=n))for(let t=f;t=r)continue;let i=(n*t+e)*4;a+=o[i+0],s+=o[i+1],c+=o[i+2],l+=o[i+3],m+=1}a/=m,s/=m,c/=m,l/=m;for(let e=u;e=n))for(let t=f;t=r)continue;let i=(n*t+e)*4;o[i+0]=a,o[i+1]=s,o[i+2]=c,o[i+3]=l}}};R.addGetterSetter(z,`pixelSize`,8,L(),R.afterSetFilter);var aa=function(e){let t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t;for(let e=0;e255?255:e<0?0:Math.round(e)}),R.addGetterSetter(z,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),R.addGetterSetter(z,`blue`,0,Je,R.afterSetFilter);var sa=function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue(),o=this.alpha();for(let e=0;e255?255:e<0?0:Math.round(e)}),R.addGetterSetter(z,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),R.addGetterSetter(z,`blue`,0,Je,R.afterSetFilter),R.addGetterSetter(z,`alpha`,1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var ca=function(e){let t=e.data,n=t.length;for(let e=0;e=128&&(t[e]=255-n,t[e+1]=255-r,t[e+2]=255-i)}return e},ua=function(e){let t=this.threshold()*255,n=e.data,r=n.length;for(let e=0;e{i(e.getAttr(r))})}}var ya=`V`;function ba(e){function t(e){return e?.__konvaNode?e:e?.parent?t(e.parent):(console.error(`vue-konva error: Can not find parent node`),null)}return t(e.parent)}function xa(e){return e.component?e.component.__konvaNode||xa(e.component.subTree):null}function Sa(e){let{el:t,component:n}=e,r=xa(e);if(t?.tagName&&n&&!r){let e=t.tagName.toLowerCase();return console.error(`vue-konva error: You are trying to render "${e}" inside your component tree. Looks like it is not a Konva node. You can render only Konva components inside the Stage.`),null}return r}function Ca(e){let t=e=>!!e&&typeof e==`object`&&`component`in e,n=e=>Array.isArray(e),r=e=>t(e)?[e,...r(e.children)]:n(e)?e.flatMap(r):[];return r(e.children)}function wa(e,t){let n=Ca(e),r=[];n.forEach(e=>{let t=Sa(e);t&&r.push(t)});let i=!1;r.forEach((e,t)=>{e.getZIndex()!==t&&(e.setZIndex(t),i=!0)}),i&&fa(t)}var Ta=da.default?.Stage||da.Stage,Ea=n({name:`Stage`,props:{config:{type:Object,default:function(){return{}}},__useStrictMode:{type:Boolean}},inheritAttrs:!1,setup(t,{attrs:n,slots:r,expose:i}){let a=D();if(!a)return;let s=o({}),c=h(null),u=new Ta({width:t.config.width,height:t.config.height,container:document.createElement(`div`)});a.__konvaNode=u,p();function d(){return a?.__konvaNode}function f(){return a?.__konvaNode}function p(){if(!a)return;let e=s||{},r={...n,...t.config};ha(a,r,e,t.__useStrictMode),Object.assign(s,r)}return e(()=>{c.value&&u.container(c.value),p(),va(u,a)}),l(()=>{p(),wa(a.subTree,u),va(u,a)}),S(()=>{u.destroy()}),k(()=>t.config,p,{deep:!0}),i({getStage:f,getNode:d}),()=>m(`div`,{ref:c,id:n?.id,accesskey:n?.accesskey,class:n?.class,role:n?.role,style:n?.style,tabindex:n?.tabindex,title:n?.title},r.default?.())}}),Da=`.vue-konva-event`,Oa={Group:!0,Layer:!0,FastLayer:!0,Label:!0};function J(t,r){return n({name:t,props:{config:{type:Object,default:function(){return{}}},__useStrictMode:{type:Boolean}},setup(n,{attrs:i,slots:a,expose:s}){let c=D();if(!c)return;let u=o({}),d=new r;c.__konvaNode=d,c.vnode.__konvaNode=d,m();function f(){return c?.__konvaNode}function p(){return c?.__konvaNode}function m(){if(!c)return;let e={};for(let t in c?.vnode.props)t.slice(0,2)===`on`&&(e[t]=c.vnode.props[t]);let t=u||{},r={...i,...n.config,...e};ha(c,r,t,n.__useStrictMode),Object.assign(u,r)}e(()=>{let e=ba(c)?.__konvaNode;e&&`add`in e&&e.add(d),fa(d),va(d,c)}),x(()=>{fa(d),d.destroy(),d.off(Da),d.off(ga)}),l(()=>{m(),wa(c.subTree,d),va(d,c)}),k(()=>n.config,m,{deep:!0}),s({getStage:p,getNode:f});let h=Oa.hasOwnProperty(t);return()=>h?a.default?.():null}})}var Y=da.default||da,ka=J(`Arc`,Y.Arc),Aa=J(`Arrow`,Y.Arrow),ja=J(`Circle`,Y.Circle),Ma=J(`Ellipse`,Y.Ellipse),Na=J(`FastLayer`,Y.FastLayer),Pa=J(`Group`,Y.Group),Fa=J(`Image`,Y.Image),Ia=J(`Label`,Y.Label),La=J(`Layer`,Y.Layer),Ra=J(`Line`,Y.Line),za=J(`Path`,Y.Path),Ba=J(`Rect`,Y.Rect),Va=J(`RegularPolygon`,Y.RegularPolygon),Ha=J(`Ring`,Y.Ring),Ua=J(`Shape`,Y.Shape),Wa=J(`Sprite`,Y.Sprite),Ga=J(`Star`,Y.Star),Ka=J(`Tag`,Y.Tag),qa=J(`Text`,Y.Text),Ja=J(`TextPath`,Y.TextPath),Ya=J(`Transformer`,Y.Transformer),Xa=J(`Wedge`,Y.Wedge),Za=Object.freeze(Object.defineProperty({__proto__:null,Arc:ka,Arrow:Aa,Circle:ja,Ellipse:Ma,FastLayer:Na,Group:Pa,Image:Fa,Label:Ia,Layer:La,Line:Ra,Path:za,Rect:Ba,RegularPolygon:Va,Ring:Ha,Shape:Ua,Sprite:Wa,Star:Ga,Tag:Ka,Text:qa,TextPath:Ja,Transformer:Ya,Wedge:Xa},Symbol.toStringTag,{value:`Module`})),Qa={install:(e,t)=>{let n=t?.prefix||ya,r=t?.customNodes?Object.entries(t.customNodes).map(([e,t])=>J(e,t)):[];[Ea,...Object.values(Za),...r].forEach(t=>{e.component(`${n}${t.name}`,t)})}},$a=typeof document<`u`;function eo(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function to(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&eo(e.default)}var X=Object.assign;function no(e,t){let n={};for(let r in t){let i=t[r];n[r]=io(i)?i.map(e):e(i)}return n}var ro=()=>{},io=Array.isArray;function ao(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var oo=/#/g,so=/&/g,co=/\//g,lo=/=/g,uo=/\?/g,fo=/\+/g,po=/%5B/g,mo=/%5D/g,ho=/%5E/g,go=/%60/g,_o=/%7B/g,vo=/%7C/g,yo=/%7D/g,bo=/%20/g;function xo(e){return e==null?``:encodeURI(``+e).replace(vo,`|`).replace(po,`[`).replace(mo,`]`)}function So(e){return xo(e).replace(_o,`{`).replace(yo,`}`).replace(ho,`^`)}function Co(e){return xo(e).replace(fo,`%2B`).replace(bo,`+`).replace(oo,`%23`).replace(so,`%26`).replace(go,"`").replace(_o,`{`).replace(yo,`}`).replace(ho,`^`)}function wo(e){return Co(e).replace(lo,`%3D`)}function To(e){return xo(e).replace(oo,`%23`).replace(uo,`%3F`)}function Eo(e){return To(e).replace(co,`%2F`)}function Do(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{}return``+e}var Oo=/\/$/,ko=e=>e.replace(Oo,``);function Ao(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=Ro(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:Do(o)}}function jo(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function Mo(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function No(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&Po(t.matched[r],n.matched[i])&&Fo(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Po(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Fo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Io(e[n],t[n]))return!1;return!0}function Io(e,t){return io(e)?Lo(e,t):io(t)?Lo(t,e):e?.valueOf()===t?.valueOf()}function Lo(e,t){return io(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function Ro(e,t){if(e.startsWith(`/`))return e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o1&&a--;else break;return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}var zo={path:`/`,name:void 0,params:{},query:{},hash:``,fullPath:`/`,matched:[],meta:{},redirectedFrom:void 0},Bo=function(e){return e.pop=`pop`,e.push=`push`,e}({}),Vo=function(e){return e.back=`back`,e.forward=`forward`,e.unknown=``,e}({});function Ho(e){if(!e)if($a){let t=document.querySelector(`base`);e=t&&t.getAttribute(`href`)||`/`,e=e.replace(/^\w+:\/\/[^\/]+/,``)}else e=`/`;return e[0]!==`/`&&e[0]!==`#`&&(e=`/`+e),ko(e)}var Uo=/^[^#]+#/;function Wo(e,t){return e.replace(Uo,`#`)+t}function Go(e,t){let n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}var Ko=()=>({left:window.scrollX,top:window.scrollY});function qo(e){let t;if(`el`in e){let n=e.el,r=typeof n==`string`&&n.startsWith(`#`),i=typeof n==`string`?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;t=Go(i,e)}else t=e;`scrollBehavior`in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left==null?window.scrollX:t.left,t.top==null?window.scrollY:t.top)}function Jo(e,t){return(history.state?history.state.position-t:-1)+e}var Yo=new Map;function Xo(e,t){Yo.set(e,t)}function Zo(e){let t=Yo.get(e);return Yo.delete(e),t}function Qo(e){return typeof e==`string`||e&&typeof e==`object`}function $o(e){return typeof e==`string`||typeof e==`symbol`}var Z=function(e){return e[e.MATCHER_NOT_FOUND=1]=`MATCHER_NOT_FOUND`,e[e.NAVIGATION_GUARD_REDIRECT=2]=`NAVIGATION_GUARD_REDIRECT`,e[e.NAVIGATION_ABORTED=4]=`NAVIGATION_ABORTED`,e[e.NAVIGATION_CANCELLED=8]=`NAVIGATION_CANCELLED`,e[e.NAVIGATION_DUPLICATED=16]=`NAVIGATION_DUPLICATED`,e}({}),es=Symbol(``);Z.MATCHER_NOT_FOUND,Z.NAVIGATION_GUARD_REDIRECT,Z.NAVIGATION_ABORTED,Z.NAVIGATION_CANCELLED,Z.NAVIGATION_DUPLICATED;function ts(e,t){return X(Error(),{type:e,[es]:!0},t)}function ns(e,t){return e instanceof Error&&es in e&&(t==null||!!(e.type&t))}function rs(e){let t={};if(e===``||e===`?`)return t;let n=(e[0]===`?`?e.slice(1):e).split(`&`);for(let e=0;ee&&Co(e)):[r&&Co(r)]).forEach(e=>{e!==void 0&&(t+=(t.length?`&`:``)+n,e!=null&&(t+=`=`+e))})}return t}function as(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=io(r)?r.map(e=>e==null?null:``+e):r==null?r:``+r)}return t}var os=Symbol(``),ss=Symbol(``),cs=Symbol(``),ls=Symbol(``),us=Symbol(``);function ds(){let e=[];function t(t){return e.push(t),()=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function fs(e,t,n,r,i,a=e=>e()){let o=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return()=>new Promise((s,c)=>{let l=e=>{e===!1?c(ts(Z.NAVIGATION_ABORTED,{from:n,to:t})):e instanceof Error?c(e):Qo(e)?c(ts(Z.NAVIGATION_GUARD_REDIRECT,{from:t,to:e})):(o&&r.enterCallbacks[i]===o&&typeof e==`function`&&o.push(e),s())},u=a(()=>e.call(r&&r.instances[i],t,n,l)),d=Promise.resolve(u);e.length<3&&(d=d.then(l)),d.catch(e=>c(e))})}function ps(e,t,n,r,i=e=>e()){let a=[];for(let o of e)for(let e in o.components){let s=o.components[e];if(!(t!==`beforeRouteEnter`&&!o.instances[e]))if(eo(s)){let c=(s.__vccOpts||s)[t];c&&a.push(fs(c,n,r,o,e,i))}else{let c=s();a.push(()=>c.then(a=>{if(!a)throw Error(`Couldn't resolve component "${e}" at "${o.path}"`);let s=to(a)?a.default:a;o.mods[e]=a,o.components[e]=s;let c=(s.__vccOpts||s)[t];return c&&fs(c,n,r,o,e,i)()}))}}return a}function ms(e,t){let n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length);for(let o=0;oPo(e,a))?r.push(a):n.push(a));let s=e.matched[o];s&&(t.matched.find(e=>Po(e,s))||i.push(s))}return[n,r,i]}var hs=()=>location.protocol+`//`+location.host;function gs(e,t){let{pathname:n,search:r,hash:i}=t,a=e.indexOf(`#`);if(a>-1){let t=i.includes(e.slice(a))?e.slice(a).length:1,n=i.slice(t);return n[0]!==`/`&&(n=`/`+n),Mo(n,``)}return Mo(n,e)+r+i}function _s(e,t,n,r){let i=[],a=[],o=null,s=({state:a})=>{let s=gs(e,location),c=n.value,l=t.value,u=0;if(a){if(n.value=s,t.value=a,o&&o===c){o=null;return}u=l?a.position-l.position:0}else r(s);i.forEach(e=>{e(n.value,c,{delta:u,type:Bo.pop,direction:u?u>0?Vo.forward:Vo.back:Vo.unknown})})};function c(){o=n.value}function l(e){i.push(e);let t=()=>{let t=i.indexOf(e);t>-1&&i.splice(t,1)};return a.push(t),t}function u(){if(document.visibilityState===`hidden`){let{history:e}=window;if(!e.state)return;e.replaceState(X({},e.state,{scroll:Ko()}),``)}}function d(){for(let e of a)e();a=[],window.removeEventListener(`popstate`,s),window.removeEventListener(`pagehide`,u),document.removeEventListener(`visibilitychange`,u)}return window.addEventListener(`popstate`,s),window.addEventListener(`pagehide`,u),document.addEventListener(`visibilitychange`,u),{pauseListeners:c,listen:l,destroy:d}}function vs(e,t,n,r=!1,i=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:i?Ko():null}}function ys(e){let{history:t,location:n}=window,r={value:gs(e,n)},i={value:t.state};i.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(r,a,o){let s=e.indexOf(`#`),c=s>-1?(n.host&&document.querySelector(`base`)?e:e.slice(s))+r:hs()+e+r;try{t[o?`replaceState`:`pushState`](a,``,c),i.value=a}catch(e){console.error(e),n[o?`replace`:`assign`](c)}}function o(e,n){a(e,X({},t.state,vs(i.value.back,e,i.value.forward,!0),n,{position:i.value.position}),!0),r.value=e}function s(e,n){let o=X({},i.value,t.state,{forward:e,scroll:Ko()});a(o.current,o,!0),a(e,X({},vs(r.value,e,null),{position:o.position+1},n),!1),r.value=e}return{location:r,state:i,push:s,replace:o}}function bs(e){e=Ho(e);let t=ys(e),n=_s(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}let i=X({location:``,base:e,go:r,createHref:Wo.bind(null,e)},t,n);return Object.defineProperty(i,`location`,{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,`state`,{enumerable:!0,get:()=>t.state.value}),i}var xs=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.Group=2]=`Group`,e}({}),Q=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.ParamRegExp=2]=`ParamRegExp`,e[e.ParamRegExpEnd=3]=`ParamRegExpEnd`,e[e.EscapeNext=4]=`EscapeNext`,e}(Q||{}),Ss={type:xs.Static,value:``},Cs=/[a-zA-Z0-9_]/;function ws(e){if(!e)return[[]];if(e===`/`)return[[Ss]];if(!e.startsWith(`/`))throw Error(`Invalid path "${e}"`);function t(e){throw Error(`ERR (${n})/"${l}": ${e}`)}let n=Q.Static,r=n,i=[],a;function o(){a&&i.push(a),a=[]}let s=0,c,l=``,u=``;function d(){l&&=(n===Q.Static?a.push({type:xs.Static,value:l}):n===Q.Param||n===Q.ParamRegExp||n===Q.ParamRegExpEnd?(a.length>1&&(c===`*`||c===`+`)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:xs.Param,value:l,regexp:u,repeatable:c===`*`||c===`+`,optional:c===`*`||c===`?`})):t(`Invalid state to consume buffer`),``)}function f(){l+=c}for(;st.length?t.length===1&&t[0]===$.Static+$.Segment?1:-1:0}function As(e,t){let n=0,r=e.score,i=t.score;for(;n