@jenesei-software/jenesei-kit-react 1.3.20 → 1.3.21

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 (203) hide show
  1. package/build/{area-DAgP6K9K.cjs → area-BG04bpxi.cjs} +2 -2
  2. package/build/{area-DAgP6K9K.cjs.map → area-BG04bpxi.cjs.map} +1 -1
  3. package/build/{area-CD8KKIM0.js → area-D4BoNEmX.js} +2 -2
  4. package/build/{area-CD8KKIM0.js.map → area-D4BoNEmX.js.map} +1 -1
  5. package/build/{area-BLgNLu9A.js → area-occQcGnD.js} +2 -2
  6. package/build/{area-BLgNLu9A.js.map → area-occQcGnD.js.map} +1 -1
  7. package/build/area-outside.cjs.js +1 -1
  8. package/build/area-outside.es.js +1 -1
  9. package/build/{area-Dup_lUb9.cjs → area-pCo19R2g.cjs} +2 -2
  10. package/build/{area-Dup_lUb9.cjs.map → area-pCo19R2g.cjs.map} +1 -1
  11. package/build/area-preview.cjs.js +1 -1
  12. package/build/area-preview.es.js +1 -1
  13. package/build/area-scroll.cjs.js +1 -1
  14. package/build/area-scroll.es.js +2 -2
  15. package/build/area-skeleton.cjs.js +1 -1
  16. package/build/area-skeleton.d.ts +6 -1
  17. package/build/area-skeleton.es.js +2 -3
  18. package/build/area-skeleton.es.js.map +1 -1
  19. package/build/area-smooth.cjs.js +1 -1
  20. package/build/area-smooth.es.js +1 -1
  21. package/build/{area.styles-DWqSyo49.js → area.styles-BSqCfPE4.js} +2 -2
  22. package/build/{area.styles-DWqSyo49.js.map → area.styles-BSqCfPE4.js.map} +1 -1
  23. package/build/area.styles-BuceLNra.cjs +27 -0
  24. package/build/{area.styles-DQBIvHdz.cjs.map → area.styles-BuceLNra.cjs.map} +1 -1
  25. package/build/build-info.txt +3 -3
  26. package/build/{component-GKvpOWlO.cjs → component-5Utdcc2G.cjs} +7 -7
  27. package/build/{component-GKvpOWlO.cjs.map → component-5Utdcc2G.cjs.map} +1 -1
  28. package/build/{component-BtgXUCiJ.js → component-B--Ljzf8.js} +2 -2
  29. package/build/{component-BtgXUCiJ.js.map → component-B--Ljzf8.js.map} +1 -1
  30. package/build/{component-BLa80fGE.cjs → component-Bq9jd15r.cjs} +2 -2
  31. package/build/{component-BLa80fGE.cjs.map → component-Bq9jd15r.cjs.map} +1 -1
  32. package/build/{component-DDVjxLvn.js → component-C3BrgaVs.js} +3 -3
  33. package/build/{component-DDVjxLvn.js.map → component-C3BrgaVs.js.map} +1 -1
  34. package/build/{component-CHmCK6Bc.js → component-C7SV3z2B.js} +2 -2
  35. package/build/{component-CHmCK6Bc.js.map → component-C7SV3z2B.js.map} +1 -1
  36. package/build/{component-BX7rFpno.js → component-C9TJVTRc.js} +7 -8
  37. package/build/{component-BX7rFpno.js.map → component-C9TJVTRc.js.map} +1 -1
  38. package/build/{component-6hRanOkU.cjs → component-CLqcB5mM.cjs} +2 -2
  39. package/build/{component-6hRanOkU.cjs.map → component-CLqcB5mM.cjs.map} +1 -1
  40. package/build/{component-DQrnK2Bj.js → component-CS7C3l76.js} +3 -3
  41. package/build/{component-DQrnK2Bj.js.map → component-CS7C3l76.js.map} +1 -1
  42. package/build/{component-DpVp9dB1.js → component-CUiqQLEQ.js} +2 -2
  43. package/build/{component-DpVp9dB1.js.map → component-CUiqQLEQ.js.map} +1 -1
  44. package/build/{component-DyEa0lzB.js → component-CWIsglCv.js} +3 -3
  45. package/build/{component-DyEa0lzB.js.map → component-CWIsglCv.js.map} +1 -1
  46. package/build/component-CZPL9hGj.cjs +2 -0
  47. package/build/{component-IlhRGJHX.cjs.map → component-CZPL9hGj.cjs.map} +1 -1
  48. package/build/{component-8NOxwZJO.cjs → component-Cc8X-Z80.cjs} +2 -2
  49. package/build/{component-8NOxwZJO.cjs.map → component-Cc8X-Z80.cjs.map} +1 -1
  50. package/build/{component-DerXrx9p.js → component-CeZFnxeP.js} +2 -2
  51. package/build/{component-DerXrx9p.js.map → component-CeZFnxeP.js.map} +1 -1
  52. package/build/{component-DhCe6E21.js → component-CqQpLjWf.js} +2 -2
  53. package/build/{component-DhCe6E21.js.map → component-CqQpLjWf.js.map} +1 -1
  54. package/build/{component-DF8wYX_U.js → component-DAMiuCOk.js} +3 -3
  55. package/build/{component-DF8wYX_U.js.map → component-DAMiuCOk.js.map} +1 -1
  56. package/build/{component-DdSHuopV.cjs → component-DBZIl6Pf.cjs} +2 -2
  57. package/build/{component-DdSHuopV.cjs.map → component-DBZIl6Pf.cjs.map} +1 -1
  58. package/build/{component-D9Fz-_ZH.cjs → component-DC6wk9OC.cjs} +2 -2
  59. package/build/{component-D9Fz-_ZH.cjs.map → component-DC6wk9OC.cjs.map} +1 -1
  60. package/build/{component-mzzOCXSx.js → component-DEZX8aBs.js} +2 -2
  61. package/build/{component-mzzOCXSx.js.map → component-DEZX8aBs.js.map} +1 -1
  62. package/build/{component-C-yqkm2n.cjs → component-DgtdqEgO.cjs} +2 -2
  63. package/build/{component-C-yqkm2n.cjs.map → component-DgtdqEgO.cjs.map} +1 -1
  64. package/build/{component-DXSNBORy.cjs → component-Dt1QKoQc.cjs} +2 -2
  65. package/build/{component-DXSNBORy.cjs.map → component-Dt1QKoQc.cjs.map} +1 -1
  66. package/build/component-DvuH4WLo.cjs +2 -0
  67. package/build/{component-KwYlKatx.cjs.map → component-DvuH4WLo.cjs.map} +1 -1
  68. package/build/{component-C56biWpi.js → component-HpOulBAQ.js} +3 -5
  69. package/build/{component-C56biWpi.js.map → component-HpOulBAQ.js.map} +1 -1
  70. package/build/{component-Cr62wN62.js → component-O7HvTkOa.js} +2 -2
  71. package/build/{component-Cr62wN62.js.map → component-O7HvTkOa.js.map} +1 -1
  72. package/build/{component-BLW4AlTi.cjs → component-PvY4ZuKa.cjs} +2 -2
  73. package/build/{component-BLW4AlTi.cjs.map → component-PvY4ZuKa.cjs.map} +1 -1
  74. package/build/{component-Ds6eJznV.cjs → component-SobV8wHk.cjs} +2 -2
  75. package/build/{component-Ds6eJznV.cjs.map → component-SobV8wHk.cjs.map} +1 -1
  76. package/build/{component-GqA6sCHI.cjs → component-VZLVznEM.cjs} +2 -2
  77. package/build/{component-GqA6sCHI.cjs.map → component-VZLVznEM.cjs.map} +1 -1
  78. package/build/component-accordion.cjs.js +1 -1
  79. package/build/component-accordion.d.ts +1 -1
  80. package/build/component-accordion.es.js +6 -6
  81. package/build/component-button-group.cjs.js +1 -1
  82. package/build/component-button-group.es.js +3 -3
  83. package/build/component-button.cjs.js +1 -1
  84. package/build/component-button.es.js +3 -3
  85. package/build/component-checkbox-group.cjs.js +1 -1
  86. package/build/component-checkbox-group.es.js +8 -8
  87. package/build/component-checkbox.cjs.js +1 -1
  88. package/build/component-checkbox.es.js +5 -5
  89. package/build/component-date-picker.cjs.js +1 -1
  90. package/build/component-date-picker.es.js +13 -13
  91. package/build/component-icon.cjs.js +1 -1
  92. package/build/component-icon.d.ts +16 -3
  93. package/build/component-icon.es.js +6 -5
  94. package/build/component-image-button.cjs.js +1 -1
  95. package/build/component-image-button.es.js +1 -1
  96. package/build/component-image-select.cjs.js +1 -1
  97. package/build/component-image-select.es.js +8 -8
  98. package/build/component-image-slider.cjs.js +1 -1
  99. package/build/component-image-slider.es.js +4 -4
  100. package/build/component-image.cjs.js +1 -1
  101. package/build/component-image.es.js +3 -3
  102. package/build/component-input-otp.cjs.js +1 -1
  103. package/build/component-input-otp.es.js +5 -5
  104. package/build/component-input.cjs.js +1 -1
  105. package/build/component-input.es.js +15 -15
  106. package/build/{component-DP42Uzl2.cjs → component-iyi7lqrB.cjs} +2 -2
  107. package/build/{component-DP42Uzl2.cjs.map → component-iyi7lqrB.cjs.map} +1 -1
  108. package/build/component-map.cjs.js +1 -1
  109. package/build/component-map.es.js +8 -8
  110. package/build/component-pagination.cjs.js +1 -1
  111. package/build/component-pagination.es.js +1 -1
  112. package/build/component-range.cjs.js +1 -1
  113. package/build/component-range.es.js +5 -5
  114. package/build/component-ripple.cjs.js +1 -1
  115. package/build/component-select.cjs.js +1 -1
  116. package/build/component-select.d.ts +1 -1
  117. package/build/component-select.es.js +18 -18
  118. package/build/component-separator.cjs.js +1 -1
  119. package/build/component-stack.cjs.js +1 -1
  120. package/build/component-stack.es.js +1 -1
  121. package/build/component-textarea.cjs.js +1 -1
  122. package/build/component-textarea.es.js +5 -5
  123. package/build/component-toggle.cjs.js +1 -1
  124. package/build/component-toggle.es.js +4 -4
  125. package/build/component-tooltip.cjs.js +1 -1
  126. package/build/component-tooltip.es.js +9 -9
  127. package/build/component-typography.cjs.js +1 -1
  128. package/build/component-typography.es.js +6 -6
  129. package/build/{component.components-B6FC2-ox.cjs → component.components-Cck7T25y.cjs} +2 -2
  130. package/build/{component.components-B6FC2-ox.cjs.map → component.components-Cck7T25y.cjs.map} +1 -1
  131. package/build/{component.components-DlJ9rcRL.js → component.components-NP2aSgyb.js} +2 -2
  132. package/build/{component.components-DlJ9rcRL.js.map → component.components-NP2aSgyb.js.map} +1 -1
  133. package/build/{component.constants-B-ZUZwuJ.js → component.constants-3UuU_a__.js} +3 -3
  134. package/build/{component.constants-B-ZUZwuJ.js.map → component.constants-3UuU_a__.js.map} +1 -1
  135. package/build/{component.constants-DwSQ9oe4.js → component.constants-B0mODNks.js} +6 -7
  136. package/build/{component.constants-DwSQ9oe4.js.map → component.constants-B0mODNks.js.map} +1 -1
  137. package/build/{component.constants-DiCmqOri.cjs → component.constants-CoFHa30V.cjs} +2 -2
  138. package/build/{component.constants-DiCmqOri.cjs.map → component.constants-CoFHa30V.cjs.map} +1 -1
  139. package/build/component.constants-vNAPiC5p.cjs +2 -0
  140. package/build/{component.constants-hDTTnj7k.cjs.map → component.constants-vNAPiC5p.cjs.map} +1 -1
  141. package/build/{component.types-CYtUJDuN.cjs → component.types-BRZsYWlH.cjs} +2 -2
  142. package/build/{component.types-CYtUJDuN.cjs.map → component.types-BRZsYWlH.cjs.map} +1 -1
  143. package/build/{component.types-DFRLIpd6.js → component.types-Cysm3D4v.js} +3 -3
  144. package/build/{component.types-DFRLIpd6.js.map → component.types-Cysm3D4v.js.map} +1 -1
  145. package/build/consts.cjs.js +1 -1
  146. package/build/consts.es.js +1 -1
  147. package/build/context-app.cjs.js +1 -1
  148. package/build/context-app.es.js +17 -17
  149. package/build/context-dialog.cjs.js +1 -1
  150. package/build/context-dialog.es.js +2 -2
  151. package/build/context-sonner.cjs.js +1 -1
  152. package/build/context-sonner.es.js +18 -18
  153. package/build/{context.constants-C5Unln0I.js → context.constants-BVl2x1gR.js} +302 -179
  154. package/build/context.constants-BVl2x1gR.js.map +1 -0
  155. package/build/{context.constants-CRxCVRKK.cjs → context.constants-BgXWD3zz.cjs} +2 -2
  156. package/build/{context.constants-CRxCVRKK.cjs.map → context.constants-BgXWD3zz.cjs.map} +1 -1
  157. package/build/{context.constants-CaDW-QGJ.js → context.constants-D-s5XvZX.js} +2 -2
  158. package/build/{context.constants-CaDW-QGJ.js.map → context.constants-D-s5XvZX.js.map} +1 -1
  159. package/build/{context.constants-DSfxf3ST.cjs → context.constants-YhrMPIvq.cjs} +285 -227
  160. package/build/context.constants-YhrMPIvq.cjs.map +1 -0
  161. package/build/{context.hooks-BfmhHvrX.cjs → context.hooks-99wJ8TBG.cjs} +2 -2
  162. package/build/{context.hooks-BfmhHvrX.cjs.map → context.hooks-99wJ8TBG.cjs.map} +1 -1
  163. package/build/{context.hooks-ByjHt-DO.cjs → context.hooks-B16qxQQY.cjs} +2 -2
  164. package/build/{context.hooks-ByjHt-DO.cjs.map → context.hooks-B16qxQQY.cjs.map} +1 -1
  165. package/build/{context.hooks-CKO6mDS-.js → context.hooks-DjwMqRSt.js} +2 -2
  166. package/build/{context.hooks-CKO6mDS-.js.map → context.hooks-DjwMqRSt.js.map} +1 -1
  167. package/build/{context.hooks-PU-CST61.cjs → context.hooks-Dkb5yK8Z.cjs} +2 -2
  168. package/build/{context.hooks-PU-CST61.cjs.map → context.hooks-Dkb5yK8Z.cjs.map} +1 -1
  169. package/build/{context.hooks-B2vWSael.js → context.hooks-KS9z3sac.js} +2 -2
  170. package/build/{context.hooks-B2vWSael.js.map → context.hooks-KS9z3sac.js.map} +1 -1
  171. package/build/{context.hooks-Bj9FlQEC.js → context.hooks-fo2TeZoK.js} +2 -2
  172. package/build/{context.hooks-Bj9FlQEC.js.map → context.hooks-fo2TeZoK.js.map} +1 -1
  173. package/build/index.cjs.js +1 -1
  174. package/build/index.d.ts +19 -7
  175. package/build/index.es.js +188 -190
  176. package/build/index.es.js.map +1 -1
  177. package/build/style-error.cjs.js +1 -1
  178. package/build/style-error.es.js +4 -4
  179. package/build/style-theme.cjs.js +1 -1
  180. package/build/style-theme.es.js +13 -13
  181. package/build/{use-7TZR9yNq.js → use-BI2JJFUm.js} +6 -6
  182. package/build/{use-7TZR9yNq.js.map → use-BI2JJFUm.js.map} +1 -1
  183. package/build/{use-DNJlP5ji.cjs → use-CtF6jyms.cjs} +3 -3
  184. package/build/{use-DNJlP5ji.cjs.map → use-CtF6jyms.cjs.map} +1 -1
  185. package/package.json +1 -1
  186. package/build/area-C5QUBcb-.js +0 -26
  187. package/build/area-C5QUBcb-.js.map +0 -1
  188. package/build/area-k8GR7Khj.cjs +0 -2
  189. package/build/area-k8GR7Khj.cjs.map +0 -1
  190. package/build/area.styles-BJCDsTi3.js +0 -46
  191. package/build/area.styles-BJCDsTi3.js.map +0 -1
  192. package/build/area.styles-CtrTLcAj.cjs +0 -40
  193. package/build/area.styles-CtrTLcAj.cjs.map +0 -1
  194. package/build/area.styles-DQBIvHdz.cjs +0 -27
  195. package/build/component-IlhRGJHX.cjs +0 -2
  196. package/build/component-KwYlKatx.cjs +0 -2
  197. package/build/component.constants-hDTTnj7k.cjs +0 -2
  198. package/build/component.styles-CNn9SMc9.cjs +0 -10
  199. package/build/component.styles-CNn9SMc9.cjs.map +0 -1
  200. package/build/component.styles-eaocqYbA.js +0 -16
  201. package/build/component.styles-eaocqYbA.js.map +0 -1
  202. package/build/context.constants-C5Unln0I.js.map +0 -1
  203. package/build/context.constants-DSfxf3ST.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),t=require("react"),o=require("./context.constants-DSfxf3ST.cjs"),n=require("./component.constants-DiCmqOri.cjs"),i=require("./component-GKvpOWlO.cjs"),r=require("./consts.cjs.js");require("./context.constants-CRxCVRKK.cjs");const a=require("./context.hooks-ByjHt-DO.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 n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{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,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var h,m,g,v,f,w,x,C,y,S,b,R,z,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(R=/\b(iPhone|iP[ao]d)/.exec(e),z=/\b(iP[ao]d)/.exec(e),S=/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 n=/(?:Trident\/(\d+.\d+))/.exec(e);w=n?parseFloat(n[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 i=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);x=!i||parseFloat(i[1].replace("_","."))}else x=!1;C=!!o[2],y=!!o[3]}else x=C=y=!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()||C},osx:function(){return M()||x},linux:function(){return M()||y},iphone:function(){return M()||R},mobile:function(){return M()||R||z||S||E},nativeApp:function(){return M()||D},android:function(){return M()||S},ipad:function(){return M()||z}},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-BcGej2Kr.cjs"),t=require("react"),o=require("./context.constants-YhrMPIvq.cjs"),n=require("./component.constants-CoFHa30V.cjs"),i=require("./component-5Utdcc2G.cjs"),r=require("./consts.cjs.js");require("./context.constants-BgXWD3zz.cjs");const a=require("./context.hooks-B16qxQQY.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 n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{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,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var h,m,g,v,f,w,x,C,S,y,b,R,z,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(R=/\b(iPhone|iP[ao]d)/.exec(e),z=/\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 n=/(?:Trident\/(\d+.\d+))/.exec(e);w=n?parseFloat(n[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 i=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);x=!i||parseFloat(i[1].replace("_","."))}else x=!1;C=!!o[2],S=!!o[3]}else x=C=S=!1}}var j,A={ie:function(){return M()||h},ieCompatibilityMode:function(){return M()||w>h},ie64:function(){return A.ie()&&b},firefox:function(){return M()||m},opera:function(){return M()||g},webkit:function(){return M()||v},safari:function(){return A.webkit()},chrome:function(){return M()||f},windows:function(){return M()||C},osx:function(){return M()||x},linux:function(){return M()||S},iphone:function(){return M()||R},mobile:function(){return M()||R||z||y||E},nativeApp:function(){return M()||D},android:function(){return M()||y},ipad:function(){return M()||z}},T=A,O={canUseDOM:!("undefined"==typeof window||!window.document||!window.document.createElement)};O.canUseDOM&&(j=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
  *
@@ -12,5 +12,5 @@
12
12
  * @return {boolean} True if the event is supported.
13
13
  * @internal
14
14
  * @license Modernizr 3.0.0pre (Custom Build) | MIT
15
- */;var W=T,_=function(e,t){if(!O.canUseDOM||t&&!("addEventListener"in document))return!1;var o="on"+e,n=o in document;if(!n){var i=document.createElement("div");i.setAttribute(o,"return;"),n="function"==typeof i[o]}return!n&&A&&"wheel"===e&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n};function L(e){var t=0,o=0,n=0,i=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),n=10*t,i=10*o,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||i)&&e.deltaMode&&(1==e.deltaMode?(n*=40,i*=40):(n*=800,i*=800)),n&&!t&&(t=n<1?-1:1),i&&!o&&(o=i<1?-1:1),{spinX:t,spinY:o,pixelX:n,pixelY:i}}L.getEventType=function(){return W.firefox()?"DOMMouseScroll":_("wheel")?"wheel":"mousewheel"};const N=u(L);function I(e,t,o,n,i){void 0===i&&(i=0);var r=B(t.width,t.height,i),a=r.width,s=r.height;return{x:F(e.x,a,o.width,n),y:F(e.y,s,o.height,n)}}function F(e,t,o,n){var i=t*n/2-o/2;return G(e,-i,i)}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 n=o*Math.PI/180;return{width:Math.abs(Math.cos(n)*e)+Math.abs(Math.sin(n)*t),height:Math.abs(Math.sin(n)*e)+Math.abs(Math.cos(n)*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.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.emitCropData(),o.setInitialCrop(e)),o.props.onMediaLoaded&&o.props.onMediaLoaded(o.mediaSize)},o.setInitialCrop=function(e){if(o.props.initialCroppedAreaPercentages){var t=function(e,t,o,n,i,r){var a=B(t.width,t.height,o),s=G(n.width/a.width*(100/e.width),i,r);return{crop:{x:s*a.width/2-n.width/2-a.width*s*(e.x/100),y:s*a.height/2-n.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),n=t.crop,i=t.zoom;o.props.onCropChange(n),o.props.onZoomChange&&o.props.onZoomChange(i)}else if(o.props.initialCroppedAreaPixels){var r=function(e,t,o,n,i,r){void 0===o&&(o=0);var a=B(t.naturalWidth,t.naturalHeight,o),s=G(function(e,t,o){var n=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*n):o.width/(e.width*n)}(e,t,n),i,r),c=n.height>n.width?n.height/e.height:n.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);n=r.crop,i=r.zoom;o.props.onCropChange(n),o.props.onZoomChange&&o.props.onZoomChange(i)}},o.computeSizes=function(){var e,t,n,i,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===(n=o.imageRef.current)||void 0===n?void 0:n.naturalHeight)||(null===(i=o.videoRef.current)||void 0===i?void 0:i.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,n,i,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,n);return p>u*i?{width:u*i,height:u}:{width:p,height:p/i}}(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 n=t.getMousePoint(e),i=o.gestureZoomStart-1+e.scale;if(o.setNewZoom(i,n,{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,n,i=e.x,r=e.y;o.dragStartPosition={x:i,y:r},o.dragStartCrop=l({},o.props.crop),null===(n=(t=o.props).onInteractionStart)||void 0===n||n.call(t)},o.onDrag=function(e){var t=e.x,n=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!==n){var e=t-o.dragStartPosition.x,i=n-o.dragStartPosition.y,r={x:o.dragStartCrop.x+e,y:o.dragStartCrop.y+i},a=o.props.restrictPosition?I(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 n=t.getMousePoint(e),i=N(e).pixelY,r=o.props.zoom-i*o.props.zoomSpeed/200;o.setNewZoom(r,n,{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 n=e.x,i=e.y;if(!o.containerRect)throw new Error("The Cropper is not mounted");return{x:o.containerRect.width/2-(n-t.x),y:o.containerRect.height/2-(i-t.y)}},o.getPointOnMedia=function(e){var t=e.x,n=e.y,i=o.props,r=i.crop,a=i.zoom;return{x:(t+r.x)/a,y:(n+r.y)/a}},o.setNewZoom=function(e,t,n){var i=(void 0===n?{}:n).shouldUpdatePosition,r=void 0===i||i;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?I(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,n,i,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/i)/2-e.x/i)/c.width*100),y:s(100,((c.height-o.height/i)/2-e.y/i)/c.height*100),width:s(100,o.width/c.width*100/i),height:s(100,o.height/c.height*100/i)},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*n?{width:Math.round(h*n),height:h}:{width:d,height:Math.round(d/n)};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?I(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,n=e.croppedAreaPixels;o.props.onCropComplete&&o.props.onCropComplete(t,n),o.props.onCropAreaChange&&o.props.onCropAreaChange(t,n)}},o.emitCropAreaChange=function(){var e=o.getCropData();if(e){var t=e.croppedAreaPercentages,n=e.croppedAreaPixels;o.props.onCropAreaChange&&o.props.onCropAreaChange(t,n)}},o.recomputeCropPosition=function(){if(o.state.cropSize){var e=o.props.restrictPosition?I(o.props.crop,o.mediaSize,o.state.cropSize,o.props.zoom,o.props.rotation):o.props.crop;o.props.onCropChange(e),o.emitCropData()}},o.onKeyDown=function(e){var t,n,i=o.props,r=i.crop,a=i.onCropChange,s=i.keyboardStep,c=i.zoom,p=i.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=I(d,o.mediaSize,o.state.cropSize,c,p)),e.repeat||null===(n=(t=o.props).onInteractionStart)||void 0===n||n.call(t),a(d)}},o.onKeyUp=function(e){var t,n;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":e.preventDefault();break;default:return}o.emitCropData(),null===(n=(t=o.props).onInteractionEnd)||void 0===n||n.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,n,i,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===(n=e.cropSize)||void 0===n?void 0:n.width)!==(null===(i=this.props.cropSize)||void 0===i?void 0:i.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,n;if("cover"===this.props.objectFit){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var i=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===(n=this.videoRef.current)||void 0===n?void 0:n.videoHeight)||0)<i?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},t.prototype.onPinchStart=function(e){var o=t.getTouchPoint(e.touches[0]),n=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=k(o,n),this.lastPinchRotation=Z(o,n),this.onDragStart(q(o,n))},t.prototype.onPinchMove=function(e){var o=this;if(this.currentDoc&&this.currentWindow){var n=t.getTouchPoint(e.touches[0]),i=t.getTouchPoint(e.touches[1]),r=q(n,i);this.onDrag(r),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var e=k(n,i),t=o.props.zoom*(e/o.lastPinchDistance);o.setNewZoom(t,r,{shouldUpdatePosition:!1}),o.lastPinchDistance=e;var a=Z(n,i),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,n=o.image,i=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.style,w=f.containerStyle,x=f.cropAreaStyle,C=f.mediaStyle,y=o.classes,S=y.containerClassName,b=y.cropAreaClassName,R=y.mediaClassName,z=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:w,className:X("reactEasyCrop_Container",S)},n?p.createElement("img",l({alt:"",className:X("reactEasyCrop_Image","contain"===z&&"reactEasyCrop_Contain","horizontal-cover"===z&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===z&&"reactEasyCrop_Cover_Vertical",R)},r,{src:n,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})):i&&p.createElement("video",l({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:X("reactEasyCrop_Video","contain"===z&&"reactEasyCrop_Contain","horizontal-cover"===z&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===z&&"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(i)?i:[{src:i}]).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({},x),{width:this.state.cropSize.width,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",b)},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),[C,y]=t.useState([]),[S,b]=t.useState([]),R=s.useTheme(),z=t.useMemo(()=>a.images.length>1,[a.images.length]),D=t.useMemo(()=>null==C?void 0:C[w],[C,w]),E=t.useCallback(async e=>{var t,o,n;const i=await Promise.all(e.map(async e=>{const t=S[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 n=r.LIST_IMAGE_SUPPORTED_FORMAT.includes(o)?o:"image/png";return new Promise((o,i)=>{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):i(new Error("Canvas is empty"))},n)},r.onerror=()=>i(new Error("Failed to load image"))})}(e.url,t,e.format),n=new File([o],e.name,{type:e.format});return{...e,file:n,url:URL.createObjectURL(n)}}));null==(o=null==(t=a.params)?void 0:t.onSave)||o.call(t,i.filter(Boolean)),null==(n=a.remove)||n.call(a)},[S,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(y(o=>{const n=[...o];return n[e.index]=t,n}),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(()=>{y(a.images),b(a.images.map(e=>e.croppedArea??null))},[a.images]),t.useEffect(()=>()=>{x(0),y([]),b([])},[]);const M=t.useMemo(()=>C.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),{}),[C]),A=t.useMemo(()=>C.every(e=>(null==e?void 0:e.isDeleted)||!(null==e?void 0:e.isCropped)),[C]),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(i.Stack,{sx:e=>{var t,o,n;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==(n=a.params)?void 0:n.br,backgroundColor:e.palette.whiteStandard},tablet:{maxWidth:"95dvw"}}},children:[e.jsxRuntimeExports.jsxs(o.Preview,{visible:!a.isAnimating,minTime:500,children:[e.jsxRuntimeExports.jsx(i.Stack,{sx:{default:{position:"absolute",top:0,left:0,right:0,bottom:0}},children:D&&e.jsxRuntimeExports.jsx(V,{style:{containerStyle:{backgroundColor:R.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(i.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}),z&&e.jsxRuntimeExports.jsx(o.Button,{genre:j,size:T,isHiddenBorder:!0,isRadius:!0,onClick:()=>E(C),isHidden:A,isDisabled:A,children:null==(m=a.params)?void 0:m.locale.dialogSave})]})]}),z&&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(i.Stack,{sx:e=>({default:{position:"absolute",bottom:z?5:15,left:z?5:void 0,right:z?void 0:15,width:z?"calc(100% - 10px)":"fit-content",backgroundColor:z?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:[z&&e.jsxRuntimeExports.jsx(n.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(i.Stack,{sx:{default:{gap:"10px"},mobile:{justifyContent:"center"}},children:[z&&e.jsxRuntimeExports.jsx(o.Button,{genre:O,size:W,isHiddenBorder:!0,isRadius:!0,onClick:()=>{P({...D,isDeleted:!0,isNext:z})},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:z,isSave:!z})},children:z?null==(v=a.params)?void 0:v.locale.dialogAddImage:null==(f=a.params)?void 0:f.locale.dialogSave})]})]})]})};exports.useImageCrop=n=>{const i=t.useMemo(()=>o.KEY_SIZE_DATA[n.dialog.button.size],[n.dialog.button.size]),r=t.useMemo(()=>`${i.radius}px`,[i.radius]),{add:s}=a.useDialog({br:r,imageSettings:n.imageSettings,onSave:n.onSave,dialog:n.dialog,locale:n.locale,propsDialog:{borderRadius:r,padding:"0",background:"transparent"}}),c=t.useCallback(t=>{s({content:(o,n,i)=>e.jsxRuntimeExports.jsx(Y,{images:t,params:o,remove:n,isAnimating:i})})},[s]),p=t.useCallback(e=>{const t=Array.from(e).filter(e=>!(e.size>n.imageSettings.maxSize)||(console.warn(`File ${e.name} exceeds the allowed size of ${n.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}));n.refInput&&"current"in n.refInput&&n.refInput.current&&(n.refInput.current.value=""),t.length&&c(t)},[c,n.imageSettings.maxSize,n.refInput]);return{handleAdd:c,handleAddFiles:p}};
16
- //# sourceMappingURL=use-DNJlP5ji.cjs.map
15
+ */;var W=T,_=function(e,t){if(!O.canUseDOM||t&&!("addEventListener"in document))return!1;var o="on"+e,n=o in document;if(!n){var i=document.createElement("div");i.setAttribute(o,"return;"),n="function"==typeof i[o]}return!n&&j&&"wheel"===e&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n};function L(e){var t=0,o=0,n=0,i=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),n=10*t,i=10*o,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||i)&&e.deltaMode&&(1==e.deltaMode?(n*=40,i*=40):(n*=800,i*=800)),n&&!t&&(t=n<1?-1:1),i&&!o&&(o=i<1?-1:1),{spinX:t,spinY:o,pixelX:n,pixelY:i}}L.getEventType=function(){return W.firefox()?"DOMMouseScroll":_("wheel")?"wheel":"mousewheel"};const I=u(L);function N(e,t,o,n,i){void 0===i&&(i=0);var r=B(t.width,t.height,i),a=r.width,s=r.height;return{x:F(e.x,a,o.width,n),y:F(e.y,s,o.height,n)}}function F(e,t,o,n){var i=t*n/2-o/2;return G(e,-i,i)}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 n=o*Math.PI/180;return{width:Math.abs(Math.cos(n)*e)+Math.abs(Math.sin(n)*t),height:Math.abs(Math.sin(n)*e)+Math.abs(Math.cos(n)*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 K=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.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.emitCropData(),o.setInitialCrop(e)),o.props.onMediaLoaded&&o.props.onMediaLoaded(o.mediaSize)},o.setInitialCrop=function(e){if(o.props.initialCroppedAreaPercentages){var t=function(e,t,o,n,i,r){var a=B(t.width,t.height,o),s=G(n.width/a.width*(100/e.width),i,r);return{crop:{x:s*a.width/2-n.width/2-a.width*s*(e.x/100),y:s*a.height/2-n.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),n=t.crop,i=t.zoom;o.props.onCropChange(n),o.props.onZoomChange&&o.props.onZoomChange(i)}else if(o.props.initialCroppedAreaPixels){var r=function(e,t,o,n,i,r){void 0===o&&(o=0);var a=B(t.naturalWidth,t.naturalHeight,o),s=G(function(e,t,o){var n=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*n):o.width/(e.width*n)}(e,t,n),i,r),c=n.height>n.width?n.height/e.height:n.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);n=r.crop,i=r.zoom;o.props.onCropChange(n),o.props.onZoomChange&&o.props.onZoomChange(i)}},o.computeSizes=function(){var e,t,n,i,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===(n=o.imageRef.current)||void 0===n?void 0:n.naturalHeight)||(null===(i=o.videoRef.current)||void 0===i?void 0:i.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,n,i,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,n);return p>u*i?{width:u*i,height:u}:{width:p,height:p/i}}(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 n=t.getMousePoint(e),i=o.gestureZoomStart-1+e.scale;if(o.setNewZoom(i,n,{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,n,i=e.x,r=e.y;o.dragStartPosition={x:i,y:r},o.dragStartCrop=l({},o.props.crop),null===(n=(t=o.props).onInteractionStart)||void 0===n||n.call(t)},o.onDrag=function(e){var t=e.x,n=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!==n){var e=t-o.dragStartPosition.x,i=n-o.dragStartPosition.y,r={x:o.dragStartCrop.x+e,y:o.dragStartCrop.y+i},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 n=t.getMousePoint(e),i=I(e).pixelY,r=o.props.zoom-i*o.props.zoomSpeed/200;o.setNewZoom(r,n,{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 n=e.x,i=e.y;if(!o.containerRect)throw new Error("The Cropper is not mounted");return{x:o.containerRect.width/2-(n-t.x),y:o.containerRect.height/2-(i-t.y)}},o.getPointOnMedia=function(e){var t=e.x,n=e.y,i=o.props,r=i.crop,a=i.zoom;return{x:(t+r.x)/a,y:(n+r.y)/a}},o.setNewZoom=function(e,t,n){var i=(void 0===n?{}:n).shouldUpdatePosition,r=void 0===i||i;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,n,i,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/i)/2-e.x/i)/c.width*100),y:s(100,((c.height-o.height/i)/2-e.y/i)/c.height*100),width:s(100,o.width/c.width*100/i),height:s(100,o.height/c.height*100/i)},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*n?{width:Math.round(h*n),height:h}:{width:d,height:Math.round(d/n)};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,n=e.croppedAreaPixels;o.props.onCropComplete&&o.props.onCropComplete(t,n),o.props.onCropAreaChange&&o.props.onCropAreaChange(t,n)}},o.emitCropAreaChange=function(){var e=o.getCropData();if(e){var t=e.croppedAreaPercentages,n=e.croppedAreaPixels;o.props.onCropAreaChange&&o.props.onCropAreaChange(t,n)}},o.recomputeCropPosition=function(){if(o.state.cropSize){var e=o.props.restrictPosition?N(o.props.crop,o.mediaSize,o.state.cropSize,o.props.zoom,o.props.rotation):o.props.crop;o.props.onCropChange(e),o.emitCropData()}},o.onKeyDown=function(e){var t,n,i=o.props,r=i.crop,a=i.onCropChange,s=i.keyboardStep,c=i.zoom,p=i.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===(n=(t=o.props).onInteractionStart)||void 0===n||n.call(t),a(d)}},o.onKeyUp=function(e){var t,n;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":e.preventDefault();break;default:return}o.emitCropData(),null===(n=(t=o.props).onInteractionEnd)||void 0===n||n.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,n,i,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===(n=e.cropSize)||void 0===n?void 0:n.width)!==(null===(i=this.props.cropSize)||void 0===i?void 0:i.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,n;if("cover"===this.props.objectFit){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var i=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===(n=this.videoRef.current)||void 0===n?void 0:n.videoHeight)||0)<i?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},t.prototype.onPinchStart=function(e){var o=t.getTouchPoint(e.touches[0]),n=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=k(o,n),this.lastPinchRotation=Z(o,n),this.onDragStart(q(o,n))},t.prototype.onPinchMove=function(e){var o=this;if(this.currentDoc&&this.currentWindow){var n=t.getTouchPoint(e.touches[0]),i=t.getTouchPoint(e.touches[1]),r=q(n,i);this.onDrag(r),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var e=k(n,i),t=o.props.zoom*(e/o.lastPinchDistance);o.setNewZoom(t,r,{shouldUpdatePosition:!1}),o.lastPinchDistance=e;var a=Z(n,i),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,n=o.image,i=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.style,w=f.containerStyle,x=f.cropAreaStyle,C=f.mediaStyle,S=o.classes,y=S.containerClassName,b=S.cropAreaClassName,R=S.mediaClassName,z=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:w,className:X("reactEasyCrop_Container",y)},n?p.createElement("img",l({alt:"",className:X("reactEasyCrop_Image","contain"===z&&"reactEasyCrop_Contain","horizontal-cover"===z&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===z&&"reactEasyCrop_Cover_Vertical",R)},r,{src:n,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})):i&&p.createElement("video",l({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:X("reactEasyCrop_Video","contain"===z&&"reactEasyCrop_Contain","horizontal-cover"===z&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===z&&"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(i)?i:[{src:i}]).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({},x),{width:this.state.cropSize.width,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",b)},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 V=a=>{var c,p,u,d,l,h,m,g,v,f;const[w,x]=t.useState(0),[C,S]=t.useState([]),[y,b]=t.useState([]),R=s.useTheme(),z=t.useMemo(()=>a.images.length>1,[a.images.length]),D=t.useMemo(()=>null==C?void 0:C[w],[C,w]),E=t.useCallback(async e=>{var t,o,n;const i=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 n=r.LIST_IMAGE_SUPPORTED_FORMAT.includes(o)?o:"image/png";return new Promise((o,i)=>{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):i(new Error("Canvas is empty"))},n)},r.onerror=()=>i(new Error("Failed to load image"))})}(e.url,t,e.format),n=new File([o],e.name,{type:e.format});return{...e,file:n,url:URL.createObjectURL(n)}}));null==(o=null==(t=a.params)?void 0:t.onSave)||o.call(t,i.filter(Boolean)),null==(n=a.remove)||n.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(S(o=>{const n=[...o];return n[e.index]=t,n}),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(()=>{S(a.images),b(a.images.map(e=>e.croppedArea??null))},[a.images]),t.useEffect(()=>()=>{x(0),S([]),b([])},[]);const M=t.useMemo(()=>C.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),{}),[C]),j=t.useMemo(()=>C.every(e=>(null==e?void 0:e.isDeleted)||!(null==e?void 0:e.isCropped)),[C]),A=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(i.Stack,{sx:e=>{var t,o,n;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==(n=a.params)?void 0:n.br,backgroundColor:e.palette.whiteStandard},tablet:{maxWidth:"95dvw"}}},children:[e.jsxRuntimeExports.jsxs(o.Preview,{visible:!a.isAnimating,minTime:500,children:[e.jsxRuntimeExports.jsx(i.Stack,{sx:{default:{position:"absolute",top:0,left:0,right:0,bottom:0}},children:D&&e.jsxRuntimeExports.jsx(K,{style:{containerStyle:{backgroundColor:R.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(i.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}),z&&e.jsxRuntimeExports.jsx(o.Button,{genre:A,size:T,isHiddenBorder:!0,isRadius:!0,onClick:()=>E(C),isHidden:j,isDisabled:j,children:null==(m=a.params)?void 0:m.locale.dialogSave})]})]}),z&&w!==a.images.length&&e.jsxRuntimeExports.jsx(o.Button,{sx:{default:{position:"absolute",top:15,left:15}},genre:A,size:T,isHiddenBorder:!0,isWidthAsHeight:!0,isRadius:!0,isDisabled:!0,children:w+1}),e.jsxRuntimeExports.jsxs(i.Stack,{sx:e=>({default:{position:"absolute",bottom:z?5:15,left:z?5:void 0,right:z?void 0:15,width:z?"calc(100% - 10px)":"fit-content",backgroundColor:z?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:[z&&e.jsxRuntimeExports.jsx(n.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:A,size:T,isRadius:!0,isWidthAsHeight:!0},buttonCount:{active:{genre:A,size:T,isRadius:!0,isPlaystationEffect:!0},inactive:{genre:"white",size:T,isRadius:!0}},locale:{next:"Next",prev:"Prev"}}),e.jsxRuntimeExports.jsxs(i.Stack,{sx:{default:{gap:"10px"},mobile:{justifyContent:"center"}},children:[z&&e.jsxRuntimeExports.jsx(o.Button,{genre:O,size:W,isHiddenBorder:!0,isRadius:!0,onClick:()=>{P({...D,isDeleted:!0,isNext:z})},children:null==(g=a.params)?void 0:g.locale.dialogDeleteImage}),e.jsxRuntimeExports.jsx(o.Button,{genre:A,size:T,isHiddenBorder:!0,isRadius:!0,onClick:()=>{P({...D,isDeleted:!1,isCropped:!0,isNext:z,isSave:!z})},children:z?null==(v=a.params)?void 0:v.locale.dialogAddImage:null==(f=a.params)?void 0:f.locale.dialogSave})]})]})]})};exports.useImageCrop=n=>{const i=t.useMemo(()=>o.KEY_SIZE_DATA[n.dialog.button.size],[n.dialog.button.size]),r=t.useMemo(()=>`${i.radius}px`,[i.radius]),{add:s}=a.useDialog({br:r,imageSettings:n.imageSettings,onSave:n.onSave,dialog:n.dialog,locale:n.locale,propsDialog:{borderRadius:r,padding:"0",background:"transparent"}}),c=t.useCallback(t=>{s({content:(o,n,i)=>e.jsxRuntimeExports.jsx(V,{images:t,params:o,remove:n,isAnimating:i})})},[s]),p=t.useCallback(e=>{const t=Array.from(e).filter(e=>!(e.size>n.imageSettings.maxSize)||(console.warn(`File ${e.name} exceeds the allowed size of ${n.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}));n.refInput&&"current"in n.refInput&&n.refInput.current&&(n.refInput.current.value=""),t.length&&c(t)},[c,n.imageSettings.maxSize,n.refInput]);return{handleAdd:c,handleAddFiles:p}};
16
+ //# sourceMappingURL=use-CtF6jyms.cjs.map