this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const t=this.hitStrokeWidth();return t==="auto"?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){var n=this.getStage(),r=n.bufferHitCanvas,i;return r.getContext().clear(),this.drawHit(r,null,!0),i=r.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data,i[3]>0}destroy(){return Fe.prototype.destroy.call(this),delete dm[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var n;if(!this.getStage()||!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=t||this.hasFill(),o=this.hasStroke(),a=this.getAbsoluteOpacity()!==1;if(i&&o&&a)return!0;const s=this.hasShadow(),l=this.shadowForStrokeEnabled();return!!(i&&o&&s&&l)}setStrokeHitEnabled(t){se.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){const n=t.skipTransform,r=t.relativeTo,i=this.getSelfRect(),a=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,s=i.width+a,l=i.height+a,c=!t.skipShadow&&this.hasShadow(),p=c?this.shadowOffsetX():0,g=c?this.shadowOffsetY():0,m=s+Math.abs(p),y=l+Math.abs(g),b=c&&this.shadowBlur()||0,S=m+b*2,T=y+b*2,E={width:S,height:T,x:-(a/2+b)+Math.min(p,0)+i.x,y:-(a/2+b)+Math.min(g,0)+i.y};return n?E:this._transformedRect(E,r)}drawScene(t,n){var r=this.getLayer(),i=t||r.getCanvas(),o=i.getContext(),a=this._getCanvasCache(),s=this.getSceneFunc(),l=this.hasShadow(),c,p,g,m=i.isCache,y=n===this;if(!this.isVisible()&&!y)return this;if(a){o.save();var b=this.getAbsoluteTransform(n).getMatrix();return o.transform(b[0],b[1],b[2],b[3],b[4],b[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()&&!m){c=this.getStage(),p=c.bufferCanvas,g=p.getContext(),g.clear(),g.save(),g._applyLineJoin(this);var S=this.getAbsoluteTransform(n).getMatrix();g.transform(S[0],S[1],S[2],S[3],S[4],S[5]),s.call(this,g,this),g.restore();var T=p.pixelRatio;l&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(p._canvas,0,0,p.width/T,p.height/T)}else{if(o._applyLineJoin(this),!y){var S=this.getAbsoluteTransform(n).getMatrix();o.transform(S[0],S[1],S[2],S[3],S[4],S[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}l&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(t,n,r=!1){if(!this.shouldDrawHit(n,r))return this;var i=this.getLayer(),o=t||i.hitCanvas,a=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),c=l&&l.hit;if(this.colorKey||se.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 p=this.getAbsoluteTransform(n).getMatrix();return a.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!s)return this;if(a.save(),a._applyLineJoin(this),!(this===n)){var m=this.getAbsoluteTransform(n).getMatrix();a.transform(m[0],m[1],m[2],m[3],m[4],m[5])}return s.call(this,a,this),a.restore(),this}drawHitFromCache(t=0){var n=this._getCanvasCache(),r=this._getCachedSceneCanvas(),i=n.hit,o=i.getContext(),a=i.getWidth(),s=i.getHeight(),l,c,p,g,m,y;o.clear(),o.drawImage(r._canvas,0,0,a,s);try{for(l=o.getImageData(0,0,a,s),c=l.data,p=c.length,g=se._hexToRgb(this.colorKey),m=0;mt?(c[m]=g.r,c[m+1]=g.g,c[m+2]=g.b,c[m+3]=255):c[m+3]=0;o.putImageData(l,0,0)}catch(b){se.error("Unable to draw hit graph from cached scene canvas. "+b.message)}return this}hasPointerCapture(t){return M$(t,this)}setPointerCapture(t){R$(t,this)}releaseCapture(t){cm(t)}}Ae.prototype._fillFunc=ibe;Ae.prototype._strokeFunc=obe;Ae.prototype._fillFuncHit=abe;Ae.prototype._strokeFuncHit=sbe;Ae.prototype._centroid=!1;Ae.prototype.nodeType="Shape";hr(Ae);Ae.prototype.eventListeners={};Ae.prototype.on.call(Ae.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",lbe);Ae.prototype.on.call(Ae.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",ube);Ae.prototype.on.call(Ae.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",cbe);Ae.prototype.on.call(Ae.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",dbe);Ae.prototype.on.call(Ae.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",fbe);j.addGetterSetter(Ae,"stroke",void 0,A$());j.addGetterSetter(Ae,"strokeWidth",2,ze());j.addGetterSetter(Ae,"fillAfterStrokeEnabled",!1);j.addGetterSetter(Ae,"hitStrokeWidth","auto",a_());j.addGetterSetter(Ae,"strokeHitEnabled",!0,ws());j.addGetterSetter(Ae,"perfectDrawEnabled",!0,ws());j.addGetterSetter(Ae,"shadowForStrokeEnabled",!0,ws());j.addGetterSetter(Ae,"lineJoin");j.addGetterSetter(Ae,"lineCap");j.addGetterSetter(Ae,"sceneFunc");j.addGetterSetter(Ae,"hitFunc");j.addGetterSetter(Ae,"dash");j.addGetterSetter(Ae,"dashOffset",0,ze());j.addGetterSetter(Ae,"shadowColor",void 0,W0());j.addGetterSetter(Ae,"shadowBlur",0,ze());j.addGetterSetter(Ae,"shadowOpacity",1,ze());j.addComponentsGetterSetter(Ae,"shadowOffset",["x","y"]);j.addGetterSetter(Ae,"shadowOffsetX",0,ze());j.addGetterSetter(Ae,"shadowOffsetY",0,ze());j.addGetterSetter(Ae,"fillPatternImage");j.addGetterSetter(Ae,"fill",void 0,A$());j.addGetterSetter(Ae,"fillPatternX",0,ze());j.addGetterSetter(Ae,"fillPatternY",0,ze());j.addGetterSetter(Ae,"fillLinearGradientColorStops");j.addGetterSetter(Ae,"strokeLinearGradientColorStops");j.addGetterSetter(Ae,"fillRadialGradientStartRadius",0);j.addGetterSetter(Ae,"fillRadialGradientEndRadius",0);j.addGetterSetter(Ae,"fillRadialGradientColorStops");j.addGetterSetter(Ae,"fillPatternRepeat","repeat");j.addGetterSetter(Ae,"fillEnabled",!0);j.addGetterSetter(Ae,"strokeEnabled",!0);j.addGetterSetter(Ae,"shadowEnabled",!0);j.addGetterSetter(Ae,"dashEnabled",!0);j.addGetterSetter(Ae,"strokeScaleEnabled",!0);j.addGetterSetter(Ae,"fillPriority","color");j.addComponentsGetterSetter(Ae,"fillPatternOffset",["x","y"]);j.addGetterSetter(Ae,"fillPatternOffsetX",0,ze());j.addGetterSetter(Ae,"fillPatternOffsetY",0,ze());j.addComponentsGetterSetter(Ae,"fillPatternScale",["x","y"]);j.addGetterSetter(Ae,"fillPatternScaleX",1,ze());j.addGetterSetter(Ae,"fillPatternScaleY",1,ze());j.addComponentsGetterSetter(Ae,"fillLinearGradientStartPoint",["x","y"]);j.addComponentsGetterSetter(Ae,"strokeLinearGradientStartPoint",["x","y"]);j.addGetterSetter(Ae,"fillLinearGradientStartPointX",0);j.addGetterSetter(Ae,"strokeLinearGradientStartPointX",0);j.addGetterSetter(Ae,"fillLinearGradientStartPointY",0);j.addGetterSetter(Ae,"strokeLinearGradientStartPointY",0);j.addComponentsGetterSetter(Ae,"fillLinearGradientEndPoint",["x","y"]);j.addComponentsGetterSetter(Ae,"strokeLinearGradientEndPoint",["x","y"]);j.addGetterSetter(Ae,"fillLinearGradientEndPointX",0);j.addGetterSetter(Ae,"strokeLinearGradientEndPointX",0);j.addGetterSetter(Ae,"fillLinearGradientEndPointY",0);j.addGetterSetter(Ae,"strokeLinearGradientEndPointY",0);j.addComponentsGetterSetter(Ae,"fillRadialGradientStartPoint",["x","y"]);j.addGetterSetter(Ae,"fillRadialGradientStartPointX",0);j.addGetterSetter(Ae,"fillRadialGradientStartPointY",0);j.addComponentsGetterSetter(Ae,"fillRadialGradientEndPoint",["x","y"]);j.addGetterSetter(Ae,"fillRadialGradientEndPointX",0);j.addGetterSetter(Ae,"fillRadialGradientEndPointY",0);j.addGetterSetter(Ae,"fillPatternRotation",0);j.backCompat(Ae,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var hbe="#",pbe="beforeDraw",gbe="draw",Z$=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],mbe=Z$.length;class nh extends ia{constructor(t){super(t),this.canvas=new o0,this.hitCanvas=new s_({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(pbe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),ia.prototype.drawScene.call(this,i,n),this._fire(gbe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),ia.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){se.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return se.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}}nh.prototype.nodeType="Layer";hr(nh);j.addGetterSetter(nh,"imageSmoothingEnabled",!0);j.addGetterSetter(nh,"clearBeforeDraw",!0);j.addGetterSetter(nh,"hitGraphEnabled",!0,ws());class u_ extends nh{constructor(t){super(t),this.listening(!1),se.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}u_.prototype.nodeType="FastLayer";hr(u_);class _0 extends ia{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&se.throw("You may only add groups and shapes to groups.")}}_0.prototype.nodeType="Group";hr(_0);var $S=function(){return i0.performance&&i0.performance.now?function(){return i0.performance.now()}:function(){return new Date().getTime()}}();class Aa{constructor(t,n){this.id=Aa.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:$S(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return t===void 0&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=RA,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=OA,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var t=this.getTimer()-this._startTime;this.state===RA?this.setTime(t):this.state===OA&&this.setTime(this.duration-t)}pause(){this.state=ybe,this.fire("onPause")}getTimer(){return new Date().getTime()}}class Mr{constructor(t){var n=this,r=t.node,i=r._id,o,a=t.easing||fm.Linear,s=!!t.yoyo,l;typeof t.duration>"u"?o=.3:t.duration===0?o=.001:o=t.duration,this.node=r,this._id=xbe++;var c=r.getLayer()||(r instanceof et.Stage?r.getLayers():null);c||se.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Aa(function(){n.tween.onEnterFrame()},c),this.tween=new bbe(l,function(p){n._tweenFunc(p)},a,0,1,o*1e3,s),this._addListeners(),Mr.attrs[i]||(Mr.attrs[i]={}),Mr.attrs[i][this._id]||(Mr.attrs[i][this._id]={}),Mr.tweens[i]||(Mr.tweens[i]={});for(l in t)vbe[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){var r=this.node,i=r._id,o,a,s,l,c,p,g,m;if(s=Mr.tweens[i][t],s&&delete Mr.attrs[i][s][t],o=r.getAttr(t),se._isArray(n))if(a=[],c=Math.max(n.length,o.length),t==="points"&&n.length!==o.length&&(n.length>o.length?(g=o,o=se._prepareArrayForTween(o,n,r.closed())):(p=n,n=se._prepareArrayForTween(n,o,r.closed()))),t.indexOf("fill")===0)for(l=0;l{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var t=this.node,n=Mr.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var t=this.node,n=Mr.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(t*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var t=this.node._id,n=this._id,r=Mr.tweens[t],i;this.pause();for(i in r)delete Mr.tweens[t][i];delete Mr.attrs[t][n]}}Mr.attrs={};Mr.tweens={};Fe.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()};var n=new Mr(e);n.play()};const fm={BackEaseIn(e,t,n,r){var i=1.70158;return n*(e/=r)*e*((i+1)*e-i)+t},BackEaseOut(e,t,n,r){var i=1.70158;return n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},BackEaseInOut(e,t,n,r){var i=1.70158;return(e/=r/2)<1?n/2*(e*e*(((i*=1.525)+1)*e-i))+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},ElasticEaseIn(e,t,n,r,i,o){var a=0;return e===0?t:(e/=r)===1?t+n:(o||(o=r*.3),!i||i0?t:n),p=a*n,g=s*(s>0?t:n),m=l*(l>0?n:t);return{x:c,y:r?-1*m:g,width:p-c,height:m-g}}}ku.prototype._centroid=!0;ku.prototype.className="Arc";ku.prototype._attrsAffectingSize=["innerRadius","outerRadius"];hr(ku);j.addGetterSetter(ku,"innerRadius",0,ze());j.addGetterSetter(ku,"outerRadius",0,ze());j.addGetterSetter(ku,"angle",0,ze());j.addGetterSetter(ku,"clockwise",!1,ws());function b8(e,t,n,r,i,o,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),c=a*s/(s+l),p=a*l/(s+l),g=n-c*(i-e),m=r-c*(o-t),y=n+p*(i-e),b=r+p*(o-t);return[g,m,y,b]}function DA(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,c=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);cp?c:p,T=c>p?1:c/p,E=c>p?p/c:1;t.translate(s,l),t.rotate(y),t.scale(T,E),t.arc(0,0,S,g,g+m,1-b),t.scale(1/T,1/E),t.rotate(-y),t.translate(-s,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(c){if(c.command==="A"){var p=c.points[4],g=c.points[5],m=c.points[4]+g,y=Math.PI/180;if(Math.abs(p-m)m;b-=y){const S=In.getPointOnEllipticalArc(c.points[0],c.points[1],c.points[2],c.points[3],b,0);t.push(S.x,S.y)}else for(let b=p+y;bthis.dataArray[r].pathLength;)t-=this.dataArray[r].pathLength,++r;if(r===i)return n=this.dataArray[r-1].points.slice(-2),{x:n[0],y:n[1]};if(t<.01)return n=this.dataArray[r].points.slice(0,2),{x:n[0],y:n[1]};var o=this.dataArray[r],a=o.points;switch(o.command){case"L":return In.getPointOnLine(t,o.start.x,o.start.y,a[0],a[1]);case"C":return In.getPointOnCubicBezier(t/o.pathLength,o.start.x,o.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return In.getPointOnQuadraticBezier(t/o.pathLength,o.start.x,o.start.y,a[0],a[1],a[2],a[3]);case"A":var s=a[0],l=a[1],c=a[2],p=a[3],g=a[4],m=a[5],y=a[6];return g+=m*t/o.pathLength,In.getPointOnEllipticalArc(s,l,c,p,g,y)}return null}static getLineLength(t,n,r,i){return Math.sqrt((r-t)*(r-t)+(i-n)*(i-n))}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),c=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(b[0]);){var k=null,L=[],I=l,O=c,D,N,z,W,V,q,he,de,ve,Ee;switch(y){case"l":l+=b.shift(),c+=b.shift(),k="L",L.push(l,c);break;case"L":l=b.shift(),c=b.shift(),L.push(l,c);break;case"m":var xe=b.shift(),Z=b.shift();if(l+=xe,c+=Z,k="M",a.length>2&&a[a.length-1].command==="z"){for(var U=a.length-2;U>=0;U--)if(a[U].command==="M"){l=a[U].points[0]+xe,c=a[U].points[1]+Z;break}}L.push(l,c),y="l";break;case"M":l=b.shift(),c=b.shift(),k="M",L.push(l,c),y="L";break;case"h":l+=b.shift(),k="L",L.push(l,c);break;case"H":l=b.shift(),k="L",L.push(l,c);break;case"v":c+=b.shift(),k="L",L.push(l,c);break;case"V":c=b.shift(),k="L",L.push(l,c);break;case"C":L.push(b.shift(),b.shift(),b.shift(),b.shift()),l=b.shift(),c=b.shift(),L.push(l,c);break;case"c":L.push(l+b.shift(),c+b.shift(),l+b.shift(),c+b.shift()),l+=b.shift(),c+=b.shift(),k="C",L.push(l,c);break;case"S":N=l,z=c,D=a[a.length-1],D.command==="C"&&(N=l+(l-D.points[2]),z=c+(c-D.points[3])),L.push(N,z,b.shift(),b.shift()),l=b.shift(),c=b.shift(),k="C",L.push(l,c);break;case"s":N=l,z=c,D=a[a.length-1],D.command==="C"&&(N=l+(l-D.points[2]),z=c+(c-D.points[3])),L.push(N,z,l+b.shift(),c+b.shift()),l+=b.shift(),c+=b.shift(),k="C",L.push(l,c);break;case"Q":L.push(b.shift(),b.shift()),l=b.shift(),c=b.shift(),L.push(l,c);break;case"q":L.push(l+b.shift(),c+b.shift()),l+=b.shift(),c+=b.shift(),k="Q",L.push(l,c);break;case"T":N=l,z=c,D=a[a.length-1],D.command==="Q"&&(N=l+(l-D.points[0]),z=c+(c-D.points[1])),l=b.shift(),c=b.shift(),k="Q",L.push(N,z,l,c);break;case"t":N=l,z=c,D=a[a.length-1],D.command==="Q"&&(N=l+(l-D.points[0]),z=c+(c-D.points[1])),l+=b.shift(),c+=b.shift(),k="Q",L.push(N,z,l,c);break;case"A":W=b.shift(),V=b.shift(),q=b.shift(),he=b.shift(),de=b.shift(),ve=l,Ee=c,l=b.shift(),c=b.shift(),k="A",L=this.convertEndpointToCenterParameterization(ve,Ee,l,c,he,de,W,V,q);break;case"a":W=b.shift(),V=b.shift(),q=b.shift(),he=b.shift(),de=b.shift(),ve=l,Ee=c,l+=b.shift(),c+=b.shift(),k="A",L=this.convertEndpointToCenterParameterization(ve,Ee,l,c,he,de,W,V,q);break}a.push({command:k||y,points:L,start:{x:I,y:O},pathLength:this.calcLength(I,O,k||y,L)})}(y==="z"||y==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,c=In;switch(r){case"L":return c.getLineLength(t,n,i[0],i[1]);case"C":for(o=0,a=c.getPointOnCubicBezier(0,t,n,i[0],i[1],i[2],i[3],i[4],i[5]),l=.01;l<=1;l+=.01)s=c.getPointOnCubicBezier(l,t,n,i[0],i[1],i[2],i[3],i[4],i[5]),o+=c.getLineLength(a.x,a.y,s.x,s.y),a=s;return o;case"Q":for(o=0,a=c.getPointOnQuadraticBezier(0,t,n,i[0],i[1],i[2],i[3]),l=.01;l<=1;l+=.01)s=c.getPointOnQuadraticBezier(l,t,n,i[0],i[1],i[2],i[3]),o+=c.getLineLength(a.x,a.y,s.x,s.y),a=s;return o;case"A":o=0;var p=i[4],g=i[5],m=i[4]+g,y=Math.PI/180;if(Math.abs(p-m)m;l-=y)s=c.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=c.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=p+y;l1&&(s*=Math.sqrt(y),l*=Math.sqrt(y));var b=Math.sqrt((s*s*(l*l)-s*s*(m*m)-l*l*(g*g))/(s*s*(m*m)+l*l*(g*g)));o===a&&(b*=-1),isNaN(b)&&(b=0);var S=b*s*m/l,T=b*-l*g/s,E=(t+r)/2+Math.cos(p)*S-Math.sin(p)*T,k=(n+i)/2+Math.sin(p)*S+Math.cos(p)*T,L=function(V){return Math.sqrt(V[0]*V[0]+V[1]*V[1])},I=function(V,q){return(V[0]*q[0]+V[1]*q[1])/(L(V)*L(q))},O=function(V,q){return(V[0]*q[1]=1&&(W=0),a===0&&W>0&&(W=W-2*Math.PI),a===1&&W<0&&(W=W+2*Math.PI),[E,k,s,l,D,W,p,a]}}In.prototype.className="Path";In.prototype._attrsAffectingSize=["data"];hr(In);j.addGetterSetter(In,"data");class rh extends Eu{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var a=this.pointerLength(),s=r.length,l,c;if(o){const m=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],y=In.calcLength(i[i.length-4],i[i.length-3],"C",m),b=In.getPointOnQuadraticBezier(Math.min(1,1-a/y),m[0],m[1],m[2],m[3],m[4],m[5]);l=r[s-2]-b.x,c=r[s-1]-b.y}else l=r[s-2]-r[s-4],c=r[s-1]-r[s-3];var p=(Math.atan2(c,l)+n)%n,g=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(p),t.moveTo(0,0),t.lineTo(-a,g/2),t.lineTo(-a,-g/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],c=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],c=r[3]-r[1]),t.rotate((Math.atan2(-c,-l)+n)%n),t.moveTo(0,0),t.lineTo(-a,g/2),t.lineTo(-a,-g/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}rh.prototype.className="Arrow";hr(rh);j.addGetterSetter(rh,"pointerLength",10,ze());j.addGetterSetter(rh,"pointerWidth",10,ze());j.addGetterSetter(rh,"pointerAtBeginning",!1);j.addGetterSetter(rh,"pointerAtEnding",!0);class V0 extends Ae{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}V0.prototype._centroid=!0;V0.prototype.className="Circle";V0.prototype._attrsAffectingSize=["radius"];hr(V0);j.addGetterSetter(V0,"radius",0,ze());class dd extends Ae{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}dd.prototype.className="Ellipse";dd.prototype._centroid=!0;dd.prototype._attrsAffectingSize=["radiusX","radiusY"];hr(dd);j.addComponentsGetterSetter(dd,"radius",["x","y"]);j.addGetterSetter(dd,"radiusX",0,ze());j.addGetterSetter(dd,"radiusY",0,ze());class Cs extends Ae{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.attrs.image;let o;if(i){const a=this.attrs.cropWidth,s=this.attrs.cropHeight;a&&s?o=[i,this.cropX(),this.cropY(),a,s,0,0,n,r]:o=[i,0,0,n,r]}(this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),i&&t.drawImage.apply(t,o)}_hitFunc(t){var n=this.width(),r=this.height();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=se.createImageElement();i.onload=function(){var o=new Cs({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}}Cs.prototype.className="Image";hr(Cs);j.addGetterSetter(Cs,"image");j.addComponentsGetterSetter(Cs,"crop",["x","y","width","height"]);j.addGetterSetter(Cs,"cropX",0,ze());j.addGetterSetter(Cs,"cropY",0,ze());j.addGetterSetter(Cs,"cropWidth",0,ze());j.addGetterSetter(Cs,"cropHeight",0,ze());var Y$=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],Sbe="Change.konva",wbe="none",S8="up",w8="right",C8="down",_8="left",Cbe=Y$.length;class c_ extends _0{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}oh.prototype.className="RegularPolygon";oh.prototype._centroid=!0;oh.prototype._attrsAffectingSize=["radius"];hr(oh);j.addGetterSetter(oh,"radius",0,ze());j.addGetterSetter(oh,"sides",0,ze());var zA=Math.PI*2;class ah extends Ae{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,zA,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),zA,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}ah.prototype.className="Ring";ah.prototype._centroid=!0;ah.prototype._attrsAffectingSize=["innerRadius","outerRadius"];hr(ah);j.addGetterSetter(ah,"innerRadius",0,ze());j.addGetterSetter(ah,"outerRadius",0,ze());class Tl extends Ae{constructor(t){super(t),this._updated=!0,this.anim=new Aa(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){!this.anim.isRunning()||(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+0],l=o[i+1],c=o[i+2],p=o[i+3],g=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,c,p),t.closePath(),t.fillStrokeShape(this)),g)if(a){var m=a[n],y=r*2;t.drawImage(g,s,l,c,p,m[y+0],m[y+1],c,p)}else t.drawImage(g,s,l,c,p,0,0,c,p)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var c=a[n],p=r*2;t.rect(c[p+0],c[p+1],s,l)}else t.rect(0,0,s,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Py;function WS(){return Py||(Py=se.createCanvasElement().getContext(Ebe),Py)}function zbe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Fbe(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Bbe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class fr extends Ae{constructor(t){super(Bbe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(E+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=se._isString(t)?t:t==null?"":t+"";return this._setAttr(Pbe,n),this}getWidth(){var t=this.attrs.width===vp||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===vp||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return se.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=WS(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Ey+this.fontVariant()+Ey+(this.fontSize()+Ibe)+Dbe(this.fontFamily())}_addTextLine(t){this.align()===gg&&(t=t.trim());var n=this._getTextWidth(t);return this.textArr.push({text:t,width:n,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return WS().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(`
-`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==vp&&o!==void 0,l=a!==vp&&a!==void 0,c=this.padding(),p=o-c*2,g=a-c*2,m=0,y=this.wrap(),b=y!==$A,S=y!==Obe&&b,T=this.ellipsis();this.textArr=[],WS().font=this._getContextFont();for(var E=T?this._getTextWidth(HS):0,k=0,L=t.length;kp)for(;I.length>0;){for(var D=0,N=I.length,z="",W=0;D>>1,q=I.slice(0,V+1),he=this._getTextWidth(q)+E;he<=p?(D=V+1,z=q,W=he):N=V}if(z){if(S){var de,ve=I[z.length],Ee=ve===Ey||ve===FA;Ee&&W<=p?de=z.length:de=Math.max(z.lastIndexOf(Ey),z.lastIndexOf(FA))+1,de>0&&(D=de,z=z.slice(0,D),W=this._getTextWidth(z))}z=z.trimRight(),this._addTextLine(z),r=Math.max(r,W),m+=i;var xe=this._shouldHandleEllipsis(m);if(xe){this._tryToAddEllipsisToLastLine();break}if(I=I.slice(D),I=I.trimLeft(),I.length>0&&(O=this._getTextWidth(I),O<=p)){this._addTextLine(I),m+=i,r=Math.max(r,O);break}}else break}else this._addTextLine(I),m+=i,r=Math.max(r,O),this._shouldHandleEllipsis(m)&&kg)break;this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0)}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==vp&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),c=l!==$A;return!c||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==vp&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+HS)=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;i0&&(s+=t.dataArray[l].pathLength);var c=0;i==="center"&&(c=Math.max(0,s/2-a/2)),i==="right"&&(c=Math.max(0,s-a));for(var p=X$(this.text()),g=this.text().split(" ").length-1,m,y,b,S=-1,T=0,E=function(){T=0;for(var he=t.dataArray,de=S+1;de0)return S=de,he[de];he[de].command==="M"&&(m={x:he[de].points[0],y:he[de].points[1]})}return{}},k=function(he){var de=t._getTextSize(he).width+r;he===" "&&i==="justify"&&(de+=(s-a)/g);var ve=0,Ee=0;for(y=void 0;Math.abs(de-ve)/de>.01&&Ee<20;){Ee++;for(var xe=ve;b===void 0;)b=E(),b&&xe+b.pathLengthde?y=In.getPointOnLine(de,m.x,m.y,b.points[0],b.points[1],m.x,m.y):b=void 0;break;case"A":var U=b.points[4],ee=b.points[5],ae=b.points[4]+ee;T===0?T=U+1e-8:de>ve?T+=Math.PI/180*ee/Math.abs(ee):T-=Math.PI/360*ee/Math.abs(ee),(ee<0&&T=0&&T>ae)&&(T=ae,Z=!0),y=In.getPointOnEllipticalArc(b.points[0],b.points[1],b.points[2],b.points[3],T,b.points[6]);break;case"C":T===0?de>b.pathLength?T=1e-8:T=de/b.pathLength:de>ve?T+=(de-ve)/b.pathLength/2:T=Math.max(T-(ve-de)/b.pathLength/2,0),T>1&&(T=1,Z=!0),y=In.getPointOnCubicBezier(T,b.start.x,b.start.y,b.points[0],b.points[1],b.points[2],b.points[3],b.points[4],b.points[5]);break;case"Q":T===0?T=de/b.pathLength:de>ve?T+=(de-ve)/b.pathLength:T-=(ve-de)/b.pathLength,T>1&&(T=1,Z=!0),y=In.getPointOnQuadraticBezier(T,b.start.x,b.start.y,b.points[0],b.points[1],b.points[2],b.points[3]);break}y!==void 0&&(ve=In.getLineLength(m.x,m.y,y.x,y.y)),Z&&(Z=!1,b=void 0)}},L="C",I=t._getTextSize(L).width+r,O=c/I-1,D=0;De+`.${iH}`).join(" "),HA="nodesRect",Wbe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Vbe={"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 Ube="ontouchstart"in et._global;function Gbe(e,t){if(e==="rotater")return"crosshair";t+=se.degToRad(Vbe[e]||0);var n=(se.radToDeg(t)%360+360)%360;return se._inRange(n,315+22.5,360)||se._inRange(n,0,22.5)?"ns-resize":se._inRange(n,45-22.5,45+22.5)?"nesw-resize":se._inRange(n,90-22.5,90+22.5)?"ew-resize":se._inRange(n,135-22.5,135+22.5)?"nwse-resize":se._inRange(n,180-22.5,180+22.5)?"ns-resize":se._inRange(n,225-22.5,225+22.5)?"nesw-resize":se._inRange(n,270-22.5,270+22.5)?"ew-resize":se._inRange(n,315-22.5,315+22.5)?"nwse-resize":(se.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var z4=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],WA=1e8;function jbe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function oH(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function qbe(e,t){const n=jbe(e);return oH(e,t,n)}function Kbe(e,t,n){let r=t;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},o=r._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");r.on(o,i),r.on(Wbe.map(a=>a+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(HA),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(HA,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const c=(et.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),p={x:a.x+s*Math.cos(c)+l*Math.sin(-c),y:a.y+l*Math.cos(c)+s*Math.sin(c),width:i.width*o.x,height:i.height*o.y,rotation:c};return oH(p,-et.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-WA,y:-WA,width:0,height:0,rotation:0};const n=[];this.nodes().map(c=>{const p=c.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var g=[{x:p.x,y:p.y},{x:p.x+p.width,y:p.y},{x:p.x+p.width,y:p.y+p.height},{x:p.x,y:p.y+p.height}],m=c.getAbsoluteTransform();g.forEach(function(y){var b=m.point(y);n.push(b)})});const r=new Qo;r.rotate(-et.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(c){var p=r.point(c);i===void 0&&(i=a=p.x,o=s=p.y),i=Math.min(i,p.x),o=Math.min(o,p.y),a=Math.max(a,p.x),s=Math.max(s,p.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:et.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(),z4.forEach(function(t){this._createAnchor(t)}.bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new Rv({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Ube?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=et.getAngle(this.rotation()),o=Gbe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new Ae({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*se._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(!!this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(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 a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const c=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(c,l,t)),o.setAbsolutePosition(l);const p=o.getAbsolutePosition();if(!(c.x===p.x&&c.y===p.y)){if(this._movingAnchorName==="rotater"){var g=this._getNodeRect();n=o.x()-g.width/2,r=-o.y()+g.height/2;let he=Math.atan2(-r,n)+Math.PI/2;g.height<0&&(he-=Math.PI);var m=et.getAngle(this.rotation());const de=m+he,ve=et.getAngle(this.rotationSnapTolerance()),xe=Kbe(this.rotationSnaps(),de,ve)-g.rotation,Z=qbe(g,xe);this._fitNodesInto(Z,t);return}var y=this.keepRatio()||t.shiftKey,k=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(y){var b=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(b.x-o.x(),2)+Math.pow(b.y-o.y(),2));var S=this.findOne(".top-left").x()>b.x?-1:1,T=this.findOne(".top-left").y()>b.y?-1:1;n=i*this.cos*S,r=i*this.sin*T,this.findOne(".top-left").x(b.x-n),this.findOne(".top-left").y(b.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(y){var b=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-b.x,2)+Math.pow(b.y-o.y(),2));var S=this.findOne(".top-right").x()b.y?-1:1;n=i*this.cos*S,r=i*this.sin*T,this.findOne(".top-right").x(b.x+n),this.findOne(".top-right").y(b.y-r)}var E=o.position();this.findOne(".top-left").y(E.y),this.findOne(".bottom-right").x(E.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(y){var b=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(b.x-o.x(),2)+Math.pow(o.y()-b.y,2));var S=b.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(se._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(se._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Qo;if(a.rotate(et.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const g=a.point({x:-this.padding()*2,y:0});if(t.x+=g.x,t.y+=g.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const g=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const g=a.point({x:0,y:-this.padding()*2});if(t.x+=g.x,t.y+=g.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const g=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=g.x,this._anchorDragOffset.y-=g.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const g=this.boundBoxFunc()(r,t);g?t=g:se.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Qo;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const c=new Qo;c.translate(t.x,t.y),c.rotate(t.rotation),c.scale(t.width/s,t.height/s);const p=c.multiply(l.invert());this._nodes.forEach(g=>{var m;const y=g.getParent().getAbsoluteTransform(),b=g.getTransform().copy();b.translate(g.offsetX(),g.offsetY());const S=new Qo;S.multiply(y.copy().invert()).multiply(p).multiply(y).multiply(b);const T=S.decompose();g.setAttrs(T),this._fire("transform",{evt:n,target:g}),g._fire("transform",{evt:n,target:g}),(m=g.getLayer())===null||m===void 0||m.batchDraw()}),this.rotation(se._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(se._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();this.find("._anchor").forEach(c=>{c.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*se._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),_0.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Fe.prototype.toObject.call(this)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function Zbe(e){return e instanceof Array||se.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){z4.indexOf(t)===-1&&se.warn("Unknown anchor name: "+t+". Available names are: "+z4.join(", "))}),e||[]}bn.prototype.className="Transformer";hr(bn);j.addGetterSetter(bn,"enabledAnchors",z4,Zbe);j.addGetterSetter(bn,"flipEnabled",!0,ws());j.addGetterSetter(bn,"resizeEnabled",!0);j.addGetterSetter(bn,"anchorSize",10,ze());j.addGetterSetter(bn,"rotateEnabled",!0);j.addGetterSetter(bn,"rotationSnaps",[]);j.addGetterSetter(bn,"rotateAnchorOffset",50,ze());j.addGetterSetter(bn,"rotationSnapTolerance",5,ze());j.addGetterSetter(bn,"borderEnabled",!0);j.addGetterSetter(bn,"anchorStroke","rgb(0, 161, 255)");j.addGetterSetter(bn,"anchorStrokeWidth",1,ze());j.addGetterSetter(bn,"anchorFill","white");j.addGetterSetter(bn,"anchorCornerRadius",0,ze());j.addGetterSetter(bn,"borderStroke","rgb(0, 161, 255)");j.addGetterSetter(bn,"borderStrokeWidth",1,ze());j.addGetterSetter(bn,"borderDash");j.addGetterSetter(bn,"keepRatio",!0);j.addGetterSetter(bn,"centeredScaling",!1);j.addGetterSetter(bn,"ignoreStroke",!1);j.addGetterSetter(bn,"padding",0,ze());j.addGetterSetter(bn,"node");j.addGetterSetter(bn,"nodes");j.addGetterSetter(bn,"boundBoxFunc");j.addGetterSetter(bn,"anchorDragBoundFunc");j.addGetterSetter(bn,"shouldOverdrawWholeArea",!1);j.addGetterSetter(bn,"useSingleNodeRotation",!0);j.backCompat(bn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class Pu extends Ae{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,et.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Pu.prototype.className="Wedge";Pu.prototype._centroid=!0;Pu.prototype._attrsAffectingSize=["radius"];hr(Pu);j.addGetterSetter(Pu,"radius",0,ze());j.addGetterSetter(Pu,"angle",0,ze());j.addGetterSetter(Pu,"clockwise",!1);j.backCompat(Pu,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function VA(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var Ybe=[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],Xbe=[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];function Qbe(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,c,p,g,m,y,b,S,T,E,k,L,I,O,D,N,z,W,V,q,he,de=t+t+1,ve=r-1,Ee=i-1,xe=t+1,Z=xe*(xe+1)/2,U=new VA,ee=null,ae=U,X=null,me=null,ye=Ybe[t],Se=Xbe[t];for(s=1;s>Se,q!==0?(q=255/q,n[p]=(m*ye>>Se)*q,n[p+1]=(y*ye>>Se)*q,n[p+2]=(b*ye>>Se)*q):n[p]=n[p+1]=n[p+2]=0,m-=T,y-=E,b-=k,S-=L,T-=X.r,E-=X.g,k-=X.b,L-=X.a,l=g+((l=o+t+1)>Se,q>0?(q=255/q,n[l]=(m*ye>>Se)*q,n[l+1]=(y*ye>>Se)*q,n[l+2]=(b*ye>>Se)*q):n[l]=n[l+1]=n[l+2]=0,m-=T,y-=E,b-=k,S-=L,T-=X.r,E-=X.g,k-=X.b,L-=X.a,l=o+((l=a+xe)0&&Qbe(t,n)};j.addGetterSetter(Fe,"blurRadius",0,ze(),j.afterSetFilter);const eSe=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};j.addGetterSetter(Fe,"contrast",0,ze(),j.afterSetFilter);const nSe=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,c=e.height,p=l*4,g=c;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:se.error("Unknown emboss direction: "+r)}do{var m=(g-1)*p,y=o;g+y<1&&(y=0),g+y>c&&(y=0);var b=(g-1+y)*l*4,S=l;do{var T=m+(S-1)*4,E=a;S+E<1&&(E=0),S+E>l&&(E=0);var k=b+(S-1+E)*4,L=s[T]-s[k],I=s[T+1]-s[k+1],O=s[T+2]-s[k+2],D=L,N=D>0?D:-D,z=I>0?I:-I,W=O>0?O:-O;if(z>N&&(D=I),W>N&&(D=O),D*=t,i){var V=s[T]+D,q=s[T+1]+D,he=s[T+2]+D;s[T]=V>255?255:V<0?0:V,s[T+1]=q>255?255:q<0?0:q,s[T+2]=he>255?255:he<0?0:he}else{var de=n-D;de<0?de=0:de>255&&(de=255),s[T]=s[T+1]=s[T+2]=de}}while(--S)}while(--g)};j.addGetterSetter(Fe,"embossStrength",.5,ze(),j.afterSetFilter);j.addGetterSetter(Fe,"embossWhiteLevel",.5,ze(),j.afterSetFilter);j.addGetterSetter(Fe,"embossDirection","top-left",null,j.afterSetFilter);j.addGetterSetter(Fe,"embossBlend",!1,null,j.afterSetFilter);function VS(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const rSe=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,c=t[2],p=c,g,m,y=this.enhance();if(y!==0){for(m=0;mi&&(i=o),l=t[m+1],ls&&(s=l),g=t[m+2],gp&&(p=g);i===r&&(i=255,r=0),s===a&&(s=255,a=0),p===c&&(p=255,c=0);var b,S,T,E,k,L,I,O,D;for(y>0?(S=i+y*(255-i),T=r-y*(r-0),k=s+y*(255-s),L=a-y*(a-0),O=p+y*(255-p),D=c-y*(c-0)):(b=(i+r)*.5,S=i+y*(i-b),T=r+y*(r-b),E=(s+a)*.5,k=s+y*(s-E),L=a+y*(a-E),I=(p+c)*.5,O=p+y*(p-I),D=c+y*(c-I)),m=0;mE?T:E;var k=a,L=o,I,O,D=360/L*Math.PI/180,N,z;for(O=0;OL?k:L;var I=a,O=o,D,N,z=n.polarRotation||0,W,V;for(p=0;pt&&(I=L,O=0,D=-1),i=0;i=0&&y=0&&b=0&&y=0&&b=255*4?255:0}return a}function mSe(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&y=0&&b=n))for(o=S;o=r||(a=(n*o+i)*4,s+=I[a+0],l+=I[a+1],c+=I[a+2],p+=I[a+3],L+=1);for(s=s/L,l=l/L,c=c/L,p=p/L,i=y;i=n))for(o=S;o=r||(a=(n*o+i)*4,I[a+0]=s,I[a+1]=l,I[a+2]=c,I[a+3]=p)}};j.addGetterSetter(Fe,"pixelSize",8,ze(),j.afterSetFilter);const bSe=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});j.addGetterSetter(Fe,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});j.addGetterSetter(Fe,"blue",0,T$,j.afterSetFilter);const wSe=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});j.addGetterSetter(Fe,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});j.addGetterSetter(Fe,"blue",0,T$,j.afterSetFilter);j.addGetterSetter(Fe,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});const CSe=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(c=255-c),p>127&&(p=255-p),g>127&&(g=255-g),t[l]=c,t[l+1]=p,t[l+2]=g}while(--s)}while(--o)},kSe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;ite||P[$]!==M[te]){var le=`
-`+P[$].replace(" at new "," at ");return d.displayName&&le.includes("")&&(le=le.replace("",d.displayName)),le}while(1<=$&&0<=te);break}}}finally{Ps=!1,Error.prepareStackTrace=v}return(d=d?d.displayName||d.name:"")?Al(d):""}var dh=Object.prototype.hasOwnProperty,Iu=[],Ts=-1;function Mo(d){return{current:d}}function Cn(d){0>Ts||(d.current=Iu[Ts],Iu[Ts]=null,Ts--)}function gn(d,f){Ts++,Iu[Ts]=d.current,d.current=f}var Ro={},_r=Mo(Ro),Ur=Mo(!1),Oo=Ro;function Ls(d,f){var v=d.type.contextTypes;if(!v)return Ro;var _=d.stateNode;if(_&&_.__reactInternalMemoizedUnmaskedChildContext===f)return _.__reactInternalMemoizedMaskedChildContext;var P={},M;for(M in v)P[M]=f[M];return _&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=f,d.__reactInternalMemoizedMaskedChildContext=P),P}function Gr(d){return d=d.childContextTypes,d!=null}function ja(){Cn(Ur),Cn(_r)}function md(d,f,v){if(_r.current!==Ro)throw Error(a(168));gn(_r,f),gn(Ur,v)}function Ml(d,f,v){var _=d.stateNode;if(f=f.childContextTypes,typeof _.getChildContext!="function")return v;_=_.getChildContext();for(var P in _)if(!(P in f))throw Error(a(108,z(d)||"Unknown",P));return o({},v,_)}function qa(d){return d=(d=d.stateNode)&&d.__reactInternalMemoizedMergedChildContext||Ro,Oo=_r.current,gn(_r,d),gn(Ur,Ur.current),!0}function vd(d,f,v){var _=d.stateNode;if(!_)throw Error(a(169));v?(d=Ml(d,f,Oo),_.__reactInternalMemoizedMergedChildContext=d,Cn(Ur),Cn(_r),gn(_r,d)):Cn(Ur),gn(Ur,v)}var ci=Math.clz32?Math.clz32:yd,fh=Math.log,hh=Math.LN2;function yd(d){return d>>>=0,d===0?32:31-(fh(d)/hh|0)|0}var As=64,so=4194304;function Is(d){switch(d&-d){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return d&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return d}}function Rl(d,f){var v=d.pendingLanes;if(v===0)return 0;var _=0,P=d.suspendedLanes,M=d.pingedLanes,$=v&268435455;if($!==0){var te=$&~P;te!==0?_=Is(te):(M&=$,M!==0&&(_=Is(M)))}else $=v&~P,$!==0?_=Is($):M!==0&&(_=Is(M));if(_===0)return 0;if(f!==0&&f!==_&&(f&P)===0&&(P=_&-_,M=f&-f,P>=M||P===16&&(M&4194240)!==0))return f;if((_&4)!==0&&(_|=v&16),f=d.entangledLanes,f!==0)for(d=d.entanglements,f&=_;0v;v++)f.push(d);return f}function ga(d,f,v){d.pendingLanes|=f,f!==536870912&&(d.suspendedLanes=0,d.pingedLanes=0),d=d.eventTimes,f=31-ci(f),d[f]=v}function bd(d,f){var v=d.pendingLanes&~f;d.pendingLanes=f,d.suspendedLanes=0,d.pingedLanes=0,d.expiredLanes&=f,d.mutableReadLanes&=f,d.entangledLanes&=f,f=d.entanglements;var _=d.eventTimes;for(d=d.expirationTimes;0>=$,P-=$,Wi=1<<32-ci(f)+P|v<zt?(zr=bt,bt=null):zr=bt.sibling;var jt=Ue(ce,bt,pe[zt],$e);if(jt===null){bt===null&&(bt=zr);break}d&&bt&&jt.alternate===null&&f(ce,bt),ie=M(jt,ie,zt),Pt===null?Pe=jt:Pt.sibling=jt,Pt=jt,bt=zr}if(zt===pe.length)return v(ce,bt),Rn&&Ms(ce,zt),Pe;if(bt===null){for(;ztzt?(zr=bt,bt=null):zr=bt.sibling;var ns=Ue(ce,bt,jt.value,$e);if(ns===null){bt===null&&(bt=zr);break}d&&bt&&ns.alternate===null&&f(ce,bt),ie=M(ns,ie,zt),Pt===null?Pe=ns:Pt.sibling=ns,Pt=ns,bt=zr}if(jt.done)return v(ce,bt),Rn&&Ms(ce,zt),Pe;if(bt===null){for(;!jt.done;zt++,jt=pe.next())jt=Et(ce,jt.value,$e),jt!==null&&(ie=M(jt,ie,zt),Pt===null?Pe=jt:Pt.sibling=jt,Pt=jt);return Rn&&Ms(ce,zt),Pe}for(bt=_(ce,bt);!jt.done;zt++,jt=pe.next())jt=Nn(bt,ce,zt,jt.value,$e),jt!==null&&(d&&jt.alternate!==null&&bt.delete(jt.key===null?zt:jt.key),ie=M(jt,ie,zt),Pt===null?Pe=jt:Pt.sibling=jt,Pt=jt);return d&&bt.forEach(function(ii){return f(ce,ii)}),Rn&&Ms(ce,zt),Pe}function Go(ce,ie,pe,$e){if(typeof pe=="object"&&pe!==null&&pe.type===p&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case l:e:{for(var Pe=pe.key,Pt=ie;Pt!==null;){if(Pt.key===Pe){if(Pe=pe.type,Pe===p){if(Pt.tag===7){v(ce,Pt.sibling),ie=P(Pt,pe.props.children),ie.return=ce,ce=ie;break e}}else if(Pt.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===L&&h1(Pe)===Pt.type){v(ce,Pt.sibling),ie=P(Pt,pe.props),ie.ref=ya(ce,Pt,pe),ie.return=ce,ce=ie;break e}v(ce,Pt);break}else f(ce,Pt);Pt=Pt.sibling}pe.type===p?(ie=js(pe.props.children,ce.mode,$e,pe.key),ie.return=ce,ce=ie):($e=Kd(pe.type,pe.key,pe.props,null,ce.mode,$e),$e.ref=ya(ce,ie,pe),$e.return=ce,ce=$e)}return $(ce);case c:e:{for(Pt=pe.key;ie!==null;){if(ie.key===Pt)if(ie.tag===4&&ie.stateNode.containerInfo===pe.containerInfo&&ie.stateNode.implementation===pe.implementation){v(ce,ie.sibling),ie=P(ie,pe.children||[]),ie.return=ce,ce=ie;break e}else{v(ce,ie);break}else f(ce,ie);ie=ie.sibling}ie=qs(pe,ce.mode,$e),ie.return=ce,ce=ie}return $(ce);case L:return Pt=pe._init,Go(ce,ie,Pt(pe._payload),$e)}if(Ee(pe))return _n(ce,ie,pe,$e);if(D(pe))return Xn(ce,ie,pe,$e);Mi(ce,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"?(pe=""+pe,ie!==null&&ie.tag===6?(v(ce,ie.sibling),ie=P(ie,pe),ie.return=ce,ce=ie):(v(ce,ie),ie=ep(pe,ce.mode,$e),ie.return=ce,ce=ie),$(ce)):v(ce,ie)}return Go}var Wu=Uv(!0),Gv=Uv(!1),Id={},fo=Mo(Id),xa=Mo(Id),Q=Mo(Id);function ge(d){if(d===Id)throw Error(a(174));return d}function fe(d,f){gn(Q,f),gn(xa,d),gn(fo,Id),d=Z(f),Cn(fo),gn(fo,d)}function Ve(){Cn(fo),Cn(xa),Cn(Q)}function xt(d){var f=ge(Q.current),v=ge(fo.current);f=U(v,d.type,f),v!==f&&(gn(xa,d),gn(fo,f))}function Xt(d){xa.current===d&&(Cn(fo),Cn(xa))}var At=Mo(0);function an(d){for(var f=d;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Lu(v)||gd(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break;for(;f.sibling===null;){if(f.return===null||f.return===d)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var Md=[];function p1(){for(var d=0;dv?v:4,d(!0);var _=Vu.transition;Vu.transition={};try{d(!1),f()}finally{Bt=v,Vu.transition=_}}function Yu(){return hi().memoizedState}function w1(d,f,v){var _=Lr(d);if(v={lane:_,action:v,hasEagerState:!1,eagerState:null,next:null},Qu(d))Ju(f,v);else if(v=Hu(d,f,v,_),v!==null){var P=ri();go(v,d,_,P),Fd(v,f,_)}}function Xu(d,f,v){var _=Lr(d),P={lane:_,action:v,hasEagerState:!1,eagerState:null,next:null};if(Qu(d))Ju(f,P);else{var M=d.alternate;if(d.lanes===0&&(M===null||M.lanes===0)&&(M=f.lastRenderedReducer,M!==null))try{var $=f.lastRenderedState,te=M($,v);if(P.hasEagerState=!0,P.eagerState=te,H(te,$)){var le=f.interleaved;le===null?(P.next=P,Ld(f)):(P.next=le.next,le.next=P),f.interleaved=P;return}}catch{}finally{}v=Hu(d,f,P,_),v!==null&&(P=ri(),go(v,d,_,P),Fd(v,f,_))}}function Qu(d){var f=d.alternate;return d===mn||f!==null&&f===mn}function Ju(d,f){Rd=Jt=!0;var v=d.pending;v===null?f.next=f:(f.next=v.next,v.next=f),d.pending=f}function Fd(d,f,v){if((v&4194240)!==0){var _=f.lanes;_&=d.pendingLanes,v|=_,f.lanes=v,Ol(d,v)}}var Ya={readContext:Vi,useCallback:Jr,useContext:Jr,useEffect:Jr,useImperativeHandle:Jr,useInsertionEffect:Jr,useLayoutEffect:Jr,useMemo:Jr,useReducer:Jr,useRef:Jr,useState:Jr,useDebugValue:Jr,useDeferredValue:Jr,useTransition:Jr,useMutableSource:Jr,useSyncExternalStore:Jr,useId:Jr,unstable_isNewReconciler:!1},Lx={readContext:Vi,useCallback:function(d,f){return qr().memoizedState=[d,f===void 0?null:f],d},useContext:Vi,useEffect:Kv,useImperativeHandle:function(d,f,v){return v=v!=null?v.concat([d]):null,Fl(4194308,4,gr.bind(null,f,d),v)},useLayoutEffect:function(d,f){return Fl(4194308,4,d,f)},useInsertionEffect:function(d,f){return Fl(4,2,d,f)},useMemo:function(d,f){var v=qr();return f=f===void 0?null:f,d=d(),v.memoizedState=[d,f],d},useReducer:function(d,f,v){var _=qr();return f=v!==void 0?v(f):f,_.memoizedState=_.baseState=f,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:f},_.queue=d,d=d.dispatch=w1.bind(null,mn,d),[_.memoizedState,d]},useRef:function(d){var f=qr();return d={current:d},f.memoizedState=d},useState:qv,useDebugValue:x1,useDeferredValue:function(d){return qr().memoizedState=d},useTransition:function(){var d=qv(!1),f=d[0];return d=S1.bind(null,d[1]),qr().memoizedState=d,[f,d]},useMutableSource:function(){},useSyncExternalStore:function(d,f,v){var _=mn,P=qr();if(Rn){if(v===void 0)throw Error(a(407));v=v()}else{if(v=f(),Dr===null)throw Error(a(349));(zl&30)!==0||y1(_,f,v)}P.memoizedState=v;var M={value:v,getSnapshot:f};return P.queue=M,Kv(Ns.bind(null,_,M,d),[d]),_.flags|=2048,Dd(9,Ku.bind(null,_,M,v,f),void 0,null),v},useId:function(){var d=qr(),f=Dr.identifierPrefix;if(Rn){var v=ma,_=Wi;v=(_&~(1<<32-ci(_)-1)).toString(32)+v,f=":"+f+"R"+v,v=Uu++,0Uh&&(f.flags|=128,_=!0,nc(P,!1),f.lanes=4194304)}else{if(!_)if(d=an(M),d!==null){if(f.flags|=128,_=!0,d=d.updateQueue,d!==null&&(f.updateQueue=d,f.flags|=4),nc(P,!0),P.tail===null&&P.tailMode==="hidden"&&!M.alternate&&!Rn)return ei(f),null}else 2*$n()-P.renderingStartTime>Uh&&v!==1073741824&&(f.flags|=128,_=!0,nc(P,!1),f.lanes=4194304);P.isBackwards?(M.sibling=f.child,f.child=M):(d=P.last,d!==null?d.sibling=M:f.child=M,P.last=M)}return P.tail!==null?(f=P.tail,P.rendering=f,P.tail=f.sibling,P.renderingStartTime=$n(),f.sibling=null,d=At.current,gn(At,_?d&1|2:d&1),f):(ei(f),null);case 22:case 23:return dc(),v=f.memoizedState!==null,d!==null&&d.memoizedState!==null!==v&&(f.flags|=8192),v&&(f.mode&1)!==0?(Gi&1073741824)!==0&&(ei(f),at&&f.subtreeFlags&6&&(f.flags|=8192)):ei(f),null;case 24:return null;case 25:return null}throw Error(a(156,f.tag))}function A1(d,f){switch(u1(f),f.tag){case 1:return Gr(f.type)&&ja(),d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 3:return Ve(),Cn(Ur),Cn(_r),p1(),d=f.flags,(d&65536)!==0&&(d&128)===0?(f.flags=d&-65537|128,f):null;case 5:return Xt(f),null;case 13:if(Cn(At),d=f.memoizedState,d!==null&&d.dehydrated!==null){if(f.alternate===null)throw Error(a(340));Fu()}return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 19:return Cn(At),null;case 4:return Ve(),null;case 10:return Pd(f.type._context),null;case 22:case 23:return dc(),null;case 24:return null;default:return null}}var zs=!1,Er=!1,Nx=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function rc(d,f){var v=d.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(_){Wn(d,f,_)}else v.current=null}function Ho(d,f,v){try{v()}catch(_){Wn(d,f,_)}}var Ih=!1;function $l(d,f){for(ee(d.containerInfo),Ke=f;Ke!==null;)if(d=Ke,f=d.child,(d.subtreeFlags&1028)!==0&&f!==null)f.return=d,Ke=f;else for(;Ke!==null;){d=Ke;try{var v=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var _=v.memoizedProps,P=v.memoizedState,M=d.stateNode,$=M.getSnapshotBeforeUpdate(d.elementType===d.type?_:Do(d.type,_),P);M.__reactInternalSnapshotBeforeUpdate=$}break;case 3:at&&_s(d.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(te){Wn(d,d.return,te)}if(f=d.sibling,f!==null){f.return=d.return,Ke=f;break}Ke=d.return}return v=Ih,Ih=!1,v}function ti(d,f,v){var _=f.updateQueue;if(_=_!==null?_.lastEffect:null,_!==null){var P=_=_.next;do{if((P.tag&d)===d){var M=P.destroy;P.destroy=void 0,M!==void 0&&Ho(f,v,M)}P=P.next}while(P!==_)}}function Mh(d,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&d)===d){var _=v.create;v.destroy=_()}v=v.next}while(v!==f)}}function Rh(d){var f=d.ref;if(f!==null){var v=d.stateNode;switch(d.tag){case 5:d=xe(v);break;default:d=v}typeof f=="function"?f(d):f.current=d}}function I1(d){var f=d.alternate;f!==null&&(d.alternate=null,I1(f)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(f=d.stateNode,f!==null&&it(f)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function ic(d){return d.tag===5||d.tag===3||d.tag===4}function Qa(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||ic(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function Oh(d,f,v){var _=d.tag;if(_===5||_===6)d=d.stateNode,f?Be(v,d,f):Tt(v,d);else if(_!==4&&(d=d.child,d!==null))for(Oh(d,f,v),d=d.sibling;d!==null;)Oh(d,f,v),d=d.sibling}function M1(d,f,v){var _=d.tag;if(_===5||_===6)d=d.stateNode,f?Mn(v,d,f):_e(v,d);else if(_!==4&&(d=d.child,d!==null))for(M1(d,f,v),d=d.sibling;d!==null;)M1(d,f,v),d=d.sibling}var vr=null,Wo=!1;function Vo(d,f,v){for(v=v.child;v!==null;)Pr(d,f,v),v=v.sibling}function Pr(d,f,v){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(on,v)}catch{}switch(v.tag){case 5:Er||rc(v,f);case 6:if(at){var _=vr,P=Wo;vr=null,Vo(d,f,v),vr=_,Wo=P,vr!==null&&(Wo?Qe(vr,v.stateNode):ct(vr,v.stateNode))}else Vo(d,f,v);break;case 18:at&&vr!==null&&(Wo?i1(vr,v.stateNode):r1(vr,v.stateNode));break;case 4:at?(_=vr,P=Wo,vr=v.stateNode.containerInfo,Wo=!0,Vo(d,f,v),vr=_,Wo=P):(Rt&&(_=v.stateNode.containerInfo,P=pa(_),Tu(_,P)),Vo(d,f,v));break;case 0:case 11:case 14:case 15:if(!Er&&(_=v.updateQueue,_!==null&&(_=_.lastEffect,_!==null))){P=_=_.next;do{var M=P,$=M.destroy;M=M.tag,$!==void 0&&((M&2)!==0||(M&4)!==0)&&Ho(v,f,$),P=P.next}while(P!==_)}Vo(d,f,v);break;case 1:if(!Er&&(rc(v,f),_=v.stateNode,typeof _.componentWillUnmount=="function"))try{_.props=v.memoizedProps,_.state=v.memoizedState,_.componentWillUnmount()}catch(te){Wn(v,f,te)}Vo(d,f,v);break;case 21:Vo(d,f,v);break;case 22:v.mode&1?(Er=(_=Er)||v.memoizedState!==null,Vo(d,f,v),Er=_):Vo(d,f,v);break;default:Vo(d,f,v)}}function Nh(d){var f=d.updateQueue;if(f!==null){d.updateQueue=null;var v=d.stateNode;v===null&&(v=d.stateNode=new Nx),f.forEach(function(_){var P=f2.bind(null,d,_);v.has(_)||(v.add(_),_.then(P,P))})}}function ho(d,f){var v=f.deletions;if(v!==null)for(var _=0;_";case Bh:return":has("+(N1(d)||"")+")";case $h:return'[role="'+d.value+'"]';case Hh:return'"'+d.value+'"';case oc:return'[data-testname="'+d.value+'"]';default:throw Error(a(365))}}function ac(d,f){var v=[];d=[d,0];for(var _=0;_