@jenesei-software/jenesei-kit-react 1.3.34 → 1.3.36

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.
Files changed (37) hide show
  1. package/build/build-info.txt +3 -3
  2. package/build/{component-Co53yylj.cjs → component-C8NWMxxo.cjs} +2 -2
  3. package/build/{component-Co53yylj.cjs.map → component-C8NWMxxo.cjs.map} +1 -1
  4. package/build/{component-34--WtCE.js → component-CS0uHwL5.js} +3 -3
  5. package/build/{component-34--WtCE.js.map → component-CS0uHwL5.js.map} +1 -1
  6. package/build/{component-CAWbX2_9.cjs → component-DkO36zGe.cjs} +2 -2
  7. package/build/{component-CAWbX2_9.cjs.map → component-DkO36zGe.cjs.map} +1 -1
  8. package/build/{component-DHwK4xEP.js → component-DrO-3u2I.js} +2 -2
  9. package/build/{component-DHwK4xEP.js.map → component-DrO-3u2I.js.map} +1 -1
  10. package/build/component-image-button.cjs.js +1 -1
  11. package/build/component-image-button.es.js +1 -1
  12. package/build/component-image-select.cjs.js +1 -1
  13. package/build/component-image-select.es.js +1 -1
  14. package/build/component-image-slider.cjs.js +1 -1
  15. package/build/component-image-slider.es.js +1 -1
  16. package/build/{component.constants-DybDxNgw.js → component.constants-DEtpkwiA.js} +2 -2
  17. package/build/{component.constants-DybDxNgw.js.map → component.constants-DEtpkwiA.js.map} +1 -1
  18. package/build/{component.constants-CuYFwf5W.cjs → component.constants-QEk9PcRK.cjs} +2 -2
  19. package/build/{component.constants-CuYFwf5W.cjs.map → component.constants-QEk9PcRK.cjs.map} +1 -1
  20. package/build/consts.cjs.js +1 -1
  21. package/build/consts.es.js +1 -1
  22. package/build/context-dialog.cjs.js +1 -1
  23. package/build/context-dialog.es.js +1 -1
  24. package/build/context.hooks-C-jAj7Vc.cjs +2 -0
  25. package/build/context.hooks-C-jAj7Vc.cjs.map +1 -0
  26. package/build/{context.hooks-DGYU76JL.js → context.hooks-CxwYYLmV.js} +5 -5
  27. package/build/context.hooks-CxwYYLmV.js.map +1 -0
  28. package/build/index.cjs.js +1 -1
  29. package/build/index.es.js +4 -4
  30. package/build/{use-CGZzVbz2.js → use-Cglz8LOj.js} +2 -2
  31. package/build/{use-CGZzVbz2.js.map → use-Cglz8LOj.js.map} +1 -1
  32. package/build/{use-DEkooQyB.cjs → use-DGVoIo0g.cjs} +2 -2
  33. package/build/{use-DEkooQyB.cjs.map → use-DGVoIo0g.cjs.map} +1 -1
  34. package/package.json +1 -1
  35. package/build/context.hooks-Biv8ZMzm.cjs +0 -2
  36. package/build/context.hooks-Biv8ZMzm.cjs.map +0 -1
  37. package/build/context.hooks-DGYU76JL.js.map +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./jsx-runtime-C6yv_9g1.cjs"),t=require("react"),o=require("./context.constants-CDgzMcxb.cjs"),i=require("./component.constants-D80V6i-m.cjs"),n=require("./component-CoOTSdM5.cjs"),r=require("./consts.cjs.js");require("./context.constants-BWZS-di6.cjs");const a=require("./context.hooks-Biv8ZMzm.cjs"),s=require("styled-components");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const o in e)if("default"!==o){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}return t.default=e,Object.freeze(t)}const p=c(t);function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(e,t)};var l=function(){return l=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},l.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var h,m,g,v,f,w,x,S,C,y,b,z,R,D,E,P=!1;function M(){if(!P){P=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),o=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(z=/\b(iPhone|iP[ao]d)/.exec(e),R=/\b(iP[ao]d)/.exec(e),y=/Android/i.exec(e),D=/FBAN\/\w+;/i.exec(e),E=/Mobile/i.exec(e),b=!!/Win64/.exec(e),t){(h=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(h=document.documentMode);var i=/(?:Trident\/(\d+.\d+))/.exec(e);w=i?parseFloat(i[1])+4:h,m=t[2]?parseFloat(t[2]):NaN,g=t[3]?parseFloat(t[3]):NaN,(v=t[4]?parseFloat(t[4]):NaN)?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),f=t&&t[1]?parseFloat(t[1]):NaN):f=NaN}else h=m=g=f=v=NaN;if(o){if(o[1]){var n=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);x=!n||parseFloat(n[1].replace("_","."))}else x=!1;S=!!o[2],C=!!o[3]}else x=S=C=!1}}var A,j={ie:function(){return M()||h},ieCompatibilityMode:function(){return M()||w>h},ie64:function(){return j.ie()&&b},firefox:function(){return M()||m},opera:function(){return M()||g},webkit:function(){return M()||v},safari:function(){return j.webkit()},chrome:function(){return M()||f},windows:function(){return M()||S},osx:function(){return M()||x},linux:function(){return M()||C},iphone:function(){return M()||z},mobile:function(){return M()||z||R||y||E},nativeApp:function(){return M()||D},android:function(){return M()||y},ipad:function(){return M()||R}},T=j,O={canUseDOM:!("undefined"==typeof window||!window.document||!window.document.createElement)};O.canUseDOM&&(A=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
