CTL/web/sdk/cropperjs.js

14 lines
40 KiB
JavaScript
Raw Normal View History

2024-06-21 09:05:50 +00:00
;/*!node_modules/cropperjs/dist/cropper.js*/
amis.define("d988d9a",(function(t,e,i,a){
/*!
* Cropper.js v1.6.1
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2023-09-17T03:44:19.860Z
*/
var n,o;n=this,o=function(){"use strict";function t(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function e(e){for(var i=1;i<arguments.length;i++){var a=null!=arguments[i]?arguments[i]:{};i%2?t(Object(a),!0).forEach((function(t){o(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):t(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,s(a.key),a)}}function o(t,e,i){return(e=s(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function r(t){return function(t){if(Array.isArray(t))return h(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?h(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=new Array(e);i<e;i++)a[i]=t[i];return a}function s(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var a=i.call(t,e||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var c="undefined"!=typeof window&&void 0!==window.document,l=c?window:{},d=!(!c||!l.document.documentElement)&&"ontouchstart"in l.document.documentElement,p=!!c&&"PointerEvent"in l,m="cropper",u="all",g="crop",f="move",v="zoom",w="e",b="w",y="s",x="n",M="ne",C="nw",D="se",B="sw",k="".concat(m,"-crop"),O="".concat(m,"-disabled"),T="".concat(m,"-hidden"),E="".concat(m,"-hide"),W="".concat(m,"-invisible"),H="".concat(m,"-modal"),N="".concat(m,"-move"),L="".concat(m,"Action"),z="".concat(m,"Preview"),Y="crop",X="move",R="none",S="crop",j="cropend",A="cropmove",P="cropstart",I="dblclick",U=p?"pointerdown":d?"touchstart":"mousedown",q=p?"pointermove":d?"touchmove":"mousemove",$=p?"pointerup pointercancel":d?"touchend touchcancel":"mouseup",Q="ready",K="resize",Z="wheel",G="zoom",V="image/jpeg",F=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,J=/^data:/,_=/^data:image\/jpeg;base64,/,tt=/^img|canvas$/i,et={viewMode:0,dragMode:Y,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},it=Number.isNaN||l.isNaN;function at(t){return"number"==typeof t&&!it(t)}var nt=function(t){return t>0&&t<1/0};function ot(t){return void 0===t}function rt(t){return"object"===i(t)&&null!==t}var ht=Object.prototype.hasOwnProperty;function st(t){if(!rt(t))return!1;try{var e=t.constru
;/*!node_modules/react-cropper/dist/react-cropper.umd.js*/
amis.define("ccb4010",(function(e,o,r,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var n=e("ce101d6"),a=e("d988d9a"),c=function(){return c=Object.assign||function(e){for(var o,r=1,t=arguments.length;r<t;r++)for(var n in o=arguments[r])Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]);return e},c.apply(this,arguments)};function i(e,o){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(t=Object.getOwnPropertySymbols(e);n<t.length;n++)o.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(r[t[n]]=e[t[n]])}return r}var l=["aspectRatio","autoCrop","autoCropArea","background","center","checkCrossOrigin","checkOrientation","cropBoxMovable","cropBoxResizable","data","dragMode","guides","highlight","initialAspectRatio","minCanvasHeight","minCanvasWidth","minContainerHeight","minContainerWidth","minCropBoxHeight","minCropBoxWidth","modal","movable","preview","responsive","restore","rotatable","scalable","toggleDragModeOnDblclick","viewMode","wheelZoomRatio","zoomOnTouch","zoomOnWheel","zoomable","cropstart","cropmove","cropend","crop","zoom","ready"],u={opacity:0,maxWidth:"100%"},s=n.forwardRef((function(e,o){var r=i(e,[]),t=r.dragMode,s=void 0===t?"crop":t,d=r.src,p=r.style,f=r.className,v=r.crossOrigin,m=r.scaleX,b=r.scaleY,g=r.enable,y=r.zoomTo,h=r.rotateTo,O=r.alt,T=void 0===O?"picture":O,z=r.ready,C=r.onInitialized,w=i(r,["dragMode","src","style","className","crossOrigin","scaleX","scaleY","enable","zoomTo","rotateTo","alt","ready","onInitialized"]),E={scaleY:b,scaleX:m,enable:g,zoomTo:y,rotateTo:h},M=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var r=n.useRef(null);return n.useEffect((function(){e.forEach((function(e){e&&("function"==typeof e?e(r.current):e.current=r.current)}))}),[e]),r}(o,n.useRef(null));n.useEffect((function(){var e;(null===(e=M.current)||void 0===e?void 0:e.cropper)&&"number"==typeof y&&M.current.cropper.zoomTo(y)}),[r.zoomTo]),n.useEffect((function(){var e;(null===(e=M.current)||void 0===e?void 0:e.cropper)&&void 0!==d&&M.current.cropper.reset().clear().replace(d)}),[d]),n.useEffect((function(){if(null!==M.current){var e=new a(M.current,c(c({dragMode:s},w),{ready:function(e){null!==e.currentTarget&&function(e,o){void 0===o&&(o={});var r=o.enable,t=void 0===r||r,n=o.scaleX,a=void 0===n?1:n,c=o.scaleY,i=void 0===c?1:c,l=o.zoomTo,u=void 0===l?0:l,s=o.rotateTo;t?e.enable():e.disable(),e.scaleX(a),e.scaleY(i),void 0!==s&&e.rotateTo(s),u>0&&e.zoomTo(u)}(e.currentTarget.cropper,E),z&&z(e)}}));C&&C(e)}return function(){var e,o;null===(o=null===(e=M.current)||void 0===e?void 0:e.cropper)||void 0===o||o.destroy()}}),[M]);var j=function(e){return l.reduce((function(e,o){var r=e,t=o;return r[t],i(r,["symbol"==typeof t?t:t+""])}),e)}(c(c({},w),{crossOrigin:v,src:d,alt:T}));return n.createElement("div",{style:p,className:f},n.createElement("img",c({},j,{style:u,ref:M})))}));o.Cropper=s,o.default=s}));