@doc-karta/karta 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dev-server.js +133 -0
- package/bin/karta.js +252 -0
- package/bin/postinstall.js +14 -0
- package/bin/resolve-core.js +54 -0
- package/dist/assets/main-C5ap-Sga.css +1 -0
- package/dist/assets/main-yfGoj78b.js +24 -0
- package/dist/assets/preview-Di0VEohf.js +1 -0
- package/dist/assets/styles-C6S5xD8i.js +51 -0
- package/dist/assets/styles-brCeFTVr.css +1 -0
- package/dist/index.html +15 -0
- package/dist/preview.html +14 -0
- package/dist/registry.json +5 -0
- package/package.json +52 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{r as L,j as _,R as At,a as xa,g as fd,b as hd,i as bt,T as ya,c as To,d as gd,u as Ao,s as pd,e as md,f as Pn,h as wa,k as xd,l as yd,m as wd,n as vd,Q as bd,o as _d,p as Sd,q as Ed}from"./styles-C6S5xD8i.js";var Jt=typeof window<"u"?L.useLayoutEffect:L.useEffect;function zr(e){const t=L.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function kd(e,t,n={},r={}){L.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([i])=>{t(i)},n);return o.observe(e.current),()=>{o.disconnect()}},[t,n,r.disabled,e])}function Cd(e){const t=L.useRef(null);return L.useImperativeHandle(e,()=>t.current,[]),t}const va=!1;function sn(e){return e[e.length-1]}function Pd(e){return typeof e=="function"}function at(e,t){return Pd(e)?e(t):e}const ba=Object.prototype.hasOwnProperty,bi=Object.prototype.propertyIsEnumerable;function _a(e){for(const t in e)if(ba.call(e,t))return!0;return!1}const Md=()=>Object.create(null),ot=(e,t)=>ct(e,t,Md);function ct(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const o=t,i=Ei(e)&&Ei(o);if(!i&&!(Zn(e)&&Zn(o)))return o;const s=i?e:_i(e);if(!s)return o;const a=i?o:_i(o);if(!a)return o;const c=s.length,l=a.length,d=i?new Array(l):n();let u=0;for(let f=0;f<l;f++){const h=i?f:a[f],g=e[h],m=o[h];if(g===m){d[h]=g,(i?f<c:ba.call(e,h))&&u++;continue}if(g===null||m===null||typeof g!="object"||typeof m!="object"){d[h]=m;continue}const p=ct(g,m,n,r+1);d[h]=p,p===g&&u++}return c===l&&u===c?e:d}function _i(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!bi.call(e,o))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const r=t;for(const o of n){if(!bi.call(e,o))return!1;r.push(o)}return r}function Zn(e){if(!Si(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Si(n)||!n.hasOwnProperty("isPrototypeOf"))}function Si(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ei(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function dt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,o=e.length;r<o;r++)if(!dt(e[r],t[r],n))return!1;return!0}if(Zn(e)&&Zn(t)){const r=(n==null?void 0:n.ignoreUndefined)??!0;if(n!=null&&n.partial){for(const s in t)if((!r||t[s]!==void 0)&&!dt(e[s],t[s],n))return!1;return!0}let o=0;if(!r)o=Object.keys(e).length;else for(const s in e)e[s]!==void 0&&o++;let i=0;for(const s in t)if((!r||t[s]!==void 0)&&(i++,i>o||!dt(e[s],t[s],n)))return!1;return o===i}return!1}function jt(e){let t,n;const r=new Promise((o,i)=>{t=o,n=i});return r.status="pending",r.resolve=o=>{r.status="resolved",r.value=o,t(o),e==null||e(o)},r.reject=o=>{r.status="rejected",n(o)},r}function an(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Nd(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function ki(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Nd(t)}const Id=["http:","https:","mailto:","tel:"];function Qn(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Gt(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",o;for(;(o=t.exec(e))!==null;)r+=ki(e.slice(n,o.index))+o[0],n=t.lastIndex;r=r+ki(n?e.slice(n):e);let i=!1;return r.startsWith("//")&&(i=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:i}}function Rd(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ld(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function We(){throw new Error("Invariant failed")}function cn(e){const t=new Map;let n,r;const o=i=>{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,n=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const s=t.get(i);if(s)return o(s),s.value},set(i,s){if(t.size>=e&&n){const c=n;t.delete(c.key),c.next&&(n=c.next,c.next.prev=void 0),c===r&&(r=void 0)}const a=t.get(i);if(a)a.value=s,o(a);else{const c={key:i,value:s,prev:r};r&&(r.next=c),r=c,n||(n=c),t.set(i,c)}},clear(){t.clear(),n=void 0,r=void 0}}}const et=4,Sa=5;function Td(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function Ea(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),o=r===-1?e.length:r,i=e.substring(t,o);if(!i||!i.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n;if(i==="$"){const a=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=a,n[4]=a,n[5]=a,n}if(i.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=o,n[4]=o,n[5]=o,n;const s=Td(i);if(s){const[a,c]=s,l=i.charCodeAt(a+1);if(l===45){if(a+2<i.length&&i.charCodeAt(a+2)===36){const d=a+3,u=c;if(d<u)return n[0]=3,n[1]=t+a,n[2]=t+d,n[3]=t+u,n[4]=t+c+1,n[5]=o,n}}else if(l===36){const d=a+1,u=a+2;return u===c?(n[0]=2,n[1]=t+a,n[2]=t+d,n[3]=t+u,n[4]=t+c+1,n[5]=e.length,n):(n[0]=1,n[1]=t+a,n[2]=t+u,n[3]=t+c,n[4]=t+c+1,n[5]=o,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}function mr(e,t,n,r,o,i,s){var c,l,d,u,f,h,g,m,p,x;s==null||s(n);let a=r;{const v=n.fullPath??n.from,y=v.length,w=((c=n.options)==null?void 0:c.caseSensitive)??e,E=((d=(l=n.options)==null?void 0:l.params)==null?void 0:d.parse)??((u=n.options)==null?void 0:u.parseParams);for(;a<y;){const S=Ea(v,a,t);let P;const M=a,A=S[5];switch(a=A+1,i++,S[0]){case 0:{const C=v.substring(S[2],S[3]);if(w){const R=(f=o.static)==null?void 0:f.get(C);if(R)P=R;else{o.static??(o.static=new Map);const j=lt(n.fullPath??n.from);j.parent=o,j.depth=i,P=j,o.static.set(C,j)}}else{const R=C.toLowerCase(),j=(h=o.staticInsensitive)==null?void 0:h.get(R);if(j)P=j;else{o.staticInsensitive??(o.staticInsensitive=new Map);const b=lt(n.fullPath??n.from);b.parent=o,b.depth=i,P=b,o.staticInsensitive.set(R,b)}}break}case 1:{const C=v.substring(M,S[1]),R=v.substring(S[4],A),j=w&&!!(C||R),b=C?j?C:C.toLowerCase():void 0,T=R?j?R:R.toLowerCase():void 0,N=!E&&((g=o.dynamic)==null?void 0:g.find(I=>!I.parse&&I.caseSensitive===j&&I.prefix===b&&I.suffix===T));if(N)P=N;else{const I=Dr(1,n.fullPath??n.from,j,b,T);P=I,I.depth=i,I.parent=o,o.dynamic??(o.dynamic=[]),o.dynamic.push(I)}break}case 3:{const C=v.substring(M,S[1]),R=v.substring(S[4],A),j=w&&!!(C||R),b=C?j?C:C.toLowerCase():void 0,T=R?j?R:R.toLowerCase():void 0,N=!E&&((m=o.optional)==null?void 0:m.find(I=>!I.parse&&I.caseSensitive===j&&I.prefix===b&&I.suffix===T));if(N)P=N;else{const I=Dr(3,n.fullPath??n.from,j,b,T);P=I,I.parent=o,I.depth=i,o.optional??(o.optional=[]),o.optional.push(I)}break}case 2:{const C=v.substring(M,S[1]),R=v.substring(S[4],A),j=w&&!!(C||R),b=C?j?C:C.toLowerCase():void 0,T=R?j?R:R.toLowerCase():void 0,N=Dr(2,n.fullPath??n.from,j,b,T);P=N,N.parent=o,N.depth=i,o.wildcard??(o.wildcard=[]),o.wildcard.push(N)}}o=P}if(E&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const S=lt(n.fullPath??n.from);S.kind=Sa,S.parent=o,i++,S.depth=i,o.pathless??(o.pathless=[]),o.pathless.push(S),o=S}const k=(n.path||!n.children)&&!n.isRoot;if(k&&v.endsWith("/")){const S=lt(n.fullPath??n.from);S.kind=et,S.parent=o,i++,S.depth=i,o.index=S,o=S}o.parse=E??null,o.priority=((x=(p=n.options)==null?void 0:p.params)==null?void 0:x.priority)??0,k&&!o.route&&(o.route=n,o.fullPath=n.fullPath??n.from)}if(n.children)for(const v of n.children)mr(e,t,v,a,o,i,s)}function $r(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Qe(e){var t,n,r;if(e.pathless)for(const o of e.pathless)Qe(o);if(e.static)for(const o of e.static.values())Qe(o);if(e.staticInsensitive)for(const o of e.staticInsensitive.values())Qe(o);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort($r);for(const o of e.dynamic)Qe(o)}if((n=e.optional)!=null&&n.length){e.optional.sort($r);for(const o of e.optional)Qe(o)}if((r=e.wildcard)!=null&&r.length){e.wildcard.sort($r);for(const o of e.wildcard)Qe(o)}}function lt(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Dr(e,t,n,r,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:o}}function Ad(e,t){const n=lt("/"),r=new Uint16Array(6);for(const o of e)mr(!1,r,o,1,n,0);Qe(n),t.masksTree=n,t.flatCache=cn(1e3)}function jd(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const r=jo(e,t.masksTree);return t.flatCache.set(e,r),r}function zd(e,t,n,r,o){e||(e="/"),r||(r="/");const i=t?`case\0${e}`:e;let s=o.singleCache.get(i);return s||(s=lt("/"),mr(t,new Uint16Array(6),{from:e},1,s,0),o.singleCache.set(i,s)),jo(r,s,n)}function $d(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,o=t.matchCache.get(r);if(o!==void 0)return o;e||(e="/");let i;try{i=jo(e,t.segmentTree,n)}catch(s){if(s instanceof URIError)i=null;else throw s}return i&&(i.branch=Ca(i.route)),t.matchCache.set(r,i),i}function Dd(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Bd(e,t=!1,n){const r=lt(e.fullPath),o=new Uint16Array(6),i={},s={};let a=0;return mr(t,o,e,1,r,0,c=>{if(n==null||n(c,a),c.id in i&&We(),i[c.id]=c,a!==0&&c.path){const l=Dd(c.fullPath);(!s[l]||c.fullPath.endsWith("/"))&&(s[l]=c)}a++}),Qe(r),{processedTree:{segmentTree:r,singleCache:cn(1e3),matchCache:cn(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:s}}function jo(e,t,n=!1){const r=e.split("/"),o=Fd(e,r,t,n);if(!o)return null;const[i]=ka(e,r,o);return{route:o.node.route,rawParams:i}}function ka(e,t,n){var d,u,f,h,g,m,p,x,v,y;const r=Od(n.node);let o=null;const i=Object.create(null);let s=((d=n.extract)==null?void 0:d.part)??0,a=((u=n.extract)==null?void 0:u.node)??0,c=((f=n.extract)==null?void 0:f.path)??0,l=((h=n.extract)==null?void 0:h.segment)??0;for(;a<r.length;s++,a++,c++,l++){const w=r[a];if(w.kind===et)break;if(w.kind===Sa){l--,s--,c--;continue}const E=t[s],k=c;if(E&&(c+=E.length),w.kind===1){o??(o=n.node.fullPath.split("/"));const S=o[l],P=((g=w.prefix)==null?void 0:g.length)??0;if(S.charCodeAt(P)===123){const M=((m=w.suffix)==null?void 0:m.length)??0,A=S.substring(P+2,S.length-M-1),C=E.substring(P,E.length-M);i[A]=decodeURIComponent(C)}else{const M=S.substring(1);i[M]=decodeURIComponent(E)}}else if(w.kind===3){if(n.skipped&1<<a){s--,c=k-1;continue}o??(o=n.node.fullPath.split("/"));const S=o[l],P=((p=w.prefix)==null?void 0:p.length)??0,M=((x=w.suffix)==null?void 0:x.length)??0,A=S.substring(P+3,S.length-M-1),C=w.suffix||w.prefix?E.substring(P,E.length-M):E;C&&(i[A]=decodeURIComponent(C))}else if(w.kind===2){const S=w,P=e.substring(k+(((v=S.prefix)==null?void 0:v.length)??0),e.length-(((y=S.suffix)==null?void 0:y.length)??0)),M=decodeURIComponent(P);i["*"]=M,i._splat=M;break}}return n.rawParams&&Object.assign(i,n.rawParams),[i,{part:s,node:a,path:c,segment:l}]}function Ca(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Od(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Fd(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const o=!sn(t),i=o&&e!=="/",s=t.length-(o?1:0),a=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let c=null,l=null;for(;a.length;){const d=a.pop(),{node:u,index:f,skipped:h,depth:g,statics:m,dynamics:p,optionals:x}=d;let{extract:v,rawParams:y}=d;if(u.kind===2&&u.route&&!Nn(l,d))continue;if(u.parse){if(!Ci(e,t,d))continue;y=d.rawParams,v=d.extract}r&&u.route&&u.kind!==et&&Nn(c,d)&&(c=d);const w=f===s;if(w&&(u.route&&(!i||u.kind===et||u.kind===2)&&Nn(l,d)&&(l=d),!u.optional&&!u.wildcard&&!u.index&&!u.pathless))continue;const E=w?void 0:t[f];let k;if(w&&u.index){const S={node:u.index,index:f,skipped:h,depth:g+1,statics:m,dynamics:p,optionals:x,extract:v,rawParams:y};let P=!0;if(u.index.parse&&(Ci(e,t,S)||(P=!1)),P){if(!p&&!x&&!h&&Hd(m,s))return S;Nn(l,S)&&(l=S)}}if(u.wildcard)for(let S=u.wildcard.length-1;S>=0;S--){const P=u.wildcard[S],{prefix:M,suffix:A}=P;if(!(M&&(w||!(P.caseSensitive?E:k??(k=E.toLowerCase())).startsWith(M)))){if(A){if(w)continue;const C=t.slice(f).join("/").slice(-A.length);if((P.caseSensitive?C:C.toLowerCase())!==A)continue}a.push({node:P,index:s,skipped:h,depth:g+1,statics:m,dynamics:p,optionals:x,extract:v,rawParams:y})}}if(u.optional){const S=h|1<<g,P=g+1;for(let M=u.optional.length-1;M>=0;M--){const A=u.optional[M];a.push({node:A,index:f,skipped:S,depth:P,statics:m,dynamics:p,optionals:x,extract:v,rawParams:y})}if(!w)for(let M=u.optional.length-1;M>=0;M--){const A=u.optional[M],{prefix:C,suffix:R}=A;if(C||R){const j=A.caseSensitive?E:k??(k=E.toLowerCase());if(C&&!j.startsWith(C)||R&&!j.endsWith(R))continue}a.push({node:A,index:f+1,skipped:h,depth:P,statics:m,dynamics:p,optionals:x+Mn(s,f),extract:v,rawParams:y})}}if(!w&&u.dynamic&&E)for(let S=u.dynamic.length-1;S>=0;S--){const P=u.dynamic[S],{prefix:M,suffix:A}=P;if(M||A){const C=P.caseSensitive?E:k??(k=E.toLowerCase());if(M&&!C.startsWith(M)||A&&!C.endsWith(A))continue}a.push({node:P,index:f+1,skipped:h,depth:g+1,statics:m,dynamics:p+Mn(s,f),optionals:x,extract:v,rawParams:y})}if(!w&&u.staticInsensitive){const S=u.staticInsensitive.get(k??(k=E.toLowerCase()));S&&a.push({node:S,index:f+1,skipped:h,depth:g+1,statics:m+Mn(s,f),dynamics:p,optionals:x,extract:v,rawParams:y})}if(!w&&u.static){const S=u.static.get(E);S&&a.push({node:S,index:f+1,skipped:h,depth:g+1,statics:m+Mn(s,f),dynamics:p,optionals:x,extract:v,rawParams:y})}if(u.pathless){const S=g+1;for(let P=u.pathless.length-1;P>=0;P--){const M=u.pathless[P];a.push({node:M,index:f,skipped:h,depth:S,statics:m,dynamics:p,optionals:x,extract:v,rawParams:y})}}}if(l)return l;if(r&&c){let d=c.index;for(let f=0;f<c.index;f++)d+=t[f].length;const u=d===e.length?"/":e.slice(d);return c.rawParams??(c.rawParams=Object.create(null)),c.rawParams["**"]=decodeURIComponent(u),c}return null}function Mn(e,t){return 2**(e-t-1)}function Hd(e,t){return e===2**(t-1)-1}function Ci(e,t,n){let r,o;try{[r,o]=ka(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=o,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function Nn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===et)>(e.node.kind===et)||t.node.kind===et==(e.node.kind===et)&&t.depth>e.depth))):!0}function Hn(e){return zo(e.filter(t=>t!==void 0).join("/"))}function zo(e){return e.replace(/\/{2,}/g,"/")}function Pa(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Ve(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function Ma(e){return Ve(Pa(e))}function Jn(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Vd(e,t,n){return Jn(e,n)===Jn(t,n)}function qd({base:e,to:t,trailingSlash:n="never",cache:r}){const o=t.startsWith("/"),i=!o&&t===".";let s;if(r){s=o?t:i?e:e+"\0"+t;const l=r.get(s);if(l)return l}let a;if(i)a=e.split("/");else if(o)a=t.split("/");else{for(a=e.split("/");a.length>1&&sn(a)==="";)a.pop();const l=t.split("/");for(let d=0,u=l.length;d<u;d++){const f=l[d];f===""?d?d===u-1&&a.push(f):a=[f]:f===".."?a.pop():f==="."||a.push(f)}}a.length>1&&(sn(a)===""?n==="never"&&a.pop():n==="always"&&a.push(""));const c=zo(a.join("/"))||"/";return s&&r&&r.set(s,c),c}function Wd(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),n=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return o=>o.replace(r,i=>t.get(i)??i)}function Br(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(o=>Mi(o,n)).join("/"):Mi(r,n)}function Pi({path:e,params:t,decoder:n,...r}){let o=!1;const i=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:i,isMissingParams:o};const s=e.length;let a=0,c,l="";for(;a<s;){const d=a;c=Ea(e,d,c);const u=c[5];if(a=u+1,d===u)continue;const f=c[0];if(f===0){l+="/"+e.substring(d,u);continue}if(f===2){const h=t._splat;i._splat=h,i["*"]=h;const g=e.substring(d,c[1]),m=e.substring(c[4],u);if(!h){o=!0,(g||m)&&(l+="/"+g+m);continue}const p=Br("_splat",t,n);l+="/"+g+p+m;continue}if(f===1){const h=e.substring(c[2],c[3]);!o&&!(h in t)&&(o=!0),i[h]=t[h];const g=e.substring(d,c[1]),m=e.substring(c[4],u),p=Br(h,t,n)??"undefined";l+="/"+g+p+m;continue}if(f===3){const h=e.substring(c[2],c[3]),g=t[h];if(g==null)continue;i[h]=g;const m=e.substring(d,c[1]),p=e.substring(c[4],u),x=Br(h,t,n)??"";l+="/"+m+x+p;continue}}return e.endsWith("/")&&(l+="/"),{usedParams:i,interpolatedPath:l||"/",isMissingParams:o}}function Mi(e,t){const n=encodeURIComponent(e);return(t==null?void 0:t(n))??n}function xe(e){return(e==null?void 0:e.isNotFound)===!0}function Yd(e,t=String){const n=new URLSearchParams;for(const r in e){const o=e[r];o!==void 0&&n.set(r,t(o))}return n.toString()}function Or(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Gd(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,o]of t.entries()){const i=n[r];i==null?n[r]=Or(o):Array.isArray(i)?i.push(Or(o)):n[r]=[i,Or(o)]}return n}const Xd=Kd(JSON.parse),Ud=Zd(JSON.stringify,JSON.parse);function Kd(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Gd(t);for(const r in n){const o=n[r];if(typeof o=="string")try{n[r]=e(o)}catch{}}return n}}function Zd(e,t){const n=typeof t=="function";function r(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(n&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const i=Yd(o,r);return i?`?${i}`:""}}const ft="__root__";function Qd(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function we(e){return e instanceof Response&&!!e.options}const uo=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},Jd=e=>e.stores.matchesId.get().some(t=>{var n;return(n=e.stores.matchStores.get(t))==null?void 0:n.get()._forcePending}),xr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ht=(e,t,n=!0)=>{const r={...e.router.options.context??{}},o=n?t:t-1;for(let i=0;i<=o;i++){const s=e.matches[i];if(!s)continue;const a=e.router.getMatch(s.id);a&&Object.assign(r,a.__routeContext,a.__beforeLoadContext)}return r},Ni=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,r=e.matches.findIndex(s=>s.routeId===e.router.routeTree.id),o=r>=0?r:0;let i=n?e.matches.findIndex(s=>s.routeId===n):e.firstBadMatchIndex??e.matches.length-1;i<0&&(i=o);for(let s=i;s>=0;s--){const a=e.matches[s];if(e.router.looseRoutesById[a.routeId].options.notFoundComponent)return s}return n?i:o},tt=(e,t,n)=>{var r,o,i;if(!(!we(n)&&!xe(n)))throw we(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&((r=t._nonReactive.beforeLoadPromise)==null||r.resolve(),(o=t._nonReactive.loaderPromise)==null||o.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,s=>({...s,status:we(n)?"redirected":xe(n)?"notFound":s.status==="pending"?"success":s.status,context:ht(e,t.index),isFetching:!1,error:n})),xe(n)&&!n.routeId&&(n.routeId=t.routeId),(i=t._nonReactive.loadPromise)==null||i.resolve()),we(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},Na=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Ii=(e,t,n)=>{const r=ht(e,n);e.updateMatch(t,o=>({...o,context:r}))},Xt=(e,t,n)=>{var s,a;const{id:r,routeId:o}=e.matches[t],i=e.router.looseRoutesById[o];if(n instanceof Promise)throw n;e.firstBadMatchIndex??(e.firstBadMatchIndex=t),tt(e,e.router.getMatch(r),n);try{(a=(s=i.options).onError)==null||a.call(s,n)}catch(c){n=c,tt(e,e.router.getMatch(r),n)}e.updateMatch(r,c=>{var l,d;return(l=c._nonReactive.beforeLoadPromise)==null||l.resolve(),c._nonReactive.beforeLoadPromise=void 0,(d=c._nonReactive.loadPromise)==null||d.resolve(),{...c,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!we(n)&&!xe(n)&&(e.serialError??(e.serialError=n))},Ia=(e,t,n,r)=>{var i;if(r._nonReactive.pendingTimeout!==void 0)return;const o=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!xr(e,t)&&(n.options.loader||n.options.beforeLoad||La(n))&&typeof o=="number"&&o!==1/0&&(n.options.pendingComponent??((i=e.router.options)==null?void 0:i.defaultPendingComponent))){const s=setTimeout(()=>{uo(e)},o);r._nonReactive.pendingTimeout=s}},ef=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Ia(e,t,n,r);const o=()=>{const i=e.router.getMatch(t);i.preload&&(i.status==="redirected"||i.status==="notFound")&&tt(e,i,i.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(o):o()},tf=(e,t,n,r)=>{const o=e.router.getMatch(t);let i=o._nonReactive.loadPromise;o._nonReactive.loadPromise=jt(()=>{i==null||i.resolve(),i=void 0});const{paramsError:s,searchError:a}=o;s&&Xt(e,n,s),a&&Xt(e,n,a),Ia(e,t,r,o);const c=new AbortController;let l=!1;const d=()=>{l||(l=!0,e.updateMatch(t,w=>({...w,isFetching:"beforeLoad",fetchCount:w.fetchCount+1,abortController:c})))},u=()=>{var w;(w=o._nonReactive.beforeLoadPromise)==null||w.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,E=>({...E,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{d(),u()});return}o._nonReactive.beforeLoadPromise=jt();const f={...ht(e,n,!1),...o.__routeContext},{search:h,params:g,cause:m}=o,p=xr(e,t),x={search:h,abortController:c,params:g,preload:p,context:f,location:e.location,navigate:w=>e.router.navigate({...w,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:p?"preload":m,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=w=>{if(w===void 0){e.router.batch(()=>{d(),u()});return}(we(w)||xe(w))&&(d(),Xt(e,n,w)),e.router.batch(()=>{d(),e.updateMatch(t,E=>({...E,__beforeLoadContext:w})),u()})};let y;try{if(y=r.options.beforeLoad(x),an(y))return d(),y.catch(w=>{Xt(e,n,w)}).then(v)}catch(w){d(),Xt(e,n,w)}v(y)},nf=(e,t)=>{const{id:n,routeId:r}=e.matches[t],o=e.router.looseRoutesById[r],i=()=>a(),s=()=>tf(e,n,t,o),a=()=>{if(Na(e,n))return;const c=ef(e,n,o);return an(c)?c.then(s):s()};return i()},rf=(e,t,n)=>{var i,s,a,c,l,d;const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([(s=(i=n.options).head)==null?void 0:s.call(i,o),(c=(a=n.options).scripts)==null?void 0:c.call(a,o),(d=(l=n.options).headers)==null?void 0:d.call(l,o)]).then(([u,f,h])=>({meta:u==null?void 0:u.meta,links:u==null?void 0:u.links,headScripts:u==null?void 0:u.scripts,headers:h,scripts:f,styles:u==null?void 0:u.styles}))},Ra=(e,t,n,r,o)=>{const i=t[r-1],{params:s,loaderDeps:a,abortController:c,cause:l}=e.router.getMatch(n),d=ht(e,r),u=xr(e,n);return{params:s,deps:a,preload:!!u,parentMatchPromise:i,abortController:c,context:d,location:e.location,navigate:f=>e.router.navigate({...f,_fromLocation:e.location}),cause:u?"preload":l,route:o,...e.router.options.additionalContext}},Ri=async(e,t,n,r,o)=>{var i,s,a,c,l;try{const d=e.router.getMatch(n);try{(!(va??e.router.isServer)||d.ssr===!0)&&ln(o);const u=o.options.loader,f=typeof u=="function"?u:u==null?void 0:u.handler,h=f==null?void 0:f(Ra(e,t,n,r,o)),g=!!f&&an(h);if((g||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||d._nonReactive.minPendingPromise)&&e.updateMatch(n,p=>({...p,isFetching:"loader"})),f){const p=g?await h:h;tt(e,e.router.getMatch(n),p),p!==void 0&&e.updateMatch(n,x=>({...x,loaderData:p}))}o._lazyPromise&&await o._lazyPromise;const m=d._nonReactive.minPendingPromise;m&&await m,o._componentsPromise&&await o._componentsPromise,e.updateMatch(n,p=>({...p,error:void 0,context:ht(e,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(u){let f=u;if((f==null?void 0:f.name)==="AbortError"){if(d.abortController.signal.aborted){(i=d._nonReactive.loaderPromise)==null||i.resolve(),d._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,g=>({...g,status:g.status==="pending"?"success":g.status,isFetching:!1,context:ht(e,r)}));return}const h=d._nonReactive.minPendingPromise;h&&await h,xe(u)&&await((a=(s=o.options.notFoundComponent)==null?void 0:s.preload)==null?void 0:a.call(s)),tt(e,e.router.getMatch(n),u);try{(l=(c=o.options).onError)==null||l.call(c,u)}catch(g){f=g,tt(e,e.router.getMatch(n),g)}!we(f)&&!xe(f)&&await ln(o,["errorComponent"]),e.updateMatch(n,g=>({...g,error:f,context:ht(e,r),status:"error",isFetching:!1}))}}catch(d){const u=e.router.getMatch(n);u&&(u._nonReactive.loaderPromise=void 0),tt(e,u,d)}},of=async(e,t,n)=>{var h,g,m,p;async function r(x,v,y,w,E){const k=Date.now()-v.updatedAt,S=x?E.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:E.options.staleTime??e.router.options.defaultStaleTime??0,P=E.options.shouldReload,M=typeof P=="function"?P(Ra(e,t,o,n,E)):P,{status:A,invalid:C}=w,R=k>=S&&(!!e.forceStaleReload||w.cause==="enter"||y!==void 0&&y!==w.id);s=A==="success"&&(C||(M??R)),x&&E.options.preload===!1||(s&&!e.sync&&d?(a=!0,(async()=>{var j,b;try{await Ri(e,t,o,n,E);const T=e.router.getMatch(o);(j=T._nonReactive.loaderPromise)==null||j.resolve(),(b=T._nonReactive.loadPromise)==null||b.resolve(),T._nonReactive.loaderPromise=void 0,T._nonReactive.loadPromise=void 0}catch(T){we(T)&&await e.router.navigate(T.options)}})()):A!=="success"||s?await Ri(e,t,o,n,E):Ii(e,o,n))}const{id:o,routeId:i}=e.matches[n];let s=!1,a=!1;const c=e.router.looseRoutesById[i],l=c.options.loader,d=((typeof l=="function"||l==null?void 0:l.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(Na(e,o)){if(!e.router.getMatch(o))return e.matches[n];Ii(e,o,n)}else{const x=e.router.getMatch(o),v=e.router.stores.matchesId.get()[n],y=((h=v&&e.router.stores.matchStores.get(v)||null)==null?void 0:h.routeId)===i?v:(g=e.router.stores.matches.get().find(E=>E.routeId===i))==null?void 0:g.id,w=xr(e,o);if(x._nonReactive.loaderPromise){if(x.status==="success"&&!e.sync&&!x.preload&&d)return x;await x._nonReactive.loaderPromise;const E=e.router.getMatch(o),k=E._nonReactive.error||E.error;k&&tt(e,E,k),E.status==="pending"&&await r(w,x,y,E,c)}else{const E=w&&!e.router.stores.matchStores.has(o),k=e.router.getMatch(o);k._nonReactive.loaderPromise=jt(),E!==k.preload&&e.updateMatch(o,S=>({...S,preload:E})),await r(w,x,y,k,c)}}const u=e.router.getMatch(o);a||((m=u._nonReactive.loaderPromise)==null||m.resolve(),(p=u._nonReactive.loadPromise)==null||p.resolve(),u._nonReactive.loadPromise=void 0),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,a||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const f=a?u.isFetching:!1;return f!==u.isFetching||u.invalid!==!1?(e.updateMatch(o,x=>({...x,isFetching:f,invalid:!1})),e.router.getMatch(o)):u};async function Li(e){var f,h;const t=e,n=[];Jd(t.router)&&uo(t);let r;for(let g=0;g<t.matches.length;g++){try{const m=nf(t,g);an(m)&&await m}catch(m){if(we(m))throw m;if(xe(m))r=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const o=t.firstBadMatchIndex??t.matches.length,i=r&&!t.preload?Ni(t,r):void 0,s=r&&t.preload?0:i!==void 0?Math.min(i+1,o):o;let a,c;for(let g=0;g<s;g++)n.push(of(t,n,g));try{await Promise.all(n)}catch{const g=await Promise.allSettled(n);for(const m of g){if(m.status!=="rejected")continue;const p=m.reason;if(we(p))throw p;xe(p)?a??(a=p):c??(c=p)}if(c!==void 0)throw c}const l=a??(r&&!t.preload?r:void 0);let d=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!l&&r&&t.preload)return t.matches;if(l){const g=Ni(t,l);g===void 0&&We();const m=t.matches[g],p=t.router.looseRoutesById[m.routeId],x=(f=t.router.options)==null?void 0:f.defaultNotFoundComponent;!p.options.notFoundComponent&&x&&(p.options.notFoundComponent=x),l.routeId=m.routeId;const v=m.routeId===t.router.routeTree.id;t.updateMatch(m.id,y=>({...y,...v?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:l},isFetching:!1})),d=g,await ln(p,["notFoundComponent"])}else if(!t.preload){const g=t.matches[0];g.globalNotFound||(h=t.router.getMatch(g.id))!=null&&h.globalNotFound&&t.updateMatch(g.id,m=>({...m,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const g=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await ln(g,["errorComponent"])}for(let g=0;g<=d;g++){const{id:m,routeId:p}=t.matches[g],x=t.router.looseRoutesById[p];try{const v=rf(t,m,x);if(v){const y=await v;t.updateMatch(m,w=>({...w,...y}))}}catch(v){console.error(`Error executing head for route ${p}:`,v)}}const u=uo(t);if(an(u)&&await u,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Ti(e,t){const n=t.map(r=>{var o,i;return(i=(o=e.options[r])==null?void 0:o.preload)==null?void 0:i.call(o)}).filter(Boolean);if(n.length!==0)return Promise.all(n)}function ln(e,t=Vn){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:o,...i}=r.options;Object.assign(e.options,i),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===Vn?(()=>{if(e._componentsPromise===void 0){const r=Ti(e,Vn);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Ti(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function La(e){var t;for(const n of Vn)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const Vn=["component","errorComponent","pendingComponent","notFoundComponent"];function sf(e){return{input:({url:t})=>{for(const n of e)t=fo(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Ta(e[n],t);return t}}}function af(e){const t=Ma(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),o=`${r}/`;return{input:({url:i})=>{const s=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return s===r?i.pathname="/":s.startsWith(o)&&(i.pathname=i.pathname.slice(n.length)),i},output:({url:i})=>(i.pathname=Hn(["/",t,i.pathname]),i)}}function fo(e,t){var r;const n=(r=e==null?void 0:e.input)==null?void 0:r.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Ta(e,t){var r;const n=(r=e==null?void 0:e.output)==null?void 0:r.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function cf(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:o,init:i}=t,s=new Map,a=new Map,c=new Map,l=n(e.status),d=n(e.loadedAt),u=n(e.isLoading),f=n(e.isTransitioning),h=n(e.location),g=n(e.resolvedLocation),m=n(e.statusCode),p=n(e.redirect),x=n([]),v=n([]),y=n([]),w=r(()=>Fr(s,x.get())),E=r(()=>Fr(a,v.get())),k=r(()=>Fr(c,y.get())),S=r(()=>x.get()[0]),P=r(()=>x.get().some(I=>{var $;return(($=s.get(I))==null?void 0:$.get().status)==="pending"})),M=r(()=>{var I;return{locationHref:h.get().href,resolvedLocationHref:(I=g.get())==null?void 0:I.href,status:l.get()}}),A=r(()=>({status:l.get(),loadedAt:d.get(),isLoading:u.get(),isTransitioning:f.get(),matches:w.get(),location:h.get(),resolvedLocation:g.get(),statusCode:m.get(),redirect:p.get()})),C=cn(64);function R(I){let $=C.get(I);return $||($=r(()=>{const z=x.get();for(const F of z){const O=s.get(F);if(O&&O.routeId===I)return O.get()}}),C.set(I,$)),$}const j={status:l,loadedAt:d,isLoading:u,isTransitioning:f,location:h,resolvedLocation:g,statusCode:m,redirect:p,matchesId:x,pendingIds:v,cachedIds:y,matches:w,pendingMatches:E,cachedMatches:k,firstId:S,hasPending:P,matchRouteDeps:M,matchStores:s,pendingMatchStores:a,cachedMatchStores:c,__store:A,getRouteMatchStore:R,setMatches:b,setPending:T,setCached:N};b(e.matches),i==null||i(j);function b(I){Hr(I,s,x,n,o)}function T(I){Hr(I,a,v,n,o)}function N(I){Hr(I,c,y,n,o)}return j}function Fr(e,t){const n=[];for(const r of t){const o=e.get(r);o&&n.push(o.get())}return n}function Hr(e,t,n,r,o){const i=e.map(a=>a.id),s=new Set(i);o(()=>{for(const a of t.keys())s.has(a)||t.delete(a);for(const a of e){const c=t.get(a.id);if(!c){const l=r(a);l.routeId=a.routeId,t.set(a.id,l);continue}c.routeId=a.routeId,c.get()!==a&&c.set(a)}Ld(n.get(),i)||n.set(i)})}var nt="__TSR_index",Ai="popstate",ji="beforeunload";function lf(e){let t=e.getLocation();const n=new Set,r=s=>{t=e.getLocation(),n.forEach(a=>a({location:t,action:s}))},o=s=>{e.notifyOnIndexChange??!0?r(s):t=e.getLocation()},i=async({task:s,navigateOpts:a,...c})=>{var u,f;if((a==null?void 0:a.ignoreBlocker)??!1){s();return}const l=((u=e.getBlockers)==null?void 0:u.call(e))??[],d=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&l.length&&d)for(const h of l){const g=er(c.path,c.state);if(await h.blockerFn({currentLocation:t,nextLocation:g,action:c.type})){(f=e.onBlocked)==null||f.call(e);return}}s()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:s=>(n.add(s),()=>{n.delete(s)}),push:(s,a,c)=>{const l=t.state[nt];a=zi(l+1,a),i({task:()=>{e.pushState(s,a),r({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:s,state:a})},replace:(s,a,c)=>{const l=t.state[nt];a=zi(l,a),i({task:()=>{e.replaceState(s,a),r({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:s,state:a})},go:(s,a)=>{i({task:()=>{e.go(s),o({type:"GO",index:s})},navigateOpts:a,type:"GO"})},back:s=>{i({task:()=>{e.back((s==null?void 0:s.ignoreBlocker)??!1),o({type:"BACK"})},navigateOpts:s,type:"BACK"})},forward:s=>{i({task:()=>{e.forward((s==null?void 0:s.ignoreBlocker)??!1),o({type:"FORWARD"})},navigateOpts:s,type:"FORWARD"})},canGoBack:()=>t.state[nt]!==0,createHref:s=>e.createHref(s),block:s=>{var c;if(!e.setBlockers)return()=>{};const a=((c=e.getBlockers)==null?void 0:c.call(e))??[];return e.setBlockers([...a,s]),()=>{var d,u;const l=((d=e.getBlockers)==null?void 0:d.call(e))??[];(u=e.setBlockers)==null||u.call(e,l.filter(f=>f!==s))}},flush:()=>{var s;return(s=e.flush)==null?void 0:s.call(e)},destroy:()=>{var s;return(s=e.destroy)==null?void 0:s.call(e)},notify:r}}function zi(e,t){t||(t={});const n=$o();return{...t,key:n,__TSR_key:n,[nt]:e}}function uf(e){var P,M;const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let o=[];const i=()=>o,s=A=>o=A,a=(A=>A),c=(()=>er(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((P=t.history.state)!=null&&P.__TSR_key)&&!((M=t.history.state)!=null&&M.key)){const A=$o();t.history.replaceState({[nt]:0,key:A,__TSR_key:A},"")}let l=c(),d,u=!1,f=!1,h=!1,g=!1;const m=()=>l;let p,x;const v=()=>{p&&(S._ignoreSubscribers=!0,(p.isPush?t.history.pushState:t.history.replaceState)(p.state,"",p.href),S._ignoreSubscribers=!1,p=void 0,x=void 0,d=void 0)},y=(A,C,R)=>{const j=a(C);x||(d=l),l=er(C,R),p={href:j,state:R,isPush:(p==null?void 0:p.isPush)||A==="push"},x||(x=Promise.resolve().then(()=>v()))},w=A=>{l=c(),S.notify({type:A})},E=async()=>{if(f){f=!1;return}const A=c(),C=A.state[nt]-l.state[nt],R=C===1,j=C===-1,b=!R&&!j||u;u=!1;const T=b?"GO":j?"BACK":"FORWARD",N=b?{type:"GO",index:C}:{type:j?"BACK":"FORWARD"};if(h)h=!1;else{const I=i();if(typeof document<"u"&&I.length){for(const $ of I)if(await $.blockerFn({currentLocation:l,nextLocation:A,action:T})){f=!0,t.history.go(1),S.notify(N);return}}}l=c(),S.notify(N)},k=A=>{if(g){g=!1;return}let C=!1;const R=i();if(typeof document<"u"&&R.length)for(const j of R){const b=j.enableBeforeUnload??!0;if(b===!0){C=!0;break}if(typeof b=="function"&&b()===!0){C=!0;break}}if(C)return A.preventDefault(),A.returnValue=""},S=lf({getLocation:m,getLength:()=>t.history.length,pushState:(A,C)=>y("push",A,C),replaceState:(A,C)=>y("replace",A,C),back:A=>(A&&(h=!0),g=!0,t.history.back()),forward:A=>{A&&(h=!0),g=!0,t.history.forward()},go:A=>{u=!0,t.history.go(A)},createHref:A=>a(A),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ji,k,{capture:!0}),t.removeEventListener(Ai,E)},onBlocked:()=>{d&&l!==d&&(l=d)},getBlockers:i,setBlockers:s,notifyOnIndexChange:!1});return t.addEventListener(ji,k,{capture:!0}),t.addEventListener(Ai,E),t.history.pushState=function(...A){const C=n.apply(t.history,A);return S._ignoreSubscribers||w("PUSH"),C},t.history.replaceState=function(...A){const C=r.apply(t.history,A);return S._ignoreSubscribers||w("REPLACE"),C},S}function df(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function er(e,t){const n=df(e),r=n.indexOf("#"),o=n.indexOf("?"),i=$o();return{href:n,pathname:n.substring(0,r>0?o>0?Math.min(r,o):r:o>0?o:n.length),hash:r>-1?n.substring(r):"",search:o>-1?n.slice(o,r===-1?void 0:r):"",state:t||{[nt]:0,key:i,__TSR_key:i}}}function $o(){return(Math.random()+1).toString(36).substring(7)}function It(e,t){const n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:(n==null?void 0:n.pathname)!==r.pathname,hrefChanged:(n==null?void 0:n.href)!==r.href,hashChanged:(n==null?void 0:n.hash)!==r.hash}}const ho=new WeakMap;var ff=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=n=>n(),this.update=n=>{var d;const r=this.options,o=this.basepath??(r==null?void 0:r.basepath)??"/",i=this.basepath===void 0,s=r==null?void 0:r.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Wd(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=uf()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let u;this.resolvePathCache=cn(1e3),u=this.buildRouteTree(),this.setRoutes(u)}if(!this.stores&&this.latestLocation){const u=this.getStoreConfig(this);this.batch=u.batch,this.stores=cf(gf(this.latestLocation),u),kf(this)}let a=!1;const c=this.options.basepath??"/",l=this.options.rewrite;if(i||o!==c||s!==l){this.basepath=c;const u=[],f=Ma(c);f&&f!=="/"&&u.push(af({basepath:c})),l&&u.push(l),this.rewrite=u.length===0?void 0:u.length===1?u[0]:sf(u),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof((d=window.CSS)==null?void 0:d.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=Bd(this.routeTree,this.options.caseSensitive,(r,o)=>{r.init({originalIndex:o})});return this.options.routeMasks&&Ad(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const o={eventType:n,fn:r};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const o=({pathname:c,search:l,hash:d,href:u,state:f})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(c)){const x=this.options.parseSearch(l),v=this.options.stringifySearch(x);return{href:c+v+d,publicHref:c+v+d,pathname:Gt(c).path,external:!1,searchStr:v,search:ot(r==null?void 0:r.search,x),hash:Gt(d.slice(1)).path,state:ct(r==null?void 0:r.state,f)}}const h=new URL(u,this.origin),g=fo(this.rewrite,h),m=this.options.parseSearch(g.search),p=this.options.stringifySearch(m);return g.search=p,{href:g.href.replace(g.origin,""),publicHref:u,pathname:Gt(g.pathname).path,external:!!this.rewrite&&g.origin!==this.origin,searchStr:p,search:ot(r==null?void 0:r.search,m),hash:Gt(g.hash.slice(1)).path,state:ct(r==null?void 0:r.state,f)}},i=o(n),{__tempLocation:s,__tempKey:a}=i.state;if(s&&(!a||a===this.tempLocationKey)){const c=o(s);return c.state.key=i.state.key,c.state.__TSR_key=i.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:i}}return i},this.resolvePathWithBase=(n,r)=>qd({base:n,to:r.includes("//")?zo(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,o)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},o):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>pf({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{var o;if(this.stores.pendingMatchStores.has(n))return;const r=(o=this.stores.matchStores.get(n))==null?void 0:o.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const r=(i={})=>{var C,R;const s=i._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutesLightweight(s);i.from;const c=i.unsafeRelative==="path"?s.pathname:i.from??a.fullPath,l=i.to?`${i.to}`:void 0,d=a.search,u=Object.assign(Object.create(null),a.params),f=(l==null?void 0:l.charCodeAt(0))===47?"/":this.resolvePathWithBase(c,"."),h=l?this.resolvePathWithBase(f,l):f,g=i.params===!1||i.params===null?Object.create(null):(i.params??!0)===!0?u:Object.assign(u,at(i.params,u)),m=this.routesByPath[Ve(h)];let p;if(m)p=this.getRouteBranch(m);else if(h.includes("$"))p=[];else{const j=this.getMatchedRoutes(h);p=j.matchedRoutes,this.options.notFoundRoute&&(!j.foundRoute||j.foundRoute.path!=="/"&&j.routeParams["**"])&&(p=[...p,this.options.notFoundRoute])}if(p.length&&_a(g))for(const j of p){const b=((C=j.options.params)==null?void 0:C.stringify)??j.options.stringifyParams;if(b)try{Object.assign(g,b(g))}catch{}}const x=n.leaveParams?h:Gt(Pi({path:h,params:g,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let v=d;if(n._includeValidateSearch&&((R=this.options.search)!=null&&R.strict)){const j={};p.forEach(b=>{if(b.options.validateSearch)try{Object.assign(j,qn(b.options.validateSearch,{...j,...v}))}catch{}}),v=j}v=mf({search:v,dest:i,destRoutes:p,_includeValidateSearch:n._includeValidateSearch}),v=ot(d,v);const y=this.options.stringifySearch(v),w=i.hash===!0?s.hash:i.hash?at(i.hash,s.hash):void 0,E=w?`#${w}`:"";let k=i.state===!0?s.state:i.state?at(i.state,s.state):{};k=ct(s.state,k);const S=`${x}${y}${E}`;let P,M,A=!1;if(this.rewrite){const j=new URL(S,this.origin),b=Ta(this.rewrite,j);P=j.href.replace(j.origin,""),b.origin!==this.origin?(M=b.href,A=!0):M=b.pathname+b.search+b.hash}else P=Rd(S),M=P;return{publicHref:M,href:P,pathname:x,search:v,searchStr:y,state:k,hash:w??"",external:A,unmaskOnReload:i.unmaskOnReload}},o=(i={},s)=>{const a=r(i);let c=s?r(s):void 0;if(!c){const l=Object.create(null);if(this.options.routeMasks){const d=jd(a.pathname,this.processedTree);if(d){Object.assign(l,d.rawParams);const{from:u,params:f,...h}=d.route,g=f===!1||f===null?Object.create(null):(f??!0)===!0?l:Object.assign(l,at(f,l));s={from:n.from,...h,params:g},c=r(s)}}}return c&&(a.maskedLocation=c),a};return n.mask?o(n,{from:n.from,...n.mask}):o(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...o})=>{let i;const s=()=>{const l=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];l.forEach(u=>{o.state[u]=this.latestLocation.state[u]});const d=dt(o.state,this.latestLocation.state);return l.forEach(u=>{delete o.state[u]}),d},a=Ve(this.latestLocation.href)===Ve(o.href);let c=this.commitLocationPromise;if(this.commitLocationPromise=jt(()=>{c==null||c.resolve(),c=void 0}),a&&s())this.load();else{let{maskedLocation:l,hashScrollIntoView:d,...u}=o;l&&(u={...l,state:{...l.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,i=o.replace?"REPLACE":"PUSH",this.history[i==="REPLACE"?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:r})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(i?{action:{type:i}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:o,viewTransition:i,ignoreBlocker:s,href:a,...c}={})=>{if(a){const u=this.history.location.state.__TSR_index,f=er(a,{__TSR_index:n?u:u+1}),h=new URL(f.pathname,this.origin);c.to=fo(this.rewrite,h).pathname,c.search=this.options.parseSearch(f.search),c.hash=f.hash.slice(1)}const l=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=l;const d=this.commitLocation({...l,viewTransition:i,replace:n,resetScroll:r,hashScrollIntoView:o,ignoreBlocker:s});return Promise.resolve().then(()=>{this.pendingBuiltLocation===l&&(this.pendingBuiltLocation=void 0)}),d},this.navigate=async({to:n,reloadDocument:r,href:o,publicHref:i,...s})=>{var c,l;let a=!1;if(o)try{new URL(`${o}`),a=!0}catch{}if(a&&!r&&(r=!0),r){if(n!==void 0||!o){const u=this.buildLocation({to:n,...s});o=o??u.publicHref,i=i??u.publicHref}const d=!a&&i?i:o;if(Qn(d,this.protocolAllowlist))return Promise.resolve();if(!s.ignoreBlocker){const u=((l=(c=this.history).getBlockers)==null?void 0:l.call(c))??[];for(const f of u)if(f!=null&&f.blockerFn&&await f.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return s.replace?window.location.replace(d):window.location.href=d,Promise.resolve()}return this.buildAndCommitLocation({...s,href:o,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(o=>!n.some(i=>i.id===o.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(r)})},this.load=async n=>{var l;const r=(l=n==null?void 0:n.action)==null?void 0:l.type;let o,i,s;const a=this.stores.resolvedLocation.get()??this.stores.location.get();for(s=new Promise(d=>{this.startTransition(async()=>{var u;try{this.beforeLoad(),r?ho.set(this.latestLocation,r):ho.delete(this.latestLocation);const f=this.latestLocation,h=It(f,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...h}),this.emit({type:"onBeforeLoad",...h}),await Li({router:this,sync:n==null?void 0:n.sync,forceStaleReload:a.href===f.href,matches:this.stores.pendingMatches.get(),location:f,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{var v,y;let g=null,m=null,p=null,x=null;this.batch(()=>{const w=this.stores.pendingMatches.get(),E=w.length,k=this.stores.matches.get();g=E?k.filter(M=>!this.stores.pendingMatchStores.has(M.id)):null;const S=new Set;for(const M of this.stores.pendingMatchStores.values())M.routeId&&S.add(M.routeId);const P=new Set;for(const M of this.stores.matchStores.values())M.routeId&&P.add(M.routeId);m=E?k.filter(M=>!S.has(M.routeId)):null,p=E?w.filter(M=>!P.has(M.routeId)):null,x=E?w.filter(M=>P.has(M.routeId)):k,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),E&&(this.stores.setMatches(w),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...g.filter(M=>M.status!=="error"&&M.status!=="notFound"&&M.status!=="redirected")]),this.clearExpiredCache())});for(const[w,E]of[[m,"onLeave"],[p,"onEnter"],[x,"onStay"]])if(w)for(const k of w)(y=(v=this.looseRoutesById[k.routeId].options)[E])==null||y.call(v,k)})})}})}catch(f){we(f)?(o=f,this.navigate({...o.options,replace:!0,ignoreBlocker:!0})):xe(f)&&(i=f);const h=o?o.status:i?404:this.stores.matches.get().some(g=>g.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(h),this.stores.redirect.set(o)})}this.latestLoadPromise===s&&((u=this.commitLocationPromise)==null||u.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),d()})}),this.latestLoadPromise=s,await s;this.latestLoadPromise&&s!==this.latestLoadPromise;)await this.latestLoadPromise;let c;this.hasNotFoundMatch()?c=404:this.stores.matches.get().some(d=>d.status==="error")&&(c=500),c!==void 0&&this.stores.statusCode.set(c)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const i=this.latestLocation,s=this.stores.resolvedLocation.get(),a=typeof r.types=="function"?r.types(It(i,s)):r.types;if(a===!1){n();return}o={update:n,types:a}}else o=n;document.startViewTransition(o)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const o=this.stores.pendingMatchStores.get(n);if(o){o.set(r);return}const i=this.stores.matchStores.get(n);if(i){i.set(r);return}const s=this.stores.cachedMatchStores.get(n);if(s){const a=r(s.get());a.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(c=>c.filter(l=>l!==n)):s.set(a)}})},this.getMatch=n=>{var r,o,i;return((r=this.stores.cachedMatchStores.get(n))==null?void 0:r.get())??((o=this.stores.pendingMatchStores.get(n))==null?void 0:o.get())??((i=this.stores.matchStores.get(n))==null?void 0:i.get())},this.invalidate=n=>{const r=o=>{var i;return((i=n==null?void 0:n.filter)==null?void 0:i.call(n,o))??!0?{...o,invalid:!0,...n!=null&&n.forcePending||o.status==="error"||o.status==="notFound"?{status:"pending",error:void 0}:void 0}:o};return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(r)),this.stores.setCached(this.stores.cachedMatches.get().map(r)),this.stores.setPending(this.stores.pendingMatches.get().map(r))}),this.shouldViewTransition=!1,this.load({sync:n==null?void 0:n.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const o=n.options._builtLocation??this.buildLocation(n.options),i=this.getParsedLocationHref(o);n.options.href=i,n.headers.set("Location",i)}else if(r)try{const o=new URL(r);if(this.origin&&o.origin===this.origin){const i=o.pathname+o.search+o.hash;n.options.href=i,n.headers.set("Location",i)}}catch{}if(n.options.href&&!n.options._builtLocation&&Qn(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n==null?void 0:n.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(o=>!r(o))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),r=o=>{const i=this.looseRoutesById[o.routeId];if(!i.options.loader)return!0;const s=(o.preload?i.options.preloadGcTime??this.options.defaultPreloadGcTime:i.options.gcTime??this.options.defaultGcTime)??300*1e3;return o.status==="error"?!0:n-o.updatedAt>=s};this.clearCache({filter:r})},this.loadRouteChunk=ln,this.preloadRoute=async n=>{const r=n._builtLocation??this.buildLocation(n);let o=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const i=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),s=new Set([...i,...this.stores.cachedIds.get()]),a=o.filter(c=>!s.has(c.id));if(a.length){const c=this.stores.cachedMatches.get();this.stores.setCached([...c,...a])}try{return o=await Li({router:this,matches:o,location:r,preload:!0,updateMatch:(c,l)=>{i.has(c)?o=o.map(d=>d.id===c?l(d):d):this.updateMatch(c,l)}}),o}catch(c){if(we(c))return c.options.reloadDocument?void 0:await this.preloadRoute({...c.options,_fromLocation:r});xe(c)||console.error(c);return}},this.matchRoute=(n,r)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(o);if(r!=null&&r.pending&&this.stores.status.get()!=="pending")return!1;const s=((r==null?void 0:r.pending)===void 0?!this.stores.isLoading.get():r.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=zd(i.pathname,(r==null?void 0:r.caseSensitive)??!1,(r==null?void 0:r.fuzzy)??!1,s.pathname,this.processedTree);return!a||n.params&&!dt(a.rawParams,n.params,{partial:!0})?!1:(r==null?void 0:r.includeSearch)??!0?dt(s.search,i.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??Ud,parseSearch:e.parseSearch??Xd,protocolAllowlist:e.protocolAllowlist??Id}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Ca(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var d,u;const n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:o}=n;let{matchedRoutes:i}=n,s=!1;(r?r.path!=="/"&&o["**"]:Ve(e.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:s=!0);const a=s?yf(this.options.notFoundMode,i):void 0,c=new Array(i.length),l=new Map;for(const f of this.stores.matchStores.values())f.routeId&&l.set(f.routeId,f.get());for(let f=0;f<i.length;f++){const h=i[f],g=c[f-1];let m,p,x;{const b=(g==null?void 0:g.search)??e.search,T=(g==null?void 0:g._strictSearch)??void 0;try{const N=qn(h.options.validateSearch,{...b})??void 0;m={...b,...N},p={...T,...N},x=void 0}catch(N){let I=N;if(N instanceof tr||(I=new tr(N.message,{cause:N})),t!=null&&t.throwOnError)throw I;m=b,p={},x=I}}const v=((u=(d=h.options).loaderDeps)==null?void 0:u.call(d,{search:m}))??"",y=v?JSON.stringify(v):"",{interpolatedPath:w,usedParams:E}=Pi({path:h.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),k=h.id+w+y,S=this.getMatch(k),P=l.get(h.id),M=(S==null?void 0:S._strictParams)??E;let A;if(!S)try{$i(h,M)}catch(b){if(xe(b)||we(b)?A=b:A=new hf(b.message,{cause:b}),t!=null&&t.throwOnError)throw A}Object.assign(o,M);const C=P?"stay":"enter";let R;if(S)R={...S,cause:C,params:(P==null?void 0:P.params)??o,_strictParams:M,search:ot(P?P.search:S.search,m),_strictSearch:p};else{const b=h.options.loader||h.options.beforeLoad||h.lazyFn||La(h)?"pending":"success";R={id:k,ssr:h.options.ssr,index:f,routeId:h.id,params:(P==null?void 0:P.params)??o,_strictParams:M,pathname:w,updatedAt:Date.now(),search:P?ot(P.search,m):m,_strictSearch:p,searchError:void 0,status:b,isFetching:!1,error:void 0,paramsError:A,__routeContext:void 0,_nonReactive:{loadPromise:jt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:P?ct(P.loaderDeps,v):v,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:h.options.staticData||{},fullPath:h.fullPath}}t!=null&&t.preload||(R.globalNotFound=a===h.id),R.searchError=x;const j=this.getParentContext(g);R.context={...j,...R.__routeContext,...R.__beforeLoadContext},c[f]=R}for(let f=0;f<c.length;f++){const h=c[f],g=this.looseRoutesById[h.routeId],m=this.getMatch(h.id),p=l.get(h.routeId);if(h.params=p?ot(p.params,o):o,!m){const x=c[f-1],v=this.getParentContext(x);if(g.options.context){const y={deps:h.loaderDeps,params:h.params,context:v??{},location:e,navigate:w=>this.navigate({...w,_fromLocation:e}),buildLocation:this.buildLocation,cause:h.cause,abortController:h.abortController,preload:!!h.preload,matches:c,routeId:g.id};h.__routeContext=g.options.context(y)??void 0}h.context={...v,...h.__routeContext,...h.__beforeLoadContext}}}return c}matchRoutesLightweight(e){var l;const{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=sn(t),o={...e.search};for(const d of t)try{Object.assign(o,qn(d.options.validateSearch,o))}catch{}const i=sn(this.stores.matchesId.get()),s=i&&((l=this.stores.matchStores.get(i))==null?void 0:l.get()),a=s&&s.routeId===r.id&&s.pathname===e.pathname;let c;if(a)c=s.params;else{const d=Object.assign(Object.create(null),n);for(const u of t)try{$i(u,d)}catch{}c=d}return{matchedRoutes:t,fullPath:r.fullPath,search:o,params:c}}},tr=class extends Error{},hf=class extends Error{};function gf(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function qn(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new tr("Async validation not supported");if(n.issues)throw new tr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function pf({pathname:e,routesById:t,processedTree:n}){const r=Object.create(null),o=Ve(e);let i;const s=$d(o,n,!0);return s&&(i=s.route,Object.assign(r,s.rawParams)),{matchedRoutes:(s==null?void 0:s.branch)||[t.__root__],routeParams:r,foundRoute:i}}function mf({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return xf(n)(e,t,r??!1)}function xf(e){var o;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const i of e){if("search"in i.options)(o=i.options.search)!=null&&o.middlewares&&t.middlewares.push(...i.options.search.middlewares);else if(i.options.preSearchFilters||i.options.postSearchFilters){const s=({search:a,next:c})=>{let l=a;"preSearchFilters"in i.options&&i.options.preSearchFilters&&(l=i.options.preSearchFilters.reduce((u,f)=>f(u),a));const d=c(l);return"postSearchFilters"in i.options&&i.options.postSearchFilters?i.options.postSearchFilters.reduce((u,f)=>f(u),d):d};t.middlewares.push(s)}if(i.options.validateSearch){const s=({search:a,next:c})=>{const l=c(a);if(!t._includeValidateSearch)return l;try{return{...l,...qn(i.options.validateSearch,l)??void 0}}catch{return l}};t.middlewares.push(s)}}const n=({search:i})=>{const s=t.dest;return s.search?s.search===!0?i:at(s.search,i):{}};t.middlewares.push(n);const r=(i,s,a)=>{if(i>=a.length)return s;const c=a[i];return c({search:s,next:d=>r(i+1,d,a)})};return function(s,a,c){return t.dest=a,t._includeValidateSearch=c,r(0,s,t.middlewares)}}function yf(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.children)return r.id}return ft}function $i(e,t){var r;const n=((r=e.options.params)==null?void 0:r.parse)??e.options.parseParams;if(n){const o=n(t);if(o===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,o)}}function wf(){try{return sessionStorage}catch{return}}const vf="tsr-scroll-restoration-v1_3",Rt=wf();function bf(){try{return JSON.parse((Rt==null?void 0:Rt.getItem("tsr-scroll-restoration-v1_3"))||"{}")}catch{return{}}}function _f(){try{Rt==null||Rt.setItem(vf,JSON.stringify(Ze))}catch{}}const Ze=bf(),Di="data-scroll-restoration-id",Sf=e=>e.state.__TSR_key||e.href;function Ef(e){const t=e.getAttribute(Di);if(t)return`[${Di}="${t}"]`;let n="",r=e,o;for(;o=r.parentNode;){let i=1,s=r;for(;s=s.previousElementSibling;)i++;const a=`${r.localName}:nth-child(${i})`;n=n?`${a} > ${n}`:a,r=o}return n}let In=!1;const Ct="window";function go(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function Bi(e){const t=[];for(const n of e){if(n===Ct)continue;const r=go(n);r&&t.push(r)}return t}function kf(e,t){if(e.options.scrollRestoration&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup)return;e.isScrollRestorationSetup=!0,In=!1;const n=e.options.getScrollRestorationKey||Sf,r=new Map,o=(a,c,l)=>{const d=r.get(a)||{};d.scrollX=c,d.scrollY=l,r.set(a,d)};history.scrollRestoration="manual";const i=a=>{if(!(In||!e.isScrollRestoring))if(a.target===document)o(Ct,scrollX,scrollY);else{const c=a.target;o(c,c.scrollLeft,c.scrollTop)}},s=a=>{if(!e.isScrollRestoring)return;const c=Ze[a]||(Ze[a]={});for(const[l,d]of r)l===Ct?c[Ct]=d:l.isConnected&&(c[Ef(l)]=d)};document.addEventListener("scroll",i,!0),e.subscribe("onBeforeLoad",a=>{a.fromLocation&&s(n(a.fromLocation)),r.clear()}),addEventListener("pagehide",()=>{s(n(e.stores.resolvedLocation.get()??e.stores.location.get())),_f()}),e.subscribe("onRendered",a=>{var g;const c=e.options.scrollRestorationBehavior,l=e.options.scrollToTopSelectors,d=e.resetNextScroll;let u;if(r.clear(),d||(e.resetNextScroll=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const f=n(a.toLocation),h=a.fromLocation&&n(a.fromLocation);if(e.isScrollRestoring&&h&&h!==f){const m=Ze[h];if(m){let p=Ze[f];for(const x in m){if(x===Ct){if(d)continue}else{const v=go(x);if(!v||d&&l&&(u??(u=Bi(l)),u.includes(v)))continue}p||(p=Ze[f]={}),p[x]??(p[x]=m[x])}}}In=!0;try{const m=a.toLocation.hash,p=a.toLocation.state.__hashScrollIntoViewOptions??!0;let x=!1;if(d){const v=ho.get(a.toLocation),y=m&&p&&(v==="PUSH"||v==="REPLACE"),w=e.isScrollRestoring?Ze[f]:void 0;if(w)for(const E in w){const{scrollX:k,scrollY:S}=w[E];if(E===Ct){if(y)continue;scrollTo({top:S,left:k,behavior:c}),x=!0}else{const P=go(E);P&&(P.scrollLeft=k,P.scrollTop=S)}}if(!x&&!m){const E={top:0,left:0,behavior:c};if(scrollTo(E),l){u??(u=Bi(l));for(const k of u)k.scrollTo(E)}}}!x&&m&&p&&((g=document.getElementById(m))==null||g.scrollIntoView(p))}finally{In=!1}})}const Cf="Error preloading route! ☝️";var Aa=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var c,l;this.originalIndex=t.originalIndex;const n=this.options,r=!(n!=null&&n.path)&&!(n!=null&&n.id);this.parentRoute=(l=(c=this.options).getParentRoute)==null?void 0:l.call(c),r?this._path=ft:this.parentRoute||We();let o=r?ft:n==null?void 0:n.path;o&&o!=="/"&&(o=Pa(o));const i=(n==null?void 0:n.id)||o;let s=r?ft:Hn([this.parentRoute.id==="__root__"?"":this.parentRoute.id,i]);o==="__root__"&&(o="/"),s!=="__root__"&&(s=Hn(["/",s]));const a=s==="__root__"?"/":Hn([this.parentRoute.fullPath,o]);this._path=o,this._id=s,this._fullPath=a,this._to=Ve(a)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>Qd({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},Pf=class extends Aa{constructor(e){super(e)}};function Do(e){const t=e.errorComponent??Bo;return _.jsx(Mf,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?L.createElement(t,{error:n,reset:r}):e.children})}var Mf=class extends L.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Bo({error:e}){const[t,n]=L.useState(!1);return _.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[_.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),_.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),_.jsx("div",{style:{height:".25rem"}}),t?_.jsx("div",{children:_.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?_.jsx("code",{children:e.message}):null})}):null]})}function Nf({children:e,fallback:t=null}){return ja()?_.jsx(At.Fragment,{children:e}):_.jsx(At.Fragment,{children:t})}function ja(){return At.useSyncExternalStore(If,()=>!0,()=>!1)}function If(){return()=>{}}var za=L.createContext(null);function Ee(e){return L.useContext(za)}var yr=L.createContext(void 0),Rf=L.createContext(void 0),ue=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(ue||{});function Lf({update:e,notify:t,unwatched:n}){return{link:r,unlink:o,propagate:i,checkDirty:s,shallowPropagate:a};function r(l,d,u){const f=d.depsTail;if(f!==void 0&&f.dep===l)return;const h=f!==void 0?f.nextDep:d.deps;if(h!==void 0&&h.dep===l){h.version=u,d.depsTail=h;return}const g=l.subsTail;if(g!==void 0&&g.version===u&&g.sub===d)return;const m=d.depsTail=l.subsTail={version:u,dep:l,sub:d,prevDep:f,nextDep:h,prevSub:g,nextSub:void 0};h!==void 0&&(h.prevDep=m),f!==void 0?f.nextDep=m:d.deps=m,g!==void 0?g.nextSub=m:l.subs=m}function o(l,d=l.sub){const u=l.dep,f=l.prevDep,h=l.nextDep,g=l.nextSub,m=l.prevSub;return h!==void 0?h.prevDep=f:d.depsTail=f,f!==void 0?f.nextDep=h:d.deps=h,g!==void 0?g.prevSub=m:u.subsTail=m,m!==void 0?m.nextSub=g:(u.subs=g)===void 0&&n(u),h}function i(l){let d=l.nextSub,u;e:do{const f=l.sub;let h=f.flags;if(h&60?h&12?h&4?!(h&48)&&c(l,f)?(f.flags=h|40,h&=1):h=0:f.flags=h&-9|32:h=0:f.flags=h|32,h&2&&t(f),h&1){const g=f.subs;if(g!==void 0){const m=(l=g).nextSub;m!==void 0&&(u={value:d,prev:u},d=m);continue}}if((l=d)!==void 0){d=l.nextSub;continue}for(;u!==void 0;)if(l=u.value,u=u.prev,l!==void 0){d=l.nextSub;continue e}break}while(!0)}function s(l,d){let u,f=0,h=!1;e:do{const g=l.dep,m=g.flags;if(d.flags&16)h=!0;else if((m&17)===17){if(e(g)){const p=g.subs;p.nextSub!==void 0&&a(p),h=!0}}else if((m&33)===33){(l.nextSub!==void 0||l.prevSub!==void 0)&&(u={value:l,prev:u}),l=g.deps,d=g,++f;continue}if(!h){const p=l.nextDep;if(p!==void 0){l=p;continue}}for(;f--;){const p=d.subs,x=p.nextSub!==void 0;if(x?(l=u.value,u=u.prev):l=p,h){if(e(d)){x&&a(p),d=l.sub;continue}h=!1}else d.flags&=-33;d=l.sub;const v=l.nextDep;if(v!==void 0){l=v;continue e}}return h}while(!0)}function a(l){do{const d=l.sub,u=d.flags;(u&48)===32&&(d.flags=u|16,(u&6)===2&&t(d))}while((l=l.nextSub)!==void 0)}function c(l,d){let u=d.depsTail;for(;u!==void 0;){if(u===l)return!0;u=u.prevDep}return!1}}function Tf(e,t,n){var i,s,a;const r=typeof e=="object",o=r?e:void 0;return{next:(i=r?e.next:e)==null?void 0:i.bind(o),error:(s=r?e.error:t)==null?void 0:s.bind(o),complete:(a=r?e.complete:n)==null?void 0:a.bind(o)}}const po=[];let Wn=0;const{link:Oi,unlink:Af,propagate:jf,checkDirty:$a,shallowPropagate:Fi}=Lf({update(e){return e._update()},notify(e){po[mo++]=e,e.flags&=~ue.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ue.Mutable|ue.Dirty,nr(e))}});let Rn=0,mo=0,je,xo=0;function Da(e){try{++xo,e()}finally{--xo||Ba()}}function nr(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Af(n,e)}function Ba(){if(!(xo>0)){for(;Rn<mo;){const e=po[Rn];po[Rn++]=void 0,e.notify()}Rn=0,mo=0}}function Hi(e,t){const n=typeof e=="function",r=e,o={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?ue.None:ue.Mutable,get(){return je!==void 0&&Oi(o,je,Wn),o._snapshot},subscribe(i){const s=Tf(i),a={current:!1},c=zf(()=>{var l;o.get(),a.current?(l=s.next)==null||l.call(s,o._snapshot):a.current=!0});return{unsubscribe:()=>{c.stop()}}},_update(i){const s=je,a=(t==null?void 0:t.compare)??Object.is;if(n)je=o,++Wn,o.depsTail=void 0;else if(i===void 0)return!1;n&&(o.flags=ue.Mutable|ue.RecursedCheck);try{const c=o._snapshot,l=typeof i=="function"?i(c):i===void 0&&n?r(c):i;return c===void 0||!a(c,l)?(o._snapshot=l,!0):!1}finally{je=s,n&&(o.flags&=~ue.RecursedCheck),nr(o)}}};return n?(o.flags=ue.Mutable|ue.Dirty,o.get=function(){const i=o.flags;if(i&ue.Dirty||i&ue.Pending&&$a(o.deps,o)){if(o._update()){const s=o.subs;s!==void 0&&Fi(s)}}else i&ue.Pending&&(o.flags=i&~ue.Pending);return je!==void 0&&Oi(o,je,Wn),o._snapshot}):o.set=function(i){if(o._update(i)){const s=o.subs;s!==void 0&&(jf(s),Fi(s),Ba())}},o}function zf(e){const t=()=>{const r=je;je=n,++Wn,n.depsTail=void 0,n.flags=ue.Watching|ue.RecursedCheck;try{return e()}finally{je=r,n.flags&=~ue.RecursedCheck,nr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ue.Watching|ue.RecursedCheck,notify(){const r=this.flags;r&ue.Dirty||r&ue.Pending&&$a(this.deps,this)?t():this.flags=ue.Watching},stop(){this.flags=ue.None,this.depsTail=void 0,nr(this)}};return t(),n}var Vr={exports:{}},qr={},Wr={exports:{}},Yr={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* use-sync-external-store-shim.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Vi;function $f(){if(Vi)return Yr;Vi=1;var e=xa();function t(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(u,f){var h=f(),g=r({inst:{value:h,getSnapshot:f}}),m=g[0].inst,p=g[1];return i(function(){m.value=h,m.getSnapshot=f,c(m)&&p({inst:m})},[u,h,f]),o(function(){return c(m)&&p({inst:m}),u(function(){c(m)&&p({inst:m})})},[u]),s(h),h}function c(u){var f=u.getSnapshot;u=u.value;try{var h=f();return!n(u,h)}catch{return!0}}function l(u,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Yr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Yr}var qi;function Df(){return qi||(qi=1,Wr.exports=$f()),Wr.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Wi;function Bf(){if(Wi)return qr;Wi=1;var e=xa(),t=Df();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return qr.useSyncExternalStoreWithSelector=function(l,d,u,f,h){var g=i(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=a(function(){function x(k){if(!v){if(v=!0,y=k,k=f(k),h!==void 0&&m.hasValue){var S=m.value;if(h(S,k))return w=S}return w=k}if(S=w,r(y,k))return S;var P=f(k);return h!==void 0&&h(S,P)?(y=k,S):(y=k,w=P)}var v=!1,y,w,E=u===void 0?null:u;return[function(){return x(d())},E===null?void 0:function(){return x(E())}]},[d,u,f,h]);var p=o(l,g[0],g[1]);return s(function(){m.hasValue=!0,m.value=p},[p]),c(p),p},qr}var Yi;function Of(){return Yi||(Yi=1,Vr.exports=Bf()),Vr.exports}var Oa=Of();const Ff=fd(Oa);function Hf(e,t){return e===t}function _e(e,t,n=Hf){const r=L.useCallback(s=>{if(!e)return()=>{};const{unsubscribe:a}=e.subscribe(s);return a},[e]),o=L.useCallback(()=>e==null?void 0:e.get(),[e]);return Oa.useSyncExternalStoreWithSelector(r,o,o,t,n)}var Vf={get:()=>{},subscribe:()=>({unsubscribe:()=>{}})};function _t(e){const t=Ee(),n=L.useContext(e.from?Rf:yr),r=e.from??n,o=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,i=L.useRef(void 0);return _e(o??Vf,s=>{if((e.shouldThrow??!0)&&!s&&We(),s===void 0)return;const a=e.select?e.select(s):s;if(e.structuralSharing??t.options.defaultStructuralSharing){const c=ct(i.current,a);return i.current=c,c}return a})}function Fa(e){return _t({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ha(e){const{select:t,...n}=e;return _t({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Va(e){return _t({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Oo(e){return _t({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Fo(e){const t=Ee();return L.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function qa(e){return _t({...e,select:t=>e.select?e.select(t.context):t.context})}var qf=hd();function Wf(e,t){const n=Ee(),r=Cd(t),{activeProps:o,inactiveProps:i,activeOptions:s,to:a,preload:c,preloadDelay:l,preloadIntentProximity:d,hashScrollIntoView:u,replace:f,startTransition:h,resetScroll:g,viewTransition:m,children:p,target:x,disabled:v,style:y,className:w,onClick:E,onBlur:k,onFocus:S,onMouseEnter:P,onMouseLeave:M,onTouchStart:A,ignoreBlocker:C,params:R,search:j,hash:b,state:T,mask:N,reloadDocument:I,unsafeRelative:$,from:z,_fromLocation:F,...O}=e,B=ja(),V=L.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),q=_e(n.stores.location,ee=>ee,(ee,le)=>ee.href===le.href),W=L.useMemo(()=>{const ee={_fromLocation:q,...V};return n.buildLocation(ee)},[n,q,V]),Q=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,U=W.maskedLocation?W.maskedLocation.external:W.external,D=L.useMemo(()=>Zf(Q,U,n.history,v),[v,U,Q,n.history]),H=L.useMemo(()=>{if(D!=null&&D.external)return Qn(D.href,n.protocolAllowlist)?void 0:D.href;if(!Qf(a)&&!(typeof a!="string"||a.indexOf(":")===-1))try{return new URL(a),Qn(a,n.protocolAllowlist)?void 0:a}catch{}},[a,D,n.protocolAllowlist]),Z=L.useMemo(()=>{if(H)return!1;if(s!=null&&s.exact){if(!Vd(q.pathname,W.pathname,n.basepath))return!1}else{const ee=Jn(q.pathname,n.basepath),le=Jn(W.pathname,n.basepath);if(!(ee.startsWith(le)&&(ee.length===le.length||ee[le.length]==="/")))return!1}return((s==null?void 0:s.includeSearch)??!0)&&!dt(q.search,W.search,{partial:!(s!=null&&s.exact),ignoreUndefined:!(s!=null&&s.explicitUndefined)})?!1:s!=null&&s.includeHash?B&&q.hash===W.hash:!0},[s==null?void 0:s.exact,s==null?void 0:s.explicitUndefined,s==null?void 0:s.includeHash,s==null?void 0:s.includeSearch,q,H,B,W.hash,W.pathname,W.search,n.basepath]),K=Z?at(o,{})??Yf:Gr,Y=Z?Gr:at(i,{})??Gr,G=[w,K.className,Y.className].filter(Boolean).join(" "),J=(y||K.style||Y.style)&&{...y,...K.style,...Y.style},[ie,se]=L.useState(!1),ce=L.useRef(!1),ge=e.reloadDocument||H?!1:c??n.options.defaultPreload,ye=l??n.options.defaultPreloadDelay??0,pe=L.useCallback(()=>{n.preloadRoute({...V,_builtLocation:W}).catch(ee=>{console.warn(ee),console.warn(Cf)})},[n,V,W]);kd(r,L.useCallback(ee=>{ee!=null&&ee.isIntersecting&&pe()},[pe]),Kf,{disabled:!!v||ge!=="viewport"}),L.useEffect(()=>{ce.current||!v&&ge==="render"&&(pe(),ce.current=!0)},[v,pe,ge]);const Pe=ee=>{const le=ee.currentTarget.getAttribute("target"),me=x!==void 0?x:le;if(!v&&!Jf(ee)&&!ee.defaultPrevented&&(!me||me==="_self")&&ee.button===0){ee.preventDefault(),qf.flushSync(()=>{se(!0)});const Fe=n.subscribe("onResolved",()=>{Fe(),se(!1)});n.navigate({...V,replace:f,resetScroll:g,hashScrollIntoView:u,startTransition:h,viewTransition:m,ignoreBlocker:C})}};if(H)return{...O,ref:r,href:H,...p&&{children:p},...x&&{target:x},...v&&{disabled:v},...y&&{style:y},...w&&{className:w},...E&&{onClick:E},...k&&{onBlur:k},...S&&{onFocus:S},...P&&{onMouseEnter:P},...M&&{onMouseLeave:M},...A&&{onTouchStart:A}};const Xe=ee=>{if(v||ge!=="intent")return;if(!ye){pe();return}const le=ee.currentTarget;if(Ut.has(le))return;const me=setTimeout(()=>{Ut.delete(le),pe()},ye);Ut.set(le,me)},Oe=ee=>{v||ge!=="intent"||pe()},Ae=ee=>{if(v||!ge||!ye)return;const le=ee.currentTarget,me=Ut.get(le);me&&(clearTimeout(me),Ut.delete(le))};return{...O,...K,...Y,href:D==null?void 0:D.href,ref:r,onClick:Et([E,Pe]),onBlur:Et([k,Ae]),onFocus:Et([S,Xe]),onMouseEnter:Et([P,Xe]),onMouseLeave:Et([M,Ae]),onTouchStart:Et([A,Oe]),disabled:!!v,target:x,...J&&{style:J},...G&&{className:G},...v&&Gf,...Z&&Xf,...B&&ie&&Uf}}var Gr={},Yf={className:"active"},Gf={role:"link","aria-disabled":!0},Xf={"data-status":"active","aria-current":"page"},Uf={"data-transitioning":"transitioning"},Ut=new WeakMap,Kf={rootMargin:"100px"},Et=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Zf(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function Qf(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Wa=L.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:o,...i}=Wf(r,t),s=typeof r.children=="function"?r.children({isActive:i["data-status"]==="active"}):r.children;if(!n){const{disabled:a,...c}=i;return L.createElement("a",c,s)}return L.createElement(n,i,s)});function Jf(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var eh=class extends Aa{constructor(e){super(e),this.useMatch=t=>_t({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>qa({...t,from:this.id}),this.useSearch=t=>Oo({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Va({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Ha({...t,from:this.id}),this.useLoaderData=t=>Fa({...t,from:this.id}),this.useNavigate=()=>Fo({from:this.fullPath}),this.Link=At.forwardRef((t,n)=>_.jsx(Wa,{ref:n,from:this.fullPath,...t}))}};function th(e){return new eh(e)}var nh=class extends Pf{constructor(e){super(e),this.useMatch=t=>_t({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>qa({...t,from:this.id}),this.useSearch=t=>Oo({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Va({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Ha({...t,from:this.id}),this.useLoaderData=t=>Fa({...t,from:this.id}),this.useNavigate=()=>Fo({from:this.fullPath}),this.Link=At.forwardRef((t,n)=>_.jsx(Wa,{ref:n,from:this.fullPath,...t}))}};function rh(e){return new nh(e)}function oh(e){const t=Ee(),n=`not-found-${_e(t.stores.location,r=>r.pathname)}-${_e(t.stores.status,r=>r)}`;return _.jsx(Do,{getResetKey:()=>n,onCatch:(r,o)=>{var i;if(xe(r))(i=e.onCatch)==null||i.call(e,r,o);else throw r},errorComponent:({error:r})=>{var o;if(xe(r))return(o=e.fallback)==null?void 0:o.call(e,r);throw r},children:e.children})}function ih(){return _.jsx("p",{children:"Not Found"})}function Pt(e){return _.jsx(_.Fragment,{children:e.children})}function Ya(e,t,n){return t.options.notFoundComponent?_.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?_.jsx(e.options.defaultNotFoundComponent,{...n}):_.jsx(ih,{})}function sh(e){return null}function ah(){return sh(Ee()),null}var Ga=L.memo(function({matchId:t}){const n=Ee(),r=n.stores.matchStores.get(t);r||We();const o=_e(n.stores.loadedAt,s=>s),i=_e(r,s=>s);return _.jsx(ch,{router:n,matchId:t,resetKey:o,matchState:L.useMemo(()=>{var c;const s=i.routeId,a=(c=n.routesById[s].parentRoute)==null?void 0:c.id;return{routeId:s,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:a}},[i._displayPending,i.routeId,i.ssr,n.routesById])})});function ch({router:e,matchId:t,resetKey:n,matchState:r}){var g,m;const o=e.routesById[r.routeId],i=o.options.pendingComponent??e.options.defaultPendingComponent,s=i?_.jsx(i,{}):null,a=o.options.errorComponent??e.options.defaultErrorComponent,c=o.options.onCatch??e.options.defaultOnCatch,l=o.isRoot?o.options.notFoundComponent??((g=e.options.notFoundRoute)==null?void 0:g.options.component):o.options.notFoundComponent,d=r.ssr===!1||r.ssr==="data-only",u=(!o.isRoot||o.options.wrapInSuspense||d)&&(o.options.wrapInSuspense??i??(((m=o.options.errorComponent)==null?void 0:m.preload)||d))?L.Suspense:Pt,f=a?Do:Pt,h=l?oh:Pt;return _.jsxs(o.isRoot?o.options.shellComponent??Pt:Pt,{children:[_.jsx(yr.Provider,{value:t,children:_.jsx(u,{fallback:s,children:_.jsx(f,{getResetKey:()=>n,errorComponent:a||Bo,onCatch:(p,x)=>{if(xe(p))throw p.routeId??(p.routeId=r.routeId),p;c==null||c(p,x)},children:_.jsx(h,{fallback:p=>{if(p.routeId??(p.routeId=r.routeId),!l||p.routeId&&p.routeId!==r.routeId||!p.routeId&&!o.isRoot)throw p;return L.createElement(l,p)},children:d||r._displayPending?_.jsx(Nf,{fallback:s,children:_.jsx(Gi,{matchId:t})}):_.jsx(Gi,{matchId:t})})})})}),r.parentRouteId===ft?_.jsxs(_.Fragment,{children:[_.jsx(lh,{resetKey:n}),e.options.scrollRestoration&&va?_.jsx(ah,{}):null]}):null]})}function lh({resetKey:e}){const t=Ee(),n=L.useRef(void 0);return Jt(()=>{const r=t.latestLocation.href;(n.current===void 0||n.current!==r)&&(t.emit({type:"onRendered",...It(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=r)},[t.latestLocation.state.__TSR_key,e,t]),null}var Gi=L.memo(function({matchId:t}){const n=Ee(),r=(d,u)=>{var f;return((f=n.getMatch(d.id))==null?void 0:f._nonReactive[u])??d._nonReactive[u]},o=n.stores.matchStores.get(t);o||We();const i=_e(o,d=>d),s=i.routeId,a=n.routesById[s],c=L.useMemo(()=>{var u;const d=(u=n.routesById[s].options.remountDeps??n.options.defaultRemountDeps)==null?void 0:u({routeId:s,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return d?JSON.stringify(d):void 0},[s,i.loaderDeps,i._strictParams,i._strictSearch,n.options.defaultRemountDeps,n.routesById]),l=L.useMemo(()=>{const d=a.options.component??n.options.defaultComponent;return d?_.jsx(d,{},c):_.jsx(Xa,{})},[c,a.options.component,n.options.defaultComponent]);if(i._displayPending)throw r(i,"displayPendingPromise");if(i._forcePending)throw r(i,"minPendingPromise");if(i.status==="pending"){const d=a.options.pendingMinMs??n.options.defaultPendingMinMs;if(d){const u=n.getMatch(i.id);if(u&&!u._nonReactive.minPendingPromise){const f=jt();u._nonReactive.minPendingPromise=f,setTimeout(()=>{f.resolve(),u._nonReactive.minPendingPromise=void 0},d)}}throw r(i,"loadPromise")}if(i.status==="notFound")return xe(i.error)||We(),Ya(n,a,i.error);if(i.status==="redirected")throw we(i.error)||We(),r(i,"loadPromise");if(i.status==="error")throw i.error;return l}),Xa=L.memo(function(){const t=Ee(),n=L.useContext(yr);let r,o=!1,i;{const l=n?t.stores.matchStores.get(n):void 0;[r,o]=_e(l,d=>[d==null?void 0:d.routeId,(d==null?void 0:d.globalNotFound)??!1]),i=_e(t.stores.matchesId,d=>d[d.findIndex(u=>u===n)+1])}const s=r?t.routesById[r]:void 0,a=t.options.defaultPendingComponent?_.jsx(t.options.defaultPendingComponent,{}):null;if(o)return s||We(),Ya(t,s,void 0);if(!i)return null;const c=_.jsx(Ga,{matchId:i});return r===ft?_.jsx(L.Suspense,{fallback:a,children:c}):c});function uh(){const e=Ee(),t=L.useRef({router:e,mounted:!1}),[n,r]=L.useState(!1),o=_e(e.stores.isLoading,u=>u),i=_e(e.stores.hasPending,u=>u),s=zr(o),a=o||n||i,c=zr(a),l=o||i,d=zr(l);return e.startTransition=u=>{r(!0),L.startTransition(()=>{u(),r(!1)})},L.useEffect(()=>{const u=e.history.subscribe(e.load),f=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ve(e.latestLocation.publicHref)!==Ve(f.publicHref)&&e.commitLocation({...f,replace:!0}),()=>{u()}},[e,e.history]),Jt(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(f){console.error(f)}})()},[e]),Jt(()=>{s&&!o&&e.emit({type:"onLoad",...It(e.stores.location.get(),e.stores.resolvedLocation.get())})},[s,e,o]),Jt(()=>{d&&!l&&e.emit({type:"onBeforeRouteMount",...It(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,d,e]),Jt(()=>{if(c&&!a){const u=It(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...u}),Da(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[a,c,e]),null}function dh(){const e=Ee(),t=e.routesById[ft].options.pendingComponent??e.options.defaultPendingComponent,n=t?_.jsx(t,{}):null,r=_.jsxs(typeof document<"u"&&e.ssr?Pt:L.Suspense,{fallback:n,children:[_.jsx(uh,{}),_.jsx(fh,{})]});return e.options.InnerWrap?_.jsx(e.options.InnerWrap,{children:r}):r}function fh(){const e=Ee(),t=_e(e.stores.firstId,o=>o),n=_e(e.stores.loadedAt,o=>o),r=t?_.jsx(Ga,{matchId:t}):null;return _.jsx(yr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:_.jsx(Do,{getResetKey:()=>n,errorComponent:Bo,onCatch:void 0,children:r})})}var hh=e=>({createMutableStore:Hi,createReadonlyStore:Hi,batch:Da}),gh=e=>new ph(e),ph=class extends ff{constructor(e){super(e,hh)}};function mh({router:e,children:t,...n}){_a(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=_.jsx(za.Provider,{value:e,children:t});return e.options.Wrap?_.jsx(e.options.Wrap,{children:r}):r}function xh({router:e,...t}){return _.jsx(mh,{router:e,...t,children:_.jsx(dh,{})})}var Kt={},Xi;function yh(){if(Xi)return Kt;Xi=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.styleq=void 0;var e=new WeakMap,t="$$css";function n(o){var i,s,a;return o!=null&&(i=o.disableCache===!0,s=o.disableMix===!0,a=o.transform),function(){for(var l=[],d="",u=null,f=i?null:e,h=new Array(arguments.length),g=0;g<arguments.length;g++)h[g]=arguments[g];for(;h.length>0;){var m=h.pop();if(!(m==null||m===!1)){if(Array.isArray(m)){for(var p=0;p<m.length;p++)h.push(m[p]);continue}var x=a!=null?a(m):m;if(x.$$css){var v="";if(f!=null&&f.has(x)){var y=f.get(x);y!=null&&(v=y[0],l.push.apply(l,y[1]),f=y[2])}else{var w=[];for(var E in x){var k=x[E];E!==t&&(typeof k=="string"||k===null?l.includes(E)||(l.push(E),f!=null&&w.push(E),typeof k=="string"&&(v+=v?" "+k:k)):console.error("styleq: ".concat(E," typeof ").concat(String(k),' is not "string" or "null".')))}if(f!=null){var S=new WeakMap;f.set(x,[v,w,S]),f=S}}v&&(d=d?v+" "+d:v)}else if(s)u==null&&(u={}),u=Object.assign({},x,u);else{var P=null;for(var M in x){var A=x[M];A!==void 0&&(l.includes(M)||(A!=null&&(u==null&&(u={}),P==null&&(P={}),P[M]=A),l.push(M),f=null))}P!=null&&(u=Object.assign(P,u))}}}var C=[d,u];return C}}var r=n();return Kt.styleq=r,r.factory=n,Kt}var wh=yh();function Ho(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const[r,o]=wh.styleq(t),i={};return r!=null&&r!==""&&(i.className=r),o!=null&&Object.keys(o).length>0&&(i.style=o),i}function he(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=he(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var vh={value:()=>{}};function wr(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Yn(n)}function Yn(e){this._=e}function bh(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Yn.prototype=wr.prototype={constructor:Yn,on:function(e,t){var n=this._,r=bh(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=_h(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Ui(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Ui(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Yn(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function _h(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Ui(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=vh,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var yo="http://www.w3.org/1999/xhtml";const Ki={svg:"http://www.w3.org/2000/svg",xhtml:yo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vr(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ki.hasOwnProperty(t)?{space:Ki[t],local:e}:e}function Sh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===yo&&t.documentElement.namespaceURI===yo?t.createElement(e):t.createElementNS(n,e)}}function Eh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ua(e){var t=vr(e);return(t.local?Eh:Sh)(t)}function kh(){}function Vo(e){return e==null?kh:function(){return this.querySelector(e)}}function Ch(e){typeof e!="function"&&(e=Vo(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new Se(r,this._parents)}function Ph(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Mh(){return[]}function Ka(e){return e==null?Mh:function(){return this.querySelectorAll(e)}}function Nh(e){return function(){return Ph(e.apply(this,arguments))}}function Ih(e){typeof e=="function"?e=Nh(e):e=Ka(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),o.push(c));return new Se(r,o)}function Za(e){return function(){return this.matches(e)}}function Qa(e){return function(t){return t.matches(e)}}var Rh=Array.prototype.find;function Lh(e){return function(){return Rh.call(this.children,e)}}function Th(){return this.firstElementChild}function Ah(e){return this.select(e==null?Th:Lh(typeof e=="function"?e:Qa(e)))}var jh=Array.prototype.filter;function zh(){return Array.from(this.children)}function $h(e){return function(){return jh.call(this.children,e)}}function Dh(e){return this.selectAll(e==null?zh:$h(typeof e=="function"?e:Qa(e)))}function Bh(e){typeof e!="function"&&(e=Za(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Se(r,this._parents)}function Ja(e){return new Array(e.length)}function Oh(){return new Se(this._enter||this._groups.map(Ja),this._parents)}function rr(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rr.prototype={constructor:rr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Fh(e){return function(){return e}}function Hh(e,t,n,r,o,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new rr(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function Vh(e,t,n,r,o,i,s){var a,c,l=new Map,d=t.length,u=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?o[a]=c:l.set(h,c));for(a=0;a<u;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(r[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new rr(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function qh(e){return e.__data__}function Wh(e,t){if(!arguments.length)return Array.from(this,qh);var n=t?Vh:Hh,r=this._parents,o=this._groups;typeof e!="function"&&(e=Fh(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=r[l],u=o[l],f=u.length,h=Yh(e.call(d,d&&d.__data__,l,r)),g=h.length,m=a[l]=new Array(g),p=s[l]=new Array(g),x=c[l]=new Array(f);n(d,u,m,p,x,h,t);for(var v=0,y=0,w,E;v<g;++v)if(w=m[v]){for(v>=y&&(y=v+1);!(E=p[y])&&++y<g;);w._next=E||null}}return s=new Se(s,r),s._enter=a,s._exit=c,s}function Yh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Gh(){return new Se(this._exit||this._groups.map(Ja),this._parents)}function Xh(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Uh(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),h,g=0;g<u;++g)(h=l[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new Se(a,this._parents)}function Kh(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Zh(e){e||(e=Qh);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new Se(o,this._parents).order()}function Qh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Jh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function eg(){return Array.from(this)}function tg(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function ng(){let e=0;for(const t of this)++e;return e}function rg(){return!this.node()}function og(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function ig(e){return function(){this.removeAttribute(e)}}function sg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ag(e,t){return function(){this.setAttribute(e,t)}}function cg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function lg(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ug(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function dg(e,t){var n=vr(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?sg:ig:typeof t=="function"?n.local?ug:lg:n.local?cg:ag)(n,t))}function ec(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fg(e){return function(){this.style.removeProperty(e)}}function hg(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gg(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function pg(e,t,n){return arguments.length>1?this.each((t==null?fg:typeof t=="function"?gg:hg)(e,t,n??"")):zt(this.node(),e)}function zt(e,t){return e.style.getPropertyValue(t)||ec(e).getComputedStyle(e,null).getPropertyValue(t)}function mg(e){return function(){delete this[e]}}function xg(e,t){return function(){this[e]=t}}function yg(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wg(e,t){return arguments.length>1?this.each((t==null?mg:typeof t=="function"?yg:xg)(e,t)):this.node()[e]}function tc(e){return e.trim().split(/^|\s+/)}function qo(e){return e.classList||new nc(e)}function nc(e){this._node=e,this._names=tc(e.getAttribute("class")||"")}nc.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function rc(e,t){for(var n=qo(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function oc(e,t){for(var n=qo(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function vg(e){return function(){rc(this,e)}}function bg(e){return function(){oc(this,e)}}function _g(e,t){return function(){(t.apply(this,arguments)?rc:oc)(this,e)}}function Sg(e,t){var n=tc(e+"");if(arguments.length<2){for(var r=qo(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?_g:t?vg:bg)(n,t))}function Eg(){this.textContent=""}function kg(e){return function(){this.textContent=e}}function Cg(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Pg(e){return arguments.length?this.each(e==null?Eg:(typeof e=="function"?Cg:kg)(e)):this.node().textContent}function Mg(){this.innerHTML=""}function Ng(e){return function(){this.innerHTML=e}}function Ig(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Rg(e){return arguments.length?this.each(e==null?Mg:(typeof e=="function"?Ig:Ng)(e)):this.node().innerHTML}function Lg(){this.nextSibling&&this.parentNode.appendChild(this)}function Tg(){return this.each(Lg)}function Ag(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jg(){return this.each(Ag)}function zg(e){var t=typeof e=="function"?e:Ua(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function $g(){return null}function Dg(e,t){var n=typeof e=="function"?e:Ua(e),r=t==null?$g:typeof t=="function"?t:Vo(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Bg(){var e=this.parentNode;e&&e.removeChild(this)}function Og(){return this.each(Bg)}function Fg(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hg(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vg(e){return this.select(e?Hg:Fg)}function qg(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Wg(e){return function(t){e.call(this,t,this.__data__)}}function Yg(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Gg(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Xg(e,t,n){return function(){var r=this.__on,o,i=Wg(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Ug(e,t,n){var r=Yg(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Xg:Gg,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function ic(e,t,n){var r=ec(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Kg(e,t){return function(){return ic(this,e,t)}}function Zg(e,t){return function(){return ic(this,e,t.apply(this,arguments))}}function Qg(e,t){return this.each((typeof t=="function"?Zg:Kg)(e,t))}function*Jg(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var sc=[null];function Se(e,t){this._groups=e,this._parents=t}function vn(){return new Se([[document.documentElement]],sc)}function ep(){return this}Se.prototype=vn.prototype={constructor:Se,select:Ch,selectAll:Ih,selectChild:Ah,selectChildren:Dh,filter:Bh,data:Wh,enter:Oh,exit:Gh,join:Xh,merge:Uh,selection:ep,order:Kh,sort:Zh,call:Jh,nodes:eg,node:tg,size:ng,empty:rg,each:og,attr:dg,style:pg,property:wg,classed:Sg,text:Pg,html:Rg,raise:Tg,lower:jg,append:zg,insert:Dg,remove:Og,clone:Vg,datum:qg,on:Ug,dispatch:Qg,[Symbol.iterator]:Jg};function be(e){return typeof e=="string"?new Se([[document.querySelector(e)]],[document.documentElement]):new Se([[e]],sc)}function tp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Me(e,t){if(e=tp(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const np={passive:!1},un={capture:!0,passive:!1};function Xr(e){e.stopImmediatePropagation()}function Lt(e){e.preventDefault(),e.stopImmediatePropagation()}function ac(e){var t=e.document.documentElement,n=be(e).on("dragstart.drag",Lt,un);"onselectstart"in t?n.on("selectstart.drag",Lt,un):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function cc(e,t){var n=e.document.documentElement,r=be(e).on("dragstart.drag",null);t&&(r.on("click.drag",Lt,un),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ln=e=>()=>e;function wo(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}wo.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function rp(e){return!e.ctrlKey&&!e.button}function op(){return this.parentNode}function ip(e,t){return t??{x:e.x,y:e.y}}function sp(){return navigator.maxTouchPoints||"ontouchstart"in this}function lc(){var e=rp,t=op,n=ip,r=sp,o={},i=wr("start","drag","end"),s=0,a,c,l,d,u=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",p).on("touchmove.drag",x,np).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,E){if(!(d||!e.call(this,w,E))){var k=y(this,t.call(this,w,E),w,E,"mouse");k&&(be(w.view).on("mousemove.drag",g,un).on("mouseup.drag",m,un),ac(w.view),Xr(w),l=!1,a=w.clientX,c=w.clientY,k("start",w))}}function g(w){if(Lt(w),!l){var E=w.clientX-a,k=w.clientY-c;l=E*E+k*k>u}o.mouse("drag",w)}function m(w){be(w.view).on("mousemove.drag mouseup.drag",null),cc(w.view,l),Lt(w),o.mouse("end",w)}function p(w,E){if(e.call(this,w,E)){var k=w.changedTouches,S=t.call(this,w,E),P=k.length,M,A;for(M=0;M<P;++M)(A=y(this,S,w,E,k[M].identifier,k[M]))&&(Xr(w),A("start",w,k[M]))}}function x(w){var E=w.changedTouches,k=E.length,S,P;for(S=0;S<k;++S)(P=o[E[S].identifier])&&(Lt(w),P("drag",w,E[S]))}function v(w){var E=w.changedTouches,k=E.length,S,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),S=0;S<k;++S)(P=o[E[S].identifier])&&(Xr(w),P("end",w,E[S]))}function y(w,E,k,S,P,M){var A=i.copy(),C=Me(M||k,E),R,j,b;if((b=n.call(w,new wo("beforestart",{sourceEvent:k,target:f,identifier:P,active:s,x:C[0],y:C[1],dx:0,dy:0,dispatch:A}),S))!=null)return R=b.x-C[0]||0,j=b.y-C[1]||0,function T(N,I,$){var z=C,F;switch(N){case"start":o[P]=T,F=s++;break;case"end":delete o[P],--s;case"drag":C=Me($||I,E),F=s;break}A.call(N,w,new wo(N,{sourceEvent:I,subject:b,target:f,identifier:P,active:F,x:C[0]+R,y:C[1]+j,dx:C[0]-z[0],dy:C[1]-z[1],dispatch:A}),S)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ln(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Ln(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Ln(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Ln(!!w),f):r},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,f):Math.sqrt(u)},f}function Wo(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function uc(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function bn(){}var dn=.7,or=1/dn,Tt="\\s*([+-]?\\d+)\\s*",fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",De="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ap=/^#([0-9a-f]{3,8})$/,cp=new RegExp(`^rgb\\(${Tt},${Tt},${Tt}\\)$`),lp=new RegExp(`^rgb\\(${De},${De},${De}\\)$`),up=new RegExp(`^rgba\\(${Tt},${Tt},${Tt},${fn}\\)$`),dp=new RegExp(`^rgba\\(${De},${De},${De},${fn}\\)$`),fp=new RegExp(`^hsl\\(${fn},${De},${De}\\)$`),hp=new RegExp(`^hsla\\(${fn},${De},${De},${fn}\\)$`),Zi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Wo(bn,mt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qi,formatHex:Qi,formatHex8:gp,formatHsl:pp,formatRgb:Ji,toString:Ji});function Qi(){return this.rgb().formatHex()}function gp(){return this.rgb().formatHex8()}function pp(){return dc(this).formatHsl()}function Ji(){return this.rgb().formatRgb()}function mt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ap.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?es(t):n===3?new ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=cp.exec(e))?new ve(t[1],t[2],t[3],1):(t=lp.exec(e))?new ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=up.exec(e))?Tn(t[1],t[2],t[3],t[4]):(t=dp.exec(e))?Tn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fp.exec(e))?rs(t[1],t[2]/100,t[3]/100,1):(t=hp.exec(e))?rs(t[1],t[2]/100,t[3]/100,t[4]):Zi.hasOwnProperty(e)?es(Zi[e]):e==="transparent"?new ve(NaN,NaN,NaN,0):null}function es(e){return new ve(e>>16&255,e>>8&255,e&255,1)}function Tn(e,t,n,r){return r<=0&&(e=t=n=NaN),new ve(e,t,n,r)}function mp(e){return e instanceof bn||(e=mt(e)),e?(e=e.rgb(),new ve(e.r,e.g,e.b,e.opacity)):new ve}function vo(e,t,n,r){return arguments.length===1?mp(e):new ve(e,t,n,r??1)}function ve(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Wo(ve,vo,uc(bn,{brighter(e){return e=e==null?or:Math.pow(or,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dn:Math.pow(dn,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ve(gt(this.r),gt(this.g),gt(this.b),ir(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ts,formatHex:ts,formatHex8:xp,formatRgb:ns,toString:ns}));function ts(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}`}function xp(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}${ut((isNaN(this.opacity)?1:this.opacity)*255)}`}function ns(){const e=ir(this.opacity);return`${e===1?"rgb(":"rgba("}${gt(this.r)}, ${gt(this.g)}, ${gt(this.b)}${e===1?")":`, ${e})`}`}function ir(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ut(e){return e=gt(e),(e<16?"0":"")+e.toString(16)}function rs(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ne(e,t,n,r)}function dc(e){if(e instanceof Ne)return new Ne(e.h,e.s,e.l,e.opacity);if(e instanceof bn||(e=mt(e)),!e)return new Ne;if(e instanceof Ne)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new Ne(s,a,c,e.opacity)}function yp(e,t,n,r){return arguments.length===1?dc(e):new Ne(e,t,n,r??1)}function Ne(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Wo(Ne,yp,uc(bn,{brighter(e){return e=e==null?or:Math.pow(or,e),new Ne(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dn:Math.pow(dn,e),new Ne(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ve(Ur(e>=240?e-240:e+120,o,r),Ur(e,o,r),Ur(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ne(os(this.h),An(this.s),An(this.l),ir(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ir(this.opacity);return`${e===1?"hsl(":"hsla("}${os(this.h)}, ${An(this.s)*100}%, ${An(this.l)*100}%${e===1?")":`, ${e})`}`}}));function os(e){return e=(e||0)%360,e<0?e+360:e}function An(e){return Math.max(0,Math.min(1,e||0))}function Ur(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Yo=e=>()=>e;function wp(e,t){return function(n){return e+n*t}}function vp(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function bp(e){return(e=+e)==1?fc:function(t,n){return n-t?vp(t,n,e):Yo(isNaN(t)?n:t)}}function fc(e,t){var n=t-e;return n?wp(e,n):Yo(isNaN(e)?t:e)}const sr=(function e(t){var n=bp(t);function r(o,i){var s=n((o=vo(o)).r,(i=vo(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=fc(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=l(d),o+""}}return r.gamma=e,r})(1);function _p(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function Sp(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ep(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=rn(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function kp(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ze(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Cp(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=rn(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var bo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Kr=new RegExp(bo.source,"g");function Pp(e){return function(){return e}}function Mp(e){return function(t){return e(t)+""}}function hc(e,t){var n=bo.lastIndex=Kr.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=bo.exec(e))&&(o=Kr.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:ze(r,o)})),n=Kr.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Mp(c[0].x):Pp(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function rn(e,t){var n=typeof t,r;return t==null||n==="boolean"?Yo(t):(n==="number"?ze:n==="string"?(r=mt(t))?(t=r,sr):hc:t instanceof mt?sr:t instanceof Date?kp:Sp(t)?_p:Array.isArray(t)?Ep:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Cp:ze)(e,t)}var is=180/Math.PI,_o={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gc(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*is,skewX:Math.atan(c)*is,scaleX:s,scaleY:a}}var jn;function Np(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?_o:gc(t.a,t.b,t.c,t.d,t.e,t.f)}function Ip(e){return e==null||(jn||(jn=document.createElementNS("http://www.w3.org/2000/svg","g")),jn.setAttribute("transform",e),!(e=jn.transform.baseVal.consolidate()))?_o:(e=e.matrix,gc(e.a,e.b,e.c,e.d,e.e,e.f))}function pc(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,d,u,f,h,g){if(l!==u||d!==f){var m=h.push("translate(",null,t,null,n);g.push({i:m-4,x:ze(l,u)},{i:m-2,x:ze(d,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(o(u)+"rotate(",null,r)-2,x:ze(l,d)})):d&&u.push(o(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(o(u)+"skewX(",null,r)-2,x:ze(l,d)}):d&&u.push(o(u)+"skewX("+d+r)}function c(l,d,u,f,h,g){if(l!==u||d!==f){var m=h.push(o(h)+"scale(",null,",",null,")");g.push({i:m-4,x:ze(l,u)},{i:m-2,x:ze(d,f)})}else(u!==1||f!==1)&&h.push(o(h)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),i(l.translateX,l.translateY,d.translateX,d.translateY,u,f),s(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(h){for(var g=-1,m=f.length,p;++g<m;)u[(p=f[g]).i]=p.x(h);return u.join("")}}}var Rp=pc(Np,"px, ","px)","deg)"),Lp=pc(Ip,", ",")",")"),Tp=1e-12;function ss(e){return((e=Math.exp(e))+1/e)/2}function Ap(e){return((e=Math.exp(e))-1/e)/2}function jp(e){return((e=Math.exp(2*e))-1)/(e+1)}const Gn=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],d=s[0],u=s[1],f=s[2],h=d-a,g=u-c,m=h*h+g*g,p,x;if(m<Tp)x=Math.log(f/l)/t,p=function(S){return[a+S*h,c+S*g,l*Math.exp(t*S*x)]};else{var v=Math.sqrt(m),y=(f*f-l*l+r*m)/(2*l*n*v),w=(f*f-l*l-r*m)/(2*f*n*v),E=Math.log(Math.sqrt(y*y+1)-y),k=Math.log(Math.sqrt(w*w+1)-w);x=(k-E)/t,p=function(S){var P=S*x,M=ss(E),A=l/(n*v)*(M*jp(t*P+E)-Ap(E));return[a+A*h,c+A*g,l*M/ss(t*P+E)]}}return p.duration=x*1e3*t/Math.SQRT2,p}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var $t=0,en=0,Zt=0,mc=1e3,ar,tn,cr=0,xt=0,br=0,hn=typeof performance=="object"&&performance.now?performance:Date,xc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Go(){return xt||(xc(zp),xt=hn.now()+br)}function zp(){xt=0}function lr(){this._call=this._time=this._next=null}lr.prototype=yc.prototype={constructor:lr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Go():+n)+(t==null?0:+t),!this._next&&tn!==this&&(tn?tn._next=this:ar=this,tn=this),this._call=e,this._time=n,So()},stop:function(){this._call&&(this._call=null,this._time=1/0,So())}};function yc(e,t,n){var r=new lr;return r.restart(e,t,n),r}function $p(){Go(),++$t;for(var e=ar,t;e;)(t=xt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$t}function as(){xt=(cr=hn.now())+br,$t=en=0;try{$p()}finally{$t=0,Bp(),xt=0}}function Dp(){var e=hn.now(),t=e-cr;t>mc&&(br-=t,cr=e)}function Bp(){for(var e,t=ar,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ar=n);tn=e,So(r)}function So(e){if(!$t){en&&(en=clearTimeout(en));var t=e-xt;t>24?(e<1/0&&(en=setTimeout(as,e-hn.now()-br)),Zt&&(Zt=clearInterval(Zt))):(Zt||(cr=hn.now(),Zt=setInterval(Dp,mc)),$t=1,xc(as))}}function cs(e,t,n){var r=new lr;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Op=wr("start","end","cancel","interrupt"),Fp=[],wc=0,ls=1,Eo=2,Xn=3,us=4,ko=5,Un=6;function _r(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Hp(e,n,{name:t,index:r,group:o,on:Op,tween:Fp,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:wc})}function Xo(e,t){var n=Te(e,t);if(n.state>wc)throw new Error("too late; already scheduled");return n}function Be(e,t){var n=Te(e,t);if(n.state>Xn)throw new Error("too late; already running");return n}function Te(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Hp(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=yc(i,0,n.time);function i(l){n.state=ls,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,u,f,h;if(n.state!==ls)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Xn)return cs(s);h.state===us?(h.state=Un,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Un,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(cs(function(){n.state===Xn&&(n.state=us,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Eo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Eo){for(n.state=Xn,o=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=ko,1),u=-1,f=o.length;++u<f;)o[u].call(e,d);n.state===ko&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Un,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Kn(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Eo&&r.state<ko,r.state=Un,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Vp(e){return this.each(function(){Kn(this,e)})}function qp(e,t){var n,r;return function(){var o=Be(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Wp(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Be(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}i.tween=o}}function Yp(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Te(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?qp:Wp)(n,e,t))}function Uo(e,t,n){var r=e._id;return e.each(function(){var o=Be(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Te(o,r).value[t]}}function vc(e,t){var n;return(typeof t=="number"?ze:t instanceof mt?sr:(n=mt(t))?(t=n,sr):hc)(e,t)}function Gp(e){return function(){this.removeAttribute(e)}}function Xp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Up(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Kp(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function Zp(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Qp(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Jp(e,t){var n=vr(e),r=n==="transform"?Lp:vc;return this.attrTween(e,typeof t=="function"?(n.local?Qp:Zp)(n,r,Uo(this,"attr."+e,t)):t==null?(n.local?Xp:Gp)(n):(n.local?Kp:Up)(n,r,t))}function em(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function tm(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function nm(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&tm(e,i)),n}return o._value=t,o}function rm(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&em(e,i)),n}return o._value=t,o}function om(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=vr(e);return this.tween(n,(r.local?nm:rm)(r,t))}function im(e,t){return function(){Xo(this,e).delay=+t.apply(this,arguments)}}function sm(e,t){return t=+t,function(){Xo(this,e).delay=t}}function am(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?im:sm)(t,e)):Te(this.node(),t).delay}function cm(e,t){return function(){Be(this,e).duration=+t.apply(this,arguments)}}function lm(e,t){return t=+t,function(){Be(this,e).duration=t}}function um(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cm:lm)(t,e)):Te(this.node(),t).duration}function dm(e,t){if(typeof t!="function")throw new Error;return function(){Be(this,e).ease=t}}function fm(e){var t=this._id;return arguments.length?this.each(dm(t,e)):Te(this.node(),t).ease}function hm(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Be(this,e).ease=n}}function gm(e){if(typeof e!="function")throw new Error;return this.each(hm(this._id,e))}function pm(e){typeof e!="function"&&(e=Za(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Ye(r,this._parents,this._name,this._id)}function mm(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],l=n[a],d=c.length,u=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||l[h])&&(u[h]=f);for(;a<r;++a)s[a]=t[a];return new Ye(s,this._parents,this._name,this._id)}function xm(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function ym(e,t,n){var r,o,i=xm(t)?Xo:Be;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function wm(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each(ym(n,e,t))}function vm(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function bm(){return this.on("end.remove",vm(this._id))}function _m(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vo(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,l=i[s]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,_r(l[f],t,n,f,l,Te(d,n)));return new Ye(i,this._parents,t,n)}function Sm(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ka(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),h,g=Te(d,n),m=0,p=f.length;m<p;++m)(h=f[m])&&_r(h,t,n,m,f,g);i.push(f),s.push(d)}return new Ye(i,s,t,n)}var Em=vn.prototype.constructor;function km(){return new Em(this._groups,this._parents)}function Cm(e,t){var n,r,o;return function(){var i=zt(this,e),s=(this.style.removeProperty(e),zt(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function bc(e){return function(){this.style.removeProperty(e)}}function Pm(e,t,n){var r,o=n+"",i;return function(){var s=zt(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function Mm(e,t,n){var r,o,i;return function(){var s=zt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),zt(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function Nm(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=Be(this,e),l=c.on,d=c.value[i]==null?a||(a=bc(t)):void 0;(l!==n||o!==d)&&(r=(n=l).copy()).on(s,o=d),c.on=r}}function Im(e,t,n){var r=(e+="")=="transform"?Rp:vc;return t==null?this.styleTween(e,Cm(e,r)).on("end.style."+e,bc(e)):typeof t=="function"?this.styleTween(e,Mm(e,r,Uo(this,"style."+e,t))).each(Nm(this._id,e)):this.styleTween(e,Pm(e,r,t),n).on("end.style."+e,null)}function Rm(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Lm(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&Rm(e,s,n)),r}return i._value=t,i}function Tm(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Lm(e,t,n??""))}function Am(e){return function(){this.textContent=e}}function jm(e){return function(){var t=e(this);this.textContent=t??""}}function zm(e){return this.tween("text",typeof e=="function"?jm(Uo(this,"text",e)):Am(e==null?"":e+""))}function $m(e){return function(t){this.textContent=e.call(this,t)}}function Dm(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&$m(o)),t}return r._value=e,r}function Bm(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Dm(e))}function Om(){for(var e=this._name,t=this._id,n=_c(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=Te(c,t);_r(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ye(r,this._parents,e,n)}function Fm(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var l=Be(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&i()})}var Hm=0;function Ye(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function _c(){return++Hm}var He=vn.prototype;Ye.prototype={constructor:Ye,select:_m,selectAll:Sm,selectChild:He.selectChild,selectChildren:He.selectChildren,filter:pm,merge:mm,selection:km,transition:Om,call:He.call,nodes:He.nodes,node:He.node,size:He.size,empty:He.empty,each:He.each,on:wm,attr:Jp,attrTween:om,style:Im,styleTween:Tm,text:zm,textTween:Bm,remove:bm,tween:Yp,delay:am,duration:um,ease:fm,easeVarying:gm,end:Fm,[Symbol.iterator]:He[Symbol.iterator]};function Vm(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var qm={time:null,delay:0,duration:250,ease:Vm};function Wm(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Ym(e){var t,n;e instanceof Ye?(t=e._id,e=e._name):(t=_c(),(n=qm).time=Go(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&_r(c,e,t,l,s,n||Wm(c,t));return new Ye(r,this._parents,e,t)}vn.prototype.interrupt=Vp;vn.prototype.transition=Ym;const zn=e=>()=>e;function Gm(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function qe(e,t,n){this.k=e,this.x=t,this.y=n}qe.prototype={constructor:qe,scale:function(e){return e===1?this:new qe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new qe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Sr=new qe(1,0,0);Sc.prototype=qe.prototype;function Sc(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Sr;return e.__zoom}function Zr(e){e.stopImmediatePropagation()}function Qt(e){e.preventDefault(),e.stopImmediatePropagation()}function Xm(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Um(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ds(){return this.__zoom||Sr}function Km(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zm(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qm(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ec(){var e=Xm,t=Um,n=Qm,r=Km,o=Zm,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Gn,l=wr("start","zoom","end"),d,u,f,h=500,g=150,m=0,p=10;function x(b){b.property("__zoom",ds).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",A).filter(o).on("touchstart.zoom",C).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,T,N,I){var $=b.selection?b.selection():b;$.property("__zoom",ds),b!==$?E(b,T,N,I):$.interrupt().each(function(){k(this,arguments).event(I).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},x.scaleBy=function(b,T,N,I){x.scaleTo(b,function(){var $=this.__zoom.k,z=typeof T=="function"?T.apply(this,arguments):T;return $*z},N,I)},x.scaleTo=function(b,T,N,I){x.transform(b,function(){var $=t.apply(this,arguments),z=this.__zoom,F=N==null?w($):typeof N=="function"?N.apply(this,arguments):N,O=z.invert(F),B=typeof T=="function"?T.apply(this,arguments):T;return n(y(v(z,B),F,O),$,s)},N,I)},x.translateBy=function(b,T,N,I){x.transform(b,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,I)},x.translateTo=function(b,T,N,I,$){x.transform(b,function(){var z=t.apply(this,arguments),F=this.__zoom,O=I==null?w(z):typeof I=="function"?I.apply(this,arguments):I;return n(Sr.translate(O[0],O[1]).scale(F.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof N=="function"?-N.apply(this,arguments):-N),z,s)},I,$)};function v(b,T){return T=Math.max(i[0],Math.min(i[1],T)),T===b.k?b:new qe(T,b.x,b.y)}function y(b,T,N){var I=T[0]-N[0]*b.k,$=T[1]-N[1]*b.k;return I===b.x&&$===b.y?b:new qe(b.k,I,$)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function E(b,T,N,I){b.on("start.zoom",function(){k(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(I).end()}).tween("zoom",function(){var $=this,z=arguments,F=k($,z).event(I),O=t.apply($,z),B=N==null?w(O):typeof N=="function"?N.apply($,z):N,V=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),q=$.__zoom,W=typeof T=="function"?T.apply($,z):T,Q=c(q.invert(B).concat(V/q.k),W.invert(B).concat(V/W.k));return function(U){if(U===1)U=W;else{var D=Q(U),H=V/D[2];U=new qe(H,B[0]-D[0]*H,B[1]-D[1]*H)}F.zoom(null,U)}})}function k(b,T,N){return!N&&b.__zooming||new S(b,T)}function S(b,T){this.that=b,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,T),this.taps=0}S.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,T){return this.mouse&&b!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var T=be(this.that).datum();l.call(b,this.that,new Gm(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:l}),T)}};function P(b,...T){if(!e.apply(this,arguments))return;var N=k(this,T).event(b),I=this.__zoom,$=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,r.apply(this,arguments)))),z=Me(b);if(N.wheel)(N.mouse[0][0]!==z[0]||N.mouse[0][1]!==z[1])&&(N.mouse[1]=I.invert(N.mouse[0]=z)),clearTimeout(N.wheel);else{if(I.k===$)return;N.mouse=[z,I.invert(z)],Kn(this),N.start()}Qt(b),N.wheel=setTimeout(F,g),N.zoom("mouse",n(y(v(I,$),N.mouse[0],N.mouse[1]),N.extent,s));function F(){N.wheel=null,N.end()}}function M(b,...T){if(f||!e.apply(this,arguments))return;var N=b.currentTarget,I=k(this,T,!0).event(b),$=be(b.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",V,!0),z=Me(b,N),F=b.clientX,O=b.clientY;ac(b.view),Zr(b),I.mouse=[z,this.__zoom.invert(z)],Kn(this),I.start();function B(q){if(Qt(q),!I.moved){var W=q.clientX-F,Q=q.clientY-O;I.moved=W*W+Q*Q>m}I.event(q).zoom("mouse",n(y(I.that.__zoom,I.mouse[0]=Me(q,N),I.mouse[1]),I.extent,s))}function V(q){$.on("mousemove.zoom mouseup.zoom",null),cc(q.view,I.moved),Qt(q),I.event(q).end()}}function A(b,...T){if(e.apply(this,arguments)){var N=this.__zoom,I=Me(b.changedTouches?b.changedTouches[0]:b,this),$=N.invert(I),z=N.k*(b.shiftKey?.5:2),F=n(y(v(N,z),I,$),t.apply(this,T),s);Qt(b),a>0?be(this).transition().duration(a).call(E,F,I,b):be(this).call(x.transform,F,I,b)}}function C(b,...T){if(e.apply(this,arguments)){var N=b.touches,I=N.length,$=k(this,T,b.changedTouches.length===I).event(b),z,F,O,B;for(Zr(b),F=0;F<I;++F)O=N[F],B=Me(O,this),B=[B,this.__zoom.invert(B),O.identifier],$.touch0?!$.touch1&&$.touch0[2]!==B[2]&&($.touch1=B,$.taps=0):($.touch0=B,z=!0,$.taps=1+!!d);d&&(d=clearTimeout(d)),z&&($.taps<2&&(u=B[0],d=setTimeout(function(){d=null},h)),Kn(this),$.start())}}function R(b,...T){if(this.__zooming){var N=k(this,T).event(b),I=b.changedTouches,$=I.length,z,F,O,B;for(Qt(b),z=0;z<$;++z)F=I[z],O=Me(F,this),N.touch0&&N.touch0[2]===F.identifier?N.touch0[0]=O:N.touch1&&N.touch1[2]===F.identifier&&(N.touch1[0]=O);if(F=N.that.__zoom,N.touch1){var V=N.touch0[0],q=N.touch0[1],W=N.touch1[0],Q=N.touch1[1],U=(U=W[0]-V[0])*U+(U=W[1]-V[1])*U,D=(D=Q[0]-q[0])*D+(D=Q[1]-q[1])*D;F=v(F,Math.sqrt(U/D)),O=[(V[0]+W[0])/2,(V[1]+W[1])/2],B=[(q[0]+Q[0])/2,(q[1]+Q[1])/2]}else if(N.touch0)O=N.touch0[0],B=N.touch0[1];else return;N.zoom("touch",n(y(F,O,B),N.extent,s))}}function j(b,...T){if(this.__zooming){var N=k(this,T).event(b),I=b.changedTouches,$=I.length,z,F;for(Zr(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),z=0;z<$;++z)F=I[z],N.touch0&&N.touch0[2]===F.identifier?delete N.touch0:N.touch1&&N.touch1[2]===F.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(F=Me(F,this),Math.hypot(u[0]-F[0],u[1]-F[1])<p)){var O=be(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(r=typeof b=="function"?b:zn(+b),x):r},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:zn(!!b),x):e},x.touchable=function(b){return arguments.length?(o=typeof b=="function"?b:zn(!!b),x):o},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:zn([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],x):[i[0],i[1]]},x.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(c=b,x):c},x.on=function(){var b=l.on.apply(l,arguments);return b===l?x:b},x.clickDistance=function(b){return arguments.length?(m=(b=+b)*b,x):Math.sqrt(m)},x.tapDistance=function(b){return arguments.length?(p=+b,x):p},x}const Le={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},gn=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],kc=["Enter"," ","Escape"],Cc={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Dt;(function(e){e.Strict="strict",e.Loose="loose"})(Dt||(Dt={}));var pt;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(pt||(pt={}));var pn;(function(e){e.Partial="partial",e.Full="full"})(pn||(pn={}));const Pc={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Je;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Je||(Je={}));var ur;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ur||(ur={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const fs={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Mc(e){return e===null?null:e?"valid":"invalid"}const Nc=e=>"id"in e&&"source"in e&&"target"in e,Jm=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ko=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),_n=(e,t=[0,0])=>{const{width:n,height:r}=Ge(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},e0=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):Ko(o)?o:t.nodeLookup.get(o.id));const a=s?dr(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Er(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return kr(n)},Sn=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Er(n,dr(o)),r=!0)}),r?kr(n):{x:0,y:0,width:0,height:0}},Zo=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...Wt(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(s&&!u||f)continue;const h=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,m=mn(a,Ot(l)),p=(h??0)*(g??0),x=i&&m>0;(!l.internals.handleBounds||x||m>=p||l.dragging)&&c.push(l)}return c},t0=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function n0(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function r0({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const a=n0(e,s),c=Sn(a),l=Jo(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function Ic({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let u=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",Le.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[c,l],[c+h,l+g]])}else a&&wt(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=wt(u)?yt(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",Le.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-l+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function o0({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(m=>m.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=t0(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const u=await o({nodes:s,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}const Bt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),yt=(e={x:0,y:0},t,n)=>({x:Bt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Bt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Rc(e,t,n){const{width:r,height:o}=Ge(n),{x:i,y:s}=n.internals.positionAbsolute;return yt(e,[[i,s],[i+r,s+o]],t)}const hs=(e,t,n)=>e<t?Bt(Math.abs(e-t),1,t)/t:e>n?-Bt(Math.abs(e-n),1,t)/t:0,Qo=(e,t,n=15,r=40)=>{const o=hs(e.x,r,t.width-r)*n,i=hs(e.y,r,t.height-r)*n;return[o,i]},Er=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Co=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),kr=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ot=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Ko(e)?e.internals.positionAbsolute:_n(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},dr=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Ko(e)?e.internals.positionAbsolute:_n(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Lc=(e,t)=>kr(Er(Co(e),Co(t))),mn=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},gs=e=>Ie(e.width)&&Ie(e.height)&&Ie(e.x)&&Ie(e.y),Ie=e=>!isNaN(e)&&isFinite(e),Tc=(e,t)=>(n,r)=>{},En=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Wt=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?En(a,s):a},Ft=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function kt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function i0(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=kt(e,n),o=kt(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=kt(e.top??e.y??0,n),o=kt(e.bottom??e.y??0,n),i=kt(e.left??e.x??0,t),s=kt(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function s0(e,t,n,r,o,i){const{x:s,y:a}=Ft(e,[t,n,r]),{x:c,y:l}=Ft({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Jo=(e,t,n,r,o,i)=>{const s=i0(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=Bt(l,r,o),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*d,g=n/2-f*d,m=s0(e,h,g,d,t,n),p={left:Math.min(m.left-s.left,0),top:Math.min(m.top-s.top,0),right:Math.min(m.right-s.right,0),bottom:Math.min(m.bottom-s.bottom,0)};return{x:h-p.left+p.right,y:g-p.top+p.bottom,zoom:d}},xn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function wt(e){return e!=null&&e!=="parent"}function Ge(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Ac(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function jc(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function ps(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function a0(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function c0(e){return{...Cc,...e||{}}}function on(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=Re(e),a=Wt({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?En(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const ei=e=>({width:e.offsetWidth,height:e.offsetHeight}),zc=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},l0=["INPUT","SELECT","TEXTAREA"];function $c(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:l0.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Dc=e=>"clientX"in e,Re=(e,t)=>{var i,s;const n=Dc(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},ms=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...ei(s)}})};function Bc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function $n(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function xs({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case X.Left:return[t-$n(t-r,i),n];case X.Right:return[t+$n(r-t,i),n];case X.Top:return[t,n-$n(n-o,i)];case X.Bottom:return[t,n+$n(o-n,i)]}}function Oc({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:i=X.Top,curvature:s=.25}){const[a,c]=xs({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[l,d]=xs({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[u,f,h,g]=Bc({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${o}`,u,f,h,g]}function Fc({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function u0({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function d0({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=Er(dr(e),dr(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return mn(s,kr(i))>0}const f0=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,h0=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),g0=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",Le.error006()),t;const r=n.getEdgeId||f0;let o;return Nc(e)?o={...e}:o={...e,id:r(e)},h0(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Hc({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=Fc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const ys={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},p0=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ws=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function m0({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:r=X.Top,center:o,offset:i,stepPosition:s}){const a=ys[t],c=ys[r],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},u=p0({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let g=[],m,p;const x={x:0,y:0},v={x:0,y:0},[,,y,w]=Fc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(m=o.x??l.x+(d.x-l.x)*s,p=o.y??(l.y+d.y)/2):(m=o.x??(l.x+d.x)/2,p=o.y??l.y+(d.y-l.y)*s);const P=[{x:m,y:l.y},{x:m,y:d.y}],M=[{x:l.x,y:p},{x:d.x,y:p}];a[f]===h?g=f==="x"?P:M:g=f==="x"?M:P}else{const P=[{x:l.x,y:d.y}],M=[{x:d.x,y:l.y}];if(f==="x"?g=a.x===h?M:P:g=a.y===h?P:M,t===r){const b=Math.abs(e[f]-n[f]);if(b<=i){const T=Math.min(i-1,i-b);a[f]===h?x[f]=(l[f]>e[f]?-1:1)*T:v[f]=(d[f]>n[f]?-1:1)*T}}if(t!==r){const b=f==="x"?"y":"x",T=a[f]===c[b],N=l[b]>d[b],I=l[b]<d[b];(a[f]===1&&(!T&&N||T&&I)||a[f]!==1&&(!T&&I||T&&N))&&(g=f==="x"?P:M)}const A={x:l.x+x.x,y:l.y+x.y},C={x:d.x+v.x,y:d.y+v.y},R=Math.max(Math.abs(A.x-g[0].x),Math.abs(C.x-g[0].x)),j=Math.max(Math.abs(A.y-g[0].y),Math.abs(C.y-g[0].y));R>=j?(m=(A.x+C.x)/2,p=g[0].y):(m=g[0].x,p=(A.y+C.y)/2)}const E={x:l.x+x.x,y:l.y+x.y},k={x:d.x+v.x,y:d.y+v.y};return[[e,...E.x!==g[0].x||E.y!==g[0].y?[E]:[],...g,...k.x!==g[g.length-1].x||k.y!==g[g.length-1].y?[k]:[],n],m,p,y,w]}function x0(e,t,n,r){const o=Math.min(ws(e,t)/2,ws(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*l},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Po({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,h,g,m]=m0({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});let p=`M${u[0].x} ${u[0].y}`;for(let x=1;x<u.length-1;x++)p+=x0(u[x-1],u[x],u[x+1],s);return p+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[p,f,h,g,m]}function vs(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function y0(e){var u;const{sourceNode:t,targetNode:n}=e;if(!vs(t)||!vs(n))return null;const r=t.internals.handleBounds||bs(t.handles),o=n.internals.handleBounds||bs(n.handles),i=_s((r==null?void 0:r.source)??[],e.sourceHandle),s=_s(e.connectionMode===Dt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(u=e.onError)==null||u.call(e,"008",Le.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||X.Bottom,c=(s==null?void 0:s.position)||X.Top,l=vt(t,i,a),d=vt(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function bs(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function vt(e,t,n=X.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ge(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case X.Top:return{x:o+s/2,y:i};case X.Right:return{x:o+s,y:i+a/2};case X.Bottom:return{x:o+s/2,y:i+a};case X.Left:return{x:o,y:i+a/2}}}function _s(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Mo(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function w0(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=Mo(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Vc=1e3,v0=10,ti={nodeOrigin:[0,0],nodeExtent:gn,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},b0={...ti,checkEquality:!0};function ni(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function _0(e,t,n){const r=ni(ti,n);for(const o of e.values())if(o.parentId)oi(o,e,t,r);else{const i=_n(o,r.nodeOrigin),s=wt(o.extent)?o.extent:r.nodeExtent,a=yt(i,s,Ge(o));o.internals.positionAbsolute=a}}function S0(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function ri(e){return e==="manual"}function No(e,t,n,r={}){var d,u;const o=ni(b0,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!ri(o.zIndexMode)?Vc:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=_n(f,o.nodeOrigin),m=wt(f.extent)?f.extent:o.nodeExtent,p=yt(g,m,Ge(f));h={...o.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(u=f.measured)==null?void 0:u.height},internals:{positionAbsolute:p,handleBounds:S0(f,h),z:qc(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&oi(h,t,n,r,i),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function E0(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function oi(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=ni(ti,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}E0(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*v0),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const u=i&&!ri(c)?Vc:0,{x:f,y:h,z:g}=k0(e,d,s,a,u,c),{positionAbsolute:m}=e.internals,p=f!==m.x||h!==m.y;(p||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:f,y:h}:m,z:g}})}function qc(e,t,n){const r=Ie(e.zIndex)?e.zIndex:0;return ri(n)?r:r+(e.selected?t:0)}function k0(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Ge(e),l=_n(e,n),d=wt(e.extent)?yt(l,e.extent,c):l;let u=yt({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=Rc(u,c,t));const f=qc(e,o,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function ii(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ot(c),d=Lc(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var y;const d=c.internals.positionAbsolute,u=Ge(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,m=Math.max(u.width,Math.round(a.width)),p=Math.max(u.height,Math.round(a.height)),x=(m-u.width)*f[0],v=(p-u.height)*f[1];(h>0||g>0||x||v)&&(o.push({id:l,type:"position",position:{x:c.position.x-h+x,y:c.position.y-g+v}}),(y=n.get(l))==null||y.forEach(w=>{e.some(E=>E.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(u.width<a.width||u.height<a.height||h||g)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(h?f[0]*h-x:0),height:p+(g?f[1]*g-v:0)}})}),o}function C0(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const m=ei(h.nodeElement),p=g.measured.width!==m.width||g.measured.height!==m.height;if(!!(m.width&&m.height&&(p||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),y=wt(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Rc(w,m,t.get(g.parentId)):y&&(w=yt(w,y,m));const E={...g,measured:m,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:ms("source",h.nodeElement,v,u,g.id),target:ms("target",h.nodeElement,v,u,g.id)}}};t.set(g.id,E),g.parentId&&oi(E,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,p&&(l.push({id:g.id,type:"dimensions",dimensions:m}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ot(E,o)}))}}if(f.length>0){const h=ii(f,t,n,o);l.push(...h)}return{changes:l,updatedInternals:c}}async function P0({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Ss(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const l=r.get(s)||new Map;r.set(s,l.set(n,t))}}function Wc(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},l=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;Ss("source",c,d,e,o,s),Ss("target",c,l,e,i,a),t.set(r.id,r)}}function Yc(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Yc(n,t):!1}function Es(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function M0(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Yc(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function Qr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[l,d]of t){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&o.push({...u,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function N0({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=En(i,t);return{x:s.x-i.x,y:s.y-i.y}}function I0({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,h=!1,g=!1,m=null;function p({noDragClassName:v,handleSelector:y,domNode:w,isSelectable:E,nodeId:k,nodeClickDistance:S=0}){f=be(w);function P({x:R,y:j}){const{nodeLookup:b,nodeExtent:T,snapGrid:N,snapToGrid:I,nodeOrigin:$,onNodeDrag:z,onSelectionDrag:F,onError:O,updateNodePositions:B}=t();i={x:R,y:j};let V=!1;const q=a.size>1,W=q&&T?Co(Sn(a)):null,Q=q&&I?N0({dragItems:a,snapGrid:N,x:R,y:j}):null;for(const[U,D]of a){if(!b.has(U))continue;let H={x:R-D.distance.x,y:j-D.distance.y};I&&(H=Q?{x:Math.round(H.x+Q.x),y:Math.round(H.y+Q.y)}:En(H,N));let Z=null;if(q&&T&&!D.extent&&W){const{positionAbsolute:G}=D.internals,J=G.x-W.x+T[0][0],ie=G.x+D.measured.width-W.x2+T[1][0],se=G.y-W.y+T[0][1],ce=G.y+D.measured.height-W.y2+T[1][1];Z=[[J,se],[ie,ce]]}const{position:K,positionAbsolute:Y}=Ic({nodeId:U,nextPosition:H,nodeLookup:b,nodeExtent:Z||T,nodeOrigin:$,onError:O});V=V||D.position.x!==K.x||D.position.y!==K.y,D.position=K,D.internals.positionAbsolute=Y}if(g=g||V,!!V&&(B(a,!0),m&&(r||z||!k&&F))){const[U,D]=Qr({nodeId:k,dragItems:a,nodeLookup:b});r==null||r(m,a,U,D),z==null||z(m,U,D),k||F==null||F(m,D)}}async function M(){if(!d)return;const{transform:R,panBy:j,autoPanSpeed:b,autoPanOnNodeDrag:T}=t();if(!T){c=!1,cancelAnimationFrame(s);return}const[N,I]=Qo(l,d,b);(N!==0||I!==0)&&(i.x=(i.x??0)-N/R[2],i.y=(i.y??0)-I/R[2],await j({x:N,y:I})&&P(i)),s=requestAnimationFrame(M)}function A(R){var q;const{nodeLookup:j,multiSelectionActive:b,nodesDraggable:T,transform:N,snapGrid:I,snapToGrid:$,selectNodesOnDrag:z,onNodeDragStart:F,onSelectionDragStart:O,unselectNodesAndEdges:B}=t();u=!0,(!z||!E)&&!b&&k&&((q=j.get(k))!=null&&q.selected||B()),E&&z&&k&&(e==null||e(k));const V=on(R.sourceEvent,{transform:N,snapGrid:I,snapToGrid:$,containerBounds:d});if(i=V,a=M0(j,T,V,k),a.size>0&&(n||F||!k&&O)){const[W,Q]=Qr({nodeId:k,dragItems:a,nodeLookup:j});n==null||n(R.sourceEvent,a,W,Q),F==null||F(R.sourceEvent,W,Q),k||O==null||O(R.sourceEvent,Q)}}const C=lc().clickDistance(S).on("start",R=>{const{domNode:j,nodeDragThreshold:b,transform:T,snapGrid:N,snapToGrid:I}=t();d=(j==null?void 0:j.getBoundingClientRect())||null,h=!1,g=!1,m=R.sourceEvent,b===0&&A(R),i=on(R.sourceEvent,{transform:T,snapGrid:N,snapToGrid:I,containerBounds:d}),l=Re(R.sourceEvent,d)}).on("drag",R=>{const{autoPanOnNodeDrag:j,transform:b,snapGrid:T,snapToGrid:N,nodeDragThreshold:I,nodeLookup:$}=t(),z=on(R.sourceEvent,{transform:b,snapGrid:T,snapToGrid:N,containerBounds:d});if(m=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||k&&!$.has(k))&&(h=!0),!h){if(!c&&j&&u&&(c=!0,M()),!u){const F=Re(R.sourceEvent,d),O=F.x-l.x,B=F.y-l.y;Math.sqrt(O*O+B*B)>I&&A(R)}(i.x!==z.xSnapped||i.y!==z.ySnapped)&&a&&u&&(l=Re(R.sourceEvent,d),P(z))}}).on("end",R=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:j,updateNodePositions:b,onNodeDragStop:T,onSelectionDragStop:N}=t();if(g&&(b(a,!1),g=!1),o||T||!k&&N){const[I,$]=Qr({nodeId:k,dragItems:a,nodeLookup:j,dragging:!1});o==null||o(R.sourceEvent,a,I,$),T==null||T(R.sourceEvent,I,$),k||N==null||N(R.sourceEvent,$)}}}).filter(R=>{const j=R.target;return!R.button&&(!v||!Es(j,`.${v}`,w))&&(!y||Es(j,y,w))});f.call(C)}function x(){f==null||f.on(".drag",null)}return{update:p,destroy:x}}function R0(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())mn(o,Ot(i))>0&&r.push(i);return r}const L0=250;function T0(e,t,n,r){var a,c;let o=[],i=1/0;const s=R0(e,n,t+L0);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=vt(l,u,u.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...u,x:f,y:h}],i=g):g===i&&o.push({...u,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(d=>d.type===l)??o[0]}return o[0]}function Gc(e,t,n,r,o,i=!1){var l,d,u;const s=r.get(e);if(!s)return null;const a=o==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...vt(s,c,c.position,!0)}:c}function Xc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function A0(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Uc=()=>!0;function j0(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:m,onConnectEnd:p,isValidConnection:x=Uc,onReconnectEnd:v,updateConnection:y,getTransform:w,getFromHandle:E,autoPanSpeed:k,dragThreshold:S=1,handleDomNode:P}){const M=zc(e.target);let A=0,C;const{x:R,y:j}=Re(e),b=Xc(i,P),T=a==null?void 0:a.getBoundingClientRect();let N=!1;if(!T||!b)return;const I=Gc(o,b,r,c,t);if(!I)return;let $=Re(e,T),z=!1,F=null,O=!1,B=null;function V(){if(!d||!T)return;const[K,Y]=Qo($,T,k);f({x:K,y:Y}),A=requestAnimationFrame(V)}const q={...I,nodeId:o,type:b,position:I.position},W=c.get(o);let U={inProgress:!0,isValid:null,from:vt(W,q,X.Left,!0),fromHandle:q,fromPosition:q.position,fromNode:W,to:$,toHandle:null,toPosition:fs[q.position],toNode:null,pointer:$};function D(){N=!0,y(U),g==null||g(e,{nodeId:o,handleId:r,handleType:b})}S===0&&D();function H(K){if(!N){const{x:ce,y:ge}=Re(K),ye=ce-R,pe=ge-j;if(!(ye*ye+pe*pe>S*S))return;D()}if(!E()||!q){Z(K);return}const Y=w();$=Re(K,T),C=T0(Wt($,Y,!1,[1,1]),n,c,q),z||(V(),z=!0);const G=Kc(K,{handle:C,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:x,doc:M,lib:l,flowId:u,nodeLookup:c});B=G.handleDomNode,F=G.connection,O=A0(!!C,G.isValid);const J=c.get(o),ie=J?vt(J,q,X.Left,!0):U.from,se={...U,from:ie,isValid:O,to:G.toHandle&&O?Ft({x:G.toHandle.x,y:G.toHandle.y},Y):$,toHandle:G.toHandle,toPosition:O&&G.toHandle?G.toHandle.position:fs[q.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:$};y(se),U=se}function Z(K){if(!("touches"in K&&K.touches.length>0)){if(N){(C||B)&&F&&O&&(m==null||m(F));const{inProgress:Y,...G}=U,J={...G,toPosition:U.toHandle?U.toPosition:null};p==null||p(K,J),i&&(v==null||v(K,J))}h(),cancelAnimationFrame(A),z=!1,O=!1,F=null,B=null,M.removeEventListener("mousemove",H),M.removeEventListener("mouseup",Z),M.removeEventListener("touchmove",H),M.removeEventListener("touchend",Z)}}M.addEventListener("mousemove",H),M.addEventListener("mouseup",Z),M.addEventListener("touchmove",H),M.addEventListener("touchend",Z)}function Kc(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Uc,nodeLookup:d}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=Re(e),m=s.elementFromPoint(h,g),p=m!=null&&m.classList.contains(`${a}-flow__handle`)?m:f,x={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const v=Xc(void 0,p),y=p.getAttribute("data-nodeid"),w=p.getAttribute("data-handleid"),E=p.classList.contains("connectable"),k=p.classList.contains("connectableend");if(!y||!v)return x;const S={source:u?y:r,sourceHandle:u?w:o,target:u?r:y,targetHandle:u?o:w};x.connection=S;const M=E&&k&&(n===Dt.Strict?u&&v==="source"||!u&&v==="target":y!==r||w!==o);x.isValid=M&&l(S),x.toHandle=Gc(y,v,w,d,n,!0)}return x}const Io={onPointerDown:j0,isValid:Kc};function z0({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=be(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const w=n(),E=y.sourceEvent.ctrlKey&&xn()?10:1,k=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*d,S=w[2]*Math.pow(2,k*E);t.scaleTo(S)};let m=[0,0];const p=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(m=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},x=y=>{const w=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const E=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],k=[E[0]-m[0],E[1]-m[1]];m=E;const S=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),P={x:w[0]-k[0]*S,y:w[1]-k[1]*S},M=[[0,0],[c,l]];t.setViewportConstrained({x:P.x,y:P.y,zoom:w[2]},M,a)},v=Ec().on("start",p).on("zoom",u?x:null).on("zoom.wheel",f?g:null);o.call(v,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:Me}}const Cr=e=>({x:e.x,y:e.y,zoom:e.k}),Jr=({x:e,y:t,zoom:n})=>Sr.translate(e,t).scale(n),Mt=(e,t)=>e.target.closest(`.${t}`),Zc=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,eo=(e,t=0,n=$0,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Qc=e=>{const t=e.ctrlKey&&xn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function D0({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(Mt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const p=Me(d),x=Qc(d),v=u*Math.pow(2,x);r.scaleTo(n,v,p,d);return}const f=d.deltaMode===1?20:1;let h=o===pt.Vertical?0:d.deltaX*f,g=o===pt.Horizontal?0:d.deltaY*f;!xn()&&d.shiftKey&&o!==pt.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const m=Cr(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,m),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,m))}}function B0({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=Mt(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function O0({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Cr(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function F0({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&Zc(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,Cr(i.transform)))}}function H0({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&Zc(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=Cr(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function V0({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var p;const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Mt(u,`${l}-flow__node`)||Mt(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||Mt(u,a)&&g||Mt(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((p=u.touches)==null?void 0:p.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const m=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&m}}function q0({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=Ec().scaleExtent([t,n]).translateExtent(r),f=be(e).call(u);v({x:o.x,y:o.y,zoom:Bt(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");u.wheelDelta(Qc);async function m(C,R){return f?new Promise(j=>{u==null||u.interpolate((R==null?void 0:R.interpolate)==="linear"?rn:Gn).transform(eo(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>j(!0)),C)}):!1}function p({noWheelClassName:C,noPanClassName:R,onPaneContextMenu:j,userSelectionActive:b,panOnScroll:T,panOnDrag:N,panOnScrollMode:I,panOnScrollSpeed:$,preventScrolling:z,zoomOnPinch:F,zoomOnScroll:O,zoomOnDoubleClick:B,zoomActivationKeyPressed:V,lib:q,onTransformChange:W,connectionInProgress:Q,paneClickDistance:U,selectionOnDrag:D}){b&&!l.isZoomingOrPanning&&x();const H=T&&!V&&!b;u.clickDistance(D?1/0:!Ie(U)||U<0?0:U);const Z=H?D0({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:u,panOnScrollMode:I,panOnScrollSpeed:$,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):B0({noWheelClassName:C,preventScrolling:z,d3ZoomHandler:h});f.on("wheel.zoom",Z,{passive:!1});const K=O0({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",K);const Y=F0({zoomPanValues:l,panOnDrag:N,onPaneContextMenu:!!j,onPanZoom:i,onTransformChange:W});u.on("zoom",Y);const G=H0({zoomPanValues:l,panOnDrag:N,panOnScroll:T,onPaneContextMenu:j,onPanZoomEnd:a,onDraggingChange:c});u.on("end",G);const J=V0({zoomActivationKeyPressed:V,panOnDrag:N,zoomOnScroll:O,panOnScroll:T,zoomOnDoubleClick:B,zoomOnPinch:F,userSelectionActive:b,noPanClassName:R,noWheelClassName:C,lib:q,connectionInProgress:Q});u.filter(J),B?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function x(){u.on("zoom",null)}async function v(C,R,j){const b=Jr(C),T=u==null?void 0:u.constrain()(b,R,j);return T&&await m(T),T}async function y(C,R){const j=Jr(C);return await m(j,R),j}function w(C){if(f){const R=Jr(C),j=f.property("__zoom");(j.k!==C.zoom||j.x!==C.x||j.y!==C.y)&&(u==null||u.transform(f,R,null,{sync:!0}))}}function E(){const C=f?Sc(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}async function k(C,R){return f?new Promise(j=>{u==null||u.interpolate((R==null?void 0:R.interpolate)==="linear"?rn:Gn).scaleTo(eo(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>j(!0)),C)}):!1}async function S(C,R){return f?new Promise(j=>{u==null||u.interpolate((R==null?void 0:R.interpolate)==="linear"?rn:Gn).scaleBy(eo(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>j(!0)),C)}):!1}function P(C){u==null||u.scaleExtent(C)}function M(C){u==null||u.translateExtent(C)}function A(C){const R=!Ie(C)||C<0?0:C;u==null||u.clickDistance(R)}return{update:p,destroy:x,setViewport:y,setViewportConstrained:v,getViewport:E,scaleTo:k,scaleBy:S,setScaleExtent:P,setTranslateExtent:M,syncViewport:w,setClickDistance:A}}var Ht;(function(e){e.Line="line",e.Handle="handle"})(Ht||(Ht={}));function W0({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function ks(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Ue(e,t){return Math.max(0,t-e)}function Ke(e,t){return Math.max(0,e-t)}function Dn(e,t,n){return Math.max(0,t-e,e-n)}function Cs(e,t){return e?!t:t}function Y0(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:m,maxWidth:p,minHeight:x,maxHeight:v}=r,{x:y,y:w,width:E,height:k,aspectRatio:S}=e;let P=Math.floor(d?h-e.pointerX:0),M=Math.floor(u?g-e.pointerY:0);const A=E+(c?-P:P),C=k+(l?-M:M),R=-i[0]*E,j=-i[1]*k;let b=Dn(A,m,p),T=Dn(C,x,v);if(s){let $=0,z=0;c&&P<0?$=Ue(y+P+R,s[0][0]):!c&&P>0&&($=Ke(y+A+R,s[1][0])),l&&M<0?z=Ue(w+M+j,s[0][1]):!l&&M>0&&(z=Ke(w+C+j,s[1][1])),b=Math.max(b,$),T=Math.max(T,z)}if(a){let $=0,z=0;c&&P>0?$=Ke(y+P,a[0][0]):!c&&P<0&&($=Ue(y+A,a[1][0])),l&&M>0?z=Ke(w+M,a[0][1]):!l&&M<0&&(z=Ue(w+C,a[1][1])),b=Math.max(b,$),T=Math.max(T,z)}if(o){if(d){const $=Dn(A/S,x,v)*S;if(b=Math.max(b,$),s){let z=0;!c&&!l||c&&!l&&f?z=Ke(w+j+A/S,s[1][1])*S:z=Ue(w+j+(c?P:-P)/S,s[0][1])*S,b=Math.max(b,z)}if(a){let z=0;!c&&!l||c&&!l&&f?z=Ue(w+A/S,a[1][1])*S:z=Ke(w+(c?P:-P)/S,a[0][1])*S,b=Math.max(b,z)}}if(u){const $=Dn(C*S,m,p)/S;if(T=Math.max(T,$),s){let z=0;!c&&!l||l&&!c&&f?z=Ke(y+C*S+R,s[1][0])/S:z=Ue(y+(l?M:-M)*S+R,s[0][0])/S,T=Math.max(T,z)}if(a){let z=0;!c&&!l||l&&!c&&f?z=Ue(y+C*S,a[1][0])/S:z=Ke(y+(l?M:-M)*S,a[0][0])/S,T=Math.max(T,z)}}}M=M+(M<0?T:-T),P=P+(P<0?b:-b),o&&(f?A>C*S?M=(Cs(c,l)?-P:P)/S:P=(Cs(c,l)?-M:M)*S:d?(M=P/S,l=c):(P=M*S,c=l));const N=c?y+P:y,I=l?w+M:w;return{width:E+(c?-P:P),height:k+(l?-M:M),x:i[0]*P*(c?-1:1)+N,y:i[1]*M*(l?-1:1)+I}}const Jc={width:0,height:0,x:0,y:0},G0={...Jc,pointerX:0,pointerY:0,aspectRatio:1};function X0(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function U0({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=be(e);let s={controlDirection:ks("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:m,shouldResize:p}){let x={...Jc},v={...G0};s={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:ks(l)};let y,w=null,E=[],k,S,P,M=!1;const A=lc().on("start",C=>{const{nodeLookup:R,transform:j,snapGrid:b,snapToGrid:T,nodeOrigin:N,paneDomNode:I}=n();if(y=R.get(t),!y)return;w=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:$,ySnapped:z}=on(C.sourceEvent,{transform:j,snapGrid:b,snapToGrid:T,containerBounds:w});x={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},v={...x,pointerX:$,pointerY:z,aspectRatio:x.width/x.height},k=void 0,S=wt(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(k=R.get(y.parentId)),k&&y.extent==="parent"&&(S=[[0,0],[k.measured.width,k.measured.height]]),E=[],P=void 0;for(const[F,O]of R)if(O.parentId===t&&(E.push({id:F,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const B=X0(O,y,O.origin??N);P?P=[[Math.min(B[0][0],P[0][0]),Math.min(B[0][1],P[0][1])],[Math.max(B[1][0],P[1][0]),Math.max(B[1][1],P[1][1])]]:P=B}h==null||h(C,{...x})}).on("drag",C=>{const{transform:R,snapGrid:j,snapToGrid:b,nodeOrigin:T}=n(),N=on(C.sourceEvent,{transform:R,snapGrid:j,snapToGrid:b,containerBounds:w}),I=[];if(!y)return;const{x:$,y:z,width:F,height:O}=x,B={},V=y.origin??T,{width:q,height:W,x:Q,y:U}=Y0(v,s.controlDirection,N,s.boundaries,s.keepAspectRatio,V,S,P),D=q!==F,H=W!==O,Z=Q!==$&&D,K=U!==z&&H;if(!Z&&!K&&!D&&!H)return;if((Z||K||V[0]===1||V[1]===1)&&(B.x=Z?Q:x.x,B.y=K?U:x.y,x.x=B.x,x.y=B.y,E.length>0)){const ie=Q-$,se=U-z;for(const ce of E)ce.position={x:ce.position.x-ie+V[0]*(q-F),y:ce.position.y-se+V[1]*(W-O)},I.push(ce)}if((D||H)&&(B.width=D&&(!s.resizeDirection||s.resizeDirection==="horizontal")?q:x.width,B.height=H&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:x.height,x.width=B.width,x.height=B.height),k&&y.expandParent){const ie=V[0]*(B.width??0);B.x&&B.x<ie&&(x.x=ie,v.x=v.x-(B.x-ie));const se=V[1]*(B.height??0);B.y&&B.y<se&&(x.y=se,v.y=v.y-(B.y-se))}const Y=W0({width:x.width,prevWidth:F,height:x.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...x,direction:Y};(p==null?void 0:p(C,G))!==!1&&(M=!0,g==null||g(C,G),r(B,I))}).on("end",C=>{M&&(m==null||m(C,{...x}),o==null||o({...x}),M=!1)});i.call(A)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const K0={},Ps=e=>{let t;const n=new Set,r=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const h=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(K0?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(r,o,c);return c},Z0=e=>e?Ps(e):Ps,{useDebugValue:Q0}=At,{useSyncExternalStoreWithSelector:J0}=Ff,ex=e=>e;function el(e,t=ex,n){const r=J0(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Q0(r),r}const Ms=(e,t)=>{const n=Z0(e),r=(o,i=t)=>el(n,o,i);return Object.assign(r,n),r},tx=(e,t)=>e?Ms(e,t):Ms;function de(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Pr=L.createContext(null),nx=Pr.Provider,tl=Le.error001("react");function oe(e,t){const n=L.useContext(Pr);if(n===null)throw new Error(tl);return el(n,e,t)}function fe(){const e=L.useContext(Pr);if(e===null)throw new Error(tl);return L.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Ns={display:"none"},rx={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},nl="react-flow__node-desc",rl="react-flow__edge-desc",ox="react-flow__aria-live",ix=e=>e.ariaLiveMessage,sx=e=>e.ariaLabelConfig;function ax({rfId:e}){const t=oe(ix);return _.jsx("div",{id:`${ox}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:rx,children:t})}function cx({rfId:e,disableKeyboardA11y:t}){const n=oe(sx);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${nl}-${e}`,style:Ns,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${rl}-${e}`,style:Ns,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(ax,{rfId:e})]})}const Mr=L.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return _.jsx("div",{className:he(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});Mr.displayName="Panel";function lx({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:_.jsx(Mr,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ux=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Bn=e=>e.id;function dx(e,t){return de(e.selectedNodes.map(Bn),t.selectedNodes.map(Bn))&&de(e.selectedEdges.map(Bn),t.selectedEdges.map(Bn))}function fx({onSelectionChange:e}){const t=fe(),{selectedNodes:n,selectedEdges:r}=oe(ux,dx);return L.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const hx=e=>!!e.onSelectionChangeHandlers;function gx({onSelectionChange:e}){const t=oe(hx);return e||t?_.jsx(fx,{onSelectionChange:e}):null}const ol=[0,0],px={x:0,y:0,zoom:1},mx=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Is=[...mx,"rfId"],xx=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Rs={translateExtent:gn,nodeOrigin:ol,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yx(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=oe(xx,de),l=fe();L.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Rs,a()}),[]);const d=L.useRef(Rs);return L.useEffect(()=>{for(const u of Is){const f=e[u],h=d.current[u];f!==h&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?r(f):u==="maxZoom"?o(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:c0(f)}):u==="fitView"?l.setState({fitViewQueued:f}):u==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[u]:f})))}d.current=e},Is.map(u=>e[u])),null}function Ls(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function wx(e){var r;const[t,n]=L.useState(e==="system"?null:e);return L.useEffect(()=>{if(e!=="system"){n(e);return}const o=Ls(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=Ls())!=null&&r.matches?"dark":"light"}const Ts=typeof document<"u"?document:null;function yn(e=null,t={target:Ts,actInsideInputWithModifier:!0}){const[n,r]=L.useState(!1),o=L.useRef(!1),i=L.useRef(new Set([])),[s,a]=L.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
18
|
+
`).replace(`
|
|
19
|
+
|
|
20
|
+
`,`
|
|
21
|
+
+`).split(`
|
|
22
|
+
`)),d=l.reduce((u,f)=>u.concat(...f),[]);return[l,d]}return[[],[]]},[e]);return L.useEffect(()=>{const c=(t==null?void 0:t.target)??Ts,l=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=h=>{var p,x;if(o.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!o.current||o.current&&!l)&&$c(h))return!1;const m=js(h.code,a);if(i.current.add(h[m]),As(s,i.current,!1)){const v=((x=(p=h.composedPath)==null?void 0:p.call(h))==null?void 0:x[0])||h.target,y=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(o.current||!y)&&h.preventDefault(),r(!0)}},u=h=>{const g=js(h.code,a);As(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),o.current=!1},f=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function As(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function js(e,t){return t.includes(e)?"code":"key"}const vx=()=>{const e=fe();return L.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),c=Jo(t,r,o,i,s,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:c}=s.getBoundingClientRect(),l={x:t.x-a,y:t.y-c},d=n.snapGrid??o,u=n.snapToGrid??i;return Wt(l,r,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=Ft(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function il(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const c of s)bx(c,a);n.push(a)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function bx(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function _x(e,t){return il(e,t)}function Sx(e,t){return il(e,t)}function st(e,t){return{id:e,type:"select",selected:t}}function Nt(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push(st(i.id,s)))}return r}function zs({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const a=t.get(s.id),c=((o=a==null?void 0:a.internals)==null?void 0:o.userNode)??a;c!==void 0&&c!==s&&n.push({id:s.id,item:s,type:"replace"}),c===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function $s(e){return{id:e.id,type:"remove"}}const Ex=Tc();function kx(e,t,n={}){return g0(e,t,{...n,onError:n.onError??Ex})}const Ds=e=>Jm(e),Cx=e=>Nc(e);function sl(e){return L.forwardRef(e)}const Px=typeof window<"u"?L.useLayoutEffect:L.useEffect;function Bs(e){const[t,n]=L.useState(BigInt(0)),[r]=L.useState(()=>Mx(()=>n(o=>o+BigInt(1))));return Px(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Mx(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const al=L.createContext(null);function Nx({children:e}){const t=fe(),n=L.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:d,onNodesChange:u,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let m=c;for(const x of a)m=typeof x=="function"?x(m):x;let p=zs({items:m,lookup:f});for(const x of g.values())p=x(p);d&&l(m),p.length>0?u==null||u(p):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:v,setNodes:y}=t.getState();x&&y(v)})},[]),r=Bs(n),o=L.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:f}=t.getState();let h=c;for(const g of a)h=typeof g=="function"?g(h):g;d?l(h):u&&u(zs({items:h,lookup:f}))},[]),i=Bs(o),s=L.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return _.jsx(al.Provider,{value:s,children:e})}function Ix(){const e=L.useContext(al);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Rx=e=>!!e.panZoom;function si(){const e=vx(),t=fe(),n=Ix(),r=oe(Rx),o=L.useMemo(()=>{const i=u=>t.getState().nodeLookup.get(u),s=u=>{n.nodeQueue.push(u)},a=u=>{n.edgeQueue.push(u)},c=u=>{var x,v;const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=Ds(u)?u:f.get(u.id),m=g.parentId?jc(g.position,g.measured,g.parentId,f,h):g.position,p={...g,position:m,width:((x=g.measured)==null?void 0:x.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return Ot(p)},l=(u,f,h={replace:!1})=>{s(g=>g.map(m=>{if(m.id===u){const p=typeof f=="function"?f(m):f;return h.replace&&Ds(p)?p:{...m,...p}}return m}))},d=(u,f,h={replace:!1})=>{a(g=>g.map(m=>{if(m.id===u){const p=typeof f=="function"?f(m):f;return h.replace&&Cx(p)?p:{...m,...p}}return m}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var f;return(f=i(u))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(f=>({...f}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:s,setEdges:a,addNodes:u=>{const f=Array.isArray(u)?u:[u];n.nodeQueue.push(h=>[...h,...f])},addEdges:u=>{const f=Array.isArray(u)?u:[u];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:u=[],edges:f=[],transform:h}=t.getState(),[g,m,p]=h;return{nodes:u.map(x=>({...x})),edges:f.map(x=>({...x})),viewport:{x:g,y:m,zoom:p}}},deleteElements:async({nodes:u=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:m,onEdgesDelete:p,triggerNodeChanges:x,triggerEdgeChanges:v,onDelete:y,onBeforeDelete:w}=t.getState(),{nodes:E,edges:k}=await o0({nodesToRemove:u,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:w}),S=k.length>0,P=E.length>0;if(S){const M=k.map($s);p==null||p(k),v(M)}if(P){const M=E.map($s);m==null||m(E),x(M)}return(P||S)&&(y==null||y({nodes:E,edges:k})),{deletedNodes:E,deletedEdges:k}},getIntersectingNodes:(u,f=!0,h)=>{const g=gs(u),m=g?u:c(u),p=h!==void 0;return m?(h||t.getState().nodes).filter(x=>{const v=t.getState().nodeLookup.get(x.id);if(v&&!g&&(x.id===u.id||!v.internals.positionAbsolute))return!1;const y=Ot(p?x:v),w=mn(y,m);return f&&w>0||w>=y.width*y.height||w>=m.width*m.height}):[]},isNodeIntersecting:(u,f,h=!0)=>{const m=gs(u)?u:c(u);if(!m)return!1;const p=mn(m,f);return h&&p>0||p>=f.width*f.height||p>=m.width*m.height},updateNode:l,updateNodeData:(u,f,h={replace:!1})=>{l(u,g=>{const m=typeof f=="function"?f(g):f;return h.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},h)},updateEdge:d,updateEdgeData:(u,f,h={replace:!1})=>{d(u,g=>{const m=typeof f=="function"?f(g):f;return h.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},h)},getNodesBounds:u=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return e0(u,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:u,id:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${u}${f?`-${f}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:u,handleId:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${u?f?`-${u}-${f}`:`-${u}`:""}`))==null?void 0:g.values())??[])},fitView:async u=>{const f=t.getState().fitViewResolver??a0();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return L.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const Os=e=>e.selected,Lx=typeof window<"u"?window:void 0;function Tx({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=fe(),{deleteElements:r}=si(),o=yn(e,{actInsideInputWithModifier:!1}),i=yn(t,{target:Lx});L.useEffect(()=>{if(o){const{edges:s,nodes:a}=n.getState();r({nodes:a.filter(Os),edges:s.filter(Os)}),n.setState({nodesSelectionActive:!1})}},[o]),L.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Ax(e){const t=fe();L.useEffect(()=>{const n=()=>{var o,i,s,a;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=ei(e.current);(r.height===0||r.width===0)&&((a=(s=t.getState()).onError)==null||a.call(s,"004",Le.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Nr={position:"absolute",width:"100%",height:"100%",top:0,left:0},jx=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function zx({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=pt.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:l,minZoom:d,maxZoom:u,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:m,noPanClassName:p,onViewportChange:x,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:w}){const E=fe(),k=L.useRef(null),{userSelectionActive:S,lib:P,connectionInProgress:M}=oe(jx,de),A=yn(f),C=L.useRef();Ax(k);const R=L.useCallback(j=>{x==null||x({x:j[0],y:j[1],zoom:j[2]}),v||E.setState({transform:j})},[x,v]);return L.useEffect(()=>{if(k.current){C.current=q0({domNode:k.current,minZoom:d,maxZoom:u,translateExtent:l,viewport:c,onDraggingChange:N=>E.setState(I=>I.paneDragging===N?I:{paneDragging:N}),onPanZoomStart:(N,I)=>{const{onViewportChangeStart:$,onMoveStart:z}=E.getState();z==null||z(N,I),$==null||$(I)},onPanZoom:(N,I)=>{const{onViewportChange:$,onMove:z}=E.getState();z==null||z(N,I),$==null||$(I)},onPanZoomEnd:(N,I)=>{const{onViewportChangeEnd:$,onMoveEnd:z}=E.getState();z==null||z(N,I),$==null||$(I)}});const{x:j,y:b,zoom:T}=C.current.getViewport();return E.setState({panZoom:C.current,transform:[j,b,T],domNode:k.current.closest(".react-flow")}),()=>{var N;(N=C.current)==null||N.destroy()}}},[]),L.useEffect(()=>{var j;(j=C.current)==null||j.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:A,preventScrolling:h,noPanClassName:p,userSelectionActive:S,noWheelClassName:m,lib:P,onTransformChange:R,connectionInProgress:M,selectionOnDrag:w,paneClickDistance:y})},[e,t,n,r,o,i,s,a,A,h,p,S,m,P,R,M,w,y]),_.jsx("div",{className:"react-flow__renderer",ref:k,style:Nr,children:g})}const $x=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Dx(){const{userSelectionActive:e,userSelectionRect:t}=oe($x,de);return e&&t?_.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const to=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Bx=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Ox({isSelecting:e,selectionKeyPressed:t,selectionMode:n=pn.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:g,children:m}){const p=L.useRef(0),x=fe(),{userSelectionActive:v,elementsSelectable:y,dragging:w,connectionInProgress:E,panBy:k,autoPanSpeed:S}=oe(Bx,de),P=y&&(e||v),M=L.useRef(null),A=L.useRef(),C=L.useRef(new Set),R=L.useRef(new Set),j=L.useRef(!1),b=L.useRef({x:0,y:0}),T=L.useRef(!1),N=D=>{if(j.current||E){j.current=!1;return}l==null||l(D),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},I=D=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){D.preventDefault();return}d==null||d(D)},$=u?D=>u(D):void 0,z=D=>{j.current&&(D.stopPropagation(),j.current=!1)},F=D=>{var ce,ge;const{domNode:H,transform:Z}=x.getState();if(A.current=H==null?void 0:H.getBoundingClientRect(),!A.current)return;const K=D.target===M.current;if(!K&&!!D.target.closest(".nokey")||!e||!(s&&K||t)||D.button!==0||!D.isPrimary)return;(ge=(ce=D.target)==null?void 0:ce.setPointerCapture)==null||ge.call(ce,D.pointerId),j.current=!1;const{x:J,y:ie}=Re(D.nativeEvent,A.current),se=Wt({x:J,y:ie},Z);x.setState({userSelectionRect:{width:0,height:0,startX:se.x,startY:se.y,x:J,y:ie}}),K||(D.stopPropagation(),D.preventDefault())};function O(D,H){const{userSelectionRect:Z}=x.getState();if(!Z)return;const{transform:K,nodeLookup:Y,edgeLookup:G,connectionLookup:J,triggerNodeChanges:ie,triggerEdgeChanges:se,defaultEdgeOptions:ce}=x.getState(),ge={x:Z.startX,y:Z.startY},{x:ye,y:pe}=Ft(ge,K),Pe={startX:ge.x,startY:ge.y,x:D<ye?D:ye,y:H<pe?H:pe,width:Math.abs(D-ye),height:Math.abs(H-pe)},Xe=C.current,Oe=R.current;C.current=new Set(Zo(Y,Pe,K,n===pn.Partial,!0).map(ee=>ee.id)),R.current=new Set;const Ae=(ce==null?void 0:ce.selectable)??!0;for(const ee of C.current){const le=J.get(ee);if(le)for(const{edgeId:me}of le.values()){const Fe=G.get(me);Fe&&(Fe.selectable??Ae)&&R.current.add(me)}}if(!ps(Xe,C.current)){const ee=Nt(Y,C.current,!0);ie(ee)}if(!ps(Oe,R.current)){const ee=Nt(G,R.current);se(ee)}x.setState({userSelectionRect:Pe,userSelectionActive:!0,nodesSelectionActive:!1})}function B(){if(!o||!A.current)return;const[D,H]=Qo(b.current,A.current,S);k({x:D,y:H}).then(Z=>{if(!j.current||!Z){p.current=requestAnimationFrame(B);return}const{x:K,y:Y}=b.current;O(K,Y),p.current=requestAnimationFrame(B)})}const V=()=>{cancelAnimationFrame(p.current),p.current=0,T.current=!1};L.useEffect(()=>()=>V(),[]);const q=D=>{const{userSelectionRect:H,transform:Z,resetSelectedElements:K}=x.getState();if(!A.current||!H)return;const{x:Y,y:G}=Re(D.nativeEvent,A.current);b.current={x:Y,y:G};const J=Ft({x:H.startX,y:H.startY},Z);if(!j.current){const ie=t?0:i;if(Math.hypot(Y-J.x,G-J.y)<=ie)return;K(),a==null||a(D)}j.current=!0,T.current||(B(),T.current=!0),O(Y,G)},W=D=>{var H,Z;D.button===0&&((Z=(H=D.target)==null?void 0:H.releasePointerCapture)==null||Z.call(H,D.pointerId),!v&&D.target===M.current&&x.getState().userSelectionRect&&(N==null||N(D)),x.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(c==null||c(D),x.setState({nodesSelectionActive:C.current.size>0})),V())},Q=D=>{var H,Z;(Z=(H=D.target)==null?void 0:H.releasePointerCapture)==null||Z.call(H,D.pointerId),V()},U=r===!0||Array.isArray(r)&&r.includes(0);return _.jsxs("div",{className:he(["react-flow__pane",{draggable:U,dragging:w,selection:e}]),onClick:P?void 0:to(N,M),onContextMenu:to(I,M),onWheel:to($,M),onPointerEnter:P?void 0:f,onPointerMove:P?q:h,onPointerUp:P?W:void 0,onPointerCancel:P?Q:void 0,onPointerDownCapture:P?F:void 0,onClickCapture:P?z:void 0,onPointerLeave:g,ref:M,style:Nr,children:[m,_.jsx(Dx,{})]})}function Ro({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c==null||c("012",Le.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):o([e])}function cl({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const a=fe(),[c,l]=L.useState(!1),d=L.useRef();return L.useEffect(()=>{d.current=I0({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{Ro({id:u,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),L.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var u;(u=d.current)==null||u.destroy()}},[n,r,t,i,e,o,s]),c}const Fx=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ll(){const e=fe();return L.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:d}=e.getState(),u=new Map,f=Fx(s),h=o?i[0]:5,g=o?i[1]:5,m=n.direction.x*h*n.factor,p=n.direction.y*g*n.factor;for(const[,x]of l){if(!f(x))continue;let v={x:x.internals.positionAbsolute.x+m,y:x.internals.positionAbsolute.y+p};o&&(v=En(v,i));const{position:y,positionAbsolute:w}=Ic({nodeId:x.id,nextPosition:v,nodeLookup:l,nodeExtent:r,nodeOrigin:d,onError:a});x.position=y,x.internals.positionAbsolute=w,u.set(x.id,x)}c(u)},[])}const ai=L.createContext(null),Hx=ai.Provider;ai.Consumer;const ul=()=>L.useContext(ai),Vx=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),qx=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:a,toHandle:c,isValid:l}=s,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:d,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===Dt.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!o,valid:d&&l}};function Wx({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:l,onMouseDown:d,onTouchStart:u,...f},h){var T,N;const g=s||null,m=e==="target",p=fe(),x=ul(),{connectOnClick:v,noPanClassName:y,rfId:w}=oe(Vx,de),{connectingFrom:E,connectingTo:k,clickConnecting:S,isPossibleEndHandle:P,connectionInProcess:M,clickConnectionInProcess:A,valid:C}=oe(qx(x,g,e),de);x||(N=(T=p.getState()).onError)==null||N.call(T,"010",Le.error010());const R=I=>{const{defaultEdgeOptions:$,onConnect:z,hasDefaultEdges:F}=p.getState(),O={...$,...I};if(F){const{edges:B,setEdges:V,onError:q}=p.getState();V(kx(O,B,{onError:q}))}z==null||z(O),a==null||a(O)},j=I=>{if(!x)return;const $=Dc(I.nativeEvent);if(o&&($&&I.button===0||!$)){const z=p.getState();Io.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:z.autoPanOnConnect,connectionMode:z.connectionMode,connectionRadius:z.connectionRadius,domNode:z.domNode,nodeLookup:z.nodeLookup,lib:z.lib,isTarget:m,handleId:g,nodeId:x,flowId:z.rfId,panBy:z.panBy,cancelConnection:z.cancelConnection,onConnectStart:z.onConnectStart,onConnectEnd:(...F)=>{var O,B;return(B=(O=p.getState()).onConnectEnd)==null?void 0:B.call(O,...F)},updateConnection:z.updateConnection,onConnect:R,isValidConnection:n||((...F)=>{var O,B;return((B=(O=p.getState()).isValidConnection)==null?void 0:B.call(O,...F))??!0}),getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,autoPanSpeed:z.autoPanSpeed,dragThreshold:z.connectionDragThreshold})}$?d==null||d(I):u==null||u(I)},b=I=>{const{onClickConnectStart:$,onClickConnectEnd:z,connectionClickStartHandle:F,connectionMode:O,isValidConnection:B,lib:V,rfId:q,nodeLookup:W,connection:Q}=p.getState();if(!x||!F&&!o)return;if(!F){$==null||$(I.nativeEvent,{nodeId:x,handleId:g,handleType:e}),p.setState({connectionClickStartHandle:{nodeId:x,type:e,id:g}});return}const U=zc(I.target),D=n||B,{connection:H,isValid:Z}=Io.isValid(I.nativeEvent,{handle:{nodeId:x,id:g,type:e},connectionMode:O,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:D,flowId:q,doc:U,lib:V,nodeLookup:W});Z&&H&&R(H);const K=structuredClone(Q);delete K.inProgress,K.toPosition=K.toHandle?K.toHandle.position:null,z==null||z(I,K),p.setState({connectionClickStartHandle:null})};return _.jsx("div",{"data-handleid":g,"data-nodeid":x,"data-handlepos":t,"data-id":`${w}-${x}-${g}-${e}`,className:he(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,l,{source:!m,target:m,connectable:r,connectablestart:o,connectableend:i,clickconnecting:S,connectingfrom:E,connectingto:k,valid:C,connectionindicator:r&&(!M||P)&&(M||A?i:o)}]),onMouseDown:j,onTouchStart:j,onClick:v?b:void 0,ref:h,...f,children:c})}const Vt=L.memo(sl(Wx));function Yx({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return _.jsxs(_.Fragment,{children:[e==null?void 0:e.label,_.jsx(Vt,{type:"source",position:n,isConnectable:t})]})}function Gx({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:r=X.Bottom}){return _.jsxs(_.Fragment,{children:[_.jsx(Vt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,_.jsx(Vt,{type:"source",position:r,isConnectable:t})]})}function Xx(){return null}function Ux({data:e,isConnectable:t,targetPosition:n=X.Top}){return _.jsxs(_.Fragment,{children:[_.jsx(Vt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const fr={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Fs={input:Yx,default:Gx,output:Ux,group:Xx};function Kx(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const Zx=e=>{const{width:t,height:n,x:r,y:o}=Sn(e.nodeLookup,{filter:i=>!!i.selected});return{width:Ie(t)?t:null,height:Ie(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function Qx({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=fe(),{width:o,height:i,transformString:s,userSelectionActive:a}=oe(Zx,de),c=ll(),l=L.useRef(null);L.useEffect(()=>{var h;n||(h=l.current)==null||h.focus({preventScroll:!0})},[n]);const d=!a&&o!==null&&i!==null;if(cl({nodeRef:l,disabled:!d}),!d)return null;const u=e?h=>{const g=r.getState().nodes.filter(m=>m.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(fr,h.key)&&(h.preventDefault(),c({direction:fr[h.key],factor:h.shiftKey?4:1}))};return _.jsx("div",{className:he(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:_.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:i}})})}const Hs=typeof window<"u"?window:void 0,Jx=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function dl({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:d,selectionMode:u,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:m,zoomActivationKeyCode:p,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:w,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:P,autoPanOnSelection:M,defaultViewport:A,translateExtent:C,minZoom:R,maxZoom:j,preventScrolling:b,onSelectionContextMenu:T,noWheelClassName:N,noPanClassName:I,disableKeyboardA11y:$,onViewportChange:z,isControlledViewport:F}){const{nodesSelectionActive:O,userSelectionActive:B}=oe(Jx,de),V=yn(l,{target:Hs}),q=yn(m,{target:Hs}),W=q||P,Q=q||w,U=d&&W!==!0,D=V||B||U;return Tx({deleteKeyCode:c,multiSelectionKeyCode:g}),_.jsx(zx,{onPaneContextMenu:i,elementsSelectable:x,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:Q,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!V&&W,defaultViewport:A,translateExtent:C,minZoom:R,maxZoom:j,zoomActivationKeyCode:p,preventScrolling:b,noWheelClassName:N,noPanClassName:I,onViewportChange:z,isControlledViewport:F,paneClickDistance:a,selectionOnDrag:U,children:_.jsxs(Ox,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:W,autoPanOnSelection:M,isSelecting:!!D,selectionMode:u,selectionKeyPressed:V,paneClickDistance:a,selectionOnDrag:U,children:[e,O&&_.jsx(Qx,{onSelectionContextMenu:T,noPanClassName:I,disableKeyboardA11y:$})]})})}dl.displayName="FlowRenderer";const ey=L.memo(dl),ty=e=>t=>e?Zo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function ny(e){return oe(L.useCallback(ty(e),[e]),de)}const ry=e=>e.updateNodeInternals;function oy(){const e=oe(ry),[t]=L.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return L.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function iy({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=fe(),i=L.useRef(null),s=L.useRef(null),a=L.useRef(e.sourcePosition),c=L.useRef(e.targetPosition),l=L.useRef(t),d=n&&!!e.internals.handleBounds;return L.useEffect(()=>{i.current&&!e.hidden&&(!d||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[d,e.hidden]),L.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),L.useEffect(()=>{if(i.current){const u=l.current!==t,f=a.current!==e.sourcePosition,h=c.current!==e.targetPosition;(u||f||h)&&(l.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function sy({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:d,resizeObserver:u,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:m,nodeTypes:p,nodeClickDistance:x,onError:v}){const{node:y,internals:w,isParent:E}=oe(D=>{const H=D.nodeLookup.get(e),Z=D.parentLookup.has(e);return{node:H,internals:H.internals,isParent:Z}},de);let k=y.type||"default",S=(p==null?void 0:p[k])||Fs[k];S===void 0&&(v==null||v("003",Le.error003(k)),k="default",S=(p==null?void 0:p.default)||Fs.default);const P=!!(y.draggable||a&&typeof y.draggable>"u"),M=!!(y.selectable||c&&typeof y.selectable>"u"),A=!!(y.connectable||l&&typeof y.connectable>"u"),C=!!(y.focusable||d&&typeof y.focusable>"u"),R=fe(),j=Ac(y),b=iy({node:y,nodeType:k,hasDimensions:j,resizeObserver:u}),T=cl({nodeRef:b,disabled:y.hidden||!P,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:x}),N=ll();if(y.hidden)return null;const I=Ge(y),$=Kx(y),z=M||P||t||n||r||o,F=n?D=>n(D,{...w.userNode}):void 0,O=r?D=>r(D,{...w.userNode}):void 0,B=o?D=>o(D,{...w.userNode}):void 0,V=i?D=>i(D,{...w.userNode}):void 0,q=s?D=>s(D,{...w.userNode}):void 0,W=D=>{const{selectNodesOnDrag:H,nodeDragThreshold:Z}=R.getState();M&&(!H||!P||Z>0)&&Ro({id:e,store:R,nodeRef:b}),t&&t(D,{...w.userNode})},Q=D=>{if(!($c(D.nativeEvent)||g)){if(kc.includes(D.key)&&M){const H=D.key==="Escape";Ro({id:e,store:R,unselect:H,nodeRef:b})}else if(P&&y.selected&&Object.prototype.hasOwnProperty.call(fr,D.key)){D.preventDefault();const{ariaLabelConfig:H}=R.getState();R.setState({ariaLiveMessage:H["node.a11yDescription.ariaLiveMessage"]({direction:D.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),N({direction:fr[D.key],factor:D.shiftKey?4:1})}}},U=()=>{var J;if(g||!((J=b.current)!=null&&J.matches(":focus-visible")))return;const{transform:D,width:H,height:Z,autoPanOnNodeFocus:K,setCenter:Y}=R.getState();if(!K)return;Zo(new Map([[e,y]]),{x:0,y:0,width:H,height:Z},D,!0).length>0||Y(y.position.x+I.width/2,y.position.y+I.height/2,{zoom:D[2]})};return _.jsx("div",{className:he(["react-flow__node",`react-flow__node-${k}`,{[h]:P},y.className,{selected:y.selected,selectable:M,parent:E,draggable:P,dragging:T}]),ref:b,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:z?"all":"none",visibility:j?"visible":"hidden",...y.style,...$},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:O,onMouseLeave:B,onContextMenu:V,onClick:W,onDoubleClick:q,onKeyDown:C?Q:void 0,tabIndex:C?0:void 0,onFocus:C?U:void 0,role:y.ariaRole??(C?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${nl}-${m}`,"aria-label":y.ariaLabel,...y.domAttributes,children:_.jsx(Hx,{value:e,children:_.jsx(S,{id:e,data:y.data,type:k,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:y.selected??!1,selectable:M,draggable:P,deletable:y.deletable??!0,isConnectable:A,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:T,dragHandle:y.dragHandle,zIndex:w.z,parentId:y.parentId,...I})})})}var ay=L.memo(sy);const cy=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function fl(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=oe(cy,de),s=ny(e.onlyRenderVisibleElements),a=oy();return _.jsx("div",{className:"react-flow__nodes",style:Nr,children:s.map(c=>_.jsx(ay,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}fl.displayName="NodeRenderer";const ly=L.memo(fl);function uy(e){return oe(L.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&d0({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),de)}const dy=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return _.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},fy=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return _.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Vs={[ur.Arrow]:dy,[ur.ArrowClosed]:fy};function hy(e){const t=fe();return L.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(Vs,e)?Vs[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Le.error009(e)),null)},[e])}const gy=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const c=hy(t);return c?_.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:_.jsx(c,{color:n,strokeWidth:s})}):null},hl=({defaultColor:e,rfId:t})=>{const n=oe(i=>i.edges),r=oe(i=>i.defaultEdgeOptions),o=L.useMemo(()=>w0(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?_.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:_.jsx("defs",{children:o.map(i=>_.jsx(gy,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};hl.displayName="MarkerDefinitions";var py=L.memo(hl);function gl({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...d}){const[u,f]=L.useState({x:1,y:0,width:0,height:0}),h=he(["react-flow__edge-textwrapper",l]),g=L.useRef(null);return L.useEffect(()=>{if(g.current){const m=g.current.getBBox();f({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),n?_.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:h,visibility:u.width?"visible":"hidden",...d,children:[o&&_.jsx("rect",{width:u.width+2*s[0],x:-s[0],y:-s[1],height:u.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),_.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}gl.displayName="EdgeText";const my=L.memo(gl);function Ir({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...d}){return _.jsxs(_.Fragment,{children:[_.jsx("path",{...d,d:e,fill:"none",className:he(["react-flow__edge-path",d.className])}),l?_.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,r&&Ie(t)&&Ie(n)?_.jsx(my,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function qs({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===X.Left||e===X.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function pl({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:i=X.Top}){const[s,a]=qs({pos:n,x1:e,y1:t,x2:r,y2:o}),[c,l]=qs({pos:i,x1:r,y1:o,x2:e,y2:t}),[d,u,f,h]=Bc({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${s},${a} ${c},${l} ${r},${o}`,d,u,f,h]}function ml(e){return L.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:a,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:p,interactionWidth:x})=>{const[v,y,w]=pl({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a}),E=e.isInternal?void 0:t;return _.jsx(Ir,{id:E,path:v,labelX:y,labelY:w,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:p,interactionWidth:x})})}const xy=ml({isInternal:!1}),xl=ml({isInternal:!0});xy.displayName="SimpleBezierEdge";xl.displayName="SimpleBezierEdgeInternal";function yl(e){return L.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,sourcePosition:h=X.Bottom,targetPosition:g=X.Top,markerEnd:m,markerStart:p,pathOptions:x,interactionWidth:v})=>{const[y,w,E]=Po({sourceX:n,sourceY:r,sourcePosition:h,targetX:o,targetY:i,targetPosition:g,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset,stepPosition:x==null?void 0:x.stepPosition}),k=e.isInternal?void 0:t;return _.jsx(Ir,{id:k,path:y,labelX:w,labelY:E,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:p,interactionWidth:v})})}const wl=yl({isInternal:!1}),vl=yl({isInternal:!0});wl.displayName="SmoothStepEdge";vl.displayName="SmoothStepEdgeInternal";function bl(e){return L.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return _.jsx(wl,{...n,id:r,pathOptions:L.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const yy=bl({isInternal:!1}),_l=bl({isInternal:!0});yy.displayName="StepEdge";_l.displayName="StepEdgeInternal";function Sl(e){return L.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:m})=>{const[p,x,v]=Hc({sourceX:n,sourceY:r,targetX:o,targetY:i}),y=e.isInternal?void 0:t;return _.jsx(Ir,{id:y,path:p,labelX:x,labelY:v,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:m})})}const wy=Sl({isInternal:!1}),El=Sl({isInternal:!0});wy.displayName="StraightEdge";El.displayName="StraightEdgeInternal";function kl(e){return L.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=X.Bottom,targetPosition:a=X.Top,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:p,pathOptions:x,interactionWidth:v})=>{const[y,w,E]=Oc({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a,curvature:x==null?void 0:x.curvature}),k=e.isInternal?void 0:t;return _.jsx(Ir,{id:k,path:y,labelX:w,labelY:E,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:p,interactionWidth:v})})}const vy=kl({isInternal:!1}),Cl=kl({isInternal:!0});vy.displayName="BezierEdge";Cl.displayName="BezierEdgeInternal";const Ws={default:Cl,straight:El,step:_l,smoothstep:vl,simplebezier:xl},Ys={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},by=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,_y=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,Gs="react-flow__edgeupdater";function Xs({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:a}){return _.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:he([Gs,`${Gs}-${a}`]),cx:by(t,r,e),cy:_y(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Sy({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:d,onReconnectEnd:u,setReconnecting:f,setUpdateHover:h}){const g=fe(),m=(w,E)=>{if(w.button!==0)return;const{autoPanOnConnect:k,domNode:S,connectionMode:P,connectionRadius:M,lib:A,onConnectStart:C,cancelConnection:R,nodeLookup:j,rfId:b,panBy:T,updateConnection:N}=g.getState(),I=E.type==="target",$=(O,B)=>{f(!1),u==null||u(O,n,E.type,B)},z=O=>l==null?void 0:l(n,O),F=(O,B)=>{f(!0),d==null||d(w,n,E.type),C==null||C(O,B)};Io.onPointerDown(w.nativeEvent,{autoPanOnConnect:k,connectionMode:P,connectionRadius:M,domNode:S,handleId:E.id,nodeId:E.nodeId,nodeLookup:j,isTarget:I,edgeUpdaterType:E.type,lib:A,flowId:b,cancelConnection:R,panBy:T,isValidConnection:(...O)=>{var B,V;return((V=(B=g.getState()).isValidConnection)==null?void 0:V.call(B,...O))??!0},onConnect:z,onConnectStart:F,onConnectEnd:(...O)=>{var B,V;return(V=(B=g.getState()).onConnectEnd)==null?void 0:V.call(B,...O)},onReconnectEnd:$,updateConnection:N,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},p=w=>m(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),x=w=>m(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),y=()=>h(!1);return _.jsxs(_.Fragment,{children:[(e===!0||e==="source")&&_.jsx(Xs,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:p,onMouseEnter:v,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&_.jsx(Xs,{position:c,centerX:i,centerY:s,radius:t,onMouseDown:x,onMouseEnter:v,onMouseOut:y,type:"target"})]})}function Ey({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:m,noPanClassName:p,onError:x,disableKeyboardA11y:v}){let y=oe(Y=>Y.edgeLookup.get(e));const w=oe(Y=>Y.defaultEdgeOptions);y=w?{...w,...y}:y;let E=y.type||"default",k=(m==null?void 0:m[E])||Ws[E];k===void 0&&(x==null||x("011",Le.error011(E)),E="default",k=(m==null?void 0:m.default)||Ws.default);const S=!!(y.focusable||t&&typeof y.focusable>"u"),P=typeof u<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),M=!!(y.selectable||r&&typeof y.selectable>"u"),A=L.useRef(null),[C,R]=L.useState(!1),[j,b]=L.useState(!1),T=fe(),{zIndex:N,sourceX:I,sourceY:$,targetX:z,targetY:F,sourcePosition:O,targetPosition:B}=oe(L.useCallback(Y=>{const G=Y.nodeLookup.get(y.source),J=Y.nodeLookup.get(y.target);if(!G||!J)return{zIndex:y.zIndex,...Ys};const ie=y0({id:e,sourceNode:G,targetNode:J,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:Y.connectionMode,onError:x});return{zIndex:u0({selected:y.selected,zIndex:y.zIndex,sourceNode:G,targetNode:J,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode}),...ie||Ys}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),de),V=L.useMemo(()=>y.markerStart?`url('#${Mo(y.markerStart,g)}')`:void 0,[y.markerStart,g]),q=L.useMemo(()=>y.markerEnd?`url('#${Mo(y.markerEnd,g)}')`:void 0,[y.markerEnd,g]);if(y.hidden||I===null||$===null||z===null||F===null)return null;const W=Y=>{var se;const{addSelectedEdges:G,unselectNodesAndEdges:J,multiSelectionActive:ie}=T.getState();M&&(T.setState({nodesSelectionActive:!1}),y.selected&&ie?(J({nodes:[],edges:[y]}),(se=A.current)==null||se.blur()):G([e])),o&&o(Y,y)},Q=i?Y=>{i(Y,{...y})}:void 0,U=s?Y=>{s(Y,{...y})}:void 0,D=a?Y=>{a(Y,{...y})}:void 0,H=c?Y=>{c(Y,{...y})}:void 0,Z=l?Y=>{l(Y,{...y})}:void 0,K=Y=>{var G;if(!v&&kc.includes(Y.key)&&M){const{unselectNodesAndEdges:J,addSelectedEdges:ie}=T.getState();Y.key==="Escape"?((G=A.current)==null||G.blur(),J({edges:[y]})):ie([e])}};return _.jsx("svg",{style:{zIndex:N},children:_.jsxs("g",{className:he(["react-flow__edge",`react-flow__edge-${E}`,y.className,p,{selected:y.selected,animated:y.animated,inactive:!M&&!o,updating:C,selectable:M}]),onClick:W,onDoubleClick:Q,onContextMenu:U,onMouseEnter:D,onMouseMove:H,onMouseLeave:Z,onKeyDown:S?K:void 0,tabIndex:S?0:void 0,role:y.ariaRole??(S?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":S?`${rl}-${g}`:void 0,ref:A,...y.domAttributes,children:[!j&&_.jsx(k,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:M,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:I,sourceY:$,targetX:z,targetY:F,sourcePosition:O,targetPosition:B,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:V,markerEnd:q,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),P&&_.jsx(Sy,{edge:y,isReconnectable:P,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,sourceX:I,sourceY:$,targetX:z,targetY:F,sourcePosition:O,targetPosition:B,setUpdateHover:R,setReconnecting:b})]})})}var ky=L.memo(Ey);const Cy=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Pl({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:m}){const{edgesFocusable:p,edgesReconnectable:x,elementsSelectable:v,onError:y}=oe(Cy,de),w=uy(t);return _.jsxs("div",{className:"react-flow__edges",children:[_.jsx(py,{defaultColor:e,rfId:n}),w.map(E=>_.jsx(ky,{id:E,edgesFocusable:p,edgesReconnectable:x,elementsSelectable:v,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:d,reconnectRadius:u,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:m},E))]})}Pl.displayName="EdgeRenderer";const Py=L.memo(Pl),My=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ny({children:e}){const t=oe(My);return _.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Iy(e){const t=si(),n=L.useRef(!1);L.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Ry=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Ly(e){const t=oe(Ry),n=fe();return L.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Ty(e){return e.connection.inProgress?{...e.connection,to:Wt(e.connection.to,e.transform)}:{...e.connection}}function Ay(e){return Ty}function jy(e){const t=Ay();return oe(t,de)}const zy=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function $y({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:a,inProgress:c}=oe(zy,de);return!(i&&o&&c)?null:_.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:_.jsx("g",{className:he(["react-flow__connection",Mc(a)]),children:_.jsx(Ml,{style:t,type:n,CustomComponent:r,isValid:a})})})}const Ml=({style:e,type:t=Je.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:a,fromPosition:c,to:l,toNode:d,toHandle:u,toPosition:f,pointer:h}=jy();if(!o)return;if(n)return _.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Mc(r),toNode:d,toHandle:u,pointer:h});let g="";const m={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Je.Bezier:[g]=Oc(m);break;case Je.SimpleBezier:[g]=pl(m);break;case Je.Step:[g]=Po({...m,borderRadius:0});break;case Je.SmoothStep:[g]=Po(m);break;default:[g]=Hc(m)}return _.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Ml.displayName="ConnectionLine";const Dy={};function Us(e=Dy){L.useRef(e),fe(),L.useEffect(()=>{},[e])}function By(){fe(),L.useRef(!1),L.useEffect(()=>{},[])}function Nl({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:m,connectionLineComponent:p,connectionLineContainerStyle:x,selectionKeyCode:v,selectionOnDrag:y,selectionMode:w,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:P,onlyRenderVisibleElements:M,elementsSelectable:A,defaultViewport:C,translateExtent:R,minZoom:j,maxZoom:b,preventScrolling:T,defaultMarkerColor:N,zoomOnScroll:I,zoomOnPinch:$,panOnScroll:z,panOnScrollSpeed:F,panOnScrollMode:O,zoomOnDoubleClick:B,panOnDrag:V,autoPanOnSelection:q,onPaneClick:W,onPaneMouseEnter:Q,onPaneMouseMove:U,onPaneMouseLeave:D,onPaneScroll:H,onPaneContextMenu:Z,paneClickDistance:K,nodeClickDistance:Y,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:ie,onEdgeMouseLeave:se,reconnectRadius:ce,onReconnect:ge,onReconnectStart:ye,onReconnectEnd:pe,noDragClassName:Pe,noWheelClassName:Xe,noPanClassName:Oe,disableKeyboardA11y:Ae,nodeExtent:ee,rfId:le,viewport:me,onViewportChange:Fe}){return Us(e),Us(t),By(),Iy(n),Ly(me),_.jsx(ey,{onPaneClick:W,onPaneMouseEnter:Q,onPaneMouseMove:U,onPaneMouseLeave:D,onPaneContextMenu:Z,onPaneScroll:H,paneClickDistance:K,deleteKeyCode:P,selectionKeyCode:v,selectionOnDrag:y,selectionMode:w,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:A,zoomOnScroll:I,zoomOnPinch:$,zoomOnDoubleClick:B,panOnScroll:z,panOnScrollSpeed:F,panOnScrollMode:O,panOnDrag:V,autoPanOnSelection:q,defaultViewport:C,translateExtent:R,minZoom:j,maxZoom:b,onSelectionContextMenu:u,preventScrolling:T,noDragClassName:Pe,noWheelClassName:Xe,noPanClassName:Oe,disableKeyboardA11y:Ae,onViewportChange:Fe,isControlledViewport:!!me,children:_.jsxs(Ny,{children:[_.jsx(Py,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:ge,onReconnectStart:ye,onReconnectEnd:pe,onlyRenderVisibleElements:M,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:ie,onEdgeMouseLeave:se,reconnectRadius:ce,defaultMarkerColor:N,noPanClassName:Oe,disableKeyboardA11y:Ae,rfId:le}),_.jsx($y,{style:m,type:g,component:p,containerStyle:x}),_.jsx("div",{className:"react-flow__edgelabel-renderer"}),_.jsx(ly,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,nodeClickDistance:Y,onlyRenderVisibleElements:M,noPanClassName:Oe,noDragClassName:Pe,disableKeyboardA11y:Ae,nodeExtent:ee,rfId:le}),_.jsx("div",{className:"react-flow__viewport-portal"})]})})}Nl.displayName="GraphView";const Oy=L.memo(Nl),Fy=Tc(),Ks=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c=.5,maxZoom:l=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,m=new Map,p=new Map,x=r??t??[],v=n??e??[],y=d??[0,0],w=u??gn;Wc(m,p,x);const{nodesInitialized:E}=No(v,h,g,{nodeOrigin:y,nodeExtent:w,zIndexMode:f});let k=[0,0,1];if(s&&o&&i){const S=Sn(h,{filter:C=>!!((C.width||C.initialWidth)&&(C.height||C.initialHeight))}),{x:P,y:M,zoom:A}=Jo(S,o,i,c,l,(a==null?void 0:a.padding)??.1);k=[P,M,A]}return{rfId:"1",width:o??0,height:i??0,transform:k,nodes:v,nodesInitialized:E,nodeLookup:h,parentLookup:g,edges:x,edgeLookup:p,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:gn,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Dt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Pc},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Fy,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Cc,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Hy=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>tx((h,g)=>{async function m(){const{nodeLookup:p,panZoom:x,fitViewOptions:v,fitViewResolver:y,width:w,height:E,minZoom:k,maxZoom:S}=g();x&&(await r0({nodes:p,width:w,height:E,panZoom:x,minZoom:k,maxZoom:S},v),y==null||y.resolve(!0),h({fitViewResolver:null}))}return{...Ks({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:p=>{const{nodeLookup:x,parentLookup:v,nodeOrigin:y,elevateNodesOnSelect:w,fitViewQueued:E,zIndexMode:k,nodesSelectionActive:S}=g(),{nodesInitialized:P,hasSelectedNodes:M}=No(p,x,v,{nodeOrigin:y,nodeExtent:u,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:k}),A=S&&M;E&&P?(m(),h({nodes:p,nodesInitialized:P,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):h({nodes:p,nodesInitialized:P,nodesSelectionActive:A})},setEdges:p=>{const{connectionLookup:x,edgeLookup:v}=g();Wc(x,v,p),h({edges:p})},setDefaultNodesAndEdges:(p,x)=>{if(p){const{setNodes:v}=g();v(p),h({hasDefaultNodes:!0})}if(x){const{setEdges:v}=g();v(x),h({hasDefaultEdges:!0})}},updateNodeInternals:p=>{const{triggerNodeChanges:x,nodeLookup:v,parentLookup:y,domNode:w,nodeOrigin:E,nodeExtent:k,debug:S,fitViewQueued:P,zIndexMode:M}=g(),{changes:A,updatedInternals:C}=C0(p,v,y,w,E,k,M);C&&(_0(v,y,{nodeOrigin:E,nodeExtent:k,zIndexMode:M}),P?(m(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(A==null?void 0:A.length)>0&&(S&&console.log("React Flow: trigger node changes",A),x==null||x(A)))},updateNodePositions:(p,x=!1)=>{const v=[];let y=[];const{nodeLookup:w,triggerNodeChanges:E,connection:k,updateConnection:S,onNodesChangeMiddlewareMap:P}=g();for(const[M,A]of p){const C=w.get(M),R=!!(C!=null&&C.expandParent&&(C!=null&&C.parentId)&&(A!=null&&A.position)),j={id:M,type:"position",position:R?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:x};if(C&&k.inProgress&&k.fromNode.id===C.id){const b=vt(C,k.fromHandle,X.Left,!0);S({...k,from:b})}R&&C.parentId&&v.push({id:M,parentId:C.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),y.push(j)}if(v.length>0){const{parentLookup:M,nodeOrigin:A}=g(),C=ii(v,w,M,A);y.push(...C)}for(const M of P.values())y=M(y);E(y)},triggerNodeChanges:p=>{const{onNodesChange:x,setNodes:v,nodes:y,hasDefaultNodes:w,debug:E}=g();if(p!=null&&p.length){if(w){const k=_x(p,y);v(k)}E&&console.log("React Flow: trigger node changes",p),x==null||x(p)}},triggerEdgeChanges:p=>{const{onEdgesChange:x,setEdges:v,edges:y,hasDefaultEdges:w,debug:E}=g();if(p!=null&&p.length){if(w){const k=Sx(p,y);v(k)}E&&console.log("React Flow: trigger edge changes",p),x==null||x(p)}},addSelectedNodes:p=>{const{multiSelectionActive:x,edgeLookup:v,nodeLookup:y,triggerNodeChanges:w,triggerEdgeChanges:E}=g();if(x){const k=p.map(S=>st(S,!0));w(k);return}w(Nt(y,new Set([...p]),!0)),E(Nt(v))},addSelectedEdges:p=>{const{multiSelectionActive:x,edgeLookup:v,nodeLookup:y,triggerNodeChanges:w,triggerEdgeChanges:E}=g();if(x){const k=p.map(S=>st(S,!0));E(k);return}E(Nt(v,new Set([...p]))),w(Nt(y,new Set,!0))},unselectNodesAndEdges:({nodes:p,edges:x}={})=>{const{edges:v,nodes:y,nodeLookup:w,triggerNodeChanges:E,triggerEdgeChanges:k}=g(),S=p||y,P=x||v,M=[];for(const C of S){if(!C.selected)continue;const R=w.get(C.id);R&&(R.selected=!1),M.push(st(C.id,!1))}const A=[];for(const C of P)C.selected&&A.push(st(C.id,!1));E(M),k(A)},setMinZoom:p=>{const{panZoom:x,maxZoom:v}=g();x==null||x.setScaleExtent([p,v]),h({minZoom:p})},setMaxZoom:p=>{const{panZoom:x,minZoom:v}=g();x==null||x.setScaleExtent([v,p]),h({maxZoom:p})},setTranslateExtent:p=>{var x;(x=g().panZoom)==null||x.setTranslateExtent(p),h({translateExtent:p})},resetSelectedElements:()=>{const{edges:p,nodes:x,triggerNodeChanges:v,triggerEdgeChanges:y,elementsSelectable:w}=g();if(!w)return;const E=x.reduce((S,P)=>P.selected?[...S,st(P.id,!1)]:S,[]),k=p.reduce((S,P)=>P.selected?[...S,st(P.id,!1)]:S,[]);v(E),y(k)},setNodeExtent:p=>{const{nodes:x,nodeLookup:v,parentLookup:y,nodeOrigin:w,elevateNodesOnSelect:E,nodeExtent:k,zIndexMode:S}=g();p[0][0]===k[0][0]&&p[0][1]===k[0][1]&&p[1][0]===k[1][0]&&p[1][1]===k[1][1]||(No(x,v,y,{nodeOrigin:w,nodeExtent:p,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:S}),h({nodeExtent:p}))},panBy:p=>{const{transform:x,width:v,height:y,panZoom:w,translateExtent:E}=g();return P0({delta:p,panZoom:w,transform:x,translateExtent:E,width:v,height:y})},setCenter:async(p,x,v)=>{const{width:y,height:w,maxZoom:E,panZoom:k}=g();if(!k)return!1;const S=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:E;return await k.setViewport({x:y/2-p*S,y:w/2-x*S,zoom:S},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),!0},cancelConnection:()=>{h({connection:{...Pc}})},updateConnection:p=>{h({connection:p})},reset:()=>h({...Ks()})}},Object.is);function Vy({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:c,fitView:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f,children:h}){const[g]=L.useState(()=>Hy({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:l,minZoom:s,maxZoom:a,fitViewOptions:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f}));return _.jsx(nx,{value:g,children:_.jsx(Nx,{children:h})})}function qy({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:c,minZoom:l,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:h}){return L.useContext(Pr)?_.jsx(_.Fragment,{children:e}):_.jsx(Vy,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:h,children:e})}const Wy={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Yy({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:m,onClickConnectStart:p,onClickConnectEnd:x,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:w,onNodeContextMenu:E,onNodeDoubleClick:k,onNodeDragStart:S,onNodeDrag:P,onNodeDragStop:M,onNodesDelete:A,onEdgesDelete:C,onDelete:R,onSelectionChange:j,onSelectionDragStart:b,onSelectionDrag:T,onSelectionDragStop:N,onSelectionContextMenu:I,onSelectionStart:$,onSelectionEnd:z,onBeforeDelete:F,connectionMode:O,connectionLineType:B=Je.Bezier,connectionLineStyle:V,connectionLineComponent:q,connectionLineContainerStyle:W,deleteKeyCode:Q="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:D=!1,selectionMode:H=pn.Full,panActivationKeyCode:Z="Space",multiSelectionKeyCode:K=xn()?"Meta":"Control",zoomActivationKeyCode:Y=xn()?"Meta":"Control",snapToGrid:G,snapGrid:J,onlyRenderVisibleElements:ie=!1,selectNodesOnDrag:se,nodesDraggable:ce,autoPanOnNodeFocus:ge,nodesConnectable:ye,nodesFocusable:pe,nodeOrigin:Pe=ol,edgesFocusable:Xe,edgesReconnectable:Oe,elementsSelectable:Ae=!0,defaultViewport:ee=px,minZoom:le=.5,maxZoom:me=2,translateExtent:Fe=gn,preventScrolling:cu=!0,nodeExtent:Ar,defaultMarkerColor:lu="#b1b1b7",zoomOnScroll:uu=!0,zoomOnPinch:du=!0,panOnScroll:fu=!1,panOnScrollSpeed:hu=.5,panOnScrollMode:gu=pt.Free,zoomOnDoubleClick:pu=!0,panOnDrag:mu=!0,onPaneClick:xu,onPaneMouseEnter:yu,onPaneMouseMove:wu,onPaneMouseLeave:vu,onPaneScroll:bu,onPaneContextMenu:_u,paneClickDistance:Su=1,nodeClickDistance:Eu=0,children:ku,onReconnect:Cu,onReconnectStart:Pu,onReconnectEnd:Mu,onEdgeContextMenu:Nu,onEdgeDoubleClick:Iu,onEdgeMouseEnter:Ru,onEdgeMouseMove:Lu,onEdgeMouseLeave:Tu,reconnectRadius:Au=10,onNodesChange:ju,onEdgesChange:zu,noDragClassName:$u="nodrag",noWheelClassName:Du="nowheel",noPanClassName:gi="nopan",fitView:pi,fitViewOptions:mi,connectOnClick:Bu,attributionPosition:Ou,proOptions:Fu,defaultEdgeOptions:Hu,elevateNodesOnSelect:Vu=!0,elevateEdgesOnSelect:qu=!1,disableKeyboardA11y:xi=!1,autoPanOnConnect:Wu,autoPanOnNodeDrag:Yu,autoPanOnSelection:Gu=!0,autoPanSpeed:Xu,connectionRadius:Uu,isValidConnection:Ku,onError:Zu,style:Qu,id:yi,nodeDragThreshold:Ju,connectionDragThreshold:ed,viewport:td,onViewportChange:nd,width:rd,height:od,colorMode:id="light",debug:sd,onScroll:Cn,ariaLabelConfig:ad,zIndexMode:wi="basic",...cd},ld){const jr=yi||"1",ud=wx(id),dd=L.useCallback(vi=>{vi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Cn==null||Cn(vi)},[Cn]);return _.jsx("div",{"data-testid":"rf__wrapper",...cd,onScroll:dd,style:{...Qu,...Wy},ref:ld,className:he(["react-flow",o,ud]),id:yi,role:"application",children:_.jsxs(qy,{nodes:e,edges:t,width:rd,height:od,fitView:pi,fitViewOptions:mi,minZoom:le,maxZoom:me,nodeOrigin:Pe,nodeExtent:Ar,zIndexMode:wi,children:[_.jsx(yx,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:m,onClickConnectStart:p,onClickConnectEnd:x,nodesDraggable:ce,autoPanOnNodeFocus:ge,nodesConnectable:ye,nodesFocusable:pe,edgesFocusable:Xe,edgesReconnectable:Oe,elementsSelectable:Ae,elevateNodesOnSelect:Vu,elevateEdgesOnSelect:qu,minZoom:le,maxZoom:me,nodeExtent:Ar,onNodesChange:ju,onEdgesChange:zu,snapToGrid:G,snapGrid:J,connectionMode:O,translateExtent:Fe,connectOnClick:Bu,defaultEdgeOptions:Hu,fitView:pi,fitViewOptions:mi,onNodesDelete:A,onEdgesDelete:C,onDelete:R,onNodeDragStart:S,onNodeDrag:P,onNodeDragStop:M,onSelectionDrag:T,onSelectionDragStart:b,onSelectionDragStop:N,onMove:d,onMoveStart:u,onMoveEnd:f,noPanClassName:gi,nodeOrigin:Pe,rfId:jr,autoPanOnConnect:Wu,autoPanOnNodeDrag:Yu,autoPanSpeed:Xu,onError:Zu,connectionRadius:Uu,isValidConnection:Ku,selectNodesOnDrag:se,nodeDragThreshold:Ju,connectionDragThreshold:ed,onBeforeDelete:F,debug:sd,ariaLabelConfig:ad,zIndexMode:wi}),_.jsx(Oy,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:w,onNodeContextMenu:E,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:s,connectionLineType:B,connectionLineStyle:V,connectionLineComponent:q,connectionLineContainerStyle:W,selectionKeyCode:U,selectionOnDrag:D,selectionMode:H,deleteKeyCode:Q,multiSelectionKeyCode:K,panActivationKeyCode:Z,zoomActivationKeyCode:Y,onlyRenderVisibleElements:ie,defaultViewport:ee,translateExtent:Fe,minZoom:le,maxZoom:me,preventScrolling:cu,zoomOnScroll:uu,zoomOnPinch:du,zoomOnDoubleClick:pu,panOnScroll:fu,panOnScrollSpeed:hu,panOnScrollMode:gu,panOnDrag:mu,autoPanOnSelection:Gu,onPaneClick:xu,onPaneMouseEnter:yu,onPaneMouseMove:wu,onPaneMouseLeave:vu,onPaneScroll:bu,onPaneContextMenu:_u,paneClickDistance:Su,nodeClickDistance:Eu,onSelectionContextMenu:I,onSelectionStart:$,onSelectionEnd:z,onReconnect:Cu,onReconnectStart:Pu,onReconnectEnd:Mu,onEdgeContextMenu:Nu,onEdgeDoubleClick:Iu,onEdgeMouseEnter:Ru,onEdgeMouseMove:Lu,onEdgeMouseLeave:Tu,reconnectRadius:Au,defaultMarkerColor:lu,noDragClassName:$u,noWheelClassName:Du,noPanClassName:gi,rfId:jr,disableKeyboardA11y:xi,nodeExtent:Ar,viewport:td,onViewportChange:nd}),_.jsx(gx,{onSelectionChange:j}),ku,_.jsx(lx,{proOptions:Fu,position:Ou}),_.jsx(cx,{rfId:jr,disableKeyboardA11y:xi})]})})}var Gy=sl(Yy);function Xy({dimensions:e,lineWidth:t,variant:n,className:r}){return _.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:he(["react-flow__background-pattern",n,r])})}function Uy({radius:e,className:t}){return _.jsx("circle",{cx:e,cy:e,r:e,className:he(["react-flow__background-pattern","dots",t])})}var rt;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(rt||(rt={}));const Ky={[rt.Dots]:1,[rt.Lines]:1,[rt.Cross]:6},Zy=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Il({id:e,variant:t=rt.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:a,style:c,className:l,patternClassName:d}){const u=L.useRef(null),{transform:f,patternId:h}=oe(Zy,de),g=r||Ky[t],m=t===rt.Dots,p=t===rt.Cross,x=Array.isArray(n)?n:[n,n],v=[x[0]*f[2]||1,x[1]*f[2]||1],y=g*f[2],w=Array.isArray(i)?i:[i,i],E=p?[y,y]:v,k=[w[0]*f[2]||1+E[0]/2,w[1]*f[2]||1+E[1]/2],S=`${h}${e||""}`;return _.jsxs("svg",{className:he(["react-flow__background",l]),style:{...c,...Nr,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:u,"data-testid":"rf__background",children:[_.jsx("pattern",{id:S,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:m?_.jsx(Uy,{radius:y/2,className:d}):_.jsx(Xy,{dimensions:E,lineWidth:o,variant:t,className:d})}),_.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}Il.displayName="Background";const Qy=L.memo(Il);function Jy(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:_.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function ew(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:_.jsx("path",{d:"M0 0h32v4.2H0z"})})}function tw(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:_.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function nw(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function rw(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function On({children:e,className:t,...n}){return _.jsx("button",{type:"button",className:he(["react-flow__controls-button",t]),...n,children:e})}const ow=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Rl({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:c,className:l,children:d,position:u="bottom-left",orientation:f="vertical","aria-label":h}){const g=fe(),{isInteractive:m,minZoomReached:p,maxZoomReached:x,ariaLabelConfig:v}=oe(ow,de),{zoomIn:y,zoomOut:w,fitView:E}=si(),k=()=>{y(),i==null||i()},S=()=>{w(),s==null||s()},P=()=>{E(o),a==null||a()},M=()=>{g.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c==null||c(!m)},A=f==="horizontal"?"horizontal":"vertical";return _.jsxs(Mr,{className:he(["react-flow__controls",A,l]),position:u,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&_.jsxs(_.Fragment,{children:[_.jsx(On,{onClick:k,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:x,children:_.jsx(Jy,{})}),_.jsx(On,{onClick:S,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:p,children:_.jsx(ew,{})})]}),n&&_.jsx(On,{className:"react-flow__controls-fitview",onClick:P,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:_.jsx(tw,{})}),r&&_.jsx(On,{className:"react-flow__controls-interactive",onClick:M,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:m?_.jsx(rw,{}):_.jsx(nw,{})}),d]})}Rl.displayName="Controls";const iw=L.memo(Rl);function sw({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:a,strokeWidth:c,className:l,borderRadius:d,shapeRendering:u,selected:f,onClick:h}){const{background:g,backgroundColor:m}=i||{},p=s||g||m;return _.jsx("rect",{className:he(["react-flow__minimap-node",{selected:f},l]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:p,stroke:a,strokeWidth:c},shapeRendering:u,onClick:h?x=>h(x,e):void 0})}const aw=L.memo(sw),cw=e=>e.nodes.map(t=>t.id),no=e=>e instanceof Function?e:()=>e;function lw({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=aw,onClick:s}){const a=oe(cw,de),c=no(t),l=no(e),d=no(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return _.jsx(_.Fragment,{children:a.map(f=>_.jsx(dw,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:u},f))})}function uw({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:c}){const{node:l,x:d,y:u,width:f,height:h}=oe(g=>{const m=g.nodeLookup.get(e);if(!m)return{node:void 0,x:0,y:0,width:0,height:0};const p=m.internals.userNode,{x,y:v}=m.internals.positionAbsolute,{width:y,height:w}=Ge(p);return{node:p,x,y:v,width:y,height:w}},de);return!l||l.hidden||!Ac(l)?null:_.jsx(a,{x:d,y:u,width:f,height:h,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:o,strokeColor:n(l),strokeWidth:i,shapeRendering:s,onClick:c,id:l.id})}const dw=L.memo(uw);var fw=L.memo(lw);const hw=200,gw=150,pw=e=>!e.hidden,mw=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Lc(Sn(e.nodeLookup,{filter:pw}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},xw="react-flow__minimap-desc";function Ll({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:d,maskStrokeWidth:u,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:m=!1,zoomable:p=!1,ariaLabel:x,inversePan:v,zoomStep:y=1,offsetScale:w=5}){const E=fe(),k=L.useRef(null),{boundingRect:S,viewBB:P,rfId:M,panZoom:A,translateExtent:C,flowWidth:R,flowHeight:j,ariaLabelConfig:b}=oe(mw,de),T=(e==null?void 0:e.width)??hw,N=(e==null?void 0:e.height)??gw,I=S.width/T,$=S.height/N,z=Math.max(I,$),F=z*T,O=z*N,B=w*z,V=S.x-(F-S.width)/2-B,q=S.y-(O-S.height)/2-B,W=F+B*2,Q=O+B*2,U=`${xw}-${M}`,D=L.useRef(0),H=L.useRef();D.current=z,L.useEffect(()=>{if(k.current&&A)return H.current=z0({domNode:k.current,panZoom:A,getTransform:()=>E.getState().transform,getViewScale:()=>D.current}),()=>{var G;(G=H.current)==null||G.destroy()}},[A]),L.useEffect(()=>{var G;(G=H.current)==null||G.update({translateExtent:C,width:R,height:j,inversePan:v,pannable:m,zoomStep:y,zoomable:p})},[m,p,v,y,C,R,j]);const Z=h?G=>{var se;const[J,ie]=((se=H.current)==null?void 0:se.pointer(G))||[0,0];h(G,{x:J,y:ie})}:void 0,K=g?L.useCallback((G,J)=>{const ie=E.getState().nodeLookup.get(J).internals.userNode;g(G,ie)},[]):void 0,Y=x??b["minimap.ariaLabel"];return _.jsx(Mr,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*z:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:he(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:_.jsxs("svg",{width:T,height:N,viewBox:`${V} ${q} ${W} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":U,ref:k,onClick:Z,children:[Y&&_.jsx("title",{id:U,children:Y}),_.jsx(fw,{onClick:K,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:a}),_.jsx("path",{className:"react-flow__minimap-mask",d:`M${V-B},${q-B}h${W+B*2}v${Q+B*2}h${-W-B*2}z
|
|
23
|
+
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ll.displayName="MiniMap";L.memo(Ll);const yw=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,ww={[Ht.Line]:"right",[Ht.Handle]:"bottom-right"};function vw({nodeId:e,position:t,variant:n=Ht.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:m,onResize:p,onResizeEnd:x}){const v=ul(),y=typeof e=="string"?e:v,w=fe(),E=L.useRef(null),k=n===Ht.Handle,S=oe(L.useCallback(yw(k&&h),[k,h]),de),P=L.useRef(null),M=t??ww[n];L.useEffect(()=>{if(!(!E.current||!y))return P.current||(P.current=U0({domNode:E.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:C,transform:R,snapGrid:j,snapToGrid:b,nodeOrigin:T,domNode:N}=w.getState();return{nodeLookup:C,transform:R,snapGrid:j,snapToGrid:b,nodeOrigin:T,paneDomNode:N}},onChange:(C,R)=>{const{triggerNodeChanges:j,nodeLookup:b,parentLookup:T,nodeOrigin:N}=w.getState(),I=[],$={x:C.x,y:C.y},z=b.get(y);if(z&&z.expandParent&&z.parentId){const F=z.origin??N,O=C.width??z.measured.width??0,B=C.height??z.measured.height??0,V={id:z.id,parentId:z.parentId,rect:{width:O,height:B,...jc({x:C.x??z.position.x,y:C.y??z.position.y},{width:O,height:B},z.parentId,b,F)}},q=ii([V],b,T,N);I.push(...q),$.x=C.x?Math.max(F[0]*O,C.x):void 0,$.y=C.y?Math.max(F[1]*B,C.y):void 0}if($.x!==void 0&&$.y!==void 0){const F={id:y,type:"position",position:{...$}};I.push(F)}if(C.width!==void 0&&C.height!==void 0){const O={id:y,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:C.width,height:C.height}};I.push(O)}for(const F of R){const O={...F,type:"position"};I.push(O)}j(I)},onEnd:({width:C,height:R})=>{const j={id:y,type:"dimensions",resizing:!1,dimensions:{width:C,height:R}};w.getState().triggerNodeChanges([j])}})),P.current.update({controlPosition:M,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:d},keepAspectRatio:u,resizeDirection:f,onResizeStart:m,onResize:p,onResizeEnd:x,shouldResize:g}),()=>{var C;(C=P.current)==null||C.destroy()}},[M,a,c,l,d,u,m,p,x,g]);const A=M.split("-");return _.jsx("div",{className:he(["react-flow__resize-control","nodrag",...A,n,r]),ref:E,style:{...o,scale:S,...s&&{[k?"backgroundColor":"borderColor"]:s}},children:i})}L.memo(vw);var Tl=Object.defineProperty,bw=(e,t,n)=>t in e?Tl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_w=(e,t)=>{for(var n in t)Tl(e,n,{get:t[n],enumerable:!0})},Sw=(e,t,n)=>bw(e,t+"",n),Al={};_w(Al,{Graph:()=>ke,alg:()=>ci,json:()=>zl,version:()=>Cw});var Ew=Object.defineProperty,jl=(e,t)=>{for(var n in t)Ew(e,n,{get:t[n],enumerable:!0})},ke=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let n={},r=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(n[o]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,r(o))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let o,i,s,a,c=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,s=e.name,arguments.length===2&&(a=t,c=!0)):(o=e,i=t,s=r,arguments.length>2&&(a=n,c=!0)),o=""+o,i=""+i,s!==void 0&&(s=""+s);let l=nn(this._isDirected,o,i,s);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=a),this;if(s!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[l]=c?a:this._defaultEdgeLabelFn(o,i,s);let d=kw(this._isDirected,o,i,s);return o=d.v,i=d.w,Object.freeze(d),this._edgeObjs[l]=d,Zs(this._preds[i],o),Zs(this._sucs[o],i),this._in[i][l]=d,this._out[o][l]=d,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?ro(this._isDirected,e):nn(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?ro(this._isDirected,e):nn(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?ro(this._isDirected,e):nn(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let i=o.v,s=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],Qs(this._preds[s],i),Qs(this._sucs[i],s),delete this._in[s][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(o=>o.v===t&&o.w===n||o.v===n&&o.w===t):r}};function Zs(e,t){e[t]?e[t]++:e[t]=1}function Qs(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function nn(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let s=o;o=i,i=s}return o+""+i+""+(r===void 0?"\0":r)}function kw(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let a=o;o=i,i=a}let s={v:o,w:i};return r&&(s.name=r),s}function ro(e,t){return nn(e,t.v,t.w,t.name)}var Cw="4.0.1",zl={};jl(zl,{read:()=>Iw,write:()=>Pw});function Pw(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Mw(e),edges:Nw(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Mw(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function Nw(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Iw(e){let t=new ke(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var ci={};jl(ci,{CycleException:()=>gr,bellmanFord:()=>$l,components:()=>Tw,dijkstra:()=>hr,dijkstraAll:()=>zw,findCycles:()=>$w,floydWarshall:()=>Bw,isAcyclic:()=>Fw,postorder:()=>Vw,preorder:()=>qw,prim:()=>Ww,shortestPaths:()=>Yw,tarjan:()=>Bl,topsort:()=>Ol});var Rw=()=>1;function $l(e,t,n,r){return Lw(e,String(t),n||Rw,r||function(o){return e.outEdges(o)})}function Lw(e,t,n,r){let o={},i,s=0,a=e.nodes(),c=function(u){let f=n(u);o[u.v].distance+f<o[u.w].distance&&(o[u.w]={distance:o[u.v].distance+f,predecessor:u.v},i=!0)},l=function(){a.forEach(function(u){r(u).forEach(function(f){let h=f.v===u?f.v:f.w,g=h===f.v?f.w:f.v;c({v:h,w:g})})})};a.forEach(function(u){let f=u===t?0:Number.POSITIVE_INFINITY;o[u]={distance:f,predecessor:""}});let d=a.length;for(let u=1;u<d&&(i=!1,s++,l(),!!i);u++);if(s===d-1&&(i=!1,l(),i))throw new Error("The graph contains a negative weight cycle");return o}function Tw(e){let t={},n=[],r;function o(i){i in t||(t[i]=!0,r.push(i),e.successors(i).forEach(o),e.predecessors(i).forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var Dl=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let o=this._arr,i=o.length;return n[r]=i,o.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},Aw=()=>1;function hr(e,t,n,r){let o=function(i){return e.outEdges(i)};return jw(e,String(t),n||Aw,r||o)}function jw(e,t,n,r){let o={},i=new Dl,s,a,c=function(l){let d=l.v!==s?l.v:l.w,u=o[d],f=n(l),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+l+" Weight: "+f);h<u.distance&&(u.distance=h,u.predecessor=s,i.decrease(d,h))};for(e.nodes().forEach(function(l){let d=l===t?0:Number.POSITIVE_INFINITY;o[l]={distance:d,predecessor:""},i.add(l,d)});i.size()>0&&(s=i.removeMin(),a=o[s],a.distance!==Number.POSITIVE_INFINITY);)r(s).forEach(c);return o}function zw(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=hr(e,o,t,n),r},{})}function Bl(e){let t=0,n=[],r={},o=[];function i(s){let a=r[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(c){c in r?r[c].onStack&&(a.lowlink=Math.min(a.lowlink,r[c].index)):(i(c),a.lowlink=Math.min(a.lowlink,r[c].lowlink))}),a.lowlink===a.index){let c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(s!==l);o.push(c)}}return e.nodes().forEach(function(s){s in r||i(s)}),o}function $w(e){return Bl(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Dw=()=>1;function Bw(e,t,n){return Ow(e,t||Dw,n||function(r){return e.outEdges(r)})}function Ow(e,t,n){let r={},o=e.nodes();return o.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},o.forEach(function(s){i!==s&&(r[i][s]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(s){let a=s.v===i?s.w:s.v,c=t(s);r[i][a]={distance:c,predecessor:i}})}),o.forEach(function(i){let s=r[i];o.forEach(function(a){let c=r[a];o.forEach(function(l){let d=c[i],u=s[l],f=c[l],h=d.distance+u.distance;h<f.distance&&(f.distance=h,f.predecessor=u.predecessor)})})}),r}var gr=class extends Error{constructor(...e){super(...e)}};function Ol(e){let t={},n={},r=[];function o(i){if(i in n)throw new gr;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(o),delete n[i],r.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new gr;return r}function Fw(e){try{Ol(e)}catch(t){if(t instanceof gr)return!1;throw t}return!0}function Hw(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(a=>{var c;return(c=e.isDirected()?e.successors(a):e.neighbors(a))!=null?c:[]}),s={};return t.forEach(function(a){if(!e.hasNode(a))throw new Error("Graph does not have node: "+a);o=Fl(e,a,n==="post",s,i,r,o)}),o}function Fl(e,t,n,r,o,i,s){return t in r||(r[t]=!0,n||(s=i(s,t)),o(t).forEach(function(a){s=Fl(e,a,n,r,o,i,s)}),n&&(s=i(s,t))),s}function Hl(e,t,n){return Hw(e,t,n,function(r,o){return r.push(o),r},[])}function Vw(e,t){return Hl(e,t,"post")}function qw(e,t){return Hl(e,t,"pre")}function Ww(e,t){let n=new ke,r={},o=new Dl,i;function s(c){let l=c.v===i?c.w:c.v,d=o.priority(l);if(d!==void 0){let u=t(c);u<d&&(r[l]=i,o.decrease(l,u))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(c){o.add(c,Number.POSITIVE_INFINITY),n.setNode(c)}),o.decrease(e.nodes()[0],0);let a=!1;for(;o.size()>0;){if(i=o.removeMin(),i in r)n.setEdge(i,r[i]);else{if(a)throw new Error("Input graph is not connected: "+e);a=!0}e.nodeEdges(i).forEach(s)}return n}function Yw(e,t,n,r){return Gw(e,t,n,r??(o=>{let i=e.outEdges(o);return i??[]}))}function Gw(e,t,n,r){if(n===void 0)return hr(e,t,n,r);let o=!1,i=e.nodes();for(let s=0;s<i.length;s++){let a=r(i[s]);for(let c=0;c<a.length;c++){let l=a[c],d=l.v===i[s]?l.v:l.w,u=d===l.v?l.w:l.v;n({v:d,w:u})<0&&(o=!0)}if(o)return $l(e,t,n,r)}return hr(e,t,n,r)}function Yt(e,t,n,r){let o=r;for(;e.hasNode(o);)o=li(r);return n.dummy=t,e.setNode(o,n),o}function Xw(e){let t=new ke().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function Vl(e){let t=new ke({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Js(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,s=e.width/2,a=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let c,l;return Math.abs(i)*s>Math.abs(o)*a?(i<0&&(a=-a),c=a*o/i,l=a):(o<0&&(s=-s),c=s,l=s*i/o),{x:n+c,y:r+l}}function kn(e){let t=wn(Wl(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function Uw(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=$e(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Kw(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),n=$e(Math.min,t),r=[];e.nodes().forEach(s=>{let a=e.node(s).rank-n;r[a]||(r[a]=[]),r[a].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((s,a)=>{s===void 0&&a%i!==0?--o:s!==void 0&&o&&s.forEach(c=>e.node(c).rank+=o)})}function ea(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),Yt(e,"border",o,t)}function Zw(e,t=ql){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var ql=65535;function $e(e,t){if(t.length>ql){let n=Zw(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function Wl(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return $e(Math.max,t)}function Qw(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function Yl(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Gl(e,t){return t()}var Jw=0;function li(e){let t=++Jw;return e+(""+t)}function wn(e,t,n=1){t==null&&(t=e,e=0);let r=i=>i<t;n<0&&(r=i=>t<i);let o=[];for(let i=e;r(i);i+=n)o.push(i);return o}function pr(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function Rr(e,t){let n;return typeof t=="string"?n=r=>r[t]:n=t,Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function ev(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var Lr="\0",tv="3.0.0",nv=class{constructor(){Sw(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return ta(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&ta(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,rv)),n=n._prev;return"["+e.join(", ")+"]"}};function ta(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function rv(e,t){if(e!=="_next"&&e!=="_prev")return t}var ov=nv,iv=()=>1;function sv(e,t){if(e.nodeCount()<=1)return[];let n=cv(e,t||iv);return av(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function av(e,t,n){var r;let o=[],i=t[t.length-1],s=t[0],a;for(;e.nodeCount();){for(;a=s.dequeue();)oo(e,t,n,a);for(;a=i.dequeue();)oo(e,t,n,a);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(a=(r=t[c])==null?void 0:r.dequeue(),a){o=o.concat(oo(e,t,n,a,!0)||[]);break}}}return o}function oo(e,t,n,r,o){let i=[],s=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(a=>{let c=e.edge(a),l=e.node(a.v);o&&i.push({v:a.v,w:a.w}),l.out-=c,Lo(t,n,l)}),(e.outEdges(r.v)||[]).forEach(a=>{let c=e.edge(a),l=a.w,d=e.node(l);d.in-=c,Lo(t,n,d)}),e.removeNode(r.v),s}function cv(e,t){let n=new ke,r=0,o=0;e.nodes().forEach(a=>{n.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let c=n.edge(a.v,a.w)||0,l=t(a),d=c+l;n.setEdge(a.v,a.w,d);let u=n.node(a.v),f=n.node(a.w);o=Math.max(o,u.out+=l),r=Math.max(r,f.in+=l)});let i=lv(o+r+3).map(()=>new ov),s=r+1;return n.nodes().forEach(a=>{Lo(i,s,n.node(a))}),{graph:n,buckets:i,zeroIdx:s}}function Lo(e,t,n){var r,o,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(o=e[e.length-1])==null||o.enqueue(n):(r=e[0])==null||r.enqueue(n)}function lv(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function uv(e){(e.graph().acyclicer==="greedy"?sv(e,t(e)):dv(e)).forEach(n=>{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,li("rev"))});function t(n){return r=>n.edge(r).weight}}function dv(e){let t=[],n={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(s=>{Object.hasOwn(n,s.w)?t.push(s):o(s.w)}),delete n[i])}return e.nodes().forEach(o),t}function fv(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function hv(e){e.graph().dummyChains=[],e.edges().forEach(t=>gv(e,t))}function gv(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,s=t.name,a=e.edge(t),c=a.labelRank;if(i===r+1)return;e.removeEdge(t);let l,d,u;for(u=0,++r;r<i;++u,++r)a.points=[],d={width:0,height:0,edgeLabel:a,edgeObj:t,rank:r},l=Yt(e,"edge",d,"_d"),r===c&&(d.width=a.width,d.height=a.height,d.dummy="edge-label",d.labelpos=a.labelpos),e.setEdge(n,l,{weight:a.weight},s),u===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,o,{weight:a.weight},s)}function pv(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}function ui(e){let t={};function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),s=i?i.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],a=$e(Math.min,s);return a===Number.POSITIVE_INFINITY&&(a=0),o.rank=a}e.sources().forEach(n)}function qt(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Xl=mv;function mv(e){let t=new ke({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=e.nodeCount();t.setNode(r,{});let i,s;for(;xv(t,e)<o&&(i=yv(t,e),!!i);)s=t.hasNode(i.v)?qt(e,i):-qt(e,i),wv(t,e,s);return t}function xv(e,t){function n(r){let o=t.nodeEdges(r);o&&o.forEach(i=>{let s=i.v,a=r===s?i.w:s;!e.hasNode(a)&&!qt(t,i)&&(e.setNode(a,{}),e.setEdge(r,a,{}),n(a))})}return e.nodes().forEach(n),e.nodeCount()}function yv(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=qt(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function wv(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:vv,postorder:bv}=ci,_v=St;St.initLowLimValues=fi;St.initCutValues=di;St.calcCutValue=Ul;St.leaveEdge=Zl;St.enterEdge=Ql;St.exchangeEdges=Jl;function St(e){e=Xw(e),ui(e);let t=Xl(e);fi(t),di(t,e);let n,r;for(;n=Zl(t);)r=Ql(t,e,n),Jl(t,e,n,r)}function di(e,t){let n=bv(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Sv(e,t,r))}function Sv(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=Ul(e,t,n)}function Ul(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),s=0;i||(o=!1,i=t.edge(r,n)),s=i.weight;let a=t.nodeEdges(n);return a&&a.forEach(c=>{let l=c.v===n,d=l?c.w:c.v;if(d!==r){let u=l===o,f=t.edge(c).weight;if(s+=u?f:-f,kv(e,n,d)){let h=e.edge(n,d).cutvalue;s+=u?-h:h}}}),s}function fi(e,t){arguments.length<2&&(t=e.nodes()[0]),Kl(e,{},1,t)}function Kl(e,t,n,r,o){let i=n,s=e.node(r);t[r]=!0;let a=e.neighbors(r);return a&&a.forEach(c=>{Object.hasOwn(t,c)||(n=Kl(e,t,n,c,r))}),s.low=i,s.lim=n++,o?s.parent=o:delete s.parent,n}function Zl(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Ql(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),s=e.node(o),a=i,c=!1;return i.lim>s.lim&&(a=s,c=!0),t.edges().filter(l=>c===na(e,e.node(l.v),a)&&c!==na(e,e.node(l.w),a)).reduce((l,d)=>qt(t,d)<qt(t,l)?d:l)}function Jl(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),fi(e),di(e,t),Ev(e,t)}function Ev(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=vv(e,[n]);r=r.slice(1),r.forEach(o=>{let i=e.node(o).parent,s=t.edge(o,i),a=!1;s||(s=t.edge(i,o),a=!0),t.node(o).rank=t.node(i).rank+(a?s.minlen:-s.minlen)})}function kv(e,t,n){return e.hasEdge(t,n)}function na(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Cv=Pv;function Pv(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":ra(e);break;case"tight-tree":Nv(e);break;case"longest-path":Mv(e);break;case"none":break;default:ra(e)}}var Mv=ui;function Nv(e){ui(e),Xl(e)}function ra(e){_v(e)}var Iv=Rv;function Rv(e){let t=Tv(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=Lv(e,t,o.v,o.w),s=i.path,a=i.lca,c=0,l=s[c],d=!0;for(;n!==o.w;){if(r=e.node(n),d){for(;(l=s[c])!==a&&e.node(l).maxRank<r.rank;)c++;l===a&&(d=!1)}if(!d){for(;c<s.length-1&&e.node(s[c+1]).minRank<=r.rank;)c++;l=s[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function Lv(e,t,n,r){let o=[],i=[],s=Math.min(t[n].low,t[r].low),a=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),o.push(c);while(c&&(t[c].low>s||a>t[c].lim));let l=c,d=r;for(;(d=e.parent(d))!==l;)i.push(d);return{path:o.concat(i.reverse()),lca:l}}function Tv(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children(Lr).forEach(r),t}function Av(e){let t=Yt(e,"root",{},"_root"),n=jv(e),r=Object.values(n),o=$e(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(a=>e.edge(a).minlen*=i);let s=zv(e)+1;e.children(Lr).forEach(a=>eu(e,t,i,s,o,n,a)),e.graph().nodeRankFactor=i}function eu(e,t,n,r,o,i,s){var a;let c=e.children(s);if(!c.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let l=ea(e,"_bt"),d=ea(e,"_bb"),u=e.node(s);e.setParent(l,s),u.borderTop=l,e.setParent(d,s),u.borderBottom=d,c.forEach(f=>{var h;eu(e,t,n,r,o,i,f);let g=e.node(f),m=g.borderTop?g.borderTop:f,p=g.borderBottom?g.borderBottom:f,x=g.borderTop?r:2*r,v=m!==p?1:o-((h=i[s])!=null?h:0)+1;e.setEdge(l,m,{weight:x,minlen:v,nestingEdge:!0}),e.setEdge(p,d,{weight:x,minlen:v,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:o+((a=i[s])!=null?a:0)})}function jv(e){let t={};function n(r,o){let i=e.children(r);i&&i.length&&i.forEach(s=>n(s,o+1)),t[r]=o}return e.children(Lr).forEach(r=>n(r,1)),t}function zv(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function $v(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Dv=Bv;function Bv(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;i<s;++i)oa(e,"borderLeft","_bl",n,o,i),oa(e,"borderRight","_br",n,o,i)}}e.children(Lr).forEach(t)}function oa(e,t,n,r,o,i){let s={width:0,height:0,rank:i,borderType:t},a=o[t][i-1],c=Yt(e,"border",s,n);o[t][i]=c,e.setParent(c,r),a&&e.setEdge(a,c,{weight:1})}function Ov(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&tu(e)}function Fv(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&Hv(e),(n==="lr"||n==="rl")&&(Vv(e),tu(e))}function tu(e){e.nodes().forEach(t=>ia(e.node(t))),e.edges().forEach(t=>ia(e.edge(t)))}function ia(e){let t=e.width;e.width=e.height,e.height=t}function Hv(e){e.nodes().forEach(t=>io(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(io),Object.hasOwn(r,"y")&&io(r)})}function io(e){e.y=-e.y}function Vv(e){e.nodes().forEach(t=>so(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(so),Object.hasOwn(r,"x")&&so(r)})}function so(e){let t=e.x;e.x=e.y,e.y=t}function qv(e){let t={},n=e.nodes().filter(a=>!e.children(a).length),r=n.map(a=>e.node(a).rank),o=$e(Math.max,r),i=wn(o+1).map(()=>[]);function s(a){if(t[a])return;t[a]=!0;let c=e.node(a);i[c.rank].push(a);let l=e.successors(a);l&&l.forEach(s)}return n.sort((a,c)=>e.node(a).rank-e.node(c).rank).forEach(s),i}function Wv(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Yv(e,t[r-1],t[r]);return n}function Yv(e,t,n){let r=ev(n,n.map((l,d)=>d)),o=t.flatMap(l=>{let d=e.outEdges(l);return d?d.map(u=>({pos:r[u.w],weight:e.edge(u).weight})).sort((u,f)=>u.pos-f.pos):[]}),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let a=new Array(s).fill(0),c=0;return o.forEach(l=>{let d=l.pos+i;a[d]+=l.weight;let u=0;for(;d>0;)d%2&&(u+=a[d+1]),d=d-1>>1,a[d]+=l.weight;c+=l.weight*u}),c}function Gv(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((i,s)=>{let a=e.edge(s),c=e.node(s.v);return{sum:i.sum+a.weight*c.order,weight:i.weight+a.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Xv(e,t){let n={};e.forEach((o,i)=>{let s={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight),n[o.v]=s}),t.edges().forEach(o=>{let i=n[o.v],s=n[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(s))});let r=Object.values(n).filter(o=>!o.indegree);return Uv(r)}function Uv(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&Kv(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>pr(o,["vs","i","barycenter","weight"]))}function Kv(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Zv(e,t){let n=Qw(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,o=n.rhs.sort((d,u)=>u.i-d.i),i=[],s=0,a=0,c=0;r.sort(Qv(!!t)),c=sa(i,o,c),r.forEach(d=>{c+=d.vs.length,i.push(d.vs),s+=d.barycenter*d.weight,a+=d.weight,c=sa(i,o,c)});let l={vs:i.flat(1)};return a&&(l.barycenter=s/a,l.weight=a),l}function sa(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Qv(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function nu(e,t,n,r){let o=e.children(t),i=e.node(t),s=i?i.borderLeft:void 0,a=i?i.borderRight:void 0,c={};s&&(o=o.filter(f=>f!==s&&f!==a));let l=Gv(e,o);l.forEach(f=>{if(e.children(f.v).length){let h=nu(e,f.v,n,r);c[f.v]=h,Object.hasOwn(h,"barycenter")&&eb(f,h)}});let d=Xv(l,n);Jv(d,c);let u=Zv(d,r);if(s&&a){u.vs=[s,u.vs,a].flat(1);let f=e.predecessors(s);if(f&&f.length){let h=e.node(f[0]),g=e.predecessors(a),m=e.node(g[0]);Object.hasOwn(u,"barycenter")||(u.barycenter=0,u.weight=0),u.barycenter=(u.barycenter*u.weight+h.order+m.order)/(u.weight+2),u.weight+=2}}return u}function Jv(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function eb(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function tb(e,t,n,r){r||(r=e.nodes());let o=nb(e),i=new ke({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return r.forEach(s=>{let a=e.node(s),c=e.parent(s);if(a.rank===t||a.minRank<=t&&t<=a.maxRank){i.setNode(s),i.setParent(s,c||o);let l=e[n](s);l&&l.forEach(d=>{let u=d.v===s?d.w:d.v,f=i.edge(u,s),h=f!==void 0?f.weight:0;i.setEdge(u,s,{weight:e.edge(d).weight+h})}),Object.hasOwn(a,"minRank")&&i.setNode(s,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]})}}),i}function nb(e){let t;for(;e.hasNode(t=li("_root")););return t}function rb(e,t,n){let r={},o;n.forEach(i=>{let s=e.parent(i),a,c;for(;s;){if(a=e.parent(s),a?(c=r[a],r[a]=s):(c=o,o=s),c&&c!==s){t.setEdge(c,s);return}s=a}})}function ru(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,ru);return}let n=Wl(e),r=aa(e,wn(1,n+1),"inEdges"),o=aa(e,wn(n-1,-1,-1),"outEdges"),i=qv(e);if(ca(e,i),t.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,a,c=t.constraints||[];for(let l=0,d=0;d<4;++l,++d){ob(l%2?r:o,l%4>=2,c),i=kn(e);let u=Wv(e,i);u<s?(d=0,a=Object.assign({},i),s=u):u===s&&(a=structuredClone(i))}ca(e,a)}function aa(e,t,n){let r=new Map,o=(i,s)=>{r.has(i)||r.set(i,[]),r.get(i).push(s)};for(let i of e.nodes()){let s=e.node(i);if(typeof s.rank=="number"&&o(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&o(a,i)}return t.map(function(i){return tb(e,i,n,r.get(i)||[])})}function ob(e,t,n){let r=new ke;e.forEach(function(o){n.forEach(a=>r.setEdge(a.left,a.right));let i=o.graph().root,s=nu(o,i,r,t);s.vs.forEach((a,c)=>o.node(a).order=c),rb(o,r,s.vs)})}function ca(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function ib(e,t){let n={};function r(o,i){let s=0,a=0,c=o.length,l=i[i.length-1];return i.forEach((d,u)=>{let f=ab(e,d),h=f?e.node(f).order:c;(f||d===l)&&(i.slice(a,u+1).forEach(g=>{let m=e.predecessors(g);m&&m.forEach(p=>{let x=e.node(p),v=x.order;(v<s||h<v)&&!(x.dummy&&e.node(g).dummy)&&ou(n,p,g)})}),a=u+1,s=h)}),i}return t.length&&t.reduce(r),n}function sb(e,t){let n={};function r(i,s,a,c,l){wn(s,a).forEach(d=>{let u=i[d];if(u!==void 0&&e.node(u).dummy){let f=e.predecessors(u);f&&f.forEach(h=>{if(h===void 0)return;let g=e.node(h);g.dummy&&(g.order<c||g.order>l)&&ou(n,h,u)})}})}function o(i,s){let a=-1,c=-1,l=0;return s.forEach((d,u)=>{if(e.node(d).dummy==="border"){let f=e.predecessors(d);if(f&&f.length){let h=f[0];if(h===void 0)return;c=e.node(h).order,r(s,l,u,a,c),l=u,a=c}}r(s,l,s.length,c,i.length)}),s}return t.length&&t.reduce(o),n}function ab(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function ou(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function cb(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function lb(e,t,n,r){let o={},i={},s={};return t.forEach(a=>{a.forEach((c,l)=>{o[c]=c,i[c]=c,s[c]=l})}),t.forEach(a=>{let c=-1;a.forEach(l=>{let d=r(l);if(d&&d.length){let u=d.sort((h,g)=>{let m=s[h],p=s[g];return(m!==void 0?m:0)-(p!==void 0?p:0)}),f=(u.length-1)/2;for(let h=Math.floor(f),g=Math.ceil(f);h<=g;++h){let m=u[h];if(m===void 0)continue;let p=s[m];if(p!==void 0&&i[l]===l&&c<p&&!cb(n,l,m)){let x=o[m];x!==void 0&&(i[m]=l,i[l]=o[l]=x,c=p)}}}})}),{root:o,align:i}}function ub(e,t,n,r,o=!1){let i={},s=db(e,t,n,o),a=o?"borderLeft":"borderRight";function c(h,g){let m=s.nodes().slice(),p={},x=m.pop();for(;x;){if(p[x])h(x);else{p[x]=!0,m.push(x);for(let v of g(x))m.push(v)}x=m.pop()}}function l(h){let g=s.inEdges(h);g?i[h]=g.reduce((m,p)=>{var x;let v=(x=i[p.v])!=null?x:0,y=s.edge(p);return Math.max(m,v+(y!==void 0?y:0))},0):i[h]=0}function d(h){let g=s.outEdges(h),m=Number.POSITIVE_INFINITY;g&&(m=g.reduce((x,v)=>{let y=i[v.w],w=s.edge(v);return Math.min(x,(y!==void 0?y:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let p=e.node(h);m!==Number.POSITIVE_INFINITY&&p.borderType!==a&&(i[h]=Math.max(i[h]!==void 0?i[h]:0,m))}function u(h){return s.predecessors(h)||[]}function f(h){return s.successors(h)||[]}return c(l,u),c(d,f),Object.keys(r).forEach(h=>{var g;let m=n[h];m!==void 0&&(i[h]=(g=i[m])!=null?g:0)}),i}function db(e,t,n,r){let o=new ke,i=e.graph(),s=mb(i.nodesep,i.edgesep,r);return t.forEach(a=>{let c;a.forEach(l=>{let d=n[l];if(d!==void 0){if(o.setNode(d),c!==void 0){let u=n[c];if(u!==void 0){let f=o.edge(u,d);o.setEdge(u,d,Math.max(s(e,l,c),f||0))}}c=l}})}),o}function fb(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([a,c])=>{let l=xb(e,a)/2;o=Math.max(c+l,o),i=Math.min(c-l,i)});let s=o-i;return s<n[0]&&(n=[s,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function hb(e,t){let n=Object.values(t),r=$e(Math.min,n),o=$e(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(s=>{let a=i+s,c=e[a];if(!c||c===t)return;let l=Object.values(c),d=r-$e(Math.min,l);s!=="l"&&(d=o-$e(Math.max,l)),d&&(e[a]=Rr(c,u=>u+d))})})}function gb(e,t=void 0){let n=e.ul;return n?Rr(n,(r,o)=>{var i,s;if(t){let c=t.toLowerCase(),l=e[c];if(l&&l[o]!==void 0)return l[o]}let a=Object.values(e).map(c=>{let l=c[o];return l!==void 0?l:0}).sort((c,l)=>c-l);return(((i=a[1])!=null?i:0)+((s=a[2])!=null?s:0))/2}):{}}function pb(e){let t=kn(e),n=Object.assign(ib(e,t),sb(e,t)),r={},o;["u","d"].forEach(s=>{o=s==="u"?t:Object.values(t).reverse(),["l","r"].forEach(a=>{a==="r"&&(o=o.map(d=>Object.values(d).reverse()));let c=lb(e,o,n,d=>(s==="u"?e.predecessors(d):e.successors(d))||[]),l=ub(e,o,c.root,c.align,a==="r");a==="r"&&(l=Rr(l,d=>-d)),r[s+a]=l})});let i=fb(e,r);return hb(r,i),gb(r,e.graph().align)}function mb(e,t,n){return(r,o,i)=>{let s=r.node(o),a=r.node(i),c=0,l;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":l=-s.width/2;break;case"r":l=s.width/2;break}if(l&&(c+=n?l:-l),l=void 0,c+=(s.dummy?t:e)/2,c+=(a.dummy?t:e)/2,c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":l=a.width/2;break;case"r":l=-a.width/2;break}return l&&(c+=n?l:-l),c}}function xb(e,t){return e.node(t).width}function yb(e){e=Vl(e),wb(e),Object.entries(pb(e)).forEach(([t,n])=>e.node(t).x=n)}function wb(e){let t=kn(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(s=>{let a=s.reduce((c,l)=>{var d;let u=(d=e.node(l).height)!=null?d:0;return c>u?c:u},0);s.forEach(c=>{let l=e.node(c);o==="top"?l.y=i+l.height/2:o==="bottom"?l.y=i+a-l.height/2:l.y=i+a/2}),i+=a+r})}function vb(e,t={}){let n=t.debugTiming?Yl:Gl;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>Ib(e));return n(" runLayout",()=>bb(r,n,t)),n(" updateInputGraph",()=>_b(e,r)),r})}function bb(e,t,n){t(" makeSpaceForEdgeLabels",()=>Rb(e)),t(" removeSelfEdges",()=>Ob(e)),t(" acyclic",()=>uv(e)),t(" nestingGraph.run",()=>Av(e)),t(" rank",()=>Cv(Vl(e))),t(" injectEdgeLabelProxies",()=>Lb(e)),t(" removeEmptyRanks",()=>Kw(e)),t(" nestingGraph.cleanup",()=>$v(e)),t(" normalizeRanks",()=>Uw(e)),t(" assignRankMinMax",()=>Tb(e)),t(" removeEdgeLabelProxies",()=>Ab(e)),t(" normalize.run",()=>hv(e)),t(" parentDummyChains",()=>Iv(e)),t(" addBorderSegments",()=>Dv(e)),t(" order",()=>ru(e,n)),t(" insertSelfEdges",()=>Fb(e)),t(" adjustCoordinateSystem",()=>Ov(e)),t(" position",()=>yb(e)),t(" positionSelfEdges",()=>Hb(e)),t(" removeBorderNodes",()=>Bb(e)),t(" normalize.undo",()=>pv(e)),t(" fixupEdgeLabelCoords",()=>$b(e)),t(" undoCoordinateSystem",()=>Fv(e)),t(" translateGraph",()=>jb(e)),t(" assignNodeIntersects",()=>zb(e)),t(" reversePoints",()=>Db(e)),t(" acyclic.undo",()=>fv(e))}function _b(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Sb=["nodesep","edgesep","ranksep","marginx","marginy"],Eb={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},kb=["acyclicer","ranker","rankdir","align","rankalign"],Cb=["width","height","rank"],la={width:0,height:0},Pb=["minlen","weight","width","height","labeloffset"],Mb={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Nb=["labelpos"];function Ib(e){let t=new ke({multigraph:!0,compound:!0}),n=co(e.graph());return t.setGraph(Object.assign({},Eb,ao(n,Sb),pr(n,kb))),e.nodes().forEach(r=>{let o=co(e.node(r)),i=ao(o,Cb);Object.keys(la).forEach(a=>{i[a]===void 0&&(i[a]=la[a])}),t.setNode(r,i);let s=e.parent(r);s!==void 0&&t.setParent(r,s)}),e.edges().forEach(r=>{let o=co(e.edge(r));t.setEdge(r,Object.assign({},Mb,ao(o,Pb),pr(o,Nb)))}),t}function Rb(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Lb(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),o={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};Yt(e,"edge-proxy",o,"_ep")}})}function Tb(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Ab(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function jb(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,a=i.marginy||0;function c(l){let d=l.x,u=l.y,f=l.width,h=l.height;t=Math.min(t,d-f/2),n=Math.max(n,d+f/2),r=Math.min(r,u-h/2),o=Math.max(o,u+h/2)}e.nodes().forEach(l=>c(e.node(l))),e.edges().forEach(l=>{let d=e.edge(l);Object.hasOwn(d,"x")&&c(d)}),t-=s,r-=a,e.nodes().forEach(l=>{let d=e.node(l);d.x-=t,d.y-=r}),e.edges().forEach(l=>{let d=e.edge(l);d.points.forEach(u=>{u.x-=t,u.y-=r}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=r)}),i.width=n-t+s,i.height=o-r+a}function zb(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=o,s=r),n.points.unshift(Js(r,i)),n.points.push(Js(o,s))})}function $b(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function Db(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Bb(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Ob(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Fb(e){kn(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);i.order=o+n,(i.selfEdges||[]).forEach(s=>{Yt(e,"selfedge",{width:s.label.width,height:s.label.height,rank:i.rank,order:o+ ++n,e:s.e,label:s.label},"_se")}),delete i.selfEdges})})}function Hb(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,o=e.node(r.e.v),i=o.x+o.width/2,s=o.y,a=n.x-i,c=o.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*a/3,y:s-c},{x:i+5*a/6,y:s-c},{x:i+a,y:s},{x:i+5*a/6,y:s+c},{x:i+2*a/3,y:s+c}],r.label.x=n.x,r.label.y=n.y}})}function ao(e,t){return Rr(pr(e,t),Number)}function co(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Vb(e){let t=kn(e),n=new ke({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,o)=>{let i="layer"+o;n.setNode(i,{rank:"same"}),r.reduce((s,a)=>(n.setEdge(s,a,{style:"invis"}),a))}),n}var qb={graphlib:Al,version:tv,layout:vb,debug:Vb,util:{time:Yl,notime:Gl}},ua=qb;/*! For license information please see dagre.esm.js.LEGAL.txt */const da=210,fa=60;function Wb(e){const t=new ua.graphlib.Graph;t.setGraph({rankdir:"LR",nodesep:36,ranksep:96}),t.setDefaultEdgeLabel(()=>({}));for(const o of e.nodes)t.setNode(o.id,{width:da,height:fa});for(const o of e.edges)t.setEdge(o.from,o.to);ua.layout(t);const n=e.nodes.map(o=>{const{x:i,y:s}=t.node(o.id);return{id:o.id,type:"karta",position:{x:i-da/2,y:s-fa/2},data:{node:o,dimmed:!1}}}),r=e.edges.map(o=>({id:`${o.from}->${o.to}`,source:o.from,target:o.to,label:o.kind,animated:o.kind==="calls"}));return{nodes:n,edges:r}}var ae=bt;ae(".width-xc5o50y{width:210px}",4e3);ae(".boxSizing-x9f619{box-sizing:border-box}",3e3);ae(".paddingTop-x1y1aw1k{padding-top:8px}",4e3);ae(".paddingBottom-xwib8y2{padding-bottom:8px}",4e3);ae(".paddingLeft-xf18ygs{padding-left:12px}",4e3);ae(".paddingRight-xnuq7ks{padding-right:12px}",4e3);ae(".borderRadius-xur7f20{border-radius:8px}",2e3);ae(".borderWidth-xmkeg23{border-width:1px}",2e3);ae(".borderStyle-x1y0btm7{border-style:solid}",2e3);ae(".borderColor-x1ugr8pw{border-color:var(--border-xcu5if3)}",2e3);ae(".borderLeftWidth-xc8hjz9{border-left-width:4px}",4e3);ae(".backgroundColor-xa3hp3g{background-color:var(--panel-x71edem)}",3e3);ae(".color-x185ec43{color:var(--text-x1qdqye4)}",3e3);ae(".fontFamily-x1880mbn{font-family:var(--fontSans-x1k96p3b)}",3e3);ae(".borderColor-xzb565n{border-color:var(--accent-x1it9n6t)}",2e3);ae(".boxShadow-xsteqnx{box-shadow:0 0 0 2px rgba(108,140,255,.35)}",3e3);ae(".opacity-xvpkmg4{opacity:.25}",3e3);ae(".fontSize-x1k6wstc{font-size:10px}",3e3);ae(".textTransform-xtvhhri{text-transform:uppercase}",3e3);ae(".letterSpacing-x9pfba7{letter-spacing:.08em}",3e3);ae(".fontSize-x4z9k3i{font-size:13px}",3e3);ae(".fontWeight-x1s688f{font-weight:600}",3e3);ae(".whiteSpace-xuxw1ft{white-space:nowrap}",3e3);ae(".overflow-xb3r6kr{overflow:hidden}",2e3);ae(".textOverflow-xlyipyv{text-overflow:ellipsis}",3e3);ae(".flexGrow-x1iyjqo2{flex-grow:1}",3e3);ae(".minWidth-xeuugli{min-width:0}",4e3);const lo={node:{"GraphCanvas__styles.node":"GraphCanvas__styles.node",width:"width-xc5o50y",boxSizing:"boxSizing-x9f619",paddingTop:"paddingTop-x1y1aw1k",paddingBottom:"paddingBottom-xwib8y2",paddingLeft:"paddingLeft-xf18ygs",paddingRight:"paddingRight-xnuq7ks",borderRadius:"borderRadius-xur7f20",borderWidth:"borderWidth-xmkeg23",borderStyle:"borderStyle-x1y0btm7",borderColor:"borderColor-x1ugr8pw",borderLeftWidth:"borderLeftWidth-xc8hjz9",backgroundColor:"backgroundColor-xa3hp3g",color:"color-x185ec43",fontFamily:"fontFamily-x1880mbn",$$css:!0},nodeSelected:{"GraphCanvas__styles.nodeSelected":"GraphCanvas__styles.nodeSelected",borderColor:"borderColor-xzb565n",boxShadow:"boxShadow-xsteqnx",$$css:!0},nodeDimmed:{"GraphCanvas__styles.nodeDimmed":"GraphCanvas__styles.nodeDimmed",opacity:"opacity-xvpkmg4",$$css:!0}};function Yb({data:e,selected:t}){const{node:n,dimmed:r}=e,o=ya[n.type];return _.jsxs("div",{...Ho(lo.node,t&&lo.nodeSelected,r&&lo.nodeDimmed),style:{borderLeftColor:o},children:[_.jsx(Vt,{type:"target",position:X.Left}),_.jsx("div",{className:"GraphCanvas__styles.type fontSize-x1k6wstc textTransform-xtvhhri letterSpacing-x9pfba7",style:{color:o},children:To[n.type]}),_.jsx("div",{className:"GraphCanvas__styles.title fontSize-x4z9k3i fontWeight-x1s688f whiteSpace-xuxw1ft overflow-xb3r6kr textOverflow-xlyipyv",children:n.title}),_.jsx(Vt,{type:"source",position:X.Right})]})}const Gb={karta:Yb};function Xb({registry:e,selectedId:t,layer:n,audience:r,onSelect:o}){const i=L.useMemo(()=>Wb(e),[e]),s=L.useMemo(()=>i.nodes.map(c=>{const l=c.data.node,d=n!=="all"&&l.type!==n||r!=="all"&&!(l.audience??[]).includes(r);return{...c,selected:l.id===t,data:{...c.data,dimmed:d}}}),[i,t,n,r]),a=i.edges;return _.jsx("div",{className:"GraphCanvas__styles.canvas flexGrow-x1iyjqo2 minWidth-xeuugli",children:_.jsxs(Gy,{nodes:s,edges:a,nodeTypes:Gb,onNodeClick:(c,l)=>o(l.id),fitView:!0,proOptions:{hideAttribution:!0},colorMode:"dark",children:[_.jsx(Qy,{}),_.jsx(iw,{showInteractive:!1})]})})}var te=bt;te(".width-x18qqrc1{width:248px}",4e3);te(".flexShrink-x2lah0s{flex-shrink:0}",3e3);te(".overflowY-x1odjw0f{overflow-y:auto}",4e3);te(".borderRightWidth-xs1s249{border-right-width:1px}",4e3);te(".borderRightStyle-x32b0ac{border-right-style:solid}",4e3);te(".borderRightColor-xw4wd4l{border-right-color:var(--border-xcu5if3)}",4e3);te(".paddingTop-x1y1aw1k{padding-top:8px}",4e3);te(".paddingBottom-xwib8y2{padding-bottom:8px}",4e3);te(".marginBottom-x1e56ztr{margin-bottom:8px}",4e3);te(".display-x78zum5{display:flex}",3e3);te(".alignItems-x6s0dn4{align-items:center}",3e3);te(".gap-x17d4w8g{gap:6px}",2e3);te(".paddingTop-x1yrsyyn{padding-top:6px}",4e3);te(".paddingBottom-x10b6aqq{padding-bottom:6px}",4e3);te(".paddingLeft-xnm25rq{padding-left:16px}",4e3);te(".paddingRight-xyfqnmn{padding-right:16px}",4e3);te(".fontSize-x1k6wstc{font-size:10px}",3e3);te(".textTransform-xtvhhri{text-transform:uppercase}",3e3);te(".letterSpacing-x9pfba7{letter-spacing:.08em}",3e3);te(".color-xn34zyf{color:var(--muted-x11rjawc)}",3e3);te(".width-x1xc55vz{width:8px}",4e3);te(".height-xdk7pt{height:8px}",4e3);te(".borderRadius-xur7f20{border-radius:8px}",2e3);te(".display-x1lliihq{display:block}",3e3);te(".width-xh8yej3{width:100%}",4e3);te(".textAlign-xdpxx8g{text-align:left}",3e3);te(".paddingLeft-xxpkpgd{padding-left:28px}",4e3);te(".fontSize-x4z9k3i{font-size:13px}",3e3);te(".cursor-x1ypdohk{cursor:pointer}",3e3);te(".borderWidth-xc342km{border-width:0}",2e3);te(".backgroundColor-xjbqb8w{background-color:transparent}",3e3);te(".backgroundColor-xyjeryo:hover{background-color:var(--panel-x71edem)}",3130);te(".color-x185ec43{color:var(--text-x1qdqye4)}",3e3);te(".backgroundColor-xa3hp3g{background-color:var(--panel-x71edem)}",3e3);te(".color-x1kop7vh{color:var(--accent-x1it9n6t)}",3e3);te(".fontWeight-x1s688f{font-weight:600}",3e3);const ha={item:{"Sidebar__styles.item":"Sidebar__styles.item",display:"display-x1lliihq",width:"width-xh8yej3",textAlign:"textAlign-xdpxx8g",paddingTop:"paddingTop-x1yrsyyn",paddingBottom:"paddingBottom-x10b6aqq",paddingLeft:"paddingLeft-xxpkpgd",paddingRight:"paddingRight-xyfqnmn",fontSize:"fontSize-x4z9k3i",cursor:"cursor-x1ypdohk",borderWidth:"borderWidth-xc342km",backgroundColor:"backgroundColor-xjbqb8w backgroundColor-xyjeryo",color:"color-x185ec43",$$css:!0},itemActive:{"Sidebar__styles.itemActive":"Sidebar__styles.itemActive",backgroundColor:"backgroundColor-xa3hp3g",color:"color-x1kop7vh",fontWeight:"fontWeight-x1s688f",$$css:!0}},Ub=["page","component","bff","api"];function Kb({registry:e,selectedId:t,onSelect:n}){return _.jsx("nav",{className:"Sidebar__styles.side width-x18qqrc1 flexShrink-x2lah0s overflowY-x1odjw0f borderRightWidth-xs1s249 borderRightStyle-x32b0ac borderRightColor-xw4wd4l paddingTop-x1y1aw1k paddingBottom-xwib8y2",children:Ub.map(r=>{const o=e.nodes.filter(i=>i.type===r);return o.length===0?null:_.jsxs("div",{className:"Sidebar__styles.group marginBottom-x1e56ztr",children:[_.jsxs("div",{className:"Sidebar__styles.groupLabel display-x78zum5 alignItems-x6s0dn4 gap-x17d4w8g paddingTop-x1yrsyyn paddingBottom-x10b6aqq paddingLeft-xnm25rq paddingRight-xyfqnmn fontSize-x1k6wstc textTransform-xtvhhri letterSpacing-x9pfba7 color-xn34zyf",children:[_.jsx("span",{className:"Sidebar__styles.dot width-x1xc55vz height-xdk7pt borderRadius-xur7f20",style:{backgroundColor:ya[r]}}),To[r]," · ",o.length]}),o.map(i=>_.jsx("button",{type:"button",onClick:()=>n(i.id),...Ho(ha.item,i.id===t&&ha.itemActive),children:i.title},i.id))]},r)})})}var ne=bt;ne(".display-x78zum5{display:flex}",3e3);ne(".alignItems-x6s0dn4{align-items:center}",3e3);ne(".gap-xou54vl{gap:16px}",2e3);ne(".paddingTop-x889kno{padding-top:10px}",4e3);ne(".paddingBottom-x1a8lsjc{padding-bottom:10px}",4e3);ne(".paddingLeft-x5tiur9{padding-left:20px}",4e3);ne(".paddingRight-x1s7jvk7{padding-right:20px}",4e3);ne(".borderBottomWidth-xso031l{border-bottom-width:1px}",4e3);ne(".borderBottomStyle-x1q0q8m5{border-bottom-style:solid}",4e3);ne(".borderBottomColor-x1y13xph{border-bottom-color:var(--border-xcu5if3)}",4e3);ne(".fontSize-x1j61zf2{font-size:16px}",3e3);ne(".fontWeight-x1xlr1w8{font-weight:700}",3e3);ne(".letterSpacing-x16q24ku{letter-spacing:.02em}",3e3);ne(".flexGrow-x1iyjqo2{flex-grow:1}",3e3);ne(".gap-x167g77z{gap:8px}",2e3);ne(".fontSize-x1j6dyjg{font-size:11px}",3e3);ne(".textTransform-xtvhhri{text-transform:uppercase}",3e3);ne(".letterSpacing-x1dgsrnt{letter-spacing:.06em}",3e3);ne(".color-xn34zyf{color:var(--muted-x11rjawc)}",3e3);ne(".borderWidth-xmkeg23{border-width:1px}",2e3);ne(".borderStyle-x1y0btm7{border-style:solid}",2e3);ne(".borderColor-x1ugr8pw{border-color:var(--border-xcu5if3)}",2e3);ne(".borderRadius-x1kogg8i{border-radius:6px}",2e3);ne(".overflow-xb3r6kr{overflow:hidden}",2e3);ne(".paddingTop-x1iorvi4{padding-top:4px}",4e3);ne(".paddingBottom-xjkvuk6{padding-bottom:4px}",4e3);ne(".paddingLeft-x1lqa7cf{padding-left:10px}",4e3);ne(".paddingRight-xcicffo{padding-right:10px}",4e3);ne(".fontSize-xfifm61{font-size:12px}",3e3);ne(".cursor-x1ypdohk{cursor:pointer}",3e3);ne(".borderWidth-xc342km{border-width:0}",2e3);ne(".backgroundColor-xjbqb8w{background-color:transparent}",3e3);ne(".backgroundColor-xg1eswc:hover{background-color:var(--border-xcu5if3)}",3130);ne(".color-x185ec43{color:var(--text-x1qdqye4)}",3e3);ne(".backgroundColor-xuoenkq{background-color:var(--accent-x1it9n6t)}",3e3);ne(".color-xuele95{color:#0e0f13}",3e3);const ga={segBtn:{"Toolbar__styles.segBtn":"Toolbar__styles.segBtn",paddingTop:"paddingTop-x1iorvi4",paddingBottom:"paddingBottom-xjkvuk6",paddingLeft:"paddingLeft-x1lqa7cf",paddingRight:"paddingRight-xcicffo",fontSize:"fontSize-xfifm61",cursor:"cursor-x1ypdohk",borderWidth:"borderWidth-xc342km",backgroundColor:"backgroundColor-xjbqb8w backgroundColor-xg1eswc",color:"color-x185ec43",$$css:!0},segActive:{"Toolbar__styles.segActive":"Toolbar__styles.segActive",backgroundColor:"backgroundColor-xuoenkq",color:"color-xuele95",$$css:!0}};function pa({options:e,value:t,onChange:n}){return _.jsx("div",{className:"Toolbar__styles.seg display-x78zum5 borderWidth-xmkeg23 borderStyle-x1y0btm7 borderColor-x1ugr8pw borderRadius-x1kogg8i overflow-xb3r6kr",children:e.map(([r,o])=>_.jsx("button",{type:"button",onClick:()=>n(r),...Ho(ga.segBtn,r===t&&ga.segActive),children:o},r))})}const Zb=[["all","All"],["page","Page"],["component","Component"],["bff","BFF"],["api","API"]],Qb=[["all","All"],["business","Business"],["tech","Tech"]];function Jb({layer:e,audience:t,onLayer:n,onAudience:r}){return _.jsxs("div",{className:"Toolbar__styles.bar display-x78zum5 alignItems-x6s0dn4 gap-xou54vl paddingTop-x889kno paddingBottom-x1a8lsjc paddingLeft-x5tiur9 paddingRight-x1s7jvk7 borderBottomWidth-xso031l borderBottomStyle-x1q0q8m5 borderBottomColor-x1y13xph",children:[_.jsx("span",{className:"Toolbar__styles.brand fontSize-x1j61zf2 fontWeight-x1xlr1w8 letterSpacing-x16q24ku",children:"Karta"}),_.jsxs("div",{className:"Toolbar__styles.group display-x78zum5 alignItems-x6s0dn4 gap-x167g77z",children:[_.jsx("span",{className:"Toolbar__styles.label fontSize-x1j6dyjg textTransform-xtvhhri letterSpacing-x1dgsrnt color-xn34zyf",children:"Layer"}),_.jsx(pa,{options:Zb,value:e,onChange:n})]}),_.jsxs("div",{className:"Toolbar__styles.group display-x78zum5 alignItems-x6s0dn4 gap-x167g77z",children:[_.jsx("span",{className:"Toolbar__styles.label fontSize-x1j6dyjg textTransform-xtvhhri letterSpacing-x1dgsrnt color-xn34zyf",children:"Audience"}),_.jsx(pa,{options:Qb,value:t,onChange:r})]}),_.jsx("span",{className:"Toolbar__styles.spacer flexGrow-x1iyjqo2"}),gd().map(([o,i])=>_.jsx(i,{},o))]})}var re=bt;re(".display-x78zum5{display:flex}",3e3);re(".flexDirection-xdt5ytf{flex-direction:column}",3e3);re(".height-x1dr59a3{height:100vh}",4e3);re(".flexGrow-x1iyjqo2{flex-grow:1}",3e3);re(".minHeight-x2lwn1j{min-height:0}",4e3);re(".width-x1m258z3{width:320px}",4e3);re(".flexShrink-x2lah0s{flex-shrink:0}",3e3);re(".borderLeftWidth-xe0pwq{border-left-width:1px}",4e3);re(".borderLeftStyle-x19ypqd9{border-left-style:solid}",4e3);re(".borderLeftColor-x1d6edkd{border-left-color:var(--border-xcu5if3)}",4e3);re(".fontSize-x1k6wstc{font-size:10px}",3e3);re(".textTransform-xtvhhri{text-transform:uppercase}",3e3);re(".letterSpacing-x9pfba7{letter-spacing:.08em}",3e3);re(".color-xn34zyf{color:var(--muted-x11rjawc)}",3e3);re(".paddingTop-x889kno{padding-top:10px}",4e3);re(".paddingBottom-x10b6aqq{padding-bottom:6px}",4e3);re(".paddingLeft-xnm25rq{padding-left:16px}",4e3);re(".paddingRight-xyfqnmn{padding-right:16px}",4e3);re(".borderBottomWidth-xso031l{border-bottom-width:1px}",4e3);re(".borderBottomStyle-x1q0q8m5{border-bottom-style:solid}",4e3);re(".borderBottomColor-x1y13xph{border-bottom-color:var(--border-xcu5if3)}",4e3);re(".width-xh8yej3{width:100%}",4e3);re(".borderWidth-xc342km{border-width:0}",2e3);re(".margin-x1bpp3o7{margin:auto}",1e3);re(".textAlign-x2b8uid{text-align:center}",3e3);re(".fontSize-x4z9k3i{font-size:13px}",3e3);re(".paddingTop-x1y1aw1k{padding-top:8px}",4e3);re(".paddingBottom-xwib8y2{padding-bottom:8px}",4e3);re(".paddingLeft-x5tiur9{padding-left:20px}",4e3);re(".paddingRight-x1s7jvk7{padding-right:20px}",4e3);re(".backgroundColor-x2669nx{background-color:rgba(248,81,73,.12)}",3e3);re(".borderBottomColor-xht1zl4{border-bottom-color:#f85149}",4e3);re(".color-x1hk7q1c{color:#ff9d96}",3e3);re(".fontSize-xfifm61{font-size:12px}",3e3);re(".fontFamily-xtd1war{font-family:var(--fontMono-x3fiz1h)}",3e3);re(".whiteSpace-x126k92a{white-space:pre-wrap}",3e3);function e_(){const e=Oo({from:"/"}),t=Fo({from:"/"}),{registry:n,isLoading:r,error:o}=Ao(),i=L.useRef(null),[s,a]=L.useState(null);L.useEffect(()=>pd(a),[]);const c=L.useCallback(m=>t({search:p=>({...p,node:m})}),[t]),l=L.useCallback(m=>t({search:p=>({...p,layer:m==="all"?void 0:m})}),[t]),d=L.useCallback(m=>t({search:p=>({...p,audience:m==="all"?void 0:m})}),[t]),u=e.layer??"all",f=e.audience??"all";L.useEffect(()=>md(yd,()=>{var m;return((m=i.current)==null?void 0:m.contentWindow)??null},window.location.origin),[]),L.useEffect(()=>{Pn("node:select",{id:e.node??null})},[e.node]),L.useEffect(()=>{n&&Pn("registry:loaded",{version:n.version,node_count:n.nodes.length,edge_count:n.edges.length})},[n]),L.useEffect(()=>wa("node:navigate",m=>c(m.id)),[c]);const h=()=>{Pn("node:select",{id:e.node??null}),n&&Pn("registry:loaded",{version:n.version,node_count:n.nodes.length,edge_count:n.edges.length})};let g;return r?g=_.jsx("p",{className:"GraphView__styles.center margin-x1bpp3o7 textAlign-x2b8uid fontSize-x4z9k3i color-xn34zyf",children:"Loading registry…"}):o?g=_.jsx("p",{className:"GraphView__styles.center margin-x1bpp3o7 textAlign-x2b8uid fontSize-x4z9k3i color-xn34zyf",children:"Failed to load registry.json"}):!n||n.nodes.length===0?g=_.jsx("p",{className:"GraphView__styles.center margin-x1bpp3o7 textAlign-x2b8uid fontSize-x4z9k3i color-xn34zyf",children:"Registry is empty."}):g=_.jsxs(_.Fragment,{children:[_.jsx(Kb,{registry:n,selectedId:e.node,onSelect:c}),_.jsx(Xb,{registry:n,selectedId:e.node,layer:u,audience:f,onSelect:c})]}),_.jsxs("div",{className:"GraphView__styles.view display-x78zum5 flexDirection-xdt5ytf height-x1dr59a3",children:[_.jsx(Jb,{layer:u,audience:f,onLayer:l,onAudience:d}),s&&_.jsxs("div",{role:"alert",className:"GraphView__styles.banner flexShrink-x2lah0s paddingTop-x1y1aw1k paddingBottom-xwib8y2 paddingLeft-x5tiur9 paddingRight-x1s7jvk7 backgroundColor-x2669nx borderBottomWidth-xso031l borderBottomStyle-x1q0q8m5 borderBottomColor-xht1zl4 color-x1hk7q1c fontSize-xfifm61 fontFamily-xtd1war whiteSpace-x126k92a",children:["crawl failed — showing last good graph:",`
|
|
24
|
+
`,s]}),_.jsxs("div",{className:"GraphView__styles.body display-x78zum5 flexGrow-x1iyjqo2 minHeight-x2lwn1j",children:[g,_.jsxs("aside",{className:"GraphView__styles.aside width-x1m258z3 flexShrink-x2lah0s display-x78zum5 flexDirection-xdt5ytf borderLeftWidth-xe0pwq borderLeftStyle-x19ypqd9 borderLeftColor-x1d6edkd",children:[_.jsxs("div",{className:"GraphView__styles.panels flexShrink-x2lah0s borderBottomWidth-xso031l borderBottomStyle-x1q0q8m5 borderBottomColor-x1y13xph",children:[_.jsx("div",{className:"GraphView__styles.paneLabel fontSize-x1k6wstc textTransform-xtvhhri letterSpacing-x9pfba7 color-xn34zyf paddingTop-x889kno paddingBottom-x10b6aqq paddingLeft-xnm25rq paddingRight-xyfqnmn borderBottomWidth-xso031l borderBottomStyle-x1q0q8m5 borderBottomColor-x1y13xph",children:"Details"}),xd().map(([m,p])=>_.jsx(p,{},m))]}),_.jsxs("div",{className:"GraphView__styles.previewWrap flexGrow-x1iyjqo2 display-x78zum5 flexDirection-xdt5ytf minHeight-x2lwn1j",children:[_.jsx("div",{className:"GraphView__styles.paneLabel fontSize-x1k6wstc textTransform-xtvhhri letterSpacing-x9pfba7 color-xn34zyf paddingTop-x889kno paddingBottom-x10b6aqq paddingLeft-xnm25rq paddingRight-xyfqnmn borderBottomWidth-xso031l borderBottomStyle-x1q0q8m5 borderBottomColor-x1y13xph",children:"Preview"}),_.jsx("iframe",{ref:i,title:"preview",src:"/preview.html",onLoad:h,sandbox:"allow-scripts allow-same-origin",className:"GraphView__styles.iframe flexGrow-x1iyjqo2 width-xh8yej3 borderWidth-xc342km"})]})]})]})]})}var Tr=bt;Tr(".minHeight-xg6iff7{min-height:100vh}",4e3);Tr(".backgroundColor-x1sv03ar{background-color:var(--bg-xl7qi7f)}",3e3);Tr(".color-x185ec43{color:var(--text-x1qdqye4)}",3e3);Tr(".fontFamily-x1880mbn{font-family:var(--fontSans-x1k96p3b)}",3e3);function t_(){return _.jsx("div",{className:"router__styles.frame minHeight-xg6iff7 backgroundColor-x1sv03ar color-x185ec43 fontFamily-x1880mbn",children:_.jsx(Xa,{})})}const n_=["page","component","bff","api"],r_=["business","tech"],ma=(e,t)=>typeof t=="string"&&e.includes(t),Fn=e=>typeof e=="string"&&e.length>0?e:void 0,iu=rh({component:t_}),o_=th({getParentRoute:()=>iu,path:"/",component:e_,validateSearch:e=>({node:Fn(e.node),focus:Fn(e.focus),env:Fn(e.env),layer:ma(n_,e.layer)?e.layer:void 0,audience:ma(r_,e.audience)?e.audience:void 0,panel:Fn(e.panel)})}),i_=iu.addChildren([o_]),s_=gh({routeTree:i_});var Ce=bt;Ce(".fontSize-x4z9k3i{font-size:13px}",3e3);Ce(".color-xn34zyf{color:var(--muted-x11rjawc)}",3e3);Ce(".padding-x1tamke2{padding:16px}",1e3);Ce(".display-x78zum5{display:flex}",3e3);Ce(".flexDirection-xdt5ytf{flex-direction:column}",3e3);Ce(".gap-x883omv{gap:10px}",2e3);Ce(".gap-x195vfkc{gap:2px}",2e3);Ce(".fontSize-x1k6wstc{font-size:10px}",3e3);Ce(".textTransform-xtvhhri{text-transform:uppercase}",3e3);Ce(".letterSpacing-x9pfba7{letter-spacing:.08em}",3e3);Ce(".fontFamily-xtd1war{font-family:var(--fontMono-x3fiz1h)}",3e3);Ce(".wordBreak-x1yn0g08{word-break:break-all}",3e3);function it({k:e,v:t}){return _.jsxs("div",{className:"detail-panel__styles.row display-x78zum5 flexDirection-xdt5ytf gap-x195vfkc",children:[_.jsx("span",{className:"detail-panel__styles.key fontSize-x1k6wstc textTransform-xtvhhri letterSpacing-x9pfba7 color-xn34zyf",children:e}),_.jsx("span",{className:"detail-panel__styles.val fontSize-x4z9k3i fontFamily-xtd1war wordBreak-x1yn0g08",children:t})]})}function a_(){const{registry:e}=Ao(),[t,n]=L.useState(null);L.useEffect(()=>wa("node:select",o=>n(o.id)),[]);const r=e==null?void 0:e.nodes.find(o=>o.id===t);return r?_.jsxs("div",{className:"detail-panel__styles.list display-x78zum5 flexDirection-xdt5ytf gap-x883omv padding-x1tamke2",children:[_.jsx(it,{k:"id",v:r.id}),_.jsx(it,{k:"type",v:To[r.type]}),_.jsx(it,{k:"status",v:r.status}),_.jsx(it,{k:"library",v:r.library}),r.owner&&_.jsx(it,{k:"owner",v:r.owner}),r.audience&&r.audience.length>0&&_.jsx(it,{k:"audience",v:r.audience.join(", ")}),_.jsx(it,{k:"source",v:r.source_path})]}):_.jsx("p",{className:"detail-panel__styles.empty fontSize-x4z9k3i color-xn34zyf padding-x1tamke2",children:"Select a node to inspect its properties."})}wd("detail",a_);var hi=bt;hi(".fontSize-xfifm61{font-size:12px}",3e3);hi(".color-xn34zyf{color:var(--muted-x11rjawc)}",3e3);hi(".fontFamily-xtd1war{font-family:var(--fontMono-x3fiz1h)}",3e3);function c_(){const{registry:e}=Ao();return e?_.jsxs("span",{className:"stats-toolbar__styles.badge fontSize-xfifm61 color-xn34zyf fontFamily-xtd1war",children:[e.nodes.length," nodes · ",e.edges.length," edges"]}):null}vd("stats",c_);const su=new bd;_d(su);const au=document.getElementById("root");if(!au)throw new Error("#root not found");Sd.createRoot(au).render(_.jsx(L.StrictMode,{children:_.jsx(Ed,{client:su,children:_.jsx(xh,{router:s_})})}));
|