@datagrok/eda 1.4.13 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +11 -5
  2. package/dist/111.js +1 -1
  3. package/dist/111.js.map +1 -1
  4. package/dist/128.js +1 -1
  5. package/dist/128.js.map +1 -1
  6. package/dist/153.js +1 -1
  7. package/dist/153.js.map +1 -1
  8. package/dist/23.js +1 -1
  9. package/dist/23.js.map +1 -1
  10. package/dist/234.js +1 -1
  11. package/dist/234.js.map +1 -1
  12. package/dist/242.js +1 -1
  13. package/dist/242.js.map +1 -1
  14. package/dist/260.js +1 -1
  15. package/dist/260.js.map +1 -1
  16. package/dist/33.js +1 -1
  17. package/dist/33.js.map +1 -1
  18. package/dist/348.js +1 -1
  19. package/dist/348.js.map +1 -1
  20. package/dist/377.js +1 -1
  21. package/dist/377.js.map +1 -1
  22. package/dist/397.js +2 -0
  23. package/dist/397.js.map +1 -0
  24. package/dist/412.js +1 -1
  25. package/dist/412.js.map +1 -1
  26. package/dist/415.js +1 -1
  27. package/dist/415.js.map +1 -1
  28. package/dist/501.js +1 -1
  29. package/dist/501.js.map +1 -1
  30. package/dist/531.js +1 -1
  31. package/dist/531.js.map +1 -1
  32. package/dist/583.js +1 -1
  33. package/dist/583.js.map +1 -1
  34. package/dist/589.js +1 -1
  35. package/dist/589.js.map +1 -1
  36. package/dist/603.js +1 -1
  37. package/dist/603.js.map +1 -1
  38. package/dist/656.js +1 -1
  39. package/dist/656.js.map +1 -1
  40. package/dist/682.js +1 -1
  41. package/dist/682.js.map +1 -1
  42. package/dist/705.js +1 -1
  43. package/dist/705.js.map +1 -1
  44. package/dist/727.js +1 -1
  45. package/dist/727.js.map +1 -1
  46. package/dist/731.js +1 -1
  47. package/dist/731.js.map +1 -1
  48. package/dist/738.js +1 -1
  49. package/dist/738.js.map +1 -1
  50. package/dist/763.js +1 -1
  51. package/dist/763.js.map +1 -1
  52. package/dist/778.js +1 -1
  53. package/dist/778.js.map +1 -1
  54. package/dist/783.js +1 -1
  55. package/dist/783.js.map +1 -1
  56. package/dist/793.js +1 -1
  57. package/dist/793.js.map +1 -1
  58. package/dist/810.js +1 -1
  59. package/dist/810.js.map +1 -1
  60. package/dist/860.js +1 -1
  61. package/dist/860.js.map +1 -1
  62. package/dist/907.js +1 -1
  63. package/dist/907.js.map +1 -1
  64. package/dist/950.js +1 -1
  65. package/dist/950.js.map +1 -1
  66. package/dist/980.js +1 -1
  67. package/dist/980.js.map +1 -1
  68. package/dist/990.js +1 -1
  69. package/dist/990.js.map +1 -1
  70. package/dist/package-test.js +1 -1
  71. package/dist/package-test.js.map +1 -1
  72. package/dist/package.js +1 -1
  73. package/dist/package.js.map +1 -1
  74. package/package.json +5 -5
  75. package/src/package.ts +2 -1
  76. package/src/pareto-optimization/pareto-optimizer.ts +1 -1
  77. package/src/pls/pls-constants.ts +8 -1
  78. package/src/pls/pls-tools.ts +176 -74
  79. package/src/probabilistic-scoring/data-generator.ts +48 -3
  80. package/src/probabilistic-scoring/pmpo-defs.ts +30 -2
  81. package/src/probabilistic-scoring/pmpo-utils.ts +143 -52
  82. package/src/probabilistic-scoring/prob-scoring.ts +477 -104
  83. package/src/probabilistic-scoring/stat-tools.ts +1 -1
  84. package/src/tests/pareto-tests.ts +13 -15
  85. package/src/tests/pmpo-tests.ts +643 -3
  86. package/test-console-output-1.log +224 -86
  87. package/test-record-1.mp4 +0 -0
