@gamelearn/arcade-components 3.7.0 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -68,7 +68,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
68
68
|
${x.feedback?"":"conversation--layer__defaultFeedback"}
|
|
69
69
|
${_==="results"?"conversation--layer__feedback":""}`,children:H}):H}function D({children:H}){return jsxRuntimeExports.jsx("div",{className:"popup--layer popup--layer--transparent",children:H})}function F({children:H}){var ee,q;let W={};return W=(ee=a.background)!=null&&ee.img?{backgroundImage:`url("${(q=a.background.img)==null?void 0:q.url}")`}:null,jsxRuntimeExports.jsxs("div",{className:`conversation ${t?"conversation--inScene":""}`,style:W,children:[jsxRuntimeExports.jsx(SlotList,{...T,children:H}),jsxRuntimeExports.jsx(DecisionBody,{...O})]})}function U(){return g?jsxRuntimeExports.jsx(F,{children:_==="results"&&x.feedback?jsxRuntimeExports.jsx(FeedBack,{question:f,soundActions:e,inherited:g,choice:x,rewards:x.rewards||[],emitEvent:o}):null}):jsxRuntimeExports.jsx(D,{children:jsxRuntimeExports.jsx(DecisionBody,{...O,children:jsxRuntimeExports.jsx(FeedBack,{question:f,soundActions:e,inherited:g,choice:x,rewards:x.rewards||[],emitEvent:o})})})}return jsxRuntimeExports.jsx(k,{children:jsxRuntimeExports.jsx(U,{})})}function ImageComponent({emitEvent:o,img:e,imgName:r,documentType:t,visible:n,viewed:a,imgId_labelId:l,soundActions:u,keyboardControl:f}){const d=p=>o({type:"translate",payload:p}),[h,y]=React$2.useState(!1),E=e.url,[g]=u,_=React$2.useCallback(()=>{g("click-ui"),o({type:"finishMedia",payload:{imgId:l,name:r,imgName:r,documentType:t,type:"image"}})},[g,l,r,t,o]);return f(null,a?null:_,a?null:_),React$2.useEffect(()=>{!n&&!h&&(y(!0),_())},[_,n,h]),n?jsxRuntimeExports.jsx("div",{className:a?"notes--results":"readings--container readings--container--darkopacity",children:jsxRuntimeExports.jsxs("div",{className:a?"notes--results__text":"readings readings--image",children:[E&&jsxRuntimeExports.jsx("img",{src:E,alt:r}),a?null:jsxRuntimeExports.jsx("div",{className:E?"readings--image--closeBtn":"position--absolute top right",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__round gat--btn__close",onClick:_,"aria-label":d("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})})]})}):null}function VoiceOver({name:o}){return jsxRuntimeExports.jsx("div",{className:"conversation--voice__over",children:jsxRuntimeExports.jsx("span",{children:o||"Voice-Over"})})}function ThinkFul({text:o}){return jsxRuntimeExports.jsxs("div",{className:"conversation--voice__over",children:[jsxRuntimeExports.jsx("span",{className:"icon-bubble-thinkful-black"}),jsxRuntimeExports.jsxs("span",{children:["[",o,"]"]})]})}function Message({current:o,translate:e}){var t,n;const r=o.text;return jsxRuntimeExports.jsxs("div",{className:`conversation--message ${o.voiceOver||(t=o==null?void 0:o.emotion)!=null&&t.includes("think")?"voice--over":""}`,children:[o.voiceOver?jsxRuntimeExports.jsx(VoiceOver,{name:o.name}):null,(n=o==null?void 0:o.emotion)!=null&&n.includes("think")?jsxRuntimeExports.jsx(ThinkFul,{text:e("emotion.thinking")}):null,jsxRuntimeExports.jsx("span",{className:"conversation--main__text",children:r})]})}Message.defaultProps={current:{},voiceOver:!1};const characterMs$3=75,minMs$1=1400;function ConversationalProComponent({keyboardControl:o,emitEvent:e,pause:r,lines:t,edges:n,characters:a,actors:l,background:u,soundActions:f,lodSettings:d,autoPlay:h,autoEnd:y,progress:E}){var Xe,gt,st;const g=(E==null?void 0:E.line)||0,[_,p]=React$2.useState(!1),[x,C]=React$2.useState(!0),[R,S]=React$2.useState(!!h),[A,T]=React$2.useState(!1),[P,w]=React$2.useState(g),[O,k]=React$2.useState(!1),[D]=f,{start:F,stop:U}=useTimeout(),H=((Xe=u==null?void 0:u.img)==null?void 0:Xe.url)||null,W=t[P],{voiceOver:ee,decision:q}=W;let{flex:B}=W,G=[];const I=!!n,$=ee||W.type==="conversationalNarration",V=q||W.type==="conversationalDecision",X=W.type==="conversationalCamera",[Q,J]=React$2.useState([]),ie=React$2.useMemo(()=>Q[Q.length-1],[Q]),ne=React$2.useCallback(()=>{const he=n.find(ye=>ye.fromId===ie)||n.find(ye=>ye.toId===ie),pe=t.find(ye=>ye.id===(he==null?void 0:he.fromId));return!ie&&(E==null?void 0:E.line)>=0?{decision:!0}:pe},[n,t,ie,E==null?void 0:E.line]),Z=React$2.useCallback(()=>{if(I){const pe=ne();return pe==null?void 0:pe.decision}const he=t[P-1]?t[P-1]:{};return P>0&&(he==null?void 0:he.decision)},[I,ne,t,P]),oe=React$2.useCallback(()=>{if(I){const pe=ne();return(pe==null?void 0:pe.type)==="conversationalCamera"}const he=t[P-1]?t[P-1]:{};return P>0&&(he==null?void 0:he.type)==="conversationalCamera"},[I,t,P,ne]),ae=React$2.useCallback(he=>e({type:"translate",payload:he}),[e]),ce=React$2.useMemo(()=>{var pe,ye;if(V)return{};if($)return W;const he=(pe=W==null?void 0:W.slots)==null?void 0:pe.find(Pe=>Pe.uid&&Pe.talking);return he||((ye=W==null?void 0:W.slots)==null?void 0:ye.find(Pe=>Pe.uid&&Pe.text))},[W,$,V]),fe=t.slice(0,P+1).reverse().find(he=>he.slots),de=!V&&((gt=W.slots)==null?void 0:gt.filter(he=>he.uid).length),xe=characterMs$3*(((st=ce==null?void 0:ce.text)==null?void 0:st.length)||0);let Oe=[];W.slots?Oe=W.slots:fe&&(Oe=fe.slots);const Te=Oe.filter(he=>he.uid).map(he=>{const pe=(a||l||[]).find(ye=>ye.uid===he.uid);return pe&&(he.resource=pe.resource,he.type=pe.type),he.resource||(he.resource={}),he}),We={characters:Te,lodSettings:d,actors:l,currentMessage:ce||{},slots:$?G:W.slots,flex:B,pause:r,emitEvent:e};if($){const he=t.slice(P).find(ye=>ye.slots),pe=fe||he;pe&&(G=pe.slots,B=pe.flex)}else if(!V&&de&&(W.slots.forEach(he=>{const pe=Te.findIndex(ye=>ye.uid===he.uid);pe>=0&&(Te[pe].emotion=he.emotion)}),ce&&ce.uid)){const he=W.slots.findIndex(ye=>ye.uid===ce.uid),pe=Te.findIndex(ye=>ye.uid===ce.uid);Te.forEach(ye=>{ye.uid===ce.uid&&(ye.name=ce.alias)}),ce.position=B?pe:he}const Be=React$2.useCallback(()=>{e({type:"success"})},[e]),qe=React$2.useCallback((he,pe)=>{const ye=[3,2,1][he.id],Le=n.filter(Ve=>Ve.fromId===W.id).find(Ve=>parseInt(Ve.fromPointIndex)===ye);if(Le){const Ve=t.findIndex(Ie=>Ie.id===Le.toId);Le.fromId===Le.toId?pe():Ve>=0?(w(Ve),e({type:"notifyProgress",payload:{line:Ve}})):Be()}else Be()},[W.id,n,e,Be,t]),ct=React$2.useCallback((he=!0)=>{const pe=he?["fromId","toId"]:["toId","fromId"],ye=n.filter(Ve=>Ve[pe[0]]===W.id),Pe=ye.length===1?ye[0]:ye.find(Ve=>Ve[pe[1]]===ie);if(!(Pe!=null&&Pe[pe[0]])){Be();return}he||J(Q.slice(0,-1));const Le=t.findIndex(Ve=>Ve.id===Pe[pe[1]]);Le>=0?(w(Le),e({type:"notifyProgress",payload:{line:Le}})):Be()},[W.id,n,Q,e,Be,ie,t]),vt=React$2.useCallback(he=>{if(I){if(he){const pe=[3,2,1][he.id],Pe=n.filter(Le=>Le.fromId===W.id).find(Le=>parseInt(Le.fromPointIndex)===pe);if(Pe){const Le=t.findIndex(Ve=>Ve.id===Pe.toId);Le>=0&&e({type:"notifyProgress",payload:{line:Le}})}else e({type:"saveNode"})}}else if(P<t.length-1){const ye=P+1;e({type:"notifyProgress",payload:{line:ye}})}else e({type:"saveNode"})},[n,t,e,P,W.id,I]),tt=React$2.useCallback((he,pe)=>{let ye=!1;if(k(!1),J([...Q,W.id]),C(!1),T(!1),I)he?qe(he,pe):ct();else if(P<t.length-1){const Le=P+1;w(Le),e({type:"notifyProgress",payload:{line:Le}})}else y||V||X?Be():ye=!0;ye||C(!0)},[Q,W.id,I,P,t.length,y,V,X,qe,ct,e,Be]),ht=()=>{if(C(!1),k(!1),T(!1),I)ct(!1);else if(!Z()){const he=P-1;w(he),e({type:"notifyProgress",payload:{line:he}})}C(!0)},Xt=React$2.useCallback(()=>I?W&&W.type!=="conversationalDecision"&&!n.find(he=>he.fromId===W.id):P===t.length-1,[P,W,n,I,t.length]),Pt=()=>{D("click-ui"),Xt()?Be():(S(!1),tt())},_t=()=>{D("click-ui"),S(!1),ht()},wt=R&&!V&&!r&&!X,Mt=React$2.useMemo(()=>P===0||Z()||oe(),[P,Z,oe]);if(useEkho({audioType:W==null?void 0:W.audioType,volume:W==null?void 0:W.audioVolume,voice:W==null?void 0:W.voice,started:x,slide:P,text:ce==null?void 0:ce.text,audio:W==null?void 0:W.audio,soundActions:f,emitEvent:e,pauseTTS:r,onStart:()=>{var he;(he=ce==null?void 0:ce.emotion)!=null&&he.includes("think")||k(!0)},onError:()=>{T(!0)},onFinish:()=>{k(!1),wt&&tt()}}),React$2.useEffect(()=>{var pe;let he;return V?()=>{}:(((W==null?void 0:W.audioType)==="none"||A)&&!((pe=ce==null?void 0:ce.emotion)!=null&&pe.includes("think"))&&(k(!0),he=setTimeout(()=>{k(!1)},xe<minMs$1?minMs$1:xe)),()=>{he&&clearTimeout(he)})},[A,W,ce==null?void 0:ce.emotion,xe,V]),React$2.useEffect(()=>(wt&&((W==null?void 0:W.audioType)==="none"||A)&&(!Xt()||Xt()&&y)&&F(tt,xe<minMs$1?minMs$1:xe),()=>{U()}),[ce,F,U,tt,W==null?void 0:W.audioType,wt,A,y,t,Xt,xe]),React$2.useEffect(()=>{if(X){const{targetUid:he}=W;e({type:"changeCamera",payload:{targetUid:he,transition:{type:"none"}}}),tt()}},[X,tt,e,W]),React$2.useEffect(()=>{if(I&&!_){const he=E==null?void 0:E.line;if(he>=0){p(!0),w(he);return}const pe=t.filter(ye=>!n.find(Pe=>Pe.toId===ye.id));if(pe.length){const ye=pe[0],Pe=t.indexOf(ye);Pe>=0&&(p(!0),w(Pe))}}},[n,I,t,_,E==null?void 0:E.line]),o(V||Mt?null:_t,V?null:Pt),V){const he={...W.payload,decisionNumber:t.filter(pe=>pe.decision).findIndex(pe=>pe.id===t[P].id)+1,required:!I,branched:I,onAddPoints:vt,onFinish:tt,keyboardControl:o,emitEvent:e,soundActions:f,inheritProps:{characters:Te,background:u,flex:fe?fe.flex:!0,slots:fe?fe.slots:[]}};return jsxRuntimeExports.jsx(DecisionComponent,{...he})}return jsxRuntimeExports.jsx("div",{className:"conversation--layer",children:jsxRuntimeExports.jsxs("div",{className:"conversation",style:H?{backgroundImage:`url("${H}")`}:null,children:[jsxRuntimeExports.jsx(SlotList,{...We,ttsStarted:O}),jsxRuntimeExports.jsxs("div",{className:"conversation--body",dir:"auto",children:[ce?jsxRuntimeExports.jsx(Message,{current:ce,translate:ae}):null,jsxRuntimeExports.jsxs("div",{className:"conversation--controls",children:[jsxRuntimeExports.jsx("button",{className:`gat--btn__round ${Mt?"disabled":""}`,disabled:Mt?!0:"",type:"button",onClick:_t,"aria-label":LangIsRtl()?ae("storylines.misc.forward"):ae("storylines.misc.rewind"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),jsxRuntimeExports.jsx("button",{className:`gat--btn__round ${R&&Xt()?"glowing-animation":""}`,type:"button",onClick:Pt,"aria-label":LangIsRtl()?ae("storylines.misc.rewind"):ae("storylines.misc.forward"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})]})]})})}ConversationalProComponent.defaultProps={background:{},emitEvent:()=>{},soundActions:[()=>{},()=>{}]};function ConversationalComponent({emitEvent:o,soundActions:e,messages:r,characters:t,alias:n,background:a,lodSettings:l}){var p;const[u,f]=React$2.useState(0),[d]=e,h=((p=a==null?void 0:a.img)==null?void 0:p.url)||null,y=r[u],E=t.map((x,C)=>({...x,name:n[C]?n[C]:x.name,uid:C})),g=()=>{const x=r.length-1;d("click-ui"),u+1<=x?f(u+1):o({type:"success"})},_=()=>{u>0&&(f(u-1),d("click-ui"))};return jsxRuntimeExports.jsx("div",{className:"conversation--layer",children:jsxRuntimeExports.jsxs("div",{className:"conversation arcade-conversation",style:h?{backgroundImage:`url("${h}")`}:{},children:[jsxRuntimeExports.jsx(SlotList,{characters:E,lodSettings:l,currentMessage:y,slots:E,emitEvent:o,flex:!0}),jsxRuntimeExports.jsxs("div",{className:"conversation--body",children:[y?jsxRuntimeExports.jsx(Message,{current:y,voiceOver:y.emotion===null}):jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsxs("div",{className:"conversation--controls arcade-conversation--controls",children:[jsxRuntimeExports.jsx("button",{className:`gat--btn__round ${u>0?"":"visibility--hidden"}`,type:"button",onClick:_,children:jsxRuntimeExports.jsx("span",{className:"icon-back"})}),jsxRuntimeExports.jsx("button",{className:"gat--btn__round",type:"button",onClick:g,children:jsxRuntimeExports.jsx("span",{className:"icon-next"})})]})]})]})})}function Vignette({vignette:o,alias:e,translate:r,backgroundImageCover:t}){var d;const a=(o.img||{url:"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg"}).url,[l,u]=React$2.useState(!0),f=h=>{document.querySelector(`#${h}`).focus(),u(!l)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`comic-image ${t?"comic-image--cover":""}`,children:a&&jsxRuntimeExports.jsx("img",{src:a,alt:"comic pic"})}),(d=o==null?void 0:o.textData)!=null&&d.text?jsxRuntimeExports.jsxs("div",{className:`comic-collapsable ${l?"comic-collapsable--opened":""}`,children:[jsxRuntimeExports.jsx("button",{id:"buttonDown",onClick:()=>f("buttonUp"),type:"button",className:"un-btn comic-collapsable__headertoggle","aria-label":r("comic.toggleText"),children:jsxRuntimeExports.jsx("span",{className:"icon-down-arrow"})}),jsxRuntimeExports.jsxs("div",{className:"comic-collapsable__text",children:[e?jsxRuntimeExports.jsxs("b",{children:[e,": "]}):null,o.textData.text]})]}):null,jsxRuntimeExports.jsx("button",{id:"buttonUp",tabIndex:l?"-1":"0","aria-hidden":l,className:`unset-button comic-buttonup
|
|
70
70
|
${l?"":"comic-buttonup--visible"}`,type:"button",onClick:()=>f("buttonDown"),"aria-label":r("comic.toggleText"),children:jsxRuntimeExports.jsx("span",{className:"icon-up-arrow"})})]})}function Slide({slide:o,transition:e,translate:r,backgroundImageCover:t}){const n=o.transitionEffects||e;return jsxRuntimeExports.jsx("div",{className:`comic-slide__item ${n}`,"aria-label":"comic slide item",children:o.vignettes.map(a=>jsxRuntimeExports.jsx(Vignette,{vignette:a,alias:o.alias,"aria-hidden":"true",translate:r,backgroundImageCover:t},`Vignete ${a.vignetteOrder}`))})}const characterMs$2=75;function ComicComponent({slides:o,emitEvent:e,soundActions:r=[()=>{},()=>{}],autoPlay:t,autoEnd:n,pause:a,progress:l,keyboardControl:u,backgroundImageCover:f=!1}){var W,ee,q,B,G,I,$,V;const d=(l==null?void 0:l.slide)||0,h=X=>e({type:"translate",payload:X}),[y,E]=React$2.useState(!0),[g,_]=React$2.useState(!!t),[p,x]=React$2.useState(!1),{start:C,stop:R}=useTimeout(),[S,A]=React$2.useState(d),[T,P]=React$2.useState("slide-animation"),[w]=r,O=o==null?void 0:o[S],k=React$2.useCallback(()=>{E(!1),e({type:"success"})},[e]),D=React$2.useCallback(()=>{if(E(!1),x(!1),S+1<o.length&&!a){const X=S+1;P("slide-animation"),A(X),E(!0),e({type:"notifyProgress",payload:{slide:X}})}else n&&!a&&k()},[S,o.length,a,n,e,k]),F=React$2.useCallback(()=>{if(E(!1),x(!1),S-1>=0){const X=S-1;P("slide-animation"),A(X),E(!0),w("click-ui"),e({type:"notifyProgress",payload:{slide:X}})}},[w,S,e]),U=()=>{w("click-ui"),_(!1),D()},H=()=>{w("click-ui"),_(!1),F()};return u(S>0?H:null,S+1>=o.length&&k||(S+1<o.length?U:null),S+1>=o.length?k:null),useEkho({audioType:(W=o==null?void 0:o[S])==null?void 0:W.audioType,voice:(ee=o==null?void 0:o[S])==null?void 0:ee.voice,text:(B=(q=o==null?void 0:o[S])==null?void 0:q.vignettes[0].textData)==null?void 0:B.text,audio:(G=o==null?void 0:o[S])==null?void 0:G.audio,slide:S,started:y,soundActions:r,emitEvent:e,pauseTTS:a,volume:(I=o==null?void 0:o[S])!=null&&I.audioVolume||(($=o==null?void 0:o[S])==null?void 0:$.audioVolume)===0?(V=o==null?void 0:o[S])==null?void 0:V.audioVolume:.5,onError:()=>{x(!0)},onFinish:()=>{g&&!(O!=null&&O.slideTimer)&&D()}}),React$2.useEffect(()=>{var X,Q;if(g){if(O!=null&&O.slideTimer)C(D,O.slideTimer*1e3);else if((O==null?void 0:O.audioType)==="none"&&!a||p&&!a){const J=characterMs$2*(((Q=(X=O==null?void 0:O.vignettes[0])==null?void 0:X.textData)==null?void 0:Q.text.length)||0);C(D,J<1400?1400:J)}}return()=>{R()}},[p,g,D,a,O==null?void 0:O.audio,O==null?void 0:O.audioType,O==null?void 0:O.slideTimer,O==null?void 0:O.vignettes,C,R]),o!=null&&o.length?jsxRuntimeExports.jsx("div",{dir:LangIsRtl()?"rtl":"auto",className:"comic component growIn-animation",role:"main","aria-label":"Comic",children:jsxRuntimeExports.jsxs("div",{className:"comic-slider",role:"navigation","aria-label":"Slider",children:[o[S]&&jsxRuntimeExports.jsx(Slide,{slide:o[S],transition:T,soundActions:r,emitEvent:e,role:"complementary","aria-hidden":"true",translate:h,backgroundImageCover:f},`comic page ${o[S].slideOrder}`),S>0&&jsxRuntimeExports.jsx("button",{type:"button",className:"comic-control comic-control--left gat--btn__round","data-testid":"btn-bck",onClick:H,"aria-label":LangIsRtl()?h("comic.next"):h("comic.previous"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),S<o.length&&jsxRuntimeExports.jsx("button",{type:"button",className:`comic-control comic-control--right gat--btn__round
|
|
71
|
-
${g&&S+1>=o.length?"glowing-animation":""}`,"data-testid":"btn-nxt",onClick:()=>{S+1<o.length?U():(w("click-ui"),k())},"aria-label":LangIsRtl()?h("comic.previous"):h("comic.next"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})}):null}const characterMs$1=75;function CartelComponent({img:o,text:e,audio:r,audioType:t,voice:n,emitEvent:a,soundActions:l,audioVolume:u,pause:f,keyboardControl:d,backgroundImageCover:h=!1,autoEnd:y=!1}){const E=P=>a({type:"translate",payload:P}),g=(o==null?void 0:o.url)||"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg",_=React$2.useRef(),p=React$2.useRef(),[x]=l,{start:C,stop:R}=useTimeout();useEkho({audioType:t,voice:n,text:e,audio:r,soundActions:l,emitEvent:a,volume:u,pauseTTS:f,onFinish:()=>{y&&S()}});const S=()=>{x("click-ui"),a({type:"success"})};d(null,S,S);const A=(P,w)=>window.matchMedia("(min-width: 1280px)").matches?w:P,T=React$2.useCallback(()=>{if(h!==!0&&e&&p.current){const P=p.current.naturalWidth/p.current.naturalHeight;let w=p.current.height*P,O=p.current.height;if(w>p.current.width&&(w=p.current.width,O=p.current.width/P),_.current.style.width=`${w}px`,window.innerHeight<p.current.width)_.current.style.bottom=`${A(24,48)+A(36,100)}px`;else{const k=(window.innerHeight-O)/2+A(36,100);_.current.style.bottom=`${k}px`}}},[h,e]);return React$2.useEffect(()=>{p.current&&new ResizeObserver(()=>A(24,48)&&T()).observe(p.current)}),React$2.useEffect(()=>{if(e&&y&&!f&&!r){const P=characterMs$1*(e.length||0);C(()=>{S()},P<1400?1400:P)}return()=>{R()}}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`cartel ${h?"cartel--cover":""}`,children:jsxRuntimeExports.jsxs("div",{className:"cartel__imagewrap",children:[jsxRuntimeExports.jsx("img",{ref:p,onLoad:T,className:"cartel__image",src:g,alt:"cartel pic"}),e?jsxRuntimeExports.jsx("div",{ref:_,className:"cartel__textwrap",children:jsxRuntimeExports.jsx("div",{className:"cartel__text",children:jsxRuntimeExports.jsx("span",{children:e})})}):null]})}),jsxRuntimeExports.jsx("div",{className:"position--absolute center right",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__round",onClick:()=>S(),"aria-label":E("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})})]})}var Typist$1={exports:{}};(function(o){o.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}return t.m=e,t.c=r,t.p="",t(0)}([function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=Object.assign||function(k){for(var D=1;D<arguments.length;D++){var F=arguments[D];for(var U in F)Object.prototype.hasOwnProperty.call(F,U)&&(k[U]=F[U])}return k},a=function(){function k(D,F){for(var U=0;U<F.length;U++){var H=F[U];H.enumerable=H.enumerable||!1,H.configurable=!0,"value"in H&&(H.writable=!0),Object.defineProperty(D,H.key,H)}}return function(D,F,U){return F&&k(D.prototype,F),U&&k(D,U),D}}(),l=t(1),u=S(l),f=t(2),d=S(f),h=t(10),y=S(h),E=t(12),g=S(E),_=t(13),p=S(_),x=t(14),C=R(x);function R(k){if(k&&k.__esModule)return k;var D={};if(k!=null)for(var F in k)Object.prototype.hasOwnProperty.call(k,F)&&(D[F]=k[F]);return D.default=k,D}function S(k){return k&&k.__esModule?k:{default:k}}function A(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")}function T(k,D){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:k}function P(k,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);k.prototype=Object.create(D&&D.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(k,D):k.__proto__=D)}var w=["🔙","⏰"],O=function(k){P(D,k);function D(F){A(this,D);var U=T(this,(D.__proto__||Object.getPrototypeOf(D)).call(this,F));return U.state={textLines:[],isDone:!1},U.onTypingDone=function(){U.mounted&&(U.setState({isDone:!0}),U.props.onTypingDone())},U.delayGenerator=function(H,W,ee,q){var B=U.props.avgTypingDelay,G=U.props.stdTypingDelay;return U.props.delayGenerator(B,G,{line:H,lineIdx:W,character:ee,charIdx:q,defDelayGenerator:function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:G;return C.gaussianRnd($,V)}})},U.typeLine=function(H,W){if(!U.mounted)return Promise.resolve();var ee=H,q=U.props.onLineTyped;return C.isBackspaceElement(H)?(H.props.delay>0&&(U.introducedDelay=H.props.delay),ee="🔙".repeat(H.props.count)):C.isDelayElement(H)&&(U.introducedDelay=H.props.ms,ee="⏰"),new Promise(function(B,G){U.setState({textLines:U.state.textLines.concat([""])},function(){C.eachPromise(ee,U.typeCharacter,ee,W).then(function(){return q(ee,W)}).then(B).catch(G)})})},U.typeCharacter=function(H,W,ee,q){if(!U.mounted)return Promise.resolve();var B=U.props.onCharacterTyped;return new Promise(function(G){var I=U.state.textLines.slice();C.sleep(U.introducedDelay).then(function(){U.introducedDelay=null;var $=H==="🔙",V=H==="⏰";if(V){G();return}if($&&q>0){for(var X=q-1,Q=I[X],J=X;J>=0&&!(Q.length>0&&!w.includes(Q[0]));J--)X=J,Q=I[X];I[X]=Q.substr(0,Q.length-1)}else I[q]+=H;U.setState({textLines:I},function(){var ie=U.delayGenerator(ee,q,H,W);B(H,W),setTimeout(G,ie)})})})},U.mounted=!1,U.linesToType=[],U.introducedDelay=null,F.children&&(U.linesToType=C.extractTextFromElement(F.children)),U}return a(D,[{key:"componentDidMount",value:function(){this.mounted=!0;var U=this.props,H=U.children,W=U.startDelay;H?W>0&&typeof window<"u"?setTimeout(this.typeAllLines.bind(this),W):this.typeAllLines():this.onTypingDone()}},{key:"shouldComponentUpdate",value:function(U,H){if(H.textLines.length!==this.state.textLines.length)return!0;for(var W=0;W<H.textLines.length;W++){var ee=this.state.textLines[W],q=H.textLines[W];if(ee!==q)return!0}return this.state.isDone!==H.isDone}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"typeAllLines",value:function(){var U=this,H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.linesToType;return C.eachPromise(H,this.typeLine).then(function(){return U.onTypingDone()})}},{key:"render",value:function(){var U=this.props,H=U.className,W=U.cursor,ee=this.state.isDone,q=C.cloneElementWithSpecifiedText({element:this.props.children,textLines:this.state.textLines});return u.default.createElement("div",{className:"Typist "+H},q,u.default.createElement(y.default,n({isDone:ee},W)))}}]),D}(l.Component);O.propTypes={children:d.default.node,className:d.default.string,avgTypingDelay:d.default.number,stdTypingDelay:d.default.number,startDelay:d.default.number,cursor:d.default.object,onCharacterTyped:d.default.func,onLineTyped:d.default.func,onTypingDone:d.default.func,delayGenerator:d.default.func},O.defaultProps={className:"",avgTypingDelay:70,stdTypingDelay:25,startDelay:0,cursor:{},onCharacterTyped:function(){},onLineTyped:function(){},onTypingDone:function(){},delayGenerator:C.gaussianRnd},r.default=O,O.Backspace=g.default,O.Delay=p.default},function(e,r){e.exports=React$2},function(e,r,t){if(process.env.NODE_ENV!=="production"){var n=typeof Symbol=="function"&&Symbol.for&&Symbol.for("react.element")||60103,a=function(u){return typeof u=="object"&&u!==null&&u.$$typeof===n},l=!0;e.exports=t(3)(a,l)}else e.exports=t(9)()},function(e,r,t){var n=t(4),a=t(5),l=t(6),u=t(7),f=t(8);e.exports=function(d,h){var y=typeof Symbol=="function"&&Symbol.iterator,E="@@iterator";function g(I){var $=I&&(y&&I[y]||I[E]);if(typeof $=="function")return $}var _="<<anonymous>>",p={array:S("array"),bool:S("boolean"),func:S("function"),number:S("number"),object:S("object"),string:S("string"),symbol:S("symbol"),any:A(),arrayOf:T,element:P(),instanceOf:w,node:F(),objectOf:k,oneOf:O,oneOfType:D,shape:U};function x(I,$){return I===$?I!==0||1/I===1/$:I!==I&&$!==$}function C(I){this.message=I,this.stack=""}C.prototype=Error.prototype;function R(I){if(process.env.NODE_ENV!=="production")var $={},V=0;function X(J,ie,ne,Z,oe,ae,ce){if(Z=Z||_,ae=ae||ne,ce!==u){if(h)a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var fe=Z+":"+ne;!$[fe]&&V<3&&(l(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",ae,Z),$[fe]=!0,V++)}}return ie[ne]==null?J?ie[ne]===null?new C("The "+oe+" `"+ae+"` is marked as required "+("in `"+Z+"`, but its value is `null`.")):new C("The "+oe+" `"+ae+"` is marked as required in "+("`"+Z+"`, but its value is `undefined`.")):null:I(ie,ne,Z,oe,ae)}var Q=X.bind(null,!1);return Q.isRequired=X.bind(null,!0),Q}function S(I){function $(V,X,Q,J,ie,ne){var Z=V[X],oe=ee(Z);if(oe!==I){var ae=q(Z);return new C("Invalid "+J+" `"+ie+"` of type "+("`"+ae+"` supplied to `"+Q+"`, expected ")+("`"+I+"`."))}return null}return R($)}function A(){return R(n.thatReturnsNull)}function T(I){function $(V,X,Q,J,ie){if(typeof I!="function")return new C("Property `"+ie+"` of component `"+Q+"` has invalid PropType notation inside arrayOf.");var ne=V[X];if(!Array.isArray(ne)){var Z=ee(ne);return new C("Invalid "+J+" `"+ie+"` of type "+("`"+Z+"` supplied to `"+Q+"`, expected an array."))}for(var oe=0;oe<ne.length;oe++){var ae=I(ne,oe,Q,J,ie+"["+oe+"]",u);if(ae instanceof Error)return ae}return null}return R($)}function P(){function I($,V,X,Q,J){var ie=$[V];if(!d(ie)){var ne=ee(ie);return new C("Invalid "+Q+" `"+J+"` of type "+("`"+ne+"` supplied to `"+X+"`, expected a single ReactElement."))}return null}return R(I)}function w(I){function $(V,X,Q,J,ie){if(!(V[X]instanceof I)){var ne=I.name||_,Z=G(V[X]);return new C("Invalid "+J+" `"+ie+"` of type "+("`"+Z+"` supplied to `"+Q+"`, expected ")+("instance of `"+ne+"`."))}return null}return R($)}function O(I){if(!Array.isArray(I))return process.env.NODE_ENV!=="production"&&l(!1,"Invalid argument supplied to oneOf, expected an instance of array."),n.thatReturnsNull;function $(V,X,Q,J,ie){for(var ne=V[X],Z=0;Z<I.length;Z++)if(x(ne,I[Z]))return null;var oe=JSON.stringify(I);return new C("Invalid "+J+" `"+ie+"` of value `"+ne+"` "+("supplied to `"+Q+"`, expected one of "+oe+"."))}return R($)}function k(I){function $(V,X,Q,J,ie){if(typeof I!="function")return new C("Property `"+ie+"` of component `"+Q+"` has invalid PropType notation inside objectOf.");var ne=V[X],Z=ee(ne);if(Z!=="object")return new C("Invalid "+J+" `"+ie+"` of type "+("`"+Z+"` supplied to `"+Q+"`, expected an object."));for(var oe in ne)if(ne.hasOwnProperty(oe)){var ae=I(ne,oe,Q,J,ie+"."+oe,u);if(ae instanceof Error)return ae}return null}return R($)}function D(I){if(!Array.isArray(I))return process.env.NODE_ENV!=="production"&&l(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),n.thatReturnsNull;for(var $=0;$<I.length;$++){var V=I[$];if(typeof V!="function")return l(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",B(V),$),n.thatReturnsNull}function X(Q,J,ie,ne,Z){for(var oe=0;oe<I.length;oe++){var ae=I[oe];if(ae(Q,J,ie,ne,Z,u)==null)return null}return new C("Invalid "+ne+" `"+Z+"` supplied to "+("`"+ie+"`."))}return R(X)}function F(){function I($,V,X,Q,J){return H($[V])?null:new C("Invalid "+Q+" `"+J+"` supplied to "+("`"+X+"`, expected a ReactNode."))}return R(I)}function U(I){function $(V,X,Q,J,ie){var ne=V[X],Z=ee(ne);if(Z!=="object")return new C("Invalid "+J+" `"+ie+"` of type `"+Z+"` "+("supplied to `"+Q+"`, expected `object`."));for(var oe in I){var ae=I[oe];if(ae){var ce=ae(ne,oe,Q,J,ie+"."+oe,u);if(ce)return ce}}return null}return R($)}function H(I){switch(typeof I){case"number":case"string":case"undefined":return!0;case"boolean":return!I;case"object":if(Array.isArray(I))return I.every(H);if(I===null||d(I))return!0;var $=g(I);if($){var V=$.call(I),X;if($!==I.entries){for(;!(X=V.next()).done;)if(!H(X.value))return!1}else for(;!(X=V.next()).done;){var Q=X.value;if(Q&&!H(Q[1]))return!1}}else return!1;return!0;default:return!1}}function W(I,$){return I==="symbol"||$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol}function ee(I){var $=typeof I;return Array.isArray(I)?"array":I instanceof RegExp?"object":W($,I)?"symbol":$}function q(I){if(typeof I>"u"||I===null)return""+I;var $=ee(I);if($==="object"){if(I instanceof Date)return"date";if(I instanceof RegExp)return"regexp"}return $}function B(I){var $=q(I);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function G(I){return!I.constructor||!I.constructor.name?_:I.constructor.name}return p.checkPropTypes=f,p.PropTypes=p,p}},function(e,r){function t(a){return function(){return a}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(a){return a},e.exports=n},function(e,r){var t=function(l){};process.env.NODE_ENV!=="production"&&(t=function(l){if(l===void 0)throw new Error("invariant requires an error message argument")});function n(a,l,u,f,d,h,y,E){if(t(l),!a){var g;if(l===void 0)g=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var _=[u,f,d,h,y,E],p=0;g=new Error(l.replace(/%s/g,function(){return _[p++]})),g.name="Invariant Violation"}throw g.framesToPop=1,g}}e.exports=n},function(e,r,t){var n=t(4),a=n;process.env.NODE_ENV!=="production"&&function(){var l=function(f){for(var d=arguments.length,h=Array(d>1?d-1:0),y=1;y<d;y++)h[y-1]=arguments[y];var E=0,g="Warning: "+f.replace(/%s/g,function(){return h[E++]});typeof console<"u"&&console.error(g);try{throw new Error(g)}catch{}};a=function(f,d){if(d===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(d.indexOf("Failed Composite propType: ")!==0&&!f){for(var h=arguments.length,y=Array(h>2?h-2:0),E=2;E<h;E++)y[E-2]=arguments[E];l.apply(void 0,[d].concat(y))}}}(),e.exports=a},function(e,r){var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=t},function(e,r,t){if(process.env.NODE_ENV!=="production")var n=t(5),a=t(6),l=t(7),u={};function f(d,h,y,E,g){if(process.env.NODE_ENV!=="production"){for(var _ in d)if(d.hasOwnProperty(_)){var p;try{n(typeof d[_]=="function","%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",E||"React class",y,_),p=d[_](h,_,E,y,null,l)}catch(C){p=C}if(a(!p||p instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",E||"React class",y,_,typeof p),p instanceof Error&&!(p.message in u)){u[p.message]=!0;var x=g?g():"";a(!1,"Failed %s type: %s%s",y,p.message,x??"")}}}}e.exports=f},function(e,r,t){var n=t(4),a=t(5),l=t(7);e.exports=function(){function u(h,y,E,g,_,p){p!==l&&a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}u.isRequired=u;function f(){return u}var d={array:u,bool:u,func:u,number:u,object:u,string:u,symbol:u,any:u,arrayOf:f,element:u,instanceOf:f,node:u,objectOf:f,oneOf:f,oneOfType:f,shape:f};return d.checkPropTypes=n,d.PropTypes=d,d}},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function _(p,x){for(var C=0;C<x.length;C++){var R=x[C];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(p,R.key,R)}}return function(p,x,C){return x&&_(p.prototype,x),C&&_(p,C),p}}(),a=t(1),l=d(a),u=t(2),f=d(u);t(11);function d(_){return _&&_.__esModule?_:{default:_}}function h(_,p){if(!(_ instanceof p))throw new TypeError("Cannot call a class as a function")}function y(_,p){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:_}function E(_,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);_.prototype=Object.create(p&&p.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(_,p):_.__proto__=p)}var g=function(_){E(p,_);function p(x){h(this,p);var C=y(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,x));return C._isReRenderingCursor=!1,C.state={shouldRender:C.props.show},C}return n(p,[{key:"componentWillReceiveProps",value:function(C){var R=this,S=!this.props.isDone&&C.isDone&&this.props.hideWhenDone;S&&setTimeout(function(){return R.setState({shouldRender:!1})},this.props.hideWhenDoneDelay)}},{key:"componentDidUpdate",value:function(){var C=this.props,R=C.show,S=C.isDone;R&&(S||this._isReRenderingCursor||this._reRenderCursor())}},{key:"_reRenderCursor",value:function(){var C=this;this._isReRenderingCursor=!0,this.setState({shouldRender:!1},function(){C.setState({shouldRender:!0},function(){C._isReRenderingCursor=!1})})}},{key:"render",value:function(){if(this.state.shouldRender){var C=this.props.blink?" Cursor--blinking":"";return l.default.createElement("span",{className:"Cursor"+C},this.props.element)}return null}}]),p}(a.Component);g.propTypes={blink:f.default.bool,show:f.default.bool,element:f.default.node,hideWhenDone:f.default.bool,hideWhenDoneDelay:f.default.number,isDone:f.default.bool},g.defaultProps={blink:!0,show:!0,element:"|",hideWhenDone:!1,hideWhenDoneDelay:1e3,isDone:!1},r.default=g},function(e,r){},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=t(1),a=f(n),l=t(2),u=f(l);function f(h){return h&&h.__esModule?h:{default:h}}var d=function(){return a.default.createElement("noscript",null)};d.componentName="Backspace",d.propTypes={count:u.default.number,delay:u.default.number},d.defaultProps={count:1,delay:0},r.default=d},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=t(1),a=f(n),l=t(2),u=f(l);function f(h){return h&&h.__esModule?h:{default:h}}var d=function(){return a.default.createElement("noscript",null)};d.componentName="Delay",d.propTypes={ms:u.default.number.isRequired},r.default=d},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.sleep=void 0;var n=function(){function R(S,A){var T=[],P=!0,w=!1,O=void 0;try{for(var k=S[Symbol.iterator](),D;!(P=(D=k.next()).done)&&(T.push(D.value),!(A&&T.length===A));P=!0);}catch(F){w=!0,O=F}finally{try{!P&&k.return&&k.return()}finally{if(w)throw O}}return T}return function(S,A){if(Array.isArray(S))return S;if(Symbol.iterator in Object(S))return R(S,A);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();r.gaussianRnd=d,r.eachPromise=h,r.exclude=y,r.isBackspaceElement=E,r.isDelayElement=g,r.extractTextFromElement=_,r.cloneElement=p,r.cloneElementWithSpecifiedText=C;var a=t(1),l=u(a);function u(R){return R&&R.__esModule?R:{default:R}}function f(R){if(Array.isArray(R)){for(var S=0,A=Array(R.length);S<R.length;S++)A[S]=R[S];return A}else return Array.from(R)}r.sleep=function(S){return new Promise(function(A){return S!=null?setTimeout(A,S):A()})};function d(R,S){for(var A=12,T=0,P=0;P<A;P++)T+=Math.random();return T-=A/2,Math.round(T*S)+R}function h(R,S){for(var A=arguments.length,T=Array(A>2?A-2:0),P=2;P<A;P++)T[P-2]=arguments[P];var w=function(k,D,F){return k.then(function(){return S.apply(void 0,[D,F].concat(T))})};return Array.from(R).reduce(w,Promise.resolve())}function y(R,S){var A={};for(var T in R)S.indexOf(T)===-1&&(A[T]=R[T]);return A}function E(R){return R&&R.type&&R.type.componentName==="Backspace"}function g(R){return R&&R.type&&R.type.componentName==="Delay"}function _(R){for(var S=R?[R]:[],A=[];S.length>0;){var T=S.pop();if(l.default.isValidElement(T))E(T)||g(T)?A.unshift(T):l.default.Children.forEach(T.props.children,function(U){S.push(U)});else if(Array.isArray(T)){var P=!0,w=!1,O=void 0;try{for(var k=T[Symbol.iterator](),D;!(P=(D=k.next()).done);P=!0){var F=D.value;S.push(F)}}catch(U){w=!0,O=U}finally{try{!P&&k.return&&k.return()}finally{if(w)throw O}}}else A.unshift(T)}return A}function p(R,S){var A=R.type,T=y(R.props,["children"]),P=new Date().getUTCMilliseconds(),w=P+Math.random()+Math.random();return T.key="Typist-element-"+A+"-"+w,l.default.createElement.apply(l.default,[A,T].concat(f(S)))}function x(R,S,A){if(A>=S.length)return[null,A];var T=A,P=function(F){var U=x(F,S,T),H=n(U,2),W=H[0],ee=H[1];return T=ee,W},w=l.default.isValidElement(R)&&!(E(R)||g(R));if(w){var O=l.default.Children.map(R.props.children,P)||[];return[p(R,O),T]}if(Array.isArray(R)){var k=R.map(P);return[k,T]}return[S[T],T+1]}function C(R){var S=R.element,A=R.textLines;if(S)return x(S,A,0)[0]}}])})(Typist$1);var TypistExports=Typist$1.exports;const Typist=getDefaultExportFromCjs(TypistExports),languages={js:["var rows = prompt('How many rows for your multiplication table?');","var cols = prompt('How many columns for your multiplication table?');"," ","if(rows == '' || rows == null)"," rows = 10;"," ","if(cols== '' || cols== null)"," cols = 10;"," ","createTable(rows, cols);"," ","function createTable(rows, cols)","{"," var j=1;"," var output = '<table border='1' width='500' cellspacing='0'cellpadding='5'>';"," "," for(i=1;i<=rows;i++)"," {"," output = output + '<tr>';"," while(j<=cols)"," {"," output = output + '<td>' + i*j + '</td>';"," j = j+1;"," }"," output = output + '</tr>';"," j = 1;"," }"," "," output = output + '</table>';"," document.write(output);","}"],lua:["-- Ensure that that the element at i is in the right position,","-- and return a closure which can be used for continuing the sort."," ","function quicksorter(i, vec, low, high)"," if low >= high then"," return quicksorter"," else -- low < high"," -- partition the vector and initialize the child closures"," local middle = partition(vec, low, high)"," local left, right = quicksorter"," ","-- Create the promise"," local function self(i, vec, low, high)"," if i < middle then"," left = left(i, vec, low, middle-1)"," return self"," elseif i > middle then"," right = right(i, vec, middle+1, high)"," return self"," end"," end"," ","-- Force the promise until i is in the right position"," return self(i, vec, low, high)"," end","end"," ","function lazysort(vec, low, high)"," local sorter = quicksorter"," return function(i)"," sorter = sorter(i, vec, low, high)"," return vec[i]"," end","end"],python:["#ask the user to enter four pieces of information"," ","firstname = input('Enter your first name: ')","surname = input('Enter your surname: ')","email = input('Enter your email: ')","yearsteaching = input('Enter the number of years teaching: ')"," ","file = open('staff.csv','r') #opens the file in read mode","found=False #sets whether the user is found to False"," ","for line in file: #reads each line in the file"," staff = line.split(',') #splits the line into the list called staff"," if staff[2] == email: #checks if the email entered is in the list"," found=True #if it is changes found to True"," ","file.close() #closes the file"," ","if found==True: #after the loop checks if the user is found"," print('Staff member already exists in the file') #displays on screen","else:"," #if the email was not in the file"," writefile=open('staff.csv','a') #open the file in append mode"," writefile.write(firstname + ',' + surname + ',' + email + ',' + yearsteaching) #write the new information to the file"," writefile.close() #close the file"," print('Staff member added to file')"]},themes={theme1:{bg:1,color:1,typo:2},theme2:{bg:3,color:2,typo:3},theme3:{bg:5,color:4,typo:1},theme4:{bg:1,color:3,typo:2},theme5:{bg:2,color:5,typo:1},theme6:{bg:5,color:6,typo:2},theme7:{bg:1,color:7,typo:3}};function ProgressBar({progress:o,type:e}){const r=languages[e];if(r){const t=r.reduce((l,u)=>(l.length?l.length:l)+u.length),n=Math.floor(o*100/t),a=n===100?"puzzle--hacker__percentage percentage--label":"puzzle--hacker__percentage";return jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__progress",children:jsxRuntimeExports.jsx("span",{className:"puzzle--hacker__progress--item",style:{width:`${Math.floor(o*100/t)}%`},children:jsxRuntimeExports.jsxs("span",{className:a,children:[n,"%"]})})})}return null}function Code({codeContainer:o}){const e=o,r=e.split("<br>");return r.length>0?r.map((t,n)=>{const a=t.replace(/ /g," ");return jsxRuntimeExports.jsx("p",{children:a},`line_${0+n}`)}):jsxRuntimeExports.jsx("p",{children:e})}function HackerPuzzleComponent({emitEvent:o,soundActions:e,info:r,themeNumber:t,type:n,writingSpeed:a,disableExit:l,setResolveAction:u}){const f=W=>o({type:"translate",payload:W}),[d]=e,{solution:h}=r,E=themes[`theme${t||1}`],[g,_]=React$2.useState(""),[p,x]=React$2.useState(0),[C,R]=React$2.useState(0),[S,A]=React$2.useState(!1),[T,P]=React$2.useState({start:0,end:0}),w=React$2.useRef(),O=React$2.useRef(),k=f("puzzle.hacker.congratulations"),D=(W,ee)=>W>ee.length?ee.length:W,F=()=>{d("click-ui");const{rewards:W}=h.right;o({type:"addPoints",complex:!0,finish:!0,payload:W}),o({type:"passPuzzle"})};React$2.useEffect(()=>{w.current.focus(),S&&l(!0)},[S]),React$2.useEffect(()=>{u(W=>{d("score"),A(!0),o({type:"hidePuzzleButtons",payload:!1}),W()})},[u]);const U=()=>{if(languages[n]&&!S){O.current&&(O.current.scrollTop=w.current.scrollHeight);const W=languages[n],ee=W[p],q=W.reduce((G,I)=>(G.length?G.length:G)+I.length),B=a>0?a:Math.floor(q/50)+p;if(ee){const G=ee.split(""),I=D(T.end,G),$=G.slice(T.start,I),V=g+$.join("");R(C+$.join("").length),_(V),I===G.length?p+1>=W.length?(d("score"),A(!0)):(x(p+1),_(`${g+$.join("")}<br>`),P({start:0,end:D(B,G)})):P({start:I,end:D(I+B,G)})}}},H=W=>{W.preventDefault(),U()};return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,"data-testid":"hacker",ref:w,onKeyDown:H,onTouchStart:H,className:`puzzle--hacker__container background-hacker-${E.bg}`,children:[jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__header",children:jsxRuntimeExports.jsx("span",{className:"title",children:"Console"})}),jsxRuntimeExports.jsxs("div",{className:`puzzle--hacker__body color-hacker-${E.color} typography-hacker-${E.typo}`,children:[jsxRuntimeExports.jsxs("div",{className:"puzzle--hacker__code",ref:O,children:[jsxRuntimeExports.jsx(Code,{codeContainer:g}),S?jsxRuntimeExports.jsxs(Typist,{avgTypingDelay:110,onCharacterTyped:()=>{O.current&&(O.current.scrollTop=w.current.scrollHeight)},cursor:{hideWhenDone:!0},className:"puzzle--hacker__result",children:[jsxRuntimeExports.jsx(Typist.Delay,{ms:300}),h.right.desc?`// ${h.right.desc}`:`${k}`]}):null]}),jsxRuntimeExports.jsx(ProgressBar,{type:n,progress:C})]}),S?jsxRuntimeExports.jsx("div",{className:"position--absolute bottom center",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary gat--btn__cracker",onClick:F,children:f("screens.continue")})}):null]})}HackerPuzzleComponent.defaultProps={type:"",writingSpeed:0,context:{},info:{},themeNumber:1};const imagenPorDefecto="https://min.gamelearn.io/css-resources/gamelearn/resources/puzzle-login-low.png";function LoginPuzzleComponent({emitEvent:o,soundActions:e,info:r,user:t,login:n,password:a,image:l,setResolveAction:u,nodeId:f}){var I;const d=$=>o({type:"translate",payload:$}),h=`login-puzzle_${f}`,y=LangIsRtl(),[E,g]=React$2.useState(""),[_,p]=React$2.useState(""),[x,C]=React$2.useState(!1),[R,S]=React$2.useState(""),[A,T]=React$2.useState(""),[P,w]=React$2.useState(!1),[O,k]=React$2.useState(!1),[D,F]=React$2.useState(!1),[U]=e,[H,W]=React$2.useState([]),ee=((I=l.img)==null?void 0:I.url)||imagenPorDefecto,q=()=>{const{rewards:$}=r.solution.right,V=[...H,...$];o({type:"addPoints",complex:!0,finish:!0,payload:V}),o({type:"passPuzzle"})},B=()=>{U("click-ui");const $={login:!0,password:!1};n&&($.login=t===E),$.password=a===_,$.login&&$.password?(T("success"),w(!0),k(!1),U("score"),setTimeout(()=>{q()},2e3)):(W([...H,...r.solution.wrong.rewards]),U("fail"),T("failed"),k(!0),o({type:"failPuzzle"}))},G=$=>{let V="";if($.length>=0){for(let X=0;X<$.length;X+=1)V+="•";S(V)}};return React$2.useEffect(()=>{u(()=>{const $=[...H,...r.resolve.rewards];F(!0),setTimeout(()=>{o({type:"hidePuzzleButtons",payload:!1}),o({type:"puzzleAction",action:"resolve",payload:{element:h,rewards:$,finish:!0}})},2e3)})},[H,r.resolve.rewards,o,u,h]),jsxRuntimeExports.jsx("div",{className:"puzzle--layer",style:{backgroundImage:`url("${ee}")`},children:jsxRuntimeExports.jsxs("div",{className:`puzzle--login ${t?"puzzle--login--withuser":""}`,children:[jsxRuntimeExports.jsx("span",{className:"icon-login-puzzle",children:" "}),jsxRuntimeExports.jsx("span",{className:"puzzle--login__title",children:d("puzzle.initSession")}),jsxRuntimeExports.jsxs("div",{children:[n&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:d("puzzle.user")}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[D?jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:P,"data-testid":"username",className:"puzzle--login__input success",type:"text",placeholder:t,value:t}):jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:P,"data-testid":"username",className:`puzzle--login__input ${A}`,type:"text",placeholder:d("puzzle.user"),onChange:$=>{g($.target.value),T(""),k(!1)}}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:jsxRuntimeExports.jsx("span",{children:d("puzzle.password")})}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[D?jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:!0,"data-testid":"password",className:"puzzle--login__input puzzle--login__input--fakepassword success",type:"text",placeholder:a,value:a,style:{opacity:1}}):jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:P,"data-testid":"password",className:`puzzle--login__input puzzle--login__input--fakepassword ${A}`,type:"text",placeholder:d("puzzle.password"),onFocus:()=>{C(!0)},onBlur:()=>{C(!1)},onChange:$=>{p($.target.value),G($.target.value),T(""),k(!1)}}),D?null:jsxRuntimeExports.jsx("div",{dir:y?"rtl":"auto",className:`login-fakepassword${x?" login-fakepassword--focus":""}${R.length?" login-fakepassword--fill":""} ${A||""}`,children:_?R:d("puzzle.password")}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]})]}),jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__primary ${_.length!==0&&!P?"":"disabled"}`,onClick:B,children:d("puzzle.loginIn")}),!D&&O&&r.solution.wrong.desc!==""&&jsxRuntimeExports.jsx("div",{className:"puzzle--login__label--error",children:r.solution.wrong.desc})]})})}function FeedbackComponent$1({text:o,success:e,playSound:r,additionalStyle:t,functionOnClose:n,secondText:a,translate:l,shortText:u,hasTimeout:f,delay:d,timeExpired:h,keyboardControl:y}){const[E,g]=React$2.useState();React$2.useEffect(()=>{let x;return r&&r(e?"score":"fail"),o&&!u&&(x=setTimeout(()=>{g(!0)},1e3)),()=>{x&&clearTimeout(x)}},[r,e,u,o]),React$2.useEffect(()=>{let x;return f&&n&&(x=setTimeout(n,d)),()=>{x&&clearTimeout(x)}},[d,n,f]);const _=()=>e?"success":"failed",p=()=>e?"icon-correct-thumb":h?"icon-times-up":"icon-incorrect-thumb";return y(null,o&&n&&E?n:null,o&&n&&E||n&&u?n:null),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:`feedback-layer ${E?"feedback-layer--withexplain":""}`,children:[jsxRuntimeExports.jsxs("div",{className:`feedback-layer__header ${u?"feedback-layer__header--in-shortText":""} ${t||""} ${_()}`,children:[a&&jsxRuntimeExports.jsxs("span",{className:"puzzle--terminal__visor--file",children:[jsxRuntimeExports.jsx("span",{className:`puzzle--terminal__icon ${t||""}`}),jsxRuntimeExports.jsx("span",{children:a})]}),jsxRuntimeExports.jsx("span",{className:"feedback-layer__maintitle",children:!o||!u?jsxRuntimeExports.jsx("div",{title:l(`tooltip.${e?"correct":"incorrect"}`),className:`${p()}`}):o}),u&&jsxRuntimeExports.jsx("button",{type:"button",className:"feedback-layer__closeX",onClick:()=>n(),"aria-label":l("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})]}),!u&&o!==""&&jsxRuntimeExports.jsx("div",{className:"feedback-layer__explainwrap",children:jsxRuntimeExports.jsxs("div",{className:"feedback-layer__explain",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:o}),o&&n&&E&&jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__navigation",onClick:()=>n(),"aria-label":l("storylines.misc.closePiece"),style:{display:"flex",margin:"auto",marginTop:"24px"},children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})})}FeedbackComponent$1.defaultProps={text:"",hasTimeout:!1,delay:3e3,success:!1};function KeyboardPuzzleComponent({emitEvent:o,image:e,password:r,keyboard:t,info:n,disableExit:a,soundActions:l,setResolveAction:u,nodeId:f,keyboardControl:d,styles:h="default-theme"}){var B,G;const[y,E]=React$2.useState(""),[g,_]=React$2.useState(""),[p,x]=React$2.useState(!1),[C,R]=React$2.useState(""),[S,A]=React$2.useState(!1),[T,P]=React$2.useState([]),w=I=>o({type:"translate",payload:I}),O=`keyboard-puzzle_${f}`,[k]=l,D=React$2.useCallback(I=>{x(!1),A(!1),o({type:"hidePuzzleButtons",payload:!1}),o({type:"addPoints",complex:!0,finish:!0,payload:I})},[o]),F=()=>{if(p){const{rewards:I}=n.solution.right,$=[...T,...I];k("score"),D($)}else o({type:"hidePuzzleButtons",payload:!1}),x(!1),a(!1),A(!1);R("")},U=I=>{I===r?(a(!1),E("success"),k("score"),o({type:"passPuzzle"}),x(!0),A(!0),n.solution.right.desc?R(n.solution.right.desc):setTimeout(()=>{const{rewards:$}=n.solution.right,V=[...T,...$];D(V)},3e3)):(A(!0),E("failed"),k("fail"),o({type:"failPuzzle"}),x(!1),P([...T,...n.solution.wrong.rewards]),o({type:"hidePuzzleButtons",payload:!1}),E(""),_(""),A(!0),n.solution.wrong.desc?R(n.solution.wrong.desc):setTimeout(()=>{F()},3e3))};React$2.useEffect(()=>{u(()=>{a(!1),k("score"),E("success"),x(!0),R(n.solution.right.desc),_(r);const I=[...T,...n.resolve.rewards];setTimeout(()=>{x(!1),A(!1),o({type:"hidePuzzleButtons",payload:!1}),o({type:"puzzleAction",action:"resolve",payload:{element:O,rewards:I,finish:!0}})},2e3)})},[u,a,n.solution.right.desc,k,n.resolve.rewards,T,r,o,O]);const H=(I,$)=>{const V=t[I][$];k("click-ui"),g.length<r.length+1&&(_(g+V),g.length+1===r.length&&U(g+V))},W=()=>{k("click-ui"),_(g.substring(0,g.length-1))},q={backgroundImage:`url("${((B=e.img)==null?void 0:B.url)||""}")`,backgroudPosition:"center center"};return jsxRuntimeExports.jsxs("div",{className:`puzzle-keyboard puzzle-keyboard--${h}`,style:(G=e.img)!=null&&G.url?q:null,children:[jsxRuntimeExports.jsx("div",{className:"puzzle-keyboard__header",children:jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__digits",children:[r.split("").map((I,$)=>jsxRuntimeExports.jsx("div",{className:`puzzle-keyboard__digit ${y}`,children:g.split("")[$]?g.split("")[$]:""},`${I+$}`)),y!==""?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:y==="success"?jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-check-circle"}):jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-error-circle"})}):jsxRuntimeExports.jsx("button",{type:"button",onClick:W,className:"puzzle-keyboard__positionatedToDigits puzzle-keyboard__delete","aria-label":w("puzzles.keyboard-puzzle.deleteButton"),children:jsxRuntimeExports.jsx("span",{className:"icon-delete-key-2023"})})]})}),jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__keypad",children:[h==="scifi-theme"&&jsxRuntimeExports.jsx("div",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-notch",children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{fill:"none",fillRule:"evenodd",children:[jsxRuntimeExports.jsxs("g",{transform:"translate(3 3)",children:[jsxRuntimeExports.jsx("circle",{fill:"#1E282F",cx:"5",cy:"5",r:"5"}),jsxRuntimeExports.jsx("path",{d:"M1.48 8.55a5 5 0 1 0 7.008-7.133",fillOpacity:".096",fill:"#1DDDD8"}),jsxRuntimeExports.jsx("circle",{fill:"#1DDDD8",opacity:".359",cx:"3",cy:"3",r:"2"})]}),jsxRuntimeExports.jsx("circle",{stroke:"#1E282F",cx:"8",cy:"8",r:"7.5"})]})})})}),jsxRuntimeExports.jsx("div",{className:`keyboard-keys keyboard-keys--${h}`,children:t.map((I,$)=>(Array.isArray(I)?I:Object.values(I)).map((V,X)=>jsxRuntimeExports.jsx("button",{className:`keyboard-key keyboard-key--${h} ${V==="*"?"keyboard-key--star":""}`,type:"button",onClick:()=>H($,X),children:jsxRuntimeExports.jsx("div",{children:V})},V)))}),h==="scifi-theme"&&jsxRuntimeExports.jsx("hr",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-line"})]}),S&&jsxRuntimeExports.jsx(FeedbackComponent$1,{translate:w,text:C,success:p,functionOnClose:F,keyboardControl:d})]})}var lib$1={exports:{}},_FullInternals={},_CoreInternals={},Global={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o._registerNode=o.Konva=o.glob=void 0;const e=Math.PI/180;function r(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}o.glob=typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},o.Konva={_global:o.glob,version:"9.3.0",isBrowser:r(),isUnminified:/param/.test((function(n){}).toString()),dblClickWindow:400,getAngle(n){return o.Konva.angleDeg?n*e:n},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return o.Konva.DD.isDragging},isDragReady(){return!!o.Konva.DD.node},releaseCanvasOnDestroy:!0,document:o.glob.document,_injectGlobal(n){o.glob.Konva=n}};const t=n=>{o.Konva[n.prototype.getClassName()]=n};o._registerNode=t,o.Konva._injectGlobal(o.Konva)})(Global);var Util={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Util=o.Transform=void 0;const e=Global;class r{constructor(A=[1,0,0,1,0,0]){this.dirty=!1,this.m=A&&A.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new r(this.m)}copyInto(A){A.m[0]=this.m[0],A.m[1]=this.m[1],A.m[2]=this.m[2],A.m[3]=this.m[3],A.m[4]=this.m[4],A.m[5]=this.m[5]}point(A){var T=this.m;return{x:T[0]*A.x+T[2]*A.y+T[4],y:T[1]*A.x+T[3]*A.y+T[5]}}translate(A,T){return this.m[4]+=this.m[0]*A+this.m[2]*T,this.m[5]+=this.m[1]*A+this.m[3]*T,this}scale(A,T){return this.m[0]*=A,this.m[1]*=A,this.m[2]*=T,this.m[3]*=T,this}rotate(A){var T=Math.cos(A),P=Math.sin(A),w=this.m[0]*T+this.m[2]*P,O=this.m[1]*T+this.m[3]*P,k=this.m[0]*-P+this.m[2]*T,D=this.m[1]*-P+this.m[3]*T;return this.m[0]=w,this.m[1]=O,this.m[2]=k,this.m[3]=D,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(A,T){var P=this.m[0]+this.m[2]*T,w=this.m[1]+this.m[3]*T,O=this.m[2]+this.m[0]*A,k=this.m[3]+this.m[1]*A;return this.m[0]=P,this.m[1]=w,this.m[2]=O,this.m[3]=k,this}multiply(A){var T=this.m[0]*A.m[0]+this.m[2]*A.m[1],P=this.m[1]*A.m[0]+this.m[3]*A.m[1],w=this.m[0]*A.m[2]+this.m[2]*A.m[3],O=this.m[1]*A.m[2]+this.m[3]*A.m[3],k=this.m[0]*A.m[4]+this.m[2]*A.m[5]+this.m[4],D=this.m[1]*A.m[4]+this.m[3]*A.m[5]+this.m[5];return this.m[0]=T,this.m[1]=P,this.m[2]=w,this.m[3]=O,this.m[4]=k,this.m[5]=D,this}invert(){var A=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),T=this.m[3]*A,P=-this.m[1]*A,w=-this.m[2]*A,O=this.m[0]*A,k=A*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),D=A*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=T,this.m[1]=P,this.m[2]=w,this.m[3]=O,this.m[4]=k,this.m[5]=D,this}getMatrix(){return this.m}decompose(){var A=this.m[0],T=this.m[1],P=this.m[2],w=this.m[3],O=this.m[4],k=this.m[5],D=A*w-T*P;let F={x:O,y:k,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(A!=0||T!=0){var U=Math.sqrt(A*A+T*T);F.rotation=T>0?Math.acos(A/U):-Math.acos(A/U),F.scaleX=U,F.scaleY=D/U,F.skewX=(A*P+T*w)/D,F.skewY=0}else if(P!=0||w!=0){var H=Math.sqrt(P*P+w*w);F.rotation=Math.PI/2-(w>0?Math.acos(-P/H):-Math.acos(P/H)),F.scaleX=D/H,F.scaleY=H,F.skewX=0,F.skewY=(A*P+T*w)/D}return F.rotation=o.Util._getRotation(F.rotation),F}}o.Transform=r;var t="[object Array]",n="[object Number]",a="[object String]",l="[object Boolean]",u=Math.PI/180,f=180/Math.PI,d="#",h="",y="0",E="Konva warning: ",g="Konva error: ",_="rgb(",p={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})\)/,C=[];const R=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(S){setTimeout(S,60)};o.Util={_isElement(S){return!!(S&&S.nodeType==1)},_isFunction(S){return!!(S&&S.constructor&&S.call&&S.apply)},_isPlainObject(S){return!!S&&S.constructor===Object},_isArray(S){return Object.prototype.toString.call(S)===t},_isNumber(S){return Object.prototype.toString.call(S)===n&&!isNaN(S)&&isFinite(S)},_isString(S){return Object.prototype.toString.call(S)===a},_isBoolean(S){return Object.prototype.toString.call(S)===l},isObject(S){return S instanceof Object},isValidSelector(S){if(typeof S!="string")return!1;var A=S[0];return A==="#"||A==="."||A===A.toUpperCase()},_sign(S){return S===0||S>0?1:-1},requestAnimFrame(S){C.push(S),C.length===1&&R(function(){const A=C;C=[],A.forEach(function(T){T()})})},createCanvasElement(){var S=document.createElement("canvas");try{S.style=S.style||{}}catch{}return S},createImageElement(){return document.createElement("img")},_isInDocument(S){for(;S=S.parentNode;)if(S==document)return!0;return!1},_urlToImage(S,A){var T=o.Util.createImageElement();T.onload=function(){A(T)},T.src=S},_rgbToHex(S,A,T){return((1<<24)+(S<<16)+(A<<8)+T).toString(16).slice(1)},_hexToRgb(S){S=S.replace(d,h);var A=parseInt(S,16);return{r:A>>16&255,g:A>>8&255,b:A&255}},getRandomColor(){for(var S=(Math.random()*16777215<<0).toString(16);S.length<6;)S=y+S;return d+S},getRGB(S){var A;return S in p?(A=p[S],{r:A[0],g:A[1],b:A[2]}):S[0]===d?this._hexToRgb(S.substring(1)):S.substr(0,4)===_?(A=x.exec(S.replace(/ /g,"")),{r:parseInt(A[1],10),g:parseInt(A[2],10),b:parseInt(A[3],10)}):{r:0,g:0,b:0}},colorToRGBA(S){return S=S||"black",o.Util._namedColorToRBA(S)||o.Util._hex3ColorToRGBA(S)||o.Util._hex4ColorToRGBA(S)||o.Util._hex6ColorToRGBA(S)||o.Util._hex8ColorToRGBA(S)||o.Util._rgbColorToRGBA(S)||o.Util._rgbaColorToRGBA(S)||o.Util._hslColorToRGBA(S)},_namedColorToRBA(S){var A=p[S.toLowerCase()];return A?{r:A[0],g:A[1],b:A[2],a:1}:null},_rgbColorToRGBA(S){if(S.indexOf("rgb(")===0){S=S.match(/rgb\(([^)]+)\)/)[1];var A=S.split(/ *, */).map(Number);return{r:A[0],g:A[1],b:A[2],a:1}}},_rgbaColorToRGBA(S){if(S.indexOf("rgba(")===0){S=S.match(/rgba\(([^)]+)\)/)[1];var A=S.split(/ *, */).map((T,P)=>T.slice(-1)==="%"?P===3?parseInt(T)/100:parseInt(T)/100*255:Number(T));return{r:A[0],g:A[1],b:A[2],a:A[3]}}},_hex8ColorToRGBA(S){if(S[0]==="#"&&S.length===9)return{r:parseInt(S.slice(1,3),16),g:parseInt(S.slice(3,5),16),b:parseInt(S.slice(5,7),16),a:parseInt(S.slice(7,9),16)/255}},_hex6ColorToRGBA(S){if(S[0]==="#"&&S.length===7)return{r:parseInt(S.slice(1,3),16),g:parseInt(S.slice(3,5),16),b:parseInt(S.slice(5,7),16),a:1}},_hex4ColorToRGBA(S){if(S[0]==="#"&&S.length===5)return{r:parseInt(S[1]+S[1],16),g:parseInt(S[2]+S[2],16),b:parseInt(S[3]+S[3],16),a:parseInt(S[4]+S[4],16)/255}},_hex3ColorToRGBA(S){if(S[0]==="#"&&S.length===4)return{r:parseInt(S[1]+S[1],16),g:parseInt(S[2]+S[2],16),b:parseInt(S[3]+S[3],16),a:1}},_hslColorToRGBA(S){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(S)){const[A,...T]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(S),P=Number(T[0])/360,w=Number(T[1])/100,O=Number(T[2])/100;let k,D,F;if(w===0)return F=O*255,{r:Math.round(F),g:Math.round(F),b:Math.round(F),a:1};O<.5?k=O*(1+w):k=O+w-O*w;const U=2*O-k,H=[0,0,0];for(let W=0;W<3;W++)D=P+1/3*-(W-1),D<0&&D++,D>1&&D--,6*D<1?F=U+(k-U)*6*D:2*D<1?F=k:3*D<2?F=U+(k-U)*(2/3-D)*6:F=U,H[W]=F*255;return{r:Math.round(H[0]),g:Math.round(H[1]),b:Math.round(H[2]),a:1}}},haveIntersection(S,A){return!(A.x>S.x+S.width||A.x+A.width<S.x||A.y>S.y+S.height||A.y+A.height<S.y)},cloneObject(S){var A={};for(var T in S)this._isPlainObject(S[T])?A[T]=this.cloneObject(S[T]):this._isArray(S[T])?A[T]=this.cloneArray(S[T]):A[T]=S[T];return A},cloneArray(S){return S.slice(0)},degToRad(S){return S*u},radToDeg(S){return S*f},_degToRad(S){return o.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),o.Util.degToRad(S)},_radToDeg(S){return o.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),o.Util.radToDeg(S)},_getRotation(S){return e.Konva.angleDeg?o.Util.radToDeg(S):S},_capitalize(S){return S.charAt(0).toUpperCase()+S.slice(1)},throw(S){throw new Error(g+S)},error(S){console.error(g+S)},warn(S){e.Konva.showWarnings&&console.warn(E+S)},each(S,A){for(var T in S)A(T,S[T])},_inRange(S,A,T){return A<=S&&S<T},_getProjectionToSegment(S,A,T,P,w,O){var k,D,F,U=(S-T)*(S-T)+(A-P)*(A-P);if(U==0)k=S,D=A,F=(w-T)*(w-T)+(O-P)*(O-P);else{var H=((w-S)*(T-S)+(O-A)*(P-A))/U;H<0?(k=S,D=A,F=(S-w)*(S-w)+(A-O)*(A-O)):H>1?(k=T,D=P,F=(T-w)*(T-w)+(P-O)*(P-O)):(k=S+H*(T-S),D=A+H*(P-A),F=(k-w)*(k-w)+(D-O)*(D-O))}return[k,D,F]},_getProjectionToLine(S,A,T){var P=o.Util.cloneObject(S),w=Number.MAX_VALUE;return A.forEach(function(O,k){if(!(!T&&k===A.length-1)){var D=A[(k+1)%A.length],F=o.Util._getProjectionToSegment(O.x,O.y,D.x,D.y,S.x,S.y),U=F[0],H=F[1],W=F[2];W<w&&(P.x=U,P.y=H,w=W)}}),P},_prepareArrayForTween(S,A,T){var P,w=[],O=[];if(S.length>A.length){var k=A;A=S,S=k}for(P=0;P<S.length;P+=2)w.push({x:S[P],y:S[P+1]});for(P=0;P<A.length;P+=2)O.push({x:A[P],y:A[P+1]});var D=[];return O.forEach(function(F){var U=o.Util._getProjectionToLine(F,w,T);D.push(U.x),D.push(U.y)}),D},_prepareToStringify(S){var A;S.visitedByCircularReferenceRemoval=!0;for(var T in S)if(S.hasOwnProperty(T)&&S[T]&&typeof S[T]=="object"){if(A=Object.getOwnPropertyDescriptor(S,T),S[T].visitedByCircularReferenceRemoval||o.Util._isElement(S[T]))if(A.configurable)delete S[T];else return null;else if(o.Util._prepareToStringify(S[T])===null)if(A.configurable)delete S[T];else return null}return delete S.visitedByCircularReferenceRemoval,S},_assign(S,A){for(var T in A)S[T]=A[T];return S},_getFirstPointerId(S){return S.touches?S.changedTouches[0].identifier:S.pointerId||999},releaseCanvas(...S){e.Konva.releaseCanvasOnDestroy&&S.forEach(A=>{A.width=0,A.height=0})},drawRoundedRectPath(S,A,T,P){let w=0,O=0,k=0,D=0;typeof P=="number"?w=O=k=D=Math.min(P,A/2,T/2):(w=Math.min(P[0]||0,A/2,T/2),O=Math.min(P[1]||0,A/2,T/2),D=Math.min(P[2]||0,A/2,T/2),k=Math.min(P[3]||0,A/2,T/2)),S.moveTo(w,0),S.lineTo(A-O,0),S.arc(A-O,O,O,Math.PI*3/2,0,!1),S.lineTo(A,T-D),S.arc(A-D,T-D,D,0,Math.PI/2,!1),S.lineTo(k,T),S.arc(k,T-k,k,Math.PI/2,Math.PI,!1),S.lineTo(0,w),S.arc(w,w,w,Math.PI,Math.PI*3/2,!1)}}})(Util);var Node$1={},Factory={},Validators={};Object.defineProperty(Validators,"__esModule",{value:!0});Validators.getComponentValidator=Validators.getBooleanValidator=Validators.getNumberArrayValidator=Validators.getFunctionValidator=Validators.getStringOrGradientValidator=Validators.getStringValidator=Validators.getNumberOrAutoValidator=Validators.getNumberOrArrayOfNumbersValidator=Validators.getNumberValidator=Validators.alphaComponent=Validators.RGBComponent=void 0;const Global_1$p=Global,Util_1$f=Util;function _formatValue(o){return Util_1$f.Util._isString(o)?'"'+o+'"':Object.prototype.toString.call(o)==="[object Number]"||Util_1$f.Util._isBoolean(o)?o:Object.prototype.toString.call(o)}function RGBComponent(o){return o>255?255:o<0?0:Math.round(o)}Validators.RGBComponent=RGBComponent;function alphaComponent(o){return o>1?1:o<1e-4?1e-4:o}Validators.alphaComponent=alphaComponent;function getNumberValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){return Util_1$f.Util._isNumber(o)||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),o}}Validators.getNumberValidator=getNumberValidator;function getNumberOrArrayOfNumbersValidator(o){if(Global_1$p.Konva.isUnminified)return function(e,r){let t=Util_1$f.Util._isNumber(e),n=Util_1$f.Util._isArray(e)&&e.length==o;return!t&&!n&&Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array<number>('+o+")"),e}}Validators.getNumberOrArrayOfNumbersValidator=getNumberOrArrayOfNumbersValidator;function getNumberOrAutoValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){var r=Util_1$f.Util._isNumber(o),t=o==="auto";return r||t||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),o}}Validators.getNumberOrAutoValidator=getNumberOrAutoValidator;function getStringValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){return Util_1$f.Util._isString(o)||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),o}}Validators.getStringValidator=getStringValidator;function getStringOrGradientValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){const r=Util_1$f.Util._isString(o),t=Object.prototype.toString.call(o)==="[object CanvasGradient]"||o&&o.addColorStop;return r||t||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),o}}Validators.getStringOrGradientValidator=getStringOrGradientValidator;function getFunctionValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){return Util_1$f.Util._isFunction(o)||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),o}}Validators.getFunctionValidator=getFunctionValidator;function getNumberArrayValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&o instanceof r||(Util_1$f.Util._isArray(o)?o.forEach(function(t){Util_1$f.Util._isNumber(t)||Util_1$f.Util.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}):Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),o}}Validators.getNumberArrayValidator=getNumberArrayValidator;function getBooleanValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){var r=o===!0||o===!1;return r||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),o}}Validators.getBooleanValidator=getBooleanValidator;function getComponentValidator(o){if(Global_1$p.Konva.isUnminified)return function(e,r){return e==null||Util_1$f.Util.isObject(e)||Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+o),e}}Validators.getComponentValidator=getComponentValidator;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Factory=void 0;const e=Util,r=Validators;var t="get",n="set";o.Factory={addGetterSetter(a,l,u,f,d){o.Factory.addGetter(a,l,u),o.Factory.addSetter(a,l,f,d),o.Factory.addOverloadedGetterSetter(a,l)},addGetter(a,l,u){var f=t+e.Util._capitalize(l);a.prototype[f]=a.prototype[f]||function(){var d=this.attrs[l];return d===void 0?u:d}},addSetter(a,l,u,f){var d=n+e.Util._capitalize(l);a.prototype[d]||o.Factory.overWriteSetter(a,l,u,f)},overWriteSetter(a,l,u,f){var d=n+e.Util._capitalize(l);a.prototype[d]=function(h){return u&&h!==void 0&&h!==null&&(h=u.call(this,h,l)),this._setAttr(l,h),f&&f.call(this),this}},addComponentsGetterSetter(a,l,u,f,d){var h=u.length,y=e.Util._capitalize,E=t+y(l),g=n+y(l),_,p;a.prototype[E]=function(){var C={};for(_=0;_<h;_++)p=u[_],C[p]=this.getAttr(l+y(p));return C};var x=(0,r.getComponentValidator)(u);a.prototype[g]=function(C){var R=this.attrs[l],S;f&&(C=f.call(this,C)),x&&x.call(this,C,l);for(S in C)C.hasOwnProperty(S)&&this._setAttr(l+y(S),C[S]);return C||u.forEach(A=>{this._setAttr(l+y(A),void 0)}),this._fireChangeEvent(l,R,C),d&&d.call(this),this},o.Factory.addOverloadedGetterSetter(a,l)},addOverloadedGetterSetter(a,l){var u=e.Util._capitalize(l),f=n+u,d=t+u;a.prototype[l]=function(){return arguments.length?(this[f](arguments[0]),this):this[d]()}},addDeprecatedGetterSetter(a,l,u,f){e.Util.error("Adding deprecated "+l);var d=t+e.Util._capitalize(l),h=l+" property is deprecated and will be removed soon. Look at Konva change log for more information.";a.prototype[d]=function(){e.Util.error(h);var y=this.attrs[l];return y===void 0?u:y},o.Factory.addSetter(a,l,f,function(){e.Util.error(h)}),o.Factory.addOverloadedGetterSetter(a,l)},backCompat(a,l){e.Util.each(l,function(u,f){var d=a.prototype[f],h=t+e.Util._capitalize(u),y=n+e.Util._capitalize(u);function E(){d.apply(this,arguments),e.Util.error('"'+u+'" method is deprecated and will be removed soon. Use ""'+f+'" instead.')}a.prototype[u]=E,a.prototype[h]=E,a.prototype[y]=E})},afterSetFilter(){this._filterUpToDate=!1}}})(Factory);var Canvas$1={},Context$2={};Object.defineProperty(Context$2,"__esModule",{value:!0});Context$2.HitContext=Context$2.SceneContext=Context$2.Context=void 0;const Util_1$e=Util,Global_1$o=Global;function simplifyArray(o){var e=[],r=o.length,t=Util_1$e.Util,n,a;for(n=0;n<r;n++)a=o[n],t._isNumber(a)?a=Math.round(a*1e3)/1e3:t._isString(a)||(a=a+""),e.push(a);return e}var COMMA=",",OPEN_PAREN="(",CLOSE_PAREN=")",OPEN_PAREN_BRACKET="([",CLOSE_BRACKET_PAREN="])",SEMICOLON=";",DOUBLE_PAREN="()",EQUALS="=",CONTEXT_METHODS=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],CONTEXT_PROPERTIES=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const traceArrMax=100;let Context$1=class{constructor(e){this.canvas=e,Global_1$o.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,r){var t=this.traceArr,n=t.length,a="",l,u,f,d;for(l=0;l<n;l++)u=t[l],f=u.method,f?(d=u.args,a+=f,e?a+=DOUBLE_PAREN:Util_1$e.Util._isArray(d[0])?a+=OPEN_PAREN_BRACKET+d.join(COMMA)+CLOSE_BRACKET_PAREN:(r&&(d=d.map(h=>typeof h=="number"?Math.floor(h):h)),a+=OPEN_PAREN+d.join(COMMA)+CLOSE_PAREN)):(a+=u.property,e||(a+=EQUALS+u.val)),a+=SEMICOLON;return a}clearTrace(){this.traceArr=[]}_trace(e){var r=this.traceArr,t;r.push(e),t=r.length,t>=traceArrMax&&r.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var r=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,r.getWidth()/r.pixelRatio,r.getHeight()/r.pixelRatio)}_applyLineCap(e){const r=e.attrs.lineCap;r&&this.setAttr("lineCap",r)}_applyOpacity(e){var r=e.getAbsoluteOpacity();r!==1&&this.setAttr("globalAlpha",r)}_applyLineJoin(e){const r=e.attrs.lineJoin;r&&this.setAttr("lineJoin",r)}setAttr(e,r){this._context[e]=r}arc(e,r,t,n,a,l){this._context.arc(e,r,t,n,a,l)}arcTo(e,r,t,n,a){this._context.arcTo(e,r,t,n,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,r,t,n,a,l){this._context.bezierCurveTo(e,r,t,n,a,l)}clearRect(e,r,t,n){this._context.clearRect(e,r,t,n)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,r){var t=arguments;if(t.length===2)return this._context.createImageData(e,r);if(t.length===1)return this._context.createImageData(e)}createLinearGradient(e,r,t,n){return this._context.createLinearGradient(e,r,t,n)}createPattern(e,r){return this._context.createPattern(e,r)}createRadialGradient(e,r,t,n,a,l){return this._context.createRadialGradient(e,r,t,n,a,l)}drawImage(e,r,t,n,a,l,u,f,d){var h=arguments,y=this._context;h.length===3?y.drawImage(e,r,t):h.length===5?y.drawImage(e,r,t,n,a):h.length===9&&y.drawImage(e,r,t,n,a,l,u,f,d)}ellipse(e,r,t,n,a,l,u,f){this._context.ellipse(e,r,t,n,a,l,u,f)}isPointInPath(e,r,t,n){return t?this._context.isPointInPath(t,e,r,n):this._context.isPointInPath(e,r,n)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,r,t,n){this._context.fillRect(e,r,t,n)}strokeRect(e,r,t,n){this._context.strokeRect(e,r,t,n)}fillText(e,r,t,n){n?this._context.fillText(e,r,t,n):this._context.fillText(e,r,t)}measureText(e){return this._context.measureText(e)}getImageData(e,r,t,n){return this._context.getImageData(e,r,t,n)}lineTo(e,r){this._context.lineTo(e,r)}moveTo(e,r){this._context.moveTo(e,r)}rect(e,r,t,n){this._context.rect(e,r,t,n)}putImageData(e,r,t){this._context.putImageData(e,r,t)}quadraticCurveTo(e,r,t,n){this._context.quadraticCurveTo(e,r,t,n)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,r){this._context.scale(e,r)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,r,t,n,a,l){this._context.setTransform(e,r,t,n,a,l)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,r,t,n){this._context.strokeText(e,r,t,n)}transform(e,r,t,n,a,l){this._context.transform(e,r,t,n,a,l)}translate(e,r){this._context.translate(e,r)}_enableTrace(){var e=this,r=CONTEXT_METHODS.length,t=this.setAttr,n,a,l=function(u){var f=e[u],d;e[u]=function(){return a=simplifyArray(Array.prototype.slice.call(arguments,0)),d=f.apply(e,arguments),e._trace({method:u,args:a}),d}};for(n=0;n<r;n++)l(CONTEXT_METHODS[n]);e.setAttr=function(){t.apply(e,arguments);var u=arguments[0],f=arguments[1];(u==="shadowOffsetX"||u==="shadowOffsetY"||u==="shadowBlur")&&(f=f/this.canvas.getPixelRatio()),e._trace({property:u,val:f})}}_applyGlobalCompositeOperation(e){const r=e.attrs.globalCompositeOperation;var t=!r||r==="source-over";t||this.setAttr("globalCompositeOperation",r)}};Context$2.Context=Context$1;CONTEXT_PROPERTIES.forEach(function(o){Object.defineProperty(Context$1.prototype,o,{get(){return this._context[o]},set(e){this._context[o]=e}})});class SceneContext extends Context$1{constructor(e,{willReadFrequently:r=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:r})}_fillColor(e){var r=e.fill();this.setAttr("fillStyle",r),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var r=e._getLinearGradient();r&&(this.setAttr("fillStyle",r),e._fillFunc(this))}_fillRadialGradient(e){const r=e._getRadialGradient();r&&(this.setAttr("fillStyle",r),e._fillFunc(this))}_fill(e){const r=e.fill(),t=e.getFillPriority();if(r&&t==="color"){this._fillColor(e);return}const n=e.getFillPatternImage();if(n&&t==="pattern"){this._fillPattern(e);return}const a=e.getFillLinearGradientColorStops();if(a&&t==="linear-gradient"){this._fillLinearGradient(e);return}const l=e.getFillRadialGradientColorStops();if(l&&t==="radial-gradient"){this._fillRadialGradient(e);return}r?this._fillColor(e):n?this._fillPattern(e):a?this._fillLinearGradient(e):l&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const r=e.getStrokeLinearGradientStartPoint(),t=e.getStrokeLinearGradientEndPoint(),n=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(r.x,r.y,t.x,t.y);if(n){for(var l=0;l<n.length;l+=2)a.addColorStop(n[l],n[l+1]);this.setAttr("strokeStyle",a)}}_stroke(e){var r=e.dash(),t=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!t){this.save();var n=this.getCanvas().getPixelRatio();this.setTransform(n,0,0,n,0,0)}this._applyLineCap(e),r&&e.dashEnabled()&&(this.setLineDash(r),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var a=e.getStrokeLinearGradientColorStops();a?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),t||this.restore()}}_applyShadow(e){var r,t,n,a=(r=e.getShadowRGBA())!==null&&r!==void 0?r:"black",l=(t=e.getShadowBlur())!==null&&t!==void 0?t:5,u=(n=e.getShadowOffset())!==null&&n!==void 0?n:{x:0,y:0},f=e.getAbsoluteScale(),d=this.canvas.getPixelRatio(),h=f.x*d,y=f.y*d;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",l*Math.min(Math.abs(h),Math.abs(y))),this.setAttr("shadowOffsetX",u.x*h),this.setAttr("shadowOffsetY",u.y*y)}}Context$2.SceneContext=SceneContext;class HitContext extends Context$1{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const a=e.getStrokeScaleEnabled();if(!a){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e);var t=e.hitStrokeWidth(),n=t==="auto"?e.strokeWidth():t;this.setAttr("lineWidth",n),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),a||this.restore()}}}Context$2.HitContext=HitContext;Object.defineProperty(Canvas$1,"__esModule",{value:!0});Canvas$1.HitCanvas=Canvas$1.SceneCanvas=Canvas$1.Canvas=void 0;const Util_1$d=Util,Context_1=Context$2,Global_1$n=Global,Factory_1$z=Factory,Validators_1$y=Validators;var _pixelRatio;function getDevicePixelRatio(){if(_pixelRatio)return _pixelRatio;var o=Util_1$d.Util.createCanvasElement(),e=o.getContext("2d");return _pixelRatio=function(){var r=Global_1$n.Konva._global.devicePixelRatio||1,t=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return r/t}(),Util_1$d.Util.releaseCanvas(o),_pixelRatio}class Canvas{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var r=e||{},t=r.pixelRatio||Global_1$n.Konva.pixelRatio||getDevicePixelRatio();this.pixelRatio=t,this._canvas=Util_1$d.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var r=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/r,this.getHeight()/r)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var r=this.pixelRatio,t=this.getContext()._context;t.scale(r,r)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var r=this.pixelRatio,t=this.getContext()._context;t.scale(r,r)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,r){this.setWidth(e||0),this.setHeight(r||0)}toDataURL(e,r){try{return this._canvas.toDataURL(e,r)}catch{try{return this._canvas.toDataURL()}catch(n){return Util_1$d.Util.error("Unable to get data URL. "+n.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}Canvas$1.Canvas=Canvas;Factory_1$z.Factory.addGetterSetter(Canvas,"pixelRatio",void 0,(0,Validators_1$y.getNumberValidator)());class SceneCanvas extends Canvas{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new Context_1.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}Canvas$1.SceneCanvas=SceneCanvas;class HitCanvas extends Canvas{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new Context_1.HitContext(this),this.setSize(e.width,e.height)}}Canvas$1.HitCanvas=HitCanvas;var DragAndDrop={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.DD=void 0;const e=Global,r=Util;o.DD={get isDragging(){var t=!1;return o.DD._dragElements.forEach(n=>{n.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return o.DD._dragElements.forEach(n=>{t=n.node}),t},_dragElements:new Map,_drag(t){const n=[];o.DD._dragElements.forEach((a,l)=>{const{node:u}=a,f=u.getStage();f.setPointersPositions(t),a.pointerId===void 0&&(a.pointerId=r.Util._getFirstPointerId(t));const d=f._changedPointerPositions.find(E=>E.id===a.pointerId);if(d){if(a.dragStatus!=="dragging"){var h=u.dragDistance(),y=Math.max(Math.abs(d.x-a.startPointerPos.x),Math.abs(d.y-a.startPointerPos.y));if(y<h||(u.startDrag({evt:t}),!u.isDragging()))return}u._setDragPosition(t,a),n.push(u)}}),n.forEach(a=>{a.fire("dragmove",{type:"dragmove",target:a,evt:t},!0)})},_endDragBefore(t){const n=[];o.DD._dragElements.forEach(a=>{const{node:l}=a,u=l.getStage();if(t&&u.setPointersPositions(t),!u._changedPointerPositions.find(h=>h.id===a.pointerId))return;(a.dragStatus==="dragging"||a.dragStatus==="stopped")&&(o.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,a.dragStatus="stopped");const d=a.node.getLayer()||a.node instanceof e.Konva.Stage&&a.node;d&&n.indexOf(d)===-1&&n.push(d)}),n.forEach(a=>{a.draw()})},_endDragAfter(t){o.DD._dragElements.forEach((n,a)=>{n.dragStatus==="stopped"&&n.node.fire("dragend",{type:"dragend",target:n.node,evt:t},!0),n.dragStatus!=="dragging"&&o.DD._dragElements.delete(a)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",o.DD._endDragBefore,!0),window.addEventListener("touchend",o.DD._endDragBefore,!0),window.addEventListener("mousemove",o.DD._drag),window.addEventListener("touchmove",o.DD._drag),window.addEventListener("mouseup",o.DD._endDragAfter,!1),window.addEventListener("touchend",o.DD._endDragAfter,!1))})(DragAndDrop);Object.defineProperty(Node$1,"__esModule",{value:!0});Node$1.Node=void 0;const Util_1$c=Util,Factory_1$y=Factory,Canvas_1$1=Canvas$1,Global_1$m=Global,DragAndDrop_1=DragAndDrop,Validators_1$x=Validators;var ABSOLUTE_OPACITY="absoluteOpacity",ALL_LISTENERS="allEventListeners",ABSOLUTE_TRANSFORM="absoluteTransform",ABSOLUTE_SCALE="absoluteScale",CANVAS="canvas",CHANGE="Change",CHILDREN="children",KONVA="konva",LISTENING="listening",MOUSEENTER="mouseenter",MOUSELEAVE="mouseleave",SET="set",SHAPE="Shape",SPACE$1=" ",STAGE="stage",TRANSFORM="transform",UPPER_STAGE="Stage",VISIBLE="visible",TRANSFORM_CHANGE_STR$1=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(SPACE$1);let idCounter=1;class Node{constructor(e){this._id=idCounter++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===TRANSFORM||e===ABSOLUTE_TRANSFORM)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,r){var t=this._cache.get(e),n=e===TRANSFORM||e===ABSOLUTE_TRANSFORM,a=t===void 0||n&&t.dirty===!0;return a&&(t=r.call(this),this._cache.set(e,t)),t}_calculate(e,r,t){if(!this._attachedDepsListeners.get(e)){const n=r.map(a=>a+"Change.konva").join(SPACE$1);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,t)}_getCanvasCache(){return this._cache.get(CANVAS)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===ABSOLUTE_TRANSFORM&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(CANVAS)){const{scene:e,filter:r,hit:t}=this._cache.get(CANVAS);Util_1$c.Util.releaseCanvas(e,r,t),this._cache.delete(CANVAS)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var r=e||{},t={};(r.x===void 0||r.y===void 0||r.width===void 0||r.height===void 0)&&(t=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var n=Math.ceil(r.width||t.width),a=Math.ceil(r.height||t.height),l=r.pixelRatio,u=r.x===void 0?Math.floor(t.x):r.x,f=r.y===void 0?Math.floor(t.y):r.y,d=r.offset||0,h=r.drawBorder||!1,y=r.hitCanvasPixelRatio||1;if(!n||!a){Util_1$c.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}n+=d*2+1,a+=d*2+1,u-=d,f-=d;var E=new Canvas_1$1.SceneCanvas({pixelRatio:l,width:n,height:a}),g=new Canvas_1$1.SceneCanvas({pixelRatio:l,width:0,height:0,willReadFrequently:!0}),_=new Canvas_1$1.HitCanvas({pixelRatio:y,width:n,height:a}),p=E.getContext(),x=_.getContext();return _.isCache=!0,E.isCache=!0,this._cache.delete(CANVAS),this._filterUpToDate=!1,r.imageSmoothingEnabled===!1&&(E.getContext()._context.imageSmoothingEnabled=!1,g.getContext()._context.imageSmoothingEnabled=!1),p.save(),x.save(),p.translate(-u,-f),x.translate(-u,-f),this._isUnderCache=!0,this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this.drawScene(E,this),this.drawHit(_,this),this._isUnderCache=!1,p.restore(),x.restore(),h&&(p.save(),p.beginPath(),p.rect(0,0,n,a),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(CANVAS,{scene:E,filter:g,hit:_,x:u,y:f}),this._requestDraw(),this}isCached(){return this._cache.has(CANVAS)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,r){var t=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],n=1/0,a=1/0,l=-1/0,u=-1/0,f=this.getAbsoluteTransform(r);return t.forEach(function(d){var h=f.point(d);n===void 0&&(n=l=h.x,a=u=h.y),n=Math.min(n,h.x),a=Math.min(a,h.y),l=Math.max(l,h.x),u=Math.max(u,h.y)}),{x:n,y:a,width:l-n,height:u-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const r=this._getCanvasCache();e.translate(r.x,r.y);var t=this._getCachedSceneCanvas(),n=t.pixelRatio;e.drawImage(t._canvas,0,0,t.width/n,t.height/n),e.restore()}_drawCachedHitCanvas(e){var r=this._getCanvasCache(),t=r.hit;e.save(),e.translate(r.x,r.y),e.drawImage(t._canvas,0,0,t.width/t.pixelRatio,t.height/t.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),r=this._getCanvasCache(),t=r.scene,n=r.filter,a=n.getContext(),l,u,f,d;if(e){if(!this._filterUpToDate){var h=t.pixelRatio;n.setSize(t.width/t.pixelRatio,t.height/t.pixelRatio);try{for(l=e.length,a.clear(),a.drawImage(t._canvas,0,0,t.getWidth()/h,t.getHeight()/h),u=a.getImageData(0,0,n.getWidth(),n.getHeight()),f=0;f<l;f++){if(d=e[f],typeof d!="function"){Util_1$c.Util.error("Filter should be type of function, but got "+typeof d+" instead. Please check correct filters");continue}d.call(this,u),a.putImageData(u,0,0)}}catch(y){Util_1$c.Util.error("Unable to apply filter. "+y.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return n}return t}on(e,r){if(this._cache&&this._cache.delete(ALL_LISTENERS),arguments.length===3)return this._delegate.apply(this,arguments);var t=e.split(SPACE$1),n=t.length,a,l,u,f,d;for(a=0;a<n;a++)l=t[a],u=l.split("."),f=u[0],d=u[1]||"",this.eventListeners[f]||(this.eventListeners[f]=[]),this.eventListeners[f].push({name:d,handler:r});return this}off(e,r){var t=(e||"").split(SPACE$1),n=t.length,a,l,u,f,d,h;if(this._cache&&this._cache.delete(ALL_LISTENERS),!e)for(l in this.eventListeners)this._off(l);for(a=0;a<n;a++)if(u=t[a],f=u.split("."),d=f[0],h=f[1],d)this.eventListeners[d]&&this._off(d,h,r);else for(l in this.eventListeners)this._off(l,h,r);return this}dispatchEvent(e){var r={target:this,type:e.type,evt:e};return this.fire(e.type,r),this}addEventListener(e,r){return this.on(e,function(t){r.call(this,t.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,r,t){var n=this;this.on(e,function(a){for(var l=a.target.findAncestors(r,!0,n),u=0;u<l.length;u++)a=Util_1$c.Util.cloneObject(a),a.currentTarget=l[u],t.call(l[u],a)})}remove(){return this.isDragging()&&this.stopDrag(),DragAndDrop_1.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this._clearSelfAndDescendantCache(STAGE),this._clearSelfAndDescendantCache(VISIBLE),this._clearSelfAndDescendantCache(LISTENING)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){var r="get"+Util_1$c.Util._capitalize(e);return Util_1$c.Util._isFunction(this[r])?this[r]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),r=[];e;)r.push(e),e=e.getParent();return r}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{var r,t;if(!e)return this;for(r in e)r!==CHILDREN&&(t=SET+Util_1$c.Util._capitalize(r),Util_1$c.Util._isFunction(this[t])?this[t](e[r]):this._setAttr(r,e[r]))}),this}isListening(){return this._getCache(LISTENING,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(VISIBLE,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,r=!1){if(e)return this._isVisible(e)&&this._isListening(e);var t=this.getLayer(),n=!1;DragAndDrop_1.DD._dragElements.forEach(l=>{l.dragStatus==="dragging"&&(l.node.nodeType==="Stage"||l.node.getLayer()===t)&&(n=!0)});var a=!r&&!Global_1$m.Konva.hitOnDragEnabled&&n;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),r=this,t=0,n,a,l,u;function f(h){for(n=[],a=h.length,l=0;l<a;l++)u=h[l],t++,u.nodeType!==SHAPE&&(n=n.concat(u.getChildren().slice())),u._id===r._id&&(l=a);n.length>0&&n[0].getDepth()<=e&&f(n)}const d=this.getStage();return r.nodeType!==UPPER_STAGE&&d&&f(d.getChildren()),t}getDepth(){for(var e=0,r=this.parent;r;)e++,r=r.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;var r=e.getPointerPosition();if(!r)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(r)}getAbsolutePosition(e){let r=!1,t=this.parent;for(;t;){if(t.isCached()){r=!0;break}t=t.parent}r&&!e&&(e=!0);var n=this.getAbsoluteTransform(e).getMatrix(),a=new Util_1$c.Transform,l=this.offset();return a.m=n.slice(),a.translate(l.x,l.y),a.getTranslation()}setAbsolutePosition(e){const{x:r,y:t,...n}=this._clearTransform();this.attrs.x=r,this.attrs.y=t,this._clearCache(TRANSFORM);var a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(e.x,e.y),e={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(n),this.setPosition({x:e.x,y:e.y}),this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this}_setTransform(e){var r;for(r in e)this.attrs[r]=e[r]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var r=e.x,t=e.y,n=this.x(),a=this.y();return r!==void 0&&(n+=r),t!==void 0&&(a+=t),this.setPosition({x:n,y:a}),this}_eachAncestorReverse(e,r){var t=[],n=this.getParent(),a,l;if(!(r&&r._id===this._id)){for(t.unshift(this);n&&(!r||n._id!==r._id);)t.unshift(n),n=n.parent;for(a=t.length,l=0;l<a;l++)e(t[l])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index,r=this.parent.getChildren().length;return e<r-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index,r=this.parent.getChildren().length;return e<r-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Util_1$c.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var r=this.index;return this.parent.children.splice(r,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(ABSOLUTE_OPACITY,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),r=this.getParent();return r&&!r._isUnderCache&&(e*=r.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},r=this.getAttrs(),t,n,a,l,u;e.attrs={};for(t in r)n=r[t],u=Util_1$c.Util.isObject(n)&&!Util_1$c.Util._isPlainObject(n)&&!Util_1$c.Util._isArray(n),!u&&(a=typeof this[t]=="function"&&this[t],delete r[t],l=a?a.call(this):null,r[t]=n,l!==n&&(e.attrs[t]=n));return e.className=this.getClassName(),Util_1$c.Util._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,r,t){var n=[];r&&this._isMatch(e)&&n.push(this);for(var a=this.parent;a;){if(a===t)return n;a._isMatch(e)&&n.push(a),a=a.parent}return n}isAncestorOf(e){return!1}findAncestor(e,r,t){return this.findAncestors(e,r,t)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var r=e.replace(/ /g,"").split(","),t=r.length,n,a;for(n=0;n<t;n++)if(a=r[n],Util_1$c.Util.isValidSelector(a)||(Util_1$c.Util.warn('Selector "'+a+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Util_1$c.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Util_1$c.Util.warn("Konva is awesome, right?")),a.charAt(0)==="#"){if(this.id()===a.slice(1))return!0}else if(a.charAt(0)==="."){if(this.hasName(a.slice(1)))return!0}else if(this.className===a||this.nodeType===a)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(STAGE,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():null}fire(e,r={},t){return r.target=r.target||this,t?this._fireAndBubble(e,r):this._fire(e,r),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(ABSOLUTE_TRANSFORM,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var r;if(e)return r=new Util_1$c.Transform,this._eachAncestorReverse(function(n){var a=n.transformsEnabled();a==="all"?r.multiply(n.getTransform()):a==="position"&&r.translate(n.x()-n.offsetX(),n.y()-n.offsetY())},e),r;r=this._cache.get(ABSOLUTE_TRANSFORM)||new Util_1$c.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(r):r.reset();var t=this.transformsEnabled();if(t==="all")r.multiply(this.getTransform());else if(t==="position"){const n=this.attrs.x||0,a=this.attrs.y||0,l=this.attrs.offsetX||0,u=this.attrs.offsetY||0;r.translate(n-l,a-u)}return r.dirty=!1,r}getAbsoluteScale(e){for(var r=this;r;)r._isUnderCache&&(e=r),r=r.getParent();const n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(TRANSFORM,this._getTransform)}_getTransform(){var e,r,t=this._cache.get(TRANSFORM)||new Util_1$c.Transform;t.reset();var n=this.x(),a=this.y(),l=Global_1$m.Konva.getAngle(this.rotation()),u=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,f=(r=this.attrs.scaleY)!==null&&r!==void 0?r:1,d=this.attrs.skewX||0,h=this.attrs.skewY||0,y=this.attrs.offsetX||0,E=this.attrs.offsetY||0;return(n!==0||a!==0)&&t.translate(n,a),l!==0&&t.rotate(l),(d!==0||h!==0)&&t.skew(d,h),(u!==1||f!==1)&&t.scale(u,f),(y!==0||E!==0)&&t.translate(-1*y,-1*E),t.dirty=!1,t}clone(e){var r=Util_1$c.Util.cloneObject(this.attrs),t,n,a,l,u;for(t in e)r[t]=e[t];var f=new this.constructor(r);for(t in this.eventListeners)for(n=this.eventListeners[t],a=n.length,l=0;l<a;l++)u=n[l],u.name.indexOf(KONVA)<0&&(f.eventListeners[t]||(f.eventListeners[t]=[]),f.eventListeners[t].push(u));return f}_toKonvaCanvas(e){e=e||{};var r=this.getClientRect(),t=this.getStage(),n=e.x!==void 0?e.x:Math.floor(r.x),a=e.y!==void 0?e.y:Math.floor(r.y),l=e.pixelRatio||1,u=new Canvas_1$1.SceneCanvas({width:e.width||Math.ceil(r.width)||(t?t.width():0),height:e.height||Math.ceil(r.height)||(t?t.height():0),pixelRatio:l}),f=u.getContext();return e.imageSmoothingEnabled===!1&&(f._context.imageSmoothingEnabled=!1),f.save(),(n||a)&&f.translate(-1*n,-1*a),this.drawScene(u),f.restore(),u}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};var r=e.mimeType||null,t=e.quality||null,n=this._toKonvaCanvas(e).toDataURL(r,t);return e.callback&&e.callback(n),n}toImage(e){return new Promise((r,t)=>{try{const n=e==null?void 0:e.callback;n&&delete e.callback,Util_1$c.Util._urlToImage(this.toDataURL(e),function(a){r(a),n==null||n(a)})}catch(n){t(n)}})}toBlob(e){return new Promise((r,t)=>{try{const n=e==null?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob(a=>{r(a),n==null||n(a)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(n){t(n)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Global_1$m.Konva.dragDistance}_off(e,r,t){var n=this.eventListeners[e],a,l,u;for(a=0;a<n.length;a++)if(l=n[a].name,u=n[a].handler,(l!=="konva"||r==="konva")&&(!r||l===r)&&(!t||t===u)){if(n.splice(a,1),n.length===0){delete this.eventListeners[e];break}a--}}_fireChangeEvent(e,r,t){this._fire(e+CHANGE,{oldVal:r,newVal:t})}addName(e){if(!this.hasName(e)){var r=this.name(),t=r?r+" "+e:e;this.name(t)}return this}hasName(e){if(!e)return!1;const r=this.name();if(!r)return!1;var t=(r||"").split(/\s/g);return t.indexOf(e)!==-1}removeName(e){var r=(this.name()||"").split(/\s/g),t=r.indexOf(e);return t!==-1&&(r.splice(t,1),this.name(r.join(" "))),this}setAttr(e,r){var t=this[SET+Util_1$c.Util._capitalize(e)];return Util_1$c.Util._isFunction(t)?t.call(this,r):this._setAttr(e,r),this}_requestDraw(){if(Global_1$m.Konva.autoDrawEnabled){const e=this.getLayer()||this.getStage();e==null||e.batchDraw()}}_setAttr(e,r){var t=this.attrs[e];t===r&&!Util_1$c.Util.isObject(r)||(r==null?delete this.attrs[e]:this.attrs[e]=r,this._shouldFireChangeEvents&&this._fireChangeEvent(e,t,r),this._requestDraw())}_setComponentAttr(e,r,t){var n;t!==void 0&&(n=this.attrs[e],n||(this.attrs[e]=this.getAttr(e)),this.attrs[e][r]=t,this._fireChangeEvent(e,n,t))}_fireAndBubble(e,r,t){r&&this.nodeType===SHAPE&&(r.target=this);var n=(e===MOUSEENTER||e===MOUSELEAVE)&&(t&&(this===t||this.isAncestorOf&&this.isAncestorOf(t))||this.nodeType==="Stage"&&!t);if(!n){this._fire(e,r);var a=(e===MOUSEENTER||e===MOUSELEAVE)&&t&&t.isAncestorOf&&t.isAncestorOf(this)&&!t.isAncestorOf(this.parent);(r&&!r.cancelBubble||!r)&&this.parent&&this.parent.isListening()&&!a&&(t&&t.parent?this._fireAndBubble.call(this.parent,e,r,t):this._fireAndBubble.call(this.parent,e,r))}}_getProtoListeners(e){var r,t,n;const a=(r=this._cache.get(ALL_LISTENERS))!==null&&r!==void 0?r:{};let l=a==null?void 0:a[e];if(l===void 0){l=[];let u=Object.getPrototypeOf(this);for(;u;){const f=(n=(t=u.eventListeners)===null||t===void 0?void 0:t[e])!==null&&n!==void 0?n:[];l.push(...f),u=Object.getPrototypeOf(u)}a[e]=l,this._cache.set(ALL_LISTENERS,a)}return l}_fire(e,r){r=r||{},r.currentTarget=this,r.type=e;const t=this._getProtoListeners(e);if(t)for(var n=0;n<t.length;n++)t[n].handler.call(this,r);const a=this.eventListeners[e];if(a)for(var n=0;n<a.length;n++)a[n].handler.call(this,r)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var r=e?e.pointerId:void 0,t=this.getStage(),n=this.getAbsolutePosition();if(t){var a=t._getPointerById(r)||t._changedPointerPositions[0]||n;DragAndDrop_1.DD._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-n.x,y:a.y-n.y},dragStatus:"ready",pointerId:r})}}startDrag(e,r=!0){DragAndDrop_1.DD._dragElements.has(this._id)||this._createDragElement(e);const t=DragAndDrop_1.DD._dragElements.get(this._id);t.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},r)}_setDragPosition(e,r){const t=this.getStage()._getPointerById(r.pointerId);if(t){var n={x:t.x-r.offset.x,y:t.y-r.offset.y},a=this.dragBoundFunc();if(a!==void 0){const l=a.call(this,n,e);l?n=l:Util_1$c.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==n.x||this._lastPos.y!==n.y)&&(this.setAbsolutePosition(n),this._requestDraw()),this._lastPos=n}}stopDrag(e){const r=DragAndDrop_1.DD._dragElements.get(this._id);r&&(r.dragStatus="stopped"),DragAndDrop_1.DD._endDragBefore(e),DragAndDrop_1.DD._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=DragAndDrop_1.DD._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){var r=e.evt.button!==void 0,t=!r||Global_1$m.Konva.dragButtons.indexOf(e.evt.button)>=0;if(t&&!this.isDragging()){var n=!1;DragAndDrop_1.DD._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(n=!0)}),n||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const r=DragAndDrop_1.DD._dragElements.get(this._id),t=r&&r.dragStatus==="dragging",n=r&&r.dragStatus==="ready";t?this.stopDrag():n&&DragAndDrop_1.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const r=this.getStage();if(!r)return!1;const t={x:-e.x,y:-e.y,width:r.width()+2*e.x,height:r.height()+2*e.y};return Util_1$c.Util.haveIntersection(t,this.getClientRect())}static create(e,r){return Util_1$c.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,r)}static _createNode(e,r){var t=Node.prototype.getClassName.call(e),n=e.children,a,l,u;r&&(e.attrs.container=r),Global_1$m.Konva[t]||(Util_1$c.Util.warn('Can not find a node with class name "'+t+'". Fallback to "Shape".'),t="Shape");const f=Global_1$m.Konva[t];if(a=new f(e.attrs),n)for(l=n.length,u=0;u<l;u++)a.add(Node._createNode(n[u]));return a}}Node$1.Node=Node;Node.prototype.nodeType="Node";Node.prototype._attrsAffectingSize=[];Node.prototype.eventListeners={};Node.prototype.on.call(Node.prototype,TRANSFORM_CHANGE_STR$1,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)});Node.prototype.on.call(Node.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(VISIBLE)});Node.prototype.on.call(Node.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(LISTENING)});Node.prototype.on.call(Node.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY)});const addGetterSetter=Factory_1$y.Factory.addGetterSetter;addGetterSetter(Node,"zIndex");addGetterSetter(Node,"absolutePosition");addGetterSetter(Node,"position");addGetterSetter(Node,"x",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"y",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"globalCompositeOperation","source-over",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"opacity",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"name","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"id","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"rotation",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"scale",["x","y"]);addGetterSetter(Node,"scaleX",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"scaleY",1,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"skew",["x","y"]);addGetterSetter(Node,"skewX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"skewY",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"offset",["x","y"]);addGetterSetter(Node,"offsetX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"offsetY",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"dragDistance",null,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"width",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"height",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"listening",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"preventDefault",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"filters",null,function(o){return this._filterUpToDate=!1,o});addGetterSetter(Node,"visible",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"transformsEnabled","all",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"size");addGetterSetter(Node,"dragBoundFunc");addGetterSetter(Node,"draggable",!1,(0,Validators_1$x.getBooleanValidator)());Factory_1$y.Factory.backCompat(Node,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Container$2={};Object.defineProperty(Container$2,"__esModule",{value:!0});Container$2.Container=void 0;const Factory_1$x=Factory,Node_1$h=Node$1,Validators_1$w=Validators;let Container$1=class extends Node_1$h.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const r=this.children||[];var t=[];return r.forEach(function(n){e(n)&&t.push(n)}),t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var r=0;r<e.length;r++)this.add(e[r]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var r=this._generalFind(e,!0);return r.length>0?r[0]:void 0}_generalFind(e,r){var t=[];return this._descendants(n=>{const a=n._isMatch(e);return a&&t.push(n),!!(a&&r)}),t}_descendants(e){let r=!1;const t=this.getChildren();for(const n of t){if(r=e(n),r)return!0;if(n.hasChildren()&&(r=n._descendants(e),r))return!0}return!1}toObject(){var e=Node_1$h.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(r=>{e.children.push(r.toObject())}),e}isAncestorOf(e){for(var r=e.getParent();r;){if(r._id===this._id)return!0;r=r.getParent()}return!1}clone(e){var r=Node_1$h.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(t){r.add(t.clone())}),r}getAllIntersections(e){var r=[];return this.find("Shape").forEach(t=>{t.isVisible()&&t.intersects(e)&&r.push(t)}),r}_clearSelfAndDescendantCache(e){var r;super._clearSelfAndDescendantCache(e),!this.isCached()&&((r=this.children)===null||r===void 0||r.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(r,t){r.index=t}),this._requestDraw()}drawScene(e,r){var t=this.getLayer(),n=e||t&&t.getCanvas(),a=n&&n.getContext(),l=this._getCanvasCache(),u=l&&l.scene,f=n&&n.isCache;if(!this.isVisible()&&!f)return this;if(u){a.save();var d=this.getAbsoluteTransform(r).getMatrix();a.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",n,r);return this}drawHit(e,r){if(!this.shouldDrawHit(r))return this;var t=this.getLayer(),n=e||t&&t.hitCanvas,a=n&&n.getContext(),l=this._getCanvasCache(),u=l&&l.hit;if(u){a.save();var f=this.getAbsoluteTransform(r).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",n,r);return this}_drawChildren(e,r,t){var n,a=r&&r.getContext(),l=this.clipWidth(),u=this.clipHeight(),f=this.clipFunc(),d=l&&u||f;const h=t===this;if(d){a.save();var y=this.getAbsoluteTransform(t),E=y.getMatrix();a.transform(E[0],E[1],E[2],E[3],E[4],E[5]),a.beginPath();let x;if(f)x=f.call(this,a,this);else{var g=this.clipX(),_=this.clipY();a.rect(g,_,l,u)}a.clip.apply(a,x),E=y.copy().invert().getMatrix(),a.transform(E[0],E[1],E[2],E[3],E[4],E[5])}var p=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";p&&(a.save(),a._applyGlobalCompositeOperation(this)),(n=this.children)===null||n===void 0||n.forEach(function(x){x[e](r,t)}),p&&a.restore(),d&&a.restore()}getClientRect(e={}){var r,t=e.skipTransform,n=e.relativeTo,a,l,u,f,d={x:1/0,y:1/0,width:0,height:0},h=this;(r=this.children)===null||r===void 0||r.forEach(function(p){if(p.visible()){var x=p.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});x.width===0&&x.height===0||(a===void 0?(a=x.x,l=x.y,u=x.x+x.width,f=x.y+x.height):(a=Math.min(a,x.x),l=Math.min(l,x.y),u=Math.max(u,x.x+x.width),f=Math.max(f,x.y+x.height)))}});for(var y=this.find("Shape"),E=!1,g=0;g<y.length;g++){var _=y[g];if(_._isVisible(this)){E=!0;break}}return E&&a!==void 0?d={x:a,y:l,width:u-a,height:f-l}:d={x:0,y:0,width:0,height:0},t?d:this._transformedRect(d,n)}};Container$2.Container=Container$1;Factory_1$x.Factory.addComponentsGetterSetter(Container$1,"clip",["x","y","width","height"]);Factory_1$x.Factory.addGetterSetter(Container$1,"clipX",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipY",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipWidth",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipHeight",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipFunc");var Stage$1={},PointerEvents={};Object.defineProperty(PointerEvents,"__esModule",{value:!0});PointerEvents.releaseCapture=PointerEvents.setPointerCapture=PointerEvents.hasPointerCapture=PointerEvents.createEvent=PointerEvents.getCapturedShape=void 0;const Global_1$l=Global,Captures=new Map,SUPPORT_POINTER_EVENTS=Global_1$l.Konva._global.PointerEvent!==void 0;function getCapturedShape(o){return Captures.get(o)}PointerEvents.getCapturedShape=getCapturedShape;function createEvent(o){return{evt:o,pointerId:o.pointerId}}PointerEvents.createEvent=createEvent;function hasPointerCapture(o,e){return Captures.get(o)===e}PointerEvents.hasPointerCapture=hasPointerCapture;function setPointerCapture(o,e){releaseCapture(o),e.getStage()&&(Captures.set(o,e),SUPPORT_POINTER_EVENTS&&e._fire("gotpointercapture",createEvent(new PointerEvent("gotpointercapture"))))}PointerEvents.setPointerCapture=setPointerCapture;function releaseCapture(o,e){const r=Captures.get(o);if(!r)return;const t=r.getStage();t&&t.content,Captures.delete(o),SUPPORT_POINTER_EVENTS&&r._fire("lostpointercapture",createEvent(new PointerEvent("lostpointercapture")))}PointerEvents.releaseCapture=releaseCapture;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Stage=o.stages=void 0;const e=Util,r=Factory,t=Container$2,n=Global,a=Canvas$1,l=DragAndDrop,u=Global,f=PointerEvents;var d="Stage",h="string",y="px",E="mouseout",g="mouseleave",_="mouseover",p="mouseenter",x="mousemove",C="mousedown",R="mouseup",S="pointermove",A="pointerdown",T="pointerup",P="pointercancel",w="lostpointercapture",O="pointerout",k="pointerleave",D="pointerover",F="pointerenter",U="contextmenu",H="touchstart",W="touchend",ee="touchmove",q="touchcancel",B="wheel",G=5,I=[[p,"_pointerenter"],[C,"_pointerdown"],[x,"_pointermove"],[R,"_pointerup"],[g,"_pointerleave"],[H,"_pointerdown"],[ee,"_pointermove"],[W,"_pointerup"],[q,"_pointercancel"],[_,"_pointerover"],[B,"_wheel"],[U,"_contextmenu"],[A,"_pointerdown"],[S,"_pointermove"],[T,"_pointerup"],[P,"_pointercancel"],[w,"_lostpointercapture"]];const $={mouse:{[O]:E,[k]:g,[D]:_,[F]:p,[S]:x,[A]:C,[T]:R,[P]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[O]:"touchout",[k]:"touchleave",[D]:"touchover",[F]:"touchenter",[S]:ee,[A]:H,[T]:W,[P]:q,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[O]:O,[k]:k,[D]:D,[F]:F,[S]:S,[A]:A,[T]:T,[P]:P,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},V=ne=>ne.indexOf("pointer")>=0?"pointer":ne.indexOf("touch")>=0?"touch":"mouse",X=ne=>{const Z=V(ne);if(Z==="pointer")return n.Konva.pointerEventsEnabled&&$.pointer;if(Z==="touch")return $.touch;if(Z==="mouse")return $.mouse};function Q(ne={}){return(ne.clipFunc||ne.clipWidth||ne.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),ne}const J="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);";o.stages=[];class ie extends t.Container{constructor(Z){super(Q(Z)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),o.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Q(this.attrs)}),this._checkVisibility()}_validateAdd(Z){const oe=Z.getType()==="Layer",ae=Z.getType()==="FastLayer";oe||ae||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const Z=this.visible()?"":"none";this.content.style.display=Z}setContainer(Z){if(typeof Z===h){if(Z.charAt(0)==="."){var oe=Z.slice(1);Z=document.getElementsByClassName(oe)[0]}else{var ae;Z.charAt(0)!=="#"?ae=Z:ae=Z.slice(1),Z=document.getElementById(ae)}if(!Z)throw"Can not find container in document with id "+ae}return this._setAttr("container",Z),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),Z.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var Z=this.children,oe=Z.length,ae;for(ae=0;ae<oe;ae++)Z[ae].clear();return this}clone(Z){return Z||(Z={}),Z.container=typeof document<"u"&&document.createElement("div"),t.Container.prototype.clone.call(this,Z)}destroy(){super.destroy();var Z=this.content;Z&&e.Util._isInDocument(Z)&&this.container().removeChild(Z);var oe=o.stages.indexOf(this);return oe>-1&&o.stages.splice(oe,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const Z=this._pointerPositions[0]||this._changedPointerPositions[0];return Z?{x:Z.x,y:Z.y}:(e.Util.warn(J),null)}_getPointerById(Z){return this._pointerPositions.find(oe=>oe.id===Z)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(Z){Z=Z||{},Z.x=Z.x||0,Z.y=Z.y||0,Z.width=Z.width||this.width(),Z.height=Z.height||this.height();var oe=new a.SceneCanvas({width:Z.width,height:Z.height,pixelRatio:Z.pixelRatio||1}),ae=oe.getContext()._context,ce=this.children;return(Z.x||Z.y)&&ae.translate(-1*Z.x,-1*Z.y),ce.forEach(function(fe){if(fe.isVisible()){var de=fe._toKonvaCanvas(Z);ae.drawImage(de._canvas,Z.x,Z.y,de.getWidth()/de.getPixelRatio(),de.getHeight()/de.getPixelRatio())}}),oe}getIntersection(Z){if(!Z)return null;var oe=this.children,ae=oe.length,ce=ae-1,fe;for(fe=ce;fe>=0;fe--){const de=oe[fe].getIntersection(Z);if(de)return de}return null}_resizeDOM(){var Z=this.width(),oe=this.height();this.content&&(this.content.style.width=Z+y,this.content.style.height=oe+y),this.bufferCanvas.setSize(Z,oe),this.bufferHitCanvas.setSize(Z,oe),this.children.forEach(ae=>{ae.setSize({width:Z,height:oe}),ae.draw()})}add(Z,...oe){if(arguments.length>1){for(var ae=0;ae<arguments.length;ae++)this.add(arguments[ae]);return this}super.add(Z);var ce=this.children.length;return ce>G&&e.Util.warn("The stage has "+ce+" 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."),Z.setSize({width:this.width(),height:this.height()}),Z.draw(),n.Konva.isBrowser&&this.content.appendChild(Z.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(Z){return f.hasPointerCapture(Z,this)}setPointerCapture(Z){f.setPointerCapture(Z,this)}releaseCapture(Z){f.releaseCapture(Z,this)}getLayers(){return this.children}_bindContentEvents(){n.Konva.isBrowser&&I.forEach(([Z,oe])=>{this.content.addEventListener(Z,ae=>{this[oe](ae)},{passive:!1})})}_pointerenter(Z){this.setPointersPositions(Z);const oe=X(Z.type);oe&&this._fire(oe.pointerenter,{evt:Z,target:this,currentTarget:this})}_pointerover(Z){this.setPointersPositions(Z);const oe=X(Z.type);oe&&this._fire(oe.pointerover,{evt:Z,target:this,currentTarget:this})}_getTargetShape(Z){let oe=this[Z+"targetShape"];return oe&&!oe.getStage()&&(oe=null),oe}_pointerleave(Z){const oe=X(Z.type),ae=V(Z.type);if(oe){this.setPointersPositions(Z);var ce=this._getTargetShape(ae),fe=!l.DD.isDragging||n.Konva.hitOnDragEnabled;ce&&fe?(ce._fireAndBubble(oe.pointerout,{evt:Z}),ce._fireAndBubble(oe.pointerleave,{evt:Z}),this._fire(oe.pointerleave,{evt:Z,target:this,currentTarget:this}),this[ae+"targetShape"]=null):fe&&(this._fire(oe.pointerleave,{evt:Z,target:this,currentTarget:this}),this._fire(oe.pointerout,{evt:Z,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(Z){const oe=X(Z.type),ae=V(Z.type);if(oe){this.setPointersPositions(Z);var ce=!1;this._changedPointerPositions.forEach(fe=>{var de=this.getIntersection(fe);if(l.DD.justDragged=!1,n.Konva["_"+ae+"ListenClick"]=!0,!de||!de.isListening())return;n.Konva.capturePointerEventsEnabled&&de.setPointerCapture(fe.id),this[ae+"ClickStartShape"]=de,de._fireAndBubble(oe.pointerdown,{evt:Z,pointerId:fe.id}),ce=!0;const xe=Z.type.indexOf("touch")>=0;de.preventDefault()&&Z.cancelable&&xe&&Z.preventDefault()}),ce||this._fire(oe.pointerdown,{evt:Z,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(Z){const oe=X(Z.type),ae=V(Z.type);if(!oe)return;l.DD.isDragging&&l.DD.node.preventDefault()&&Z.cancelable&&Z.preventDefault(),this.setPointersPositions(Z);var ce=!l.DD.isDragging||n.Konva.hitOnDragEnabled;if(!ce)return;var fe={};let de=!1;var xe=this._getTargetShape(ae);this._changedPointerPositions.forEach(Oe=>{const Te=f.getCapturedShape(Oe.id)||this.getIntersection(Oe),We=Oe.id,Be={evt:Z,pointerId:We};var qe=xe!==Te;if(qe&&xe&&(xe._fireAndBubble(oe.pointerout,{...Be},Te),xe._fireAndBubble(oe.pointerleave,{...Be},Te)),Te){if(fe[Te._id])return;fe[Te._id]=!0}Te&&Te.isListening()?(de=!0,qe&&(Te._fireAndBubble(oe.pointerover,{...Be},xe),Te._fireAndBubble(oe.pointerenter,{...Be},xe),this[ae+"targetShape"]=Te),Te._fireAndBubble(oe.pointermove,{...Be})):xe&&(this._fire(oe.pointerover,{evt:Z,target:this,currentTarget:this,pointerId:We}),this[ae+"targetShape"]=null)}),de||this._fire(oe.pointermove,{evt:Z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(Z){const oe=X(Z.type),ae=V(Z.type);if(!oe)return;this.setPointersPositions(Z);const ce=this[ae+"ClickStartShape"],fe=this[ae+"ClickEndShape"];var de={};let xe=!1;this._changedPointerPositions.forEach(Oe=>{const Te=f.getCapturedShape(Oe.id)||this.getIntersection(Oe);if(Te){if(Te.releaseCapture(Oe.id),de[Te._id])return;de[Te._id]=!0}const We=Oe.id,Be={evt:Z,pointerId:We};let qe=!1;n.Konva["_"+ae+"InDblClickWindow"]?(qe=!0,clearTimeout(this[ae+"DblTimeout"])):l.DD.justDragged||(n.Konva["_"+ae+"InDblClickWindow"]=!0,clearTimeout(this[ae+"DblTimeout"])),this[ae+"DblTimeout"]=setTimeout(function(){n.Konva["_"+ae+"InDblClickWindow"]=!1},n.Konva.dblClickWindow),Te&&Te.isListening()?(xe=!0,this[ae+"ClickEndShape"]=Te,Te._fireAndBubble(oe.pointerup,{...Be}),n.Konva["_"+ae+"ListenClick"]&&ce&&ce===Te&&(Te._fireAndBubble(oe.pointerclick,{...Be}),qe&&fe&&fe===Te&&Te._fireAndBubble(oe.pointerdblclick,{...Be}))):(this[ae+"ClickEndShape"]=null,n.Konva["_"+ae+"ListenClick"]&&this._fire(oe.pointerclick,{evt:Z,target:this,currentTarget:this,pointerId:We}),qe&&this._fire(oe.pointerdblclick,{evt:Z,target:this,currentTarget:this,pointerId:We}))}),xe||this._fire(oe.pointerup,{evt:Z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),n.Konva["_"+ae+"ListenClick"]=!1,Z.cancelable&&ae!=="touch"&&Z.preventDefault()}_contextmenu(Z){this.setPointersPositions(Z);var oe=this.getIntersection(this.getPointerPosition());oe&&oe.isListening()?oe._fireAndBubble(U,{evt:Z}):this._fire(U,{evt:Z,target:this,currentTarget:this})}_wheel(Z){this.setPointersPositions(Z);var oe=this.getIntersection(this.getPointerPosition());oe&&oe.isListening()?oe._fireAndBubble(B,{evt:Z}):this._fire(B,{evt:Z,target:this,currentTarget:this})}_pointercancel(Z){this.setPointersPositions(Z);const oe=f.getCapturedShape(Z.pointerId)||this.getIntersection(this.getPointerPosition());oe&&oe._fireAndBubble(T,f.createEvent(Z)),f.releaseCapture(Z.pointerId)}_lostpointercapture(Z){f.releaseCapture(Z.pointerId)}setPointersPositions(Z){var oe=this._getContentPosition(),ae=null,ce=null;Z=Z||window.event,Z.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(Z.touches,fe=>{this._pointerPositions.push({id:fe.identifier,x:(fe.clientX-oe.left)/oe.scaleX,y:(fe.clientY-oe.top)/oe.scaleY})}),Array.prototype.forEach.call(Z.changedTouches||Z.touches,fe=>{this._changedPointerPositions.push({id:fe.identifier,x:(fe.clientX-oe.left)/oe.scaleX,y:(fe.clientY-oe.top)/oe.scaleY})})):(ae=(Z.clientX-oe.left)/oe.scaleX,ce=(Z.clientY-oe.top)/oe.scaleY,this.pointerPos={x:ae,y:ce},this._pointerPositions=[{x:ae,y:ce,id:e.Util._getFirstPointerId(Z)}],this._changedPointerPositions=[{x:ae,y:ce,id:e.Util._getFirstPointerId(Z)}])}_setPointerPosition(Z){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(Z)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var Z=this.content.getBoundingClientRect();return{top:Z.top,left:Z.left,scaleX:Z.width/this.content.clientWidth||1,scaleY:Z.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new a.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new a.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!n.Konva.isBrowser){var Z=this.container();if(!Z)throw"Stage has no container. A container is required.";Z.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"),Z.appendChild(this.content),this._resizeDOM()}}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(Z){Z.batchDraw()}),this}}o.Stage=ie,ie.prototype.nodeType=d,(0,u._registerNode)(ie),r.Factory.addGetterSetter(ie,"container")})(Stage$1);var Layer$2={},Shape={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Shape=o.shapes=void 0;const e=Global,r=Util,t=Factory,n=Node$1,a=Validators,l=Global,u=PointerEvents;var f="hasShadow",d="shadowRGBA",h="patternImage",y="linearGradient",E="radialGradient";let g;function _(){return g||(g=r.Util.createCanvasElement().getContext("2d"),g)}o.shapes={};function p(k){const D=this.attrs.fillRule;D?k.fill(D):k.fill()}function x(k){k.stroke()}function C(k){k.fill()}function R(k){k.stroke()}function S(){this._clearCache(f)}function A(){this._clearCache(d)}function T(){this._clearCache(h)}function P(){this._clearCache(y)}function w(){this._clearCache(E)}class O extends n.Node{constructor(D){super(D);let F;for(;F=r.Util.getRandomColor(),!(F&&!(F in o.shapes)););this.colorKey=F,o.shapes[F]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(f,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(h,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var D=_();const F=D.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(F&&F.setTransform){const U=new r.Transform;U.translate(this.fillPatternX(),this.fillPatternY()),U.rotate(e.Konva.getAngle(this.fillPatternRotation())),U.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),U.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const H=U.getMatrix(),W=typeof DOMMatrix>"u"?{a:H[0],b:H[1],c:H[2],d:H[3],e:H[4],f:H[5]}:new DOMMatrix(H);F.setTransform(W)}return F}}_getLinearGradient(){return this._getCache(y,this.__getLinearGradient)}__getLinearGradient(){var D=this.fillLinearGradientColorStops();if(D){for(var F=_(),U=this.fillLinearGradientStartPoint(),H=this.fillLinearGradientEndPoint(),W=F.createLinearGradient(U.x,U.y,H.x,H.y),ee=0;ee<D.length;ee+=2)W.addColorStop(D[ee],D[ee+1]);return W}}_getRadialGradient(){return this._getCache(E,this.__getRadialGradient)}__getRadialGradient(){var D=this.fillRadialGradientColorStops();if(D){for(var F=_(),U=this.fillRadialGradientStartPoint(),H=this.fillRadialGradientEndPoint(),W=F.createRadialGradient(U.x,U.y,this.fillRadialGradientStartRadius(),H.x,H.y,this.fillRadialGradientEndRadius()),ee=0;ee<D.length;ee+=2)W.addColorStop(D[ee],D[ee+1]);return W}}getShadowRGBA(){return this._getCache(d,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var D=r.Util.colorToRGBA(this.shadowColor());if(D)return"rgba("+D.r+","+D.g+","+D.b+","+D.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(){const D=this.hitStrokeWidth();return D==="auto"?this.hasStroke():this.strokeEnabled()&&!!D}intersects(D){var F=this.getStage();if(!F)return!1;const U=F.bufferHitCanvas;return U.getContext().clear(),this.drawHit(U,void 0,!0),U.context.getImageData(Math.round(D.x),Math.round(D.y),1,1).data[3]>0}destroy(){return n.Node.prototype.destroy.call(this),delete o.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(D){var F;if(!this.getStage()||!((F=this.attrs.perfectDrawEnabled)!==null&&F!==void 0?F:!0))return!1;const H=D||this.hasFill(),W=this.hasStroke(),ee=this.getAbsoluteOpacity()!==1;if(H&&W&&ee)return!0;const q=this.hasShadow(),B=this.shadowForStrokeEnabled();return!!(H&&W&&q&&B)}setStrokeHitEnabled(D){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),D?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var D=this.size();return{x:this._centroid?-D.width/2:0,y:this._centroid?-D.height/2:0,width:D.width,height:D.height}}getClientRect(D={}){const F=D.skipTransform,U=D.relativeTo,H=this.getSelfRect(),ee=!D.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,q=H.width+ee,B=H.height+ee,G=!D.skipShadow&&this.hasShadow(),I=G?this.shadowOffsetX():0,$=G?this.shadowOffsetY():0,V=q+Math.abs(I),X=B+Math.abs($),Q=G&&this.shadowBlur()||0,J=V+Q*2,ie=X+Q*2,ne={width:J,height:ie,x:-(ee/2+Q)+Math.min(I,0)+H.x,y:-(ee/2+Q)+Math.min($,0)+H.y};return F?ne:this._transformedRect(ne,U)}drawScene(D,F){var U=this.getLayer(),H=D||U.getCanvas(),W=H.getContext(),ee=this._getCanvasCache(),q=this.getSceneFunc(),B=this.hasShadow(),G,I,$,V=H.isCache,X=F===this;if(!this.isVisible()&&!X)return this;if(ee){W.save();var Q=this.getAbsoluteTransform(F).getMatrix();return W.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),this._drawCachedSceneCanvas(W),W.restore(),this}if(!q)return this;if(W.save(),this._useBufferCanvas()&&!V){G=this.getStage(),I=G.bufferCanvas,$=I.getContext(),$.clear(),$.save(),$._applyLineJoin(this);var J=this.getAbsoluteTransform(F).getMatrix();$.transform(J[0],J[1],J[2],J[3],J[4],J[5]),q.call(this,$,this),$.restore();var ie=I.pixelRatio;B&&W._applyShadow(this),W._applyOpacity(this),W._applyGlobalCompositeOperation(this),W.drawImage(I._canvas,0,0,I.width/ie,I.height/ie)}else{if(W._applyLineJoin(this),!X){var J=this.getAbsoluteTransform(F).getMatrix();W.transform(J[0],J[1],J[2],J[3],J[4],J[5]),W._applyOpacity(this),W._applyGlobalCompositeOperation(this)}B&&W._applyShadow(this),q.call(this,W,this)}return W.restore(),this}drawHit(D,F,U=!1){if(!this.shouldDrawHit(F,U))return this;var H=this.getLayer(),W=D||H.hitCanvas,ee=W&&W.getContext(),q=this.hitFunc()||this.sceneFunc(),B=this._getCanvasCache(),G=B&&B.hit;if(this.colorKey||r.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),G){ee.save();var I=this.getAbsoluteTransform(F).getMatrix();return ee.transform(I[0],I[1],I[2],I[3],I[4],I[5]),this._drawCachedHitCanvas(ee),ee.restore(),this}if(!q)return this;if(ee.save(),ee._applyLineJoin(this),!(this===F)){var V=this.getAbsoluteTransform(F).getMatrix();ee.transform(V[0],V[1],V[2],V[3],V[4],V[5])}return q.call(this,ee,this),ee.restore(),this}drawHitFromCache(D=0){var F=this._getCanvasCache(),U=this._getCachedSceneCanvas(),H=F.hit,W=H.getContext(),ee=H.getWidth(),q=H.getHeight(),B,G,I,$,V,X;W.clear(),W.drawImage(U._canvas,0,0,ee,q);try{for(B=W.getImageData(0,0,ee,q),G=B.data,I=G.length,$=r.Util._hexToRgb(this.colorKey),V=0;V<I;V+=4)X=G[V+3],X>D?(G[V]=$.r,G[V+1]=$.g,G[V+2]=$.b,G[V+3]=255):G[V+3]=0;W.putImageData(B,0,0)}catch(Q){r.Util.error("Unable to draw hit graph from cached scene canvas. "+Q.message)}return this}hasPointerCapture(D){return u.hasPointerCapture(D,this)}setPointerCapture(D){u.setPointerCapture(D,this)}releaseCapture(D){u.releaseCapture(D,this)}}o.Shape=O,O.prototype._fillFunc=p,O.prototype._strokeFunc=x,O.prototype._fillFuncHit=C,O.prototype._strokeFuncHit=R,O.prototype._centroid=!1,O.prototype.nodeType="Shape",(0,l._registerNode)(O),O.prototype.eventListeners={},O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",S),O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",A),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",T),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",P),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",w),t.Factory.addGetterSetter(O,"stroke",void 0,(0,a.getStringOrGradientValidator)()),t.Factory.addGetterSetter(O,"strokeWidth",2,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillAfterStrokeEnabled",!1),t.Factory.addGetterSetter(O,"hitStrokeWidth","auto",(0,a.getNumberOrAutoValidator)()),t.Factory.addGetterSetter(O,"strokeHitEnabled",!0,(0,a.getBooleanValidator)()),t.Factory.addGetterSetter(O,"perfectDrawEnabled",!0,(0,a.getBooleanValidator)()),t.Factory.addGetterSetter(O,"shadowForStrokeEnabled",!0,(0,a.getBooleanValidator)()),t.Factory.addGetterSetter(O,"lineJoin"),t.Factory.addGetterSetter(O,"lineCap"),t.Factory.addGetterSetter(O,"sceneFunc"),t.Factory.addGetterSetter(O,"hitFunc"),t.Factory.addGetterSetter(O,"dash"),t.Factory.addGetterSetter(O,"dashOffset",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"shadowColor",void 0,(0,a.getStringValidator)()),t.Factory.addGetterSetter(O,"shadowBlur",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"shadowOpacity",1,(0,a.getNumberValidator)()),t.Factory.addComponentsGetterSetter(O,"shadowOffset",["x","y"]),t.Factory.addGetterSetter(O,"shadowOffsetX",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"shadowOffsetY",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternImage"),t.Factory.addGetterSetter(O,"fill",void 0,(0,a.getStringOrGradientValidator)()),t.Factory.addGetterSetter(O,"fillPatternX",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternY",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillLinearGradientColorStops"),t.Factory.addGetterSetter(O,"strokeLinearGradientColorStops"),t.Factory.addGetterSetter(O,"fillRadialGradientStartRadius",0),t.Factory.addGetterSetter(O,"fillRadialGradientEndRadius",0),t.Factory.addGetterSetter(O,"fillRadialGradientColorStops"),t.Factory.addGetterSetter(O,"fillPatternRepeat","repeat"),t.Factory.addGetterSetter(O,"fillEnabled",!0),t.Factory.addGetterSetter(O,"strokeEnabled",!0),t.Factory.addGetterSetter(O,"shadowEnabled",!0),t.Factory.addGetterSetter(O,"dashEnabled",!0),t.Factory.addGetterSetter(O,"strokeScaleEnabled",!0),t.Factory.addGetterSetter(O,"fillPriority","color"),t.Factory.addComponentsGetterSetter(O,"fillPatternOffset",["x","y"]),t.Factory.addGetterSetter(O,"fillPatternOffsetX",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternOffsetY",0,(0,a.getNumberValidator)()),t.Factory.addComponentsGetterSetter(O,"fillPatternScale",["x","y"]),t.Factory.addGetterSetter(O,"fillPatternScaleX",1,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternScaleY",1,(0,a.getNumberValidator)()),t.Factory.addComponentsGetterSetter(O,"fillLinearGradientStartPoint",["x","y"]),t.Factory.addComponentsGetterSetter(O,"strokeLinearGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillLinearGradientStartPointX",0),t.Factory.addGetterSetter(O,"strokeLinearGradientStartPointX",0),t.Factory.addGetterSetter(O,"fillLinearGradientStartPointY",0),t.Factory.addGetterSetter(O,"strokeLinearGradientStartPointY",0),t.Factory.addComponentsGetterSetter(O,"fillLinearGradientEndPoint",["x","y"]),t.Factory.addComponentsGetterSetter(O,"strokeLinearGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillLinearGradientEndPointX",0),t.Factory.addGetterSetter(O,"strokeLinearGradientEndPointX",0),t.Factory.addGetterSetter(O,"fillLinearGradientEndPointY",0),t.Factory.addGetterSetter(O,"strokeLinearGradientEndPointY",0),t.Factory.addComponentsGetterSetter(O,"fillRadialGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillRadialGradientStartPointX",0),t.Factory.addGetterSetter(O,"fillRadialGradientStartPointY",0),t.Factory.addComponentsGetterSetter(O,"fillRadialGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillRadialGradientEndPointX",0),t.Factory.addGetterSetter(O,"fillRadialGradientEndPointY",0),t.Factory.addGetterSetter(O,"fillPatternRotation",0),t.Factory.addGetterSetter(O,"fillRule",void 0,(0,a.getStringValidator)()),t.Factory.backCompat(O,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Shape);Object.defineProperty(Layer$2,"__esModule",{value:!0});Layer$2.Layer=void 0;const Util_1$b=Util,Container_1$1=Container$2,Node_1$g=Node$1,Factory_1$w=Factory,Canvas_1=Canvas$1,Validators_1$v=Validators,Shape_1$g=Shape,Global_1$k=Global;var HASH="#",BEFORE_DRAW="beforeDraw",DRAW="draw",INTERSECTION_OFFSETS=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],INTERSECTION_OFFSETS_LEN=INTERSECTION_OFFSETS.length;let Layer$1=class extends Container_1$1.Container{constructor(e){super(e),this.canvas=new Canvas_1.SceneCanvas,this.hitCanvas=new Canvas_1.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var r=this.getStage();return r&&r.content&&(r.content.removeChild(this.getNativeCanvasElement()),e<r.children.length-1?r.content.insertBefore(this.getNativeCanvasElement(),r.children[e+1].getCanvas()._canvas):r.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Node_1$g.Node.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var e=Node_1$g.Node.prototype.moveUp.call(this);if(!e)return!1;var r=this.getStage();return!r||!r.content?!1:(r.content.removeChild(this.getNativeCanvasElement()),this.index<r.children.length-1?r.content.insertBefore(this.getNativeCanvasElement(),r.children[this.index+1].getCanvas()._canvas):r.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Node_1$g.Node.prototype.moveDown.call(this)){var e=this.getStage();if(e){var r=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),r[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Node_1$g.Node.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var r=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),r[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return Node_1$g.Node.prototype.remove.call(this),e&&e.parentNode&&Util_1$b.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:r}){return this.canvas.setSize(e,r),this.hitCanvas.setSize(e,r),this._setSmoothEnabled(),this}_validateAdd(e){var r=e.getType();r!=="Group"&&r!=="Shape"&&Util_1$b.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e=e||{},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),Node_1$g.Node.prototype._toKonvaCanvas.call(this,e)}_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(){Util_1$b.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Util_1$b.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Util_1$b.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var r=1,t=!1;;){for(let n=0;n<INTERSECTION_OFFSETS_LEN;n++){const a=INTERSECTION_OFFSETS[n],l=this._getIntersection({x:e.x+a.x*r,y:e.y+a.y*r}),u=l.shape;if(u)return u;if(t=!!l.antialiased,!l.antialiased)break}if(t)r+=1;else return null}}_getIntersection(e){const r=this.hitCanvas.pixelRatio,t=this.hitCanvas.context.getImageData(Math.round(e.x*r),Math.round(e.y*r),1,1).data,n=t[3];if(n===255){const a=Util_1$b.Util._rgbToHex(t[0],t[1],t[2]),l=Shape_1$g.shapes[HASH+a];return l?{shape:l}:{antialiased:!0}}else if(n>0)return{antialiased:!0};return{}}drawScene(e,r){var t=this.getLayer(),n=e||t&&t.getCanvas();return this._fire(BEFORE_DRAW,{node:this}),this.clearBeforeDraw()&&n.getContext().clear(),Container_1$1.Container.prototype.drawScene.call(this,n,r),this._fire(DRAW,{node:this}),this}drawHit(e,r){var t=this.getLayer(),n=e||t&&t.hitCanvas;return t&&t.clearBeforeDraw()&&t.getHitCanvas().getContext().clear(),Container_1$1.Container.prototype.drawHit.call(this,n,r),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,r=!!this.hitCanvas._canvas.parentNode;r?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Util_1$b.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Layer$2.Layer=Layer$1;Layer$1.prototype.nodeType="Layer";(0,Global_1$k._registerNode)(Layer$1);Factory_1$w.Factory.addGetterSetter(Layer$1,"imageSmoothingEnabled",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"clearBeforeDraw",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"hitGraphEnabled",!0,(0,Validators_1$v.getBooleanValidator)());var FastLayer$1={};Object.defineProperty(FastLayer$1,"__esModule",{value:!0});FastLayer$1.FastLayer=void 0;const Util_1$a=Util,Layer_1=Layer$2,Global_1$j=Global;class FastLayer extends Layer_1.Layer{constructor(e){super(e),this.listening(!1),Util_1$a.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}FastLayer$1.FastLayer=FastLayer;FastLayer.prototype.nodeType="FastLayer";(0,Global_1$j._registerNode)(FastLayer);var Group$2={};Object.defineProperty(Group$2,"__esModule",{value:!0});Group$2.Group=void 0;const Util_1$9=Util,Container_1=Container$2,Global_1$i=Global;let Group$1=class extends Container_1.Container{_validateAdd(e){var r=e.getType();r!=="Group"&&r!=="Shape"&&Util_1$9.Util.throw("You may only add groups and shapes to groups.")}};Group$2.Group=Group$1;Group$1.prototype.nodeType="Group";(0,Global_1$i._registerNode)(Group$1);var Animation$2={};Object.defineProperty(Animation$2,"__esModule",{value:!0});Animation$2.Animation=void 0;const Global_1$h=Global,Util_1$8=Util,now=function(){return Global_1$h.glob.performance&&Global_1$h.glob.performance.now?function(){return Global_1$h.glob.performance.now()}:function(){return new Date().getTime()}}();let Animation$1=class Hl{constructor(e,r){this.id=Hl.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:now(),frameRate:0},this.func=e,this.setLayers(r)}setLayers(e){let r=[];return e&&(r=Array.isArray(e)?e:[e]),this.layers=r,this}getLayers(){return this.layers}addLayer(e){const r=this.layers,t=r.length;for(let n=0;n<t;n++)if(r[n]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const r=Hl.animations,t=r.length;for(let n=0;n<t;n++)if(r[n].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=now(),Hl._addAnimation(this),this}stop(){return Hl._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const r=e.id,t=this.animations,n=t.length;for(let a=0;a<n;a++)if(t[a].id===r){this.animations.splice(a,1);break}}static _runFrames(){const e={},r=this.animations;for(let t=0;t<r.length;t++){const n=r[t],a=n.layers,l=n.func;n._updateFrameObject(now());const u=a.length;let f;if(l?f=l.call(n,n.frame)!==!1:f=!0,!!f)for(let d=0;d<u;d++){const h=a[d];h._id!==void 0&&(e[h._id]=h)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){const e=Hl;e.animations.length?(e._runFrames(),Util_1$8.Util.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Util_1$8.Util.requestAnimFrame(this._animationLoop))}};Animation$2.Animation=Animation$1;Animation$1.animations=[];Animation$1.animIdCounter=0;Animation$1.animRunning=!1;var Tween$1={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Easings=o.Tween=void 0;const e=Util,r=Animation$2,t=Node$1,n=Global;var a={node:1,duration:1,easing:1,onFinish:1,yoyo:1},l=1,u=2,f=3,d=0,h=["fill","stroke","shadowColor"];class y{constructor(_,p,x,C,R,S,A){this.prop=_,this.propFunc=p,this.begin=C,this._pos=C,this.duration=S,this._change=0,this.prevPos=0,this.yoyo=A,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=x,this._change=R-this.begin,this.pause()}fire(_){var p=this[_];p&&p()}setTime(_){_>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():_<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=_,this.update())}getTime(){return this._time}setPosition(_){this.prevPos=this._pos,this.propFunc(_),this._pos=_}getPosition(_){return _===void 0&&(_=this._time),this.func(_,this.begin,this._change,this.duration)}play(){this.state=u,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=f,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(_){this.pause(),this._time=_,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var _=this.getTimer()-this._startTime;this.state===u?this.setTime(_):this.state===f&&this.setTime(this.duration-_)}pause(){this.state=l,this.fire("onPause")}getTimer(){return new Date().getTime()}}class E{constructor(_){var p=this,x=_.node,C=x._id,R,S=_.easing||o.Easings.Linear,A=!!_.yoyo,T;typeof _.duration>"u"?R=.3:_.duration===0?R=.001:R=_.duration,this.node=x,this._id=d++;var P=x.getLayer()||(x instanceof n.Konva.Stage?x.getLayers():null);P||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new r.Animation(function(){p.tween.onEnterFrame()},P),this.tween=new y(T,function(w){p._tweenFunc(w)},S,0,1,R*1e3,A),this._addListeners(),E.attrs[C]||(E.attrs[C]={}),E.attrs[C][this._id]||(E.attrs[C][this._id]={}),E.tweens[C]||(E.tweens[C]={});for(T in _)a[T]===void 0&&this._addAttr(T,_[T]);this.reset(),this.onFinish=_.onFinish,this.onReset=_.onReset,this.onUpdate=_.onUpdate}_addAttr(_,p){var x=this.node,C=x._id,R,S,A,T,P,w,O,k;if(A=E.tweens[C][_],A&&delete E.attrs[C][A][_],R=x.getAttr(_),e.Util._isArray(p))if(S=[],P=Math.max(p.length,R.length),_==="points"&&p.length!==R.length&&(p.length>R.length?(O=R,R=e.Util._prepareArrayForTween(R,p,x.closed())):(w=p,p=e.Util._prepareArrayForTween(p,R,x.closed()))),_.indexOf("fill")===0)for(T=0;T<P;T++)if(T%2===0)S.push(p[T]-R[T]);else{var D=e.Util.colorToRGBA(R[T]);k=e.Util.colorToRGBA(p[T]),R[T]=D,S.push({r:k.r-D.r,g:k.g-D.g,b:k.b-D.b,a:k.a-D.a})}else for(T=0;T<P;T++)S.push(p[T]-R[T]);else h.indexOf(_)!==-1?(R=e.Util.colorToRGBA(R),k=e.Util.colorToRGBA(p),S={r:k.r-R.r,g:k.g-R.g,b:k.b-R.b,a:k.a-R.a}):S=p-R;E.attrs[C][this._id][_]={start:R,diff:S,end:p,trueEnd:w,trueStart:O},E.tweens[C][_]=this._id}_tweenFunc(_){var p=this.node,x=E.attrs[p._id][this._id],C,R,S,A,T,P,w,O;for(C in x){if(R=x[C],S=R.start,A=R.diff,O=R.end,e.Util._isArray(S))if(T=[],w=Math.max(S.length,O.length),C.indexOf("fill")===0)for(P=0;P<w;P++)P%2===0?T.push((S[P]||0)+A[P]*_):T.push("rgba("+Math.round(S[P].r+A[P].r*_)+","+Math.round(S[P].g+A[P].g*_)+","+Math.round(S[P].b+A[P].b*_)+","+(S[P].a+A[P].a*_)+")");else for(P=0;P<w;P++)T.push((S[P]||0)+A[P]*_);else h.indexOf(C)!==-1?T="rgba("+Math.round(S.r+A.r*_)+","+Math.round(S.g+A.g*_)+","+Math.round(S.b+A.b*_)+","+(S.a+A.a*_)+")":T=S+A*_;p.setAttr(C,T)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var _=this.node,p=E.attrs[_._id][this._id];p.points&&p.points.trueEnd&&_.setAttr("points",p.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var _=this.node,p=E.attrs[_._id][this._id];p.points&&p.points.trueStart&&_.points(p.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(_){return this.tween.seek(_*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var _=this.node._id,p=this._id,x=E.tweens[_],C;this.pause();for(C in x)delete E.tweens[_][C];delete E.attrs[_][p]}}o.Tween=E,E.attrs={},E.tweens={},t.Node.prototype.to=function(g){var _=g.onFinish;g.node=this,g.onFinish=function(){this.destroy(),_&&_()};var p=new E(g);p.play()},o.Easings={BackEaseIn(g,_,p,x){var C=1.70158;return p*(g/=x)*g*((C+1)*g-C)+_},BackEaseOut(g,_,p,x){var C=1.70158;return p*((g=g/x-1)*g*((C+1)*g+C)+1)+_},BackEaseInOut(g,_,p,x){var C=1.70158;return(g/=x/2)<1?p/2*(g*g*(((C*=1.525)+1)*g-C))+_:p/2*((g-=2)*g*(((C*=1.525)+1)*g+C)+2)+_},ElasticEaseIn(g,_,p,x,C,R){var S=0;return g===0?_:(g/=x)===1?_+p:(R||(R=x*.3),!C||C<Math.abs(p)?(C=p,S=R/4):S=R/(2*Math.PI)*Math.asin(p/C),-(C*Math.pow(2,10*(g-=1))*Math.sin((g*x-S)*(2*Math.PI)/R))+_)},ElasticEaseOut(g,_,p,x,C,R){var S=0;return g===0?_:(g/=x)===1?_+p:(R||(R=x*.3),!C||C<Math.abs(p)?(C=p,S=R/4):S=R/(2*Math.PI)*Math.asin(p/C),C*Math.pow(2,-10*g)*Math.sin((g*x-S)*(2*Math.PI)/R)+p+_)},ElasticEaseInOut(g,_,p,x,C,R){var S=0;return g===0?_:(g/=x/2)===2?_+p:(R||(R=x*(.3*1.5)),!C||C<Math.abs(p)?(C=p,S=R/4):S=R/(2*Math.PI)*Math.asin(p/C),g<1?-.5*(C*Math.pow(2,10*(g-=1))*Math.sin((g*x-S)*(2*Math.PI)/R))+_:C*Math.pow(2,-10*(g-=1))*Math.sin((g*x-S)*(2*Math.PI)/R)*.5+p+_)},BounceEaseOut(g,_,p,x){return(g/=x)<1/2.75?p*(7.5625*g*g)+_:g<2/2.75?p*(7.5625*(g-=1.5/2.75)*g+.75)+_:g<2.5/2.75?p*(7.5625*(g-=2.25/2.75)*g+.9375)+_:p*(7.5625*(g-=2.625/2.75)*g+.984375)+_},BounceEaseIn(g,_,p,x){return p-o.Easings.BounceEaseOut(x-g,0,p,x)+_},BounceEaseInOut(g,_,p,x){return g<x/2?o.Easings.BounceEaseIn(g*2,0,p,x)*.5+_:o.Easings.BounceEaseOut(g*2-x,0,p,x)*.5+p*.5+_},EaseIn(g,_,p,x){return p*(g/=x)*g+_},EaseOut(g,_,p,x){return-p*(g/=x)*(g-2)+_},EaseInOut(g,_,p,x){return(g/=x/2)<1?p/2*g*g+_:-p/2*(--g*(g-2)-1)+_},StrongEaseIn(g,_,p,x){return p*(g/=x)*g*g*g*g+_},StrongEaseOut(g,_,p,x){return p*((g=g/x-1)*g*g*g*g+1)+_},StrongEaseInOut(g,_,p,x){return(g/=x/2)<1?p/2*g*g*g*g*g+_:p/2*((g-=2)*g*g*g*g+2)+_},Linear(g,_,p,x){return p*g/x+_}}})(Tween$1);(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Konva=void 0;const e=Global,r=Util,t=Node$1,n=Container$2,a=Stage$1,l=Layer$2,u=FastLayer$1,f=Group$2,d=DragAndDrop,h=Shape,y=Animation$2,E=Tween$1,g=Context$2,_=Canvas$1;o.Konva=r.Util._assign(e.Konva,{Util:r.Util,Transform:r.Transform,Node:t.Node,Container:n.Container,Stage:a.Stage,stages:a.stages,Layer:l.Layer,FastLayer:u.FastLayer,Group:f.Group,DD:d.DD,Shape:h.Shape,shapes:h.shapes,Animation:y.Animation,Tween:E.Tween,Easings:E.Easings,Context:g.Context,Canvas:_.Canvas}),o.default=o.Konva})(_CoreInternals);var Arc$1={};Object.defineProperty(Arc$1,"__esModule",{value:!0});Arc$1.Arc=void 0;const Factory_1$v=Factory,Shape_1$f=Shape,Global_1$g=Global,Validators_1$u=Validators,Global_2$2=Global;class Arc extends Shape_1$f.Shape{_sceneFunc(e){var r=Global_1$g.Konva.getAngle(this.angle()),t=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,r,t),e.arc(0,0,this.innerRadius(),r,0,!t),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),r=this.outerRadius(),t=this.clockwise(),n=Global_1$g.Konva.getAngle(t?360-this.angle():this.angle()),a=Math.cos(Math.min(n,Math.PI)),l=1,u=Math.sin(Math.min(Math.max(Math.PI,n),3*Math.PI/2)),f=Math.sin(Math.min(n,Math.PI/2)),d=a*(a>0?e:r),h=l*r,y=u*(u>0?e:r),E=f*(f>0?r:e);return{x:d,y:t?-1*E:y,width:h-d,height:E-y}}}Arc$1.Arc=Arc;Arc.prototype._centroid=!0;Arc.prototype.className="Arc";Arc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_2$2._registerNode)(Arc);Factory_1$v.Factory.addGetterSetter(Arc,"innerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"outerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"angle",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"clockwise",!1,(0,Validators_1$u.getBooleanValidator)());var Arrow$1={},Line$2={};Object.defineProperty(Line$2,"__esModule",{value:!0});Line$2.Line=void 0;const Factory_1$u=Factory,Shape_1$e=Shape,Validators_1$t=Validators,Global_1$f=Global;function getControlPoints(o,e,r,t,n,a,l){var u=Math.sqrt(Math.pow(r-o,2)+Math.pow(t-e,2)),f=Math.sqrt(Math.pow(n-r,2)+Math.pow(a-t,2)),d=l*u/(u+f),h=l*f/(u+f),y=r-d*(n-o),E=t-d*(a-e),g=r+h*(n-o),_=t+h*(a-e);return[y,E,g,_]}function expandPoints(o,e){var r=o.length,t=[],n,a;for(n=2;n<r-2;n+=2)a=getControlPoints(o[n-2],o[n-1],o[n],o[n+1],o[n+2],o[n+3],e),!isNaN(a[0])&&(t.push(a[0]),t.push(a[1]),t.push(o[n]),t.push(o[n+1]),t.push(a[2]),t.push(a[3]));return t}let Line$1=class extends Shape_1$e.Shape{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){var r=this.points(),t=r.length,n=this.tension(),a=this.closed(),l=this.bezier(),u,f,d;if(t){if(e.beginPath(),e.moveTo(r[0],r[1]),n!==0&&t>4){for(u=this.getTensionPoints(),f=u.length,d=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);d<f-2;)e.bezierCurveTo(u[d++],u[d++],u[d++],u[d++],u[d++],u[d++]);a||e.quadraticCurveTo(u[f-2],u[f-1],r[t-2],r[t-1])}else if(l)for(d=2;d<t;)e.bezierCurveTo(r[d++],r[d++],r[d++],r[d++],r[d++],r[d++]);else for(d=2;d<t;d+=2)e.lineTo(r[d],r[d+1]);a?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():expandPoints(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),r=e.length,t=this.tension(),n=getControlPoints(e[r-2],e[r-1],e[0],e[1],e[2],e[3],t),a=getControlPoints(e[r-4],e[r-3],e[r-2],e[r-1],e[0],e[1],t),l=expandPoints(e,t),u=[n[2],n[3]].concat(l).concat([a[0],a[1],e[r-2],e[r-1],a[2],a[3],n[0],n[1],e[0],e[1]]);return u}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:e=this.points();for(var r=e[0],t=e[0],n=e[1],a=e[1],l,u,f=0;f<e.length/2;f++)l=e[f*2],u=e[f*2+1],r=Math.min(r,l),t=Math.max(t,l),n=Math.min(n,u),a=Math.max(a,u);return{x:r,y:n,width:t-r,height:a-n}}};Line$2.Line=Line$1;Line$1.prototype.className="Line";Line$1.prototype._attrsAffectingSize=["points","bezier","tension"];(0,Global_1$f._registerNode)(Line$1);Factory_1$u.Factory.addGetterSetter(Line$1,"closed",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"bezier",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"tension",0,(0,Validators_1$t.getNumberValidator)());Factory_1$u.Factory.addGetterSetter(Line$1,"points",[],(0,Validators_1$t.getNumberArrayValidator)());var Path$1={},BezierFunctions={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.t2length=o.getQuadraticArcLength=o.getCubicArcLength=o.binomialCoefficients=o.cValues=o.tValues=void 0,o.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],o.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],o.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const e=(l,u,f)=>{let d,h,y;d=f/2,h=0;for(let g=0;g<20;g++)y=d*o.tValues[20][g]+d,h+=o.cValues[20][g]*t(l,u,y);return d*h};o.getCubicArcLength=e;const r=(l,u,f)=>{f===void 0&&(f=1);const d=l[0]-2*l[1]+l[2],h=u[0]-2*u[1]+u[2],y=2*l[1]-2*l[0],E=2*u[1]-2*u[0],g=4*(d*d+h*h),_=4*(d*y+h*E),p=y*y+E*E;if(g===0)return f*Math.sqrt(Math.pow(l[2]-l[0],2)+Math.pow(u[2]-u[0],2));const x=_/(2*g),C=p/g,R=f+x,S=C-x*x,A=R*R+S>0?Math.sqrt(R*R+S):0,T=x*x+S>0?Math.sqrt(x*x+S):0,P=x+Math.sqrt(x*x+S)!==0?S*Math.log(Math.abs((R+A)/(x+T))):0;return Math.sqrt(g)/2*(R*A-x*T+P)};o.getQuadraticArcLength=r;function t(l,u,f){const d=n(1,f,l),h=n(1,f,u),y=d*d+h*h;return Math.sqrt(y)}const n=(l,u,f)=>{const d=f.length-1;let h,y;if(d===0)return 0;if(l===0){y=0;for(let E=0;E<=d;E++)y+=o.binomialCoefficients[d][E]*Math.pow(1-u,d-E)*Math.pow(u,E)*f[E];return y}else{h=new Array(d);for(let E=0;E<d;E++)h[E]=d*(f[E+1]-f[E]);return n(l-1,u,h)}},a=(l,u,f)=>{let d=1,h=l/u,y=(l-f(h))/u,E=0;for(;d>.001;){const g=f(h+y),_=Math.abs(l-g)/u;if(_<d)d=_,h+=y;else{const p=f(h-y),x=Math.abs(l-p)/u;x<d?(d=x,h-=y):y/=2}if(E++,E>500)break}return h};o.t2length=a})(BezierFunctions);Object.defineProperty(Path$1,"__esModule",{value:!0});Path$1.Path=void 0;const Factory_1$t=Factory,Shape_1$d=Shape,Global_1$e=Global,BezierFunctions_1=BezierFunctions;class Path extends Shape_1$d.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Path.parsePathData(this.data()),this.pathLength=Path.getPathLength(this.dataArray)}_sceneFunc(e){var r=this.dataArray;e.beginPath();for(var t=!1,n=0;n<r.length;n++){var a=r[n].command,l=r[n].points;switch(a){case"L":e.lineTo(l[0],l[1]);break;case"M":e.moveTo(l[0],l[1]);break;case"C":e.bezierCurveTo(l[0],l[1],l[2],l[3],l[4],l[5]);break;case"Q":e.quadraticCurveTo(l[0],l[1],l[2],l[3]);break;case"A":var u=l[0],f=l[1],d=l[2],h=l[3],y=l[4],E=l[5],g=l[6],_=l[7],p=d>h?d:h,x=d>h?1:d/h,C=d>h?h/d:1;e.translate(u,f),e.rotate(g),e.scale(x,C),e.arc(0,0,p,y,y+E,1-_),e.scale(1/x,1/C),e.rotate(-g),e.translate(-u,-f);break;case"z":t=!0,e.closePath();break}}!t&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(d){if(d.command==="A"){var h=d.points[4],y=d.points[5],E=d.points[4]+y,g=Math.PI/180;if(Math.abs(h-E)<g&&(g=Math.abs(h-E)),y<0)for(let _=h-g;_>E;_-=g){const p=Path.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],_,0);e.push(p.x,p.y)}else for(let _=h+g;_<E;_+=g){const p=Path.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],_,0);e.push(p.x,p.y)}}else if(d.command==="C")for(let _=0;_<=1;_+=.01){const p=Path.getPointOnCubicBezier(_,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3],d.points[4],d.points[5]);e.push(p.x,p.y)}else e=e.concat(d.points)});for(var r=e[0],t=e[0],n=e[1],a=e[1],l,u,f=0;f<e.length/2;f++)l=e[f*2],u=e[f*2+1],isNaN(l)||(r=Math.min(r,l),t=Math.max(t,l)),isNaN(u)||(n=Math.min(n,u),a=Math.max(a,u));return{x:r,y:n,width:t-r,height:a-n}}getLength(){return this.pathLength}getPointAtLength(e){return Path.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,r,t,n){return Math.sqrt((t-e)*(t-e)+(n-r)*(n-r))}static getPathLength(e){let r=0;for(var t=0;t<e.length;++t)r+=e[t].pathLength;return r}static getPointAtLengthOfDataArray(e,r){var t,n=0,a=r.length;if(!a)return null;for(;n<a&&e>r[n].pathLength;)e-=r[n].pathLength,++n;if(n===a)return t=r[n-1].points.slice(-2),{x:t[0],y:t[1]};if(e<.01)return t=r[n].points.slice(0,2),{x:t[0],y:t[1]};var l=r[n],u=l.points;switch(l.command){case"L":return Path.getPointOnLine(e,l.start.x,l.start.y,u[0],u[1]);case"C":return Path.getPointOnCubicBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(r),p=>(0,BezierFunctions_1.getCubicArcLength)([l.start.x,u[0],u[2],u[4]],[l.start.y,u[1],u[3],u[5]],p)),l.start.x,l.start.y,u[0],u[1],u[2],u[3],u[4],u[5]);case"Q":return Path.getPointOnQuadraticBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(r),p=>(0,BezierFunctions_1.getQuadraticArcLength)([l.start.x,u[0],u[2]],[l.start.y,u[1],u[3]],p)),l.start.x,l.start.y,u[0],u[1],u[2],u[3]);case"A":var f=u[0],d=u[1],h=u[2],y=u[3],E=u[4],g=u[5],_=u[6];return E+=g*e/l.pathLength,Path.getPointOnEllipticalArc(f,d,h,y,E,_)}return null}static getPointOnLine(e,r,t,n,a,l,u){l===void 0&&(l=r),u===void 0&&(u=t);var f=(a-t)/(n-r+1e-8),d=Math.sqrt(e*e/(1+f*f));n<r&&(d*=-1);var h=f*d,y;if(n===r)y={x:l,y:u+h};else if((u-t)/(l-r+1e-8)===f)y={x:l+d,y:u+h};else{var E,g,_=this.getLineLength(r,t,n,a),p=(l-r)*(n-r)+(u-t)*(a-t);p=p/(_*_),E=r+p*(n-r),g=t+p*(a-t);var x=this.getLineLength(l,u,E,g),C=Math.sqrt(e*e-x*x);d=Math.sqrt(C*C/(1+f*f)),n<r&&(d*=-1),h=f*d,y={x:E+d,y:g+h}}return y}static getPointOnCubicBezier(e,r,t,n,a,l,u,f,d){function h(x){return x*x*x}function y(x){return 3*x*x*(1-x)}function E(x){return 3*x*(1-x)*(1-x)}function g(x){return(1-x)*(1-x)*(1-x)}var _=f*h(e)+l*y(e)+n*E(e)+r*g(e),p=d*h(e)+u*y(e)+a*E(e)+t*g(e);return{x:_,y:p}}static getPointOnQuadraticBezier(e,r,t,n,a,l,u){function f(g){return g*g}function d(g){return 2*g*(1-g)}function h(g){return(1-g)*(1-g)}var y=l*f(e)+n*d(e)+r*h(e),E=u*f(e)+a*d(e)+t*h(e);return{x:y,y:E}}static getPointOnEllipticalArc(e,r,t,n,a,l){var u=Math.cos(l),f=Math.sin(l),d={x:t*Math.cos(a),y:n*Math.sin(a)};return{x:e+(d.x*u-d.y*f),y:r+(d.x*f+d.y*u)}}static parsePathData(e){if(!e)return[];var r=e,t=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];r=r.replace(new RegExp(" ","g"),",");for(var n=0;n<t.length;n++)r=r.replace(new RegExp(t[n],"g"),"|"+t[n]);var a=r.split("|"),l=[],u=[],f=0,d=0,h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,y;for(n=1;n<a.length;n++){var E=a[n],g=E.charAt(0);for(E=E.slice(1),u.length=0;y=h.exec(E);)u.push(y[0]);for(var _=[],p=0,x=u.length;p<x;p++){if(u[p]==="00"){_.push(0,0);continue}var C=parseFloat(u[p]);isNaN(C)?_.push(0):_.push(C)}for(;_.length>0&&!isNaN(_[0]);){var R="",S=[],A=f,T=d,P,w,O,k,D,F,U,H,W,ee;switch(g){case"l":f+=_.shift(),d+=_.shift(),R="L",S.push(f,d);break;case"L":f=_.shift(),d=_.shift(),S.push(f,d);break;case"m":var q=_.shift(),B=_.shift();if(f+=q,d+=B,R="M",l.length>2&&l[l.length-1].command==="z"){for(var G=l.length-2;G>=0;G--)if(l[G].command==="M"){f=l[G].points[0]+q,d=l[G].points[1]+B;break}}S.push(f,d),g="l";break;case"M":f=_.shift(),d=_.shift(),R="M",S.push(f,d),g="L";break;case"h":f+=_.shift(),R="L",S.push(f,d);break;case"H":f=_.shift(),R="L",S.push(f,d);break;case"v":d+=_.shift(),R="L",S.push(f,d);break;case"V":d=_.shift(),R="L",S.push(f,d);break;case"C":S.push(_.shift(),_.shift(),_.shift(),_.shift()),f=_.shift(),d=_.shift(),S.push(f,d);break;case"c":S.push(f+_.shift(),d+_.shift(),f+_.shift(),d+_.shift()),f+=_.shift(),d+=_.shift(),R="C",S.push(f,d);break;case"S":w=f,O=d,P=l[l.length-1],P.command==="C"&&(w=f+(f-P.points[2]),O=d+(d-P.points[3])),S.push(w,O,_.shift(),_.shift()),f=_.shift(),d=_.shift(),R="C",S.push(f,d);break;case"s":w=f,O=d,P=l[l.length-1],P.command==="C"&&(w=f+(f-P.points[2]),O=d+(d-P.points[3])),S.push(w,O,f+_.shift(),d+_.shift()),f+=_.shift(),d+=_.shift(),R="C",S.push(f,d);break;case"Q":S.push(_.shift(),_.shift()),f=_.shift(),d=_.shift(),S.push(f,d);break;case"q":S.push(f+_.shift(),d+_.shift()),f+=_.shift(),d+=_.shift(),R="Q",S.push(f,d);break;case"T":w=f,O=d,P=l[l.length-1],P.command==="Q"&&(w=f+(f-P.points[0]),O=d+(d-P.points[1])),f=_.shift(),d=_.shift(),R="Q",S.push(w,O,f,d);break;case"t":w=f,O=d,P=l[l.length-1],P.command==="Q"&&(w=f+(f-P.points[0]),O=d+(d-P.points[1])),f+=_.shift(),d+=_.shift(),R="Q",S.push(w,O,f,d);break;case"A":k=_.shift(),D=_.shift(),F=_.shift(),U=_.shift(),H=_.shift(),W=f,ee=d,f=_.shift(),d=_.shift(),R="A",S=this.convertEndpointToCenterParameterization(W,ee,f,d,U,H,k,D,F);break;case"a":k=_.shift(),D=_.shift(),F=_.shift(),U=_.shift(),H=_.shift(),W=f,ee=d,f+=_.shift(),d+=_.shift(),R="A",S=this.convertEndpointToCenterParameterization(W,ee,f,d,U,H,k,D,F);break}l.push({command:R||g,points:S,start:{x:A,y:T},pathLength:this.calcLength(A,T,R||g,S)})}(g==="z"||g==="Z")&&l.push({command:"z",points:[],start:void 0,pathLength:0})}return l}static calcLength(e,r,t,n){var a,l,u,f,d=Path;switch(t){case"L":return d.getLineLength(e,r,n[0],n[1]);case"C":return(0,BezierFunctions_1.getCubicArcLength)([e,n[0],n[2],n[4]],[r,n[1],n[3],n[5]],1);case"Q":return(0,BezierFunctions_1.getQuadraticArcLength)([e,n[0],n[2]],[r,n[1],n[3]],1);case"A":a=0;var h=n[4],y=n[5],E=n[4]+y,g=Math.PI/180;if(Math.abs(h-E)<g&&(g=Math.abs(h-E)),l=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],h,0),y<0)for(f=h-g;f>E;f-=g)u=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],f,0),a+=d.getLineLength(l.x,l.y,u.x,u.y),l=u;else for(f=h+g;f<E;f+=g)u=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],f,0),a+=d.getLineLength(l.x,l.y,u.x,u.y),l=u;return u=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],E,0),a+=d.getLineLength(l.x,l.y,u.x,u.y),a}return 0}static convertEndpointToCenterParameterization(e,r,t,n,a,l,u,f,d){var h=d*(Math.PI/180),y=Math.cos(h)*(e-t)/2+Math.sin(h)*(r-n)/2,E=-1*Math.sin(h)*(e-t)/2+Math.cos(h)*(r-n)/2,g=y*y/(u*u)+E*E/(f*f);g>1&&(u*=Math.sqrt(g),f*=Math.sqrt(g));var _=Math.sqrt((u*u*(f*f)-u*u*(E*E)-f*f*(y*y))/(u*u*(E*E)+f*f*(y*y)));a===l&&(_*=-1),isNaN(_)&&(_=0);var p=_*u*E/f,x=_*-f*y/u,C=(e+t)/2+Math.cos(h)*p-Math.sin(h)*x,R=(r+n)/2+Math.sin(h)*p+Math.cos(h)*x,S=function(D){return Math.sqrt(D[0]*D[0]+D[1]*D[1])},A=function(D,F){return(D[0]*F[0]+D[1]*F[1])/(S(D)*S(F))},T=function(D,F){return(D[0]*F[1]<D[1]*F[0]?-1:1)*Math.acos(A(D,F))},P=T([1,0],[(y-p)/u,(E-x)/f]),w=[(y-p)/u,(E-x)/f],O=[(-1*y-p)/u,(-1*E-x)/f],k=T(w,O);return A(w,O)<=-1&&(k=Math.PI),A(w,O)>=1&&(k=0),l===0&&k>0&&(k=k-2*Math.PI),l===1&&k<0&&(k=k+2*Math.PI),[C,R,u,f,P,k,h,l]}}Path$1.Path=Path;Path.prototype.className="Path";Path.prototype._attrsAffectingSize=["data"];(0,Global_1$e._registerNode)(Path);Factory_1$t.Factory.addGetterSetter(Path,"data");Object.defineProperty(Arrow$1,"__esModule",{value:!0});Arrow$1.Arrow=void 0;const Factory_1$s=Factory,Line_1$1=Line$2,Validators_1$s=Validators,Global_1$d=Global,Path_1$2=Path$1;class Arrow extends Line_1$1.Line{_sceneFunc(e){super._sceneFunc(e);var r=Math.PI*2,t=this.points(),n=t,a=this.tension()!==0&&t.length>4;a&&(n=this.getTensionPoints());var l=this.pointerLength(),u=t.length,f,d;if(a){const E=[n[n.length-4],n[n.length-3],n[n.length-2],n[n.length-1],t[u-2],t[u-1]],g=Path_1$2.Path.calcLength(n[n.length-4],n[n.length-3],"C",E),_=Path_1$2.Path.getPointOnQuadraticBezier(Math.min(1,1-l/g),E[0],E[1],E[2],E[3],E[4],E[5]);f=t[u-2]-_.x,d=t[u-1]-_.y}else f=t[u-2]-t[u-4],d=t[u-1]-t[u-3];var h=(Math.atan2(d,f)+r)%r,y=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(t[u-2],t[u-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-l,y/2),e.lineTo(-l,-y/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(t[0],t[1]),a?(f=(n[0]+n[2])/2-t[0],d=(n[1]+n[3])/2-t[1]):(f=t[2]-t[0],d=t[3]-t[1]),e.rotate((Math.atan2(-d,-f)+r)%r),e.moveTo(0,0),e.lineTo(-l,y/2),e.lineTo(-l,-y/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var r=this.dashEnabled();r&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),r&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),r=this.pointerWidth()/2;return{x:e.x-r,y:e.y-r,width:e.width+r*2,height:e.height+r*2}}}Arrow$1.Arrow=Arrow;Arrow.prototype.className="Arrow";(0,Global_1$d._registerNode)(Arrow);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerLength",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerWidth",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtBeginning",!1);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtEnding",!0);var Circle$1={};Object.defineProperty(Circle$1,"__esModule",{value:!0});Circle$1.Circle=void 0;const Factory_1$r=Factory,Shape_1$c=Shape,Validators_1$r=Validators,Global_1$c=Global;class Circle extends Shape_1$c.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Circle$1.Circle=Circle;Circle.prototype._centroid=!0;Circle.prototype.className="Circle";Circle.prototype._attrsAffectingSize=["radius"];(0,Global_1$c._registerNode)(Circle);Factory_1$r.Factory.addGetterSetter(Circle,"radius",0,(0,Validators_1$r.getNumberValidator)());var Ellipse$1={};Object.defineProperty(Ellipse$1,"__esModule",{value:!0});Ellipse$1.Ellipse=void 0;const Factory_1$q=Factory,Shape_1$b=Shape,Validators_1$q=Validators,Global_1$b=Global;class Ellipse extends Shape_1$b.Shape{_sceneFunc(e){var r=this.radiusX(),t=this.radiusY();e.beginPath(),e.save(),r!==t&&e.scale(1,t/r),e.arc(0,0,r,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Ellipse$1.Ellipse=Ellipse;Ellipse.prototype.className="Ellipse";Ellipse.prototype._centroid=!0;Ellipse.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Global_1$b._registerNode)(Ellipse);Factory_1$q.Factory.addComponentsGetterSetter(Ellipse,"radius",["x","y"]);Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusX",0,(0,Validators_1$q.getNumberValidator)());Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusY",0,(0,Validators_1$q.getNumberValidator)());var Image$4={};Object.defineProperty(Image$4,"__esModule",{value:!0});Image$4.Image=void 0;const Util_1$7=Util,Factory_1$p=Factory,Shape_1$a=Shape,Global_1$a=Global,Validators_1$p=Validators;let Image$3=class wv extends Shape_1$a.Shape{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const r=this.getWidth(),t=this.getHeight(),n=this.cornerRadius(),a=this.attrs.image;let l;if(a){const u=this.attrs.cropWidth,f=this.attrs.cropHeight;u&&f?l=[a,this.cropX(),this.cropY(),u,f,0,0,r,t]:l=[a,0,0,r,t]}(this.hasFill()||this.hasStroke()||n)&&(e.beginPath(),n?Util_1$7.Util.drawRoundedRectPath(e,r,t,n):e.rect(0,0,r,t),e.closePath(),e.fillStrokeShape(this)),a&&(n&&e.clip(),e.drawImage.apply(e,l))}_hitFunc(e){var r=this.width(),t=this.height(),n=this.cornerRadius();e.beginPath(),n?Util_1$7.Util.drawRoundedRectPath(e,r,t,n):e.rect(0,0,r,t),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,r;return(e=this.attrs.width)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.width}getHeight(){var e,r;return(e=this.attrs.height)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.height}static fromURL(e,r,t=null){var n=Util_1$7.Util.createImageElement();n.onload=function(){var a=new wv({image:n});r(a)},n.onerror=t,n.crossOrigin="Anonymous",n.src=e}};Image$4.Image=Image$3;Image$3.prototype.className="Image";(0,Global_1$a._registerNode)(Image$3);Factory_1$p.Factory.addGetterSetter(Image$3,"cornerRadius",0,(0,Validators_1$p.getNumberOrArrayOfNumbersValidator)(4));Factory_1$p.Factory.addGetterSetter(Image$3,"image");Factory_1$p.Factory.addComponentsGetterSetter(Image$3,"crop",["x","y","width","height"]);Factory_1$p.Factory.addGetterSetter(Image$3,"cropX",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropY",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropWidth",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropHeight",0,(0,Validators_1$p.getNumberValidator)());var Label$1={};Object.defineProperty(Label$1,"__esModule",{value:!0});Label$1.Tag=Label$1.Label=void 0;const Factory_1$o=Factory,Shape_1$9=Shape,Group_1$1=Group$2,Validators_1$o=Validators,Global_1$9=Global;var ATTR_CHANGE_LIST$2=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],CHANGE_KONVA$1="Change.konva",NONE$1="none",UP="up",RIGHT$1="right",DOWN="down",LEFT$1="left",attrChangeListLen$1=ATTR_CHANGE_LIST$2.length;class Label extends Group_1$1.Group{constructor(e){super(e),this.on("add.konva",function(r){this._addListeners(r.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var r=this,t,n=function(){r._sync()};for(t=0;t<attrChangeListLen$1;t++)e.on(ATTR_CHANGE_LIST$2[t]+CHANGE_KONVA$1,n)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e=this.getText(),r=this.getTag(),t,n,a,l,u,f,d;if(e&&r){switch(t=e.width(),n=e.height(),a=r.pointerDirection(),l=r.pointerWidth(),d=r.pointerHeight(),u=0,f=0,a){case UP:u=t/2,f=-1*d;break;case RIGHT$1:u=t+l,f=n/2;break;case DOWN:u=t/2,f=n+d;break;case LEFT$1:u=-1*l,f=n/2;break}r.setAttrs({x:-1*u,y:-1*f,width:t,height:n}),e.setAttrs({x:-1*u,y:-1*f})}}}Label$1.Label=Label;Label.prototype.className="Label";(0,Global_1$9._registerNode)(Label);class Tag extends Shape_1$9.Shape{_sceneFunc(e){var r=this.width(),t=this.height(),n=this.pointerDirection(),a=this.pointerWidth(),l=this.pointerHeight(),u=this.cornerRadius();let f=0,d=0,h=0,y=0;typeof u=="number"?f=d=h=y=Math.min(u,r/2,t/2):(f=Math.min(u[0]||0,r/2,t/2),d=Math.min(u[1]||0,r/2,t/2),y=Math.min(u[2]||0,r/2,t/2),h=Math.min(u[3]||0,r/2,t/2)),e.beginPath(),e.moveTo(f,0),n===UP&&(e.lineTo((r-a)/2,0),e.lineTo(r/2,-1*l),e.lineTo((r+a)/2,0)),e.lineTo(r-d,0),e.arc(r-d,d,d,Math.PI*3/2,0,!1),n===RIGHT$1&&(e.lineTo(r,(t-l)/2),e.lineTo(r+a,t/2),e.lineTo(r,(t+l)/2)),e.lineTo(r,t-y),e.arc(r-y,t-y,y,0,Math.PI/2,!1),n===DOWN&&(e.lineTo((r+a)/2,t),e.lineTo(r/2,t+l),e.lineTo((r-a)/2,t)),e.lineTo(h,t),e.arc(h,t-h,h,Math.PI/2,Math.PI,!1),n===LEFT$1&&(e.lineTo(0,(t+l)/2),e.lineTo(-1*a,t/2),e.lineTo(0,(t-l)/2)),e.lineTo(0,f),e.arc(f,f,f,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,r=0,t=this.pointerWidth(),n=this.pointerHeight(),a=this.pointerDirection(),l=this.width(),u=this.height();return a===UP?(r-=n,u+=n):a===DOWN?u+=n:a===LEFT$1?(e-=t*1.5,l+=t):a===RIGHT$1&&(l+=t*1.5),{x:e,y:r,width:l,height:u}}}Label$1.Tag=Tag;Tag.prototype.className="Tag";(0,Global_1$9._registerNode)(Tag);Factory_1$o.Factory.addGetterSetter(Tag,"pointerDirection",NONE$1);Factory_1$o.Factory.addGetterSetter(Tag,"pointerWidth",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"pointerHeight",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"cornerRadius",0,(0,Validators_1$o.getNumberOrArrayOfNumbersValidator)(4));var Rect$2={};Object.defineProperty(Rect$2,"__esModule",{value:!0});Rect$2.Rect=void 0;const Factory_1$n=Factory,Shape_1$8=Shape,Global_1$8=Global,Util_1$6=Util,Validators_1$n=Validators;let Rect$1=class extends Shape_1$8.Shape{_sceneFunc(e){var r=this.cornerRadius(),t=this.width(),n=this.height();e.beginPath(),r?Util_1$6.Util.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}};Rect$2.Rect=Rect$1;Rect$1.prototype.className="Rect";(0,Global_1$8._registerNode)(Rect$1);Factory_1$n.Factory.addGetterSetter(Rect$1,"cornerRadius",0,(0,Validators_1$n.getNumberOrArrayOfNumbersValidator)(4));var RegularPolygon$1={};Object.defineProperty(RegularPolygon$1,"__esModule",{value:!0});RegularPolygon$1.RegularPolygon=void 0;const Factory_1$m=Factory,Shape_1$7=Shape,Validators_1$m=Validators,Global_1$7=Global;class RegularPolygon extends Shape_1$7.Shape{_sceneFunc(e){const r=this._getPoints();e.beginPath(),e.moveTo(r[0].x,r[0].y);for(var t=1;t<r.length;t++)e.lineTo(r[t].x,r[t].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,r=this.attrs.radius||0,t=[];for(var n=0;n<e;n++)t.push({x:r*Math.sin(n*2*Math.PI/e),y:-1*r*Math.cos(n*2*Math.PI/e)});return t}getSelfRect(){const e=this._getPoints();var r=e[0].x,t=e[0].y,n=e[0].x,a=e[0].y;return e.forEach(l=>{r=Math.min(r,l.x),t=Math.max(t,l.x),n=Math.min(n,l.y),a=Math.max(a,l.y)}),{x:r,y:n,width:t-r,height:a-n}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}RegularPolygon$1.RegularPolygon=RegularPolygon;RegularPolygon.prototype.className="RegularPolygon";RegularPolygon.prototype._centroid=!0;RegularPolygon.prototype._attrsAffectingSize=["radius"];(0,Global_1$7._registerNode)(RegularPolygon);Factory_1$m.Factory.addGetterSetter(RegularPolygon,"radius",0,(0,Validators_1$m.getNumberValidator)());Factory_1$m.Factory.addGetterSetter(RegularPolygon,"sides",0,(0,Validators_1$m.getNumberValidator)());var Ring$1={};Object.defineProperty(Ring$1,"__esModule",{value:!0});Ring$1.Ring=void 0;const Factory_1$l=Factory,Shape_1$6=Shape,Validators_1$l=Validators,Global_1$6=Global;var PIx2=Math.PI*2;class Ring extends Shape_1$6.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,PIx2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),PIx2,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ring$1.Ring=Ring;Ring.prototype.className="Ring";Ring.prototype._centroid=!0;Ring.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$6._registerNode)(Ring);Factory_1$l.Factory.addGetterSetter(Ring,"innerRadius",0,(0,Validators_1$l.getNumberValidator)());Factory_1$l.Factory.addGetterSetter(Ring,"outerRadius",0,(0,Validators_1$l.getNumberValidator)());var Sprite$1={};Object.defineProperty(Sprite$1,"__esModule",{value:!0});Sprite$1.Sprite=void 0;const Factory_1$k=Factory,Shape_1$5=Shape,Animation_1=Animation$2,Validators_1$k=Validators,Global_1$5=Global;class Sprite extends Shape_1$5.Shape{constructor(e){super(e),this._updated=!0,this.anim=new Animation_1.Animation(()=>{var r=this._updated;return this._updated=!1,r}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){var r=this.animation(),t=this.frameIndex(),n=t*4,a=this.animations()[r],l=this.frameOffsets(),u=a[n+0],f=a[n+1],d=a[n+2],h=a[n+3],y=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,d,h),e.closePath(),e.fillStrokeShape(this)),y)if(l){var E=l[r],g=t*2;e.drawImage(y,u,f,d,h,E[g+0],E[g+1],d,h)}else e.drawImage(y,u,f,d,h,0,0,d,h)}_hitFunc(e){var r=this.animation(),t=this.frameIndex(),n=t*4,a=this.animations()[r],l=this.frameOffsets(),u=a[n+2],f=a[n+3];if(e.beginPath(),l){var d=l[r],h=t*2;e.rect(d[h+0],d[h+1],u,f)}else e.rect(0,0,u,f);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),r=this.animation(),t=this.animations(),n=t[r],a=n.length/4;e<a-1?this.frameIndex(e+1):this.frameIndex(0)}}Sprite$1.Sprite=Sprite;Sprite.prototype.className="Sprite";(0,Global_1$5._registerNode)(Sprite);Factory_1$k.Factory.addGetterSetter(Sprite,"animation");Factory_1$k.Factory.addGetterSetter(Sprite,"animations");Factory_1$k.Factory.addGetterSetter(Sprite,"frameOffsets");Factory_1$k.Factory.addGetterSetter(Sprite,"image");Factory_1$k.Factory.addGetterSetter(Sprite,"frameIndex",0,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.addGetterSetter(Sprite,"frameRate",17,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.backCompat(Sprite,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Star$1={};Object.defineProperty(Star$1,"__esModule",{value:!0});Star$1.Star=void 0;const Factory_1$j=Factory,Shape_1$4=Shape,Validators_1$j=Validators,Global_1$4=Global;class Star extends Shape_1$4.Shape{_sceneFunc(e){var r=this.innerRadius(),t=this.outerRadius(),n=this.numPoints();e.beginPath(),e.moveTo(0,0-t);for(var a=1;a<n*2;a++){var l=a%2===0?t:r,u=l*Math.sin(a*Math.PI/n),f=-1*l*Math.cos(a*Math.PI/n);e.lineTo(u,f)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Star$1.Star=Star;Star.prototype.className="Star";Star.prototype._centroid=!0;Star.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$4._registerNode)(Star);Factory_1$j.Factory.addGetterSetter(Star,"numPoints",5,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"innerRadius",0,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"outerRadius",0,(0,Validators_1$j.getNumberValidator)());var Text$2={};Object.defineProperty(Text$2,"__esModule",{value:!0});Text$2.Text=Text$2.stringToArray=void 0;const Util_1$5=Util,Factory_1$i=Factory,Shape_1$3=Shape,Validators_1$i=Validators,Global_1$3=Global;function stringToArray(o){return Array.from(o)}Text$2.stringToArray=stringToArray;var AUTO="auto",CENTER="center",INHERIT="inherit",JUSTIFY="justify",CHANGE_KONVA="Change.konva",CONTEXT_2D="2d",DASH="-",LEFT="left",TEXT="text",TEXT_UPPER="Text",TOP="top",BOTTOM="bottom",MIDDLE="middle",NORMAL$1="normal",PX_SPACE="px ",SPACE=" ",RIGHT="right",RTL="rtl",WORD="word",CHAR="char",NONE="none",ELLIPSIS="…",ATTR_CHANGE_LIST$1=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],attrChangeListLen=ATTR_CHANGE_LIST$1.length;function normalizeFontFamily(o){return o.split(",").map(e=>{e=e.trim();const r=e.indexOf(" ")>=0,t=e.indexOf('"')>=0||e.indexOf("'")>=0;return r&&!t&&(e=`"${e}"`),e}).join(", ")}var dummyContext;function getDummyContext(){return dummyContext||(dummyContext=Util_1$5.Util.createCanvasElement().getContext(CONTEXT_2D),dummyContext)}function _fillFunc$1(o){o.fillText(this._partialText,this._partialTextX,this._partialTextY)}function _strokeFunc$1(o){o.setAttr("miterLimit",2),o.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function checkDefaultFill(o){return o=o||{},!o.fillLinearGradientColorStops&&!o.fillRadialGradientColorStops&&!o.fillPatternImage&&(o.fill=o.fill||"black"),o}let Text$1=class extends Shape_1$3.Shape{constructor(e){super(checkDefaultFill(e)),this._partialTextX=0,this._partialTextY=0;for(var r=0;r<attrChangeListLen;r++)this.on(ATTR_CHANGE_LIST$1[r]+CHANGE_KONVA,this._setTextData);this._setTextData()}_sceneFunc(e){var r=this.textArr,t=r.length;if(this.text()){var n=this.padding(),a=this.fontSize(),l=this.lineHeight()*a,u=this.verticalAlign(),f=this.direction(),d=0,h=this.align(),y=this.getWidth(),E=this.letterSpacing(),g=this.fill(),_=this.textDecoration(),p=_.indexOf("underline")!==-1,x=_.indexOf("line-through")!==-1,C;f=f===INHERIT?e.direction:f;var R=0,R=l/2,S=0,A=0;for(f===RTL&&e.setAttr("direction",f),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",MIDDLE),e.setAttr("textAlign",LEFT),u===MIDDLE?d=(this.getHeight()-t*l-n*2)/2:u===BOTTOM&&(d=this.getHeight()-t*l-n*2),e.translate(n,d+n),C=0;C<t;C++){var S=0,A=0,T=r[C],P=T.text,w=T.width,O=T.lastInParagraph,k,D,F;if(e.save(),h===RIGHT?S+=y-w-n*2:h===CENTER&&(S+=(y-w-n*2)/2),p){e.save(),e.beginPath(),e.moveTo(S,R+A+Math.round(a/2)),k=P.split(" ").length-1,D=k===0,F=h===JUSTIFY&&!O?y-n*2:w,e.lineTo(S+Math.round(F),R+A+Math.round(a/2)),e.lineWidth=a/15;const B=this._getLinearGradient();e.strokeStyle=B||g,e.stroke(),e.restore()}if(x){e.save(),e.beginPath(),e.moveTo(S,R+A),k=P.split(" ").length-1,D=k===0,F=h===JUSTIFY&&O&&!D?y-n*2:w,e.lineTo(S+Math.round(F),R+A),e.lineWidth=a/15;const B=this._getLinearGradient();e.strokeStyle=B||g,e.stroke(),e.restore()}if(f!==RTL&&(E!==0||h===JUSTIFY)){k=P.split(" ").length-1;for(var U=stringToArray(P),H=0;H<U.length;H++){var W=U[H];W===" "&&!O&&h===JUSTIFY&&(S+=(y-n*2-w)/k),this._partialTextX=S,this._partialTextY=R+A,this._partialText=W,e.fillStrokeShape(this),S+=this.measureSize(W).width+E}}else E!==0&&e.setAttr("letterSpacing",`${E}px`),this._partialTextX=S,this._partialTextY=R+A,this._partialText=P,e.fillStrokeShape(this);e.restore(),t>1&&(R+=l)}}}_hitFunc(e){var r=this.getWidth(),t=this.getHeight();e.beginPath(),e.rect(0,0,r,t),e.closePath(),e.fillStrokeShape(this)}setText(e){var r=Util_1$5.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(TEXT,r),this}getWidth(){var e=this.attrs.width===AUTO||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===AUTO||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Util_1$5.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var r=getDummyContext(),t=this.fontSize(),n;return r.save(),r.font=this._getContextFont(),n=r.measureText(e),r.restore(),{width:n.width,height:t}}_getContextFont(){return this.fontStyle()+SPACE+this.fontVariant()+SPACE+(this.fontSize()+PX_SPACE)+normalizeFontFamily(this.fontFamily())}_addTextLine(e){this.align()===JUSTIFY&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var r=this.letterSpacing(),t=e.length;return getDummyContext().measureText(e).width+(t?r*(t-1):0)}_setTextData(){var e=this.text().split(`
|
|
71
|
+
${g&&S+1>=o.length?"glowing-animation":""}`,"data-testid":"btn-nxt",onClick:()=>{S+1<o.length?U():(w("click-ui"),k())},"aria-label":LangIsRtl()?h("comic.previous"):h("comic.next"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})}):null}const characterMs$1=75;function CartelComponent({img:o,text:e,audio:r,audioType:t,voice:n,emitEvent:a,soundActions:l,audioVolume:u,pause:f,keyboardControl:d,backgroundImageCover:h=!1,autoEnd:y=!1}){const E=P=>a({type:"translate",payload:P}),g=(o==null?void 0:o.url)||"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg",_=React$2.useRef(),p=React$2.useRef(),[x]=l,{start:C,stop:R}=useTimeout();useEkho({audioType:t,voice:n,text:e,audio:r,soundActions:l,emitEvent:a,volume:u,pauseTTS:f,onFinish:()=>{y&&S()}});const S=()=>{x("click-ui"),a({type:"success"})};d(null,S,S);const A=(P,w)=>window.matchMedia("(min-width: 1280px)").matches?w:P,T=React$2.useCallback(()=>{if(h!==!0&&e&&p.current){const P=p.current.naturalWidth/p.current.naturalHeight;let w=p.current.height*P,O=p.current.height;if(w>p.current.width&&(w=p.current.width,O=p.current.width/P),_.current.style.width=`${w}px`,window.innerHeight<p.current.width)_.current.style.bottom=`${A(24,48)+A(36,100)}px`;else{const k=(window.innerHeight-O)/2+A(36,100);_.current.style.bottom=`${k}px`}}},[h,e]);return React$2.useEffect(()=>{p.current&&new ResizeObserver(()=>A(24,48)&&T()).observe(p.current)}),React$2.useEffect(()=>{if(y&&!f&&!r){const P=characterMs$1*(e.length||0);C(()=>{S()},P<1400?1400:P)}return()=>{R()}}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`cartel ${h?"cartel--cover":""}`,children:jsxRuntimeExports.jsxs("div",{className:"cartel__imagewrap",children:[jsxRuntimeExports.jsx("img",{ref:p,onLoad:T,className:"cartel__image",src:g,alt:"cartel pic"}),e?jsxRuntimeExports.jsx("div",{ref:_,className:"cartel__textwrap",children:jsxRuntimeExports.jsx("div",{className:"cartel__text",children:jsxRuntimeExports.jsx("span",{children:e})})}):null]})}),jsxRuntimeExports.jsx("div",{className:"position--absolute center right",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__round",onClick:()=>S(),"aria-label":E("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})})]})}var Typist$1={exports:{}};(function(o){o.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}return t.m=e,t.c=r,t.p="",t(0)}([function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=Object.assign||function(k){for(var D=1;D<arguments.length;D++){var F=arguments[D];for(var U in F)Object.prototype.hasOwnProperty.call(F,U)&&(k[U]=F[U])}return k},a=function(){function k(D,F){for(var U=0;U<F.length;U++){var H=F[U];H.enumerable=H.enumerable||!1,H.configurable=!0,"value"in H&&(H.writable=!0),Object.defineProperty(D,H.key,H)}}return function(D,F,U){return F&&k(D.prototype,F),U&&k(D,U),D}}(),l=t(1),u=S(l),f=t(2),d=S(f),h=t(10),y=S(h),E=t(12),g=S(E),_=t(13),p=S(_),x=t(14),C=R(x);function R(k){if(k&&k.__esModule)return k;var D={};if(k!=null)for(var F in k)Object.prototype.hasOwnProperty.call(k,F)&&(D[F]=k[F]);return D.default=k,D}function S(k){return k&&k.__esModule?k:{default:k}}function A(k,D){if(!(k instanceof D))throw new TypeError("Cannot call a class as a function")}function T(k,D){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D&&(typeof D=="object"||typeof D=="function")?D:k}function P(k,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof D);k.prototype=Object.create(D&&D.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),D&&(Object.setPrototypeOf?Object.setPrototypeOf(k,D):k.__proto__=D)}var w=["🔙","⏰"],O=function(k){P(D,k);function D(F){A(this,D);var U=T(this,(D.__proto__||Object.getPrototypeOf(D)).call(this,F));return U.state={textLines:[],isDone:!1},U.onTypingDone=function(){U.mounted&&(U.setState({isDone:!0}),U.props.onTypingDone())},U.delayGenerator=function(H,W,ee,q){var B=U.props.avgTypingDelay,G=U.props.stdTypingDelay;return U.props.delayGenerator(B,G,{line:H,lineIdx:W,character:ee,charIdx:q,defDelayGenerator:function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:G;return C.gaussianRnd($,V)}})},U.typeLine=function(H,W){if(!U.mounted)return Promise.resolve();var ee=H,q=U.props.onLineTyped;return C.isBackspaceElement(H)?(H.props.delay>0&&(U.introducedDelay=H.props.delay),ee="🔙".repeat(H.props.count)):C.isDelayElement(H)&&(U.introducedDelay=H.props.ms,ee="⏰"),new Promise(function(B,G){U.setState({textLines:U.state.textLines.concat([""])},function(){C.eachPromise(ee,U.typeCharacter,ee,W).then(function(){return q(ee,W)}).then(B).catch(G)})})},U.typeCharacter=function(H,W,ee,q){if(!U.mounted)return Promise.resolve();var B=U.props.onCharacterTyped;return new Promise(function(G){var I=U.state.textLines.slice();C.sleep(U.introducedDelay).then(function(){U.introducedDelay=null;var $=H==="🔙",V=H==="⏰";if(V){G();return}if($&&q>0){for(var X=q-1,Q=I[X],J=X;J>=0&&!(Q.length>0&&!w.includes(Q[0]));J--)X=J,Q=I[X];I[X]=Q.substr(0,Q.length-1)}else I[q]+=H;U.setState({textLines:I},function(){var ie=U.delayGenerator(ee,q,H,W);B(H,W),setTimeout(G,ie)})})})},U.mounted=!1,U.linesToType=[],U.introducedDelay=null,F.children&&(U.linesToType=C.extractTextFromElement(F.children)),U}return a(D,[{key:"componentDidMount",value:function(){this.mounted=!0;var U=this.props,H=U.children,W=U.startDelay;H?W>0&&typeof window<"u"?setTimeout(this.typeAllLines.bind(this),W):this.typeAllLines():this.onTypingDone()}},{key:"shouldComponentUpdate",value:function(U,H){if(H.textLines.length!==this.state.textLines.length)return!0;for(var W=0;W<H.textLines.length;W++){var ee=this.state.textLines[W],q=H.textLines[W];if(ee!==q)return!0}return this.state.isDone!==H.isDone}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"typeAllLines",value:function(){var U=this,H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.linesToType;return C.eachPromise(H,this.typeLine).then(function(){return U.onTypingDone()})}},{key:"render",value:function(){var U=this.props,H=U.className,W=U.cursor,ee=this.state.isDone,q=C.cloneElementWithSpecifiedText({element:this.props.children,textLines:this.state.textLines});return u.default.createElement("div",{className:"Typist "+H},q,u.default.createElement(y.default,n({isDone:ee},W)))}}]),D}(l.Component);O.propTypes={children:d.default.node,className:d.default.string,avgTypingDelay:d.default.number,stdTypingDelay:d.default.number,startDelay:d.default.number,cursor:d.default.object,onCharacterTyped:d.default.func,onLineTyped:d.default.func,onTypingDone:d.default.func,delayGenerator:d.default.func},O.defaultProps={className:"",avgTypingDelay:70,stdTypingDelay:25,startDelay:0,cursor:{},onCharacterTyped:function(){},onLineTyped:function(){},onTypingDone:function(){},delayGenerator:C.gaussianRnd},r.default=O,O.Backspace=g.default,O.Delay=p.default},function(e,r){e.exports=React$2},function(e,r,t){if(process.env.NODE_ENV!=="production"){var n=typeof Symbol=="function"&&Symbol.for&&Symbol.for("react.element")||60103,a=function(u){return typeof u=="object"&&u!==null&&u.$$typeof===n},l=!0;e.exports=t(3)(a,l)}else e.exports=t(9)()},function(e,r,t){var n=t(4),a=t(5),l=t(6),u=t(7),f=t(8);e.exports=function(d,h){var y=typeof Symbol=="function"&&Symbol.iterator,E="@@iterator";function g(I){var $=I&&(y&&I[y]||I[E]);if(typeof $=="function")return $}var _="<<anonymous>>",p={array:S("array"),bool:S("boolean"),func:S("function"),number:S("number"),object:S("object"),string:S("string"),symbol:S("symbol"),any:A(),arrayOf:T,element:P(),instanceOf:w,node:F(),objectOf:k,oneOf:O,oneOfType:D,shape:U};function x(I,$){return I===$?I!==0||1/I===1/$:I!==I&&$!==$}function C(I){this.message=I,this.stack=""}C.prototype=Error.prototype;function R(I){if(process.env.NODE_ENV!=="production")var $={},V=0;function X(J,ie,ne,Z,oe,ae,ce){if(Z=Z||_,ae=ae||ne,ce!==u){if(h)a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var fe=Z+":"+ne;!$[fe]&&V<3&&(l(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",ae,Z),$[fe]=!0,V++)}}return ie[ne]==null?J?ie[ne]===null?new C("The "+oe+" `"+ae+"` is marked as required "+("in `"+Z+"`, but its value is `null`.")):new C("The "+oe+" `"+ae+"` is marked as required in "+("`"+Z+"`, but its value is `undefined`.")):null:I(ie,ne,Z,oe,ae)}var Q=X.bind(null,!1);return Q.isRequired=X.bind(null,!0),Q}function S(I){function $(V,X,Q,J,ie,ne){var Z=V[X],oe=ee(Z);if(oe!==I){var ae=q(Z);return new C("Invalid "+J+" `"+ie+"` of type "+("`"+ae+"` supplied to `"+Q+"`, expected ")+("`"+I+"`."))}return null}return R($)}function A(){return R(n.thatReturnsNull)}function T(I){function $(V,X,Q,J,ie){if(typeof I!="function")return new C("Property `"+ie+"` of component `"+Q+"` has invalid PropType notation inside arrayOf.");var ne=V[X];if(!Array.isArray(ne)){var Z=ee(ne);return new C("Invalid "+J+" `"+ie+"` of type "+("`"+Z+"` supplied to `"+Q+"`, expected an array."))}for(var oe=0;oe<ne.length;oe++){var ae=I(ne,oe,Q,J,ie+"["+oe+"]",u);if(ae instanceof Error)return ae}return null}return R($)}function P(){function I($,V,X,Q,J){var ie=$[V];if(!d(ie)){var ne=ee(ie);return new C("Invalid "+Q+" `"+J+"` of type "+("`"+ne+"` supplied to `"+X+"`, expected a single ReactElement."))}return null}return R(I)}function w(I){function $(V,X,Q,J,ie){if(!(V[X]instanceof I)){var ne=I.name||_,Z=G(V[X]);return new C("Invalid "+J+" `"+ie+"` of type "+("`"+Z+"` supplied to `"+Q+"`, expected ")+("instance of `"+ne+"`."))}return null}return R($)}function O(I){if(!Array.isArray(I))return process.env.NODE_ENV!=="production"&&l(!1,"Invalid argument supplied to oneOf, expected an instance of array."),n.thatReturnsNull;function $(V,X,Q,J,ie){for(var ne=V[X],Z=0;Z<I.length;Z++)if(x(ne,I[Z]))return null;var oe=JSON.stringify(I);return new C("Invalid "+J+" `"+ie+"` of value `"+ne+"` "+("supplied to `"+Q+"`, expected one of "+oe+"."))}return R($)}function k(I){function $(V,X,Q,J,ie){if(typeof I!="function")return new C("Property `"+ie+"` of component `"+Q+"` has invalid PropType notation inside objectOf.");var ne=V[X],Z=ee(ne);if(Z!=="object")return new C("Invalid "+J+" `"+ie+"` of type "+("`"+Z+"` supplied to `"+Q+"`, expected an object."));for(var oe in ne)if(ne.hasOwnProperty(oe)){var ae=I(ne,oe,Q,J,ie+"."+oe,u);if(ae instanceof Error)return ae}return null}return R($)}function D(I){if(!Array.isArray(I))return process.env.NODE_ENV!=="production"&&l(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),n.thatReturnsNull;for(var $=0;$<I.length;$++){var V=I[$];if(typeof V!="function")return l(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",B(V),$),n.thatReturnsNull}function X(Q,J,ie,ne,Z){for(var oe=0;oe<I.length;oe++){var ae=I[oe];if(ae(Q,J,ie,ne,Z,u)==null)return null}return new C("Invalid "+ne+" `"+Z+"` supplied to "+("`"+ie+"`."))}return R(X)}function F(){function I($,V,X,Q,J){return H($[V])?null:new C("Invalid "+Q+" `"+J+"` supplied to "+("`"+X+"`, expected a ReactNode."))}return R(I)}function U(I){function $(V,X,Q,J,ie){var ne=V[X],Z=ee(ne);if(Z!=="object")return new C("Invalid "+J+" `"+ie+"` of type `"+Z+"` "+("supplied to `"+Q+"`, expected `object`."));for(var oe in I){var ae=I[oe];if(ae){var ce=ae(ne,oe,Q,J,ie+"."+oe,u);if(ce)return ce}}return null}return R($)}function H(I){switch(typeof I){case"number":case"string":case"undefined":return!0;case"boolean":return!I;case"object":if(Array.isArray(I))return I.every(H);if(I===null||d(I))return!0;var $=g(I);if($){var V=$.call(I),X;if($!==I.entries){for(;!(X=V.next()).done;)if(!H(X.value))return!1}else for(;!(X=V.next()).done;){var Q=X.value;if(Q&&!H(Q[1]))return!1}}else return!1;return!0;default:return!1}}function W(I,$){return I==="symbol"||$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol}function ee(I){var $=typeof I;return Array.isArray(I)?"array":I instanceof RegExp?"object":W($,I)?"symbol":$}function q(I){if(typeof I>"u"||I===null)return""+I;var $=ee(I);if($==="object"){if(I instanceof Date)return"date";if(I instanceof RegExp)return"regexp"}return $}function B(I){var $=q(I);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function G(I){return!I.constructor||!I.constructor.name?_:I.constructor.name}return p.checkPropTypes=f,p.PropTypes=p,p}},function(e,r){function t(a){return function(){return a}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(a){return a},e.exports=n},function(e,r){var t=function(l){};process.env.NODE_ENV!=="production"&&(t=function(l){if(l===void 0)throw new Error("invariant requires an error message argument")});function n(a,l,u,f,d,h,y,E){if(t(l),!a){var g;if(l===void 0)g=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var _=[u,f,d,h,y,E],p=0;g=new Error(l.replace(/%s/g,function(){return _[p++]})),g.name="Invariant Violation"}throw g.framesToPop=1,g}}e.exports=n},function(e,r,t){var n=t(4),a=n;process.env.NODE_ENV!=="production"&&function(){var l=function(f){for(var d=arguments.length,h=Array(d>1?d-1:0),y=1;y<d;y++)h[y-1]=arguments[y];var E=0,g="Warning: "+f.replace(/%s/g,function(){return h[E++]});typeof console<"u"&&console.error(g);try{throw new Error(g)}catch{}};a=function(f,d){if(d===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(d.indexOf("Failed Composite propType: ")!==0&&!f){for(var h=arguments.length,y=Array(h>2?h-2:0),E=2;E<h;E++)y[E-2]=arguments[E];l.apply(void 0,[d].concat(y))}}}(),e.exports=a},function(e,r){var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=t},function(e,r,t){if(process.env.NODE_ENV!=="production")var n=t(5),a=t(6),l=t(7),u={};function f(d,h,y,E,g){if(process.env.NODE_ENV!=="production"){for(var _ in d)if(d.hasOwnProperty(_)){var p;try{n(typeof d[_]=="function","%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",E||"React class",y,_),p=d[_](h,_,E,y,null,l)}catch(C){p=C}if(a(!p||p instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",E||"React class",y,_,typeof p),p instanceof Error&&!(p.message in u)){u[p.message]=!0;var x=g?g():"";a(!1,"Failed %s type: %s%s",y,p.message,x??"")}}}}e.exports=f},function(e,r,t){var n=t(4),a=t(5),l=t(7);e.exports=function(){function u(h,y,E,g,_,p){p!==l&&a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}u.isRequired=u;function f(){return u}var d={array:u,bool:u,func:u,number:u,object:u,string:u,symbol:u,any:u,arrayOf:f,element:u,instanceOf:f,node:u,objectOf:f,oneOf:f,oneOfType:f,shape:f};return d.checkPropTypes=n,d.PropTypes=d,d}},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function _(p,x){for(var C=0;C<x.length;C++){var R=x[C];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(p,R.key,R)}}return function(p,x,C){return x&&_(p.prototype,x),C&&_(p,C),p}}(),a=t(1),l=d(a),u=t(2),f=d(u);t(11);function d(_){return _&&_.__esModule?_:{default:_}}function h(_,p){if(!(_ instanceof p))throw new TypeError("Cannot call a class as a function")}function y(_,p){if(!_)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:_}function E(_,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);_.prototype=Object.create(p&&p.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(_,p):_.__proto__=p)}var g=function(_){E(p,_);function p(x){h(this,p);var C=y(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,x));return C._isReRenderingCursor=!1,C.state={shouldRender:C.props.show},C}return n(p,[{key:"componentWillReceiveProps",value:function(C){var R=this,S=!this.props.isDone&&C.isDone&&this.props.hideWhenDone;S&&setTimeout(function(){return R.setState({shouldRender:!1})},this.props.hideWhenDoneDelay)}},{key:"componentDidUpdate",value:function(){var C=this.props,R=C.show,S=C.isDone;R&&(S||this._isReRenderingCursor||this._reRenderCursor())}},{key:"_reRenderCursor",value:function(){var C=this;this._isReRenderingCursor=!0,this.setState({shouldRender:!1},function(){C.setState({shouldRender:!0},function(){C._isReRenderingCursor=!1})})}},{key:"render",value:function(){if(this.state.shouldRender){var C=this.props.blink?" Cursor--blinking":"";return l.default.createElement("span",{className:"Cursor"+C},this.props.element)}return null}}]),p}(a.Component);g.propTypes={blink:f.default.bool,show:f.default.bool,element:f.default.node,hideWhenDone:f.default.bool,hideWhenDoneDelay:f.default.number,isDone:f.default.bool},g.defaultProps={blink:!0,show:!0,element:"|",hideWhenDone:!1,hideWhenDoneDelay:1e3,isDone:!1},r.default=g},function(e,r){},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=t(1),a=f(n),l=t(2),u=f(l);function f(h){return h&&h.__esModule?h:{default:h}}var d=function(){return a.default.createElement("noscript",null)};d.componentName="Backspace",d.propTypes={count:u.default.number,delay:u.default.number},d.defaultProps={count:1,delay:0},r.default=d},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=t(1),a=f(n),l=t(2),u=f(l);function f(h){return h&&h.__esModule?h:{default:h}}var d=function(){return a.default.createElement("noscript",null)};d.componentName="Delay",d.propTypes={ms:u.default.number.isRequired},r.default=d},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0}),r.sleep=void 0;var n=function(){function R(S,A){var T=[],P=!0,w=!1,O=void 0;try{for(var k=S[Symbol.iterator](),D;!(P=(D=k.next()).done)&&(T.push(D.value),!(A&&T.length===A));P=!0);}catch(F){w=!0,O=F}finally{try{!P&&k.return&&k.return()}finally{if(w)throw O}}return T}return function(S,A){if(Array.isArray(S))return S;if(Symbol.iterator in Object(S))return R(S,A);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();r.gaussianRnd=d,r.eachPromise=h,r.exclude=y,r.isBackspaceElement=E,r.isDelayElement=g,r.extractTextFromElement=_,r.cloneElement=p,r.cloneElementWithSpecifiedText=C;var a=t(1),l=u(a);function u(R){return R&&R.__esModule?R:{default:R}}function f(R){if(Array.isArray(R)){for(var S=0,A=Array(R.length);S<R.length;S++)A[S]=R[S];return A}else return Array.from(R)}r.sleep=function(S){return new Promise(function(A){return S!=null?setTimeout(A,S):A()})};function d(R,S){for(var A=12,T=0,P=0;P<A;P++)T+=Math.random();return T-=A/2,Math.round(T*S)+R}function h(R,S){for(var A=arguments.length,T=Array(A>2?A-2:0),P=2;P<A;P++)T[P-2]=arguments[P];var w=function(k,D,F){return k.then(function(){return S.apply(void 0,[D,F].concat(T))})};return Array.from(R).reduce(w,Promise.resolve())}function y(R,S){var A={};for(var T in R)S.indexOf(T)===-1&&(A[T]=R[T]);return A}function E(R){return R&&R.type&&R.type.componentName==="Backspace"}function g(R){return R&&R.type&&R.type.componentName==="Delay"}function _(R){for(var S=R?[R]:[],A=[];S.length>0;){var T=S.pop();if(l.default.isValidElement(T))E(T)||g(T)?A.unshift(T):l.default.Children.forEach(T.props.children,function(U){S.push(U)});else if(Array.isArray(T)){var P=!0,w=!1,O=void 0;try{for(var k=T[Symbol.iterator](),D;!(P=(D=k.next()).done);P=!0){var F=D.value;S.push(F)}}catch(U){w=!0,O=U}finally{try{!P&&k.return&&k.return()}finally{if(w)throw O}}}else A.unshift(T)}return A}function p(R,S){var A=R.type,T=y(R.props,["children"]),P=new Date().getUTCMilliseconds(),w=P+Math.random()+Math.random();return T.key="Typist-element-"+A+"-"+w,l.default.createElement.apply(l.default,[A,T].concat(f(S)))}function x(R,S,A){if(A>=S.length)return[null,A];var T=A,P=function(F){var U=x(F,S,T),H=n(U,2),W=H[0],ee=H[1];return T=ee,W},w=l.default.isValidElement(R)&&!(E(R)||g(R));if(w){var O=l.default.Children.map(R.props.children,P)||[];return[p(R,O),T]}if(Array.isArray(R)){var k=R.map(P);return[k,T]}return[S[T],T+1]}function C(R){var S=R.element,A=R.textLines;if(S)return x(S,A,0)[0]}}])})(Typist$1);var TypistExports=Typist$1.exports;const Typist=getDefaultExportFromCjs(TypistExports),languages={js:["var rows = prompt('How many rows for your multiplication table?');","var cols = prompt('How many columns for your multiplication table?');"," ","if(rows == '' || rows == null)"," rows = 10;"," ","if(cols== '' || cols== null)"," cols = 10;"," ","createTable(rows, cols);"," ","function createTable(rows, cols)","{"," var j=1;"," var output = '<table border='1' width='500' cellspacing='0'cellpadding='5'>';"," "," for(i=1;i<=rows;i++)"," {"," output = output + '<tr>';"," while(j<=cols)"," {"," output = output + '<td>' + i*j + '</td>';"," j = j+1;"," }"," output = output + '</tr>';"," j = 1;"," }"," "," output = output + '</table>';"," document.write(output);","}"],lua:["-- Ensure that that the element at i is in the right position,","-- and return a closure which can be used for continuing the sort."," ","function quicksorter(i, vec, low, high)"," if low >= high then"," return quicksorter"," else -- low < high"," -- partition the vector and initialize the child closures"," local middle = partition(vec, low, high)"," local left, right = quicksorter"," ","-- Create the promise"," local function self(i, vec, low, high)"," if i < middle then"," left = left(i, vec, low, middle-1)"," return self"," elseif i > middle then"," right = right(i, vec, middle+1, high)"," return self"," end"," end"," ","-- Force the promise until i is in the right position"," return self(i, vec, low, high)"," end","end"," ","function lazysort(vec, low, high)"," local sorter = quicksorter"," return function(i)"," sorter = sorter(i, vec, low, high)"," return vec[i]"," end","end"],python:["#ask the user to enter four pieces of information"," ","firstname = input('Enter your first name: ')","surname = input('Enter your surname: ')","email = input('Enter your email: ')","yearsteaching = input('Enter the number of years teaching: ')"," ","file = open('staff.csv','r') #opens the file in read mode","found=False #sets whether the user is found to False"," ","for line in file: #reads each line in the file"," staff = line.split(',') #splits the line into the list called staff"," if staff[2] == email: #checks if the email entered is in the list"," found=True #if it is changes found to True"," ","file.close() #closes the file"," ","if found==True: #after the loop checks if the user is found"," print('Staff member already exists in the file') #displays on screen","else:"," #if the email was not in the file"," writefile=open('staff.csv','a') #open the file in append mode"," writefile.write(firstname + ',' + surname + ',' + email + ',' + yearsteaching) #write the new information to the file"," writefile.close() #close the file"," print('Staff member added to file')"]},themes={theme1:{bg:1,color:1,typo:2},theme2:{bg:3,color:2,typo:3},theme3:{bg:5,color:4,typo:1},theme4:{bg:1,color:3,typo:2},theme5:{bg:2,color:5,typo:1},theme6:{bg:5,color:6,typo:2},theme7:{bg:1,color:7,typo:3}};function ProgressBar({progress:o,type:e}){const r=languages[e];if(r){const t=r.reduce((l,u)=>(l.length?l.length:l)+u.length),n=Math.floor(o*100/t),a=n===100?"puzzle--hacker__percentage percentage--label":"puzzle--hacker__percentage";return jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__progress",children:jsxRuntimeExports.jsx("span",{className:"puzzle--hacker__progress--item",style:{width:`${Math.floor(o*100/t)}%`},children:jsxRuntimeExports.jsxs("span",{className:a,children:[n,"%"]})})})}return null}function Code({codeContainer:o}){const e=o,r=e.split("<br>");return r.length>0?r.map((t,n)=>{const a=t.replace(/ /g," ");return jsxRuntimeExports.jsx("p",{children:a},`line_${0+n}`)}):jsxRuntimeExports.jsx("p",{children:e})}function HackerPuzzleComponent({emitEvent:o,soundActions:e,info:r,themeNumber:t,type:n,writingSpeed:a,disableExit:l,setResolveAction:u}){const f=W=>o({type:"translate",payload:W}),[d]=e,{solution:h}=r,E=themes[`theme${t||1}`],[g,_]=React$2.useState(""),[p,x]=React$2.useState(0),[C,R]=React$2.useState(0),[S,A]=React$2.useState(!1),[T,P]=React$2.useState({start:0,end:0}),w=React$2.useRef(),O=React$2.useRef(),k=f("puzzle.hacker.congratulations"),D=(W,ee)=>W>ee.length?ee.length:W,F=()=>{d("click-ui");const{rewards:W}=h.right;o({type:"addPoints",complex:!0,finish:!0,payload:W}),o({type:"passPuzzle"})};React$2.useEffect(()=>{w.current.focus(),S&&l(!0)},[S]),React$2.useEffect(()=>{u(W=>{d("score"),A(!0),o({type:"hidePuzzleButtons",payload:!1}),W()})},[u]);const U=()=>{if(languages[n]&&!S){O.current&&(O.current.scrollTop=w.current.scrollHeight);const W=languages[n],ee=W[p],q=W.reduce((G,I)=>(G.length?G.length:G)+I.length),B=a>0?a:Math.floor(q/50)+p;if(ee){const G=ee.split(""),I=D(T.end,G),$=G.slice(T.start,I),V=g+$.join("");R(C+$.join("").length),_(V),I===G.length?p+1>=W.length?(d("score"),A(!0)):(x(p+1),_(`${g+$.join("")}<br>`),P({start:0,end:D(B,G)})):P({start:I,end:D(I+B,G)})}}},H=W=>{W.preventDefault(),U()};return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,"data-testid":"hacker",ref:w,onKeyDown:H,onTouchStart:H,className:`puzzle--hacker__container background-hacker-${E.bg}`,children:[jsxRuntimeExports.jsx("div",{className:"puzzle--hacker__header",children:jsxRuntimeExports.jsx("span",{className:"title",children:"Console"})}),jsxRuntimeExports.jsxs("div",{className:`puzzle--hacker__body color-hacker-${E.color} typography-hacker-${E.typo}`,children:[jsxRuntimeExports.jsxs("div",{className:"puzzle--hacker__code",ref:O,children:[jsxRuntimeExports.jsx(Code,{codeContainer:g}),S?jsxRuntimeExports.jsxs(Typist,{avgTypingDelay:110,onCharacterTyped:()=>{O.current&&(O.current.scrollTop=w.current.scrollHeight)},cursor:{hideWhenDone:!0},className:"puzzle--hacker__result",children:[jsxRuntimeExports.jsx(Typist.Delay,{ms:300}),h.right.desc?`// ${h.right.desc}`:`${k}`]}):null]}),jsxRuntimeExports.jsx(ProgressBar,{type:n,progress:C})]}),S?jsxRuntimeExports.jsx("div",{className:"position--absolute bottom center",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary gat--btn__cracker",onClick:F,children:f("screens.continue")})}):null]})}HackerPuzzleComponent.defaultProps={type:"",writingSpeed:0,context:{},info:{},themeNumber:1};const imagenPorDefecto="https://min.gamelearn.io/css-resources/gamelearn/resources/puzzle-login-low.png";function LoginPuzzleComponent({emitEvent:o,soundActions:e,info:r,user:t,login:n,password:a,image:l,setResolveAction:u,nodeId:f}){var I;const d=$=>o({type:"translate",payload:$}),h=`login-puzzle_${f}`,y=LangIsRtl(),[E,g]=React$2.useState(""),[_,p]=React$2.useState(""),[x,C]=React$2.useState(!1),[R,S]=React$2.useState(""),[A,T]=React$2.useState(""),[P,w]=React$2.useState(!1),[O,k]=React$2.useState(!1),[D,F]=React$2.useState(!1),[U]=e,[H,W]=React$2.useState([]),ee=((I=l.img)==null?void 0:I.url)||imagenPorDefecto,q=()=>{const{rewards:$}=r.solution.right,V=[...H,...$];o({type:"addPoints",complex:!0,finish:!0,payload:V}),o({type:"passPuzzle"})},B=()=>{U("click-ui");const $={login:!0,password:!1};n&&($.login=t===E),$.password=a===_,$.login&&$.password?(T("success"),w(!0),k(!1),U("score"),setTimeout(()=>{q()},2e3)):(W([...H,...r.solution.wrong.rewards]),U("fail"),T("failed"),k(!0),o({type:"failPuzzle"}))},G=$=>{let V="";if($.length>=0){for(let X=0;X<$.length;X+=1)V+="•";S(V)}};return React$2.useEffect(()=>{u(()=>{const $=[...H,...r.resolve.rewards];F(!0),setTimeout(()=>{o({type:"hidePuzzleButtons",payload:!1}),o({type:"puzzleAction",action:"resolve",payload:{element:h,rewards:$,finish:!0}})},2e3)})},[H,r.resolve.rewards,o,u,h]),jsxRuntimeExports.jsx("div",{className:"puzzle--layer",style:{backgroundImage:`url("${ee}")`},children:jsxRuntimeExports.jsxs("div",{className:`puzzle--login ${t?"puzzle--login--withuser":""}`,children:[jsxRuntimeExports.jsx("span",{className:"icon-login-puzzle",children:" "}),jsxRuntimeExports.jsx("span",{className:"puzzle--login__title",children:d("puzzle.initSession")}),jsxRuntimeExports.jsxs("div",{children:[n&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:d("puzzle.user")}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[D?jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:P,"data-testid":"username",className:"puzzle--login__input success",type:"text",placeholder:t,value:t}):jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:P,"data-testid":"username",className:`puzzle--login__input ${A}`,type:"text",placeholder:d("puzzle.user"),onChange:$=>{g($.target.value),T(""),k(!1)}}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--login__label",children:jsxRuntimeExports.jsx("span",{children:d("puzzle.password")})}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:"puzzle--login__group",children:[D?jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:!0,"data-testid":"password",className:"puzzle--login__input puzzle--login__input--fakepassword success",type:"text",placeholder:a,value:a,style:{opacity:1}}):jsxRuntimeExports.jsx("input",{dir:y?"rtl":"auto",disabled:P,"data-testid":"password",className:`puzzle--login__input puzzle--login__input--fakepassword ${A}`,type:"text",placeholder:d("puzzle.password"),onFocus:()=>{C(!0)},onBlur:()=>{C(!1)},onChange:$=>{p($.target.value),G($.target.value),T(""),k(!1)}}),D?null:jsxRuntimeExports.jsx("div",{dir:y?"rtl":"auto",className:`login-fakepassword${x?" login-fakepassword--focus":""}${R.length?" login-fakepassword--fill":""} ${A||""}`,children:_?R:d("puzzle.password")}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check",children:" "})]})]})]}),jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__primary ${_.length!==0&&!P?"":"disabled"}`,onClick:B,children:d("puzzle.loginIn")}),!D&&O&&r.solution.wrong.desc!==""&&jsxRuntimeExports.jsx("div",{className:"puzzle--login__label--error",children:r.solution.wrong.desc})]})})}function FeedbackComponent$1({text:o,success:e,playSound:r,additionalStyle:t,functionOnClose:n,secondText:a,translate:l,shortText:u,hasTimeout:f,delay:d,timeExpired:h,keyboardControl:y}){const[E,g]=React$2.useState();React$2.useEffect(()=>{let x;return r&&r(e?"score":"fail"),o&&!u&&(x=setTimeout(()=>{g(!0)},1e3)),()=>{x&&clearTimeout(x)}},[r,e,u,o]),React$2.useEffect(()=>{let x;return f&&n&&(x=setTimeout(n,d)),()=>{x&&clearTimeout(x)}},[d,n,f]);const _=()=>e?"success":"failed",p=()=>e?"icon-correct-thumb":h?"icon-times-up":"icon-incorrect-thumb";return y(null,o&&n&&E?n:null,o&&n&&E||n&&u?n:null),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:`feedback-layer ${E?"feedback-layer--withexplain":""}`,children:[jsxRuntimeExports.jsxs("div",{className:`feedback-layer__header ${u?"feedback-layer__header--in-shortText":""} ${t||""} ${_()}`,children:[a&&jsxRuntimeExports.jsxs("span",{className:"puzzle--terminal__visor--file",children:[jsxRuntimeExports.jsx("span",{className:`puzzle--terminal__icon ${t||""}`}),jsxRuntimeExports.jsx("span",{children:a})]}),jsxRuntimeExports.jsx("span",{className:"feedback-layer__maintitle",children:!o||!u?jsxRuntimeExports.jsx("div",{title:l(`tooltip.${e?"correct":"incorrect"}`),className:`${p()}`}):o}),u&&jsxRuntimeExports.jsx("button",{type:"button",className:"feedback-layer__closeX",onClick:()=>n(),"aria-label":l("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})]}),!u&&o!==""&&jsxRuntimeExports.jsx("div",{className:"feedback-layer__explainwrap",children:jsxRuntimeExports.jsxs("div",{className:"feedback-layer__explain",children:[jsxRuntimeExports.jsx("div",{dir:"auto",children:o}),o&&n&&E&&jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__navigation",onClick:()=>n(),"aria-label":l("storylines.misc.closePiece"),style:{display:"flex",margin:"auto",marginTop:"24px"},children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})})]})})}FeedbackComponent$1.defaultProps={text:"",hasTimeout:!1,delay:3e3,success:!1};function KeyboardPuzzleComponent({emitEvent:o,image:e,password:r,keyboard:t,info:n,disableExit:a,soundActions:l,setResolveAction:u,nodeId:f,keyboardControl:d,styles:h="default-theme"}){var B,G;const[y,E]=React$2.useState(""),[g,_]=React$2.useState(""),[p,x]=React$2.useState(!1),[C,R]=React$2.useState(""),[S,A]=React$2.useState(!1),[T,P]=React$2.useState([]),w=I=>o({type:"translate",payload:I}),O=`keyboard-puzzle_${f}`,[k]=l,D=React$2.useCallback(I=>{x(!1),A(!1),o({type:"hidePuzzleButtons",payload:!1}),o({type:"addPoints",complex:!0,finish:!0,payload:I})},[o]),F=()=>{if(p){const{rewards:I}=n.solution.right,$=[...T,...I];k("score"),D($)}else o({type:"hidePuzzleButtons",payload:!1}),x(!1),a(!1),A(!1);R("")},U=I=>{I===r?(a(!1),E("success"),k("score"),o({type:"passPuzzle"}),x(!0),A(!0),n.solution.right.desc?R(n.solution.right.desc):setTimeout(()=>{const{rewards:$}=n.solution.right,V=[...T,...$];D(V)},3e3)):(A(!0),E("failed"),k("fail"),o({type:"failPuzzle"}),x(!1),P([...T,...n.solution.wrong.rewards]),o({type:"hidePuzzleButtons",payload:!1}),E(""),_(""),A(!0),n.solution.wrong.desc?R(n.solution.wrong.desc):setTimeout(()=>{F()},3e3))};React$2.useEffect(()=>{u(()=>{a(!1),k("score"),E("success"),x(!0),R(n.solution.right.desc),_(r);const I=[...T,...n.resolve.rewards];setTimeout(()=>{x(!1),A(!1),o({type:"hidePuzzleButtons",payload:!1}),o({type:"puzzleAction",action:"resolve",payload:{element:O,rewards:I,finish:!0}})},2e3)})},[u,a,n.solution.right.desc,k,n.resolve.rewards,T,r,o,O]);const H=(I,$)=>{const V=t[I][$];k("click-ui"),g.length<r.length+1&&(_(g+V),g.length+1===r.length&&U(g+V))},W=()=>{k("click-ui"),_(g.substring(0,g.length-1))},q={backgroundImage:`url("${((B=e.img)==null?void 0:B.url)||""}")`,backgroudPosition:"center center"};return jsxRuntimeExports.jsxs("div",{className:`puzzle-keyboard puzzle-keyboard--${h}`,style:(G=e.img)!=null&&G.url?q:null,children:[jsxRuntimeExports.jsx("div",{className:"puzzle-keyboard__header",children:jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__digits",children:[r.split("").map((I,$)=>jsxRuntimeExports.jsx("div",{className:`puzzle-keyboard__digit ${y}`,children:g.split("")[$]?g.split("")[$]:""},`${I+$}`)),y!==""?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:y==="success"?jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-check-circle"}):jsxRuntimeExports.jsx("span",{className:"puzzle-keyboard__positionatedToDigits icon-mini-error-circle"})}):jsxRuntimeExports.jsx("button",{type:"button",onClick:W,className:"puzzle-keyboard__positionatedToDigits puzzle-keyboard__delete","aria-label":w("puzzles.keyboard-puzzle.deleteButton"),children:jsxRuntimeExports.jsx("span",{className:"icon-delete-key-2023"})})]})}),jsxRuntimeExports.jsxs("div",{className:"puzzle-keyboard__keypad",children:[h==="scifi-theme"&&jsxRuntimeExports.jsx("div",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-notch",children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{fill:"none",fillRule:"evenodd",children:[jsxRuntimeExports.jsxs("g",{transform:"translate(3 3)",children:[jsxRuntimeExports.jsx("circle",{fill:"#1E282F",cx:"5",cy:"5",r:"5"}),jsxRuntimeExports.jsx("path",{d:"M1.48 8.55a5 5 0 1 0 7.008-7.133",fillOpacity:".096",fill:"#1DDDD8"}),jsxRuntimeExports.jsx("circle",{fill:"#1DDDD8",opacity:".359",cx:"3",cy:"3",r:"2"})]}),jsxRuntimeExports.jsx("circle",{stroke:"#1E282F",cx:"8",cy:"8",r:"7.5"})]})})})}),jsxRuntimeExports.jsx("div",{className:`keyboard-keys keyboard-keys--${h}`,children:t.map((I,$)=>(Array.isArray(I)?I:Object.values(I)).map((V,X)=>jsxRuntimeExports.jsx("button",{className:`keyboard-key keyboard-key--${h} ${V==="*"?"keyboard-key--star":""}`,type:"button",onClick:()=>H($,X),children:jsxRuntimeExports.jsx("div",{children:V})},V)))}),h==="scifi-theme"&&jsxRuntimeExports.jsx("hr",{"aria-hidden":!0,className:"puzzle-keyboard__scifi-line"})]}),S&&jsxRuntimeExports.jsx(FeedbackComponent$1,{translate:w,text:C,success:p,functionOnClose:F,keyboardControl:d})]})}var lib$1={exports:{}},_FullInternals={},_CoreInternals={},Global={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o._registerNode=o.Konva=o.glob=void 0;const e=Math.PI/180;function r(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}o.glob=typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},o.Konva={_global:o.glob,version:"9.3.0",isBrowser:r(),isUnminified:/param/.test((function(n){}).toString()),dblClickWindow:400,getAngle(n){return o.Konva.angleDeg?n*e:n},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return o.Konva.DD.isDragging},isDragReady(){return!!o.Konva.DD.node},releaseCanvasOnDestroy:!0,document:o.glob.document,_injectGlobal(n){o.glob.Konva=n}};const t=n=>{o.Konva[n.prototype.getClassName()]=n};o._registerNode=t,o.Konva._injectGlobal(o.Konva)})(Global);var Util={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Util=o.Transform=void 0;const e=Global;class r{constructor(A=[1,0,0,1,0,0]){this.dirty=!1,this.m=A&&A.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new r(this.m)}copyInto(A){A.m[0]=this.m[0],A.m[1]=this.m[1],A.m[2]=this.m[2],A.m[3]=this.m[3],A.m[4]=this.m[4],A.m[5]=this.m[5]}point(A){var T=this.m;return{x:T[0]*A.x+T[2]*A.y+T[4],y:T[1]*A.x+T[3]*A.y+T[5]}}translate(A,T){return this.m[4]+=this.m[0]*A+this.m[2]*T,this.m[5]+=this.m[1]*A+this.m[3]*T,this}scale(A,T){return this.m[0]*=A,this.m[1]*=A,this.m[2]*=T,this.m[3]*=T,this}rotate(A){var T=Math.cos(A),P=Math.sin(A),w=this.m[0]*T+this.m[2]*P,O=this.m[1]*T+this.m[3]*P,k=this.m[0]*-P+this.m[2]*T,D=this.m[1]*-P+this.m[3]*T;return this.m[0]=w,this.m[1]=O,this.m[2]=k,this.m[3]=D,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(A,T){var P=this.m[0]+this.m[2]*T,w=this.m[1]+this.m[3]*T,O=this.m[2]+this.m[0]*A,k=this.m[3]+this.m[1]*A;return this.m[0]=P,this.m[1]=w,this.m[2]=O,this.m[3]=k,this}multiply(A){var T=this.m[0]*A.m[0]+this.m[2]*A.m[1],P=this.m[1]*A.m[0]+this.m[3]*A.m[1],w=this.m[0]*A.m[2]+this.m[2]*A.m[3],O=this.m[1]*A.m[2]+this.m[3]*A.m[3],k=this.m[0]*A.m[4]+this.m[2]*A.m[5]+this.m[4],D=this.m[1]*A.m[4]+this.m[3]*A.m[5]+this.m[5];return this.m[0]=T,this.m[1]=P,this.m[2]=w,this.m[3]=O,this.m[4]=k,this.m[5]=D,this}invert(){var A=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),T=this.m[3]*A,P=-this.m[1]*A,w=-this.m[2]*A,O=this.m[0]*A,k=A*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),D=A*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=T,this.m[1]=P,this.m[2]=w,this.m[3]=O,this.m[4]=k,this.m[5]=D,this}getMatrix(){return this.m}decompose(){var A=this.m[0],T=this.m[1],P=this.m[2],w=this.m[3],O=this.m[4],k=this.m[5],D=A*w-T*P;let F={x:O,y:k,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(A!=0||T!=0){var U=Math.sqrt(A*A+T*T);F.rotation=T>0?Math.acos(A/U):-Math.acos(A/U),F.scaleX=U,F.scaleY=D/U,F.skewX=(A*P+T*w)/D,F.skewY=0}else if(P!=0||w!=0){var H=Math.sqrt(P*P+w*w);F.rotation=Math.PI/2-(w>0?Math.acos(-P/H):-Math.acos(P/H)),F.scaleX=D/H,F.scaleY=H,F.skewX=0,F.skewY=(A*P+T*w)/D}return F.rotation=o.Util._getRotation(F.rotation),F}}o.Transform=r;var t="[object Array]",n="[object Number]",a="[object String]",l="[object Boolean]",u=Math.PI/180,f=180/Math.PI,d="#",h="",y="0",E="Konva warning: ",g="Konva error: ",_="rgb(",p={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})\)/,C=[];const R=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(S){setTimeout(S,60)};o.Util={_isElement(S){return!!(S&&S.nodeType==1)},_isFunction(S){return!!(S&&S.constructor&&S.call&&S.apply)},_isPlainObject(S){return!!S&&S.constructor===Object},_isArray(S){return Object.prototype.toString.call(S)===t},_isNumber(S){return Object.prototype.toString.call(S)===n&&!isNaN(S)&&isFinite(S)},_isString(S){return Object.prototype.toString.call(S)===a},_isBoolean(S){return Object.prototype.toString.call(S)===l},isObject(S){return S instanceof Object},isValidSelector(S){if(typeof S!="string")return!1;var A=S[0];return A==="#"||A==="."||A===A.toUpperCase()},_sign(S){return S===0||S>0?1:-1},requestAnimFrame(S){C.push(S),C.length===1&&R(function(){const A=C;C=[],A.forEach(function(T){T()})})},createCanvasElement(){var S=document.createElement("canvas");try{S.style=S.style||{}}catch{}return S},createImageElement(){return document.createElement("img")},_isInDocument(S){for(;S=S.parentNode;)if(S==document)return!0;return!1},_urlToImage(S,A){var T=o.Util.createImageElement();T.onload=function(){A(T)},T.src=S},_rgbToHex(S,A,T){return((1<<24)+(S<<16)+(A<<8)+T).toString(16).slice(1)},_hexToRgb(S){S=S.replace(d,h);var A=parseInt(S,16);return{r:A>>16&255,g:A>>8&255,b:A&255}},getRandomColor(){for(var S=(Math.random()*16777215<<0).toString(16);S.length<6;)S=y+S;return d+S},getRGB(S){var A;return S in p?(A=p[S],{r:A[0],g:A[1],b:A[2]}):S[0]===d?this._hexToRgb(S.substring(1)):S.substr(0,4)===_?(A=x.exec(S.replace(/ /g,"")),{r:parseInt(A[1],10),g:parseInt(A[2],10),b:parseInt(A[3],10)}):{r:0,g:0,b:0}},colorToRGBA(S){return S=S||"black",o.Util._namedColorToRBA(S)||o.Util._hex3ColorToRGBA(S)||o.Util._hex4ColorToRGBA(S)||o.Util._hex6ColorToRGBA(S)||o.Util._hex8ColorToRGBA(S)||o.Util._rgbColorToRGBA(S)||o.Util._rgbaColorToRGBA(S)||o.Util._hslColorToRGBA(S)},_namedColorToRBA(S){var A=p[S.toLowerCase()];return A?{r:A[0],g:A[1],b:A[2],a:1}:null},_rgbColorToRGBA(S){if(S.indexOf("rgb(")===0){S=S.match(/rgb\(([^)]+)\)/)[1];var A=S.split(/ *, */).map(Number);return{r:A[0],g:A[1],b:A[2],a:1}}},_rgbaColorToRGBA(S){if(S.indexOf("rgba(")===0){S=S.match(/rgba\(([^)]+)\)/)[1];var A=S.split(/ *, */).map((T,P)=>T.slice(-1)==="%"?P===3?parseInt(T)/100:parseInt(T)/100*255:Number(T));return{r:A[0],g:A[1],b:A[2],a:A[3]}}},_hex8ColorToRGBA(S){if(S[0]==="#"&&S.length===9)return{r:parseInt(S.slice(1,3),16),g:parseInt(S.slice(3,5),16),b:parseInt(S.slice(5,7),16),a:parseInt(S.slice(7,9),16)/255}},_hex6ColorToRGBA(S){if(S[0]==="#"&&S.length===7)return{r:parseInt(S.slice(1,3),16),g:parseInt(S.slice(3,5),16),b:parseInt(S.slice(5,7),16),a:1}},_hex4ColorToRGBA(S){if(S[0]==="#"&&S.length===5)return{r:parseInt(S[1]+S[1],16),g:parseInt(S[2]+S[2],16),b:parseInt(S[3]+S[3],16),a:parseInt(S[4]+S[4],16)/255}},_hex3ColorToRGBA(S){if(S[0]==="#"&&S.length===4)return{r:parseInt(S[1]+S[1],16),g:parseInt(S[2]+S[2],16),b:parseInt(S[3]+S[3],16),a:1}},_hslColorToRGBA(S){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(S)){const[A,...T]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(S),P=Number(T[0])/360,w=Number(T[1])/100,O=Number(T[2])/100;let k,D,F;if(w===0)return F=O*255,{r:Math.round(F),g:Math.round(F),b:Math.round(F),a:1};O<.5?k=O*(1+w):k=O+w-O*w;const U=2*O-k,H=[0,0,0];for(let W=0;W<3;W++)D=P+1/3*-(W-1),D<0&&D++,D>1&&D--,6*D<1?F=U+(k-U)*6*D:2*D<1?F=k:3*D<2?F=U+(k-U)*(2/3-D)*6:F=U,H[W]=F*255;return{r:Math.round(H[0]),g:Math.round(H[1]),b:Math.round(H[2]),a:1}}},haveIntersection(S,A){return!(A.x>S.x+S.width||A.x+A.width<S.x||A.y>S.y+S.height||A.y+A.height<S.y)},cloneObject(S){var A={};for(var T in S)this._isPlainObject(S[T])?A[T]=this.cloneObject(S[T]):this._isArray(S[T])?A[T]=this.cloneArray(S[T]):A[T]=S[T];return A},cloneArray(S){return S.slice(0)},degToRad(S){return S*u},radToDeg(S){return S*f},_degToRad(S){return o.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),o.Util.degToRad(S)},_radToDeg(S){return o.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),o.Util.radToDeg(S)},_getRotation(S){return e.Konva.angleDeg?o.Util.radToDeg(S):S},_capitalize(S){return S.charAt(0).toUpperCase()+S.slice(1)},throw(S){throw new Error(g+S)},error(S){console.error(g+S)},warn(S){e.Konva.showWarnings&&console.warn(E+S)},each(S,A){for(var T in S)A(T,S[T])},_inRange(S,A,T){return A<=S&&S<T},_getProjectionToSegment(S,A,T,P,w,O){var k,D,F,U=(S-T)*(S-T)+(A-P)*(A-P);if(U==0)k=S,D=A,F=(w-T)*(w-T)+(O-P)*(O-P);else{var H=((w-S)*(T-S)+(O-A)*(P-A))/U;H<0?(k=S,D=A,F=(S-w)*(S-w)+(A-O)*(A-O)):H>1?(k=T,D=P,F=(T-w)*(T-w)+(P-O)*(P-O)):(k=S+H*(T-S),D=A+H*(P-A),F=(k-w)*(k-w)+(D-O)*(D-O))}return[k,D,F]},_getProjectionToLine(S,A,T){var P=o.Util.cloneObject(S),w=Number.MAX_VALUE;return A.forEach(function(O,k){if(!(!T&&k===A.length-1)){var D=A[(k+1)%A.length],F=o.Util._getProjectionToSegment(O.x,O.y,D.x,D.y,S.x,S.y),U=F[0],H=F[1],W=F[2];W<w&&(P.x=U,P.y=H,w=W)}}),P},_prepareArrayForTween(S,A,T){var P,w=[],O=[];if(S.length>A.length){var k=A;A=S,S=k}for(P=0;P<S.length;P+=2)w.push({x:S[P],y:S[P+1]});for(P=0;P<A.length;P+=2)O.push({x:A[P],y:A[P+1]});var D=[];return O.forEach(function(F){var U=o.Util._getProjectionToLine(F,w,T);D.push(U.x),D.push(U.y)}),D},_prepareToStringify(S){var A;S.visitedByCircularReferenceRemoval=!0;for(var T in S)if(S.hasOwnProperty(T)&&S[T]&&typeof S[T]=="object"){if(A=Object.getOwnPropertyDescriptor(S,T),S[T].visitedByCircularReferenceRemoval||o.Util._isElement(S[T]))if(A.configurable)delete S[T];else return null;else if(o.Util._prepareToStringify(S[T])===null)if(A.configurable)delete S[T];else return null}return delete S.visitedByCircularReferenceRemoval,S},_assign(S,A){for(var T in A)S[T]=A[T];return S},_getFirstPointerId(S){return S.touches?S.changedTouches[0].identifier:S.pointerId||999},releaseCanvas(...S){e.Konva.releaseCanvasOnDestroy&&S.forEach(A=>{A.width=0,A.height=0})},drawRoundedRectPath(S,A,T,P){let w=0,O=0,k=0,D=0;typeof P=="number"?w=O=k=D=Math.min(P,A/2,T/2):(w=Math.min(P[0]||0,A/2,T/2),O=Math.min(P[1]||0,A/2,T/2),D=Math.min(P[2]||0,A/2,T/2),k=Math.min(P[3]||0,A/2,T/2)),S.moveTo(w,0),S.lineTo(A-O,0),S.arc(A-O,O,O,Math.PI*3/2,0,!1),S.lineTo(A,T-D),S.arc(A-D,T-D,D,0,Math.PI/2,!1),S.lineTo(k,T),S.arc(k,T-k,k,Math.PI/2,Math.PI,!1),S.lineTo(0,w),S.arc(w,w,w,Math.PI,Math.PI*3/2,!1)}}})(Util);var Node$1={},Factory={},Validators={};Object.defineProperty(Validators,"__esModule",{value:!0});Validators.getComponentValidator=Validators.getBooleanValidator=Validators.getNumberArrayValidator=Validators.getFunctionValidator=Validators.getStringOrGradientValidator=Validators.getStringValidator=Validators.getNumberOrAutoValidator=Validators.getNumberOrArrayOfNumbersValidator=Validators.getNumberValidator=Validators.alphaComponent=Validators.RGBComponent=void 0;const Global_1$p=Global,Util_1$f=Util;function _formatValue(o){return Util_1$f.Util._isString(o)?'"'+o+'"':Object.prototype.toString.call(o)==="[object Number]"||Util_1$f.Util._isBoolean(o)?o:Object.prototype.toString.call(o)}function RGBComponent(o){return o>255?255:o<0?0:Math.round(o)}Validators.RGBComponent=RGBComponent;function alphaComponent(o){return o>1?1:o<1e-4?1e-4:o}Validators.alphaComponent=alphaComponent;function getNumberValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){return Util_1$f.Util._isNumber(o)||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),o}}Validators.getNumberValidator=getNumberValidator;function getNumberOrArrayOfNumbersValidator(o){if(Global_1$p.Konva.isUnminified)return function(e,r){let t=Util_1$f.Util._isNumber(e),n=Util_1$f.Util._isArray(e)&&e.length==o;return!t&&!n&&Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array<number>('+o+")"),e}}Validators.getNumberOrArrayOfNumbersValidator=getNumberOrArrayOfNumbersValidator;function getNumberOrAutoValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){var r=Util_1$f.Util._isNumber(o),t=o==="auto";return r||t||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),o}}Validators.getNumberOrAutoValidator=getNumberOrAutoValidator;function getStringValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){return Util_1$f.Util._isString(o)||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),o}}Validators.getStringValidator=getStringValidator;function getStringOrGradientValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){const r=Util_1$f.Util._isString(o),t=Object.prototype.toString.call(o)==="[object CanvasGradient]"||o&&o.addColorStop;return r||t||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),o}}Validators.getStringOrGradientValidator=getStringOrGradientValidator;function getFunctionValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){return Util_1$f.Util._isFunction(o)||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),o}}Validators.getFunctionValidator=getFunctionValidator;function getNumberArrayValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&o instanceof r||(Util_1$f.Util._isArray(o)?o.forEach(function(t){Util_1$f.Util._isNumber(t)||Util_1$f.Util.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}):Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),o}}Validators.getNumberArrayValidator=getNumberArrayValidator;function getBooleanValidator(){if(Global_1$p.Konva.isUnminified)return function(o,e){var r=o===!0||o===!1;return r||Util_1$f.Util.warn(_formatValue(o)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),o}}Validators.getBooleanValidator=getBooleanValidator;function getComponentValidator(o){if(Global_1$p.Konva.isUnminified)return function(e,r){return e==null||Util_1$f.Util.isObject(e)||Util_1$f.Util.warn(_formatValue(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+o),e}}Validators.getComponentValidator=getComponentValidator;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Factory=void 0;const e=Util,r=Validators;var t="get",n="set";o.Factory={addGetterSetter(a,l,u,f,d){o.Factory.addGetter(a,l,u),o.Factory.addSetter(a,l,f,d),o.Factory.addOverloadedGetterSetter(a,l)},addGetter(a,l,u){var f=t+e.Util._capitalize(l);a.prototype[f]=a.prototype[f]||function(){var d=this.attrs[l];return d===void 0?u:d}},addSetter(a,l,u,f){var d=n+e.Util._capitalize(l);a.prototype[d]||o.Factory.overWriteSetter(a,l,u,f)},overWriteSetter(a,l,u,f){var d=n+e.Util._capitalize(l);a.prototype[d]=function(h){return u&&h!==void 0&&h!==null&&(h=u.call(this,h,l)),this._setAttr(l,h),f&&f.call(this),this}},addComponentsGetterSetter(a,l,u,f,d){var h=u.length,y=e.Util._capitalize,E=t+y(l),g=n+y(l),_,p;a.prototype[E]=function(){var C={};for(_=0;_<h;_++)p=u[_],C[p]=this.getAttr(l+y(p));return C};var x=(0,r.getComponentValidator)(u);a.prototype[g]=function(C){var R=this.attrs[l],S;f&&(C=f.call(this,C)),x&&x.call(this,C,l);for(S in C)C.hasOwnProperty(S)&&this._setAttr(l+y(S),C[S]);return C||u.forEach(A=>{this._setAttr(l+y(A),void 0)}),this._fireChangeEvent(l,R,C),d&&d.call(this),this},o.Factory.addOverloadedGetterSetter(a,l)},addOverloadedGetterSetter(a,l){var u=e.Util._capitalize(l),f=n+u,d=t+u;a.prototype[l]=function(){return arguments.length?(this[f](arguments[0]),this):this[d]()}},addDeprecatedGetterSetter(a,l,u,f){e.Util.error("Adding deprecated "+l);var d=t+e.Util._capitalize(l),h=l+" property is deprecated and will be removed soon. Look at Konva change log for more information.";a.prototype[d]=function(){e.Util.error(h);var y=this.attrs[l];return y===void 0?u:y},o.Factory.addSetter(a,l,f,function(){e.Util.error(h)}),o.Factory.addOverloadedGetterSetter(a,l)},backCompat(a,l){e.Util.each(l,function(u,f){var d=a.prototype[f],h=t+e.Util._capitalize(u),y=n+e.Util._capitalize(u);function E(){d.apply(this,arguments),e.Util.error('"'+u+'" method is deprecated and will be removed soon. Use ""'+f+'" instead.')}a.prototype[u]=E,a.prototype[h]=E,a.prototype[y]=E})},afterSetFilter(){this._filterUpToDate=!1}}})(Factory);var Canvas$1={},Context$2={};Object.defineProperty(Context$2,"__esModule",{value:!0});Context$2.HitContext=Context$2.SceneContext=Context$2.Context=void 0;const Util_1$e=Util,Global_1$o=Global;function simplifyArray(o){var e=[],r=o.length,t=Util_1$e.Util,n,a;for(n=0;n<r;n++)a=o[n],t._isNumber(a)?a=Math.round(a*1e3)/1e3:t._isString(a)||(a=a+""),e.push(a);return e}var COMMA=",",OPEN_PAREN="(",CLOSE_PAREN=")",OPEN_PAREN_BRACKET="([",CLOSE_BRACKET_PAREN="])",SEMICOLON=";",DOUBLE_PAREN="()",EQUALS="=",CONTEXT_METHODS=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],CONTEXT_PROPERTIES=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const traceArrMax=100;let Context$1=class{constructor(e){this.canvas=e,Global_1$o.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,r){var t=this.traceArr,n=t.length,a="",l,u,f,d;for(l=0;l<n;l++)u=t[l],f=u.method,f?(d=u.args,a+=f,e?a+=DOUBLE_PAREN:Util_1$e.Util._isArray(d[0])?a+=OPEN_PAREN_BRACKET+d.join(COMMA)+CLOSE_BRACKET_PAREN:(r&&(d=d.map(h=>typeof h=="number"?Math.floor(h):h)),a+=OPEN_PAREN+d.join(COMMA)+CLOSE_PAREN)):(a+=u.property,e||(a+=EQUALS+u.val)),a+=SEMICOLON;return a}clearTrace(){this.traceArr=[]}_trace(e){var r=this.traceArr,t;r.push(e),t=r.length,t>=traceArrMax&&r.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var r=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,r.getWidth()/r.pixelRatio,r.getHeight()/r.pixelRatio)}_applyLineCap(e){const r=e.attrs.lineCap;r&&this.setAttr("lineCap",r)}_applyOpacity(e){var r=e.getAbsoluteOpacity();r!==1&&this.setAttr("globalAlpha",r)}_applyLineJoin(e){const r=e.attrs.lineJoin;r&&this.setAttr("lineJoin",r)}setAttr(e,r){this._context[e]=r}arc(e,r,t,n,a,l){this._context.arc(e,r,t,n,a,l)}arcTo(e,r,t,n,a){this._context.arcTo(e,r,t,n,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,r,t,n,a,l){this._context.bezierCurveTo(e,r,t,n,a,l)}clearRect(e,r,t,n){this._context.clearRect(e,r,t,n)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,r){var t=arguments;if(t.length===2)return this._context.createImageData(e,r);if(t.length===1)return this._context.createImageData(e)}createLinearGradient(e,r,t,n){return this._context.createLinearGradient(e,r,t,n)}createPattern(e,r){return this._context.createPattern(e,r)}createRadialGradient(e,r,t,n,a,l){return this._context.createRadialGradient(e,r,t,n,a,l)}drawImage(e,r,t,n,a,l,u,f,d){var h=arguments,y=this._context;h.length===3?y.drawImage(e,r,t):h.length===5?y.drawImage(e,r,t,n,a):h.length===9&&y.drawImage(e,r,t,n,a,l,u,f,d)}ellipse(e,r,t,n,a,l,u,f){this._context.ellipse(e,r,t,n,a,l,u,f)}isPointInPath(e,r,t,n){return t?this._context.isPointInPath(t,e,r,n):this._context.isPointInPath(e,r,n)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,r,t,n){this._context.fillRect(e,r,t,n)}strokeRect(e,r,t,n){this._context.strokeRect(e,r,t,n)}fillText(e,r,t,n){n?this._context.fillText(e,r,t,n):this._context.fillText(e,r,t)}measureText(e){return this._context.measureText(e)}getImageData(e,r,t,n){return this._context.getImageData(e,r,t,n)}lineTo(e,r){this._context.lineTo(e,r)}moveTo(e,r){this._context.moveTo(e,r)}rect(e,r,t,n){this._context.rect(e,r,t,n)}putImageData(e,r,t){this._context.putImageData(e,r,t)}quadraticCurveTo(e,r,t,n){this._context.quadraticCurveTo(e,r,t,n)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,r){this._context.scale(e,r)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,r,t,n,a,l){this._context.setTransform(e,r,t,n,a,l)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,r,t,n){this._context.strokeText(e,r,t,n)}transform(e,r,t,n,a,l){this._context.transform(e,r,t,n,a,l)}translate(e,r){this._context.translate(e,r)}_enableTrace(){var e=this,r=CONTEXT_METHODS.length,t=this.setAttr,n,a,l=function(u){var f=e[u],d;e[u]=function(){return a=simplifyArray(Array.prototype.slice.call(arguments,0)),d=f.apply(e,arguments),e._trace({method:u,args:a}),d}};for(n=0;n<r;n++)l(CONTEXT_METHODS[n]);e.setAttr=function(){t.apply(e,arguments);var u=arguments[0],f=arguments[1];(u==="shadowOffsetX"||u==="shadowOffsetY"||u==="shadowBlur")&&(f=f/this.canvas.getPixelRatio()),e._trace({property:u,val:f})}}_applyGlobalCompositeOperation(e){const r=e.attrs.globalCompositeOperation;var t=!r||r==="source-over";t||this.setAttr("globalCompositeOperation",r)}};Context$2.Context=Context$1;CONTEXT_PROPERTIES.forEach(function(o){Object.defineProperty(Context$1.prototype,o,{get(){return this._context[o]},set(e){this._context[o]=e}})});class SceneContext extends Context$1{constructor(e,{willReadFrequently:r=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:r})}_fillColor(e){var r=e.fill();this.setAttr("fillStyle",r),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var r=e._getLinearGradient();r&&(this.setAttr("fillStyle",r),e._fillFunc(this))}_fillRadialGradient(e){const r=e._getRadialGradient();r&&(this.setAttr("fillStyle",r),e._fillFunc(this))}_fill(e){const r=e.fill(),t=e.getFillPriority();if(r&&t==="color"){this._fillColor(e);return}const n=e.getFillPatternImage();if(n&&t==="pattern"){this._fillPattern(e);return}const a=e.getFillLinearGradientColorStops();if(a&&t==="linear-gradient"){this._fillLinearGradient(e);return}const l=e.getFillRadialGradientColorStops();if(l&&t==="radial-gradient"){this._fillRadialGradient(e);return}r?this._fillColor(e):n?this._fillPattern(e):a?this._fillLinearGradient(e):l&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const r=e.getStrokeLinearGradientStartPoint(),t=e.getStrokeLinearGradientEndPoint(),n=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(r.x,r.y,t.x,t.y);if(n){for(var l=0;l<n.length;l+=2)a.addColorStop(n[l],n[l+1]);this.setAttr("strokeStyle",a)}}_stroke(e){var r=e.dash(),t=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!t){this.save();var n=this.getCanvas().getPixelRatio();this.setTransform(n,0,0,n,0,0)}this._applyLineCap(e),r&&e.dashEnabled()&&(this.setLineDash(r),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var a=e.getStrokeLinearGradientColorStops();a?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),t||this.restore()}}_applyShadow(e){var r,t,n,a=(r=e.getShadowRGBA())!==null&&r!==void 0?r:"black",l=(t=e.getShadowBlur())!==null&&t!==void 0?t:5,u=(n=e.getShadowOffset())!==null&&n!==void 0?n:{x:0,y:0},f=e.getAbsoluteScale(),d=this.canvas.getPixelRatio(),h=f.x*d,y=f.y*d;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",l*Math.min(Math.abs(h),Math.abs(y))),this.setAttr("shadowOffsetX",u.x*h),this.setAttr("shadowOffsetY",u.y*y)}}Context$2.SceneContext=SceneContext;class HitContext extends Context$1{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const a=e.getStrokeScaleEnabled();if(!a){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e);var t=e.hitStrokeWidth(),n=t==="auto"?e.strokeWidth():t;this.setAttr("lineWidth",n),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),a||this.restore()}}}Context$2.HitContext=HitContext;Object.defineProperty(Canvas$1,"__esModule",{value:!0});Canvas$1.HitCanvas=Canvas$1.SceneCanvas=Canvas$1.Canvas=void 0;const Util_1$d=Util,Context_1=Context$2,Global_1$n=Global,Factory_1$z=Factory,Validators_1$y=Validators;var _pixelRatio;function getDevicePixelRatio(){if(_pixelRatio)return _pixelRatio;var o=Util_1$d.Util.createCanvasElement(),e=o.getContext("2d");return _pixelRatio=function(){var r=Global_1$n.Konva._global.devicePixelRatio||1,t=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return r/t}(),Util_1$d.Util.releaseCanvas(o),_pixelRatio}class Canvas{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var r=e||{},t=r.pixelRatio||Global_1$n.Konva.pixelRatio||getDevicePixelRatio();this.pixelRatio=t,this._canvas=Util_1$d.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var r=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/r,this.getHeight()/r)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var r=this.pixelRatio,t=this.getContext()._context;t.scale(r,r)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var r=this.pixelRatio,t=this.getContext()._context;t.scale(r,r)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,r){this.setWidth(e||0),this.setHeight(r||0)}toDataURL(e,r){try{return this._canvas.toDataURL(e,r)}catch{try{return this._canvas.toDataURL()}catch(n){return Util_1$d.Util.error("Unable to get data URL. "+n.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}Canvas$1.Canvas=Canvas;Factory_1$z.Factory.addGetterSetter(Canvas,"pixelRatio",void 0,(0,Validators_1$y.getNumberValidator)());class SceneCanvas extends Canvas{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new Context_1.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}Canvas$1.SceneCanvas=SceneCanvas;class HitCanvas extends Canvas{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new Context_1.HitContext(this),this.setSize(e.width,e.height)}}Canvas$1.HitCanvas=HitCanvas;var DragAndDrop={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.DD=void 0;const e=Global,r=Util;o.DD={get isDragging(){var t=!1;return o.DD._dragElements.forEach(n=>{n.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return o.DD._dragElements.forEach(n=>{t=n.node}),t},_dragElements:new Map,_drag(t){const n=[];o.DD._dragElements.forEach((a,l)=>{const{node:u}=a,f=u.getStage();f.setPointersPositions(t),a.pointerId===void 0&&(a.pointerId=r.Util._getFirstPointerId(t));const d=f._changedPointerPositions.find(E=>E.id===a.pointerId);if(d){if(a.dragStatus!=="dragging"){var h=u.dragDistance(),y=Math.max(Math.abs(d.x-a.startPointerPos.x),Math.abs(d.y-a.startPointerPos.y));if(y<h||(u.startDrag({evt:t}),!u.isDragging()))return}u._setDragPosition(t,a),n.push(u)}}),n.forEach(a=>{a.fire("dragmove",{type:"dragmove",target:a,evt:t},!0)})},_endDragBefore(t){const n=[];o.DD._dragElements.forEach(a=>{const{node:l}=a,u=l.getStage();if(t&&u.setPointersPositions(t),!u._changedPointerPositions.find(h=>h.id===a.pointerId))return;(a.dragStatus==="dragging"||a.dragStatus==="stopped")&&(o.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,a.dragStatus="stopped");const d=a.node.getLayer()||a.node instanceof e.Konva.Stage&&a.node;d&&n.indexOf(d)===-1&&n.push(d)}),n.forEach(a=>{a.draw()})},_endDragAfter(t){o.DD._dragElements.forEach((n,a)=>{n.dragStatus==="stopped"&&n.node.fire("dragend",{type:"dragend",target:n.node,evt:t},!0),n.dragStatus!=="dragging"&&o.DD._dragElements.delete(a)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",o.DD._endDragBefore,!0),window.addEventListener("touchend",o.DD._endDragBefore,!0),window.addEventListener("mousemove",o.DD._drag),window.addEventListener("touchmove",o.DD._drag),window.addEventListener("mouseup",o.DD._endDragAfter,!1),window.addEventListener("touchend",o.DD._endDragAfter,!1))})(DragAndDrop);Object.defineProperty(Node$1,"__esModule",{value:!0});Node$1.Node=void 0;const Util_1$c=Util,Factory_1$y=Factory,Canvas_1$1=Canvas$1,Global_1$m=Global,DragAndDrop_1=DragAndDrop,Validators_1$x=Validators;var ABSOLUTE_OPACITY="absoluteOpacity",ALL_LISTENERS="allEventListeners",ABSOLUTE_TRANSFORM="absoluteTransform",ABSOLUTE_SCALE="absoluteScale",CANVAS="canvas",CHANGE="Change",CHILDREN="children",KONVA="konva",LISTENING="listening",MOUSEENTER="mouseenter",MOUSELEAVE="mouseleave",SET="set",SHAPE="Shape",SPACE$1=" ",STAGE="stage",TRANSFORM="transform",UPPER_STAGE="Stage",VISIBLE="visible",TRANSFORM_CHANGE_STR$1=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(SPACE$1);let idCounter=1;class Node{constructor(e){this._id=idCounter++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===TRANSFORM||e===ABSOLUTE_TRANSFORM)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,r){var t=this._cache.get(e),n=e===TRANSFORM||e===ABSOLUTE_TRANSFORM,a=t===void 0||n&&t.dirty===!0;return a&&(t=r.call(this),this._cache.set(e,t)),t}_calculate(e,r,t){if(!this._attachedDepsListeners.get(e)){const n=r.map(a=>a+"Change.konva").join(SPACE$1);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,t)}_getCanvasCache(){return this._cache.get(CANVAS)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===ABSOLUTE_TRANSFORM&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(CANVAS)){const{scene:e,filter:r,hit:t}=this._cache.get(CANVAS);Util_1$c.Util.releaseCanvas(e,r,t),this._cache.delete(CANVAS)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var r=e||{},t={};(r.x===void 0||r.y===void 0||r.width===void 0||r.height===void 0)&&(t=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var n=Math.ceil(r.width||t.width),a=Math.ceil(r.height||t.height),l=r.pixelRatio,u=r.x===void 0?Math.floor(t.x):r.x,f=r.y===void 0?Math.floor(t.y):r.y,d=r.offset||0,h=r.drawBorder||!1,y=r.hitCanvasPixelRatio||1;if(!n||!a){Util_1$c.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}n+=d*2+1,a+=d*2+1,u-=d,f-=d;var E=new Canvas_1$1.SceneCanvas({pixelRatio:l,width:n,height:a}),g=new Canvas_1$1.SceneCanvas({pixelRatio:l,width:0,height:0,willReadFrequently:!0}),_=new Canvas_1$1.HitCanvas({pixelRatio:y,width:n,height:a}),p=E.getContext(),x=_.getContext();return _.isCache=!0,E.isCache=!0,this._cache.delete(CANVAS),this._filterUpToDate=!1,r.imageSmoothingEnabled===!1&&(E.getContext()._context.imageSmoothingEnabled=!1,g.getContext()._context.imageSmoothingEnabled=!1),p.save(),x.save(),p.translate(-u,-f),x.translate(-u,-f),this._isUnderCache=!0,this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this.drawScene(E,this),this.drawHit(_,this),this._isUnderCache=!1,p.restore(),x.restore(),h&&(p.save(),p.beginPath(),p.rect(0,0,n,a),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(CANVAS,{scene:E,filter:g,hit:_,x:u,y:f}),this._requestDraw(),this}isCached(){return this._cache.has(CANVAS)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,r){var t=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],n=1/0,a=1/0,l=-1/0,u=-1/0,f=this.getAbsoluteTransform(r);return t.forEach(function(d){var h=f.point(d);n===void 0&&(n=l=h.x,a=u=h.y),n=Math.min(n,h.x),a=Math.min(a,h.y),l=Math.max(l,h.x),u=Math.max(u,h.y)}),{x:n,y:a,width:l-n,height:u-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const r=this._getCanvasCache();e.translate(r.x,r.y);var t=this._getCachedSceneCanvas(),n=t.pixelRatio;e.drawImage(t._canvas,0,0,t.width/n,t.height/n),e.restore()}_drawCachedHitCanvas(e){var r=this._getCanvasCache(),t=r.hit;e.save(),e.translate(r.x,r.y),e.drawImage(t._canvas,0,0,t.width/t.pixelRatio,t.height/t.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),r=this._getCanvasCache(),t=r.scene,n=r.filter,a=n.getContext(),l,u,f,d;if(e){if(!this._filterUpToDate){var h=t.pixelRatio;n.setSize(t.width/t.pixelRatio,t.height/t.pixelRatio);try{for(l=e.length,a.clear(),a.drawImage(t._canvas,0,0,t.getWidth()/h,t.getHeight()/h),u=a.getImageData(0,0,n.getWidth(),n.getHeight()),f=0;f<l;f++){if(d=e[f],typeof d!="function"){Util_1$c.Util.error("Filter should be type of function, but got "+typeof d+" instead. Please check correct filters");continue}d.call(this,u),a.putImageData(u,0,0)}}catch(y){Util_1$c.Util.error("Unable to apply filter. "+y.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return n}return t}on(e,r){if(this._cache&&this._cache.delete(ALL_LISTENERS),arguments.length===3)return this._delegate.apply(this,arguments);var t=e.split(SPACE$1),n=t.length,a,l,u,f,d;for(a=0;a<n;a++)l=t[a],u=l.split("."),f=u[0],d=u[1]||"",this.eventListeners[f]||(this.eventListeners[f]=[]),this.eventListeners[f].push({name:d,handler:r});return this}off(e,r){var t=(e||"").split(SPACE$1),n=t.length,a,l,u,f,d,h;if(this._cache&&this._cache.delete(ALL_LISTENERS),!e)for(l in this.eventListeners)this._off(l);for(a=0;a<n;a++)if(u=t[a],f=u.split("."),d=f[0],h=f[1],d)this.eventListeners[d]&&this._off(d,h,r);else for(l in this.eventListeners)this._off(l,h,r);return this}dispatchEvent(e){var r={target:this,type:e.type,evt:e};return this.fire(e.type,r),this}addEventListener(e,r){return this.on(e,function(t){r.call(this,t.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,r,t){var n=this;this.on(e,function(a){for(var l=a.target.findAncestors(r,!0,n),u=0;u<l.length;u++)a=Util_1$c.Util.cloneObject(a),a.currentTarget=l[u],t.call(l[u],a)})}remove(){return this.isDragging()&&this.stopDrag(),DragAndDrop_1.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY),this._clearSelfAndDescendantCache(ABSOLUTE_SCALE),this._clearSelfAndDescendantCache(STAGE),this._clearSelfAndDescendantCache(VISIBLE),this._clearSelfAndDescendantCache(LISTENING)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){var r="get"+Util_1$c.Util._capitalize(e);return Util_1$c.Util._isFunction(this[r])?this[r]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),r=[];e;)r.push(e),e=e.getParent();return r}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{var r,t;if(!e)return this;for(r in e)r!==CHILDREN&&(t=SET+Util_1$c.Util._capitalize(r),Util_1$c.Util._isFunction(this[t])?this[t](e[r]):this._setAttr(r,e[r]))}),this}isListening(){return this._getCache(LISTENING,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(VISIBLE,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,r=!1){if(e)return this._isVisible(e)&&this._isListening(e);var t=this.getLayer(),n=!1;DragAndDrop_1.DD._dragElements.forEach(l=>{l.dragStatus==="dragging"&&(l.node.nodeType==="Stage"||l.node.getLayer()===t)&&(n=!0)});var a=!r&&!Global_1$m.Konva.hitOnDragEnabled&&n;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),r=this,t=0,n,a,l,u;function f(h){for(n=[],a=h.length,l=0;l<a;l++)u=h[l],t++,u.nodeType!==SHAPE&&(n=n.concat(u.getChildren().slice())),u._id===r._id&&(l=a);n.length>0&&n[0].getDepth()<=e&&f(n)}const d=this.getStage();return r.nodeType!==UPPER_STAGE&&d&&f(d.getChildren()),t}getDepth(){for(var e=0,r=this.parent;r;)e++,r=r.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;var r=e.getPointerPosition();if(!r)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(r)}getAbsolutePosition(e){let r=!1,t=this.parent;for(;t;){if(t.isCached()){r=!0;break}t=t.parent}r&&!e&&(e=!0);var n=this.getAbsoluteTransform(e).getMatrix(),a=new Util_1$c.Transform,l=this.offset();return a.m=n.slice(),a.translate(l.x,l.y),a.getTranslation()}setAbsolutePosition(e){const{x:r,y:t,...n}=this._clearTransform();this.attrs.x=r,this.attrs.y=t,this._clearCache(TRANSFORM);var a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(e.x,e.y),e={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(n),this.setPosition({x:e.x,y:e.y}),this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM),this}_setTransform(e){var r;for(r in e)this.attrs[r]=e[r]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var r=e.x,t=e.y,n=this.x(),a=this.y();return r!==void 0&&(n+=r),t!==void 0&&(a+=t),this.setPosition({x:n,y:a}),this}_eachAncestorReverse(e,r){var t=[],n=this.getParent(),a,l;if(!(r&&r._id===this._id)){for(t.unshift(this);n&&(!r||n._id!==r._id);)t.unshift(n),n=n.parent;for(a=t.length,l=0;l<a;l++)e(t[l])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index,r=this.parent.getChildren().length;return e<r-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index,r=this.parent.getChildren().length;return e<r-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return Util_1$c.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Util_1$c.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var r=this.index;return this.parent.children.splice(r,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(ABSOLUTE_OPACITY,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),r=this.getParent();return r&&!r._isUnderCache&&(e*=r.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},r=this.getAttrs(),t,n,a,l,u;e.attrs={};for(t in r)n=r[t],u=Util_1$c.Util.isObject(n)&&!Util_1$c.Util._isPlainObject(n)&&!Util_1$c.Util._isArray(n),!u&&(a=typeof this[t]=="function"&&this[t],delete r[t],l=a?a.call(this):null,r[t]=n,l!==n&&(e.attrs[t]=n));return e.className=this.getClassName(),Util_1$c.Util._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,r,t){var n=[];r&&this._isMatch(e)&&n.push(this);for(var a=this.parent;a;){if(a===t)return n;a._isMatch(e)&&n.push(a),a=a.parent}return n}isAncestorOf(e){return!1}findAncestor(e,r,t){return this.findAncestors(e,r,t)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var r=e.replace(/ /g,"").split(","),t=r.length,n,a;for(n=0;n<t;n++)if(a=r[n],Util_1$c.Util.isValidSelector(a)||(Util_1$c.Util.warn('Selector "'+a+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Util_1$c.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Util_1$c.Util.warn("Konva is awesome, right?")),a.charAt(0)==="#"){if(this.id()===a.slice(1))return!0}else if(a.charAt(0)==="."){if(this.hasName(a.slice(1)))return!0}else if(this.className===a||this.nodeType===a)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(STAGE,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():null}fire(e,r={},t){return r.target=r.target||this,t?this._fireAndBubble(e,r):this._fire(e,r),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(ABSOLUTE_TRANSFORM,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var r;if(e)return r=new Util_1$c.Transform,this._eachAncestorReverse(function(n){var a=n.transformsEnabled();a==="all"?r.multiply(n.getTransform()):a==="position"&&r.translate(n.x()-n.offsetX(),n.y()-n.offsetY())},e),r;r=this._cache.get(ABSOLUTE_TRANSFORM)||new Util_1$c.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(r):r.reset();var t=this.transformsEnabled();if(t==="all")r.multiply(this.getTransform());else if(t==="position"){const n=this.attrs.x||0,a=this.attrs.y||0,l=this.attrs.offsetX||0,u=this.attrs.offsetY||0;r.translate(n-l,a-u)}return r.dirty=!1,r}getAbsoluteScale(e){for(var r=this;r;)r._isUnderCache&&(e=r),r=r.getParent();const n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(TRANSFORM,this._getTransform)}_getTransform(){var e,r,t=this._cache.get(TRANSFORM)||new Util_1$c.Transform;t.reset();var n=this.x(),a=this.y(),l=Global_1$m.Konva.getAngle(this.rotation()),u=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,f=(r=this.attrs.scaleY)!==null&&r!==void 0?r:1,d=this.attrs.skewX||0,h=this.attrs.skewY||0,y=this.attrs.offsetX||0,E=this.attrs.offsetY||0;return(n!==0||a!==0)&&t.translate(n,a),l!==0&&t.rotate(l),(d!==0||h!==0)&&t.skew(d,h),(u!==1||f!==1)&&t.scale(u,f),(y!==0||E!==0)&&t.translate(-1*y,-1*E),t.dirty=!1,t}clone(e){var r=Util_1$c.Util.cloneObject(this.attrs),t,n,a,l,u;for(t in e)r[t]=e[t];var f=new this.constructor(r);for(t in this.eventListeners)for(n=this.eventListeners[t],a=n.length,l=0;l<a;l++)u=n[l],u.name.indexOf(KONVA)<0&&(f.eventListeners[t]||(f.eventListeners[t]=[]),f.eventListeners[t].push(u));return f}_toKonvaCanvas(e){e=e||{};var r=this.getClientRect(),t=this.getStage(),n=e.x!==void 0?e.x:Math.floor(r.x),a=e.y!==void 0?e.y:Math.floor(r.y),l=e.pixelRatio||1,u=new Canvas_1$1.SceneCanvas({width:e.width||Math.ceil(r.width)||(t?t.width():0),height:e.height||Math.ceil(r.height)||(t?t.height():0),pixelRatio:l}),f=u.getContext();return e.imageSmoothingEnabled===!1&&(f._context.imageSmoothingEnabled=!1),f.save(),(n||a)&&f.translate(-1*n,-1*a),this.drawScene(u),f.restore(),u}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};var r=e.mimeType||null,t=e.quality||null,n=this._toKonvaCanvas(e).toDataURL(r,t);return e.callback&&e.callback(n),n}toImage(e){return new Promise((r,t)=>{try{const n=e==null?void 0:e.callback;n&&delete e.callback,Util_1$c.Util._urlToImage(this.toDataURL(e),function(a){r(a),n==null||n(a)})}catch(n){t(n)}})}toBlob(e){return new Promise((r,t)=>{try{const n=e==null?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob(a=>{r(a),n==null||n(a)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(n){t(n)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Global_1$m.Konva.dragDistance}_off(e,r,t){var n=this.eventListeners[e],a,l,u;for(a=0;a<n.length;a++)if(l=n[a].name,u=n[a].handler,(l!=="konva"||r==="konva")&&(!r||l===r)&&(!t||t===u)){if(n.splice(a,1),n.length===0){delete this.eventListeners[e];break}a--}}_fireChangeEvent(e,r,t){this._fire(e+CHANGE,{oldVal:r,newVal:t})}addName(e){if(!this.hasName(e)){var r=this.name(),t=r?r+" "+e:e;this.name(t)}return this}hasName(e){if(!e)return!1;const r=this.name();if(!r)return!1;var t=(r||"").split(/\s/g);return t.indexOf(e)!==-1}removeName(e){var r=(this.name()||"").split(/\s/g),t=r.indexOf(e);return t!==-1&&(r.splice(t,1),this.name(r.join(" "))),this}setAttr(e,r){var t=this[SET+Util_1$c.Util._capitalize(e)];return Util_1$c.Util._isFunction(t)?t.call(this,r):this._setAttr(e,r),this}_requestDraw(){if(Global_1$m.Konva.autoDrawEnabled){const e=this.getLayer()||this.getStage();e==null||e.batchDraw()}}_setAttr(e,r){var t=this.attrs[e];t===r&&!Util_1$c.Util.isObject(r)||(r==null?delete this.attrs[e]:this.attrs[e]=r,this._shouldFireChangeEvents&&this._fireChangeEvent(e,t,r),this._requestDraw())}_setComponentAttr(e,r,t){var n;t!==void 0&&(n=this.attrs[e],n||(this.attrs[e]=this.getAttr(e)),this.attrs[e][r]=t,this._fireChangeEvent(e,n,t))}_fireAndBubble(e,r,t){r&&this.nodeType===SHAPE&&(r.target=this);var n=(e===MOUSEENTER||e===MOUSELEAVE)&&(t&&(this===t||this.isAncestorOf&&this.isAncestorOf(t))||this.nodeType==="Stage"&&!t);if(!n){this._fire(e,r);var a=(e===MOUSEENTER||e===MOUSELEAVE)&&t&&t.isAncestorOf&&t.isAncestorOf(this)&&!t.isAncestorOf(this.parent);(r&&!r.cancelBubble||!r)&&this.parent&&this.parent.isListening()&&!a&&(t&&t.parent?this._fireAndBubble.call(this.parent,e,r,t):this._fireAndBubble.call(this.parent,e,r))}}_getProtoListeners(e){var r,t,n;const a=(r=this._cache.get(ALL_LISTENERS))!==null&&r!==void 0?r:{};let l=a==null?void 0:a[e];if(l===void 0){l=[];let u=Object.getPrototypeOf(this);for(;u;){const f=(n=(t=u.eventListeners)===null||t===void 0?void 0:t[e])!==null&&n!==void 0?n:[];l.push(...f),u=Object.getPrototypeOf(u)}a[e]=l,this._cache.set(ALL_LISTENERS,a)}return l}_fire(e,r){r=r||{},r.currentTarget=this,r.type=e;const t=this._getProtoListeners(e);if(t)for(var n=0;n<t.length;n++)t[n].handler.call(this,r);const a=this.eventListeners[e];if(a)for(var n=0;n<a.length;n++)a[n].handler.call(this,r)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var r=e?e.pointerId:void 0,t=this.getStage(),n=this.getAbsolutePosition();if(t){var a=t._getPointerById(r)||t._changedPointerPositions[0]||n;DragAndDrop_1.DD._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-n.x,y:a.y-n.y},dragStatus:"ready",pointerId:r})}}startDrag(e,r=!0){DragAndDrop_1.DD._dragElements.has(this._id)||this._createDragElement(e);const t=DragAndDrop_1.DD._dragElements.get(this._id);t.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},r)}_setDragPosition(e,r){const t=this.getStage()._getPointerById(r.pointerId);if(t){var n={x:t.x-r.offset.x,y:t.y-r.offset.y},a=this.dragBoundFunc();if(a!==void 0){const l=a.call(this,n,e);l?n=l:Util_1$c.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==n.x||this._lastPos.y!==n.y)&&(this.setAbsolutePosition(n),this._requestDraw()),this._lastPos=n}}stopDrag(e){const r=DragAndDrop_1.DD._dragElements.get(this._id);r&&(r.dragStatus="stopped"),DragAndDrop_1.DD._endDragBefore(e),DragAndDrop_1.DD._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=DragAndDrop_1.DD._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){var r=e.evt.button!==void 0,t=!r||Global_1$m.Konva.dragButtons.indexOf(e.evt.button)>=0;if(t&&!this.isDragging()){var n=!1;DragAndDrop_1.DD._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(n=!0)}),n||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const r=DragAndDrop_1.DD._dragElements.get(this._id),t=r&&r.dragStatus==="dragging",n=r&&r.dragStatus==="ready";t?this.stopDrag():n&&DragAndDrop_1.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const r=this.getStage();if(!r)return!1;const t={x:-e.x,y:-e.y,width:r.width()+2*e.x,height:r.height()+2*e.y};return Util_1$c.Util.haveIntersection(t,this.getClientRect())}static create(e,r){return Util_1$c.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,r)}static _createNode(e,r){var t=Node.prototype.getClassName.call(e),n=e.children,a,l,u;r&&(e.attrs.container=r),Global_1$m.Konva[t]||(Util_1$c.Util.warn('Can not find a node with class name "'+t+'". Fallback to "Shape".'),t="Shape");const f=Global_1$m.Konva[t];if(a=new f(e.attrs),n)for(l=n.length,u=0;u<l;u++)a.add(Node._createNode(n[u]));return a}}Node$1.Node=Node;Node.prototype.nodeType="Node";Node.prototype._attrsAffectingSize=[];Node.prototype.eventListeners={};Node.prototype.on.call(Node.prototype,TRANSFORM_CHANGE_STR$1,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(TRANSFORM),this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM)});Node.prototype.on.call(Node.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(VISIBLE)});Node.prototype.on.call(Node.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(LISTENING)});Node.prototype.on.call(Node.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY)});const addGetterSetter=Factory_1$y.Factory.addGetterSetter;addGetterSetter(Node,"zIndex");addGetterSetter(Node,"absolutePosition");addGetterSetter(Node,"position");addGetterSetter(Node,"x",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"y",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"globalCompositeOperation","source-over",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"opacity",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"name","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"id","",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"rotation",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"scale",["x","y"]);addGetterSetter(Node,"scaleX",1,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"scaleY",1,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"skew",["x","y"]);addGetterSetter(Node,"skewX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"skewY",0,(0,Validators_1$x.getNumberValidator)());Factory_1$y.Factory.addComponentsGetterSetter(Node,"offset",["x","y"]);addGetterSetter(Node,"offsetX",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"offsetY",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"dragDistance",null,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"width",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"height",0,(0,Validators_1$x.getNumberValidator)());addGetterSetter(Node,"listening",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"preventDefault",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"filters",null,function(o){return this._filterUpToDate=!1,o});addGetterSetter(Node,"visible",!0,(0,Validators_1$x.getBooleanValidator)());addGetterSetter(Node,"transformsEnabled","all",(0,Validators_1$x.getStringValidator)());addGetterSetter(Node,"size");addGetterSetter(Node,"dragBoundFunc");addGetterSetter(Node,"draggable",!1,(0,Validators_1$x.getBooleanValidator)());Factory_1$y.Factory.backCompat(Node,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Container$2={};Object.defineProperty(Container$2,"__esModule",{value:!0});Container$2.Container=void 0;const Factory_1$x=Factory,Node_1$h=Node$1,Validators_1$w=Validators;let Container$1=class extends Node_1$h.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const r=this.children||[];var t=[];return r.forEach(function(n){e(n)&&t.push(n)}),t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var r=0;r<e.length;r++)this.add(e[r]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var r=this._generalFind(e,!0);return r.length>0?r[0]:void 0}_generalFind(e,r){var t=[];return this._descendants(n=>{const a=n._isMatch(e);return a&&t.push(n),!!(a&&r)}),t}_descendants(e){let r=!1;const t=this.getChildren();for(const n of t){if(r=e(n),r)return!0;if(n.hasChildren()&&(r=n._descendants(e),r))return!0}return!1}toObject(){var e=Node_1$h.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(r=>{e.children.push(r.toObject())}),e}isAncestorOf(e){for(var r=e.getParent();r;){if(r._id===this._id)return!0;r=r.getParent()}return!1}clone(e){var r=Node_1$h.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(t){r.add(t.clone())}),r}getAllIntersections(e){var r=[];return this.find("Shape").forEach(t=>{t.isVisible()&&t.intersects(e)&&r.push(t)}),r}_clearSelfAndDescendantCache(e){var r;super._clearSelfAndDescendantCache(e),!this.isCached()&&((r=this.children)===null||r===void 0||r.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(r,t){r.index=t}),this._requestDraw()}drawScene(e,r){var t=this.getLayer(),n=e||t&&t.getCanvas(),a=n&&n.getContext(),l=this._getCanvasCache(),u=l&&l.scene,f=n&&n.isCache;if(!this.isVisible()&&!f)return this;if(u){a.save();var d=this.getAbsoluteTransform(r).getMatrix();a.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",n,r);return this}drawHit(e,r){if(!this.shouldDrawHit(r))return this;var t=this.getLayer(),n=e||t&&t.hitCanvas,a=n&&n.getContext(),l=this._getCanvasCache(),u=l&&l.hit;if(u){a.save();var f=this.getAbsoluteTransform(r).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",n,r);return this}_drawChildren(e,r,t){var n,a=r&&r.getContext(),l=this.clipWidth(),u=this.clipHeight(),f=this.clipFunc(),d=l&&u||f;const h=t===this;if(d){a.save();var y=this.getAbsoluteTransform(t),E=y.getMatrix();a.transform(E[0],E[1],E[2],E[3],E[4],E[5]),a.beginPath();let x;if(f)x=f.call(this,a,this);else{var g=this.clipX(),_=this.clipY();a.rect(g,_,l,u)}a.clip.apply(a,x),E=y.copy().invert().getMatrix(),a.transform(E[0],E[1],E[2],E[3],E[4],E[5])}var p=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";p&&(a.save(),a._applyGlobalCompositeOperation(this)),(n=this.children)===null||n===void 0||n.forEach(function(x){x[e](r,t)}),p&&a.restore(),d&&a.restore()}getClientRect(e={}){var r,t=e.skipTransform,n=e.relativeTo,a,l,u,f,d={x:1/0,y:1/0,width:0,height:0},h=this;(r=this.children)===null||r===void 0||r.forEach(function(p){if(p.visible()){var x=p.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});x.width===0&&x.height===0||(a===void 0?(a=x.x,l=x.y,u=x.x+x.width,f=x.y+x.height):(a=Math.min(a,x.x),l=Math.min(l,x.y),u=Math.max(u,x.x+x.width),f=Math.max(f,x.y+x.height)))}});for(var y=this.find("Shape"),E=!1,g=0;g<y.length;g++){var _=y[g];if(_._isVisible(this)){E=!0;break}}return E&&a!==void 0?d={x:a,y:l,width:u-a,height:f-l}:d={x:0,y:0,width:0,height:0},t?d:this._transformedRect(d,n)}};Container$2.Container=Container$1;Factory_1$x.Factory.addComponentsGetterSetter(Container$1,"clip",["x","y","width","height"]);Factory_1$x.Factory.addGetterSetter(Container$1,"clipX",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipY",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipWidth",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipHeight",void 0,(0,Validators_1$w.getNumberValidator)());Factory_1$x.Factory.addGetterSetter(Container$1,"clipFunc");var Stage$1={},PointerEvents={};Object.defineProperty(PointerEvents,"__esModule",{value:!0});PointerEvents.releaseCapture=PointerEvents.setPointerCapture=PointerEvents.hasPointerCapture=PointerEvents.createEvent=PointerEvents.getCapturedShape=void 0;const Global_1$l=Global,Captures=new Map,SUPPORT_POINTER_EVENTS=Global_1$l.Konva._global.PointerEvent!==void 0;function getCapturedShape(o){return Captures.get(o)}PointerEvents.getCapturedShape=getCapturedShape;function createEvent(o){return{evt:o,pointerId:o.pointerId}}PointerEvents.createEvent=createEvent;function hasPointerCapture(o,e){return Captures.get(o)===e}PointerEvents.hasPointerCapture=hasPointerCapture;function setPointerCapture(o,e){releaseCapture(o),e.getStage()&&(Captures.set(o,e),SUPPORT_POINTER_EVENTS&&e._fire("gotpointercapture",createEvent(new PointerEvent("gotpointercapture"))))}PointerEvents.setPointerCapture=setPointerCapture;function releaseCapture(o,e){const r=Captures.get(o);if(!r)return;const t=r.getStage();t&&t.content,Captures.delete(o),SUPPORT_POINTER_EVENTS&&r._fire("lostpointercapture",createEvent(new PointerEvent("lostpointercapture")))}PointerEvents.releaseCapture=releaseCapture;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Stage=o.stages=void 0;const e=Util,r=Factory,t=Container$2,n=Global,a=Canvas$1,l=DragAndDrop,u=Global,f=PointerEvents;var d="Stage",h="string",y="px",E="mouseout",g="mouseleave",_="mouseover",p="mouseenter",x="mousemove",C="mousedown",R="mouseup",S="pointermove",A="pointerdown",T="pointerup",P="pointercancel",w="lostpointercapture",O="pointerout",k="pointerleave",D="pointerover",F="pointerenter",U="contextmenu",H="touchstart",W="touchend",ee="touchmove",q="touchcancel",B="wheel",G=5,I=[[p,"_pointerenter"],[C,"_pointerdown"],[x,"_pointermove"],[R,"_pointerup"],[g,"_pointerleave"],[H,"_pointerdown"],[ee,"_pointermove"],[W,"_pointerup"],[q,"_pointercancel"],[_,"_pointerover"],[B,"_wheel"],[U,"_contextmenu"],[A,"_pointerdown"],[S,"_pointermove"],[T,"_pointerup"],[P,"_pointercancel"],[w,"_lostpointercapture"]];const $={mouse:{[O]:E,[k]:g,[D]:_,[F]:p,[S]:x,[A]:C,[T]:R,[P]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[O]:"touchout",[k]:"touchleave",[D]:"touchover",[F]:"touchenter",[S]:ee,[A]:H,[T]:W,[P]:q,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[O]:O,[k]:k,[D]:D,[F]:F,[S]:S,[A]:A,[T]:T,[P]:P,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},V=ne=>ne.indexOf("pointer")>=0?"pointer":ne.indexOf("touch")>=0?"touch":"mouse",X=ne=>{const Z=V(ne);if(Z==="pointer")return n.Konva.pointerEventsEnabled&&$.pointer;if(Z==="touch")return $.touch;if(Z==="mouse")return $.mouse};function Q(ne={}){return(ne.clipFunc||ne.clipWidth||ne.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),ne}const J="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);";o.stages=[];class ie extends t.Container{constructor(Z){super(Q(Z)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),o.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Q(this.attrs)}),this._checkVisibility()}_validateAdd(Z){const oe=Z.getType()==="Layer",ae=Z.getType()==="FastLayer";oe||ae||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const Z=this.visible()?"":"none";this.content.style.display=Z}setContainer(Z){if(typeof Z===h){if(Z.charAt(0)==="."){var oe=Z.slice(1);Z=document.getElementsByClassName(oe)[0]}else{var ae;Z.charAt(0)!=="#"?ae=Z:ae=Z.slice(1),Z=document.getElementById(ae)}if(!Z)throw"Can not find container in document with id "+ae}return this._setAttr("container",Z),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),Z.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var Z=this.children,oe=Z.length,ae;for(ae=0;ae<oe;ae++)Z[ae].clear();return this}clone(Z){return Z||(Z={}),Z.container=typeof document<"u"&&document.createElement("div"),t.Container.prototype.clone.call(this,Z)}destroy(){super.destroy();var Z=this.content;Z&&e.Util._isInDocument(Z)&&this.container().removeChild(Z);var oe=o.stages.indexOf(this);return oe>-1&&o.stages.splice(oe,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const Z=this._pointerPositions[0]||this._changedPointerPositions[0];return Z?{x:Z.x,y:Z.y}:(e.Util.warn(J),null)}_getPointerById(Z){return this._pointerPositions.find(oe=>oe.id===Z)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(Z){Z=Z||{},Z.x=Z.x||0,Z.y=Z.y||0,Z.width=Z.width||this.width(),Z.height=Z.height||this.height();var oe=new a.SceneCanvas({width:Z.width,height:Z.height,pixelRatio:Z.pixelRatio||1}),ae=oe.getContext()._context,ce=this.children;return(Z.x||Z.y)&&ae.translate(-1*Z.x,-1*Z.y),ce.forEach(function(fe){if(fe.isVisible()){var de=fe._toKonvaCanvas(Z);ae.drawImage(de._canvas,Z.x,Z.y,de.getWidth()/de.getPixelRatio(),de.getHeight()/de.getPixelRatio())}}),oe}getIntersection(Z){if(!Z)return null;var oe=this.children,ae=oe.length,ce=ae-1,fe;for(fe=ce;fe>=0;fe--){const de=oe[fe].getIntersection(Z);if(de)return de}return null}_resizeDOM(){var Z=this.width(),oe=this.height();this.content&&(this.content.style.width=Z+y,this.content.style.height=oe+y),this.bufferCanvas.setSize(Z,oe),this.bufferHitCanvas.setSize(Z,oe),this.children.forEach(ae=>{ae.setSize({width:Z,height:oe}),ae.draw()})}add(Z,...oe){if(arguments.length>1){for(var ae=0;ae<arguments.length;ae++)this.add(arguments[ae]);return this}super.add(Z);var ce=this.children.length;return ce>G&&e.Util.warn("The stage has "+ce+" 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."),Z.setSize({width:this.width(),height:this.height()}),Z.draw(),n.Konva.isBrowser&&this.content.appendChild(Z.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(Z){return f.hasPointerCapture(Z,this)}setPointerCapture(Z){f.setPointerCapture(Z,this)}releaseCapture(Z){f.releaseCapture(Z,this)}getLayers(){return this.children}_bindContentEvents(){n.Konva.isBrowser&&I.forEach(([Z,oe])=>{this.content.addEventListener(Z,ae=>{this[oe](ae)},{passive:!1})})}_pointerenter(Z){this.setPointersPositions(Z);const oe=X(Z.type);oe&&this._fire(oe.pointerenter,{evt:Z,target:this,currentTarget:this})}_pointerover(Z){this.setPointersPositions(Z);const oe=X(Z.type);oe&&this._fire(oe.pointerover,{evt:Z,target:this,currentTarget:this})}_getTargetShape(Z){let oe=this[Z+"targetShape"];return oe&&!oe.getStage()&&(oe=null),oe}_pointerleave(Z){const oe=X(Z.type),ae=V(Z.type);if(oe){this.setPointersPositions(Z);var ce=this._getTargetShape(ae),fe=!l.DD.isDragging||n.Konva.hitOnDragEnabled;ce&&fe?(ce._fireAndBubble(oe.pointerout,{evt:Z}),ce._fireAndBubble(oe.pointerleave,{evt:Z}),this._fire(oe.pointerleave,{evt:Z,target:this,currentTarget:this}),this[ae+"targetShape"]=null):fe&&(this._fire(oe.pointerleave,{evt:Z,target:this,currentTarget:this}),this._fire(oe.pointerout,{evt:Z,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(Z){const oe=X(Z.type),ae=V(Z.type);if(oe){this.setPointersPositions(Z);var ce=!1;this._changedPointerPositions.forEach(fe=>{var de=this.getIntersection(fe);if(l.DD.justDragged=!1,n.Konva["_"+ae+"ListenClick"]=!0,!de||!de.isListening())return;n.Konva.capturePointerEventsEnabled&&de.setPointerCapture(fe.id),this[ae+"ClickStartShape"]=de,de._fireAndBubble(oe.pointerdown,{evt:Z,pointerId:fe.id}),ce=!0;const xe=Z.type.indexOf("touch")>=0;de.preventDefault()&&Z.cancelable&&xe&&Z.preventDefault()}),ce||this._fire(oe.pointerdown,{evt:Z,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(Z){const oe=X(Z.type),ae=V(Z.type);if(!oe)return;l.DD.isDragging&&l.DD.node.preventDefault()&&Z.cancelable&&Z.preventDefault(),this.setPointersPositions(Z);var ce=!l.DD.isDragging||n.Konva.hitOnDragEnabled;if(!ce)return;var fe={};let de=!1;var xe=this._getTargetShape(ae);this._changedPointerPositions.forEach(Oe=>{const Te=f.getCapturedShape(Oe.id)||this.getIntersection(Oe),We=Oe.id,Be={evt:Z,pointerId:We};var qe=xe!==Te;if(qe&&xe&&(xe._fireAndBubble(oe.pointerout,{...Be},Te),xe._fireAndBubble(oe.pointerleave,{...Be},Te)),Te){if(fe[Te._id])return;fe[Te._id]=!0}Te&&Te.isListening()?(de=!0,qe&&(Te._fireAndBubble(oe.pointerover,{...Be},xe),Te._fireAndBubble(oe.pointerenter,{...Be},xe),this[ae+"targetShape"]=Te),Te._fireAndBubble(oe.pointermove,{...Be})):xe&&(this._fire(oe.pointerover,{evt:Z,target:this,currentTarget:this,pointerId:We}),this[ae+"targetShape"]=null)}),de||this._fire(oe.pointermove,{evt:Z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(Z){const oe=X(Z.type),ae=V(Z.type);if(!oe)return;this.setPointersPositions(Z);const ce=this[ae+"ClickStartShape"],fe=this[ae+"ClickEndShape"];var de={};let xe=!1;this._changedPointerPositions.forEach(Oe=>{const Te=f.getCapturedShape(Oe.id)||this.getIntersection(Oe);if(Te){if(Te.releaseCapture(Oe.id),de[Te._id])return;de[Te._id]=!0}const We=Oe.id,Be={evt:Z,pointerId:We};let qe=!1;n.Konva["_"+ae+"InDblClickWindow"]?(qe=!0,clearTimeout(this[ae+"DblTimeout"])):l.DD.justDragged||(n.Konva["_"+ae+"InDblClickWindow"]=!0,clearTimeout(this[ae+"DblTimeout"])),this[ae+"DblTimeout"]=setTimeout(function(){n.Konva["_"+ae+"InDblClickWindow"]=!1},n.Konva.dblClickWindow),Te&&Te.isListening()?(xe=!0,this[ae+"ClickEndShape"]=Te,Te._fireAndBubble(oe.pointerup,{...Be}),n.Konva["_"+ae+"ListenClick"]&&ce&&ce===Te&&(Te._fireAndBubble(oe.pointerclick,{...Be}),qe&&fe&&fe===Te&&Te._fireAndBubble(oe.pointerdblclick,{...Be}))):(this[ae+"ClickEndShape"]=null,n.Konva["_"+ae+"ListenClick"]&&this._fire(oe.pointerclick,{evt:Z,target:this,currentTarget:this,pointerId:We}),qe&&this._fire(oe.pointerdblclick,{evt:Z,target:this,currentTarget:this,pointerId:We}))}),xe||this._fire(oe.pointerup,{evt:Z,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),n.Konva["_"+ae+"ListenClick"]=!1,Z.cancelable&&ae!=="touch"&&Z.preventDefault()}_contextmenu(Z){this.setPointersPositions(Z);var oe=this.getIntersection(this.getPointerPosition());oe&&oe.isListening()?oe._fireAndBubble(U,{evt:Z}):this._fire(U,{evt:Z,target:this,currentTarget:this})}_wheel(Z){this.setPointersPositions(Z);var oe=this.getIntersection(this.getPointerPosition());oe&&oe.isListening()?oe._fireAndBubble(B,{evt:Z}):this._fire(B,{evt:Z,target:this,currentTarget:this})}_pointercancel(Z){this.setPointersPositions(Z);const oe=f.getCapturedShape(Z.pointerId)||this.getIntersection(this.getPointerPosition());oe&&oe._fireAndBubble(T,f.createEvent(Z)),f.releaseCapture(Z.pointerId)}_lostpointercapture(Z){f.releaseCapture(Z.pointerId)}setPointersPositions(Z){var oe=this._getContentPosition(),ae=null,ce=null;Z=Z||window.event,Z.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(Z.touches,fe=>{this._pointerPositions.push({id:fe.identifier,x:(fe.clientX-oe.left)/oe.scaleX,y:(fe.clientY-oe.top)/oe.scaleY})}),Array.prototype.forEach.call(Z.changedTouches||Z.touches,fe=>{this._changedPointerPositions.push({id:fe.identifier,x:(fe.clientX-oe.left)/oe.scaleX,y:(fe.clientY-oe.top)/oe.scaleY})})):(ae=(Z.clientX-oe.left)/oe.scaleX,ce=(Z.clientY-oe.top)/oe.scaleY,this.pointerPos={x:ae,y:ce},this._pointerPositions=[{x:ae,y:ce,id:e.Util._getFirstPointerId(Z)}],this._changedPointerPositions=[{x:ae,y:ce,id:e.Util._getFirstPointerId(Z)}])}_setPointerPosition(Z){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(Z)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var Z=this.content.getBoundingClientRect();return{top:Z.top,left:Z.left,scaleX:Z.width/this.content.clientWidth||1,scaleY:Z.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new a.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new a.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!n.Konva.isBrowser){var Z=this.container();if(!Z)throw"Stage has no container. A container is required.";Z.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"),Z.appendChild(this.content),this._resizeDOM()}}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(Z){Z.batchDraw()}),this}}o.Stage=ie,ie.prototype.nodeType=d,(0,u._registerNode)(ie),r.Factory.addGetterSetter(ie,"container")})(Stage$1);var Layer$2={},Shape={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Shape=o.shapes=void 0;const e=Global,r=Util,t=Factory,n=Node$1,a=Validators,l=Global,u=PointerEvents;var f="hasShadow",d="shadowRGBA",h="patternImage",y="linearGradient",E="radialGradient";let g;function _(){return g||(g=r.Util.createCanvasElement().getContext("2d"),g)}o.shapes={};function p(k){const D=this.attrs.fillRule;D?k.fill(D):k.fill()}function x(k){k.stroke()}function C(k){k.fill()}function R(k){k.stroke()}function S(){this._clearCache(f)}function A(){this._clearCache(d)}function T(){this._clearCache(h)}function P(){this._clearCache(y)}function w(){this._clearCache(E)}class O extends n.Node{constructor(D){super(D);let F;for(;F=r.Util.getRandomColor(),!(F&&!(F in o.shapes)););this.colorKey=F,o.shapes[F]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(f,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(h,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var D=_();const F=D.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(F&&F.setTransform){const U=new r.Transform;U.translate(this.fillPatternX(),this.fillPatternY()),U.rotate(e.Konva.getAngle(this.fillPatternRotation())),U.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),U.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const H=U.getMatrix(),W=typeof DOMMatrix>"u"?{a:H[0],b:H[1],c:H[2],d:H[3],e:H[4],f:H[5]}:new DOMMatrix(H);F.setTransform(W)}return F}}_getLinearGradient(){return this._getCache(y,this.__getLinearGradient)}__getLinearGradient(){var D=this.fillLinearGradientColorStops();if(D){for(var F=_(),U=this.fillLinearGradientStartPoint(),H=this.fillLinearGradientEndPoint(),W=F.createLinearGradient(U.x,U.y,H.x,H.y),ee=0;ee<D.length;ee+=2)W.addColorStop(D[ee],D[ee+1]);return W}}_getRadialGradient(){return this._getCache(E,this.__getRadialGradient)}__getRadialGradient(){var D=this.fillRadialGradientColorStops();if(D){for(var F=_(),U=this.fillRadialGradientStartPoint(),H=this.fillRadialGradientEndPoint(),W=F.createRadialGradient(U.x,U.y,this.fillRadialGradientStartRadius(),H.x,H.y,this.fillRadialGradientEndRadius()),ee=0;ee<D.length;ee+=2)W.addColorStop(D[ee],D[ee+1]);return W}}getShadowRGBA(){return this._getCache(d,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var D=r.Util.colorToRGBA(this.shadowColor());if(D)return"rgba("+D.r+","+D.g+","+D.b+","+D.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(){const D=this.hitStrokeWidth();return D==="auto"?this.hasStroke():this.strokeEnabled()&&!!D}intersects(D){var F=this.getStage();if(!F)return!1;const U=F.bufferHitCanvas;return U.getContext().clear(),this.drawHit(U,void 0,!0),U.context.getImageData(Math.round(D.x),Math.round(D.y),1,1).data[3]>0}destroy(){return n.Node.prototype.destroy.call(this),delete o.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(D){var F;if(!this.getStage()||!((F=this.attrs.perfectDrawEnabled)!==null&&F!==void 0?F:!0))return!1;const H=D||this.hasFill(),W=this.hasStroke(),ee=this.getAbsoluteOpacity()!==1;if(H&&W&&ee)return!0;const q=this.hasShadow(),B=this.shadowForStrokeEnabled();return!!(H&&W&&q&&B)}setStrokeHitEnabled(D){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),D?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var D=this.size();return{x:this._centroid?-D.width/2:0,y:this._centroid?-D.height/2:0,width:D.width,height:D.height}}getClientRect(D={}){const F=D.skipTransform,U=D.relativeTo,H=this.getSelfRect(),ee=!D.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,q=H.width+ee,B=H.height+ee,G=!D.skipShadow&&this.hasShadow(),I=G?this.shadowOffsetX():0,$=G?this.shadowOffsetY():0,V=q+Math.abs(I),X=B+Math.abs($),Q=G&&this.shadowBlur()||0,J=V+Q*2,ie=X+Q*2,ne={width:J,height:ie,x:-(ee/2+Q)+Math.min(I,0)+H.x,y:-(ee/2+Q)+Math.min($,0)+H.y};return F?ne:this._transformedRect(ne,U)}drawScene(D,F){var U=this.getLayer(),H=D||U.getCanvas(),W=H.getContext(),ee=this._getCanvasCache(),q=this.getSceneFunc(),B=this.hasShadow(),G,I,$,V=H.isCache,X=F===this;if(!this.isVisible()&&!X)return this;if(ee){W.save();var Q=this.getAbsoluteTransform(F).getMatrix();return W.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),this._drawCachedSceneCanvas(W),W.restore(),this}if(!q)return this;if(W.save(),this._useBufferCanvas()&&!V){G=this.getStage(),I=G.bufferCanvas,$=I.getContext(),$.clear(),$.save(),$._applyLineJoin(this);var J=this.getAbsoluteTransform(F).getMatrix();$.transform(J[0],J[1],J[2],J[3],J[4],J[5]),q.call(this,$,this),$.restore();var ie=I.pixelRatio;B&&W._applyShadow(this),W._applyOpacity(this),W._applyGlobalCompositeOperation(this),W.drawImage(I._canvas,0,0,I.width/ie,I.height/ie)}else{if(W._applyLineJoin(this),!X){var J=this.getAbsoluteTransform(F).getMatrix();W.transform(J[0],J[1],J[2],J[3],J[4],J[5]),W._applyOpacity(this),W._applyGlobalCompositeOperation(this)}B&&W._applyShadow(this),q.call(this,W,this)}return W.restore(),this}drawHit(D,F,U=!1){if(!this.shouldDrawHit(F,U))return this;var H=this.getLayer(),W=D||H.hitCanvas,ee=W&&W.getContext(),q=this.hitFunc()||this.sceneFunc(),B=this._getCanvasCache(),G=B&&B.hit;if(this.colorKey||r.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),G){ee.save();var I=this.getAbsoluteTransform(F).getMatrix();return ee.transform(I[0],I[1],I[2],I[3],I[4],I[5]),this._drawCachedHitCanvas(ee),ee.restore(),this}if(!q)return this;if(ee.save(),ee._applyLineJoin(this),!(this===F)){var V=this.getAbsoluteTransform(F).getMatrix();ee.transform(V[0],V[1],V[2],V[3],V[4],V[5])}return q.call(this,ee,this),ee.restore(),this}drawHitFromCache(D=0){var F=this._getCanvasCache(),U=this._getCachedSceneCanvas(),H=F.hit,W=H.getContext(),ee=H.getWidth(),q=H.getHeight(),B,G,I,$,V,X;W.clear(),W.drawImage(U._canvas,0,0,ee,q);try{for(B=W.getImageData(0,0,ee,q),G=B.data,I=G.length,$=r.Util._hexToRgb(this.colorKey),V=0;V<I;V+=4)X=G[V+3],X>D?(G[V]=$.r,G[V+1]=$.g,G[V+2]=$.b,G[V+3]=255):G[V+3]=0;W.putImageData(B,0,0)}catch(Q){r.Util.error("Unable to draw hit graph from cached scene canvas. "+Q.message)}return this}hasPointerCapture(D){return u.hasPointerCapture(D,this)}setPointerCapture(D){u.setPointerCapture(D,this)}releaseCapture(D){u.releaseCapture(D,this)}}o.Shape=O,O.prototype._fillFunc=p,O.prototype._strokeFunc=x,O.prototype._fillFuncHit=C,O.prototype._strokeFuncHit=R,O.prototype._centroid=!1,O.prototype.nodeType="Shape",(0,l._registerNode)(O),O.prototype.eventListeners={},O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",S),O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",A),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",T),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",P),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",w),t.Factory.addGetterSetter(O,"stroke",void 0,(0,a.getStringOrGradientValidator)()),t.Factory.addGetterSetter(O,"strokeWidth",2,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillAfterStrokeEnabled",!1),t.Factory.addGetterSetter(O,"hitStrokeWidth","auto",(0,a.getNumberOrAutoValidator)()),t.Factory.addGetterSetter(O,"strokeHitEnabled",!0,(0,a.getBooleanValidator)()),t.Factory.addGetterSetter(O,"perfectDrawEnabled",!0,(0,a.getBooleanValidator)()),t.Factory.addGetterSetter(O,"shadowForStrokeEnabled",!0,(0,a.getBooleanValidator)()),t.Factory.addGetterSetter(O,"lineJoin"),t.Factory.addGetterSetter(O,"lineCap"),t.Factory.addGetterSetter(O,"sceneFunc"),t.Factory.addGetterSetter(O,"hitFunc"),t.Factory.addGetterSetter(O,"dash"),t.Factory.addGetterSetter(O,"dashOffset",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"shadowColor",void 0,(0,a.getStringValidator)()),t.Factory.addGetterSetter(O,"shadowBlur",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"shadowOpacity",1,(0,a.getNumberValidator)()),t.Factory.addComponentsGetterSetter(O,"shadowOffset",["x","y"]),t.Factory.addGetterSetter(O,"shadowOffsetX",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"shadowOffsetY",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternImage"),t.Factory.addGetterSetter(O,"fill",void 0,(0,a.getStringOrGradientValidator)()),t.Factory.addGetterSetter(O,"fillPatternX",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternY",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillLinearGradientColorStops"),t.Factory.addGetterSetter(O,"strokeLinearGradientColorStops"),t.Factory.addGetterSetter(O,"fillRadialGradientStartRadius",0),t.Factory.addGetterSetter(O,"fillRadialGradientEndRadius",0),t.Factory.addGetterSetter(O,"fillRadialGradientColorStops"),t.Factory.addGetterSetter(O,"fillPatternRepeat","repeat"),t.Factory.addGetterSetter(O,"fillEnabled",!0),t.Factory.addGetterSetter(O,"strokeEnabled",!0),t.Factory.addGetterSetter(O,"shadowEnabled",!0),t.Factory.addGetterSetter(O,"dashEnabled",!0),t.Factory.addGetterSetter(O,"strokeScaleEnabled",!0),t.Factory.addGetterSetter(O,"fillPriority","color"),t.Factory.addComponentsGetterSetter(O,"fillPatternOffset",["x","y"]),t.Factory.addGetterSetter(O,"fillPatternOffsetX",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternOffsetY",0,(0,a.getNumberValidator)()),t.Factory.addComponentsGetterSetter(O,"fillPatternScale",["x","y"]),t.Factory.addGetterSetter(O,"fillPatternScaleX",1,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(O,"fillPatternScaleY",1,(0,a.getNumberValidator)()),t.Factory.addComponentsGetterSetter(O,"fillLinearGradientStartPoint",["x","y"]),t.Factory.addComponentsGetterSetter(O,"strokeLinearGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillLinearGradientStartPointX",0),t.Factory.addGetterSetter(O,"strokeLinearGradientStartPointX",0),t.Factory.addGetterSetter(O,"fillLinearGradientStartPointY",0),t.Factory.addGetterSetter(O,"strokeLinearGradientStartPointY",0),t.Factory.addComponentsGetterSetter(O,"fillLinearGradientEndPoint",["x","y"]),t.Factory.addComponentsGetterSetter(O,"strokeLinearGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillLinearGradientEndPointX",0),t.Factory.addGetterSetter(O,"strokeLinearGradientEndPointX",0),t.Factory.addGetterSetter(O,"fillLinearGradientEndPointY",0),t.Factory.addGetterSetter(O,"strokeLinearGradientEndPointY",0),t.Factory.addComponentsGetterSetter(O,"fillRadialGradientStartPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillRadialGradientStartPointX",0),t.Factory.addGetterSetter(O,"fillRadialGradientStartPointY",0),t.Factory.addComponentsGetterSetter(O,"fillRadialGradientEndPoint",["x","y"]),t.Factory.addGetterSetter(O,"fillRadialGradientEndPointX",0),t.Factory.addGetterSetter(O,"fillRadialGradientEndPointY",0),t.Factory.addGetterSetter(O,"fillPatternRotation",0),t.Factory.addGetterSetter(O,"fillRule",void 0,(0,a.getStringValidator)()),t.Factory.backCompat(O,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Shape);Object.defineProperty(Layer$2,"__esModule",{value:!0});Layer$2.Layer=void 0;const Util_1$b=Util,Container_1$1=Container$2,Node_1$g=Node$1,Factory_1$w=Factory,Canvas_1=Canvas$1,Validators_1$v=Validators,Shape_1$g=Shape,Global_1$k=Global;var HASH="#",BEFORE_DRAW="beforeDraw",DRAW="draw",INTERSECTION_OFFSETS=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],INTERSECTION_OFFSETS_LEN=INTERSECTION_OFFSETS.length;let Layer$1=class extends Container_1$1.Container{constructor(e){super(e),this.canvas=new Canvas_1.SceneCanvas,this.hitCanvas=new Canvas_1.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var r=this.getStage();return r&&r.content&&(r.content.removeChild(this.getNativeCanvasElement()),e<r.children.length-1?r.content.insertBefore(this.getNativeCanvasElement(),r.children[e+1].getCanvas()._canvas):r.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Node_1$g.Node.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var e=Node_1$g.Node.prototype.moveUp.call(this);if(!e)return!1;var r=this.getStage();return!r||!r.content?!1:(r.content.removeChild(this.getNativeCanvasElement()),this.index<r.children.length-1?r.content.insertBefore(this.getNativeCanvasElement(),r.children[this.index+1].getCanvas()._canvas):r.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Node_1$g.Node.prototype.moveDown.call(this)){var e=this.getStage();if(e){var r=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),r[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Node_1$g.Node.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var r=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),r[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return Node_1$g.Node.prototype.remove.call(this),e&&e.parentNode&&Util_1$b.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:r}){return this.canvas.setSize(e,r),this.hitCanvas.setSize(e,r),this._setSmoothEnabled(),this}_validateAdd(e){var r=e.getType();r!=="Group"&&r!=="Shape"&&Util_1$b.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e=e||{},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),Node_1$g.Node.prototype._toKonvaCanvas.call(this,e)}_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(){Util_1$b.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Util_1$b.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Util_1$b.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var r=1,t=!1;;){for(let n=0;n<INTERSECTION_OFFSETS_LEN;n++){const a=INTERSECTION_OFFSETS[n],l=this._getIntersection({x:e.x+a.x*r,y:e.y+a.y*r}),u=l.shape;if(u)return u;if(t=!!l.antialiased,!l.antialiased)break}if(t)r+=1;else return null}}_getIntersection(e){const r=this.hitCanvas.pixelRatio,t=this.hitCanvas.context.getImageData(Math.round(e.x*r),Math.round(e.y*r),1,1).data,n=t[3];if(n===255){const a=Util_1$b.Util._rgbToHex(t[0],t[1],t[2]),l=Shape_1$g.shapes[HASH+a];return l?{shape:l}:{antialiased:!0}}else if(n>0)return{antialiased:!0};return{}}drawScene(e,r){var t=this.getLayer(),n=e||t&&t.getCanvas();return this._fire(BEFORE_DRAW,{node:this}),this.clearBeforeDraw()&&n.getContext().clear(),Container_1$1.Container.prototype.drawScene.call(this,n,r),this._fire(DRAW,{node:this}),this}drawHit(e,r){var t=this.getLayer(),n=e||t&&t.hitCanvas;return t&&t.clearBeforeDraw()&&t.getHitCanvas().getContext().clear(),Container_1$1.Container.prototype.drawHit.call(this,n,r),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Util_1$b.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,r=!!this.hitCanvas._canvas.parentNode;r?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Util_1$b.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Layer$2.Layer=Layer$1;Layer$1.prototype.nodeType="Layer";(0,Global_1$k._registerNode)(Layer$1);Factory_1$w.Factory.addGetterSetter(Layer$1,"imageSmoothingEnabled",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"clearBeforeDraw",!0);Factory_1$w.Factory.addGetterSetter(Layer$1,"hitGraphEnabled",!0,(0,Validators_1$v.getBooleanValidator)());var FastLayer$1={};Object.defineProperty(FastLayer$1,"__esModule",{value:!0});FastLayer$1.FastLayer=void 0;const Util_1$a=Util,Layer_1=Layer$2,Global_1$j=Global;class FastLayer extends Layer_1.Layer{constructor(e){super(e),this.listening(!1),Util_1$a.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}FastLayer$1.FastLayer=FastLayer;FastLayer.prototype.nodeType="FastLayer";(0,Global_1$j._registerNode)(FastLayer);var Group$2={};Object.defineProperty(Group$2,"__esModule",{value:!0});Group$2.Group=void 0;const Util_1$9=Util,Container_1=Container$2,Global_1$i=Global;let Group$1=class extends Container_1.Container{_validateAdd(e){var r=e.getType();r!=="Group"&&r!=="Shape"&&Util_1$9.Util.throw("You may only add groups and shapes to groups.")}};Group$2.Group=Group$1;Group$1.prototype.nodeType="Group";(0,Global_1$i._registerNode)(Group$1);var Animation$2={};Object.defineProperty(Animation$2,"__esModule",{value:!0});Animation$2.Animation=void 0;const Global_1$h=Global,Util_1$8=Util,now=function(){return Global_1$h.glob.performance&&Global_1$h.glob.performance.now?function(){return Global_1$h.glob.performance.now()}:function(){return new Date().getTime()}}();let Animation$1=class Hl{constructor(e,r){this.id=Hl.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:now(),frameRate:0},this.func=e,this.setLayers(r)}setLayers(e){let r=[];return e&&(r=Array.isArray(e)?e:[e]),this.layers=r,this}getLayers(){return this.layers}addLayer(e){const r=this.layers,t=r.length;for(let n=0;n<t;n++)if(r[n]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const r=Hl.animations,t=r.length;for(let n=0;n<t;n++)if(r[n].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=now(),Hl._addAnimation(this),this}stop(){return Hl._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const r=e.id,t=this.animations,n=t.length;for(let a=0;a<n;a++)if(t[a].id===r){this.animations.splice(a,1);break}}static _runFrames(){const e={},r=this.animations;for(let t=0;t<r.length;t++){const n=r[t],a=n.layers,l=n.func;n._updateFrameObject(now());const u=a.length;let f;if(l?f=l.call(n,n.frame)!==!1:f=!0,!!f)for(let d=0;d<u;d++){const h=a[d];h._id!==void 0&&(e[h._id]=h)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){const e=Hl;e.animations.length?(e._runFrames(),Util_1$8.Util.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Util_1$8.Util.requestAnimFrame(this._animationLoop))}};Animation$2.Animation=Animation$1;Animation$1.animations=[];Animation$1.animIdCounter=0;Animation$1.animRunning=!1;var Tween$1={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Easings=o.Tween=void 0;const e=Util,r=Animation$2,t=Node$1,n=Global;var a={node:1,duration:1,easing:1,onFinish:1,yoyo:1},l=1,u=2,f=3,d=0,h=["fill","stroke","shadowColor"];class y{constructor(_,p,x,C,R,S,A){this.prop=_,this.propFunc=p,this.begin=C,this._pos=C,this.duration=S,this._change=0,this.prevPos=0,this.yoyo=A,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=x,this._change=R-this.begin,this.pause()}fire(_){var p=this[_];p&&p()}setTime(_){_>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():_<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=_,this.update())}getTime(){return this._time}setPosition(_){this.prevPos=this._pos,this.propFunc(_),this._pos=_}getPosition(_){return _===void 0&&(_=this._time),this.func(_,this.begin,this._change,this.duration)}play(){this.state=u,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=f,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(_){this.pause(),this._time=_,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var _=this.getTimer()-this._startTime;this.state===u?this.setTime(_):this.state===f&&this.setTime(this.duration-_)}pause(){this.state=l,this.fire("onPause")}getTimer(){return new Date().getTime()}}class E{constructor(_){var p=this,x=_.node,C=x._id,R,S=_.easing||o.Easings.Linear,A=!!_.yoyo,T;typeof _.duration>"u"?R=.3:_.duration===0?R=.001:R=_.duration,this.node=x,this._id=d++;var P=x.getLayer()||(x instanceof n.Konva.Stage?x.getLayers():null);P||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new r.Animation(function(){p.tween.onEnterFrame()},P),this.tween=new y(T,function(w){p._tweenFunc(w)},S,0,1,R*1e3,A),this._addListeners(),E.attrs[C]||(E.attrs[C]={}),E.attrs[C][this._id]||(E.attrs[C][this._id]={}),E.tweens[C]||(E.tweens[C]={});for(T in _)a[T]===void 0&&this._addAttr(T,_[T]);this.reset(),this.onFinish=_.onFinish,this.onReset=_.onReset,this.onUpdate=_.onUpdate}_addAttr(_,p){var x=this.node,C=x._id,R,S,A,T,P,w,O,k;if(A=E.tweens[C][_],A&&delete E.attrs[C][A][_],R=x.getAttr(_),e.Util._isArray(p))if(S=[],P=Math.max(p.length,R.length),_==="points"&&p.length!==R.length&&(p.length>R.length?(O=R,R=e.Util._prepareArrayForTween(R,p,x.closed())):(w=p,p=e.Util._prepareArrayForTween(p,R,x.closed()))),_.indexOf("fill")===0)for(T=0;T<P;T++)if(T%2===0)S.push(p[T]-R[T]);else{var D=e.Util.colorToRGBA(R[T]);k=e.Util.colorToRGBA(p[T]),R[T]=D,S.push({r:k.r-D.r,g:k.g-D.g,b:k.b-D.b,a:k.a-D.a})}else for(T=0;T<P;T++)S.push(p[T]-R[T]);else h.indexOf(_)!==-1?(R=e.Util.colorToRGBA(R),k=e.Util.colorToRGBA(p),S={r:k.r-R.r,g:k.g-R.g,b:k.b-R.b,a:k.a-R.a}):S=p-R;E.attrs[C][this._id][_]={start:R,diff:S,end:p,trueEnd:w,trueStart:O},E.tweens[C][_]=this._id}_tweenFunc(_){var p=this.node,x=E.attrs[p._id][this._id],C,R,S,A,T,P,w,O;for(C in x){if(R=x[C],S=R.start,A=R.diff,O=R.end,e.Util._isArray(S))if(T=[],w=Math.max(S.length,O.length),C.indexOf("fill")===0)for(P=0;P<w;P++)P%2===0?T.push((S[P]||0)+A[P]*_):T.push("rgba("+Math.round(S[P].r+A[P].r*_)+","+Math.round(S[P].g+A[P].g*_)+","+Math.round(S[P].b+A[P].b*_)+","+(S[P].a+A[P].a*_)+")");else for(P=0;P<w;P++)T.push((S[P]||0)+A[P]*_);else h.indexOf(C)!==-1?T="rgba("+Math.round(S.r+A.r*_)+","+Math.round(S.g+A.g*_)+","+Math.round(S.b+A.b*_)+","+(S.a+A.a*_)+")":T=S+A*_;p.setAttr(C,T)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var _=this.node,p=E.attrs[_._id][this._id];p.points&&p.points.trueEnd&&_.setAttr("points",p.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var _=this.node,p=E.attrs[_._id][this._id];p.points&&p.points.trueStart&&_.points(p.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(_){return this.tween.seek(_*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var _=this.node._id,p=this._id,x=E.tweens[_],C;this.pause();for(C in x)delete E.tweens[_][C];delete E.attrs[_][p]}}o.Tween=E,E.attrs={},E.tweens={},t.Node.prototype.to=function(g){var _=g.onFinish;g.node=this,g.onFinish=function(){this.destroy(),_&&_()};var p=new E(g);p.play()},o.Easings={BackEaseIn(g,_,p,x){var C=1.70158;return p*(g/=x)*g*((C+1)*g-C)+_},BackEaseOut(g,_,p,x){var C=1.70158;return p*((g=g/x-1)*g*((C+1)*g+C)+1)+_},BackEaseInOut(g,_,p,x){var C=1.70158;return(g/=x/2)<1?p/2*(g*g*(((C*=1.525)+1)*g-C))+_:p/2*((g-=2)*g*(((C*=1.525)+1)*g+C)+2)+_},ElasticEaseIn(g,_,p,x,C,R){var S=0;return g===0?_:(g/=x)===1?_+p:(R||(R=x*.3),!C||C<Math.abs(p)?(C=p,S=R/4):S=R/(2*Math.PI)*Math.asin(p/C),-(C*Math.pow(2,10*(g-=1))*Math.sin((g*x-S)*(2*Math.PI)/R))+_)},ElasticEaseOut(g,_,p,x,C,R){var S=0;return g===0?_:(g/=x)===1?_+p:(R||(R=x*.3),!C||C<Math.abs(p)?(C=p,S=R/4):S=R/(2*Math.PI)*Math.asin(p/C),C*Math.pow(2,-10*g)*Math.sin((g*x-S)*(2*Math.PI)/R)+p+_)},ElasticEaseInOut(g,_,p,x,C,R){var S=0;return g===0?_:(g/=x/2)===2?_+p:(R||(R=x*(.3*1.5)),!C||C<Math.abs(p)?(C=p,S=R/4):S=R/(2*Math.PI)*Math.asin(p/C),g<1?-.5*(C*Math.pow(2,10*(g-=1))*Math.sin((g*x-S)*(2*Math.PI)/R))+_:C*Math.pow(2,-10*(g-=1))*Math.sin((g*x-S)*(2*Math.PI)/R)*.5+p+_)},BounceEaseOut(g,_,p,x){return(g/=x)<1/2.75?p*(7.5625*g*g)+_:g<2/2.75?p*(7.5625*(g-=1.5/2.75)*g+.75)+_:g<2.5/2.75?p*(7.5625*(g-=2.25/2.75)*g+.9375)+_:p*(7.5625*(g-=2.625/2.75)*g+.984375)+_},BounceEaseIn(g,_,p,x){return p-o.Easings.BounceEaseOut(x-g,0,p,x)+_},BounceEaseInOut(g,_,p,x){return g<x/2?o.Easings.BounceEaseIn(g*2,0,p,x)*.5+_:o.Easings.BounceEaseOut(g*2-x,0,p,x)*.5+p*.5+_},EaseIn(g,_,p,x){return p*(g/=x)*g+_},EaseOut(g,_,p,x){return-p*(g/=x)*(g-2)+_},EaseInOut(g,_,p,x){return(g/=x/2)<1?p/2*g*g+_:-p/2*(--g*(g-2)-1)+_},StrongEaseIn(g,_,p,x){return p*(g/=x)*g*g*g*g+_},StrongEaseOut(g,_,p,x){return p*((g=g/x-1)*g*g*g*g+1)+_},StrongEaseInOut(g,_,p,x){return(g/=x/2)<1?p/2*g*g*g*g*g+_:p/2*((g-=2)*g*g*g*g+2)+_},Linear(g,_,p,x){return p*g/x+_}}})(Tween$1);(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Konva=void 0;const e=Global,r=Util,t=Node$1,n=Container$2,a=Stage$1,l=Layer$2,u=FastLayer$1,f=Group$2,d=DragAndDrop,h=Shape,y=Animation$2,E=Tween$1,g=Context$2,_=Canvas$1;o.Konva=r.Util._assign(e.Konva,{Util:r.Util,Transform:r.Transform,Node:t.Node,Container:n.Container,Stage:a.Stage,stages:a.stages,Layer:l.Layer,FastLayer:u.FastLayer,Group:f.Group,DD:d.DD,Shape:h.Shape,shapes:h.shapes,Animation:y.Animation,Tween:E.Tween,Easings:E.Easings,Context:g.Context,Canvas:_.Canvas}),o.default=o.Konva})(_CoreInternals);var Arc$1={};Object.defineProperty(Arc$1,"__esModule",{value:!0});Arc$1.Arc=void 0;const Factory_1$v=Factory,Shape_1$f=Shape,Global_1$g=Global,Validators_1$u=Validators,Global_2$2=Global;class Arc extends Shape_1$f.Shape{_sceneFunc(e){var r=Global_1$g.Konva.getAngle(this.angle()),t=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,r,t),e.arc(0,0,this.innerRadius(),r,0,!t),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),r=this.outerRadius(),t=this.clockwise(),n=Global_1$g.Konva.getAngle(t?360-this.angle():this.angle()),a=Math.cos(Math.min(n,Math.PI)),l=1,u=Math.sin(Math.min(Math.max(Math.PI,n),3*Math.PI/2)),f=Math.sin(Math.min(n,Math.PI/2)),d=a*(a>0?e:r),h=l*r,y=u*(u>0?e:r),E=f*(f>0?r:e);return{x:d,y:t?-1*E:y,width:h-d,height:E-y}}}Arc$1.Arc=Arc;Arc.prototype._centroid=!0;Arc.prototype.className="Arc";Arc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_2$2._registerNode)(Arc);Factory_1$v.Factory.addGetterSetter(Arc,"innerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"outerRadius",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"angle",0,(0,Validators_1$u.getNumberValidator)());Factory_1$v.Factory.addGetterSetter(Arc,"clockwise",!1,(0,Validators_1$u.getBooleanValidator)());var Arrow$1={},Line$2={};Object.defineProperty(Line$2,"__esModule",{value:!0});Line$2.Line=void 0;const Factory_1$u=Factory,Shape_1$e=Shape,Validators_1$t=Validators,Global_1$f=Global;function getControlPoints(o,e,r,t,n,a,l){var u=Math.sqrt(Math.pow(r-o,2)+Math.pow(t-e,2)),f=Math.sqrt(Math.pow(n-r,2)+Math.pow(a-t,2)),d=l*u/(u+f),h=l*f/(u+f),y=r-d*(n-o),E=t-d*(a-e),g=r+h*(n-o),_=t+h*(a-e);return[y,E,g,_]}function expandPoints(o,e){var r=o.length,t=[],n,a;for(n=2;n<r-2;n+=2)a=getControlPoints(o[n-2],o[n-1],o[n],o[n+1],o[n+2],o[n+3],e),!isNaN(a[0])&&(t.push(a[0]),t.push(a[1]),t.push(o[n]),t.push(o[n+1]),t.push(a[2]),t.push(a[3]));return t}let Line$1=class extends Shape_1$e.Shape{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){var r=this.points(),t=r.length,n=this.tension(),a=this.closed(),l=this.bezier(),u,f,d;if(t){if(e.beginPath(),e.moveTo(r[0],r[1]),n!==0&&t>4){for(u=this.getTensionPoints(),f=u.length,d=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);d<f-2;)e.bezierCurveTo(u[d++],u[d++],u[d++],u[d++],u[d++],u[d++]);a||e.quadraticCurveTo(u[f-2],u[f-1],r[t-2],r[t-1])}else if(l)for(d=2;d<t;)e.bezierCurveTo(r[d++],r[d++],r[d++],r[d++],r[d++],r[d++]);else for(d=2;d<t;d+=2)e.lineTo(r[d],r[d+1]);a?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():expandPoints(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),r=e.length,t=this.tension(),n=getControlPoints(e[r-2],e[r-1],e[0],e[1],e[2],e[3],t),a=getControlPoints(e[r-4],e[r-3],e[r-2],e[r-1],e[0],e[1],t),l=expandPoints(e,t),u=[n[2],n[3]].concat(l).concat([a[0],a[1],e[r-2],e[r-1],a[2],a[3],n[0],n[1],e[0],e[1]]);return u}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:e=this.points();for(var r=e[0],t=e[0],n=e[1],a=e[1],l,u,f=0;f<e.length/2;f++)l=e[f*2],u=e[f*2+1],r=Math.min(r,l),t=Math.max(t,l),n=Math.min(n,u),a=Math.max(a,u);return{x:r,y:n,width:t-r,height:a-n}}};Line$2.Line=Line$1;Line$1.prototype.className="Line";Line$1.prototype._attrsAffectingSize=["points","bezier","tension"];(0,Global_1$f._registerNode)(Line$1);Factory_1$u.Factory.addGetterSetter(Line$1,"closed",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"bezier",!1);Factory_1$u.Factory.addGetterSetter(Line$1,"tension",0,(0,Validators_1$t.getNumberValidator)());Factory_1$u.Factory.addGetterSetter(Line$1,"points",[],(0,Validators_1$t.getNumberArrayValidator)());var Path$1={},BezierFunctions={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.t2length=o.getQuadraticArcLength=o.getCubicArcLength=o.binomialCoefficients=o.cValues=o.tValues=void 0,o.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],o.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],o.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const e=(l,u,f)=>{let d,h,y;d=f/2,h=0;for(let g=0;g<20;g++)y=d*o.tValues[20][g]+d,h+=o.cValues[20][g]*t(l,u,y);return d*h};o.getCubicArcLength=e;const r=(l,u,f)=>{f===void 0&&(f=1);const d=l[0]-2*l[1]+l[2],h=u[0]-2*u[1]+u[2],y=2*l[1]-2*l[0],E=2*u[1]-2*u[0],g=4*(d*d+h*h),_=4*(d*y+h*E),p=y*y+E*E;if(g===0)return f*Math.sqrt(Math.pow(l[2]-l[0],2)+Math.pow(u[2]-u[0],2));const x=_/(2*g),C=p/g,R=f+x,S=C-x*x,A=R*R+S>0?Math.sqrt(R*R+S):0,T=x*x+S>0?Math.sqrt(x*x+S):0,P=x+Math.sqrt(x*x+S)!==0?S*Math.log(Math.abs((R+A)/(x+T))):0;return Math.sqrt(g)/2*(R*A-x*T+P)};o.getQuadraticArcLength=r;function t(l,u,f){const d=n(1,f,l),h=n(1,f,u),y=d*d+h*h;return Math.sqrt(y)}const n=(l,u,f)=>{const d=f.length-1;let h,y;if(d===0)return 0;if(l===0){y=0;for(let E=0;E<=d;E++)y+=o.binomialCoefficients[d][E]*Math.pow(1-u,d-E)*Math.pow(u,E)*f[E];return y}else{h=new Array(d);for(let E=0;E<d;E++)h[E]=d*(f[E+1]-f[E]);return n(l-1,u,h)}},a=(l,u,f)=>{let d=1,h=l/u,y=(l-f(h))/u,E=0;for(;d>.001;){const g=f(h+y),_=Math.abs(l-g)/u;if(_<d)d=_,h+=y;else{const p=f(h-y),x=Math.abs(l-p)/u;x<d?(d=x,h-=y):y/=2}if(E++,E>500)break}return h};o.t2length=a})(BezierFunctions);Object.defineProperty(Path$1,"__esModule",{value:!0});Path$1.Path=void 0;const Factory_1$t=Factory,Shape_1$d=Shape,Global_1$e=Global,BezierFunctions_1=BezierFunctions;class Path extends Shape_1$d.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Path.parsePathData(this.data()),this.pathLength=Path.getPathLength(this.dataArray)}_sceneFunc(e){var r=this.dataArray;e.beginPath();for(var t=!1,n=0;n<r.length;n++){var a=r[n].command,l=r[n].points;switch(a){case"L":e.lineTo(l[0],l[1]);break;case"M":e.moveTo(l[0],l[1]);break;case"C":e.bezierCurveTo(l[0],l[1],l[2],l[3],l[4],l[5]);break;case"Q":e.quadraticCurveTo(l[0],l[1],l[2],l[3]);break;case"A":var u=l[0],f=l[1],d=l[2],h=l[3],y=l[4],E=l[5],g=l[6],_=l[7],p=d>h?d:h,x=d>h?1:d/h,C=d>h?h/d:1;e.translate(u,f),e.rotate(g),e.scale(x,C),e.arc(0,0,p,y,y+E,1-_),e.scale(1/x,1/C),e.rotate(-g),e.translate(-u,-f);break;case"z":t=!0,e.closePath();break}}!t&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(d){if(d.command==="A"){var h=d.points[4],y=d.points[5],E=d.points[4]+y,g=Math.PI/180;if(Math.abs(h-E)<g&&(g=Math.abs(h-E)),y<0)for(let _=h-g;_>E;_-=g){const p=Path.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],_,0);e.push(p.x,p.y)}else for(let _=h+g;_<E;_+=g){const p=Path.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],_,0);e.push(p.x,p.y)}}else if(d.command==="C")for(let _=0;_<=1;_+=.01){const p=Path.getPointOnCubicBezier(_,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3],d.points[4],d.points[5]);e.push(p.x,p.y)}else e=e.concat(d.points)});for(var r=e[0],t=e[0],n=e[1],a=e[1],l,u,f=0;f<e.length/2;f++)l=e[f*2],u=e[f*2+1],isNaN(l)||(r=Math.min(r,l),t=Math.max(t,l)),isNaN(u)||(n=Math.min(n,u),a=Math.max(a,u));return{x:r,y:n,width:t-r,height:a-n}}getLength(){return this.pathLength}getPointAtLength(e){return Path.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,r,t,n){return Math.sqrt((t-e)*(t-e)+(n-r)*(n-r))}static getPathLength(e){let r=0;for(var t=0;t<e.length;++t)r+=e[t].pathLength;return r}static getPointAtLengthOfDataArray(e,r){var t,n=0,a=r.length;if(!a)return null;for(;n<a&&e>r[n].pathLength;)e-=r[n].pathLength,++n;if(n===a)return t=r[n-1].points.slice(-2),{x:t[0],y:t[1]};if(e<.01)return t=r[n].points.slice(0,2),{x:t[0],y:t[1]};var l=r[n],u=l.points;switch(l.command){case"L":return Path.getPointOnLine(e,l.start.x,l.start.y,u[0],u[1]);case"C":return Path.getPointOnCubicBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(r),p=>(0,BezierFunctions_1.getCubicArcLength)([l.start.x,u[0],u[2],u[4]],[l.start.y,u[1],u[3],u[5]],p)),l.start.x,l.start.y,u[0],u[1],u[2],u[3],u[4],u[5]);case"Q":return Path.getPointOnQuadraticBezier((0,BezierFunctions_1.t2length)(e,Path.getPathLength(r),p=>(0,BezierFunctions_1.getQuadraticArcLength)([l.start.x,u[0],u[2]],[l.start.y,u[1],u[3]],p)),l.start.x,l.start.y,u[0],u[1],u[2],u[3]);case"A":var f=u[0],d=u[1],h=u[2],y=u[3],E=u[4],g=u[5],_=u[6];return E+=g*e/l.pathLength,Path.getPointOnEllipticalArc(f,d,h,y,E,_)}return null}static getPointOnLine(e,r,t,n,a,l,u){l===void 0&&(l=r),u===void 0&&(u=t);var f=(a-t)/(n-r+1e-8),d=Math.sqrt(e*e/(1+f*f));n<r&&(d*=-1);var h=f*d,y;if(n===r)y={x:l,y:u+h};else if((u-t)/(l-r+1e-8)===f)y={x:l+d,y:u+h};else{var E,g,_=this.getLineLength(r,t,n,a),p=(l-r)*(n-r)+(u-t)*(a-t);p=p/(_*_),E=r+p*(n-r),g=t+p*(a-t);var x=this.getLineLength(l,u,E,g),C=Math.sqrt(e*e-x*x);d=Math.sqrt(C*C/(1+f*f)),n<r&&(d*=-1),h=f*d,y={x:E+d,y:g+h}}return y}static getPointOnCubicBezier(e,r,t,n,a,l,u,f,d){function h(x){return x*x*x}function y(x){return 3*x*x*(1-x)}function E(x){return 3*x*(1-x)*(1-x)}function g(x){return(1-x)*(1-x)*(1-x)}var _=f*h(e)+l*y(e)+n*E(e)+r*g(e),p=d*h(e)+u*y(e)+a*E(e)+t*g(e);return{x:_,y:p}}static getPointOnQuadraticBezier(e,r,t,n,a,l,u){function f(g){return g*g}function d(g){return 2*g*(1-g)}function h(g){return(1-g)*(1-g)}var y=l*f(e)+n*d(e)+r*h(e),E=u*f(e)+a*d(e)+t*h(e);return{x:y,y:E}}static getPointOnEllipticalArc(e,r,t,n,a,l){var u=Math.cos(l),f=Math.sin(l),d={x:t*Math.cos(a),y:n*Math.sin(a)};return{x:e+(d.x*u-d.y*f),y:r+(d.x*f+d.y*u)}}static parsePathData(e){if(!e)return[];var r=e,t=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];r=r.replace(new RegExp(" ","g"),",");for(var n=0;n<t.length;n++)r=r.replace(new RegExp(t[n],"g"),"|"+t[n]);var a=r.split("|"),l=[],u=[],f=0,d=0,h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,y;for(n=1;n<a.length;n++){var E=a[n],g=E.charAt(0);for(E=E.slice(1),u.length=0;y=h.exec(E);)u.push(y[0]);for(var _=[],p=0,x=u.length;p<x;p++){if(u[p]==="00"){_.push(0,0);continue}var C=parseFloat(u[p]);isNaN(C)?_.push(0):_.push(C)}for(;_.length>0&&!isNaN(_[0]);){var R="",S=[],A=f,T=d,P,w,O,k,D,F,U,H,W,ee;switch(g){case"l":f+=_.shift(),d+=_.shift(),R="L",S.push(f,d);break;case"L":f=_.shift(),d=_.shift(),S.push(f,d);break;case"m":var q=_.shift(),B=_.shift();if(f+=q,d+=B,R="M",l.length>2&&l[l.length-1].command==="z"){for(var G=l.length-2;G>=0;G--)if(l[G].command==="M"){f=l[G].points[0]+q,d=l[G].points[1]+B;break}}S.push(f,d),g="l";break;case"M":f=_.shift(),d=_.shift(),R="M",S.push(f,d),g="L";break;case"h":f+=_.shift(),R="L",S.push(f,d);break;case"H":f=_.shift(),R="L",S.push(f,d);break;case"v":d+=_.shift(),R="L",S.push(f,d);break;case"V":d=_.shift(),R="L",S.push(f,d);break;case"C":S.push(_.shift(),_.shift(),_.shift(),_.shift()),f=_.shift(),d=_.shift(),S.push(f,d);break;case"c":S.push(f+_.shift(),d+_.shift(),f+_.shift(),d+_.shift()),f+=_.shift(),d+=_.shift(),R="C",S.push(f,d);break;case"S":w=f,O=d,P=l[l.length-1],P.command==="C"&&(w=f+(f-P.points[2]),O=d+(d-P.points[3])),S.push(w,O,_.shift(),_.shift()),f=_.shift(),d=_.shift(),R="C",S.push(f,d);break;case"s":w=f,O=d,P=l[l.length-1],P.command==="C"&&(w=f+(f-P.points[2]),O=d+(d-P.points[3])),S.push(w,O,f+_.shift(),d+_.shift()),f+=_.shift(),d+=_.shift(),R="C",S.push(f,d);break;case"Q":S.push(_.shift(),_.shift()),f=_.shift(),d=_.shift(),S.push(f,d);break;case"q":S.push(f+_.shift(),d+_.shift()),f+=_.shift(),d+=_.shift(),R="Q",S.push(f,d);break;case"T":w=f,O=d,P=l[l.length-1],P.command==="Q"&&(w=f+(f-P.points[0]),O=d+(d-P.points[1])),f=_.shift(),d=_.shift(),R="Q",S.push(w,O,f,d);break;case"t":w=f,O=d,P=l[l.length-1],P.command==="Q"&&(w=f+(f-P.points[0]),O=d+(d-P.points[1])),f+=_.shift(),d+=_.shift(),R="Q",S.push(w,O,f,d);break;case"A":k=_.shift(),D=_.shift(),F=_.shift(),U=_.shift(),H=_.shift(),W=f,ee=d,f=_.shift(),d=_.shift(),R="A",S=this.convertEndpointToCenterParameterization(W,ee,f,d,U,H,k,D,F);break;case"a":k=_.shift(),D=_.shift(),F=_.shift(),U=_.shift(),H=_.shift(),W=f,ee=d,f+=_.shift(),d+=_.shift(),R="A",S=this.convertEndpointToCenterParameterization(W,ee,f,d,U,H,k,D,F);break}l.push({command:R||g,points:S,start:{x:A,y:T},pathLength:this.calcLength(A,T,R||g,S)})}(g==="z"||g==="Z")&&l.push({command:"z",points:[],start:void 0,pathLength:0})}return l}static calcLength(e,r,t,n){var a,l,u,f,d=Path;switch(t){case"L":return d.getLineLength(e,r,n[0],n[1]);case"C":return(0,BezierFunctions_1.getCubicArcLength)([e,n[0],n[2],n[4]],[r,n[1],n[3],n[5]],1);case"Q":return(0,BezierFunctions_1.getQuadraticArcLength)([e,n[0],n[2]],[r,n[1],n[3]],1);case"A":a=0;var h=n[4],y=n[5],E=n[4]+y,g=Math.PI/180;if(Math.abs(h-E)<g&&(g=Math.abs(h-E)),l=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],h,0),y<0)for(f=h-g;f>E;f-=g)u=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],f,0),a+=d.getLineLength(l.x,l.y,u.x,u.y),l=u;else for(f=h+g;f<E;f+=g)u=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],f,0),a+=d.getLineLength(l.x,l.y,u.x,u.y),l=u;return u=d.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],E,0),a+=d.getLineLength(l.x,l.y,u.x,u.y),a}return 0}static convertEndpointToCenterParameterization(e,r,t,n,a,l,u,f,d){var h=d*(Math.PI/180),y=Math.cos(h)*(e-t)/2+Math.sin(h)*(r-n)/2,E=-1*Math.sin(h)*(e-t)/2+Math.cos(h)*(r-n)/2,g=y*y/(u*u)+E*E/(f*f);g>1&&(u*=Math.sqrt(g),f*=Math.sqrt(g));var _=Math.sqrt((u*u*(f*f)-u*u*(E*E)-f*f*(y*y))/(u*u*(E*E)+f*f*(y*y)));a===l&&(_*=-1),isNaN(_)&&(_=0);var p=_*u*E/f,x=_*-f*y/u,C=(e+t)/2+Math.cos(h)*p-Math.sin(h)*x,R=(r+n)/2+Math.sin(h)*p+Math.cos(h)*x,S=function(D){return Math.sqrt(D[0]*D[0]+D[1]*D[1])},A=function(D,F){return(D[0]*F[0]+D[1]*F[1])/(S(D)*S(F))},T=function(D,F){return(D[0]*F[1]<D[1]*F[0]?-1:1)*Math.acos(A(D,F))},P=T([1,0],[(y-p)/u,(E-x)/f]),w=[(y-p)/u,(E-x)/f],O=[(-1*y-p)/u,(-1*E-x)/f],k=T(w,O);return A(w,O)<=-1&&(k=Math.PI),A(w,O)>=1&&(k=0),l===0&&k>0&&(k=k-2*Math.PI),l===1&&k<0&&(k=k+2*Math.PI),[C,R,u,f,P,k,h,l]}}Path$1.Path=Path;Path.prototype.className="Path";Path.prototype._attrsAffectingSize=["data"];(0,Global_1$e._registerNode)(Path);Factory_1$t.Factory.addGetterSetter(Path,"data");Object.defineProperty(Arrow$1,"__esModule",{value:!0});Arrow$1.Arrow=void 0;const Factory_1$s=Factory,Line_1$1=Line$2,Validators_1$s=Validators,Global_1$d=Global,Path_1$2=Path$1;class Arrow extends Line_1$1.Line{_sceneFunc(e){super._sceneFunc(e);var r=Math.PI*2,t=this.points(),n=t,a=this.tension()!==0&&t.length>4;a&&(n=this.getTensionPoints());var l=this.pointerLength(),u=t.length,f,d;if(a){const E=[n[n.length-4],n[n.length-3],n[n.length-2],n[n.length-1],t[u-2],t[u-1]],g=Path_1$2.Path.calcLength(n[n.length-4],n[n.length-3],"C",E),_=Path_1$2.Path.getPointOnQuadraticBezier(Math.min(1,1-l/g),E[0],E[1],E[2],E[3],E[4],E[5]);f=t[u-2]-_.x,d=t[u-1]-_.y}else f=t[u-2]-t[u-4],d=t[u-1]-t[u-3];var h=(Math.atan2(d,f)+r)%r,y=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(t[u-2],t[u-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-l,y/2),e.lineTo(-l,-y/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(t[0],t[1]),a?(f=(n[0]+n[2])/2-t[0],d=(n[1]+n[3])/2-t[1]):(f=t[2]-t[0],d=t[3]-t[1]),e.rotate((Math.atan2(-d,-f)+r)%r),e.moveTo(0,0),e.lineTo(-l,y/2),e.lineTo(-l,-y/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var r=this.dashEnabled();r&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),r&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),r=this.pointerWidth()/2;return{x:e.x-r,y:e.y-r,width:e.width+r*2,height:e.height+r*2}}}Arrow$1.Arrow=Arrow;Arrow.prototype.className="Arrow";(0,Global_1$d._registerNode)(Arrow);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerLength",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerWidth",10,(0,Validators_1$s.getNumberValidator)());Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtBeginning",!1);Factory_1$s.Factory.addGetterSetter(Arrow,"pointerAtEnding",!0);var Circle$1={};Object.defineProperty(Circle$1,"__esModule",{value:!0});Circle$1.Circle=void 0;const Factory_1$r=Factory,Shape_1$c=Shape,Validators_1$r=Validators,Global_1$c=Global;class Circle extends Shape_1$c.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Circle$1.Circle=Circle;Circle.prototype._centroid=!0;Circle.prototype.className="Circle";Circle.prototype._attrsAffectingSize=["radius"];(0,Global_1$c._registerNode)(Circle);Factory_1$r.Factory.addGetterSetter(Circle,"radius",0,(0,Validators_1$r.getNumberValidator)());var Ellipse$1={};Object.defineProperty(Ellipse$1,"__esModule",{value:!0});Ellipse$1.Ellipse=void 0;const Factory_1$q=Factory,Shape_1$b=Shape,Validators_1$q=Validators,Global_1$b=Global;class Ellipse extends Shape_1$b.Shape{_sceneFunc(e){var r=this.radiusX(),t=this.radiusY();e.beginPath(),e.save(),r!==t&&e.scale(1,t/r),e.arc(0,0,r,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Ellipse$1.Ellipse=Ellipse;Ellipse.prototype.className="Ellipse";Ellipse.prototype._centroid=!0;Ellipse.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Global_1$b._registerNode)(Ellipse);Factory_1$q.Factory.addComponentsGetterSetter(Ellipse,"radius",["x","y"]);Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusX",0,(0,Validators_1$q.getNumberValidator)());Factory_1$q.Factory.addGetterSetter(Ellipse,"radiusY",0,(0,Validators_1$q.getNumberValidator)());var Image$4={};Object.defineProperty(Image$4,"__esModule",{value:!0});Image$4.Image=void 0;const Util_1$7=Util,Factory_1$p=Factory,Shape_1$a=Shape,Global_1$a=Global,Validators_1$p=Validators;let Image$3=class wv extends Shape_1$a.Shape{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const r=this.getWidth(),t=this.getHeight(),n=this.cornerRadius(),a=this.attrs.image;let l;if(a){const u=this.attrs.cropWidth,f=this.attrs.cropHeight;u&&f?l=[a,this.cropX(),this.cropY(),u,f,0,0,r,t]:l=[a,0,0,r,t]}(this.hasFill()||this.hasStroke()||n)&&(e.beginPath(),n?Util_1$7.Util.drawRoundedRectPath(e,r,t,n):e.rect(0,0,r,t),e.closePath(),e.fillStrokeShape(this)),a&&(n&&e.clip(),e.drawImage.apply(e,l))}_hitFunc(e){var r=this.width(),t=this.height(),n=this.cornerRadius();e.beginPath(),n?Util_1$7.Util.drawRoundedRectPath(e,r,t,n):e.rect(0,0,r,t),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,r;return(e=this.attrs.width)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.width}getHeight(){var e,r;return(e=this.attrs.height)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.height}static fromURL(e,r,t=null){var n=Util_1$7.Util.createImageElement();n.onload=function(){var a=new wv({image:n});r(a)},n.onerror=t,n.crossOrigin="Anonymous",n.src=e}};Image$4.Image=Image$3;Image$3.prototype.className="Image";(0,Global_1$a._registerNode)(Image$3);Factory_1$p.Factory.addGetterSetter(Image$3,"cornerRadius",0,(0,Validators_1$p.getNumberOrArrayOfNumbersValidator)(4));Factory_1$p.Factory.addGetterSetter(Image$3,"image");Factory_1$p.Factory.addComponentsGetterSetter(Image$3,"crop",["x","y","width","height"]);Factory_1$p.Factory.addGetterSetter(Image$3,"cropX",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropY",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropWidth",0,(0,Validators_1$p.getNumberValidator)());Factory_1$p.Factory.addGetterSetter(Image$3,"cropHeight",0,(0,Validators_1$p.getNumberValidator)());var Label$1={};Object.defineProperty(Label$1,"__esModule",{value:!0});Label$1.Tag=Label$1.Label=void 0;const Factory_1$o=Factory,Shape_1$9=Shape,Group_1$1=Group$2,Validators_1$o=Validators,Global_1$9=Global;var ATTR_CHANGE_LIST$2=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],CHANGE_KONVA$1="Change.konva",NONE$1="none",UP="up",RIGHT$1="right",DOWN="down",LEFT$1="left",attrChangeListLen$1=ATTR_CHANGE_LIST$2.length;class Label extends Group_1$1.Group{constructor(e){super(e),this.on("add.konva",function(r){this._addListeners(r.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var r=this,t,n=function(){r._sync()};for(t=0;t<attrChangeListLen$1;t++)e.on(ATTR_CHANGE_LIST$2[t]+CHANGE_KONVA$1,n)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e=this.getText(),r=this.getTag(),t,n,a,l,u,f,d;if(e&&r){switch(t=e.width(),n=e.height(),a=r.pointerDirection(),l=r.pointerWidth(),d=r.pointerHeight(),u=0,f=0,a){case UP:u=t/2,f=-1*d;break;case RIGHT$1:u=t+l,f=n/2;break;case DOWN:u=t/2,f=n+d;break;case LEFT$1:u=-1*l,f=n/2;break}r.setAttrs({x:-1*u,y:-1*f,width:t,height:n}),e.setAttrs({x:-1*u,y:-1*f})}}}Label$1.Label=Label;Label.prototype.className="Label";(0,Global_1$9._registerNode)(Label);class Tag extends Shape_1$9.Shape{_sceneFunc(e){var r=this.width(),t=this.height(),n=this.pointerDirection(),a=this.pointerWidth(),l=this.pointerHeight(),u=this.cornerRadius();let f=0,d=0,h=0,y=0;typeof u=="number"?f=d=h=y=Math.min(u,r/2,t/2):(f=Math.min(u[0]||0,r/2,t/2),d=Math.min(u[1]||0,r/2,t/2),y=Math.min(u[2]||0,r/2,t/2),h=Math.min(u[3]||0,r/2,t/2)),e.beginPath(),e.moveTo(f,0),n===UP&&(e.lineTo((r-a)/2,0),e.lineTo(r/2,-1*l),e.lineTo((r+a)/2,0)),e.lineTo(r-d,0),e.arc(r-d,d,d,Math.PI*3/2,0,!1),n===RIGHT$1&&(e.lineTo(r,(t-l)/2),e.lineTo(r+a,t/2),e.lineTo(r,(t+l)/2)),e.lineTo(r,t-y),e.arc(r-y,t-y,y,0,Math.PI/2,!1),n===DOWN&&(e.lineTo((r+a)/2,t),e.lineTo(r/2,t+l),e.lineTo((r-a)/2,t)),e.lineTo(h,t),e.arc(h,t-h,h,Math.PI/2,Math.PI,!1),n===LEFT$1&&(e.lineTo(0,(t+l)/2),e.lineTo(-1*a,t/2),e.lineTo(0,(t-l)/2)),e.lineTo(0,f),e.arc(f,f,f,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,r=0,t=this.pointerWidth(),n=this.pointerHeight(),a=this.pointerDirection(),l=this.width(),u=this.height();return a===UP?(r-=n,u+=n):a===DOWN?u+=n:a===LEFT$1?(e-=t*1.5,l+=t):a===RIGHT$1&&(l+=t*1.5),{x:e,y:r,width:l,height:u}}}Label$1.Tag=Tag;Tag.prototype.className="Tag";(0,Global_1$9._registerNode)(Tag);Factory_1$o.Factory.addGetterSetter(Tag,"pointerDirection",NONE$1);Factory_1$o.Factory.addGetterSetter(Tag,"pointerWidth",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"pointerHeight",0,(0,Validators_1$o.getNumberValidator)());Factory_1$o.Factory.addGetterSetter(Tag,"cornerRadius",0,(0,Validators_1$o.getNumberOrArrayOfNumbersValidator)(4));var Rect$2={};Object.defineProperty(Rect$2,"__esModule",{value:!0});Rect$2.Rect=void 0;const Factory_1$n=Factory,Shape_1$8=Shape,Global_1$8=Global,Util_1$6=Util,Validators_1$n=Validators;let Rect$1=class extends Shape_1$8.Shape{_sceneFunc(e){var r=this.cornerRadius(),t=this.width(),n=this.height();e.beginPath(),r?Util_1$6.Util.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}};Rect$2.Rect=Rect$1;Rect$1.prototype.className="Rect";(0,Global_1$8._registerNode)(Rect$1);Factory_1$n.Factory.addGetterSetter(Rect$1,"cornerRadius",0,(0,Validators_1$n.getNumberOrArrayOfNumbersValidator)(4));var RegularPolygon$1={};Object.defineProperty(RegularPolygon$1,"__esModule",{value:!0});RegularPolygon$1.RegularPolygon=void 0;const Factory_1$m=Factory,Shape_1$7=Shape,Validators_1$m=Validators,Global_1$7=Global;class RegularPolygon extends Shape_1$7.Shape{_sceneFunc(e){const r=this._getPoints();e.beginPath(),e.moveTo(r[0].x,r[0].y);for(var t=1;t<r.length;t++)e.lineTo(r[t].x,r[t].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,r=this.attrs.radius||0,t=[];for(var n=0;n<e;n++)t.push({x:r*Math.sin(n*2*Math.PI/e),y:-1*r*Math.cos(n*2*Math.PI/e)});return t}getSelfRect(){const e=this._getPoints();var r=e[0].x,t=e[0].y,n=e[0].x,a=e[0].y;return e.forEach(l=>{r=Math.min(r,l.x),t=Math.max(t,l.x),n=Math.min(n,l.y),a=Math.max(a,l.y)}),{x:r,y:n,width:t-r,height:a-n}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}RegularPolygon$1.RegularPolygon=RegularPolygon;RegularPolygon.prototype.className="RegularPolygon";RegularPolygon.prototype._centroid=!0;RegularPolygon.prototype._attrsAffectingSize=["radius"];(0,Global_1$7._registerNode)(RegularPolygon);Factory_1$m.Factory.addGetterSetter(RegularPolygon,"radius",0,(0,Validators_1$m.getNumberValidator)());Factory_1$m.Factory.addGetterSetter(RegularPolygon,"sides",0,(0,Validators_1$m.getNumberValidator)());var Ring$1={};Object.defineProperty(Ring$1,"__esModule",{value:!0});Ring$1.Ring=void 0;const Factory_1$l=Factory,Shape_1$6=Shape,Validators_1$l=Validators,Global_1$6=Global;var PIx2=Math.PI*2;class Ring extends Shape_1$6.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,PIx2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),PIx2,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ring$1.Ring=Ring;Ring.prototype.className="Ring";Ring.prototype._centroid=!0;Ring.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$6._registerNode)(Ring);Factory_1$l.Factory.addGetterSetter(Ring,"innerRadius",0,(0,Validators_1$l.getNumberValidator)());Factory_1$l.Factory.addGetterSetter(Ring,"outerRadius",0,(0,Validators_1$l.getNumberValidator)());var Sprite$1={};Object.defineProperty(Sprite$1,"__esModule",{value:!0});Sprite$1.Sprite=void 0;const Factory_1$k=Factory,Shape_1$5=Shape,Animation_1=Animation$2,Validators_1$k=Validators,Global_1$5=Global;class Sprite extends Shape_1$5.Shape{constructor(e){super(e),this._updated=!0,this.anim=new Animation_1.Animation(()=>{var r=this._updated;return this._updated=!1,r}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){var r=this.animation(),t=this.frameIndex(),n=t*4,a=this.animations()[r],l=this.frameOffsets(),u=a[n+0],f=a[n+1],d=a[n+2],h=a[n+3],y=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,d,h),e.closePath(),e.fillStrokeShape(this)),y)if(l){var E=l[r],g=t*2;e.drawImage(y,u,f,d,h,E[g+0],E[g+1],d,h)}else e.drawImage(y,u,f,d,h,0,0,d,h)}_hitFunc(e){var r=this.animation(),t=this.frameIndex(),n=t*4,a=this.animations()[r],l=this.frameOffsets(),u=a[n+2],f=a[n+3];if(e.beginPath(),l){var d=l[r],h=t*2;e.rect(d[h+0],d[h+1],u,f)}else e.rect(0,0,u,f);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),r=this.animation(),t=this.animations(),n=t[r],a=n.length/4;e<a-1?this.frameIndex(e+1):this.frameIndex(0)}}Sprite$1.Sprite=Sprite;Sprite.prototype.className="Sprite";(0,Global_1$5._registerNode)(Sprite);Factory_1$k.Factory.addGetterSetter(Sprite,"animation");Factory_1$k.Factory.addGetterSetter(Sprite,"animations");Factory_1$k.Factory.addGetterSetter(Sprite,"frameOffsets");Factory_1$k.Factory.addGetterSetter(Sprite,"image");Factory_1$k.Factory.addGetterSetter(Sprite,"frameIndex",0,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.addGetterSetter(Sprite,"frameRate",17,(0,Validators_1$k.getNumberValidator)());Factory_1$k.Factory.backCompat(Sprite,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Star$1={};Object.defineProperty(Star$1,"__esModule",{value:!0});Star$1.Star=void 0;const Factory_1$j=Factory,Shape_1$4=Shape,Validators_1$j=Validators,Global_1$4=Global;class Star extends Shape_1$4.Shape{_sceneFunc(e){var r=this.innerRadius(),t=this.outerRadius(),n=this.numPoints();e.beginPath(),e.moveTo(0,0-t);for(var a=1;a<n*2;a++){var l=a%2===0?t:r,u=l*Math.sin(a*Math.PI/n),f=-1*l*Math.cos(a*Math.PI/n);e.lineTo(u,f)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Star$1.Star=Star;Star.prototype.className="Star";Star.prototype._centroid=!0;Star.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Global_1$4._registerNode)(Star);Factory_1$j.Factory.addGetterSetter(Star,"numPoints",5,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"innerRadius",0,(0,Validators_1$j.getNumberValidator)());Factory_1$j.Factory.addGetterSetter(Star,"outerRadius",0,(0,Validators_1$j.getNumberValidator)());var Text$2={};Object.defineProperty(Text$2,"__esModule",{value:!0});Text$2.Text=Text$2.stringToArray=void 0;const Util_1$5=Util,Factory_1$i=Factory,Shape_1$3=Shape,Validators_1$i=Validators,Global_1$3=Global;function stringToArray(o){return Array.from(o)}Text$2.stringToArray=stringToArray;var AUTO="auto",CENTER="center",INHERIT="inherit",JUSTIFY="justify",CHANGE_KONVA="Change.konva",CONTEXT_2D="2d",DASH="-",LEFT="left",TEXT="text",TEXT_UPPER="Text",TOP="top",BOTTOM="bottom",MIDDLE="middle",NORMAL$1="normal",PX_SPACE="px ",SPACE=" ",RIGHT="right",RTL="rtl",WORD="word",CHAR="char",NONE="none",ELLIPSIS="…",ATTR_CHANGE_LIST$1=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],attrChangeListLen=ATTR_CHANGE_LIST$1.length;function normalizeFontFamily(o){return o.split(",").map(e=>{e=e.trim();const r=e.indexOf(" ")>=0,t=e.indexOf('"')>=0||e.indexOf("'")>=0;return r&&!t&&(e=`"${e}"`),e}).join(", ")}var dummyContext;function getDummyContext(){return dummyContext||(dummyContext=Util_1$5.Util.createCanvasElement().getContext(CONTEXT_2D),dummyContext)}function _fillFunc$1(o){o.fillText(this._partialText,this._partialTextX,this._partialTextY)}function _strokeFunc$1(o){o.setAttr("miterLimit",2),o.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function checkDefaultFill(o){return o=o||{},!o.fillLinearGradientColorStops&&!o.fillRadialGradientColorStops&&!o.fillPatternImage&&(o.fill=o.fill||"black"),o}let Text$1=class extends Shape_1$3.Shape{constructor(e){super(checkDefaultFill(e)),this._partialTextX=0,this._partialTextY=0;for(var r=0;r<attrChangeListLen;r++)this.on(ATTR_CHANGE_LIST$1[r]+CHANGE_KONVA,this._setTextData);this._setTextData()}_sceneFunc(e){var r=this.textArr,t=r.length;if(this.text()){var n=this.padding(),a=this.fontSize(),l=this.lineHeight()*a,u=this.verticalAlign(),f=this.direction(),d=0,h=this.align(),y=this.getWidth(),E=this.letterSpacing(),g=this.fill(),_=this.textDecoration(),p=_.indexOf("underline")!==-1,x=_.indexOf("line-through")!==-1,C;f=f===INHERIT?e.direction:f;var R=0,R=l/2,S=0,A=0;for(f===RTL&&e.setAttr("direction",f),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",MIDDLE),e.setAttr("textAlign",LEFT),u===MIDDLE?d=(this.getHeight()-t*l-n*2)/2:u===BOTTOM&&(d=this.getHeight()-t*l-n*2),e.translate(n,d+n),C=0;C<t;C++){var S=0,A=0,T=r[C],P=T.text,w=T.width,O=T.lastInParagraph,k,D,F;if(e.save(),h===RIGHT?S+=y-w-n*2:h===CENTER&&(S+=(y-w-n*2)/2),p){e.save(),e.beginPath(),e.moveTo(S,R+A+Math.round(a/2)),k=P.split(" ").length-1,D=k===0,F=h===JUSTIFY&&!O?y-n*2:w,e.lineTo(S+Math.round(F),R+A+Math.round(a/2)),e.lineWidth=a/15;const B=this._getLinearGradient();e.strokeStyle=B||g,e.stroke(),e.restore()}if(x){e.save(),e.beginPath(),e.moveTo(S,R+A),k=P.split(" ").length-1,D=k===0,F=h===JUSTIFY&&O&&!D?y-n*2:w,e.lineTo(S+Math.round(F),R+A),e.lineWidth=a/15;const B=this._getLinearGradient();e.strokeStyle=B||g,e.stroke(),e.restore()}if(f!==RTL&&(E!==0||h===JUSTIFY)){k=P.split(" ").length-1;for(var U=stringToArray(P),H=0;H<U.length;H++){var W=U[H];W===" "&&!O&&h===JUSTIFY&&(S+=(y-n*2-w)/k),this._partialTextX=S,this._partialTextY=R+A,this._partialText=W,e.fillStrokeShape(this),S+=this.measureSize(W).width+E}}else E!==0&&e.setAttr("letterSpacing",`${E}px`),this._partialTextX=S,this._partialTextY=R+A,this._partialText=P,e.fillStrokeShape(this);e.restore(),t>1&&(R+=l)}}}_hitFunc(e){var r=this.getWidth(),t=this.getHeight();e.beginPath(),e.rect(0,0,r,t),e.closePath(),e.fillStrokeShape(this)}setText(e){var r=Util_1$5.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(TEXT,r),this}getWidth(){var e=this.attrs.width===AUTO||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===AUTO||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Util_1$5.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var r=getDummyContext(),t=this.fontSize(),n;return r.save(),r.font=this._getContextFont(),n=r.measureText(e),r.restore(),{width:n.width,height:t}}_getContextFont(){return this.fontStyle()+SPACE+this.fontVariant()+SPACE+(this.fontSize()+PX_SPACE)+normalizeFontFamily(this.fontFamily())}_addTextLine(e){this.align()===JUSTIFY&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var r=this.letterSpacing(),t=e.length;return getDummyContext().measureText(e).width+(t?r*(t-1):0)}_setTextData(){var e=this.text().split(`
|
|
72
72
|
`),r=+this.fontSize(),t=0,n=this.lineHeight()*r,a=this.attrs.width,l=this.attrs.height,u=a!==AUTO&&a!==void 0,f=l!==AUTO&&l!==void 0,d=this.padding(),h=a-d*2,y=l-d*2,E=0,g=this.wrap(),_=g!==NONE,p=g!==CHAR&&_,x=this.ellipsis();this.textArr=[],getDummyContext().font=this._getContextFont();for(var C=x?this._getTextWidth(ELLIPSIS):0,R=0,S=e.length;R<S;++R){var A=e[R],T=this._getTextWidth(A);if(u&&T>h)for(;A.length>0;){for(var P=0,w=A.length,O="",k=0;P<w;){var D=P+w>>>1,F=A.slice(0,D+1),U=this._getTextWidth(F)+C;U<=h?(P=D+1,O=F,k=U):w=D}if(O){if(p){var H,W=A[O.length],ee=W===SPACE||W===DASH;ee&&k<=h?H=O.length:H=Math.max(O.lastIndexOf(SPACE),O.lastIndexOf(DASH))+1,H>0&&(P=H,O=O.slice(0,P),k=this._getTextWidth(O))}O=O.trimRight(),this._addTextLine(O),t=Math.max(t,k),E+=n;var q=this._shouldHandleEllipsis(E);if(q){this._tryToAddEllipsisToLastLine();break}if(A=A.slice(P),A=A.trimLeft(),A.length>0&&(T=this._getTextWidth(A),T<=h)){this._addTextLine(A),E+=n,t=Math.max(t,T);break}}else break}else this._addTextLine(A),E+=n,t=Math.max(t,T),this._shouldHandleEllipsis(E)&&R<S-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),f&&E+n>y)break}this.textHeight=r,this.textWidth=t}_shouldHandleEllipsis(e){var r=+this.fontSize(),t=this.lineHeight()*r,n=this.attrs.height,a=n!==AUTO&&n!==void 0,l=this.padding(),u=n-l*2,f=this.wrap(),d=f!==NONE;return!d||a&&e+t>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,r=e!==AUTO&&e!==void 0,t=this.padding(),n=e-t*2,a=this.ellipsis(),l=this.textArr[this.textArr.length-1];if(!(!l||!a)){if(r){var u=this._getTextWidth(l.text+ELLIPSIS)<n;u||(l.text=l.text.slice(0,l.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(l.text+ELLIPSIS)}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,r=this.hasShadow();return e&&r?!0:super._useBufferCanvas()}};Text$2.Text=Text$1;Text$1.prototype._fillFunc=_fillFunc$1;Text$1.prototype._strokeFunc=_strokeFunc$1;Text$1.prototype.className=TEXT_UPPER;Text$1.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];(0,Global_1$3._registerNode)(Text$1);Factory_1$i.Factory.overWriteSetter(Text$1,"width",(0,Validators_1$i.getNumberOrAutoValidator)());Factory_1$i.Factory.overWriteSetter(Text$1,"height",(0,Validators_1$i.getNumberOrAutoValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"direction",INHERIT);Factory_1$i.Factory.addGetterSetter(Text$1,"fontFamily","Arial");Factory_1$i.Factory.addGetterSetter(Text$1,"fontSize",12,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"fontStyle",NORMAL$1);Factory_1$i.Factory.addGetterSetter(Text$1,"fontVariant",NORMAL$1);Factory_1$i.Factory.addGetterSetter(Text$1,"padding",0,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"align",LEFT);Factory_1$i.Factory.addGetterSetter(Text$1,"verticalAlign",TOP);Factory_1$i.Factory.addGetterSetter(Text$1,"lineHeight",1,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"wrap",WORD);Factory_1$i.Factory.addGetterSetter(Text$1,"ellipsis",!1,(0,Validators_1$i.getBooleanValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"letterSpacing",0,(0,Validators_1$i.getNumberValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"text","",(0,Validators_1$i.getStringValidator)());Factory_1$i.Factory.addGetterSetter(Text$1,"textDecoration","");var TextPath$1={};Object.defineProperty(TextPath$1,"__esModule",{value:!0});TextPath$1.TextPath=void 0;const Util_1$4=Util,Factory_1$h=Factory,Shape_1$2=Shape,Path_1$1=Path$1,Text_1$1=Text$2,Validators_1$h=Validators,Global_1$2=Global;var EMPTY_STRING="",NORMAL="normal";function _fillFunc(o){o.fillText(this.partialText,0,0)}function _strokeFunc(o){o.strokeText(this.partialText,0,0)}class TextPath extends Shape_1$2.Shape{constructor(e){super(e),this.dummyCanvas=Util_1$4.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return Path_1$1.Path.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;const r=this.pathLength;return e-1>r?null:Path_1$1.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Path_1$1.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var r=this.textDecoration(),t=this.fill(),n=this.fontSize(),a=this.glyphInfo;r==="underline"&&e.beginPath();for(var l=0;l<a.length;l++){e.save();var u=a[l].p0;e.translate(u.x,u.y),e.rotate(a[l].rotation),this.partialText=a[l].text,e.fillStrokeShape(this),r==="underline"&&(l===0&&e.moveTo(0,n/2+1),e.lineTo(n,n/2+1)),e.restore()}r==="underline"&&(e.strokeStyle=t,e.lineWidth=n/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();var r=this.glyphInfo;if(r.length>=1){var t=r[0].p0;e.moveTo(t.x,t.y)}for(var n=0;n<r.length;n++){var a=r[n].p1;e.lineTo(a.x,a.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Util_1$4.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Text_1$1.Text.prototype.setText.call(this,e)}_getContextFont(){return Text_1$1.Text.prototype._getContextFont.call(this)}_getTextSize(e){var r=this.dummyCanvas,t=r.getContext("2d");t.save(),t.font=this._getContextFont();var n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:e,height:r}=this._getTextSize(this.attrs.text);if(this.textWidth=e,this.textHeight=r,this.glyphInfo=[],!this.attrs.data)return null;const t=this.letterSpacing(),n=this.align(),a=this.kerningFunc(),l=Math.max(this.textWidth+((this.attrs.text||"").length-1)*t,0);let u=0;n==="center"&&(u=Math.max(0,this.pathLength/2-l/2)),n==="right"&&(u=Math.max(0,this.pathLength-l));const f=(0,Text_1$1.stringToArray)(this.text());let d=u;for(var h=0;h<f.length;h++){const y=this._getPointAtLength(d);if(!y)return;let E=this._getTextSize(f[h]).width+t;if(f[h]===" "&&n==="justify"){const R=this.text().split(" ").length-1;E+=(this.pathLength-l)/R}const g=this._getPointAtLength(d+E);if(!g)return;const _=Path_1$1.Path.getLineLength(y.x,y.y,g.x,g.y);let p=0;if(a)try{p=a(f[h-1],f[h])*this.fontSize()}catch{p=0}y.x+=p,g.x+=p,this.textWidth+=p;const x=Path_1$1.Path.getPointOnLine(p+_/2,y.x,y.y,g.x,g.y),C=Math.atan2(g.y-y.y,g.x-y.x);this.glyphInfo.push({transposeX:x.x,transposeY:x.y,text:f[h],rotation:C,p0:y,p1:g}),d+=E}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var e=[];this.glyphInfo.forEach(function(h){e.push(h.p0.x),e.push(h.p0.y),e.push(h.p1.x),e.push(h.p1.y)});for(var r=e[0]||0,t=e[0]||0,n=e[1]||0,a=e[1]||0,l,u,f=0;f<e.length/2;f++)l=e[f*2],u=e[f*2+1],r=Math.min(r,l),t=Math.max(t,l),n=Math.min(n,u),a=Math.max(a,u);var d=this.fontSize();return{x:r-d/2,y:n-d/2,width:t-r+d,height:a-n+d}}destroy(){return Util_1$4.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}TextPath$1.TextPath=TextPath;TextPath.prototype._fillFunc=_fillFunc;TextPath.prototype._strokeFunc=_strokeFunc;TextPath.prototype._fillFuncHit=_fillFunc;TextPath.prototype._strokeFuncHit=_strokeFunc;TextPath.prototype.className="TextPath";TextPath.prototype._attrsAffectingSize=["text","fontSize","data"];(0,Global_1$2._registerNode)(TextPath);Factory_1$h.Factory.addGetterSetter(TextPath,"data");Factory_1$h.Factory.addGetterSetter(TextPath,"fontFamily","Arial");Factory_1$h.Factory.addGetterSetter(TextPath,"fontSize",12,(0,Validators_1$h.getNumberValidator)());Factory_1$h.Factory.addGetterSetter(TextPath,"fontStyle",NORMAL);Factory_1$h.Factory.addGetterSetter(TextPath,"align","left");Factory_1$h.Factory.addGetterSetter(TextPath,"letterSpacing",0,(0,Validators_1$h.getNumberValidator)());Factory_1$h.Factory.addGetterSetter(TextPath,"textBaseline","middle");Factory_1$h.Factory.addGetterSetter(TextPath,"fontVariant",NORMAL);Factory_1$h.Factory.addGetterSetter(TextPath,"text",EMPTY_STRING);Factory_1$h.Factory.addGetterSetter(TextPath,"textDecoration",null);Factory_1$h.Factory.addGetterSetter(TextPath,"kerningFunc",null);var Transformer$1={};Object.defineProperty(Transformer$1,"__esModule",{value:!0});Transformer$1.Transformer=void 0;const Util_1$3=Util,Factory_1$g=Factory,Node_1$f=Node$1,Shape_1$1=Shape,Rect_1$1=Rect$2,Group_1=Group$2,Global_1$1=Global,Validators_1$g=Validators,Global_2$1=Global;var EVENTS_NAME="tr-konva",ATTR_CHANGE_LIST=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(o=>o+`.${EVENTS_NAME}`).join(" "),NODES_RECT="nodesRect",TRANSFORM_CHANGE_STR=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],ANGLES={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const TOUCH_DEVICE="ontouchstart"in Global_1$1.Konva._global;function getCursor(o,e,r){if(o==="rotater")return r;e+=Util_1$3.Util.degToRad(ANGLES[o]||0);var t=(Util_1$3.Util.radToDeg(e)%360+360)%360;return Util_1$3.Util._inRange(t,315+22.5,360)||Util_1$3.Util._inRange(t,0,22.5)?"ns-resize":Util_1$3.Util._inRange(t,45-22.5,45+22.5)?"nesw-resize":Util_1$3.Util._inRange(t,90-22.5,90+22.5)?"ew-resize":Util_1$3.Util._inRange(t,135-22.5,135+22.5)?"nwse-resize":Util_1$3.Util._inRange(t,180-22.5,180+22.5)?"ns-resize":Util_1$3.Util._inRange(t,225-22.5,225+22.5)?"nesw-resize":Util_1$3.Util._inRange(t,270-22.5,270+22.5)?"ew-resize":Util_1$3.Util._inRange(t,315-22.5,315+22.5)?"nwse-resize":(Util_1$3.Util.error("Transformer has unknown angle for cursor detection: "+t),"pointer")}var ANCHORS_NAMES=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],MAX_SAFE_INTEGER=1e8;function getCenter(o){return{x:o.x+o.width/2*Math.cos(o.rotation)+o.height/2*Math.sin(-o.rotation),y:o.y+o.height/2*Math.cos(o.rotation)+o.width/2*Math.sin(o.rotation)}}function rotateAroundPoint(o,e,r){const t=r.x+(o.x-r.x)*Math.cos(e)-(o.y-r.y)*Math.sin(e),n=r.y+(o.x-r.x)*Math.sin(e)+(o.y-r.y)*Math.cos(e);return{...o,rotation:o.rotation+e,x:t,y:n}}function rotateAroundCenter(o,e){const r=getCenter(o);return rotateAroundPoint(o,e,r)}function getSnap(o,e,r){let t=e;for(let n=0;n<o.length;n++){const a=Global_1$1.Konva.getAngle(o[n]),l=Math.abs(a-e)%(Math.PI*2);Math.min(l,Math.PI*2-l)<r&&(t=a)}return t}class Transformer extends Group_1.Group{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(ATTR_CHANGE_LIST,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Util_1$3.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return EVENTS_NAME+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const r=e.filter(n=>n.isAncestorOf(this)?(Util_1$3.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=e=r,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(n=>{const a=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},l=n._attrsAffectingSize.map(u=>u+"Change."+this._getEventNamespace()).join(" ");n.on(l,a),n.on(TRANSFORM_CHANGE_STR.map(u=>u+`.${this._getEventNamespace()}`).join(" "),a),n.on(`absoluteTransformChange.${this._getEventNamespace()}`,a),this._proxyDrag(n)}),this._resetTransformCache();var t=!!this.findOne(".top-left");return t&&this.update(),this}_proxyDrag(e){let r;e.on(`dragstart.${this._getEventNamespace()}`,t=>{r=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(t,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,t=>{if(!r)return;const n=e.getAbsolutePosition(),a=n.x-r.x,l=n.y-r.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const f=u.getAbsolutePosition();u.setAbsolutePosition({x:f.x+a,y:f.y+l}),u.startDrag(t)}),r=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(NODES_RECT),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(NODES_RECT,this.__getNodeRect)}__getNodeShape(e,r=this.rotation(),t){var n=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(t),l=e.getAbsolutePosition(t),u=n.x*a.x-e.offsetX()*a.x,f=n.y*a.y-e.offsetY()*a.y;const d=(Global_1$1.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:l.x+u*Math.cos(d)+f*Math.sin(-d),y:l.y+f*Math.cos(d)+u*Math.sin(d),width:n.width*a.x,height:n.height*a.y,rotation:d};return rotateAroundPoint(h,-Global_1$1.Konva.getAngle(r),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-MAX_SAFE_INTEGER,y:-MAX_SAFE_INTEGER,width:0,height:0,rotation:0};const r=[];this.nodes().map(d=>{const h=d.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var y=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],E=d.getAbsoluteTransform();y.forEach(function(g){var _=E.point(g);r.push(_)})});const t=new Util_1$3.Transform;t.rotate(-Global_1$1.Konva.getAngle(this.rotation()));var n=1/0,a=1/0,l=-1/0,u=-1/0;r.forEach(function(d){var h=t.point(d);n===void 0&&(n=l=h.x,a=u=h.y),n=Math.min(n,h.x),a=Math.min(a,h.y),l=Math.max(l,h.x),u=Math.max(u,h.y)}),t.invert();const f=t.point({x:n,y:a});return{x:f.x,y:f.y,width:l-n,height:u-a,rotation:Global_1$1.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),ANCHORS_NAMES.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){var r=new Rect_1$1.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:TOUCH_DEVICE?10:"auto"}),t=this;r.on("mousedown touchstart",function(n){t._handleMouseDown(n)}),r.on("dragstart",n=>{r.stopDrag(),n.cancelBubble=!0}),r.on("dragend",n=>{n.cancelBubble=!0}),r.on("mouseenter",()=>{var n=Global_1$1.Konva.getAngle(this.rotation()),a=this.rotateAnchorCursor(),l=getCursor(e,n,a);r.getStage().content&&(r.getStage().content.style.cursor=l),this._cursorChange=!0}),r.on("mouseout",()=>{r.getStage().content&&(r.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(r)}_createBack(){var e=new Shape_1$1.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(r,t){var n=t.getParent(),a=n.padding();r.beginPath(),r.rect(-a,-a,t.width()+a*2,t.height()+a*2),r.moveTo(t.width()/2,-a),n.rotateEnabled()&&n.rotateLineVisible()&&r.lineTo(t.width()/2,-n.rotateAnchorOffset()*Util_1$3.Util._sign(t.height())-a),r.fillStrokeShape(t)},hitFunc:(r,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();r.beginPath(),r.rect(-n,-n,t.width()+n*2,t.height()+n*2),r.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",r=>{r.cancelBubble=!0}),e.on("dragmove",r=>{r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),this.on("dragmove",r=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var r=this._getNodeRect(),t=r.width,n=r.height,a=Math.sqrt(Math.pow(t,2)+Math.pow(n,2));this.sin=Math.abs(n/a),this.cos=Math.abs(t/a),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var l=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-l.x,y:u.y-l.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(f=>{f._fire("transformstart",{evt:e.evt,target:f})})}_handleMouseMove(e){var r,t,n,a=this.findOne("."+this._movingAnchorName),l=a.getStage();l.setPointersPositions(e);const u=l.getPointerPosition();let f={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const d=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(f=this.anchorDragBoundFunc()(d,f,e)),a.setAbsolutePosition(f);const h=a.getAbsolutePosition();if(!(d.x===h.x&&d.y===h.y)){if(this._movingAnchorName==="rotater"){var y=this._getNodeRect();r=a.x()-y.width/2,t=-a.y()+y.height/2;let H=Math.atan2(-t,r)+Math.PI/2;y.height<0&&(H-=Math.PI);var E=Global_1$1.Konva.getAngle(this.rotation());const W=E+H,ee=Global_1$1.Konva.getAngle(this.rotationSnapTolerance()),B=getSnap(this.rotationSnaps(),W,ee)-y.rotation,G=rotateAroundCenter(y,B);this._fitNodesInto(G,e);return}var g=this.shiftBehavior(),_;g==="inverted"?_=this.keepRatio()&&!e.shiftKey:g==="none"?_=this.keepRatio():_=this.keepRatio()||e.shiftKey;var S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(_){var p=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};n=Math.sqrt(Math.pow(p.x-a.x(),2)+Math.pow(p.y-a.y(),2));var x=this.findOne(".top-left").x()>p.x?-1:1,C=this.findOne(".top-left").y()>p.y?-1:1;r=n*this.cos*x,t=n*this.sin*C,this.findOne(".top-left").x(p.x-r),this.findOne(".top-left").y(p.y-t)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(_){var p=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};n=Math.sqrt(Math.pow(a.x()-p.x,2)+Math.pow(p.y-a.y(),2));var x=this.findOne(".top-right").x()<p.x?-1:1,C=this.findOne(".top-right").y()>p.y?-1:1;r=n*this.cos*x,t=n*this.sin*C,this.findOne(".top-right").x(p.x+r),this.findOne(".top-right").y(p.y-t)}var R=a.position();this.findOne(".top-left").y(R.y),this.findOne(".bottom-right").x(R.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(_){var p=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};n=Math.sqrt(Math.pow(p.x-a.x(),2)+Math.pow(a.y()-p.y,2));var x=p.x<a.x()?-1:1,C=a.y()<p.y?-1:1;r=n*this.cos*x,t=n*this.sin*C,a.x(p.x-r),a.y(p.y+t)}R=a.position(),this.findOne(".top-left").x(R.x),this.findOne(".bottom-right").y(R.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(a.y());else if(this._movingAnchorName==="bottom-right"){if(_){var p=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};n=Math.sqrt(Math.pow(a.x()-p.x,2)+Math.pow(a.y()-p.y,2));var x=this.findOne(".bottom-right").x()<p.x?-1:1,C=this.findOne(".bottom-right").y()<p.y?-1:1;r=n*this.cos*x,t=n*this.sin*C,this.findOne(".bottom-right").x(p.x+r),this.findOne(".bottom-right").y(p.y+t)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var S=this.centeredScaling()||e.altKey;if(S){var A=this.findOne(".top-left"),T=this.findOne(".bottom-right"),P=A.x(),w=A.y(),O=this.getWidth()-T.x(),k=this.getHeight()-T.y();T.move({x:-P,y:-w}),A.move({x:O,y:k})}var D=this.findOne(".top-left").getAbsolutePosition();r=D.x,t=D.y;var F=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),U=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:r,y:t,width:F,height:U,rotation:Global_1$1.Konva.getAngle(this.rotation())},e)}}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var r=this.getNode();this._fire("transformend",{evt:e,target:r}),r&&this._nodes.forEach(t=>{t._fire("transformend",{evt:e,target:t})}),this._movingAnchorName=null}}_fitNodesInto(e,r){var t=this._getNodeRect();const n=1;if(Util_1$3.Util._inRange(e.width,-this.padding()*2-n,n)){this.update();return}if(Util_1$3.Util._inRange(e.height,-this.padding()*2-n,n)){this.update();return}var a=new Util_1$3.Transform;if(a.rotate(Global_1$1.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const E=a.point({x:-this.padding()*2,y:0});e.x+=E.x,e.y+=E.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=E.x,this._anchorDragOffset.y-=E.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const E=a.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=E.x,this._anchorDragOffset.y-=E.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const E=a.point({x:0,y:-this.padding()*2});e.x+=E.x,e.y+=E.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=E.x,this._anchorDragOffset.y-=E.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const E=a.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=E.x,this._anchorDragOffset.y-=E.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const E=this.boundBoxFunc()(t,e);E?e=E:Util_1$3.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const l=1e7,u=new Util_1$3.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/l,t.height/l);const f=new Util_1$3.Transform,d=e.width/l,h=e.height/l;this.flipEnabled()===!1?(f.translate(e.x,e.y),f.rotate(e.rotation),f.translate(e.width<0?e.width:0,e.height<0?e.height:0),f.scale(Math.abs(d),Math.abs(h))):(f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(d,h));const y=f.multiply(u.invert());this._nodes.forEach(E=>{var g;const _=E.getParent().getAbsoluteTransform(),p=E.getTransform().copy();p.translate(E.offsetX(),E.offsetY());const x=new Util_1$3.Transform;x.multiply(_.copy().invert()).multiply(y).multiply(_).multiply(p);const C=x.decompose();E.setAttrs(C),this._fire("transform",{evt:r,target:E}),E._fire("transform",{evt:r,target:E}),(g=E.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(Util_1$3.Util._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,r){this.findOne(e).setAttrs(r)}update(){var e,r=this._getNodeRect();this.rotation(Util_1$3.Util._getRotation(r.rotation));var t=r.width,n=r.height,a=this.enabledAnchors(),l=this.resizeEnabled(),u=this.padding(),f=this.anchorSize();const d=this.find("._anchor");d.forEach(y=>{y.setAttrs({width:f,height:f,offsetX:f/2,offsetY:f/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:f/2+u,offsetY:f/2+u,visible:l&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:t/2,y:0,offsetY:f/2+u,visible:l&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:t,y:0,offsetX:f/2-u,offsetY:f/2+u,visible:l&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:n/2,offsetX:f/2+u,visible:l&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:t,y:n/2,offsetX:f/2-u,visible:l&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:n,offsetX:f/2+u,offsetY:f/2-u,visible:l&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:t/2,y:n,offsetY:f/2-u,visible:l&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:t,y:n,offsetX:f/2-u,offsetY:f/2-u,visible:l&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:t/2,y:-this.rotateAnchorOffset()*Util_1$3.Util._sign(n)-u,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:t,height:n,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const h=this.anchorStyleFunc();h&&d.forEach(y=>{h(y)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Group_1.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Node_1$f.Node.prototype.toObject.call(this)}clone(e){var r=Node_1$f.Node.prototype.clone.call(this,e);return r}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Transformer$1.Transformer=Transformer;function validateAnchors(o){return o instanceof Array||Util_1$3.Util.warn("enabledAnchors value should be an array"),o instanceof Array&&o.forEach(function(e){ANCHORS_NAMES.indexOf(e)===-1&&Util_1$3.Util.warn("Unknown anchor name: "+e+". Available names are: "+ANCHORS_NAMES.join(", "))}),o||[]}Transformer.prototype.className="Transformer";(0,Global_2$1._registerNode)(Transformer);Factory_1$g.Factory.addGetterSetter(Transformer,"enabledAnchors",ANCHORS_NAMES,validateAnchors);Factory_1$g.Factory.addGetterSetter(Transformer,"flipEnabled",!0,(0,Validators_1$g.getBooleanValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"resizeEnabled",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"anchorSize",10,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"rotateEnabled",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"rotateLineVisible",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"rotationSnaps",[]);Factory_1$g.Factory.addGetterSetter(Transformer,"rotateAnchorOffset",50,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"rotateAnchorCursor","crosshair");Factory_1$g.Factory.addGetterSetter(Transformer,"rotationSnapTolerance",5,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"borderEnabled",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"anchorStroke","rgb(0, 161, 255)");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorStrokeWidth",1,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"anchorFill","white");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorCornerRadius",0,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"borderStroke","rgb(0, 161, 255)");Factory_1$g.Factory.addGetterSetter(Transformer,"borderStrokeWidth",1,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"borderDash");Factory_1$g.Factory.addGetterSetter(Transformer,"keepRatio",!0);Factory_1$g.Factory.addGetterSetter(Transformer,"shiftBehavior","default");Factory_1$g.Factory.addGetterSetter(Transformer,"centeredScaling",!1);Factory_1$g.Factory.addGetterSetter(Transformer,"ignoreStroke",!1);Factory_1$g.Factory.addGetterSetter(Transformer,"padding",0,(0,Validators_1$g.getNumberValidator)());Factory_1$g.Factory.addGetterSetter(Transformer,"node");Factory_1$g.Factory.addGetterSetter(Transformer,"nodes");Factory_1$g.Factory.addGetterSetter(Transformer,"boundBoxFunc");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorDragBoundFunc");Factory_1$g.Factory.addGetterSetter(Transformer,"anchorStyleFunc");Factory_1$g.Factory.addGetterSetter(Transformer,"shouldOverdrawWholeArea",!1);Factory_1$g.Factory.addGetterSetter(Transformer,"useSingleNodeRotation",!0);Factory_1$g.Factory.backCompat(Transformer,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Wedge$1={};Object.defineProperty(Wedge$1,"__esModule",{value:!0});Wedge$1.Wedge=void 0;const Factory_1$f=Factory,Shape_1=Shape,Global_1=Global,Validators_1$f=Validators,Global_2=Global;class Wedge extends Shape_1.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Global_1.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Wedge$1.Wedge=Wedge;Wedge.prototype.className="Wedge";Wedge.prototype._centroid=!0;Wedge.prototype._attrsAffectingSize=["radius"];(0,Global_2._registerNode)(Wedge);Factory_1$f.Factory.addGetterSetter(Wedge,"radius",0,(0,Validators_1$f.getNumberValidator)());Factory_1$f.Factory.addGetterSetter(Wedge,"angle",0,(0,Validators_1$f.getNumberValidator)());Factory_1$f.Factory.addGetterSetter(Wedge,"clockwise",!1);Factory_1$f.Factory.backCompat(Wedge,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var Blur$1={};Object.defineProperty(Blur$1,"__esModule",{value:!0});Blur$1.Blur=void 0;const Factory_1$e=Factory,Node_1$e=Node$1,Validators_1$e=Validators;function BlurStack(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var mul_table=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],shg_table=[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 filterGaussBlurRGBA(o,e){var r=o.data,t=o.width,n=o.height,a,l,u,f,d,h,y,E,g,_,p,x,C,R,S,A,T,P,w,O,k,D,F,U,H=e+e+1,W=t-1,ee=n-1,q=e+1,B=q*(q+1)/2,G=new BlurStack,I=null,$=G,V=null,X=null,Q=mul_table[e],J=shg_table[e];for(u=1;u<H;u++)$=$.next=new BlurStack,u===q&&(I=$);for($.next=G,y=h=0,l=0;l<n;l++){for(A=T=P=w=E=g=_=p=0,x=q*(O=r[h]),C=q*(k=r[h+1]),R=q*(D=r[h+2]),S=q*(F=r[h+3]),E+=B*O,g+=B*k,_+=B*D,p+=B*F,$=G,u=0;u<q;u++)$.r=O,$.g=k,$.b=D,$.a=F,$=$.next;for(u=1;u<q;u++)f=h+((W<u?W:u)<<2),E+=($.r=O=r[f])*(U=q-u),g+=($.g=k=r[f+1])*U,_+=($.b=D=r[f+2])*U,p+=($.a=F=r[f+3])*U,A+=O,T+=k,P+=D,w+=F,$=$.next;for(V=G,X=I,a=0;a<t;a++)r[h+3]=F=p*Q>>J,F!==0?(F=255/F,r[h]=(E*Q>>J)*F,r[h+1]=(g*Q>>J)*F,r[h+2]=(_*Q>>J)*F):r[h]=r[h+1]=r[h+2]=0,E-=x,g-=C,_-=R,p-=S,x-=V.r,C-=V.g,R-=V.b,S-=V.a,f=y+((f=a+e+1)<W?f:W)<<2,A+=V.r=r[f],T+=V.g=r[f+1],P+=V.b=r[f+2],w+=V.a=r[f+3],E+=A,g+=T,_+=P,p+=w,V=V.next,x+=O=X.r,C+=k=X.g,R+=D=X.b,S+=F=X.a,A-=O,T-=k,P-=D,w-=F,X=X.next,h+=4;y+=t}for(a=0;a<t;a++){for(T=P=w=A=g=_=p=E=0,h=a<<2,x=q*(O=r[h]),C=q*(k=r[h+1]),R=q*(D=r[h+2]),S=q*(F=r[h+3]),E+=B*O,g+=B*k,_+=B*D,p+=B*F,$=G,u=0;u<q;u++)$.r=O,$.g=k,$.b=D,$.a=F,$=$.next;for(d=t,u=1;u<=e;u++)h=d+a<<2,E+=($.r=O=r[h])*(U=q-u),g+=($.g=k=r[h+1])*U,_+=($.b=D=r[h+2])*U,p+=($.a=F=r[h+3])*U,A+=O,T+=k,P+=D,w+=F,$=$.next,u<ee&&(d+=t);for(h=a,V=G,X=I,l=0;l<n;l++)f=h<<2,r[f+3]=F=p*Q>>J,F>0?(F=255/F,r[f]=(E*Q>>J)*F,r[f+1]=(g*Q>>J)*F,r[f+2]=(_*Q>>J)*F):r[f]=r[f+1]=r[f+2]=0,E-=x,g-=C,_-=R,p-=S,x-=V.r,C-=V.g,R-=V.b,S-=V.a,f=a+((f=l+q)<ee?f:ee)*t<<2,E+=A+=V.r=r[f],g+=T+=V.g=r[f+1],_+=P+=V.b=r[f+2],p+=w+=V.a=r[f+3],V=V.next,x+=O=X.r,C+=k=X.g,R+=D=X.b,S+=F=X.a,A-=O,T-=k,P-=D,w-=F,X=X.next,h+=t}}const Blur=function o(e){var r=Math.round(this.blurRadius());r>0&&filterGaussBlurRGBA(e,r)};Blur$1.Blur=Blur;Factory_1$e.Factory.addGetterSetter(Node_1$e.Node,"blurRadius",0,(0,Validators_1$e.getNumberValidator)(),Factory_1$e.Factory.afterSetFilter);var Brighten$1={};Object.defineProperty(Brighten$1,"__esModule",{value:!0});Brighten$1.Brighten=void 0;const Factory_1$d=Factory,Node_1$d=Node$1,Validators_1$d=Validators,Brighten=function(o){var e=this.brightness()*255,r=o.data,t=r.length,n;for(n=0;n<t;n+=4)r[n]+=e,r[n+1]+=e,r[n+2]+=e};Brighten$1.Brighten=Brighten;Factory_1$d.Factory.addGetterSetter(Node_1$d.Node,"brightness",0,(0,Validators_1$d.getNumberValidator)(),Factory_1$d.Factory.afterSetFilter);var Contrast$1={};Object.defineProperty(Contrast$1,"__esModule",{value:!0});Contrast$1.Contrast=void 0;const Factory_1$c=Factory,Node_1$c=Node$1,Validators_1$c=Validators,Contrast=function(o){var e=Math.pow((this.contrast()+100)/100,2),r=o.data,t=r.length,n=150,a=150,l=150,u;for(u=0;u<t;u+=4)n=r[u],a=r[u+1],l=r[u+2],n/=255,n-=.5,n*=e,n+=.5,n*=255,a/=255,a-=.5,a*=e,a+=.5,a*=255,l/=255,l-=.5,l*=e,l+=.5,l*=255,n=n<0?0:n>255?255:n,a=a<0?0:a>255?255:a,l=l<0?0:l>255?255:l,r[u]=n,r[u+1]=a,r[u+2]=l};Contrast$1.Contrast=Contrast;Factory_1$c.Factory.addGetterSetter(Node_1$c.Node,"contrast",0,(0,Validators_1$c.getNumberValidator)(),Factory_1$c.Factory.afterSetFilter);var Emboss$1={};Object.defineProperty(Emboss$1,"__esModule",{value:!0});Emboss$1.Emboss=void 0;const Factory_1$b=Factory,Node_1$b=Node$1,Util_1$2=Util,Validators_1$b=Validators,Emboss=function(o){var e=this.embossStrength()*10,r=this.embossWhiteLevel()*255,t=this.embossDirection(),n=this.embossBlend(),a=0,l=0,u=o.data,f=o.width,d=o.height,h=f*4,y=d;switch(t){case"top-left":a=-1,l=-1;break;case"top":a=-1,l=0;break;case"top-right":a=-1,l=1;break;case"right":a=0,l=1;break;case"bottom-right":a=1,l=1;break;case"bottom":a=1,l=0;break;case"bottom-left":a=1,l=-1;break;case"left":a=0,l=-1;break;default:Util_1$2.Util.error("Unknown emboss direction: "+t)}do{var E=(y-1)*h,g=a;y+g<1&&(g=0),y+g>d&&(g=0);var _=(y-1+g)*f*4,p=f;do{var x=E+(p-1)*4,C=l;p+C<1&&(C=0),p+C>f&&(C=0);var R=_+(p-1+C)*4,S=u[x]-u[R],A=u[x+1]-u[R+1],T=u[x+2]-u[R+2],P=S,w=P>0?P:-P,O=A>0?A:-A,k=T>0?T:-T;if(O>w&&(P=A),k>w&&(P=T),P*=e,n){var D=u[x]+P,F=u[x+1]+P,U=u[x+2]+P;u[x]=D>255?255:D<0?0:D,u[x+1]=F>255?255:F<0?0:F,u[x+2]=U>255?255:U<0?0:U}else{var H=r-P;H<0?H=0:H>255&&(H=255),u[x]=u[x+1]=u[x+2]=H}}while(--p)}while(--y)};Emboss$1.Emboss=Emboss;Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossStrength",.5,(0,Validators_1$b.getNumberValidator)(),Factory_1$b.Factory.afterSetFilter);Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossWhiteLevel",.5,(0,Validators_1$b.getNumberValidator)(),Factory_1$b.Factory.afterSetFilter);Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossDirection","top-left",null,Factory_1$b.Factory.afterSetFilter);Factory_1$b.Factory.addGetterSetter(Node_1$b.Node,"embossBlend",!1,null,Factory_1$b.Factory.afterSetFilter);var Enhance$1={};Object.defineProperty(Enhance$1,"__esModule",{value:!0});Enhance$1.Enhance=void 0;const Factory_1$a=Factory,Node_1$a=Node$1,Validators_1$a=Validators;function remap(o,e,r,t,n){var a=r-e,l=n-t,u;return a===0?t+l/2:l===0?t:(u=(o-e)/a,u=l*u+t,u)}const Enhance=function(o){var e=o.data,r=e.length,t=e[0],n=t,a,l=e[1],u=l,f,d=e[2],h=d,y,E,g=this.enhance();if(g!==0){for(E=0;E<r;E+=4)a=e[E+0],a<t?t=a:a>n&&(n=a),f=e[E+1],f<l?l=f:f>u&&(u=f),y=e[E+2],y<d?d=y:y>h&&(h=y);n===t&&(n=255,t=0),u===l&&(u=255,l=0),h===d&&(h=255,d=0);var _,p,x,C,R,S,A,T,P;for(g>0?(p=n+g*(255-n),x=t-g*(t-0),R=u+g*(255-u),S=l-g*(l-0),T=h+g*(255-h),P=d-g*(d-0)):(_=(n+t)*.5,p=n+g*(n-_),x=t+g*(t-_),C=(u+l)*.5,R=u+g*(u-C),S=l+g*(l-C),A=(h+d)*.5,T=h+g*(h-A),P=d+g*(d-A)),E=0;E<r;E+=4)e[E+0]=remap(e[E+0],t,n,x,p),e[E+1]=remap(e[E+1],l,u,S,R),e[E+2]=remap(e[E+2],d,h,P,T)}};Enhance$1.Enhance=Enhance;Factory_1$a.Factory.addGetterSetter(Node_1$a.Node,"enhance",0,(0,Validators_1$a.getNumberValidator)(),Factory_1$a.Factory.afterSetFilter);var Grayscale$1={};Object.defineProperty(Grayscale$1,"__esModule",{value:!0});Grayscale$1.Grayscale=void 0;const Grayscale=function(o){var e=o.data,r=e.length,t,n;for(t=0;t<r;t+=4)n=.34*e[t]+.5*e[t+1]+.16*e[t+2],e[t]=n,e[t+1]=n,e[t+2]=n};Grayscale$1.Grayscale=Grayscale;var HSL$1={};Object.defineProperty(HSL$1,"__esModule",{value:!0});HSL$1.HSL=void 0;const Factory_1$9=Factory,Node_1$9=Node$1,Validators_1$9=Validators;Factory_1$9.Factory.addGetterSetter(Node_1$9.Node,"hue",0,(0,Validators_1$9.getNumberValidator)(),Factory_1$9.Factory.afterSetFilter);Factory_1$9.Factory.addGetterSetter(Node_1$9.Node,"saturation",0,(0,Validators_1$9.getNumberValidator)(),Factory_1$9.Factory.afterSetFilter);Factory_1$9.Factory.addGetterSetter(Node_1$9.Node,"luminance",0,(0,Validators_1$9.getNumberValidator)(),Factory_1$9.Factory.afterSetFilter);const HSL=function(o){var e=o.data,r=e.length,t=1,n=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,l=this.luminance()*127,u,f=t*n*Math.cos(a*Math.PI/180),d=t*n*Math.sin(a*Math.PI/180),h=.299*t+.701*f+.167*d,y=.587*t-.587*f+.33*d,E=.114*t-.114*f-.497*d,g=.299*t-.299*f-.328*d,_=.587*t+.413*f+.035*d,p=.114*t-.114*f+.293*d,x=.299*t-.3*f+1.25*d,C=.587*t-.586*f-1.05*d,R=.114*t+.886*f-.2*d,S,A,T,P;for(u=0;u<r;u+=4)S=e[u+0],A=e[u+1],T=e[u+2],P=e[u+3],e[u+0]=h*S+y*A+E*T+l,e[u+1]=g*S+_*A+p*T+l,e[u+2]=x*S+C*A+R*T+l,e[u+3]=P};HSL$1.HSL=HSL;var HSV$1={};Object.defineProperty(HSV$1,"__esModule",{value:!0});HSV$1.HSV=void 0;const Factory_1$8=Factory,Node_1$8=Node$1,Validators_1$8=Validators,HSV=function(o){var e=o.data,r=e.length,t=Math.pow(2,this.value()),n=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,l,u=t*n*Math.cos(a*Math.PI/180),f=t*n*Math.sin(a*Math.PI/180),d=.299*t+.701*u+.167*f,h=.587*t-.587*u+.33*f,y=.114*t-.114*u-.497*f,E=.299*t-.299*u-.328*f,g=.587*t+.413*u+.035*f,_=.114*t-.114*u+.293*f,p=.299*t-.3*u+1.25*f,x=.587*t-.586*u-1.05*f,C=.114*t+.886*u-.2*f,R,S,A,T;for(l=0;l<r;l+=4)R=e[l+0],S=e[l+1],A=e[l+2],T=e[l+3],e[l+0]=d*R+h*S+y*A,e[l+1]=E*R+g*S+_*A,e[l+2]=p*R+x*S+C*A,e[l+3]=T};HSV$1.HSV=HSV;Factory_1$8.Factory.addGetterSetter(Node_1$8.Node,"hue",0,(0,Validators_1$8.getNumberValidator)(),Factory_1$8.Factory.afterSetFilter);Factory_1$8.Factory.addGetterSetter(Node_1$8.Node,"saturation",0,(0,Validators_1$8.getNumberValidator)(),Factory_1$8.Factory.afterSetFilter);Factory_1$8.Factory.addGetterSetter(Node_1$8.Node,"value",0,(0,Validators_1$8.getNumberValidator)(),Factory_1$8.Factory.afterSetFilter);var Invert$1={};Object.defineProperty(Invert$1,"__esModule",{value:!0});Invert$1.Invert=void 0;const Invert=function(o){var e=o.data,r=e.length,t;for(t=0;t<r;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]};Invert$1.Invert=Invert;var Kaleidoscope$1={};Object.defineProperty(Kaleidoscope$1,"__esModule",{value:!0});Kaleidoscope$1.Kaleidoscope=void 0;const Factory_1$7=Factory,Node_1$7=Node$1,Util_1$1=Util,Validators_1$7=Validators;var ToPolar=function(o,e,r){var t=o.data,n=e.data,a=o.width,l=o.height,u=r.polarCenterX||a/2,f=r.polarCenterY||l/2,d,h,y,E=0,g=0,_=0,p=0,x,C=Math.sqrt(u*u+f*f);h=a-u,y=l-f,x=Math.sqrt(h*h+y*y),C=x>C?x:C;var R=l,S=a,A,T,P=360/S*Math.PI/180,w,O;for(T=0;T<S;T+=1)for(w=Math.sin(T*P),O=Math.cos(T*P),A=0;A<R;A+=1)h=Math.floor(u+C*A/R*O),y=Math.floor(f+C*A/R*w),d=(y*a+h)*4,E=t[d+0],g=t[d+1],_=t[d+2],p=t[d+3],d=(T+A*a)*4,n[d+0]=E,n[d+1]=g,n[d+2]=_,n[d+3]=p},FromPolar=function(o,e,r){var t=o.data,n=e.data,a=o.width,l=o.height,u=r.polarCenterX||a/2,f=r.polarCenterY||l/2,d,h,y,E,g,_=0,p=0,x=0,C=0,R,S=Math.sqrt(u*u+f*f);h=a-u,y=l-f,R=Math.sqrt(h*h+y*y),S=R>S?R:S;var A=l,T=a,P,w,O=r.polarRotation||0,k,D;for(h=0;h<a;h+=1)for(y=0;y<l;y+=1)E=h-u,g=y-f,P=Math.sqrt(E*E+g*g)*A/S,w=(Math.atan2(g,E)*180/Math.PI+360+O)%360,w=w*T/360,k=Math.floor(w),D=Math.floor(P),d=(D*a+k)*4,_=t[d+0],p=t[d+1],x=t[d+2],C=t[d+3],d=(y*a+h)*4,n[d+0]=_,n[d+1]=p,n[d+2]=x,n[d+3]=C};const Kaleidoscope=function(o){var e=o.width,r=o.height,t,n,a,l,u,f,d,h,y,E,g=Math.round(this.kaleidoscopePower()),_=Math.round(this.kaleidoscopeAngle()),p=Math.floor(e*(_%360)/360);if(!(g<1)){var x=Util_1$1.Util.createCanvasElement();x.width=e,x.height=r;var C=x.getContext("2d").getImageData(0,0,e,r);Util_1$1.Util.releaseCanvas(x),ToPolar(o,C,{polarCenterX:e/2,polarCenterY:r/2});for(var R=e/Math.pow(2,g);R<=8;)R=R*2,g-=1;R=Math.ceil(R);var S=R,A=0,T=S,P=1;for(p+R>e&&(A=S,T=0,P=-1),n=0;n<r;n+=1)for(t=A;t!==T;t+=P)a=Math.round(t+p)%e,y=(e*n+a)*4,u=C.data[y+0],f=C.data[y+1],d=C.data[y+2],h=C.data[y+3],E=(e*n+t)*4,C.data[E+0]=u,C.data[E+1]=f,C.data[E+2]=d,C.data[E+3]=h;for(n=0;n<r;n+=1)for(S=Math.floor(R),l=0;l<g;l+=1){for(t=0;t<S+1;t+=1)y=(e*n+t)*4,u=C.data[y+0],f=C.data[y+1],d=C.data[y+2],h=C.data[y+3],E=(e*n+S*2-t-1)*4,C.data[E+0]=u,C.data[E+1]=f,C.data[E+2]=d,C.data[E+3]=h;S*=2}FromPolar(C,o,{polarRotation:0})}};Kaleidoscope$1.Kaleidoscope=Kaleidoscope;Factory_1$7.Factory.addGetterSetter(Node_1$7.Node,"kaleidoscopePower",2,(0,Validators_1$7.getNumberValidator)(),Factory_1$7.Factory.afterSetFilter);Factory_1$7.Factory.addGetterSetter(Node_1$7.Node,"kaleidoscopeAngle",0,(0,Validators_1$7.getNumberValidator)(),Factory_1$7.Factory.afterSetFilter);var Mask$1={};Object.defineProperty(Mask$1,"__esModule",{value:!0});Mask$1.Mask=void 0;const Factory_1$6=Factory,Node_1$6=Node$1,Validators_1$6=Validators;function pixelAt(o,e,r){var t=(r*o.width+e)*4,n=[];return n.push(o.data[t++],o.data[t++],o.data[t++],o.data[t++]),n}function rgbDistance(o,e){return Math.sqrt(Math.pow(o[0]-e[0],2)+Math.pow(o[1]-e[1],2)+Math.pow(o[2]-e[2],2))}function rgbMean(o){for(var e=[0,0,0],r=0;r<o.length;r++)e[0]+=o[r][0],e[1]+=o[r][1],e[2]+=o[r][2];return e[0]/=o.length,e[1]/=o.length,e[2]/=o.length,e}function backgroundMask(o,e){var r=pixelAt(o,0,0),t=pixelAt(o,o.width-1,0),n=pixelAt(o,0,o.height-1),a=pixelAt(o,o.width-1,o.height-1),l=e||10;if(rgbDistance(r,t)<l&&rgbDistance(t,a)<l&&rgbDistance(a,n)<l&&rgbDistance(n,r)<l){for(var u=rgbMean([t,r,a,n]),f=[],d=0;d<o.width*o.height;d++){var h=rgbDistance(u,[o.data[d*4],o.data[d*4+1],o.data[d*4+2]]);f[d]=h<l?0:255}return f}}function applyMask(o,e){for(var r=0;r<o.width*o.height;r++)o.data[4*r+3]=e[r]}function erodeMask(o,e,r){for(var t=[1,1,1,1,0,1,1,1,1],n=Math.round(Math.sqrt(t.length)),a=Math.floor(n/2),l=[],u=0;u<r;u++)for(var f=0;f<e;f++){for(var d=u*e+f,h=0,y=0;y<n;y++)for(var E=0;E<n;E++){var g=u+y-a,_=f+E-a;if(g>=0&&g<r&&_>=0&&_<e){var p=g*e+_,x=t[y*n+E];h+=o[p]*x}}l[d]=h===255*8?255:0}return l}function dilateMask(o,e,r){for(var t=[1,1,1,1,1,1,1,1,1],n=Math.round(Math.sqrt(t.length)),a=Math.floor(n/2),l=[],u=0;u<r;u++)for(var f=0;f<e;f++){for(var d=u*e+f,h=0,y=0;y<n;y++)for(var E=0;E<n;E++){var g=u+y-a,_=f+E-a;if(g>=0&&g<r&&_>=0&&_<e){var p=g*e+_,x=t[y*n+E];h+=o[p]*x}}l[d]=h>=255*4?255:0}return l}function smoothEdgeMask(o,e,r){for(var t=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],n=Math.round(Math.sqrt(t.length)),a=Math.floor(n/2),l=[],u=0;u<r;u++)for(var f=0;f<e;f++){for(var d=u*e+f,h=0,y=0;y<n;y++)for(var E=0;E<n;E++){var g=u+y-a,_=f+E-a;if(g>=0&&g<r&&_>=0&&_<e){var p=g*e+_,x=t[y*n+E];h+=o[p]*x}}l[d]=h}return l}const Mask=function(o){var e=this.threshold(),r=backgroundMask(o,e);return r&&(r=erodeMask(r,o.width,o.height),r=dilateMask(r,o.width,o.height),r=smoothEdgeMask(r,o.width,o.height),applyMask(o,r)),o};Mask$1.Mask=Mask;Factory_1$6.Factory.addGetterSetter(Node_1$6.Node,"threshold",0,(0,Validators_1$6.getNumberValidator)(),Factory_1$6.Factory.afterSetFilter);var Noise$1={};Object.defineProperty(Noise$1,"__esModule",{value:!0});Noise$1.Noise=void 0;const Factory_1$5=Factory,Node_1$5=Node$1,Validators_1$5=Validators,Noise=function(o){var e=this.noise()*255,r=o.data,t=r.length,n=e/2,a;for(a=0;a<t;a+=4)r[a+0]+=n-2*n*Math.random(),r[a+1]+=n-2*n*Math.random(),r[a+2]+=n-2*n*Math.random()};Noise$1.Noise=Noise;Factory_1$5.Factory.addGetterSetter(Node_1$5.Node,"noise",.2,(0,Validators_1$5.getNumberValidator)(),Factory_1$5.Factory.afterSetFilter);var Pixelate$1={};Object.defineProperty(Pixelate$1,"__esModule",{value:!0});Pixelate$1.Pixelate=void 0;const Factory_1$4=Factory,Util_1=Util,Node_1$4=Node$1,Validators_1$4=Validators,Pixelate=function(o){var e=Math.ceil(this.pixelSize()),r=o.width,t=o.height,n,a,l,u,f,d,h,y=Math.ceil(r/e),E=Math.ceil(t/e),g,_,p,x,C,R,S,A=o.data;if(e<=0){Util_1.Util.error("pixelSize value can not be <= 0");return}for(C=0;C<y;C+=1)for(R=0;R<E;R+=1){for(u=0,f=0,d=0,h=0,g=C*e,_=g+e,p=R*e,x=p+e,S=0,n=g;n<_;n+=1)if(!(n>=r))for(a=p;a<x;a+=1)a>=t||(l=(r*a+n)*4,u+=A[l+0],f+=A[l+1],d+=A[l+2],h+=A[l+3],S+=1);for(u=u/S,f=f/S,d=d/S,h=h/S,n=g;n<_;n+=1)if(!(n>=r))for(a=p;a<x;a+=1)a>=t||(l=(r*a+n)*4,A[l+0]=u,A[l+1]=f,A[l+2]=d,A[l+3]=h)}};Pixelate$1.Pixelate=Pixelate;Factory_1$4.Factory.addGetterSetter(Node_1$4.Node,"pixelSize",8,(0,Validators_1$4.getNumberValidator)(),Factory_1$4.Factory.afterSetFilter);var Posterize$1={};Object.defineProperty(Posterize$1,"__esModule",{value:!0});Posterize$1.Posterize=void 0;const Factory_1$3=Factory,Node_1$3=Node$1,Validators_1$3=Validators,Posterize=function(o){var e=Math.round(this.levels()*254)+1,r=o.data,t=r.length,n=255/e,a;for(a=0;a<t;a+=1)r[a]=Math.floor(r[a]/n)*n};Posterize$1.Posterize=Posterize;Factory_1$3.Factory.addGetterSetter(Node_1$3.Node,"levels",.5,(0,Validators_1$3.getNumberValidator)(),Factory_1$3.Factory.afterSetFilter);var RGB$1={};Object.defineProperty(RGB$1,"__esModule",{value:!0});RGB$1.RGB=void 0;const Factory_1$2=Factory,Node_1$2=Node$1,Validators_1$2=Validators,RGB=function(o){var e=o.data,r=e.length,t=this.red(),n=this.green(),a=this.blue(),l,u;for(l=0;l<r;l+=4)u=(.34*e[l]+.5*e[l+1]+.16*e[l+2])/255,e[l]=u*t,e[l+1]=u*n,e[l+2]=u*a,e[l+3]=e[l+3]};RGB$1.RGB=RGB;Factory_1$2.Factory.addGetterSetter(Node_1$2.Node,"red",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});Factory_1$2.Factory.addGetterSetter(Node_1$2.Node,"green",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});Factory_1$2.Factory.addGetterSetter(Node_1$2.Node,"blue",0,Validators_1$2.RGBComponent,Factory_1$2.Factory.afterSetFilter);var RGBA$1={};Object.defineProperty(RGBA$1,"__esModule",{value:!0});RGBA$1.RGBA=void 0;const Factory_1$1=Factory,Node_1$1=Node$1,Validators_1$1=Validators,RGBA=function(o){var e=o.data,r=e.length,t=this.red(),n=this.green(),a=this.blue(),l=this.alpha(),u,f;for(u=0;u<r;u+=4)f=1-l,e[u]=t*l+e[u]*f,e[u+1]=n*l+e[u+1]*f,e[u+2]=a*l+e[u+2]*f};RGBA$1.RGBA=RGBA;Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"red",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"green",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"blue",0,Validators_1$1.RGBComponent,Factory_1$1.Factory.afterSetFilter);Factory_1$1.Factory.addGetterSetter(Node_1$1.Node,"alpha",1,function(o){return this._filterUpToDate=!1,o>1?1:o<0?0:o});var Sepia$1={};Object.defineProperty(Sepia$1,"__esModule",{value:!0});Sepia$1.Sepia=void 0;const Sepia=function(o){var e=o.data,r=e.length,t,n,a,l;for(t=0;t<r;t+=4)n=e[t+0],a=e[t+1],l=e[t+2],e[t+0]=Math.min(255,n*.393+a*.769+l*.189),e[t+1]=Math.min(255,n*.349+a*.686+l*.168),e[t+2]=Math.min(255,n*.272+a*.534+l*.131)};Sepia$1.Sepia=Sepia;var Solarize$1={};Object.defineProperty(Solarize$1,"__esModule",{value:!0});Solarize$1.Solarize=void 0;const Solarize=function(o){var e=o.data,r=o.width,t=o.height,n=r*4,a=t;do{var l=(a-1)*n,u=r;do{var f=l+(u-1)*4,d=e[f],h=e[f+1],y=e[f+2];d>127&&(d=255-d),h>127&&(h=255-h),y>127&&(y=255-y),e[f]=d,e[f+1]=h,e[f+2]=y}while(--u)}while(--a)};Solarize$1.Solarize=Solarize;var Threshold$1={};Object.defineProperty(Threshold$1,"__esModule",{value:!0});Threshold$1.Threshold=void 0;const Factory_1=Factory,Node_1=Node$1,Validators_1=Validators,Threshold=function(o){var e=this.threshold()*255,r=o.data,t=r.length,n;for(n=0;n<t;n+=1)r[n]=r[n]<e?0:255};Threshold$1.Threshold=Threshold;Factory_1.Factory.addGetterSetter(Node_1.Node,"threshold",.5,(0,Validators_1.getNumberValidator)(),Factory_1.Factory.afterSetFilter);Object.defineProperty(_FullInternals,"__esModule",{value:!0});_FullInternals.Konva=void 0;const _CoreInternals_1=_CoreInternals,Arc_1=Arc$1,Arrow_1=Arrow$1,Circle_1=Circle$1,Ellipse_1=Ellipse$1,Image_1=Image$4,Label_1=Label$1,Line_1=Line$2,Path_1=Path$1,Rect_1=Rect$2,RegularPolygon_1=RegularPolygon$1,Ring_1=Ring$1,Sprite_1=Sprite$1,Star_1=Star$1,Text_1=Text$2,TextPath_1=TextPath$1,Transformer_1=Transformer$1,Wedge_1=Wedge$1,Blur_1=Blur$1,Brighten_1=Brighten$1,Contrast_1=Contrast$1,Emboss_1=Emboss$1,Enhance_1=Enhance$1,Grayscale_1=Grayscale$1,HSL_1=HSL$1,HSV_1=HSV$1,Invert_1=Invert$1,Kaleidoscope_1=Kaleidoscope$1,Mask_1=Mask$1,Noise_1=Noise$1,Pixelate_1=Pixelate$1,Posterize_1=Posterize$1,RGB_1=RGB$1,RGBA_1=RGBA$1,Sepia_1=Sepia$1,Solarize_1=Solarize$1,Threshold_1=Threshold$1;_FullInternals.Konva=_CoreInternals_1.Konva.Util._assign(_CoreInternals_1.Konva,{Arc:Arc_1.Arc,Arrow:Arrow_1.Arrow,Circle:Circle_1.Circle,Ellipse:Ellipse_1.Ellipse,Image:Image_1.Image,Label:Label_1.Label,Tag:Label_1.Tag,Line:Line_1.Line,Path:Path_1.Path,Rect:Rect_1.Rect,RegularPolygon:RegularPolygon_1.RegularPolygon,Ring:Ring_1.Ring,Sprite:Sprite_1.Sprite,Star:Star_1.Star,Text:Text_1.Text,TextPath:TextPath_1.TextPath,Transformer:Transformer_1.Transformer,Wedge:Wedge_1.Wedge,Filters:{Blur:Blur_1.Blur,Brighten:Brighten_1.Brighten,Contrast:Contrast_1.Contrast,Emboss:Emboss_1.Emboss,Enhance:Enhance_1.Enhance,Grayscale:Grayscale_1.Grayscale,HSL:HSL_1.HSL,HSV:HSV_1.HSV,Invert:Invert_1.Invert,Kaleidoscope:Kaleidoscope_1.Kaleidoscope,Mask:Mask_1.Mask,Noise:Noise_1.Noise,Pixelate:Pixelate_1.Pixelate,Posterize:Posterize_1.Posterize,RGB:RGB_1.RGB,RGBA:RGBA_1.RGBA,Sepia:Sepia_1.Sepia,Solarize:Solarize_1.Solarize,Threshold:Threshold_1.Threshold}});var lib=lib$1.exports;Object.defineProperty(lib,"__esModule",{value:!0});const _FullInternals_1=_FullInternals;lib$1.exports=_FullInternals_1.Konva;var Core={exports:{}};(function(o,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;var r=_CoreInternals;Object.defineProperty(e,"Konva",{enumerable:!0,get:function(){return r.Konva}});const t=_CoreInternals;o.exports=t.Konva})(Core,Core.exports);var CoreExports=Core.exports;const Konva=getDefaultExportFromCjs(CoreExports);var reactReconciler={exports:{}},scheduler={exports:{}},scheduler_production_min={};/**
|
|
73
73
|
* @license React
|
|
74
74
|
* scheduler.production.min.js
|