@inweb/viewer-three 26.3.3 → 26.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/viewer-three.js +149 -171
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +1 -1
- package/dist/viewer-three.module.js +10 -10
- package/dist/viewer-three.module.js.map +1 -1
- package/package.json +5 -5
package/dist/viewer-three.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ODA=t.ODA||{},t.ODA.Three=t.ODA.Three||{}))}(this,(function(t){"use strict";class e{constructor(){this._commands=new Map}registerCommand(t,e,n,i){this._commands.set(t,{id:t,handler:e,thisArg:i,description:n})}registerCommandAlias(t,e){this.registerCommand(e,((e,...n)=>this.executeCommand(t,e,...n)))}getCommand(t){return this._commands.get(t)}getCommands(){const t=new Map;return this._commands.forEach(((e,n)=>t.set(n,e))),t}executeCommand(t,e,...n){const i=this._commands.get(t);if(!i){if(e){if(e.draggers.includes(t))return e.setActiveDragger(t)}return void console.warn(`Command '${t}' not found`)}const{handler:r,thisArg:s}=i,a=r.apply(s,[e,...n]);return null==e||e.emit({type:"command",data:t,args:n}),a}}const n=new Map;function i(t=""){let i=n.get(t);return i||(i=new e,n.set(t,i)),i}class r{constructor(){this._draggers=new Map}registerDragger(t,e){this._draggers.set(t,e)}registerDraggerAlias(t,e){const n=this.getDragger(t);n&&this.registerDragger(e,(t=>n(t)))}getDragger(t){return this._draggers.get(t)}getDraggers(){const t=new Map;return this._draggers.forEach(((e,n)=>t.set(n,e))),t}createDragger(t,e){const n=this.getDragger(t);if(!n)return null;const i=n(e);return i.name=t,i}}const s=new Map;function a(t=""){let e=s.get(t);return e||(e=new r,s.set(t,e)),e}class o{constructor(){this._components=new Map}registerComponent(t,e){this._components.set(t,e)}registerComponentAlias(t,e){const n=this.getComponent(t);n&&this.registerComponent(e,(t=>n(t)))}getComponent(t){return this._components.get(t)}getComponents(){const t=new Map;return this._components.forEach(((e,n)=>t.set(n,e))),t}createComponent(t,e){const n=this.getComponent(t);if(!n)return null;const i=n(e);return i.name=t,i}}const l=new Map;function h(t=""){let e=l.get(t);return e||(e=new o,l.set(t,e)),e}function c(){return{showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0,geometryType:"vsfx",rulerUnit:"Default"}}class d{constructor(t){this._emitter=t,this._data={showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0,geometryType:"vsfx",rulerUnit:"Default"},this.loadFromStorage()}static defaults(){return{showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0,geometryType:"vsfx",rulerUnit:"Default"}}notifierChangeEvent(){console.warn("Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead."),this.change()}change(){void 0!==this._emitter&&(this.saveToStorage(),this._emitter.emit({type:"optionschange",data:this}))}saveToStorage(){if("undefined"!=typeof window)try{localStorage.setItem("od-client-settings",JSON.stringify(this.data))}catch(t){console.error("Cannot save client settings.",t)}}loadFromStorage(){if("undefined"!=typeof window)try{const t=localStorage.getItem("od-client-settings");if(t){const e=JSON.parse(t);this.data={...e}}}catch(t){console.error("Cannot load client settings.",t)}}resetToDefaults(t){if(void 0!==t){const e=d.defaults(),n=t.reduce(((t,n)=>(t[n]=e[n],t)),{});this.data={...this.data,...n}}else this.data={...this.data,...d.defaults()}}get data(){return this._data}set data(t){const e=!!t.enableStreamingMode&&t.enablePartialMode,n=!e&&t.sceneGraph;this._data={...d.defaults(),...this._data,...t,enablePartialMode:e,sceneGraph:n},this.change()}get showWCS(){return this._data.showWCS}set showWCS(t){this._data.showWCS=t,this.change()}get cameraAnimation(){return this._data.cameraAnimation}set cameraAnimation(t){this._data.cameraAnimation=t,this.change()}get antialiasing(){return this._data.antialiasing}set antialiasing(t){this._data.antialiasing=t,this.change()}get groundShadow(){return this._data.groundShadow}set groundShadow(t){this._data.groundShadow=t,this.change()}get shadows(){return this._data.shadows}set shadows(t){this._data.shadows=t,this.change()}get cameraAxisXSpeed(){return this._data.cameraAxisXSpeed}set cameraAxisXSpeed(t){this._data.cameraAxisXSpeed=t,this.change()}get cameraAxisYSpeed(){return this._data.cameraAxisYSpeed}set cameraAxisYSpeed(t){this.cameraAxisYSpeed=t,this.change()}get ambientOcclusion(){return this._data.ambientOcclusion}set ambientOcclusion(t){this._data.ambientOcclusion=t,this.change()}get enableStreamingMode(){return this._data.enableStreamingMode}set enableStreamingMode(t){this._data.enableStreamingMode=t,t||(this._data.enablePartialMode=!1),this.change()}get enablePartialMode(){return this._data.enablePartialMode}set enablePartialMode(t){this._data.enablePartialMode=t,t&&(this._data.enableStreamingMode=!0,this._data.sceneGraph=!1),this.change()}get memoryLimit(){return this._data.memoryLimit}set memoryLimit(t){this._data.memoryLimit=t,this.change()}get cuttingPlaneFillColor(){return this._data.cuttingPlaneFillColor}set cuttingPlaneFillColor(t){this._data.cuttingPlaneFillColor=t,this.change()}get edgesColor(){return this._data.edgesColor}set edgesColor(t){this._data.edgesColor=t,this.change()}get facesColor(){return this._data.facesColor}set facesColor(t){this._data.facesColor=t,this.change()}get edgesVisibility(){return this._data.edgesVisibility}set edgesVisibility(t){this._data.edgesVisibility=t,this.change()}get edgesOverlap(){return this._data.edgesOverlap}set edgesOverlap(t){this._data.edgesOverlap=t,this.change()}get facesOverlap(){return this._data.facesOverlap}set facesOverlap(t){this._data.facesOverlap=t,this.change()}get facesTransparancy(){return this._data.facesTransparancy}set facesTransparancy(t){this._data.facesTransparancy=t,this.change()}get enableCustomHighlight(){return this._data.enableCustomHighlight}set enableCustomHighlight(t){this._data.enableCustomHighlight=t,this.change()}get sceneGraph(){return this._data.sceneGraph}set sceneGraph(t){this._data.sceneGraph=t,t&&(this._data.enablePartialMode=!1),this.change()}get edgeModel(){return Boolean(this._data.edgeModel)}set edgeModel(t){this._data.edgeModel=Boolean(t),this.change()}get reverseZoomWheel(){return this._data.reverseZoomWheel}set reverseZoomWheel(t){this._data.reverseZoomWheel=!!t,this.change()}get enableZoomWheel(){return this._data.enableZoomWheel}set enableZoomWheel(t){this._data.enableZoomWheel=!!t,this.change()}get enableGestures(){return this._data.enableGestures}set enableGestures(t){this._data.enableGestures=!!t,this.change()}get geometryType(){return this._data.geometryType}set geometryType(t){this._data.geometryType=t,this.change()}get rulerUnit(){return this._data.rulerUnit}set rulerUnit(t){this._data.rulerUnit=t,this.change()}}const u=["click","contextmenu","dblclick","mousedown","mouseleave","mousemove","mouseup","pointercancel","pointerdown","pointerleave","pointermove","pointerup","touchcancel","touchend","touchmove","touchstart","wheel"],p=u;var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var g,_={exports:{}},v={},y={},x={};function S(){return g||(g=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const e=Math.PI/180;t.glob=void 0!==f?f:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},t.Konva={_global:t.glob,version:"9.3.20",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle:n=>t.Konva.angleDeg?n*e:n,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)}(x)),x}var b,M={};function w(){return b||(b=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=S();class n{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}translate(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this}scale(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.m[0]*e+this.m[2]*n,r=this.m[1]*e+this.m[3]*n,s=this.m[0]*-n+this.m[2]*e,a=this.m[1]*-n+this.m[3]*e;return this.m[0]=i,this.m[1]=r,this.m[2]=s,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){const n=this.m[0]+this.m[2]*e,i=this.m[1]+this.m[3]*e,r=this.m[2]+this.m[0]*t,s=this.m[3]+this.m[1]*t;return this.m[0]=n,this.m[1]=i,this.m[2]=r,this.m[3]=s,this}multiply(t){const e=this.m[0]*t.m[0]+this.m[2]*t.m[1],n=this.m[1]*t.m[0]+this.m[3]*t.m[1],i=this.m[0]*t.m[2]+this.m[2]*t.m[3],r=this.m[1]*t.m[2]+this.m[3]*t.m[3],s=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=s,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,n=-this.m[1]*t,i=-this.m[2]*t,r=this.m[0]*t,s=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=s,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const e=this.m[0],n=this.m[1],i=this.m[2],r=this.m[3],s=e*r-n*i,a={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=n){const t=Math.sqrt(e*e+n*n);a.rotation=n>0?Math.acos(e/t):-Math.acos(e/t),a.scaleX=t,a.scaleY=s/t,a.skewX=(e*i+n*r)/s,a.skewY=0}else if(0!=i||0!=r){const t=Math.sqrt(i*i+r*r);a.rotation=Math.PI/2-(r>0?Math.acos(-i/t):-Math.acos(i/t)),a.scaleX=s/t,a.scaleY=t,a.skewX=0,a.skewY=(e*i+n*r)/s}return a.rotation=t.Util._getRotation(a.rotation),a}}t.Transform=n;const i=Math.PI/180,r=180/Math.PI,s="Konva error: ",a={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]},o=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let l=[];const h="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(t){setTimeout(t,60)};t.Util={_isElement:t=>!(!t||1!=t.nodeType),_isFunction:t=>!!(t&&t.constructor&&t.call&&t.apply),_isPlainObject:t=>!!t&&t.constructor===Object,_isArray:t=>"[object Array]"===Object.prototype.toString.call(t),_isNumber:t=>"[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)&&isFinite(t),_isString:t=>"[object String]"===Object.prototype.toString.call(t),_isBoolean:t=>"[object Boolean]"===Object.prototype.toString.call(t),isObject:t=>t instanceof Object,isValidSelector(t){if("string"!=typeof t)return!1;const e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:t=>0===t||t>0?1:-1,requestAnimFrame(t){l.push(t),1===l.length&&h((function(){const t=l;l=[],t.forEach((function(t){t()}))}))},createCanvasElement(){const t=document.createElement("canvas");try{t.style=t.style||{}}catch(t){}return t},createImageElement:()=>document.createElement("img"),_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(e,n){const i=t.Util.createImageElement();i.onload=function(){n(i)},i.src=e},_rgbToHex:(t,e,n)=>((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1),_hexToRgb(t){t=t.replace("#","");const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor(){let t=(16777215*Math.random()|0).toString(16);for(;t.length<6;)t="0"+t;return"#"+t},getRGB(t){let e;return t in a?(e=a[t],{r:e[0],g:e[1],b:e[2]}):"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?(e=o.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA: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(t){const e=a[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(0===t.indexOf("rgb(")){const e=(t=t.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(0===t.indexOf("rgba(")){const e=(t=t.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((t,e)=>"%"===t.slice(-1)?3===e?parseInt(t)/100:parseInt(t)/100*255:Number(t)));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if("#"===t[0]&&9===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if("#"===t[0]&&7===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if("#"===t[0]&&5===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if("#"===t[0]&&4===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),i=Number(n[0])/360,r=Number(n[1])/100,s=Number(n[2])/100;let a,o,l;if(0===r)return l=255*s,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};a=s<.5?s*(1+r):s+r-s*r;const h=2*s-a,c=[0,0,0];for(let t=0;t<3;t++)o=i+1/3*-(t-1),o<0&&o++,o>1&&o--,l=6*o<1?h+6*(a-h)*o:2*o<1?a:3*o<2?h+(a-h)*(2/3-o)*6:h,c[t]=255*l;return{r:Math.round(c[0]),g:Math.round(c[1]),b:Math.round(c[2]),a:1}}},haveIntersection:(t,e)=>!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y),cloneObject(t){const e={};for(const n in t)this._isPlainObject(t[n])?e[n]=this.cloneObject(t[n]):this._isArray(t[n])?e[n]=this.cloneArray(t[n]):e[n]=t[n];return e},cloneArray:t=>t.slice(0),degToRad:t=>t*i,radToDeg:t=>t*r,_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:n=>e.Konva.angleDeg?t.Util.radToDeg(n):n,_capitalize:t=>t.charAt(0).toUpperCase()+t.slice(1),throw(t){throw new Error(s+t)},error(t){console.error(s+t)},warn(t){e.Konva.showWarnings&&console.warn("Konva warning: "+t)},each(t,e){for(const n in t)e(n,t[n])},_inRange:(t,e,n)=>e<=t&&t<n,_getProjectionToSegment(t,e,n,i,r,s){let a,o,l;const h=(t-n)*(t-n)+(e-i)*(e-i);if(0==h)a=t,o=e,l=(r-n)*(r-n)+(s-i)*(s-i);else{const c=((r-t)*(n-t)+(s-e)*(i-e))/h;c<0?(a=t,o=e,l=(t-r)*(t-r)+(e-s)*(e-s)):c>1?(a=n,o=i,l=(n-r)*(n-r)+(i-s)*(i-s)):(a=t+c*(n-t),o=e+c*(i-e),l=(a-r)*(a-r)+(o-s)*(o-s))}return[a,o,l]},_getProjectionToLine(e,n,i){const r=t.Util.cloneObject(e);let s=Number.MAX_VALUE;return n.forEach((function(a,o){if(!i&&o===n.length-1)return;const l=n[(o+1)%n.length],h=t.Util._getProjectionToSegment(a.x,a.y,l.x,l.y,e.x,e.y),c=h[0],d=h[1],u=h[2];u<s&&(r.x=c,r.y=d,s=u)})),r},_prepareArrayForTween(e,n,i){const r=[],s=[];if(e.length>n.length){const t=n;n=e,e=t}for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});for(let t=0;t<n.length;t+=2)s.push({x:n[t],y:n[t+1]});const a=[];return s.forEach((function(e){const n=t.Util._getProjectionToLine(e,r,i);a.push(n.x),a.push(n.y)})),a},_prepareToStringify(e){let n;e.visitedByCircularReferenceRemoval=!0;for(const i in e)if(e.hasOwnProperty(i)&&e[i]&&"object"==typeof e[i])if(n=Object.getOwnPropertyDescriptor(e,i),e[i].visitedByCircularReferenceRemoval||t.Util._isElement(e[i])){if(!n.configurable)return null;delete e[i]}else if(null===t.Util._prepareToStringify(e[i])){if(!n.configurable)return null;delete e[i]}return delete e.visitedByCircularReferenceRemoval,e},_assign(t,e){for(const n in e)t[n]=e[n];return t},_getFirstPointerId:t=>t.touches?t.changedTouches[0].identifier:t.pointerId||999,releaseCanvas(...t){e.Konva.releaseCanvasOnDestroy&&t.forEach((t=>{t.width=0,t.height=0}))},drawRoundedRectPath(t,e,n,i){let r=0,s=0,a=0,o=0;"number"==typeof i?r=s=a=o=Math.min(i,e/2,n/2):(r=Math.min(i[0]||0,e/2,n/2),s=Math.min(i[1]||0,e/2,n/2),o=Math.min(i[2]||0,e/2,n/2),a=Math.min(i[3]||0,e/2,n/2)),t.moveTo(r,0),t.lineTo(e-s,0),t.arc(e-s,s,s,3*Math.PI/2,0,!1),t.lineTo(e,n-o),t.arc(e-o,n-o,o,0,Math.PI/2,!1),t.lineTo(a,n),t.arc(a,n-a,a,Math.PI/2,Math.PI,!1),t.lineTo(0,r),t.arc(r,r,r,Math.PI,3*Math.PI/2,!1)}}}(M)),M}var E,T,A={},C={},R={};function P(){if(E)return R;E=1,Object.defineProperty(R,"__esModule",{value:!0}),R.RGBComponent=function(t){if(t>255)return 255;if(t<0)return 0;return Math.round(t)},R.alphaComponent=function(t){if(t>1)return 1;if(t<1e-4)return 1e-4;return t},R.getNumberValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isNumber(t)||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a number.'),t}},R.getNumberOrArrayOfNumbersValidator=function(i){if(t.Konva.isUnminified)return function(t,r){let s=e.Util._isNumber(t),a=e.Util._isArray(t)&&t.length==i;return s||a||e.Util.warn(n(t)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array<number>('+i+")"),t}},R.getNumberOrAutoValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isNumber(t)||"auto"===t||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a number or "auto".'),t}},R.getStringValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isString(t)||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a string.'),t}},R.getStringOrGradientValidator=function(){if(t.Konva.isUnminified)return function(t,i){const r=e.Util._isString(t),s="[object CanvasGradient]"===Object.prototype.toString.call(t)||t&&t.addColorStop;return r||s||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a string or a native gradient.'),t}},R.getFunctionValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isFunction(t)||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a function.'),t}},R.getNumberArrayValidator=function(){if(t.Konva.isUnminified)return function(t,i){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&t instanceof r||(e.Util._isArray(t)?t.forEach((function(t){e.Util._isNumber(t)||e.Util.warn('"'+i+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")})):e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a array of numbers.')),t}},R.getBooleanValidator=function(){if(t.Konva.isUnminified)return function(t,i){return!0===t||!1===t||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a boolean.'),t}},R.getComponentValidator=function(i){if(t.Konva.isUnminified)return function(t,r){return null==t||e.Util.isObject(t)||e.Util.warn(n(t)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+i),t}};const t=S(),e=w();function n(t){return e.Util._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)||e.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}return R}function L(){return T||(T=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const e=w(),n=P(),i="get",r="set";t.Factory={addGetterSetter(e,n,i,r,s){t.Factory.addGetter(e,n,i),t.Factory.addSetter(e,n,r,s),t.Factory.addOverloadedGetterSetter(e,n)},addGetter(t,n,r){var s=i+e.Util._capitalize(n);t.prototype[s]=t.prototype[s]||function(){const t=this.attrs[n];return void 0===t?r:t}},addSetter(n,i,s,a){var o=r+e.Util._capitalize(i);n.prototype[o]||t.Factory.overWriteSetter(n,i,s,a)},overWriteSetter(t,n,i,s){var a=r+e.Util._capitalize(n);t.prototype[a]=function(t){return i&&null!=t&&(t=i.call(this,t,n)),this._setAttr(n,t),s&&s.call(this),this}},addComponentsGetterSetter(s,a,o,l,h){const c=o.length,d=e.Util._capitalize,u=i+d(a),p=r+d(a);s.prototype[u]=function(){const t={};for(let e=0;e<c;e++){const n=o[e];t[n]=this.getAttr(a+d(n))}return t};const f=(0,n.getComponentValidator)(o);s.prototype[p]=function(t){const e=this.attrs[a];l&&(t=l.call(this,t,a)),f&&f.call(this,t,a);for(const e in t)t.hasOwnProperty(e)&&this._setAttr(a+d(e),t[e]);return t||o.forEach((t=>{this._setAttr(a+d(t),void 0)})),this._fireChangeEvent(a,e,t),h&&h.call(this),this},t.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(t,n){var s=e.Util._capitalize(n),a=r+s,o=i+s;t.prototype[n]=function(){return arguments.length?(this[a](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(n,r,s,a){e.Util.error("Adding deprecated "+r);const o=i+e.Util._capitalize(r),l=r+" property is deprecated and will be removed soon. Look at Konva change log for more information.";n.prototype[o]=function(){e.Util.error(l);const t=this.attrs[r];return void 0===t?s:t},t.Factory.addSetter(n,r,a,(function(){e.Util.error(l)})),t.Factory.addOverloadedGetterSetter(n,r)},backCompat(t,n){e.Util.each(n,(function(n,s){const a=t.prototype[s],o=i+e.Util._capitalize(n),l=r+e.Util._capitalize(n);function h(){a.apply(this,arguments),e.Util.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+s+'" instead.')}t.prototype[n]=h,t.prototype[o]=h,t.prototype[l]=h}))},afterSetFilter(){this._filterUpToDate=!1}}}(C)),C}var I,D,N={},U={};function O(){if(I)return U;I=1,Object.defineProperty(U,"__esModule",{value:!0}),U.HitContext=U.SceneContext=U.Context=void 0;const t=w(),e=S();const n=["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"];let i=class{constructor(t){this.canvas=t,e.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(e,n){let i,r,s,a,o=this.traceArr,l=o.length,h="";for(i=0;i<l;i++)r=o[i],s=r.method,s?(a=r.args,h+=s,e?h+="()":t.Util._isArray(a[0])?h+="(["+a.join(",")+"])":(n&&(a=a.map((t=>"number"==typeof t?Math.floor(t):t))),h+="("+a.join(",")+")")):(h+=r.property,e||(h+="="+r.val)),h+=";";return h}clearTrace(){this.traceArr=[]}_trace(t){let e,n=this.traceArr;n.push(t),e=n.length,e>=100&&n.shift()}reset(){const t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){const e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){const e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,n,i,r,s){this._context.arc(t,e,n,i,r,s)}arcTo(t,e,n,i,r){this._context.arcTo(t,e,n,i,r)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,n,i,r,s){this._context.bezierCurveTo(t,e,n,i,r,s)}clearRect(t,e,n,i){this._context.clearRect(t,e,n,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){const n=arguments;return 2===n.length?this._context.createImageData(t,e):1===n.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,n,i){return this._context.createLinearGradient(t,e,n,i)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,n,i,r,s){return this._context.createRadialGradient(t,e,n,i,r,s)}drawImage(t,e,n,i,r,s,a,o,l){const h=arguments,c=this._context;3===h.length?c.drawImage(t,e,n):5===h.length?c.drawImage(t,e,n,i,r):9===h.length&&c.drawImage(t,e,n,i,r,s,a,o,l)}ellipse(t,e,n,i,r,s,a,o){this._context.ellipse(t,e,n,i,r,s,a,o)}isPointInPath(t,e,n,i){return n?this._context.isPointInPath(n,t,e,i):this._context.isPointInPath(t,e,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,n,i){this._context.fillRect(t,e,n,i)}strokeRect(t,e,n,i){this._context.strokeRect(t,e,n,i)}fillText(t,e,n,i){i?this._context.fillText(t,e,n,i):this._context.fillText(t,e,n)}measureText(t){return this._context.measureText(t)}getImageData(t,e,n,i){return this._context.getImageData(t,e,n,i)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,n,i){this._context.rect(t,e,n,i)}roundRect(t,e,n,i,r){this._context.roundRect(t,e,n,i,r)}putImageData(t,e,n){this._context.putImageData(t,e,n)}quadraticCurveTo(t,e,n,i){this._context.quadraticCurveTo(t,e,n,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,n,i,r,s){this._context.setTransform(t,e,n,i,r,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,n,i){this._context.strokeText(t,e,n,i)}transform(t,e,n,i,r,s){this._context.transform(t,e,n,i,r,s)}translate(t,e){this._context.translate(t,e)}_enableTrace(){let e,i,r=this,s=n.length,a=this.setAttr;const o=function(e){let n,s=r[e];r[e]=function(){return i=function(e){const n=[],i=e.length,r=t.Util;for(let t=0;t<i;t++){let i=e[t];r._isNumber(i)?i=Math.round(1e3*i)/1e3:r._isString(i)||(i+=""),n.push(i)}return n}(Array.prototype.slice.call(arguments,0)),n=s.apply(r,arguments),r._trace({method:e,args:i}),n}};for(e=0;e<s;e++)o(n[e]);r.setAttr=function(){a.apply(r,arguments);const t=arguments[0];let e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),r._trace({property:t,val:e})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;!e||"source-over"===e||this.setAttr("globalCompositeOperation",e)}};U.Context=i,["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(t){Object.defineProperty(i.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})}));U.SceneContext=class extends i{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){const e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){const e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),n=t.getFillPriority();if(e&&"color"===n)return void this._fillColor(t);const i=t.getFillPatternImage();if(i&&"pattern"===n)return void this._fillPattern(t);const r=t.getFillLinearGradientColorStops();if(r&&"linear-gradient"===n)return void this._fillLinearGradient(t);const s=t.getFillRadialGradientColorStops();s&&"radial-gradient"===n?this._fillRadialGradient(t):e?this._fillColor(t):i?this._fillPattern(t):r?this._fillLinearGradient(t):s&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),n=t.getStrokeLinearGradientEndPoint(),i=t.getStrokeLinearGradientColorStops(),r=this.createLinearGradient(e.x,e.y,n.x,n.y);if(i){for(let t=0;t<i.length;t+=2)r.addColorStop(i[t],i[t+1]);this.setAttr("strokeStyle",r)}}_stroke(t){const e=t.dash(),n=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!n){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),n||this.restore()}}_applyShadow(t){var e,n,i;const r=null!==(e=t.getShadowRGBA())&&void 0!==e?e:"black",s=null!==(n=t.getShadowBlur())&&void 0!==n?n:5,a=null!==(i=t.getShadowOffset())&&void 0!==i?i:{x:0,y:0},o=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),h=o.x*l,c=o.y*l;this.setAttr("shadowColor",r),this.setAttr("shadowBlur",s*Math.min(Math.abs(h),Math.abs(c))),this.setAttr("shadowOffsetX",a.x*h),this.setAttr("shadowOffsetY",a.y*c)}};return U.HitContext=class extends i{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const e=t.getStrokeScaleEnabled();if(!e){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t);const n=t.hitStrokeWidth(),i="auto"===n?t.strokeWidth():n;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}}},U}function F(){if(D)return N;D=1,Object.defineProperty(N,"__esModule",{value:!0}),N.HitCanvas=N.SceneCanvas=N.Canvas=void 0;const t=w(),e=O(),n=S();let i;let r=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const r=(e||{}).pixelRatio||n.Konva.pixelRatio||function(){if(i)return i;const e=t.Util.createCanvasElement(),r=e.getContext("2d");return i=(n.Konva._global.devicePixelRatio||1)/(r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1),t.Util.releaseCanvas(e),i}();this.pixelRatio=r,this._canvas=t.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){const e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch(e){try{return this._canvas.toDataURL()}catch(e){return t.Util.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}};N.Canvas=r;N.SceneCanvas=class extends r{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new e.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}};return N.HitCanvas=class extends r{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new e.HitContext(this),this.setSize(t.width,t.height)}},N}var k,B,z={};function G(){return k||(k=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DD=void 0;const e=S(),n=w();t.DD={get isDragging(){let e=!1;return t.DD._dragElements.forEach((t=>{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){let e;return t.DD._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const i=[];t.DD._dragElements.forEach(((t,r)=>{const{node:s}=t,a=s.getStage();a.setPointersPositions(e),void 0===t.pointerId&&(t.pointerId=n.Util._getFirstPointerId(e));const o=a._changedPointerPositions.find((e=>e.id===t.pointerId));if(o){if("dragging"!==t.dragStatus){const n=s.dragDistance();if(Math.max(Math.abs(o.x-t.startPointerPos.x),Math.abs(o.y-t.startPointerPos.y))<n)return;if(s.startDrag({evt:e}),!s.isDragging())return}s._setDragPosition(e,t),i.push(s)}})),i.forEach((t=>{t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(n){const i=[];t.DD._dragElements.forEach((r=>{const{node:s}=r,a=s.getStage();n&&a.setPointersPositions(n);if(!a._changedPointerPositions.find((t=>t.id===r.pointerId)))return;"dragging"!==r.dragStatus&&"stopped"!==r.dragStatus||(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,r.dragStatus="stopped");const o=r.node.getLayer()||r.node instanceof e.Konva.Stage&&r.node;o&&-1===i.indexOf(o)&&i.push(o)})),i.forEach((t=>{t.draw()}))},_endDragAfter(e){t.DD._dragElements.forEach(((n,i)=>{"stopped"===n.dragStatus&&n.node.fire("dragend",{type:"dragend",target:n.node,evt:e},!0),"dragging"!==n.dragStatus&&t.DD._dragElements.delete(i)}))}},e.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",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),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))}(z)),z}function H(){if(B)return A;B=1,Object.defineProperty(A,"__esModule",{value:!0}),A.Node=void 0;const t=w(),e=L(),n=F(),i=S(),r=G(),s=P(),a="absoluteOpacity",o="allEventListeners",l="absoluteTransform",h="absoluteScale",c="canvas",d="listening",u="mouseenter",p="mouseleave",f="Shape",m=" ",g="stage",_="transform",v="visible",y=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(m);let x=1,b=class e{constructor(t){this._id=x++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){t!==_&&t!==l||!this._cache.get(t)?t?this._cache.delete(t):this._cache.clear():this._cache.get(t).dirty=!0}_getCache(t,e){let n=this._cache.get(t);return(void 0===n||(t===_||t===l)&&!0===n.dirty)&&(n=e.call(this),this._cache.set(t,n)),n}_calculate(t,e,n){if(!this._attachedDepsListeners.get(t)){const n=e.map((t=>t+"Change.konva")).join(m);this.on(n,(()=>{this._clearCache(t)})),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,n)}_getCanvasCache(){return this._cache.get(c)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===l&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(c)){const{scene:e,filter:n,hit:i}=this._cache.get(c);t.Util.releaseCanvas(e,n,i),this._cache.delete(c)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const i=e||{};let r={};void 0!==i.x&&void 0!==i.y&&void 0!==i.width&&void 0!==i.height||(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let s=Math.ceil(i.width||r.width),o=Math.ceil(i.height||r.height),l=i.pixelRatio,d=void 0===i.x?Math.floor(r.x):i.x,u=void 0===i.y?Math.floor(r.y):i.y,p=i.offset||0,f=i.drawBorder||!1,m=i.hitCanvasPixelRatio||1;if(!s||!o)return void t.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");s+=2*p+(Math.abs(Math.round(r.x)-d)>.5?1:0),o+=2*p+(Math.abs(Math.round(r.y)-u)>.5?1:0),d-=p,u-=p;const g=new n.SceneCanvas({pixelRatio:l,width:s,height:o}),_=new n.SceneCanvas({pixelRatio:l,width:0,height:0,willReadFrequently:!0}),v=new n.HitCanvas({pixelRatio:m,width:s,height:o}),y=g.getContext(),x=v.getContext();return v.isCache=!0,g.isCache=!0,this._cache.delete(c),this._filterUpToDate=!1,!1===i.imageSmoothingEnabled&&(g.getContext()._context.imageSmoothingEnabled=!1,_.getContext()._context.imageSmoothingEnabled=!1),y.save(),x.save(),y.translate(-d,-u),x.translate(-d,-u),this._isUnderCache=!0,this._clearSelfAndDescendantCache(a),this._clearSelfAndDescendantCache(h),this.drawScene(g,this),this.drawHit(v,this),this._isUnderCache=!1,y.restore(),x.restore(),f&&(y.save(),y.beginPath(),y.rect(0,0,s,o),y.closePath(),y.setAttr("strokeStyle","red"),y.setAttr("lineWidth",5),y.stroke(),y.restore()),this._cache.set(c,{scene:g,filter:_,hit:v,x:d,y:u}),this._requestDraw(),this}isCached(){return this._cache.has(c)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){const n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let i=1/0,r=1/0,s=-1/0,a=-1/0;const o=this.getAbsoluteTransform(e);return n.forEach((function(t){const e=o.point(t);void 0===i&&(i=s=e.x,r=a=e.y),i=Math.min(i,e.x),r=Math.min(r,e.y),s=Math.max(s,e.x),a=Math.max(a,e.y)})),{x:i,y:r,width:s-i,height:a-r}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);const n=this._getCachedSceneCanvas(),i=n.pixelRatio;t.drawImage(n._canvas,0,0,n.width/i,n.height/i),t.restore()}_drawCachedHitCanvas(t){const e=this._getCanvasCache(),n=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),t.restore()}_getCachedSceneCanvas(){let e,n,i,r,s=this.filters(),a=this._getCanvasCache(),o=a.scene,l=a.filter,h=l.getContext();if(s){if(!this._filterUpToDate){const a=o.pixelRatio;l.setSize(o.width/o.pixelRatio,o.height/o.pixelRatio);try{for(e=s.length,h.clear(),h.drawImage(o._canvas,0,0,o.getWidth()/a,o.getHeight()/a),n=h.getImageData(0,0,l.getWidth(),l.getHeight()),i=0;i<e;i++)r=s[i],"function"==typeof r?(r.call(this,n),h.putImageData(n,0,0)):t.Util.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(e){t.Util.error("Unable to apply filter. "+e.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return l}return o}on(t,e){if(this._cache&&this._cache.delete(o),3===arguments.length)return this._delegate.apply(this,arguments);let n,i,r,s,a,l=t.split(m),h=l.length;for(n=0;n<h;n++)i=l[n],r=i.split("."),s=r[0],a=r[1]||"",this.eventListeners[s]||(this.eventListeners[s]=[]),this.eventListeners[s].push({name:a,handler:e});return this}off(t,e){let n,i,r,s,a,l,h=(t||"").split(m),c=h.length;if(this._cache&&this._cache.delete(o),!t)for(i in this.eventListeners)this._off(i);for(n=0;n<c;n++)if(r=h[n],s=r.split("."),a=s[0],l=s[1],a)this.eventListeners[a]&&this._off(a,l,e);else for(i in this.eventListeners)this._off(i,l,e);return this}dispatchEvent(t){const e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,(function(t){e.call(this,t.evt)})),this}removeEventListener(t){return this.off(t),this}_delegate(e,n,i){const r=this;this.on(e,(function(e){const s=e.target.findAncestors(n,!0,r);for(let n=0;n<s.length;n++)(e=t.Util.cloneObject(e)).currentTarget=s[n],i.call(s[n],e)}))}remove(){return this.isDragging()&&this.stopDrag(),r.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(l),this._clearSelfAndDescendantCache(a),this._clearSelfAndDescendantCache(h),this._clearSelfAndDescendantCache(g),this._clearSelfAndDescendantCache(v),this._clearSelfAndDescendantCache(d)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){const n="get"+t.Util._capitalize(e);return t.Util._isFunction(this[n])?this[n]():this.attrs[e]}getAncestors(){let t=this.getParent(),e=[];for(;t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges((()=>{let n,i;if(!e)return this;for(n in e)"children"!==n&&(i="set"+t.Util._capitalize(n),t.Util._isFunction(this[i])?this[i](e[n]):this._setAttr(n,e[n]))})),this}isListening(){return this._getCache(d,this._isListening)}_isListening(t){if(!this.listening())return!1;const e=this.getParent();return!e||e===t||this===t||e._isListening(t)}isVisible(){return this._getCache(v,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const e=this.getParent();return!e||e===t||this===t||e._isVisible(t)}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);const n=this.getLayer();let s=!1;r.DD._dragElements.forEach((t=>{"dragging"===t.dragStatus&&("Stage"===t.node.nodeType||t.node.getLayer()===n)&&(s=!0)}));const a=!e&&!i.Konva.hitOnDragEnabled&&(s||i.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t,e,n,i,r=this.getDepth(),s=this,a=0;const o=this.getStage();return"Stage"!==s.nodeType&&o&&function o(l){for(t=[],e=l.length,n=0;n<e;n++)i=l[n],a++,i.nodeType!==f&&(t=t.concat(i.getChildren().slice())),i._id===s._id&&(n=e);t.length>0&&t[0].getDepth()<=r&&o(t)}(o.getChildren()),a}getDepth(){let t=0,e=this.parent;for(;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(_),this._clearSelfAndDescendantCache(l)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges((()=>{this.x(t.x),this.y(t.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const e=t.getPointerPosition();if(!e)return null;const n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(e){let n=!1,i=this.parent;for(;i;){if(i.isCached()){n=!0;break}i=i.parent}n&&!e&&(e=!0);const r=this.getAbsoluteTransform(e).getMatrix(),s=new t.Transform,a=this.offset();return s.m=r.slice(),s.translate(a.x,a.y),s.getTranslation()}setAbsolutePosition(t){const{x:e,y:n,...i}=this._clearTransform();this.attrs.x=e,this.attrs.y=n,this._clearCache(_);const r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(i),this.setPosition({x:t.x,y:t.y}),this._clearCache(_),this._clearSelfAndDescendantCache(l),this}_setTransform(t){let e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let e=t.x,n=t.y,i=this.x(),r=this.y();return void 0!==e&&(i+=e),void 0!==n&&(r+=n),this.setPosition({x:i,y:r}),this}_eachAncestorReverse(t,e){let n,i,r=[],s=this.getParent();if(!e||e._id!==this._id){for(r.unshift(this);s&&(!e||s._id!==e._id);)r.unshift(s),s=s.parent;for(n=r.length,i=0;i<n;i++)t(r[i])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return t.Util.warn("Node has no parent. moveToTop function is ignored."),!1;const e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return t.Util.warn("Node has no parent. moveUp function is ignored."),!1;const e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return t.Util.warn("Node has no parent. moveDown function is ignored."),!1;const e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return t.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const 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 t.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&t.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)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(a,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let e,n,i,r,s,a=this.getAttrs();const o={attrs:{},className:this.getClassName()};for(e in a)n=a[e],s=t.Util.isObject(n)&&!t.Util._isPlainObject(n)&&!t.Util._isArray(n),s||(i="function"==typeof this[e]&&this[e],delete a[e],r=i?i.call(this):null,a[e]=n,r!==n&&(o.attrs[e]=n));return t.Util._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,n){const i=[];e&&this._isMatch(t)&&i.push(this);let r=this.parent;for(;r;){if(r===n)return i;r._isMatch(t)&&i.push(r),r=r.parent}return i}isAncestorOf(t){return!1}findAncestor(t,e,n){return this.findAncestors(t,e,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);let n,i,r=e.replace(/ /g,"").split(","),s=r.length;for(n=0;n<s;n++)if(i=r[n],t.Util.isValidSelector(i)||(t.Util.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),t.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),t.Util.warn("Konva is awesome, right?")),"#"===i.charAt(0)){if(this.id()===i.slice(1))return!0}else if("."===i.charAt(0)){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(g,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,e={},n){return e.target=e.target||this,n?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(l,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let n;if(e)return n=new t.Transform,this._eachAncestorReverse((function(t){const e=t.transformsEnabled();"all"===e?n.multiply(t.getTransform()):"position"===e&&n.translate(t.x()-t.offsetX(),t.y()-t.offsetY())}),e),n;{n=this._cache.get(l)||new t.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const e=this.transformsEnabled();if("all"===e)n.multiply(this.getTransform());else if("position"===e){const t=this.attrs.x||0,e=this.attrs.y||0,i=this.attrs.offsetX||0,r=this.attrs.offsetY||0;n.translate(t-i,e-r)}return n.dirty=!1,n}}getAbsoluteScale(t){let e=this;for(;e;)e._isUnderCache&&(t=e),e=e.getParent();const n=this.getAbsoluteTransform(t).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(_,this._getTransform)}_getTransform(){var e,n;const r=this._cache.get(_)||new t.Transform;r.reset();const s=this.x(),a=this.y(),o=i.Konva.getAngle(this.rotation()),l=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,h=null!==(n=this.attrs.scaleY)&&void 0!==n?n:1,c=this.attrs.skewX||0,d=this.attrs.skewY||0,u=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return 0===s&&0===a||r.translate(s,a),0!==o&&r.rotate(o),0===c&&0===d||r.skew(c,d),1===l&&1===h||r.scale(l,h),0===u&&0===p||r.translate(-1*u,-1*p),r.dirty=!1,r}clone(e){let n,i,r,s,a,o=t.Util.cloneObject(this.attrs);for(n in e)o[n]=e[n];const l=new this.constructor(o);for(n in this.eventListeners)for(i=this.eventListeners[n],r=i.length,s=0;s<r;s++)a=i[s],a.name.indexOf("konva")<0&&(l.eventListeners[n]||(l.eventListeners[n]=[]),l.eventListeners[n].push(a));return l}_toKonvaCanvas(t){t=t||{};const e=this.getClientRect(),i=this.getStage(),r=void 0!==t.x?t.x:Math.floor(e.x),s=void 0!==t.y?t.y:Math.floor(e.y),a=t.pixelRatio||1,o=new n.SceneCanvas({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:a}),l=o.getContext(),h=new n.SceneCanvas({width:o.width/o.pixelRatio+Math.abs(r),height:o.height/o.pixelRatio+Math.abs(s),pixelRatio:o.pixelRatio});return!1===t.imageSmoothingEnabled&&(l._context.imageSmoothingEnabled=!1),l.save(),(r||s)&&l.translate(-1*r,-1*s),this.drawScene(o,void 0,h),l.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){const e=(t=t||{}).mimeType||null,n=t.quality||null,i=this._toKonvaCanvas(t).toDataURL(e,n);return t.callback&&t.callback(i),i}toImage(e){return new Promise(((n,i)=>{try{const i=null==e?void 0:e.callback;i&&delete e.callback,t.Util._urlToImage(this.toDataURL(e),(function(t){n(t),null==i||i(t)}))}catch(t){i(t)}}))}toBlob(t){return new Promise(((e,n)=>{try{const n=null==t?void 0:t.callback;n&&delete t.callback,this.toCanvas(t).toBlob((t=>{e(t),null==n||n(t)}),null==t?void 0:t.mimeType,null==t?void 0:t.quality)}catch(t){n(t)}}))}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():i.Konva.dragDistance}_off(t,e,n){let i,r,s,a=this.eventListeners[t];for(i=0;i<a.length;i++)if(r=a[i].name,s=a[i].handler,!("konva"===r&&"konva"!==e||e&&r!==e||n&&n!==s)){if(a.splice(i,1),0===a.length){delete this.eventListeners[t];break}i--}}_fireChangeEvent(t,e,n){this._fire(t+"Change",{oldVal:e,newVal:n})}addName(t){if(!this.hasName(t)){const e=this.name(),n=e?e+" "+t:t;this.name(n)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;return-1!==(e||"").split(/\s/g).indexOf(t)}removeName(t){const e=(this.name()||"").split(/\s/g),n=e.indexOf(t);return-1!==n&&(e.splice(n,1),this.name(e.join(" "))),this}setAttr(e,n){const i=this["set"+t.Util._capitalize(e)];return t.Util._isFunction(i)?i.call(this,n):this._setAttr(e,n),this}_requestDraw(){if(i.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();null==t||t.batchDraw()}}_setAttr(e,n){const i=this.attrs[e];(i!==n||t.Util.isObject(n))&&(null==n?delete this.attrs[e]:this.attrs[e]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(e,i,n),this._requestDraw())}_setComponentAttr(t,e,n){let i;void 0!==n&&(i=this.attrs[t],i||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=n,this._fireChangeEvent(t,i,n))}_fireAndBubble(t,e,n){e&&this.nodeType===f&&(e.target=this);if(!((t===u||t===p)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||"Stage"===this.nodeType&&!n))){this._fire(t,e);const i=(t===u||t===p)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!i&&(n&&n.parent?this._fireAndBubble.call(this.parent,t,e,n):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,n,i;const r=null!==(e=this._cache.get(o))&&void 0!==e?e:{};let s=null==r?void 0:r[t];if(void 0===s){s=[];let e=Object.getPrototypeOf(this);for(;e;){const r=null!==(i=null===(n=e.eventListeners)||void 0===n?void 0:n[t])&&void 0!==i?i:[];s.push(...r),e=Object.getPrototypeOf(e)}r[t]=s,this._cache.set(o,r)}return s}_fire(t,e){(e=e||{}).currentTarget=this,e.type=t;const n=this._getProtoListeners(t);if(n)for(var i=0;i<n.length;i++)n[i].handler.call(this,e);const r=this.eventListeners[t];if(r)for(i=0;i<r.length;i++)r[i].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const e=t?t.pointerId:void 0,n=this.getStage(),i=this.getAbsolutePosition();if(!n)return;const s=n._getPointerById(e)||n._changedPointerPositions[0]||i;r.DD._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-i.x,y:s.y-i.y},dragStatus:"ready",pointerId:e})}startDrag(t,e=!0){r.DD._dragElements.has(this._id)||this._createDragElement(t);r.DD._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(e,n){const i=this.getStage()._getPointerById(n.pointerId);if(!i)return;let r={x:i.x-n.offset.x,y:i.y-n.offset.y};const s=this.dragBoundFunc();if(void 0!==s){const n=s.call(this,r,e);n?r=n:t.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}stopDrag(t){const e=r.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),r.DD._endDragBefore(t),r.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=r.DD._dragElements.get(this._id);return!!t&&"dragging"===t.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(t){if(!(!(void 0!==t.evt.button)||i.Konva.dragButtons.indexOf(t.evt.button)>=0))return;if(this.isDragging())return;let e=!1;r.DD._dragElements.forEach((t=>{this.isAncestorOf(t.node)&&(e=!0)})),e||this._createDragElement(t)}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();if(!this.getStage())return;const t=r.DD._dragElements.get(this._id),e=t&&"dragging"===t.dragStatus,n=t&&"ready"===t.dragStatus;e?this.stopDrag():n&&r.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const i={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return t.Util.haveIntersection(i,this.getClientRect())}static create(e,n){return t.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(n,r){let s,a,o,l=e.prototype.getClassName.call(n),h=n.children;r&&(n.attrs.container=r),i.Konva[l]||(t.Util.warn('Can not find a node with class name "'+l+'". Fallback to "Shape".'),l="Shape");if(s=new(0,i.Konva[l])(n.attrs),h)for(a=h.length,o=0;o<a;o++)s.add(e._createNode(h[o]));return s}};A.Node=b,b.prototype.nodeType="Node",b.prototype._attrsAffectingSize=[],b.prototype.eventListeners={},b.prototype.on.call(b.prototype,y,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(_),this._clearSelfAndDescendantCache(l))})),b.prototype.on.call(b.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(v)})),b.prototype.on.call(b.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(d)})),b.prototype.on.call(b.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(a)}));const M=e.Factory.addGetterSetter;return M(b,"zIndex"),M(b,"absolutePosition"),M(b,"position"),M(b,"x",0,(0,s.getNumberValidator)()),M(b,"y",0,(0,s.getNumberValidator)()),M(b,"globalCompositeOperation","source-over",(0,s.getStringValidator)()),M(b,"opacity",1,(0,s.getNumberValidator)()),M(b,"name","",(0,s.getStringValidator)()),M(b,"id","",(0,s.getStringValidator)()),M(b,"rotation",0,(0,s.getNumberValidator)()),e.Factory.addComponentsGetterSetter(b,"scale",["x","y"]),M(b,"scaleX",1,(0,s.getNumberValidator)()),M(b,"scaleY",1,(0,s.getNumberValidator)()),e.Factory.addComponentsGetterSetter(b,"skew",["x","y"]),M(b,"skewX",0,(0,s.getNumberValidator)()),M(b,"skewY",0,(0,s.getNumberValidator)()),e.Factory.addComponentsGetterSetter(b,"offset",["x","y"]),M(b,"offsetX",0,(0,s.getNumberValidator)()),M(b,"offsetY",0,(0,s.getNumberValidator)()),M(b,"dragDistance",void 0,(0,s.getNumberValidator)()),M(b,"width",0,(0,s.getNumberValidator)()),M(b,"height",0,(0,s.getNumberValidator)()),M(b,"listening",!0,(0,s.getBooleanValidator)()),M(b,"preventDefault",!0,(0,s.getBooleanValidator)()),M(b,"filters",void 0,(function(t){return this._filterUpToDate=!1,t})),M(b,"visible",!0,(0,s.getBooleanValidator)()),M(b,"transformsEnabled","all",(0,s.getStringValidator)()),M(b,"size"),M(b,"dragBoundFunc"),M(b,"draggable",!1,(0,s.getBooleanValidator)()),e.Factory.backCompat(b,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"}),A}var V,W={};function X(){if(V)return W;V=1,Object.defineProperty(W,"__esModule",{value:!0}),W.Container=void 0;const t=L(),e=H(),n=P();let i=class extends e.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[],n=[];return e.forEach((function(e){t(e)&&n.push(e)})),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.destroy()})),this.children=[],this._requestDraw(),this}add(...t){if(0===t.length)return this;if(t.length>1){for(let e=0;e<t.length;e++)this.add(t[e]);return this}const e=t[0];return e.getParent()?(e.moveTo(this),this):(this._validateAdd(e),e.index=this.getChildren().length,e.parent=this,e._clearCaches(),this.getChildren().push(e),this._fire("add",{child:e}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){const e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){const n=[];return this._descendants((i=>{const r=i._isMatch(t);return r&&n.push(i),!(!r||!e)})),n}_descendants(t){let e=!1;const n=this.getChildren();for(const i of n){if(e=t(i),e)return!0;if(i.hasChildren()&&(e=i._descendants(t),e))return!0}return!1}toObject(){const t=e.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach((e=>{t.children.push(e.toObject())})),t}isAncestorOf(t){let e=t.getParent();for(;e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){const n=e.Node.prototype.clone.call(this,t);return this.getChildren().forEach((function(t){n.add(t.clone())})),n}getAllIntersections(t){const e=[];return this.find("Shape").forEach((n=>{n.isVisible()&&n.intersects(t)&&e.push(n)})),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null===(e=this.children)||void 0===e||e.forEach((function(e){e._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;null===(t=this.children)||void 0===t||t.forEach((function(t,e){t.index=e})),this._requestDraw()}drawScene(t,e,n){const i=this.getLayer(),r=t||i&&i.getCanvas(),s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,l=r&&r.isCache;if(!this.isVisible()&&!l)return this;if(o){s.save();const t=this.getAbsoluteTransform(e).getMatrix();s.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",r,e,n);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;const n=this.getLayer(),i=t||n&&n.hitCanvas,r=i&&i.getContext(),s=this._getCanvasCache();if(s&&s.hit){r.save();const t=this.getAbsoluteTransform(e).getMatrix();r.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(r),r.restore()}else this._drawChildren("drawHit",i,e);return this}_drawChildren(t,e,n,i){var r;const s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),l=this.clipFunc(),h="number"==typeof a&&"number"==typeof o||l,c=n===this;if(h){s.save();const t=this.getAbsoluteTransform(n);let e,i=t.getMatrix();if(s.transform(i[0],i[1],i[2],i[3],i[4],i[5]),s.beginPath(),l)e=l.call(this,s,this);else{const t=this.clipX(),e=this.clipY();s.rect(t||0,e||0,a,o)}s.clip.apply(s,e),i=t.copy().invert().getMatrix(),s.transform(i[0],i[1],i[2],i[3],i[4],i[5])}const d=!c&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;d&&(s.save(),s._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[t](e,n,i)})),d&&s.restore(),h&&s.restore()}getClientRect(t={}){var e;const n=t.skipTransform,i=t.relativeTo;let r,s,a,o,l={x:1/0,y:1/0,width:0,height:0};const h=this;null===(e=this.children)||void 0===e||e.forEach((function(e){if(!e.visible())return;const n=e.getClientRect({relativeTo:h,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===n.width&&0===n.height||(void 0===r?(r=n.x,s=n.y,a=n.x+n.width,o=n.y+n.height):(r=Math.min(r,n.x),s=Math.min(s,n.y),a=Math.max(a,n.x+n.width),o=Math.max(o,n.y+n.height)))}));const c=this.find("Shape");let d=!1;for(let t=0;t<c.length;t++){if(c[t]._isVisible(this)){d=!0;break}}return l=d&&void 0!==r?{x:r,y:s,width:a-r,height:o-s}:{x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,i)}};return W.Container=i,t.Factory.addComponentsGetterSetter(i,"clip",["x","y","width","height"]),t.Factory.addGetterSetter(i,"clipX",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipY",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipWidth",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipHeight",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipFunc"),W}var j,Y,q={},K={};function Z(){if(j)return K;j=1,Object.defineProperty(K,"__esModule",{value:!0}),K.getCapturedShape=function(t){return e.get(t)},K.createEvent=i,K.hasPointerCapture=function(t,n){return e.get(t)===n},K.setPointerCapture=function(t,s){r(t);if(!s.getStage())return;e.set(t,s),n&&s._fire("gotpointercapture",i(new PointerEvent("gotpointercapture")))},K.releaseCapture=r;const t=S(),e=new Map,n=void 0!==t.Konva._global.PointerEvent;function i(t){return{evt:t,pointerId:t.pointerId}}function r(t,r){const s=e.get(t);if(!s)return;const a=s.getStage();a&&a.content,e.delete(t),n&&s._fire("lostpointercapture",i(new PointerEvent("lostpointercapture")))}return K}var Q,J,$={},tt={};function et(){return Q||(Q=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=S(),n=w(),i=L(),r=H(),s=P(),a=S(),o=Z(),l="hasShadow",h="shadowRGBA",c="patternImage",d="linearGradient",u="radialGradient";let p;function f(){return p||(p=n.Util.createCanvasElement().getContext("2d"),p)}t.shapes={};class m extends r.Node{constructor(e){let i;for(super(e);i=n.Util.getRandomColor(),!i||i in t.shapes;);this.colorKey=i,t.shapes[i]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.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(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const t=f().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(t&&t.setTransform){const i=new n.Transform;i.translate(this.fillPatternX(),this.fillPatternY()),i.rotate(e.Konva.getAngle(this.fillPatternRotation())),i.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),i.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const r=i.getMatrix(),s="undefined"==typeof DOMMatrix?{a:r[0],b:r[1],c:r[2],d:r[3],e:r[4],f:r[5]}:new DOMMatrix(r);t.setTransform(s)}return t}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){const t=this.fillLinearGradientColorStops();if(t){const e=f(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),r=e.createLinearGradient(n.x,n.y,i.x,i.y);for(let e=0;e<t.length;e+=2)r.addColorStop(t[e],t[e+1]);return r}}_getRadialGradient(){return this._getCache(u,this.__getRadialGradient)}__getRadialGradient(){const t=this.fillRadialGradientColorStops();if(t){const e=f(),n=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),r=e.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let e=0;e<t.length;e+=2)r.addColorStop(t[e],t[e+1]);return r}}getShadowRGBA(){return this._getCache(h,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const t=n.Util.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){const e=this.getStage();if(!e)return!1;const n=e.bufferHitCanvas;n.getContext().clear(),this.drawHit(n,void 0,!0);return n.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!(null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e))return!1;const n=t||this.hasFill(),i=this.hasStroke(),r=1!==this.getAbsoluteOpacity();if(n&&i&&r)return!0;const s=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(n&&i&&s&&a)}setStrokeHitEnabled(t){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,n=this.getParent();for(;n;){if(n.isCached()){e=!0;break}n=n.getParent()}const i=t.skipTransform,r=t.relativeTo||e&&this.getStage()||void 0,s=this.getSelfRect(),a=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=s.width+a,l=s.height+a,h=!t.skipShadow&&this.hasShadow(),c=h?this.shadowOffsetX():0,d=h?this.shadowOffsetY():0,u=o+Math.abs(c),p=l+Math.abs(d),f=h&&this.shadowBlur()||0,m={width:u+2*f,height:p+2*f,x:-(a/2+f)+Math.min(c,0)+s.x,y:-(a/2+f)+Math.min(d,0)+s.y};return i?m:this._transformedRect(m,r)}drawScene(t,e,n){const i=this.getLayer();let r,s,a=t||i.getCanvas(),o=a.getContext(),l=this._getCanvasCache(),h=this.getSceneFunc(),c=this.hasShadow();const d=a.isCache,u=e===this;if(!this.isVisible()&&!u)return this;if(l){o.save();const t=this.getAbsoluteTransform(e).getMatrix();return o.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!h)return this;if(o.save(),this._useBufferCanvas()&&!d){r=this.getStage();const t=n||r.bufferCanvas;s=t.getContext(),s.clear(),s.save(),s._applyLineJoin(this);var p=this.getAbsoluteTransform(e).getMatrix();s.transform(p[0],p[1],p[2],p[3],p[4],p[5]),h.call(this,s,this),s.restore();const i=t.pixelRatio;c&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(t._canvas,0,0,t.width/i,t.height/i)}else{if(o._applyLineJoin(this),!u){p=this.getAbsoluteTransform(e).getMatrix();o.transform(p[0],p[1],p[2],p[3],p[4],p[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}c&&o._applyShadow(this),h.call(this,o,this)}return o.restore(),this}drawHit(t,e,i=!1){if(!this.shouldDrawHit(e,i))return this;const r=this.getLayer(),s=t||r.hitCanvas,a=s&&s.getContext(),o=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),h=l&&l.hit;if(this.colorKey||n.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()"),h){a.save();const t=this.getAbsoluteTransform(e).getMatrix();return a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!o)return this;a.save(),a._applyLineJoin(this);if(!(this===e)){const t=this.getAbsoluteTransform(e).getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return o.call(this,a,this),a.restore(),this}drawHitFromCache(t=0){const e=this._getCanvasCache(),i=this._getCachedSceneCanvas(),r=e.hit,s=r.getContext(),a=r.getWidth(),o=r.getHeight();s.clear(),s.drawImage(i._canvas,0,0,a,o);try{const e=s.getImageData(0,0,a,o),i=e.data,r=i.length,l=n.Util._hexToRgb(this.colorKey);for(let e=0;e<r;e+=4){i[e+3]>t?(i[e]=l.r,i[e+1]=l.g,i[e+2]=l.b,i[e+3]=255):i[e+3]=0}s.putImageData(e,0,0)}catch(t){n.Util.error("Unable to draw hit graph from cached scene canvas. "+t.message)}return this}hasPointerCapture(t){return o.hasPointerCapture(t,this)}setPointerCapture(t){o.setPointerCapture(t,this)}releaseCapture(t){o.releaseCapture(t,this)}}t.Shape=m,m.prototype._fillFunc=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},m.prototype._strokeFunc=function(t){t.stroke()},m.prototype._fillFuncHit=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},m.prototype._strokeFuncHit=function(t){t.stroke()},m.prototype._centroid=!1,m.prototype.nodeType="Shape",(0,a._registerNode)(m),m.prototype.eventListeners={},m.prototype.on.call(m.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(l)})),m.prototype.on.call(m.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(h)})),m.prototype.on.call(m.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(c)})),m.prototype.on.call(m.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(d)})),m.prototype.on.call(m.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(u)})),i.Factory.addGetterSetter(m,"stroke",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(m,"strokeWidth",2,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillAfterStrokeEnabled",!1),i.Factory.addGetterSetter(m,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),i.Factory.addGetterSetter(m,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(m,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(m,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(m,"lineJoin"),i.Factory.addGetterSetter(m,"lineCap"),i.Factory.addGetterSetter(m,"sceneFunc"),i.Factory.addGetterSetter(m,"hitFunc"),i.Factory.addGetterSetter(m,"dash"),i.Factory.addGetterSetter(m,"dashOffset",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"shadowColor",void 0,(0,s.getStringValidator)()),i.Factory.addGetterSetter(m,"shadowBlur",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"shadowOpacity",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(m,"shadowOffset",["x","y"]),i.Factory.addGetterSetter(m,"shadowOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"shadowOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternImage"),i.Factory.addGetterSetter(m,"fill",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(m,"fillPatternX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillLinearGradientColorStops"),i.Factory.addGetterSetter(m,"strokeLinearGradientColorStops"),i.Factory.addGetterSetter(m,"fillRadialGradientStartRadius",0),i.Factory.addGetterSetter(m,"fillRadialGradientEndRadius",0),i.Factory.addGetterSetter(m,"fillRadialGradientColorStops"),i.Factory.addGetterSetter(m,"fillPatternRepeat","repeat"),i.Factory.addGetterSetter(m,"fillEnabled",!0),i.Factory.addGetterSetter(m,"strokeEnabled",!0),i.Factory.addGetterSetter(m,"shadowEnabled",!0),i.Factory.addGetterSetter(m,"dashEnabled",!0),i.Factory.addGetterSetter(m,"strokeScaleEnabled",!0),i.Factory.addGetterSetter(m,"fillPriority","color"),i.Factory.addComponentsGetterSetter(m,"fillPatternOffset",["x","y"]),i.Factory.addGetterSetter(m,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(m,"fillPatternScale",["x","y"]),i.Factory.addGetterSetter(m,"fillPatternScaleX",1,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternScaleY",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(m,"fillLinearGradientStartPoint",["x","y"]),i.Factory.addComponentsGetterSetter(m,"strokeLinearGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillLinearGradientStartPointX",0),i.Factory.addGetterSetter(m,"strokeLinearGradientStartPointX",0),i.Factory.addGetterSetter(m,"fillLinearGradientStartPointY",0),i.Factory.addGetterSetter(m,"strokeLinearGradientStartPointY",0),i.Factory.addComponentsGetterSetter(m,"fillLinearGradientEndPoint",["x","y"]),i.Factory.addComponentsGetterSetter(m,"strokeLinearGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillLinearGradientEndPointX",0),i.Factory.addGetterSetter(m,"strokeLinearGradientEndPointX",0),i.Factory.addGetterSetter(m,"fillLinearGradientEndPointY",0),i.Factory.addGetterSetter(m,"strokeLinearGradientEndPointY",0),i.Factory.addComponentsGetterSetter(m,"fillRadialGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillRadialGradientStartPointX",0),i.Factory.addGetterSetter(m,"fillRadialGradientStartPointY",0),i.Factory.addComponentsGetterSetter(m,"fillRadialGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillRadialGradientEndPointX",0),i.Factory.addGetterSetter(m,"fillRadialGradientEndPointY",0),i.Factory.addGetterSetter(m,"fillPatternRotation",0),i.Factory.addGetterSetter(m,"fillRule",void 0,(0,s.getStringValidator)()),i.Factory.backCompat(m,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})}(tt)),tt}function nt(){if(J)return $;J=1,Object.defineProperty($,"__esModule",{value:!0}),$.Layer=void 0;const t=w(),e=X(),n=H(),i=L(),r=F(),s=P(),a=et(),o=S(),l=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],h=l.length;let c=class extends e.Container{constructor(t){super(t),this.canvas=new r.SceneCanvas,this.hitCanvas=new r.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){n.Node.prototype.moveToTop.call(this);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!n.Node.prototype.moveUp.call(this))return!1;const t=this.getStage();return!(!t||!t.content)&&(t.content.removeChild(this.getNativeCanvasElement()),this.index<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[this.index+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(n.Node.prototype.moveDown.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(n.Node.prototype.moveToBottom.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return n.Node.prototype.remove.call(this),e&&e.parentNode&&t.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(e){const n=e.getType();"Group"!==n&&"Shape"!==n&&t.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return(t=t||{}).width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=void 0!==t.x?t.x:this.x(),t.y=void 0!==t.y?t.y:this.y(),n.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){const t=this.visible();this.canvas._canvas.style.display=t?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){t.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){t.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,t.Util.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;let e=1,n=!1;for(;;){for(let i=0;i<h;i++){const r=l[i],s=this._getIntersection({x:t.x+r.x*e,y:t.y+r.y*e}),a=s.shape;if(a)return a;if(n=!!s.antialiased,!s.antialiased)break}if(!n)return null;e+=1}}_getIntersection(e){const n=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,r=i[3];if(255===r){const e=t.Util._rgbToHex(i[0],i[1],i[2]),n=a.shapes["#"+e];return n?{shape:n}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(t,n){const i=this.getLayer(),r=t||i&&i.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),e.Container.prototype.drawScene.call(this,r,n),this._fire("draw",{node:this}),this}drawHit(t,n){const i=this.getLayer(),r=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),e.Container.prototype.drawHit.call(this,r,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const t=this.parent;!!this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}destroy(){return t.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};return $.Layer=c,c.prototype.nodeType="Layer",(0,o._registerNode)(c),i.Factory.addGetterSetter(c,"imageSmoothingEnabled",!0),i.Factory.addGetterSetter(c,"clearBeforeDraw",!0),i.Factory.addGetterSetter(c,"hitGraphEnabled",!0,(0,s.getBooleanValidator)()),$}var it,rt={};var st,at={};function ot(){if(st)return at;st=1,Object.defineProperty(at,"__esModule",{value:!0}),at.Group=void 0;const t=w(),e=X(),n=S();class i extends e.Container{_validateAdd(e){const n=e.getType();"Group"!==n&&"Shape"!==n&&t.Util.throw("You may only add groups and shapes to groups.")}}return at.Group=i,i.prototype.nodeType="Group",(0,n._registerNode)(i),at}var lt,ht={};function ct(){if(lt)return ht;lt=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.Animation=void 0;const t=S(),e=w(),n=t.glob.performance&&t.glob.performance.now?function(){return t.glob.performance.now()}:function(){return(new Date).getTime()};let i=class t{constructor(e,i){this.id=t.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:n(),frameRate:0},this.func=e,this.setLayers(i)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,n=e.length;for(let i=0;i<n;i++)if(e[i]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=t.animations,n=e.length;for(let t=0;t<n;t++)if(e[t].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=n(),t._addAnimation(this),this}stop(){return t._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,n=this.animations,i=n.length;for(let t=0;t<i;t++)if(n[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){const t={},e=this.animations;for(let i=0;i<e.length;i++){const r=e[i],s=r.layers,a=r.func;r._updateFrameObject(n());const o=s.length;let l;if(l=!a||!1!==a.call(r,r.frame),l)for(let e=0;e<o;e++){const n=s[e];void 0!==n._id&&(t[n._id]=n)}}for(const e in t)t.hasOwnProperty(e)&&t[e].batchDraw()}static _animationLoop(){const n=t;n.animations.length?(n._runFrames(),e.Util.requestAnimFrame(n._animationLoop)):n.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,e.Util.requestAnimFrame(this._animationLoop))}};return ht.Animation=i,i.animations=[],i.animIdCounter=0,i.animRunning=!1,ht}var dt,ut,pt={};function ft(){return ut||(ut=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const e=S(),n=w(),i=H(),r=X(),s=(Y||(Y=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Stage=t.stages=void 0;const e=w(),n=L(),i=X(),r=S(),s=F(),a=G(),o=S(),l=Z(),h="mouseleave",c="mouseover",d="mouseenter",u="mousemove",p="mousedown",f="mouseup",m="pointermove",g="pointerdown",_="pointerup",v="pointercancel",y="pointerout",x="pointerleave",b="pointerover",M="pointerenter",E="contextmenu",T="touchstart",A="touchend",C="touchmove",R="touchcancel",P="wheel",I=[[d,"_pointerenter"],[p,"_pointerdown"],[u,"_pointermove"],[f,"_pointerup"],[h,"_pointerleave"],[T,"_pointerdown"],[C,"_pointermove"],[A,"_pointerup"],[R,"_pointercancel"],[c,"_pointerover"],[P,"_wheel"],[E,"_contextmenu"],[g,"_pointerdown"],[m,"_pointermove"],[_,"_pointerup"],[v,"_pointercancel"],["lostpointercapture","_lostpointercapture"]],D={mouse:{[y]:"mouseout",[x]:h,[b]:c,[M]:d,[m]:u,[g]:p,[_]:f,[v]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[y]:"touchout",[x]:"touchleave",[b]:"touchover",[M]:"touchenter",[m]:C,[g]:T,[_]:A,[v]:R,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[y]:y,[x]:x,[b]:b,[M]:M,[m]:m,[g]:g,[_]:_,[v]:v,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},N=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",U=t=>{const e=N(t);return"pointer"===e?r.Konva.pointerEventsEnabled&&D.pointer:"touch"===e?D.touch:"mouse"===e?D.mouse:void 0};function O(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}t.stages=[];class k extends i.Container{constructor(e){super(O(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",(()=>{O(this.attrs)})),this._checkVisibility()}_validateAdd(t){const n="Layer"===t.getType(),i="FastLayer"===t.getType();n||i||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if("string"==typeof t){if("."===t.charAt(0)){const e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var e;e="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(e)}if(!t)throw"Can not find container in document with id "+e}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const t=this.children,e=t.length;for(let n=0;n<e;n++)t[n].clear();return this}clone(t){return t||(t={}),t.container="undefined"!=typeof document&&document.createElement("div"),i.Container.prototype.clone.call(this,t)}destroy(){super.destroy();const n=this.content;n&&e.Util._isInDocument(n)&&this.container().removeChild(n);const i=t.stages.indexOf(this);return i>-1&&t.stages.splice(i,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(e.Util.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(t){return this._pointerPositions.find((e=>e.id===t))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){(t=t||{}).x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();const e=new s.SceneCanvas({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),n=e.getContext()._context,i=this.children;return(t.x||t.y)&&n.translate(-1*t.x,-1*t.y),i.forEach((function(e){if(!e.isVisible())return;const i=e._toKonvaCanvas(t);n.drawImage(i._canvas,t.x,t.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())})),e}getIntersection(t){if(!t)return null;const e=this.children;for(let n=e.length-1;n>=0;n--){const i=e[n].getIntersection(t);if(i)return i}return null}_resizeDOM(){const t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach((n=>{n.setSize({width:t,height:e}),n.draw()}))}add(t,...n){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}super.add(t);const i=this.children.length;return i>5&&e.Util.warn("The stage has "+i+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),t.setSize({width:this.width(),height:this.height()}),t.draw(),r.Konva.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return l.hasPointerCapture(t,this)}setPointerCapture(t){l.setPointerCapture(t,this)}releaseCapture(t){l.releaseCapture(t,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&I.forEach((([t,e])=>{this.content.addEventListener(t,(t=>{this[e](t)}),{passive:!1})}))}_pointerenter(t){this.setPointersPositions(t);const e=U(t.type);e&&this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);const e=U(t.type);e&&this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];return e&&!e.getStage()&&(e=null),e}_pointerleave(t){const e=U(t.type),n=N(t.type);if(!e)return;this.setPointersPositions(t);const i=this._getTargetShape(n),s=!(r.Konva.isDragging()||r.Konva.isTransforming())||r.Konva.hitOnDragEnabled;i&&s?(i._fireAndBubble(e.pointerout,{evt:t}),i._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[n+"targetShape"]=null):s&&(this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(t){const e=U(t.type),n=N(t.type);if(!e)return;this.setPointersPositions(t);let i=!1;this._changedPointerPositions.forEach((s=>{const o=this.getIntersection(s);if(a.DD.justDragged=!1,r.Konva["_"+n+"ListenClick"]=!0,!o||!o.isListening())return void(this[n+"ClickStartShape"]=void 0);r.Konva.capturePointerEventsEnabled&&o.setPointerCapture(s.id),this[n+"ClickStartShape"]=o,o._fireAndBubble(e.pointerdown,{evt:t,pointerId:s.id}),i=!0;const l=t.type.indexOf("touch")>=0;o.preventDefault()&&t.cancelable&&l&&t.preventDefault()})),i||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(t){const e=U(t.type),n=N(t.type);if(!e)return;if(r.Konva.isDragging()&&a.DD.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t),(r.Konva.isDragging()||r.Konva.isTransforming())&&!r.Konva.hitOnDragEnabled)return;const i={};let s=!1;const o=this._getTargetShape(n);this._changedPointerPositions.forEach((r=>{const a=l.getCapturedShape(r.id)||this.getIntersection(r),h=r.id,c={evt:t,pointerId:h},d=o!==a;if(d&&o&&(o._fireAndBubble(e.pointerout,{...c},a),o._fireAndBubble(e.pointerleave,{...c},a)),a){if(i[a._id])return;i[a._id]=!0}a&&a.isListening()?(s=!0,d&&(a._fireAndBubble(e.pointerover,{...c},o),a._fireAndBubble(e.pointerenter,{...c},o),this[n+"targetShape"]=a),a._fireAndBubble(e.pointermove,{...c})):o&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:h}),this[n+"targetShape"]=null)})),s||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){const e=U(t.type),n=N(t.type);if(!e)return;this.setPointersPositions(t);const i=this[n+"ClickStartShape"],s=this[n+"ClickEndShape"],o={};let h=!1;this._changedPointerPositions.forEach((c=>{const d=l.getCapturedShape(c.id)||this.getIntersection(c);if(d){if(d.releaseCapture(c.id),o[d._id])return;o[d._id]=!0}const u=c.id,p={evt:t,pointerId:u};let f=!1;r.Konva["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):a.DD.justDragged||(r.Konva["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){r.Konva["_"+n+"InDblClickWindow"]=!1}),r.Konva.dblClickWindow),d&&d.isListening()?(h=!0,this[n+"ClickEndShape"]=d,d._fireAndBubble(e.pointerup,{...p}),r.Konva["_"+n+"ListenClick"]&&i&&i===d&&(d._fireAndBubble(e.pointerclick,{...p}),f&&s&&s===d&&d._fireAndBubble(e.pointerdblclick,{...p}))):(this[n+"ClickEndShape"]=null,r.Konva["_"+n+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:u}),f&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:u}))})),h||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+n+"ListenClick"]=!1,t.cancelable&&"touch"!==n&&"pointer"!==n&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(E,{evt:t}):this._fire(E,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(P,{evt:t}):this._fire(P,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);const e=l.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble(_,l.createEvent(t)),l.releaseCapture(t.pointerId)}_lostpointercapture(t){l.releaseCapture(t.pointerId)}setPointersPositions(t){const n=this._getContentPosition();let i=null,r=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,(t=>{this._pointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})})),Array.prototype.forEach.call(t.changedTouches||t.touches,(t=>{this._changedPointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})}))):(i=(t.clientX-n.left)/n.scaleX,r=(t.clientY-n.top)/n.scaleY,this.pointerPos={x:i,y:r},this._pointerPositions=[{x:i,y:r,id:e.Util._getFirstPointerId(t)}],this._changedPointerPositions=[{x:i,y:r,id:e.Util._getFirstPointerId(t)}])}_setPointerPosition(t){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!r.Konva.isBrowser)return;const t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(t){t.batchDraw()})),this}}t.Stage=k,k.prototype.nodeType="Stage",(0,o._registerNode)(k),n.Factory.addGetterSetter(k,"container"),r.Konva.isBrowser&&document.addEventListener("visibilitychange",(()=>{t.stages.forEach((t=>{t.batchDraw()}))}))}(q)),q),a=nt(),o=function(){if(it)return rt;it=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.FastLayer=void 0;const t=w(),e=nt(),n=S();let i=class extends e.Layer{constructor(e){super(e),this.listening(!1),t.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};return rt.FastLayer=i,i.prototype.nodeType="FastLayer",(0,n._registerNode)(i),rt}(),l=ot(),h=G(),c=et(),d=ct(),u=(dt||(dt=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Easings=t.Tween=void 0;const e=w(),n=ct(),i=H(),r=S(),s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=["fill","stroke","shadowColor"];let o=0;class l{constructor(t,e,n,i,r,s,a){this.prop=t,this.propFunc=e,this.begin=i,this._pos=i,this.duration=s,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=r-this.begin,this.pause()}fire(t){const e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class h{constructor(i){const a=this,c=i.node,d=c._id,u=i.easing||t.Easings.Linear,p=!!i.yoyo;let f,m;f=void 0===i.duration?.3:0===i.duration?.001:i.duration,this.node=c,this._id=o++;const g=c.getLayer()||(c instanceof r.Konva.Stage?c.getLayers():null);for(m in g||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation((function(){a.tween.onEnterFrame()}),g),this.tween=new l(m,(function(t){a._tweenFunc(t)}),u,0,1,1e3*f,p),this._addListeners(),h.attrs[d]||(h.attrs[d]={}),h.attrs[d][this._id]||(h.attrs[d][this._id]={}),h.tweens[d]||(h.tweens[d]={}),i)void 0===s[m]&&this._addAttr(m,i[m]);this.reset(),this.onFinish=i.onFinish,this.onReset=i.onReset,this.onUpdate=i.onUpdate}_addAttr(t,n){const i=this.node,r=i._id;let s,o,l,c,d;const u=h.tweens[r][t];u&&delete h.attrs[r][u][t];let p=i.getAttr(t);if(e.Util._isArray(n))if(s=[],o=Math.max(n.length,p.length),"points"===t&&n.length!==p.length&&(n.length>p.length?(c=p,p=e.Util._prepareArrayForTween(p,n,i.closed())):(l=n,n=e.Util._prepareArrayForTween(n,p,i.closed()))),0===t.indexOf("fill"))for(let t=0;t<o;t++)if(t%2==0)s.push(n[t]-p[t]);else{const i=e.Util.colorToRGBA(p[t]);d=e.Util.colorToRGBA(n[t]),p[t]=i,s.push({r:d.r-i.r,g:d.g-i.g,b:d.b-i.b,a:d.a-i.a})}else for(let t=0;t<o;t++)s.push(n[t]-p[t]);else-1!==a.indexOf(t)?(p=e.Util.colorToRGBA(p),d=e.Util.colorToRGBA(n),s={r:d.r-p.r,g:d.g-p.g,b:d.b-p.b,a:d.a-p.a}):s=n-p;h.attrs[r][this._id][t]={start:p,diff:s,end:n,trueEnd:l,trueStart:c},h.tweens[r][t]=this._id}_tweenFunc(t){const n=this.node,i=h.attrs[n._id][this._id];let r,s,o,l,c,d,u,p;for(r in i){if(s=i[r],o=s.start,l=s.diff,p=s.end,e.Util._isArray(o))if(c=[],u=Math.max(o.length,p.length),0===r.indexOf("fill"))for(d=0;d<u;d++)d%2==0?c.push((o[d]||0)+l[d]*t):c.push("rgba("+Math.round(o[d].r+l[d].r*t)+","+Math.round(o[d].g+l[d].g*t)+","+Math.round(o[d].b+l[d].b*t)+","+(o[d].a+l[d].a*t)+")");else for(d=0;d<u;d++)c.push((o[d]||0)+l[d]*t);else c=-1!==a.indexOf(r)?"rgba("+Math.round(o.r+l.r*t)+","+Math.round(o.g+l.g*t)+","+Math.round(o.b+l.b*t)+","+(o.a+l.a*t)+")":o+l*t;n.setAttr(r,c)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,e=h.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,e=h.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(1e3*t),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const t=this.node._id,e=this._id,n=h.tweens[t];this.pause();for(const e in n)delete h.tweens[t][e];delete h.attrs[t][e]}}t.Tween=h,h.attrs={},h.tweens={},i.Node.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new h(t).play()},t.Easings={BackEaseIn(t,e,n,i){const r=1.70158;return n*(t/=i)*t*((r+1)*t-r)+e},BackEaseOut(t,e,n,i){const r=1.70158;return n*((t=t/i-1)*t*((r+1)*t+r)+1)+e},BackEaseInOut(t,e,n,i){let r=1.70158;return(t/=i/2)<1?n/2*(t*t*((1+(r*=1.525))*t-r))+e:n/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},ElasticEaseIn(t,e,n,i,r,s){let a=0;return 0===t?e:1==(t/=i)?e+n:(s||(s=.3*i),!r||r<Math.abs(n)?(r=n,a=s/4):a=s/(2*Math.PI)*Math.asin(n/r),-r*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/s)+e)},ElasticEaseOut(t,e,n,i,r,s){let a=0;return 0===t?e:1==(t/=i)?e+n:(s||(s=.3*i),!r||r<Math.abs(n)?(r=n,a=s/4):a=s/(2*Math.PI)*Math.asin(n/r),r*Math.pow(2,-10*t)*Math.sin((t*i-a)*(2*Math.PI)/s)+n+e)},ElasticEaseInOut(t,e,n,i,r,s){let a=0;return 0===t?e:2==(t/=i/2)?e+n:(s||(s=i*(.3*1.5)),!r||r<Math.abs(n)?(r=n,a=s/4):a=s/(2*Math.PI)*Math.asin(n/r),t<1?r*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/s)*-.5+e:r*Math.pow(2,-10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/s)*.5+n+e)},BounceEaseOut:(t,e,n,i)=>(t/=i)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(e,n,i,r)=>i-t.Easings.BounceEaseOut(r-e,0,i,r)+n,BounceEaseInOut:(e,n,i,r)=>e<r/2?.5*t.Easings.BounceEaseIn(2*e,0,i,r)+n:.5*t.Easings.BounceEaseOut(2*e-r,0,i,r)+.5*i+n,EaseIn:(t,e,n,i)=>n*(t/=i)*t+e,EaseOut:(t,e,n,i)=>-n*(t/=i)*(t-2)+e,EaseInOut:(t,e,n,i)=>(t/=i/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,n,i)=>n*(t/=i)*t*t*t*t+e,StrongEaseOut:(t,e,n,i)=>n*((t=t/i-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,n,i)=>(t/=i/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,n,i)=>n*t/i+e}}(pt)),pt),p=O(),f=F();t.Konva=n.Util._assign(e.Konva,{Util:n.Util,Transform:n.Transform,Node:i.Node,Container:r.Container,Stage:s.Stage,stages:s.stages,Layer:a.Layer,FastLayer:o.FastLayer,Group:l.Group,DD:h.DD,Shape:c.Shape,shapes:c.shapes,Animation:d.Animation,Tween:u.Tween,Easings:u.Easings,Context:p.Context,Canvas:f.Canvas}),t.default=t.Konva}(y)),y}var mt,gt={};var _t,vt={},yt={};function xt(){if(_t)return yt;_t=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.Line=void 0;const t=L(),e=S(),n=et(),i=P();function r(t,e,n,i,r,s,a){const o=Math.sqrt(Math.pow(n-t,2)+Math.pow(i-e,2)),l=Math.sqrt(Math.pow(r-n,2)+Math.pow(s-i,2)),h=a*o/(o+l),c=a*l/(o+l);return[n-h*(r-t),i-h*(s-e),n+c*(r-t),i+c*(s-e)]}function s(t,e){const n=t.length,i=[];for(let s=2;s<n-2;s+=2){const n=r(t[s-2],t[s-1],t[s],t[s+1],t[s+2],t[s+3],e);isNaN(n[0])||(i.push(n[0]),i.push(n[1]),i.push(t[s]),i.push(t[s+1]),i.push(n[2]),i.push(n[3]))}return i}class a extends n.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(t){let e,n,i,r=this.points(),s=r.length,a=this.tension(),o=this.closed(),l=this.bezier();if(s){if(t.beginPath(),t.moveTo(r[0],r[1]),0!==a&&s>4){for(e=this.getTensionPoints(),n=e.length,i=o?0:4,o||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);i<n-2;)t.bezierCurveTo(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);o||t.quadraticCurveTo(e[n-2],e[n-1],r[s-2],r[s-1])}else if(l)for(i=2;i<s;)t.bezierCurveTo(r[i++],r[i++],r[i++],r[i++],r[i++],r[i++]);else for(i=2;i<s;i+=2)t.lineTo(r[i],r[i+1]);o?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():s(this.points(),this.tension())}_getTensionPointsClosed(){const t=this.points(),e=t.length,n=this.tension(),i=r(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),a=r(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),o=s(t,n);return[i[2],i[3]].concat(o).concat([a[0],a[1],t[e-2],t[e-1],a[2],a[3],i[0],i[1],t[0],t[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};t=0!==this.tension()?[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:this.points();let e,n,i=t[0],r=t[0],s=t[1],a=t[1];for(let o=0;o<t.length/2;o++)e=t[2*o],n=t[2*o+1],i=Math.min(i,e),r=Math.max(r,e),s=Math.min(s,n),a=Math.max(a,n);return{x:i,y:s,width:r-i,height:a-s}}}return yt.Line=a,a.prototype.className="Line",a.prototype._attrsAffectingSize=["points","bezier","tension"],(0,e._registerNode)(a),t.Factory.addGetterSetter(a,"closed",!1),t.Factory.addGetterSetter(a,"bezier",!1),t.Factory.addGetterSetter(a,"tension",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(a,"points",[],(0,i.getNumberArrayValidator)()),yt}var St,bt,Mt,wt={},Et={};function Tt(){if(bt)return wt;bt=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.Path=void 0;const t=L(),e=et(),n=S(),i=(St||(St=1,function(t){function e(t,e,i){const r=n(1,i,t),s=n(1,i,e),a=r*r+s*s;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=(n,i,r)=>{let s,a;const o=r/2;s=0;for(let r=0;r<20;r++)a=o*t.tValues[20][r]+o,s+=t.cValues[20][r]*e(n,i,a);return o*s},t.getQuadraticArcLength=(t,e,n)=>{void 0===n&&(n=1);const i=t[0]-2*t[1]+t[2],r=e[0]-2*e[1]+e[2],s=2*t[1]-2*t[0],a=2*e[1]-2*e[0],o=4*(i*i+r*r),l=4*(i*s+r*a),h=s*s+a*a;if(0===o)return n*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const c=l/(2*o),d=n+c,u=h/o-c*c,p=d*d+u>0?Math.sqrt(d*d+u):0,f=c*c+u>0?Math.sqrt(c*c+u):0,m=c+Math.sqrt(c*c+u)!==0?u*Math.log(Math.abs((d+p)/(c+f))):0;return Math.sqrt(o)/2*(d*p-c*f+m)};const n=(e,i,r)=>{const s=r.length-1;let a,o;if(0===s)return 0;if(0===e){o=0;for(let e=0;e<=s;e++)o+=t.binomialCoefficients[s][e]*Math.pow(1-i,s-e)*Math.pow(i,e)*r[e];return o}a=new Array(s);for(let t=0;t<s;t++)a[t]=s*(r[t+1]-r[t]);return n(e-1,i,a)};t.t2length=(t,e,n)=>{let i=1,r=t/e,s=(t-n(r))/e,a=0;for(;i>.001;){const o=n(r+s),l=Math.abs(t-o)/e;if(l<i)i=l,r+=s;else{const a=n(r-s),o=Math.abs(t-a)/e;o<i?(i=o,r-=s):s/=2}if(a++,a>500)break}return r}}(Et)),Et);let r=class t extends e.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",(function(){this._readDataAttribute()}))}_readDataAttribute(){this.dataArray=t.parsePathData(this.data()),this.pathLength=t.getPathLength(this.dataArray)}_sceneFunc(t){const e=this.dataArray;t.beginPath();let n=!1;for(let f=0;f<e.length;f++){const m=e[f].command,g=e[f].points;switch(m){case"L":t.lineTo(g[0],g[1]);break;case"M":t.moveTo(g[0],g[1]);break;case"C":t.bezierCurveTo(g[0],g[1],g[2],g[3],g[4],g[5]);break;case"Q":t.quadraticCurveTo(g[0],g[1],g[2],g[3]);break;case"A":var i=g[0],r=g[1],s=g[2],a=g[3],o=g[4],l=g[5],h=g[6],c=g[7],d=s>a?s:a,u=s>a?1:s/a,p=s>a?a/s:1;t.translate(i,r),t.rotate(h),t.scale(u,p),t.arc(0,0,d,o,o+l,1-c),t.scale(1/u,1/p),t.rotate(-h),t.translate(-i,-r);break;case"z":n=!0,t.closePath()}}n||this.hasFill()?t.fillStrokeShape(this):t.strokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach((function(n){if("A"===n.command){const i=n.points[4],r=n.points[5],s=n.points[4]+r;let a=Math.PI/180;if(Math.abs(i-s)<a&&(a=Math.abs(i-s)),r<0)for(let r=i-a;r>s;r-=a){const i=t.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],r,0);e.push(i.x,i.y)}else for(let r=i+a;r<s;r+=a){const i=t.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],r,0);e.push(i.x,i.y)}}else if("C"===n.command)for(let i=0;i<=1;i+=.01){const r=t.getPointOnCubicBezier(i,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);e.push(r.x,r.y)}else e=e.concat(n.points)}));let n,i,r=e[0],s=e[0],a=e[1],o=e[1];for(let t=0;t<e.length/2;t++)n=e[2*t],i=e[2*t+1],isNaN(n)||(r=Math.min(r,n),s=Math.max(s,n)),isNaN(i)||(a=Math.min(a,i),o=Math.max(o,i));return{x:r,y:a,width:s-r,height:o-a}}getLength(){return this.pathLength}getPointAtLength(e){return t.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(t,e,n,i){return Math.sqrt((n-t)*(n-t)+(i-e)*(i-e))}static getPathLength(t){let e=0;for(let n=0;n<t.length;++n)e+=t[n].pathLength;return e}static getPointAtLengthOfDataArray(e,n){let r,s=0,a=n.length;if(!a)return null;for(;s<a&&e>n[s].pathLength;)e-=n[s].pathLength,++s;if(s===a)return r=n[s-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return r=n[s].points.slice(0,2),{x:r[0],y:r[1]};const o=n[s],l=o.points;switch(o.command){case"L":return t.getPointOnLine(e,o.start.x,o.start.y,l[0],l[1]);case"C":return t.getPointOnCubicBezier((0,i.t2length)(e,t.getPathLength(n),(t=>(0,i.getCubicArcLength)([o.start.x,l[0],l[2],l[4]],[o.start.y,l[1],l[3],l[5]],t))),o.start.x,o.start.y,l[0],l[1],l[2],l[3],l[4],l[5]);case"Q":return t.getPointOnQuadraticBezier((0,i.t2length)(e,t.getPathLength(n),(t=>(0,i.getQuadraticArcLength)([o.start.x,l[0],l[2]],[o.start.y,l[1],l[3]],t))),o.start.x,o.start.y,l[0],l[1],l[2],l[3]);case"A":var h=l[0],c=l[1],d=l[2],u=l[3],p=l[4],f=l[5],m=l[6];return p+=f*e/o.pathLength,t.getPointOnEllipticalArc(h,c,d,u,p,m)}return null}static getPointOnLine(t,e,n,i,r,s,a){s=null!=s?s:e,a=null!=a?a:n;const o=this.getLineLength(e,n,i,r);if(o<1e-10)return{x:e,y:n};if(i===e)return{x:s,y:a+(r>n?t:-t)};const l=(r-n)/(i-e),h=Math.sqrt(t*t/(1+l*l))*(i<e?-1:1),c=l*h;if(Math.abs(a-n-l*(s-e))<1e-10)return{x:s+h,y:a+c};const d=((s-e)*(i-e)+(a-n)*(r-n))/(o*o),u=e+d*(i-e),p=n+d*(r-n),f=this.getLineLength(s,a,u,p),m=Math.sqrt(t*t-f*f),g=Math.sqrt(m*m/(1+l*l))*(i<e?-1:1);return{x:u+g,y:p+l*g}}static getPointOnCubicBezier(t,e,n,i,r,s,a,o,l){function h(t){return t*t*t}function c(t){return 3*t*t*(1-t)}function d(t){return 3*t*(1-t)*(1-t)}function u(t){return(1-t)*(1-t)*(1-t)}return{x:o*h(t)+s*c(t)+i*d(t)+e*u(t),y:l*h(t)+a*c(t)+r*d(t)+n*u(t)}}static getPointOnQuadraticBezier(t,e,n,i,r,s,a){function o(t){return t*t}function l(t){return 2*t*(1-t)}function h(t){return(1-t)*(1-t)}return{x:s*o(t)+i*l(t)+e*h(t),y:a*o(t)+r*l(t)+n*h(t)}}static getPointOnEllipticalArc(t,e,n,i,r,s){const a=Math.cos(s),o=Math.sin(s),l=n*Math.cos(r),h=i*Math.sin(r);return{x:t+(l*a-h*o),y:e+(l*o+h*a)}}static parsePathData(t){if(!t)return[];let e=t;const n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var i=0;i<n.length;i++)e=e.replace(new RegExp(n[i],"g"),"|"+n[i]);const r=e.split("|"),s=[],a=[];let o=0,l=0;const h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let c;for(i=1;i<r.length;i++){let t=r[i],e=t.charAt(0);for(t=t.slice(1),a.length=0;c=h.exec(t);)a.push(c[0]);const n=[];for(let t=0,e=a.length;t<e;t++){if("00"===a[t]){n.push(0,0);continue}const e=parseFloat(a[t]);isNaN(e)?n.push(0):n.push(e)}for(;n.length>0&&!isNaN(n[0]);){let t="",i=[];const r=o,a=l;var d,u,p,f,m,g,_,v,y,x;switch(e){case"l":o+=n.shift(),l+=n.shift(),t="L",i.push(o,l);break;case"L":o=n.shift(),l=n.shift(),i.push(o,l);break;case"m":var S=n.shift(),b=n.shift();if(o+=S,l+=b,t="M",s.length>2&&"z"===s[s.length-1].command)for(let t=s.length-2;t>=0;t--)if("M"===s[t].command){o=s[t].points[0]+S,l=s[t].points[1]+b;break}i.push(o,l),e="l";break;case"M":o=n.shift(),l=n.shift(),t="M",i.push(o,l),e="L";break;case"h":o+=n.shift(),t="L",i.push(o,l);break;case"H":o=n.shift(),t="L",i.push(o,l);break;case"v":l+=n.shift(),t="L",i.push(o,l);break;case"V":l=n.shift(),t="L",i.push(o,l);break;case"C":i.push(n.shift(),n.shift(),n.shift(),n.shift()),o=n.shift(),l=n.shift(),i.push(o,l);break;case"c":i.push(o+n.shift(),l+n.shift(),o+n.shift(),l+n.shift()),o+=n.shift(),l+=n.shift(),t="C",i.push(o,l);break;case"S":u=o,p=l,"C"===(d=s[s.length-1]).command&&(u=o+(o-d.points[2]),p=l+(l-d.points[3])),i.push(u,p,n.shift(),n.shift()),o=n.shift(),l=n.shift(),t="C",i.push(o,l);break;case"s":u=o,p=l,"C"===(d=s[s.length-1]).command&&(u=o+(o-d.points[2]),p=l+(l-d.points[3])),i.push(u,p,o+n.shift(),l+n.shift()),o+=n.shift(),l+=n.shift(),t="C",i.push(o,l);break;case"Q":i.push(n.shift(),n.shift()),o=n.shift(),l=n.shift(),i.push(o,l);break;case"q":i.push(o+n.shift(),l+n.shift()),o+=n.shift(),l+=n.shift(),t="Q",i.push(o,l);break;case"T":u=o,p=l,"Q"===(d=s[s.length-1]).command&&(u=o+(o-d.points[0]),p=l+(l-d.points[1])),o=n.shift(),l=n.shift(),t="Q",i.push(u,p,o,l);break;case"t":u=o,p=l,"Q"===(d=s[s.length-1]).command&&(u=o+(o-d.points[0]),p=l+(l-d.points[1])),o+=n.shift(),l+=n.shift(),t="Q",i.push(u,p,o,l);break;case"A":f=n.shift(),m=n.shift(),g=n.shift(),_=n.shift(),v=n.shift(),y=o,x=l,o=n.shift(),l=n.shift(),t="A",i=this.convertEndpointToCenterParameterization(y,x,o,l,_,v,f,m,g);break;case"a":f=n.shift(),m=n.shift(),g=n.shift(),_=n.shift(),v=n.shift(),y=o,x=l,o+=n.shift(),l+=n.shift(),t="A",i=this.convertEndpointToCenterParameterization(y,x,o,l,_,v,f,m,g)}s.push({command:t||e,points:i,start:{x:r,y:a},pathLength:this.calcLength(r,a,t||e,i)})}"z"!==e&&"Z"!==e||s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,s){let a,o,l,h;const c=t;switch(r){case"L":return c.getLineLength(e,n,s[0],s[1]);case"C":return(0,i.getCubicArcLength)([e,s[0],s[2],s[4]],[n,s[1],s[3],s[5]],1);case"Q":return(0,i.getQuadraticArcLength)([e,s[0],s[2]],[n,s[1],s[3]],1);case"A":a=0;var d=s[4],u=s[5],p=s[4]+u,f=Math.PI/180;if(Math.abs(d-p)<f&&(f=Math.abs(d-p)),o=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],d,0),u<0)for(h=d-f;h>p;h-=f)l=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],h,0),a+=c.getLineLength(o.x,o.y,l.x,l.y),o=l;else for(h=d+f;h<p;h+=f)l=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],h,0),a+=c.getLineLength(o.x,o.y,l.x,l.y),o=l;return l=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],p,0),a+=c.getLineLength(o.x,o.y,l.x,l.y),a}return 0}static convertEndpointToCenterParameterization(t,e,n,i,r,s,a,o,l){const h=l*(Math.PI/180),c=Math.cos(h)*(t-n)/2+Math.sin(h)*(e-i)/2,d=-1*Math.sin(h)*(t-n)/2+Math.cos(h)*(e-i)/2,u=c*c/(a*a)+d*d/(o*o);u>1&&(a*=Math.sqrt(u),o*=Math.sqrt(u));let p=Math.sqrt((a*a*(o*o)-a*a*(d*d)-o*o*(c*c))/(a*a*(d*d)+o*o*(c*c)));r===s&&(p*=-1),isNaN(p)&&(p=0);const f=p*a*d/o,m=p*-o*c/a,g=(t+n)/2+Math.cos(h)*f-Math.sin(h)*m,_=(e+i)/2+Math.sin(h)*f+Math.cos(h)*m,v=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},y=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(v(t)*v(e))},x=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(y(t,e))},S=x([1,0],[(c-f)/a,(d-m)/o]),b=[(c-f)/a,(d-m)/o],M=[(-1*c-f)/a,(-1*d-m)/o];let w=x(b,M);return y(b,M)<=-1&&(w=Math.PI),y(b,M)>=1&&(w=0),0===s&&w>0&&(w-=2*Math.PI),1===s&&w<0&&(w+=2*Math.PI),[g,_,a,o,S,w,h,s]}};return wt.Path=r,r.prototype.className="Path",r.prototype._attrsAffectingSize=["data"],(0,n._registerNode)(r),t.Factory.addGetterSetter(r,"data"),wt}var At,Ct={};var Rt,Pt={};var Lt,It={};var Dt,Nt={};var Ut,Ot={};function Ft(){if(Ut)return Ot;Ut=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.Rect=void 0;const t=L(),e=et(),n=S(),i=w(),r=P();let s=class extends e.Shape{_sceneFunc(t){const e=this.cornerRadius(),n=this.width(),r=this.height();t.beginPath(),e?i.Util.drawRoundedRectPath(t,n,r,e):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}};return Ot.Rect=s,s.prototype.className="Rect",(0,n._registerNode)(s),t.Factory.addGetterSetter(s,"cornerRadius",0,(0,r.getNumberOrArrayOfNumbersValidator)(4)),Ot}var kt,Bt={};var zt,Gt={};var Ht,Vt={};var Wt,Xt={};var jt,Yt={};function qt(){if(jt)return Yt;jt=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.Text=void 0,Yt.stringToArray=a;const t=w(),e=L(),n=et(),i=S(),r=P(),s=S();function a(t){return[...t].reduce(((t,e,n,i)=>{if(/\p{Emoji}/u.test(e)){const r=i[n+1];r&&/\p{Emoji_Modifier}|\u200D/u.test(r)?(t.push(e+r),i[n+1]=""):t.push(e)}else/\p{Regional_Indicator}{2}/u.test(e+(i[n+1]||""))?t.push(e+i[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(e)?t[t.length-1]+=e:e&&t.push(e);return t}),[])}const o="auto",l="inherit",h="justify",c="left",d="middle",u="normal",p=" ",f="none",m=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],g=m.length;let _;function v(){return _||(_=t.Util.createCanvasElement().getContext("2d"),_)}let y=class extends n.Shape{constructor(t){super(function(t){return(t=t||{}).fillLinearGradientColorStops||t.fillRadialGradientColorStops||t.fillPatternImage||(t.fill=t.fill||"black"),t}(t)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<g;t++)this.on(m[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(t){const e=this.textArr,n=e.length;if(!this.text())return;let r,s=this.padding(),o=this.fontSize(),u=this.lineHeight()*o,p=this.verticalAlign(),f=this.direction(),m=0,g=this.align(),_=this.getWidth(),v=this.letterSpacing(),y=this.fill(),x=this.textDecoration(),S=-1!==x.indexOf("underline"),b=-1!==x.indexOf("line-through");f=f===l?t.direction:f;let M=u/2,w=d;if(i.Konva._fixTextRendering){const t=this.measureSize("M");w="alphabetic",M=(t.fontBoundingBoxAscent-t.fontBoundingBoxDescent)/2+u/2}var E=0,T=0;for("rtl"===f&&t.setAttr("direction",f),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",w),t.setAttr("textAlign",c),p===d?m=(this.getHeight()-n*u-2*s)/2:"bottom"===p&&(m=this.getHeight()-n*u-2*s),t.translate(s,m+s),r=0;r<n;r++){E=0,T=0;var A,C,R=e[r],P=R.text,L=R.width,I=R.lastInParagraph;if(t.save(),"right"===g?E+=_-L-2*s:"center"===g&&(E+=(_-L-2*s)/2),S){t.save(),t.beginPath();const e=E,n=M+T+(i.Konva._fixTextRendering?Math.round(o/4):Math.round(o/2));t.moveTo(e,n),A=P.split(" ").length-1,C=g!==h||I?L:_-2*s,t.lineTo(e+Math.round(C),n),t.lineWidth=o/15;const r=this._getLinearGradient();t.strokeStyle=r||y,t.stroke(),t.restore()}if(b){t.save(),t.beginPath();const e=i.Konva._fixTextRendering?-Math.round(o/4):0;t.moveTo(E,M+T+e),A=P.split(" ").length-1,C=g!==h||I?L:_-2*s,t.lineTo(E+Math.round(C),M+T+e),t.lineWidth=o/15;const n=this._getLinearGradient();t.strokeStyle=n||y,t.stroke(),t.restore()}if("rtl"===f||0===v&&g!==h)0!==v&&t.setAttr("letterSpacing",`${v}px`),this._partialTextX=E,this._partialTextY=M+T,this._partialText=P,t.fillStrokeShape(this);else{A=P.split(" ").length-1;const e=a(P);for(let n=0;n<e.length;n++){const i=e[n];" "!==i||I||g!==h||(E+=(_-2*s-L)/A),this._partialTextX=E,this._partialTextY=M+T,this._partialText=i,t.fillStrokeShape(this),E+=this.measureSize(i).width+v}}t.restore(),n>1&&(M+=u)}}_hitFunc(t){const e=this.getWidth(),n=this.getHeight();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}setText(e){const n=t.Util._isString(e)?e:null==e?"":e+"";return this._setAttr("text",n),this}getWidth(){return this.attrs.width===o||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===o||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return t.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e,n,i,r,s,a,o,l,h,c,d;let u,p=v(),f=this.fontSize();p.save(),p.font=this._getContextFont(),u=p.measureText(t),p.restore();const m=f/100;return{actualBoundingBoxAscent:null!==(e=u.actualBoundingBoxAscent)&&void 0!==e?e:71.58203125*m,actualBoundingBoxDescent:null!==(n=u.actualBoundingBoxDescent)&&void 0!==n?n:0,actualBoundingBoxLeft:null!==(i=u.actualBoundingBoxLeft)&&void 0!==i?i:-7.421875*m,actualBoundingBoxRight:null!==(r=u.actualBoundingBoxRight)&&void 0!==r?r:75.732421875*m,alphabeticBaseline:null!==(s=u.alphabeticBaseline)&&void 0!==s?s:0,emHeightAscent:null!==(a=u.emHeightAscent)&&void 0!==a?a:100*m,emHeightDescent:null!==(o=u.emHeightDescent)&&void 0!==o?o:-20*m,fontBoundingBoxAscent:null!==(l=u.fontBoundingBoxAscent)&&void 0!==l?l:91*m,fontBoundingBoxDescent:null!==(h=u.fontBoundingBoxDescent)&&void 0!==h?h:21*m,hangingBaseline:null!==(c=u.hangingBaseline)&&void 0!==c?c:72.80000305175781*m,ideographicBaseline:null!==(d=u.ideographicBaseline)&&void 0!==d?d:-21*m,width:u.width,height:f}}_getContextFont(){return this.fontStyle()+p+this.fontVariant()+p+(this.fontSize()+"px ")+this.fontFamily().split(",").map((t=>{const e=(t=t.trim()).indexOf(" ")>=0,n=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!n&&(t=`"${t}"`),t})).join(", ")}_addTextLine(t){this.align()===h&&(t=t.trim());const e=this._getTextWidth(t);return this.textArr.push({text:t,width:e,lastInParagraph:!1})}_getTextWidth(t){const e=this.letterSpacing(),n=t.length;return v().measureText(t).width+e*n}_setTextData(){let t=this.text().split("\n"),e=+this.fontSize(),n=0,i=this.lineHeight()*e,r=this.attrs.width,s=this.attrs.height,l=r!==o&&void 0!==r,h=s!==o&&void 0!==s,c=this.padding(),d=r-2*c,u=s-2*c,m=0,g=this.wrap(),_="char"!==g&&g!==f,y=this.ellipsis();this.textArr=[],v().font=this._getContextFont();const x=y?this._getTextWidth("…"):0;for(let e=0,r=t.length;e<r;++e){let s=t[e],o=this._getTextWidth(s);if(l&&o>d)for(;s.length>0;){let t=0,e=a(s).length,r="",l=0;for(;t<e;){const n=t+e>>>1,o=a(s).slice(0,n+1).join(""),c=this._getTextWidth(o);(y&&h&&m+i>u?c+x:c)<=d?(t=n+1,r=o,l=c):e=n}if(!r)break;if(_){const e=a(s),n=a(r),i=e[n.length];let o;if((i===p||"-"===i)&&l<=d)o=n.length;else{const t=n.lastIndexOf(p),e=n.lastIndexOf("-");o=Math.max(t,e)+1}o>0&&(t=o,r=e.slice(0,t).join(""),l=this._getTextWidth(r))}r=r.trimRight(),this._addTextLine(r),n=Math.max(n,l),m+=i;if(this._shouldHandleEllipsis(m)){this._tryToAddEllipsisToLastLine();break}if(s=a(s).slice(t).join("").trimLeft(),s.length>0&&(o=this._getTextWidth(s),o<=d)){this._addTextLine(s),m+=i,n=Math.max(n,o);break}}else this._addTextLine(s),m+=i,n=Math.max(n,o),this._shouldHandleEllipsis(m)&&e<r-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),h&&m+i>u)break}this.textHeight=e,this.textWidth=n}_shouldHandleEllipsis(t){const e=+this.fontSize(),n=this.lineHeight()*e,i=this.attrs.height,r=i!==o&&void 0!==i,s=i-2*this.padding();return!(this.wrap()!==f)||r&&t+n>s}_tryToAddEllipsisToLastLine(){const t=this.attrs.width,e=t!==o&&void 0!==t,n=t-2*this.padding(),i=this.ellipsis(),r=this.textArr[this.textArr.length-1];if(r&&i){if(e){this._getTextWidth(r.text+"…")<n||(r.text=r.text.slice(0,r.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(r.text+"…")}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=-1!==this.textDecoration().indexOf("underline")||-1!==this.textDecoration().indexOf("line-through"),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas()}};return Yt.Text=y,y.prototype._fillFunc=function(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)},y.prototype._strokeFunc=function(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)},y.prototype.className="Text",y.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,s._registerNode)(y),e.Factory.overWriteSetter(y,"width",(0,r.getNumberOrAutoValidator)()),e.Factory.overWriteSetter(y,"height",(0,r.getNumberOrAutoValidator)()),e.Factory.addGetterSetter(y,"direction",l),e.Factory.addGetterSetter(y,"fontFamily","Arial"),e.Factory.addGetterSetter(y,"fontSize",12,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"fontStyle",u),e.Factory.addGetterSetter(y,"fontVariant",u),e.Factory.addGetterSetter(y,"padding",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"align",c),e.Factory.addGetterSetter(y,"verticalAlign","top"),e.Factory.addGetterSetter(y,"lineHeight",1,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"wrap","word"),e.Factory.addGetterSetter(y,"ellipsis",!1,(0,r.getBooleanValidator)()),e.Factory.addGetterSetter(y,"letterSpacing",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"text","",(0,r.getStringValidator)()),e.Factory.addGetterSetter(y,"textDecoration",""),Yt}var Kt,Zt={};var Qt,Jt={};function $t(){if(Qt)return Jt;Qt=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Transformer=void 0;const t=w(),e=L(),n=H(),i=et(),r=Ft(),s=ot(),a=S(),o=P(),l=S(),h="tr-konva",c=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((t=>t+`.${h}`)).join(" "),d="nodesRect",u=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],p={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},f="ontouchstart"in a.Konva._global;const m=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function g(t,e,n){const i=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),r=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:i,y:r}}function _(t,e){const n=function(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}(t);return g(t,e,n)}let v=0,y=class extends s.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(c,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(e){return t.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 h+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const n=e.filter((e=>!e.isAncestorOf(this)||(t.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1)));this._nodes=e=n,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((t=>{const e=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()};if(t._attrsAffectingSize.length){const n=t._attrsAffectingSize.map((t=>t+"Change."+this._getEventNamespace())).join(" ");t.on(n,e)}t.on(u.map((t=>t+`.${this._getEventNamespace()}`)).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)})),this._resetTransformCache();return!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,(n=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(n,!1)})),t.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!e)return;const i=t.getAbsolutePosition(),r=i.x-e.x,s=i.y-e.y;this.nodes().forEach((e=>{if(e===t)return;if(e.isDragging())return;const i=e.getAbsolutePosition();e.setAbsolutePosition({x:i.x+r,y:i.y+s}),e.startDrag(n)})),e=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((t=>{t.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(d),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(d,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),n){const i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=t.getAbsoluteScale(n),s=t.getAbsolutePosition(n),o=i.x*r.x-t.offsetX()*r.x,l=i.y*r.y-t.offsetY()*r.y,h=(a.Konva.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return g({x:s.x+o*Math.cos(h)+l*Math.sin(-h),y:s.y+l*Math.cos(h)+o*Math.sin(h),width:i.width*r.x,height:i.height*r.y,rotation:h},-a.Konva.getAngle(e),{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()}),i=[{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}],r=t.getAbsoluteTransform();i.forEach((function(t){const n=r.point(t);e.push(n)}))}));const n=new t.Transform;n.rotate(-a.Konva.getAngle(this.rotation()));let i=1/0,r=1/0,s=-1/0,o=-1/0;e.forEach((function(t){const e=n.point(t);void 0===i&&(i=s=e.x,r=o=e.y),i=Math.min(i,e.x),r=Math.min(r,e.y),s=Math.max(s,e.x),o=Math.max(o,e.y)})),n.invert();const l=n.point({x:i,y:r});return{x:l.x,y:l.y,width:s-i,height:o-r,rotation:a.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(),m.forEach((t=>{this._createAnchor(t)})),this._createAnchor("rotater")}_createAnchor(e){const n=new r.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:f?10:"auto"}),i=this;n.on("mousedown touchstart",(function(t){i._handleMouseDown(t)})),n.on("dragstart",(t=>{n.stopDrag(),t.cancelBubble=!0})),n.on("dragend",(t=>{t.cancelBubble=!0})),n.on("mouseenter",(()=>{const i=a.Konva.getAngle(this.rotation()),r=this.rotateAnchorCursor(),s=function(e,n,i){if("rotater"===e)return i;n+=t.Util.degToRad(p[e]||0);const r=(t.Util.radToDeg(n)%360+360)%360;return t.Util._inRange(r,337.5,360)||t.Util._inRange(r,0,22.5)?"ns-resize":t.Util._inRange(r,22.5,67.5)?"nesw-resize":t.Util._inRange(r,67.5,112.5)?"ew-resize":t.Util._inRange(r,112.5,157.5)?"nwse-resize":t.Util._inRange(r,157.5,202.5)?"ns-resize":t.Util._inRange(r,202.5,247.5)?"nesw-resize":t.Util._inRange(r,247.5,292.5)?"ew-resize":t.Util._inRange(r,292.5,337.5)?"nwse-resize":(t.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}(e,i,r);n.getStage().content&&(n.getStage().content.style.cursor=s),this._cursorChange=!0})),n.on("mouseout",(()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(n)}_createBack(){const e=new i.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,n){const i=n.getParent(),r=i.padding();e.beginPath(),e.rect(-r,-r,n.width()+2*r,n.height()+2*r),e.moveTo(n.width()/2,-r),i.rotateEnabled()&&i.rotateLineVisible()&&e.lineTo(n.width()/2,-i.rotateAnchorOffset()*t.Util._sign(n.height())-r),e.fillStrokeShape(n)},hitFunc:(t,e)=>{if(!this.shouldOverdrawWholeArea())return;const n=this.padding();t.beginPath(),t.rect(-n,-n,e.width()+2*n,e.height()+2*n),t.fillStrokeShape(e)}});this.add(e),this._proxyDrag(e),e.on("dragstart",(t=>{t.cancelBubble=!0})),e.on("dragmove",(t=>{t.cancelBubble=!0})),e.on("dragend",(t=>{t.cancelBubble=!0})),this.on("dragmove",(t=>{this.update()}))}_handleMouseDown(t){if(this._transforming)return;this._movingAnchorName=t.target.name().split(" ")[0];const e=this._getNodeRect(),n=e.width,i=e.height,r=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));this.sin=Math.abs(i/r),this.cos=Math.abs(n/r),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const s=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},v++,this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach((e=>{e._fire("transformstart",{evt:t.evt,target:e})}))}_handleMouseMove(t){let e,n,i;const r=this.findOne("."+this._movingAnchorName),s=r.getStage();s.setPointersPositions(t);const o=s.getPointerPosition();let l={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const h=r.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(h,l,t)),r.setAbsolutePosition(l);const c=r.getAbsolutePosition();if(h.x===c.x&&h.y===c.y)return;if("rotater"===this._movingAnchorName){const i=this._getNodeRect();e=r.x()-i.width/2,n=-r.y()+i.height/2;let s=Math.atan2(-n,e)+Math.PI/2;i.height<0&&(s-=Math.PI);const o=a.Konva.getAngle(this.rotation())+s,l=a.Konva.getAngle(this.rotationSnapTolerance()),h=function(t,e,n){let i=e;for(let r=0;r<t.length;r++){const s=a.Konva.getAngle(t[r]),o=Math.abs(s-e)%(2*Math.PI);Math.min(o,2*Math.PI-o)<n&&(i=s)}return i}(this.rotationSnaps(),o,l),c=_(i,h-i.rotation);return void this._fitNodesInto(c,t)}const d=this.shiftBehavior();let u;u="inverted"===d?this.keepRatio()&&!t.shiftKey:"none"===d?this.keepRatio():this.keepRatio()||t.shiftKey;var p=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(u){var f=p?{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(f.x-r.x(),2)+Math.pow(f.y-r.y(),2));var m=this.findOne(".top-left").x()>f.x?-1:1,g=this.findOne(".top-left").y()>f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,this.findOne(".top-left").x(f.x-e),this.findOne(".top-left").y(f.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(r.y());else if("top-right"===this._movingAnchorName){if(u){f=p?{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(r.x()-f.x,2)+Math.pow(f.y-r.y(),2));m=this.findOne(".top-right").x()<f.x?-1:1,g=this.findOne(".top-right").y()>f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,this.findOne(".top-right").x(f.x+e),this.findOne(".top-right").y(f.y-n)}var v=r.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(r.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(r.x());else if("bottom-left"===this._movingAnchorName){if(u){f=p?{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(f.x-r.x(),2)+Math.pow(r.y()-f.y,2));m=f.x<r.x()?-1:1,g=r.y()<f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,r.x(f.x-e),r.y(f.y+n)}v=r.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(r.y());else if("bottom-right"===this._movingAnchorName){if(u){f=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(r.x()-f.x,2)+Math.pow(r.y()-f.y,2));m=this.findOne(".bottom-right").x()<f.x?-1:1,g=this.findOne(".bottom-right").y()<f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,this.findOne(".bottom-right").x(f.x+e),this.findOne(".bottom-right").y(f.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(p=this.centeredScaling()||t.altKey){const t=this.findOne(".top-left"),e=this.findOne(".bottom-right"),n=t.x(),i=t.y(),r=this.getWidth()-e.x(),s=this.getHeight()-e.y();e.move({x:-n,y:-i}),t.move({x:r,y:s})}const y=this.findOne(".top-left").getAbsolutePosition();e=y.x,n=y.y;const x=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),S=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:n,width:x,height:S,rotation:a.Konva.getAngle(this.rotation())},t)}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){var e;if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const n=this.getNode();v--,this._fire("transformend",{evt:t,target:n}),null===(e=this.getLayer())||void 0===e||e.batchDraw(),n&&this._nodes.forEach((e=>{var n;e._fire("transformend",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this._movingAnchorName=null}}_fitNodesInto(e,n){const i=this._getNodeRect();if(t.Util._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(t.Util._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=new t.Transform;if(r.rotate(a.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=r.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=r.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=r.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=r.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 n=this.boundBoxFunc()(i,e);n?e=n:t.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,o=new t.Transform;o.translate(i.x,i.y),o.rotate(i.rotation),o.scale(i.width/s,i.height/s);const l=new t.Transform,h=e.width/s,c=e.height/s;!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(h),Math.abs(c))):(l.translate(e.x,e.y),l.rotate(e.rotation),l.scale(h,c));const d=l.multiply(o.invert());this._nodes.forEach((e=>{var n;const i=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());const s=new t.Transform;s.multiply(i.copy().invert()).multiply(d).multiply(i).multiply(r);const a=s.decompose();e.setAttrs(a),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(t.Util._getRotation(e.rotation)),this._nodes.forEach((t=>{this._fire("transform",{evt:n,target:t}),t._fire("transform",{evt:n,target:t})})),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var e;const n=this._getNodeRect();this.rotation(t.Util._getRotation(n.rotation));const i=n.width,r=n.height,s=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),l=this.anchorSize(),h=this.find("._anchor");h.forEach((t=>{t.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+o,offsetY:l/2+o,visible:a&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:l/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:l/2-o,offsetY:l/2+o,visible:a&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:l/2+o,visible:a&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:r/2,offsetX:l/2-o,visible:a&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:l/2+o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:r,offsetY:l/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:r,offsetX:l/2-o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:i/2,y:-this.rotateAnchorOffset()*t.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&h.forEach((t=>{c(t)})),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),s.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return n.Node.prototype.toObject.call(this)}clone(t){return n.Node.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};return Jt.Transformer=y,y.isTransforming=()=>v>0,y.prototype.className="Transformer",(0,l._registerNode)(y),e.Factory.addGetterSetter(y,"enabledAnchors",m,(function(e){return e instanceof Array||t.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===m.indexOf(e)&&t.Util.warn("Unknown anchor name: "+e+". Available names are: "+m.join(", "))})),e||[]})),e.Factory.addGetterSetter(y,"flipEnabled",!0,(0,o.getBooleanValidator)()),e.Factory.addGetterSetter(y,"resizeEnabled",!0),e.Factory.addGetterSetter(y,"anchorSize",10,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"rotateEnabled",!0),e.Factory.addGetterSetter(y,"rotateLineVisible",!0),e.Factory.addGetterSetter(y,"rotationSnaps",[]),e.Factory.addGetterSetter(y,"rotateAnchorOffset",50,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"rotateAnchorCursor","crosshair"),e.Factory.addGetterSetter(y,"rotationSnapTolerance",5,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"borderEnabled",!0),e.Factory.addGetterSetter(y,"anchorStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(y,"anchorStrokeWidth",1,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"anchorFill","white"),e.Factory.addGetterSetter(y,"anchorCornerRadius",0,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"borderStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(y,"borderStrokeWidth",1,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"borderDash"),e.Factory.addGetterSetter(y,"keepRatio",!0),e.Factory.addGetterSetter(y,"shiftBehavior","default"),e.Factory.addGetterSetter(y,"centeredScaling",!1),e.Factory.addGetterSetter(y,"ignoreStroke",!1),e.Factory.addGetterSetter(y,"padding",0,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"nodes"),e.Factory.addGetterSetter(y,"node"),e.Factory.addGetterSetter(y,"boundBoxFunc"),e.Factory.addGetterSetter(y,"anchorDragBoundFunc"),e.Factory.addGetterSetter(y,"anchorStyleFunc"),e.Factory.addGetterSetter(y,"shouldOverdrawWholeArea",!1),e.Factory.addGetterSetter(y,"useSingleNodeRotation",!0),e.Factory.backCompat(y,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"}),Jt}var te,ee={};var ne,ie={};function re(){if(ne)return ie;ne=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.Blur=void 0;const t=L(),e=H(),n=P();function i(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const r=[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];return ie.Blur=function(t){const e=Math.round(this.blurRadius());e>0&&function(t,e){const n=t.data,a=t.width,o=t.height;let l,h,c,d,u,p,f,m,g,_,v,y,x,S,b,M,w,E,T,A,C,R,P,L;const I=e+e+1,D=a-1,N=o-1,U=e+1,O=U*(U+1)/2,F=new i,k=r[e],B=s[e];let z=null,G=F,H=null,V=null;for(c=1;c<I;c++)G=G.next=new i,c===U&&(z=G);for(G.next=F,f=p=0,h=0;h<o;h++){for(M=w=E=T=m=g=_=v=0,y=U*(A=n[p]),x=U*(C=n[p+1]),S=U*(R=n[p+2]),b=U*(P=n[p+3]),m+=O*A,g+=O*C,_+=O*R,v+=O*P,G=F,c=0;c<U;c++)G.r=A,G.g=C,G.b=R,G.a=P,G=G.next;for(c=1;c<U;c++)d=p+((D<c?D:c)<<2),m+=(G.r=A=n[d])*(L=U-c),g+=(G.g=C=n[d+1])*L,_+=(G.b=R=n[d+2])*L,v+=(G.a=P=n[d+3])*L,M+=A,w+=C,E+=R,T+=P,G=G.next;for(H=F,V=z,l=0;l<a;l++)n[p+3]=P=v*k>>B,0!==P?(P=255/P,n[p]=(m*k>>B)*P,n[p+1]=(g*k>>B)*P,n[p+2]=(_*k>>B)*P):n[p]=n[p+1]=n[p+2]=0,m-=y,g-=x,_-=S,v-=b,y-=H.r,x-=H.g,S-=H.b,b-=H.a,d=f+((d=l+e+1)<D?d:D)<<2,M+=H.r=n[d],w+=H.g=n[d+1],E+=H.b=n[d+2],T+=H.a=n[d+3],m+=M,g+=w,_+=E,v+=T,H=H.next,y+=A=V.r,x+=C=V.g,S+=R=V.b,b+=P=V.a,M-=A,w-=C,E-=R,T-=P,V=V.next,p+=4;f+=a}for(l=0;l<a;l++){for(w=E=T=M=g=_=v=m=0,p=l<<2,y=U*(A=n[p]),x=U*(C=n[p+1]),S=U*(R=n[p+2]),b=U*(P=n[p+3]),m+=O*A,g+=O*C,_+=O*R,v+=O*P,G=F,c=0;c<U;c++)G.r=A,G.g=C,G.b=R,G.a=P,G=G.next;for(u=a,c=1;c<=e;c++)p=u+l<<2,m+=(G.r=A=n[p])*(L=U-c),g+=(G.g=C=n[p+1])*L,_+=(G.b=R=n[p+2])*L,v+=(G.a=P=n[p+3])*L,M+=A,w+=C,E+=R,T+=P,G=G.next,c<N&&(u+=a);for(p=l,H=F,V=z,h=0;h<o;h++)d=p<<2,n[d+3]=P=v*k>>B,P>0?(P=255/P,n[d]=(m*k>>B)*P,n[d+1]=(g*k>>B)*P,n[d+2]=(_*k>>B)*P):n[d]=n[d+1]=n[d+2]=0,m-=y,g-=x,_-=S,v-=b,y-=H.r,x-=H.g,S-=H.b,b-=H.a,d=l+((d=h+U)<N?d:N)*a<<2,m+=M+=H.r=n[d],g+=w+=H.g=n[d+1],_+=E+=H.b=n[d+2],v+=T+=H.a=n[d+3],H=H.next,y+=A=V.r,x+=C=V.g,S+=R=V.b,b+=P=V.a,M-=A,w-=C,E-=R,T-=P,V=V.next,p+=a}}(t,e)},t.Factory.addGetterSetter(e.Node,"blurRadius",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ie}var se,ae={};var oe,le={};var he,ce={};var de,ue={};var pe,fe={};var me,ge={};var _e,ve={};var ye,xe={};var Se,be={};function Me(){if(Se)return be;Se=1,Object.defineProperty(be,"__esModule",{value:!0}),be.Kaleidoscope=void 0;const t=L(),e=H(),n=w(),i=P();return be.Kaleidoscope=function(t){const e=t.width,i=t.height;let r,s,a,o,l,h,c,d,u,p,f=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),g=Math.floor(e*(m%360)/360);if(f<1)return;const _=n.Util.createCanvasElement();_.width=e,_.height=i;const v=_.getContext("2d").getImageData(0,0,e,i);n.Util.releaseCanvas(_),function(t,e,n){const i=t.data,r=e.data,s=t.width,a=t.height,o=n.polarCenterX||s/2,l=n.polarCenterY||a/2;let h=Math.sqrt(o*o+l*l),c=s-o,d=a-l;const u=Math.sqrt(c*c+d*d);h=u>h?u:h;const p=a,f=s,m=360/f*Math.PI/180;for(let t=0;t<f;t+=1){const e=Math.sin(t*m),n=Math.cos(t*m);for(let a=0;a<p;a+=1){c=Math.floor(o+h*a/p*n),d=Math.floor(l+h*a/p*e);let u=4*(d*s+c);const f=i[u+0],m=i[u+1],g=i[u+2],_=i[u+3];u=4*(t+a*s),r[u+0]=f,r[u+1]=m,r[u+2]=g,r[u+3]=_}}}(t,v,{polarCenterX:e/2,polarCenterY:i/2});let y=e/Math.pow(2,f);for(;y<=8;)y*=2,f-=1;y=Math.ceil(y);let x=y,S=0,b=x,M=1;for(g+y>e&&(S=x,b=0,M=-1),s=0;s<i;s+=1)for(r=S;r!==b;r+=M)a=Math.round(r+g)%e,u=4*(e*s+a),l=v.data[u+0],h=v.data[u+1],c=v.data[u+2],d=v.data[u+3],p=4*(e*s+r),v.data[p+0]=l,v.data[p+1]=h,v.data[p+2]=c,v.data[p+3]=d;for(s=0;s<i;s+=1)for(x=Math.floor(y),o=0;o<f;o+=1){for(r=0;r<x+1;r+=1)u=4*(e*s+r),l=v.data[u+0],h=v.data[u+1],c=v.data[u+2],d=v.data[u+3],p=4*(e*s+2*x-r-1),v.data[p+0]=l,v.data[p+1]=h,v.data[p+2]=c,v.data[p+3]=d;x*=2}!function(t,e,n){const i=t.data,r=e.data,s=t.width,a=t.height,o=n.polarCenterX||s/2,l=n.polarCenterY||a/2;let h=Math.sqrt(o*o+l*l),c=s-o,d=a-l;const u=Math.sqrt(c*c+d*d);h=u>h?u:h;const p=a,f=s;let m,g;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1){const t=c-o,e=d-l,n=Math.sqrt(t*t+e*e)*p/h;let a=(180*Math.atan2(e,t)/Math.PI+360+0)%360;a=a*f/360,m=Math.floor(a),g=Math.floor(n);let u=4*(g*s+m);const _=i[u+0],v=i[u+1],y=i[u+2],x=i[u+3];u=4*(d*s+c),r[u+0]=_,r[u+1]=v,r[u+2]=y,r[u+3]=x}}(v,t,{})},t.Factory.addGetterSetter(e.Node,"kaleidoscopePower",2,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"kaleidoscopeAngle",0,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),be}var we,Ee={};function Te(){if(we)return Ee;we=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.Mask=void 0;const t=L(),e=H(),n=P();function i(t,e,n){let i=4*(n*t.width+e);const r=[];return r.push(t.data[i++],t.data[i++],t.data[i++],t.data[i++]),r}function r(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}return Ee.Mask=function(t){let e=function(t,e){const n=i(t,0,0),s=i(t,t.width-1,0),a=i(t,0,t.height-1),o=i(t,t.width-1,t.height-1),l=e||10;if(r(n,s)<l&&r(s,o)<l&&r(o,a)<l&&r(a,n)<l){const e=function(t){const e=[0,0,0];for(let n=0;n<t.length;n++)e[0]+=t[n][0],e[1]+=t[n][1],e[2]+=t[n][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}([s,n,o,a]),i=[];for(let n=0;n<t.width*t.height;n++){const s=r(e,[t.data[4*n],t.data[4*n+1],t.data[4*n+2]]);i[n]=s<l?0:255}return i}}(t,this.threshold());return e&&(e=function(t,e,n){const i=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[];for(let o=0;o<n;o++)for(let l=0;l<e;l++){const h=o*e+l;let c=0;for(let a=0;a<r;a++)for(let h=0;h<r;h++){const d=o+a-s,u=l+h-s;if(d>=0&&d<n&&u>=0&&u<e){const n=i[a*r+h];c+=t[d*e+u]*n}}a[h]=2040===c?255:0}return a}(e,t.width,t.height),e=function(t,e,n){const i=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[];for(let o=0;o<n;o++)for(let l=0;l<e;l++){const h=o*e+l;let c=0;for(let a=0;a<r;a++)for(let h=0;h<r;h++){const d=o+a-s,u=l+h-s;if(d>=0&&d<n&&u>=0&&u<e){const n=i[a*r+h];c+=t[d*e+u]*n}}a[h]=c>=1020?255:0}return a}(e,t.width,t.height),e=function(t,e,n){const i=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[];for(let o=0;o<n;o++)for(let l=0;l<e;l++){const h=o*e+l;let c=0;for(let a=0;a<r;a++)for(let h=0;h<r;h++){const d=o+a-s,u=l+h-s;if(d>=0&&d<n&&u>=0&&u<e){const n=i[a*r+h];c+=t[d*e+u]*n}}a[h]=c}return a}(e,t.width,t.height),function(t,e){for(let n=0;n<t.width*t.height;n++)t.data[4*n+3]=e[n]}(t,e)),t},t.Factory.addGetterSetter(e.Node,"threshold",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ee}var Ae,Ce={};var Re,Pe={};var Le,Ie={};var De,Ne={};var Ue,Oe={};var Fe,ke={};var Be,ze={};var Ge,He,Ve={};function We(){if(He)return v;He=1,Object.defineProperty(v,"__esModule",{value:!0}),v.Konva=void 0;const t=ft(),e=function(){if(mt)return gt;mt=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.Arc=void 0;const t=L(),e=et(),n=S(),i=P(),r=S();let s=class extends e.Shape{_sceneFunc(t){const e=n.Konva.getAngle(this.angle()),i=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,i),t.arc(0,0,this.innerRadius(),e,0,!i),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),i=this.clockwise(),r=n.Konva.getAngle(i?360-this.angle():this.angle()),s=Math.cos(Math.min(r,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),o=Math.sin(Math.min(r,Math.PI/2)),l=s*(s>0?t:e),h=a*(a>0?t:e),c=o*(o>0?e:t);return{x:l,y:i?-1*c:h,width:1*e-l,height:c-h}}};return gt.Arc=s,s.prototype._centroid=!0,s.prototype.className="Arc",s.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],(0,r._registerNode)(s),t.Factory.addGetterSetter(s,"innerRadius",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"outerRadius",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"angle",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"clockwise",!1,(0,i.getBooleanValidator)()),gt}(),n=function(){if(Mt)return vt;Mt=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.Arrow=void 0;const t=L(),e=xt(),n=P(),i=S(),r=Tt();let s=class extends e.Line{_sceneFunc(t){super._sceneFunc(t);const e=2*Math.PI,n=this.points();let i=n;const s=0!==this.tension()&&n.length>4;s&&(i=this.getTensionPoints());const a=this.pointerLength(),o=n.length;let l,h;if(s){const t=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],n[o-2],n[o-1]],e=r.Path.calcLength(i[i.length-4],i[i.length-3],"C",t),s=r.Path.getPointOnQuadraticBezier(Math.min(1,1-a/e),t[0],t[1],t[2],t[3],t[4],t[5]);l=n[o-2]-s.x,h=n[o-1]-s.y}else l=n[o-2]-n[o-4],h=n[o-1]-n[o-3];const c=(Math.atan2(h,l)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(n[o-2],n[o-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(n[0],n[1]),s?(l=(i[0]+i[2])/2-n[0],h=(i[1]+i[3])/2-n[1]):(l=n[2]-n[0],h=n[3]-n[1]),t.rotate((Math.atan2(-h,-l)+e)%e),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){const e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x,y:t.y-e,width:t.width,height:t.height+2*e}}};return vt.Arrow=s,s.prototype.className="Arrow",(0,i._registerNode)(s),t.Factory.addGetterSetter(s,"pointerLength",10,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"pointerWidth",10,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"pointerAtBeginning",!1),t.Factory.addGetterSetter(s,"pointerAtEnding",!0),vt}(),i=function(){if(At)return Ct;At=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.Circle=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};return Ct.Circle=r,r.prototype._centroid=!0,r.prototype.className="Circle",r.prototype._attrsAffectingSize=["radius"],(0,i._registerNode)(r),t.Factory.addGetterSetter(r,"radius",0,(0,n.getNumberValidator)()),Ct}(),r=function(){if(Rt)return Pt;Rt=1,Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.Ellipse=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){const e=this.radiusX(),n=this.radiusY();t.beginPath(),t.save(),e!==n&&t.scale(1,n/e),t.arc(0,0,e,0,2*Math.PI,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}};return Pt.Ellipse=r,r.prototype.className="Ellipse",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,i._registerNode)(r),t.Factory.addComponentsGetterSetter(r,"radius",["x","y"]),t.Factory.addGetterSetter(r,"radiusX",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"radiusY",0,(0,n.getNumberValidator)()),Pt}(),s=function(){if(Lt)return It;Lt=1,Object.defineProperty(It,"__esModule",{value:!0}),It.Image=void 0;const t=w(),e=L(),n=et(),i=S(),r=P();class s extends n.Shape{constructor(t){super(t),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",(t=>{this._removeImageLoad(t.oldVal),this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&4===t.readyState||t&&t.addEventListener&&t.addEventListener("load",this._loadListener)}_removeImageLoad(t){t&&t.removeEventListener&&t.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const t=!!this.cornerRadius(),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),i=this.getHeight(),r=this.cornerRadius(),s=this.attrs.image;let a;if(s){const t=this.attrs.cropWidth,e=this.attrs.cropHeight;a=t&&e?[s,this.cropX(),this.cropY(),t,e,0,0,n,i]:[s,0,0,n,i]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?t.Util.drawRoundedRectPath(e,n,i,r):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)),s&&(r&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){const n=this.width(),i=this.height(),r=this.cornerRadius();e.beginPath(),r?t.Util.drawRoundedRectPath(e,n,i,r):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}getWidth(){var t,e;return null!==(t=this.attrs.width)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.width}getHeight(){var t,e;return null!==(t=this.attrs.height)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.height}static fromURL(e,n,i=null){const r=t.Util.createImageElement();r.onload=function(){const t=new s({image:r});n(t)},r.onerror=i,r.crossOrigin="Anonymous",r.src=e}}return It.Image=s,s.prototype.className="Image",(0,i._registerNode)(s),e.Factory.addGetterSetter(s,"cornerRadius",0,(0,r.getNumberOrArrayOfNumbersValidator)(4)),e.Factory.addGetterSetter(s,"image"),e.Factory.addComponentsGetterSetter(s,"crop",["x","y","width","height"]),e.Factory.addGetterSetter(s,"cropX",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(s,"cropY",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(s,"cropWidth",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(s,"cropHeight",0,(0,r.getNumberValidator)()),It}(),a=function(){if(Dt)return Nt;Dt=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.Tag=Nt.Label=void 0;const t=L(),e=et(),n=ot(),i=P(),r=S(),s=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],a="up",o="right",l="down",h="left",c=s.length;let d=class extends n.Group{constructor(t){super(t),this.on("add.konva",(function(t){this._addListeners(t.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){let e,n=this;const i=function(){n._sync()};for(e=0;e<c;e++)t.on(s[e]+"Change.konva",i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let t,e,n,i,r,s,c,d=this.getText(),u=this.getTag();if(d&&u){switch(t=d.width(),e=d.height(),n=u.pointerDirection(),i=u.pointerWidth(),c=u.pointerHeight(),r=0,s=0,n){case a:r=t/2,s=-1*c;break;case o:r=t+i,s=e/2;break;case l:r=t/2,s=e+c;break;case h:r=-1*i,s=e/2}u.setAttrs({x:-1*r,y:-1*s,width:t,height:e}),d.setAttrs({x:-1*r,y:-1*s})}}};Nt.Label=d,d.prototype.className="Label",(0,r._registerNode)(d);class u extends e.Shape{_sceneFunc(t){const e=this.width(),n=this.height(),i=this.pointerDirection(),r=this.pointerWidth(),s=this.pointerHeight(),c=this.cornerRadius();let d=0,u=0,p=0,f=0;"number"==typeof c?d=u=p=f=Math.min(c,e/2,n/2):(d=Math.min(c[0]||0,e/2,n/2),u=Math.min(c[1]||0,e/2,n/2),f=Math.min(c[2]||0,e/2,n/2),p=Math.min(c[3]||0,e/2,n/2)),t.beginPath(),t.moveTo(d,0),i===a&&(t.lineTo((e-r)/2,0),t.lineTo(e/2,-1*s),t.lineTo((e+r)/2,0)),t.lineTo(e-u,0),t.arc(e-u,u,u,3*Math.PI/2,0,!1),i===o&&(t.lineTo(e,(n-s)/2),t.lineTo(e+r,n/2),t.lineTo(e,(n+s)/2)),t.lineTo(e,n-f),t.arc(e-f,n-f,f,0,Math.PI/2,!1),i===l&&(t.lineTo((e+r)/2,n),t.lineTo(e/2,n+s),t.lineTo((e-r)/2,n)),t.lineTo(p,n),t.arc(p,n-p,p,Math.PI/2,Math.PI,!1),i===h&&(t.lineTo(0,(n+s)/2),t.lineTo(-1*r,n/2),t.lineTo(0,(n-s)/2)),t.lineTo(0,d),t.arc(d,d,d,Math.PI,3*Math.PI/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){let t=0,e=0,n=this.pointerWidth(),i=this.pointerHeight(),r=this.pointerDirection(),s=this.width(),c=this.height();return r===a?(e-=i,c+=i):r===l?c+=i:r===h?(t-=1.5*n,s+=n):r===o&&(s+=1.5*n),{x:t,y:e,width:s,height:c}}}return Nt.Tag=u,u.prototype.className="Tag",(0,r._registerNode)(u),t.Factory.addGetterSetter(u,"pointerDirection","none"),t.Factory.addGetterSetter(u,"pointerWidth",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(u,"pointerHeight",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(u,"cornerRadius",0,(0,i.getNumberOrArrayOfNumbersValidator)(4)),Nt}(),o=xt(),l=Tt(),h=Ft(),c=function(){if(kt)return Bt;kt=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.RegularPolygon=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,n=[];for(let i=0;i<t;i++)n.push({x:e*Math.sin(2*i*Math.PI/t),y:-1*e*Math.cos(2*i*Math.PI/t)});return n}getSelfRect(){const t=this._getPoints();let e=t[0].x,n=t[0].y,i=t[0].x,r=t[0].y;return t.forEach((t=>{e=Math.min(e,t.x),n=Math.max(n,t.x),i=Math.min(i,t.y),r=Math.max(r,t.y)})),{x:e,y:i,width:n-e,height:r-i}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}};return Bt.RegularPolygon=r,r.prototype.className="RegularPolygon",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["radius"],(0,i._registerNode)(r),t.Factory.addGetterSetter(r,"radius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"sides",0,(0,n.getNumberValidator)()),Bt}(),d=function(){if(zt)return Gt;zt=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Ring=void 0;const t=L(),e=et(),n=P(),i=S(),r=2*Math.PI;let s=class extends e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,r,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),r,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}};return Gt.Ring=s,s.prototype.className="Ring",s.prototype._centroid=!0,s.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,i._registerNode)(s),t.Factory.addGetterSetter(s,"innerRadius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"outerRadius",0,(0,n.getNumberValidator)()),Gt}(),u=function(){if(Ht)return Vt;Ht=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.Sprite=void 0;const t=L(),e=et(),n=ct(),i=P(),r=S();class s extends e.Shape{constructor(t){super(t),this._updated=!0,this.anim=new n.Animation((()=>{const t=this._updated;return this._updated=!1,t})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(t){const e=this.animation(),n=this.frameIndex(),i=4*n,r=this.animations()[e],s=this.frameOffsets(),a=r[i+0],o=r[i+1],l=r[i+2],h=r[i+3],c=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,l,h),t.closePath(),t.fillStrokeShape(this)),c)if(s){const i=s[e],r=2*n;t.drawImage(c,a,o,l,h,i[r+0],i[r+1],l,h)}else t.drawImage(c,a,o,l,h,0,0,l,h)}_hitFunc(t){const e=this.animation(),n=this.frameIndex(),i=4*n,r=this.animations()[e],s=this.frameOffsets(),a=r[i+2],o=r[i+3];if(t.beginPath(),s){const i=s[e],r=2*n;t.rect(i[r+0],i[r+1],a,o)}else t.rect(0,0,a,o);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const t=this;this.interval=setInterval((function(){t._updateIndex()}),1e3/this.frameRate())}start(){if(this.isRunning())return;const t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const t=this.frameIndex(),e=this.animation();t<this.animations()[e].length/4-1?this.frameIndex(t+1):this.frameIndex(0)}}return Vt.Sprite=s,s.prototype.className="Sprite",(0,r._registerNode)(s),t.Factory.addGetterSetter(s,"animation"),t.Factory.addGetterSetter(s,"animations"),t.Factory.addGetterSetter(s,"frameOffsets"),t.Factory.addGetterSetter(s,"image"),t.Factory.addGetterSetter(s,"frameIndex",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"frameRate",17,(0,i.getNumberValidator)()),t.Factory.backCompat(s,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"}),Vt}(),p=function(){if(Wt)return Xt;Wt=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Star=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){const e=this.innerRadius(),n=this.outerRadius(),i=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(let r=1;r<2*i;r++){const s=r%2==0?n:e,a=s*Math.sin(r*Math.PI/i),o=-1*s*Math.cos(r*Math.PI/i);t.lineTo(a,o)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}};return Xt.Star=r,r.prototype.className="Star",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,i._registerNode)(r),t.Factory.addGetterSetter(r,"numPoints",5,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"innerRadius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"outerRadius",0,(0,n.getNumberValidator)()),Xt}(),f=qt(),m=function(){if(Kt)return Zt;Kt=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.TextPath=void 0;const t=w(),e=L(),n=et(),i=Tt(),r=qt(),s=P(),a=S(),o="normal";function l(t){t.fillText(this.partialText,0,0)}function h(t){t.strokeText(this.partialText,0,0)}let c=class extends n.Shape{constructor(e){super(e),this.dummyCanvas=t.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 i.Path.getPathLength(this.dataArray)}_getPointAtLength(t){return this.attrs.data?t-1>this.pathLength?null:i.Path.getPointAtLengthOfDataArray(t,this.dataArray):null}_readDataAttribute(){this.dataArray=i.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();const e=this.textDecoration(),n=this.fill(),i=this.fontSize(),r=this.glyphInfo;"underline"===e&&t.beginPath();for(let n=0;n<r.length;n++){t.save();const s=r[n].p0;t.translate(s.x,s.y),t.rotate(r[n].rotation),this.partialText=r[n].text,t.fillStrokeShape(this),"underline"===e&&(0===n&&t.moveTo(0,i/2+1),t.lineTo(i,i/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=n,t.lineWidth=i/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();const e=this.glyphInfo;if(e.length>=1){const n=e[0].p0;t.moveTo(n.x,n.y)}for(let n=0;n<e.length;n++){const i=e[n].p1;t.lineTo(i.x,i.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return t.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return r.Text.prototype.setText.call(this,t)}_getContextFont(){return r.Text.prototype._getContextFont.call(this)}_getTextSize(t){const e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();const n=e.measureText(t);return e.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const n=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);let l=0;"center"===s&&(l=Math.max(0,this.pathLength/2-o/2)),"right"===s&&(l=Math.max(0,this.pathLength-o));const h=(0,r.stringToArray)(this.text());let c=l;for(let t=0;t<h.length;t++){const e=this._getPointAtLength(c);if(!e)return;let r=this._getTextSize(h[t]).width+n;if(" "===h[t]&&"justify"===s){const t=this.text().split(" ").length-1;r+=(this.pathLength-o)/t}const l=this._getPointAtLength(c+r);if(!l)return;const d=i.Path.getLineLength(e.x,e.y,l.x,l.y);let u=0;if(a)try{u=a(h[t-1],h[t])*this.fontSize()}catch(t){u=0}e.x+=u,l.x+=u,this.textWidth+=u;const p=i.Path.getPointOnLine(u+d/2,e.x,e.y,l.x,l.y),f=Math.atan2(l.y-e.y,l.x-e.x);this.glyphInfo.push({transposeX:p.x,transposeY:p.y,text:h[t],rotation:f,p0:e,p1:l}),c+=r}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const t=[];this.glyphInfo.forEach((function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)}));let e,n,i=t[0]||0,r=t[0]||0,s=t[1]||0,a=t[1]||0;for(let o=0;o<t.length/2;o++)e=t[2*o],n=t[2*o+1],i=Math.min(i,e),r=Math.max(r,e),s=Math.min(s,n),a=Math.max(a,n);const o=this.fontSize();return{x:i-o/2,y:s-o/2,width:r-i+o,height:a-s+o}}destroy(){return t.Util.releaseCanvas(this.dummyCanvas),super.destroy()}};return Zt.TextPath=c,c.prototype._fillFunc=l,c.prototype._strokeFunc=h,c.prototype._fillFuncHit=l,c.prototype._strokeFuncHit=h,c.prototype.className="TextPath",c.prototype._attrsAffectingSize=["text","fontSize","data"],(0,a._registerNode)(c),e.Factory.addGetterSetter(c,"data"),e.Factory.addGetterSetter(c,"fontFamily","Arial"),e.Factory.addGetterSetter(c,"fontSize",12,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(c,"fontStyle",o),e.Factory.addGetterSetter(c,"align","left"),e.Factory.addGetterSetter(c,"letterSpacing",0,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(c,"textBaseline","middle"),e.Factory.addGetterSetter(c,"fontVariant",o),e.Factory.addGetterSetter(c,"text",""),e.Factory.addGetterSetter(c,"textDecoration",""),e.Factory.addGetterSetter(c,"kerningFunc",void 0),Zt}(),g=$t(),_=function(){if(te)return ee;te=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.Wedge=void 0;const t=L(),e=et(),n=S(),i=P(),r=S();let s=class extends e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,n.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}};return ee.Wedge=s,s.prototype.className="Wedge",s.prototype._centroid=!0,s.prototype._attrsAffectingSize=["radius"],(0,r._registerNode)(s),t.Factory.addGetterSetter(s,"radius",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"angle",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"clockwise",!1),t.Factory.backCompat(s,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"}),ee}(),y=re(),x=function(){if(se)return ae;se=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.Brighten=void 0;const t=L(),e=H(),n=P();return ae.Brighten=function(t){const e=255*this.brightness(),n=t.data,i=n.length;for(let t=0;t<i;t+=4)n[t]+=e,n[t+1]+=e,n[t+2]+=e},t.Factory.addGetterSetter(e.Node,"brightness",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ae}(),b=function(){if(oe)return le;oe=1,Object.defineProperty(le,"__esModule",{value:!0}),le.Contrast=void 0;const t=L(),e=H(),n=P();return le.Contrast=function(t){const e=Math.pow((this.contrast()+100)/100,2),n=t.data,i=n.length;let r=150,s=150,a=150;for(let t=0;t<i;t+=4)r=n[t],s=n[t+1],a=n[t+2],r/=255,r-=.5,r*=e,r+=.5,r*=255,s/=255,s-=.5,s*=e,s+=.5,s*=255,a/=255,a-=.5,a*=e,a+=.5,a*=255,r=r<0?0:r>255?255:r,s=s<0?0:s>255?255:s,a=a<0?0:a>255?255:a,n[t]=r,n[t+1]=s,n[t+2]=a},t.Factory.addGetterSetter(e.Node,"contrast",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),le}(),M=function(){if(he)return ce;he=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.Emboss=void 0;const t=L(),e=H(),n=w(),i=P();return ce.Emboss=function(t){const e=10*this.embossStrength(),i=255*this.embossWhiteLevel(),r=this.embossDirection(),s=this.embossBlend(),a=t.data,o=t.width,l=t.height,h=4*o;let c=0,d=0,u=l;switch(r){case"top-left":c=-1,d=-1;break;case"top":c=-1,d=0;break;case"top-right":c=-1,d=1;break;case"right":c=0,d=1;break;case"bottom-right":c=1,d=1;break;case"bottom":c=1,d=0;break;case"bottom-left":c=1,d=-1;break;case"left":c=0,d=-1;break;default:n.Util.error("Unknown emboss direction: "+r)}do{const t=(u-1)*h;let n=c;u+n<1&&(n=0),u+n>l&&(n=0);const r=(u-1+n)*o*4;let p=o;do{const n=t+4*(p-1);let l=d;p+l<1&&(l=0),p+l>o&&(l=0);const h=r+4*(p-1+l),c=a[n]-a[h],u=a[n+1]-a[h+1],f=a[n+2]-a[h+2];let m=c;const g=m>0?m:-m;if((u>0?u:-u)>g&&(m=u),(f>0?f:-f)>g&&(m=f),m*=e,s){const t=a[n]+m,e=a[n+1]+m,i=a[n+2]+m;a[n]=t>255?255:t<0?0:t,a[n+1]=e>255?255:e<0?0:e,a[n+2]=i>255?255:i<0?0:i}else{let t=i-m;t<0?t=0:t>255&&(t=255),a[n]=a[n+1]=a[n+2]=t}}while(--p)}while(--u)},t.Factory.addGetterSetter(e.Node,"embossStrength",.5,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossWhiteLevel",.5,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossDirection","top-left",void 0,t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossBlend",!1,void 0,t.Factory.afterSetFilter),ce}(),E=function(){if(de)return ue;de=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.Enhance=void 0;const t=L(),e=H(),n=P();function i(t,e,n,i,r){const s=n-e,a=r-i;if(0===s)return i+a/2;if(0===a)return i;let o=(t-e)/s;return o=a*o+i,o}return ue.Enhance=function(t){const e=t.data,n=e.length;let r,s,a,o=e[0],l=o,h=e[1],c=h,d=e[2],u=d;const p=this.enhance();if(0===p)return;for(let t=0;t<n;t+=4)r=e[t+0],r<o?o=r:r>l&&(l=r),s=e[t+1],s<h?h=s:s>c&&(c=s),a=e[t+2],a<d?d=a:a>u&&(u=a);let f,m,g,_,v,y,x,S,b;l===o&&(l=255,o=0),c===h&&(c=255,h=0),u===d&&(u=255,d=0),p>0?(m=l+p*(255-l),g=o-p*(o-0),v=c+p*(255-c),y=h-p*(h-0),S=u+p*(255-u),b=d-p*(d-0)):(f=.5*(l+o),m=l+p*(l-f),g=o+p*(o-f),_=.5*(c+h),v=c+p*(c-_),y=h+p*(h-_),x=.5*(u+d),S=u+p*(u-x),b=d+p*(d-x));for(let t=0;t<n;t+=4)e[t+0]=i(e[t+0],o,l,g,m),e[t+1]=i(e[t+1],h,c,y,v),e[t+2]=i(e[t+2],d,u,b,S)},t.Factory.addGetterSetter(e.Node,"enhance",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ue}(),T=(pe||(pe=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.Grayscale=void 0,fe.Grayscale=function(t){const e=t.data,n=e.length;for(let t=0;t<n;t+=4){const n=.34*e[t]+.5*e[t+1]+.16*e[t+2];e[t]=n,e[t+1]=n,e[t+2]=n}}),fe),A=function(){if(me)return ge;me=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.HSL=void 0;const t=L(),e=H(),n=P();return t.Factory.addGetterSetter(e.Node,"hue",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"saturation",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"luminance",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ge.HSL=function(t){const e=t.data,n=e.length,i=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,s=127*this.luminance(),a=1*i*Math.cos(r*Math.PI/180),o=1*i*Math.sin(r*Math.PI/180),l=.299+.701*a+.167*o,h=.587-.587*a+.33*o,c=.114-.114*a-.497*o,d=.299-.299*a-.328*o,u=.587+.413*a+.035*o,p=.114-.114*a+.293*o,f=.299-.3*a+1.25*o,m=.587-.586*a-1.05*o,g=.114+.886*a-.2*o;let _,v,y,x;for(let t=0;t<n;t+=4)_=e[t+0],v=e[t+1],y=e[t+2],x=e[t+3],e[t+0]=l*_+h*v+c*y+s,e[t+1]=d*_+u*v+p*y+s,e[t+2]=f*_+m*v+g*y+s,e[t+3]=x},ge}(),C=function(){if(_e)return ve;_e=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.HSV=void 0;const t=L(),e=H(),n=P();return ve.HSV=function(t){const e=t.data,n=e.length,i=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=i*r*Math.cos(s*Math.PI/180),o=i*r*Math.sin(s*Math.PI/180),l=.299*i+.701*a+.167*o,h=.587*i-.587*a+.33*o,c=.114*i-.114*a-.497*o,d=.299*i-.299*a-.328*o,u=.587*i+.413*a+.035*o,p=.114*i-.114*a+.293*o,f=.299*i-.3*a+1.25*o,m=.587*i-.586*a-1.05*o,g=.114*i+.886*a-.2*o;let _,v,y,x;for(let t=0;t<n;t+=4)_=e[t+0],v=e[t+1],y=e[t+2],x=e[t+3],e[t+0]=l*_+h*v+c*y,e[t+1]=d*_+u*v+p*y,e[t+2]=f*_+m*v+g*y,e[t+3]=x},t.Factory.addGetterSetter(e.Node,"hue",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"saturation",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"value",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ve}(),R=(ye||(ye=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Invert=void 0,xe.Invert=function(t){const e=t.data,n=e.length;for(let t=0;t<n;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}),xe),I=Me(),D=Te(),N=function(){if(Ae)return Ce;Ae=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.Noise=void 0;const t=L(),e=H(),n=P();return Ce.Noise=function(t){const e=255*this.noise(),n=t.data,i=n.length,r=e/2;for(let t=0;t<i;t+=4)n[t+0]+=r-2*r*Math.random(),n[t+1]+=r-2*r*Math.random(),n[t+2]+=r-2*r*Math.random()},t.Factory.addGetterSetter(e.Node,"noise",.2,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ce}(),U=function(){if(Re)return Pe;Re=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.Pixelate=void 0;const t=L(),e=w(),n=H(),i=P();return Pe.Pixelate=function(t){let n,i,r,s,a,o,l,h,c,d,u,p,f,m,g=Math.ceil(this.pixelSize()),_=t.width,v=t.height,y=Math.ceil(_/g),x=Math.ceil(v/g),S=t.data;if(g<=0)e.Util.error("pixelSize value can not be <= 0");else for(p=0;p<y;p+=1)for(f=0;f<x;f+=1){for(s=0,a=0,o=0,l=0,h=p*g,c=h+g,d=f*g,u=d+g,m=0,n=h;n<c;n+=1)if(!(n>=_))for(i=d;i<u;i+=1)i>=v||(r=4*(_*i+n),s+=S[r+0],a+=S[r+1],o+=S[r+2],l+=S[r+3],m+=1);for(s/=m,a/=m,o/=m,l/=m,n=h;n<c;n+=1)if(!(n>=_))for(i=d;i<u;i+=1)i>=v||(r=4*(_*i+n),S[r+0]=s,S[r+1]=a,S[r+2]=o,S[r+3]=l)}},t.Factory.addGetterSetter(n.Node,"pixelSize",8,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),Pe}(),O=function(){if(Le)return Ie;Le=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.Posterize=void 0;const t=L(),e=H(),n=P();return Ie.Posterize=function(t){const e=Math.round(254*this.levels())+1,n=t.data,i=n.length,r=255/e;for(let t=0;t<i;t+=1)n[t]=Math.floor(n[t]/r)*r},t.Factory.addGetterSetter(e.Node,"levels",.5,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ie}(),F=function(){if(De)return Ne;De=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.RGB=void 0;const t=L(),e=H(),n=P();return Ne.RGB=function(t){const e=t.data,n=e.length,i=this.red(),r=this.green(),s=this.blue();for(let t=0;t<n;t+=4){const n=(.34*e[t]+.5*e[t+1]+.16*e[t+2])/255;e[t]=n*i,e[t+1]=n*r,e[t+2]=n*s,e[t+3]=e[t+3]}},t.Factory.addGetterSetter(e.Node,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"blue",0,n.RGBComponent,t.Factory.afterSetFilter),Ne}(),k=function(){if(Ue)return Oe;Ue=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.RGBA=void 0;const t=L(),e=H(),n=P();return Oe.RGBA=function(t){const e=t.data,n=e.length,i=this.red(),r=this.green(),s=this.blue(),a=this.alpha();for(let t=0;t<n;t+=4){const n=1-a;e[t]=i*a+e[t]*n,e[t+1]=r*a+e[t+1]*n,e[t+2]=s*a+e[t+2]*n}},t.Factory.addGetterSetter(e.Node,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"blue",0,n.RGBComponent,t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"alpha",1,(function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t})),Oe}(),B=(Fe||(Fe=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.Sepia=void 0,ke.Sepia=function(t){const e=t.data,n=e.length;for(let t=0;t<n;t+=4){const n=e[t+0],i=e[t+1],r=e[t+2];e[t+0]=Math.min(255,.393*n+.769*i+.189*r),e[t+1]=Math.min(255,.349*n+.686*i+.168*r),e[t+2]=Math.min(255,.272*n+.534*i+.131*r)}}),ke),z=(Be||(Be=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.Solarize=void 0,ze.Solarize=function(t){const e=t.data,n=t.width,i=4*n;let r=t.height;do{const t=(r-1)*i;let s=n;do{const n=t+4*(s-1);let i=e[n],r=e[n+1],a=e[n+2];i>127&&(i=255-i),r>127&&(r=255-r),a>127&&(a=255-a),e[n]=i,e[n+1]=r,e[n+2]=a}while(--s)}while(--r)}),ze),G=function(){if(Ge)return Ve;Ge=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.Threshold=void 0;const t=L(),e=H(),n=P();return Ve.Threshold=function(t){const e=255*this.threshold(),n=t.data,i=n.length;for(let t=0;t<i;t+=1)n[t]=n[t]<e?0:255},t.Factory.addGetterSetter(e.Node,"threshold",.5,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ve}();return v.Konva=t.Konva.Util._assign(t.Konva,{Arc:e.Arc,Arrow:n.Arrow,Circle:i.Circle,Ellipse:r.Ellipse,Image:s.Image,Label:a.Label,Tag:a.Tag,Line:o.Line,Path:l.Path,Rect:h.Rect,RegularPolygon:c.RegularPolygon,Ring:d.Ring,Sprite:u.Sprite,Star:p.Star,Text:f.Text,TextPath:m.TextPath,Transformer:g.Transformer,Wedge:_.Wedge,Filters:{Blur:y.Blur,Brighten:x.Brighten,Contrast:b.Contrast,Emboss:M.Emboss,Enhance:E.Enhance,Grayscale:T.Grayscale,HSL:A.HSL,HSV:C.HSV,Invert:R.Invert,Kaleidoscope:I.Kaleidoscope,Mask:D.Mask,Noise:N.Noise,Pixelate:U.Pixelate,Posterize:O.Posterize,RGB:F.RGB,RGBA:k.RGBA,Sepia:B.Sepia,Solarize:z.Solarize,Threshold:G.Threshold}}),v}var Xe,je=_.exports;var Ye=m(function(){if(Xe)return _.exports;Xe=1,Object.defineProperty(je,"__esModule",{value:!0});const t=We();return _.exports=t.Konva,_.exports}());class qe{screenToWorld(t){return{x:t.x,y:t.y,z:0}}worldToScreen(t){return{x:t.x,y:t.y}}getScale(){return{x:1,y:1,z:1}}}class Ke{constructor(t,e,n){this.setColor(t,e,n)}asHex(){return"#"+this.HEX}asRGB(){return{r:this.R,g:this.G,b:this.B}}setColor(t,e,n){this.R=t,this.G=e,this.B=n,this.HEX=this.rgbToHex(t,e,n)}rgbToHex(t,e,n){const i=t=>{const e=t.toString(16);return"0"===e?"00":e};return i(t)+i(e)+i(n)}}const Ze=new Map([["solid",[]],["dot",[30,30,.001,30]],["dash",[30,30]]]);class Qe{constructor(t,e=null){var n,i;if(e)return void(this._ref=e);t||(t={}),t.points||(t.points=[{x:0,y:0},{x:100,y:100}]);const r=[];t.points.forEach((t=>r.push(t.x,t.y))),this._ref=new Ye.Line({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",strokeWidth:null!==(i=t.width)&&void 0!==i?i:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",points:r,draggable:!0,strokeScaleEnabled:!1,dash:Ze.get(t.type)||[]}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation)})),this._ref.id(this._ref._id.toString())}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Line"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPoints(){return this._ref.points()}setLineWidth(t){this._ref.strokeWidth(t)}getLineWidth(){return this._ref.strokeWidth()}getLineType(){let t;switch(this._ref.dash()||[]){case Ze.get("dot"):t="dot";break;case Ze.get("dash"):t="dash";break;default:t="solid"}return t}setLineType(t){const e=Ze.get(t);e&&this._ref.dash(e)}addPoints(t){let e=this._ref.points();t.forEach((t=>{e=e.concat([t.x,t.y])})),this._ref.points(e)}}class Je{constructor(t,e=null){var n,i,r;this.TEXT_FONT_FAMILY="Calibri",e?this._ref=e:(t||(t={}),t.position||(t.position={x:0,y:0}),t.text||(t.text="default"),this._ref=new Ye.Text({x:t.position.x,y:t.position.y,text:t.text,fontSize:null!==(n=t.fontSize)&&void 0!==n?n:34,fontFamily:this.TEXT_FONT_FAMILY,fill:null!==(i=t.color)&&void 0!==i?i:"#ff0000",align:"left",draggable:!0,rotation:null!==(r=t.rotation)&&void 0!==r?r:0}),this._ref.width(this._ref.getTextWidth()),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY);r<50&&(r=50),s<Math.round(this.getFontSize())&&(s=Math.round(this.getFontSize())),n&&this._ref.width(r),i&&this._ref.height(s),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString()))}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Text"}getColor(){return this._ref.fill()}setColor(t){this._ref.fill(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getText(){return this._ref.text()}setText(t){this._ref.text(t)}getPosition(){return this._ref.getPosition()}setPosition(t,e){this._ref.setPosition({x:t,y:e})}getFontSize(){return this._ref.fontSize()}setFontSize(t){this._ref.fontSize(t)}}class $e{constructor(t,e=null){var n,i,r,s;e?this._ref=e:(t||(t={}),t.position||(t.position={x:0,y:0}),this._ref=new Ye.Rect({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",strokeWidth:null!==(i=t.lineWidth)&&void 0!==i?i:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",x:t.position.x,y:t.position.y,width:null!==(r=t.width)&&void 0!==r?r:200,height:null!==(s=t.height)&&void 0!==s?s:200,draggable:!0,strokeScaleEnabled:!1}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY);r<50&&(r=50),s<50&&(s=50),n&&this._ref.width(r),i&&this._ref.height(s),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString()))}getPosition(){return this._ref.position()}getWidth(){return this._ref.width()}getHeigth(){return this._ref.height()}setWidth(t){this._ref.width(t)}setHeight(t){this._ref.height(t)}setPosition(t,e){this._ref.setPosition({x:t,y:e})}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Rectangle"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}setLineWidth(t){this._ref.strokeWidth(t)}getLineWidth(){return this._ref.strokeWidth()}}class tn{constructor(t,e=null){var n,i;e?this._ref=e:(t||(t={}),t.position||(t.position={x:0,y:0}),t.radius||(t.radius={x:25,y:25}),this._ref=new Ye.Ellipse({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",strokeWidth:null!==(i=t.lineWidth)&&void 0!==i?i:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",x:t.position.x,y:t.position.y,radiusX:t.radius.x,radiusY:t.radius.y,draggable:!0,strokeScaleEnabled:!1}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.radiusX();n&&(r*=e.scaleX);let s=this._ref.radiusY();i&&(s*=e.scaleY);r<25&&(r=25),s<25&&(s=25),t.evt.ctrlKey||t.evt.shiftKey?n?this._ref.radius({x:r,y:r}):this._ref.radius({x:s,y:s}):this._ref.radius({x:r,y:s}),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString()))}getPosition(){return this._ref.position()}setPosition(t,e){this._ref.setPosition({x:t,y:e})}getRadiusX(){return this._ref.radiusX()}setRadiusX(t){this._ref.radiusX(t)}getRadiusY(){return this._ref.radiusY()}setRadiusY(t){this._ref.radiusY(t)}getLineWidth(){return this._ref.strokeWidth()}setLineWidth(t){this._ref.strokeWidth(t)}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Ellipse"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}}class en{constructor(t,e=null){var n,i;e?this._ref=e:(t||(t={}),t.start||(t.start={x:0,y:0}),t.end||(t.end={x:100,y:100}),this._ref=new Ye.Arrow({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",fill:null!==(i=t.color)&&void 0!==i?i:"#ff0000",strokeWidth:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",points:[t.start.x,t.start.y,t.end.x,t.end.y],draggable:!0,strokeScaleEnabled:!1}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation)})),this._ref.id(this._ref._id.toString()))}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Arrow"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t),this._ref.fill(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPoints(){const t=this._ref.points();return[{x:t[0],y:t[1]},{x:t[2],y:t[3]}]}setPoints(t){2===t.length&&this._ref.points([t[0].x,t[0].y,t[1].x,t[1].y])}getStartPoint(){const t=this._ref.points();return{x:t[0],y:t[1]}}setStartPoint(t,e){const n=this._ref.points();this._ref.points([t,e,n[2],n[3]])}getEndPoint(){const t=this._ref.points();return{x:t[2],y:t[3]}}setEndPoint(t,e){const n=this._ref.points();this._ref.points([n[0],n[1],t,e])}}class nn{constructor(t,e=null){var n,i;if(this._ratio=1,this.EPSILON=1e-5,this.BASE64_HEADER_START="data:image/",this.BASE64_NOT_FOUND="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADsAAAA7AF5KHG9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAmhJREFUWIXtlr9rVEEQxz+H8RQUJIdeIopYm0vkCg0GBBtbG1NF7Kxt7dR/IGIw/uhTaBNLERURg2kCEUyCYCPi70b0InjGS57FzOZN3r19d+9HJIVfWO52dma/s7Mz8xa2KAaBCWAR+AkECWOmSOIdwC1gtQOpHc+NfQ8wClQ8+1d0vcdH/lQ3bSIRGAZ2pTjAqNovANXIWlXlAXA2zvi2Ln4AjqYgtagYEutENSLvjRoOImFv5iB32Ae8UrLXwFBk3h9ndF0VJnKSO9gTu3yKu5Z1LKnS8YIcABgw5Ks692JZFXcXRJ46Aq6kikCnHNi/mQ50WwVtfaIoBzL3gRk2drSscJ2wrc4VvUoe2wn/41/iBfoVLRnBGnDSY3AAKacy8AmYR+o7K1zCl6wgrgpOAc/MuhvfgMuk+1JGHQgSBcAloKXy78AjYBppJk5/noTulseBMZ23iD/piHFkEdgTQzKk+5wHjmHC3cmBg0BD5xcSTrFXyQPgIWFtDwMvab+2N8DpbhyY1v/3E8gdDgNfVX9SCVZ0/gW4B0wB71S2BpxLcuCM/jaQSHSDEeAX4VMuAG4gTzyHbcAVXXO6GxxwIX+vvxe7JHcYQ07nHqklj96UIW/YhSWzMKcep8VVtf8B1Dw6h4DfhB+sdbgn2R+gnoEc5NR3dZ+3QJ9H74HqXLPCGlJyTfI9y3YCs0owq3OLOpKkLeBI1HhSDT/mdKIPiUCARMTlQx34TMLjtww8IczmO8AJ/N/2JNSQXAiQ671JePePge0+wzJSQq4FFzlaenIvucUAkiQLhC/mLGNZ9xgn5s63BP4CCk0QDtm4BhoAAAAASUVORK5CYII=",e)return e.src&&e.src.startsWith(this.BASE64_HEADER_START)||(e.src=this.BASE64_NOT_FOUND),e.height()<=this.EPSILON&&e.height(32),e.width()<=this.EPSILON&&e.width(32),this._ref=e,this._canvasImage=e.image(),void(this._ratio=this._ref.height()<=this.EPSILON||this._ref.width()<=this.EPSILON?1:this._ref.height()/this._ref.width());t||(t={}),t.position||(t.position={x:0,y:0}),t.src&&t.src.startsWith(this.BASE64_HEADER_START)||(t.src=this.BASE64_NOT_FOUND),this._canvasImage=new Image,this._canvasImage.onload=()=>{if(this._ref.image(this._canvasImage),this._ref.height()<=this.EPSILON&&this._ref.height(this._canvasImage.height),this._ref.width()<=this.EPSILON&&this._ref.width(this._canvasImage.width),this._ratio=this._ref.height()<=this.EPSILON||this._ref.width()<=this.EPSILON?1:this._ref.height()/this._ref.width(),(t.width<=this.EPSILON||t.height<=this.EPSILON)&&(t.maxWidth>=this.EPSILON||t.maxWidth>=this.EPSILON)){const e=t.maxHeight-this._canvasImage.height,n=t.maxWidth-this._canvasImage.width;(e<=this.EPSILON||n<=this.EPSILON)&&(n<=this.EPSILON&&n<e/this._ratio?(this._ref.height(t.maxWidth*this._ratio),this._ref.width(t.maxWidth)):(this._ref.width(t.maxHeight/this._ratio),this._ref.height(t.maxHeight)))}},this._canvasImage.onerror=()=>{this._canvasImage.onerror=function(){},this._canvasImage.src=this.BASE64_NOT_FOUND},this._canvasImage.src=t.src,this._ref=new Ye.Image({x:t.position.x,y:t.position.y,image:this._canvasImage,width:null!==(n=t.width)&&void 0!==n?n:0,height:null!==(i=t.height)&&void 0!==i?i:0,draggable:!0}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY),t.evt.ctrlKey||t.evt.shiftKey?n?(this._ref.width(r),this._ref.height(r*this._ratio)):(this._ref.width(s/this._ratio),this._ref.height(s)):(n&&this._ref.width(r),i&&this._ref.height(s)),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString())}getSrc(){return this._canvasImage.src}setSrc(t){this._canvasImage.src=t}getWidth(){return this._ref.width()}setWidth(t){this._ref.width(t),this._ref.height(t*this._ratio)}getHeight(){return this._ref.height()}setHeight(t){this._ref.height(t),this._ref.width(t/this._ratio)}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Image"}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPosition(){return this._ref.getPosition()}setPosition(t,e){this._ref.setPosition({x:t,y:e})}}class rn{constructor(t,e=null){var n,i,r,s;if(e)return void(this._ref=e);t||(t={}),t.position||(t.position={x:0,y:0});const a=16;this._ref=new Ye.Shape({x:t.position.x,y:t.position.y,width:null!==(n=t.width)&&void 0!==n?n:200,height:null!==(i=t.height)&&void 0!==i?i:200,stroke:null!==(r=t.color)&&void 0!==r?r:"#ff0000",strokeWidth:null!==(s=t.lineWidth)&&void 0!==s?s:4,draggable:!0,strokeScaleEnabled:!1,globalCompositeOperation:"source-over",sceneFunc:(t,e)=>{const n=[{x:0,y:0},{x:0+this._ref.width(),y:0},{x:0+this._ref.width(),y:0+this._ref.height()},{x:0,y:0+this._ref.height()},{x:0,y:0}],i=(r={x:0,y:0},s=this._ref.width(),o=this._ref.height(),{x:r.x+s/2,y:r.y+o/2});var r,s,o;t.beginPath();for(let e=0;e<n.length-1;e++){let r=30;const s=n[e+1].x-n[e].x,o=n[e+1].y-n[e].y,l=Math.sqrt(s*s+o*o),h=Math.floor(l/r);r=30+h/(l%r);let c=n[e].x+s/h/2,d=n[e].y+o/h/2;const u=n[e+1].x,p=n[e+1].y,f=Math.atan((p-d)/(u-c)),m=f+Math.PI,g=c>i.x&&d>i.y;for(let e=0;e<h;e++)g?t.arc(c,d,a,f,m):t.arc(c,d,a,m,f),c+=s/h,d+=o/h}t.closePath(),t.fillStrokeShape(e)}}),this._ref.className="Cloud",this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY);r<100&&(r=100),s<100&&(s=100),n&&this._ref.width(r),i&&this._ref.height(s),this._ref.scale({x:1,y:1})})),this._ref.getSelfRect=()=>({x:-16,y:-16,width:this._ref.width()+32,height:this._ref.height()+32}),this._ref.id(this._ref._id.toString())}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Cloud"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPosition(){return this._ref.position()}setPosition(t,e){this._ref.position({x:t,y:e})}getWidth(){return this._ref.width()}setWidth(t){this._ref.width(t)}getHeigth(){return this._ref.height()}setHeight(t){this._ref.height(t)}getLineWidth(){return this._ref.strokeWidth()}setLineWidth(t){this._ref.strokeWidth(t)}}const sn={SelectMarkup:{name:"SelectMarkup",initializer:null},Line:{name:"Line",initializer:(t,e=null)=>new Qe(e,t)},Text:{name:"Text",initializer:(t,e=null)=>new Je(e,t)},Rectangle:{name:"Rect",initializer:(t,e=null)=>new $e(e,t)},Ellipse:{name:"Ellipse",initializer:(t,e=null)=>new tn(e,t)},Arrow:{name:"Arrow",initializer:(t,e=null)=>new en(e,t)},Image:{name:"Image",initializer:(t,e=null)=>new nn(e,t)},Cloud:{name:"Cloud",initializer:(t,e=null)=>new rn(e,t)}};class an{constructor(){this._containerEvents=[],this._markupIsActive=!1,this._markupColor=new Ke(255,0,0),this.lineWidth=4,this.lineType="solid",this.fontSize=34,this.changeActiveDragger=t=>{const e=t.data;this._markupContainer.className=this._container.className.split(" ").filter((t=>!t.startsWith("oda-cursor-"))).filter((t=>t)).concat(`oda-cursor-${e.toLowerCase()}`).join(" "),this.removeTextInput(),this.removeImageInput(),this.enableEditMode(e)},this.resizeContainer=t=>{const{width:e,height:n}=t[0].contentRect;e&&n&&this._konvaStage&&(this._konvaStage.width(e),this._konvaStage.height(n))},this.pan=t=>{const e={x:this._konvaStage.x()+t.dX,y:this._konvaStage.y()+t.dY};this._konvaStage.position(e)},this.zoomAt=t=>{const e=this._konvaStage.scaleX()*t.data;this._konvaStage.scale({x:e,y:e});const n={x:t.x-(t.x-this._konvaStage.x())*t.data,y:t.y-(t.y-this._konvaStage.y())*t.data};this._konvaStage.position(n)},this.redirectToViewer=t=>{this._viewer&&this._viewer.emit(t)},this.getRelativePointPosition=(t,e)=>{const n=e.getAbsoluteTransform().copy();return n.invert(),n.point(t)},this.getRelativePointerPosition=t=>this.getRelativePointPosition(t.getStage().getPointerPosition(),t)}initialize(t,e,n,i){if(!Ye)throw new Error('Markup error: Konva is not initialized. Forgot to add <script src="https://unpkg.com/konva@9/konva.min.js"><\/script> to your page?');this._viewer=n,this._worldTransformer=null!=i?i:new qe,this._container=t,this._containerEvents=null!=e?e:[],this._markupContainer=document.createElement("div"),this._markupContainer.id="markup-container",this._markupContainer.style.position="absolute",this._markupContainer.style.top="0px",this._markupContainer.style.left="0px",this._markupContainer.style.outline="0px",this._markupContainer.style.pointerEvents="none";const r=this._container.parentElement;r.appendChild(this._markupContainer),this._resizeObserver=new ResizeObserver(this.resizeContainer),this._resizeObserver.observe(r),this._markupColor.setColor(255,0,0),this.initializeKonva(),this._viewer&&(this._viewer.addEventListener("changeactivedragger",this.changeActiveDragger),this._viewer.addEventListener("pan",this.pan),this._viewer.addEventListener("zoomat",this.zoomAt))}dispose(){var t,e;this._viewer&&(this._viewer.removeEventListener("zoomat",this.zoomAt),this._viewer.removeEventListener("pan",this.pan),this._viewer.removeEventListener("changeactivedragger",this.changeActiveDragger)),this.destroyKonva(),null===(t=this._resizeObserver)||void 0===t||t.disconnect(),this._resizeObserver=void 0,null===(e=this._markupContainer)||void 0===e||e.remove(),this._markupContainer=void 0,this._container=void 0,this._viewer=void 0,this._worldTransformer=void 0,this._markupIsActive=!1}syncOverlay(){}clearOverlay(){this.removeTextInput(),this.removeImageInput(),this.clearSelected(),this.getObjects().forEach((t=>t.delete()))}getMarkupColor(){return this._markupColor.asRGB()}setMarkupColor(t,e,n){this._markupColor.setColor(t,e,n),this.redirectToViewer({type:"changemarkupcolor",data:{r:t,g:e,b:n}})}colorizeAllMarkup(t,e,n){const i=new Ke(t,e,n).asHex();this.getObjects().filter((t=>{var e;return null===(e=t.setColor)||void 0===e?void 0:e.call(t,i)}))}colorizeSelectedMarkups(t,e,n){const i=new Ke(t,e,n).asHex();this.getSelectedObjects().filter((t=>{var e;return null===(e=t.setColor)||void 0===e?void 0:e.call(t,i)}))}setViewpoint(t){var e,n,i,r,s,a,o,l;this.clearSelected(),this.removeTextInput(),this.removeImageInput(),this._konvaStage.scale({x:1,y:1}),this._konvaStage.position({x:0,y:0});const h=(null===(e=t.custom_fields)||void 0===e?void 0:e.markup_color)||{r:255,g:0,b:0};this.setMarkupColor(h.r,h.g,h.b),null===(n=t.lines)||void 0===n||n.forEach((t=>{const e=[];t.points.forEach((t=>{const n=this._worldTransformer.worldToScreen(t);e.push(n.x),e.push(n.y)})),this.addLine(e,t.color,t.type,t.width,t.id)})),null===(i=t.texts)||void 0===i||i.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addText(t.text,e,t.angle,t.color,t.text_size,t.font_size,t.id)})),null===(r=t.rectangles)||void 0===r||r.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addRectangle(e,t.width,t.height,t.line_width,t.color,t.id)})),null===(s=t.ellipses)||void 0===s||s.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addEllipse(e,t.radius,t.line_width,t.color,t.id)})),null===(a=t.arrows)||void 0===a||a.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.start),n=this._worldTransformer.worldToScreen(t.end);this.addArrow(e,n,t.color,t.id)})),null===(o=t.clouds)||void 0===o||o.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addCloud(e,t.width,t.height,t.line_width,t.color,t.id)})),null===(l=t.images)||void 0===l||l.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addImage(e,t.src,t.width,t.height,t.id)}))}getViewpoint(t){return t||(t={}),t.lines=this.getMarkupLines(),t.texts=this.getMarkupTexts(),t.arrows=this.getMarkupArrows(),t.clouds=this.getMarkupClouds(),t.ellipses=this.getMarkupEllipses(),t.images=this.getMarkupImages(),t.rectangles=this.getMarkupRectangles(),t.custom_fields={markup_color:this.getMarkupColor()},t.snapshot={data:this.combineMarkupWithDrawing()},t}enableEditMode(t){return t&&sn[t]?(this._markupMode=t,this._markupContainer.style.pointerEvents="all",this._markupIsActive=!0):(this.clearSelected(),this.removeTextInput(),this.removeImageInput(),this._markupContainer.style.pointerEvents="none",this._markupIsActive=!1),this}createObject(t,e){const n=sn[t];if(!n||!n.initializer)throw new Error(`Markup CreateObject - unsupported markup type ${t}`);const i=n.initializer(null,e);return this.addObject(i),i}getObjects(){const t=[];return Object.keys(sn).forEach((e=>{const n=sn[e];this.konvaLayerFind(e).forEach((e=>t.push(n.initializer(e))))})),t}getSelectedObjects(){return this._konvaTransformer?this._konvaTransformer.nodes().map((t=>{const e=t.className,n=Object.values(sn).find((t=>t.name===e));return n?n.initializer(t):null})).filter((t=>t)):[]}selectObjects(t){if(!this._konvaTransformer)return;const e=this._konvaTransformer.nodes().concat(t.map((t=>t.ref())));this._konvaTransformer.nodes(e)}clearSelected(){this._konvaTransformer&&this._konvaTransformer.nodes([])}addObject(t){"Image"===t.type()?this._groupImages.add(t.ref()):"Text"===t.type()?this._groupTexts.add(t.ref()):this._groupGeometry.add(t.ref())}konvaLayerFind(t){if(!this._konvaLayer)return[];const e=sn[t];return e&&e.initializer?this._konvaLayer.find(e.name).filter((t=>t.parent===this._konvaLayer||t.parent===this._groupImages||t.parent===this._groupGeometry||t.parent===this._groupTexts)):[]}initializeKonva(){const t=new Ye.Stage({container:this._markupContainer,width:this._container.clientWidth,height:this._container.clientHeight});this._konvaStage=t;const e=new Ye.Layer({pixelRation:window.devicePixelRatio});t.add(e),this._groupImages=new Ye.Group,e.add(this._groupImages),this._groupGeometry=new Ye.Group,e.add(this._groupGeometry),this._groupTexts=new Ye.Group,e.add(this._groupTexts),this._konvaLayer=e;const n=new Ye.Transformer({shouldOverdrawWholeArea:!1,keepRatio:!1,flipEnabled:!1});e.add(n),this._konvaTransformer=n;let i,r,s,a=!1;t.on("mousedown touchstart",(e=>{if(!this._markupIsActive||e.target!==t||"Text"===this._markupMode||"Image"===this._markupMode)return;if(e.target===t&&n.nodes().length>0)return void n.nodes([]);const s=this.getRelativePointerPosition(t);r=s,a=["Arrow","Cloud","Ellipse","Line","Rectangle"].some((t=>t===this._markupMode)),"Line"===this._markupMode&&(i=this.addLine([s.x,s.y,s.x,s.y]))})),t.on("mouseup touchend",(e=>{if(this._markupIsActive){if(a){const e=this.getRelativePointerPosition(t),n=r&&e.x===r.x&&e.y===r.y,i=n?r.x:Math.min(r.x,e.x),s=n?r.y:Math.min(r.y,e.y),a=n?200:Math.abs(r.x-e.x),o=n?200:Math.abs(r.y-e.y);n&&("Rectangle"===this._markupMode?this.addRectangle({x:i,y:s},a,o):"Ellipse"===this._markupMode?this.addEllipse({x:i,y:s},{x:a/2,y:o/2}):"Arrow"===this._markupMode?this.addArrow({x:r.x,y:r.y},{x:n?r.x+200:e.x,y:n?s:e.y}):"Cloud"===this._markupMode&&this.addCloud({x:i,y:s},Math.max(100,a),Math.max(100,o)))}s=void 0,a=!1}})),t.on("mousemove touchmove",(e=>{if(!this._markupIsActive)return;if(!a)return;const n=this.getRelativePointerPosition(t),o=r&&n.x===r.x&&n.y===r.y,l=o?r.x:Math.min(r.x,n.x),h=o?r.y:Math.min(r.y,n.y),c=o?200:Math.abs(r.x-n.x),d=o?200:Math.abs(r.y-n.y);"Line"===this._markupMode?i.addPoints([{x:n.x,y:n.y}]):"Arrow"===this._markupMode?s?s.setEndPoint(n.x,n.y):s=this.addArrow({x:r.x,y:r.y},{x:n.x,y:n.y}):"Rectangle"===this._markupMode?s?(s.setPosition(l,h),s.setWidth(c),s.setHeight(d)):s=this.addRectangle({x:l,y:h},c,d):"Ellipse"===this._markupMode?s?(s.setPosition(l,h),s.setRadiusX(c),s.setRadiusY(d)):s=this.addEllipse({x:l,y:h},{x:c,y:d}):"Cloud"===this._markupMode&&(s?(s.setPosition(l,h),s.setWidth(Math.max(100,c)),s.setHeight(Math.max(100,d))):s=this.addCloud({x:l,y:h},c,d))})),t.on("click tap",(e=>{if(!this._markupIsActive)return;if(e.target===t){if("Text"===this._markupMode){if(this._textInputRef&&this._textInputRef.value)this.addText(this._textInputRef.value,this._textInputPos,this._textInputAngle);else if(0===n.nodes().length){const n=this.getRelativePointerPosition(t);this.createTextInput(n,e.evt.pageX,e.evt.pageY,0,null)}}else if("Image"===this._markupMode)if(this._imageInputRef&&this._imageInputRef.value)this.addImage({x:this._imageInputPos.x,y:this._imageInputPos.y},this._imageInputRef.value,0,0,this._imageInputRef.value);else if(0===n.nodes().length){const e=this.getRelativePointerPosition(t);this.createImageInput(e)}return void n.nodes([])}if("Text"===this._markupMode||"SelectMarkup"===this._markupMode){if("Text"===e.target.className&&1===n.nodes().length&&n.nodes()[0]===e.target)return void(this._textInputRef&&this._textInputRef.value?this.addText(this._textInputRef.value,this._textInputPos,this._textInputAngle):this.createTextInput({x:e.target.attrs.x,y:e.target.attrs.y},e.evt.pageX,e.evt.pageY,e.target.attrs.rotation,e.target.attrs.text));this.removeTextInput()}if("Image"===this._markupMode||"SelectMarkup"===this._markupMode){if("Image"===e.target.className&&1===n.nodes().length&&n.nodes()[0]===e.target)return void(this._imageInputRef&&this._imageInputRef.value?this.addImage(this._imageInputPos,this._imageInputRef.value,0,0):this.createImageInput({x:e.target.attrs.x,y:e.target.attrs.y}));this.removeImageInput()}n.nodes().filter((t=>"Cloud"===t.className||"Image"===t.className)).length>0||"Cloud"===e.target.className||"Image"===e.target.className?n.rotateEnabled(!1):n.rotateEnabled(!0);const i=e.evt.shiftKey||e.evt.ctrlKey||e.evt.metaKey,r=n.nodes().indexOf(e.target)>=0;if(i||r){if(i&&r){const t=n.nodes().slice();t.splice(t.indexOf(e.target),1),n.nodes(t)}else if(i&&!r){const t=n.nodes().concat([e.target]);n.nodes(t)}}else n.nodes([e.target])}));const o=t.container();o.tabIndex=1,o.focus(),o.addEventListener("keydown",(t=>{if(this._markupIsActive)return"Delete"===t.code?(this.getSelectedObjects().forEach((t=>t.delete())),void this.clearSelected()):void t.preventDefault()}))}destroyKonva(){var t;this.removeTextInput(),this.removeImageInput(),this.clearOverlay(),null===(t=this._konvaStage)||void 0===t||t.destroy(),this._groupImages=void 0,this._groupGeometry=void 0,this._groupTexts=void 0,this._konvaLayer=void 0,this._konvaTransformer=void 0,this._konvaStage=void 0}getMarkupLines(){const t=[];return this.konvaLayerFind("Line").forEach((e=>{const n=e.points();if(!n)return;const i=[],r=e.getAbsoluteTransform();for(let t=0;t<n.length;t+=2){const e=r.point({x:n[t],y:n[t+1]}),s=this._worldTransformer.screenToWorld(e);i.push(s)}const s=new Qe(null,e),a={id:s.id(),points:i,color:s.getColor()||"#ff0000",type:s.getLineType()||this.lineType,width:s.getLineWidth()||this.lineWidth};t.push(a)})),t}getMarkupTexts(){const t=[];return this.konvaLayerFind("Text").forEach((e=>{const n=this._worldTransformer.getScale(),i=e.position(),r=this._konvaStage.getAbsoluteTransform(),s=r.point({x:i.x,y:i.y}),a=this._worldTransformer.screenToWorld(s),o=new Je(null,e),l={id:o.id(),position:a,text:o.getText(),text_size:.02*n.y,angle:o.getRotation(),color:o.getColor(),font_size:o.getFontSize()*r.getMatrix()[0]};t.push(l)})),t}getMarkupRectangles(){const t=[];return this.konvaLayerFind("Rectangle").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new $e(null,e),l={id:o.id(),position:s,width:o.getWidth()*a,height:o.getHeigth()*a,line_width:o.getLineWidth(),color:o.getColor()};t.push(l)})),t}getMarkupEllipses(){const t=[];return this.konvaLayerFind("Ellipse").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new tn(null,e),l={id:o.id(),position:s,radius:{x:e.getRadiusX()*a,y:e.getRadiusY()*a},line_width:o.getLineWidth(),color:o.getColor()};t.push(l)})),t}getMarkupArrows(){const t=[];return this.konvaLayerFind("Arrow").forEach((e=>{const n=e.getAbsoluteTransform(),i=n.point({x:e.points()[0],y:e.points()[1]}),r=this._worldTransformer.screenToWorld(i),s=n.point({x:e.points()[2],y:e.points()[3]}),a=this._worldTransformer.screenToWorld(s),o=new en(null,e),l={id:o.id(),start:r,end:a,color:o.getColor()};t.push(l)})),t}getMarkupImages(){const t=[];return this.konvaLayerFind("Image").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new nn(null,e),l={id:o.id(),position:s,src:o.getSrc(),width:o.getWidth()*a,height:o.getHeight()*a};t.push(l)})),t}getMarkupClouds(){const t=[];return this.konvaLayerFind("Cloud").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new rn(null,e),l={id:o.id(),position:s,width:o.getWidth()*a,height:o.getHeigth()*a,line_width:o.getLineWidth(),color:o.getColor()};t.push(l)})),t}combineMarkupWithDrawing(){this.clearSelected();const t=document.createElement("canvas");if(this._konvaStage){t.width=this._konvaStage.width(),t.height=this._konvaStage.height();const e=t.getContext("2d");this._container instanceof HTMLCanvasElement&&e.drawImage(this._container,0,0),e.drawImage(this._konvaStage.toCanvas({pixelRatio:window.devicePixelRatio}),0,0)}return t.toDataURL("image/jpeg",.25)}addLine(t,e,n,i,r){if(!t||0===t.length)return;const s=[];for(let e=0;e<t.length;e+=2)s.push({x:t[e],y:t[e+1]});const a=new Qe({points:s,type:n||this.lineType,width:i||this.lineWidth,color:e||this._markupColor.asHex(),id:r});return this.addObject(a),a}createTextInput(t,e,n,i,r){this._textInputRef?this.removeTextInput():(this._textInputPos=t,this._textInputAngle=i,this._textInputRef=document.createElement("textarea"),this._textInputRef.style.zIndex="9999",this._textInputRef.style.position="absolute",this._textInputRef.style.display="block",this._textInputRef.style.top=n+"px",this._textInputRef.style.left=e+"px",this._textInputRef.style.fontSize=`${this.fontSize}px`,this._textInputRef.style.color=`${this._markupColor.asHex()}`,this._textInputRef.style.fontFamily="Calibri",this._textInputRef.onkeydown=t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),this.addText(this._textInputRef.value,this._textInputPos,this._textInputAngle)),"Escape"===t.key&&(t.preventDefault(),this.removeTextInput())},r&&(this._textInputRef.value=r),document.body.appendChild(this._textInputRef),setTimeout((()=>{this._textInputRef.focus()}),50))}removeTextInput(){var t;null===(t=this._textInputRef)||void 0===t||t.remove(),this._textInputRef=null,this._textInputPos=null,this._textInputAngle=0}createImageInput(t){if(this._imageInputRef)this.removeImageInput();else{const e=t=>new Promise(((e,n)=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)},i.onerror=t=>{n(t)}}));this._imageInputPos=t,this._imageInputRef=document.createElement("input"),this._imageInputRef.style.display="none",this._imageInputRef.type="file",this._imageInputRef.accept="image/png, image/jpeg",this._imageInputRef.onchange=async t=>{const n=t.target.files[0],i=await e(n);this.addImage({x:this._imageInputPos.x,y:this._imageInputPos.y},i.toString(),0,0)},this._imageInputRef.oncancel=t=>{this.removeImageInput()},document.body.appendChild(this._imageInputRef),setTimeout((()=>{this._imageInputRef.click()}),50)}}removeImageInput(){var t;null===(t=this._imageInputRef)||void 0===t||t.remove(),this._imageInputRef=null,this._imageInputPos=null}addText(t,e,n,i,r,s,a){var o;if(!t)return;null===(o=this.getSelectedObjects().at(0))||void 0===o||o.delete(),this.clearSelected(),this.removeTextInput();const l=1e-6;if(r&&r>l&&(!s||s<l)){const t=.02;s=r/(this._worldTransformer.getScale().y/t)/34}const h=new Je({position:{x:e.x,y:e.y},text:t,rotation:n,fontSize:s||this.fontSize,color:i||this._markupColor.asHex(),id:a});return this.addObject(h),h}addRectangle(t,e,n,i,r,s){if(!t)return;const a=new $e({position:t,width:e,height:n,lineWidth:i||this.lineWidth,color:r||this._markupColor.asHex(),id:s});return this.addObject(a),a}addEllipse(t,e,n,i,r){if(!t)return;const s=new tn({position:t,radius:e,lineWidth:n,color:i||this._markupColor.asHex(),id:r});return this.addObject(s),s}addArrow(t,e,n,i){if(!t||!e)return;const r=new en({start:t,end:e,color:n||this._markupColor.asHex(),id:i});return this.addObject(r),r}addCloud(t,e,n,i,r,s){if(!t||!e||!n)return;const a=new rn({position:t,width:e,height:n,color:r||this._markupColor.asHex(),lineWidth:i||this.lineWidth,id:s});return this.addObject(a),a}addImage(t,e,n,i,r){var s;if(!t||!e)return;null===(s=this.getSelectedObjects().at(0))||void 0===s||s.delete(),this.clearSelected(),this.removeImageInput();const a=new nn({position:t,src:e,width:n,height:i,maxWidth:this._konvaStage.width()-t.x,maxHeight:this._konvaStage.height()-t.y,id:r});return this.addObject(a),a}}
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ODA=t.ODA||{},t.ODA.Three=t.ODA.Three||{}))}(this,(function(t){"use strict";class e{constructor(){this._commands=new Map}registerCommand(t,e,n,i){this._commands.set(t,{id:t,handler:e,thisArg:i,description:n})}registerCommandAlias(t,e){this.registerCommand(e,((e,...n)=>this.executeCommand(t,e,...n)))}getCommand(t){return this._commands.get(t)}getCommands(){const t=new Map;return this._commands.forEach(((e,n)=>t.set(n,e))),t}executeCommand(t,e,...n){const i=this._commands.get(t);if(!i){if(e){if(e.draggers.includes(t))return e.setActiveDragger(t)}return void console.warn(`Command '${t}' not found`)}const{handler:r,thisArg:s}=i,a=r.apply(s,[e,...n]);return null==e||e.emit({type:"command",data:t,args:n}),a}}const n=new Map;function i(t=""){let i=n.get(t);return i||(i=new e,n.set(t,i)),i}class r{constructor(){this._draggers=new Map}registerDragger(t,e){this._draggers.set(t,e)}registerDraggerAlias(t,e){const n=this.getDragger(t);n&&this.registerDragger(e,(t=>n(t)))}getDragger(t){return this._draggers.get(t)}getDraggers(){const t=new Map;return this._draggers.forEach(((e,n)=>t.set(n,e))),t}createDragger(t,e){const n=this.getDragger(t);if(!n)return null;const i=n(e);return i.name=t,i}}const s=new Map;function a(t=""){let e=s.get(t);return e||(e=new r,s.set(t,e)),e}class o{constructor(){this._components=new Map}registerComponent(t,e){this._components.set(t,e)}registerComponentAlias(t,e){const n=this.getComponent(t);n&&this.registerComponent(e,(t=>n(t)))}getComponent(t){return this._components.get(t)}getComponents(){const t=new Map;return this._components.forEach(((e,n)=>t.set(n,e))),t}createComponent(t,e){const n=this.getComponent(t);if(!n)return null;const i=n(e);return i.name=t,i}}const l=new Map;function h(t=""){let e=l.get(t);return e||(e=new o,l.set(t,e)),e}function c(){return{showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0,geometryType:"vsfx",rulerUnit:"Default"}}class d{constructor(t){this._emitter=t,this._data={showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0,geometryType:"vsfx",rulerUnit:"Default"},this.loadFromStorage()}static defaults(){return{showWCS:!0,cameraAnimation:!0,antialiasing:!0,groundShadow:!1,shadows:!1,cameraAxisXSpeed:4,cameraAxisYSpeed:1,ambientOcclusion:!1,enableStreamingMode:!0,enablePartialMode:!1,memoryLimit:3294967296,cuttingPlaneFillColor:{red:255,green:152,blue:0},edgesColor:{r:255,g:152,b:0},facesColor:{r:255,g:152,b:0},edgesVisibility:!0,edgesOverlap:!0,facesOverlap:!1,facesTransparancy:200,enableCustomHighlight:!0,sceneGraph:!1,edgeModel:!0,reverseZoomWheel:!1,enableZoomWheel:!0,enableGestures:!0,geometryType:"vsfx",rulerUnit:"Default"}}notifierChangeEvent(){console.warn("Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead."),this.change()}change(){void 0!==this._emitter&&(this.saveToStorage(),this._emitter.emit({type:"optionschange",data:this}))}saveToStorage(){if("undefined"!=typeof window)try{localStorage.setItem("od-client-settings",JSON.stringify(this.data))}catch(t){console.error("Cannot save client settings.",t)}}loadFromStorage(){if("undefined"!=typeof window)try{const t=localStorage.getItem("od-client-settings");if(t){const e=JSON.parse(t);this.data={...e}}}catch(t){console.error("Cannot load client settings.",t)}}resetToDefaults(t){if(void 0!==t){const e=d.defaults(),n=t.reduce(((t,n)=>(t[n]=e[n],t)),{});this.data={...this.data,...n}}else this.data={...this.data,...d.defaults()}}get data(){return this._data}set data(t){const e=!!t.enableStreamingMode&&t.enablePartialMode,n=!e&&t.sceneGraph;this._data={...d.defaults(),...this._data,...t,enablePartialMode:e,sceneGraph:n},this.change()}get showWCS(){return this._data.showWCS}set showWCS(t){this._data.showWCS=t,this.change()}get cameraAnimation(){return this._data.cameraAnimation}set cameraAnimation(t){this._data.cameraAnimation=t,this.change()}get antialiasing(){return this._data.antialiasing}set antialiasing(t){this._data.antialiasing=t,this.change()}get groundShadow(){return this._data.groundShadow}set groundShadow(t){this._data.groundShadow=t,this.change()}get shadows(){return this._data.shadows}set shadows(t){this._data.shadows=t,this.change()}get cameraAxisXSpeed(){return this._data.cameraAxisXSpeed}set cameraAxisXSpeed(t){this._data.cameraAxisXSpeed=t,this.change()}get cameraAxisYSpeed(){return this._data.cameraAxisYSpeed}set cameraAxisYSpeed(t){this.cameraAxisYSpeed=t,this.change()}get ambientOcclusion(){return this._data.ambientOcclusion}set ambientOcclusion(t){this._data.ambientOcclusion=t,this.change()}get enableStreamingMode(){return this._data.enableStreamingMode}set enableStreamingMode(t){this._data.enableStreamingMode=t,t||(this._data.enablePartialMode=!1),this.change()}get enablePartialMode(){return this._data.enablePartialMode}set enablePartialMode(t){this._data.enablePartialMode=t,t&&(this._data.enableStreamingMode=!0,this._data.sceneGraph=!1),this.change()}get memoryLimit(){return this._data.memoryLimit}set memoryLimit(t){this._data.memoryLimit=t,this.change()}get cuttingPlaneFillColor(){return this._data.cuttingPlaneFillColor}set cuttingPlaneFillColor(t){this._data.cuttingPlaneFillColor=t,this.change()}get edgesColor(){return this._data.edgesColor}set edgesColor(t){this._data.edgesColor=t,this.change()}get facesColor(){return this._data.facesColor}set facesColor(t){this._data.facesColor=t,this.change()}get edgesVisibility(){return this._data.edgesVisibility}set edgesVisibility(t){this._data.edgesVisibility=t,this.change()}get edgesOverlap(){return this._data.edgesOverlap}set edgesOverlap(t){this._data.edgesOverlap=t,this.change()}get facesOverlap(){return this._data.facesOverlap}set facesOverlap(t){this._data.facesOverlap=t,this.change()}get facesTransparancy(){return this._data.facesTransparancy}set facesTransparancy(t){this._data.facesTransparancy=t,this.change()}get enableCustomHighlight(){return this._data.enableCustomHighlight}set enableCustomHighlight(t){this._data.enableCustomHighlight=t,this.change()}get sceneGraph(){return this._data.sceneGraph}set sceneGraph(t){this._data.sceneGraph=t,t&&(this._data.enablePartialMode=!1),this.change()}get edgeModel(){return Boolean(this._data.edgeModel)}set edgeModel(t){this._data.edgeModel=Boolean(t),this.change()}get reverseZoomWheel(){return this._data.reverseZoomWheel}set reverseZoomWheel(t){this._data.reverseZoomWheel=!!t,this.change()}get enableZoomWheel(){return this._data.enableZoomWheel}set enableZoomWheel(t){this._data.enableZoomWheel=!!t,this.change()}get enableGestures(){return this._data.enableGestures}set enableGestures(t){this._data.enableGestures=!!t,this.change()}get geometryType(){return this._data.geometryType}set geometryType(t){this._data.geometryType=t,this.change()}get rulerUnit(){return this._data.rulerUnit}set rulerUnit(t){this._data.rulerUnit=t,this.change()}}const u=["click","contextmenu","dblclick","mousedown","mouseleave","mousemove","mouseup","pointercancel","pointerdown","pointerleave","pointermove","pointerup","touchcancel","touchend","touchmove","touchstart","wheel"],p=u;var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var g,_={exports:{}},v={},y={},x={};function S(){return g||(g=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const e=Math.PI/180;t.glob=void 0!==f?f:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},t.Konva={_global:t.glob,version:"9.3.18",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle:n=>t.Konva.angleDeg?n*e:n,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)}(x)),x}var b,M={};function w(){return b||(b=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=S();class n{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}translate(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this}scale(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.m[0]*e+this.m[2]*n,r=this.m[1]*e+this.m[3]*n,s=this.m[0]*-n+this.m[2]*e,a=this.m[1]*-n+this.m[3]*e;return this.m[0]=i,this.m[1]=r,this.m[2]=s,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){const n=this.m[0]+this.m[2]*e,i=this.m[1]+this.m[3]*e,r=this.m[2]+this.m[0]*t,s=this.m[3]+this.m[1]*t;return this.m[0]=n,this.m[1]=i,this.m[2]=r,this.m[3]=s,this}multiply(t){const e=this.m[0]*t.m[0]+this.m[2]*t.m[1],n=this.m[1]*t.m[0]+this.m[3]*t.m[1],i=this.m[0]*t.m[2]+this.m[2]*t.m[3],r=this.m[1]*t.m[2]+this.m[3]*t.m[3],s=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=s,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,n=-this.m[1]*t,i=-this.m[2]*t,r=this.m[0]*t,s=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=n,this.m[2]=i,this.m[3]=r,this.m[4]=s,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const e=this.m[0],n=this.m[1],i=this.m[2],r=this.m[3],s=e*r-n*i,a={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=n){const t=Math.sqrt(e*e+n*n);a.rotation=n>0?Math.acos(e/t):-Math.acos(e/t),a.scaleX=t,a.scaleY=s/t,a.skewX=(e*i+n*r)/s,a.skewY=0}else if(0!=i||0!=r){const t=Math.sqrt(i*i+r*r);a.rotation=Math.PI/2-(r>0?Math.acos(-i/t):-Math.acos(i/t)),a.scaleX=s/t,a.scaleY=t,a.skewX=0,a.skewY=(e*i+n*r)/s}return a.rotation=t.Util._getRotation(a.rotation),a}}t.Transform=n;const i=Math.PI/180,r=180/Math.PI,s="Konva error: ",a={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]},o=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let l=[];const h="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(t){setTimeout(t,60)};t.Util={_isElement:t=>!(!t||1!=t.nodeType),_isFunction:t=>!!(t&&t.constructor&&t.call&&t.apply),_isPlainObject:t=>!!t&&t.constructor===Object,_isArray:t=>"[object Array]"===Object.prototype.toString.call(t),_isNumber:t=>"[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)&&isFinite(t),_isString:t=>"[object String]"===Object.prototype.toString.call(t),_isBoolean:t=>"[object Boolean]"===Object.prototype.toString.call(t),isObject:t=>t instanceof Object,isValidSelector(t){if("string"!=typeof t)return!1;const e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:t=>0===t||t>0?1:-1,requestAnimFrame(t){l.push(t),1===l.length&&h((function(){const t=l;l=[],t.forEach((function(t){t()}))}))},createCanvasElement(){const t=document.createElement("canvas");try{t.style=t.style||{}}catch(t){}return t},createImageElement:()=>document.createElement("img"),_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(e,n){const i=t.Util.createImageElement();i.onload=function(){n(i)},i.src=e},_rgbToHex:(t,e,n)=>((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1),_hexToRgb(t){t=t.replace("#","");const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor(){let t=(16777215*Math.random()|0).toString(16);for(;t.length<6;)t="0"+t;return"#"+t},getRGB(t){let e;return t in a?(e=a[t],{r:e[0],g:e[1],b:e[2]}):"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?(e=o.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA: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(t){const e=a[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(0===t.indexOf("rgb(")){const e=(t=t.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(0===t.indexOf("rgba(")){const e=(t=t.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((t,e)=>"%"===t.slice(-1)?3===e?parseInt(t)/100:parseInt(t)/100*255:Number(t)));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if("#"===t[0]&&9===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if("#"===t[0]&&7===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if("#"===t[0]&&5===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if("#"===t[0]&&4===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),i=Number(n[0])/360,r=Number(n[1])/100,s=Number(n[2])/100;let a,o,l;if(0===r)return l=255*s,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};a=s<.5?s*(1+r):s+r-s*r;const h=2*s-a,c=[0,0,0];for(let t=0;t<3;t++)o=i+1/3*-(t-1),o<0&&o++,o>1&&o--,l=6*o<1?h+6*(a-h)*o:2*o<1?a:3*o<2?h+(a-h)*(2/3-o)*6:h,c[t]=255*l;return{r:Math.round(c[0]),g:Math.round(c[1]),b:Math.round(c[2]),a:1}}},haveIntersection:(t,e)=>!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y),cloneObject(t){const e={};for(const n in t)this._isPlainObject(t[n])?e[n]=this.cloneObject(t[n]):this._isArray(t[n])?e[n]=this.cloneArray(t[n]):e[n]=t[n];return e},cloneArray:t=>t.slice(0),degToRad:t=>t*i,radToDeg:t=>t*r,_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:n=>e.Konva.angleDeg?t.Util.radToDeg(n):n,_capitalize:t=>t.charAt(0).toUpperCase()+t.slice(1),throw(t){throw new Error(s+t)},error(t){console.error(s+t)},warn(t){e.Konva.showWarnings&&console.warn("Konva warning: "+t)},each(t,e){for(const n in t)e(n,t[n])},_inRange:(t,e,n)=>e<=t&&t<n,_getProjectionToSegment(t,e,n,i,r,s){let a,o,l;const h=(t-n)*(t-n)+(e-i)*(e-i);if(0==h)a=t,o=e,l=(r-n)*(r-n)+(s-i)*(s-i);else{const c=((r-t)*(n-t)+(s-e)*(i-e))/h;c<0?(a=t,o=e,l=(t-r)*(t-r)+(e-s)*(e-s)):c>1?(a=n,o=i,l=(n-r)*(n-r)+(i-s)*(i-s)):(a=t+c*(n-t),o=e+c*(i-e),l=(a-r)*(a-r)+(o-s)*(o-s))}return[a,o,l]},_getProjectionToLine(e,n,i){const r=t.Util.cloneObject(e);let s=Number.MAX_VALUE;return n.forEach((function(a,o){if(!i&&o===n.length-1)return;const l=n[(o+1)%n.length],h=t.Util._getProjectionToSegment(a.x,a.y,l.x,l.y,e.x,e.y),c=h[0],d=h[1],u=h[2];u<s&&(r.x=c,r.y=d,s=u)})),r},_prepareArrayForTween(e,n,i){const r=[],s=[];if(e.length>n.length){const t=n;n=e,e=t}for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});for(let t=0;t<n.length;t+=2)s.push({x:n[t],y:n[t+1]});const a=[];return s.forEach((function(e){const n=t.Util._getProjectionToLine(e,r,i);a.push(n.x),a.push(n.y)})),a},_prepareToStringify(e){let n;e.visitedByCircularReferenceRemoval=!0;for(const i in e)if(e.hasOwnProperty(i)&&e[i]&&"object"==typeof e[i])if(n=Object.getOwnPropertyDescriptor(e,i),e[i].visitedByCircularReferenceRemoval||t.Util._isElement(e[i])){if(!n.configurable)return null;delete e[i]}else if(null===t.Util._prepareToStringify(e[i])){if(!n.configurable)return null;delete e[i]}return delete e.visitedByCircularReferenceRemoval,e},_assign(t,e){for(const n in e)t[n]=e[n];return t},_getFirstPointerId:t=>t.touches?t.changedTouches[0].identifier:t.pointerId||999,releaseCanvas(...t){e.Konva.releaseCanvasOnDestroy&&t.forEach((t=>{t.width=0,t.height=0}))},drawRoundedRectPath(t,e,n,i){let r=0,s=0,a=0,o=0;"number"==typeof i?r=s=a=o=Math.min(i,e/2,n/2):(r=Math.min(i[0]||0,e/2,n/2),s=Math.min(i[1]||0,e/2,n/2),o=Math.min(i[2]||0,e/2,n/2),a=Math.min(i[3]||0,e/2,n/2)),t.moveTo(r,0),t.lineTo(e-s,0),t.arc(e-s,s,s,3*Math.PI/2,0,!1),t.lineTo(e,n-o),t.arc(e-o,n-o,o,0,Math.PI/2,!1),t.lineTo(a,n),t.arc(a,n-a,a,Math.PI/2,Math.PI,!1),t.lineTo(0,r),t.arc(r,r,r,Math.PI,3*Math.PI/2,!1)}}}(M)),M}var E,T,A={},C={},R={};function P(){if(E)return R;E=1,Object.defineProperty(R,"__esModule",{value:!0}),R.RGBComponent=function(t){if(t>255)return 255;if(t<0)return 0;return Math.round(t)},R.alphaComponent=function(t){if(t>1)return 1;if(t<1e-4)return 1e-4;return t},R.getNumberValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isNumber(t)||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a number.'),t}},R.getNumberOrArrayOfNumbersValidator=function(i){if(t.Konva.isUnminified)return function(t,r){let s=e.Util._isNumber(t),a=e.Util._isArray(t)&&t.length==i;return s||a||e.Util.warn(n(t)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array<number>('+i+")"),t}},R.getNumberOrAutoValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isNumber(t)||"auto"===t||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a number or "auto".'),t}},R.getStringValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isString(t)||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a string.'),t}},R.getStringOrGradientValidator=function(){if(t.Konva.isUnminified)return function(t,i){const r=e.Util._isString(t),s="[object CanvasGradient]"===Object.prototype.toString.call(t)||t&&t.addColorStop;return r||s||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a string or a native gradient.'),t}},R.getFunctionValidator=function(){if(t.Konva.isUnminified)return function(t,i){return e.Util._isFunction(t)||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a function.'),t}},R.getNumberArrayValidator=function(){if(t.Konva.isUnminified)return function(t,i){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&t instanceof r||(e.Util._isArray(t)?t.forEach((function(t){e.Util._isNumber(t)||e.Util.warn('"'+i+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")})):e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a array of numbers.')),t}},R.getBooleanValidator=function(){if(t.Konva.isUnminified)return function(t,i){return!0===t||!1===t||e.Util.warn(n(t)+' is a not valid value for "'+i+'" attribute. The value should be a boolean.'),t}},R.getComponentValidator=function(i){if(t.Konva.isUnminified)return function(t,r){return null==t||e.Util.isObject(t)||e.Util.warn(n(t)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+i),t}};const t=S(),e=w();function n(t){return e.Util._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)||e.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}return R}function L(){return T||(T=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const e=w(),n=P(),i="get",r="set";t.Factory={addGetterSetter(e,n,i,r,s){t.Factory.addGetter(e,n,i),t.Factory.addSetter(e,n,r,s),t.Factory.addOverloadedGetterSetter(e,n)},addGetter(t,n,r){var s=i+e.Util._capitalize(n);t.prototype[s]=t.prototype[s]||function(){const t=this.attrs[n];return void 0===t?r:t}},addSetter(n,i,s,a){var o=r+e.Util._capitalize(i);n.prototype[o]||t.Factory.overWriteSetter(n,i,s,a)},overWriteSetter(t,n,i,s){var a=r+e.Util._capitalize(n);t.prototype[a]=function(t){return i&&null!=t&&(t=i.call(this,t,n)),this._setAttr(n,t),s&&s.call(this),this}},addComponentsGetterSetter(s,a,o,l,h){const c=o.length,d=e.Util._capitalize,u=i+d(a),p=r+d(a);s.prototype[u]=function(){const t={};for(let e=0;e<c;e++){const n=o[e];t[n]=this.getAttr(a+d(n))}return t};const f=(0,n.getComponentValidator)(o);s.prototype[p]=function(t){const e=this.attrs[a];l&&(t=l.call(this,t,a)),f&&f.call(this,t,a);for(const e in t)t.hasOwnProperty(e)&&this._setAttr(a+d(e),t[e]);return t||o.forEach((t=>{this._setAttr(a+d(t),void 0)})),this._fireChangeEvent(a,e,t),h&&h.call(this),this},t.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(t,n){var s=e.Util._capitalize(n),a=r+s,o=i+s;t.prototype[n]=function(){return arguments.length?(this[a](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(n,r,s,a){e.Util.error("Adding deprecated "+r);const o=i+e.Util._capitalize(r),l=r+" property is deprecated and will be removed soon. Look at Konva change log for more information.";n.prototype[o]=function(){e.Util.error(l);const t=this.attrs[r];return void 0===t?s:t},t.Factory.addSetter(n,r,a,(function(){e.Util.error(l)})),t.Factory.addOverloadedGetterSetter(n,r)},backCompat(t,n){e.Util.each(n,(function(n,s){const a=t.prototype[s],o=i+e.Util._capitalize(n),l=r+e.Util._capitalize(n);function h(){a.apply(this,arguments),e.Util.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+s+'" instead.')}t.prototype[n]=h,t.prototype[o]=h,t.prototype[l]=h}))},afterSetFilter(){this._filterUpToDate=!1}}}(C)),C}var I,D,N={},U={};function O(){if(I)return U;I=1,Object.defineProperty(U,"__esModule",{value:!0}),U.HitContext=U.SceneContext=U.Context=void 0;const t=w(),e=S();const n=["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"];let i=class{constructor(t){this.canvas=t,e.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(e,n){let i,r,s,a,o=this.traceArr,l=o.length,h="";for(i=0;i<l;i++)r=o[i],s=r.method,s?(a=r.args,h+=s,e?h+="()":t.Util._isArray(a[0])?h+="(["+a.join(",")+"])":(n&&(a=a.map((t=>"number"==typeof t?Math.floor(t):t))),h+="("+a.join(",")+")")):(h+=r.property,e||(h+="="+r.val)),h+=";";return h}clearTrace(){this.traceArr=[]}_trace(t){let e,n=this.traceArr;n.push(t),e=n.length,e>=100&&n.shift()}reset(){const t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){const e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){const e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,n,i,r,s){this._context.arc(t,e,n,i,r,s)}arcTo(t,e,n,i,r){this._context.arcTo(t,e,n,i,r)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,n,i,r,s){this._context.bezierCurveTo(t,e,n,i,r,s)}clearRect(t,e,n,i){this._context.clearRect(t,e,n,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){const n=arguments;return 2===n.length?this._context.createImageData(t,e):1===n.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,n,i){return this._context.createLinearGradient(t,e,n,i)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,n,i,r,s){return this._context.createRadialGradient(t,e,n,i,r,s)}drawImage(t,e,n,i,r,s,a,o,l){const h=arguments,c=this._context;3===h.length?c.drawImage(t,e,n):5===h.length?c.drawImage(t,e,n,i,r):9===h.length&&c.drawImage(t,e,n,i,r,s,a,o,l)}ellipse(t,e,n,i,r,s,a,o){this._context.ellipse(t,e,n,i,r,s,a,o)}isPointInPath(t,e,n,i){return n?this._context.isPointInPath(n,t,e,i):this._context.isPointInPath(t,e,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,n,i){this._context.fillRect(t,e,n,i)}strokeRect(t,e,n,i){this._context.strokeRect(t,e,n,i)}fillText(t,e,n,i){i?this._context.fillText(t,e,n,i):this._context.fillText(t,e,n)}measureText(t){return this._context.measureText(t)}getImageData(t,e,n,i){return this._context.getImageData(t,e,n,i)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,n,i){this._context.rect(t,e,n,i)}roundRect(t,e,n,i,r){this._context.roundRect(t,e,n,i,r)}putImageData(t,e,n){this._context.putImageData(t,e,n)}quadraticCurveTo(t,e,n,i){this._context.quadraticCurveTo(t,e,n,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,n,i,r,s){this._context.setTransform(t,e,n,i,r,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,n,i){this._context.strokeText(t,e,n,i)}transform(t,e,n,i,r,s){this._context.transform(t,e,n,i,r,s)}translate(t,e){this._context.translate(t,e)}_enableTrace(){let e,i,r=this,s=n.length,a=this.setAttr;const o=function(e){let n,s=r[e];r[e]=function(){return i=function(e){const n=[],i=e.length,r=t.Util;for(let t=0;t<i;t++){let i=e[t];r._isNumber(i)?i=Math.round(1e3*i)/1e3:r._isString(i)||(i+=""),n.push(i)}return n}(Array.prototype.slice.call(arguments,0)),n=s.apply(r,arguments),r._trace({method:e,args:i}),n}};for(e=0;e<s;e++)o(n[e]);r.setAttr=function(){a.apply(r,arguments);const t=arguments[0];let e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),r._trace({property:t,val:e})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;!e||"source-over"===e||this.setAttr("globalCompositeOperation",e)}};U.Context=i,["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(t){Object.defineProperty(i.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})}));U.SceneContext=class extends i{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){const e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){const e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),n=t.getFillPriority();if(e&&"color"===n)return void this._fillColor(t);const i=t.getFillPatternImage();if(i&&"pattern"===n)return void this._fillPattern(t);const r=t.getFillLinearGradientColorStops();if(r&&"linear-gradient"===n)return void this._fillLinearGradient(t);const s=t.getFillRadialGradientColorStops();s&&"radial-gradient"===n?this._fillRadialGradient(t):e?this._fillColor(t):i?this._fillPattern(t):r?this._fillLinearGradient(t):s&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),n=t.getStrokeLinearGradientEndPoint(),i=t.getStrokeLinearGradientColorStops(),r=this.createLinearGradient(e.x,e.y,n.x,n.y);if(i){for(let t=0;t<i.length;t+=2)r.addColorStop(i[t],i[t+1]);this.setAttr("strokeStyle",r)}}_stroke(t){const e=t.dash(),n=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!n){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),n||this.restore()}}_applyShadow(t){var e,n,i;const r=null!==(e=t.getShadowRGBA())&&void 0!==e?e:"black",s=null!==(n=t.getShadowBlur())&&void 0!==n?n:5,a=null!==(i=t.getShadowOffset())&&void 0!==i?i:{x:0,y:0},o=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),h=o.x*l,c=o.y*l;this.setAttr("shadowColor",r),this.setAttr("shadowBlur",s*Math.min(Math.abs(h),Math.abs(c))),this.setAttr("shadowOffsetX",a.x*h),this.setAttr("shadowOffsetY",a.y*c)}};return U.HitContext=class extends i{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const e=t.getStrokeScaleEnabled();if(!e){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t);const n=t.hitStrokeWidth(),i="auto"===n?t.strokeWidth():n;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}}},U}function F(){if(D)return N;D=1,Object.defineProperty(N,"__esModule",{value:!0}),N.HitCanvas=N.SceneCanvas=N.Canvas=void 0;const t=w(),e=O(),n=S(),i=L(),r=P();let s;let a=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const i=(e||{}).pixelRatio||n.Konva.pixelRatio||function(){if(s)return s;const e=t.Util.createCanvasElement(),i=e.getContext("2d");return s=(n.Konva._global.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1),t.Util.releaseCanvas(e),s}();this.pixelRatio=i,this._canvas=t.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){const e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch(e){try{return this._canvas.toDataURL()}catch(e){return t.Util.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}};N.Canvas=a,i.Factory.addGetterSetter(a,"pixelRatio",void 0,(0,r.getNumberValidator)());N.SceneCanvas=class extends a{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new e.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}};return N.HitCanvas=class extends a{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new e.HitContext(this),this.setSize(t.width,t.height)}},N}var k,B,z={};function G(){return k||(k=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DD=void 0;const e=S(),n=w();t.DD={get isDragging(){let e=!1;return t.DD._dragElements.forEach((t=>{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){let e;return t.DD._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const i=[];t.DD._dragElements.forEach(((t,r)=>{const{node:s}=t,a=s.getStage();a.setPointersPositions(e),void 0===t.pointerId&&(t.pointerId=n.Util._getFirstPointerId(e));const o=a._changedPointerPositions.find((e=>e.id===t.pointerId));if(o){if("dragging"!==t.dragStatus){const n=s.dragDistance();if(Math.max(Math.abs(o.x-t.startPointerPos.x),Math.abs(o.y-t.startPointerPos.y))<n)return;if(s.startDrag({evt:e}),!s.isDragging())return}s._setDragPosition(e,t),i.push(s)}})),i.forEach((t=>{t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(n){const i=[];t.DD._dragElements.forEach((r=>{const{node:s}=r,a=s.getStage();n&&a.setPointersPositions(n);if(!a._changedPointerPositions.find((t=>t.id===r.pointerId)))return;"dragging"!==r.dragStatus&&"stopped"!==r.dragStatus||(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,r.dragStatus="stopped");const o=r.node.getLayer()||r.node instanceof e.Konva.Stage&&r.node;o&&-1===i.indexOf(o)&&i.push(o)})),i.forEach((t=>{t.draw()}))},_endDragAfter(e){t.DD._dragElements.forEach(((n,i)=>{"stopped"===n.dragStatus&&n.node.fire("dragend",{type:"dragend",target:n.node,evt:e},!0),"dragging"!==n.dragStatus&&t.DD._dragElements.delete(i)}))}},e.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",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),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))}(z)),z}function H(){if(B)return A;B=1,Object.defineProperty(A,"__esModule",{value:!0}),A.Node=void 0;const t=w(),e=L(),n=F(),i=S(),r=G(),s=P(),a="absoluteOpacity",o="allEventListeners",l="absoluteTransform",h="absoluteScale",c="canvas",d="listening",u="mouseenter",p="mouseleave",f="Shape",m=" ",g="stage",_="transform",v="visible",y=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(m);let x=1,b=class e{constructor(t){this._id=x++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){t!==_&&t!==l||!this._cache.get(t)?t?this._cache.delete(t):this._cache.clear():this._cache.get(t).dirty=!0}_getCache(t,e){let n=this._cache.get(t);return(void 0===n||(t===_||t===l)&&!0===n.dirty)&&(n=e.call(this),this._cache.set(t,n)),n}_calculate(t,e,n){if(!this._attachedDepsListeners.get(t)){const n=e.map((t=>t+"Change.konva")).join(m);this.on(n,(()=>{this._clearCache(t)})),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,n)}_getCanvasCache(){return this._cache.get(c)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===l&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(c)){const{scene:e,filter:n,hit:i}=this._cache.get(c);t.Util.releaseCanvas(e,n,i),this._cache.delete(c)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const i=e||{};let r={};void 0!==i.x&&void 0!==i.y&&void 0!==i.width&&void 0!==i.height||(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let s=Math.ceil(i.width||r.width),o=Math.ceil(i.height||r.height),l=i.pixelRatio,d=void 0===i.x?Math.floor(r.x):i.x,u=void 0===i.y?Math.floor(r.y):i.y,p=i.offset||0,f=i.drawBorder||!1,m=i.hitCanvasPixelRatio||1;if(!s||!o)return void t.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");s+=2*p+(Math.abs(Math.round(r.x)-d)>.5?1:0),o+=2*p+(Math.abs(Math.round(r.y)-u)>.5?1:0),d-=p,u-=p;const g=new n.SceneCanvas({pixelRatio:l,width:s,height:o}),_=new n.SceneCanvas({pixelRatio:l,width:0,height:0,willReadFrequently:!0}),v=new n.HitCanvas({pixelRatio:m,width:s,height:o}),y=g.getContext(),x=v.getContext();return v.isCache=!0,g.isCache=!0,this._cache.delete(c),this._filterUpToDate=!1,!1===i.imageSmoothingEnabled&&(g.getContext()._context.imageSmoothingEnabled=!1,_.getContext()._context.imageSmoothingEnabled=!1),y.save(),x.save(),y.translate(-d,-u),x.translate(-d,-u),this._isUnderCache=!0,this._clearSelfAndDescendantCache(a),this._clearSelfAndDescendantCache(h),this.drawScene(g,this),this.drawHit(v,this),this._isUnderCache=!1,y.restore(),x.restore(),f&&(y.save(),y.beginPath(),y.rect(0,0,s,o),y.closePath(),y.setAttr("strokeStyle","red"),y.setAttr("lineWidth",5),y.stroke(),y.restore()),this._cache.set(c,{scene:g,filter:_,hit:v,x:d,y:u}),this._requestDraw(),this}isCached(){return this._cache.has(c)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){const n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let i=1/0,r=1/0,s=-1/0,a=-1/0;const o=this.getAbsoluteTransform(e);return n.forEach((function(t){const e=o.point(t);void 0===i&&(i=s=e.x,r=a=e.y),i=Math.min(i,e.x),r=Math.min(r,e.y),s=Math.max(s,e.x),a=Math.max(a,e.y)})),{x:i,y:r,width:s-i,height:a-r}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);const n=this._getCachedSceneCanvas(),i=n.pixelRatio;t.drawImage(n._canvas,0,0,n.width/i,n.height/i),t.restore()}_drawCachedHitCanvas(t){const e=this._getCanvasCache(),n=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),t.restore()}_getCachedSceneCanvas(){let e,n,i,r,s=this.filters(),a=this._getCanvasCache(),o=a.scene,l=a.filter,h=l.getContext();if(s){if(!this._filterUpToDate){const a=o.pixelRatio;l.setSize(o.width/o.pixelRatio,o.height/o.pixelRatio);try{for(e=s.length,h.clear(),h.drawImage(o._canvas,0,0,o.getWidth()/a,o.getHeight()/a),n=h.getImageData(0,0,l.getWidth(),l.getHeight()),i=0;i<e;i++)r=s[i],"function"==typeof r?(r.call(this,n),h.putImageData(n,0,0)):t.Util.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(e){t.Util.error("Unable to apply filter. "+e.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return l}return o}on(t,e){if(this._cache&&this._cache.delete(o),3===arguments.length)return this._delegate.apply(this,arguments);let n,i,r,s,a,l=t.split(m),h=l.length;for(n=0;n<h;n++)i=l[n],r=i.split("."),s=r[0],a=r[1]||"",this.eventListeners[s]||(this.eventListeners[s]=[]),this.eventListeners[s].push({name:a,handler:e});return this}off(t,e){let n,i,r,s,a,l,h=(t||"").split(m),c=h.length;if(this._cache&&this._cache.delete(o),!t)for(i in this.eventListeners)this._off(i);for(n=0;n<c;n++)if(r=h[n],s=r.split("."),a=s[0],l=s[1],a)this.eventListeners[a]&&this._off(a,l,e);else for(i in this.eventListeners)this._off(i,l,e);return this}dispatchEvent(t){const e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,(function(t){e.call(this,t.evt)})),this}removeEventListener(t){return this.off(t),this}_delegate(e,n,i){const r=this;this.on(e,(function(e){const s=e.target.findAncestors(n,!0,r);for(let n=0;n<s.length;n++)(e=t.Util.cloneObject(e)).currentTarget=s[n],i.call(s[n],e)}))}remove(){return this.isDragging()&&this.stopDrag(),r.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(l),this._clearSelfAndDescendantCache(a),this._clearSelfAndDescendantCache(h),this._clearSelfAndDescendantCache(g),this._clearSelfAndDescendantCache(v),this._clearSelfAndDescendantCache(d)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){const n="get"+t.Util._capitalize(e);return t.Util._isFunction(this[n])?this[n]():this.attrs[e]}getAncestors(){let t=this.getParent(),e=[];for(;t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges((()=>{let n,i;if(!e)return this;for(n in e)"children"!==n&&(i="set"+t.Util._capitalize(n),t.Util._isFunction(this[i])?this[i](e[n]):this._setAttr(n,e[n]))})),this}isListening(){return this._getCache(d,this._isListening)}_isListening(t){if(!this.listening())return!1;const e=this.getParent();return!e||e===t||this===t||e._isListening(t)}isVisible(){return this._getCache(v,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const e=this.getParent();return!e||e===t||this===t||e._isVisible(t)}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);const n=this.getLayer();let s=!1;r.DD._dragElements.forEach((t=>{"dragging"===t.dragStatus&&("Stage"===t.node.nodeType||t.node.getLayer()===n)&&(s=!0)}));const a=!e&&!i.Konva.hitOnDragEnabled&&(s||i.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t,e,n,i,r=this.getDepth(),s=this,a=0;const o=this.getStage();return"Stage"!==s.nodeType&&o&&function o(l){for(t=[],e=l.length,n=0;n<e;n++)i=l[n],a++,i.nodeType!==f&&(t=t.concat(i.getChildren().slice())),i._id===s._id&&(n=e);t.length>0&&t[0].getDepth()<=r&&o(t)}(o.getChildren()),a}getDepth(){let t=0,e=this.parent;for(;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(_),this._clearSelfAndDescendantCache(l)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges((()=>{this.x(t.x),this.y(t.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const e=t.getPointerPosition();if(!e)return null;const n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(e){let n=!1,i=this.parent;for(;i;){if(i.isCached()){n=!0;break}i=i.parent}n&&!e&&(e=!0);const r=this.getAbsoluteTransform(e).getMatrix(),s=new t.Transform,a=this.offset();return s.m=r.slice(),s.translate(a.x,a.y),s.getTranslation()}setAbsolutePosition(t){const{x:e,y:n,...i}=this._clearTransform();this.attrs.x=e,this.attrs.y=n,this._clearCache(_);const r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(i),this.setPosition({x:t.x,y:t.y}),this._clearCache(_),this._clearSelfAndDescendantCache(l),this}_setTransform(t){let e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let e=t.x,n=t.y,i=this.x(),r=this.y();return void 0!==e&&(i+=e),void 0!==n&&(r+=n),this.setPosition({x:i,y:r}),this}_eachAncestorReverse(t,e){let n,i,r=[],s=this.getParent();if(!e||e._id!==this._id){for(r.unshift(this);s&&(!e||s._id!==e._id);)r.unshift(s),s=s.parent;for(n=r.length,i=0;i<n;i++)t(r[i])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return t.Util.warn("Node has no parent. moveToTop function is ignored."),!1;const e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return t.Util.warn("Node has no parent. moveUp function is ignored."),!1;const e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return t.Util.warn("Node has no parent. moveDown function is ignored."),!1;const e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return t.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const 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 t.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&t.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)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(a,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let e,n,i,r,s,a=this.getAttrs();const o={attrs:{},className:this.getClassName()};for(e in a)n=a[e],s=t.Util.isObject(n)&&!t.Util._isPlainObject(n)&&!t.Util._isArray(n),s||(i="function"==typeof this[e]&&this[e],delete a[e],r=i?i.call(this):null,a[e]=n,r!==n&&(o.attrs[e]=n));return t.Util._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,n){const i=[];e&&this._isMatch(t)&&i.push(this);let r=this.parent;for(;r;){if(r===n)return i;r._isMatch(t)&&i.push(r),r=r.parent}return i}isAncestorOf(t){return!1}findAncestor(t,e,n){return this.findAncestors(t,e,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);let n,i,r=e.replace(/ /g,"").split(","),s=r.length;for(n=0;n<s;n++)if(i=r[n],t.Util.isValidSelector(i)||(t.Util.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),t.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),t.Util.warn("Konva is awesome, right?")),"#"===i.charAt(0)){if(this.id()===i.slice(1))return!0}else if("."===i.charAt(0)){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(g,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,e={},n){return e.target=e.target||this,n?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(l,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let n;if(e)return n=new t.Transform,this._eachAncestorReverse((function(t){const e=t.transformsEnabled();"all"===e?n.multiply(t.getTransform()):"position"===e&&n.translate(t.x()-t.offsetX(),t.y()-t.offsetY())}),e),n;{n=this._cache.get(l)||new t.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const e=this.transformsEnabled();if("all"===e)n.multiply(this.getTransform());else if("position"===e){const t=this.attrs.x||0,e=this.attrs.y||0,i=this.attrs.offsetX||0,r=this.attrs.offsetY||0;n.translate(t-i,e-r)}return n.dirty=!1,n}}getAbsoluteScale(t){let e=this;for(;e;)e._isUnderCache&&(t=e),e=e.getParent();const n=this.getAbsoluteTransform(t).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(_,this._getTransform)}_getTransform(){var e,n;const r=this._cache.get(_)||new t.Transform;r.reset();const s=this.x(),a=this.y(),o=i.Konva.getAngle(this.rotation()),l=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,h=null!==(n=this.attrs.scaleY)&&void 0!==n?n:1,c=this.attrs.skewX||0,d=this.attrs.skewY||0,u=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return 0===s&&0===a||r.translate(s,a),0!==o&&r.rotate(o),0===c&&0===d||r.skew(c,d),1===l&&1===h||r.scale(l,h),0===u&&0===p||r.translate(-1*u,-1*p),r.dirty=!1,r}clone(e){let n,i,r,s,a,o=t.Util.cloneObject(this.attrs);for(n in e)o[n]=e[n];const l=new this.constructor(o);for(n in this.eventListeners)for(i=this.eventListeners[n],r=i.length,s=0;s<r;s++)a=i[s],a.name.indexOf("konva")<0&&(l.eventListeners[n]||(l.eventListeners[n]=[]),l.eventListeners[n].push(a));return l}_toKonvaCanvas(t){t=t||{};const e=this.getClientRect(),i=this.getStage(),r=void 0!==t.x?t.x:Math.floor(e.x),s=void 0!==t.y?t.y:Math.floor(e.y),a=t.pixelRatio||1,o=new n.SceneCanvas({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:a}),l=o.getContext(),h=new n.SceneCanvas({width:o.width/o.pixelRatio+Math.abs(r),height:o.height/o.pixelRatio+Math.abs(s),pixelRatio:o.pixelRatio});return!1===t.imageSmoothingEnabled&&(l._context.imageSmoothingEnabled=!1),l.save(),(r||s)&&l.translate(-1*r,-1*s),this.drawScene(o,void 0,h),l.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){const e=(t=t||{}).mimeType||null,n=t.quality||null,i=this._toKonvaCanvas(t).toDataURL(e,n);return t.callback&&t.callback(i),i}toImage(e){return new Promise(((n,i)=>{try{const i=null==e?void 0:e.callback;i&&delete e.callback,t.Util._urlToImage(this.toDataURL(e),(function(t){n(t),null==i||i(t)}))}catch(t){i(t)}}))}toBlob(t){return new Promise(((e,n)=>{try{const n=null==t?void 0:t.callback;n&&delete t.callback,this.toCanvas(t).toBlob((t=>{e(t),null==n||n(t)}),null==t?void 0:t.mimeType,null==t?void 0:t.quality)}catch(t){n(t)}}))}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():i.Konva.dragDistance}_off(t,e,n){let i,r,s,a=this.eventListeners[t];for(i=0;i<a.length;i++)if(r=a[i].name,s=a[i].handler,!("konva"===r&&"konva"!==e||e&&r!==e||n&&n!==s)){if(a.splice(i,1),0===a.length){delete this.eventListeners[t];break}i--}}_fireChangeEvent(t,e,n){this._fire(t+"Change",{oldVal:e,newVal:n})}addName(t){if(!this.hasName(t)){const e=this.name(),n=e?e+" "+t:t;this.name(n)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;return-1!==(e||"").split(/\s/g).indexOf(t)}removeName(t){const e=(this.name()||"").split(/\s/g),n=e.indexOf(t);return-1!==n&&(e.splice(n,1),this.name(e.join(" "))),this}setAttr(e,n){const i=this["set"+t.Util._capitalize(e)];return t.Util._isFunction(i)?i.call(this,n):this._setAttr(e,n),this}_requestDraw(){if(i.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();null==t||t.batchDraw()}}_setAttr(e,n){const i=this.attrs[e];(i!==n||t.Util.isObject(n))&&(null==n?delete this.attrs[e]:this.attrs[e]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(e,i,n),this._requestDraw())}_setComponentAttr(t,e,n){let i;void 0!==n&&(i=this.attrs[t],i||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=n,this._fireChangeEvent(t,i,n))}_fireAndBubble(t,e,n){e&&this.nodeType===f&&(e.target=this);if(!((t===u||t===p)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||"Stage"===this.nodeType&&!n))){this._fire(t,e);const i=(t===u||t===p)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!i&&(n&&n.parent?this._fireAndBubble.call(this.parent,t,e,n):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,n,i;const r=null!==(e=this._cache.get(o))&&void 0!==e?e:{};let s=null==r?void 0:r[t];if(void 0===s){s=[];let e=Object.getPrototypeOf(this);for(;e;){const r=null!==(i=null===(n=e.eventListeners)||void 0===n?void 0:n[t])&&void 0!==i?i:[];s.push(...r),e=Object.getPrototypeOf(e)}r[t]=s,this._cache.set(o,r)}return s}_fire(t,e){(e=e||{}).currentTarget=this,e.type=t;const n=this._getProtoListeners(t);if(n)for(var i=0;i<n.length;i++)n[i].handler.call(this,e);const r=this.eventListeners[t];if(r)for(i=0;i<r.length;i++)r[i].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const e=t?t.pointerId:void 0,n=this.getStage(),i=this.getAbsolutePosition();if(!n)return;const s=n._getPointerById(e)||n._changedPointerPositions[0]||i;r.DD._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-i.x,y:s.y-i.y},dragStatus:"ready",pointerId:e})}startDrag(t,e=!0){r.DD._dragElements.has(this._id)||this._createDragElement(t);r.DD._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(e,n){const i=this.getStage()._getPointerById(n.pointerId);if(!i)return;let r={x:i.x-n.offset.x,y:i.y-n.offset.y};const s=this.dragBoundFunc();if(void 0!==s){const n=s.call(this,r,e);n?r=n:t.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}stopDrag(t){const e=r.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),r.DD._endDragBefore(t),r.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=r.DD._dragElements.get(this._id);return!!t&&"dragging"===t.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(t){if(!(!(void 0!==t.evt.button)||i.Konva.dragButtons.indexOf(t.evt.button)>=0))return;if(this.isDragging())return;let e=!1;r.DD._dragElements.forEach((t=>{this.isAncestorOf(t.node)&&(e=!0)})),e||this._createDragElement(t)}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();if(!this.getStage())return;const t=r.DD._dragElements.get(this._id),e=t&&"dragging"===t.dragStatus,n=t&&"ready"===t.dragStatus;e?this.stopDrag():n&&r.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const i={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return t.Util.haveIntersection(i,this.getClientRect())}static create(e,n){return t.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(n,r){let s,a,o,l=e.prototype.getClassName.call(n),h=n.children;r&&(n.attrs.container=r),i.Konva[l]||(t.Util.warn('Can not find a node with class name "'+l+'". Fallback to "Shape".'),l="Shape");if(s=new(0,i.Konva[l])(n.attrs),h)for(a=h.length,o=0;o<a;o++)s.add(e._createNode(h[o]));return s}};A.Node=b,b.prototype.nodeType="Node",b.prototype._attrsAffectingSize=[],b.prototype.eventListeners={},b.prototype.on.call(b.prototype,y,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(_),this._clearSelfAndDescendantCache(l))})),b.prototype.on.call(b.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(v)})),b.prototype.on.call(b.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(d)})),b.prototype.on.call(b.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(a)}));const M=e.Factory.addGetterSetter;return M(b,"zIndex"),M(b,"absolutePosition"),M(b,"position"),M(b,"x",0,(0,s.getNumberValidator)()),M(b,"y",0,(0,s.getNumberValidator)()),M(b,"globalCompositeOperation","source-over",(0,s.getStringValidator)()),M(b,"opacity",1,(0,s.getNumberValidator)()),M(b,"name","",(0,s.getStringValidator)()),M(b,"id","",(0,s.getStringValidator)()),M(b,"rotation",0,(0,s.getNumberValidator)()),e.Factory.addComponentsGetterSetter(b,"scale",["x","y"]),M(b,"scaleX",1,(0,s.getNumberValidator)()),M(b,"scaleY",1,(0,s.getNumberValidator)()),e.Factory.addComponentsGetterSetter(b,"skew",["x","y"]),M(b,"skewX",0,(0,s.getNumberValidator)()),M(b,"skewY",0,(0,s.getNumberValidator)()),e.Factory.addComponentsGetterSetter(b,"offset",["x","y"]),M(b,"offsetX",0,(0,s.getNumberValidator)()),M(b,"offsetY",0,(0,s.getNumberValidator)()),M(b,"dragDistance",void 0,(0,s.getNumberValidator)()),M(b,"width",0,(0,s.getNumberValidator)()),M(b,"height",0,(0,s.getNumberValidator)()),M(b,"listening",!0,(0,s.getBooleanValidator)()),M(b,"preventDefault",!0,(0,s.getBooleanValidator)()),M(b,"filters",void 0,(function(t){return this._filterUpToDate=!1,t})),M(b,"visible",!0,(0,s.getBooleanValidator)()),M(b,"transformsEnabled","all",(0,s.getStringValidator)()),M(b,"size"),M(b,"dragBoundFunc"),M(b,"draggable",!1,(0,s.getBooleanValidator)()),e.Factory.backCompat(b,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"}),A}var V,W={};function X(){if(V)return W;V=1,Object.defineProperty(W,"__esModule",{value:!0}),W.Container=void 0;const t=L(),e=H(),n=P();let i=class extends e.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[],n=[];return e.forEach((function(e){t(e)&&n.push(e)})),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.destroy()})),this.children=[],this._requestDraw(),this}add(...t){if(0===t.length)return this;if(t.length>1){for(let e=0;e<t.length;e++)this.add(t[e]);return this}const e=t[0];return e.getParent()?(e.moveTo(this),this):(this._validateAdd(e),e.index=this.getChildren().length,e.parent=this,e._clearCaches(),this.getChildren().push(e),this._fire("add",{child:e}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){const e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){const n=[];return this._descendants((i=>{const r=i._isMatch(t);return r&&n.push(i),!(!r||!e)})),n}_descendants(t){let e=!1;const n=this.getChildren();for(const i of n){if(e=t(i),e)return!0;if(i.hasChildren()&&(e=i._descendants(t),e))return!0}return!1}toObject(){const t=e.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach((e=>{t.children.push(e.toObject())})),t}isAncestorOf(t){let e=t.getParent();for(;e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){const n=e.Node.prototype.clone.call(this,t);return this.getChildren().forEach((function(t){n.add(t.clone())})),n}getAllIntersections(t){const e=[];return this.find("Shape").forEach((n=>{n.isVisible()&&n.intersects(t)&&e.push(n)})),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null===(e=this.children)||void 0===e||e.forEach((function(e){e._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;null===(t=this.children)||void 0===t||t.forEach((function(t,e){t.index=e})),this._requestDraw()}drawScene(t,e,n){const i=this.getLayer(),r=t||i&&i.getCanvas(),s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,l=r&&r.isCache;if(!this.isVisible()&&!l)return this;if(o){s.save();const t=this.getAbsoluteTransform(e).getMatrix();s.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",r,e,n);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;const n=this.getLayer(),i=t||n&&n.hitCanvas,r=i&&i.getContext(),s=this._getCanvasCache();if(s&&s.hit){r.save();const t=this.getAbsoluteTransform(e).getMatrix();r.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(r),r.restore()}else this._drawChildren("drawHit",i,e);return this}_drawChildren(t,e,n,i){var r;const s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),l=this.clipFunc(),h="number"==typeof a&&"number"==typeof o||l,c=n===this;if(h){s.save();const t=this.getAbsoluteTransform(n);let e,i=t.getMatrix();if(s.transform(i[0],i[1],i[2],i[3],i[4],i[5]),s.beginPath(),l)e=l.call(this,s,this);else{const t=this.clipX(),e=this.clipY();s.rect(t||0,e||0,a,o)}s.clip.apply(s,e),i=t.copy().invert().getMatrix(),s.transform(i[0],i[1],i[2],i[3],i[4],i[5])}const d=!c&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;d&&(s.save(),s._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[t](e,n,i)})),d&&s.restore(),h&&s.restore()}getClientRect(t={}){var e;const n=t.skipTransform,i=t.relativeTo;let r,s,a,o,l={x:1/0,y:1/0,width:0,height:0};const h=this;null===(e=this.children)||void 0===e||e.forEach((function(e){if(!e.visible())return;const n=e.getClientRect({relativeTo:h,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===n.width&&0===n.height||(void 0===r?(r=n.x,s=n.y,a=n.x+n.width,o=n.y+n.height):(r=Math.min(r,n.x),s=Math.min(s,n.y),a=Math.max(a,n.x+n.width),o=Math.max(o,n.y+n.height)))}));const c=this.find("Shape");let d=!1;for(let t=0;t<c.length;t++){if(c[t]._isVisible(this)){d=!0;break}}return l=d&&void 0!==r?{x:r,y:s,width:a-r,height:o-s}:{x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,i)}};return W.Container=i,t.Factory.addComponentsGetterSetter(i,"clip",["x","y","width","height"]),t.Factory.addGetterSetter(i,"clipX",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipY",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipWidth",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipHeight",void 0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipFunc"),W}var j,Y,q={},K={};function Z(){if(j)return K;j=1,Object.defineProperty(K,"__esModule",{value:!0}),K.getCapturedShape=function(t){return e.get(t)},K.createEvent=i,K.hasPointerCapture=function(t,n){return e.get(t)===n},K.setPointerCapture=function(t,s){r(t);if(!s.getStage())return;e.set(t,s),n&&s._fire("gotpointercapture",i(new PointerEvent("gotpointercapture")))},K.releaseCapture=r;const t=S(),e=new Map,n=void 0!==t.Konva._global.PointerEvent;function i(t){return{evt:t,pointerId:t.pointerId}}function r(t,r){const s=e.get(t);if(!s)return;const a=s.getStage();a&&a.content,e.delete(t),n&&s._fire("lostpointercapture",i(new PointerEvent("lostpointercapture")))}return K}var Q,J,$={},tt={};function et(){return Q||(Q=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=S(),n=w(),i=L(),r=H(),s=P(),a=S(),o=Z(),l="hasShadow",h="shadowRGBA",c="patternImage",d="linearGradient",u="radialGradient";let p;function f(){return p||(p=n.Util.createCanvasElement().getContext("2d"),p)}t.shapes={};class m extends r.Node{constructor(e){let i;for(super(e);i=n.Util.getRandomColor(),!i||i in t.shapes;);this.colorKey=i,t.shapes[i]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.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(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const t=f().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(t&&t.setTransform){const i=new n.Transform;i.translate(this.fillPatternX(),this.fillPatternY()),i.rotate(e.Konva.getAngle(this.fillPatternRotation())),i.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),i.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const r=i.getMatrix(),s="undefined"==typeof DOMMatrix?{a:r[0],b:r[1],c:r[2],d:r[3],e:r[4],f:r[5]}:new DOMMatrix(r);t.setTransform(s)}return t}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){const t=this.fillLinearGradientColorStops();if(t){const e=f(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),r=e.createLinearGradient(n.x,n.y,i.x,i.y);for(let e=0;e<t.length;e+=2)r.addColorStop(t[e],t[e+1]);return r}}_getRadialGradient(){return this._getCache(u,this.__getRadialGradient)}__getRadialGradient(){const t=this.fillRadialGradientColorStops();if(t){const e=f(),n=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),r=e.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let e=0;e<t.length;e+=2)r.addColorStop(t[e],t[e+1]);return r}}getShadowRGBA(){return this._getCache(h,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const t=n.Util.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){const e=this.getStage();if(!e)return!1;const n=e.bufferHitCanvas;n.getContext().clear(),this.drawHit(n,void 0,!0);return n.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!(null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e))return!1;const n=t||this.hasFill(),i=this.hasStroke(),r=1!==this.getAbsoluteOpacity();if(n&&i&&r)return!0;const s=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(n&&i&&s&&a)}setStrokeHitEnabled(t){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,n=this.getParent();for(;n;){if(n.isCached()){e=!0;break}n=n.getParent()}const i=t.skipTransform,r=t.relativeTo||e&&this.getStage()||void 0,s=this.getSelfRect(),a=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=s.width+a,l=s.height+a,h=!t.skipShadow&&this.hasShadow(),c=h?this.shadowOffsetX():0,d=h?this.shadowOffsetY():0,u=o+Math.abs(c),p=l+Math.abs(d),f=h&&this.shadowBlur()||0,m={width:u+2*f,height:p+2*f,x:-(a/2+f)+Math.min(c,0)+s.x,y:-(a/2+f)+Math.min(d,0)+s.y};return i?m:this._transformedRect(m,r)}drawScene(t,e,n){const i=this.getLayer();let r,s,a=t||i.getCanvas(),o=a.getContext(),l=this._getCanvasCache(),h=this.getSceneFunc(),c=this.hasShadow();const d=a.isCache,u=e===this;if(!this.isVisible()&&!u)return this;if(l){o.save();const t=this.getAbsoluteTransform(e).getMatrix();return o.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!h)return this;if(o.save(),this._useBufferCanvas()&&!d){r=this.getStage();const t=n||r.bufferCanvas;s=t.getContext(),s.clear(),s.save(),s._applyLineJoin(this);var p=this.getAbsoluteTransform(e).getMatrix();s.transform(p[0],p[1],p[2],p[3],p[4],p[5]),h.call(this,s,this),s.restore();const i=t.pixelRatio;c&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(t._canvas,0,0,t.width/i,t.height/i)}else{if(o._applyLineJoin(this),!u){p=this.getAbsoluteTransform(e).getMatrix();o.transform(p[0],p[1],p[2],p[3],p[4],p[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}c&&o._applyShadow(this),h.call(this,o,this)}return o.restore(),this}drawHit(t,e,i=!1){if(!this.shouldDrawHit(e,i))return this;const r=this.getLayer(),s=t||r.hitCanvas,a=s&&s.getContext(),o=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),h=l&&l.hit;if(this.colorKey||n.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()"),h){a.save();const t=this.getAbsoluteTransform(e).getMatrix();return a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!o)return this;a.save(),a._applyLineJoin(this);if(!(this===e)){const t=this.getAbsoluteTransform(e).getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return o.call(this,a,this),a.restore(),this}drawHitFromCache(t=0){const e=this._getCanvasCache(),i=this._getCachedSceneCanvas(),r=e.hit,s=r.getContext(),a=r.getWidth(),o=r.getHeight();s.clear(),s.drawImage(i._canvas,0,0,a,o);try{const e=s.getImageData(0,0,a,o),i=e.data,r=i.length,l=n.Util._hexToRgb(this.colorKey);for(let e=0;e<r;e+=4){i[e+3]>t?(i[e]=l.r,i[e+1]=l.g,i[e+2]=l.b,i[e+3]=255):i[e+3]=0}s.putImageData(e,0,0)}catch(t){n.Util.error("Unable to draw hit graph from cached scene canvas. "+t.message)}return this}hasPointerCapture(t){return o.hasPointerCapture(t,this)}setPointerCapture(t){o.setPointerCapture(t,this)}releaseCapture(t){o.releaseCapture(t,this)}}t.Shape=m,m.prototype._fillFunc=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},m.prototype._strokeFunc=function(t){t.stroke()},m.prototype._fillFuncHit=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},m.prototype._strokeFuncHit=function(t){t.stroke()},m.prototype._centroid=!1,m.prototype.nodeType="Shape",(0,a._registerNode)(m),m.prototype.eventListeners={},m.prototype.on.call(m.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(l)})),m.prototype.on.call(m.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(h)})),m.prototype.on.call(m.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(c)})),m.prototype.on.call(m.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(d)})),m.prototype.on.call(m.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(u)})),i.Factory.addGetterSetter(m,"stroke",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(m,"strokeWidth",2,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillAfterStrokeEnabled",!1),i.Factory.addGetterSetter(m,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),i.Factory.addGetterSetter(m,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(m,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(m,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(m,"lineJoin"),i.Factory.addGetterSetter(m,"lineCap"),i.Factory.addGetterSetter(m,"sceneFunc"),i.Factory.addGetterSetter(m,"hitFunc"),i.Factory.addGetterSetter(m,"dash"),i.Factory.addGetterSetter(m,"dashOffset",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"shadowColor",void 0,(0,s.getStringValidator)()),i.Factory.addGetterSetter(m,"shadowBlur",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"shadowOpacity",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(m,"shadowOffset",["x","y"]),i.Factory.addGetterSetter(m,"shadowOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"shadowOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternImage"),i.Factory.addGetterSetter(m,"fill",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(m,"fillPatternX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillLinearGradientColorStops"),i.Factory.addGetterSetter(m,"strokeLinearGradientColorStops"),i.Factory.addGetterSetter(m,"fillRadialGradientStartRadius",0),i.Factory.addGetterSetter(m,"fillRadialGradientEndRadius",0),i.Factory.addGetterSetter(m,"fillRadialGradientColorStops"),i.Factory.addGetterSetter(m,"fillPatternRepeat","repeat"),i.Factory.addGetterSetter(m,"fillEnabled",!0),i.Factory.addGetterSetter(m,"strokeEnabled",!0),i.Factory.addGetterSetter(m,"shadowEnabled",!0),i.Factory.addGetterSetter(m,"dashEnabled",!0),i.Factory.addGetterSetter(m,"strokeScaleEnabled",!0),i.Factory.addGetterSetter(m,"fillPriority","color"),i.Factory.addComponentsGetterSetter(m,"fillPatternOffset",["x","y"]),i.Factory.addGetterSetter(m,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(m,"fillPatternScale",["x","y"]),i.Factory.addGetterSetter(m,"fillPatternScaleX",1,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(m,"fillPatternScaleY",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(m,"fillLinearGradientStartPoint",["x","y"]),i.Factory.addComponentsGetterSetter(m,"strokeLinearGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillLinearGradientStartPointX",0),i.Factory.addGetterSetter(m,"strokeLinearGradientStartPointX",0),i.Factory.addGetterSetter(m,"fillLinearGradientStartPointY",0),i.Factory.addGetterSetter(m,"strokeLinearGradientStartPointY",0),i.Factory.addComponentsGetterSetter(m,"fillLinearGradientEndPoint",["x","y"]),i.Factory.addComponentsGetterSetter(m,"strokeLinearGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillLinearGradientEndPointX",0),i.Factory.addGetterSetter(m,"strokeLinearGradientEndPointX",0),i.Factory.addGetterSetter(m,"fillLinearGradientEndPointY",0),i.Factory.addGetterSetter(m,"strokeLinearGradientEndPointY",0),i.Factory.addComponentsGetterSetter(m,"fillRadialGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillRadialGradientStartPointX",0),i.Factory.addGetterSetter(m,"fillRadialGradientStartPointY",0),i.Factory.addComponentsGetterSetter(m,"fillRadialGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(m,"fillRadialGradientEndPointX",0),i.Factory.addGetterSetter(m,"fillRadialGradientEndPointY",0),i.Factory.addGetterSetter(m,"fillPatternRotation",0),i.Factory.addGetterSetter(m,"fillRule",void 0,(0,s.getStringValidator)()),i.Factory.backCompat(m,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})}(tt)),tt}function nt(){if(J)return $;J=1,Object.defineProperty($,"__esModule",{value:!0}),$.Layer=void 0;const t=w(),e=X(),n=H(),i=L(),r=F(),s=P(),a=et(),o=S(),l=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],h=l.length;let c=class extends e.Container{constructor(t){super(t),this.canvas=new r.SceneCanvas,this.hitCanvas=new r.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){n.Node.prototype.moveToTop.call(this);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!n.Node.prototype.moveUp.call(this))return!1;const t=this.getStage();return!(!t||!t.content)&&(t.content.removeChild(this.getNativeCanvasElement()),this.index<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[this.index+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(n.Node.prototype.moveDown.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(n.Node.prototype.moveToBottom.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return n.Node.prototype.remove.call(this),e&&e.parentNode&&t.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(e){const n=e.getType();"Group"!==n&&"Shape"!==n&&t.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return(t=t||{}).width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=void 0!==t.x?t.x:this.x(),t.y=void 0!==t.y?t.y:this.y(),n.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){const t=this.visible();this.canvas._canvas.style.display=t?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){t.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){t.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,t.Util.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;let e=1,n=!1;for(;;){for(let i=0;i<h;i++){const r=l[i],s=this._getIntersection({x:t.x+r.x*e,y:t.y+r.y*e}),a=s.shape;if(a)return a;if(n=!!s.antialiased,!s.antialiased)break}if(!n)return null;e+=1}}_getIntersection(e){const n=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,r=i[3];if(255===r){const e=t.Util._rgbToHex(i[0],i[1],i[2]),n=a.shapes["#"+e];return n?{shape:n}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(t,n){const i=this.getLayer(),r=t||i&&i.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),e.Container.prototype.drawScene.call(this,r,n),this._fire("draw",{node:this}),this}drawHit(t,n){const i=this.getLayer(),r=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),e.Container.prototype.drawHit.call(this,r,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const t=this.parent;!!this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}destroy(){return t.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};return $.Layer=c,c.prototype.nodeType="Layer",(0,o._registerNode)(c),i.Factory.addGetterSetter(c,"imageSmoothingEnabled",!0),i.Factory.addGetterSetter(c,"clearBeforeDraw",!0),i.Factory.addGetterSetter(c,"hitGraphEnabled",!0,(0,s.getBooleanValidator)()),$}var it,rt={};var st,at={};function ot(){if(st)return at;st=1,Object.defineProperty(at,"__esModule",{value:!0}),at.Group=void 0;const t=w(),e=X(),n=S();class i extends e.Container{_validateAdd(e){const n=e.getType();"Group"!==n&&"Shape"!==n&&t.Util.throw("You may only add groups and shapes to groups.")}}return at.Group=i,i.prototype.nodeType="Group",(0,n._registerNode)(i),at}var lt,ht={};function ct(){if(lt)return ht;lt=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.Animation=void 0;const t=S(),e=w(),n=t.glob.performance&&t.glob.performance.now?function(){return t.glob.performance.now()}:function(){return(new Date).getTime()};let i=class t{constructor(e,i){this.id=t.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:n(),frameRate:0},this.func=e,this.setLayers(i)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,n=e.length;for(let i=0;i<n;i++)if(e[i]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=t.animations,n=e.length;for(let t=0;t<n;t++)if(e[t].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=n(),t._addAnimation(this),this}stop(){return t._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,n=this.animations,i=n.length;for(let t=0;t<i;t++)if(n[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){const t={},e=this.animations;for(let i=0;i<e.length;i++){const r=e[i],s=r.layers,a=r.func;r._updateFrameObject(n());const o=s.length;let l;if(l=!a||!1!==a.call(r,r.frame),l)for(let e=0;e<o;e++){const n=s[e];void 0!==n._id&&(t[n._id]=n)}}for(const e in t)t.hasOwnProperty(e)&&t[e].batchDraw()}static _animationLoop(){const n=t;n.animations.length?(n._runFrames(),e.Util.requestAnimFrame(n._animationLoop)):n.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,e.Util.requestAnimFrame(this._animationLoop))}};return ht.Animation=i,i.animations=[],i.animIdCounter=0,i.animRunning=!1,ht}var dt,ut,pt={};function ft(){return ut||(ut=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const e=S(),n=w(),i=H(),r=X(),s=(Y||(Y=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Stage=t.stages=void 0;const e=w(),n=L(),i=X(),r=S(),s=F(),a=G(),o=S(),l=Z(),h="mouseleave",c="mouseover",d="mouseenter",u="mousemove",p="mousedown",f="mouseup",m="pointermove",g="pointerdown",_="pointerup",v="pointercancel",y="pointerout",x="pointerleave",b="pointerover",M="pointerenter",E="contextmenu",T="touchstart",A="touchend",C="touchmove",R="touchcancel",P="wheel",I=[[d,"_pointerenter"],[p,"_pointerdown"],[u,"_pointermove"],[f,"_pointerup"],[h,"_pointerleave"],[T,"_pointerdown"],[C,"_pointermove"],[A,"_pointerup"],[R,"_pointercancel"],[c,"_pointerover"],[P,"_wheel"],[E,"_contextmenu"],[g,"_pointerdown"],[m,"_pointermove"],[_,"_pointerup"],[v,"_pointercancel"],["lostpointercapture","_lostpointercapture"]],D={mouse:{[y]:"mouseout",[x]:h,[b]:c,[M]:d,[m]:u,[g]:p,[_]:f,[v]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[y]:"touchout",[x]:"touchleave",[b]:"touchover",[M]:"touchenter",[m]:C,[g]:T,[_]:A,[v]:R,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[y]:y,[x]:x,[b]:b,[M]:M,[m]:m,[g]:g,[_]:_,[v]:v,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},N=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",U=t=>{const e=N(t);return"pointer"===e?r.Konva.pointerEventsEnabled&&D.pointer:"touch"===e?D.touch:"mouse"===e?D.mouse:void 0};function O(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}t.stages=[];class k extends i.Container{constructor(e){super(O(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",(()=>{O(this.attrs)})),this._checkVisibility()}_validateAdd(t){const n="Layer"===t.getType(),i="FastLayer"===t.getType();n||i||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if("string"==typeof t){if("."===t.charAt(0)){const e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var e;e="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(e)}if(!t)throw"Can not find container in document with id "+e}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const t=this.children,e=t.length;for(let n=0;n<e;n++)t[n].clear();return this}clone(t){return t||(t={}),t.container="undefined"!=typeof document&&document.createElement("div"),i.Container.prototype.clone.call(this,t)}destroy(){super.destroy();const n=this.content;n&&e.Util._isInDocument(n)&&this.container().removeChild(n);const i=t.stages.indexOf(this);return i>-1&&t.stages.splice(i,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(e.Util.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(t){return this._pointerPositions.find((e=>e.id===t))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){(t=t||{}).x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();const e=new s.SceneCanvas({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),n=e.getContext()._context,i=this.children;return(t.x||t.y)&&n.translate(-1*t.x,-1*t.y),i.forEach((function(e){if(!e.isVisible())return;const i=e._toKonvaCanvas(t);n.drawImage(i._canvas,t.x,t.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())})),e}getIntersection(t){if(!t)return null;const e=this.children;for(let n=e.length-1;n>=0;n--){const i=e[n].getIntersection(t);if(i)return i}return null}_resizeDOM(){const t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach((n=>{n.setSize({width:t,height:e}),n.draw()}))}add(t,...n){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}super.add(t);const i=this.children.length;return i>5&&e.Util.warn("The stage has "+i+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),t.setSize({width:this.width(),height:this.height()}),t.draw(),r.Konva.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return l.hasPointerCapture(t,this)}setPointerCapture(t){l.setPointerCapture(t,this)}releaseCapture(t){l.releaseCapture(t,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&I.forEach((([t,e])=>{this.content.addEventListener(t,(t=>{this[e](t)}),{passive:!1})}))}_pointerenter(t){this.setPointersPositions(t);const e=U(t.type);e&&this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);const e=U(t.type);e&&this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];return e&&!e.getStage()&&(e=null),e}_pointerleave(t){const e=U(t.type),n=N(t.type);if(!e)return;this.setPointersPositions(t);const i=this._getTargetShape(n),s=!(r.Konva.isDragging()||r.Konva.isTransforming())||r.Konva.hitOnDragEnabled;i&&s?(i._fireAndBubble(e.pointerout,{evt:t}),i._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[n+"targetShape"]=null):s&&(this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(t){const e=U(t.type),n=N(t.type);if(!e)return;this.setPointersPositions(t);let i=!1;this._changedPointerPositions.forEach((s=>{const o=this.getIntersection(s);if(a.DD.justDragged=!1,r.Konva["_"+n+"ListenClick"]=!0,!o||!o.isListening())return void(this[n+"ClickStartShape"]=void 0);r.Konva.capturePointerEventsEnabled&&o.setPointerCapture(s.id),this[n+"ClickStartShape"]=o,o._fireAndBubble(e.pointerdown,{evt:t,pointerId:s.id}),i=!0;const l=t.type.indexOf("touch")>=0;o.preventDefault()&&t.cancelable&&l&&t.preventDefault()})),i||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(t){const e=U(t.type),n=N(t.type);if(!e)return;if(r.Konva.isDragging()&&a.DD.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t),(r.Konva.isDragging()||r.Konva.isTransforming())&&!r.Konva.hitOnDragEnabled)return;const i={};let s=!1;const o=this._getTargetShape(n);this._changedPointerPositions.forEach((r=>{const a=l.getCapturedShape(r.id)||this.getIntersection(r),h=r.id,c={evt:t,pointerId:h},d=o!==a;if(d&&o&&(o._fireAndBubble(e.pointerout,{...c},a),o._fireAndBubble(e.pointerleave,{...c},a)),a){if(i[a._id])return;i[a._id]=!0}a&&a.isListening()?(s=!0,d&&(a._fireAndBubble(e.pointerover,{...c},o),a._fireAndBubble(e.pointerenter,{...c},o),this[n+"targetShape"]=a),a._fireAndBubble(e.pointermove,{...c})):o&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:h}),this[n+"targetShape"]=null)})),s||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){const e=U(t.type),n=N(t.type);if(!e)return;this.setPointersPositions(t);const i=this[n+"ClickStartShape"],s=this[n+"ClickEndShape"],o={};let h=!1;this._changedPointerPositions.forEach((c=>{const d=l.getCapturedShape(c.id)||this.getIntersection(c);if(d){if(d.releaseCapture(c.id),o[d._id])return;o[d._id]=!0}const u=c.id,p={evt:t,pointerId:u};let f=!1;r.Konva["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):a.DD.justDragged||(r.Konva["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){r.Konva["_"+n+"InDblClickWindow"]=!1}),r.Konva.dblClickWindow),d&&d.isListening()?(h=!0,this[n+"ClickEndShape"]=d,d._fireAndBubble(e.pointerup,{...p}),r.Konva["_"+n+"ListenClick"]&&i&&i===d&&(d._fireAndBubble(e.pointerclick,{...p}),f&&s&&s===d&&d._fireAndBubble(e.pointerdblclick,{...p}))):(this[n+"ClickEndShape"]=null,r.Konva["_"+n+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:u}),f&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:u}))})),h||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+n+"ListenClick"]=!1,t.cancelable&&"touch"!==n&&"pointer"!==n&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(E,{evt:t}):this._fire(E,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(P,{evt:t}):this._fire(P,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);const e=l.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble(_,l.createEvent(t)),l.releaseCapture(t.pointerId)}_lostpointercapture(t){l.releaseCapture(t.pointerId)}setPointersPositions(t){const n=this._getContentPosition();let i=null,r=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,(t=>{this._pointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})})),Array.prototype.forEach.call(t.changedTouches||t.touches,(t=>{this._changedPointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})}))):(i=(t.clientX-n.left)/n.scaleX,r=(t.clientY-n.top)/n.scaleY,this.pointerPos={x:i,y:r},this._pointerPositions=[{x:i,y:r,id:e.Util._getFirstPointerId(t)}],this._changedPointerPositions=[{x:i,y:r,id:e.Util._getFirstPointerId(t)}])}_setPointerPosition(t){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!r.Konva.isBrowser)return;const t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(t){t.batchDraw()})),this}}t.Stage=k,k.prototype.nodeType="Stage",(0,o._registerNode)(k),n.Factory.addGetterSetter(k,"container"),r.Konva.isBrowser&&document.addEventListener("visibilitychange",(()=>{t.stages.forEach((t=>{t.batchDraw()}))}))}(q)),q),a=nt(),o=function(){if(it)return rt;it=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.FastLayer=void 0;const t=w(),e=nt(),n=S();let i=class extends e.Layer{constructor(e){super(e),this.listening(!1),t.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};return rt.FastLayer=i,i.prototype.nodeType="FastLayer",(0,n._registerNode)(i),rt}(),l=ot(),h=G(),c=et(),d=ct(),u=(dt||(dt=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Easings=t.Tween=void 0;const e=w(),n=ct(),i=H(),r=S(),s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=["fill","stroke","shadowColor"];let o=0;class l{constructor(t,e,n,i,r,s,a){this.prop=t,this.propFunc=e,this.begin=i,this._pos=i,this.duration=s,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=r-this.begin,this.pause()}fire(t){const e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class h{constructor(i){const a=this,c=i.node,d=c._id,u=i.easing||t.Easings.Linear,p=!!i.yoyo;let f,m;f=void 0===i.duration?.3:0===i.duration?.001:i.duration,this.node=c,this._id=o++;const g=c.getLayer()||(c instanceof r.Konva.Stage?c.getLayers():null);for(m in g||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation((function(){a.tween.onEnterFrame()}),g),this.tween=new l(m,(function(t){a._tweenFunc(t)}),u,0,1,1e3*f,p),this._addListeners(),h.attrs[d]||(h.attrs[d]={}),h.attrs[d][this._id]||(h.attrs[d][this._id]={}),h.tweens[d]||(h.tweens[d]={}),i)void 0===s[m]&&this._addAttr(m,i[m]);this.reset(),this.onFinish=i.onFinish,this.onReset=i.onReset,this.onUpdate=i.onUpdate}_addAttr(t,n){const i=this.node,r=i._id;let s,o,l,c,d;const u=h.tweens[r][t];u&&delete h.attrs[r][u][t];let p=i.getAttr(t);if(e.Util._isArray(n))if(s=[],o=Math.max(n.length,p.length),"points"===t&&n.length!==p.length&&(n.length>p.length?(c=p,p=e.Util._prepareArrayForTween(p,n,i.closed())):(l=n,n=e.Util._prepareArrayForTween(n,p,i.closed()))),0===t.indexOf("fill"))for(let t=0;t<o;t++)if(t%2==0)s.push(n[t]-p[t]);else{const i=e.Util.colorToRGBA(p[t]);d=e.Util.colorToRGBA(n[t]),p[t]=i,s.push({r:d.r-i.r,g:d.g-i.g,b:d.b-i.b,a:d.a-i.a})}else for(let t=0;t<o;t++)s.push(n[t]-p[t]);else-1!==a.indexOf(t)?(p=e.Util.colorToRGBA(p),d=e.Util.colorToRGBA(n),s={r:d.r-p.r,g:d.g-p.g,b:d.b-p.b,a:d.a-p.a}):s=n-p;h.attrs[r][this._id][t]={start:p,diff:s,end:n,trueEnd:l,trueStart:c},h.tweens[r][t]=this._id}_tweenFunc(t){const n=this.node,i=h.attrs[n._id][this._id];let r,s,o,l,c,d,u,p;for(r in i){if(s=i[r],o=s.start,l=s.diff,p=s.end,e.Util._isArray(o))if(c=[],u=Math.max(o.length,p.length),0===r.indexOf("fill"))for(d=0;d<u;d++)d%2==0?c.push((o[d]||0)+l[d]*t):c.push("rgba("+Math.round(o[d].r+l[d].r*t)+","+Math.round(o[d].g+l[d].g*t)+","+Math.round(o[d].b+l[d].b*t)+","+(o[d].a+l[d].a*t)+")");else for(d=0;d<u;d++)c.push((o[d]||0)+l[d]*t);else c=-1!==a.indexOf(r)?"rgba("+Math.round(o.r+l.r*t)+","+Math.round(o.g+l.g*t)+","+Math.round(o.b+l.b*t)+","+(o.a+l.a*t)+")":o+l*t;n.setAttr(r,c)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,e=h.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,e=h.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(1e3*t),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const t=this.node._id,e=this._id,n=h.tweens[t];this.pause();for(const e in n)delete h.tweens[t][e];delete h.attrs[t][e]}}t.Tween=h,h.attrs={},h.tweens={},i.Node.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new h(t).play()},t.Easings={BackEaseIn(t,e,n,i){const r=1.70158;return n*(t/=i)*t*((r+1)*t-r)+e},BackEaseOut(t,e,n,i){const r=1.70158;return n*((t=t/i-1)*t*((r+1)*t+r)+1)+e},BackEaseInOut(t,e,n,i){let r=1.70158;return(t/=i/2)<1?n/2*(t*t*((1+(r*=1.525))*t-r))+e:n/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},ElasticEaseIn(t,e,n,i,r,s){let a=0;return 0===t?e:1==(t/=i)?e+n:(s||(s=.3*i),!r||r<Math.abs(n)?(r=n,a=s/4):a=s/(2*Math.PI)*Math.asin(n/r),-r*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/s)+e)},ElasticEaseOut(t,e,n,i,r,s){let a=0;return 0===t?e:1==(t/=i)?e+n:(s||(s=.3*i),!r||r<Math.abs(n)?(r=n,a=s/4):a=s/(2*Math.PI)*Math.asin(n/r),r*Math.pow(2,-10*t)*Math.sin((t*i-a)*(2*Math.PI)/s)+n+e)},ElasticEaseInOut(t,e,n,i,r,s){let a=0;return 0===t?e:2==(t/=i/2)?e+n:(s||(s=i*(.3*1.5)),!r||r<Math.abs(n)?(r=n,a=s/4):a=s/(2*Math.PI)*Math.asin(n/r),t<1?r*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/s)*-.5+e:r*Math.pow(2,-10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/s)*.5+n+e)},BounceEaseOut:(t,e,n,i)=>(t/=i)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(e,n,i,r)=>i-t.Easings.BounceEaseOut(r-e,0,i,r)+n,BounceEaseInOut:(e,n,i,r)=>e<r/2?.5*t.Easings.BounceEaseIn(2*e,0,i,r)+n:.5*t.Easings.BounceEaseOut(2*e-r,0,i,r)+.5*i+n,EaseIn:(t,e,n,i)=>n*(t/=i)*t+e,EaseOut:(t,e,n,i)=>-n*(t/=i)*(t-2)+e,EaseInOut:(t,e,n,i)=>(t/=i/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,n,i)=>n*(t/=i)*t*t*t*t+e,StrongEaseOut:(t,e,n,i)=>n*((t=t/i-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,n,i)=>(t/=i/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,n,i)=>n*t/i+e}}(pt)),pt),p=O(),f=F();t.Konva=n.Util._assign(e.Konva,{Util:n.Util,Transform:n.Transform,Node:i.Node,Container:r.Container,Stage:s.Stage,stages:s.stages,Layer:a.Layer,FastLayer:o.FastLayer,Group:l.Group,DD:h.DD,Shape:c.Shape,shapes:c.shapes,Animation:d.Animation,Tween:u.Tween,Easings:u.Easings,Context:p.Context,Canvas:f.Canvas}),t.default=t.Konva}(y)),y}var mt,gt={};var _t,vt={},yt={};function xt(){if(_t)return yt;_t=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.Line=void 0;const t=L(),e=S(),n=et(),i=P();function r(t,e,n,i,r,s,a){const o=Math.sqrt(Math.pow(n-t,2)+Math.pow(i-e,2)),l=Math.sqrt(Math.pow(r-n,2)+Math.pow(s-i,2)),h=a*o/(o+l),c=a*l/(o+l);return[n-h*(r-t),i-h*(s-e),n+c*(r-t),i+c*(s-e)]}function s(t,e){const n=t.length,i=[];for(let s=2;s<n-2;s+=2){const n=r(t[s-2],t[s-1],t[s],t[s+1],t[s+2],t[s+3],e);isNaN(n[0])||(i.push(n[0]),i.push(n[1]),i.push(t[s]),i.push(t[s+1]),i.push(n[2]),i.push(n[3]))}return i}class a extends n.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(t){let e,n,i,r=this.points(),s=r.length,a=this.tension(),o=this.closed(),l=this.bezier();if(s){if(t.beginPath(),t.moveTo(r[0],r[1]),0!==a&&s>4){for(e=this.getTensionPoints(),n=e.length,i=o?0:4,o||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);i<n-2;)t.bezierCurveTo(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);o||t.quadraticCurveTo(e[n-2],e[n-1],r[s-2],r[s-1])}else if(l)for(i=2;i<s;)t.bezierCurveTo(r[i++],r[i++],r[i++],r[i++],r[i++],r[i++]);else for(i=2;i<s;i+=2)t.lineTo(r[i],r[i+1]);o?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():s(this.points(),this.tension())}_getTensionPointsClosed(){const t=this.points(),e=t.length,n=this.tension(),i=r(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),a=r(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),o=s(t,n);return[i[2],i[3]].concat(o).concat([a[0],a[1],t[e-2],t[e-1],a[2],a[3],i[0],i[1],t[0],t[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};t=0!==this.tension()?[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:this.points();let e,n,i=t[0],r=t[0],s=t[1],a=t[1];for(let o=0;o<t.length/2;o++)e=t[2*o],n=t[2*o+1],i=Math.min(i,e),r=Math.max(r,e),s=Math.min(s,n),a=Math.max(a,n);return{x:i,y:s,width:r-i,height:a-s}}}return yt.Line=a,a.prototype.className="Line",a.prototype._attrsAffectingSize=["points","bezier","tension"],(0,e._registerNode)(a),t.Factory.addGetterSetter(a,"closed",!1),t.Factory.addGetterSetter(a,"bezier",!1),t.Factory.addGetterSetter(a,"tension",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(a,"points",[],(0,i.getNumberArrayValidator)()),yt}var St,bt,Mt,wt={},Et={};function Tt(){if(bt)return wt;bt=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.Path=void 0;const t=L(),e=et(),n=S(),i=(St||(St=1,function(t){function e(t,e,i){const r=n(1,i,t),s=n(1,i,e),a=r*r+s*s;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=(n,i,r)=>{let s,a;const o=r/2;s=0;for(let r=0;r<20;r++)a=o*t.tValues[20][r]+o,s+=t.cValues[20][r]*e(n,i,a);return o*s},t.getQuadraticArcLength=(t,e,n)=>{void 0===n&&(n=1);const i=t[0]-2*t[1]+t[2],r=e[0]-2*e[1]+e[2],s=2*t[1]-2*t[0],a=2*e[1]-2*e[0],o=4*(i*i+r*r),l=4*(i*s+r*a),h=s*s+a*a;if(0===o)return n*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const c=l/(2*o),d=n+c,u=h/o-c*c,p=d*d+u>0?Math.sqrt(d*d+u):0,f=c*c+u>0?Math.sqrt(c*c+u):0,m=c+Math.sqrt(c*c+u)!==0?u*Math.log(Math.abs((d+p)/(c+f))):0;return Math.sqrt(o)/2*(d*p-c*f+m)};const n=(e,i,r)=>{const s=r.length-1;let a,o;if(0===s)return 0;if(0===e){o=0;for(let e=0;e<=s;e++)o+=t.binomialCoefficients[s][e]*Math.pow(1-i,s-e)*Math.pow(i,e)*r[e];return o}a=new Array(s);for(let t=0;t<s;t++)a[t]=s*(r[t+1]-r[t]);return n(e-1,i,a)};t.t2length=(t,e,n)=>{let i=1,r=t/e,s=(t-n(r))/e,a=0;for(;i>.001;){const o=n(r+s),l=Math.abs(t-o)/e;if(l<i)i=l,r+=s;else{const a=n(r-s),o=Math.abs(t-a)/e;o<i?(i=o,r-=s):s/=2}if(a++,a>500)break}return r}}(Et)),Et);let r=class t extends e.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",(function(){this._readDataAttribute()}))}_readDataAttribute(){this.dataArray=t.parsePathData(this.data()),this.pathLength=t.getPathLength(this.dataArray)}_sceneFunc(t){const e=this.dataArray;t.beginPath();let n=!1;for(let f=0;f<e.length;f++){const m=e[f].command,g=e[f].points;switch(m){case"L":t.lineTo(g[0],g[1]);break;case"M":t.moveTo(g[0],g[1]);break;case"C":t.bezierCurveTo(g[0],g[1],g[2],g[3],g[4],g[5]);break;case"Q":t.quadraticCurveTo(g[0],g[1],g[2],g[3]);break;case"A":var i=g[0],r=g[1],s=g[2],a=g[3],o=g[4],l=g[5],h=g[6],c=g[7],d=s>a?s:a,u=s>a?1:s/a,p=s>a?a/s:1;t.translate(i,r),t.rotate(h),t.scale(u,p),t.arc(0,0,d,o,o+l,1-c),t.scale(1/u,1/p),t.rotate(-h),t.translate(-i,-r);break;case"z":n=!0,t.closePath()}}n||this.hasFill()?t.fillStrokeShape(this):t.strokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach((function(n){if("A"===n.command){const i=n.points[4],r=n.points[5],s=n.points[4]+r;let a=Math.PI/180;if(Math.abs(i-s)<a&&(a=Math.abs(i-s)),r<0)for(let r=i-a;r>s;r-=a){const i=t.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],r,0);e.push(i.x,i.y)}else for(let r=i+a;r<s;r+=a){const i=t.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],r,0);e.push(i.x,i.y)}}else if("C"===n.command)for(let i=0;i<=1;i+=.01){const r=t.getPointOnCubicBezier(i,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);e.push(r.x,r.y)}else e=e.concat(n.points)}));let n,i,r=e[0],s=e[0],a=e[1],o=e[1];for(let t=0;t<e.length/2;t++)n=e[2*t],i=e[2*t+1],isNaN(n)||(r=Math.min(r,n),s=Math.max(s,n)),isNaN(i)||(a=Math.min(a,i),o=Math.max(o,i));return{x:r,y:a,width:s-r,height:o-a}}getLength(){return this.pathLength}getPointAtLength(e){return t.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(t,e,n,i){return Math.sqrt((n-t)*(n-t)+(i-e)*(i-e))}static getPathLength(t){let e=0;for(let n=0;n<t.length;++n)e+=t[n].pathLength;return e}static getPointAtLengthOfDataArray(e,n){let r,s=0,a=n.length;if(!a)return null;for(;s<a&&e>n[s].pathLength;)e-=n[s].pathLength,++s;if(s===a)return r=n[s-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return r=n[s].points.slice(0,2),{x:r[0],y:r[1]};const o=n[s],l=o.points;switch(o.command){case"L":return t.getPointOnLine(e,o.start.x,o.start.y,l[0],l[1]);case"C":return t.getPointOnCubicBezier((0,i.t2length)(e,t.getPathLength(n),(t=>(0,i.getCubicArcLength)([o.start.x,l[0],l[2],l[4]],[o.start.y,l[1],l[3],l[5]],t))),o.start.x,o.start.y,l[0],l[1],l[2],l[3],l[4],l[5]);case"Q":return t.getPointOnQuadraticBezier((0,i.t2length)(e,t.getPathLength(n),(t=>(0,i.getQuadraticArcLength)([o.start.x,l[0],l[2]],[o.start.y,l[1],l[3]],t))),o.start.x,o.start.y,l[0],l[1],l[2],l[3]);case"A":var h=l[0],c=l[1],d=l[2],u=l[3],p=l[4],f=l[5],m=l[6];return p+=f*e/o.pathLength,t.getPointOnEllipticalArc(h,c,d,u,p,m)}return null}static getPointOnLine(t,e,n,i,r,s,a){s=null!=s?s:e,a=null!=a?a:n;const o=this.getLineLength(e,n,i,r);if(o<1e-10)return{x:e,y:n};if(i===e)return{x:s,y:a+(r>n?t:-t)};const l=(r-n)/(i-e),h=Math.sqrt(t*t/(1+l*l))*(i<e?-1:1),c=l*h;if(Math.abs(a-n-l*(s-e))<1e-10)return{x:s+h,y:a+c};const d=((s-e)*(i-e)+(a-n)*(r-n))/(o*o),u=e+d*(i-e),p=n+d*(r-n),f=this.getLineLength(s,a,u,p),m=Math.sqrt(t*t-f*f),g=Math.sqrt(m*m/(1+l*l))*(i<e?-1:1);return{x:u+g,y:p+l*g}}static getPointOnCubicBezier(t,e,n,i,r,s,a,o,l){function h(t){return t*t*t}function c(t){return 3*t*t*(1-t)}function d(t){return 3*t*(1-t)*(1-t)}function u(t){return(1-t)*(1-t)*(1-t)}return{x:o*h(t)+s*c(t)+i*d(t)+e*u(t),y:l*h(t)+a*c(t)+r*d(t)+n*u(t)}}static getPointOnQuadraticBezier(t,e,n,i,r,s,a){function o(t){return t*t}function l(t){return 2*t*(1-t)}function h(t){return(1-t)*(1-t)}return{x:s*o(t)+i*l(t)+e*h(t),y:a*o(t)+r*l(t)+n*h(t)}}static getPointOnEllipticalArc(t,e,n,i,r,s){const a=Math.cos(s),o=Math.sin(s),l=n*Math.cos(r),h=i*Math.sin(r);return{x:t+(l*a-h*o),y:e+(l*o+h*a)}}static parsePathData(t){if(!t)return[];let e=t;const n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var i=0;i<n.length;i++)e=e.replace(new RegExp(n[i],"g"),"|"+n[i]);const r=e.split("|"),s=[],a=[];let o=0,l=0;const h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let c;for(i=1;i<r.length;i++){let t=r[i],e=t.charAt(0);for(t=t.slice(1),a.length=0;c=h.exec(t);)a.push(c[0]);const n=[];for(let t=0,e=a.length;t<e;t++){if("00"===a[t]){n.push(0,0);continue}const e=parseFloat(a[t]);isNaN(e)?n.push(0):n.push(e)}for(;n.length>0&&!isNaN(n[0]);){let t="",i=[];const r=o,a=l;var d,u,p,f,m,g,_,v,y,x;switch(e){case"l":o+=n.shift(),l+=n.shift(),t="L",i.push(o,l);break;case"L":o=n.shift(),l=n.shift(),i.push(o,l);break;case"m":var S=n.shift(),b=n.shift();if(o+=S,l+=b,t="M",s.length>2&&"z"===s[s.length-1].command)for(let t=s.length-2;t>=0;t--)if("M"===s[t].command){o=s[t].points[0]+S,l=s[t].points[1]+b;break}i.push(o,l),e="l";break;case"M":o=n.shift(),l=n.shift(),t="M",i.push(o,l),e="L";break;case"h":o+=n.shift(),t="L",i.push(o,l);break;case"H":o=n.shift(),t="L",i.push(o,l);break;case"v":l+=n.shift(),t="L",i.push(o,l);break;case"V":l=n.shift(),t="L",i.push(o,l);break;case"C":i.push(n.shift(),n.shift(),n.shift(),n.shift()),o=n.shift(),l=n.shift(),i.push(o,l);break;case"c":i.push(o+n.shift(),l+n.shift(),o+n.shift(),l+n.shift()),o+=n.shift(),l+=n.shift(),t="C",i.push(o,l);break;case"S":u=o,p=l,"C"===(d=s[s.length-1]).command&&(u=o+(o-d.points[2]),p=l+(l-d.points[3])),i.push(u,p,n.shift(),n.shift()),o=n.shift(),l=n.shift(),t="C",i.push(o,l);break;case"s":u=o,p=l,"C"===(d=s[s.length-1]).command&&(u=o+(o-d.points[2]),p=l+(l-d.points[3])),i.push(u,p,o+n.shift(),l+n.shift()),o+=n.shift(),l+=n.shift(),t="C",i.push(o,l);break;case"Q":i.push(n.shift(),n.shift()),o=n.shift(),l=n.shift(),i.push(o,l);break;case"q":i.push(o+n.shift(),l+n.shift()),o+=n.shift(),l+=n.shift(),t="Q",i.push(o,l);break;case"T":u=o,p=l,"Q"===(d=s[s.length-1]).command&&(u=o+(o-d.points[0]),p=l+(l-d.points[1])),o=n.shift(),l=n.shift(),t="Q",i.push(u,p,o,l);break;case"t":u=o,p=l,"Q"===(d=s[s.length-1]).command&&(u=o+(o-d.points[0]),p=l+(l-d.points[1])),o+=n.shift(),l+=n.shift(),t="Q",i.push(u,p,o,l);break;case"A":f=n.shift(),m=n.shift(),g=n.shift(),_=n.shift(),v=n.shift(),y=o,x=l,o=n.shift(),l=n.shift(),t="A",i=this.convertEndpointToCenterParameterization(y,x,o,l,_,v,f,m,g);break;case"a":f=n.shift(),m=n.shift(),g=n.shift(),_=n.shift(),v=n.shift(),y=o,x=l,o+=n.shift(),l+=n.shift(),t="A",i=this.convertEndpointToCenterParameterization(y,x,o,l,_,v,f,m,g)}s.push({command:t||e,points:i,start:{x:r,y:a},pathLength:this.calcLength(r,a,t||e,i)})}"z"!==e&&"Z"!==e||s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,s){let a,o,l,h;const c=t;switch(r){case"L":return c.getLineLength(e,n,s[0],s[1]);case"C":return(0,i.getCubicArcLength)([e,s[0],s[2],s[4]],[n,s[1],s[3],s[5]],1);case"Q":return(0,i.getQuadraticArcLength)([e,s[0],s[2]],[n,s[1],s[3]],1);case"A":a=0;var d=s[4],u=s[5],p=s[4]+u,f=Math.PI/180;if(Math.abs(d-p)<f&&(f=Math.abs(d-p)),o=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],d,0),u<0)for(h=d-f;h>p;h-=f)l=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],h,0),a+=c.getLineLength(o.x,o.y,l.x,l.y),o=l;else for(h=d+f;h<p;h+=f)l=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],h,0),a+=c.getLineLength(o.x,o.y,l.x,l.y),o=l;return l=c.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],p,0),a+=c.getLineLength(o.x,o.y,l.x,l.y),a}return 0}static convertEndpointToCenterParameterization(t,e,n,i,r,s,a,o,l){const h=l*(Math.PI/180),c=Math.cos(h)*(t-n)/2+Math.sin(h)*(e-i)/2,d=-1*Math.sin(h)*(t-n)/2+Math.cos(h)*(e-i)/2,u=c*c/(a*a)+d*d/(o*o);u>1&&(a*=Math.sqrt(u),o*=Math.sqrt(u));let p=Math.sqrt((a*a*(o*o)-a*a*(d*d)-o*o*(c*c))/(a*a*(d*d)+o*o*(c*c)));r===s&&(p*=-1),isNaN(p)&&(p=0);const f=p*a*d/o,m=p*-o*c/a,g=(t+n)/2+Math.cos(h)*f-Math.sin(h)*m,_=(e+i)/2+Math.sin(h)*f+Math.cos(h)*m,v=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},y=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(v(t)*v(e))},x=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(y(t,e))},S=x([1,0],[(c-f)/a,(d-m)/o]),b=[(c-f)/a,(d-m)/o],M=[(-1*c-f)/a,(-1*d-m)/o];let w=x(b,M);return y(b,M)<=-1&&(w=Math.PI),y(b,M)>=1&&(w=0),0===s&&w>0&&(w-=2*Math.PI),1===s&&w<0&&(w+=2*Math.PI),[g,_,a,o,S,w,h,s]}};return wt.Path=r,r.prototype.className="Path",r.prototype._attrsAffectingSize=["data"],(0,n._registerNode)(r),t.Factory.addGetterSetter(r,"data"),wt}var At,Ct={};var Rt,Pt={};var Lt,It={};var Dt,Nt={};var Ut,Ot={};function Ft(){if(Ut)return Ot;Ut=1,Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.Rect=void 0;const t=L(),e=et(),n=S(),i=w(),r=P();let s=class extends e.Shape{_sceneFunc(t){const e=this.cornerRadius(),n=this.width(),r=this.height();t.beginPath(),e?i.Util.drawRoundedRectPath(t,n,r,e):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}};return Ot.Rect=s,s.prototype.className="Rect",(0,n._registerNode)(s),t.Factory.addGetterSetter(s,"cornerRadius",0,(0,r.getNumberOrArrayOfNumbersValidator)(4)),Ot}var kt,Bt={};var zt,Gt={};var Ht,Vt={};var Wt,Xt={};var jt,Yt={};function qt(){if(jt)return Yt;jt=1,Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.Text=void 0,Yt.stringToArray=a;const t=w(),e=L(),n=et(),i=S(),r=P(),s=S();function a(t){return[...t].reduce(((t,e,n,i)=>{if(/\p{Emoji}/u.test(e)){const r=i[n+1];r&&/\p{Emoji_Modifier}|\u200D/u.test(r)?(t.push(e+r),i[n+1]=""):t.push(e)}else/\p{Regional_Indicator}{2}/u.test(e+(i[n+1]||""))?t.push(e+i[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(e)?t[t.length-1]+=e:e&&t.push(e);return t}),[])}const o="auto",l="inherit",h="justify",c="left",d="middle",u="normal",p=" ",f="none",m=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],g=m.length;let _;function v(){return _||(_=t.Util.createCanvasElement().getContext("2d"),_)}let y=class extends n.Shape{constructor(t){super(function(t){return(t=t||{}).fillLinearGradientColorStops||t.fillRadialGradientColorStops||t.fillPatternImage||(t.fill=t.fill||"black"),t}(t)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<g;t++)this.on(m[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(t){const e=this.textArr,n=e.length;if(!this.text())return;let r,s=this.padding(),o=this.fontSize(),u=this.lineHeight()*o,p=this.verticalAlign(),f=this.direction(),m=0,g=this.align(),_=this.getWidth(),v=this.letterSpacing(),y=this.fill(),x=this.textDecoration(),S=-1!==x.indexOf("underline"),b=-1!==x.indexOf("line-through");f=f===l?t.direction:f;let M=u/2,w=d;if(i.Konva._fixTextRendering){const t=this.measureSize("M");w="alphabetic",M=(t.fontBoundingBoxAscent-t.fontBoundingBoxDescent)/2+u/2}var E=0,T=0;for("rtl"===f&&t.setAttr("direction",f),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",w),t.setAttr("textAlign",c),p===d?m=(this.getHeight()-n*u-2*s)/2:"bottom"===p&&(m=this.getHeight()-n*u-2*s),t.translate(s,m+s),r=0;r<n;r++){E=0,T=0;var A,C,R=e[r],P=R.text,L=R.width,I=R.lastInParagraph;if(t.save(),"right"===g?E+=_-L-2*s:"center"===g&&(E+=(_-L-2*s)/2),S){t.save(),t.beginPath();const e=E,n=M+T+(i.Konva._fixTextRendering?Math.round(o/4):Math.round(o/2));t.moveTo(e,n),A=P.split(" ").length-1,C=g!==h||I?L:_-2*s,t.lineTo(e+Math.round(C),n),t.lineWidth=o/15;const r=this._getLinearGradient();t.strokeStyle=r||y,t.stroke(),t.restore()}if(b){t.save(),t.beginPath();const e=i.Konva._fixTextRendering?-Math.round(o/4):0;t.moveTo(E,M+T+e),A=P.split(" ").length-1,C=g!==h||I?L:_-2*s,t.lineTo(E+Math.round(C),M+T+e),t.lineWidth=o/15;const n=this._getLinearGradient();t.strokeStyle=n||y,t.stroke(),t.restore()}if("rtl"===f||0===v&&g!==h)0!==v&&t.setAttr("letterSpacing",`${v}px`),this._partialTextX=E,this._partialTextY=M+T,this._partialText=P,t.fillStrokeShape(this);else{A=P.split(" ").length-1;const e=a(P);for(let n=0;n<e.length;n++){const i=e[n];" "!==i||I||g!==h||(E+=(_-2*s-L)/A),this._partialTextX=E,this._partialTextY=M+T,this._partialText=i,t.fillStrokeShape(this),E+=this.measureSize(i).width+v}}t.restore(),n>1&&(M+=u)}}_hitFunc(t){const e=this.getWidth(),n=this.getHeight();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}setText(e){const n=t.Util._isString(e)?e:null==e?"":e+"";return this._setAttr("text",n),this}getWidth(){return this.attrs.width===o||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===o||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return t.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e,n,i,r,s,a,o,l,h,c,d;let u,p=v(),f=this.fontSize();p.save(),p.font=this._getContextFont(),u=p.measureText(t),p.restore();const m=f/100;return{actualBoundingBoxAscent:null!==(e=u.actualBoundingBoxAscent)&&void 0!==e?e:71.58203125*m,actualBoundingBoxDescent:null!==(n=u.actualBoundingBoxDescent)&&void 0!==n?n:0,actualBoundingBoxLeft:null!==(i=u.actualBoundingBoxLeft)&&void 0!==i?i:-7.421875*m,actualBoundingBoxRight:null!==(r=u.actualBoundingBoxRight)&&void 0!==r?r:75.732421875*m,alphabeticBaseline:null!==(s=u.alphabeticBaseline)&&void 0!==s?s:0,emHeightAscent:null!==(a=u.emHeightAscent)&&void 0!==a?a:100*m,emHeightDescent:null!==(o=u.emHeightDescent)&&void 0!==o?o:-20*m,fontBoundingBoxAscent:null!==(l=u.fontBoundingBoxAscent)&&void 0!==l?l:91*m,fontBoundingBoxDescent:null!==(h=u.fontBoundingBoxDescent)&&void 0!==h?h:21*m,hangingBaseline:null!==(c=u.hangingBaseline)&&void 0!==c?c:72.80000305175781*m,ideographicBaseline:null!==(d=u.ideographicBaseline)&&void 0!==d?d:-21*m,width:u.width,height:f}}_getContextFont(){return this.fontStyle()+p+this.fontVariant()+p+(this.fontSize()+"px ")+this.fontFamily().split(",").map((t=>{const e=(t=t.trim()).indexOf(" ")>=0,n=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!n&&(t=`"${t}"`),t})).join(", ")}_addTextLine(t){this.align()===h&&(t=t.trim());const e=this._getTextWidth(t);return this.textArr.push({text:t,width:e,lastInParagraph:!1})}_getTextWidth(t){const e=this.letterSpacing(),n=t.length;return v().measureText(t).width+e*n}_setTextData(){let t=this.text().split("\n"),e=+this.fontSize(),n=0,i=this.lineHeight()*e,r=this.attrs.width,s=this.attrs.height,l=r!==o&&void 0!==r,h=s!==o&&void 0!==s,c=this.padding(),d=r-2*c,u=s-2*c,m=0,g=this.wrap(),_="char"!==g&&g!==f,y=this.ellipsis();this.textArr=[],v().font=this._getContextFont();const x=y?this._getTextWidth("…"):0;for(let e=0,r=t.length;e<r;++e){let s=t[e],o=this._getTextWidth(s);if(l&&o>d)for(;s.length>0;){let t=0,e=a(s).length,r="",l=0;for(;t<e;){const n=t+e>>>1,i=a(s).slice(0,n+1).join(""),o=this._getTextWidth(i)+x;o<=d?(t=n+1,r=i,l=o):e=n}if(!r)break;if(_){const e=a(s),n=a(r),i=e[n.length];let o;if((i===p||"-"===i)&&l<=d)o=n.length;else{const t=n.lastIndexOf(p),e=n.lastIndexOf("-");o=Math.max(t,e)+1}o>0&&(t=o,r=e.slice(0,t).join(""),l=this._getTextWidth(r))}r=r.trimRight(),this._addTextLine(r),n=Math.max(n,l),m+=i;if(this._shouldHandleEllipsis(m)){this._tryToAddEllipsisToLastLine();break}if(s=a(s).slice(t).join("").trimLeft(),s.length>0&&(o=this._getTextWidth(s),o<=d)){this._addTextLine(s),m+=i,n=Math.max(n,o);break}}else this._addTextLine(s),m+=i,n=Math.max(n,o),this._shouldHandleEllipsis(m)&&e<r-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),h&&m+i>u)break}this.textHeight=e,this.textWidth=n}_shouldHandleEllipsis(t){const e=+this.fontSize(),n=this.lineHeight()*e,i=this.attrs.height,r=i!==o&&void 0!==i,s=i-2*this.padding();return!(this.wrap()!==f)||r&&t+n>s}_tryToAddEllipsisToLastLine(){const t=this.attrs.width,e=t!==o&&void 0!==t,n=t-2*this.padding(),i=this.ellipsis(),r=this.textArr[this.textArr.length-1];if(r&&i){if(e){this._getTextWidth(r.text+"…")<n||(r.text=r.text.slice(0,r.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(r.text+"…")}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=-1!==this.textDecoration().indexOf("underline")||-1!==this.textDecoration().indexOf("line-through"),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas()}};return Yt.Text=y,y.prototype._fillFunc=function(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)},y.prototype._strokeFunc=function(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)},y.prototype.className="Text",y.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,s._registerNode)(y),e.Factory.overWriteSetter(y,"width",(0,r.getNumberOrAutoValidator)()),e.Factory.overWriteSetter(y,"height",(0,r.getNumberOrAutoValidator)()),e.Factory.addGetterSetter(y,"direction",l),e.Factory.addGetterSetter(y,"fontFamily","Arial"),e.Factory.addGetterSetter(y,"fontSize",12,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"fontStyle",u),e.Factory.addGetterSetter(y,"fontVariant",u),e.Factory.addGetterSetter(y,"padding",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"align",c),e.Factory.addGetterSetter(y,"verticalAlign","top"),e.Factory.addGetterSetter(y,"lineHeight",1,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"wrap","word"),e.Factory.addGetterSetter(y,"ellipsis",!1,(0,r.getBooleanValidator)()),e.Factory.addGetterSetter(y,"letterSpacing",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(y,"text","",(0,r.getStringValidator)()),e.Factory.addGetterSetter(y,"textDecoration",""),Yt}var Kt,Zt={};var Qt,Jt={};function $t(){if(Qt)return Jt;Qt=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Transformer=void 0;const t=w(),e=L(),n=H(),i=et(),r=Ft(),s=ot(),a=S(),o=P(),l=S(),h="tr-konva",c=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((t=>t+`.${h}`)).join(" "),d="nodesRect",u=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],p={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},f="ontouchstart"in a.Konva._global;const m=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function g(t,e,n){const i=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),r=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:i,y:r}}function _(t,e){const n=function(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}(t);return g(t,e,n)}let v=0,y=class extends s.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(c,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(e){return t.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 h+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const n=e.filter((e=>!e.isAncestorOf(this)||(t.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1)));this._nodes=e=n,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((t=>{const e=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=t._attrsAffectingSize.map((t=>t+"Change."+this._getEventNamespace())).join(" ");t.on(n,e),t.on(u.map((t=>t+`.${this._getEventNamespace()}`)).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)})),this._resetTransformCache();return!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,(n=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(n,!1)})),t.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!e)return;const i=t.getAbsolutePosition(),r=i.x-e.x,s=i.y-e.y;this.nodes().forEach((e=>{if(e===t)return;if(e.isDragging())return;const i=e.getAbsolutePosition();e.setAbsolutePosition({x:i.x+r,y:i.y+s}),e.startDrag(n)})),e=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((t=>{t.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(d),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(d,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),n){const i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=t.getAbsoluteScale(n),s=t.getAbsolutePosition(n),o=i.x*r.x-t.offsetX()*r.x,l=i.y*r.y-t.offsetY()*r.y,h=(a.Konva.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return g({x:s.x+o*Math.cos(h)+l*Math.sin(-h),y:s.y+l*Math.cos(h)+o*Math.sin(h),width:i.width*r.x,height:i.height*r.y,rotation:h},-a.Konva.getAngle(e),{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()}),i=[{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}],r=t.getAbsoluteTransform();i.forEach((function(t){const n=r.point(t);e.push(n)}))}));const n=new t.Transform;n.rotate(-a.Konva.getAngle(this.rotation()));let i=1/0,r=1/0,s=-1/0,o=-1/0;e.forEach((function(t){const e=n.point(t);void 0===i&&(i=s=e.x,r=o=e.y),i=Math.min(i,e.x),r=Math.min(r,e.y),s=Math.max(s,e.x),o=Math.max(o,e.y)})),n.invert();const l=n.point({x:i,y:r});return{x:l.x,y:l.y,width:s-i,height:o-r,rotation:a.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(),m.forEach((t=>{this._createAnchor(t)})),this._createAnchor("rotater")}_createAnchor(e){const n=new r.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:f?10:"auto"}),i=this;n.on("mousedown touchstart",(function(t){i._handleMouseDown(t)})),n.on("dragstart",(t=>{n.stopDrag(),t.cancelBubble=!0})),n.on("dragend",(t=>{t.cancelBubble=!0})),n.on("mouseenter",(()=>{const i=a.Konva.getAngle(this.rotation()),r=this.rotateAnchorCursor(),s=function(e,n,i){if("rotater"===e)return i;n+=t.Util.degToRad(p[e]||0);const r=(t.Util.radToDeg(n)%360+360)%360;return t.Util._inRange(r,337.5,360)||t.Util._inRange(r,0,22.5)?"ns-resize":t.Util._inRange(r,22.5,67.5)?"nesw-resize":t.Util._inRange(r,67.5,112.5)?"ew-resize":t.Util._inRange(r,112.5,157.5)?"nwse-resize":t.Util._inRange(r,157.5,202.5)?"ns-resize":t.Util._inRange(r,202.5,247.5)?"nesw-resize":t.Util._inRange(r,247.5,292.5)?"ew-resize":t.Util._inRange(r,292.5,337.5)?"nwse-resize":(t.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}(e,i,r);n.getStage().content&&(n.getStage().content.style.cursor=s),this._cursorChange=!0})),n.on("mouseout",(()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(n)}_createBack(){const e=new i.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,n){const i=n.getParent(),r=i.padding();e.beginPath(),e.rect(-r,-r,n.width()+2*r,n.height()+2*r),e.moveTo(n.width()/2,-r),i.rotateEnabled()&&i.rotateLineVisible()&&e.lineTo(n.width()/2,-i.rotateAnchorOffset()*t.Util._sign(n.height())-r),e.fillStrokeShape(n)},hitFunc:(t,e)=>{if(!this.shouldOverdrawWholeArea())return;const n=this.padding();t.beginPath(),t.rect(-n,-n,e.width()+2*n,e.height()+2*n),t.fillStrokeShape(e)}});this.add(e),this._proxyDrag(e),e.on("dragstart",(t=>{t.cancelBubble=!0})),e.on("dragmove",(t=>{t.cancelBubble=!0})),e.on("dragend",(t=>{t.cancelBubble=!0})),this.on("dragmove",(t=>{this.update()}))}_handleMouseDown(t){if(this._transforming)return;this._movingAnchorName=t.target.name().split(" ")[0];const e=this._getNodeRect(),n=e.width,i=e.height,r=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));this.sin=Math.abs(i/r),this.cos=Math.abs(n/r),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const s=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},v++,this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach((e=>{e._fire("transformstart",{evt:t.evt,target:e})}))}_handleMouseMove(t){let e,n,i;const r=this.findOne("."+this._movingAnchorName),s=r.getStage();s.setPointersPositions(t);const o=s.getPointerPosition();let l={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const h=r.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(h,l,t)),r.setAbsolutePosition(l);const c=r.getAbsolutePosition();if(h.x===c.x&&h.y===c.y)return;if("rotater"===this._movingAnchorName){const i=this._getNodeRect();e=r.x()-i.width/2,n=-r.y()+i.height/2;let s=Math.atan2(-n,e)+Math.PI/2;i.height<0&&(s-=Math.PI);const o=a.Konva.getAngle(this.rotation())+s,l=a.Konva.getAngle(this.rotationSnapTolerance()),h=function(t,e,n){let i=e;for(let r=0;r<t.length;r++){const s=a.Konva.getAngle(t[r]),o=Math.abs(s-e)%(2*Math.PI);Math.min(o,2*Math.PI-o)<n&&(i=s)}return i}(this.rotationSnaps(),o,l),c=_(i,h-i.rotation);return void this._fitNodesInto(c,t)}const d=this.shiftBehavior();let u;u="inverted"===d?this.keepRatio()&&!t.shiftKey:"none"===d?this.keepRatio():this.keepRatio()||t.shiftKey;var p=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(u){var f=p?{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(f.x-r.x(),2)+Math.pow(f.y-r.y(),2));var m=this.findOne(".top-left").x()>f.x?-1:1,g=this.findOne(".top-left").y()>f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,this.findOne(".top-left").x(f.x-e),this.findOne(".top-left").y(f.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(r.y());else if("top-right"===this._movingAnchorName){if(u){f=p?{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(r.x()-f.x,2)+Math.pow(f.y-r.y(),2));m=this.findOne(".top-right").x()<f.x?-1:1,g=this.findOne(".top-right").y()>f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,this.findOne(".top-right").x(f.x+e),this.findOne(".top-right").y(f.y-n)}var v=r.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(r.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(r.x());else if("bottom-left"===this._movingAnchorName){if(u){f=p?{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(f.x-r.x(),2)+Math.pow(r.y()-f.y,2));m=f.x<r.x()?-1:1,g=r.y()<f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,r.x(f.x-e),r.y(f.y+n)}v=r.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(r.y());else if("bottom-right"===this._movingAnchorName){if(u){f=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(r.x()-f.x,2)+Math.pow(r.y()-f.y,2));m=this.findOne(".bottom-right").x()<f.x?-1:1,g=this.findOne(".bottom-right").y()<f.y?-1:1;e=i*this.cos*m,n=i*this.sin*g,this.findOne(".bottom-right").x(f.x+e),this.findOne(".bottom-right").y(f.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(p=this.centeredScaling()||t.altKey){const t=this.findOne(".top-left"),e=this.findOne(".bottom-right"),n=t.x(),i=t.y(),r=this.getWidth()-e.x(),s=this.getHeight()-e.y();e.move({x:-n,y:-i}),t.move({x:r,y:s})}const y=this.findOne(".top-left").getAbsolutePosition();e=y.x,n=y.y;const x=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),S=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:n,width:x,height:S,rotation:a.Konva.getAngle(this.rotation())},t)}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){var e;if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const n=this.getNode();v--,this._fire("transformend",{evt:t,target:n}),null===(e=this.getLayer())||void 0===e||e.batchDraw(),n&&this._nodes.forEach((e=>{var n;e._fire("transformend",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this._movingAnchorName=null}}_fitNodesInto(e,n){const i=this._getNodeRect();if(t.Util._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(t.Util._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=new t.Transform;if(r.rotate(a.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=r.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=r.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=r.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=r.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 n=this.boundBoxFunc()(i,e);n?e=n:t.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,o=new t.Transform;o.translate(i.x,i.y),o.rotate(i.rotation),o.scale(i.width/s,i.height/s);const l=new t.Transform,h=e.width/s,c=e.height/s;!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(h),Math.abs(c))):(l.translate(e.x,e.y),l.rotate(e.rotation),l.scale(h,c));const d=l.multiply(o.invert());this._nodes.forEach((e=>{var n;const i=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());const s=new t.Transform;s.multiply(i.copy().invert()).multiply(d).multiply(i).multiply(r);const a=s.decompose();e.setAttrs(a),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(t.Util._getRotation(e.rotation)),this._nodes.forEach((t=>{this._fire("transform",{evt:n,target:t}),t._fire("transform",{evt:n,target:t})})),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var e;const n=this._getNodeRect();this.rotation(t.Util._getRotation(n.rotation));const i=n.width,r=n.height,s=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),l=this.anchorSize(),h=this.find("._anchor");h.forEach((t=>{t.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+o,offsetY:l/2+o,visible:a&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:l/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:l/2-o,offsetY:l/2+o,visible:a&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:l/2+o,visible:a&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:r/2,offsetX:l/2-o,visible:a&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:l/2+o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:r,offsetY:l/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:r,offsetX:l/2-o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:i/2,y:-this.rotateAnchorOffset()*t.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&h.forEach((t=>{c(t)})),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),s.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return n.Node.prototype.toObject.call(this)}clone(t){return n.Node.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};return Jt.Transformer=y,y.isTransforming=()=>v>0,y.prototype.className="Transformer",(0,l._registerNode)(y),e.Factory.addGetterSetter(y,"enabledAnchors",m,(function(e){return e instanceof Array||t.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===m.indexOf(e)&&t.Util.warn("Unknown anchor name: "+e+". Available names are: "+m.join(", "))})),e||[]})),e.Factory.addGetterSetter(y,"flipEnabled",!0,(0,o.getBooleanValidator)()),e.Factory.addGetterSetter(y,"resizeEnabled",!0),e.Factory.addGetterSetter(y,"anchorSize",10,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"rotateEnabled",!0),e.Factory.addGetterSetter(y,"rotateLineVisible",!0),e.Factory.addGetterSetter(y,"rotationSnaps",[]),e.Factory.addGetterSetter(y,"rotateAnchorOffset",50,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"rotateAnchorCursor","crosshair"),e.Factory.addGetterSetter(y,"rotationSnapTolerance",5,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"borderEnabled",!0),e.Factory.addGetterSetter(y,"anchorStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(y,"anchorStrokeWidth",1,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"anchorFill","white"),e.Factory.addGetterSetter(y,"anchorCornerRadius",0,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"borderStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(y,"borderStrokeWidth",1,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"borderDash"),e.Factory.addGetterSetter(y,"keepRatio",!0),e.Factory.addGetterSetter(y,"shiftBehavior","default"),e.Factory.addGetterSetter(y,"centeredScaling",!1),e.Factory.addGetterSetter(y,"ignoreStroke",!1),e.Factory.addGetterSetter(y,"padding",0,(0,o.getNumberValidator)()),e.Factory.addGetterSetter(y,"nodes"),e.Factory.addGetterSetter(y,"node"),e.Factory.addGetterSetter(y,"boundBoxFunc"),e.Factory.addGetterSetter(y,"anchorDragBoundFunc"),e.Factory.addGetterSetter(y,"anchorStyleFunc"),e.Factory.addGetterSetter(y,"shouldOverdrawWholeArea",!1),e.Factory.addGetterSetter(y,"useSingleNodeRotation",!0),e.Factory.backCompat(y,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"}),Jt}var te,ee={};var ne,ie={};function re(){if(ne)return ie;ne=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.Blur=void 0;const t=L(),e=H(),n=P();function i(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const r=[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];return ie.Blur=function(t){const e=Math.round(this.blurRadius());e>0&&function(t,e){const n=t.data,a=t.width,o=t.height;let l,h,c,d,u,p,f,m,g,_,v,y,x,S,b,M,w,E,T,A,C,R,P,L;const I=e+e+1,D=a-1,N=o-1,U=e+1,O=U*(U+1)/2,F=new i,k=r[e],B=s[e];let z=null,G=F,H=null,V=null;for(c=1;c<I;c++)G=G.next=new i,c===U&&(z=G);for(G.next=F,f=p=0,h=0;h<o;h++){for(M=w=E=T=m=g=_=v=0,y=U*(A=n[p]),x=U*(C=n[p+1]),S=U*(R=n[p+2]),b=U*(P=n[p+3]),m+=O*A,g+=O*C,_+=O*R,v+=O*P,G=F,c=0;c<U;c++)G.r=A,G.g=C,G.b=R,G.a=P,G=G.next;for(c=1;c<U;c++)d=p+((D<c?D:c)<<2),m+=(G.r=A=n[d])*(L=U-c),g+=(G.g=C=n[d+1])*L,_+=(G.b=R=n[d+2])*L,v+=(G.a=P=n[d+3])*L,M+=A,w+=C,E+=R,T+=P,G=G.next;for(H=F,V=z,l=0;l<a;l++)n[p+3]=P=v*k>>B,0!==P?(P=255/P,n[p]=(m*k>>B)*P,n[p+1]=(g*k>>B)*P,n[p+2]=(_*k>>B)*P):n[p]=n[p+1]=n[p+2]=0,m-=y,g-=x,_-=S,v-=b,y-=H.r,x-=H.g,S-=H.b,b-=H.a,d=f+((d=l+e+1)<D?d:D)<<2,M+=H.r=n[d],w+=H.g=n[d+1],E+=H.b=n[d+2],T+=H.a=n[d+3],m+=M,g+=w,_+=E,v+=T,H=H.next,y+=A=V.r,x+=C=V.g,S+=R=V.b,b+=P=V.a,M-=A,w-=C,E-=R,T-=P,V=V.next,p+=4;f+=a}for(l=0;l<a;l++){for(w=E=T=M=g=_=v=m=0,p=l<<2,y=U*(A=n[p]),x=U*(C=n[p+1]),S=U*(R=n[p+2]),b=U*(P=n[p+3]),m+=O*A,g+=O*C,_+=O*R,v+=O*P,G=F,c=0;c<U;c++)G.r=A,G.g=C,G.b=R,G.a=P,G=G.next;for(u=a,c=1;c<=e;c++)p=u+l<<2,m+=(G.r=A=n[p])*(L=U-c),g+=(G.g=C=n[p+1])*L,_+=(G.b=R=n[p+2])*L,v+=(G.a=P=n[p+3])*L,M+=A,w+=C,E+=R,T+=P,G=G.next,c<N&&(u+=a);for(p=l,H=F,V=z,h=0;h<o;h++)d=p<<2,n[d+3]=P=v*k>>B,P>0?(P=255/P,n[d]=(m*k>>B)*P,n[d+1]=(g*k>>B)*P,n[d+2]=(_*k>>B)*P):n[d]=n[d+1]=n[d+2]=0,m-=y,g-=x,_-=S,v-=b,y-=H.r,x-=H.g,S-=H.b,b-=H.a,d=l+((d=h+U)<N?d:N)*a<<2,m+=M+=H.r=n[d],g+=w+=H.g=n[d+1],_+=E+=H.b=n[d+2],v+=T+=H.a=n[d+3],H=H.next,y+=A=V.r,x+=C=V.g,S+=R=V.b,b+=P=V.a,M-=A,w-=C,E-=R,T-=P,V=V.next,p+=a}}(t,e)},t.Factory.addGetterSetter(e.Node,"blurRadius",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ie}var se,ae={};var oe,le={};var he,ce={};var de,ue={};var pe,fe={};var me,ge={};var _e,ve={};var ye,xe={};var Se,be={};function Me(){if(Se)return be;Se=1,Object.defineProperty(be,"__esModule",{value:!0}),be.Kaleidoscope=void 0;const t=L(),e=H(),n=w(),i=P();return be.Kaleidoscope=function(t){const e=t.width,i=t.height;let r,s,a,o,l,h,c,d,u,p,f=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),g=Math.floor(e*(m%360)/360);if(f<1)return;const _=n.Util.createCanvasElement();_.width=e,_.height=i;const v=_.getContext("2d").getImageData(0,0,e,i);n.Util.releaseCanvas(_),function(t,e,n){const i=t.data,r=e.data,s=t.width,a=t.height,o=n.polarCenterX||s/2,l=n.polarCenterY||a/2;let h=Math.sqrt(o*o+l*l),c=s-o,d=a-l;const u=Math.sqrt(c*c+d*d);h=u>h?u:h;const p=a,f=s,m=360/f*Math.PI/180;for(let t=0;t<f;t+=1){const e=Math.sin(t*m),n=Math.cos(t*m);for(let a=0;a<p;a+=1){c=Math.floor(o+h*a/p*n),d=Math.floor(l+h*a/p*e);let u=4*(d*s+c);const f=i[u+0],m=i[u+1],g=i[u+2],_=i[u+3];u=4*(t+a*s),r[u+0]=f,r[u+1]=m,r[u+2]=g,r[u+3]=_}}}(t,v,{polarCenterX:e/2,polarCenterY:i/2});let y=e/Math.pow(2,f);for(;y<=8;)y*=2,f-=1;y=Math.ceil(y);let x=y,S=0,b=x,M=1;for(g+y>e&&(S=x,b=0,M=-1),s=0;s<i;s+=1)for(r=S;r!==b;r+=M)a=Math.round(r+g)%e,u=4*(e*s+a),l=v.data[u+0],h=v.data[u+1],c=v.data[u+2],d=v.data[u+3],p=4*(e*s+r),v.data[p+0]=l,v.data[p+1]=h,v.data[p+2]=c,v.data[p+3]=d;for(s=0;s<i;s+=1)for(x=Math.floor(y),o=0;o<f;o+=1){for(r=0;r<x+1;r+=1)u=4*(e*s+r),l=v.data[u+0],h=v.data[u+1],c=v.data[u+2],d=v.data[u+3],p=4*(e*s+2*x-r-1),v.data[p+0]=l,v.data[p+1]=h,v.data[p+2]=c,v.data[p+3]=d;x*=2}!function(t,e,n){const i=t.data,r=e.data,s=t.width,a=t.height,o=n.polarCenterX||s/2,l=n.polarCenterY||a/2;let h=Math.sqrt(o*o+l*l),c=s-o,d=a-l;const u=Math.sqrt(c*c+d*d);h=u>h?u:h;const p=a,f=s;let m,g;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1){const t=c-o,e=d-l,n=Math.sqrt(t*t+e*e)*p/h;let a=(180*Math.atan2(e,t)/Math.PI+360+0)%360;a=a*f/360,m=Math.floor(a),g=Math.floor(n);let u=4*(g*s+m);const _=i[u+0],v=i[u+1],y=i[u+2],x=i[u+3];u=4*(d*s+c),r[u+0]=_,r[u+1]=v,r[u+2]=y,r[u+3]=x}}(v,t,{})},t.Factory.addGetterSetter(e.Node,"kaleidoscopePower",2,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"kaleidoscopeAngle",0,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),be}var we,Ee={};function Te(){if(we)return Ee;we=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.Mask=void 0;const t=L(),e=H(),n=P();function i(t,e,n){let i=4*(n*t.width+e);const r=[];return r.push(t.data[i++],t.data[i++],t.data[i++],t.data[i++]),r}function r(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}return Ee.Mask=function(t){let e=function(t,e){const n=i(t,0,0),s=i(t,t.width-1,0),a=i(t,0,t.height-1),o=i(t,t.width-1,t.height-1),l=e||10;if(r(n,s)<l&&r(s,o)<l&&r(o,a)<l&&r(a,n)<l){const e=function(t){const e=[0,0,0];for(let n=0;n<t.length;n++)e[0]+=t[n][0],e[1]+=t[n][1],e[2]+=t[n][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}([s,n,o,a]),i=[];for(let n=0;n<t.width*t.height;n++){const s=r(e,[t.data[4*n],t.data[4*n+1],t.data[4*n+2]]);i[n]=s<l?0:255}return i}}(t,this.threshold());return e&&(e=function(t,e,n){const i=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[];for(let o=0;o<n;o++)for(let l=0;l<e;l++){const h=o*e+l;let c=0;for(let a=0;a<r;a++)for(let h=0;h<r;h++){const d=o+a-s,u=l+h-s;if(d>=0&&d<n&&u>=0&&u<e){const n=i[a*r+h];c+=t[d*e+u]*n}}a[h]=2040===c?255:0}return a}(e,t.width,t.height),e=function(t,e,n){const i=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[];for(let o=0;o<n;o++)for(let l=0;l<e;l++){const h=o*e+l;let c=0;for(let a=0;a<r;a++)for(let h=0;h<r;h++){const d=o+a-s,u=l+h-s;if(d>=0&&d<n&&u>=0&&u<e){const n=i[a*r+h];c+=t[d*e+u]*n}}a[h]=c>=1020?255:0}return a}(e,t.width,t.height),e=function(t,e,n){const i=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[];for(let o=0;o<n;o++)for(let l=0;l<e;l++){const h=o*e+l;let c=0;for(let a=0;a<r;a++)for(let h=0;h<r;h++){const d=o+a-s,u=l+h-s;if(d>=0&&d<n&&u>=0&&u<e){const n=i[a*r+h];c+=t[d*e+u]*n}}a[h]=c}return a}(e,t.width,t.height),function(t,e){for(let n=0;n<t.width*t.height;n++)t.data[4*n+3]=e[n]}(t,e)),t},t.Factory.addGetterSetter(e.Node,"threshold",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ee}var Ae,Ce={};var Re,Pe={};var Le,Ie={};var De,Ne={};var Ue,Oe={};var Fe,ke={};var Be,ze={};var Ge,He,Ve={};function We(){if(He)return v;He=1,Object.defineProperty(v,"__esModule",{value:!0}),v.Konva=void 0;const t=ft(),e=function(){if(mt)return gt;mt=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.Arc=void 0;const t=L(),e=et(),n=S(),i=P(),r=S();let s=class extends e.Shape{_sceneFunc(t){const e=n.Konva.getAngle(this.angle()),i=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,i),t.arc(0,0,this.innerRadius(),e,0,!i),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),i=this.clockwise(),r=n.Konva.getAngle(i?360-this.angle():this.angle()),s=Math.cos(Math.min(r,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),o=Math.sin(Math.min(r,Math.PI/2)),l=s*(s>0?t:e),h=a*(a>0?t:e),c=o*(o>0?e:t);return{x:l,y:i?-1*c:h,width:1*e-l,height:c-h}}};return gt.Arc=s,s.prototype._centroid=!0,s.prototype.className="Arc",s.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,r._registerNode)(s),t.Factory.addGetterSetter(s,"innerRadius",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"outerRadius",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"angle",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"clockwise",!1,(0,i.getBooleanValidator)()),gt}(),n=function(){if(Mt)return vt;Mt=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.Arrow=void 0;const t=L(),e=xt(),n=P(),i=S(),r=Tt();let s=class extends e.Line{_sceneFunc(t){super._sceneFunc(t);const e=2*Math.PI,n=this.points();let i=n;const s=0!==this.tension()&&n.length>4;s&&(i=this.getTensionPoints());const a=this.pointerLength(),o=n.length;let l,h;if(s){const t=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],n[o-2],n[o-1]],e=r.Path.calcLength(i[i.length-4],i[i.length-3],"C",t),s=r.Path.getPointOnQuadraticBezier(Math.min(1,1-a/e),t[0],t[1],t[2],t[3],t[4],t[5]);l=n[o-2]-s.x,h=n[o-1]-s.y}else l=n[o-2]-n[o-4],h=n[o-1]-n[o-3];const c=(Math.atan2(h,l)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(n[o-2],n[o-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(n[0],n[1]),s?(l=(i[0]+i[2])/2-n[0],h=(i[1]+i[3])/2-n[1]):(l=n[2]-n[0],h=n[3]-n[1]),t.rotate((Math.atan2(-h,-l)+e)%e),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){const e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x,y:t.y-e,width:t.width,height:t.height+2*e}}};return vt.Arrow=s,s.prototype.className="Arrow",(0,i._registerNode)(s),t.Factory.addGetterSetter(s,"pointerLength",10,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"pointerWidth",10,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"pointerAtBeginning",!1),t.Factory.addGetterSetter(s,"pointerAtEnding",!0),vt}(),i=function(){if(At)return Ct;At=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.Circle=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};return Ct.Circle=r,r.prototype._centroid=!0,r.prototype.className="Circle",r.prototype._attrsAffectingSize=["radius"],(0,i._registerNode)(r),t.Factory.addGetterSetter(r,"radius",0,(0,n.getNumberValidator)()),Ct}(),r=function(){if(Rt)return Pt;Rt=1,Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.Ellipse=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){const e=this.radiusX(),n=this.radiusY();t.beginPath(),t.save(),e!==n&&t.scale(1,n/e),t.arc(0,0,e,0,2*Math.PI,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}};return Pt.Ellipse=r,r.prototype.className="Ellipse",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,i._registerNode)(r),t.Factory.addComponentsGetterSetter(r,"radius",["x","y"]),t.Factory.addGetterSetter(r,"radiusX",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"radiusY",0,(0,n.getNumberValidator)()),Pt}(),s=function(){if(Lt)return It;Lt=1,Object.defineProperty(It,"__esModule",{value:!0}),It.Image=void 0;const t=w(),e=L(),n=et(),i=S(),r=P();class s extends n.Shape{constructor(t){super(t),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&4===t.readyState||t&&t.addEventListener&&t.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){const t=!!this.cornerRadius(),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),i=this.getHeight(),r=this.cornerRadius(),s=this.attrs.image;let a;if(s){const t=this.attrs.cropWidth,e=this.attrs.cropHeight;a=t&&e?[s,this.cropX(),this.cropY(),t,e,0,0,n,i]:[s,0,0,n,i]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?t.Util.drawRoundedRectPath(e,n,i,r):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)),s&&(r&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){const n=this.width(),i=this.height(),r=this.cornerRadius();e.beginPath(),r?t.Util.drawRoundedRectPath(e,n,i,r):e.rect(0,0,n,i),e.closePath(),e.fillStrokeShape(this)}getWidth(){var t,e;return null!==(t=this.attrs.width)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.width}getHeight(){var t,e;return null!==(t=this.attrs.height)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.height}static fromURL(e,n,i=null){const r=t.Util.createImageElement();r.onload=function(){const t=new s({image:r});n(t)},r.onerror=i,r.crossOrigin="Anonymous",r.src=e}}return It.Image=s,s.prototype.className="Image",(0,i._registerNode)(s),e.Factory.addGetterSetter(s,"cornerRadius",0,(0,r.getNumberOrArrayOfNumbersValidator)(4)),e.Factory.addGetterSetter(s,"image"),e.Factory.addComponentsGetterSetter(s,"crop",["x","y","width","height"]),e.Factory.addGetterSetter(s,"cropX",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(s,"cropY",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(s,"cropWidth",0,(0,r.getNumberValidator)()),e.Factory.addGetterSetter(s,"cropHeight",0,(0,r.getNumberValidator)()),It}(),a=function(){if(Dt)return Nt;Dt=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.Tag=Nt.Label=void 0;const t=L(),e=et(),n=ot(),i=P(),r=S(),s=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],a="up",o="right",l="down",h="left",c=s.length;let d=class extends n.Group{constructor(t){super(t),this.on("add.konva",(function(t){this._addListeners(t.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){let e,n=this;const i=function(){n._sync()};for(e=0;e<c;e++)t.on(s[e]+"Change.konva",i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let t,e,n,i,r,s,c,d=this.getText(),u=this.getTag();if(d&&u){switch(t=d.width(),e=d.height(),n=u.pointerDirection(),i=u.pointerWidth(),c=u.pointerHeight(),r=0,s=0,n){case a:r=t/2,s=-1*c;break;case o:r=t+i,s=e/2;break;case l:r=t/2,s=e+c;break;case h:r=-1*i,s=e/2}u.setAttrs({x:-1*r,y:-1*s,width:t,height:e}),d.setAttrs({x:-1*r,y:-1*s})}}};Nt.Label=d,d.prototype.className="Label",(0,r._registerNode)(d);class u extends e.Shape{_sceneFunc(t){const e=this.width(),n=this.height(),i=this.pointerDirection(),r=this.pointerWidth(),s=this.pointerHeight(),c=this.cornerRadius();let d=0,u=0,p=0,f=0;"number"==typeof c?d=u=p=f=Math.min(c,e/2,n/2):(d=Math.min(c[0]||0,e/2,n/2),u=Math.min(c[1]||0,e/2,n/2),f=Math.min(c[2]||0,e/2,n/2),p=Math.min(c[3]||0,e/2,n/2)),t.beginPath(),t.moveTo(d,0),i===a&&(t.lineTo((e-r)/2,0),t.lineTo(e/2,-1*s),t.lineTo((e+r)/2,0)),t.lineTo(e-u,0),t.arc(e-u,u,u,3*Math.PI/2,0,!1),i===o&&(t.lineTo(e,(n-s)/2),t.lineTo(e+r,n/2),t.lineTo(e,(n+s)/2)),t.lineTo(e,n-f),t.arc(e-f,n-f,f,0,Math.PI/2,!1),i===l&&(t.lineTo((e+r)/2,n),t.lineTo(e/2,n+s),t.lineTo((e-r)/2,n)),t.lineTo(p,n),t.arc(p,n-p,p,Math.PI/2,Math.PI,!1),i===h&&(t.lineTo(0,(n+s)/2),t.lineTo(-1*r,n/2),t.lineTo(0,(n-s)/2)),t.lineTo(0,d),t.arc(d,d,d,Math.PI,3*Math.PI/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){let t=0,e=0,n=this.pointerWidth(),i=this.pointerHeight(),r=this.pointerDirection(),s=this.width(),c=this.height();return r===a?(e-=i,c+=i):r===l?c+=i:r===h?(t-=1.5*n,s+=n):r===o&&(s+=1.5*n),{x:t,y:e,width:s,height:c}}}return Nt.Tag=u,u.prototype.className="Tag",(0,r._registerNode)(u),t.Factory.addGetterSetter(u,"pointerDirection","none"),t.Factory.addGetterSetter(u,"pointerWidth",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(u,"pointerHeight",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(u,"cornerRadius",0,(0,i.getNumberOrArrayOfNumbersValidator)(4)),Nt}(),o=xt(),l=Tt(),h=Ft(),c=function(){if(kt)return Bt;kt=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.RegularPolygon=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,n=[];for(let i=0;i<t;i++)n.push({x:e*Math.sin(2*i*Math.PI/t),y:-1*e*Math.cos(2*i*Math.PI/t)});return n}getSelfRect(){const t=this._getPoints();let e=t[0].x,n=t[0].y,i=t[0].x,r=t[0].y;return t.forEach((t=>{e=Math.min(e,t.x),n=Math.max(n,t.x),i=Math.min(i,t.y),r=Math.max(r,t.y)})),{x:e,y:i,width:n-e,height:r-i}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}};return Bt.RegularPolygon=r,r.prototype.className="RegularPolygon",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["radius"],(0,i._registerNode)(r),t.Factory.addGetterSetter(r,"radius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"sides",0,(0,n.getNumberValidator)()),Bt}(),d=function(){if(zt)return Gt;zt=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Ring=void 0;const t=L(),e=et(),n=P(),i=S(),r=2*Math.PI;let s=class extends e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,r,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),r,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}};return Gt.Ring=s,s.prototype.className="Ring",s.prototype._centroid=!0,s.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,i._registerNode)(s),t.Factory.addGetterSetter(s,"innerRadius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(s,"outerRadius",0,(0,n.getNumberValidator)()),Gt}(),u=function(){if(Ht)return Vt;Ht=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.Sprite=void 0;const t=L(),e=et(),n=ct(),i=P(),r=S();class s extends e.Shape{constructor(t){super(t),this._updated=!0,this.anim=new n.Animation((()=>{const t=this._updated;return this._updated=!1,t})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(t){const e=this.animation(),n=this.frameIndex(),i=4*n,r=this.animations()[e],s=this.frameOffsets(),a=r[i+0],o=r[i+1],l=r[i+2],h=r[i+3],c=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,l,h),t.closePath(),t.fillStrokeShape(this)),c)if(s){const i=s[e],r=2*n;t.drawImage(c,a,o,l,h,i[r+0],i[r+1],l,h)}else t.drawImage(c,a,o,l,h,0,0,l,h)}_hitFunc(t){const e=this.animation(),n=this.frameIndex(),i=4*n,r=this.animations()[e],s=this.frameOffsets(),a=r[i+2],o=r[i+3];if(t.beginPath(),s){const i=s[e],r=2*n;t.rect(i[r+0],i[r+1],a,o)}else t.rect(0,0,a,o);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const t=this;this.interval=setInterval((function(){t._updateIndex()}),1e3/this.frameRate())}start(){if(this.isRunning())return;const t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const t=this.frameIndex(),e=this.animation();t<this.animations()[e].length/4-1?this.frameIndex(t+1):this.frameIndex(0)}}return Vt.Sprite=s,s.prototype.className="Sprite",(0,r._registerNode)(s),t.Factory.addGetterSetter(s,"animation"),t.Factory.addGetterSetter(s,"animations"),t.Factory.addGetterSetter(s,"frameOffsets"),t.Factory.addGetterSetter(s,"image"),t.Factory.addGetterSetter(s,"frameIndex",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"frameRate",17,(0,i.getNumberValidator)()),t.Factory.backCompat(s,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"}),Vt}(),p=function(){if(Wt)return Xt;Wt=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Star=void 0;const t=L(),e=et(),n=P(),i=S();let r=class extends e.Shape{_sceneFunc(t){const e=this.innerRadius(),n=this.outerRadius(),i=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(let r=1;r<2*i;r++){const s=r%2==0?n:e,a=s*Math.sin(r*Math.PI/i),o=-1*s*Math.cos(r*Math.PI/i);t.lineTo(a,o)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}};return Xt.Star=r,r.prototype.className="Star",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,i._registerNode)(r),t.Factory.addGetterSetter(r,"numPoints",5,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"innerRadius",0,(0,n.getNumberValidator)()),t.Factory.addGetterSetter(r,"outerRadius",0,(0,n.getNumberValidator)()),Xt}(),f=qt(),m=function(){if(Kt)return Zt;Kt=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.TextPath=void 0;const t=w(),e=L(),n=et(),i=Tt(),r=qt(),s=P(),a=S(),o="normal";function l(t){t.fillText(this.partialText,0,0)}function h(t){t.strokeText(this.partialText,0,0)}let c=class extends n.Shape{constructor(e){super(e),this.dummyCanvas=t.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 i.Path.getPathLength(this.dataArray)}_getPointAtLength(t){return this.attrs.data?t-1>this.pathLength?null:i.Path.getPointAtLengthOfDataArray(t,this.dataArray):null}_readDataAttribute(){this.dataArray=i.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();const e=this.textDecoration(),n=this.fill(),i=this.fontSize(),r=this.glyphInfo;"underline"===e&&t.beginPath();for(let n=0;n<r.length;n++){t.save();const s=r[n].p0;t.translate(s.x,s.y),t.rotate(r[n].rotation),this.partialText=r[n].text,t.fillStrokeShape(this),"underline"===e&&(0===n&&t.moveTo(0,i/2+1),t.lineTo(i,i/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=n,t.lineWidth=i/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();const e=this.glyphInfo;if(e.length>=1){const n=e[0].p0;t.moveTo(n.x,n.y)}for(let n=0;n<e.length;n++){const i=e[n].p1;t.lineTo(i.x,i.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return t.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return r.Text.prototype.setText.call(this,t)}_getContextFont(){return r.Text.prototype._getContextFont.call(this)}_getTextSize(t){const e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();const n=e.measureText(t);return e.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const n=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);let l=0;"center"===s&&(l=Math.max(0,this.pathLength/2-o/2)),"right"===s&&(l=Math.max(0,this.pathLength-o));const h=(0,r.stringToArray)(this.text());let c=l;for(let t=0;t<h.length;t++){const e=this._getPointAtLength(c);if(!e)return;let r=this._getTextSize(h[t]).width+n;if(" "===h[t]&&"justify"===s){const t=this.text().split(" ").length-1;r+=(this.pathLength-o)/t}const l=this._getPointAtLength(c+r);if(!l)return;const d=i.Path.getLineLength(e.x,e.y,l.x,l.y);let u=0;if(a)try{u=a(h[t-1],h[t])*this.fontSize()}catch(t){u=0}e.x+=u,l.x+=u,this.textWidth+=u;const p=i.Path.getPointOnLine(u+d/2,e.x,e.y,l.x,l.y),f=Math.atan2(l.y-e.y,l.x-e.x);this.glyphInfo.push({transposeX:p.x,transposeY:p.y,text:h[t],rotation:f,p0:e,p1:l}),c+=r}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const t=[];this.glyphInfo.forEach((function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)}));let e,n,i=t[0]||0,r=t[0]||0,s=t[1]||0,a=t[1]||0;for(let o=0;o<t.length/2;o++)e=t[2*o],n=t[2*o+1],i=Math.min(i,e),r=Math.max(r,e),s=Math.min(s,n),a=Math.max(a,n);const o=this.fontSize();return{x:i-o/2,y:s-o/2,width:r-i+o,height:a-s+o}}destroy(){return t.Util.releaseCanvas(this.dummyCanvas),super.destroy()}};return Zt.TextPath=c,c.prototype._fillFunc=l,c.prototype._strokeFunc=h,c.prototype._fillFuncHit=l,c.prototype._strokeFuncHit=h,c.prototype.className="TextPath",c.prototype._attrsAffectingSize=["text","fontSize","data"],(0,a._registerNode)(c),e.Factory.addGetterSetter(c,"data"),e.Factory.addGetterSetter(c,"fontFamily","Arial"),e.Factory.addGetterSetter(c,"fontSize",12,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(c,"fontStyle",o),e.Factory.addGetterSetter(c,"align","left"),e.Factory.addGetterSetter(c,"letterSpacing",0,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(c,"textBaseline","middle"),e.Factory.addGetterSetter(c,"fontVariant",o),e.Factory.addGetterSetter(c,"text",""),e.Factory.addGetterSetter(c,"textDecoration",""),e.Factory.addGetterSetter(c,"kerningFunc",void 0),Zt}(),g=$t(),_=function(){if(te)return ee;te=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.Wedge=void 0;const t=L(),e=et(),n=S(),i=P(),r=S();let s=class extends e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,n.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}};return ee.Wedge=s,s.prototype.className="Wedge",s.prototype._centroid=!0,s.prototype._attrsAffectingSize=["radius"],(0,r._registerNode)(s),t.Factory.addGetterSetter(s,"radius",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"angle",0,(0,i.getNumberValidator)()),t.Factory.addGetterSetter(s,"clockwise",!1),t.Factory.backCompat(s,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"}),ee}(),y=re(),x=function(){if(se)return ae;se=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.Brighten=void 0;const t=L(),e=H(),n=P();return ae.Brighten=function(t){const e=255*this.brightness(),n=t.data,i=n.length;for(let t=0;t<i;t+=4)n[t]+=e,n[t+1]+=e,n[t+2]+=e},t.Factory.addGetterSetter(e.Node,"brightness",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ae}(),b=function(){if(oe)return le;oe=1,Object.defineProperty(le,"__esModule",{value:!0}),le.Contrast=void 0;const t=L(),e=H(),n=P();return le.Contrast=function(t){const e=Math.pow((this.contrast()+100)/100,2),n=t.data,i=n.length;let r=150,s=150,a=150;for(let t=0;t<i;t+=4)r=n[t],s=n[t+1],a=n[t+2],r/=255,r-=.5,r*=e,r+=.5,r*=255,s/=255,s-=.5,s*=e,s+=.5,s*=255,a/=255,a-=.5,a*=e,a+=.5,a*=255,r=r<0?0:r>255?255:r,s=s<0?0:s>255?255:s,a=a<0?0:a>255?255:a,n[t]=r,n[t+1]=s,n[t+2]=a},t.Factory.addGetterSetter(e.Node,"contrast",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),le}(),M=function(){if(he)return ce;he=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.Emboss=void 0;const t=L(),e=H(),n=w(),i=P();return ce.Emboss=function(t){const e=10*this.embossStrength(),i=255*this.embossWhiteLevel(),r=this.embossDirection(),s=this.embossBlend(),a=t.data,o=t.width,l=t.height,h=4*o;let c=0,d=0,u=l;switch(r){case"top-left":c=-1,d=-1;break;case"top":c=-1,d=0;break;case"top-right":c=-1,d=1;break;case"right":c=0,d=1;break;case"bottom-right":c=1,d=1;break;case"bottom":c=1,d=0;break;case"bottom-left":c=1,d=-1;break;case"left":c=0,d=-1;break;default:n.Util.error("Unknown emboss direction: "+r)}do{const t=(u-1)*h;let n=c;u+n<1&&(n=0),u+n>l&&(n=0);const r=(u-1+n)*o*4;let p=o;do{const n=t+4*(p-1);let l=d;p+l<1&&(l=0),p+l>o&&(l=0);const h=r+4*(p-1+l),c=a[n]-a[h],u=a[n+1]-a[h+1],f=a[n+2]-a[h+2];let m=c;const g=m>0?m:-m;if((u>0?u:-u)>g&&(m=u),(f>0?f:-f)>g&&(m=f),m*=e,s){const t=a[n]+m,e=a[n+1]+m,i=a[n+2]+m;a[n]=t>255?255:t<0?0:t,a[n+1]=e>255?255:e<0?0:e,a[n+2]=i>255?255:i<0?0:i}else{let t=i-m;t<0?t=0:t>255&&(t=255),a[n]=a[n+1]=a[n+2]=t}}while(--p)}while(--u)},t.Factory.addGetterSetter(e.Node,"embossStrength",.5,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossWhiteLevel",.5,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossDirection","top-left",void 0,t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"embossBlend",!1,void 0,t.Factory.afterSetFilter),ce}(),E=function(){if(de)return ue;de=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.Enhance=void 0;const t=L(),e=H(),n=P();function i(t,e,n,i,r){const s=n-e,a=r-i;if(0===s)return i+a/2;if(0===a)return i;let o=(t-e)/s;return o=a*o+i,o}return ue.Enhance=function(t){const e=t.data,n=e.length;let r,s,a,o=e[0],l=o,h=e[1],c=h,d=e[2],u=d;const p=this.enhance();if(0===p)return;for(let t=0;t<n;t+=4)r=e[t+0],r<o?o=r:r>l&&(l=r),s=e[t+1],s<h?h=s:s>c&&(c=s),a=e[t+2],a<d?d=a:a>u&&(u=a);let f,m,g,_,v,y,x,S,b;l===o&&(l=255,o=0),c===h&&(c=255,h=0),u===d&&(u=255,d=0),p>0?(m=l+p*(255-l),g=o-p*(o-0),v=c+p*(255-c),y=h-p*(h-0),S=u+p*(255-u),b=d-p*(d-0)):(f=.5*(l+o),m=l+p*(l-f),g=o+p*(o-f),_=.5*(c+h),v=c+p*(c-_),y=h+p*(h-_),x=.5*(u+d),S=u+p*(u-x),b=d+p*(d-x));for(let t=0;t<n;t+=4)e[t+0]=i(e[t+0],o,l,g,m),e[t+1]=i(e[t+1],h,c,y,v),e[t+2]=i(e[t+2],d,u,b,S)},t.Factory.addGetterSetter(e.Node,"enhance",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ue}(),T=(pe||(pe=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.Grayscale=void 0,fe.Grayscale=function(t){const e=t.data,n=e.length;for(let t=0;t<n;t+=4){const n=.34*e[t]+.5*e[t+1]+.16*e[t+2];e[t]=n,e[t+1]=n,e[t+2]=n}}),fe),A=function(){if(me)return ge;me=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.HSL=void 0;const t=L(),e=H(),n=P();return t.Factory.addGetterSetter(e.Node,"hue",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"saturation",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"luminance",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ge.HSL=function(t){const e=t.data,n=e.length,i=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,s=127*this.luminance(),a=1*i*Math.cos(r*Math.PI/180),o=1*i*Math.sin(r*Math.PI/180),l=.299+.701*a+.167*o,h=.587-.587*a+.33*o,c=.114-.114*a-.497*o,d=.299-.299*a-.328*o,u=.587+.413*a+.035*o,p=.114-.114*a+.293*o,f=.299-.3*a+1.25*o,m=.587-.586*a-1.05*o,g=.114+.886*a-.2*o;let _,v,y,x;for(let t=0;t<n;t+=4)_=e[t+0],v=e[t+1],y=e[t+2],x=e[t+3],e[t+0]=l*_+h*v+c*y+s,e[t+1]=d*_+u*v+p*y+s,e[t+2]=f*_+m*v+g*y+s,e[t+3]=x},ge}(),C=function(){if(_e)return ve;_e=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.HSV=void 0;const t=L(),e=H(),n=P();return ve.HSV=function(t){const e=t.data,n=e.length,i=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=i*r*Math.cos(s*Math.PI/180),o=i*r*Math.sin(s*Math.PI/180),l=.299*i+.701*a+.167*o,h=.587*i-.587*a+.33*o,c=.114*i-.114*a-.497*o,d=.299*i-.299*a-.328*o,u=.587*i+.413*a+.035*o,p=.114*i-.114*a+.293*o,f=.299*i-.3*a+1.25*o,m=.587*i-.586*a-1.05*o,g=.114*i+.886*a-.2*o;let _,v,y,x;for(let t=0;t<n;t+=4)_=e[t+0],v=e[t+1],y=e[t+2],x=e[t+3],e[t+0]=l*_+h*v+c*y,e[t+1]=d*_+u*v+p*y,e[t+2]=f*_+m*v+g*y,e[t+3]=x},t.Factory.addGetterSetter(e.Node,"hue",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"saturation",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"value",0,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),ve}(),R=(ye||(ye=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Invert=void 0,xe.Invert=function(t){const e=t.data,n=e.length;for(let t=0;t<n;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}),xe),I=Me(),D=Te(),N=function(){if(Ae)return Ce;Ae=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.Noise=void 0;const t=L(),e=H(),n=P();return Ce.Noise=function(t){const e=255*this.noise(),n=t.data,i=n.length,r=e/2;for(let t=0;t<i;t+=4)n[t+0]+=r-2*r*Math.random(),n[t+1]+=r-2*r*Math.random(),n[t+2]+=r-2*r*Math.random()},t.Factory.addGetterSetter(e.Node,"noise",.2,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ce}(),U=function(){if(Re)return Pe;Re=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.Pixelate=void 0;const t=L(),e=w(),n=H(),i=P();return Pe.Pixelate=function(t){let n,i,r,s,a,o,l,h,c,d,u,p,f,m,g=Math.ceil(this.pixelSize()),_=t.width,v=t.height,y=Math.ceil(_/g),x=Math.ceil(v/g),S=t.data;if(g<=0)e.Util.error("pixelSize value can not be <= 0");else for(p=0;p<y;p+=1)for(f=0;f<x;f+=1){for(s=0,a=0,o=0,l=0,h=p*g,c=h+g,d=f*g,u=d+g,m=0,n=h;n<c;n+=1)if(!(n>=_))for(i=d;i<u;i+=1)i>=v||(r=4*(_*i+n),s+=S[r+0],a+=S[r+1],o+=S[r+2],l+=S[r+3],m+=1);for(s/=m,a/=m,o/=m,l/=m,n=h;n<c;n+=1)if(!(n>=_))for(i=d;i<u;i+=1)i>=v||(r=4*(_*i+n),S[r+0]=s,S[r+1]=a,S[r+2]=o,S[r+3]=l)}},t.Factory.addGetterSetter(n.Node,"pixelSize",8,(0,i.getNumberValidator)(),t.Factory.afterSetFilter),Pe}(),O=function(){if(Le)return Ie;Le=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.Posterize=void 0;const t=L(),e=H(),n=P();return Ie.Posterize=function(t){const e=Math.round(254*this.levels())+1,n=t.data,i=n.length,r=255/e;for(let t=0;t<i;t+=1)n[t]=Math.floor(n[t]/r)*r},t.Factory.addGetterSetter(e.Node,"levels",.5,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ie}(),F=function(){if(De)return Ne;De=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.RGB=void 0;const t=L(),e=H(),n=P();return Ne.RGB=function(t){const e=t.data,n=e.length,i=this.red(),r=this.green(),s=this.blue();for(let t=0;t<n;t+=4){const n=(.34*e[t]+.5*e[t+1]+.16*e[t+2])/255;e[t]=n*i,e[t+1]=n*r,e[t+2]=n*s,e[t+3]=e[t+3]}},t.Factory.addGetterSetter(e.Node,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"blue",0,n.RGBComponent,t.Factory.afterSetFilter),Ne}(),k=function(){if(Ue)return Oe;Ue=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.RGBA=void 0;const t=L(),e=H(),n=P();return Oe.RGBA=function(t){const e=t.data,n=e.length,i=this.red(),r=this.green(),s=this.blue(),a=this.alpha();for(let t=0;t<n;t+=4){const n=1-a;e[t]=i*a+e[t]*n,e[t+1]=r*a+e[t+1]*n,e[t+2]=s*a+e[t+2]*n}},t.Factory.addGetterSetter(e.Node,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),t.Factory.addGetterSetter(e.Node,"blue",0,n.RGBComponent,t.Factory.afterSetFilter),t.Factory.addGetterSetter(e.Node,"alpha",1,(function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t})),Oe}(),B=(Fe||(Fe=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.Sepia=void 0,ke.Sepia=function(t){const e=t.data,n=e.length;for(let t=0;t<n;t+=4){const n=e[t+0],i=e[t+1],r=e[t+2];e[t+0]=Math.min(255,.393*n+.769*i+.189*r),e[t+1]=Math.min(255,.349*n+.686*i+.168*r),e[t+2]=Math.min(255,.272*n+.534*i+.131*r)}}),ke),z=(Be||(Be=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.Solarize=void 0,ze.Solarize=function(t){const e=t.data,n=t.width,i=4*n;let r=t.height;do{const t=(r-1)*i;let s=n;do{const n=t+4*(s-1);let i=e[n],r=e[n+1],a=e[n+2];i>127&&(i=255-i),r>127&&(r=255-r),a>127&&(a=255-a),e[n]=i,e[n+1]=r,e[n+2]=a}while(--s)}while(--r)}),ze),G=function(){if(Ge)return Ve;Ge=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.Threshold=void 0;const t=L(),e=H(),n=P();return Ve.Threshold=function(t){const e=255*this.threshold(),n=t.data,i=n.length;for(let t=0;t<i;t+=1)n[t]=n[t]<e?0:255},t.Factory.addGetterSetter(e.Node,"threshold",.5,(0,n.getNumberValidator)(),t.Factory.afterSetFilter),Ve}();return v.Konva=t.Konva.Util._assign(t.Konva,{Arc:e.Arc,Arrow:n.Arrow,Circle:i.Circle,Ellipse:r.Ellipse,Image:s.Image,Label:a.Label,Tag:a.Tag,Line:o.Line,Path:l.Path,Rect:h.Rect,RegularPolygon:c.RegularPolygon,Ring:d.Ring,Sprite:u.Sprite,Star:p.Star,Text:f.Text,TextPath:m.TextPath,Transformer:g.Transformer,Wedge:_.Wedge,Filters:{Blur:y.Blur,Brighten:x.Brighten,Contrast:b.Contrast,Emboss:M.Emboss,Enhance:E.Enhance,Grayscale:T.Grayscale,HSL:A.HSL,HSV:C.HSV,Invert:R.Invert,Kaleidoscope:I.Kaleidoscope,Mask:D.Mask,Noise:N.Noise,Pixelate:U.Pixelate,Posterize:O.Posterize,RGB:F.RGB,RGBA:k.RGBA,Sepia:B.Sepia,Solarize:z.Solarize,Threshold:G.Threshold}}),v}var Xe,je=_.exports;var Ye=m(function(){if(Xe)return _.exports;Xe=1,Object.defineProperty(je,"__esModule",{value:!0});const t=We();return _.exports=t.Konva,_.exports}());class qe{screenToWorld(t){return{x:t.x,y:t.y,z:0}}worldToScreen(t){return{x:t.x,y:t.y}}getScale(){return{x:1,y:1,z:1}}}class Ke{constructor(t,e,n){this.setColor(t,e,n)}asHex(){return"#"+this.HEX}asRGB(){return{r:this.R,g:this.G,b:this.B}}setColor(t,e,n){this.R=t,this.G=e,this.B=n,this.HEX=this.rgbToHex(t,e,n)}rgbToHex(t,e,n){const i=t=>{const e=t.toString(16);return"0"===e?"00":e};return i(t)+i(e)+i(n)}}const Ze=new Map([["solid",[]],["dot",[30,30,.001,30]],["dash",[30,30]]]);class Qe{constructor(t,e=null){var n,i;if(e)return void(this._ref=e);t||(t={}),t.points||(t.points=[{x:0,y:0},{x:100,y:100}]);const r=[];t.points.forEach((t=>r.push(t.x,t.y))),this._ref=new Ye.Line({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",strokeWidth:null!==(i=t.width)&&void 0!==i?i:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",points:r,draggable:!0,strokeScaleEnabled:!1,dash:Ze.get(t.type)||[]}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation)})),this._ref.id(this._ref._id.toString())}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Line"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPoints(){return this._ref.points()}setLineWidth(t){this._ref.strokeWidth(t)}getLineWidth(){return this._ref.strokeWidth()}getLineType(){let t;switch(this._ref.dash()||[]){case Ze.get("dot"):t="dot";break;case Ze.get("dash"):t="dash";break;default:t="solid"}return t}setLineType(t){const e=Ze.get(t);e&&this._ref.dash(e)}addPoints(t){let e=this._ref.points();t.forEach((t=>{e=e.concat([t.x,t.y])})),this._ref.points(e)}}class Je{constructor(t,e=null){var n,i,r;this.TEXT_FONT_FAMILY="Calibri",e?this._ref=e:(t||(t={}),t.position||(t.position={x:0,y:0}),t.text||(t.text="default"),this._ref=new Ye.Text({x:t.position.x,y:t.position.y,text:t.text,fontSize:null!==(n=t.fontSize)&&void 0!==n?n:34,fontFamily:this.TEXT_FONT_FAMILY,fill:null!==(i=t.color)&&void 0!==i?i:"#ff0000",align:"left",draggable:!0,rotation:null!==(r=t.rotation)&&void 0!==r?r:0}),this._ref.width(this._ref.getTextWidth()),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY);r<50&&(r=50),s<Math.round(this.getFontSize())&&(s=Math.round(this.getFontSize())),n&&this._ref.width(r),i&&this._ref.height(s),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString()))}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Text"}getColor(){return this._ref.fill()}setColor(t){this._ref.fill(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getText(){return this._ref.text()}setText(t){this._ref.text(t)}getPosition(){return this._ref.getPosition()}setPosition(t,e){this._ref.setPosition({x:t,y:e})}getFontSize(){return this._ref.fontSize()}setFontSize(t){this._ref.fontSize(t)}}class $e{constructor(t,e=null){var n,i,r,s;e?this._ref=e:(t||(t={}),t.position||(t.position={x:0,y:0}),this._ref=new Ye.Rect({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",strokeWidth:null!==(i=t.lineWidth)&&void 0!==i?i:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",x:t.position.x,y:t.position.y,width:null!==(r=t.width)&&void 0!==r?r:200,height:null!==(s=t.height)&&void 0!==s?s:200,draggable:!0,strokeScaleEnabled:!1}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY);r<50&&(r=50),s<50&&(s=50),n&&this._ref.width(r),i&&this._ref.height(s),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString()))}getPosition(){return this._ref.position()}getWidth(){return this._ref.width()}getHeigth(){return this._ref.height()}setWidth(t){this._ref.width(t)}setHeight(t){this._ref.height(t)}setPosition(t,e){this._ref.setPosition({x:t,y:e})}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Rectangle"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}setLineWidth(t){this._ref.strokeWidth(t)}getLineWidth(){return this._ref.strokeWidth()}}class tn{constructor(t,e=null){var n,i;e?this._ref=e:(t||(t={}),t.position||(t.position={x:0,y:0}),t.radius||(t.radius={x:25,y:25}),this._ref=new Ye.Ellipse({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",strokeWidth:null!==(i=t.lineWidth)&&void 0!==i?i:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",x:t.position.x,y:t.position.y,radiusX:t.radius.x,radiusY:t.radius.y,draggable:!0,strokeScaleEnabled:!1}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.radiusX();n&&(r*=e.scaleX);let s=this._ref.radiusY();i&&(s*=e.scaleY);r<25&&(r=25),s<25&&(s=25),t.evt.ctrlKey||t.evt.shiftKey?n?this._ref.radius({x:r,y:r}):this._ref.radius({x:s,y:s}):this._ref.radius({x:r,y:s}),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString()))}getPosition(){return this._ref.position()}setPosition(t,e){this._ref.setPosition({x:t,y:e})}getRadiusX(){return this._ref.radiusX()}setRadiusX(t){this._ref.radiusX(t)}getRadiusY(){return this._ref.radiusY()}setRadiusY(t){this._ref.radiusY(t)}getLineWidth(){return this._ref.strokeWidth()}setLineWidth(t){this._ref.strokeWidth(t)}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Ellipse"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}}class en{constructor(t,e=null){var n,i;e?this._ref=e:(t||(t={}),t.start||(t.start={x:0,y:0}),t.end||(t.end={x:100,y:100}),this._ref=new Ye.Arrow({stroke:null!==(n=t.color)&&void 0!==n?n:"#ff0000",fill:null!==(i=t.color)&&void 0!==i?i:"#ff0000",strokeWidth:4,globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",points:[t.start.x,t.start.y,t.end.x,t.end.y],draggable:!0,strokeScaleEnabled:!1}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation)})),this._ref.id(this._ref._id.toString()))}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Arrow"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t),this._ref.fill(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPoints(){const t=this._ref.points();return[{x:t[0],y:t[1]},{x:t[2],y:t[3]}]}setPoints(t){2===t.length&&this._ref.points([t[0].x,t[0].y,t[1].x,t[1].y])}getStartPoint(){const t=this._ref.points();return{x:t[0],y:t[1]}}setStartPoint(t,e){const n=this._ref.points();this._ref.points([t,e,n[2],n[3]])}getEndPoint(){const t=this._ref.points();return{x:t[2],y:t[3]}}setEndPoint(t,e){const n=this._ref.points();this._ref.points([n[0],n[1],t,e])}}class nn{constructor(t,e=null){var n,i;if(this._ratio=1,this.EPSILON=1e-5,this.BASE64_HEADER_START="data:image/",this.BASE64_NOT_FOUND="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADsAAAA7AF5KHG9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAmhJREFUWIXtlr9rVEEQxz+H8RQUJIdeIopYm0vkCg0GBBtbG1NF7Kxt7dR/IGIw/uhTaBNLERURg2kCEUyCYCPi70b0InjGS57FzOZN3r19d+9HJIVfWO52dma/s7Mz8xa2KAaBCWAR+AkECWOmSOIdwC1gtQOpHc+NfQ8wClQ8+1d0vcdH/lQ3bSIRGAZ2pTjAqNovANXIWlXlAXA2zvi2Ln4AjqYgtagYEutENSLvjRoOImFv5iB32Ae8UrLXwFBk3h9ndF0VJnKSO9gTu3yKu5Z1LKnS8YIcABgw5Ks692JZFXcXRJ46Aq6kikCnHNi/mQ50WwVtfaIoBzL3gRk2drSscJ2wrc4VvUoe2wn/41/iBfoVLRnBGnDSY3AAKacy8AmYR+o7K1zCl6wgrgpOAc/MuhvfgMuk+1JGHQgSBcAloKXy78AjYBppJk5/noTulseBMZ23iD/piHFkEdgTQzKk+5wHjmHC3cmBg0BD5xcSTrFXyQPgIWFtDwMvab+2N8DpbhyY1v/3E8gdDgNfVX9SCVZ0/gW4B0wB71S2BpxLcuCM/jaQSHSDEeAX4VMuAG4gTzyHbcAVXXO6GxxwIX+vvxe7JHcYQ07nHqklj96UIW/YhSWzMKcep8VVtf8B1Dw6h4DfhB+sdbgn2R+gnoEc5NR3dZ+3QJ9H74HqXLPCGlJyTfI9y3YCs0owq3OLOpKkLeBI1HhSDT/mdKIPiUCARMTlQx34TMLjtww8IczmO8AJ/N/2JNSQXAiQ671JePePge0+wzJSQq4FFzlaenIvucUAkiQLhC/mLGNZ9xgn5s63BP4CCk0QDtm4BhoAAAAASUVORK5CYII=",e)return e.src&&e.src.startsWith(this.BASE64_HEADER_START)||(e.src=this.BASE64_NOT_FOUND),e.height()<=this.EPSILON&&e.height(32),e.width()<=this.EPSILON&&e.width(32),this._ref=e,this._canvasImage=e.image(),void(this._ratio=this._ref.height()<=this.EPSILON||this._ref.width()<=this.EPSILON?1:this._ref.height()/this._ref.width());t||(t={}),t.position||(t.position={x:0,y:0}),t.src&&t.src.startsWith(this.BASE64_HEADER_START)||(t.src=this.BASE64_NOT_FOUND),this._canvasImage=new Image,this._canvasImage.onload=()=>{if(this._ref.image(this._canvasImage),this._ref.height()<=this.EPSILON&&this._ref.height(this._canvasImage.height),this._ref.width()<=this.EPSILON&&this._ref.width(this._canvasImage.width),this._ratio=this._ref.height()<=this.EPSILON||this._ref.width()<=this.EPSILON?1:this._ref.height()/this._ref.width(),(t.width<=this.EPSILON||t.height<=this.EPSILON)&&(t.maxWidth>=this.EPSILON||t.maxWidth>=this.EPSILON)){const e=t.maxHeight-this._canvasImage.height,n=t.maxWidth-this._canvasImage.width;(e<=this.EPSILON||n<=this.EPSILON)&&(n<=this.EPSILON&&n<e/this._ratio?(this._ref.height(t.maxWidth*this._ratio),this._ref.width(t.maxWidth)):(this._ref.width(t.maxHeight/this._ratio),this._ref.height(t.maxHeight)))}},this._canvasImage.onerror=()=>{this._canvasImage.onerror=function(){},this._canvasImage.src=this.BASE64_NOT_FOUND},this._canvasImage.src=t.src,this._ref=new Ye.Image({x:t.position.x,y:t.position.y,image:this._canvasImage,width:null!==(n=t.width)&&void 0!==n?n:0,height:null!==(i=t.height)&&void 0!==i?i:0,draggable:!0}),this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY),t.evt.ctrlKey||t.evt.shiftKey?n?(this._ref.width(r),this._ref.height(r*this._ratio)):(this._ref.width(s/this._ratio),this._ref.height(s)):(n&&this._ref.width(r),i&&this._ref.height(s)),this._ref.scale({x:1,y:1})})),this._ref.id(this._ref._id.toString())}getSrc(){return this._canvasImage.src}setSrc(t){this._canvasImage.src=t}getWidth(){return this._ref.width()}setWidth(t){this._ref.width(t),this._ref.height(t*this._ratio)}getHeight(){return this._ref.height()}setHeight(t){this._ref.height(t),this._ref.width(t/this._ratio)}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Image"}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPosition(){return this._ref.getPosition()}setPosition(t,e){this._ref.setPosition({x:t,y:e})}}class rn{constructor(t,e=null){var n,i,r,s;if(e)return void(this._ref=e);t||(t={}),t.position||(t.position={x:0,y:0});const a=16;this._ref=new Ye.Shape({x:t.position.x,y:t.position.y,width:null!==(n=t.width)&&void 0!==n?n:200,height:null!==(i=t.height)&&void 0!==i?i:200,stroke:null!==(r=t.color)&&void 0!==r?r:"#ff0000",strokeWidth:null!==(s=t.lineWidth)&&void 0!==s?s:4,draggable:!0,strokeScaleEnabled:!1,globalCompositeOperation:"source-over",sceneFunc:(t,e)=>{const n=[{x:0,y:0},{x:0+this._ref.width(),y:0},{x:0+this._ref.width(),y:0+this._ref.height()},{x:0,y:0+this._ref.height()},{x:0,y:0}],i=(r={x:0,y:0},s=this._ref.width(),o=this._ref.height(),{x:r.x+s/2,y:r.y+o/2});var r,s,o;t.beginPath();for(let e=0;e<n.length-1;e++){let r=30;const s=n[e+1].x-n[e].x,o=n[e+1].y-n[e].y,l=Math.sqrt(s*s+o*o),h=Math.floor(l/r);r=30+h/(l%r);let c=n[e].x+s/h/2,d=n[e].y+o/h/2;const u=n[e+1].x,p=n[e+1].y,f=Math.atan((p-d)/(u-c)),m=f+Math.PI,g=c>i.x&&d>i.y;for(let e=0;e<h;e++)g?t.arc(c,d,a,f,m):t.arc(c,d,a,m,f),c+=s/h,d+=o/h}t.closePath(),t.fillStrokeShape(e)}}),this._ref.className="Cloud",this._ref.on("transform",(t=>{const e=t.target.attrs;e.rotation!==this._ref.rotation()&&this._ref.rotation(e.rotation);const n=Math.abs(e.scaleX-1)>1e-5,i=Math.abs(e.scaleY-1)>1e-5;let r=this._ref.width();n&&(r*=e.scaleX);let s=this._ref.height();i&&(s*=e.scaleY);r<100&&(r=100),s<100&&(s=100),n&&this._ref.width(r),i&&this._ref.height(s),this._ref.scale({x:1,y:1})})),this._ref.getSelfRect=()=>({x:-16,y:-16,width:this._ref.width()+32,height:this._ref.height()+32}),this._ref.id(this._ref._id.toString())}ref(){return this._ref}id(){return this._ref.id()}enableMouseEditing(t){this._ref.draggable(t)}type(){return"Cloud"}getColor(){return this._ref.stroke()}setColor(t){this._ref.stroke(t)}getRotation(){return this._ref.rotation()}setRotation(t){this._ref.rotation(t)}getZIndex(){return this._ref.zIndex()}setZIndex(t){this._ref.zIndex(t)}delete(){this._ref.destroy(),this._ref=null}getPosition(){return this._ref.position()}setPosition(t,e){this._ref.position({x:t,y:e})}getWidth(){return this._ref.width()}setWidth(t){this._ref.width(t)}getHeigth(){return this._ref.height()}setHeight(t){this._ref.height(t)}getLineWidth(){return this._ref.strokeWidth()}setLineWidth(t){this._ref.strokeWidth(t)}}const sn={SelectMarkup:{name:"SelectMarkup",initializer:null},Line:{name:"Line",initializer:(t,e=null)=>new Qe(e,t)},Text:{name:"Text",initializer:(t,e=null)=>new Je(e,t)},Rectangle:{name:"Rect",initializer:(t,e=null)=>new $e(e,t)},Ellipse:{name:"Ellipse",initializer:(t,e=null)=>new tn(e,t)},Arrow:{name:"Arrow",initializer:(t,e=null)=>new en(e,t)},Image:{name:"Image",initializer:(t,e=null)=>new nn(e,t)},Cloud:{name:"Cloud",initializer:(t,e=null)=>new rn(e,t)}};class an{constructor(){this._containerEvents=[],this._markupIsActive=!1,this._markupColor=new Ke(255,0,0),this.lineWidth=4,this.lineType="solid",this.fontSize=34,this.changeActiveDragger=t=>{const e=t.data;this._markupContainer.className=this._container.className.split(" ").filter((t=>!t.startsWith("oda-cursor-"))).filter((t=>t)).concat(`oda-cursor-${e.toLowerCase()}`).join(" "),this.removeTextInput(),this.removeImageInput(),this.enableEditMode(e)},this.resizeContainer=t=>{const{width:e,height:n}=t[0].contentRect;e&&n&&this._konvaStage&&(this._konvaStage.width(e),this._konvaStage.height(n))},this.pan=t=>{const e={x:this._konvaStage.x()+t.dX,y:this._konvaStage.y()+t.dY};this._konvaStage.position(e)},this.zoomAt=t=>{const e=this._konvaStage.scaleX()*t.data;this._konvaStage.scale({x:e,y:e});const n={x:t.x-(t.x-this._konvaStage.x())*t.data,y:t.y-(t.y-this._konvaStage.y())*t.data};this._konvaStage.position(n)},this.redirectToViewer=t=>{this._viewer&&this._viewer.emit(t)},this.getRelativePointPosition=(t,e)=>{const n=e.getAbsoluteTransform().copy();return n.invert(),n.point(t)},this.getRelativePointerPosition=t=>this.getRelativePointPosition(t.getStage().getPointerPosition(),t)}initialize(t,e,n,i){if(!Ye)throw new Error('Markup error: Konva is not initialized. Forgot to add <script src="https://unpkg.com/konva@9/konva.min.js"><\/script> to your page?');this._viewer=n,this._worldTransformer=null!=i?i:new qe,this._container=t,this._containerEvents=null!=e?e:[],this._markupContainer=document.createElement("div"),this._markupContainer.id="markup-container",this._markupContainer.style.position="absolute",this._markupContainer.style.top="0px",this._markupContainer.style.left="0px",this._markupContainer.style.outline="0px",this._markupContainer.style.pointerEvents="none";const r=this._container.parentElement;r.appendChild(this._markupContainer),this._resizeObserver=new ResizeObserver(this.resizeContainer),this._resizeObserver.observe(r),this._markupColor.setColor(255,0,0),this.initializeKonva(),this._viewer&&(this._viewer.addEventListener("changeactivedragger",this.changeActiveDragger),this._viewer.addEventListener("pan",this.pan),this._viewer.addEventListener("zoomat",this.zoomAt))}dispose(){var t,e;this._viewer&&(this._viewer.removeEventListener("zoomat",this.zoomAt),this._viewer.removeEventListener("pan",this.pan),this._viewer.removeEventListener("changeactivedragger",this.changeActiveDragger)),this.destroyKonva(),null===(t=this._resizeObserver)||void 0===t||t.disconnect(),this._resizeObserver=void 0,null===(e=this._markupContainer)||void 0===e||e.remove(),this._markupContainer=void 0,this._container=void 0,this._viewer=void 0,this._worldTransformer=void 0,this._markupIsActive=!1}syncOverlay(){}clearOverlay(){this.removeTextInput(),this.removeImageInput(),this.clearSelected(),this.getObjects().forEach((t=>t.delete()))}getMarkupColor(){return this._markupColor.asRGB()}setMarkupColor(t,e,n){this._markupColor.setColor(t,e,n),this.redirectToViewer({type:"changemarkupcolor",data:{r:t,g:e,b:n}})}colorizeAllMarkup(t,e,n){const i=new Ke(t,e,n).asHex();this.getObjects().filter((t=>{var e;return null===(e=t.setColor)||void 0===e?void 0:e.call(t,i)}))}colorizeSelectedMarkups(t,e,n){const i=new Ke(t,e,n).asHex();this.getSelectedObjects().filter((t=>{var e;return null===(e=t.setColor)||void 0===e?void 0:e.call(t,i)}))}setViewpoint(t){var e,n,i,r,s,a,o,l;this.clearSelected(),this.removeTextInput(),this.removeImageInput(),this._konvaStage.scale({x:1,y:1}),this._konvaStage.position({x:0,y:0});const h=(null===(e=t.custom_fields)||void 0===e?void 0:e.markup_color)||{r:255,g:0,b:0};this.setMarkupColor(h.r,h.g,h.b),null===(n=t.lines)||void 0===n||n.forEach((t=>{const e=[];t.points.forEach((t=>{const n=this._worldTransformer.worldToScreen(t);e.push(n.x),e.push(n.y)})),this.addLine(e,t.color,t.type,t.width,t.id)})),null===(i=t.texts)||void 0===i||i.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addText(t.text,e,t.angle,t.color,t.text_size,t.font_size,t.id)})),null===(r=t.rectangles)||void 0===r||r.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addRectangle(e,t.width,t.height,t.line_width,t.color,t.id)})),null===(s=t.ellipses)||void 0===s||s.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addEllipse(e,t.radius,t.line_width,t.color,t.id)})),null===(a=t.arrows)||void 0===a||a.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.start),n=this._worldTransformer.worldToScreen(t.end);this.addArrow(e,n,t.color,t.id)})),null===(o=t.clouds)||void 0===o||o.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addCloud(e,t.width,t.height,t.line_width,t.color,t.id)})),null===(l=t.images)||void 0===l||l.forEach((t=>{const e=this._worldTransformer.worldToScreen(t.position);this.addImage(e,t.src,t.width,t.height,t.id)}))}getViewpoint(t){return t||(t={}),t.lines=this.getMarkupLines(),t.texts=this.getMarkupTexts(),t.arrows=this.getMarkupArrows(),t.clouds=this.getMarkupClouds(),t.ellipses=this.getMarkupEllipses(),t.images=this.getMarkupImages(),t.rectangles=this.getMarkupRectangles(),t.custom_fields={markup_color:this.getMarkupColor()},t.snapshot={data:this.combineMarkupWithDrawing()},t}enableEditMode(t){return t&&sn[t]?(this._markupMode=t,this._markupContainer.style.pointerEvents="all",this._markupIsActive=!0):(this.clearSelected(),this.removeTextInput(),this.removeImageInput(),this._markupContainer.style.pointerEvents="none",this._markupIsActive=!1),this}createObject(t,e){const n=sn[t];if(!n||!n.initializer)throw new Error(`Markup CreateObject - unsupported markup type ${t}`);const i=n.initializer(null,e);return this.addObject(i),i}getObjects(){const t=[];return Object.keys(sn).forEach((e=>{const n=sn[e];this.konvaLayerFind(e).forEach((e=>t.push(n.initializer(e))))})),t}getSelectedObjects(){return this._konvaTransformer?this._konvaTransformer.nodes().map((t=>{const e=t.className,n=Object.values(sn).find((t=>t.name===e));return n?n.initializer(t):null})).filter((t=>t)):[]}selectObjects(t){if(!this._konvaTransformer)return;const e=this._konvaTransformer.nodes().concat(t.map((t=>t.ref())));this._konvaTransformer.nodes(e)}clearSelected(){this._konvaTransformer&&this._konvaTransformer.nodes([])}addObject(t){"Image"===t.type()?this._groupImages.add(t.ref()):"Text"===t.type()?this._groupTexts.add(t.ref()):this._groupGeometry.add(t.ref())}konvaLayerFind(t){if(!this._konvaLayer)return[];const e=sn[t];return e&&e.initializer?this._konvaLayer.find(e.name).filter((t=>t.parent===this._konvaLayer||t.parent===this._groupImages||t.parent===this._groupGeometry||t.parent===this._groupTexts)):[]}initializeKonva(){const t=new Ye.Stage({container:this._markupContainer,width:this._container.clientWidth,height:this._container.clientHeight});this._konvaStage=t;const e=new Ye.Layer({pixelRation:window.devicePixelRatio});t.add(e),this._groupImages=new Ye.Group,e.add(this._groupImages),this._groupGeometry=new Ye.Group,e.add(this._groupGeometry),this._groupTexts=new Ye.Group,e.add(this._groupTexts),this._konvaLayer=e;const n=new Ye.Transformer({shouldOverdrawWholeArea:!1,keepRatio:!1,flipEnabled:!1});e.add(n),this._konvaTransformer=n;let i,r,s,a=!1;t.on("mousedown touchstart",(e=>{if(!this._markupIsActive||e.target!==t||"Text"===this._markupMode||"Image"===this._markupMode)return;if(e.target===t&&n.nodes().length>0)return void n.nodes([]);const s=this.getRelativePointerPosition(t);r=s,a=["Arrow","Cloud","Ellipse","Line","Rectangle"].some((t=>t===this._markupMode)),"Line"===this._markupMode&&(i=this.addLine([s.x,s.y,s.x,s.y]))})),t.on("mouseup touchend",(e=>{if(this._markupIsActive){if(a){const e=this.getRelativePointerPosition(t),n=r&&e.x===r.x&&e.y===r.y,i=n?r.x:Math.min(r.x,e.x),s=n?r.y:Math.min(r.y,e.y),a=n?200:Math.abs(r.x-e.x),o=n?200:Math.abs(r.y-e.y);n&&("Rectangle"===this._markupMode?this.addRectangle({x:i,y:s},a,o):"Ellipse"===this._markupMode?this.addEllipse({x:i,y:s},{x:a/2,y:o/2}):"Arrow"===this._markupMode?this.addArrow({x:r.x,y:r.y},{x:n?r.x+200:e.x,y:n?s:e.y}):"Cloud"===this._markupMode&&this.addCloud({x:i,y:s},Math.max(100,a),Math.max(100,o)))}s=void 0,a=!1}})),t.on("mousemove touchmove",(e=>{if(!this._markupIsActive)return;if(!a)return;const n=this.getRelativePointerPosition(t),o=r&&n.x===r.x&&n.y===r.y,l=o?r.x:Math.min(r.x,n.x),h=o?r.y:Math.min(r.y,n.y),c=o?200:Math.abs(r.x-n.x),d=o?200:Math.abs(r.y-n.y);"Line"===this._markupMode?i.addPoints([{x:n.x,y:n.y}]):"Arrow"===this._markupMode?s?s.setEndPoint(n.x,n.y):s=this.addArrow({x:r.x,y:r.y},{x:n.x,y:n.y}):"Rectangle"===this._markupMode?s?(s.setPosition(l,h),s.setWidth(c),s.setHeight(d)):s=this.addRectangle({x:l,y:h},c,d):"Ellipse"===this._markupMode?s?(s.setPosition(l,h),s.setRadiusX(c),s.setRadiusY(d)):s=this.addEllipse({x:l,y:h},{x:c,y:d}):"Cloud"===this._markupMode&&(s?(s.setPosition(l,h),s.setWidth(Math.max(100,c)),s.setHeight(Math.max(100,d))):s=this.addCloud({x:l,y:h},c,d))})),t.on("click tap",(e=>{if(!this._markupIsActive)return;if(e.target===t){if("Text"===this._markupMode){if(this._textInputRef&&this._textInputRef.value)this.addText(this._textInputRef.value,this._textInputPos,this._textInputAngle);else if(0===n.nodes().length){const n=this.getRelativePointerPosition(t);this.createTextInput(n,e.evt.pageX,e.evt.pageY,0,null)}}else if("Image"===this._markupMode)if(this._imageInputRef&&this._imageInputRef.value)this.addImage({x:this._imageInputPos.x,y:this._imageInputPos.y},this._imageInputRef.value,0,0,this._imageInputRef.value);else if(0===n.nodes().length){const e=this.getRelativePointerPosition(t);this.createImageInput(e)}return void n.nodes([])}if("Text"===this._markupMode||"SelectMarkup"===this._markupMode){if("Text"===e.target.className&&1===n.nodes().length&&n.nodes()[0]===e.target)return void(this._textInputRef&&this._textInputRef.value?this.addText(this._textInputRef.value,this._textInputPos,this._textInputAngle):this.createTextInput({x:e.target.attrs.x,y:e.target.attrs.y},e.evt.pageX,e.evt.pageY,e.target.attrs.rotation,e.target.attrs.text));this.removeTextInput()}if("Image"===this._markupMode||"SelectMarkup"===this._markupMode){if("Image"===e.target.className&&1===n.nodes().length&&n.nodes()[0]===e.target)return void(this._imageInputRef&&this._imageInputRef.value?this.addImage(this._imageInputPos,this._imageInputRef.value,0,0):this.createImageInput({x:e.target.attrs.x,y:e.target.attrs.y}));this.removeImageInput()}n.nodes().filter((t=>"Cloud"===t.className||"Image"===t.className)).length>0||"Cloud"===e.target.className||"Image"===e.target.className?n.rotateEnabled(!1):n.rotateEnabled(!0);const i=e.evt.shiftKey||e.evt.ctrlKey||e.evt.metaKey,r=n.nodes().indexOf(e.target)>=0;if(i||r){if(i&&r){const t=n.nodes().slice();t.splice(t.indexOf(e.target),1),n.nodes(t)}else if(i&&!r){const t=n.nodes().concat([e.target]);n.nodes(t)}}else n.nodes([e.target])}));const o=t.container();o.tabIndex=1,o.focus(),o.addEventListener("keydown",(t=>{if(this._markupIsActive)return"Delete"===t.code?(this.getSelectedObjects().forEach((t=>t.delete())),void this.clearSelected()):void t.preventDefault()}))}destroyKonva(){var t;this.removeTextInput(),this.removeImageInput(),this.clearOverlay(),null===(t=this._konvaStage)||void 0===t||t.destroy(),this._groupImages=void 0,this._groupGeometry=void 0,this._groupTexts=void 0,this._konvaLayer=void 0,this._konvaTransformer=void 0,this._konvaStage=void 0}getMarkupLines(){const t=[];return this.konvaLayerFind("Line").forEach((e=>{const n=e.points();if(!n)return;const i=[],r=e.getAbsoluteTransform();for(let t=0;t<n.length;t+=2){const e=r.point({x:n[t],y:n[t+1]}),s=this._worldTransformer.screenToWorld(e);i.push(s)}const s=new Qe(null,e),a={id:s.id(),points:i,color:s.getColor()||"#ff0000",type:s.getLineType()||this.lineType,width:s.getLineWidth()||this.lineWidth};t.push(a)})),t}getMarkupTexts(){const t=[];return this.konvaLayerFind("Text").forEach((e=>{const n=this._worldTransformer.getScale(),i=e.position(),r=this._konvaStage.getAbsoluteTransform(),s=r.point({x:i.x,y:i.y}),a=this._worldTransformer.screenToWorld(s),o=new Je(null,e),l={id:o.id(),position:a,text:o.getText(),text_size:.02*n.y,angle:o.getRotation(),color:o.getColor(),font_size:o.getFontSize()*r.getMatrix()[0]};t.push(l)})),t}getMarkupRectangles(){const t=[];return this.konvaLayerFind("Rectangle").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new $e(null,e),l={id:o.id(),position:s,width:o.getWidth()*a,height:o.getHeigth()*a,line_width:o.getLineWidth(),color:o.getColor()};t.push(l)})),t}getMarkupEllipses(){const t=[];return this.konvaLayerFind("Ellipse").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new tn(null,e),l={id:o.id(),position:s,radius:{x:e.getRadiusX()*a,y:e.getRadiusY()*a},line_width:o.getLineWidth(),color:o.getColor()};t.push(l)})),t}getMarkupArrows(){const t=[];return this.konvaLayerFind("Arrow").forEach((e=>{const n=e.getAbsoluteTransform(),i=n.point({x:e.points()[0],y:e.points()[1]}),r=this._worldTransformer.screenToWorld(i),s=n.point({x:e.points()[2],y:e.points()[3]}),a=this._worldTransformer.screenToWorld(s),o=new en(null,e),l={id:o.id(),start:r,end:a,color:o.getColor()};t.push(l)})),t}getMarkupImages(){const t=[];return this.konvaLayerFind("Image").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new nn(null,e),l={id:o.id(),position:s,src:o.getSrc(),width:o.getWidth()*a,height:o.getHeight()*a};t.push(l)})),t}getMarkupClouds(){const t=[];return this.konvaLayerFind("Cloud").forEach((e=>{const n=e.position(),i=this._konvaStage.getAbsoluteTransform(),r=i.point({x:n.x,y:n.y}),s=this._worldTransformer.screenToWorld(r),a=i.getMatrix()[0],o=new rn(null,e),l={id:o.id(),position:s,width:o.getWidth()*a,height:o.getHeigth()*a,line_width:o.getLineWidth(),color:o.getColor()};t.push(l)})),t}combineMarkupWithDrawing(){this.clearSelected();const t=document.createElement("canvas");if(this._konvaStage){t.width=this._konvaStage.width(),t.height=this._konvaStage.height();const e=t.getContext("2d");this._container instanceof HTMLCanvasElement&&e.drawImage(this._container,0,0),e.drawImage(this._konvaStage.toCanvas({pixelRatio:window.devicePixelRatio}),0,0)}return t.toDataURL("image/jpeg",.25)}addLine(t,e,n,i,r){if(!t||0===t.length)return;const s=[];for(let e=0;e<t.length;e+=2)s.push({x:t[e],y:t[e+1]});const a=new Qe({points:s,type:n||this.lineType,width:i||this.lineWidth,color:e||this._markupColor.asHex(),id:r});return this.addObject(a),a}createTextInput(t,e,n,i,r){this._textInputRef?this.removeTextInput():(this._textInputPos=t,this._textInputAngle=i,this._textInputRef=document.createElement("textarea"),this._textInputRef.style.zIndex="9999",this._textInputRef.style.position="absolute",this._textInputRef.style.display="block",this._textInputRef.style.top=n+"px",this._textInputRef.style.left=e+"px",this._textInputRef.style.fontSize=`${this.fontSize}px`,this._textInputRef.style.color=`${this._markupColor.asHex()}`,this._textInputRef.style.fontFamily="Calibri",this._textInputRef.onkeydown=t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),this.addText(this._textInputRef.value,this._textInputPos,this._textInputAngle)),"Escape"===t.key&&(t.preventDefault(),this.removeTextInput())},r&&(this._textInputRef.value=r),document.body.appendChild(this._textInputRef),setTimeout((()=>{this._textInputRef.focus()}),50))}removeTextInput(){var t;null===(t=this._textInputRef)||void 0===t||t.remove(),this._textInputRef=null,this._textInputPos=null,this._textInputAngle=0}createImageInput(t){if(this._imageInputRef)this.removeImageInput();else{const e=t=>new Promise(((e,n)=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)},i.onerror=t=>{n(t)}}));this._imageInputPos=t,this._imageInputRef=document.createElement("input"),this._imageInputRef.style.display="none",this._imageInputRef.type="file",this._imageInputRef.accept="image/png, image/jpeg",this._imageInputRef.onchange=async t=>{const n=t.target.files[0],i=await e(n);this.addImage({x:this._imageInputPos.x,y:this._imageInputPos.y},i.toString(),0,0)},this._imageInputRef.oncancel=t=>{this.removeImageInput()},document.body.appendChild(this._imageInputRef),setTimeout((()=>{this._imageInputRef.click()}),50)}}removeImageInput(){var t;null===(t=this._imageInputRef)||void 0===t||t.remove(),this._imageInputRef=null,this._imageInputPos=null}addText(t,e,n,i,r,s,a){var o;if(!t)return;null===(o=this.getSelectedObjects().at(0))||void 0===o||o.delete(),this.clearSelected(),this.removeTextInput();const l=1e-6;if(r&&r>l&&(!s||s<l)){const t=.02;s=r/(this._worldTransformer.getScale().y/t)/34}const h=new Je({position:{x:e.x,y:e.y},text:t,rotation:n,fontSize:s||this.fontSize,color:i||this._markupColor.asHex(),id:a});return this.addObject(h),h}addRectangle(t,e,n,i,r,s){if(!t)return;const a=new $e({position:t,width:e,height:n,lineWidth:i||this.lineWidth,color:r||this._markupColor.asHex(),id:s});return this.addObject(a),a}addEllipse(t,e,n,i,r){if(!t)return;const s=new tn({position:t,radius:e,lineWidth:n,color:i||this._markupColor.asHex(),id:r});return this.addObject(s),s}addArrow(t,e,n,i){if(!t||!e)return;const r=new en({start:t,end:e,color:n||this._markupColor.asHex(),id:i});return this.addObject(r),r}addCloud(t,e,n,i,r,s){if(!t||!e||!n)return;const a=new rn({position:t,width:e,height:n,color:r||this._markupColor.asHex(),lineWidth:i||this.lineWidth,id:s});return this.addObject(a),a}addImage(t,e,n,i,r){var s;if(!t||!e)return;null===(s=this.getSelectedObjects().at(0))||void 0===s||s.delete(),this.clearSelected(),this.removeImageInput();const a=new nn({position:t,src:e,width:n,height:i,maxWidth:this._konvaStage.width()-t.x,maxHeight:this._konvaStage.height()-t.y,id:r});return this.addObject(a),a}}
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2010-2025 Three.js Authors
|