kdpa-components 1.52.0 → 1.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1971,4 +1971,4 @@ Message: ${on}`),on}}const isString$1=on=>typeof on=="string",isFunction$1=on=>t
1971
1971
  * @see https://react-pdf-viewer.dev
1972
1972
  * @license https://react-pdf-viewer.dev/license
1973
1973
  * @copyright 2019-2023 Nguyen Huu Phuoc <me@phuoc.ng>
1974
- */process.env.NODE_ENV==="production"?lib$g.exports=requireDefaultLayout_min():lib$g.exports=requireDefaultLayout();var libExports=lib$g.exports;const renderToolbar=(on,rn)=>jsx$1(on,{children:un=>{const{CurrentPageInput:dn,Download:pn,EnterFullScreen:fn,GoToNextPage:hn,GoToPreviousPage:gn,NumberOfPages:vn,Print:yn,Zoom:xn,ZoomIn:wn,ZoomOut:Cn}=un;return jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"20px"},children:[jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"},children:[jsx$1(Cn,{}),jsx$1(xn,{}),jsx$1(wn,{})]}),jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"},children:[jsx$1(gn,{}),jsx$1(dn,{}),jsxs("div",{style:{color:"white"},children:["/ ",jsx$1(vn,{})]}),jsx$1(hn,{})]}),jsxs("div",{style:{display:"flex",gap:"10px"},children:[jsx$1(fn,{}),jsx$1(pn,{}),jsx$1(yn,{}),jsx$1(MdClose,{size:24,onClick:()=>{rn?.()},style:{cursor:"pointer",color:"white"}})]})]})}}),KdpaPdfViewer=({fileUrl:on,handleClose:rn})=>{const un=libExports.defaultLayoutPlugin({renderToolbar:dn=>renderToolbar(dn,()=>{rn()}),sidebarTabs:dn=>[dn[0]]});return jsx$1(libExports$1.Worker,{workerUrl:"https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js",children:jsx$1(libExports$1.Viewer,{theme:"dark",fileUrl:on,plugins:[un],withCredentials:!0})})};function getDirectionNames(on,rn){var un,dn;return on&&rn?(un=""+on+rn[0].toUpperCase()+rn.slice(1),dn=on+"-"+rn):(un=on||rn,dn=on||rn),{camelCase:un,snakeCase:dn}}function isBlob(on){return/^blob:/.test(on)}function isDataUrl(on){return/^data:/.test(on)}function isLocal(on){return isBlob(on)||isDataUrl(on)}function isCrossOriginURL(on){if(isLocal(on))return!1;var rn=window.location,un=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,dn=un.exec(on)||[],pn={protocol:dn[1]||"",host:dn[2]||"",port:dn[3]||""},fn=function(gn){return gn==="http"?80:433},hn=function(gn){return gn.port||fn(gn.protocol||rn.protocol)};return!(!pn.protocol&&!pn.host&&!pn.port||pn.protocol&&pn.protocol==rn.protocol&&pn.host&&pn.host==rn.host&&pn.host&&hn(pn)==hn(rn))}function isArray(on){return Array.isArray(on)}function isFunction(on){return typeof on=="function"}function isUndefined(on){return on===void 0}var isObject=function(on){return on!==null&&typeof on=="object"};function getOptions(on,rn,un){un===void 0&&(un={});var dn={};return isObject(on)?(Object.keys(rn).forEach(function(pn){isUndefined(on[pn])?dn[pn]=rn[pn]:isObject(rn[pn])?isObject(on[pn])?dn[pn]=getOptions(on[pn],rn[pn],un[pn]):dn[pn]=on[pn]?rn[pn]:un[pn]:rn[pn]===!0||rn[pn]===!1?dn[pn]=!!on[pn]:dn[pn]=on[pn]}),dn):on?rn:un}function parseNumber(on){var rn=Number(on);return Number.isNaN(rn)?on:rn}function isBoolean(on){return on===!0||on===!1}function isNumber(on){return typeof on=="number"}function isString(on){return typeof on=="string"}function isNaN$1(on){return on!==on}function isNumeric(on){return isNumber(on)&&!isNaN$1(on)||isString(on)&&!Number.isNaN(parseFloat(on))&&isFinite(parseFloat(on))}function distance(on,rn){return Math.sqrt(Math.pow(on.left-rn.left,2)+Math.pow(on.top-rn.top,2))}function isRoughlyEqual(on,rn,un){return un===void 0&&(un=.001),Math.abs(rn-on)<un}function isGreater(on,rn,un){return isRoughlyEqual(on,rn,un)?!1:on>rn}function isLower(on,rn,un){return isRoughlyEqual(on,rn,un)?!1:on<rn}function sign(on){var rn=+on;return rn===0||isNaN$1(rn)?rn:rn>0?1:-1}function promiseTimeout(on){return new Promise(function(rn){setTimeout(function(){rn()},on)})}function deepClone(on){if(!isObject(on))return on;var rn={};return Array.isArray(on)?rn=on.map(function(un){return deepClone(un)}):Object.keys(on).forEach(function(un){return rn[un]=deepClone(on[un])}),rn}function deepCompare(on,rn,un){if(un===void 0&&(un=.001),isNumber(on)&&isNumber(rn)&&isRoughlyEqual(on,rn,un)||on===rn)return!0;if(on&&rn&&typeof on=="object"&&typeof rn=="object"){if(on.constructor!==rn.constructor)return!1;var dn,pn=void 0;if(Array.isArray(on)){if(dn=on.length,dn!=rn.length)return!1;for(pn=dn;pn--!==0;)if(!deepCompare(on[pn],rn[pn],un))return!1;return!0}if(on.valueOf!==Object.prototype.valueOf)return on.valueOf()===rn.valueOf();if(on.toString!==Object.prototype.toString)return on.toString()===rn.toString();var fn=Object.keys(on);if(dn=fn.length,dn!==Object.keys(rn).length)return!1;for(pn=dn;pn--!==0;)if(!Object.prototype.hasOwnProperty.call(rn,fn[pn]))return!1;for(pn=dn;pn--!==0;){var hn=fn[pn];if(!deepCompare(on[hn],rn[hn],un))return!1}return!0}return on!==on&&rn!==rn}function emptyCoordinates(){return{left:0,top:0,width:0,height:0}}function isCardinalDirection(on){return on==="west"||on==="south"||on==="north"||on==="east"}function debounce(on,rn){var un,dn;function pn(){for(var hn=[],gn=0;gn<arguments.length;gn++)hn[gn]=arguments[gn];var vn=Date.now()-un,yn=isFunction(rn)?rn():rn||0;vn<yn&&vn>=0?dn=setTimeout(function(){return pn.apply(void 0,hn)},yn-vn):on.apply(void 0,hn)}function fn(){for(var hn=[],gn=0;gn<arguments.length;gn++)hn[gn]=arguments[gn];un=Date.now(),dn=setTimeout(function(){return pn.apply(void 0,hn)},isFunction(rn)?rn():rn||0)}return fn.clear=function(){clearTimeout(dn)},fn}var ALL_DIRECTIONS=["left","right","top","bottom"],HORIZONTAL_DIRECTIONS$1=["left","right"],VERTICAL_DIRECTIONS$1=["top","bottom"];function diff(on,rn){return{left:on.left-rn.left,top:on.top-rn.top}}function getCenter(on){return{left:on.left+on.width/2,top:on.top+on.height/2}}function getOppositeSide(on){return{left:"right",top:"bottom",right:"left",bottom:"top"}[on]}function sizeDistance(on,rn){return Math.pow(on.width-rn.width,2)+Math.pow(on.height-rn.height,2)}function applyDirections(on,rn){return{left:on.left-rn.left,top:on.top-rn.top,width:on.width+rn.left+rn.right,height:on.height+rn.top+rn.bottom}}function inverseMove(on){return{left:-on.left,top:-on.top}}function applyMove(on,rn){return __assign(__assign({},on),{left:on.left+rn.left,top:on.top+rn.top})}function coordinatesToPositionRestrictions(on){return{left:on.left,top:on.top,right:on.left+on.width,bottom:on.top+on.height}}function applyScale(on,rn,un,dn){if(rn!==1)if("left"in on||"top"in on)if(un){var pn=getCenter(on);return{width:on.width*rn,height:on.height*rn,left:on.left+on.width*(1-rn)/2+(un.left-pn.left)*(1-rn),top:on.top+on.height*(1-rn)/2+(un.top-pn.top)*(1-rn)}}else return{width:on.width*rn,height:on.height*rn,left:on.left+on.width*(1-rn)/2,top:on.top+on.height*(1-rn)/2};else return{width:on.width*rn,height:on.height*rn};else return on}function ratio(on){return on.width/on.height}function maxScale(on,rn){return Math.min(rn.maxWidth?rn.maxWidth/on.width:1/0,rn.maxHeight?rn.maxHeight/on.height:1/0)}function minScale(on,rn){return Math.max(rn.minWidth?rn.minWidth/on.width:0,rn.minHeight?rn.minHeight/on.height:0)}function getBrokenRatio(on,rn){var un;return rn.minimum&&isLower(on,rn.minimum)?un=rn.minimum:rn.maximum&&isGreater(on,rn.maximum)&&(un=rn.maximum),un}function fitToSizeRestrictions(on,rn){var un=ratio(on),dn=1;return rn.minWidth>0&&rn.minHeight>0?un>rn.minWidth/rn.minHeight?on.height<rn.minHeight&&(dn=rn.minHeight/on.height):on.width<rn.minWidth&&(dn=rn.minWidth/on.width):rn.minWidth>0?on.width<rn.minWidth&&(dn=rn.minWidth/on.width):rn.minHeight>0&&on.height<rn.minHeight&&(dn=rn.minHeight/on.height),rn.maxWidth<1/0&&rn.maxHeight<1/0?un>rn.maxWidth/rn.maxHeight?on.width>rn.maxWidth&&(dn=rn.maxWidth/on.width):on.height>rn.maxHeight&&(dn=rn.maxHeight/on.height):rn.maxWidth<1/0?on.width>rn.maxWidth&&(dn=rn.maxWidth/on.width):rn.maxHeight<1/0&&on.height>rn.maxHeight&&(dn=rn.maxHeight/on.height),dn}function getIntersections(on,rn){var un={left:0,top:0,right:0,bottom:0};return ALL_DIRECTIONS.forEach(function(dn){var pn=rn[dn],fn=coordinatesToPositionRestrictions(on)[dn];pn!==void 0&&fn!==void 0?dn==="left"||dn==="top"?un[dn]=Math.max(0,pn-fn):un[dn]=Math.max(0,fn-pn):un[dn]=0}),un}function resizeToSizeRestrictions(on,rn){return applyScale(on,fitToSizeRestrictions(on,rn))}function rotateSize(on,rn){var un=rn*Math.PI/180;return{width:Math.abs(on.width*Math.cos(un))+Math.abs(on.height*Math.sin(un)),height:Math.abs(on.width*Math.sin(un))+Math.abs(on.height*Math.cos(un))}}function rotatePoint(on,rn,un){var dn=rn*Math.PI/180;return un?{left:(on.left-un.left)*Math.cos(dn)-(on.top-un.top)*Math.sin(dn)+un.left,top:(on.left-un.left)*Math.sin(dn)+(on.top-un.top)*Math.cos(dn)+un.top}:{left:on.left*Math.cos(dn)-on.top*Math.sin(dn),top:on.left*Math.sin(dn)+on.top*Math.cos(dn)}}function positionToSizeRestrictions(on){return{minWidth:0,minHeight:0,maxWidth:on.right!==void 0&&on.left!==void 0?on.right-on.left:1/0,maxHeight:on.bottom!==void 0&&on.top!==void 0?on.bottom-on.top:1/0}}function mergePositionRestrictions(on,rn){var un={};return ALL_DIRECTIONS.forEach(function(dn){var pn=on[dn],fn=rn[dn];pn!==void 0&&fn!==void 0?dn==="left"||dn==="top"?un[dn]=Math.max(pn,fn):un[dn]=Math.min(pn,fn):fn!==void 0?un[dn]=fn:pn!==void 0&&(un[dn]=pn)}),un}function fitToPositionRestrictions(on,rn){var un={left:0,top:0},dn=getIntersections(on,rn);return dn.left&&dn.left>0?un.left=dn.left:dn.right&&dn.right>0&&(un.left=-dn.right),dn.top&&dn.top>0?un.top=dn.top:dn.bottom&&dn.bottom>0&&(un.top=-dn.bottom),un}function moveToPositionRestrictions(on,rn){return applyMove(on,fitToPositionRestrictions(on,rn))}function aspectRatioIntersection(on,rn){return rn?on?{minimum:Math.min(on.maximum,Math.max(on.minimum,rn.minimum)),maximum:Math.max(on.minimum,Math.min(on.maximum,rn.maximum))}:rn:on}function createAspectRatio(on){return on===void 0&&(on={}),isNumber(on)?{minimum:on,maximum:on}:{minimum:isNumeric(on.minimum)?on.minimum:0,maximum:isNumeric(on.maximum)?on.maximum:1/0}}function isConsistentSize(on,rn){return(isUndefined(rn.maxWidth)||!isGreater(on.width,rn.maxWidth))&&(isUndefined(rn.maxHeight)||!isGreater(on.height,rn.maxHeight))&&(isUndefined(rn.minHeight)||!isLower(on.height,rn.minHeight))&&(isUndefined(rn.minWidth)||!isLower(on.width,rn.minWidth))}function isConsistentPosition(on,rn){return(isUndefined(rn.left)||!isLower(on.left,rn.left))&&(isUndefined(rn.top)||!isLower(on.top,rn.top))&&(isUndefined(rn.right)||!isGreater(on.left+on.width,rn.right))&&(isUndefined(rn.bottom)||!isGreater(on.top+on.height,rn.bottom))}function getCloserSize(on,rn,un,dn){var pn=function(fn){return on.reduce(function(hn,gn){var vn=isFunction(un)?un(gn):un,yn=vn.maxHeight,xn=vn.maxWidth,wn=vn.minWidth,Cn=vn.minHeight,Tn=createAspectRatio(isFunction(dn)?dn(gn):dn),Pn=fn?{maxWidth:xn,maxHeight:yn}:{maxWidth:xn,maxHeight:yn,minWidth:wn,minHeight:Cn};return isConsistentSize(gn,Pn)&&!getBrokenRatio(ratio(gn),Tn)&&gn.width&&gn.height&&(!hn||isLower(sizeDistance(gn,rn),sizeDistance(hn,rn)))?gn:hn},null)};return pn()||pn(!0)}function isInitializedState(on){return!!(on&&on.visibleArea&&on.coordinates)}function getAreaSizeRestrictions(on,rn){return calculateAreaSizeRestrictions(on,rn)}function getAreaPositionRestrictions(on,rn){return isFunction(rn.areaPositionRestrictions)?rn.areaPositionRestrictions(on,rn):rn.areaPositionRestrictions}function getSizeRestrictions(on,rn){return calculateSizeRestrictions(on,rn)}function getPositionRestrictions(on,rn){return isFunction(rn.positionRestrictions)?rn.positionRestrictions(on,rn):rn.positionRestrictions}function getCoefficient(on){return on.visibleArea?on.visibleArea.width/on.boundary.width:0}function getStencilCoordinates(on){if(isInitializedState(on)){var rn=on.coordinates,un=rn.width,dn=rn.height,pn=rn.left,fn=rn.top,hn=getCoefficient(on);return{width:un/hn,height:dn/hn,left:(pn-on.visibleArea.left)/hn,top:(fn-on.visibleArea.top)/hn}}else return emptyCoordinates()}function getAspectRatio(on,rn){return createAspectRatio(isFunction(rn.aspectRatio)?rn.aspectRatio(on,rn):rn.aspectRatio)}function getDefaultCoordinates(on,rn){return isFunction(rn.defaultCoordinates)?rn.defaultCoordinates(on,rn):rn.defaultCoordinates}function getDefaultVisibleArea(on,rn){return isFunction(rn.defaultVisibleArea)?rn.defaultVisibleArea(on,rn):rn.defaultVisibleArea}function getDefaultTransforms(on,rn){var un=__assign(__assign({},on.transforms),{flip:__assign({},on.transforms.flip)});if(rn.defaultTransforms){var dn=isFunction(rn.defaultTransforms)?rn.defaultTransforms(on,rn):rn.defaultTransforms;isNumber(dn.rotate)&&(un.rotate=dn.rotate),dn.flip&&(isBoolean(dn.flip.horizontal)&&(un.flip.horizontal=dn.flip.horizontal),isBoolean(dn.flip.vertical)&&(un.flip.vertical=dn.flip.vertical))}return un}function getTransformedImageSize(on){return on.imageSize&&on.imageSize.width&&on.imageSize.height?rotateSize(on.imageSize,on.transforms.rotate):{width:0,height:0}}function getMinimumSize(on){return on.coordinates?Math.min(on.coordinates.width,on.coordinates.height,20*getCoefficient(on)):1}function getRoundedCoordinates(on,rn){if(isInitializedState(on)){var un=getSizeRestrictions(on,rn),dn=getPositionRestrictions(on,rn),pn={width:Math.round(on.coordinates.width),height:Math.round(on.coordinates.height),left:Math.round(on.coordinates.left),top:Math.round(on.coordinates.top)};return pn.width>un.maxWidth?pn.width=Math.floor(on.coordinates.width):pn.width<un.minWidth&&(pn.width=Math.ceil(on.coordinates.width)),pn.height>un.maxHeight?pn.height=Math.floor(on.coordinates.height):pn.height<un.minHeight&&(pn.height=Math.ceil(on.coordinates.height)),moveToPositionRestrictions(pn,dn)}else return null}function isConsistentState(on,rn){return isInitializedState(on)?!getBrokenRatio(ratio(on.coordinates),getAspectRatio(on,rn))&&isConsistentSize(on.visibleArea,getAreaSizeRestrictions(on,rn))&&isConsistentSize(on.coordinates,getSizeRestrictions(on,rn))&&isConsistentPosition(on.visibleArea,getAreaPositionRestrictions(on,rn))&&isConsistentPosition(on.coordinates,getPositionRestrictions(on,rn)):!0}function reconcileSizeRestrictions(on){var rn=__assign({},on);return rn.minWidth>rn.maxWidth&&(rn.minWidth=rn.maxWidth),rn.minHeight>rn.maxHeight&&(rn.minHeight=rn.maxHeight),rn}function mergeSizeRestrictions(on,rn){var un=on,dn=__assign({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},rn);return reconcileSizeRestrictions({maxHeight:Math.min(un.maxHeight,dn.maxHeight),minHeight:Math.max(un.minHeight,dn.minHeight),maxWidth:Math.min(un.maxWidth,dn.maxWidth),minWidth:Math.max(un.minWidth,dn.minWidth)})}function calculateSizeRestrictions(on,rn){var un=isFunction(rn.sizeRestrictions)?rn.sizeRestrictions(on,rn):rn.sizeRestrictions,dn=getPositionRestrictions(on,rn),pn={minWidth:isNumeric(un.minWidth)?parseNumber(un.minWidth):0,minHeight:isNumeric(un.minHeight)?parseNumber(un.minHeight):0,maxWidth:isNumeric(un.maxWidth)?parseNumber(un.maxWidth):1/0,maxHeight:isNumeric(un.maxHeight)?parseNumber(un.maxHeight):1/0};return dn.left!==void 0&&dn.right!==void 0&&(pn.maxWidth=Math.min(pn.maxWidth,dn.right-dn.left)),dn.bottom!==void 0&&dn.top!==void 0&&(pn.maxHeight=Math.min(pn.maxHeight,dn.bottom-dn.top)),reconcileSizeRestrictions(pn)}function calculateAreaSizeRestrictions(on,rn){var un=isFunction(rn.areaSizeRestrictions)?rn.areaSizeRestrictions(on,rn):rn.areaSizeRestrictions;return un.maxWidth<1/0&&un.maxHeight<1/0&&(ratio(on.boundary)>un.maxWidth/un.maxHeight?un.maxHeight=un.maxWidth/ratio(on.boundary):un.maxWidth=un.maxHeight*ratio(on.boundary)),reconcileSizeRestrictions(un)}function copyState(on){return deepClone(on)}var ImageRestriction;(function(on){on.fillArea="fillArea",on.fitArea="fitArea",on.stencil="stencil",on.none="none"})(ImageRestriction||(ImageRestriction={}));var Priority;(function(on){on.coordinates="coordinates",on.visibleArea="visibleArea"})(Priority||(Priority={}));function approximateSize(on){var rn=on.width,un=on.height,dn=on.sizeRestrictions||{minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},pn=createAspectRatio(on.aspectRatio),fn={width:Math.max(dn.minWidth,Math.min(dn.maxWidth,rn)),height:Math.max(dn.minHeight,Math.min(dn.maxHeight,un))},hn=[fn];return pn&&[pn.minimum,pn.maximum].forEach(function(gn){gn&&hn.push({width:fn.width,height:fn.width/gn},{width:fn.height*gn,height:fn.height})}),hn=hn.map(function(gn){return resizeToSizeRestrictions(gn,dn)}),getCloserSize(hn,{width:rn,height:un},dn,pn)}function fitVisibleArea(on,rn){var un=copyState(on);if(on.visibleArea){var dn=getAreaSizeRestrictions(on,rn);un.visibleArea=__assign(__assign({},on.visibleArea),approximateSize({width:on.visibleArea.width,height:on.visibleArea.height,aspectRatio:{minimum:ratio(un.boundary),maximum:ratio(un.boundary)},sizeRestrictions:dn})),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(on.visibleArea),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn))}return un}function moveCoordinatesAlgorithm(on,rn,un){var dn=applyMove(on,rn);return un?moveToPositionRestrictions(dn,un):dn}var SetCoordinatesMode;(function(on){on.limit="limit",on.zoom="zoom",on.unsafe="unsafe"})(SetCoordinatesMode||(SetCoordinatesMode={}));function setCoordinates(on,rn,un,dn){dn===void 0&&(dn=!0);var pn=dn===!1?SetCoordinatesMode.unsafe:dn===!0?SetCoordinatesMode.zoom:dn,fn=getAspectRatio(on,rn),hn=getSizeRestrictions(on,rn);on.visibleArea&&pn===SetCoordinatesMode.limit&&(hn=__assign(__assign({},hn),{minWidth:Math.min(on.visibleArea.width,hn.minWidth),minHeight:Math.min(on.visibleArea.height,hn.minHeight),maxWidth:Math.min(on.visibleArea.width,hn.maxWidth),maxHeight:Math.min(on.visibleArea.height,hn.maxHeight)}));var gn=getPositionRestrictions(on,rn);on.visibleArea&&pn===SetCoordinatesMode.limit&&(gn=mergePositionRestrictions(gn,coordinatesToPositionRestrictions(on.visibleArea)));var vn=function(_n,Rn){return moveCoordinatesAlgorithm(_n,{left:Rn.left-(_n.left||0),top:Rn.top-(_n.top||0)},gn)},yn=function(_n,Rn){var $n=__assign(__assign(__assign({},_n),approximateSize({width:Rn.width,height:Rn.height,sizeRestrictions:hn,aspectRatio:fn})),{left:0,top:0});return vn($n,{left:_n.left||0,top:_n.top||0})},xn=on.coordinates?__assign({},on.coordinates):emptyCoordinates(),wn=Array.isArray(un)?un:[un];wn.forEach(function(_n){var Rn;typeof _n=="function"?Rn=_n(__assign(__assign({},on),{coordinates:xn}),rn):Rn=_n,Rn&&((!isUndefined(Rn.width)||!isUndefined(Rn.height))&&(xn=yn(xn,__assign(__assign({},xn),Rn))),(!isUndefined(Rn.left)||!isUndefined(Rn.top))&&(xn=vn(xn,__assign(__assign({},xn),Rn))))});var Cn=__assign(__assign({},copyState(on)),{coordinates:xn});if(Cn.visibleArea&&pn===SetCoordinatesMode.zoom){var Tn=Math.max(0,Cn.coordinates.width-Cn.visibleArea.width),Pn=Math.max(0,Cn.coordinates.height-Cn.visibleArea.height),Sn=getAreaSizeRestrictions(on,rn),En=Tn>Pn?Cn.coordinates.width/Cn.visibleArea.width:Cn.coordinates.height/Cn.visibleArea.height;return En>1&&(Cn.visibleArea=applyScale(Cn.visibleArea,Math.min(En,maxScale(Cn.visibleArea,Sn)))),Cn.visibleArea=applyMove(Cn.visibleArea,inverseMove(fitToPositionRestrictions(Cn.coordinates,coordinatesToPositionRestrictions(Cn.visibleArea)))),fitVisibleArea(Cn,rn)}else return Cn}function fitCoordinates(on,rn){if(on.coordinates){var un=copyState(on),dn=getAspectRatio(on,rn),pn=getSizeRestrictions(on,rn);return un.coordinates=__assign(__assign({},on.coordinates),approximateSize({width:on.coordinates.width,height:on.coordinates.height,aspectRatio:dn,sizeRestrictions:on.visibleArea?{maxWidth:Math.min(on.visibleArea.width,pn.maxWidth),maxHeight:Math.min(on.visibleArea.height,pn.maxHeight),minHeight:Math.min(on.visibleArea.height,pn.minHeight),minWidth:Math.min(on.visibleArea.width,pn.minWidth)}:pn})),un.coordinates=applyMove(un.coordinates,diff(getCenter(on.coordinates),getCenter(un.coordinates))),un.coordinates=moveToPositionRestrictions(un.coordinates,on.visibleArea?mergePositionRestrictions(coordinatesToPositionRestrictions(on.visibleArea),getPositionRestrictions(un,rn)):getPositionRestrictions(un,rn)),un}return on}function setVisibleArea(on,rn,un,dn){dn===void 0&&(dn=!0);var pn=__assign(__assign({},copyState(on)),{visibleArea:un});return pn=fitVisibleArea(pn,rn),dn&&(pn=fitCoordinates(pn,rn)),pn}function createState(on,rn){var un,dn,pn,fn,hn,gn=on.boundary,vn=on.image,yn={boundary:{width:gn.width,height:gn.height},imageSize:{width:vn.width,height:vn.height},transforms:{rotate:((un=vn.transforms)===null||un===void 0?void 0:un.rotate)||0,flip:{horizontal:((pn=(dn=vn.transforms)===null||dn===void 0?void 0:dn.flip)===null||pn===void 0?void 0:pn.horizontal)||!1,vertical:((hn=(fn=vn.transforms)===null||fn===void 0?void 0:fn.flip)===null||hn===void 0?void 0:hn.vertical)||!1}},visibleArea:null,coordinates:null};return rn.defaultTransforms&&(yn.transforms=getDefaultTransforms(yn,rn)),rn.priority===Priority.visibleArea?(yn=setVisibleArea(yn,rn,getDefaultVisibleArea(yn,rn),!1),yn=setCoordinates(yn,rn,getDefaultCoordinates(yn,rn),SetCoordinatesMode.limit)):(yn=setCoordinates(yn,rn,getDefaultCoordinates(yn,rn),SetCoordinatesMode.unsafe),yn=setVisibleArea(yn,rn,getDefaultVisibleArea(yn,rn),!0)),yn}function moveCoordinates(on,rn,un){if(isInitializedState(on)){var dn=copyState(on);return dn.coordinates=applyMove(dn.coordinates,un),dn.coordinates=moveToPositionRestrictions(dn.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(dn.visibleArea),getPositionRestrictions(dn,rn))),dn}return on}function fitDirections(on){var rn=on.coordinates,un=on.directions,dn=on.positionRestrictions,pn=on.sizeRestrictions,fn=on.preserveRatio,hn=on.allowedDirections,gn=on.compensate,vn=gn===void 0?!0:gn,yn=__assign({},un),xn=applyDirections(rn,yn).width,wn=applyDirections(rn,yn).height;xn<0&&(yn.left<0&&yn.right<0?(yn.left=-(rn.width-pn.minWidth)/(yn.left/yn.right),yn.right=-(rn.width-pn.minWidth)/(yn.right/yn.left)):yn.left<0?yn.left=-(rn.width-pn.minWidth):yn.right<0&&(yn.right=-(rn.width-pn.minWidth))),wn<0&&(yn.top<0&&yn.bottom<0?(yn.top=-(rn.height-pn.minHeight)/(yn.top/yn.bottom),yn.bottom=-(rn.height-pn.minHeight)/(yn.bottom/yn.top)):yn.top<0?yn.top=-(rn.height-pn.minHeight):yn.bottom<0&&(yn.bottom=-(rn.height-pn.minHeight)));var Cn=getIntersections(applyDirections(rn,yn),dn),Tn=ALL_DIRECTIONS.every(function(_n){return!isGreater(Cn[getOppositeSide(_n)],0)||hn[_n]});vn&&Tn&&(Cn.left&&Cn.left>0&&Cn.right===0?(yn.right+=Cn.left,yn.left-=Cn.left):Cn.right&&Cn.right>0&&Cn.left===0&&(yn.left+=Cn.right,yn.right-=Cn.right),Cn.top&&Cn.top>0&&Cn.bottom===0?(yn.bottom+=Cn.top,yn.top-=Cn.top):Cn.bottom&&Cn.bottom>0&&Cn.top===0&&(yn.top+=Cn.bottom,yn.bottom-=Cn.bottom),Cn=getIntersections(applyDirections(rn,yn),dn));var Pn={width:1/0,height:1/0,left:1/0,right:1/0,top:1/0,bottom:1/0};if(ALL_DIRECTIONS.forEach(function(_n){var Rn=Cn[_n];Rn&&yn[_n]&&(Pn[_n]=Math.max(0,1-Rn/yn[_n]))}),fn){var Sn=Math.min.apply(Math,ALL_DIRECTIONS.map(function(_n){return Pn[_n]}));Sn!==1/0&&ALL_DIRECTIONS.forEach(function(_n){yn[_n]*=Sn})}else ALL_DIRECTIONS.forEach(function(_n){Pn[_n]!==1/0&&(yn[_n]*=Pn[_n])});if(xn=applyDirections(rn,yn).width,wn=applyDirections(rn,yn).height,yn.right+yn.left&&(xn>pn.maxWidth?Pn.width=(pn.maxWidth-rn.width)/(yn.right+yn.left):xn<pn.minWidth&&(Pn.width=(pn.minWidth-rn.width)/(yn.right+yn.left))),yn.bottom+yn.top&&(wn>pn.maxHeight?Pn.height=(pn.maxHeight-rn.height)/(yn.bottom+yn.top):wn<pn.minHeight&&(Pn.height=(pn.minHeight-rn.height)/(yn.bottom+yn.top))),fn){var En=Math.min(Pn.width,Pn.height);En!==1/0&&ALL_DIRECTIONS.forEach(function(_n){yn[_n]*=En})}else Pn.width!==1/0&&HORIZONTAL_DIRECTIONS$1.forEach(function(_n){yn[_n]*=Pn.width}),Pn.height!==1/0&&VERTICAL_DIRECTIONS$1.forEach(function(_n){yn[_n]*=Pn.height});return yn}function distributeOverlap(on,rn,un){return isRoughlyEqual(rn+un,0)?on/2:isRoughlyEqual(rn,0)?0:isRoughlyEqual(un,0)?on:on*Math.abs(rn/(rn+un))}function resizeCoordinatesAlgorithm(on,rn,un,dn){var pn=dn.aspectRatio,fn=dn.positionRestrictions,hn=dn.sizeRestrictions,gn=__assign({},on);rn=__assign({},rn);var vn=un.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};on.width<hn.minWidth&&(rn.left=0,rn.right=0),on.height<hn.minHeight&&(rn.top=0,rn.bottom=0),ALL_DIRECTIONS.forEach(function($n){vn[$n]||(rn[$n]=0)}),rn=fitDirections({coordinates:gn,directions:rn,sizeRestrictions:hn,positionRestrictions:fn,allowedDirections:vn});var yn=applyDirections(gn,rn).width,xn=applyDirections(gn,rn).height,wn=un.preserveAspectRatio?ratio(gn):getBrokenRatio(yn/xn,pn);if(wn){var Cn=un.respectDirection;if(Cn!=="width"&&Cn!=="height"&&(gn.width>=gn.height||wn===1?Cn="width":Cn="height"),Cn==="width"){var Tn=yn/wn-gn.height;if(vn.top&&vn.bottom){var Pn=rn.top,Sn=rn.bottom;rn.bottom=distributeOverlap(Tn,Sn,Pn),rn.top=distributeOverlap(Tn,Pn,Sn)}else vn.bottom?rn.bottom=Tn:vn.top?rn.top=Tn:vn.right?rn.right=0:vn.left&&(rn.left=0)}else if(Cn==="height"){var En=gn.width-xn*wn;if(vn.left&&vn.right){var _n=rn.left,Rn=rn.right;rn.left=-distributeOverlap(En,_n,Rn),rn.right=-distributeOverlap(En,Rn,_n)}else vn.left?rn.left=-En:vn.right?rn.right=-En:vn.top?rn.top=0:vn.bottom&&(rn.bottom=0)}rn=fitDirections({directions:rn,coordinates:gn,sizeRestrictions:hn,positionRestrictions:fn,preserveRatio:!0,compensate:un.compensate,allowedDirections:vn})}return yn=applyDirections(gn,rn).width,xn=applyDirections(gn,rn).height,wn=un.preserveAspectRatio?ratio(gn):getBrokenRatio(yn/xn,pn),wn&&isGreater(Math.abs(wn-yn/xn),0)&&ALL_DIRECTIONS.forEach(function($n){rn[$n]=0}),moveCoordinatesAlgorithm({width:on.width+rn.right+rn.left,height:on.height+rn.top+rn.bottom,left:on.left,top:on.top},{left:-rn.left,top:-rn.top},fn)}function anchorToMassPoint(on,rn){var un=rn.toLowerCase();return{left:on.left+on.width*(un.indexOf("west")!==-1?1:un.indexOf("east")!==-1?0:.5),top:on.top+on.height*(un.indexOf("north")!==-1?1:un.indexOf("south")!==-1?0:.5)}}function anchorToAllowedDirections(on){var rn=on.toLowerCase();return{left:rn.indexOf("east")===-1,top:rn.indexOf("south")===-1,right:rn.indexOf("west")===-1,bottom:rn.indexOf("north")===-1}}function anchorMoveToResizeDirections(on,rn){var un=on.toLowerCase(),dn={left:un.indexOf("west")===-1?rn.left:-rn.left,top:-rn.top,right:rn.left,bottom:rn.top};["north","south","center"].every(function(fn){return un.indexOf(fn)===-1})&&(dn.top=0,dn.bottom=0),["west","east","center"].every(function(fn){return un.indexOf(fn)===-1})&&(dn.left=0,dn.right=0);var pn=anchorToAllowedDirections(on);return ALL_DIRECTIONS.forEach(function(fn){pn[fn]||(dn[fn]=0)}),dn}function anchoredResizeCoordinatesAlgorithm(on,rn,un,dn,pn){var fn=dn.reference,hn=anchorMoveToResizeDirections(rn,un),gn=anchorToAllowedDirections(rn),vn=resizeCoordinatesAlgorithm(on,hn,__assign(__assign({},dn),{allowedDirections:gn}),pn);return fn&&(vn=applyMove(vn,diff(anchorToMassPoint(fn,rn),anchorToMassPoint(vn,rn)))),moveToPositionRestrictions(vn,pn.positionRestrictions)}function resizeCoordinates(on,rn,un,dn,pn){var fn=getMinimumSize(on),hn=getSizeRestrictions(on,rn);return isInitializedState(on)?__assign(__assign({},copyState(on)),{coordinates:anchoredResizeCoordinatesAlgorithm(on.coordinates,un,dn,pn,{positionRestrictions:mergePositionRestrictions(getPositionRestrictions(on,rn),coordinatesToPositionRestrictions(on.visibleArea)),sizeRestrictions:{maxWidth:Math.min(hn.maxWidth,on.visibleArea.width),maxHeight:Math.min(hn.maxHeight,on.visibleArea.height),minWidth:Math.max(Math.min(hn.minWidth,on.visibleArea.width),fn),minHeight:Math.max(Math.min(hn.minHeight,on.visibleArea.height),fn)},aspectRatio:getAspectRatio(on,rn)})}):on}function setBoundary(on,rn,un){var dn=__assign(__assign({},copyState(on)),{boundary:un});if(dn.visibleArea&&dn.coordinates&&on.visibleArea){dn.visibleArea.height=dn.visibleArea.width/ratio(un),dn.visibleArea.top+=(on.visibleArea.height-dn.visibleArea.height)/2;var pn=getSizeRestrictions(dn,rn);(Math.max(pn.minHeight,dn.coordinates.height)-dn.visibleArea.height>0||Math.max(pn.minWidth,dn.coordinates.width)-dn.visibleArea.width>0)&&(dn.visibleArea=applyScale(dn.visibleArea,Math.max(Math.max(pn.minHeight,dn.coordinates.height)/dn.visibleArea.height,Math.max(pn.minWidth,dn.coordinates.width)/dn.visibleArea.width))),dn.visibleArea=resizeToSizeRestrictions(dn.visibleArea,getAreaSizeRestrictions(dn,rn));var fn=inverseMove(fitToPositionRestrictions(dn.coordinates,coordinatesToPositionRestrictions(dn.visibleArea)));dn.visibleArea.width<dn.coordinates.width&&(fn.left=0),dn.visibleArea.height<dn.coordinates.height&&(fn.top=0),dn.visibleArea=applyMove(dn.visibleArea,fn),dn.visibleArea=moveToPositionRestrictions(dn.visibleArea,getAreaPositionRestrictions(dn,rn)),dn=fitCoordinates(dn,rn)}return dn}function rotateImageAlgorithm(on,rn,un){if(isInitializedState(on)){var dn=copyState(on),pn=isNumber(un)?un:un.angle,fn=rotatePoint(getCenter(__assign({left:0,top:0},getTransformedImageSize(on))),pn);dn.transforms.rotate+=pn,dn.coordinates=__assign(__assign({},approximateSize({sizeRestrictions:getSizeRestrictions(dn,rn),aspectRatio:getAspectRatio(dn,rn),width:dn.coordinates.width,height:dn.coordinates.height})),rotatePoint(getCenter(dn.coordinates),pn));var hn=!isNumber(un)&&un.center?un.center:getCenter(on.coordinates),gn=diff(getCenter(on.coordinates),rotatePoint(getCenter(on.coordinates),pn,hn)),vn=getTransformedImageSize(dn);return dn.coordinates.left-=fn.left-vn.width/2+dn.coordinates.width/2-gn.left,dn.coordinates.top-=fn.top-vn.height/2+dn.coordinates.height/2-gn.top,dn.visibleArea=resizeToSizeRestrictions(dn.visibleArea,mergeSizeRestrictions(getAreaSizeRestrictions(dn,rn),{minWidth:dn.coordinates.width,minHeight:dn.coordinates.height})),dn.coordinates=moveToPositionRestrictions(dn.coordinates,getPositionRestrictions(dn,rn)),dn.visibleArea=applyMove(dn.visibleArea,diff(getCenter(dn.coordinates),getCenter(on.coordinates))),dn.visibleArea=moveToPositionRestrictions(dn.visibleArea,getAreaPositionRestrictions(dn,rn)),dn}return on}function flipImageAlgorithm(on,rn,un,dn){if(isInitializedState(on)){var pn=copyState(on),fn=on.transforms.rotate,hn=getTransformedImageSize(on),gn={horizontal:un,vertical:dn};if(gn.horizontal||gn.vertical){var vn=rotatePoint({left:hn.width/2,top:hn.height/2},-fn),yn=rotatePoint(getCenter(pn.coordinates),-fn),xn=rotatePoint({left:gn.horizontal?vn.left-(yn.left-vn.left):yn.left,top:gn.vertical?vn.top-(yn.top-vn.top):yn.top},fn);pn.coordinates=applyMove(pn.coordinates,diff(xn,getCenter(pn.coordinates))),yn=rotatePoint(getCenter(pn.visibleArea),-fn),xn=rotatePoint({left:gn.horizontal?vn.left-(yn.left-vn.left):yn.left,top:gn.vertical?vn.top-(yn.top-vn.top):yn.top},fn),pn.visibleArea=applyMove(pn.visibleArea,diff(xn,getCenter(pn.visibleArea))),pn.visibleArea=moveToPositionRestrictions(pn.visibleArea,getAreaPositionRestrictions(pn,rn))}return gn.horizontal&&(pn.transforms.flip.horizontal=!on.transforms.flip.horizontal),gn.vertical&&(pn.transforms.flip.vertical=!on.transforms.flip.vertical),pn}return on}function transformImageAlgorithm(on,rn,un){var dn,pn=un.scale,fn=pn===void 0?1:pn,hn=un.move,gn=hn===void 0?{}:hn;if(isInitializedState(on)){var vn=copyState(on),yn=1/(isNumber(fn)?fn:fn.factor),xn=isNumber(fn)?void 0:fn.center,wn=!isRoughlyEqual(yn,1),Cn=1,Tn=1;vn.visibleArea=applyMove(vn.visibleArea,{left:gn.left||0,top:gn.top||0});var Pn=getSizeRestrictions(vn,rn),Sn=getPositionRestrictions(vn,rn),En=getAreaSizeRestrictions(vn,rn),_n={stencil:{minimum:Math.max(Pn.minWidth?Pn.minWidth/vn.coordinates.width:0,Pn.minHeight?Pn.minHeight/vn.coordinates.height:0),maximum:Math.min(Pn.maxWidth?Pn.maxWidth/vn.coordinates.width:1/0,Pn.maxHeight?Pn.maxHeight/vn.coordinates.height:1/0,maxScale(vn.coordinates,positionToSizeRestrictions(Sn)))},area:{maximum:maxScale(vn.visibleArea,En),minimum:minScale(vn.visibleArea,En)}};yn&&wn&&(yn<1?(Tn=Math.max(yn,Math.max(_n.area.minimum,_n.stencil.minimum)),Tn>1&&(Tn=1)):yn>1&&(Tn=Math.min(yn,Math.min(_n.area.maximum,_n.stencil.maximum)),Tn<1&&(Tn=1))),Tn&&(vn.visibleArea=applyScale(vn.visibleArea,Tn,xn));var Rn={left:on.coordinates.left-on.visibleArea.left,right:on.visibleArea.width+on.visibleArea.left-(on.coordinates.width+on.coordinates.left),top:on.coordinates.top-on.visibleArea.top,bottom:on.visibleArea.height+on.visibleArea.top-(on.coordinates.height+on.coordinates.top)};return vn.visibleArea=moveToPositionRestrictions(vn.visibleArea,{left:Sn.left!==void 0?Sn.left-Rn.left*Tn:void 0,top:Sn.top!==void 0?Sn.top-Rn.top*Tn:void 0,bottom:Sn.bottom!==void 0?Sn.bottom+Rn.bottom*Tn:void 0,right:Sn.right!==void 0?Sn.right+Rn.right*Tn:void 0}),vn.visibleArea=moveToPositionRestrictions(vn.visibleArea,getAreaPositionRestrictions(vn,rn)),vn.coordinates.width=vn.coordinates.width*Tn,vn.coordinates.height=vn.coordinates.height*Tn,vn.coordinates.left=vn.visibleArea.left+Rn.left*Tn,vn.coordinates.top=vn.visibleArea.top+Rn.top*Tn,vn.coordinates=moveToPositionRestrictions(vn.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(vn.visibleArea),Sn)),wn&&yn&&(!((dn=rn.transformImage)===null||dn===void 0)&&dn.adjustStencil)&&(yn>1?Cn=Math.min(_n.area.maximum,yn)/Tn:yn<1&&(Cn=Math.max(vn.coordinates.height/vn.visibleArea.height,vn.coordinates.width/vn.visibleArea.width,yn/Tn)),Cn!==1&&(vn.visibleArea=applyScale(vn.visibleArea,Cn,yn>1?xn:getCenter(vn.coordinates)),vn.visibleArea=moveToPositionRestrictions(vn.visibleArea,getAreaPositionRestrictions(vn,rn)),vn.visibleArea=applyMove(vn.visibleArea,inverseMove(fitToPositionRestrictions(vn.coordinates,coordinatesToPositionRestrictions(vn.visibleArea)))))),vn}return on}function transformImage(on,rn,un){return un.rotate&&(on=rotateImageAlgorithm(on,rn,un.rotate)),un.flip&&(on=flipImageAlgorithm(on,rn,un.flip.horizontal,un.flip.vertical)),(un.move||un.scale)&&(on=transformImageAlgorithm(on,rn,un)),on}function reconcileState(on,rn){if(isInitializedState(on)){var un=copyState(on),dn=getAspectRatio(on,rn),pn=getSizeRestrictions(on,rn),fn=getAreaSizeRestrictions(on,rn),hn=getBrokenRatio(ratio(on.coordinates),dn),gn=hn?{height:on.coordinates.height,width:on.coordinates.height*hn}:on.coordinates;un.coordinates=__assign(__assign({},un.coordinates),approximateSize({width:gn.width,height:gn.height,aspectRatio:dn,sizeRestrictions:mergeSizeRestrictions(fn,pn)})),un.coordinates=applyMove(un.coordinates,diff(getCenter(on.coordinates),getCenter(un.coordinates)));var vn=Math.max(un.coordinates.width/un.visibleArea.width,un.coordinates.height/un.visibleArea.height,1);return un.visibleArea=__assign(__assign({},on.visibleArea),approximateSize({width:on.visibleArea.width*vn,height:on.visibleArea.height*vn,aspectRatio:{minimum:ratio(un.boundary),maximum:ratio(un.boundary)},sizeRestrictions:fn})),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(on.visibleArea),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn)),un.coordinates=moveToPositionRestrictions(un.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(un.visibleArea),getPositionRestrictions(un,rn))),un}return on}function normalizeResizeDirections(on,rn){var un=getCoefficient(on);return{left:isNumber(rn.left)?rn.left*un:0,top:isNumber(rn.top)?rn.top*un:0,right:isNumber(rn.right)?rn.right*un:0,bottom:isNumber(rn.bottom)?rn.bottom*un:0}}function normalizeCenter(on,rn){var un=getCoefficient(on);return on.visibleArea?{left:rn.left*un+on.visibleArea.left,top:rn.top*un+on.visibleArea.top}:rn}function normalizeFlip(on,rn){if(on){var un=Math.abs(on.transforms.rotate%180);return un<=45||un>=135?rn:{horizontal:rn.vertical,vertical:rn.horizontal}}return rn}function fillMoveDirections(on){return{left:isNumber(on.left)?on.left:0,top:isNumber(on.top)?on.top:0}}function fillResizeDirections(on){return{left:isNumber(on.left)?on.left:0,top:isNumber(on.top)?on.top:0,right:isNumber(on.right)?on.right:0,bottom:isNumber(on.bottom)?on.bottom:0}}function normalizeMoveDirections(on,rn){var un=getCoefficient(on);return{left:isNumber(rn.left)?rn.left*un:0,top:isNumber(rn.top)?rn.top*un:0}}function normalizeImageTransform(on,rn){return rn.scale&&(rn.scale={factor:isNumber(rn.scale)?rn.scale:rn.scale.factor,center:!isNumber(rn.scale)&&rn.scale.center?normalizeCenter(on,rn.scale.center):void 0}),rn.rotate&&(rn.rotate={angle:isNumber(rn.rotate)?rn.rotate:rn.rotate.angle,center:!isNumber(rn.rotate)&&rn.rotate.center?normalizeCenter(on,rn.rotate.center):void 0}),rn.move&&(rn.move=normalizeMoveDirections(on,rn.move)),rn}function calculateGeometricProperties(on,rn){var un=rn.getBoundingClientRect(),dn=un.left,pn=un.top,fn={left:0,top:0},hn=0;return on.forEach(function(gn){fn.left+=(gn.clientX-dn)/on.length,fn.top+=(gn.clientY-pn)/on.length}),on.forEach(function(gn){hn+=distance({left:fn.left,top:fn.top},{left:gn.clientX-dn,top:gn.clientY-pn})}),{centerMass:fn,spread:hn,count:on.length}}function touchesToImageTransform(on,rn,un,dn){dn===void 0&&(dn={});var pn,fn,hn;if(rn.length===1&&on.length===1)dn.move&&(pn={left:rn[0].clientX-on[0].clientX,top:rn[0].clientY-on[0].clientY});else if(on.length>1){var gn=calculateGeometricProperties(rn,un),vn=calculateGeometricProperties(on,un);if(dn.rotate&&rn.length===2&&on.length===2){var yn={left:[on[0].clientX-on[1].clientX,rn[0].clientX-rn[1].clientX],top:[on[0].clientY-on[1].clientY,rn[0].clientY-rn[1].clientY]},xn=yn.left[0]*yn.top[1]-yn.left[1]*yn.top[0],wn=yn.left[0]*yn.left[1]+yn.top[0]*yn.top[1];if(!isRoughlyEqual(wn,0)&&!isRoughlyEqual(xn,0)){var Cn=Math.atan2(xn,wn),Tn=-(Cn*180)/Math.PI;hn={center:vn.centerMass,angle:Tn}}}dn.move&&(pn={left:gn.centerMass.left-vn.centerMass.left,top:gn.centerMass.top-vn.centerMass.top}),dn.scale&&(fn={factor:vn.spread/gn.spread,center:vn.centerMass})}return{move:pn,scale:fn,rotate:hn}}function wheelEventToImageTransform(on,rn,un){un===void 0&&(un=.1);var dn=rn.getBoundingClientRect(),pn=dn.left,fn=dn.top,hn=1-un*sign(on.deltaY||on.detail||on.wheelDelta),gn={left:on.clientX-pn,top:on.clientY-fn};return{scale:{factor:hn,center:gn}}}function hasInteractions(on){return on.moveCoordinates||on.resizeCoordinates||on.transformImage.move||on.transformImage.rotate||on.transformImage.flip||on.transformImage.scale}function getEmptyInteractions(){return{moveCoordinates:!1,resizeCoordinates:!1,transformImage:{rotate:!1,move:!1,scale:!1,flip:!1}}}function defaultPositionRestrictions(on,rn){var un=getTransformedImageSize(on),dn={};return rn.imageRestriction&&rn.imageRestriction!=="none"&&(dn={left:0,top:0,right:un.width,bottom:un.height}),dn}function defaultVisibleArea(on,rn){var un=on.coordinates,dn=on.boundary,pn=getTransformedImageSize(on),fn=ratio(dn);if(un){var hn={height:Math.max(un.height,pn.height),width:Math.max(un.width,pn.width)},gn={left:0,top:0,width:ratio(hn)>fn?hn.width:hn.height*fn,height:ratio(hn)>fn?hn.width/fn:hn.height};gn=resizeToSizeRestrictions(gn,getAreaSizeRestrictions(on,rn)),gn.left=un.left+un.width/2-gn.width/2,gn.top=un.top+un.height/2-gn.height/2;var vn=getIntersections(un,coordinatesToPositionRestrictions(__assign({left:0,top:0},pn))),yn={};return!vn.left&&!vn.right&&gn.width<=pn.width&&(yn.left=0,yn.right=pn.width),!vn.top&&!vn.bottom&&gn.height<=pn.height&&(yn.top=0,yn.bottom=pn.height),moveToPositionRestrictions(gn,yn)}else{var xn=ratio(pn),wn={height:xn<fn?pn.height:pn.width/fn,width:xn<fn?pn.height*fn:pn.width};return{left:pn.width/2-wn.width/2,top:pn.height/2-wn.height/2,width:wn.width,height:wn.height}}}function defaultSize$1(on,rn){var un=on.imageSize,dn=on.visibleArea,pn=getSizeRestrictions(on,rn),fn=getAspectRatio(on,rn),hn;if(dn)hn=dn;else{var gn=positionToSizeRestrictions(getPositionRestrictions(on,rn));hn={width:Math.max(gn.minWidth,Math.min(gn.maxWidth,un.width)),height:Math.max(gn.minHeight,Math.min(gn.maxHeight,un.height))}}var vn=Math.min(fn.maximum||1/0,Math.max(fn.minimum||0,ratio(hn))),yn=hn.width<hn.height?{width:hn.width*.8,height:hn.width*.8/vn}:{height:hn.height*.8,width:hn.height*.8*vn};return approximateSize(__assign(__assign({},yn),{aspectRatio:fn,sizeRestrictions:pn}))}function retrieveSizeRestrictions(on){return{minWidth:isNumeric(on.minWidth)?parseNumber(on.minWidth):0,minHeight:isNumeric(on.minHeight)?parseNumber(on.minHeight):0,maxWidth:isNumeric(on.maxWidth)?parseNumber(on.maxWidth):1/0,maxHeight:isNumeric(on.maxHeight)?parseNumber(on.maxHeight):1/0}}function pixelsRestrictions(on,rn){return retrieveSizeRestrictions(rn)}function defaultPosition(on){var rn=on.visibleArea,un=on.coordinates,dn=rn||getTransformedImageSize(on);return{left:(rn?rn.left:0)+dn.width/2-(un?un.width/2:0),top:(rn?rn.top:0)+dn.height/2-(un?un.height/2:0)}}function defaultAreaPositionRestrictions(on,rn){var un=on.visibleArea,dn=on.boundary,pn=rn.imageRestriction,fn=getTransformedImageSize(on),hn={};return pn===ImageRestriction.fillArea?hn={left:0,top:0,right:fn.width,bottom:fn.height}:pn===ImageRestriction.fitArea&&(ratio(dn)>ratio(fn)?(hn={top:0,bottom:fn.height},un&&(un.width>fn.width?(hn.left=-(un.width-fn.width)/2,hn.right=fn.width-hn.left):(hn.left=0,hn.right=fn.width))):(hn={left:0,right:fn.width},un&&(un.height>fn.height?(hn.top=-(un.height-fn.height)/2,hn.bottom=fn.height-hn.top):(hn.top=0,hn.bottom=fn.height)))),hn}function defaultAreaSizeRestrictions(on,rn){var un=on.boundary,dn=rn.imageRestriction,pn=getTransformedImageSize(on),fn={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0};return dn===ImageRestriction.fillArea?(fn.maxWidth=pn.width,fn.maxHeight=pn.height):dn===ImageRestriction.fitArea&&(ratio(un)>ratio(pn)?(fn.maxHeight=pn.height,fn.maxWidth=pn.height*ratio(un)):(fn.maxWidth=pn.width,fn.maxHeight=pn.width/ratio(un))),fn}function fillBoundary(on){var rn=on.getBoundingClientRect(),un=rn.width,dn=rn.height;return{width:un,height:dn}}function defaultStencilConstraints(on,rn){return on.aspectRatio?{}:{aspectRatio:createAspectRatio(isFunction(rn.aspectRatio)?rn.aspectRatio():rn.aspectRatio)}}function withDefaultSizeRestrictions(on){return function(rn,un){var dn=isFunction(on)?on(rn,un):on;return mergeSizeRestrictions(pixelsRestrictions(rn,un),dn)}}function createDefaultSettings(on){return __assign(__assign({},on),{sizeRestrictions:function(rn,un){var dn;return on.sizeRestrictions?dn=isFunction(on.sizeRestrictions)?on.sizeRestrictions(rn,un):on.sizeRestrictions:dn=pixelsRestrictions(rn,un),dn},areaPositionRestrictions:function(rn,un){return on.areaPositionRestrictions?isFunction(on.areaPositionRestrictions)?on.areaPositionRestrictions(rn,un):on.areaPositionRestrictions:defaultAreaPositionRestrictions(rn,un)},areaSizeRestrictions:function(rn,un){return on.areaSizeRestrictions?isFunction(on.areaSizeRestrictions)?on.areaSizeRestrictions(rn,un):on.areaSizeRestrictions:defaultAreaSizeRestrictions(rn,un)},positionRestrictions:function(rn,un){return on.positionRestrictions?isFunction(on.positionRestrictions)?on.positionRestrictions(rn,un):on.positionRestrictions:defaultPositionRestrictions(rn,un)},defaultCoordinates:function(rn,un){if(on.defaultCoordinates)return isFunction(on.defaultCoordinates)?on.defaultCoordinates(rn,un):on.defaultCoordinates;var dn=on.defaultSize;dn||(dn=defaultSize$1);var pn=isFunction(dn)?dn(rn,un):dn,fn=on.defaultPosition||defaultPosition;return[pn,function(hn){return __assign({},isFunction(fn)?fn(hn,un):fn)}]},defaultVisibleArea:function(rn,un){return on.defaultVisibleArea?isFunction(on.defaultVisibleArea)?on.defaultVisibleArea(rn,un):on.defaultVisibleArea:defaultVisibleArea(rn,un)},aspectRatio:function(rn,un){return createAspectRatio(isFunction(on.aspectRatio)?on.aspectRatio(rn,un):on.aspectRatio)}})}function runCallback(on,rn){if(on&&rn){var un=rn();un&&on(un)}}function runCallbacks(on,rn){on.forEach(function(un){runCallback(un,rn)})}var AbstractCropperInstance=function(){function on(){var rn=this;this.getTransitions=function(){var un=rn.getData(),dn=rn.getProps().transitions;return __assign(__assign({},getOptions(dn,{timingFunction:"ease-in-out",duration:350})),{active:un.transitions})},this.getInteractions=function(){var un=rn.getData().interactions;return deepClone(un)},this.hasInteractions=function(){var un=rn.getData().interactions;return hasInteractions(un)},this.startTransitions=function(){var un=rn.getProps(),dn=un.onTransitionsStart,pn=un.onUpdate,fn=un.getInstance,hn=rn.getData(),gn=hn.transitions,vn=__rest(hn,["transitions"]);rn.setData(__assign(__assign({},vn),{transitions:!0})),gn||runCallbacks([dn,pn],fn),rn.endTransitions()},this.endTransitions=debounce(function(){var un=rn.getProps(),dn=un.onTransitionsEnd,pn=un.onUpdate,fn=un.getInstance;rn.setData(__assign(__assign({},rn.getData()),{transitions:!1})),runCallbacks([dn,pn],fn)},function(){return rn.getTransitions().duration}),this.applyPostProcess=function(un,dn){var pn=rn.getProps(),fn=pn.settings,hn=pn.postProcess,gn=un.name,vn=un.interaction,yn=vn===void 0?!1:vn,xn=un.transitions,wn=xn===void 0?!1:xn,Cn=un.immediately,Tn=Cn===void 0?!1:Cn,Pn={name:gn,interaction:yn,transitions:wn,immediately:Tn};return isArray(hn)?hn.reduce(function(Sn,En){return En(Sn,fn,Pn)},dn):isFunction(hn)?hn(dn,fn,Pn):dn},this.updateState=function(un,dn,pn){dn===void 0&&(dn={}),pn===void 0&&(pn=[]);var fn=dn.transitions,hn=fn===void 0?!1:fn,gn=rn.getProps(),vn=gn.onTransitionsStart,yn=gn.getInstance,xn=gn.onChange,wn=gn.onUpdate,Cn=gn.settings,Tn=rn.getData(),Pn=isFunction(un)?un(Tn.state,Cn):un,Sn=Pn?.001*getCoefficient(Pn):.001,En=!deepCompare(Tn.state,Pn,Sn),_n=["coordinates","boundary","visibleArea","imageSize","transforms"].some(function($n){var Mn;return!deepCompare((Mn=Tn.state)===null||Mn===void 0?void 0:Mn[$n],Pn?.[$n],Sn)}),Rn=Tn;En&&(hn&&_n&&rn.endTransitions(),Rn=__assign(__assign({},Rn),{state:copyState(Pn),transitions:hn&&_n}),rn.setData(Rn),runCallback(xn,yn)),Rn.transitions&&!Tn.transitions&&runCallback(vn,yn),runCallbacks(__spreadArrays(pn,[wn]),yn)},this.setInteractions=function(un){var dn=rn.getProps(),pn=dn.onInteractionStart,fn=dn.onInteractionEnd,hn=dn.getInstance,gn=rn.getInteractions(),vn=__assign(__assign({},gn),un);if(deepCompare(gn,vn)||rn.setData(__assign(__assign({},rn.getData()),{interactions:vn})),hasInteractions(gn)!==hasInteractions(vn))if(!hasInteractions(gn))runCallback(pn,hn);else{var yn=rn.getData().state;rn.updateState(function(){return yn&&rn.applyPostProcess({name:"interactionEnd",immediately:!0,transitions:!0},yn)},{transitions:!0},[fn])}},this.resetState=function(un,dn){rn.updateState(rn.createDefaultState(un,dn))},this.clear=function(){rn.updateState(null)},this.reconcileState=function(un){un===void 0&&(un={});var dn=rn.getProps(),pn=dn.reconcileStateAlgorithm,fn=dn.settings,hn=rn.getData().state,gn=un.transitions,vn=gn===void 0?!1:gn;if(hn&&!isConsistentState(hn,fn)){var yn=(pn||reconcileState)(hn,fn);yn=rn.applyPostProcess({name:"reconcileState",immediately:!0,transitions:vn},yn),rn.updateState(yn,{transitions:vn})}},this.transformImage=function(un,dn){dn===void 0&&(dn={});var pn=dn.transitions,fn=pn===void 0?!0:pn,hn=dn.interaction,gn=hn===void 0?!0:hn,vn=dn.immediately,yn=vn===void 0?!1:vn,xn=dn.normalize,wn=xn===void 0?!0:xn,Cn=rn.getProps(),Tn=Cn.transformImageAlgorithm,Pn=Cn.onTransformImage,Sn=Cn.onTransformImageEnd,En=Cn.settings,_n=rn.getData().state,Rn=[];if(_n){wn&&(un=normalizeImageTransform(_n,un));var $n=rn.applyPostProcess({name:"transformImage",transitions:fn,immediately:yn},(Tn||transformImage)(_n,En,un));Rn.push(Pn),gn?rn.setInteractions({transformImage:{rotate:!isUndefined(un.rotate),flip:!isUndefined(un.flip),scale:!isUndefined(un.scale),move:!isUndefined(un.move)}}):($n=rn.applyPostProcess({name:"transformImageEnd",transitions:fn,immediately:!0},$n),Rn.push(Sn)),rn.updateState($n,{transitions:yn&&fn},Rn)}},this.transformImageEnd=function(un){un===void 0&&(un={});var dn=un.immediately,pn=dn===void 0?!0:dn,fn=un.transitions,hn=fn===void 0?!0:fn,gn=rn.getData().state,vn=rn.getProps().onTransformImageEnd;rn.updateState(function(){return gn&&rn.applyPostProcess({name:"transformImageEnd",immediately:pn,transitions:hn},gn)},{transitions:hn},[vn]),rn.setInteractions({transformImage:{rotate:!1,flip:!1,scale:!1,move:!1}})},this.zoomImage=function(un,dn){dn===void 0&&(dn={});var pn=dn.interaction,fn=pn===void 0?!1:pn,hn=dn.immediately,gn=hn===void 0?!0:hn,vn=dn.transitions,yn=vn===void 0?!0:vn,xn=dn.normalize,wn=xn===void 0?!1:xn;rn.transformImage({scale:un},{interaction:fn,immediately:gn,transitions:yn,normalize:wn})},this.moveImage=function(un,dn,pn){pn===void 0&&(pn={});var fn=pn.interaction,hn=fn===void 0?!1:fn,gn=pn.immediately,vn=gn===void 0?!0:gn,yn=pn.transitions,xn=yn===void 0?!0:yn,wn=pn.normalize,Cn=wn===void 0?!1:wn;rn.transformImage({move:{left:un,top:dn}},{interaction:hn,immediately:vn,transitions:xn,normalize:Cn})},this.flipImage=function(un,dn,pn){pn===void 0&&(pn={});var fn=pn.interaction,hn=fn===void 0?!1:fn,gn=pn.immediately,vn=gn===void 0?!0:gn,yn=pn.transitions,xn=yn===void 0?!0:yn,wn=pn.normalize,Cn=wn===void 0?!0:wn,Tn=rn.getState(),Pn={horizontal:un,vertical:dn};rn.transformImage({flip:Tn&&Cn?normalizeFlip(Tn,Pn):Pn},{interaction:hn,immediately:vn,transitions:xn})},this.rotateImage=function(un,dn){dn===void 0&&(dn={});var pn=dn.interaction,fn=pn===void 0?!1:pn,hn=dn.immediately,gn=hn===void 0?!0:hn,vn=dn.transitions,yn=vn===void 0?!0:vn,xn=dn.normalize,wn=xn===void 0?!1:xn;rn.transformImage({rotate:un},{interaction:fn,immediately:gn,transitions:yn,normalize:wn})},this.reset=function(un,dn){rn.resetState(un,dn)},this.setState=function(un,dn){dn===void 0&&(dn={});var pn=rn.getSettings(),fn=rn.getData().state,hn=dn.transitions,gn=hn===void 0?!0:hn,vn=dn.immediately,yn=vn===void 0?!1:vn,xn=dn.interaction,wn=xn===void 0?!1:xn,Cn=dn.postprocess,Tn=Cn===void 0?!1:Cn,Pn=un&&(isFunction(un)?un(fn,pn):__assign(__assign({},fn),un));rn.updateState(function(){return Tn?Pn&&rn.applyPostProcess({name:"setState",immediately:yn,transitions:gn,interaction:wn},Pn):Pn},{transitions:gn})},this.setCoordinates=function(un,dn){dn===void 0&&(dn={});var pn=rn.getData().state,fn=rn.getProps(),hn=fn.setCoordinatesAlgorithm,gn=fn.settings,vn=dn.transitions,yn=vn===void 0?!0:vn,xn=dn.immediately,wn=xn===void 0?!0:xn;rn.updateState(function(){return pn&&rn.applyPostProcess({name:"setCoordinates",immediately:wn,transitions:yn},(hn||setCoordinates)(pn,gn,un,SetCoordinatesMode.zoom))},{transitions:yn})},this.setVisibleArea=function(un,dn){dn===void 0&&(dn={});var pn=dn.transitions,fn=pn===void 0?!0:pn,hn=dn.immediately,gn=hn===void 0?!0:hn,vn=rn.getData().state,yn=rn.getProps(),xn=yn.setVisibleAreaAlgorithm,wn=yn.settings;rn.updateState(function(){return vn&&rn.applyPostProcess({name:"setVisibleArea",immediately:gn,transitions:fn},(xn||setVisibleArea)(vn,wn,un))},{transitions:fn})},this.setBoundary=function(un,dn){dn===void 0&&(dn={});var pn=rn.getData().state,fn=rn.getProps(),hn=fn.setBoundaryAlgorithm,gn=fn.settings,vn=dn.transitions,yn=vn===void 0?!1:vn,xn=dn.immediately,wn=xn===void 0?!0:xn;un?rn.updateState(function(){return pn&&rn.applyPostProcess({name:"setBoundary",immediately:wn,transitions:yn},(hn||setBoundary)(pn,gn,un))}):rn.updateState(null)},this.moveCoordinates=function(un,dn){dn===void 0&&(dn={});var pn=rn.getData(),fn=rn.getProps(),hn=fn.moveCoordinatesAlgorithm,gn=fn.onMove,vn=fn.onMoveEnd,yn=fn.settings,xn=dn.interaction,wn=xn===void 0?!0:xn,Cn=dn.transitions,Tn=Cn===void 0?!1:Cn,Pn=dn.immediately,Sn=Pn===void 0?!1:Pn,En=dn.normalize,_n=En===void 0?!0:En,Rn=[];if(!pn.transitions&&pn.state){var $n=_n?normalizeMoveDirections(pn.state,un):fillMoveDirections(un),Mn=rn.applyPostProcess({name:"moveCoordinates",interaction:wn,immediately:Sn,transitions:Tn},(hn||moveCoordinates)(pn.state,yn,$n));Rn.push(gn),wn?rn.setInteractions({moveCoordinates:!0}):(Mn=rn.applyPostProcess({name:"moveCoordinatesEnd",interaction:wn,immediately:Sn,transitions:Tn},Mn),Rn.push(vn)),rn.updateState(Mn,{transitions:Sn&&Tn},Rn)}},this.moveCoordinatesEnd=function(un){un===void 0&&(un={});var dn=rn.getData().state,pn=rn.getProps().onMoveEnd,fn=un.transitions,hn=fn===void 0?!0:fn,gn=un.immediately,vn=gn===void 0?!1:gn;rn.updateState(function(){return dn&&rn.applyPostProcess({name:"moveCoordinatesEnd",transitions:hn,immediately:vn},dn)},{transitions:hn},[pn]),rn.setInteractions({moveCoordinates:!1})},this.resizeCoordinates=function(un,dn,pn,fn){fn===void 0&&(fn={});var hn=rn.getData().state,gn=rn.getProps(),vn=gn.resizeCoordinatesAlgorithm,yn=gn.onResize,xn=gn.onResizeEnd,wn=gn.settings,Cn=fn.interaction,Tn=Cn===void 0?!0:Cn,Pn=fn.transitions,Sn=Pn===void 0?!1:Pn,En=fn.immediately,_n=En===void 0?!1:En,Rn=fn.normalize,$n=Rn===void 0?!0:Rn,Mn=rn.getTransitions();if(!Mn.active&&hn){var An=[],Dn=$n?normalizeResizeDirections(hn,dn):fillResizeDirections(dn),On=rn.applyPostProcess({name:"resizeCoordinates",interaction:Tn,immediately:_n,transitions:Sn},(vn||resizeCoordinates)(hn,wn,un,Dn,isObject(pn)?pn:{}));An.push(yn),Tn?rn.setInteractions({resizeCoordinates:!0}):(On=rn.applyPostProcess({name:"resizeCoordinatesEnd",interaction:Tn,immediately:_n,transitions:Sn},On),An.push(xn)),rn.updateState(On,{transitions:_n&&Sn},An)}},this.resizeCoordinatesEnd=function(un){un===void 0&&(un={});var dn=rn.getProps().onResizeEnd,pn=rn.getData().state,fn=un.transitions,hn=fn===void 0?!0:fn,gn=un.immediately,vn=gn===void 0?!1:gn;rn.updateState(function(){return pn&&rn.applyPostProcess({name:"resizeCoordinatesEnd",transitions:hn,immediately:vn},pn)},{transitions:hn},[dn]),rn.setInteractions({resizeCoordinates:!1})},this.getStencilCoordinates=function(){var un=rn.getData().state;return getStencilCoordinates(un)},this.getCoordinates=function(un){un===void 0&&(un={});var dn=rn.getData().state,pn=rn.getProps().settings;if(dn&&dn.coordinates){var fn=un.round,hn=fn===void 0?!0:fn;return hn?getRoundedCoordinates(dn,pn):__assign({},dn.coordinates)}else return null},this.getVisibleArea=function(){var un=rn.getData().state;return un?.visibleArea?__assign({},un.visibleArea):null},this.getSettings=function(){var un=rn.getProps().settings;return __assign({},un)},this.getState=function(){var un=rn.getData().state;return copyState(un)},this.getTransforms=function(){var un=rn.getData().state;return un?deepClone(un.transforms):{rotate:0,flip:{horizontal:!1,vertical:!1}}},this.createDefaultState=function(un,dn){var pn=rn.getProps(),fn=pn.createStateAlgorithm,hn=pn.settings;return rn.applyPostProcess({name:"createState",immediately:!0,transitions:!1},(fn||createState)({image:dn,boundary:un},hn))},this.isConsistent=function(){var un=rn.getData().state,dn=rn.getProps().settings;return un?isConsistentState(un,dn):!0}}return on}(),timingFunctions={linear:function(on){return on},"ease-in":function(on){return Math.pow(on,1.675)},"ease-out":function(on){return 1-Math.pow(1-on,1.675)},"ease-in-out":function(on){return .5*(Math.sin((on-.5)*Math.PI)+1)}},Animation=function(){function on(){this.active=!1}return on.prototype.start=function(rn){var un;this.onStart=rn.onStart,this.onProgress=rn.onProgress,this.onStop=rn.onStop,this.active||(un=this.onStart)===null||un===void 0||un.call(this),this.id&&window.cancelAnimationFrame(this.id),this.startTime=performance.now(),this.timingFunction=rn.timingFunction,this.endTime=this.startTime+rn.duration,this.active=!0,this.animate()},on.prototype.animate=function(){var rn=this;if(this.startTime&&this.endTime){var un=timingFunctions[this.timingFunction];un||(process.env.NODE_ENV!=="production"&&console.warn("[Animation] The timing function '"+un+"' is not supported. Available timing function: 'linear', 'ease-in', 'ease-in-out', 'ease-out'. Reset to 'ease-out'."),un=timingFunctions["ease-out"]);var dn=1-(this.endTime-performance.now())/(this.endTime-this.startTime),pn=Math.min(1,un(dn));this.onProgress&&this.onProgress(pn),dn<1?this.id=window.requestAnimationFrame(function(){return rn.animate()}):this.stop()}else this.stop()},on.prototype.stop=function(){this.active=!1,this.id&&window.cancelAnimationFrame(this.id),this.onStop&&this.onStop()},on}();function prepareSource(on,rn,un){var dn=un.rotate,pn=un.flip,fn={width:"naturalWidth"in rn?rn.naturalWidth:rn.width,height:"naturalHeight"in rn?rn.naturalHeight:rn.height},hn=rotateSize(fn,dn),gn=on.getContext("2d");if(on.height=hn.height,on.width=hn.width,gn){gn.save();var vn=rotatePoint(getCenter(__assign({left:0,top:0},fn)),dn);gn.translate(-(vn.left-hn.width/2),-(vn.top-hn.height/2)),gn.rotate(dn*Math.PI/180),gn.translate(pn.horizontal?fn.width:0,pn.vertical?fn.height:0),gn.scale(pn.horizontal?-1:1,pn.vertical?-1:1),gn.drawImage(rn,0,0,fn.width,fn.height),gn.restore()}return on}function updateCanvas(on,rn,un,dn,pn){on.width=dn?dn.width:un.width,on.height=dn?dn.height:un.height;var fn=on.getContext("2d");if(fn){fn.clearRect(0,0,on.width,on.height),pn&&(pn.imageSmoothingEnabled&&(fn.imageSmoothingEnabled=pn.imageSmoothingEnabled),pn.imageSmoothingQuality&&(fn.imageSmoothingQuality=pn.imageSmoothingQuality),pn.fillColor&&(fn.fillStyle=pn.fillColor,fn.fillRect(0,0,on.width,on.height),fn.save()));var hn=un.left<0?-un.left:0,gn=un.top<0?-un.top:0;fn.drawImage(rn,un.left+hn,un.top+gn,un.width,un.height,hn*(on.width/un.width),gn*(on.height/un.height),on.width,on.height)}return on}function drawCroppedArea(on,rn,un,dn,pn){if(isInitializedState(on)){var fn=on.transforms,hn=on.coordinates,gn=fn.rotate!==0||fn.flip.horizontal||fn.flip.vertical,vn=gn?prepareSource(dn,rn,fn):rn,yn=__assign({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,maxArea:1/0,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",fillColor:"transparent"},pn),xn=function(Tn){return Tn.find(function(Pn){return isNumeric(Pn)})},wn=approximateSize({sizeRestrictions:{minWidth:xn([yn.width,yn.minWidth])||0,minHeight:xn([yn.height,yn.minHeight])||0,maxWidth:xn([yn.width,yn.maxWidth])||1/0,maxHeight:xn([yn.height,yn.maxHeight])||1/0},width:hn.width,height:hn.height,aspectRatio:{minimum:hn.width/hn.height,maximum:hn.width/hn.height}});if(yn.maxArea&&wn.width*wn.height>yn.maxArea){var Cn=Math.sqrt(yn.maxArea/(wn.width*wn.height));wn={width:Math.round(Cn*wn.width),height:Math.round(Cn*wn.height)}}return updateCanvas(un,vn,hn,wn,yn)}else return null}function stretchCropperBoundary(on,rn,un){rn.style.width="0px",rn.style.height="0px",rn.style.width=Math.max(on.clientWidth,un.width)+"px";var dn=un.width/un.height;rn.style.height=Math.max(on.clientHeight,rn.clientWidth/dn)+"px",rn.style.width=rn.clientHeight*dn+"px"}function stretchPreviewBoundary(on,rn,un){rn.style.width="0px",rn.style.height="0px",rn.style.width=Math.max(on.getBoundingClientRect().width,un.width)+"px";var dn=un.width/un.height;rn.style.height=Math.max(on.getBoundingClientRect().height,rn.getBoundingClientRect().width/dn)+"px",rn.style.width=rn.getBoundingClientRect().height*dn+"px",rn.clientWidth/rn.clientHeight>on.clientWidth/on.clientHeight?rn.clientWidth>on.clientWidth&&(rn.style.width=on.clientWidth+"px",rn.style.height=on.clientWidth/dn+"px"):rn.clientHeight>on.clientHeight&&(rn.style.height=on.clientHeight+"px",rn.style.width=on.clientHeight*dn+"px")}var XHR_DONE=4;function base64ToArrayBuffer(on){on=on.replace(/^data:([^;]+);base64,/gim,"");for(var rn=atob(on),un=rn.length,dn=new ArrayBuffer(un),pn=new Uint8Array(dn),fn=0;fn<un;fn++)pn[fn]=rn.charCodeAt(fn);return dn}function objectURLToBlob(on,rn){var un=new XMLHttpRequest;un.open("GET",on,!0),un.responseType="blob",un.onload=function(){(this.status==200||this.status===0)&&rn(this.response)},un.send()}function getTransforms(on){var rn={flip:{horizontal:!1,vertical:!1},rotate:0};if(on)switch(on){case 2:rn.flip.horizontal=!0;break;case 3:rn.rotate=-180;break;case 4:rn.flip.vertical=!0;break;case 5:rn.rotate=90,rn.flip.vertical=!0;break;case 6:rn.rotate=90;break;case 7:rn.rotate=90,rn.flip.horizontal=!0;break;case 8:rn.rotate=-90;break}return rn}function getImageData(on){return new Promise(function(rn,un){try{if(on)if(/^data:/i.test(on))rn(base64ToArrayBuffer(on));else if(/^blob:/i.test(on)){var dn=new FileReader;dn.onload=function(fn){var hn;rn((hn=fn.target)===null||hn===void 0?void 0:hn.result)},objectURLToBlob(on,function(fn){dn.readAsArrayBuffer(fn)})}else{var pn=new XMLHttpRequest;pn.onreadystatechange=function(){pn.readyState===XHR_DONE&&(pn.status===200||pn.status===0?rn(pn.response):un("Warning: could not load an image to parse its orientation"))},pn.onprogress=function(){pn.getResponseHeader("content-type")!=="image/jpeg"&&pn.abort()},pn.withCredentials=!1,pn.open("GET",on,!0),pn.responseType="arraybuffer",pn.send(null)}else un("Error: the image is empty")}catch(fn){un(fn)}})}function getStyleTransforms(on){var rn=on.rotate,un=rn===void 0?0:rn,dn=on.flip,pn=dn===void 0?{horizontal:!1,vertical:!1}:dn,fn=on.scale,hn=fn===void 0?1:fn;return" rotate("+un+"deg) scaleX("+hn*(pn.horizontal?-1:1)+") scaleY("+hn*(pn.vertical?-1:1)+")"}function getStringFromCharCode(on,rn,un){var dn="",pn;for(pn=rn,un+=rn;pn<un;pn++)dn+=String.fromCharCode(on.getUint8(pn));return dn}function resetAndGetOrientation(on){try{var rn=new DataView(on),un,dn=void 0,pn=void 0,fn=void 0,hn=void 0,gn=void 0;if(rn.getUint8(0)===255&&rn.getUint8(1)===216)for(var vn=rn.byteLength,yn=2;yn+1<vn;){if(rn.getUint8(yn)===255&&rn.getUint8(yn+1)===225){hn=yn;break}yn++}if(hn&&(dn=hn+4,pn=hn+10,getStringFromCharCode(rn,dn,4)==="Exif")){var xn=rn.getUint16(pn);if(fn=xn===18761,(fn||xn===19789)&&rn.getUint16(pn+2,fn)===42){var wn=rn.getUint32(pn+4,fn);wn>=8&&(gn=pn+wn)}}if(gn)for(var Cn=rn.getUint16(gn,fn),Tn=0;Tn<Cn;Tn++){var yn=gn+Tn*12+2;if(rn.getUint16(yn,fn)===274){yn+=8,un=rn.getUint16(yn,fn),rn.setUint16(yn,1,fn);break}}return un}catch{return null}}function arrayBufferToDataURL(on){for(var rn=[],un=8192,dn=new Uint8Array(on);dn.length>0;){var pn=dn.subarray(0,un);rn.push(String.fromCharCode.apply(null,Array.from?Array.from(pn):pn.slice())),dn=dn.subarray(un)}return"data:image/jpeg;base64,"+btoa(rn.join(""))}function getImage(on){var rn=on.src,un=on.arrayBuffer,dn=un===void 0?null:un,pn=on.orientation,fn=pn===void 0?null:pn,hn={src:rn,arrayBuffer:dn,revoke:!1,transforms:{flip:{horizontal:!1,vertical:!1},rotate:0}};return dn&&fn&&fn>1?isBlob(rn)||!isLocal(rn)?(hn.src=URL.createObjectURL(new Blob([dn])),hn.revoke=!0):hn.src=arrayBufferToDataURL(dn):hn.src=rn,fn&&(hn.transforms=getTransforms(fn)),hn}function parseImage(on,rn){rn===void 0&&(rn={});var un=rn.checkOrientation,dn=rn.parse;return new Promise(function(pn){un||dn?getImageData(on).then(function(fn){var hn=resetAndGetOrientation(fn);pn(getImage(fn?{src:on,arrayBuffer:fn,orientation:hn}:{src:on,arrayBuffer:null,orientation:null}))}).catch(function(fn){console.warn(fn),pn(getImage({src:on}))}):pn(getImage({src:on}))})}function createImage(on,rn){return rn===void 0&&(rn={}),new Promise(function(un,dn){var pn=document.createElement("img");rn.crossOrigin&&(pn.crossOrigin=rn.crossOrigin!==!0?rn.crossOrigin:"anonymous"),pn.src=on,pn.style.visibility="hidden",pn.style.position="fixed",document.body.appendChild(pn),pn.complete?(un(pn),document.body.removeChild(pn)):(pn.addEventListener("load",function(){un(pn),document.body.removeChild(pn)}),pn.addEventListener("error",function(){dn(null),document.body.removeChild(pn)}))})}function loadImage(on,rn){return rn===void 0&&(rn={}),parseImage(on,__assign(__assign({},rn),{crossOrigin:isCrossOriginURL(on)&&rn.crossOrigin})).then(function(un){return new Promise(function(dn,pn){createImage(un.src,rn).then(function(fn){dn(__assign(__assign({},un),{width:fn.naturalWidth,height:fn.naturalHeight}))}).catch(function(){pn(null)})})})}function getImageStyle(on,rn,un,dn,pn){pn===void 0&&(pn=null);var fn=on.width>on.height?{width:Math.min(512,on.width),height:Math.min(512,on.width)/(on.width/on.height)}:{height:Math.min(512,on.height),width:Math.min(512,on.height)*(on.width/on.height)},hn=getTransformedImageSize(rn),gn={rotate:rn.transforms.rotate,flip:{horizontal:rn.transforms.flip.horizontal,vertical:rn.transforms.flip.vertical},translateX:un.left/dn,translateY:un.top/dn,scale:1/dn},vn={rotate:{left:(fn.width-hn.width)/(2*dn),top:(fn.height-hn.height)/(2*dn)},scale:{left:(1-1/dn)*fn.width/2,top:(1-1/dn)*fn.height/2}},yn=__assign(__assign({},gn),{scale:gn.scale*(on.width/fn.width)}),xn={width:fn.width+"px",height:fn.height+"px",left:"0px",top:"0px",transition:"none",transform:"translate3d("+(-vn.rotate.left-vn.scale.left-gn.translateX)+"px, "+(-vn.rotate.top-vn.scale.top-gn.translateY)+"px, 0px)"+getStyleTransforms(yn),willChange:"none"};return pn&&pn.active&&(xn.willChange="transform",xn.transition=pn.duration+"ms "+pn.timingFunction),xn}function getBackgroundStyle(on,rn,un){return un===void 0&&(un=null),on&&rn&&rn.visibleArea?getImageStyle(on,rn,rn.visibleArea,getCoefficient(rn),un):{}}function getPreviewStyle(on,rn,un,dn){return dn===void 0&&(dn=null),on&&rn&&rn.visibleArea&&rn.coordinates?getImageStyle(on,rn,rn.coordinates,ratio(rn.coordinates)>ratio(un)?rn.coordinates.width/un.width:rn.coordinates.height/un.height,dn):{}}function fixedStencilConstraints(on,rn){var un=defaultStencilConstraints({},rn);return{stencilSize:function(dn,pn){var fn=isFunction(on.stencilSize)?on.stencilSize(dn,pn):on.stencilSize;return approximateSize(__assign(__assign({},fn),{aspectRatio:aspectRatioIntersection(un.aspectRatio,createAspectRatio(ratio(fn)))}))}}}function getStencilSize(on,rn){var un=on.boundary,dn=isFunction(rn.stencilSize)?rn.stencilSize(on,rn):rn.stencilSize;return(dn.width>un.width||dn.height>un.height)&&(dn=approximateSize({sizeRestrictions:{maxWidth:un.width,maxHeight:un.height,minWidth:0,minHeight:0},width:dn.width,height:dn.height,aspectRatio:{minimum:ratio(dn),maximum:ratio(dn)}})),dn}function sizeRestrictions(on,rn){var un=getStencilSize(on,__assign(__assign({},rn),{stencilSize:rn.stencilSize})),dn=getAreaSizeRestrictions(on,rn);return{maxWidth:dn.maxWidth*un.width/on.boundary.width,maxHeight:dn.maxHeight*un.height/on.boundary.height,minWidth:0,minHeight:0}}function defaultSize(on,rn){var un=on.imageSize,dn=on.visibleArea,pn=on.boundary,fn=getSizeRestrictions(on,rn),hn=getAspectRatio(on,rn),gn=isFunction(rn.stencilSize)?rn.stencilSize(on,rn):rn.stencilSize,vn=dn||un,yn,xn;return ratio(vn)>ratio(pn)?(yn=gn.height*vn.height/pn.height,xn=yn*ratio(gn)):(xn=gn.width*vn.width/pn.width,yn=xn/ratio(gn)),approximateSize({width:xn,height:yn,aspectRatio:hn,sizeRestrictions:fn})}function aspectRatio(on,rn){var un=ratio(getStencilSize(on,rn));return{minimum:un,maximum:un}}function fixedStencilAlgorithm(on,rn){if(isInitializedState(on)){var un=copyState(on),dn=getStencilSize(on,rn);un.visibleArea=applyScale(un.visibleArea,un.coordinates.width*un.boundary.width/(un.visibleArea.width*dn.width));var pn=fitToSizeRestrictions(un.visibleArea,getAreaSizeRestrictions(un,rn));return pn!==1&&(un.visibleArea=applyScale(un.visibleArea,pn),un.coordinates=applyScale(un.coordinates,pn)),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(un.coordinates),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn)),un.coordinates=moveToPositionRestrictions(un.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(un.visibleArea),getAreaPositionRestrictions(un,rn))),un}return on}function fixedStencil(on,rn,un){return un&&un.immediately?fixedStencilAlgorithm(on,rn):on}function hybridStencilAutoZoomAlgorithm(on,rn){if(isInitializedState(on)){var un=copyState(on),dn={width:0,height:0};ratio(un.boundary)>ratio(un.coordinates)?(dn.height=un.boundary.height*.8,dn.width=dn.height*ratio(un.coordinates)):(dn.width=un.boundary.width*.8,dn.height=dn.width*ratio(un.coordinates)),un.visibleArea=applyScale(un.visibleArea,un.coordinates.width*un.boundary.width/(un.visibleArea.width*dn.width));var pn=fitToSizeRestrictions(un.visibleArea,getAreaSizeRestrictions(un,rn));return un.visibleArea=applyScale(un.visibleArea,pn),pn!==1&&(dn.height/=pn,dn.width/=pn),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(un.coordinates),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn)),un.coordinates=moveToPositionRestrictions(un.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(un.visibleArea),getPositionRestrictions(un,rn))),un}return on}function hybridStencilAutoZoom(on,rn,un){return un.immediately?hybridStencilAutoZoomAlgorithm(on,rn):on}function deprecationWarning(on){process.env.NODE_ENV==="development"&&console.warn("Deprecation warning: ".concat(on))}function useDeprecationWarning(){var on=useRef([]);return function(rn){on.current.indexOf(rn)===-1&&(deprecationWarning(rn),on.current.push(rn))}}function createCropper(on){return forwardRef(on)}function useFirstMountState(){var on=useRef(!0);return on.current?(on.current=!1,!0):on.current}var useUpdateEffect=function(on,rn){var un=useFirstMountState();useEffect(function(){if(!un)return on()},rn)};function useStateWithCallback(on){var rn=__read(useState(on),2),un=rn[0],dn=rn[1],pn=__read(useState(null),2),fn=pn[0],hn=pn[1],gn=useRef(on);return useUpdateEffect(function(){fn&&fn(un,gn.current)},[fn]),[un,function(vn,yn){gn.current=un,dn(vn),hn(function(){return yn})}]}var CropperInstance=function(on){__extends(rn,on);function rn(un,dn){var pn=on.call(this)||this;return pn.props=un,pn.notify=dn,pn.data={state:null,transitions:!1,interactions:getEmptyInteractions()},pn}return rn.prototype.getProps=function(){return this.props()},rn.prototype.setData=function(un){this.data=un,this.notify()},rn.prototype.getData=function(){return this.data},rn}(AbstractCropperInstance);function useForceRerender(){var on=__read(useState({}),2);on[0];var rn=on[1];return function(){rn({})}}function usePersistentFunction(on){var rn=useRef(on);return rn.current=on,function(){for(var un=[],dn=0;dn<arguments.length;dn++)un[dn]=arguments[dn];return rn.current.apply(rn,__spreadArray([],__read(un),!1))}}function useCropperInstance(on){var rn=useForceRerender(),un=usePersistentFunction(function(){var pn=on(),fn=pn.settings,hn=__rest(pn,["settings"]),gn=__assign({imageRestriction:ImageRestriction.fitArea,transformImage:{adjustStencil:!0}},fn),vn=__assign({transitions:!0},hn);return __assign({settings:__assign(__assign({},gn),createDefaultSettings(gn))},vn)}),dn=useRef(new CropperInstance(un,rn));return dn.current}function useCropperImage(on){var rn=on.src,un=on.onLoadingStart,dn=on.onLoadingEnd,pn=on.onError,fn=on.onLoad,hn=on.crossOrigin,gn=on.checkOrientation,vn=on.canvas,yn=on.unloadTime,xn=__read(useState(null),2),wn=xn[0],Cn=xn[1],Tn=__read(useState(!1),2),Pn=Tn[0],Sn=Tn[1],En=__read(useStateWithCallback(!1),2),_n=En[0],Rn=En[1],$n=useRef(null);return useEffect(function(){if($n.current!==rn)if($n.current=rn||null,Rn(!1),rn){Sn(!0),un?.();var Mn=[loadImage(rn,{crossOrigin:isUndefined(hn)?vn:hn,checkOrientation:gn})];_n&&yn&&Mn.push(promiseTimeout(yn)),Promise.all(Mn).then(function(An){var Dn=__read(An,1),On=Dn[0];$n.current===rn&&Cn(On)}).catch(function(){$n.current===rn&&pn?.()}).finally(function(){$n.current===rn&&(dn?.(),Sn(!1))})}else yn?promiseTimeout(yn).then(function(){$n.current===rn&&Cn(null)}):Cn(null)},[rn,wn]),useEffect(function(){wn&&Rn(!0,function(){fn?.(wn)})},[wn]),{isLoading:function(){return Pn},isLoaded:function(){return _n},getImage:function(){return wn},setImage:Cn}}var useWindowResize=function(on){var rn=useRef(on),un=function(){rn.current&&rn.current()};useEffect(function(){rn.current=on},[on]),useEffect(function(){return window.addEventListener("resize",un),window.addEventListener("orientationchange",un),function(){window.removeEventListener("resize",un),window.removeEventListener("orientationchange",un)}},[])};function useCropperAutoReconcile(on,rn){rn===void 0&&(rn=!0);var un=__read(useState(rn),2),dn=un[0],pn=un[1];return useLayoutEffect$2(function(){dn&&!on.hasInteractions()&&on.reconcileState()}),{pause:function(){pn(!1)},resume:function(){pn(!0)}}}function useAbstractCropper(on){var rn=this,un=on(),dn=un.src,pn=un.onReady,fn=un.onError,hn=un.onUpdate,gn=un.canvas,vn=gn===void 0?!0:gn,yn=un.unloadTime,xn=yn===void 0?500:yn,wn=un.crossOrigin,Cn=wn===void 0?!0:wn,Tn=un.checkOrientation,Pn=Tn===void 0?!0:Tn,Sn=un.autoReconcileState,En=Sn===void 0?!0:Sn,_n=useRef(null),Rn=useRef(null),$n=useRef(null),Mn=useRef(null),An=__read(useStateWithCallback(null),2),Dn=An[0],On=An[1],In=useCropperInstance(function(){return __assign(__assign({},on()),{getInstance:function(){return Mn.current}})}),Nn=useCropperImage({src:dn,crossOrigin:Cn,checkOrientation:Pn,unloadTime:xn,canvas:vn,onError:function(){Mn.current&&fn?.(Mn.current)}}),jn=useCropperAutoReconcile(In,En),Ln=function(){return __awaiter(rn,void 0,void 0,function(){var Vn,Yn,Gn;return __generator(this,function(Wn){switch(Wn.label){case 0:return Rn.current?(jn.pause(),Vn=Nn.getImage(),[4,(Gn=Rn.current)===null||Gn===void 0?void 0:Gn.stretchTo(Vn)]):[3,2];case 1:Yn=Wn.sent(),On(Vn,function(){Yn&&Vn?In.reset(Yn,Vn):In.clear()}),jn.resume(),Wn.label=2;case 2:return[2]}})})},Un=function(){return __awaiter(rn,void 0,void 0,function(){var Vn,Yn,Gn,Wn;return __generator(this,function(Fn){switch(Fn.label){case 0:return Rn.current?(jn.pause(),Vn=Nn.getImage(),[4,(Wn=Rn.current)===null||Wn===void 0?void 0:Wn.stretchTo(Vn)]):[3,2];case 1:Yn=Fn.sent(),Yn&&Vn?(Gn=In.getState(),Gn?(Yn.width!==Gn.boundary.width||Yn.height!==Gn.boundary.height)&&(In.setBoundary(Yn),In.reconcileState()):In.reset(Yn,Vn)):In.clear(),jn.resume(),Fn.label=2;case 2:return[2]}})})},Hn={reset:function(){return Ln()},refresh:function(){return Un()},setImage:function(Vn){return On(Vn)},reconcileState:In.reconcileState,moveCoordinates:In.moveCoordinates,moveCoordinatesEnd:In.moveCoordinatesEnd,resizeCoordinates:In.resizeCoordinates,clear:In.clear,resizeCoordinatesEnd:In.resizeCoordinatesEnd,moveImage:In.moveImage,flipImage:In.flipImage,zoomImage:In.zoomImage,rotateImage:In.rotateImage,transformImage:In.transformImage,transformImageEnd:In.transformImageEnd,setCoordinates:In.setCoordinates,setVisibleArea:In.setVisibleArea,startTransitions:In.startTransitions,setState:In.setState,hasInteractions:In.hasInteractions,getStencilCoordinates:In.getStencilCoordinates,getCoordinates:In.getCoordinates,getVisibleArea:In.getVisibleArea,getTransforms:In.getTransforms,getTransitions:In.getTransitions,getInteractions:In.getInteractions,getSettings:In.getSettings,getState:In.getState,getDefaultState:function(){var Vn=In.getState(),Yn=Nn.getImage();return Vn&&Yn?In.createDefaultState(Vn.boundary,Yn):null},getCanvas:function(Vn){var Yn=In.getState();return _n.current&&$n.current&&Yn?$n.current.draw(Yn,_n.current,Vn):null},getImage:function(){return Dn?__assign({},Dn):null},isLoading:Nn.isLoading,isLoaded:Nn.isLoaded};return useWindowResize(function(){Un()}),useUpdateEffect(function(){Ln()},[Nn.getImage()]),useUpdateEffect(function(){Mn.current&&Dn&&pn?.(Mn.current)},[Dn]),useUpdateEffect(function(){Mn.current&&hn?.(Mn.current)},[Nn.isLoaded(),Nn.isLoading()]),useImperativeHandle(Mn,function(){return Hn}),{cropper:Hn,refs:{image:_n,boundary:Rn,canvas:$n},image:Dn}}var StretchableBoundary=forwardRef(function(on,rn){var un=on.className,dn=on.style,pn=on.stretcherClassName,fn=on.contentClassName,hn=on.stretchAlgorithm,gn=hn===void 0?stretchCropperBoundary:hn,vn=on.sizeAlgorithm,yn=vn===void 0?fillBoundary:vn,xn=on.children,wn=useRef(null),Cn=useRef(null);return useImperativeHandle(rn,function(){return{reset:function(){var Tn=wn.current;Tn&&(Tn.style.height="",Tn.style.width="")},stretchTo:function(Tn){var Pn=wn.current,Sn=Cn.current;if(Tn?.width&&Tn?.height&&Pn&&Sn){gn(Sn,Pn,Tn);var En=yn(Sn,Tn);return Promise.resolve(En.width&&En.height?En:null)}else return Pn&&(Pn.style.height="",Pn.style.width=""),Promise.resolve(null)}}}),React__default.createElement("div",{ref:Cn,style:dn,className:cn("advanced-cropper-boundary",un)},React__default.createElement("div",{ref:wn,className:cn(["advanced-cropper-boundary__stretcher",pn])}),React__default.createElement("div",{className:cn(["advanced-cropper-boundary__content",fn])},xn))});StretchableBoundary.displayName="StretchableBoundary";var CropperFade=function(on){var rn=on.visible,un=on.className,dn=on.style,pn=on.children;return React__default.createElement("div",{style:dn,className:cn(un,"advanced-cropper-fade",!!rn&&"advanced-cropper-fade--visible")},pn)},CropperWrapper=function(on){var rn=on.cropper,un=on.children,dn=on.className,pn=on.style,fn=rn?rn.getState():null,hn=rn?rn.isLoaded():!1;return React__default.createElement("div",{className:cn(dn,"advanced-cropper-wrapper"),style:pn},React__default.createElement(CropperFade,{visible:fn&&hn,className:"advanced-cropper-wrapper__fade"},un))};function preventDefault(on){on.preventDefault()}var CropperBackgroundImage=forwardRef(function(on,rn){var un=on.className,dn=on.style,pn=on.cropper,fn=on.crossOrigin,hn=fn===void 0?!0:fn,gn=pn.getState(),vn=pn.getTransitions(),yn=pn.getImage(),xn=yn&&gn?getBackgroundStyle(yn,gn,vn):{},wn=yn?yn.src:void 0;return wn?React__default.createElement("img",{key:wn,ref:rn,className:cn("advanced-cropper-background-image",un),src:wn,crossOrigin:hn===!0?"anonymous":hn||void 0,style:__assign(__assign({},xn),dn),onMouseDown:preventDefault}):null});CropperBackgroundImage.displayName="CropperBackgroundImage";var CropperCanvas=forwardRef(function(on,rn){var un=useRef(null),dn=useRef(null);return useImperativeHandle(rn,function(){return{draw:function(pn,fn,hn){return hn===void 0&&(hn={}),fn&&un.current&&dn.current?drawCroppedArea(pn,fn,un.current,dn.current,hn):null}}}),React__default.createElement(React__default.Fragment,null,React__default.createElement("canvas",{className:"advanced-cropper-canvas",ref:un}),React__default.createElement("canvas",{className:"advanced-cropper-canvas",ref:dn}))});CropperCanvas.displayName="CropperCanvas";var DraggableElement=function(on){__extends(rn,on);function rn(un){var dn=on.call(this,un)||this;return dn.processMove=function(pn,fn){var hn,gn=dn.container.current;if(gn&&dn.touches.length){var vn=gn.getBoundingClientRect(),yn=vn.left,xn=vn.top;if(dn.touches.length===1&&fn.length===1&&dn.props.onMove){var wn={left:Math.abs(fn[0].clientX-dn.anchor.left-yn)<Math.abs(dn.touches[0].clientX-dn.anchor.left-yn),top:Math.abs(fn[0].clientY-dn.anchor.top-xn)<Math.abs(dn.touches[0].clientY-dn.anchor.top-xn)},Cn={left:0,top:0};(!dn.props.useAnchor||!wn.left)&&(Cn.left=fn[0].clientX-dn.touches[0].clientX),(!dn.props.useAnchor||!wn.top)&&(Cn.top=fn[0].clientY-dn.touches[0].clientY),(hn=dn.props)===null||hn===void 0||hn.onMove(Cn,pn),dn.touches=__spreadArray([],__read(fn),!1)}}},dn.processEnd=function(){var pn=dn.props,fn=pn.onMoveEnd,hn=pn.onLeave;!dn.props.disabled&&dn.touches.length&&fn?.(),dn.hovered&&(hn?.(),dn.hovered=!1),dn.touches=[]},dn.initAnchor=function(pn){var fn=dn.container.current;if(fn){var hn=fn.getBoundingClientRect(),gn=hn.left,vn=hn.top;dn.anchor={left:pn.clientX-gn,top:pn.clientY-vn}}},dn.onMouseOver=function(){var pn=dn.props,fn=pn.onEnter,hn=pn.disabled;!dn.hovered&&!hn&&(dn.hovered=!0,fn?.())},dn.onMouseLeave=function(){var pn=dn.props.onLeave;dn.hovered&&!dn.touches.length&&(dn.hovered=!1,pn?.())},dn.onTouchStart=function(pn){var fn=dn.props,hn=fn.onEnter,gn=fn.onMoveStart,vn=fn.disabled;if(pn.cancelable){dn.touches=Array.from(pn.touches);var yn=!vn&&pn.touches.length===1;yn&&(dn.touches=Array.from(pn.touches),gn?.()),!dn.hovered&&!vn&&(dn.hovered=!0,hn?.()),(dn.started||yn)&&(pn.preventDefault(),pn.stopPropagation())}},dn.onTouchEnd=function(){dn.started=!1,dn.processEnd()},dn.onTouchMove=function(pn){dn.touches.length>=1&&(dn.started?(dn.processMove(pn,Array.from(pn.touches)),pn.preventDefault(),pn.stopPropagation()):distance({left:dn.touches[0].clientX,top:dn.touches[0].clientY},{left:pn.touches[0].clientX,top:pn.touches[0].clientY})>(dn.props.activationDistance||0)&&(dn.initAnchor({clientX:pn.touches[0].clientX,clientY:pn.touches[0].clientY}),dn.started=!0))},dn.onMouseDown=function(pn){var fn=dn.props,hn=fn.onMoveStart,gn=fn.disabled;if(!gn&&pn.button===0){var vn={clientX:pn.clientX,clientY:pn.clientY};dn.touches=[vn],dn.initAnchor(vn),pn.stopPropagation(),hn?.()}},dn.onMouseMove=function(pn){!dn.props.disabled&&dn.touches.length&&(dn.processMove(pn,[{clientX:pn.clientX,clientY:pn.clientY}]),pn.preventDefault&&pn.cancelable&&pn.preventDefault(),pn.stopPropagation())},dn.onMouseUp=function(){dn.processEnd()},dn.touches=[],dn.hovered=!1,dn.started=!1,dn.anchor={left:0,top:0},dn.container=createRef(),dn}return rn.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var un=this.container.current;un&&(un.removeEventListener("touchstart",this.onTouchStart),un.removeEventListener("mousedown",this.onMouseDown))},rn.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var un=this.container.current;un&&(un.addEventListener("touchstart",this.onTouchStart,{passive:!1}),un.addEventListener("mousedown",this.onMouseDown,{passive:!1}))},rn.prototype.componentDidUpdate=function(un){this.props.disabled&&!un.disabled&&(this.touches=[])},rn.prototype.render=function(){var un=this.props,dn=un.children,pn=un.className;return React__default.createElement("div",{className:cn("advanced-cropper-draggable-element",pn),ref:this.container,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},dn)},rn.defaultProps={disabled:!1,activationDistance:30,useAnchor:!0,rerender:!0},rn}(Component$1),LineWrapper=function(on){var rn=on.position,un=on.className,dn=on.disabled,pn=on.onDrag,fn=on.onDragEnd,hn=on.onLeave,gn=on.onEnter,vn=on.children;return React__default.createElement(DraggableElement,{className:cn(["advanced-cropper-line-wrapper",rn&&"advanced-cropper-line-wrapper--".concat(rn),dn&&"advanced-cropper-line-wrapper--disabled",un]),disabled:dn,onMove:pn,onMoveEnd:fn,onLeave:hn,onEnter:gn,activationDistance:0},React__default.createElement("div",{className:cn(["advanced-cropper-line-wrapper__content",rn&&"advanced-cropper-line-wrapper__content--".concat(rn)])},vn))},SimpleLine=function(on){var rn,un,dn=on.position,pn=on.hoverClassName,fn=on.wrapperClassName,hn=on.defaultClassName,gn=on.disabled,vn=on.onMove,yn=on.onMoveEnd,xn=__read(useState(!1),2),wn=xn[0],Cn=xn[1],Tn=function(){Cn(!0)},Pn=function(){Cn(!1)};return React__default.createElement(LineWrapper,{className:cn("advanced-cropper-simple-line-wrapper",fn,(rn={},rn["advanced-cropper-simple-line-wrapper--".concat(dn)]=!!dn,rn)),position:dn,disabled:gn,onDrag:vn,onDragEnd:yn,onLeave:Pn,onEnter:Tn},React__default.createElement("div",{className:cn("advanced-cropper-simple-line",wn&&"advanced-cropper-simple-line--hover",hn,wn&&pn,(un={},un["advanced-cropper-simple-line--".concat(dn)]=!!dn,un))}))},HandlerWrapper=function(on){var rn=on.horizontalPosition,un=on.verticalPosition,dn=on.className,pn=on.disabled,fn=on.onDrag,hn=on.onDragEnd,gn=on.onLeave,vn=on.onEnter,yn=on.children,xn=on.style,wn=rn||un?getDirectionNames(rn,un).snakeCase:null;return React__default.createElement("div",{style:xn,className:cn(dn,"advanced-cropper-handler-wrapper",wn&&"advanced-cropper-handler-wrapper--".concat(wn),pn&&"advanced-cropper-handler-wrapper--disabled")},React__default.createElement(DraggableElement,{className:"advanced-cropper-handler-wrapper__draggable",disabled:pn,onMove:fn,onMoveEnd:hn,onLeave:gn,onEnter:vn,activationDistance:0},yn))},SimpleHandler=function(on){var rn,un=on.verticalPosition,dn=on.horizontalPosition,pn=on.hoverClassName,fn=on.wrapperClassName,hn=on.defaultClassName,gn=on.wrapperStyle,vn=on.disabled,yn=on.onMove,xn=on.onMoveEnd,wn=__read(useState(!1),2),Cn=wn[0],Tn=wn[1],Pn=function(){Tn(!0)},Sn=function(){Tn(!1)};return React__default.createElement(HandlerWrapper,{style:gn,className:cn("advanced-cropper-simple-handler-wrapper",fn,un&&"advanced-cropper-simple-handler-wrapper--".concat(un),dn&&"advanced-cropper-simple-handler-wrapper--".concat(dn),dn&&un&&"advanced-cropper-simple-handler-wrapper--".concat(dn,"-").concat(un),Cn&&"advanced-cropper-simple-handler-wrapper--hover"),verticalPosition:un,horizontalPosition:dn,disabled:vn,onDrag:yn,onDragEnd:xn,onLeave:Sn,onEnter:Pn},React__default.createElement("div",{className:cn("advanced-cropper-simple-handler",Cn&&"advanced-cropper-simple-handler--hover",hn,Cn&&pn,(rn={},rn["advanced-cropper-simple-handler--".concat(un)]=!!un,rn["advanced-cropper-simple-handler--".concat(dn)]=!!dn,rn["advanced-cropper-simple-handler--".concat(dn,"-").concat(un)]=dn&&un,rn))}))},HORIZONTAL_DIRECTIONS=["east","west",null],VERTICAL_DIRECTIONS=["south","north",null],BoundingBox=function(on){var rn=on.style,un=on.className,dn=on.children,pn=on.onResize,fn=on.onResizeEnd,hn=on.handlerComponent,gn=hn===void 0?SimpleHandler:hn,vn=on.handlers,yn=vn===void 0?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:vn,xn=on.handlerClassNames,wn=xn===void 0?{}:xn,Cn=on.handlerWrapperClassNames,Tn=Cn===void 0?{}:Cn,Pn=on.lines,Sn=Pn===void 0?{west:!0,north:!0,east:!0,south:!0}:Pn,En=on.lineComponent,_n=En===void 0?SimpleLine:En,Rn=on.lineClassNames,$n=Rn===void 0?{}:Rn,Mn=on.lineWrapperClassNames,An=Mn===void 0?{}:Mn,Dn=on.disabled,On=Dn===void 0?!1:Dn,In=on.reference,Nn=In===void 0?null:In,jn=__read(useState(null),2),Ln=jn[0],Un=jn[1],Hn=useMemo$1(function(){var Fn=[];return HORIZONTAL_DIRECTIONS.forEach(function(Bn){VERTICAL_DIRECTIONS.forEach(function(zn){if(Bn!==zn){var Kn=getDirectionNames(Bn,zn),Jn=Kn.snakeCase,rr=Kn.camelCase;Jn&&rr&&Fn.push({name:rr,className:Jn,verticalPosition:zn,horizontalPosition:Bn})}})}),Fn},[]),Vn=useMemo$1(function(){var Fn=[];return Hn.forEach(function(Bn){isCardinalDirection(Bn.name)&&(isObject(Sn)?Sn[Bn.name]:Sn)&&Fn.push({name:Bn.name,component:_n,className:cn($n.default,$n[Bn.name],On&&$n.disabled),wrapperClassName:cn("advanced-cropper-bounding-box__line","advanced-cropper-bounding-box__line--".concat(Bn.name),An.default,An[Bn.name],On&&An.disabled),hoverClassName:$n.hover,verticalPosition:Bn.verticalPosition,horizontalPosition:Bn.horizontalPosition,disabled:On})}),Fn},[Hn,Sn,_n,$n,An,On]),Yn=useMemo$1(function(){var Fn=[];return Hn.forEach(function(Bn){(isObject(yn)?yn[Bn.name]:yn)&&Fn.push({name:Bn.name,component:gn,className:cn(wn.default,wn[Bn.name]),containerClassName:cn("advanced-cropper-bounding-box__handler-wrapper","advanced-cropper-bounding-box__handler-wrapper--".concat(Bn.className)),wrapperClassName:cn("advanced-cropper-bounding-box__handler","advanced-cropper-bounding-box__handler--".concat(Bn.className),Tn.default,Tn[Bn.name]),hoverClassName:wn.hover,verticalPosition:Bn.verticalPosition,horizontalPosition:Bn.horizontalPosition,disabled:On})}),Fn},[Hn,yn,gn,wn,Tn,On]),Gn=function(Fn,Bn){return function(zn,Kn){var Jn=zn.left,rr=zn.top,er={left:Jn,top:rr},Qn;if(!Bn&&Fn?Qn="width":Bn&&!Fn&&(Qn="height"),!On){if(pn){var Xn=getDirectionNames(Fn,Bn).camelCase;Xn&&pn(Xn,er,{reference:Ln||Nn,preserveAspectRatio:Kn&&Kn.shiftKey,respectDirection:Qn,compensate:!0})}Ln||Un(Nn)}}},Wn=function(){fn?.(),Un(null)};return React__default.createElement("div",{className:cn("advanced-cropper-bounding-box",un),style:rn},dn,React__default.createElement("div",null,Vn.map(function(Fn){return React__default.createElement(Fn.component,{key:Fn.name,defaultClassName:Fn.className,hoverClassName:Fn.hoverClassName,wrapperClassName:Fn.wrapperClassName,position:Fn.name,disabled:Fn.disabled,onMove:Gn(Fn.horizontalPosition,Fn.verticalPosition),onMoveEnd:Wn})})),React__default.createElement("div",null,Yn.map(function(Fn){var Bn=React__default.createElement(Fn.component,{defaultClassName:Fn.className,hoverClassName:Fn.hoverClassName,wrapperClassName:Fn.wrapperClassName,horizontalPosition:Fn.horizontalPosition,verticalPosition:Fn.verticalPosition,disabled:Fn.disabled,onMove:Gn(Fn.horizontalPosition,Fn.verticalPosition),onMoveEnd:Wn});return React__default.createElement("div",{key:Fn.name,className:Fn.containerClassName},Bn)})))},StencilOverlay=function(on){var rn=on.className,un=on.children;return React__default.createElement("div",{className:cn("advanced-cropper-stencil-overlay",rn)},un)};function useTransition(on){on===void 0&&(on=null);var rn=useRef(new Animation),un=__read(useState(!1),2),dn=un[0],pn=un[1];return[function(fn){on&&on.active?rn.current.start(__assign(__assign({},on),{onStart:function(){pn(!0)},onProgress:function(hn){fn(hn)},onStop:function(){pn(!1)}})):rn.current.active||fn(1)},dn]}var ArtificialTransition=function(on){var rn=on.className,un=on.transitions,dn=on.children,pn=__rest(on,["className","transitions","children"]),fn=useRef(null),hn=useRef(pn),gn=__read(useState(pn),2),vn=gn[0],yn=gn[1],xn=__read(useTransition(un),2),wn=xn[0],Cn=xn[1];useLayoutEffect$2(function(){if(!deepCompare(vn,pn)){yn(pn);var Sn=Cn?__assign({},hn.current):vn;wn(function(En){var _n=["left","top","height","width"];_n.forEach(function(Rn){var $n=pn[Rn],Mn=Sn[Rn];hn.current[Rn]=isNumber(Mn)&&isNumber($n)?Mn+($n-Mn)*En:$n}),fn.current&&(fn.current.style.width="".concat(hn.current.width,"px"),fn.current.style.height="".concat(hn.current.height,"px"),fn.current.style.transform="translate3d(".concat(hn.current.left,"px, ").concat(hn.current.top,"px, 0px)"))})}},[vn,Cn,pn.width,pn.height,pn.top,pn.left]);var Tn=Cn?hn.current:pn,Pn={left:0,top:0,width:"".concat(Tn.width,"px"),height:"".concat(Tn.height,"px"),transform:"translate3d(".concat(Tn.left,"px, ").concat(Tn.top,"px, 0px)")};return React__default.createElement("div",{ref:fn,className:cn("advanced-cropper-artificial-transition",rn),style:Pn},dn)},StencilWrapper=function(on){var rn=on.className,un=on.transitions,dn=on.width,pn=on.height,fn=on.left,hn=on.top,gn=on.children;return React__default.createElement(ArtificialTransition,{className:cn("advanced-cropper-stencil-wrapper",rn),transitions:un,width:dn,height:pn,top:hn,left:fn},gn)},StencilGrid=function(on){var rn=on.columns,un=rn===void 0?3:rn,dn=on.rows,pn=dn===void 0?3:dn,fn=on.visible,hn=fn===void 0?!1:fn,gn=on.className,vn=[],yn=__read(useState(un),2),xn=yn[0],wn=yn[1],Cn=__read(useState(pn),2),Tn=Cn[0],Pn=Cn[1];useUpdateEffect(function(){hn&&(Pn(pn),wn(un))},[hn,un,pn]);for(var Sn=0;Sn<Tn;Sn++){for(var En=[],_n=0;_n<xn;_n++)En.push(React__default.createElement("div",{key:_n,className:cn("advanced-cropper-stencil-grid__cell",Sn===0&&"advanced-cropper-stencil-grid__cell--top",Sn===Tn-1&&"advanced-cropper-stencil-grid__cell--bottom",_n===0&&"advanced-cropper-stencil-grid__cell--left",_n===xn-1&&"advanced-cropper-stencil-grid__cell--right")}));vn.push(React__default.createElement("div",{key:Sn,className:"advanced-cropper-stencil-grid__row"},En))}return React__default.createElement("div",{className:cn("advanced-cropper-stencil-grid",hn&&"advanced-cropper-stencil-grid--visible",gn)},vn)},RectangleStencil=forwardRef(function(on,rn){var un=on.cropper,dn=on.coordinates,pn=on.aspectRatio,fn=on.minAspectRatio,hn=on.maxAspectRatio,gn=on.handlerComponent,vn=gn===void 0?SimpleHandler:gn,yn=on.handlers,xn=yn===void 0?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:yn,wn=on.handlerClassNames,Cn=wn===void 0?{}:wn,Tn=on.handlerWrapperClassNames,Pn=Tn===void 0?{}:Tn,Sn=on.lines,En=Sn===void 0?{west:!0,north:!0,east:!0,south:!0}:Sn,_n=on.lineComponent,Rn=_n===void 0?SimpleLine:_n,$n=on.lineClassNames,Mn=$n===void 0?{}:$n,An=on.lineWrapperClassNames,Dn=An===void 0?{}:An,On=on.resizable,In=On===void 0?!0:On,Nn=on.movable,jn=Nn===void 0?!0:Nn,Ln=on.grid,Un=on.gridClassName,Hn=on.className,Vn=on.movingClassName,Yn=on.resizingClassName,Gn=on.previewClassName,Wn=on.boundingBoxClassName,Fn=on.overlayClassName,Bn=on.draggableAreaClassName,zn=on.disabled,Kn=un.getState(),Jn=un.getTransitions(),rr=un.getInteractions(),er=In&&!zn,Qn=jn&&!zn;useImperativeHandle(rn,function(){return{aspectRatio:createAspectRatio(pn||{minimum:fn,maximum:hn})}});var Xn=function(Rr){un&&Qn&&un.moveCoordinates(Rr)},Zn=function(){un&&un.moveCoordinatesEnd()},cr=function(Rr,Ar,$r){un&&er&&un.resizeCoordinates(Rr,Ar,$r)},vr=function(){un&&un.resizeCoordinatesEnd()},xr=dn?isFunction(dn)?dn(Kn):dn:getStencilCoordinates(Kn),yr=xr.width,pr=xr.height,Tr=xr.left,kr=xr.top;return Kn&&React__default.createElement(StencilWrapper,{className:cn("advanced-cropper-rectangle-stencil",Hn,rr.moveCoordinates&&Vn,rr.resizeCoordinates&&Yn,{"advanced-cropper-rectangle-stencil--movable":Qn,"advanced-cropper-rectangle-stencil--moving":rr.moveCoordinates,"advanced-cropper-rectangle-stencil--resizable":er,"advanced-cropper-rectangle-stencil--resizing":rr.resizeCoordinates,"advanced-cropper-rectangle-stencil--disabled":zn}),width:yr,height:pr,left:Tr,top:kr,transitions:Jn},React__default.createElement(BoundingBox,{reference:Kn.coordinates,className:cn(Wn,"advanced-cropper-rectangle-stencil__bounding-box"),handlers:xn,handlerComponent:vn,handlerClassNames:Cn,handlerWrapperClassNames:Pn,lines:En,lineComponent:Rn,lineClassNames:Mn,lineWrapperClassNames:Dn,onResize:cr,onResizeEnd:vr,disabled:!er},React__default.createElement(DraggableElement,{disabled:!Qn,onMove:Xn,onMoveEnd:Zn,className:cn("advanced-cropper-rectangle-stencil__draggable-area",Bn)},React__default.createElement(StencilOverlay,{className:cn("advanced-cropper-rectangle-stencil__overlay",Fn)},Ln&&React__default.createElement(StencilGrid,{visible:un.hasInteractions(),columns:rr.transformImage.rotate?9:3,rows:rr.transformImage.rotate?9:3,className:cn("advanced-cropper-rectangle-stencil__grid",Un)}),React__default.createElement("div",{className:cn("advanced-cropper-rectangle-stencil__preview",Gn)})))))});RectangleStencil.displayName="RectangleStencil";function useRotateImageOptions(on){return useMemo$1(function(){return getOptions(on,{touch:!0},{touch:!1})},[on])}function useScaleImageOptions(on){return useMemo$1(function(){return getOptions(on,{touch:!0,wheel:{ratio:.1}},{touch:!1,wheel:!1})},[on])}function useMoveImageOptions(on){return useMemo$1(function(){return getOptions(on,{touch:!0,mouse:!0},{touch:!1,mouse:!1})},[on])}var TransformableImageEvent=function(){function on(rn){var un=rn.active;this.active=un,this.defaultPrevented=!1}return on.prototype.preventDefault=function(){this.defaultPrevented=!0},on}(),TransformableImage=function(on){__extends(rn,on);function rn(un){var dn=on.call(this,un)||this;return dn.processMove=function(pn){var fn=dn.props,hn=fn.onTransform,gn=fn.touchScale,vn=fn.touchMove,yn=fn.touchRotate,xn=dn.container.current;xn&&hn&&(hn(touchesToImageTransform(pn,dn.touches,xn,{scale:gn,rotate:yn,move:vn})),dn.touches=pn)},dn.processEnd=function(){var pn=dn.props.onTransformEnd;dn.transforming&&(dn.transforming=!1,pn&&pn())},dn.processStart=function(){dn.transforming=!0,dn.debouncedProcessEnd.clear()},dn.processEvent=function(pn){var fn=dn.props,hn=fn.onEvent,gn=fn.disabled,vn=fn.preventDefault,yn=vn===void 0?!0:vn,xn=new TransformableImageEvent({active:dn.transforming});return hn?hn(xn,pn):yn&&(pn.preventDefault(),pn.stopPropagation()),!gn&&!xn.defaultPrevented},dn.onWheel=function(pn){var fn=dn.props,hn=fn.onTransform,gn=fn.wheelScale,vn=dn.container.current;gn&&dn.processEvent(pn)&&(dn.processStart(),hn&&vn&&hn(wheelEventToImageTransform(pn,vn,gn===!0?.1:gn.ratio)),dn.touches.length||dn.debouncedProcessEnd())},dn.onTouchStart=function(pn){var fn=dn.props,hn=fn.touchMove,gn=fn.touchScale,vn=fn.touchRotate;if(pn.cancelable&&(hn||(gn||vn)&&pn.touches.length>1)&&dn.processEvent(pn)){var yn=dn.container.current;if(yn){var xn=yn.getBoundingClientRect(),wn=xn.left,Cn=xn.top,Tn=xn.bottom,Pn=xn.right;dn.touches=Array.from(pn.touches).filter(function(Sn){return Sn.clientX>wn&&Sn.clientX<Pn&&Sn.clientY>Cn&&Sn.clientY<Tn})}}},dn.onTouchEnd=function(pn){pn.touches.length===0&&(dn.touches=[],dn.processEnd())},dn.onTouchMove=function(pn){if(dn.touches.length){var fn=__spreadArray([],__read(pn.touches),!1).filter(function(hn){return!hn.identifier||dn.touches.find(function(gn){return gn.identifier===hn.identifier})});dn.processEvent(pn)&&(dn.processMove(fn),dn.processStart())}},dn.onMouseDown=function(pn){var fn=dn.props.mouseMove;if(fn&&"buttons"in pn&&pn.buttons===1&&dn.processEvent(pn)){var hn={clientX:pn.clientX,clientY:pn.clientY};dn.touches=[hn],dn.processStart()}},dn.onMouseMove=function(pn){dn.touches.length&&dn.processEvent(pn)&&dn.processMove([{clientX:pn.clientX,clientY:pn.clientY}])},dn.onMouseUp=function(){dn.touches=[],dn.processEnd()},dn.transforming=!1,dn.touches=[],dn.anchor={left:0,top:0},dn.container=createRef(),dn.debouncedProcessEnd=debounce(dn.processEnd,un.timeout),dn}return rn.prototype.shouldComponentUpdate=function(){return!0},rn.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var un=this.container.current;un&&(un.removeEventListener("touchstart",this.onTouchStart),un.removeEventListener("mousedown",this.onMouseDown),un.removeEventListener("wheel",this.onWheel))},rn.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var un=this.container.current;un&&(un.addEventListener("touchstart",this.onTouchStart,{passive:!1}),un.addEventListener("mousedown",this.onMouseDown,{passive:!1}),un.addEventListener("wheel",this.onWheel,{passive:!1}))},rn.prototype.render=function(){var un=this.props,dn=un.className,pn=un.children,fn=un.style;return React__default.createElement("div",{className:dn,style:fn,ref:this.container},pn)},rn.defaultProps={touchMove:!0,mouseMove:!0,touchScale:!0,touchRotate:!1,wheelScale:!0,timeout:500},rn}(Component$1),CropperBackgroundWrapper=function(on){var rn=on.scaleImage,un=rn===void 0?!0:rn,dn=on.moveImage,pn=dn===void 0?!0:dn,fn=on.rotateImage,hn=fn===void 0?!1:fn,gn=on.children,vn=on.className,yn=on.style,xn=on.cropper,wn=on.timeout,Cn=on.disabled,Tn=xn.getTransitions(),Pn=useRotateImageOptions(hn),Sn=useScaleImageOptions(un),En=useMoveImageOptions(pn);return React__default.createElement(TransformableImage,{className:vn,style:yn,onTransform:xn.transformImage,onTransformEnd:xn.transformImageEnd,touchMove:En.touch,mouseMove:En.mouse,touchScale:Sn.touch,wheelScale:Sn.wheel,touchRotate:Pn.touch,disabled:Tn.active||Cn,preventDefault:!Cn,timeout:wn},gn)},AbstractCropperComponent=function(on,rn){var un=on.style,dn=on.className,pn=on.stencilComponent,fn=pn===void 0?RectangleStencil:pn,hn=on.stencilConstraints,gn=hn===void 0?defaultStencilConstraints:hn,vn=on.stencilProps,yn=vn===void 0?{}:vn,xn=on.wrapperComponent,wn=xn===void 0?CropperWrapper:xn,Cn=on.wrapperProps,Tn=Cn===void 0?{}:Cn,Pn=on.backgroundComponent,Sn=Pn===void 0?CropperBackgroundImage:Pn,En=on.backgroundProps,_n=En===void 0?{}:En,Rn=on.backgroundClassName,$n=on.backgroundWrapperComponent,Mn=$n===void 0?CropperBackgroundWrapper:$n,An=on.backgroundWrapperProps,Dn=An===void 0?{}:An,On=on.boundaryComponent,In=On===void 0?StretchableBoundary:On,Nn=on.boundaryProps,jn=on.boundaryClassName,Ln=on.canvas,Un=Ln===void 0?!0:Ln,Hn=on.crossOrigin,Vn=Hn===void 0?!0:Hn,Yn=on.disabled,Gn=on.settings,Wn=__rest(on,["style","className","stencilComponent","stencilConstraints","stencilProps","wrapperComponent","wrapperProps","backgroundComponent","backgroundProps","backgroundClassName","backgroundWrapperComponent","backgroundWrapperProps","boundaryComponent","boundaryProps","boundaryClassName","canvas","crossOrigin","disabled","settings"]),Fn=useRef(null),Bn=useAbstractCropper(function(){return __assign(__assign({},Wn),{crossOrigin:Vn,stencilProps:yn,canvas:Un,settings:__assign(__assign({},Gn),gn(Gn,__assign(__assign({},yn),Fn.current)))})}),zn=Bn.cropper,Kn=Bn.image,Jn=Bn.refs,rr=fn,er=wn,Qn=Mn,Xn=Sn,Zn=In;useImperativeHandle(rn,function(){return zn});var cr={loading:zn.isLoading(),loaded:zn.isLoaded()};return React__default.createElement(er,__assign({},Tn,{disabled:Yn,className:cn("advanced-cropper",dn),cropper:zn,style:un},cr),React__default.createElement(Zn,__assign({},Nn,{ref:Jn.boundary,className:cn("advanced-cropper__boundary",jn)}),React__default.createElement(Qn,__assign({},Dn,{disabled:Yn,cropper:zn,className:"advanced-cropper__background-wrapper"}),zn.getState()&&React__default.createElement(Xn,__assign({},_n,{ref:Jn.image,crossOrigin:Vn,cropper:zn,className:cn("advanced-cropper__background",Rn)})),React__default.createElement(rr,__assign({},yn,{disabled:Yn,ref:Fn,cropper:zn,image:Kn}))),Un&&React__default.createElement(CropperCanvas,{ref:Jn.canvas})))},AbstractCropper=createCropper(AbstractCropperComponent),defaultSettings=["transformImage","moveCoordinates","resizeCoordinates","defaultCoordinates","defaultVisibleArea","areaPositionRestrictions","areaSizeRestrictions","sizeRestrictions","positionRestrictions","aspectRatio","minWidth","minHeight","maxWidth","maxHeight","defaultSize","defaultPosition","defaultTransforms","imageRestriction","priority"];function useAbstractCropperProps(on,rn){rn===void 0&&(rn=defaultSettings);var un={settings:{},props:{}};return Object.keys(on).forEach(function(dn){rn.some(function(pn){return pn===dn})?un.settings[dn]=on[dn]:un.props[dn]=on[dn]}),un}var FixedCropper=forwardRef(function(on,rn){var un=useAbstractCropperProps(on,__spreadArray(__spreadArray([],__read(defaultSettings),!1),["stencilSize"],!1));return React__default.createElement(AbstractCropper,__assign({postProcess:fixedStencil,stencilConstraints:fixedStencilConstraints},un.props,{settings:__assign(__assign({defaultSize,aspectRatio,sizeRestrictions:withDefaultSizeRestrictions(sizeRestrictions)},un.settings),{transformImage:__assign(__assign({},un.settings.transformImage),{adjustStencil:!1})}),ref:rn}))});FixedCropper.displayName="FixedCropper";var Cropper=forwardRef(function(on,rn){var un=useAbstractCropperProps(on),dn=un.props,pn=un.settings,fn=pn.stencilSize,hn=pn.autoZoom,gn=__rest(pn,["stencilSize","autoZoom"]),vn=useDeprecationWarning();return isUndefined(hn)||(dn.postProcess||fn?vn("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function."):(vn("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function. The 'postProcess' automatically set to 'hybridAutoZoom'"),dn.postProcess=hybridStencilAutoZoom)),isUndefined(fn)?React__default.createElement(AbstractCropper,__assign({},dn,{ref:rn,settings:gn})):(vn("prop 'stencilSize' is deprecated for <Cropper/> component now and will be removed, use <FixedCropper/> component instead."),React__default.createElement(FixedCropper,__assign({ref:rn,stencilSize:fn},gn,dn)))});Cropper.displayName="CropperComponent";var CircleStencil=forwardRef(function(on,rn){var un=on.cropper,dn=on.coordinates,pn=on.handlerComponent,fn=pn===void 0?SimpleHandler:pn,hn=on.handlers,gn=hn===void 0?{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}:hn,vn=on.handlerClassNames,yn=vn===void 0?{}:vn,xn=on.handlerWrapperClassNames,wn=xn===void 0?{}:xn,Cn=on.lines,Tn=Cn===void 0?{west:!0,north:!0,east:!0,south:!0}:Cn,Pn=on.lineComponent,Sn=Pn===void 0?SimpleLine:Pn,En=on.lineClassNames,_n=En===void 0?{}:En,Rn=on.lineWrapperClassNames,$n=Rn===void 0?{}:Rn,Mn=on.resizable,An=Mn===void 0?!0:Mn,Dn=on.movable,On=Dn===void 0?!0:Dn,In=on.grid,Nn=on.gridClassName,jn=on.className,Ln=on.movingClassName,Un=on.resizingClassName,Hn=on.previewClassName,Vn=on.boundingBoxClassName,Yn=on.overlayClassName,Gn=on.draggableAreaClassName,Wn=on.disabled,Fn=un.getState(),Bn=un.getTransitions(),zn=un.getInteractions(),Kn=An&&!Wn,Jn=On&&!Wn;useImperativeHandle(rn,function(){return{aspectRatio:1,boundingBox:"circle"}});var rr=function(pr){un&&Jn&&un.moveCoordinates(pr)},er=function(){un&&un.moveCoordinatesEnd()},Qn=function(pr,Tr,kr){un&&Kn&&un.resizeCoordinates(pr,Tr,kr)},Xn=function(){un&&un.resizeCoordinatesEnd()},Zn=dn?isFunction(dn)?dn(Fn):dn:getStencilCoordinates(Fn),cr=Zn.width,vr=Zn.height,xr=Zn.left,yr=Zn.top;return Fn&&React__default.createElement(StencilWrapper,{className:cn("advanced-cropper-circle-stencil",jn,zn.moveCoordinates&&Ln,zn.resizeCoordinates&&Un,{"advanced-cropper-circle-stencil--movable":Jn,"advanced-cropper-circle-stencil--moving":zn.moveCoordinates,"advanced-cropper-circle-stencil--resizable":Kn,"advanced-cropper-circle-stencil--resizing":zn.resizeCoordinates,"advanced-cropper-circle-stencil--disabled":Wn}),width:cr,height:vr,left:xr,top:yr,transitions:Bn},React__default.createElement(BoundingBox,{reference:Fn.coordinates,className:cn(Vn,"advanced-cropper-circle-stencil__bounding-box"),handlers:gn,handlerComponent:fn,handlerClassNames:yn,handlerWrapperClassNames:wn,lines:Tn,lineComponent:Sn,lineClassNames:_n,lineWrapperClassNames:$n,onResize:Qn,onResizeEnd:Xn,disabled:!Kn},React__default.createElement(DraggableElement,{disabled:!Jn,onMove:rr,onMoveEnd:er,className:cn("advanced-cropper-circle-stencil__draggable-area",Gn)},React__default.createElement(StencilOverlay,{className:cn("advanced-cropper-circle-stencil__overlay",Yn)},In&&React__default.createElement(StencilGrid,{visible:un.hasInteractions(),columns:zn.transformImage.rotate?9:3,rows:zn.transformImage.rotate?9:3,className:cn("advanced-cropper-circle-stencil__grid",Nn)}),React__default.createElement("div",{className:cn("advanced-cropper-circle-stencil__preview",Hn)})))))});CircleStencil.displayName="CircleStencil";var CropperSource=forwardRef(function(on,rn){var un=on.src,dn=on.crossOrigin,pn=dn===void 0?!0:dn,fn=__rest(on,["src","crossOrigin"]);return un?React__default.createElement("img",__assign({key:un,ref:rn,src:un,className:cn("advanced-cropper-source"),crossOrigin:pn===!0?"anonymous":pn||void 0},fn)):null});CropperSource.displayName="CropperSource";var CropperPreviewWrapper=function(on){var rn=on.children,un=on.cropper,dn=on.className,pn=on.style;return React__default.createElement("div",{className:cn(dn,"cropper-preview-wrapper"),style:pn},React__default.createElement(CropperFade,{visible:un?.isLoaded(),className:"cropper-preview-wrapper__fade"},rn))},CropperPreviewBackground=function(on){var rn=on.className,un=on.cropper,dn=on.crossOrigin,pn=dn===void 0?!0:dn,fn=on.size,hn=on.style,gn=un.getState(),vn=un.getTransitions(),yn=un.getImage(),xn=fn&&yn&&gn?.coordinates?getPreviewStyle(yn,gn,fn,vn):{},wn=yn?yn.src:void 0;return wn?React__default.createElement("img",{key:wn,className:cn("advanced-cropper-background-image",rn),src:wn,crossOrigin:pn===!0?"anonymous":pn||void 0,style:__assign(__assign({},xn),hn),onMouseDown:preventDefault}):null};forwardRef(function(on,rn){var un,dn,pn,fn,hn=on.className,gn=on.contentClassName,vn=on.state,yn=vn===void 0?null:vn,xn=on.image,wn=xn===void 0?null:xn,Cn=on.transitions,Tn=Cn===void 0?null:Cn,Pn=on.backgroundComponent,Sn=Pn===void 0?CropperPreviewBackground:Pn,En=on.backgroundProps,_n=on.backgroundClassName,Rn=on.boundaryComponent,$n=Rn===void 0?StretchableBoundary:Rn,Mn=on.boundaryProps,An=on.boundaryClassName,Dn=on.wrapperComponent,On=Dn===void 0?CropperPreviewWrapper:Dn,In=on.wrapperProps,Nn=on.loaded,jn=Nn===void 0?!0:Nn,Ln=on.loading,Un=Ln===void 0?!1:Ln,Hn=on.style,Vn=on.cropper,Yn=useForceRerender(),Gn=useRef(null),Wn=useRef(null),Fn=Vn||(Wn.current?Wn:{current:{getState:function(){return yn},getTransitions:function(){return Tn},getImage:function(){return wn},isLoaded:function(){return jn},isLoading:function(){return Un}}}),Bn=__read(useState(null),2),zn=Bn[0],Kn=Bn[1],Jn=(dn=(un=Fn.current)===null||un===void 0?void 0:un.getState())===null||dn===void 0?void 0:dn.coordinates,rr=(fn=(pn=Fn.current)===null||pn===void 0?void 0:pn.getImage())===null||fn===void 0?void 0:fn.src,er=zn?{width:"".concat(zn.width,"px"),height:"".concat(zn.height,"px")}:{},Qn=function(){var vr,xr,yr=(xr=(vr=Fn.current)===null||vr===void 0?void 0:vr.getState())===null||xr===void 0?void 0:xr.coordinates;Gn.current&&yr&&Gn.current.stretchTo(yr).then(function(pr){pr&&yr?isGreater(ratio(yr),ratio(pr))?Kn({width:pr.width,height:pr.width/ratio(yr)}):Kn({width:pr.height*ratio(yr),height:pr.height}):Kn(null)}),Yn()};useWindowResize(Qn),useLayoutEffect$2(Qn,[Jn?.height,Jn?.width]),useImperativeHandle(rn,function(){return{refresh:Qn,update:function(vr){vr?Wn.current=vr:Wn.current=null,Qn()}}});var Xn=On,Zn=Sn,cr=$n;return React__default.createElement(Xn,__assign({},In,{className:cn(hn,"advanced-cropper-preview"),cropper:Fn.current,style:Hn}),React__default.createElement(cr,__assign({ref:Gn,stretchAlgorithm:stretchPreviewBoundary},Mn,{className:cn("advanced-cropper-preview__boundary",An)}),React__default.createElement("div",{className:cn(gn,"advanced-cropper-preview__content"),style:er},Fn.current&&React__default.createElement(Zn,__assign({},En,{cropper:Fn.current,size:zn,className:cn(_n,"advanced-cropper-preview__image",rr&&"advanced-cropper-preview__image--visible")})))))});function FaCheck(on){return GenIcon({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"}}]})(on)}const blobToFile=(on,rn)=>new File([on],rn,{lastModified:new Date().getTime(),type:on.type});function KdImageCropper({src:on,onCrop:rn,stencil:un="rectangle",defaultHeight:dn=200,defaultWidth:pn=200,resizable:fn=!0,fileName:hn="image.jpg"}){const gn=useRef(null),vn=()=>{const yn=gn.current?.getCanvas();if(yn){let xn=hn.split(".").at(-1)?.toLocaleLowerCase();xn==="jpg"&&(xn="jpeg"),yn.toBlob(wn=>{if(wn){const Cn=blobToFile(wn,hn);rn(Cn)}},`image/${xn}`)}};return jsxs(Box,{sx:{position:"relative",minWidth:"calc(min(50vw , 500px))"},children:[jsx$1(Cropper,{src:on,ref:gn,className:"cropper",crossOrigin:"use-credentials",stencilComponent:un==="circle"?CircleStencil:RectangleStencil,defaultSize:{width:pn,height:dn},stencilProps:{grid:!0,resizable:fn}}),jsx$1(KdpaPrimaryButton,{sx:{position:"absolute",bottom:"8px",right:"50%",transform:"translateX(50%)",padding:"4px 12px"},onClick:vn,children:jsx$1(FaCheck,{size:20})})]})}function KdImageCropperPopup({onClose:on=()=>({}),onCrop:rn,open:un,src:dn,...pn}){return jsx$1(Dialog,{open:un,onClose:on,children:jsx$1(DialogContent,{sx:{padding:"8px"},children:dn&&jsx$1(KdImageCropper,{src:dn,onCrop:rn,...pn})})})}function KdpaUploadedFile({sessionId:on,fileName:rn,onDelete:un,smallUrl:dn,largeUrl:pn,modal:fn=!0,downloadSmallSize:hn=!1,extention:gn,onCropImage:vn,croppable:yn,defaultCropWidth:xn,defaultCropHeight:wn,cropResizable:Cn,cropStencil:Tn}){const Pn=!!gn&&Object.keys(fileExtension).find(Dn=>fileExtension[Dn].includes(gn.toLocaleLowerCase())),Sn=["jpg","jpeg","png"].includes((gn||"").toLocaleLowerCase()),[En,_n]=useState(!1),[Rn,$n]=useState(!1);function Mn(){return gn==="pdf"?jsxs("div",{children:[jsx$1("img",{src:dn,className:"modal-image",style:{cursor:"pointer"},onClick:()=>_n(!0)}),jsx$1(Dialog,{open:En,fullScreen:!0,children:jsx$1(DialogContent,{sx:{padding:"0px"},children:jsx$1(KdpaPdfViewer,{handleClose:()=>_n(!1),fileUrl:pn})})})]}):jsx$1(_default$1,{small:dn,medium:Pn==="image"?pn:dn,large:pn,hideZoom:!0,className:"modal-image"})}function An(Dn){vn&&vn(Dn),$n(!1)}return jsxs("div",{className:"kdpa-uploaded-file",children:[jsxs("div",{className:"parent",children:[fn?Mn():jsx$1("div",{children:jsx$1("img",{src:dn,className:"modal-image"})}),(un||hn||Pn==="image")&&jsxs("div",{className:"child",children:[yn&&Pn==="image"&&Sn&&jsx$1(FiEdit3,{className:"icon-actions",size:20,onClick:()=>{$n(!0)}}),un&&jsx$1(FiTrash2,{className:"icon-actions",size:20,onClick:()=>{un(on)}}),hn&&jsx$1(MdOutlineFileDownload,{className:"icon-actions",size:20,onClick:()=>{pn&&window.open(pn,"_blank")}})]})]}),rn&&jsx$1("span",{style:{fontSize:"12px"},children:rn?.split("\\")?.slice(-1)?.[0]}),Pn==="image"&&jsx$1(KdImageCropperPopup,{onClose:()=>$n(!1),fileName:rn,onCrop:An,src:pn,open:Rn,defaultWidth:xn,defaultHeight:wn,stencil:Tn,resizable:Cn})]})}export{KdAccordion,KdAdvanceFileUploader,KdAlert,KdCaptcha,KdChart2D,KdChart3D,KdDrawer,KdDropDownField,KdFileUploader,KdFileViewer,KdFormContainer$1 as KdFormContainer,KdFormField,KdGridHeader,KdGridPanel$1 as KdGridPanel,KdHtmlEditor,KdImageBox,KdLanguageChange,KdLazyDropDownField,KdLoading,KdMenubar,KdModal,KdPanelWrapper,KdRadioListCustom,KdRangeField$1 as KdRangeField,KdSearchableInput,KdpaFormField as KdSearchableInputField,KdStepContent,KdStepList,KdStepRoot,KdStepTrigger,KdStyledComponent,KdSwiper,KdSwiperSlide,KdTabsContent,KdTabsList,KdTabsRoot,KdTabsTrigger,KdTagBoxInput,KdTooltip,KdTree,KdTreeField,KdTypography,KdpaAccordion,KdpaAccordionDetails,KdpaAccordionSummary,KdpaAlert,KdpaAlertTitle,KdpaAutoComplete,KdpaAvatar,KdpaBadge,KdpaButton,KdpaCheckBox,KdpaChip,KdpaCircularProgress,KdpaCollapse$1 as KdpaCollapse,KdpaCollapse as KdpaCollapseTransitions,KdpaCopyToClipboard,KdpaDatePicker,KdpaDateTimePicker,KdpaDialog,KdpaDivider,KdpaDropDownLazy,KdpaDropZone,KdpaFade,KdpaFileUploader,KdpaFormContainer$1 as KdpaFormContainer,KdpaFormControl,KdpaFormControlLabel,KdpaFormField$2 as KdpaFormField,KdpaFormLabel,KdpaFullScreenDialog,KdpaGrid,KdpaGridBadge,KdpaGrow,KdpaIconButton,KdImageCropper as KdpaImageCropper,KdImageCropperPopup as KdpaImageCropperPopup,KdpaInlineSpinner,KdpaInput,KdpaInputLabel,KdpaInputMultiline,BpmsLoading as KdpaLoading,KdpaMenuItem,KdpaModal,KdpaModalImage,KdpaMuiBadge,KdpaPaginationGrid,KdpaPdfViewer,KdpaPrimaryButton,KdpaRadio,KdpaRadioGroup,KdpaRtlProvider,KdpaSecondaryButton,KdpaSegment,KdpaSelect,KdpaSkeleton,KdpaSlide,KdpaSlider,KdpaSweetAlertConfirm,KdpaSweetAlertDelete,KdpaSweetAlertOK,KdpaSwitch,KdpaTab,KdpaTabs,KdpaThemeProvider,KdpaTimePicker,KdpaTooltip,KdpaTree,KdpaTreeSelect,KdpaTypography,KdpaUploadedFile,KdpaUploadingFile,KdpaUseFileUploadHook,KdpaZoom,fileExtension,pathFile,pathServicesUpload,serviceName};
1974
+ */process.env.NODE_ENV==="production"?lib$g.exports=requireDefaultLayout_min():lib$g.exports=requireDefaultLayout();var libExports=lib$g.exports;const pdfWorkerUrl=new URL("pdfjs-dist/legacy/build/pdf.worker.min.js",import.meta.url).toString(),renderToolbar=(on,rn)=>jsx$1(on,{children:un=>{const{CurrentPageInput:dn,Download:pn,EnterFullScreen:fn,GoToNextPage:hn,GoToPreviousPage:gn,NumberOfPages:vn,Print:yn,Zoom:xn,ZoomIn:wn,ZoomOut:Cn}=un;return jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",paddingInline:"20px"},children:[jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"},children:[jsx$1(Cn,{}),jsx$1(xn,{}),jsx$1(wn,{})]}),jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"},children:[jsx$1(gn,{}),jsx$1(dn,{}),jsxs("div",{style:{color:"white"},children:["/ ",jsx$1(vn,{})]}),jsx$1(hn,{})]}),jsxs("div",{style:{display:"flex",gap:"10px"},children:[jsx$1(fn,{}),jsx$1(pn,{}),jsx$1(yn,{}),jsx$1(MdClose,{size:24,onClick:()=>{rn?.()},style:{cursor:"pointer",color:"white"}})]})]})}}),KdpaPdfViewer=({fileUrl:on,handleClose:rn})=>{const un=libExports.defaultLayoutPlugin({renderToolbar:dn=>renderToolbar(dn,()=>{rn()}),sidebarTabs:dn=>[dn[0]]});return jsx$1(libExports$1.Worker,{workerUrl:pdfWorkerUrl,children:jsx$1(libExports$1.Viewer,{theme:"dark",fileUrl:on,plugins:[un],withCredentials:!0})})};function getDirectionNames(on,rn){var un,dn;return on&&rn?(un=""+on+rn[0].toUpperCase()+rn.slice(1),dn=on+"-"+rn):(un=on||rn,dn=on||rn),{camelCase:un,snakeCase:dn}}function isBlob(on){return/^blob:/.test(on)}function isDataUrl(on){return/^data:/.test(on)}function isLocal(on){return isBlob(on)||isDataUrl(on)}function isCrossOriginURL(on){if(isLocal(on))return!1;var rn=window.location,un=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,dn=un.exec(on)||[],pn={protocol:dn[1]||"",host:dn[2]||"",port:dn[3]||""},fn=function(gn){return gn==="http"?80:433},hn=function(gn){return gn.port||fn(gn.protocol||rn.protocol)};return!(!pn.protocol&&!pn.host&&!pn.port||pn.protocol&&pn.protocol==rn.protocol&&pn.host&&pn.host==rn.host&&pn.host&&hn(pn)==hn(rn))}function isArray(on){return Array.isArray(on)}function isFunction(on){return typeof on=="function"}function isUndefined(on){return on===void 0}var isObject=function(on){return on!==null&&typeof on=="object"};function getOptions(on,rn,un){un===void 0&&(un={});var dn={};return isObject(on)?(Object.keys(rn).forEach(function(pn){isUndefined(on[pn])?dn[pn]=rn[pn]:isObject(rn[pn])?isObject(on[pn])?dn[pn]=getOptions(on[pn],rn[pn],un[pn]):dn[pn]=on[pn]?rn[pn]:un[pn]:rn[pn]===!0||rn[pn]===!1?dn[pn]=!!on[pn]:dn[pn]=on[pn]}),dn):on?rn:un}function parseNumber(on){var rn=Number(on);return Number.isNaN(rn)?on:rn}function isBoolean(on){return on===!0||on===!1}function isNumber(on){return typeof on=="number"}function isString(on){return typeof on=="string"}function isNaN$1(on){return on!==on}function isNumeric(on){return isNumber(on)&&!isNaN$1(on)||isString(on)&&!Number.isNaN(parseFloat(on))&&isFinite(parseFloat(on))}function distance(on,rn){return Math.sqrt(Math.pow(on.left-rn.left,2)+Math.pow(on.top-rn.top,2))}function isRoughlyEqual(on,rn,un){return un===void 0&&(un=.001),Math.abs(rn-on)<un}function isGreater(on,rn,un){return isRoughlyEqual(on,rn,un)?!1:on>rn}function isLower(on,rn,un){return isRoughlyEqual(on,rn,un)?!1:on<rn}function sign(on){var rn=+on;return rn===0||isNaN$1(rn)?rn:rn>0?1:-1}function promiseTimeout(on){return new Promise(function(rn){setTimeout(function(){rn()},on)})}function deepClone(on){if(!isObject(on))return on;var rn={};return Array.isArray(on)?rn=on.map(function(un){return deepClone(un)}):Object.keys(on).forEach(function(un){return rn[un]=deepClone(on[un])}),rn}function deepCompare(on,rn,un){if(un===void 0&&(un=.001),isNumber(on)&&isNumber(rn)&&isRoughlyEqual(on,rn,un)||on===rn)return!0;if(on&&rn&&typeof on=="object"&&typeof rn=="object"){if(on.constructor!==rn.constructor)return!1;var dn,pn=void 0;if(Array.isArray(on)){if(dn=on.length,dn!=rn.length)return!1;for(pn=dn;pn--!==0;)if(!deepCompare(on[pn],rn[pn],un))return!1;return!0}if(on.valueOf!==Object.prototype.valueOf)return on.valueOf()===rn.valueOf();if(on.toString!==Object.prototype.toString)return on.toString()===rn.toString();var fn=Object.keys(on);if(dn=fn.length,dn!==Object.keys(rn).length)return!1;for(pn=dn;pn--!==0;)if(!Object.prototype.hasOwnProperty.call(rn,fn[pn]))return!1;for(pn=dn;pn--!==0;){var hn=fn[pn];if(!deepCompare(on[hn],rn[hn],un))return!1}return!0}return on!==on&&rn!==rn}function emptyCoordinates(){return{left:0,top:0,width:0,height:0}}function isCardinalDirection(on){return on==="west"||on==="south"||on==="north"||on==="east"}function debounce(on,rn){var un,dn;function pn(){for(var hn=[],gn=0;gn<arguments.length;gn++)hn[gn]=arguments[gn];var vn=Date.now()-un,yn=isFunction(rn)?rn():rn||0;vn<yn&&vn>=0?dn=setTimeout(function(){return pn.apply(void 0,hn)},yn-vn):on.apply(void 0,hn)}function fn(){for(var hn=[],gn=0;gn<arguments.length;gn++)hn[gn]=arguments[gn];un=Date.now(),dn=setTimeout(function(){return pn.apply(void 0,hn)},isFunction(rn)?rn():rn||0)}return fn.clear=function(){clearTimeout(dn)},fn}var ALL_DIRECTIONS=["left","right","top","bottom"],HORIZONTAL_DIRECTIONS$1=["left","right"],VERTICAL_DIRECTIONS$1=["top","bottom"];function diff(on,rn){return{left:on.left-rn.left,top:on.top-rn.top}}function getCenter(on){return{left:on.left+on.width/2,top:on.top+on.height/2}}function getOppositeSide(on){return{left:"right",top:"bottom",right:"left",bottom:"top"}[on]}function sizeDistance(on,rn){return Math.pow(on.width-rn.width,2)+Math.pow(on.height-rn.height,2)}function applyDirections(on,rn){return{left:on.left-rn.left,top:on.top-rn.top,width:on.width+rn.left+rn.right,height:on.height+rn.top+rn.bottom}}function inverseMove(on){return{left:-on.left,top:-on.top}}function applyMove(on,rn){return __assign(__assign({},on),{left:on.left+rn.left,top:on.top+rn.top})}function coordinatesToPositionRestrictions(on){return{left:on.left,top:on.top,right:on.left+on.width,bottom:on.top+on.height}}function applyScale(on,rn,un,dn){if(rn!==1)if("left"in on||"top"in on)if(un){var pn=getCenter(on);return{width:on.width*rn,height:on.height*rn,left:on.left+on.width*(1-rn)/2+(un.left-pn.left)*(1-rn),top:on.top+on.height*(1-rn)/2+(un.top-pn.top)*(1-rn)}}else return{width:on.width*rn,height:on.height*rn,left:on.left+on.width*(1-rn)/2,top:on.top+on.height*(1-rn)/2};else return{width:on.width*rn,height:on.height*rn};else return on}function ratio(on){return on.width/on.height}function maxScale(on,rn){return Math.min(rn.maxWidth?rn.maxWidth/on.width:1/0,rn.maxHeight?rn.maxHeight/on.height:1/0)}function minScale(on,rn){return Math.max(rn.minWidth?rn.minWidth/on.width:0,rn.minHeight?rn.minHeight/on.height:0)}function getBrokenRatio(on,rn){var un;return rn.minimum&&isLower(on,rn.minimum)?un=rn.minimum:rn.maximum&&isGreater(on,rn.maximum)&&(un=rn.maximum),un}function fitToSizeRestrictions(on,rn){var un=ratio(on),dn=1;return rn.minWidth>0&&rn.minHeight>0?un>rn.minWidth/rn.minHeight?on.height<rn.minHeight&&(dn=rn.minHeight/on.height):on.width<rn.minWidth&&(dn=rn.minWidth/on.width):rn.minWidth>0?on.width<rn.minWidth&&(dn=rn.minWidth/on.width):rn.minHeight>0&&on.height<rn.minHeight&&(dn=rn.minHeight/on.height),rn.maxWidth<1/0&&rn.maxHeight<1/0?un>rn.maxWidth/rn.maxHeight?on.width>rn.maxWidth&&(dn=rn.maxWidth/on.width):on.height>rn.maxHeight&&(dn=rn.maxHeight/on.height):rn.maxWidth<1/0?on.width>rn.maxWidth&&(dn=rn.maxWidth/on.width):rn.maxHeight<1/0&&on.height>rn.maxHeight&&(dn=rn.maxHeight/on.height),dn}function getIntersections(on,rn){var un={left:0,top:0,right:0,bottom:0};return ALL_DIRECTIONS.forEach(function(dn){var pn=rn[dn],fn=coordinatesToPositionRestrictions(on)[dn];pn!==void 0&&fn!==void 0?dn==="left"||dn==="top"?un[dn]=Math.max(0,pn-fn):un[dn]=Math.max(0,fn-pn):un[dn]=0}),un}function resizeToSizeRestrictions(on,rn){return applyScale(on,fitToSizeRestrictions(on,rn))}function rotateSize(on,rn){var un=rn*Math.PI/180;return{width:Math.abs(on.width*Math.cos(un))+Math.abs(on.height*Math.sin(un)),height:Math.abs(on.width*Math.sin(un))+Math.abs(on.height*Math.cos(un))}}function rotatePoint(on,rn,un){var dn=rn*Math.PI/180;return un?{left:(on.left-un.left)*Math.cos(dn)-(on.top-un.top)*Math.sin(dn)+un.left,top:(on.left-un.left)*Math.sin(dn)+(on.top-un.top)*Math.cos(dn)+un.top}:{left:on.left*Math.cos(dn)-on.top*Math.sin(dn),top:on.left*Math.sin(dn)+on.top*Math.cos(dn)}}function positionToSizeRestrictions(on){return{minWidth:0,minHeight:0,maxWidth:on.right!==void 0&&on.left!==void 0?on.right-on.left:1/0,maxHeight:on.bottom!==void 0&&on.top!==void 0?on.bottom-on.top:1/0}}function mergePositionRestrictions(on,rn){var un={};return ALL_DIRECTIONS.forEach(function(dn){var pn=on[dn],fn=rn[dn];pn!==void 0&&fn!==void 0?dn==="left"||dn==="top"?un[dn]=Math.max(pn,fn):un[dn]=Math.min(pn,fn):fn!==void 0?un[dn]=fn:pn!==void 0&&(un[dn]=pn)}),un}function fitToPositionRestrictions(on,rn){var un={left:0,top:0},dn=getIntersections(on,rn);return dn.left&&dn.left>0?un.left=dn.left:dn.right&&dn.right>0&&(un.left=-dn.right),dn.top&&dn.top>0?un.top=dn.top:dn.bottom&&dn.bottom>0&&(un.top=-dn.bottom),un}function moveToPositionRestrictions(on,rn){return applyMove(on,fitToPositionRestrictions(on,rn))}function aspectRatioIntersection(on,rn){return rn?on?{minimum:Math.min(on.maximum,Math.max(on.minimum,rn.minimum)),maximum:Math.max(on.minimum,Math.min(on.maximum,rn.maximum))}:rn:on}function createAspectRatio(on){return on===void 0&&(on={}),isNumber(on)?{minimum:on,maximum:on}:{minimum:isNumeric(on.minimum)?on.minimum:0,maximum:isNumeric(on.maximum)?on.maximum:1/0}}function isConsistentSize(on,rn){return(isUndefined(rn.maxWidth)||!isGreater(on.width,rn.maxWidth))&&(isUndefined(rn.maxHeight)||!isGreater(on.height,rn.maxHeight))&&(isUndefined(rn.minHeight)||!isLower(on.height,rn.minHeight))&&(isUndefined(rn.minWidth)||!isLower(on.width,rn.minWidth))}function isConsistentPosition(on,rn){return(isUndefined(rn.left)||!isLower(on.left,rn.left))&&(isUndefined(rn.top)||!isLower(on.top,rn.top))&&(isUndefined(rn.right)||!isGreater(on.left+on.width,rn.right))&&(isUndefined(rn.bottom)||!isGreater(on.top+on.height,rn.bottom))}function getCloserSize(on,rn,un,dn){var pn=function(fn){return on.reduce(function(hn,gn){var vn=isFunction(un)?un(gn):un,yn=vn.maxHeight,xn=vn.maxWidth,wn=vn.minWidth,Cn=vn.minHeight,Tn=createAspectRatio(isFunction(dn)?dn(gn):dn),Pn=fn?{maxWidth:xn,maxHeight:yn}:{maxWidth:xn,maxHeight:yn,minWidth:wn,minHeight:Cn};return isConsistentSize(gn,Pn)&&!getBrokenRatio(ratio(gn),Tn)&&gn.width&&gn.height&&(!hn||isLower(sizeDistance(gn,rn),sizeDistance(hn,rn)))?gn:hn},null)};return pn()||pn(!0)}function isInitializedState(on){return!!(on&&on.visibleArea&&on.coordinates)}function getAreaSizeRestrictions(on,rn){return calculateAreaSizeRestrictions(on,rn)}function getAreaPositionRestrictions(on,rn){return isFunction(rn.areaPositionRestrictions)?rn.areaPositionRestrictions(on,rn):rn.areaPositionRestrictions}function getSizeRestrictions(on,rn){return calculateSizeRestrictions(on,rn)}function getPositionRestrictions(on,rn){return isFunction(rn.positionRestrictions)?rn.positionRestrictions(on,rn):rn.positionRestrictions}function getCoefficient(on){return on.visibleArea?on.visibleArea.width/on.boundary.width:0}function getStencilCoordinates(on){if(isInitializedState(on)){var rn=on.coordinates,un=rn.width,dn=rn.height,pn=rn.left,fn=rn.top,hn=getCoefficient(on);return{width:un/hn,height:dn/hn,left:(pn-on.visibleArea.left)/hn,top:(fn-on.visibleArea.top)/hn}}else return emptyCoordinates()}function getAspectRatio(on,rn){return createAspectRatio(isFunction(rn.aspectRatio)?rn.aspectRatio(on,rn):rn.aspectRatio)}function getDefaultCoordinates(on,rn){return isFunction(rn.defaultCoordinates)?rn.defaultCoordinates(on,rn):rn.defaultCoordinates}function getDefaultVisibleArea(on,rn){return isFunction(rn.defaultVisibleArea)?rn.defaultVisibleArea(on,rn):rn.defaultVisibleArea}function getDefaultTransforms(on,rn){var un=__assign(__assign({},on.transforms),{flip:__assign({},on.transforms.flip)});if(rn.defaultTransforms){var dn=isFunction(rn.defaultTransforms)?rn.defaultTransforms(on,rn):rn.defaultTransforms;isNumber(dn.rotate)&&(un.rotate=dn.rotate),dn.flip&&(isBoolean(dn.flip.horizontal)&&(un.flip.horizontal=dn.flip.horizontal),isBoolean(dn.flip.vertical)&&(un.flip.vertical=dn.flip.vertical))}return un}function getTransformedImageSize(on){return on.imageSize&&on.imageSize.width&&on.imageSize.height?rotateSize(on.imageSize,on.transforms.rotate):{width:0,height:0}}function getMinimumSize(on){return on.coordinates?Math.min(on.coordinates.width,on.coordinates.height,20*getCoefficient(on)):1}function getRoundedCoordinates(on,rn){if(isInitializedState(on)){var un=getSizeRestrictions(on,rn),dn=getPositionRestrictions(on,rn),pn={width:Math.round(on.coordinates.width),height:Math.round(on.coordinates.height),left:Math.round(on.coordinates.left),top:Math.round(on.coordinates.top)};return pn.width>un.maxWidth?pn.width=Math.floor(on.coordinates.width):pn.width<un.minWidth&&(pn.width=Math.ceil(on.coordinates.width)),pn.height>un.maxHeight?pn.height=Math.floor(on.coordinates.height):pn.height<un.minHeight&&(pn.height=Math.ceil(on.coordinates.height)),moveToPositionRestrictions(pn,dn)}else return null}function isConsistentState(on,rn){return isInitializedState(on)?!getBrokenRatio(ratio(on.coordinates),getAspectRatio(on,rn))&&isConsistentSize(on.visibleArea,getAreaSizeRestrictions(on,rn))&&isConsistentSize(on.coordinates,getSizeRestrictions(on,rn))&&isConsistentPosition(on.visibleArea,getAreaPositionRestrictions(on,rn))&&isConsistentPosition(on.coordinates,getPositionRestrictions(on,rn)):!0}function reconcileSizeRestrictions(on){var rn=__assign({},on);return rn.minWidth>rn.maxWidth&&(rn.minWidth=rn.maxWidth),rn.minHeight>rn.maxHeight&&(rn.minHeight=rn.maxHeight),rn}function mergeSizeRestrictions(on,rn){var un=on,dn=__assign({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},rn);return reconcileSizeRestrictions({maxHeight:Math.min(un.maxHeight,dn.maxHeight),minHeight:Math.max(un.minHeight,dn.minHeight),maxWidth:Math.min(un.maxWidth,dn.maxWidth),minWidth:Math.max(un.minWidth,dn.minWidth)})}function calculateSizeRestrictions(on,rn){var un=isFunction(rn.sizeRestrictions)?rn.sizeRestrictions(on,rn):rn.sizeRestrictions,dn=getPositionRestrictions(on,rn),pn={minWidth:isNumeric(un.minWidth)?parseNumber(un.minWidth):0,minHeight:isNumeric(un.minHeight)?parseNumber(un.minHeight):0,maxWidth:isNumeric(un.maxWidth)?parseNumber(un.maxWidth):1/0,maxHeight:isNumeric(un.maxHeight)?parseNumber(un.maxHeight):1/0};return dn.left!==void 0&&dn.right!==void 0&&(pn.maxWidth=Math.min(pn.maxWidth,dn.right-dn.left)),dn.bottom!==void 0&&dn.top!==void 0&&(pn.maxHeight=Math.min(pn.maxHeight,dn.bottom-dn.top)),reconcileSizeRestrictions(pn)}function calculateAreaSizeRestrictions(on,rn){var un=isFunction(rn.areaSizeRestrictions)?rn.areaSizeRestrictions(on,rn):rn.areaSizeRestrictions;return un.maxWidth<1/0&&un.maxHeight<1/0&&(ratio(on.boundary)>un.maxWidth/un.maxHeight?un.maxHeight=un.maxWidth/ratio(on.boundary):un.maxWidth=un.maxHeight*ratio(on.boundary)),reconcileSizeRestrictions(un)}function copyState(on){return deepClone(on)}var ImageRestriction;(function(on){on.fillArea="fillArea",on.fitArea="fitArea",on.stencil="stencil",on.none="none"})(ImageRestriction||(ImageRestriction={}));var Priority;(function(on){on.coordinates="coordinates",on.visibleArea="visibleArea"})(Priority||(Priority={}));function approximateSize(on){var rn=on.width,un=on.height,dn=on.sizeRestrictions||{minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0},pn=createAspectRatio(on.aspectRatio),fn={width:Math.max(dn.minWidth,Math.min(dn.maxWidth,rn)),height:Math.max(dn.minHeight,Math.min(dn.maxHeight,un))},hn=[fn];return pn&&[pn.minimum,pn.maximum].forEach(function(gn){gn&&hn.push({width:fn.width,height:fn.width/gn},{width:fn.height*gn,height:fn.height})}),hn=hn.map(function(gn){return resizeToSizeRestrictions(gn,dn)}),getCloserSize(hn,{width:rn,height:un},dn,pn)}function fitVisibleArea(on,rn){var un=copyState(on);if(on.visibleArea){var dn=getAreaSizeRestrictions(on,rn);un.visibleArea=__assign(__assign({},on.visibleArea),approximateSize({width:on.visibleArea.width,height:on.visibleArea.height,aspectRatio:{minimum:ratio(un.boundary),maximum:ratio(un.boundary)},sizeRestrictions:dn})),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(on.visibleArea),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn))}return un}function moveCoordinatesAlgorithm(on,rn,un){var dn=applyMove(on,rn);return un?moveToPositionRestrictions(dn,un):dn}var SetCoordinatesMode;(function(on){on.limit="limit",on.zoom="zoom",on.unsafe="unsafe"})(SetCoordinatesMode||(SetCoordinatesMode={}));function setCoordinates(on,rn,un,dn){dn===void 0&&(dn=!0);var pn=dn===!1?SetCoordinatesMode.unsafe:dn===!0?SetCoordinatesMode.zoom:dn,fn=getAspectRatio(on,rn),hn=getSizeRestrictions(on,rn);on.visibleArea&&pn===SetCoordinatesMode.limit&&(hn=__assign(__assign({},hn),{minWidth:Math.min(on.visibleArea.width,hn.minWidth),minHeight:Math.min(on.visibleArea.height,hn.minHeight),maxWidth:Math.min(on.visibleArea.width,hn.maxWidth),maxHeight:Math.min(on.visibleArea.height,hn.maxHeight)}));var gn=getPositionRestrictions(on,rn);on.visibleArea&&pn===SetCoordinatesMode.limit&&(gn=mergePositionRestrictions(gn,coordinatesToPositionRestrictions(on.visibleArea)));var vn=function(_n,Rn){return moveCoordinatesAlgorithm(_n,{left:Rn.left-(_n.left||0),top:Rn.top-(_n.top||0)},gn)},yn=function(_n,Rn){var $n=__assign(__assign(__assign({},_n),approximateSize({width:Rn.width,height:Rn.height,sizeRestrictions:hn,aspectRatio:fn})),{left:0,top:0});return vn($n,{left:_n.left||0,top:_n.top||0})},xn=on.coordinates?__assign({},on.coordinates):emptyCoordinates(),wn=Array.isArray(un)?un:[un];wn.forEach(function(_n){var Rn;typeof _n=="function"?Rn=_n(__assign(__assign({},on),{coordinates:xn}),rn):Rn=_n,Rn&&((!isUndefined(Rn.width)||!isUndefined(Rn.height))&&(xn=yn(xn,__assign(__assign({},xn),Rn))),(!isUndefined(Rn.left)||!isUndefined(Rn.top))&&(xn=vn(xn,__assign(__assign({},xn),Rn))))});var Cn=__assign(__assign({},copyState(on)),{coordinates:xn});if(Cn.visibleArea&&pn===SetCoordinatesMode.zoom){var Tn=Math.max(0,Cn.coordinates.width-Cn.visibleArea.width),Pn=Math.max(0,Cn.coordinates.height-Cn.visibleArea.height),Sn=getAreaSizeRestrictions(on,rn),En=Tn>Pn?Cn.coordinates.width/Cn.visibleArea.width:Cn.coordinates.height/Cn.visibleArea.height;return En>1&&(Cn.visibleArea=applyScale(Cn.visibleArea,Math.min(En,maxScale(Cn.visibleArea,Sn)))),Cn.visibleArea=applyMove(Cn.visibleArea,inverseMove(fitToPositionRestrictions(Cn.coordinates,coordinatesToPositionRestrictions(Cn.visibleArea)))),fitVisibleArea(Cn,rn)}else return Cn}function fitCoordinates(on,rn){if(on.coordinates){var un=copyState(on),dn=getAspectRatio(on,rn),pn=getSizeRestrictions(on,rn);return un.coordinates=__assign(__assign({},on.coordinates),approximateSize({width:on.coordinates.width,height:on.coordinates.height,aspectRatio:dn,sizeRestrictions:on.visibleArea?{maxWidth:Math.min(on.visibleArea.width,pn.maxWidth),maxHeight:Math.min(on.visibleArea.height,pn.maxHeight),minHeight:Math.min(on.visibleArea.height,pn.minHeight),minWidth:Math.min(on.visibleArea.width,pn.minWidth)}:pn})),un.coordinates=applyMove(un.coordinates,diff(getCenter(on.coordinates),getCenter(un.coordinates))),un.coordinates=moveToPositionRestrictions(un.coordinates,on.visibleArea?mergePositionRestrictions(coordinatesToPositionRestrictions(on.visibleArea),getPositionRestrictions(un,rn)):getPositionRestrictions(un,rn)),un}return on}function setVisibleArea(on,rn,un,dn){dn===void 0&&(dn=!0);var pn=__assign(__assign({},copyState(on)),{visibleArea:un});return pn=fitVisibleArea(pn,rn),dn&&(pn=fitCoordinates(pn,rn)),pn}function createState(on,rn){var un,dn,pn,fn,hn,gn=on.boundary,vn=on.image,yn={boundary:{width:gn.width,height:gn.height},imageSize:{width:vn.width,height:vn.height},transforms:{rotate:((un=vn.transforms)===null||un===void 0?void 0:un.rotate)||0,flip:{horizontal:((pn=(dn=vn.transforms)===null||dn===void 0?void 0:dn.flip)===null||pn===void 0?void 0:pn.horizontal)||!1,vertical:((hn=(fn=vn.transforms)===null||fn===void 0?void 0:fn.flip)===null||hn===void 0?void 0:hn.vertical)||!1}},visibleArea:null,coordinates:null};return rn.defaultTransforms&&(yn.transforms=getDefaultTransforms(yn,rn)),rn.priority===Priority.visibleArea?(yn=setVisibleArea(yn,rn,getDefaultVisibleArea(yn,rn),!1),yn=setCoordinates(yn,rn,getDefaultCoordinates(yn,rn),SetCoordinatesMode.limit)):(yn=setCoordinates(yn,rn,getDefaultCoordinates(yn,rn),SetCoordinatesMode.unsafe),yn=setVisibleArea(yn,rn,getDefaultVisibleArea(yn,rn),!0)),yn}function moveCoordinates(on,rn,un){if(isInitializedState(on)){var dn=copyState(on);return dn.coordinates=applyMove(dn.coordinates,un),dn.coordinates=moveToPositionRestrictions(dn.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(dn.visibleArea),getPositionRestrictions(dn,rn))),dn}return on}function fitDirections(on){var rn=on.coordinates,un=on.directions,dn=on.positionRestrictions,pn=on.sizeRestrictions,fn=on.preserveRatio,hn=on.allowedDirections,gn=on.compensate,vn=gn===void 0?!0:gn,yn=__assign({},un),xn=applyDirections(rn,yn).width,wn=applyDirections(rn,yn).height;xn<0&&(yn.left<0&&yn.right<0?(yn.left=-(rn.width-pn.minWidth)/(yn.left/yn.right),yn.right=-(rn.width-pn.minWidth)/(yn.right/yn.left)):yn.left<0?yn.left=-(rn.width-pn.minWidth):yn.right<0&&(yn.right=-(rn.width-pn.minWidth))),wn<0&&(yn.top<0&&yn.bottom<0?(yn.top=-(rn.height-pn.minHeight)/(yn.top/yn.bottom),yn.bottom=-(rn.height-pn.minHeight)/(yn.bottom/yn.top)):yn.top<0?yn.top=-(rn.height-pn.minHeight):yn.bottom<0&&(yn.bottom=-(rn.height-pn.minHeight)));var Cn=getIntersections(applyDirections(rn,yn),dn),Tn=ALL_DIRECTIONS.every(function(_n){return!isGreater(Cn[getOppositeSide(_n)],0)||hn[_n]});vn&&Tn&&(Cn.left&&Cn.left>0&&Cn.right===0?(yn.right+=Cn.left,yn.left-=Cn.left):Cn.right&&Cn.right>0&&Cn.left===0&&(yn.left+=Cn.right,yn.right-=Cn.right),Cn.top&&Cn.top>0&&Cn.bottom===0?(yn.bottom+=Cn.top,yn.top-=Cn.top):Cn.bottom&&Cn.bottom>0&&Cn.top===0&&(yn.top+=Cn.bottom,yn.bottom-=Cn.bottom),Cn=getIntersections(applyDirections(rn,yn),dn));var Pn={width:1/0,height:1/0,left:1/0,right:1/0,top:1/0,bottom:1/0};if(ALL_DIRECTIONS.forEach(function(_n){var Rn=Cn[_n];Rn&&yn[_n]&&(Pn[_n]=Math.max(0,1-Rn/yn[_n]))}),fn){var Sn=Math.min.apply(Math,ALL_DIRECTIONS.map(function(_n){return Pn[_n]}));Sn!==1/0&&ALL_DIRECTIONS.forEach(function(_n){yn[_n]*=Sn})}else ALL_DIRECTIONS.forEach(function(_n){Pn[_n]!==1/0&&(yn[_n]*=Pn[_n])});if(xn=applyDirections(rn,yn).width,wn=applyDirections(rn,yn).height,yn.right+yn.left&&(xn>pn.maxWidth?Pn.width=(pn.maxWidth-rn.width)/(yn.right+yn.left):xn<pn.minWidth&&(Pn.width=(pn.minWidth-rn.width)/(yn.right+yn.left))),yn.bottom+yn.top&&(wn>pn.maxHeight?Pn.height=(pn.maxHeight-rn.height)/(yn.bottom+yn.top):wn<pn.minHeight&&(Pn.height=(pn.minHeight-rn.height)/(yn.bottom+yn.top))),fn){var En=Math.min(Pn.width,Pn.height);En!==1/0&&ALL_DIRECTIONS.forEach(function(_n){yn[_n]*=En})}else Pn.width!==1/0&&HORIZONTAL_DIRECTIONS$1.forEach(function(_n){yn[_n]*=Pn.width}),Pn.height!==1/0&&VERTICAL_DIRECTIONS$1.forEach(function(_n){yn[_n]*=Pn.height});return yn}function distributeOverlap(on,rn,un){return isRoughlyEqual(rn+un,0)?on/2:isRoughlyEqual(rn,0)?0:isRoughlyEqual(un,0)?on:on*Math.abs(rn/(rn+un))}function resizeCoordinatesAlgorithm(on,rn,un,dn){var pn=dn.aspectRatio,fn=dn.positionRestrictions,hn=dn.sizeRestrictions,gn=__assign({},on);rn=__assign({},rn);var vn=un.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};on.width<hn.minWidth&&(rn.left=0,rn.right=0),on.height<hn.minHeight&&(rn.top=0,rn.bottom=0),ALL_DIRECTIONS.forEach(function($n){vn[$n]||(rn[$n]=0)}),rn=fitDirections({coordinates:gn,directions:rn,sizeRestrictions:hn,positionRestrictions:fn,allowedDirections:vn});var yn=applyDirections(gn,rn).width,xn=applyDirections(gn,rn).height,wn=un.preserveAspectRatio?ratio(gn):getBrokenRatio(yn/xn,pn);if(wn){var Cn=un.respectDirection;if(Cn!=="width"&&Cn!=="height"&&(gn.width>=gn.height||wn===1?Cn="width":Cn="height"),Cn==="width"){var Tn=yn/wn-gn.height;if(vn.top&&vn.bottom){var Pn=rn.top,Sn=rn.bottom;rn.bottom=distributeOverlap(Tn,Sn,Pn),rn.top=distributeOverlap(Tn,Pn,Sn)}else vn.bottom?rn.bottom=Tn:vn.top?rn.top=Tn:vn.right?rn.right=0:vn.left&&(rn.left=0)}else if(Cn==="height"){var En=gn.width-xn*wn;if(vn.left&&vn.right){var _n=rn.left,Rn=rn.right;rn.left=-distributeOverlap(En,_n,Rn),rn.right=-distributeOverlap(En,Rn,_n)}else vn.left?rn.left=-En:vn.right?rn.right=-En:vn.top?rn.top=0:vn.bottom&&(rn.bottom=0)}rn=fitDirections({directions:rn,coordinates:gn,sizeRestrictions:hn,positionRestrictions:fn,preserveRatio:!0,compensate:un.compensate,allowedDirections:vn})}return yn=applyDirections(gn,rn).width,xn=applyDirections(gn,rn).height,wn=un.preserveAspectRatio?ratio(gn):getBrokenRatio(yn/xn,pn),wn&&isGreater(Math.abs(wn-yn/xn),0)&&ALL_DIRECTIONS.forEach(function($n){rn[$n]=0}),moveCoordinatesAlgorithm({width:on.width+rn.right+rn.left,height:on.height+rn.top+rn.bottom,left:on.left,top:on.top},{left:-rn.left,top:-rn.top},fn)}function anchorToMassPoint(on,rn){var un=rn.toLowerCase();return{left:on.left+on.width*(un.indexOf("west")!==-1?1:un.indexOf("east")!==-1?0:.5),top:on.top+on.height*(un.indexOf("north")!==-1?1:un.indexOf("south")!==-1?0:.5)}}function anchorToAllowedDirections(on){var rn=on.toLowerCase();return{left:rn.indexOf("east")===-1,top:rn.indexOf("south")===-1,right:rn.indexOf("west")===-1,bottom:rn.indexOf("north")===-1}}function anchorMoveToResizeDirections(on,rn){var un=on.toLowerCase(),dn={left:un.indexOf("west")===-1?rn.left:-rn.left,top:-rn.top,right:rn.left,bottom:rn.top};["north","south","center"].every(function(fn){return un.indexOf(fn)===-1})&&(dn.top=0,dn.bottom=0),["west","east","center"].every(function(fn){return un.indexOf(fn)===-1})&&(dn.left=0,dn.right=0);var pn=anchorToAllowedDirections(on);return ALL_DIRECTIONS.forEach(function(fn){pn[fn]||(dn[fn]=0)}),dn}function anchoredResizeCoordinatesAlgorithm(on,rn,un,dn,pn){var fn=dn.reference,hn=anchorMoveToResizeDirections(rn,un),gn=anchorToAllowedDirections(rn),vn=resizeCoordinatesAlgorithm(on,hn,__assign(__assign({},dn),{allowedDirections:gn}),pn);return fn&&(vn=applyMove(vn,diff(anchorToMassPoint(fn,rn),anchorToMassPoint(vn,rn)))),moveToPositionRestrictions(vn,pn.positionRestrictions)}function resizeCoordinates(on,rn,un,dn,pn){var fn=getMinimumSize(on),hn=getSizeRestrictions(on,rn);return isInitializedState(on)?__assign(__assign({},copyState(on)),{coordinates:anchoredResizeCoordinatesAlgorithm(on.coordinates,un,dn,pn,{positionRestrictions:mergePositionRestrictions(getPositionRestrictions(on,rn),coordinatesToPositionRestrictions(on.visibleArea)),sizeRestrictions:{maxWidth:Math.min(hn.maxWidth,on.visibleArea.width),maxHeight:Math.min(hn.maxHeight,on.visibleArea.height),minWidth:Math.max(Math.min(hn.minWidth,on.visibleArea.width),fn),minHeight:Math.max(Math.min(hn.minHeight,on.visibleArea.height),fn)},aspectRatio:getAspectRatio(on,rn)})}):on}function setBoundary(on,rn,un){var dn=__assign(__assign({},copyState(on)),{boundary:un});if(dn.visibleArea&&dn.coordinates&&on.visibleArea){dn.visibleArea.height=dn.visibleArea.width/ratio(un),dn.visibleArea.top+=(on.visibleArea.height-dn.visibleArea.height)/2;var pn=getSizeRestrictions(dn,rn);(Math.max(pn.minHeight,dn.coordinates.height)-dn.visibleArea.height>0||Math.max(pn.minWidth,dn.coordinates.width)-dn.visibleArea.width>0)&&(dn.visibleArea=applyScale(dn.visibleArea,Math.max(Math.max(pn.minHeight,dn.coordinates.height)/dn.visibleArea.height,Math.max(pn.minWidth,dn.coordinates.width)/dn.visibleArea.width))),dn.visibleArea=resizeToSizeRestrictions(dn.visibleArea,getAreaSizeRestrictions(dn,rn));var fn=inverseMove(fitToPositionRestrictions(dn.coordinates,coordinatesToPositionRestrictions(dn.visibleArea)));dn.visibleArea.width<dn.coordinates.width&&(fn.left=0),dn.visibleArea.height<dn.coordinates.height&&(fn.top=0),dn.visibleArea=applyMove(dn.visibleArea,fn),dn.visibleArea=moveToPositionRestrictions(dn.visibleArea,getAreaPositionRestrictions(dn,rn)),dn=fitCoordinates(dn,rn)}return dn}function rotateImageAlgorithm(on,rn,un){if(isInitializedState(on)){var dn=copyState(on),pn=isNumber(un)?un:un.angle,fn=rotatePoint(getCenter(__assign({left:0,top:0},getTransformedImageSize(on))),pn);dn.transforms.rotate+=pn,dn.coordinates=__assign(__assign({},approximateSize({sizeRestrictions:getSizeRestrictions(dn,rn),aspectRatio:getAspectRatio(dn,rn),width:dn.coordinates.width,height:dn.coordinates.height})),rotatePoint(getCenter(dn.coordinates),pn));var hn=!isNumber(un)&&un.center?un.center:getCenter(on.coordinates),gn=diff(getCenter(on.coordinates),rotatePoint(getCenter(on.coordinates),pn,hn)),vn=getTransformedImageSize(dn);return dn.coordinates.left-=fn.left-vn.width/2+dn.coordinates.width/2-gn.left,dn.coordinates.top-=fn.top-vn.height/2+dn.coordinates.height/2-gn.top,dn.visibleArea=resizeToSizeRestrictions(dn.visibleArea,mergeSizeRestrictions(getAreaSizeRestrictions(dn,rn),{minWidth:dn.coordinates.width,minHeight:dn.coordinates.height})),dn.coordinates=moveToPositionRestrictions(dn.coordinates,getPositionRestrictions(dn,rn)),dn.visibleArea=applyMove(dn.visibleArea,diff(getCenter(dn.coordinates),getCenter(on.coordinates))),dn.visibleArea=moveToPositionRestrictions(dn.visibleArea,getAreaPositionRestrictions(dn,rn)),dn}return on}function flipImageAlgorithm(on,rn,un,dn){if(isInitializedState(on)){var pn=copyState(on),fn=on.transforms.rotate,hn=getTransformedImageSize(on),gn={horizontal:un,vertical:dn};if(gn.horizontal||gn.vertical){var vn=rotatePoint({left:hn.width/2,top:hn.height/2},-fn),yn=rotatePoint(getCenter(pn.coordinates),-fn),xn=rotatePoint({left:gn.horizontal?vn.left-(yn.left-vn.left):yn.left,top:gn.vertical?vn.top-(yn.top-vn.top):yn.top},fn);pn.coordinates=applyMove(pn.coordinates,diff(xn,getCenter(pn.coordinates))),yn=rotatePoint(getCenter(pn.visibleArea),-fn),xn=rotatePoint({left:gn.horizontal?vn.left-(yn.left-vn.left):yn.left,top:gn.vertical?vn.top-(yn.top-vn.top):yn.top},fn),pn.visibleArea=applyMove(pn.visibleArea,diff(xn,getCenter(pn.visibleArea))),pn.visibleArea=moveToPositionRestrictions(pn.visibleArea,getAreaPositionRestrictions(pn,rn))}return gn.horizontal&&(pn.transforms.flip.horizontal=!on.transforms.flip.horizontal),gn.vertical&&(pn.transforms.flip.vertical=!on.transforms.flip.vertical),pn}return on}function transformImageAlgorithm(on,rn,un){var dn,pn=un.scale,fn=pn===void 0?1:pn,hn=un.move,gn=hn===void 0?{}:hn;if(isInitializedState(on)){var vn=copyState(on),yn=1/(isNumber(fn)?fn:fn.factor),xn=isNumber(fn)?void 0:fn.center,wn=!isRoughlyEqual(yn,1),Cn=1,Tn=1;vn.visibleArea=applyMove(vn.visibleArea,{left:gn.left||0,top:gn.top||0});var Pn=getSizeRestrictions(vn,rn),Sn=getPositionRestrictions(vn,rn),En=getAreaSizeRestrictions(vn,rn),_n={stencil:{minimum:Math.max(Pn.minWidth?Pn.minWidth/vn.coordinates.width:0,Pn.minHeight?Pn.minHeight/vn.coordinates.height:0),maximum:Math.min(Pn.maxWidth?Pn.maxWidth/vn.coordinates.width:1/0,Pn.maxHeight?Pn.maxHeight/vn.coordinates.height:1/0,maxScale(vn.coordinates,positionToSizeRestrictions(Sn)))},area:{maximum:maxScale(vn.visibleArea,En),minimum:minScale(vn.visibleArea,En)}};yn&&wn&&(yn<1?(Tn=Math.max(yn,Math.max(_n.area.minimum,_n.stencil.minimum)),Tn>1&&(Tn=1)):yn>1&&(Tn=Math.min(yn,Math.min(_n.area.maximum,_n.stencil.maximum)),Tn<1&&(Tn=1))),Tn&&(vn.visibleArea=applyScale(vn.visibleArea,Tn,xn));var Rn={left:on.coordinates.left-on.visibleArea.left,right:on.visibleArea.width+on.visibleArea.left-(on.coordinates.width+on.coordinates.left),top:on.coordinates.top-on.visibleArea.top,bottom:on.visibleArea.height+on.visibleArea.top-(on.coordinates.height+on.coordinates.top)};return vn.visibleArea=moveToPositionRestrictions(vn.visibleArea,{left:Sn.left!==void 0?Sn.left-Rn.left*Tn:void 0,top:Sn.top!==void 0?Sn.top-Rn.top*Tn:void 0,bottom:Sn.bottom!==void 0?Sn.bottom+Rn.bottom*Tn:void 0,right:Sn.right!==void 0?Sn.right+Rn.right*Tn:void 0}),vn.visibleArea=moveToPositionRestrictions(vn.visibleArea,getAreaPositionRestrictions(vn,rn)),vn.coordinates.width=vn.coordinates.width*Tn,vn.coordinates.height=vn.coordinates.height*Tn,vn.coordinates.left=vn.visibleArea.left+Rn.left*Tn,vn.coordinates.top=vn.visibleArea.top+Rn.top*Tn,vn.coordinates=moveToPositionRestrictions(vn.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(vn.visibleArea),Sn)),wn&&yn&&(!((dn=rn.transformImage)===null||dn===void 0)&&dn.adjustStencil)&&(yn>1?Cn=Math.min(_n.area.maximum,yn)/Tn:yn<1&&(Cn=Math.max(vn.coordinates.height/vn.visibleArea.height,vn.coordinates.width/vn.visibleArea.width,yn/Tn)),Cn!==1&&(vn.visibleArea=applyScale(vn.visibleArea,Cn,yn>1?xn:getCenter(vn.coordinates)),vn.visibleArea=moveToPositionRestrictions(vn.visibleArea,getAreaPositionRestrictions(vn,rn)),vn.visibleArea=applyMove(vn.visibleArea,inverseMove(fitToPositionRestrictions(vn.coordinates,coordinatesToPositionRestrictions(vn.visibleArea)))))),vn}return on}function transformImage(on,rn,un){return un.rotate&&(on=rotateImageAlgorithm(on,rn,un.rotate)),un.flip&&(on=flipImageAlgorithm(on,rn,un.flip.horizontal,un.flip.vertical)),(un.move||un.scale)&&(on=transformImageAlgorithm(on,rn,un)),on}function reconcileState(on,rn){if(isInitializedState(on)){var un=copyState(on),dn=getAspectRatio(on,rn),pn=getSizeRestrictions(on,rn),fn=getAreaSizeRestrictions(on,rn),hn=getBrokenRatio(ratio(on.coordinates),dn),gn=hn?{height:on.coordinates.height,width:on.coordinates.height*hn}:on.coordinates;un.coordinates=__assign(__assign({},un.coordinates),approximateSize({width:gn.width,height:gn.height,aspectRatio:dn,sizeRestrictions:mergeSizeRestrictions(fn,pn)})),un.coordinates=applyMove(un.coordinates,diff(getCenter(on.coordinates),getCenter(un.coordinates)));var vn=Math.max(un.coordinates.width/un.visibleArea.width,un.coordinates.height/un.visibleArea.height,1);return un.visibleArea=__assign(__assign({},on.visibleArea),approximateSize({width:on.visibleArea.width*vn,height:on.visibleArea.height*vn,aspectRatio:{minimum:ratio(un.boundary),maximum:ratio(un.boundary)},sizeRestrictions:fn})),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(on.visibleArea),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn)),un.coordinates=moveToPositionRestrictions(un.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(un.visibleArea),getPositionRestrictions(un,rn))),un}return on}function normalizeResizeDirections(on,rn){var un=getCoefficient(on);return{left:isNumber(rn.left)?rn.left*un:0,top:isNumber(rn.top)?rn.top*un:0,right:isNumber(rn.right)?rn.right*un:0,bottom:isNumber(rn.bottom)?rn.bottom*un:0}}function normalizeCenter(on,rn){var un=getCoefficient(on);return on.visibleArea?{left:rn.left*un+on.visibleArea.left,top:rn.top*un+on.visibleArea.top}:rn}function normalizeFlip(on,rn){if(on){var un=Math.abs(on.transforms.rotate%180);return un<=45||un>=135?rn:{horizontal:rn.vertical,vertical:rn.horizontal}}return rn}function fillMoveDirections(on){return{left:isNumber(on.left)?on.left:0,top:isNumber(on.top)?on.top:0}}function fillResizeDirections(on){return{left:isNumber(on.left)?on.left:0,top:isNumber(on.top)?on.top:0,right:isNumber(on.right)?on.right:0,bottom:isNumber(on.bottom)?on.bottom:0}}function normalizeMoveDirections(on,rn){var un=getCoefficient(on);return{left:isNumber(rn.left)?rn.left*un:0,top:isNumber(rn.top)?rn.top*un:0}}function normalizeImageTransform(on,rn){return rn.scale&&(rn.scale={factor:isNumber(rn.scale)?rn.scale:rn.scale.factor,center:!isNumber(rn.scale)&&rn.scale.center?normalizeCenter(on,rn.scale.center):void 0}),rn.rotate&&(rn.rotate={angle:isNumber(rn.rotate)?rn.rotate:rn.rotate.angle,center:!isNumber(rn.rotate)&&rn.rotate.center?normalizeCenter(on,rn.rotate.center):void 0}),rn.move&&(rn.move=normalizeMoveDirections(on,rn.move)),rn}function calculateGeometricProperties(on,rn){var un=rn.getBoundingClientRect(),dn=un.left,pn=un.top,fn={left:0,top:0},hn=0;return on.forEach(function(gn){fn.left+=(gn.clientX-dn)/on.length,fn.top+=(gn.clientY-pn)/on.length}),on.forEach(function(gn){hn+=distance({left:fn.left,top:fn.top},{left:gn.clientX-dn,top:gn.clientY-pn})}),{centerMass:fn,spread:hn,count:on.length}}function touchesToImageTransform(on,rn,un,dn){dn===void 0&&(dn={});var pn,fn,hn;if(rn.length===1&&on.length===1)dn.move&&(pn={left:rn[0].clientX-on[0].clientX,top:rn[0].clientY-on[0].clientY});else if(on.length>1){var gn=calculateGeometricProperties(rn,un),vn=calculateGeometricProperties(on,un);if(dn.rotate&&rn.length===2&&on.length===2){var yn={left:[on[0].clientX-on[1].clientX,rn[0].clientX-rn[1].clientX],top:[on[0].clientY-on[1].clientY,rn[0].clientY-rn[1].clientY]},xn=yn.left[0]*yn.top[1]-yn.left[1]*yn.top[0],wn=yn.left[0]*yn.left[1]+yn.top[0]*yn.top[1];if(!isRoughlyEqual(wn,0)&&!isRoughlyEqual(xn,0)){var Cn=Math.atan2(xn,wn),Tn=-(Cn*180)/Math.PI;hn={center:vn.centerMass,angle:Tn}}}dn.move&&(pn={left:gn.centerMass.left-vn.centerMass.left,top:gn.centerMass.top-vn.centerMass.top}),dn.scale&&(fn={factor:vn.spread/gn.spread,center:vn.centerMass})}return{move:pn,scale:fn,rotate:hn}}function wheelEventToImageTransform(on,rn,un){un===void 0&&(un=.1);var dn=rn.getBoundingClientRect(),pn=dn.left,fn=dn.top,hn=1-un*sign(on.deltaY||on.detail||on.wheelDelta),gn={left:on.clientX-pn,top:on.clientY-fn};return{scale:{factor:hn,center:gn}}}function hasInteractions(on){return on.moveCoordinates||on.resizeCoordinates||on.transformImage.move||on.transformImage.rotate||on.transformImage.flip||on.transformImage.scale}function getEmptyInteractions(){return{moveCoordinates:!1,resizeCoordinates:!1,transformImage:{rotate:!1,move:!1,scale:!1,flip:!1}}}function defaultPositionRestrictions(on,rn){var un=getTransformedImageSize(on),dn={};return rn.imageRestriction&&rn.imageRestriction!=="none"&&(dn={left:0,top:0,right:un.width,bottom:un.height}),dn}function defaultVisibleArea(on,rn){var un=on.coordinates,dn=on.boundary,pn=getTransformedImageSize(on),fn=ratio(dn);if(un){var hn={height:Math.max(un.height,pn.height),width:Math.max(un.width,pn.width)},gn={left:0,top:0,width:ratio(hn)>fn?hn.width:hn.height*fn,height:ratio(hn)>fn?hn.width/fn:hn.height};gn=resizeToSizeRestrictions(gn,getAreaSizeRestrictions(on,rn)),gn.left=un.left+un.width/2-gn.width/2,gn.top=un.top+un.height/2-gn.height/2;var vn=getIntersections(un,coordinatesToPositionRestrictions(__assign({left:0,top:0},pn))),yn={};return!vn.left&&!vn.right&&gn.width<=pn.width&&(yn.left=0,yn.right=pn.width),!vn.top&&!vn.bottom&&gn.height<=pn.height&&(yn.top=0,yn.bottom=pn.height),moveToPositionRestrictions(gn,yn)}else{var xn=ratio(pn),wn={height:xn<fn?pn.height:pn.width/fn,width:xn<fn?pn.height*fn:pn.width};return{left:pn.width/2-wn.width/2,top:pn.height/2-wn.height/2,width:wn.width,height:wn.height}}}function defaultSize$1(on,rn){var un=on.imageSize,dn=on.visibleArea,pn=getSizeRestrictions(on,rn),fn=getAspectRatio(on,rn),hn;if(dn)hn=dn;else{var gn=positionToSizeRestrictions(getPositionRestrictions(on,rn));hn={width:Math.max(gn.minWidth,Math.min(gn.maxWidth,un.width)),height:Math.max(gn.minHeight,Math.min(gn.maxHeight,un.height))}}var vn=Math.min(fn.maximum||1/0,Math.max(fn.minimum||0,ratio(hn))),yn=hn.width<hn.height?{width:hn.width*.8,height:hn.width*.8/vn}:{height:hn.height*.8,width:hn.height*.8*vn};return approximateSize(__assign(__assign({},yn),{aspectRatio:fn,sizeRestrictions:pn}))}function retrieveSizeRestrictions(on){return{minWidth:isNumeric(on.minWidth)?parseNumber(on.minWidth):0,minHeight:isNumeric(on.minHeight)?parseNumber(on.minHeight):0,maxWidth:isNumeric(on.maxWidth)?parseNumber(on.maxWidth):1/0,maxHeight:isNumeric(on.maxHeight)?parseNumber(on.maxHeight):1/0}}function pixelsRestrictions(on,rn){return retrieveSizeRestrictions(rn)}function defaultPosition(on){var rn=on.visibleArea,un=on.coordinates,dn=rn||getTransformedImageSize(on);return{left:(rn?rn.left:0)+dn.width/2-(un?un.width/2:0),top:(rn?rn.top:0)+dn.height/2-(un?un.height/2:0)}}function defaultAreaPositionRestrictions(on,rn){var un=on.visibleArea,dn=on.boundary,pn=rn.imageRestriction,fn=getTransformedImageSize(on),hn={};return pn===ImageRestriction.fillArea?hn={left:0,top:0,right:fn.width,bottom:fn.height}:pn===ImageRestriction.fitArea&&(ratio(dn)>ratio(fn)?(hn={top:0,bottom:fn.height},un&&(un.width>fn.width?(hn.left=-(un.width-fn.width)/2,hn.right=fn.width-hn.left):(hn.left=0,hn.right=fn.width))):(hn={left:0,right:fn.width},un&&(un.height>fn.height?(hn.top=-(un.height-fn.height)/2,hn.bottom=fn.height-hn.top):(hn.top=0,hn.bottom=fn.height)))),hn}function defaultAreaSizeRestrictions(on,rn){var un=on.boundary,dn=rn.imageRestriction,pn=getTransformedImageSize(on),fn={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0};return dn===ImageRestriction.fillArea?(fn.maxWidth=pn.width,fn.maxHeight=pn.height):dn===ImageRestriction.fitArea&&(ratio(un)>ratio(pn)?(fn.maxHeight=pn.height,fn.maxWidth=pn.height*ratio(un)):(fn.maxWidth=pn.width,fn.maxHeight=pn.width/ratio(un))),fn}function fillBoundary(on){var rn=on.getBoundingClientRect(),un=rn.width,dn=rn.height;return{width:un,height:dn}}function defaultStencilConstraints(on,rn){return on.aspectRatio?{}:{aspectRatio:createAspectRatio(isFunction(rn.aspectRatio)?rn.aspectRatio():rn.aspectRatio)}}function withDefaultSizeRestrictions(on){return function(rn,un){var dn=isFunction(on)?on(rn,un):on;return mergeSizeRestrictions(pixelsRestrictions(rn,un),dn)}}function createDefaultSettings(on){return __assign(__assign({},on),{sizeRestrictions:function(rn,un){var dn;return on.sizeRestrictions?dn=isFunction(on.sizeRestrictions)?on.sizeRestrictions(rn,un):on.sizeRestrictions:dn=pixelsRestrictions(rn,un),dn},areaPositionRestrictions:function(rn,un){return on.areaPositionRestrictions?isFunction(on.areaPositionRestrictions)?on.areaPositionRestrictions(rn,un):on.areaPositionRestrictions:defaultAreaPositionRestrictions(rn,un)},areaSizeRestrictions:function(rn,un){return on.areaSizeRestrictions?isFunction(on.areaSizeRestrictions)?on.areaSizeRestrictions(rn,un):on.areaSizeRestrictions:defaultAreaSizeRestrictions(rn,un)},positionRestrictions:function(rn,un){return on.positionRestrictions?isFunction(on.positionRestrictions)?on.positionRestrictions(rn,un):on.positionRestrictions:defaultPositionRestrictions(rn,un)},defaultCoordinates:function(rn,un){if(on.defaultCoordinates)return isFunction(on.defaultCoordinates)?on.defaultCoordinates(rn,un):on.defaultCoordinates;var dn=on.defaultSize;dn||(dn=defaultSize$1);var pn=isFunction(dn)?dn(rn,un):dn,fn=on.defaultPosition||defaultPosition;return[pn,function(hn){return __assign({},isFunction(fn)?fn(hn,un):fn)}]},defaultVisibleArea:function(rn,un){return on.defaultVisibleArea?isFunction(on.defaultVisibleArea)?on.defaultVisibleArea(rn,un):on.defaultVisibleArea:defaultVisibleArea(rn,un)},aspectRatio:function(rn,un){return createAspectRatio(isFunction(on.aspectRatio)?on.aspectRatio(rn,un):on.aspectRatio)}})}function runCallback(on,rn){if(on&&rn){var un=rn();un&&on(un)}}function runCallbacks(on,rn){on.forEach(function(un){runCallback(un,rn)})}var AbstractCropperInstance=function(){function on(){var rn=this;this.getTransitions=function(){var un=rn.getData(),dn=rn.getProps().transitions;return __assign(__assign({},getOptions(dn,{timingFunction:"ease-in-out",duration:350})),{active:un.transitions})},this.getInteractions=function(){var un=rn.getData().interactions;return deepClone(un)},this.hasInteractions=function(){var un=rn.getData().interactions;return hasInteractions(un)},this.startTransitions=function(){var un=rn.getProps(),dn=un.onTransitionsStart,pn=un.onUpdate,fn=un.getInstance,hn=rn.getData(),gn=hn.transitions,vn=__rest(hn,["transitions"]);rn.setData(__assign(__assign({},vn),{transitions:!0})),gn||runCallbacks([dn,pn],fn),rn.endTransitions()},this.endTransitions=debounce(function(){var un=rn.getProps(),dn=un.onTransitionsEnd,pn=un.onUpdate,fn=un.getInstance;rn.setData(__assign(__assign({},rn.getData()),{transitions:!1})),runCallbacks([dn,pn],fn)},function(){return rn.getTransitions().duration}),this.applyPostProcess=function(un,dn){var pn=rn.getProps(),fn=pn.settings,hn=pn.postProcess,gn=un.name,vn=un.interaction,yn=vn===void 0?!1:vn,xn=un.transitions,wn=xn===void 0?!1:xn,Cn=un.immediately,Tn=Cn===void 0?!1:Cn,Pn={name:gn,interaction:yn,transitions:wn,immediately:Tn};return isArray(hn)?hn.reduce(function(Sn,En){return En(Sn,fn,Pn)},dn):isFunction(hn)?hn(dn,fn,Pn):dn},this.updateState=function(un,dn,pn){dn===void 0&&(dn={}),pn===void 0&&(pn=[]);var fn=dn.transitions,hn=fn===void 0?!1:fn,gn=rn.getProps(),vn=gn.onTransitionsStart,yn=gn.getInstance,xn=gn.onChange,wn=gn.onUpdate,Cn=gn.settings,Tn=rn.getData(),Pn=isFunction(un)?un(Tn.state,Cn):un,Sn=Pn?.001*getCoefficient(Pn):.001,En=!deepCompare(Tn.state,Pn,Sn),_n=["coordinates","boundary","visibleArea","imageSize","transforms"].some(function($n){var Mn;return!deepCompare((Mn=Tn.state)===null||Mn===void 0?void 0:Mn[$n],Pn?.[$n],Sn)}),Rn=Tn;En&&(hn&&_n&&rn.endTransitions(),Rn=__assign(__assign({},Rn),{state:copyState(Pn),transitions:hn&&_n}),rn.setData(Rn),runCallback(xn,yn)),Rn.transitions&&!Tn.transitions&&runCallback(vn,yn),runCallbacks(__spreadArrays(pn,[wn]),yn)},this.setInteractions=function(un){var dn=rn.getProps(),pn=dn.onInteractionStart,fn=dn.onInteractionEnd,hn=dn.getInstance,gn=rn.getInteractions(),vn=__assign(__assign({},gn),un);if(deepCompare(gn,vn)||rn.setData(__assign(__assign({},rn.getData()),{interactions:vn})),hasInteractions(gn)!==hasInteractions(vn))if(!hasInteractions(gn))runCallback(pn,hn);else{var yn=rn.getData().state;rn.updateState(function(){return yn&&rn.applyPostProcess({name:"interactionEnd",immediately:!0,transitions:!0},yn)},{transitions:!0},[fn])}},this.resetState=function(un,dn){rn.updateState(rn.createDefaultState(un,dn))},this.clear=function(){rn.updateState(null)},this.reconcileState=function(un){un===void 0&&(un={});var dn=rn.getProps(),pn=dn.reconcileStateAlgorithm,fn=dn.settings,hn=rn.getData().state,gn=un.transitions,vn=gn===void 0?!1:gn;if(hn&&!isConsistentState(hn,fn)){var yn=(pn||reconcileState)(hn,fn);yn=rn.applyPostProcess({name:"reconcileState",immediately:!0,transitions:vn},yn),rn.updateState(yn,{transitions:vn})}},this.transformImage=function(un,dn){dn===void 0&&(dn={});var pn=dn.transitions,fn=pn===void 0?!0:pn,hn=dn.interaction,gn=hn===void 0?!0:hn,vn=dn.immediately,yn=vn===void 0?!1:vn,xn=dn.normalize,wn=xn===void 0?!0:xn,Cn=rn.getProps(),Tn=Cn.transformImageAlgorithm,Pn=Cn.onTransformImage,Sn=Cn.onTransformImageEnd,En=Cn.settings,_n=rn.getData().state,Rn=[];if(_n){wn&&(un=normalizeImageTransform(_n,un));var $n=rn.applyPostProcess({name:"transformImage",transitions:fn,immediately:yn},(Tn||transformImage)(_n,En,un));Rn.push(Pn),gn?rn.setInteractions({transformImage:{rotate:!isUndefined(un.rotate),flip:!isUndefined(un.flip),scale:!isUndefined(un.scale),move:!isUndefined(un.move)}}):($n=rn.applyPostProcess({name:"transformImageEnd",transitions:fn,immediately:!0},$n),Rn.push(Sn)),rn.updateState($n,{transitions:yn&&fn},Rn)}},this.transformImageEnd=function(un){un===void 0&&(un={});var dn=un.immediately,pn=dn===void 0?!0:dn,fn=un.transitions,hn=fn===void 0?!0:fn,gn=rn.getData().state,vn=rn.getProps().onTransformImageEnd;rn.updateState(function(){return gn&&rn.applyPostProcess({name:"transformImageEnd",immediately:pn,transitions:hn},gn)},{transitions:hn},[vn]),rn.setInteractions({transformImage:{rotate:!1,flip:!1,scale:!1,move:!1}})},this.zoomImage=function(un,dn){dn===void 0&&(dn={});var pn=dn.interaction,fn=pn===void 0?!1:pn,hn=dn.immediately,gn=hn===void 0?!0:hn,vn=dn.transitions,yn=vn===void 0?!0:vn,xn=dn.normalize,wn=xn===void 0?!1:xn;rn.transformImage({scale:un},{interaction:fn,immediately:gn,transitions:yn,normalize:wn})},this.moveImage=function(un,dn,pn){pn===void 0&&(pn={});var fn=pn.interaction,hn=fn===void 0?!1:fn,gn=pn.immediately,vn=gn===void 0?!0:gn,yn=pn.transitions,xn=yn===void 0?!0:yn,wn=pn.normalize,Cn=wn===void 0?!1:wn;rn.transformImage({move:{left:un,top:dn}},{interaction:hn,immediately:vn,transitions:xn,normalize:Cn})},this.flipImage=function(un,dn,pn){pn===void 0&&(pn={});var fn=pn.interaction,hn=fn===void 0?!1:fn,gn=pn.immediately,vn=gn===void 0?!0:gn,yn=pn.transitions,xn=yn===void 0?!0:yn,wn=pn.normalize,Cn=wn===void 0?!0:wn,Tn=rn.getState(),Pn={horizontal:un,vertical:dn};rn.transformImage({flip:Tn&&Cn?normalizeFlip(Tn,Pn):Pn},{interaction:hn,immediately:vn,transitions:xn})},this.rotateImage=function(un,dn){dn===void 0&&(dn={});var pn=dn.interaction,fn=pn===void 0?!1:pn,hn=dn.immediately,gn=hn===void 0?!0:hn,vn=dn.transitions,yn=vn===void 0?!0:vn,xn=dn.normalize,wn=xn===void 0?!1:xn;rn.transformImage({rotate:un},{interaction:fn,immediately:gn,transitions:yn,normalize:wn})},this.reset=function(un,dn){rn.resetState(un,dn)},this.setState=function(un,dn){dn===void 0&&(dn={});var pn=rn.getSettings(),fn=rn.getData().state,hn=dn.transitions,gn=hn===void 0?!0:hn,vn=dn.immediately,yn=vn===void 0?!1:vn,xn=dn.interaction,wn=xn===void 0?!1:xn,Cn=dn.postprocess,Tn=Cn===void 0?!1:Cn,Pn=un&&(isFunction(un)?un(fn,pn):__assign(__assign({},fn),un));rn.updateState(function(){return Tn?Pn&&rn.applyPostProcess({name:"setState",immediately:yn,transitions:gn,interaction:wn},Pn):Pn},{transitions:gn})},this.setCoordinates=function(un,dn){dn===void 0&&(dn={});var pn=rn.getData().state,fn=rn.getProps(),hn=fn.setCoordinatesAlgorithm,gn=fn.settings,vn=dn.transitions,yn=vn===void 0?!0:vn,xn=dn.immediately,wn=xn===void 0?!0:xn;rn.updateState(function(){return pn&&rn.applyPostProcess({name:"setCoordinates",immediately:wn,transitions:yn},(hn||setCoordinates)(pn,gn,un,SetCoordinatesMode.zoom))},{transitions:yn})},this.setVisibleArea=function(un,dn){dn===void 0&&(dn={});var pn=dn.transitions,fn=pn===void 0?!0:pn,hn=dn.immediately,gn=hn===void 0?!0:hn,vn=rn.getData().state,yn=rn.getProps(),xn=yn.setVisibleAreaAlgorithm,wn=yn.settings;rn.updateState(function(){return vn&&rn.applyPostProcess({name:"setVisibleArea",immediately:gn,transitions:fn},(xn||setVisibleArea)(vn,wn,un))},{transitions:fn})},this.setBoundary=function(un,dn){dn===void 0&&(dn={});var pn=rn.getData().state,fn=rn.getProps(),hn=fn.setBoundaryAlgorithm,gn=fn.settings,vn=dn.transitions,yn=vn===void 0?!1:vn,xn=dn.immediately,wn=xn===void 0?!0:xn;un?rn.updateState(function(){return pn&&rn.applyPostProcess({name:"setBoundary",immediately:wn,transitions:yn},(hn||setBoundary)(pn,gn,un))}):rn.updateState(null)},this.moveCoordinates=function(un,dn){dn===void 0&&(dn={});var pn=rn.getData(),fn=rn.getProps(),hn=fn.moveCoordinatesAlgorithm,gn=fn.onMove,vn=fn.onMoveEnd,yn=fn.settings,xn=dn.interaction,wn=xn===void 0?!0:xn,Cn=dn.transitions,Tn=Cn===void 0?!1:Cn,Pn=dn.immediately,Sn=Pn===void 0?!1:Pn,En=dn.normalize,_n=En===void 0?!0:En,Rn=[];if(!pn.transitions&&pn.state){var $n=_n?normalizeMoveDirections(pn.state,un):fillMoveDirections(un),Mn=rn.applyPostProcess({name:"moveCoordinates",interaction:wn,immediately:Sn,transitions:Tn},(hn||moveCoordinates)(pn.state,yn,$n));Rn.push(gn),wn?rn.setInteractions({moveCoordinates:!0}):(Mn=rn.applyPostProcess({name:"moveCoordinatesEnd",interaction:wn,immediately:Sn,transitions:Tn},Mn),Rn.push(vn)),rn.updateState(Mn,{transitions:Sn&&Tn},Rn)}},this.moveCoordinatesEnd=function(un){un===void 0&&(un={});var dn=rn.getData().state,pn=rn.getProps().onMoveEnd,fn=un.transitions,hn=fn===void 0?!0:fn,gn=un.immediately,vn=gn===void 0?!1:gn;rn.updateState(function(){return dn&&rn.applyPostProcess({name:"moveCoordinatesEnd",transitions:hn,immediately:vn},dn)},{transitions:hn},[pn]),rn.setInteractions({moveCoordinates:!1})},this.resizeCoordinates=function(un,dn,pn,fn){fn===void 0&&(fn={});var hn=rn.getData().state,gn=rn.getProps(),vn=gn.resizeCoordinatesAlgorithm,yn=gn.onResize,xn=gn.onResizeEnd,wn=gn.settings,Cn=fn.interaction,Tn=Cn===void 0?!0:Cn,Pn=fn.transitions,Sn=Pn===void 0?!1:Pn,En=fn.immediately,_n=En===void 0?!1:En,Rn=fn.normalize,$n=Rn===void 0?!0:Rn,Mn=rn.getTransitions();if(!Mn.active&&hn){var An=[],Dn=$n?normalizeResizeDirections(hn,dn):fillResizeDirections(dn),On=rn.applyPostProcess({name:"resizeCoordinates",interaction:Tn,immediately:_n,transitions:Sn},(vn||resizeCoordinates)(hn,wn,un,Dn,isObject(pn)?pn:{}));An.push(yn),Tn?rn.setInteractions({resizeCoordinates:!0}):(On=rn.applyPostProcess({name:"resizeCoordinatesEnd",interaction:Tn,immediately:_n,transitions:Sn},On),An.push(xn)),rn.updateState(On,{transitions:_n&&Sn},An)}},this.resizeCoordinatesEnd=function(un){un===void 0&&(un={});var dn=rn.getProps().onResizeEnd,pn=rn.getData().state,fn=un.transitions,hn=fn===void 0?!0:fn,gn=un.immediately,vn=gn===void 0?!1:gn;rn.updateState(function(){return pn&&rn.applyPostProcess({name:"resizeCoordinatesEnd",transitions:hn,immediately:vn},pn)},{transitions:hn},[dn]),rn.setInteractions({resizeCoordinates:!1})},this.getStencilCoordinates=function(){var un=rn.getData().state;return getStencilCoordinates(un)},this.getCoordinates=function(un){un===void 0&&(un={});var dn=rn.getData().state,pn=rn.getProps().settings;if(dn&&dn.coordinates){var fn=un.round,hn=fn===void 0?!0:fn;return hn?getRoundedCoordinates(dn,pn):__assign({},dn.coordinates)}else return null},this.getVisibleArea=function(){var un=rn.getData().state;return un?.visibleArea?__assign({},un.visibleArea):null},this.getSettings=function(){var un=rn.getProps().settings;return __assign({},un)},this.getState=function(){var un=rn.getData().state;return copyState(un)},this.getTransforms=function(){var un=rn.getData().state;return un?deepClone(un.transforms):{rotate:0,flip:{horizontal:!1,vertical:!1}}},this.createDefaultState=function(un,dn){var pn=rn.getProps(),fn=pn.createStateAlgorithm,hn=pn.settings;return rn.applyPostProcess({name:"createState",immediately:!0,transitions:!1},(fn||createState)({image:dn,boundary:un},hn))},this.isConsistent=function(){var un=rn.getData().state,dn=rn.getProps().settings;return un?isConsistentState(un,dn):!0}}return on}(),timingFunctions={linear:function(on){return on},"ease-in":function(on){return Math.pow(on,1.675)},"ease-out":function(on){return 1-Math.pow(1-on,1.675)},"ease-in-out":function(on){return .5*(Math.sin((on-.5)*Math.PI)+1)}},Animation=function(){function on(){this.active=!1}return on.prototype.start=function(rn){var un;this.onStart=rn.onStart,this.onProgress=rn.onProgress,this.onStop=rn.onStop,this.active||(un=this.onStart)===null||un===void 0||un.call(this),this.id&&window.cancelAnimationFrame(this.id),this.startTime=performance.now(),this.timingFunction=rn.timingFunction,this.endTime=this.startTime+rn.duration,this.active=!0,this.animate()},on.prototype.animate=function(){var rn=this;if(this.startTime&&this.endTime){var un=timingFunctions[this.timingFunction];un||(process.env.NODE_ENV!=="production"&&console.warn("[Animation] The timing function '"+un+"' is not supported. Available timing function: 'linear', 'ease-in', 'ease-in-out', 'ease-out'. Reset to 'ease-out'."),un=timingFunctions["ease-out"]);var dn=1-(this.endTime-performance.now())/(this.endTime-this.startTime),pn=Math.min(1,un(dn));this.onProgress&&this.onProgress(pn),dn<1?this.id=window.requestAnimationFrame(function(){return rn.animate()}):this.stop()}else this.stop()},on.prototype.stop=function(){this.active=!1,this.id&&window.cancelAnimationFrame(this.id),this.onStop&&this.onStop()},on}();function prepareSource(on,rn,un){var dn=un.rotate,pn=un.flip,fn={width:"naturalWidth"in rn?rn.naturalWidth:rn.width,height:"naturalHeight"in rn?rn.naturalHeight:rn.height},hn=rotateSize(fn,dn),gn=on.getContext("2d");if(on.height=hn.height,on.width=hn.width,gn){gn.save();var vn=rotatePoint(getCenter(__assign({left:0,top:0},fn)),dn);gn.translate(-(vn.left-hn.width/2),-(vn.top-hn.height/2)),gn.rotate(dn*Math.PI/180),gn.translate(pn.horizontal?fn.width:0,pn.vertical?fn.height:0),gn.scale(pn.horizontal?-1:1,pn.vertical?-1:1),gn.drawImage(rn,0,0,fn.width,fn.height),gn.restore()}return on}function updateCanvas(on,rn,un,dn,pn){on.width=dn?dn.width:un.width,on.height=dn?dn.height:un.height;var fn=on.getContext("2d");if(fn){fn.clearRect(0,0,on.width,on.height),pn&&(pn.imageSmoothingEnabled&&(fn.imageSmoothingEnabled=pn.imageSmoothingEnabled),pn.imageSmoothingQuality&&(fn.imageSmoothingQuality=pn.imageSmoothingQuality),pn.fillColor&&(fn.fillStyle=pn.fillColor,fn.fillRect(0,0,on.width,on.height),fn.save()));var hn=un.left<0?-un.left:0,gn=un.top<0?-un.top:0;fn.drawImage(rn,un.left+hn,un.top+gn,un.width,un.height,hn*(on.width/un.width),gn*(on.height/un.height),on.width,on.height)}return on}function drawCroppedArea(on,rn,un,dn,pn){if(isInitializedState(on)){var fn=on.transforms,hn=on.coordinates,gn=fn.rotate!==0||fn.flip.horizontal||fn.flip.vertical,vn=gn?prepareSource(dn,rn,fn):rn,yn=__assign({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,maxArea:1/0,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",fillColor:"transparent"},pn),xn=function(Tn){return Tn.find(function(Pn){return isNumeric(Pn)})},wn=approximateSize({sizeRestrictions:{minWidth:xn([yn.width,yn.minWidth])||0,minHeight:xn([yn.height,yn.minHeight])||0,maxWidth:xn([yn.width,yn.maxWidth])||1/0,maxHeight:xn([yn.height,yn.maxHeight])||1/0},width:hn.width,height:hn.height,aspectRatio:{minimum:hn.width/hn.height,maximum:hn.width/hn.height}});if(yn.maxArea&&wn.width*wn.height>yn.maxArea){var Cn=Math.sqrt(yn.maxArea/(wn.width*wn.height));wn={width:Math.round(Cn*wn.width),height:Math.round(Cn*wn.height)}}return updateCanvas(un,vn,hn,wn,yn)}else return null}function stretchCropperBoundary(on,rn,un){rn.style.width="0px",rn.style.height="0px",rn.style.width=Math.max(on.clientWidth,un.width)+"px";var dn=un.width/un.height;rn.style.height=Math.max(on.clientHeight,rn.clientWidth/dn)+"px",rn.style.width=rn.clientHeight*dn+"px"}function stretchPreviewBoundary(on,rn,un){rn.style.width="0px",rn.style.height="0px",rn.style.width=Math.max(on.getBoundingClientRect().width,un.width)+"px";var dn=un.width/un.height;rn.style.height=Math.max(on.getBoundingClientRect().height,rn.getBoundingClientRect().width/dn)+"px",rn.style.width=rn.getBoundingClientRect().height*dn+"px",rn.clientWidth/rn.clientHeight>on.clientWidth/on.clientHeight?rn.clientWidth>on.clientWidth&&(rn.style.width=on.clientWidth+"px",rn.style.height=on.clientWidth/dn+"px"):rn.clientHeight>on.clientHeight&&(rn.style.height=on.clientHeight+"px",rn.style.width=on.clientHeight*dn+"px")}var XHR_DONE=4;function base64ToArrayBuffer(on){on=on.replace(/^data:([^;]+);base64,/gim,"");for(var rn=atob(on),un=rn.length,dn=new ArrayBuffer(un),pn=new Uint8Array(dn),fn=0;fn<un;fn++)pn[fn]=rn.charCodeAt(fn);return dn}function objectURLToBlob(on,rn){var un=new XMLHttpRequest;un.open("GET",on,!0),un.responseType="blob",un.onload=function(){(this.status==200||this.status===0)&&rn(this.response)},un.send()}function getTransforms(on){var rn={flip:{horizontal:!1,vertical:!1},rotate:0};if(on)switch(on){case 2:rn.flip.horizontal=!0;break;case 3:rn.rotate=-180;break;case 4:rn.flip.vertical=!0;break;case 5:rn.rotate=90,rn.flip.vertical=!0;break;case 6:rn.rotate=90;break;case 7:rn.rotate=90,rn.flip.horizontal=!0;break;case 8:rn.rotate=-90;break}return rn}function getImageData(on){return new Promise(function(rn,un){try{if(on)if(/^data:/i.test(on))rn(base64ToArrayBuffer(on));else if(/^blob:/i.test(on)){var dn=new FileReader;dn.onload=function(fn){var hn;rn((hn=fn.target)===null||hn===void 0?void 0:hn.result)},objectURLToBlob(on,function(fn){dn.readAsArrayBuffer(fn)})}else{var pn=new XMLHttpRequest;pn.onreadystatechange=function(){pn.readyState===XHR_DONE&&(pn.status===200||pn.status===0?rn(pn.response):un("Warning: could not load an image to parse its orientation"))},pn.onprogress=function(){pn.getResponseHeader("content-type")!=="image/jpeg"&&pn.abort()},pn.withCredentials=!1,pn.open("GET",on,!0),pn.responseType="arraybuffer",pn.send(null)}else un("Error: the image is empty")}catch(fn){un(fn)}})}function getStyleTransforms(on){var rn=on.rotate,un=rn===void 0?0:rn,dn=on.flip,pn=dn===void 0?{horizontal:!1,vertical:!1}:dn,fn=on.scale,hn=fn===void 0?1:fn;return" rotate("+un+"deg) scaleX("+hn*(pn.horizontal?-1:1)+") scaleY("+hn*(pn.vertical?-1:1)+")"}function getStringFromCharCode(on,rn,un){var dn="",pn;for(pn=rn,un+=rn;pn<un;pn++)dn+=String.fromCharCode(on.getUint8(pn));return dn}function resetAndGetOrientation(on){try{var rn=new DataView(on),un,dn=void 0,pn=void 0,fn=void 0,hn=void 0,gn=void 0;if(rn.getUint8(0)===255&&rn.getUint8(1)===216)for(var vn=rn.byteLength,yn=2;yn+1<vn;){if(rn.getUint8(yn)===255&&rn.getUint8(yn+1)===225){hn=yn;break}yn++}if(hn&&(dn=hn+4,pn=hn+10,getStringFromCharCode(rn,dn,4)==="Exif")){var xn=rn.getUint16(pn);if(fn=xn===18761,(fn||xn===19789)&&rn.getUint16(pn+2,fn)===42){var wn=rn.getUint32(pn+4,fn);wn>=8&&(gn=pn+wn)}}if(gn)for(var Cn=rn.getUint16(gn,fn),Tn=0;Tn<Cn;Tn++){var yn=gn+Tn*12+2;if(rn.getUint16(yn,fn)===274){yn+=8,un=rn.getUint16(yn,fn),rn.setUint16(yn,1,fn);break}}return un}catch{return null}}function arrayBufferToDataURL(on){for(var rn=[],un=8192,dn=new Uint8Array(on);dn.length>0;){var pn=dn.subarray(0,un);rn.push(String.fromCharCode.apply(null,Array.from?Array.from(pn):pn.slice())),dn=dn.subarray(un)}return"data:image/jpeg;base64,"+btoa(rn.join(""))}function getImage(on){var rn=on.src,un=on.arrayBuffer,dn=un===void 0?null:un,pn=on.orientation,fn=pn===void 0?null:pn,hn={src:rn,arrayBuffer:dn,revoke:!1,transforms:{flip:{horizontal:!1,vertical:!1},rotate:0}};return dn&&fn&&fn>1?isBlob(rn)||!isLocal(rn)?(hn.src=URL.createObjectURL(new Blob([dn])),hn.revoke=!0):hn.src=arrayBufferToDataURL(dn):hn.src=rn,fn&&(hn.transforms=getTransforms(fn)),hn}function parseImage(on,rn){rn===void 0&&(rn={});var un=rn.checkOrientation,dn=rn.parse;return new Promise(function(pn){un||dn?getImageData(on).then(function(fn){var hn=resetAndGetOrientation(fn);pn(getImage(fn?{src:on,arrayBuffer:fn,orientation:hn}:{src:on,arrayBuffer:null,orientation:null}))}).catch(function(fn){console.warn(fn),pn(getImage({src:on}))}):pn(getImage({src:on}))})}function createImage(on,rn){return rn===void 0&&(rn={}),new Promise(function(un,dn){var pn=document.createElement("img");rn.crossOrigin&&(pn.crossOrigin=rn.crossOrigin!==!0?rn.crossOrigin:"anonymous"),pn.src=on,pn.style.visibility="hidden",pn.style.position="fixed",document.body.appendChild(pn),pn.complete?(un(pn),document.body.removeChild(pn)):(pn.addEventListener("load",function(){un(pn),document.body.removeChild(pn)}),pn.addEventListener("error",function(){dn(null),document.body.removeChild(pn)}))})}function loadImage(on,rn){return rn===void 0&&(rn={}),parseImage(on,__assign(__assign({},rn),{crossOrigin:isCrossOriginURL(on)&&rn.crossOrigin})).then(function(un){return new Promise(function(dn,pn){createImage(un.src,rn).then(function(fn){dn(__assign(__assign({},un),{width:fn.naturalWidth,height:fn.naturalHeight}))}).catch(function(){pn(null)})})})}function getImageStyle(on,rn,un,dn,pn){pn===void 0&&(pn=null);var fn=on.width>on.height?{width:Math.min(512,on.width),height:Math.min(512,on.width)/(on.width/on.height)}:{height:Math.min(512,on.height),width:Math.min(512,on.height)*(on.width/on.height)},hn=getTransformedImageSize(rn),gn={rotate:rn.transforms.rotate,flip:{horizontal:rn.transforms.flip.horizontal,vertical:rn.transforms.flip.vertical},translateX:un.left/dn,translateY:un.top/dn,scale:1/dn},vn={rotate:{left:(fn.width-hn.width)/(2*dn),top:(fn.height-hn.height)/(2*dn)},scale:{left:(1-1/dn)*fn.width/2,top:(1-1/dn)*fn.height/2}},yn=__assign(__assign({},gn),{scale:gn.scale*(on.width/fn.width)}),xn={width:fn.width+"px",height:fn.height+"px",left:"0px",top:"0px",transition:"none",transform:"translate3d("+(-vn.rotate.left-vn.scale.left-gn.translateX)+"px, "+(-vn.rotate.top-vn.scale.top-gn.translateY)+"px, 0px)"+getStyleTransforms(yn),willChange:"none"};return pn&&pn.active&&(xn.willChange="transform",xn.transition=pn.duration+"ms "+pn.timingFunction),xn}function getBackgroundStyle(on,rn,un){return un===void 0&&(un=null),on&&rn&&rn.visibleArea?getImageStyle(on,rn,rn.visibleArea,getCoefficient(rn),un):{}}function getPreviewStyle(on,rn,un,dn){return dn===void 0&&(dn=null),on&&rn&&rn.visibleArea&&rn.coordinates?getImageStyle(on,rn,rn.coordinates,ratio(rn.coordinates)>ratio(un)?rn.coordinates.width/un.width:rn.coordinates.height/un.height,dn):{}}function fixedStencilConstraints(on,rn){var un=defaultStencilConstraints({},rn);return{stencilSize:function(dn,pn){var fn=isFunction(on.stencilSize)?on.stencilSize(dn,pn):on.stencilSize;return approximateSize(__assign(__assign({},fn),{aspectRatio:aspectRatioIntersection(un.aspectRatio,createAspectRatio(ratio(fn)))}))}}}function getStencilSize(on,rn){var un=on.boundary,dn=isFunction(rn.stencilSize)?rn.stencilSize(on,rn):rn.stencilSize;return(dn.width>un.width||dn.height>un.height)&&(dn=approximateSize({sizeRestrictions:{maxWidth:un.width,maxHeight:un.height,minWidth:0,minHeight:0},width:dn.width,height:dn.height,aspectRatio:{minimum:ratio(dn),maximum:ratio(dn)}})),dn}function sizeRestrictions(on,rn){var un=getStencilSize(on,__assign(__assign({},rn),{stencilSize:rn.stencilSize})),dn=getAreaSizeRestrictions(on,rn);return{maxWidth:dn.maxWidth*un.width/on.boundary.width,maxHeight:dn.maxHeight*un.height/on.boundary.height,minWidth:0,minHeight:0}}function defaultSize(on,rn){var un=on.imageSize,dn=on.visibleArea,pn=on.boundary,fn=getSizeRestrictions(on,rn),hn=getAspectRatio(on,rn),gn=isFunction(rn.stencilSize)?rn.stencilSize(on,rn):rn.stencilSize,vn=dn||un,yn,xn;return ratio(vn)>ratio(pn)?(yn=gn.height*vn.height/pn.height,xn=yn*ratio(gn)):(xn=gn.width*vn.width/pn.width,yn=xn/ratio(gn)),approximateSize({width:xn,height:yn,aspectRatio:hn,sizeRestrictions:fn})}function aspectRatio(on,rn){var un=ratio(getStencilSize(on,rn));return{minimum:un,maximum:un}}function fixedStencilAlgorithm(on,rn){if(isInitializedState(on)){var un=copyState(on),dn=getStencilSize(on,rn);un.visibleArea=applyScale(un.visibleArea,un.coordinates.width*un.boundary.width/(un.visibleArea.width*dn.width));var pn=fitToSizeRestrictions(un.visibleArea,getAreaSizeRestrictions(un,rn));return pn!==1&&(un.visibleArea=applyScale(un.visibleArea,pn),un.coordinates=applyScale(un.coordinates,pn)),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(un.coordinates),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn)),un.coordinates=moveToPositionRestrictions(un.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(un.visibleArea),getAreaPositionRestrictions(un,rn))),un}return on}function fixedStencil(on,rn,un){return un&&un.immediately?fixedStencilAlgorithm(on,rn):on}function hybridStencilAutoZoomAlgorithm(on,rn){if(isInitializedState(on)){var un=copyState(on),dn={width:0,height:0};ratio(un.boundary)>ratio(un.coordinates)?(dn.height=un.boundary.height*.8,dn.width=dn.height*ratio(un.coordinates)):(dn.width=un.boundary.width*.8,dn.height=dn.width*ratio(un.coordinates)),un.visibleArea=applyScale(un.visibleArea,un.coordinates.width*un.boundary.width/(un.visibleArea.width*dn.width));var pn=fitToSizeRestrictions(un.visibleArea,getAreaSizeRestrictions(un,rn));return un.visibleArea=applyScale(un.visibleArea,pn),pn!==1&&(dn.height/=pn,dn.width/=pn),un.visibleArea=applyMove(un.visibleArea,diff(getCenter(un.coordinates),getCenter(un.visibleArea))),un.visibleArea=moveToPositionRestrictions(un.visibleArea,getAreaPositionRestrictions(un,rn)),un.coordinates=moveToPositionRestrictions(un.coordinates,mergePositionRestrictions(coordinatesToPositionRestrictions(un.visibleArea),getPositionRestrictions(un,rn))),un}return on}function hybridStencilAutoZoom(on,rn,un){return un.immediately?hybridStencilAutoZoomAlgorithm(on,rn):on}function deprecationWarning(on){process.env.NODE_ENV==="development"&&console.warn("Deprecation warning: ".concat(on))}function useDeprecationWarning(){var on=useRef([]);return function(rn){on.current.indexOf(rn)===-1&&(deprecationWarning(rn),on.current.push(rn))}}function createCropper(on){return forwardRef(on)}function useFirstMountState(){var on=useRef(!0);return on.current?(on.current=!1,!0):on.current}var useUpdateEffect=function(on,rn){var un=useFirstMountState();useEffect(function(){if(!un)return on()},rn)};function useStateWithCallback(on){var rn=__read(useState(on),2),un=rn[0],dn=rn[1],pn=__read(useState(null),2),fn=pn[0],hn=pn[1],gn=useRef(on);return useUpdateEffect(function(){fn&&fn(un,gn.current)},[fn]),[un,function(vn,yn){gn.current=un,dn(vn),hn(function(){return yn})}]}var CropperInstance=function(on){__extends(rn,on);function rn(un,dn){var pn=on.call(this)||this;return pn.props=un,pn.notify=dn,pn.data={state:null,transitions:!1,interactions:getEmptyInteractions()},pn}return rn.prototype.getProps=function(){return this.props()},rn.prototype.setData=function(un){this.data=un,this.notify()},rn.prototype.getData=function(){return this.data},rn}(AbstractCropperInstance);function useForceRerender(){var on=__read(useState({}),2);on[0];var rn=on[1];return function(){rn({})}}function usePersistentFunction(on){var rn=useRef(on);return rn.current=on,function(){for(var un=[],dn=0;dn<arguments.length;dn++)un[dn]=arguments[dn];return rn.current.apply(rn,__spreadArray([],__read(un),!1))}}function useCropperInstance(on){var rn=useForceRerender(),un=usePersistentFunction(function(){var pn=on(),fn=pn.settings,hn=__rest(pn,["settings"]),gn=__assign({imageRestriction:ImageRestriction.fitArea,transformImage:{adjustStencil:!0}},fn),vn=__assign({transitions:!0},hn);return __assign({settings:__assign(__assign({},gn),createDefaultSettings(gn))},vn)}),dn=useRef(new CropperInstance(un,rn));return dn.current}function useCropperImage(on){var rn=on.src,un=on.onLoadingStart,dn=on.onLoadingEnd,pn=on.onError,fn=on.onLoad,hn=on.crossOrigin,gn=on.checkOrientation,vn=on.canvas,yn=on.unloadTime,xn=__read(useState(null),2),wn=xn[0],Cn=xn[1],Tn=__read(useState(!1),2),Pn=Tn[0],Sn=Tn[1],En=__read(useStateWithCallback(!1),2),_n=En[0],Rn=En[1],$n=useRef(null);return useEffect(function(){if($n.current!==rn)if($n.current=rn||null,Rn(!1),rn){Sn(!0),un?.();var Mn=[loadImage(rn,{crossOrigin:isUndefined(hn)?vn:hn,checkOrientation:gn})];_n&&yn&&Mn.push(promiseTimeout(yn)),Promise.all(Mn).then(function(An){var Dn=__read(An,1),On=Dn[0];$n.current===rn&&Cn(On)}).catch(function(){$n.current===rn&&pn?.()}).finally(function(){$n.current===rn&&(dn?.(),Sn(!1))})}else yn?promiseTimeout(yn).then(function(){$n.current===rn&&Cn(null)}):Cn(null)},[rn,wn]),useEffect(function(){wn&&Rn(!0,function(){fn?.(wn)})},[wn]),{isLoading:function(){return Pn},isLoaded:function(){return _n},getImage:function(){return wn},setImage:Cn}}var useWindowResize=function(on){var rn=useRef(on),un=function(){rn.current&&rn.current()};useEffect(function(){rn.current=on},[on]),useEffect(function(){return window.addEventListener("resize",un),window.addEventListener("orientationchange",un),function(){window.removeEventListener("resize",un),window.removeEventListener("orientationchange",un)}},[])};function useCropperAutoReconcile(on,rn){rn===void 0&&(rn=!0);var un=__read(useState(rn),2),dn=un[0],pn=un[1];return useLayoutEffect$2(function(){dn&&!on.hasInteractions()&&on.reconcileState()}),{pause:function(){pn(!1)},resume:function(){pn(!0)}}}function useAbstractCropper(on){var rn=this,un=on(),dn=un.src,pn=un.onReady,fn=un.onError,hn=un.onUpdate,gn=un.canvas,vn=gn===void 0?!0:gn,yn=un.unloadTime,xn=yn===void 0?500:yn,wn=un.crossOrigin,Cn=wn===void 0?!0:wn,Tn=un.checkOrientation,Pn=Tn===void 0?!0:Tn,Sn=un.autoReconcileState,En=Sn===void 0?!0:Sn,_n=useRef(null),Rn=useRef(null),$n=useRef(null),Mn=useRef(null),An=__read(useStateWithCallback(null),2),Dn=An[0],On=An[1],In=useCropperInstance(function(){return __assign(__assign({},on()),{getInstance:function(){return Mn.current}})}),Nn=useCropperImage({src:dn,crossOrigin:Cn,checkOrientation:Pn,unloadTime:xn,canvas:vn,onError:function(){Mn.current&&fn?.(Mn.current)}}),jn=useCropperAutoReconcile(In,En),Ln=function(){return __awaiter(rn,void 0,void 0,function(){var Vn,Yn,Gn;return __generator(this,function(Wn){switch(Wn.label){case 0:return Rn.current?(jn.pause(),Vn=Nn.getImage(),[4,(Gn=Rn.current)===null||Gn===void 0?void 0:Gn.stretchTo(Vn)]):[3,2];case 1:Yn=Wn.sent(),On(Vn,function(){Yn&&Vn?In.reset(Yn,Vn):In.clear()}),jn.resume(),Wn.label=2;case 2:return[2]}})})},Un=function(){return __awaiter(rn,void 0,void 0,function(){var Vn,Yn,Gn,Wn;return __generator(this,function(Fn){switch(Fn.label){case 0:return Rn.current?(jn.pause(),Vn=Nn.getImage(),[4,(Wn=Rn.current)===null||Wn===void 0?void 0:Wn.stretchTo(Vn)]):[3,2];case 1:Yn=Fn.sent(),Yn&&Vn?(Gn=In.getState(),Gn?(Yn.width!==Gn.boundary.width||Yn.height!==Gn.boundary.height)&&(In.setBoundary(Yn),In.reconcileState()):In.reset(Yn,Vn)):In.clear(),jn.resume(),Fn.label=2;case 2:return[2]}})})},Hn={reset:function(){return Ln()},refresh:function(){return Un()},setImage:function(Vn){return On(Vn)},reconcileState:In.reconcileState,moveCoordinates:In.moveCoordinates,moveCoordinatesEnd:In.moveCoordinatesEnd,resizeCoordinates:In.resizeCoordinates,clear:In.clear,resizeCoordinatesEnd:In.resizeCoordinatesEnd,moveImage:In.moveImage,flipImage:In.flipImage,zoomImage:In.zoomImage,rotateImage:In.rotateImage,transformImage:In.transformImage,transformImageEnd:In.transformImageEnd,setCoordinates:In.setCoordinates,setVisibleArea:In.setVisibleArea,startTransitions:In.startTransitions,setState:In.setState,hasInteractions:In.hasInteractions,getStencilCoordinates:In.getStencilCoordinates,getCoordinates:In.getCoordinates,getVisibleArea:In.getVisibleArea,getTransforms:In.getTransforms,getTransitions:In.getTransitions,getInteractions:In.getInteractions,getSettings:In.getSettings,getState:In.getState,getDefaultState:function(){var Vn=In.getState(),Yn=Nn.getImage();return Vn&&Yn?In.createDefaultState(Vn.boundary,Yn):null},getCanvas:function(Vn){var Yn=In.getState();return _n.current&&$n.current&&Yn?$n.current.draw(Yn,_n.current,Vn):null},getImage:function(){return Dn?__assign({},Dn):null},isLoading:Nn.isLoading,isLoaded:Nn.isLoaded};return useWindowResize(function(){Un()}),useUpdateEffect(function(){Ln()},[Nn.getImage()]),useUpdateEffect(function(){Mn.current&&Dn&&pn?.(Mn.current)},[Dn]),useUpdateEffect(function(){Mn.current&&hn?.(Mn.current)},[Nn.isLoaded(),Nn.isLoading()]),useImperativeHandle(Mn,function(){return Hn}),{cropper:Hn,refs:{image:_n,boundary:Rn,canvas:$n},image:Dn}}var StretchableBoundary=forwardRef(function(on,rn){var un=on.className,dn=on.style,pn=on.stretcherClassName,fn=on.contentClassName,hn=on.stretchAlgorithm,gn=hn===void 0?stretchCropperBoundary:hn,vn=on.sizeAlgorithm,yn=vn===void 0?fillBoundary:vn,xn=on.children,wn=useRef(null),Cn=useRef(null);return useImperativeHandle(rn,function(){return{reset:function(){var Tn=wn.current;Tn&&(Tn.style.height="",Tn.style.width="")},stretchTo:function(Tn){var Pn=wn.current,Sn=Cn.current;if(Tn?.width&&Tn?.height&&Pn&&Sn){gn(Sn,Pn,Tn);var En=yn(Sn,Tn);return Promise.resolve(En.width&&En.height?En:null)}else return Pn&&(Pn.style.height="",Pn.style.width=""),Promise.resolve(null)}}}),React__default.createElement("div",{ref:Cn,style:dn,className:cn("advanced-cropper-boundary",un)},React__default.createElement("div",{ref:wn,className:cn(["advanced-cropper-boundary__stretcher",pn])}),React__default.createElement("div",{className:cn(["advanced-cropper-boundary__content",fn])},xn))});StretchableBoundary.displayName="StretchableBoundary";var CropperFade=function(on){var rn=on.visible,un=on.className,dn=on.style,pn=on.children;return React__default.createElement("div",{style:dn,className:cn(un,"advanced-cropper-fade",!!rn&&"advanced-cropper-fade--visible")},pn)},CropperWrapper=function(on){var rn=on.cropper,un=on.children,dn=on.className,pn=on.style,fn=rn?rn.getState():null,hn=rn?rn.isLoaded():!1;return React__default.createElement("div",{className:cn(dn,"advanced-cropper-wrapper"),style:pn},React__default.createElement(CropperFade,{visible:fn&&hn,className:"advanced-cropper-wrapper__fade"},un))};function preventDefault(on){on.preventDefault()}var CropperBackgroundImage=forwardRef(function(on,rn){var un=on.className,dn=on.style,pn=on.cropper,fn=on.crossOrigin,hn=fn===void 0?!0:fn,gn=pn.getState(),vn=pn.getTransitions(),yn=pn.getImage(),xn=yn&&gn?getBackgroundStyle(yn,gn,vn):{},wn=yn?yn.src:void 0;return wn?React__default.createElement("img",{key:wn,ref:rn,className:cn("advanced-cropper-background-image",un),src:wn,crossOrigin:hn===!0?"anonymous":hn||void 0,style:__assign(__assign({},xn),dn),onMouseDown:preventDefault}):null});CropperBackgroundImage.displayName="CropperBackgroundImage";var CropperCanvas=forwardRef(function(on,rn){var un=useRef(null),dn=useRef(null);return useImperativeHandle(rn,function(){return{draw:function(pn,fn,hn){return hn===void 0&&(hn={}),fn&&un.current&&dn.current?drawCroppedArea(pn,fn,un.current,dn.current,hn):null}}}),React__default.createElement(React__default.Fragment,null,React__default.createElement("canvas",{className:"advanced-cropper-canvas",ref:un}),React__default.createElement("canvas",{className:"advanced-cropper-canvas",ref:dn}))});CropperCanvas.displayName="CropperCanvas";var DraggableElement=function(on){__extends(rn,on);function rn(un){var dn=on.call(this,un)||this;return dn.processMove=function(pn,fn){var hn,gn=dn.container.current;if(gn&&dn.touches.length){var vn=gn.getBoundingClientRect(),yn=vn.left,xn=vn.top;if(dn.touches.length===1&&fn.length===1&&dn.props.onMove){var wn={left:Math.abs(fn[0].clientX-dn.anchor.left-yn)<Math.abs(dn.touches[0].clientX-dn.anchor.left-yn),top:Math.abs(fn[0].clientY-dn.anchor.top-xn)<Math.abs(dn.touches[0].clientY-dn.anchor.top-xn)},Cn={left:0,top:0};(!dn.props.useAnchor||!wn.left)&&(Cn.left=fn[0].clientX-dn.touches[0].clientX),(!dn.props.useAnchor||!wn.top)&&(Cn.top=fn[0].clientY-dn.touches[0].clientY),(hn=dn.props)===null||hn===void 0||hn.onMove(Cn,pn),dn.touches=__spreadArray([],__read(fn),!1)}}},dn.processEnd=function(){var pn=dn.props,fn=pn.onMoveEnd,hn=pn.onLeave;!dn.props.disabled&&dn.touches.length&&fn?.(),dn.hovered&&(hn?.(),dn.hovered=!1),dn.touches=[]},dn.initAnchor=function(pn){var fn=dn.container.current;if(fn){var hn=fn.getBoundingClientRect(),gn=hn.left,vn=hn.top;dn.anchor={left:pn.clientX-gn,top:pn.clientY-vn}}},dn.onMouseOver=function(){var pn=dn.props,fn=pn.onEnter,hn=pn.disabled;!dn.hovered&&!hn&&(dn.hovered=!0,fn?.())},dn.onMouseLeave=function(){var pn=dn.props.onLeave;dn.hovered&&!dn.touches.length&&(dn.hovered=!1,pn?.())},dn.onTouchStart=function(pn){var fn=dn.props,hn=fn.onEnter,gn=fn.onMoveStart,vn=fn.disabled;if(pn.cancelable){dn.touches=Array.from(pn.touches);var yn=!vn&&pn.touches.length===1;yn&&(dn.touches=Array.from(pn.touches),gn?.()),!dn.hovered&&!vn&&(dn.hovered=!0,hn?.()),(dn.started||yn)&&(pn.preventDefault(),pn.stopPropagation())}},dn.onTouchEnd=function(){dn.started=!1,dn.processEnd()},dn.onTouchMove=function(pn){dn.touches.length>=1&&(dn.started?(dn.processMove(pn,Array.from(pn.touches)),pn.preventDefault(),pn.stopPropagation()):distance({left:dn.touches[0].clientX,top:dn.touches[0].clientY},{left:pn.touches[0].clientX,top:pn.touches[0].clientY})>(dn.props.activationDistance||0)&&(dn.initAnchor({clientX:pn.touches[0].clientX,clientY:pn.touches[0].clientY}),dn.started=!0))},dn.onMouseDown=function(pn){var fn=dn.props,hn=fn.onMoveStart,gn=fn.disabled;if(!gn&&pn.button===0){var vn={clientX:pn.clientX,clientY:pn.clientY};dn.touches=[vn],dn.initAnchor(vn),pn.stopPropagation(),hn?.()}},dn.onMouseMove=function(pn){!dn.props.disabled&&dn.touches.length&&(dn.processMove(pn,[{clientX:pn.clientX,clientY:pn.clientY}]),pn.preventDefault&&pn.cancelable&&pn.preventDefault(),pn.stopPropagation())},dn.onMouseUp=function(){dn.processEnd()},dn.touches=[],dn.hovered=!1,dn.started=!1,dn.anchor={left:0,top:0},dn.container=createRef(),dn}return rn.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var un=this.container.current;un&&(un.removeEventListener("touchstart",this.onTouchStart),un.removeEventListener("mousedown",this.onMouseDown))},rn.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var un=this.container.current;un&&(un.addEventListener("touchstart",this.onTouchStart,{passive:!1}),un.addEventListener("mousedown",this.onMouseDown,{passive:!1}))},rn.prototype.componentDidUpdate=function(un){this.props.disabled&&!un.disabled&&(this.touches=[])},rn.prototype.render=function(){var un=this.props,dn=un.children,pn=un.className;return React__default.createElement("div",{className:cn("advanced-cropper-draggable-element",pn),ref:this.container,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},dn)},rn.defaultProps={disabled:!1,activationDistance:30,useAnchor:!0,rerender:!0},rn}(Component$1),LineWrapper=function(on){var rn=on.position,un=on.className,dn=on.disabled,pn=on.onDrag,fn=on.onDragEnd,hn=on.onLeave,gn=on.onEnter,vn=on.children;return React__default.createElement(DraggableElement,{className:cn(["advanced-cropper-line-wrapper",rn&&"advanced-cropper-line-wrapper--".concat(rn),dn&&"advanced-cropper-line-wrapper--disabled",un]),disabled:dn,onMove:pn,onMoveEnd:fn,onLeave:hn,onEnter:gn,activationDistance:0},React__default.createElement("div",{className:cn(["advanced-cropper-line-wrapper__content",rn&&"advanced-cropper-line-wrapper__content--".concat(rn)])},vn))},SimpleLine=function(on){var rn,un,dn=on.position,pn=on.hoverClassName,fn=on.wrapperClassName,hn=on.defaultClassName,gn=on.disabled,vn=on.onMove,yn=on.onMoveEnd,xn=__read(useState(!1),2),wn=xn[0],Cn=xn[1],Tn=function(){Cn(!0)},Pn=function(){Cn(!1)};return React__default.createElement(LineWrapper,{className:cn("advanced-cropper-simple-line-wrapper",fn,(rn={},rn["advanced-cropper-simple-line-wrapper--".concat(dn)]=!!dn,rn)),position:dn,disabled:gn,onDrag:vn,onDragEnd:yn,onLeave:Pn,onEnter:Tn},React__default.createElement("div",{className:cn("advanced-cropper-simple-line",wn&&"advanced-cropper-simple-line--hover",hn,wn&&pn,(un={},un["advanced-cropper-simple-line--".concat(dn)]=!!dn,un))}))},HandlerWrapper=function(on){var rn=on.horizontalPosition,un=on.verticalPosition,dn=on.className,pn=on.disabled,fn=on.onDrag,hn=on.onDragEnd,gn=on.onLeave,vn=on.onEnter,yn=on.children,xn=on.style,wn=rn||un?getDirectionNames(rn,un).snakeCase:null;return React__default.createElement("div",{style:xn,className:cn(dn,"advanced-cropper-handler-wrapper",wn&&"advanced-cropper-handler-wrapper--".concat(wn),pn&&"advanced-cropper-handler-wrapper--disabled")},React__default.createElement(DraggableElement,{className:"advanced-cropper-handler-wrapper__draggable",disabled:pn,onMove:fn,onMoveEnd:hn,onLeave:gn,onEnter:vn,activationDistance:0},yn))},SimpleHandler=function(on){var rn,un=on.verticalPosition,dn=on.horizontalPosition,pn=on.hoverClassName,fn=on.wrapperClassName,hn=on.defaultClassName,gn=on.wrapperStyle,vn=on.disabled,yn=on.onMove,xn=on.onMoveEnd,wn=__read(useState(!1),2),Cn=wn[0],Tn=wn[1],Pn=function(){Tn(!0)},Sn=function(){Tn(!1)};return React__default.createElement(HandlerWrapper,{style:gn,className:cn("advanced-cropper-simple-handler-wrapper",fn,un&&"advanced-cropper-simple-handler-wrapper--".concat(un),dn&&"advanced-cropper-simple-handler-wrapper--".concat(dn),dn&&un&&"advanced-cropper-simple-handler-wrapper--".concat(dn,"-").concat(un),Cn&&"advanced-cropper-simple-handler-wrapper--hover"),verticalPosition:un,horizontalPosition:dn,disabled:vn,onDrag:yn,onDragEnd:xn,onLeave:Sn,onEnter:Pn},React__default.createElement("div",{className:cn("advanced-cropper-simple-handler",Cn&&"advanced-cropper-simple-handler--hover",hn,Cn&&pn,(rn={},rn["advanced-cropper-simple-handler--".concat(un)]=!!un,rn["advanced-cropper-simple-handler--".concat(dn)]=!!dn,rn["advanced-cropper-simple-handler--".concat(dn,"-").concat(un)]=dn&&un,rn))}))},HORIZONTAL_DIRECTIONS=["east","west",null],VERTICAL_DIRECTIONS=["south","north",null],BoundingBox=function(on){var rn=on.style,un=on.className,dn=on.children,pn=on.onResize,fn=on.onResizeEnd,hn=on.handlerComponent,gn=hn===void 0?SimpleHandler:hn,vn=on.handlers,yn=vn===void 0?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:vn,xn=on.handlerClassNames,wn=xn===void 0?{}:xn,Cn=on.handlerWrapperClassNames,Tn=Cn===void 0?{}:Cn,Pn=on.lines,Sn=Pn===void 0?{west:!0,north:!0,east:!0,south:!0}:Pn,En=on.lineComponent,_n=En===void 0?SimpleLine:En,Rn=on.lineClassNames,$n=Rn===void 0?{}:Rn,Mn=on.lineWrapperClassNames,An=Mn===void 0?{}:Mn,Dn=on.disabled,On=Dn===void 0?!1:Dn,In=on.reference,Nn=In===void 0?null:In,jn=__read(useState(null),2),Ln=jn[0],Un=jn[1],Hn=useMemo$1(function(){var Fn=[];return HORIZONTAL_DIRECTIONS.forEach(function(Bn){VERTICAL_DIRECTIONS.forEach(function(zn){if(Bn!==zn){var Kn=getDirectionNames(Bn,zn),Jn=Kn.snakeCase,rr=Kn.camelCase;Jn&&rr&&Fn.push({name:rr,className:Jn,verticalPosition:zn,horizontalPosition:Bn})}})}),Fn},[]),Vn=useMemo$1(function(){var Fn=[];return Hn.forEach(function(Bn){isCardinalDirection(Bn.name)&&(isObject(Sn)?Sn[Bn.name]:Sn)&&Fn.push({name:Bn.name,component:_n,className:cn($n.default,$n[Bn.name],On&&$n.disabled),wrapperClassName:cn("advanced-cropper-bounding-box__line","advanced-cropper-bounding-box__line--".concat(Bn.name),An.default,An[Bn.name],On&&An.disabled),hoverClassName:$n.hover,verticalPosition:Bn.verticalPosition,horizontalPosition:Bn.horizontalPosition,disabled:On})}),Fn},[Hn,Sn,_n,$n,An,On]),Yn=useMemo$1(function(){var Fn=[];return Hn.forEach(function(Bn){(isObject(yn)?yn[Bn.name]:yn)&&Fn.push({name:Bn.name,component:gn,className:cn(wn.default,wn[Bn.name]),containerClassName:cn("advanced-cropper-bounding-box__handler-wrapper","advanced-cropper-bounding-box__handler-wrapper--".concat(Bn.className)),wrapperClassName:cn("advanced-cropper-bounding-box__handler","advanced-cropper-bounding-box__handler--".concat(Bn.className),Tn.default,Tn[Bn.name]),hoverClassName:wn.hover,verticalPosition:Bn.verticalPosition,horizontalPosition:Bn.horizontalPosition,disabled:On})}),Fn},[Hn,yn,gn,wn,Tn,On]),Gn=function(Fn,Bn){return function(zn,Kn){var Jn=zn.left,rr=zn.top,er={left:Jn,top:rr},Qn;if(!Bn&&Fn?Qn="width":Bn&&!Fn&&(Qn="height"),!On){if(pn){var Xn=getDirectionNames(Fn,Bn).camelCase;Xn&&pn(Xn,er,{reference:Ln||Nn,preserveAspectRatio:Kn&&Kn.shiftKey,respectDirection:Qn,compensate:!0})}Ln||Un(Nn)}}},Wn=function(){fn?.(),Un(null)};return React__default.createElement("div",{className:cn("advanced-cropper-bounding-box",un),style:rn},dn,React__default.createElement("div",null,Vn.map(function(Fn){return React__default.createElement(Fn.component,{key:Fn.name,defaultClassName:Fn.className,hoverClassName:Fn.hoverClassName,wrapperClassName:Fn.wrapperClassName,position:Fn.name,disabled:Fn.disabled,onMove:Gn(Fn.horizontalPosition,Fn.verticalPosition),onMoveEnd:Wn})})),React__default.createElement("div",null,Yn.map(function(Fn){var Bn=React__default.createElement(Fn.component,{defaultClassName:Fn.className,hoverClassName:Fn.hoverClassName,wrapperClassName:Fn.wrapperClassName,horizontalPosition:Fn.horizontalPosition,verticalPosition:Fn.verticalPosition,disabled:Fn.disabled,onMove:Gn(Fn.horizontalPosition,Fn.verticalPosition),onMoveEnd:Wn});return React__default.createElement("div",{key:Fn.name,className:Fn.containerClassName},Bn)})))},StencilOverlay=function(on){var rn=on.className,un=on.children;return React__default.createElement("div",{className:cn("advanced-cropper-stencil-overlay",rn)},un)};function useTransition(on){on===void 0&&(on=null);var rn=useRef(new Animation),un=__read(useState(!1),2),dn=un[0],pn=un[1];return[function(fn){on&&on.active?rn.current.start(__assign(__assign({},on),{onStart:function(){pn(!0)},onProgress:function(hn){fn(hn)},onStop:function(){pn(!1)}})):rn.current.active||fn(1)},dn]}var ArtificialTransition=function(on){var rn=on.className,un=on.transitions,dn=on.children,pn=__rest(on,["className","transitions","children"]),fn=useRef(null),hn=useRef(pn),gn=__read(useState(pn),2),vn=gn[0],yn=gn[1],xn=__read(useTransition(un),2),wn=xn[0],Cn=xn[1];useLayoutEffect$2(function(){if(!deepCompare(vn,pn)){yn(pn);var Sn=Cn?__assign({},hn.current):vn;wn(function(En){var _n=["left","top","height","width"];_n.forEach(function(Rn){var $n=pn[Rn],Mn=Sn[Rn];hn.current[Rn]=isNumber(Mn)&&isNumber($n)?Mn+($n-Mn)*En:$n}),fn.current&&(fn.current.style.width="".concat(hn.current.width,"px"),fn.current.style.height="".concat(hn.current.height,"px"),fn.current.style.transform="translate3d(".concat(hn.current.left,"px, ").concat(hn.current.top,"px, 0px)"))})}},[vn,Cn,pn.width,pn.height,pn.top,pn.left]);var Tn=Cn?hn.current:pn,Pn={left:0,top:0,width:"".concat(Tn.width,"px"),height:"".concat(Tn.height,"px"),transform:"translate3d(".concat(Tn.left,"px, ").concat(Tn.top,"px, 0px)")};return React__default.createElement("div",{ref:fn,className:cn("advanced-cropper-artificial-transition",rn),style:Pn},dn)},StencilWrapper=function(on){var rn=on.className,un=on.transitions,dn=on.width,pn=on.height,fn=on.left,hn=on.top,gn=on.children;return React__default.createElement(ArtificialTransition,{className:cn("advanced-cropper-stencil-wrapper",rn),transitions:un,width:dn,height:pn,top:hn,left:fn},gn)},StencilGrid=function(on){var rn=on.columns,un=rn===void 0?3:rn,dn=on.rows,pn=dn===void 0?3:dn,fn=on.visible,hn=fn===void 0?!1:fn,gn=on.className,vn=[],yn=__read(useState(un),2),xn=yn[0],wn=yn[1],Cn=__read(useState(pn),2),Tn=Cn[0],Pn=Cn[1];useUpdateEffect(function(){hn&&(Pn(pn),wn(un))},[hn,un,pn]);for(var Sn=0;Sn<Tn;Sn++){for(var En=[],_n=0;_n<xn;_n++)En.push(React__default.createElement("div",{key:_n,className:cn("advanced-cropper-stencil-grid__cell",Sn===0&&"advanced-cropper-stencil-grid__cell--top",Sn===Tn-1&&"advanced-cropper-stencil-grid__cell--bottom",_n===0&&"advanced-cropper-stencil-grid__cell--left",_n===xn-1&&"advanced-cropper-stencil-grid__cell--right")}));vn.push(React__default.createElement("div",{key:Sn,className:"advanced-cropper-stencil-grid__row"},En))}return React__default.createElement("div",{className:cn("advanced-cropper-stencil-grid",hn&&"advanced-cropper-stencil-grid--visible",gn)},vn)},RectangleStencil=forwardRef(function(on,rn){var un=on.cropper,dn=on.coordinates,pn=on.aspectRatio,fn=on.minAspectRatio,hn=on.maxAspectRatio,gn=on.handlerComponent,vn=gn===void 0?SimpleHandler:gn,yn=on.handlers,xn=yn===void 0?{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}:yn,wn=on.handlerClassNames,Cn=wn===void 0?{}:wn,Tn=on.handlerWrapperClassNames,Pn=Tn===void 0?{}:Tn,Sn=on.lines,En=Sn===void 0?{west:!0,north:!0,east:!0,south:!0}:Sn,_n=on.lineComponent,Rn=_n===void 0?SimpleLine:_n,$n=on.lineClassNames,Mn=$n===void 0?{}:$n,An=on.lineWrapperClassNames,Dn=An===void 0?{}:An,On=on.resizable,In=On===void 0?!0:On,Nn=on.movable,jn=Nn===void 0?!0:Nn,Ln=on.grid,Un=on.gridClassName,Hn=on.className,Vn=on.movingClassName,Yn=on.resizingClassName,Gn=on.previewClassName,Wn=on.boundingBoxClassName,Fn=on.overlayClassName,Bn=on.draggableAreaClassName,zn=on.disabled,Kn=un.getState(),Jn=un.getTransitions(),rr=un.getInteractions(),er=In&&!zn,Qn=jn&&!zn;useImperativeHandle(rn,function(){return{aspectRatio:createAspectRatio(pn||{minimum:fn,maximum:hn})}});var Xn=function(Rr){un&&Qn&&un.moveCoordinates(Rr)},Zn=function(){un&&un.moveCoordinatesEnd()},cr=function(Rr,Ar,$r){un&&er&&un.resizeCoordinates(Rr,Ar,$r)},vr=function(){un&&un.resizeCoordinatesEnd()},xr=dn?isFunction(dn)?dn(Kn):dn:getStencilCoordinates(Kn),yr=xr.width,pr=xr.height,Tr=xr.left,kr=xr.top;return Kn&&React__default.createElement(StencilWrapper,{className:cn("advanced-cropper-rectangle-stencil",Hn,rr.moveCoordinates&&Vn,rr.resizeCoordinates&&Yn,{"advanced-cropper-rectangle-stencil--movable":Qn,"advanced-cropper-rectangle-stencil--moving":rr.moveCoordinates,"advanced-cropper-rectangle-stencil--resizable":er,"advanced-cropper-rectangle-stencil--resizing":rr.resizeCoordinates,"advanced-cropper-rectangle-stencil--disabled":zn}),width:yr,height:pr,left:Tr,top:kr,transitions:Jn},React__default.createElement(BoundingBox,{reference:Kn.coordinates,className:cn(Wn,"advanced-cropper-rectangle-stencil__bounding-box"),handlers:xn,handlerComponent:vn,handlerClassNames:Cn,handlerWrapperClassNames:Pn,lines:En,lineComponent:Rn,lineClassNames:Mn,lineWrapperClassNames:Dn,onResize:cr,onResizeEnd:vr,disabled:!er},React__default.createElement(DraggableElement,{disabled:!Qn,onMove:Xn,onMoveEnd:Zn,className:cn("advanced-cropper-rectangle-stencil__draggable-area",Bn)},React__default.createElement(StencilOverlay,{className:cn("advanced-cropper-rectangle-stencil__overlay",Fn)},Ln&&React__default.createElement(StencilGrid,{visible:un.hasInteractions(),columns:rr.transformImage.rotate?9:3,rows:rr.transformImage.rotate?9:3,className:cn("advanced-cropper-rectangle-stencil__grid",Un)}),React__default.createElement("div",{className:cn("advanced-cropper-rectangle-stencil__preview",Gn)})))))});RectangleStencil.displayName="RectangleStencil";function useRotateImageOptions(on){return useMemo$1(function(){return getOptions(on,{touch:!0},{touch:!1})},[on])}function useScaleImageOptions(on){return useMemo$1(function(){return getOptions(on,{touch:!0,wheel:{ratio:.1}},{touch:!1,wheel:!1})},[on])}function useMoveImageOptions(on){return useMemo$1(function(){return getOptions(on,{touch:!0,mouse:!0},{touch:!1,mouse:!1})},[on])}var TransformableImageEvent=function(){function on(rn){var un=rn.active;this.active=un,this.defaultPrevented=!1}return on.prototype.preventDefault=function(){this.defaultPrevented=!0},on}(),TransformableImage=function(on){__extends(rn,on);function rn(un){var dn=on.call(this,un)||this;return dn.processMove=function(pn){var fn=dn.props,hn=fn.onTransform,gn=fn.touchScale,vn=fn.touchMove,yn=fn.touchRotate,xn=dn.container.current;xn&&hn&&(hn(touchesToImageTransform(pn,dn.touches,xn,{scale:gn,rotate:yn,move:vn})),dn.touches=pn)},dn.processEnd=function(){var pn=dn.props.onTransformEnd;dn.transforming&&(dn.transforming=!1,pn&&pn())},dn.processStart=function(){dn.transforming=!0,dn.debouncedProcessEnd.clear()},dn.processEvent=function(pn){var fn=dn.props,hn=fn.onEvent,gn=fn.disabled,vn=fn.preventDefault,yn=vn===void 0?!0:vn,xn=new TransformableImageEvent({active:dn.transforming});return hn?hn(xn,pn):yn&&(pn.preventDefault(),pn.stopPropagation()),!gn&&!xn.defaultPrevented},dn.onWheel=function(pn){var fn=dn.props,hn=fn.onTransform,gn=fn.wheelScale,vn=dn.container.current;gn&&dn.processEvent(pn)&&(dn.processStart(),hn&&vn&&hn(wheelEventToImageTransform(pn,vn,gn===!0?.1:gn.ratio)),dn.touches.length||dn.debouncedProcessEnd())},dn.onTouchStart=function(pn){var fn=dn.props,hn=fn.touchMove,gn=fn.touchScale,vn=fn.touchRotate;if(pn.cancelable&&(hn||(gn||vn)&&pn.touches.length>1)&&dn.processEvent(pn)){var yn=dn.container.current;if(yn){var xn=yn.getBoundingClientRect(),wn=xn.left,Cn=xn.top,Tn=xn.bottom,Pn=xn.right;dn.touches=Array.from(pn.touches).filter(function(Sn){return Sn.clientX>wn&&Sn.clientX<Pn&&Sn.clientY>Cn&&Sn.clientY<Tn})}}},dn.onTouchEnd=function(pn){pn.touches.length===0&&(dn.touches=[],dn.processEnd())},dn.onTouchMove=function(pn){if(dn.touches.length){var fn=__spreadArray([],__read(pn.touches),!1).filter(function(hn){return!hn.identifier||dn.touches.find(function(gn){return gn.identifier===hn.identifier})});dn.processEvent(pn)&&(dn.processMove(fn),dn.processStart())}},dn.onMouseDown=function(pn){var fn=dn.props.mouseMove;if(fn&&"buttons"in pn&&pn.buttons===1&&dn.processEvent(pn)){var hn={clientX:pn.clientX,clientY:pn.clientY};dn.touches=[hn],dn.processStart()}},dn.onMouseMove=function(pn){dn.touches.length&&dn.processEvent(pn)&&dn.processMove([{clientX:pn.clientX,clientY:pn.clientY}])},dn.onMouseUp=function(){dn.touches=[],dn.processEnd()},dn.transforming=!1,dn.touches=[],dn.anchor={left:0,top:0},dn.container=createRef(),dn.debouncedProcessEnd=debounce(dn.processEnd,un.timeout),dn}return rn.prototype.shouldComponentUpdate=function(){return!0},rn.prototype.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd);var un=this.container.current;un&&(un.removeEventListener("touchstart",this.onTouchStart),un.removeEventListener("mousedown",this.onMouseDown),un.removeEventListener("wheel",this.onWheel))},rn.prototype.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1});var un=this.container.current;un&&(un.addEventListener("touchstart",this.onTouchStart,{passive:!1}),un.addEventListener("mousedown",this.onMouseDown,{passive:!1}),un.addEventListener("wheel",this.onWheel,{passive:!1}))},rn.prototype.render=function(){var un=this.props,dn=un.className,pn=un.children,fn=un.style;return React__default.createElement("div",{className:dn,style:fn,ref:this.container},pn)},rn.defaultProps={touchMove:!0,mouseMove:!0,touchScale:!0,touchRotate:!1,wheelScale:!0,timeout:500},rn}(Component$1),CropperBackgroundWrapper=function(on){var rn=on.scaleImage,un=rn===void 0?!0:rn,dn=on.moveImage,pn=dn===void 0?!0:dn,fn=on.rotateImage,hn=fn===void 0?!1:fn,gn=on.children,vn=on.className,yn=on.style,xn=on.cropper,wn=on.timeout,Cn=on.disabled,Tn=xn.getTransitions(),Pn=useRotateImageOptions(hn),Sn=useScaleImageOptions(un),En=useMoveImageOptions(pn);return React__default.createElement(TransformableImage,{className:vn,style:yn,onTransform:xn.transformImage,onTransformEnd:xn.transformImageEnd,touchMove:En.touch,mouseMove:En.mouse,touchScale:Sn.touch,wheelScale:Sn.wheel,touchRotate:Pn.touch,disabled:Tn.active||Cn,preventDefault:!Cn,timeout:wn},gn)},AbstractCropperComponent=function(on,rn){var un=on.style,dn=on.className,pn=on.stencilComponent,fn=pn===void 0?RectangleStencil:pn,hn=on.stencilConstraints,gn=hn===void 0?defaultStencilConstraints:hn,vn=on.stencilProps,yn=vn===void 0?{}:vn,xn=on.wrapperComponent,wn=xn===void 0?CropperWrapper:xn,Cn=on.wrapperProps,Tn=Cn===void 0?{}:Cn,Pn=on.backgroundComponent,Sn=Pn===void 0?CropperBackgroundImage:Pn,En=on.backgroundProps,_n=En===void 0?{}:En,Rn=on.backgroundClassName,$n=on.backgroundWrapperComponent,Mn=$n===void 0?CropperBackgroundWrapper:$n,An=on.backgroundWrapperProps,Dn=An===void 0?{}:An,On=on.boundaryComponent,In=On===void 0?StretchableBoundary:On,Nn=on.boundaryProps,jn=on.boundaryClassName,Ln=on.canvas,Un=Ln===void 0?!0:Ln,Hn=on.crossOrigin,Vn=Hn===void 0?!0:Hn,Yn=on.disabled,Gn=on.settings,Wn=__rest(on,["style","className","stencilComponent","stencilConstraints","stencilProps","wrapperComponent","wrapperProps","backgroundComponent","backgroundProps","backgroundClassName","backgroundWrapperComponent","backgroundWrapperProps","boundaryComponent","boundaryProps","boundaryClassName","canvas","crossOrigin","disabled","settings"]),Fn=useRef(null),Bn=useAbstractCropper(function(){return __assign(__assign({},Wn),{crossOrigin:Vn,stencilProps:yn,canvas:Un,settings:__assign(__assign({},Gn),gn(Gn,__assign(__assign({},yn),Fn.current)))})}),zn=Bn.cropper,Kn=Bn.image,Jn=Bn.refs,rr=fn,er=wn,Qn=Mn,Xn=Sn,Zn=In;useImperativeHandle(rn,function(){return zn});var cr={loading:zn.isLoading(),loaded:zn.isLoaded()};return React__default.createElement(er,__assign({},Tn,{disabled:Yn,className:cn("advanced-cropper",dn),cropper:zn,style:un},cr),React__default.createElement(Zn,__assign({},Nn,{ref:Jn.boundary,className:cn("advanced-cropper__boundary",jn)}),React__default.createElement(Qn,__assign({},Dn,{disabled:Yn,cropper:zn,className:"advanced-cropper__background-wrapper"}),zn.getState()&&React__default.createElement(Xn,__assign({},_n,{ref:Jn.image,crossOrigin:Vn,cropper:zn,className:cn("advanced-cropper__background",Rn)})),React__default.createElement(rr,__assign({},yn,{disabled:Yn,ref:Fn,cropper:zn,image:Kn}))),Un&&React__default.createElement(CropperCanvas,{ref:Jn.canvas})))},AbstractCropper=createCropper(AbstractCropperComponent),defaultSettings=["transformImage","moveCoordinates","resizeCoordinates","defaultCoordinates","defaultVisibleArea","areaPositionRestrictions","areaSizeRestrictions","sizeRestrictions","positionRestrictions","aspectRatio","minWidth","minHeight","maxWidth","maxHeight","defaultSize","defaultPosition","defaultTransforms","imageRestriction","priority"];function useAbstractCropperProps(on,rn){rn===void 0&&(rn=defaultSettings);var un={settings:{},props:{}};return Object.keys(on).forEach(function(dn){rn.some(function(pn){return pn===dn})?un.settings[dn]=on[dn]:un.props[dn]=on[dn]}),un}var FixedCropper=forwardRef(function(on,rn){var un=useAbstractCropperProps(on,__spreadArray(__spreadArray([],__read(defaultSettings),!1),["stencilSize"],!1));return React__default.createElement(AbstractCropper,__assign({postProcess:fixedStencil,stencilConstraints:fixedStencilConstraints},un.props,{settings:__assign(__assign({defaultSize,aspectRatio,sizeRestrictions:withDefaultSizeRestrictions(sizeRestrictions)},un.settings),{transformImage:__assign(__assign({},un.settings.transformImage),{adjustStencil:!1})}),ref:rn}))});FixedCropper.displayName="FixedCropper";var Cropper=forwardRef(function(on,rn){var un=useAbstractCropperProps(on),dn=un.props,pn=un.settings,fn=pn.stencilSize,hn=pn.autoZoom,gn=__rest(pn,["stencilSize","autoZoom"]),vn=useDeprecationWarning();return isUndefined(hn)||(dn.postProcess||fn?vn("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function."):(vn("prop 'autoZoom' is deprecated now and will be removed, use 'postProcess' prop to pass your auto zoom function. The 'postProcess' automatically set to 'hybridAutoZoom'"),dn.postProcess=hybridStencilAutoZoom)),isUndefined(fn)?React__default.createElement(AbstractCropper,__assign({},dn,{ref:rn,settings:gn})):(vn("prop 'stencilSize' is deprecated for <Cropper/> component now and will be removed, use <FixedCropper/> component instead."),React__default.createElement(FixedCropper,__assign({ref:rn,stencilSize:fn},gn,dn)))});Cropper.displayName="CropperComponent";var CircleStencil=forwardRef(function(on,rn){var un=on.cropper,dn=on.coordinates,pn=on.handlerComponent,fn=pn===void 0?SimpleHandler:pn,hn=on.handlers,gn=hn===void 0?{eastNorth:!0,westNorth:!0,westSouth:!0,eastSouth:!0}:hn,vn=on.handlerClassNames,yn=vn===void 0?{}:vn,xn=on.handlerWrapperClassNames,wn=xn===void 0?{}:xn,Cn=on.lines,Tn=Cn===void 0?{west:!0,north:!0,east:!0,south:!0}:Cn,Pn=on.lineComponent,Sn=Pn===void 0?SimpleLine:Pn,En=on.lineClassNames,_n=En===void 0?{}:En,Rn=on.lineWrapperClassNames,$n=Rn===void 0?{}:Rn,Mn=on.resizable,An=Mn===void 0?!0:Mn,Dn=on.movable,On=Dn===void 0?!0:Dn,In=on.grid,Nn=on.gridClassName,jn=on.className,Ln=on.movingClassName,Un=on.resizingClassName,Hn=on.previewClassName,Vn=on.boundingBoxClassName,Yn=on.overlayClassName,Gn=on.draggableAreaClassName,Wn=on.disabled,Fn=un.getState(),Bn=un.getTransitions(),zn=un.getInteractions(),Kn=An&&!Wn,Jn=On&&!Wn;useImperativeHandle(rn,function(){return{aspectRatio:1,boundingBox:"circle"}});var rr=function(pr){un&&Jn&&un.moveCoordinates(pr)},er=function(){un&&un.moveCoordinatesEnd()},Qn=function(pr,Tr,kr){un&&Kn&&un.resizeCoordinates(pr,Tr,kr)},Xn=function(){un&&un.resizeCoordinatesEnd()},Zn=dn?isFunction(dn)?dn(Fn):dn:getStencilCoordinates(Fn),cr=Zn.width,vr=Zn.height,xr=Zn.left,yr=Zn.top;return Fn&&React__default.createElement(StencilWrapper,{className:cn("advanced-cropper-circle-stencil",jn,zn.moveCoordinates&&Ln,zn.resizeCoordinates&&Un,{"advanced-cropper-circle-stencil--movable":Jn,"advanced-cropper-circle-stencil--moving":zn.moveCoordinates,"advanced-cropper-circle-stencil--resizable":Kn,"advanced-cropper-circle-stencil--resizing":zn.resizeCoordinates,"advanced-cropper-circle-stencil--disabled":Wn}),width:cr,height:vr,left:xr,top:yr,transitions:Bn},React__default.createElement(BoundingBox,{reference:Fn.coordinates,className:cn(Vn,"advanced-cropper-circle-stencil__bounding-box"),handlers:gn,handlerComponent:fn,handlerClassNames:yn,handlerWrapperClassNames:wn,lines:Tn,lineComponent:Sn,lineClassNames:_n,lineWrapperClassNames:$n,onResize:Qn,onResizeEnd:Xn,disabled:!Kn},React__default.createElement(DraggableElement,{disabled:!Jn,onMove:rr,onMoveEnd:er,className:cn("advanced-cropper-circle-stencil__draggable-area",Gn)},React__default.createElement(StencilOverlay,{className:cn("advanced-cropper-circle-stencil__overlay",Yn)},In&&React__default.createElement(StencilGrid,{visible:un.hasInteractions(),columns:zn.transformImage.rotate?9:3,rows:zn.transformImage.rotate?9:3,className:cn("advanced-cropper-circle-stencil__grid",Nn)}),React__default.createElement("div",{className:cn("advanced-cropper-circle-stencil__preview",Hn)})))))});CircleStencil.displayName="CircleStencil";var CropperSource=forwardRef(function(on,rn){var un=on.src,dn=on.crossOrigin,pn=dn===void 0?!0:dn,fn=__rest(on,["src","crossOrigin"]);return un?React__default.createElement("img",__assign({key:un,ref:rn,src:un,className:cn("advanced-cropper-source"),crossOrigin:pn===!0?"anonymous":pn||void 0},fn)):null});CropperSource.displayName="CropperSource";var CropperPreviewWrapper=function(on){var rn=on.children,un=on.cropper,dn=on.className,pn=on.style;return React__default.createElement("div",{className:cn(dn,"cropper-preview-wrapper"),style:pn},React__default.createElement(CropperFade,{visible:un?.isLoaded(),className:"cropper-preview-wrapper__fade"},rn))},CropperPreviewBackground=function(on){var rn=on.className,un=on.cropper,dn=on.crossOrigin,pn=dn===void 0?!0:dn,fn=on.size,hn=on.style,gn=un.getState(),vn=un.getTransitions(),yn=un.getImage(),xn=fn&&yn&&gn?.coordinates?getPreviewStyle(yn,gn,fn,vn):{},wn=yn?yn.src:void 0;return wn?React__default.createElement("img",{key:wn,className:cn("advanced-cropper-background-image",rn),src:wn,crossOrigin:pn===!0?"anonymous":pn||void 0,style:__assign(__assign({},xn),hn),onMouseDown:preventDefault}):null};forwardRef(function(on,rn){var un,dn,pn,fn,hn=on.className,gn=on.contentClassName,vn=on.state,yn=vn===void 0?null:vn,xn=on.image,wn=xn===void 0?null:xn,Cn=on.transitions,Tn=Cn===void 0?null:Cn,Pn=on.backgroundComponent,Sn=Pn===void 0?CropperPreviewBackground:Pn,En=on.backgroundProps,_n=on.backgroundClassName,Rn=on.boundaryComponent,$n=Rn===void 0?StretchableBoundary:Rn,Mn=on.boundaryProps,An=on.boundaryClassName,Dn=on.wrapperComponent,On=Dn===void 0?CropperPreviewWrapper:Dn,In=on.wrapperProps,Nn=on.loaded,jn=Nn===void 0?!0:Nn,Ln=on.loading,Un=Ln===void 0?!1:Ln,Hn=on.style,Vn=on.cropper,Yn=useForceRerender(),Gn=useRef(null),Wn=useRef(null),Fn=Vn||(Wn.current?Wn:{current:{getState:function(){return yn},getTransitions:function(){return Tn},getImage:function(){return wn},isLoaded:function(){return jn},isLoading:function(){return Un}}}),Bn=__read(useState(null),2),zn=Bn[0],Kn=Bn[1],Jn=(dn=(un=Fn.current)===null||un===void 0?void 0:un.getState())===null||dn===void 0?void 0:dn.coordinates,rr=(fn=(pn=Fn.current)===null||pn===void 0?void 0:pn.getImage())===null||fn===void 0?void 0:fn.src,er=zn?{width:"".concat(zn.width,"px"),height:"".concat(zn.height,"px")}:{},Qn=function(){var vr,xr,yr=(xr=(vr=Fn.current)===null||vr===void 0?void 0:vr.getState())===null||xr===void 0?void 0:xr.coordinates;Gn.current&&yr&&Gn.current.stretchTo(yr).then(function(pr){pr&&yr?isGreater(ratio(yr),ratio(pr))?Kn({width:pr.width,height:pr.width/ratio(yr)}):Kn({width:pr.height*ratio(yr),height:pr.height}):Kn(null)}),Yn()};useWindowResize(Qn),useLayoutEffect$2(Qn,[Jn?.height,Jn?.width]),useImperativeHandle(rn,function(){return{refresh:Qn,update:function(vr){vr?Wn.current=vr:Wn.current=null,Qn()}}});var Xn=On,Zn=Sn,cr=$n;return React__default.createElement(Xn,__assign({},In,{className:cn(hn,"advanced-cropper-preview"),cropper:Fn.current,style:Hn}),React__default.createElement(cr,__assign({ref:Gn,stretchAlgorithm:stretchPreviewBoundary},Mn,{className:cn("advanced-cropper-preview__boundary",An)}),React__default.createElement("div",{className:cn(gn,"advanced-cropper-preview__content"),style:er},Fn.current&&React__default.createElement(Zn,__assign({},En,{cropper:Fn.current,size:zn,className:cn(_n,"advanced-cropper-preview__image",rr&&"advanced-cropper-preview__image--visible")})))))});function FaCheck(on){return GenIcon({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"}}]})(on)}const blobToFile=(on,rn)=>new File([on],rn,{lastModified:new Date().getTime(),type:on.type});function KdImageCropper({src:on,onCrop:rn,stencil:un="rectangle",defaultHeight:dn=200,defaultWidth:pn=200,resizable:fn=!0,fileName:hn="image.jpg"}){const gn=useRef(null),vn=()=>{const yn=gn.current?.getCanvas();if(yn){let xn=hn.split(".").at(-1)?.toLocaleLowerCase();xn==="jpg"&&(xn="jpeg"),yn.toBlob(wn=>{if(wn){const Cn=blobToFile(wn,hn);rn(Cn)}},`image/${xn}`)}};return jsxs(Box,{sx:{position:"relative",minWidth:"calc(min(50vw , 500px))"},children:[jsx$1(Cropper,{src:on,ref:gn,className:"cropper",crossOrigin:"use-credentials",stencilComponent:un==="circle"?CircleStencil:RectangleStencil,defaultSize:{width:pn,height:dn},stencilProps:{grid:!0,resizable:fn}}),jsx$1(KdpaPrimaryButton,{sx:{position:"absolute",bottom:"8px",right:"50%",transform:"translateX(50%)",padding:"4px 12px"},onClick:vn,children:jsx$1(FaCheck,{size:20})})]})}function KdImageCropperPopup({onClose:on=()=>({}),onCrop:rn,open:un,src:dn,...pn}){return jsx$1(Dialog,{open:un,onClose:on,children:jsx$1(DialogContent,{sx:{padding:"8px"},children:dn&&jsx$1(KdImageCropper,{src:dn,onCrop:rn,...pn})})})}function KdpaUploadedFile({sessionId:on,fileName:rn,onDelete:un,smallUrl:dn,largeUrl:pn,modal:fn=!0,downloadSmallSize:hn=!1,extention:gn,onCropImage:vn,croppable:yn,defaultCropWidth:xn,defaultCropHeight:wn,cropResizable:Cn,cropStencil:Tn}){const Pn=!!gn&&Object.keys(fileExtension).find(Dn=>fileExtension[Dn].includes(gn.toLocaleLowerCase())),Sn=["jpg","jpeg","png"].includes((gn||"").toLocaleLowerCase()),[En,_n]=useState(!1),[Rn,$n]=useState(!1);function Mn(){return gn==="pdf"?jsxs("div",{children:[jsx$1("img",{src:dn,className:"modal-image",style:{cursor:"pointer"},onClick:()=>_n(!0)}),jsx$1(Dialog,{open:En,fullScreen:!0,children:jsx$1(DialogContent,{sx:{padding:"0px"},children:jsx$1(KdpaPdfViewer,{handleClose:()=>_n(!1),fileUrl:pn})})})]}):jsx$1(_default$1,{small:dn,medium:Pn==="image"?pn:dn,large:pn,hideZoom:!0,className:"modal-image"})}function An(Dn){vn&&vn(Dn),$n(!1)}return jsxs("div",{className:"kdpa-uploaded-file",children:[jsxs("div",{className:"parent",children:[fn?Mn():jsx$1("div",{children:jsx$1("img",{src:dn,className:"modal-image"})}),(un||hn||Pn==="image")&&jsxs("div",{className:"child",children:[yn&&Pn==="image"&&Sn&&jsx$1(FiEdit3,{className:"icon-actions",size:20,onClick:()=>{$n(!0)}}),un&&jsx$1(FiTrash2,{className:"icon-actions",size:20,onClick:()=>{un(on)}}),hn&&jsx$1(MdOutlineFileDownload,{className:"icon-actions",size:20,onClick:()=>{pn&&window.open(pn,"_blank")}})]})]}),rn&&jsx$1("span",{style:{fontSize:"12px"},children:rn?.split("\\")?.slice(-1)?.[0]}),Pn==="image"&&jsx$1(KdImageCropperPopup,{onClose:()=>$n(!1),fileName:rn,onCrop:An,src:pn,open:Rn,defaultWidth:xn,defaultHeight:wn,stencil:Tn,resizable:Cn})]})}export{KdAccordion,KdAdvanceFileUploader,KdAlert,KdCaptcha,KdChart2D,KdChart3D,KdDrawer,KdDropDownField,KdFileUploader,KdFileViewer,KdFormContainer$1 as KdFormContainer,KdFormField,KdGridHeader,KdGridPanel$1 as KdGridPanel,KdHtmlEditor,KdImageBox,KdLanguageChange,KdLazyDropDownField,KdLoading,KdMenubar,KdModal,KdPanelWrapper,KdRadioListCustom,KdRangeField$1 as KdRangeField,KdSearchableInput,KdpaFormField as KdSearchableInputField,KdStepContent,KdStepList,KdStepRoot,KdStepTrigger,KdStyledComponent,KdSwiper,KdSwiperSlide,KdTabsContent,KdTabsList,KdTabsRoot,KdTabsTrigger,KdTagBoxInput,KdTooltip,KdTree,KdTreeField,KdTypography,KdpaAccordion,KdpaAccordionDetails,KdpaAccordionSummary,KdpaAlert,KdpaAlertTitle,KdpaAutoComplete,KdpaAvatar,KdpaBadge,KdpaButton,KdpaCheckBox,KdpaChip,KdpaCircularProgress,KdpaCollapse$1 as KdpaCollapse,KdpaCollapse as KdpaCollapseTransitions,KdpaCopyToClipboard,KdpaDatePicker,KdpaDateTimePicker,KdpaDialog,KdpaDivider,KdpaDropDownLazy,KdpaDropZone,KdpaFade,KdpaFileUploader,KdpaFormContainer$1 as KdpaFormContainer,KdpaFormControl,KdpaFormControlLabel,KdpaFormField$2 as KdpaFormField,KdpaFormLabel,KdpaFullScreenDialog,KdpaGrid,KdpaGridBadge,KdpaGrow,KdpaIconButton,KdImageCropper as KdpaImageCropper,KdImageCropperPopup as KdpaImageCropperPopup,KdpaInlineSpinner,KdpaInput,KdpaInputLabel,KdpaInputMultiline,BpmsLoading as KdpaLoading,KdpaMenuItem,KdpaModal,KdpaModalImage,KdpaMuiBadge,KdpaPaginationGrid,KdpaPdfViewer,KdpaPrimaryButton,KdpaRadio,KdpaRadioGroup,KdpaRtlProvider,KdpaSecondaryButton,KdpaSegment,KdpaSelect,KdpaSkeleton,KdpaSlide,KdpaSlider,KdpaSweetAlertConfirm,KdpaSweetAlertDelete,KdpaSweetAlertOK,KdpaSwitch,KdpaTab,KdpaTabs,KdpaThemeProvider,KdpaTimePicker,KdpaTooltip,KdpaTree,KdpaTreeSelect,KdpaTypography,KdpaUploadedFile,KdpaUploadingFile,KdpaUseFileUploadHook,KdpaZoom,fileExtension,pathFile,pathServicesUpload,serviceName};
@@ -1 +1 @@
1
- {"version":3,"file":"KdpaPdfViewer.d.ts","sourceRoot":"","sources":["../../../../src/components/PdfViewer/KdpaPdfViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,6CAA6C,CAAC;AACrD,OAAO,uDAAuD,CAAC;AAI/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAiFD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAyB/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"KdpaPdfViewer.d.ts","sourceRoot":"","sources":["../../../../src/components/PdfViewer/KdpaPdfViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,6CAA6C,CAAC;AACrD,OAAO,uDAAuD,CAAC;AAO/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAiFD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAyB/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kdpa-components",
3
- "version": "1.52.0",
3
+ "version": "1.52.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,6 +45,7 @@
45
45
  "he": "^1.2.0",
46
46
  "jalali-moment": "^3.3.11",
47
47
  "moment": "^2.29.4",
48
+ "pdfjs-dist": "^3.11.174",
48
49
  "rc-tree-select": "^5.8.0",
49
50
  "react": "^18.2.0",
50
51
  "react-advanced-cropper": "^0.20.1",