1
+ "use strict";const e=require("./jsx-runtime-C6yv_9g1.cjs"),t=require("react"),o=require("./context.constants-CDgzMcxb.cjs"),i=require("./component.constants-D80V6i-m.cjs"),n=require("./component-CoOTSdM5.cjs"),r=require("./consts.cjs.js");require("./context.constants-BWZS-di6.cjs");const a=require("./context.hooks-C-jAj7Vc.cjs"),s=require("styled-components");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const o in e)if("default"!==o){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}return t.default=e,Object.freeze(t)}const p=c(t);function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(e,t)};var l=function(){return l=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},l.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var h,m,g,v,f,w,x,S,C,y,b,z,R,D,E,P=!1;function M(){if(!P){P=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),o=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(z=/\b(iPhone|iP[ao]d)/.exec(e),R=/\b(iP[ao]d)/.exec(e),y=/Android/i.exec(e),D=/FBAN\/\w+;/i.exec(e),E=/Mobile/i.exec(e),b=!!/Win64/.exec(e),t){(h=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(h=document.documentMode);var i=/(?:Trident\/(\d+.\d+))/.exec(e);w=i?parseFloat(i[1])+4:h,m=t[2]?parseFloat(t[2]):NaN,g=t[3]?parseFloat(t[3]):NaN,(v=t[4]?parseFloat(t[4]):NaN)?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),f=t&&t[1]?parseFloat(t[1]):NaN):f=NaN}else h=m=g=f=v=NaN;if(o){if(o[1]){var n=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);x=!n||parseFloat(n[1].replace("_","."))}else x=!1;S=!!o[2],C=!!o[3]}else x=S=C=!1}}var A,j={ie:function(){return M()||h},ieCompatibilityMode:function(){return M()||w>h},ie64:function(){return j.ie()&&b},firefox:function(){return M()||m},opera:function(){return M()||g},webkit:function(){return M()||v},safari:function(){return j.webkit()},chrome:function(){return M()||f},windows:function(){return M()||S},osx:function(){return M()||x},linux:function(){return M()||C},iphone:function(){return M()||z},mobile:function(){return M()||z||R||y||E},nativeApp:function(){return M()||D},android:function(){return M()||y},ipad:function(){return M()||R}},T=j,O={canUseDOM:!("undefined"==typeof window||!window.document||!window.document.createElement)};O.canUseDOM&&(A=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
2
2
  /**
3
3
  * Checks if an event is supported in the current execution environment.
4
4
  *
@@ -13,4 +13,4 @@
13
13
  * @internal
14
14
  * @license Modernizr 3.0.0pre (Custom Build) | MIT
15
15
  */;var W=T,_=function(e,t){if(!O.canUseDOM||t&&!("addEventListener"in document))return!1;var o="on"+e,i=o in document;if(!i){var n=document.createElement("div");n.setAttribute(o,"return;"),i="function"==typeof n[o]}return!i&&A&&"wheel"===e&&(i=document.implementation.hasFeature("Events.wheel","3.0")),i};function I(e){var t=0,o=0,i=0,n=0;return"detail"in e&&(o=e.detail),"wheelDelta"in e&&(o=-e.wheelDelta/120),"wheelDeltaY"in e&&(o=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=o,o=0),i=10*t,n=10*o,"deltaY"in e&&(n=e.deltaY),"deltaX"in e&&(i=e.deltaX),(i||n)&&e.deltaMode&&(1==e.deltaMode?(i*=40,n*=40):(i*=800,n*=800)),i&&!t&&(t=i<1?-1:1),n&&!o&&(o=n<1?-1:1),{spinX:t,spinY:o,pixelX:i,pixelY:n}}I.getEventType=function(){return W.firefox()?"DOMMouseScroll":_("wheel")?"wheel":"mousewheel"};const L=u(I);function N(e,t,o,i,n){void 0===n&&(n=0);var r=B(t.width,t.height,n),a=r.width,s=r.height;return{x:F(e.x,a,o.width,i),y:F(e.y,s,o.height,i)}}function F(e,t,o,i){var n=t*i/2-o/2;return G(e,-n,n)}function k(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function Z(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function H(e,t){return Math.min(e,Math.max(0,t))}function U(e,t){return t}function q(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function B(e,t,o){var i=o*Math.PI/180;return{width:Math.abs(Math.cos(i)*e)+Math.abs(Math.sin(i)*t),height:Math.abs(Math.sin(i)*e)+Math.abs(Math.cos(i)*t)}}function G(e,t,o){return Math.min(Math.max(e,t),o)}function X(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return"string"==typeof e&&e.length>0}).join(" ").trim()}var V=function(e){function t(){var o=null!==e&&e.apply(this,arguments)||this;return o.cropperRef=p.createRef(),o.imageRef=p.createRef(),o.videoRef=p.createRef(),o.containerPosition={x:0,y:0},o.containerRef=null,o.styleRef=null,o.containerRect=null,o.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},o.dragStartPosition={x:0,y:0},o.dragStartCrop={x:0,y:0},o.gestureZoomStart=0,o.gestureRotationStart=0,o.isTouching=!1,o.lastPinchDistance=0,o.lastPinchRotation=0,o.rafDragTimeout=null,o.rafPinchTimeout=null,o.wheelTimer=null,o.currentDoc="undefined"!=typeof document?document:null,o.currentWindow="undefined"!=typeof window?window:null,o.resizeObserver=null,o.previousCropSize=null,o.isInitialized=!1,o.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},o.initResizeObserver=function(){if(void 0!==window.ResizeObserver&&o.containerRef){var e=!0;o.resizeObserver=new window.ResizeObserver(function(t){e?e=!1:o.computeSizes()}),o.resizeObserver.observe(o.containerRef)}},o.preventZoomSafari=function(e){return e.preventDefault()},o.cleanEvents=function(){o.currentDoc&&(o.currentDoc.removeEventListener("mousemove",o.onMouseMove),o.currentDoc.removeEventListener("mouseup",o.onDragStopped),o.currentDoc.removeEventListener("touchmove",o.onTouchMove),o.currentDoc.removeEventListener("touchend",o.onDragStopped),o.currentDoc.removeEventListener("gesturechange",o.onGestureChange),o.currentDoc.removeEventListener("gestureend",o.onGestureEnd),o.currentDoc.removeEventListener("scroll",o.onScroll))},o.clearScrollEvent=function(){o.containerRef&&o.containerRef.removeEventListener("wheel",o.onWheel),o.wheelTimer&&clearTimeout(o.wheelTimer)},o.onMediaLoad=function(){var e=o.computeSizes();e&&(o.previousCropSize=e,o.emitCropData(),o.setInitialCrop(e),o.isInitialized=!0),o.props.onMediaLoaded&&o.props.onMediaLoaded(o.mediaSize)},o.setInitialCrop=function(e){if(o.props.initialCroppedAreaPercentages){var t=function(e,t,o,i,n,r){var a=B(t.width,t.height,o),s=G(i.width/a.width*(100/e.width),n,r);return{crop:{x:s*a.width/2-i.width/2-a.width*s*(e.x/100),y:s*a.height/2-i.height/2-a.height*s*(e.y/100)},zoom:s}}(o.props.initialCroppedAreaPercentages,o.mediaSize,o.props.rotation,e,o.props.minZoom,o.props.maxZoom),i=t.crop,n=t.zoom;o.props.onCropChange(i),o.props.onZoomChange&&o.props.onZoomChange(n)}else if(o.props.initialCroppedAreaPixels){var r=function(e,t,o,i,n,r){void 0===o&&(o=0);var a=B(t.naturalWidth,t.naturalHeight,o),s=G(function(e,t,o){var i=function(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}(t);return o.height>o.width?o.height/(e.height*i):o.width/(e.width*i)}(e,t,i),n,r),c=i.height>i.width?i.height/e.height:i.width/e.width;return{crop:{x:((a.width-e.width)/2-e.x)*c,y:((a.height-e.height)/2-e.y)*c},zoom:s}}(o.props.initialCroppedAreaPixels,o.mediaSize,o.props.rotation,e,o.props.minZoom,o.props.maxZoom);i=r.crop,n=r.zoom;o.props.onCropChange(i),o.props.onZoomChange&&o.props.onZoomChange(n)}},o.computeSizes=function(){var e,t,i,n,r,a,s=o.imageRef.current||o.videoRef.current;if(s&&o.containerRef){o.containerRect=o.containerRef.getBoundingClientRect(),o.saveContainerPosition();var c=o.containerRect.width/o.containerRect.height,p=(null===(e=o.imageRef.current)||void 0===e?void 0:e.naturalWidth)||(null===(t=o.videoRef.current)||void 0===t?void 0:t.videoWidth)||0,u=(null===(i=o.imageRef.current)||void 0===i?void 0:i.naturalHeight)||(null===(n=o.videoRef.current)||void 0===n?void 0:n.videoHeight)||0,d=p/u,h=void 0;if(s.offsetWidth<p||s.offsetHeight<u)switch(o.state.mediaObjectFit){default:case"contain":h=c>d?{width:o.containerRect.height*d,height:o.containerRect.height}:{width:o.containerRect.width,height:o.containerRect.width/d};break;case"horizontal-cover":h={width:o.containerRect.width,height:o.containerRect.width/d};break;case"vertical-cover":h={width:o.containerRect.height*d,height:o.containerRect.height}}else h={width:s.offsetWidth,height:s.offsetHeight};o.mediaSize=l(l({},h),{naturalWidth:p,naturalHeight:u}),o.props.setMediaSize&&o.props.setMediaSize(o.mediaSize);var m=o.props.cropSize?o.props.cropSize:function(e,t,o,i,n,r){void 0===r&&(r=0);var a=B(e,t,r),s=a.width,c=a.height,p=Math.min(s,o),u=Math.min(c,i);return p>u*n?{width:u*n,height:u}:{width:p,height:p/n}}(o.mediaSize.width,o.mediaSize.height,o.containerRect.width,o.containerRect.height,o.props.aspect,o.props.rotation);return(null===(r=o.state.cropSize)||void 0===r?void 0:r.height)===m.height&&(null===(a=o.state.cropSize)||void 0===a?void 0:a.width)===m.width||o.props.onCropSizeChange&&o.props.onCropSizeChange(m),o.setState({cropSize:m},o.recomputeCropPosition),o.props.setCropSize&&o.props.setCropSize(m),m}},o.saveContainerPosition=function(){if(o.containerRef){var e=o.containerRef.getBoundingClientRect();o.containerPosition={x:e.left,y:e.top}}},o.onMouseDown=function(e){o.currentDoc&&(e.preventDefault(),o.currentDoc.addEventListener("mousemove",o.onMouseMove),o.currentDoc.addEventListener("mouseup",o.onDragStopped),o.saveContainerPosition(),o.onDragStart(t.getMousePoint(e)))},o.onMouseMove=function(e){return o.onDrag(t.getMousePoint(e))},o.onScroll=function(e){o.currentDoc&&(e.preventDefault(),o.saveContainerPosition())},o.onTouchStart=function(e){o.currentDoc&&(o.isTouching=!0,o.props.onTouchRequest&&!o.props.onTouchRequest(e)||(o.currentDoc.addEventListener("touchmove",o.onTouchMove,{passive:!1}),o.currentDoc.addEventListener("touchend",o.onDragStopped),o.saveContainerPosition(),2===e.touches.length?o.onPinchStart(e):1===e.touches.length&&o.onDragStart(t.getTouchPoint(e.touches[0]))))},o.onTouchMove=function(e){e.preventDefault(),2===e.touches.length?o.onPinchMove(e):1===e.touches.length&&o.onDrag(t.getTouchPoint(e.touches[0]))},o.onGestureStart=function(e){o.currentDoc&&(e.preventDefault(),o.currentDoc.addEventListener("gesturechange",o.onGestureChange),o.currentDoc.addEventListener("gestureend",o.onGestureEnd),o.gestureZoomStart=o.props.zoom,o.gestureRotationStart=o.props.rotation)},o.onGestureChange=function(e){if(e.preventDefault(),!o.isTouching){var i=t.getMousePoint(e),n=o.gestureZoomStart-1+e.scale;if(o.setNewZoom(n,i,{shouldUpdatePosition:!0}),o.props.onRotationChange){var r=o.gestureRotationStart+e.rotation;o.props.onRotationChange(r)}}},o.onGestureEnd=function(e){o.cleanEvents()},o.onDragStart=function(e){var t,i,n=e.x,r=e.y;o.dragStartPosition={x:n,y:r},o.dragStartCrop=l({},o.props.crop),null===(i=(t=o.props).onInteractionStart)||void 0===i||i.call(t)},o.onDrag=function(e){var t=e.x,i=e.y;o.currentWindow&&(o.rafDragTimeout&&o.currentWindow.cancelAnimationFrame(o.rafDragTimeout),o.rafDragTimeout=o.currentWindow.requestAnimationFrame(function(){if(o.state.cropSize&&void 0!==t&&void 0!==i){var e=t-o.dragStartPosition.x,n=i-o.dragStartPosition.y,r={x:o.dragStartCrop.x+e,y:o.dragStartCrop.y+n},a=o.props.restrictPosition?N(r,o.mediaSize,o.state.cropSize,o.props.zoom,o.props.rotation):r;o.props.onCropChange(a)}}))},o.onDragStopped=function(){var e,t;o.isTouching=!1,o.cleanEvents(),o.emitCropData(),null===(t=(e=o.props).onInteractionEnd)||void 0===t||t.call(e)},o.onWheel=function(e){if(o.currentWindow&&(!o.props.onWheelRequest||o.props.onWheelRequest(e))){e.preventDefault();var i=t.getMousePoint(e),n=L(e).pixelY,r=o.props.zoom-n*o.props.zoomSpeed/200;o.setNewZoom(r,i,{shouldUpdatePosition:!0}),o.state.hasWheelJustStarted||o.setState({hasWheelJustStarted:!0},function(){var e,t;return null===(t=(e=o.props).onInteractionStart)||void 0===t?void 0:t.call(e)}),o.wheelTimer&&clearTimeout(o.wheelTimer),o.wheelTimer=o.currentWindow.setTimeout(function(){return o.setState({hasWheelJustStarted:!1},function(){var e,t;return null===(t=(e=o.props).onInteractionEnd)||void 0===t?void 0:t.call(e)})},250)}},o.getPointOnContainer=function(e,t){var i=e.x,n=e.y;if(!o.containerRect)throw new Error("The Cropper is not mounted");return{x:o.containerRect.width/2-(i-t.x),y:o.containerRect.height/2-(n-t.y)}},o.getPointOnMedia=function(e){var t=e.x,i=e.y,n=o.props,r=n.crop,a=n.zoom;return{x:(t+r.x)/a,y:(i+r.y)/a}},o.setNewZoom=function(e,t,i){var n=(void 0===i?{}:i).shouldUpdatePosition,r=void 0===n||n;if(o.state.cropSize&&o.props.onZoomChange){var a=G(e,o.props.minZoom,o.props.maxZoom);if(r){var s=o.getPointOnContainer(t,o.containerPosition),c=o.getPointOnMedia(s),p={x:c.x*a-s.x,y:c.y*a-s.y},u=o.props.restrictPosition?N(p,o.mediaSize,o.state.cropSize,a,o.props.rotation):p;o.props.onCropChange(u)}o.props.onZoomChange(a)}},o.getCropData=function(){return o.state.cropSize?function(e,t,o,i,n,r,a){void 0===r&&(r=0),void 0===a&&(a=!0);var s=a?H:U,c=B(t.width,t.height,r),p=B(t.naturalWidth,t.naturalHeight,r),u={x:s(100,((c.width-o.width/n)/2-e.x/n)/c.width*100),y:s(100,((c.height-o.height/n)/2-e.y/n)/c.height*100),width:s(100,o.width/c.width*100/n),height:s(100,o.height/c.height*100/n)},d=Math.round(s(p.width,u.width*p.width/100)),h=Math.round(s(p.height,u.height*p.height/100)),m=p.width>=p.height*i?{width:Math.round(h*i),height:h}:{width:d,height:Math.round(d/i)};return{croppedAreaPercentages:u,croppedAreaPixels:l(l({},m),{x:Math.round(s(p.width-m.width,u.x*p.width/100)),y:Math.round(s(p.height-m.height,u.y*p.height/100))})}}(o.props.restrictPosition?N(o.props.crop,o.mediaSize,o.state.cropSize,o.props.zoom,o.props.rotation):o.props.crop,o.mediaSize,o.state.cropSize,o.getAspect(),o.props.zoom,o.props.rotation,o.props.restrictPosition):null},o.emitCropData=function(){var e=o.getCropData();if(e){var t=e.croppedAreaPercentages,i=e.croppedAreaPixels;o.props.onCropComplete&&o.props.onCropComplete(t,i),o.props.onCropAreaChange&&o.props.onCropAreaChange(t,i)}},o.emitCropAreaChange=function(){var e=o.getCropData();if(e){var t=e.croppedAreaPercentages,i=e.croppedAreaPixels;o.props.onCropAreaChange&&o.props.onCropAreaChange(t,i)}},o.recomputeCropPosition=function(){if(o.state.cropSize){var e=o.props.crop;if(o.isInitialized&&o.previousCropSize)if(Math.abs(o.previousCropSize.width-o.state.cropSize.width)>1e-6||Math.abs(o.previousCropSize.height-o.state.cropSize.height)>1e-6){var t=o.state.cropSize.width/o.previousCropSize.width,i=o.state.cropSize.height/o.previousCropSize.height;e={x:o.props.crop.x*t,y:o.props.crop.y*i}}var n=o.props.restrictPosition?N(e,o.mediaSize,o.state.cropSize,o.props.zoom,o.props.rotation):e;o.previousCropSize=o.state.cropSize,o.props.onCropChange(n),o.emitCropData()}},o.onKeyDown=function(e){var t,i,n=o.props,r=n.crop,a=n.onCropChange,s=n.keyboardStep,c=n.zoom,p=n.rotation,u=s;if(o.state.cropSize){e.shiftKey&&(u*=.2);var d=l({},r);switch(e.key){case"ArrowUp":d.y-=u,e.preventDefault();break;case"ArrowDown":d.y+=u,e.preventDefault();break;case"ArrowLeft":d.x-=u,e.preventDefault();break;case"ArrowRight":d.x+=u,e.preventDefault();break;default:return}o.props.restrictPosition&&(d=N(d,o.mediaSize,o.state.cropSize,c,p)),e.repeat||null===(i=(t=o.props).onInteractionStart)||void 0===i||i.call(t),a(d)}},o.onKeyUp=function(e){var t,i;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":e.preventDefault();break;default:return}o.emitCropData(),null===(i=(t=o.props).onInteractionEnd)||void 0===i||i.call(t)},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(t,e),t.prototype.componentDidMount=function(){this.currentDoc&&this.currentWindow&&(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),void 0===window.ResizeObserver&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n",this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},t.prototype.componentWillUnmount=function(){var e,t;this.currentDoc&&this.currentWindow&&(void 0===window.ResizeObserver&&this.currentWindow.removeEventListener("resize",this.computeSizes),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&(null===(t=this.styleRef.parentNode)||void 0===t||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},t.prototype.componentDidUpdate=function(e){var t,o,i,n,r,a,s,c,p;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect||e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():(null===(t=e.cropSize)||void 0===t?void 0:t.height)!==(null===(o=this.props.cropSize)||void 0===o?void 0:o.height)||(null===(i=e.cropSize)||void 0===i?void 0:i.width)!==(null===(n=this.props.cropSize)||void 0===n?void 0:n.width)?this.computeSizes():(null===(r=e.crop)||void 0===r?void 0:r.x)===(null===(a=this.props.crop)||void 0===a?void 0:a.x)&&(null===(s=e.crop)||void 0===s?void 0:s.y)===(null===(c=this.props.crop)||void 0===c?void 0:c.y)||this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&(null===(p=this.videoRef.current)||void 0===p||p.load());var u=this.getObjectFit();u!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:u},this.computeSizes)},t.prototype.getAspect=function(){var e=this.props,t=e.cropSize,o=e.aspect;return t?t.width/t.height:o},t.prototype.getObjectFit=function(){var e,t,o,i;if("cover"===this.props.objectFit){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var n=this.containerRect.width/this.containerRect.height;return((null===(e=this.imageRef.current)||void 0===e?void 0:e.naturalWidth)||(null===(t=this.videoRef.current)||void 0===t?void 0:t.videoWidth)||0)/((null===(o=this.imageRef.current)||void 0===o?void 0:o.naturalHeight)||(null===(i=this.videoRef.current)||void 0===i?void 0:i.videoHeight)||0)<n?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},t.prototype.onPinchStart=function(e){var o=t.getTouchPoint(e.touches[0]),i=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=k(o,i),this.lastPinchRotation=Z(o,i),this.onDragStart(q(o,i))},t.prototype.onPinchMove=function(e){var o=this;if(this.currentDoc&&this.currentWindow){var i=t.getTouchPoint(e.touches[0]),n=t.getTouchPoint(e.touches[1]),r=q(i,n);this.onDrag(r),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var e=k(i,n),t=o.props.zoom*(e/o.lastPinchDistance);o.setNewZoom(t,r,{shouldUpdatePosition:!1}),o.lastPinchDistance=e;var a=Z(i,n),s=o.props.rotation+(a-o.lastPinchRotation);o.props.onRotationChange&&o.props.onRotationChange(s),o.lastPinchRotation=a})}},t.prototype.render=function(){var e,t=this,o=this.props,i=o.image,n=o.video,r=o.mediaProps,a=o.cropperProps,s=o.transform,c=o.crop,u=c.x,d=c.y,h=o.rotation,m=o.zoom,g=o.cropShape,v=o.showGrid,f=o.roundCropAreaPixels,w=o.style,x=w.containerStyle,S=w.cropAreaStyle,C=w.mediaStyle,y=o.classes,b=y.containerClassName,z=y.cropAreaClassName,R=y.mediaClassName,D=null!==(e=this.state.mediaObjectFit)&&void 0!==e?e:this.getObjectFit();return p.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(e){return t.containerRef=e},"data-testid":"container",style:x,className:X("reactEasyCrop_Container",b)},i?p.createElement("img",l({alt:"",className:X("reactEasyCrop_Image","contain"===D&&"reactEasyCrop_Contain","horizontal-cover"===D&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===D&&"reactEasyCrop_Cover_Vertical",R)},r,{src:i,ref:this.imageRef,style:l(l({},C),{transform:s||"translate(".concat(u,"px, ").concat(d,"px) rotate(").concat(h,"deg) scale(").concat(m,")")}),onLoad:this.onMediaLoad})):n&&p.createElement("video",l({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:X("reactEasyCrop_Video","contain"===D&&"reactEasyCrop_Contain","horizontal-cover"===D&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===D&&"reactEasyCrop_Cover_Vertical",R)},r,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:l(l({},C),{transform:s||"translate(".concat(u,"px, ").concat(d,"px) rotate(").concat(h,"deg) scale(").concat(m,")")}),controls:!1}),(Array.isArray(n)?n:[{src:n}]).map(function(e){return p.createElement("source",l({key:e.src},e))})),this.state.cropSize&&p.createElement("div",l({ref:this.cropperRef,style:l(l({},S),{width:f?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:f?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:X("reactEasyCrop_CropArea","round"===g&&"reactEasyCrop_CropAreaRound",v&&"reactEasyCrop_CropAreaGrid",z)},a)))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:1},t.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t}(p.Component);const Y=a=>{var c,p,u,d,l,h,m,g,v,f;const[w,x]=t.useState(0),[S,C]=t.useState([]),[y,b]=t.useState([]),z=s.useTheme(),R=t.useMemo(()=>a.images.length>1,[a.images.length]),D=t.useMemo(()=>null==S?void 0:S[w],[S,w]),E=t.useCallback(async e=>{var t,o,i;const n=await Promise.all(e.map(async e=>{const t=y[e.index]??null;if(e.isDeleted||!e.isCropped||!e.url||!e.name||!t)return null;const o=await function(e,t,o="image/png"){const i=r.LIST_IMAGE_SUPPORTED_FORMAT.includes(o)?o:"image/png";return new Promise((o,n)=>{const r=new Image;r.src=e,r.crossOrigin="anonymous",r.onload=()=>{const e=document.createElement("canvas"),a=e.getContext("2d");e.width=t.width,e.height=t.height,a.drawImage(r,t.x,t.y,t.width,t.height,0,0,t.width,t.height),e.toBlob(e=>{e?o(e):n(new Error("Canvas is empty"))},i)},r.onerror=()=>n(new Error("Failed to load image"))})}(e.url,t,e.format),i=new File([o],e.name,{type:e.format});return{...e,file:i,url:URL.createObjectURL(i)}}));null==(o=null==(t=a.params)?void 0:t.onSave)||o.call(t,n.filter(Boolean)),null==(i=a.remove)||i.call(a)},[y,a]),P=t.useCallback(async e=>{var t;const o=null==(t=a.images)?void 0:t[e.index];if(o){const t={...o,id:Date.now()+e.index,index:e.index,croppedArea:e.croppedArea??o.croppedArea,zoom:e.zoom??o.zoom,crop:e.crop??o.crop,isNew:!0,isCropped:e.isCropped??o.isCropped,isDeleted:e.isDeleted??o.isDeleted};if(C(o=>{const i=[...o];return i[e.index]=t,i}),e.isNext){const t=e.index+1>=a.images.length?0:e.index+1;x(t)}e.isSave&&E([t])}},[E,a.images]);t.useEffect(()=>{C(a.images),b(a.images.map(e=>e.croppedArea??null))},[a.images]),t.useEffect(()=>()=>{x(0),C([]),b([])},[]);const M=t.useMemo(()=>S.reduce((e,t)=>(e&&void 0!==(null==t?void 0:t.index)&&(e[t.index]={genre:t.isDeleted?"redTransparent":t.isCropped?"greenTransparent":"white",icons:t.isDeleted?[{type:"id",name:"CloseMini"}]:t.isCropped?[{type:"id",name:"TickMini"}]:[]}),e),{}),[S]),A=t.useMemo(()=>S.every(e=>(null==e?void 0:e.isDeleted)||!(null==e?void 0:e.isCropped)),[S]),j=t.useMemo(()=>{var e;return(null==(e=a.params)?void 0:e.dialog.button.genre)||"product"},[null==(c=a.params)?void 0:c.dialog.button.genre]),T=t.useMemo(()=>{var e;return(null==(e=a.params)?void 0:e.dialog.button.size)||"medium"},[null==(p=a.params)?void 0:p.dialog.button.size]),O=t.useMemo(()=>{var e;return(null==(e=a.params)?void 0:e.dialog.buttonDelete.genre)||"product"},[null==(u=a.params)?void 0:u.dialog.buttonDelete.genre]),W=t.useMemo(()=>{var e;return(null==(e=a.params)?void 0:e.dialog.button.size)||"medium"},[null==(d=a.params)?void 0:d.dialog.button.size]);return e.jsxRuntimeExports.jsxs(n.Stack,{sx:e=>{var t,o,i;return{default:{position:"relative",overflow:"hidden",aspectRatio:(null==(t=a.params)?void 0:t.imageSettings.aspect)?2*(null==(o=a.params)?void 0:o.imageSettings.aspect)+" / 2":void 0,width:"auto",maxWidth:"70dvw",height:"85dvh",borderRadius:null==(i=a.params)?void 0:i.br,backgroundColor:e.palette.whiteStandard},tablet:{maxWidth:"95dvw"}}},children:[e.jsxRuntimeExports.jsxs(o.Preview,{visible:!a.isAnimating,minTime:500,children:[e.jsxRuntimeExports.jsx(n.Stack,{sx:{default:{position:"absolute",top:0,left:0,right:0,bottom:0}},children:D&&e.jsxRuntimeExports.jsx(V,{style:{containerStyle:{backgroundColor:z.palette.black80}},image:D.url,crop:(null==D?void 0:D.crop)??{x:0,y:0},zoom:(null==D?void 0:D.zoom)??1,aspect:null==(l=a.params)?void 0:l.imageSettings.aspect,onCropChange:e=>{P({...D,crop:e})},onZoomChange:e=>{P({...D,zoom:e})},onCropComplete:(e,t)=>{b(e=>{const o=[...e];return o[w]=t,o})}})}),e.jsxRuntimeExports.jsxs(n.Stack,{sx:{default:{position:"absolute",top:15,right:15,gap:"10px"}},children:[e.jsxRuntimeExports.jsx(o.Button,{genre:O,size:W,isHiddenBorder:!0,isRadius:!0,onClick:()=>{var e;return null==(e=a.remove)?void 0:e.call(a)},children:null==(h=a.params)?void 0:h.locale.dialogCancel}),R&&e.jsxRuntimeExports.jsx(o.Button,{genre:j,size:T,isHiddenBorder:!0,isRadius:!0,onClick:()=>E(S),isHidden:A,isDisabled:A,children:null==(m=a.params)?void 0:m.locale.dialogSave})]})]}),R&&w!==a.images.length&&e.jsxRuntimeExports.jsx(o.Button,{sx:{default:{position:"absolute",top:15,left:15}},genre:j,size:T,isHiddenBorder:!0,isWidthAsHeight:!0,isRadius:!0,isDisabled:!0,children:w+1}),e.jsxRuntimeExports.jsxs(n.Stack,{sx:e=>({default:{position:"absolute",bottom:R?5:15,left:R?5:void 0,right:R?void 0:15,width:R?"calc(100% - 10px)":"fit-content",backgroundColor:R?e.palette.whiteStandard:e.palette.transparent,padding:"10px",borderRadius:"50px",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"10px"},mobile:{borderRadius:"24px",flexDirection:"column",alignItems:"stretch",gap:"10px"}}),children:[R&&e.jsxRuntimeExports.jsx(i.Pagination,{sx:{default:{},mobile:{justifyContent:"space-between"}},lengthData:M,length:a.images.length,index:w,changeIndex:e=>{x(e)},isInfinity:!0,viewQuantity:4,buttonControl:{genre:j,size:T,isRadius:!0,isWidthAsHeight:!0},buttonCount:{active:{genre:j,size:T,isRadius:!0,isPlaystationEffect:!0},inactive:{genre:"white",size:T,isRadius:!0}},locale:{next:"Next",prev:"Prev"}}),e.jsxRuntimeExports.jsxs(n.Stack,{sx:{default:{gap:"10px"},mobile:{justifyContent:"center"}},children:[R&&e.jsxRuntimeExports.jsx(o.Button,{genre:O,size:W,isHiddenBorder:!0,isRadius:!0,onClick:()=>{P({...D,isDeleted:!0,isNext:R})},children:null==(g=a.params)?void 0:g.locale.dialogDeleteImage}),e.jsxRuntimeExports.jsx(o.Button,{genre:j,size:T,isHiddenBorder:!0,isRadius:!0,onClick:()=>{P({...D,isDeleted:!1,isCropped:!0,isNext:R,isSave:!R})},children:R?null==(v=a.params)?void 0:v.locale.dialogAddImage:null==(f=a.params)?void 0:f.locale.dialogSave})]})]})]})};exports.useImageCrop=i=>{const n=t.useMemo(()=>o.KEY_SIZE_DATA[i.dialog.button.size],[i.dialog.button.size]),r=t.useMemo(()=>`${n.radius}px`,[n.radius]),{add:s}=a.useDialog({br:r,imageSettings:i.imageSettings,onSave:i.onSave,dialog:i.dialog,locale:i.locale,propsDialog:{borderRadius:r,padding:"0",background:"transparent"}}),c=t.useCallback(t=>{s({content:(o,i,n)=>e.jsxRuntimeExports.jsx(Y,{images:t,params:o,remove:i,isAnimating:n})})},[s]),p=t.useCallback(e=>{const t=Array.from(e).filter(e=>!(e.size>i.imageSettings.maxSize)||(console.warn(`File ${e.name} exceeds the allowed size of ${i.imageSettings.maxSize} bytes`),!1)).map((e,t)=>({id:Date.now()+t,file:e,url:URL.createObjectURL(e),index:t,isNew:!0,name:e.name,format:e.type}));i.refInput&&"current"in i.refInput&&i.refInput.current&&(i.refInput.current.value=""),t.length&&c(t)},[c,i.imageSettings.maxSize,i.refInput]);return{handleAdd:c,handleAddFiles:p}};
16
- //# sourceMappingURL=use-DEkooQyB.cjs.map
16
+ //# sourceMappingURL=use-DGVoIo0g.cjs.map