package/dist/397.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunkeda=self.webpackChunkeda||[]).push([[397],{9696(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Animation=void 0;const n=i(8871),r=i(4060),a=n.glob.performance&&n.glob.performance.now?function(){return n.glob.performance.now()}:function(){return(new Date).getTime()};class s{constructor(t,e){this.id=s.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:a(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,i=e.length;for(let n=0;n<i;n++)if(e[n]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const t=s.animations,e=t.length;for(let i=0;i<e;i++)if(t[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=a(),s._addAnimation(this),this}stop(){return s._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,i=this.animations,n=i.length;for(let t=0;t<n;t++)if(i[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){const t={},e=this.animations;for(let i=0;i<e.length;i++){const n=e[i],r=n.layers,s=n.func;n._updateFrameObject(a());const o=r.length;let h;if(h=!s||!1!==s.call(n,n.frame),h)for(let e=0;e<o;e++){const i=r[e];void 0!==i._id&&(t[i._id]=i)}}for(const e in t)t.hasOwnProperty(e)&&t[e].batchDraw()}static _animationLoop(){const t=s;t.animations.length?(t._runFrames(),r.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,r.Util.requestAnimFrame(this._animationLoop))}}e.Animation=s,s.animations=[],s.animIdCounter=0,s.animRunning=!1},5570(t,e){function i(t,e,i){const r=n(1,i,t),a=n(1,i,e),s=r*r+a*a;return Math.sqrt(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.t2length=e.getQuadraticArcLength=e.getCubicArcLength=e.binomialCoefficients=e.cValues=e.tValues=void 0,e.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],e.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],e.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]],e.getCubicArcLength=(t,n,r)=>{let a,s;const o=r/2;a=0;for(let r=0;r<20;r++)s=o*e.tValues[20][r]+o,a+=e.cValues[20][r]*i(t,n,s);return o*a},e.getQuadraticArcLength=(t,e,i)=>{void 0===i&&(i=1);const n=t[0]-2*t[1]+t[2],r=e[0]-2*e[1]+e[2],a=2*t[1]-2*t[0],s=2*e[1]-2*e[0],o=4*(n*n+r*r),h=4*(n*a+r*s),l=a*a+s*s;if(0===o)return i*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const d=h/(2*o),c=i+d,g=l/o-d*d,u=c*c+g>0?Math.sqrt(c*c+g):0,f=d*d+g>0?Math.sqrt(d*d+g):0,p=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((c+u)/(d+f))):0;return Math.sqrt(o)/2*(c*u-d*f+p)};const n=(t,i,r)=>{const a=r.length-1;let s,o;if(0===a)return 0;if(0===t){o=0;for(let t=0;t<=a;t++)o+=e.binomialCoefficients[a][t]*Math.pow(1-i,a-t)*Math.pow(i,t)*r[t];return o}s=new Array(a);for(let t=0;t<a;t++)s[t]=a*(r[t+1]-r[t]);return n(t-1,i,s)};e.t2length=(t,e,i)=>{let n=1,r=t/e,a=(t-i(r))/e,s=0;for(;n>.001;){const o=i(r+a),h=Math.abs(t-o)/e;if(h<n)n=h,r+=a;else{const s=i(r-a),o=Math.abs(t-s)/e;o<n?(n=o,r-=a):a/=2}if(s++,s>500)break}return r}},8604(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.HitCanvas=e.SceneCanvas=e.Canvas=void 0;const n=i(4060),r=i(9869),a=i(8871);let s;class o{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const e=(t||{}).pixelRatio||a.Konva.pixelRatio||function(){if(s)return s;const t=n.Util.createCanvasElement(),e=t.getContext("2d");return s=(a.Konva._global.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),n.Util.releaseCanvas(t),s}();this.pixelRatio=e,this._canvas=n.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){const e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch(t){try{return this._canvas.toDataURL()}catch(t){return n.Util.error("Unable to get data URL. "+t.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}e.Canvas=o,e.SceneCanvas=class extends o{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new r.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}},e.HitCanvas=class extends o{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new r.HitContext(this),this.setSize(t.width,t.height)}}},4473(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Container=void 0;const n=i(4892),r=i(6536),a=i(5483);class s extends r.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){const e=this.children||[];return t?e.filter(t):e}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(0===t.length)return this;if(t.length>1){for(let e=0;e<t.length;e++)this.add(t[e]);return this}const e=t[0];return e.getParent()?(e.moveTo(this),this):(this._validateAdd(e),e.index=this.getChildren().length,e.parent=this,e._clearCaches(),this.getChildren().push(e),this._fire("add",{child:e}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){const e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){const i=[];return this._descendants(n=>{const r=n._isMatch(t);return r&&i.push(n),!(!r||!e)}),i}_descendants(t){let e=!1;const i=this.getChildren();for(const n of i){if(e=t(n),e)return!0;if(n.hasChildren()&&(e=n._descendants(t),e))return!0}return!1}toObject(){const t=r.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){let e=t.getParent();for(;e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){const e=r.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(t){e.add(t.clone())}),e}getAllIntersections(t){const e=[];return this.find("Shape").forEach(i=>{i.isVisible()&&i.intersects(t)&&e.push(i)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null===(e=this.children)||void 0===e||e.forEach(function(e){e._clearSelfAndDescendantCache(t)})}_setChildrenIndices(){var t;null===(t=this.children)||void 0===t||t.forEach(function(t,e){t.index=e}),this._requestDraw()}drawScene(t,e,i){const n=this.getLayer(),r=t||n&&n.getCanvas(),a=r&&r.getContext(),s=this._getCanvasCache(),o=s&&s.scene,h=r&&r.isCache;if(!this.isVisible()&&!h)return this;if(o){a.save();const t=this.getAbsoluteTransform(e).getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",r,e,i);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;const i=this.getLayer(),n=t||i&&i.hitCanvas,r=n&&n.getContext(),a=this._getCanvasCache();if(a&&a.hit){r.save();const t=this.getAbsoluteTransform(e).getMatrix();r.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(r),r.restore()}else this._drawChildren("drawHit",n,e);return this}_drawChildren(t,e,i,n){var r;const a=e&&e.getContext(),s=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l="number"==typeof s&&"number"==typeof o||h,d=i===this;if(l){a.save();const t=this.getAbsoluteTransform(i);let e,n=t.getMatrix();if(a.transform(n[0],n[1],n[2],n[3],n[4],n[5]),a.beginPath(),h)e=h.call(this,a,this);else{const t=this.clipX(),e=this.clipY();a.rect(t||0,e||0,s,o)}a.clip.apply(a,e),n=t.copy().invert().getMatrix(),a.transform(n[0],n[1],n[2],n[3],n[4],n[5])}const c=!d&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;c&&(a.save(),a._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach(function(r){r[t](e,i,n)}),c&&a.restore(),l&&a.restore()}getClientRect(t={}){var e;const i=t.skipTransform,n=t.relativeTo;let r,a,s,o,h={x:1/0,y:1/0,width:0,height:0};const l=this;null===(e=this.children)||void 0===e||e.forEach(function(e){if(!e.visible())return;const i=e.getClientRect({relativeTo:l,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===i.width&&0===i.height||(void 0===r?(r=i.x,a=i.y,s=i.x+i.width,o=i.y+i.height):(r=Math.min(r,i.x),a=Math.min(a,i.y),s=Math.max(s,i.x+i.width),o=Math.max(o,i.y+i.height)))});const d=this.find("Shape");let c=!1;for(let t=0;t<d.length;t++)if(d[t]._isVisible(this)){c=!0;break}return h=c&&void 0!==r?{x:r,y:a,width:s-r,height:o-a}:{x:0,y:0,width:0,height:0},i?h:this._transformedRect(h,n)}}e.Container=s,n.Factory.addComponentsGetterSetter(s,"clip",["x","y","width","height"]),n.Factory.addGetterSetter(s,"clipX",void 0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(s,"clipY",void 0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(s,"clipWidth",void 0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(s,"clipHeight",void 0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(s,"clipFunc")},9869(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.HitContext=e.SceneContext=e.Context=void 0;const n=i(4060),r=i(8871),a=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class s{constructor(t){this.canvas=t,r.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){let i,r,a,s,o=this.traceArr,h=o.length,l="";for(i=0;i<h;i++)r=o[i],a=r.method,a?(s=r.args,l+=a,t?l+="()":n.Util._isArray(s[0])?l+="(["+s.join(",")+"])":(e&&(s=s.map(t=>"number"==typeof t?Math.floor(t):t)),l+="("+s.join(",")+")")):(l+=r.property,t||(l+="="+r.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(t){let e,i=this.traceArr;i.push(t),e=i.length,e>=100&&i.shift()}reset(){const t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){const e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){const e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,n,r,a){this._context.arc(t,e,i,n,r,a)}arcTo(t,e,i,n,r){this._context.arcTo(t,e,i,n,r)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,n,r,a){this._context.bezierCurveTo(t,e,i,n,r,a)}clearRect(t,e,i,n){this._context.clearRect(t,e,i,n)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){const i=arguments;return 2===i.length?this._context.createImageData(t,e):1===i.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,i,n){return this._context.createLinearGradient(t,e,i,n)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,n,r,a){return this._context.createRadialGradient(t,e,i,n,r,a)}drawImage(t,e,i,n,r,a,s,o,h){const l=arguments,d=this._context;3===l.length?d.drawImage(t,e,i):5===l.length?d.drawImage(t,e,i,n,r):9===l.length&&d.drawImage(t,e,i,n,r,a,s,o,h)}ellipse(t,e,i,n,r,a,s,o){this._context.ellipse(t,e,i,n,r,a,s,o)}isPointInPath(t,e,i,n){return i?this._context.isPointInPath(i,t,e,n):this._context.isPointInPath(t,e,n)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,i,n){this._context.fillRect(t,e,i,n)}strokeRect(t,e,i,n){this._context.strokeRect(t,e,i,n)}fillText(t,e,i,n){n?this._context.fillText(t,e,i,n):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,n){return this._context.getImageData(t,e,i,n)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,n){this._context.rect(t,e,i,n)}roundRect(t,e,i,n,r){this._context.roundRect(t,e,i,n,r)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,n){this._context.quadraticCurveTo(t,e,i,n)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,n,r,a){this._context.setTransform(t,e,i,n,r,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,n){this._context.strokeText(t,e,i,n)}transform(t,e,i,n,r,a){this._context.transform(t,e,i,n,r,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){let t,e,i=this,r=a.length,s=this.setAttr;const o=function(t){let r,a=i[t];i[t]=function(){return e=function(t){const e=[],i=t.length,r=n.Util;for(let n=0;n<i;n++){let i=t[n];r._isNumber(i)?i=Math.round(1e3*i)/1e3:r._isString(i)||(i+=""),e.push(i)}return e}(Array.prototype.slice.call(arguments,0)),r=a.apply(i,arguments),i._trace({method:t,args:e}),r}};for(t=0;t<r;t++)o(a[t]);i.setAttr=function(){s.apply(i,arguments);const t=arguments[0];let e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),i._trace({property:t,val:e})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;!e||"source-over"===e||this.setAttr("globalCompositeOperation",e)}}e.Context=s,["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach(function(t){Object.defineProperty(s.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})}),e.SceneContext=class extends s{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){const e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){const e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)return void this._fillColor(t);const n=t.getFillPatternImage();if(n&&"pattern"===i)return void this._fillPattern(t);const r=t.getFillLinearGradientColorStops();if(r&&"linear-gradient"===i)return void this._fillLinearGradient(t);const a=t.getFillRadialGradientColorStops();a&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):n?this._fillPattern(t):r?this._fillLinearGradient(t):a&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),n=t.getStrokeLinearGradientColorStops(),r=this.createLinearGradient(e.x,e.y,i.x,i.y);if(n){for(let t=0;t<n.length;t+=2)r.addColorStop(n[t],n[t+1]);this.setAttr("strokeStyle",r)}}_stroke(t){const e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,n;const r=null!==(e=t.getShadowRGBA())&&void 0!==e?e:"black",a=null!==(i=t.getShadowBlur())&&void 0!==i?i:5,s=null!==(n=t.getShadowOffset())&&void 0!==n?n:{x:0,y:0},o=t.getAbsoluteScale(),h=this.canvas.getPixelRatio(),l=o.x*h,d=o.y*h;this.setAttr("shadowColor",r),this.setAttr("shadowBlur",a*Math.min(Math.abs(l),Math.abs(d))),this.setAttr("shadowOffsetX",s.x*l),this.setAttr("shadowOffsetY",s.y*d)}},e.HitContext=class extends s{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const e=t.getStrokeScaleEnabled();if(!e){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t);const i=t.hitStrokeWidth(),n="auto"===i?t.strokeWidth():i;this.setAttr("lineWidth",n),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}}}},1268(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.DD=void 0;const n=i(8871),r=i(4060);e.DD={get isDragging(){let t=!1;return e.DD._dragElements.forEach(e=>{"dragging"===e.dragStatus&&(t=!0)}),t},justDragged:!1,get node(){let t;return e.DD._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const i=[];e.DD._dragElements.forEach((e,n)=>{const{node:a}=e,s=a.getStage();s.setPointersPositions(t),void 0===e.pointerId&&(e.pointerId=r.Util._getFirstPointerId(t));const o=s._changedPointerPositions.find(t=>t.id===e.pointerId);if(o){if("dragging"!==e.dragStatus){const i=a.dragDistance();if(Math.max(Math.abs(o.x-e.startPointerPos.x),Math.abs(o.y-e.startPointerPos.y))<i)return;if(a.startDrag({evt:t}),!a.isDragging())return}a._setDragPosition(t,e),i.push(a)}}),i.forEach(e=>{e.fire("dragmove",{type:"dragmove",target:e,evt:t},!0)})},_endDragBefore(t){const i=[];e.DD._dragElements.forEach(r=>{const{node:a}=r,s=a.getStage();if(t&&s.setPointersPositions(t),!s._changedPointerPositions.find(t=>t.id===r.pointerId))return;"dragging"!==r.dragStatus&&"stopped"!==r.dragStatus||(e.DD.justDragged=!0,n.Konva._mouseListenClick=!1,n.Konva._touchListenClick=!1,n.Konva._pointerListenClick=!1,r.dragStatus="stopped");const o=r.node.getLayer()||r.node instanceof n.Konva.Stage&&r.node;o&&-1===i.indexOf(o)&&i.push(o)}),i.forEach(t=>{t.draw()})},_endDragAfter(t){e.DD._dragElements.forEach((i,n)=>{"stopped"===i.dragStatus&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:t},!0),"dragging"!==i.dragStatus&&e.DD._dragElements.delete(n)})}},n.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("touchcancel",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1),window.addEventListener("touchcancel",e.DD._endDragAfter,!1))},4892(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const n=i(4060),r=i(5483),a="get",s="set";e.Factory={addGetterSetter(t,i,n,r,a){e.Factory.addGetter(t,i,n),e.Factory.addSetter(t,i,r,a),e.Factory.addOverloadedGetterSetter(t,i)},addGetter(t,e,i){const r=a+n.Util._capitalize(e);t.prototype[r]=t.prototype[r]||function(){const t=this.attrs[e];return void 0===t?i:t}},addSetter(t,i,r,a){const o=s+n.Util._capitalize(i);t.prototype[o]||e.Factory.overWriteSetter(t,i,r,a)},overWriteSetter(t,e,i,r){const a=s+n.Util._capitalize(e);t.prototype[a]=function(t){return i&&null!=t&&(t=i.call(this,t,e)),this._setAttr(e,t),r&&r.call(this),this}},addComponentsGetterSetter(t,i,o,h,l){const d=o.length,c=n.Util._capitalize,g=a+c(i),u=s+c(i);t.prototype[g]=function(){const t={};for(let e=0;e<d;e++){const n=o[e];t[n]=this.getAttr(i+c(n))}return t};const f=(0,r.getComponentValidator)(o);t.prototype[u]=function(t){const e=this.attrs[i];h&&(t=h.call(this,t,i)),f&&f.call(this,t,i);for(const e in t)t.hasOwnProperty(e)&&this._setAttr(i+c(e),t[e]);return t||o.forEach(t=>{this._setAttr(i+c(t),void 0)}),this._fireChangeEvent(i,e,t),l&&l.call(this),this},e.Factory.addOverloadedGetterSetter(t,i)},addOverloadedGetterSetter(t,e){const i=n.Util._capitalize(e),r=s+i,o=a+i;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(t,i,r,s){n.Util.error("Adding deprecated "+i);const o=a+n.Util._capitalize(i),h=i+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[o]=function(){n.Util.error(h);const t=this.attrs[i];return void 0===t?r:t},e.Factory.addSetter(t,i,s,function(){n.Util.error(h)}),e.Factory.addOverloadedGetterSetter(t,i)},backCompat(t,e){n.Util.each(e,function(e,i){const r=t.prototype[i],o=a+n.Util._capitalize(e),h=s+n.Util._capitalize(e);function l(){r.apply(this,arguments),n.Util.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}t.prototype[e]=l,t.prototype[o]=l,t.prototype[h]=l})},afterSetFilter(){this._filterUpToDate=!1}}},7457(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.FastLayer=void 0;const n=i(4060),r=i(6267),a=i(8871);class s extends r.Layer{constructor(t){super(t),this.listening(!1),n.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}e.FastLayer=s,s.prototype.nodeType="FastLayer",(0,a._registerNode)(s)},8871(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;const n=Math.PI/180;e.glob=void 0!==i.g?i.g:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},e.Konva={_global:e.glob,version:"9.3.22",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle:t=>e.Konva.angleDeg?t*n:t,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>e.Konva.DD.isDragging,isTransforming(){var t;return null===(t=e.Konva.Transformer)||void 0===t?void 0:t.isTransforming()},isDragReady:()=>!!e.Konva.DD.node,releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(t){e.glob.Konva=t}},e._registerNode=t=>{e.Konva[t.prototype.getClassName()]=t},e.Konva._injectGlobal(e.Konva)},7949(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Group=void 0;const n=i(4060),r=i(4473),a=i(8871);class s extends r.Container{_validateAdd(t){const e=t.getType();"Group"!==e&&"Shape"!==e&&n.Util.throw("You may only add groups and shapes to groups.")}}e.Group=s,s.prototype.nodeType="Group",(0,a._registerNode)(s)},6267(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Layer=void 0;const n=i(4060),r=i(4473),a=i(6536),s=i(4892),o=i(8604),h=i(5483),l=i(4723),d=i(8871),c=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],g=c.length;class u extends r.Container{constructor(t){super(t),this.canvas=new o.SceneCanvas,this.hitCanvas=new o.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){a.Node.prototype.moveToTop.call(this);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!a.Node.prototype.moveUp.call(this))return!1;const t=this.getStage();return!(!t||!t.content||(t.content.removeChild(this.getNativeCanvasElement()),this.index<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[this.index+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement()),0))}moveDown(){if(a.Node.prototype.moveDown.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(a.Node.prototype.moveToBottom.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const t=this.getNativeCanvasElement();return a.Node.prototype.remove.call(this),t&&t.parentNode&&n.Util._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){const e=t.getType();"Group"!==e&&"Shape"!==e&&n.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return(t=t||{}).width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=void 0!==t.x?t.x:this.x(),t.y=void 0!==t.y?t.y:this.y(),a.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){const t=this.visible();this.canvas._canvas.style.display=t?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){n.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){n.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,n.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;let e=1,i=!1;for(;;){for(let n=0;n<g;n++){const r=c[n],a=this._getIntersection({x:t.x+r.x*e,y:t.y+r.y*e}),s=a.shape;if(s)return s;if(i=!!a.antialiased,!a.antialiased)break}if(!i)return null;e+=1}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=i[3];if(255===r){const t=n.Util._rgbToHex(i[0],i[1],i[2]),e=l.shapes["#"+t];return e?{shape:e}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(t,e,i){const n=this.getLayer(),a=t||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&a.getContext().clear(),r.Container.prototype.drawScene.call(this,a,e,i),this._fire("draw",{node:this}),this}drawHit(t,e){const i=this.getLayer(),n=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),r.Container.prototype.drawHit.call(this,n,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){n.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return n.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const t=this.parent;this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}destroy(){return n.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}e.Layer=u,u.prototype.nodeType="Layer",(0,d._registerNode)(u),s.Factory.addGetterSetter(u,"imageSmoothingEnabled",!0),s.Factory.addGetterSetter(u,"clearBeforeDraw",!0),s.Factory.addGetterSetter(u,"hitGraphEnabled",!0,(0,h.getBooleanValidator)())},6536(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Node=void 0;const n=i(8604),r=i(1268),a=i(4892),s=i(8871),o=i(4060),h=i(5483),l="absoluteOpacity",d="allEventListeners",c="absoluteTransform",g="absoluteScale",u="canvas",f="listening",p="Shape",m=" ",_="stage",y="transform",v="visible",b=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(m);let x=1;class S{constructor(t){this._id=x++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){t!==y&&t!==c||!this._cache.get(t)?t?this._cache.delete(t):this._cache.clear():this._cache.get(t).dirty=!0}_getCache(t,e){let i=this._cache.get(t);return(void 0===i||(t===y||t===c)&&!0===i.dirty)&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){const i=e.map(t=>t+"Change.konva").join(m);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(u)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===c&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(u)){const{scene:t,filter:e,hit:i,buffer:n}=this._cache.get(u);o.Util.releaseCanvas(t,e,i,n),this._cache.delete(u)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const e=t||{};let i={};void 0!==e.x&&void 0!==e.y&&void 0!==e.width&&void 0!==e.height||(i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(e.width||i.width),a=Math.ceil(e.height||i.height),s=e.pixelRatio,h=void 0===e.x?Math.floor(i.x):e.x,d=void 0===e.y?Math.floor(i.y):e.y,c=e.offset||0,f=e.drawBorder||!1,p=e.hitCanvasPixelRatio||1;if(!r||!a)return void o.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");r+=2*c+(Math.abs(Math.round(i.x)-h)>.5?1:0),a+=2*c+(Math.abs(Math.round(i.y)-d)>.5?1:0),h-=c,d-=c;const m=new n.SceneCanvas({pixelRatio:s,width:r,height:a}),_=new n.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),y=new n.HitCanvas({pixelRatio:p,width:r,height:a}),v=m.getContext(),b=y.getContext(),x=new n.SceneCanvas({width:m.width/m.pixelRatio+Math.abs(h),height:m.height/m.pixelRatio+Math.abs(d),pixelRatio:m.pixelRatio}),S=x.getContext();return y.isCache=!0,m.isCache=!0,this._cache.delete(u),this._filterUpToDate=!1,!1===e.imageSmoothingEnabled&&(m.getContext()._context.imageSmoothingEnabled=!1,_.getContext()._context.imageSmoothingEnabled=!1),v.save(),b.save(),S.save(),v.translate(-h,-d),b.translate(-h,-d),S.translate(-h,-d),x.x=h,x.y=d,this._isUnderCache=!0,this._clearSelfAndDescendantCache(l),this._clearSelfAndDescendantCache(g),this.drawScene(m,this,x),this.drawHit(y,this),this._isUnderCache=!1,v.restore(),b.restore(),f&&(v.save(),v.beginPath(),v.rect(0,0,r,a),v.closePath(),v.setAttr("strokeStyle","red"),v.setAttr("lineWidth",5),v.stroke(),v.restore()),this._cache.set(u,{scene:m,filter:_,hit:y,buffer:x,x:h,y:d}),this._requestDraw(),this}isCached(){return this._cache.has(u)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){const i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let n=1/0,r=1/0,a=-1/0,s=-1/0;const o=this.getAbsoluteTransform(e);return i.forEach(function(t){const e=o.point(t);void 0===n&&(n=a=e.x,r=s=e.y),n=Math.min(n,e.x),r=Math.min(r,e.y),a=Math.max(a,e.x),s=Math.max(s,e.y)}),{x:n,y:r,width:a-n,height:s-r}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);const i=this._getCachedSceneCanvas(),n=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/n,i.height/n),t.restore()}_drawCachedHitCanvas(t){const e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t,e,i,n,r=this.filters(),a=this._getCanvasCache(),s=a.scene,h=a.filter,l=h.getContext();if(r){if(!this._filterUpToDate){const a=s.pixelRatio;h.setSize(s.width/s.pixelRatio,s.height/s.pixelRatio);try{for(t=r.length,l.clear(),l.drawImage(s._canvas,0,0,s.getWidth()/a,s.getHeight()/a),e=l.getImageData(0,0,h.getWidth(),h.getHeight()),i=0;i<t;i++)n=r[i],"function"==typeof n?(n.call(this,e),l.putImageData(e,0,0)):o.Util.error("Filter should be type of function, but got "+typeof n+" instead. Please check correct filters")}catch(t){o.Util.error("Unable to apply filter. "+t.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return h}return s}on(t,e){if(this._cache&&this._cache.delete(d),3===arguments.length)return this._delegate.apply(this,arguments);const i=t.split(m);for(let t=0;t<i.length;t++){const n=i[t].split("."),r=n[0],a=n[1]||"";this.eventListeners[r]||(this.eventListeners[r]=[]),this.eventListeners[r].push({name:a,handler:e})}return this}off(t,e){let i,n,r,a,s,o,h=(t||"").split(m),l=h.length;if(this._cache&&this._cache.delete(d),!t)for(n in this.eventListeners)this._off(n);for(i=0;i<l;i++)if(r=h[i],a=r.split("."),s=a[0],o=a[1],s)this.eventListeners[s]&&this._off(s,o,e);else for(n in this.eventListeners)this._off(n,o,e);return this}dispatchEvent(t){const e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(t){e.call(this,t.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,i){const n=this;this.on(t,function(t){const r=t.target.findAncestors(e,!0,n);for(let e=0;e<r.length;e++)(t=o.Util.cloneObject(t)).currentTarget=r[e],i.call(r[e],t)})}remove(){return this.isDragging()&&this.stopDrag(),r.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(c),this._clearSelfAndDescendantCache(l),this._clearSelfAndDescendantCache(g),this._clearSelfAndDescendantCache(_),this._clearSelfAndDescendantCache(v),this._clearSelfAndDescendantCache(f)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){const e="get"+o.Util._capitalize(t);return o.Util._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){let t=this.getParent(),e=[];for(;t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{let e,i;if(!t)return this;for(e in t)"children"!==e&&(i="set"+o.Util._capitalize(e),o.Util._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(f,this._isListening)}_isListening(t){if(!this.listening())return!1;const e=this.getParent();return!e||e===t||this===t||e._isListening(t)}isVisible(){return this._getCache(v,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const e=this.getParent();return!e||e===t||this===t||e._isVisible(t)}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);const i=this.getLayer();let n=!1;r.DD._dragElements.forEach(t=>{"dragging"===t.dragStatus&&("Stage"===t.node.nodeType||t.node.getLayer()===i)&&(n=!0)});const a=!e&&!s.Konva.hitOnDragEnabled&&(n||s.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t,e,i,n,r=this.getDepth(),a=this,s=0;const o=this.getStage();return"Stage"!==a.nodeType&&o&&function o(h){for(t=[],e=h.length,i=0;i<e;i++)n=h[i],s++,n.nodeType!==p&&(t=t.concat(n.getChildren().slice())),n._id===a._id&&(i=e);t.length>0&&t[0].getDepth()<=r&&o(t)}(o.getChildren()),s}getDepth(){let t=0,e=this.parent;for(;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(y),this._clearSelfAndDescendantCache(c)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const e=t.getPointerPosition();if(!e)return null;const i=this.getAbsoluteTransform().copy();return i.invert(),i.point(e)}getAbsolutePosition(t){let e=!1,i=this.parent;for(;i;){if(i.isCached()){e=!0;break}i=i.parent}e&&!t&&(t=!0);const n=this.getAbsoluteTransform(t).getMatrix(),r=new o.Transform,a=this.offset();return r.m=n.slice(),r.translate(a.x,a.y),r.getTranslation()}setAbsolutePosition(t){const{x:e,y:i,...n}=this._clearTransform();this.attrs.x=e,this.attrs.y=i,this._clearCache(y);const r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(y),this._clearSelfAndDescendantCache(c),this}_setTransform(t){let e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let e=t.x,i=t.y,n=this.x(),r=this.y();return void 0!==e&&(n+=e),void 0!==i&&(r+=i),this.setPosition({x:n,y:r}),this}_eachAncestorReverse(t,e){let i,n,r=[],a=this.getParent();if(!e||e._id!==this._id){for(r.unshift(this);a&&(!e||a._id!==e._id);)r.unshift(a),a=a.parent;for(i=r.length,n=0;n<i;n++)t(r[n])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return o.Util.warn("Node has no parent. moveToTop function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return o.Util.warn("Node has no parent. moveUp function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return o.Util.warn("Node has no parent. moveDown function is ignored."),!1;const t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return o.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(t){if(!this.parent)return o.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&o.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(l,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let t,e,i,n,r,a=this.getAttrs();const s={attrs:{},className:this.getClassName()};for(t in a)e=a[t],r=o.Util.isObject(e)&&!o.Util._isPlainObject(e)&&!o.Util._isArray(e),r||(i="function"==typeof this[t]&&this[t],delete a[t],n=i?i.call(this):null,a[t]=e,n!==e&&(s.attrs[t]=e));return o.Util._prepareToStringify(s)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){const n=[];e&&this._isMatch(t)&&n.push(this);let r=this.parent;for(;r;){if(r===i)return n;r._isMatch(t)&&n.push(r),r=r.parent}return n}isAncestorOf(t){return!1}findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(t){if(!t)return!1;if("function"==typeof t)return t(this);let e,i,n=t.replace(/ /g,"").split(","),r=n.length;for(e=0;e<r;e++)if(i=n[e],o.Util.isValidSelector(i)||(o.Util.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),o.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),o.Util.warn("Konva is awesome, right?")),"#"===i.charAt(0)){if(this.id()===i.slice(1))return!0}else if("."===i.charAt(0)){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(_,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(c,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let e;if(t)return e=new o.Transform,this._eachAncestorReverse(function(t){const i=t.transformsEnabled();"all"===i?e.multiply(t.getTransform()):"position"===i&&e.translate(t.x()-t.offsetX(),t.y()-t.offsetY())},t),e;{e=this._cache.get(c)||new o.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();const t=this.transformsEnabled();if("all"===t)e.multiply(this.getTransform());else if("position"===t){const t=this.attrs.x||0,i=this.attrs.y||0,n=this.attrs.offsetX||0,r=this.attrs.offsetY||0;e.translate(t-n,i-r)}return e.dirty=!1,e}}getAbsoluteScale(t){let e=this;for(;e;)e._isUnderCache&&(t=e),e=e.getParent();const i=this.getAbsoluteTransform(t).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(y,this._getTransform)}_getTransform(){var t,e;const i=this._cache.get(y)||new o.Transform;i.reset();const n=this.x(),r=this.y(),a=s.Konva.getAngle(this.rotation()),h=null!==(t=this.attrs.scaleX)&&void 0!==t?t:1,l=null!==(e=this.attrs.scaleY)&&void 0!==e?e:1,d=this.attrs.skewX||0,c=this.attrs.skewY||0,g=this.attrs.offsetX||0,u=this.attrs.offsetY||0;return 0===n&&0===r||i.translate(n,r),0!==a&&i.rotate(a),0===d&&0===c||i.skew(d,c),1===h&&1===l||i.scale(h,l),0===g&&0===u||i.translate(-1*g,-1*u),i.dirty=!1,i}clone(t){let e,i,n,r,a,s=o.Util.cloneObject(this.attrs);for(e in t)s[e]=t[e];const h=new this.constructor(s);for(e in this.eventListeners)for(i=this.eventListeners[e],n=i.length,r=0;r<n;r++)a=i[r],a.name.indexOf("konva")<0&&(h.eventListeners[e]||(h.eventListeners[e]=[]),h.eventListeners[e].push(a));return h}_toKonvaCanvas(t){t=t||{};const e=this.getClientRect(),i=this.getStage(),r=void 0!==t.x?t.x:Math.floor(e.x),a=void 0!==t.y?t.y:Math.floor(e.y),s=t.pixelRatio||1,o=new n.SceneCanvas({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:s}),h=o.getContext(),l=new n.SceneCanvas({width:o.width/o.pixelRatio+Math.abs(r),height:o.height/o.pixelRatio+Math.abs(a),pixelRatio:o.pixelRatio});return!1===t.imageSmoothingEnabled&&(h._context.imageSmoothingEnabled=!1),h.save(),(r||a)&&h.translate(-1*r,-1*a),this.drawScene(o,void 0,l),h.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){const e=(t=t||{}).mimeType||null,i=t.quality||null,n=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(n),n}toImage(t){return new Promise((e,i)=>{try{const i=null==t?void 0:t.callback;i&&delete t.callback,o.Util._urlToImage(this.toDataURL(t),function(t){e(t),null==i||i(t)})}catch(t){i(t)}})}toBlob(t){return new Promise((e,i)=>{try{const i=null==t?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(t=>{e(t),null==i||i(t)},null==t?void 0:t.mimeType,null==t?void 0:t.quality)}catch(t){i(t)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():s.Konva.dragDistance}_off(t,e,i){let n,r,a,s=this.eventListeners[t];for(n=0;n<s.length;n++)if(r=s[n].name,a=s[n].handler,!("konva"===r&&"konva"!==e||e&&r!==e||i&&i!==a)){if(s.splice(n,1),0===s.length){delete this.eventListeners[t];break}n--}}_fireChangeEvent(t,e,i){this._fire(t+"Change",{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){const e=this.name(),i=e?e+" "+t:t;this.name(i)}return this}hasName(t){if(!t)return!1;const e=this.name();return!!e&&-1!==(e||"").split(/\s/g).indexOf(t)}removeName(t){const e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return-1!==i&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(t,e){const i=this["set"+o.Util._capitalize(t)];return o.Util._isFunction(i)?i.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(s.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();null==t||t.batchDraw()}}_setAttr(t,e){const i=this.attrs[t];(i!==e||o.Util.isObject(e))&&(null==e?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,i,e),this._requestDraw())}_setComponentAttr(t,e,i){let n;void 0!==i&&(n=this.attrs[t],n||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,n,i))}_fireAndBubble(t,e,i){e&&this.nodeType===p&&(e.target=this);const n=["mouseenter","mouseleave","pointerenter","pointerleave","touchenter","touchleave"];if(-1===n.indexOf(t)||!(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||"Stage"===this.nodeType&&!i)){this._fire(t,e);const r=-1!==n.indexOf(t)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!r&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,i,n;const r=null!==(e=this._cache.get(d))&&void 0!==e?e:{};let a=null==r?void 0:r[t];if(void 0===a){a=[];let e=Object.getPrototypeOf(this);for(;e;){const r=null!==(n=null===(i=e.eventListeners)||void 0===i?void 0:i[t])&&void 0!==n?n:[];a.push(...r),e=Object.getPrototypeOf(e)}r[t]=a,this._cache.set(d,r)}return a}_fire(t,e){(e=e||{}).currentTarget=this,e.type=t;const i=this._getProtoListeners(t);if(i)for(let t=0;t<i.length;t++)i[t].handler.call(this,e);const n=this.eventListeners[t];if(n)for(let t=0;t<n.length;t++)n[t].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const e=t?t.pointerId:void 0,i=this.getStage(),n=this.getAbsolutePosition();if(!i)return;const a=i._getPointerById(e)||i._changedPointerPositions[0]||n;r.DD._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-n.x,y:a.y-n.y},dragStatus:"ready",pointerId:e})}startDrag(t,e=!0){r.DD._dragElements.has(this._id)||this._createDragElement(t),r.DD._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const i=this.getStage()._getPointerById(e.pointerId);if(!i)return;let n={x:i.x-e.offset.x,y:i.y-e.offset.y};const r=this.dragBoundFunc();if(void 0!==r){const e=r.call(this,n,t);e?n=e:o.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===n.x&&this._lastPos.y===n.y||(this.setAbsolutePosition(n),this._requestDraw()),this._lastPos=n}stopDrag(t){const e=r.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),r.DD._endDragBefore(t),r.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=r.DD._dragElements.get(this._id);return!!t&&"dragging"===t.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if(!(void 0===t.evt.button||s.Konva.dragButtons.indexOf(t.evt.button)>=0))return;if(this.isDragging())return;let e=!1;r.DD._dragElements.forEach(t=>{this.isAncestorOf(t.node)&&(e=!0)}),e||this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=r.DD._dragElements.get(this._id),e=t&&"dragging"===t.dragStatus,i=t&&"ready"===t.dragStatus;e?this.stopDrag():i&&r.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const i={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return o.Util.haveIntersection(i,this.getClientRect())}static create(t,e){return o.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){let i,n,r,a=S.prototype.getClassName.call(t),h=t.children;if(e&&(t.attrs.container=e),s.Konva[a]||(o.Util.warn('Can not find a node with class name "'+a+'". Fallback to "Shape".'),a="Shape"),i=new(0,s.Konva[a])(t.attrs),h)for(n=h.length,r=0;r<n;r++)i.add(S._createNode(h[r]));return i}}e.Node=S,S.prototype.nodeType="Node",S.prototype._attrsAffectingSize=[],S.prototype.eventListeners={},S.prototype.on.call(S.prototype,b,function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(y),this._clearSelfAndDescendantCache(c))}),S.prototype.on.call(S.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(v)}),S.prototype.on.call(S.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(f)}),S.prototype.on.call(S.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(l)});const C=a.Factory.addGetterSetter;C(S,"zIndex"),C(S,"absolutePosition"),C(S,"position"),C(S,"x",0,(0,h.getNumberValidator)()),C(S,"y",0,(0,h.getNumberValidator)()),C(S,"globalCompositeOperation","source-over",(0,h.getStringValidator)()),C(S,"opacity",1,(0,h.getNumberValidator)()),C(S,"name","",(0,h.getStringValidator)()),C(S,"id","",(0,h.getStringValidator)()),C(S,"rotation",0,(0,h.getNumberValidator)()),a.Factory.addComponentsGetterSetter(S,"scale",["x","y"]),C(S,"scaleX",1,(0,h.getNumberValidator)()),C(S,"scaleY",1,(0,h.getNumberValidator)()),a.Factory.addComponentsGetterSetter(S,"skew",["x","y"]),C(S,"skewX",0,(0,h.getNumberValidator)()),C(S,"skewY",0,(0,h.getNumberValidator)()),a.Factory.addComponentsGetterSetter(S,"offset",["x","y"]),C(S,"offsetX",0,(0,h.getNumberValidator)()),C(S,"offsetY",0,(0,h.getNumberValidator)()),C(S,"dragDistance",void 0,(0,h.getNumberValidator)()),C(S,"width",0,(0,h.getNumberValidator)()),C(S,"height",0,(0,h.getNumberValidator)()),C(S,"listening",!0,(0,h.getBooleanValidator)()),C(S,"preventDefault",!0,(0,h.getBooleanValidator)()),C(S,"filters",void 0,function(t){return this._filterUpToDate=!1,t}),C(S,"visible",!0,(0,h.getBooleanValidator)()),C(S,"transformsEnabled","all",(0,h.getStringValidator)()),C(S,"size"),C(S,"dragBoundFunc"),C(S,"draggable",!1,(0,h.getBooleanValidator)()),a.Factory.backCompat(S,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"})},8722(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.getCapturedShape=function(t){return r.get(t)},e.createEvent=s,e.hasPointerCapture=function(t,e){return r.get(t)===e},e.setPointerCapture=function(t,e){o(t),e.getStage()&&(r.set(t,e),a&&e._fire("gotpointercapture",s(new PointerEvent("gotpointercapture"))))},e.releaseCapture=o;const n=i(8871),r=new Map,a=void 0!==n.Konva._global.PointerEvent;function s(t){return{evt:t,pointerId:t.pointerId}}function o(t,e){const i=r.get(t);if(!i)return;const n=i.getStage();n&&n.content,r.delete(t),a&&i._fire("lostpointercapture",s(new PointerEvent("lostpointercapture")))}},4723(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const n=i(8871),r=i(4060),a=i(4892),s=i(6536),o=i(5483),h=i(8871),l=i(8722),d="hasShadow",c="shadowRGBA",g="patternImage",u="linearGradient",f="radialGradient";let p;function m(){return p||(p=r.Util.createCanvasElement().getContext("2d"),p)}e.shapes={};class _ extends s.Node{constructor(t){let i;for(super(t);i=r.Util.getRandomColor(),!i||i in e.shapes;);this.colorKey=i,e.shapes[i]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(d,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(g,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const t=m().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(t&&t.setTransform){const e=new r.Transform;e.translate(this.fillPatternX(),this.fillPatternY()),e.rotate(n.Konva.getAngle(this.fillPatternRotation())),e.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),e.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=e.getMatrix(),a="undefined"==typeof DOMMatrix?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);t.setTransform(a)}return t}}_getLinearGradient(){return this._getCache(u,this.__getLinearGradient)}__getLinearGradient(){const t=this.fillLinearGradientColorStops();if(t){const e=m(),i=this.fillLinearGradientStartPoint(),n=this.fillLinearGradientEndPoint(),r=e.createLinearGradient(i.x,i.y,n.x,n.y);for(let e=0;e<t.length;e+=2)r.addColorStop(t[e],t[e+1]);return r}}_getRadialGradient(){return this._getCache(f,this.__getRadialGradient)}__getRadialGradient(){const t=this.fillRadialGradientColorStops();if(t){const e=m(),i=this.fillRadialGradientStartPoint(),n=this.fillRadialGradientEndPoint(),r=e.createRadialGradient(i.x,i.y,this.fillRadialGradientStartRadius(),n.x,n.y,this.fillRadialGradientEndRadius());for(let e=0;e<t.length;e+=2)r.addColorStop(t[e],t[e+1]);return r}}getShadowRGBA(){return this._getCache(c,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const t=r.Util.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops()))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){const e=this.getStage();if(!e)return!1;const i=e.bufferHitCanvas;return i.getContext().clear(),this.drawHit(i,void 0,!0),i.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return s.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(null!==(e=this.attrs.perfectDrawEnabled)&&void 0!==e&&!e)return!1;const i=t||this.hasFill(),n=this.hasStroke(),r=1!==this.getAbsoluteOpacity();if(i&&n&&r)return!0;const a=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(i&&n&&a&&s)}setStrokeHitEnabled(t){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,i=this.getParent();for(;i;){if(i.isCached()){e=!0;break}i=i.getParent()}const n=t.skipTransform,r=t.relativeTo||e&&this.getStage()||void 0,a=this.getSelfRect(),s=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=a.width+s,h=a.height+s,l=!t.skipShadow&&this.hasShadow(),d=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,g=o+Math.abs(d),u=h+Math.abs(c),f=l&&this.shadowBlur()||0,p={width:g+2*f,height:u+2*f,x:-(s/2+f)+Math.min(d,0)+a.x,y:-(s/2+f)+Math.min(c,0)+a.y};return n?p:this._transformedRect(p,r)}drawScene(t,e,i){const n=this.getLayer(),r=(t||n.getCanvas()).getContext(),a=this._getCanvasCache(),s=this.getSceneFunc(),o=this.hasShadow();let h;const l=e===this;if(!this.isVisible()&&!l)return this;if(a){r.save();const t=this.getAbsoluteTransform(e).getMatrix();return r.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(r),r.restore(),this}if(!s)return this;if(r.save(),this._useBufferCanvas()){h=this.getStage();const t=i||h.bufferCanvas,n=t.getContext();n.clear(),n.save(),n._applyLineJoin(this);const a=this.getAbsoluteTransform(e).getMatrix();n.transform(a[0],a[1],a[2],a[3],a[4],a[5]),s.call(this,n,this),n.restore();const l=t.pixelRatio;o&&r._applyShadow(this),r._applyOpacity(this),r._applyGlobalCompositeOperation(this),r.drawImage(t._canvas,t.x||0,t.y||0,t.width/l,t.height/l)}else{if(r._applyLineJoin(this),!l){const t=this.getAbsoluteTransform(e).getMatrix();r.transform(t[0],t[1],t[2],t[3],t[4],t[5]),r._applyOpacity(this),r._applyGlobalCompositeOperation(this)}o&&r._applyShadow(this),s.call(this,r,this)}return r.restore(),this}drawHit(t,e,i=!1){if(!this.shouldDrawHit(e,i))return this;const n=this.getLayer(),a=t||n.hitCanvas,s=a&&a.getContext(),o=this.hitFunc()||this.sceneFunc(),h=this._getCanvasCache(),l=h&&h.hit;if(this.colorKey||r.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){s.save();const t=this.getAbsoluteTransform(e).getMatrix();return s.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(s),s.restore(),this}if(!o)return this;if(s.save(),s._applyLineJoin(this),this!==e){const t=this.getAbsoluteTransform(e).getMatrix();s.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return o.call(this,s,this),s.restore(),this}drawHitFromCache(t=0){const e=this._getCanvasCache(),i=this._getCachedSceneCanvas(),n=e.hit,a=n.getContext(),s=n.getWidth(),o=n.getHeight();a.clear(),a.drawImage(i._canvas,0,0,s,o);try{const e=a.getImageData(0,0,s,o),i=e.data,n=i.length,h=r.Util._hexToRgb(this.colorKey);for(let e=0;e<n;e+=4)i[e+3]>t?(i[e]=h.r,i[e+1]=h.g,i[e+2]=h.b,i[e+3]=255):i[e+3]=0;a.putImageData(e,0,0)}catch(t){r.Util.error("Unable to draw hit graph from cached scene canvas. "+t.message)}return this}hasPointerCapture(t){return l.hasPointerCapture(t,this)}setPointerCapture(t){l.setPointerCapture(t,this)}releaseCapture(t){l.releaseCapture(t,this)}}e.Shape=_,_.prototype._fillFunc=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},_.prototype._strokeFunc=function(t){t.stroke()},_.prototype._fillFuncHit=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},_.prototype._strokeFuncHit=function(t){t.stroke()},_.prototype._centroid=!1,_.prototype.nodeType="Shape",(0,h._registerNode)(_),_.prototype.eventListeners={},_.prototype.on.call(_.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(d)}),_.prototype.on.call(_.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(c)}),_.prototype.on.call(_.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",function(){this._clearCache(g)}),_.prototype.on.call(_.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",function(){this._clearCache(u)}),_.prototype.on.call(_.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",function(){this._clearCache(f)}),a.Factory.addGetterSetter(_,"stroke",void 0,(0,o.getStringOrGradientValidator)()),a.Factory.addGetterSetter(_,"strokeWidth",2,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"fillAfterStrokeEnabled",!1),a.Factory.addGetterSetter(_,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),a.Factory.addGetterSetter(_,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),a.Factory.addGetterSetter(_,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),a.Factory.addGetterSetter(_,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),a.Factory.addGetterSetter(_,"lineJoin"),a.Factory.addGetterSetter(_,"lineCap"),a.Factory.addGetterSetter(_,"sceneFunc"),a.Factory.addGetterSetter(_,"hitFunc"),a.Factory.addGetterSetter(_,"dash"),a.Factory.addGetterSetter(_,"dashOffset",0,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"shadowColor",void 0,(0,o.getStringValidator)()),a.Factory.addGetterSetter(_,"shadowBlur",0,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"shadowOpacity",1,(0,o.getNumberValidator)()),a.Factory.addComponentsGetterSetter(_,"shadowOffset",["x","y"]),a.Factory.addGetterSetter(_,"shadowOffsetX",0,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"shadowOffsetY",0,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"fillPatternImage"),a.Factory.addGetterSetter(_,"fill",void 0,(0,o.getStringOrGradientValidator)()),a.Factory.addGetterSetter(_,"fillPatternX",0,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"fillPatternY",0,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"fillLinearGradientColorStops"),a.Factory.addGetterSetter(_,"strokeLinearGradientColorStops"),a.Factory.addGetterSetter(_,"fillRadialGradientStartRadius",0),a.Factory.addGetterSetter(_,"fillRadialGradientEndRadius",0),a.Factory.addGetterSetter(_,"fillRadialGradientColorStops"),a.Factory.addGetterSetter(_,"fillPatternRepeat","repeat"),a.Factory.addGetterSetter(_,"fillEnabled",!0),a.Factory.addGetterSetter(_,"strokeEnabled",!0),a.Factory.addGetterSetter(_,"shadowEnabled",!0),a.Factory.addGetterSetter(_,"dashEnabled",!0),a.Factory.addGetterSetter(_,"strokeScaleEnabled",!0),a.Factory.addGetterSetter(_,"fillPriority","color"),a.Factory.addComponentsGetterSetter(_,"fillPatternOffset",["x","y"]),a.Factory.addGetterSetter(_,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),a.Factory.addComponentsGetterSetter(_,"fillPatternScale",["x","y"]),a.Factory.addGetterSetter(_,"fillPatternScaleX",1,(0,o.getNumberValidator)()),a.Factory.addGetterSetter(_,"fillPatternScaleY",1,(0,o.getNumberValidator)()),a.Factory.addComponentsGetterSetter(_,"fillLinearGradientStartPoint",["x","y"]),a.Factory.addComponentsGetterSetter(_,"strokeLinearGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(_,"fillLinearGradientStartPointX",0),a.Factory.addGetterSetter(_,"strokeLinearGradientStartPointX",0),a.Factory.addGetterSetter(_,"fillLinearGradientStartPointY",0),a.Factory.addGetterSetter(_,"strokeLinearGradientStartPointY",0),a.Factory.addComponentsGetterSetter(_,"fillLinearGradientEndPoint",["x","y"]),a.Factory.addComponentsGetterSetter(_,"strokeLinearGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(_,"fillLinearGradientEndPointX",0),a.Factory.addGetterSetter(_,"strokeLinearGradientEndPointX",0),a.Factory.addGetterSetter(_,"fillLinearGradientEndPointY",0),a.Factory.addGetterSetter(_,"strokeLinearGradientEndPointY",0),a.Factory.addComponentsGetterSetter(_,"fillRadialGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(_,"fillRadialGradientStartPointX",0),a.Factory.addGetterSetter(_,"fillRadialGradientStartPointY",0),a.Factory.addComponentsGetterSetter(_,"fillRadialGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(_,"fillRadialGradientEndPointX",0),a.Factory.addGetterSetter(_,"fillRadialGradientEndPointY",0),a.Factory.addGetterSetter(_,"fillPatternRotation",0),a.Factory.addGetterSetter(_,"fillRule",void 0,(0,o.getStringValidator)()),a.Factory.backCompat(_,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})},7324(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Stage=e.stages=void 0;const n=i(4060),r=i(4892),a=i(4473),s=i(8871),o=i(8604),h=i(1268),l=i(8871),d=i(8722),c="mouseleave",g="mouseover",u="mouseenter",f="mousemove",p="mousedown",m="mouseup",_="pointermove",y="pointerdown",v="pointerup",b="pointercancel",x="pointerout",S="pointerleave",C="pointerover",w="pointerenter",P="contextmenu",k="touchstart",A="touchend",T="touchmove",F="touchcancel",M="wheel",G=[[u,"_pointerenter"],[p,"_pointerdown"],[f,"_pointermove"],[m,"_pointerup"],[c,"_pointerleave"],[k,"_pointerdown"],[T,"_pointermove"],[A,"_pointerup"],[F,"_pointercancel"],[g,"_pointerover"],[M,"_wheel"],[P,"_contextmenu"],[y,"_pointerdown"],[_,"_pointermove"],[v,"_pointerup"],[b,"_pointercancel"],[S,"_pointerleave"],["lostpointercapture","_lostpointercapture"]],R={mouse:{[x]:"mouseout",[S]:c,[C]:g,[w]:u,[_]:f,[y]:p,[v]:m,[b]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[x]:"touchout",[S]:"touchleave",[C]:"touchover",[w]:"touchenter",[_]:T,[y]:k,[v]:A,[b]:F,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[x]:x,[S]:S,[C]:C,[w]:w,[_]:_,[y]:y,[v]:v,[b]:b,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},D=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",E=t=>{const e=D(t);return"pointer"===e?s.Konva.pointerEventsEnabled&&R.pointer:"touch"===e?R.touch:"mouse"===e?R.mouse:void 0};function N(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&n.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}e.stages=[];class O extends a.Container{constructor(t){super(N(t)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{N(this.attrs)}),this._checkVisibility()}_validateAdd(t){const e="Layer"===t.getType(),i="FastLayer"===t.getType();e||i||n.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if("string"==typeof t){let e;if("."===t.charAt(0)){const e=t.slice(1);t=document.getElementsByClassName(e)[0]}else e="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(e);if(!t)throw"Can not find container in document with id "+e}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const t=this.children,e=t.length;for(let i=0;i<e;i++)t[i].clear();return this}clone(t){return t||(t={}),t.container="undefined"!=typeof document&&document.createElement("div"),a.Container.prototype.clone.call(this,t)}destroy(){super.destroy();const t=this.content;t&&n.Util._isInDocument(t)&&this.container().removeChild(t);const i=e.stages.indexOf(this);return i>-1&&e.stages.splice(i,1),n.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(n.Util.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(t){return this._pointerPositions.find(e=>e.id===t)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){(t=t||{}).x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();const e=new o.SceneCanvas({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),i=e.getContext()._context,n=this.children;return(t.x||t.y)&&i.translate(-1*t.x,-1*t.y),n.forEach(function(e){if(!e.isVisible())return;const n=e._toKonvaCanvas(t);i.drawImage(n._canvas,t.x,t.y,n.getWidth()/n.getPixelRatio(),n.getHeight()/n.getPixelRatio())}),e}getIntersection(t){if(!t)return null;const e=this.children;for(let i=e.length-1;i>=0;i--){const n=e[i].getIntersection(t);if(n)return n}return null}_resizeDOM(){const t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach(i=>{i.setSize({width:t,height:e}),i.draw()})}add(t,...e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}super.add(t);const i=this.children.length;return i>5&&n.Util.warn("The stage has "+i+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),t.setSize({width:this.width(),height:this.height()}),t.draw(),s.Konva.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return d.hasPointerCapture(t,this)}setPointerCapture(t){d.setPointerCapture(t,this)}releaseCapture(t){d.releaseCapture(t,this)}getLayers(){return this.children}_bindContentEvents(){s.Konva.isBrowser&&G.forEach(([t,e])=>{this.content.addEventListener(t,t=>{this[e](t)},{passive:!1})})}_pointerenter(t){this.setPointersPositions(t);const e=E(t.type);e&&this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);const e=E(t.type);e&&this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];return e&&!e.getStage()&&(e=null),e}_pointerleave(t){const e=E(t.type),i=D(t.type);if(!e)return;this.setPointersPositions(t);const n=this._getTargetShape(i),r=!(s.Konva.isDragging()||s.Konva.isTransforming())||s.Konva.hitOnDragEnabled;n&&r?(n._fireAndBubble(e.pointerout,{evt:t}),n._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[i+"targetShape"]=null):r&&(this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(t){const e=E(t.type),i=D(t.type);if(!e)return;this.setPointersPositions(t);let n=!1;this._changedPointerPositions.forEach(r=>{const a=this.getIntersection(r);if(h.DD.justDragged=!1,s.Konva["_"+i+"ListenClick"]=!0,!a||!a.isListening())return void(this[i+"ClickStartShape"]=void 0);s.Konva.capturePointerEventsEnabled&&a.setPointerCapture(r.id),this[i+"ClickStartShape"]=a,a._fireAndBubble(e.pointerdown,{evt:t,pointerId:r.id}),n=!0;const o=t.type.indexOf("touch")>=0;a.preventDefault()&&t.cancelable&&o&&t.preventDefault()}),n||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(t){const e=E(t.type),i=D(t.type);if(!e)return;if(s.Konva.isDragging()&&h.DD.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t),(s.Konva.isDragging()||s.Konva.isTransforming())&&!s.Konva.hitOnDragEnabled)return;const n={};let r=!1;const a=this._getTargetShape(i);this._changedPointerPositions.forEach(s=>{const o=d.getCapturedShape(s.id)||this.getIntersection(s),h=s.id,l={evt:t,pointerId:h},c=a!==o;if(c&&a&&(a._fireAndBubble(e.pointerout,{...l},o),a._fireAndBubble(e.pointerleave,{...l},o)),o){if(n[o._id])return;n[o._id]=!0}o&&o.isListening()?(r=!0,c&&(o._fireAndBubble(e.pointerover,{...l},a),o._fireAndBubble(e.pointerenter,{...l},a),this[i+"targetShape"]=o),o._fireAndBubble(e.pointermove,{...l})):a&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:h}),this[i+"targetShape"]=null)}),r||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){const e=E(t.type),i=D(t.type);if(!e)return;this.setPointersPositions(t);const n=this[i+"ClickStartShape"],r=this[i+"ClickEndShape"],a={};let o=!1;this._changedPointerPositions.forEach(l=>{const c=d.getCapturedShape(l.id)||this.getIntersection(l);if(c){if(c.releaseCapture(l.id),a[c._id])return;a[c._id]=!0}const g=l.id,u={evt:t,pointerId:g};let f=!1;s.Konva["_"+i+"InDblClickWindow"]?(f=!0,clearTimeout(this[i+"DblTimeout"])):h.DD.justDragged||(s.Konva["_"+i+"InDblClickWindow"]=!0,clearTimeout(this[i+"DblTimeout"])),this[i+"DblTimeout"]=setTimeout(function(){s.Konva["_"+i+"InDblClickWindow"]=!1},s.Konva.dblClickWindow),c&&c.isListening()?(o=!0,this[i+"ClickEndShape"]=c,c._fireAndBubble(e.pointerup,{...u}),s.Konva["_"+i+"ListenClick"]&&n&&n===c&&(c._fireAndBubble(e.pointerclick,{...u}),f&&r&&r===c&&c._fireAndBubble(e.pointerdblclick,{...u}))):(this[i+"ClickEndShape"]=null,s.Konva["_"+i+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:g}),f&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:g}))}),o||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s.Konva["_"+i+"ListenClick"]=!1,t.cancelable&&"touch"!==i&&"pointer"!==i&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(P,{evt:t}):this._fire(P,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(M,{evt:t}):this._fire(M,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);const e=d.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble(v,d.createEvent(t)),d.releaseCapture(t.pointerId)}_lostpointercapture(t){d.releaseCapture(t.pointerId)}setPointersPositions(t){const e=this._getContentPosition();let i=null,r=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,t=>{this._pointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})}),Array.prototype.forEach.call(t.changedTouches||t.touches,t=>{this._changedPointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})})):(i=(t.clientX-e.left)/e.scaleX,r=(t.clientY-e.top)/e.scaleY,this.pointerPos={x:i,y:r},this._pointerPositions=[{x:i,y:r,id:n.Util._getFirstPointerId(t)}],this._changedPointerPositions=[{x:i,y:r,id:n.Util._getFirstPointerId(t)}])}_setPointerPosition(t){n.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!s.Konva.isBrowser)return;const t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}cache(){return n.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(t){t.batchDraw()}),this}}e.Stage=O,O.prototype.nodeType="Stage",(0,l._registerNode)(O),r.Factory.addGetterSetter(O,"container"),s.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{e.stages.forEach(t=>{t.batchDraw()})})},8665(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Easings=e.Tween=void 0;const n=i(4060),r=i(9696),a=i(6536),s=i(8871),o={node:1,duration:1,easing:1,onFinish:1,yoyo:1},h=["fill","stroke","shadowColor"];let l=0;class d{constructor(t,e,i,n,r,a,s){this.prop=t,this.propFunc=e,this.begin=n,this._pos=n,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=r-this.begin,this.pause()}fire(t){const e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class c{constructor(t){const i=this,a=t.node,h=a._id,g=t.easing||e.Easings.Linear,u=!!t.yoyo;let f,p;f=void 0===t.duration?.3:0===t.duration?.001:t.duration,this.node=a,this._id=l++;const m=a.getLayer()||(a instanceof s.Konva.Stage?a.getLayers():null);for(p in m||n.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new r.Animation(function(){i.tween.onEnterFrame()},m),this.tween=new d(p,function(t){i._tweenFunc(t)},g,0,1,1e3*f,u),this._addListeners(),c.attrs[h]||(c.attrs[h]={}),c.attrs[h][this._id]||(c.attrs[h][this._id]={}),c.tweens[h]||(c.tweens[h]={}),t)void 0===o[p]&&this._addAttr(p,t[p]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,e){const i=this.node,r=i._id;let a,s,o,l,d;const g=c.tweens[r][t];g&&delete c.attrs[r][g][t];let u=i.getAttr(t);if(n.Util._isArray(e))if(a=[],s=Math.max(e.length,u.length),"points"===t&&e.length!==u.length&&(e.length>u.length?(l=u,u=n.Util._prepareArrayForTween(u,e,i.closed())):(o=e,e=n.Util._prepareArrayForTween(e,u,i.closed()))),0===t.indexOf("fill"))for(let t=0;t<s;t++)if(t%2==0)a.push(e[t]-u[t]);else{const i=n.Util.colorToRGBA(u[t]);d=n.Util.colorToRGBA(e[t]),u[t]=i,a.push({r:d.r-i.r,g:d.g-i.g,b:d.b-i.b,a:d.a-i.a})}else for(let t=0;t<s;t++)a.push(e[t]-u[t]);else-1!==h.indexOf(t)?(u=n.Util.colorToRGBA(u),d=n.Util.colorToRGBA(e),a={r:d.r-u.r,g:d.g-u.g,b:d.b-u.b,a:d.a-u.a}):a=e-u;c.attrs[r][this._id][t]={start:u,diff:a,end:e,trueEnd:o,trueStart:l},c.tweens[r][t]=this._id}_tweenFunc(t){const e=this.node,i=c.attrs[e._id][this._id];let r,a,s,o,l,d,g,u;for(r in i){if(a=i[r],s=a.start,o=a.diff,u=a.end,n.Util._isArray(s))if(l=[],g=Math.max(s.length,u.length),0===r.indexOf("fill"))for(d=0;d<g;d++)d%2==0?l.push((s[d]||0)+o[d]*t):l.push("rgba("+Math.round(s[d].r+o[d].r*t)+","+Math.round(s[d].g+o[d].g*t)+","+Math.round(s[d].b+o[d].b*t)+","+(s[d].a+o[d].a*t)+")");else for(d=0;d<g;d++)l.push((s[d]||0)+o[d]*t);else l=-1!==h.indexOf(r)?"rgba("+Math.round(s.r+o.r*t)+","+Math.round(s.g+o.g*t)+","+Math.round(s.b+o.b*t)+","+(s.a+o.a*t)+")":s+o*t;e.setAttr(r,l)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,e=c.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,e=c.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(1e3*t),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const t=this.node._id,e=this._id,i=c.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const e in i)delete c.tweens[t][e];delete c.attrs[t][e],c.tweens[t]&&(0===Object.keys(c.tweens[t]).length&&delete c.tweens[t],0===Object.keys(c.attrs[t]).length&&delete c.attrs[t])}}e.Tween=c,c.attrs={},c.tweens={},a.Node.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new c(t).play()},e.Easings={BackEaseIn(t,e,i,n){const r=1.70158;return i*(t/=n)*t*((r+1)*t-r)+e},BackEaseOut(t,e,i,n){const r=1.70158;return i*((t=t/n-1)*t*((r+1)*t+r)+1)+e},BackEaseInOut(t,e,i,n){let r=1.70158;return(t/=n/2)<1?i/2*(t*t*((1+(r*=1.525))*t-r))+e:i/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},ElasticEaseIn(t,e,i,n,r,a){let s=0;return 0===t?e:1===(t/=n)?e+i:(a||(a=.3*n),!r||r<Math.abs(i)?(r=i,s=a/4):s=a/(2*Math.PI)*Math.asin(i/r),-r*Math.pow(2,10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/a)+e)},ElasticEaseOut(t,e,i,n,r,a){let s=0;return 0===t?e:1===(t/=n)?e+i:(a||(a=.3*n),!r||r<Math.abs(i)?(r=i,s=a/4):s=a/(2*Math.PI)*Math.asin(i/r),r*Math.pow(2,-10*t)*Math.sin((t*n-s)*(2*Math.PI)/a)+i+e)},ElasticEaseInOut(t,e,i,n,r,a){let s=0;return 0===t?e:2==(t/=n/2)?e+i:(a||(a=n*(.3*1.5)),!r||r<Math.abs(i)?(r=i,s=a/4):s=a/(2*Math.PI)*Math.asin(i/r),t<1?r*Math.pow(2,10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/a)*-.5+e:r*Math.pow(2,-10*(t-=1))*Math.sin((t*n-s)*(2*Math.PI)/a)*.5+i+e)},BounceEaseOut:(t,e,i,n)=>(t/=n)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(t,i,n,r)=>n-e.Easings.BounceEaseOut(r-t,0,n,r)+i,BounceEaseInOut:(t,i,n,r)=>t<r/2?.5*e.Easings.BounceEaseIn(2*t,0,n,r)+i:.5*e.Easings.BounceEaseOut(2*t-r,0,n,r)+.5*n+i,EaseIn:(t,e,i,n)=>i*(t/=n)*t+e,EaseOut:(t,e,i,n)=>-i*(t/=n)*(t-2)+e,EaseInOut:(t,e,i,n)=>(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,i,n)=>i*(t/=n)*t*t*t*t+e,StrongEaseOut:(t,e,i,n)=>i*((t=t/n-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,i,n)=>(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,i,n)=>i*t/n+e}},4060(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const n=i(8871);class r{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new r(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}translate(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this}scale(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.m[0]*e+this.m[2]*i,r=this.m[1]*e+this.m[3]*i,a=this.m[0]*-i+this.m[2]*e,s=this.m[1]*-i+this.m[3]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=a,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){const i=this.m[0]+this.m[2]*e,n=this.m[1]+this.m[3]*e,r=this.m[2]+this.m[0]*t,a=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=n,this.m[2]=r,this.m[3]=a,this}multiply(t){const e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],n=this.m[0]*t.m[2]+this.m[2]*t.m[3],r=this.m[1]*t.m[2]+this.m[3]*t.m[3],a=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],s=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=r,this.m[4]=a,this.m[5]=s,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,n=-this.m[2]*t,r=this.m[0]*t,a=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=r,this.m[4]=a,this.m[5]=s,this}getMatrix(){return this.m}decompose(){const t=this.m[0],i=this.m[1],n=this.m[2],r=this.m[3],a=t*r-i*n,s={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=t||0!=i){const e=Math.sqrt(t*t+i*i);s.rotation=i>0?Math.acos(t/e):-Math.acos(t/e),s.scaleX=e,s.scaleY=a/e,s.skewX=(t*n+i*r)/a,s.skewY=0}else if(0!=n||0!=r){const e=Math.sqrt(n*n+r*r);s.rotation=Math.PI/2-(r>0?Math.acos(-n/e):-Math.acos(n/e)),s.scaleX=a/e,s.scaleY=e,s.skewX=0,s.skewY=(t*n+i*r)/a}return s.rotation=e.Util._getRotation(s.rotation),s}}e.Transform=r;const a=Math.PI/180,s=180/Math.PI,o="Konva error: ",h={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},l=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let d=[];const c="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(t){setTimeout(t,60)};e.Util={_isElement:t=>!(!t||1!=t.nodeType),_isFunction:t=>!!(t&&t.constructor&&t.call&&t.apply),_isPlainObject:t=>!!t&&t.constructor===Object,_isArray:t=>"[object Array]"===Object.prototype.toString.call(t),_isNumber:t=>"[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)&&isFinite(t),_isString:t=>"[object String]"===Object.prototype.toString.call(t),_isBoolean:t=>"[object Boolean]"===Object.prototype.toString.call(t),isObject:t=>t instanceof Object,isValidSelector(t){if("string"!=typeof t)return!1;const e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:t=>0===t||t>0?1:-1,requestAnimFrame(t){d.push(t),1===d.length&&c(function(){const t=d;d=[],t.forEach(function(t){t()})})},createCanvasElement(){const t=document.createElement("canvas");try{t.style=t.style||{}}catch(t){}return t},createImageElement:()=>document.createElement("img"),_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,i){const n=e.Util.createImageElement();n.onload=function(){i(n)},n.src=t},_rgbToHex:(t,e,i)=>((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1),_hexToRgb(t){t=t.replace("#","");const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor(){let t=(16777215*Math.random()|0).toString(16);for(;t.length<6;)t="0"+t;return"#"+t},getRGB(t){let e;return t in h?(e=h[t],{r:e[0],g:e[1],b:e[2]}):"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?(e=l.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA:t=>(t=t||"black",e.Util._namedColorToRBA(t)||e.Util._hex3ColorToRGBA(t)||e.Util._hex4ColorToRGBA(t)||e.Util._hex6ColorToRGBA(t)||e.Util._hex8ColorToRGBA(t)||e.Util._rgbColorToRGBA(t)||e.Util._rgbaColorToRGBA(t)||e.Util._hslColorToRGBA(t)),_namedColorToRBA(t){const e=h[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(0===t.indexOf("rgb(")){const e=(t=t.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(0===t.indexOf("rgba(")){const e=(t=t.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map((t,e)=>"%"===t.slice(-1)?3===e?parseInt(t)/100:parseInt(t)/100*255:Number(t));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if("#"===t[0]&&9===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if("#"===t[0]&&7===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if("#"===t[0]&&5===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if("#"===t[0]&&4===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...i]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),n=Number(i[0])/360,r=Number(i[1])/100,a=Number(i[2])/100;let s,o,h;if(0===r)return h=255*a,{r:Math.round(h),g:Math.round(h),b:Math.round(h),a:1};s=a<.5?a*(1+r):a+r-a*r;const l=2*a-s,d=[0,0,0];for(let t=0;t<3;t++)o=n+1/3*-(t-1),o<0&&o++,o>1&&o--,h=6*o<1?l+6*(s-l)*o:2*o<1?s:3*o<2?l+(s-l)*(2/3-o)*6:l,d[t]=255*h;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection:(t,e)=>!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y),cloneObject(t){const e={};for(const i in t)this._isPlainObject(t[i])?e[i]=this.cloneObject(t[i]):this._isArray(t[i])?e[i]=this.cloneArray(t[i]):e[i]=t[i];return e},cloneArray:t=>t.slice(0),degToRad:t=>t*a,radToDeg:t=>t*s,_degToRad:t=>(e.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),e.Util.degToRad(t)),_radToDeg:t=>(e.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),e.Util.radToDeg(t)),_getRotation:t=>n.Konva.angleDeg?e.Util.radToDeg(t):t,_capitalize:t=>t.charAt(0).toUpperCase()+t.slice(1),throw(t){throw new Error(o+t)},error(t){console.error(o+t)},warn(t){n.Konva.showWarnings&&console.warn("Konva warning: "+t)},each(t,e){for(const i in t)e(i,t[i])},_inRange:(t,e,i)=>e<=t&&t<i,_getProjectionToSegment(t,e,i,n,r,a){let s,o,h;const l=(t-i)*(t-i)+(e-n)*(e-n);if(0==l)s=t,o=e,h=(r-i)*(r-i)+(a-n)*(a-n);else{const d=((r-t)*(i-t)+(a-e)*(n-e))/l;d<0?(s=t,o=e,h=(t-r)*(t-r)+(e-a)*(e-a)):d>1?(s=i,o=n,h=(i-r)*(i-r)+(n-a)*(n-a)):(s=t+d*(i-t),o=e+d*(n-e),h=(s-r)*(s-r)+(o-a)*(o-a))}return[s,o,h]},_getProjectionToLine(t,i,n){const r=e.Util.cloneObject(t);let a=Number.MAX_VALUE;return i.forEach(function(s,o){if(!n&&o===i.length-1)return;const h=i[(o+1)%i.length],l=e.Util._getProjectionToSegment(s.x,s.y,h.x,h.y,t.x,t.y),d=l[0],c=l[1],g=l[2];g<a&&(r.x=d,r.y=c,a=g)}),r},_prepareArrayForTween(t,i,n){const r=[],a=[];if(t.length>i.length){const e=i;i=t,t=e}for(let e=0;e<t.length;e+=2)r.push({x:t[e],y:t[e+1]});for(let t=0;t<i.length;t+=2)a.push({x:i[t],y:i[t+1]});const s=[];return a.forEach(function(t){const i=e.Util._getProjectionToLine(t,r,n);s.push(i.x),s.push(i.y)}),s},_prepareToStringify(t){let i;t.visitedByCircularReferenceRemoval=!0;for(const n in t)if(t.hasOwnProperty(n)&&t[n]&&"object"==typeof t[n])if(i=Object.getOwnPropertyDescriptor(t,n),t[n].visitedByCircularReferenceRemoval||e.Util._isElement(t[n])){if(!i.configurable)return null;delete t[n]}else if(null===e.Util._prepareToStringify(t[n])){if(!i.configurable)return null;delete t[n]}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(const i in e)t[i]=e[i];return t},_getFirstPointerId:t=>t.touches?t.changedTouches[0].identifier:t.pointerId||999,releaseCanvas(...t){n.Konva.releaseCanvasOnDestroy&&t.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(t,e,i,n){let r=0,a=0,s=0,o=0;"number"==typeof n?r=a=s=o=Math.min(n,e/2,i/2):(r=Math.min(n[0]||0,e/2,i/2),a=Math.min(n[1]||0,e/2,i/2),o=Math.min(n[2]||0,e/2,i/2),s=Math.min(n[3]||0,e/2,i/2)),t.moveTo(r,0),t.lineTo(e-a,0),t.arc(e-a,a,a,3*Math.PI/2,0,!1),t.lineTo(e,i-o),t.arc(e-o,i-o,o,0,Math.PI/2,!1),t.lineTo(s,i),t.arc(s,i-s,s,Math.PI/2,Math.PI,!1),t.lineTo(0,r),t.arc(r,r,r,Math.PI,3*Math.PI/2,!1)}}},5483(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RGBComponent=function(t){return t>255?255:t<0?0:Math.round(t)},e.alphaComponent=function(t){return t>1?1:t<1e-4?1e-4:t},e.getNumberValidator=function(){if(n.Konva.isUnminified)return function(t,e){return r.Util._isNumber(t)||r.Util.warn(a(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}},e.getNumberOrArrayOfNumbersValidator=function(t){if(n.Konva.isUnminified)return function(e,i){let n=r.Util._isNumber(e),s=r.Util._isArray(e)&&e.length==t;return n||s||r.Util.warn(a(e)+' is a not valid value for "'+i+'" attribute. The value should be a number or Array<number>('+t+")"),e}},e.getNumberOrAutoValidator=function(){if(n.Konva.isUnminified)return function(t,e){return r.Util._isNumber(t)||"auto"===t||r.Util.warn(a(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}},e.getStringValidator=function(){if(n.Konva.isUnminified)return function(t,e){return r.Util._isString(t)||r.Util.warn(a(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}},e.getStringOrGradientValidator=function(){if(n.Konva.isUnminified)return function(t,e){const i=r.Util._isString(t),n="[object CanvasGradient]"===Object.prototype.toString.call(t)||t&&t.addColorStop;return i||n||r.Util.warn(a(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}},e.getFunctionValidator=function(){if(n.Konva.isUnminified)return function(t,e){return r.Util._isFunction(t)||r.Util.warn(a(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}},e.getNumberArrayValidator=function(){if(n.Konva.isUnminified)return function(t,e){const i=Int8Array?Object.getPrototypeOf(Int8Array):null;return i&&t instanceof i||(r.Util._isArray(t)?t.forEach(function(t){r.Util._isNumber(t)||r.Util.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}):r.Util.warn(a(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}},e.getBooleanValidator=function(){if(n.Konva.isUnminified)return function(t,e){return!0===t||!1===t||r.Util.warn(a(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}},e.getComponentValidator=function(t){if(n.Konva.isUnminified)return function(e,i){return null==e||r.Util.isObject(e)||r.Util.warn(a(e)+' is a not valid value for "'+i+'" attribute. The value should be an object with properties '+t),e}};const n=i(8871),r=i(4060);function a(t){return r.Util._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)||r.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}},680(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;const n=i(8871),r=i(4060),a=i(6536),s=i(4473),o=i(7324),h=i(6267),l=i(7457),d=i(7949),c=i(1268),g=i(4723),u=i(9696),f=i(8665),p=i(9869),m=i(8604);e.Konva=r.Util._assign(n.Konva,{Util:r.Util,Transform:r.Transform,Node:a.Node,Container:s.Container,Stage:o.Stage,stages:o.stages,Layer:h.Layer,FastLayer:l.FastLayer,Group:d.Group,DD:c.DD,Shape:g.Shape,shapes:g.shapes,Animation:u.Animation,Tween:f.Tween,Easings:f.Easings,Context:p.Context,Canvas:m.Canvas}),e.default=e.Konva},8558(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;const n=i(680),r=i(4821),a=i(9456),s=i(9729),o=i(6955),h=i(7256),l=i(6619),d=i(3443),c=i(1486),g=i(5155),u=i(9131),f=i(5451),p=i(9308),m=i(4481),_=i(1958),y=i(8137),v=i(5058),b=i(8001),x=i(6261),S=i(6627),C=i(2650),w=i(983),P=i(7928),k=i(7241),A=i(5461),T=i(4843),F=i(6564),M=i(5553),G=i(8624),R=i(5992),D=i(4943),E=i(7019),N=i(6921),O=i(3862),L=i(2512),I=i(517),U=i(661);e.Konva=n.Konva.Util._assign(n.Konva,{Arc:r.Arc,Arrow:a.Arrow,Circle:s.Circle,Ellipse:o.Ellipse,Image:h.Image,Label:l.Label,Tag:l.Tag,Line:d.Line,Path:c.Path,Rect:g.Rect,RegularPolygon:u.RegularPolygon,Ring:f.Ring,Sprite:p.Sprite,Star:m.Star,Text:_.Text,TextPath:y.TextPath,Transformer:v.Transformer,Wedge:b.Wedge,Filters:{Blur:x.Blur,Brighten:S.Brighten,Contrast:C.Contrast,Emboss:w.Emboss,Enhance:P.Enhance,Grayscale:k.Grayscale,HSL:A.HSL,HSV:T.HSV,Invert:F.Invert,Kaleidoscope:M.Kaleidoscope,Mask:G.Mask,Noise:R.Noise,Pixelate:D.Pixelate,Posterize:E.Posterize,RGB:N.RGB,RGBA:O.RGBA,Sepia:L.Sepia,Solarize:I.Solarize,Threshold:U.Threshold}})},6261(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Blur=void 0;const n=i(4892),r=i(6536),a=i(5483);function s(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const o=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],h=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];e.Blur=function(t){const e=Math.round(this.blurRadius());e>0&&function(t,e){const i=t.data,n=t.width,r=t.height;let a,l,d,c,g,u,f,p,m,_,y,v,b,x,S,C,w,P,k,A;const T=e+e+1,F=n-1,M=r-1,G=e+1,R=G*(G+1)/2,D=new s,E=o[e],N=h[e];let O=null,L=D,I=null,U=null;for(let t=1;t<T;t++)L=L.next=new s,t===G&&(O=L);L.next=D,d=l=0;for(let t=0;t<r;t++){v=b=x=S=c=g=u=f=0,p=G*(C=i[l]),m=G*(w=i[l+1]),_=G*(P=i[l+2]),y=G*(k=i[l+3]),c+=R*C,g+=R*w,u+=R*P,f+=R*k,L=D;for(let t=0;t<G;t++)L.r=C,L.g=w,L.b=P,L.a=k,L=L.next;for(let t=1;t<G;t++)a=l+((F<t?F:t)<<2),c+=(L.r=C=i[a])*(A=G-t),g+=(L.g=w=i[a+1])*A,u+=(L.b=P=i[a+2])*A,f+=(L.a=k=i[a+3])*A,v+=C,b+=w,x+=P,S+=k,L=L.next;I=D,U=O;for(let t=0;t<n;t++)i[l+3]=k=f*E>>N,0!==k?(k=255/k,i[l]=(c*E>>N)*k,i[l+1]=(g*E>>N)*k,i[l+2]=(u*E>>N)*k):i[l]=i[l+1]=i[l+2]=0,c-=p,g-=m,u-=_,f-=y,p-=I.r,m-=I.g,_-=I.b,y-=I.a,a=d+((a=t+e+1)<F?a:F)<<2,v+=I.r=i[a],b+=I.g=i[a+1],x+=I.b=i[a+2],S+=I.a=i[a+3],c+=v,g+=b,u+=x,f+=S,I=I.next,p+=C=U.r,m+=w=U.g,_+=P=U.b,y+=k=U.a,v-=C,b-=w,x-=P,S-=k,U=U.next,l+=4;d+=n}for(let t=0;t<n;t++){b=x=S=v=g=u=f=c=0,l=t<<2,p=G*(C=i[l]),m=G*(w=i[l+1]),_=G*(P=i[l+2]),y=G*(k=i[l+3]),c+=R*C,g+=R*w,u+=R*P,f+=R*k,L=D;for(let t=0;t<G;t++)L.r=C,L.g=w,L.b=P,L.a=k,L=L.next;let s=n;for(let r=1;r<=e;r++)l=s+t<<2,c+=(L.r=C=i[l])*(A=G-r),g+=(L.g=w=i[l+1])*A,u+=(L.b=P=i[l+2])*A,f+=(L.a=k=i[l+3])*A,v+=C,b+=w,x+=P,S+=k,L=L.next,r<M&&(s+=n);l=t,I=D,U=O;for(let e=0;e<r;e++)a=l<<2,i[a+3]=k=f*E>>N,k>0?(k=255/k,i[a]=(c*E>>N)*k,i[a+1]=(g*E>>N)*k,i[a+2]=(u*E>>N)*k):i[a]=i[a+1]=i[a+2]=0,c-=p,g-=m,u-=_,f-=y,p-=I.r,m-=I.g,_-=I.b,y-=I.a,a=t+((a=e+G)<M?a:M)*n<<2,c+=v+=I.r=i[a],g+=b+=I.g=i[a+1],u+=x+=I.b=i[a+2],f+=S+=I.a=i[a+3],I=I.next,p+=C=U.r,m+=w=U.g,_+=P=U.b,y+=k=U.a,v-=C,b-=w,x-=P,S-=k,U=U.next,l+=n}}(t,e)},n.Factory.addGetterSetter(r.Node,"blurRadius",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},6627(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Brighten=void 0;const n=i(4892),r=i(6536),a=i(5483);e.Brighten=function(t){const e=255*this.brightness(),i=t.data,n=i.length;for(let t=0;t<n;t+=4)i[t]+=e,i[t+1]+=e,i[t+2]+=e},n.Factory.addGetterSetter(r.Node,"brightness",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},2650(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Contrast=void 0;const n=i(4892),r=i(6536),a=i(5483);e.Contrast=function(t){const e=Math.pow((this.contrast()+100)/100,2),i=t.data,n=i.length;let r=150,a=150,s=150;for(let t=0;t<n;t+=4)r=i[t],a=i[t+1],s=i[t+2],r/=255,r-=.5,r*=e,r+=.5,r*=255,a/=255,a-=.5,a*=e,a+=.5,a*=255,s/=255,s-=.5,s*=e,s+=.5,s*=255,r=r<0?0:r>255?255:r,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,i[t]=r,i[t+1]=a,i[t+2]=s},n.Factory.addGetterSetter(r.Node,"contrast",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},983(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Emboss=void 0;const n=i(4892),r=i(6536),a=i(4060),s=i(5483);e.Emboss=function(t){const e=10*this.embossStrength(),i=255*this.embossWhiteLevel(),n=this.embossDirection(),r=this.embossBlend(),s=t.data,o=t.width,h=t.height,l=4*o;let d=0,c=0,g=h;switch(n){case"top-left":d=-1,c=-1;break;case"top":d=-1,c=0;break;case"top-right":d=-1,c=1;break;case"right":d=0,c=1;break;case"bottom-right":d=1,c=1;break;case"bottom":d=1,c=0;break;case"bottom-left":d=1,c=-1;break;case"left":d=0,c=-1;break;default:a.Util.error("Unknown emboss direction: "+n)}do{const t=(g-1)*l;let n=d;g+n<1&&(n=0),g+n>h&&(n=0);const a=(g-1+n)*o*4;let u=o;do{const n=t+4*(u-1);let h=c;u+h<1&&(h=0),u+h>o&&(h=0);const l=a+4*(u-1+h),d=s[n]-s[l],g=s[n+1]-s[l+1],f=s[n+2]-s[l+2];let p=d;const m=p>0?p:-p;if((g>0?g:-g)>m&&(p=g),(f>0?f:-f)>m&&(p=f),p*=e,r){const t=s[n]+p,e=s[n+1]+p,i=s[n+2]+p;s[n]=t>255?255:t<0?0:t,s[n+1]=e>255?255:e<0?0:e,s[n+2]=i>255?255:i<0?0:i}else{let t=i-p;t<0?t=0:t>255&&(t=255),s[n]=s[n+1]=s[n+2]=t}}while(--u)}while(--g)},n.Factory.addGetterSetter(r.Node,"embossStrength",.5,(0,s.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"embossWhiteLevel",.5,(0,s.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"embossDirection","top-left",void 0,n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"embossBlend",!1,void 0,n.Factory.afterSetFilter)},7928(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Enhance=void 0;const n=i(4892),r=i(6536),a=i(5483);function s(t,e,i,n,r){const a=i-e,s=r-n;if(0===a)return n+s/2;if(0===s)return n;let o=(t-e)/a;return o=s*o+n,o}e.Enhance=function(t){const e=t.data,i=e.length;let n,r,a,o=e[0],h=o,l=e[1],d=l,c=e[2],g=c;const u=this.enhance();if(0===u)return;for(let t=0;t<i;t+=4)n=e[t+0],n<o?o=n:n>h&&(h=n),r=e[t+1],r<l?l=r:r>d&&(d=r),a=e[t+2],a<c?c=a:a>g&&(g=a);let f,p,m,_,y,v;if(h===o&&(h=255,o=0),d===l&&(d=255,l=0),g===c&&(g=255,c=0),u>0)f=h+u*(255-h),p=o-u*(o-0),m=d+u*(255-d),_=l-u*(l-0),y=g+u*(255-g),v=c-u*(c-0);else{const t=.5*(h+o);f=h+u*(h-t),p=o+u*(o-t);const e=.5*(d+l);m=d+u*(d-e),_=l+u*(l-e);const i=.5*(g+c);y=g+u*(g-i),v=c+u*(c-i)}for(let t=0;t<i;t+=4)e[t+0]=s(e[t+0],o,h,p,f),e[t+1]=s(e[t+1],l,d,_,m),e[t+2]=s(e[t+2],c,g,v,y)},n.Factory.addGetterSetter(r.Node,"enhance",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},7241(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Grayscale=void 0,e.Grayscale=function(t){const e=t.data,i=e.length;for(let t=0;t<i;t+=4){const i=.34*e[t]+.5*e[t+1]+.16*e[t+2];e[t]=i,e[t+1]=i,e[t+2]=i}}},5461(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.HSL=void 0;const n=i(4892),r=i(6536),a=i(5483);n.Factory.addGetterSetter(r.Node,"hue",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"saturation",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"luminance",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter),e.HSL=function(t){const e=t.data,i=e.length,n=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,a=127*this.luminance(),s=1*n*Math.cos(r*Math.PI/180),o=1*n*Math.sin(r*Math.PI/180),h=.299+.701*s+.167*o,l=.587-.587*s+.33*o,d=.114-.114*s-.497*o,c=.299-.299*s-.328*o,g=.587+.413*s+.035*o,u=.114-.114*s+.293*o,f=.299-.3*s+1.25*o,p=.587-.586*s-1.05*o,m=.114+.886*s-.2*o;let _,y,v,b;for(let t=0;t<i;t+=4)_=e[t+0],y=e[t+1],v=e[t+2],b=e[t+3],e[t+0]=h*_+l*y+d*v+a,e[t+1]=c*_+g*y+u*v+a,e[t+2]=f*_+p*y+m*v+a,e[t+3]=b}},4843(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.HSV=void 0;const n=i(4892),r=i(6536),a=i(5483);e.HSV=function(t){const e=t.data,i=e.length,n=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,s=n*r*Math.cos(a*Math.PI/180),o=n*r*Math.sin(a*Math.PI/180),h=.299*n+.701*s+.167*o,l=.587*n-.587*s+.33*o,d=.114*n-.114*s-.497*o,c=.299*n-.299*s-.328*o,g=.587*n+.413*s+.035*o,u=.114*n-.114*s+.293*o,f=.299*n-.3*s+1.25*o,p=.587*n-.586*s-1.05*o,m=.114*n+.886*s-.2*o;for(let t=0;t<i;t+=4){const i=e[t+0],n=e[t+1],r=e[t+2],a=e[t+3];e[t+0]=h*i+l*n+d*r,e[t+1]=c*i+g*n+u*r,e[t+2]=f*i+p*n+m*r,e[t+3]=a}},n.Factory.addGetterSetter(r.Node,"hue",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"saturation",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"value",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},6564(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Invert=void 0,e.Invert=function(t){const e=t.data,i=e.length;for(let t=0;t<i;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}},5553(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Kaleidoscope=void 0;const n=i(4892),r=i(6536),a=i(4060),s=i(5483);e.Kaleidoscope=function(t){const e=t.width,i=t.height;let n,r,s,o,h,l,d,c,g,u,f=Math.round(this.kaleidoscopePower());const p=Math.round(this.kaleidoscopeAngle()),m=Math.floor(e*(p%360)/360);if(f<1)return;const _=a.Util.createCanvasElement();_.width=e,_.height=i;const y=_.getContext("2d").getImageData(0,0,e,i);a.Util.releaseCanvas(_),function(t,e,i){const n=t.data,r=e.data,a=t.width,s=t.height,o=i.polarCenterX||a/2,h=i.polarCenterY||s/2;let l=Math.sqrt(o*o+h*h),d=a-o,c=s-h;const g=Math.sqrt(d*d+c*c);l=g>l?g:l;const u=s,f=a,p=360/f*Math.PI/180;for(let t=0;t<f;t+=1){const e=Math.sin(t*p),i=Math.cos(t*p);for(let s=0;s<u;s+=1){d=Math.floor(o+l*s/u*i),c=Math.floor(h+l*s/u*e);let g=4*(c*a+d);const f=n[g+0],p=n[g+1],m=n[g+2],_=n[g+3];g=4*(t+s*a),r[g+0]=f,r[g+1]=p,r[g+2]=m,r[g+3]=_}}}(t,y,{polarCenterX:e/2,polarCenterY:i/2});let v=e/Math.pow(2,f);for(;v<=8;)v*=2,f-=1;v=Math.ceil(v);let b=v,x=0,S=b,C=1;for(m+v>e&&(x=b,S=0,C=-1),r=0;r<i;r+=1)for(n=x;n!==S;n+=C)s=Math.round(n+m)%e,g=4*(e*r+s),h=y.data[g+0],l=y.data[g+1],d=y.data[g+2],c=y.data[g+3],u=4*(e*r+n),y.data[u+0]=h,y.data[u+1]=l,y.data[u+2]=d,y.data[u+3]=c;for(r=0;r<i;r+=1)for(b=Math.floor(v),o=0;o<f;o+=1){for(n=0;n<b+1;n+=1)g=4*(e*r+n),h=y.data[g+0],l=y.data[g+1],d=y.data[g+2],c=y.data[g+3],u=4*(e*r+2*b-n-1),y.data[u+0]=h,y.data[u+1]=l,y.data[u+2]=d,y.data[u+3]=c;b*=2}!function(t,e,i){const n=t.data,r=e.data,a=t.width,s=t.height,o=i.polarCenterX||a/2,h=i.polarCenterY||s/2;let l=Math.sqrt(o*o+h*h),d=a-o,c=s-h;const g=Math.sqrt(d*d+c*c);l=g>l?g:l;const u=s,f=a,p=i.polarRotation||0;let m,_;for(d=0;d<a;d+=1)for(c=0;c<s;c+=1){const t=d-o,e=c-h,i=Math.sqrt(t*t+e*e)*u/l;let s=(180*Math.atan2(e,t)/Math.PI+360+p)%360;s=s*f/360,m=Math.floor(s),_=Math.floor(i);let g=4*(_*a+m);const y=n[g+0],v=n[g+1],b=n[g+2],x=n[g+3];g=4*(c*a+d),r[g+0]=y,r[g+1]=v,r[g+2]=b,r[g+3]=x}}(y,t,{polarRotation:0})},n.Factory.addGetterSetter(r.Node,"kaleidoscopePower",2,(0,s.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"kaleidoscopeAngle",0,(0,s.getNumberValidator)(),n.Factory.afterSetFilter)},8624(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Mask=void 0;const n=i(4892),r=i(6536),a=i(5483);function s(t,e,i){let n=4*(i*t.width+e);const r=[];return r.push(t.data[n++],t.data[n++],t.data[n++],t.data[n++]),r}function o(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}e.Mask=function(t){let e=function(t,e){const i=s(t,0,0),n=s(t,t.width-1,0),r=s(t,0,t.height-1),a=s(t,t.width-1,t.height-1),h=e||10;if(o(i,n)<h&&o(n,a)<h&&o(a,r)<h&&o(r,i)<h){const e=function(t){const e=[0,0,0];for(let i=0;i<t.length;i++)e[0]+=t[i][0],e[1]+=t[i][1],e[2]+=t[i][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}([n,i,a,r]),s=[];for(let i=0;i<t.width*t.height;i++){const n=o(e,[t.data[4*i],t.data[4*i+1],t.data[4*i+2]]);s[i]=n<h?0:255}return s}}(t,this.threshold());return e&&(e=function(t,e,i){const n=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(n.length)),a=Math.floor(r/2),s=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){const l=o*e+h;let d=0;for(let s=0;s<r;s++)for(let l=0;l<r;l++){const c=o+s-a,g=h+l-a;if(c>=0&&c<i&&g>=0&&g<e){const i=n[s*r+l];d+=t[c*e+g]*i}}s[l]=2040===d?255:0}return s}(e,t.width,t.height),e=function(t,e,i){const n=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(n.length)),a=Math.floor(r/2),s=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){const l=o*e+h;let d=0;for(let s=0;s<r;s++)for(let l=0;l<r;l++){const c=o+s-a,g=h+l-a;if(c>=0&&c<i&&g>=0&&g<e){const i=n[s*r+l];d+=t[c*e+g]*i}}s[l]=d>=1020?255:0}return s}(e,t.width,t.height),e=function(t,e,i){const n=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],r=Math.round(Math.sqrt(n.length)),a=Math.floor(r/2),s=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){const l=o*e+h;let d=0;for(let s=0;s<r;s++)for(let l=0;l<r;l++){const c=o+s-a,g=h+l-a;if(c>=0&&c<i&&g>=0&&g<e){const i=n[s*r+l];d+=t[c*e+g]*i}}s[l]=d}return s}(e,t.width,t.height),function(t,e){for(let i=0;i<t.width*t.height;i++)t.data[4*i+3]=e[i]}(t,e)),t},n.Factory.addGetterSetter(r.Node,"threshold",0,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},5992(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Noise=void 0;const n=i(4892),r=i(6536),a=i(5483);e.Noise=function(t){const e=255*this.noise(),i=t.data,n=i.length,r=e/2;for(let t=0;t<n;t+=4)i[t+0]+=r-2*r*Math.random(),i[t+1]+=r-2*r*Math.random(),i[t+2]+=r-2*r*Math.random()},n.Factory.addGetterSetter(r.Node,"noise",.2,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},4943(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Pixelate=void 0;const n=i(4892),r=i(4060),a=i(6536),s=i(5483);e.Pixelate=function(t){let e=Math.ceil(this.pixelSize()),i=t.width,n=t.height,a=Math.ceil(i/e),s=Math.ceil(n/e),o=t.data;if(e<=0)r.Util.error("pixelSize value can not be <= 0");else for(let t=0;t<a;t+=1)for(let r=0;r<s;r+=1){let a=0,s=0,h=0,l=0;const d=t*e,c=d+e,g=r*e,u=g+e;let f=0;for(let t=d;t<c;t+=1)if(!(t>=i))for(let e=g;e<u;e+=1){if(e>=n)continue;const r=4*(i*e+t);a+=o[r+0],s+=o[r+1],h+=o[r+2],l+=o[r+3],f+=1}a/=f,s/=f,h/=f,l/=f;for(let t=d;t<c;t+=1)if(!(t>=i))for(let e=g;e<u;e+=1){if(e>=n)continue;const r=4*(i*e+t);o[r+0]=a,o[r+1]=s,o[r+2]=h,o[r+3]=l}}},n.Factory.addGetterSetter(a.Node,"pixelSize",8,(0,s.getNumberValidator)(),n.Factory.afterSetFilter)},7019(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Posterize=void 0;const n=i(4892),r=i(6536),a=i(5483);e.Posterize=function(t){const e=Math.round(254*this.levels())+1,i=t.data,n=i.length,r=255/e;for(let t=0;t<n;t+=1)i[t]=Math.floor(i[t]/r)*r},n.Factory.addGetterSetter(r.Node,"levels",.5,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},6921(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RGB=void 0;const n=i(4892),r=i(6536),a=i(5483);e.RGB=function(t){const e=t.data,i=e.length,n=this.red(),r=this.green(),a=this.blue();for(let t=0;t<i;t+=4){const i=(.34*e[t]+.5*e[t+1]+.16*e[t+2])/255;e[t]=i*n,e[t+1]=i*r,e[t+2]=i*a,e[t+3]=e[t+3]}},n.Factory.addGetterSetter(r.Node,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),n.Factory.addGetterSetter(r.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),n.Factory.addGetterSetter(r.Node,"blue",0,a.RGBComponent,n.Factory.afterSetFilter)},3862(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RGBA=void 0;const n=i(4892),r=i(6536),a=i(5483);e.RGBA=function(t){const e=t.data,i=e.length,n=this.red(),r=this.green(),a=this.blue(),s=this.alpha();for(let t=0;t<i;t+=4){const i=1-s;e[t]=n*s+e[t]*i,e[t+1]=r*s+e[t+1]*i,e[t+2]=a*s+e[t+2]*i}},n.Factory.addGetterSetter(r.Node,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),n.Factory.addGetterSetter(r.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)}),n.Factory.addGetterSetter(r.Node,"blue",0,a.RGBComponent,n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t})},2512(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Sepia=void 0,e.Sepia=function(t){const e=t.data,i=e.length;for(let t=0;t<i;t+=4){const i=e[t+0],n=e[t+1],r=e[t+2];e[t+0]=Math.min(255,.393*i+.769*n+.189*r),e[t+1]=Math.min(255,.349*i+.686*n+.168*r),e[t+2]=Math.min(255,.272*i+.534*n+.131*r)}}},517(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Solarize=void 0,e.Solarize=function(t){const e=t.data,i=t.width,n=4*i;let r=t.height;do{const t=(r-1)*n;let a=i;do{const i=t+4*(a-1);let n=e[i],r=e[i+1],s=e[i+2];n>127&&(n=255-n),r>127&&(r=255-r),s>127&&(s=255-s),e[i]=n,e[i+1]=r,e[i+2]=s}while(--a)}while(--r)}},661(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Threshold=void 0;const n=i(4892),r=i(6536),a=i(5483);e.Threshold=function(t){const e=255*this.threshold(),i=t.data,n=i.length;for(let t=0;t<n;t+=1)i[t]=i[t]<e?0:255},n.Factory.addGetterSetter(r.Node,"threshold",.5,(0,a.getNumberValidator)(),n.Factory.afterSetFilter)},5778(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});const n=i(8558);t.exports=n.Konva},4821(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Arc=void 0;const n=i(4892),r=i(4723),a=i(8871),s=i(5483),o=i(8871);class h extends r.Shape{_sceneFunc(t){const e=a.Konva.getAngle(this.angle()),i=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,i),t.arc(0,0,this.innerRadius(),e,0,!i),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),i=this.clockwise(),n=a.Konva.getAngle(i?360-this.angle():this.angle()),r=Math.cos(Math.min(n,Math.PI)),s=Math.sin(Math.min(Math.max(Math.PI,n),3*Math.PI/2)),o=Math.sin(Math.min(n,Math.PI/2)),h=r*(r>0?t:e),l=s*(s>0?t:e),d=o*(o>0?e:t);return{x:h,y:i?-1*d:l,width:1*e-h,height:d-l}}}e.Arc=h,h.prototype._centroid=!0,h.prototype.className="Arc",h.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],(0,o._registerNode)(h),n.Factory.addGetterSetter(h,"innerRadius",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(h,"outerRadius",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(h,"angle",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(h,"clockwise",!1,(0,s.getBooleanValidator)())},9456(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Arrow=void 0;const n=i(4892),r=i(3443),a=i(5483),s=i(8871),o=i(1486);class h extends r.Line{_sceneFunc(t){super._sceneFunc(t);const e=2*Math.PI,i=this.points();let n=i;const r=0!==this.tension()&&i.length>4;r&&(n=this.getTensionPoints());const a=this.pointerLength(),s=i.length;let h,l;if(r){const t=[n[n.length-4],n[n.length-3],n[n.length-2],n[n.length-1],i[s-2],i[s-1]],e=o.Path.calcLength(n[n.length-4],n[n.length-3],"C",t),r=o.Path.getPointOnQuadraticBezier(Math.min(1,1-a/e),t[0],t[1],t[2],t[3],t[4],t[5]);h=i[s-2]-r.x,l=i[s-1]-r.y}else h=i[s-2]-i[s-4],l=i[s-1]-i[s-3];const d=(Math.atan2(l,h)+e)%e,c=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(i[s-2],i[s-1]),t.rotate(d),t.moveTo(0,0),t.lineTo(-a,c/2),t.lineTo(-a,-c/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(i[0],i[1]),r?(h=(n[0]+n[2])/2-i[0],l=(n[1]+n[3])/2-i[1]):(h=i[2]-i[0],l=i[3]-i[1]),t.rotate((Math.atan2(-l,-h)+e)%e),t.moveTo(0,0),t.lineTo(-a,c/2),t.lineTo(-a,-c/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){const e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x,y:t.y-e,width:t.width,height:t.height+2*e}}}e.Arrow=h,h.prototype.className="Arrow",(0,s._registerNode)(h),n.Factory.addGetterSetter(h,"pointerLength",10,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(h,"pointerWidth",10,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(h,"pointerAtBeginning",!1),n.Factory.addGetterSetter(h,"pointerAtEnding",!0)},9729(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Circle=void 0;const n=i(4892),r=i(4723),a=i(5483),s=i(8871);class o extends r.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}e.Circle=o,o.prototype._centroid=!0,o.prototype.className="Circle",o.prototype._attrsAffectingSize=["radius"],(0,s._registerNode)(o),n.Factory.addGetterSetter(o,"radius",0,(0,a.getNumberValidator)())},6955(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Ellipse=void 0;const n=i(4892),r=i(4723),a=i(5483),s=i(8871);class o extends r.Shape{_sceneFunc(t){const e=this.radiusX(),i=this.radiusY();t.beginPath(),t.save(),e!==i&&t.scale(1,i/e),t.arc(0,0,e,0,2*Math.PI,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}e.Ellipse=o,o.prototype.className="Ellipse",o.prototype._centroid=!0,o.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,s._registerNode)(o),n.Factory.addComponentsGetterSetter(o,"radius",["x","y"]),n.Factory.addGetterSetter(o,"radiusX",0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(o,"radiusY",0,(0,a.getNumberValidator)())},7256(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Image=void 0;const n=i(4060),r=i(4892),a=i(4723),s=i(8871),o=i(5483);class h extends a.Shape{constructor(t){super(t),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",t=>{this._removeImageLoad(t.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&4===t.readyState||t&&t.addEventListener&&t.addEventListener("load",this._loadListener)}_removeImageLoad(t){t&&t.removeEventListener&&t.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const t=!!this.cornerRadius(),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),i=this.getHeight(),r=this.cornerRadius(),a=this.attrs.image;let s;if(a){const t=this.attrs.cropWidth,n=this.attrs.cropHeight;s=t&&n?[a,this.cropX(),this.cropY(),t,n,0,0,e,i]:[a,0,0,e,i]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?n.Util.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)),a&&(r&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){const e=this.width(),i=this.height(),r=this.cornerRadius();t.beginPath(),r?n.Util.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return null!==(t=this.attrs.width)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.width}getHeight(){var t,e;return null!==(t=this.attrs.height)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.height}static fromURL(t,e,i=null){const r=n.Util.createImageElement();r.onload=function(){const t=new h({image:r});e(t)},r.onerror=i,r.crossOrigin="Anonymous",r.src=t}}e.Image=h,h.prototype.className="Image",(0,s._registerNode)(h),r.Factory.addGetterSetter(h,"cornerRadius",0,(0,o.getNumberOrArrayOfNumbersValidator)(4)),r.Factory.addGetterSetter(h,"image"),r.Factory.addComponentsGetterSetter(h,"crop",["x","y","width","height"]),r.Factory.addGetterSetter(h,"cropX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(h,"cropY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(h,"cropWidth",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(h,"cropHeight",0,(0,o.getNumberValidator)())},6619(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Tag=e.Label=void 0;const n=i(4892),r=i(4723),a=i(7949),s=i(5483),o=i(8871),h=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],l="up",d="right",c="down",g="left",u=h.length;class f extends a.Group{constructor(t){super(t),this.on("add.konva",function(t){this._addListeners(t.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){let e,i=this;const n=function(){i._sync()};for(e=0;e<u;e++)t.on(h[e]+"Change.konva",n)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let t,e,i,n,r,a,s,o=this.getText(),h=this.getTag();if(o&&h){switch(t=o.width(),e=o.height(),i=h.pointerDirection(),n=h.pointerWidth(),s=h.pointerHeight(),r=0,a=0,i){case l:r=t/2,a=-1*s;break;case d:r=t+n,a=e/2;break;case c:r=t/2,a=e+s;break;case g:r=-1*n,a=e/2}h.setAttrs({x:-1*r,y:-1*a,width:t,height:e}),o.setAttrs({x:-1*r,y:-1*a})}}}e.Label=f,f.prototype.className="Label",(0,o._registerNode)(f);class p extends r.Shape{_sceneFunc(t){const e=this.width(),i=this.height(),n=this.pointerDirection(),r=this.pointerWidth(),a=this.pointerHeight(),s=this.cornerRadius();let o=0,h=0,u=0,f=0;"number"==typeof s?o=h=u=f=Math.min(s,e/2,i/2):(o=Math.min(s[0]||0,e/2,i/2),h=Math.min(s[1]||0,e/2,i/2),f=Math.min(s[2]||0,e/2,i/2),u=Math.min(s[3]||0,e/2,i/2)),t.beginPath(),t.moveTo(o,0),n===l&&(t.lineTo((e-r)/2,0),t.lineTo(e/2,-1*a),t.lineTo((e+r)/2,0)),t.lineTo(e-h,0),t.arc(e-h,h,h,3*Math.PI/2,0,!1),n===d&&(t.lineTo(e,(i-a)/2),t.lineTo(e+r,i/2),t.lineTo(e,(i+a)/2)),t.lineTo(e,i-f),t.arc(e-f,i-f,f,0,Math.PI/2,!1),n===c&&(t.lineTo((e+r)/2,i),t.lineTo(e/2,i+a),t.lineTo((e-r)/2,i)),t.lineTo(u,i),t.arc(u,i-u,u,Math.PI/2,Math.PI,!1),n===g&&(t.lineTo(0,(i+a)/2),t.lineTo(-1*r,i/2),t.lineTo(0,(i-a)/2)),t.lineTo(0,o),t.arc(o,o,o,Math.PI,3*Math.PI/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){let t=0,e=0,i=this.pointerWidth(),n=this.pointerHeight(),r=this.pointerDirection(),a=this.width(),s=this.height();return r===l?(e-=n,s+=n):r===c?s+=n:r===g?(t-=1.5*i,a+=i):r===d&&(a+=1.5*i),{x:t,y:e,width:a,height:s}}}e.Tag=p,p.prototype.className="Tag",(0,o._registerNode)(p),n.Factory.addGetterSetter(p,"pointerDirection","none"),n.Factory.addGetterSetter(p,"pointerWidth",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(p,"pointerHeight",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(p,"cornerRadius",0,(0,s.getNumberOrArrayOfNumbersValidator)(4))},3443(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Line=void 0;const n=i(4892),r=i(8871),a=i(4723),s=i(5483);function o(t,e,i,n,r,a,s){const o=Math.sqrt(Math.pow(i-t,2)+Math.pow(n-e,2)),h=Math.sqrt(Math.pow(r-i,2)+Math.pow(a-n,2)),l=s*o/(o+h),d=s*h/(o+h);return[i-l*(r-t),n-l*(a-e),i+d*(r-t),n+d*(a-e)]}function h(t,e){const i=t.length,n=[];for(let r=2;r<i-2;r+=2){const i=o(t[r-2],t[r-1],t[r],t[r+1],t[r+2],t[r+3],e);isNaN(i[0])||(n.push(i[0]),n.push(i[1]),n.push(t[r]),n.push(t[r+1]),n.push(i[2]),n.push(i[3]))}return n}class l extends a.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){const e=this.points(),i=e.length,n=this.tension(),r=this.closed(),a=this.bezier();if(!i)return;let s=0;if(t.beginPath(),t.moveTo(e[0],e[1]),0!==n&&i>4){const n=this.getTensionPoints(),a=n.length;for(s=r?0:4,r||t.quadraticCurveTo(n[0],n[1],n[2],n[3]);s<a-2;)t.bezierCurveTo(n[s++],n[s++],n[s++],n[s++],n[s++],n[s++]);r||t.quadraticCurveTo(n[a-2],n[a-1],e[i-2],e[i-1])}else if(a)for(s=2;s<i;)t.bezierCurveTo(e[s++],e[s++],e[s++],e[s++],e[s++],e[s++]);else for(s=2;s<i;s+=2)t.lineTo(e[s],e[s+1]);r?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():h(this.points(),this.tension())}_getTensionPointsClosed(){const t=this.points(),e=t.length,i=this.tension(),n=o(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),r=o(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),a=h(t,i);return[n[2],n[3]].concat(a).concat([r[0],r[1],t[e-2],t[e-1],r[2],r[3],n[0],n[1],t[0],t[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};t=0!==this.tension()?[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:this.points();let e,i,n=t[0],r=t[0],a=t[1],s=t[1];for(let o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],n=Math.min(n,e),r=Math.max(r,e),a=Math.min(a,i),s=Math.max(s,i);return{x:n,y:a,width:r-n,height:s-a}}}e.Line=l,l.prototype.className="Line",l.prototype._attrsAffectingSize=["points","bezier","tension"],(0,r._registerNode)(l),n.Factory.addGetterSetter(l,"closed",!1),n.Factory.addGetterSetter(l,"bezier",!1),n.Factory.addGetterSetter(l,"tension",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(l,"points",[],(0,s.getNumberArrayValidator)())},1486(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Path=void 0;const n=i(4892),r=i(8871),a=i(4723),s=i(5570);class o extends a.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=o.parsePathData(this.data()),this.pathLength=o.getPathLength(this.dataArray)}_sceneFunc(t){const e=this.dataArray;t.beginPath();let i=!1;for(let n=0;n<e.length;n++){const r=e[n].command,a=e[n].points;switch(r){case"L":t.lineTo(a[0],a[1]);break;case"M":t.moveTo(a[0],a[1]);break;case"C":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":t.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":const e=a[0],n=a[1],r=a[2],s=a[3],o=a[4],h=a[5],l=a[6],d=a[7],c=r>s?r:s,g=r>s?1:r/s,u=r>s?s/r:1;t.translate(e,n),t.rotate(l),t.scale(g,u),t.arc(0,0,c,o,o+h,1-d),t.scale(1/g,1/u),t.rotate(-l),t.translate(-e,-n);break;case"z":i=!0,t.closePath()}}i||this.hasFill()?t.fillStrokeShape(this):t.strokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(e){if("A"===e.command){const i=e.points[4],n=e.points[5],r=e.points[4]+n;let a=Math.PI/180;if(Math.abs(i-r)<a&&(a=Math.abs(i-r)),n<0)for(let n=i-a;n>r;n-=a){const i=o.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],n,0);t.push(i.x,i.y)}else for(let n=i+a;n<r;n+=a){const i=o.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],n,0);t.push(i.x,i.y)}}else if("C"===e.command)for(let i=0;i<=1;i+=.01){const n=o.getPointOnCubicBezier(i,e.start.x,e.start.y,e.points[0],e.points[1],e.points[2],e.points[3],e.points[4],e.points[5]);t.push(n.x,n.y)}else t=t.concat(e.points)});let e,i,n=t[0],r=t[0],a=t[1],s=t[1];for(let o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],isNaN(e)||(n=Math.min(n,e),r=Math.max(r,e)),isNaN(i)||(a=Math.min(a,i),s=Math.max(s,i));return{x:n,y:a,width:r-n,height:s-a}}getLength(){return this.pathLength}getPointAtLength(t){return o.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))}static getPathLength(t){let e=0;for(let i=0;i<t.length;++i)e+=t[i].pathLength;return e}static getPointAtLengthOfDataArray(t,e){let i,n=0,r=e.length;if(!r)return null;for(;n<r&&t>e[n].pathLength;)t-=e[n].pathLength,++n;if(n===r)return i=e[n-1].points.slice(-2),{x:i[0],y:i[1]};if(t<.01)return"M"===e[n].command?(i=e[n].points.slice(0,2),{x:i[0],y:i[1]}):{x:e[n].start.x,y:e[n].start.y};const a=e[n],h=a.points;switch(a.command){case"L":return o.getPointOnLine(t,a.start.x,a.start.y,h[0],h[1]);case"C":return o.getPointOnCubicBezier((0,s.t2length)(t,o.getPathLength(e),t=>(0,s.getCubicArcLength)([a.start.x,h[0],h[2],h[4]],[a.start.y,h[1],h[3],h[5]],t)),a.start.x,a.start.y,h[0],h[1],h[2],h[3],h[4],h[5]);case"Q":return o.getPointOnQuadraticBezier((0,s.t2length)(t,o.getPathLength(e),t=>(0,s.getQuadraticArcLength)([a.start.x,h[0],h[2]],[a.start.y,h[1],h[3]],t)),a.start.x,a.start.y,h[0],h[1],h[2],h[3]);case"A":const i=h[0],n=h[1],r=h[2],l=h[3],d=h[5],c=h[6];let g=h[4];return g+=d*t/a.pathLength,o.getPointOnEllipticalArc(i,n,r,l,g,c)}return null}static getPointOnLine(t,e,i,n,r,a,s){a=null!=a?a:e,s=null!=s?s:i;const o=this.getLineLength(e,i,n,r);if(o<1e-10)return{x:e,y:i};if(n===e)return{x:a,y:s+(r>i?t:-t)};const h=(r-i)/(n-e),l=Math.sqrt(t*t/(1+h*h))*(n<e?-1:1),d=h*l;if(Math.abs(s-i-h*(a-e))<1e-10)return{x:a+l,y:s+d};const c=((a-e)*(n-e)+(s-i)*(r-i))/(o*o),g=e+c*(n-e),u=i+c*(r-i),f=this.getLineLength(a,s,g,u),p=Math.sqrt(t*t-f*f),m=Math.sqrt(p*p/(1+h*h))*(n<e?-1:1);return{x:g+m,y:u+h*m}}static getPointOnCubicBezier(t,e,i,n,r,a,s,o,h){function l(t){return t*t*t}function d(t){return 3*t*t*(1-t)}function c(t){return 3*t*(1-t)*(1-t)}function g(t){return(1-t)*(1-t)*(1-t)}return{x:o*l(t)+a*d(t)+n*c(t)+e*g(t),y:h*l(t)+s*d(t)+r*c(t)+i*g(t)}}static getPointOnQuadraticBezier(t,e,i,n,r,a,s){function o(t){return t*t}function h(t){return 2*t*(1-t)}function l(t){return(1-t)*(1-t)}return{x:a*o(t)+n*h(t)+e*l(t),y:s*o(t)+r*h(t)+i*l(t)}}static getPointOnEllipticalArc(t,e,i,n,r,a){const s=Math.cos(a),o=Math.sin(a),h=i*Math.cos(r),l=n*Math.sin(r);return{x:t+(h*s-l*o),y:e+(h*o+l*s)}}static parsePathData(t){if(!t)return[];let e=t;const i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(let t=0;t<i.length;t++)e=e.replace(new RegExp(i[t],"g"),"|"+i[t]);const n=e.split("|"),r=[],a=[];let s=0,o=0;const h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let l;for(let t=1;t<n.length;t++){let e=n[t],i=e.charAt(0);for(e=e.slice(1),a.length=0;l=h.exec(e);)a.push(l[0]);const d=[];for(let t=0,e=a.length;t<e;t++){if("00"===a[t]){d.push(0,0);continue}const e=parseFloat(a[t]);isNaN(e)?d.push(0):d.push(e)}for(;d.length>0&&!isNaN(d[0]);){let t="",e=[];const n=s,a=o;let h,l,c,g,u,f,p,m,_,y;switch(i){case"l":s+=d.shift(),o+=d.shift(),t="L",e.push(s,o);break;case"L":s=d.shift(),o=d.shift(),e.push(s,o);break;case"m":const n=d.shift(),a=d.shift();if(s+=n,o+=a,t="M",r.length>2&&"z"===r[r.length-1].command)for(let t=r.length-2;t>=0;t--)if("M"===r[t].command){s=r[t].points[0]+n,o=r[t].points[1]+a;break}e.push(s,o),i="l";break;case"M":s=d.shift(),o=d.shift(),t="M",e.push(s,o),i="L";break;case"h":s+=d.shift(),t="L",e.push(s,o);break;case"H":s=d.shift(),t="L",e.push(s,o);break;case"v":o+=d.shift(),t="L",e.push(s,o);break;case"V":o=d.shift(),t="L",e.push(s,o);break;case"C":e.push(d.shift(),d.shift(),d.shift(),d.shift()),s=d.shift(),o=d.shift(),e.push(s,o);break;case"c":e.push(s+d.shift(),o+d.shift(),s+d.shift(),o+d.shift()),s+=d.shift(),o+=d.shift(),t="C",e.push(s,o);break;case"S":l=s,c=o,h=r[r.length-1],"C"===h.command&&(l=s+(s-h.points[2]),c=o+(o-h.points[3])),e.push(l,c,d.shift(),d.shift()),s=d.shift(),o=d.shift(),t="C",e.push(s,o);break;case"s":l=s,c=o,h=r[r.length-1],"C"===h.command&&(l=s+(s-h.points[2]),c=o+(o-h.points[3])),e.push(l,c,s+d.shift(),o+d.shift()),s+=d.shift(),o+=d.shift(),t="C",e.push(s,o);break;case"Q":e.push(d.shift(),d.shift()),s=d.shift(),o=d.shift(),e.push(s,o);break;case"q":e.push(s+d.shift(),o+d.shift()),s+=d.shift(),o+=d.shift(),t="Q",e.push(s,o);break;case"T":l=s,c=o,h=r[r.length-1],"Q"===h.command&&(l=s+(s-h.points[0]),c=o+(o-h.points[1])),s=d.shift(),o=d.shift(),t="Q",e.push(l,c,s,o);break;case"t":l=s,c=o,h=r[r.length-1],"Q"===h.command&&(l=s+(s-h.points[0]),c=o+(o-h.points[1])),s+=d.shift(),o+=d.shift(),t="Q",e.push(l,c,s,o);break;case"A":g=d.shift(),u=d.shift(),f=d.shift(),p=d.shift(),m=d.shift(),_=s,y=o,s=d.shift(),o=d.shift(),t="A",e=this.convertEndpointToCenterParameterization(_,y,s,o,p,m,g,u,f);break;case"a":g=d.shift(),u=d.shift(),f=d.shift(),p=d.shift(),m=d.shift(),_=s,y=o,s+=d.shift(),o+=d.shift(),t="A",e=this.convertEndpointToCenterParameterization(_,y,s,o,p,m,g,u,f)}r.push({command:t||i,points:e,start:{x:n,y:a},pathLength:this.calcLength(n,a,t||i,e)})}"z"!==i&&"Z"!==i||r.push({command:"z",points:[],start:void 0,pathLength:0})}return r}static calcLength(t,e,i,n){let r,a,h,l;const d=o;switch(i){case"L":return d.getLineLength(t,e,n[0],n[1]);case"C":return(0,s.getCubicArcLength)([t,n[0],n[2],n[4]],[e,n[1],n[3],n[5]],1);case"Q":return(0,s.getQuadraticArcLength)([t,n[0],n[2]],[e,n[1],n[3]],1);case"A":r=0;const i=n[4],o=n[5],c=n[4]+o;let g=Math.PI/180;if(Math.abs(i-c)<g&&(g=Math.abs(i-c)),a=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],i,0),o<0)for(l=i-g;l>c;l-=g)h=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],l,0),r+=d.getLineLength(a.x,a.y,h.x,h.y),a=h;else for(l=i+g;l<c;l+=g)h=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],l,0),r+=d.getLineLength(a.x,a.y,h.x,h.y),a=h;return h=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],c,0),r+=d.getLineLength(a.x,a.y,h.x,h.y),r}return 0}static convertEndpointToCenterParameterization(t,e,i,n,r,a,s,o,h){const l=h*(Math.PI/180),d=Math.cos(l)*(t-i)/2+Math.sin(l)*(e-n)/2,c=-1*Math.sin(l)*(t-i)/2+Math.cos(l)*(e-n)/2,g=d*d/(s*s)+c*c/(o*o);g>1&&(s*=Math.sqrt(g),o*=Math.sqrt(g));let u=Math.sqrt((s*s*(o*o)-s*s*(c*c)-o*o*(d*d))/(s*s*(c*c)+o*o*(d*d)));r===a&&(u*=-1),isNaN(u)&&(u=0);const f=u*s*c/o,p=u*-o*d/s,m=(t+i)/2+Math.cos(l)*f-Math.sin(l)*p,_=(e+n)/2+Math.sin(l)*f+Math.cos(l)*p,y=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},v=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(y(t)*y(e))},b=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(v(t,e))},x=b([1,0],[(d-f)/s,(c-p)/o]),S=[(d-f)/s,(c-p)/o],C=[(-1*d-f)/s,(-1*c-p)/o];let w=b(S,C);return v(S,C)<=-1&&(w=Math.PI),v(S,C)>=1&&(w=0),0===a&&w>0&&(w-=2*Math.PI),1===a&&w<0&&(w+=2*Math.PI),[m,_,s,o,x,w,l,a]}}e.Path=o,o.prototype.className="Path",o.prototype._attrsAffectingSize=["data"],(0,r._registerNode)(o),n.Factory.addGetterSetter(o,"data")},5155(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Rect=void 0;const n=i(4892),r=i(4723),a=i(8871),s=i(4060),o=i(5483);class h extends r.Shape{_sceneFunc(t){const e=this.cornerRadius(),i=this.width(),n=this.height();t.beginPath(),e?s.Util.drawRoundedRectPath(t,i,n,e):t.rect(0,0,i,n),t.closePath(),t.fillStrokeShape(this)}}e.Rect=h,h.prototype.className="Rect",(0,a._registerNode)(h),n.Factory.addGetterSetter(h,"cornerRadius",0,(0,o.getNumberOrArrayOfNumbersValidator)(4))},9131(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RegularPolygon=void 0;const n=i(4892),r=i(4723),a=i(5483),s=i(8871);class o extends r.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let i=1;i<e.length;i++)t.lineTo(e[i].x,e[i].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,i=[];for(let n=0;n<t;n++)i.push({x:e*Math.sin(2*n*Math.PI/t),y:-1*e*Math.cos(2*n*Math.PI/t)});return i}getSelfRect(){const t=this._getPoints();let e=t[0].x,i=t[0].y,n=t[0].x,r=t[0].y;return t.forEach(t=>{e=Math.min(e,t.x),i=Math.max(i,t.x),n=Math.min(n,t.y),r=Math.max(r,t.y)}),{x:e,y:n,width:i-e,height:r-n}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}e.RegularPolygon=o,o.prototype.className="RegularPolygon",o.prototype._centroid=!0,o.prototype._attrsAffectingSize=["radius"],(0,s._registerNode)(o),n.Factory.addGetterSetter(o,"radius",0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(o,"sides",0,(0,a.getNumberValidator)())},5451(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Ring=void 0;const n=i(4892),r=i(4723),a=i(5483),s=i(8871),o=2*Math.PI;class h extends r.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,o,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),o,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}e.Ring=h,h.prototype.className="Ring",h.prototype._centroid=!0,h.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,s._registerNode)(h),n.Factory.addGetterSetter(h,"innerRadius",0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(h,"outerRadius",0,(0,a.getNumberValidator)())},9308(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Sprite=void 0;const n=i(4892),r=i(4723),a=i(9696),s=i(5483),o=i(8871);class h extends r.Shape{constructor(t){super(t),this._updated=!0,this.anim=new a.Animation(()=>{const t=this._updated;return this._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){const e=this.animation(),i=this.frameIndex(),n=4*i,r=this.animations()[e],a=this.frameOffsets(),s=r[n+0],o=r[n+1],h=r[n+2],l=r[n+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,h,l),t.closePath(),t.fillStrokeShape(this)),d)if(a){const n=a[e],r=2*i;t.drawImage(d,s,o,h,l,n[r+0],n[r+1],h,l)}else t.drawImage(d,s,o,h,l,0,0,h,l)}_hitFunc(t){const e=this.animation(),i=this.frameIndex(),n=4*i,r=this.animations()[e],a=this.frameOffsets(),s=r[n+2],o=r[n+3];if(t.beginPath(),a){const n=a[e],r=2*i;t.rect(n[r+0],n[r+1],s,o)}else t.rect(0,0,s,o);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const t=this.frameIndex(),e=this.animation();t<this.animations()[e].length/4-1?this.frameIndex(t+1):this.frameIndex(0)}}e.Sprite=h,h.prototype.className="Sprite",(0,o._registerNode)(h),n.Factory.addGetterSetter(h,"animation"),n.Factory.addGetterSetter(h,"animations"),n.Factory.addGetterSetter(h,"frameOffsets"),n.Factory.addGetterSetter(h,"image"),n.Factory.addGetterSetter(h,"frameIndex",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(h,"frameRate",17,(0,s.getNumberValidator)()),n.Factory.backCompat(h,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"})},4481(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Star=void 0;const n=i(4892),r=i(4723),a=i(5483),s=i(8871);class o extends r.Shape{_sceneFunc(t){const e=this.innerRadius(),i=this.outerRadius(),n=this.numPoints();t.beginPath(),t.moveTo(0,0-i);for(let r=1;r<2*n;r++){const a=r%2==0?i:e,s=a*Math.sin(r*Math.PI/n),o=-1*a*Math.cos(r*Math.PI/n);t.lineTo(s,o)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}e.Star=o,o.prototype.className="Star",o.prototype._centroid=!0,o.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,s._registerNode)(o),n.Factory.addGetterSetter(o,"numPoints",5,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(o,"innerRadius",0,(0,a.getNumberValidator)()),n.Factory.addGetterSetter(o,"outerRadius",0,(0,a.getNumberValidator)())},1958(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Text=void 0,e.stringToArray=l;const n=i(4060),r=i(4892),a=i(4723),s=i(8871),o=i(5483),h=i(8871);function l(t){return[...t].reduce((t,e,i,n)=>{if(/\p{Emoji}/u.test(e)){const r=n[i+1];r&&/\p{Emoji_Modifier}|\u200D/u.test(r)?(t.push(e+r),n[i+1]=""):t.push(e)}else/\p{Regional_Indicator}{2}/u.test(e+(n[i+1]||""))?t.push(e+n[i+1]):i>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(e)?t[t.length-1]+=e:e&&t.push(e);return t},[])}const d="auto",c="inherit",g="justify",u="left",f="middle",p="normal",m=" ",_="none",y=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],v=y.length;let b;function x(){return b||(b=n.Util.createCanvasElement().getContext("2d"),b)}class S extends a.Shape{constructor(t){super(function(t){return(t=t||{}).fillLinearGradientColorStops||t.fillRadialGradientColorStops||t.fillPatternImage||(t.fill=t.fill||"black"),t}(t)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<v;t++)this.on(y[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(t){const e=this.textArr,i=e.length;if(!this.text())return;let n,r=this.padding(),a=this.fontSize(),o=this.lineHeight()*a,h=this.verticalAlign(),d=this.direction(),p=0,m=this.align(),_=this.getWidth(),y=this.letterSpacing(),v=this.fill(),b=this.textDecoration(),x=-1!==b.indexOf("underline"),S=-1!==b.indexOf("line-through");d=d===c?t.direction:d;let C=o/2,w=f;if(s.Konva._fixTextRendering){const t=this.measureSize("M");w="alphabetic",C=(t.fontBoundingBoxAscent-t.fontBoundingBoxDescent)/2+o/2}for("rtl"===d&&t.setAttr("direction",d),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",w),t.setAttr("textAlign",u),h===f?p=(this.getHeight()-i*o-2*r)/2:"bottom"===h&&(p=this.getHeight()-i*o-2*r),t.translate(r,p+r),n=0;n<i;n++){let h=0,c=0;const u=e[n],f=u.text,p=u.width,b=u.lastInParagraph;if(t.save(),"right"===m?h+=_-p-2*r:"center"===m&&(h+=(_-p-2*r)/2),x){t.save(),t.beginPath();const e=h,i=C+c+(s.Konva._fixTextRendering?Math.round(a/4):Math.round(a/2));t.moveTo(e,i);const n=m!==g||b?p:_-2*r;t.lineTo(e+Math.round(n),i),t.lineWidth=a/15;const o=this._getLinearGradient();t.strokeStyle=o||v,t.stroke(),t.restore()}if(S){t.save(),t.beginPath();const e=s.Konva._fixTextRendering?-Math.round(a/4):0;t.moveTo(h,C+c+e);const i=m!==g||b?p:_-2*r;t.lineTo(h+Math.round(i),C+c+e),t.lineWidth=a/15;const n=this._getLinearGradient();t.strokeStyle=n||v,t.stroke(),t.restore()}if("rtl"===d||0===y&&m!==g)0!==y&&t.setAttr("letterSpacing",`${y}px`),this._partialTextX=h,this._partialTextY=C+c,this._partialText=f,t.fillStrokeShape(this);else{const e=f.split(" ").length-1,i=l(f);for(let n=0;n<i.length;n++){const a=i[n];" "!==a||b||m!==g||(h+=(_-2*r-p)/e),this._partialTextX=h,this._partialTextY=C+c,this._partialText=a,t.fillStrokeShape(this),h+=this.measureSize(a).width+y}}t.restore(),i>1&&(C+=o)}}_hitFunc(t){const e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}setText(t){const e=n.Util._isString(t)?t:null==t?"":t+"";return this._setAttr("text",e),this}getWidth(){return this.attrs.width===d||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===d||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return n.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e,i,n,r,a,s,o,h,l,d,c;let g,u=x(),f=this.fontSize();u.save(),u.font=this._getContextFont(),g=u.measureText(t),u.restore();const p=f/100;return{actualBoundingBoxAscent:null!==(e=g.actualBoundingBoxAscent)&&void 0!==e?e:71.58203125*p,actualBoundingBoxDescent:null!==(i=g.actualBoundingBoxDescent)&&void 0!==i?i:0,actualBoundingBoxLeft:null!==(n=g.actualBoundingBoxLeft)&&void 0!==n?n:-7.421875*p,actualBoundingBoxRight:null!==(r=g.actualBoundingBoxRight)&&void 0!==r?r:75.732421875*p,alphabeticBaseline:null!==(a=g.alphabeticBaseline)&&void 0!==a?a:0,emHeightAscent:null!==(s=g.emHeightAscent)&&void 0!==s?s:100*p,emHeightDescent:null!==(o=g.emHeightDescent)&&void 0!==o?o:-20*p,fontBoundingBoxAscent:null!==(h=g.fontBoundingBoxAscent)&&void 0!==h?h:91*p,fontBoundingBoxDescent:null!==(l=g.fontBoundingBoxDescent)&&void 0!==l?l:21*p,hangingBaseline:null!==(d=g.hangingBaseline)&&void 0!==d?d:72.80000305175781*p,ideographicBaseline:null!==(c=g.ideographicBaseline)&&void 0!==c?c:-21*p,width:g.width,height:f}}_getContextFont(){return this.fontStyle()+m+this.fontVariant()+m+(this.fontSize()+"px ")+this.fontFamily().split(",").map(t=>{const e=(t=t.trim()).indexOf(" ")>=0,i=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!i&&(t=`"${t}"`),t}).join(", ")}_addTextLine(t){this.align()===g&&(t=t.trim());const e=this._getTextWidth(t);return this.textArr.push({text:t,width:e,lastInParagraph:!1})}_getTextWidth(t){const e=this.letterSpacing(),i=t.length;return x().measureText(t).width+e*i}_setTextData(){let t=this.text().split("\n"),e=+this.fontSize(),i=0,n=this.lineHeight()*e,r=this.attrs.width,a=this.attrs.height,s=r!==d&&void 0!==r,o=a!==d&&void 0!==a,h=this.padding(),c=r-2*h,g=a-2*h,u=0,f=this.wrap(),p="char"!==f&&f!==_,y=this.ellipsis();this.textArr=[],x().font=this._getContextFont();const v=y?this._getTextWidth("…"):0;for(let e=0,r=t.length;e<r;++e){let a=t[e],h=this._getTextWidth(a);if(s&&h>c)for(;a.length>0;){let t=0,e=l(a).length,r="",s=0;for(;t<e;){const i=t+e>>>1,h=l(a).slice(0,i+1).join(""),d=this._getTextWidth(h);(y&&o&&u+n>g?d+v:d)<=c?(t=i+1,r=h,s=d):e=i}if(!r)break;if(p){const e=l(a),i=l(r),n=e[i.length];let o;if((n===m||"-"===n)&&s<=c)o=i.length;else{const t=i.lastIndexOf(m),e=i.lastIndexOf("-");o=Math.max(t,e)+1}o>0&&(t=o,r=e.slice(0,t).join(""),s=this._getTextWidth(r))}if(r=r.trimRight(),this._addTextLine(r),i=Math.max(i,s),u+=n,this._shouldHandleEllipsis(u)){this._tryToAddEllipsisToLastLine();break}if(a=l(a).slice(t).join("").trimLeft(),a.length>0&&(h=this._getTextWidth(a),h<=c)){this._addTextLine(a),u+=n,i=Math.max(i,h);break}}else this._addTextLine(a),u+=n,i=Math.max(i,h),this._shouldHandleEllipsis(u)&&e<r-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),o&&u+n>g)break}this.textHeight=e,this.textWidth=i}_shouldHandleEllipsis(t){const e=+this.fontSize(),i=this.lineHeight()*e,n=this.attrs.height,r=n!==d&&void 0!==n,a=n-2*this.padding();return!(this.wrap()!==_)||r&&t+i>a}_tryToAddEllipsisToLastLine(){const t=this.attrs.width,e=t!==d&&void 0!==t,i=t-2*this.padding(),n=this.ellipsis(),r=this.textArr[this.textArr.length-1];r&&n&&(e&&(this._getTextWidth(r.text+"…")<i||(r.text=r.text.slice(0,r.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(r.text+"…"))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=-1!==this.textDecoration().indexOf("underline")||-1!==this.textDecoration().indexOf("line-through"),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas()}}e.Text=S,S.prototype._fillFunc=function(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)},S.prototype._strokeFunc=function(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)},S.prototype.className="Text",S.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,h._registerNode)(S),r.Factory.overWriteSetter(S,"width",(0,o.getNumberOrAutoValidator)()),r.Factory.overWriteSetter(S,"height",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(S,"direction",c),r.Factory.addGetterSetter(S,"fontFamily","Arial"),r.Factory.addGetterSetter(S,"fontSize",12,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(S,"fontStyle",p),r.Factory.addGetterSetter(S,"fontVariant",p),r.Factory.addGetterSetter(S,"padding",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(S,"align",u),r.Factory.addGetterSetter(S,"verticalAlign","top"),r.Factory.addGetterSetter(S,"lineHeight",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(S,"wrap","word"),r.Factory.addGetterSetter(S,"ellipsis",!1,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(S,"letterSpacing",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(S,"text","",(0,o.getStringValidator)()),r.Factory.addGetterSetter(S,"textDecoration","")},8137(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.TextPath=void 0;const n=i(4060),r=i(4892),a=i(4723),s=i(1486),o=i(1958),h=i(5483),l=i(8871),d="normal";function c(t){t.fillText(this.partialText,0,0)}function g(t){t.strokeText(this.partialText,0,0)}class u extends a.Shape{constructor(t){super(t),this.dummyCanvas=n.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return s.Path.getPathLength(this.dataArray)}_getPointAtLength(t){return this.attrs.data?t-1>this.pathLength?null:s.Path.getPointAtLengthOfDataArray(t,this.dataArray):null}_readDataAttribute(){this.dataArray=s.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();const e=this.textDecoration(),i=this.fill(),n=this.fontSize(),r=this.glyphInfo;"underline"===e&&t.beginPath();for(let i=0;i<r.length;i++){t.save();const a=r[i].p0;t.translate(a.x,a.y),t.rotate(r[i].rotation),this.partialText=r[i].text,t.fillStrokeShape(this),"underline"===e&&(0===i&&t.moveTo(0,n/2+1),t.lineTo(n,n/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=i,t.lineWidth=n/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();const e=this.glyphInfo;if(e.length>=1){const i=e[0].p0;t.moveTo(i.x,i.y)}for(let i=0;i<e.length;i++){const n=e[i].p1;t.lineTo(n.x,n.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return n.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return o.Text.prototype.setText.call(this,t)}_getContextFont(){return o.Text.prototype._getContextFont.call(this)}_getTextSize(t){const e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();const i=e.measureText(t);return e.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),n=this.align(),r=this.kerningFunc(),a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let h=0;"center"===n&&(h=Math.max(0,this.pathLength/2-a/2)),"right"===n&&(h=Math.max(0,this.pathLength-a));const l=(0,o.stringToArray)(this.text());let d=h;for(let t=0;t<l.length;t++){const e=this._getPointAtLength(d);if(!e)return;let o=this._getTextSize(l[t]).width+i;if(" "===l[t]&&"justify"===n){const t=this.text().split(" ").length-1;o+=(this.pathLength-a)/t}const h=this._getPointAtLength(d+o);if(!h)return;const c=s.Path.getLineLength(e.x,e.y,h.x,h.y);let g=0;if(r)try{g=r(l[t-1],l[t])*this.fontSize()}catch(t){g=0}e.x+=g,h.x+=g,this.textWidth+=g;const u=s.Path.getPointOnLine(g+c/2,e.x,e.y,h.x,h.y),f=Math.atan2(h.y-e.y,h.x-e.x);this.glyphInfo.push({transposeX:u.x,transposeY:u.y,text:l[t],rotation:f,p0:e,p1:h}),d+=o}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const t=[];this.glyphInfo.forEach(function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)});let e,i,n=t[0]||0,r=t[0]||0,a=t[1]||0,s=t[1]||0;for(let o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],n=Math.min(n,e),r=Math.max(r,e),a=Math.min(a,i),s=Math.max(s,i);const o=this.fontSize();return{x:n-o/2,y:a-o/2,width:r-n+o,height:s-a+o}}destroy(){return n.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}e.TextPath=u,u.prototype._fillFunc=c,u.prototype._strokeFunc=g,u.prototype._fillFuncHit=c,u.prototype._strokeFuncHit=g,u.prototype.className="TextPath",u.prototype._attrsAffectingSize=["text","fontSize","data"],(0,l._registerNode)(u),r.Factory.addGetterSetter(u,"data"),r.Factory.addGetterSetter(u,"fontFamily","Arial"),r.Factory.addGetterSetter(u,"fontSize",12,(0,h.getNumberValidator)()),r.Factory.addGetterSetter(u,"fontStyle",d),r.Factory.addGetterSetter(u,"align","left"),r.Factory.addGetterSetter(u,"letterSpacing",0,(0,h.getNumberValidator)()),r.Factory.addGetterSetter(u,"textBaseline","middle"),r.Factory.addGetterSetter(u,"fontVariant",d),r.Factory.addGetterSetter(u,"text",""),r.Factory.addGetterSetter(u,"textDecoration",""),r.Factory.addGetterSetter(u,"kerningFunc",void 0)},5058(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Transformer=void 0;const n=i(4060),r=i(4892),a=i(6536),s=i(4723),o=i(5155),h=i(7949),l=i(8871),d=i(5483),c=i(8871),g="tr-konva",u=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${g}`).join(" "),f="nodesRect",p=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],m={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},_="ontouchstart"in l.Konva._global,y=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function v(t,e,i){const n=i.x+(t.x-i.x)*Math.cos(e)-(t.y-i.y)*Math.sin(e),r=i.y+(t.x-i.x)*Math.sin(e)+(t.y-i.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:n,y:r}}let b=0;class x extends h.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(u,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return n.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return g+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(t=>!t.isAncestorOf(this)||(n.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1));return this._nodes=t=e,1===t.length&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(t=>{const e=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()};if(t._attrsAffectingSize.length){const i=t._attrsAffectingSize.map(t=>t+"Change."+this._getEventNamespace()).join(" ");t.on(i,e)}t.on(p.map(t=>t+`.${this._getEventNamespace()}`).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,i=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(i,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,i=>{if(!e)return;const n=t.getAbsolutePosition(),r=n.x-e.x,a=n.y-e.y;this.nodes().forEach(e=>{if(e===t)return;if(e.isDragging())return;const n=e.getAbsolutePosition();e.setAbsolutePosition({x:n.x+r,y:n.y+a}),e.startDrag(i)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(f),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(f,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),i){const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=t.getAbsoluteScale(i),a=t.getAbsolutePosition(i),s=n.x*r.x-t.offsetX()*r.x,o=n.y*r.y-t.offsetY()*r.y,h=(l.Konva.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return v({x:a.x+s*Math.cos(h)+o*Math.sin(-h),y:a.y+o*Math.cos(h)+s*Math.sin(h),width:n.width*r.x,height:n.height*r.y,rotation:h},-l.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const t=[];this.nodes().map(e=>{const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),n=[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}],r=e.getAbsoluteTransform();n.forEach(function(e){const i=r.point(e);t.push(i)})});const e=new n.Transform;e.rotate(-l.Konva.getAngle(this.rotation()));let i=1/0,r=1/0,a=-1/0,s=-1/0;t.forEach(function(t){const n=e.point(t);void 0===i&&(i=a=n.x,r=s=n.y),i=Math.min(i,n.x),r=Math.min(r,n.y),a=Math.max(a,n.x),s=Math.max(s,n.y)}),e.invert();const o=e.point({x:i,y:r});return{x:o.x,y:o.y,width:a-i,height:s-r,rotation:l.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),y.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){const e=new o.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:_?10:"auto"}),i=this;e.on("mousedown touchstart",function(t){i._handleMouseDown(t)}),e.on("dragstart",t=>{e.stopDrag(),t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),e.on("mouseenter",()=>{const i=l.Konva.getAngle(this.rotation()),r=this.rotateAnchorCursor(),a=function(t,e,i){if("rotater"===t)return i;e+=n.Util.degToRad(m[t]||0);const r=(n.Util.radToDeg(e)%360+360)%360;return n.Util._inRange(r,337.5,360)||n.Util._inRange(r,0,22.5)?"ns-resize":n.Util._inRange(r,22.5,67.5)?"nesw-resize":n.Util._inRange(r,67.5,112.5)?"ew-resize":n.Util._inRange(r,112.5,157.5)?"nwse-resize":n.Util._inRange(r,157.5,202.5)?"ns-resize":n.Util._inRange(r,202.5,247.5)?"nesw-resize":n.Util._inRange(r,247.5,292.5)?"ew-resize":n.Util._inRange(r,292.5,337.5)?"nwse-resize":(n.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}(t,i,r);e.getStage().content&&(e.getStage().content.style.cursor=a),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){const t=new s.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(t,e){const i=e.getParent(),r=i.padding();t.beginPath(),t.rect(-r,-r,e.width()+2*r,e.height()+2*r),t.moveTo(e.width()/2,-r),i.rotateEnabled()&&i.rotateLineVisible()&&t.lineTo(e.width()/2,-i.rotateAnchorOffset()*n.Util._sign(e.height())-r),t.fillStrokeShape(e)},hitFunc:(t,e)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();t.beginPath(),t.rect(-i,-i,e.width()+2*i,e.height()+2*i),t.fillStrokeShape(e)}});this.add(t),this._proxyDrag(t),t.on("dragstart",t=>{t.cancelBubble=!0}),t.on("dragmove",t=>{t.cancelBubble=!0}),t.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(t){if(this._transforming)return;this._movingAnchorName=t.target.name().split(" ")[0];const e=this._getNodeRect(),i=e.width,n=e.height,r=Math.sqrt(Math.pow(i,2)+Math.pow(n,2));this.sin=Math.abs(n/r),this.cos=Math.abs(i/r),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},b++,this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(e=>{e._fire("transformstart",{evt:t.evt,target:e})})}_handleMouseMove(t){let e,i,n;const r=this.findOne("."+this._movingAnchorName),a=r.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let o={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const h=r.getAbsolutePosition();this.anchorDragBoundFunc()&&(o=this.anchorDragBoundFunc()(h,o,t)),r.setAbsolutePosition(o);const d=r.getAbsolutePosition();if(h.x===d.x&&h.y===d.y)return;if("rotater"===this._movingAnchorName){const n=this._getNodeRect();e=r.x()-n.width/2,i=-r.y()+n.height/2;let a=Math.atan2(-i,e)+Math.PI/2;n.height<0&&(a-=Math.PI);const s=l.Konva.getAngle(this.rotation())+a,o=l.Konva.getAngle(this.rotationSnapTolerance()),h=function(t,e,i){let n=e;for(let r=0;r<t.length;r++){const a=l.Konva.getAngle(t[r]),s=Math.abs(a-e)%(2*Math.PI);Math.min(s,2*Math.PI-s)<i&&(n=a)}return n}(this.rotationSnaps(),s,o),d=function(t,e){const i=function(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}(t);return v(t,e,i)}(n,h-n.rotation);return void this._fitNodesInto(d,t)}const c=this.shiftBehavior();let g;g="inverted"===c?this.keepRatio()&&!t.shiftKey:"none"===c?this.keepRatio():this.keepRatio()||t.shiftKey;let u=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(g){const t=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};n=Math.sqrt(Math.pow(t.x-r.x(),2)+Math.pow(t.y-r.y(),2));const a=this.findOne(".top-left").x()>t.x?-1:1,s=this.findOne(".top-left").y()>t.y?-1:1;e=n*this.cos*a,i=n*this.sin*s,this.findOne(".top-left").x(t.x-e),this.findOne(".top-left").y(t.y-i)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(r.y());else if("top-right"===this._movingAnchorName){if(g){const t=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};n=Math.sqrt(Math.pow(r.x()-t.x,2)+Math.pow(t.y-r.y(),2));const a=this.findOne(".top-right").x()<t.x?-1:1,s=this.findOne(".top-right").y()>t.y?-1:1;e=n*this.cos*a,i=n*this.sin*s,this.findOne(".top-right").x(t.x+e),this.findOne(".top-right").y(t.y-i)}var f=r.position();this.findOne(".top-left").y(f.y),this.findOne(".bottom-right").x(f.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(r.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(r.x());else if("bottom-left"===this._movingAnchorName){if(g){const t=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};n=Math.sqrt(Math.pow(t.x-r.x(),2)+Math.pow(r.y()-t.y,2));const a=t.x<r.x()?-1:1,s=r.y()<t.y?-1:1;e=n*this.cos*a,i=n*this.sin*s,r.x(t.x-e),r.y(t.y+i)}f=r.position(),this.findOne(".top-left").x(f.x),this.findOne(".bottom-right").y(f.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(r.y());else if("bottom-right"===this._movingAnchorName){if(g){const t=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};n=Math.sqrt(Math.pow(r.x()-t.x,2)+Math.pow(r.y()-t.y,2));const a=this.findOne(".bottom-right").x()<t.x?-1:1,s=this.findOne(".bottom-right").y()<t.y?-1:1;e=n*this.cos*a,i=n*this.sin*s,this.findOne(".bottom-right").x(t.x+e),this.findOne(".bottom-right").y(t.y+i)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(u=this.centeredScaling()||t.altKey,u){const t=this.findOne(".top-left"),e=this.findOne(".bottom-right"),i=t.x(),n=t.y(),r=this.getWidth()-e.x(),a=this.getHeight()-e.y();e.move({x:-i,y:-n}),t.move({x:r,y:a})}const p=this.findOne(".top-left").getAbsolutePosition();e=p.x,i=p.y;const m=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),_=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:i,width:m,height:_,rotation:l.Konva.getAngle(this.rotation())},t)}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){var e;if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const i=this.getNode();b--,this._fire("transformend",{evt:t,target:i}),null===(e=this.getLayer())||void 0===e||e.batchDraw(),i&&this._nodes.forEach(e=>{var i;e._fire("transformend",{evt:t,target:e}),null===(i=e.getLayer())||void 0===i||i.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(t,e){const i=this._getNodeRect();if(n.Util._inRange(t.width,2*-this.padding()-1,1))return void this.update();if(n.Util._inRange(t.height,2*-this.padding()-1,1))return void this.update();const r=new n.Transform;if(r.rotate(l.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const e=r.point({x:2*-this.padding(),y:0});t.x+=e.x,t.y+=e.y,t.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const e=r.point({x:2*this.padding(),y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.width+=2*this.padding()}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const e=r.point({x:0,y:2*-this.padding()});t.x+=e.x,t.y+=e.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const e=r.point({x:0,y:2*this.padding()});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}if(this.boundBoxFunc()){const e=this.boundBoxFunc()(i,t);e?t=e:n.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,s=new n.Transform;s.translate(i.x,i.y),s.rotate(i.rotation),s.scale(i.width/a,i.height/a);const o=new n.Transform,h=t.width/a,d=t.height/a;!1===this.flipEnabled()?(o.translate(t.x,t.y),o.rotate(t.rotation),o.translate(t.width<0?t.width:0,t.height<0?t.height:0),o.scale(Math.abs(h),Math.abs(d))):(o.translate(t.x,t.y),o.rotate(t.rotation),o.scale(h,d));const c=o.multiply(s.invert());this._nodes.forEach(t=>{var e;const i=t.getParent().getAbsoluteTransform(),r=t.getTransform().copy();r.translate(t.offsetX(),t.offsetY());const a=new n.Transform;a.multiply(i.copy().invert()).multiply(c).multiply(i).multiply(r);const s=a.decompose();t.setAttrs(s),null===(e=t.getLayer())||void 0===e||e.batchDraw()}),this.rotation(n.Util._getRotation(t.rotation)),this._nodes.forEach(t=>{this._fire("transform",{evt:e,target:t}),t._fire("transform",{evt:e,target:t})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t;const e=this._getNodeRect();this.rotation(n.Util._getRotation(e.rotation));const i=e.width,r=e.height,a=this.enabledAnchors(),s=this.resizeEnabled(),o=this.padding(),h=this.anchorSize(),l=this.find("._anchor");l.forEach(t=>{t.setAttrs({width:h,height:h,offsetX:h/2,offsetY:h/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:h/2+o,offsetY:h/2+o,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:h/2+o,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:h/2-o,offsetY:h/2+o,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:h/2+o,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:r/2,offsetX:h/2-o,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:h/2+o,offsetY:h/2-o,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:r,offsetY:h/2-o,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:r,offsetX:h/2-o,offsetY:h/2-o,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:i/2,y:-this.rotateAnchorOffset()*n.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const d=this.anchorStyleFunc();d&&l.forEach(t=>{d(t)}),null===(t=this.getLayer())||void 0===t||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),h.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return a.Node.prototype.toObject.call(this)}clone(t){return a.Node.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}e.Transformer=x,x.isTransforming=()=>b>0,x.prototype.className="Transformer",(0,c._registerNode)(x),r.Factory.addGetterSetter(x,"enabledAnchors",y,function(t){return t instanceof Array||n.Util.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(t){-1===y.indexOf(t)&&n.Util.warn("Unknown anchor name: "+t+". Available names are: "+y.join(", "))}),t||[]}),r.Factory.addGetterSetter(x,"flipEnabled",!0,(0,d.getBooleanValidator)()),r.Factory.addGetterSetter(x,"resizeEnabled",!0),r.Factory.addGetterSetter(x,"anchorSize",10,(0,d.getNumberValidator)()),r.Factory.addGetterSetter(x,"rotateEnabled",!0),r.Factory.addGetterSetter(x,"rotateLineVisible",!0),r.Factory.addGetterSetter(x,"rotationSnaps",[]),r.Factory.addGetterSetter(x,"rotateAnchorOffset",50,(0,d.getNumberValidator)()),r.Factory.addGetterSetter(x,"rotateAnchorCursor","crosshair"),r.Factory.addGetterSetter(x,"rotationSnapTolerance",5,(0,d.getNumberValidator)()),r.Factory.addGetterSetter(x,"borderEnabled",!0),r.Factory.addGetterSetter(x,"anchorStroke","rgb(0, 161, 255)"),r.Factory.addGetterSetter(x,"anchorStrokeWidth",1,(0,d.getNumberValidator)()),r.Factory.addGetterSetter(x,"anchorFill","white"),r.Factory.addGetterSetter(x,"anchorCornerRadius",0,(0,d.getNumberValidator)()),r.Factory.addGetterSetter(x,"borderStroke","rgb(0, 161, 255)"),r.Factory.addGetterSetter(x,"borderStrokeWidth",1,(0,d.getNumberValidator)()),r.Factory.addGetterSetter(x,"borderDash"),r.Factory.addGetterSetter(x,"keepRatio",!0),r.Factory.addGetterSetter(x,"shiftBehavior","default"),r.Factory.addGetterSetter(x,"centeredScaling",!1),r.Factory.addGetterSetter(x,"ignoreStroke",!1),r.Factory.addGetterSetter(x,"padding",0,(0,d.getNumberValidator)()),r.Factory.addGetterSetter(x,"nodes"),r.Factory.addGetterSetter(x,"node"),r.Factory.addGetterSetter(x,"boundBoxFunc"),r.Factory.addGetterSetter(x,"anchorDragBoundFunc"),r.Factory.addGetterSetter(x,"anchorStyleFunc"),r.Factory.addGetterSetter(x,"shouldOverdrawWholeArea",!1),r.Factory.addGetterSetter(x,"useSingleNodeRotation",!0),r.Factory.backCompat(x,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"})},8001(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Wedge=void 0;const n=i(4892),r=i(4723),a=i(8871),s=i(5483),o=i(8871);class h extends r.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,a.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}e.Wedge=h,h.prototype.className="Wedge",h.prototype._centroid=!0,h.prototype._attrsAffectingSize=["radius"],(0,o._registerNode)(h),n.Factory.addGetterSetter(h,"radius",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(h,"angle",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(h,"clockwise",!1),n.Factory.backCompat(h,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"})}}]);
2
+ //# sourceMappingURL=397.js.map