From 4edd0be235d8c7be997afb352f3c288cab2e6f8f Mon Sep 17 00:00:00 2001 From: Laomai Date: Thu, 25 Jul 2024 12:00:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E6=96=87=E6=9C=AC=E6=98=BE=E7=A4=BA=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pdfjs-annotation-extension.js | 2 +- src/const/definitions.tsx | 2 +- src/painter/editor/editor_free_text.ts | 27 ++++++++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/examples/pdfjs-4.3.136-dist/web/pdfjs-annotation-extension/pdfjs-annotation-extension.js b/examples/pdfjs-4.3.136-dist/web/pdfjs-annotation-extension/pdfjs-annotation-extension.js index f92cd51..060da19 100644 --- a/examples/pdfjs-4.3.136-dist/web/pdfjs-annotation-extension/pdfjs-annotation-extension.js +++ b/examples/pdfjs-4.3.136-dist/web/pdfjs-annotation-extension/pdfjs-annotation-extension.js @@ -1,2 +1,2 @@ /*! For license information please see pdfjs-annotation-extension.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PdfjsAnnotationExtension=t():e.PdfjsAnnotationExtension=t()}(self,(()=>(()=>{var e,t,n={8508:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(1601),o=n.n(r),i=n(6314),a=n.n(i)()(o());a.push([e.id,'.CustomToolbar{width:100%;height:72px;display:flex;justify-content:center;align-items:center}.CustomToolbar .buttons{display:flex;padding:0;margin:0;list-style:none;gap:3px;user-select:none}.CustomToolbar .buttons li{align-items:center;height:100%;text-align:center;border:1px solid rgba(0,0,0,0);border-radius:3px;color:var(--main-color);transition:background-color .3s}.CustomToolbar .buttons li .ant-upload-wrapper{line-height:normal}.CustomToolbar .buttons li .icon{font-size:18px;padding:5px 10px 3px 10px;border-bottom:1px solid rgba(0,0,0,0);opacity:.8}.CustomToolbar .buttons li .name{font-size:14px;padding:1px 10px 2px 10px}.CustomToolbar .buttons li:hover{background-color:var(--button-hover-color)}.CustomToolbar .buttons li.selected{border:1px solid var(--toolbar-border-color);background-color:var(--toolbar-border-color)}.CustomToolbar .buttons li.disabled{opacity:.5}.CustomToolbar .buttons li.disabled:hover{background-color:rgba(0,0,0,0)}.CustomToolbar .splitToolbarButtonSeparator{height:51px;margin:0 10px}.SignatureTool{margin:0 auto}.SignatureTool-Container{background-color:#eee;border:1px solid #ccc;position:relative;margin:0 auto}.SignatureTool-Container .konvajs-content{z-index:99;cursor:crosshair}.SignatureTool-Container::after{content:"签名处...";font-size:20px;z-index:0;color:#ccc;position:absolute;top:50%;left:0;right:0;transform:translateY(-50%);text-align:center}.SignatureTool-Toolbar{border:1px solid #ccc;border-top:0;display:flex;justify-content:space-between;margin:0 auto}.SignatureTool-Toolbar .colorPalette{display:flex;margin:8px}.SignatureTool-Toolbar .colorPalette .cell{cursor:pointer;width:22px;height:22px;margin-right:10px;border-radius:100px;display:flex;align-items:center;justify-content:center;border:1px solid #fff}.SignatureTool-Toolbar .colorPalette .cell span{width:12px;height:12px;display:inline-block;border-radius:100px}.SignatureTool-Toolbar .colorPalette .active{border:1px solid #bbb}.SignatureTool-Toolbar .clear{padding:8px;cursor:pointer}.SignatureTool-Toolbar .clear:hover{text-decoration:underline}.SignaturePop .ant-popover-inner{padding:5px}.SignaturePop ul,.SignaturePop li{margin:0;list-style:none;padding:0}.SignaturePop ul img:hover,.SignaturePop li img:hover{background-color:#ccc}.SignaturePop li{display:flex;margin:5px;justify-content:center;align-items:center}.SignaturePop li span{margin-left:5px;cursor:pointer}.SignaturePop-Toolbar{padding:5px}.StampTool{position:relative}.StampTool input{position:absolute;width:100%;height:100%;top:0;left:0;z-index:1;opacity:0}',""]);const l=a},1665:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(1601),o=n.n(r),i=n(6314),a=n.n(i)()(o());a.push([e.id,".PdfjsAnnotationExtension_painter_wrapper{position:absolute;text-align:initial;top:0;inset:0;overflow:hidden;line-height:1;text-size-adjust:none;forced-color-adjust:none;transform-origin:0 0;z-index:1}.PdfjsAnnotationExtension_selector_hover .PdfjsAnnotationExtension_painter_wrapper{cursor:pointer !important}.PdfjsAnnotationExtension_is_painting .PdfjsAnnotationExtension_painter_wrapper{z-index:999}.PdfjsAnnotationExtension_painting_type_1 .textLayer:not(.free) span,.PdfjsAnnotationExtension_painting_type_2 .textLayer:not(.free) span,.PdfjsAnnotationExtension_painting_type_3 .textLayer:not(.free) span{cursor:var(--editorHighlight-editing-cursor)}.PdfjsAnnotationExtension_painting_type_4 .PdfjsAnnotationExtension_painter_wrapper,.PdfjsAnnotationExtension_painting_type_5 .PdfjsAnnotationExtension_painter_wrapper,.PdfjsAnnotationExtension_painting_type_6 .PdfjsAnnotationExtension_painter_wrapper{cursor:crosshair}.PdfjsAnnotationExtension_painting_type_7 .PdfjsAnnotationExtension_painter_wrapper{cursor:var(--editorInk-editing-cursor)}.PdfjsAnnotationExtension_painting_type_8 .PdfjsAnnotationExtension_painter_wrapper{cursor:var(--editorFreeHighlight-editing-cursor)}.PdfjsAnnotationExtension_painting_type_9 .PdfjsAnnotationExtension_painter_wrapper,.PdfjsAnnotationExtension_painting_type_10 .PdfjsAnnotationExtension_painter_wrapper{cursor:var(--PdfjsAnnotationExtension-image-cursor)}.PdfjsAnnotationExtension_free_text_input{width:auto;position:absolute;z-index:999;padding:0px;overflow:hidden;background:#fff;outline:none;overflow-wrap:break-word;white-space:pre-wrap;user-select:text;word-break:normal;font-weight:normal;font-style:normal}",""]);const l=a},8307:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(1601),o=n.n(r),i=n(6314),a=n.n(i)()(o());a.push([e.id,".PdfjsAnnotationExtension .textLayer{z-index:9 !important}.PdfjsAnnotationExtension #viewerContainer{top:107px !important}.PdfjsAnnotationExtension #sidebarContainer{top:107px !important}.PdfjsAnnotationExtension #toolbarContainer{height:107px}",""]);const l=a},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var l=0;l0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},1601:e=>{"use strict";e.exports=function(e){return e[1]}},9696:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Animation=void 0;const r=n(8871),o=n(4060),i=r.glob.performance&&r.glob.performance.now?function(){return r.glob.performance.now()}:function(){return(new Date).getTime()};class a{constructor(e,t){this.id=a.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:i(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){let t=[];return e&&(t=Array.isArray(e)?e:[e]),this.layers=t,this}getLayers(){return this.layers}addLayer(e){const t=this.layers,n=t.length;for(let r=0;r{"use strict";function n(e,t,n){const o=r(1,n,e),i=r(1,n,t),a=o*o+i*i;return Math.sqrt(a)}Object.defineProperty(t,"__esModule",{value:!0}),t.t2length=t.getQuadraticArcLength=t.getCubicArcLength=t.binomialCoefficients=t.cValues=t.tValues=void 0,t.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]],t.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]],t.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]],t.getCubicArcLength=(e,r,o)=>{let i,a,l;i=o/2,a=0;for(let o=0;o<20;o++)l=i*t.tValues[20][o]+i,a+=t.cValues[20][o]*n(e,r,l);return i*a},t.getQuadraticArcLength=(e,t,n)=>{void 0===n&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],a=2*t[1]-2*t[0],l=4*(r*r+o*o),s=4*(r*i+o*a),c=i*i+a*a;if(0===l)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const u=s/(2*l),d=n+u,f=c/l-u*u,h=d*d+f>0?Math.sqrt(d*d+f):0,p=u*u+f>0?Math.sqrt(u*u+f):0,g=u+Math.sqrt(u*u+f)!==0?f*Math.log(Math.abs((d+h)/(u+p))):0;return Math.sqrt(l)/2*(d*h-u*p+g)};const r=(e,n,o)=>{const i=o.length-1;let a,l;if(0===i)return 0;if(0===e){l=0;for(let e=0;e<=i;e++)l+=t.binomialCoefficients[i][e]*Math.pow(1-n,i-e)*Math.pow(n,e)*o[e];return l}a=new Array(i);for(let e=0;e{let r=1,o=e/t,i=(e-n(o))/t,a=0;for(;r>.001;){const l=n(o+i),s=Math.abs(e-l)/t;if(s500)break}return o}},8604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HitCanvas=t.SceneCanvas=t.Canvas=void 0;const r=n(4060),o=n(9869),i=n(8871),a=n(4892),l=n(5483);var s;class c{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var t=(e||{}).pixelRatio||i.Konva.pixelRatio||function(){if(s)return s;var e=r.Util.createCanvasElement(),t=e.getContext("2d");return s=(i.Konva._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),r.Util.releaseCanvas(e),s}();this.pixelRatio=t,this._canvas=r.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(e){var t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch(e){try{return this._canvas.toDataURL()}catch(e){return r.Util.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}t.Canvas=c,a.Factory.addGetterSetter(c,"pixelRatio",void 0,(0,l.getNumberValidator)()),t.SceneCanvas=class extends c{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new o.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},t.HitCanvas=class extends c{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new o.HitContext(this),this.setSize(e.width,e.height)}}},4473:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Container=void 0;const r=n(4892),o=n(6536),i=n(5483);class a extends o.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const t=this.children||[];var n=[];return t.forEach((function(t){e(t)&&n.push(t)})),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.destroy()})),this.children=[],this._requestDraw(),this}add(...e){if(0===e.length)return this;if(e.length>1){for(var t=0;t0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants((r=>{const o=r._isMatch(e);return o&&n.push(r),!(!o||!t)})),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){var e=o.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((t=>{e.children.push(t.toObject())})),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=o.Node.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach((n=>{n.isVisible()&&n.intersects(e)&&t.push(n)})),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}drawScene(e,t,n){var r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),a=this._getCanvasCache(),l=a&&a.scene,s=o&&o.isCache;if(!this.isVisible()&&!s)return this;if(l){i.save();var c=this.getAbsoluteTransform(t).getMatrix();i.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();var a=this.getAbsoluteTransform(t).getMatrix();o.transform(a[0],a[1],a[2],a[3],a[4],a[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o,i=t&&t.getContext(),a=this.clipWidth(),l=this.clipHeight(),s=this.clipFunc(),c="number"==typeof a&&"number"==typeof l||s;const u=n===this;if(c){i.save();var d=this.getAbsoluteTransform(n),f=d.getMatrix();let e;if(i.transform(f[0],f[1],f[2],f[3],f[4],f[5]),i.beginPath(),s)e=s.call(this,i,this);else{var h=this.clipX(),p=this.clipY();i.rect(h||0,p||0,a,l)}i.clip.apply(i,e),f=d.copy().invert().getMatrix(),i.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var g=!u&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;g&&(i.save(),i._applyGlobalCompositeOperation(this)),null===(o=this.children)||void 0===o||o.forEach((function(o){o[e](t,n,r)})),g&&i.restore(),c&&i.restore()}getClientRect(e={}){var t,n,r,o,i,a,l=e.skipTransform,s=e.relativeTo,c=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var a=t.getClientRect({relativeTo:c,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===a.width&&0===a.height||(void 0===n?(n=a.x,r=a.y,o=a.x+a.width,i=a.y+a.height):(n=Math.min(n,a.x),r=Math.min(r,a.y),o=Math.max(o,a.x+a.width),i=Math.max(i,a.y+a.height)))}}));for(var u=this.find("Shape"),d=!1,f=0;f{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HitContext=t.SceneContext=t.Context=void 0;const r=n(4060),o=n(8871);var i=["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 a{constructor(e){this.canvas=e,o.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){var n,o,i,a,l=this.traceArr,s=l.length,c="";for(n=0;n"number"==typeof e?Math.floor(e):e))),c+="("+a.join(",")+")")):(c+=o.property,e||(c+="="+o.val)),c+=";";return c}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,a,l,s){var c=arguments,u=this._context;3===c.length?u.drawImage(e,t,n):5===c.length?u.drawImage(e,t,n,r,o):9===c.length&&u.drawImage(e,t,n,r,o,i,a,l,s)}ellipse(e,t,n,r,o,i,a,l){this._context.ellipse(e,t,n,r,o,i,a,l)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,o){this._context.roundRect(e,t,n,r,o)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,o=i.length,a=this.setAttr,l=function(e){var o,i=n[e];n[e]=function(){return t=function(e){var t,n,o=[],i=e.length,a=r.Util;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DD=void 0;const r=n(8871),o=n(4060);t.DD={get isDragging(){var e=!1;return t.DD._dragElements.forEach((t=>{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return t.DD._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const n=[];t.DD._dragElements.forEach(((t,r)=>{const{node:i}=t,a=i.getStage();a.setPointersPositions(e),void 0===t.pointerId&&(t.pointerId=o.Util._getFirstPointerId(e));const l=a._changedPointerPositions.find((e=>e.id===t.pointerId));if(l){if("dragging"!==t.dragStatus){var s=i.dragDistance();if(Math.max(Math.abs(l.x-t.startPointerPos.x),Math.abs(l.y-t.startPointerPos.y)){t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(e){const n=[];t.DD._dragElements.forEach((o=>{const{node:i}=o,a=i.getStage();if(e&&a.setPointersPositions(e),!a._changedPointerPositions.find((e=>e.id===o.pointerId)))return;"dragging"!==o.dragStatus&&"stopped"!==o.dragStatus||(t.DD.justDragged=!0,r.Konva._mouseListenClick=!1,r.Konva._touchListenClick=!1,r.Konva._pointerListenClick=!1,o.dragStatus="stopped");const l=o.node.getLayer()||o.node instanceof r.Konva.Stage&&o.node;l&&-1===n.indexOf(l)&&n.push(l)})),n.forEach((e=>{e.draw()}))},_endDragAfter(e){t.DD._dragElements.forEach(((n,r)=>{"stopped"===n.dragStatus&&n.node.fire("dragend",{type:"dragend",target:n.node,evt:e},!0),"dragging"!==n.dragStatus&&t.DD._dragElements.delete(r)}))}},r.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1))},4892:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const r=n(4060),o=n(5483);var i="get",a="set";t.Factory={addGetterSetter(e,n,r,o,i){t.Factory.addGetter(e,n,r),t.Factory.addSetter(e,n,o,i),t.Factory.addOverloadedGetterSetter(e,n)},addGetter(e,t,n){var o=i+r.Util._capitalize(t);e.prototype[o]=e.prototype[o]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,n,o,i){var l=a+r.Util._capitalize(n);e.prototype[l]||t.Factory.overWriteSetter(e,n,o,i)},overWriteSetter(e,t,n,o){var i=a+r.Util._capitalize(t);e.prototype[i]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),o&&o.call(this),this}},addComponentsGetterSetter(e,n,l,s,c){var u,d,f=l.length,h=r.Util._capitalize,p=i+h(n),g=a+h(n);e.prototype[p]=function(){var e={};for(u=0;u{this._setAttr(n+h(e),void 0)})),this._fireChangeEvent(n,r,e),c&&c.call(this),this},t.Factory.addOverloadedGetterSetter(e,n)},addOverloadedGetterSetter(e,t){var n=r.Util._capitalize(t),o=a+n,l=i+n;e.prototype[t]=function(){return arguments.length?(this[o](arguments[0]),this):this[l]()}},addDeprecatedGetterSetter(e,n,o,a){r.Util.error("Adding deprecated "+n);var l=i+r.Util._capitalize(n),s=n+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[l]=function(){r.Util.error(s);var e=this.attrs[n];return void 0===e?o:e},t.Factory.addSetter(e,n,a,(function(){r.Util.error(s)})),t.Factory.addOverloadedGetterSetter(e,n)},backCompat(e,t){r.Util.each(t,(function(t,n){var o=e.prototype[n],l=i+r.Util._capitalize(t),s=a+r.Util._capitalize(t);function c(){o.apply(this,arguments),r.Util.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=c,e.prototype[l]=c,e.prototype[s]=c}))},afterSetFilter(){this._filterUpToDate=!1}}},7457:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FastLayer=void 0;const r=n(4060),o=n(6267),i=n(8871);class a extends o.Layer{constructor(e){super(e),this.listening(!1),r.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}t.FastLayer=a,a.prototype.nodeType="FastLayer",(0,i._registerNode)(a)},8871:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const r=Math.PI/180;t.glob=void 0!==n.g?n.g:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},t.Konva={_global:t.glob,version:"9.3.12",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>t.Konva.angleDeg?e*r:e,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:()=>t.Konva.DD.isDragging,isTransforming(){var e;return null===(e=t.Konva.Transformer)||void 0===e?void 0:e.isTransforming()},isDragReady:()=>!!t.Konva.DD.node,releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(e){t.glob.Konva=e}},t._registerNode=e=>{t.Konva[e.prototype.getClassName()]=e},t.Konva._injectGlobal(t.Konva)},7949:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Group=void 0;const r=n(4060),o=n(4473),i=n(8871);class a extends o.Container{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&r.Util.throw("You may only add groups and shapes to groups.")}}t.Group=a,a.prototype.nodeType="Group",(0,i._registerNode)(a)},6267:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Layer=void 0;const r=n(4060),o=n(4473),i=n(6536),a=n(4892),l=n(8604),s=n(5483),c=n(4723),u=n(8871);var d=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],f=d.length;class h extends o.Container{constructor(e){super(e),this.canvas=new l.SceneCanvas,this.hitCanvas=new l.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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let r=0;r0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),o.Container.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),o.Container.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){r.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return r.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return r.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}t.Layer=h,h.prototype.nodeType="Layer",(0,u._registerNode)(h),a.Factory.addGetterSetter(h,"imageSmoothingEnabled",!0),a.Factory.addGetterSetter(h,"clearBeforeDraw",!0),a.Factory.addGetterSetter(h,"hitGraphEnabled",!0,(0,s.getBooleanValidator)())},6536:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Node=void 0;const r=n(4060),o=n(4892),i=n(8604),a=n(8871),l=n(1268),s=n(5483);var c="absoluteOpacity",u="allEventListeners",d="absoluteTransform",f="absoluteScale",h="canvas",p="listening",g="mouseenter",m="mouseleave",v="Shape",y=" ",b="stage",w="transform",x="visible",S=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(y);let C=1;class E{constructor(e){this._id=C++,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(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==w&&e!==d||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===w||e===d)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map((e=>e+"Change.konva")).join(y);this.on(n,(()=>{this._clearCache(e)})),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(h)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===d&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(h)){const{scene:e,filter:t,hit:n}=this._cache.get(h);r.Util.releaseCanvas(e,t,n),this._cache.delete(h)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var o=Math.ceil(t.width||n.width),a=Math.ceil(t.height||n.height),l=t.pixelRatio,s=void 0===t.x?Math.floor(n.x):t.x,u=void 0===t.y?Math.floor(n.y):t.y,d=t.offset||0,p=t.drawBorder||!1,g=t.hitCanvasPixelRatio||1;if(o&&a){o+=2*d+(Math.abs(Math.round(n.x)-s)>.5?1:0),a+=2*d+(Math.abs(Math.round(n.y)-u)>.5?1:0),s-=d,u-=d;var m=new i.SceneCanvas({pixelRatio:l,width:o,height:a}),v=new i.SceneCanvas({pixelRatio:l,width:0,height:0,willReadFrequently:!0}),y=new i.HitCanvas({pixelRatio:g,width:o,height:a}),b=m.getContext(),w=y.getContext();return y.isCache=!0,m.isCache=!0,this._cache.delete(h),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),b.save(),w.save(),b.translate(-s,-u),w.translate(-s,-u),this._isUnderCache=!0,this._clearSelfAndDescendantCache(c),this._clearSelfAndDescendantCache(f),this.drawScene(m,this),this.drawHit(y,this),this._isUnderCache=!1,b.restore(),w.restore(),p&&(b.save(),b.beginPath(),b.rect(0,0,o,a),b.closePath(),b.setAttr("strokeStyle","red"),b.setAttr("lineWidth",5),b.stroke(),b.restore()),this._cache.set(h,{scene:m,filter:v,hit:y,x:s,y:u}),this._requestDraw(),this}r.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(h)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],r=1/0,o=1/0,i=-1/0,a=-1/0,l=this.getAbsoluteTransform(t);return n.forEach((function(e){var t=l.point(e);void 0===r&&(r=i=t.x,o=a=t.y),r=Math.min(r,t.x),o=Math.min(o,t.y),i=Math.max(i,t.x),a=Math.max(a,t.y)})),{x:r,y:o,width:i-r,height:a-o}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){var t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e,t,n,o,i=this.filters(),a=this._getCanvasCache(),l=a.scene,s=a.filter,c=s.getContext();if(i){if(!this._filterUpToDate){var u=l.pixelRatio;s.setSize(l.width/l.pixelRatio,l.height/l.pixelRatio);try{for(e=i.length,c.clear(),c.drawImage(l._canvas,0,0,l.getWidth()/u,l.getHeight()/u),t=c.getImageData(0,0,s.getWidth(),s.getHeight()),n=0;n{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+r.Util._capitalize(t),r.Util._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))})),this}isListening(){return this._getCache(p,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(x,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;l.DD._dragElements.forEach((e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var o=!t&&!a.Konva.hitOnDragEnabled&&(r||a.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,r,o=this.getDepth(),i=this,a=0;const l=this.getStage();return"Stage"!==i.nodeType&&l&&function l(s){for(e=[],t=s.length,n=0;n0&&e[0].getDepth()<=o&&l(e)}(l.getChildren()),a}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(w),this._clearSelfAndDescendantCache(d)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges((()=>{this.x(e.x),this.y(e.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;var t=e.getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var o=this.getAbsoluteTransform(e).getMatrix(),i=new r.Transform,a=this.offset();return i.m=o.slice(),i.translate(a.x,a.y),i.getTranslation()}setAbsolutePosition(e){const{x:t,y:n,...r}=this._clearTransform();this.attrs.x=t,this.attrs.y=n,this._clearCache(w);var o=this._getAbsoluteTransform().copy();return o.invert(),o.translate(e.x,e.y),e={x:this.attrs.x+o.getTranslation().x,y:this.attrs.y+o.getTranslation().y},this._setTransform(r),this.setPosition({x:e.x,y:e.y}),this._clearCache(w),this._clearSelfAndDescendantCache(d),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var e={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,e}move(e){var t=e.x,n=e.y,r=this.x(),o=this.y();return void 0!==t&&(r+=t),void 0!==n&&(o+=n),this.setPosition({x:r,y:o}),this}_eachAncestorReverse(e,t){var n,r,o=[],i=this.getParent();if(!t||t._id!==this._id){for(o.unshift(this);i&&(!t||i._id!==t._id);)o.unshift(i),i=i.parent;for(n=o.length,r=0;r0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return r.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return r.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&r.Util.warn("Unexpected value "+e+" 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)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(c,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e,t,n,o,i=this.getAttrs();const a={attrs:{},className:this.getClassName()};for(e in i)t=i[e],r.Util.isObject(t)&&!r.Util._isPlainObject(t)&&!r.Util._isArray(t)||(n="function"==typeof this[e]&&this[e],delete i[e],o=n?n.call(this):null,i[e]=t,o!==t&&(a.attrs[e]=t));return r.Util._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var o=this.parent;o;){if(o===n)return r;o._isMatch(e)&&r.push(o),o=o.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,o=e.replace(/ /g,"").split(","),i=o.length;for(t=0;t{try{const n=null==e?void 0:e.callback;n&&delete e.callback,r.Util._urlToImage(this.toDataURL(e),(function(e){t(e),null==n||n(e)}))}catch(e){n(e)}}))}toBlob(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob((e=>{t(e),null==n||n(e)}),null==e?void 0:e.mimeType,null==e?void 0:e.quality)}catch(e){n(e)}}))}setSize(e){return this.width(e.width),this.height(e.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():a.Konva.dragDistance}_off(e,t,n){var r,o,i,a=this.eventListeners[e];for(r=0;r=0)&&!this.isDragging()){var t=!1;l.DD._dragElements.forEach((e=>{this.isAncestorOf(e.node)&&(t=!0)})),t||this._createDragElement(e)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=l.DD._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&l.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return r.Util.haveIntersection(n,this.getClientRect())}static create(e,t){return r.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,o,i,l=E.prototype.getClassName.call(e),s=e.children;if(t&&(e.attrs.container=t),a.Konva[l]||(r.Util.warn('Can not find a node with class name "'+l+'". Fallback to "Shape".'),l="Shape"),n=new(0,a.Konva[l])(e.attrs),s)for(o=s.length,i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.releaseCapture=t.setPointerCapture=t.hasPointerCapture=t.createEvent=t.getCapturedShape=void 0;const r=n(8871),o=new Map,i=void 0!==r.Konva._global.PointerEvent;function a(e){return{evt:e,pointerId:e.pointerId}}function l(e,t){const n=o.get(e);if(!n)return;const r=n.getStage();r&&r.content,o.delete(e),i&&n._fire("lostpointercapture",a(new PointerEvent("lostpointercapture")))}t.getCapturedShape=function(e){return o.get(e)},t.createEvent=a,t.hasPointerCapture=function(e,t){return o.get(e)===t},t.setPointerCapture=function(e,t){l(e),t.getStage()&&(o.set(e,t),i&&t._fire("gotpointercapture",a(new PointerEvent("gotpointercapture"))))},t.releaseCapture=l},4723:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const r=n(8871),o=n(4060),i=n(4892),a=n(6536),l=n(5483),s=n(8871),c=n(8722);var u="hasShadow",d="shadowRGBA",f="patternImage",h="linearGradient",p="radialGradient";let g;function m(){return g||(g=o.Util.createCanvasElement().getContext("2d"),g)}t.shapes={};class v extends a.Node{constructor(e){let n;for(super(e);n=o.Util.getRandomColor(),!n||n in t.shapes;);this.colorKey=n,t.shapes[n]=this}getContext(){return o.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return o.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(u,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(f,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=m().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new o.Transform;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(r.Konva.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),i="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(i)}return e}}_getLinearGradient(){return this._getCache(h,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=m(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=t.createLinearGradient(n.x,n.y,r.x,r.y),i=0;ithis.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 e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage();if(!t)return!1;const n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return a.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(null!==(t=this.attrs.perfectDrawEnabled)&&void 0!==t&&!t)return!1;const n=e||this.hasFill(),r=this.hasStroke(),o=1!==this.getAbsoluteOpacity();if(n&&r&&o)return!0;const i=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(n&&r&&i&&a)}setStrokeHitEnabled(e){o.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),a=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,l=i.width+a,s=i.height+a,c=!e.skipShadow&&this.hasShadow(),u=c?this.shadowOffsetX():0,d=c?this.shadowOffsetY():0,f=l+Math.abs(u),h=s+Math.abs(d),p=c&&this.shadowBlur()||0,g={width:f+2*p,height:h+2*p,x:-(a/2+p)+Math.min(u,0)+i.x,y:-(a/2+p)+Math.min(d,0)+i.y};return r?g:this._transformedRect(g,o)}drawScene(e,t,n){var r,o,i=this.getLayer(),a=e||i.getCanvas(),l=a.getContext(),s=this._getCanvasCache(),c=this.getSceneFunc(),u=this.hasShadow(),d=a.isCache,f=t===this;if(!this.isVisible()&&!f)return this;if(s){l.save();var h=this.getAbsoluteTransform(t).getMatrix();return l.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedSceneCanvas(l),l.restore(),this}if(!c)return this;if(l.save(),this._useBufferCanvas()&&!d){r=this.getStage();const e=n||r.bufferCanvas;(o=e.getContext()).clear(),o.save(),o._applyLineJoin(this);var p=this.getAbsoluteTransform(t).getMatrix();o.transform(p[0],p[1],p[2],p[3],p[4],p[5]),c.call(this,o,this),o.restore();var g=e.pixelRatio;u&&l._applyShadow(this),l._applyOpacity(this),l._applyGlobalCompositeOperation(this),l.drawImage(e._canvas,0,0,e.width/g,e.height/g)}else l._applyLineJoin(this),f||(p=this.getAbsoluteTransform(t).getMatrix(),l.transform(p[0],p[1],p[2],p[3],p[4],p[5]),l._applyOpacity(this),l._applyGlobalCompositeOperation(this)),u&&l._applyShadow(this),c.call(this,l,this);return l.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),i=e||r.hitCanvas,a=i&&i.getContext(),l=this.hitFunc()||this.sceneFunc(),s=this._getCanvasCache(),c=s&&s.hit;if(this.colorKey||o.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()"),c){a.save();var u=this.getAbsoluteTransform(t).getMatrix();return a.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!l)return this;if(a.save(),a._applyLineJoin(this),this!==t){var d=this.getAbsoluteTransform(t).getMatrix();a.transform(d[0],d[1],d[2],d[3],d[4],d[5])}return l.call(this,a,this),a.restore(),this}drawHitFromCache(e=0){var t,n,r,i,a,l=this._getCanvasCache(),s=this._getCachedSceneCanvas(),c=l.hit,u=c.getContext(),d=c.getWidth(),f=c.getHeight();u.clear(),u.drawImage(s._canvas,0,0,d,f);try{for(r=(n=(t=u.getImageData(0,0,d,f)).data).length,i=o.Util._hexToRgb(this.colorKey),a=0;ae?(n[a]=i.r,n[a+1]=i.g,n[a+2]=i.b,n[a+3]=255):n[a+3]=0;u.putImageData(t,0,0)}catch(e){o.Util.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return c.hasPointerCapture(e,this)}setPointerCapture(e){c.setPointerCapture(e,this)}releaseCapture(e){c.releaseCapture(e,this)}}t.Shape=v,v.prototype._fillFunc=function(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()},v.prototype._strokeFunc=function(e){e.stroke()},v.prototype._fillFuncHit=function(e){e.fill()},v.prototype._strokeFuncHit=function(e){e.stroke()},v.prototype._centroid=!1,v.prototype.nodeType="Shape",(0,s._registerNode)(v),v.prototype.eventListeners={},v.prototype.on.call(v.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(u)})),v.prototype.on.call(v.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(d)})),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(f)})),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(h)})),v.prototype.on.call(v.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(p)})),i.Factory.addGetterSetter(v,"stroke",void 0,(0,l.getStringOrGradientValidator)()),i.Factory.addGetterSetter(v,"strokeWidth",2,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"fillAfterStrokeEnabled",!1),i.Factory.addGetterSetter(v,"hitStrokeWidth","auto",(0,l.getNumberOrAutoValidator)()),i.Factory.addGetterSetter(v,"strokeHitEnabled",!0,(0,l.getBooleanValidator)()),i.Factory.addGetterSetter(v,"perfectDrawEnabled",!0,(0,l.getBooleanValidator)()),i.Factory.addGetterSetter(v,"shadowForStrokeEnabled",!0,(0,l.getBooleanValidator)()),i.Factory.addGetterSetter(v,"lineJoin"),i.Factory.addGetterSetter(v,"lineCap"),i.Factory.addGetterSetter(v,"sceneFunc"),i.Factory.addGetterSetter(v,"hitFunc"),i.Factory.addGetterSetter(v,"dash"),i.Factory.addGetterSetter(v,"dashOffset",0,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"shadowColor",void 0,(0,l.getStringValidator)()),i.Factory.addGetterSetter(v,"shadowBlur",0,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"shadowOpacity",1,(0,l.getNumberValidator)()),i.Factory.addComponentsGetterSetter(v,"shadowOffset",["x","y"]),i.Factory.addGetterSetter(v,"shadowOffsetX",0,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"shadowOffsetY",0,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"fillPatternImage"),i.Factory.addGetterSetter(v,"fill",void 0,(0,l.getStringOrGradientValidator)()),i.Factory.addGetterSetter(v,"fillPatternX",0,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"fillPatternY",0,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"fillLinearGradientColorStops"),i.Factory.addGetterSetter(v,"strokeLinearGradientColorStops"),i.Factory.addGetterSetter(v,"fillRadialGradientStartRadius",0),i.Factory.addGetterSetter(v,"fillRadialGradientEndRadius",0),i.Factory.addGetterSetter(v,"fillRadialGradientColorStops"),i.Factory.addGetterSetter(v,"fillPatternRepeat","repeat"),i.Factory.addGetterSetter(v,"fillEnabled",!0),i.Factory.addGetterSetter(v,"strokeEnabled",!0),i.Factory.addGetterSetter(v,"shadowEnabled",!0),i.Factory.addGetterSetter(v,"dashEnabled",!0),i.Factory.addGetterSetter(v,"strokeScaleEnabled",!0),i.Factory.addGetterSetter(v,"fillPriority","color"),i.Factory.addComponentsGetterSetter(v,"fillPatternOffset",["x","y"]),i.Factory.addGetterSetter(v,"fillPatternOffsetX",0,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"fillPatternOffsetY",0,(0,l.getNumberValidator)()),i.Factory.addComponentsGetterSetter(v,"fillPatternScale",["x","y"]),i.Factory.addGetterSetter(v,"fillPatternScaleX",1,(0,l.getNumberValidator)()),i.Factory.addGetterSetter(v,"fillPatternScaleY",1,(0,l.getNumberValidator)()),i.Factory.addComponentsGetterSetter(v,"fillLinearGradientStartPoint",["x","y"]),i.Factory.addComponentsGetterSetter(v,"strokeLinearGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(v,"fillLinearGradientStartPointX",0),i.Factory.addGetterSetter(v,"strokeLinearGradientStartPointX",0),i.Factory.addGetterSetter(v,"fillLinearGradientStartPointY",0),i.Factory.addGetterSetter(v,"strokeLinearGradientStartPointY",0),i.Factory.addComponentsGetterSetter(v,"fillLinearGradientEndPoint",["x","y"]),i.Factory.addComponentsGetterSetter(v,"strokeLinearGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(v,"fillLinearGradientEndPointX",0),i.Factory.addGetterSetter(v,"strokeLinearGradientEndPointX",0),i.Factory.addGetterSetter(v,"fillLinearGradientEndPointY",0),i.Factory.addGetterSetter(v,"strokeLinearGradientEndPointY",0),i.Factory.addComponentsGetterSetter(v,"fillRadialGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(v,"fillRadialGradientStartPointX",0),i.Factory.addGetterSetter(v,"fillRadialGradientStartPointY",0),i.Factory.addComponentsGetterSetter(v,"fillRadialGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(v,"fillRadialGradientEndPointX",0),i.Factory.addGetterSetter(v,"fillRadialGradientEndPointY",0),i.Factory.addGetterSetter(v,"fillPatternRotation",0),i.Factory.addGetterSetter(v,"fillRule",void 0,(0,l.getStringValidator)()),i.Factory.backCompat(v,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})},7324:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Stage=t.stages=void 0;const r=n(4060),o=n(4892),i=n(4473),a=n(8871),l=n(8604),s=n(1268),c=n(8871),u=n(8722);var d="mouseleave",f="mouseover",h="mouseenter",p="mousemove",g="mousedown",m="mouseup",v="pointermove",y="pointerdown",b="pointerup",w="pointercancel",x="pointerout",S="pointerleave",C="pointerover",E="pointerenter",k="contextmenu",O="touchstart",_="touchend",P="touchmove",T="touchcancel",I="wheel",N=[[h,"_pointerenter"],[g,"_pointerdown"],[p,"_pointermove"],[m,"_pointerup"],[d,"_pointerleave"],[O,"_pointerdown"],[P,"_pointermove"],[_,"_pointerup"],[T,"_pointercancel"],[f,"_pointerover"],[I,"_wheel"],[k,"_contextmenu"],[y,"_pointerdown"],[v,"_pointermove"],[b,"_pointerup"],[w,"_pointercancel"],["lostpointercapture","_lostpointercapture"]];const $={mouse:{[x]:"mouseout",[S]:d,[C]:f,[E]:h,[v]:p,[y]:g,[b]:m,[w]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[x]:"touchout",[S]:"touchleave",[C]:"touchover",[E]:"touchenter",[v]:P,[y]:O,[b]:_,[w]:T,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[x]:x,[S]:S,[C]:C,[E]:E,[v]:v,[y]:y,[b]:b,[w]:w,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},R=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",A=e=>{const t=R(e);return"pointer"===t?a.Konva.pointerEventsEnabled&&$.pointer:"touch"===t?$.touch:"mouse"===t?$.mouse:void 0};function j(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&r.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}t.stages=[];class M extends i.Container{constructor(e){super(j(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.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",(()=>{j(this.attrs)})),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||r.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e,t=this.children,n=t.length;for(e=0;e-1&&t.stages.splice(n,1),r.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(r.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(e){return this._pointerPositions.find((t=>t.id===e))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new l.SceneCanvas({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const r=n[t].getIntersection(e);if(r)return r}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((n=>{n.setSize({width:e,height:t}),n.draw()}))}add(e,...t){if(arguments.length>1){for(var n=0;n5&&r.Util.warn("The stage has "+o+" 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."),e.setSize({width:this.width(),height:this.height()}),e.draw(),a.Konva.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return u.hasPointerCapture(e,this)}setPointerCapture(e){u.setPointerCapture(e,this)}releaseCapture(e){u.releaseCapture(e,this)}getLayers(){return this.children}_bindContentEvents(){a.Konva.isBrowser&&N.forEach((([e,t])=>{this.content.addEventListener(e,(e=>{this[t](e)}),{passive:!1})}))}_pointerenter(e){this.setPointersPositions(e);const t=A(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=A(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=A(e.type),n=R(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),o=!(a.Konva.isDragging()||a.Konva.isTransforming())||a.Konva.hitOnDragEnabled;r&&o?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):o&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(e){const t=A(e.type),n=R(e.type);if(t){this.setPointersPositions(e);var r=!1;this._changedPointerPositions.forEach((o=>{var i=this.getIntersection(o);if(s.DD.justDragged=!1,a.Konva["_"+n+"ListenClick"]=!0,!i||!i.isListening())return void(this[n+"ClickStartShape"]=void 0);a.Konva.capturePointerEventsEnabled&&i.setPointerCapture(o.id),this[n+"ClickStartShape"]=i,i._fireAndBubble(t.pointerdown,{evt:e,pointerId:o.id}),r=!0;const l=e.type.indexOf("touch")>=0;i.preventDefault()&&e.cancelable&&l&&e.preventDefault()})),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=A(e.type),n=R(e.type);if(!t)return;if(a.Konva.isDragging()&&s.DD.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),(a.Konva.isDragging()||a.Konva.isTransforming())&&!a.Konva.hitOnDragEnabled)return;var r={};let o=!1;var i=this._getTargetShape(n);this._changedPointerPositions.forEach((a=>{const l=u.getCapturedShape(a.id)||this.getIntersection(a),s=a.id,c={evt:e,pointerId:s};var d=i!==l;if(d&&i&&(i._fireAndBubble(t.pointerout,{...c},l),i._fireAndBubble(t.pointerleave,{...c},l)),l){if(r[l._id])return;r[l._id]=!0}l&&l.isListening()?(o=!0,d&&(l._fireAndBubble(t.pointerover,{...c},i),l._fireAndBubble(t.pointerenter,{...c},i),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,{...c})):i&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:s}),this[n+"targetShape"]=null)})),o||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=A(e.type),n=R(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],o=this[n+"ClickEndShape"];var i={};let l=!1;this._changedPointerPositions.forEach((c=>{const d=u.getCapturedShape(c.id)||this.getIntersection(c);if(d){if(d.releaseCapture(c.id),i[d._id])return;i[d._id]=!0}const f=c.id,h={evt:e,pointerId:f};let p=!1;a.Konva["_"+n+"InDblClickWindow"]?(p=!0,clearTimeout(this[n+"DblTimeout"])):s.DD.justDragged||(a.Konva["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){a.Konva["_"+n+"InDblClickWindow"]=!1}),a.Konva.dblClickWindow),d&&d.isListening()?(l=!0,this[n+"ClickEndShape"]=d,d._fireAndBubble(t.pointerup,{...h}),a.Konva["_"+n+"ListenClick"]&&r&&r===d&&(d._fireAndBubble(t.pointerclick,{...h}),p&&o&&o===d&&d._fireAndBubble(t.pointerdblclick,{...h}))):(this[n+"ClickEndShape"]=null,a.Konva["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:f}),p&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:f}))})),l||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),a.Konva["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(k,{evt:e}):this._fire(k,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(I,{evt:e}):this._fire(I,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=u.getCapturedShape(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(b,u.createEvent(e)),u.releaseCapture(e.pointerId)}_lostpointercapture(e){u.releaseCapture(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,o=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))):(n=(e.clientX-t.left)/t.scaleX,o=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:o},this._pointerPositions=[{x:n,y:o,id:r.Util._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:o,id:r.Util._getFirstPointerId(e)}])}_setPointerPosition(e){r.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new l.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new l.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),a.Konva.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.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"),e.appendChild(this.content),this._resizeDOM()}}cache(){return r.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(e){e.batchDraw()})),this}}t.Stage=M,M.prototype.nodeType="Stage",(0,c._registerNode)(M),o.Factory.addGetterSetter(M,"container"),a.Konva.isBrowser&&document.addEventListener("visibilitychange",(()=>{t.stages.forEach((e=>{e.batchDraw()}))}))},8665:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Easings=t.Tween=void 0;const r=n(4060),o=n(9696),i=n(6536),a=n(8871);var l={node:1,duration:1,easing:1,onFinish:1,yoyo:1},s=0,c=["fill","stroke","shadowColor"];class u{constructor(e,t,n,r,o,i,a){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=i,this._change=0,this.prevPos=0,this.yoyo=a,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=o-this.begin,this.pause()}fire(e){var t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,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(e){this.pause(),this._time=e,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(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class d{constructor(e){var n,i,c=this,f=e.node,h=f._id,p=e.easing||t.Easings.Linear,g=!!e.yoyo;n=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=f,this._id=s++;var m=f.getLayer()||(f instanceof a.Konva.Stage?f.getLayers():null);for(i in m||r.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new o.Animation((function(){c.tween.onEnterFrame()}),m),this.tween=new u(i,(function(e){c._tweenFunc(e)}),p,0,1,1e3*n,g),this._addListeners(),d.attrs[h]||(d.attrs[h]={}),d.attrs[h][this._id]||(d.attrs[h][this._id]={}),d.tweens[h]||(d.tweens[h]={}),e)void 0===l[i]&&this._addAttr(i,e[i]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,o,i,a,l,s,u,f,h=this.node,p=h._id;if((i=d.tweens[p][e])&&delete d.attrs[p][i][e],n=h.getAttr(e),r.Util._isArray(t))if(o=[],l=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(u=n,n=r.Util._prepareArrayForTween(n,t,h.closed())):(s=t,t=r.Util._prepareArrayForTween(t,n,h.closed()))),0===e.indexOf("fill"))for(a=0;a{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=d.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=d.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.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(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,r=d.tweens[t];for(e in this.pause(),r)delete d.tweens[t][e];delete d.attrs[t][n]}}t.Tween=d,d.attrs={},d.tweens={},i.Node.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new d(e).play()},t.Easings={BackEaseIn(e,t,n,r){var o=1.70158;return n*(e/=r)*e*((o+1)*e-o)+t},BackEaseOut(e,t,n,r){var o=1.70158;return n*((e=e/r-1)*e*((o+1)*e+o)+1)+t},BackEaseInOut(e,t,n,r){var o=1.70158;return(e/=r/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t},ElasticEaseIn(e,t,n,r,o,i){var a=0;return 0===e?t:1==(e/=r)?t+n:(i||(i=.3*r),!o||o(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,n,r,o)=>r-t.Easings.BounceEaseOut(o-e,0,r,o)+n,BounceEaseInOut:(e,n,r,o)=>en*(e/=r)*e+t,EaseOut:(e,t,n,r)=>-n*(e/=r)*(e-2)+t,EaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,r)=>n*(e/=r)*e*e*e*e+t,StrongEaseOut:(e,t,n,r)=>n*((e=e/r-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,r)=>n*e/r+t}},4060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const r=n(8871);class o{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.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 o(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,o=this.m[1]*t+this.m[3]*n,i=this.m[0]*-n+this.m[2]*t,a=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,o=this.m[2]+this.m[0]*e,i=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],o=this.m[1]*e.m[2]+this.m[3]*e.m[3],i=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],a=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=o,this.m[4]=i,this.m[5]=a,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,o=this.m[0]*e,i=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=o,this.m[4]=i,this.m[5]=a,this}getMatrix(){return this.m}decompose(){var e=this.m[0],n=this.m[1],r=this.m[2],o=this.m[3],i=e*o-n*r;let a={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=n){var l=Math.sqrt(e*e+n*n);a.rotation=n>0?Math.acos(e/l):-Math.acos(e/l),a.scaleX=l,a.scaleY=i/l,a.skewX=(e*r+n*o)/i,a.skewY=0}else if(0!=r||0!=o){var s=Math.sqrt(r*r+o*o);a.rotation=Math.PI/2-(o>0?Math.acos(-r/s):-Math.acos(r/s)),a.scaleX=i/s,a.scaleY=s,a.skewX=0,a.skewY=(e*r+n*o)/i}return a.rotation=t.Util._getRotation(a.rotation),a}}t.Transform=o;var i=Math.PI/180,a=180/Math.PI,l="Konva error: ",s={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]},c=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,u=[];const d="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)};t.Util={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){u.push(e),1===u.length&&d((function(){const e=u;u=[],e.forEach((function(e){e()}))}))},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,n){var r=t.Util.createImageElement();r.onload=function(){n(r)},r.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()|0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in s?{r:(t=s[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=c.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",t.Util._namedColorToRBA(e)||t.Util._hex3ColorToRGBA(e)||t.Util._hex4ColorToRGBA(e)||t.Util._hex6ColorToRGBA(e)||t.Util._hex8ColorToRGBA(e)||t.Util._rgbColorToRGBA(e)||t.Util._rgbaColorToRGBA(e)||t.Util._hslColorToRGBA(e)),_namedColorToRBA(e){var t=s[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e)));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if("#"===e[0]&&9===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if("#"===e[0]&&5===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let a,l,s;if(0===o)return s=255*i,{r:Math.round(s),g:Math.round(s),b:Math.round(s),a:1};a=i<.5?i*(1+o):i+o-i*o;const c=2*i-a,u=[0,0,0];for(let e=0;e<3;e++)l=r+1/3*-(e-1),l<0&&l++,l>1&&l--,s=6*l<1?c+6*(a-c)*l:2*l<1?a:3*l<2?c+(a-c)*(2/3-l)*6:c,u[e]=255*s;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.widthe.y+e.height||t.y+t.heighte.slice(0),degToRad:e=>e*i,radToDeg:e=>e*a,_degToRad:e=>(t.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),t.Util.degToRad(e)),_radToDeg:e=>(t.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),t.Util.radToDeg(e)),_getRotation:e=>r.Konva.angleDeg?t.Util.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(l+e)},error(e){console.error(l+e)},warn(e){r.Konva.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e1?(a=n,l=r,s=(n-o)*(n-o)+(r-i)*(r-i)):s=((a=e+u*(n-e))-o)*(a-o)+((l=t+u*(r-t))-i)*(l-i)}return[a,l,s]},_getProjectionToLine(e,n,r){var o=t.Util.cloneObject(e),i=Number.MAX_VALUE;return n.forEach((function(a,l){if(r||l!==n.length-1){var s=n[(l+1)%n.length],c=t.Util._getProjectionToSegment(a.x,a.y,s.x,s.y,e.x,e.y),u=c[0],d=c[1],f=c[2];fn.length){var l=n;n=e,e=l}for(o=0;oe.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...e){r.Konva.releaseCanvasOnDestroy&&e.forEach((e=>{e.width=0,e.height=0}))},drawRoundedRectPath(e,t,n,r){let o=0,i=0,a=0,l=0;"number"==typeof r?o=i=a=l=Math.min(r,t/2,n/2):(o=Math.min(r[0]||0,t/2,n/2),i=Math.min(r[1]||0,t/2,n/2),l=Math.min(r[2]||0,t/2,n/2),a=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o,0),e.lineTo(t-i,0),e.arc(t-i,i,i,3*Math.PI/2,0,!1),e.lineTo(t,n-l),e.arc(t-l,n-l,l,0,Math.PI/2,!1),e.lineTo(a,n),e.arc(a,n-a,a,Math.PI/2,Math.PI,!1),e.lineTo(0,o),e.arc(o,o,o,Math.PI,3*Math.PI/2,!1)}}},5483:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getComponentValidator=t.getBooleanValidator=t.getNumberArrayValidator=t.getFunctionValidator=t.getStringOrGradientValidator=t.getStringValidator=t.getNumberOrAutoValidator=t.getNumberOrArrayOfNumbersValidator=t.getNumberValidator=t.alphaComponent=t.RGBComponent=void 0;const r=n(8871),o=n(4060);function i(e){return o.Util._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||o.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}t.RGBComponent=function(e){return e>255?255:e<0?0:Math.round(e)},t.alphaComponent=function(e){return e>1?1:e<1e-4?1e-4:e},t.getNumberValidator=function(){if(r.Konva.isUnminified)return function(e,t){return o.Util._isNumber(e)||o.Util.warn(i(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}},t.getNumberOrArrayOfNumbersValidator=function(e){if(r.Konva.isUnminified)return function(t,n){let r=o.Util._isNumber(t),a=o.Util._isArray(t)&&t.length==e;return r||a||o.Util.warn(i(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}},t.getNumberOrAutoValidator=function(){if(r.Konva.isUnminified)return function(e,t){return o.Util._isNumber(e)||"auto"===e||o.Util.warn(i(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}},t.getStringValidator=function(){if(r.Konva.isUnminified)return function(e,t){return o.Util._isString(e)||o.Util.warn(i(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}},t.getStringOrGradientValidator=function(){if(r.Konva.isUnminified)return function(e,t){const n=o.Util._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||o.Util.warn(i(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}},t.getFunctionValidator=function(){if(r.Konva.isUnminified)return function(e,t){return o.Util._isFunction(e)||o.Util.warn(i(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}},t.getNumberArrayValidator=function(){if(r.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(o.Util._isArray(e)?e.forEach((function(e){o.Util._isNumber(e)||o.Util.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")})):o.Util.warn(i(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}},t.getBooleanValidator=function(){if(r.Konva.isUnminified)return function(e,t){return!0===e||!1===e||o.Util.warn(i(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}},t.getComponentValidator=function(e){if(r.Konva.isUnminified)return function(t,n){return null==t||o.Util.isObject(t)||o.Util.warn(i(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}},680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const r=n(8871),o=n(4060),i=n(6536),a=n(4473),l=n(7324),s=n(6267),c=n(7457),u=n(7949),d=n(1268),f=n(4723),h=n(9696),p=n(8665),g=n(9869),m=n(8604);t.Konva=o.Util._assign(r.Konva,{Util:o.Util,Transform:o.Transform,Node:i.Node,Container:a.Container,Stage:l.Stage,stages:l.stages,Layer:s.Layer,FastLayer:c.FastLayer,Group:u.Group,DD:d.DD,Shape:f.Shape,shapes:f.shapes,Animation:h.Animation,Tween:p.Tween,Easings:p.Easings,Context:g.Context,Canvas:m.Canvas}),t.default=t.Konva},8558:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const r=n(680),o=n(4821),i=n(9456),a=n(9729),l=n(6955),s=n(7256),c=n(6619),u=n(3443),d=n(1486),f=n(5155),h=n(9131),p=n(5451),g=n(9308),m=n(4481),v=n(1958),y=n(8137),b=n(5058),w=n(8001),x=n(6261),S=n(6627),C=n(2650),E=n(983),k=n(7928),O=n(7241),_=n(5461),P=n(4843),T=n(6564),I=n(5553),N=n(8624),$=n(5992),R=n(4943),A=n(7019),j=n(6921),M=n(3862),L=n(2512),F=n(517),D=n(661);t.Konva=r.Konva.Util._assign(r.Konva,{Arc:o.Arc,Arrow:i.Arrow,Circle:a.Circle,Ellipse:l.Ellipse,Image:s.Image,Label:c.Label,Tag:c.Tag,Line:u.Line,Path:d.Path,Rect:f.Rect,RegularPolygon:h.RegularPolygon,Ring:p.Ring,Sprite:g.Sprite,Star:m.Star,Text:v.Text,TextPath:y.TextPath,Transformer:b.Transformer,Wedge:w.Wedge,Filters:{Blur:x.Blur,Brighten:S.Brighten,Contrast:C.Contrast,Emboss:E.Emboss,Enhance:k.Enhance,Grayscale:O.Grayscale,HSL:_.HSL,HSV:P.HSV,Invert:T.Invert,Kaleidoscope:I.Kaleidoscope,Mask:N.Mask,Noise:$.Noise,Pixelate:R.Pixelate,Posterize:A.Posterize,RGB:j.RGB,RGBA:M.RGBA,Sepia:L.Sepia,Solarize:F.Solarize,Threshold:D.Threshold}})},6261:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Blur=void 0;const r=n(4892),o=n(6536),i=n(5483);function a(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var l=[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],s=[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];t.Blur=function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,o,i,c,u,d,f,h,p,g,m,v,y,b,w,x,S,C,E,k,O,_,P,T=e.data,I=e.width,N=e.height,$=t+t+1,R=I-1,A=N-1,j=t+1,M=j*(j+1)/2,L=new a,F=null,D=L,z=null,H=null,B=l[t],G=s[t];for(o=1;o<$;o++)D=D.next=new a,o===j&&(F=D);for(D.next=L,d=u=0,r=0;r>G,0!==_?(_=255/_,T[u]=(f*B>>G)*_,T[u+1]=(h*B>>G)*_,T[u+2]=(p*B>>G)*_):T[u]=T[u+1]=T[u+2]=0,f-=m,h-=v,p-=y,g-=b,m-=z.r,v-=z.g,y-=z.b,b-=z.a,i=d+((i=n+t+1)>G,_>0?(_=255/_,T[i]=(f*B>>G)*_,T[i+1]=(h*B>>G)*_,T[i+2]=(p*B>>G)*_):T[i]=T[i+1]=T[i+2]=0,f-=m,h-=v,p-=y,g-=b,m-=z.r,v-=z.g,y-=z.b,b-=z.a,i=n+((i=r+j){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Brighten=void 0;const r=n(4892),o=n(6536),i=n(5483);t.Brighten=function(e){var t,n=255*this.brightness(),r=e.data,o=r.length;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Contrast=void 0;const r=n(4892),o=n(6536),i=n(5483);t.Contrast=function(e){var t,n=Math.pow((this.contrast()+100)/100,2),r=e.data,o=r.length,i=150,a=150,l=150;for(t=0;t255?255:i,a=(a*=255)<0?0:a>255?255:a,l=(l*=255)<0?0:l>255?255:l,r[t]=i,r[t+1]=a,r[t+2]=l},r.Factory.addGetterSetter(o.Node,"contrast",0,(0,i.getNumberValidator)(),r.Factory.afterSetFilter)},983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Emboss=void 0;const r=n(4892),o=n(6536),i=n(4060),a=n(5483);t.Emboss=function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),o=this.embossBlend(),a=0,l=0,s=e.data,c=e.width,u=e.height,d=4*c,f=u;switch(r){case"top-left":a=-1,l=-1;break;case"top":a=-1,l=0;break;case"top-right":a=-1,l=1;break;case"right":a=0,l=1;break;case"bottom-right":a=1,l=1;break;case"bottom":a=1,l=0;break;case"bottom-left":a=1,l=-1;break;case"left":a=0,l=-1;break;default:i.Util.error("Unknown emboss direction: "+r)}do{var h=(f-1)*d,p=a;f+p<1&&(p=0),f+p>u&&(p=0);var g=(f-1+p)*c*4,m=c;do{var v=h+4*(m-1),y=l;m+y<1&&(y=0),m+y>c&&(y=0);var b=g+4*(m-1+y),w=s[v]-s[b],x=s[v+1]-s[b+1],S=s[v+2]-s[b+2],C=w,E=C>0?C:-C;if((x>0?x:-x)>E&&(C=x),(S>0?S:-S)>E&&(C=S),C*=t,o){var k=s[v]+C,O=s[v+1]+C,_=s[v+2]+C;s[v]=k>255?255:k<0?0:k,s[v+1]=O>255?255:O<0?0:O,s[v+2]=_>255?255:_<0?0:_}else{var P=n-C;P<0?P=0:P>255&&(P=255),s[v]=s[v+1]=s[v+2]=P}}while(--m)}while(--f)},r.Factory.addGetterSetter(o.Node,"embossStrength",.5,(0,a.getNumberValidator)(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(o.Node,"embossWhiteLevel",.5,(0,a.getNumberValidator)(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(o.Node,"embossDirection","top-left",null,r.Factory.afterSetFilter),r.Factory.addGetterSetter(o.Node,"embossBlend",!1,null,r.Factory.afterSetFilter)},7928:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Enhance=void 0;const r=n(4892),o=n(6536),i=n(5483);function a(e,t,n,r,o){var i=n-t,a=o-r;return 0===i?r+a/2:0===a?r:a*((e-t)/i)+r}t.Enhance=function(e){var t,n,r,o,i=e.data,l=i.length,s=i[0],c=s,u=i[1],d=u,f=i[2],h=f,p=this.enhance();if(0!==p){for(o=0;oc&&(c=t),(n=i[o+1])d&&(d=n),(r=i[o+2])h&&(h=r);var g,m,v,y,b,w,x,S,C;for(c===s&&(c=255,s=0),d===u&&(d=255,u=0),h===f&&(h=255,f=0),p>0?(m=c+p*(255-c),v=s-p*(s-0),b=d+p*(255-d),w=u-p*(u-0),S=h+p*(255-h),C=f-p*(f-0)):(m=c+p*(c-(g=.5*(c+s))),v=s+p*(s-g),b=d+p*(d-(y=.5*(d+u))),w=u+p*(u-y),S=h+p*(h-(x=.5*(h+f))),C=f+p*(f-x)),o=0;o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Grayscale=void 0,t.Grayscale=function(e){var t,n,r=e.data,o=r.length;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HSL=void 0;const r=n(4892),o=n(6536),i=n(5483);r.Factory.addGetterSetter(o.Node,"hue",0,(0,i.getNumberValidator)(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(o.Node,"saturation",0,(0,i.getNumberValidator)(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(o.Node,"luminance",0,(0,i.getNumberValidator)(),r.Factory.afterSetFilter),t.HSL=function(e){var t,n,r,o,i,a=e.data,l=a.length,s=Math.pow(2,this.saturation()),c=Math.abs(this.hue()+360)%360,u=127*this.luminance(),d=1*s*Math.cos(c*Math.PI/180),f=1*s*Math.sin(c*Math.PI/180),h=.299+.701*d+.167*f,p=.587-.587*d+.33*f,g=.114-.114*d-.497*f,m=.299-.299*d-.328*f,v=.587+.413*d+.035*f,y=.114-.114*d+.293*f,b=.299-.3*d+1.25*f,w=.587-.586*d-1.05*f,x=.114+.886*d-.2*f;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HSV=void 0;const r=n(4892),o=n(6536),i=n(5483);t.HSV=function(e){var t,n,r,o,i,a=e.data,l=a.length,s=Math.pow(2,this.value()),c=Math.pow(2,this.saturation()),u=Math.abs(this.hue()+360)%360,d=s*c*Math.cos(u*Math.PI/180),f=s*c*Math.sin(u*Math.PI/180),h=.299*s+.701*d+.167*f,p=.587*s-.587*d+.33*f,g=.114*s-.114*d-.497*f,m=.299*s-.299*d-.328*f,v=.587*s+.413*d+.035*f,y=.114*s-.114*d+.293*f,b=.299*s-.3*d+1.25*f,w=.587*s-.586*d-1.05*f,x=.114*s+.886*d-.2*f;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Invert=void 0,t.Invert=function(e){var t,n=e.data,r=n.length;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Kaleidoscope=void 0;const r=n(4892),o=n(6536),i=n(4060),a=n(5483);t.Kaleidoscope=function(e){var t,n,r,o,a,l,s,c,u,d=e.width,f=e.height,h=Math.round(this.kaleidoscopePower()),p=Math.round(this.kaleidoscopeAngle()),g=Math.floor(d*(p%360)/360);if(!(h<1)){var m=i.Util.createCanvasElement();m.width=d,m.height=f;var v=m.getContext("2d").getImageData(0,0,d,f);i.Util.releaseCanvas(m),function(e,t,n){var r,o,i,a,l=e.data,s=t.data,c=e.width,u=e.height,d=n.polarCenterX||c/2,f=n.polarCenterY||u/2,h=0,p=0,g=0,m=0,v=Math.sqrt(d*d+f*f);o=c-d,i=u-f,v=(a=Math.sqrt(o*o+i*i))>v?a:v;var y,b,w,x,S=u,C=c,E=360/C*Math.PI/180;for(b=0;bd&&(w=b,x=0,S=-1),n=0;nb?s:b;var w,x,S,C=f,E=d,k=n.polarRotation||0;for(o=0;o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mask=void 0;const r=n(4892),o=n(6536),i=n(5483);function a(e,t,n){var r=4*(n*e.width+t),o=[];return o.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),o}function l(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}t.Mask=function(e){var t=function(e,t){var n=a(e,0,0),r=a(e,e.width-1,0),o=a(e,0,e.height-1),i=a(e,e.width-1,e.height-1),s=t||10;if(l(n,r)=0&&h=0&&p=0&&h=0&&p=1020?255:0}return a}(t=function(e,t,n){for(var r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),a=[],l=0;l=0&&h=0&&p{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Noise=void 0;const r=n(4892),o=n(6536),i=n(5483);t.Noise=function(e){var t,n=255*this.noise(),r=e.data,o=r.length,i=n/2;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Pixelate=void 0;const r=n(4892),o=n(4060),i=n(6536),a=n(5483);t.Pixelate=function(e){var t,n,r,i,a,l,s,c,u,d,f,h,p,g,m=Math.ceil(this.pixelSize()),v=e.width,y=e.height,b=Math.ceil(v/m),w=Math.ceil(y/m),x=e.data;if(m<=0)o.Util.error("pixelSize value can not be <= 0");else for(h=0;h=v))for(n=d;n=y||(i+=x[0+(r=4*(v*n+t))],a+=x[r+1],l+=x[r+2],s+=x[r+3],g+=1);for(i/=g,a/=g,l/=g,s/=g,t=c;t=v))for(n=d;n=y||(x[0+(r=4*(v*n+t))]=i,x[r+1]=a,x[r+2]=l,x[r+3]=s)}},r.Factory.addGetterSetter(i.Node,"pixelSize",8,(0,a.getNumberValidator)(),r.Factory.afterSetFilter)},7019:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Posterize=void 0;const r=n(4892),o=n(6536),i=n(5483);t.Posterize=function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,o=r.length,i=255/n;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RGB=void 0;const r=n(4892),o=n(6536),i=n(5483);t.RGB=function(e){var t,n,r=e.data,o=r.length,i=this.red(),a=this.green(),l=this.blue();for(t=0;t255?255:e<0?0:Math.round(e)})),r.Factory.addGetterSetter(o.Node,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),r.Factory.addGetterSetter(o.Node,"blue",0,i.RGBComponent,r.Factory.afterSetFilter)},3862:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RGBA=void 0;const r=n(4892),o=n(6536),i=n(5483);t.RGBA=function(e){var t,n,r=e.data,o=r.length,i=this.red(),a=this.green(),l=this.blue(),s=this.alpha();for(t=0;t255?255:e<0?0:Math.round(e)})),r.Factory.addGetterSetter(o.Node,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),r.Factory.addGetterSetter(o.Node,"blue",0,i.RGBComponent,r.Factory.afterSetFilter),r.Factory.addGetterSetter(o.Node,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}))},2512:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sepia=void 0,t.Sepia=function(e){var t,n,r,o,i=e.data,a=i.length;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Solarize=void 0,t.Solarize=function(e){var t=e.data,n=e.width,r=4*n,o=e.height;do{var i=(o-1)*r,a=n;do{var l=i+4*(a-1),s=t[l],c=t[l+1],u=t[l+2];s>127&&(s=255-s),c>127&&(c=255-c),u>127&&(u=255-u),t[l]=s,t[l+1]=c,t[l+2]=u}while(--a)}while(--o)}},661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Threshold=void 0;const r=n(4892),o=n(6536),i=n(5483);t.Threshold=function(e){var t,n=255*this.threshold(),r=e.data,o=r.length;for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8558);e.exports=r.Konva},4821:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Arc=void 0;const r=n(4892),o=n(4723),i=n(8871),a=n(5483),l=n(8871);class s extends o.Shape{_sceneFunc(e){var t=i.Konva.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=i.Konva.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),l=Math.sin(Math.min(r,Math.PI/2)),s=o*(o>0?e:t),c=a*(a>0?e:t),u=l*(l>0?t:e);return{x:s,y:n?-1*u:c,width:1*t-s,height:u-c}}}t.Arc=s,s.prototype._centroid=!0,s.prototype.className="Arc",s.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,l._registerNode)(s),r.Factory.addGetterSetter(s,"innerRadius",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(s,"outerRadius",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(s,"angle",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(s,"clockwise",!1,(0,a.getBooleanValidator)())},9456:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Arrow=void 0;const r=n(4892),o=n(3443),i=n(5483),a=n(8871),l=n(1486);class s extends o.Line{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),r=n,o=0!==this.tension()&&n.length>4;o&&(r=this.getTensionPoints());var i,a,s=this.pointerLength(),c=n.length;if(o){const e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[c-2],n[c-1]],t=l.Path.calcLength(r[r.length-4],r[r.length-3],"C",e),o=l.Path.getPointOnQuadraticBezier(Math.min(1,1-s/t),e[0],e[1],e[2],e[3],e[4],e[5]);i=n[c-2]-o.x,a=n[c-1]-o.y}else i=n[c-2]-n[c-4],a=n[c-1]-n[c-3];var u=(Math.atan2(a,i)+t)%t,d=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[c-2],n[c-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-s,d/2),e.lineTo(-s,-d/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(i=(r[0]+r[2])/2-n[0],a=(r[1]+r[3])/2-n[1]):(i=n[2]-n[0],a=n[3]-n[1]),e.rotate((Math.atan2(-a,-i)+t)%t),e.moveTo(0,0),e.lineTo(-s,d/2),e.lineTo(-s,-d/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}t.Arrow=s,s.prototype.className="Arrow",(0,a._registerNode)(s),r.Factory.addGetterSetter(s,"pointerLength",10,(0,i.getNumberValidator)()),r.Factory.addGetterSetter(s,"pointerWidth",10,(0,i.getNumberValidator)()),r.Factory.addGetterSetter(s,"pointerAtBeginning",!1),r.Factory.addGetterSetter(s,"pointerAtEnding",!0)},9729:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Circle=void 0;const r=n(4892),o=n(4723),i=n(5483),a=n(8871);class l extends o.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}t.Circle=l,l.prototype._centroid=!0,l.prototype.className="Circle",l.prototype._attrsAffectingSize=["radius"],(0,a._registerNode)(l),r.Factory.addGetterSetter(l,"radius",0,(0,i.getNumberValidator)())},6955:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Ellipse=void 0;const r=n(4892),o=n(4723),i=n(5483),a=n(8871);class l extends o.Shape{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}t.Ellipse=l,l.prototype.className="Ellipse",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,a._registerNode)(l),r.Factory.addComponentsGetterSetter(l,"radius",["x","y"]),r.Factory.addGetterSetter(l,"radiusX",0,(0,i.getNumberValidator)()),r.Factory.addGetterSetter(l,"radiusY",0,(0,i.getNumberValidator)())},7256:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Image=void 0;const r=n(4060),o=n(4892),i=n(4723),a=n(8871),l=n(5483);class s extends i.Shape{constructor(e){super(e),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),o=this.cornerRadius(),i=this.attrs.image;let a;if(i){const e=this.attrs.cropWidth,r=this.attrs.cropHeight;a=e&&r?[i,this.cropX(),this.cropY(),e,r,0,0,t,n]:[i,0,0,t,n]}(this.hasFill()||this.hasStroke()||o)&&(e.beginPath(),o?r.Util.drawRoundedRectPath(e,t,n,o):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),i&&(o&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){var t=this.width(),n=this.height(),o=this.cornerRadius();e.beginPath(),o?r.Util.drawRoundedRectPath(e,t,n,o):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t,n=null){var o=r.Util.createImageElement();o.onload=function(){var e=new s({image:o});t(e)},o.onerror=n,o.crossOrigin="Anonymous",o.src=e}}t.Image=s,s.prototype.className="Image",(0,a._registerNode)(s),o.Factory.addGetterSetter(s,"cornerRadius",0,(0,l.getNumberOrArrayOfNumbersValidator)(4)),o.Factory.addGetterSetter(s,"image"),o.Factory.addComponentsGetterSetter(s,"crop",["x","y","width","height"]),o.Factory.addGetterSetter(s,"cropX",0,(0,l.getNumberValidator)()),o.Factory.addGetterSetter(s,"cropY",0,(0,l.getNumberValidator)()),o.Factory.addGetterSetter(s,"cropWidth",0,(0,l.getNumberValidator)()),o.Factory.addGetterSetter(s,"cropHeight",0,(0,l.getNumberValidator)())},6619:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=t.Label=void 0;const r=n(4892),o=n(4723),i=n(7949),a=n(5483),l=n(8871);var s=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],c="up",u="right",d="down",f="left",h=s.length;class p extends i.Group{constructor(e){super(e),this.on("add.konva",(function(e){this._addListeners(e.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var t,n=this,r=function(){n._sync()};for(t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Line=void 0;const r=n(4892),o=n(4723),i=n(5483),a=n(8871);function l(e,t,n,r,o,i,a){var l=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),s=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),c=a*l/(l+s),u=a*s/(l+s);return[n-c*(o-e),r-c*(i-t),n+u*(o-e),r+u*(i-t)]}function s(e,t){var n,r,o=e.length,i=[];for(n=2;n4){for(n=(t=this.getTensionPoints()).length,r=l?0:4,l||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Path=void 0;const r=n(4892),o=n(4723),i=n(8871),a=n(5570);class l extends o.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",(function(){this._readDataAttribute()}))}_readDataAttribute(){this.dataArray=l.parsePathData(this.data()),this.pathLength=l.getPathLength(this.dataArray)}_sceneFunc(e){var t=this.dataArray;e.beginPath();for(var n=!1,r=0;rc?s:c,g=s>c?1:s/c,m=s>c?c/s:1;e.translate(a,l),e.rotate(f),e.scale(g,m),e.arc(0,0,p,u,u+d,1-h),e.scale(1/g,1/m),e.rotate(-f),e.translate(-a,-l);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var n=t.points[4],r=t.points[5],o=t.points[4]+r,i=Math.PI/180;if(Math.abs(n-o)o;r-=i){const n=l.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}else for(let r=n+i;rt[r].pathLength;)e-=t[r].pathLength,++r;if(r===o)return{x:(n=t[r-1].points.slice(-2))[0],y:n[1]};if(e<.01)return{x:(n=t[r].points.slice(0,2))[0],y:n[1]};var i=t[r],s=i.points;switch(i.command){case"L":return l.getPointOnLine(e,i.start.x,i.start.y,s[0],s[1]);case"C":return l.getPointOnCubicBezier((0,a.t2length)(e,l.getPathLength(t),(e=>(0,a.getCubicArcLength)([i.start.x,s[0],s[2],s[4]],[i.start.y,s[1],s[3],s[5]],e))),i.start.x,i.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return l.getPointOnQuadraticBezier((0,a.t2length)(e,l.getPathLength(t),(e=>(0,a.getQuadraticArcLength)([i.start.x,s[0],s[2]],[i.start.y,s[1],s[3]],e))),i.start.x,i.start.y,s[0],s[1],s[2],s[3]);case"A":var c=s[0],u=s[1],d=s[2],f=s[3],h=s[4],p=s[5],g=s[6];return h+=p*e/i.pathLength,l.getPointOnEllipticalArc(c,u,d,f,h,g)}return null}static getPointOnLine(e,t,n,r,o,i,a){i=null!=i?i:t,a=null!=a?a:n;const l=this.getLineLength(t,n,r,o);if(l<1e-10)return{x:t,y:n};if(r===t)return{x:i,y:a+(o>n?e:-e)};const s=(o-n)/(r-t),c=Math.sqrt(e*e/(1+s*s))*(r0&&!isNaN(h[0]);){var v,y,b,w,x,S,C,E,k,O,_="",P=[],T=s,I=c;switch(f){case"l":s+=h.shift(),c+=h.shift(),_="L",P.push(s,c);break;case"L":s=h.shift(),c=h.shift(),P.push(s,c);break;case"m":var N=h.shift(),$=h.shift();if(s+=N,c+=$,_="M",a.length>2&&"z"===a[a.length-1].command)for(var R=a.length-2;R>=0;R--)if("M"===a[R].command){s=a[R].points[0]+N,c=a[R].points[1]+$;break}P.push(s,c),f="l";break;case"M":s=h.shift(),c=h.shift(),_="M",P.push(s,c),f="L";break;case"h":s+=h.shift(),_="L",P.push(s,c);break;case"H":s=h.shift(),_="L",P.push(s,c);break;case"v":c+=h.shift(),_="L",P.push(s,c);break;case"V":c=h.shift(),_="L",P.push(s,c);break;case"C":P.push(h.shift(),h.shift(),h.shift(),h.shift()),s=h.shift(),c=h.shift(),P.push(s,c);break;case"c":P.push(s+h.shift(),c+h.shift(),s+h.shift(),c+h.shift()),s+=h.shift(),c+=h.shift(),_="C",P.push(s,c);break;case"S":y=s,b=c,"C"===(v=a[a.length-1]).command&&(y=s+(s-v.points[2]),b=c+(c-v.points[3])),P.push(y,b,h.shift(),h.shift()),s=h.shift(),c=h.shift(),_="C",P.push(s,c);break;case"s":y=s,b=c,"C"===(v=a[a.length-1]).command&&(y=s+(s-v.points[2]),b=c+(c-v.points[3])),P.push(y,b,s+h.shift(),c+h.shift()),s+=h.shift(),c+=h.shift(),_="C",P.push(s,c);break;case"Q":P.push(h.shift(),h.shift()),s=h.shift(),c=h.shift(),P.push(s,c);break;case"q":P.push(s+h.shift(),c+h.shift()),s+=h.shift(),c+=h.shift(),_="Q",P.push(s,c);break;case"T":y=s,b=c,"Q"===(v=a[a.length-1]).command&&(y=s+(s-v.points[0]),b=c+(c-v.points[1])),s=h.shift(),c=h.shift(),_="Q",P.push(y,b,s,c);break;case"t":y=s,b=c,"Q"===(v=a[a.length-1]).command&&(y=s+(s-v.points[0]),b=c+(c-v.points[1])),s+=h.shift(),c+=h.shift(),_="Q",P.push(y,b,s,c);break;case"A":w=h.shift(),x=h.shift(),S=h.shift(),C=h.shift(),E=h.shift(),k=s,O=c,s=h.shift(),c=h.shift(),_="A",P=this.convertEndpointToCenterParameterization(k,O,s,c,C,E,w,x,S);break;case"a":w=h.shift(),x=h.shift(),S=h.shift(),C=h.shift(),E=h.shift(),k=s,O=c,s+=h.shift(),c+=h.shift(),_="A",P=this.convertEndpointToCenterParameterization(k,O,s,c,C,E,w,x,S)}a.push({command:_||f,points:P,start:{x:T,y:I},pathLength:this.calcLength(T,I,_||f,P)})}"z"!==f&&"Z"!==f||a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(e,t,n,r){var o,i,s,c,u=l;switch(n){case"L":return u.getLineLength(e,t,r[0],r[1]);case"C":return(0,a.getCubicArcLength)([e,r[0],r[2],r[4]],[t,r[1],r[3],r[5]],1);case"Q":return(0,a.getQuadraticArcLength)([e,r[0],r[2]],[t,r[1],r[3]],1);case"A":o=0;var d=r[4],f=r[5],h=r[4]+f,p=Math.PI/180;if(Math.abs(d-h)h;c-=p)s=u.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),o+=u.getLineLength(i.x,i.y,s.x,s.y),i=s;else for(c=d+p;c1&&(a*=Math.sqrt(f),l*=Math.sqrt(f));var h=Math.sqrt((a*a*(l*l)-a*a*(d*d)-l*l*(u*u))/(a*a*(d*d)+l*l*(u*u)));o===i&&(h*=-1),isNaN(h)&&(h=0);var p=h*a*d/l,g=h*-l*u/a,m=(e+n)/2+Math.cos(c)*p-Math.sin(c)*g,v=(t+r)/2+Math.sin(c)*p+Math.cos(c)*g,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},w=function(e,t){return(e[0]*t[1]=1&&(E=0),0===i&&E>0&&(E-=2*Math.PI),1===i&&E<0&&(E+=2*Math.PI),[m,v,a,l,x,E,c,i]}}t.Path=l,l.prototype.className="Path",l.prototype._attrsAffectingSize=["data"],(0,i._registerNode)(l),r.Factory.addGetterSetter(l,"data")},5155:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rect=void 0;const r=n(4892),o=n(4723),i=n(8871),a=n(4060),l=n(5483);class s extends o.Shape{_sceneFunc(e){var t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?a.Util.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}}t.Rect=s,s.prototype.className="Rect",(0,i._registerNode)(s),r.Factory.addGetterSetter(s,"cornerRadius",0,(0,l.getNumberOrArrayOfNumbersValidator)(4))},9131:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegularPolygon=void 0;const r=n(4892),o=n(4723),i=n(5483),a=n(8871);class l extends o.Shape{_sceneFunc(e){const t=this._getPoints();e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var n=1;n{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),o=Math.max(o,e.y)})),{x:t,y:r,width:n-t,height:o-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}t.RegularPolygon=l,l.prototype.className="RegularPolygon",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["radius"],(0,a._registerNode)(l),r.Factory.addGetterSetter(l,"radius",0,(0,i.getNumberValidator)()),r.Factory.addGetterSetter(l,"sides",0,(0,i.getNumberValidator)())},5451:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Ring=void 0;const r=n(4892),o=n(4723),i=n(5483),a=n(8871);var l=2*Math.PI;class s extends o.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,l,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),l,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}t.Ring=s,s.prototype.className="Ring",s.prototype._centroid=!0,s.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,a._registerNode)(s),r.Factory.addGetterSetter(s,"innerRadius",0,(0,i.getNumberValidator)()),r.Factory.addGetterSetter(s,"outerRadius",0,(0,i.getNumberValidator)())},9308:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sprite=void 0;const r=n(4892),o=n(4723),i=n(9696),a=n(5483),l=n(8871);class s extends o.Shape{constructor(e){super(e),this._updated=!0,this.anim=new i.Animation((()=>{var e=this._updated;return this._updated=!1,e})),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(e){var t=this.animation(),n=this.frameIndex(),r=4*n,o=this.animations()[t],i=this.frameOffsets(),a=o[r+0],l=o[r+1],s=o[r+2],c=o[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,s,c),e.closePath(),e.fillStrokeShape(this)),u)if(i){var d=i[t],f=2*n;e.drawImage(u,a,l,s,c,d[f+0],d[f+1],s,c)}else e.drawImage(u,a,l,s,c,0,0,s,c)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,o=this.animations()[t],i=this.frameOffsets(),a=o[r+2],l=o[r+3];if(e.beginPath(),i){var s=i[t],c=2*n;e.rect(s[c+0],s[c+1],a,l)}else e.rect(0,0,a,l);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval((function(){e._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),t=this.animation();e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Star=void 0;const r=n(4892),o=n(4723),i=n(5483),a=n(8871);class l extends o.Shape{_sceneFunc(e){var t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(var o=1;o<2*r;o++){var i=o%2==0?n:t,a=i*Math.sin(o*Math.PI/r),l=-1*i*Math.cos(o*Math.PI/r);e.lineTo(a,l)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}t.Star=l,l.prototype.className="Star",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,a._registerNode)(l),r.Factory.addGetterSetter(l,"numPoints",5,(0,i.getNumberValidator)()),r.Factory.addGetterSetter(l,"innerRadius",0,(0,i.getNumberValidator)()),r.Factory.addGetterSetter(l,"outerRadius",0,(0,i.getNumberValidator)())},1958:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Text=t.stringToArray=void 0;const r=n(4060),o=n(4892),i=n(4723),a=n(8871),l=n(5483),s=n(8871);function c(e){return Array.from(e)}t.stringToArray=c;var u,d="auto",f="inherit",h="justify",p="left",g="middle",m="normal",v=" ",y="none",b=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],w=b.length;function x(){return u||(u=r.Util.createCanvasElement().getContext("2d"))}class S extends i.Shape{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(var t=0;t1&&(C+=l)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=r.Util._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),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 r.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=x(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,actualBoundingBoxLeft:t.actualBoundingBoxLeft,actualBoundingBoxRight:t.actualBoundingBoxRight,alphabeticBaseline:t.alphabeticBaseline,emHeightAscent:t.emHeightAscent,emHeightDescent:t.emHeightDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent,hangingBaseline:t.hangingBaseline,ideographicBaseline:t.ideographicBaseline,width:t.width,height:r}}_getContextFont(){return this.fontStyle()+v+this.fontVariant()+v+(this.fontSize()+"px ")+this.fontFamily().split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e})).join(", ")}_addTextLine(e){this.align()===h&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return x().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,a=o!==d&&void 0!==o,l=i!==d&&void 0!==i,s=this.padding(),c=o-2*s,u=i-2*s,f=0,h=this.wrap(),p="char"!==h&&h!==y,g=this.ellipsis();this.textArr=[],x().font=this._getContextFont();for(var m=g?this._getTextWidth("…"):0,b=0,w=e.length;bc)for(;S.length>0;){for(var E=0,k=S.length,O="",_=0;E>>1,T=S.slice(0,P+1),I=this._getTextWidth(T)+m;I<=c?(E=P+1,O=T,_=I):k=P}if(!O)break;if(p){var N,$=S[O.length];(N=($===v||"-"===$)&&_<=c?O.length:Math.max(O.lastIndexOf(v),O.lastIndexOf("-"))+1)>0&&(E=N,O=O.slice(0,E),_=this._getTextWidth(O))}if(O=O.trimRight(),this._addTextLine(O),n=Math.max(n,_),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if((S=(S=S.slice(E)).trimLeft()).length>0&&(C=this._getTextWidth(S))<=c){this._addTextLine(S),f+=r,n=Math.max(n,C);break}}else this._addTextLine(S),f+=r,n=Math.max(n,C),this._shouldHandleEllipsis(f)&&bu)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){var t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==d&&void 0!==r,i=r-2*this.padding();return!(this.wrap()!==y)||o&&e+n>i}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,t=e!==d&&void 0!==e,n=e-2*this.padding(),r=this.ellipsis(),o=this.textArr[this.textArr.length-1];o&&r&&(t&&(this._getTextWidth(o.text+"…"){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextPath=void 0;const r=n(4060),o=n(4892),i=n(4723),a=n(1486),l=n(1958),s=n(5483),c=n(8871);var u="normal";function d(e){e.fillText(this.partialText,0,0)}function f(e){e.strokeText(this.partialText,0,0)}class h extends i.Shape{constructor(e){super(e),this.dummyCanvas=r.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 a.Path.getPathLength(this.dataArray)}_getPointAtLength(e){return this.attrs.data?e-1>this.pathLength?null:a.Path.getPointAtLengthOfDataArray(e,this.dataArray):null}_readDataAttribute(){this.dataArray=a.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var t=this.textDecoration(),n=this.fill(),r=this.fontSize(),o=this.glyphInfo;"underline"===t&&e.beginPath();for(var i=0;i=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Transformer=void 0;const r=n(4060),o=n(4892),i=n(6536),a=n(4723),l=n(5155),s=n(7949),c=n(8871),u=n(5483),d=n(8871);var f="tr-konva",h=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((e=>e+`.${f}`)).join(" "),p="nodesRect",g=["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};const v="ontouchstart"in c.Konva._global;var y=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function b(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),o=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:o}}let w=0;class x extends s.Group{constructor(e){super(e),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(h,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return r.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return f+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter((e=>!e.isAncestorOf(this)||(r.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1)));return this._nodes=e=t,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map((e=>e+"Change."+this._getEventNamespace())).join(" ");e.on(n,t),e.on(g.map((e=>e+`.${this._getEventNamespace()}`)).join(" "),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,(n=>{t=e.getAbsolutePosition(),this.isDragging()||e===this.findOne(".back")||this.startDrag(n,!1)})),e.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!t)return;const r=e.getAbsolutePosition(),o=r.x-t.x,i=r.y-t.y;this.nodes().forEach((t=>{if(t===e)return;if(t.isDragging())return;const r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+o,y:r.y+i}),t.startDrag(n)})),t=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((e=>{e.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(p),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(p,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(n),i=e.getAbsolutePosition(n),a=r.x*o.x-e.offsetX()*o.x,l=r.y*o.y-e.offsetY()*o.y;const s=(c.Konva.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return b({x:i.x+a*Math.cos(s)+l*Math.sin(-s),y:i.y+l*Math.cos(s)+a*Math.sin(s),width:r.width*o.x,height:r.height*o.y,rotation:s},-c.Konva.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map((t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],o=t.getAbsoluteTransform();r.forEach((function(t){var n=o.point(t);e.push(n)}))}));const t=new r.Transform;t.rotate(-c.Konva.getAngle(this.rotation()));var n=1/0,o=1/0,i=-1/0,a=-1/0;e.forEach((function(e){var r=t.point(e);void 0===n&&(n=i=r.x,o=a=r.y),n=Math.min(n,r.x),o=Math.min(o,r.y),i=Math.max(i,r.x),a=Math.max(a,r.y)})),t.invert();const l=t.point({x:n,y:o});return{x:l.x,y:l.y,width:i-n,height:a-o,rotation:c.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((e=>{this._createAnchor(e)})),this._createAnchor("rotater")}_createAnchor(e){var t=new l.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:v?10:"auto"}),n=this;t.on("mousedown touchstart",(function(e){n._handleMouseDown(e)})),t.on("dragstart",(e=>{t.stopDrag(),e.cancelBubble=!0})),t.on("dragend",(e=>{e.cancelBubble=!0})),t.on("mouseenter",(()=>{var n=c.Konva.getAngle(this.rotation()),o=this.rotateAnchorCursor(),i=function(e,t,n){if("rotater"===e)return n;t+=r.Util.degToRad(m[e]||0);var o=(r.Util.radToDeg(t)%360+360)%360;return r.Util._inRange(o,337.5,360)||r.Util._inRange(o,0,22.5)?"ns-resize":r.Util._inRange(o,22.5,67.5)?"nesw-resize":r.Util._inRange(o,67.5,112.5)?"ew-resize":r.Util._inRange(o,112.5,157.5)?"nwse-resize":r.Util._inRange(o,157.5,202.5)?"ns-resize":r.Util._inRange(o,202.5,247.5)?"nesw-resize":r.Util._inRange(o,247.5,292.5)?"ew-resize":r.Util._inRange(o,292.5,337.5)?"nwse-resize":(r.Util.error("Transformer has unknown angle for cursor detection: "+o),"pointer")}(e,n,o);t.getStage().content&&(t.getStage().content.style.cursor=i),this._cursorChange=!0})),t.on("mouseout",(()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(t)}_createBack(){var e=new a.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,t){var n=t.getParent(),o=n.padding();e.beginPath(),e.rect(-o,-o,t.width()+2*o,t.height()+2*o),e.moveTo(t.width()/2,-o),n.rotateEnabled()&&n.rotateLineVisible()&&e.lineTo(t.width()/2,-n.rotateAnchorOffset()*r.Util._sign(t.height())-o),e.fillStrokeShape(t)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),e.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",(e=>{e.cancelBubble=!0})),e.on("dragmove",(e=>{e.cancelBubble=!0})),e.on("dragend",(e=>{e.cancelBubble=!0})),this.on("dragmove",(e=>{this.update()}))}_handleMouseDown(e){if(!this._transforming){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),"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;var i=e.target.getAbsolutePosition(),a=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-i.x,y:a.y-i.y},w++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((t=>{t._fire("transformstart",{evt:e.evt,target:t})}))}}_handleMouseMove(e){var t,n,r,o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const a=i.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const s=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(s,l,e)),o.setAbsolutePosition(l);const u=o.getAbsolutePosition();if(s.x!==u.x||s.y!==u.y)if("rotater"!==this._movingAnchorName){var d,f=this.shiftBehavior();d="inverted"===f?this.keepRatio()&&!e.shiftKey:"none"===f?this.keepRatio():this.keepRatio()||e.shiftKey;var h=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(d){var p=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(p.x-o.x(),2)+Math.pow(p.y-o.y(),2));var g=this.findOne(".top-left").x()>p.x?-1:1,m=this.findOne(".top-left").y()>p.y?-1:1;t=r*this.cos*g,n=r*this.sin*m,this.findOne(".top-left").x(p.x-t),this.findOne(".top-left").y(p.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(o.y());else if("top-right"===this._movingAnchorName){d&&(p=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()},r=Math.sqrt(Math.pow(o.x()-p.x,2)+Math.pow(p.y-o.y(),2)),g=this.findOne(".top-right").x()p.y?-1:1,t=r*this.cos*g,n=r*this.sin*m,this.findOne(".top-right").x(p.x+t),this.findOne(".top-right").y(p.y-n));var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else"middle-left"===this._movingAnchorName?this.findOne(".top-left").x(o.x()):"middle-right"===this._movingAnchorName?this.findOne(".bottom-right").x(o.x()):"bottom-left"===this._movingAnchorName?(d&&(p=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()},r=Math.sqrt(Math.pow(p.x-o.x(),2)+Math.pow(o.y()-p.y,2)),g=p.x{var n;t._fire("transformend",{evt:e,target:t}),null===(n=t.getLayer())||void 0===n||n.batchDraw()})),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(r.Util._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(r.Util._inRange(e.height,2*-this.padding()-1,1))return void this.update();var o=new r.Transform;if(o.rotate(c.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=o.point({x:2*-this.padding(),y:0});e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=o.point({x:2*this.padding(),y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=o.point({x:0,y:2*-this.padding()});e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=o.point({x:0,y:2*this.padding()});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:r.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,a=new r.Transform;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/i,n.height/i);const l=new r.Transform,s=e.width/i,u=e.height/i;!1===this.flipEnabled()?(l.translate(e.x,e.y),l.rotate(e.rotation),l.translate(e.width<0?e.width:0,e.height<0?e.height:0),l.scale(Math.abs(s),Math.abs(u))):(l.translate(e.x,e.y),l.rotate(e.rotation),l.scale(s,u));const d=l.multiply(a.invert());this._nodes.forEach((e=>{var t;const n=e.getParent().getAbsoluteTransform(),o=e.getTransform().copy();o.translate(e.offsetX(),e.offsetY());const i=new r.Transform;i.multiply(n.copy().invert()).multiply(d).multiply(n).multiply(o);const a=i.decompose();e.setAttrs(a),null===(t=e.getLayer())||void 0===t||t.batchDraw()})),this.rotation(r.Util._getRotation(e.rotation)),this._nodes.forEach((e=>{this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e})})),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(r.Util._getRotation(t.rotation));var n=t.width,o=t.height,i=this.enabledAnchors(),a=this.resizeEnabled(),l=this.padding(),s=this.anchorSize();const c=this.find("._anchor");c.forEach((e=>{e.setAttrs({width:s,height:s,offsetX:s/2,offsetY:s/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:s/2+l,offsetY:s/2+l,visible:a&&i.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:s/2+l,visible:a&&i.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:s/2-l,offsetY:s/2+l,visible:a&&i.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:o/2,offsetX:s/2+l,visible:a&&i.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:o/2,offsetX:s/2-l,visible:a&&i.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:o,offsetX:s/2+l,offsetY:s/2-l,visible:a&&i.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:o,offsetY:s/2-l,visible:a&&i.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:o,offsetX:s/2-l,offsetY:s/2-l,visible:a&&i.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*r.Util._sign(o)-l,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:o,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const u=this.anchorStyleFunc();u&&c.forEach((e=>{u(e)})),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),s.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return i.Node.prototype.toObject.call(this)}clone(e){return i.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}t.Transformer=x,x.isTransforming=()=>w>0,x.prototype.className="Transformer",(0,d._registerNode)(x),o.Factory.addGetterSetter(x,"enabledAnchors",y,(function(e){return e instanceof Array||r.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===y.indexOf(e)&&r.Util.warn("Unknown anchor name: "+e+". Available names are: "+y.join(", "))})),e||[]})),o.Factory.addGetterSetter(x,"flipEnabled",!0,(0,u.getBooleanValidator)()),o.Factory.addGetterSetter(x,"resizeEnabled",!0),o.Factory.addGetterSetter(x,"anchorSize",10,(0,u.getNumberValidator)()),o.Factory.addGetterSetter(x,"rotateEnabled",!0),o.Factory.addGetterSetter(x,"rotateLineVisible",!0),o.Factory.addGetterSetter(x,"rotationSnaps",[]),o.Factory.addGetterSetter(x,"rotateAnchorOffset",50,(0,u.getNumberValidator)()),o.Factory.addGetterSetter(x,"rotateAnchorCursor","crosshair"),o.Factory.addGetterSetter(x,"rotationSnapTolerance",5,(0,u.getNumberValidator)()),o.Factory.addGetterSetter(x,"borderEnabled",!0),o.Factory.addGetterSetter(x,"anchorStroke","rgb(0, 161, 255)"),o.Factory.addGetterSetter(x,"anchorStrokeWidth",1,(0,u.getNumberValidator)()),o.Factory.addGetterSetter(x,"anchorFill","white"),o.Factory.addGetterSetter(x,"anchorCornerRadius",0,(0,u.getNumberValidator)()),o.Factory.addGetterSetter(x,"borderStroke","rgb(0, 161, 255)"),o.Factory.addGetterSetter(x,"borderStrokeWidth",1,(0,u.getNumberValidator)()),o.Factory.addGetterSetter(x,"borderDash"),o.Factory.addGetterSetter(x,"keepRatio",!0),o.Factory.addGetterSetter(x,"shiftBehavior","default"),o.Factory.addGetterSetter(x,"centeredScaling",!1),o.Factory.addGetterSetter(x,"ignoreStroke",!1),o.Factory.addGetterSetter(x,"padding",0,(0,u.getNumberValidator)()),o.Factory.addGetterSetter(x,"node"),o.Factory.addGetterSetter(x,"nodes"),o.Factory.addGetterSetter(x,"boundBoxFunc"),o.Factory.addGetterSetter(x,"anchorDragBoundFunc"),o.Factory.addGetterSetter(x,"anchorStyleFunc"),o.Factory.addGetterSetter(x,"shouldOverdrawWholeArea",!1),o.Factory.addGetterSetter(x,"useSingleNodeRotation",!0),o.Factory.backCompat(x,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"})},8001:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Wedge=void 0;const r=n(4892),o=n(4723),i=n(8871),a=n(5483),l=n(8871);class s extends o.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,i.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}t.Wedge=s,s.prototype.className="Wedge",s.prototype._centroid=!0,s.prototype._attrsAffectingSize=["radius"],(0,l._registerNode)(s),r.Factory.addGetterSetter(s,"radius",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(s,"angle",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(s,"clockwise",!1),r.Factory.backCompat(s,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"})},7787:(e,t)=>{"use strict";var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy");Symbol.for("react.offscreen");function g(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case o:case a:case i:case d:case f:return e;default:switch(e=e&&e.$$typeof){case c:case s:case u:case p:case h:case l:return e;default:return t}}case r:return t}}}Symbol.for("react.module.reference"),t.ForwardRef=u,t.isFragment=function(e){return g(e)===o},t.isMemo=function(e){return g(e)===h}},6351:(e,t,n)=>{"use strict";e.exports=n(7787)},2551:(e,t,n)=>{"use strict";var r=n(6540),o=n(9982);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n