PageSourceSearch

https://cornucopia-app.vercel.app/_next/static/chunks/2225.734cf975882543d0.js

js cornucopia-app.vercel.app collected 2026-10-03 06:35:10 UTC 193,905 bytes, 21 lines download raw bytes

1!function(){try{var t="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="da1d90a9-32c2-4083-a3e7-e433290649c9",t._sentryDebugIdIdentifier="sentry-dbid-da1d90a9-32c2-4083-a3e7-e433290649c9")}catch(t){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2225],{37235:(t,e,i)=>{t.exports=i(59722)},51854:(t,e,i)=>{t.exports=i(89602)},59722:(t,e)=>{e.ConcurrentRoot=1,e.DefaultEventPriority=32,e.DiscreteEventPriority=2},77930:(t,e)=>{function i(t,e){var i=t.length;for(t.push(e);0<i;){var r=i-1>>>1,n=t[r];if(0<a(n,e))t[r]=e,t[i]=n,i=r;else break}}function r(t){return 0===t.length?null:t[0]}function n(t){if(0===t.length)return null;var e=t[0],i=t.pop();if(i!==e){t[0]=i;for(var r=0,n=t.length,s=n>>>1;r<s;){var o=2*(r+1)-1,h=t[o],l=o+1,d=t[l];if(0>a(h,i))l<n&&0>a(d,h)?(t[r]=d,t[l]=i,r=l):(t[r]=h,t[o]=i,r=o);else if(l<n&&0>a(d,i))t[r]=d,t[l]=i,r=l;else break}}return e}function a(t,e){var i=t.sortIndex-e.sortIndex;return 0!==i?i:t.id-e.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var s,o=performance;e.unstable_now=function(){return o.now()}}else{var h=Date,l=h.now();e.unstable_now=function(){return h.now()-l}}var d=[],c=[],u=1,g=null,f=3,p=!1,m=!1,_=!1,y=!1,v="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="u">typeof setImmediate?setImmediate:null;function S(t){for(var e=r(c);null!==e;){if(null===e.callback)n(c);else if(e.startTime<=t)n(c),e.sortIndex=e.expirationTime,i(d,e);else break;e=r(c)}}function w(t){if(_=!1,S(t),!m)if(null!==r(d))m=!0,C||(C=!0,s());else{var e=r(c);null!==e&&G(w,e.startTime-t)}}var C=!1,k=-1,P=5,T=-1;function A(){return!!y||!(e.unstable_now()-T<P)}function M(){if(y=!1,C){var t=e.unstable_now();T=t;var i=!0;try{t:{m=!1,_&&(_=!1,x(k),k=-1),p=!0;var a=f;try{e:{for(S(t),g=r(d);null!==g&&!(g.expirationTime>t&&A());){var o=g.callback;if("function"==typeof o){g.callback=null,f=g.priorityLevel;var h=o(g.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof h){g.callback=h,S(t),i=!0;break e}g===r(d)&&n(d),S(t)}else n(d);g=r(d)}if(null!==g)i=!0;else{var l=r(c);null!==l&&G(w,l.startTime-t),i=!1}}break t}finally{g=null,f=a,p=!1}}}finally{i?s():C=!1}}}if("function"==typeof b)s=function(){b(M)};else if("u">typeof MessageChannel){var R=new MessageChannel,E=R.port2;R.port1.onmessage=M,s=function(){E.postMessage(null)}}else s=function(){v(M,0)};function G(t,i){k=v(function(){t(e.unstable_now())},i)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.callback=null},e.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<t?Math.floor(1e3/t):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(t){switch(f){case 1:case 2:case 3:var e=3;break;default:e=f}var i=f;f=e;try{return t()}finally{f=i}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var i=f;f=t;try{return e()}finally{f=i}},e.unstable_scheduleCallback=function(t,n,a){var o=e.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?o+a:o,t){case 1:var h=-1;break;case 2:h=250;break;case 5:h=0x3fffffff;break;case 4:h=1e4;break;default:h=5e3}return h=a+h,t={id:u++,callback:n,priorityLevel:t,startTime:a,expirationTime:h,sortIndex:-1},a>o?(t.sortIndex=a,i(c,t),null===r(d)&&t===r(c)&&(_?(x(k),k=-1):_=!0,G(w,a-o))):(t.sortIndex=h,i(d,t),m||p||(m=!0,C||(C=!0,s()))),t},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(t){var e=f;return function(){var i=f;f=e;try{return t.apply(this,arguments)}finally{f=i}}}},82225:(t,e,i)=>{let r,n,a;i.d(e,{i3:()=>rT,jl:()=>rS,Pp:()=>rw,YJ:()=>rx,_V:()=>rk,Wd:()=>rv,N1:()=>rC,rw:()=>rb,yp:()=>rA,BI:()=>rE,EY:()=>rP,Ge:()=>rM});var s,o,h={};i.r(h),i.d(h,{HostTransitionContext:()=>rc,NotPendingTransition:()=>rd,afterActiveInstanceBlur:()=>i5,appendChild:()=>iH,appendChildToContainer:()=>iz,appendInitialChild:()=>im,beforeActiveInstanceBlur:()=>i2,cancelTimeout:()=>iR,clearContainer:()=>iZ,commitMount:()=>iq,commitTextUpdate:()=>iU,commitUpdate:()=>iK,createInstance:()=>i_,createTextInstance:()=>iy,detachDeletedInstance:()=>i0,finalizeInitialChildren:()=>iv,getChildHostContext:()=>iA,getCurrentEventPriority:()=>i3,getCurrentUpdatePriority:()=>i9,getInstanceFromNode:()=>i1,getInstanceFromScope:()=>i8,getPublicInstance:()=>ix,getRootHostContext:()=>iT,hideInstance:()=>iV,hideTextInstance:()=>i$,idlePriority:()=>ic.unstable_IdlePriority,insertBefore:()=>iW,insertInContainerBefore:()=>iY,isPrimaryRenderer:()=>iI,maySuspendCommit:()=>ra,noTimeout:()=>iD,now:()=>ic.unstable_now,preloadInstance:()=>rs,prepareForCommit:()=>ib,preparePortalMount:()=>
1iS,prepareScopeUpdate:()=>i4,prepareUpdate:()=>iw,removeChild:()=>ij,removeChildFromContainer:()=>iX,requestPostPaintCallback:()=>rn,resetAfterCommit:()=>iC,resetFormInstance:()=>ru,resetTextContent:()=>ik,resolveEventTimeStamp:()=>rr,resolveEventType:()=>ri,resolveUpdatePriority:()=>i7,run:()=>ic.unstable_runWithPriority,scheduleMicrotask:()=>iG,scheduleTimeout:()=>iM,setCurrentUpdatePriority:()=>i6,shouldAttemptEagerTransition:()=>rt,shouldDeprioritizeSubtree:()=>iP,shouldSetTextContent:()=>iL,startSuspendingCommit:()=>ro,supportsHydration:()=>iN,supportsMicrotasks:()=>iE,supportsMutation:()=>iF,supportsPersistence:()=>iB,suspendInstance:()=>rh,trackSchedulerEvent:()=>re,unhideInstance:()=>iJ,unhideTextInstance:()=>iQ,waitForCommitToBeReady:()=>rl,warnsIfNotActing:()=>iO});let l=Math.PI/180,d="u">typeof global?global:"u">typeof window?window:"u">typeof WorkerGlobalScope?self:{},c={_global:d,version:"10.3.0",isBrowser:"u">typeof window&&("[object Window]"===({}).toString.call(window)||"[object global]"===({}).toString.call(window)),isUnminified:/param/.test((function(t){}).toString()),dblClickWindow:400,getAngle:t=>c.angleDeg?t*l:t,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:"u">typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>c.DD.isDragging,isTransforming(){var t,e;return null!=(e=null==(t=c.Transformer)?void 0:t.isTransforming())&&e},isDragReady:()=>!!c.DD.node,releaseCanvasOnDestroy:!0,document:d.document,_injectGlobal(t){void 0!==d.Konva&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),d.Konva=t}},u=t=>{c[t.prototype.getClassName()]=t};c._injectGlobal(c);let g=`Konva.js unsupported environment.
2
3Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
4
5To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
6
7bash: npm install canvas
8js: import "konva/canvas-backend";
9
10or
11
12bash: npm install skia-canvas
13js: import "konva/skia-backend";
14`,f=()=>{if("u"<typeof document)throw Error(g)};class p{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 p(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){let 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){let e=Math.cos(t),i=Math.sin(t),r=this.m[0]*e+this.m[2]*i,n=this.m[1]*e+this.m[3]*i,a=-(this.m[0]*i)+this.m[2]*e,s=-(this.m[1]*i)+this.m[3]*e;return this.m[0]=r,this.m[1]=n,this.m[2]=a,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){let i=this.m[0]+this.m[2]*e,r=this.m[1]+this.m[3]*e,n=this.m[2]+this.m[0]*t,a=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=r,this.m[2]=n,this.m[3]=a,this}multiply(t){let e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],r=this.m[0]*t.m[2]+this.m[2]*t.m[3],n=this.m[1]*t.m[2]+this.m[3]*t.m[3],a=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],s=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=n,this.m[4]=a,this.m[5]=s,this}invert(){let t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,r=-this.m[2]*t,n=this.m[0]*t,a=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=n,this.m[4]=a,this.m[5]=s,this}getMatrix(){return this.m}decompose(){let t=this.m[0],e=this.m[1],i=this.m[2],r=this.m[3],n=this.m[4],a=this.m[5],s=t*r-e*i,o={x:n,y:a,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=t||0!=e){let n=Math.sqrt(t*t+e*e);o.rotation=e>0?Math.acos(t/n):-Math.acos(t/n),o.scaleX=n,o.scaleY=s/n,o.skewX=(t*i+e*r)/s,o.skewY=0}
14else if(0!=i||0!=r){let n=Math.sqrt(i*i+r*r);o.rotation=Math.PI/2-(r>0?Math.acos(-i/n):-Math.acos(i/n)),o.scaleX=s/n,o.scaleY=n,o.skewX=0,o.skewY=(t*i+e*r)/s}return o.rotation=C._getRotation(o.rotation),o}}let m=Math.PI/180,_=180/Math.PI,y="Konva error: ",v={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]},x=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[],S=null,w="u">typeof requestAnimationFrame&&requestAnimationFrame||function(t){setTimeout(t,16)},C={_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;let e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:t=>0===t||t>
140?1:-1,requestAnimFrame(t){b.push(t),1===b.length&&w(function(){let t=b;b=[],t.forEach(function(t){t()})})},createCanvasElement(){f();let t=document.createElement("canvas");try{t.style=t.style||{}}catch(t){}return t},createImageElement:()=>(f(),document.createElement("img")),_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){let i=C.createImageElement();i.onload=function(){e(i)},i.src=t},_rgbToHex:(t,e,i)=>(0x1000000+(t<<16)+(e<<8)+i).toString(16).slice(1),_hexToRgb(t){let e=parseInt(t=t.replace("#",""),16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor(){let t=(0xffffff*Math.random()|0).toString(16);for(;t.length<6;)t="0"+t;return"#"+t},isCanvasFarblingActive(){if(null!==S)return S;if("u"<typeof document)return S=!1,!1;let t=this.createCanvasElement();t.width=10,t.height=10;let e=t.getContext("2d",{willReadFrequently:!0});e.clearRect(0,0,10,10),e.fillStyle="#282828",e.fillRect(0,0,10,10);let i=e.getImageData(0,0,10,10).data,r=!1;for(let t=0;t<100;t++)if(40!==i[4*t]||40!==i[4*t+1]||40!==i[4*t+2]||255!==i[4*t+3]){r=!0;break}return S=r,this.releaseCanvas(t),S},getHitColor(){let t=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(t):t},getHitColorKey(t,e,i){return this.isCanvasFarblingActive()&&(t=5*Math.round(t/5),e=5*Math.round(e/5),i=5*Math.round(i/5)),"#"+this._rgbToHex(t,e,i)},getSnappedHexColor(t){let e=this._hexToRgb(t);return"#"+this._rgbToHex(5*Math.round(e.r/5),5*Math.round(e.g/5),5*Math.round(e.b/5))},getRGB(t){let e;return t in v?{r:(e=v[t])[0],g:e[1],b:e[2]}:"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?{r:parseInt((e=x.exec(t.replace(/ /g,"")))[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}:{r:0,g:0,b:0}},colorToRGBA:t=>(t=t||"black",C._namedColorToRBA(t)||C._hex3ColorToRGBA(t)||C._hex4ColorToRGBA(t)||C._hex6ColorToRGBA(t)||C._hex8ColorToRGBA(t)||C._rgbColorToRGBA(t)||C._rgbaColorToRGBA(t)||C._hslColorToRGBA(t)),_namedColorToRBA(t){let e=v[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(0===t.indexOf("rgb(")){let 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(")){let 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)){let e,i,r,[n,...a]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),s=Number(a[0])/360,o=Number(a[1])/100,h=Number(a[2])/100;if(0===o)return{r:Math.round(r=255*h),g:Math.round(r),b:Math.round(r),a:1};e=h<.5?h*(1+o):h+o-h*o;let l=2*h-e,d=[0,0,0];for(let t=0;t<3;t++)(i=s+-(1/3*(t-1)))<0&&i++,i>1&&i--,r=6*i<1?l+(e-l)*6*i:2*i<1?e:3*i<2?l+(e-l)*(2/3-i)*6:l,d[t]=255*r;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection:(t,e)=>!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y),cloneObject(t){let e={};for(let i in t)this._isPlainObject(t[i])?e[i]=this.cloneObject(t[i]):this._isArray(t[i])?e[i]=this.cloneArray(t[i]):e[i]=t[i];return e},cloneArray:t=>t.slice(0),degToRad:t=>t*m,radToDeg:t=>t*_,_degToRad:t=>(C.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),C.degToRad(t)),_radToDeg:t=>(C.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),C.radToDeg(t)),_getRotation:t=>c.angleDeg?C.radToDeg(t):t,_capitalize:t=>t.charAt(0).toUpperCase()+t.slice(1),throw(t){throw Error(y+t)},error(t){console.error(y+t)},warn(t){c.showWarnings&&console.warn("Konva warning: "+t)},each(t,e){for(let i in t)e(i,t[i])},_inRange:(t,e,i)=>e<=t&&t<i,_getProjectionToSegment(t,e,i,r,n,a){let s,o,h,l=(t-i)*(t-i)+(e-r)*(e-r);if(0==l)s=t,o=e,h=(n-i)*(n-i)+(a-r)*(a-r);else{let d=((n-t)*(i-t)+(a-e)*(r-e))/l;d<0?(s=t,o=e,h=(t-n)*(t-n)+(e-a)*(e-a)):d>1?(s=i,o=r,h=(i-n)*(i-n)+(r-a)*(r-a)):h=((s=t+d*(i-t))-n)*(s-n)+((o=e+d*(r-e))-a)*(o-a)}return[s,o,h]},_getProjectionToLine(t,e,i){let r=C.cloneObject(t),n=Number.MAX_VALUE;return e.forEach(function(a,s){if(!i&&s===e.length-1)return;let o=e[(s+1)%e.length],h=C._getProjectionToSegment(a.x,a.y,o.x,o.y,t.x,t.y),l=h[0],d=h[1],c=h[2];c<n&&(r.x=l,r.y=d,n=c)}),r},_prepareArrayForTween(t,e,i){let r=[],n=[];if(t.length>e.length){let i=e;e=t,t=i}for(let e=0;e<t.length;e+=2)r.push({x:t[e],y:t[e+1]});for(let t=0;t<e.length;t+=2)n.push({x:e[t],y:e[t+1]});let a=[];
14return n.forEach(function(t){let e=C._getProjectionToLine(t,r,i);a.push(e.x),a.push(e.y)}),a},_prepareToStringify(t){let e;for(let i in t.visitedByCircularReferenceRemoval=!0,t)if(t.hasOwnProperty(i)&&t[i]&&"object"==typeof t[i]){if(e=Object.getOwnPropertyDescriptor(t,i),t[i].visitedByCircularReferenceRemoval||C._isElement(t[i]))if(!e.configurable)return null;else delete t[i];else if(null===C._prepareToStringify(t[i]))if(!e.configurable)return null;else delete t[i]}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(let i in e)t[i]=e[i];return t},_getFirstPointerId:t=>t.touches?t.changedTouches[0].identifier:t.pointerId||999,releaseCanvas(...t){c.releaseCanvasOnDestroy&&t.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(t,e,i,r){let n=e<0?e:0,a=i<0?i:0;e=Math.abs(e),i=Math.abs(i);let s=0,o=0,h=0,l=0;"number"==typeof r?s=o=h=l=Math.min(r,e/2,i/2):(s=Math.min(r[0]||0,e/2,i/2),o=Math.min(r[1]||0,e/2,i/2),l=Math.min(r[2]||0,e/2,i/2),h=Math.min(r[3]||0,e/2,i/2)),t.moveTo(n+s,a),t.lineTo(n+e-o,a),t.arc(n+e-o,a+o,o,3*Math.PI/2,0,!1),t.lineTo(n+e,a+i-l),t.arc(n+e-l,a+i-l,l,0,Math.PI/2,!1),t.lineTo(n+h,a+i),t.arc(n+h,a+i-h,h,Math.PI/2,Math.PI,!1),t.lineTo(n,a+s),t.arc(n+s,a+s,s,Math.PI,3*Math.PI/2,!1)},drawRoundedPolygonPath(t,e,i,r,n){r=Math.abs(r);for(let a=0;a<i;a++){let s,o=e[(a-1+i)%i],h=e[a],l=e[(a+1)%i],d={x:h.x-o.x,y:h.y-o.y},c={x:l.x-h.x,y:l.y-h.y},u=Math.hypot(d.x,d.y),g=Math.hypot(c.x,c.y);s="number"==typeof n?n:a<n.length?n[a]:0,s=r*Math.cos(Math.PI/i)*Math.min(1,s/r*2);let f={x:d.x/u,y:d.y/u},p={x:c.x/g,y:c.y/g},m={x:h.x-f.x*s,y:h.y-f.y*s},_={x:h.x+p.x*s,y:h.y+p.y*s};0===a?t.moveTo(m.x,m.y):t.lineTo(m.x,m.y),t.arcTo(h.x,h.y,_.x,_.y,s)}}},k=["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"],P=null;function T(){if(null!==P)return P;try{let t=C.createCanvasElement().getContext("2d");if(!t)return P=!1,!1;return!!t&&"filter"in t}catch(t){return P=!1,!1}}class A{constructor(t){this.canvas=t,c.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){let i=this.traceArr,r=i.length,n="",a,s,o,h;for(a=0;a<r;a++)(o=(s=i[a]).method)?(h=s.args,n+=o,t?n+="()":C._isArray(h[0])?n+="(["+h.join(",")+"])":(e&&(h=h.map(t=>"number"==typeof t?Math.floor(t):t)),n+="("+h.join(",")+")")):(n+=s.property,t||(n+="="+s.val)),n+=";";return n}clearTrace(){this.traceArr=[]}_trace(t){let e=this.traceArr;e.push(t),e.length>=100&&e.shift()}reset(){let t=this.getCanvas().getPixelRatio();this.setTransform(+t,0,0,+t,0,0)}getCanvas(){return this.canvas}clear(t){let 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){let e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){let e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){let e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}_applyMiterLimit(t){let e=t.attrs.miterLimit;null!=e&&this.setAttr("miterLimit",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,r,n,a){this._context.arc(t,e,i,r,n,a)}arcTo(t,e,i,r,n){this._context.arcTo(t,e,i,r,n)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,r,n,a){this._context.bezierCurveTo(t,e,i,r,n,a)}clearRect(t,e,i,r){this._context.clearRect(t,e,i,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){let i=arguments;return 2===i.length?this._context.createImageData(t,e):1===i.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,i,r){return this._context.createLinearGradient(t,e,i,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,r,n,a){return this._context.createRadialGradient(t,e,i,r,n,a)}drawImage(t,e,i,r,n,a,s,o,h){let l=arguments,d=this._context;3===l.length?d.drawImage(t,e,i):5===l.length?d.drawImage(t,e,i,r,n):9===l.length&&d.drawImage(t,e,i,r,n,a,s,o,h)}ellipse(t,e,i,r,n,a,s,o){this._context.ellipse(t,e,i,r,n,a,s,o)}
14isPointInPath(t,e,i,r){return i?this._context.isPointInPath(i,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,i,r){this._context.fillRect(t,e,i,r)}strokeRect(t,e,i,r){this._context.strokeRect(t,e,i,r)}fillText(t,e,i,r){r?this._context.fillText(t,e,i,r):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,r){return this._context.getImageData(t,e,i,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,r){this._context.rect(t,e,i,r)}roundRect(t,e,i,r,n){this._context.roundRect(t,e,i,r,n)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,r){this._context.quadraticCurveTo(t,e,i,r)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,r,n,a){this._context.setTransform(t,e,i,r,n,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,r){this._context.strokeText(t,e,i,r)}transform(t,e,i,r,n,a){this._context.transform(t,e,i,r,n,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){let t=this,e=k.length,i=this.setAttr,r,n,a=function(e){let i=t[e],r;t[e]=function(){return n=function(t){let e=[],i=t.length;for(let r=0;r<i;r++){let i=t[r];C._isNumber(i)?i=Math.round(1e3*i)/1e3:C._isString(i)||(i+=""),e.push(i)}return e}(Array.prototype.slice.call(arguments,0)),r=i.apply(t,arguments),t._trace({method:e,args:n}),r}};for(r=0;r<e;r++)a(k[r]);t.setAttr=function(){i.apply(t,arguments);let e=arguments[0],r=arguments[1];("shadowOffsetX"===e||"shadowOffsetY"===e||"shadowBlur"===e)&&(r/=this.canvas.getPixelRatio()),t._trace({property:e,val:r})}}_applyGlobalCompositeOperation(t){let e=t.attrs.globalCompositeOperation;e&&"source-over"!==e&&this.setAttr("globalCompositeOperation",e)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"].forEach(function(t){Object.defineProperty(A.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class M extends A{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){let e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){let e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){let e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){let e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)return void this._fillColor(t);let r=t.getFillPatternImage();if(r&&"pattern"===i)return void this._fillPattern(t);let n=t.getFillLinearGradientColorStops();if(n&&"linear-gradient"===i)return void this._fillLinearGradient(t);let a=t.getFillRadialGradientColorStops();a&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):r?this._fillPattern(t):n?this._fillLinearGradient(t):a&&this._fillRadialGradient(t)}_strokeLinearGradient(t){let e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),n=this.createLinearGradient(e.x,e.y,i.x,i.y);if(r){for(let t=0;t<r.length;t+=2)n.addColorStop(r[t],r[t+1]);this.setAttr("strokeStyle",n)}}_stroke(t){let e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();let t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore(
14)}}_applyShadow(t){var e,i,r;let n=null!=(e=t.getShadowRGBA())?e:"black",a=null!=(i=t.getShadowBlur())?i:5,s=null!=(r=t.getShadowOffset())?r:{x:0,y:0},o=t.getAbsoluteScale(),h=this.canvas.getPixelRatio(),l=o.x*h,d=o.y*h;this.setAttr("shadowColor",n),this.setAttr("shadowBlur",a*Math.min(Math.abs(l),Math.abs(d))),this.setAttr("shadowOffsetX",s.x*l),this.setAttr("shadowOffsetY",s.y*d)}}class R extends A{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()){let e=t.getStrokeScaleEnabled();if(!e){this.save();let t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t);let i=t.hitStrokeWidth(),r="auto"===i?t.strokeWidth():i;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}}}class E{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const e=(t||{}).pixelRatio||c.pixelRatio||function(){if(r)return r;let t=C.createCanvasElement(),e=t.getContext("2d");return r=(c._global.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),C.releaseCanvas(t),r}();this.pixelRatio=e,this._canvas=C.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){let 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";let 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";let e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch(t){try{return this._canvas.toDataURL()}catch(t){return C.error("Unable to get data URL. "+t.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class G extends E{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new M(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}class D extends E{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new R(this),this.setSize(t.width,t.height)}}let L={get isDragging(){let t=!1;return L._dragElements.forEach(e=>{"dragging"===e.dragStatus&&(t=!0)}),t},justDragged:!1,get node(){let t;return L._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){let e=[];L._dragElements.forEach((i,r)=>{let{node:n}=i,a=n.getStage();a.setPointersPositions(t),void 0===i.pointerId&&(i.pointerId=C._getFirstPointerId(t));let s=a._changedPointerPositions.find(t=>t.id===i.pointerId);if(s){if("dragging"!==i.dragStatus){let e=n.dragDistance();if(Math.max(Math.abs(s.x-i.startPointerPos.x),Math.abs(s.y-i.startPointerPos.y))<e||(n.startDrag({evt:t}),!n.isDragging()))return}n._setDragPosition(t,i),e.push(n)}}),e.forEach(e=>{e.getStage()&&e.fire("dragmove",{type:"dragmove",target:e,evt:t},!0)})},_endDragBefore(t){let e=[];L._dragElements.forEach(i=>{let{node:r}=i,n=r.getStage();if(t&&n.setPointersPositions(t),!n._changedPointerPositions.find(t=>t.id===i.pointerId))return;("dragging"===i.dragStatus||"stopped"===i.dragStatus)&&(L.justDragged=!0,c._mouseListenClick=!1,c._touchListenClick=!1,c._pointerListenClick=!1,i.dragStatus="stopped");let a=i.node.getLayer()||i.node instanceof c.Stage&&i.node;a&&-1===e.indexOf(a)&&e.push(a)}),e.forEach(t=>{t.draw()})},_endDragAfter(t){L._dragElements.forEach((e,i)=>{"stopped"===e.dragStatus&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t}
14,!0),"dragging"!==e.dragStatus&&L._dragElements.delete(i)})}};function I(t){return C._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)||C._isBoolean(t)?t:Object.prototype.toString.call(t)}function O(t){return t>255?255:t<0?0:Math.round(t)}function F(){if(c.isUnminified)return function(t,e){return C._isNumber(t)||C.warn(I(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function B(t){if(c.isUnminified)return function(e,i){let r=C._isNumber(e),n=C._isArray(e)&&e.length==t;return r||n||C.warn(I(e)+' is a not valid value for "'+i+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function N(){if(c.isUnminified)return function(t,e){let i=C._isNumber(t),r="auto"===t;return i||r||C.warn(I(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function H(){if(c.isUnminified)return function(t,e){return C._isString(t)||C.warn(I(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function z(){if(c.isUnminified)return function(t,e){let i=C._isString(t),r="[object CanvasGradient]"===Object.prototype.toString.call(t)||t&&t.addColorStop;
14return i||r||C.warn(I(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function W(){if(c.isUnminified)return function(t,e){return!0!==t&&!1!==t&&C.warn(I(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}c.isBrowser&&(window.addEventListener("mouseup",L._endDragBefore,!0),window.addEventListener("touchend",L._endDragBefore,!0),window.addEventListener("touchcancel",L._endDragBefore,!0),window.addEventListener("mousemove",L._drag),window.addEventListener("touchmove",L._drag),window.addEventListener("mouseup",L._endDragAfter,!1),window.addEventListener("touchend",L._endDragAfter,!1),window.addEventListener("touchcancel",L._endDragAfter,!1));let Y={addGetterSetter(t,e,i,r,n){Y.addGetter(t,e,i),Y.addSetter(t,e,r,n),Y.addOverloadedGetterSetter(t,e)},addGetter(t,e,i){let r="get"+C._capitalize(e);t.prototype[r]=t.prototype[r]||function(){let t=this.attrs[e];return void 0===t?i:t}},addSetter(t,e,i,r){let n="set"+C._capitalize(e);t.prototype[n]||Y.overWriteSetter(t,e,i,r)},overWriteSetter(t,e,i,r){let n="set"+C._capitalize(e);t.prototype[n]=function(t){return i&&null!=t&&(t=i.call(this,t,e)),this._setAttr(e,t),r&&r.call(this),this}},addComponentsGetterSetter(t,e,i,r,n){let a=i.length,s=C._capitalize,o="get"+s(e),h="set"+s(e);t.prototype[o]=function(){let t={};for(let r=0;r<a;r++){let n=i[r];t[n]=this.getAttr(e+s(n))}return t};let l=function(t){if(c.isUnminified)return function(e,i){return null==e||C.isObject(e)||C.warn(I(e)+' is a not val
14id value for "'+i+'" attribute. The value should be an object with properties '+t),e}}(i);t.prototype[h]=function(t){let a=this.attrs[e];for(let i in r&&(t=r.call(this,t,e)),l&&l.call(this,t,e),t)t.hasOwnProperty(i)&&this._setAttr(e+s(i),t[i]);return t||i.forEach(t=>{this._setAttr(e+s(t),void 0)}),this._fireChangeEvent(e,a,t),n&&n.call(this),this},Y.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){let i=C._capitalize(e),r="set"+i,n="get"+i;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[n]()}},addDeprecatedGetterSetter(t,e,i,r){C.error("Adding deprecated "+e);let n="get"+C._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[n]=function(){C.error(a);let t=this.attrs[e];return void 0===t?i:t},Y.addSetter(t,e,r,function(){C.error(a)}),Y.addOverloadedGetterSetter(t,e)},backCompat(t,e){C.each(e,function(e,i){let r=t.prototype[i],n="get"+C._capitalize(e),a="set"+C._capitalize(e);function s(){r.apply(this,arguments),C.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}t.prototype[e]=s,t.prototype[n]=s,t.prototype[a]=s})},afterSetFilter(){this._filterUpToDate=!1}},j="absoluteOpacity",X="allEventListeners",U="absoluteTransform",q="absoluteScale",K="canvas",V="listening",$="Shape",J="stage",Q="transform",Z="visible",tt=1;class te{constructor(t){this._id=tt++,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===Q||t===U)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){let i=this._cache.get(t),r=t===Q||t===U;return(void 0===i||r&&!0===i.dirty)&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){let i=e.map(t=>t+"Change.konva").join(" ");this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(K)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===U&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(K)){let{scene:t,filter:e,hit:i}=this._cache.get(K);C.releaseCanvas(t._canvas,e._canvas,i._canvas),this._cache.delete(K)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){let e=t||{},i={};(void 0===e.x||void 0===e.y||void 0===e.width||void 0===e.height)&&(i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(e.width||i.width),n=Math.ceil(e.height||i.height),a=e.pixelRatio,s=void 0===e.x?Math.floor(i.x):e.x,o=void 0===e.y?Math.floor(i.y):e.y,h=e.offset||0,l=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!r||!n)return void C.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");let c=+(Math.abs(Math.round(i.x)-s)>.5),u=+(Math.abs(Math.round(i.y)-o)>.5);r+=2*h+c,n+=2*h+u,s-=h,o-=h;let g=new G({pixelRatio:a,width:r,height:n}),f=new G({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new D({pixelRatio:d,width:r,height:n}),m=g.getContext(),_=p.getContext(),y=new G({width:g.width/g.pixelRatio+Math.abs(s),height:g.height/g.pixelRatio+Math.abs(o),pixelRatio:g.pixelRatio}),v=y.getContext();return p.isCache=!0,g.isCache=!0,this._cache.delete(K),this._filterUpToDate=!1,!1===e.imageSmoothingEnabled&&(g.getContext()._context.imageSmoothingEnabled=!1,f.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),v.save(),m.translate(-s,-o),_.translate(-s,-o),v.translate(-s,-o),y.x=s,y.y=o,this._isUnderCache=!0,this._clearSelfAndDescendantCache(j),this._clearSelfAndDescendantCache(q),this.drawScene(g,this,y),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),l&&(m.save(),m.beginPath(),m.rect(0,0,r,n),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore(
14)),C.releaseCanvas(y._canvas),this._cache.set(K,{scene:g,filter:f,hit:p,x:s,y:o}),this._requestDraw(),this}isCached(){return this._cache.has(K)}getClientRect(t){throw Error('abstract "getClientRect" method call')}_transformedRect(t,e){let i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],r=1/0,n=1/0,a=-1/0,s=-1/0,o=this.getAbsoluteTransform(e);return i.forEach(function(t){let e=o.point(t);void 0===r&&(r=a=e.x,n=s=e.y),r=Math.min(r,e.x),n=Math.min(n,e.y),a=Math.max(a,e.x),s=Math.max(s,e.y)}),{x:r,y:n,width:a-r,height:s-n}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);let e=this._getCanvasCache();t.translate(e.x,e.y);let i=this._getCachedSceneCanvas(),r=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/r,i.height/r),t.restore()}_drawCachedHitCanvas(t){let e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t=this.filters(),e=this._getCanvasCache(),i=e.scene,r=e.filter,n=r.getContext(),a,s,o,h;if(!t||0===t.length)return i;if(this._filterUpToDate)return r;let l=!0;for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&!T(),"string"!=typeof t[e]||!T()){l=!1;break}let d=i.pixelRatio;if(r.setSize(i.width/i.pixelRatio,i.height/i.pixelRatio),l){let e=t.join(" ");return n.save(),n.setAttr("filter",e),n.drawImage(i._canvas,0,0,i.getWidth()/d,i.getHeight()/d),n.restore(),this._filterUpToDate=!0,r}try{for(a=t.length,n.clear(),n.drawImage(i._canvas,0,0,i.getWidth()/d,i.getHeight()/d),s=n.getImageData(0,0,r.getWidth(),r.getHeight()),o=0;o<a;o++)h=t[o],"string"==typeof h&&(h=function(t){let e,i=/(\w+)\(([^)]+)\)/g;for(;null!==(e=i.exec(t));){let[,t,i]=e;switch(t){case"blur":{let t=parseFloat(i.replace("px",""));return function(e){this.blurRadius(.5*t);let i=c.Filters;i&&i.Blur&&i.Blur.call(this,e)}}case"brightness":{let t=i.includes("%")?parseFloat(i)/100:parseFloat(i);return function(e){this.brightness(t);let i=c.Filters;i&&i.Brightness&&i.Brightness.call(this,e)}}case"contrast":{let t=parseFloat(i);return function(e){let i=100*(Math.sqrt(t)-1);this.contrast(i);let r=c.Filters;r&&r.Contrast&&r.Contrast.call(this,e)}}case"grayscale":return function(t){let e=c.Filters;e&&e.Grayscale&&e.Grayscale.call(this,t)};case"sepia":return function(t){let e=c.Filters;e&&e.Sepia&&e.Sepia.call(this,t)};case"invert":return function(t){let e=c.Filters;e&&e.Invert&&e.Invert.call(this,t)};default:C.warn(`CSS filter "${t}" is not supported in fallback mode. Consider using function filters for better compatibility.`)}}return()=>{}}(h)),h.call(this,s),n.putImageData(s,0,0)}catch(t){C.error("Unable to apply filter. "+t.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,r}on(...t){let e=t[0],i=t[1];if(t[2],this._cache&&this._cache.delete(X),3===t.length)return this._delegate.apply(this,t);let r=e.split(" ");for(let t=0;t<r.length;t++){let e=r[t].split("."),n=e[0],a=e[1]||"";this.eventListeners[n]||(this.eventListeners[n]=[]),this.eventListeners[n].push({name:a,handler:i})}return this}off(t,e){let i=(t||"").split(" "),r=i.length,n,a,s,o,h;if(this._cache&&this._cache.delete(X),!t)for(a in this.eventListeners)this._off(a);for(n=0;n<r;n++)if(o=(s=i[n].split("."))[0],h=s[1],o)this.eventListeners[o]&&this._off(o,h,e);else for(a in this.eventListeners)this._off(a,h,e);return this}dispatchEvent(t){let e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(t){e.call(this,t.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,i){let r=this;return this.on(t,function(t){let n=t.target.findAncestors(e,!0,r);for(let e=0;e<n.length;e++)(t=C.cloneObject(t)).currentTarget=n[e],i.call(n[e],t)}),this}
14remove(){return this.isDragging()&&this.stopDrag(),L._dragElements.delete(this._id),L._dragElements.forEach((t,e)=>{this.isAncestorOf(t.node)&&L._dragElements.delete(e)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(U),this._clearSelfAndDescendantCache(j),this._clearSelfAndDescendantCache(q),this._clearSelfAndDescendantCache(J),this._clearSelfAndDescendantCache(Z),this._clearSelfAndDescendantCache(V)}_remove(){this._clearCaches();let t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){let e="get"+C._capitalize(t);return C._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){let t=this.getParent(),e=[];for(;t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{let e,i;if(!t)return this;for(e in t)"children"!==e&&(i="set"+C._capitalize(e),C._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(V,this._isListening)}_isListening(t){if(!this.listening())return!1;let e=this.getParent();return!e||e===t||this===t||e._isListening(t)}isVisible(){return this._getCache(Z,this._isVisible)}_isVisible(t){if(!this.visible())return!1;let 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);let i=this.getLayer(),r=!1;L._dragElements.forEach(t=>{"dragging"!==t.dragStatus||("Stage"===t.node.nodeType?r=!0:t.node.getLayer()===i&&(r=!0))});let n=!e&&!c.hitOnDragEnabled&&(r||c.isTransforming());return this.isListening()&&this.isVisible()&&!n}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t=this.getDepth(),e=this,i=0,r,n,a,s,o=this.getStage();return"Stage"!==e.nodeType&&o&&function o(h){for(r=[],n=h.length,a=0;a<n;a++)s=h[a],i++,s.nodeType!==$&&(r=r.concat(s.getChildren().slice())),s._id===e._id&&(a=n);r.length>0&&r[0].getDepth()<=t&&o(r)}(o.getChildren()),i}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(Q),this._clearSelfAndDescendantCache(U)),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(){let t=this.getStage();if(!t)return null;let e=t.getPointerPosition();if(!e)return null;let i=this.getAbsoluteTransform().copy();return i.invert(),i.point(e)}getAbsolutePosition(t){let e=!1,i=this.parent;for(;i;){if(i.isCached()){e=!0;break}i=i.parent}e&&!t&&(t=!0);let r=this.getAbsoluteTransform(t).getMatrix(),n=new p,a=this.offset();return n.m=r.slice(),n.translate(a.x,a.y),n.getTranslation()}setAbsolutePosition(t){let{x:e,y:i,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=i,this._clearCache(Q);let n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(t.x,t.y),t={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(r),this.setPosition({x:t.x,y:t.y}),this._clearCache(Q),this._clearSelfAndDescendantCache(U),this}_setTransform(t){let e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){let t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let e=t.x,i=t.y,r=this.x(),n=this.y();return void 0!==e&&(r+=e),void 0!==i&&(n+=i),this.setPosition({x:r,y:n}),this}_eachAncestorReverse(t,e){let i=[],r=this.getParent(),n,a;if(!e||e._id!==this._id){for(i.unshift(this);r&&(!e||r._id!==e._id);)i.unshift(r),r=r.parent;for(n=i.length,a=0;a<n;a++)t(i[a])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return C.warn("Node has no parent. moveToTop function is ignored."),!1;let t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return C.warn("Node has no parent. moveUp function is ignored."),!1;let t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return C.warn("Node has no parent. moveDown function is ignored."),!1;let t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return C.warn("Node has no parent. moveToBottom function is ignored."),!1;let t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(t){if(!this.parent)return C.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&C.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");let e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(j,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let t=this.getAttrs(),e,i,r,n,a={attrs:{},className:this.getClassName()};for(e in t)i=t[e],(!C.isObject(i)||C._isPlainObject(i)||C._isArray(i))&&(r="function"==typeof this[e]&&this[e],delete t[e],n=r?r.call(this):null,t[e]=i,n!==i&&(a.attrs[e]=i));return C._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){let r=[];e&&this._isMatch(t)&&r.push(this);let n=this.parent;for(;n&&n!==i;)n._isMatch(t)&&r.push(n),n=n.parent;return r}isAncestorOf(t){return!1}
14findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(t){if(!t)return!1;if("function"==typeof t)return t(this);let e=t.replace(/ /g,"").split(","),i=e.length,r,n;for(r=0;r<i;r++)if(n=e[r],C.isValidSelector(n)||(C.warn('Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),C.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),C.warn("Konva is awesome, right?")),"#"===n.charAt(0)){if(this.id()===n.slice(1))return!0}else if("."===n.charAt(0)){if(this.hasName(n.slice(1)))return!0}else if(this.className===n||this.nodeType===n)return!0;return!1}getLayer(){let t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(J,this._getStage)}_getStage(){let t=this.getParent();return t?t.getStage():null}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(U,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let e;if(t)return e=new p,this._eachAncestorReverse(function(t){let i=t.transformsEnabled();"all"===i?e.multiply(t.getTransform()):"position"===i&&e.translate(t.x()-t.offsetX(),t.y()-t.offsetY())},t),e;{e=this._cache.get(U)||new p,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();let t=this.transformsEnabled();if("all"===t)e.multiply(this.getTransform());else if("position"===t){let t=this.attrs.x||0,i=this.attrs.y||0,r=this.attrs.offsetX||0,n=this.attrs.offsetY||0;e.translate(t-r,i-n)}return e.dirty=!1,e}}getAbsoluteScale(t){let e=this;for(;e;)e._isUnderCache&&(t=e),e=e.getParent();let i=this.getAbsoluteTransform(t).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Q,this._getTransform)}_getTransform(){var t,e;let i=this._cache.get(Q)||new p;i.reset();let r=this.x(),n=this.y(),a=c.getAngle(this.rotation()),s=null!=(t=this.attrs.scaleX)?t:1,o=null!=(e=this.attrs.scaleY)?e:1,h=this.attrs.skewX||0,l=this.attrs.skewY||0,d=this.attrs.offsetX||0,u=this.attrs.offsetY||0;return(0!==r||0!==n)&&i.translate(r,n),0!==a&&i.rotate(a),(0!==h||0!==l)&&i.skew(h,l),(1!==s||1!==o)&&i.scale(s,o),(0!==d||0!==u)&&i.translate(-1*d,-1*u),i.dirty=!1,i}clone(t){let e=C.cloneObject(this.attrs),i,r,n,a,s;for(i in t)e[i]=t[i];let o=new this.constructor(e);for(i in this.eventListeners)for(n=(r=this.eventListeners[i]).length,a=0;a<n;a++)0>(s=r[a]).name.indexOf("konva")&&(o.eventListeners[i]||(o.eventListeners[i]=[]),o.eventListeners[i].push(s));return o}_toKonvaCanvas(t){t=t||{};let e=this.getClientRect(),i=this.getStage(),r=void 0!==t.x?t.x:Math.floor(e.x),n=void 0!==t.y?t.y:Math.floor(e.y),a=t.pixelRatio||1,s=new G({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:a}),o=s.getContext(),h=new G({width:s.width/s.pixelRatio+Math.abs(r),height:s.height/s.pixelRatio+Math.abs(n),pixelRatio:s.pixelRatio});return!1===t.imageSmoothingEnabled&&(o._context.imageSmoothingEnabled=!1),o.save(),(r||n)&&o.translate(-1*r,-1*n),this.drawScene(s,void 0,h),o.restore(),s}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){let e=(t=t||{}).mimeType||null,i=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(r),r}toImage(t){return new Promise((e,i)=>{try{let i=null==t?void 0:t.callback;i&&delete t.callback,C._urlToImage(this.toDataURL(t),function(t){e(t),null==i||i(t)})}catch(t){i(t)}})}toBlob(t){return new Promise((e,i)=>{try{let i=null==t?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(t=>{e(t),null==i||i(t)},null==t?void 0:t.mimeType,null==t?void 0:t.quality)}catch(t){i(t)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():c.dragDistance}_off(t,e,i){let r=this.eventListeners[t],n,a,s;for(n=0;n<r.length;
14n++)if(a=r[n].name,s=r[n].handler,("konva"!==a||"konva"===e)&&(!e||a===e)&&(!i||i===s)){if(r.splice(n,1),0===r.length){delete this.eventListeners[t];break}n--}}_fireChangeEvent(t,e,i){this._fire(t+"Change",{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){let e=this.name();this.name(e?e+" "+t:t)}return this}hasName(t){if(!t)return!1;let e=this.name();return!!e&&-1!==(e||"").split(/\s/g).indexOf(t)}removeName(t){let e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return -1!==i&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(t,e){let i=this["set"+C._capitalize(t)];return C._isFunction(i)?i.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(c.autoDrawEnabled){let t=this.getLayer()||this.getStage();null==t||t.batchDraw()}}_setAttr(t,e){let i=this.attrs[t];(i!==e||C.isObject(e))&&(null==e?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,i,e),this._requestDraw())}_setComponentAttr(t,e,i){let r;void 0!==i&&((r=this.attrs[t])||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,r,i))}_fireAndBubble(t,e,i){e&&this.nodeType===$&&(e.target=this);let r=["mouseenter","mouseleave","pointerenter","pointerleave","touchenter","touchleave"];if(!(-1!==r.indexOf(t)&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||"Stage"===this.nodeType&&!i))){this._fire(t,e);let n=-1!==r.indexOf(t)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!n&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,i;let{nodeType:r}=this,n=te.protoListenerMap.get(r)||{},a=null==n?void 0:n[t];if(void 0===a){a=[];let s=Object.getPrototypeOf(this);for(;s;){let r=null!=(i=null==(e=s.eventListeners)?void 0:e[t])?i:[];a.push(...r),s=Object.getPrototypeOf(s)}n[t]=a,te.protoListenerMap.set(r,n)}return a}_fire(t,e){(e=e||{}).currentTarget=this,e.type=t;let i=this._getProtoListeners(t);if(i){let t=i.slice();for(let i=0;i<t.length;i++)t[i].handler.call(this,e)}let r=this.eventListeners[t];if(r){let i=r.slice(),n=i.length;for(let t=0;t<i.length;t++)i[t].handler.call(this,e);let a=this.eventListeners[t];if(a)for(let t=n;t<a.length;t++)a[t].handler.call(this,e)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){let e=t?t.pointerId:void 0,i=this.getStage(),r=this.getAbsolutePosition();if(!i)return;let n=i._getPointerById(e)||i._changedPointerPositions[0]||r;L._dragElements.set(this._id,{node:this,startPointerPos:n,offset:{x:n.x-r.x,y:n.y-r.y},dragStatus:"ready",pointerId:e,startEvent:t})}startDrag(t,e=!0){L._dragElements.has(this._id)||this._createDragElement(t);let i=L._dragElements.get(this._id);i.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:i.startEvent&&i.startEvent.evt||t&&t.evt},e)}_setDragPosition(t,e){let i=this.getStage()._getPointerById(e.pointerId);if(!i)return;let r={x:i.x-e.offset.x,y:i.y-e.offset.y},n=this.dragBoundFunc();if(void 0!==n){let e=n.call(this,r,t);e?r=e:C.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){let e=L._dragElements.get(this._id);e&&(e.dragStatus="stopped"),L._endDragBefore(t),L._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){let t=L._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||c.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let e=!1;L._dragElements.forEach(t=>{this.isAncestorOf(t.node)&&(e=!0)}),e||this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let t=L._dragElements.get(this._id),e=t&&"dragging"===t.dragStatus,i=t&&"ready"===t.dragStatus;
14e?this.stopDrag():i&&L._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){let e=this.getStage();if(!e)return!1;let i={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return C.haveIntersection(i,this.getClientRect())}static create(t,e){return C._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){let i=te.prototype.getClassName.call(t),r=t.children,n,a,s;if(e&&(t.attrs.container=e),c[i]||(C.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape"),n=new c[i](t.attrs),r)for(a=r.length,s=0;s<a;s++)n.add(te._createNode(r[s]));return n}}te.protoListenerMap=new Map,te.prototype.nodeType="Node",te.prototype._attrsAffectingSize=[],te.prototype.eventListeners={},te.prototype.on("xChange.konva yChange.konva scaleXChange.konva scaleYChange.konva skewXChange.konva skewYChange.konva rotationChange.konva offsetXChange.konva offsetYChange.konva transformsEnabledChange.konva",function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Q),this._clearSelfAndDescendantCache(U)}),te.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(Z)}),te.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(V)}),te.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(j)});let ti=Y.addGetterSetter;ti(te,"zIndex"),ti(te,"absolutePosition"),ti(te,"position"),ti(te,"x",0,F()),ti(te,"y",0,F()),ti(te,"globalCompositeOperation","source-over",H()),ti(te,"opacity",1,F()),ti(te,"name","",H()),ti(te,"i
14d","",H()),ti(te,"rotation",0,F()),Y.addComponentsGetterSetter(te,"scale",["x","y"]),ti(te,"scaleX",1,F()),ti(te,"scaleY",1,F()),Y.addComponentsGetterSetter(te,"skew",["x","y"]),ti(te,"skewX",0,F()),ti(te,"skewY",0,F()),Y.addComponentsGetterSetter(te,"offset",["x","y"]),ti(te,"offsetX",0,F()),ti(te,"offsetY",0,F()),ti(te,"dragDistance",void 0,F()),ti(te,"width",0,F()),ti(te,"height",0,F()),ti(te,"listening",!0,W()),ti(te,"preventDefault",!0,W()),ti(te,"filters",void 0,function(t){return this._filterUpToDate=!1,t}),ti(te,"visible",!0,W()),ti(te,"transformsEnabled","all",H()),ti(te,"size"),ti(te,"dragBoundFunc"),ti(te,"draggable",!1,W()),Y.backCompat(te,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class tr extends te{constructor(){super(...arguments),this.children=[]}getChildren(t){let e=this.children||[];return t?e.filter(t):e}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}
14destroyChildren(){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}let e=t[0];return e.getParent()?e.moveTo(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){let e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){let i=[];return this._descendants(r=>{let n=r._isMatch(t);return n&&i.push(r),!!n&&!!e}),i}_descendants(t){for(let e of this.getChildren())if(t(e)||e.hasChildren()&&e._descendants(t))return!0;return!1}toObject(){let t=te.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){let e=te.prototype.clone.call(this,t);
14return this.getChildren().forEach(function(t){e.add(t.clone())}),e}getAllIntersections(t){let e=[];return this.find("Shape").forEach(i=>{i.isVisible()&&i.intersects(t)&&e.push(i)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null==(e=this.children)||e.forEach(function(e){e._clearSelfAndDescendantCache(t)})}_setChildrenIndices(){var t;null==(t=this.children)||t.forEach(function(t,e){t.index=e}),this._requestDraw()}drawScene(t,e,i){let r=this.getLayer(),n=t||r&&r.getCanvas(),a=n&&n.getContext(),s=this._getCanvasCache(),o=s&&s.scene,h=n&&n.isCache;if(!this.isVisible()&&!h)return this;if(o){a.save();let t=this.getAbsoluteTransform(e).getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",n,e,i);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;let i=this.getLayer(),r=t||i&&i.hitCanvas,n=r&&r.getContext(),a=this._getCanvasCache();if(a&&a.hit){n.save();let t=this.getAbsoluteTransform(e).getMatrix();n.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(n),n.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,i,r){var n;let a=e&&e.getContext(),s=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l="number"==typeof s&&"number"==typeof o||h,d=i===this;if(l){let t;a.save();let e=this.getAbsoluteTransform(i),r=e.getMatrix();if(a.transform(r[0],r[1],r[2],r[3],r[4],r[5]),a.beginPath(),h)t=h.call(this,a,this);else{let t=this.clipX(),e=this.clipY();a.rect(t||0,e||0,s,o)}a.clip.apply(a,t),r=e.copy().invert().getMatrix(),a.transform(r[0],r[1],r[2],r[3],r[4],r[5])}let c=!d&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;c&&(a.save(),a._applyGlobalCompositeOperation(this)),null==(n=this.children)||n.forEach(function(n){n[t](e,i,r)}),c&&a.restore(),l&&a.restore()}getClientRect(t={}){var e;let i,r,n,a,s=t.skipTransform,o=t.relativeTo,h={x:1/0,y:1/0,width:0,height:0},l=this;null==(e=this.children)||e.forEach(function(e){if(!e.visible())return;let s=e.getClientRect({relativeTo:l,skipShadow:t.skipShadow,skipStroke:t.skipStroke});(0!==s.width||0!==s.height)&&(void 0===i?(i=s.x,r=s.y,n=s.x+s.width,a=s.y+s.height):(i=Math.min(i,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x+s.width),a=Math.max(a,s.y+s.height)))});let d=this.find("Shape"),c=!1;for(let t=0;t<d.length;t++)if(d[t]._isVisible(this)){c=!0;break}return(h=c&&void 0!==i?{x:i,y:r,width:n-i,height:a-r}:{x:0,y:0,width:0,height:0},s)?h:this._transformedRect(h,o)}}Y.addComponentsGetterSetter(tr,"clip",["x","y","width","height"]),Y.addGetterSetter(tr,"clipX",void 0,F()),Y.addGetterSetter(tr,"clipY",void 0,F()),Y.addGetterSetter(tr,"clipWidth",void 0,F()),Y.addGetterSetter(tr,"clipHeight",void 0,F()),Y.addGetterSetter(tr,"clipFunc");let tn=new Map,ta=void 0!==c._global.PointerEvent;function ts(t){return{evt:t,pointerId:t.pointerId}}function to(t,e){th(t),e.getStage()&&(tn.set(t,e),ta&&e._fire("gotpointercapture",ts(new PointerEvent("gotpointercapture"))))}function th(t,e){let i=tn.get(t);if(!i)return;let r=i.getStage();r&&r.content,tn.delete(t),ta&&i._fire("lostpointercapture",ts(new PointerEvent("lostpointercapture")))}let tl="mouseleave",td="mouseover",tc="mouseenter",tu="mousemove",tg="mousedown",tf="mouseup",tp="pointermove",tm="pointerdown",t_="pointerup",ty="pointercancel",tv="pointerout",tx="pointerleave",tb="pointerover",tS="pointerenter",tw="contextmenu",tC="touchstart",tk="touchend",tP="touchmove",tT="touchcancel",tA="wheel",tM=[[tc,"_pointerenter"],[tg,"_pointerdown"],[tu,"_pointermove"],[tf,"_pointerup"],[tl,"_pointerleave"],[tC,"_pointerdown"],[tP,"_pointermove"],[tk,"_pointerup"],[tT,"_pointercancel"],[td,"_pointerover"],[tA,"_wheel"],[tw,"_contextmenu"],[tm,"_pointerdown"],[tp,"_pointermove"],[t_,"_pointerup"],[ty,"_pointercancel"],[tx,"_pointerleave"],["lostpointercapture","_lostpointercapture"]],tR={[tv]:"mouseout",[tx]:tl,[tb]:td,[tS]:tc,[tp]:tu,[tm]:tg,[t_]:tf,[ty]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},tE={[tv]:"touchout",[tx]:"touchleave",[tb]:"touchover",[tS]:"touchenter",[tp]:tP,[tm]:tC,[t_]:tk,[ty]:tT,pointerclick:"tap",pointerdblclick:"dbltap"},tG={[tv]:tv,[tx]:tx,[tb]:tb,[tS]:tS,[tp]:tp,[tm]:tm,[t_]:t_,[ty]:ty,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"},tD=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",tL=t=>{let e=tD(t);
14return"pointer"===e?c.pointerEventsEnabled&&tG:"touch"===e?tE:"mouse"===e?tR:void 0};function tI(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&C.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}let tO=[];class tF extends tr{constructor(t){super(tI(t)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),tO.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{tI(this.attrs)}),this._checkVisibility()}_validateAdd(t){let e="Layer"===t.getType(),i="FastLayer"===t.getType();e||i||C.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;let t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if("string"==typeof t){let e;if("."===t.charAt(0)){let e=t.slice(1);t=document.getElementsByClassName(e)[0]}else e="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(e);if(!t)throw"Can not find container in document with id "+e}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let t=this.children,e=t.length;for(let i=0;i<e;i++)t[i].clear();return this}clone(t){return t||(t={}),t.container="u">typeof document&&document.createElement("div"),tr.prototype.clone.call(this,t)}destroy(){super.destroy();let t=this.content;t&&C._isInDocument(t)&&this.container().removeChild(t);let e=tO.indexOf(this);return e>-1&&tO.splice(e,1),C.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(C.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();let e=new G({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),i=e.getContext()._context,r=this.children;return(t.x||t.y)&&i.translate(-1*t.x,-1*t.y),r.forEach(function(e){if(!e.isVisible())return;let r=e._toKonvaCanvas(t);i.drawImage(r._canvas,t.x,t.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}),e}getIntersection(t){if(!t)return null;let e=this.children,i=e.length-1;for(let r=i;r>=0;r--){let i=e[r].getIntersection(t);if(i)return i}return null}_resizeDOM(){let t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach(i=>{i.setSize({width:t,height:e}),i.draw()})}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}super.add(t);let e=this.children.length;return e>5&&C.warn("The stage has "+e+" 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(),c.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return tn.get(t)===this}setPointerCapture(t){to(t,this)}releaseCapture(t){th(t,this)}getLayers(){return this.children}_bindContentEvents(){c.isBrowser&&tM.forEach(([t,e])=>{this.content.addEventListener(t,t=>{this[e](t)},{passive:!1})})}_pointerenter(t){this.setPointersPositions(t);let e=tL(t.type);e&&this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);let e=tL(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){let e=tL(t.type),i=tD(t.type);if(!e)return;this.setPointersPositions(t);let r=this._getTargetShape(i),n=!(c.isDragging()||c.isTransforming())||c.hitOnDragEnabled;r&&n?(r._fireAndBubble(e.pointerout,{evt:t}),r._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[i+"targetShape"]=null):n&&(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){let e=tL(t.type),i=tD(t.type);if(!e)return;this.setPointersPositions(t);let r=!1;this._changedPointerPositions.forEach(n=>{let a=this.getIntersection(n);if(L.justDragged=!1,c["_"+i+"ListenClick"]=!0,!a||!a.isListening()){this[i+"ClickStartShape"]=void 0;return}c.capturePointerEventsEnabled&&a.setPointerCapture(n.id),this[i+"ClickStartShape"]=a,a._fireAndBubble(e.pointerdown,{evt:t,pointerId:n.id}),r=!0;let s=t.type.indexOf("touch")>=0;a.preventDefault()&&t.cancelable&&s&&t.preventDefault()}),r||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(t){let e=tL(t.type),i=tD(t.type);if(!e)return;let r=t.type.indexOf("touch")>=0||"touch"===t.pointerType;if(c.isDragging()&&L.node.preventDefault()&&t.cancelable&&r&&t.preventDefault(),this.setPointersPositions(t),!(!(c.isDragging()||c.isTransforming())||c.hitOnDragEnabled))return;let n={},a=!1,s=this._getTargetShape(i);this._changedPointerPositions.forEach(r=>{var o;let h=(o=r.id,tn.get(o)||this.getIntersection(r)),l=r.id,d={evt:t,pointerId:l},c=s!==h;if(c&&s&&(s._fireAndBubble(e.pointerout,{...d},h),s._fireAndBubble(e.pointerleave,{...d},h)),h){if(n[h._id])return;n[h._id]=!0}h&&h.isListening()?(a=!0,c&&(h._fireAndBubble(e.pointerover,{...d},s),h._fireAndBubble(e.pointerenter,{...d},s),this[i+"targetShape"]=h),h._fireAndBubble(e.pointermove,{...d})):s&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:l}),this[i+"targetShape"]=null)}),a||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){let e=tL(t.type),i=tD(t.type);if(!e)return;this.setPointersPositions(t);let r=this[i+"ClickStartShape"],n=this[i+"ClickEndShape"],a={},s=!1;this._changedPointerPositions.forEach(o=>{var h;let l=(h=o.id,tn.get(h)||this.getIntersection(o));if(l){if(l.releaseCapture(o.id),a[l._id])return;a[l._id]=!0}let d=o.id,u={evt:t,pointerId:d},g=!1;c["_"+i+"InDblClickWindow"]?(g=!0,clearTimeout(this[i+"DblTimeout"])):L.justDragged||(c["_"+i+"InDblClickWindow"]=!0,clearTimeout(this[i+"DblTimeout"])),this[i+"DblTimeout"]=setTimeout(function(){c["_"+i+"InDblClickWindow"]=!1}
14,c.dblClickWindow),l&&l.isListening()?(s=!0,this[i+"ClickEndShape"]=l,l._fireAndBubble(e.pointerup,{...u}),c["_"+i+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(e.pointerclick,{...u}),g&&n&&n===l&&l._fireAndBubble(e.pointerdblclick,{...u}))):(this[i+"ClickEndShape"]=null,s||(this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s=!0),c["_"+i+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:d}),g&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:d}))}),s||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),c["_"+i+"ListenClick"]=!1,t.cancelable&&"touch"!==i&&"pointer"!==i&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);let e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(tw,{evt:t}):this._fire(tw,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);let e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(tA,{evt:t}):this._fire(tA,{evt:t,target:this,currentTarget:this})}_pointercancel(t){var e;this.setPointersPositions(t);let i=(e=t.pointerId,tn.get(e)||this.getIntersection(this.getPointerPosition()));i&&i._fireAndBubble(t_,ts(t)),th(t.pointerId)}_lostpointercapture(t){th(t.pointerId)}setPointersPositions(t){let e=this._getContentPosition(),i=null,r=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,t=>{this._pointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})}),Array.prototype.forEach.call(t.changedTouches||t.touches,t=>{this._changedPointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})})):(i=(t.clientX-e.left)/e.scaleX,r=(t.clientY-e.top)/e.scaleY,this.pointerPos={x:i,y:r},this._pointerPositions=[{x:i,y:r,id:C._getFirstPointerId(t)}],this._changedPointerPositions=[{x:i,y:r,id:C._getFirstPointerId(t)}])}_setPointerPosition(t){C.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};let 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 G({width:this.width(),height:this.height()}),this.bufferHitCanvas=new D({pixelRatio:1,width:this.width(),height:this.height()}),!c.isBrowser)return;let 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 C.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}
14batchDraw(){return this.getChildren().forEach(function(t){t.batchDraw()}),this}}tF.prototype.nodeType="Stage",u(tF),Y.addGetterSetter(tF,"container"),c.isBrowser&&document.addEventListener("visibilitychange",()=>{tO.forEach(t=>{t.batchDraw()})});let tB="hasShadow",tN="shadowRGBA",tH="patternImage",tz="linearGradient",tW="radialGradient";function tY(){return n||(n=C.createCanvasElement().getContext("2d"))}let tj={};class tX extends te{constructor(t){let e;super(t);let i=0;for(;!(e=C.getHitColor())||e in tj;)if(++i>=1e4){C.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),e=C.getRandomColor();break}this.colorKey=e,tj[e]=this}getContext(){return C.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return C.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(tB,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(tH,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let t=tY().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(t&&t.setTransform){let e=new p;e.translate(this.fillPatternX(),this.fillPatternY()),e.rotate(c.getAngle(this.fillPatternRotation())),e.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),e.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let i=e.getMatrix(),r="u"<typeof DOMMatrix?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);t.setTransform(r)}return t}}_getLinearGradient(){return this._getCache(tz,this.__getLinearGradient)}__getLinearGradient(){let t=this.fillLinearGradientColorStops();if(t){let e=tY(),i=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),n=e.createLinearGradient(i.x,i.y,r.x,r.y);for(let e=0;e<t.length;e+=2)n.addColorStop(t[e],t[e+1]);return n}}_getRadialGradient(){return this._getCache(tW,this.__getRadialGradient)}__getRadialGradient(){let t=this.fillRadialGradientColorStops();if(t){let e=tY(),i=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),n=e.createRadialGradient(i.x,i.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let e=0;e<t.length;e+=2)n.addColorStop(t[e],t[e+1]);return n}}getShadowRGBA(){return this._getCache(tN,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let t=C.colorToRGBA(this.shadowColor());if(t)return"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")"}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(){let t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){let e=this.getStage();if(!e)return!1;let i=e.bufferHitCanvas;return i.getContext().clear(),this.drawHit(i,void 0,!0),i.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return te.prototype.destroy.call(this),delete tj[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!(null==(e=this.attrs.perfectDrawEnabled)||e))return!1;let i=t||this.hasFill(),r=this.hasStroke(),n=1!==this.getAbsoluteOpacity();if(i&&r&&n)return!0;let a=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!i&&!!r&&!!a&&!!s}setStrokeHitEnabled(t){C.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){let t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,i=this.getParent();for(;i;){if(i.isCached()){e=!0;break}i=i.getParent()}
14let r=t.skipTransform,n=t.relativeTo||e&&this.getStage()||void 0,a=this.getSelfRect(),s=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=a.width+s,h=a.height+s,l=!t.skipShadow&&this.hasShadow(),d=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,u=o+Math.abs(d),g=h+Math.abs(c),f=l&&this.shadowBlur()||0,p={width:u+2*f,height:g+2*f,x:-(s/2+f)+Math.min(d,0)+a.x,y:-(s/2+f)+Math.min(c,0)+a.y};return r?p:this._transformedRect(p,n)}drawScene(t,e,i){let r,n=this.getLayer(),a=(t||n.getCanvas()).getContext(),s=this._getCanvasCache(),o=this.getSceneFunc(),h=this.hasShadow(),l=e===this;if(!this.isVisible()&&!l)return this;if(s){a.save();let t=this.getAbsoluteTransform(e).getMatrix();return a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!o)return this;if(a.save(),this._useBufferCanvas()&&1){r=this.getStage();let t=i||r.bufferCanvas,n=t.getContext();i?(n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.restore()):n.clear(),n.save(),n._applyLineJoin(this),n._applyMiterLimit(this);let s=this.getAbsoluteTransform(e).getMatrix();n.transform(s[0],s[1],s[2],s[3],s[4],s[5]),o.call(this,n,this),n.restore();let d=t.pixelRatio;h&&a._applyShadow(this),l||(a._applyOpacity(this),a._applyGlobalCompositeOperation(this)),a.drawImage(t._canvas,t.x||0,t.y||0,t.width/d,t.height/d)}else{if(a._applyLineJoin(this),a._applyMiterLimit(this),!l){let t=this.getAbsoluteTransform(e).getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}h&&a._applyShadow(this),o.call(this,a,this)}
14return a.restore(),this}drawHit(t,e,i=!1){if(!this.shouldDrawHit(e,i))return this;let r=this.getLayer(),n=t||r.hitCanvas,a=n&&n.getContext(),s=this.hitFunc()||this.sceneFunc(),o=this._getCanvasCache(),h=o&&o.hit;if(this.colorKey||C.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();let 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(!s)return this;if(a.save(),a._applyLineJoin(this),a._applyMiterLimit(this),this!==e){let t=this.getAbsoluteTransform(e).getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return s.call(this,a,this),a.restore(),this}drawHitFromCache(t=0){let e=this._getCanvasCache(),i=this._getCachedSceneCanvas(),r=e.hit,n=r.getContext(),a=r.getWidth(),s=r.getHeight();n.clear(),n.drawImage(i._canvas,0,0,a,s);try{let e=n.getImageData(0,0,a,s),i=e.data,r=i.length,o=C._hexToRgb(this.colorKey);for(let e=0;e<r;e+=4)i[e+3]>t?(i[e]=o.r,i[e+1]=o.g,i[e+2]=o.b,i[e+3]=255):i[e+3]=0;n.putImageData(e,0,0)}catch(t){C.error("Unable to draw hit graph from cached scene canvas. "+t.message)}return this}hasPointerCapture(t){return tn.get(t)===this}setPointerCapture(t){to(t,this)}releaseCapture(t){th(t,this)}}tX.prototype._fillFunc=function(t){let e=this.attrs.fillRule;e?t.fill(e):t.fill()},tX.prototype._strokeFunc=function(t){t.stroke()},tX.prototype._fillFuncHit=function(t){let e=this.attrs.fillRule;e?t.fill(e):t.fill()},tX.prototype._strokeFuncHit=function(t){t.stroke()},tX.prototype._centroid=!1,tX.prototype.nodeType="Shape",u(tX),tX.prototype.eventListeners={},tX.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(tB)}),tX.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(tN)}),tX.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",function(){this._clearCache(tH)}),tX.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",function(){this._clearCache(tz)}),tX.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",function(){this._clearCache(tW)}),Y.addGetterSetter(tX,"stroke",void 0,z()),Y.addGetterSetter(tX,"strokeWidth",2,F()),Y.addGetterSetter(tX,"fillAfterStrokeEnabled",!1),Y.addGetterSetter(tX,"hitStrokeWidth","auto",N()),Y.addGetterSetter(tX,"strokeHitEnabled",!0,W()),Y.addGetterSetter(tX,"perfectDrawEnabled",!0,W()),Y.addGetterSetter(tX,"shadowForStrokeEnabled",!0,W()),Y.addGetterSetter(tX,"lineJoin"),Y.addGetterSetter(tX,"lineCap"),Y.addGetterSetter(tX,"miterLimit"),Y.addGetterSetter(tX,"sceneFunc"),Y.addGetterSetter(tX,"hitFunc"),Y.addGetterSetter(tX,"dash"),Y.addGetterSetter(tX,"dashOffset",0,F()),Y.addGetterSetter(tX,"shadowColor",void 0,H()),Y.addGetterSetter(tX,"shadowBlur",0,F()),Y.addGetterSetter(tX,"shadowOpacity",1,F()),Y.addComponentsGetterSetter(tX,"shadowOffset",["x","y"]),Y.addGetterSetter(tX,"shadowOffsetX",0,F()),Y.addGetterSetter(tX,"shadowOffsetY",0,F()),Y.addGetterSetter(tX,"fillPatternImage"),Y.addGetterSetter(tX,"fill",void 0,z()),Y.addGetterSetter(tX,"fillPatternX",0,F()),Y.addGetterSetter(tX,"fillPatternY",0,F()),Y.addGetterSetter(tX,"fillLinearGradientColorStops"),Y.addGetterSetter(tX,"strokeLinearGradientColorStops"),Y.addGetterSetter(tX,"fillRadialGradientStartRadius",0),Y.addGetterSetter(tX,"fillRadialGradientEndRadius",0),Y.addGetterSetter(tX,"fillRadialGradientColorStops"),Y.addGetterSetter(tX,"fillPatternRepeat","repeat"),Y.addGetterSetter(tX,"fillEnabled",!0),Y.addGetterSetter(tX,"strokeEnabled",!0),Y.addGetterSetter(tX,"shadowEnabled",!0),Y.addGetterSetter(tX,"dashEnabled",!0),Y.addGetterSetter(tX,"strokeScaleEnabled",!0),Y.addGetterSetter(tX,"fillPriority","color"),Y.addComponentsGetterSetter(tX,"fillPatternOffset",["x","y"]),Y.addGetterSetter(tX,"fillPatternOffsetX",0,F()),Y.addGetterSetter(tX,"fillPatternOffsetY",0,F()),Y.addComponentsGetterSetter(tX,"fillPatternScale",["x","y"]),Y.addGetterSetter(tX,"fillPatternScaleX",1,F()),Y.addGetterSetter(tX,"fillPatternScaleY",1,F()),Y.addComponentsGetterSetter(tX,"fillLinearGradientStartPoint",["x","y"]),Y.addComponentsGetterSetter(tX,"strokeLinearGradientStartPoint",["x","y"]),Y.addGetterSetter(tX,"fillLinearGradientStartPointX",0),Y.addGetterSetter(tX,"strokeLinearGradientStartPointX",0),Y.addGetterSetter(tX,"fillLinearGradientStartPointY",0),Y.addGetterSetter(tX,"strokeLinearGradientStartPointY",0),Y.addComponentsGetterSetter(tX,"fillLinearGradientEndPoint",["x","y"]),Y.addComponentsGetterSetter(tX,"strokeLinearGradientEndPoint",["x","y"]),Y.addGetterSetter(tX,"fillLinearGradientEndPointX",0),Y.addGetterSetter(tX,"strokeLinearGradientEndPointX",0),Y.addGetterSetter(tX,"fillLinearGradientEndPointY",0),Y.addGetterSetter(tX,"strokeLinearGradientEndPointY",0),Y.addComponentsGetterSetter(tX,"fillRadialGradientStartPoint",["x","y"]),Y.addGetterSetter(tX,"fillRadialGradientStartPointX",0),Y.addGetterSetter(tX,"fillRadialGradientStartPointY",0),Y.addComponentsGetterSetter(tX,"fillRadialGradientEndPoint",["x","y"]),Y.addGetterSetter(tX,"fillRadialGradientEndPointX",0),Y.addGetterSetter(tX,"fillRadialGradientEndPointY",0),Y.addGetterSetter(tX,"fillPatternRotation",0),Y.addGetterSetter(tX,"fillRule",void 0,H()),Y.backCompat(tX,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});let tU=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],tq=tU.length;class tK extends tr{constructor(t){super(t),this.canvas=new G,this.hitCanvas=new D({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}
14createPNGStream(){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);let 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(){te.prototype.moveToTop.call(this);let t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!te.prototype.moveUp.call(this))return!1;let 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(te.prototype.moveDown.call(this)){let t=this.getStage();if(t){let 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(te.prototype.moveToBottom.call(this)){let t=this.getStage();if(t){let 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(){let t=this.getNativeCanvasElement();return te.prototype.remove.call(this),t&&t.parentNode&&C._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){let e=t.getType();"Group"!==e&&"Shape"!==e&&C.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(),te.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){C.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){C.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,C.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;let e=1,i=!1;for(;;){for(let r=0;r<tq;r++){let n=tU[r],a=this._getIntersection({x:t.x+n.x*e,y:t.y+n.y*e}),s=a.shape;if(s)return s;if(i=!!a.antialiased,!a.antialiased)break}if(!i)return null;e+=1}}_getIntersection(t){let e=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=i[3];if(255===r){let t=tj[C.getHitColorKey(i[0],i[1],i[2])];return t?{shape:t}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(t,e,i){let r=this.getLayer(),n=t||r&&r.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&n.getContext().clear(),tr.prototype.drawScene.call(this,n,e,i),this._fire("draw",{node:this}),this}drawHit(t,e){let i=this.getLayer(),r=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),tr.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){C.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return C.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let t=this.parent;this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}destroy(){return C.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}tK.prototype.nodeType="Layer",u(tK),Y.addGetterSetter(tK,"imageSmoothingEnabled",!0),Y.addGetterSetter(tK,"clearBeforeDraw",!0),Y.addGetterSetter(tK,"hitGraphEnabled",!0,W());class tV extends tK{constructor(t){super(t),this.listening(!1),C.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}tV.prototype.nodeType="FastLayer",u(tV);class t$ extends tr{_validateAdd(t){let e=t.getType();"Group"!==e&&"Shape"!==e&&C.throw("You may only add groups and shapes to groups.")}}t$.prototype.nodeType="Group",u(t$);let tJ=d.performance&&d.performance.now?function(){return d.performance.now()}:function(){return new Date().getTime()};class tQ{constructor(t,e){this.id=tQ.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:tJ(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){let e=this.layers,i=e.length;for(let r=0;r<i;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){let t=tQ.animations,e=t.length;for(let i=0;i<e;i++)if(t[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=tJ(),tQ._addAnimation(this),this}stop(){return tQ._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){let e=t.id,i=this.animations,r=i.length;for(let t=0;t<r;t++)if(i[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){let t={},e=this.animations;for(let i=0;i<e.length;i++){let r=e[i],n=r.layers,a=r.func;r._updateFrameObject(tJ());let s=n.length;if(!a||!1!==a.call(r,r.frame))for(let e=0;e<s;e++){let i=n[e];void 0!==i._id&&(t[i._id]=i)}}for(let e in t)t.hasOwnProperty(e)&&t[e].batchDraw()}static _animationLoop(){tQ.animations.length?(tQ._runFrames(),C.requestAnimFrame
14(tQ._animationLoop)):tQ.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,C.requestAnimFrame(this._animationLoop))}}tQ.animations=[],tQ.animIdCounter=0,tQ.animRunning=!1;let tZ={node:1,duration:1,easing:1,onFinish:1,yoyo:1},t0=["fill","stroke","shadowColor"],t1=0;class t2{constructor(t,e,i,r,n,a,s){this.prop=t,this.propFunc=e,this.begin=r,this._pos=r,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=n-this.begin,this.pause()}fire(t){let 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(){let 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 t5{constructor(t){let e,i;const r=this,n=t.node,a=n._id,s=t.easing||t3.Linear,o=!!t.yoyo;e=void 0===t.duration?.3:0===t.duration?.001:t.duration,this.node=n,this._id=t1++;const h=n.getLayer()||(n instanceof c.Stage?n.getLayers():null);for(i in h||C.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new tQ(function(){r.tween.onEnterFrame()},h),this.tween=new t2(i,function(t){r._tweenFunc(t)},s,0,1,1e3*e,o),this._addListeners(),t5.attrs[a]||(t5.attrs[a]={}),t5.attrs[a][this._id]||(t5.attrs[a][this._id]={}),t5.tweens[a]||(t5.tweens[a]={}),t)void 0===tZ[i]&&this._addAttr(i,t[i]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,e){let i,r,n,a,s,o=this.node,h=o._id,l=t5.tweens[h][t];l&&delete t5.attrs[h][l][t];let d=o.getAttr(t);if(C._isArray(e))if(i=[],r=Math.max(e.length,d.length),"points"===t&&e.length!==d.length&&(e.length>d.length?(a=d,d=C._prepareArrayForTween(d,e,o.closed())):(n=e,e=C._prepareArrayForTween(e,d,o.closed()))),0===t.indexOf("fill"))for(let t=0;t<r;t++)if(t%2==0)i.push(e[t]-d[t]);else{let r=C.colorToRGBA(d[t]);s=C.colorToRGBA(e[t]),d[t]=r,i.push({r:s.r-r.r,g:s.g-r.g,b:s.b-r.b,a:s.a-r.a})}else for(let t=0;t<r;t++)i.push(e[t]-d[t]);else -1!==t0.indexOf(t)?(d=C.colorToRGBA(d),i={r:(s=C.colorToRGBA(e)).r-d.r,g:s.g-d.g,b:s.b-d.b,a:s.a-d.a}):i=e-d;t5.attrs[h][this._id][t]={start:d,diff:i,end:e,trueEnd:n,trueStart:a},t5.tweens[h][t]=this._id}_tweenFunc(t){let e,i,r,n,a,s,o,h,l=this.node,d=t5.attrs[l._id][this._id];for(e in d){if(r=(i=d[e]).start,n=i.diff,h=i.end,C._isArray(r))if(a=[],o=Math.max(r.length,h.length),0===e.indexOf("fill"))for(s=0;s<o;s++)s%2==0?a.push((r[s]||0)+n[s]*t):a.push("rgba("+Math.round(r[s].r+n[s].r*t)+","+Math.round(r[s].g+n[s].g*t)+","+Math.round(r[s].b+n[s].b*t)+","+(r[s].a+n[s].a*t)+")");else for(s=0;s<o;s++)a.push((r[s]||0)+n[s]*t);else a=-1!==t0.indexOf(e)?"rgba("+Math.round(r.r+n.r*t)+","+Math.round(r.g+n.g*t)+","+Math.round(r.b+n.b*t)+","+(r.a+n.a*t)+")":r+n*t;l.setAttr(e,a)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let t=this.node,e=t5.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=()=>{let t=this.node,e=t5.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.points.trueStart),this.onReset&&this.onReset()}
14,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(){let t=this.node._id,e=this._id,i=t5.tweens[t];for(let e in this.pause(),this.anim&&this.anim.stop(),i)delete t5.tweens[t][e];delete t5.attrs[t][e],t5.tweens[t]&&(0===Object.keys(t5.tweens[t]).length&&delete t5.tweens[t],0===Object.keys(t5.attrs[t]).length&&delete t5.attrs[t])}}t5.attrs={},t5.tweens={},te.prototype.to=function(t){let e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new t5(t).play()};let t3={BackEaseIn:(t,e,i,r)=>i*(t/=r)*t*(2.70158*t-1.70158)+e,BackEaseOut:(t,e,i,r)=>i*((t=t/r-1)*t*(2.70158*t+1.70158)+1)+e,BackEaseInOut(t,e,i,r){let n=1.70158;return(t/=r/2)<1?i/2*(t*t*(((n*=1.525)+1)*t-n))+e:i/2*((t-=2)*t*(((n*=1.525)+1)*t+n)+2)+e},ElasticEaseIn(t,e,i,r,n,a){let s=0;return 0===t?e:1==(t/=r)?e+i:(a||(a=.3*r),!n||n<Math.abs(i)?(n=i,s=a/4):s=a/(2*Math.PI)*Math.asin(i/n),-(n*Math.pow(2,10*(t-=1))*Math.sin(2*Math.PI*(t*r-s)/a))+e)},ElasticEaseOut(t,e,i,r,n,a){let s=0;return 0===t?e:1==(t/=r)?e+i:(a||(a=.3*r),!n||n<Math.abs(i)?(n=i,s=a/4):s=a/(2*Math.PI)*Math.asin(i/n),n*Math.pow(2,-10*t)*Math.sin(2*Math.PI*(t*r-s)/a)+i+e)},ElasticEaseInOut(t,e,i,r,n,a){let s=0;return 0===t?e:2==(t/=r/2)?e+i:(a||(a=.3*1.5*r),!n||n<Math.abs(i)?(n=i,s=a/4):s=a/(2*Math.PI)*Math.asin(i/n),t<1)?-.5*(n*Math.pow(2,10*(t-=1))*Math.sin(2*Math.PI*(t*r-s)/a))+e:n*Math.pow(2,-10*(t-=1))*Math.sin(2*Math.PI*(t*r-s)/a)*.5+i+e},BounceEaseOut:(t,e,i,r)=>(t/=r)<1/2.75?7.5625*t*t*i+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(t,e,i,r)=>i-t3.BounceEaseOut(r-t,0,i,r)+e,BounceEaseInOut:(t,e,i,r)=>t<r/2?.5*t3.BounceEaseIn(2*t,0,i,r)+e:.5*t3.BounceEaseOut(2*t-r,0,i,r)+.5*i+e,EaseIn:(t,e,i,r)=>i*(t/=r)*t+e,EaseOut:(t,e,i,r)=>-i*(t/=r)*(t-2)+e,EaseInOut:(t,e,i,r)=>(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,i,r)=>i*(t/=r)*t*t*t*t+e,StrongEaseOut:(t,e,i,r)=>i*((t=t/r-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,i,r)=>(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,i,r)=>i*t/r+e},t4=C._assign(c,{Util:C,Transform:p,Node:te,Container:tr,Stage:tF,stages:tO,Layer:tK,FastLayer:tV,Group:t$,DD:L,Shape:tX,shapes:tj,Animation:tQ,Tween:t5,Easings:t3,Context:A,Canvas:E});class t8 extends tX{_sceneFunc(t){let e=c.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(){let t=this.innerRadius(),e=this.outerRadius(),i=this.clockwise(),r=c.getAngle(i?360-this.angle():this.angle()),n=Math.cos(Math.min(r,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),s=Math.sin(Math.min(r,Math.PI/2)),o=n*(n>0?t:e),h=a*(a>0?t:e),l=s*(s>0?e:t);return{x:o,y:i?-1*l:h,width:e-o,height:l-h}}}function t6(t,e,i,r,n,a,s){let o=Math.sqrt(Math.pow(i-t,2)+Math.pow(r-e,2)),h=Math.sqrt(Math.pow(n-i,2)+Math.pow(a-r,2)),l=s*o/(o+h),d=s*h/(o+h);return[i-l*(n-t),r-l*(a-e),i+d*(n-t),r+d*(a-e)]}function t9(t,e){let i=t.length,r=[];for(let n=2;n<i-2;n+=2){let i=t6(t[n-2],t[n-1],t[n],t[n+1],t[n+2],t[n+3],e);isNaN(i[0])||(r.push(i[0]),r.push(i[1]),r.push(t[n]),r.push(t[n+1]),r.push(i[2]),r.push(i[3]))}return r}t8.prototype._centroid=!0,t8.prototype.className="Arc",t8.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],u(t8),Y.addGetterSetter(t8,"innerRadius",0,F()),Y.addGetterSetter(t8,"outerRadius",0,F()),Y.addGetterSetter(t8,"angle",0,F()),Y.addGetterSetter(t8,"clockwise",!1,W());class t7 extends tX{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){let e=this.points(),i=e.length,r=this.tension(),n=this.closed(),a=this.bezier();if(!i)return;let s=0;if(t.beginPath(),t.moveTo(e[0],e[1]),0!==r&&i>4){let r=this.getTensionPoints(),a=r.length;for(s=4*!n,n||t.quadraticCurveTo(r[0],r[1],r[2],r[3]);s<a-2;)t.bezierCurveTo(r[s++],r[s++],r[s++],r[s++],r[s++],r[s++]);n||t.quadraticCurveTo(r[a-2],r[a-1],e[i-2],e[i-1])}else if(a)for(s=2;s<i;)t.bezierCurveTo(e[s++],e[s++],e[s++],e[s++],e[s++],e[s++]);else for(s=2;s<i;s+=2)t.lineTo(e[s],e[s+1]);n?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():t9(this.points(),this.tension())}_getTensionPointsClosed(){let t=this.points(),e=t.length,i=this.tension(),r=t6(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),n=t6(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),a=t9(t,i);
14return[r[2],r[3]].concat(a).concat([n[0],n[1],t[e-2],t[e-1],n[2],n[3],r[0],r[1],t[0],t[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let t,e,i=this.points();if(i.length<4)return{x:i[0]||0,y:i[1]||0,width:0,height:0};let r=(i=0!==this.tension()?[i[0],i[1],...this._getTensionPoints(),i[i.length-2],i[i.length-1]]:this.bezier()?[i[0],i[1],...function(t){let e=[[t[0],t[2],t[4],t[6]],[t[1],t[3],t[5],t[7]]],i=[];for(let t of e){let e=-3*t[0]+9*t[1]-9*t[2]+3*t[3];if(0!==e){let r=6*t[0]-12*t[1]+6*t[2],n=r*r-4*e*(-3*t[0]+3*t[1]);if(n>=0){let t=Math.sqrt(n);i.push((-r+t)/(2*e)),i.push((-r-t)/(2*e))}}}return i.filter(t=>t>0&&t<1).flatMap(t=>e.map(e=>{let i=1-t;return i*i*i*e[0]+3*i*i*t*e[1]+3*i*t*t*e[2]+t*t*t*e[3]}))}(this.points()),i[i.length-2],i[i.length-1]]:this.points())[0],n=i[0],a=i[1],s=i[1];for(let o=0;o<i.length/2;o++)t=i[2*o],e=i[2*o+1],r=Math.min(r,t),n=Math.max(n,t),a=Math.min(a,e),s=Math.max(s,e);return{x:r,y:a,width:n-r,height:s-a}}}t7.prototype.className="Line",t7.prototype._attrsAffectingSize=["points","bezier","tension"],u(t7),Y.addGetterSetter(t7,"closed",!1),Y.addGetterSetter(t7,"bezier",!1),Y.addGetterSetter(t7,"tension",0,F()),Y.addGetterSetter(t7,"points",[],function(){if(c.isUnminified)return function(t,e){let i=Int8Array?Object.getPrototypeOf(Int8Array):null;return i&&t instanceof i||(C._isArray(t)?t.forEach(function(t){C._isNumber(t)||C.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}
14):C.warn(I(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}());let et=[[],[],[-.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,
14-.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]],ee=[[],[],[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,.122555206
1471147846,.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]],ei=[[1],[1,1],[1,2,1],[1,3,3,1]],er=(t,e,i)=>{let r,n,a=i/2;r=0;for(let i=0;i<20;i++)n=a*et[20][i]+a,r+=ee[20][i]*function(t,e,i){let r=ea(1,i,t),n=ea(1,i,e);return Math.sqrt(r*r+n*n)}(t,e,n);return a*r},en=(t,e,i)=>{void 0===i&&(i=1);let r=t[0]-2*t[1]+t[2],n=e[0]-2*e[1]+e[2],a=2*t[1]-2*t[0],s=2*e[1]-2*e[0],o=4*(r*r+n*n);if(0===o)return i*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));let h=4*(r*a+n*s)/(2*o),l=i+h,d=(a*a+s*s)/o-h*h,c=l*l+d>0?Math.sqrt(l*l+d):0,u=h*h+d>0?Math.sqrt(h*h+d):0,g=h+Math.sqrt(h*h+d)!==0?d*Math.log(Math.abs((l+c)/(h+u))):0;return Math.sqrt(o)/2*(l*c-h*u+g)},ea=(t,e,i)=>{let r,n,a=i.length-1;if(0===a)return 0;if(0===t){n=0;for(let t=0;t<=a;t++)n+=ei[a][t]*Math.pow(1-e,a-t)*Math.pow(e,t)*i[t];return n}r=Array(a);for(let t=0;t<a;t++)r[t]=a*(i[t+1]-i[t]);return ea(t-1,e,r)},es=(t,e,i)=>{let r=1,n=t/e,a=(t-i(n))/e,s=0;for(;r>.001;){let o=Math.abs(t-i(n+a))/e;if(o<r)r=o,n+=a;else{let s=Math.abs(t-i(n-a))/e;s<r?(r=s,n-=a):a/=2}if(++s>500)break}return n};class eo extends tX{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=eo.parsePathData(this.data()),this.pathLength=eo.getPathLength(this.dataArray)}_sceneFunc(t){let e=this.dataArray;t.beginPath();let i=!1;for(let r=0;r<e.length;r++){let n=e[r].command,a=e[r].points;switch(n){case"L":t.lineTo(a[0],a[1]);break;case"M":t.moveTo(a[0],a[1]);break;case"C":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":t.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":let s=a[0],o=a[1],h=a[2],l=a[3],d=a[4],c=a[5],u=a[6],g=a[7],f=h>l?h:l,p=h>l?1:h/l,m=h>l?l/h:1;t.translate(s,o),t.rotate(u),t.scale(p,m),t.arc(0,0,f,d,d+c,1-g),t.scale(1/p,1/m),t.rotate(-u),t.translate(-s,-o);break;case"z":i=!0,t.closePath()}}i||this.hasFill()?t.fillStrokeShape(this):t.strokeShape(this)}getSelfRect(){let t,e,i=[];this.dataArray.forEach(function(t){if("A"===t.command){let e=t.points[4],r=t.points[5],n=t.points[4]+r,a=Math.PI/180;
14if(Math.abs(e-n)<a&&(a=Math.abs(e-n)),r<0)for(let r=e-a;r>n;r-=a){let e=eo.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);i.push(e.x,e.y)}else for(let r=e+a;r<n;r+=a){let e=eo.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);i.push(e.x,e.y)}}else if("C"===t.command)for(let e=0;e<=1;e+=.01){let r=eo.getPointOnCubicBezier(e,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3],t.points[4],t.points[5]);i.push(r.x,r.y)}else i=i.concat(t.points)});let r=i[0],n=i[0],a=i[1],s=i[1];for(let o=0;o<i.length/2;o++)t=i[2*o],e=i[2*o+1],isNaN(t)||(r=Math.min(r,t),n=Math.max(n,t)),isNaN(e)||(a=Math.min(a,e),s=Math.max(s,e));return{x:r,y:a,width:n-r,height:s-a}}getLength(){return this.pathLength}getPointAtLength(t){return eo.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(let i=0;i<t.length;++i)e+=t[i].pathLength;return e}static getPointAtLengthOfDataArray(t,e){let i,r=0,n=e.length;if(!n)return null;for(;r<n&&t>e[r].pathLength;)t-=e[r].pathLength,++r;if(r===n)return{x:(i=e[r-1].points.slice(-2))[0],y:i[1]};if(t<.01)return"M"===e[r].command?{x:(i=e[r].points.slice(0,2))[0],y:i[1]}:{x:e[r].start.x,y:e[r].start.y};let a=e[r],s=a.points;switch(a.command){case"L":return eo.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return eo.getPointOnCubicBezier(es(t,eo.getPathLength(e),t=>er([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],t)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return eo.getPointOnQuadraticBezier(es(t,eo.getPathLength(e),t=>en([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],t)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":let o=s[0],h=s[1],l=s[2],d=s[3],c=s[5],u=s[6],g=s[4];return g+=c*t/a.pathLength,eo.getPointOnEllipticalArc(o,h,l,d,g,u)}return null}static getPointOnLine(t,e,i,r,n,a,s){a=null!=a?a:e,s=null!=s?s:i;let o=this.getLineLength(e,i,r,n);if(o<1e-10)return{x:e,y:i};if(r===e)return{x:a,y:s+(n>i?t:-t)};let h=(n-i)/(r-e),l=Math.sqrt(t*t/(1+h*h))*(r<e?-1:1);if(1e-10>Math.abs(s-i-h*(a-e)))return{x:a+l,y:s+h*l};let d=((a-e)*(r-e)+(s-i)*(n-i))/(o*o),c=e+d*(r-e),u=i+d*(n-i),g=this.getLineLength(a,s,c,u),f=Math.sqrt(t*t-g*g),p=Math.sqrt(f*f/(1+h*h))*(r<e?-1:1);return{x:c+p,y:u+h*p}}static getPointOnCubicBezier(t,e,i,r,n,a,s,o,h){function l(t){return 3*t*(1-t)*(1-t)}return{x:t*t*t*o+3*t*t*(1-t)*a+r*l(t)+(1-t)*(1-t)*(1-t)*e,y:t*t*t*h+3*t*t*(1-t)*s+n*l(t)+(1-t)*(1-t)*(1-t)*i}}static getPointOnQuadraticBezier(t,e,i,r,n,a,s){return{x:t*t*a+2*t*(1-t)*r+(1-t)*(1-t)*e,y:t*t*s+2*t*(1-t)*n+(1-t)*(1-t)*i}}static getPointOnEllipticalArc(t,e,i,r,n,a){let s=Math.cos(a),o=Math.sin(a),h={x:i*Math.cos(n),y:r*Math.sin(n)};return{x:t+(h.x*s-h.y*o),y:e+(h.x*o+h.y*s)}}static parsePathData(t){let e;if(!t)return[];let i=t,r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];i=i.replace(RegExp(" ","g"),",");for(let t=0;t<r.length;t++)i=i.replace(RegExp(r[t],"g"),"|"+r[t]);let n=i.split("|"),a=[],s=[],o=0,h=0,l=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(let t=1;t<n.length;t++){let i=n[t],r=i.charAt(0);for(i=i.slice(1),s.length=0;e=l.exec(i);)s.push(e[0]);let d=[],c="A"===r||"a"===r?0:-1;for(let t=0,e=s.length;t<e;t++){let e=s[t];if("00"===e){d.push(0,0),c>=0&&(c+=2)>=7&&(c-=7);continue}if(c>=0){if(3===c){if(/^[01]{2}\d+(?:\.\d+)?$/.test(e)){d.push(parseInt(e[0],10)),d.push(parseInt(e[1],10)),d.push(parseFloat(e.slice(2))),(c+=3)>=7&&(c-=7);continue}if("11"===e||"10"===e||"01"===e){d.push(parseInt(e[0],10)),d.push(parseInt(e[1],10)),(c+=2)>=7&&(c-=7);continue}if("0"===e||"1"===e){d.push(parseInt(e,10)),(c+=1)>=7&&(c-=7);continue}}else if(4===c){if(/^[01]\d+(?:\.\d+)?$/.test(e)){d.push(parseInt(e[0],10)),d.push(parseFloat(e.slice(1))),(c+=2)>=7&&(c-=7);continue}if("0"===e||"1"===e){d.push(parseInt(e,10)),(c+=1)>=7&&(c-=7);continue}}let t=parseFloat(e);isNaN(t)?d.push(0):d.push(t),(c+=1)>=7&&(c-=7)}else{let t=parseFloat(e);isNaN(t)?d.push(0):d.push(t)}}for(;d.length>0;){let t,e,i,n,s,l,c,u,g,f;if(isNaN(d[0]))break;let p="",m=[],_=o,y=h;switch(r){case"l":o+=d.shift(),h+=d.shift(),p="L",m.push(o,h);break;case"L":o=d.shift(),h=d.shift(),m.push(o,h);break;case"m":let v=d.shift(),x=d.shift();if(o+=v,h+=x,p="M",a.length>2&&"z"===a[a.length-1].command){for(let t=a.length-2;t>=0;t--)if("M"===a[t].command){o=a[t].points[0]+v,h=a[t].points[1]+x;break}}m.push(o,h),r="l";break;case"M":o=d.shift(),h=d.shift(),p="M",m.push(o,h),r="L";break;case"h":o+=d.shift(),p="L",m.push(o,h);break;case"H":o=d.shift(),p="L",m.push(o,h);break;case"v":h+=d.shift(),p="L",m.push(o,h);break;case"V":h=d.shift(),p="L",m.push(o,h);break;case"C":m.push(d.shift(),d.shift(),d.shift(),d.shift()),o=d.shift(),h=d.shift(),m.push(o,h);break;case"c":m.push(o+d.shift(),h+d.shift(),o+d.shift(),h+d.shift()),o+=d.shift(),h+=d.shift(),p="C",m.push(o,h);break;case"S":e=o,i=h,"C"===(t=a[a.length-1]).command&&(e=o+(o-t.points[2]),i=h+(h-t.points[3])),m.push(e,i,d.shift(),d.shift()),o=d.shift(),h=d.shift(),p="C",m.push(o,h);break;case"s":e=o,i=h,"C"===(t=a[a.length-1]).command&&(e=o+(o-t.points[2]),i=h+(h-t.points[3])),m.push(e,i,o+d.shift(),h+d.shift()),o+=d.shift(),h+=d.shift(),p="C",m.push(o,h);break;case"Q":m.push(d.shift(),d.shift()),o=d.shift(),h=d.shift(),m.push(o,h);break;
14case"q":m.push(o+d.shift(),h+d.shift()),o+=d.shift(),h+=d.shift(),p="Q",m.push(o,h);break;case"T":e=o,i=h,"Q"===(t=a[a.length-1]).command&&(e=o+(o-t.points[0]),i=h+(h-t.points[1])),o=d.shift(),h=d.shift(),p="Q",m.push(e,i,o,h);break;case"t":e=o,i=h,"Q"===(t=a[a.length-1]).command&&(e=o+(o-t.points[0]),i=h+(h-t.points[1])),o+=d.shift(),h+=d.shift(),p="Q",m.push(e,i,o,h);break;case"A":n=d.shift(),s=d.shift(),l=d.shift(),c=d.shift(),u=d.shift(),g=o,f=h,o=d.shift(),h=d.shift(),p="A",m=this.convertEndpointToCenterParameterization(g,f,o,h,c,u,n,s,l);break;case"a":n=d.shift(),s=d.shift(),l=d.shift(),c=d.shift(),u=d.shift(),g=o,f=h,o+=d.shift(),h+=d.shift(),p="A",m=this.convertEndpointToCenterParameterization(g,f,o,h,c,u,n,s,l)}a.push({command:p||r,points:m,start:{x:_,y:y},pathLength:this.calcLength(_,y,p||r,m)})}("z"===r||"Z"===r)&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,e,i,r){let n,a,s,o;switch(i){case"L":return eo.getLineLength(t,e,r[0],r[1]);case"C":return er([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return en([t,r[0],r[2]],[e,r[1],r[3]],1);case"A":n=0;let h=r[4],l=r[5],d=r[4]+l,c=Math.PI/180;if(Math.abs(h-d)<c&&(c=Math.abs(h-d)),a=eo.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),l<0)for(o=h-c;o>d;o-=c)s=eo.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),n+=eo.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(o=h+c;o<d;o+=c)s=eo.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),n+=eo.getLineLength(a.x,a.y,s.x,s.y),a=s;return s=eo.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],d,0),n+=eo.getLineLength(a.x,a.y,s.x,s.y)}return 0}static convertEndpointToCenterParameterization(t,e,i,r,n,a,s,o,h){let l=Math.PI/180*h,d=Math.cos(l)*(t-i)/2+Math.sin(l)*(e-r)/2,c=-1*Math.sin(l)*(t-i)/2+Math.cos(l)*(e-r)/2,u=d*d/(s*s)+c*c/(o*o);u>1&&(s*=Math.sqrt(u),o*=Math.sqrt(u));let g=Math.sqrt((s*s*(o*o)-s*s*(c*c)-o*o*(d*d))/(s*s*(c*c)+o*o*(d*d)));n===a&&(g*=-1),isNaN(g)&&(g=0);let f=g*s*c/o,p=-(g*o)*d/s,m=(t+i)/2+Math.cos(l)*f-Math.sin(l)*p,_=(e+r)/2+Math.sin(l)*f+Math.cos(l)*p,y=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},v=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(y(t)*y(e))},x=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(v(t,e))},b=x([1,0],[(d-f)/s,(c-p)/o]),S=[(d-f)/s,(c-p)/o],w=[(-1*d-f)/s,(-1*c-p)/o],C=x(S,w);return -1>=v(S,w)&&(C=Math.PI),v(S,w)>=1&&(C=0),0===a&&C>0&&(C-=2*Math.PI),1===a&&C<0&&(C+=2*Math.PI),[m,_,s,o,b,C,l,a]}}eo.prototype.className="Path",eo.prototype._attrsAffectingSize=["data"],u(eo),Y.addGetterSetter(eo,"data");class eh extends t7{_sceneFunc(t){let e,i;super._sceneFunc(t);let r=2*Math.PI,n=this.points(),a=n,s=0!==this.tension()&&n.length>4;s&&(a=this.getTensionPoints());let o=this.pointerLength(),h=n.length;if(s){let t=[a[a.length-4],a[a.length-3],a[a.length-2],a[a.length-1],n[h-2],n[h-1]],r=eo.calcLength(a[a.length-4],a[a.length-3],"C",t),s=eo.getPointOnQuadraticBezier(Math.min(1,1-o/r),t[0],t[1],t[2],t[3],t[4],t[5]);e=n[h-2]-s.x,i=n[h-1]-s.y}else e=n[h-2]-n[h-4],i=n[h-1]-n[h-3];let l=(Math.atan2(i,e)+r)%r,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(n[h-2],n[h-1]),t.rotate(l),t.moveTo(0,0),t.lineTo(-o,d/2),t.lineTo(-o,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(n[0],n[1]),s?(e=(a[0]+a[2])/2-n[0],i=(a[1]+a[3])/2-n[1]):(e=n[2]-n[0],i=n[3]-n[1]),t.rotate((Math.atan2(-i,-e)+r)%r),t.moveTo(0,0),t.lineTo(-o,d/2),t.lineTo(-o,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){let e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){let t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x,y:t.y-e,width:t.width,height:t.height+2*e}}}eh.prototype.className="Arrow",u(eh),Y.addGetterSetter(eh,"pointerLength",10,F()),Y.addGetterSetter(eh,"pointerWidth",10,F()),Y.addGetterSetter(eh,"pointerAtBeginning",!1),Y.addGetterSetter(eh,"pointerAtEnding",!0);class el extends tX{_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)}}el.prototype._centroid=!0,el.prototype.className="Circle",el.prototype._attrsAffectingSize=["radiu
14s"],u(el),Y.addGetterSetter(el,"radius",0,F());class ed extends tX{_sceneFunc(t){let e=this.radiusX(),i=this.radiusY();t.beginPath(),t.save(),e!==i&&t.scale(1,i/e),t.arc(0,0,e,0,2*Math.PI,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}ed.prototype.className="Ellipse",ed.prototype._centroid=!0,ed.prototype._attrsAffectingSize=["radiusX","radiusY"],u(ed),Y.addComponentsGetterSetter(ed,"radius",["x","y"]),Y.addGetterSetter(ed,"radiusX",0,F()),Y.addGetterSetter(ed,"radiusY",0,F());class ec extends tX{constructor(t){super(t),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",t=>{this._removeImageLoad(t.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let 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(){let t=!!this.cornerRadius(),e=this.hasShadow();return!!t&&!!e||super._useBufferCanvas(!0)}_sceneFunc(t){let e,i=this.getWidth(),r=this.getHeight(),n=this.cornerRadius(),a=this.attrs.image;if(a){let t=this.attrs.cropWidth,n=this.attrs.cropHeight;e=t&&n?[a,this.cropX(),this.cropY(),t,n,0,0,i,r]:[a,0,0,i,r]}(this.hasFill()||this.hasStroke()||n)&&(t.beginPath(),n?C.drawRoundedRectPath(t,i,r,n):t.rect(0,0,i,r),t.closePath(),t.fillStrokeShape(this)),a&&(n&&t.clip(),t.drawImage.apply(t,e))}_hitFunc(t){let e=this.width(),i=this.height(),r=this.cornerRadius();t.beginPath(),r?C.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e,i;return null!=(i=null!=(t=this.attrs.width)?t:null==(e=this.image())?void 0:e.width)?i:0}getHeight(){var t,e,i;return null!=(i=null!=(t=this.attrs.height)?t:null==(e=this.image())?void 0:e.height)?i:0}static fromURL(t,e,i=null){let r=C.createImageElement();r.onload=function(){e(new ec({image:r}))},r.onerror=i,r.crossOrigin="Anonymous",r.src=t}}ec.prototype.className="Image",ec.prototype._attrsAffectingSize=["image"],u(ec),Y.addGetterSetter(ec,"cornerRadius",0,B(4)),Y.addGetterSetter(ec,"image"),Y.addComponentsGetterSetter(ec,"crop",["x","y","width","height"]),Y.addGetterSetter(ec,"cropX",0,F()),Y.addGetterSetter(ec,"cropY",0,F()),Y.addGetterSetter(ec,"cropWidth",0,F()),Y.addGetterSetter(ec,"cropHeight",0,F());let eu=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],eg="right",ef="down",ep="left",em=eu.length;class e_ extends t${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=this,i,r=function(){e._sync()};for(i=0;i<em;i++)t.on(eu[i]+"Change.konva",r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let t=this.getText(),e=this.getTag(),i,r,n,a,s,o,h;if(t&&e){switch(i=t.width(),r=t.height(),n=e.pointerDirection(),a=e.pointerWidth(),h=e.pointerHeight(),s=0,o=0,n){case"up":s=i/2,o=-1*h;break;case eg:s=i+a,o=r/2;break;case ef:s=i/2,o=r+h;break;case ep:s=-1*a,o=r/2}e.setAttrs({x:-1*s,y:-1*o,width:i,height:r}),t.setAttrs({x:-1*s,y:-1*o})}}}e_.prototype.className="Label",u(e_);class ey extends tX{_sceneFunc(t){let e=this.width(),i=this.height(),r=this.pointerDirection(),n=this.pointerWidth(),a=this.pointerHeight(),s=this.cornerRadius(),o=0,h=0,l=0,d=0;"number"==typeof s?o=h=l=d=Math.min(s,e/2,i/2):(o=Math.min(s[0]||0,e/2,i/2),h=Math.min(s[1]||0,e/2,i/2),d=Math.min(s[2]||0,e/2,i/2),l=Math.min(s[3]||0,e/2,i/2)),t.beginPath(),t.moveTo(o,0),"up"===r&&(t.lineTo((e-n)/2,0),t.lineTo(e/2,-1*a),t.lineTo((e+n)/2,0)),t.lineTo(e-h,0),t.arc(e-h,h,h,3*Math.PI/2,0,!1),r===eg&&(t.lineTo(e,(i-a)/2),t.lineTo(e+n,i/2),t.lineTo(e,(i+a)/2)),t.lineTo(e,i-d),t.arc(e-d,i-d,d,0,Math.PI/2,!1),r===ef&&(t.lineTo((e+n)/2,i),t.lineTo(e/2,i+a),t.lineTo((e-n)/2,i)),t.lineTo(l,i),t.arc(l,i-l,l,Math.PI/2,Math.PI,!1),r===ep&&(t.lineTo(0,(i+a)/2),t.lineTo(-1*n,i/2),t.lineTo(0,(i-a)/2)),t.lineTo(0,o),t.arc(o,o,o,Math.PI,3*Math.PI/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){let t=0,e=0,i=this.pointerWidth(),r=this.pointerHeight(),n=this.pointerDirection(),a=this.width(),s=this.height();return"up"===n?(e-=r,s+=r):n===ef?s+=r:n===ep?(t-=1.5*i,a+=i):n===eg&&(a+=1.5*i),{x:t,y:e,width:a,height:s}}}ey.prototype.className="Tag",u(ey),Y.addGetterSetter(ey,"pointerDirection","none"),Y.addGetterSetter(ey,"pointerWidth",0,F()),Y.addGetterSetter(ey,"pointerHeight",0,F()),Y.addGetterSetter(ey,"cornerRadius",0,B(4));class ev extends tX{_sceneFunc(t){let e=this.cornerRadius(),i=this.width(),r=this.height();t.beginPath(),e?C.drawRoundedRectPath(t,i,r,e):t.rect(0,0,i,r),t.closePath(),t.fillStrokeShape(this)}}ev.prototype.className="Rect",u(ev),Y.addGetterSetter(ev,"cornerRadius",0,B(4));class ex extends tX{_sceneFunc(t){let e=this._getPoints(),i=this.radius(),r=this.sides(),n=this.cornerRadius();if(t.beginPath(),n)C.drawRoundedPolygonPath(t,e,r,i,n);else{t.moveTo(e[0].x,e[0].y);for(let i=1;i<e.length;i++)t.lineTo(e[i].x,e[i].y)}t.closePath(),t.fillStrokeShape(this)}_getPoints(){let t=this.attrs.sides,e=this.attrs.radius||0,i=[];for(let r=0;r<t;r++)i.push({x:e*Math.sin(2*r*Math.PI/t),y:-1*e*Math.cos(2*r*Math.PI/t)});return i}getSelfRect(){let t=this._getPoints(),e=t[0].x,i=t[0].x,r=t[0].y,n=t[0].y;return t.forEach(t=>{e=Math.min(e,t.x),i=Math.max(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.y)}),{x:e,y:r,width:i-e,height:n-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}ex.prototype.className="RegularPolygon",ex.prototype._centroid=!0,ex.prototype._attrsAffectingSize=["radiu
14s"],u(ex),Y.addGetterSetter(ex,"radius",0,F()),Y.addGetterSetter(ex,"sides",0,F()),Y.addGetterSetter(ex,"cornerRadius",0,B(4));let eb=2*Math.PI;class eS extends tX{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,eb,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),eb,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)}}eS.prototype.className="Ring",eS.prototype._centroid=!0,eS.prototype._attrsAffectingSize=["innerRadius","outerRadius"],u(eS),Y.addGetterSetter(eS,"innerRadius",0,F()),Y.addGetterSetter(eS,"outerRadius",0,F());class ew extends tX{constructor(t){super(t),this._updated=!0,this.anim=new tQ(()=>{let 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){let e=this.animation(),i=this.frameIndex(),r=4*i,n=this.animations()[e],a=this.frameOffsets(),s=n[r+0],o=n[r+1],h=n[r+2],l=n[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,h,l),t.closePath(),t.fillStrokeShape(this)),d)if(a){let r=a[e],n=2*i;t.drawImage(d,s,o,h,l,r[n+0],r[n+1],h,l)}else t.drawImage(d,s,o,h,l,0,0,h,l)}_hitFunc(t){let e=this.animation(),i=this.frameIndex(),r=4*i,n=this.animations()[e],a=this.frameOffsets(),s=n[r+2],o=n[r+3];if(t.beginPath(),a){let r=a[e],n=2*i;t.rect(r[n+0],r[n+1],s,o)}else t.rect(0,0,s,o);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;let 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(){let t=this.frameIndex(),e=this.animation();t<this.animations()[e].length/4-1?this.frameIndex(t+1):this.frameIndex(0)}}ew.prototype.className="Sprite",u(ew),Y.addGetterSetter(ew,"animation"),Y.addGetterSetter(ew,"animations"),Y.addGetterSetter(ew,"frameOffsets"),Y.addGetterSetter(ew,"image"),Y.addGetterSetter(ew,"frameIndex",0,F()),Y.addGetterSetter(ew,"frameRate",17,F()),Y.backCompat(ew,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class eC extends tX{_sceneFunc(t){let e=this.innerRadius(),i=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-i);for(let n=1;n<2*r;n++){let a=n%2==0?i:e,s=a*Math.sin(n*Math.PI/r),o=-1*a*Math.cos(n*Math.PI/r);t.lineTo(s,o)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}function ek(t){return[...t].reduce((t,e,i,r)=>{if(/\p{Emoji}/u.test(e)){let n=r[i+1];n&&/\p{Emoji_Modifier}|\u200D/u.test(n)?(t.push(e+n),r[i+1]=""):t.push(e)}else/\p{Regional_Indicator}{2}/u.test(e+(r[i+1]||""))?t.push(e+r[i+1]):i>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(e)?t[t.length-1]+=e:e&&t.push(e);return t},[])}eC.prototype.className="Star",eC.prototype._centroid=!0,eC.prototype._attrsAffectingSize=["innerRadius","outerRadius"],u(eC),Y.addGetterSetter(eC,"numPoints",5,F()),Y.addGetterSetter(eC,"innerRadius",0,F()),Y.addGetterSetter(eC,"outerRadius",0,F());let eP="auto",eT="inherit",eA="justify",eM="left",eR="middle",eE="normal",eG="none",eD=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],eL=eD.length,eI=null;function eO(){return a||(a=C.createCanvasElement().getContext("2d"))}class eF extends tX{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<eL;t++)this.on(eD[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(t){var e,i;let r=this.textArr,n=r.length;if(!this.text())return;let a=this.padding(),s=this.fontSize(),o=this.lineHeight()*s,h=this.verticalAlign(),l=this.direction(),d=0,u=this.align(),g=this.getWidth(),f=this.letterSpacing(),p=this.charRenderFunc(),m=this.fill(),_=this.textDecoration(),y=this.underlineOffset(),v=-1!==_.indexOf("underline"),x=-1!==_.indexOf("line-through"),b;l=l===eT?t.direction:l;let S=o/2,w=eR;if(!c.legacyTextRendering){let t=this.measureSize("M");w="alphabetic",S=((null!=(e=t.fontBoundingBoxAscent)?e:t.actualBoundingBoxAscent)-(null!=(i=t.fontBoundingBoxDescent)?i:t.actualBoundingBoxDescent))/2+o
14/2}for("rtl"===l&&t.setAttr("direction",l),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",w),t.setAttr("textAlign",eM),h===eR?d=(this.getHeight()-n*o-2*a)/2:"bottom"===h&&(d=this.getHeight()-n*o-2*a),t.translate(a,d+a),b=0;b<n;b++){let e=0,i=r[b],h=i.text,d=i.width,_=i.lastInParagraph;if(t.save(),"right"===u?e+=g-d-2*a:"center"===u&&(e+=(g-d-2*a)/2),v){t.save(),t.beginPath();let i=null!=y?y:c.legacyTextRendering?Math.round(s/2):Math.round(s/4),r=e,n=S+0+i;t.moveTo(r,n);let o=u!==eA||_?d:g-2*a;t.lineTo(r+Math.round(o),n),t.lineWidth=s/15,t.strokeStyle=this._getLinearGradient()||m,t.stroke(),t.restore()}let w=e;if("rtl"!==l&&(0!==f||u===eA||p)){let i=h.split(" ").length-1,n=ek(h);for(let s=0;s<n.length;s++){let o=n[s];" "!==o||_||u!==eA||(e+=(g-2*a-d)/i),this._partialTextX=e,this._partialTextY=S+0,this._partialText=o,p&&(t.save(),p({char:o,index:s+r.slice(0,b).reduce((t,e)=>t+ek(e.text).length,0),x:e,y:S+0,lineIndex:b,column:s,isLastInLine:_,width:this.measureSize(o).width,context:t})),t.fillStrokeShape(this),p&&t.restore(),e+=this.measureSize(o).width+f}}else 0!==f&&t.setAttr("letterSpacing",`${f}px`),this._partialTextX=e,this._partialTextY=S+0,this._partialText=h,t.fillStrokeShape(this);if(x){t.save(),t.beginPath();let e=c.legacyTextRendering?0:-Math.round(s/4);t.moveTo(w,S+0+e);let i=u!==eA||_?d:g-2*a;t.lineTo(w+Math.round(i),S+0+e),t.lineWidth=s/15,t.strokeStyle=this._getLinearGradient()||m,t.stroke(),t.restore()}t.restore(),n>1&&(S+=o)}}_hitFunc(t){let e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}setText(t){let e=C._isString(t)?t:null==t?"":t+"";return this._setAttr("text",e),this}getWidth(){return this.attrs.width===eP||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===eP||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return C.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e,i,r,n,a,s,o,h,l,d,c;let u=eO(),g=this.fontSize(),f;u.save(),u.font=this._getContextFont(),f=u.measureText(t),u.restore();let p=g/100;return{actualBoundingBoxAscent:null!=(e=f.actualBoundingBoxAscent)?e:71.58203125*p,actualBoundingBoxDescent:null!=(i=f.actualBoundingBoxDescent)?i:0,actualBoundingBoxLeft:null!=(r=f.actualBoundingBoxLeft)?r:-7.421875*p,actualBoundingBoxRight:null!=(n=f.actualBoundingBoxRight)?n:75.732421875*p,alphabeticBaseline:null!=(a=f.alphabeticBaseline)?a:0,emHeightAscent:null!=(s=f.emHeightAscent)?s:100*p,emHeightDescent:null!=(o=f.emHeightDescent)?o:-20*p,fontBoundingBoxAscent:null!=(h=f.fontBoundingBoxAscent)?h:91*p,fontBoundingBoxDescent:null!=(l=f.fontBoundingBoxDescent)?l:21*p,hangingBaseline:null!=(d=f.hangingBaseline)?d:72.80000305175781*p,ideographicBaseline:null!=(c=f.ideographicBaseline)?c:-21*p,width:f.width,height:g}}_getContextFont(){return this.fontStyle()+" "+this.fontVariant()+" "+this.fontSize()+"px "+this.fontFamily().split(",").map(t=>{let e=(t=t.trim()).indexOf(" ")>=0,i=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!i&&(t=`"${t}"`),t}).join(", ")}_addTextLine(t){this.align()===eA&&(t=t.trim());let e=this._getTextWidth(t);return this.textArr.push({text:t,width:e,lastInParagraph:!1})}_getTextWidth(t){let e=this.letterSpacing(),i=t.length;return eO().measureText(t).width+e*i}_setTextData(){let t=this.text().split("\n"),e=+this.fontSize(),i=0,r=this.lineHeight()*e,n=this.attrs.width,a=this.attrs.height,s=n!==eP&&void 0!==n,o=a!==eP&&void 0!==a,h=this.padding(),l=n-2*h,d=a-2*h,c=0,u=this.wrap(),g="char"!==u&&u!==eG,f=this.ellipsis();this.textArr=[],eO().font=this._getContextFont();let p=f?this._getTextWidth("…"):0;for(let e=0,n=t.length;e<n;++e){let a=t[e],h=this._getTextWidth(a);if(s&&h>l)for(;a.length>0;){let t=0,e=ek(a).length,n="",s=0;for(;t<e;){let i=t+e>>>1,h=ek(a).slice(0,i+1).join(""),u=this._getTextWidth(h);(f&&o&&c+r>d?u+p:u)<=l?(t=i+1,n=h,s=u):e=i}if(n){if(g){let e,i=ek(a),r=ek(n),o=i[r.length];(e=(" "===o||"-"===o)&&s<=l?r.length:Math.max(r.lastIndexOf(" "),r.lastIndexOf("-"))+1)>0&&(t=e,n=i.slice(0,t).join(""),s=this._getTextWidth(n))}if(n=n.trimRight(),this._addTextLine(n),i=Math.max(i,s),c+=r,this._shouldHandleEllipsis(c)){this._tryToAddEllipsisToLastLine();break}if((a=ek(a).slice(t).join("").trimLeft()).length>0&&(h=this._getTextWidth(a))<=l){this._addTextLine(a),c+=r,i=Math.max(i,h);break}}else break}else this._addTextLine(a),c+=r,i=Math.max(i,h),this._shouldHandleEllipsis(c)&&e<n-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),o&&c+r>d)break}this.textHeight=e,this.textWidth=i}_shouldHandleEllipsis(t){let e=+this.fontSize(),i=this.lineHeight()*e,r=this.attrs.height,n=this.padding();return this.wrap()===eG||r!==eP&&void 0!==r&&t+i>r-2*n}_tryToAddEllipsisToLastLine(){let t=this.attrs.width,e=this.padding(),i=this.ellipsis(),r=this.textArr[this.textArr.length-1];r&&i&&(t!==eP&&void 0!==t&&(this._getTextWidth(r.text+"…")<t-2*e||(r.text=r.text.slice(0,r.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(r.text
14+"…"))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let t=-1!==this.textDecoration().indexOf("underline")||-1!==this.textDecoration().indexOf("line-through"),e=this.hasShadow();return!!(t&&e||e&&1!==this.getAbsoluteOpacity()&&function(){if(null!==eI)return eI;eI=!1;try{let t=document.createElement("canvas");t.width=10,t.height=10;let e=t.getContext("2d");if(e){e.globalAlpha=0,e.shadowColor="black",e.shadowBlur=5,e.shadowOffsetX=5,e.shadowOffsetY=5,e.fillStyle="black",e.font="10px Arial",e.fillText("X",0,10);let t=e.getImageData(0,0,10,10).data;for(let e=3;e<t.length;e+=4)if(t[e]>0){eI=!0;break}}}catch(t){}return eI}())||super._useBufferCanvas()}}eF.prototype._fillFunc=function(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)},eF.prototype._strokeFunc=function(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)},eF.prototype.className="Text",eF.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],u(eF),Y.overWriteSetter(eF,"width",N()),Y.overWriteSetter(eF,"height",N()),Y.addGetterSetter(eF,"direction",eT),Y.addGetterSetter(eF,"fontFamily","Arial"),Y.addGetterSetter(eF,"fontSize",12,F()),Y.addGetterSetter(eF,"fontStyle",eE),Y.addGetterSetter(eF,"fontVariant",eE),Y.addGetterSetter(eF,"padding",0,F()),Y.addGetterSetter(eF,"align",eM),Y.addGetterSetter(eF,"verticalAlign","top"),Y.addGetterSetter(eF,"lineHeight",1,F()),Y.addGetterSetter(eF,"wrap","word"),Y.addGetterSetter(eF,"ellipsis",!1,W()),Y.addGetterSetter(eF,"letterSpacing",0,F()),Y.addGetterSetter(eF,"text","",H()),Y.addGetterSetter(eF,"textDecoration",""),Y.addGetterSetter(eF,"underlineOffset",void 0,F()),Y.addGetterSetter(eF,"charRenderFunc",void 0);let eB="normal";function eN(t){t.fillText(this.partialText,0,0)}function eH(t){t.strokeText(this.partialText,0,0)}class ez extends tX{constructor(t){super(t),this.dummyCanvas=C.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncCh
14ange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return eo.getPathLength(this.dataArray)}_getPointAtLength(t){return!this.attrs.data||t>this.pathLength?null:eo.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=eo.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();let e=this.textDecoration(),i=this.fill(),r=this.fontSize(),n=this.glyphInfo,a=-1!==e.indexOf("underline"),s=-1!==e.indexOf("line-through");a&&t.beginPath();for(let e=0;e<n.length;e++){t.save();let i=n[e].p0;t.translate(i.x,i.y),t.rotate(n[e].rotation),this.partialText=n[e].text,t.fillStrokeShape(this),a&&(0===e&&t.moveTo(0,r/2+1),t.lineTo(n[e].width,r/2+1)),t.restore()}if(a&&(t.strokeStyle=i,t.lineWidth=r/20,t.stroke()),s){t.beginPath();for(let e=0;e<n.length;e++){t.save();let i=n[e].p0;t.translate(i.x,i.y),t.rotate(n[e].rotation),0===e&&t.moveTo(0,0),t.lineTo(n[e].width,0),t.restore()}t.strokeStyle=i,t.lineWidth=r/20,t.stroke()}t.restore()}_hitFunc(t){t.beginPath();let e=this.glyphInfo;if(e.length>=1){let i=e[0].p0;t.moveTo(i.x,i.y)}for(let i=0;i<e.length;i++){let r=e[i].p1;t.lineTo(r.x,r.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return C.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return eF.prototype.setText.call(this,t)}_getContextFont(){return eF.prototype._getContextFont.call(this)}_getTextSize(t){let e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();let i=e.measureText(t);return e.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let t=ek(this.text());"rtl"===this.direction()&&t.reverse();let e=[],i=0;for(let r=0;r<t.length;r++)e.push({char:t[r],width:this._getTextSize(t[r]).width}),i+=e[r].width;let{width:r,height:n}=this._getTextSize(this.attrs.text);if(this.textWidth=i,this.textHeight=n,this.glyphInfo=[],!this.attrs.data)return null;let a=this.letterSpacing(),s=this.align(),o=this.kerningFunc(),h=Math.max(0,i-r),l=Math.max(this.textWidth+((this.attrs.text||"").length-1)*a,0),d=0;"center"===s&&(d=Math.max(0,this.pathLength/2-l/2)),"right"===s&&(d=Math.max(0,this.pathLength-l));let c=d;for(let i=0;i<e.length;i++){let r=this._getPointAtLength(c);if(!r)return;let n=e[i].char,d=e[i].width+a;if(" "===n&&"justify"===s){let t=this.text().split(" ").length-1;d+=(this.pathLength-l)/t}let u=c+d,g=this._getPointAtLength(u>this.pathLength&&u-this.pathLength<=h?this.pathLength:u);if(!g)return;let f=eo.getLineLength(r.x,r.y,g.x,g.y),p=0;if(o)try{p=o(e[i-1].char,n)*this.fontSize()}catch(t){p=0}r.x+=p,g.x+=p,this.textWidth+=p;let m=eo.getPointOnLine(p+f/2,r.x,r.y,g.x,g.y),_=Math.atan2(g.y-r.y,g.x-r.x);this.glyphInfo.push({transposeX:m.x,transposeY:m.y,text:t[i],rotation:_,p0:r,p1:g,width:f}),c+=d}}getSelfRect(){let t,e;if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let i=[];this.glyphInfo.forEach(function(t){i.push(t.p0.x),i.push(t.p0.y),i.push(t.p1.x),i.push(t.p1.y)});let r=i[0]||0,n=i[0]||0,a=i[1]||0,s=i[1]||0;for(let o=0;o<i.length/2;o++)t=i[2*o],e=i[2*o+1],r=Math.min(r,t),n=Math.max(n,t),a=Math.min(a,e),s=Math.max(s,e);let o=this.fontSize();return{x:r-o/2,y:a-o/2,width:n-r+o,height:s-a+o}}destroy(){return C.releaseCanvas(this.dummyCanvas),super.destroy()}}ez.prototype._fillFunc=eN,ez.prototype._strokeFunc=eH,ez.prototype._fillFuncHit=eN,ez.prototype._strokeFuncHit=eH,ez.prototype.className="TextPath",ez.prototype._attrsAffectingSize=["text","fontSize","data"],u(ez),Y.addGetterSetter(ez,"data"),Y.addGetterSetter(ez,"fontFamily","Arial"),Y.addGetterSetter(ez,"fontSize",12,F()),Y.addGetterSetter(ez,"fontStyle",eB),Y.addGetterSetter(ez,"align","left"),Y.addGetterSetter(ez,"letterSpacing",0,F()),Y.addGetterSetter(ez,"textBaseline","middle"),Y.addGetterSetter(ez,"fontVariant",eB),Y.addGetterSetter(ez,"text",""),Y.addGetterSetter(ez,"textDecoration",""),Y.addGetterSetter(ez,"kerningFunc",void 0),Y.addGetterSetter(ez,"direction","inherit");let eW="tr-konva",eY=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${eW}`).join(" "),ej="nodesRect",eX=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],eU={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},eq="ontouchstart"in c._global,eK=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];
14function eV(t,e,i){let r=i.x+(t.x-i.x)*Math.cos(e)-(t.y-i.y)*Math.sin(e),n=i.y+(t.x-i.x)*Math.sin(e)+(t.y-i.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:r,y:n}}let e$=0;class eJ extends t${constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(eY,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return C.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return eW+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();let e=t.filter(t=>!t.isAncestorOf(this)||(C.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1));return this._nodes=t=e,1===t.length&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(t=>{let 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){let i=t._attrsAffectingSize.map(t=>t+"Change."+this._getEventNamespace()).join(" ");t.on(i,e)}t.on(eX.map(t=>t+`.${this._getEventNamespace()}`).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)}),this._resetTransformCache(),this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,i=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(i,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,i=>{if(!e)return;let r=t.getAbsolutePosition(),n=r.x-e.x,a=r.y-e.y;this.nodes().forEach(e=>{if(e===t||e.isDragging())return;let r=e.getAbsolutePosition();e.setAbsolutePosition({x:r.x+n,y:r.y+a}),e.startDrag(i)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(ej),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(ej,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),i){let r=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),n=t.getAbsoluteScale(i),a=t.getAbsolutePosition(i),s=r.x*n.x-t.offsetX()*n.x,o=r.y*n.y-t.offsetY()*n.y,h=(c.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return eV({x:a.x+s*Math.cos(h)+o*Math.sin(-h),y:a.y+o*Math.cos(h)+s*Math.sin(h),width:r.width*n.x,height:r.height*n.y,rotation:h},-c.getAngle(e),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};let t=[];this.nodes().map(e=>{let i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}],n=e.getAbsoluteTransform();r.forEach(function(e){let i=n.point(e);t.push(i)})});let e=new p;e.rotate(-c.getAngle(this.rotation()));let i=1/0,r=1/0,n=-1/0,a=-1/0;t.forEach(function(t){let s=e.point(t);void 0===i&&(i=n=s.x,r=a=s.y),i=Math.min(i,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),a=Math.max(a,s.y)}),e.invert();let s=e.point({x:i,y:r});return{x:s.x,y:s.y,width:n-i,height:a-r,rotation:c.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(),eK.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(t){let e=new ev({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:eq?10:"auto"}),i=this;e.on("mousedown touchstart",function(t){i._handleMouseDown(t)}),e.on("dragstart",t=>
14{e.stopDrag(),t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),e.on("mouseenter",()=>{let i=function(t,e,i){if("rotater"===t)return i;e+=C.degToRad(eU[t]||0);let r=(C.radToDeg(e)%360+360)%360;return C._inRange(r,337.5,360)||C._inRange(r,0,22.5)?"ns-resize":C._inRange(r,22.5,67.5)?"nesw-resize":C._inRange(r,67.5,112.5)?"ew-resize":C._inRange(r,112.5,157.5)?"nwse-resize":C._inRange(r,157.5,202.5)?"ns-resize":C._inRange(r,202.5,247.5)?"nesw-resize":C._inRange(r,247.5,292.5)?"ew-resize":C._inRange(r,292.5,337.5)?"nwse-resize":(C.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}(t,c.getAngle(this.rotation()),this.rotateAnchorCursor());e.getStage().content&&(e.getStage().content.style.cursor=i),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){let t=new tX({name:"back",width:0,height:0,sceneFunc(t,e){let i=e.getParent(),r=i.padding(),n=e.width(),a=e.height();if(t.beginPath(),t.rect(-r,-r,n+2*r,a+2*r),i.rotateEnabled()&&i.rotateLineVisible()){let e=i.rotateAnchorAngle(),r=i.rotateAnchorOffset(),s=C.degToRad(e),o=Math.sin(s),h=-Math.cos(s),l=n/2,d=a/2,c=1/0;h<0?c=Math.min(c,-d/h):h>0&&(c=Math.min(c,(a-d)/h)),o<0?c=Math.min(c,-l/o):o>0&&(c=Math.min(c,(n-l)/o));let u=l+o*c,g=d+h*c,f=C._sign(a);t.moveTo(u,g),t.lineTo(u+o*r*f,g+h*r*f)}t.fillStrokeShape(e)},hitFunc:(t,e)=>{if(!this.shouldOverdrawWholeArea())return;let i=this.padding();t.beginPath(),t.rect(-i,-i,e.width()+2*i,e.height()+2*i),t.fillStrokeShape(e)}});this.add(t),this._proxyDrag(t),t.on("dragstart",t=>{t.cancelBubble=!0}),t.on("dragmove",t=>{t.cancelBubble=!0}),t.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(t){if(this._transforming)return;this._movingAnchorName=t.target.name().split(" ")[0];let e=this._getNodeRect(),i=e.width,r=e.height,n=Math.sqrt(Math.pow(i,2)+Math.pow(r,2));this.sin=Math.abs(r/n),this.cos=Math.abs(i/n),"u">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;let a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},e$++,this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(e=>{e._fire("transformstart",{evt:t.evt,target:e})})}_handleMouseMove(t){let e,i,r,n,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(t);let o=s.getPointerPosition(),h={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y},l=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(l,h,t)),a.setAbsolutePosition(h);let d=a.getAbsolutePosition();if(l.x===d.x&&l.y===d.y)return;if("rotater"===this._movingAnchorName){let r,n=this._getNodeRect();e=a.x()-n.width/2;let s=Math.atan2(-(i=-a.y()+n.height/2),e)+Math.PI/2-c.getAngle(this.rotateAnchorAngle());n.height<0&&(s-=Math.PI);let o=c.getAngle(this.rotation())+s,h=c.getAngle(this.rotationSnapTolerance()),l=function(t,e,i){let r=e;for(let n=0;n<t.length;n++){let a=c.getAngle(t[n]),s=Math.abs(a-e)%(2*Math.PI);Math.min(s,2*Math.PI-s)<i&&(r=a)}return r}(this.rotationSnaps(),o,h)-n.rotation,d=(r={x:n.x+n.width/2*Math.cos(n.rotation)+n.height/2*Math.sin(-n.rotation),y:n.y+n.height/2*Math.cos(n.rotation)+n.width/2*Math.sin(n.rotation)},eV(n,l,r));this._fitNodesInto(d,t);return}let u=this.shiftBehavior();n="inverted"===u?this.keepRatio()&&!t.shiftKey:"none"===u?this.keepRatio():this.keepRatio()||t.shiftKey;let g=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(n){let t=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(t.x-a.x(),2)+Math.pow(t.y-a.y(),2));let n=this.findOne(".top-left").x()>t.x?-1:1,s=this.findOne(".top-left").y()>t.y?-1:1;e=r*this.cos*n,i=r*this.sin*s,this.findOne(".top-left").x(t.x-e),this.findOne(".top-left").y(t.y-i)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(a.y());else if("top-right"===this._movingAnchorName){if(n){let t=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(a.x()-t.x,2)+Math.pow(t.y-a.y(),2));let n=this.findOne(".top-right").x()<t.x?-1:1,s=this.findOne(".top-right").y()>t.y?-1:1;e=r*this.cos*n,i=r*this.sin*s,this.findOne(".top-right").x(t.x+e),this.findOne(".top-right").y(t.y-i)}var f=a.position();this.findOne(".top-left").y(f.y),this.findOne(".bottom-right").x(f.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(a.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(a.x());else if("bottom-left"===this._movingAnchorName){if(n){let t=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(t.x-a.x(),2)+Math.pow(a.y()-t.y,2));let n=t.x<a.x()?-1:1,s=a.y()<t.y?-1:1;e=r*this.cos*n,i=r*this.sin*s,a.x(t.x-e),a.y(t.y+i)}f=a.position(),this.findOne(".top-left").x(f.x),this.findOne(".bottom-right").y(f.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(a.y());else if("bottom-right"===this._movingAnchorName){if(n){let t=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(a.x()-t.x,2)+Math.pow(a.y()-t.y,2));let n=this.findOne(".bottom-right").x()<t.x?-1:1,s=this.findOne(".bottom-right").y()<t.y?-1:1;e=r*this.cos*n,i=r*this.sin*s,this.findOne(".bottom-right").x(t.x+e),this.findOne(".bottom-right").y(t.y+i)}}else console.error(Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(g=this.centeredScaling()||t.altKey){let t=this.findOne(".top-left"),e=this.findOne(".bottom-right"),i=t.x(),r=t.y(),n=this.getWidth()-e.x(),a=this.getHeight()-e.y();e.move({x:-i,y:-r}),t.move({x:n,y:a})}let p=this.findOne(".top-left").getAbsolutePosition();e=p.x,i=p.y;let m=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),_=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:i,width:m,height:_,rotation:c.getAngle(this.rotation())},t)}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){var e;if(this._transforming){this._transforming=!1,"u">typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));let i=this.getNode();e$--,this._fire("transformend",{evt:t,target:i}),null==(e=this.getLayer())||e.batchDraw(),i&&this._nodes.forEac
14h(e=>{var i;e._fire("transformend",{evt:t,target:e}),null==(i=e.getLayer())||i.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(t,e){let i=this._getNodeRect();if(C._inRange(t.width,-(2*this.padding())-1,1)||C._inRange(t.height,-(2*this.padding())-1,1))return void this.update();let r=new p;if(r.rotate(c.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){let e=r.point({x:-(2*this.padding()),y:0});t.x+=e.x,t.y+=e.y,t.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){let e=r.point({x:2*this.padding(),y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.width+=2*this.padding()}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){let e=r.point({x:0,y:-(2*this.padding())});t.x+=e.x,t.y+=e.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){let e=r.point({x:0,y:2*this.padding()});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}if(this.boundBoxFunc()){let e=this.boundBoxFunc()(i,t);e?t=e:C.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}let n=new p;n.translate(i.x,i.y),n.rotate(i.rotation),n.scale(i.width/1e7,i.height/1e7);let a=new p,s=t.width/1e7,o=t.height/1e7;!1===this.flipEnabled()?(a.translate(t.x,t.y),a.rotate(t.rotation),a.translate(t.width<0?t.width:0,t.height<0?t.height:0),a.scale(Math.abs(s),Math.abs(o))):(a.translate(t.x,t.y),a.rotate(t.rotation),a.scale(s,o));let h=a.multiply(n.invert());this._nodes.forEach(t=>{var e;if(!t.getStage())return;let i=t.getParent().getAbsoluteTransform(),r=t.getTransform().copy();r.translate(t.offsetX(),t.offsetY());let n=new p;n.multiply(i.copy().invert()).multiply(h).multiply(i).multiply(r);let a=n.decompose();t.setAttrs(a),null==(e=t.getLayer())||e.batchDraw()}),this.rotation(C._getRotation(t.rotation)),this._nodes.forEach(t=>{this._fire("transform",{evt:e,target:t}),t._fire("transform",{evt:e,target:t})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t;let e=this._getNodeRect();this.rotation(C._getRotation(e.rotation));let i=e.width,r=e.height,n=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),o=this.anchorSize(),h=this.find("._anchor");h.forEach(t=>{t.setAttrs({width:o,height:o,offsetX:o/2,offsetY:o/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:o/2+s,offsetY:o/2+s,visible:a&&n.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:o/2+s,visible:a&&n.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:o/2-s,offsetY:o/2+s,visible:a&&n.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:o/2+s,visible:a&&n.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:r/2,offsetX:o/2-s,visible:a&&n.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:o/2+s,offsetY:o/2-s,visible:a&&n.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:r,offsetY:o/2-s,visible:a&&n.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:r,offsetX:o/2-s,offsetY:o/2-s,visible:a&&n.indexOf("bottom-right")>=0});let l=this.rotateAnchorAngle(),d=this.rotateAnchorOffset(),c=C.degToRad(l),u=Math.sin(c),g=-Math.cos(c),f=i/2,p=r/2,m=1/0;g<0?m=Math.min(m,-p/g):g>0&&(m=Math.min(m,(r-p)/g)),u<0?m=Math.min(m,-f/u):u>0&&(m=Math.min(m,(i-f)/u));let _=f+u*m,y=p+g*m,v=C._sign(r);this._batchChangeChild(".rotater",{x:_+u*d*v,y:y+g*d*v-s*g,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(t=>t.draggable()),x:0,y:0});let x=this.anchorStyleFunc();x&&h.forEach(t=>{x(t)}),null==(t=this.getLayer())||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let t=this.findOne("."+this._movingAnchorName);
14t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),t$.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...t){return this._elementsCreated?(C.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...t)}toObject(){return te.prototype.toObject.call(this)}clone(t){return te.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}eJ.isTransforming=()=>e$>0,eJ.prototype.className="Transformer",u(eJ),Y.addGetterSetter(eJ,"enabledAnchors",eK,function(t){return t instanceof Array||C.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(t){-1===eK.indexOf(t)&&C.warn("Unknown anchor name: "+t+". Available names are: "+eK.join(", "))}),t||[]}),Y.addGetterSetter(eJ,"flipEnabled",!0,W()),Y.addGetterSetter(eJ,"resizeEnabled",!0),Y.addGetterSetter(eJ,"anchorSize",10,F()),Y.addGetterSetter(eJ,"rotateEnabled",!0),Y.addGetterSetter(eJ,"rotateLineVisible",!0),Y.addGetterSetter(eJ,"rotationSnaps",[]),Y.addGetterSetter(eJ,"rotateAnchorOffset",50,F()),Y.addGetterSetter(eJ,"rotateAnchorAngle",0,F()),Y.addGetterSetter(eJ,"rotateAnchorCursor","crosshair"),Y.addGetterSetter(eJ,"rotationSnapTolerance",5,F()),Y.addGetterSetter(eJ,"borderEnabled",!0),Y.addGetterSetter(eJ,"anchorStroke","rgb(0, 161, 255)"),Y.addGetterSetter(eJ,"anchorStrokeWidth",1,F()),Y.addGetterSetter(eJ,"anchorFill","white"),Y.addGetterSetter(eJ,"anchorCornerRadius",0,F()),Y.addGetterSetter(eJ,"borderStroke","rgb(0, 161, 255)"),Y.addGetterSetter(eJ,"borderStrokeWidth",1,F()),Y.addGetterSetter(eJ,"borderDash"),Y.addGetterSetter(eJ,"keepRatio",!0),Y.addGetterSetter(eJ,"shiftBehavior","default"),Y.addGetterSetter(eJ,"centeredScaling",!1),Y.addGetterSetter(eJ,"ignoreStroke",!1),Y.addGetterSetter(eJ,"padding",0,F()),Y.addGetterSetter(eJ,"nodes"),Y.addGetterSetter(eJ,"node"),Y.addGetterSetter(eJ,"boun
14dBoxFunc"),Y.addGetterSetter(eJ,"anchorDragBoundFunc"),Y.addGetterSetter(eJ,"anchorStyleFunc"),Y.addGetterSetter(eJ,"shouldOverdrawWholeArea",!1),Y.addGetterSetter(eJ,"useSingleNodeRotation",!0),Y.backCompat(eJ,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class eQ extends tX{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,c.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)}}function eZ(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}eQ.prototype.className="Wedge",eQ.prototype._centroid=!0,eQ.prototype._attrsAffectingSize=["radius"],u(eQ),Y.addGetterSetter(eQ,"radius",0,F()),Y.addGetterSetter(eQ,"angle",0,F()),Y.addGetterSetter(eQ,"clockwise",!1),Y.backCompat(eQ,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});let e0=[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,39
146,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],e1=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function e2(t,e,i,r,n){let a=i-e,s=n-r;if(0===a)return r+s/2;if(0===s)return r;let o=(t-e)/a;return s*o+r}Y.addGetterSetter(te,"blurRadius",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"brightness",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"contrast",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"embossStrength",.5,F(),Y.afterSetFilter),Y.addGetterSetter(te,"embossWhiteLevel",.5,F(),Y.afterSetFilter),Y.addGetterSetter(te,"embossDirection","top-left",void 0,Y.afterSetFilter),Y.addGetterSetter(te,"embossBlend",!1,void 0,Y.afterSetFilter),Y.addGetterSetter(te,"enhance",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"hue",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"saturation",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"luminance",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"hue",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"saturation",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"value",0,F(),Y.afterSetFilter);let e5=function(t,e,i){let r=t.data,n=e.data,a=t.width,s=t.height,o=i.polarCenterX||a/2,h=i.polarCenterY||s/2,l=Math.sqrt(o*o+h*h),d=a-o,c=s-h,u=Math.sqrt(d*d+c*c);l=u>l?u:l;let g=360/a*Math.PI/180;for(let t=0;t<a;t+=1){let e=Math.sin(t*g),i=Math.cos(t*g);for(let u=0;u<s;u+=1){d=Math.floor(o+l*u/s*i);let g=((c=Math.floor(h+l*u/s*e))*a+d)*4,f=r[g+0],p=r[g+1],m=r[g+2],_=r[g+3];n[(g=(t+u*a)*4)+0]=f,n[g+1]=p,n[g+2]=m,n[g+3]=_}}},e3=function(t,e,i){let r,n=t.data,a=e.data,s=t.width,o=t.height,h=i.polarCenterX||s/2,l=i.polarCenterY||o/2,d=Math.sqrt(h*h+l*l),c=s-h,u=o-l,g=Math.sqrt(c*c+u*u);d=g>d?g:d;let f=i.polarRotation||0;for(c=0;c<s;c+=1)for(u=0;u<o;u+=1){let t=c-h,e=u-l,i=Math.sqrt(t*t+e*e)*o/d,g=(180*Math.atan2(e,t)/Math.PI+360+f)%360;r=Math.floor(g=g*s/360);let p=(Math.floor(i)*s+r)*4,m=n[p+0],_=n[p+1],y=n[p+2],v=n[p+3];a[(p=(u*s+c)*4)+0]=m,a[p+1]=_,a[p+2]=y,a[p+3]=v}};function e4(t,e,i){let r=(i*t.width+e)*4,n=[];return n.push(t.data[r++],t.data[r++],t.data[r++],t.data[r++]),n}function e8(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))}Y.addGetterSetter(te,"kaleidoscopePower",2,F(),Y.afterSetFilter),Y.addGetterSetter(te,"kaleidoscopeAngle",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"threshold",0,F(),Y.afterSetFilter),Y.addGetterSetter(te,"noise",.2,F(),Y.afterSetFilter),Y.addGetterSetter(te,"pixelSize",8,F(),Y.afterSetFilter),Y.addGetterSetter(te,"levels",.5,F(),Y.afterSetFilter),Y.addGetterSetter(te,"red",0,function(t){return(this._filterUpToDate=!1,t>255)?255:t<0?0:Math.round(t)}),Y.addGetterSetter(te,"green",0,function(t){return(this._filterUpToDate=!1,t>255)?255:t<0?0:Math.round(t)}),Y.addGetterSetter(te,"blue",0,O,Y.afterSetFilter),Y.addGetterSetter(te,"red",0,function(t){return(this._filterUpToDate=!1,t>255)?255:t<0?0:Math.round(t)}),Y.addGetterSetter(te,"green",0,function(t){return(this._filterUpToDate=!1,t>255)?255:t<0?0:Math.round(t)}),Y.addGetterSetter(te,"blue",0,O,Y.afterSetFilter),Y.addGetterSetter(te,"alpha",1,function(t){return(this._filterUpToDate=!1,t>1)?1:t<0?0:t}),Y.addGetterSetter(te,"threshold",.5,F(),Y.afterSetFilter),t4.Util._assign(t4,{Arc:t8,Arrow:eh,Circle:el,Ellipse:ed,Image:ec,Label:e_,Tag:ey,Line:t7,Path:eo,Rect:ev,RegularPolygon:ex,Ring:eS,Sprite:ew,Star:eC,Text:eF,TextPath:ez,Transformer:eJ,Wedge:eQ,Filters:{Blur:function(t){let e=Math.round(this.blurRadius());e>0&&function(t,e){let i,r,n,a,s,o,h,l,d,c,u,g,f,p,m,_,y,v,x,b,S=t.data,w=t.width,C=t.height,k=e+e+1,P=w-1,T=C-1,A=e+1,M=A*(A+1)/2,R=new eZ,E=e0[e],G=e1[e],D=null,
14L=R,I=null,O=null;for(let t=1;t<k;t++)L=L.next=new eZ,t===A&&(D=L);L.next=R,n=r=0;for(let t=0;t<C;t++){g=f=p=m=a=s=o=h=0,l=A*(_=S[r]),d=A*(y=S[r+1]),c=A*(v=S[r+2]),u=A*(x=S[r+3]),a+=M*_,s+=M*y,o+=M*v,h+=M*x,L=R;for(let t=0;t<A;t++)L.r=_,L.g=y,L.b=v,L.a=x,L=L.next;for(let t=1;t<A;t++)i=r+((P<t?P:t)<<2),a+=(L.r=_=S[i])*(b=A-t),s+=(L.g=y=S[i+1])*b,o+=(L.b=v=S[i+2])*b,h+=(L.a=x=S[i+3])*b,g+=_,f+=y,p+=v,m+=x,L=L.next;I=R,O=D;for(let t=0;t<w;t++)S[r+3]=x=h*E>>G,0!==x?(x=255/x,S[r]=(a*E>>G)*x,S[r+1]=(s*E>>G)*x,S[r+2]=(o*E>>G)*x):S[r]=S[r+1]=S[r+2]=0,a-=l,s-=d,o-=c,h-=u,l-=I.r,d-=I.g,c-=I.b,u-=I.a,i=n+((i=t+e+1)<P?i:P)<<2,g+=I.r=S[i],f+=I.g=S[i+1],p+=I.b=S[i+2],m+=I.a=S[i+3],a+=g,s+=f,o+=p,h+=m,I=I.next,l+=_=O.r,d+=y=O.g,c+=v=O.b,u+=x=O.a,g-=_,f-=y,p-=v,m-=x,O=O.next,r+=4;n+=w}for(let t=0;t<w;t++){f=p=m=g=s=o=h=a=0,l=A*(_=S[r=t<<2]),d=A*(y=S[r+1]),c=A*(v=S[r+2]),u=A*(x=S[r+3]),a+=M*_,s+=M*y,o+=M*v,h+=M*x,L=R;for(let t=0;t<A;t++)L.r=_,L.g=y,L.b=v,L.a=x,L=L.next;let n=w;for(let i=1;i<=e;i++)r=n+t<<2,a+=(L.r=_=S[r])*(b=A-i),s+=(L.g=y=S[r+1])*b,o+=(L.b=v=S[r+2])*b,h+=(L.a=x=S[r+3])*b,g+=_,f+=y,p+=v,m+=x,L=L.next,i<T&&(n+=w);r=t,I=R,O=D;for(let e=0;e<C;e++)S[(i=r<<2)+3]=x=h*E>>G,x>0?(x=255/x,S[i]=(a*E>>G)*x,S[i+1]=(s*E>>G)*x,S[i+2]=(o*E>>G)*x):S[i]=S[i+1]=S[i+2]=0,a-=l,s-=d,o-=c,h-=u,l-=I.r,d-=I.g,c-=I.b,u-=I.a,i=t+((i=e+A)<T?i:T)*w<<2,a+=g+=I.r=S[i],s+=f+=I.g=S[i+1],o+=p+=I.b=S[i+2],h+=m+=I.a=S[i+3],I=I.next,l+=_=O.r,d+=y=O.g,c+=v=O.b,u+=x=O.a,g-=_,f-=y,p-=v,m-=x,O=O.next,r+=w}}(t,e)},Brightness:function(t){let e=this.brightness(),i=t.data,r=i.length;for(let t=0;t<r;t+=4)i[t]=Math.min(255,i[t]*e),i[t+1]=Math.min(255,i[t+1]*e),i[t+2]=Math.min(255,i[t+2]*e)},Brighten:function(t){let e=255*this.brightness(),i=t.data,r=i.length;for(let t=0;t<r;t+=4)i[t]+=e,i[t+1]+=e,i[t+2]+=e},Contrast:function(t){let e=Math.pow((this.contrast()+100)/100,2),i=t.data,r=i.length,n=150,a=150,s=150;for(let t=0;t<r;t+=4)n=i[t],a=i[t+1],s=i[t+2],n/=255,n-=.5,n*=e,n+=.5,n*=255,a/=255,a-=.5,a*=e,a+=.5,a*=255,s/=255,s-=.5,s*=e,s+=.5,s*=255,n=n<0?0:n>255?255:n,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,i[t]=n,i[t+1]=a,i[t+2]=s},Emboss:function(t){var e,i,r,n,a,s,o,h,l;let d=t.data,c=t.width,u=t.height,g=Math.min(1,Math.max(0,null!=(i=null==(e=this.embossStrength)?void 0:e.call(this))?i:.5)),f=Math.min(1,Math.max(0,null!=(n=null==(r=this.embossWhiteLevel)?void 0:r.call(this))?n:.5)),p=null!=(o=({"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0})[null!=(s=null==(a=this.embossDirection)?void 0:a.call(this))?s:"top-left"])?o:315,m=!!(null!=(l=null==(h=this.embossBlend)?void 0:h.call(this))&&l),_=255*f,y=p*Math.PI/180,v=Math.cos(y),x=Math.sin(y),b=128/1020*(10*g),S=new Uint8ClampedArray(d),w=new Float32Array(c*u);for(let t=0,e=0;e<d.length;e+=4,t++)w[t]=.2126*S[e]+.7152*S[e+1]+.0722*S[e+2];let C=[-c-1,-c,-c+1,-1,0,1,c-1,c,c+1],k=t=>t<0?0:t>255?255:t;
14for(let t=1;t<u-1;t++)for(let e=1;e<c-1;e++){let i=t*c+e,r,n=0;r=0+-1*w[i+C[0]],n+=-1*w[i+C[0]],r+=0*w[i+C[1]],n+=-2*w[i+C[1]],r+=+w[i+C[2]],n+=-1*w[i+C[2]],r+=-2*w[i+C[3]],n+=0*w[i+C[3]],r+=2*w[i+C[5]],n+=0*w[i+C[5]],r+=-1*w[i+C[6]],n+=+w[i+C[6]],r+=0*w[i+C[7]],n+=2*w[i+C[7]];let a=k(_+(v*(r+=+w[i+C[8]])+x*(n+=+w[i+C[8]]))*b),s=4*i;if(m){let t=a-_;d[s]=k(S[s]+t),d[s+1]=k(S[s+1]+t),d[s+2]=k(S[s+2]+t),d[s+3]=S[s+3]}else d[s]=d[s+1]=d[s+2]=a,d[s+3]=S[s+3]}for(let t=0;t<c;t++){let e=4*t,i=((u-1)*c+t)*4;d[e]=S[e],d[e+1]=S[e+1],d[e+2]=S[e+2],d[e+3]=S[e+3],d[i]=S[i],d[i+1]=S[i+1],d[i+2]=S[i+2],d[i+3]=S[i+3]}for(let t=1;t<u-1;t++){let e=t*c*4,i=(t*c+(c-1))*4;d[e]=S[e],d[e+1]=S[e+1],d[e+2]=S[e+2],d[e+3]=S[e+3],d[i]=S[i],d[i+1]=S[i+1],d[i+2]=S[i+2],d[i+3]=S[i+3]}return t},Enhance:function(t){let e,i,r,n,a,s,o=t.data,h=o.length,l=o[0],d=l,c,u=o[1],g=u,f,p=o[2],m=p,_,y=this.enhance();if(0!==y){for(let t=0;t<h;t+=4)(c=o[t+0])<l?l=c:c>d&&(d=c),(f=o[t+1])<u?u=f:f>g&&(g=f),(_=o[t+2])<p?p=_:_>m&&(m=_);if(d===l&&(d=255,l=0),g===u&&(g=255,u=0),m===p&&(m=255,p=0),y>0)e=d+y*(255-d),i=l-y*(l-0),r=g+y*(255-g),n=u-y*(u-0),a=m+y*(255-m),s=p-y*(p-0);else{let t=(d+l)*.5;e=d+y*(d-t),i=l+y*(l-t);let o=(g+u)*.5;r=g+y*(g-o),n=u+y*(u-o);let h=(m+p)*.5;a=m+y*(m-h),s=p+y*(p-h)}for(let t=0;t<h;t+=4)o[t+0]=e2(o[t+0],l,d,i,e),o[t+1]=e2(o[t+1],u,g,n,r),o[t+2]=e2(o[t+2],p,m,s,a)}},Grayscale:function(t){let e=t.data,i=e.length;for(let t=0;t<i;t+=4){let i=.34*e[t]+.5*e[t+1]+.16*e[t+2];e[t]=i,e[t+1]=i,e[t+2]=i}},HSL:function(t){let e,i,r,n,a=t.data,s=a.length,o=Math.pow(2,this.saturation()),h=Math.abs(this.hue()+360)%360,l=127*this.luminance(),d=o*Math.cos(h*Math.PI/180),c=o*Math.sin(h*Math.PI/180),u=.299+.701*d+.167*c,g=.587-.587*d+.33*c,f=.114-.114*d-.497*c,p=.299-.299*d-.328*c,m=.587+.413*d+.035*c,_=.114-.114*d+.293*c,y=.299-.3*d+1.25*c,v=.587-.586*d-1.05*c,x=.114+.886*d-.2*c;for(let t=0;t<s;t+=4)e=a[t+0],i=a[t+1],r=a[t+2],n=a[t+3],a[t+0]=u*e+g*i+f*r+l,a[t+1]=p*e+m*i+_*r+l,a[t+2]=y*e+v*i+x*r+l,a[t+3]=n},HSV:function(t){let e=t.data,i=e.length,r=Math.pow(2,this.value()),n=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,s=r*n*Math.cos(a*Math.PI/180),o=r*n*Math.sin(a*Math.PI/180),h=.299*r+.701*s+.167*o,l=.587*r-.587*s+.33*o,d=.114*r-.114*s-.497*o,c=.299*r-.299*s-.328*o,u=.587*r+.413*s+.035*o,g=.114*r-.114*s+.293*o,f=.299*r-.3*s+1.25*o,p=.587*r-.586*s-1.05*o,m=.114*r+.886*s-.2*o;for(let t=0;t<i;t+=4){let i=e[t+0],r=e[t+1],n=e[t+2],a=e[t+3];e[t+0]=h*i+l*r+d*n,e[t+1]=c*i+u*r+g*n,e[t+2]=f*i+p*r+m*n,e[t+3]=a}},Invert:function(t){let e=t.data,i=e.length;for(let t=0;t<i;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]},Kaleidoscope:function(t){let e,i,r,n,a,s,o,h,l,d,c=t.width,u=t.height,g=Math.round(this.kaleidoscopePower()),f=Math.floor(Math.round(this.kaleidoscopeAngle())%360*c/360);if(g<1)return;let p=C.createCanvasElement();p.width=c,p.height=u;let m=p.getContext("2d").getImageData(0,0,c,u);C.releaseCanvas(p),e5(t,m,{polarCenterX:c/2,polarCenterY:u/2});let _=c/Math.pow(2,g);for(;_<=8;)_*=2,g-=1;let y=_=Math.ceil(_),v=0,x=y,b=1;for(f+_>c&&(v=y,x=0,b=-1),i=0;i<u;i+=1)for(e=v;e!==x;e+=b)r=Math.round(e+f)%c,l=(c*i+r)*4,a=m.data[l+0],s=m.data[l+1],o=m.data[l+2],h=m.data[l+3],d=(c*i+e)*4,m.data[d+0]=a,m.data[d+1]=s,m.data[d+2]=o,m.data[d+3]=h;for(i=0;i<u;i+=1)for(y=Math.floor(_),n=0;n<g;n+=1){for(e=0;e<y+1;e+=1)l=(c*i+e)*4,a=m.data[l+0],s=m.data[l+1],o=m.data[l+2],h=m.data[l+3],d=(c*i+2*y-e-1)*4,m.data[d+0]=a,m.data[d+1]=s,m.data[d+2]=o,m.data[d+3]=h;y*=2}e3(m,t,{polarRotation:0})},Mask:function(t){let e=function(t,e){let i=e4(t,0,0),r=e4(t,t.width-1,0),n=e4(t,0,t.height-1),a=e4(t,t.width-1,t.height-1),s=e||10;if(e8(i,r)<s&&e8(r,a)<s&&e8(a,n)<s&&e8(n,i)<s){let e=function(t){let e=[0,0,0];for(let i=0;i<t.length;i++)e[0]+=t[i][0],e[1]+=t[i][1],e[2]+=t[i][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}([r,i,a,n]),o=[];for(let i=0;i<t.width*t.height;i++){let r=e8(e,[t.data[4*i],t.data[4*i+1],t.data[4*i+2]]);o[i]=r<s?0:255}return o}}(t,this.threshold());if(e){var i=e=function(t,e,i){let r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],n=Math.round(Math.sqrt(r.length)),a=Math.floor(n/2),s=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){let l=o*e+h,d=0;for(let s=0;s<n;s++)for(let l=0;l<n;l++){let c=o+s-a,u=h+l-a;if(c>=0&&c<i&&u>=0&&u<e){let i=c*e+u,a=r[s*n+l];d+=t[i]*a}}s[l]=d}return s}
14(e=function(t,e,i){let r=[1,1,1,1,1,1,1,1,1],n=Math.round(Math.sqrt(r.length)),a=Math.floor(n/2),s=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){let l=o*e+h,d=0;for(let s=0;s<n;s++)for(let l=0;l<n;l++){let c=o+s-a,u=h+l-a;if(c>=0&&c<i&&u>=0&&u<e){let i=c*e+u,a=r[s*n+l];d+=t[i]*a}}s[l]=255*(d>=1020)}return s}(e=function(t,e,i){let r=[1,1,1,1,0,1,1,1,1],n=Math.round(Math.sqrt(r.length)),a=Math.floor(n/2),s=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){let l=o*e+h,d=0;for(let s=0;s<n;s++)for(let l=0;l<n;l++){let c=o+s-a,u=h+l-a;if(c>=0&&c<i&&u>=0&&u<e){let i=c*e+u,a=r[s*n+l];d+=t[i]*a}}s[l]=255*(2040===d)}return s}(e,t.width,t.height),t.width,t.height),t.width,t.height);for(let e=0;e<t.width*t.height;e++)t.data[4*e+3]=i[e]}return t},Noise:function(t){let e=255*this.noise(),i=t.data,r=i.length,n=e/2;for(let t=0;t<r;t+=4)i[t+0]+=n-2*n*Math.random(),i[t+1]+=n-2*n*Math.random(),i[t+2]+=n-2*n*Math.random()},Pixelate:function(t){let e=Math.ceil(this.pixelSize()),i=t.width,r=t.height,n=Math.ceil(i/e),a=Math.ceil(r/e),s=t.data;if(e<=0)return void C.error("pixelSize value can not be <= 0");for(let t=0;t<n;t+=1)for(let n=0;n<a;n+=1){let a=0,o=0,h=0,l=0,d=t*e,c=d+e,u=n*e,g=u+e,f=0;for(let t=d;t<c;t+=1)if(!(t>=i))for(let e=u;e<g;e+=1){if(e>=r)continue;let n=(i*e+t)*4;a+=s[n+0],o+=s[n+1],h+=s[n+2],l+=s[n+3],f+=1}a/=f,o/=f,h/=f,l/=f;for(let t=d;t<c;t+=1)if(!(t>=i))for(let e=u;e<g;e+=1){if(e>=r)continue;let n=(i*e+t)*4;s[n+0]=a,s[n+1]=o,s[n+2]=h,s[n+3]=l}}},Posterize:function(t){let e=Math.round(254*this.levels())+1,i=t.data,r=i.length,n=255/e;for(let t=0;t<r;t+=1)i[t]=Math.floor(i[t]/n)*n},RGB:function(t){let e=t.data,i=e.length,r=this.red(),n=this.green(),a=this.blue();for(let t=0;t<i;t+=4){let i=(.34*e[t]+.5*e[t+1]+.16*e[t+2])/255;e[t]=i*r,e[t+1]=i*n,e[t+2]=i*a,e[t+3]=e[t+3]}},RGBA:function(t){let e=t.data,i=e.length,r=this.red(),n=this.green(),a=this.blue(),s=this.alpha();for(let t=0;t<i;t+=4){let i=1-s;e[t]=r*s+e[t]*i,e[t+1]=n*s+e[t+1]*i,e[t+2]=a*s+e[t+2]*i}},Sepia:function(t){let e=t.data,i=e.length;for(let t=0;t<i;t+=4){let i=e[t+0],r=e[t+1],n=e[t+2];e[t+0]=Math.min(255,.393*i+.769*r+.189*n),e[t+1]=Math.min(255,.349*i+.686*r+.168*n),e[t+2]=Math.min(255,.272*i+.534*r+.131*n)}},Solarize:function(t){let e=t.data;for(let t=0;t<e.length;t+=4){let i=e[t],r=e[t+1],n=e[t+2];.2126*i+.7152*r+.0722*n>=128&&(e[t]=255-i,e[t+1]=255-r,e[t+2]=255-n)}return t},Threshold:function(t){let e=255*this.threshold(),i=t.data,r=i.length;for(let t=0;t<r;t+=1)i[t]=i[t]<e?0:255}}});var e6=i(12115),e9=i(51854),e7=i.n(e9),it=i(37235);let ie={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},ii=!1,ir=!1,ia=".react-konva-event",is=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
15Position of a node will be changed during drag&drop, so you should update state of the react app as well.
16Consider to add onDragMove or onDragEnd events.
17For more info see: https://github.com/konvajs/react-konva/issues/256
18`,io=`ReactKonva: You are using "zIndex" attribute for a Konva node.
19react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
20For more info see: https://github.com/konvajs/react-konva/issues/194
21`,ih={};function il(t,e,i=ih){if(!ii&&"zIndex"in e&&(console.warn(io),ii=!0),!ir&&e.draggable){var r=void 0!==e.x||void 0!==e.y,n=e.onDragEnd||e.onDragMove;r&&!n&&(console.warn(is),ir=!0)}for(var a in i)if(!ie[a]){var s="on"===a.slice(0,2),o=i[a]!==e[a];if(s&&o){var h=a.substr(2).toLowerCase();"content"===h.substr(0,7)&&(h="content"+h.substr(7,1).toUpperCase()+h.substr(8)),t.off(h,i[a])}e.hasOwnProperty(a)||t.setAttr(a,void 0)}var l=e._useStrictMode,d={},c=!1;let u={};for(var a in e)if(!ie[a]){var s="on"===a.slice(0,2),g=i[a]!==e[a];if(s&&g){var h=a.substr(2).toLowerCase();"content"===h.substr(0,7)&&(h="content"+h.substr(7,1).toUpperCase()+h.substr(8)),e[a]&&(u[h]=e[a])}!s&&(e[a]!==i[a]||l&&e[a]!==t.getAttr(a))&&(c=!0,d[a]=e[a])}for(var h in c&&(t.setAttrs(d),id(t)),u)t.off(h+ia),t.on(h+ia,u[h])}function id(t){if(!c.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}var ic=i(88745);let iu={},ig={};t4.Node.prototype._applyProps=il;let ip=it.DefaultEventPriority;function im(t,e){"string"==typeof e?console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`):(t.add(e),id(t))}function i_(t,e,i){let r=t4[t];r||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}"  If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=t4.Group);let n={},a={};for(var s in e)"ref"!==s&&("on"===s.slice(0,2)?a[s]=e[s]:n[s]=e[s]);let o=new r(n);return il(o,a),o}function iy(t,e,i){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function iv(t,e,i){return!1}function ix(t){return t}function ib(){return null}function iS(){return null}
21function iw(t,e,i,r){return ig}function iC(){}function ik(t){}function iP(t,e){return!1}function iT(){return iu}function iA(){return iu}let iM=setTimeout,iR=clearTimeout,iE=!0,iG="function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve(null).then(t),iD=-1;function iL(t,e){return!1}let iI=!1,iO=!1,iF=!0,iB=!1,iN=!1;function iH(t,e){e.parent===t?e.moveToTop():t.add(e),id(t)}function iz(t,e){e.parent===t?e.moveToTop():t.add(e),id(t)}function iW(t,e,i){e._remove(),t.add(e),e.setZIndex(i.getZIndex()),id(t)}function iY(t,e,i){iW(t,e,i)}function ij(t,e){e.destroy(),e.off(ia),id(t)}function iX(t,e){e.destroy(),e.off(ia),id(t)}function iU(t,e,i){console.error(`Text components are not yet supported in ReactKonva. You text is: "${i}"`)}function iq(t,e,i){}function iK(t,e,i,r){il(t,r,i)}function iV(t){t.hide(),id(t)}function i$(t){}function iJ(t,e){(null==e.visible||e.visible)&&t.show()}function iQ(t,e){}function iZ(t){}function i0(){}function i1(){return null}function i2(){}function i5(){}function i3(){return it.DefaultEventPriority}function i4(){}function i8(){return null}function i6(t){ip=t}function i9(){return ip}function i7(){return it.DiscreteEventPriority}function rt(){return!1}function re(){}function ri(){return null}function rr(){return -1.1}function rn(){}function ra(){return!1}function rs(){return!0}function ro(){}function rh(){}function rl(){return null}let rd=null,rc=e6.createContext(null);function ru(){}function rg(t){try{return Object.defineProperties(t,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(e){return t}}"u">typeof window&&((null==(s=window.document)?void 0:s.createElement)||(null==(o=window.navigator)?void 0:o.product)==="ReactNative")?e6.useLayoutEffect:e6.useEffect;let rf=rg(e6.createContext(null));class rp extends e6.Component{render(){return e6.createElement(rf.Provider,{value:this._reactInternals},this.props.children)}}let rm=Symbol.for("react.context"),r_=t=>null!==t&&"object"==typeof t&&"$$typeof"in t&&t.$$typeof===rm;if(-1===e6.version.indexOf("19"))throw Error("react-konva version 19 is only compatible with React 19. Make sure to have the last version of react-konva and react or downgrade react-konva to version 18.");let ry=t=>{let e,i,r,n=e6.useRef(null),a=e6.useRef(null),s=e6.useRef(null),o=(e=e6.useRef({}),e6.useLayoutEffect(()=>{e.current=t}),e6.useLayoutEffect(()=>()=>{e.current={}},[]),e.current),h=(i=function(){let t=function(){let t=e6.useContext(rf);if(null===t)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let e=e6.useId();return e6.useMemo(()=>{for(let i of[t,null==t?void 0:t.alternate]){if(!i)continue;let t=function t(e,i,r){if(!e)return;if(!0===r(e))return e;let n=i?e.return:e.child;for(;n;){let e=t(n,i,r);if(e)return e;n=i?null:n.sibling}}(i,!1,t=>{let i=t.memoizedState;for(;i;){if(i.memoizedState===e)return!0;i=i.next}});if(t)return t}},[t,e])}(),[e]=e6.useState(()=>new Map);e.clear();let i=t;for(;i;){let t=i.type;r_(t)&&t!==rf&&!e.has(t)&&e.set(t,e6.use(rg(t))),i=i.return}return e}(),e6.useMemo(()=>Array.from(i.keys()).reduce((t,e)=>r=>e6.createElement(t,null,e6.createElement(e.Provider,{...r,value:i.get(e)})),t=>e6.createElement(rp,{...t})),[i])),l=e6.useRef(null),d=e=>{let{forwardedRef:i}=t;i&&("function"==typeof i?i(e):i.current=e)},c=(r=e6.useRef(0),e6.useMemo(()=>{r.current++},[]),r.current>1),u=()=>{d(null),rR.flushSyncFromReconciler(()=>{rR.updateContainer(null,s.current,null)}),a.current?.destroy(),a.current=null};return e6.useLayoutEffect(()=>(l.current&&(clearTimeout(l.current),l.current=null),a.current?d(a.current):(a.current=new t4.Stage({width:t.width,height:t.height,container:n.current}),d(a.current),s.current=rR.createContainer(a.current,it.ConcurrentRoot,null,!1,null,"",console.error,console.error,console.error,null),rR.updateContainer(e6.createElement(h,{},t.children),s.current,null,()=>{})),()=>{c?l.current=setTimeout(u,0):u()}),[]),e6.useLayoutEffect(()=>{d(a.current),il(a.current,t,o),rR.updateContainer(e6.createElement(h,{},t.children),s.current,null),rR.flushSyncWork()}),e6.createElement("div",{ref:n,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},rv="Layer",rx="Group",rb="Rect",rS="Circle",rw="Ellipse",rC="Line",rk="Image",rP="Text",rT="Arrow",rA="Shape",rM="Transformer",rR=e7()(h),rE=e6.forwardRef((t,e)=>e6.createElement(rp,{},e6.createElement(ry,{...t,forwardedRef:e})))},88745:(t,e,i)=>{t.exports=i(77930)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.