saterys 0.2.7__py3-none-any.whl

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.
@@ -0,0 +1,13 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Controls-BuZt2rJO.js","assets/Icon-BZoXfbBu.js","assets/DrawerController-CunOJ5Gd.js","assets/DrawerController-ZXfKNTdC.css"])))=>i.map(i=>d[i]);
2
+ var Ul=Object.defineProperty;var Yl=(n,e,i)=>e in n?Ul(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var Zo=(n,e,i)=>Yl(n,typeof e!="symbol"?e+"":e,i);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function i(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(r){if(r.ep)return;r.ep=!0;const l=i(r);fetch(r.href,l)}})();function Ot(){}function $o(n,e){for(const i in e)n[i]=e[i];return n}function Aa(n){return n()}function Fs(){return Object.create(null)}function tn(n){n.forEach(Aa)}function Wi(n){return typeof n=="function"}function Ye(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function ql(n){return Object.keys(n).length===0}function Je(n,...e){if(n==null){for(const s of e)s(void 0);return Ot}const i=n.subscribe(...e);return i.unsubscribe?()=>i.unsubscribe():i}function gt(n){let e;return Je(n,i=>e=i)(),e}function ft(n,e,i){n.$$.on_destroy.push(Je(e,i))}function de(n,e,i,s){if(n){const r=Na(n,e,i,s);return n[0](r)}}function Na(n,e,i,s){return n[1]&&s?$o(i.ctx.slice(),n[1](s(e))):i.ctx}function _e(n,e,i,s){if(n[2]&&s){const r=n[2](s(i));if(e.dirty===void 0)return r;if(typeof r=="object"){const l=[],u=Math.max(e.dirty.length,r.length);for(let f=0;f<u;f+=1)l[f]=e.dirty[f]|r[f];return l}return e.dirty|r}return e.dirty}function me(n,e,i,s,r,l){if(r){const u=Na(e,i,s,l);n.p(u,r)}}function ge(n){if(n.ctx.length>32){const e=[],i=n.ctx.length/32;for(let s=0;s<i;s++)e[s]=-1;return e}return-1}function ts(n){const e={};for(const i in n)e[i]=!0;return e}function Gs(n){return n??""}function Mt(n,e,i){return n.set(i),e}function Vn(n){return n&&Wi(n.destroy)?n.destroy:Ot}const Vl=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function S(n,e){n.appendChild(e)}function lt(n,e,i){n.insertBefore(e,i||null)}function rt(n){n.parentNode&&n.parentNode.removeChild(n)}function Bi(n,e){for(let i=0;i<n.length;i+=1)n[i]&&n[i].d(e)}function ot(n){return document.createElement(n)}function ee(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function je(n){return document.createTextNode(n)}function pt(){return je(" ")}function pe(){return je("")}function Ct(n,e,i,s){return n.addEventListener(e,i,s),()=>n.removeEventListener(e,i,s)}function wn(n){return function(e){return e.preventDefault(),n.call(this,e)}}function En(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function Ii(n){return function(e){e.target===this&&n.call(this,e)}}function v(n,e,i){i==null?n.removeAttribute(e):n.getAttribute(e)!==i&&n.setAttribute(e,i)}function jf(n){return n===""?null:+n}function Kl(n){return Array.from(n.childNodes)}function bn(n,e){e=""+e,n.data!==e&&(n.data=e)}function yi(n,e){n.value=e??""}function et(n,e,i,s){i==null?n.style.removeProperty(e):n.style.setProperty(e,i,"")}function js(n,e,i){for(let s=0;s<n.options.length;s+=1){const r=n.options[s];if(r.__value===e){r.selected=!0;return}}(!i||e!==void 0)&&(n.selectedIndex=-1)}function Jl(n){const e=n.querySelector(":checked");return e&&e.__value}let io;function Ql(){if(io===void 0){io=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{io=!0}}return io}function $l(n,e){getComputedStyle(n).position==="static"&&(n.style.position="relative");const s=ot("iframe");s.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),s.setAttribute("aria-hidden","true"),s.tabIndex=-1;const r=Ql();let l;return r?(s.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",l=Ct(window,"message",u=>{u.source===s.contentWindow&&e()})):(s.src="about:blank",s.onload=()=>{l=Ct(s.contentWindow,"resize",e),e()}),S(n,s),()=>{(r||l&&s.contentWindow)&&l(),rt(s)}}function Xt(n,e,i){n.classList.toggle(e,!!i)}function tu(n,e,{bubbles:i=!1,cancelable:s=!1}={}){return new CustomEvent(n,{detail:e,bubbles:i,cancelable:s})}function Zn(n,e){return new n(e)}let Zi;function Oi(n){Zi=n}function ri(){if(!Zi)throw new Error("Function called outside component initialization");return Zi}function eu(n){ri().$$.before_update.push(n)}function zn(n){ri().$$.on_mount.push(n)}function Ia(n){ri().$$.after_update.push(n)}function ho(n){ri().$$.on_destroy.push(n)}function wi(){const n=ri();return(e,i,{cancelable:s=!1}={})=>{const r=n.$$.callbacks[e];if(r){const l=tu(e,i,{cancelable:s});return r.slice().forEach(u=>{u.call(n,l)}),!l.defaultPrevented}return!0}}function Le(n,e){return ri().$$.context.set(n,e),e}function te(n){return ri().$$.context.get(n)}function Re(n,e){const i=n.$$.callbacks[e.type];i&&i.slice().forEach(s=>s.call(this,e))}const pi=[],Cn=[];let vi=[];const Yo=[],Oa=Promise.resolve();let qo=!1;function xa(){qo||(qo=!0,Oa.then(Za))}function Ba(){return xa(),Oa}function Di(n){vi.push(n)}function nu(n){Yo.push(n)}const Do=new Set;let mi=0;function Za(){if(mi!==0)return;const n=Zi;do{try{for(;mi<pi.length;){const e=pi[mi];mi++,Oi(e),iu(e.$$)}}catch(e){throw pi.length=0,mi=0,e}for(Oi(null),pi.length=0,mi=0;Cn.length;)Cn.pop()();for(let e=0;e<vi.length;e+=1){const i=vi[e];Do.has(i)||(Do.add(i),i())}vi.length=0}while(pi.length);for(;Yo.length;)Yo.pop()();qo=!1,Do.clear(),Oi(n)}function iu(n){if(n.fragment!==null){n.update(),tn(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Di)}}function ou(n){const e=[],i=[];vi.forEach(s=>n.indexOf(s)===-1?e.push(s):i.push(s)),i.forEach(s=>s()),vi=e}const ao=new Set;let oi;function le(){oi={r:0,c:[],p:oi}}function ue(){oi.r||tn(oi.c),oi=oi.p}function N(n,e){n&&n.i&&(ao.delete(n),n.i(e))}function R(n,e,i,s){if(n&&n.o){if(ao.has(n))return;ao.add(n),oi.c.push(()=>{ao.delete(n),s&&(i&&n.d(1),s())}),n.o(e)}else s&&s()}function Ee(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function fo(n,e){n.d(1),e.delete(n.key)}function Ri(n,e){R(n,1,1,()=>{e.delete(n.key)})}function Un(n,e,i,s,r,l,u,f,h,_,m,p){let w=n.length,b=l.length,k=w;const C={};for(;k--;)C[n[k].key]=k;const M=[],E=new Map,T=new Map,I=[];for(k=b;k--;){const at=p(r,l,k),ct=i(at);let st=u.get(ct);st?I.push(()=>st.p(at,e)):(st=_(ct,at),st.c()),E.set(ct,M[k]=st),ct in C&&T.set(ct,Math.abs(k-C[ct]))}const q=new Set,j=new Set;function Y(at){N(at,1),at.m(f,m),u.set(at.key,at),m=at.first,b--}for(;w&&b;){const at=M[b-1],ct=n[w-1],st=at.key,nt=ct.key;at===ct?(m=at.first,w--,b--):E.has(nt)?!u.has(st)||q.has(st)?Y(at):j.has(nt)?w--:T.get(st)>T.get(nt)?(j.add(st),Y(at)):(q.add(nt),w--):(h(ct,u),w--)}for(;w--;){const at=n[w];E.has(at.key)||h(at,u)}for(;b;)Y(M[b-1]);return tn(I),M}function Da(n,e){const i={},s={},r={$$scope:1};let l=n.length;for(;l--;){const u=n[l],f=e[l];if(f){for(const h in u)h in f||(s[h]=1);for(const h in f)r[h]||(i[h]=f[h],r[h]=1);n[l]=f}else for(const h in u)r[h]=1}for(const u in s)u in i||(i[u]=void 0);return i}function Ra(n){return typeof n=="object"&&n!==null?n:{}}function su(n,e,i){const s=n.$$.props[e];s!==void 0&&(n.$$.bound[s]=i,i(n.$$.ctx[s]))}function Qt(n){n&&n.c()}function Vt(n,e,i){const{fragment:s,after_update:r}=n.$$;s&&s.m(e,i),Di(()=>{const l=n.$$.on_mount.map(Aa).filter(Wi);n.$$.on_destroy?n.$$.on_destroy.push(...l):tn(l),n.$$.on_mount=[]}),r.forEach(Di)}function Kt(n,e){const i=n.$$;i.fragment!==null&&(ou(i.after_update),tn(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function ru(n,e){n.$$.dirty[0]===-1&&(pi.push(n),xa(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function en(n,e,i,s,r,l,u=null,f=[-1]){const h=Zi;Oi(n);const _=n.$$={fragment:null,ctx:[],props:l,update:Ot,not_equal:r,bound:Fs(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(h?h.$$.context:[])),callbacks:Fs(),dirty:f,skip_bound:!1,root:e.target||h.$$.root};u&&u(_.root);let m=!1;if(_.ctx=i?i(n,e.props||{},(p,w,...b)=>{const k=b.length?b[0]:w;return _.ctx&&r(_.ctx[p],_.ctx[p]=k)&&(!_.skip_bound&&_.bound[p]&&_.bound[p](k),m&&ru(n,p)),w}):[],_.update(),m=!0,tn(_.before_update),_.fragment=s?s(_.ctx):!1,e.target){if(e.hydrate){const p=Kl(e.target);_.fragment&&_.fragment.l(p),p.forEach(rt)}else _.fragment&&_.fragment.c();e.intro&&N(n.$$.fragment),Vt(n,e.target,e.anchor),Za()}Oi(h)}class nn{constructor(){Zo(this,"$$");Zo(this,"$$set")}$destroy(){Kt(this,1),this.$destroy=Ot}$on(e,i){if(!Wi(i))return Ot;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(i),()=>{const r=s.indexOf(i);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!ql(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const au="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(au);const gi=[];function uo(n,e){return{subscribe:U(n,e).subscribe}}function U(n,e=Ot){let i;const s=new Set;function r(f){if(Ye(n,f)&&(n=f,i)){const h=!gi.length;for(const _ of s)_[1](),gi.push(_,n);if(h){for(let _=0;_<gi.length;_+=2)gi[_][0](gi[_+1]);gi.length=0}}}function l(f){r(f(n))}function u(f,h=Ot){const _=[f,h];return s.add(_),s.size===1&&(i=e(r,l)||Ot),f(n),()=>{s.delete(_),s.size===0&&i&&(i(),i=null)}}return{set:r,update:l,subscribe:u}}function xi(n,e,i){const s=!Array.isArray(n),r=s?[n]:n;if(!r.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const l=e.length<2;return uo(i,(u,f)=>{let h=!1;const _=[];let m=0,p=Ot;const w=()=>{if(m)return;p();const k=e(s?_[0]:_,u,f);l?u(k):p=Wi(k)?k:Ot},b=r.map((k,C)=>Je(k,M=>{_[C]=M,m&=~(1<<C),h&&w()},()=>{m|=1<<C}));return h=!0,w(),function(){tn(b),p(),h=!1}})}function co(){const n=new Map,{subscribe:e,set:i,update:s}=U(n);return{subscribe:e,set:i,update:s,add:(l,u)=>(s(f=>(f.set(u,l),f)),n),get:l=>n.get(l)||null,getAll:()=>Array.from(n.values()),delete:l=>{let u=!1;return s(f=>(f.delete(l),u=!0,f)),u},count:()=>n.size}}function lu(n){const{id:e,inputs:i,outputs:s,resizable:r,dimensions:l,editable:u,direction:f,zIndex:h,position:_,selectionColor:m,borderWidth:p,edge:w}=n,{bgColor:b,borderColor:k,rotation:C,borderRadius:M,connections:E,textColor:T,locked:I,group:q}=n,j=co(),Y=(st="self")=>{gt(j).forEach(nt=>{(st==="self"||gt(nt.direction)===st)&&nt.recalculatePosition()})};return{id:typeof e=="string"&&e.slice(0,2)==="N-"?e:`N-${e}`,position:U({x:(_==null?void 0:_.x)||0,y:(_==null?void 0:_.y)||0}),dimensions:{width:U((l==null?void 0:l.width)||0),height:U((l==null?void 0:l.height)||(l==null?void 0:l.width))},group:U(q||null),locked:U(I||!1),inputs:U(i),outputs:U(s),recalculateAnchors:Y,rotation:U(C||0),moving:U(!1),resizingWidth:U(!1),resizingHeight:U(!1),rotating:U(!1),editable:U(u||!1),resizable:U(r),anchors:j,zIndex:U(h||2),collapsed:U(!1),edge:w||null,borderRadius:U(M),bgColor:U(b||null),direction:U(f),label:U(n.label||""),borderColor:U(k||null),borderWidth:U(p),selectionColor:U(m||null),textColor:U(T||null),connections:U(E)}}const uu=10,cu=100,hu=50,fu="#000",du="#fff",_u="12px",mu=22,gu=1.4,pu=40;function vu(n,e){const i=[n,e].sort();return`${i[0]}+${i[1]}`}function Xs(n,e,i){var f,h,_,m,p;const{source:s,target:r}=n,u={id:s.id&&r.id?vu(s.id,r.id):"cursor",target:n.target,source:n.source,component:e,type:U((i==null?void 0:i.type)||null),color:(i==null?void 0:i.color)||U(null),width:U((i==null?void 0:i.width)||0),animated:U((i==null?void 0:i.animated)||!1),rendered:U(!1),start:(i==null?void 0:i.start)||null,end:(i==null?void 0:i.end)||null};if(i!=null&&i.disconnect&&(u.disconnect=!0),i!=null&&i.label){const w={text:U(i==null?void 0:i.label.text),color:U(((f=i==null?void 0:i.label)==null?void 0:f.color)||fu),textColor:U(((h=i==null?void 0:i.label)==null?void 0:h.textColor)||du),fontSize:U(((_=i==null?void 0:i.label)==null?void 0:_.fontSize)||_u),dimensions:{width:U(((m=i==null?void 0:i.label.dimensions)==null?void 0:m.width)||cu),height:U(((p=i==null?void 0:i.label.dimensions)==null?void 0:p.height)||hu)},borderRadius:U((i==null?void 0:i.label.borderRadius)||uu)};u.label=w}return u}function yu(){const n=new Map,e=new Set,{subscribe:i,set:s,update:r}=U(n),l={subscribe:i,set:s,update:r,add:(u,f)=>{if(typeof f!="string"){const h=Array.from(f),_=h[0],m=h[1];if(_.connected.update(p=>p.add(m)),m.connected.update(p=>p.add(_)),l.match(...Array.from(f)).length)return;e.forEach(p=>p(u,"connection"))}r(h=>(h.set(f,u),h))},getAll:()=>Array.from(n.values()),get:u=>n.get(u)||null,match:(...u)=>Array.from(n.keys()).filter(f=>f==="cursor"?!1:u.every(h=>h?f.has(h):!0)),fetch:(u,f)=>{const h=Array.from(n.keys()).filter(_=>_==="cursor"?!1:[u,f].every(m=>m?_.has(m):!0))[0];return n.get(h)||null},delete:u=>{if(typeof u!="string"){const h=Array.from(u),_=h[0],m=h[1];_.connected.update(p=>(p.delete(m),p)),m.connected.update(p=>(p.delete(_),p))}let f=!1;return r(h=>{const _=h.get(u);return _&&(h.delete(u),f=!0,typeof u!="string"&&e.forEach(m=>m(_,"disconnection"))),h}),f},onEdgeChange:u=>(e.add(u),()=>e.delete(u)),count:()=>n.size};return l}function wu(n,e){const i=n.clientX-e.clientX,s=n.clientY-e.clientY;return Math.sqrt(i*i+s*s)}function bu(){const n=()=>Math.floor(Math.random()*256),e=n(),i=n(),s=n();return`rgb(${e},${i},${s})`}const ku={"(":"round","[":"square","([":"stadium","[[":"subroutine","[(":"cylindrical","((":"circle","{":"rhombus","{{":"hexagon"},Us={"-":"straight","~":"bezier"},Wa={"(":")","[":"]","{":"}"},Pu=/[-=~]*>(?:\s*\|(.+?)\|)?/g,Lu=n=>{const e=n.split(`
3
+ `),i={parentNodes:[],nodeList:{}};for(const s of e){const{parentNodes:r,childNodes:l,edge:u}=Cu(s);for(const f of r){i.nodeList[f.id]||i.parentNodes.push(f);for(const h of l){if(i.nodeList[f.id]){if(i.nodeList[h.id]&&i.nodeList[h.id].children.some(({node:_})=>_.id===f.id))throw new Error("Circular reference detected");i.nodeList[f.id].children.push({node:i.nodeList[h.id]||h,...u})}else f.children.push({node:i.nodeList[h.id]||h,...u}),i.nodeList[f.id]=f;i.nodeList[h.id]?i.nodeList[h.id].parents.push({node:i.nodeList[f.id]||f}):(h.parents.push({node:i.nodeList[f.id]||f}),i.nodeList[h.id]=h),i.parentNodes=i.parentNodes.filter(_=>_.id!==h.id)}}}return i},Cu=n=>{const e=[],i=[],s=n.trim();let r="";const l=s.match(Pu);if(l)r=l[0];else throw new Error("Invalid edge");const[u,f]=s.split(r);for(const _ of u.split("&"))e.push(Ys(_));for(const _ of f.split("&"))i.push(Ys(_));const h=Su(r);return{parentNodes:e,childNodes:i,edge:h}},Ys=n=>{n=n.trim();const e=n[0],i=n.slice(1);let s="",r="";const l="Default",u={shape:""},f=[];for(let h=0;h<i.length;h++)if(Mu(i[h]))f.push(i[h]);else if(Wa[f[f.length-1]]===i[h]){r=ku[f.join("")];break}else s+=i[h];return u.shape=r,u.content=s,{id:e,data:u,type:l,children:[],parents:[],depth:0,nesting:0}},Su=n=>{n=n.trim();let e="";const[i,s]=n.split("|"),r=i[0];if(r in Us)e=Us[r];else throw new Error("Not a valid edge type");return s?{shape:e,content:s.trim(),length:Math.floor((i.trim().length-1)/2)}:{shape:e,length:Math.floor((i.trim().length-1)/2)}};function Mu(n){return n in Wa}function Tu(){return Math.random().toString(36).substring(7)}function Eu(n,e){const i=Math.sign(n.x).toString(),s=Math.sign(n.y).toString(),r=Math.sign(e.x).toString(),l=Math.sign(e.y).toString();return`${i}${s}${r}${l}`}function zu(n,e){return{1001:`a ${n} ${n} 0 0 1 ${n} ${n}`,"0110":`a ${n} ${n} 0 0 0 ${n} ${n}`,"100-1":`a ${n} ${n} 0 0 0 ${n} -${n}`,"0-110":`a ${n} ${n} 0 0 1 ${n} -${n}`,"-1001":`a ${n} ${n} 0 0 0 -${n} ${n}`,"01-10":`a ${n} ${n} 0 0 1 -${n} ${n}`,"-100-1":`a ${n} ${n} 0 0 1 -${n} -${n}`,"0-1-10":`a ${n} ${n} 0 0 0 -${n} -${n}`}[e]||""}function qs(n,e){const i=e*(Math.PI/180),s=n.x*Math.cos(i)-n.y*Math.sin(i),r=n.x*Math.sin(i)+n.y*Math.cos(i);return{x:s,y:r}}const Au=(n,e,i,s)=>n+` l ${e} ${i} `+s,mn=U({x:0,y:0}),Vo=U(0),vn=U(!1),Ko=U(!1),Ha=uo({x:0,y:0},n=>{const e=l=>{n({x:l.clientX,y:l.clientY})},i=l=>{if(l.touches.length===2){const u=wu(l.touches[0],l.touches[1]);Vo.set(u);const f={x:l.touches[0].clientX,y:l.touches[0].clientY};n(f)}else if(l.touches.length===1){const u=l.touches[0].clientX,f=l.touches[0].clientY;n({x:u,y:f}),vn.set(!0)}},s=l=>{i(l),window.addEventListener("touchend",r),window.addEventListener("touchmove",i)},r=()=>{vn.set(!1),Vo.set(0),window.removeEventListener("touchmove",i)};return document.addEventListener("mousemove",e),window.addEventListener("touchstart",s,!0),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("touchstart",s),window.removeEventListener("touchmove",i),window.removeEventListener("touchend",r)}});function Ro(n){const e=n.style.width,i=n.style.height;n.style.width="fit-content",n.style.height="fit-content";const s=n.offsetWidth,r=n.offsetHeight;return n.style.width=e,n.style.height=i,[s,r]}function Fa(n,e,i,s,r){const l={x:0,y:0},u=s.x-r.left-r.width/2,f=s.y-r.top-r.height/2,h=(u-i.x)/n,_=(f-i.y)/n;return l.x=u-h*e,l.y=f-_*e,l}const Nu=3,Iu=.1,Ni={north:{x:0,y:-1},south:{x:0,y:1},east:{x:1,y:0},west:{x:-1,y:0},self:{x:0,y:0}};function Ga(n,e,i){const s=e*i,r=n-s;return Number(Math.max(Iu,Math.min(Nu,r)).toFixed(9))}const _o=(n,e,i,s,r,l,u)=>{const{clientX:f,clientY:h}=n,_=l,m=f-i,p=h-e,w=u.x,b=u.y,k=s*(1-l)/2,C=r*(1-l)/2,M=m-w-k,E=p-b-C,T=M/_,I=E/_;return{x:T,y:I}};function Ou(n,e,i){const{top:s,left:r,width:l,height:u}=gt(n),f=gt(e.scale),h=gt(e.translation);return{scaled:_o({clientX:i.x,clientY:i.y},s,r,l,u,f,h),scale:f}}function xu(n,e,i){const{scale:s,translation:r}=i,l=gt(s),u=gt(r),f=e.x-n.x,h=e.y-n.y,_=u.x+f*l,m=u.y+h*l;return{x:_,y:m}}function Bu(n,e){return n.x*e.x+n.y*e.y}function Zu(n,e,i){const s=[],r=e.x-n.x,l=e.y-n.y,u=Ru(n.direction,e.direction),f=Bu(n.direction,e.direction)===0,h=Du(n,e),_=De(n.direction,-1,-1),m=De(e.direction,-1,-1),p={x:Math.abs(n.direction.y),y:Math.abs(n.direction.x)},w=De(n.direction,r-i*n.direction.x*(f?1:u?0:2),l-i*n.direction.y*(f?1:u?0:2)),b=De(e.direction,r+i*e.direction.x*(f?1:u?0:2),l+i*e.direction.y*(f?1:u?0:2)),k=Math.sign(w.x)===-1||Math.sign(w.y)===-1,C=Math.sign(b.x)===1||Math.sign(b.y)===1,M=Math.abs(r),E=Math.abs(l),T=De(n.direction,i,i),I=De(m,i,i),q=De(e.direction,i,i),j=De(n.direction,M,E),Y=De(m,M,E),at=De(n.direction,M/2,E/2),ct=De(m,M/2,E/2),st=De(p,r,l),nt=!h&&!C&&!k,Q=n.x+T.x,G=n.y+T.y,vt=e.x+q.x,X=e.y+q.y;if(k&&s.push(T),h&&!C&&!k)s.push(j),s.push(Y);else if(u)k||s.push(De(n.direction,i+M,i+E)),s.push(st),C||s.push(De(m,i+M,i+E));else if(nt)s.push(at),s.push(st),s.push(ct);else if(k&&C)if(f){const $=Math.abs(Q-vt),J=Math.abs(G-X);s.push(De(e.direction,M<i*2?e.direction.x*(r+e.direction.x*i):M+i,E<i*2?e.direction.y*(l+e.direction.y*i):E+i)),s.push(De(_,$,J))}else{const $=Math.abs(Q-vt),J=Math.abs(G-X);s.push(De(p,r/2,l/2)),s.push(De(e.direction,$,J)),s.push(De(p,r/2,l/2))}else if(k){const $=Math.abs(Q-e.x),J=Math.abs(G-e.y);s.push(De(m,M<i*2?M-i:M/2,E<i*2?E-i:E/2)),s.push(De(_,$,J)),s.push(De(m,Math.max(i,M/2),Math.max(i,E/2)))}else if(C){const $=Math.abs(vt-n.x),J=Math.abs(X-n.y);s.push(De(n.direction,Math.max(i,M/2),Math.max(i,E/2))),s.push(De(e.direction,$,J)),s.push(De(n.direction,M<i*2?M-i:M/2,E<i*2?E-i:E/2))}return C&&s.push(I),s}function Du(n,e){const{x:i,y:s}=n.direction,{x:r,y:l}=e.direction,u=e.x-n.x,f=e.y-n.y;return i*l===r*s?!1:Math.sign(f)===Math.sign(s+l)!=(Math.sign(u)===Math.sign(i+r))}function De(n,e,i){return{x:n.x*e,y:n.y*i}}function Ru(n,e){return n.x===e.x&&n.y===e.y}function Wu(n,e){const{width:i,height:s}=n,{top:r,left:l,right:u,bottom:f}=e,h=u-l,_=f-r;if(!h||!_)return{x:null,y:null,scale:null};const m=l+h/2,p=r+_/2,w=Math.min(i/h,s/_)*.8,b=i/2,k=s/2,C=b-m,M=k-p;return{x:C*w,y:M*w,scale:w}}const oo=(n,e,i)=>Math.min(Math.abs(n||e)/2,i);function Wo(n,e){const s=n.getTotalLength()*e;return n.getPointAtLength(s)}function Hu(n,e,i,s){return xi([n,e,i,s],([l,u,f,h])=>{const _={clientX:l.x,clientY:l.y};return _o(_,u.top,u.left,u.width,u.height,h,f)})}function Fu(n,e,i,s){const r=U({top:1/0,left:1/0,right:-1/0,bottom:-1/0}),l=U({top:1/0,left:1/0,right:-1/0,bottom:-1/0});let u,f=gt(e),h=gt(i),_=gt(s),m=f.width/h,p=f.height/h;function w(){const{x:k,y:C}=_o({clientX:f.left,clientY:f.top},f.top,f.left,f.width,f.height,h,_),M=gt(l);r.set({top:Math.min(M.top,C),left:Math.min(M.left,k),right:Math.max(M.right,k+m),bottom:Math.max(M.bottom,p+C)})}function b(k=!1){let C=1/0,M=1/0,E=-1/0,T=-1/0;for(const I of n.getAll()){console.log("dentro del for, este es e node:",I);const{x:q,y:j}=gt(I.position),Y=gt(I.dimensions.width),at=gt(I.dimensions.height);M=Math.min(M,q),C=Math.min(C,j),E=Math.max(E,q+Y),T=Math.max(T,j+at)}l.set({top:C,left:M,right:E,bottom:T}),w(),k&&(u=requestAnimationFrame(()=>b(k)))}return n.subscribe(()=>{console.log("dentro del nodes.subscribe...........Aqui no estan llegando los nodes"),b()}),Ko.subscribe(k=>{k&&b(k),k||cancelAnimationFrame(u)}),vn.subscribe(k=>{k&&b(k),k||cancelAnimationFrame(u)}),e.subscribe(()=>{f=gt(e),m=f.width/h,p=f.height/h,w()}),i.subscribe(()=>{h=gt(i),m=f.width/h,p=f.height/h,w()}),s.subscribe(()=>{_=gt(s),w()}),{graphBounds:r,nodeBounds:l}}function Gu(n,e,i){const{width:s,height:r,top:l,left:u}=n,f={clientX:s/2,clientY:r/2};return _o(f,l,u,s,r,i,e)}function ja(n,e){const{zoom:i,editable:s,translation:r,direction:l,locked:u,edge:f,nodes:h}=e,_=U({x:(r==null?void 0:r.x)||0,y:(r==null?void 0:r.y)||0}),m=U({top:0,left:0,width:0,height:0,bottom:0,right:0}),p=U(i),w=U(!1),b=co(),k=Fu(b,m,p,_),C=xi([m,_,p],([E,T,I])=>Gu(E,T,I));return{id:n,nodes:b,edges:yu(),transforms:{translation:_,scale:p},maxZIndex:U(2),dimensions:m,bounds:k,center:C,mounted:w,direction:l||"LR",editable:s||!1,edge:f||null,editing:U(null),cursor:Hu(Ha,m,_,p),locked:U(u||!1),groups:U({selected:{parent:U(null),nodes:U(new Set)},hidden:{parent:U(null),nodes:U(new Set)}}),groupBoxes:co(),activeGroup:U(null),initialNodePositions:U([])}}const Ho=co(),so={width:200,height:100};function lo(n,e){return{x:Math.round(n/so.width)*so.width,y:Math.round(e/so.height)*so.height}}const ro=10;function Xa(n){const e=gt(n);return Array.from(e).map(s=>gt(s.position))}function ju(n,e){console.log("moveNodes called");let i;const s=gt(n.groups),r=gt(n.activeGroup);if(console.log("Graph Groups:",s),console.log("Active Group:",r),!r)return;const l=s[r].nodes;if(!l)return;const u=gt(n.initialNodePositions),{x:f,y:h}=gt(mn),_=Array.from(gt(l)),m=gt(n.groupBoxes);console.log("Group Boxes:",m),_.forEach(w=>w.moving.set(!0)),p();function p(){const w=gt(n.cursor);let b=w.x-f,k=w.y-h;if(e){const M=lo(b,k);b=M.x,k=M.y}const C={x:b,y:k};_.forEach((M,E)=>{const{group:T,position:I}=M,q=u[E];let j;if(r==="selected"){const Y=gt(T);Y&&(j=m.get(Y))}if(!j)Xu(q,C,I);else{const Y=gt(M.dimensions.width),at=gt(M.dimensions.height),ct=Ya(j,Y,at);Ua(q,C,I,ct)}}),gt(vn)?i=requestAnimationFrame(p):cancelAnimationFrame(i)}}function Xu(n,e,i){i.set({x:n.x+e.x,y:n.y+e.y})}function Ua(n,e,i,s){i.set({x:Math.min(Math.max(s.left,n.x+e.x),s.right),y:Math.min(Math.max(s.top,n.y+e.y),s.bottom)})}function Ya(n,e,i){const{x:s,y:r}=gt(n.position);return console.log("Group Box Position:",{x:s,y:r}),{left:s+ro,right:s+gt(n.dimensions.width)-e-ro,top:r+ro,bottom:r+gt(n.dimensions.height)-i-ro}}function Vs(n=1,e,i,s=.1){const r=gt(e),{width:l,height:u,top:f,left:h}=r,_=i.scale,m=gt(i.translation),p=gt(_),w=Ga(p,n,s),b=Fa(p,w,m,{x:l/2+h,y:u/2+f},r);_.set(w),i.translation.set(b)}function Uu(n,e,i,s,r,l,u,f,h,_,m,p){const{width:w,height:b}=r,{x:k,y:C}=s,M=gt(e.position),E=U({x:k-M.x+w/2,y:C-M.y+b/2}),T=xi([e.position,E],([st,nt])=>({x:st.x+nt.x,y:st.y+nt.y})),I=n.transforms,q=n.dimensions,j=U(h||"self"),Y=()=>{const st=document.getElementById(i),nt=gt(j),Q=Ni[nt];if(!st)return;const{x:G,y:vt,width:X,height:$}=st.getBoundingClientRect(),J=gt(E),B=gt(T),{scaled:A,scale:Nt}=Ou(q,I,{x:G,y:vt}),V=A.x-B.x,yt=A.y-B.y;E.set({x:J.x+V+X/Nt/2+Q.x*X/Nt/2,y:J.y+yt+$/Nt/2+Q.y*$/Nt/2})},at=xi([e.moving,e.resizingWidth,e.resizingHeight,e.rotating],([st,nt,Q,G])=>st||nt||Q||G),ct=xi([e.rotation],([st])=>st);return{id:i,position:T,offset:E,direction:j,dynamic:U(_||!1),type:f,edge:u,moving:at,mounted:U(!1),recalculatePosition:Y,connected:U(new Set),store:l||null,inputKey:m||null,edgeColor:p||U(null),rotation:ct,node:e}}function Yu(n){var s,r;const e=JSON.parse(n);return ja(e.id,{...e,editable:e.editable,direction:e.direction,locked:e.locked,zoom:((s=e.transforms)==null?void 0:s.scale)??1,translation:((r=e.transforms)==null?void 0:r.translation)??{x:0,y:0},edge:e.edge})}function qu(n){let e;const i=n[2].default,s=de(i,n,n[1],null);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,[l]){s&&s.p&&(!e||l&2)&&me(s,i,r,r[1],e?_e(i,r[1],l,null):ge(r[1]),null)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Vu(n,e,i){let{$$slots:s={},$$scope:r}=e,{edge:l}=e;return Le("edge",l),n.$$set=u=>{"edge"in u&&i(0,l=u.edge),"$$scope"in u&&i(1,r=u.$$scope)},[l,r,s]}class qa extends nn{constructor(e){super(),en(this,e,Vu,qu,Ye,{edge:0})}}const Ku=n=>({hovering:n[0]&32768}),Ks=n=>({destroy:n[9],hovering:n[15]}),Ju=n=>({path:n[0]&4096,hovering:n[0]&32768}),Js=n=>({path:n[12],destroy:n[9],hovering:n[15]});function Qu(n){let e,i,s,r,l,u=(n[0]||n[1])&&Qs(n);const f=n[91].default,h=de(f,n,n[90],Js),_=h||$u(n);let m=n[10]&&$s(n);return{c(){e=ee("svg"),u&&u.c(),i=ee("path"),_&&_.c(),m&&m.c(),v(i,"role","presentation"),v(i,"id",n[38]+"-target"),v(i,"class","target svelte-ppcocz"),v(i,"d",n[12]),Xt(i,"cursor",n[38]==="cursor"||!n[4]&&!n[3]),et(i,"cursor",n[4]||n[15]?"pointer":"move"),et(i,"--prop-target-edge-color",n[4]||n[15]?n[8]||null:"transparent"),v(e,"class","edges-wrapper svelte-ppcocz"),et(e,"z-index",n[17])},m(p,w){lt(p,e,w),u&&u.m(e,null),S(e,i),n[94](i),_&&_.m(e,null),m&&m.m(e,null),n[95](e),s=!0,r||(l=[Ct(i,"mousedown",function(){Wi(n[4])&&n[4].apply(this,arguments)}),Ct(i,"mouseenter",n[92]),Ct(i,"mouseleave",n[93])],r=!0)},p(p,w){n=p,n[0]||n[1]?u?u.p(n,w):(u=Qs(n),u.c(),u.m(e,i)):u&&(u.d(1),u=null),(!s||w[0]&4096)&&v(i,"d",n[12]),(!s||w[0]&24|w[1]&128)&&Xt(i,"cursor",n[38]==="cursor"||!n[4]&&!n[3]),w[0]&32784&&et(i,"cursor",n[4]||n[15]?"pointer":"move"),w[0]&33040&&et(i,"--prop-target-edge-color",n[4]||n[15]?n[8]||null:"transparent"),h?h.p&&(!s||w[0]&36864|w[2]&268435456)&&me(h,f,n,n[90],s?_e(f,n[90],w,Ju):ge(n[90]),Js):_&&_.p&&(!s||w[0]&1052711)&&_.p(n,s?w:[-1,-1,-1,-1]),n[10]?m?(m.p(n,w),w[0]&1024&&N(m,1)):(m=$s(n),m.c(),N(m,1),m.m(e,null)):m&&(le(),R(m,1,1,()=>{m=null}),ue()),w[0]&131072&&et(e,"z-index",n[17])},i(p){s||(N(_,p),N(m),s=!0)},o(p){R(_,p),R(m),s=!1},d(p){p&&rt(e),u&&u.d(),n[94](null),_&&_.d(p),m&&m.d(),n[95](null),r=!1,tn(l)}}}function Qs(n){let e,i,s,r,l;return{c(){e=ee("defs"),i=ee("marker"),s=ee("polygon"),r=ee("marker"),l=ee("polygon"),v(s,"class","arrow svelte-ppcocz"),v(s,"points","0 0, 15 5, 0 10"),et(s,"--prop-edge-color",n[20]),v(i,"id",n[38]+"-end-arrow"),v(i,"viewBox","0 0 15 15"),v(i,"markerWidth","15"),v(i,"markerHeight","10"),v(i,"refX","12.5"),v(i,"refY","5"),v(i,"orient","auto"),v(l,"class","arrow svelte-ppcocz"),v(l,"points","0 5, 15 0, 15 10"),et(l,"--prop-edge-color",n[20]),v(r,"id",n[38]+"-start-arrow"),v(r,"viewBox","0 0 15 15"),v(r,"markerWidth","15"),v(r,"markerHeight","10"),v(r,"refX","0"),v(r,"refY","5"),v(r,"orient","auto")},m(u,f){lt(u,e,f),S(e,i),S(i,s),S(e,r),S(r,l)},p(u,f){f[0]&1048576&&et(s,"--prop-edge-color",u[20]),f[0]&1048576&&et(l,"--prop-edge-color",u[20])},d(u){u&&rt(e)}}}function $u(n){let e,i,s;return{c(){e=ee("path"),v(e,"id",n[38]),v(e,"class","edge svelte-ppcocz"),v(e,"d",n[12]),v(e,"marker-end",i=n[1]==="arrow"?`url(#${n[38]+"-end-arrow"})`:""),v(e,"marker-start",s=n[0]==="arrow"?`url(#${n[38]+"-start-arrow"})`:""),Xt(e,"animate",n[2]),et(e,"--prop-edge-color",n[20]),et(e,"--prop-stroke-width",n[5]?n[5]+"px":null)},m(r,l){lt(r,e,l)},p(r,l){l[0]&4096&&v(e,"d",r[12]),l[0]&2&&i!==(i=r[1]==="arrow"?`url(#${r[38]+"-end-arrow"})`:"")&&v(e,"marker-end",i),l[0]&1&&s!==(s=r[0]==="arrow"?`url(#${r[38]+"-start-arrow"})`:"")&&v(e,"marker-start",s),l[0]&4&&Xt(e,"animate",r[2]),l[0]&1048576&&et(e,"--prop-edge-color",r[20]),l[0]&32&&et(e,"--prop-stroke-width",r[5]?r[5]+"px":null)},d(r){r&&rt(e)}}}function $s(n){let e,i,s,r,l;const u=n[91].label,f=de(u,n,n[90],Ks),h=f||tc(n);return{c(){e=ee("foreignObject"),i=ot("span"),h&&h.c(),v(i,"class","label-wrapper svelte-ppcocz"),v(e,"x",s=n[14].x),v(e,"y",r=n[14].y),v(e,"width","100%"),v(e,"height","100%"),v(e,"class","svelte-ppcocz")},m(_,m){lt(_,e,m),S(e,i),h&&h.m(i,null),l=!0},p(_,m){f?f.p&&(!l||m[0]&32768|m[2]&268435456)&&me(f,u,_,_[90],l?_e(u,_[90],m,Ku):ge(_[90]),Ks):h&&h.p&&(!l||m[0]&2240)&&h.p(_,l?m:[-1,-1,-1,-1]),(!l||m[0]&16384&&s!==(s=_[14].x))&&v(e,"x",s),(!l||m[0]&16384&&r!==(r=_[14].y))&&v(e,"y",r)},i(_){l||(N(h,_),l=!0)},o(_){R(h,_),l=!1},d(_){_&&rt(e),h&&h.d(_)}}}function tc(n){let e,i;return{c(){e=ot("div"),i=je(n[11]),v(e,"class","default-label svelte-ppcocz"),et(e,"--prop-label-color",n[6]),et(e,"--prop-label-text-color",n[7])},m(s,r){lt(s,e,r),S(e,i)},p(s,r){r[0]&2048&&bn(i,s[11]),r[0]&64&&et(e,"--prop-label-color",s[6]),r[0]&128&&et(e,"--prop-label-text-color",s[7])},d(s){s&&rt(e)}}}function ec(n){let e,i,s=n[23]&&n[24]&&Qu(n);return{c(){s&&s.c(),e=pe()},m(r,l){s&&s.m(r,l),lt(r,e,l),i=!0},p(r,l){r[23]&&r[24]&&s.p(r,l)},i(r){i||(N(s),i=!0)},o(r){R(s),i=!1},d(r){r&&rt(e),s&&s.d(r)}}}let Fo;function nc(n){const e=n.parentNode;if(!e)return;e.removeChild(n);const i=document.querySelector(".svelvet-graph-wrapper");i&&i.appendChild(n)}function ic(n,e,i){var Kn,ki;let s,r,l,u,f,h,_,m,p,w,b,k,C,M,E,T,I,q,j,Y,at,ct,st,nt,Q,G,vt,X,$,J,B,A,Nt=Ot,V=()=>(Nt(),Nt=Je($,mt=>i(73,A=mt)),$),yt,Pt=Ot,dt=()=>(Pt(),Pt=Je(X,mt=>i(74,yt=mt)),X),Z,W,H,F,Gt,re,ht,Lt,St,xt,ne,ce,Se,K,he=Ot,Zt=()=>(he(),he=Je(l,mt=>i(88,K=mt)),l),Tt,Ut=Ot,we=()=>(Ut(),Ut=Je(r,mt=>i(89,Tt=mt)),r);n.$$.on_destroy.push(()=>Nt()),n.$$.on_destroy.push(()=>Pt()),n.$$.on_destroy.push(()=>he()),n.$$.on_destroy.push(()=>Ut());let{$$slots:Ne={},$$scope:We}=e;const Me=ts(Ne),Ft=te("edgeStore"),Ce=te("edgeStyle"),be=te("endStyles"),qe=te("raiseEdgesOnSelect"),ve=te("edgesAboveNode");let{edge:fe=te("edge")}=e,{straight:ze=Ce==="straight"}=e,{step:He=Ce==="step"}=e,{start:Xe=be[0]}=e,{end:xe=be[1]}=e,{animate:Ie=!1}=e,{label:D=""}=e,{enableHover:it=!1}=e,{edgeClick:Et=null}=e,{labelPosition:At=.5}=e,{width:$t=null}=e,{color:ie=null}=e,{labelColor:Qe=null}=e,{textColor:Te=null}=e,{cornerRadius:Dt=8}=e,{targetColor:ye=null}=e;const Yt=fe.source,Rt=fe.target,Ge=Yt.direction;ft(n,Ge,mt=>i(76,W=mt));const Ve=Rt.direction;ft(n,Ve,mt=>i(75,Z=mt));const fn=Yt.rotation;ft(n,fn,mt=>i(83,St=mt));const cn=Rt.rotation;ft(n,cn,mt=>i(82,Lt=mt));const Ke=Yt.position;ft(n,Ke,mt=>i(87,Se=mt));const oe=Rt.position;ft(n,oe,mt=>i(86,ce=mt));const _t=Yt.dynamic;ft(n,_t,mt=>i(79,Gt=mt));const an=Rt.dynamic;ft(n,an,mt=>i(78,F=mt));const hn=Yt.moving;ft(n,hn,mt=>i(81,ht=mt));const Be=Rt.moving;ft(n,Be,mt=>i(80,re=mt));const Bt=(Kn=Yt.node)==null?void 0:Kn.position;ft(n,Bt,mt=>i(85,ne=mt));const y=(ki=Rt.node)==null?void 0:ki.position;ft(n,y,mt=>i(84,xt=mt));const ut=fe.type;ft(n,ut,mt=>i(77,H=mt));const bt=fe.id;let wt,zt,O={x:0,y:0},qt=!1,ke=!1,se=!1,Fe=!1,ln=!1,on;fe.rendered.set(!0),zn(()=>{setTimeout(()=>{zt&&i(14,O=Wo(zt,At))},0),nc(on)}),Ia(()=>{zt&&i(14,O=Wo(zt,At))}),ho(()=>{on.remove(),cancelAnimationFrame(Fo)});function yn(){qt&&(zt&&i(14,O=Wo(zt,At)),Fo=requestAnimationFrame(yn))}function Dn(){if(Yt.id===null||Rt.id===null)return;const mt=Ft.match(Yt,Rt);Ft.delete(mt[0]),Yt==null||Yt.connected.update(Wt=>(Rt&&Wt.delete(Rt),Wt)),Rt==null||Rt.connected.update(Wt=>(Yt&&Wt.delete(Yt),Wt))}const ai=()=>i(15,ln=!0),bi=()=>i(15,ln=!1);function An(mt){Cn[mt?"unshift":"push"](()=>{zt=mt,i(13,zt)})}function Sn(mt){Cn[mt?"unshift":"push"](()=>{on=mt,i(16,on)})}return n.$$set=mt=>{"edge"in mt&&i(39,fe=mt.edge),"straight"in mt&&i(40,ze=mt.straight),"step"in mt&&i(41,He=mt.step),"start"in mt&&i(0,Xe=mt.start),"end"in mt&&i(1,xe=mt.end),"animate"in mt&&i(2,Ie=mt.animate),"label"in mt&&i(42,D=mt.label),"enableHover"in mt&&i(3,it=mt.enableHover),"edgeClick"in mt&&i(4,Et=mt.edgeClick),"labelPosition"in mt&&i(43,At=mt.labelPosition),"width"in mt&&i(5,$t=mt.width),"color"in mt&&i(44,ie=mt.color),"labelColor"in mt&&i(6,Qe=mt.labelColor),"textColor"in mt&&i(7,Te=mt.textColor),"cornerRadius"in mt&&i(45,Dt=mt.cornerRadius),"targetColor"in mt&&i(8,ye=mt.targetColor),"$$scope"in mt&&i(90,We=mt.$$scope)},n.$$.update=()=>{var mt;if(n.$$.dirty[2]&196608&&i(55,s=Gt||F),n.$$.dirty[1]&256&&Zt(i(21,l=(mt=fe.label)==null?void 0:mt.text)),n.$$.dirty[1]&8192|n.$$.dirty[2]&134217728&&i(20,u=ie||Tt||null),n.$$.dirty[1]&2048|n.$$.dirty[2]&67108864&&i(11,f=D||K||""),n.$$.dirty[0]&2048&&i(10,h=f||Me.label),n.$$.dirty[2]&33554432&&i(72,_=Se),n.$$.dirty[2]&16777216&&i(71,m=ce),n.$$.dirty[2]&8388608&&i(56,p=ne),n.$$.dirty[2]&4194304&&i(57,w=xt),n.$$.dirty[2]&1024&&i(52,b=_.x),n.$$.dirty[2]&1024&&i(51,k=_.y),n.$$.dirty[2]&512&&i(54,C=m.x),n.$$.dirty[2]&512&&i(53,M=m.y),n.$$.dirty[1]&10485760&&i(70,E=C-b),n.$$.dirty[1]&5242880&&i(69,T=M-k),n.$$.dirty[2]&256&&i(68,I=Math.abs(E)),n.$$.dirty[2]&128&&i(67,q=Math.abs(T)),n.$$.dirty[2]&64&&i(65,j=Math.max(30,Math.min(600,I/2))),n.$$.dirty[2]&32&&i(63,Y=Math.max(30,Math.min(600,q/2))),n.$$.dirty[1]&117833728&&s&&Yt.node&&Rt.node){const Wt=w.x-p.x,Pe=w.y-p.y;i(48,se=Pe>0),i(49,Fe=Wt>0);let gn,kn;if(se){const sn=gt(Yt.node.dimensions.height),Ae=p.y+sn;gn=w.y-Ae}else{const sn=gt(Rt.node.dimensions.height),Ae=w.y+sn;gn=p.y-Ae}if(Fe){const sn=gt(Yt.node.dimensions.width),Ae=p.x+sn;kn=w.x-Ae}else{const sn=gt(Rt.node.dimensions.width),Ae=w.x+sn;kn=p.x-Ae}i(47,ke=gn>kn)}if(n.$$.dirty[1]&17235968|n.$$.dirty[2]&196608&&s){let Wt,Pe;ke?(Wt=se?"south":"north",Pe=se?"north":"south"):(Wt=Fe?"east":"west",Pe=Fe?"west":"east"),Gt&&Mt(Ge,W=Wt,W),F&&Mt(Ve,Z=Pe,Z)}if(n.$$.dirty[2]&2113536&&i(66,at=qs(Ni[W],St||0)),n.$$.dirty[2]&1056768&&i(64,ct=qs(Ni[Z],Lt||0)),n.$$.dirty[1]&2097152|n.$$.dirty[2]&24&&i(62,st=b+at.x*j),n.$$.dirty[1]&1048576|n.$$.dirty[2]&18&&i(61,nt=k+at.y*Y),n.$$.dirty[1]&8388608|n.$$.dirty[2]&12&&i(60,Q=C+ct.x*j),n.$$.dirty[1]&4194304|n.$$.dirty[2]&6&&i(59,G=M+ct.y*Y),n.$$.dirty[1]&1879048192|n.$$.dirty[2]&1&&i(58,vt=`C ${st}, ${nt} ${Q}, ${G}`),n.$$.dirty[1]&149947904|n.$$.dirty[2]&32768&&(!He||bt==="cursor"||H==="bezier")&&i(12,wt=`M ${b}, ${k} ${ze?"":vt} ${C}, ${M}`),n.$$.dirty[0]&1024|n.$$.dirty[1]&32768|n.$$.dirty[2]&786432&&(h&&!qt&&(ht||re||bt==="cursor")?(i(46,qt=!0),yn()):qt&&!ht&&!re&&bt!=="cursor"&&(i(46,qt=!1),cancelAnimationFrame(Fo))),n.$$.dirty[1]&15746048|n.$$.dirty[2]&57344&&He&&bt!=="cursor"&&!(H&&H==="bezier")){const Wt={x:b,y:k,direction:Ni[W]},Pe={x:C,y:M,direction:Ni[Z]},gn=Zu(Wt,Pe,pu),kn=(sn,Ae,Ht)=>{if(Ae<gn.length-1){const Ze=Eu(sn,gn[Ae+1]);return zu(Ht,Ze)}return""};i(12,wt=gn.reduce((sn,Ae,Ht)=>{const Ze=Math.sign(Ae.x),Pi=Math.sign(Ae.y);let Jn=Ae.x,dn=Ae.y,Fi="";if(Dt){const Qn=gn[Ht+1]||{x:0,y:0},Nn=gn[Ht-1]||{x:0,y:0},Ue=oo(Ae.x,Qn.x,Dt),Rn=oo(Qn.y,Ae.y,Dt),$n=oo(Nn.x,Ae.x,Dt),ti=oo(Nn.y,Ae.y,Dt),li=Math.min($n,ti),Wn=Math.min(Ue,Rn);Ae.x?Jn=Ae.x-(Wn+li)*Ze:dn=Ae.y-(Wn+li)*Pi,Fi=kn(Ae,Ht,Wn)}return Au(sn,Jn,dn,Fi)},`M ${b}, ${k}`))}n.$$.dirty[2]&6144&&i(50,J=Math.max(yt,A)),n.$$.dirty[1]&524288|n.$$.dirty[2]&6144&&i(17,B=ve==="all"?1e5:ve?J:qe===!0?J-1:qe==="source"?yt-1:qe==="target"?A-1:0)},we(i(22,r=(Yt==null?void 0:Yt.edgeColor)||(Rt==null?void 0:Rt.edgeColor)||null)),dt(i(19,X=Yt.node.zIndex||0)),V(i(18,$=Rt.node.zIndex||0)),[Xe,xe,Ie,it,Et,$t,Qe,Te,ye,Dn,h,f,wt,zt,O,ln,on,B,$,X,u,l,r,Yt,Rt,Ge,Ve,fn,cn,Ke,oe,_t,an,hn,Be,Bt,y,ut,bt,fe,ze,He,D,At,ie,Dt,qt,ke,se,Fe,J,k,b,M,C,s,p,w,vt,G,Q,nt,st,Y,ct,j,at,q,I,T,E,m,_,A,yt,Z,W,H,F,Gt,re,ht,Lt,St,xt,ne,ce,Se,K,Tt,We,Ne,ai,bi,An,Sn]}class Va extends nn{constructor(e){super(),en(this,e,ic,ec,Ye,{edge:39,straight:40,step:41,start:0,end:1,animate:2,label:42,enableHover:3,edgeClick:4,labelPosition:43,width:5,color:44,labelColor:6,textColor:7,cornerRadius:45,targetColor:8,destroy:9},null,[-1,-1,-1,-1])}get destroy(){return this.$$.ctx[9]}}function oc(n){let e;return{c(){e=ot("div"),v(e,"class","svelvet-anchor svelte-19t6skv"),Xt(e,"output",n[0]),Xt(e,"input",n[1]),Xt(e,"connected",n[3]),Xt(e,"connecting",n[2]),Xt(e,"hovering",n[4]),et(e,"--prop-anchor-color",n[5])},m(i,s){lt(i,e,s)},p(i,[s]){s&1&&Xt(e,"output",i[0]),s&2&&Xt(e,"input",i[1]),s&8&&Xt(e,"connected",i[3]),s&4&&Xt(e,"connecting",i[2]),s&16&&Xt(e,"hovering",i[4]),s&32&&et(e,"--prop-anchor-color",i[5])},i:Ot,o:Ot,d(i){i&&rt(e)}}}function sc(n,e,i){let{output:s}=e,{input:r}=e,{connecting:l}=e,{connected:u}=e,{hovering:f}=e,{bgColor:h}=e;return n.$$set=_=>{"output"in _&&i(0,s=_.output),"input"in _&&i(1,r=_.input),"connecting"in _&&i(2,l=_.connecting),"connected"in _&&i(3,u=_.connected),"hovering"in _&&i(4,f=_.hovering),"bgColor"in _&&i(5,h=_.bgColor)},[s,r,l,u,f,h]}class rc extends nn{constructor(e){super(),en(this,e,sc,oc,Ye,{output:0,input:1,connecting:2,connected:3,hovering:4,bgColor:5})}}const ac=n=>({}),tr=n=>({});function er(n){const e=n.slice(),i=e[7].component;return e[86]=i,e}function Go(n){const e=n.slice(),i=e[14].get("cursor");return e[7]=i,e}function nr(n,e,i){const s=n.slice();s[87]=e[i];const r=s[14].fetch(s[23],s[87]);return s[7]=r,s}const lc=n=>({}),ir=n=>({});function jo(n){const e=n.slice(),i=e[7].component;return e[86]=i,e}const uc=n=>({linked:n[0]&512,hovering:n[0]&1024,connecting:n[0]&2048}),or=n=>{var e;return{linked:((e=n[9])==null?void 0:e.size)>=1,hovering:n[10],connecting:n[11]}};function sr(n){var s;let e,i;return e=new rc({props:{output:n[2],input:n[1],connecting:n[11],hovering:n[10],bgColor:n[0],connected:((s=n[9])==null?void 0:s.size)>=1}}),{c(){Qt(e.$$.fragment)},m(r,l){Vt(e,r,l),i=!0},p(r,l){var f;const u={};l[0]&4&&(u.output=r[2]),l[0]&2&&(u.input=r[1]),l[0]&2048&&(u.connecting=r[11]),l[0]&1024&&(u.hovering=r[10]),l[0]&1&&(u.bgColor=r[0]),l[0]&512&&(u.connected=((f=r[9])==null?void 0:f.size)>=1),e.$set(u)},i(r){i||(N(e.$$.fragment,r),i=!0)},o(r){R(e.$$.fragment,r),i=!1},d(r){Kt(e,r)}}}function cc(n){let e,i,s=!n[5]&&sr(n);return{c(){s&&s.c(),e=pe()},m(r,l){s&&s.m(r,l),lt(r,e,l),i=!0},p(r,l){r[5]?s&&(le(),R(s,1,1,()=>{s=null}),ue()):s?(s.p(r,l),l[0]&32&&N(s,1)):(s=sr(r),s.c(),N(s,1),s.m(e.parentNode,e))},i(r){i||(N(s),i=!0)},o(r){R(s),i=!1},d(r){r&&rt(e),s&&s.d(r)}}}function rr(n){let e,i;return e=new qa({props:{edge:n[7],$$slots:{default:[_c]},$$scope:{ctx:n}}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[0]&512&&(l.edge=s[7]),r[0]&512|r[1]&8388608&&(l.$$scope={dirty:r,ctx:s}),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function hc(n){let e,i;return e=new Va({}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function fc(n){let e,i;return e=new n[86]({}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function dc(n){let e,i,s,r;const l=[fc,hc],u=[];function f(h,_){return h[86]?0:1}return e=f(n),i=u[e]=l[e](n),{c(){i.c(),s=pe()},m(h,_){u[e].m(h,_),lt(h,s,_),r=!0},p(h,_){let m=e;e=f(h),e!==m&&(le(),R(u[m],1,1,()=>{u[m]=null}),ue(),i=u[e],i||(i=u[e]=l[e](h),i.c()),N(i,1),i.m(s.parentNode,s))},i(h){r||(N(i),r=!0)},o(h){R(i),r=!1},d(h){h&&rt(s),u[e].d(h)}}}function _c(n){let e;const i=n[50].edge,s=de(i,n,n[54],ir),r=s||dc(n);return{c(){r&&r.c()},m(l,u){r&&r.m(l,u),e=!0},p(l,u){s?s.p&&(!e||u[1]&8388608)&&me(s,i,l,l[54],e?_e(i,l[54],u,lc):ge(l[54]),ir):r&&r.p&&(!e||u[0]&512)&&r.p(l,e?u:[-1,-1,-1])},i(l){e||(N(r,l),e=!0)},o(l){R(r,l),e=!1},d(l){r&&r.d(l)}}}function ar(n,e){let i,s,r,l=e[7]&&e[7].source===e[23]&&rr(jo(e));return{key:n,first:null,c(){i=pe(),l&&l.c(),s=pe(),this.first=i},m(u,f){lt(u,i,f),l&&l.m(u,f),lt(u,s,f),r=!0},p(u,f){e=u,e[7]&&e[7].source===e[23]?l?(l.p(jo(e),f),f[0]&512&&N(l,1)):(l=rr(jo(e)),l.c(),N(l,1),l.m(s.parentNode,s)):l&&(le(),R(l,1,1,()=>{l=null}),ue())},i(u){r||(N(l),r=!0)},o(u){R(l),r=!1},d(u){u&&(rt(i),rt(s)),l&&l.d(u)}}}function lr(n){let e,i,s=n[7]&&mc(er(n));return{c(){s&&s.c(),e=pe()},m(r,l){s&&s.m(r,l),lt(r,e,l),i=!0},p(r,l){r[7]&&s.p(er(r),l)},i(r){i||(N(s),i=!0)},o(r){R(s),i=!1},d(r){r&&rt(e),s&&s.d(r)}}}function mc(n){let e,i;return e=new qa({props:{edge:n[7],$$slots:{default:[yc]},$$scope:{ctx:n}}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[1]&8388608&&(l.$$scope={dirty:r,ctx:s}),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function gc(n){let e,i;return e=new Va({}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function pc(n){let e,i;return e=new n[86]({}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function vc(n){let e,i,s,r;const l=[pc,gc],u=[];function f(h,_){return h[86]?0:1}return e=f(n),i=u[e]=l[e](n),{c(){i.c(),s=pe()},m(h,_){u[e].m(h,_),lt(h,s,_),r=!0},p:Ot,i(h){r||(N(i),r=!0)},o(h){R(i),r=!1},d(h){h&&rt(s),u[e].d(h)}}}function yc(n){let e;const i=n[50].edge,s=de(i,n,n[54],tr),r=s||vc(n);return{c(){r&&r.c()},m(l,u){r&&r.m(l,u),e=!0},p(l,u){s&&s.p&&(!e||u[1]&8388608)&&me(s,i,l,l[54],e?_e(i,l[54],u,ac):ge(l[54]),tr)},i(l){e||(N(r,l),e=!0)},o(l){R(r,l),e=!1},d(l){r&&r.d(l)}}}function wc(n){let e,i,s,r=[],l=new Map,u,f,h,_,m;const p=n[50].default,w=de(p,n,n[54],or),b=w||cc(n);let k=Ee(Array.from(n[9]));const C=E=>E[87].id;for(let E=0;E<k.length;E+=1){let T=nr(n,k,E),I=C(T);l.set(I,r[E]=ar(I,T))}let M=n[11]&&lr(Go(n));return{c(){var E;e=ot("div"),b&&b.c(),s=pt();for(let T=0;T<r.length;T+=1)r[T].c();u=pt(),M&&M.c(),f=pe(),v(e,"id",(E=n[23])==null?void 0:E.id),v(e,"class","anchor-wrapper svelte-bazd6o"),v(e,"role","button"),v(e,"tabindex","0"),v(e,"title",i=n[6]||""),Xt(e,"locked",n[4])},m(E,T){lt(E,e,T),b&&b.m(e,null),n[53](e),lt(E,s,T);for(let I=0;I<r.length;I+=1)r[I]&&r[I].m(E,T);lt(E,u,T),M&&M.m(E,T),lt(E,f,T),h=!0,_||(m=[Ct(e,"mouseenter",n[51]),Ct(e,"mouseleave",n[52]),Ct(e,"mousedown",En(wn(n[25]))),Ct(e,"mouseup",En(n[24])),Ct(e,"touchstart",En(wn(n[25]))),Ct(e,"touchend",En(n[24]))],_=!0)},p(E,T){w?w.p&&(!h||T[0]&3584|T[1]&8388608)&&me(w,p,E,E[54],h?_e(p,E[54],T,uc):ge(E[54]),or):b&&b.p&&(!h||T[0]&3623)&&b.p(E,h?T:[-1,-1,-1]),(!h||T[0]&64&&i!==(i=E[6]||""))&&v(e,"title",i),(!h||T[0]&16)&&Xt(e,"locked",E[4]),T[0]&8405504|T[1]&8388608&&(k=Ee(Array.from(E[9])),le(),r=Un(r,T,C,1,E,k,l,u.parentNode,Ri,ar,u,nr),ue()),E[11]?M?(M.p(Go(E),T),T[0]&2048&&N(M,1)):(M=lr(Go(E)),M.c(),N(M,1),M.m(f.parentNode,f)):M&&(le(),R(M,1,1,()=>{M=null}),ue())},i(E){if(!h){N(b,E);for(let T=0;T<k.length;T+=1)N(r[T]);N(M),h=!0}},o(E){R(b,E);for(let T=0;T<r.length;T+=1)R(r[T]);R(M),h=!1},d(E){E&&(rt(e),rt(s),rt(u),rt(f)),b&&b.d(E),n[53](null);for(let T=0;T<r.length;T+=1)r[T].d(E);M&&M.d(E),_=!1,tn(m)}}}let Xo;const Bn=U(null);function bc(n,e,i){if(e==="self")return;const s=n.parentNode;if(!s)return;s.removeChild(n);const r=document.querySelector(`#anchors-${e}-${i.id}`);r&&(r.appendChild(n),n&&i.recalculateAnchors())}function kc(n,e,i){let s,r,l,u,f=Ot,h=()=>(f(),f=Je(ht,y=>i(55,u=y)),ht),_,m=Ot,p,w,b=Ot,k=()=>(b(),b=Je(r,y=>i(9,w=y)),r),C,M,E,T,I=Ot,q=()=>(I(),I=Je(l,y=>i(47,T=y)),l),j,Y,at,ct;ft(n,Bn,y=>i(42,_=y)),n.$$.on_destroy.push(()=>f()),n.$$.on_destroy.push(()=>m()),n.$$.on_destroy.push(()=>b()),n.$$.on_destroy.push(()=>I());let{$$slots:st={},$$scope:nt}=e;const Q=te("dynamic"),G=te("node"),vt=te("edgeStore"),X=te("cursorAnchor"),$=te("direction"),J=te("mounted");ft(n,J,y=>i(49,Y=y));const B=te("graph"),A=te("nodeStore"),Nt=te("graphEdge"),V=te("nodeConnectEvent");ft(n,V,y=>i(43,p=y));const yt=te("anchorsMounted");ft(n,yt,y=>i(56,at=y));const Pt=te("flowchart")||void 0;let{bgColor:dt=null}=e,{id:Z=0}=e,{input:W=!1}=e,{output:H=!1}=e,{multiple:F=H?!0:!W}=e,{dynamic:Gt=Q||!1}=e,{edge:re=null}=e,{inputsStore:ht=null}=e;h();let{key:Lt=null}=e,{outputStore:St=null}=e,{connections:xt=[]}=e,{edgeColor:ne=U(null)}=e,{edgeLabel:ce=""}=e,{locked:Se=!1}=e,{nodeConnect:K=!1}=e,{edgeStyle:he=null}=e,{endStyles:Zt=[null,null]}=e,{invisible:Tt=!1}=e,{direction:Ut=$==="TD"?W?"north":"south":W?"west":"east"}=e,{title:we=""}=e;const Ne=wi(),We=wi();let Me,Ft=!1,Ce=!1,be=0,qe=W===H?null:W?"input":"output",ve=[];const fe=G.edge,ze=G.anchors;ft(n,ze,y=>i(48,j=y));const He=G.resizingWidth;ft(n,He,y=>i(46,E=y));const Xe=G.resizingHeight;ft(n,Xe,y=>i(45,M=y));const xe=G.rotating;ft(n,xe,y=>i(44,C=y));const Ie=G.connections;ft(n,Ie,y=>i(57,ct=y));const D=`A-${Z||ze.count()+1}/${G.id}`,it=Uu(B,G,D,{x:0,y:0},{width:0,height:0},ht||St||null,re||fe||Nt||null,qe,Ut,Gt,Lt,ne);ze.add(it,it.id),zn(()=>{Me&&it.recalculatePosition();const y=Array.from(gt(G.anchors)).reduce((ut,[,bt])=>(bt.type==="output"&&ut++,ut),0);if(ct!=null&&ct.length&&!W){const ut=[];let bt=null;ct.forEach((wt,zt)=>{wt&&(bt===null&&(bt=zt),(zt-bt)%y===0?(ve.push(wt),ut.push(null)):ut.push(wt))}),Mt(Ie,ct=ut,ct)}Mt(yt,at++,at)}),Ia(()=>{Me&&it.recalculatePosition()}),ho(()=>{fn(),cancelAnimationFrame(Xo)});function Et(y){var ke;vt.delete("cursor");const ut={x:y.changedTouches[0].clientX,y:y.changedTouches[0].clientY},bt=document.elementFromPoint(ut.x,ut.y);if(!bt)return;const wt=bt.parentElement;if(!wt)return;const zt=wt.id,O=zt.split("/")[1],qt=(ke=A.get(O))==null?void 0:ke.anchors.get(zt);qt&&(vt.delete("cursor"),At(it,qt,y))}function At(y,ut,bt){const wt=ye(y,ut);wt&&Yt(),bt.shiftKey||Ge(wt)}function $t(y){if("changedTouches"in y&&s){Et(y);return}if(!s){if(w!=null&&w.size&&!F){vt.delete("cursor"),y.shiftKey||Ge(!1);return}_&&Dt(y)}}function ie(y){if(!Se){if(w!=null&&w.size&&!F&&!_)return cn();if(!_)return Qe();Dt(y)}}function Qe(){W===H?(Mt(Bn,_={anchor:it,store:null,key:null},_),Te(it,X)):W?(Mt(Bn,_={anchor:it,store:ht,key:Lt},_),Te(X,it)):H&&(Mt(Bn,_={anchor:it,store:St,key:null},_),Te(it,X))}function Te(y,ut,bt=!1){const wt={color:ne,label:{text:ce}};bt&&(wt.disconnect=!0),he&&(wt.type=he),Zt[0]&&(wt.start=Zt[0]),Zt[1]&&(wt.start=Zt[1]);const zt=Xs({source:y,target:ut},(y==null?void 0:y.edge)||null,wt);vt.add(zt,"cursor")}function Dt(y){if(vt.delete("cursor"),!_)return;const ut=_.anchor.type;if(_.anchor===it||ut===it.type&&ut){Ge(!1);return}it.recalculatePosition();let bt,wt;W===H?ut==="input"?(bt=it,wt=_.anchor):(bt=_.anchor,wt=it):W?(bt=_.anchor,wt=it):(bt=it,wt=_.anchor),At(bt,wt,y)}function ye(y,ut){if(y===ut||gt(y.connected).has(it))return!1;const bt={color:ne,label:{text:ce}};if(Pt){const zt=y.node.id.slice(2),O=Pt.nodeList[zt];if(O){const qt=ut.node.id.slice(2),ke=O.children.filter(se=>se.node.id===qt)[0];if(ke){const se=ke;bt.label={text:se.content}}}}he&&(bt.type=he),Zt[0]&&(bt.start=Zt[0]),Zt[1]&&(bt.start=Zt[1]);const wt=Xs({source:y,target:ut},(y==null?void 0:y.edge)||null,bt);return!y.node||!ut.node?!1:(vt.add(wt,new Set([y,ut,y.node,ut.node])),!0)}function Yt(){if(W&&_&&_.store)u&&Lt&&ht&&typeof ht.set=="function"&&typeof ht.update=="function"&&Mt(ht,u[Lt]=_.store,u);else if(H&&_&&_.store){const{store:y,key:ut}=_;y&&ut&&typeof y.update=="function"&&y.update(bt=>(St&&(bt[ut]=St),bt))}}function Rt(){u&&Lt&&u[Lt]&&Mt(ht,u[Lt]=U(gt(u[Lt])),u)}function Ge(y){(y||!p)&&(Mt(Bn,_=null,_),Mt(V,p=null,p))}function Ve(){Ft&&(Me&&it.recalculatePosition(),Xo=requestAnimationFrame(Ve))}function fn(){vt.delete("cursor"),vt.match(it).forEach(ut=>vt.delete(ut)),Ge(!1),Rt()}function cn(){if(gt(it.connected).size>1)return;const y=Array.from(gt(it.connected))[0];if(y.type!=="input")if(fn(),y.type==="output"){Te(y,X,!0),Rt();const ut=y.store;Mt(Bn,_={anchor:y,store:ut,key:null},_)}else Te(y,X,!0),Mt(Bn,_={anchor:y,store:null,key:null},_)}function Ke(){ve.forEach((y,ut)=>{if(!y)return;an(y)&&i(26,xt[ut]=null,xt)}),i(41,ve=ve.filter(y=>y!==null))}function oe(){xt.forEach(y=>{y&&an(y)})}function _t(y){const ut=`N-${y[0]}`,bt=A.get(ut);if(!bt)return;const wt=bt.anchors.get(`A-${y[1]}/N-${y[0]}`);if(!wt)return;const zt=vt.match(it,wt);zt&&vt.delete(zt[0])}const an=y=>{let ut,bt,wt=null;Array.isArray(y)?(ut=y[0].toString(),bt=y[1].toString()):(ut=y.toString(),bt=null);const zt=`N-${ut}`,O=A.get(zt);if(!O)return!1;if(bt){const qt=`A-${bt}/${zt}`;wt=O.anchors.get(qt)||null}else{const qt=gt(O.anchors),ke=Array.from(qt.values());if(!ke.length)return!1;wt=ke.reduce((se,Fe)=>!se&&Fe.type==="output"?null:Fe.type==="output"?se:!se||gt(Fe.connected).size<gt(se.connected).size?Fe:se,null)}if(!wt)return!1;if(ye(it,wt),wt.store&&(ht||St)){if(W&&wt.type==="output")u&&Lt&&ht&&typeof ht.set=="function"&&typeof ht.update=="function"&&Mt(ht,u[Lt]=wt.store,u);else if(H&&wt.type==="input"){const{store:qt,inputKey:ke}=wt;qt&&ke&&typeof qt.update=="function"&&qt.update(se=>(St&&(se[ke]=St),se))}}return!0},hn=()=>i(10,Ce=!0),Be=()=>i(10,Ce=!1);function Bt(y){Cn[y?"unshift":"push"](()=>{Me=y,i(8,Me)})}return n.$$set=y=>{"bgColor"in y&&i(0,dt=y.bgColor),"id"in y&&i(27,Z=y.id),"input"in y&&i(1,W=y.input),"output"in y&&i(2,H=y.output),"multiple"in y&&i(28,F=y.multiple),"dynamic"in y&&i(29,Gt=y.dynamic),"edge"in y&&i(7,re=y.edge),"inputsStore"in y&&h(i(3,ht=y.inputsStore)),"key"in y&&i(30,Lt=y.key),"outputStore"in y&&i(31,St=y.outputStore),"connections"in y&&i(26,xt=y.connections),"edgeColor"in y&&i(32,ne=y.edgeColor),"edgeLabel"in y&&i(33,ce=y.edgeLabel),"locked"in y&&i(4,Se=y.locked),"nodeConnect"in y&&i(34,K=y.nodeConnect),"edgeStyle"in y&&i(35,he=y.edgeStyle),"endStyles"in y&&i(36,Zt=y.endStyles),"invisible"in y&&i(5,Tt=y.invisible),"direction"in y&&i(37,Ut=y.direction),"title"in y&&i(6,we=y.title),"$$scope"in y&&i(54,nt=y.$$scope)},n.$$.update=()=>{if(n.$$.dirty[1]&2048&&i(11,s=(_==null?void 0:_.anchor)===it),n.$$.dirty[0]&536871168|n.$$.dirty[1]&65536&&Gt&&Me&&bc(Me,T,G),n.$$.dirty[0]&67108864|n.$$.dirty[1]&262144&&Y===A.count()&&xt.length&&oe(),n.$$.dirty[1]&4104&&K&&p&&$t(p),n.$$.dirty[1]&263168&&Y===A.count()&&ve.length&&Ke(),n.$$.dirty[0]&768|n.$$.dirty[1]&196608&&Me&&it.recalculatePosition(),n.$$.dirty[1]&57600&&(!Ft&&(E||M||C)?(i(39,Ft=!0),Ve()):!E&&!M&&Ft&&!C&&(i(39,Ft=!1),cancelAnimationFrame(Xo))),n.$$.dirty[0]&512|n.$$.dirty[1]&512&&w){if(w.size<be)We("disconnection",{node:G,anchor:it});else if(w.size>be){const y=Array.from(w),ut=y[y.length-1];Ne("connection",{node:G,anchor:it,connectedNode:ut.node,connectedAnchor:ut})}i(40,be=w.size)}},k(i(13,r=it&&it.connected)),q(i(12,l=it==null?void 0:it.direction)),[dt,W,H,ht,Se,Tt,we,re,Me,w,Ce,s,l,r,vt,J,V,yt,ze,He,Xe,xe,Ie,it,$t,ie,xt,Z,F,Gt,Lt,St,ne,ce,K,he,Zt,Ut,_t,Ft,be,ve,_,p,C,M,E,T,j,Y,st,hn,Be,Bt,nt]}class mo extends nn{constructor(e){super(),en(this,e,kc,wc,Ye,{bgColor:0,id:27,input:1,output:2,multiple:28,dynamic:29,edge:7,inputsStore:3,key:30,outputStore:31,connections:26,edgeColor:32,edgeLabel:33,locked:4,nodeConnect:34,edgeStyle:35,endStyles:36,invisible:5,direction:37,title:6,disconnect:38},null,[-1,-1,-1])}get disconnect(){return this.$$.ctx[38]}}function ur(n){let e,i,s,r,l;return{c(){e=ot("div"),i=pt(),s=ot("div"),v(e,"class","left svelte-1ryxg7v"),Xt(e,"width",n[0]),v(s,"class","right svelte-1ryxg7v"),Xt(s,"width",n[0])},m(u,f){lt(u,e,f),lt(u,i,f),lt(u,s,f),r||(l=[Vn(n[16].call(null,e,{left:n[3]})),Vn(n[16].call(null,s,{right:n[4]}))],r=!0)},p(u,f){f[0]&1&&Xt(e,"width",u[0]),f[0]&1&&Xt(s,"width",u[0])},d(u){u&&(rt(e),rt(i),rt(s)),r=!1,tn(l)}}}function cr(n){let e,i,s,r,l;return{c(){e=ot("div"),i=pt(),s=ot("div"),v(e,"class","top svelte-1ryxg7v"),Xt(e,"height",n[1]),v(s,"class","bottom svelte-1ryxg7v"),Xt(s,"height",n[1])},m(u,f){lt(u,e,f),lt(u,i,f),lt(u,s,f),r||(l=[Vn(n[16].call(null,e,{top:n[5]})),Vn(n[16].call(null,s,{bottom:n[6]}))],r=!0)},p(u,f){f[0]&2&&Xt(e,"height",u[1]),f[0]&2&&Xt(s,"height",u[1])},d(u){u&&(rt(e),rt(i),rt(s)),r=!1,tn(l)}}}function Pc(n){let e,i,s;return{c(){e=ot("div"),v(e,"class","svelte-1ryxg7v"),Xt(e,"both",n[7])},m(r,l){lt(r,e,l),i||(s=Vn(n[16].call(null,e,{both:n[7]})),i=!0)},p:Ot,d(r){r&&rt(e),i=!1,s()}}}function hr(n){let e,i,s;return{c(){e=ot("div"),v(e,"class","svelte-1ryxg7v"),Xt(e,"rotation",n[2])},m(r,l){lt(r,e,l),i||(s=Vn(n[17].call(null,e)),i=!0)},p(r,l){l[0]&4&&Xt(e,"rotation",r[2])},d(r){r&&rt(e),i=!1,s()}}}function Lc(n){let e,i,s,r,l=n[0]&&ur(n),u=n[1]&&cr(n),f=n[7]&&Pc(n),h=n[2]&&hr(n);return{c(){l&&l.c(),e=pt(),u&&u.c(),i=pt(),f&&f.c(),s=pt(),h&&h.c(),r=pe()},m(_,m){l&&l.m(_,m),lt(_,e,m),u&&u.m(_,m),lt(_,i,m),f&&f.m(_,m),lt(_,s,m),h&&h.m(_,m),lt(_,r,m)},p(_,m){_[0]?l?l.p(_,m):(l=ur(_),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),_[1]?u?u.p(_,m):(u=cr(_),u.c(),u.m(i.parentNode,i)):u&&(u.d(1),u=null),_[7]&&f.p(_,m),_[2]?h?h.p(_,m):(h=hr(_),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null)},i:Ot,o:Ot,d(_){_&&(rt(e),rt(i),rt(s),rt(r)),l&&l.d(_),u&&u.d(_),f&&f.d(_),h&&h.d(_)}}}function Cc(n){return n*(180/Math.PI)}function Sc(n,e,i){let s,r,l,u,f,h,_,m,p,w,b,k;ft(n,mn,ht=>i(38,_=ht));const C=te("graph"),M=te("node"),E=te("resized");let{width:T=!1}=e,{height:I=!1}=e,{rotation:q=!1}=e,{minHeight:j=0}=e,{minWidth:Y=0}=e,at,ct=T,st=T,nt=I,Q=I,G=T&&I,vt=0,X=0,$=gt(M.position);const J=M.position;ft(n,J,ht=>i(32,b=ht));const B=M.resizingWidth;ft(n,B,ht=>i(31,w=ht));const A=M.resizingHeight;ft(n,A,ht=>i(30,p=ht));const Nt=M.rotating;ft(n,Nt,ht=>i(28,h=ht));const V=M.rotation;ft(n,V,ht=>i(29,m=ht));const yt=M.dimensions.height;ft(n,yt,ht=>i(26,u=ht));const Pt=M.dimensions.width;ft(n,Pt,ht=>i(27,f=ht));const dt=C.cursor;ft(n,dt,ht=>i(33,k=ht));let Z,W,H=1;zn(()=>{try{at=document.querySelector(`#${M.id}`),at&&i(19,[Y,j]=Ro(at),Y,i(18,j))}catch(ht){console.error(ht)}});function F(ht,Lt){const St=ne=>{ne.stopPropagation(),ne.preventDefault(),Lt.left||Lt.top?i(23,H=-1):i(23,H=1),Ko.set(!0),Mt(mn,_=gt(dt),_),i(21,Z=f),i(22,W=u),i(20,$=b),Lt.both?Mt(B,w=!0,w):Mt(B,w=!1,w),Mt(B,w=Lt.left||Lt.right||Lt.both||!1,w),Mt(A,p=Lt.top||Lt.bottom||Lt.both||!1,p),at&&i(19,[Y,j]=Ro(at),Y,i(18,j)),window.addEventListener("mouseup",xt)},xt=()=>{Mt(B,w=!1,w),Mt(A,p=!1,p),Ko.set(!1),window.removeEventListener("mouseup",xt)};return ht.addEventListener("mousedown",St),{destroy(){ht.removeEventListener("mousedown",St)}}}function Gt(ht){const Lt=xt=>{xt.stopPropagation(),xt.preventDefault(),vt=m,Mt(mn,_=gt(dt),_);const ne=_.x-l.x,ce=_.y-l.y;X=Math.atan2(ce,ne),Mt(Nt,h=!0,h),window.addEventListener("mouseup",St)},St=()=>{Mt(Nt,h=!1,h),window.removeEventListener("mouseup",St)};return ht.addEventListener("mousedown",Lt),{destroy(){ht.removeEventListener("mousedown",Lt)}}}function re(){const ht=gt(dt),Lt=ht.x-l.x,St=ht.y-l.y,xt=Math.atan2(St,Lt),ne=X-xt;return vt-Cc(ne)}return eu(()=>{at&&i(19,[Y,j]=Ro(at),Y,i(18,j)),f<Y&&E.set(!1),u<j&&E.set(!1)}),n.$$set=ht=>{"width"in ht&&i(0,T=ht.width),"height"in ht&&i(1,I=ht.height),"rotation"in ht&&i(2,q=ht.rotation),"minHeight"in ht&&i(18,j=ht.minHeight),"minWidth"in ht&&i(19,Y=ht.minWidth)},n.$$.update=()=>{if(n.$$.dirty[0]&268435456|n.$$.dirty[1]&4&&h&&Mt(V,m=re(),m),n.$$.dirty[0]&1624506368|n.$$.dirty[1]&4&&p){const ht=gt(mn),Lt=k,St=Math.max(j,W+(Lt.y-ht.y)*H);St>j?(E.set(!0),Mt(yt,u=St,u)):E.set(!1),H===-1&&Mt(J,b={x:$.x,y:$.y+Lt.y-ht.y},b),m!==0&&M.position.update(xt=>({y:$.y-(St-W)/2,x:xt.x}))}if(n.$$.dirty[0]&548929536|n.$$.dirty[1]&5&&w){const ht=gt(mn),Lt=k,St=Math.max(Y,Z+(Lt.x-ht.x)*H);St>Y?(E.set(!0),Mt(Pt,f=St,f)):E.set(!1),H===-1&&Mt(J,b={x:$.x+Lt.x-ht.x,y:$.y},b),m!==0&&M.position.update(xt=>({x:$.x-(St-Z)/2,y:xt.y}))}n.$$.dirty[1]&2&&i(25,s=b.x),n.$$.dirty[1]&2&&i(24,r=b.y),n.$$.dirty[0]&251658240&&(l={x:s+f/2,y:r+u/2})},[T,I,q,ct,st,nt,Q,G,J,B,A,Nt,V,yt,Pt,dt,F,Gt,j,Y,$,Z,W,H,r,s,u,f,h,m,p,w,b,k]}class Mc extends nn{constructor(e){super(),en(this,e,Sc,Lc,Ye,{width:0,height:1,rotation:2,minHeight:18,minWidth:19},null,[-1,-1])}}function fr(n,e,i){const s=n.slice();return s[28]=e[i],s[34]=i,s}function dr(n,e,i){const s=n.slice();return s[28]=e[i],s[34]=i,s}function _r(n,e,i){const s=n.slice();return s[28]=e[i],s}function mr(n,e,i){const s=n.slice();return s[28]=e[i],s}function Tc(n){let e,i=[],s=new Map,r,l,u=[],f=new Map,h,_=Ee({length:n[2]});const m=b=>b[34];for(let b=0;b<_.length;b+=1){let k=dr(n,_,b),C=m(k);s.set(C,i[b]=gr(C,k))}let p=Ee({length:n[3]});const w=b=>b[34];for(let b=0;b<p.length;b+=1){let k=fr(n,p,b),C=w(k);f.set(C,u[b]=pr(C,k))}return{c(){e=ot("div");for(let b=0;b<i.length;b+=1)i[b].c();r=pt(),l=ot("div");for(let b=0;b<u.length;b+=1)u[b].c();v(e,"class","input-anchors svelte-j5bq7k"),Xt(e,"top",n[14]),Xt(e,"left",n[16]),v(l,"class","output-anchors svelte-j5bq7k"),Xt(l,"bottom",n[15]),Xt(l,"right",n[17])},m(b,k){lt(b,e,k);for(let C=0;C<i.length;C+=1)i[C]&&i[C].m(e,null);lt(b,r,k),lt(b,l,k);for(let C=0;C<u.length;C+=1)u[C]&&u[C].m(l,null);h=!0},p(b,k){k[0]&16388&&(_=Ee({length:b[2]}),le(),i=Un(i,k,m,1,b,_,s,e,Ri,gr,null,dr),ue()),k[0]&16392&&(p=Ee({length:b[3]}),le(),u=Un(u,k,w,1,b,p,f,l,Ri,pr,null,fr),ue())},i(b){if(!h){for(let k=0;k<_.length;k+=1)N(i[k]);for(let k=0;k<p.length;k+=1)N(u[k]);h=!0}},o(b){for(let k=0;k<i.length;k+=1)R(i[k]);for(let k=0;k<u.length;k+=1)R(u[k]);h=!1},d(b){b&&(rt(e),rt(r),rt(l));for(let k=0;k<i.length;k+=1)i[k].d();for(let k=0;k<u.length;k+=1)u[k].d()}}}function Ec(n){let e,i,s,r=Ee({length:n[2]}),l=[];for(let m=0;m<r.length;m+=1)l[m]=vr(mr(n,r,m));const u=m=>R(l[m],1,1,()=>{l[m]=null});let f=Ee({length:n[3]}),h=[];for(let m=0;m<f.length;m+=1)h[m]=yr(_r(n,f,m));const _=m=>R(h[m],1,1,()=>{h[m]=null});return{c(){for(let m=0;m<l.length;m+=1)l[m].c();e=pt();for(let m=0;m<h.length;m+=1)h[m].c();i=pe()},m(m,p){for(let w=0;w<l.length;w+=1)l[w]&&l[w].m(m,p);lt(m,e,p);for(let w=0;w<h.length;w+=1)h[w]&&h[w].m(m,p);lt(m,i,p),s=!0},p(m,p){if(p[0]&4){const w=r.length;r=Ee({length:m[2]});let b;for(b=w;b<r.length;b+=1){const k=mr(m,r,b);l[b]?N(l[b],1):(l[b]=vr(k),l[b].c(),N(l[b],1),l[b].m(e.parentNode,e))}for(le(),b=r.length;b<l.length;b+=1)u(b);ue()}if(p[0]&8){const w=f.length;f=Ee({length:m[3]});let b;for(b=w;b<f.length;b+=1){const k=_r(m,f,b);h[b]?N(h[b],1):(h[b]=yr(k),h[b].c(),N(h[b],1),h[b].m(i.parentNode,i))}for(le(),b=f.length;b<h.length;b+=1)_(b);ue()}},i(m){if(!s){for(let p=0;p<r.length;p+=1)N(l[p]);for(let p=0;p<f.length;p+=1)N(h[p]);s=!0}},o(m){l=l.filter(Boolean);for(let p=0;p<l.length;p+=1)R(l[p]);h=h.filter(Boolean);for(let p=0;p<h.length;p+=1)R(h[p]);s=!1},d(m){m&&(rt(e),rt(i)),Bi(l,m),Bi(h,m)}}}function gr(n,e){let i,s,r;return s=new mo({props:{input:!0,direction:e[14]?"north":"west"}}),s.$on("connection",e[22]),s.$on("disconnection",e[23]),{key:n,first:null,c(){i=pe(),Qt(s.$$.fragment),this.first=i},m(l,u){lt(l,i,u),Vt(s,l,u),r=!0},p(l,u){e=l},i(l){r||(N(s.$$.fragment,l),r=!0)},o(l){R(s.$$.fragment,l),r=!1},d(l){l&&rt(i),Kt(s,l)}}}function pr(n,e){let i,s,r;return s=new mo({props:{output:!0,direction:e[14]?"south":"east"}}),s.$on("connection",e[24]),s.$on("disconnection",e[25]),{key:n,first:null,c(){i=pe(),Qt(s.$$.fragment),this.first=i},m(l,u){lt(l,i,u),Vt(s,l,u),r=!0},p(l,u){e=l},i(l){r||(N(s.$$.fragment,l),r=!0)},o(l){R(s.$$.fragment,l),r=!1},d(l){l&&rt(i),Kt(s,l)}}}function vr(n){let e,i;return e=new mo({}),e.$on("connection",n[18]),e.$on("disconnection",n[19]),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function yr(n){let e,i;return e=new mo({}),e.$on("connection",n[20]),e.$on("disconnection",n[21]),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function wr(n){let e,i;return e=new Mc({props:{width:!0,height:!0,rotation:!0}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function zc(n){let e,i,s,r,l,u,f,h=`${n[1]}px`,_;const m=[Ec,Tc],p=[];function w(k,C){return k[7]?0:1}i=w(n),s=p[i]=m[i](n);let b=n[6]&&wr();return{c(){e=ot("div"),s.c(),r=pt(),l=ot("p"),u=je(n[5]),f=pt(),b&&b.c(),v(l,"class","svelte-j5bq7k"),et(l,"color",n[4]),v(e,"class","default-node svelte-j5bq7k"),Xt(e,"selected",n[0]),et(e,"border-radius",h)},m(k,C){lt(k,e,C),p[i].m(e,null),S(e,r),S(e,l),S(l,u),S(e,f),b&&b.m(e,null),_=!0},p(k,C){s.p(k,C),(!_||C[0]&32)&&bn(u,k[5]),C[0]&16&&et(l,"color",k[4]),k[6]?b?C[0]&64&&N(b,1):(b=wr(),b.c(),N(b,1),b.m(e,null)):b&&(le(),R(b,1,1,()=>{b=null}),ue()),(!_||C[0]&1)&&Xt(e,"selected",k[0]),C[0]&2&&h!==(h=`${k[1]}px`)&&et(e,"border-radius",h)},i(k){_||(N(s),N(b),_=!0)},o(k){R(s),R(b),_=!1},d(k){k&&rt(e),p[i].d(),b&&b.d()}}}function Ac(n,e,i){let s,r,l,u,f,h;const _=te("dynamic"),m=te("node");let{selected:p}=e;const w=m.label;ft(n,w,$=>i(5,f=$));const b=m.borderRadius;ft(n,b,$=>i(1,s=$));const k=m.textColor;ft(n,k,$=>i(4,u=$));const C=m.inputs;ft(n,C,$=>i(2,r=$));const M=m.outputs;ft(n,M,$=>i(3,l=$));const E=m.resizable;ft(n,E,$=>i(6,h=$));const T=gt(m.direction);let I=T==="TD",q=T==="TD",j=T!=="TD",Y=T!=="TD";function at($){Re.call(this,n,$)}function ct($){Re.call(this,n,$)}function st($){Re.call(this,n,$)}function nt($){Re.call(this,n,$)}function Q($){Re.call(this,n,$)}function G($){Re.call(this,n,$)}function vt($){Re.call(this,n,$)}function X($){Re.call(this,n,$)}return n.$$set=$=>{"selected"in $&&i(0,p=$.selected)},[p,s,r,l,u,f,h,_,w,b,k,C,M,E,I,q,j,Y,at,ct,st,nt,Q,G,vt,X]}class Nc extends nn{constructor(e){super(),en(this,e,Ac,zc,Ye,{selected:0},null,[-1,-1])}}const Ic=n=>({}),br=n=>({}),Oc=n=>({}),kr=n=>({}),xc=n=>({}),Pr=n=>({}),Bc=n=>({}),Lr=n=>({}),Zc=n=>({selected:n[0]&2048}),Cr=n=>({grabHandle:n[50],selected:n[11],destroy:n[48]}),Dc=n=>({selected:n[0]&2048}),Sr=n=>({grabHandle:n[50],selected:n[11],destroy:n[48]});function Mr(n){let e,i,s,r,l,u,f,h,_,m,p,w,b,k,C,M=`${n[14].y}px`,E=`${n[14].x}px`,T=`rotate(${n[20]}deg)`,I,q,j;const Y=[Wc,Rc],at=[];function ct(B,A){return B[12]?1:0}i=ct(n),s=at[i]=Y[i](n);const st=n[61].anchorWest,nt=de(st,n,n[60],Lr),Q=n[61].anchorEast,G=de(Q,n,n[60],Pr),vt=n[61].anchorNorth,X=de(vt,n,n[60],kr),$=n[61].anchorSouth,J=de($,n,n[60],br);return{c(){e=ot("div"),s.c(),r=pt(),l=ot("div"),nt&&nt.c(),f=pt(),h=ot("div"),G&&G.c(),m=pt(),p=ot("div"),X&&X.c(),b=pt(),k=ot("div"),J&&J.c(),v(l,"id",u=`anchors-west-${n[0].id}`),v(l,"class","anchors left svelte-1iknrz0"),v(h,"id",_=`anchors-east-${n[0].id}`),v(h,"class","anchors right svelte-1iknrz0"),v(p,"id",w=`anchors-north-${n[0].id}`),v(p,"class","anchors top svelte-1iknrz0"),v(k,"id",C=`anchors-south-${n[0].id}`),v(k,"class","anchors bottom svelte-1iknrz0"),v(e,"id",n[30]),v(e,"class","svelvet-node svelte-1iknrz0"),v(e,"role","button"),v(e,"title",n[10]),v(e,"tabindex",0),Xt(e,"selected",n[11]),Xt(e,"locked",n[16]||n[15]),et(e,"top",M),et(e,"left",E),et(e,"z-index",n[17]),et(e,"width",n[12]?n[19]+"px":"fit-content"),et(e,"height",n[12]?n[18]+"px":"fit-content"),et(e,"transform",T),et(e,"--prop-background-color",n[21]||(n[1]||n[2]?null:"transparent")),et(e,"--prop-text-color",n[22]),et(e,"--prop-border-color",n[23]),et(e,"--prop-selection-color",n[24]),et(e,"--prop-border-radius",n[25]?`${n[25]}px`:n[1]||n[2]?null:"0px"),et(e,"--prop-border-width",n[26]||(n[1]||n[2]?null:"0px"))},m(B,A){lt(B,e,A),at[i].m(e,null),S(e,r),S(e,l),nt&&nt.m(l,null),S(e,f),S(e,h),G&&G.m(h,null),S(e,m),S(e,p),X&&X.m(p,null),S(e,b),S(e,k),J&&J.m(k,null),I=!0,q||(j=[Ct(e,"contextmenu",En(wn(n[62]))),Ct(e,"mouseup",n[49]),Vn(n[50].call(null,e))],q=!0)},p(B,A){let Nt=i;i=ct(B),i===Nt?at[i].p(B,A):(le(),R(at[Nt],1,1,()=>{at[Nt]=null}),ue(),s=at[i],s?s.p(B,A):(s=at[i]=Y[i](B),s.c()),N(s,1),s.m(e,r)),nt&&nt.p&&(!I||A[1]&536870912)&&me(nt,st,B,B[60],I?_e(st,B[60],A,Bc):ge(B[60]),Lr),(!I||A[0]&1&&u!==(u=`anchors-west-${B[0].id}`))&&v(l,"id",u),G&&G.p&&(!I||A[1]&536870912)&&me(G,Q,B,B[60],I?_e(Q,B[60],A,xc):ge(B[60]),Pr),(!I||A[0]&1&&_!==(_=`anchors-east-${B[0].id}`))&&v(h,"id",_),X&&X.p&&(!I||A[1]&536870912)&&me(X,vt,B,B[60],I?_e(vt,B[60],A,Oc):ge(B[60]),kr),(!I||A[0]&1&&w!==(w=`anchors-north-${B[0].id}`))&&v(p,"id",w),J&&J.p&&(!I||A[1]&536870912)&&me(J,$,B,B[60],I?_e($,B[60],A,Ic):ge(B[60]),br),(!I||A[0]&1&&C!==(C=`anchors-south-${B[0].id}`))&&v(k,"id",C),(!I||A[0]&1024)&&v(e,"title",B[10]),(!I||A[0]&2048)&&Xt(e,"selected",B[11]),(!I||A[0]&98304)&&Xt(e,"locked",B[16]||B[15]),A[0]&16384&&M!==(M=`${B[14].y}px`)&&et(e,"top",M),A[0]&16384&&E!==(E=`${B[14].x}px`)&&et(e,"left",E),A[0]&131072&&et(e,"z-index",B[17]),A[0]&528384&&et(e,"width",B[12]?B[19]+"px":"fit-content"),A[0]&266240&&et(e,"height",B[12]?B[18]+"px":"fit-content"),A[0]&1048576&&T!==(T=`rotate(${B[20]}deg)`)&&et(e,"transform",T),A[0]&2097158&&et(e,"--prop-background-color",B[21]||(B[1]||B[2]?null:"transparent")),A[0]&4194304&&et(e,"--prop-text-color",B[22]),A[0]&8388608&&et(e,"--prop-border-color",B[23]),A[0]&16777216&&et(e,"--prop-selection-color",B[24]),A[0]&33554438&&et(e,"--prop-border-radius",B[25]?`${B[25]}px`:B[1]||B[2]?null:"0px"),A[0]&67108870&&et(e,"--prop-border-width",B[26]||(B[1]||B[2]?null:"0px"))},i(B){I||(N(s),N(nt,B),N(G,B),N(X,B),N(J,B),I=!0)},o(B){R(s),R(nt,B),R(G,B),R(X,B),R(J,B),I=!1},d(B){B&&rt(e),at[i].d(),nt&&nt.d(B),G&&G.d(B),X&&X.d(B),J&&J.d(B),q=!1,tn(j)}}}function Rc(n){let e;const i=n[61].default,s=de(i,n,n[60],Cr);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[0]&2048|l[1]&536870912)&&me(s,i,r,r[60],e?_e(i,r[60],l,Zc):ge(r[60]),Cr)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Wc(n){let e,i,s;const r=n[61].default,l=de(r,n,n[60],Sr);return{c(){e=ot("div"),l&&l.c(),Di(()=>n[63].call(e)),et(e,"width","fit-content"),et(e,"height","fit-content")},m(u,f){lt(u,e,f),l&&l.m(e,null),i=$l(e,n[63].bind(e)),s=!0},p(u,f){l&&l.p&&(!s||f[0]&2048|f[1]&536870912)&&me(l,r,u,u[60],s?_e(r,u[60],f,Dc):ge(u[60]),Sr)},i(u){s||(N(l,u),s=!0)},o(u){R(l,u),s=!1},d(u){u&&rt(e),l&&l.d(u),i()}}}function Hc(n){let e,i,s=!n[13]&&Mr(n);return{c(){s&&s.c(),e=pe()},m(r,l){s&&s.m(r,l),lt(r,e,l),i=!0},p(r,l){r[13]?s&&(le(),R(s,1,1,()=>{s=null}),ue()):s?(s.p(r,l),l[0]&8192&&N(s,1)):(s=Mr(r),s.c(),N(s,1),s.m(e.parentNode,e))},i(r){i||(N(s),i=!0)},o(r){R(s),i=!1},d(r){r&&rt(e),s&&s.d(r)}}}const Fc=new Set(["INPUT","SELECT","BUTTON","TEXTAREA"]);function Gc(n,e,i){let s,r,l,u,f,h,_,m=Ot,p=()=>(m(),m=Je(Ft,O=>i(66,_=O)),Ft),w,b=Ot,k=()=>(b(),b=Je(ve,O=>i(67,w=O)),ve),C,M,E=Ot,T=()=>(E(),E=Je(fe,O=>i(68,M=O)),fe),I,q,j,Y=Ot,at=()=>(Y(),Y=Je(ze,O=>i(71,j=O)),ze),ct,st,nt,Q=Ot,G=()=>(Q(),Q=Je(Me,O=>i(16,nt=O)),Me),vt,X=Ot,$=()=>(X(),X=Je(Ce,O=>i(73,vt=O)),Ce),J,B,A,Nt,V=Ot,yt=()=>(V(),V=Je(be,O=>i(75,Nt=O)),be),Pt,dt,Z,W,H,F,Gt,re,ht,Lt,St,xt;ft(n,mn,O=>i(65,h=O)),ft(n,vn,O=>i(70,q=O)),n.$$.on_destroy.push(()=>m()),n.$$.on_destroy.push(()=>b()),n.$$.on_destroy.push(()=>E()),n.$$.on_destroy.push(()=>Y()),n.$$.on_destroy.push(()=>Q()),n.$$.on_destroy.push(()=>X()),n.$$.on_destroy.push(()=>V());let{$$slots:ne={},$$scope:ce}=e;const Se=te("mounted"),K=te("duplicate");ft(n,K,O=>i(56,dt=O));const he=te("graphDOMElement");ft(n,he,O=>i(74,B=O));const Zt=wi();let{node:Tt}=e,{isDefault:Ut}=e,{useDefaults:we}=e,{center:Ne}=e,{nodeStore:We}=e,{locked:Me}=e;G();let{groups:Ft}=e;p();let{maxZIndex:Ce}=e;$();let{centerPoint:be}=e;yt();let{cursor:qe}=e,{initialNodePositions:ve}=e;k();let{activeGroup:fe}=e;T();let{editing:ze}=e;at();let{dimensionsProvided:He=!1}=e,{title:Xe}=e;const xe=U(0),Ie=U(null);ft(n,Ie,O=>i(64,f=O));const D=Tt.id,it=Tt.position;ft(n,it,O=>i(59,H=O));const Et=Tt.dimensions.width;ft(n,Et,O=>i(19,Pt=O));const At=Tt.dimensions.height;ft(n,At,O=>i(18,A=O));const $t=Tt.selectionColor;ft(n,$t,O=>i(24,Lt=O));const ie=Tt.editable;ft(n,ie,O=>i(72,ct=O));const Qe=Tt.locked;ft(n,Qe,O=>i(15,st=O));const Te=Tt.zIndex;ft(n,Te,O=>i(17,J=O));const Dt=Tt.bgColor;ft(n,Dt,O=>i(21,Gt=O));const ye=Tt.borderRadius;ft(n,ye,O=>i(25,St=O));const Yt=Tt.textColor;ft(n,Yt,O=>i(22,re=O));const Rt=Tt.group;ft(n,Rt,O=>i(69,I=O));const Ge=Tt.borderColor;ft(n,Ge,O=>i(23,ht=O));const Ve=Tt.borderWidth;ft(n,Ve,O=>i(26,xt=O));const fn=Tt.rotation;ft(n,fn,O=>i(20,F=O));const{selected:cn,hidden:Ke}=_,oe=Ke.nodes;ft(n,oe,O=>i(58,W=O));const _t=cn.nodes;ft(n,_t,O=>i(55,C=O));const an=U(!1);ft(n,an,O=>i(57,Z=O)),Le("node",Tt),Le("anchorsMounted",xe),Le("resized",an),Le("nodeConnectEvent",Ie),zn(()=>{if(Ne){const O={x:Nt.x-Pt/2,y:Nt.y-A/2};Tt.position.set(O),vn.set(!0),vn.set(!1)}Se.update(O=>O+1)}),ho(()=>{r&&(C.delete(Tt),_t.set(C)),Se.update(O=>O-1)});function hn(){r?(Tt&&C.delete(Tt),_t.set(C)):(Tt&&C.add(Tt),_t.set(C))}function Be(O){Mt(mn,h=gt(qe),h),B.focus(),J!==vt&&J!==1/0&&Mt(Te,J=Mt(Ce,++vt,vt),J);const qt=O.target;if(!Fc.has(qt.tagName)&&(O.preventDefault(),Zt("nodeClicked",{node:Tt,e:O}),!(nt||st))){if("touches"in O){if(O.touches&&O.touches.length>1)return}else O.button===2&&ct&&Mt(ze,j=Tt,j);Mt(vn,q=!0,q),Bt(O)}}function Bt(O){let qt,ke,se=!1;const Fe=I;Fe&&(qt=_[Fe],ke=gt(qt.parent),se=ke===Tt),se?Mt(fe,M=Fe,M):Mt(fe,M="selected",M),!O.shiftKey&&r?Mt(fe,M="selected",M):(!O.shiftKey&&!r&&!O.shiftKey&&(C.clear(),_t.set(C)),hn()),Mt(ve,w=Xa(_.selected.nodes),w)}function y(){We.delete(D)}function ut(O){const qt=gt(qe),ke=qt.x-h.x,se=qt.y-h.y;Math.abs(ke)+Math.abs(se)<4&&Zt("nodeReleased",{e:O,node:Tt}),Mt(Ie,f=O,f)}function bt(O){return O.addEventListener("mousedown",Be),O.addEventListener("touchstart",Be),{destroy(){O.removeEventListener("mousedown",Be),O.removeEventListener("touchstart",Be)}}}function wt(O){Re.call(this,n,O)}function zt(){A=this.clientHeight,At.set(A),Pt=this.clientWidth,Et.set(Pt)}return n.$$set=O=>{"node"in O&&i(0,Tt=O.node),"isDefault"in O&&i(1,Ut=O.isDefault),"useDefaults"in O&&i(2,we=O.useDefaults),"center"in O&&i(51,Ne=O.center),"nodeStore"in O&&i(52,We=O.nodeStore),"locked"in O&&G(i(3,Me=O.locked)),"groups"in O&&p(i(4,Ft=O.groups)),"maxZIndex"in O&&$(i(5,Ce=O.maxZIndex)),"centerPoint"in O&&yt(i(6,be=O.centerPoint)),"cursor"in O&&i(53,qe=O.cursor),"initialNodePositions"in O&&k(i(7,ve=O.initialNodePositions)),"activeGroup"in O&&T(i(8,fe=O.activeGroup)),"editing"in O&&at(i(9,ze=O.editing)),"dimensionsProvided"in O&&i(54,He=O.dimensionsProvided),"title"in O&&i(10,Xe=O.title),"$$scope"in O&&i(60,ce=O.$$scope)},n.$$.update=()=>{n.$$.dirty[1]&268435456&&i(14,s=H),n.$$.dirty[0]&1|n.$$.dirty[1]&16777216&&i(11,r=C.has(Tt)),n.$$.dirty[0]&1|n.$$.dirty[1]&134217728&&i(13,l=W.has(Tt)),n.$$.dirty[1]&75497472&&i(12,u=He||Z),n.$$.dirty[0]&2049|n.$$.dirty[1]&33554432&&r&&dt&&Zt("duplicate",Tt)},[Tt,Ut,we,Me,Ft,Ce,be,ve,fe,ze,Xe,r,u,l,s,st,nt,J,A,Pt,F,Gt,re,ht,Lt,St,xt,K,he,Ie,D,it,Et,At,$t,ie,Qe,Te,Dt,ye,Yt,Rt,Ge,Ve,fn,oe,_t,an,y,ut,bt,Ne,We,qe,He,C,dt,Z,W,H,ce,ne,wt,zt]}class jc extends nn{constructor(e){super(),en(this,e,Gc,Hc,Ye,{node:0,isDefault:1,useDefaults:2,center:51,nodeStore:52,locked:3,groups:4,maxZIndex:5,centerPoint:6,cursor:53,initialNodePositions:7,activeGroup:8,editing:9,dimensionsProvided:54,title:10},null,[-1,-1,-1])}}const Xc=n=>({selected:n[1]&262144,grabHandle:n[1]&524288,node:n[0]&128,destroy:n[1]&131072}),Tr=n=>({selected:n[49],grabHandle:n[50],disconnect:n[14],connect:n[13],node:n[7],destroy:n[48]}),Uc=n=>({}),Er=n=>({slot:"anchorWest"}),Yc=n=>({}),zr=n=>({slot:"anchorEast"}),qc=n=>({}),Ar=n=>({slot:"anchorNorth"}),Vc=n=>({}),Nr=n=>({slot:"anchorSouth"});function Ir(n){let e,i;return e=new jc({props:{node:n[7],center:n[5]||n[0]==="center",isDefault:n[8],useDefaults:n[4],dimensionsProvided:!!n[1]||!!n[2]||!!n[3]||n[8]||!1,nodeStore:n[11].nodes,locked:n[11].locked,groups:n[11].groups,title:n[6],maxZIndex:n[11].maxZIndex,centerPoint:n[11].center,cursor:n[11].cursor,activeGroup:n[11].activeGroup,editing:n[11].editing,initialNodePositions:n[11].initialNodePositions,$$slots:{anchorSouth:[eh],anchorNorth:[th],anchorEast:[$c],anchorWest:[Qc],default:[Jc,({destroy:s,selected:r,grabHandle:l})=>({48:s,49:r,50:l}),({destroy:s,selected:r,grabHandle:l})=>[0,(s?131072:0)|(r?262144:0)|(l?524288:0)]]},$$scope:{ctx:n}}}),e.$on("nodeClicked",n[41]),e.$on("nodeMount",n[42]),e.$on("nodeReleased",n[43]),e.$on("duplicate",n[44]),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[0]&128&&(l.node=s[7]),r[0]&33&&(l.center=s[5]||s[0]==="center"),r[0]&256&&(l.isDefault=s[8]),r[0]&16&&(l.useDefaults=s[4]),r[0]&270&&(l.dimensionsProvided=!!s[1]||!!s[2]||!!s[3]||s[8]||!1),r[0]&64&&(l.title=s[6]),r[0]&384|r[1]&933888&&(l.$$scope={dirty:r,ctx:s}),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function Or(n){let e,i;return e=new Nc({props:{selected:n[49]}}),e.$on("connection",n[39]),e.$on("disconnection",n[40]),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[1]&262144&&(l.selected=s[49]),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function Kc(n){let e,i,s=n[8]&&Or(n);return{c(){s&&s.c(),e=pe()},m(r,l){s&&s.m(r,l),lt(r,e,l),i=!0},p(r,l){r[8]?s?(s.p(r,l),l[0]&256&&N(s,1)):(s=Or(r),s.c(),N(s,1),s.m(e.parentNode,e)):s&&(le(),R(s,1,1,()=>{s=null}),ue())},i(r){i||(N(s),i=!0)},o(r){R(s),i=!1},d(r){r&&rt(e),s&&s.d(r)}}}function Jc(n){let e;const i=n[38].default,s=de(i,n,n[45],Tr),r=s||Kc(n);return{c(){r&&r.c()},m(l,u){r&&r.m(l,u),e=!0},p(l,u){s?s.p&&(!e||u[0]&128|u[1]&933888)&&me(s,i,l,l[45],e?_e(i,l[45],u,Xc):ge(l[45]),Tr):r&&r.p&&(!e||u[0]&256|u[1]&262144)&&r.p(l,e?u:[-1,-1])},i(l){e||(N(r,l),e=!0)},o(l){R(r,l),e=!1},d(l){r&&r.d(l)}}}function Qc(n){let e;const i=n[38].anchorWest,s=de(i,n,n[45],Er);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&16384)&&me(s,i,r,r[45],e?_e(i,r[45],l,Uc):ge(r[45]),Er)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function $c(n){let e;const i=n[38].anchorEast,s=de(i,n,n[45],zr);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&16384)&&me(s,i,r,r[45],e?_e(i,r[45],l,Yc):ge(r[45]),zr)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function th(n){let e;const i=n[38].anchorNorth,s=de(i,n,n[45],Ar);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&16384)&&me(s,i,r,r[45],e?_e(i,r[45],l,qc):ge(r[45]),Ar)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function eh(n){let e;const i=n[38].anchorSouth,s=de(i,n,n[45],Nr);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&16384)&&me(s,i,r,r[45],e?_e(i,r[45],l,Vc):ge(r[45]),Nr)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function nh(n){let e=n[7]&&n[10].get(n[7].id),i,s,r=e&&Ir(n);return{c(){r&&r.c(),i=pe()},m(l,u){r&&r.m(l,u),lt(l,i,u),s=!0},p(l,u){u[0]&1152&&(e=l[7]&&l[10].get(l[7].id)),e?r?(r.p(l,u),u[0]&1152&&N(r,1)):(r=Ir(l),r.c(),N(r,1),r.m(i.parentNode,i)):r&&(le(),R(r,1,1,()=>{r=null}),ue())},i(l){s||(N(r),s=!0)},o(l){R(r),s=!1},d(l){l&&rt(i),r&&r.d(l)}}}function ih(n,e,i){let s,r,l=Ot,u=()=>(l(),l=Je(s,K=>i(37,r=K)),s),f;n.$$.on_destroy.push(()=>l());let{$$slots:h={},$$scope:_}=e;const m=ts(h),p=te("graph"),w=te("group");let{position:b={x:0,y:0}}=e,{drop:k=!1}=e,{dimensions:C=null}=e,{id:M=0}=e,{bgColor:E=null}=e,{borderRadius:T=null}=e,{borderColor:I=null}=e,{borderWidth:q=null}=e,{selectionColor:j=null}=e,{textColor:Y=null}=e,{resizable:at=!1}=e,{label:ct=""}=e,{inputs:st=1}=e,{outputs:nt=1}=e,{width:Q=null}=e,{height:G=null}=e,{TD:vt=!1}=e,{LR:X=!1}=e,{zIndex:$=1}=e,{editable:J=!0}=e,{locked:B=!1}=e,{rotation:A=0}=e,{edge:Nt=null}=e,{connections:V=[]}=e,{useDefaults:yt=!1}=e,{center:Pt=!1}=e,{dynamic:dt=!1}=e,{title:Z=""}=e;const W=p.nodes;ft(n,W,K=>i(10,f=K)),Le("dynamic",dt);let H,F=!0;zn(()=>{const K=vt?"TD":X?"LR":p.direction,he=p.groupBoxes.get(w),Zt=p.nodes.count()+1;i(8,F=!m.default),(m.anchorWest||m.anchorEast||m.anchorNorth||m.anchorSouth)&&i(8,F=!1);const Tt=C||(Q||G?{width:Q||G||200,height:G||Q||100}:F?{width:200,height:100}:{width:0,height:0}),Ut={id:M||Zt,position:k==="cursor"?{x:gt(p.cursor).x,y:gt(p.cursor).y}:he?{x:gt(he.position).x+b.x,y:gt(he.position).y+b.y}:b,dimensions:Tt,editable:J||p.editable,label:ct,group:w,resizable:at,inputs:st,outputs:nt,zIndex:$,direction:K,locked:B,rotation:A};V.length&&(Ut.connections=V),q&&(Ut.borderWidth=q),T&&(Ut.borderRadius=T),I&&(Ut.borderColor=I),j&&(Ut.selectionColor=j),Y&&(Ut.textColor=Y),E&&(Ut.bgColor=E),Nt&&(Ut.edge=Nt),i(7,H=lu(Ut)),he&&p.groups.update(we=>{const Ne=gt(we[w].nodes);return we[w].nodes.set(new Set([...Ne,H])),we}),p.nodes.add(H,H.id)}),ho(()=>{p.nodes.delete(H.id)});function Gt(K){H&&H.connections.set([K])}function re(K){if(!H)return;(Array.isArray(K)?K:[K]).forEach(Zt=>{const[Tt,Ut]=Array.isArray(Zt)?Zt:[Zt,null],we=`N-${Tt}`,Ne=p.nodes.get(we);if(!Ne)return;let We=null;const Me=Ut?`A-${Ut}/${we}`:null;Me&&(We=Ne.anchors.get(Me));const Ft=p.edges.match(H,Ne,We);Ft.length&&p.edges.delete(Ft[Ft.length-1])})}Le("connect",Gt),Le("disconnect",re);let ht=b;function Lt(K){Re.call(this,n,K)}function St(K){Re.call(this,n,K)}function xt(K){Re.call(this,n,K)}function ne(K){Re.call(this,n,K)}function ce(K){Re.call(this,n,K)}function Se(K){Re.call(this,n,K)}return n.$$set=K=>{"position"in K&&i(15,b=K.position),"drop"in K&&i(0,k=K.drop),"dimensions"in K&&i(1,C=K.dimensions),"id"in K&&i(16,M=K.id),"bgColor"in K&&i(17,E=K.bgColor),"borderRadius"in K&&i(18,T=K.borderRadius),"borderColor"in K&&i(19,I=K.borderColor),"borderWidth"in K&&i(20,q=K.borderWidth),"selectionColor"in K&&i(21,j=K.selectionColor),"textColor"in K&&i(22,Y=K.textColor),"resizable"in K&&i(23,at=K.resizable),"label"in K&&i(24,ct=K.label),"inputs"in K&&i(25,st=K.inputs),"outputs"in K&&i(26,nt=K.outputs),"width"in K&&i(2,Q=K.width),"height"in K&&i(3,G=K.height),"TD"in K&&i(27,vt=K.TD),"LR"in K&&i(28,X=K.LR),"zIndex"in K&&i(29,$=K.zIndex),"editable"in K&&i(30,J=K.editable),"locked"in K&&i(31,B=K.locked),"rotation"in K&&i(32,A=K.rotation),"edge"in K&&i(33,Nt=K.edge),"connections"in K&&i(34,V=K.connections),"useDefaults"in K&&i(4,yt=K.useDefaults),"center"in K&&i(5,Pt=K.center),"dynamic"in K&&i(35,dt=K.dynamic),"title"in K&&i(6,Z=K.title),"$$scope"in K&&i(45,_=K.$$scope)},n.$$.update=()=>{if(n.$$.dirty[0]&128|n.$$.dirty[1]&8&&H&&H.connections.set(V),n.$$.dirty[0]&131200&&H&&H.bgColor.set(E),n.$$.dirty[0]&16777344&&H&&H.label.set(ct),n.$$.dirty[0]&4194432&&H&&H.textColor.set(Y),n.$$.dirty[0]&524416&&H&&H.borderColor.set(I),n.$$.dirty[0]&2097280&&H&&H.selectionColor.set(j),n.$$.dirty[0]&8388736&&H&&H.resizable.set(at),n.$$.dirty[0]&1073741952&&H&&H.editable.set(J),n.$$.dirty[0]&128|n.$$.dirty[1]&1&&H&&H.locked.set(B),n.$$.dirty[0]&33554560&&H&&H.inputs.set(st),n.$$.dirty[0]&67108992&&H&&H.outputs.set(nt),n.$$.dirty[0]&536871040&&H&&H.zIndex.set($),n.$$.dirty[0]&128&&u(i(9,s=H&&(H==null?void 0:H.position))),n.$$.dirty[0]&32896|n.$$.dirty[1]&96&&H){const{x:K,y:he}=ht,{x:Zt,y:Tt}=r,{x:Ut,y:we}=b;(Ut!==Zt||we!==Tt)&&(Ut!==K||we!==he?(i(36,ht=b),H.position.set(b)):(i(36,ht=r),i(15,b=r)))}n.$$.dirty[0]&33554560&&H&&H.inputs.set(st),n.$$.dirty[0]&67108992&&H&&H.outputs.set(nt)},[k,C,Q,G,yt,Pt,Z,H,F,s,f,p,W,Gt,re,b,M,E,T,I,q,j,Y,at,ct,st,nt,vt,X,$,J,B,A,Nt,V,dt,ht,r,h,Lt,St,xt,ne,ce,Se,_]}class es extends nn{constructor(e){super(),en(this,e,ih,nh,Ye,{position:15,drop:0,dimensions:1,id:16,bgColor:17,borderRadius:18,borderColor:19,borderWidth:20,selectionColor:21,textColor:22,resizable:23,label:24,inputs:25,outputs:26,width:2,height:3,TD:27,LR:28,zIndex:29,editable:30,locked:31,rotation:32,edge:33,connections:34,useDefaults:4,center:5,dynamic:35,title:6},null,[-1,-1])}}function oh(n){n.parentNodes.forEach(l=>sh(l));const[e,i]=rh(n);ah(e,n),lh(e);for(let l=0;l<10;l++){let u=!1;for(let f=0;f<=i;f++)if(e[f])for(let h=0;h<e[f].length;h++){const _=e[f][h],m=ch(e,_,h);m&&(si(e[f],h,m),u=!0)}if(!u)break}const s=hh(e);for(let l=0;l<10&&fh(e,s);l++);for(let l=0;l<2;l++){let u=!1;for(let f=0;f<=i;f++)for(let h=0;h<e[f].length;h++){const _=e[f][h],m=uh(e,_,h);m&&(si(e[f],h,m),u=!0)}if(!u)break}const r=[];for(let l=0;l<=i;l++)r.push(e[l]);return r}function sh(n,e=0,i=0){const s=[],r=(l,u=0,f=0)=>{l.depth=Math.max(l.depth,u),l.nesting=Math.max(l.nesting,f),s.push(l);for(const h of l.children){const{node:_,length:m}=h;r(_,m+u,f+1)}};r(n,e,i);for(const l of s)if(l.children.length){l.nesting=l.children[0].node.nesting-1,l.depth=l.children[0].node.depth-l.children[0].length;for(const u of l.children)l.nesting=Math.min(l.nesting,u.node.nesting-1),l.depth=Math.min(l.depth,u.node.depth-u.length)}}function rh(n){let e=0;const i={};for(const s in n.nodeList){const{depth:r,parents:l,children:u,type:f,data:h}=n.nodeList[s];e=Math.max(e,r),i[r]||(i[r]=[]);const _={id:s,label:h.content,children:[],parents:[],layer:r,type:f.trim()};h.props&&(_.propsId=h.props.trim());for(const m of l)_.parents.push(m.node.id);for(const m of u)_.children.push(m.node.id);i[r].push(_)}return[i,e]}function ah(n,e){for(const i in e.nodeList)for(const s of e.nodeList[i].children)if(s.node.depth-1>e.nodeList[i].depth){const r=e.nodeList[i].depth+1,l=s.node.depth-1,u=[];let f=0;for(let h=r;h<=l;h++){const _={id:`GHOST_${s.node.id}_${f}`,label:"",children:[],parents:[],layer:h,ignore:!0};u.push(_),f++}for(const h of s.node.parents)u[0].parents.push(h.node.id);u[u.length-1].children.push(s.node.id);for(let h=0;h<u.length-1;h++)u[h].children.push(`GHOST_${s.node.id}_${h+1}`);for(let h=l;h>=r;h--)u.length>0&&n[h].push(u[0]);for(const h of n[e.nodeList[i].depth])h.id===i&&(h.children.push(u[0].id),h.children=h.children.filter(_=>_!==s.node.id))}}function lh(n){let e=0;for(const i in n)e=Math.max(n[i].length,e);for(const i in n)if(n[i].length<e){const s=Array.from({length:e-n[i].length},()=>({id:"NULL_NODE",children:[],parents:[],layer:parseInt(i),ignore:!0}));n[i]=n[i].concat(s)}}function xr(n,e,i){let s=0,r=0;for(const l of e.parents){for(let u=0;u<n[e.layer-1].length;u++)if(l===n[e.layer-1][u].id){s+=Math.abs(i-u);break}r++}for(const l of e.children){for(let u=0;u<n[e.layer+1].length;u++)if(l===n[e.layer+1][u].id){s+=Math.abs(i-u);break}r++}return isNaN(s/r)?0:s/r}function Br(n,e,i){let s=0,r=0;for(const l of e.parents){for(let u=0;u<n[e.layer-1].length;u++)if(l===n[e.layer-1][u].id){s+=Math.abs(i-u);break}r++}return isNaN(s/r)?0:s/r}function Zr(n,e,i){let s=0,r=0;for(const l of e.children){for(let u=0;u<n[e.layer+1].length;u++)if(l===n[e.layer+1][u].id){s+=Math.abs(i-u);break}r++}return isNaN(s/r)?0:s/r}function uh(n,e,i){const s=Jo(n,e.layer);let r=0;e.layer===0?r=Zr(n,e,i):r=Br(n,e,i);let l=r,u=i;for(let f=0;f<n[e.layer].length;f++)if(n[e.layer][f].id==="NULL_NODE"){si(n[e.layer],i,f);const _=Jo(n,e.layer);let m=0;e.layer===0?m=Zr(n,e,f):m=Br(n,e,f),_<=s&&m<l&&(l=m,u=f),si(n[e.layer],f,i)}return u===i?null:u}function ch(n,e,i){const s={};let r=1/0,l=0;for(let u=0;u<n[e.layer].length;u++){const f=xr(n,e,u),h=xr(n,n[e.layer][u],i);s[u]=f+h}for(const u in s)s[u]<r&&(r=s[u],l=parseInt(u));return l===i?null:l}function si(n,e,i){const s=n[e];n[e]=n[i],n[i]=s}function hh(n){const e=[];for(const i in n)for(const s of n[i])e.push(s);return e.sort((i,s)=>s.parents.length+s.children.length-(i.parents.length+i.children.length))}function Jo(n,e){let i=0;for(let s=0;s<n[e].length;s++){const r=n[e][s],l=[],u=[];if(n[e-1])for(let f=s+1;f<n[e-1].length;f++)r.parents.includes(n[e-1][f].id)&&l.push(f);if(n[e+1])for(let f=s+1;f<n[e+1].length;f++)r.children.includes(n[e+1][f].id)&&u.push(f);for(let f=s+1;f<n[e].length;f++){const h=n[e][f];if(l.length)for(let _=0;_<n[e-1].length;_++)h.parents.includes(n[e-1][_].id)&&l.forEach(m=>{_<m&&i++});if(u.length)for(let _=0;_<n[e+1].length;_++)h.children.includes(n[e+1][_].id)&&u.forEach(m=>{_<m&&i++})}}return i}function fh(n,e){let i=!1;for(const s of e){if(s.children.length+s.parents.length===0)return i;let r=0;for(let f=0;f<n[s.layer].length;f++)if(n[s.layer][f].id===s.id){r=f;break}let l=1/0,u=r;for(let f=0;f<n[s.layer].length;f++){si(n[s.layer],r,f);const h=Jo(n,s.layer);h<l&&(l=h,u=f),si(n[s.layer],f,r)}u!==r&&(si(n[s.layer],r,u),i=!0)}return i}function Dr(n,e,i){const s=n.slice();return s[6]=e[i],s}function Rr(n,e,i){const s=n.slice();return s[9]=e[i],s}function dh(n){let e,i;const s=[{label:n[9].label},{id:n[9].id},{TD:!0},n[0][n[9].id],{connections:n[9].children.map(Fr)}];let r={};for(let l=0;l<s.length;l+=1)r=$o(r,s[l]);return e=new es({props:r}),{c(){Qt(e.$$.fragment)},m(l,u){Vt(e,l,u),i=!0},p(l,u){const f=u&3?Da(s,[u&2&&{label:l[9].label},u&2&&{id:l[9].id},s[2],Ra(l[0][l[9].id]),u&2&&{connections:l[9].children.map(Fr)}]):{};e.$set(f)},i(l){i||(N(e.$$.fragment,l),i=!0)},o(l){R(e.$$.fragment,l),i=!1},d(l){Kt(e,l)}}}function Wr(n){let e,i,s=!n[9].ignore&&dh(n);return{c(){s&&s.c(),e=pe()},m(r,l){s&&s.m(r,l),lt(r,e,l),i=!0},p(r,l){r[9].ignore||s.p(r,l)},i(r){i||(N(s),i=!0)},o(r){R(s),i=!1},d(r){r&&rt(e),s&&s.d(r)}}}function Hr(n){let e,i,s=Ee(n[6]),r=[];for(let u=0;u<s.length;u+=1)r[u]=Wr(Rr(n,s,u));const l=u=>R(r[u],1,1,()=>{r[u]=null});return{c(){for(let u=0;u<r.length;u+=1)r[u].c();e=pe()},m(u,f){for(let h=0;h<r.length;h+=1)r[h]&&r[h].m(u,f);lt(u,e,f),i=!0},p(u,f){if(f&3){s=Ee(u[6]);let h;for(h=0;h<s.length;h+=1){const _=Rr(u,s,h);r[h]?(r[h].p(_,f),N(r[h],1)):(r[h]=Wr(_),r[h].c(),N(r[h],1),r[h].m(e.parentNode,e))}for(le(),h=s.length;h<r.length;h+=1)l(h);ue()}},i(u){if(!i){for(let f=0;f<s.length;f+=1)N(r[f]);i=!0}},o(u){r=r.filter(Boolean);for(let f=0;f<r.length;f+=1)R(r[f]);i=!1},d(u){u&&rt(e),Bi(r,u)}}}function _h(n){let e,i,s=Ee(n[1]),r=[];for(let u=0;u<s.length;u+=1)r[u]=Hr(Dr(n,s,u));const l=u=>R(r[u],1,1,()=>{r[u]=null});return{c(){for(let u=0;u<r.length;u+=1)r[u].c();e=pe()},m(u,f){for(let h=0;h<r.length;h+=1)r[h]&&r[h].m(u,f);lt(u,e,f),i=!0},p(u,[f]){if(f&3){s=Ee(u[1]);let h;for(h=0;h<s.length;h+=1){const _=Dr(u,s,h);r[h]?(r[h].p(_,f),N(r[h],1)):(r[h]=Hr(_),r[h].c(),N(r[h],1),r[h].m(e.parentNode,e))}for(le(),h=s.length;h<r.length;h+=1)l(h);ue()}},i(u){if(!i){for(let f=0;f<s.length;f+=1)N(r[f]);i=!0}},o(u){r=r.filter(Boolean);for(let f=0;f<r.length;f+=1)R(r[f]);i=!1},d(u){u&&rt(e),Bi(r,u)}}}const mh=100,gh=100,Fr=n=>[n,"1"];function ph(n,e,i){let{mermaid:s=""}=e,{mermaidConfig:r={}}=e;const l=Lu(s);Le("flowchart",l);const u=oh(l),f=te("graph");let h;return zn(()=>{f.nodes.subscribe(m=>h=Object.fromEntries(m));let _=0;for(const m of u){let p=0,w=-1/0;for(const b of m)b.ignore||(h[`N-${b.id}`].position.update(()=>({x:p,y:_})),h[`N-${b.id}`].dimensions.width.subscribe(k=>p+=k),h[`N-${b.id}`].dimensions.height.subscribe(k=>w=Math.max(w,k))),p+=mh;_+=w+gh}}),n.$$set=_=>{"mermaid"in _&&i(2,s=_.mermaid),"mermaidConfig"in _&&i(0,r=_.mermaidConfig)},[r,u,s]}class vh extends nn{constructor(e){super(),en(this,e,ph,_h,Ye,{mermaid:2,mermaidConfig:0})}}const yh="modulepreload",wh=function(n){return"/"+n},Gr={},Ai=function(e,i,s){let r=Promise.resolve();if(i&&i.length>0){document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));r=Promise.allSettled(i.map(h=>{if(h=wh(h),h in Gr)return;Gr[h]=!0;const _=h.endsWith(".css"),m=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const p=document.createElement("link");if(p.rel=_?"stylesheet":yh,_||(p.as="script"),p.crossOrigin="",p.href=h,f&&p.setAttribute("nonce",f),document.head.appendChild(p),_)return new Promise((w,b)=>{p.addEventListener("load",w),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return r.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return e().catch(l)})},bh=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],kh=new Set(bh),jr=n=>kh.has(n);function Ph(n){let e,i,s;return{c(){e=ot("input"),v(e,"placeholder",n[0]),v(e,"type","text")},m(r,l){lt(r,e,l),yi(e,n[1]),i||(s=[Ct(e,"keydown",En(n[3])),Ct(e,"click",En(n[4])),Ct(e,"mousedown",En(n[5])),Ct(e,"input",n[6])],i=!0)},p(r,[l]){l&1&&v(e,"placeholder",r[0]),l&2&&e.value!==r[1]&&yi(e,r[1])},i:Ot,o:Ot,d(r){r&&rt(e),i=!1,tn(s)}}}function Lh(n,e,i){let s,{placeholder:r}=e;const l=te("textStore");ft(n,l,m=>i(1,s=m));function u(m){Re.call(this,n,m)}function f(m){Re.call(this,n,m)}function h(m){Re.call(this,n,m)}function _(){s=this.value,l.set(s)}return n.$$set=m=>{"placeholder"in m&&i(0,r=m.placeholder)},[r,s,l,u,f,h,_]}class Ch extends nn{constructor(e){super(),en(this,e,Lh,Ph,Ye,{placeholder:0})}}function Sh(n){let e,i,s,r,l,u,f,h,_,m,p,w,b;return u=new Ch({props:{placeholder:"Node Label"}}),{c(){e=ot("div"),i=ot("span"),i.textContent="Editor",s=pt(),r=ot("button"),r.textContent="X",l=pt(),Qt(u.$$.fragment),f=pt(),h=ot("button"),h.textContent="Delete Node",_=pt(),m=ot("button"),m.textContent="Resize Node",et(i,"color","white"),et(i,"font-size","45px"),et(r,"position","absolute"),et(r,"top","10px"),et(r,"right","10px"),v(e,"class","editor svelte-1nv0yho")},m(k,C){lt(k,e,C),S(e,i),S(e,s),S(e,r),S(e,l),Vt(u,e,null),S(e,f),S(e,h),S(e,_),S(e,m),p=!0,w||(b=[Ct(r,"click",n[6]),Ct(h,"click",n[3]),Ct(m,"click",n[4]),Ct(e,"contextmenu",n[2])],w=!0)},p:Ot,i(k){p||(N(u.$$.fragment,k),p=!0)},o(k){R(u.$$.fragment,k),p=!1},d(k){k&&rt(e),Kt(u),w=!1,tn(b)}}}function Mh(n){let e,i;return e=new es({props:{zIndex:1/0,position:n[0],bgColor:"white",id:"editor",$$slots:{default:[Sh]},$$scope:{ctx:n}}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,[r]){const l={};r&1&&(l.position=s[0]),r&512&&(l.$$scope={dirty:r,ctx:s}),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function Th(n,e,i){let{editing:s}=e;const r=te("graph");Le("graph",r),Le("textStore",s.label),Le("colorStore",s.bgColor);let l={x:150,y:50};function u(m){m.preventDefault(),i(0,l={x:m.clientX,y:m.clientY}),r.editing.set(s)}function f(){r.nodes.delete(s.id),r.editing.set(null)}function h(){const m=s.id,p=r.nodes.get(m);if(p){const w=p.dimensions.width,b=p.dimensions.height,k=prompt("Enter new width (for example:250):",w?w.toString():""),C=prompt("Enter new height (for example:200):",b?b.toString():"");if(k===null||C===null)return;p.dimensions.width.set(parseInt(k,10)||0),p.dimensions.height.set(parseInt(C,10)||0),p.resizingWidth.set(!0),p.resizingHeight.set(!0)}}const _=()=>r.editing.set(null);return n.$$set=m=>{"editing"in m&&i(5,s=m.editing)},r.cursor,[l,r,u,f,h,s,_]}class Eh extends nn{constructor(e){super(),en(this,e,Th,Mh,Ye,{editing:5})}}function zh(n){let e,i,s,r;return{c(){e=ot("div"),i=ot("div"),v(i,"class","bounding-box svelte-1e5jg43"),et(i,"background-color",n[6]),v(e,"role","button"),v(e,"tabindex","0"),v(e,"class","bounding-box-border svelte-1e5jg43"),v(e,"id",n[2]),et(e,"border","solid 4px "+n[6]),et(e,"top",`${n[3].y}px`),et(e,"left",`${n[3].x}px`),et(e,"width",`${n[4]}px`),et(e,"height",`${n[5]}px`)},m(l,u){lt(l,e,u),S(e,i),s||(r=[Ct(e,"contextmenu",En(wn(n[12]))),Ct(e,"mousedown",En(wn(n[9])))],s=!0)},p(l,[u]){u&64&&et(i,"background-color",l[6]),u&4&&v(e,"id",l[2]),u&64&&et(e,"border","solid 4px "+l[6]);const f=u&64;(u&72||f)&&et(e,"top",`${l[3].y}px`),(u&72||f)&&et(e,"left",`${l[3].x}px`),(u&80||f)&&et(e,"width",`${l[4]}px`),(u&96||f)&&et(e,"height",`${l[5]}px`)},i:Ot,o:Ot,d(l){l&&rt(e),s=!1,tn(r)}}}function Ah(n,e,i){let s,r,l=Ot,u=()=>(l(),l=Je(b,j=>i(3,r=j)),b),f,h,_,m=Ot,p=()=>(m(),m=Je(k,j=>i(6,_=j)),k);n.$$.on_destroy.push(()=>l()),n.$$.on_destroy.push(()=>m());let{dimensions:w}=e,{position:b}=e;u();let{color:k}=e;p();let{groupName:C}=e;const{width:M,height:E}=w;ft(n,M,j=>i(4,f=j)),ft(n,E,j=>i(5,h=j));const T=wi();function I(){T("groupClick",{groupName:C})}function q(j){Re.call(this,n,j)}return n.$$set=j=>{"dimensions"in j&&i(10,w=j.dimensions),"position"in j&&u(i(0,b=j.position)),"color"in j&&p(i(1,k=j.color)),"groupName"in j&&i(11,C=j.groupName)},n.$$.update=()=>{n.$$.dirty&2048&&i(2,s=`${C}-bounding-box`)},[b,k,s,r,f,h,_,M,E,I,w,C,q]}class Nh extends nn{constructor(e){super(),en(this,e,Ah,zh,Ye,{dimensions:10,position:0,color:1,groupName:11})}}function Xr(n,e,i){const s=n.slice();return s[4]=e[i][0],s[5]=e[i][1],s}function Ur(n,e){let i,s,r;const l=[e[5],{groupName:e[4]}];let u={};for(let f=0;f<l.length;f+=1)u=$o(u,l[f]);return s=new Nh({props:u}),s.$on("groupClick",e[2]),{key:n,first:null,c(){i=pe(),Qt(s.$$.fragment),this.first=i},m(f,h){lt(f,i,h),Vt(s,f,h),r=!0},p(f,h){e=f;const _=h&1?Da(l,[Ra(e[5]),{groupName:e[4]}]):{};s.$set(_)},i(f){r||(N(s.$$.fragment,f),r=!0)},o(f){R(s.$$.fragment,f),r=!1},d(f){f&&rt(i),Kt(s,f)}}}function Ih(n){let e=[],i=new Map,s,r,l=Ee(Array.from(n[0]));const u=f=>f[4];for(let f=0;f<l.length;f+=1){let h=Xr(n,l,f),_=u(h);i.set(_,e[f]=Ur(_,h))}return{c(){for(let f=0;f<e.length;f+=1)e[f].c();s=pe()},m(f,h){for(let _=0;_<e.length;_+=1)e[_]&&e[_].m(f,h);lt(f,s,h),r=!0},p(f,[h]){h&1&&(l=Ee(Array.from(f[0])),le(),e=Un(e,h,u,1,f,l,i,s.parentNode,Ri,Ur,s,Xr),ue())},i(f){if(!r){for(let h=0;h<l.length;h+=1)N(e[h]);r=!0}},o(f){for(let h=0;h<e.length;h+=1)R(e[h]);r=!1},d(f){f&&rt(s);for(let h=0;h<e.length;h+=1)e[h].d(f)}}}function Oh(n,e,i){let s;const l=te("graph").groupBoxes;ft(n,l,f=>i(0,s=f));function u(f){Re.call(this,n,f)}return[s,l,u]}class xh extends nn{constructor(e){super(),en(this,e,Oh,Ih,Ye,{})}}function Bh(n){let e,i,s,r;const l=n[11].default,u=de(l,n,n[10],null);return{c(){e=ot("div"),u&&u.c(),v(e,"class","svelvet-graph-wrapper svelte-19pa6i0"),v(e,"role","presentation"),et(e,"transform",n[0])},m(f,h){lt(f,e,h),u&&u.m(e,null),i=!0,s||(r=[Ct(e,"contextmenu",Ii(wn(n[12]))),Ct(e,"click",Ii(wn(n[13]))),Ct(e,"touchstart",Ii(wn(n[14])))],s=!0)},p(f,[h]){u&&u.p&&(!i||h&1024)&&me(u,l,f,f[10],i?_e(l,f[10],h,null):ge(f[10]),null),h&1&&et(e,"transform",f[0])},i(f){i||(N(u,f),i=!0)},o(f){R(u,f),i=!1},d(f){f&&rt(e),u&&u.d(f),s=!1,tn(r)}}}function Zh(n,e,i){let s,r,l,u,f,{$$slots:h={},$$scope:_}=e;const m=te("graph"),p=m.transforms,w=p.scale;ft(n,w,Y=>i(9,f=Y));const b=p.translation;ft(n,b,Y=>i(8,u=Y));const k=m.cursor;ft(n,k,Y=>i(15,l=Y));let{isMovable:C}=e,M,E=!1;function T(){Mt(b,u=xu(gt(mn),l,p),u),i(5,M=requestAnimationFrame(T))}function I(Y){Re.call(this,n,Y)}function q(Y){Re.call(this,n,Y)}function j(Y){Re.call(this,n,Y)}return n.$$set=Y=>{"isMovable"in Y&&i(4,C=Y.isMovable),"$$scope"in Y&&i(10,_=Y.$$scope)},n.$$.update=()=>{n.$$.dirty&256&&i(7,s=u),n.$$.dirty&640&&i(0,r=`translate(${s.x}px, ${s.y}px) scale(${f})`),n.$$.dirty&112&&(C&&!E?(i(6,E=!0),i(5,M=requestAnimationFrame(T))):(!C||!E)&&(i(6,E=!1),cancelAnimationFrame(M)))},[r,w,b,k,C,M,E,s,u,f,_,h,I,q,j]}class Dh extends nn{constructor(e){super(),en(this,e,Zh,Bh,Ye,{isMovable:4})}}function Rh(n){let e,i,s;const r=n[8].default,l=de(r,n,n[9],null);return i=new xh({}),i.$on("groupClick",n[5]),{c(){l&&l.c(),e=pt(),Qt(i.$$.fragment)},m(u,f){l&&l.m(u,f),lt(u,e,f),Vt(i,u,f),s=!0},p(u,f){l&&l.p&&(!s||f&512)&&me(l,r,u,u[9],s?_e(r,u[9],f,null):ge(u[9]),null)},i(u){s||(N(l,u),N(i.$$.fragment,u),s=!0)},o(u){R(l,u),R(i.$$.fragment,u),s=!1},d(u){u&&rt(e),l&&l.d(u),Kt(i,u)}}}function Wh(n){let e,i;return e=new Dh({props:{isMovable:n[0],$$slots:{default:[Rh]},$$scope:{ctx:n}}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,[r]){const l={};r&1&&(l.isMovable=s[0]),r&512&&(l.$$scope={dirty:r,ctx:s}),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function Hh(n,e,i){let s,r,l,u,f,h;ft(n,mn,I=>i(13,u=I)),ft(n,vn,I=>i(7,h=I));let{$$slots:_={},$$scope:m}=e;console.log("Componente GraphRenderer.svelte");const p=te("graph"),w=te("snapTo");let{isMovable:b}=e;const k=p.activeGroup;ft(n,k,I=>i(6,f=I));const C=p.groups;ft(n,C,I=>i(10,s=I));const M=p.initialNodePositions;ft(n,M,I=>i(11,r=I));const E=p.cursor;ft(n,E,I=>i(12,l=I));function T(I){Mt(vn,h=!0,h);const{groupName:q}=I.detail;Mt(k,f=q,f),Mt(mn,u=l,u),Mt(M,r=Xa(s[q].nodes),r)}return n.$$set=I=>{"isMovable"in I&&i(0,b=I.isMovable),"$$scope"in I&&i(9,m=I.$$scope)},n.$$.update=()=>{n.$$.dirty&192&&f&&h&&ju(p,w)},[b,k,C,M,E,T,f,h,_,m]}class Fh extends nn{constructor(e){super(),en(this,e,Hh,Wh,Ye,{isMovable:0})}}function Gh(n){let e,i;return{c(){e=ee("line"),i=ee("line"),v(e,"class","background-line svelte-rryw83"),v(e,"x1",n[11]),v(e,"y1",0),v(e,"x2",n[11]),v(e,"y2",n[6]),v(e,"stroke-width",n[5]),et(e,"--calculated-dot-color",n[2]),v(i,"class","background-line svelte-rryw83"),v(i,"y1",n[11]),v(i,"x1",0),v(i,"y2",n[11]),v(i,"x2",n[6]),v(i,"stroke-width",n[5]),et(i,"--calculated-dot-color",n[2])},m(s,r){lt(s,e,r),lt(s,i,r)},p(s,r){r&2048&&v(e,"x1",s[11]),r&2048&&v(e,"x2",s[11]),r&64&&v(e,"y2",s[6]),r&32&&v(e,"stroke-width",s[5]),r&4&&et(e,"--calculated-dot-color",s[2]),r&2048&&v(i,"y1",s[11]),r&2048&&v(i,"y2",s[11]),r&64&&v(i,"x2",s[6]),r&32&&v(i,"stroke-width",s[5]),r&4&&et(i,"--calculated-dot-color",s[2])},d(s){s&&(rt(e),rt(i))}}}function jh(n){let e;return{c(){e=ee("circle"),v(e,"class","background-dot svelte-rryw83"),v(e,"r",n[5]),v(e,"cx",n[11]),v(e,"cy",n[11]),et(e,"--calculated-dot-color",n[2])},m(i,s){lt(i,e,s)},p(i,s){s&32&&v(e,"r",i[5]),s&2048&&v(e,"cx",i[11]),s&2048&&v(e,"cy",i[11]),s&4&&et(e,"--calculated-dot-color",i[2])},d(i){i&&rt(e)}}}function Yr(n){let e,i,s;function r(f,h){if(f[0]==="dots")return Uh;if(f[0]==="lines")return Xh}let l=r(n),u=l&&l(n);return{c(){e=ee("pattern"),u&&u.c(),v(e,"id","graph-coarse-pattern"),v(e,"x",n[7]),v(e,"y",n[8]),v(e,"width",i=n[6]*n[3]),v(e,"height",s=n[6]*n[3]),v(e,"patternUnits","userSpaceOnUse")},m(f,h){lt(f,e,h),u&&u.m(e,null)},p(f,h){l===(l=r(f))&&u?u.p(f,h):(u&&u.d(1),u=l&&l(f),u&&(u.c(),u.m(e,null))),h&128&&v(e,"x",f[7]),h&256&&v(e,"y",f[8]),h&72&&i!==(i=f[6]*f[3])&&v(e,"width",i),h&72&&s!==(s=f[6]*f[3])&&v(e,"height",s)},d(f){f&&rt(e),u&&u.d()}}}function Xh(n){let e,i,s,r,l,u;return{c(){e=ee("line"),r=ee("line"),v(e,"class","background-line svelte-rryw83"),v(e,"x1",n[11]),v(e,"y1",0),v(e,"x2",n[11]),v(e,"y2",i=n[6]*n[3]),v(e,"stroke-width",s=n[5]*1.2),et(e,"--calculated-dot-color",n[2]),v(r,"class","background-line svelte-rryw83"),v(r,"y1",n[11]),v(r,"x1",0),v(r,"y2",n[11]),v(r,"x2",l=n[6]*n[3]),v(r,"stroke-width",u=n[5]*1.2),et(r,"--calculated-dot-color",n[2])},m(f,h){lt(f,e,h),lt(f,r,h)},p(f,h){h&2048&&v(e,"x1",f[11]),h&2048&&v(e,"x2",f[11]),h&72&&i!==(i=f[6]*f[3])&&v(e,"y2",i),h&32&&s!==(s=f[5]*1.2)&&v(e,"stroke-width",s),h&4&&et(e,"--calculated-dot-color",f[2]),h&2048&&v(r,"y1",f[11]),h&2048&&v(r,"y2",f[11]),h&72&&l!==(l=f[6]*f[3])&&v(r,"x2",l),h&32&&u!==(u=f[5]*1.2)&&v(r,"stroke-width",u),h&4&&et(r,"--calculated-dot-color",f[2])},d(f){f&&(rt(e),rt(r))}}}function Uh(n){let e,i;return{c(){e=ee("circle"),v(e,"class","background-dot svelte-rryw83"),v(e,"r",i=n[5]*2),v(e,"cx",n[11]),v(e,"cy",n[11]),et(e,"--calculated-dot-color",n[2])},m(s,r){lt(s,e,r)},p(s,r){r&32&&i!==(i=s[5]*2)&&v(e,"r",i),r&2048&&v(e,"cx",s[11]),r&2048&&v(e,"cy",s[11]),r&4&&et(e,"--calculated-dot-color",s[2])},d(s){s&&rt(e)}}}function qr(n){let e;return{c(){e=ee("rect"),v(e,"width","100%"),v(e,"height","100%"),v(e,"fill","url(#graph-coarse-pattern)"),v(e,"opacity",n[10])},m(i,s){lt(i,e,s)},p(i,s){s&1024&&v(e,"opacity",i[10])},d(i){i&&rt(e)}}}function Yh(n){let e,i,s,r,l;function u(p,w){if(p[0]==="dots")return jh;if(p[0]==="lines")return Gh}let f=u(n),h=f&&f(n),_=n[3]>0&&Yr(n),m=n[3]>0&&qr(n);return{c(){e=ot("div"),i=ee("svg"),s=ee("defs"),r=ee("pattern"),h&&h.c(),_&&_.c(),l=ee("rect"),m&&m.c(),v(r,"id","graph-pattern"),v(r,"x",n[7]),v(r,"y",n[8]),v(r,"width",n[6]),v(r,"height",n[6]),v(r,"patternUnits","userSpaceOnUse"),v(l,"width","100%"),v(l,"height","100%"),v(l,"fill","url(#graph-pattern)"),v(l,"opacity",n[9]),v(i,"class","svelte-rryw83"),v(e,"id","background-wrapper"),v(e,"class","svelte-rryw83"),et(e,"--calculated-background-color",n[1])},m(p,w){lt(p,e,w),S(e,i),S(i,s),S(s,r),h&&h.m(r,null),_&&_.m(s,null),S(i,l),m&&m.m(i,null),n[24](e)},p(p,[w]){f===(f=u(p))&&h?h.p(p,w):(h&&h.d(1),h=f&&f(p),h&&(h.c(),h.m(r,null))),w&128&&v(r,"x",p[7]),w&256&&v(r,"y",p[8]),w&64&&v(r,"width",p[6]),w&64&&v(r,"height",p[6]),p[3]>0?_?_.p(p,w):(_=Yr(p),_.c(),_.m(s,null)):_&&(_.d(1),_=null),w&512&&v(l,"opacity",p[9]),p[3]>0?m?m.p(p,w):(m=qr(p),m.c(),m.m(i,null)):m&&(m.d(1),m=null),w&2&&et(e,"--calculated-background-color",p[1])},i:Ot,o:Ot,d(p){p&&rt(e),h&&h.d(),_&&_.d(),m&&m.d(),n[24](null)}}}function qh(n,e,i){let s,r,l,u,f,h,_;const m=te("graph");let{style:p="dots"}=e,{gridWidth:w=mu}=e,{dotSize:b=gu}=e,{bgColor:k=null}=e,{dotColor:C=null}=e,{opacityThreshold:M=3}=e,{majorGrid:E=0}=e,{minOpacity:T=.4}=e;const I=m.transforms,q=I.scale;ft(n,q,X=>i(22,h=X));const j=I.translation;ft(n,j,X=>i(23,_=X));let Y,at,ct,st,nt,Q=1,G=1;function vt(X){Cn[X?"unshift":"push"](()=>{Y=X,i(4,Y)})}return n.$$set=X=>{"style"in X&&i(0,p=X.style),"gridWidth"in X&&i(14,w=X.gridWidth),"dotSize"in X&&i(15,b=X.dotSize),"bgColor"in X&&i(1,k=X.bgColor),"dotColor"in X&&i(2,C=X.dotColor),"opacityThreshold"in X&&i(16,M=X.opacityThreshold),"majorGrid"in X&&i(3,E=X.majorGrid),"minOpacity"in X&&i(17,T=X.minOpacity)},n.$$.update=()=>{n.$$.dirty&8388608&&i(21,s=_),n.$$.dirty&4194304&&i(20,r=h),n.$$.dirty&1064960&&i(6,l=r*w),n.$$.dirty&1081344&&i(5,u=r*b/2),n.$$.dirty&64&&i(11,f=l/2),n.$$.dirty&4128816&&(i(18,at=(Y==null?void 0:Y.offsetWidth)||0),i(19,ct=(Y==null?void 0:Y.offsetHeight)||0),i(7,st=(at+u)*(1-r)/2+s.x),i(8,nt=(ct+u)*(1-r)/2+s.y),i(9,Q=r>M?1:r/M+T),i(10,G=r>M/3?1:r/(M/3)+T))},[p,k,C,E,Y,u,l,st,nt,Q,G,f,q,j,w,b,M,T,at,ct,r,s,h,_,vt]}class Vh extends nn{constructor(e){super(),en(this,e,qh,Yh,Ye,{style:0,gridWidth:14,dotSize:15,bgColor:1,dotColor:2,opacityThreshold:16,majorGrid:3,minOpacity:17})}}function Kh(n){let e,i;return{c(){e=ot("div"),i=ot("div"),v(i,"class","selection-box svelte-10ds4jd"),Xt(i,"creating",n[0]),v(e,"class","selection-border svelte-10ds4jd"),Xt(e,"creating",n[0]),et(e,"--prop-selection-box-color",n[1]),et(e,"height",n[4]),et(e,"width",n[3]),et(e,"top",n[6]),et(e,"left",n[5])},m(s,r){lt(s,e,r),S(e,i),n[18](i)},p(s,[r]){r&1&&Xt(i,"creating",s[0]),r&1&&Xt(e,"creating",s[0]),r&2&&et(e,"--prop-selection-box-color",s[1]),r&16&&et(e,"height",s[4]),r&8&&et(e,"width",s[3]),r&64&&et(e,"top",s[6]),r&32&&et(e,"left",s[5])},i:Ot,o:Ot,d(s){s&&rt(e),n[18](null)}}}function Jh(n,e,i){let s,r,l,u,f,h,_,m,p,w,b=Ot,k=()=>(b(),b=Je(s,G=>i(20,w=G)),s),C,M;ft(n,Ha,G=>i(16,C=G)),n.$$.on_destroy.push(()=>b());let{graph:E}=e,{anchor:T}=e,{adding:I=!1}=e,{creating:q=!1}=e,{color:j=null}=e;const{groups:Y}=E;ft(n,Y,G=>i(17,M=G));let at,ct;zn(st);function st(){at=Array.from(document.querySelectorAll(".svelvet-node")).map(vt=>{const{top:X,left:$,width:J,height:B}=vt.getBoundingClientRect();return{id:vt.id,top:X,left:$,width:J,height:B}})}function nt(){if(!at)return;const G=at.reduce((vt,X)=>{if(f+T.left<=X.left&&u+T.top<=X.top&&f+T.left+Math.abs(l)>=X.left+X.width&&u+T.top+Math.abs(r)>=X.top+X.height){const $=X.id,J=E.nodes.get($);if(!J)return vt;vt.push(J)}return vt},[]);I?G.forEach(vt=>{w.add(vt)}):Mt(s,w=new Set(G),w),s.set(w)}function Q(G){Cn[G?"unshift":"push"](()=>{ct=G,i(2,ct)})}return n.$$set=G=>{"graph"in G&&i(9,E=G.graph),"anchor"in G&&i(10,T=G.anchor),"adding"in G&&i(11,I=G.adding),"creating"in G&&i(0,q=G.creating),"color"in G&&i(1,j=G.color)},n.$$.update=()=>{n.$$.dirty&131072&&k(i(7,s=M.selected.nodes)),n.$$.dirty&66560&&i(12,r=C.y-T.y-T.top),n.$$.dirty&66560&&i(14,l=C.x-T.x-T.left),n.$$.dirty&5120&&i(13,u=Math.min(T.y,T.y+r)),n.$$.dirty&17408&&i(15,f=Math.min(T.x,T.x+l)),n.$$.dirty&8192&&i(6,h=`${u}px`),n.$$.dirty&32768&&i(5,_=`${f}px`),n.$$.dirty&4096&&i(4,m=`${Math.abs(r)}px`),n.$$.dirty&16384&&i(3,p=`${Math.abs(l)}px`),n.$$.dirty&20480&&(l||r)&&nt()},[q,j,ct,p,m,_,h,s,Y,E,T,I,r,u,l,f,C,M,Q]}class Qh extends nn{constructor(e){super(),en(this,e,Jh,Kh,Ye,{graph:9,anchor:10,adding:11,creating:0,color:1})}}const $h=n=>({}),Vr=n=>({}),tf=n=>({}),Kr=n=>({}),ef=n=>({}),Jr=n=>({}),nf=n=>({}),Qr=n=>({}),of=n=>({}),$r=n=>({}),sf=n=>({}),ta=n=>({});function ea(n){let e,i;return e=new Eh({props:{editing:n[24]}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[0]&16777216&&(l.editing=s[24]),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function rf(n){let e,i,s=n[24]&&ea(n);const r=n[56].default,l=de(r,n,n[58],null);return{c(){s&&s.c(),e=pt(),l&&l.c()},m(u,f){s&&s.m(u,f),lt(u,e,f),l&&l.m(u,f),i=!0},p(u,f){u[24]?s?(s.p(u,f),f[0]&16777216&&N(s,1)):(s=ea(u),s.c(),N(s,1),s.m(e.parentNode,e)):s&&(le(),R(s,1,1,()=>{s=null}),ue()),l&&l.p&&(!i||f[1]&134217728)&&me(l,r,u,u[58],i?_e(r,u[58],f,null):ge(u[58]),null)},i(u){i||(N(s),N(l,u),i=!0)},o(u){R(s),R(l,u),i=!1},d(u){u&&rt(e),s&&s.d(u),l&&l.d(u)}}}function af(n){let e,i;return e=new Vh({}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p:Ot,i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function lf(n){let e;const i=n[56].background,s=de(i,n,n[58],ta);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&134217728)&&me(s,i,r,r[58],e?_e(i,r[58],l,sf):ge(r[58]),ta)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function na(n){let e,i,s;var r=n[14];function l(u,f){return{}}return r&&(e=Zn(r,l())),{c(){e&&Qt(e.$$.fragment),i=pe()},m(u,f){e&&Vt(e,u,f),lt(u,i,f),s=!0},p(u,f){if(f[0]&16384&&r!==(r=u[14])){if(e){le();const h=e;R(h.$$.fragment,1,0,()=>{Kt(h,1)}),ue()}r?(e=Zn(r,l()),Qt(e.$$.fragment),N(e.$$.fragment,1),Vt(e,i.parentNode,i)):e=null}},i(u){s||(e&&N(e.$$.fragment,u),s=!0)},o(u){e&&R(e.$$.fragment,u),s=!1},d(u){u&&rt(i),e&&Kt(e,u)}}}function ia(n){let e,i,s;var r=n[15];function l(u,f){return{}}return r&&(e=Zn(r,l())),{c(){e&&Qt(e.$$.fragment),i=pe()},m(u,f){e&&Vt(e,u,f),lt(u,i,f),s=!0},p(u,f){if(f[0]&32768&&r!==(r=u[15])){if(e){le();const h=e;R(h.$$.fragment,1,0,()=>{Kt(h,1)}),ue()}r?(e=Zn(r,l()),Qt(e.$$.fragment),N(e.$$.fragment,1),Vt(e,i.parentNode,i)):e=null}},i(u){s||(e&&N(e.$$.fragment,u),s=!0)},o(u){e&&R(e.$$.fragment,u),s=!1},d(u){u&&rt(i),e&&Kt(e,u)}}}function oa(n){let e,i,s;var r=n[13];function l(u,f){return{}}return r&&(e=Zn(r,l())),{c(){e&&Qt(e.$$.fragment),i=pe()},m(u,f){e&&Vt(e,u,f),lt(u,i,f),s=!0},p(u,f){if(f[0]&8192&&r!==(r=u[13])){if(e){le();const h=e;R(h.$$.fragment,1,0,()=>{Kt(h,1)}),ue()}r?(e=Zn(r,l()),Qt(e.$$.fragment),N(e.$$.fragment,1),Vt(e,i.parentNode,i)):e=null}},i(u){s||(e&&N(e.$$.fragment,u),s=!0)},o(u){e&&R(e.$$.fragment,u),s=!1},d(u){u&&rt(i),e&&Kt(e,u)}}}function sa(n){let e,i,s;var r=n[16];function l(u,f){return{}}return r&&(e=Zn(r,l())),{c(){e&&Qt(e.$$.fragment),i=pe()},m(u,f){e&&Vt(e,u,f),lt(u,i,f),s=!0},p(u,f){if(f[0]&65536&&r!==(r=u[16])){if(e){le();const h=e;R(h.$$.fragment,1,0,()=>{Kt(h,1)}),ue()}r?(e=Zn(r,l()),Qt(e.$$.fragment),N(e.$$.fragment,1),Vt(e,i.parentNode,i)):e=null}},i(u){s||(e&&N(e.$$.fragment,u),s=!0)},o(u){e&&R(e.$$.fragment,u),s=!1},d(u){u&&rt(i),e&&Kt(e,u)}}}function ra(n){let e,i,s;var r=n[17];function l(u,f){return{}}return r&&(e=Zn(r,l())),{c(){e&&Qt(e.$$.fragment),i=pe()},m(u,f){e&&Vt(e,u,f),lt(u,i,f),s=!0},p(u,f){if(f[0]&131072&&r!==(r=u[17])){if(e){le();const h=e;R(h.$$.fragment,1,0,()=>{Kt(h,1)}),ue()}r?(e=Zn(r,l()),Qt(e.$$.fragment),N(e.$$.fragment,1),Vt(e,i.parentNode,i)):e=null}},i(u){s||(e&&N(e.$$.fragment,u),s=!0)},o(u){e&&R(e.$$.fragment,u),s=!1},d(u){u&&rt(i),e&&Kt(e,u)}}}function aa(n){let e,i;return e=new Qh({props:{creating:n[20],anchor:n[18],graph:n[3],adding:n[21],color:n[9]}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[0]&1048576&&(l.creating=s[20]),r[0]&262144&&(l.anchor=s[18]),r[0]&8&&(l.graph=s[3]),r[0]&2097152&&(l.adding=s[21]),r[0]&512&&(l.color=s[9]),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function uf(n){let e,i,s,r,l,u,f,h,_,m,p,w,b,k,C,M,E,T,I,q;i=new Fh({props:{isMovable:n[22],$$slots:{default:[rf]},$$scope:{ctx:n}}});const j=[lf,af],Y=[];function at(Z,W){return Z[10]?0:1}r=at(n),l=Y[r]=j[r](n);let ct=n[0]&&na(n),st=n[1]&&ia(n),nt=n[6]&&oa(n),Q=n[2]&&sa(n),G=n[12]&&ra(n);const vt=n[56].minimap,X=de(vt,n,n[58],$r),$=n[56].drawer,J=de($,n,n[58],Qr),B=n[56].controls,A=de(B,n,n[58],Jr),Nt=n[56].toggle,V=de(Nt,n,n[58],Kr),yt=n[56].contrast,Pt=de(yt,n,n[58],Vr);let dt=n[19]&&!n[8]&&aa(n);return{c(){e=ot("section"),Qt(i.$$.fragment),s=pt(),l.c(),u=pt(),ct&&ct.c(),f=pt(),st&&st.c(),h=pt(),nt&&nt.c(),_=pt(),Q&&Q.c(),m=pt(),G&&G.c(),p=pt(),X&&X.c(),w=pt(),J&&J.c(),b=pt(),A&&A.c(),k=pt(),V&&V.c(),C=pt(),Pt&&Pt.c(),M=pt(),dt&&dt.c(),v(e,"role","presentation"),v(e,"id",E=n[3].id),v(e,"class","svelvet-wrapper svelte-13nq7cv"),v(e,"title",n[11]),v(e,"tabindex",0),et(e,"width",n[4]?n[4]+"px":"100%"),et(e,"height",n[5]?n[5]+"px":"100%"),et(e,"cursor",n[7]?"move":"default")},m(Z,W){lt(Z,e,W),Vt(i,e,null),S(e,s),Y[r].m(e,null),S(e,u),ct&&ct.m(e,null),S(e,f),st&&st.m(e,null),S(e,h),nt&&nt.m(e,null),S(e,_),Q&&Q.m(e,null),S(e,m),G&&G.m(e,null),S(e,p),X&&X.m(e,null),S(e,w),J&&J.m(e,null),S(e,b),A&&A.m(e,null),S(e,k),V&&V.m(e,null),S(e,C),Pt&&Pt.m(e,null),S(e,M),dt&&dt.m(e,null),n[57](e),T=!0,I||(q=[Ct(window,"touchend",n[36]),Ct(window,"mouseup",n[36]),Ct(window,"resize",n[35]),Ct(window,"scroll",n[35]),Ct(e,"wheel",wn(n[43])),Ct(e,"mousedown",Ii(wn(n[37]))),Ct(e,"touchend",wn(n[39])),Ct(e,"touchstart",Ii(wn(n[38]))),Ct(e,"keydown",n[40]),Ct(e,"keyup",n[42]),Ct(e,"dragover",wn(cf)),Ct(e,"drop",n[41])],I=!0)},p(Z,W){const H={};W[0]&4194304&&(H.isMovable=Z[22]),W[0]&16777216|W[1]&134217728&&(H.$$scope={dirty:W,ctx:Z}),i.$set(H);let F=r;r=at(Z),r===F?Y[r].p(Z,W):(le(),R(Y[F],1,1,()=>{Y[F]=null}),ue(),l=Y[r],l?l.p(Z,W):(l=Y[r]=j[r](Z),l.c()),N(l,1),l.m(e,u)),Z[0]?ct?(ct.p(Z,W),W[0]&1&&N(ct,1)):(ct=na(Z),ct.c(),N(ct,1),ct.m(e,f)):ct&&(le(),R(ct,1,1,()=>{ct=null}),ue()),Z[1]?st?(st.p(Z,W),W[0]&2&&N(st,1)):(st=ia(Z),st.c(),N(st,1),st.m(e,h)):st&&(le(),R(st,1,1,()=>{st=null}),ue()),Z[6]?nt?(nt.p(Z,W),W[0]&64&&N(nt,1)):(nt=oa(Z),nt.c(),N(nt,1),nt.m(e,_)):nt&&(le(),R(nt,1,1,()=>{nt=null}),ue()),Z[2]?Q?(Q.p(Z,W),W[0]&4&&N(Q,1)):(Q=sa(Z),Q.c(),N(Q,1),Q.m(e,m)):Q&&(le(),R(Q,1,1,()=>{Q=null}),ue()),Z[12]?G?(G.p(Z,W),W[0]&4096&&N(G,1)):(G=ra(Z),G.c(),N(G,1),G.m(e,p)):G&&(le(),R(G,1,1,()=>{G=null}),ue()),X&&X.p&&(!T||W[1]&134217728)&&me(X,vt,Z,Z[58],T?_e(vt,Z[58],W,of):ge(Z[58]),$r),J&&J.p&&(!T||W[1]&134217728)&&me(J,$,Z,Z[58],T?_e($,Z[58],W,nf):ge(Z[58]),Qr),A&&A.p&&(!T||W[1]&134217728)&&me(A,B,Z,Z[58],T?_e(B,Z[58],W,ef):ge(Z[58]),Jr),V&&V.p&&(!T||W[1]&134217728)&&me(V,Nt,Z,Z[58],T?_e(Nt,Z[58],W,tf):ge(Z[58]),Kr),Pt&&Pt.p&&(!T||W[1]&134217728)&&me(Pt,yt,Z,Z[58],T?_e(yt,Z[58],W,$h):ge(Z[58]),Vr),Z[19]&&!Z[8]?dt?(dt.p(Z,W),W[0]&524544&&N(dt,1)):(dt=aa(Z),dt.c(),N(dt,1),dt.m(e,null)):dt&&(le(),R(dt,1,1,()=>{dt=null}),ue()),(!T||W[0]&8&&E!==(E=Z[3].id))&&v(e,"id",E),(!T||W[0]&2048)&&v(e,"title",Z[11]),W[0]&16&&et(e,"width",Z[4]?Z[4]+"px":"100%"),W[0]&32&&et(e,"height",Z[5]?Z[5]+"px":"100%"),W[0]&128&&et(e,"cursor",Z[7]?"move":"default")},i(Z){T||(N(i.$$.fragment,Z),N(l),N(ct),N(st),N(nt),N(Q),N(G),N(X,Z),N(J,Z),N(A,Z),N(V,Z),N(Pt,Z),N(dt),T=!0)},o(Z){R(i.$$.fragment,Z),R(l),R(ct),R(st),R(nt),R(Q),R(G),R(X,Z),R(J,Z),R(A,Z),R(V,Z),R(Pt,Z),R(dt),T=!1},d(Z){Z&&rt(e),Kt(i),Y[r].d(),ct&&ct.d(),st&&st.d(),nt&&nt.d(),Q&&Q.d(),G&&G.d(),X&&X.d(Z),J&&J.d(Z),A&&A.d(Z),V&&V.d(Z),Pt&&Pt.d(Z),dt&&dt.d(),n[57](null),I=!1,tn(q)}}}function cf(n){n.preventDefault()}function hf(n,e,i){let s,r,l,u,f,h,_,m,p,w,b,k,C,M,E;ft(n,Vo,y=>i(70,_=y)),ft(n,mn,y=>i(71,m=y)),ft(n,vn,y=>i(72,p=y)),ft(n,Bn,y=>i(75,k=y));let{$$slots:T={},$$scope:I}=e,{graph:q}=e,{width:j}=e,{height:Y}=e,{minimap:at=!1}=e,{controls:ct=!1}=e,{toggle:st=!1}=e,{fixedZoom:nt=!1}=e,{pannable:Q=!0}=e,{disableSelection:G=!1}=e,{ZOOM_INCREMENT:vt=.1}=e,{PAN_INCREMENT:X=50}=e,{PAN_TIME:$=250}=e,{MAX_SCALE:J=3}=e,{MIN_SCALE:B=.2}=e,{selectionColor:A}=e,{backgroundExists:Nt}=e,{fitView:V=!1}=e,{trackpadPan:yt}=e,{modifier:Pt}=e,{theme:dt="light"}=e,{title:Z}=e,{drawer:W=!1}=e,{contrast:H=!1}=e;console.log("Initial Graph drawer prop:",W);let F;const Gt=wi(),re={},ht=U(!1),Lt=U(0),St=U(null);ft(n,St,y=>i(23,f=y));const xt=q.cursor,ne=q.transforms.scale;ft(n,ne,y=>i(68,u=y));const ce=q.dimensions;ft(n,ce,y=>i(55,M=y));const Se=q.transforms.translation;ft(n,Se,y=>i(67,l=y));const K=q.groups;ft(n,K,y=>i(69,h=y));const he=q.groupBoxes,Zt=h.selected.nodes;ft(n,Zt,y=>i(66,r=y));const Tt=q.activeGroup;ft(n,Tt,y=>i(74,b=y));const Ut=q.initialNodePositions;ft(n,Ut,y=>i(73,w=y));const we=q.editing;ft(n,we,y=>i(24,E=y));const Ne=q.bounds.nodeBounds;ft(n,Ne,y=>i(76,C=y));let We=0,Me=1,Ft={x:0,y:0,top:0,left:0},Ce=!1,be=!1,qe=!1,ve=!1,fe=!1,ze=!1,He,Xe=null,xe=null,Ie=null,D=null,it=null;const Et={id:null,position:q.cursor,offset:U({x:0,y:0}),connected:U(new Set),dynamic:U(!1),edge:null,edgeColor:U(null),direction:U("self"),inputKey:null,type:"output",moving:uo(!1),store:null,mounted:U(!0),rotation:uo(0),node:{zIndex:U(1/0),rotating:U(!1),position:q.cursor,dimensions:{width:U(0),height:U(0)}}};Le("graphDOMElement",St),Le("cursorAnchor",Et),Le("duplicate",ht),Le("graph",q),Le("transforms",q.transforms),Le("dimensions",q.dimensions),Le("locked",q.locked),Le("groups",q.groups),Le("bounds",q.bounds),Le("edgeStore",q.edges),Le("nodeStore",q.nodes),Le("mounted",Lt),zn(()=>{console.log("Graph component mounted with drawer1:",W),ye()});async function At(){await Ba(),vn.set(!0);const{x:y,y:ut,scale:bt}=Wu(He,C);y!==null&&ut!==null&&bt!==null&&(q.transforms.scale.set(bt),Se.set({x:y,y:ut})),vn.set(!1),i(54,ze=!0)}async function $t(){i(14,xe=(await Ai(async()=>{const{default:y}=await import("./Minimap-6vF3teR8.js");return{default:y}},[])).default)}async function ie(){i(13,Xe=(await Ai(async()=>{const{default:y}=await import("./ThemeToggle-CmShuKPJ.js");return{default:y}},[])).default)}async function Qe(){i(15,Ie=(await Ai(async()=>{const{default:y}=await import("./Controls-BuZt2rJO.js");return{default:y}},__vite__mapDeps([0,1]))).default)}async function Te(){i(16,D=(await Ai(async()=>{const{default:y}=await import("./DrawerController-CunOJ5Gd.js");return{default:y}},__vite__mapDeps([2,1,3]))).default)}async function Dt(){i(17,it=(await Ai(async()=>{const{default:y}=await import("./ContrastTheme-8vl10reL.js");return{default:y}},[])).default)}function ye(){if(!f)return;const y=f.getBoundingClientRect();He={top:y.top,left:y.left,bottom:y.bottom,right:y.right,width:y.width,height:y.height},q.dimensions.set(He),V==="resize"&&At()}function Yt(y){if(be){const wt=`${Tu()}/${q.id}`,zt=gt(xt),O=zt.x-m.x,qt=zt.y-m.y,ke=Math.min(m.y,m.y+qt),se=Math.min(m.x,m.x+O),Fe={width:U(Math.abs(O)),height:U(Math.abs(qt))},ln=U({x:se,y:ke}),on={group:U(wt),dimensions:Fe,position:ln,color:U(bu()),moving:U(!1)};he.add(on,wt),Array.from(r).forEach(yn=>{yn.group.set(wt)}),K.update(yn=>{const Dn={parent:U(on),nodes:U(new Set([...r,on]))};return yn[wt]=Dn,yn}),Mt(Zt,r=new Set,r),i(20,be=!1),i(19,Ce=!1)}b&&Array.from(gt(h[b].nodes)).forEach(wt=>{const zt=lo(gt(wt.position).x,gt(wt.position).y);wt.position.set(zt),wt.moving.set(!1)});const ut=q.edges.get("cursor");ut&&(q.edges.delete("cursor"),ut.disconnect||Gt("edgeDrop",{cursor:gt(xt),source:{node:k==null?void 0:k.anchor.node.id.slice(2),anchor:k==null?void 0:k.anchor.id.split("/")[0].slice(2)}})),Mt(Tt,b=null,b),Mt(mn,m={x:0,y:0},m),Mt(Ut,w=[],w),i(19,Ce=!1),i(22,ve=!1),Mt(vn,p=!1,p),y.shiftKey||Bn.set(null),i(18,Ft.y=0,Ft),i(18,Ft.x=0,Ft)}function Rt(y){if(!Q&&!(y.shiftKey||y.metaKey)||y.button===2)return;f&&f.focus();const{clientX:ut,clientY:bt}=y;if(Mt(mn,m=gt(xt),m),y.shiftKey||y.metaKey){y.preventDefault(),i(19,Ce=!0);const{top:wt,left:zt}=s;i(18,Ft.y=bt-wt,Ft),i(18,Ft.x=ut-zt,Ft),i(18,Ft.top=wt,Ft),i(18,Ft.left=zt,Ft),y.shiftKey&&y.metaKey?i(20,be=!0):i(20,be=!1),y.metaKey&&!y.shiftKey?i(21,qe=!0):i(21,qe=!1)}else i(22,ve=!0),Mt(Zt,r=new Set,r),Zt.set(r)}function Ge(y){Mt(Zt,r=new Set,r),Zt.set(r),Mt(mn,m=gt(xt),m),i(22,ve=!0),y.touches.length===2&&(fn(),We=_,Me=u)}function Ve(){i(22,ve=!1),fe=!1}function fn(){fe||(fe=!0,F=requestAnimationFrame(cn))}function cn(){if(!fe){cancelAnimationFrame(F);return}const ut=_/We;Mt(ne,u=Me*ut,u),F=requestAnimationFrame(cn)}function Ke(y){const{key:ut,code:bt}=y,wt=y.target;if(!(wt.tagName=="INPUT"||wt.tagName=="TEXTAREA")){if(bt==="KeyA"&&y[`${Pt}Key`]){const zt=q.nodes.getAll().filter(O=>!gt(O.locked));Mt(Zt,r=new Set(zt),r)}else if(jr(ut))Be(ut,y);else if(ut==="=")Vs(-1,q.dimensions,q.transforms,vt);else if(ut==="-")Vs(1,q.dimensions,q.transforms,vt);else if(ut==="0")At();else if(ut==="Control")h.selected.nodes.set(new Set);else if(bt==="KeyD"&&y[`${Pt}Key`])ht.set(!0),setTimeout(()=>{ht.set(!1)},100);else if(ut==="Tab"&&(y.altKey||y.ctrlKey))_t();else if(ut==="l")i(44,dt=dt==="light"?"dark":"light");else if(ut==="d")i(2,W=!W);else if(ut==="m")i(0,at=!at);else if(ut==="c")i(1,ct=!ct);else if(ut==="e"){const zt=Array.from(r)[0];q.editing.set(zt)}else return;y.preventDefault()}}function oe(y){y.preventDefault();const ut=f==null?void 0:f.getBoundingClientRect();if(!ut)return;const bt=y.clientX-ut.left,wt=y.clientY-ut.top,{x:zt,y:O}=lo(bt,wt);if(console.log(`Dropped Node at Snapped Position: (${zt}, ${O})`),!ke)return;const qt={id:`node-${Date.now()}`,rotation:U(0),position:U({x:zt,y:O}),moving:U(!1),label:U("New Node"),dimensions:{width:U(200),height:U(100)},inputs:U(2),outputs:U(2),anchors:U([]),group:U(null),collapsed:U(!1),resizingWidth:U(!1),resizingHeight:U(!1),rotating:U(!1),editable:U(!0),locked:U(!1),recalculateAnchors:se=>{},resizable:U(!0),zIndex:U(1),edge:null,direction:U("TD"),borderRadius:U(5),borderWidth:U(1),connections:U([]),bgColor:U("#007bff"),borderColor:U("#000"),selectionColor:U("#ff0000"),textColor:U("#fff")};let ke=null;q.nodes.add(qt,qt.id),ke=null}function _t(){const y=q.nodes.getAll(),ut=y.findIndex(wt=>r.has(wt)),bt=ut+1;r.delete(y[ut]),r.add(y[bt])}function an(y){const{key:ut}=y;jr(ut)?(clearInterval(re[ut]),delete re[ut]):ut==="Shift"&&Bn.set(null)}function hn(y){if(nt)return;const ut=y.shiftKey?.15:1,{clientX:bt,clientY:wt,deltaY:zt}=y,O=l,qt={x:bt,y:wt};if((yt||y.metaKey)&&zt%1===0){Mt(Se,l={x:Mt(Se,l.x-=y.deltaX,l),y:Mt(Se,l.y-=y.deltaY,l)},l);return}if(u>=J&&zt<0||u<=B&&zt>0)return;const ke=Math.min(.009*ut*Math.abs(zt),.08),se=Ga(u,Math.sign(zt),ke),Fe=Fa(u,se,O,qt,He);ne.set(se),Se.set(Fe)}function Be(y,ut){const bt=ut.shiftKey?2:1,wt=y==="ArrowLeft"||y==="ArrowUp"?1:-1,zt=y==="ArrowLeft"||y==="ArrowRight",O=zt?l.x:l.y,qt=O+wt*X*bt;if(!re[y]){const ke=performance.now();let se=setInterval(()=>{const Fe=performance.now()-ke;if(r.size===0){const ln=O+(qt-O)*(Fe/$);Se.set({x:zt?ln:l.x,y:zt?l.y:ln})}else{const ln={x:zt?-wt*2:0,y:zt?0:-wt*2};Array.from(r).forEach(on=>{const yn=gt(on.position);let Dn;const ai=gt(on.group),bi=gt(q.groupBoxes);if(ai&&(Dn=bi.get(ai)),Dn){const An=gt(on.dimensions.width),Sn=gt(on.dimensions.height),Kn=Ya(Dn,An,Sn);Ua(yn,ln,on.position,Kn)}else{const An={x:yn.x+ln.x,y:yn.y+ln.y},Sn=lo(An.x,An.y);on.position.set(Sn)}})}},2);re[y]=se}}function Bt(y){Cn[y?"unshift":"push"](()=>{f=y,St.set(f)})}return n.$$set=y=>{"graph"in y&&i(3,q=y.graph),"width"in y&&i(4,j=y.width),"height"in y&&i(5,Y=y.height),"minimap"in y&&i(0,at=y.minimap),"controls"in y&&i(1,ct=y.controls),"toggle"in y&&i(6,st=y.toggle),"fixedZoom"in y&&i(45,nt=y.fixedZoom),"pannable"in y&&i(7,Q=y.pannable),"disableSelection"in y&&i(8,G=y.disableSelection),"ZOOM_INCREMENT"in y&&i(46,vt=y.ZOOM_INCREMENT),"PAN_INCREMENT"in y&&i(47,X=y.PAN_INCREMENT),"PAN_TIME"in y&&i(48,$=y.PAN_TIME),"MAX_SCALE"in y&&i(49,J=y.MAX_SCALE),"MIN_SCALE"in y&&i(50,B=y.MIN_SCALE),"selectionColor"in y&&i(9,A=y.selectionColor),"backgroundExists"in y&&i(10,Nt=y.backgroundExists),"fitView"in y&&i(51,V=y.fitView),"trackpadPan"in y&&i(52,yt=y.trackpadPan),"modifier"in y&&i(53,Pt=y.modifier),"theme"in y&&i(44,dt=y.theme),"title"in y&&i(11,Z=y.title),"drawer"in y&&i(2,W=y.drawer),"contrast"in y&&i(12,H=y.contrast),"$$scope"in y&&i(58,I=y.$$scope)},n.$$.update=()=>{n.$$.dirty[1]&16777216&&(s=M),n.$$.dirty[1]&8192&&dt&&document.documentElement.setAttribute("svelvet-theme",dt),n.$$.dirty[1]&9437184&&!ze&&V&&At(),n.$$.dirty[0]&8256&&st&&!Xe&&ie(),n.$$.dirty[0]&16385&&at&&!xe&&$t(),n.$$.dirty[0]&32770&&ct&&!Ie&&Qe(),n.$$.dirty[0]&65540&&W&&!D&&Te(),n.$$.dirty[0]&135168&&H&&!it&&Dt(),n.$$.dirty[0]&4&&console.log("Reactive Graph drawer prop:",W)},[at,ct,W,q,j,Y,st,Q,G,A,Nt,Z,H,Xe,xe,Ie,D,it,Ft,Ce,be,qe,ve,f,E,St,ne,ce,Se,K,Zt,Tt,Ut,we,Ne,ye,Yt,Rt,Ge,Ve,Ke,oe,an,hn,dt,nt,vt,X,$,J,B,V,yt,Pt,ze,M,T,Bt,I]}class ff extends nn{constructor(e){super(),en(this,e,hf,uf,Ye,{graph:3,width:4,height:5,minimap:0,controls:1,toggle:6,fixedZoom:45,pannable:7,disableSelection:8,ZOOM_INCREMENT:46,PAN_INCREMENT:47,PAN_TIME:48,MAX_SCALE:49,MIN_SCALE:50,selectionColor:9,backgroundExists:10,fitView:51,trackpadPan:52,modifier:53,theme:44,title:11,drawer:2,contrast:12},null,[-1,-1,-1])}}const df=n=>({}),la=n=>({slot:"minimap"}),_f=n=>({}),ua=n=>({slot:"controls"}),mf=n=>({}),ca=n=>({slot:"background"}),gf=n=>({}),ha=n=>({slot:"toggle"}),pf=n=>({}),fa=n=>({slot:"drawer"}),vf=n=>({}),da=n=>({slot:"contrast"});function yf(n){let e;return{c(){e=ot("div"),v(e,"class","svelvet-temp svelte-lsy29y"),et(e,"width",n[2]?n[2]+"px":"100%"),et(e,"height",n[3]?n[3]+"px":"100%")},m(i,s){lt(i,e,s)},p(i,s){s[0]&4&&et(e,"width",i[2]?i[2]+"px":"100%"),s[0]&8&&et(e,"height",i[3]?i[3]+"px":"100%")},i:Ot,o:Ot,d(i){i&&rt(e)}}}function wf(n){let e,i;return e=new ff({props:{width:n[2],height:n[3],toggle:n[6],backgroundExists:n[19],minimap:n[4],graph:n[18],fitView:n[9],fixedZoom:n[16],pannable:n[17],theme:n[1],drawer:n[7],controls:n[5],selectionColor:n[10],disableSelection:n[11],trackpadPan:n[13],modifier:n[14],title:n[15],contrast:n[8],$$slots:{contrast:[Mf],drawer:[Sf],toggle:[Cf],background:[Lf],controls:[Pf],minimap:[kf],default:[bf]},$$scope:{ctx:n}}}),e.$on("edgeDrop",n[35]),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[0]&4&&(l.width=s[2]),r[0]&8&&(l.height=s[3]),r[0]&64&&(l.toggle=s[6]),r[0]&524288&&(l.backgroundExists=s[19]),r[0]&16&&(l.minimap=s[4]),r[0]&262144&&(l.graph=s[18]),r[0]&512&&(l.fitView=s[9]),r[0]&65536&&(l.fixedZoom=s[16]),r[0]&131072&&(l.pannable=s[17]),r[0]&2&&(l.theme=s[1]),r[0]&128&&(l.drawer=s[7]),r[0]&32&&(l.controls=s[5]),r[0]&1024&&(l.selectionColor=s[10]),r[0]&2048&&(l.disableSelection=s[11]),r[0]&8192&&(l.trackpadPan=s[13]),r[0]&16384&&(l.modifier=s[14]),r[0]&32768&&(l.title=s[15]),r[0]&256&&(l.contrast=s[8]),r[0]&4097|r[1]&32&&(l.$$scope={dirty:r,ctx:s}),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function _a(n){let e,i;return e=new vh({props:{mermaid:n[0],mermaidConfig:n[12]}}),{c(){Qt(e.$$.fragment)},m(s,r){Vt(e,s,r),i=!0},p(s,r){const l={};r[0]&1&&(l.mermaid=s[0]),r[0]&4096&&(l.mermaidConfig=s[12]),e.$set(l)},i(s){i||(N(e.$$.fragment,s),i=!0)},o(s){R(e.$$.fragment,s),i=!1},d(s){Kt(e,s)}}}function bf(n){let e,i,s=n[0].length&&_a(n);const r=n[34].default,l=de(r,n,n[36],null);return{c(){s&&s.c(),e=pt(),l&&l.c()},m(u,f){s&&s.m(u,f),lt(u,e,f),l&&l.m(u,f),i=!0},p(u,f){u[0].length?s?(s.p(u,f),f[0]&1&&N(s,1)):(s=_a(u),s.c(),N(s,1),s.m(e.parentNode,e)):s&&(le(),R(s,1,1,()=>{s=null}),ue()),l&&l.p&&(!i||f[1]&32)&&me(l,r,u,u[36],i?_e(r,u[36],f,null):ge(u[36]),null)},i(u){i||(N(s),N(l,u),i=!0)},o(u){R(s),R(l,u),i=!1},d(u){u&&rt(e),s&&s.d(u),l&&l.d(u)}}}function kf(n){let e;const i=n[34].minimap,s=de(i,n,n[36],la);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&32)&&me(s,i,r,r[36],e?_e(i,r[36],l,df):ge(r[36]),la)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Pf(n){let e;const i=n[34].controls,s=de(i,n,n[36],ua);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&32)&&me(s,i,r,r[36],e?_e(i,r[36],l,_f):ge(r[36]),ua)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Lf(n){let e;const i=n[34].background,s=de(i,n,n[36],ca);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&32)&&me(s,i,r,r[36],e?_e(i,r[36],l,mf):ge(r[36]),ca)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Cf(n){let e;const i=n[34].toggle,s=de(i,n,n[36],ha);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&32)&&me(s,i,r,r[36],e?_e(i,r[36],l,gf):ge(r[36]),ha)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Sf(n){let e;const i=n[34].drawer,s=de(i,n,n[36],fa);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&32)&&me(s,i,r,r[36],e?_e(i,r[36],l,pf):ge(r[36]),fa)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Mf(n){let e;const i=n[34].contrast,s=de(i,n,n[36],da);return{c(){s&&s.c()},m(r,l){s&&s.m(r,l),e=!0},p(r,l){s&&s.p&&(!e||l[1]&32)&&me(s,i,r,r[36],e?_e(i,r[36],l,vf):ge(r[36]),da)},i(r){e||(N(s,r),e=!0)},o(r){R(s,r),e=!1},d(r){s&&s.d(r)}}}function Tf(n){let e,i,s,r;const l=[wf,yf],u=[];function f(h,_){return h[18]?0:1}return e=f(n),i=u[e]=l[e](n),{c(){i.c(),s=pe()},m(h,_){u[e].m(h,_),lt(h,s,_),r=!0},p(h,_){let m=e;e=f(h),e===m?u[e].p(h,_):(le(),R(u[m],1,1,()=>{u[m]=null}),ue(),i=u[e],i?i.p(h,_):(i=u[e]=l[e](h),i.c()),N(i,1),i.m(s.parentNode,s))},i(h){r||(N(i),r=!0)},o(h){R(i),r=!1},d(h){h&&rt(s),u[e].d(h)}}}function Ef(n,e,i){let s,r,{$$slots:l={},$$scope:u}=e;const f=ts(l);let{mermaid:h=""}=e,{theme:_="light"}=e,{id:m=0}=e,{snapTo:p=0}=e,{zoom:w=1}=e,{TD:b=!1}=e,{editable:k=!0}=e,{locked:C=!1}=e,{width:M=0}=e,{height:E=0}=e,{minimap:T=!1}=e,{controls:I=!1}=e,{toggle:q=!1}=e,{drawer:j=!1}=e,{contrast:Y=!1}=e,{fitView:at=!1}=e,{selectionColor:ct="lightblue"}=e,{edgeStyle:st="bezier"}=e,{endStyles:nt=[null,null]}=e,{edge:Q=null}=e,{disableSelection:G=!1}=e,{mermaidConfig:vt={}}=e,{translation:X={x:0,y:0}}=e,{trackpadPan:$=!1}=e,{modifier:J="meta"}=e,{raiseEdgesOnSelect:B=!1}=e,{edgesAboveNode:A=!1}=e,{title:Nt=""}=e,{fixedZoom:V=!1}=e,{pannable:yt=!0}=e;const Pt=wi();let dt=null,Z=b?"TD":"LR";Le("snapTo",p),Le("edgeStyle",st),Le("endStyles",nt),Le("graphEdge",Q),Le("raiseEdgesOnSelect",B),Le("edgesAboveNode",A),Le("graph",dt),zn(()=>{console.log("Graph component mounted with drawer:",j);const F=localStorage.getItem("state");if(console.log("stateObject during onMount:",F),F)i(18,dt=Yu(F)),console.log("This is the graph set using reloadStore",dt),Ho.add(dt,dt.id),console.log("graphStore updated",dt);else{let Gt=`G-${m||Ho.count()+1}`;i(18,dt=ja(Gt,{zoom:w,direction:Z,editable:k,locked:C,translation:X})),Ho.add(dt,Gt)}});function W(F,Gt){if(!dt)return;const re=`N-${F[0]}`,ht=dt.nodes.get(re);if(!ht)return;const Lt=ht.anchors.get(`A-${F[1]}/N-${F[0]}`);if(!Lt)return;const St=`N-${Gt[0]}`,xt=dt.nodes.get(St);if(!xt)return;const ne=xt.anchors.get(`A-${Gt[1]}/N-${Gt[0]}`);if(!ne)return;const ce=dt.edges.match(Lt,ne);ce&&dt.edges.delete(ce[0])}function H(F){Re.call(this,n,F)}return n.$$set=F=>{"mermaid"in F&&i(0,h=F.mermaid),"theme"in F&&i(1,_=F.theme),"id"in F&&i(20,m=F.id),"snapTo"in F&&i(21,p=F.snapTo),"zoom"in F&&i(22,w=F.zoom),"TD"in F&&i(23,b=F.TD),"editable"in F&&i(24,k=F.editable),"locked"in F&&i(25,C=F.locked),"width"in F&&i(2,M=F.width),"height"in F&&i(3,E=F.height),"minimap"in F&&i(4,T=F.minimap),"controls"in F&&i(5,I=F.controls),"toggle"in F&&i(6,q=F.toggle),"drawer"in F&&i(7,j=F.drawer),"contrast"in F&&i(8,Y=F.contrast),"fitView"in F&&i(9,at=F.fitView),"selectionColor"in F&&i(10,ct=F.selectionColor),"edgeStyle"in F&&i(26,st=F.edgeStyle),"endStyles"in F&&i(27,nt=F.endStyles),"edge"in F&&i(28,Q=F.edge),"disableSelection"in F&&i(11,G=F.disableSelection),"mermaidConfig"in F&&i(12,vt=F.mermaidConfig),"translation"in F&&i(29,X=F.translation),"trackpadPan"in F&&i(13,$=F.trackpadPan),"modifier"in F&&i(14,J=F.modifier),"raiseEdgesOnSelect"in F&&i(30,B=F.raiseEdgesOnSelect),"edgesAboveNode"in F&&i(31,A=F.edgesAboveNode),"title"in F&&i(15,Nt=F.title),"fixedZoom"in F&&i(16,V=F.fixedZoom),"pannable"in F&&i(17,yt=F.pannable),"$$scope"in F&&i(36,u=F.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&262144&&i(33,r=dt&&dt.edges),n.$$.dirty[0]&4456448&&dt&&dt.transforms.scale.set(w),n.$$.dirty[1]&4&&r&&r.onEdgeChange((F,Gt)=>{Pt(Gt,{sourceAnchor:F.source,targetAnchor:F.target,sourceNode:F.source.node,targetNode:F.target.node})})},i(19,s=f.background),[h,_,M,E,T,I,q,j,Y,at,ct,G,vt,$,J,Nt,V,yt,dt,s,m,p,w,b,k,C,st,nt,Q,X,B,A,W,r,l,H,u]}class zf extends nn{constructor(e){super(),en(this,e,Ef,Tf,Ye,{mermaid:0,theme:1,id:20,snapTo:21,zoom:22,TD:23,editable:24,locked:25,width:2,height:3,minimap:4,controls:5,toggle:6,drawer:7,contrast:8,fitView:9,selectionColor:10,edgeStyle:26,endStyles:27,edge:28,disableSelection:11,mermaidConfig:12,translation:29,trackpadPan:13,modifier:14,raiseEdgesOnSelect:30,edgesAboveNode:31,title:15,fixedZoom:16,pannable:17,disconnect:32},null,[-1,-1])}get disconnect(){return this.$$.ctx[32]}}var Af=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Qo={exports:{}};/* @preserve
4
+ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
5
+ * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
6
+ */(function(n,e){(function(i,s){s(e)})(Af,function(i){var s="1.9.4";function r(t){var o,a,c,d;for(a=1,c=arguments.length;a<c;a++){d=arguments[a];for(o in d)t[o]=d[o]}return t}var l=Object.create||function(){function t(){}return function(o){return t.prototype=o,new t}}();function u(t,o){var a=Array.prototype.slice;if(t.bind)return t.bind.apply(t,a.call(arguments,1));var c=a.call(arguments,2);return function(){return t.apply(o,c.length?c.concat(a.call(arguments)):arguments)}}var f=0;function h(t){return"_leaflet_id"in t||(t._leaflet_id=++f),t._leaflet_id}function _(t,o,a){var c,d,g,P;return P=function(){c=!1,d&&(g.apply(a,d),d=!1)},g=function(){c?d=arguments:(t.apply(a,arguments),setTimeout(P,o),c=!0)},g}function m(t,o,a){var c=o[1],d=o[0],g=c-d;return t===c&&a?t:((t-d)%g+g)%g+d}function p(){return!1}function w(t,o){if(o===!1)return t;var a=Math.pow(10,o===void 0?6:o);return Math.round(t*a)/a}function b(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function k(t){return b(t).split(/\s+/)}function C(t,o){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?l(t.options):{});for(var a in o)t.options[a]=o[a];return t.options}function M(t,o,a){var c=[];for(var d in t)c.push(encodeURIComponent(a?d.toUpperCase():d)+"="+encodeURIComponent(t[d]));return(!o||o.indexOf("?")===-1?"?":"&")+c.join("&")}var E=/\{ *([\w_ -]+) *\}/g;function T(t,o){return t.replace(E,function(a,c){var d=o[c];if(d===void 0)throw new Error("No value provided for variable "+a);return typeof d=="function"&&(d=d(o)),d})}var I=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function q(t,o){for(var a=0;a<t.length;a++)if(t[a]===o)return a;return-1}var j="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function Y(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var at=0;function ct(t){var o=+new Date,a=Math.max(0,16-(o-at));return at=o+a,window.setTimeout(t,a)}var st=window.requestAnimationFrame||Y("RequestAnimationFrame")||ct,nt=window.cancelAnimationFrame||Y("CancelAnimationFrame")||Y("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function Q(t,o,a){if(a&&st===ct)t.call(o);else return st.call(window,u(t,o))}function G(t){t&&nt.call(window,t)}var vt={__proto__:null,extend:r,create:l,bind:u,get lastId(){return f},stamp:h,throttle:_,wrapNum:m,falseFn:p,formatNum:w,trim:b,splitWords:k,setOptions:C,getParamString:M,template:T,isArray:I,indexOf:q,emptyImageUrl:j,requestFn:st,cancelFn:nt,requestAnimFrame:Q,cancelAnimFrame:G};function X(){}X.extend=function(t){var o=function(){C(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},a=o.__super__=this.prototype,c=l(a);c.constructor=o,o.prototype=c;for(var d in this)Object.prototype.hasOwnProperty.call(this,d)&&d!=="prototype"&&d!=="__super__"&&(o[d]=this[d]);return t.statics&&r(o,t.statics),t.includes&&($(t.includes),r.apply(null,[c].concat(t.includes))),r(c,t),delete c.statics,delete c.includes,c.options&&(c.options=a.options?l(a.options):{},r(c.options,t.options)),c._initHooks=[],c.callInitHooks=function(){if(!this._initHooksCalled){a.callInitHooks&&a.callInitHooks.call(this),this._initHooksCalled=!0;for(var g=0,P=c._initHooks.length;g<P;g++)c._initHooks[g].call(this)}},o},X.include=function(t){var o=this.prototype.options;return r(this.prototype,t),t.options&&(this.prototype.options=o,this.mergeOptions(t.options)),this},X.mergeOptions=function(t){return r(this.prototype.options,t),this},X.addInitHook=function(t){var o=Array.prototype.slice.call(arguments,1),a=typeof t=="function"?t:function(){this[t].apply(this,o)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(a),this};function $(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=I(t)?t:[t];for(var o=0;o<t.length;o++)t[o]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var J={on:function(t,o,a){if(typeof t=="object")for(var c in t)this._on(c,t[c],o);else{t=k(t);for(var d=0,g=t.length;d<g;d++)this._on(t[d],o,a)}return this},off:function(t,o,a){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var c in t)this._off(c,t[c],o);else{t=k(t);for(var d=arguments.length===1,g=0,P=t.length;g<P;g++)d?this._off(t[g]):this._off(t[g],o,a)}return this},_on:function(t,o,a,c){if(typeof o!="function"){console.warn("wrong listener type: "+typeof o);return}if(this._listens(t,o,a)===!1){a===this&&(a=void 0);var d={fn:o,ctx:a};c&&(d.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(d)}},_off:function(t,o,a){var c,d,g;if(this._events&&(c=this._events[t],!!c)){if(arguments.length===1){if(this._firingCount)for(d=0,g=c.length;d<g;d++)c[d].fn=p;delete this._events[t];return}if(typeof o!="function"){console.warn("wrong listener type: "+typeof o);return}var P=this._listens(t,o,a);if(P!==!1){var z=c[P];this._firingCount&&(z.fn=p,this._events[t]=c=c.slice()),c.splice(P,1)}}},fire:function(t,o,a){if(!this.listens(t,a))return this;var c=r({},o,{type:t,target:this,sourceTarget:o&&o.sourceTarget||this});if(this._events){var d=this._events[t];if(d){this._firingCount=this._firingCount+1||1;for(var g=0,P=d.length;g<P;g++){var z=d[g],x=z.fn;z.once&&this.off(t,x,z.ctx),x.call(z.ctx||this,c)}this._firingCount--}}return a&&this._propagateEvent(c),this},listens:function(t,o,a,c){typeof t!="string"&&console.warn('"string" type argument expected');var d=o;typeof o!="function"&&(c=!!o,d=void 0,a=void 0);var g=this._events&&this._events[t];if(g&&g.length&&this._listens(t,d,a)!==!1)return!0;if(c){for(var P in this._eventParents)if(this._eventParents[P].listens(t,o,a,c))return!0}return!1},_listens:function(t,o,a){if(!this._events)return!1;var c=this._events[t]||[];if(!o)return!!c.length;a===this&&(a=void 0);for(var d=0,g=c.length;d<g;d++)if(c[d].fn===o&&c[d].ctx===a)return d;return!1},once:function(t,o,a){if(typeof t=="object")for(var c in t)this._on(c,t[c],o,!0);else{t=k(t);for(var d=0,g=t.length;d<g;d++)this._on(t[d],o,a,!0)}return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[h(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[h(t)],this},_propagateEvent:function(t){for(var o in this._eventParents)this._eventParents[o].fire(t.type,r({layer:t.target,propagatedFrom:t.target},t),!0)}};J.addEventListener=J.on,J.removeEventListener=J.clearAllEventListeners=J.off,J.addOneTimeEventListener=J.once,J.fireEvent=J.fire,J.hasEventListeners=J.listens;var B=X.extend(J);function A(t,o,a){this.x=a?Math.round(t):t,this.y=a?Math.round(o):o}var Nt=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};A.prototype={clone:function(){return new A(this.x,this.y)},add:function(t){return this.clone()._add(V(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(V(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new A(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new A(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Nt(this.x),this.y=Nt(this.y),this},distanceTo:function(t){t=V(t);var o=t.x-this.x,a=t.y-this.y;return Math.sqrt(o*o+a*a)},equals:function(t){return t=V(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=V(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+w(this.x)+", "+w(this.y)+")"}};function V(t,o,a){return t instanceof A?t:I(t)?new A(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new A(t.x,t.y):new A(t,o,a)}function yt(t,o){if(t)for(var a=o?[t,o]:t,c=0,d=a.length;c<d;c++)this.extend(a[c])}yt.prototype={extend:function(t){var o,a;if(!t)return this;if(t instanceof A||typeof t[0]=="number"||"x"in t)o=a=V(t);else if(t=Pt(t),o=t.min,a=t.max,!o||!a)return this;return!this.min&&!this.max?(this.min=o.clone(),this.max=a.clone()):(this.min.x=Math.min(o.x,this.min.x),this.max.x=Math.max(a.x,this.max.x),this.min.y=Math.min(o.y,this.min.y),this.max.y=Math.max(a.y,this.max.y)),this},getCenter:function(t){return V((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return V(this.min.x,this.max.y)},getTopRight:function(){return V(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var o,a;return typeof t[0]=="number"||t instanceof A?t=V(t):t=Pt(t),t instanceof yt?(o=t.min,a=t.max):o=a=t,o.x>=this.min.x&&a.x<=this.max.x&&o.y>=this.min.y&&a.y<=this.max.y},intersects:function(t){t=Pt(t);var o=this.min,a=this.max,c=t.min,d=t.max,g=d.x>=o.x&&c.x<=a.x,P=d.y>=o.y&&c.y<=a.y;return g&&P},overlaps:function(t){t=Pt(t);var o=this.min,a=this.max,c=t.min,d=t.max,g=d.x>o.x&&c.x<a.x,P=d.y>o.y&&c.y<a.y;return g&&P},isValid:function(){return!!(this.min&&this.max)},pad:function(t){var o=this.min,a=this.max,c=Math.abs(o.x-a.x)*t,d=Math.abs(o.y-a.y)*t;return Pt(V(o.x-c,o.y-d),V(a.x+c,a.y+d))},equals:function(t){return t?(t=Pt(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight())):!1}};function Pt(t,o){return!t||t instanceof yt?t:new yt(t,o)}function dt(t,o){if(t)for(var a=o?[t,o]:t,c=0,d=a.length;c<d;c++)this.extend(a[c])}dt.prototype={extend:function(t){var o=this._southWest,a=this._northEast,c,d;if(t instanceof W)c=t,d=t;else if(t instanceof dt){if(c=t._southWest,d=t._northEast,!c||!d)return this}else return t?this.extend(H(t)||Z(t)):this;return!o&&!a?(this._southWest=new W(c.lat,c.lng),this._northEast=new W(d.lat,d.lng)):(o.lat=Math.min(c.lat,o.lat),o.lng=Math.min(c.lng,o.lng),a.lat=Math.max(d.lat,a.lat),a.lng=Math.max(d.lng,a.lng)),this},pad:function(t){var o=this._southWest,a=this._northEast,c=Math.abs(o.lat-a.lat)*t,d=Math.abs(o.lng-a.lng)*t;return new dt(new W(o.lat-c,o.lng-d),new W(a.lat+c,a.lng+d))},getCenter:function(){return new W((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new W(this.getNorth(),this.getWest())},getSouthEast:function(){return new W(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){typeof t[0]=="number"||t instanceof W||"lat"in t?t=H(t):t=Z(t);var o=this._southWest,a=this._northEast,c,d;return t instanceof dt?(c=t.getSouthWest(),d=t.getNorthEast()):c=d=t,c.lat>=o.lat&&d.lat<=a.lat&&c.lng>=o.lng&&d.lng<=a.lng},intersects:function(t){t=Z(t);var o=this._southWest,a=this._northEast,c=t.getSouthWest(),d=t.getNorthEast(),g=d.lat>=o.lat&&c.lat<=a.lat,P=d.lng>=o.lng&&c.lng<=a.lng;return g&&P},overlaps:function(t){t=Z(t);var o=this._southWest,a=this._northEast,c=t.getSouthWest(),d=t.getNorthEast(),g=d.lat>o.lat&&c.lat<a.lat,P=d.lng>o.lng&&c.lng<a.lng;return g&&P},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,o){return t?(t=Z(t),this._southWest.equals(t.getSouthWest(),o)&&this._northEast.equals(t.getNorthEast(),o)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function Z(t,o){return t instanceof dt?t:new dt(t,o)}function W(t,o,a){if(isNaN(t)||isNaN(o))throw new Error("Invalid LatLng object: ("+t+", "+o+")");this.lat=+t,this.lng=+o,a!==void 0&&(this.alt=+a)}W.prototype={equals:function(t,o){if(!t)return!1;t=H(t);var a=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return a<=(o===void 0?1e-9:o)},toString:function(t){return"LatLng("+w(this.lat,t)+", "+w(this.lng,t)+")"},distanceTo:function(t){return Gt.distance(this,H(t))},wrap:function(){return Gt.wrapLatLng(this)},toBounds:function(t){var o=180*t/40075017,a=o/Math.cos(Math.PI/180*this.lat);return Z([this.lat-o,this.lng-a],[this.lat+o,this.lng+a])},clone:function(){return new W(this.lat,this.lng,this.alt)}};function H(t,o,a){return t instanceof W?t:I(t)&&typeof t[0]!="object"?t.length===3?new W(t[0],t[1],t[2]):t.length===2?new W(t[0],t[1]):null:t==null?t:typeof t=="object"&&"lat"in t?new W(t.lat,"lng"in t?t.lng:t.lon,t.alt):o===void 0?null:new W(t,o,a)}var F={latLngToPoint:function(t,o){var a=this.projection.project(t),c=this.scale(o);return this.transformation._transform(a,c)},pointToLatLng:function(t,o){var a=this.scale(o),c=this.transformation.untransform(t,a);return this.projection.unproject(c)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var o=this.projection.bounds,a=this.scale(t),c=this.transformation.transform(o.min,a),d=this.transformation.transform(o.max,a);return new yt(c,d)},infinite:!1,wrapLatLng:function(t){var o=this.wrapLng?m(t.lng,this.wrapLng,!0):t.lng,a=this.wrapLat?m(t.lat,this.wrapLat,!0):t.lat,c=t.alt;return new W(a,o,c)},wrapLatLngBounds:function(t){var o=t.getCenter(),a=this.wrapLatLng(o),c=o.lat-a.lat,d=o.lng-a.lng;if(c===0&&d===0)return t;var g=t.getSouthWest(),P=t.getNorthEast(),z=new W(g.lat-c,g.lng-d),x=new W(P.lat-c,P.lng-d);return new dt(z,x)}},Gt=r({},F,{wrapLng:[-180,180],R:6371e3,distance:function(t,o){var a=Math.PI/180,c=t.lat*a,d=o.lat*a,g=Math.sin((o.lat-t.lat)*a/2),P=Math.sin((o.lng-t.lng)*a/2),z=g*g+Math.cos(c)*Math.cos(d)*P*P,x=2*Math.atan2(Math.sqrt(z),Math.sqrt(1-z));return this.R*x}}),re=6378137,ht={R:re,MAX_LATITUDE:85.0511287798,project:function(t){var o=Math.PI/180,a=this.MAX_LATITUDE,c=Math.max(Math.min(a,t.lat),-a),d=Math.sin(c*o);return new A(this.R*t.lng*o,this.R*Math.log((1+d)/(1-d))/2)},unproject:function(t){var o=180/Math.PI;return new W((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*o,t.x*o/this.R)},bounds:function(){var t=re*Math.PI;return new yt([-t,-t],[t,t])}()};function Lt(t,o,a,c){if(I(t)){this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3];return}this._a=t,this._b=o,this._c=a,this._d=c}Lt.prototype={transform:function(t,o){return this._transform(t.clone(),o)},_transform:function(t,o){return o=o||1,t.x=o*(this._a*t.x+this._b),t.y=o*(this._c*t.y+this._d),t},untransform:function(t,o){return o=o||1,new A((t.x/o-this._b)/this._a,(t.y/o-this._d)/this._c)}};function St(t,o,a,c){return new Lt(t,o,a,c)}var xt=r({},Gt,{code:"EPSG:3857",projection:ht,transformation:function(){var t=.5/(Math.PI*ht.R);return St(t,.5,-t,.5)}()}),ne=r({},xt,{code:"EPSG:900913"});function ce(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Se(t,o){var a="",c,d,g,P,z,x;for(c=0,g=t.length;c<g;c++){for(z=t[c],d=0,P=z.length;d<P;d++)x=z[d],a+=(d?"L":"M")+x.x+" "+x.y;a+=o?_t.svg?"z":"x":""}return a||"M0 0"}var K=document.documentElement.style,he="ActiveXObject"in window,Zt=he&&!document.addEventListener,Tt="msLaunchUri"in navigator&&!("documentMode"in document),Ut=oe("webkit"),we=oe("android"),Ne=oe("android 2")||oe("android 3"),We=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),Me=we&&oe("Google")&&We<537&&!("AudioNode"in window),Ft=!!window.opera,Ce=!Tt&&oe("chrome"),be=oe("gecko")&&!Ut&&!Ft&&!he,qe=!Ce&&oe("safari"),ve=oe("phantom"),fe="OTransition"in K,ze=navigator.platform.indexOf("Win")===0,He=he&&"transition"in K,Xe="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Ne,xe="MozPerspective"in K,Ie=!window.L_DISABLE_3D&&(He||Xe||xe)&&!fe&&!ve,D=typeof orientation<"u"||oe("mobile"),it=D&&Ut,Et=D&&Xe,At=!window.PointerEvent&&window.MSPointerEvent,$t=!!(window.PointerEvent||At),ie="ontouchstart"in window||!!window.TouchEvent,Qe=!window.L_NO_TOUCH&&(ie||$t),Te=D&&Ft,Dt=D&&be,ye=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Yt=function(){var t=!1;try{var o=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",p,o),window.removeEventListener("testPassiveEventSupport",p,o)}catch{}return t}(),Rt=function(){return!!document.createElement("canvas").getContext}(),Ge=!!(document.createElementNS&&ce("svg").createSVGRect),Ve=!!Ge&&function(){var t=document.createElement("div");return t.innerHTML="<svg/>",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),fn=!Ge&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var o=t.firstChild;return o.style.behavior="url(#default#VML)",o&&typeof o.adj=="object"}catch{return!1}}(),cn=navigator.platform.indexOf("Mac")===0,Ke=navigator.platform.indexOf("Linux")===0;function oe(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var _t={ie:he,ielt9:Zt,edge:Tt,webkit:Ut,android:we,android23:Ne,androidStock:Me,opera:Ft,chrome:Ce,gecko:be,safari:qe,phantom:ve,opera12:fe,win:ze,ie3d:He,webkit3d:Xe,gecko3d:xe,any3d:Ie,mobile:D,mobileWebkit:it,mobileWebkit3d:Et,msPointer:At,pointer:$t,touch:Qe,touchNative:ie,mobileOpera:Te,mobileGecko:Dt,retina:ye,passiveEvents:Yt,canvas:Rt,svg:Ge,vml:fn,inlineSvg:Ve,mac:cn,linux:Ke},an=_t.msPointer?"MSPointerDown":"pointerdown",hn=_t.msPointer?"MSPointerMove":"pointermove",Be=_t.msPointer?"MSPointerUp":"pointerup",Bt=_t.msPointer?"MSPointerCancel":"pointercancel",y={touchstart:an,touchmove:hn,touchend:Be,touchcancel:Bt},ut={touchstart:on,touchmove:ln,touchend:ln,touchcancel:ln},bt={},wt=!1;function zt(t,o,a){return o==="touchstart"&&Fe(),ut[o]?(a=ut[o].bind(this,a),t.addEventListener(y[o],a,!1),a):(console.warn("wrong event specified:",o),p)}function O(t,o,a){if(!y[o]){console.warn("wrong event specified:",o);return}t.removeEventListener(y[o],a,!1)}function qt(t){bt[t.pointerId]=t}function ke(t){bt[t.pointerId]&&(bt[t.pointerId]=t)}function se(t){delete bt[t.pointerId]}function Fe(){wt||(document.addEventListener(an,qt,!0),document.addEventListener(hn,ke,!0),document.addEventListener(Be,se,!0),document.addEventListener(Bt,se,!0),wt=!0)}function ln(t,o){if(o.pointerType!==(o.MSPOINTER_TYPE_MOUSE||"mouse")){o.touches=[];for(var a in bt)o.touches.push(bt[a]);o.changedTouches=[o],t(o)}}function on(t,o){o.MSPOINTER_TYPE_TOUCH&&o.pointerType===o.MSPOINTER_TYPE_TOUCH&&un(o),ln(t,o)}function yn(t){var o={},a,c;for(c in t)a=t[c],o[c]=a&&a.bind?a.bind(t):a;return t=o,o.type="dblclick",o.detail=2,o.isTrusted=!1,o._simulated=!0,o}var Dn=200;function ai(t,o){t.addEventListener("dblclick",o);var a=0,c;function d(g){if(g.detail!==1){c=g.detail;return}if(!(g.pointerType==="mouse"||g.sourceCapabilities&&!g.sourceCapabilities.firesTouchEvents)){var P=os(g);if(!(P.some(function(x){return x instanceof HTMLLabelElement&&x.attributes.for})&&!P.some(function(x){return x instanceof HTMLInputElement||x instanceof HTMLSelectElement}))){var z=Date.now();z-a<=Dn?(c++,c===2&&o(yn(g))):c=1,a=z}}}return t.addEventListener("click",d),{dblclick:o,simDblclick:d}}function bi(t,o){t.removeEventListener("dblclick",o.dblclick),t.removeEventListener("click",o.simDblclick)}var An=Qn(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Sn=Qn(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Kn=Sn==="webkitTransition"||Sn==="OTransition"?Sn+"End":"transitionend";function ki(t){return typeof t=="string"?document.getElementById(t):t}function mt(t,o){var a=t.style[o]||t.currentStyle&&t.currentStyle[o];if((!a||a==="auto")&&document.defaultView){var c=document.defaultView.getComputedStyle(t,null);a=c?c[o]:null}return a==="auto"?null:a}function Wt(t,o,a){var c=document.createElement(t);return c.className=o||"",a&&a.appendChild(c),c}function Pe(t){var o=t.parentNode;o&&o.removeChild(t)}function gn(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function kn(t){var o=t.parentNode;o&&o.lastChild!==t&&o.appendChild(t)}function sn(t){var o=t.parentNode;o&&o.firstChild!==t&&o.insertBefore(t,o.firstChild)}function Ae(t,o){if(t.classList!==void 0)return t.classList.contains(o);var a=Jn(t);return a.length>0&&new RegExp("(^|\\s)"+o+"(\\s|$)").test(a)}function Ht(t,o){if(t.classList!==void 0)for(var a=k(o),c=0,d=a.length;c<d;c++)t.classList.add(a[c]);else if(!Ae(t,o)){var g=Jn(t);Pi(t,(g?g+" ":"")+o)}}function Ze(t,o){t.classList!==void 0?t.classList.remove(o):Pi(t,b((" "+Jn(t)+" ").replace(" "+o+" "," ")))}function Pi(t,o){t.className.baseVal===void 0?t.className=o:t.className.baseVal=o}function Jn(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal}function dn(t,o){"opacity"in t.style?t.style.opacity=o:"filter"in t.style&&Fi(t,o)}function Fi(t,o){var a=!1,c="DXImageTransform.Microsoft.Alpha";try{a=t.filters.item(c)}catch{if(o===1)return}o=Math.round(o*100),a?(a.Enabled=o!==100,a.Opacity=o):t.style.filter+=" progid:"+c+"(opacity="+o+")"}function Qn(t){for(var o=document.documentElement.style,a=0;a<t.length;a++)if(t[a]in o)return t[a];return!1}function Nn(t,o,a){var c=o||new A(0,0);t.style[An]=(_t.ie3d?"translate("+c.x+"px,"+c.y+"px)":"translate3d("+c.x+"px,"+c.y+"px,0)")+(a?" scale("+a+")":"")}function Ue(t,o){t._leaflet_pos=o,_t.any3d?Nn(t,o):(t.style.left=o.x+"px",t.style.top=o.y+"px")}function Rn(t){return t._leaflet_pos||new A(0,0)}var $n,ti,li;if("onselectstart"in document)$n=function(){jt(window,"selectstart",un)},ti=function(){Oe(window,"selectstart",un)};else{var Wn=Qn(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);$n=function(){if(Wn){var t=document.documentElement.style;li=t[Wn],t[Wn]="none"}},ti=function(){Wn&&(document.documentElement.style[Wn]=li,li=void 0)}}function go(){jt(window,"dragstart",un)}function po(){Oe(window,"dragstart",un)}var Gi,vo;function yo(t){for(;t.tabIndex===-1;)t=t.parentNode;t.style&&(ji(),Gi=t,vo=t.style.outlineStyle,t.style.outlineStyle="none",jt(window,"keydown",ji))}function ji(){Gi&&(Gi.style.outlineStyle=vo,Gi=void 0,vo=void 0,Oe(window,"keydown",ji))}function ns(t){do t=t.parentNode;while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function wo(t){var o=t.getBoundingClientRect();return{x:o.width/t.offsetWidth||1,y:o.height/t.offsetHeight||1,boundingClientRect:o}}var Qa={__proto__:null,TRANSFORM:An,TRANSITION:Sn,TRANSITION_END:Kn,get:ki,getStyle:mt,create:Wt,remove:Pe,empty:gn,toFront:kn,toBack:sn,hasClass:Ae,addClass:Ht,removeClass:Ze,setClass:Pi,getClass:Jn,setOpacity:dn,testProp:Qn,setTransform:Nn,setPosition:Ue,getPosition:Rn,get disableTextSelection(){return $n},get enableTextSelection(){return ti},disableImageDrag:go,enableImageDrag:po,preventOutline:yo,restoreOutline:ji,getSizedParentNode:ns,getScale:wo};function jt(t,o,a,c){if(o&&typeof o=="object")for(var d in o)ko(t,d,o[d],a);else{o=k(o);for(var g=0,P=o.length;g<P;g++)ko(t,o[g],a,c)}return this}var In="_leaflet_events";function Oe(t,o,a,c){if(arguments.length===1)is(t),delete t[In];else if(o&&typeof o=="object")for(var d in o)Po(t,d,o[d],a);else if(o=k(o),arguments.length===2)is(t,function(z){return q(o,z)!==-1});else for(var g=0,P=o.length;g<P;g++)Po(t,o[g],a,c);return this}function is(t,o){for(var a in t[In]){var c=a.split(/\d/)[0];(!o||o(c))&&Po(t,c,null,null,a)}}var bo={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function ko(t,o,a,c){var d=o+h(a)+(c?"_"+h(c):"");if(t[In]&&t[In][d])return this;var g=function(z){return a.call(c||t,z||window.event)},P=g;!_t.touchNative&&_t.pointer&&o.indexOf("touch")===0?g=zt(t,o,g):_t.touch&&o==="dblclick"?g=ai(t,g):"addEventListener"in t?o==="touchstart"||o==="touchmove"||o==="wheel"||o==="mousewheel"?t.addEventListener(bo[o]||o,g,_t.passiveEvents?{passive:!1}:!1):o==="mouseenter"||o==="mouseleave"?(g=function(z){z=z||window.event,Co(t,z)&&P(z)},t.addEventListener(bo[o],g,!1)):t.addEventListener(o,P,!1):t.attachEvent("on"+o,g),t[In]=t[In]||{},t[In][d]=g}function Po(t,o,a,c,d){d=d||o+h(a)+(c?"_"+h(c):"");var g=t[In]&&t[In][d];if(!g)return this;!_t.touchNative&&_t.pointer&&o.indexOf("touch")===0?O(t,o,g):_t.touch&&o==="dblclick"?bi(t,g):"removeEventListener"in t?t.removeEventListener(bo[o]||o,g,!1):t.detachEvent("on"+o,g),t[In][d]=null}function ei(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function Lo(t){return ko(t,"wheel",ei),this}function Li(t){return jt(t,"mousedown touchstart dblclick contextmenu",ei),t._leaflet_disable_click=!0,this}function un(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function ni(t){return un(t),ei(t),this}function os(t){if(t.composedPath)return t.composedPath();for(var o=[],a=t.target;a;)o.push(a),a=a.parentNode;return o}function ss(t,o){if(!o)return new A(t.clientX,t.clientY);var a=wo(o),c=a.boundingClientRect;return new A((t.clientX-c.left)/a.x-o.clientLeft,(t.clientY-c.top)/a.y-o.clientTop)}var $a=_t.linux&&_t.chrome?window.devicePixelRatio:_t.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function rs(t){return _t.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/$a:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function Co(t,o){var a=o.relatedTarget;if(!a)return!0;try{for(;a&&a!==t;)a=a.parentNode}catch{return!1}return a!==t}var tl={__proto__:null,on:jt,off:Oe,stopPropagation:ei,disableScrollPropagation:Lo,disableClickPropagation:Li,preventDefault:un,stop:ni,getPropagationPath:os,getMousePosition:ss,getWheelDelta:rs,isExternalTarget:Co,addListener:jt,removeListener:Oe},as=B.extend({run:function(t,o,a,c){this.stop(),this._el=t,this._inProgress=!0,this._duration=a||.25,this._easeOutPower=1/Math.max(c||.5,.2),this._startPos=Rn(t),this._offset=o.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=Q(this._animate,this),this._step()},_step:function(t){var o=+new Date-this._startTime,a=this._duration*1e3;o<a?this._runFrame(this._easeOut(o/a),t):(this._runFrame(1),this._complete())},_runFrame:function(t,o){var a=this._startPos.add(this._offset.multiplyBy(t));o&&a._round(),Ue(this._el,a),this.fire("step")},_complete:function(){G(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),ae=B.extend({options:{crs:xt,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,o){o=C(this,o),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=u(this._onResize,this),this._initEvents(),o.maxBounds&&this.setMaxBounds(o.maxBounds),o.zoom!==void 0&&(this._zoom=this._limitZoom(o.zoom)),o.center&&o.zoom!==void 0&&this.setView(H(o.center),o.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=Sn&&_t.any3d&&!_t.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),jt(this._proxy,Kn,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,o,a){if(o=o===void 0?this._zoom:this._limitZoom(o),t=this._limitCenter(H(t),o,this.options.maxBounds),a=a||{},this._stop(),this._loaded&&!a.reset&&a!==!0){a.animate!==void 0&&(a.zoom=r({animate:a.animate},a.zoom),a.pan=r({animate:a.animate,duration:a.duration},a.pan));var c=this._zoom!==o?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,o,a.zoom):this._tryAnimatedPan(t,a.pan);if(c)return clearTimeout(this._sizeTimer),this}return this._resetView(t,o,a.pan&&a.pan.noMoveStart),this},setZoom:function(t,o){return this._loaded?this.setView(this.getCenter(),t,{zoom:o}):(this._zoom=t,this)},zoomIn:function(t,o){return t=t||(_t.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,o)},zoomOut:function(t,o){return t=t||(_t.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,o)},setZoomAround:function(t,o,a){var c=this.getZoomScale(o),d=this.getSize().divideBy(2),g=t instanceof A?t:this.latLngToContainerPoint(t),P=g.subtract(d).multiplyBy(1-1/c),z=this.containerPointToLatLng(d.add(P));return this.setView(z,o,{zoom:a})},_getBoundsCenterZoom:function(t,o){o=o||{},t=t.getBounds?t.getBounds():Z(t);var a=V(o.paddingTopLeft||o.padding||[0,0]),c=V(o.paddingBottomRight||o.padding||[0,0]),d=this.getBoundsZoom(t,!1,a.add(c));if(d=typeof o.maxZoom=="number"?Math.min(o.maxZoom,d):d,d===1/0)return{center:t.getCenter(),zoom:d};var g=c.subtract(a).divideBy(2),P=this.project(t.getSouthWest(),d),z=this.project(t.getNorthEast(),d),x=this.unproject(P.add(z).divideBy(2).add(g),d);return{center:x,zoom:d}},fitBounds:function(t,o){if(t=Z(t),!t.isValid())throw new Error("Bounds are not valid.");var a=this._getBoundsCenterZoom(t,o);return this.setView(a.center,a.zoom,o)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,o){return this.setView(t,this._zoom,{pan:o})},panBy:function(t,o){if(t=V(t).round(),o=o||{},!t.x&&!t.y)return this.fire("moveend");if(o.animate!==!0&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new as,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),o.noMoveStart||this.fire("movestart"),o.animate!==!1){Ht(this._mapPane,"leaflet-pan-anim");var a=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,a,o.duration||.25,o.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,o,a){if(a=a||{},a.animate===!1||!_t.any3d)return this.setView(t,o,a);this._stop();var c=this.project(this.getCenter()),d=this.project(t),g=this.getSize(),P=this._zoom;t=H(t),o=o===void 0?P:o;var z=Math.max(g.x,g.y),x=z*this.getZoomScale(P,o),tt=d.distanceTo(c)||1,kt=1.42,It=kt*kt;function Jt($e){var no=$e?-1:1,Fl=$e?x:z,Gl=x*x-z*z+no*It*It*tt*tt,jl=2*Fl*It*tt,Bo=Gl/jl,Hs=Math.sqrt(Bo*Bo+1)-Bo,Xl=Hs<1e-9?-18:Math.log(Hs);return Xl}function _n($e){return(Math.exp($e)-Math.exp(-$e))/2}function rn($e){return(Math.exp($e)+Math.exp(-$e))/2}function Ln($e){return _n($e)/rn($e)}var pn=Jt(0);function _i($e){return z*(rn(pn)/rn(pn+kt*$e))}function Dl($e){return z*(rn(pn)*Ln(pn+kt*$e)-_n(pn))/It}function Rl($e){return 1-Math.pow(1-$e,1.5)}var Wl=Date.now(),Rs=(Jt(1)-pn)/kt,Hl=a.duration?1e3*a.duration:1e3*Rs*.8;function Ws(){var $e=(Date.now()-Wl)/Hl,no=Rl($e)*Rs;$e<=1?(this._flyToFrame=Q(Ws,this),this._move(this.unproject(c.add(d.subtract(c).multiplyBy(Dl(no)/tt)),P),this.getScaleZoom(z/_i(no),P),{flyTo:!0})):this._move(t,o)._moveEnd(!0)}return this._moveStart(!0,a.noMoveStart),Ws.call(this),this},flyToBounds:function(t,o){var a=this._getBoundsCenterZoom(t,o);return this.flyTo(a.center,a.zoom,o)},setMaxBounds:function(t){return t=Z(t),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),t.isValid()?(this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(t){var o=this.options.minZoom;return this.options.minZoom=t,this._loaded&&o!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var o=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&o!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,o){this._enforcingBounds=!0;var a=this.getCenter(),c=this._limitCenter(a,this._zoom,Z(t));return a.equals(c)||this.panTo(c,o),this._enforcingBounds=!1,this},panInside:function(t,o){o=o||{};var a=V(o.paddingTopLeft||o.padding||[0,0]),c=V(o.paddingBottomRight||o.padding||[0,0]),d=this.project(this.getCenter()),g=this.project(t),P=this.getPixelBounds(),z=Pt([P.min.add(a),P.max.subtract(c)]),x=z.getSize();if(!z.contains(g)){this._enforcingBounds=!0;var tt=g.subtract(z.getCenter()),kt=z.extend(g).getSize().subtract(x);d.x+=tt.x<0?-kt.x:kt.x,d.y+=tt.y<0?-kt.y:kt.y,this.panTo(this.unproject(d),o),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=r({animate:!1,pan:!0},t===!0?{animate:!0}:t);var o=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var a=this.getSize(),c=o.divideBy(2).round(),d=a.divideBy(2).round(),g=c.subtract(d);return!g.x&&!g.y?this:(t.animate&&t.pan?this.panBy(g):(t.pan&&this._rawPanBy(g),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(u(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:o,newSize:a}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=r({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var o=u(this._handleGeolocationResponse,this),a=u(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(o,a,t):navigator.geolocation.getCurrentPosition(o,a,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){if(this._container._leaflet_id){var o=t.code,a=t.message||(o===1?"permission denied":o===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:o,message:"Geolocation error: "+a+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var o=t.coords.latitude,a=t.coords.longitude,c=new W(o,a),d=c.toBounds(t.coords.accuracy*2),g=this._locateOptions;if(g.setView){var P=this.getBoundsZoom(d);this.setView(c,g.maxZoom?Math.min(P,g.maxZoom):P)}var z={latlng:c,bounds:d,timestamp:t.timestamp};for(var x in t.coords)typeof t.coords[x]=="number"&&(z[x]=t.coords[x]);this.fire("locationfound",z)}},addHandler:function(t,o){if(!o)return this;var a=this[t]=new o(this);return this._handlers.push(a),this.options[t]&&a.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Pe(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(G(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)Pe(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,o){var a="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),c=Wt("div",a,o||this._mapPane);return t&&(this._panes[t]=c),c},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),o=this.unproject(t.getBottomLeft()),a=this.unproject(t.getTopRight());return new dt(o,a)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,o,a){t=Z(t),a=V(a||[0,0]);var c=this.getZoom()||0,d=this.getMinZoom(),g=this.getMaxZoom(),P=t.getNorthWest(),z=t.getSouthEast(),x=this.getSize().subtract(a),tt=Pt(this.project(z,c),this.project(P,c)).getSize(),kt=_t.any3d?this.options.zoomSnap:1,It=x.x/tt.x,Jt=x.y/tt.y,_n=o?Math.max(It,Jt):Math.min(It,Jt);return c=this.getScaleZoom(_n,c),kt&&(c=Math.round(c/(kt/100))*(kt/100),c=o?Math.ceil(c/kt)*kt:Math.floor(c/kt)*kt),Math.max(d,Math.min(g,c))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new A(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,o){var a=this._getTopLeftPoint(t,o);return new yt(a,a.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,o){var a=this.options.crs;return o=o===void 0?this._zoom:o,a.scale(t)/a.scale(o)},getScaleZoom:function(t,o){var a=this.options.crs;o=o===void 0?this._zoom:o;var c=a.zoom(t*a.scale(o));return isNaN(c)?1/0:c},project:function(t,o){return o=o===void 0?this._zoom:o,this.options.crs.latLngToPoint(H(t),o)},unproject:function(t,o){return o=o===void 0?this._zoom:o,this.options.crs.pointToLatLng(V(t),o)},layerPointToLatLng:function(t){var o=V(t).add(this.getPixelOrigin());return this.unproject(o)},latLngToLayerPoint:function(t){var o=this.project(H(t))._round();return o._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(H(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(Z(t))},distance:function(t,o){return this.options.crs.distance(H(t),H(o))},containerPointToLayerPoint:function(t){return V(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return V(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var o=this.containerPointToLayerPoint(V(t));return this.layerPointToLatLng(o)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(H(t)))},mouseEventToContainerPoint:function(t){return ss(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var o=this._container=ki(t);if(o){if(o._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");jt(o,"scroll",this._onScroll,this),this._containerId=h(o)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&_t.any3d,Ht(t,"leaflet-container"+(_t.touch?" leaflet-touch":"")+(_t.retina?" leaflet-retina":"")+(_t.ielt9?" leaflet-oldie":"")+(_t.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var o=mt(t,"position");o!=="absolute"&&o!=="relative"&&o!=="fixed"&&o!=="sticky"&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Ue(this._mapPane,new A(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Ht(t.markerPane,"leaflet-zoom-hide"),Ht(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,o,a){Ue(this._mapPane,new A(0,0));var c=!this._loaded;this._loaded=!0,o=this._limitZoom(o),this.fire("viewprereset");var d=this._zoom!==o;this._moveStart(d,a)._move(t,o)._moveEnd(d),this.fire("viewreset"),c&&this.fire("load")},_moveStart:function(t,o){return t&&this.fire("zoomstart"),o||this.fire("movestart"),this},_move:function(t,o,a,c){o===void 0&&(o=this._zoom);var d=this._zoom!==o;return this._zoom=o,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),c?a&&a.pinch&&this.fire("zoom",a):((d||a&&a.pinch)&&this.fire("zoom",a),this.fire("move",a)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return G(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Ue(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[h(this._container)]=this;var o=t?Oe:jt;o(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&o(window,"resize",this._onResize,this),_t.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){G(this._resizeRequest),this._resizeRequest=Q(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,o){for(var a=[],c,d=o==="mouseout"||o==="mouseover",g=t.target||t.srcElement,P=!1;g;){if(c=this._targets[h(g)],c&&(o==="click"||o==="preclick")&&this._draggableMoved(c)){P=!0;break}if(c&&c.listens(o,!0)&&(d&&!Co(g,t)||(a.push(c),d))||g===this._container)break;g=g.parentNode}return!a.length&&!P&&!d&&this.listens(o,!0)&&(a=[this]),a},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var o=t.target||t.srcElement;if(!(!this._loaded||o._leaflet_disable_events||t.type==="click"&&this._isClickDisabled(o))){var a=t.type;a==="mousedown"&&yo(o),this._fireDOMEvent(t,a)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,o,a){if(t.type==="click"){var c=r({},t);c.type="preclick",this._fireDOMEvent(c,c.type,a)}var d=this._findEventTargets(t,o);if(a){for(var g=[],P=0;P<a.length;P++)a[P].listens(o,!0)&&g.push(a[P]);d=g.concat(d)}if(d.length){o==="contextmenu"&&un(t);var z=d[0],x={originalEvent:t};if(t.type!=="keypress"&&t.type!=="keydown"&&t.type!=="keyup"){var tt=z.getLatLng&&(!z._radius||z._radius<=10);x.containerPoint=tt?this.latLngToContainerPoint(z.getLatLng()):this.mouseEventToContainerPoint(t),x.layerPoint=this.containerPointToLayerPoint(x.containerPoint),x.latlng=tt?z.getLatLng():this.layerPointToLatLng(x.layerPoint)}for(P=0;P<d.length;P++)if(d[P].fire(o,x,!0),x.originalEvent._stopped||d[P].options.bubblingMouseEvents===!1&&q(this._mouseEvents,o)!==-1)return}},_draggableMoved:function(t){return t=t.dragging&&t.dragging.enabled()?t:this,t.dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,o=this._handlers.length;t<o;t++)this._handlers[t].disable()},whenReady:function(t,o){return this._loaded?t.call(o||this,{target:this}):this.on("load",t,o),this},_getMapPanePos:function(){return Rn(this._mapPane)||new A(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,o){var a=t&&o!==void 0?this._getNewPixelOrigin(t,o):this.getPixelOrigin();return a.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,o){var a=this.getSize()._divideBy(2);return this.project(t,o)._subtract(a)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,o,a){var c=this._getNewPixelOrigin(a,o);return this.project(t,o)._subtract(c)},_latLngBoundsToNewLayerBounds:function(t,o,a){var c=this._getNewPixelOrigin(a,o);return Pt([this.project(t.getSouthWest(),o)._subtract(c),this.project(t.getNorthWest(),o)._subtract(c),this.project(t.getSouthEast(),o)._subtract(c),this.project(t.getNorthEast(),o)._subtract(c)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,o,a){if(!a)return t;var c=this.project(t,o),d=this.getSize().divideBy(2),g=new yt(c.subtract(d),c.add(d)),P=this._getBoundsOffset(g,a,o);return Math.abs(P.x)<=1&&Math.abs(P.y)<=1?t:this.unproject(c.add(P),o)},_limitOffset:function(t,o){if(!o)return t;var a=this.getPixelBounds(),c=new yt(a.min.add(t),a.max.add(t));return t.add(this._getBoundsOffset(c,o))},_getBoundsOffset:function(t,o,a){var c=Pt(this.project(o.getNorthEast(),a),this.project(o.getSouthWest(),a)),d=c.min.subtract(t.min),g=c.max.subtract(t.max),P=this._rebound(d.x,-g.x),z=this._rebound(d.y,-g.y);return new A(P,z)},_rebound:function(t,o){return t+o>0?Math.round(t-o)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(o))},_limitZoom:function(t){var o=this.getMinZoom(),a=this.getMaxZoom(),c=_t.any3d?this.options.zoomSnap:1;return c&&(t=Math.round(t/c)*c),Math.max(o,Math.min(a,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Ze(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,o){var a=this._getCenterOffset(t)._trunc();return(o&&o.animate)!==!0&&!this.getSize().contains(a)?!1:(this.panBy(a,o),!0)},_createAnimProxy:function(){var t=this._proxy=Wt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(o){var a=An,c=this._proxy.style[a];Nn(this._proxy,this.project(o.center,o.zoom),this.getZoomScale(o.zoom,1)),c===this._proxy.style[a]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Pe(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),o=this.getZoom();Nn(this._proxy,this.project(t,o),this.getZoomScale(o,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,o,a){if(this._animatingZoom)return!0;if(a=a||{},!this._zoomAnimated||a.animate===!1||this._nothingToAnimate()||Math.abs(o-this._zoom)>this.options.zoomAnimationThreshold)return!1;var c=this.getZoomScale(o),d=this._getCenterOffset(t)._divideBy(1-1/c);return a.animate!==!0&&!this.getSize().contains(d)?!1:(Q(function(){this._moveStart(!0,a.noMoveStart||!1)._animateZoom(t,o,!0)},this),!0)},_animateZoom:function(t,o,a,c){this._mapPane&&(a&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=o,Ht(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:o,noUpdate:c}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(u(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Ze(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function el(t,o){return new ae(t,o)}var Mn=X.extend({options:{position:"topright"},initialize:function(t){C(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var o=this._map;return o&&o.removeControl(this),this.options.position=t,o&&o.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var o=this._container=this.onAdd(t),a=this.getPosition(),c=t._controlCorners[a];return Ht(o,"leaflet-control"),a.indexOf("bottom")!==-1?c.insertBefore(o,c.firstChild):c.appendChild(o),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Pe(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),Ci=function(t){return new Mn(t)};ae.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},o="leaflet-",a=this._controlContainer=Wt("div",o+"control-container",this._container);function c(d,g){var P=o+d+" "+o+g;t[d+g]=Wt("div",P,a)}c("top","left"),c("top","right"),c("bottom","left"),c("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)Pe(this._controlCorners[t]);Pe(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ls=Mn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,o,a,c){return a<c?-1:c<a?1:0}},initialize:function(t,o,a){C(this,a),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var c in t)this._addLayer(t[c],c);for(c in o)this._addLayer(o[c],c,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var o=0;o<this._layers.length;o++)this._layers[o].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return Mn.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,o){return this._addLayer(t,o),this._map?this._update():this},addOverlay:function(t,o){return this._addLayer(t,o,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var o=this._getLayer(h(t));return o&&this._layers.splice(this._layers.indexOf(o),1),this._map?this._update():this},expand:function(){Ht(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(Ht(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):Ze(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Ze(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",o=this._container=Wt("div",t),a=this.options.collapsed;o.setAttribute("aria-haspopup",!0),Li(o),Lo(o);var c=this._section=Wt("section",t+"-list");a&&(this._map.on("click",this.collapse,this),jt(o,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var d=this._layersLink=Wt("a",t+"-toggle",o);d.href="#",d.title="Layers",d.setAttribute("role","button"),jt(d,{keydown:function(g){g.keyCode===13&&this._expandSafely()},click:function(g){un(g),this._expandSafely()}},this),a||this.expand(),this._baseLayersList=Wt("div",t+"-base",c),this._separator=Wt("div",t+"-separator",c),this._overlaysList=Wt("div",t+"-overlays",c),o.appendChild(c)},_getLayer:function(t){for(var o=0;o<this._layers.length;o++)if(this._layers[o]&&h(this._layers[o].layer)===t)return this._layers[o]},_addLayer:function(t,o,a){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:o,overlay:a}),this.options.sortLayers&&this._layers.sort(u(function(c,d){return this.options.sortFunction(c.layer,d.layer,c.name,d.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;gn(this._baseLayersList),gn(this._overlaysList),this._layerControlInputs=[];var t,o,a,c,d=0;for(a=0;a<this._layers.length;a++)c=this._layers[a],this._addItem(c),o=o||c.overlay,t=t||!c.overlay,d+=c.overlay?0:1;return this.options.hideSingleBase&&(t=t&&d>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=o&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var o=this._getLayer(h(t.target)),a=o.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;a&&this._map.fire(a,o)},_createRadioElement:function(t,o){var a='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(o?' checked="checked"':"")+"/>",c=document.createElement("div");return c.innerHTML=a,c.firstChild},_addItem:function(t){var o=document.createElement("label"),a=this._map.hasLayer(t.layer),c;t.overlay?(c=document.createElement("input"),c.type="checkbox",c.className="leaflet-control-layers-selector",c.defaultChecked=a):c=this._createRadioElement("leaflet-base-layers_"+h(this),a),this._layerControlInputs.push(c),c.layerId=h(t.layer),jt(c,"click",this._onInputClick,this);var d=document.createElement("span");d.innerHTML=" "+t.name;var g=document.createElement("span");o.appendChild(g),g.appendChild(c),g.appendChild(d);var P=t.overlay?this._overlaysList:this._baseLayersList;return P.appendChild(o),this._checkDisabledLayers(),o},_onInputClick:function(){if(!this._preventClick){var t=this._layerControlInputs,o,a,c=[],d=[];this._handlingClick=!0;for(var g=t.length-1;g>=0;g--)o=t[g],a=this._getLayer(o.layerId).layer,o.checked?c.push(a):o.checked||d.push(a);for(g=0;g<d.length;g++)this._map.hasLayer(d[g])&&this._map.removeLayer(d[g]);for(g=0;g<c.length;g++)this._map.hasLayer(c[g])||this._map.addLayer(c[g]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t=this._layerControlInputs,o,a,c=this._map.getZoom(),d=t.length-1;d>=0;d--)o=t[d],a=this._getLayer(o.layerId).layer,o.disabled=a.options.minZoom!==void 0&&c<a.options.minZoom||a.options.maxZoom!==void 0&&c>a.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,jt(t,"click",un),this.expand();var o=this;setTimeout(function(){Oe(t,"click",un),o._preventClick=!1})}}),nl=function(t,o,a){return new ls(t,o,a)},So=Mn.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var o="leaflet-control-zoom",a=Wt("div",o+" leaflet-bar"),c=this.options;return this._zoomInButton=this._createButton(c.zoomInText,c.zoomInTitle,o+"-in",a,this._zoomIn),this._zoomOutButton=this._createButton(c.zoomOutText,c.zoomOutTitle,o+"-out",a,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),a},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,o,a,c,d){var g=Wt("a",a,c);return g.innerHTML=t,g.href="#",g.title=o,g.setAttribute("role","button"),g.setAttribute("aria-label",o),Li(g),jt(g,"click",ni),jt(g,"click",d,this),jt(g,"click",this._refocusOnMap,this),g},_updateDisabled:function(){var t=this._map,o="leaflet-disabled";Ze(this._zoomInButton,o),Ze(this._zoomOutButton,o),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(Ht(this._zoomOutButton,o),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(Ht(this._zoomInButton,o),this._zoomInButton.setAttribute("aria-disabled","true"))}});ae.mergeOptions({zoomControl:!0}),ae.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new So,this.addControl(this.zoomControl))});var il=function(t){return new So(t)},us=Mn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var o="leaflet-control-scale",a=Wt("div",o),c=this.options;return this._addScales(c,o+"-line",a),t.on(c.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),a},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,o,a){t.metric&&(this._mScale=Wt("div",o,a)),t.imperial&&(this._iScale=Wt("div",o,a))},_update:function(){var t=this._map,o=t.getSize().y/2,a=t.distance(t.containerPointToLatLng([0,o]),t.containerPointToLatLng([this.options.maxWidth,o]));this._updateScales(a)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var o=this._getRoundNum(t),a=o<1e3?o+" m":o/1e3+" km";this._updateScale(this._mScale,a,o/t)},_updateImperial:function(t){var o=t*3.2808399,a,c,d;o>5280?(a=o/5280,c=this._getRoundNum(a),this._updateScale(this._iScale,c+" mi",c/a)):(d=this._getRoundNum(o),this._updateScale(this._iScale,d+" ft",d/o))},_updateScale:function(t,o,a){t.style.width=Math.round(this.options.maxWidth*a)+"px",t.innerHTML=o},_getRoundNum:function(t){var o=Math.pow(10,(Math.floor(t)+"").length-1),a=t/o;return a=a>=10?10:a>=5?5:a>=3?3:a>=2?2:1,o*a}}),ol=function(t){return new us(t)},sl='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',Mo=Mn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(_t.inlineSvg?sl+" ":"")+"Leaflet</a>"},initialize:function(t){C(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=Wt("div","leaflet-control-attribution"),Li(this._container);for(var o in t._layers)t._layers[o].getAttribution&&this.addAttribution(t._layers[o].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var o in this._attributions)this._attributions[o]&&t.push(o);var a=[];this.options.prefix&&a.push(this.options.prefix),t.length&&a.push(t.join(", ")),this._container.innerHTML=a.join(' <span aria-hidden="true">|</span> ')}}});ae.mergeOptions({attributionControl:!0}),ae.addInitHook(function(){this.options.attributionControl&&new Mo().addTo(this)});var rl=function(t){return new Mo(t)};Mn.Layers=ls,Mn.Zoom=So,Mn.Scale=us,Mn.Attribution=Mo,Ci.layers=nl,Ci.zoom=il,Ci.scale=ol,Ci.attribution=rl;var On=X.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});On.addTo=function(t,o){return t.addHandler(o,this),this};var al={Events:J},cs=_t.touch?"touchstart mousedown":"mousedown",Yn=B.extend({options:{clickTolerance:3},initialize:function(t,o,a,c){C(this,c),this._element=t,this._dragStartTarget=o||t,this._preventOutline=a},enable:function(){this._enabled||(jt(this._dragStartTarget,cs,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Yn._dragging===this&&this.finishDrag(!0),Oe(this._dragStartTarget,cs,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!Ae(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){Yn._dragging===this&&this.finishDrag();return}if(!(Yn._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(Yn._dragging=this,this._preventOutline&&yo(this._element),go(),$n(),!this._moving)){this.fire("down");var o=t.touches?t.touches[0]:t,a=ns(this._element);this._startPoint=new A(o.clientX,o.clientY),this._startPos=Rn(this._element),this._parentScale=wo(a);var c=t.type==="mousedown";jt(document,c?"mousemove":"touchmove",this._onMove,this),jt(document,c?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var o=t.touches&&t.touches.length===1?t.touches[0]:t,a=new A(o.clientX,o.clientY)._subtract(this._startPoint);!a.x&&!a.y||Math.abs(a.x)+Math.abs(a.y)<this.options.clickTolerance||(a.x/=this._parentScale.x,a.y/=this._parentScale.y,un(t),this._moved||(this.fire("dragstart"),this._moved=!0,Ht(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Ht(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(a),this._moving=!0,this._lastEvent=t,this._updatePosition())}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Ue(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){Ze(document.body,"leaflet-dragging"),this._lastTarget&&(Ze(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Oe(document,"mousemove touchmove",this._onMove,this),Oe(document,"mouseup touchend touchcancel",this._onUp,this),po(),ti();var o=this._moved&&this._moving;this._moving=!1,Yn._dragging=!1,o&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)})}});function hs(t,o,a){var c,d=[1,4,2,8],g,P,z,x,tt,kt,It,Jt;for(g=0,kt=t.length;g<kt;g++)t[g]._code=ii(t[g],o);for(z=0;z<4;z++){for(It=d[z],c=[],g=0,kt=t.length,P=kt-1;g<kt;P=g++)x=t[g],tt=t[P],x._code&It?tt._code&It||(Jt=Xi(tt,x,It,o,a),Jt._code=ii(Jt,o),c.push(Jt)):(tt._code&It&&(Jt=Xi(tt,x,It,o,a),Jt._code=ii(Jt,o),c.push(Jt)),c.push(x));t=c}return t}function fs(t,o){var a,c,d,g,P,z,x,tt,kt;if(!t||t.length===0)throw new Error("latlngs not passed");Pn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var It=H([0,0]),Jt=Z(t),_n=Jt.getNorthWest().distanceTo(Jt.getSouthWest())*Jt.getNorthEast().distanceTo(Jt.getNorthWest());_n<1700&&(It=To(t));var rn=t.length,Ln=[];for(a=0;a<rn;a++){var pn=H(t[a]);Ln.push(o.project(H([pn.lat-It.lat,pn.lng-It.lng])))}for(z=x=tt=0,a=0,c=rn-1;a<rn;c=a++)d=Ln[a],g=Ln[c],P=d.y*g.x-g.y*d.x,x+=(d.x+g.x)*P,tt+=(d.y+g.y)*P,z+=P*3;z===0?kt=Ln[0]:kt=[x/z,tt/z];var _i=o.unproject(V(kt));return H([_i.lat+It.lat,_i.lng+It.lng])}function To(t){for(var o=0,a=0,c=0,d=0;d<t.length;d++){var g=H(t[d]);o+=g.lat,a+=g.lng,c++}return H([o/c,a/c])}var ll={__proto__:null,clipPolygon:hs,polygonCenter:fs,centroid:To};function ds(t,o){if(!o||!t.length)return t.slice();var a=o*o;return t=hl(t,a),t=cl(t,a),t}function _s(t,o,a){return Math.sqrt(Si(t,o,a,!0))}function ul(t,o,a){return Si(t,o,a)}function cl(t,o){var a=t.length,c=typeof Uint8Array<"u"?Uint8Array:Array,d=new c(a);d[0]=d[a-1]=1,Eo(t,d,o,0,a-1);var g,P=[];for(g=0;g<a;g++)d[g]&&P.push(t[g]);return P}function Eo(t,o,a,c,d){var g=0,P,z,x;for(z=c+1;z<=d-1;z++)x=Si(t[z],t[c],t[d],!0),x>g&&(P=z,g=x);g>a&&(o[P]=1,Eo(t,o,a,c,P),Eo(t,o,a,P,d))}function hl(t,o){for(var a=[t[0]],c=1,d=0,g=t.length;c<g;c++)fl(t[c],t[d])>o&&(a.push(t[c]),d=c);return d<g-1&&a.push(t[g-1]),a}var ms;function gs(t,o,a,c,d){var g=c?ms:ii(t,a),P=ii(o,a),z,x,tt;for(ms=P;;){if(!(g|P))return[t,o];if(g&P)return!1;z=g||P,x=Xi(t,o,z,a,d),tt=ii(x,a),z===g?(t=x,g=tt):(o=x,P=tt)}}function Xi(t,o,a,c,d){var g=o.x-t.x,P=o.y-t.y,z=c.min,x=c.max,tt,kt;return a&8?(tt=t.x+g*(x.y-t.y)/P,kt=x.y):a&4?(tt=t.x+g*(z.y-t.y)/P,kt=z.y):a&2?(tt=x.x,kt=t.y+P*(x.x-t.x)/g):a&1&&(tt=z.x,kt=t.y+P*(z.x-t.x)/g),new A(tt,kt,d)}function ii(t,o){var a=0;return t.x<o.min.x?a|=1:t.x>o.max.x&&(a|=2),t.y<o.min.y?a|=4:t.y>o.max.y&&(a|=8),a}function fl(t,o){var a=o.x-t.x,c=o.y-t.y;return a*a+c*c}function Si(t,o,a,c){var d=o.x,g=o.y,P=a.x-d,z=a.y-g,x=P*P+z*z,tt;return x>0&&(tt=((t.x-d)*P+(t.y-g)*z)/x,tt>1?(d=a.x,g=a.y):tt>0&&(d+=P*tt,g+=z*tt)),P=t.x-d,z=t.y-g,c?P*P+z*z:new A(d,g)}function Pn(t){return!I(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function ps(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Pn(t)}function vs(t,o){var a,c,d,g,P,z,x,tt;if(!t||t.length===0)throw new Error("latlngs not passed");Pn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var kt=H([0,0]),It=Z(t),Jt=It.getNorthWest().distanceTo(It.getSouthWest())*It.getNorthEast().distanceTo(It.getNorthWest());Jt<1700&&(kt=To(t));var _n=t.length,rn=[];for(a=0;a<_n;a++){var Ln=H(t[a]);rn.push(o.project(H([Ln.lat-kt.lat,Ln.lng-kt.lng])))}for(a=0,c=0;a<_n-1;a++)c+=rn[a].distanceTo(rn[a+1])/2;if(c===0)tt=rn[0];else for(a=0,g=0;a<_n-1;a++)if(P=rn[a],z=rn[a+1],d=P.distanceTo(z),g+=d,g>c){x=(g-c)/d,tt=[z.x-x*(z.x-P.x),z.y-x*(z.y-P.y)];break}var pn=o.unproject(V(tt));return H([pn.lat+kt.lat,pn.lng+kt.lng])}var dl={__proto__:null,simplify:ds,pointToSegmentDistance:_s,closestPointOnSegment:ul,clipSegment:gs,_getEdgeIntersection:Xi,_getBitCode:ii,_sqClosestPointOnSegment:Si,isFlat:Pn,_flat:ps,polylineCenter:vs},zo={project:function(t){return new A(t.lng,t.lat)},unproject:function(t){return new W(t.y,t.x)},bounds:new yt([-180,-90],[180,90])},Ao={R:6378137,R_MINOR:6356752314245179e-9,bounds:new yt([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var o=Math.PI/180,a=this.R,c=t.lat*o,d=this.R_MINOR/a,g=Math.sqrt(1-d*d),P=g*Math.sin(c),z=Math.tan(Math.PI/4-c/2)/Math.pow((1-P)/(1+P),g/2);return c=-a*Math.log(Math.max(z,1e-10)),new A(t.lng*o*a,c)},unproject:function(t){for(var o=180/Math.PI,a=this.R,c=this.R_MINOR/a,d=Math.sqrt(1-c*c),g=Math.exp(-t.y/a),P=Math.PI/2-2*Math.atan(g),z=0,x=.1,tt;z<15&&Math.abs(x)>1e-7;z++)tt=d*Math.sin(P),tt=Math.pow((1-tt)/(1+tt),d/2),x=Math.PI/2-2*Math.atan(g*tt)-P,P+=x;return new W(P*o,t.x*o/a)}},_l={__proto__:null,LonLat:zo,Mercator:Ao,SphericalMercator:ht},ml=r({},Gt,{code:"EPSG:3395",projection:Ao,transformation:function(){var t=.5/(Math.PI*Ao.R);return St(t,.5,-t,.5)}()}),ys=r({},Gt,{code:"EPSG:4326",projection:zo,transformation:St(1/180,1,-1/180,.5)}),gl=r({},F,{projection:zo,transformation:St(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,o){var a=o.lng-t.lng,c=o.lat-t.lat;return Math.sqrt(a*a+c*c)},infinite:!0});F.Earth=Gt,F.EPSG3395=ml,F.EPSG3857=xt,F.EPSG900913=ne,F.EPSG4326=ys,F.Simple=gl;var Tn=B.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[h(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[h(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var o=t.target;if(o.hasLayer(this)){if(this._map=o,this._zoomAnimated=o._zoomAnimated,this.getEvents){var a=this.getEvents();o.on(a,this),this.once("remove",function(){o.off(a,this)},this)}this.onAdd(o),this.fire("add"),o.fire("layeradd",{layer:this})}}});ae.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var o=h(t);return this._layers[o]?this:(this._layers[o]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var o=h(t);return this._layers[o]?(this._loaded&&t.onRemove(this),delete this._layers[o],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return h(t)in this._layers},eachLayer:function(t,o){for(var a in this._layers)t.call(o,this._layers[a]);return this},_addLayers:function(t){t=t?I(t)?t:[t]:[];for(var o=0,a=t.length;o<a;o++)this.addLayer(t[o])},_addZoomLimit:function(t){(!isNaN(t.options.maxZoom)||!isNaN(t.options.minZoom))&&(this._zoomBoundLayers[h(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var o=h(t);this._zoomBoundLayers[o]&&(delete this._zoomBoundLayers[o],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,o=-1/0,a=this._getZoomSpan();for(var c in this._zoomBoundLayers){var d=this._zoomBoundLayers[c].options;t=d.minZoom===void 0?t:Math.min(t,d.minZoom),o=d.maxZoom===void 0?o:Math.max(o,d.maxZoom)}this._layersMaxZoom=o===-1/0?void 0:o,this._layersMinZoom=t===1/0?void 0:t,a!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var ui=Tn.extend({initialize:function(t,o){C(this,o),this._layers={};var a,c;if(t)for(a=0,c=t.length;a<c;a++)this.addLayer(t[a])},addLayer:function(t){var o=this.getLayerId(t);return this._layers[o]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var o=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[o]&&this._map.removeLayer(this._layers[o]),delete this._layers[o],this},hasLayer:function(t){var o=typeof t=="number"?t:this.getLayerId(t);return o in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var o=Array.prototype.slice.call(arguments,1),a,c;for(a in this._layers)c=this._layers[a],c[t]&&c[t].apply(c,o);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,o){for(var a in this._layers)t.call(o,this._layers[a]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return h(t)}}),pl=function(t,o){return new ui(t,o)},Hn=ui.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),ui.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),ui.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new dt;for(var o in this._layers){var a=this._layers[o];t.extend(a.getBounds?a.getBounds():a.getLatLng())}return t}}),vl=function(t,o){return new Hn(t,o)},ci=X.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){C(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,o){var a=this._getIconUrl(t);if(!a){if(t==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var c=this._createImg(a,o&&o.tagName==="IMG"?o:null);return this._setIconStyles(c,t),(this.options.crossOrigin||this.options.crossOrigin==="")&&(c.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),c},_setIconStyles:function(t,o){var a=this.options,c=a[o+"Size"];typeof c=="number"&&(c=[c,c]);var d=V(c),g=V(o==="shadow"&&a.shadowAnchor||a.iconAnchor||d&&d.divideBy(2,!0));t.className="leaflet-marker-"+o+" "+(a.className||""),g&&(t.style.marginLeft=-g.x+"px",t.style.marginTop=-g.y+"px"),d&&(t.style.width=d.x+"px",t.style.height=d.y+"px")},_createImg:function(t,o){return o=o||document.createElement("img"),o.src=t,o},_getIconUrl:function(t){return _t.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function yl(t){return new ci(t)}var Mi=ci.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return typeof Mi.imagePath!="string"&&(Mi.imagePath=this._detectIconPath()),(this.options.imagePath||Mi.imagePath)+ci.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var o=function(a,c,d){var g=c.exec(a);return g&&g[d]};return t=o(t,/^url\((['"])?(.+)\1\)$/,2),t&&o(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=Wt("div","leaflet-default-icon-path",document.body),o=mt(t,"background-image")||mt(t,"backgroundImage");if(document.body.removeChild(t),o=this._stripUrl(o),o)return o;var a=document.querySelector('link[href$="leaflet.css"]');return a?a.href.substring(0,a.href.length-11-1):""}}),ws=On.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new Yn(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Ht(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&Ze(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var o=this._marker,a=o._map,c=this._marker.options.autoPanSpeed,d=this._marker.options.autoPanPadding,g=Rn(o._icon),P=a.getPixelBounds(),z=a.getPixelOrigin(),x=Pt(P.min._subtract(z).add(d),P.max._subtract(z).subtract(d));if(!x.contains(g)){var tt=V((Math.max(x.max.x,g.x)-x.max.x)/(P.max.x-x.max.x)-(Math.min(x.min.x,g.x)-x.min.x)/(P.min.x-x.min.x),(Math.max(x.max.y,g.y)-x.max.y)/(P.max.y-x.max.y)-(Math.min(x.min.y,g.y)-x.min.y)/(P.min.y-x.min.y)).multiplyBy(c);a.panBy(tt,{animate:!1}),this._draggable._newPos._add(tt),this._draggable._startPos._add(tt),Ue(o._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=Q(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(G(this._panRequest),this._panRequest=Q(this._adjustPan.bind(this,t)))},_onDrag:function(t){var o=this._marker,a=o._shadow,c=Rn(o._icon),d=o._map.layerPointToLatLng(c);a&&Ue(a,c),o._latlng=d,t.latlng=d,t.oldLatLng=this._oldLatLng,o.fire("move",t).fire("drag",t)},_onDragEnd:function(t){G(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Ui=Tn.extend({options:{icon:new Mi,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,o){C(this,o),this._latlng=H(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var o=this._latlng;return this._latlng=H(t),this.update(),this.fire("move",{oldLatLng:o,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,o="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),a=t.icon.createIcon(this._icon),c=!1;a!==this._icon&&(this._icon&&this._removeIcon(),c=!0,t.title&&(a.title=t.title),a.tagName==="IMG"&&(a.alt=t.alt||"")),Ht(a,o),t.keyboard&&(a.tabIndex="0",a.setAttribute("role","button")),this._icon=a,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&jt(a,"focus",this._panOnFocus,this);var d=t.icon.createShadow(this._shadow),g=!1;d!==this._shadow&&(this._removeShadow(),g=!0),d&&(Ht(d,o),d.alt=""),this._shadow=d,t.opacity<1&&this._updateOpacity(),c&&this.getPane().appendChild(this._icon),this._initInteraction(),d&&g&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Oe(this._icon,"focus",this._panOnFocus,this),Pe(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Pe(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&Ue(this._icon,t),this._shadow&&Ue(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(t){var o=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(o)},_initInteraction:function(){if(this.options.interactive&&(Ht(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),ws)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new ws(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&dn(this._icon,t),this._shadow&&dn(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var t=this._map;if(t){var o=this.options.icon.options,a=o.iconSize?V(o.iconSize):V(0,0),c=o.iconAnchor?V(o.iconAnchor):V(0,0);t.panInside(this._latlng,{paddingTopLeft:c,paddingBottomRight:a.subtract(c)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function wl(t,o){return new Ui(t,o)}var qn=Tn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return C(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),Yi=qn.extend({options:{fill:!0,radius:10},initialize:function(t,o){C(this,o),this._latlng=H(t),this._radius=this.options.radius},setLatLng:function(t){var o=this._latlng;return this._latlng=H(t),this.redraw(),this.fire("move",{oldLatLng:o,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var o=t&&t.radius||this._radius;return qn.prototype.setStyle.call(this,t),this.setRadius(o),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,o=this._radiusY||t,a=this._clickTolerance(),c=[t+a,o+a];this._pxBounds=new yt(this._point.subtract(c),this._point.add(c))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function bl(t,o){return new Yi(t,o)}var No=Yi.extend({initialize:function(t,o,a){if(typeof o=="number"&&(o=r({},a,{radius:o})),C(this,o),this._latlng=H(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new dt(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:qn.prototype.setStyle,_project:function(){var t=this._latlng.lng,o=this._latlng.lat,a=this._map,c=a.options.crs;if(c.distance===Gt.distance){var d=Math.PI/180,g=this._mRadius/Gt.R/d,P=a.project([o+g,t]),z=a.project([o-g,t]),x=P.add(z).divideBy(2),tt=a.unproject(x).lat,kt=Math.acos((Math.cos(g*d)-Math.sin(o*d)*Math.sin(tt*d))/(Math.cos(o*d)*Math.cos(tt*d)))/d;(isNaN(kt)||kt===0)&&(kt=g/Math.cos(Math.PI/180*o)),this._point=x.subtract(a.getPixelOrigin()),this._radius=isNaN(kt)?0:x.x-a.project([tt,t-kt]).x,this._radiusY=x.y-P.y}else{var It=c.unproject(c.project(this._latlng).subtract([this._mRadius,0]));this._point=a.latLngToLayerPoint(this._latlng),this._radius=this._point.x-a.latLngToLayerPoint(It).x}this._updateBounds()}});function kl(t,o,a){return new No(t,o,a)}var Fn=qn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,o){C(this,o),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var o=1/0,a=null,c=Si,d,g,P=0,z=this._parts.length;P<z;P++)for(var x=this._parts[P],tt=1,kt=x.length;tt<kt;tt++){d=x[tt-1],g=x[tt];var It=c(t,d,g,!0);It<o&&(o=It,a=c(t,d,g))}return a&&(a.distance=Math.sqrt(o)),a},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return vs(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,o){return o=o||this._defaultShape(),t=H(t),o.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new dt,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Pn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var o=[],a=Pn(t),c=0,d=t.length;c<d;c++)a?(o[c]=H(t[c]),this._bounds.extend(o[c])):o[c]=this._convertLatLngs(t[c]);return o},_project:function(){var t=new yt;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),o=new A(t,t);this._rawPxBounds&&(this._pxBounds=new yt([this._rawPxBounds.min.subtract(o),this._rawPxBounds.max.add(o)]))},_projectLatlngs:function(t,o,a){var c=t[0]instanceof W,d=t.length,g,P;if(c){for(P=[],g=0;g<d;g++)P[g]=this._map.latLngToLayerPoint(t[g]),a.extend(P[g]);o.push(P)}else for(g=0;g<d;g++)this._projectLatlngs(t[g],o,a)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}var o=this._parts,a,c,d,g,P,z,x;for(a=0,d=0,g=this._rings.length;a<g;a++)for(x=this._rings[a],c=0,P=x.length;c<P-1;c++)z=gs(x[c],x[c+1],t,c,!0),z&&(o[d]=o[d]||[],o[d].push(z[0]),(z[1]!==x[c+1]||c===P-2)&&(o[d].push(z[1]),d++))}},_simplifyPoints:function(){for(var t=this._parts,o=this.options.smoothFactor,a=0,c=t.length;a<c;a++)t[a]=ds(t[a],o)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,o){var a,c,d,g,P,z,x=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(a=0,g=this._parts.length;a<g;a++)for(z=this._parts[a],c=0,P=z.length,d=P-1;c<P;d=c++)if(!(!o&&c===0)&&_s(t,z[d],z[c])<=x)return!0;return!1}});function Pl(t,o){return new Fn(t,o)}Fn._flat=ps;var hi=Fn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return fs(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var o=Fn.prototype._convertLatLngs.call(this,t),a=o.length;return a>=2&&o[0]instanceof W&&o[0].equals(o[a-1])&&o.pop(),o},_setLatLngs:function(t){Fn.prototype._setLatLngs.call(this,t),Pn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Pn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,o=this.options.weight,a=new A(o,o);if(t=new yt(t.min.subtract(a),t.max.add(a)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var c=0,d=this._rings.length,g;c<d;c++)g=hs(this._rings[c],t,!0),g.length&&this._parts.push(g)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var o=!1,a,c,d,g,P,z,x,tt;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(g=0,x=this._parts.length;g<x;g++)for(a=this._parts[g],P=0,tt=a.length,z=tt-1;P<tt;z=P++)c=a[P],d=a[z],c.y>t.y!=d.y>t.y&&t.x<(d.x-c.x)*(t.y-c.y)/(d.y-c.y)+c.x&&(o=!o);return o||Fn.prototype._containsPoint.call(this,t,!0)}});function Ll(t,o){return new hi(t,o)}var Gn=Hn.extend({initialize:function(t,o){C(this,o),this._layers={},t&&this.addData(t)},addData:function(t){var o=I(t)?t:t.features,a,c,d;if(o){for(a=0,c=o.length;a<c;a++)d=o[a],(d.geometries||d.geometry||d.features||d.coordinates)&&this.addData(d);return this}var g=this.options;if(g.filter&&!g.filter(t))return this;var P=qi(t,g);return P?(P.feature=Ji(t),P.defaultOptions=P.options,this.resetStyle(P),g.onEachFeature&&g.onEachFeature(t,P),this.addLayer(P)):this},resetStyle:function(t){return t===void 0?this.eachLayer(this.resetStyle,this):(t.options=r({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)},setStyle:function(t){return this.eachLayer(function(o){this._setLayerStyle(o,t)},this)},_setLayerStyle:function(t,o){t.setStyle&&(typeof o=="function"&&(o=o(t.feature)),t.setStyle(o))}});function qi(t,o){var a=t.type==="Feature"?t.geometry:t,c=a?a.coordinates:null,d=[],g=o&&o.pointToLayer,P=o&&o.coordsToLatLng||Io,z,x,tt,kt;if(!c&&!a)return null;switch(a.type){case"Point":return z=P(c),bs(g,t,z,o);case"MultiPoint":for(tt=0,kt=c.length;tt<kt;tt++)z=P(c[tt]),d.push(bs(g,t,z,o));return new Hn(d);case"LineString":case"MultiLineString":return x=Vi(c,a.type==="LineString"?0:1,P),new Fn(x,o);case"Polygon":case"MultiPolygon":return x=Vi(c,a.type==="Polygon"?1:2,P),new hi(x,o);case"GeometryCollection":for(tt=0,kt=a.geometries.length;tt<kt;tt++){var It=qi({geometry:a.geometries[tt],type:"Feature",properties:t.properties},o);It&&d.push(It)}return new Hn(d);case"FeatureCollection":for(tt=0,kt=a.features.length;tt<kt;tt++){var Jt=qi(a.features[tt],o);Jt&&d.push(Jt)}return new Hn(d);default:throw new Error("Invalid GeoJSON object.")}}function bs(t,o,a,c){return t?t(o,a):new Ui(a,c&&c.markersInheritOptions&&c)}function Io(t){return new W(t[1],t[0],t[2])}function Vi(t,o,a){for(var c=[],d=0,g=t.length,P;d<g;d++)P=o?Vi(t[d],o-1,a):(a||Io)(t[d]),c.push(P);return c}function Oo(t,o){return t=H(t),t.alt!==void 0?[w(t.lng,o),w(t.lat,o),w(t.alt,o)]:[w(t.lng,o),w(t.lat,o)]}function Ki(t,o,a,c){for(var d=[],g=0,P=t.length;g<P;g++)d.push(o?Ki(t[g],Pn(t[g])?0:o-1,a,c):Oo(t[g],c));return!o&&a&&d.length>0&&d.push(d[0].slice()),d}function fi(t,o){return t.feature?r({},t.feature,{geometry:o}):Ji(o)}function Ji(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var xo={toGeoJSON:function(t){return fi(this,{type:"Point",coordinates:Oo(this.getLatLng(),t)})}};Ui.include(xo),No.include(xo),Yi.include(xo),Fn.include({toGeoJSON:function(t){var o=!Pn(this._latlngs),a=Ki(this._latlngs,o?1:0,!1,t);return fi(this,{type:(o?"Multi":"")+"LineString",coordinates:a})}}),hi.include({toGeoJSON:function(t){var o=!Pn(this._latlngs),a=o&&!Pn(this._latlngs[0]),c=Ki(this._latlngs,a?2:o?1:0,!0,t);return o||(c=[c]),fi(this,{type:(a?"Multi":"")+"Polygon",coordinates:c})}}),ui.include({toMultiPoint:function(t){var o=[];return this.eachLayer(function(a){o.push(a.toGeoJSON(t).geometry.coordinates)}),fi(this,{type:"MultiPoint",coordinates:o})},toGeoJSON:function(t){var o=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(o==="MultiPoint")return this.toMultiPoint(t);var a=o==="GeometryCollection",c=[];return this.eachLayer(function(d){if(d.toGeoJSON){var g=d.toGeoJSON(t);if(a)c.push(g.geometry);else{var P=Ji(g);P.type==="FeatureCollection"?c.push.apply(c,P.features):c.push(P)}}}),a?fi(this,{geometries:c,type:"GeometryCollection"}):{type:"FeatureCollection",features:c}}});function ks(t,o){return new Gn(t,o)}var Cl=ks,Qi=Tn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,o,a){this._url=t,this._bounds=Z(o),C(this,a)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Ht(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Pe(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&kn(this._image),this},bringToBack:function(){return this._map&&sn(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=Z(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t=this._url.tagName==="IMG",o=this._image=t?this._url:Wt("img");if(Ht(o,"leaflet-image-layer"),this._zoomAnimated&&Ht(o,"leaflet-zoom-animated"),this.options.className&&Ht(o,this.options.className),o.onselectstart=p,o.onmousemove=p,o.onload=u(this.fire,this,"load"),o.onerror=u(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(o.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=o.src;return}o.src=this._url,o.alt=this.options.alt},_animateZoom:function(t){var o=this._map.getZoomScale(t.zoom),a=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Nn(this._image,a,o)},_reset:function(){var t=this._image,o=new yt(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),a=o.getSize();Ue(t,o.min),t.style.width=a.x+"px",t.style.height=a.y+"px"},_updateOpacity:function(){dn(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Sl=function(t,o,a){return new Qi(t,o,a)},Ps=Qi.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",o=this._image=t?this._url:Wt("video");if(Ht(o,"leaflet-image-layer"),this._zoomAnimated&&Ht(o,"leaflet-zoom-animated"),this.options.className&&Ht(o,this.options.className),o.onselectstart=p,o.onmousemove=p,o.onloadeddata=u(this.fire,this,"load"),t){for(var a=o.getElementsByTagName("source"),c=[],d=0;d<a.length;d++)c.push(a[d].src);this._url=a.length>0?c:[o.src];return}I(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(o.style,"objectFit")&&(o.style.objectFit="fill"),o.autoplay=!!this.options.autoplay,o.loop=!!this.options.loop,o.muted=!!this.options.muted,o.playsInline=!!this.options.playsInline;for(var g=0;g<this._url.length;g++){var P=Wt("source");P.src=this._url[g],o.appendChild(P)}}});function Ml(t,o,a){return new Ps(t,o,a)}var Ls=Qi.extend({_initImage:function(){var t=this._image=this._url;Ht(t,"leaflet-image-layer"),this._zoomAnimated&&Ht(t,"leaflet-zoom-animated"),this.options.className&&Ht(t,this.options.className),t.onselectstart=p,t.onmousemove=p}});function Tl(t,o,a){return new Ls(t,o,a)}var xn=Tn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,o){t&&(t instanceof W||I(t))?(this._latlng=H(t),C(this,o)):(C(this,t),this._source=o),this.options.content&&(this._content=this.options.content)},openOn:function(t){return t=arguments.length?t:this._source._map,t.hasLayer(this)||t.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(t){return this._map?this.close():(arguments.length?this._source=t:t=this._source,this._prepareOpen(),this.openOn(t._map)),this},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&dn(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&dn(this._container,1),this.bringToFront(),this.options.interactive&&(Ht(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(dn(this._container,0),this._removeTimeout=setTimeout(u(Pe,void 0,this._container),200)):Pe(this._container),this.options.interactive&&(Ze(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=H(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&kn(this._container),this},bringToBack:function(){return this._map&&sn(this._container),this},_prepareOpen:function(t){var o=this._source;if(!o._map)return!1;if(o instanceof Hn){o=null;var a=this._source._layers;for(var c in a)if(a[c]._map){o=a[c];break}if(!o)return!1;this._source=o}if(!t)if(o.getCenter)t=o.getCenter();else if(o.getLatLng)t=o.getLatLng();else if(o.getBounds)t=o.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,o=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof o=="string")t.innerHTML=o;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(o)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),o=V(this.options.offset),a=this._getAnchor();this._zoomAnimated?Ue(this._container,t.add(a)):o=o.add(t).add(a);var c=this._containerBottom=-o.y,d=this._containerLeft=-Math.round(this._containerWidth/2)+o.x;this._container.style.bottom=c+"px",this._container.style.left=d+"px"}},_getAnchor:function(){return[0,0]}});ae.include({_initOverlay:function(t,o,a,c){var d=o;return d instanceof t||(d=new t(c).setContent(o)),a&&d.setLatLng(a),d}}),Tn.include({_initOverlay:function(t,o,a,c){var d=a;return d instanceof t?(C(d,c),d._source=this):(d=o&&!c?o:new t(c,this),d.setContent(a)),d}});var $i=xn.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t=arguments.length?t:this._source._map,!t.hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,xn.prototype.openOn.call(this,t)},onAdd:function(t){xn.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof qn||this._source.on("preclick",ei))},onRemove:function(t){xn.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof qn||this._source.off("preclick",ei))},getEvents:function(){var t=xn.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this.close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_initLayout:function(){var t="leaflet-popup",o=this._container=Wt("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),a=this._wrapper=Wt("div",t+"-content-wrapper",o);if(this._contentNode=Wt("div",t+"-content",a),Li(o),Lo(this._contentNode),jt(o,"contextmenu",ei),this._tipContainer=Wt("div",t+"-tip-container",o),this._tip=Wt("div",t+"-tip",this._tipContainer),this.options.closeButton){var c=this._closeButton=Wt("a",t+"-close-button",o);c.setAttribute("role","button"),c.setAttribute("aria-label","Close popup"),c.href="#close",c.innerHTML='<span aria-hidden="true">&#215;</span>',jt(c,"click",function(d){un(d),this.close()},this)}},_updateLayout:function(){var t=this._contentNode,o=t.style;o.width="",o.whiteSpace="nowrap";var a=t.offsetWidth;a=Math.min(a,this.options.maxWidth),a=Math.max(a,this.options.minWidth),o.width=a+1+"px",o.whiteSpace="",o.height="";var c=t.offsetHeight,d=this.options.maxHeight,g="leaflet-popup-scrolled";d&&c>d?(o.height=d+"px",Ht(t,g)):Ze(t,g),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var o=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),a=this._getAnchor();Ue(this._container,o.add(a))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,o=parseInt(mt(this._container,"marginBottom"),10)||0,a=this._container.offsetHeight+o,c=this._containerWidth,d=new A(this._containerLeft,-a-this._containerBottom);d._add(Rn(this._container));var g=t.layerPointToContainerPoint(d),P=V(this.options.autoPanPadding),z=V(this.options.autoPanPaddingTopLeft||P),x=V(this.options.autoPanPaddingBottomRight||P),tt=t.getSize(),kt=0,It=0;g.x+c+x.x>tt.x&&(kt=g.x+c-tt.x+x.x),g.x-kt-z.x<0&&(kt=g.x-z.x),g.y+a+x.y>tt.y&&(It=g.y+a-tt.y+x.y),g.y-It-z.y<0&&(It=g.y-z.y),(kt||It)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([kt,It]))}},_getAnchor:function(){return V(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),El=function(t,o){return new $i(t,o)};ae.mergeOptions({closePopupOnClick:!0}),ae.include({openPopup:function(t,o,a){return this._initOverlay($i,t,o,a).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),Tn.include({bindPopup:function(t,o){return this._popup=this._initOverlay($i,this._popup,t,o),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof Hn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){ni(t);var o=t.layer||t.target;if(this._popup._source===o&&!(o instanceof qn)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=o,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var to=xn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){xn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){xn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=xn.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",o=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Wt("div",o),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+h(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var o,a,c=this._map,d=this._container,g=c.latLngToContainerPoint(c.getCenter()),P=c.layerPointToContainerPoint(t),z=this.options.direction,x=d.offsetWidth,tt=d.offsetHeight,kt=V(this.options.offset),It=this._getAnchor();z==="top"?(o=x/2,a=tt):z==="bottom"?(o=x/2,a=0):z==="center"?(o=x/2,a=tt/2):z==="right"?(o=0,a=tt/2):z==="left"?(o=x,a=tt/2):P.x<g.x?(z="right",o=0,a=tt/2):(z="left",o=x+(kt.x+It.x)*2,a=tt/2),t=t.subtract(V(o,a,!0)).add(kt).add(It),Ze(d,"leaflet-tooltip-right"),Ze(d,"leaflet-tooltip-left"),Ze(d,"leaflet-tooltip-top"),Ze(d,"leaflet-tooltip-bottom"),Ht(d,"leaflet-tooltip-"+z),Ue(d,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&dn(this._container,t)},_animateZoom:function(t){var o=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(o)},_getAnchor:function(){return V(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),zl=function(t,o){return new to(t,o)};ae.include({openTooltip:function(t,o,a){return this._initOverlay(to,t,o,a).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),Tn.include({bindTooltip:function(t,o){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(to,this._tooltip,t,o),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(!(!t&&this._tooltipHandlersAdded)){var o=t?"off":"on",a={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?a.add=this._openTooltip:(a.mouseover=this._openTooltip,a.mouseout=this.closeTooltip,a.click=this._openTooltip,this._map?this._addFocusListeners():a.add=this._addFocusListeners),this._tooltip.options.sticky&&(a.mousemove=this._moveTooltip),this[o](a),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof Hn||(this._tooltip._source=this),this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(t){var o=typeof t.getElement=="function"&&t.getElement();o&&(jt(o,"focus",function(){this._tooltip._source=t,this.openTooltip()},this),jt(o,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var o=typeof t.getElement=="function"&&t.getElement();o&&o.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(t){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var o=this;this._map.once("moveend",function(){o._openOnceFlag=!1,o._openTooltip(t)});return}this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0)}},_moveTooltip:function(t){var o=t.latlng,a,c;this._tooltip.options.sticky&&t.originalEvent&&(a=this._map.mouseEventToContainerPoint(t.originalEvent),c=this._map.containerPointToLayerPoint(a),o=this._map.layerPointToLatLng(c)),this._tooltip.setLatLng(o)}});var Cs=ci.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var o=t&&t.tagName==="DIV"?t:document.createElement("div"),a=this.options;if(a.html instanceof Element?(gn(o),o.appendChild(a.html)):o.innerHTML=a.html!==!1?a.html:"",a.bgPos){var c=V(a.bgPos);o.style.backgroundPosition=-c.x+"px "+-c.y+"px"}return this._setIconStyles(o,"icon"),o},createShadow:function(){return null}});function Al(t){return new Cs(t)}ci.Default=Mi;var Ti=Tn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:_t.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){C(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),Pe(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(kn(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(sn(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var t=this._clampZoom(this._map.getZoom());t!==this._tileZoom&&(this._tileZoom=t,this._updateLevels()),this._update()}return this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=_(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof A?t:new A(t,t)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var o=this.getPane().children,a=-t(-1/0,1/0),c=0,d=o.length,g;c<d;c++)g=o[c].style.zIndex,o[c]!==this._container&&g&&(a=t(a,+g));isFinite(a)&&(this.options.zIndex=a+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!_t.ielt9){dn(this._container,this.options.opacity);var t=+new Date,o=!1,a=!1;for(var c in this._tiles){var d=this._tiles[c];if(!(!d.current||!d.loaded)){var g=Math.min(1,(t-d.loaded)/200);dn(d.el,g),g<1?o=!0:(d.active?a=!0:this._onOpaqueTile(d),d.active=!0)}}a&&!this._noPrune&&this._pruneTiles(),o&&(G(this._fadeFrame),this._fadeFrame=Q(this._updateOpacity,this))}},_onOpaqueTile:p,_initContainer:function(){this._container||(this._container=Wt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,o=this.options.maxZoom;if(t!==void 0){for(var a in this._levels)a=Number(a),this._levels[a].el.children.length||a===t?(this._levels[a].el.style.zIndex=o-Math.abs(t-a),this._onUpdateLevel(a)):(Pe(this._levels[a].el),this._removeTilesAtZoom(a),this._onRemoveLevel(a),delete this._levels[a]);var c=this._levels[t],d=this._map;return c||(c=this._levels[t]={},c.el=Wt("div","leaflet-tile-container leaflet-zoom-animated",this._container),c.el.style.zIndex=o,c.origin=d.project(d.unproject(d.getPixelOrigin()),t).round(),c.zoom=t,this._setZoomTransform(c,d.getCenter(),d.getZoom()),p(c.el.offsetWidth),this._onCreateLevel(c)),this._level=c,c}},_onUpdateLevel:p,_onRemoveLevel:p,_onCreateLevel:p,_pruneTiles:function(){if(this._map){var t,o,a=this._map.getZoom();if(a>this.options.maxZoom||a<this.options.minZoom){this._removeAllTiles();return}for(t in this._tiles)o=this._tiles[t],o.retain=o.current;for(t in this._tiles)if(o=this._tiles[t],o.current&&!o.active){var c=o.coords;this._retainParent(c.x,c.y,c.z,c.z-5)||this._retainChildren(c.x,c.y,c.z,c.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}},_removeTilesAtZoom:function(t){for(var o in this._tiles)this._tiles[o].coords.z===t&&this._removeTile(o)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)Pe(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,o,a,c){var d=Math.floor(t/2),g=Math.floor(o/2),P=a-1,z=new A(+d,+g);z.z=+P;var x=this._tileCoordsToKey(z),tt=this._tiles[x];return tt&&tt.active?(tt.retain=!0,!0):(tt&&tt.loaded&&(tt.retain=!0),P>c?this._retainParent(d,g,P,c):!1)},_retainChildren:function(t,o,a,c){for(var d=2*t;d<2*t+2;d++)for(var g=2*o;g<2*o+2;g++){var P=new A(d,g);P.z=a+1;var z=this._tileCoordsToKey(P),x=this._tiles[z];if(x&&x.active){x.retain=!0;continue}else x&&x.loaded&&(x.retain=!0);a+1<c&&this._retainChildren(d,g,a+1,c)}},_resetView:function(t){var o=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),o,o)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var o=this.options;return o.minNativeZoom!==void 0&&t<o.minNativeZoom?o.minNativeZoom:o.maxNativeZoom!==void 0&&o.maxNativeZoom<t?o.maxNativeZoom:t},_setView:function(t,o,a,c){var d=Math.round(o);this.options.maxZoom!==void 0&&d>this.options.maxZoom||this.options.minZoom!==void 0&&d<this.options.minZoom?d=void 0:d=this._clampZoom(d);var g=this.options.updateWhenZooming&&d!==this._tileZoom;(!c||g)&&(this._tileZoom=d,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),d!==void 0&&this._update(t),a||this._pruneTiles(),this._noPrune=!!a),this._setZoomTransforms(t,o)},_setZoomTransforms:function(t,o){for(var a in this._levels)this._setZoomTransform(this._levels[a],t,o)},_setZoomTransform:function(t,o,a){var c=this._map.getZoomScale(a,t.zoom),d=t.origin.multiplyBy(c).subtract(this._map._getNewPixelOrigin(o,a)).round();_t.any3d?Nn(t.el,d,c):Ue(t.el,d)},_resetGrid:function(){var t=this._map,o=t.options.crs,a=this._tileSize=this.getTileSize(),c=this._tileZoom,d=this._map.getPixelWorldBounds(this._tileZoom);d&&(this._globalTileRange=this._pxBoundsToTileRange(d)),this._wrapX=o.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,o.wrapLng[0]],c).x/a.x),Math.ceil(t.project([0,o.wrapLng[1]],c).x/a.y)],this._wrapY=o.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([o.wrapLat[0],0],c).y/a.x),Math.ceil(t.project([o.wrapLat[1],0],c).y/a.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(t){var o=this._map,a=o._animatingZoom?Math.max(o._animateToZoom,o.getZoom()):o.getZoom(),c=o.getZoomScale(a,this._tileZoom),d=o.project(t,this._tileZoom).floor(),g=o.getSize().divideBy(c*2);return new yt(d.subtract(g),d.add(g))},_update:function(t){var o=this._map;if(o){var a=this._clampZoom(o.getZoom());if(t===void 0&&(t=o.getCenter()),this._tileZoom!==void 0){var c=this._getTiledPixelBounds(t),d=this._pxBoundsToTileRange(c),g=d.getCenter(),P=[],z=this.options.keepBuffer,x=new yt(d.getBottomLeft().subtract([z,-z]),d.getTopRight().add([z,-z]));if(!(isFinite(d.min.x)&&isFinite(d.min.y)&&isFinite(d.max.x)&&isFinite(d.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var tt in this._tiles){var kt=this._tiles[tt].coords;(kt.z!==this._tileZoom||!x.contains(new A(kt.x,kt.y)))&&(this._tiles[tt].current=!1)}if(Math.abs(a-this._tileZoom)>1){this._setView(t,a);return}for(var It=d.min.y;It<=d.max.y;It++)for(var Jt=d.min.x;Jt<=d.max.x;Jt++){var _n=new A(Jt,It);if(_n.z=this._tileZoom,!!this._isValidTile(_n)){var rn=this._tiles[this._tileCoordsToKey(_n)];rn?rn.current=!0:P.push(_n)}}if(P.sort(function(pn,_i){return pn.distanceTo(g)-_i.distanceTo(g)}),P.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Ln=document.createDocumentFragment();for(Jt=0;Jt<P.length;Jt++)this._addTile(P[Jt],Ln);this._level.el.appendChild(Ln)}}}},_isValidTile:function(t){var o=this._map.options.crs;if(!o.infinite){var a=this._globalTileRange;if(!o.wrapLng&&(t.x<a.min.x||t.x>a.max.x)||!o.wrapLat&&(t.y<a.min.y||t.y>a.max.y))return!1}if(!this.options.bounds)return!0;var c=this._tileCoordsToBounds(t);return Z(this.options.bounds).overlaps(c)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var o=this._map,a=this.getTileSize(),c=t.scaleBy(a),d=c.add(a),g=o.unproject(c,t.z),P=o.unproject(d,t.z);return[g,P]},_tileCoordsToBounds:function(t){var o=this._tileCoordsToNwSe(t),a=new dt(o[0],o[1]);return this.options.noWrap||(a=this._map.wrapLatLngBounds(a)),a},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var o=t.split(":"),a=new A(+o[0],+o[1]);return a.z=+o[2],a},_removeTile:function(t){var o=this._tiles[t];o&&(Pe(o.el),delete this._tiles[t],this.fire("tileunload",{tile:o.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){Ht(t,"leaflet-tile");var o=this.getTileSize();t.style.width=o.x+"px",t.style.height=o.y+"px",t.onselectstart=p,t.onmousemove=p,_t.ielt9&&this.options.opacity<1&&dn(t,this.options.opacity)},_addTile:function(t,o){var a=this._getTilePos(t),c=this._tileCoordsToKey(t),d=this.createTile(this._wrapCoords(t),u(this._tileReady,this,t));this._initTile(d),this.createTile.length<2&&Q(u(this._tileReady,this,t,null,d)),Ue(d,a),this._tiles[c]={el:d,coords:t,current:!0},o.appendChild(d),this.fire("tileloadstart",{tile:d,coords:t})},_tileReady:function(t,o,a){o&&this.fire("tileerror",{error:o,tile:a,coords:t});var c=this._tileCoordsToKey(t);a=this._tiles[c],a&&(a.loaded=+new Date,this._map._fadeAnimated?(dn(a.el,0),G(this._fadeFrame),this._fadeFrame=Q(this._updateOpacity,this)):(a.active=!0,this._pruneTiles()),o||(Ht(a.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:a.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),_t.ielt9||!this._map._fadeAnimated?Q(this._pruneTiles,this):setTimeout(u(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var o=new A(this._wrapX?m(t.x,this._wrapX):t.x,this._wrapY?m(t.y,this._wrapY):t.y);return o.z=t.z,o},_pxBoundsToTileRange:function(t){var o=this.getTileSize();return new yt(t.min.unscaleBy(o).floor(),t.max.unscaleBy(o).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Nl(t){return new Ti(t)}var di=Ti.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,o){this._url=t,o=C(this,o),o.detectRetina&&_t.retina&&o.maxZoom>0?(o.tileSize=Math.floor(o.tileSize/2),o.zoomReverse?(o.zoomOffset--,o.minZoom=Math.min(o.maxZoom,o.minZoom+1)):(o.zoomOffset++,o.maxZoom=Math.max(o.minZoom,o.maxZoom-1)),o.minZoom=Math.max(0,o.minZoom)):o.zoomReverse?o.minZoom=Math.min(o.maxZoom,o.minZoom):o.maxZoom=Math.max(o.minZoom,o.maxZoom),typeof o.subdomains=="string"&&(o.subdomains=o.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,o){return this._url===t&&o===void 0&&(o=!0),this._url=t,o||this.redraw(),this},createTile:function(t,o){var a=document.createElement("img");return jt(a,"load",u(this._tileOnLoad,this,o,a)),jt(a,"error",u(this._tileOnError,this,o,a)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(a.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(a.referrerPolicy=this.options.referrerPolicy),a.alt="",a.src=this.getTileUrl(t),a},getTileUrl:function(t){var o={r:_t.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var a=this._globalTileRange.max.y-t.y;this.options.tms&&(o.y=a),o["-y"]=a}return T(this._url,r(o,this.options))},_tileOnLoad:function(t,o){_t.ielt9?setTimeout(u(t,this,null,o),0):t(null,o)},_tileOnError:function(t,o,a){var c=this.options.errorTileUrl;c&&o.getAttribute("src")!==c&&(o.src=c),t(a,o)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,o=this.options.maxZoom,a=this.options.zoomReverse,c=this.options.zoomOffset;return a&&(t=o-t),t+c},_getSubdomain:function(t){var o=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[o]},_abortLoading:function(){var t,o;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&(o=this._tiles[t].el,o.onload=p,o.onerror=p,!o.complete)){o.src=j;var a=this._tiles[t].coords;Pe(o),delete this._tiles[t],this.fire("tileabort",{tile:o,coords:a})}},_removeTile:function(t){var o=this._tiles[t];if(o)return o.el.setAttribute("src",j),Ti.prototype._removeTile.call(this,t)},_tileReady:function(t,o,a){if(!(!this._map||a&&a.getAttribute("src")===j))return Ti.prototype._tileReady.call(this,t,o,a)}});function Ss(t,o){return new di(t,o)}var Ms=di.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,o){this._url=t;var a=r({},this.defaultWmsParams);for(var c in o)c in this.options||(a[c]=o[c]);o=C(this,o);var d=o.detectRetina&&_t.retina?2:1,g=this.getTileSize();a.width=g.x*d,a.height=g.y*d,this.wmsParams=a},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var o=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[o]=this._crs.code,di.prototype.onAdd.call(this,t)},getTileUrl:function(t){var o=this._tileCoordsToNwSe(t),a=this._crs,c=Pt(a.project(o[0]),a.project(o[1])),d=c.min,g=c.max,P=(this._wmsVersion>=1.3&&this._crs===ys?[d.y,d.x,g.y,g.x]:[d.x,d.y,g.x,g.y]).join(","),z=di.prototype.getTileUrl.call(this,t);return z+M(this.wmsParams,z,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+P},setParams:function(t,o){return r(this.wmsParams,t),o||this.redraw(),this}});function Il(t,o){return new Ms(t,o)}di.WMS=Ms,Ss.wms=Il;var jn=Tn.extend({options:{padding:.1},initialize:function(t){C(this,t),h(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Ht(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,o){var a=this._map.getZoomScale(o,this._zoom),c=this._map.getSize().multiplyBy(.5+this.options.padding),d=this._map.project(this._center,o),g=c.multiplyBy(-a).add(d).subtract(this._map._getNewPixelOrigin(t,o));_t.any3d?Nn(this._container,g,a):Ue(this._container,g)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,o=this._map.getSize(),a=this._map.containerPointToLayerPoint(o.multiplyBy(-t)).round();this._bounds=new yt(a,a.add(o.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Ts=jn.extend({options:{tolerance:0},getEvents:function(){var t=jn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){jn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");jt(t,"mousemove",this._onMouseMove,this),jt(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),jt(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){G(this._redrawRequest),delete this._ctx,Pe(this._container),Oe(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var o in this._layers)t=this._layers[o],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){jn.prototype._update.call(this);var t=this._bounds,o=this._container,a=t.getSize(),c=_t.retina?2:1;Ue(o,t.min),o.width=c*a.x,o.height=c*a.y,o.style.width=a.x+"px",o.style.height=a.y+"px",_t.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){jn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[h(t)]=t;var o=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=o),this._drawLast=o,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var o=t._order,a=o.next,c=o.prev;a?a.prev=c:this._drawLast=c,c?c.next=a:this._drawFirst=a,delete t._order,delete this._layers[h(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(typeof t.options.dashArray=="string"){var o=t.options.dashArray.split(/[, ]+/),a=[],c,d;for(d=0;d<o.length;d++){if(c=Number(o[d]),isNaN(c))return;a.push(c)}t.options._dashArray=a}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||Q(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var o=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new yt,this._redrawBounds.extend(t._pxBounds.min.subtract([o,o])),this._redrawBounds.extend(t._pxBounds.max.add([o,o]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var o=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,o.x,o.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var t,o=this._redrawBounds;if(this._ctx.save(),o){var a=o.getSize();this._ctx.beginPath(),this._ctx.rect(o.min.x,o.min.y,a.x,a.y),this._ctx.clip()}this._drawing=!0;for(var c=this._drawFirst;c;c=c.next)t=c.layer,(!o||t._pxBounds&&t._pxBounds.intersects(o))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,o){if(this._drawing){var a,c,d,g,P=t._parts,z=P.length,x=this._ctx;if(z){for(x.beginPath(),a=0;a<z;a++){for(c=0,d=P[a].length;c<d;c++)g=P[a][c],x[c?"lineTo":"moveTo"](g.x,g.y);o&&x.closePath()}this._fillStroke(x,t)}}},_updateCircle:function(t){if(!(!this._drawing||t._empty())){var o=t._point,a=this._ctx,c=Math.max(Math.round(t._radius),1),d=(Math.max(Math.round(t._radiusY),1)||c)/c;d!==1&&(a.save(),a.scale(1,d)),a.beginPath(),a.arc(o.x,o.y/d,c,0,Math.PI*2,!1),d!==1&&a.restore(),this._fillStroke(a,t)}},_fillStroke:function(t,o){var a=o.options;a.fill&&(t.globalAlpha=a.fillOpacity,t.fillStyle=a.fillColor||a.color,t.fill(a.fillRule||"evenodd")),a.stroke&&a.weight!==0&&(t.setLineDash&&t.setLineDash(o.options&&o.options._dashArray||[]),t.globalAlpha=a.opacity,t.lineWidth=a.weight,t.strokeStyle=a.color,t.lineCap=a.lineCap,t.lineJoin=a.lineJoin,t.stroke())},_onClick:function(t){for(var o=this._map.mouseEventToLayerPoint(t),a,c,d=this._drawFirst;d;d=d.next)a=d.layer,a.options.interactive&&a._containsPoint(o)&&(!(t.type==="click"||t.type==="preclick")||!this._map._draggableMoved(a))&&(c=a);this._fireEvent(c?[c]:!1,t)},_onMouseMove:function(t){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var o=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,o)}},_handleMouseOut:function(t){var o=this._hoveredLayer;o&&(Ze(this._container,"leaflet-interactive"),this._fireEvent([o],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,o){if(!this._mouseHoverThrottled){for(var a,c,d=this._drawFirst;d;d=d.next)a=d.layer,a.options.interactive&&a._containsPoint(o)&&(c=a);c!==this._hoveredLayer&&(this._handleMouseOut(t),c&&(Ht(this._container,"leaflet-interactive"),this._fireEvent([c],t,"mouseover"),this._hoveredLayer=c)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,t),this._mouseHoverThrottled=!0,setTimeout(u(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(t,o,a){this._map._fireDOMEvent(o,a||o.type,t)},_bringToFront:function(t){var o=t._order;if(o){var a=o.next,c=o.prev;if(a)a.prev=c;else return;c?c.next=a:a&&(this._drawFirst=a),o.prev=this._drawLast,this._drawLast.next=o,o.next=null,this._drawLast=o,this._requestRedraw(t)}},_bringToBack:function(t){var o=t._order;if(o){var a=o.next,c=o.prev;if(c)c.next=a;else return;a?a.prev=c:c&&(this._drawLast=c),o.prev=null,o.next=this._drawFirst,this._drawFirst.prev=o,this._drawFirst=o,this._requestRedraw(t)}}});function Es(t){return _t.canvas?new Ts(t):null}var Ei=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Ol={_initContainer:function(){this._container=Wt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(jn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var o=t._container=Ei("shape");Ht(o,"leaflet-vml-shape "+(this.options.className||"")),o.coordsize="1 1",t._path=Ei("path"),o.appendChild(t._path),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){var o=t._container;this._container.appendChild(o),t.options.interactive&&t.addInteractiveTarget(o)},_removePath:function(t){var o=t._container;Pe(o),t.removeInteractiveTarget(o),delete this._layers[h(t)]},_updateStyle:function(t){var o=t._stroke,a=t._fill,c=t.options,d=t._container;d.stroked=!!c.stroke,d.filled=!!c.fill,c.stroke?(o||(o=t._stroke=Ei("stroke")),d.appendChild(o),o.weight=c.weight+"px",o.color=c.color,o.opacity=c.opacity,c.dashArray?o.dashStyle=I(c.dashArray)?c.dashArray.join(" "):c.dashArray.replace(/( *, *)/g," "):o.dashStyle="",o.endcap=c.lineCap.replace("butt","flat"),o.joinstyle=c.lineJoin):o&&(d.removeChild(o),t._stroke=null),c.fill?(a||(a=t._fill=Ei("fill")),d.appendChild(a),a.color=c.fillColor||c.color,a.opacity=c.fillOpacity):a&&(d.removeChild(a),t._fill=null)},_updateCircle:function(t){var o=t._point.round(),a=Math.round(t._radius),c=Math.round(t._radiusY||a);this._setPath(t,t._empty()?"M0 0":"AL "+o.x+","+o.y+" "+a+","+c+" 0,"+65535*360)},_setPath:function(t,o){t._path.v=o},_bringToFront:function(t){kn(t._container)},_bringToBack:function(t){sn(t._container)}},eo=_t.vml?Ei:ce,zi=jn.extend({_initContainer:function(){this._container=eo("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=eo("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Pe(this._container),Oe(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){jn.prototype._update.call(this);var t=this._bounds,o=t.getSize(),a=this._container;(!this._svgSize||!this._svgSize.equals(o))&&(this._svgSize=o,a.setAttribute("width",o.x),a.setAttribute("height",o.y)),Ue(a,t.min),a.setAttribute("viewBox",[t.min.x,t.min.y,o.x,o.y].join(" ")),this.fire("update")}},_initPath:function(t){var o=t._path=eo("path");t.options.className&&Ht(o,t.options.className),t.options.interactive&&Ht(o,"leaflet-interactive"),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){Pe(t._path),t.removeInteractiveTarget(t._path),delete this._layers[h(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var o=t._path,a=t.options;o&&(a.stroke?(o.setAttribute("stroke",a.color),o.setAttribute("stroke-opacity",a.opacity),o.setAttribute("stroke-width",a.weight),o.setAttribute("stroke-linecap",a.lineCap),o.setAttribute("stroke-linejoin",a.lineJoin),a.dashArray?o.setAttribute("stroke-dasharray",a.dashArray):o.removeAttribute("stroke-dasharray"),a.dashOffset?o.setAttribute("stroke-dashoffset",a.dashOffset):o.removeAttribute("stroke-dashoffset")):o.setAttribute("stroke","none"),a.fill?(o.setAttribute("fill",a.fillColor||a.color),o.setAttribute("fill-opacity",a.fillOpacity),o.setAttribute("fill-rule",a.fillRule||"evenodd")):o.setAttribute("fill","none"))},_updatePoly:function(t,o){this._setPath(t,Se(t._parts,o))},_updateCircle:function(t){var o=t._point,a=Math.max(Math.round(t._radius),1),c=Math.max(Math.round(t._radiusY),1)||a,d="a"+a+","+c+" 0 1,0 ",g=t._empty()?"M0 0":"M"+(o.x-a)+","+o.y+d+a*2+",0 "+d+-a*2+",0 ";this._setPath(t,g)},_setPath:function(t,o){t._path.setAttribute("d",o)},_bringToFront:function(t){kn(t._path)},_bringToBack:function(t){sn(t._path)}});_t.vml&&zi.include(Ol);function zs(t){return _t.svg||_t.vml?new zi(t):null}ae.include({getRenderer:function(t){var o=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return o||(o=this._renderer=this._createRenderer()),this.hasLayer(o)||this.addLayer(o),o},_getPaneRenderer:function(t){if(t==="overlayPane"||t===void 0)return!1;var o=this._paneRenderers[t];return o===void 0&&(o=this._createRenderer({pane:t}),this._paneRenderers[t]=o),o},_createRenderer:function(t){return this.options.preferCanvas&&Es(t)||zs(t)}});var As=hi.extend({initialize:function(t,o){hi.prototype.initialize.call(this,this._boundsToLatLngs(t),o)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=Z(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function xl(t,o){return new As(t,o)}zi.create=eo,zi.pointsToPath=Se,Gn.geometryToLayer=qi,Gn.coordsToLatLng=Io,Gn.coordsToLatLngs=Vi,Gn.latLngToCoords=Oo,Gn.latLngsToCoords=Ki,Gn.getFeature=fi,Gn.asFeature=Ji,ae.mergeOptions({boxZoom:!0});var Ns=On.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){jt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Oe(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Pe(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),$n(),go(),this._startPoint=this._map.mouseEventToContainerPoint(t),jt(document,{contextmenu:ni,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=Wt("div","leaflet-zoom-box",this._container),Ht(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var o=new yt(this._point,this._startPoint),a=o.getSize();Ue(this._box,o.min),this._box.style.width=a.x+"px",this._box.style.height=a.y+"px"},_finish:function(){this._moved&&(Pe(this._box),Ze(this._container,"leaflet-crosshair")),ti(),po(),Oe(document,{contextmenu:ni,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(u(this._resetState,this),0);var o=new dt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(o).fire("boxzoomend",{boxZoomBounds:o})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});ae.addInitHook("addHandler","boxZoom",Ns),ae.mergeOptions({doubleClickZoom:!0});var Is=On.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var o=this._map,a=o.getZoom(),c=o.options.zoomDelta,d=t.originalEvent.shiftKey?a-c:a+c;o.options.doubleClickZoom==="center"?o.setZoom(d):o.setZoomAround(t.containerPoint,d)}});ae.addInitHook("addHandler","doubleClickZoom",Is),ae.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Os=On.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new Yn(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}Ht(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Ze(this._map._container,"leaflet-grab"),Ze(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var o=Z(this._map.options.maxBounds);this._offsetLimit=Pt(this._map.latLngToContainerPoint(o.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(o.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var o=this._lastTime=+new Date,a=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(a),this._times.push(o),this._prunePositions(o)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),o=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=o.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,o){return t-(t-o)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var t=this._draggable._newPos.subtract(this._draggable._startPos),o=this._offsetLimit;t.x<o.min.x&&(t.x=this._viscousLimit(t.x,o.min.x)),t.y<o.min.y&&(t.y=this._viscousLimit(t.y,o.min.y)),t.x>o.max.x&&(t.x=this._viscousLimit(t.x,o.max.x)),t.y>o.max.y&&(t.y=this._viscousLimit(t.y,o.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,o=Math.round(t/2),a=this._initialWorldOffset,c=this._draggable._newPos.x,d=(c-o+a)%t+o-a,g=(c+o+a)%t-o-a,P=Math.abs(d+a)<Math.abs(g+a)?d:g;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=P},_onDragEnd:function(t){var o=this._map,a=o.options,c=!a.inertia||t.noInertia||this._times.length<2;if(o.fire("dragend",t),c)o.fire("moveend");else{this._prunePositions(+new Date);var d=this._lastPos.subtract(this._positions[0]),g=(this._lastTime-this._times[0])/1e3,P=a.easeLinearity,z=d.multiplyBy(P/g),x=z.distanceTo([0,0]),tt=Math.min(a.inertiaMaxSpeed,x),kt=z.multiplyBy(tt/x),It=tt/(a.inertiaDeceleration*P),Jt=kt.multiplyBy(-It/2).round();!Jt.x&&!Jt.y?o.fire("moveend"):(Jt=o._limitOffset(Jt,o.options.maxBounds),Q(function(){o.panBy(Jt,{duration:It,easeLinearity:P,noMoveStart:!0,animate:!0})}))}}});ae.addInitHook("addHandler","dragging",Os),ae.mergeOptions({keyboard:!0,keyboardPanDelta:80});var xs=On.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),jt(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Oe(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,o=document.documentElement,a=t.scrollTop||o.scrollTop,c=t.scrollLeft||o.scrollLeft;this._map._container.focus(),window.scrollTo(c,a)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var o=this._panKeys={},a=this.keyCodes,c,d;for(c=0,d=a.left.length;c<d;c++)o[a.left[c]]=[-1*t,0];for(c=0,d=a.right.length;c<d;c++)o[a.right[c]]=[t,0];for(c=0,d=a.down.length;c<d;c++)o[a.down[c]]=[0,t];for(c=0,d=a.up.length;c<d;c++)o[a.up[c]]=[0,-1*t]},_setZoomDelta:function(t){var o=this._zoomKeys={},a=this.keyCodes,c,d;for(c=0,d=a.zoomIn.length;c<d;c++)o[a.zoomIn[c]]=t;for(c=0,d=a.zoomOut.length;c<d;c++)o[a.zoomOut[c]]=-t},_addHooks:function(){jt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Oe(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var o=t.keyCode,a=this._map,c;if(o in this._panKeys){if(!a._panAnim||!a._panAnim._inProgress)if(c=this._panKeys[o],t.shiftKey&&(c=V(c).multiplyBy(3)),a.options.maxBounds&&(c=a._limitOffset(V(c),a.options.maxBounds)),a.options.worldCopyJump){var d=a.wrapLatLng(a.unproject(a.project(a.getCenter()).add(c)));a.panTo(d)}else a.panBy(c)}else if(o in this._zoomKeys)a.setZoom(a.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[o]);else if(o===27&&a._popup&&a._popup.options.closeOnEscapeKey)a.closePopup();else return;ni(t)}}});ae.addInitHook("addHandler","keyboard",xs),ae.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Bs=On.extend({addHooks:function(){jt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Oe(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var o=rs(t),a=this._map.options.wheelDebounceTime;this._delta+=o,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var c=Math.max(a-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(u(this._performZoom,this),c),ni(t)},_performZoom:function(){var t=this._map,o=t.getZoom(),a=this._map.options.zoomSnap||0;t._stop();var c=this._delta/(this._map.options.wheelPxPerZoomLevel*4),d=4*Math.log(2/(1+Math.exp(-Math.abs(c))))/Math.LN2,g=a?Math.ceil(d/a)*a:d,P=t._limitZoom(o+(this._delta>0?g:-g))-o;this._delta=0,this._startTime=null,P&&(t.options.scrollWheelZoom==="center"?t.setZoom(o+P):t.setZoomAround(this._lastMousePos,o+P))}});ae.addInitHook("addHandler","scrollWheelZoom",Bs);var Bl=600;ae.mergeOptions({tapHold:_t.touchNative&&_t.safari&&_t.mobile,tapTolerance:15});var Zs=On.extend({addHooks:function(){jt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Oe(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var o=t.touches[0];this._startPos=this._newPos=new A(o.clientX,o.clientY),this._holdTimeout=setTimeout(u(function(){this._cancel(),this._isTapValid()&&(jt(document,"touchend",un),jt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",o))},this),Bl),jt(document,"touchend touchcancel contextmenu",this._cancel,this),jt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){Oe(document,"touchend",un),Oe(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),Oe(document,"touchend touchcancel contextmenu",this._cancel,this),Oe(document,"touchmove",this._onMove,this)},_onMove:function(t){var o=t.touches[0];this._newPos=new A(o.clientX,o.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,o){var a=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:o.screenX,screenY:o.screenY,clientX:o.clientX,clientY:o.clientY});a._simulated=!0,o.target.dispatchEvent(a)}});ae.addInitHook("addHandler","tapHold",Zs),ae.mergeOptions({touchZoom:_t.touch,bounceAtZoomLimits:!0});var Ds=On.extend({addHooks:function(){Ht(this._map._container,"leaflet-touch-zoom"),jt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ze(this._map._container,"leaflet-touch-zoom"),Oe(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var o=this._map;if(!(!t.touches||t.touches.length!==2||o._animatingZoom||this._zooming)){var a=o.mouseEventToContainerPoint(t.touches[0]),c=o.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=o.getSize()._divideBy(2),this._startLatLng=o.containerPointToLatLng(this._centerPoint),o.options.touchZoom!=="center"&&(this._pinchStartLatLng=o.containerPointToLatLng(a.add(c)._divideBy(2))),this._startDist=a.distanceTo(c),this._startZoom=o.getZoom(),this._moved=!1,this._zooming=!0,o._stop(),jt(document,"touchmove",this._onTouchMove,this),jt(document,"touchend touchcancel",this._onTouchEnd,this),un(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var o=this._map,a=o.mouseEventToContainerPoint(t.touches[0]),c=o.mouseEventToContainerPoint(t.touches[1]),d=a.distanceTo(c)/this._startDist;if(this._zoom=o.getScaleZoom(d,this._startZoom),!o.options.bounceAtZoomLimits&&(this._zoom<o.getMinZoom()&&d<1||this._zoom>o.getMaxZoom()&&d>1)&&(this._zoom=o._limitZoom(this._zoom)),o.options.touchZoom==="center"){if(this._center=this._startLatLng,d===1)return}else{var g=a._add(c)._divideBy(2)._subtract(this._centerPoint);if(d===1&&g.x===0&&g.y===0)return;this._center=o.unproject(o.project(this._pinchStartLatLng,this._zoom).subtract(g),this._zoom)}this._moved||(o._moveStart(!0,!1),this._moved=!0),G(this._animRequest);var P=u(o._move,o,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=Q(P,this,!0),un(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,G(this._animRequest),Oe(document,"touchmove",this._onTouchMove,this),Oe(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});ae.addInitHook("addHandler","touchZoom",Ds),ae.BoxZoom=Ns,ae.DoubleClickZoom=Is,ae.Drag=Os,ae.Keyboard=xs,ae.ScrollWheelZoom=Bs,ae.TapHold=Zs,ae.TouchZoom=Ds,i.Bounds=yt,i.Browser=_t,i.CRS=F,i.Canvas=Ts,i.Circle=No,i.CircleMarker=Yi,i.Class=X,i.Control=Mn,i.DivIcon=Cs,i.DivOverlay=xn,i.DomEvent=tl,i.DomUtil=Qa,i.Draggable=Yn,i.Evented=B,i.FeatureGroup=Hn,i.GeoJSON=Gn,i.GridLayer=Ti,i.Handler=On,i.Icon=ci,i.ImageOverlay=Qi,i.LatLng=W,i.LatLngBounds=dt,i.Layer=Tn,i.LayerGroup=ui,i.LineUtil=dl,i.Map=ae,i.Marker=Ui,i.Mixin=al,i.Path=qn,i.Point=A,i.PolyUtil=ll,i.Polygon=hi,i.Polyline=Fn,i.Popup=$i,i.PosAnimation=as,i.Projection=_l,i.Rectangle=As,i.Renderer=jn,i.SVG=zi,i.SVGOverlay=Ls,i.TileLayer=di,i.Tooltip=to,i.Transformation=Lt,i.Util=vt,i.VideoOverlay=Ps,i.bind=u,i.bounds=Pt,i.canvas=Es,i.circle=kl,i.circleMarker=bl,i.control=Ci,i.divIcon=Al,i.extend=r,i.featureGroup=vl,i.geoJSON=ks,i.geoJson=Cl,i.gridLayer=Nl,i.icon=yl,i.imageOverlay=Sl,i.latLng=H,i.latLngBounds=Z,i.layerGroup=pl,i.map=el,i.marker=wl,i.point=V,i.polygon=Ll,i.polyline=Pl,i.popup=El,i.rectangle=xl,i.setOptions=C,i.stamp=h,i.svg=zs,i.svgOverlay=Tl,i.tileLayer=Ss,i.tooltip=zl,i.transformation=St,i.version=s,i.videoOverlay=Ml;var Zl=window.L;i.noConflict=function(){return window.L=Zl,this},window.L=i})})(Qo,Qo.exports);var Xn=Qo.exports;const{Map:Hi}=Vl;function ma(n,e,i){const s=n.slice();return s[70]=e[i],s[72]=i,s}function ga(n,e,i){const s=n.slice();return s[73]=e[i],s}function pa(n,e,i){const s=n.slice();return s[73]=e[i],s}function Uo(n){const e=n.slice(),i=e[33](e[73].source);e[78]=i;const s=e[33](e[73].target);return e[79]=s,e}function va(n,e,i){const s=n.slice();return s[80]=e[i],s[81]=e,s[82]=i,s}function ya(n,e,i){const s=n.slice();return s[79]=e[i],s}function wa(n,e,i){const s=n.slice();return s[73]=e[i],s}function Nf(n){let e=[],i=new Hi,s,r=Ee(n[2]);const l=u=>u[73].id;for(let u=0;u<r.length;u+=1){let f=wa(n,r,u),h=l(f);i.set(h,e[u]=ba(h,f))}return{c(){for(let u=0;u<e.length;u+=1)e[u].c();s=pe()},m(u,f){for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(u,f);lt(u,s,f)},p(u,f){f[0]&524292&&(r=Ee(u[2]),e=Un(e,f,l,1,u,r,i,s.parentNode,fo,ba,s,wa))},d(u){u&&rt(s);for(let f=0;f<e.length;f+=1)e[f].d(u)}}}function If(n){let e;return{c(){e=ot("div"),e.textContent="(none)",v(e,"class","muted small txt svelte-12uwe6i")},m(i,s){lt(i,e,s)},p:Ot,d(i){i&&rt(e)}}}function ba(n,e){let i,s=e[73].source+"",r,l,u=e[73].target+"",f,h,_,m,p,w;function b(){return e[38](e[73])}return{key:n,first:null,c(){i=ot("span"),r=je(s),l=je("→"),f=je(u),h=pt(),_=ot("button"),_.textContent="×",m=pt(),v(_,"class","pill-x svelte-12uwe6i"),v(_,"aria-label","Remove edge"),v(i,"class","edge-pill svelte-12uwe6i"),v(i,"title","Click × to remove"),this.first=i},m(k,C){lt(k,i,C),S(i,r),S(i,l),S(i,f),S(i,h),S(i,_),S(i,m),p||(w=Ct(_,"click",b),p=!0)},p(k,C){e=k,C[0]&4&&s!==(s=e[73].source+"")&&bn(r,s),C[0]&4&&u!==(u=e[73].target+"")&&bn(f,u)},d(k){k&&rt(i),p=!1,w()}}}function ka(n){let e,i,s,r,l,u,f,h,_,m;return{c(){e=ot("div"),i=ot("span"),s=je("connecting from "),r=ot("code"),l=je(n[4]),u=je(" — click a node’s ◀ to finish"),f=pt(),h=ot("button"),h.textContent="cancel",v(i,"class","txt svelte-12uwe6i"),v(h,"class","pill-x svelte-12uwe6i"),v(e,"class","pending small svelte-12uwe6i")},m(p,w){lt(p,e,w),S(e,i),S(i,s),S(i,r),S(r,l),S(i,u),S(e,f),S(e,h),_||(m=Ct(h,"click",n[25]),_=!0)},p(p,w){w[0]&16&&bn(l,p[4])},d(p){p&&rt(e),_=!1,m()}}}function Pa(n){let e,i=n[79].name+"",s,r;return{c(){e=ot("option"),s=je(i),e.__value=r=n[79].name,yi(e,e.__value)},m(l,u){lt(l,e,u),S(e,s)},p(l,u){u[0]&32&&i!==(i=l[79].name+"")&&bn(s,i),u[0]&32&&r!==(r=l[79].name)&&(e.__value=r,yi(e,e.__value))},d(l){l&&rt(e)}}}function Of(n){let e,i,s=n[80].label+"",r,l,u,f,h,_,m,p,w,b,k,C,M,E,T,I,q,j,Y;function at(){return n[39](n[80])}function ct(){return n[40](n[80])}function st(){return n[41](n[80])}let nt=Ee(n[5]),Q=[];for(let J=0;J<nt.length;J+=1)Q[J]=Pa(ya(n,nt,J));function G(){n[42].call(k,n[82])}function vt(){return n[43](n[82],n[80])}function X(){return n[44](n[80])}function $(){return n[45](n[80],n[82])}return{c(){e=ot("div"),i=ot("div"),r=je(s),l=pt(),u=ot("button"),f=pt(),h=ot("button"),m=pt(),p=ot("button"),p.textContent="🗑",w=pt(),b=ot("div"),k=ot("select");for(let J=0;J<Q.length;J+=1)Q[J].c();C=pt(),M=ot("button"),M.textContent="📝",E=pt(),T=ot("button"),T.textContent="👁",q=pt(),v(i,"class","node-title svelte-12uwe6i"),v(u,"class","dot in svelte-12uwe6i"),v(u,"title","input"),v(h,"class","dot out svelte-12uwe6i"),v(h,"title","output"),v(h,"aria-pressed",_=n[4]===n[80].id),v(p,"class","node-del svelte-12uwe6i"),v(p,"title","delete node"),v(k,"class","svelte-12uwe6i"),n[1][n[82]].type===void 0&&Di(G),v(M,"class","edit-btn svelte-12uwe6i"),v(T,"class","preview-btn svelte-12uwe6i"),v(T,"title","Preview on map"),v(b,"class","node-config svelte-12uwe6i"),v(e,"class","node svelte-12uwe6i"),v(e,"aria-selected",I=n[83]?"true":"false")},m(J,B){lt(J,e,B),S(e,i),S(i,r),S(e,l),S(e,u),S(e,f),S(e,h),S(e,m),S(e,p),S(e,w),S(e,b),S(b,k);for(let A=0;A<Q.length;A+=1)Q[A]&&Q[A].m(k,null);js(k,n[1][n[82]].type,!0),S(b,C),S(b,M),S(b,E),S(b,T),lt(J,q,B),j||(Y=[Ct(u,"click",at),Ct(h,"click",ct),Ct(p,"click",st),Ct(k,"change",G),Ct(k,"change",vt),Ct(M,"click",X),Ct(T,"click",$),Vn(n[84].call(null,e))],j=!0)},p(J,B){if(n=J,B[0]&2&&s!==(s=n[80].label+"")&&bn(r,s),B[0]&50&&_!==(_=n[4]===n[80].id)&&v(h,"aria-pressed",_),B[0]&32){nt=Ee(n[5]);let A;for(A=0;A<nt.length;A+=1){const Nt=ya(n,nt,A);Q[A]?Q[A].p(Nt,B):(Q[A]=Pa(Nt),Q[A].c(),Q[A].m(k,null))}for(;A<Q.length;A+=1)Q[A].d(1);Q.length=nt.length}B[0]&34&&js(k,n[1][n[82]].type),B[2]&2097152&&I!==(I=n[83]?"true":"false")&&v(e,"aria-selected",I)},d(J){J&&(rt(e),rt(q)),Bi(Q,J),j=!1,tn(Y)}}}function La(n,e){let i,s,r,l;function u(h){e[46](h,e[82])}let f={id:e[80].id,width:Ka,height:Ja,$$slots:{default:[Of,({selected:h,grabHandle:_})=>({83:h,84:_}),({selected:h,grabHandle:_})=>[0,0,(h?2097152:0)|(_?4194304:0)]]},$$scope:{ctx:e}};return e[1][e[82]].position!==void 0&&(f.position=e[1][e[82]].position),s=new es({props:f}),Cn.push(()=>su(s,"position",u)),{key:n,first:null,c(){i=pe(),Qt(s.$$.fragment),this.first=i},m(h,_){lt(h,i,_),Vt(s,h,_),l=!0},p(h,_){e=h;const m={};_[0]&2&&(m.id=e[80].id),_[0]&196666|_[2]&136314880&&(m.$$scope={dirty:_,ctx:e}),!r&&_[0]&2&&(r=!0,m.position=e[1][e[82]].position,nu(()=>r=!1)),s.$set(m)},i(h){l||(N(s.$$.fragment,h),l=!0)},o(h){R(s.$$.fragment,h),l=!1},d(h){h&&rt(i),Kt(s,h)}}}function Ca(n){let e,i;return{c(){e=ee("path"),v(e,"d",i=`M ${n[27](n[78])} ${n[28](n[78])}
7
+ C ${n[27](n[78])+60} ${n[28](n[78])},
8
+ ${n[26](n[79])-60} ${n[28](n[79])},
9
+ ${n[26](n[79])} ${n[28](n[79])}`),v(e,"class","cable svelte-12uwe6i"),v(e,"marker-end","url(#arrow)")},m(s,r){lt(s,e,r)},p(s,r){r[0]&4&&i!==(i=`M ${s[27](s[78])} ${s[28](s[78])}
10
+ C ${s[27](s[78])+60} ${s[28](s[78])},
11
+ ${s[26](s[79])-60} ${s[28](s[79])},
12
+ ${s[26](s[79])} ${s[28](s[79])}`)&&v(e,"d",i)},d(s){s&&rt(e)}}}function Sa(n,e){let i,s=e[18](e[73].source)&&e[18](e[73].target),r,l=s&&Ca(Uo(e));return{key:n,first:null,c(){i=pe(),l&&l.c(),r=pe(),this.first=i},m(u,f){lt(u,i,f),l&&l.m(u,f),lt(u,r,f)},p(u,f){e=u,f[0]&4&&(s=e[18](e[73].source)&&e[18](e[73].target)),s?l?l.p(Uo(e),f):(l=Ca(Uo(e)),l.c(),l.m(r.parentNode,r)):l&&(l.d(1),l=null)},d(u){u&&(rt(i),rt(r)),l&&l.d(u)}}}function Ma(n,e){let i,s=[],r=new Hi,l,u=Ee(e[2]);const f=h=>h[73].id;for(let h=0;h<u.length;h+=1){let _=pa(e,u,h),m=f(_);r.set(m,s[h]=Sa(m,_))}return{key:n,first:null,c(){i=pe();for(let h=0;h<s.length;h+=1)s[h].c();l=pe(),this.first=i},m(h,_){lt(h,i,_);for(let m=0;m<s.length;m+=1)s[m]&&s[m].m(h,_);lt(h,l,_)},p(h,_){e=h,_[0]&470024196|_[1]&4&&(u=Ee(e[2]),s=Un(s,_,f,1,e,u,r,l.parentNode,fo,Sa,l,pa))},d(h){h&&(rt(i),rt(l));for(let _=0;_<s.length;_+=1)s[_].d(h)}}}function Ta(n){let e,i,s,r=[],l=new Hi,u,f=Ee(n[2]);const h=_=>_[73].id;for(let _=0;_<f.length;_+=1){let m=ga(n,f,_),p=h(m);l.set(p,r[_]=Ma(p,m))}return{c(){e=ee("defs"),i=ee("marker"),s=ee("path");for(let _=0;_<r.length;_+=1)r[_].c();u=pe(),v(s,"d","M 0 0 L 10 5 L 0 10 z"),v(i,"id","arrow"),v(i,"viewBox","0 0 10 10"),v(i,"refX","9"),v(i,"refY","5"),v(i,"markerWidth","6"),v(i,"markerHeight","6"),v(i,"orient","auto-start-reverse")},m(_,m){lt(_,e,m),S(e,i),S(i,s);for(let p=0;p<r.length;p+=1)r[p]&&r[p].m(_,m);lt(_,u,m)},p(_,m){m[0]&470024196|m[1]&4&&(f=Ee(_[2]),r=Un(r,m,h,1,_,f,l,u.parentNode,fo,Ma,u,ga))},d(_){_&&(rt(e),rt(u));for(let m=0;m<r.length;m+=1)r[m].d(_)}}}function xf(n){let e=[],i=new Hi,s,r,l=n[10],u,f,h=Ee(n[1]);const _=p=>p[80].id;for(let p=0;p<h.length;p+=1){let w=va(n,h,p),b=_(w);i.set(b,e[p]=La(b,w))}let m=Ta(n);return{c(){for(let p=0;p<e.length;p+=1)e[p].c();s=pt(),r=ee("svg"),m.c(),v(r,"class","edges-overlay svelte-12uwe6i"),v(r,"viewBox",u=`0 0 ${n[12]} ${n[13]}`),v(r,"preserveAspectRatio","none")},m(p,w){for(let b=0;b<e.length;b+=1)e[b]&&e[b].m(p,w);lt(p,s,w),lt(p,r,w),m.m(r,null),f=!0},p(p,w){w[0]&26411066|w[1]&1|w[2]&2097152&&(h=Ee(p[1]),le(),e=Un(e,w,_,1,p,h,i,s.parentNode,Ri,La,s,va),ue()),w[0]&1024&&Ye(l,l=p[10])?(m.d(1),m=Ta(p),m.c(),m.m(r,null)):m.p(p,w),(!f||w[0]&12288&&u!==(u=`0 0 ${p[12]} ${p[13]}`))&&v(r,"viewBox",u)},i(p){if(!f){for(let w=0;w<h.length;w+=1)N(e[w]);f=!0}},o(p){for(let w=0;w<e.length;w+=1)R(e[w]);f=!1},d(p){p&&(rt(s),rt(r));for(let w=0;w<e.length;w+=1)e[w].d(p);m.d(p)}}}function Ea(n){let e,i,s,r,l,u=n[16].label+"",f,h,_=n[16].type+"",m,p,w,b,k,C,M,E,T,I,q;return{c(){e=ot("div"),i=pt(),s=ot("div"),r=ot("h3"),l=je("Edit Args for "),f=je(u),h=je(" ("),m=je(_),p=je(")"),w=pt(),b=ot("textarea"),k=pt(),C=ot("div"),M=ot("button"),M.textContent="Save",E=pt(),T=ot("button"),T.textContent="Cancel",v(e,"class","modal-backdrop svelte-12uwe6i"),v(b,"class","svelte-12uwe6i"),v(M,"class","svelte-12uwe6i"),v(T,"class","svelte-12uwe6i"),v(C,"class","modal-actions svelte-12uwe6i"),v(s,"class","modal svelte-12uwe6i")},m(j,Y){lt(j,e,Y),lt(j,i,Y),lt(j,s,Y),S(s,r),S(r,l),S(r,f),S(r,h),S(r,m),S(r,p),S(s,w),S(s,b),yi(b,n[17]),S(s,k),S(s,C),S(C,M),S(C,E),S(C,T),I||(q=[Ct(e,"click",n[50]),Ct(b,"input",n[51]),Ct(M,"click",n[52]),Ct(T,"click",n[53]),Ct(s,"click",En(n[34]))],I=!0)},p(j,Y){Y[0]&65536&&u!==(u=j[16].label+"")&&bn(f,u),Y[0]&65536&&_!==(_=j[16].type+"")&&bn(m,_),Y[0]&131072&&yi(b,j[17])},d(j){j&&(rt(e),rt(i),rt(s)),I=!1,tn(q)}}}function Bf(n){let e,i=[],s=new Hi,r=Ee(n[6]);const l=u=>u[72];for(let u=0;u<r.length;u+=1){let f=ma(n,r,u),h=l(f);s.set(h,i[u]=za(h,f))}return{c(){e=ot("ul");for(let u=0;u<i.length;u+=1)i[u].c();v(e,"class","svelte-12uwe6i")},m(u,f){lt(u,e,f);for(let h=0;h<i.length;h+=1)i[h]&&i[h].m(e,null)},p(u,f){f[0]&64&&(r=Ee(u[6]),i=Un(i,f,l,1,u,r,s,e,fo,za,null,ma))},d(u){u&&rt(e);for(let f=0;f<i.length;f+=1)i[f].d()}}}function Zf(n){let e;return{c(){e=ot("div"),e.textContent="No logs yet. Run the pipeline to see Python prints/stdout.",v(e,"class","muted small svelte-12uwe6i")},m(i,s){lt(i,e,s)},p:Ot,d(i){i&&rt(e)}}}function za(n,e){let i,s,r=e[70].nodeId+"",l,u,f=e[70].text+"",h,_,m;return{key:n,first:null,c(){i=ot("li"),s=ot("code"),l=je(r),u=je(" — "),h=je(f),_=pt(),v(s,"class","svelte-12uwe6i"),v(i,"class",m=Gs(e[70].ok?"ok":"err")+" svelte-12uwe6i"),this.first=i},m(p,w){lt(p,i,w),S(i,s),S(s,l),S(i,u),S(i,h),S(i,_)},p(p,w){e=p,w[0]&64&&r!==(r=e[70].nodeId+"")&&bn(l,r),w[0]&64&&f!==(f=e[70].text+"")&&bn(h,f),w[0]&64&&m!==(m=Gs(e[70].ok?"ok":"err")+" svelte-12uwe6i")&&v(i,"class",m)},d(p){p&&rt(i)}}}function Df(n){let e,i,s,r,l,u,f,h,_,m,p,w,b,k,C,M,E,T,I,q,j,Y,at,ct,st,nt,Q,G,vt,X,$,J,B,A,Nt,V,yt,Pt=n[7]?"Running…":"Run",dt,Z,W,H,F,Gt,re,ht,Lt,St,xt,ne,ce,Se,K,he,Zt,Tt,Ut,we,Ne,We,Me,Ft,Ce,be,qe,ve,fe,ze,He,Xe,xe,Ie,D,it,Et,At,$t,ie,Qe,Te,Dt,ye,Yt,Rt,Ge,Ve;function fn(Bt,y){return Bt[2].length===0?If:Nf}let cn=fn(n),Ke=cn(n),oe=n[4]&&ka(n);be=new zf({props:{width:n[12],height:n[13],theme:n[0],$$slots:{default:[xf]},$$scope:{ctx:n}}});let _t=n[16]&&Ea(n);function an(Bt,y){return Bt[6].length===0?Zf:Bf}let hn=an(n),Be=hn(n);return{c(){e=ot("div"),i=ot("header"),s=ot("button"),s.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><path d="M3 6h18M3 12h18M3 18h18" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>',r=pt(),l=ot("div"),l.innerHTML='<span class="title svelte-12uwe6i">SATERYS</span>',u=pt(),f=ot("div"),h=ot("button"),_=ee("svg"),m=ee("path"),p=pt(),w=ot("span"),w.textContent="Run",k=pt(),C=ot("button"),C.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18"><path d="M4 5h16a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V7a2 2 0 012-2zm2 4l3 3-3 3m5 0h5" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg> <span class="btn-label svelte-12uwe6i">Logs</span>',M=pt(),E=ot("button"),T=ee("svg"),I=ee("path"),q=pt(),j=ot("span"),j.textContent="Layers",Y=pt(),at=ot("button"),at.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z" stroke="currentColor" stroke-width="2" fill="none"></path></svg> <span class="btn-label svelte-12uwe6i">Theme</span>',ct=pt(),st=ot("div"),nt=ot("aside"),Q=ot("div"),G=ot("div"),G.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16"><path d="M5 12h14M12 5v14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg> <span class="txt svelte-12uwe6i">Tools</span>',vt=pt(),X=ot("div"),$=ot("button"),$.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16"><path d="M12 5v14M5 12h14" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg> <span class="txt svelte-12uwe6i">Add Node</span>',J=pt(),B=ot("button"),A=ee("svg"),Nt=ee("path"),V=pt(),yt=ot("span"),dt=je(Pt),Z=pt(),W=ot("button"),H=ee("svg"),F=ee("path"),Gt=pt(),re=ot("span"),re.textContent="Clear Layers",ht=pt(),Lt=ot("button"),St=ee("svg"),xt=ee("path"),ne=pt(),ce=ot("span"),Se=je("Theme: "),K=je(n[0]),he=pt(),Zt=ot("div"),Tt=ot("div"),Tt.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16"><path d="M3 12l7-7 4 4 7-7" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg> <span class="txt svelte-12uwe6i">Edges</span>',Ut=pt(),we=ot("div"),Ke.c(),Ne=pt(),oe&&oe.c(),Me=pt(),Ft=ot("div"),Ce=ot("div"),Qt(be.$$.fragment),qe=pt(),ve=ot("div"),fe=ot("div"),He=pt(),_t&&_t.c(),Xe=pt(),xe=ot("div"),Ie=ot("div"),D=ot("div"),D.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16"><path d="M4 5h16a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V7a2 2 0 012-2zm2 4l3 3-3 3m5 0h5" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg> <span>Pipeline Logs</span>',it=pt(),Et=ot("div"),At=ot("button"),At.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16"><path d="M9 9h11v11H9zM5 5h11v11" stroke="currentColor" stroke-width="2" fill="none"></path></svg>',$t=pt(),ie=ot("button"),ie.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16"><path d="M3 6h18M9 6v12m6-12v12M5 6l1-3h12l1 3" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>',Qe=pt(),Te=ot("button"),Te.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16"><path d="M6 6l12 12M6 18L18 6" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></path></svg>',Dt=pt(),ye=ot("div"),Be.c(),v(s,"class","icon-btn svelte-12uwe6i"),v(s,"title","Toggle sidebar"),v(l,"class","brand svelte-12uwe6i"),v(m,"d","M8 5v14l11-7z"),v(m,"fill","currentColor"),v(_,"viewBox","0 0 24 24"),v(_,"width","18"),v(_,"height","18"),v(w,"class","btn-label svelte-12uwe6i"),v(h,"class","icon-btn svelte-12uwe6i"),v(h,"title",b=n[7]?"Running…":"Run pipeline"),h.disabled=n[7],v(C,"class","icon-btn svelte-12uwe6i"),v(C,"title","Toggle logs"),v(I,"d","M12 3l9 5-9 5-9-5 9-5zm0 8l9 5-9 5-9-5"),v(I,"stroke","currentColor"),v(I,"stroke-width","2"),v(I,"fill","none"),v(I,"stroke-linejoin","round"),v(T,"viewBox","0 0 24 24"),v(T,"width","18"),v(T,"height","18"),v(j,"class","btn-label svelte-12uwe6i"),v(E,"class","icon-btn svelte-12uwe6i"),v(E,"title","Clear map layers"),E.disabled=n[29].size===0,v(at,"class","icon-btn svelte-12uwe6i"),v(at,"title","Toggle theme"),v(f,"class","header-actions svelte-12uwe6i"),v(i,"class","app-header svelte-12uwe6i"),v(G,"class","section-title svelte-12uwe6i"),v($,"class","tool svelte-12uwe6i"),v($,"title","Add node"),v(Nt,"d","M8 5v14l11-7z"),v(Nt,"fill","currentColor"),v(A,"viewBox","0 0 24 24"),v(A,"width","16"),v(A,"height","16"),v(yt,"class","txt svelte-12uwe6i"),v(B,"class","tool svelte-12uwe6i"),B.disabled=n[7],v(B,"title","Run pipeline"),v(F,"d","M12 3l9 5-9 5-9-5 9-5zm0 8l9 5-9 5-9-5"),v(F,"stroke","currentColor"),v(F,"stroke-width","2"),v(F,"fill","none"),v(F,"stroke-linejoin","round"),v(H,"viewBox","0 0 24 24"),v(H,"width","16"),v(H,"height","16"),v(re,"class","txt svelte-12uwe6i"),v(W,"class","tool svelte-12uwe6i"),W.disabled=n[29].size===0,v(W,"title","Clear overlay layers"),v(xt,"d","M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"),v(xt,"stroke","currentColor"),v(xt,"stroke-width","2"),v(xt,"fill","none"),v(St,"viewBox","0 0 24 24"),v(St,"width","16"),v(St,"height","16"),v(ce,"class","txt svelte-12uwe6i"),v(Lt,"class","tool svelte-12uwe6i"),v(Lt,"title","Toggle theme"),v(X,"class","tool-list svelte-12uwe6i"),v(Q,"class","section"),v(Tt,"class","section-title svelte-12uwe6i"),v(we,"class","edge-chips svelte-12uwe6i"),v(Zt,"class","section"),v(nt,"class","sidebar svelte-12uwe6i"),v(nt,"data-collapsed",We=n[9]?"true":"false"),v(fe,"class","map svelte-12uwe6i"),v(ve,"class","right svelte-12uwe6i"),v(Ce,"class","split svelte-12uwe6i"),v(Ft,"class","work svelte-12uwe6i"),v(st,"class","main svelte-12uwe6i"),v(st,"data-collapsed",ze=n[9]?"true":"false"),v(D,"class","logs-title svelte-12uwe6i"),v(At,"class","icon-btn svelte-12uwe6i"),v(At,"title","Copy all"),v(ie,"class","icon-btn svelte-12uwe6i"),v(ie,"title","Clear"),v(Te,"class","icon-btn svelte-12uwe6i"),v(Te,"title","Close"),v(Et,"class","logs-actions svelte-12uwe6i"),v(Ie,"class","logs-header svelte-12uwe6i"),v(ye,"class","logs-body svelte-12uwe6i"),v(xe,"class","logs-drawer svelte-12uwe6i"),v(xe,"data-open",Yt=n[8]?"true":"false"),v(e,"class","app-root svelte-12uwe6i")},m(Bt,y){lt(Bt,e,y),S(e,i),S(i,s),S(i,r),S(i,l),S(i,u),S(i,f),S(f,h),S(h,_),S(_,m),S(h,p),S(h,w),S(f,k),S(f,C),S(f,M),S(f,E),S(E,T),S(T,I),S(E,q),S(E,j),S(f,Y),S(f,at),S(e,ct),S(e,st),S(st,nt),S(nt,Q),S(Q,G),S(Q,vt),S(Q,X),S(X,$),S(X,J),S(X,B),S(B,A),S(A,Nt),S(B,V),S(B,yt),S(yt,dt),S(X,Z),S(X,W),S(W,H),S(H,F),S(W,Gt),S(W,re),S(X,ht),S(X,Lt),S(Lt,St),S(St,xt),S(Lt,ne),S(Lt,ce),S(ce,Se),S(ce,K),S(nt,he),S(nt,Zt),S(Zt,Tt),S(Zt,Ut),S(Zt,we),Ke.m(we,null),S(Zt,Ne),oe&&oe.m(Zt,null),S(st,Me),S(st,Ft),S(Ft,Ce),Vt(be,Ce,null),S(Ce,qe),S(Ce,ve),S(ve,fe),n[47](fe),n[48](ve),n[49](Ce),S(e,He),_t&&_t.m(e,null),S(e,Xe),S(e,xe),S(xe,Ie),S(Ie,D),S(Ie,it),S(Ie,Et),S(Et,At),S(Et,$t),S(Et,ie),S(Et,Qe),S(Et,Te),S(xe,Dt),S(xe,ye),Be.m(ye,null),Rt=!0,Ge||(Ve=[Ct(s,"click",n[30]),Ct(h,"click",n[21]),Ct(C,"click",n[35]),Ct(E,"click",n[32]),Ct(at,"click",n[36]),Ct($,"click",n[22]),Ct(B,"click",n[21]),Ct(W,"click",n[32]),Ct(Lt,"click",n[37]),Ct(At,"click",n[54]),Ct(ie,"click",n[55]),Ct(Te,"click",n[56])],Ge=!0)},p(Bt,y){(!Rt||y[0]&128&&b!==(b=Bt[7]?"Running…":"Run pipeline"))&&v(h,"title",b),(!Rt||y[0]&128)&&(h.disabled=Bt[7]),(!Rt||y[0]&128)&&Pt!==(Pt=Bt[7]?"Running…":"Run")&&bn(dt,Pt),(!Rt||y[0]&128)&&(B.disabled=Bt[7]),(!Rt||y[0]&1)&&bn(K,Bt[0]),cn===(cn=fn(Bt))&&Ke?Ke.p(Bt,y):(Ke.d(1),Ke=cn(Bt),Ke&&(Ke.c(),Ke.m(we,null))),Bt[4]?oe?oe.p(Bt,y):(oe=ka(Bt),oe.c(),oe.m(Zt,null)):oe&&(oe.d(1),oe=null),(!Rt||y[0]&512&&We!==(We=Bt[9]?"true":"false"))&&v(nt,"data-collapsed",We);const ut={};y[0]&4096&&(ut.width=Bt[12]),y[0]&8192&&(ut.height=Bt[13]),y[0]&1&&(ut.theme=Bt[0]),y[0]&209982|y[2]&134217728&&(ut.$$scope={dirty:y,ctx:Bt}),be.$set(ut),(!Rt||y[0]&512&&ze!==(ze=Bt[9]?"true":"false"))&&v(st,"data-collapsed",ze),Bt[16]?_t?_t.p(Bt,y):(_t=Ea(Bt),_t.c(),_t.m(e,Xe)):_t&&(_t.d(1),_t=null),hn===(hn=an(Bt))&&Be?Be.p(Bt,y):(Be.d(1),Be=hn(Bt),Be&&(Be.c(),Be.m(ye,null))),(!Rt||y[0]&256&&Yt!==(Yt=Bt[8]?"true":"false"))&&v(xe,"data-open",Yt)},i(Bt){Rt||(N(be.$$.fragment,Bt),Rt=!0)},o(Bt){R(be.$$.fragment,Bt),Rt=!1},d(Bt){Bt&&rt(e),Ke.d(),oe&&oe.d(),Kt(be),n[47](null),n[48](null),n[49](null),_t&&_t.d(),Be.d(),Ge=!1,tn(Ve)}}}const Ka=230,Ja=80;function Rf(n,e){const i=n.map(h=>h.id),s=new Set(i),r=new Map,l=new Map;for(const h of i)r.set(h,[]),l.set(h,0);for(const h of e)!s.has(h.source)||!s.has(h.target)||(r.get(h.source).push(h.target),l.set(h.target,(l.get(h.target)||0)+1));const u=[];for(const h of i)(l.get(h)||0)===0&&u.push(h);const f=[];for(;u.length;){const h=u.shift();f.push(h);for(const _ of r.get(h))l.set(_,(l.get(_)||0)-1),(l.get(_)||0)===0&&u.push(_)}return f}async function Wf(n,e={}){return await(await fetch("/run_node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:n.id,type:n.type,args:n.args??{},inputs:e})})).json().catch(()=>({ok:!1,error:"Bad JSON"}))}function Hf(n,e,i){let s="dark",r=[{id:"n1",position:{x:120,y:140},label:"Hello",type:"hello",args:{name:"world"}},{id:"n2",position:{x:420,y:140},label:"Sum",type:"sum",args:{nums:[1,2,3]}},{id:"n3",position:{x:720,y:140},label:"Script",type:"script",args:{code:"print('hi')"}}],l=4,u=[],f=1,h=null,_={},m=[{name:"hello",default_args:{name:"world"}},{name:"sum",default_args:{nums:[1,2,3]}},{name:"script",default_args:{code:"print('hello')"}},{name:"raster.input",default_args:{path:""}}];zn(async()=>{try{const it=await(await fetch("/node_types")).json();Array.isArray(it==null?void 0:it.types)&&i(5,m=it.types)}catch{}});const p=D=>r.find(it=>it.id===D);function w(D,it){!p(D)||!p(it)||D===it||u.some(Et=>Et.source===D&&Et.target===it)||i(2,u=[...u,{id:`e${f++}`,source:D,target:it}])}function b(D){i(2,u=u.filter(it=>it.id!==D))}function k(D){if(yt.has(D)&&V&&Pt){const it=yt.get(D);V.removeLayer(it),Pt.removeLayer(it),yt.delete(D)}i(1,r=r.filter(it=>it.id!==D)),delete _[D]}function C(){const D=new Set;for(const $t of u)D.add($t.source),D.add($t.target);const it=r.filter($t=>D.has($t.id)),Et=new Set(it.map($t=>$t.id)),At=u.filter($t=>Et.has($t.source)&&Et.has($t.target));return{activeNodes:it,activeEdges:At}}let M=[],E=!1,T={},I=!1,q=!1;function j(D,it,Et){i(6,M=[...M,{nodeId:D,ok:it,text:Et}]),I&&requestAnimationFrame(()=>{const At=document.querySelector(".logs-body");At&&(At.scrollTop=At.scrollHeight)})}async function Y(){var $t;i(7,E=!0),i(6,M=[]),T={},i(8,I=!0);const{activeNodes:D,activeEdges:it}=C();if(D.length===0){j("system",!1,"No connected nodes to run."),i(7,E=!1);return}const Et=Rf(D,it);Et.length!==D.length&&j("system",!1,"Warning: cycle detected; running partial order.");const At={};for(const ie of it)(At[$t=ie.target]??(At[$t]=[])).push(ie.source);for(const ie of Et){const Qe=p(ie),Te={};for(const Dt of At[ie]??[])Te[Dt]=T[Dt];j(ie,!0,"▶ Running…");try{const Dt=await Wf(Qe,Te);if(Array.isArray(Dt==null?void 0:Dt.logs))for(const ye of Dt.logs)j(ie,!0,String(ye));if(typeof(Dt==null?void 0:Dt.stdout)=="string"&&Dt.stdout.trim())for(const ye of Dt.stdout.split(/\r?\n/))ye.trim()&&j(ie,!0,ye);if(Dt!=null&&Dt.ok){const ye=Dt.output??{};T[ie]=ye;const Yt=typeof ye=="string"?ye:ye.text??JSON.stringify(ye);j(ie,!0,`✅ ${Yt}`)}else j(ie,!1,`❌ ${(Dt==null?void 0:Dt.error)||"Unknown error"}`)}catch(Dt){j(ie,!1,`❌ Exception: ${(Dt==null?void 0:Dt.message)||Dt}`)}}i(7,E=!1)}function at(){const D=`n${l++}`,it=m[0]||{name:"hello",default_args:{name:D}},Et=120+r.length%6*260,At=140+Math.floor(r.length/6)*140,$t=JSON.parse(JSON.stringify(it.default_args||{}));i(1,r=[...r,{id:D,position:{x:Et,y:At},label:`Node ${D}`,type:it.name,args:$t}]),i(3,_[D]=JSON.stringify($t,null,2),_)}function ct(D){i(4,h=D)}function st(D){h&&w(h,D),i(4,h=null)}function nt(){i(4,h=null)}const Q=D=>D.position.x,G=D=>D.position.x+Ka,vt=D=>D.position.y+Ja/2;let X="",$=null,J=1200,B=650,A=null;function Nt(){$&&(A&&A.disconnect(),A=new ResizeObserver(()=>{$&&(i(12,J=Math.max(320,Math.floor($.clientWidth-1))),i(13,B=Math.max(240,Math.floor($.clientHeight-1))))}),A.observe($))}let V=null,yt=new Map,Pt=null,dt=null,Z=null,W=null;function H(){!V||!Z||(W&&W.disconnect(),W=new ResizeObserver(()=>{requestAnimationFrame(()=>V&&V.invalidateSize())}),W.observe(Z))}function F(){i(9,q=!q),requestAnimationFrame(()=>V==null?void 0:V.invalidateSize())}zn(()=>{let D=!1;const it=()=>V&&V.invalidateSize();return Promise.resolve().then(async()=>{if(await Ba(),!D&&(Nt(),!V&&dt)){V=Xn.map(dt,{zoomControl:!0,attributionControl:!1}).setView([0,0],2);const Et={OpenStreetMap:Xn.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{opacity:.8,minZoom:1,maxZoom:22,attribution:"© OpenStreetMap contributors"}),"OpenStreetMap (Dark)":Xn.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{opacity:.3,minZoom:1,maxZoom:22,attribution:"© OpenStreetMap contributors"}),"CartoDB Positron":Xn.tileLayer("https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",{opacity:.8,minZoom:1,maxZoom:22,attribution:"© OpenStreetMap contributors, © CartoDB"}),"CartoDB Dark":Xn.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{opacity:.8,minZoom:1,maxZoom:22,attribution:"© OpenStreetMap contributors, © CartoDB"}),OpenTopoMap:Xn.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",{opacity:.8,minZoom:1,maxZoom:17,attribution:"© OpenStreetMap contributors, © OpenTopoMap"})};Et["OpenStreetMap (Dark)"].addTo(V),Pt=Xn.control.layers(Et,{},{position:"topright",collapsed:!1}),Pt.addTo(V),H(),window.addEventListener("resize",it)}}),()=>{D=!0,window.removeEventListener("resize",it),W==null||W.disconnect(),A==null||A.disconnect()}});function Gt(D,it){var At;const Et=T[D.id];return Et&&typeof Et=="object"&&Et.type==="raster"&&Et.path?Et.path:D.type==="raster.input"&&typeof((At=r[it].args)==null?void 0:At.path)=="string"?r[it].args.path:null}async function re(D,it){if(!V||!Pt){alert("Map not ready yet.");return}const Et=Gt(D,it);if(!Et){alert("No raster path available. Run the pipeline or set args.path for raster.input.");return}const At=D.id;await fetch("/preview/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:At,path:Et})});const $t=`/preview/tile/${At}/{z}/{x}/{y}.png`,ie=`${D.label} (${D.id})`;if(yt.has(At)){const Ve=yt.get(At);V.removeLayer(Ve),Pt.removeLayer(Ve),yt.delete(At)}const Qe=Xn.tileLayer($t,{tms:!1,opacity:.8,maxZoom:22});yt.set(At,Qe),Qe.addTo(V),Pt.addOverlay(Qe,ie);const Te=await fetch(`/preview/bounds/${At}`).then(Ve=>Ve.json()),[Dt,ye,Yt,Rt]=Te.bounds,Ge=Xn.latLngBounds([ye,Dt],[Rt,Yt]);V.fitBounds(Ge,{padding:[10,10]})}function ht(){if(!(!V||!Pt)){for(const[,D]of yt)V.removeLayer(D),Pt.removeLayer(D);yt.clear()}}let Lt=null,St="";function xt(D){const it=r.find(Et=>Et.id===D);if(!it)throw new Error(`Node not found: ${D}`);return it}function ne(D){Re.call(this,n,D)}const ce=()=>i(8,I=!I),Se=()=>i(0,s=s==="dark"?"light":"dark"),K=()=>i(0,s=s==="dark"?"light":"dark"),he=D=>b(D.id),Zt=D=>st(D.id),Tt=D=>ct(D.id),Ut=D=>k(D.id);function we(D){r[D].type=Jl(this),i(1,r),i(5,m)}const Ne=(D,it)=>{const Et=m.find($t=>$t.name===r[D].type),At=(Et==null?void 0:Et.default_args)??{};i(1,r[D].args=JSON.parse(JSON.stringify(At)),r),i(3,_[it.id]=JSON.stringify(r[D].args,null,2),_)},We=D=>{i(16,Lt=D),i(17,St=_[D.id])},Me=(D,it)=>re(D,it);function Ft(D,it){n.$$.not_equal(r[it].position,D)&&(r[it].position=D,i(1,r))}function Ce(D){Cn[D?"unshift":"push"](()=>{dt=D,i(14,dt)})}function be(D){Cn[D?"unshift":"push"](()=>{Z=D,i(15,Z)})}function qe(D){Cn[D?"unshift":"push"](()=>{$=D,i(11,$)})}const ve=()=>i(16,Lt=null);function fe(){St=this.value,i(17,St)}const ze=()=>{if(Lt)try{const D=Lt;D.args=JSON.parse(St||"{}"),i(3,_[D.id]=JSON.stringify(D.args,null,2),_),i(16,Lt=null)}catch{alert("Invalid JSON")}},He=()=>i(16,Lt=null),Xe=()=>navigator.clipboard.writeText(M.map(D=>`[${D.nodeId}] ${D.ok?"OK":"ERR"} ${D.text}`).join(`
13
+ `)),xe=()=>i(6,M=[]),Ie=()=>i(8,I=!1);return n.$$.update=()=>{if(n.$$.dirty[0]&1&&document!=null&&document.body&&(document.body.dataset.theme=s),n.$$.dirty[0]&10){for(const D of r)if(_[D.id]===void 0)try{i(3,_[D.id]=JSON.stringify(D.args??{},null,2),_)}catch{i(3,_[D.id]="{}",_)}}if(n.$$.dirty[0]&6){const D=new Set(r.map(Et=>Et.id)),it=u.filter(Et=>D.has(Et.source)&&D.has(Et.target));it.length!==u.length&&i(2,u=it)}n.$$.dirty[0]&2&&i(10,X=r.map(D=>`${D.id}:${D.position.x},${D.position.y}`).join("|"))},[s,r,u,_,h,m,M,E,I,q,X,$,J,B,dt,Z,Lt,St,p,b,k,Y,at,ct,st,nt,Q,G,vt,yt,F,re,ht,xt,ne,ce,Se,K,he,Zt,Tt,Ut,we,Ne,We,Me,Ft,Ce,be,qe,ve,fe,ze,He,Xe,xe,Ie]}class Ff extends nn{constructor(e){super(),en(this,e,Hf,Df,Ye,{},null,[-1,-1,-1])}}new Ff({target:document.getElementById("app")});export{ho as $,Kt as A,Da as B,Ra as C,Vt as D,Qt as E,gt as F,tn as G,bn as H,En as I,je as J,Ho as K,de as L,me as M,ge as N,_e as O,Vs as P,vn as Q,Wu as R,nn as S,yi as T,jf as U,js as V,wn as W,Di as X,Jl as Y,U as Z,Cn as _,et as a,lo as a0,ee as a1,Zn as a2,fo as a3,lt as b,v as c,rt as d,ot as e,ft as f,Je as g,Ee as h,en as i,R as j,N as k,Ct as l,le as m,Ot as n,zn as o,Ri as p,ue as q,S as r,Ye as s,Xt as t,Un as u,pt as v,te as w,_o as x,pe as y,$o as z};