expxagents 0.17.7 → 0.17.8

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreeBackground-ClAX-GgS.js","assets/three-BZk_I9Ly.js","assets/browserAll-BJZ9_U0C.js","assets/webworkerAll-BOQTv0Mj.js","assets/WebGPURenderer-BduUOOQw.js","assets/BufferResource-_oSMBdZq.js","assets/RenderTargetSystem-C3ZGnr3V.js","assets/WebGLRenderer-6sYsFs6Z.js","assets/CanvasRenderer-D81h5zgP.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreeBackground-Br_6kh54.js","assets/three-BZk_I9Ly.js","assets/browserAll-DtAMswxw.js","assets/webworkerAll-B4oBLw25.js","assets/WebGPURenderer-CKo3lcKT.js","assets/BufferResource--9qB8zOA.js","assets/RenderTargetSystem-BTChQNhb.js","assets/WebGLRenderer-DNCdu3jO.js","assets/CanvasRenderer-BZ7OTSuR.js"])))=>i.map(i=>d[i]);
2
2
  (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();const PO="modulepreload",FO=function(e){return"/"+e},VS={},ou=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let l=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));r=l(n.map(p=>{if(p=FO(p),p in VS)return;VS[p]=!0;const m=p.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const x=document.createElement("link");if(x.rel=m?"stylesheet":PO,m||(x.as="script"),x.crossOrigin="",x.href=p,f&&x.setAttribute("nonce",f),document.head.appendChild(x),m)return new Promise((v,S)=>{x.addEventListener("load",v),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return r.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};function du(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sb={exports:{}},Xp={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -58,7 +58,7 @@ Error generating stack: `+y.message+`
58
58
  * @license MIT
59
59
  */var iE="popstate";function rE(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ZO(e={}){function t(i,r){var p;let s=(p=r.state)==null?void 0:p.masked,{pathname:l,search:c,hash:f}=s||i.location;return Uv("",{pathname:l,search:c,hash:f},r.state&&r.state.usr||null,r.state&&r.state.key||"default",s?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:km(r)}return e3(t,n,null,e)}function Wn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _l(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function JO(){return Math.random().toString(36).substring(2,10)}function aE(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Uv(e,t,n=null,i,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?_h(t):t,state:n,key:t&&t.key||i||JO(),unstable_mask:r}}function km({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function _h(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function e3(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:s=!1}=i,l=r.history,c="POP",f=null,p=m();p==null&&(p=0,l.replaceState({...l.state,idx:p},""));function m(){return(l.state||{idx:null}).idx}function g(){c="POP";let T=m(),C=T==null?null:T-p;p=T,f&&f({action:c,location:A.location,delta:C})}function x(T,C){c="PUSH";let N=rE(T)?T:Uv(A.location,T,C);p=m()+1;let R=aE(N,p),D=A.createHref(N.unstable_mask||N);try{l.pushState(R,"",D)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;r.location.assign(D)}s&&f&&f({action:c,location:A.location,delta:1})}function v(T,C){c="REPLACE";let N=rE(T)?T:Uv(A.location,T,C);p=m();let R=aE(N,p),D=A.createHref(N.unstable_mask||N);l.replaceState(R,"",D),s&&f&&f({action:c,location:A.location,delta:0})}function S(T){return t3(T)}let A={get action(){return c},get location(){return e(r,l)},listen(T){if(f)throw new Error("A history only accepts one active listener");return r.addEventListener(iE,g),f=T,()=>{r.removeEventListener(iE,g),f=null}},createHref(T){return t(r,T)},createURL:S,encodeLocation(T){let C=S(T);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:v,go(T){return l.go(T)}};return A}function t3(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Wn(n,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:km(e);return i=i.replace(/ $/,"%20"),!t&&i.startsWith("//")&&(i=n+i),new URL(i,n)}function AC(e,t,n="/"){return n3(e,t,n,!1)}function n3(e,t,n,i){let r=typeof t=="string"?_h(t):t,s=sc(r.pathname||"/",n);if(s==null)return null;let l=MC(e);i3(l);let c=null;for(let f=0;c==null&&f<l.length;++f){let p=p3(s);c=f3(l[f],p,i)}return c}function MC(e,t=[],n=[],i="",r=!1){let s=(l,c,f=r,p)=>{let m={relativePath:p===void 0?l.path||"":p,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(i)&&f)return;Wn(m.relativePath.startsWith(i),`Absolute route path "${m.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(i.length)}let g=po([i,m.relativePath]),x=n.concat(m);l.children&&l.children.length>0&&(Wn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),MC(l.children,t,x,g,f)),!(l.path==null&&!l.index)&&t.push({path:g,score:u3(g,l.index),routesMeta:x})};return e.forEach((l,c)=>{var f;if(l.path===""||!((f=l.path)!=null&&f.includes("?")))s(l,c);else for(let p of RC(l.path))s(l,c,!0,p)}),t}function RC(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,r=n.endsWith("?"),s=n.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let l=RC(i.join("/")),c=[];return c.push(...l.map(f=>f===""?s:[s,f].join("/"))),r&&c.push(...l),c.map(f=>e.startsWith("/")&&f===""?"/":f)}function i3(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:d3(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var r3=/^:[\w-]+$/,a3=3,s3=2,l3=1,o3=10,c3=-2,sE=e=>e==="*";function u3(e,t){let n=e.split("/"),i=n.length;return n.some(sE)&&(i+=c3),t&&(i+=s3),n.filter(r=>!sE(r)).reduce((r,s)=>r+(r3.test(s)?a3:s===""?l3:o3),i)}function d3(e,t){return e.length===t.length&&e.slice(0,-1).every((i,r)=>i===t[r])?e[e.length-1]-t[t.length-1]:0}function f3(e,t,n=!1){let{routesMeta:i}=e,r={},s="/",l=[];for(let c=0;c<i.length;++c){let f=i[c],p=c===i.length-1,m=s==="/"?t:t.slice(s.length)||"/",g=w0({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},m),x=f.route;if(!g&&p&&n&&!i[i.length-1].route.index&&(g=w0({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},m)),!g)return null;Object.assign(r,g.params),l.push({params:r,pathname:po([s,g.pathname]),pathnameBase:x3(po([s,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(s=po([s,g.pathnameBase]))}return l}function w0(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=h3(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let s=r[0],l=s.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:i.reduce((p,{paramName:m,isOptional:g},x)=>{if(m==="*"){let S=c[x]||"";l=s.slice(0,s.length-S.length).replace(/(.)\/+$/,"$1")}const v=c[x];return g&&!v?p[m]=void 0:p[m]=(v||"").replace(/%2F/g,"/"),p},{}),pathname:s,pathnameBase:l,pattern:e}}function h3(e,t=!1,n=!0){_l(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,c,f,p,m)=>{if(i.push({paramName:c,isOptional:f!=null}),f){let g=m.charAt(p+l.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),i]}function p3(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return _l(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function sc(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}var m3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function g3(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?_h(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=lE(n.substring(1),"/"):s=lE(n,t)):s=t,{pathname:s,search:b3(i),hash:v3(r)}}function lE(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function fb(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function y3(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Y1(e){let t=y3(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function W0(e,t,n,i=!1){let r;typeof e=="string"?r=_h(e):(r={...e},Wn(!r.pathname||!r.pathname.includes("?"),fb("?","pathname","search",r)),Wn(!r.pathname||!r.pathname.includes("#"),fb("#","pathname","hash",r)),Wn(!r.search||!r.search.includes("#"),fb("#","search","hash",r)));let s=e===""||r.pathname==="",l=s?"/":r.pathname,c;if(l==null)c=n;else{let g=t.length-1;if(!i&&l.startsWith("..")){let x=l.split("/");for(;x[0]==="..";)x.shift(),g-=1;r.pathname=x.join("/")}c=g>=0?t[g]:"/"}let f=g3(r,c),p=l&&l!=="/"&&l.endsWith("/"),m=(s||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||m)&&(f.pathname+="/"),f}var po=e=>e.join("/").replace(/\/\/+/g,"/"),x3=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),b3=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,v3=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,_3=class{constructor(e,t,n,i=!1){this.status=e,this.statusText=t||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function S3(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function E3(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var kC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function NC(e,t){let n=e;if(typeof n!="string"||!m3.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(kC)try{let s=new URL(window.location.href),l=n.startsWith("//")?new URL(s.protocol+n):new URL(n),c=sc(l.pathname,t);l.origin===s.origin&&c!=null?n=c+l.search+l.hash:r=!0}catch{_l(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var OC=["POST","PUT","PATCH","DELETE"];new Set(OC);var w3=["GET",...OC];new Set(w3);var Sh=j.createContext(null);Sh.displayName="DataRouter";var Q0=j.createContext(null);Q0.displayName="DataRouterState";var T3=j.createContext(!1),DC=j.createContext({isTransitioning:!1});DC.displayName="ViewTransition";var C3=j.createContext(new Map);C3.displayName="Fetchers";var A3=j.createContext(null);A3.displayName="Await";var ss=j.createContext(null);ss.displayName="Navigation";var $m=j.createContext(null);$m.displayName="Location";var El=j.createContext({outlet:null,matches:[],isDataRoute:!1});El.displayName="Route";var V1=j.createContext(null);V1.displayName="RouteError";var zC="REACT_ROUTER_ERROR",M3="REDIRECT",R3="ROUTE_ERROR_RESPONSE";function k3(e){if(e.startsWith(`${zC}:${M3}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function N3(e){if(e.startsWith(`${zC}:${R3}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new _3(t.status,t.statusText,t.data)}catch{}}function O3(e,{relative:t}={}){Wn(Eh(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=j.useContext(ss),{hash:r,pathname:s,search:l}=Wm(e,{relative:t}),c=s;return n!=="/"&&(c=s==="/"?n:po([n,s])),i.createHref({pathname:c,search:l,hash:r})}function Eh(){return j.useContext($m)!=null}function wl(){return Wn(Eh(),"useLocation() may be used only in the context of a <Router> component."),j.useContext($m).location}var BC="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function LC(e){j.useContext(ss).static||j.useLayoutEffect(e)}function Z0(){let{isDataRoute:e}=j.useContext(El);return e?X3():D3()}function D3(){Wn(Eh(),"useNavigate() may be used only in the context of a <Router> component.");let e=j.useContext(Sh),{basename:t,navigator:n}=j.useContext(ss),{matches:i}=j.useContext(El),{pathname:r}=wl(),s=JSON.stringify(Y1(i)),l=j.useRef(!1);return LC(()=>{l.current=!0}),j.useCallback((f,p={})=>{if(_l(l.current,BC),!l.current)return;if(typeof f=="number"){n.go(f);return}let m=W0(f,JSON.parse(s),r,p.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:po([t,m.pathname])),(p.replace?n.replace:n.push)(m,p.state,p)},[t,n,s,r,e])}var z3=j.createContext(null);function B3(e){let t=j.useContext(El).outlet;return j.useMemo(()=>t&&j.createElement(z3.Provider,{value:e},t),[t,e])}function Wm(e,{relative:t}={}){let{matches:n}=j.useContext(El),{pathname:i}=wl(),r=JSON.stringify(Y1(n));return j.useMemo(()=>W0(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function L3(e,t){return jC(e,t)}function jC(e,t,n){var T;Wn(Eh(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=j.useContext(ss),{matches:r}=j.useContext(El),s=r[r.length-1],l=s?s.params:{},c=s?s.pathname:"/",f=s?s.pathnameBase:"/",p=s&&s.route;{let C=p&&p.path||"";UC(c,!p||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
60
 
61
- Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let m=wl(),g;if(t){let C=typeof t=="string"?_h(t):t;Wn(f==="/"||((T=C.pathname)==null?void 0:T.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=m;let x=g.pathname||"/",v=x;if(f!=="/"){let C=f.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=AC(e,{pathname:v});_l(p||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),_l(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=P3(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:po([f,i.encodeLocation?i.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:po([f,i.encodeLocation?i.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),r,n);return t&&A?j.createElement($m.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},A):A}function j3(){let e=V3(),t=S3(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=j.createElement(j.Fragment,null,j.createElement("p",null,"💿 Hey developer 👋"),j.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",j.createElement("code",{style:s},"ErrorBoundary")," or"," ",j.createElement("code",{style:s},"errorElement")," prop on your route.")),j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:r},n):null,l)}var I3=j.createElement(j3,null),IC=class extends j.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=N3(e.digest);n&&(e=n)}let t=e!==void 0?j.createElement(El.Provider,{value:this.props.routeContext},j.createElement(V1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?j.createElement(U3,{error:e},t):t}};IC.contextType=T3;var hb=new WeakMap;function U3({children:e,error:t}){let{basename:n}=j.useContext(ss);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=k3(t.digest);if(i){let r=hb.get(t);if(r)throw r;let s=NC(i.location,n);if(kC&&!hb.get(t))if(s.isExternal||i.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:i.replace}));throw hb.set(t,l),l}return j.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function H3({routeContext:e,match:t,children:n}){let i=j.useContext(Sh);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),j.createElement(El.Provider,{value:e},n)}function P3(e,t=[],n){let i=n==null?void 0:n.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let r=e,s=i==null?void 0:i.errors;if(s!=null){let m=r.findIndex(g=>g.route.id&&(s==null?void 0:s[g.route.id])!==void 0);Wn(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),r=r.slice(0,Math.min(r.length,m+1))}let l=!1,c=-1;if(n&&i){l=i.renderFallback;for(let m=0;m<r.length;m++){let g=r[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=m),g.route.id){let{loaderData:x,errors:v}=i,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||S){n.isStatic&&(l=!0),c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}}let f=n==null?void 0:n.onError,p=i&&f?(m,g)=>{var x,v;f(m,{location:i.location,params:((v=(x=i.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:E3(i.matches),errorInfo:g})}:void 0;return r.reduceRight((m,g,x)=>{let v,S=!1,A=null,T=null;i&&(v=s&&g.route.id?s[g.route.id]:void 0,A=g.route.errorElement||I3,l&&(c<0&&x===0?(UC("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,T=null):c===x&&(S=!0,T=g.route.hydrateFallbackElement||null)));let C=t.concat(r.slice(0,x+1)),N=()=>{let R;return v?R=A:S?R=T:g.route.Component?R=j.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=m,j.createElement(H3,{match:g,routeContext:{outlet:m,matches:C,isDataRoute:i!=null},children:R})};return i&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?j.createElement(IC,{location:i.location,revalidation:i.revalidation,component:A,error:v,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:p}):N()},null)}function X1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function F3(e){let t=j.useContext(Sh);return Wn(t,X1(e)),t}function G3(e){let t=j.useContext(Q0);return Wn(t,X1(e)),t}function q3(e){let t=j.useContext(El);return Wn(t,X1(e)),t}function K1(e){let t=q3(e),n=t.matches[t.matches.length-1];return Wn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Y3(){return K1("useRouteId")}function V3(){var i;let e=j.useContext(V1),t=G3("useRouteError"),n=K1("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[n]}function X3(){let{router:e}=F3("useNavigate"),t=K1("useNavigate"),n=j.useRef(!1);return LC(()=>{n.current=!0}),j.useCallback(async(r,s={})=>{_l(n.current,BC),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...s}))},[e,t])}var oE={};function UC(e,t,n){!t&&!oE[e]&&(oE[e]=!0,_l(!1,n))}j.memo(K3);function K3({routes:e,future:t,state:n,isStatic:i,onError:r}){return jC(e,void 0,{state:n,isStatic:i,onError:r})}function $3({to:e,replace:t,state:n,relative:i}){Wn(Eh(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=j.useContext(ss);_l(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=j.useContext(El),{pathname:l}=wl(),c=Z0(),f=W0(e,Y1(s),l,i==="path"),p=JSON.stringify(f);return j.useEffect(()=>{c(JSON.parse(p),{replace:t,state:n,relative:i})},[c,p,i,t,n]),null}function cE(e){return B3(e.context)}function ca(e){Wn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function W3({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:s=!1,unstable_useTransitions:l}){Wn(!Eh(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),f=j.useMemo(()=>({basename:c,navigator:r,static:s,unstable_useTransitions:l,future:{}}),[c,r,s,l]);typeof n=="string"&&(n=_h(n));let{pathname:p="/",search:m="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=n,A=j.useMemo(()=>{let T=sc(p,c);return T==null?null:{location:{pathname:T,search:m,hash:g,state:x,key:v,unstable_mask:S},navigationType:i}},[c,p,m,g,x,v,i,S]);return _l(A!=null,`<Router basename="${c}"> is not able to match the URL "${p}${m}${g}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:j.createElement(ss.Provider,{value:f},j.createElement($m.Provider,{children:t,value:A}))}function Q3({children:e,location:t}){return L3(Hv(e),t)}function Hv(e,t=[]){let n=[];return j.Children.forEach(e,(i,r)=>{if(!j.isValidElement(i))return;let s=[...t,r];if(i.type===j.Fragment){n.push.apply(n,Hv(i.props.children,s));return}Wn(i.type===ca,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Wn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let l={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(l.children=Hv(i.props.children,s)),n.push(l)}),n}var h0="get",p0="application/x-www-form-urlencoded";function J0(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Z3(e){return J0(e)&&e.tagName.toLowerCase()==="button"}function J3(e){return J0(e)&&e.tagName.toLowerCase()==="form"}function eD(e){return J0(e)&&e.tagName.toLowerCase()==="input"}function tD(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function nD(e,t){return e.button===0&&(!t||t==="_self")&&!tD(e)}var Ay=null;function iD(){if(Ay===null)try{new FormData(document.createElement("form"),0),Ay=!1}catch{Ay=!0}return Ay}var rD=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pb(e){return e!=null&&!rD.has(e)?(_l(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${p0}"`),null):e}function aD(e,t){let n,i,r,s,l;if(J3(e)){let c=e.getAttribute("action");i=c?sc(c,t):null,n=e.getAttribute("method")||h0,r=pb(e.getAttribute("enctype"))||p0,s=new FormData(e)}else if(Z3(e)||eD(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(i=f?sc(f,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||h0,r=pb(e.getAttribute("formenctype"))||pb(c.getAttribute("enctype"))||p0,s=new FormData(c,e),!iD()){let{name:p,type:m,value:g}=e;if(m==="image"){let x=p?`${p}.`:"";s.append(`${x}x`,"0"),s.append(`${x}y`,"0")}else p&&s.append(p,g)}}else{if(J0(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=h0,i=null,r=p0,l=e}return s&&r==="text/plain"&&(l=s,s=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:s,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function $1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sD(e,t,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:t&&sc(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function lD(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function oD(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function cD(e,t,n){let i=await Promise.all(e.map(async r=>{let s=t.routes[r.route.id];if(s){let l=await lD(s,n);return l.links?l.links():[]}return[]}));return hD(i.flat(1).filter(oD).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function uE(e,t,n,i,r,s){let l=(f,p)=>n[p]?f.route.id!==n[p].route.id:!0,c=(f,p)=>{var m;return n[p].pathname!==f.pathname||((m=n[p].route.path)==null?void 0:m.endsWith("*"))&&n[p].params["*"]!==f.params["*"]};return s==="assets"?t.filter((f,p)=>l(f,p)||c(f,p)):s==="data"?t.filter((f,p)=>{var g;let m=i.routes[f.route.id];if(!m||!m.hasLoader)return!1;if(l(f,p)||c(f,p))return!0;if(f.route.shouldRevalidate){let x=f.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function uD(e,t,{includeHydrateFallback:n}={}){return dD(e.map(i=>{let r=t.routes[i.route.id];if(!r)return[];let s=[r.module];return r.clientActionModule&&(s=s.concat(r.clientActionModule)),r.clientLoaderModule&&(s=s.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(s=s.concat(r.hydrateFallbackModule)),r.imports&&(s=s.concat(r.imports)),s}).flat(1))}function dD(e){return[...new Set(e)]}function fD(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function hD(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let s=JSON.stringify(fD(r));return n.has(s)||(n.add(s),i.push({key:s,link:r})),i},[])}function HC(){let e=j.useContext(Sh);return $1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function pD(){let e=j.useContext(Q0);return $1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var W1=j.createContext(void 0);W1.displayName="FrameworkContext";function PC(){let e=j.useContext(W1);return $1(e,"You must render this element inside a <HydratedRouter> element"),e}function mD(e,t){let n=j.useContext(W1),[i,r]=j.useState(!1),[s,l]=j.useState(!1),{onFocus:c,onBlur:f,onMouseEnter:p,onMouseLeave:m,onTouchStart:g}=t,x=j.useRef(null);j.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let A=C=>{C.forEach(N=>{l(N.isIntersecting)})},T=new IntersectionObserver(A,{threshold:.5});return x.current&&T.observe(x.current),()=>{T.disconnect()}}},[e]),j.useEffect(()=>{if(i){let A=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(A)}}},[i]);let v=()=>{r(!0)},S=()=>{r(!1),l(!1)};return n?e!=="intent"?[s,x,{}]:[s,x,{onFocus:$p(c,v),onBlur:$p(f,S),onMouseEnter:$p(p,v),onMouseLeave:$p(m,S),onTouchStart:$p(g,v)}]:[!1,x,{}]}function $p(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function gD({page:e,...t}){let{router:n}=HC(),i=j.useMemo(()=>AC(n.routes,e,n.basename),[n.routes,e,n.basename]);return i?j.createElement(xD,{page:e,matches:i,...t}):null}function yD(e){let{manifest:t,routeModules:n}=PC(),[i,r]=j.useState([]);return j.useEffect(()=>{let s=!1;return cD(e,t,n).then(l=>{s||r(l)}),()=>{s=!0}},[e,t,n]),i}function xD({page:e,matches:t,...n}){let i=wl(),{future:r,manifest:s,routeModules:l}=PC(),{basename:c}=HC(),{loaderData:f,matches:p}=pD(),m=j.useMemo(()=>uE(e,t,p,s,i,"data"),[e,t,p,s,i]),g=j.useMemo(()=>uE(e,t,p,s,i,"assets"),[e,t,p,s,i]),x=j.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let A=new Set,T=!1;if(t.forEach(N=>{var D;let R=s.routes[N.route.id];!R||!R.hasLoader||(!m.some(H=>H.route.id===N.route.id)&&N.route.id in f&&((D=l[N.route.id])!=null&&D.shouldRevalidate)||R.hasClientLoader?T=!0:A.add(N.route.id))}),A.size===0)return[];let C=sD(e,c,r.unstable_trailingSlashAwareDataRequests,"data");return T&&A.size>0&&C.searchParams.set("_routes",t.filter(N=>A.has(N.route.id)).map(N=>N.route.id).join(",")),[C.pathname+C.search]},[c,r.unstable_trailingSlashAwareDataRequests,f,i,s,m,t,e,l]),v=j.useMemo(()=>uD(g,s),[g,s]),S=yD(g);return j.createElement(j.Fragment,null,x.map(A=>j.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...n})),v.map(A=>j.createElement("link",{key:A,rel:"modulepreload",href:A,...n})),S.map(({key:A,link:T})=>j.createElement("link",{key:A,nonce:n.nonce,...T,crossOrigin:T.crossOrigin??n.crossOrigin})))}function bD(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var vD=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{vD&&(window.__reactRouterVersion="7.13.1")}catch{}function _D({basename:e,children:t,unstable_useTransitions:n,window:i}){let r=j.useRef();r.current==null&&(r.current=ZO({window:i,v5Compat:!0}));let s=r.current,[l,c]=j.useState({action:s.action,location:s.location}),f=j.useCallback(p=>{n===!1?c(p):j.startTransition(()=>c(p))},[n]);return j.useLayoutEffect(()=>s.listen(f),[s,f]),j.createElement(W3,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:s,unstable_useTransitions:n})}var FC=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,GC=j.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:s,replace:l,unstable_mask:c,state:f,target:p,to:m,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},A){let{basename:T,navigator:C,unstable_useTransitions:N}=j.useContext(ss),R=typeof m=="string"&&FC.test(m),D=NC(m,T);m=D.to;let H=O3(m,{relative:r}),O=wl(),q=null;if(c){let K=W0(c,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);T!=="/"&&(K.pathname=K.pathname==="/"?T:po([T,K.pathname])),q=C.createHref(K)}let[Z,I,F]=mD(i,S),U=wD(m,{replace:l,unstable_mask:c,state:f,target:p,preventScrollReset:g,relative:r,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:N});function L(K){t&&t(K),K.defaultPrevented||U(K)}let J=!(D.isExternal||s),G=j.createElement("a",{...S,...F,href:(J?q:void 0)||D.absoluteURL||H,onClick:J?L:t,ref:bD(A,I),target:p,"data-discover":!R&&n==="render"?"true":void 0});return Z&&!R?j.createElement(j.Fragment,null,G,j.createElement(gD,{page:H})):G});GC.displayName="Link";var qC=j.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:s,to:l,viewTransition:c,children:f,...p},m){let g=Wm(l,{relative:p.relative}),x=wl(),v=j.useContext(Q0),{navigator:S,basename:A}=j.useContext(ss),T=v!=null&&RD(g)&&c===!0,C=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,N=x.pathname,R=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(N=N.toLowerCase(),R=R?R.toLowerCase():null,C=C.toLowerCase()),R&&A&&(R=sc(R,A)||R);const D=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let H=N===C||!r&&N.startsWith(C)&&N.charAt(D)==="/",O=R!=null&&(R===C||!r&&R.startsWith(C)&&R.charAt(C.length)==="/"),q={isActive:H,isPending:O,isTransitioning:T},Z=H?t:void 0,I;typeof i=="function"?I=i(q):I=[i,H?"active":null,O?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let F=typeof s=="function"?s(q):s;return j.createElement(GC,{...p,"aria-current":Z,className:I,ref:m,style:F,to:l,viewTransition:c},typeof f=="function"?f(q):f)});qC.displayName="NavLink";var SD=j.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:s,method:l=h0,action:c,onSubmit:f,relative:p,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:A}=j.useContext(ss),T=AD(),C=MD(c,{relative:p}),N=l.toLowerCase()==="get"?"get":"post",R=typeof c=="string"&&FC.test(c),D=H=>{if(f&&f(H),H.defaultPrevented)return;H.preventDefault();let O=H.nativeEvent.submitter,q=(O==null?void 0:O.getAttribute("formmethod"))||l,Z=()=>T(O||H.currentTarget,{fetcherKey:t,method:q,navigate:n,replace:r,state:s,relative:p,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:x});A&&n!==!1?j.startTransition(()=>Z()):Z()};return j.createElement("form",{ref:S,method:N,action:C,onSubmit:i?f:D,...v,"data-discover":!R&&e==="render"?"true":void 0})});SD.displayName="Form";function ED(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YC(e){let t=j.useContext(Sh);return Wn(t,ED(e)),t}function wD(e,{target:t,replace:n,unstable_mask:i,state:r,preventScrollReset:s,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:f,unstable_useTransitions:p}={}){let m=Z0(),g=wl(),x=Wm(e,{relative:l});return j.useCallback(v=>{if(nD(v,t)){v.preventDefault();let S=n!==void 0?n:km(g)===km(x),A=()=>m(e,{replace:S,unstable_mask:i,state:r,preventScrollReset:s,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:f});p?j.startTransition(()=>A()):A()}},[g,m,x,n,i,r,t,e,s,l,c,f,p])}var TD=0,CD=()=>`__${String(++TD)}__`;function AD(){let{router:e}=YC("useSubmit"),{basename:t}=j.useContext(ss),n=Y3(),i=e.fetch,r=e.navigate;return j.useCallback(async(s,l={})=>{let{action:c,method:f,encType:p,formData:m,body:g}=aD(s,t);if(l.navigate===!1){let x=l.fetcherKey||CD();await i(x,n,l.action||c,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:g,formMethod:l.method||f,formEncType:l.encType||p,flushSync:l.flushSync})}else await r(l.action||c,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:g,formMethod:l.method||f,formEncType:l.encType||p,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[i,r,t,n])}function MD(e,{relative:t}={}){let{basename:n}=j.useContext(ss),i=j.useContext(El);Wn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),s={...Wm(e||".",{relative:t})},l=wl();if(e==null){s.search=l.search;let c=new URLSearchParams(s.search),f=c.getAll("index");if(f.some(m=>m==="")){c.delete("index"),f.filter(g=>g).forEach(g=>c.append("index",g));let m=c.toString();s.search=m?`?${m}`:""}}return(!e||e===".")&&r.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:po([n,s.pathname])),km(s)}function RD(e,{relative:t}={}){let n=j.useContext(DC);Wn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=YC("useViewTransitionState"),r=Wm(e,{relative:t});if(!n.isTransitioning)return!1;let s=sc(n.currentLocation.pathname,i)||n.currentLocation.pathname,l=sc(n.nextLocation.pathname,i)||n.nextLocation.pathname;return w0(r.pathname,l)!=null||w0(r.pathname,s)!=null}CC();const dE=e=>{let t;const n=new Set,i=(p,m)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const x=t;t=m??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(v=>v(t,x))}},r=()=>t,c={setState:i,getState:r,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(i,r,c);return c},kD=(e=>e?dE(e):dE),ND=e=>e;function OD(e,t=ND){const n=fm.useSyncExternalStore(e.subscribe,fm.useCallback(()=>t(e.getState()),[e,t]),fm.useCallback(()=>t(e.getInitialState()),[e,t]));return fm.useDebugValue(n),n}const fE=e=>{const t=kD(e),n=i=>OD(t,i);return Object.assign(n,t),n},fu=(e=>e?fE(e):fE),gl=fu(e=>({user:null,isAuthenticated:!1,loading:!1,error:null,login:async(t,n)=>{e({loading:!0,error:null});try{const i=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:n}),credentials:"include"}),r=await i.json();if(!i.ok){e({loading:!1,error:r.error||"Login failed"});return}e({user:r.user,isAuthenticated:!0,loading:!1,error:null})}catch{e({loading:!1,error:"Network error"})}},logout:async()=>{try{await fetch("/api/auth/logout",{method:"POST",credentials:"include"})}catch{}e({user:null,isAuthenticated:!1,error:null})},checkAuth:async()=>{e({loading:!0});try{const t=await fetch("/api/auth/me",{credentials:"include"});if(t.ok){const n=await t.json();e({user:n.user,isAuthenticated:!0,loading:!1})}else e({user:null,isAuthenticated:!1,loading:!1})}catch{e({user:null,isAuthenticated:!1,loading:!1})}},reset:()=>e({user:null,isAuthenticated:!1,loading:!1,error:null})})),vr=fu((e,t)=>({squads:[],selectedSquad:null,activeStates:{},uiComponents:{},fetchSquads:async()=>{try{const n=await fetch("/api/squads",{credentials:"include"});if(n.ok){const i=await n.json();e({squads:i.squads})}}catch{}},selectSquad:n=>e({selectedSquad:n}),setSquadState:(n,i)=>e(r=>({activeStates:{...r.activeStates,[n]:i}})),clearSquadState:n=>e(i=>{const{[n]:r,...s}=i.activeStates;return{activeStates:s}}),setUiComponents:(n,i)=>e(r=>({uiComponents:{...r.uiComponents,[n]:i}})),reset:()=>e({squads:[],selectedSquad:null,activeStates:{},uiComponents:{}})}));let DD=0;function hE(){return`local-${Date.now()}-${++DD}`}const rr=fu((e,t)=>({conversations:[],messages:[],conversationId:null,streaming:!1,streamingText:"",activity:null,error:null,addUserMessage:n=>{const i={id:hE(),role:"user",content:n,createdAt:new Date().toISOString()};e(r=>{const s=r.conversationId,l=s&&!r.messages.some(c=>c.role==="user")?r.conversations.map(c=>c.id===s?{...c,preview:n.slice(0,80)}:c):r.conversations;return{messages:[...r.messages,i],error:null,conversations:l}})},setConversationId:n=>{e({conversationId:n})},startStreaming:()=>{e({streaming:!0,streamingText:"",activity:null,error:null})},appendChunk:n=>{e(i=>({streamingText:i.streamingText+n,activity:null}))},setActivity:n=>{e({activity:n})},finishStreaming:n=>{const{streamingText:i}=t(),r={id:n,role:"assistant",content:i,createdAt:new Date().toISOString()};e(s=>({messages:[...s.messages,r],streaming:!1,streamingText:"",activity:null}))},addAgentDm:n=>{const i={id:hE(),role:"agent_dm",content:n.content,agentId:n.agentId,agentName:n.agentName,createdAt:new Date().toISOString()};e(r=>({messages:[...r.messages,i]}))},setError:n=>{e({error:n,streaming:!1,streamingText:"",activity:null})},loadConversations:async n=>{try{const i=await fetch(`/api/squads/${n}/conversations`,{credentials:"include"});if(!i.ok)return;const s=((await i.json()).data||[]).map(l=>({id:l.id,createdAt:l.created_at,preview:""}));for(const l of s)try{const c=await fetch(`/api/conversations/${l.id}/messages?limit=1`,{credentials:"include"});if(c.ok){const p=((await c.json()).data||[])[0];p&&(l.preview=p.content.slice(0,80))}}catch{}e({conversations:s})}catch{}},selectConversation:async n=>{e({conversationId:n,messages:[],streaming:!1,streamingText:"",activity:null,error:null});try{const i=await fetch(`/api/conversations/${n}/messages`,{credentials:"include"});if(!i.ok)return;const s=((await i.json()).data||[]).map(l=>({id:l.id,role:l.role,content:l.content,agentId:l.agent_id??void 0,agentName:l.agent_name??void 0,createdAt:l.created_at}));e({messages:s})}catch{}},deleteConversation:async(n,i)=>{try{if(!(await fetch(`/api/conversations/${n}`,{method:"DELETE",credentials:"include"})).ok)return;const{conversationId:s}=t();e(l=>({conversations:l.conversations.filter(c=>c.id!==n)})),s===n&&e({conversationId:null,messages:[]})}catch{}},loadHistory:async n=>{try{const i=await fetch(`/api/squads/${n}/conversations`,{credentials:"include"});if(!i.ok)return;const r=await i.json();if(!r.data||r.data.length===0){e({conversationId:null,messages:[],conversations:[]});return}const s=(r.data||[]).map(g=>({id:g.id,createdAt:g.created_at,preview:""})),l=r.data[0];e({conversationId:l.id,conversations:s});const c=await fetch(`/api/conversations/${l.id}/messages`,{credentials:"include"});if(!c.ok)return;const p=((await c.json()).data||[]).map(g=>({id:g.id,role:g.role,content:g.content,agentId:g.agent_id??void 0,agentName:g.agent_name??void 0,createdAt:g.created_at})),m=p.find(g=>g.role==="user");if(m){const g=s.findIndex(x=>x.id===l.id);g>=0&&(s[g].preview=m.content.slice(0,80))}e({messages:p,conversations:s});for(const g of s)if(g.id!==l.id)try{const x=await fetch(`/api/conversations/${g.id}/messages?limit=1`,{credentials:"include"});if(x.ok){const S=((await x.json()).data||[])[0];S&&(g.preview=S.content.slice(0,80))}}catch{}e({conversations:[...s]})}catch{}},reset:()=>e({conversations:[],messages:[],conversationId:null,streaming:!1,streamingText:"",error:null})}));function zD(e){const n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,i=new WebSocket(n),r=[];let s=!0;function l(c){i.readyState===WebSocket.OPEN?i.send(JSON.stringify(c)):i.readyState===WebSocket.CONNECTING&&r.push(c)}return i.onopen=()=>{var c,f;s||(f=(c=e.current).onReconnect)==null||f.call(c),s=!1;for(const p of r)i.send(JSON.stringify(p));r.length=0},i.onmessage=c=>{var f,p,m,g,x,v,S,A,T,C,N,R,D,H,O,q,Z,I,F;try{const U=JSON.parse(c.data),L=e.current;switch(U.type){case"squad:state":(f=L.onSquadState)==null||f.call(L,U.squadName,U.state);break;case"squad:inactive":(p=L.onSquadInactive)==null||p.call(L,U.squadName,U.reason);break;case"chat:chunk":(m=L.onChatChunk)==null||m.call(L,U.squadName,U.conversationId,U.delta);break;case"chat:activity":(g=L.onChatActivity)==null||g.call(L,U.squadName,U.tool,U.summary);break;case"chat:done":(x=L.onChatDone)==null||x.call(L,U.squadName,U.conversationId,U.messageId);break;case"chat:error":(v=L.onChatError)==null||v.call(L,U.squadName,U.error);break;case"chat:agent_dm":(S=L.onChatAgentDm)==null||S.call(L,U.squadName,U.conversationId,U.agentId,U.agentName,U.message);break;case"chat:conversation_created":(A=L.onChatConversationCreated)==null||A.call(L,U.squadName,U.conversationId);break;case"agent:output_chunk":(T=L.onAgentOutputChunk)==null||T.call(L,U.squadName,U.agentId,U.agentName,U.delta);break;case"agent:step_start":(C=L.onAgentStepStart)==null||C.call(L,U.squadName,U.agentId,U.agentName,U.stepIndex,U.stepLabel);break;case"agent:step_complete":(N=L.onAgentStepComplete)==null||N.call(L,U.squadName,U.agentId,U.agentName,U.stepIndex,U.stepLabel);break;case"squad:checkpoint":(R=L.onSquadCheckpoint)==null||R.call(L,U.squadName,U.agentId,U.agentName,U.question);break;case"schedule:started":(D=L.onScheduleStarted)==null||D.call(L,U.squadName,U.jobId,U.attempt);break;case"schedule:chunk":(H=L.onScheduleChunk)==null||H.call(L,U.squadName,U.jobId,U.delta);break;case"schedule:done":(O=L.onScheduleDone)==null||O.call(L,U.squadName,U.jobId,U.summary,U.attempt);break;case"schedule:error":(q=L.onScheduleError)==null||q.call(L,U.squadName,U.jobId,U.error,U.attempt,U.willRetry);break;case"schedule:status_changed":(Z=L.onScheduleStatusChanged)==null||Z.call(L,U.squadName,U.status);break;case"kanban:task_updated":(I=L.onKanbanTaskUpdated)==null||I.call(L,U);break;case"a2ui:update":(F=L.onA2uiUpdate)==null||F.call(L,U.squadName,U.components);break}}catch{}},{subscribe:c=>{l({type:"squad:subscribe",squadName:c})},unsubscribe:c=>{l({type:"squad:unsubscribe",squadName:c})},sendChat:(c,f,p)=>{const m={type:"chat:send",squadName:c,message:f};p&&p.length>0&&(m.files=p),l(m)},newConversation:c=>{l({type:"chat:new_conversation",squadName:c})},sendCheckpointResponse:(c,f)=>{l({type:"squad:checkpoint_response",squadName:c,answer:f})},disconnect:()=>{i.close()}}}function BD(e={}){const t=j.useRef(null),n=j.useRef(e),i=j.useRef(new Set);n.current=e,j.useEffect(()=>{const p=zD(n);t.current=p;for(const m of i.current)p.subscribe(m);return()=>{p.disconnect()}},[]);const r=j.useCallback(p=>{var m;i.current.add(p),(m=t.current)==null||m.subscribe(p)},[]),s=j.useCallback(p=>{var m;i.current.delete(p),(m=t.current)==null||m.unsubscribe(p)},[]),l=j.useCallback((p,m,g)=>{var x;(x=t.current)==null||x.sendChat(p,m,g)},[]),c=j.useCallback(p=>{var m;(m=t.current)==null||m.newConversation(p)},[]),f=j.useCallback((p,m)=>{var g;(g=t.current)==null||g.sendCheckpointResponse(p,m)},[]);return{subscribe:r,unsubscribe:s,sendChat:l,newConversation:c,sendCheckpointResponse:f}}function LD(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60,r=s=>s.toString().padStart(2,"0");return t>0?`${t}h ${r(n)}m ${r(i)}s`:`${n}m ${r(i)}s`}function jD({state:e}){const[t,n]=j.useState(0);return j.useEffect(()=>{if(!(e!=null&&e.startedAt)||e.status!=="running"){n(0);return}const i=new Date(e.startedAt).getTime(),r=()=>n(Math.floor((Date.now()-i)/1e3));r();const s=setInterval(r,1e3);return()=>clearInterval(s)},[e==null?void 0:e.startedAt,e==null?void 0:e.status]),_.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"var(--statusbar-height)",padding:"0 var(--sp-4)",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)",fontFamily:"var(--font-mono)",fontSize:"0.7rem",color:"var(--text-muted)"},children:e?_.jsxs(_.Fragment,{children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[_.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:e.status==="running"?"var(--status-active)":e.status==="checkpoint"?"var(--status-warning)":"var(--status-idle)",boxShadow:e.status==="running"?"0 0 8px var(--status-active-glow)":"none",animation:e.status==="running"?"statusPulse 2s ease-in-out infinite":"none"}}),_.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Step ",e.step.current,"/",e.step.total]}),_.jsx("span",{style:{color:"var(--border-strong)"},children:"│"}),_.jsx("span",{children:e.step.label})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[e.handoff&&_.jsxs("span",{style:{color:"var(--accent)"},children:[e.handoff.from," → ",e.handoff.to]}),e.status==="running"&&_.jsx("span",{style:{color:"var(--text-secondary)"},children:LD(t)})]})]}):_.jsxs(_.Fragment,{children:[_.jsx("span",{children:"Ready"}),_.jsx("span",{children:"ExpxAgents Mission Control"})]})})}let Pv=null;function ID(e){Pv=e}function VC(e,t,n){Pv&&Pv(e,t,n)}let Fv=null;function UD(e){Fv=e}function HD(e){Fv&&Fv(e)}let Gv=null;function PD(e){Gv=e}function FD(e,t){Gv&&Gv(e,t)}const m0=32,fl=96,iu=64,pt={floor:13158600,floorHighlight:14211288,floorGrout:12105912,wall:15261904,wallTrim:11577496,baseboard:7035464,desk:15263976,deskTop:16119285,deskShadow:13684944,deskLeg:1710618,deskEdge:14737632,monitor:2236976,monitorScreen:1981020,monitorScreenGlow:2773120,monitorStand:3355456,keyboard:3355456,keyboardKey:4473941,chairSeat:2899536,chairBack:3426654,chairBase:4473924,chairWheel:3355443,plant:5025616,plantDark:3706428,plantLight:6732650,pot:9133628,potRim:10515018,soil:4863264,bookshelf:8020808,bookshelfEdge:9139029,bookColors:[15022389,2001125,4431943,16750592,9315498,35195,16635957],rug:6044974,rugPattern:8016448,rugBorder:4861472},qv=[5227511,5025616,16750592,15022389,9315498,16771899],GD={idle:8947848,working:5025616,delivering:5227511,done:5025616,checkpoint:16750592},Br={counter:4073251,counterTop:6111287,machine:3622735,machineTop:4545124,machineLight:5025616,cup:14142664,cupShadow:12364452,saucer:14735052,sink:7901340,faucet:11583173,menu:5125166},Wa={table:6111287,tableTop:7162945,tableEdge:5125166,tableLeg:4073251,chair:3622735,chairSeat:4545124,chairBack:5533306,carpet:2503224,carpetPattern:3030340,whiteboard:15527921,whiteboardFrame:7901340},md={background:1713022,backgroundGlow:2635155,statusRunning:5025616,statusIdle:8947848,statusCheckpoint:16750592,statusCompleted:5025616},au={floor:11579568,tile:11053224,grout:10066329,stripe:12632256},la={floor:14477552,tile:12966120,tileGrout:11453652,wall:14740208,stall:11583173,stallDoor:9479342,sink:15527921,sinkBowl:16777215,mirror:11789820,mirrorFrame:7901340,toilet:16448250,toiletSeat:15658734,pipe:9479342},Aa={floor:6111287,carpet:5125166,carpetBorder:4073251,desk:4073251,deskTop:6111287,deskEdge:2890510,chair:1713022,chairSeat:2635155,window:8508666,windowFrame:5533306,windowSill:7901340,bookshelf:7162945,globe:4367861,nameplate:16766720},ah={wall:7901340,wallHighlight:10795204,doorFrame:6111287},ir={floor:16115411,tile:15259072,tileGrout:13942952,counter:6111287,counterTop:7951688,fridge:15527921,fridgeDoor:14737632,fridgeHandle:10395294,table:9268835,tableTop:10586239,chair:7162945,coffeeMaker:3622735,coffeeMakerLight:5025616,lamp:16766287},Ma={floor:14142664,carpet:6323595,carpetBorder:4545124,sofa:5533306,sofaCushion:6323595,sofaArm:4545124,tv:2171169,tvScreen:2503224,tvStand:4342338,sideTable:7951688,magazine:15684432,magazineAlt:4367861},ec=480,Za=360,id=400,Gi=60,Qa=120,mb=120,pE=160,mE=120,gE=160,qD=64,YD=80,VD=fl+32,XD=iu+48,yE=2,XC=10,Wo=80;function My(e,t,n){const i=Math.max(0,Math.min(1,n));return e+(t-e)*i}function KD(e){return e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2}const $D=["nw","ne","sw","se"],WD={nw:"right",ne:"left",sw:"top",se:"top"};function T0(e){const t=XC,n=Math.max(1,e),i={nw:0,ne:0,sw:0,se:0},r=[];for(let W=0;W<n;W++){const Y=$D[W%4];r.push({quadrant:Y,slot:i[Y]}),i[Y]++}const s=Math.max(1,i.nw),l=Math.max(1,i.ne),c=Math.max(1,i.sw),f=Math.max(1,i.se),p=Math.max(id,Qa),m=s*(Za+t),g=l*(Za+t),x=Math.max(m+p,g+Qa),v=c*(Za+t),S=f*(Za+t),A=Math.max(pE,gE),T=Math.max(v+A+t,S+A+t),C=Math.max(ec,Qa+t+id),N=Math.max(ec,Qa),R=Math.max(ec,mb),D=Math.max(ec,mE),H=Math.max(C,R),O=Math.max(N,D),q=t+H+t+Gi+t+O+t,Z=t+x+t+Gi+t+T+t,I={x:t+H+t,y:t,width:Gi,height:Z-2*t},F={x:t,y:t+x+t,width:q-2*t,height:Gi},U={x:I.x+I.width/2,y:F.y+F.height/2},L={x:I.x-t-id,y:F.y-t-id,width:id,height:id},J={x:L.x-t-Qa,y:F.y-t-Qa,width:Qa,height:Qa},G={x:I.x+Gi+t,y:F.y-t-Qa,width:Qa,height:Qa},K={x:I.x-t-mb,y:F.y+Gi+t+c*(Za+t),width:mb,height:pE},B={x:I.x+Gi+t,y:F.y+Gi+t+f*(Za+t),width:mE,height:gE},V=[],Q={};for(let W=0;W<n;W++){const{quadrant:Y,slot:$}=r[W],ne=WD[Y];let X;Y==="nw"?X={x:I.x-t-ec,y:L.y-t-($+1)*Za-$*t}:Y==="ne"?X={x:I.x+Gi+t,y:G.y-t-($+1)*Za-$*t}:Y==="sw"?X={x:I.x-t-ec,y:F.y+Gi+t+$*(Za+t)}:X={x:I.x+Gi+t,y:F.y+Gi+t+$*(Za+t)},V.push({origin:X,width:ec,height:Za,quadrant:Y,doorSide:ne}),ne==="right"||ne==="left"?Q[`squad-${W}`]={x:I.x+Gi/2,y:X.y+Za/2}:Q[`squad-${W}`]={x:X.x+ec/2,y:F.y+Gi/2}}return Q.ceo={x:I.x+Gi/2,y:L.y+id/2},Q["bathroom-male"]={x:J.x+Qa/2,y:F.y+Gi/2},Q["bathroom-female"]={x:G.x+Qa/2,y:F.y+Gi/2},Q.kitchen={x:I.x+Gi/2,y:K.y+K.height/2},Q["rest-area"]={x:I.x+Gi/2,y:B.y+B.height/2},{totalWidth:q,totalHeight:Z,squadOrigins:V,ceoOffice:L,corridorH:F,corridorV:I,bathroomMale:J,bathroomFemale:G,kitchen:K,restArea:B,doorPoints:Q,corridorHub:U}}function th(e,t,n,i){const r=e%yE,s=Math.floor(e/yE);return{x:t.x+qD+r*VD,y:t.y+YD+s*XD}}function bm(e,t,n){return{x:e.x+t-80,y:e.y+n-80}}function KC(e,t,n){return{x:e.x+t-160,y:e.y+Math.floor(n/2)}}function QD(e,t){const n=t==="male"?e.bathroomMale:e.bathroomFemale;return{x:n.x+n.width/2,y:n.y+n.height/2}}function ZD(e){return{x:e.kitchen.x+e.kitchen.width/2,y:e.kitchen.y+e.kitchen.height/2}}function JD(e){return{x:e.restArea.x+e.restArea.width/2,y:e.restArea.y+e.restArea.height/2}}function e4(e){const t=e.corridorV;if(t.height>0&&Math.random()<.5)return{x:t.x+10+Math.random()*Math.max(0,t.width-20),y:t.y+10+Math.random()*Math.max(0,t.height-20)};const n=e.corridorH;return{x:n.x+20+Math.random()*Math.max(0,n.width-40),y:n.y+10+Math.random()*Math.max(0,n.height-20)}}function xE(e,t){const n=t.corridorH;return e.x>=n.x&&e.x<=n.x+n.width&&e.y>=n.y&&e.y<=n.y+n.height}function bE(e,t){const n=t.corridorV;return e.x>=n.x&&e.x<=n.x+n.width&&e.y>=n.y&&e.y<=n.y+n.height}function t4(e,t){if(e==="ceo"){const i=t.ceoOffice;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="bathroom-male"){const i=t.bathroomMale;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="bathroom-female"){const i=t.bathroomFemale;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="kitchen"){const i=t.kitchen;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="rest-area"){const i=t.restArea;return{x:i.x+i.width/2,y:i.y+i.height/2}}const n=e.match(/^squad-(\d+)$/);if(n){const i=parseInt(n[1],10),r=t.squadOrigins[i];if(r)return{x:r.origin.x+r.width/2,y:r.origin.y+r.height/2}}return t.corridorHub}function vm(e,t,n,i){const r=i.doorPoints[t],s=i.doorPoints[n];if(!r||!s)return[e];const l=i.corridorHub,c=t4(n,i),f=xE(r,i)&&xE(s,i),p=bE(r,i)&&bE(s,i);return f||p?[e,r,s,c]:[e,r,l,s,c]}function Ry(e,t){const n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)}const vE=500,_E=50;let SE=0;function EE(e){return{idle:"idle",working:"working",delivering:"walking",done:"idle",checkpoint:"checkpoint"}[e]??"idle"}const ai=fu(e=>({rooms:[],activeRoom:null,bubbles:{},activityLog:{},checkpoints:{},agentVisuals:{},appendBubble:(t,n,i)=>{const r=`${t}:${n}`;e(s=>{var f;let c=(((f=s.bubbles[r])==null?void 0:f.text)??"")+i;return c.length>vE&&(c=c.slice(c.length-vE)),{bubbles:{...s.bubbles,[r]:{text:c,updatedAt:Date.now()}}}})},clearBubble:(t,n)=>{const i=`${t}:${n}`;e(r=>{const{[i]:s,...l}=r.bubbles;return{bubbles:l}})},clearAllBubbles:()=>e({bubbles:{}}),addActivity:(t,n,i)=>{const s={id:++SE,agentName:n,action:i,timestamp:Date.now()};e(l=>{var m;const f=[...((m=l.activityLog[t])==null?void 0:m.entries)??[],s],p=f.length>_E?f.slice(f.length-_E):f;return{activityLog:{...l.activityLog,[t]:{entries:p}}}})},setCheckpoint:(t,n,i,r)=>e(s=>({checkpoints:{...s.checkpoints,[t]:{agentId:n,agentName:i,question:r}}})),clearCheckpoint:t=>e(n=>{const{[t]:i,...r}=n.checkpoints;return{checkpoints:r}}),setActiveRoom:t=>e({activeRoom:t}),syncRooms:t=>e(n=>{const i=t;let r;return i.length===0?r=null:n.activeRoom===null||!i.includes(n.activeRoom)?r=i[0]:r=n.activeRoom,{rooms:i,activeRoom:r}}),setAgents:(t,n)=>e(i=>{const r=i.agentVisuals[t]??[],s=new Map(r.map(v=>[v.id,v])),l={x:0,y:0},c=T0(i.rooms.length),f=i.rooms.indexOf(t),p=c.squadOrigins[f],m=(p==null?void 0:p.width)??480,g=(p==null?void 0:p.height)??360,x=n.map((v,S)=>{const A=s.get(v.id);if(A){const N=v.status?EE(v.status):A.status,R=N!==A.status;let D=A.targetPosition;return R&&(N==="working"||N==="checkpoint"?D=th(S,l):D=bm(l,m,g)),{...A,name:v.name,avatar:v.avatar,deskIndex:S,status:N,targetPosition:D}}const T=v.status?EE(v.status):"idle",C=T==="working"||T==="checkpoint"?th(S,l):bm(l,m,g);return{id:v.id,name:v.name,avatar:v.avatar,colorIndex:S%6,status:T,deskIndex:S,position:C,targetPosition:null}});return{agentVisuals:{...i.agentVisuals,[t]:x}}}),setAgentStatus:(t,n,i)=>e(r=>{const s=r.agentVisuals[t];if(!s)return r;const l={x:0,y:0},c=T0(r.rooms.length),f=r.rooms.indexOf(t),p=c.squadOrigins[f],m=(p==null?void 0:p.width)??480,g=(p==null?void 0:p.height)??360,x=s.map(v=>{if(v.id!==n)return v;let S;return i==="working"||i==="checkpoint"?S=th(v.deskIndex,l):S=bm(l,m,g),{...v,status:i,targetPosition:S}});return{agentVisuals:{...r.agentVisuals,[t]:x}}}),reset:()=>{SE=0,e({rooms:[],activeRoom:null,bubbles:{},activityLog:{},checkpoints:{},agentVisuals:{}})}})),aQ={background:"#0a0a0f",grid:"rgba(0, 200, 255, 0.06)",orbStandby:"#1a3a5c",orbListening:"#00c8ff",orbProcessing:"#ff8c00",orbSpeaking:"#00ff88",panelBg:"rgba(0, 200, 255, 0.08)",panelBorder:"rgba(0, 200, 255, 0.25)",textPrimary:"#e0e8f0",textAccent:"#00c8ff",textJarvis:"#00ff88",particleStart:"#00c8ff"},n4={orbRadius:60,orbRingWidth:3,gridSpacing:40,particleCount:65,particleMinRadius:1,particleMaxRadius:3,waveformBars:32,waveformMaxHeight:40,panelWidth:180,panelPadding:12,transcriptLineHeight:20,standbyTimeoutMs:15e3,ttsSplitLength:300};let $C=0;function i4(){return`jarvis-${Date.now()}-${++$C}`}let lo=null;const gb=fu((e,t)=>({mode:"STANDBY",messages:[],streamingText:"",selectedSquad:null,userName:"",setMode:n=>e({mode:n}),addMessage:(n,i)=>{const r={id:i4(),role:n,content:i,createdAt:new Date().toISOString()};e(s=>({messages:[...s.messages,r]}))},appendChunk:n=>{e(i=>({streamingText:i.streamingText+n}))},finalizeMessage:n=>{const{streamingText:i}=t(),r={id:n,role:"assistant",content:i,createdAt:new Date().toISOString()};e(s=>({messages:[...s.messages,r],streamingText:""}))},selectSquad:n=>e({selectedSquad:n}),setUserName:n=>e({userName:n}),startStandbyTimer:()=>{lo&&clearTimeout(lo),lo=setTimeout(()=>{e({mode:"STANDBY"}),lo=null},n4.standbyTimeoutMs)},resetStandbyTimer:()=>{t().startStandbyTimer()},clearStandbyTimer:()=>{lo&&(clearTimeout(lo),lo=null)},reset:()=>{lo&&(clearTimeout(lo),lo=null),$C=0,e({mode:"STANDBY",messages:[],streamingText:"",selectedSquad:null,userName:""})}})),ua=fu((e,t)=>({jobs:[],loading:!1,history:{},historyLoading:{},fetchJobs:async()=>{e({loading:!0});try{const n=await fetch("/api/scheduler",{credentials:"include"});if(n.ok){const i=await n.json();e({jobs:i.data,loading:!1})}else e({loading:!1})}catch{e({loading:!1})}},createJob:async n=>(await fetch("/api/scheduler",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).ok?(t().fetchJobs(),!0):!1,deleteJob:async n=>{await fetch(`/api/scheduler/${n}`,{method:"DELETE",credentials:"include"}),t().fetchJobs()},pauseJob:async n=>{await fetch(`/api/scheduler/${n}/pause`,{method:"POST",credentials:"include"}),t().fetchJobs()},resumeJob:async n=>{await fetch(`/api/scheduler/${n}/resume`,{method:"POST",credentials:"include"}),t().fetchJobs()},triggerJob:async n=>{await fetch(`/api/scheduler/${n}/trigger`,{method:"POST",credentials:"include"})},updateJobStatus:(n,i)=>{e(r=>({jobs:r.jobs.map(s=>s.squad_name===n?{...s,status:i}:s)}))},fetchHistory:async n=>{e(i=>({historyLoading:{...i.historyLoading,[n]:!0}}));try{const i=await fetch(`/api/scheduler/${n}/history?limit=50`,{credentials:"include"});if(i.ok){const r=await i.json();e(s=>({history:{...s.history,[n]:r.data},historyLoading:{...s.historyLoading,[n]:!1}}))}else e(r=>({historyLoading:{...r.historyLoading,[n]:!1}}))}catch{e(i=>({historyLoading:{...i.historyLoading,[n]:!1}}))}}})),r4=600*1e3;function a4(){const[e,t]=j.useState(null),[n,i]=j.useState(!1),[r,s]=j.useState(!1),l=j.useCallback(async()=>{try{const f=await fetch("/api/system/version",{credentials:"include"});if(f.ok){const p=await f.json();t(p)}}catch{}},[]);j.useEffect(()=>{l();const f=setInterval(l,r4);return()=>clearInterval(f)},[l]);const c=async()=>{i(!0);try{await fetch("/api/system/update",{method:"POST",credentials:"include"})}catch{i(!1)}};return!(e!=null&&e.updateAvailable)||r?null:_.jsx("div",{"data-testid":"update-banner",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"var(--sp-3)",padding:"8px var(--sp-4)",background:"var(--surface-2)",borderBottom:"1px solid var(--accent)",fontFamily:"var(--font-mono)",fontSize:"0.72rem",color:"var(--text-secondary)",animation:"fadeIn 0.3s var(--ease-out) both"},children:n?_.jsxs("span",{style:{color:"var(--accent)"},children:["Updating to v",e.latest,"... Server will restart automatically."]}):_.jsxs(_.Fragment,{children:[_.jsxs("span",{children:["New version available: ",_.jsxs("strong",{style:{color:"var(--accent)"},children:["v",e.latest]}),_.jsxs("span",{style:{color:"var(--text-muted)",marginLeft:6},children:["(current: v",e.current,")"]})]}),_.jsx("button",{"data-testid":"btn-update",onClick:c,style:{padding:"3px 12px",borderRadius:"var(--radius-xs)",fontFamily:"var(--font-mono)",fontSize:"0.68rem",fontWeight:600,cursor:"pointer",border:"none",background:"var(--accent)",color:"var(--text-inverse)",transition:"opacity 0.15s ease"},children:"Update"}),_.jsx("button",{"data-testid":"btn-dismiss-update",onClick:()=>s(!0),style:{padding:"2px 6px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.68rem"},children:"✕"})]})})}function s4(){if(typeof window>"u")return"dark";const e=localStorage.getItem("expx-theme");return e==="light"||e==="dark"?e:"dark"}function wE(e){document.documentElement.setAttribute("data-theme",e),localStorage.setItem("expx-theme",e)}const C0=fu((e,t)=>({theme:s4(),toggle:()=>{const n=t().theme==="dark"?"light":"dark";wE(n),e({theme:n})},setTheme:n=>{wE(n),e({theme:n})}})),l4=j.lazy(()=>ou(()=>import("./ThreeBackground-ClAX-GgS.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ThreeBackground}))),o4=[{to:"/office",label:"Office",icon:"⬡"},{to:"/chat",label:"Chat",icon:"◈"},{to:"/kanban",label:"Kanban",icon:"▦"},{to:"/dashboard",label:"Dashboard",icon:"▣"},{to:"/scheduler",label:"Scheduler",icon:"⏣"},{to:"/email",label:"Email",icon:"✉"},{to:"/orgchart",label:"Org Chart",icon:"◎"},{to:"/graph",label:"Graph",icon:"◇"},{to:"/files",label:"Files",icon:"▤"},{to:"/settings",label:"Settings",icon:"⚙"}];function c4(){const e=gl(ie=>ie.user),t=gl(ie=>ie.isAuthenticated),n=gl(ie=>ie.loading),i=gl(ie=>ie.logout),r=gl(ie=>ie.checkAuth),s=Z0(),l=wl();l.pathname==="/office"||l.pathname;const c=l.pathname==="/jarvis",f=C0(ie=>ie.theme),p=C0(ie=>ie.toggle),m=vr(ie=>ie.squads),g=vr(ie=>ie.selectedSquad),x=vr(ie=>g?ie.activeStates[g]:null),v=vr(ie=>ie.fetchSquads),S=vr(ie=>ie.setSquadState),A=vr(ie=>ie.clearSquadState),T=j.useCallback((ie,he)=>{S(ie,he);const be=ai.getState();be.rooms.includes(ie)||be.syncRooms([...be.rooms,ie]),he.status!=="checkpoint"&&be.clearCheckpoint(ie),he.agents&&be.setAgents(ie,he.agents.map(ye=>({id:ye.id,name:ye.name,status:ye.status})))},[S]),C=j.useCallback(ie=>{A(ie);const he=ai.getState(),be=he.agentVisuals[ie];if(be)for(const ye of be)he.setAgentStatus(ie,ye.id,"idle")},[A]),N=j.useCallback((ie,he)=>{rr.setState(be=>({conversationId:he,messages:[],conversations:[{id:he,createdAt:new Date().toISOString(),preview:""},...be.conversations.filter(ye=>ye.id!==he)]}))},[]),R=j.useCallback((ie,he,be)=>{if(ie==="_jarvis"){gb.getState().appendChunk(be);return}const ye=rr.getState();ye.streaming||ye.startStreaming(),ye.appendChunk(be)},[]),D=j.useCallback((ie,he,be)=>{if(ie==="_jarvis"){gb.getState().finalizeMessage(be);return}rr.getState().finishStreaming(be)},[]),H=j.useCallback((ie,he)=>{if(ie==="_jarvis"){gb.getState().setMode("LISTENING");return}rr.getState().setError(he)},[]),O=j.useCallback((ie,he,be)=>{ie!=="_jarvis"&&rr.getState().setActivity(`${he}${be?" "+be:""}`)},[]),q=j.useCallback((ie,he,be,ye,le)=>{rr.getState().addAgentDm({agentId:be,agentName:ye,content:le})},[]),Z=j.useCallback((ie,he,be,ye)=>{ai.getState().appendBubble(ie,he,ye)},[]),I=j.useCallback((ie,he,be,ye,le)=>{ai.getState().addActivity(ie,be,`started "${le}"`),ai.getState().setAgentStatus(ie,he,"working")},[]),F=j.useCallback((ie,he,be,ye,le)=>{ai.getState().addActivity(ie,be,`completed "${le}"`),ai.getState().setAgentStatus(ie,he,"idle")},[]),U=j.useCallback((ie,he,be,ye)=>{ai.getState().setCheckpoint(ie,he,be,ye),ai.getState().setAgentStatus(ie,he,"checkpoint")},[]),L=j.useCallback(()=>{ai.getState().clearAllBubbles()},[]),J=j.useCallback((ie,he,be)=>{ua.getState().fetchJobs()},[]),G=j.useCallback((ie,he,be,ye)=>{ua.getState().fetchJobs()},[]),K=j.useCallback((ie,he,be,ye,le)=>{ua.getState().fetchJobs()},[]),B=j.useCallback((ie,he)=>{ua.getState().updateJobStatus(ie,he)},[]),V=j.useCallback(ie=>{window.dispatchEvent(new CustomEvent("kanban:task_updated",{detail:ie}))},[]),Q=j.useCallback((ie,he)=>{vr.getState().setUiComponents(ie,he)},[]),{subscribe:W,unsubscribe:Y,sendChat:$,newConversation:ne,sendCheckpointResponse:X}=BD({onSquadState:T,onSquadInactive:C,onChatConversationCreated:N,onChatChunk:R,onChatActivity:O,onChatDone:D,onChatError:H,onChatAgentDm:q,onAgentOutputChunk:Z,onAgentStepStart:I,onAgentStepComplete:F,onSquadCheckpoint:U,onReconnect:L,onScheduleStarted:J,onScheduleDone:G,onScheduleError:K,onScheduleStatusChanged:B,onKanbanTaskUpdated:V,onA2uiUpdate:Q});j.useEffect(()=>{ID($)},[$]),j.useEffect(()=>{UD(ne)},[ne]),j.useEffect(()=>{PD(X)},[X]),j.useEffect(()=>{v().then(()=>{const{squads:ie}=vr.getState();if(ie.length>0){const he=ai.getState(),be=ie.map(Re=>Re.code),ye=he.rooms,le=[...new Set([...ye,...be])];he.syncRooms(le);for(const Re of ie)!he.agentVisuals[Re.code]&&Re.agents&&Re.agents.length>0&&he.setAgents(Re.code,Re.agents.map(je=>({id:je.id,name:je.name,avatar:je.avatar,status:"idle"})))}})},[v]);const ue=ai(ie=>ie.rooms);return j.useEffect(()=>{for(const ie of ue)W(ie);return()=>{for(const ie of ue)Y(ie)}},[ue,W,Y]),j.useEffect(()=>(W("_expxagents"),()=>Y("_expxagents")),[W,Y]),j.useEffect(()=>{if(c)return W("_jarvis"),()=>Y("_jarvis")},[c,W,Y]),j.useEffect(()=>{t||r()},[]),j.useEffect(()=>{!n&&!t&&s("/login",{state:{from:l.pathname}})},[n,t,s,l.pathname]),c?_.jsx(cE,{}):_.jsxs("div",{className:"noise-bg",style:{display:"flex",flexDirection:"column",height:"100vh",background:"var(--surface-0)",color:"var(--text-primary)"},children:[_.jsxs("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"var(--header-height)",padding:"0 var(--sp-4)",background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)",position:"relative",zIndex:10},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[_.jsx("div",{style:{width:28,height:28,borderRadius:"var(--radius-sm)",background:"linear-gradient(135deg, var(--accent), var(--accent-dim))",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.8rem",fontWeight:700,color:"var(--text-inverse)",boxShadow:"0 0 12px var(--accent-glow-strong)"},children:"EX"}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"0.95rem",color:"var(--text-primary)",letterSpacing:"-0.02em"},children:"ExpxAgents"}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",background:"var(--surface-3)",padding:"2px 6px",borderRadius:"var(--radius-xs)",letterSpacing:"0.05em"},children:"MISSION CONTROL"})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-4)"},children:[_.jsx("button",{"data-testid":"btn-restart-server",onClick:async()=>{if(confirm("Restart the server? It will be briefly unavailable."))try{await fetch("/api/system/restart",{method:"POST",credentials:"include"})}catch{}},title:"Restart server",style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.7rem",padding:"3px 8px",borderRadius:"var(--radius-xs)",transition:"all var(--duration-fast) var(--ease-out)",display:"flex",alignItems:"center",gap:4},onMouseEnter:ie=>{ie.currentTarget.style.color="var(--accent)",ie.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:ie=>{ie.currentTarget.style.color="var(--text-muted)",ie.currentTarget.style.borderColor="var(--border-subtle)"},children:"↻ Restart"}),_.jsx("button",{"data-testid":"btn-toggle-theme",onClick:p,title:`Switch to ${f==="dark"?"light":"dark"} mode`,style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.85rem",padding:"3px 8px",borderRadius:"var(--radius-xs)",transition:"all var(--duration-fast) var(--ease-out)",display:"flex",alignItems:"center",gap:4,lineHeight:1},onMouseEnter:ie=>{ie.currentTarget.style.color="var(--accent)",ie.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:ie=>{ie.currentTarget.style.color="var(--text-muted)",ie.currentTarget.style.borderColor="var(--border-subtle)"},children:f==="dark"?"☀":"☽"}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-secondary)"},children:[_.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:"var(--status-active)",boxShadow:"0 0 8px var(--status-active-glow)",animation:"statusPulse 2s ease-in-out infinite"}}),_.jsx("span",{children:e==null?void 0:e.username})]}),_.jsx("button",{onClick:i,className:"btn-ghost",style:{background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-display)",fontSize:"0.75rem",padding:"4px 8px",borderRadius:"var(--radius-xs)",transition:"color var(--duration-fast) var(--ease-out)"},onMouseEnter:ie=>ie.currentTarget.style.color="var(--status-error)",onMouseLeave:ie=>ie.currentTarget.style.color="var(--text-muted)",children:"Logout"})]})]}),_.jsx(a4,{}),_.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[_.jsxs("aside",{style:{width:"var(--sidebar-width)",background:"var(--surface-1)",borderRight:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",overflowY:"auto"},children:[_.jsxs("nav",{style:{padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-1)",flex:1},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.1em",padding:"0 var(--sp-2)",marginBottom:"var(--sp-1)"},children:"Navigation"}),o4.map(ie=>_.jsxs(qC,{to:ie.to,style:({isActive:he})=>({display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"8px 10px",borderRadius:"var(--radius-sm)",textDecoration:"none",fontSize:"0.82rem",fontWeight:he?600:400,color:he?"var(--accent)":"var(--text-secondary)",background:he?"var(--accent-glow)":"transparent",border:he?"1px solid var(--accent-glow)":"1px solid transparent",transition:"all var(--duration-fast) var(--ease-out)"}),children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.85rem",width:20,textAlign:"center",opacity:.7},children:ie.icon}),ie.label]},ie.to)),_.jsx("div",{style:{height:1,margin:"var(--sp-2) var(--sp-2)",background:"var(--border-subtle)"}}),_.jsxs("a",{href:"/jarvis",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"8px 10px",borderRadius:"var(--radius-sm)",textDecoration:"none",fontSize:"0.82rem",fontWeight:500,color:"var(--status-active)",background:"var(--status-active-glow)",border:"1px solid var(--status-active-glow)",transition:"all var(--duration-fast) var(--ease-out)"},children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.85rem",width:20,textAlign:"center",opacity:.7},children:"◉"}),"Jarvis",_.jsx("span",{style:{marginLeft:"auto",fontFamily:"var(--font-mono)",fontSize:"0.55rem",opacity:.6},children:"↗"})]})]}),_.jsxs("div",{style:{padding:"var(--sp-3)",borderTop:"1px solid var(--border-subtle)",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",display:"flex",justifyContent:"space-between"},children:[_.jsxs("span",{children:[m.length," squad",m.length!==1?"s":""]}),_.jsx("span",{children:"v0.1.0"})]})]}),_.jsxs("main",{className:"grid-bg",style:{flex:1,overflow:"hidden",position:"relative"},children:[_.jsx(j.Suspense,{fallback:null,children:_.jsx(l4,{opacity:.4})}),_.jsx("div",{style:{position:"relative",zIndex:1,height:"100%",overflow:"auto"},children:_.jsx(cE,{})})]})]}),_.jsx(jD,{state:x})]})}const u4=j.lazy(()=>ou(()=>import("./ThreeBackground-ClAX-GgS.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ThreeBackground})));function d4(){var S;const[e,t]=j.useState(""),[n,i]=j.useState(""),r=gl(A=>A.login),s=gl(A=>A.loading),l=gl(A=>A.error),c=gl(A=>A.isAuthenticated),f=Z0(),m=((S=wl().state)==null?void 0:S.from)||"/";j.useEffect(()=>{c&&f(m,{replace:!0})},[c,f,m]);const g=A=>{A.preventDefault(),r(e,n)},x=C0(A=>A.theme),v=C0(A=>A.toggle);return _.jsxs("div",{className:"noise-bg",style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"var(--surface-0)",position:"relative",overflow:"hidden"},children:[_.jsx(j.Suspense,{fallback:null,children:_.jsx(u4,{opacity:.6})}),_.jsx("button",{onClick:v,title:`Switch to ${x==="dark"?"light":"dark"} mode`,style:{position:"absolute",top:16,right:16,zIndex:10,background:"var(--surface-2)",border:"1px solid var(--border-default)",color:"var(--text-secondary)",cursor:"pointer",fontSize:"1rem",padding:"6px 10px",borderRadius:"var(--radius-sm)",transition:"all var(--duration-fast) var(--ease-out)",lineHeight:1},children:x==="dark"?"☀":"☽"}),_.jsxs("div",{style:{animation:"fadeInUp 0.6s var(--ease-out) both",width:360,position:"relative",zIndex:1},children:[_.jsxs("div",{style:{textAlign:"center",marginBottom:"var(--sp-8)"},children:[_.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:48,height:48,borderRadius:"var(--radius-md)",background:"linear-gradient(135deg, var(--accent), var(--accent-dim))",fontSize:"1.1rem",fontWeight:800,color:"var(--text-inverse)",boxShadow:"var(--shadow-glow-strong)",marginBottom:"var(--sp-4)"},children:"EX"}),_.jsx("h1",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"1.4rem",color:"var(--text-primary)",letterSpacing:"-0.02em",marginBottom:"var(--sp-1)"},children:"ExpxAgents"}),_.jsx("p",{style:{fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.15em"},children:"Mission Control"})]}),_.jsxs("form",{onSubmit:g,className:"glass",style:{padding:"var(--sp-6)",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-lg)"},children:[l&&_.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3)",marginBottom:"var(--sp-4)",borderRadius:"var(--radius-sm)",background:"var(--status-error-glow)",border:"1px solid rgba(255, 64, 112, 0.2)",color:"var(--status-error)",fontSize:"0.8rem",fontFamily:"var(--font-mono)"},children:l}),_.jsxs("div",{style:{marginBottom:"var(--sp-3)"},children:[_.jsx("label",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"var(--sp-1)"},children:"Username"}),_.jsx("input",{type:"text",className:"input",placeholder:"Enter username",value:e,onChange:A=>t(A.target.value),autoFocus:!0})]}),_.jsxs("div",{style:{marginBottom:"var(--sp-5)"},children:[_.jsx("label",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"var(--sp-1)"},children:"Password"}),_.jsx("input",{type:"password",className:"input",placeholder:"Enter password",value:n,onChange:A=>i(A.target.value)})]}),_.jsx("button",{type:"submit",disabled:s,className:"btn btn-accent",style:{width:"100%",padding:"var(--sp-3)",fontSize:"0.85rem",cursor:s?"wait":"pointer",opacity:s?.7:1},children:s?"Authenticating...":"Access Mission Control"})]}),_.jsx("p",{style:{textAlign:"center",marginTop:"var(--sp-4)",fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)"},children:"AI Squad Orchestration Platform"})]})]})}function WC(e,t,n){if(!e)return;if(n(e)===!0)return e;let i=e.child;for(;i;){const r=WC(i,t,n);if(r)return r;i=i.sibling}}function QC(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Q1=QC(j.createContext(null));let ZC=class extends j.Component{render(){return j.createElement(Q1.Provider,{value:this._reactInternals},this.props.children)}};function f4(){const e=j.useContext(Q1);if(e===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const t=j.useId();return j.useMemo(()=>{for(const n of[e,e==null?void 0:e.alternate]){if(!n)continue;const i=WC(n,!1,r=>{let s=r.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}});if(i)return i}},[e,t])}const h4=Symbol.for("react.context"),p4=e=>e!==null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===h4;function m4(){const e=f4(),[t]=j.useState(()=>new Map);t.clear();let n=e;for(;n;){const i=n.type;p4(i)&&i!==Q1&&!t.has(i)&&t.set(i,j.use(QC(i))),n=n.return}return t}function g4(){const e=m4();return j.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>i=>j.createElement(t,null,j.createElement(n.Provider,{...i,value:e.get(n)})),t=>j.createElement(ZC,{...t})),[e])}var kt=(e=>(e.Application="application",e.WebGLPipes="webgl-pipes",e.WebGLPipesAdaptor="webgl-pipes-adaptor",e.WebGLSystem="webgl-system",e.WebGPUPipes="webgpu-pipes",e.WebGPUPipesAdaptor="webgpu-pipes-adaptor",e.WebGPUSystem="webgpu-system",e.CanvasSystem="canvas-system",e.CanvasPipesAdaptor="canvas-pipes-adaptor",e.CanvasPipes="canvas-pipes",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e.MaskEffect="mask-effect",e.BlendMode="blend-mode",e.TextureSource="texture-source",e.Environment="environment",e.ShapeBuilder="shape-builder",e.Batcher="batcher",e))(kt||{});const Yv=e=>{if(typeof e=="function"||typeof e=="object"&&e.extension){if(!e.extension)throw new Error("Extension class must have an extension object");e={...typeof e.extension!="object"?{type:e.extension}:e.extension,ref:e}}if(typeof e=="object")e={...e};else throw new Error("Invalid extension type");return typeof e.type=="string"&&(e.type=[e.type]),e},ky=(e,t)=>Yv(e).priority??t,li={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(Yv).forEach(t=>{t.type.forEach(n=>{var i,r;return(r=(i=this._removeHandlers)[n])==null?void 0:r.call(i,t)})}),this},add(...e){return e.map(Yv).forEach(t=>{t.type.forEach(n=>{var s,l;const i=this._addHandlers,r=this._queue;i[n]?(l=i[n])==null||l.call(i,t):(r[n]=r[n]||[],(s=r[n])==null||s.push(t))})}),this},handle(e,t,n){var l;const i=this._addHandlers,r=this._removeHandlers;if(i[e]||r[e])throw new Error(`Extension type ${e} already has a handler`);i[e]=t,r[e]=n;const s=this._queue;return s[e]&&((l=s[e])==null||l.forEach(c=>t(c)),delete s[e]),this},handleByMap(e,t){return this.handle(e,n=>{n.name&&(t[n.name]=n.ref)},n=>{n.name&&delete t[n.name]})},handleByNamedList(e,t,n=-1){return this.handle(e,i=>{t.findIndex(s=>s.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((s,l)=>ky(l.value,n)-ky(s.value,n)))},i=>{const r=t.findIndex(s=>s.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(e,t,n=-1){return this.handle(e,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,s)=>ky(s,n)-ky(r,n)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})},mixin(e,...t){for(const n of t)Object.defineProperties(e.prototype,Object.getOwnPropertyDescriptors(n))}},y4={extension:{type:kt.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await ou(()=>import("./browserAll-BJZ9_U0C.js"),__vite__mapDeps([2,3]))}},x4={extension:{type:kt.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await ou(()=>import("./webworkerAll-BOQTv0Mj.js"),[])}};class br{constructor(t,n,i){this._x=n||0,this._y=i||0,this._observer=t}clone(t){return new br(t??this._observer,this._x,this._y)}set(t=0,n=t){return(this._x!==t||this._y!==n)&&(this._x=t,this._y=n,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}var yb={exports:{}},TE;function b4(){return TE||(TE=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(n=!1));function r(f,p,m){this.fn=f,this.context=p,this.once=m||!1}function s(f,p,m,g,x){if(typeof m!="function")throw new TypeError("The listener must be a function");var v=new r(m,g||f,x),S=n?n+p:p;return f._events[S]?f._events[S].fn?f._events[S]=[f._events[S],v]:f._events[S].push(v):(f._events[S]=v,f._eventsCount++),f}function l(f,p){--f._eventsCount===0?f._events=new i:delete f._events[p]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var p=[],m,g;if(this._eventsCount===0)return p;for(g in m=this._events)t.call(m,g)&&p.push(n?g.slice(1):g);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(m)):p},c.prototype.listeners=function(p){var m=n?n+p:p,g=this._events[m];if(!g)return[];if(g.fn)return[g.fn];for(var x=0,v=g.length,S=new Array(v);x<v;x++)S[x]=g[x].fn;return S},c.prototype.listenerCount=function(p){var m=n?n+p:p,g=this._events[m];return g?g.fn?1:g.length:0},c.prototype.emit=function(p,m,g,x,v,S){var A=n?n+p:p;if(!this._events[A])return!1;var T=this._events[A],C=arguments.length,N,R;if(T.fn){switch(T.once&&this.removeListener(p,T.fn,void 0,!0),C){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,m),!0;case 3:return T.fn.call(T.context,m,g),!0;case 4:return T.fn.call(T.context,m,g,x),!0;case 5:return T.fn.call(T.context,m,g,x,v),!0;case 6:return T.fn.call(T.context,m,g,x,v,S),!0}for(R=1,N=new Array(C-1);R<C;R++)N[R-1]=arguments[R];T.fn.apply(T.context,N)}else{var D=T.length,H;for(R=0;R<D;R++)switch(T[R].once&&this.removeListener(p,T[R].fn,void 0,!0),C){case 1:T[R].fn.call(T[R].context);break;case 2:T[R].fn.call(T[R].context,m);break;case 3:T[R].fn.call(T[R].context,m,g);break;case 4:T[R].fn.call(T[R].context,m,g,x);break;default:if(!N)for(H=1,N=new Array(C-1);H<C;H++)N[H-1]=arguments[H];T[R].fn.apply(T[R].context,N)}}return!0},c.prototype.on=function(p,m,g){return s(this,p,m,g,!1)},c.prototype.once=function(p,m,g){return s(this,p,m,g,!0)},c.prototype.removeListener=function(p,m,g,x){var v=n?n+p:p;if(!this._events[v])return this;if(!m)return l(this,v),this;var S=this._events[v];if(S.fn)S.fn===m&&(!x||S.once)&&(!g||S.context===g)&&l(this,v);else{for(var A=0,T=[],C=S.length;A<C;A++)(S[A].fn!==m||x&&!S[A].once||g&&S[A].context!==g)&&T.push(S[A]);T.length?this._events[v]=T.length===1?T[0]:T:l(this,v)}return this},c.prototype.removeAllListeners=function(p){var m;return p?(m=n?n+p:p,this._events[m]&&l(this,m)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(yb)),yb.exports}var v4=b4();const yo=du(v4),_4=Math.PI*2,S4=180/Math.PI,E4=Math.PI/180;class Lr{constructor(t=0,n=0){this.x=0,this.y=0,this.x=t,this.y=n}clone(){return new Lr(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,n=t){return this.x=t,this.y=n,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return xb.x=0,xb.y=0,xb}}const xb=new Lr;class Ht{constructor(t=1,n=0,i=0,r=1,s=0,l=0){this.array=null,this.a=t,this.b=n,this.c=i,this.d=r,this.tx=s,this.ty=l}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,n,i,r,s,l){return this.a=t,this.b=n,this.c=i,this.d=r,this.tx=s,this.ty=l,this}toArray(t,n){this.array||(this.array=new Float32Array(9));const i=n||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,n){n=n||new Lr;const i=t.x,r=t.y;return n.x=this.a*i+this.c*r+this.tx,n.y=this.b*i+this.d*r+this.ty,n}applyInverse(t,n){n=n||new Lr;const i=this.a,r=this.b,s=this.c,l=this.d,c=this.tx,f=this.ty,p=1/(i*l+s*-r),m=t.x,g=t.y;return n.x=l*p*m+-s*p*g+(f*s-c*l)*p,n.y=i*p*g+-r*p*m+(-f*i+c*r)*p,n}translate(t,n){return this.tx+=t,this.ty+=n,this}scale(t,n){return this.a*=t,this.d*=n,this.c*=t,this.b*=n,this.tx*=t,this.ty*=n,this}rotate(t){const n=Math.cos(t),i=Math.sin(t),r=this.a,s=this.c,l=this.tx;return this.a=r*n-this.b*i,this.b=r*i+this.b*n,this.c=s*n-this.d*i,this.d=s*i+this.d*n,this.tx=l*n-this.ty*i,this.ty=l*i+this.ty*n,this}append(t){const n=this.a,i=this.b,r=this.c,s=this.d;return this.a=t.a*n+t.b*r,this.b=t.a*i+t.b*s,this.c=t.c*n+t.d*r,this.d=t.c*i+t.d*s,this.tx=t.tx*n+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this}appendFrom(t,n){const i=t.a,r=t.b,s=t.c,l=t.d,c=t.tx,f=t.ty,p=n.a,m=n.b,g=n.c,x=n.d;return this.a=i*p+r*g,this.b=i*m+r*x,this.c=s*p+l*g,this.d=s*m+l*x,this.tx=c*p+f*g+n.tx,this.ty=c*m+f*x+n.ty,this}setTransform(t,n,i,r,s,l,c,f,p){return this.a=Math.cos(c+p)*s,this.b=Math.sin(c+p)*s,this.c=-Math.sin(c-f)*l,this.d=Math.cos(c-f)*l,this.tx=t-(i*this.a+r*this.c),this.ty=n-(i*this.b+r*this.d),this}prepend(t){const n=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=n*t.a+this.ty*t.c+t.tx,this.ty=n*t.b+this.ty*t.d+t.ty,this}decompose(t){const n=this.a,i=this.b,r=this.c,s=this.d,l=t.pivot,c=-Math.atan2(-r,s),f=Math.atan2(i,n),p=Math.abs(c+f);return p<1e-5||Math.abs(_4-p)<1e-5?(t.rotation=f,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=f),t.scale.x=Math.sqrt(n*n+i*i),t.scale.y=Math.sqrt(r*r+s*s),t.position.x=this.tx+(l.x*n+l.y*r),t.position.y=this.ty+(l.x*i+l.y*s),t}invert(){const t=this.a,n=this.b,i=this.c,r=this.d,s=this.tx,l=t*r-n*i;return this.a=r/l,this.b=-n/l,this.c=-i/l,this.d=t/l,this.tx=(i*this.ty-r*s)/l,this.ty=-(t*this.ty-n*s)/l,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new Ht;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return T4.identity()}static get shared(){return w4.identity()}}const w4=new Ht,T4=new Ht,od=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],cd=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ud=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],dd=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Vv=[],JC=[],Ny=Math.sign;function C4(){for(let e=0;e<16;e++){const t=[];Vv.push(t);for(let n=0;n<16;n++){const i=Ny(od[e]*od[n]+ud[e]*cd[n]),r=Ny(cd[e]*od[n]+dd[e]*cd[n]),s=Ny(od[e]*ud[n]+ud[e]*dd[n]),l=Ny(cd[e]*ud[n]+dd[e]*dd[n]);for(let c=0;c<16;c++)if(od[c]===i&&cd[c]===r&&ud[c]===s&&dd[c]===l){t.push(c);break}}}for(let e=0;e<16;e++){const t=new Ht;t.set(od[e],cd[e],ud[e],dd[e],0,0),JC.push(t)}}C4();const Bn={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:e=>od[e],uY:e=>cd[e],vX:e=>ud[e],vY:e=>dd[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Vv[e][t],sub:(e,t)=>Vv[e][Bn.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)===2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?Bn.S:Bn.N:Math.abs(t)*2<=Math.abs(e)?e>0?Bn.E:Bn.W:t>0?e>0?Bn.SE:Bn.SW:e>0?Bn.NE:Bn.NW,matrixAppendRotationInv:(e,t,n=0,i=0,r=0,s=0)=>{const l=JC[Bn.inv(t)],c=l.a,f=l.b,p=l.c,m=l.d,g=n-Math.min(0,c*r,p*s,c*r+p*s),x=i-Math.min(0,f*r,m*s,f*r+m*s),v=e.a,S=e.b,A=e.c,T=e.d;e.a=c*v+f*A,e.b=c*S+f*T,e.c=p*v+m*A,e.d=p*S+m*T,e.tx=g*v+x*A+e.tx,e.ty=g*S+x*T+e.ty},transformRectCoords:(e,t,n,i)=>{const{x:r,y:s,width:l,height:c}=e,{x:f,y:p,width:m,height:g}=t;return n===Bn.E?(i.set(r+f,s+p,l,c),i):n===Bn.S?i.set(m-s-c+f,r+p,c,l):n===Bn.W?i.set(m-r-l+f,g-s-c+p,l,c):n===Bn.N?i.set(s+f,g-r-l+p,c,l):i.set(r+f,s+p,l,c)}},Oy=[new Lr,new Lr,new Lr,new Lr];class Ti{constructor(t=0,n=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(n),this.width=Number(i),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Ti(0,0,0,0)}clone(){return new Ti(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,n){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&n>=this.y&&n<this.y+this.height}strokeContains(t,n,i,r=.5){const{width:s,height:l}=this;if(s<=0||l<=0)return!1;const c=this.x,f=this.y,p=i*(1-r),m=i-p,g=c-p,x=c+s+p,v=f-p,S=f+l+p,A=c+m,T=c+s-m,C=f+m,N=f+l-m;return t>=g&&t<=x&&n>=v&&n<=S&&!(t>A&&t<T&&n>C&&n<N)}intersects(t,n){if(!n){const Z=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=Z)return!1;const F=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>F}const i=this.left,r=this.right,s=this.top,l=this.bottom;if(r<=i||l<=s)return!1;const c=Oy[0].set(t.left,t.top),f=Oy[1].set(t.left,t.bottom),p=Oy[2].set(t.right,t.top),m=Oy[3].set(t.right,t.bottom);if(p.x<=c.x||f.y<=c.y)return!1;const g=Math.sign(n.a*n.d-n.b*n.c);if(g===0||(n.apply(c,c),n.apply(f,f),n.apply(p,p),n.apply(m,m),Math.max(c.x,f.x,p.x,m.x)<=i||Math.min(c.x,f.x,p.x,m.x)>=r||Math.max(c.y,f.y,p.y,m.y)<=s||Math.min(c.y,f.y,p.y,m.y)>=l))return!1;const x=g*(f.y-c.y),v=g*(c.x-f.x),S=x*i+v*s,A=x*r+v*s,T=x*i+v*l,C=x*r+v*l;if(Math.max(S,A,T,C)<=x*c.x+v*c.y||Math.min(S,A,T,C)>=x*m.x+v*m.y)return!1;const N=g*(c.y-p.y),R=g*(p.x-c.x),D=N*i+R*s,H=N*r+R*s,O=N*i+R*l,q=N*r+R*l;return!(Math.max(D,H,O,q)<=N*c.x+R*c.y||Math.min(D,H,O,q)>=N*m.x+R*m.y)}pad(t=0,n=t){return this.x-=t,this.y-=n,this.width+=t*2,this.height+=n*2,this}fit(t){const n=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=n,this.width=Math.max(i-n,0),this.y=r,this.height=Math.max(s-r,0),this}ceil(t=1,n=.001){const i=Math.ceil((this.x+this.width-n)*t)/t,r=Math.ceil((this.y+this.height-n)*t)/t;return this.x=Math.floor((this.x+n)*t)/t,this.y=Math.floor((this.y+n)*t)/t,this.width=i-this.x,this.height=r-this.y,this}scale(t,n=t){return this.x*=t,this.y*=n,this.width*=t,this.height*=n,this}enlarge(t){const n=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=n,this.width=i-n,this.y=r,this.height=s-r,this}getBounds(t){return t||(t=new Ti),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const n=t.x,i=t.y,r=t.x+t.width,s=t.y+t.height;return n>=this.x&&n<this.x+this.width&&i>=this.y&&i<this.y+this.height&&r>=this.x&&r<this.x+this.width&&s>=this.y&&s<this.y+this.height}set(t,n,i,r){return this.x=t,this.y=n,this.width=i,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const bb={default:-1};function bi(e="default"){return bb[e]===void 0&&(bb[e]=-1),++bb[e]}const CE=new Set,xi="8.0.0",A4="8.3.4",$f={quiet:!1,noColor:!1},en=((e,t,n=3)=>{if($f.quiet||CE.has(t))return;let i=new Error().stack;const r=`${t}
61
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let m=wl(),g;if(t){let C=typeof t=="string"?_h(t):t;Wn(f==="/"||((T=C.pathname)==null?void 0:T.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=m;let x=g.pathname||"/",v=x;if(f!=="/"){let C=f.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=AC(e,{pathname:v});_l(p||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),_l(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=P3(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:po([f,i.encodeLocation?i.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:po([f,i.encodeLocation?i.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),r,n);return t&&A?j.createElement($m.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},A):A}function j3(){let e=V3(),t=S3(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=j.createElement(j.Fragment,null,j.createElement("p",null,"💿 Hey developer 👋"),j.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",j.createElement("code",{style:s},"ErrorBoundary")," or"," ",j.createElement("code",{style:s},"errorElement")," prop on your route.")),j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:r},n):null,l)}var I3=j.createElement(j3,null),IC=class extends j.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=N3(e.digest);n&&(e=n)}let t=e!==void 0?j.createElement(El.Provider,{value:this.props.routeContext},j.createElement(V1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?j.createElement(U3,{error:e},t):t}};IC.contextType=T3;var hb=new WeakMap;function U3({children:e,error:t}){let{basename:n}=j.useContext(ss);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=k3(t.digest);if(i){let r=hb.get(t);if(r)throw r;let s=NC(i.location,n);if(kC&&!hb.get(t))if(s.isExternal||i.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:i.replace}));throw hb.set(t,l),l}return j.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function H3({routeContext:e,match:t,children:n}){let i=j.useContext(Sh);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),j.createElement(El.Provider,{value:e},n)}function P3(e,t=[],n){let i=n==null?void 0:n.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let r=e,s=i==null?void 0:i.errors;if(s!=null){let m=r.findIndex(g=>g.route.id&&(s==null?void 0:s[g.route.id])!==void 0);Wn(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),r=r.slice(0,Math.min(r.length,m+1))}let l=!1,c=-1;if(n&&i){l=i.renderFallback;for(let m=0;m<r.length;m++){let g=r[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=m),g.route.id){let{loaderData:x,errors:v}=i,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||S){n.isStatic&&(l=!0),c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}}let f=n==null?void 0:n.onError,p=i&&f?(m,g)=>{var x,v;f(m,{location:i.location,params:((v=(x=i.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:E3(i.matches),errorInfo:g})}:void 0;return r.reduceRight((m,g,x)=>{let v,S=!1,A=null,T=null;i&&(v=s&&g.route.id?s[g.route.id]:void 0,A=g.route.errorElement||I3,l&&(c<0&&x===0?(UC("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,T=null):c===x&&(S=!0,T=g.route.hydrateFallbackElement||null)));let C=t.concat(r.slice(0,x+1)),N=()=>{let R;return v?R=A:S?R=T:g.route.Component?R=j.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=m,j.createElement(H3,{match:g,routeContext:{outlet:m,matches:C,isDataRoute:i!=null},children:R})};return i&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?j.createElement(IC,{location:i.location,revalidation:i.revalidation,component:A,error:v,children:N(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:p}):N()},null)}function X1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function F3(e){let t=j.useContext(Sh);return Wn(t,X1(e)),t}function G3(e){let t=j.useContext(Q0);return Wn(t,X1(e)),t}function q3(e){let t=j.useContext(El);return Wn(t,X1(e)),t}function K1(e){let t=q3(e),n=t.matches[t.matches.length-1];return Wn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Y3(){return K1("useRouteId")}function V3(){var i;let e=j.useContext(V1),t=G3("useRouteError"),n=K1("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[n]}function X3(){let{router:e}=F3("useNavigate"),t=K1("useNavigate"),n=j.useRef(!1);return LC(()=>{n.current=!0}),j.useCallback(async(r,s={})=>{_l(n.current,BC),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...s}))},[e,t])}var oE={};function UC(e,t,n){!t&&!oE[e]&&(oE[e]=!0,_l(!1,n))}j.memo(K3);function K3({routes:e,future:t,state:n,isStatic:i,onError:r}){return jC(e,void 0,{state:n,isStatic:i,onError:r})}function $3({to:e,replace:t,state:n,relative:i}){Wn(Eh(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=j.useContext(ss);_l(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=j.useContext(El),{pathname:l}=wl(),c=Z0(),f=W0(e,Y1(s),l,i==="path"),p=JSON.stringify(f);return j.useEffect(()=>{c(JSON.parse(p),{replace:t,state:n,relative:i})},[c,p,i,t,n]),null}function cE(e){return B3(e.context)}function ca(e){Wn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function W3({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:s=!1,unstable_useTransitions:l}){Wn(!Eh(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),f=j.useMemo(()=>({basename:c,navigator:r,static:s,unstable_useTransitions:l,future:{}}),[c,r,s,l]);typeof n=="string"&&(n=_h(n));let{pathname:p="/",search:m="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=n,A=j.useMemo(()=>{let T=sc(p,c);return T==null?null:{location:{pathname:T,search:m,hash:g,state:x,key:v,unstable_mask:S},navigationType:i}},[c,p,m,g,x,v,i,S]);return _l(A!=null,`<Router basename="${c}"> is not able to match the URL "${p}${m}${g}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:j.createElement(ss.Provider,{value:f},j.createElement($m.Provider,{children:t,value:A}))}function Q3({children:e,location:t}){return L3(Hv(e),t)}function Hv(e,t=[]){let n=[];return j.Children.forEach(e,(i,r)=>{if(!j.isValidElement(i))return;let s=[...t,r];if(i.type===j.Fragment){n.push.apply(n,Hv(i.props.children,s));return}Wn(i.type===ca,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Wn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let l={id:i.props.id||s.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(l.children=Hv(i.props.children,s)),n.push(l)}),n}var h0="get",p0="application/x-www-form-urlencoded";function J0(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Z3(e){return J0(e)&&e.tagName.toLowerCase()==="button"}function J3(e){return J0(e)&&e.tagName.toLowerCase()==="form"}function eD(e){return J0(e)&&e.tagName.toLowerCase()==="input"}function tD(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function nD(e,t){return e.button===0&&(!t||t==="_self")&&!tD(e)}var Ay=null;function iD(){if(Ay===null)try{new FormData(document.createElement("form"),0),Ay=!1}catch{Ay=!0}return Ay}var rD=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pb(e){return e!=null&&!rD.has(e)?(_l(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${p0}"`),null):e}function aD(e,t){let n,i,r,s,l;if(J3(e)){let c=e.getAttribute("action");i=c?sc(c,t):null,n=e.getAttribute("method")||h0,r=pb(e.getAttribute("enctype"))||p0,s=new FormData(e)}else if(Z3(e)||eD(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(i=f?sc(f,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||h0,r=pb(e.getAttribute("formenctype"))||pb(c.getAttribute("enctype"))||p0,s=new FormData(c,e),!iD()){let{name:p,type:m,value:g}=e;if(m==="image"){let x=p?`${p}.`:"";s.append(`${x}x`,"0"),s.append(`${x}y`,"0")}else p&&s.append(p,g)}}else{if(J0(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=h0,i=null,r=p0,l=e}return s&&r==="text/plain"&&(l=s,s=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:s,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function $1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sD(e,t,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:t&&sc(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function lD(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function oD(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function cD(e,t,n){let i=await Promise.all(e.map(async r=>{let s=t.routes[r.route.id];if(s){let l=await lD(s,n);return l.links?l.links():[]}return[]}));return hD(i.flat(1).filter(oD).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function uE(e,t,n,i,r,s){let l=(f,p)=>n[p]?f.route.id!==n[p].route.id:!0,c=(f,p)=>{var m;return n[p].pathname!==f.pathname||((m=n[p].route.path)==null?void 0:m.endsWith("*"))&&n[p].params["*"]!==f.params["*"]};return s==="assets"?t.filter((f,p)=>l(f,p)||c(f,p)):s==="data"?t.filter((f,p)=>{var g;let m=i.routes[f.route.id];if(!m||!m.hasLoader)return!1;if(l(f,p)||c(f,p))return!0;if(f.route.shouldRevalidate){let x=f.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function uD(e,t,{includeHydrateFallback:n}={}){return dD(e.map(i=>{let r=t.routes[i.route.id];if(!r)return[];let s=[r.module];return r.clientActionModule&&(s=s.concat(r.clientActionModule)),r.clientLoaderModule&&(s=s.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(s=s.concat(r.hydrateFallbackModule)),r.imports&&(s=s.concat(r.imports)),s}).flat(1))}function dD(e){return[...new Set(e)]}function fD(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function hD(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let s=JSON.stringify(fD(r));return n.has(s)||(n.add(s),i.push({key:s,link:r})),i},[])}function HC(){let e=j.useContext(Sh);return $1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function pD(){let e=j.useContext(Q0);return $1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var W1=j.createContext(void 0);W1.displayName="FrameworkContext";function PC(){let e=j.useContext(W1);return $1(e,"You must render this element inside a <HydratedRouter> element"),e}function mD(e,t){let n=j.useContext(W1),[i,r]=j.useState(!1),[s,l]=j.useState(!1),{onFocus:c,onBlur:f,onMouseEnter:p,onMouseLeave:m,onTouchStart:g}=t,x=j.useRef(null);j.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let A=C=>{C.forEach(N=>{l(N.isIntersecting)})},T=new IntersectionObserver(A,{threshold:.5});return x.current&&T.observe(x.current),()=>{T.disconnect()}}},[e]),j.useEffect(()=>{if(i){let A=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(A)}}},[i]);let v=()=>{r(!0)},S=()=>{r(!1),l(!1)};return n?e!=="intent"?[s,x,{}]:[s,x,{onFocus:$p(c,v),onBlur:$p(f,S),onMouseEnter:$p(p,v),onMouseLeave:$p(m,S),onTouchStart:$p(g,v)}]:[!1,x,{}]}function $p(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function gD({page:e,...t}){let{router:n}=HC(),i=j.useMemo(()=>AC(n.routes,e,n.basename),[n.routes,e,n.basename]);return i?j.createElement(xD,{page:e,matches:i,...t}):null}function yD(e){let{manifest:t,routeModules:n}=PC(),[i,r]=j.useState([]);return j.useEffect(()=>{let s=!1;return cD(e,t,n).then(l=>{s||r(l)}),()=>{s=!0}},[e,t,n]),i}function xD({page:e,matches:t,...n}){let i=wl(),{future:r,manifest:s,routeModules:l}=PC(),{basename:c}=HC(),{loaderData:f,matches:p}=pD(),m=j.useMemo(()=>uE(e,t,p,s,i,"data"),[e,t,p,s,i]),g=j.useMemo(()=>uE(e,t,p,s,i,"assets"),[e,t,p,s,i]),x=j.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let A=new Set,T=!1;if(t.forEach(N=>{var D;let R=s.routes[N.route.id];!R||!R.hasLoader||(!m.some(H=>H.route.id===N.route.id)&&N.route.id in f&&((D=l[N.route.id])!=null&&D.shouldRevalidate)||R.hasClientLoader?T=!0:A.add(N.route.id))}),A.size===0)return[];let C=sD(e,c,r.unstable_trailingSlashAwareDataRequests,"data");return T&&A.size>0&&C.searchParams.set("_routes",t.filter(N=>A.has(N.route.id)).map(N=>N.route.id).join(",")),[C.pathname+C.search]},[c,r.unstable_trailingSlashAwareDataRequests,f,i,s,m,t,e,l]),v=j.useMemo(()=>uD(g,s),[g,s]),S=yD(g);return j.createElement(j.Fragment,null,x.map(A=>j.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...n})),v.map(A=>j.createElement("link",{key:A,rel:"modulepreload",href:A,...n})),S.map(({key:A,link:T})=>j.createElement("link",{key:A,nonce:n.nonce,...T,crossOrigin:T.crossOrigin??n.crossOrigin})))}function bD(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var vD=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{vD&&(window.__reactRouterVersion="7.13.1")}catch{}function _D({basename:e,children:t,unstable_useTransitions:n,window:i}){let r=j.useRef();r.current==null&&(r.current=ZO({window:i,v5Compat:!0}));let s=r.current,[l,c]=j.useState({action:s.action,location:s.location}),f=j.useCallback(p=>{n===!1?c(p):j.startTransition(()=>c(p))},[n]);return j.useLayoutEffect(()=>s.listen(f),[s,f]),j.createElement(W3,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:s,unstable_useTransitions:n})}var FC=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,GC=j.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:s,replace:l,unstable_mask:c,state:f,target:p,to:m,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},A){let{basename:T,navigator:C,unstable_useTransitions:N}=j.useContext(ss),R=typeof m=="string"&&FC.test(m),D=NC(m,T);m=D.to;let H=O3(m,{relative:r}),O=wl(),q=null;if(c){let K=W0(c,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);T!=="/"&&(K.pathname=K.pathname==="/"?T:po([T,K.pathname])),q=C.createHref(K)}let[Z,I,F]=mD(i,S),U=wD(m,{replace:l,unstable_mask:c,state:f,target:p,preventScrollReset:g,relative:r,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:N});function L(K){t&&t(K),K.defaultPrevented||U(K)}let J=!(D.isExternal||s),G=j.createElement("a",{...S,...F,href:(J?q:void 0)||D.absoluteURL||H,onClick:J?L:t,ref:bD(A,I),target:p,"data-discover":!R&&n==="render"?"true":void 0});return Z&&!R?j.createElement(j.Fragment,null,G,j.createElement(gD,{page:H})):G});GC.displayName="Link";var qC=j.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:s,to:l,viewTransition:c,children:f,...p},m){let g=Wm(l,{relative:p.relative}),x=wl(),v=j.useContext(Q0),{navigator:S,basename:A}=j.useContext(ss),T=v!=null&&RD(g)&&c===!0,C=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,N=x.pathname,R=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(N=N.toLowerCase(),R=R?R.toLowerCase():null,C=C.toLowerCase()),R&&A&&(R=sc(R,A)||R);const D=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let H=N===C||!r&&N.startsWith(C)&&N.charAt(D)==="/",O=R!=null&&(R===C||!r&&R.startsWith(C)&&R.charAt(C.length)==="/"),q={isActive:H,isPending:O,isTransitioning:T},Z=H?t:void 0,I;typeof i=="function"?I=i(q):I=[i,H?"active":null,O?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let F=typeof s=="function"?s(q):s;return j.createElement(GC,{...p,"aria-current":Z,className:I,ref:m,style:F,to:l,viewTransition:c},typeof f=="function"?f(q):f)});qC.displayName="NavLink";var SD=j.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:s,method:l=h0,action:c,onSubmit:f,relative:p,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:A}=j.useContext(ss),T=AD(),C=MD(c,{relative:p}),N=l.toLowerCase()==="get"?"get":"post",R=typeof c=="string"&&FC.test(c),D=H=>{if(f&&f(H),H.defaultPrevented)return;H.preventDefault();let O=H.nativeEvent.submitter,q=(O==null?void 0:O.getAttribute("formmethod"))||l,Z=()=>T(O||H.currentTarget,{fetcherKey:t,method:q,navigate:n,replace:r,state:s,relative:p,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:x});A&&n!==!1?j.startTransition(()=>Z()):Z()};return j.createElement("form",{ref:S,method:N,action:C,onSubmit:i?f:D,...v,"data-discover":!R&&e==="render"?"true":void 0})});SD.displayName="Form";function ED(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YC(e){let t=j.useContext(Sh);return Wn(t,ED(e)),t}function wD(e,{target:t,replace:n,unstable_mask:i,state:r,preventScrollReset:s,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:f,unstable_useTransitions:p}={}){let m=Z0(),g=wl(),x=Wm(e,{relative:l});return j.useCallback(v=>{if(nD(v,t)){v.preventDefault();let S=n!==void 0?n:km(g)===km(x),A=()=>m(e,{replace:S,unstable_mask:i,state:r,preventScrollReset:s,relative:l,viewTransition:c,unstable_defaultShouldRevalidate:f});p?j.startTransition(()=>A()):A()}},[g,m,x,n,i,r,t,e,s,l,c,f,p])}var TD=0,CD=()=>`__${String(++TD)}__`;function AD(){let{router:e}=YC("useSubmit"),{basename:t}=j.useContext(ss),n=Y3(),i=e.fetch,r=e.navigate;return j.useCallback(async(s,l={})=>{let{action:c,method:f,encType:p,formData:m,body:g}=aD(s,t);if(l.navigate===!1){let x=l.fetcherKey||CD();await i(x,n,l.action||c,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:g,formMethod:l.method||f,formEncType:l.encType||p,flushSync:l.flushSync})}else await r(l.action||c,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:g,formMethod:l.method||f,formEncType:l.encType||p,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[i,r,t,n])}function MD(e,{relative:t}={}){let{basename:n}=j.useContext(ss),i=j.useContext(El);Wn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),s={...Wm(e||".",{relative:t})},l=wl();if(e==null){s.search=l.search;let c=new URLSearchParams(s.search),f=c.getAll("index");if(f.some(m=>m==="")){c.delete("index"),f.filter(g=>g).forEach(g=>c.append("index",g));let m=c.toString();s.search=m?`?${m}`:""}}return(!e||e===".")&&r.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:po([n,s.pathname])),km(s)}function RD(e,{relative:t}={}){let n=j.useContext(DC);Wn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=YC("useViewTransitionState"),r=Wm(e,{relative:t});if(!n.isTransitioning)return!1;let s=sc(n.currentLocation.pathname,i)||n.currentLocation.pathname,l=sc(n.nextLocation.pathname,i)||n.nextLocation.pathname;return w0(r.pathname,l)!=null||w0(r.pathname,s)!=null}CC();const dE=e=>{let t;const n=new Set,i=(p,m)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const x=t;t=m??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(v=>v(t,x))}},r=()=>t,c={setState:i,getState:r,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(i,r,c);return c},kD=(e=>e?dE(e):dE),ND=e=>e;function OD(e,t=ND){const n=fm.useSyncExternalStore(e.subscribe,fm.useCallback(()=>t(e.getState()),[e,t]),fm.useCallback(()=>t(e.getInitialState()),[e,t]));return fm.useDebugValue(n),n}const fE=e=>{const t=kD(e),n=i=>OD(t,i);return Object.assign(n,t),n},fu=(e=>e?fE(e):fE),gl=fu(e=>({user:null,isAuthenticated:!1,loading:!1,error:null,login:async(t,n)=>{e({loading:!0,error:null});try{const i=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:n}),credentials:"include"}),r=await i.json();if(!i.ok){e({loading:!1,error:r.error||"Login failed"});return}e({user:r.user,isAuthenticated:!0,loading:!1,error:null})}catch{e({loading:!1,error:"Network error"})}},logout:async()=>{try{await fetch("/api/auth/logout",{method:"POST",credentials:"include"})}catch{}e({user:null,isAuthenticated:!1,error:null})},checkAuth:async()=>{e({loading:!0});try{const t=await fetch("/api/auth/me",{credentials:"include"});if(t.ok){const n=await t.json();e({user:n.user,isAuthenticated:!0,loading:!1})}else e({user:null,isAuthenticated:!1,loading:!1})}catch{e({user:null,isAuthenticated:!1,loading:!1})}},reset:()=>e({user:null,isAuthenticated:!1,loading:!1,error:null})})),vr=fu((e,t)=>({squads:[],selectedSquad:null,activeStates:{},uiComponents:{},fetchSquads:async()=>{try{const n=await fetch("/api/squads",{credentials:"include"});if(n.ok){const i=await n.json();e({squads:i.squads})}}catch{}},selectSquad:n=>e({selectedSquad:n}),setSquadState:(n,i)=>e(r=>({activeStates:{...r.activeStates,[n]:i}})),clearSquadState:n=>e(i=>{const{[n]:r,...s}=i.activeStates;return{activeStates:s}}),setUiComponents:(n,i)=>e(r=>({uiComponents:{...r.uiComponents,[n]:i}})),reset:()=>e({squads:[],selectedSquad:null,activeStates:{},uiComponents:{}})}));let DD=0;function hE(){return`local-${Date.now()}-${++DD}`}const rr=fu((e,t)=>({conversations:[],messages:[],conversationId:null,streaming:!1,streamingText:"",activity:null,error:null,addUserMessage:n=>{const i={id:hE(),role:"user",content:n,createdAt:new Date().toISOString()};e(r=>{const s=r.conversationId,l=s&&!r.messages.some(c=>c.role==="user")?r.conversations.map(c=>c.id===s?{...c,preview:n.slice(0,80)}:c):r.conversations;return{messages:[...r.messages,i],error:null,conversations:l}})},setConversationId:n=>{e({conversationId:n})},startStreaming:()=>{e({streaming:!0,streamingText:"",activity:null,error:null})},appendChunk:n=>{e(i=>({streamingText:i.streamingText+n,activity:null}))},setActivity:n=>{e({activity:n})},finishStreaming:n=>{const{streamingText:i}=t(),r={id:n,role:"assistant",content:i,createdAt:new Date().toISOString()};e(s=>({messages:[...s.messages,r],streaming:!1,streamingText:"",activity:null}))},addAgentDm:n=>{const i={id:hE(),role:"agent_dm",content:n.content,agentId:n.agentId,agentName:n.agentName,createdAt:new Date().toISOString()};e(r=>({messages:[...r.messages,i]}))},setError:n=>{e({error:n,streaming:!1,streamingText:"",activity:null})},loadConversations:async n=>{try{const i=await fetch(`/api/squads/${n}/conversations`,{credentials:"include"});if(!i.ok)return;const s=((await i.json()).data||[]).map(l=>({id:l.id,createdAt:l.created_at,preview:""}));for(const l of s)try{const c=await fetch(`/api/conversations/${l.id}/messages?limit=1`,{credentials:"include"});if(c.ok){const p=((await c.json()).data||[])[0];p&&(l.preview=p.content.slice(0,80))}}catch{}e({conversations:s})}catch{}},selectConversation:async n=>{e({conversationId:n,messages:[],streaming:!1,streamingText:"",activity:null,error:null});try{const i=await fetch(`/api/conversations/${n}/messages`,{credentials:"include"});if(!i.ok)return;const s=((await i.json()).data||[]).map(l=>({id:l.id,role:l.role,content:l.content,agentId:l.agent_id??void 0,agentName:l.agent_name??void 0,createdAt:l.created_at}));e({messages:s})}catch{}},deleteConversation:async(n,i)=>{try{if(!(await fetch(`/api/conversations/${n}`,{method:"DELETE",credentials:"include"})).ok)return;const{conversationId:s}=t();e(l=>({conversations:l.conversations.filter(c=>c.id!==n)})),s===n&&e({conversationId:null,messages:[]})}catch{}},loadHistory:async n=>{try{const i=await fetch(`/api/squads/${n}/conversations`,{credentials:"include"});if(!i.ok)return;const r=await i.json();if(!r.data||r.data.length===0){e({conversationId:null,messages:[],conversations:[]});return}const s=(r.data||[]).map(g=>({id:g.id,createdAt:g.created_at,preview:""})),l=r.data[0];e({conversationId:l.id,conversations:s});const c=await fetch(`/api/conversations/${l.id}/messages`,{credentials:"include"});if(!c.ok)return;const p=((await c.json()).data||[]).map(g=>({id:g.id,role:g.role,content:g.content,agentId:g.agent_id??void 0,agentName:g.agent_name??void 0,createdAt:g.created_at})),m=p.find(g=>g.role==="user");if(m){const g=s.findIndex(x=>x.id===l.id);g>=0&&(s[g].preview=m.content.slice(0,80))}e({messages:p,conversations:s});for(const g of s)if(g.id!==l.id)try{const x=await fetch(`/api/conversations/${g.id}/messages?limit=1`,{credentials:"include"});if(x.ok){const S=((await x.json()).data||[])[0];S&&(g.preview=S.content.slice(0,80))}}catch{}e({conversations:[...s]})}catch{}},reset:()=>e({conversations:[],messages:[],conversationId:null,streaming:!1,streamingText:"",error:null})}));function zD(e){const n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,i=new WebSocket(n),r=[];let s=!0;function l(c){i.readyState===WebSocket.OPEN?i.send(JSON.stringify(c)):i.readyState===WebSocket.CONNECTING&&r.push(c)}return i.onopen=()=>{var c,f;s||(f=(c=e.current).onReconnect)==null||f.call(c),s=!1;for(const p of r)i.send(JSON.stringify(p));r.length=0},i.onmessage=c=>{var f,p,m,g,x,v,S,A,T,C,N,R,D,H,O,q,Z,I,F;try{const U=JSON.parse(c.data),L=e.current;switch(U.type){case"squad:state":(f=L.onSquadState)==null||f.call(L,U.squadName,U.state);break;case"squad:inactive":(p=L.onSquadInactive)==null||p.call(L,U.squadName,U.reason);break;case"chat:chunk":(m=L.onChatChunk)==null||m.call(L,U.squadName,U.conversationId,U.delta);break;case"chat:activity":(g=L.onChatActivity)==null||g.call(L,U.squadName,U.tool,U.summary);break;case"chat:done":(x=L.onChatDone)==null||x.call(L,U.squadName,U.conversationId,U.messageId);break;case"chat:error":(v=L.onChatError)==null||v.call(L,U.squadName,U.error);break;case"chat:agent_dm":(S=L.onChatAgentDm)==null||S.call(L,U.squadName,U.conversationId,U.agentId,U.agentName,U.message);break;case"chat:conversation_created":(A=L.onChatConversationCreated)==null||A.call(L,U.squadName,U.conversationId);break;case"agent:output_chunk":(T=L.onAgentOutputChunk)==null||T.call(L,U.squadName,U.agentId,U.agentName,U.delta);break;case"agent:step_start":(C=L.onAgentStepStart)==null||C.call(L,U.squadName,U.agentId,U.agentName,U.stepIndex,U.stepLabel);break;case"agent:step_complete":(N=L.onAgentStepComplete)==null||N.call(L,U.squadName,U.agentId,U.agentName,U.stepIndex,U.stepLabel);break;case"squad:checkpoint":(R=L.onSquadCheckpoint)==null||R.call(L,U.squadName,U.agentId,U.agentName,U.question);break;case"schedule:started":(D=L.onScheduleStarted)==null||D.call(L,U.squadName,U.jobId,U.attempt);break;case"schedule:chunk":(H=L.onScheduleChunk)==null||H.call(L,U.squadName,U.jobId,U.delta);break;case"schedule:done":(O=L.onScheduleDone)==null||O.call(L,U.squadName,U.jobId,U.summary,U.attempt);break;case"schedule:error":(q=L.onScheduleError)==null||q.call(L,U.squadName,U.jobId,U.error,U.attempt,U.willRetry);break;case"schedule:status_changed":(Z=L.onScheduleStatusChanged)==null||Z.call(L,U.squadName,U.status);break;case"kanban:task_updated":(I=L.onKanbanTaskUpdated)==null||I.call(L,U);break;case"a2ui:update":(F=L.onA2uiUpdate)==null||F.call(L,U.squadName,U.components);break}}catch{}},{subscribe:c=>{l({type:"squad:subscribe",squadName:c})},unsubscribe:c=>{l({type:"squad:unsubscribe",squadName:c})},sendChat:(c,f,p)=>{const m={type:"chat:send",squadName:c,message:f};p&&p.length>0&&(m.files=p),l(m)},newConversation:c=>{l({type:"chat:new_conversation",squadName:c})},sendCheckpointResponse:(c,f)=>{l({type:"squad:checkpoint_response",squadName:c,answer:f})},disconnect:()=>{i.close()}}}function BD(e={}){const t=j.useRef(null),n=j.useRef(e),i=j.useRef(new Set);n.current=e,j.useEffect(()=>{const p=zD(n);t.current=p;for(const m of i.current)p.subscribe(m);return()=>{p.disconnect()}},[]);const r=j.useCallback(p=>{var m;i.current.add(p),(m=t.current)==null||m.subscribe(p)},[]),s=j.useCallback(p=>{var m;i.current.delete(p),(m=t.current)==null||m.unsubscribe(p)},[]),l=j.useCallback((p,m,g)=>{var x;(x=t.current)==null||x.sendChat(p,m,g)},[]),c=j.useCallback(p=>{var m;(m=t.current)==null||m.newConversation(p)},[]),f=j.useCallback((p,m)=>{var g;(g=t.current)==null||g.sendCheckpointResponse(p,m)},[]);return{subscribe:r,unsubscribe:s,sendChat:l,newConversation:c,sendCheckpointResponse:f}}function LD(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60,r=s=>s.toString().padStart(2,"0");return t>0?`${t}h ${r(n)}m ${r(i)}s`:`${n}m ${r(i)}s`}function jD({state:e}){const[t,n]=j.useState(0);return j.useEffect(()=>{if(!(e!=null&&e.startedAt)||e.status!=="running"){n(0);return}const i=new Date(e.startedAt).getTime(),r=()=>n(Math.floor((Date.now()-i)/1e3));r();const s=setInterval(r,1e3);return()=>clearInterval(s)},[e==null?void 0:e.startedAt,e==null?void 0:e.status]),_.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"var(--statusbar-height)",padding:"0 var(--sp-4)",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)",fontFamily:"var(--font-mono)",fontSize:"0.7rem",color:"var(--text-muted)"},children:e?_.jsxs(_.Fragment,{children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[_.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:e.status==="running"?"var(--status-active)":e.status==="checkpoint"?"var(--status-warning)":"var(--status-idle)",boxShadow:e.status==="running"?"0 0 8px var(--status-active-glow)":"none",animation:e.status==="running"?"statusPulse 2s ease-in-out infinite":"none"}}),_.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Step ",e.step.current,"/",e.step.total]}),_.jsx("span",{style:{color:"var(--border-strong)"},children:"│"}),_.jsx("span",{children:e.step.label})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[e.handoff&&_.jsxs("span",{style:{color:"var(--accent)"},children:[e.handoff.from," → ",e.handoff.to]}),e.status==="running"&&_.jsx("span",{style:{color:"var(--text-secondary)"},children:LD(t)})]})]}):_.jsxs(_.Fragment,{children:[_.jsx("span",{children:"Ready"}),_.jsx("span",{children:"ExpxAgents Mission Control"})]})})}let Pv=null;function ID(e){Pv=e}function VC(e,t,n){Pv&&Pv(e,t,n)}let Fv=null;function UD(e){Fv=e}function HD(e){Fv&&Fv(e)}let Gv=null;function PD(e){Gv=e}function FD(e,t){Gv&&Gv(e,t)}const m0=32,fl=96,iu=64,pt={floor:13158600,floorHighlight:14211288,floorGrout:12105912,wall:15261904,wallTrim:11577496,baseboard:7035464,desk:15263976,deskTop:16119285,deskShadow:13684944,deskLeg:1710618,deskEdge:14737632,monitor:2236976,monitorScreen:1981020,monitorScreenGlow:2773120,monitorStand:3355456,keyboard:3355456,keyboardKey:4473941,chairSeat:2899536,chairBack:3426654,chairBase:4473924,chairWheel:3355443,plant:5025616,plantDark:3706428,plantLight:6732650,pot:9133628,potRim:10515018,soil:4863264,bookshelf:8020808,bookshelfEdge:9139029,bookColors:[15022389,2001125,4431943,16750592,9315498,35195,16635957],rug:6044974,rugPattern:8016448,rugBorder:4861472},qv=[5227511,5025616,16750592,15022389,9315498,16771899],GD={idle:8947848,working:5025616,delivering:5227511,done:5025616,checkpoint:16750592},Br={counter:4073251,counterTop:6111287,machine:3622735,machineTop:4545124,machineLight:5025616,cup:14142664,cupShadow:12364452,saucer:14735052,sink:7901340,faucet:11583173,menu:5125166},Wa={table:6111287,tableTop:7162945,tableEdge:5125166,tableLeg:4073251,chair:3622735,chairSeat:4545124,chairBack:5533306,carpet:2503224,carpetPattern:3030340,whiteboard:15527921,whiteboardFrame:7901340},md={background:1713022,backgroundGlow:2635155,statusRunning:5025616,statusIdle:8947848,statusCheckpoint:16750592,statusCompleted:5025616},au={floor:11579568,tile:11053224,grout:10066329,stripe:12632256},la={floor:14477552,tile:12966120,tileGrout:11453652,wall:14740208,stall:11583173,stallDoor:9479342,sink:15527921,sinkBowl:16777215,mirror:11789820,mirrorFrame:7901340,toilet:16448250,toiletSeat:15658734,pipe:9479342},Aa={floor:6111287,carpet:5125166,carpetBorder:4073251,desk:4073251,deskTop:6111287,deskEdge:2890510,chair:1713022,chairSeat:2635155,window:8508666,windowFrame:5533306,windowSill:7901340,bookshelf:7162945,globe:4367861,nameplate:16766720},ah={wall:7901340,wallHighlight:10795204,doorFrame:6111287},ir={floor:16115411,tile:15259072,tileGrout:13942952,counter:6111287,counterTop:7951688,fridge:15527921,fridgeDoor:14737632,fridgeHandle:10395294,table:9268835,tableTop:10586239,chair:7162945,coffeeMaker:3622735,coffeeMakerLight:5025616,lamp:16766287},Ma={floor:14142664,carpet:6323595,carpetBorder:4545124,sofa:5533306,sofaCushion:6323595,sofaArm:4545124,tv:2171169,tvScreen:2503224,tvStand:4342338,sideTable:7951688,magazine:15684432,magazineAlt:4367861},ec=480,Za=360,id=400,Gi=60,Qa=120,mb=120,pE=160,mE=120,gE=160,qD=64,YD=80,VD=fl+32,XD=iu+48,yE=2,XC=10,Wo=80;function My(e,t,n){const i=Math.max(0,Math.min(1,n));return e+(t-e)*i}function KD(e){return e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2}const $D=["nw","ne","sw","se"],WD={nw:"right",ne:"left",sw:"top",se:"top"};function T0(e){const t=XC,n=Math.max(1,e),i={nw:0,ne:0,sw:0,se:0},r=[];for(let W=0;W<n;W++){const Y=$D[W%4];r.push({quadrant:Y,slot:i[Y]}),i[Y]++}const s=Math.max(1,i.nw),l=Math.max(1,i.ne),c=Math.max(1,i.sw),f=Math.max(1,i.se),p=Math.max(id,Qa),m=s*(Za+t),g=l*(Za+t),x=Math.max(m+p,g+Qa),v=c*(Za+t),S=f*(Za+t),A=Math.max(pE,gE),T=Math.max(v+A+t,S+A+t),C=Math.max(ec,Qa+t+id),N=Math.max(ec,Qa),R=Math.max(ec,mb),D=Math.max(ec,mE),H=Math.max(C,R),O=Math.max(N,D),q=t+H+t+Gi+t+O+t,Z=t+x+t+Gi+t+T+t,I={x:t+H+t,y:t,width:Gi,height:Z-2*t},F={x:t,y:t+x+t,width:q-2*t,height:Gi},U={x:I.x+I.width/2,y:F.y+F.height/2},L={x:I.x-t-id,y:F.y-t-id,width:id,height:id},J={x:L.x-t-Qa,y:F.y-t-Qa,width:Qa,height:Qa},G={x:I.x+Gi+t,y:F.y-t-Qa,width:Qa,height:Qa},K={x:I.x-t-mb,y:F.y+Gi+t+c*(Za+t),width:mb,height:pE},B={x:I.x+Gi+t,y:F.y+Gi+t+f*(Za+t),width:mE,height:gE},V=[],Q={};for(let W=0;W<n;W++){const{quadrant:Y,slot:$}=r[W],ne=WD[Y];let X;Y==="nw"?X={x:I.x-t-ec,y:L.y-t-($+1)*Za-$*t}:Y==="ne"?X={x:I.x+Gi+t,y:G.y-t-($+1)*Za-$*t}:Y==="sw"?X={x:I.x-t-ec,y:F.y+Gi+t+$*(Za+t)}:X={x:I.x+Gi+t,y:F.y+Gi+t+$*(Za+t)},V.push({origin:X,width:ec,height:Za,quadrant:Y,doorSide:ne}),ne==="right"||ne==="left"?Q[`squad-${W}`]={x:I.x+Gi/2,y:X.y+Za/2}:Q[`squad-${W}`]={x:X.x+ec/2,y:F.y+Gi/2}}return Q.ceo={x:I.x+Gi/2,y:L.y+id/2},Q["bathroom-male"]={x:J.x+Qa/2,y:F.y+Gi/2},Q["bathroom-female"]={x:G.x+Qa/2,y:F.y+Gi/2},Q.kitchen={x:I.x+Gi/2,y:K.y+K.height/2},Q["rest-area"]={x:I.x+Gi/2,y:B.y+B.height/2},{totalWidth:q,totalHeight:Z,squadOrigins:V,ceoOffice:L,corridorH:F,corridorV:I,bathroomMale:J,bathroomFemale:G,kitchen:K,restArea:B,doorPoints:Q,corridorHub:U}}function th(e,t,n,i){const r=e%yE,s=Math.floor(e/yE);return{x:t.x+qD+r*VD,y:t.y+YD+s*XD}}function bm(e,t,n){return{x:e.x+t-80,y:e.y+n-80}}function KC(e,t,n){return{x:e.x+t-160,y:e.y+Math.floor(n/2)}}function QD(e,t){const n=t==="male"?e.bathroomMale:e.bathroomFemale;return{x:n.x+n.width/2,y:n.y+n.height/2}}function ZD(e){return{x:e.kitchen.x+e.kitchen.width/2,y:e.kitchen.y+e.kitchen.height/2}}function JD(e){return{x:e.restArea.x+e.restArea.width/2,y:e.restArea.y+e.restArea.height/2}}function e4(e){const t=e.corridorV;if(t.height>0&&Math.random()<.5)return{x:t.x+10+Math.random()*Math.max(0,t.width-20),y:t.y+10+Math.random()*Math.max(0,t.height-20)};const n=e.corridorH;return{x:n.x+20+Math.random()*Math.max(0,n.width-40),y:n.y+10+Math.random()*Math.max(0,n.height-20)}}function xE(e,t){const n=t.corridorH;return e.x>=n.x&&e.x<=n.x+n.width&&e.y>=n.y&&e.y<=n.y+n.height}function bE(e,t){const n=t.corridorV;return e.x>=n.x&&e.x<=n.x+n.width&&e.y>=n.y&&e.y<=n.y+n.height}function t4(e,t){if(e==="ceo"){const i=t.ceoOffice;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="bathroom-male"){const i=t.bathroomMale;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="bathroom-female"){const i=t.bathroomFemale;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="kitchen"){const i=t.kitchen;return{x:i.x+i.width/2,y:i.y+i.height/2}}if(e==="rest-area"){const i=t.restArea;return{x:i.x+i.width/2,y:i.y+i.height/2}}const n=e.match(/^squad-(\d+)$/);if(n){const i=parseInt(n[1],10),r=t.squadOrigins[i];if(r)return{x:r.origin.x+r.width/2,y:r.origin.y+r.height/2}}return t.corridorHub}function vm(e,t,n,i){const r=i.doorPoints[t],s=i.doorPoints[n];if(!r||!s)return[e];const l=i.corridorHub,c=t4(n,i),f=xE(r,i)&&xE(s,i),p=bE(r,i)&&bE(s,i);return f||p?[e,r,s,c]:[e,r,l,s,c]}function Ry(e,t){const n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)}const vE=500,_E=50;let SE=0;function EE(e){return{idle:"idle",working:"working",delivering:"walking",done:"idle",checkpoint:"checkpoint"}[e]??"idle"}const ai=fu(e=>({rooms:[],activeRoom:null,bubbles:{},activityLog:{},checkpoints:{},agentVisuals:{},appendBubble:(t,n,i)=>{const r=`${t}:${n}`;e(s=>{var f;let c=(((f=s.bubbles[r])==null?void 0:f.text)??"")+i;return c.length>vE&&(c=c.slice(c.length-vE)),{bubbles:{...s.bubbles,[r]:{text:c,updatedAt:Date.now()}}}})},clearBubble:(t,n)=>{const i=`${t}:${n}`;e(r=>{const{[i]:s,...l}=r.bubbles;return{bubbles:l}})},clearAllBubbles:()=>e({bubbles:{}}),addActivity:(t,n,i)=>{const s={id:++SE,agentName:n,action:i,timestamp:Date.now()};e(l=>{var m;const f=[...((m=l.activityLog[t])==null?void 0:m.entries)??[],s],p=f.length>_E?f.slice(f.length-_E):f;return{activityLog:{...l.activityLog,[t]:{entries:p}}}})},setCheckpoint:(t,n,i,r)=>e(s=>({checkpoints:{...s.checkpoints,[t]:{agentId:n,agentName:i,question:r}}})),clearCheckpoint:t=>e(n=>{const{[t]:i,...r}=n.checkpoints;return{checkpoints:r}}),setActiveRoom:t=>e({activeRoom:t}),syncRooms:t=>e(n=>{const i=t;let r;return i.length===0?r=null:n.activeRoom===null||!i.includes(n.activeRoom)?r=i[0]:r=n.activeRoom,{rooms:i,activeRoom:r}}),setAgents:(t,n)=>e(i=>{const r=i.agentVisuals[t]??[],s=new Map(r.map(v=>[v.id,v])),l={x:0,y:0},c=T0(i.rooms.length),f=i.rooms.indexOf(t),p=c.squadOrigins[f],m=(p==null?void 0:p.width)??480,g=(p==null?void 0:p.height)??360,x=n.map((v,S)=>{const A=s.get(v.id);if(A){const N=v.status?EE(v.status):A.status,R=N!==A.status;let D=A.targetPosition;return R&&(N==="working"||N==="checkpoint"?D=th(S,l):D=bm(l,m,g)),{...A,name:v.name,avatar:v.avatar,deskIndex:S,status:N,targetPosition:D}}const T=v.status?EE(v.status):"idle",C=T==="working"||T==="checkpoint"?th(S,l):bm(l,m,g);return{id:v.id,name:v.name,avatar:v.avatar,colorIndex:S%6,status:T,deskIndex:S,position:C,targetPosition:null}});return{agentVisuals:{...i.agentVisuals,[t]:x}}}),setAgentStatus:(t,n,i)=>e(r=>{const s=r.agentVisuals[t];if(!s)return r;const l={x:0,y:0},c=T0(r.rooms.length),f=r.rooms.indexOf(t),p=c.squadOrigins[f],m=(p==null?void 0:p.width)??480,g=(p==null?void 0:p.height)??360,x=s.map(v=>{if(v.id!==n)return v;let S;return i==="working"||i==="checkpoint"?S=th(v.deskIndex,l):S=bm(l,m,g),{...v,status:i,targetPosition:S}});return{agentVisuals:{...r.agentVisuals,[t]:x}}}),reset:()=>{SE=0,e({rooms:[],activeRoom:null,bubbles:{},activityLog:{},checkpoints:{},agentVisuals:{}})}})),aQ={background:"#0a0a0f",grid:"rgba(0, 200, 255, 0.06)",orbStandby:"#1a3a5c",orbListening:"#00c8ff",orbProcessing:"#ff8c00",orbSpeaking:"#00ff88",panelBg:"rgba(0, 200, 255, 0.08)",panelBorder:"rgba(0, 200, 255, 0.25)",textPrimary:"#e0e8f0",textAccent:"#00c8ff",textJarvis:"#00ff88",particleStart:"#00c8ff"},n4={orbRadius:60,orbRingWidth:3,gridSpacing:40,particleCount:65,particleMinRadius:1,particleMaxRadius:3,waveformBars:32,waveformMaxHeight:40,panelWidth:180,panelPadding:12,transcriptLineHeight:20,standbyTimeoutMs:15e3,ttsSplitLength:300};let $C=0;function i4(){return`jarvis-${Date.now()}-${++$C}`}let lo=null;const gb=fu((e,t)=>({mode:"STANDBY",messages:[],streamingText:"",selectedSquad:null,userName:"",setMode:n=>e({mode:n}),addMessage:(n,i)=>{const r={id:i4(),role:n,content:i,createdAt:new Date().toISOString()};e(s=>({messages:[...s.messages,r]}))},appendChunk:n=>{e(i=>({streamingText:i.streamingText+n}))},finalizeMessage:n=>{const{streamingText:i}=t(),r={id:n,role:"assistant",content:i,createdAt:new Date().toISOString()};e(s=>({messages:[...s.messages,r],streamingText:""}))},selectSquad:n=>e({selectedSquad:n}),setUserName:n=>e({userName:n}),startStandbyTimer:()=>{lo&&clearTimeout(lo),lo=setTimeout(()=>{e({mode:"STANDBY"}),lo=null},n4.standbyTimeoutMs)},resetStandbyTimer:()=>{t().startStandbyTimer()},clearStandbyTimer:()=>{lo&&(clearTimeout(lo),lo=null)},reset:()=>{lo&&(clearTimeout(lo),lo=null),$C=0,e({mode:"STANDBY",messages:[],streamingText:"",selectedSquad:null,userName:""})}})),ua=fu((e,t)=>({jobs:[],loading:!1,history:{},historyLoading:{},fetchJobs:async()=>{e({loading:!0});try{const n=await fetch("/api/scheduler",{credentials:"include"});if(n.ok){const i=await n.json();e({jobs:i.data,loading:!1})}else e({loading:!1})}catch{e({loading:!1})}},createJob:async n=>(await fetch("/api/scheduler",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).ok?(t().fetchJobs(),!0):!1,deleteJob:async n=>{await fetch(`/api/scheduler/${n}`,{method:"DELETE",credentials:"include"}),t().fetchJobs()},pauseJob:async n=>{await fetch(`/api/scheduler/${n}/pause`,{method:"POST",credentials:"include"}),t().fetchJobs()},resumeJob:async n=>{await fetch(`/api/scheduler/${n}/resume`,{method:"POST",credentials:"include"}),t().fetchJobs()},triggerJob:async n=>{await fetch(`/api/scheduler/${n}/trigger`,{method:"POST",credentials:"include"})},updateJobStatus:(n,i)=>{e(r=>({jobs:r.jobs.map(s=>s.squad_name===n?{...s,status:i}:s)}))},fetchHistory:async n=>{e(i=>({historyLoading:{...i.historyLoading,[n]:!0}}));try{const i=await fetch(`/api/scheduler/${n}/history?limit=50`,{credentials:"include"});if(i.ok){const r=await i.json();e(s=>({history:{...s.history,[n]:r.data},historyLoading:{...s.historyLoading,[n]:!1}}))}else e(r=>({historyLoading:{...r.historyLoading,[n]:!1}}))}catch{e(i=>({historyLoading:{...i.historyLoading,[n]:!1}}))}}})),r4=600*1e3;function a4(){const[e,t]=j.useState(null),[n,i]=j.useState(!1),[r,s]=j.useState(!1),l=j.useCallback(async()=>{try{const f=await fetch("/api/system/version",{credentials:"include"});if(f.ok){const p=await f.json();t(p)}}catch{}},[]);j.useEffect(()=>{l();const f=setInterval(l,r4);return()=>clearInterval(f)},[l]);const c=async()=>{i(!0);try{await fetch("/api/system/update",{method:"POST",credentials:"include"})}catch{i(!1)}};return!(e!=null&&e.updateAvailable)||r?null:_.jsx("div",{"data-testid":"update-banner",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"var(--sp-3)",padding:"8px var(--sp-4)",background:"var(--surface-2)",borderBottom:"1px solid var(--accent)",fontFamily:"var(--font-mono)",fontSize:"0.72rem",color:"var(--text-secondary)",animation:"fadeIn 0.3s var(--ease-out) both"},children:n?_.jsxs("span",{style:{color:"var(--accent)"},children:["Updating to v",e.latest,"... Server will restart automatically."]}):_.jsxs(_.Fragment,{children:[_.jsxs("span",{children:["New version available: ",_.jsxs("strong",{style:{color:"var(--accent)"},children:["v",e.latest]}),_.jsxs("span",{style:{color:"var(--text-muted)",marginLeft:6},children:["(current: v",e.current,")"]})]}),_.jsx("button",{"data-testid":"btn-update",onClick:c,style:{padding:"3px 12px",borderRadius:"var(--radius-xs)",fontFamily:"var(--font-mono)",fontSize:"0.68rem",fontWeight:600,cursor:"pointer",border:"none",background:"var(--accent)",color:"var(--text-inverse)",transition:"opacity 0.15s ease"},children:"Update"}),_.jsx("button",{"data-testid":"btn-dismiss-update",onClick:()=>s(!0),style:{padding:"2px 6px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.68rem"},children:"✕"})]})})}function s4(){if(typeof window>"u")return"dark";const e=localStorage.getItem("expx-theme");return e==="light"||e==="dark"?e:"dark"}function wE(e){document.documentElement.setAttribute("data-theme",e),localStorage.setItem("expx-theme",e)}const C0=fu((e,t)=>({theme:s4(),toggle:()=>{const n=t().theme==="dark"?"light":"dark";wE(n),e({theme:n})},setTheme:n=>{wE(n),e({theme:n})}})),l4=j.lazy(()=>ou(()=>import("./ThreeBackground-Br_6kh54.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ThreeBackground}))),o4=[{to:"/office",label:"Office",icon:"⬡"},{to:"/chat",label:"Chat",icon:"◈"},{to:"/kanban",label:"Kanban",icon:"▦"},{to:"/dashboard",label:"Dashboard",icon:"▣"},{to:"/scheduler",label:"Scheduler",icon:"⏣"},{to:"/email",label:"Email",icon:"✉"},{to:"/orgchart",label:"Org Chart",icon:"◎"},{to:"/graph",label:"Graph",icon:"◇"},{to:"/files",label:"Files",icon:"▤"},{to:"/settings",label:"Settings",icon:"⚙"}];function c4(){const e=gl(ie=>ie.user),t=gl(ie=>ie.isAuthenticated),n=gl(ie=>ie.loading),i=gl(ie=>ie.logout),r=gl(ie=>ie.checkAuth),s=Z0(),l=wl();l.pathname==="/office"||l.pathname;const c=l.pathname==="/jarvis",f=C0(ie=>ie.theme),p=C0(ie=>ie.toggle),m=vr(ie=>ie.squads),g=vr(ie=>ie.selectedSquad),x=vr(ie=>g?ie.activeStates[g]:null),v=vr(ie=>ie.fetchSquads),S=vr(ie=>ie.setSquadState),A=vr(ie=>ie.clearSquadState),T=j.useCallback((ie,he)=>{S(ie,he);const be=ai.getState();be.rooms.includes(ie)||be.syncRooms([...be.rooms,ie]),he.status!=="checkpoint"&&be.clearCheckpoint(ie),he.agents&&be.setAgents(ie,he.agents.map(ye=>({id:ye.id,name:ye.name,status:ye.status})))},[S]),C=j.useCallback(ie=>{A(ie);const he=ai.getState(),be=he.agentVisuals[ie];if(be)for(const ye of be)he.setAgentStatus(ie,ye.id,"idle")},[A]),N=j.useCallback((ie,he)=>{rr.setState(be=>({conversationId:he,messages:[],conversations:[{id:he,createdAt:new Date().toISOString(),preview:""},...be.conversations.filter(ye=>ye.id!==he)]}))},[]),R=j.useCallback((ie,he,be)=>{if(ie==="_jarvis"){gb.getState().appendChunk(be);return}const ye=rr.getState();ye.streaming||ye.startStreaming(),ye.appendChunk(be)},[]),D=j.useCallback((ie,he,be)=>{if(ie==="_jarvis"){gb.getState().finalizeMessage(be);return}rr.getState().finishStreaming(be)},[]),H=j.useCallback((ie,he)=>{if(ie==="_jarvis"){gb.getState().setMode("LISTENING");return}rr.getState().setError(he)},[]),O=j.useCallback((ie,he,be)=>{ie!=="_jarvis"&&rr.getState().setActivity(`${he}${be?" "+be:""}`)},[]),q=j.useCallback((ie,he,be,ye,le)=>{rr.getState().addAgentDm({agentId:be,agentName:ye,content:le})},[]),Z=j.useCallback((ie,he,be,ye)=>{ai.getState().appendBubble(ie,he,ye)},[]),I=j.useCallback((ie,he,be,ye,le)=>{ai.getState().addActivity(ie,be,`started "${le}"`),ai.getState().setAgentStatus(ie,he,"working")},[]),F=j.useCallback((ie,he,be,ye,le)=>{ai.getState().addActivity(ie,be,`completed "${le}"`),ai.getState().setAgentStatus(ie,he,"idle")},[]),U=j.useCallback((ie,he,be,ye)=>{ai.getState().setCheckpoint(ie,he,be,ye),ai.getState().setAgentStatus(ie,he,"checkpoint")},[]),L=j.useCallback(()=>{ai.getState().clearAllBubbles()},[]),J=j.useCallback((ie,he,be)=>{ua.getState().fetchJobs()},[]),G=j.useCallback((ie,he,be,ye)=>{ua.getState().fetchJobs()},[]),K=j.useCallback((ie,he,be,ye,le)=>{ua.getState().fetchJobs()},[]),B=j.useCallback((ie,he)=>{ua.getState().updateJobStatus(ie,he)},[]),V=j.useCallback(ie=>{window.dispatchEvent(new CustomEvent("kanban:task_updated",{detail:ie}))},[]),Q=j.useCallback((ie,he)=>{vr.getState().setUiComponents(ie,he)},[]),{subscribe:W,unsubscribe:Y,sendChat:$,newConversation:ne,sendCheckpointResponse:X}=BD({onSquadState:T,onSquadInactive:C,onChatConversationCreated:N,onChatChunk:R,onChatActivity:O,onChatDone:D,onChatError:H,onChatAgentDm:q,onAgentOutputChunk:Z,onAgentStepStart:I,onAgentStepComplete:F,onSquadCheckpoint:U,onReconnect:L,onScheduleStarted:J,onScheduleDone:G,onScheduleError:K,onScheduleStatusChanged:B,onKanbanTaskUpdated:V,onA2uiUpdate:Q});j.useEffect(()=>{ID($)},[$]),j.useEffect(()=>{UD(ne)},[ne]),j.useEffect(()=>{PD(X)},[X]),j.useEffect(()=>{v().then(()=>{const{squads:ie}=vr.getState();if(ie.length>0){const he=ai.getState(),be=ie.map(Re=>Re.code),ye=he.rooms,le=[...new Set([...ye,...be])];he.syncRooms(le);for(const Re of ie)!he.agentVisuals[Re.code]&&Re.agents&&Re.agents.length>0&&he.setAgents(Re.code,Re.agents.map(je=>({id:je.id,name:je.name,avatar:je.avatar,status:"idle"})))}})},[v]);const ue=ai(ie=>ie.rooms);return j.useEffect(()=>{for(const ie of ue)W(ie);return()=>{for(const ie of ue)Y(ie)}},[ue,W,Y]),j.useEffect(()=>(W("_expxagents"),()=>Y("_expxagents")),[W,Y]),j.useEffect(()=>{if(c)return W("_jarvis"),()=>Y("_jarvis")},[c,W,Y]),j.useEffect(()=>{t||r()},[]),j.useEffect(()=>{!n&&!t&&s("/login",{state:{from:l.pathname}})},[n,t,s,l.pathname]),c?_.jsx(cE,{}):_.jsxs("div",{className:"noise-bg",style:{display:"flex",flexDirection:"column",height:"100vh",background:"var(--surface-0)",color:"var(--text-primary)"},children:[_.jsxs("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"var(--header-height)",padding:"0 var(--sp-4)",background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)",position:"relative",zIndex:10},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-3)"},children:[_.jsx("div",{style:{width:28,height:28,borderRadius:"var(--radius-sm)",background:"linear-gradient(135deg, var(--accent), var(--accent-dim))",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.8rem",fontWeight:700,color:"var(--text-inverse)",boxShadow:"0 0 12px var(--accent-glow-strong)"},children:"EX"}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"0.95rem",color:"var(--text-primary)",letterSpacing:"-0.02em"},children:"ExpxAgents"}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",background:"var(--surface-3)",padding:"2px 6px",borderRadius:"var(--radius-xs)",letterSpacing:"0.05em"},children:"MISSION CONTROL"})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-4)"},children:[_.jsx("button",{"data-testid":"btn-restart-server",onClick:async()=>{if(confirm("Restart the server? It will be briefly unavailable."))try{await fetch("/api/system/restart",{method:"POST",credentials:"include"})}catch{}},title:"Restart server",style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.7rem",padding:"3px 8px",borderRadius:"var(--radius-xs)",transition:"all var(--duration-fast) var(--ease-out)",display:"flex",alignItems:"center",gap:4},onMouseEnter:ie=>{ie.currentTarget.style.color="var(--accent)",ie.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:ie=>{ie.currentTarget.style.color="var(--text-muted)",ie.currentTarget.style.borderColor="var(--border-subtle)"},children:"↻ Restart"}),_.jsx("button",{"data-testid":"btn-toggle-theme",onClick:p,title:`Switch to ${f==="dark"?"light":"dark"} mode`,style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.85rem",padding:"3px 8px",borderRadius:"var(--radius-xs)",transition:"all var(--duration-fast) var(--ease-out)",display:"flex",alignItems:"center",gap:4,lineHeight:1},onMouseEnter:ie=>{ie.currentTarget.style.color="var(--accent)",ie.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:ie=>{ie.currentTarget.style.color="var(--text-muted)",ie.currentTarget.style.borderColor="var(--border-subtle)"},children:f==="dark"?"☀":"☽"}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-secondary)"},children:[_.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:"var(--status-active)",boxShadow:"0 0 8px var(--status-active-glow)",animation:"statusPulse 2s ease-in-out infinite"}}),_.jsx("span",{children:e==null?void 0:e.username})]}),_.jsx("button",{onClick:i,className:"btn-ghost",style:{background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontFamily:"var(--font-display)",fontSize:"0.75rem",padding:"4px 8px",borderRadius:"var(--radius-xs)",transition:"color var(--duration-fast) var(--ease-out)"},onMouseEnter:ie=>ie.currentTarget.style.color="var(--status-error)",onMouseLeave:ie=>ie.currentTarget.style.color="var(--text-muted)",children:"Logout"})]})]}),_.jsx(a4,{}),_.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[_.jsxs("aside",{style:{width:"var(--sidebar-width)",background:"var(--surface-1)",borderRight:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",overflowY:"auto"},children:[_.jsxs("nav",{style:{padding:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-1)",flex:1},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.1em",padding:"0 var(--sp-2)",marginBottom:"var(--sp-1)"},children:"Navigation"}),o4.map(ie=>_.jsxs(qC,{to:ie.to,style:({isActive:he})=>({display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"8px 10px",borderRadius:"var(--radius-sm)",textDecoration:"none",fontSize:"0.82rem",fontWeight:he?600:400,color:he?"var(--accent)":"var(--text-secondary)",background:he?"var(--accent-glow)":"transparent",border:he?"1px solid var(--accent-glow)":"1px solid transparent",transition:"all var(--duration-fast) var(--ease-out)"}),children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.85rem",width:20,textAlign:"center",opacity:.7},children:ie.icon}),ie.label]},ie.to)),_.jsx("div",{style:{height:1,margin:"var(--sp-2) var(--sp-2)",background:"var(--border-subtle)"}}),_.jsxs("a",{href:"/jarvis",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"8px 10px",borderRadius:"var(--radius-sm)",textDecoration:"none",fontSize:"0.82rem",fontWeight:500,color:"var(--status-active)",background:"var(--status-active-glow)",border:"1px solid var(--status-active-glow)",transition:"all var(--duration-fast) var(--ease-out)"},children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.85rem",width:20,textAlign:"center",opacity:.7},children:"◉"}),"Jarvis",_.jsx("span",{style:{marginLeft:"auto",fontFamily:"var(--font-mono)",fontSize:"0.55rem",opacity:.6},children:"↗"})]})]}),_.jsxs("div",{style:{padding:"var(--sp-3)",borderTop:"1px solid var(--border-subtle)",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",display:"flex",justifyContent:"space-between"},children:[_.jsxs("span",{children:[m.length," squad",m.length!==1?"s":""]}),_.jsx("span",{children:"v0.1.0"})]})]}),_.jsxs("main",{className:"grid-bg",style:{flex:1,overflow:"hidden",position:"relative"},children:[_.jsx(j.Suspense,{fallback:null,children:_.jsx(l4,{opacity:.4})}),_.jsx("div",{style:{position:"relative",zIndex:1,height:"100%",overflow:"auto"},children:_.jsx(cE,{})})]})]}),_.jsx(jD,{state:x})]})}const u4=j.lazy(()=>ou(()=>import("./ThreeBackground-Br_6kh54.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ThreeBackground})));function d4(){var S;const[e,t]=j.useState(""),[n,i]=j.useState(""),r=gl(A=>A.login),s=gl(A=>A.loading),l=gl(A=>A.error),c=gl(A=>A.isAuthenticated),f=Z0(),m=((S=wl().state)==null?void 0:S.from)||"/";j.useEffect(()=>{c&&f(m,{replace:!0})},[c,f,m]);const g=A=>{A.preventDefault(),r(e,n)},x=C0(A=>A.theme),v=C0(A=>A.toggle);return _.jsxs("div",{className:"noise-bg",style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"var(--surface-0)",position:"relative",overflow:"hidden"},children:[_.jsx(j.Suspense,{fallback:null,children:_.jsx(u4,{opacity:.6})}),_.jsx("button",{onClick:v,title:`Switch to ${x==="dark"?"light":"dark"} mode`,style:{position:"absolute",top:16,right:16,zIndex:10,background:"var(--surface-2)",border:"1px solid var(--border-default)",color:"var(--text-secondary)",cursor:"pointer",fontSize:"1rem",padding:"6px 10px",borderRadius:"var(--radius-sm)",transition:"all var(--duration-fast) var(--ease-out)",lineHeight:1},children:x==="dark"?"☀":"☽"}),_.jsxs("div",{style:{animation:"fadeInUp 0.6s var(--ease-out) both",width:360,position:"relative",zIndex:1},children:[_.jsxs("div",{style:{textAlign:"center",marginBottom:"var(--sp-8)"},children:[_.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:48,height:48,borderRadius:"var(--radius-md)",background:"linear-gradient(135deg, var(--accent), var(--accent-dim))",fontSize:"1.1rem",fontWeight:800,color:"var(--text-inverse)",boxShadow:"var(--shadow-glow-strong)",marginBottom:"var(--sp-4)"},children:"EX"}),_.jsx("h1",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"1.4rem",color:"var(--text-primary)",letterSpacing:"-0.02em",marginBottom:"var(--sp-1)"},children:"ExpxAgents"}),_.jsx("p",{style:{fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.15em"},children:"Mission Control"})]}),_.jsxs("form",{onSubmit:g,className:"glass",style:{padding:"var(--sp-6)",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-lg)"},children:[l&&_.jsx("div",{style:{padding:"var(--sp-2) var(--sp-3)",marginBottom:"var(--sp-4)",borderRadius:"var(--radius-sm)",background:"var(--status-error-glow)",border:"1px solid rgba(255, 64, 112, 0.2)",color:"var(--status-error)",fontSize:"0.8rem",fontFamily:"var(--font-mono)"},children:l}),_.jsxs("div",{style:{marginBottom:"var(--sp-3)"},children:[_.jsx("label",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"var(--sp-1)"},children:"Username"}),_.jsx("input",{type:"text",className:"input",placeholder:"Enter username",value:e,onChange:A=>t(A.target.value),autoFocus:!0})]}),_.jsxs("div",{style:{marginBottom:"var(--sp-5)"},children:[_.jsx("label",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"var(--sp-1)"},children:"Password"}),_.jsx("input",{type:"password",className:"input",placeholder:"Enter password",value:n,onChange:A=>i(A.target.value)})]}),_.jsx("button",{type:"submit",disabled:s,className:"btn btn-accent",style:{width:"100%",padding:"var(--sp-3)",fontSize:"0.85rem",cursor:s?"wait":"pointer",opacity:s?.7:1},children:s?"Authenticating...":"Access Mission Control"})]}),_.jsx("p",{style:{textAlign:"center",marginTop:"var(--sp-4)",fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)"},children:"AI Squad Orchestration Platform"})]})]})}function WC(e,t,n){if(!e)return;if(n(e)===!0)return e;let i=e.child;for(;i;){const r=WC(i,t,n);if(r)return r;i=i.sibling}}function QC(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Q1=QC(j.createContext(null));let ZC=class extends j.Component{render(){return j.createElement(Q1.Provider,{value:this._reactInternals},this.props.children)}};function f4(){const e=j.useContext(Q1);if(e===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const t=j.useId();return j.useMemo(()=>{for(const n of[e,e==null?void 0:e.alternate]){if(!n)continue;const i=WC(n,!1,r=>{let s=r.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}});if(i)return i}},[e,t])}const h4=Symbol.for("react.context"),p4=e=>e!==null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===h4;function m4(){const e=f4(),[t]=j.useState(()=>new Map);t.clear();let n=e;for(;n;){const i=n.type;p4(i)&&i!==Q1&&!t.has(i)&&t.set(i,j.use(QC(i))),n=n.return}return t}function g4(){const e=m4();return j.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>i=>j.createElement(t,null,j.createElement(n.Provider,{...i,value:e.get(n)})),t=>j.createElement(ZC,{...t})),[e])}var kt=(e=>(e.Application="application",e.WebGLPipes="webgl-pipes",e.WebGLPipesAdaptor="webgl-pipes-adaptor",e.WebGLSystem="webgl-system",e.WebGPUPipes="webgpu-pipes",e.WebGPUPipesAdaptor="webgpu-pipes-adaptor",e.WebGPUSystem="webgpu-system",e.CanvasSystem="canvas-system",e.CanvasPipesAdaptor="canvas-pipes-adaptor",e.CanvasPipes="canvas-pipes",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e.MaskEffect="mask-effect",e.BlendMode="blend-mode",e.TextureSource="texture-source",e.Environment="environment",e.ShapeBuilder="shape-builder",e.Batcher="batcher",e))(kt||{});const Yv=e=>{if(typeof e=="function"||typeof e=="object"&&e.extension){if(!e.extension)throw new Error("Extension class must have an extension object");e={...typeof e.extension!="object"?{type:e.extension}:e.extension,ref:e}}if(typeof e=="object")e={...e};else throw new Error("Invalid extension type");return typeof e.type=="string"&&(e.type=[e.type]),e},ky=(e,t)=>Yv(e).priority??t,li={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(Yv).forEach(t=>{t.type.forEach(n=>{var i,r;return(r=(i=this._removeHandlers)[n])==null?void 0:r.call(i,t)})}),this},add(...e){return e.map(Yv).forEach(t=>{t.type.forEach(n=>{var s,l;const i=this._addHandlers,r=this._queue;i[n]?(l=i[n])==null||l.call(i,t):(r[n]=r[n]||[],(s=r[n])==null||s.push(t))})}),this},handle(e,t,n){var l;const i=this._addHandlers,r=this._removeHandlers;if(i[e]||r[e])throw new Error(`Extension type ${e} already has a handler`);i[e]=t,r[e]=n;const s=this._queue;return s[e]&&((l=s[e])==null||l.forEach(c=>t(c)),delete s[e]),this},handleByMap(e,t){return this.handle(e,n=>{n.name&&(t[n.name]=n.ref)},n=>{n.name&&delete t[n.name]})},handleByNamedList(e,t,n=-1){return this.handle(e,i=>{t.findIndex(s=>s.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((s,l)=>ky(l.value,n)-ky(s.value,n)))},i=>{const r=t.findIndex(s=>s.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(e,t,n=-1){return this.handle(e,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,s)=>ky(s,n)-ky(r,n)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})},mixin(e,...t){for(const n of t)Object.defineProperties(e.prototype,Object.getOwnPropertyDescriptors(n))}},y4={extension:{type:kt.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await ou(()=>import("./browserAll-DtAMswxw.js"),__vite__mapDeps([2,3]))}},x4={extension:{type:kt.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await ou(()=>import("./webworkerAll-B4oBLw25.js"),[])}};class br{constructor(t,n,i){this._x=n||0,this._y=i||0,this._observer=t}clone(t){return new br(t??this._observer,this._x,this._y)}set(t=0,n=t){return(this._x!==t||this._y!==n)&&(this._x=t,this._y=n,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}var yb={exports:{}},TE;function b4(){return TE||(TE=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(n=!1));function r(f,p,m){this.fn=f,this.context=p,this.once=m||!1}function s(f,p,m,g,x){if(typeof m!="function")throw new TypeError("The listener must be a function");var v=new r(m,g||f,x),S=n?n+p:p;return f._events[S]?f._events[S].fn?f._events[S]=[f._events[S],v]:f._events[S].push(v):(f._events[S]=v,f._eventsCount++),f}function l(f,p){--f._eventsCount===0?f._events=new i:delete f._events[p]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var p=[],m,g;if(this._eventsCount===0)return p;for(g in m=this._events)t.call(m,g)&&p.push(n?g.slice(1):g);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(m)):p},c.prototype.listeners=function(p){var m=n?n+p:p,g=this._events[m];if(!g)return[];if(g.fn)return[g.fn];for(var x=0,v=g.length,S=new Array(v);x<v;x++)S[x]=g[x].fn;return S},c.prototype.listenerCount=function(p){var m=n?n+p:p,g=this._events[m];return g?g.fn?1:g.length:0},c.prototype.emit=function(p,m,g,x,v,S){var A=n?n+p:p;if(!this._events[A])return!1;var T=this._events[A],C=arguments.length,N,R;if(T.fn){switch(T.once&&this.removeListener(p,T.fn,void 0,!0),C){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,m),!0;case 3:return T.fn.call(T.context,m,g),!0;case 4:return T.fn.call(T.context,m,g,x),!0;case 5:return T.fn.call(T.context,m,g,x,v),!0;case 6:return T.fn.call(T.context,m,g,x,v,S),!0}for(R=1,N=new Array(C-1);R<C;R++)N[R-1]=arguments[R];T.fn.apply(T.context,N)}else{var D=T.length,H;for(R=0;R<D;R++)switch(T[R].once&&this.removeListener(p,T[R].fn,void 0,!0),C){case 1:T[R].fn.call(T[R].context);break;case 2:T[R].fn.call(T[R].context,m);break;case 3:T[R].fn.call(T[R].context,m,g);break;case 4:T[R].fn.call(T[R].context,m,g,x);break;default:if(!N)for(H=1,N=new Array(C-1);H<C;H++)N[H-1]=arguments[H];T[R].fn.apply(T[R].context,N)}}return!0},c.prototype.on=function(p,m,g){return s(this,p,m,g,!1)},c.prototype.once=function(p,m,g){return s(this,p,m,g,!0)},c.prototype.removeListener=function(p,m,g,x){var v=n?n+p:p;if(!this._events[v])return this;if(!m)return l(this,v),this;var S=this._events[v];if(S.fn)S.fn===m&&(!x||S.once)&&(!g||S.context===g)&&l(this,v);else{for(var A=0,T=[],C=S.length;A<C;A++)(S[A].fn!==m||x&&!S[A].once||g&&S[A].context!==g)&&T.push(S[A]);T.length?this._events[v]=T.length===1?T[0]:T:l(this,v)}return this},c.prototype.removeAllListeners=function(p){var m;return p?(m=n?n+p:p,this._events[m]&&l(this,m)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(yb)),yb.exports}var v4=b4();const yo=du(v4),_4=Math.PI*2,S4=180/Math.PI,E4=Math.PI/180;class Lr{constructor(t=0,n=0){this.x=0,this.y=0,this.x=t,this.y=n}clone(){return new Lr(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,n=t){return this.x=t,this.y=n,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return xb.x=0,xb.y=0,xb}}const xb=new Lr;class Ht{constructor(t=1,n=0,i=0,r=1,s=0,l=0){this.array=null,this.a=t,this.b=n,this.c=i,this.d=r,this.tx=s,this.ty=l}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,n,i,r,s,l){return this.a=t,this.b=n,this.c=i,this.d=r,this.tx=s,this.ty=l,this}toArray(t,n){this.array||(this.array=new Float32Array(9));const i=n||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,n){n=n||new Lr;const i=t.x,r=t.y;return n.x=this.a*i+this.c*r+this.tx,n.y=this.b*i+this.d*r+this.ty,n}applyInverse(t,n){n=n||new Lr;const i=this.a,r=this.b,s=this.c,l=this.d,c=this.tx,f=this.ty,p=1/(i*l+s*-r),m=t.x,g=t.y;return n.x=l*p*m+-s*p*g+(f*s-c*l)*p,n.y=i*p*g+-r*p*m+(-f*i+c*r)*p,n}translate(t,n){return this.tx+=t,this.ty+=n,this}scale(t,n){return this.a*=t,this.d*=n,this.c*=t,this.b*=n,this.tx*=t,this.ty*=n,this}rotate(t){const n=Math.cos(t),i=Math.sin(t),r=this.a,s=this.c,l=this.tx;return this.a=r*n-this.b*i,this.b=r*i+this.b*n,this.c=s*n-this.d*i,this.d=s*i+this.d*n,this.tx=l*n-this.ty*i,this.ty=l*i+this.ty*n,this}append(t){const n=this.a,i=this.b,r=this.c,s=this.d;return this.a=t.a*n+t.b*r,this.b=t.a*i+t.b*s,this.c=t.c*n+t.d*r,this.d=t.c*i+t.d*s,this.tx=t.tx*n+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this}appendFrom(t,n){const i=t.a,r=t.b,s=t.c,l=t.d,c=t.tx,f=t.ty,p=n.a,m=n.b,g=n.c,x=n.d;return this.a=i*p+r*g,this.b=i*m+r*x,this.c=s*p+l*g,this.d=s*m+l*x,this.tx=c*p+f*g+n.tx,this.ty=c*m+f*x+n.ty,this}setTransform(t,n,i,r,s,l,c,f,p){return this.a=Math.cos(c+p)*s,this.b=Math.sin(c+p)*s,this.c=-Math.sin(c-f)*l,this.d=Math.cos(c-f)*l,this.tx=t-(i*this.a+r*this.c),this.ty=n-(i*this.b+r*this.d),this}prepend(t){const n=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=n*t.a+this.ty*t.c+t.tx,this.ty=n*t.b+this.ty*t.d+t.ty,this}decompose(t){const n=this.a,i=this.b,r=this.c,s=this.d,l=t.pivot,c=-Math.atan2(-r,s),f=Math.atan2(i,n),p=Math.abs(c+f);return p<1e-5||Math.abs(_4-p)<1e-5?(t.rotation=f,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=f),t.scale.x=Math.sqrt(n*n+i*i),t.scale.y=Math.sqrt(r*r+s*s),t.position.x=this.tx+(l.x*n+l.y*r),t.position.y=this.ty+(l.x*i+l.y*s),t}invert(){const t=this.a,n=this.b,i=this.c,r=this.d,s=this.tx,l=t*r-n*i;return this.a=r/l,this.b=-n/l,this.c=-i/l,this.d=t/l,this.tx=(i*this.ty-r*s)/l,this.ty=-(t*this.ty-n*s)/l,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new Ht;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return T4.identity()}static get shared(){return w4.identity()}}const w4=new Ht,T4=new Ht,od=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],cd=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ud=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],dd=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Vv=[],JC=[],Ny=Math.sign;function C4(){for(let e=0;e<16;e++){const t=[];Vv.push(t);for(let n=0;n<16;n++){const i=Ny(od[e]*od[n]+ud[e]*cd[n]),r=Ny(cd[e]*od[n]+dd[e]*cd[n]),s=Ny(od[e]*ud[n]+ud[e]*dd[n]),l=Ny(cd[e]*ud[n]+dd[e]*dd[n]);for(let c=0;c<16;c++)if(od[c]===i&&cd[c]===r&&ud[c]===s&&dd[c]===l){t.push(c);break}}}for(let e=0;e<16;e++){const t=new Ht;t.set(od[e],cd[e],ud[e],dd[e],0,0),JC.push(t)}}C4();const Bn={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:e=>od[e],uY:e=>cd[e],vX:e=>ud[e],vY:e=>dd[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Vv[e][t],sub:(e,t)=>Vv[e][Bn.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)===2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?Bn.S:Bn.N:Math.abs(t)*2<=Math.abs(e)?e>0?Bn.E:Bn.W:t>0?e>0?Bn.SE:Bn.SW:e>0?Bn.NE:Bn.NW,matrixAppendRotationInv:(e,t,n=0,i=0,r=0,s=0)=>{const l=JC[Bn.inv(t)],c=l.a,f=l.b,p=l.c,m=l.d,g=n-Math.min(0,c*r,p*s,c*r+p*s),x=i-Math.min(0,f*r,m*s,f*r+m*s),v=e.a,S=e.b,A=e.c,T=e.d;e.a=c*v+f*A,e.b=c*S+f*T,e.c=p*v+m*A,e.d=p*S+m*T,e.tx=g*v+x*A+e.tx,e.ty=g*S+x*T+e.ty},transformRectCoords:(e,t,n,i)=>{const{x:r,y:s,width:l,height:c}=e,{x:f,y:p,width:m,height:g}=t;return n===Bn.E?(i.set(r+f,s+p,l,c),i):n===Bn.S?i.set(m-s-c+f,r+p,c,l):n===Bn.W?i.set(m-r-l+f,g-s-c+p,l,c):n===Bn.N?i.set(s+f,g-r-l+p,c,l):i.set(r+f,s+p,l,c)}},Oy=[new Lr,new Lr,new Lr,new Lr];class Ti{constructor(t=0,n=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(n),this.width=Number(i),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Ti(0,0,0,0)}clone(){return new Ti(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,n){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&n>=this.y&&n<this.y+this.height}strokeContains(t,n,i,r=.5){const{width:s,height:l}=this;if(s<=0||l<=0)return!1;const c=this.x,f=this.y,p=i*(1-r),m=i-p,g=c-p,x=c+s+p,v=f-p,S=f+l+p,A=c+m,T=c+s-m,C=f+m,N=f+l-m;return t>=g&&t<=x&&n>=v&&n<=S&&!(t>A&&t<T&&n>C&&n<N)}intersects(t,n){if(!n){const Z=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=Z)return!1;const F=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>F}const i=this.left,r=this.right,s=this.top,l=this.bottom;if(r<=i||l<=s)return!1;const c=Oy[0].set(t.left,t.top),f=Oy[1].set(t.left,t.bottom),p=Oy[2].set(t.right,t.top),m=Oy[3].set(t.right,t.bottom);if(p.x<=c.x||f.y<=c.y)return!1;const g=Math.sign(n.a*n.d-n.b*n.c);if(g===0||(n.apply(c,c),n.apply(f,f),n.apply(p,p),n.apply(m,m),Math.max(c.x,f.x,p.x,m.x)<=i||Math.min(c.x,f.x,p.x,m.x)>=r||Math.max(c.y,f.y,p.y,m.y)<=s||Math.min(c.y,f.y,p.y,m.y)>=l))return!1;const x=g*(f.y-c.y),v=g*(c.x-f.x),S=x*i+v*s,A=x*r+v*s,T=x*i+v*l,C=x*r+v*l;if(Math.max(S,A,T,C)<=x*c.x+v*c.y||Math.min(S,A,T,C)>=x*m.x+v*m.y)return!1;const N=g*(c.y-p.y),R=g*(p.x-c.x),D=N*i+R*s,H=N*r+R*s,O=N*i+R*l,q=N*r+R*l;return!(Math.max(D,H,O,q)<=N*c.x+R*c.y||Math.min(D,H,O,q)>=N*m.x+R*m.y)}pad(t=0,n=t){return this.x-=t,this.y-=n,this.width+=t*2,this.height+=n*2,this}fit(t){const n=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=n,this.width=Math.max(i-n,0),this.y=r,this.height=Math.max(s-r,0),this}ceil(t=1,n=.001){const i=Math.ceil((this.x+this.width-n)*t)/t,r=Math.ceil((this.y+this.height-n)*t)/t;return this.x=Math.floor((this.x+n)*t)/t,this.y=Math.floor((this.y+n)*t)/t,this.width=i-this.x,this.height=r-this.y,this}scale(t,n=t){return this.x*=t,this.y*=n,this.width*=t,this.height*=n,this}enlarge(t){const n=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=n,this.width=i-n,this.y=r,this.height=s-r,this}getBounds(t){return t||(t=new Ti),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const n=t.x,i=t.y,r=t.x+t.width,s=t.y+t.height;return n>=this.x&&n<this.x+this.width&&i>=this.y&&i<this.y+this.height&&r>=this.x&&r<this.x+this.width&&s>=this.y&&s<this.y+this.height}set(t,n,i,r){return this.x=t,this.y=n,this.width=i,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const bb={default:-1};function bi(e="default"){return bb[e]===void 0&&(bb[e]=-1),++bb[e]}const CE=new Set,xi="8.0.0",A4="8.3.4",$f={quiet:!1,noColor:!1},en=((e,t,n=3)=>{if($f.quiet||CE.has(t))return;let i=new Error().stack;const r=`${t}
62
62
  Deprecated since v${e}`,s=typeof console.groupCollapsed=="function"&&!$f.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",r):(i=i.split(`
63
63
  `).splice(n).join(`
64
64
  `),s?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",r),console.warn(i))),CE.add(t)});Object.defineProperties(en,{quiet:{get:()=>$f.quiet,set:e=>{$f.quiet=e},enumerable:!0,configurable:!1},noColor:{get:()=>$f.noColor,set:e=>{$f.noColor=e},enumerable:!0,configurable:!1}});const eA=()=>{};function sh(e){return e+=e===0?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}function AE(e){return!(e&e-1)&&!!e}function tA(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}const ME=Object.create(null);function M4(e){const t=ME[e];return t===void 0&&(ME[e]=bi("resource")),t}const nA=class iA extends yo{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...iA.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){en(xi,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=M4(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};nA.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let lh=nA;const rA=class aA extends yo{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=bi("textureSource"),this._resourceType="textureSource",this._resourceId=bi("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...aA.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.viewDimension=t.viewDimension??t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new lh(tA(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var n,i;this.style!==t&&((n=this._style)==null||n.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){var t,n;this._resourceId=bi("resource"),this.emit("change",this),this.emit("unload",this);for(const i in this._gpuData)(n=(t=this._gpuData[i])==null?void 0:t.destroy)==null||n.call(t);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,n,i){i||(i=this._resolution),t||(t=this.width),n||(n=this.height);const r=Math.round(t*i),s=Math.round(n*i);return this.width=r/i,this.height=s/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=s,this.emit("resize",this),this._resourceId=bi("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=AE(this.pixelWidth)&&AE(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};rA.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let Is=rA;class Z1 extends Is{constructor(t){const n=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(n instanceof Float32Array?i="rgba32float":n instanceof Int32Array||n instanceof Uint32Array?i="rgba32uint":n instanceof Int16Array||n instanceof Uint16Array?i="rgba16uint":(n instanceof Int8Array,i="bgra8unorm")),super({...t,resource:n,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Z1.extension=kt.TextureSource;const RE=new Ht;class R4{constructor(t,n){this.mapCoord=new Ht,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof n>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=n,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var n;this.texture!==t&&((n=this._texture)==null||n.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,n){n===void 0&&(n=t);const i=this.mapCoord;for(let r=0;r<t.length;r+=2){const s=t[r],l=t[r+1];n[r]=s*i.a+l*i.c+i.tx,n[r+1]=s*i.b+l*i.d+i.ty}return n}update(){const t=this._texture;this._updateID++;const n=t.uvs;this.mapCoord.set(n.x1-n.x0,n.y1-n.y0,n.x3-n.x0,n.y3-n.y0,n.x0,n.y0);const i=t.orig,r=t.trim;r&&(RE.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(RE));const s=t.source,l=this.uClampFrame,c=this.clampMargin/s._resolution,f=this.clampOffset/s._resolution;return l[0]=(t.frame.x+c+f)/s.width,l[1]=(t.frame.y+c+f)/s.height,l[2]=(t.frame.x+t.frame.width-c+f)/s.width,l[3]=(t.frame.y+t.frame.height-c+f)/s.height,this.uClampOffset[0]=this.clampOffset/s.pixelWidth,this.uClampOffset[1]=this.clampOffset/s.pixelHeight,this.isSimple=t.frame.width===s.width&&t.frame.height===s.height&&t.rotate===0,!0}}class Mn extends yo{constructor({source:t,label:n,frame:i,orig:r,trim:s,defaultAnchor:l,defaultBorders:c,rotate:f,dynamic:p}={}){if(super(),this.uid=bi("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ti,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=n,this.source=(t==null?void 0:t.source)??new Is,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:m,height:g}=this._source;this.frame.width=m,this.frame.height=g}this.orig=r||this.frame,this.trim=s,this.rotate=f??0,this.defaultAnchor=l,this.defaultBorders=c,this.destroyed=!1,this.dynamic=p||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new R4(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:n}=this,{width:i,height:r}=this._source,s=n.x/i,l=n.y/r,c=n.width/i,f=n.height/r;let p=this.rotate;if(p){const m=c/2,g=f/2,x=s+m,v=l+g;p=Bn.add(p,Bn.NW),t.x0=x+m*Bn.uX(p),t.y0=v+g*Bn.uY(p),p=Bn.add(p,2),t.x1=x+m*Bn.uX(p),t.y1=v+g*Bn.uY(p),p=Bn.add(p,2),t.x2=x+m*Bn.uX(p),t.y2=v+g*Bn.uY(p),p=Bn.add(p,2),t.x3=x+m*Bn.uX(p),t.y3=v+g*Bn.uY(p)}else t.x0=s,t.y0=l,t.x1=s+c,t.y1=l,t.x2=s+c,t.y2=l+f,t.x3=s,t.y3=l+f}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return en(xi,"Texture.baseTexture is now Texture.source"),this._source}}Mn.EMPTY=new Mn({label:"EMPTY",source:new Is({label:"EMPTY"})});Mn.EMPTY.destroy=eA;Mn.WHITE=new Mn({source:new Z1({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});Mn.WHITE.destroy=eA;function sA(e,t,n){const{width:i,height:r}=n.orig,s=n.trim;if(s){const l=s.width,c=s.height;e.minX=s.x-t._x*i,e.maxX=e.minX+l,e.minY=s.y-t._y*r,e.maxY=e.minY+c}else e.minX=-t._x*i,e.maxX=e.minX+i,e.minY=-t._y*r,e.maxY=e.minY+r}const kE=new Ht;class js{constructor(t=1/0,n=1/0,i=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=kE,this.minX=t,this.minY=n,this.maxX=i,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Ti);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=kE,this}set(t,n,i,r){this.minX=t,this.minY=n,this.maxX=i,this.maxY=r}addFrame(t,n,i,r,s){s||(s=this.matrix);const l=s.a,c=s.b,f=s.c,p=s.d,m=s.tx,g=s.ty;let x=this.minX,v=this.minY,S=this.maxX,A=this.maxY,T=l*t+f*n+m,C=c*t+p*n+g;T<x&&(x=T),C<v&&(v=C),T>S&&(S=T),C>A&&(A=C),T=l*i+f*n+m,C=c*i+p*n+g,T<x&&(x=T),C<v&&(v=C),T>S&&(S=T),C>A&&(A=C),T=l*t+f*r+m,C=c*t+p*r+g,T<x&&(x=T),C<v&&(v=C),T>S&&(S=T),C>A&&(A=C),T=l*i+f*r+m,C=c*i+p*r+g,T<x&&(x=T),C<v&&(v=C),T>S&&(S=T),C>A&&(A=C),this.minX=x,this.minY=v,this.maxX=S,this.maxY=A}addRect(t,n){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,n)}addBounds(t,n){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,n)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const n=this.minX,i=this.minY,r=this.maxX,s=this.maxY,{a:l,b:c,c:f,d:p,tx:m,ty:g}=t;let x=l*n+f*i+m,v=c*n+p*i+g;this.minX=x,this.minY=v,this.maxX=x,this.maxY=v,x=l*r+f*i+m,v=c*r+p*i+g,this.minX=x<this.minX?x:this.minX,this.minY=v<this.minY?v:this.minY,this.maxX=x>this.maxX?x:this.maxX,this.maxY=v>this.maxY?v:this.maxY,x=l*n+f*s+m,v=c*n+p*s+g,this.minX=x<this.minX?x:this.minX,this.minY=v<this.minY?v:this.minY,this.maxX=x>this.maxX?x:this.maxX,this.maxY=v>this.maxY?v:this.maxY,x=l*r+f*s+m,v=c*r+p*s+g,this.minX=x<this.minX?x:this.minX,this.minY=v<this.minY?v:this.minY,this.maxX=x>this.maxX?x:this.maxX,this.maxY=v>this.maxY?v:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,n,i,r){return this.minX<t&&(this.minX=t),this.maxX>n&&(this.maxX=n),this.minY<i&&(this.minY=i),this.maxY>r&&(this.maxY=r),this}pad(t,n=t){return this.minX-=t,this.maxX+=t,this.minY-=n,this.maxY+=n,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new js(this.minX,this.minY,this.maxX,this.maxY)}scale(t,n=t){return this.minX*=t,this.minY*=n,this.maxX*=t,this.maxY*=n,this}get x(){return this.minX}set x(t){const n=this.maxX-this.minX;this.minX=t,this.maxX=t+n}get y(){return this.minY}set y(t){const n=this.maxY-this.minY;this.minY=t,this.maxY=t+n}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,n,i,r){let s=this.minX,l=this.minY,c=this.maxX,f=this.maxY;r||(r=this.matrix);const p=r.a,m=r.b,g=r.c,x=r.d,v=r.tx,S=r.ty;for(let A=n;A<i;A+=2){const T=t[A],C=t[A+1],N=p*T+g*C+v,R=m*T+x*C+S;s=N<s?N:s,l=R<l?R:l,c=N>c?N:c,f=R>f?R:f}this.minX=s,this.minY=l,this.maxX=c,this.maxY=f}containsPoint(t,n){return this.minX<=t&&this.minY<=n&&this.maxX>=t&&this.maxY>=n}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var k4={grad:.9,turn:360,rad:360/(2*Math.PI)},Qo=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},ar=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Bs=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},lA=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},NE=function(e){return{r:Bs(e.r,0,255),g:Bs(e.g,0,255),b:Bs(e.b,0,255),a:Bs(e.a)}},vb=function(e){return{r:ar(e.r),g:ar(e.g),b:ar(e.b),a:ar(e.a,3)}},N4=/^#([0-9a-f]{3,8})$/i,Dy=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},oA=function(e){var t=e.r,n=e.g,i=e.b,r=e.a,s=Math.max(t,n,i),l=s-Math.min(t,n,i),c=l?s===t?(n-i)/l:s===n?2+(i-t)/l:4+(t-n)/l:0;return{h:60*(c<0?c+6:c),s:s?l/s*100:0,v:s/255*100,a:r}},cA=function(e){var t=e.h,n=e.s,i=e.v,r=e.a;t=t/360*6,n/=100,i/=100;var s=Math.floor(t),l=i*(1-n),c=i*(1-(t-s)*n),f=i*(1-(1-t+s)*n),p=s%6;return{r:255*[i,c,l,l,f,i][p],g:255*[f,i,i,c,l,l][p],b:255*[l,l,f,i,i,c][p],a:r}},OE=function(e){return{h:lA(e.h),s:Bs(e.s,0,100),l:Bs(e.l,0,100),a:Bs(e.a)}},DE=function(e){return{h:ar(e.h),s:ar(e.s),l:ar(e.l),a:ar(e.a,3)}},zE=function(e){return cA((n=(t=e).s,{h:t.h,s:(n*=((i=t.l)<50?i:100-i)/100)>0?2*n/(i+n)*100:0,v:i+n,a:t.a}));var t,n,i},_m=function(e){return{h:(t=oA(e)).h,s:(r=(200-(n=t.s))*(i=t.v)/100)>0&&r<200?n*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,i,r},O4=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D4=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z4=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,B4=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xv={string:[[function(e){var t=N4.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?ar(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?ar(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=z4.exec(e)||B4.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:NE({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=O4.exec(e)||D4.exec(e);if(!t)return null;var n,i,r=OE({h:(n=t[1],i=t[2],i===void 0&&(i="deg"),Number(n)*(k4[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return zE(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,i=e.b,r=e.a,s=r===void 0?1:r;return Qo(t)&&Qo(n)&&Qo(i)?NE({r:Number(t),g:Number(n),b:Number(i),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,i=e.l,r=e.a,s=r===void 0?1:r;if(!Qo(t)||!Qo(n)||!Qo(i))return null;var l=OE({h:Number(t),s:Number(n),l:Number(i),a:Number(s)});return zE(l)},"hsl"],[function(e){var t=e.h,n=e.s,i=e.v,r=e.a,s=r===void 0?1:r;if(!Qo(t)||!Qo(n)||!Qo(i))return null;var l=(function(c){return{h:lA(c.h),s:Bs(c.s,0,100),v:Bs(c.v,0,100),a:Bs(c.a)}})({h:Number(t),s:Number(n),v:Number(i),a:Number(s)});return cA(l)},"hsv"]]},BE=function(e,t){for(var n=0;n<t.length;n++){var i=t[n][0](e);if(i)return[i,t[n][1]]}return[null,void 0]},L4=function(e){return typeof e=="string"?BE(e.trim(),Xv.string):typeof e=="object"&&e!==null?BE(e,Xv.object):[null,void 0]},_b=function(e,t){var n=_m(e);return{h:n.h,s:Bs(n.s+100*t,0,100),l:n.l,a:n.a}},Sb=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},LE=function(e,t){var n=_m(e);return{h:n.h,s:n.s,l:Bs(n.l+100*t,0,100),a:n.a}},Kv=(function(){function e(t){this.parsed=L4(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return ar(Sb(this.rgba),2)},e.prototype.isDark=function(){return Sb(this.rgba)<.5},e.prototype.isLight=function(){return Sb(this.rgba)>=.5},e.prototype.toHex=function(){return t=vb(this.rgba),n=t.r,i=t.g,r=t.b,l=(s=t.a)<1?Dy(ar(255*s)):"","#"+Dy(n)+Dy(i)+Dy(r)+l;var t,n,i,r,s,l},e.prototype.toRgb=function(){return vb(this.rgba)},e.prototype.toRgbString=function(){return t=vb(this.rgba),n=t.r,i=t.g,r=t.b,(s=t.a)<1?"rgba("+n+", "+i+", "+r+", "+s+")":"rgb("+n+", "+i+", "+r+")";var t,n,i,r,s},e.prototype.toHsl=function(){return DE(_m(this.rgba))},e.prototype.toHslString=function(){return t=DE(_m(this.rgba)),n=t.h,i=t.s,r=t.l,(s=t.a)<1?"hsla("+n+", "+i+"%, "+r+"%, "+s+")":"hsl("+n+", "+i+"%, "+r+"%)";var t,n,i,r,s},e.prototype.toHsv=function(){return t=oA(this.rgba),{h:ar(t.h),s:ar(t.s),v:ar(t.v),a:ar(t.a,3)};var t},e.prototype.invert=function(){return oo({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),oo(_b(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),oo(_b(this.rgba,-t))},e.prototype.grayscale=function(){return oo(_b(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),oo(LE(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),oo(LE(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?oo({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):ar(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=_m(this.rgba);return typeof t=="number"?oo({h:t,s:n.s,l:n.l,a:n.a}):ar(n.h)},e.prototype.isEqual=function(t){return this.toHex()===oo(t).toHex()},e})(),oo=function(e){return e instanceof Kv?e:new Kv(e)},jE=[],j4=function(e){e.forEach(function(t){jE.indexOf(t)<0&&(t(Kv,Xv),jE.push(t))})};function I4(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in n)i[n[r]]=r;var s={};e.prototype.toName=function(l){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var c,f,p=i[this.toHex()];if(p)return p;if(l!=null&&l.closest){var m=this.toRgb(),g=1/0,x="black";if(!s.length)for(var v in n)s[v]=new e(n[v]).toRgb();for(var S in n){var A=(c=m,f=s[S],Math.pow(c.r-f.r,2)+Math.pow(c.g-f.g,2)+Math.pow(c.b-f.b,2));A<g&&(g=A,x=S)}return x}},t.string.push([function(l){var c=l.toLowerCase(),f=c==="transparent"?"#0000":n[c];return f?new e(f).toRgb():null},"name"])}j4([I4]);const oh=class hm{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof hm)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,n){const i=typeof t;if(i!==typeof n)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===n;if(Array.isArray(t)&&Array.isArray(n)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(n))return t.length!==n.length?!1:t.every((s,l)=>s===n[l]);if(t!==null&&n!==null){const s=Object.keys(t),l=Object.keys(n);return s.length!==l.length?!1:s.every(c=>t[c]===n[c])}return t===n}toRgba(){const[t,n,i,r]=this._components;return{r:t,g:n,b:i,a:r}}toRgb(){const[t,n,i]=this._components;return{r:t,g:n,b:i}}toRgbaString(){const[t,n,i]=this.toUint8RgbArray();return`rgba(${t},${n},${i},${this.alpha})`}toUint8RgbArray(t){const[n,i,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(n*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[n,i,r,s]=this._components;return t[0]=n,t[1]=i,t[2]=r,t[3]=s,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[n,i,r]=this._components;return t[0]=n,t[1]=i,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,n,i]=this.toUint8RgbArray();return(i<<16)+(n<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[n,i,r,s]=hm._temp.setValue(t)._components;return this._components[0]*=n,this._components[1]*=i,this._components[2]*=r,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(t,n=!0){return n&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,n=!0){if(t===1)return(255<<24)+this._int;if(t===0)return n?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,s=this._int&255;return n&&(i=i*t+.5|0,r=r*t+.5|0,s=s*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+s}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const n=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-n.length)+n}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(t){let n,i,r,s;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const l=t;n=(l>>16&255)/255,i=(l>>8&255)/255,r=(l&255)/255,s=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[n,i,r,s=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[n,i,r,s=255]=t,n/=255,i/=255,r/=255,s/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const c=hm.HEX_PATTERN.exec(t);c&&(t=`#${c[2]}`)}const l=oo(t);l.isValid()&&({r:n,g:i,b:r,a:s}=l.rgba,n/=255,i/=255,r/=255)}if(n!==void 0)this._components[0]=n,this._components[1]=i,this._components[2]=r,this._components[3]=s,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,n,i]=this._components;this._int=(t*255<<16)+(n*255<<8)+(i*255|0)}_clamp(t,n=0,i=1){return typeof t=="number"?Math.min(Math.max(t,n),i):(t.forEach((r,s)=>{t[s]=Math.min(Math.max(r,n),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof hm||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};oh.shared=new oh;oh._temp=new oh;oh.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let qi=oh;const U4={cullArea:null,cullable:!1,cullableChildren:!0};let Eb=0;const IE=500;function ma(...e){Eb!==IE&&(Eb++,Eb===IE?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...e))}const Qm={_registeredResources:new Set,register(e){this._registeredResources.add(e)},unregister(e){this._registeredResources.delete(e)},release(){this._registeredResources.forEach(e=>e.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(e){return this._registeredResources.has(e)},reset(){this._registeredResources.clear()}};class H4{constructor(t,n){this._pool=[],this._count=0,this._index=0,this._classType=t,n&&this.prepopulate(n)}prepopulate(t){for(let n=0;n<t;n++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){var i;let n;return this._index>0?n=this._pool[--this._index]:(n=new this._classType,this._count++),(i=n.init)==null||i.call(n,t),n}return(t){var n;(n=t.reset)==null||n.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}class P4{constructor(){this._poolsByClass=new Map}prepopulate(t,n){this.getPool(t).prepopulate(n)}get(t,n){return this.getPool(t).get(n)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new H4(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(n=>{const i=t[n._classType.name]?n._classType.name+n._classType.ID:n._classType.name;t[i]={free:n.totalFree,used:n.totalUsed,size:n.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const Da=new P4;Qm.register(Da);const F4={get isCachedAsTexture(){var e;return!!((e=this.renderGroup)!=null&&e.isCachedAsTexture)},cacheAsTexture(e){typeof e=="boolean"&&e===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(e===!0?{}:e))},updateCacheTexture(){var e;(e=this.renderGroup)==null||e.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(e){en("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(e)}};function G4(e,t,n){const i=e.length;let r;if(t>=i||n===0)return;n=t+n>i?i-t:n;const s=i-n;for(r=t;r<s;++r)e[r]=e[r+n];e.length=s}const q4={allowChildren:!0,removeChildren(e=0,t){var s;const n=t??this.children.length,i=n-e,r=[];if(i>0&&i<=n){for(let c=n-1;c>=e;c--){const f=this.children[c];f&&(r.push(f),f.parent=null)}G4(this.children,e,n);const l=this.renderGroup||this.parentRenderGroup;l&&l.removeChildren(r);for(let c=0;c<r.length;++c){const f=r[c];(s=f.parentRenderLayer)==null||s.detach(f),this.emit("childRemoved",f,this,c),r[c].emit("removed",this)}return r.length>0&&this._didViewChangeTick++,r}else if(i===0&&this.children.length===0)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(e){const t=this.getChildAt(e);return this.removeChild(t)},getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]},setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(e),this.addChildAt(e,t)},getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(e,t){this.allowChildren||en(xi,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:n}=this;if(t<0||t>n.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${n.length}`);const i=e.parent===this;if(e.parent){const s=e.parent.children.indexOf(e);if(i){if(s===t)return e;e.parent.children.splice(s,1)}else e.removeFromParent()}t===n.length?n.push(e):n.splice(t,0,e),e.parent=this,e.didChange=!0,e._updateFlags=15;const r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(e),this.sortableChildren&&(this.sortDirty=!0),i||(this.emit("childAdded",e,this,t),e.emit("added",this)),e},swapChildren(e,t){if(e===t)return;const n=this.getChildIndex(e),i=this.getChildIndex(t);this.children[n]=t,this.children[i]=e;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var e;(e=this.parent)==null||e.removeChild(this)},reparentChild(...e){return e.length===1?this.reparentChildAt(e[0],this.children.length):(e.forEach(t=>this.reparentChildAt(t,this.children.length)),e[0])},reparentChildAt(e,t){if(e.parent===this)return this.setChildIndex(e,t),e;const n=e.worldTransform.clone();e.removeFromParent(),this.addChildAt(e,t);const i=this.worldTransform.clone();return i.invert(),n.prepend(i),e.setFromMatrix(n),e},replaceChild(e,t){e.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(e)),t.setFromMatrix(e.localTransform),t.updateLocalTransform(),this.removeChild(e)}},Y4={collectRenderables(e,t,n){this.parentRenderLayer&&this.parentRenderLayer!==n||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(e,t,n):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,e):this.collectRenderablesWithEffects(e,t,n))},collectRenderablesSimple(e,t,n){const i=this.children,r=i.length;for(let s=0;s<r;s++)i[s].collectRenderables(e,t,n)},collectRenderablesWithEffects(e,t,n){const{renderPipes:i}=t;for(let r=0;r<this.effects.length;r++){const s=this.effects[r];i[s.pipe].push(s,this,e)}this.collectRenderablesSimple(e,t,n);for(let r=this.effects.length-1;r>=0;r--){const s=this.effects[r];i[s.pipe].pop(s,this,e)}}};class UE{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}class V4{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let n=0;n<this._tests.length;n++){const i=this._tests[n];if(i.test(t))return Da.get(i.maskClass,t)}return t}returnMaskEffect(t){Da.return(t)}}const $v=new V4;li.handleByList(kt.MaskEffect,$v._effectClasses);const X4={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0)},addEffect(e){this.effects.indexOf(e)===-1&&(this.effects.push(e),this.effects.sort((n,i)=>n.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(e){const t=this.effects.indexOf(e);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(e){const t=this._maskEffect;(t==null?void 0:t.mask)!==e&&(t&&(this.removeEffect(t),$v.returnMaskEffect(t),this._maskEffect=null),e!=null&&(this._maskEffect=$v.getMaskEffect(e),this.addEffect(this._maskEffect)))},get mask(){var e;return(e=this._maskEffect)==null?void 0:e.mask},setMask(e){this._maskOptions={...this._maskOptions,...e},e.mask&&(this.mask=e.mask),this._markStructureAsChanged()},set filters(e){var s;!Array.isArray(e)&&e&&(e=[e]);const t=this._filterEffect||(this._filterEffect=new UE);e=e;const n=(e==null?void 0:e.length)>0,i=((s=t.filters)==null?void 0:s.length)>0,r=n!==i;e=Array.isArray(e)?e.slice(0):e,t.filters=Object.freeze(e),r&&(n?this.addEffect(t):(this.removeEffect(t),t.filters=e??null))},get filters(){var e;return(e=this._filterEffect)==null?void 0:e.filters},set filterArea(e){this._filterEffect||(this._filterEffect=new UE),this._filterEffect.filterArea=e},get filterArea(){var e;return(e=this._filterEffect)==null?void 0:e.filterArea}},K4={label:null,get name(){return en(xi,"Container.name property has been removed, use Container.label instead"),this.label},set name(e){en(xi,"Container.name property has been removed, use Container.label instead"),this.label=e},getChildByName(e,t=!1){return this.getChildByLabel(e,t)},getChildByLabel(e,t=!1){const n=this.children;for(let i=0;i<n.length;i++){const r=n[i];if(r.label===e||e instanceof RegExp&&e.test(r.label))return r}if(t)for(let i=0;i<n.length;i++){const s=n[i].getChildByLabel(e,!0);if(s)return s}return null},getChildrenByLabel(e,t=!1,n=[]){const i=this.children;for(let r=0;r<i.length;r++){const s=i[r];(s.label===e||e instanceof RegExp&&e.test(s.label))&&n.push(s)}if(t)for(let r=0;r<i.length;r++)i[r].getChildrenByLabel(e,!0,n);return n}},pa=Da.getPool(Ht),rc=Da.getPool(js),$4=new Ht,W4={getFastGlobalBounds(e,t){t||(t=new js),t.clear(),this._getGlobalBoundsRecursive(!!e,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const n=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(n.worldTransform),t},_getGlobalBoundsRecursive(e,t,n){let i=t;if(e&&this.parentRenderLayer&&this.parentRenderLayer!==n||this.localDisplayStatus!==7||!this.measurable)return;const r=!!this.effects.length;if((this.renderGroup||r)&&(i=rc.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const l=this.bounds;i.addFrame(l.minX,l.minY,l.maxX,l.maxY,this.groupTransform)}const s=this.children;for(let l=0;l<s.length;l++)s[l]._getGlobalBoundsRecursive(e,i,n)}if(r){let s=!1;const l=this.renderGroup||this.parentRenderGroup;for(let c=0;c<this.effects.length;c++)this.effects[c].addBounds&&(s||(s=!0,i.applyMatrix(l.worldTransform)),this.effects[c].addBounds(i,!0));s&&i.applyMatrix(l.worldTransform.copyTo($4).invert()),t.addBounds(i),rc.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),rc.return(i))}};function uA(e,t,n){n.clear();let i,r;return e.parent?t?i=e.parent.worldTransform:(r=pa.get().identity(),i=J1(e,r)):i=Ht.IDENTITY,dA(e,n,i,t),r&&pa.return(r),n.isValid||n.set(0,0,0,0),n}function dA(e,t,n,i){var c,f;if(!e.visible||!e.measurable)return;let r;i?r=e.worldTransform:(e.updateLocalTransform(),r=pa.get(),r.appendFrom(e.localTransform,n));const s=t,l=!!e.effects.length;if(l&&(t=rc.get().clear()),e.boundsArea)t.addRect(e.boundsArea,r);else{const p=e.bounds;p&&!p.isEmpty()&&(t.matrix=r,t.addBounds(p));for(let m=0;m<e.children.length;m++)dA(e.children[m],t,r,i)}if(l){for(let p=0;p<e.effects.length;p++)(f=(c=e.effects[p]).addBounds)==null||f.call(c,t);s.addBounds(t,Ht.IDENTITY),rc.return(t)}i||pa.return(r)}function J1(e,t){const n=e.parent;return n&&(J1(n,t),n.updateLocalTransform(),t.append(n.localTransform)),t}function fA(e,t){if(e===16777215||!t)return t;if(t===16777215||!e)return e;const n=e>>16&255,i=e>>8&255,r=e&255,s=t>>16&255,l=t>>8&255,c=t&255,f=n*s/255|0,p=i*l/255|0,m=r*c/255|0;return(f<<16)+(p<<8)+m}const HE=16777215;function PE(e,t){return e===HE?t:t===HE?e:fA(e,t)}function g0(e){return((e&255)<<16)+(e&65280)+(e>>16&255)}const Q4={getGlobalAlpha(e){if(e)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,n=this.parent;for(;n;)t*=n.alpha,n=n.parent;return t},getGlobalTransform(e=new Ht,t){if(t)return e.copyFrom(this.worldTransform);this.updateLocalTransform();const n=J1(this,pa.get().identity());return e.appendFrom(this.localTransform,n),pa.return(n),e},getGlobalTint(e){if(e)return this.renderGroup?g0(this.renderGroup.worldColor):this.parentRenderGroup?g0(PE(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,n=this.parent;for(;n;)t=PE(t,n.localColor),n=n.parent;return g0(t)}};function hA(e,t,n){return t.clear(),n||(n=Ht.IDENTITY),pA(e,t,n,e,!0),t.isValid||t.set(0,0,0,0),t}function pA(e,t,n,i,r){var f,p;let s;if(r)s=pa.get(),s=n.copyTo(s);else{if(!e.visible||!e.measurable)return;e.updateLocalTransform();const m=e.localTransform;s=pa.get(),s.appendFrom(m,n)}const l=t,c=!!e.effects.length;if(c&&(t=rc.get().clear()),e.boundsArea)t.addRect(e.boundsArea,s);else{e.renderPipeId&&(t.matrix=s,t.addBounds(e.bounds));const m=e.children;for(let g=0;g<m.length;g++)pA(m[g],t,s,i,!1)}if(c){for(let m=0;m<e.effects.length;m++)(p=(f=e.effects[m]).addLocalBounds)==null||p.call(f,t,i);l.addBounds(t,Ht.IDENTITY),rc.return(t)}pa.return(s)}function mA(e,t){const n=e.children;for(let i=0;i<n.length;i++){const r=n[i],s=r.uid,l=(r._didViewChangeTick&65535)<<16|r._didContainerChangeTick&65535,c=t.index;(t.data[c]!==s||t.data[c+1]!==l)&&(t.data[t.index]=s,t.data[t.index+1]=l,t.didChange=!0),t.index=c+2,r.children.length&&mA(r,t)}return t.didChange}const Z4=new Ht,J4={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(e,t){const n=Math.sign(this.scale.x)||1;t!==0?this.scale.x=e/t*n:this.scale.x=n},_setHeight(e,t){const n=Math.sign(this.scale.y)||1;t!==0?this.scale.y=e/t*n:this.scale.y=n},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new js});const e=this._localBoundsCacheData;return e.index=1,e.didChange=!1,e.data[0]!==this._didViewChangeTick&&(e.didChange=!0,e.data[0]=this._didViewChangeTick),mA(this,e),e.didChange&&hA(this,e.localBounds,Z4),e.localBounds},getBounds(e,t){return uA(this,e,t||new js)}},ez={_onRender:null,set onRender(e){const t=this.renderGroup||this.parentRenderGroup;if(!e){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=e},get onRender(){return this._onRender}},tz={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(nz))}};function nz(e,t){return e._zIndex-t._zIndex}const iz={getGlobalPosition(e=new Lr,t=!1){return this.parent?this.parent.toGlobal(this._position,e,t):(e.x=this._position.x,e.y=this._position.y),e},toGlobal(e,t,n=!1){const i=this.getGlobalTransform(pa.get(),n);return t=i.apply(e,t),pa.return(i),t},toLocal(e,t,n,i){t&&(e=t.toGlobal(e,n,i));const r=this.getGlobalTransform(pa.get(),i);return n=r.applyInverse(e,n),pa.return(r),n}};class e_{constructor(){this.uid=bi("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let rz=0;class az{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new lh(this.textureOptions)}createTexture(t,n,i,r){const s=new Is({...this.textureOptions,width:t,height:n,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:r});return new Mn({source:s,label:`texturePool_${rz++}`})}getOptimalTexture(t,n,i=1,r,s=!1){let l=Math.ceil(t*i-1e-6),c=Math.ceil(n*i-1e-6);l=sh(l),c=sh(c);const f=r?1:0,p=s?1:0,m=(l<<17)+(c<<2)+(p<<1)+f;this._texturePool[m]||(this._texturePool[m]=[]);let g=this._texturePool[m].pop();return g||(g=this.createTexture(l,c,r,s)),g.source._resolution=i,g.source.width=l/i,g.source.height=c/i,g.source.pixelWidth=l,g.source.pixelHeight=c,g.frame.x=0,g.frame.y=0,g.frame.width=t,g.frame.height=n,g.updateUvs(),this._poolKeyHash[g.uid]=m,g}getSameSizeTexture(t,n=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,n)}returnTexture(t,n=!1){const i=this._poolKeyHash[t.uid];n&&(t.source.style=this.textureStyle),this._texturePool[i].push(t)}clear(t){if(t=t!==!1,t)for(const n in this._texturePool){const i=this._texturePool[n];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0)}this._texturePool={}}}const ex=new az;Qm.register(ex);class sz{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new Ht,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new e_,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const n=t.children;for(let i=0;i<n.length;i++){const r=n[i];r._updateFlags=15,this.addChild(r)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(ex.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const n=this.childrenToUpdate[t];n.list.fill(null),n.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const n=this.renderGroupChildren.indexOf(t);n>-1&&this.renderGroupChildren.splice(n,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const n=t.children;for(let i=0;i<n.length;i++)this.addChild(n[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const n=t.children;for(let i=0;i<n.length;i++)this.removeChild(n[i])}removeChildren(t){for(let n=0;n<t.length;n++)this.removeChild(t[n])}onChildUpdate(t){let n=this.childrenToUpdate[t.relativeRenderGroupDepth];n||(n=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),n.list[n.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let n=0;n<this._onRenderContainers.length;n++)this._onRenderContainers[n]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const n=this.root.children;for(let i=0;i<n.length;i++)this._getChildren(n[i],t);return t}_getChildren(t,n=[]){if(n.push(t),t.renderGroup)return n;const i=t.children;for(let r=0;r<i.length;r++)this._getChildren(i[r],n);return n}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new Ht),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new Ht),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new Ht),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function lz(e,t,n={}){for(const i in t)!n[i]&&t[i]!==void 0&&(e[i]=t[i])}const wb=new br(null),zy=new br(null),Tb=new br(null,1,1),By=new br(null),FE=1,oz=2,Cb=4;class _r extends yo{constructor(t={}){var n,i;super(),this.uid=bi("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new Ht,this.relativeGroupTransform=new Ht,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new br(this,0,0),this._scale=Tb,this._pivot=zy,this._origin=By,this._skew=wb,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],lz(this,t,{children:!0,parent:!0,effects:!0}),(n=t.children)==null||n.forEach(r=>this.addChild(r)),(i=t.parent)==null||i.addChild(this)}static mixin(t){en("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),li.mixin(_r,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||en(xi,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r<t.length;r++)this.addChild(t[r]);return t[0]}const n=t[0],i=this.renderGroup||this.parentRenderGroup;return n.parent===this?(this.children.splice(this.children.indexOf(n),1),this.children.push(n),i&&(i.structureDidChange=!0),n):(n.parent&&n.parent.removeChild(n),this.children.push(n),this.sortableChildren&&(this.sortDirty=!0),n.parent=this,n.didChange=!0,n._updateFlags=15,i&&i.addChild(n),this.emit("childAdded",n,this,this.children.length-1),n.emit("added",this),this._didViewChangeTick++,n._zIndex!==0&&n.depthOfChildModified(),n)}removeChild(...t){if(t.length>1){for(let r=0;r<t.length;r++)this.removeChild(t[r]);return t[0]}const n=t[0],i=this.children.indexOf(n);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(n):this.parentRenderGroup&&this.parentRenderGroup.removeChild(n),n.parentRenderLayer&&n.parentRenderLayer.detach(n),n.parent=null,this.emit("childRemoved",n,this,i),n.emit("removed",this)),n}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=Da.get(sz,this),this.groupTransform=Ht.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),Da.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new Ht),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*S4}set angle(t){this.rotation=t*E4}get pivot(){return this._pivot===zy&&(this._pivot=new br(this,0,0)),this._pivot}set pivot(t){this._pivot===zy&&(this._pivot=new br(this,0,0),this._origin!==By&&ma("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===wb&&(this._skew=new br(this,0,0)),this._skew}set skew(t){this._skew===wb&&(this._skew=new br(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Tb&&(this._scale=new br(this,1,1)),this._scale}set scale(t){this._scale===Tb&&(this._scale=new br(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===By&&(this._origin=new br(this,0,0)),this._origin}set origin(t){this._origin===By&&(this._origin=new br(this,0,0),this._pivot!==zy&&ma("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const n=this.getLocalBounds().width;this._setWidth(t,n)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const n=this.getLocalBounds().height;this._setHeight(t,n)}getSize(t){t||(t={});const n=this.getLocalBounds();return t.width=Math.abs(this.scale.x*n.width),t.height=Math.abs(this.scale.y*n.height),t}setSize(t,n){const i=this.getLocalBounds();typeof t=="object"?(n=t.height??t.width,t=t.width):n??(n=t),t!==void 0&&this._setWidth(t,i.width),n!==void 0&&this._setHeight(n,i.height)}_updateSkew(){const t=this._rotation,n=this._skew;this._cx=Math.cos(t+n._y),this._sx=Math.sin(t+n._y),this._cy=-Math.sin(t-n._x),this._sy=Math.cos(t-n._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const n=this.localTransform,i=this._scale,r=this._pivot,s=this._origin,l=this._position,c=i._x,f=i._y,p=r._x,m=r._y,g=-s._x,x=-s._y;n.a=this._cx*c,n.b=this._sx*c,n.c=this._cy*f,n.d=this._sy*f,n.tx=l._x-(p*n.a+m*n.c)+(g*n.a+x*n.c)-g,n.ty=l._y-(p*n.b+m*n.d)+(g*n.b+x*n.d)-x}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=FE,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=qi.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=FE,this._onUpdate())}get tint(){return g0(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=oz,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const n=t?2:0;(this.localDisplayStatus&2)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Cb,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const n=t?0:4;(this.localDisplayStatus&4)!==n&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Cb,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const n=t?1:0;(this.localDisplayStatus&1)!==n&&(this._updateFlags|=Cb,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var r;if(this.destroyed)return;this.destroyed=!0;let n;if(this.children.length&&(n=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t==null?void 0:t.children)&&n)for(let s=0;s<n.length;++s)n[s].destroy(t);(r=this.renderGroup)==null||r.destroy(),this.renderGroup=null}}li.mixin(_r,q4,W4,iz,ez,J4,X4,K4,tz,U4,F4,Q4,Y4);class t_ extends _r{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new js(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const n=this.bounds,{x:i,y:r}=t;return i>=n.minX&&i<=n.maxX&&r>=n.minY&&r<=n.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){var t;this.emit("unload",this);for(const n in this._gpuData)(t=this._gpuData[n])==null||t.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,n,i){const{renderPipes:r}=n;r.blendMode.pushBlendMode(this,this.groupBlendMode,t);const l=r[this.renderPipeId];l!=null&&l.addRenderable&&l.addRenderable(this,t),this.didViewUpdate=!1;const c=this.children,f=c.length;for(let p=0;p<f;p++)c[p].collectRenderables(t,n,i);r.blendMode.popBlendMode(t)}}class ch extends t_{constructor(t=Mn.EMPTY){t instanceof Mn&&(t={texture:t});const{texture:n=Mn.EMPTY,anchor:i,roundPixels:r,width:s,height:l,...c}=t;super({label:"Sprite",...c}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new br({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:n.defaultAnchor&&(this.anchor=n.defaultAnchor),this.texture=n,this.allowChildren=!1,this.roundPixels=r??!1,s!==void 0&&(this.width=s),l!==void 0&&(this.height=l)}static from(t,n=!1){return t instanceof Mn?new ch(t):new ch(Mn.from(t,n))}set texture(t){t||(t=Mn.EMPTY);const n=this._texture;n!==t&&(n&&n.dynamic&&n.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return sA(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return en("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,n=this._texture,i=this._bounds,{width:r,height:s}=n.orig;i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,n){typeof t=="object"?(n=t.height??t.width,t=t.width):n??(n=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),n!==void 0&&this._setHeight(n,this._texture.orig.height)}}const cz=new js;function gA(e,t,n){const i=cz;e.measurable=!0,uA(e,n,i),t.addBoundsMask(i),e.measurable=!1}function yA(e,t,n){const i=rc.get();e.measurable=!0;const r=pa.get().identity(),s=xA(e,n,r);hA(e,i,s),e.measurable=!1,t.addBoundsMask(i),pa.return(r),rc.return(i)}function xA(e,t,n){return e?(e!==t&&(xA(e.parent,t,n),e.updateLocalTransform(),n.append(e.localTransform)),n):(ma("Mask bounds, renderable is not inside the root container"),n)}class bA{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof ch),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,n){this.inverse||gA(this.mask,t,n)}addLocalBounds(t,n){yA(this.mask,t,n)}containsPoint(t,n){const i=this.mask;return n(i,t)}destroy(){this.reset()}static test(t){return t instanceof ch}}bA.extension=kt.MaskEffect;class vA{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}vA.extension=kt.MaskEffect;class _A{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,n){gA(this.mask,t,n)}addLocalBounds(t,n){yA(this.mask,t,n)}containsPoint(t,n){const i=this.mask;return n(i,t)}destroy(){this.reset()}static test(t){return t instanceof _r}}_A.extension=kt.MaskEffect;const uz={createCanvas:(e,t)=>{const n=document.createElement("canvas");return n.width=e,n.height=t,n},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>new DOMParser().parseFromString(e,"text/xml")};let GE=uz;const is={get(){return GE},set(e){GE=e}};class SA extends Is{constructor(t){t.resource||(t.resource=is.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,n=this.height,i=this._resolution){const r=super.resize(t,n,i);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}SA.extension=kt.TextureSource;class A0 extends Is{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}A0.extension=kt.TextureSource;var M0=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(M0||{});class Ab{constructor(t,n=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=n,this.priority=i,this._once=r}match(t,n=null){return this._fn===t&&this._context===n}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const n=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),n}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const n=this.next;return this.next=t?null:n,this.previous=null,n}}const EA=class Ja{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Ab(null,null,1/0),this.deltaMS=1/Ja.targetFPMS,this.elapsedMS=1/Ja.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,n,i=M0.NORMAL){return this._addListener(new Ab(t,n,i))}addOnce(t,n,i=M0.NORMAL){return this._addListener(new Ab(t,n,i,!0))}_addListener(t){let n=this._head.next,i=this._head;if(!n)t.connect(i);else{for(;n;){if(t.priority>n.priority){t.connect(i);break}i=n,n=n.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,n){let i=this._head.next;for(;i;)i.match(t,n)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,n=this._head;for(;n=n.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let n;if(t>this.lastTime){if(n=this.elapsedMS=t-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){const s=t-this._lastFrame|0;if(s<this._minElapsedMS)return;this._lastFrame=t-s%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*Ja.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const n=Math.min(Math.max(0,t)/1e3,Ja.targetFPMS);this._maxElapsedMS=1/n,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){t===0?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!Ja._shared){const t=Ja._shared=new Ja;t.autoStart=!0,t._protected=!0}return Ja._shared}static get system(){if(!Ja._system){const t=Ja._system=new Ja;t.autoStart=!0,t._protected=!0}return Ja._system}};EA.targetFPMS=.06;let Wf=EA,Mb;async function dz(){return Mb??(Mb=(async()=>{var l;const t=is.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const n=await new Promise(c=>{const f=document.createElement("video");f.onloadeddata=()=>c(f),f.onerror=()=>c(null),f.autoplay=!1,f.crossOrigin="anonymous",f.preload="auto",f.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",f.load()});if(!n)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n);const s=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,s),t.deleteFramebuffer(r),t.deleteTexture(i),(l=t.getExtension("WEBGL_lose_context"))==null||l.loseContext(),s[0]<=s[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Mb}const tx=class wA extends Is{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...wA.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=Wf.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,n=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(n.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await dz(),this._load=new Promise((i,r)=>{this.isValid?i(this):(this._resolve=i,this._reject=r,n.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${n.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Wf.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Wf.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Wf.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};tx.extension=kt.TextureSource;tx.defaultOptions={...Is.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};tx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let fz=tx;const Gf=(e,t,n=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(i=>typeof i=="string"||n?t(i):i):e);class hz{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const n=this._cache.get(t);return n||ma(`[Assets] Asset id ${t} was not found in the Cache`),n}set(t,n){const i=Gf(t);let r;for(let f=0;f<this.parsers.length;f++){const p=this.parsers[f];if(p.test(n)){r=p.getCacheableAssets(i,n);break}}const s=new Map(Object.entries(r||{}));r||i.forEach(f=>{s.set(f,n)});const l=[...s.keys()],c={cacheKeys:l,keys:i};i.forEach(f=>{this._cacheMap.set(f,c)}),l.forEach(f=>{const p=r?r[f]:n;this._cache.has(f)&&this._cache.get(f)!==p&&ma("[Cache] already has key:",f),this._cache.set(f,s.get(f))})}remove(t){if(!this._cacheMap.has(t)){ma(`[Assets] Asset id ${t} was not found in the Cache`);return}const n=this._cacheMap.get(t);n.cacheKeys.forEach(r=>{this._cache.delete(r)}),n.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const qf=new hz,Wv=[];li.handleByList(kt.TextureSource,Wv);function TA(e={}){const t=e&&e.resource,n=t?e.resource:e,i=t?e:{resource:e};for(let r=0;r<Wv.length;r++){const s=Wv[r];if(s.test(n))return new s(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function pz(e={},t=!1){const n=e&&e.resource,i=n?e.resource:e,r=n?e:{resource:e};if(!t&&qf.has(i))return qf.get(i);const s=new Mn({source:TA(r)});return s.on("destroy",()=>{qf.has(i)&&qf.remove(i)}),t||qf.set(i,s),s}function mz(e,t=!1){return typeof e=="string"?qf.get(e):e instanceof Is?new Mn({source:e}):pz(e,t)}Mn.from=mz;Is.from=TA;li.add(bA,vA,_A,fz,A0,SA,Z1);var CA=(e=>(e[e.Low=0]="Low",e[e.Normal=1]="Normal",e[e.High=2]="High",e))(CA||{});function dl(e){if(typeof e!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Wp(e){return e.split("?")[0].split("#")[0]}function gz(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yz(e,t,n){return e.replace(new RegExp(gz(t),"g"),n)}function xz(e,t){let n="",i=0,r=-1,s=0,l=-1;for(let c=0;c<=e.length;++c){if(c<e.length)l=e.charCodeAt(c);else{if(l===47)break;l=47}if(l===47){if(!(r===c-1||s===1))if(r!==c-1&&s===2){if(n.length<2||i!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){const f=n.lastIndexOf("/");if(f!==n.length-1){f===-1?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),r=c,s=0;continue}}else if(n.length===2||n.length===1){n="",i=0,r=c,s=0;continue}}}else n.length>0?n+=`/${e.slice(r+1,c)}`:n=e.slice(r+1,c),i=c-r-1;r=c,s=0}else l===46&&s!==-1?++s:s=-1}return n}const Nm={toPosix(e){return yz(e,"\\","/")},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith("blob:")},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){dl(e),e=this.toPosix(e);const t=/^file:\/\/\//.exec(e);if(t)return t[0];const n=/^[^/:]+:\/{0,2}/.exec(e);return n?n[0]:""},toAbsolute(e,t,n){if(dl(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;const i=Wp(this.toPosix(t??is.get().getBaseUrl())),r=Wp(this.toPosix(n??this.rootname(i)));return e=this.toPosix(e),e.startsWith("/")?Nm.join(r,e.slice(1)):this.isAbsolute(e)?e:this.join(i,e)},normalize(e){if(dl(e),e.length===0)return".";if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t="";const n=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));const i=e.endsWith("/");return e=xz(e),e.length>0&&i&&(e+="/"),n?`/${e}`:t+e},isAbsolute(e){return dl(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith("/")},join(...e){if(e.length===0)return".";let t;for(let n=0;n<e.length;++n){const i=e[n];if(dl(i),i.length>0)if(t===void 0)t=i;else{const r=e[n-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(e){if(dl(e),e.length===0)return".";e=this.toPosix(e);let t=e.charCodeAt(0);const n=t===47;let i=-1,r=!0;const s=this.getProtocol(e),l=e;e=e.slice(s.length);for(let c=e.length-1;c>=1;--c)if(t=e.charCodeAt(c),t===47){if(!r){i=c;break}}else r=!1;return i===-1?n?"/":this.isUrl(l)?s+e:s:n&&i===1?"//":s+e.slice(0,i)},rootname(e){dl(e),e=this.toPosix(e);let t="";if(e.startsWith("/")?t="/":t=this.getProtocol(e),this.isUrl(e)){const n=e.indexOf("/",t.length);n!==-1?t=e.slice(0,n):t=e,t.endsWith("/")||(t+="/")}return t},basename(e,t){dl(e),t&&dl(t),e=Wp(this.toPosix(e));let n=0,i=-1,r=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let l=t.length-1,c=-1;for(s=e.length-1;s>=0;--s){const f=e.charCodeAt(s);if(f===47){if(!r){n=s+1;break}}else c===-1&&(r=!1,c=s+1),l>=0&&(f===t.charCodeAt(l)?--l===-1&&(i=s):(l=-1,i=c))}return n===i?i=c:i===-1&&(i=e.length),e.slice(n,i)}for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!r){n=s+1;break}}else i===-1&&(r=!1,i=s+1);return i===-1?"":e.slice(n,i)},extname(e){dl(e),e=Wp(this.toPosix(e));let t=-1,n=0,i=-1,r=!0,s=0;for(let l=e.length-1;l>=0;--l){const c=e.charCodeAt(l);if(c===47){if(!r){n=l+1;break}continue}i===-1&&(r=!1,i=l+1),c===46?t===-1?t=l:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||i===-1||s===0||s===1&&t===i-1&&t===n+1?"":e.slice(t,i)},parse(e){dl(e);const t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;e=Wp(this.toPosix(e));let n=e.charCodeAt(0);const i=this.isAbsolute(e);let r;t.root=this.rootname(e),i||this.hasProtocol(e)?r=1:r=0;let s=-1,l=0,c=-1,f=!0,p=e.length-1,m=0;for(;p>=r;--p){if(n=e.charCodeAt(p),n===47){if(!f){l=p+1;break}continue}c===-1&&(f=!1,c=p+1),n===46?s===-1?s=p:m!==1&&(m=1):s!==-1&&(m=-1)}return s===-1||c===-1||m===0||m===1&&s===c-1&&s===l+1?c!==-1&&(l===0&&i?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(l,c)):(l===0&&i?(t.name=e.slice(1,s),t.base=e.slice(1,c)):(t.name=e.slice(l,s),t.base=e.slice(l,c)),t.ext=e.slice(s,c)),t.dir=this.dirname(e),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function AA(e,t,n,i,r){const s=t[n];for(let l=0;l<s.length;l++){const c=s[l];n<t.length-1?AA(e.replace(i[n],c),t,n+1,i,r):r.push(e.replace(i[n],c))}}function bz(e){const t=/\{(.*?)\}/g,n=e.match(t),i=[];if(n){const r=[];n.forEach(s=>{const l=s.substring(1,s.length-1).split(",");r.push(l)}),AA(e,r,0,n,i)}else i.push(e);return i}const qE=e=>!Array.isArray(e);class MA{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,n)=>`${t}${this._bundleIdConnector}${n}`,extractAssetIdFromBundle:(t,n)=>n.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(n=>{this._preferredOrder.push(n),n.priority||(n.priority=Object.keys(n.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const n=t;this._defaultSearchParams=Object.keys(n).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(n[i])}`).join("&")}}getAlias(t){const{alias:n,src:i}=t;return Gf(n||i,s=>typeof s=="string"?s:Array.isArray(s)?s.map(l=>(l==null?void 0:l.src)??l):s!=null&&s.src?s.src:s,!0)}removeAlias(t,n){this._assetMap[t]&&(n&&n!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&ma("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(n=>{this.addBundle(n.name,n.assets)})}addBundle(t,n){const i=[];let r=n;Array.isArray(n)||(r=Object.entries(n).map(([s,l])=>typeof l=="string"||Array.isArray(l)?{alias:s,src:l}:{alias:s,...l})),r.forEach(s=>{const l=s.src,c=s.alias;let f;if(typeof c=="string"){const p=this._createBundleAssetId(t,c);i.push(p),f=[c,p]}else{const p=c.map(m=>this._createBundleAssetId(t,m));i.push(...p),f=[...c,...p]}this.add({...s,alias:f,src:l})}),this._bundles[t]=i}add(t){const n=[];Array.isArray(t)?n.push(...t):n.push(t);let i;i=s=>{this.hasKey(s)&&ma(`[Resolver] already has key: ${s} overwriting`)},Gf(n).forEach(s=>{const{src:l}=s;let{data:c,format:f,loadParser:p,parser:m}=s;const g=Gf(l).map(A=>typeof A=="string"?bz(A):Array.isArray(A)?A:[A]),x=this.getAlias(s);Array.isArray(x)?x.forEach(i):i(x);const v=[],S=A=>{const T=this._parsers.find(C=>C.test(A));return{src:A,...T==null?void 0:T.parse(A)}};g.forEach(A=>{A.forEach(T=>{let C={};if(typeof T!="object"?C=S(T):(c=T.data??c,f=T.format??f,(T.loadParser||T.parser)&&(p=T.loadParser??p,m=T.parser??m),C={...S(T.src),...T}),!x)throw new Error(`[Resolver] alias is undefined for this asset: ${C.src}`);C=this._buildResolvedAsset(C,{aliases:x,data:c,format:f,loadParser:p,parser:m,progressSize:s.progressSize}),v.push(C)})}),x.forEach(A=>{this._assetMap[A]=v})})}resolveBundle(t){const n=qE(t);t=Gf(t);const i={};return t.forEach(r=>{const s=this._bundles[r];if(s){const l=this.resolve(s),c={};for(const f in l){const p=l[f];c[this._extractAssetIdFromBundle(r,f)]=p}i[r]=c}}),n?i[t[0]]:i}resolveUrl(t){const n=this.resolve(t);if(typeof t!="string"){const i={};for(const r in n)i[r]=n[r].src;return i}return n.src}resolve(t){const n=qE(t);t=Gf(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let s=this._assetMap[r];const l=this._getPreferredOrder(s);l==null||l.priority.forEach(c=>{l.params[c].forEach(f=>{const p=s.filter(m=>m[c]?m[c]===f:!1);p.length&&(s=p)})}),this._resolverHash[r]=s[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),n?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let n=0;n<t.length;n++){const i=t[n],r=this._preferredOrder.find(s=>s.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const n=/\?/.test(t)?"&":"?";return`${t}${n}${this._defaultSearchParams}`}_buildResolvedAsset(t,n){const{aliases:i,data:r,loadParser:s,parser:l,format:c,progressSize:f}=n;return(this._basePath||this._rootPath)&&(t.src=Nm.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=s??t.loadParser,t.parser=l??t.parser,t.format=c??t.format??vz(t.src),f!==void 0&&(t.progressSize=f),t}}MA.RETINA_PREFIX=/@([0-9\.]+)x/;function vz(e){return e.split(".").pop().split("?").shift().split("#").shift()}const YE=(e,t)=>{const n=t.split("?")[1];return n&&(e+=`?${n}`),e},RA=class pm{constructor(t,n){this.linkedSheets=[];let i=t;(t==null?void 0:t.source)instanceof Is&&(i={texture:t,data:n});const{texture:r,data:s,cachePrefix:l=""}=i;this.cachePrefix=l,this._texture=r instanceof Mn?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=s;const c=parseFloat(s.meta.scale);c?(this.resolution=c,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=pm.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,n=!1){let i=t;const r=n?1/0:pm.BATCH_SIZE;for(;i-t<r&&i<this._frameKeys.length;){const s=this._frameKeys[i],l=this._frames[s],c=l.frame;if(c){let f=null,p=null;const m=l.trimmed!==!1&&l.sourceSize?l.sourceSize:l.frame,g=new Ti(0,0,Math.floor(m.w)/this.resolution,Math.floor(m.h)/this.resolution);l.rotated?f=new Ti(Math.floor(c.x)/this.resolution,Math.floor(c.y)/this.resolution,Math.floor(c.h)/this.resolution,Math.floor(c.w)/this.resolution):f=new Ti(Math.floor(c.x)/this.resolution,Math.floor(c.y)/this.resolution,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution),l.trimmed!==!1&&l.spriteSourceSize&&(p=new Ti(Math.floor(l.spriteSourceSize.x)/this.resolution,Math.floor(l.spriteSourceSize.y)/this.resolution,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution)),this.textures[s]=new Mn({source:this.textureSource,frame:f,orig:g,trim:p,rotate:l.rotated?2:0,defaultAnchor:l.anchor,defaultBorders:l.borders,label:s.toString()})}i++}}_processAnimations(){const t=this.data.animations||{};for(const n in t){this.animations[n]=[];for(let i=0;i<t[n].length;i++){const r=t[n][i];this.animations[n].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*pm.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*pm.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var n;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((n=this._texture)==null||n.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};RA.BATCH_SIZE=1e3;let VE=RA;const _z=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function kA(e,t,n){const i={};if(e.forEach(r=>{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!n){const r=Nm.dirname(e[0]);t.linkedSheets.forEach((s,l)=>{const c=kA([`${r}/${t.data.meta.related_multi_packs[l]}`],s,!0);Object.assign(i,c)})}return i}const Sz={extension:kt.Asset,cache:{test:e=>e instanceof VE,getCacheableAssets:(e,t)=>kA(e,t,!1)},resolver:{extension:{type:kt.ResolveParser,name:"resolveSpritesheet"},test:e=>{const n=e.split("?")[0].split("."),i=n.pop(),r=n.pop();return i==="json"&&_z.includes(r)},parse:e=>{var n;const t=e.split(".");return{resolution:parseFloat(((n=MA.RETINA_PREFIX.exec(e))==null?void 0:n[1])??"1"),format:t[t.length-2],src:e}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:kt.LoadParser,priority:CA.Normal,name:"spritesheetLoader"},async testParse(e,t){return Nm.extname(t.src).toLowerCase()===".json"&&!!e.frames},async parse(e,t,n){var g,x;const{texture:i,imageFilename:r,textureOptions:s,cachePrefix:l}=(t==null?void 0:t.data)??{};let c=Nm.dirname(t.src);c&&c.lastIndexOf("/")!==c.length-1&&(c+="/");let f;if(i instanceof Mn)f=i;else{const v=YE(c+(r??e.meta.image),t.src);f=(await n.load([{src:v,data:s}]))[v]}const p=new VE({texture:f.source,data:e,cachePrefix:l});await p.parse();const m=(g=e==null?void 0:e.meta)==null?void 0:g.related_multi_packs;if(Array.isArray(m)){const v=[];for(const A of m){if(typeof A!="string")continue;let T=c+A;(x=t.data)!=null&&x.ignoreMultiPack||(T=YE(T,t.src),v.push(n.load({src:T,data:{textureOptions:s,ignoreMultiPack:!0}})))}const S=await Promise.all(v);p.linkedSheets=S,S.forEach(A=>{A.linkedSheets=[p].concat(p.linkedSheets.filter(T=>T!==A))})}return p},async unload(e,t,n){await n.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}};li.add(Sz);const Rb=Object.create(null),XE=Object.create(null);function n_(e,t){let n=XE[e];return n===void 0&&(Rb[t]===void 0&&(Rb[t]=1),XE[e]=n=Rb[t]++),n}let zf;function NA(){return(!zf||zf!=null&&zf.isContextLost())&&(zf=is.get().createCanvas().getContext("webgl",{})),zf}let Ly;function Ez(){if(!Ly){Ly="mediump";const e=NA();e&&e.getShaderPrecisionFormat&&(Ly=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision?"highp":"mediump")}return Ly}function wz(e,t,n){return t?e:n?(e=e.replace("out vec4 finalColor;",""),`
@@ -79,7 +79,7 @@ Deprecated since v${e}`,s=typeof console.groupCollapsed=="function"&&!$f.noColor
79
79
  `}function Tz(e,t,n){const i=n?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(e.substring(0,9)!=="precision"){let r=n?t.requestedFragmentPrecision:t.requestedVertexPrecision;return r==="highp"&&i!=="highp"&&(r="mediump"),`precision ${r} float;
80
80
  ${e}`}else if(i!=="highp"&&e.substring(0,15)==="precision highp")return e.replace("precision highp","precision mediump");return e}function Cz(e,t){return t?`#version 300 es
81
81
  ${e}`:e}const Az={},Mz={};function Rz(e,{name:t="pixi-program"},n=!0){t=t.replace(/\s+/g,"-"),t+=n?"-fragment":"-vertex";const i=n?Az:Mz;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,e.indexOf("#define SHADER_NAME")!==-1?e:`${`#define SHADER_NAME ${t}`}
82
- ${e}`}function kz(e,t){return t?e.replace("#version 300 es",""):e}const kb={stripVersion:kz,ensurePrecision:Tz,addProgramDefines:wz,setProgramName:Rz,insertVersion:Cz},Qp=Object.create(null),OA=class Qv{constructor(t){t={...Qv.defaultOptions,...t};const n=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Ez()},setProgramName:{name:t.name},addProgramDefines:n,insertVersion:n};let r=t.fragment,s=t.vertex;Object.keys(kb).forEach(l=>{const c=i[l];r=kb[l](r,c,!0),s=kb[l](s,c,!1)}),this.fragment=r,this.vertex=s,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=n_(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,Qp[this._cacheKey]=null}static from(t){const n=`${t.vertex}:${t.fragment}`;return Qp[n]||(Qp[n]=new Qv(t),Qp[n]._cacheKey=n),Qp[n]}};OA.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let i_=OA;const KE={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function Nz(e){return KE[e]??KE.float32}const Oz={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},$E=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function WE(e,t){let n;for(;(n=$E.exec(e))!==null;){const i=Oz[n[3]]??"float32";t[n[2]]={location:parseInt(n[1],10),format:i,stride:Nz(i).stride,offset:0,instance:!1,start:0}}$E.lastIndex=0}function Dz(e){return e.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function zz({source:e,entryPoint:t}){const n={},i=Dz(e),r=i.indexOf(`fn ${t}(`);if(r===-1)return n;const s=i.indexOf("->",r);if(s===-1)return n;const l=i.substring(r,s);if(WE(l,n),Object.keys(n).length===0){const c=l.match(/\(\s*\w+\s*:\s*(\w+)/);if(c){const f=c[1],p=new RegExp(`struct\\s+${f}\\s*\\{([^}]+)\\}`,"s"),m=i.match(p);m&&WE(m[1],n)}}return n}function Nb(e){var g,x;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,s=/:\s*([\w<>]+)/,l=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,f=/struct\s+(\w+)/,p=(g=e.match(t))==null?void 0:g.map(v=>({group:parseInt(v.match(n)[1],10),binding:parseInt(v.match(i)[1],10),name:v.match(r)[2],isUniform:v.match(r)[1]==="<uniform>",type:v.match(s)[1]}));if(!p)return{groups:[],structs:[]};const m=((x=e.match(l))==null?void 0:x.map(v=>{const S=v.match(f)[1],A=v.match(c).reduce((T,C)=>{const[N,R]=C.split(":");return T[N.trim()]=R.trim(),T},{});return A?{name:S,members:A}:null}).filter(({name:v})=>p.some(S=>S.type===v||S.type.includes(`<${v}>`))))??[];return{groups:p,structs:m}}var fd=(e=>(e[e.VERTEX=1]="VERTEX",e[e.FRAGMENT=2]="FRAGMENT",e[e.COMPUTE=4]="COMPUTE",e))(fd||{});function Bz({groups:e}){const t=[];for(let n=0;n<e.length;n++){const i=e[n];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:fd.VERTEX|fd.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"||i.type.startsWith("texture_2d<")?t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):i.type==="texture_2d_array"||i.type.startsWith("texture_2d_array<")?t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(i.type==="texture_cube"||i.type.startsWith("texture_cube<"))&&t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<t.length;n++)t[n]||(t[n]=[]);return t}function Lz({groups:e}){const t=[];for(let n=0;n<e.length;n++){const i=e[n];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function jz(e,t){const n=new Set,i=new Set,r=[...e.structs,...t.structs].filter(l=>n.has(l.name)?!1:(n.add(l.name),!0)),s=[...e.groups,...t.groups].filter(l=>{const c=`${l.name}-${l.binding}`;return i.has(c)?!1:(i.add(c),!0)});return{structs:r,groups:s}}const Zp=Object.create(null);class Zm{constructor(t){var c,f;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:n,vertex:i,layout:r,gpuLayout:s,name:l}=t;if(this.name=l,this.fragment=n,this.vertex=i,n.source===i.source){const p=Nb(n.source);this.structsAndGroups=p}else{const p=Nb(i.source),m=Nb(n.source);this.structsAndGroups=jz(p,m)}this.layout=r??Lz(this.structsAndGroups),this.gpuLayout=s??Bz(this.structsAndGroups),this.autoAssignGlobalUniforms=((c=this.layout[0])==null?void 0:c.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((f=this.layout[1])==null?void 0:f.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:n}=this,i=t.source+n.source+t.entryPoint+n.entryPoint;this._layoutKey=n_(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=zz(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Zp[this._cacheKey]=null}static from(t){const n=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Zp[n]||(Zp[n]=new Zm(t),Zp[n]._cacheKey=n),Zp[n]}}const DA=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Iz=DA.reduce((e,t)=>(e[t]=!0,e),{});function Uz(e,t){switch(e){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const zA=class BA{constructor(t,n){this._touched=0,this.uid=bi("uniform"),this._resourceType="uniformGroup",this._resourceId=bi("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...BA.defaultOptions,...n},this.uniformStructures=t;const i={};for(const r in t){const s=t[r];if(s.name=r,s.size=s.size??1,!Iz[s.type]){const l=s.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(l){const[,c,f]=l;throw new Error(`Uniform type ${s.type} is not supported. Use type: '${c}', size: ${f} instead.`)}throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${DA.join(", ")}`)}s.value??(s.value=Uz(s.type,s.size)),i[r]=s.value}this.uniforms=i,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=n_(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};zA.defaultOptions={ubo:!1,isStatic:!1};let LA=zA;class y0{constructor(t){this.resources=Object.create(null),this._dirty=!0;let n=0;for(const i in t){const r=t[i];this.setResource(r,n++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let n=0;for(const i in this.resources)t[n++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,n){var r,s;const i=this.resources[n];t!==i&&((r=i==null?void 0:i.off)==null||r.call(i,"change",this.onResourceChange,this),(s=t.on)==null||s.call(t,"change",this.onResourceChange,this),this.resources[n]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,n){const i=this.resources;for(const r in i)i[r]._gcLastUsed=t,i[r]._touched=n}destroy(){var n;const t=this.resources;for(const i in t){const r=t[i];(n=r==null?void 0:r.off)==null||n.call(r,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var Zv=(e=>(e[e.WEBGL=1]="WEBGL",e[e.WEBGPU=2]="WEBGPU",e[e.CANVAS=4]="CANVAS",e[e.BOTH=3]="BOTH",e))(Zv||{});class nx extends yo{constructor(t){super(),this.uid=bi("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:n,glProgram:i,groups:r,resources:s,compatibleRenderers:l,groupMap:c}=t;this.gpuProgram=n,this.glProgram=i,l===void 0&&(l=0,n&&(l|=Zv.WEBGPU),i&&(l|=Zv.WEBGL)),this.compatibleRenderers=l;const f={};if(!s&&!r&&(s={}),s&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!n&&r&&!c)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!n&&r&&c)for(const p in c)for(const m in c[p]){const g=c[p][m];f[g]={group:p,binding:m,name:g}}else if(n&&r&&!c){const p=n.structsAndGroups.groups;c={},p.forEach(m=>{c[m.group]=c[m.group]||{},c[m.group][m.binding]=m.name,f[m.name]=m})}else if(s){r={},c={},n&&n.structsAndGroups.groups.forEach(g=>{c[g.group]=c[g.group]||{},c[g.group][g.binding]=g.name,f[g.name]=g});let p=0;for(const m in s)f[m]||(r[99]||(r[99]=new y0,this._ownedBindGroups.push(r[99])),f[m]={group:99,binding:p,name:m},c[99]=c[99]||{},c[99][p]=m,p++);for(const m in s){const g=m;let x=s[m];!x.source&&!x._resourceType&&(x=new LA(x));const v=f[g];v&&(r[v.group]||(r[v.group]=new y0,this._ownedBindGroups.push(r[v.group])),r[v.group].setResource(x,v.binding))}}this.groups=r,this._uniformBindMap=c,this.resources=this._buildResourceAccessor(r,f)}addResource(t,n,i){var r,s;(r=this._uniformBindMap)[n]||(r[n]={}),(s=this._uniformBindMap[n])[i]||(s[i]=t),this.groups[n]||(this.groups[n]=new y0,this._ownedBindGroups.push(this.groups[n]))}_buildResourceAccessor(t,n){const i={};for(const r in n){const s=n[r];Object.defineProperty(i,s.name,{get(){return t[s.group].getResource(s.binding)},set(l){t[s.group].setResource(l,s.binding)}})}return i}destroy(t=!1){var n,i;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&((n=this.gpuProgram)==null||n.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:n,gl:i,...r}=t;let s,l;return n&&(s=Zm.from(n)),i&&(l=i_.from(i)),new nx({gpuProgram:s,glProgram:l,...r})}}const Hz={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Ob=0,Db=1,zb=2,Bb=3,Lb=4,jb=5,Jv=class jA{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ob)}set blend(t){!!(this.data&1<<Ob)!==t&&(this.data^=1<<Ob)}get offsets(){return!!(this.data&1<<Db)}set offsets(t){!!(this.data&1<<Db)!==t&&(this.data^=1<<Db)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<zb)}set culling(t){!!(this.data&1<<zb)!==t&&(this.data^=1<<zb)}get depthTest(){return!!(this.data&1<<Bb)}set depthTest(t){!!(this.data&1<<Bb)!==t&&(this.data^=1<<Bb)}get depthMask(){return!!(this.data&1<<jb)}set depthMask(t){!!(this.data&1<<jb)!==t&&(this.data^=1<<jb)}get clockwiseFrontFace(){return!!(this.data&1<<Lb)}set clockwiseFrontFace(t){!!(this.data&1<<Lb)!==t&&(this.data^=1<<Lb)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=Hz[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const t=new jA;return t.depthTest=!1,t.blend=!0,t}};Jv.default2d=Jv.for2d();let r_=Jv;const IA=class e1 extends nx{constructor(t){t={...e1.defaultOptions,...t},super(t),this.enabled=!0,this._state=r_.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1),t.blendRequired&&this.addResource("uBackTexture",0,3)}apply(t,n,i,r){t.applyFilter(this,n,i,r)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const{gpu:n,gl:i,...r}=t;let s,l;return n&&(s=Zm.from(n)),i&&(l=i_.from(i)),new e1({gpuProgram:s,glProgram:l,...r})}};IA.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let Ad=IA;const t1=[];li.handleByNamedList(kt.Environment,t1);async function Pz(e){if(!e)for(let t=0;t<t1.length;t++){const n=t1[t];if(n.value.test()){await n.value.load();return}}}let Jp;function Fz(){if(typeof Jp=="boolean")return Jp;try{Jp=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Jp=!1}return Jp}function QE(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=UA(e,0,r,n,!0);const l=[];if(!s||s.next===s.prev)return l;let c,f,p;if(i&&(s=Xz(e,t,s,n)),e.length>80*n){c=e[0],f=e[1];let m=c,g=f;for(let x=n;x<r;x+=n){const v=e[x],S=e[x+1];v<c&&(c=v),S<f&&(f=S),v>m&&(m=v),S>g&&(g=S)}p=Math.max(m-c,g-f),p=p!==0?32767/p:0}return Om(s,l,n,c,f,p,0),l}function UA(e,t,n,i,r){let s;if(r===r5(e,t,n,i)>0)for(let l=t;l<n;l+=i)s=ZE(l/i|0,e[l],e[l+1],s);else for(let l=n-i;l>=t;l-=i)s=ZE(l/i|0,e[l],e[l+1],s);return s&&uh(s,s.next)&&(zm(s),s=s.next),s}function vd(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&(uh(n,n.next)||si(n.prev,n,n.next)===0)){if(zm(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function Om(e,t,n,i,r,s,l){if(!e)return;!l&&s&&Zz(e,i,r,s);let c=e;for(;e.prev!==e.next;){const f=e.prev,p=e.next;if(s?qz(e,i,r,s):Gz(e)){t.push(f.i,e.i,p.i),zm(e),e=p.next,c=p.next;continue}if(e=p,e===c){l?l===1?(e=Yz(vd(e),t),Om(e,t,n,i,r,s,2)):l===2&&Vz(e,t,n,i,r,s):Om(vd(e),t,n,i,r,s,1);break}}}function Gz(e){const t=e.prev,n=e,i=e.next;if(si(t,n,i)>=0)return!1;const r=t.x,s=n.x,l=i.x,c=t.y,f=n.y,p=i.y,m=Math.min(r,s,l),g=Math.min(c,f,p),x=Math.max(r,s,l),v=Math.max(c,f,p);let S=i.next;for(;S!==t;){if(S.x>=m&&S.x<=x&&S.y>=g&&S.y<=v&&mm(r,c,s,f,l,p,S.x,S.y)&&si(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function qz(e,t,n,i){const r=e.prev,s=e,l=e.next;if(si(r,s,l)>=0)return!1;const c=r.x,f=s.x,p=l.x,m=r.y,g=s.y,x=l.y,v=Math.min(c,f,p),S=Math.min(m,g,x),A=Math.max(c,f,p),T=Math.max(m,g,x),C=n1(v,S,t,n,i),N=n1(A,T,t,n,i);let R=e.prevZ,D=e.nextZ;for(;R&&R.z>=C&&D&&D.z<=N;){if(R.x>=v&&R.x<=A&&R.y>=S&&R.y<=T&&R!==r&&R!==l&&mm(c,m,f,g,p,x,R.x,R.y)&&si(R.prev,R,R.next)>=0||(R=R.prevZ,D.x>=v&&D.x<=A&&D.y>=S&&D.y<=T&&D!==r&&D!==l&&mm(c,m,f,g,p,x,D.x,D.y)&&si(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;R&&R.z>=C;){if(R.x>=v&&R.x<=A&&R.y>=S&&R.y<=T&&R!==r&&R!==l&&mm(c,m,f,g,p,x,R.x,R.y)&&si(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;D&&D.z<=N;){if(D.x>=v&&D.x<=A&&D.y>=S&&D.y<=T&&D!==r&&D!==l&&mm(c,m,f,g,p,x,D.x,D.y)&&si(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function Yz(e,t){let n=e;do{const i=n.prev,r=n.next.next;!uh(i,r)&&PA(i,n,n.next,r)&&Dm(i,r)&&Dm(r,i)&&(t.push(i.i,n.i,r.i),zm(n),zm(n.next),n=e=r),n=n.next}while(n!==e);return vd(n)}function Vz(e,t,n,i,r,s){let l=e;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&t5(l,c)){let f=FA(l,c);l=vd(l,l.next),f=vd(f,f.next),Om(l,t,n,i,r,s,0),Om(f,t,n,i,r,s,0);return}c=c.next}l=l.next}while(l!==e)}function Xz(e,t,n,i){const r=[];for(let s=0,l=t.length;s<l;s++){const c=t[s]*i,f=s<l-1?t[s+1]*i:e.length,p=UA(e,c,f,i,!1);p===p.next&&(p.steiner=!0),r.push(e5(p))}r.sort(Kz);for(let s=0;s<r.length;s++)n=$z(r[s],n);return n}function Kz(e,t){let n=e.x-t.x;if(n===0&&(n=e.y-t.y,n===0)){const i=(e.next.y-e.y)/(e.next.x-e.x),r=(t.next.y-t.y)/(t.next.x-t.x);n=i-r}return n}function $z(e,t){const n=Wz(e,t);if(!n)return t;const i=FA(n,e);return vd(i,i.next),vd(n,n.next)}function Wz(e,t){let n=t;const i=e.x,r=e.y;let s=-1/0,l;if(uh(e,n))return n;do{if(uh(e,n.next))return n.next;if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const g=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(g<=i&&g>s&&(s=g,l=n.x<n.next.x?n:n.next,g===i))return l}n=n.next}while(n!==t);if(!l)return null;const c=l,f=l.x,p=l.y;let m=1/0;n=l;do{if(i>=n.x&&n.x>=f&&i!==n.x&&HA(r<p?i:s,r,f,p,r<p?s:i,r,n.x,n.y)){const g=Math.abs(r-n.y)/(i-n.x);Dm(n,e)&&(g<m||g===m&&(n.x>l.x||n.x===l.x&&Qz(l,n)))&&(l=n,m=g)}n=n.next}while(n!==c);return l}function Qz(e,t){return si(e.prev,e,t.prev)<0&&si(t.next,e,e.next)<0}function Zz(e,t,n,i){let r=e;do r.z===0&&(r.z=n1(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,Jz(r)}function Jz(e){let t,n=1;do{let i=e,r;e=null;let s=null;for(t=0;i;){t++;let l=i,c=0;for(let p=0;p<n&&(c++,l=l.nextZ,!!l);p++);let f=n;for(;c>0||f>0&&l;)c!==0&&(f===0||!l||i.z<=l.z)?(r=i,i=i.nextZ,c--):(r=l,l=l.nextZ,f--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;i=l}s.nextZ=null,n*=2}while(t>1);return e}function n1(e,t,n,i,r){return e=(e-n)*r|0,t=(t-i)*r|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function e5(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function HA(e,t,n,i,r,s,l,c){return(r-l)*(t-c)>=(e-l)*(s-c)&&(e-l)*(i-c)>=(n-l)*(t-c)&&(n-l)*(s-c)>=(r-l)*(i-c)}function mm(e,t,n,i,r,s,l,c){return!(e===l&&t===c)&&HA(e,t,n,i,r,s,l,c)}function t5(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!n5(e,t)&&(Dm(e,t)&&Dm(t,e)&&i5(e,t)&&(si(e.prev,e,t.prev)||si(e,t.prev,t))||uh(e,t)&&si(e.prev,e,e.next)>0&&si(t.prev,t,t.next)>0)}function si(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function uh(e,t){return e.x===t.x&&e.y===t.y}function PA(e,t,n,i){const r=Iy(si(e,t,n)),s=Iy(si(e,t,i)),l=Iy(si(n,i,e)),c=Iy(si(n,i,t));return!!(r!==s&&l!==c||r===0&&jy(e,n,t)||s===0&&jy(e,i,t)||l===0&&jy(n,e,i)||c===0&&jy(n,t,i))}function jy(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Iy(e){return e>0?1:e<0?-1:0}function n5(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&PA(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Dm(e,t){return si(e.prev,e,e.next)<0?si(e,t,e.next)>=0&&si(e,e.prev,t)>=0:si(e,t,e.prev)<0||si(e,e.next,t)<0}function i5(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function FA(e,t){const n=i1(e.i,e.x,e.y),i=i1(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function ZE(e,t,n,i){const r=i1(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function zm(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function i1(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function r5(e,t,n,i){let r=0;for(let s=t,l=n-i;s<n;s+=i)r+=(e[l]-e[s])*(e[s+1]+e[l+1]),l=s;return r}const a5=QE.default||QE;var GA=(e=>(e[e.NONE=0]="NONE",e[e.COLOR=16384]="COLOR",e[e.STENCIL=1024]="STENCIL",e[e.DEPTH=256]="DEPTH",e[e.COLOR_DEPTH=16640]="COLOR_DEPTH",e[e.COLOR_STENCIL=17408]="COLOR_STENCIL",e[e.DEPTH_STENCIL=1280]="DEPTH_STENCIL",e[e.ALL=17664]="ALL",e))(GA||{});class s5{constructor(t){this.items=[],this._name=t}emit(t,n,i,r,s,l,c,f){const{name:p,items:m}=this;for(let g=0,x=m.length;g<x;g++)m[g][p](t,n,i,r,s,l,c,f);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const n=this.items.indexOf(t);return n!==-1&&this.items.splice(n,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}const l5=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],qA=class YA extends yo{constructor(t){super(),this.tick=0,this.uid=bi("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const n=[...l5,...this.config.runners??[]];this._addRunners(...n),this._unsafeEvalCheck()}async init(t={}){const n=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Pz(n),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...YA.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,n){this.tick++;let i=t;if(i instanceof _r&&(i={container:i},n&&(en(xi,"passing a second argument is deprecated, please use render options instead"),i.target=n.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){const r=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=r?i.clearColor:qi.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.visible&&(i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i))}resize(t,n,i){const r=this.view.resolution;this.view.resize(t,n,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==r&&this.runners.resolutionChange.emit(i)}clear(t={}){const n=this;t.target||(t.target=n.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=GA.ALL);const{clear:i,clearColor:r,target:s,mipLevel:l,layer:c}=t;qi.shared.setValue(r??this.background.colorRgba),n.renderTarget.clear(s,i,qi.shared.toArray(),l??0,c??0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(n=>{this.runners[n]=new s5(n)})}_addSystems(t){let n;for(n in t){const i=t[n];this._addSystem(i.value,i.name)}}_addSystem(t,n){const i=new t(this);if(this[n])throw new Error(`Whoops! The name "${n}" is already in use`);this[n]=i,this._systemsHash[n]=i;for(const r in this.runners)this.runners[r].add(i);return this}_addPipes(t,n){const i=n.reduce((r,s)=>(r[s.name]=s.value,r),{});t.forEach(r=>{const s=r.value,l=r.name,c=i[l];this.renderPipes[l]=new s(this,c?new c:null),this.runners.destroy.add(this.renderPipes[l])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&Qm.release(),Object.values(this.runners).forEach(n=>{n.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Fz())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};qA.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let VA=qA,Uy;function o5(e){return Uy!==void 0||(Uy=(()=>{var n;const t={stencil:!0,failIfMajorPerformanceCaveat:e??VA.defaultOptions.failIfMajorPerformanceCaveat};try{if(!is.get().getWebGLRenderingContext())return!1;let r=is.get().createCanvas().getContext("webgl",t);const s=!!((n=r==null?void 0:r.getContextAttributes())!=null&&n.stencil);if(r){const l=r.getExtension("WEBGL_lose_context");l&&l.loseContext()}return r=null,s}catch{return!1}})()),Uy}let Hy;async function c5(e={}){return Hy!==void 0||(Hy=await(async()=>{const t=is.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(e)).requestDevice(),!0}catch{return!1}})()),Hy}const JE=["webgl","webgpu","canvas"];async function u5(e){let t=[];e.preference?(t.push(e.preference),JE.forEach(s=>{s!==e.preference&&t.push(s)})):t=JE.slice();let n,i={};for(let s=0;s<t.length;s++){const l=t[s];if(l==="webgpu"&&await c5()){const{WebGPURenderer:c}=await ou(async()=>{const{WebGPURenderer:f}=await import("./WebGPURenderer-BduUOOQw.js");return{WebGPURenderer:f}},__vite__mapDeps([4,5,6]));n=c,i={...e,...e.webgpu};break}else if(l==="webgl"&&o5(e.failIfMajorPerformanceCaveat??VA.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:c}=await ou(async()=>{const{WebGLRenderer:f}=await import("./WebGLRenderer-6sYsFs6Z.js");return{WebGLRenderer:f}},__vite__mapDeps([7,5,6]));n=c,i={...e,...e.webgl};break}else if(l==="canvas"){const{CanvasRenderer:c}=await ou(async()=>{const{CanvasRenderer:f}=await import("./CanvasRenderer-D81h5zgP.js");return{CanvasRenderer:f}},__vite__mapDeps([8,6]));n=c,i={...e,...e.canvasOptions};break}}if(delete i.webgpu,delete i.webgl,delete i.canvasOptions,!n)throw new Error("No available renderer for the current environment");const r=new n;return await r.init(i),r}const XA="8.17.0";class KA{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,XA)}static destroy(){}}KA.extension=kt.Application;class d5{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,XA)}destroy(){this._renderer=null}}d5.extension={type:[kt.WebGLSystem,kt.WebGPUSystem],name:"initHook",priority:-10};class $A{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,set(n){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=n,n&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let n,i;if(this._resizeTo===globalThis.window)n=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:s}=this._resizeTo;n=r,i=s}this.renderer.resize(n,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}$A.extension=kt.Application;class WA{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(n){this._ticker&&this._ticker.remove(this.render,this),this._ticker=n,n&&n.add(this.render,this,M0.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Wf.shared:new Wf,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}WA.extension=kt.Application;li.add($A);li.add(WA);const QA=class r1{constructor(...t){this.stage=new _r,t[0]!==void 0&&en(xi,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new _r),this.renderer=await u5(t),r1._plugins.forEach(n=>{n.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return en(xi,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,n=!1){const i=r1._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(n),this.stage=null,this.renderer.destroy(t),this.renderer=null}};QA._plugins=[];let a_=QA;li.handleByList(kt.Application,a_._plugins);li.add(KA);var Ib,ew;function f5(){if(ew)return Ib;ew=1,Ib=n;var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(s){var l=[];return s.replace(t,function(c,f,p){var m=f.toLowerCase();for(p=r(p),m=="m"&&p.length>2&&(l.push([f].concat(p.splice(0,2))),m="l",f=f=="m"?"l":"L");;){if(p.length==e[m])return p.unshift(f),l.push(p);if(p.length<e[m])throw new Error("malformed path data");l.push([f].concat(p.splice(0,e[m])))}}),l}var i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function r(s){var l=s.match(i);return l?l.map(Number):[]}return Ib}var h5=f5();const p5=du(h5);function m5(e,t){const n=p5(e),i=[];let r=null,s=0,l=0;for(let c=0;c<n.length;c++){const f=n[c],p=f[0],m=f;switch(p){case"M":s=m[1],l=m[2],t.moveTo(s,l);break;case"m":s+=m[1],l+=m[2],t.moveTo(s,l);break;case"H":s=m[1],t.lineTo(s,l);break;case"h":s+=m[1],t.lineTo(s,l);break;case"V":l=m[1],t.lineTo(s,l);break;case"v":l+=m[1],t.lineTo(s,l);break;case"L":s=m[1],l=m[2],t.lineTo(s,l);break;case"l":s+=m[1],l+=m[2],t.lineTo(s,l);break;case"C":s=m[5],l=m[6],t.bezierCurveTo(m[1],m[2],m[3],m[4],s,l);break;case"c":t.bezierCurveTo(s+m[1],l+m[2],s+m[3],l+m[4],s+m[5],l+m[6]),s+=m[5],l+=m[6];break;case"S":s=m[3],l=m[4],t.bezierCurveToShort(m[1],m[2],s,l);break;case"s":t.bezierCurveToShort(s+m[1],l+m[2],s+m[3],l+m[4]),s+=m[3],l+=m[4];break;case"Q":s=m[3],l=m[4],t.quadraticCurveTo(m[1],m[2],s,l);break;case"q":t.quadraticCurveTo(s+m[1],l+m[2],s+m[3],l+m[4]),s+=m[3],l+=m[4];break;case"T":s=m[1],l=m[2],t.quadraticCurveToShort(s,l);break;case"t":s+=m[1],l+=m[2],t.quadraticCurveToShort(s,l);break;case"A":s=m[6],l=m[7],t.arcToSvg(m[1],m[2],m[3],m[4],m[5],s,l);break;case"a":s+=m[6],l+=m[7],t.arcToSvg(m[1],m[2],m[3],m[4],m[5],s,l);break;case"Z":case"z":t.closePath(),i.length>0&&(r=i.pop(),r?(s=r.startX,l=r.startY):(s=0,l=0)),r=null;break;default:ma(`Unknown SVG path command: ${p}`)}p!=="Z"&&p!=="z"&&r===null&&(r={startX:s,startY:l},i.push(r))}return t}class s_{constructor(t=0,n=0,i=0){this.type="circle",this.x=t,this.y=n,this.radius=i}clone(){return new s_(this.x,this.y,this.radius)}contains(t,n){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,s=this.y-n;return r*=r,s*=s,r+s<=i}strokeContains(t,n,i,r=.5){if(this.radius===0)return!1;const s=this.x-t,l=this.y-n,c=this.radius,f=(1-r)*i,p=Math.sqrt(s*s+l*l);return p<=c+f&&p>c-(i-f)}getBounds(t){return t||(t=new Ti),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class l_{constructor(t=0,n=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=n,this.halfWidth=i,this.halfHeight=r}clone(){return new l_(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,n){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,r=(n-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,n,i,r=.5){const{halfWidth:s,halfHeight:l}=this;if(s<=0||l<=0)return!1;const c=i*(1-r),f=i-c,p=s-f,m=l-f,g=s+c,x=l+c,v=t-this.x,S=n-this.y,A=v*v/(p*p)+S*S/(m*m),T=v*v/(g*g)+S*S/(x*x);return A>1&&T<=1}getBounds(t){return t||(t=new Ti),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function g5(e,t,n,i,r,s){const l=e-n,c=t-i,f=r-n,p=s-i,m=l*f+c*p,g=f*f+p*p;let x=-1;g!==0&&(x=m/g);let v,S;x<0?(v=n,S=i):x>1?(v=r,S=s):(v=n+x*f,S=i+x*p);const A=e-v,T=t-S;return A*A+T*T}let y5,x5;class Sm{constructor(...t){this.type="polygon";let n=Array.isArray(t[0])?t[0]:t;if(typeof n[0]!="number"){const i=[];for(let r=0,s=n.length;r<s;r++)i.push(n[r].x,n[r].y);n=i}this.points=n,this.closePath=!0}isClockwise(){let t=0;const n=this.points,i=n.length;for(let r=0;r<i;r+=2){const s=n[r],l=n[r+1],c=n[(r+2)%i],f=n[(r+3)%i];t+=(c-s)*(f+l)}return t<0}containsPolygon(t){const n=this.getBounds(y5),i=t.getBounds(x5);if(!n.containsRect(i))return!1;const r=t.points;for(let s=0;s<r.length;s+=2){const l=r[s],c=r[s+1];if(!this.contains(l,c))return!1}return!0}clone(){const t=this.points.slice(),n=new Sm(t);return n.closePath=this.closePath,n}contains(t,n){let i=!1;const r=this.points.length/2;for(let s=0,l=r-1;s<r;l=s++){const c=this.points[s*2],f=this.points[s*2+1],p=this.points[l*2],m=this.points[l*2+1];f>n!=m>n&&t<(p-c)*((n-f)/(m-f))+c&&(i=!i)}return i}strokeContains(t,n,i,r=.5){const s=i*i,l=s*(1-r),c=s-l,{points:f}=this,p=f.length-(this.closePath?0:2);for(let m=0;m<p;m+=2){const g=f[m],x=f[m+1],v=f[(m+2)%f.length],S=f[(m+3)%f.length],A=g5(t,n,g,x,v,S),T=Math.sign((v-g)*(n-x)-(S-x)*(t-g));if(A<=(T<0?c:l))return!0}return!1}getBounds(t){t||(t=new Ti);const n=this.points;let i=1/0,r=-1/0,s=1/0,l=-1/0;for(let c=0,f=n.length;c<f;c+=2){const p=n[c],m=n[c+1];i=p<i?p:i,r=p>r?p:r,s=m<s?m:s,l=m>l?m:l}return t.x=i,t.width=r-i,t.y=s,t.height=l-s,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,n)=>`${t}, ${n}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return en("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return en("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const Py=(e,t,n,i,r,s,l)=>{const c=e-n,f=t-i,p=Math.sqrt(c*c+f*f);return p>=r-s&&p<=r+l};class o_{constructor(t=0,n=0,i=0,r=0,s=20){this.type="roundedRectangle",this.x=t,this.y=n,this.width=i,this.height=r,this.radius=s}getBounds(t){return t||(t=new Ti),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new o_(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,n){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&n>=this.y&&n<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(n>=this.y+i&&n<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),s=n-(this.y+i);const l=i*i;if(r*r+s*s<=l||(r=t-(this.x+this.width-i),r*r+s*s<=l)||(s=n-(this.y+this.height-i),r*r+s*s<=l)||(r=t-(this.x+i),r*r+s*s<=l))return!0}return!1}strokeContains(t,n,i,r=.5){const{x:s,y:l,width:c,height:f,radius:p}=this,m=i*(1-r),g=i-m,x=s+p,v=l+p,S=c-p*2,A=f-p*2,T=s+c,C=l+f;return(t>=s-m&&t<=s+g||t>=T-g&&t<=T+m)&&n>=v&&n<=v+A||(n>=l-m&&n<=l+g||n>=C-g&&n<=C+m)&&t>=x&&t<=x+S?!0:t<x&&n<v&&Py(t,n,x,v,p,g,m)||t>T-p&&n<v&&Py(t,n,T-p,v,p,g,m)||t>T-p&&n>C-p&&Py(t,n,T-p,C-p,p,g,m)||t<x&&n>C-p&&Py(t,n,x,C-p,p,g,m)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const ZA={};function b5(e,t,n){let i=2166136261;for(let r=0;r<t;r++)i^=e[r].uid,i=Math.imul(i,16777619),i>>>=0;return ZA[i]||v5(e,t,i,n)}function v5(e,t,n,i){const r={};let s=0;for(let c=0;c<i;c++){const f=c<t?e[c]:Mn.EMPTY.source;r[s++]=f.source,r[s++]=f.style}const l=new y0(r);return ZA[n]=l,l}class tw{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}function nw(e,t,n,i){if(n??(n=0),i??(i=Math.min(e.byteLength-n,t.byteLength)),!(n&7)&&!(i&7)){const r=i/8;new Float64Array(t,0,r).set(new Float64Array(e,n,r))}else if(!(n&3)&&!(i&3)){const r=i/4;new Float32Array(t,0,r).set(new Float32Array(e,n,r))}else new Uint8Array(t).set(new Uint8Array(e,n,i))}const _5={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var S5=(e=>(e[e.DISABLED=0]="DISABLED",e[e.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",e[e.MASK_ACTIVE=2]="MASK_ACTIVE",e[e.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",e[e.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",e[e.NONE=5]="NONE",e))(S5||{});function iw(e,t){return t.alphaMode==="no-premultiply-alpha"&&_5[e]||e}const E5=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
82
+ ${e}`}function kz(e,t){return t?e.replace("#version 300 es",""):e}const kb={stripVersion:kz,ensurePrecision:Tz,addProgramDefines:wz,setProgramName:Rz,insertVersion:Cz},Qp=Object.create(null),OA=class Qv{constructor(t){t={...Qv.defaultOptions,...t};const n=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Ez()},setProgramName:{name:t.name},addProgramDefines:n,insertVersion:n};let r=t.fragment,s=t.vertex;Object.keys(kb).forEach(l=>{const c=i[l];r=kb[l](r,c,!0),s=kb[l](s,c,!1)}),this.fragment=r,this.vertex=s,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=n_(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,Qp[this._cacheKey]=null}static from(t){const n=`${t.vertex}:${t.fragment}`;return Qp[n]||(Qp[n]=new Qv(t),Qp[n]._cacheKey=n),Qp[n]}};OA.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let i_=OA;const KE={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function Nz(e){return KE[e]??KE.float32}const Oz={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},$E=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function WE(e,t){let n;for(;(n=$E.exec(e))!==null;){const i=Oz[n[3]]??"float32";t[n[2]]={location:parseInt(n[1],10),format:i,stride:Nz(i).stride,offset:0,instance:!1,start:0}}$E.lastIndex=0}function Dz(e){return e.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function zz({source:e,entryPoint:t}){const n={},i=Dz(e),r=i.indexOf(`fn ${t}(`);if(r===-1)return n;const s=i.indexOf("->",r);if(s===-1)return n;const l=i.substring(r,s);if(WE(l,n),Object.keys(n).length===0){const c=l.match(/\(\s*\w+\s*:\s*(\w+)/);if(c){const f=c[1],p=new RegExp(`struct\\s+${f}\\s*\\{([^}]+)\\}`,"s"),m=i.match(p);m&&WE(m[1],n)}}return n}function Nb(e){var g,x;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,s=/:\s*([\w<>]+)/,l=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,f=/struct\s+(\w+)/,p=(g=e.match(t))==null?void 0:g.map(v=>({group:parseInt(v.match(n)[1],10),binding:parseInt(v.match(i)[1],10),name:v.match(r)[2],isUniform:v.match(r)[1]==="<uniform>",type:v.match(s)[1]}));if(!p)return{groups:[],structs:[]};const m=((x=e.match(l))==null?void 0:x.map(v=>{const S=v.match(f)[1],A=v.match(c).reduce((T,C)=>{const[N,R]=C.split(":");return T[N.trim()]=R.trim(),T},{});return A?{name:S,members:A}:null}).filter(({name:v})=>p.some(S=>S.type===v||S.type.includes(`<${v}>`))))??[];return{groups:p,structs:m}}var fd=(e=>(e[e.VERTEX=1]="VERTEX",e[e.FRAGMENT=2]="FRAGMENT",e[e.COMPUTE=4]="COMPUTE",e))(fd||{});function Bz({groups:e}){const t=[];for(let n=0;n<e.length;n++){const i=e[n];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:fd.VERTEX|fd.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"||i.type.startsWith("texture_2d<")?t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):i.type==="texture_2d_array"||i.type.startsWith("texture_2d_array<")?t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(i.type==="texture_cube"||i.type.startsWith("texture_cube<"))&&t[i.group].push({binding:i.binding,visibility:fd.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let n=0;n<t.length;n++)t[n]||(t[n]=[]);return t}function Lz({groups:e}){const t=[];for(let n=0;n<e.length;n++){const i=e[n];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function jz(e,t){const n=new Set,i=new Set,r=[...e.structs,...t.structs].filter(l=>n.has(l.name)?!1:(n.add(l.name),!0)),s=[...e.groups,...t.groups].filter(l=>{const c=`${l.name}-${l.binding}`;return i.has(c)?!1:(i.add(c),!0)});return{structs:r,groups:s}}const Zp=Object.create(null);class Zm{constructor(t){var c,f;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:n,vertex:i,layout:r,gpuLayout:s,name:l}=t;if(this.name=l,this.fragment=n,this.vertex=i,n.source===i.source){const p=Nb(n.source);this.structsAndGroups=p}else{const p=Nb(i.source),m=Nb(n.source);this.structsAndGroups=jz(p,m)}this.layout=r??Lz(this.structsAndGroups),this.gpuLayout=s??Bz(this.structsAndGroups),this.autoAssignGlobalUniforms=((c=this.layout[0])==null?void 0:c.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((f=this.layout[1])==null?void 0:f.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:n}=this,i=t.source+n.source+t.entryPoint+n.entryPoint;this._layoutKey=n_(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=zz(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Zp[this._cacheKey]=null}static from(t){const n=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Zp[n]||(Zp[n]=new Zm(t),Zp[n]._cacheKey=n),Zp[n]}}const DA=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Iz=DA.reduce((e,t)=>(e[t]=!0,e),{});function Uz(e,t){switch(e){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const zA=class BA{constructor(t,n){this._touched=0,this.uid=bi("uniform"),this._resourceType="uniformGroup",this._resourceId=bi("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...BA.defaultOptions,...n},this.uniformStructures=t;const i={};for(const r in t){const s=t[r];if(s.name=r,s.size=s.size??1,!Iz[s.type]){const l=s.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(l){const[,c,f]=l;throw new Error(`Uniform type ${s.type} is not supported. Use type: '${c}', size: ${f} instead.`)}throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${DA.join(", ")}`)}s.value??(s.value=Uz(s.type,s.size)),i[r]=s.value}this.uniforms=i,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=n_(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};zA.defaultOptions={ubo:!1,isStatic:!1};let LA=zA;class y0{constructor(t){this.resources=Object.create(null),this._dirty=!0;let n=0;for(const i in t){const r=t[i];this.setResource(r,n++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let n=0;for(const i in this.resources)t[n++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,n){var r,s;const i=this.resources[n];t!==i&&((r=i==null?void 0:i.off)==null||r.call(i,"change",this.onResourceChange,this),(s=t.on)==null||s.call(t,"change",this.onResourceChange,this),this.resources[n]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,n){const i=this.resources;for(const r in i)i[r]._gcLastUsed=t,i[r]._touched=n}destroy(){var n;const t=this.resources;for(const i in t){const r=t[i];(n=r==null?void 0:r.off)==null||n.call(r,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var Zv=(e=>(e[e.WEBGL=1]="WEBGL",e[e.WEBGPU=2]="WEBGPU",e[e.CANVAS=4]="CANVAS",e[e.BOTH=3]="BOTH",e))(Zv||{});class nx extends yo{constructor(t){super(),this.uid=bi("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:n,glProgram:i,groups:r,resources:s,compatibleRenderers:l,groupMap:c}=t;this.gpuProgram=n,this.glProgram=i,l===void 0&&(l=0,n&&(l|=Zv.WEBGPU),i&&(l|=Zv.WEBGL)),this.compatibleRenderers=l;const f={};if(!s&&!r&&(s={}),s&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!n&&r&&!c)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!n&&r&&c)for(const p in c)for(const m in c[p]){const g=c[p][m];f[g]={group:p,binding:m,name:g}}else if(n&&r&&!c){const p=n.structsAndGroups.groups;c={},p.forEach(m=>{c[m.group]=c[m.group]||{},c[m.group][m.binding]=m.name,f[m.name]=m})}else if(s){r={},c={},n&&n.structsAndGroups.groups.forEach(g=>{c[g.group]=c[g.group]||{},c[g.group][g.binding]=g.name,f[g.name]=g});let p=0;for(const m in s)f[m]||(r[99]||(r[99]=new y0,this._ownedBindGroups.push(r[99])),f[m]={group:99,binding:p,name:m},c[99]=c[99]||{},c[99][p]=m,p++);for(const m in s){const g=m;let x=s[m];!x.source&&!x._resourceType&&(x=new LA(x));const v=f[g];v&&(r[v.group]||(r[v.group]=new y0,this._ownedBindGroups.push(r[v.group])),r[v.group].setResource(x,v.binding))}}this.groups=r,this._uniformBindMap=c,this.resources=this._buildResourceAccessor(r,f)}addResource(t,n,i){var r,s;(r=this._uniformBindMap)[n]||(r[n]={}),(s=this._uniformBindMap[n])[i]||(s[i]=t),this.groups[n]||(this.groups[n]=new y0,this._ownedBindGroups.push(this.groups[n]))}_buildResourceAccessor(t,n){const i={};for(const r in n){const s=n[r];Object.defineProperty(i,s.name,{get(){return t[s.group].getResource(s.binding)},set(l){t[s.group].setResource(l,s.binding)}})}return i}destroy(t=!1){var n,i;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&((n=this.gpuProgram)==null||n.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:n,gl:i,...r}=t;let s,l;return n&&(s=Zm.from(n)),i&&(l=i_.from(i)),new nx({gpuProgram:s,glProgram:l,...r})}}const Hz={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Ob=0,Db=1,zb=2,Bb=3,Lb=4,jb=5,Jv=class jA{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ob)}set blend(t){!!(this.data&1<<Ob)!==t&&(this.data^=1<<Ob)}get offsets(){return!!(this.data&1<<Db)}set offsets(t){!!(this.data&1<<Db)!==t&&(this.data^=1<<Db)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<zb)}set culling(t){!!(this.data&1<<zb)!==t&&(this.data^=1<<zb)}get depthTest(){return!!(this.data&1<<Bb)}set depthTest(t){!!(this.data&1<<Bb)!==t&&(this.data^=1<<Bb)}get depthMask(){return!!(this.data&1<<jb)}set depthMask(t){!!(this.data&1<<jb)!==t&&(this.data^=1<<jb)}get clockwiseFrontFace(){return!!(this.data&1<<Lb)}set clockwiseFrontFace(t){!!(this.data&1<<Lb)!==t&&(this.data^=1<<Lb)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=Hz[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const t=new jA;return t.depthTest=!1,t.blend=!0,t}};Jv.default2d=Jv.for2d();let r_=Jv;const IA=class e1 extends nx{constructor(t){t={...e1.defaultOptions,...t},super(t),this.enabled=!0,this._state=r_.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1),t.blendRequired&&this.addResource("uBackTexture",0,3)}apply(t,n,i,r){t.applyFilter(this,n,i,r)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const{gpu:n,gl:i,...r}=t;let s,l;return n&&(s=Zm.from(n)),i&&(l=i_.from(i)),new e1({gpuProgram:s,glProgram:l,...r})}};IA.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let Ad=IA;const t1=[];li.handleByNamedList(kt.Environment,t1);async function Pz(e){if(!e)for(let t=0;t<t1.length;t++){const n=t1[t];if(n.value.test()){await n.value.load();return}}}let Jp;function Fz(){if(typeof Jp=="boolean")return Jp;try{Jp=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Jp=!1}return Jp}function QE(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=UA(e,0,r,n,!0);const l=[];if(!s||s.next===s.prev)return l;let c,f,p;if(i&&(s=Xz(e,t,s,n)),e.length>80*n){c=e[0],f=e[1];let m=c,g=f;for(let x=n;x<r;x+=n){const v=e[x],S=e[x+1];v<c&&(c=v),S<f&&(f=S),v>m&&(m=v),S>g&&(g=S)}p=Math.max(m-c,g-f),p=p!==0?32767/p:0}return Om(s,l,n,c,f,p,0),l}function UA(e,t,n,i,r){let s;if(r===r5(e,t,n,i)>0)for(let l=t;l<n;l+=i)s=ZE(l/i|0,e[l],e[l+1],s);else for(let l=n-i;l>=t;l-=i)s=ZE(l/i|0,e[l],e[l+1],s);return s&&uh(s,s.next)&&(zm(s),s=s.next),s}function vd(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&(uh(n,n.next)||si(n.prev,n,n.next)===0)){if(zm(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function Om(e,t,n,i,r,s,l){if(!e)return;!l&&s&&Zz(e,i,r,s);let c=e;for(;e.prev!==e.next;){const f=e.prev,p=e.next;if(s?qz(e,i,r,s):Gz(e)){t.push(f.i,e.i,p.i),zm(e),e=p.next,c=p.next;continue}if(e=p,e===c){l?l===1?(e=Yz(vd(e),t),Om(e,t,n,i,r,s,2)):l===2&&Vz(e,t,n,i,r,s):Om(vd(e),t,n,i,r,s,1);break}}}function Gz(e){const t=e.prev,n=e,i=e.next;if(si(t,n,i)>=0)return!1;const r=t.x,s=n.x,l=i.x,c=t.y,f=n.y,p=i.y,m=Math.min(r,s,l),g=Math.min(c,f,p),x=Math.max(r,s,l),v=Math.max(c,f,p);let S=i.next;for(;S!==t;){if(S.x>=m&&S.x<=x&&S.y>=g&&S.y<=v&&mm(r,c,s,f,l,p,S.x,S.y)&&si(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function qz(e,t,n,i){const r=e.prev,s=e,l=e.next;if(si(r,s,l)>=0)return!1;const c=r.x,f=s.x,p=l.x,m=r.y,g=s.y,x=l.y,v=Math.min(c,f,p),S=Math.min(m,g,x),A=Math.max(c,f,p),T=Math.max(m,g,x),C=n1(v,S,t,n,i),N=n1(A,T,t,n,i);let R=e.prevZ,D=e.nextZ;for(;R&&R.z>=C&&D&&D.z<=N;){if(R.x>=v&&R.x<=A&&R.y>=S&&R.y<=T&&R!==r&&R!==l&&mm(c,m,f,g,p,x,R.x,R.y)&&si(R.prev,R,R.next)>=0||(R=R.prevZ,D.x>=v&&D.x<=A&&D.y>=S&&D.y<=T&&D!==r&&D!==l&&mm(c,m,f,g,p,x,D.x,D.y)&&si(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;R&&R.z>=C;){if(R.x>=v&&R.x<=A&&R.y>=S&&R.y<=T&&R!==r&&R!==l&&mm(c,m,f,g,p,x,R.x,R.y)&&si(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;D&&D.z<=N;){if(D.x>=v&&D.x<=A&&D.y>=S&&D.y<=T&&D!==r&&D!==l&&mm(c,m,f,g,p,x,D.x,D.y)&&si(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function Yz(e,t){let n=e;do{const i=n.prev,r=n.next.next;!uh(i,r)&&PA(i,n,n.next,r)&&Dm(i,r)&&Dm(r,i)&&(t.push(i.i,n.i,r.i),zm(n),zm(n.next),n=e=r),n=n.next}while(n!==e);return vd(n)}function Vz(e,t,n,i,r,s){let l=e;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&t5(l,c)){let f=FA(l,c);l=vd(l,l.next),f=vd(f,f.next),Om(l,t,n,i,r,s,0),Om(f,t,n,i,r,s,0);return}c=c.next}l=l.next}while(l!==e)}function Xz(e,t,n,i){const r=[];for(let s=0,l=t.length;s<l;s++){const c=t[s]*i,f=s<l-1?t[s+1]*i:e.length,p=UA(e,c,f,i,!1);p===p.next&&(p.steiner=!0),r.push(e5(p))}r.sort(Kz);for(let s=0;s<r.length;s++)n=$z(r[s],n);return n}function Kz(e,t){let n=e.x-t.x;if(n===0&&(n=e.y-t.y,n===0)){const i=(e.next.y-e.y)/(e.next.x-e.x),r=(t.next.y-t.y)/(t.next.x-t.x);n=i-r}return n}function $z(e,t){const n=Wz(e,t);if(!n)return t;const i=FA(n,e);return vd(i,i.next),vd(n,n.next)}function Wz(e,t){let n=t;const i=e.x,r=e.y;let s=-1/0,l;if(uh(e,n))return n;do{if(uh(e,n.next))return n.next;if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const g=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(g<=i&&g>s&&(s=g,l=n.x<n.next.x?n:n.next,g===i))return l}n=n.next}while(n!==t);if(!l)return null;const c=l,f=l.x,p=l.y;let m=1/0;n=l;do{if(i>=n.x&&n.x>=f&&i!==n.x&&HA(r<p?i:s,r,f,p,r<p?s:i,r,n.x,n.y)){const g=Math.abs(r-n.y)/(i-n.x);Dm(n,e)&&(g<m||g===m&&(n.x>l.x||n.x===l.x&&Qz(l,n)))&&(l=n,m=g)}n=n.next}while(n!==c);return l}function Qz(e,t){return si(e.prev,e,t.prev)<0&&si(t.next,e,e.next)<0}function Zz(e,t,n,i){let r=e;do r.z===0&&(r.z=n1(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,Jz(r)}function Jz(e){let t,n=1;do{let i=e,r;e=null;let s=null;for(t=0;i;){t++;let l=i,c=0;for(let p=0;p<n&&(c++,l=l.nextZ,!!l);p++);let f=n;for(;c>0||f>0&&l;)c!==0&&(f===0||!l||i.z<=l.z)?(r=i,i=i.nextZ,c--):(r=l,l=l.nextZ,f--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;i=l}s.nextZ=null,n*=2}while(t>1);return e}function n1(e,t,n,i,r){return e=(e-n)*r|0,t=(t-i)*r|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function e5(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function HA(e,t,n,i,r,s,l,c){return(r-l)*(t-c)>=(e-l)*(s-c)&&(e-l)*(i-c)>=(n-l)*(t-c)&&(n-l)*(s-c)>=(r-l)*(i-c)}function mm(e,t,n,i,r,s,l,c){return!(e===l&&t===c)&&HA(e,t,n,i,r,s,l,c)}function t5(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!n5(e,t)&&(Dm(e,t)&&Dm(t,e)&&i5(e,t)&&(si(e.prev,e,t.prev)||si(e,t.prev,t))||uh(e,t)&&si(e.prev,e,e.next)>0&&si(t.prev,t,t.next)>0)}function si(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function uh(e,t){return e.x===t.x&&e.y===t.y}function PA(e,t,n,i){const r=Iy(si(e,t,n)),s=Iy(si(e,t,i)),l=Iy(si(n,i,e)),c=Iy(si(n,i,t));return!!(r!==s&&l!==c||r===0&&jy(e,n,t)||s===0&&jy(e,i,t)||l===0&&jy(n,e,i)||c===0&&jy(n,t,i))}function jy(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Iy(e){return e>0?1:e<0?-1:0}function n5(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&PA(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Dm(e,t){return si(e.prev,e,e.next)<0?si(e,t,e.next)>=0&&si(e,e.prev,t)>=0:si(e,t,e.prev)<0||si(e,e.next,t)<0}function i5(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function FA(e,t){const n=i1(e.i,e.x,e.y),i=i1(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function ZE(e,t,n,i){const r=i1(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function zm(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function i1(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function r5(e,t,n,i){let r=0;for(let s=t,l=n-i;s<n;s+=i)r+=(e[l]-e[s])*(e[s+1]+e[l+1]),l=s;return r}const a5=QE.default||QE;var GA=(e=>(e[e.NONE=0]="NONE",e[e.COLOR=16384]="COLOR",e[e.STENCIL=1024]="STENCIL",e[e.DEPTH=256]="DEPTH",e[e.COLOR_DEPTH=16640]="COLOR_DEPTH",e[e.COLOR_STENCIL=17408]="COLOR_STENCIL",e[e.DEPTH_STENCIL=1280]="DEPTH_STENCIL",e[e.ALL=17664]="ALL",e))(GA||{});class s5{constructor(t){this.items=[],this._name=t}emit(t,n,i,r,s,l,c,f){const{name:p,items:m}=this;for(let g=0,x=m.length;g<x;g++)m[g][p](t,n,i,r,s,l,c,f);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const n=this.items.indexOf(t);return n!==-1&&this.items.splice(n,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}const l5=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],qA=class YA extends yo{constructor(t){super(),this.tick=0,this.uid=bi("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const n=[...l5,...this.config.runners??[]];this._addRunners(...n),this._unsafeEvalCheck()}async init(t={}){const n=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Pz(n),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...YA.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,n){this.tick++;let i=t;if(i instanceof _r&&(i={container:i},n&&(en(xi,"passing a second argument is deprecated, please use render options instead"),i.target=n.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){const r=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=r?i.clearColor:qi.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.visible&&(i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i))}resize(t,n,i){const r=this.view.resolution;this.view.resize(t,n,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==r&&this.runners.resolutionChange.emit(i)}clear(t={}){const n=this;t.target||(t.target=n.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=GA.ALL);const{clear:i,clearColor:r,target:s,mipLevel:l,layer:c}=t;qi.shared.setValue(r??this.background.colorRgba),n.renderTarget.clear(s,i,qi.shared.toArray(),l??0,c??0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(n=>{this.runners[n]=new s5(n)})}_addSystems(t){let n;for(n in t){const i=t[n];this._addSystem(i.value,i.name)}}_addSystem(t,n){const i=new t(this);if(this[n])throw new Error(`Whoops! The name "${n}" is already in use`);this[n]=i,this._systemsHash[n]=i;for(const r in this.runners)this.runners[r].add(i);return this}_addPipes(t,n){const i=n.reduce((r,s)=>(r[s.name]=s.value,r),{});t.forEach(r=>{const s=r.value,l=r.name,c=i[l];this.renderPipes[l]=new s(this,c?new c:null),this.runners.destroy.add(this.renderPipes[l])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&Qm.release(),Object.values(this.runners).forEach(n=>{n.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Fz())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};qA.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let VA=qA,Uy;function o5(e){return Uy!==void 0||(Uy=(()=>{var n;const t={stencil:!0,failIfMajorPerformanceCaveat:e??VA.defaultOptions.failIfMajorPerformanceCaveat};try{if(!is.get().getWebGLRenderingContext())return!1;let r=is.get().createCanvas().getContext("webgl",t);const s=!!((n=r==null?void 0:r.getContextAttributes())!=null&&n.stencil);if(r){const l=r.getExtension("WEBGL_lose_context");l&&l.loseContext()}return r=null,s}catch{return!1}})()),Uy}let Hy;async function c5(e={}){return Hy!==void 0||(Hy=await(async()=>{const t=is.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(e)).requestDevice(),!0}catch{return!1}})()),Hy}const JE=["webgl","webgpu","canvas"];async function u5(e){let t=[];e.preference?(t.push(e.preference),JE.forEach(s=>{s!==e.preference&&t.push(s)})):t=JE.slice();let n,i={};for(let s=0;s<t.length;s++){const l=t[s];if(l==="webgpu"&&await c5()){const{WebGPURenderer:c}=await ou(async()=>{const{WebGPURenderer:f}=await import("./WebGPURenderer-CKo3lcKT.js");return{WebGPURenderer:f}},__vite__mapDeps([4,5,6]));n=c,i={...e,...e.webgpu};break}else if(l==="webgl"&&o5(e.failIfMajorPerformanceCaveat??VA.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:c}=await ou(async()=>{const{WebGLRenderer:f}=await import("./WebGLRenderer-DNCdu3jO.js");return{WebGLRenderer:f}},__vite__mapDeps([7,5,6]));n=c,i={...e,...e.webgl};break}else if(l==="canvas"){const{CanvasRenderer:c}=await ou(async()=>{const{CanvasRenderer:f}=await import("./CanvasRenderer-BZ7OTSuR.js");return{CanvasRenderer:f}},__vite__mapDeps([8,6]));n=c,i={...e,...e.canvasOptions};break}}if(delete i.webgpu,delete i.webgl,delete i.canvasOptions,!n)throw new Error("No available renderer for the current environment");const r=new n;return await r.init(i),r}const XA="8.17.0";class KA{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,XA)}static destroy(){}}KA.extension=kt.Application;class d5{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,XA)}destroy(){this._renderer=null}}d5.extension={type:[kt.WebGLSystem,kt.WebGPUSystem],name:"initHook",priority:-10};class $A{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,set(n){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=n,n&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let n,i;if(this._resizeTo===globalThis.window)n=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:s}=this._resizeTo;n=r,i=s}this.renderer.resize(n,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}$A.extension=kt.Application;class WA{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(n){this._ticker&&this._ticker.remove(this.render,this),this._ticker=n,n&&n.add(this.render,this,M0.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Wf.shared:new Wf,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}WA.extension=kt.Application;li.add($A);li.add(WA);const QA=class r1{constructor(...t){this.stage=new _r,t[0]!==void 0&&en(xi,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new _r),this.renderer=await u5(t),r1._plugins.forEach(n=>{n.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return en(xi,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,n=!1){const i=r1._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(n),this.stage=null,this.renderer.destroy(t),this.renderer=null}};QA._plugins=[];let a_=QA;li.handleByList(kt.Application,a_._plugins);li.add(KA);var Ib,ew;function f5(){if(ew)return Ib;ew=1,Ib=n;var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(s){var l=[];return s.replace(t,function(c,f,p){var m=f.toLowerCase();for(p=r(p),m=="m"&&p.length>2&&(l.push([f].concat(p.splice(0,2))),m="l",f=f=="m"?"l":"L");;){if(p.length==e[m])return p.unshift(f),l.push(p);if(p.length<e[m])throw new Error("malformed path data");l.push([f].concat(p.splice(0,e[m])))}}),l}var i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function r(s){var l=s.match(i);return l?l.map(Number):[]}return Ib}var h5=f5();const p5=du(h5);function m5(e,t){const n=p5(e),i=[];let r=null,s=0,l=0;for(let c=0;c<n.length;c++){const f=n[c],p=f[0],m=f;switch(p){case"M":s=m[1],l=m[2],t.moveTo(s,l);break;case"m":s+=m[1],l+=m[2],t.moveTo(s,l);break;case"H":s=m[1],t.lineTo(s,l);break;case"h":s+=m[1],t.lineTo(s,l);break;case"V":l=m[1],t.lineTo(s,l);break;case"v":l+=m[1],t.lineTo(s,l);break;case"L":s=m[1],l=m[2],t.lineTo(s,l);break;case"l":s+=m[1],l+=m[2],t.lineTo(s,l);break;case"C":s=m[5],l=m[6],t.bezierCurveTo(m[1],m[2],m[3],m[4],s,l);break;case"c":t.bezierCurveTo(s+m[1],l+m[2],s+m[3],l+m[4],s+m[5],l+m[6]),s+=m[5],l+=m[6];break;case"S":s=m[3],l=m[4],t.bezierCurveToShort(m[1],m[2],s,l);break;case"s":t.bezierCurveToShort(s+m[1],l+m[2],s+m[3],l+m[4]),s+=m[3],l+=m[4];break;case"Q":s=m[3],l=m[4],t.quadraticCurveTo(m[1],m[2],s,l);break;case"q":t.quadraticCurveTo(s+m[1],l+m[2],s+m[3],l+m[4]),s+=m[3],l+=m[4];break;case"T":s=m[1],l=m[2],t.quadraticCurveToShort(s,l);break;case"t":s+=m[1],l+=m[2],t.quadraticCurveToShort(s,l);break;case"A":s=m[6],l=m[7],t.arcToSvg(m[1],m[2],m[3],m[4],m[5],s,l);break;case"a":s+=m[6],l+=m[7],t.arcToSvg(m[1],m[2],m[3],m[4],m[5],s,l);break;case"Z":case"z":t.closePath(),i.length>0&&(r=i.pop(),r?(s=r.startX,l=r.startY):(s=0,l=0)),r=null;break;default:ma(`Unknown SVG path command: ${p}`)}p!=="Z"&&p!=="z"&&r===null&&(r={startX:s,startY:l},i.push(r))}return t}class s_{constructor(t=0,n=0,i=0){this.type="circle",this.x=t,this.y=n,this.radius=i}clone(){return new s_(this.x,this.y,this.radius)}contains(t,n){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,s=this.y-n;return r*=r,s*=s,r+s<=i}strokeContains(t,n,i,r=.5){if(this.radius===0)return!1;const s=this.x-t,l=this.y-n,c=this.radius,f=(1-r)*i,p=Math.sqrt(s*s+l*l);return p<=c+f&&p>c-(i-f)}getBounds(t){return t||(t=new Ti),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class l_{constructor(t=0,n=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=n,this.halfWidth=i,this.halfHeight=r}clone(){return new l_(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,n){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,r=(n-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,n,i,r=.5){const{halfWidth:s,halfHeight:l}=this;if(s<=0||l<=0)return!1;const c=i*(1-r),f=i-c,p=s-f,m=l-f,g=s+c,x=l+c,v=t-this.x,S=n-this.y,A=v*v/(p*p)+S*S/(m*m),T=v*v/(g*g)+S*S/(x*x);return A>1&&T<=1}getBounds(t){return t||(t=new Ti),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function g5(e,t,n,i,r,s){const l=e-n,c=t-i,f=r-n,p=s-i,m=l*f+c*p,g=f*f+p*p;let x=-1;g!==0&&(x=m/g);let v,S;x<0?(v=n,S=i):x>1?(v=r,S=s):(v=n+x*f,S=i+x*p);const A=e-v,T=t-S;return A*A+T*T}let y5,x5;class Sm{constructor(...t){this.type="polygon";let n=Array.isArray(t[0])?t[0]:t;if(typeof n[0]!="number"){const i=[];for(let r=0,s=n.length;r<s;r++)i.push(n[r].x,n[r].y);n=i}this.points=n,this.closePath=!0}isClockwise(){let t=0;const n=this.points,i=n.length;for(let r=0;r<i;r+=2){const s=n[r],l=n[r+1],c=n[(r+2)%i],f=n[(r+3)%i];t+=(c-s)*(f+l)}return t<0}containsPolygon(t){const n=this.getBounds(y5),i=t.getBounds(x5);if(!n.containsRect(i))return!1;const r=t.points;for(let s=0;s<r.length;s+=2){const l=r[s],c=r[s+1];if(!this.contains(l,c))return!1}return!0}clone(){const t=this.points.slice(),n=new Sm(t);return n.closePath=this.closePath,n}contains(t,n){let i=!1;const r=this.points.length/2;for(let s=0,l=r-1;s<r;l=s++){const c=this.points[s*2],f=this.points[s*2+1],p=this.points[l*2],m=this.points[l*2+1];f>n!=m>n&&t<(p-c)*((n-f)/(m-f))+c&&(i=!i)}return i}strokeContains(t,n,i,r=.5){const s=i*i,l=s*(1-r),c=s-l,{points:f}=this,p=f.length-(this.closePath?0:2);for(let m=0;m<p;m+=2){const g=f[m],x=f[m+1],v=f[(m+2)%f.length],S=f[(m+3)%f.length],A=g5(t,n,g,x,v,S),T=Math.sign((v-g)*(n-x)-(S-x)*(t-g));if(A<=(T<0?c:l))return!0}return!1}getBounds(t){t||(t=new Ti);const n=this.points;let i=1/0,r=-1/0,s=1/0,l=-1/0;for(let c=0,f=n.length;c<f;c+=2){const p=n[c],m=n[c+1];i=p<i?p:i,r=p>r?p:r,s=m<s?m:s,l=m>l?m:l}return t.x=i,t.width=r-i,t.y=s,t.height=l-s,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,n)=>`${t}, ${n}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return en("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return en("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const Py=(e,t,n,i,r,s,l)=>{const c=e-n,f=t-i,p=Math.sqrt(c*c+f*f);return p>=r-s&&p<=r+l};class o_{constructor(t=0,n=0,i=0,r=0,s=20){this.type="roundedRectangle",this.x=t,this.y=n,this.width=i,this.height=r,this.radius=s}getBounds(t){return t||(t=new Ti),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new o_(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,n){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&n>=this.y&&n<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(n>=this.y+i&&n<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),s=n-(this.y+i);const l=i*i;if(r*r+s*s<=l||(r=t-(this.x+this.width-i),r*r+s*s<=l)||(s=n-(this.y+this.height-i),r*r+s*s<=l)||(r=t-(this.x+i),r*r+s*s<=l))return!0}return!1}strokeContains(t,n,i,r=.5){const{x:s,y:l,width:c,height:f,radius:p}=this,m=i*(1-r),g=i-m,x=s+p,v=l+p,S=c-p*2,A=f-p*2,T=s+c,C=l+f;return(t>=s-m&&t<=s+g||t>=T-g&&t<=T+m)&&n>=v&&n<=v+A||(n>=l-m&&n<=l+g||n>=C-g&&n<=C+m)&&t>=x&&t<=x+S?!0:t<x&&n<v&&Py(t,n,x,v,p,g,m)||t>T-p&&n<v&&Py(t,n,T-p,v,p,g,m)||t>T-p&&n>C-p&&Py(t,n,T-p,C-p,p,g,m)||t<x&&n>C-p&&Py(t,n,x,C-p,p,g,m)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const ZA={};function b5(e,t,n){let i=2166136261;for(let r=0;r<t;r++)i^=e[r].uid,i=Math.imul(i,16777619),i>>>=0;return ZA[i]||v5(e,t,i,n)}function v5(e,t,n,i){const r={};let s=0;for(let c=0;c<i;c++){const f=c<t?e[c]:Mn.EMPTY.source;r[s++]=f.source,r[s++]=f.style}const l=new y0(r);return ZA[n]=l,l}class tw{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}function nw(e,t,n,i){if(n??(n=0),i??(i=Math.min(e.byteLength-n,t.byteLength)),!(n&7)&&!(i&7)){const r=i/8;new Float64Array(t,0,r).set(new Float64Array(e,n,r))}else if(!(n&3)&&!(i&3)){const r=i/4;new Float32Array(t,0,r).set(new Float32Array(e,n,r))}else new Uint8Array(t).set(new Uint8Array(e,n,i))}const _5={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var S5=(e=>(e[e.DISABLED=0]="DISABLED",e[e.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",e[e.MASK_ACTIVE=2]="MASK_ACTIVE",e[e.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",e[e.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",e[e.NONE=5]="NONE",e))(S5||{});function iw(e,t){return t.alphaMode==="no-premultiply-alpha"&&_5[e]||e}const E5=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
83
83
  `);function w5(e){let t="";for(let n=0;n<e;++n)n>0&&(t+=`
84
84
  else `),n<e-1&&(t+=`if(test == ${n}.0){}`);return t}function T5(e,t){if(e===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const n=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const i=E5.replace(/%forloop%/gi,w5(e));if(t.shaderSource(n,i),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))e=e/2|0;else break}}finally{t.deleteShader(n)}return e}let Bf=null;function C5(){var t;if(Bf)return Bf;const e=NA();return Bf=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Bf=T5(Bf,e),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext(),Bf}class A5{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const n=this.textures[t];this.textures[t]=null,this.ids[n.uid]=null}this.count=0}}class M5{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new A5,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const Em=[];let R0=0;Qm.register({clear:()=>{if(Em.length>0)for(const e of Em)e&&e.destroy();Em.length=0,R0=0}});function rw(){return R0>0?Em[--R0]:new M5}function aw(e){e.elements=null,Em[R0++]=e}let em=0;const JA=class eM{constructor(t){this.uid=bi("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...eM.defaultOptions,...t},t.maxTextures||(en("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=C5());const{maxTextures:n,attributesInitialSize:i,indicesInitialSize:r}=t;this.attributeBuffer=new tw(i*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)aw(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,n){const i=t._batch.textures.ids[n._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=n,!0)}updateElement(t){this.dirty=!0;const n=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,n.float32View,n.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,n.float32View,n.uint32View,t._attributeStart,t._textureId)}break(t){const n=this._elements;if(!n[this.elementStart])return;let i=rw(),r=i.textures;r.clear();const s=n[this.elementStart];let l=iw(s.blendMode,s.texture._source),c=s.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const f=this.attributeBuffer.float32View,p=this.attributeBuffer.uint32View,m=this.indexBuffer;let g=this._batchIndexSize,x=this._batchIndexStart,v="startBatch",S=[];const A=this.maxTextures;for(let T=this.elementStart;T<this.elementSize;++T){const C=n[T];n[T]=null;const R=C.texture._source,D=iw(C.blendMode,R),H=l!==D||c!==C.topology;if(R._batchTick===em&&!H){C._textureId=R._textureBindLocation,g+=C.indexSize,C.packAsQuad?(this.packQuadAttributes(C,f,p,C._attributeStart,C._textureId),this.packQuadIndex(m,C._indexStart,C._attributeStart/this.vertexSize)):(this.packAttributes(C,f,p,C._attributeStart,C._textureId),this.packIndex(C,m,C._indexStart,C._attributeStart/this.vertexSize)),C._batch=i,S.push(C);continue}R._batchTick=em,(r.count>=A||H)&&(this._finishBatch(i,x,g-x,r,l,c,t,v,S),v="renderBatch",x=g,l=D,c=C.topology,i=rw(),r=i.textures,r.clear(),S=[],++em),C._textureId=R._textureBindLocation=r.count,r.ids[R.uid]=r.count,r.textures[r.count++]=R,C._batch=i,S.push(C),g+=C.indexSize,C.packAsQuad?(this.packQuadAttributes(C,f,p,C._attributeStart,C._textureId),this.packQuadIndex(m,C._indexStart,C._attributeStart/this.vertexSize)):(this.packAttributes(C,f,p,C._attributeStart,C._textureId),this.packIndex(C,m,C._indexStart,C._attributeStart/this.vertexSize))}r.count>0&&(this._finishBatch(i,x,g-x,r,l,c,t,v,S),x=g,++em),this.elementStart=this.elementSize,this._batchIndexStart=x,this._batchIndexSize=g}_finishBatch(t,n,i,r,s,l,c,f,p){t.gpuBindGroup=null,t.bindGroup=null,t.action=f,t.batcher=this,t.textures=r,t.blendMode=s,t.topology=l,t.start=n,t.size=i,t.elements=p,++em,this.batches[this.batchIndex++]=t,c.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const n=Math.max(t,this.attributeBuffer.size*2),i=new tw(n);nw(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const n=this.indexBuffer;let i=Math.max(t,n.length*1.5);i+=i%2;const r=i>65535?new Uint32Array(i):new Uint16Array(i);if(r.BYTES_PER_ELEMENT!==n.BYTES_PER_ELEMENT)for(let s=0;s<n.length;s++)r[s]=n[s];else nw(n.buffer,r.buffer);this.indexBuffer=r}packQuadIndex(t,n,i){t[n]=i+0,t[n+1]=i+1,t[n+2]=i+2,t[n+3]=i+0,t[n+4]=i+2,t[n+5]=i+3}packIndex(t,n,i,r){const s=t.indices,l=t.indexSize,c=t.indexOffset,f=t.attributeOffset;for(let p=0;p<l;p++)n[i++]=r+s[p+c]-f}destroy(t={}){var n;if(this.batches!==null){for(let i=0;i<this.batchIndex;i++)aw(this.batches[i]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&((n=this.shader)==null||n.destroy(),this.shader=null);for(let i=0;i<this._elements.length;i++)this._elements[i]&&(this._elements[i]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};JA.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let R5=JA;var ka=(e=>(e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE",e[e.STATIC=1024]="STATIC",e))(ka||{});class Bm extends yo{constructor(t){let{data:n,size:i}=t;const{usage:r,label:s,shrinkToFit:l}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=bi("buffer"),this._resourceType="buffer",this._resourceId=bi("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,n instanceof Array&&(n=new Float32Array(n)),this._data=n,i??(i=n==null?void 0:n.byteLength);const c=!!n;this.descriptor={size:i,usage:r,mappedAtCreation:c,label:s},this.shrinkToFit=l??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ka.STATIC)}set static(t){t?this.descriptor.usage|=ka.STATIC:this.descriptor.usage&=~ka.STATIC}setDataWithSize(t,n,i){if(this._updateID++,this._updateSize=n*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const r=this._data;if(this._data=t,this._dataInt32=null,!r||r.length!==t.length){!this.shrinkToFit&&r&&t.byteLength<r.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=bi("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var t;this.emit("unload",this);for(const n in this._gpuData)(t=this._gpuData[n])==null||t.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function tM(e,t){if(!(e instanceof Bm)){let n=t?ka.INDEX:ka.VERTEX;e instanceof Array&&(t?(e=new Uint32Array(e),n=ka.INDEX|ka.COPY_DST):(e=new Float32Array(e),n=ka.VERTEX|ka.COPY_DST)),e=new Bm({data:e,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return e}function k5(e,t,n){const i=e.getAttribute(t);if(!i)return n.minX=0,n.minY=0,n.maxX=0,n.maxY=0,n;const r=i.buffer.data;let s=1/0,l=1/0,c=-1/0,f=-1/0;const p=r.BYTES_PER_ELEMENT,m=(i.offset||0)/p,g=(i.stride||8)/p;for(let x=m;x<r.length;x+=g){const v=r[x],S=r[x+1];v>c&&(c=v),S>f&&(f=S),v<s&&(s=v),S<l&&(l=S)}return n.minX=s,n.minY=l,n.maxX=c,n.maxY=f,n}function N5(e){return(e instanceof Bm||Array.isArray(e)||e.BYTES_PER_ELEMENT)&&(e={buffer:e}),e.buffer=tM(e.buffer,!1),e}class O5 extends yo{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=bi("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new js,this._boundsDirty=!0;const{attributes:n,indexBuffer:i,topology:r}=t;if(this.buffers=[],this.attributes={},n)for(const s in n)this.addAttribute(s,n[s]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const n=this.attributes[t];return n.buffer.data.length/(n.stride/4||n.size)}return 0}addAttribute(t,n){const i=N5(n);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=tM(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,k5(this,"aPosition",this._bounds)):this._bounds}unload(){var t;this.emit("unload",this);for(const n in this._gpuData)(t=this._gpuData[n])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){var n;this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(i=>i.destroy()),this.unload(),(n=this.indexBuffer)==null||n.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const D5=new Float32Array(1),z5=new Uint32Array(1);class B5 extends O5{constructor(){const n=new Bm({data:D5,label:"attribute-batch-buffer",usage:ka.VERTEX|ka.COPY_DST,shrinkToFit:!1}),i=new Bm({data:z5,label:"index-batch-buffer",usage:ka.INDEX|ka.COPY_DST,shrinkToFit:!1}),r=24;super({attributes:{aPosition:{buffer:n,format:"float32x2",stride:r,offset:0},aUV:{buffer:n,format:"float32x2",stride:r,offset:8},aColor:{buffer:n,format:"unorm8x4",stride:r,offset:16},aTextureIdAndRound:{buffer:n,format:"uint16x2",stride:r,offset:20}},indexBuffer:i})}}function sw(e,t,n){if(e)for(const i in e){const r=i.toLocaleLowerCase(),s=t[r];if(s){let l=e[i];i==="header"&&(l=l.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),n&&s.push(`//----${n}----//`),s.push(l)}else ma(`${i} placement hook does not exist in shader`)}}const L5=/\{\{(.*?)\}\}/g;function lw(e){var i;const t={};return(((i=e.match(L5))==null?void 0:i.map(r=>r.replace(/[{()}]/g,"")))??[]).forEach(r=>{t[r]=[]}),t}function ow(e,t){let n;const i=/@in\s+([^;]+);/g;for(;(n=i.exec(e))!==null;)t.push(n[1])}function cw(e,t,n=!1){const i=[];ow(t,i),e.forEach(c=>{c.header&&ow(c.header,i)});const r=i;n&&r.sort();const s=r.map((c,f)=>` @location(${f}) ${c},`).join(`
85
85
  `);let l=t.replace(/@in\s+[^;]+;\s*/g,"");return l=l.replace("{{in}}",`
@@ -397,4 +397,4 @@ https://github.com/highlightjs/highlight.js/issues/2277`),In=Ne,Xt=Ke),vt===void
397
397
  `,`
398
398
  +`).split(`
399
399
  `)),m=p.reduce((g,x)=>g.concat(...x),[]);return[p,m]}return[[],[]]},[e]);return j.useEffect(()=>{const f=(t==null?void 0:t.target)??eC,p=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const m=v=>{var T,C;if(r.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!r.current||r.current&&!p)&&Jk(v))return!1;const A=nC(v.code,c);if(s.current.add(v[A]),tC(l,s.current,!1)){const N=((C=(T=v.composedPath)==null?void 0:T.call(v))==null?void 0:C[0])||v.target,R=(N==null?void 0:N.nodeName)==="BUTTON"||(N==null?void 0:N.nodeName)==="A";t.preventDefault!==!1&&(r.current||!R)&&v.preventDefault(),i(!0)}},g=v=>{const S=nC(v.code,c);tC(l,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(v[S]),v.key==="Meta"&&s.current.clear(),r.current=!1},x=()=>{s.current.clear(),i(!1)};return f==null||f.addEventListener("keydown",m),f==null||f.addEventListener("keyup",g),window.addEventListener("blur",x),window.addEventListener("contextmenu",x),()=>{f==null||f.removeEventListener("keydown",m),f==null||f.removeEventListener("keyup",g),window.removeEventListener("blur",x),window.removeEventListener("contextmenu",x)}}},[e,i]),n}function tC(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function nC(e,t){return t.includes(e)?"code":"key"}const FK=()=>{const e=Zn();return j.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,r,s],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??i,y:t.y??r,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:r,minZoom:s,maxZoom:l,panZoom:c}=e.getState(),f=V_(t,i,r,s,l,(n==null?void 0:n.padding)??.1);return c?(await c.setViewport(f,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:r,snapToGrid:s,domNode:l}=e.getState();if(!l)return t;const{x:c,y:f}=l.getBoundingClientRect(),p={x:t.x-c,y:t.y-f},m=n.snapGrid??r,g=n.snapToGrid??s;return cg(p,i,g,m)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:s}=i.getBoundingClientRect(),l=K0(t,n);return{x:l.x+r,y:l.y+s}}}),[])};function _N(e,t){const n=[],i=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")i.set(s.id,[s]);else{const l=i.get(s.id);l?l.push(s):i.set(s.id,[s])}for(const s of t){const l=i.get(s.id);if(!l){n.push(s);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const c={...s};for(const f of l)GK(f,c);n.push(c)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function GK(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 qK(e,t){return _N(e,t)}function YK(e,t){return _N(e,t)}function pd(e,t){return{id:e,type:"select",selected:t}}function eh(e,t=new Set,n=!1){const i=[];for(const[r,s]of e){const l=t.has(r);!(s.selected===void 0&&!l)&&s.selected!==l&&(n&&(s.selected=l),i.push(pd(s.id,l)))}return i}function iC({items:e=[],lookup:t}){var r;const n=[],i=new Map(e.map(s=>[s.id,s]));for(const[s,l]of e.entries()){const c=t.get(l.id),f=((r=c==null?void 0:c.internals)==null?void 0:r.userNode)??c;f!==void 0&&f!==l&&n.push({id:l.id,item:l,type:"replace"}),f===void 0&&n.push({item:l,type:"add",index:s})}for(const[s]of t)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function rC(e){return{id:e.id,type:"remove"}}const aC=e=>hX(e),VK=e=>Yk(e);function SN(e){return j.forwardRef(e)}const XK=typeof window<"u"?j.useLayoutEffect:j.useEffect;function sC(e){const[t,n]=j.useState(BigInt(0)),[i]=j.useState(()=>KK(()=>n(r=>r+BigInt(1))));return XK(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function KK(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const EN=j.createContext(null);function $K({children:e}){const t=Zn(),n=j.useCallback(c=>{const{nodes:f=[],setNodes:p,hasDefaultNodes:m,onNodesChange:g,nodeLookup:x,fitViewQueued:v,onNodesChangeMiddlewareMap:S}=t.getState();let A=f;for(const C of c)A=typeof C=="function"?C(A):C;let T=iC({items:A,lookup:x});for(const C of S.values())T=C(T);m&&p(A),T.length>0?g==null||g(T):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:C,nodes:N,setNodes:R}=t.getState();C&&R(N)})},[]),i=sC(n),r=j.useCallback(c=>{const{edges:f=[],setEdges:p,hasDefaultEdges:m,onEdgesChange:g,edgeLookup:x}=t.getState();let v=f;for(const S of c)v=typeof S=="function"?S(v):S;m?p(v):g&&g(iC({items:v,lookup:x}))},[]),s=sC(r),l=j.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return _.jsx(EN.Provider,{value:l,children:e})}function WK(){const e=j.useContext(EN);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const QK=e=>!!e.panZoom;function Sx(){const e=FK(),t=Zn(),n=WK(),i=$t(QK),r=j.useMemo(()=>{const s=g=>t.getState().nodeLookup.get(g),l=g=>{n.nodeQueue.push(g)},c=g=>{n.edgeQueue.push(g)},f=g=>{var C,N;const{nodeLookup:x,nodeOrigin:v}=t.getState(),S=aC(g)?g:x.get(g.id),A=S.parentId?Qk(S.position,S.measured,S.parentId,x,v):S.position,T={...S,position:A,width:((C=S.measured)==null?void 0:C.width)??S.width,height:((N=S.measured)==null?void 0:N.height)??S.height};return yh(T)},p=(g,x,v={replace:!1})=>{l(S=>S.map(A=>{if(A.id===g){const T=typeof x=="function"?x(A):x;return v.replace&&aC(T)?T:{...A,...T}}return A}))},m=(g,x,v={replace:!1})=>{c(S=>S.map(A=>{if(A.id===g){const T=typeof x=="function"?x(A):x;return v.replace&&VK(T)?T:{...A,...T}}return A}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>{var x;return(x=s(g))==null?void 0:x.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(x=>({...x}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:l,setEdges:c,addNodes:g=>{const x=Array.isArray(g)?g:[g];n.nodeQueue.push(v=>[...v,...x])},addEdges:g=>{const x=Array.isArray(g)?g:[g];n.edgeQueue.push(v=>[...v,...x])},toObject:()=>{const{nodes:g=[],edges:x=[],transform:v}=t.getState(),[S,A,T]=v;return{nodes:g.map(C=>({...C})),edges:x.map(C=>({...C})),viewport:{x:S,y:A,zoom:T}}},deleteElements:async({nodes:g=[],edges:x=[]})=>{const{nodes:v,edges:S,onNodesDelete:A,onEdgesDelete:T,triggerNodeChanges:C,triggerEdgeChanges:N,onDelete:R,onBeforeDelete:D}=t.getState(),{nodes:H,edges:O}=await xX({nodesToRemove:g,edgesToRemove:x,nodes:v,edges:S,onBeforeDelete:D}),q=O.length>0,Z=H.length>0;if(q){const I=O.map(rC);T==null||T(O),N(I)}if(Z){const I=H.map(rC);A==null||A(H),C(I)}return(Z||q)&&(R==null||R({nodes:H,edges:O})),{deletedNodes:H,deletedEdges:O}},getIntersectingNodes:(g,x=!0,v)=>{const S=NT(g),A=S?g:f(g),T=v!==void 0;return A?(v||t.getState().nodes).filter(C=>{const N=t.getState().nodeLookup.get(C.id);if(N&&!S&&(C.id===g.id||!N.internals.positionAbsolute))return!1;const R=yh(T?C:N),D=Vm(R,A);return x&&D>0||D>=R.width*R.height||D>=A.width*A.height}):[]},isNodeIntersecting:(g,x,v=!0)=>{const A=NT(g)?g:f(g);if(!A)return!1;const T=Vm(A,x);return v&&T>0||T>=x.width*x.height||T>=A.width*A.height},updateNode:p,updateNodeData:(g,x,v={replace:!1})=>{p(g,S=>{const A=typeof x=="function"?x(S):x;return v.replace?{...S,data:A}:{...S,data:{...S.data,...A}}},v)},updateEdge:m,updateEdgeData:(g,x,v={replace:!1})=>{m(g,S=>{const A=typeof x=="function"?x(S):x;return v.replace?{...S,data:A}:{...S,data:{...S.data,...A}}},v)},getNodesBounds:g=>{const{nodeLookup:x,nodeOrigin:v}=t.getState();return pX(g,{nodeLookup:x,nodeOrigin:v})},getHandleConnections:({type:g,id:x,nodeId:v})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${v}-${g}${x?`-${x}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:g,handleId:x,nodeId:v})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${v}${g?x?`-${g}-${x}`:`-${g}`:""}`))==null?void 0:S.values())??[])},fitView:async g=>{const x=t.getState().fitViewResolver??SX();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:x}),n.nodeQueue.push(v=>[...v]),x.promise}}},[]);return j.useMemo(()=>({...r,...e,viewportInitialized:i}),[i])}const lC=e=>e.selected,ZK=typeof window<"u"?window:void 0;function JK({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Zn(),{deleteElements:i}=Sx(),r=Km(e,{actInsideInputWithModifier:!1}),s=Km(t,{target:ZK});j.useEffect(()=>{if(r){const{edges:l,nodes:c}=n.getState();i({nodes:c.filter(lC),edges:l.filter(lC)}),n.setState({nodesSelectionActive:!1})}},[r]),j.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function e$(e){const t=Zn();j.useEffect(()=>{const n=()=>{var r,s,l,c;if(!e.current||!(((s=(r=e.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const i=X_(e.current);(i.height===0||i.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",go.error004())),t.setState({width:i.width||500,height:i.height||500})};if(e.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(e.current),()=>{window.removeEventListener("resize",n),i&&e.current&&i.unobserve(e.current)}}},[])}const Ex={position:"absolute",width:"100%",height:"100%",top:0,left:0},t$=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function n$({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=bd.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:f,translateExtent:p,minZoom:m,maxZoom:g,zoomActivationKeyCode:x,preventScrolling:v=!0,children:S,noWheelClassName:A,noPanClassName:T,onViewportChange:C,isControlledViewport:N,paneClickDistance:R,selectionOnDrag:D}){const H=Zn(),O=j.useRef(null),{userSelectionActive:q,lib:Z,connectionInProgress:I}=$t(t$,Qn),F=Km(x),U=j.useRef();e$(O);const L=j.useCallback(J=>{C==null||C({x:J[0],y:J[1],zoom:J[2]}),N||H.setState({transform:J})},[C,N]);return j.useEffect(()=>{if(O.current){U.current=aK({domNode:O.current,minZoom:m,maxZoom:g,translateExtent:p,viewport:f,onDraggingChange:B=>H.setState(V=>V.paneDragging===B?V:{paneDragging:B}),onPanZoomStart:(B,V)=>{const{onViewportChangeStart:Q,onMoveStart:W}=H.getState();W==null||W(B,V),Q==null||Q(V)},onPanZoom:(B,V)=>{const{onViewportChange:Q,onMove:W}=H.getState();W==null||W(B,V),Q==null||Q(V)},onPanZoomEnd:(B,V)=>{const{onViewportChangeEnd:Q,onMoveEnd:W}=H.getState();W==null||W(B,V),Q==null||Q(V)}});const{x:J,y:G,zoom:K}=U.current.getViewport();return H.setState({panZoom:U.current,transform:[J,G,K],domNode:O.current.closest(".react-flow")}),()=>{var B;(B=U.current)==null||B.destroy()}}},[]),j.useEffect(()=>{var J;(J=U.current)==null||J.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:F,preventScrolling:v,noPanClassName:T,userSelectionActive:q,noWheelClassName:A,lib:Z,onTransformChange:L,connectionInProgress:I,selectionOnDrag:D,paneClickDistance:R})},[e,t,n,i,r,s,l,c,F,v,T,q,A,Z,L,I,D,R]),_.jsx("div",{className:"react-flow__renderer",ref:O,style:Ex,children:S})}const i$=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function r$(){const{userSelectionActive:e,userSelectionRect:t}=$t(i$,Qn);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 zv=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},a$=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function s$({isSelecting:e,selectionKeyPressed:t,selectionMode:n=qm.Full,panOnDrag:i,paneClickDistance:r,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:c,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:m,onPaneMouseEnter:g,onPaneMouseMove:x,onPaneMouseLeave:v,children:S}){const A=Zn(),{userSelectionActive:T,elementsSelectable:C,dragging:N,connectionInProgress:R}=$t(a$,Qn),D=C&&(e||T),H=j.useRef(null),O=j.useRef(),q=j.useRef(new Set),Z=j.useRef(new Set),I=j.useRef(!1),F=Q=>{if(I.current||R){I.current=!1;return}f==null||f(Q),A.getState().resetSelectedElements(),A.setState({nodesSelectionActive:!1})},U=Q=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){Q.preventDefault();return}p==null||p(Q)},L=m?Q=>m(Q):void 0,J=Q=>{I.current&&(Q.stopPropagation(),I.current=!1)},G=Q=>{var ie,he;const{domNode:W}=A.getState();if(O.current=W==null?void 0:W.getBoundingClientRect(),!O.current)return;const Y=Q.target===H.current;if(!Y&&!!Q.target.closest(".nokey")||!e||!(s&&Y||t)||Q.button!==0||!Q.isPrimary)return;(he=(ie=Q.target)==null?void 0:ie.setPointerCapture)==null||he.call(ie,Q.pointerId),I.current=!1;const{x:X,y:ue}=bl(Q.nativeEvent,O.current);A.setState({userSelectionRect:{width:0,height:0,startX:X,startY:ue,x:X,y:ue}}),Y||(Q.stopPropagation(),Q.preventDefault())},K=Q=>{const{userSelectionRect:W,transform:Y,nodeLookup:$,edgeLookup:ne,connectionLookup:X,triggerNodeChanges:ue,triggerEdgeChanges:ie,defaultEdgeOptions:he,resetSelectedElements:be}=A.getState();if(!O.current||!W)return;const{x:ye,y:le}=bl(Q.nativeEvent,O.current),{startX:Re,startY:je}=W;if(!I.current){const Ue=t?0:r;if(Math.hypot(ye-Re,le-je)<=Ue)return;be(),l==null||l(Q)}I.current=!0;const Ie={startX:Re,startY:je,x:ye<Re?ye:Re,y:le<je?le:je,width:Math.abs(ye-Re),height:Math.abs(le-je)},He=q.current,Qe=Z.current;q.current=new Set(Y_($,Ie,Y,n===qm.Partial,!0).map(Ue=>Ue.id)),Z.current=new Set;const ot=(he==null?void 0:he.selectable)??!0;for(const Ue of q.current){const wt=X.get(Ue);if(wt)for(const{edgeId:_n}of wt.values()){const Sn=ne.get(_n);Sn&&(Sn.selectable??ot)&&Z.current.add(_n)}}if(!OT(He,q.current)){const Ue=eh($,q.current,!0);ue(Ue)}if(!OT(Qe,Z.current)){const Ue=eh(ne,Z.current);ie(Ue)}A.setState({userSelectionRect:Ie,userSelectionActive:!0,nodesSelectionActive:!1})},B=Q=>{var W,Y;Q.button===0&&((Y=(W=Q.target)==null?void 0:W.releasePointerCapture)==null||Y.call(W,Q.pointerId),!T&&Q.target===H.current&&A.getState().userSelectionRect&&(F==null||F(Q)),A.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(c==null||c(Q),A.setState({nodesSelectionActive:q.current.size>0})))},V=i===!0||Array.isArray(i)&&i.includes(0);return _.jsxs("div",{className:zi(["react-flow__pane",{draggable:V,dragging:N,selection:e}]),onClick:D?void 0:zv(F,H),onContextMenu:zv(U,H),onWheel:zv(L,H),onPointerEnter:D?void 0:g,onPointerMove:D?K:x,onPointerUp:D?B:void 0,onPointerDownCapture:D?G:void 0,onClickCapture:D?J:void 0,onPointerLeave:v,ref:H,style:Ex,children:[S,_.jsx(r$,{})]})}function F1({id:e,store:t,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:l,nodeLookup:c,onError:f}=t.getState(),p=c.get(e);if(!p){f==null||f("012",go.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(s({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var m;return(m=i==null?void 0:i.current)==null?void 0:m.blur()})):r([e])}function wN({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:i,nodeId:r,isSelectable:s,nodeClickDistance:l}){const c=Zn(),[f,p]=j.useState(!1),m=j.useRef();return j.useEffect(()=>{m.current=YX({getStoreItems:()=>c.getState(),onNodeMouseDown:g=>{F1({id:g,store:c,nodeRef:e})},onDragStart:()=>{p(!0)},onDragStop:()=>{p(!1)}})},[]),j.useEffect(()=>{if(!(t||!e.current||!m.current))return m.current.update({noDragClassName:n,handleSelector:i,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:l}),()=>{var g;(g=m.current)==null||g.destroy()}},[n,i,t,s,e,r,l]),f}const l$=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function TN(){const e=Zn();return j.useCallback(n=>{const{nodeExtent:i,snapToGrid:r,snapGrid:s,nodesDraggable:l,onError:c,updateNodePositions:f,nodeLookup:p,nodeOrigin:m}=e.getState(),g=new Map,x=l$(l),v=r?s[0]:5,S=r?s[1]:5,A=n.direction.x*v*n.factor,T=n.direction.y*S*n.factor;for(const[,C]of p){if(!x(C))continue;let N={x:C.internals.positionAbsolute.x+A,y:C.internals.positionAbsolute.y+T};r&&(N=og(N,s));const{position:R,positionAbsolute:D}=Vk({nodeId:C.id,nextPosition:N,nodeLookup:p,nodeExtent:i,nodeOrigin:m,onError:c});C.position=R,C.internals.positionAbsolute=D,g.set(C.id,C)}f(g)},[])}const J_=j.createContext(null),o$=J_.Provider;J_.Consumer;const CN=()=>j.useContext(J_),c$=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),u$=(e,t,n)=>i=>{const{connectionClickStartHandle:r,connectionMode:s,connection:l}=i,{fromHandle:c,toHandle:f,isValid:p}=l,m=(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===t&&(f==null?void 0:f.type)===n;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n,connectingTo:m,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:s===mh.Strict?(c==null?void 0:c.type)!==n:e!==(c==null?void 0:c.nodeId)||t!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!r,valid:m&&p}};function d$({type:e="source",position:t=We.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:l,onConnect:c,children:f,className:p,onMouseDown:m,onTouchStart:g,...x},v){var K,B;const S=l||null,A=e==="target",T=Zn(),C=CN(),{connectOnClick:N,noPanClassName:R,rfId:D}=$t(c$,Qn),{connectingFrom:H,connectingTo:O,clickConnecting:q,isPossibleEndHandle:Z,connectionInProcess:I,clickConnectionInProcess:F,valid:U}=$t(u$(C,S,e),Qn);C||(B=(K=T.getState()).onError)==null||B.call(K,"010",go.error010());const L=V=>{const{defaultEdgeOptions:Q,onConnect:W,hasDefaultEdges:Y}=T.getState(),$={...Q,...V};if(Y){const{edges:ne,setEdges:X}=T.getState();X(RX($,ne))}W==null||W($),c==null||c($)},J=V=>{if(!C)return;const Q=eN(V.nativeEvent);if(r&&(Q&&V.button===0||!Q)){const W=T.getState();P1.onPointerDown(V.nativeEvent,{handleDomNode:V.currentTarget,autoPanOnConnect:W.autoPanOnConnect,connectionMode:W.connectionMode,connectionRadius:W.connectionRadius,domNode:W.domNode,nodeLookup:W.nodeLookup,lib:W.lib,isTarget:A,handleId:S,nodeId:C,flowId:W.rfId,panBy:W.panBy,cancelConnection:W.cancelConnection,onConnectStart:W.onConnectStart,onConnectEnd:(...Y)=>{var $,ne;return(ne=($=T.getState()).onConnectEnd)==null?void 0:ne.call($,...Y)},updateConnection:W.updateConnection,onConnect:L,isValidConnection:n||((...Y)=>{var $,ne;return((ne=($=T.getState()).isValidConnection)==null?void 0:ne.call($,...Y))??!0}),getTransform:()=>T.getState().transform,getFromHandle:()=>T.getState().connection.fromHandle,autoPanSpeed:W.autoPanSpeed,dragThreshold:W.connectionDragThreshold})}Q?m==null||m(V):g==null||g(V)},G=V=>{const{onClickConnectStart:Q,onClickConnectEnd:W,connectionClickStartHandle:Y,connectionMode:$,isValidConnection:ne,lib:X,rfId:ue,nodeLookup:ie,connection:he}=T.getState();if(!C||!Y&&!r)return;if(!Y){Q==null||Q(V.nativeEvent,{nodeId:C,handleId:S,handleType:e}),T.setState({connectionClickStartHandle:{nodeId:C,type:e,id:S}});return}const be=Zk(V.target),ye=n||ne,{connection:le,isValid:Re}=P1.isValid(V.nativeEvent,{handle:{nodeId:C,id:S,type:e},connectionMode:$,fromNodeId:Y.nodeId,fromHandleId:Y.id||null,fromType:Y.type,isValidConnection:ye,flowId:ue,doc:be,lib:X,nodeLookup:ie});Re&&le&&L(le);const je=structuredClone(he);delete je.inProgress,je.toPosition=je.toHandle?je.toHandle.position:null,W==null||W(V,je),T.setState({connectionClickStartHandle:null})};return _.jsx("div",{"data-handleid":S,"data-nodeid":C,"data-handlepos":t,"data-id":`${D}-${C}-${S}-${e}`,className:zi(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",R,p,{source:!A,target:A,connectable:i,connectablestart:r,connectableend:s,clickconnecting:q,connectingfrom:H,connectingto:O,valid:U,connectionindicator:i&&(!I||Z)&&(I||F?s:r)}]),onMouseDown:J,onTouchStart:J,onClick:N?G:void 0,ref:v,...x,children:f})}const Sl=j.memo(SN(d$));function f$({data:e,isConnectable:t,sourcePosition:n=We.Bottom}){return _.jsxs(_.Fragment,{children:[e==null?void 0:e.label,_.jsx(Sl,{type:"source",position:n,isConnectable:t})]})}function h$({data:e,isConnectable:t,targetPosition:n=We.Top,sourcePosition:i=We.Bottom}){return _.jsxs(_.Fragment,{children:[_.jsx(Sl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,_.jsx(Sl,{type:"source",position:i,isConnectable:t})]})}function p$(){return null}function m$({data:e,isConnectable:t,targetPosition:n=We.Top}){return _.jsxs(_.Fragment,{children:[_.jsx(Sl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const $0={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},oC={input:f$,default:h$,output:m$,group:p$};function g$(e){var t,n,i,r;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??((i=e.style)==null?void 0:i.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const y$=e=>{const{width:t,height:n,x:i,y:r}=lg(e.nodeLookup,{filter:s=>!!s.selected});return{width:xl(t)?t:null,height:xl(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${r}px)`}};function x$({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const i=Zn(),{width:r,height:s,transformString:l,userSelectionActive:c}=$t(y$,Qn),f=TN(),p=j.useRef(null);j.useEffect(()=>{var v;n||(v=p.current)==null||v.focus({preventScroll:!0})},[n]);const m=!c&&r!==null&&s!==null;if(wN({nodeRef:p,disabled:!m}),!m)return null;const g=e?v=>{const S=i.getState().nodes.filter(A=>A.selected);e(v,S)}:void 0,x=v=>{Object.prototype.hasOwnProperty.call($0,v.key)&&(v.preventDefault(),f({direction:$0[v.key],factor:v.shiftKey?4:1}))};return _.jsx("div",{className:zi(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:_.jsx("div",{ref:p,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:r,height:s}})})}const cC=typeof window<"u"?window:void 0,b$=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function AN({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:f,selectionKeyCode:p,selectionOnDrag:m,selectionMode:g,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:S,panActivationKeyCode:A,zoomActivationKeyCode:T,elementsSelectable:C,zoomOnScroll:N,zoomOnPinch:R,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:O,zoomOnDoubleClick:q,panOnDrag:Z,defaultViewport:I,translateExtent:F,minZoom:U,maxZoom:L,preventScrolling:J,onSelectionContextMenu:G,noWheelClassName:K,noPanClassName:B,disableKeyboardA11y:V,onViewportChange:Q,isControlledViewport:W}){const{nodesSelectionActive:Y,userSelectionActive:$}=$t(b$,Qn),ne=Km(p,{target:cC}),X=Km(A,{target:cC}),ue=X||Z,ie=X||D,he=m&&ue!==!0,be=ne||$||he;return JK({deleteKeyCode:f,multiSelectionKeyCode:S}),_.jsx(n$,{onPaneContextMenu:s,elementsSelectable:C,zoomOnScroll:N,zoomOnPinch:R,panOnScroll:ie,panOnScrollSpeed:H,panOnScrollMode:O,zoomOnDoubleClick:q,panOnDrag:!ne&&ue,defaultViewport:I,translateExtent:F,minZoom:U,maxZoom:L,zoomActivationKeyCode:T,preventScrolling:J,noWheelClassName:K,noPanClassName:B,onViewportChange:Q,isControlledViewport:W,paneClickDistance:c,selectionOnDrag:he,children:_.jsxs(s$,{onSelectionStart:x,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:ue,isSelecting:!!be,selectionMode:g,selectionKeyPressed:ne,paneClickDistance:c,selectionOnDrag:he,children:[e,Y&&_.jsx(x$,{onSelectionContextMenu:G,noPanClassName:B,disableKeyboardA11y:V})]})})}AN.displayName="FlowRenderer";const v$=j.memo(AN),_$=e=>t=>e?Y_(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 S$(e){return $t(j.useCallback(_$(e),[e]),Qn)}const E$=e=>e.updateNodeInternals;function w$(){const e=$t(E$),[t]=j.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");i.set(s,{id:s,nodeElement:r.target,force:!0})}),e(i)}));return j.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function T$({node:e,nodeType:t,hasDimensions:n,resizeObserver:i}){const r=Zn(),s=j.useRef(null),l=j.useRef(null),c=j.useRef(e.sourcePosition),f=j.useRef(e.targetPosition),p=j.useRef(t),m=n&&!!e.internals.handleBounds;return j.useEffect(()=>{s.current&&!e.hidden&&(!m||l.current!==s.current)&&(l.current&&(i==null||i.unobserve(l.current)),i==null||i.observe(s.current),l.current=s.current)},[m,e.hidden]),j.useEffect(()=>()=>{l.current&&(i==null||i.unobserve(l.current),l.current=null)},[]),j.useEffect(()=>{if(s.current){const g=p.current!==t,x=c.current!==e.sourcePosition,v=f.current!==e.targetPosition;(g||x||v)&&(p.current=t,c.current=e.sourcePosition,f.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function C$({id:e,onClick:t,onMouseEnter:n,onMouseMove:i,onMouseLeave:r,onContextMenu:s,onDoubleClick:l,nodesDraggable:c,elementsSelectable:f,nodesConnectable:p,nodesFocusable:m,resizeObserver:g,noDragClassName:x,noPanClassName:v,disableKeyboardA11y:S,rfId:A,nodeTypes:T,nodeClickDistance:C,onError:N}){const{node:R,internals:D,isParent:H}=$t(ye=>{const le=ye.nodeLookup.get(e),Re=ye.parentLookup.has(e);return{node:le,internals:le.internals,isParent:Re}},Qn);let O=R.type||"default",q=(T==null?void 0:T[O])||oC[O];q===void 0&&(N==null||N("003",go.error003(O)),O="default",q=(T==null?void 0:T.default)||oC.default);const Z=!!(R.draggable||c&&typeof R.draggable>"u"),I=!!(R.selectable||f&&typeof R.selectable>"u"),F=!!(R.connectable||p&&typeof R.connectable>"u"),U=!!(R.focusable||m&&typeof R.focusable>"u"),L=Zn(),J=Wk(R),G=T$({node:R,nodeType:O,hasDimensions:J,resizeObserver:g}),K=wN({nodeRef:G,disabled:R.hidden||!Z,noDragClassName:x,handleSelector:R.dragHandle,nodeId:e,isSelectable:I,nodeClickDistance:C}),B=TN();if(R.hidden)return null;const V=dc(R),Q=g$(R),W=I||Z||t||n||i||r,Y=n?ye=>n(ye,{...D.userNode}):void 0,$=i?ye=>i(ye,{...D.userNode}):void 0,ne=r?ye=>r(ye,{...D.userNode}):void 0,X=s?ye=>s(ye,{...D.userNode}):void 0,ue=l?ye=>l(ye,{...D.userNode}):void 0,ie=ye=>{const{selectNodesOnDrag:le,nodeDragThreshold:Re}=L.getState();I&&(!le||!Z||Re>0)&&F1({id:e,store:L,nodeRef:G}),t&&t(ye,{...D.userNode})},he=ye=>{if(!(Jk(ye.nativeEvent)||S)){if(Pk.includes(ye.key)&&I){const le=ye.key==="Escape";F1({id:e,store:L,unselect:le,nodeRef:G})}else if(Z&&R.selected&&Object.prototype.hasOwnProperty.call($0,ye.key)){ye.preventDefault();const{ariaLabelConfig:le}=L.getState();L.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:ye.key.replace("Arrow","").toLowerCase(),x:~~D.positionAbsolute.x,y:~~D.positionAbsolute.y})}),B({direction:$0[ye.key],factor:ye.shiftKey?4:1})}}},be=()=>{var Qe;if(S||!((Qe=G.current)!=null&&Qe.matches(":focus-visible")))return;const{transform:ye,width:le,height:Re,autoPanOnNodeFocus:je,setCenter:Ie}=L.getState();if(!je)return;Y_(new Map([[e,R]]),{x:0,y:0,width:le,height:Re},ye,!0).length>0||Ie(R.position.x+V.width/2,R.position.y+V.height/2,{zoom:ye[2]})};return _.jsx("div",{className:zi(["react-flow__node",`react-flow__node-${O}`,{[v]:Z},R.className,{selected:R.selected,selectable:I,parent:H,draggable:Z,dragging:K}]),ref:G,style:{zIndex:D.z,transform:`translate(${D.positionAbsolute.x}px,${D.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:J?"visible":"hidden",...R.style,...Q},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Y,onMouseMove:$,onMouseLeave:ne,onContextMenu:X,onClick:ie,onDoubleClick:ue,onKeyDown:U?he:void 0,tabIndex:U?0:void 0,onFocus:U?be:void 0,role:R.ariaRole??(U?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${xN}-${A}`,"aria-label":R.ariaLabel,...R.domAttributes,children:_.jsx(o$,{value:e,children:_.jsx(q,{id:e,data:R.data,type:O,positionAbsoluteX:D.positionAbsolute.x,positionAbsoluteY:D.positionAbsolute.y,selected:R.selected??!1,selectable:I,draggable:Z,deletable:R.deletable??!0,isConnectable:F,sourcePosition:R.sourcePosition,targetPosition:R.targetPosition,dragging:K,dragHandle:R.dragHandle,zIndex:D.z,parentId:R.parentId,...V})})})}var A$=j.memo(C$);const M$=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function MN(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,onError:s}=$t(M$,Qn),l=S$(e.onlyRenderVisibleElements),c=w$();return _.jsx("div",{className:"react-flow__nodes",style:Ex,children:l.map(f=>_.jsx(A$,{id:f,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:c,nodesDraggable:t,nodesConnectable:n,nodesFocusable:i,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},f))})}MN.displayName="NodeRenderer";const R$=j.memo(MN);function k$(e){return $t(j.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const i=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),l=n.nodeLookup.get(r.target);s&&l&&CX({sourceNode:s,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&i.push(r.id)}return i},[e]),Qn)}const N$=({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"})},O$=({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"})},uC={[Ym.Arrow]:N$,[Ym.ArrowClosed]:O$};function D$(e){const t=Zn();return j.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(uC,e)?uC[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",go.error009(e)),null)},[e])}const z$=({id:e,type:t,color:n,width:i=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const f=D$(t);return f?_.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:_.jsx(f,{color:n,strokeWidth:l})}):null},RN=({defaultColor:e,rfId:t})=>{const n=$t(s=>s.edges),i=$t(s=>s.defaultEdgeOptions),r=j.useMemo(()=>zX(n,{id:t,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[n,i,t,e]);return r.length?_.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:_.jsx("defs",{children:r.map(s=>_.jsx(z$,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};RN.displayName="MarkerDefinitions";var B$=j.memo(RN);function kN({x:e,y:t,label:n,labelStyle:i,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:f,className:p,...m}){const[g,x]=j.useState({x:1,y:0,width:0,height:0}),v=zi(["react-flow__edge-textwrapper",p]),S=j.useRef(null);return j.useEffect(()=>{if(S.current){const A=S.current.getBBox();x({x:A.x,y:A.y,width:A.width,height:A.height})}},[n]),n?_.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:v,visibility:g.width?"visible":"hidden",...m,children:[r&&_.jsx("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),_.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:i,children:n}),f]}):null}kN.displayName="EdgeText";const L$=j.memo(kN);function wx({path:e,labelX:t,labelY:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,interactionWidth:p=20,...m}){return _.jsxs(_.Fragment,{children:[_.jsx("path",{...m,d:e,fill:"none",className:zi(["react-flow__edge-path",m.className])}),p?_.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}):null,i&&xl(t)&&xl(n)?_.jsx(L$,{x:t,y:n,label:i,labelStyle:r,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f}):null]})}function dC({pos:e,x1:t,y1:n,x2:i,y2:r}){return e===We.Left||e===We.Right?[.5*(t+i),n]:[t,.5*(n+r)]}function NN({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:i,targetY:r,targetPosition:s=We.Top}){const[l,c]=dC({pos:n,x1:e,y1:t,x2:i,y2:r}),[f,p]=dC({pos:s,x1:i,y1:r,x2:e,y2:t}),[m,g,x,v]=tN({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:l,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${c} ${f},${p} ${i},${r}`,m,g,x,v]}function ON(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:l,targetPosition:c,label:f,labelStyle:p,labelShowBg:m,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:S,markerEnd:A,markerStart:T,interactionWidth:C})=>{const[N,R,D]=NN({sourceX:n,sourceY:i,sourcePosition:l,targetX:r,targetY:s,targetPosition:c}),H=e.isInternal?void 0:t;return _.jsx(wx,{id:H,path:N,labelX:R,labelY:D,label:f,labelStyle:p,labelShowBg:m,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:S,markerEnd:A,markerStart:T,interactionWidth:C})})}const j$=ON({isInternal:!1}),DN=ON({isInternal:!0});j$.displayName="SimpleBezierEdge";DN.displayName="SimpleBezierEdgeInternal";function zN(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:g,style:x,sourcePosition:v=We.Bottom,targetPosition:S=We.Top,markerEnd:A,markerStart:T,pathOptions:C,interactionWidth:N})=>{const[R,D,H]=I1({sourceX:n,sourceY:i,sourcePosition:v,targetX:r,targetY:s,targetPosition:S,borderRadius:C==null?void 0:C.borderRadius,offset:C==null?void 0:C.offset,stepPosition:C==null?void 0:C.stepPosition}),O=e.isInternal?void 0:t;return _.jsx(wx,{id:O,path:R,labelX:D,labelY:H,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:g,style:x,markerEnd:A,markerStart:T,interactionWidth:N})})}const BN=zN({isInternal:!1}),LN=zN({isInternal:!0});BN.displayName="SmoothStepEdge";LN.displayName="SmoothStepEdgeInternal";function jN(e){return j.memo(({id:t,...n})=>{var r;const i=e.isInternal?void 0:t;return _.jsx(BN,{...n,id:i,pathOptions:j.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const I$=jN({isInternal:!1}),IN=jN({isInternal:!0});I$.displayName="StepEdge";IN.displayName="StepEdgeInternal";function UN(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:g,style:x,markerEnd:v,markerStart:S,interactionWidth:A})=>{const[T,C,N]=rN({sourceX:n,sourceY:i,targetX:r,targetY:s}),R=e.isInternal?void 0:t;return _.jsx(wx,{id:R,path:T,labelX:C,labelY:N,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:g,style:x,markerEnd:v,markerStart:S,interactionWidth:A})})}const U$=UN({isInternal:!1}),HN=UN({isInternal:!0});U$.displayName="StraightEdge";HN.displayName="StraightEdgeInternal";function PN(e){return j.memo(({id:t,sourceX:n,sourceY:i,targetX:r,targetY:s,sourcePosition:l=We.Bottom,targetPosition:c=We.Top,label:f,labelStyle:p,labelShowBg:m,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:S,markerEnd:A,markerStart:T,pathOptions:C,interactionWidth:N})=>{const[R,D,H]=nN({sourceX:n,sourceY:i,sourcePosition:l,targetX:r,targetY:s,targetPosition:c,curvature:C==null?void 0:C.curvature}),O=e.isInternal?void 0:t;return _.jsx(wx,{id:O,path:R,labelX:D,labelY:H,label:f,labelStyle:p,labelShowBg:m,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:S,markerEnd:A,markerStart:T,interactionWidth:N})})}const H$=PN({isInternal:!1}),FN=PN({isInternal:!0});H$.displayName="BezierEdge";FN.displayName="BezierEdgeInternal";const fC={default:FN,straight:HN,step:IN,smoothstep:LN,simplebezier:DN},hC={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},P$=(e,t,n)=>n===We.Left?e-t:n===We.Right?e+t:e,F$=(e,t,n)=>n===We.Top?e-t:n===We.Bottom?e+t:e,pC="react-flow__edgeupdater";function mC({position:e,centerX:t,centerY:n,radius:i=10,onMouseDown:r,onMouseEnter:s,onMouseOut:l,type:c}){return _.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:l,className:zi([pC,`${pC}-${c}`]),cx:P$(t,i,e),cy:F$(n,i,e),r:i,stroke:"transparent",fill:"transparent"})}function G$({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:i,sourceY:r,targetX:s,targetY:l,sourcePosition:c,targetPosition:f,onReconnect:p,onReconnectStart:m,onReconnectEnd:g,setReconnecting:x,setUpdateHover:v}){const S=Zn(),A=(D,H)=>{if(D.button!==0)return;const{autoPanOnConnect:O,domNode:q,connectionMode:Z,connectionRadius:I,lib:F,onConnectStart:U,cancelConnection:L,nodeLookup:J,rfId:G,panBy:K,updateConnection:B}=S.getState(),V=H.type==="target",Q=($,ne)=>{x(!1),g==null||g($,n,H.type,ne)},W=$=>p==null?void 0:p(n,$),Y=($,ne)=>{x(!0),m==null||m(D,n,H.type),U==null||U($,ne)};P1.onPointerDown(D.nativeEvent,{autoPanOnConnect:O,connectionMode:Z,connectionRadius:I,domNode:q,handleId:H.id,nodeId:H.nodeId,nodeLookup:J,isTarget:V,edgeUpdaterType:H.type,lib:F,flowId:G,cancelConnection:L,panBy:K,isValidConnection:(...$)=>{var ne,X;return((X=(ne=S.getState()).isValidConnection)==null?void 0:X.call(ne,...$))??!0},onConnect:W,onConnectStart:Y,onConnectEnd:(...$)=>{var ne,X;return(X=(ne=S.getState()).onConnectEnd)==null?void 0:X.call(ne,...$)},onReconnectEnd:Q,updateConnection:B,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:D.currentTarget})},T=D=>A(D,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),C=D=>A(D,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),N=()=>v(!0),R=()=>v(!1);return _.jsxs(_.Fragment,{children:[(e===!0||e==="source")&&_.jsx(mC,{position:c,centerX:i,centerY:r,radius:t,onMouseDown:T,onMouseEnter:N,onMouseOut:R,type:"source"}),(e===!0||e==="target")&&_.jsx(mC,{position:f,centerX:s,centerY:l,radius:t,onMouseDown:C,onMouseEnter:N,onMouseOut:R,type:"target"})]})}function q$({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:i,onClick:r,onDoubleClick:s,onContextMenu:l,onMouseEnter:c,onMouseMove:f,onMouseLeave:p,reconnectRadius:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:v,rfId:S,edgeTypes:A,noPanClassName:T,onError:C,disableKeyboardA11y:N}){let R=$t(Ie=>Ie.edgeLookup.get(e));const D=$t(Ie=>Ie.defaultEdgeOptions);R=D?{...D,...R}:R;let H=R.type||"default",O=(A==null?void 0:A[H])||fC[H];O===void 0&&(C==null||C("011",go.error011(H)),H="default",O=(A==null?void 0:A.default)||fC.default);const q=!!(R.focusable||t&&typeof R.focusable>"u"),Z=typeof g<"u"&&(R.reconnectable||n&&typeof R.reconnectable>"u"),I=!!(R.selectable||i&&typeof R.selectable>"u"),F=j.useRef(null),[U,L]=j.useState(!1),[J,G]=j.useState(!1),K=Zn(),{zIndex:B,sourceX:V,sourceY:Q,targetX:W,targetY:Y,sourcePosition:$,targetPosition:ne}=$t(j.useCallback(Ie=>{const He=Ie.nodeLookup.get(R.source),Qe=Ie.nodeLookup.get(R.target);if(!He||!Qe)return{zIndex:R.zIndex,...hC};const ot=DX({id:e,sourceNode:He,targetNode:Qe,sourceHandle:R.sourceHandle||null,targetHandle:R.targetHandle||null,connectionMode:Ie.connectionMode,onError:C});return{zIndex:TX({selected:R.selected,zIndex:R.zIndex,sourceNode:He,targetNode:Qe,elevateOnSelect:Ie.elevateEdgesOnSelect,zIndexMode:Ie.zIndexMode}),...ot||hC}},[R.source,R.target,R.sourceHandle,R.targetHandle,R.selected,R.zIndex]),Qn),X=j.useMemo(()=>R.markerStart?`url('#${U1(R.markerStart,S)}')`:void 0,[R.markerStart,S]),ue=j.useMemo(()=>R.markerEnd?`url('#${U1(R.markerEnd,S)}')`:void 0,[R.markerEnd,S]);if(R.hidden||V===null||Q===null||W===null||Y===null)return null;const ie=Ie=>{var Ue;const{addSelectedEdges:He,unselectNodesAndEdges:Qe,multiSelectionActive:ot}=K.getState();I&&(K.setState({nodesSelectionActive:!1}),R.selected&&ot?(Qe({nodes:[],edges:[R]}),(Ue=F.current)==null||Ue.blur()):He([e])),r&&r(Ie,R)},he=s?Ie=>{s(Ie,{...R})}:void 0,be=l?Ie=>{l(Ie,{...R})}:void 0,ye=c?Ie=>{c(Ie,{...R})}:void 0,le=f?Ie=>{f(Ie,{...R})}:void 0,Re=p?Ie=>{p(Ie,{...R})}:void 0,je=Ie=>{var He;if(!N&&Pk.includes(Ie.key)&&I){const{unselectNodesAndEdges:Qe,addSelectedEdges:ot}=K.getState();Ie.key==="Escape"?((He=F.current)==null||He.blur(),Qe({edges:[R]})):ot([e])}};return _.jsx("svg",{style:{zIndex:B},children:_.jsxs("g",{className:zi(["react-flow__edge",`react-flow__edge-${H}`,R.className,T,{selected:R.selected,animated:R.animated,inactive:!I&&!r,updating:U,selectable:I}]),onClick:ie,onDoubleClick:he,onContextMenu:be,onMouseEnter:ye,onMouseMove:le,onMouseLeave:Re,onKeyDown:q?je:void 0,tabIndex:q?0:void 0,role:R.ariaRole??(q?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":R.ariaLabel===null?void 0:R.ariaLabel||`Edge from ${R.source} to ${R.target}`,"aria-describedby":q?`${bN}-${S}`:void 0,ref:F,...R.domAttributes,children:[!J&&_.jsx(O,{id:e,source:R.source,target:R.target,type:R.type,selected:R.selected,animated:R.animated,selectable:I,deletable:R.deletable??!0,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,sourceX:V,sourceY:Q,targetX:W,targetY:Y,sourcePosition:$,targetPosition:ne,data:R.data,style:R.style,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerStart:X,markerEnd:ue,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth}),Z&&_.jsx(G$,{edge:R,isReconnectable:Z,reconnectRadius:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:v,sourceX:V,sourceY:Q,targetX:W,targetY:Y,sourcePosition:$,targetPosition:ne,setUpdateHover:L,setReconnecting:G})]})})}var Y$=j.memo(q$);const V$=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function GN({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:i,noPanClassName:r,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:m,reconnectRadius:g,onEdgeDoubleClick:x,onReconnectStart:v,onReconnectEnd:S,disableKeyboardA11y:A}){const{edgesFocusable:T,edgesReconnectable:C,elementsSelectable:N,onError:R}=$t(V$,Qn),D=k$(t);return _.jsxs("div",{className:"react-flow__edges",children:[_.jsx(B$,{defaultColor:e,rfId:n}),D.map(H=>_.jsx(Y$,{id:H,edgesFocusable:T,edgesReconnectable:C,elementsSelectable:N,noPanClassName:r,onReconnect:s,onContextMenu:l,onMouseEnter:c,onMouseMove:f,onMouseLeave:p,onClick:m,reconnectRadius:g,onDoubleClick:x,onReconnectStart:v,onReconnectEnd:S,rfId:n,onError:R,edgeTypes:i,disableKeyboardA11y:A},H))]})}GN.displayName="EdgeRenderer";const X$=j.memo(GN),K$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function $$({children:e}){const t=$t(K$);return _.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function W$(e){const t=Sx(),n=j.useRef(!1);j.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Q$=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Z$(e){const t=$t(Q$),n=Zn();return j.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function J$(e){return e.connection.inProgress?{...e.connection,to:cg(e.connection.to,e.transform)}:{...e.connection}}function eW(e){return J$}function tW(e){const t=eW();return $t(t,Qn)}const nW=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function iW({containerStyle:e,style:t,type:n,component:i}){const{nodesConnectable:r,width:s,height:l,isValid:c,inProgress:f}=$t(nW,Qn);return!(s&&r&&f)?null:_.jsx("svg",{style:e,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:_.jsx("g",{className:zi(["react-flow__connection",qk(c)]),children:_.jsx(qN,{style:t,type:n,CustomComponent:i,isValid:c})})})}const qN=({style:e,type:t=su.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:r,from:s,fromNode:l,fromHandle:c,fromPosition:f,to:p,toNode:m,toHandle:g,toPosition:x,pointer:v}=tW();if(!r)return;if(n)return _.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:c,fromX:s.x,fromY:s.y,toX:p.x,toY:p.y,fromPosition:f,toPosition:x,connectionStatus:qk(i),toNode:m,toHandle:g,pointer:v});let S="";const A={sourceX:s.x,sourceY:s.y,sourcePosition:f,targetX:p.x,targetY:p.y,targetPosition:x};switch(t){case su.Bezier:[S]=nN(A);break;case su.SimpleBezier:[S]=NN(A);break;case su.Step:[S]=I1({...A,borderRadius:0});break;case su.SmoothStep:[S]=I1(A);break;default:[S]=rN(A)}return _.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};qN.displayName="ConnectionLine";const rW={};function gC(e=rW){j.useRef(e),Zn(),j.useEffect(()=>{},[e])}function aW(){Zn(),j.useRef(!1),j.useEffect(()=>{},[])}function YN({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:m,onSelectionContextMenu:g,onSelectionStart:x,onSelectionEnd:v,connectionLineType:S,connectionLineStyle:A,connectionLineComponent:T,connectionLineContainerStyle:C,selectionKeyCode:N,selectionOnDrag:R,selectionMode:D,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:q,deleteKeyCode:Z,onlyRenderVisibleElements:I,elementsSelectable:F,defaultViewport:U,translateExtent:L,minZoom:J,maxZoom:G,preventScrolling:K,defaultMarkerColor:B,zoomOnScroll:V,zoomOnPinch:Q,panOnScroll:W,panOnScrollSpeed:Y,panOnScrollMode:$,zoomOnDoubleClick:ne,panOnDrag:X,onPaneClick:ue,onPaneMouseEnter:ie,onPaneMouseMove:he,onPaneMouseLeave:be,onPaneScroll:ye,onPaneContextMenu:le,paneClickDistance:Re,nodeClickDistance:je,onEdgeContextMenu:Ie,onEdgeMouseEnter:He,onEdgeMouseMove:Qe,onEdgeMouseLeave:ot,reconnectRadius:Ue,onReconnect:wt,onReconnectStart:_n,onReconnectEnd:Sn,noDragClassName:hn,noWheelClassName:oi,noPanClassName:Ur,disableKeyboardA11y:Ci,nodeExtent:Wt,rfId:sr,viewport:Ee,onViewportChange:ke}){return gC(e),gC(t),aW(),W$(n),Z$(Ee),_.jsx(v$,{onPaneClick:ue,onPaneMouseEnter:ie,onPaneMouseMove:he,onPaneMouseLeave:be,onPaneContextMenu:le,onPaneScroll:ye,paneClickDistance:Re,deleteKeyCode:Z,selectionKeyCode:N,selectionOnDrag:R,selectionMode:D,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:q,elementsSelectable:F,zoomOnScroll:V,zoomOnPinch:Q,zoomOnDoubleClick:ne,panOnScroll:W,panOnScrollSpeed:Y,panOnScrollMode:$,panOnDrag:X,defaultViewport:U,translateExtent:L,minZoom:J,maxZoom:G,onSelectionContextMenu:g,preventScrolling:K,noDragClassName:hn,noWheelClassName:oi,noPanClassName:Ur,disableKeyboardA11y:Ci,onViewportChange:ke,isControlledViewport:!!Ee,children:_.jsxs($$,{children:[_.jsx(X$,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:l,onReconnect:wt,onReconnectStart:_n,onReconnectEnd:Sn,onlyRenderVisibleElements:I,onEdgeContextMenu:Ie,onEdgeMouseEnter:He,onEdgeMouseMove:Qe,onEdgeMouseLeave:ot,reconnectRadius:Ue,defaultMarkerColor:B,noPanClassName:Ur,disableKeyboardA11y:Ci,rfId:sr}),_.jsx(iW,{style:A,type:S,component:T,containerStyle:C}),_.jsx("div",{className:"react-flow__edgelabel-renderer"}),_.jsx(R$,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:m,nodeClickDistance:je,onlyRenderVisibleElements:I,noPanClassName:Ur,noDragClassName:hn,disableKeyboardA11y:Ci,nodeExtent:Wt,rfId:sr}),_.jsx("div",{className:"react-flow__viewport-portal"})]})})}YN.displayName="GraphView";const sW=j.memo(YN),yC=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:l,fitViewOptions:c,minZoom:f=.5,maxZoom:p=2,nodeOrigin:m,nodeExtent:g,zIndexMode:x="basic"}={})=>{const v=new Map,S=new Map,A=new Map,T=new Map,C=i??t??[],N=n??e??[],R=m??[0,0],D=g??Gm;lN(A,T,C);const H=H1(N,v,S,{nodeOrigin:R,nodeExtent:D,zIndexMode:x});let O=[0,0,1];if(l&&r&&s){const q=lg(v,{filter:U=>!!((U.width||U.initialWidth)&&(U.height||U.initialHeight))}),{x:Z,y:I,zoom:F}=V_(q,r,s,f,p,(c==null?void 0:c.padding)??.1);O=[Z,I,F]}return{rfId:"1",width:r??0,height:s??0,transform:O,nodes:N,nodesInitialized:H,nodeLookup:v,parentLookup:S,edges:C,edgeLookup:T,connectionLookup:A,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:f,maxZoom:p,translateExtent:Gm,nodeExtent:D,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mh.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:R,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:l??!1,fitViewOptions:c,fitViewResolver:null,connection:{...Gk},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:bX,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Fk,zIndexMode:x,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},lW=({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:l,fitViewOptions:c,minZoom:f,maxZoom:p,nodeOrigin:m,nodeExtent:g,zIndexMode:x})=>EK((v,S)=>{async function A(){const{nodeLookup:T,panZoom:C,fitViewOptions:N,fitViewResolver:R,width:D,height:H,minZoom:O,maxZoom:q}=S();C&&(await yX({nodes:T,width:D,height:H,panZoom:C,minZoom:O,maxZoom:q},N),R==null||R.resolve(!0),v({fitViewResolver:null}))}return{...yC({nodes:e,edges:t,width:r,height:s,fitView:l,fitViewOptions:c,minZoom:f,maxZoom:p,nodeOrigin:m,nodeExtent:g,defaultNodes:n,defaultEdges:i,zIndexMode:x}),setNodes:T=>{const{nodeLookup:C,parentLookup:N,nodeOrigin:R,elevateNodesOnSelect:D,fitViewQueued:H,zIndexMode:O}=S(),q=H1(T,C,N,{nodeOrigin:R,nodeExtent:g,elevateNodesOnSelect:D,checkEquality:!0,zIndexMode:O});H&&q?(A(),v({nodes:T,nodesInitialized:q,fitViewQueued:!1,fitViewOptions:void 0})):v({nodes:T,nodesInitialized:q})},setEdges:T=>{const{connectionLookup:C,edgeLookup:N}=S();lN(C,N,T),v({edges:T})},setDefaultNodesAndEdges:(T,C)=>{if(T){const{setNodes:N}=S();N(T),v({hasDefaultNodes:!0})}if(C){const{setEdges:N}=S();N(C),v({hasDefaultEdges:!0})}},updateNodeInternals:T=>{const{triggerNodeChanges:C,nodeLookup:N,parentLookup:R,domNode:D,nodeOrigin:H,nodeExtent:O,debug:q,fitViewQueued:Z,zIndexMode:I}=S(),{changes:F,updatedInternals:U}=PX(T,N,R,D,H,O,I);U&&(jX(N,R,{nodeOrigin:H,nodeExtent:O,zIndexMode:I}),Z?(A(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(F==null?void 0:F.length)>0&&(q&&console.log("React Flow: trigger node changes",F),C==null||C(F)))},updateNodePositions:(T,C=!1)=>{const N=[];let R=[];const{nodeLookup:D,triggerNodeChanges:H,connection:O,updateConnection:q,onNodesChangeMiddlewareMap:Z}=S();for(const[I,F]of T){const U=D.get(I),L=!!(U!=null&&U.expandParent&&(U!=null&&U.parentId)&&(F!=null&&F.position)),J={id:I,type:"position",position:L?{x:Math.max(0,F.position.x),y:Math.max(0,F.position.y)}:F.position,dragging:C};if(U&&O.inProgress&&O.fromNode.id===U.id){const G=Cd(U,O.fromHandle,We.Left,!0);q({...O,from:G})}L&&U.parentId&&N.push({id:I,parentId:U.parentId,rect:{...F.internals.positionAbsolute,width:F.measured.width??0,height:F.measured.height??0}}),R.push(J)}if(N.length>0){const{parentLookup:I,nodeOrigin:F}=S(),U=Z_(N,D,I,F);R.push(...U)}for(const I of Z.values())R=I(R);H(R)},triggerNodeChanges:T=>{const{onNodesChange:C,setNodes:N,nodes:R,hasDefaultNodes:D,debug:H}=S();if(T!=null&&T.length){if(D){const O=qK(T,R);N(O)}H&&console.log("React Flow: trigger node changes",T),C==null||C(T)}},triggerEdgeChanges:T=>{const{onEdgesChange:C,setEdges:N,edges:R,hasDefaultEdges:D,debug:H}=S();if(T!=null&&T.length){if(D){const O=YK(T,R);N(O)}H&&console.log("React Flow: trigger edge changes",T),C==null||C(T)}},addSelectedNodes:T=>{const{multiSelectionActive:C,edgeLookup:N,nodeLookup:R,triggerNodeChanges:D,triggerEdgeChanges:H}=S();if(C){const O=T.map(q=>pd(q,!0));D(O);return}D(eh(R,new Set([...T]),!0)),H(eh(N))},addSelectedEdges:T=>{const{multiSelectionActive:C,edgeLookup:N,nodeLookup:R,triggerNodeChanges:D,triggerEdgeChanges:H}=S();if(C){const O=T.map(q=>pd(q,!0));H(O);return}H(eh(N,new Set([...T]))),D(eh(R,new Set,!0))},unselectNodesAndEdges:({nodes:T,edges:C}={})=>{const{edges:N,nodes:R,nodeLookup:D,triggerNodeChanges:H,triggerEdgeChanges:O}=S(),q=T||R,Z=C||N,I=[];for(const U of q){if(!U.selected)continue;const L=D.get(U.id);L&&(L.selected=!1),I.push(pd(U.id,!1))}const F=[];for(const U of Z)U.selected&&F.push(pd(U.id,!1));H(I),O(F)},setMinZoom:T=>{const{panZoom:C,maxZoom:N}=S();C==null||C.setScaleExtent([T,N]),v({minZoom:T})},setMaxZoom:T=>{const{panZoom:C,minZoom:N}=S();C==null||C.setScaleExtent([N,T]),v({maxZoom:T})},setTranslateExtent:T=>{var C;(C=S().panZoom)==null||C.setTranslateExtent(T),v({translateExtent:T})},resetSelectedElements:()=>{const{edges:T,nodes:C,triggerNodeChanges:N,triggerEdgeChanges:R,elementsSelectable:D}=S();if(!D)return;const H=C.reduce((q,Z)=>Z.selected?[...q,pd(Z.id,!1)]:q,[]),O=T.reduce((q,Z)=>Z.selected?[...q,pd(Z.id,!1)]:q,[]);N(H),R(O)},setNodeExtent:T=>{const{nodes:C,nodeLookup:N,parentLookup:R,nodeOrigin:D,elevateNodesOnSelect:H,nodeExtent:O,zIndexMode:q}=S();T[0][0]===O[0][0]&&T[0][1]===O[0][1]&&T[1][0]===O[1][0]&&T[1][1]===O[1][1]||(H1(C,N,R,{nodeOrigin:D,nodeExtent:T,elevateNodesOnSelect:H,checkEquality:!1,zIndexMode:q}),v({nodeExtent:T}))},panBy:T=>{const{transform:C,width:N,height:R,panZoom:D,translateExtent:H}=S();return FX({delta:T,panZoom:D,transform:C,translateExtent:H,width:N,height:R})},setCenter:async(T,C,N)=>{const{width:R,height:D,maxZoom:H,panZoom:O}=S();if(!O)return Promise.resolve(!1);const q=typeof(N==null?void 0:N.zoom)<"u"?N.zoom:H;return await O.setViewport({x:R/2-T*q,y:D/2-C*q,zoom:q},{duration:N==null?void 0:N.duration,ease:N==null?void 0:N.ease,interpolate:N==null?void 0:N.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{v({connection:{...Gk}})},updateConnection:T=>{v({connection:T})},reset:()=>v({...yC()})}},Object.is);function VN({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:i,initialWidth:r,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:f,fitView:p,nodeOrigin:m,nodeExtent:g,zIndexMode:x,children:v}){const[S]=j.useState(()=>lW({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,width:r,height:s,fitView:p,minZoom:l,maxZoom:c,fitViewOptions:f,nodeOrigin:m,nodeExtent:g,zIndexMode:x}));return _.jsx(wK,{value:S,children:_.jsx($K,{children:v})})}function oW({children:e,nodes:t,edges:n,defaultNodes:i,defaultEdges:r,width:s,height:l,fitView:c,fitViewOptions:f,minZoom:p,maxZoom:m,nodeOrigin:g,nodeExtent:x,zIndexMode:v}){return j.useContext(vx)?_.jsx(_.Fragment,{children:e}):_.jsx(VN,{initialNodes:t,initialEdges:n,defaultNodes:i,defaultEdges:r,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:f,initialMinZoom:p,initialMaxZoom:m,nodeOrigin:g,nodeExtent:x,zIndexMode:v,children:e})}const cW={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function uW({nodes:e,edges:t,defaultNodes:n,defaultEdges:i,className:r,nodeTypes:s,edgeTypes:l,onNodeClick:c,onEdgeClick:f,onInit:p,onMove:m,onMoveStart:g,onMoveEnd:x,onConnect:v,onConnectStart:S,onConnectEnd:A,onClickConnectStart:T,onClickConnectEnd:C,onNodeMouseEnter:N,onNodeMouseMove:R,onNodeMouseLeave:D,onNodeContextMenu:H,onNodeDoubleClick:O,onNodeDragStart:q,onNodeDrag:Z,onNodeDragStop:I,onNodesDelete:F,onEdgesDelete:U,onDelete:L,onSelectionChange:J,onSelectionDragStart:G,onSelectionDrag:K,onSelectionDragStop:B,onSelectionContextMenu:V,onSelectionStart:Q,onSelectionEnd:W,onBeforeDelete:Y,connectionMode:$,connectionLineType:ne=su.Bezier,connectionLineStyle:X,connectionLineComponent:ue,connectionLineContainerStyle:ie,deleteKeyCode:he="Backspace",selectionKeyCode:be="Shift",selectionOnDrag:ye=!1,selectionMode:le=qm.Full,panActivationKeyCode:Re="Space",multiSelectionKeyCode:je=Xm()?"Meta":"Control",zoomActivationKeyCode:Ie=Xm()?"Meta":"Control",snapToGrid:He,snapGrid:Qe,onlyRenderVisibleElements:ot=!1,selectNodesOnDrag:Ue,nodesDraggable:wt,autoPanOnNodeFocus:_n,nodesConnectable:Sn,nodesFocusable:hn,nodeOrigin:oi=vN,edgesFocusable:Ur,edgesReconnectable:Ci,elementsSelectable:Wt=!0,defaultViewport:sr=jK,minZoom:Ee=.5,maxZoom:ke=2,translateExtent:oe=Gm,preventScrolling:Pe=!0,nodeExtent:ct,defaultMarkerColor:tn="#b1b1b7",zoomOnScroll:ci=!0,zoomOnPinch:Qt=!0,panOnScroll:Zt=!1,panOnScrollSpeed:Gn=.5,panOnScrollMode:Pt=bd.Free,zoomOnDoubleClick:Yi=!0,panOnDrag:Jn=!0,onPaneClick:vo,onPaneMouseEnter:ls,onPaneMouseMove:Ba,onPaneMouseLeave:os,onPaneScroll:vi,onPaneContextMenu:se,paneClickDistance:Te=1,nodeClickDistance:Le=0,children:tt,onReconnect:nn,onReconnectStart:rn,onReconnectEnd:Ye,onEdgeContextMenu:Ge,onEdgeDoubleClick:nt,onEdgeMouseEnter:Rn,onEdgeMouseMove:Ft,onEdgeMouseLeave:ga,reconnectRadius:lr=10,onNodesChange:Vi,onEdgesChange:or,noDragClassName:bt="nodrag",noWheelClassName:ui="nowheel",noPanClassName:Hr="nopan",fitView:Us,fitViewOptions:Cl,connectOnClick:Al,attributionPosition:Ml,proOptions:La,defaultEdgeOptions:Hs,elevateNodesOnSelect:an=!0,elevateEdgesOnSelect:sn=!1,disableKeyboardA11y:cr=!1,autoPanOnConnect:Pr,autoPanOnNodeDrag:jn,autoPanSpeed:Sr,connectionRadius:ya,isValidConnection:Fr,onError:Ne,style:Ke,id:vt,nodeDragThreshold:Xt,connectionDragThreshold:In,viewport:_i,onViewportChange:Xi,width:Ai,height:pn,colorMode:ur="light",debug:_o,onScroll:xa,ariaLabelConfig:Rl,zIndexMode:ja="basic",...fc},Bi){const cs=vt||"1",us=PK(ur),Ps=j.useCallback(di=>{di.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),xa==null||xa(di)},[xa]);return _.jsx("div",{"data-testid":"rf__wrapper",...fc,onScroll:Ps,style:{...Ke,...cW},ref:Bi,className:zi(["react-flow",r,us]),id:vt,role:"application",children:_.jsxs(oW,{nodes:e,edges:t,width:Ai,height:pn,fitView:Us,fitViewOptions:Cl,minZoom:Ee,maxZoom:ke,nodeOrigin:oi,nodeExtent:ct,zIndexMode:ja,children:[_.jsx(sW,{onInit:p,onNodeClick:c,onEdgeClick:f,onNodeMouseEnter:N,onNodeMouseMove:R,onNodeMouseLeave:D,onNodeContextMenu:H,onNodeDoubleClick:O,nodeTypes:s,edgeTypes:l,connectionLineType:ne,connectionLineStyle:X,connectionLineComponent:ue,connectionLineContainerStyle:ie,selectionKeyCode:be,selectionOnDrag:ye,selectionMode:le,deleteKeyCode:he,multiSelectionKeyCode:je,panActivationKeyCode:Re,zoomActivationKeyCode:Ie,onlyRenderVisibleElements:ot,defaultViewport:sr,translateExtent:oe,minZoom:Ee,maxZoom:ke,preventScrolling:Pe,zoomOnScroll:ci,zoomOnPinch:Qt,zoomOnDoubleClick:Yi,panOnScroll:Zt,panOnScrollSpeed:Gn,panOnScrollMode:Pt,panOnDrag:Jn,onPaneClick:vo,onPaneMouseEnter:ls,onPaneMouseMove:Ba,onPaneMouseLeave:os,onPaneScroll:vi,onPaneContextMenu:se,paneClickDistance:Te,nodeClickDistance:Le,onSelectionContextMenu:V,onSelectionStart:Q,onSelectionEnd:W,onReconnect:nn,onReconnectStart:rn,onReconnectEnd:Ye,onEdgeContextMenu:Ge,onEdgeDoubleClick:nt,onEdgeMouseEnter:Rn,onEdgeMouseMove:Ft,onEdgeMouseLeave:ga,reconnectRadius:lr,defaultMarkerColor:tn,noDragClassName:bt,noWheelClassName:ui,noPanClassName:Hr,rfId:cs,disableKeyboardA11y:cr,nodeExtent:ct,viewport:_i,onViewportChange:Xi}),_.jsx(HK,{nodes:e,edges:t,defaultNodes:n,defaultEdges:i,onConnect:v,onConnectStart:S,onConnectEnd:A,onClickConnectStart:T,onClickConnectEnd:C,nodesDraggable:wt,autoPanOnNodeFocus:_n,nodesConnectable:Sn,nodesFocusable:hn,edgesFocusable:Ur,edgesReconnectable:Ci,elementsSelectable:Wt,elevateNodesOnSelect:an,elevateEdgesOnSelect:sn,minZoom:Ee,maxZoom:ke,nodeExtent:ct,onNodesChange:Vi,onEdgesChange:or,snapToGrid:He,snapGrid:Qe,connectionMode:$,translateExtent:oe,connectOnClick:Al,defaultEdgeOptions:Hs,fitView:Us,fitViewOptions:Cl,onNodesDelete:F,onEdgesDelete:U,onDelete:L,onNodeDragStart:q,onNodeDrag:Z,onNodeDragStop:I,onSelectionDrag:K,onSelectionDragStart:G,onSelectionDragStop:B,onMove:m,onMoveStart:g,onMoveEnd:x,noPanClassName:Hr,nodeOrigin:oi,rfId:cs,autoPanOnConnect:Pr,autoPanOnNodeDrag:jn,autoPanSpeed:Sr,onError:Ne,connectionRadius:ya,isValidConnection:Fr,selectNodesOnDrag:Ue,nodeDragThreshold:Xt,connectionDragThreshold:In,onBeforeDelete:Y,debug:_o,ariaLabelConfig:Rl,zIndexMode:ja}),_.jsx(LK,{onSelectionChange:J}),tt,_.jsx(NK,{proOptions:La,position:Ml}),_.jsx(kK,{rfId:cs,disableKeyboardA11y:cr})]})})}var dW=SN(uW);function fW({dimensions:e,lineWidth:t,variant:n,className:i}){return _.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:zi(["react-flow__background-pattern",n,i])})}function hW({radius:e,className:t}){return _.jsx("circle",{cx:e,cy:e,r:e,className:zi(["react-flow__background-pattern","dots",t])})}var cu;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(cu||(cu={}));const pW={[cu.Dots]:1,[cu.Lines]:1,[cu.Cross]:6},mW=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function XN({id:e,variant:t=cu.Dots,gap:n=20,size:i,lineWidth:r=1,offset:s=0,color:l,bgColor:c,style:f,className:p,patternClassName:m}){const g=j.useRef(null),{transform:x,patternId:v}=$t(mW,Qn),S=i||pW[t],A=t===cu.Dots,T=t===cu.Cross,C=Array.isArray(n)?n:[n,n],N=[C[0]*x[2]||1,C[1]*x[2]||1],R=S*x[2],D=Array.isArray(s)?s:[s,s],H=T?[R,R]:N,O=[D[0]*x[2]||1+H[0]/2,D[1]*x[2]||1+H[1]/2],q=`${v}${e||""}`;return _.jsxs("svg",{className:zi(["react-flow__background",p]),style:{...f,...Ex,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:g,"data-testid":"rf__background",children:[_.jsx("pattern",{id:q,x:x[0]%N[0],y:x[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${O[0]},-${O[1]})`,children:A?_.jsx(hW,{radius:R/2,className:m}):_.jsx(fW,{dimensions:H,lineWidth:r,variant:t,className:m})}),_.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${q})`})]})}XN.displayName="Background";const gW=j.memo(XN);function yW(){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 xW(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:_.jsx("path",{d:"M0 0h32v4.2H0z"})})}function bW(){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 vW(){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 _W(){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 f0({children:e,className:t,...n}){return _.jsx("button",{type:"button",className:zi(["react-flow__controls-button",t]),...n,children:e})}const SW=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function KN({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:l,onFitView:c,onInteractiveChange:f,className:p,children:m,position:g="bottom-left",orientation:x="vertical","aria-label":v}){const S=Zn(),{isInteractive:A,minZoomReached:T,maxZoomReached:C,ariaLabelConfig:N}=$t(SW,Qn),{zoomIn:R,zoomOut:D,fitView:H}=Sx(),O=()=>{R(),s==null||s()},q=()=>{D(),l==null||l()},Z=()=>{H(r),c==null||c()},I=()=>{S.setState({nodesDraggable:!A,nodesConnectable:!A,elementsSelectable:!A}),f==null||f(!A)},F=x==="horizontal"?"horizontal":"vertical";return _.jsxs(_x,{className:zi(["react-flow__controls",F,p]),position:g,style:e,"data-testid":"rf__controls","aria-label":v??N["controls.ariaLabel"],children:[t&&_.jsxs(_.Fragment,{children:[_.jsx(f0,{onClick:O,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:C,children:_.jsx(yW,{})}),_.jsx(f0,{onClick:q,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:T,children:_.jsx(xW,{})})]}),n&&_.jsx(f0,{className:"react-flow__controls-fitview",onClick:Z,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:_.jsx(bW,{})}),i&&_.jsx(f0,{className:"react-flow__controls-interactive",onClick:I,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:A?_.jsx(_W,{}):_.jsx(vW,{})}),m]})}KN.displayName="Controls";const EW=j.memo(KN);function wW({id:e,x:t,y:n,width:i,height:r,style:s,color:l,strokeColor:c,strokeWidth:f,className:p,borderRadius:m,shapeRendering:g,selected:x,onClick:v}){const{background:S,backgroundColor:A}=s||{},T=l||S||A;return _.jsx("rect",{className:zi(["react-flow__minimap-node",{selected:x},p]),x:t,y:n,rx:m,ry:m,width:i,height:r,style:{fill:T,stroke:c,strokeWidth:f},shapeRendering:g,onClick:v?C=>v(C,e):void 0})}const TW=j.memo(wW),CW=e=>e.nodes.map(t=>t.id),Bv=e=>e instanceof Function?e:()=>e;function AW({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:s=TW,onClick:l}){const c=$t(CW,Qn),f=Bv(t),p=Bv(e),m=Bv(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return _.jsx(_.Fragment,{children:c.map(x=>_.jsx(RW,{id:x,nodeColorFunc:f,nodeStrokeColorFunc:p,nodeClassNameFunc:m,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:s,onClick:l,shapeRendering:g},x))})}function MW({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:l,NodeComponent:c,onClick:f}){const{node:p,x:m,y:g,width:x,height:v}=$t(S=>{const A=S.nodeLookup.get(e);if(!A)return{node:void 0,x:0,y:0,width:0,height:0};const T=A.internals.userNode,{x:C,y:N}=A.internals.positionAbsolute,{width:R,height:D}=dc(T);return{node:T,x:C,y:N,width:R,height:D}},Qn);return!p||p.hidden||!Wk(p)?null:_.jsx(c,{x:m,y:g,width:x,height:v,style:p.style,selected:!!p.selected,className:i(p),color:t(p),borderRadius:r,strokeColor:n(p),strokeWidth:s,shapeRendering:l,onClick:f,id:p.id})}const RW=j.memo(MW);var kW=j.memo(AW);const NW=200,OW=150,DW=e=>!e.hidden,zW=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?$k(lg(e.nodeLookup,{filter:DW}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},BW="react-flow__minimap-desc";function $N({style:e,className:t,nodeStrokeColor:n,nodeColor:i,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:f,maskColor:p,maskStrokeColor:m,maskStrokeWidth:g,position:x="bottom-right",onClick:v,onNodeClick:S,pannable:A=!1,zoomable:T=!1,ariaLabel:C,inversePan:N,zoomStep:R=1,offsetScale:D=5}){const H=Zn(),O=j.useRef(null),{boundingRect:q,viewBB:Z,rfId:I,panZoom:F,translateExtent:U,flowWidth:L,flowHeight:J,ariaLabelConfig:G}=$t(zW,Qn),K=(e==null?void 0:e.width)??NW,B=(e==null?void 0:e.height)??OW,V=q.width/K,Q=q.height/B,W=Math.max(V,Q),Y=W*K,$=W*B,ne=D*W,X=q.x-(Y-q.width)/2-ne,ue=q.y-($-q.height)/2-ne,ie=Y+ne*2,he=$+ne*2,be=`${BW}-${I}`,ye=j.useRef(0),le=j.useRef();ye.current=W,j.useEffect(()=>{if(O.current&&F)return le.current=QX({domNode:O.current,panZoom:F,getTransform:()=>H.getState().transform,getViewScale:()=>ye.current}),()=>{var He;(He=le.current)==null||He.destroy()}},[F]),j.useEffect(()=>{var He;(He=le.current)==null||He.update({translateExtent:U,width:L,height:J,inversePan:N,pannable:A,zoomStep:R,zoomable:T})},[A,T,N,R,U,L,J]);const Re=v?He=>{var Ue;const[Qe,ot]=((Ue=le.current)==null?void 0:Ue.pointer(He))||[0,0];v(He,{x:Qe,y:ot})}:void 0,je=S?j.useCallback((He,Qe)=>{const ot=H.getState().nodeLookup.get(Qe).internals.userNode;S(He,ot)},[]):void 0,Ie=C??G["minimap.ariaLabel"];return _.jsx(_x,{position:x,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*W:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:zi(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:_.jsxs("svg",{width:K,height:B,viewBox:`${X} ${ue} ${ie} ${he}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":be,ref:O,onClick:Re,children:[Ie&&_.jsx("title",{id:be,children:Ie}),_.jsx(kW,{onClick:je,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:l,nodeComponent:c}),_.jsx("path",{className:"react-flow__minimap-mask",d:`M${X-ne},${ue-ne}h${ie+ne*2}v${he+ne*2}h${-ie-ne*2}z
400
- M${Z.x},${Z.y}h${Z.width}v${Z.height}h${-Z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}$N.displayName="MiniMap";const LW=j.memo($N),jW=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,IW={[bh.Line]:"right",[bh.Handle]:"bottom-right"};function UW({nodeId:e,position:t,variant:n=bh.Handle,className:i,style:r=void 0,children:s,color:l,minWidth:c=10,minHeight:f=10,maxWidth:p=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:x,autoScale:v=!0,shouldResize:S,onResizeStart:A,onResize:T,onResizeEnd:C}){const N=CN(),R=typeof e=="string"?e:N,D=Zn(),H=j.useRef(null),O=n===bh.Handle,q=$t(j.useCallback(jW(O&&v),[O,v]),Qn),Z=j.useRef(null),I=t??IW[n];j.useEffect(()=>{if(!(!H.current||!R))return Z.current||(Z.current=dK({domNode:H.current,nodeId:R,getStoreItems:()=>{const{nodeLookup:U,transform:L,snapGrid:J,snapToGrid:G,nodeOrigin:K,domNode:B}=D.getState();return{nodeLookup:U,transform:L,snapGrid:J,snapToGrid:G,nodeOrigin:K,paneDomNode:B}},onChange:(U,L)=>{const{triggerNodeChanges:J,nodeLookup:G,parentLookup:K,nodeOrigin:B}=D.getState(),V=[],Q={x:U.x,y:U.y},W=G.get(R);if(W&&W.expandParent&&W.parentId){const Y=W.origin??B,$=U.width??W.measured.width??0,ne=U.height??W.measured.height??0,X={id:W.id,parentId:W.parentId,rect:{width:$,height:ne,...Qk({x:U.x??W.position.x,y:U.y??W.position.y},{width:$,height:ne},W.parentId,G,Y)}},ue=Z_([X],G,K,B);V.push(...ue),Q.x=U.x?Math.max(Y[0]*$,U.x):void 0,Q.y=U.y?Math.max(Y[1]*ne,U.y):void 0}if(Q.x!==void 0&&Q.y!==void 0){const Y={id:R,type:"position",position:{...Q}};V.push(Y)}if(U.width!==void 0&&U.height!==void 0){const $={id:R,type:"dimensions",resizing:!0,setAttributes:x?x==="horizontal"?"width":"height":!0,dimensions:{width:U.width,height:U.height}};V.push($)}for(const Y of L){const $={...Y,type:"position"};V.push($)}J(V)},onEnd:({width:U,height:L})=>{const J={id:R,type:"dimensions",resizing:!1,dimensions:{width:U,height:L}};D.getState().triggerNodeChanges([J])}})),Z.current.update({controlPosition:I,boundaries:{minWidth:c,minHeight:f,maxWidth:p,maxHeight:m},keepAspectRatio:g,resizeDirection:x,onResizeStart:A,onResize:T,onResizeEnd:C,shouldResize:S}),()=>{var U;(U=Z.current)==null||U.destroy()}},[I,c,f,p,m,g,A,T,C,S]);const F=I.split("-");return _.jsx("div",{className:zi(["react-flow__resize-control","nodrag",...F,n,i]),ref:H,style:{...r,scale:q,...l&&{[O?"backgroundColor":"borderColor"]:l}},children:s})}j.memo(UW);const G1={background:"rgba(0, 200, 255, 0.4)",width:6,height:6,border:"none"},xC={background:"rgba(0, 230, 138, 0.4)",width:6,height:6,border:"none"},bC={background:"rgba(255, 171, 64, 0.4)",width:6,height:6,border:"none"};function HW({data:e}){return _.jsxs("div",{style:{padding:"16px 32px",border:"2px solid rgba(0, 200, 255, 0.4)",borderRadius:12,background:"var(--surface-2)",boxShadow:"0 0 30px rgba(0, 200, 255, 0.15), 0 4px 16px rgba(0,0,0,0.2)",textAlign:"center",minWidth:200},children:[_.jsx(Sl,{type:"source",position:We.Bottom,style:G1}),_.jsx("div",{style:{width:44,height:44,borderRadius:8,background:"linear-gradient(135deg, var(--accent), var(--accent-dim))",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",fontWeight:700,color:"var(--text-inverse)",margin:"0 auto 8px",boxShadow:"var(--shadow-glow-strong)"},children:e.label.slice(0,2).toUpperCase()}),_.jsx("div",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"1rem",color:"var(--text-primary)"},children:e.label}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",marginTop:3},children:"CEO"})]})}function PW({data:e}){const t=e.agents;return _.jsxs("div",{style:{padding:"14px 20px",border:"1px solid var(--status-active-glow)",borderRadius:10,background:"var(--surface-2)",boxShadow:"0 0 16px rgba(0, 230, 138, 0.08), 0 2px 8px rgba(0,0,0,0.15)",textAlign:"center",minWidth:160},children:[_.jsx(Sl,{type:"target",position:We.Top,style:xC}),_.jsx(Sl,{type:"source",position:We.Bottom,style:xC}),_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,marginBottom:4},children:[_.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:5,background:"rgba(0, 230, 138, 0.15)",border:"1px solid rgba(0, 230, 138, 0.25)",fontSize:"0.6rem",color:"var(--status-active)",fontWeight:700},children:e.label.slice(0,1).toUpperCase()}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontWeight:600,fontSize:"0.82rem",color:"var(--status-active)"},children:e.label})]}),e.description?_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)",marginBottom:4,maxWidth:180},children:String(e.description)}):null,_.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)"},children:[t.length," agent",t.length!==1?"s":""]})]})}function FW({data:e}){return _.jsxs("div",{style:{padding:"8px 16px",border:"1px solid var(--border-subtle)",borderRadius:6,background:"var(--surface-1)",boxShadow:"0 1px 4px rgba(0,0,0,0.15)",textAlign:"center",minWidth:110},children:[_.jsx(Sl,{type:"target",position:We.Top,style:G1}),_.jsx(Sl,{type:"source",position:We.Bottom,style:G1}),_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[_.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--status-active)",boxShadow:"0 0 6px var(--status-active-glow)",flexShrink:0}}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontWeight:500,fontSize:"0.72rem",color:"var(--text-secondary)"},children:e.label})]}),e.stepLabel?_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.5rem",color:"var(--text-muted)",marginTop:3,maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:String(e.stepLabel)}):null]})}function GW({data:e}){return _.jsxs("div",{style:{padding:"5px 12px",border:"1px solid rgba(255, 171, 64, 0.3)",borderRadius:4,background:"var(--surface-2)",textAlign:"center",minWidth:80},children:[_.jsx(Sl,{type:"target",position:We.Top,style:bC}),_.jsx(Sl,{type:"source",position:We.Bottom,style:bC}),_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5},children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--status-warning)"},children:"⏸"}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontWeight:500,fontSize:"0.6rem",color:"var(--status-warning)"},children:e.label})]})]})}const qW={company:HW,squad:PW,agent:FW,checkpoint:GW},vC=300,Lv=60;function YW(e){const{tree:t,squads:n}=e,i=[],r=[];if(n.length===0)return i.push({id:"company",type:"company",position:{x:0,y:0},data:{label:t.name},draggable:!0}),{nodes:i,edges:r};const l=n.length*vC/2-100;return i.push({id:"company",type:"company",position:{x:l,y:0},data:{label:t.name},draggable:!0}),n.forEach((c,f)=>{const p=`squad-${c.code}`,m=f*vC,g=new Map(c.agents.map(S=>[S.id,S]));i.push({id:p,type:"squad",position:{x:m,y:200},data:{label:c.name,description:c.description,agents:c.agents},draggable:!0}),r.push({id:`company-${p}`,source:"company",target:p,style:{stroke:"rgba(0, 230, 138, 0.3)",strokeWidth:2},animated:!1});const x=c.pipeline||[];if(x.length===0){c.agents.forEach((S,A)=>{const T=`agent-${c.code}-${S.id}`;i.push({id:T,type:"agent",position:{x:m+25,y:340+A*Lv},data:{label:S.name},draggable:!0}),r.push({id:`${p}-${T}`,source:p,target:T,style:{stroke:"rgba(100, 120, 200, 0.15)",strokeWidth:1}})});return}let v=p;x.forEach((S,A)=>{const T=S.type==="checkpoint",C=S.agent?g.get(S.agent):null,N=`step-${c.code}-${S.id}`;T?i.push({id:N,type:"checkpoint",position:{x:m+40,y:340+A*Lv},data:{label:S.label},draggable:!0}):i.push({id:N,type:"agent",position:{x:m+25,y:340+A*Lv},data:{label:(C==null?void 0:C.name)||S.agent||S.id,stepLabel:S.label},draggable:!0});const R=T?{stroke:"rgba(255, 171, 64, 0.3)",strokeWidth:1}:{stroke:"rgba(0, 200, 255, 0.25)",strokeWidth:1.5};r.push({id:`chain-${c.code}-${v}-${N}`,source:v,target:N,style:R,markerEnd:T?void 0:{type:Ym.ArrowClosed,color:"rgba(0, 200, 255, 0.35)",width:12,height:12},animated:!T}),v=N})}),{nodes:i,edges:r}}function VW({data:e}){const{fitView:t}=Sx(),{nodes:n,edges:i}=j.useMemo(()=>YW(e),[e]);j.useEffect(()=>{const s=setTimeout(()=>t({padding:.12,duration:400}),50);return()=>clearTimeout(s)},[n.length,t]);const r=e.squads.reduce((s,l)=>s+l.agents.length,0);return _.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",animation:"fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both"},children:[_.jsxs("div",{style:{padding:"16px 20px 12px",flexShrink:0},children:[_.jsxs("h2",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"1.1rem",color:"var(--text-primary)",marginBottom:2},children:[e.tree.name," — Org Chart"]}),_.jsxs("p",{style:{fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)"},children:[e.squads.length," active squad",e.squads.length!==1?"s":""," / ",r," agents"]})]}),_.jsx("div",{style:{flex:1,minHeight:0},children:_.jsxs(dW,{nodes:n,edges:i,nodeTypes:qW,fitView:!0,fitViewOptions:{padding:.12},minZoom:.1,maxZoom:2,proOptions:{hideAttribution:!0},style:{background:"var(--surface-0)"},nodesDraggable:!0,nodesConnectable:!1,children:[_.jsx(gW,{color:"rgba(100, 120, 200, 0.04)",gap:24,size:1}),_.jsx(EW,{showInteractive:!1,style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8}}),_.jsx(LW,{nodeColor:s=>s.type==="company"?"#007acc":s.type==="squad"?"#00e68a":s.type==="checkpoint"?"#ffab40":"#888",maskColor:"var(--glass-bg)",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8}})]})})]})}function XW(){const[e,t]=j.useState(null),[n,i]=j.useState(!0),[r,s]=j.useState(null);return j.useEffect(()=>{fetch("/api/orgchart",{credentials:"include"}).then(l=>{if(!l.ok)throw new Error(`HTTP ${l.status}`);return l.json()}).then(l=>{t(l),i(!1)}).catch(l=>{s(l.message),i(!1)})},[]),n?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-muted)"},children:"Loading org chart..."}):r||!e?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--status-error)"},children:r||"Failed to load org chart"}):_.jsx(VN,{children:_.jsx(VW,{data:e})})}const WN={squad:"#00c8ff",agent:"#00e68a",memory:"#b388ff",skill:"#ffab40"},q1={squad:18,agent:12,memory:8,skill:8},_C={contains:"rgba(255,255,255,0.08)",pipeline:"rgba(0,200,255,0.4)",delivers:"rgba(0,230,138,0.5)",uses_skill:"rgba(255,171,64,0.15)",has_memory:"rgba(179,136,255,0.15)",shared_skill:"rgba(255,171,64,0.3)",shared_memory:"rgba(179,136,255,0.3)"};function KW(e,t,n,i,r){const s=n/2,l=i/2,c=3e3*r,f=.008*r,p=.01*r,m=.85;for(let x=0;x<e.length;x++){let v=0,S=0;for(let A=0;A<e.length;A++){if(x===A)continue;const T=e[x].x-e[A].x,C=e[x].y-e[A].y,N=T*T+C*C+1,R=c/N,D=Math.sqrt(N);v+=T/D*R,S+=C/D*R}v+=(s-e[x].x)*p,S+=(l-e[x].y)*p,e[x].vx=(e[x].vx+v)*m,e[x].vy=(e[x].vy+S)*m}for(const x of t){const v=e.findIndex(H=>H.id===x.source),S=e.findIndex(H=>H.id===x.target);if(v===-1||S===-1)continue;const A=e[S].x-e[v].x,T=e[S].y-e[v].y,C=Math.sqrt(A*A+T*T)+1,N=(C-100)*f,R=A/C*N,D=T/C*N;e[v].vx+=R,e[v].vy+=D,e[S].vx-=R,e[S].vy-=D}let g=0;for(const x of e)x.x+=x.vx,x.y+=x.vy,g+=x.vx*x.vx+x.vy*x.vy;return g}function $W(e,t){const n=new Map;for(const l of t)n.has(l.source)||n.set(l.source,[]),n.has(l.target)||n.set(l.target,[]),n.get(l.source).push(l.target),n.get(l.target).push(l.source);const i=new Map;i.set(e,0);const r=[e];let s=0;for(;s<r.length;){const l=r[s++],c=i.get(l);for(const f of n.get(l)||[])i.has(f)||(i.set(f,c+1),r.push(f))}return i}function WW(e,t,n,i,r,s,l,c,f){const p=getComputedStyle(document.documentElement).getPropertyValue("--surface-0").trim()||"#1e1e1e";e.fillStyle=p,e.fillRect(0,0,i,r),e.save(),e.translate(l,c),e.scale(f,f);const m=new Map(t.map(v=>[v.id,v]));let g=null;if(s){g=$W(s.id,n);for(const v of g.values());}const x=v=>{if(!s||!g||v===s.id)return 1;const S=g.get(v);return S===void 0?.06:Math.max(.08,1-S*.28)};for(const v of n){const S=m.get(v.source),A=m.get(v.target);if(!S||!A)continue;const T=Math.min(x(v.source),x(v.target)),C=s&&(v.source===s.id||v.target===s.id);if(e.globalAlpha=T,e.beginPath(),e.moveTo(S.x,S.y),e.lineTo(A.x,A.y),e.strokeStyle=C?"rgba(255,255,255,0.6)":_C[v.type]||"rgba(255,255,255,0.06)",e.lineWidth=C?1.8:v.type==="delivers"||v.type==="pipeline"?1.2:.5,e.stroke(),v.type==="delivers"||v.type==="pipeline"){const N=Math.atan2(A.y-S.y,A.x-S.x),R=q1[A.type]||10,D=A.x-Math.cos(N)*(R+4),H=A.y-Math.sin(N)*(R+4);e.beginPath(),e.moveTo(D,H),e.lineTo(D-Math.cos(N-.4)*6,H-Math.sin(N-.4)*6),e.lineTo(D-Math.cos(N+.4)*6,H-Math.sin(N+.4)*6),e.closePath(),e.fillStyle=_C[v.type],e.fill()}}e.globalAlpha=1;for(const v of t){const S=q1[v.type]||10,A=WN[v.type]||"#888",T=(s==null?void 0:s.id)===v.id,C=x(v.id);e.globalAlpha=C,e.beginPath(),e.arc(v.x,v.y,S,0,Math.PI*2),T&&(e.shadowColor=A,e.shadowBlur=24),e.fillStyle=A,e.fill(),e.shadowBlur=0;const N=v.type==="squad"?11:9;e.font=`${v.type==="squad"?"600":"400"} ${N}px "JetBrains Mono", monospace`,e.textAlign="center",e.textBaseline="top";const R=getComputedStyle(document.documentElement).getPropertyValue("--text-primary").trim()||"#fff";e.fillStyle=R,e.fillText(v.label,v.x,v.y+S+4)}e.globalAlpha=1,e.restore()}function QW(){const e=j.useRef(null),[t,n]=j.useState([]),[i,r]=j.useState([]),[s,l]=j.useState(!0),[c,f]=j.useState(null),p=j.useRef(null),m=j.useRef(null),g=j.useRef(null),x=j.useRef(!1),v=j.useRef({x:0,y:0}),S=j.useRef(1),A=j.useRef(!1),T=j.useRef({x:0,y:0}),C=j.useRef([]),N=j.useRef([]),R=j.useRef(0),D=j.useRef(1),H=j.useRef(!0),O=j.useRef(null);j.useEffect(()=>{fetch("/api/graph",{credentials:"include"}).then(I=>I.json()).then(I=>{const F=window.innerWidth,U=window.innerHeight,L=I.nodes.map((J,G)=>({...J,x:F/2+(Math.random()-.5)*400,y:U/2+(Math.random()-.5)*400,vx:0,vy:0}));C.current=L,N.current=I.edges,n(L),r(I.edges),l(!1)}).catch(()=>{f("Failed to load graph data"),l(!1)})},[]);const q=j.useCallback((I,F)=>{const U=v.current,L=S.current,J=(I-U.x)/L,G=(F-U.y)/L;for(let K=C.current.length-1;K>=0;K--){const B=C.current[K],V=q1[B.type]||10,Q=J-B.x,W=G-B.y;if(Q*Q+W*W<(V+4)*(V+4))return B}return null},[]);j.useEffect(()=>{const I=e.current;if(!I)return;const F=K=>{const B=I.getBoundingClientRect(),V=K.clientX-B.left,Q=K.clientY-B.top;if(g.current){x.current=!0;const ne=S.current,X=v.current;g.current.x=(V-X.x)/ne,g.current.y=(Q-X.y)/ne,g.current.vx=0,g.current.vy=0,D.current=.3,H.current=!0;return}if(A.current){v.current.x+=V-T.current.x,v.current.y+=Q-T.current.y,T.current={x:V,y:Q};return}const W=S.current,Y=v.current;O.current={x:(V-Y.x)/W,y:(Q-Y.y)/W};const $=q(V,Q);p.current=$,I.style.cursor=$?"grab":"default"},U=K=>{const B=I.getBoundingClientRect(),V=K.clientX-B.left,Q=K.clientY-B.top;x.current=!1;const W=q(V,Q);W?(g.current=W,I.style.cursor="grabbing"):(A.current=!0,T.current={x:V,y:Q},I.style.cursor="move")},L=K=>{var V;g.current;const B=A.current;if(g.current=null,A.current=!1,I.style.cursor="default",!x.current){const Q=I.getBoundingClientRect(),W=K.clientX-Q.left,Y=K.clientY-Q.top,$=q(W,Y);$?m.current=((V=m.current)==null?void 0:V.id)===$.id?null:$:B||(m.current=null)}},J=K=>{K.preventDefault();const B=I.getBoundingClientRect(),V=K.clientX-B.left,Q=K.clientY-B.top,W=K.deltaY>0?.92:1.08,Y=Math.max(.2,Math.min(5,S.current*W)),$=Y/S.current;v.current.x=V-(V-v.current.x)*$,v.current.y=Q-(Q-v.current.y)*$,S.current=Y},G=()=>{g.current=null,A.current=!1,O.current=null,I.style.cursor="default"};return I.addEventListener("mousemove",F),I.addEventListener("mousedown",U),I.addEventListener("mouseup",L),I.addEventListener("mouseleave",G),I.addEventListener("wheel",J,{passive:!1}),()=>{I.removeEventListener("mousemove",F),I.removeEventListener("mousedown",U),I.removeEventListener("mouseup",L),I.removeEventListener("mouseleave",G),I.removeEventListener("wheel",J)}},[q,s]),j.useEffect(()=>{if(s||C.current.length===0)return;const I=e.current;if(!I)return;const F=()=>{const G=I.parentElement;G&&(I.width=G.clientWidth*window.devicePixelRatio,I.height=G.clientHeight*window.devicePixelRatio,I.style.width=G.clientWidth+"px",I.style.height=G.clientHeight+"px")};F(),window.addEventListener("resize",F);const U=I.getContext("2d");let L=!0;const J=()=>{if(!L)return;const G=I.width/window.devicePixelRatio,K=I.height/window.devicePixelRatio;U.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),H.current&&(KW(C.current,N.current,G,K,D.current),D.current*=.98,D.current<.001&&(H.current=!1,D.current=0));const B=O.current;if(B&&!g.current&&!A.current)for(const W of C.current){const Y=W.x-B.x,$=W.y-B.y,ne=Y*Y+$*$;if(ne<14400&&ne>1){const X=Math.sqrt(ne),ue=.8*(1-X/120);W.x+=Y/X*ue,W.y+=$/X*ue}}WW(U,C.current,N.current,G,K,m.current,v.current.x,v.current.y,S.current),R.current=requestAnimationFrame(J)};return R.current=requestAnimationFrame(J),()=>{L=!1,cancelAnimationFrame(R.current),window.removeEventListener("resize",F)}},[s]);const Z=j.useCallback(I=>{const F=e.current;if(!F)return;const U=I==="in"?1.25:.8,L=F.clientWidth/2,J=F.clientHeight/2,G=Math.max(.2,Math.min(5,S.current*U)),K=G/S.current;v.current.x=L-(L-v.current.x)*K,v.current.y=J-(J-v.current.y)*K,S.current=G},[]);return s?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"0.8rem"},children:"Loading graph..."}):c?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--status-error)",fontFamily:"var(--font-mono)",fontSize:"0.8rem"},children:c}):_.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",background:"var(--surface-0)"},children:[_.jsx("canvas",{ref:e,style:{display:"block",touchAction:"none"}}),_.jsx("div",{style:{position:"absolute",bottom:16,left:16,background:"rgba(10, 12, 16, 0.85)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",padding:"10px 14px",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",display:"flex",flexDirection:"column",gap:6},children:Object.entries(WN).map(([I,F])=>_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[_.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:F,display:"inline-block"}}),_.jsx("span",{style:{textTransform:"capitalize"},children:I})]},I))}),_.jsxs("div",{style:{position:"absolute",top:16,right:16,background:"rgba(10, 12, 16, 0.85)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",padding:"10px 14px",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",display:"flex",gap:16},children:[_.jsxs("span",{children:[t.length," nodes"]}),_.jsxs("span",{children:[i.length," edges"]})]}),_.jsx("div",{style:{position:"absolute",bottom:16,right:16,display:"flex",flexDirection:"column",gap:4},children:[{label:"+",action:"in"},{label:"−",action:"out"}].map(({label:I,action:F})=>_.jsx("button",{onClick:()=>Z(F),style:{width:32,height:32,background:"rgba(10, 12, 16, 0.85)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"1rem",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:I},F))})]})}function ZW(){const[e,t]=j.useState([]),[n,i]=j.useState(null),[r,s]=j.useState(""),[l,c]=j.useState(""),[f,p]=j.useState(!1),[m,g]=j.useState(!1),[x,v]=j.useState(new Set),[S,A]=j.useState(""),T=j.useRef(null);j.useEffect(()=>{fetch("/api/files",{credentials:"include"}).then(O=>O.json()).then(O=>{const q=new Map;for(const I of O)q.has(I.squad)||q.set(I.squad,{squad:I.squad,squadName:I.squadName,files:[]}),q.get(I.squad).files.push(I);const Z=[...q.values()];t(Z)})},[]);const C=j.useCallback(O=>{i(O),g(!0),fetch(`/api/files/${O.squad}/${O.path}`,{credentials:"include"}).then(q=>q.json()).then(q=>{s(q.content),c(q.content),g(!1)}).catch(()=>{s(""),c(""),g(!1)})},[]),N=j.useCallback(async()=>{n&&(p(!0),await fetch(`/api/files/${n.squad}/${n.path}`,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})}),c(r),p(!1))},[n,r]),R=j.useCallback(O=>{v(q=>{const Z=new Set(q);return Z.has(O)?Z.delete(O):Z.add(O),Z})},[]),D=r!==l;j.useEffect(()=>{const O=q=>{(q.metaKey||q.ctrlKey)&&q.key==="s"&&(q.preventDefault(),D&&n&&N())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[D,n,N]);const H=O=>O==="squad.yaml"?"⚙":O==="memories.md"?"◆":"◇";return _.jsxs("div",{style:{display:"flex",height:"100%",overflow:"hidden"},children:[_.jsxs("div",{style:{width:260,minWidth:260,borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[_.jsx("div",{style:{padding:"12px 14px",fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.1em",borderBottom:"1px solid var(--border-subtle)"},children:"Squad Files"}),_.jsx("div",{style:{padding:"8px 10px",borderBottom:"1px solid var(--border-subtle)"},children:_.jsx("input",{type:"text",placeholder:"Search squads...",value:S,onChange:O=>A(O.target.value),style:{width:"100%",padding:"5px 8px",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-xs)",background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:"0.7rem",outline:"none"}})}),_.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"8px 0"},children:[e.filter(O=>{if(!S)return!0;const q=S.toLowerCase();return O.squadName.toLowerCase().includes(q)||O.squad.toLowerCase().includes(q)}).map(O=>_.jsxs("div",{children:[_.jsxs("button",{onClick:()=>R(O.squad),style:{width:"100%",background:"none",border:"none",padding:"6px 14px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.75rem",fontWeight:600,color:"var(--text-primary)",textAlign:"left"},children:[_.jsx("span",{style:{fontSize:"0.6rem",transition:"transform 0.15s ease",transform:x.has(O.squad)?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),O.squadName]}),x.has(O.squad)&&_.jsx("div",{style:{paddingLeft:14},children:O.files.map(q=>{const Z=(n==null?void 0:n.squad)===q.squad&&(n==null?void 0:n.path)===q.path;return _.jsxs("button",{onClick:()=>C(q),style:{width:"100%",background:Z?"var(--accent-glow)":"none",border:Z?"1px solid rgba(0, 200, 255, 0.12)":"1px solid transparent",borderRadius:"var(--radius-xs)",padding:"5px 10px",display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.7rem",color:Z?"var(--accent)":"var(--text-secondary)",textAlign:"left"},children:[_.jsx("span",{style:{opacity:.6},children:H(q.file)}),q.file]},`${q.squad}/${q.path}`)})})]},O.squad)),e.length===0&&_.jsx("div",{style:{padding:"20px 14px",fontFamily:"var(--font-mono)",fontSize:"0.7rem",color:"var(--text-muted)",textAlign:"center"},children:"No squads found"})]})]}),_.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:n?_.jsxs(_.Fragment,{children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[_.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-secondary)",display:"flex",alignItems:"center",gap:8},children:[_.jsx("span",{style:{color:"var(--text-muted)"},children:n.squadName}),_.jsx("span",{style:{color:"var(--text-muted)",opacity:.4},children:"/"}),_.jsx("span",{children:n.file}),D&&_.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",display:"inline-block"}})]}),_.jsxs("button",{onClick:N,disabled:!D||f,style:{background:D?"var(--accent)":"var(--surface-3)",border:"none",borderRadius:"var(--radius-xs)",padding:"4px 14px",fontFamily:"var(--font-mono)",fontSize:"0.7rem",fontWeight:600,color:D?"var(--text-inverse)":"var(--text-muted)",cursor:D?"pointer":"default",opacity:D?1:.5,transition:"all 0.15s ease"},children:[f?"Saving...":"Save",_.jsx("span",{style:{marginLeft:6,fontSize:"0.6rem",opacity:.7},children:"⌘S"})]})]}),m?_.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"0.8rem"},children:"Loading..."}):_.jsx("textarea",{ref:T,value:r,onChange:O=>s(O.target.value),spellCheck:!1,style:{flex:1,width:"100%",padding:"16px 20px",border:"none",outline:"none",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:'"JetBrains Mono", "Fira Code", monospace',fontSize:"0.8rem",lineHeight:1.7,tabSize:2,whiteSpace:"pre",overflowWrap:"normal",overflowX:"auto"}})]}):_.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"var(--text-muted)",fontFamily:"var(--font-mono)"},children:[_.jsx("span",{style:{fontSize:"2rem",opacity:.3},children:"◇"}),_.jsx("span",{style:{fontSize:"0.8rem"},children:"Select a file to edit"})]})})]})}function xm(e){return e>=70?"#4ade80":e>=40?"#f59e0b":"#f44747"}function Ff(e,t,n){const i=n>0?Math.round(e/n*100):0,r=e+t>0?Math.round(e/(e+t)*100):0,s=Math.round((i+r)/2);return{r:i,q:r,e:s}}function JW(e,t){const n=Math.max(0,Math.floor((t-new Date(e).getTime())/1e3)),i=Math.floor(n/3600).toString().padStart(2,"0"),r=Math.floor(n%3600/60).toString().padStart(2,"0"),s=(n%60).toString().padStart(2,"0");return`${i}:${r}:${s}`}function SC(e,t){return t[e]??e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function eQ({name:e,size:t=28}){const n=[...e].reduce((i,r)=>i+r.charCodeAt(0),0)%360;return _.jsx("div",{style:{width:t,height:t,borderRadius:"50%",flexShrink:0,background:`hsl(${n},45%,20%)`,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-mono)",fontWeight:700,fontSize:Math.round(t*.38),color:`hsl(${n},55%,68%)`},children:e.slice(0,1).toUpperCase()})}function tQ({rank:e}){const t=["#FFD700","#C0C0C0","#CD7F32"],n=e<=3?t[e-1]:"var(--text-muted)";return _.jsx("div",{style:{width:20,height:20,borderRadius:"50%",flexShrink:0,background:e<=3?`${n}22`:"transparent",border:`1.5px solid ${n}`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.55rem",fontWeight:700,color:n},children:e})}function ld({label:e,value:t,sub:n,color:i,icon:r}){return _.jsxs("div",{style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"14px 14px 12px",display:"flex",flexDirection:"column",gap:6},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[_.jsx("span",{style:{fontSize:"0.58rem",color:"var(--text-muted)",fontFamily:"var(--font-mono)",textTransform:"uppercase",letterSpacing:"0.08em"},children:e}),r&&_.jsx("span",{style:{fontSize:"0.75rem",opacity:.5},children:r})]}),_.jsx("div",{style:{fontSize:"1.9rem",fontWeight:800,fontFamily:"var(--font-display)",color:i??"var(--text-bright)",lineHeight:1},children:t}),_.jsx("div",{style:{fontSize:"0.58rem",color:"var(--text-muted)",fontFamily:"var(--font-mono)"},children:n})]})}function jv({label:e,value:t,description:n}){const i=xm(t);return _.jsxs("div",{style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:16},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:10},children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.62rem",fontWeight:700,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.08em"},children:e}),_.jsxs("span",{style:{fontFamily:"var(--font-display)",fontSize:"1.15rem",fontWeight:800,color:i},children:[t,"%"]})]}),_.jsx("div",{style:{height:5,background:"var(--surface-3)",borderRadius:3,overflow:"hidden"},children:_.jsx("div",{style:{height:"100%",width:`${t}%`,background:i,borderRadius:3,transition:"width 0.6s ease"}})}),_.jsx("p",{style:{fontSize:"0.58rem",color:"var(--text-muted)",fontFamily:"var(--font-mono)",marginTop:8,lineHeight:1.6},children:n})]})}function EC({bars:e,height:t=100,showSecondary:n=!1}){const i=Math.max(...e.flatMap(s=>[s.primary,s.secondary??0]),1),r=t-16;return _.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:2,height:t},children:e.map((s,l)=>_.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[_.jsxs("div",{style:{display:"flex",gap:1,alignItems:"flex-end",width:"100%",height:r},children:[n&&s.secondary!==void 0&&_.jsx("div",{style:{flex:1,alignSelf:"flex-end",height:Math.max(s.secondary>0?2:0,Math.round(s.secondary/i*r)),background:"rgba(255,255,255,0.1)",borderRadius:"2px 2px 0 0"}}),_.jsx("div",{style:{flex:1,alignSelf:"flex-end",height:Math.max(s.primary>0?2:0,Math.round(s.primary/i*r)),background:"#4ade80",borderRadius:"2px 2px 0 0"}})]}),_.jsx("span",{style:{fontSize:"0.42rem",color:"var(--text-muted)",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},children:s.label})]},l))})}function Iv({rank:e,name:t,score:n,sub:i,barColor:r}){return _.jsxs("div",{children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3},children:[_.jsx(tQ,{rank:e}),_.jsx(eQ,{name:t,size:26}),_.jsxs("div",{style:{flex:1,minWidth:0},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.63rem",fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.48rem",color:"var(--text-muted)"},children:i})]}),_.jsxs("span",{style:{fontFamily:"var(--font-display)",fontSize:"0.82rem",fontWeight:800,color:r,flexShrink:0},children:[n,"%"]})]}),_.jsx("div",{style:{height:2,background:"var(--surface-3)",borderRadius:1,marginLeft:55},children:_.jsx("div",{style:{height:"100%",width:`${n}%`,background:r,borderRadius:1}})})]})}function nQ(){var Z;const[e,t]=j.useState(null),[n,i]=j.useState(Date.now()),r=vr(I=>I.squads),s=Object.fromEntries(r.map(I=>[I.code,I.name]));j.useEffect(()=>{const I=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(I)},[]),j.useEffect(()=>{const I=async()=>{try{const U=await fetch("/api/dashboard/stats",{credentials:"include"});U.ok&&t(await U.json())}catch{}};I();const F=setInterval(I,3e4);return()=>clearInterval(F)},[]);const l=new Date(n),c=l.toLocaleTimeString("pt-BR",{hour12:!1}),f=l.toLocaleDateString("pt-BR",{weekday:"long",day:"numeric",month:"long"}).toUpperCase(),p=e==null?void 0:e.kpis,m=e==null?void 0:e.metrics,g=(p==null?void 0:p.weekChange)??0,x=(()=>{const I=Object.fromEntries(((e==null?void 0:e.rhythm14)??[]).map(F=>[F.day,F.count]));return Array.from({length:14},(F,U)=>{const L=new Date(n);L.setDate(L.getDate()-(13-U));const J=L.toISOString().slice(0,10);return{label:`${L.getDate().toString().padStart(2,"0")}/${(L.getMonth()+1).toString().padStart(2,"0")}`,primary:I[J]??0}})})(),v=(()=>{const I=Object.fromEntries(((e==null?void 0:e.hourlyToday)??[]).map(U=>[U.hour,U.count])),F=Object.fromEntries(((e==null?void 0:e.hourlyLastWeek)??[]).map(U=>[U.hour,Math.round(U.avg_count)]));return Array.from({length:14},(U,L)=>{const J=L+7;return{label:`${J.toString().padStart(2,"0")}h`,primary:I[J]??0,secondary:F[J]??0}})})(),S=x.reduce((I,F)=>I+F.primary,0),A=l.getHours(),T=((Z=((e==null?void 0:e.hourlyToday)??[]).find(I=>I.hour===A))==null?void 0:Z.count)??0,C=(e==null?void 0:e.agentPerf)??[],N=[...C].sort((I,F)=>{const{e:U}=Ff(I.done,I.failed,I.total),{e:L}=Ff(F.done,F.failed,F.total);return L-U}),R=[...C].sort((I,F)=>{const U=I.total>0?I.done/I.total:0;return(F.total>0?F.done/F.total:0)-U}),D=[...C].sort((I,F)=>{const{e:U}=Ff(I.done,I.failed,I.total),{e:L}=Ff(F.done,F.failed,F.total);return L-U}),H={background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:16,overflow:"hidden"},O={display:"flex",alignItems:"center",gap:6,fontFamily:"var(--font-mono)",fontSize:"0.62rem",fontWeight:700,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:14},q=_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.62rem",color:"var(--text-muted)"},children:"Nenhum dado ainda"});return _.jsxs("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-0)"},children:[_.jsxs("div",{style:{padding:"12px 24px",borderBottom:"1px solid var(--border-subtle)",display:"flex",justifyContent:"space-between",alignItems:"flex-start",position:"sticky",top:0,zIndex:10,background:"var(--surface-0)"},children:[_.jsxs("div",{children:[_.jsx("div",{style:{fontFamily:"var(--font-display)",fontSize:"1rem",fontWeight:700,color:"var(--text-bright)"},children:"Painel de Operações"}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:2},children:[_.jsx("span",{style:{fontSize:"0.55rem",fontFamily:"var(--font-mono)",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.1em"},children:"em tempo real"}),_.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[_.jsx("span",{style:{width:6,height:6,borderRadius:"50%",display:"inline-block",background:"#4ade80",boxShadow:"0 0 5px #4ade80",animation:"statusPulse 2s ease-in-out infinite"}}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"#4ade80"},children:"Ao vivo"})]})]})]}),_.jsxs("div",{style:{textAlign:"right"},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"1.5rem",fontWeight:700,color:"var(--text-bright)",lineHeight:1,letterSpacing:"0.04em"},children:c}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)",marginTop:3,letterSpacing:"0.06em"},children:f})]})]}),!e&&_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"calc(100% - 64px)"},children:_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-muted)"},children:"Carregando dados..."})}),e&&_.jsxs("div",{style:{padding:"16px 24px 40px",display:"flex",flexDirection:"column",gap:12},children:[_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:10},children:[_.jsx(ld,{label:"Em Aberto",value:p.open,sub:"Tarefas planejadas",icon:"○"}),_.jsx(ld,{label:"Em Atraso",value:p.delayed,sub:"Tarefas com falha",color:p.delayed>0?"#f44747":void 0,icon:"△"}),_.jsx(ld,{label:"Concluídas Hoje",value:p.doneToday,sub:`Finalizadas em ${l.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}`,color:"#4ade80",icon:"✓"}),_.jsx(ld,{label:"Em Execução",value:p.inReview,sub:"Tarefas em andamento",color:p.inReview>0?"#f59e0b":void 0,icon:"⚡"}),_.jsx(ld,{label:"Executando Agora",value:p.runningNow,sub:"Sessões ativas",color:p.runningNow>0?"#4ade80":void 0,icon:"▶"}),_.jsx(ld,{label:"Horas Rastreadas (7d)",value:`${p.hoursTracked}h`,sub:"Últimos 7 dias",icon:"⏱"}),_.jsx(ld,{label:"Sem. vs Anterior",value:`${g>0?"+":""}${g}%`,sub:"Entregas vs período anterior",color:g>0?"#4ade80":g<0?"#f44747":void 0,icon:g>=0?"↑":"↓"})]}),_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:10},children:[_.jsx(jv,{label:"Regularidade",value:m.regularidade,description:"Taxa de tarefas concluídas em relação ao total de tarefas registradas."}),_.jsx(jv,{label:"Qualidade",value:m.qualidade,description:"Taxa de sucesso entre tarefas finalizadas — concluídas vs. falhas."}),_.jsx(jv,{label:"Eficiência",value:m.eficiencia,description:"Combina regularidade e qualidade para medir o desempenho geral."})]}),_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"55fr 45fr",gap:10},children:[_.jsxs("div",{style:H,children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:14},children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"📈"}),_.jsx("span",{children:"Ritmo de Conclusão"}),_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"últimos 14 dias"})]}),_.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.58rem",color:"var(--text-muted)"},children:["Total: ",S," tarefas"]})]}),_.jsx(EC,{bars:x,height:120})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:14},children:[_.jsxs("div",{children:[_.jsxs("div",{style:{...O,marginBottom:6},children:[_.jsx("span",{children:"⏰"}),_.jsx("span",{children:"Ritmo por Hora"}),_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"hoje vs média semana anterior"})]}),_.jsxs("div",{style:{display:"flex",gap:10,marginBottom:8},children:[_.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"#4ade80"},children:[_.jsx("span",{style:{width:8,height:8,borderRadius:2,background:"#4ade80",display:"inline-block"}}),"Hoje"]}),_.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)"},children:[_.jsx("span",{style:{width:8,height:8,borderRadius:2,background:"rgba(255,255,255,0.12)",display:"inline-block"}}),"Média sem. anterior"]})]})]}),_.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)",textAlign:"right",whiteSpace:"nowrap"},children:[T," nesta hora",_.jsx("br",{}),"Total: ",p.doneToday]})]}),_.jsx(EC,{bars:v,height:100,showSecondary:!0})]})]}),e.runningSessions.length>0&&_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#4ade80",boxShadow:"0 0 6px #4ade80",display:"inline-block",animation:"statusPulse 2s ease-in-out infinite"}}),"Executando Agora — ",e.runningSessions.length," sessão",e.runningSessions.length!==1?"ões":""," ativa",e.runningSessions.length!==1?"s":""]}),_.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:10},children:e.runningSessions.map(I=>{const F=SC(I.squad_code,s),U=[...I.squad_code].reduce((L,J)=>L+J.charCodeAt(0),0)%360;return _.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid rgba(74,222,128,0.15)",borderRadius:6,padding:"10px 12px",display:"flex",alignItems:"center",gap:10},children:[_.jsx("div",{style:{width:34,height:34,borderRadius:"50%",flexShrink:0,background:`hsl(${U},45%,18%)`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:"0.82rem",fontFamily:"var(--font-mono)",color:`hsl(${U},55%,65%)`},children:F.slice(0,1).toUpperCase()}),_.jsxs("div",{style:{flex:1,minWidth:0},children:[_.jsx("div",{style:{fontFamily:"var(--font-display)",fontSize:"0.76rem",fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)",marginTop:2},children:I.squad_code})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,flexShrink:0},children:[_.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#4ade80",display:"inline-block",boxShadow:"0 0 4px #4ade80"}}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.72rem",fontWeight:700,color:"#4ade80"},children:JW(I.started_at,n)})]})]},I.id)})})]}),_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10},children:[_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"👥"})," Performance por Squad"]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.squadPerf.length===0&&q,e.squadPerf.slice(0,6).map((I,F)=>{const U=I.total>0?Math.round(I.done/I.total*100):0,L=SC(I.squad_code,s),J=xm(U);return _.jsxs("div",{children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:4},children:[_.jsxs("div",{style:{display:"flex",gap:5,alignItems:"flex-start",flex:1,minWidth:0},children:[_.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)",paddingTop:1,width:16,flexShrink:0},children:["#",F+1]}),_.jsxs("div",{style:{minWidth:0},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.63rem",fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L}),_.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)",marginTop:1},children:[I.done,"/",I.total," concluídas",I.failed>0&&_.jsxs("span",{style:{color:"#f44747",marginLeft:4},children:[I.failed," falhas"]})]})]})]}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontSize:"0.9rem",fontWeight:800,color:J,flexShrink:0,marginLeft:6},children:U})]}),_.jsx("div",{style:{height:3,background:"var(--surface-3)",borderRadius:2},children:_.jsx("div",{style:{height:"100%",width:`${U}%`,background:J,borderRadius:2}})})]},I.squad_code)})]})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"🏆"})," Top Performers",_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"score combinado"})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[N.length===0&&q,N.slice(0,5).map((I,F)=>{const U=Ff(I.done,I.failed,I.total);return _.jsx(Iv,{rank:F+1,name:I.agent_name,score:U.e,barColor:xm(U.e),sub:`R: ${U.r}% · Q: ${U.q}% · E: ${U.e}%`},I.agent_name)})]})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"⭐"})," Top Regularidade",_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"tarefas entregues"})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[R.length===0&&q,R.slice(0,5).map((I,F)=>{const U=I.total>0?Math.round(I.done/I.total*100):0;return _.jsx(Iv,{rank:F+1,name:I.agent_name,score:U,barColor:xm(U),sub:`${I.done} de ${I.total} concluídas`},I.agent_name)})]})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"📊"})," Top Eficiência",_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"conclusão vs. andamento"})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[D.length===0&&q,D.slice(0,5).map((I,F)=>{const{r:U,q:L,e:J}=Ff(I.done,I.failed,I.total);return _.jsx(Iv,{rank:F+1,name:I.agent_name,score:J,barColor:xm(J),sub:`R: ${U}% · Q: ${L}% · E: ${J}%`},I.agent_name)})]})]})]})]})]})}const iQ=localStorage.getItem("expx-theme")||"dark";document.documentElement.setAttribute("data-theme",iQ);const rQ=j.lazy(()=>ou(()=>import("./JarvisView-D9SzKl_x.js"),[]).then(e=>({default:e.JarvisView})));QO.createRoot(document.getElementById("root")).render(_.jsx(j.StrictMode,{children:_.jsx(_D,{children:_.jsxs(Q3,{children:[_.jsx(ca,{path:"/login",element:_.jsx(d4,{})}),_.jsxs(ca,{path:"/",element:_.jsx(c4,{}),children:[_.jsx(ca,{index:!0,element:_.jsx($3,{to:"/office",replace:!0})}),_.jsx(ca,{path:"office",element:_.jsx(j8,{})}),_.jsx(ca,{path:"chat",element:_.jsx(uG,{})}),_.jsx(ca,{path:"kanban",element:_.jsx(pG,{})}),_.jsx(ca,{path:"settings",element:_.jsx(TG,{})}),_.jsx(ca,{path:"scheduler",element:_.jsx(RG,{})}),_.jsx(ca,{path:"email",element:_.jsx(DG,{})}),_.jsx(ca,{path:"orgchart",element:_.jsx(XW,{})}),_.jsx(ca,{path:"graph",element:_.jsx(QW,{})}),_.jsx(ca,{path:"files",element:_.jsx(ZW,{})}),_.jsx(ca,{path:"dashboard",element:_.jsx(nQ,{})}),_.jsx(ca,{path:"jarvis",element:_.jsx(j.Suspense,{fallback:null,children:_.jsx(rQ,{})})})]})]})})}));export{n6 as $,VA as A,Bm as B,qi as C,is as D,yo as E,lc as F,Na as G,b5 as H,r_ as I,n4 as J,Jm as K,nw as L,Ht as M,y0 as N,n_ as O,Lr as P,GA as Q,Zv as R,S5 as S,Mn as T,M0 as U,Is as V,LA as W,u1 as X,W5 as Y,Z5 as Z,a6 as _,aQ as a,nx as a0,Ad as a1,R4 as a2,Zm as a3,i_ as a4,o6 as a5,Da as a6,uA as a7,js as a8,ex as a9,UE as aa,ch as ab,FB as ac,sz as ad,PE as ae,Cb as af,FE as ag,oz as ah,lh as ai,Ti as aj,hA as ak,dB as al,XA as am,en as an,Qm as ao,xi as ap,d5 as aq,s5 as ar,O5 as as,T5 as at,Q5 as au,J5 as av,s6 as aw,r6 as ax,l6 as ay,gb as b,gl as c,vr as d,Fz as e,ka as f,Nz as g,bi as h,Bn as i,_ as j,g0 as k,kt as l,fA as m,w6 as n,ix as o,m6 as p,rx as q,j as r,VC as s,SA as t,C0 as u,li as v,ma as w,Wf as x,G4 as y,_r as z};
400
+ M${Z.x},${Z.y}h${Z.width}v${Z.height}h${-Z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}$N.displayName="MiniMap";const LW=j.memo($N),jW=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,IW={[bh.Line]:"right",[bh.Handle]:"bottom-right"};function UW({nodeId:e,position:t,variant:n=bh.Handle,className:i,style:r=void 0,children:s,color:l,minWidth:c=10,minHeight:f=10,maxWidth:p=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:x,autoScale:v=!0,shouldResize:S,onResizeStart:A,onResize:T,onResizeEnd:C}){const N=CN(),R=typeof e=="string"?e:N,D=Zn(),H=j.useRef(null),O=n===bh.Handle,q=$t(j.useCallback(jW(O&&v),[O,v]),Qn),Z=j.useRef(null),I=t??IW[n];j.useEffect(()=>{if(!(!H.current||!R))return Z.current||(Z.current=dK({domNode:H.current,nodeId:R,getStoreItems:()=>{const{nodeLookup:U,transform:L,snapGrid:J,snapToGrid:G,nodeOrigin:K,domNode:B}=D.getState();return{nodeLookup:U,transform:L,snapGrid:J,snapToGrid:G,nodeOrigin:K,paneDomNode:B}},onChange:(U,L)=>{const{triggerNodeChanges:J,nodeLookup:G,parentLookup:K,nodeOrigin:B}=D.getState(),V=[],Q={x:U.x,y:U.y},W=G.get(R);if(W&&W.expandParent&&W.parentId){const Y=W.origin??B,$=U.width??W.measured.width??0,ne=U.height??W.measured.height??0,X={id:W.id,parentId:W.parentId,rect:{width:$,height:ne,...Qk({x:U.x??W.position.x,y:U.y??W.position.y},{width:$,height:ne},W.parentId,G,Y)}},ue=Z_([X],G,K,B);V.push(...ue),Q.x=U.x?Math.max(Y[0]*$,U.x):void 0,Q.y=U.y?Math.max(Y[1]*ne,U.y):void 0}if(Q.x!==void 0&&Q.y!==void 0){const Y={id:R,type:"position",position:{...Q}};V.push(Y)}if(U.width!==void 0&&U.height!==void 0){const $={id:R,type:"dimensions",resizing:!0,setAttributes:x?x==="horizontal"?"width":"height":!0,dimensions:{width:U.width,height:U.height}};V.push($)}for(const Y of L){const $={...Y,type:"position"};V.push($)}J(V)},onEnd:({width:U,height:L})=>{const J={id:R,type:"dimensions",resizing:!1,dimensions:{width:U,height:L}};D.getState().triggerNodeChanges([J])}})),Z.current.update({controlPosition:I,boundaries:{minWidth:c,minHeight:f,maxWidth:p,maxHeight:m},keepAspectRatio:g,resizeDirection:x,onResizeStart:A,onResize:T,onResizeEnd:C,shouldResize:S}),()=>{var U;(U=Z.current)==null||U.destroy()}},[I,c,f,p,m,g,A,T,C,S]);const F=I.split("-");return _.jsx("div",{className:zi(["react-flow__resize-control","nodrag",...F,n,i]),ref:H,style:{...r,scale:q,...l&&{[O?"backgroundColor":"borderColor"]:l}},children:s})}j.memo(UW);const G1={background:"rgba(0, 200, 255, 0.4)",width:6,height:6,border:"none"},xC={background:"rgba(0, 230, 138, 0.4)",width:6,height:6,border:"none"},bC={background:"rgba(255, 171, 64, 0.4)",width:6,height:6,border:"none"};function HW({data:e}){return _.jsxs("div",{style:{padding:"16px 32px",border:"2px solid rgba(0, 200, 255, 0.4)",borderRadius:12,background:"var(--surface-2)",boxShadow:"0 0 30px rgba(0, 200, 255, 0.15), 0 4px 16px rgba(0,0,0,0.2)",textAlign:"center",minWidth:200},children:[_.jsx(Sl,{type:"source",position:We.Bottom,style:G1}),_.jsx("div",{style:{width:44,height:44,borderRadius:8,background:"linear-gradient(135deg, var(--accent), var(--accent-dim))",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",fontWeight:700,color:"var(--text-inverse)",margin:"0 auto 8px",boxShadow:"var(--shadow-glow-strong)"},children:e.label.slice(0,2).toUpperCase()}),_.jsx("div",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"1rem",color:"var(--text-primary)"},children:e.label}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",marginTop:3},children:"CEO"})]})}function PW({data:e}){const t=e.agents;return _.jsxs("div",{style:{padding:"14px 20px",border:"1px solid var(--status-active-glow)",borderRadius:10,background:"var(--surface-2)",boxShadow:"0 0 16px rgba(0, 230, 138, 0.08), 0 2px 8px rgba(0,0,0,0.15)",textAlign:"center",minWidth:160},children:[_.jsx(Sl,{type:"target",position:We.Top,style:xC}),_.jsx(Sl,{type:"source",position:We.Bottom,style:xC}),_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,marginBottom:4},children:[_.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:5,background:"rgba(0, 230, 138, 0.15)",border:"1px solid rgba(0, 230, 138, 0.25)",fontSize:"0.6rem",color:"var(--status-active)",fontWeight:700},children:e.label.slice(0,1).toUpperCase()}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontWeight:600,fontSize:"0.82rem",color:"var(--status-active)"},children:e.label})]}),e.description?_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)",marginBottom:4,maxWidth:180},children:String(e.description)}):null,_.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)"},children:[t.length," agent",t.length!==1?"s":""]})]})}function FW({data:e}){return _.jsxs("div",{style:{padding:"8px 16px",border:"1px solid var(--border-subtle)",borderRadius:6,background:"var(--surface-1)",boxShadow:"0 1px 4px rgba(0,0,0,0.15)",textAlign:"center",minWidth:110},children:[_.jsx(Sl,{type:"target",position:We.Top,style:G1}),_.jsx(Sl,{type:"source",position:We.Bottom,style:G1}),_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[_.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--status-active)",boxShadow:"0 0 6px var(--status-active-glow)",flexShrink:0}}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontWeight:500,fontSize:"0.72rem",color:"var(--text-secondary)"},children:e.label})]}),e.stepLabel?_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.5rem",color:"var(--text-muted)",marginTop:3,maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:String(e.stepLabel)}):null]})}function GW({data:e}){return _.jsxs("div",{style:{padding:"5px 12px",border:"1px solid rgba(255, 171, 64, 0.3)",borderRadius:4,background:"var(--surface-2)",textAlign:"center",minWidth:80},children:[_.jsx(Sl,{type:"target",position:We.Top,style:bC}),_.jsx(Sl,{type:"source",position:We.Bottom,style:bC}),_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5},children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--status-warning)"},children:"⏸"}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontWeight:500,fontSize:"0.6rem",color:"var(--status-warning)"},children:e.label})]})]})}const qW={company:HW,squad:PW,agent:FW,checkpoint:GW},vC=300,Lv=60;function YW(e){const{tree:t,squads:n}=e,i=[],r=[];if(n.length===0)return i.push({id:"company",type:"company",position:{x:0,y:0},data:{label:t.name},draggable:!0}),{nodes:i,edges:r};const l=n.length*vC/2-100;return i.push({id:"company",type:"company",position:{x:l,y:0},data:{label:t.name},draggable:!0}),n.forEach((c,f)=>{const p=`squad-${c.code}`,m=f*vC,g=new Map(c.agents.map(S=>[S.id,S]));i.push({id:p,type:"squad",position:{x:m,y:200},data:{label:c.name,description:c.description,agents:c.agents},draggable:!0}),r.push({id:`company-${p}`,source:"company",target:p,style:{stroke:"rgba(0, 230, 138, 0.3)",strokeWidth:2},animated:!1});const x=c.pipeline||[];if(x.length===0){c.agents.forEach((S,A)=>{const T=`agent-${c.code}-${S.id}`;i.push({id:T,type:"agent",position:{x:m+25,y:340+A*Lv},data:{label:S.name},draggable:!0}),r.push({id:`${p}-${T}`,source:p,target:T,style:{stroke:"rgba(100, 120, 200, 0.15)",strokeWidth:1}})});return}let v=p;x.forEach((S,A)=>{const T=S.type==="checkpoint",C=S.agent?g.get(S.agent):null,N=`step-${c.code}-${S.id}`;T?i.push({id:N,type:"checkpoint",position:{x:m+40,y:340+A*Lv},data:{label:S.label},draggable:!0}):i.push({id:N,type:"agent",position:{x:m+25,y:340+A*Lv},data:{label:(C==null?void 0:C.name)||S.agent||S.id,stepLabel:S.label},draggable:!0});const R=T?{stroke:"rgba(255, 171, 64, 0.3)",strokeWidth:1}:{stroke:"rgba(0, 200, 255, 0.25)",strokeWidth:1.5};r.push({id:`chain-${c.code}-${v}-${N}`,source:v,target:N,style:R,markerEnd:T?void 0:{type:Ym.ArrowClosed,color:"rgba(0, 200, 255, 0.35)",width:12,height:12},animated:!T}),v=N})}),{nodes:i,edges:r}}function VW({data:e}){const{fitView:t}=Sx(),{nodes:n,edges:i}=j.useMemo(()=>YW(e),[e]);j.useEffect(()=>{const s=setTimeout(()=>t({padding:.12,duration:400}),50);return()=>clearTimeout(s)},[n.length,t]);const r=e.squads.reduce((s,l)=>s+l.agents.length,0);return _.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",animation:"fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both"},children:[_.jsxs("div",{style:{padding:"16px 20px 12px",flexShrink:0},children:[_.jsxs("h2",{style:{fontFamily:"var(--font-display)",fontWeight:700,fontSize:"1.1rem",color:"var(--text-primary)",marginBottom:2},children:[e.tree.name," — Org Chart"]}),_.jsxs("p",{style:{fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)"},children:[e.squads.length," active squad",e.squads.length!==1?"s":""," / ",r," agents"]})]}),_.jsx("div",{style:{flex:1,minHeight:0},children:_.jsxs(dW,{nodes:n,edges:i,nodeTypes:qW,fitView:!0,fitViewOptions:{padding:.12},minZoom:.1,maxZoom:2,proOptions:{hideAttribution:!0},style:{background:"var(--surface-0)"},nodesDraggable:!0,nodesConnectable:!1,children:[_.jsx(gW,{color:"rgba(100, 120, 200, 0.04)",gap:24,size:1}),_.jsx(EW,{showInteractive:!1,style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8}}),_.jsx(LW,{nodeColor:s=>s.type==="company"?"#007acc":s.type==="squad"?"#00e68a":s.type==="checkpoint"?"#ffab40":"#888",maskColor:"var(--glass-bg)",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8}})]})})]})}function XW(){const[e,t]=j.useState(null),[n,i]=j.useState(!0),[r,s]=j.useState(null);return j.useEffect(()=>{fetch("/api/orgchart",{credentials:"include"}).then(l=>{if(!l.ok)throw new Error(`HTTP ${l.status}`);return l.json()}).then(l=>{t(l),i(!1)}).catch(l=>{s(l.message),i(!1)})},[]),n?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-muted)"},children:"Loading org chart..."}):r||!e?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--status-error)"},children:r||"Failed to load org chart"}):_.jsx(VN,{children:_.jsx(VW,{data:e})})}const WN={squad:"#00c8ff",agent:"#00e68a",memory:"#b388ff",skill:"#ffab40"},q1={squad:18,agent:12,memory:8,skill:8},_C={contains:"rgba(255,255,255,0.08)",pipeline:"rgba(0,200,255,0.4)",delivers:"rgba(0,230,138,0.5)",uses_skill:"rgba(255,171,64,0.15)",has_memory:"rgba(179,136,255,0.15)",shared_skill:"rgba(255,171,64,0.3)",shared_memory:"rgba(179,136,255,0.3)"};function KW(e,t,n,i,r){const s=n/2,l=i/2,c=3e3*r,f=.008*r,p=.01*r,m=.85;for(let x=0;x<e.length;x++){let v=0,S=0;for(let A=0;A<e.length;A++){if(x===A)continue;const T=e[x].x-e[A].x,C=e[x].y-e[A].y,N=T*T+C*C+1,R=c/N,D=Math.sqrt(N);v+=T/D*R,S+=C/D*R}v+=(s-e[x].x)*p,S+=(l-e[x].y)*p,e[x].vx=(e[x].vx+v)*m,e[x].vy=(e[x].vy+S)*m}for(const x of t){const v=e.findIndex(H=>H.id===x.source),S=e.findIndex(H=>H.id===x.target);if(v===-1||S===-1)continue;const A=e[S].x-e[v].x,T=e[S].y-e[v].y,C=Math.sqrt(A*A+T*T)+1,N=(C-100)*f,R=A/C*N,D=T/C*N;e[v].vx+=R,e[v].vy+=D,e[S].vx-=R,e[S].vy-=D}let g=0;for(const x of e)x.x+=x.vx,x.y+=x.vy,g+=x.vx*x.vx+x.vy*x.vy;return g}function $W(e,t){const n=new Map;for(const l of t)n.has(l.source)||n.set(l.source,[]),n.has(l.target)||n.set(l.target,[]),n.get(l.source).push(l.target),n.get(l.target).push(l.source);const i=new Map;i.set(e,0);const r=[e];let s=0;for(;s<r.length;){const l=r[s++],c=i.get(l);for(const f of n.get(l)||[])i.has(f)||(i.set(f,c+1),r.push(f))}return i}function WW(e,t,n,i,r,s,l,c,f){const p=getComputedStyle(document.documentElement).getPropertyValue("--surface-0").trim()||"#1e1e1e";e.fillStyle=p,e.fillRect(0,0,i,r),e.save(),e.translate(l,c),e.scale(f,f);const m=new Map(t.map(v=>[v.id,v]));let g=null;if(s){g=$W(s.id,n);for(const v of g.values());}const x=v=>{if(!s||!g||v===s.id)return 1;const S=g.get(v);return S===void 0?.06:Math.max(.08,1-S*.28)};for(const v of n){const S=m.get(v.source),A=m.get(v.target);if(!S||!A)continue;const T=Math.min(x(v.source),x(v.target)),C=s&&(v.source===s.id||v.target===s.id);if(e.globalAlpha=T,e.beginPath(),e.moveTo(S.x,S.y),e.lineTo(A.x,A.y),e.strokeStyle=C?"rgba(255,255,255,0.6)":_C[v.type]||"rgba(255,255,255,0.06)",e.lineWidth=C?1.8:v.type==="delivers"||v.type==="pipeline"?1.2:.5,e.stroke(),v.type==="delivers"||v.type==="pipeline"){const N=Math.atan2(A.y-S.y,A.x-S.x),R=q1[A.type]||10,D=A.x-Math.cos(N)*(R+4),H=A.y-Math.sin(N)*(R+4);e.beginPath(),e.moveTo(D,H),e.lineTo(D-Math.cos(N-.4)*6,H-Math.sin(N-.4)*6),e.lineTo(D-Math.cos(N+.4)*6,H-Math.sin(N+.4)*6),e.closePath(),e.fillStyle=_C[v.type],e.fill()}}e.globalAlpha=1;for(const v of t){const S=q1[v.type]||10,A=WN[v.type]||"#888",T=(s==null?void 0:s.id)===v.id,C=x(v.id);e.globalAlpha=C,e.beginPath(),e.arc(v.x,v.y,S,0,Math.PI*2),T&&(e.shadowColor=A,e.shadowBlur=24),e.fillStyle=A,e.fill(),e.shadowBlur=0;const N=v.type==="squad"?11:9;e.font=`${v.type==="squad"?"600":"400"} ${N}px "JetBrains Mono", monospace`,e.textAlign="center",e.textBaseline="top";const R=getComputedStyle(document.documentElement).getPropertyValue("--text-primary").trim()||"#fff";e.fillStyle=R,e.fillText(v.label,v.x,v.y+S+4)}e.globalAlpha=1,e.restore()}function QW(){const e=j.useRef(null),[t,n]=j.useState([]),[i,r]=j.useState([]),[s,l]=j.useState(!0),[c,f]=j.useState(null),p=j.useRef(null),m=j.useRef(null),g=j.useRef(null),x=j.useRef(!1),v=j.useRef({x:0,y:0}),S=j.useRef(1),A=j.useRef(!1),T=j.useRef({x:0,y:0}),C=j.useRef([]),N=j.useRef([]),R=j.useRef(0),D=j.useRef(1),H=j.useRef(!0),O=j.useRef(null);j.useEffect(()=>{fetch("/api/graph",{credentials:"include"}).then(I=>I.json()).then(I=>{const F=window.innerWidth,U=window.innerHeight,L=I.nodes.map((J,G)=>({...J,x:F/2+(Math.random()-.5)*400,y:U/2+(Math.random()-.5)*400,vx:0,vy:0}));C.current=L,N.current=I.edges,n(L),r(I.edges),l(!1)}).catch(()=>{f("Failed to load graph data"),l(!1)})},[]);const q=j.useCallback((I,F)=>{const U=v.current,L=S.current,J=(I-U.x)/L,G=(F-U.y)/L;for(let K=C.current.length-1;K>=0;K--){const B=C.current[K],V=q1[B.type]||10,Q=J-B.x,W=G-B.y;if(Q*Q+W*W<(V+4)*(V+4))return B}return null},[]);j.useEffect(()=>{const I=e.current;if(!I)return;const F=K=>{const B=I.getBoundingClientRect(),V=K.clientX-B.left,Q=K.clientY-B.top;if(g.current){x.current=!0;const ne=S.current,X=v.current;g.current.x=(V-X.x)/ne,g.current.y=(Q-X.y)/ne,g.current.vx=0,g.current.vy=0,D.current=.3,H.current=!0;return}if(A.current){v.current.x+=V-T.current.x,v.current.y+=Q-T.current.y,T.current={x:V,y:Q};return}const W=S.current,Y=v.current;O.current={x:(V-Y.x)/W,y:(Q-Y.y)/W};const $=q(V,Q);p.current=$,I.style.cursor=$?"grab":"default"},U=K=>{const B=I.getBoundingClientRect(),V=K.clientX-B.left,Q=K.clientY-B.top;x.current=!1;const W=q(V,Q);W?(g.current=W,I.style.cursor="grabbing"):(A.current=!0,T.current={x:V,y:Q},I.style.cursor="move")},L=K=>{var V;g.current;const B=A.current;if(g.current=null,A.current=!1,I.style.cursor="default",!x.current){const Q=I.getBoundingClientRect(),W=K.clientX-Q.left,Y=K.clientY-Q.top,$=q(W,Y);$?m.current=((V=m.current)==null?void 0:V.id)===$.id?null:$:B||(m.current=null)}},J=K=>{K.preventDefault();const B=I.getBoundingClientRect(),V=K.clientX-B.left,Q=K.clientY-B.top,W=K.deltaY>0?.92:1.08,Y=Math.max(.2,Math.min(5,S.current*W)),$=Y/S.current;v.current.x=V-(V-v.current.x)*$,v.current.y=Q-(Q-v.current.y)*$,S.current=Y},G=()=>{g.current=null,A.current=!1,O.current=null,I.style.cursor="default"};return I.addEventListener("mousemove",F),I.addEventListener("mousedown",U),I.addEventListener("mouseup",L),I.addEventListener("mouseleave",G),I.addEventListener("wheel",J,{passive:!1}),()=>{I.removeEventListener("mousemove",F),I.removeEventListener("mousedown",U),I.removeEventListener("mouseup",L),I.removeEventListener("mouseleave",G),I.removeEventListener("wheel",J)}},[q,s]),j.useEffect(()=>{if(s||C.current.length===0)return;const I=e.current;if(!I)return;const F=()=>{const G=I.parentElement;G&&(I.width=G.clientWidth*window.devicePixelRatio,I.height=G.clientHeight*window.devicePixelRatio,I.style.width=G.clientWidth+"px",I.style.height=G.clientHeight+"px")};F(),window.addEventListener("resize",F);const U=I.getContext("2d");let L=!0;const J=()=>{if(!L)return;const G=I.width/window.devicePixelRatio,K=I.height/window.devicePixelRatio;U.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),H.current&&(KW(C.current,N.current,G,K,D.current),D.current*=.98,D.current<.001&&(H.current=!1,D.current=0));const B=O.current;if(B&&!g.current&&!A.current)for(const W of C.current){const Y=W.x-B.x,$=W.y-B.y,ne=Y*Y+$*$;if(ne<14400&&ne>1){const X=Math.sqrt(ne),ue=.8*(1-X/120);W.x+=Y/X*ue,W.y+=$/X*ue}}WW(U,C.current,N.current,G,K,m.current,v.current.x,v.current.y,S.current),R.current=requestAnimationFrame(J)};return R.current=requestAnimationFrame(J),()=>{L=!1,cancelAnimationFrame(R.current),window.removeEventListener("resize",F)}},[s]);const Z=j.useCallback(I=>{const F=e.current;if(!F)return;const U=I==="in"?1.25:.8,L=F.clientWidth/2,J=F.clientHeight/2,G=Math.max(.2,Math.min(5,S.current*U)),K=G/S.current;v.current.x=L-(L-v.current.x)*K,v.current.y=J-(J-v.current.y)*K,S.current=G},[]);return s?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"0.8rem"},children:"Loading graph..."}):c?_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--status-error)",fontFamily:"var(--font-mono)",fontSize:"0.8rem"},children:c}):_.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",background:"var(--surface-0)"},children:[_.jsx("canvas",{ref:e,style:{display:"block",touchAction:"none"}}),_.jsx("div",{style:{position:"absolute",bottom:16,left:16,background:"rgba(10, 12, 16, 0.85)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",padding:"10px 14px",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",display:"flex",flexDirection:"column",gap:6},children:Object.entries(WN).map(([I,F])=>_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[_.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:F,display:"inline-block"}}),_.jsx("span",{style:{textTransform:"capitalize"},children:I})]},I))}),_.jsxs("div",{style:{position:"absolute",top:16,right:16,background:"rgba(10, 12, 16, 0.85)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",padding:"10px 14px",fontFamily:"var(--font-mono)",fontSize:"0.65rem",color:"var(--text-muted)",display:"flex",gap:16},children:[_.jsxs("span",{children:[t.length," nodes"]}),_.jsxs("span",{children:[i.length," edges"]})]}),_.jsx("div",{style:{position:"absolute",bottom:16,right:16,display:"flex",flexDirection:"column",gap:4},children:[{label:"+",action:"in"},{label:"−",action:"out"}].map(({label:I,action:F})=>_.jsx("button",{onClick:()=>Z(F),style:{width:32,height:32,background:"rgba(10, 12, 16, 0.85)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"1rem",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:I},F))})]})}function ZW(){const[e,t]=j.useState([]),[n,i]=j.useState(null),[r,s]=j.useState(""),[l,c]=j.useState(""),[f,p]=j.useState(!1),[m,g]=j.useState(!1),[x,v]=j.useState(new Set),[S,A]=j.useState(""),T=j.useRef(null);j.useEffect(()=>{fetch("/api/files",{credentials:"include"}).then(O=>O.json()).then(O=>{const q=new Map;for(const I of O)q.has(I.squad)||q.set(I.squad,{squad:I.squad,squadName:I.squadName,files:[]}),q.get(I.squad).files.push(I);const Z=[...q.values()];t(Z)})},[]);const C=j.useCallback(O=>{i(O),g(!0),fetch(`/api/files/${O.squad}/${O.path}`,{credentials:"include"}).then(q=>q.json()).then(q=>{s(q.content),c(q.content),g(!1)}).catch(()=>{s(""),c(""),g(!1)})},[]),N=j.useCallback(async()=>{n&&(p(!0),await fetch(`/api/files/${n.squad}/${n.path}`,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})}),c(r),p(!1))},[n,r]),R=j.useCallback(O=>{v(q=>{const Z=new Set(q);return Z.has(O)?Z.delete(O):Z.add(O),Z})},[]),D=r!==l;j.useEffect(()=>{const O=q=>{(q.metaKey||q.ctrlKey)&&q.key==="s"&&(q.preventDefault(),D&&n&&N())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[D,n,N]);const H=O=>O==="squad.yaml"?"⚙":O==="memories.md"?"◆":"◇";return _.jsxs("div",{style:{display:"flex",height:"100%",overflow:"hidden"},children:[_.jsxs("div",{style:{width:260,minWidth:260,borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[_.jsx("div",{style:{padding:"12px 14px",fontFamily:"var(--font-mono)",fontSize:"0.6rem",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.1em",borderBottom:"1px solid var(--border-subtle)"},children:"Squad Files"}),_.jsx("div",{style:{padding:"8px 10px",borderBottom:"1px solid var(--border-subtle)"},children:_.jsx("input",{type:"text",placeholder:"Search squads...",value:S,onChange:O=>A(O.target.value),style:{width:"100%",padding:"5px 8px",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-xs)",background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:"0.7rem",outline:"none"}})}),_.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"8px 0"},children:[e.filter(O=>{if(!S)return!0;const q=S.toLowerCase();return O.squadName.toLowerCase().includes(q)||O.squad.toLowerCase().includes(q)}).map(O=>_.jsxs("div",{children:[_.jsxs("button",{onClick:()=>R(O.squad),style:{width:"100%",background:"none",border:"none",padding:"6px 14px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.75rem",fontWeight:600,color:"var(--text-primary)",textAlign:"left"},children:[_.jsx("span",{style:{fontSize:"0.6rem",transition:"transform 0.15s ease",transform:x.has(O.squad)?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),O.squadName]}),x.has(O.squad)&&_.jsx("div",{style:{paddingLeft:14},children:O.files.map(q=>{const Z=(n==null?void 0:n.squad)===q.squad&&(n==null?void 0:n.path)===q.path;return _.jsxs("button",{onClick:()=>C(q),style:{width:"100%",background:Z?"var(--accent-glow)":"none",border:Z?"1px solid rgba(0, 200, 255, 0.12)":"1px solid transparent",borderRadius:"var(--radius-xs)",padding:"5px 10px",display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:"0.7rem",color:Z?"var(--accent)":"var(--text-secondary)",textAlign:"left"},children:[_.jsx("span",{style:{opacity:.6},children:H(q.file)}),q.file]},`${q.squad}/${q.path}`)})})]},O.squad)),e.length===0&&_.jsx("div",{style:{padding:"20px 14px",fontFamily:"var(--font-mono)",fontSize:"0.7rem",color:"var(--text-muted)",textAlign:"center"},children:"No squads found"})]})]}),_.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:n?_.jsxs(_.Fragment,{children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[_.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-secondary)",display:"flex",alignItems:"center",gap:8},children:[_.jsx("span",{style:{color:"var(--text-muted)"},children:n.squadName}),_.jsx("span",{style:{color:"var(--text-muted)",opacity:.4},children:"/"}),_.jsx("span",{children:n.file}),D&&_.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",display:"inline-block"}})]}),_.jsxs("button",{onClick:N,disabled:!D||f,style:{background:D?"var(--accent)":"var(--surface-3)",border:"none",borderRadius:"var(--radius-xs)",padding:"4px 14px",fontFamily:"var(--font-mono)",fontSize:"0.7rem",fontWeight:600,color:D?"var(--text-inverse)":"var(--text-muted)",cursor:D?"pointer":"default",opacity:D?1:.5,transition:"all 0.15s ease"},children:[f?"Saving...":"Save",_.jsx("span",{style:{marginLeft:6,fontSize:"0.6rem",opacity:.7},children:"⌘S"})]})]}),m?_.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"0.8rem"},children:"Loading..."}):_.jsx("textarea",{ref:T,value:r,onChange:O=>s(O.target.value),spellCheck:!1,style:{flex:1,width:"100%",padding:"16px 20px",border:"none",outline:"none",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:'"JetBrains Mono", "Fira Code", monospace',fontSize:"0.8rem",lineHeight:1.7,tabSize:2,whiteSpace:"pre",overflowWrap:"normal",overflowX:"auto"}})]}):_.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"var(--text-muted)",fontFamily:"var(--font-mono)"},children:[_.jsx("span",{style:{fontSize:"2rem",opacity:.3},children:"◇"}),_.jsx("span",{style:{fontSize:"0.8rem"},children:"Select a file to edit"})]})})]})}function xm(e){return e>=70?"#4ade80":e>=40?"#f59e0b":"#f44747"}function Ff(e,t,n){const i=n>0?Math.round(e/n*100):0,r=e+t>0?Math.round(e/(e+t)*100):0,s=Math.round((i+r)/2);return{r:i,q:r,e:s}}function JW(e,t){const n=Math.max(0,Math.floor((t-new Date(e).getTime())/1e3)),i=Math.floor(n/3600).toString().padStart(2,"0"),r=Math.floor(n%3600/60).toString().padStart(2,"0"),s=(n%60).toString().padStart(2,"0");return`${i}:${r}:${s}`}function SC(e,t){return t[e]??e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function eQ({name:e,size:t=28}){const n=[...e].reduce((i,r)=>i+r.charCodeAt(0),0)%360;return _.jsx("div",{style:{width:t,height:t,borderRadius:"50%",flexShrink:0,background:`hsl(${n},45%,20%)`,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-mono)",fontWeight:700,fontSize:Math.round(t*.38),color:`hsl(${n},55%,68%)`},children:e.slice(0,1).toUpperCase()})}function tQ({rank:e}){const t=["#FFD700","#C0C0C0","#CD7F32"],n=e<=3?t[e-1]:"var(--text-muted)";return _.jsx("div",{style:{width:20,height:20,borderRadius:"50%",flexShrink:0,background:e<=3?`${n}22`:"transparent",border:`1.5px solid ${n}`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.55rem",fontWeight:700,color:n},children:e})}function ld({label:e,value:t,sub:n,color:i,icon:r}){return _.jsxs("div",{style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"14px 14px 12px",display:"flex",flexDirection:"column",gap:6},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[_.jsx("span",{style:{fontSize:"0.58rem",color:"var(--text-muted)",fontFamily:"var(--font-mono)",textTransform:"uppercase",letterSpacing:"0.08em"},children:e}),r&&_.jsx("span",{style:{fontSize:"0.75rem",opacity:.5},children:r})]}),_.jsx("div",{style:{fontSize:"1.9rem",fontWeight:800,fontFamily:"var(--font-display)",color:i??"var(--text-bright)",lineHeight:1},children:t}),_.jsx("div",{style:{fontSize:"0.58rem",color:"var(--text-muted)",fontFamily:"var(--font-mono)"},children:n})]})}function jv({label:e,value:t,description:n}){const i=xm(t);return _.jsxs("div",{style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:16},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:10},children:[_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.62rem",fontWeight:700,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.08em"},children:e}),_.jsxs("span",{style:{fontFamily:"var(--font-display)",fontSize:"1.15rem",fontWeight:800,color:i},children:[t,"%"]})]}),_.jsx("div",{style:{height:5,background:"var(--surface-3)",borderRadius:3,overflow:"hidden"},children:_.jsx("div",{style:{height:"100%",width:`${t}%`,background:i,borderRadius:3,transition:"width 0.6s ease"}})}),_.jsx("p",{style:{fontSize:"0.58rem",color:"var(--text-muted)",fontFamily:"var(--font-mono)",marginTop:8,lineHeight:1.6},children:n})]})}function EC({bars:e,height:t=100,showSecondary:n=!1}){const i=Math.max(...e.flatMap(s=>[s.primary,s.secondary??0]),1),r=t-16;return _.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:2,height:t},children:e.map((s,l)=>_.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[_.jsxs("div",{style:{display:"flex",gap:1,alignItems:"flex-end",width:"100%",height:r},children:[n&&s.secondary!==void 0&&_.jsx("div",{style:{flex:1,alignSelf:"flex-end",height:Math.max(s.secondary>0?2:0,Math.round(s.secondary/i*r)),background:"rgba(255,255,255,0.1)",borderRadius:"2px 2px 0 0"}}),_.jsx("div",{style:{flex:1,alignSelf:"flex-end",height:Math.max(s.primary>0?2:0,Math.round(s.primary/i*r)),background:"#4ade80",borderRadius:"2px 2px 0 0"}})]}),_.jsx("span",{style:{fontSize:"0.42rem",color:"var(--text-muted)",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},children:s.label})]},l))})}function Iv({rank:e,name:t,score:n,sub:i,barColor:r}){return _.jsxs("div",{children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3},children:[_.jsx(tQ,{rank:e}),_.jsx(eQ,{name:t,size:26}),_.jsxs("div",{style:{flex:1,minWidth:0},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.63rem",fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.48rem",color:"var(--text-muted)"},children:i})]}),_.jsxs("span",{style:{fontFamily:"var(--font-display)",fontSize:"0.82rem",fontWeight:800,color:r,flexShrink:0},children:[n,"%"]})]}),_.jsx("div",{style:{height:2,background:"var(--surface-3)",borderRadius:1,marginLeft:55},children:_.jsx("div",{style:{height:"100%",width:`${n}%`,background:r,borderRadius:1}})})]})}function nQ(){var Z;const[e,t]=j.useState(null),[n,i]=j.useState(Date.now()),r=vr(I=>I.squads),s=Object.fromEntries(r.map(I=>[I.code,I.name]));j.useEffect(()=>{const I=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(I)},[]),j.useEffect(()=>{const I=async()=>{try{const U=await fetch("/api/dashboard/stats",{credentials:"include"});U.ok&&t(await U.json())}catch{}};I();const F=setInterval(I,3e4);return()=>clearInterval(F)},[]);const l=new Date(n),c=l.toLocaleTimeString("pt-BR",{hour12:!1}),f=l.toLocaleDateString("pt-BR",{weekday:"long",day:"numeric",month:"long"}).toUpperCase(),p=e==null?void 0:e.kpis,m=e==null?void 0:e.metrics,g=(p==null?void 0:p.weekChange)??0,x=(()=>{const I=Object.fromEntries(((e==null?void 0:e.rhythm14)??[]).map(F=>[F.day,F.count]));return Array.from({length:14},(F,U)=>{const L=new Date(n);L.setDate(L.getDate()-(13-U));const J=L.toISOString().slice(0,10);return{label:`${L.getDate().toString().padStart(2,"0")}/${(L.getMonth()+1).toString().padStart(2,"0")}`,primary:I[J]??0}})})(),v=(()=>{const I=Object.fromEntries(((e==null?void 0:e.hourlyToday)??[]).map(U=>[U.hour,U.count])),F=Object.fromEntries(((e==null?void 0:e.hourlyLastWeek)??[]).map(U=>[U.hour,Math.round(U.avg_count)]));return Array.from({length:14},(U,L)=>{const J=L+7;return{label:`${J.toString().padStart(2,"0")}h`,primary:I[J]??0,secondary:F[J]??0}})})(),S=x.reduce((I,F)=>I+F.primary,0),A=l.getHours(),T=((Z=((e==null?void 0:e.hourlyToday)??[]).find(I=>I.hour===A))==null?void 0:Z.count)??0,C=(e==null?void 0:e.agentPerf)??[],N=[...C].sort((I,F)=>{const{e:U}=Ff(I.done,I.failed,I.total),{e:L}=Ff(F.done,F.failed,F.total);return L-U}),R=[...C].sort((I,F)=>{const U=I.total>0?I.done/I.total:0;return(F.total>0?F.done/F.total:0)-U}),D=[...C].sort((I,F)=>{const{e:U}=Ff(I.done,I.failed,I.total),{e:L}=Ff(F.done,F.failed,F.total);return L-U}),H={background:"var(--surface-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:16,overflow:"hidden"},O={display:"flex",alignItems:"center",gap:6,fontFamily:"var(--font-mono)",fontSize:"0.62rem",fontWeight:700,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:14},q=_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.62rem",color:"var(--text-muted)"},children:"Nenhum dado ainda"});return _.jsxs("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-0)"},children:[_.jsxs("div",{style:{padding:"12px 24px",borderBottom:"1px solid var(--border-subtle)",display:"flex",justifyContent:"space-between",alignItems:"flex-start",position:"sticky",top:0,zIndex:10,background:"var(--surface-0)"},children:[_.jsxs("div",{children:[_.jsx("div",{style:{fontFamily:"var(--font-display)",fontSize:"1rem",fontWeight:700,color:"var(--text-bright)"},children:"Painel de Operações"}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:2},children:[_.jsx("span",{style:{fontSize:"0.55rem",fontFamily:"var(--font-mono)",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.1em"},children:"em tempo real"}),_.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[_.jsx("span",{style:{width:6,height:6,borderRadius:"50%",display:"inline-block",background:"#4ade80",boxShadow:"0 0 5px #4ade80",animation:"statusPulse 2s ease-in-out infinite"}}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"#4ade80"},children:"Ao vivo"})]})]})]}),_.jsxs("div",{style:{textAlign:"right"},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"1.5rem",fontWeight:700,color:"var(--text-bright)",lineHeight:1,letterSpacing:"0.04em"},children:c}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)",marginTop:3,letterSpacing:"0.06em"},children:f})]})]}),!e&&_.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"calc(100% - 64px)"},children:_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.75rem",color:"var(--text-muted)"},children:"Carregando dados..."})}),e&&_.jsxs("div",{style:{padding:"16px 24px 40px",display:"flex",flexDirection:"column",gap:12},children:[_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:10},children:[_.jsx(ld,{label:"Em Aberto",value:p.open,sub:"Tarefas planejadas",icon:"○"}),_.jsx(ld,{label:"Falhas",value:p.delayed,sub:"Tarefas com erro ou falha",color:p.delayed>0?"#f44747":void 0,icon:"△"}),_.jsx(ld,{label:"Concluídas Hoje",value:p.doneToday,sub:`Finalizadas em ${l.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}`,color:"#4ade80",icon:"✓"}),_.jsx(ld,{label:"Squads Rodando",value:p.activeSquads,sub:"Squads com pipeline ativo",color:p.activeSquads>0?"#f59e0b":void 0,icon:"◈"}),_.jsx(ld,{label:"Pipelines Ativos",value:p.runningNow,sub:"Instâncias Claude em execução",color:p.runningNow>0?"#4ade80":void 0,icon:"▶"}),_.jsx(ld,{label:"Horas Rastreadas (7d)",value:`${p.hoursTracked}h`,sub:"Últimos 7 dias",icon:"⏱"}),_.jsx(ld,{label:"Sem. vs Anterior",value:`${g>0?"+":""}${g}%`,sub:"Entregas vs período anterior",color:g>0?"#4ade80":g<0?"#f44747":void 0,icon:g>=0?"↑":"↓"})]}),_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:10},children:[_.jsx(jv,{label:"Regularidade",value:m.regularidade,description:"Taxa de tarefas concluídas em relação ao total de tarefas registradas."}),_.jsx(jv,{label:"Qualidade",value:m.qualidade,description:"Taxa de sucesso entre tarefas finalizadas — concluídas vs. falhas."}),_.jsx(jv,{label:"Eficiência",value:m.eficiencia,description:"Combina regularidade e qualidade para medir o desempenho geral."})]}),_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"55fr 45fr",gap:10},children:[_.jsxs("div",{style:H,children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:14},children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"📈"}),_.jsx("span",{children:"Ritmo de Conclusão"}),_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"últimos 14 dias"})]}),_.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.58rem",color:"var(--text-muted)"},children:["Total: ",S," tarefas"]})]}),_.jsx(EC,{bars:x,height:120})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:14},children:[_.jsxs("div",{children:[_.jsxs("div",{style:{...O,marginBottom:6},children:[_.jsx("span",{children:"⏰"}),_.jsx("span",{children:"Ritmo por Hora"}),_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"hoje vs média semana anterior"})]}),_.jsxs("div",{style:{display:"flex",gap:10,marginBottom:8},children:[_.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"#4ade80"},children:[_.jsx("span",{style:{width:8,height:8,borderRadius:2,background:"#4ade80",display:"inline-block"}}),"Hoje"]}),_.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)"},children:[_.jsx("span",{style:{width:8,height:8,borderRadius:2,background:"rgba(255,255,255,0.12)",display:"inline-block"}}),"Média sem. anterior"]})]})]}),_.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)",textAlign:"right",whiteSpace:"nowrap"},children:[T," nesta hora",_.jsx("br",{}),"Total: ",p.doneToday]})]}),_.jsx(EC,{bars:v,height:100,showSecondary:!0})]})]}),e.runningSessions.length>0&&_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#4ade80",boxShadow:"0 0 6px #4ade80",display:"inline-block",animation:"statusPulse 2s ease-in-out infinite"}}),"Pipelines Ativos — ",e.runningSessions.length," instância",e.runningSessions.length!==1?"s":""," Claude em execução"]}),_.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:10},children:e.runningSessions.map(I=>{const F=SC(I.squad_code,s),U=[...I.squad_code].reduce((L,J)=>L+J.charCodeAt(0),0)%360;return _.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid rgba(74,222,128,0.15)",borderRadius:6,padding:"10px 12px",display:"flex",alignItems:"center",gap:10},children:[_.jsx("div",{style:{width:34,height:34,borderRadius:"50%",flexShrink:0,background:`hsl(${U},45%,18%)`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:"0.82rem",fontFamily:"var(--font-mono)",color:`hsl(${U},55%,65%)`},children:F.slice(0,1).toUpperCase()}),_.jsxs("div",{style:{flex:1,minWidth:0},children:[_.jsx("div",{style:{fontFamily:"var(--font-display)",fontSize:"0.76rem",fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F}),_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.55rem",color:"var(--text-muted)",marginTop:2},children:I.squad_code})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,flexShrink:0},children:[_.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#4ade80",display:"inline-block",boxShadow:"0 0 4px #4ade80"}}),_.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.72rem",fontWeight:700,color:"#4ade80"},children:JW(I.started_at,n)})]})]},I.id)})})]}),_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10},children:[_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"👥"})," Performance por Squad"]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.squadPerf.length===0&&q,[...e.squadPerf].sort((I,F)=>{const U=I.total>0?I.done/I.total:0;return(F.total>0?F.done/F.total:0)-U}).slice(0,6).map((I,F)=>{const U=I.total>0?Math.round(I.done/I.total*100):0,L=SC(I.squad_code,s),J=xm(U);return _.jsxs("div",{children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:4},children:[_.jsxs("div",{style:{display:"flex",gap:5,alignItems:"flex-start",flex:1,minWidth:0},children:[_.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)",paddingTop:1,width:16,flexShrink:0},children:["#",F+1]}),_.jsxs("div",{style:{minWidth:0},children:[_.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.63rem",fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L}),_.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.52rem",color:"var(--text-muted)",marginTop:1},children:[I.done,"/",I.total," concluídas",I.failed>0&&_.jsxs("span",{style:{color:"#f44747",marginLeft:4},children:[I.failed," falhas"]})]})]})]}),_.jsx("span",{style:{fontFamily:"var(--font-display)",fontSize:"0.9rem",fontWeight:800,color:J,flexShrink:0,marginLeft:6},children:U})]}),_.jsx("div",{style:{height:3,background:"var(--surface-3)",borderRadius:2},children:_.jsx("div",{style:{height:"100%",width:`${U}%`,background:J,borderRadius:2}})})]},I.squad_code)})]})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"🏆"})," Top Performers",_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"score combinado"})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[N.length===0&&q,N.slice(0,5).map((I,F)=>{const U=Ff(I.done,I.failed,I.total);return _.jsx(Iv,{rank:F+1,name:I.agent_name,score:U.e,barColor:xm(U.e),sub:`R: ${U.r}% · Q: ${U.q}% · E: ${U.e}%`},I.agent_name)})]})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"⭐"})," Top Regularidade",_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"tarefas entregues"})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[R.length===0&&q,R.slice(0,5).map((I,F)=>{const U=I.total>0?Math.round(I.done/I.total*100):0;return _.jsx(Iv,{rank:F+1,name:I.agent_name,score:U,barColor:xm(U),sub:`${I.done} de ${I.total} concluídas`},I.agent_name)})]})]}),_.jsxs("div",{style:H,children:[_.jsxs("div",{style:O,children:[_.jsx("span",{children:"📊"})," Top Eficiência",_.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)",fontSize:"0.52rem",textTransform:"none"},children:"conclusão vs. andamento"})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[D.length===0&&q,D.slice(0,5).map((I,F)=>{const{r:U,q:L,e:J}=Ff(I.done,I.failed,I.total);return _.jsx(Iv,{rank:F+1,name:I.agent_name,score:J,barColor:xm(J),sub:`R: ${U}% · Q: ${L}% · E: ${J}%`},I.agent_name)})]})]})]})]})]})}const iQ=localStorage.getItem("expx-theme")||"dark";document.documentElement.setAttribute("data-theme",iQ);const rQ=j.lazy(()=>ou(()=>import("./JarvisView-U98c-iyZ.js"),[]).then(e=>({default:e.JarvisView})));QO.createRoot(document.getElementById("root")).render(_.jsx(j.StrictMode,{children:_.jsx(_D,{children:_.jsxs(Q3,{children:[_.jsx(ca,{path:"/login",element:_.jsx(d4,{})}),_.jsxs(ca,{path:"/",element:_.jsx(c4,{}),children:[_.jsx(ca,{index:!0,element:_.jsx($3,{to:"/office",replace:!0})}),_.jsx(ca,{path:"office",element:_.jsx(j8,{})}),_.jsx(ca,{path:"chat",element:_.jsx(uG,{})}),_.jsx(ca,{path:"kanban",element:_.jsx(pG,{})}),_.jsx(ca,{path:"settings",element:_.jsx(TG,{})}),_.jsx(ca,{path:"scheduler",element:_.jsx(RG,{})}),_.jsx(ca,{path:"email",element:_.jsx(DG,{})}),_.jsx(ca,{path:"orgchart",element:_.jsx(XW,{})}),_.jsx(ca,{path:"graph",element:_.jsx(QW,{})}),_.jsx(ca,{path:"files",element:_.jsx(ZW,{})}),_.jsx(ca,{path:"dashboard",element:_.jsx(nQ,{})}),_.jsx(ca,{path:"jarvis",element:_.jsx(j.Suspense,{fallback:null,children:_.jsx(rQ,{})})})]})]})})}));export{n6 as $,VA as A,Bm as B,qi as C,is as D,yo as E,lc as F,Na as G,b5 as H,r_ as I,n4 as J,Jm as K,nw as L,Ht as M,y0 as N,n_ as O,Lr as P,GA as Q,Zv as R,S5 as S,Mn as T,M0 as U,Is as V,LA as W,u1 as X,W5 as Y,Z5 as Z,a6 as _,aQ as a,nx as a0,Ad as a1,R4 as a2,Zm as a3,i_ as a4,o6 as a5,Da as a6,uA as a7,js as a8,ex as a9,UE as aa,ch as ab,FB as ac,sz as ad,PE as ae,Cb as af,FE as ag,oz as ah,lh as ai,Ti as aj,hA as ak,dB as al,XA as am,en as an,Qm as ao,xi as ap,d5 as aq,s5 as ar,O5 as as,T5 as at,Q5 as au,J5 as av,s6 as aw,r6 as ax,l6 as ay,gb as b,gl as c,vr as d,Fz as e,ka as f,Nz as g,bi as h,Bn as i,_ as j,g0 as k,kt as l,fA as m,w6 as n,ix as o,m6 as p,rx as q,j as r,VC as s,SA as t,C0 as u,li as v,ma as w,Wf as x,G4 as y,_r as z};