@taico/taico 0.2.13 → 0.2.14

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.
Files changed (76) hide show
  1. package/dist/agents/agent-avatar.library.d.ts +15 -0
  2. package/dist/agents/agent-avatar.library.js +128 -0
  3. package/dist/agents/agent-avatar.library.js.map +1 -0
  4. package/dist/agents/agent-template.catalog.js +5 -3
  5. package/dist/agents/agent-template.catalog.js.map +1 -1
  6. package/dist/agents/agents.service.d.ts +1 -0
  7. package/dist/agents/agents.service.js +14 -3
  8. package/dist/agents/agents.service.js.map +1 -1
  9. package/dist/agents/dto/agent-response.dto.js +1 -1
  10. package/dist/agents/dto/agent-response.dto.js.map +1 -1
  11. package/dist/agents/dto/agent-template-catalog-response.dto.d.ts +7 -0
  12. package/dist/agents/dto/agent-template-catalog-response.dto.js +41 -1
  13. package/dist/agents/dto/agent-template-catalog-response.dto.js.map +1 -1
  14. package/dist/agents/dto/create-agent.dto.js +1 -1
  15. package/dist/agents/dto/create-agent.dto.js.map +1 -1
  16. package/dist/agents/dto/patch-agent.dto.js +1 -1
  17. package/dist/agents/dto/patch-agent.dto.js.map +1 -1
  18. package/dist/agents/enums/agent-type.enum.d.ts +0 -1
  19. package/dist/agents/enums/agent-type.enum.js +1 -9
  20. package/dist/agents/enums/agent-type.enum.js.map +1 -1
  21. package/dist/agents/errors/agents.errors.d.ts +3 -0
  22. package/dist/agents/errors/agents.errors.js +7 -1
  23. package/dist/agents/errors/agents.errors.js.map +1 -1
  24. package/dist/app-init/agent/code-reviewer.agent.js +2 -1
  25. package/dist/app-init/agent/code-reviewer.agent.js.map +1 -1
  26. package/dist/app-init/agent/codex-dev.agent.js +2 -1
  27. package/dist/app-init/agent/codex-dev.agent.js.map +1 -1
  28. package/dist/app-init/agent/gemini-assistant.agent.js +2 -1
  29. package/dist/app-init/agent/gemini-assistant.agent.js.map +1 -1
  30. package/dist/app-init/agent/taico.agent.js +2 -1
  31. package/dist/app-init/agent/taico.agent.js.map +1 -1
  32. package/dist/app.module.js +2 -0
  33. package/dist/app.module.js.map +1 -1
  34. package/dist/context/context.mcp.gateway.js +1 -1
  35. package/dist/context/context.mcp.gateway.js.map +1 -1
  36. package/dist/executions/active/active-task-execution.controller.d.ts +1 -0
  37. package/dist/executions/active/active-task-execution.controller.js +26 -0
  38. package/dist/executions/active/active-task-execution.controller.js.map +1 -1
  39. package/dist/executions/active/active-task-execution.service.d.ts +7 -1
  40. package/dist/executions/active/active-task-execution.service.js +26 -2
  41. package/dist/executions/active/active-task-execution.service.js.map +1 -1
  42. package/dist/executions/events/execution-interrupt.event.d.ts +15 -0
  43. package/dist/executions/events/execution-interrupt.event.js +15 -0
  44. package/dist/executions/events/execution-interrupt.event.js.map +1 -0
  45. package/dist/executions/executions-worker.gateway.d.ts +3 -0
  46. package/dist/executions/executions-worker.gateway.js +41 -0
  47. package/dist/executions/executions-worker.gateway.js.map +1 -1
  48. package/dist/executions/history/task-execution-history-error-code.enum.d.ts +1 -0
  49. package/dist/executions/history/task-execution-history-error-code.enum.js +1 -0
  50. package/dist/executions/history/task-execution-history-error-code.enum.js.map +1 -1
  51. package/dist/llm/openai-responses.service.js +1 -1
  52. package/dist/migrations/1742500000000-AllowInterruptedExecutionErrorCode.d.ts +7 -0
  53. package/dist/migrations/1742500000000-AllowInterruptedExecutionErrorCode.js +116 -0
  54. package/dist/migrations/1742500000000-AllowInterruptedExecutionErrorCode.js.map +1 -0
  55. package/dist/public/assets/index-BFiHpO7T.js +73 -0
  56. package/dist/public/assets/{index-Cl8y_6g0.css → index-N2Ursvu5.css} +1 -1
  57. package/dist/public/avatar/angus.png +0 -0
  58. package/dist/public/avatar/bruce.png +0 -0
  59. package/dist/public/avatar/claude.webp +0 -0
  60. package/dist/public/avatar/cockatoo.png +0 -0
  61. package/dist/public/avatar/gemini.png +0 -0
  62. package/dist/public/avatar/grace.png +0 -0
  63. package/dist/public/avatar/gustav.png +0 -0
  64. package/dist/public/avatar/openai.svg +15 -0
  65. package/dist/public/avatar/opencode.svg +1 -0
  66. package/dist/public/avatar/qwen.png +0 -0
  67. package/dist/public/avatar/stacy.png +0 -0
  68. package/dist/public/avatar/taico.png +0 -0
  69. package/dist/public/beta/assets/{index-g8TuopEh.js → index-Bnn4h6Il.js} +1 -1
  70. package/dist/public/beta/index.html +1 -1
  71. package/dist/public/index.html +2 -2
  72. package/dist/threads/backends/openai.backend.js +3 -3
  73. package/dist/threads/backends/openai.backend.js.map +1 -1
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +5 -5
  76. package/dist/public/assets/index-DaHPYsvL.js +0 -73
@@ -57,7 +57,7 @@ Error generating stack: `+i.message+`
57
57
  * @license MIT
58
58
  */var Np="popstate";function wp(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function yE(e={}){function t(i,l){var c;let a=(c=l.state)==null?void 0:c.masked,{pathname:r,search:s,hash:u}=a||i.location;return Ic("",{pathname:r,search:s,hash:u},l.state&&l.state.usr||null,l.state&&l.state.key||"default",a?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,l){return typeof l=="string"?l:lr(l)}return vE(t,n,null,e)}function Ne(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Yt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xE(){return Math.random().toString(36).substring(2,10)}function Ap(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 Ic(e,t,n=null,i,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Wl(t):t,state:n,key:t&&t.key||i||xE(),unstable_mask:l}}function lr({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 Wl(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 vE(e,t,n,i={}){let{window:l=document.defaultView,v5Compat:a=!1}=i,r=l.history,s="POP",u=null,c=d();c==null&&(c=0,r.replaceState({...r.state,idx:c},""));function d(){return(r.state||{idx:null}).idx}function f(){s="POP";let E=d(),g=E==null?null:E-c;c=E,u&&u({action:s,location:x.location,delta:g})}function h(E,g){s="PUSH";let m=wp(E)?E:Ic(x.location,E,g);c=d()+1;let v=Ap(m,c),C=x.createHref(m.unstable_mask||m);try{r.pushState(v,"",C)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;l.location.assign(C)}a&&u&&u({action:s,location:x.location,delta:1})}function p(E,g){s="REPLACE";let m=wp(E)?E:Ic(x.location,E,g);c=d();let v=Ap(m,c),C=x.createHref(m.unstable_mask||m);r.replaceState(v,"",C),a&&u&&u({action:s,location:x.location,delta:0})}function y(E){return bE(E)}let x={get action(){return s},get location(){return e(l,r)},listen(E){if(u)throw new Error("A history only accepts one active listener");return l.addEventListener(Np,f),u=E,()=>{l.removeEventListener(Np,f),u=null}},createHref(E){return t(l,E)},createURL:y,encodeLocation(E){let g=y(E);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:h,replace:p,go(E){return r.go(E)}};return x}function bE(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Ne(n,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:lr(e);return i=i.replace(/ $/,"%20"),!t&&i.startsWith("//")&&(i=n+i),new URL(i,n)}function gv(e,t,n="/"){return SE(e,t,n,!1)}function SE(e,t,n,i){let l=typeof t=="string"?Wl(t):t,a=Hn(l.pathname||"/",n);if(a==null)return null;let r=yv(e);EE(r);let s=null;for(let u=0;s==null&&u<r.length;++u){let c=DE(a);s=RE(r[u],c,i)}return s}function yv(e,t=[],n=[],i="",l=!1){let a=(r,s,u=l,c)=>{let d={relativePath:c===void 0?r.path||"":c,caseSensitive:r.caseSensitive===!0,childrenIndex:s,route:r};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(i)&&u)return;Ne(d.relativePath.startsWith(i),`Absolute route path "${d.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(i.length)}let f=pn([i,d.relativePath]),h=n.concat(d);r.children&&r.children.length>0&&(Ne(r.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),yv(r.children,t,h,f,u)),!(r.path==null&&!r.index)&&t.push({path:f,score:jE(f,r.index),routesMeta:h})};return e.forEach((r,s)=>{var u;if(r.path===""||!((u=r.path)!=null&&u.includes("?")))a(r,s);else for(let c of xv(r.path))a(r,s,!0,c)}),t}function xv(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,l=n.endsWith("?"),a=n.replace(/\?$/,"");if(i.length===0)return l?[a,""]:[a];let r=xv(i.join("/")),s=[];return s.push(...r.map(u=>u===""?a:[a,u].join("/"))),l&&s.push(...r),s.map(u=>e.startsWith("/")&&u===""?"/":u)}function EE(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:_E(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var CE=/^:[\w-]+$/,TE=3,kE=2,NE=1,wE=10,AE=-2,jp=e=>e==="*";function jE(e,t){let n=e.split("/"),i=n.length;return n.some(jp)&&(i+=AE),t&&(i+=kE),n.filter(l=>!jp(l)).reduce((l,a)=>l+(CE.test(a)?TE:a===""?NE:wE),i)}function _E(e,t){return e.length===t.length&&e.slice(0,-1).every((i,l)=>i===t[l])?e[e.length-1]-t[t.length-1]:0}function RE(e,t,n=!1){let{routesMeta:i}=e,l={},a="/",r=[];for(let s=0;s<i.length;++s){let u=i[s],c=s===i.length-1,d=a==="/"?t:t.slice(a.length)||"/",f=Js({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},d),h=u.route;if(!f&&c&&n&&!i[i.length-1].route.index&&(f=Js({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},d)),!f)return null;Object.assign(l,f.params),r.push({params:l,pathname:pn([a,f.pathname]),pathnameBase:BE(pn([a,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(a=pn([a,f.pathnameBase]))}return r}function Js(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=OE(e.path,e.caseSensitive,e.end),l=t.match(n);if(!l)return null;let a=l[0],r=a.replace(/(.)\/+$/,"$1"),s=l.slice(1);return{params:i.reduce((c,{paramName:d,isOptional:f},h)=>{if(d==="*"){let y=s[h]||"";r=a.slice(0,a.length-y.length).replace(/(.)\/+$/,"$1")}const p=s[h];return f&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:r,pattern:e}}function OE(e,t=!1,n=!0){Yt(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=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(r,s,u,c,d)=>{if(i.push({paramName:s,isOptional:u!=null}),u){let f=d.charAt(c+r.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),i]}function DE(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Yt(!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 Hn(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 zE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function LE(e,t="/"){let{pathname:n,search:i="",hash:l=""}=typeof e=="string"?Wl(e):e,a;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?a=_p(n.substring(1),"/"):a=_p(n,t)):a=t,{pathname:a,search:UE(i),hash:IE(l)}}function _p(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function bu(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 ME(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function fd(e){let t=ME(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function Co(e,t,n,i=!1){let l;typeof e=="string"?l=Wl(e):(l={...e},Ne(!l.pathname||!l.pathname.includes("?"),bu("?","pathname","search",l)),Ne(!l.pathname||!l.pathname.includes("#"),bu("#","pathname","hash",l)),Ne(!l.search||!l.search.includes("#"),bu("#","search","hash",l)));let a=e===""||l.pathname==="",r=a?"/":l.pathname,s;if(r==null)s=n;else{let f=t.length-1;if(!i&&r.startsWith("..")){let h=r.split("/");for(;h[0]==="..";)h.shift(),f-=1;l.pathname=h.join("/")}s=f>=0?t[f]:"/"}let u=LE(l,s),c=r&&r!=="/"&&r.endsWith("/"),d=(a||r===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||d)&&(u.pathname+="/"),u}var pn=e=>e.join("/").replace(/\/\/+/g,"/"),BE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),UE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,IE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,HE=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 qE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function FE(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var vv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bv(e,t){let n=e;if(typeof n!="string"||!zE.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,l=!1;if(vv)try{let a=new URL(window.location.href),r=n.startsWith("//")?new URL(a.protocol+n):new URL(n),s=Hn(r.pathname,t);r.origin===a.origin&&s!=null?n=s+r.search+r.hash:l=!0}catch{Yt(!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:l,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Sv=["POST","PUT","PATCH","DELETE"];new Set(Sv);var GE=["GET",...Sv];new Set(GE);var ea=b.createContext(null);ea.displayName="DataRouter";var To=b.createContext(null);To.displayName="DataRouterState";var Ev=b.createContext(!1);function VE(){return b.useContext(Ev)}var Cv=b.createContext({isTransitioning:!1});Cv.displayName="ViewTransition";var YE=b.createContext(new Map);YE.displayName="Fetchers";var PE=b.createContext(null);PE.displayName="Await";var Rt=b.createContext(null);Rt.displayName="Navigation";var Sr=b.createContext(null);Sr.displayName="Location";var Pt=b.createContext({outlet:null,matches:[],isDataRoute:!1});Pt.displayName="Route";var dd=b.createContext(null);dd.displayName="RouteError";var Tv="REACT_ROUTER_ERROR",XE="REDIRECT",QE="ROUTE_ERROR_RESPONSE";function ZE(e){if(e.startsWith(`${Tv}:${XE}:{`))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 KE(e){if(e.startsWith(`${Tv}:${QE}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new HE(t.status,t.statusText,t.data)}catch{}}function $E(e,{relative:t}={}){Ne(ta(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=b.useContext(Rt),{hash:l,pathname:a,search:r}=Er(e,{relative:t}),s=a;return n!=="/"&&(s=a==="/"?n:pn([n,a])),i.createHref({pathname:s,search:r,hash:l})}function ta(){return b.useContext(Sr)!=null}function rt(){return Ne(ta(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Sr).location}var kv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Nv(e){b.useContext(Rt).static||b.useLayoutEffect(e)}function Je(){let{isDataRoute:e}=b.useContext(Pt);return e?dC():JE()}function JE(){Ne(ta(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(ea),{basename:t,navigator:n}=b.useContext(Rt),{matches:i}=b.useContext(Pt),{pathname:l}=rt(),a=JSON.stringify(fd(i)),r=b.useRef(!1);return Nv(()=>{r.current=!0}),b.useCallback((u,c={})=>{if(Yt(r.current,kv),!r.current)return;if(typeof u=="number"){n.go(u);return}let d=Co(u,JSON.parse(a),l,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:pn([t,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[t,n,a,l,e])}var WE=b.createContext(null);function eC(e){let t=b.useContext(Pt).outlet;return b.useMemo(()=>t&&b.createElement(WE.Provider,{value:e},t),[t,e])}function Wi(){let{matches:e}=b.useContext(Pt),t=e[e.length-1];return t?t.params:{}}function Er(e,{relative:t}={}){let{matches:n}=b.useContext(Pt),{pathname:i}=rt(),l=JSON.stringify(fd(n));return b.useMemo(()=>Co(e,JSON.parse(l),i,t==="path"),[e,l,i,t])}function tC(e,t){return wv(e,t)}function wv(e,t,n){var E;Ne(ta(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=b.useContext(Rt),{matches:l}=b.useContext(Pt),a=l[l.length-1],r=a?a.params:{},s=a?a.pathname:"/",u=a?a.pathnameBase:"/",c=a&&a.route;{let g=c&&c.path||"";jv(s,!c||g.endsWith("*")||g.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${g}">) 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.
59
59
 
60
- Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let d=rt(),f;if(t){let g=typeof t=="string"?Wl(t):t;Ne(u==="/"||((E=g.pathname)==null?void 0:E.startsWith(u)),`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 "${u}" but pathname "${g.pathname}" was given in the \`location\` prop.`),f=g}else f=d;let h=f.pathname||"/",p=h;if(u!=="/"){let g=u.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(g.length).join("/")}let y=gv(e,{pathname:p});Yt(c||y!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Yt(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.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 x=rC(y&&y.map(g=>Object.assign({},g,{params:Object.assign({},r,g.params),pathname:pn([u,i.encodeLocation?i.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?u:pn([u,i.encodeLocation?i.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),l,n);return t&&x?b.createElement(Sr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},x):x}function nC(){let e=fC(),t=qE(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)",l={padding:"0.5rem",backgroundColor:i},a={padding:"2px 4px",backgroundColor:i},r=null;return console.error("Error handled by React Router default ErrorBoundary:",e),r=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:a},"ErrorBoundary")," or"," ",b.createElement("code",{style:a},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:l},n):null,r)}var iC=b.createElement(nC,null),Av=class extends b.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=KE(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(Pt.Provider,{value:this.props.routeContext},b.createElement(dd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(lC,{error:e},t):t}};Av.contextType=Ev;var Su=new WeakMap;function lC({children:e,error:t}){let{basename:n}=b.useContext(Rt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=ZE(t.digest);if(i){let l=Su.get(t);if(l)throw l;let a=bv(i.location,n);if(vv&&!Su.get(t))if(a.isExternal||i.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const r=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:i.replace}));throw Su.set(t,r),r}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function aC({routeContext:e,match:t,children:n}){let i=b.useContext(ea);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(Pt.Provider,{value:e},n)}function rC(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 l=e,a=i==null?void 0:i.errors;if(a!=null){let d=l.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);Ne(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),l=l.slice(0,Math.min(l.length,d+1))}let r=!1,s=-1;if(n&&i){r=i.renderFallback;for(let d=0;d<l.length;d++){let f=l[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(s=d),f.route.id){let{loaderData:h,errors:p}=i,y=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||y){n.isStatic&&(r=!0),s>=0?l=l.slice(0,s+1):l=[l[0]];break}}}}let u=n==null?void 0:n.onError,c=i&&u?(d,f)=>{var h,p;u(d,{location:i.location,params:((p=(h=i.matches)==null?void 0:h[0])==null?void 0:p.params)??{},unstable_pattern:FE(i.matches),errorInfo:f})}:void 0;return l.reduceRight((d,f,h)=>{let p,y=!1,x=null,E=null;i&&(p=a&&f.route.id?a[f.route.id]:void 0,x=f.route.errorElement||iC,r&&(s<0&&h===0?(jv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,E=null):s===h&&(y=!0,E=f.route.hydrateFallbackElement||null)));let g=t.concat(l.slice(0,h+1)),m=()=>{let v;return p?v=x:y?v=E:f.route.Component?v=b.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=d,b.createElement(aC,{match:f,routeContext:{outlet:d,matches:g,isDataRoute:i!=null},children:v})};return i&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?b.createElement(Av,{location:i.location,revalidation:i.revalidation,component:x,error:p,children:m(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:c}):m()},null)}function hd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sC(e){let t=b.useContext(ea);return Ne(t,hd(e)),t}function oC(e){let t=b.useContext(To);return Ne(t,hd(e)),t}function uC(e){let t=b.useContext(Pt);return Ne(t,hd(e)),t}function pd(e){let t=uC(e),n=t.matches[t.matches.length-1];return Ne(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function cC(){return pd("useRouteId")}function fC(){var i;let e=b.useContext(dd),t=oC("useRouteError"),n=pd("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[n]}function dC(){let{router:e}=sC("useNavigate"),t=pd("useNavigate"),n=b.useRef(!1);return Nv(()=>{n.current=!0}),b.useCallback(async(l,a={})=>{Yt(n.current,kv),n.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...a}))},[e,t])}var Rp={};function jv(e,t,n){!t&&!Rp[e]&&(Rp[e]=!0,Yt(!1,n))}b.memo(hC);function hC({routes:e,future:t,state:n,isStatic:i,onError:l}){return wv(e,void 0,{state:n,isStatic:i,onError:l})}function pC({to:e,replace:t,state:n,relative:i}){Ne(ta(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=b.useContext(Rt);Yt(!l,"<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:a}=b.useContext(Pt),{pathname:r}=rt(),s=Je(),u=Co(e,fd(a),r,i==="path"),c=JSON.stringify(u);return b.useEffect(()=>{s(JSON.parse(c),{replace:t,state:n,relative:i})},[s,c,i,t,n]),null}function md(e){return eC(e.context)}function qe(e){Ne(!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 mC({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:l,static:a=!1,unstable_useTransitions:r}){Ne(!ta(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:s,navigator:l,static:a,unstable_useTransitions:r,future:{}}),[s,l,a,r]);typeof n=="string"&&(n=Wl(n));let{pathname:c="/",search:d="",hash:f="",state:h=null,key:p="default",unstable_mask:y}=n,x=b.useMemo(()=>{let E=Hn(c,s);return E==null?null:{location:{pathname:E,search:d,hash:f,state:h,key:p,unstable_mask:y},navigationType:i}},[s,c,d,f,h,p,i,y]);return Yt(x!=null,`<Router basename="${s}"> is not able to match the URL "${c}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:b.createElement(Rt.Provider,{value:u},b.createElement(Sr.Provider,{children:t,value:x}))}function gC({children:e,location:t}){return tC(Hc(e),t)}function Hc(e,t=[]){let n=[];return b.Children.forEach(e,(i,l)=>{if(!b.isValidElement(i))return;let a=[...t,l];if(i.type===b.Fragment){n.push.apply(n,Hc(i.props.children,a));return}Ne(i.type===qe,`[${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>`),Ne(!i.props.index||!i.props.children,"An index route cannot have child routes.");let r={id:i.props.id||a.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&&(r.children=Hc(i.props.children,a)),n.push(r)}),n}var ms="get",gs="application/x-www-form-urlencoded";function ko(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function yC(e){return ko(e)&&e.tagName.toLowerCase()==="button"}function xC(e){return ko(e)&&e.tagName.toLowerCase()==="form"}function vC(e){return ko(e)&&e.tagName.toLowerCase()==="input"}function bC(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function SC(e,t){return e.button===0&&(!t||t==="_self")&&!bC(e)}function qc(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let i=e[n];return t.concat(Array.isArray(i)?i.map(l=>[n,l]):[[n,i]])},[]))}function EC(e,t){let n=qc(e);return t&&t.forEach((i,l)=>{n.has(l)||t.getAll(l).forEach(a=>{n.append(l,a)})}),n}var Yr=null;function CC(){if(Yr===null)try{new FormData(document.createElement("form"),0),Yr=!1}catch{Yr=!0}return Yr}var TC=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eu(e){return e!=null&&!TC.has(e)?(Yt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${gs}"`),null):e}function kC(e,t){let n,i,l,a,r;if(xC(e)){let s=e.getAttribute("action");i=s?Hn(s,t):null,n=e.getAttribute("method")||ms,l=Eu(e.getAttribute("enctype"))||gs,a=new FormData(e)}else if(yC(e)||vC(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||s.getAttribute("action");if(i=u?Hn(u,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||ms,l=Eu(e.getAttribute("formenctype"))||Eu(s.getAttribute("enctype"))||gs,a=new FormData(s,e),!CC()){let{name:c,type:d,value:f}=e;if(d==="image"){let h=c?`${c}.`:"";a.append(`${h}x`,"0"),a.append(`${h}y`,"0")}else c&&a.append(c,f)}}else{if(ko(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ms,i=null,l=gs,r=e}return a&&l==="text/plain"&&(r=a,a=void 0),{action:i,method:n.toLowerCase(),encType:l,formData:a,body:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _v(e,t,n,i){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${i}`:l.pathname=`${l.pathname}.${i}`:l.pathname==="/"?l.pathname=`_root.${i}`:t&&Hn(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${i}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${i}`,l}async function NC(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 wC(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 AC(e,t,n){let i=await Promise.all(e.map(async l=>{let a=t.routes[l.route.id];if(a){let r=await NC(a,n);return r.links?r.links():[]}return[]}));return OC(i.flat(1).filter(wC).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function Op(e,t,n,i,l,a){let r=(u,c)=>n[c]?u.route.id!==n[c].route.id:!0,s=(u,c)=>{var d;return n[c].pathname!==u.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==u.params["*"]};return a==="assets"?t.filter((u,c)=>r(u,c)||s(u,c)):a==="data"?t.filter((u,c)=>{var f;let d=i.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(r(u,c)||s(u,c))return!0;if(u.route.shouldRevalidate){let h=u.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function jC(e,t,{includeHydrateFallback:n}={}){return _C(e.map(i=>{let l=t.routes[i.route.id];if(!l)return[];let a=[l.module];return l.clientActionModule&&(a=a.concat(l.clientActionModule)),l.clientLoaderModule&&(a=a.concat(l.clientLoaderModule)),n&&l.hydrateFallbackModule&&(a=a.concat(l.hydrateFallbackModule)),l.imports&&(a=a.concat(l.imports)),a}).flat(1))}function _C(e){return[...new Set(e)]}function RC(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function OC(e,t){let n=new Set;return new Set(t),e.reduce((i,l)=>{let a=JSON.stringify(RC(l));return n.has(a)||(n.add(a),i.push({key:a,link:l})),i},[])}function yd(){let e=b.useContext(ea);return gd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function DC(){let e=b.useContext(To);return gd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var xd=b.createContext(void 0);xd.displayName="FrameworkContext";function vd(){let e=b.useContext(xd);return gd(e,"You must render this element inside a <HydratedRouter> element"),e}function zC(e,t){let n=b.useContext(xd),[i,l]=b.useState(!1),[a,r]=b.useState(!1),{onFocus:s,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=t,h=b.useRef(null);b.useEffect(()=>{if(e==="render"&&r(!0),e==="viewport"){let x=g=>{g.forEach(m=>{r(m.isIntersecting)})},E=new IntersectionObserver(x,{threshold:.5});return h.current&&E.observe(h.current),()=>{E.disconnect()}}},[e]),b.useEffect(()=>{if(i){let x=setTimeout(()=>{r(!0)},100);return()=>{clearTimeout(x)}}},[i]);let p=()=>{l(!0)},y=()=>{l(!1),r(!1)};return n?e!=="intent"?[a,h,{}]:[a,h,{onFocus:pa(s,p),onBlur:pa(u,y),onMouseEnter:pa(c,p),onMouseLeave:pa(d,y),onTouchStart:pa(f,p)}]:[!1,h,{}]}function pa(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function LC({page:e,...t}){let n=VE(),{router:i}=yd(),l=b.useMemo(()=>gv(i.routes,e,i.basename),[i.routes,e,i.basename]);return l?n?b.createElement(BC,{page:e,matches:l,...t}):b.createElement(UC,{page:e,matches:l,...t}):null}function MC(e){let{manifest:t,routeModules:n}=vd(),[i,l]=b.useState([]);return b.useEffect(()=>{let a=!1;return AC(e,t,n).then(r=>{a||l(r)}),()=>{a=!0}},[e,t,n]),i}function BC({page:e,matches:t,...n}){let i=rt(),{future:l}=vd(),{basename:a}=yd(),r=b.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let s=_v(e,a,l.unstable_trailingSlashAwareDataRequests,"rsc"),u=!1,c=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?u=!0:c.push(d.route.id);return u&&c.length>0&&s.searchParams.set("_routes",c.join(",")),[s.pathname+s.search]},[a,l.unstable_trailingSlashAwareDataRequests,e,i,t]);return b.createElement(b.Fragment,null,r.map(s=>b.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...n})))}function UC({page:e,matches:t,...n}){let i=rt(),{future:l,manifest:a,routeModules:r}=vd(),{basename:s}=yd(),{loaderData:u,matches:c}=DC(),d=b.useMemo(()=>Op(e,t,c,a,i,"data"),[e,t,c,a,i]),f=b.useMemo(()=>Op(e,t,c,a,i,"assets"),[e,t,c,a,i]),h=b.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,E=!1;if(t.forEach(m=>{var C;let v=a.routes[m.route.id];!v||!v.hasLoader||(!d.some(A=>A.route.id===m.route.id)&&m.route.id in u&&((C=r[m.route.id])!=null&&C.shouldRevalidate)||v.hasClientLoader?E=!0:x.add(m.route.id))}),x.size===0)return[];let g=_v(e,s,l.unstable_trailingSlashAwareDataRequests,"data");return E&&x.size>0&&g.searchParams.set("_routes",t.filter(m=>x.has(m.route.id)).map(m=>m.route.id).join(",")),[g.pathname+g.search]},[s,l.unstable_trailingSlashAwareDataRequests,u,i,a,d,t,e,r]),p=b.useMemo(()=>jC(f,a),[f,a]),y=MC(f);return b.createElement(b.Fragment,null,h.map(x=>b.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),p.map(x=>b.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),y.map(({key:x,link:E})=>b.createElement("link",{key:x,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function IC(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var HC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{HC&&(window.__reactRouterVersion="7.14.0")}catch{}function qC({basename:e,children:t,unstable_useTransitions:n,window:i}){let l=b.useRef();l.current==null&&(l.current=yE({window:i,v5Compat:!0}));let a=l.current,[r,s]=b.useState({action:a.action,location:a.location}),u=b.useCallback(c=>{n===!1?s(c):b.startTransition(()=>s(c))},[n]);return b.useLayoutEffect(()=>a.listen(u),[a,u]),b.createElement(mC,{basename:e,children:t,location:r.location,navigationType:r.action,navigator:a,unstable_useTransitions:n})}var Rv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pi=b.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:l,reloadDocument:a,replace:r,unstable_mask:s,state:u,target:c,to:d,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:p,...y},x){let{basename:E,navigator:g,unstable_useTransitions:m}=b.useContext(Rt),v=typeof d=="string"&&Rv.test(d),C=bv(d,E);d=C.to;let A=$E(d,{relative:l}),N=rt(),_=null;if(s){let V=Co(s,[],N.unstable_mask?N.unstable_mask.pathname:"/",!0);E!=="/"&&(V.pathname=V.pathname==="/"?E:pn([E,V.pathname])),_=g.createHref(V)}let[U,D,T]=zC(i,y),M=VC(d,{replace:r,unstable_mask:s,state:u,target:c,preventScrollReset:f,relative:l,viewTransition:h,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m});function q(V){t&&t(V),V.defaultPrevented||M(V)}let P=!(C.isExternal||a),F=b.createElement("a",{...y,...T,href:(P?_:void 0)||C.absoluteURL||A,onClick:P?q:t,ref:IC(x,D),target:c,"data-discover":!v&&n==="render"?"true":void 0});return U&&!v?b.createElement(b.Fragment,null,F,b.createElement(LC,{page:A})):F});Pi.displayName="Link";var Fc=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:l=!1,style:a,to:r,viewTransition:s,children:u,...c},d){let f=Er(r,{relative:c.relative}),h=rt(),p=b.useContext(To),{navigator:y,basename:x}=b.useContext(Rt),E=p!=null&&KC(f)&&s===!0,g=y.encodeLocation?y.encodeLocation(f).pathname:f.pathname,m=h.pathname,v=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(m=m.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&x&&(v=Hn(v,x)||v);const C=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let A=m===g||!l&&m.startsWith(g)&&m.charAt(C)==="/",N=v!=null&&(v===g||!l&&v.startsWith(g)&&v.charAt(g.length)==="/"),_={isActive:A,isPending:N,isTransitioning:E},U=A?t:void 0,D;typeof i=="function"?D=i(_):D=[i,A?"active":null,N?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let T=typeof a=="function"?a(_):a;return b.createElement(Pi,{...c,"aria-current":U,className:D,ref:d,style:T,to:r,viewTransition:s},typeof u=="function"?u(_):u)});Fc.displayName="NavLink";var FC=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:l,state:a,method:r=ms,action:s,onSubmit:u,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:h,...p},y)=>{let{unstable_useTransitions:x}=b.useContext(Rt),E=QC(),g=ZC(s,{relative:c}),m=r.toLowerCase()==="get"?"get":"post",v=typeof s=="string"&&Rv.test(s),C=A=>{if(u&&u(A),A.defaultPrevented)return;A.preventDefault();let N=A.nativeEvent.submitter,_=(N==null?void 0:N.getAttribute("formmethod"))||r,U=()=>E(N||A.currentTarget,{fetcherKey:t,method:_,navigate:n,replace:l,state:a,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:h});x&&n!==!1?b.startTransition(()=>U()):U()};return b.createElement("form",{ref:y,method:m,action:g,onSubmit:i?u:C,...p,"data-discover":!v&&e==="render"?"true":void 0})});FC.displayName="Form";function GC(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ov(e){let t=b.useContext(ea);return Ne(t,GC(e)),t}function VC(e,{target:t,replace:n,unstable_mask:i,state:l,preventScrollReset:a,relative:r,viewTransition:s,unstable_defaultShouldRevalidate:u,unstable_useTransitions:c}={}){let d=Je(),f=rt(),h=Er(e,{relative:r});return b.useCallback(p=>{if(SC(p,t)){p.preventDefault();let y=n!==void 0?n:lr(f)===lr(h),x=()=>d(e,{replace:y,unstable_mask:i,state:l,preventScrollReset:a,relative:r,viewTransition:s,unstable_defaultShouldRevalidate:u});c?b.startTransition(()=>x()):x()}},[f,d,h,n,i,l,t,e,a,r,s,u,c])}function YC(e){Yt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=b.useRef(qc(e)),n=b.useRef(!1),i=rt(),l=b.useMemo(()=>EC(i.search,n.current?null:t.current),[i.search]),a=Je(),r=b.useCallback((s,u)=>{const c=qc(typeof s=="function"?s(new URLSearchParams(l)):s);n.current=!0,a("?"+c,u)},[a,l]);return[l,r]}var PC=0,XC=()=>`__${String(++PC)}__`;function QC(){let{router:e}=Ov("useSubmit"),{basename:t}=b.useContext(Rt),n=cC(),i=e.fetch,l=e.navigate;return b.useCallback(async(a,r={})=>{let{action:s,method:u,encType:c,formData:d,body:f}=kC(a,t);if(r.navigate===!1){let h=r.fetcherKey||XC();await i(h,n,r.action||s,{unstable_defaultShouldRevalidate:r.unstable_defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:d,body:f,formMethod:r.method||u,formEncType:r.encType||c,flushSync:r.flushSync})}else await l(r.action||s,{unstable_defaultShouldRevalidate:r.unstable_defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:d,body:f,formMethod:r.method||u,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,l,t,n])}function ZC(e,{relative:t}={}){let{basename:n}=b.useContext(Rt),i=b.useContext(Pt);Ne(i,"useFormAction must be used inside a RouteContext");let[l]=i.matches.slice(-1),a={...Er(e||".",{relative:t})},r=rt();if(e==null){a.search=r.search;let s=new URLSearchParams(a.search),u=s.getAll("index");if(u.some(d=>d==="")){s.delete("index"),u.filter(f=>f).forEach(f=>s.append("index",f));let d=s.toString();a.search=d?`?${d}`:""}}return(!e||e===".")&&l.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:pn([n,a.pathname])),lr(a)}function KC(e,{relative:t}={}){let n=b.useContext(Cv);Ne(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Ov("useViewTransitionState"),l=Er(e,{relative:t});if(!n.isTransitioning)return!1;let a=Hn(n.currentLocation.pathname,i)||n.currentLocation.pathname,r=Hn(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Js(l.pathname,r)!=null||Js(l.pathname,a)!=null}const $C="/beta";class Dp extends Error{constructor(n,i,l){super(l);ll(this,"url");ll(this,"status");ll(this,"statusText");ll(this,"body");ll(this,"request");this.name="ApiError",this.url=i.url,this.status=i.status,this.statusText=i.statusText,this.body=i.body,this.request=n}}class JC extends Error{constructor(t){super(t),this.name="CancelError"}get isCancelled(){return!0}}var on,un,$t,ti,Li,Ol,ni;class WC{constructor(t){Yn(this,on);Yn(this,un);Yn(this,$t);Yn(this,ti);Yn(this,Li);Yn(this,Ol);Yn(this,ni);Qt(this,on,!1),Qt(this,un,!1),Qt(this,$t,!1),Qt(this,ti,[]),Qt(this,Li,new Promise((n,i)=>{Qt(this,Ol,n),Qt(this,ni,i);const l=s=>{fe(this,on)||fe(this,un)||fe(this,$t)||(Qt(this,on,!0),fe(this,Ol)&&fe(this,Ol).call(this,s))},a=s=>{fe(this,on)||fe(this,un)||fe(this,$t)||(Qt(this,un,!0),fe(this,ni)&&fe(this,ni).call(this,s))},r=s=>{fe(this,on)||fe(this,un)||fe(this,$t)||fe(this,ti).push(s)};return Object.defineProperty(r,"isResolved",{get:()=>fe(this,on)}),Object.defineProperty(r,"isRejected",{get:()=>fe(this,un)}),Object.defineProperty(r,"isCancelled",{get:()=>fe(this,$t)}),t(l,a,r)}))}get[Symbol.toStringTag](){return"Cancellable Promise"}then(t,n){return fe(this,Li).then(t,n)}catch(t){return fe(this,Li).catch(t)}finally(t){return fe(this,Li).finally(t)}cancel(){if(!(fe(this,on)||fe(this,un)||fe(this,$t))){if(Qt(this,$t,!0),fe(this,ti).length)try{for(const t of fe(this,ti))t()}catch(t){console.warn("Cancellation threw an error",t);return}fe(this,ti).length=0,fe(this,ni)&&fe(this,ni).call(this,new JC("Request aborted"))}}get isCancelled(){return fe(this,$t)}}on=new WeakMap,un=new WeakMap,$t=new WeakMap,ti=new WeakMap,Li=new WeakMap,Ol=new WeakMap,ni=new WeakMap;const B={BASE:"",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var zp;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatus||(e.taskStatus={})),(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatusBeforeClaim||(e.taskStatusBeforeClaim={}))})(zp||(zp={}));var Lp;(function(e){(function(t){t.HUMAN="human",t.AGENT="agent"})(e.type||(e.type={}))})(Lp||(Lp={}));var Mp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Mp||(Mp={}));var Bp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Bp||(Bp={}));var Up;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Up||(Up={}));var Ip;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})(Ip||(Ip={}));var rn;(function(e){(function(t){t.NOT_STARTED="not_started",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.MCP_AUTH_FLOW_STARTED="mcp_auth_flow_started",t.MCP_AUTH_FLOW_COMPLETED="mcp_auth_flow_completed",t.CONNECTIONS_FLOW_STARTED="connections_flow_started",t.CONNECTIONS_FLOW_COMPLETED="connections_flow_completed",t.AUTHORIZATION_CODE_ISSUED="authorization_code_issued",t.AUTHORIZATION_CODE_EXCHANGED="authorization_code_exchanged"})(e.status||(e.status={}))})(rn||(rn={}));var Hp;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.status||(e.status={}))})(Hp||(Hp={}));var qp;(function(e){(function(t){t.OPENAI="openai",t.ADK="adk"})(e.type||(e.type={}))})(qp||(qp={}));var Fp;(function(e){(function(t){t.NONE="none",t.CLIENT_SECRET_BASIC="client_secret_basic"})(e.token_endpoint_auth_method||(e.token_endpoint_auth_method={}))})(Fp||(Fp={}));var Kn;(function(e){(function(t){t.PENDING="pending",t.AUTHORIZED="authorized",t.FAILED="failed"})(e.status||(e.status={}))})(Kn||(Kn={}));var Gp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Gp||(Gp={}));var Vp;(function(e){(function(t){t.OPENAI="openai",t.ADK="adk"})(e.type||(e.type={}))})(Vp||(Vp={}));var Gc;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})(Gc||(Gc={}));var Yp;(function(e){(function(t){t.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",t.CLIENT_REGISTERED="CLIENT_REGISTERED",t.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",t.USER_CONSENT_OK="USER_CONSENT_OK",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",t.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",t.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(e.status||(e.status={}))})(Yp||(Yp={}));var Pp;(function(e){(function(t){t.TASK="task",t.CONTEXT_BLOCK="context_block",t.AGENT="agent",t.PROJECT="project",t.TAG="tag",t.TOOL="tool"})(e.type||(e.type={}))})(Pp||(Pp={}));var Xp;(function(e){(function(t){t.ACCESS_TOKEN="access_token",t.REFRESH_TOKEN="refresh_token"})(e.token_type_hint||(e.token_type_hint={}))})(Xp||(Xp={}));var Qp;(function(e){(function(t){t.BEARER="Bearer"})(e.token_type||(e.token_type={}))})(Qp||(Qp={}));var Ia;(function(e){(function(t){t.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",t.CLIENT_REGISTERED="CLIENT_REGISTERED",t.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",t.USER_CONSENT_OK="USER_CONSENT_OK",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",t.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",t.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(e.status||(e.status={}))})(Ia||(Ia={}));var Zp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Zp||(Zp={}));var Kp;(function(e){(function(t){t.NONE="none",t.CLIENT_SECRET_BASIC="client_secret_basic"})(e.token_endpoint_auth_method||(e.token_endpoint_auth_method={}))})(Kp||(Kp={}));var $p;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})($p||($p={}));var Jp;(function(e){(function(t){t.SUCCEEDED="SUCCEEDED",t.FAILED="FAILED",t.STALE="STALE",t.CANCELLED="CANCELLED"})(e.status||(e.status={})),(function(t){t.OUT_OF_QUOTA="OUT_OF_QUOTA",t.UNKNOWN="UNKNOWN"})(e.errorCode||(e.errorCode={}))})(Jp||(Jp={}));var Wp;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatus||(e.taskStatus={})),(function(t){t.SUCCEEDED="SUCCEEDED",t.FAILED="FAILED",t.STALE="STALE",t.CANCELLED="CANCELLED"})(e.status||(e.status={})),(function(t){t.OUT_OF_QUOTA="OUT_OF_QUOTA",t.UNKNOWN="UNKNOWN"})(e.errorCode||(e.errorCode={}))})(Wp||(Wp={}));var em;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatus||(e.taskStatus={}))})(em||(em={}));var Vc;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.status||(e.status={}))})(Vc||(Vc={}));var tm;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.status||(e.status={}))})(tm||(tm={}));var nm;(function(e){(function(t){t.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE="urn:ietf:params:oauth:grant-type:token-exchange"})(e.grant_type||(e.grant_type={})),(function(t){t.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN="urn:ietf:params:oauth:token-type:access_token"})(e.subject_token_type||(e.subject_token_type={}))})(nm||(nm={}));var im;(function(e){(function(t){t.AUTHORIZATION_CODE="authorization_code",t.REFRESH_TOKEN="refresh_token"})(e.grant_type||(e.grant_type={}))})(im||(im={}));var lm;(function(e){(function(t){t.BEARER="Bearer"})(e.token_type||(e.token_type={}))})(lm||(lm={}));var am;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})(am||(am={}));var rm;(function(e){(function(t){t.ADMIN="admin",t.STANDARD="standard"})(e.role||(e.role={})),(function(t){t.FULL_PAGE="FULL_PAGE",t.BANNER="BANNER",t.OFF="OFF"})(e.onboardingDisplayMode||(e.onboardingDisplayMode={}))})(rm||(rm={}));var sm;(function(e){(function(t){t.FULL_PAGE="FULL_PAGE",t.BANNER="BANNER",t.OFF="OFF"})(e.onboardingDisplayMode||(e.onboardingDisplayMode={}))})(sm||(sm={}));const bd=e=>e!=null,Cr=e=>typeof e=="string",Cu=e=>Cr(e)&&e!=="",Sd=e=>typeof e=="object"&&typeof e.type=="string"&&typeof e.stream=="function"&&typeof e.arrayBuffer=="function"&&typeof e.constructor=="function"&&typeof e.constructor.name=="string"&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag]),Dv=e=>e instanceof FormData,eT=e=>{try{return btoa(e)}catch{return Buffer.from(e).toString("base64")}},tT=e=>{const t=[],n=(l,a)=>{t.push(`${encodeURIComponent(l)}=${encodeURIComponent(String(a))}`)},i=(l,a)=>{bd(a)&&(Array.isArray(a)?a.forEach(r=>{i(l,r)}):typeof a=="object"?Object.entries(a).forEach(([r,s])=>{i(`${l}[${r}]`,s)}):n(l,a))};return Object.entries(e).forEach(([l,a])=>{i(l,a)}),t.length>0?`?${t.join("&")}`:""},nT=(e,t)=>{const n=e.ENCODE_PATH||encodeURI,i=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,(a,r)=>{var s;return(s=t.path)!=null&&s.hasOwnProperty(r)?n(String(t.path[r])):a}),l=`${e.BASE}${i}`;return t.query?`${l}${tT(t.query)}`:l},iT=e=>{if(e.formData){const t=new FormData,n=(i,l)=>{Cr(l)||Sd(l)?t.append(i,l):t.append(i,JSON.stringify(l))};return Object.entries(e.formData).filter(([i,l])=>bd(l)).forEach(([i,l])=>{Array.isArray(l)?l.forEach(a=>n(i,a)):n(i,l)}),t}},Pr=async(e,t)=>typeof t=="function"?t(e):t,lT=async(e,t)=>{const[n,i,l,a]=await Promise.all([Pr(t,e.TOKEN),Pr(t,e.USERNAME),Pr(t,e.PASSWORD),Pr(t,e.HEADERS)]),r=Object.entries({Accept:"application/json",...a,...t.headers}).filter(([s,u])=>bd(u)).reduce((s,[u,c])=>({...s,[u]:String(c)}),{});if(Cu(n)&&(r.Authorization=`Bearer ${n}`),Cu(i)&&Cu(l)){const s=eT(`${i}:${l}`);r.Authorization=`Basic ${s}`}return t.body!==void 0&&(t.mediaType?r["Content-Type"]=t.mediaType:Sd(t.body)?r["Content-Type"]=t.body.type||"application/octet-stream":Cr(t.body)?r["Content-Type"]="text/plain":Dv(t.body)||(r["Content-Type"]="application/json")),new Headers(r)},aT=e=>{var t;if(e.body!==void 0)return(t=e.mediaType)!=null&&t.includes("/json")?JSON.stringify(e.body):Cr(e.body)||Sd(e.body)||Dv(e.body)?e.body:JSON.stringify(e.body)},rT=async(e,t,n,i,l,a,r)=>{const s=new AbortController,u={headers:a,body:i??l,method:t.method,signal:s.signal};return e.WITH_CREDENTIALS&&(u.credentials=e.CREDENTIALS),r(()=>s.abort()),await fetch(n,u)},sT=(e,t)=>{if(t){const n=e.headers.get(t);if(Cr(n))return n}},oT=async e=>{if(e.status!==204)try{const t=e.headers.get("Content-Type");if(t)return["application/json","application/problem+json"].some(l=>t.toLowerCase().startsWith(l))?await e.json():await e.text()}catch(t){console.error(t)}},uT=(e,t)=>{const i={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...e.errors}[t.status];if(i)throw new Dp(e,t,i);if(!t.ok){const l=t.status??"unknown",a=t.statusText??"unknown",r=(()=>{try{return JSON.stringify(t.body,null,2)}catch{return}})();throw new Dp(e,t,`Generic Error: status: ${l}; status text: ${a}; body: ${r}`)}},I=(e,t)=>new WC(async(n,i,l)=>{try{const a=nT(e,t),r=iT(t),s=aT(t),u=await lT(e,t);if(!l.isCancelled){const c=await rT(e,t,a,s,r,u,l),d=await oT(c),f=sT(c,t.responseHeader),h={url:a,ok:c.ok,status:c.status,statusText:c.statusText,body:f??d};uT(t,h),n(h.body)}}catch(a){i(a)}});class Tu{static agentsControllerCreateAgent(t,n=B){return I(n,{method:"POST",url:"/api/v1/agents",body:t,mediaType:"application/json"})}static agentsControllerListAgents(t,n=1,i=20,l=B){return I(l,{method:"GET",url:"/api/v1/agents",query:{isActive:t,page:n,limit:i}})}static agentsControllerListAgentTemplates(t=B){return I(t,{method:"GET",url:"/api/v1/agents/templates"})}static agentsControllerGetAgentBySlug(t,n=B){return I(n,{method:"GET",url:"/api/v1/agents/{slug}",path:{slug:t}})}static agentsControllerPatchAgent(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/agents/{actorId}",path:{actorId:t},body:n,mediaType:"application/json"})}static agentsControllerDeleteAgent(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/agents/{actorId}",path:{actorId:t}})}static agentToolPermissionsControllerListAgentToolPermissions(t,n=B){return I(n,{method:"GET",url:"/api/v1/agents/{actorId}/tool-permissions",path:{actorId:t}})}static agentToolPermissionsControllerUpsertAgentToolPermission(t,n,i,l=B){return I(l,{method:"PUT",url:"/api/v1/agents/{actorId}/tool-permissions/{serverId}",path:{actorId:t,serverId:n},body:i,mediaType:"application/json"})}static agentToolPermissionsControllerDeleteAgentToolPermission(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/agents/{actorId}/tool-permissions/{serverId}",path:{actorId:t,serverId:n}})}}class cT{static authJourneysControllerGetAuthJourneys(t,n=B){return I(n,{method:"GET",url:"/api/v1/auth-journeys/servers/{serverId}",path:{serverId:t},errors:{404:"Server not found"}})}}class fT{static clientRegistrationControllerRegisterClient(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/clients/register/mcp/{serverId}/{version}",path:{serverId:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid client metadata (missing fields, invalid redirect URIs, unsupported grant types, or PKCE not configured)",409:"A client with this name is already registered"}})}static clientRegistrationControllerGetClient(t,n=B){return I(n,{method:"GET",url:"/api/v1/auth/clients/{clientId}",path:{clientId:t},errors:{404:"Client not found"}})}static clientRegistrationControllerListClients(t=B){return I(t,{method:"GET",url:"/api/v1/auth/clients"})}static authorizationControllerAuthorize(t,n,i,l,a,r,s,u,c,d,f=B){return I(f,{method:"GET",url:"/api/v1/auth/authorize/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:s,version:u},query:{response_type:t,scope:c,client_id:n,code_challenge:i,code_challenge_method:l,redirect_uri:a,state:r,resource:d},errors:{302:"Redirects to consent screen with authorization request ID",400:"Invalid authorization request parameters",404:"MCP server or client not found"}})}static authorizationControllerAuthorizeConsent(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/authorize/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{302:"Redirects to client redirect_uri with authorization code or error",400:"Invalid consent decision or flow state",401:"Authorization flow has already been used",404:"Authorization flow not found"}})}static authorizationControllerGetConsentMetadata(t,n=B){return I(n,{method:"GET",url:"/api/v1/auth/consent/{flowId}",path:{flowId:t},errors:{401:"Authentication required to access consent metadata",404:"Authorization flow not found"}})}static authorizationControllerToken(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/token/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid token request parameters",401:"Invalid authorization code, code_verifier, or expired code"}})}static authorizationControllerIntrospect(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/introspect/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid introspection request parameters"}})}static authorizationControllerTokenExchange(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/token-exchange/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid token exchange request parameters",401:"Invalid or expired MCP JWT",403:"Insufficient scope - requested scope not entitled",404:"Connection not found"}})}static authorizationControllerCallback(t,n,i,l,a,r=B){return I(r,{method:"GET",url:"/api/v1/auth/callback",query:{code:t,state:n,error:i,scope:l,error_description:a},errors:{302:"Redirects to next step in the authorization flow",400:"Invalid callback parameters or state",404:"Connection flow not found for provided state"}})}static authorizationControllerGetScopes(t=B){return I(t,{method:"GET",url:"/api/v1/auth/scopes"})}}class Kt{static contextControllerCreateBlock(t,n=B){return I(n,{method:"POST",url:"/api/v1/context/blocks",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static contextControllerListBlocks(t,n=B){return I(n,{method:"GET",url:"/api/v1/context/blocks",query:{tag:t}})}static contextControllerSearchBlocks(t,n=10,i=.3,l=B){return I(l,{method:"GET",url:"/api/v1/context/blocks/search/query",query:{query:t,limit:n,threshold:i}})}static contextControllerGetBlockTree(t=B){return I(t,{method:"GET",url:"/api/v1/context/blocks/tree"})}static contextControllerExportBlocks(t=B){return I(t,{method:"GET",url:"/api/v1/context/blocks/export"})}static contextControllerImportBlocks(t,n=B){return I(n,{method:"POST",url:"/api/v1/context/blocks/import",formData:t,mediaType:"multipart/form-data",errors:{400:"No archive file uploaded or invalid file type"}})}static contextControllerGetBlock(t,n=B){return I(n,{method:"GET",url:"/api/v1/context/blocks/{id}",path:{id:t}})}static contextControllerUpdateBlock(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/context/blocks/{id}",path:{id:t},body:n,mediaType:"application/json",errors:{400:"No update fields provided"}})}static contextControllerDeleteBlock(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/context/blocks/{id}",path:{id:t}})}static contextControllerAppendToBlock(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/context/blocks/{id}/append",path:{id:t},body:n,mediaType:"application/json"})}static contextControllerReorderBlock(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/context/blocks/{id}/reorder",path:{id:t},body:n,mediaType:"application/json"})}static contextControllerMoveBlock(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/context/blocks/{id}/move",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Circular reference detected or parent not found"}})}static contextControllerAddTagToBlock(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/context/blocks/{id}/tags",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data"}})}static contextControllerRemoveTagFromBlock(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/context/blocks/{id}/tags/{tagId}",path:{id:t,tagId:n}})}static contextControllerHandleMcpGet(t=B){return I(t,{method:"GET",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpPost(t=B){return I(t,{method:"POST",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpPut(t=B){return I(t,{method:"PUT",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpDelete(t=B){return I(t,{method:"DELETE",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpPatch(t=B){return I(t,{method:"PATCH",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpOptions(t=B){return I(t,{method:"OPTIONS",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpHead(t=B){return I(t,{method:"HEAD",url:"/api/v1/context/blocks/mcp"})}}class zv{static metaControllerCreateTag(t,n=B){return I(n,{method:"POST",url:"/api/v1/meta/tags",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static metaControllerGetAllTags(t=B){return I(t,{method:"GET",url:"/api/v1/meta/tags"})}static metaControllerGetTagColors(t=B){return I(t,{method:"GET",url:"/api/v1/meta/tags/colors"})}static metaControllerDeleteTag(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/meta/tags/{tagId}",path:{tagId:t},errors:{404:"Tag not found"}})}}class en{static tasksControllerCreateTask(t,n=B){return I(n,{method:"POST",url:"/api/v1/tasks/tasks",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static tasksControllerListTasks(t,n,i,l=1,a=20,r=B){return I(r,{method:"GET",url:"/api/v1/tasks/tasks",query:{assignee:t,sessionId:n,tag:i,page:l,limit:a}})}static tasksControllerUpdateTask(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerDeleteTask(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/tasks/tasks/{id}",path:{id:t},errors:{404:"Task not found"}})}static tasksControllerGetTask(t,n=B){return I(n,{method:"GET",url:"/api/v1/tasks/tasks/{id}",path:{id:t},errors:{404:"Task not found"}})}static tasksControllerAssignTask(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}/assign",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerAssignTaskToMe(t,n=B){return I(n,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}/assign-to-me",path:{id:t},errors:{404:"Task not found"}})}static tasksControllerSearchTasks(t,n=10,i=.3,l=B){return I(l,{method:"GET",url:"/api/v1/tasks/tasks/search/query",query:{query:t,limit:n,threshold:i}})}static tasksControllerAddComment(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/comments",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerAddArtefact(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/artefacts",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerChangeStatus(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}/status",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid status transition or comment required",404:"Task not found"}})}static tasksControllerAddTagToTask(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/tags",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerRemoveTagFromTask(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/tasks/tasks/{id}/tags/{tagId}",path:{id:t,tagId:n},errors:{404:"Task not found"}})}static tasksControllerCreateInputRequest(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/input-requests",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerAnswerInputRequest(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/tasks/tasks/{id}/input-requests/{inputRequestId}/answer",path:{id:t,inputRequestId:n},body:i,mediaType:"application/json",errors:{400:"Invalid input data",404:"Input request not found"}})}static tasksControllerHandleMcpGet(t=B){return I(t,{method:"GET",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpPost(t=B){return I(t,{method:"POST",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpPut(t=B){return I(t,{method:"PUT",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpDelete(t=B){return I(t,{method:"DELETE",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpPatch(t=B){return I(t,{method:"PATCH",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpOptions(t=B){return I(t,{method:"OPTIONS",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpHead(t=B){return I(t,{method:"HEAD",url:"/api/v1/tasks/tasks/mcp"})}}class ct{static mcpRegistryControllerCreateServer(t,n=B){return I(n,{method:"POST",url:"/api/v1/mcp/servers",body:t,mediaType:"application/json",errors:{409:"Server with providedId already exists"}})}static mcpRegistryControllerListServers(t,n,i=B){return I(i,{method:"GET",url:"/api/v1/mcp/servers",query:{page:t,limit:n}})}static mcpRegistryControllerGetServer(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/servers/{serverId}",path:{serverId:t},errors:{404:"Server not found"}})}static mcpRegistryControllerUpdateServer(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/mcp/servers/{serverId}",path:{serverId:t},body:n,mediaType:"application/json",errors:{404:"Server not found"}})}static mcpRegistryControllerDeleteServer(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/mcp/servers/{serverId}",path:{serverId:t},errors:{404:"Server not found",409:"Server has dependencies"}})}static mcpRegistryControllerCreateScopes(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/mcp/servers/{serverId}/scopes",path:{serverId:t},body:n,mediaType:"application/json",errors:{404:"Server not found",409:"Scope already exists"}})}static mcpRegistryControllerListScopes(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/scopes",path:{serverId:t},errors:{404:"Server not found"}})}static mcpRegistryControllerGetScope(t,n,i=B){return I(i,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/scopes/{scopeId}",path:{serverId:t,scopeId:n},errors:{404:"Scope not found"}})}static mcpRegistryControllerDeleteScope(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/mcp/servers/{serverId}/scopes/{scopeId}",path:{serverId:t,scopeId:n},errors:{404:"Scope not found",409:"Scope has mappings"}})}static mcpRegistryControllerCreateConnection(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/mcp/servers/{serverId}/connections",path:{serverId:t},body:n,mediaType:"application/json",errors:{404:"Server not found",409:"Connection name conflict"}})}static mcpRegistryControllerListConnections(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/connections",path:{serverId:t},errors:{404:"Server not found"}})}static mcpRegistryControllerGetConnection(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/connections/{connectionId}",path:{connectionId:t},errors:{404:"Connection not found"}})}static mcpRegistryControllerUpdateConnection(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/mcp/connections/{connectionId}",path:{connectionId:t},body:n,mediaType:"application/json",errors:{404:"Connection not found",409:"Connection name conflict"}})}static mcpRegistryControllerDeleteConnection(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/mcp/connections/{connectionId}",path:{connectionId:t},errors:{404:"Connection not found",409:"Connection has mappings"}})}static mcpRegistryControllerCreateMapping(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/mcp/servers/{serverId}/mappings",path:{serverId:t},body:n,mediaType:"application/json",errors:{400:"Invalid mapping",404:"Scope or connection not found"}})}static mcpRegistryControllerListMappings(t,n,i=B){return I(i,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/scopes/{scopeId}/mappings",path:{serverId:t,scopeId:n},errors:{404:"Scope not found"}})}static mcpRegistryControllerDeleteMapping(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/mcp/mappings/{mappingId}",path:{mappingId:t},errors:{404:"Mapping not found"}})}}class ma{static webAuthControllerLogin(t,n=B){return I(n,{method:"POST",url:"/api/v1/auth/login",body:t,mediaType:"application/json",errors:{401:"Invalid credentials"}})}static webAuthControllerRefresh(t=B){return I(t,{method:"POST",url:"/api/v1/auth/refresh",errors:{401:"Invalid or expired refresh token"}})}static webAuthControllerLogout(t=B){return I(t,{method:"POST",url:"/api/v1/auth/logout"})}static webAuthControllerMe(t=B){return I(t,{method:"GET",url:"/api/v1/auth/me",errors:{401:"Not authenticated"}})}static webAuthControllerChangePassword(t,n=B){return I(n,{method:"POST",url:"/api/v1/auth/change-password",body:t,mediaType:"application/json",errors:{401:"Not authenticated or current password is incorrect"}})}static webAuthControllerGetOnboardingStatus(t=B){return I(t,{method:"GET",url:"/api/v1/auth/onboarding-status"})}static webAuthControllerOnboard(t,n=B){return I(n,{method:"POST",url:"/api/v1/auth/onboard",body:t,mediaType:"application/json",errors:{409:"Admin users already exist, onboarding not allowed"}})}static webAuthControllerMarkWalkthroughSeen(t=B){return I(t,{method:"POST",url:"/api/v1/auth/mark-walkthrough-seen",errors:{401:"Not authenticated"}})}}const Lv=()=>"",Mv=e=>e,el=Lv();B.BASE=el;B.CREDENTIALS="include";B.BASE=el;const Bv=b.createContext(void 0);function dT({children:e}){const[t,n]=b.useState(null),[i,l]=b.useState(!0);b.useEffect(()=>{ma.webAuthControllerMe().then(c=>{console.log("found me"),n(c)}).catch(()=>{console.log("not me"),n(null)}).finally(()=>{l(!1)})},[]),b.useEffect(()=>{if(!t)return;const c=setInterval(async()=>{try{const d=await ma.webAuthControllerRefresh();n(d.user)}catch(d){console.error("Token refresh failed:",d),n(null)}},480*1e3);return()=>clearInterval(c)},[t]);const u={user:t,isAuthenticated:!!t,isLoading:i,login:async(c,d)=>{const f=await ma.webAuthControllerLogin({email:c,password:d});n(f.user)},logout:async()=>{try{await ma.webAuthControllerLogout()}finally{n(null)}},refreshAuth:async()=>{const c=await ma.webAuthControllerRefresh();n(c.user)}};return o.jsx(Bv.Provider,{value:u,children:e})}function Ed(){const e=b.useContext(Bv);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function hT({children:e}){const{isAuthenticated:t,isLoading:n}=Ed(),i=rt();return n?o.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},children:o.jsx("div",{style:{color:"white",fontSize:"18px",fontWeight:"600"},children:"Loading..."})}):t?o.jsx(o.Fragment,{children:e}):o.jsx(pC,{to:"/login",state:{from:i},replace:!0})}function pT(){var p,y;const[e,t]=b.useState(""),[n,i]=b.useState(""),[l,a]=b.useState(""),[r,s]=b.useState(!1),{login:u}=Ed(),c=Je(),f=((y=(p=rt().state)==null?void 0:p.from)==null?void 0:y.pathname)||"/",h=async x=>{x.preventDefault(),s(!0),a("");try{await u(e,n),c(f,{replace:!0})}catch{a("Invalid email or password")}finally{s(!1)}};return o.jsx("div",{className:"login-page",children:o.jsx("div",{className:"login-container",children:o.jsxs("div",{className:"login-card",children:[o.jsxs("div",{className:"login-header",children:[o.jsx("h1",{className:"login-title",children:"Welcome Back"}),o.jsx("p",{className:"login-subtitle",children:"Sign in to your account"})]}),o.jsxs("form",{onSubmit:h,className:"login-form",children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"email",className:"form-label",children:"Email"}),o.jsx("input",{id:"email",type:"email",value:e,onChange:x=>t(x.target.value),className:"form-input",placeholder:"you@example.com",required:!0,disabled:r,autoComplete:"email"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"password",className:"form-label",children:"Password"}),o.jsx("input",{id:"password",type:"password",value:n,onChange:x=>i(x.target.value),className:"form-input",placeholder:"••••••••",required:!0,disabled:r,autoComplete:"current-password"})]}),l&&o.jsx("div",{className:"login-error",children:l}),o.jsx("button",{type:"submit",className:"login-button",disabled:r,children:r?"Signing in...":"Sign In"})]})]})})})}function mT({collapsed:e}){const t=[{name:"Home",path:"/",icon:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),o.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]})},{name:"Agents",path:"/agents",icon:"🤖"},{name:"Tasks",path:"/tasks",icon:"📋"},{name:"Context",path:"/context",icon:"📚"},{name:"Tools",path:"/mcp-registry",icon:"🔧"}];return o.jsxs("nav",{className:"sidebar-nav-container",children:[o.jsx("div",{className:"sidebar-nav-main",children:t.map(n=>o.jsxs(Fc,{to:n.path,className:({isActive:i})=>`sidebar-nav-link ${i?"active":""} ${e?"collapsed":""}`,end:n.path==="/",children:[o.jsx("div",{className:"sidebar-nav-icon",children:typeof n.icon=="string"?o.jsx("span",{children:n.icon}):n.icon}),o.jsx("span",{className:"nav-link-text",children:n.name})]},n.path))}),o.jsx("div",{className:"sidebar-nav-bottom",children:o.jsxs(Fc,{to:"/logout",className:({isActive:n})=>`sidebar-nav-link ${n?"active":""} ${e?"collapsed":""}`,end:!0,children:[o.jsx("div",{className:"sidebar-nav-icon",children:o.jsx("span",{children:"🔓"})}),o.jsx("span",{className:"nav-link-text",children:"Logout"})]},"213")})]})}const gT=768;function ar(){return window.innerWidth<gT}function yT(){const[e,t]=b.useState(()=>ar());return b.useEffect(()=>{const n=()=>{t(ar())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}const om="app-nav-collapsed";function xT(){const[e,t]=b.useState(()=>{const i=localStorage.getItem(om);return i!==null?i==="true":ar()});b.useEffect(()=>{localStorage.setItem(om,String(e))},[e]);const n=()=>{t(!e)};return o.jsxs("div",{className:"root-layout",children:[o.jsxs("aside",{className:`sidebar-app-nav ${e?"collapsed":""}`,children:[o.jsx("nav",{className:"sidebar-content",children:o.jsx(mT,{collapsed:e})}),o.jsx("button",{className:"sidebar-toggle",onClick:n,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:e?"→":"←"})]}),o.jsx("div",{className:"root-layout-main",children:o.jsx(md,{})})]})}function tl(e){const t=b.useRef(null);b.useEffect(()=>(t.current=document.title,document.title=e,()=>{t.current!==null&&(document.title=t.current)}),[e])}function vT(){tl("taico — Home");const e=[{name:"Tasks",description:"Manage and track your tasks across different stages with our Kanban board.",path:"/tasks",icon:"📋",color:"#3b82f6"},{name:"Context",description:"Create, edit, and organize your knowledge base with our wiki platform.",path:"/context",icon:"📚",color:"#10b981"},{name:"Tools",description:"Manage Model Context Protocol servers, scopes, and OAuth connections.",path:"/mcp-registry",icon:"🔧",color:"#8b5cf6"}];return o.jsx("div",{className:"home-page",children:o.jsxs("div",{className:"home-container",children:[o.jsxs("header",{className:"home-header",children:[o.jsx("h1",{className:"home-title",children:"taico"}),o.jsx("p",{className:"home-subtitle",children:"Your all-in-one platform for task management, knowledge organization, and protocol integration"})]}),o.jsx("div",{className:"apps-grid",children:e.map(t=>o.jsxs(Pi,{to:t.path,className:"app-card",style:{"--app-color":t.color},children:[o.jsx("div",{className:"app-icon",children:t.icon}),o.jsx("h2",{className:"app-name",children:t.name}),o.jsx("p",{className:"app-description",children:t.description}),o.jsx("div",{className:"app-arrow",children:"→"})]},t.path))}),o.jsx("footer",{className:"home-footer",children:o.jsx("p",{children:"Built with React + TypeScript + Vite"})})]})})}const Uv=({tag:e,onRemove:t,small:n=!1})=>{const i=e.color||"#6B7280";return o.jsxs("span",{className:`tag-badge ${n?"tag-badge-small":""}`,style:{backgroundColor:i,color:"#ffffff",padding:n?"1px 4px":"2px 6px",borderRadius:"3px",fontSize:n?"0.65rem":"0.7rem",fontWeight:"500",display:"inline-flex",alignItems:"center",gap:"2px",marginRight:"4px",marginBottom:"4px"},children:[e.name,t&&o.jsx("button",{onClick:l=>{l.stopPropagation(),t()},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:n?"0.75rem":"0.85rem",lineHeight:"1"},"aria-label":`Remove ${e.name} tag`,children:"×"})]})};function bT({task:e,onClick:t}){var l,a;const n=r=>{const s=new Date(r);return(new Date().getTime()-s.getTime())/(1e3*60*60)<24?s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):s.toLocaleDateString("en-US",{month:"short",day:"numeric"})},i=((l=e.comments)==null?void 0:l.length)??0;return o.jsxs("div",{className:"task-card",onClick:t,children:[o.jsx("h3",{className:"task-card-title",children:e.name}),o.jsx("p",{className:"task-card-description",children:e.description}),e.tags&&e.tags.length>0&&o.jsx("div",{style:{marginTop:"8px",marginBottom:"8px"},children:e.tags.map(r=>o.jsx(Uv,{tag:r,small:!0},r.name))}),o.jsx("div",{className:"task-card-divider"}),o.jsxs("div",{className:"task-card-footer",children:[o.jsxs("div",{className:"task-card-assignee",children:[e.assignee?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"assignee-emoji",children:"👤"}),o.jsx("span",{className:"assignee-name",children:((a=e.assigneeActor)==null?void 0:a.displayName)||"unassigned"})]}):o.jsx("span",{className:"unassigned-text",children:"Unassigned"}),i>0?o.jsxs("span",{className:"comment-count","aria-label":`${i} comments`,children:["💬 ",i]}):null]}),o.jsx("div",{className:"task-card-date",children:n(e.updatedAt)})]})]})}B.BASE=el;function Iv(){const[e,t]=b.useState([]),n=b.useCallback((l,a="info")=>{const r=Date.now();t(s=>[...s,{id:r,message:l,type:a}])},[]),i=b.useCallback(l=>{t(a=>a.filter(r=>r.id!==l))},[]);return{toasts:e,showToast:n,removeToast:i}}function Hv({message:e,type:t="info",onClose:n,duration:i=3e3}){return b.useEffect(()=>{const l=setTimeout(n,i);return()=>clearTimeout(l)},[n,i]),o.jsxs("div",{className:`toast toast-${t}`,children:[o.jsx("span",{children:e}),o.jsx("button",{onClick:n,className:"toast-close","aria-label":"Close",children:"×"})]})}const Cd=({value:e,onChange:t,placeholder:n="Type to add tags..."})=>{const[i,l]=b.useState(""),[a,r]=b.useState([]),[s,u]=b.useState(!1),[c,d]=b.useState(-1),[f,h]=b.useState([]),p=b.useRef(null),y=b.useRef(null);b.useEffect(()=>{(async()=>{try{const v=await zv.metaControllerGetAllTags();h(v)}catch(v){console.error("Failed to load tags:",v)}})()},[]),b.useEffect(()=>{const v=setTimeout(()=>{if(i.trim().length>0){const C=i.trim().toLowerCase(),A=f.filter(N=>N.name.toLowerCase().includes(C)&&!e.includes(N.name));r(A),u(!0)}else r([]),u(!1)},150);return()=>clearTimeout(v)},[i,e,f]),b.useEffect(()=>{const m=v=>{y.current&&!y.current.contains(v.target)&&u(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const x=m=>{var C;const v=m.trim();v&&!e.includes(v)&&t([...e,v]),l(""),r([]),u(!1),d(-1),(C=p.current)==null||C.focus()},E=m=>{t(e.filter(v=>v!==m))},g=m=>{m.key==="Tab"&&i.trim()||m.key==="Enter"&&i.trim()?(m.preventDefault(),c>=0&&a[c]?x(a[c].name):x(i)):m.key==="ArrowDown"?(m.preventDefault(),d(v=>v<a.length-1?v+1:v)):m.key==="ArrowUp"?(m.preventDefault(),d(v=>v>0?v-1:-1)):m.key==="Escape"?(u(!1),d(-1)):m.key==="Backspace"&&!i&&e.length>0&&t(e.slice(0,-1))};return o.jsxs("div",{ref:y,style:{position:"relative"},children:[o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",padding:"6px",border:"1px solid #ddd",borderRadius:"4px",minHeight:"38px",cursor:"text"},onClick:()=>{var m;return(m=p.current)==null?void 0:m.focus()},children:[e.map(m=>{const v=f.find(A=>A.name===m),C=(v==null?void 0:v.color)||"#3B82F6";return o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",backgroundColor:C,color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"0.7rem",fontWeight:"500"},children:[m,o.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),E(m)},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:"0.85rem",lineHeight:"1"},children:"×"})]},m)}),o.jsx("input",{ref:p,type:"text",value:i,onChange:m=>l(m.target.value),onKeyDown:g,onFocus:()=>i&&u(!0),placeholder:e.length===0?n:"",style:{flex:"1",minWidth:"120px",border:"none",outline:"none",fontSize:"0.875rem",padding:"2px"}})]}),s&&a.length>0&&o.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3},children:a.map((m,v)=>o.jsxs("div",{onClick:()=>x(m.name),style:{padding:"8px 12px",cursor:"pointer",backgroundColor:v===c?"#EFF6FF":"white",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:()=>d(v),children:[o.jsx("span",{style:{width:"12px",height:"12px",borderRadius:"2px",backgroundColor:m.color||"#6B7280"}}),o.jsx("span",{style:{fontSize:"0.875rem"},children:m.name})]},m.name))}),s&&i&&a.length===0&&o.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",padding:"8px 12px",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3,fontSize:"0.875rem",color:"#6B7280"},children:['Press Tab or Enter to create "',i,'"']})]})};function ST({key:e,defaultValue:t,debounceMs:n=500}){const[i,l]=b.useState(()=>{try{const s=localStorage.getItem(e);if(s)return JSON.parse(s)}catch(s){console.error("Error loading draft from localStorage:",s)}return t}),a=b.useRef(void 0);return b.useEffect(()=>(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{try{localStorage.setItem(e,JSON.stringify(i))}catch(s){console.error("Error saving draft to localStorage:",s)}},n),()=>{a.current&&clearTimeout(a.current)}),[i,e,n]),[i,l,()=>{try{localStorage.removeItem(e),l(t)}catch(s){console.error("Error clearing draft from localStorage:",s)}}]}const ET={name:"",description:"",assignee:"",sessionId:"",tagNames:[],dependsOnIds:[]};function CT({onClose:e}){const{toasts:t,showToast:n,removeToast:i}=Iv(),[l,a,r]=ST({key:"create-task-draft",defaultValue:ET}),[s,u]=b.useState(!1),{name:c,description:d,assignee:f,sessionId:h,tagNames:p,dependsOnIds:y}=l,x=(g,m)=>{a({...l,[g]:m})};b.useEffect(()=>{const g=m=>{m.key==="Escape"&&e()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[e]);const E=async g=>{var m;g.preventDefault(),u(!0);try{await en.tasksControllerCreateTask({name:c,description:d,...f&&{assignee:f},...h&&{sessionId:h},...p.length>0&&{tagNames:p},...y.length>0&&{dependsOnIds:y}}),r(),e()}catch(v){const C=((m=v==null?void 0:v.body)==null?void 0:m.detail)||(v==null?void 0:v.message)||"Failed to create task";n(`Error: ${C}`,"error"),console.error(v)}finally{u(!1)}};return o.jsx("div",{className:"modal-overlay",onClick:e,children:o.jsxs("div",{className:"modal-content",onClick:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:"Create New Task"}),o.jsx("button",{onClick:e,className:"btn-close",children:"×"})]}),o.jsxs("form",{onSubmit:E,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"name",children:"Title *"}),o.jsx("input",{id:"name",type:"text",value:c,onChange:g=>x("name",g.target.value),required:!0,placeholder:"Enter task name"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"description",children:"Description *"}),o.jsx("textarea",{id:"description",value:d,onChange:g=>x("description",g.target.value),required:!0,placeholder:"Enter task description",rows:4})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"assignee",children:"Assigned to"}),o.jsx("input",{id:"assignee",type:"text",value:f,onChange:g=>x("assignee",g.target.value),placeholder:"Agent name or assignee"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"sessionId",children:"Session ID"}),o.jsx("input",{id:"sessionId",type:"text",value:h,onChange:g=>x("sessionId",g.target.value),placeholder:"Agent session ID"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"tags",children:"Tags"}),o.jsx(Cd,{value:p,onChange:g=>x("tagNames",g),placeholder:"Type to add tags..."})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"dependsOn",children:"Depends On (Task IDs)"}),o.jsx("input",{id:"dependsOn",type:"text",value:y.join(", "),onChange:g=>x("dependsOnIds",g.target.value.split(",").map(m=>m.trim()).filter(m=>m)),placeholder:"Enter task IDs separated by commas"})]}),o.jsxs("div",{className:"form-actions",children:[o.jsx("button",{type:"button",onClick:e,className:"btn-secondary",children:"Cancel"}),o.jsx("button",{type:"submit",className:"btn-primary",disabled:s,children:s?"Creating...":"Create Task"})]})]}),t.map(g=>o.jsx(Hv,{message:g.message,type:g.type,onClose:()=>i(g.id)},g.id))]})})}const re=Vc.status;function qv({task:e,onClose:t,onUpdate:n}){var D,T,M,q;const[i,l]=b.useState(e.description),[a,r]=b.useState((D=e.assigneeActor)==null?void 0:D.id),[s,u]=b.useState(e.sessionId||""),[c,d]=b.useState(((T=e.tags)==null?void 0:T.map(P=>P.name))||[]),[f,h]=b.useState(""),[p,y]=b.useState(""),[x,E]=b.useState(!1),[g,m]=b.useState("");b.useEffect(()=>{const P=F=>{F.key==="Escape"&&t()};return document.addEventListener("keydown",P),()=>{document.removeEventListener("keydown",P)}},[t]);const v=async()=>{var P;if(i!==e.description)try{const F=await en.tasksControllerUpdateTask(e.id,{description:i});n(F),m("")}catch(F){console.error("Failed to update task:",F);const V=((P=F==null?void 0:F.body)==null?void 0:P.detail)||(F==null?void 0:F.message)||"Failed to update description";m(V)}},C=async()=>{console.log("NOT IMPLEMENTED - ASSIGNEE STRUCTURE CHANGED")},A=async()=>{var P;if(f.trim())try{await en.tasksControllerAddComment(e.id,{content:f});const F=await en.tasksControllerGetTask(e.id);n(F),h(""),m("")}catch(F){console.error("Failed to add comment:",F);const V=((P=F==null?void 0:F.body)==null?void 0:P.detail)||(F==null?void 0:F.message)||"Failed to add comment";m(V)}},N=async P=>{var F;try{const V={status:P};P===re.DONE&&p.trim()&&(V.comment=p);const j=await en.tasksControllerChangeStatus(e.id,V);n(j),y(""),m("")}catch(V){console.error("Failed to change status:",V);const j=((F=V==null?void 0:V.body)==null?void 0:F.detail)||(V==null?void 0:V.message)||"Failed to change status";m(j)}},_=async()=>{var P;try{await en.tasksControllerDeleteTask(e.id),t()}catch(F){console.error("Failed to delete task:",F);const V=((P=F==null?void 0:F.body)==null?void 0:P.detail)||(F==null?void 0:F.message)||"Failed to delete task";m(V)}},U=async P=>{var F,V;d(P);try{const j=await en.tasksControllerUpdateTask(e.id,{tagNames:P});n(j),m("")}catch(j){console.error("Failed to update tags:",j);const O=((F=j==null?void 0:j.body)==null?void 0:F.detail)||(j==null?void 0:j.message)||"Failed to update tags";m(O),d(((V=e.tags)==null?void 0:V.map(w=>w.name))||[])}};return o.jsx("div",{className:"modal-overlay",onClick:t,children:o.jsxs("div",{className:"modal-content task-detail",onClick:P=>P.stopPropagation(),children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:e.name}),o.jsx("button",{onClick:t,className:"btn-close",children:"×"})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Description"}),o.jsx("textarea",{value:i,onChange:P=>l(P.target.value),onBlur:v,placeholder:"Enter task description...",className:"description-textarea"})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Status"}),g&&o.jsxs("div",{className:"error-message",children:[o.jsx("strong",{children:"Error:"})," ",g]}),o.jsxs("div",{className:"status-buttons",children:[o.jsx("button",{onClick:()=>N(re.NOT_STARTED),className:`status-btn ${e.status===re.NOT_STARTED?"active status-not-started":""}`,children:"Not Started"}),o.jsx("button",{onClick:()=>N(re.IN_PROGRESS),className:`status-btn ${e.status===re.IN_PROGRESS?"active status-in-progress":""}`,children:"In Progress"}),o.jsx("button",{onClick:()=>N(re.FOR_REVIEW),className:`status-btn ${e.status===re.FOR_REVIEW?"active status-for-review":""}`,children:"For Review"}),o.jsx("button",{onClick:()=>N(re.DONE),className:`status-btn ${e.status===re.DONE?"active status-done":""}`,children:"Done"})]})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Assignee & Session"}),o.jsxs("div",{className:"assignee-form",children:[o.jsxs("div",{className:"form-row",children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{children:"Assignee"}),o.jsx("input",{type:"text",value:e.assignee?`@${e.assignee}`:"@",onChange:P=>r(P.target.value),placeholder:"Enter assignee name"})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{children:"Session ID"}),o.jsx("input",{type:"text",value:s,onChange:P=>u(P.target.value),placeholder:"Enter session ID"})]})]}),o.jsx("button",{onClick:C,className:"btn-primary",children:"Update Assignment"})]})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Tags"}),o.jsx(Cd,{value:c,onChange:U,placeholder:"Type to add tags..."})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Task Info"}),o.jsxs("div",{className:"task-info-grid",children:[o.jsxs("div",{className:"info-item",children:[o.jsx("label",{children:"Created By"}),o.jsxs("span",{children:["@",e.createdByActor.slug]})]}),e.dependsOnIds&&e.dependsOnIds.length>0&&o.jsxs("div",{className:"info-item",children:[o.jsx("label",{children:"Depends On"}),o.jsx("div",{className:"dependency-list",children:e.dependsOnIds.map(P=>o.jsx("span",{className:"dependency-id",children:P},P))})]})]})]}),o.jsxs("div",{className:"detail-section",children:[o.jsxs("h3",{children:["Comments (",((M=e.comments)==null?void 0:M.length)||0,")"]}),o.jsx("div",{className:"comments-list",children:(q=e.comments)==null?void 0:q.map(P=>o.jsxs("div",{className:"comment",children:[o.jsx("strong",{children:P.commenterName}),o.jsx("p",{children:P.content}),o.jsx("span",{className:"comment-date",children:new Date(P.createdAt).toLocaleString()})]},P.id))}),o.jsxs("div",{className:"add-comment",children:[o.jsx("textarea",{placeholder:"Add a comment...",value:f,onChange:P=>h(P.target.value),rows:3}),o.jsx("button",{onClick:A,className:"btn-primary",children:"Add Comment"})]})]}),o.jsx("div",{className:"detail-section",children:o.jsxs("div",{className:"task-actions",children:[e.status===re.FOR_REVIEW&&o.jsxs("div",{className:"review-shortcuts",children:[o.jsx("button",{onClick:()=>N(re.DONE),className:"btn-review-done",children:"✓ Done"}),o.jsx("button",{onClick:()=>N(re.IN_PROGRESS),className:"btn-review-needs-work",children:"← Needs work"})]}),x?o.jsxs("div",{className:"delete-confirm",children:[o.jsx("button",{onClick:_,className:"btn-danger",children:"Confirm Delete"}),o.jsx("button",{onClick:()=>E(!1),className:"btn-secondary",children:"Cancel"})]}):o.jsx("button",{onClick:()=>E(!0),className:"btn-danger",children:"Delete Task"})]})})]})})}function rr(){return o.jsx(Pi,{to:"/",className:"home-link",title:"Back to Home",children:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),o.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]})})}const gn=Object.create(null);gn.open="0";gn.close="1";gn.ping="2";gn.pong="3";gn.message="4";gn.upgrade="5";gn.noop="6";const ys=Object.create(null);Object.keys(gn).forEach(e=>{ys[gn[e]]=e});const Yc={type:"error",data:"parser error"},Fv=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Gv=typeof ArrayBuffer=="function",Vv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Td=({type:e,data:t},n,i)=>Fv&&t instanceof Blob?n?i(t):um(t,i):Gv&&(t instanceof ArrayBuffer||Vv(t))?n?i(t):um(new Blob([t]),i):i(gn[e]+(t||"")),um=(e,t)=>{const n=new FileReader;return n.onload=function(){const i=n.result.split(",")[1];t("b"+(i||""))},n.readAsDataURL(e)};function cm(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let ku;function TT(e,t){if(Fv&&e.data instanceof Blob)return e.data.arrayBuffer().then(cm).then(t);if(Gv&&(e.data instanceof ArrayBuffer||Vv(e.data)))return t(cm(e.data));Td(e,!1,n=>{ku||(ku=new TextEncoder),t(ku.encode(n))})}const fm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ta=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<fm.length;e++)Ta[fm.charCodeAt(e)]=e;const kT=e=>{let t=e.length*.75,n=e.length,i,l=0,a,r,s,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),d=new Uint8Array(c);for(i=0;i<n;i+=4)a=Ta[e.charCodeAt(i)],r=Ta[e.charCodeAt(i+1)],s=Ta[e.charCodeAt(i+2)],u=Ta[e.charCodeAt(i+3)],d[l++]=a<<2|r>>4,d[l++]=(r&15)<<4|s>>2,d[l++]=(s&3)<<6|u&63;return c},NT=typeof ArrayBuffer=="function",kd=(e,t)=>{if(typeof e!="string")return{type:"message",data:Yv(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:wT(e.substring(1),t)}:ys[n]?e.length>1?{type:ys[n],data:e.substring(1)}:{type:ys[n]}:Yc},wT=(e,t)=>{if(NT){const n=kT(e);return Yv(n,t)}else return{base64:!0,data:e}},Yv=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Pv="",AT=(e,t)=>{const n=e.length,i=new Array(n);let l=0;e.forEach((a,r)=>{Td(a,!1,s=>{i[r]=s,++l===n&&t(i.join(Pv))})})},jT=(e,t)=>{const n=e.split(Pv),i=[];for(let l=0;l<n.length;l++){const a=kd(n[l],t);if(i.push(a),a.type==="error")break}return i};function _T(){return new TransformStream({transform(e,t){TT(e,n=>{const i=n.length;let l;if(i<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,i);else if(i<65536){l=new Uint8Array(3);const a=new DataView(l.buffer);a.setUint8(0,126),a.setUint16(1,i)}else{l=new Uint8Array(9);const a=new DataView(l.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(i))}e.data&&typeof e.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(n)})}})}let Nu;function Xr(e){return e.reduce((t,n)=>t+n.length,0)}function Qr(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let i=0;for(let l=0;l<t;l++)n[l]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),n}function RT(e,t){Nu||(Nu=new TextDecoder);const n=[];let i=0,l=-1,a=!1;return new TransformStream({transform(r,s){for(n.push(r);;){if(i===0){if(Xr(n)<1)break;const u=Qr(n,1);a=(u[0]&128)===128,l=u[0]&127,l<126?i=3:l===126?i=1:i=2}else if(i===1){if(Xr(n)<2)break;const u=Qr(n,2);l=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),i=3}else if(i===2){if(Xr(n)<8)break;const u=Qr(n,8),c=new DataView(u.buffer,u.byteOffset,u.length),d=c.getUint32(0);if(d>Math.pow(2,21)-1){s.enqueue(Yc);break}l=d*Math.pow(2,32)+c.getUint32(4),i=3}else{if(Xr(n)<l)break;const u=Qr(n,l);s.enqueue(kd(a?u:Nu.decode(u),t)),i=0}if(l===0||l>e){s.enqueue(Yc);break}}}})}const Xv=4;function Ue(e){if(e)return OT(e)}function OT(e){for(var t in Ue.prototype)e[t]=Ue.prototype[t];return e}Ue.prototype.on=Ue.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Ue.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Ue.prototype.off=Ue.prototype.removeListener=Ue.prototype.removeAllListeners=Ue.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var i,l=0;l<n.length;l++)if(i=n[l],i===t||i.fn===t){n.splice(l,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Ue.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){n=n.slice(0);for(var i=0,l=n.length;i<l;++i)n[i].apply(this,t)}return this};Ue.prototype.emitReserved=Ue.prototype.emit;Ue.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Ue.prototype.hasListeners=function(e){return!!this.listeners(e).length};const No=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Bt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),DT="arraybuffer";function Qv(e,...t){return t.reduce((n,i)=>(e.hasOwnProperty(i)&&(n[i]=e[i]),n),{})}const zT=Bt.setTimeout,LT=Bt.clearTimeout;function wo(e,t){t.useNativeTimers?(e.setTimeoutFn=zT.bind(Bt),e.clearTimeoutFn=LT.bind(Bt)):(e.setTimeoutFn=Bt.setTimeout.bind(Bt),e.clearTimeoutFn=Bt.clearTimeout.bind(Bt))}const MT=1.33;function BT(e){return typeof e=="string"?UT(e):Math.ceil((e.byteLength||e.size)*MT)}function UT(e){let t=0,n=0;for(let i=0,l=e.length;i<l;i++)t=e.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}function Zv(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function IT(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function HT(e){let t={},n=e.split("&");for(let i=0,l=n.length;i<l;i++){let a=n[i].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class qT extends Error{constructor(t,n,i){super(t),this.description=n,this.context=i,this.type="TransportError"}}class Nd extends Ue{constructor(t){super(),this.writable=!1,wo(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,i){return super.emitReserved("error",new qT(t,n,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=kd(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=IT(t);return n.length?"?"+n:""}}class FT extends Nd{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||n()})),this.writable||(i++,this.once("drain",function(){--i||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};jT(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,AT(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Zv()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Kv=!1;try{Kv=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const GT=Kv;function VT(){}class YT extends FT{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let i=location.port;i||(i=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,n){const i=this.request({method:"POST",data:t});i.on("success",n),i.on("error",(l,a)=>{this.onError("xhr post error",l,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,i)=>{this.onError("xhr poll error",n,i)}),this.pollXhr=t}}class mn extends Ue{constructor(t,n,i){super(),this.createRequest=t,wo(this,i),this._opts=i,this._method=i.method||"GET",this._uri=n,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const n=Qv(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(n);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&i.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var l;i.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=mn.requestsCount++,mn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=VT,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete mn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}mn.requestsCount=0;mn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",dm);else if(typeof addEventListener=="function"){const e="onpagehide"in Bt?"pagehide":"unload";addEventListener(e,dm,!1)}}function dm(){for(let e in mn.requests)mn.requests.hasOwnProperty(e)&&mn.requests[e].abort()}const PT=(function(){const e=$v({xdomain:!1});return e&&e.responseType!==null})();class XT extends YT{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=PT&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new mn($v,this.uri(),t)}}function $v(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||GT))return new XMLHttpRequest}catch{}if(!t)try{return new Bt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Jv=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class QT extends Nd{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,i=Jv?{}:Qv(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,i)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const i=t[n],l=n===t.length-1;Td(i,this.supportsBinary,a=>{try{this.doWrite(i,a)}catch{}l&&No(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Zv()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const wu=Bt.WebSocket||Bt.MozWebSocket;class ZT extends QT{createSocket(t,n,i){return Jv?new wu(t,n,i):n?new wu(t,n):new wu(t)}doWrite(t,n){this.ws.send(n)}}class KT extends Nd{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=RT(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(n).getReader(),l=_T();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const a=()=>{i.read().then(({done:s,value:u})=>{s||(this.onPacket(u),a())}).catch(s=>{})};a();const r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this._writer.write(r).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const i=t[n],l=n===t.length-1;this._writer.write(i).then(()=>{l&&No(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const $T={websocket:ZT,webtransport:KT,polling:XT},JT=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,WT=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Pc(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),i=e.indexOf("]");n!=-1&&i!=-1&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let l=JT.exec(e||""),a={},r=14;for(;r--;)a[WT[r]]=l[r]||"";return n!=-1&&i!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=ek(a,a.path),a.queryKey=tk(a,a.query),a}function ek(e,t){const n=/\/{2,9}/g,i=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function tk(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,l,a){l&&(n[l]=a)}),n}const Xc=typeof addEventListener=="function"&&typeof removeEventListener=="function",xs=[];Xc&&addEventListener("offline",()=>{xs.forEach(e=>e())},!1);class yi extends Ue{constructor(t,n){if(super(),this.binaryType=DT,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const i=Pc(t);n.hostname=i.host,n.secure=i.protocol==="https"||i.protocol==="wss",n.port=i.port,i.query&&(n.query=i.query)}else n.host&&(n.hostname=Pc(n.host).host);wo(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(i=>{const l=i.prototype.name;this.transports.push(l),this._transportsByName[l]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=HT(this.opts.query)),Xc&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},xs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Xv,n.transport=t,this.id&&(n.sid=this.id);const i=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&yi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",yi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let i=0;i<this.writeBuffer.length;i++){const l=this.writeBuffer[i].data;if(l&&(n+=BT(l)),i>0&&n>this._maxPayload)return this.writeBuffer.slice(0,i);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,No(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,i){return this._sendPacket("message",t,n,i),this}send(t,n,i){return this._sendPacket("message",t,n,i),this}_sendPacket(t,n,i,l){if(typeof n=="function"&&(l=n,n=void 0),typeof i=="function"&&(l=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const a={type:t,data:n,options:i};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},i=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(yi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Xc&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=xs.indexOf(this._offlineEventListener);i!==-1&&xs.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}yi.protocol=Xv;class nk extends yi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),i=!1;yi.priorWebsocketSuccess=!1;const l=()=>{i||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!i)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;yi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function a(){i||(i=!0,d(),n.close(),n=null)}const r=f=>{const h=new Error("probe error: "+f);h.transport=n.name,a(),this.emitReserved("upgradeError",h)};function s(){r("transport closed")}function u(){r("socket closed")}function c(f){n&&f.name!==n.name&&a()}const d=()=>{n.removeListener("open",l),n.removeListener("error",r),n.removeListener("close",s),this.off("close",u),this.off("upgrading",c)};n.once("open",l),n.once("error",r),n.once("close",s),this.once("close",u),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&n.push(t[i]);return n}}let ik=class extends nk{constructor(t,n={}){const i=typeof t=="object"?t:n;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(l=>$T[l]).filter(l=>!!l)),super(t,i)}};function lk(e,t="",n){let i=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),i=Pc(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const a=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+a+":"+i.port+t,i.href=i.protocol+"://"+a+(n&&n.port===i.port?"":":"+i.port),i}const ak=typeof ArrayBuffer=="function",rk=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Wv=Object.prototype.toString,sk=typeof Blob=="function"||typeof Blob<"u"&&Wv.call(Blob)==="[object BlobConstructor]",ok=typeof File=="function"||typeof File<"u"&&Wv.call(File)==="[object FileConstructor]";function wd(e){return ak&&(e instanceof ArrayBuffer||rk(e))||sk&&e instanceof Blob||ok&&e instanceof File}function vs(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,i=e.length;n<i;n++)if(vs(e[n]))return!0;return!1}if(wd(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return vs(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&vs(e[n]))return!0;return!1}function uk(e){const t=[],n=e.data,i=e;return i.data=Qc(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Qc(e,t){if(!e)return e;if(wd(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=Qc(e[i],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Qc(e[i],t));return n}return e}function ck(e,t){return e.data=Zc(e.data,t),delete e.attachments,e}function Zc(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Zc(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Zc(e[n],t));return e}const fk=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ae;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ae||(ae={}));class dk{constructor(t){this.replacer=t}encode(t){return(t.type===ae.EVENT||t.type===ae.ACK)&&vs(t)?this.encodeAsBinary({type:t.type===ae.EVENT?ae.BINARY_EVENT:ae.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ae.BINARY_EVENT||t.type===ae.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=uk(t),i=this.encodeAsString(n.packet),l=n.buffers;return l.unshift(i),l}}class Ad extends Ue{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const i=n.type===ae.BINARY_EVENT;i||n.type===ae.BINARY_ACK?(n.type=i?ae.EVENT:ae.ACK,this.reconstructor=new hk(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(wd(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const i={type:Number(t.charAt(0))};if(ae[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ae.BINARY_EVENT||i.type===ae.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const r=t.substring(a,n);if(r!=Number(r)||t.charAt(n)!=="-")throw new Error("Illegal attachments");const s=Number(r);if(!pk(s)||s<0)throw new Error("Illegal attachments");if(s>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=s}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););i.nsp=t.substring(a,n)}else i.nsp="/";const l=t.charAt(n+1);if(l!==""&&Number(l)==l){const a=n+1;for(;++n;){const r=t.charAt(n);if(r==null||Number(r)!=r){--n;break}if(n===t.length)break}i.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(Ad.isPayloadValid(i.type,a))i.data=a;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ae.CONNECT:return hm(n);case ae.DISCONNECT:return n===void 0;case ae.CONNECT_ERROR:return typeof n=="string"||hm(n);case ae.EVENT:case ae.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&fk.indexOf(n[0])===-1);case ae.ACK:case ae.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class hk{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=ck(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const pk=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function hm(e){return Object.prototype.toString.call(e)==="[object Object]"}const mk=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ad,Encoder:dk,get PacketType(){return ae}},Symbol.toStringTag,{value:"Module"}));function Wt(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const gk=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class eb extends Ue{constructor(t,n,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Wt(t,"open",this.onopen.bind(this)),Wt(t,"packet",this.onpacket.bind(this)),Wt(t,"error",this.onerror.bind(this)),Wt(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var i,l,a;if(gk.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:ae.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,f=n.pop();this._registerAckCallback(d,f),r.id=d}const s=(l=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||l===void 0?void 0:l.writable,u=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!s||(u?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,n){var i;const l=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(l===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let s=0;s<this.sendBuffer.length;s++)this.sendBuffer[s].id===t&&this.sendBuffer.splice(s,1);n.call(this,new Error("operation has timed out"))},l),r=(...s)=>{this.io.clearTimeoutFn(a),n.apply(this,s)};r.withError=!0,this.acks[t]=r}emitWithAck(t,...n){return new Promise((i,l)=>{const a=(r,s)=>r?l(r):i(s);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...a)=>(this._queue[0],l!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(l)):(this._queue.shift(),n&&n(null,...a)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ae.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ae.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ae.EVENT:case ae.BINARY_EVENT:this.onevent(t);break;case ae.ACK:case ae.BINARY_ACK:this.onack(t);break;case ae.DISCONNECT:this.ondisconnect();break;case ae.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const i of n)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let i=!1;return function(...l){i||(i=!0,n.packet({type:ae.ACK,id:t,data:l}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ae.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const i of n)i.apply(this,t.data)}}}function na(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}na.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};na.prototype.reset=function(){this.attempts=0};na.prototype.setMin=function(e){this.ms=e};na.prototype.setMax=function(e){this.max=e};na.prototype.setJitter=function(e){this.jitter=e};class Kc extends Ue{constructor(t,n){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,wo(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((i=n.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new na({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const l=n.parser||mk;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ik(this.uri,this.opts);const n=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const l=Wt(n,"open",function(){i.onopen(),t&&t()}),a=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},r=Wt(n,"error",a);if(this._timeout!==!1){const s=this._timeout,u=this.setTimeoutFn(()=>{l(),a(new Error("timeout")),n.close()},s);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(l),this.subs.push(r),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Wt(t,"ping",this.onping.bind(this)),Wt(t,"data",this.ondata.bind(this)),Wt(t,"error",this.onerror.bind(this)),Wt(t,"close",this.onclose.bind(this)),Wt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){No(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new eb(this,t,n),this.nsps[t]=i),i}_destroy(t){const n=Object.keys(this.nsps);for(const i of n)if(this.nsps[i].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let i=0;i<n.length;i++)this.engine.write(n[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},n);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ga={};function Ha(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=lk(e,t.path||"/socket.io"),i=n.source,l=n.id,a=n.path,r=ga[l]&&a in ga[l].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||r;let u;return s?u=new Kc(i,t):(ga[l]||(ga[l]=new Kc(i,t)),u=ga[l]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(Ha,{Manager:Kc,Socket:eb,io:Ha,connect:Ha});const yk=Mv("/tasks"),tb=()=>{const[e,t]=b.useState(!1),[n,i]=b.useState(null),[l,a]=b.useState([]),[r,s]=b.useState(null),[u,c]=b.useState(!1);b.useEffect(()=>(f(),h(),()=>{r&&r.disconnect()}),[]);const d=p=>[...p].sort((y,x)=>{const E=new Date(y.updatedAt).getTime();return new Date(x.updatedAt).getTime()-E}),f=async()=>{t(!0),i(null);try{const p=await en.tasksControllerListTasks();a(d(p.items))}catch(p){i(p instanceof Error?p.message:"Failed to load tasks")}finally{t(!1)}},h=()=>{const p=Ha(yk,{transports:["websocket","polling"],withCredentials:!0});return p.on("connect",()=>{console.log("Connected to websocket"),p.emit("tasks.subscribe",{},y=>{y.ok?(console.log(y),console.log("Subscribed to room:",y.room),c(!0)):(console.error("Failed to subscribe to room"),c(!1))}),f()}),p.on("disconnect",()=>{console.log("WebSocket disconnected"),c(!1)}),p.on("task.created",y=>{a(x=>x.some(E=>E.id===y.id)?x:d([y,...x]))}),p.on("task.updated",y=>{a(x=>d(x.map(E=>E.id===y.id?y:E)))}),p.on("task.deleted",({taskId:y})=>{a(x=>x.filter(E=>E.id!==y))}),p.on("task.assigned",y=>{a(x=>d(x.map(E=>E.id===y.id?y:E)))}),p.on("task.commented",async y=>{try{const x=await en.tasksControllerGetTask(y.taskId);a(E=>E.findIndex(m=>m.id===x.id)===-1?d([x,...E]):d(E.map(m=>m.id===x.id?x:m)))}catch(x){console.error("Failed to refresh task after comment",x)}}),p.on("input.request.answered",async y=>{try{const x=await en.tasksControllerGetTask(y.taskId);a(E=>E.findIndex(m=>m.id===x.id)===-1?d([x,...E]):d(E.map(m=>m.id===x.id?x:m)))}catch(x){console.error("Failed to refresh task after input request answer",x)}}),p.on("task.status_changed",y=>{a(x=>d(x.map(E=>E.id===y.id?y:E)))}),s(p),()=>{p.close()}};return{isLoading:e,error:n,tasks:l,isConnected:u}};function xk(){const{tasks:e,isConnected:t}=tb(),[n,i]=b.useState(null),[l,a]=b.useState(!1);tl("Tasks");const r={[re.NOT_STARTED]:e.filter(s=>s.status===re.NOT_STARTED),[re.IN_PROGRESS]:e.filter(s=>s.status===re.IN_PROGRESS),[re.FOR_REVIEW]:e.filter(s=>s.status===re.FOR_REVIEW),[re.DONE]:e.filter(s=>s.status===re.DONE)};return o.jsxs("div",{className:"task-board",children:[o.jsxs("div",{className:"task-board-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:"Tasks"}),o.jsx("p",{className:"subtitle",children:"Manage and track your tasks across different stages"})]}),o.jsxs("div",{className:"header-actions",children:[o.jsx(rr,{}),o.jsx("span",{className:`status-indicator ${t?"connected":"disconnected"}`,children:t?"● Connected":"○ Disconnected"})]})]}),o.jsx("div",{className:"kanban-board",children:Object.entries(r).map(([s,u])=>o.jsxs("div",{className:`kanban-column column-${s.replace(" ","-")}`,children:[o.jsxs("div",{className:"column-header",children:[o.jsx("h2",{children:s.toUpperCase()}),o.jsx("span",{className:"task-count",children:u.length})]}),o.jsxs("div",{className:"column-content",children:[s===re.NOT_STARTED&&o.jsx("button",{onClick:()=>a(!0),className:"btn-add-task",children:"+ Add New Task"}),u.map(c=>o.jsx(bT,{task:c,onClick:()=>i(c)},c.id))]})]},s))}),l&&o.jsx(CT,{onClose:()=>a(!1)}),n&&o.jsx(qv,{task:n,onClose:()=>i(null),onUpdate:s=>i(s)})]})}function vk(){const[e,t]=b.useState(!1),n=rt(),i=()=>t(!e),l=()=>t(!1),a=[{name:"Home",path:"/",icon:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),o.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),color:"#8e8e93"},{name:"Tasks",path:"/tasks",icon:"📋",color:"#3b82f6"},{name:"Context",path:"/context",icon:"📚",color:"#10b981"},{name:"Tools",path:"/mcp-registry",icon:"🔧",color:"#8b5cf6"},{name:"Logout",path:"/logout",icon:"🔒"}];return o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"hamburger-button",onClick:i,"aria-label":"Menu",children:o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),o.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),o.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),e&&o.jsx("div",{className:"hamburger-overlay",onClick:l}),o.jsxs("div",{className:`hamburger-drawer ${e?"open":""}`,children:[o.jsxs("div",{className:"hamburger-header",children:[o.jsx("h2",{children:"Menu"}),o.jsx("button",{className:"hamburger-close",onClick:l,"aria-label":"Close menu",children:o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("nav",{className:"hamburger-nav",children:a.map(r=>{const s=n.pathname===r.path||r.path!=="/"&&n.pathname.startsWith(r.path);return o.jsxs(Pi,{to:r.path,className:`hamburger-nav-item ${s?"active":""}`,onClick:l,children:[o.jsx("div",{className:"hamburger-nav-icon",style:{color:r.color},children:typeof r.icon=="string"?o.jsx("span",{className:"hamburger-emoji",children:r.icon}):r.icon}),o.jsx("span",{className:"hamburger-nav-label",children:r.name}),s&&o.jsx("svg",{className:"hamburger-nav-check",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})})]},r.path)})})]})]})}const bk=[re.NOT_STARTED,re.IN_PROGRESS,re.FOR_REVIEW,re.DONE],Zr={[re.NOT_STARTED]:{label:"Queued",icon:"○",sublabel:"Ideas + intake"},[re.IN_PROGRESS]:{label:"Building",icon:"▣",sublabel:"Actively running"},[re.FOR_REVIEW]:{label:"Review",icon:"◆",sublabel:"Needs eyeballs"},[re.DONE]:{label:"Shipped",icon:"▴",sublabel:"Mission complete"}};function Sk(){const{tasks:e,isConnected:t}=tb(),[n,i]=b.useState(null),[l,a]=b.useState(!1),[r,s]=b.useState(re.NOT_STARTED);tl("Tasks");const u=b.useMemo(()=>e.reduce((f,h)=>(f[h.status]=f[h.status]?[...f[h.status],h]:[h],f),{[re.NOT_STARTED]:[],[re.IN_PROGRESS]:[],[re.FOR_REVIEW]:[],[re.DONE]:[]}),[e]),c=u[r]??[],d=f=>{const h=new Date(f),y=Math.round((new Date().getTime()-h.getTime())/(1e3*60));if(y<60)return`${Math.max(y,1)}m ago`;const x=Math.round(y/60);return x<24?`${x}h ago`:h.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return o.jsxs("div",{className:"task-board-mobile",children:[o.jsxs("div",{className:"matrix-frame",children:[o.jsxs("header",{className:"matrix-header",children:[o.jsx(vk,{}),o.jsx("div",{className:"matrix-header-copy",children:o.jsx("h1",{children:"Tasks"})}),o.jsxs("div",{className:"matrix-connection",children:[o.jsx("span",{className:`matrix-connection-dot ${t?"online":"offline"}`,"aria-hidden":!0}),o.jsx("span",{children:t?"":"offline"})]})]}),o.jsxs("section",{className:"matrix-status-panel",children:[o.jsxs("div",{children:[o.jsx("h2",{children:Zr[r].label}),o.jsx("p",{className:"matrix-status-sub",children:Zr[r].sublabel})]}),o.jsxs("div",{className:"matrix-status-count",children:[o.jsx("span",{className:"matrix-count-number",children:c.length}),o.jsx("span",{className:"matrix-count-text",children:"tasks"})]})]}),o.jsxs("section",{className:"matrix-task-feed",children:[c.length===0&&o.jsxs("div",{className:"matrix-empty-state",children:[o.jsx("p",{children:"No entries in this lane."}),r===re.NOT_STARTED&&o.jsx("button",{type:"button",className:"matrix-link",onClick:()=>a(!0),children:"create the first task"})]}),c.map(f=>o.jsxs("article",{className:"matrix-task-card",onClick:()=>i(f),children:[o.jsxs("div",{className:"matrix-task-meta-row",children:[o.jsxs("span",{className:"matrix-task-id",children:["#",f.id.slice(0,6).toUpperCase()]}),o.jsx("span",{className:"matrix-task-updated",children:d(f.updatedAt)})]}),o.jsx("h3",{children:f.name}),o.jsx("p",{children:f.description}),f.tags&&f.tags.length>0&&o.jsx("div",{className:"matrix-task-tags",children:f.tags.map(h=>o.jsx(Uv,{tag:h,small:!0},h.name))}),o.jsxs("div",{className:"matrix-task-footer",children:[o.jsx("span",{children:f.assignee?`Assigned: ${f.assignee}`:"Unassigned"}),f.comments&&f.comments.length>0&&o.jsxs("span",{children:["💬 ",f.comments.length]})]})]},f.id))]})]}),o.jsx("nav",{className:"matrix-bottom-nav","aria-label":"Task status navigation",children:bk.map(f=>o.jsxs("button",{className:`matrix-nav-item ${f===r?"active":""}`,onClick:()=>s(f),type:"button",children:[o.jsx("span",{className:"matrix-nav-icon",children:Zr[f].icon}),o.jsx("span",{className:"matrix-nav-label",children:Zr[f].label}),o.jsx("span",{className:"matrix-nav-count",children:u[f].length})]},f))}),o.jsx("button",{type:"button",className:"matrix-fab",onClick:()=>a(!0),"aria-label":"Create task",children:"➕"}),n&&o.jsx(qv,{task:n,onClose:()=>i(null),onUpdate:f=>i(f)}),l&&o.jsx(Ek,{onClose:()=>a(!1)})]})}function Ek({onClose:e}){const{toasts:t,showToast:n,removeToast:i}=Iv(),[l,a]=b.useState(""),[r,s]=b.useState(""),[u,c]=b.useState(""),[d,f]=b.useState(""),[h,p]=b.useState([]),[y,x]=b.useState(""),[E,g]=b.useState(!1),m=async v=>{var C;if(v.preventDefault(),!l.trim()||!r.trim()){n("Name and description are required","error");return}g(!0);try{const A=y.split(",").map(N=>N.trim()).filter(Boolean);await en.tasksControllerCreateTask({name:l,description:r,...u&&{assignee:u},...d&&{sessionId:d},...h.length>0&&{tagNames:h},...A.length>0&&{dependsOnIds:A}}),e()}catch(A){const N=((C=A==null?void 0:A.body)==null?void 0:C.detail)||(A==null?void 0:A.message)||"Failed to create task";n(N,"error")}finally{g(!1)}};return o.jsx("div",{className:"mobile-create-overlay",onClick:e,children:o.jsxs("div",{className:"mobile-create-panel",onClick:v=>v.stopPropagation(),children:[o.jsxs("header",{className:"mobile-create-header",children:[o.jsxs("div",{children:[o.jsx("p",{className:"matrix-status-label",children:"New task payload"}),o.jsx("h2",{children:"Compose"})]}),o.jsx("button",{type:"button",className:"matrix-link",onClick:e,children:"close"})]}),o.jsxs("form",{className:"mobile-create-form",onSubmit:m,children:[o.jsxs("label",{children:[o.jsx("span",{children:"Title *"}),o.jsx("input",{type:"text",value:l,onChange:v=>a(v.target.value),placeholder:"Ship a feature",required:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Description *"}),o.jsx("textarea",{value:r,onChange:v=>s(v.target.value),placeholder:"Outline what needs to happen",rows:4,required:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Assignee"}),o.jsx("input",{type:"text",value:u,onChange:v=>c(v.target.value),placeholder:"agent or human"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Session ID"}),o.jsx("input",{type:"text",value:d,onChange:v=>f(v.target.value),placeholder:"link a running session"})]}),o.jsxs("div",{className:"mobile-form-control",children:[o.jsx("span",{children:"Tags"}),o.jsx(Cd,{value:h,onChange:p,placeholder:"ops, agents, ui"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Depends on task IDs"}),o.jsx("input",{type:"text",value:y,onChange:v=>x(v.target.value),placeholder:"comma separated"})]}),o.jsx("button",{type:"submit",className:"matrix-submit",disabled:E,children:E?"Transmitting…":"Create Task"})]}),t.map(v=>o.jsx(Hv,{message:v.message,type:v.type,onClose:()=>i(v.id)},v.id))]})})}function nb(e,t){return t?e.id===t?!0:e.children?e.children.some(n=>nb(n,t)):!1:!1}const Ck=b.memo(function e({page:t,level:n,isActive:i,currentPageId:l,onPageClick:a,onAddChild:r}){const s=t.children&&t.children.length>0,u=s&&nb(t,l),[c,d]=b.useState(u);b.useEffect(()=>{u&&d(!0)},[u]);const f=x=>{x.stopPropagation(),d(!c)},h=x=>{x.preventDefault(),a(t.id)},p=x=>{x.preventDefault(),x.stopPropagation(),r(t.id)},y=b.useMemo(()=>s?[...t.children].sort((x,E)=>x.order-E.order):[],[s,t.children]);return o.jsxs("div",{className:"page-tree-item",children:[o.jsxs("div",{className:`tree-item-content ${i?"active":""}`,style:{paddingLeft:`${n*20}px`},children:[s?o.jsx("button",{className:"tree-toggle",onClick:f,"aria-label":c?"Collapse":"Expand","aria-expanded":c,children:c?"▼":"▶"}):o.jsx("span",{className:"tree-spacer"}),o.jsx("a",{href:"#",className:"tree-item-link",onClick:h,"aria-current":i?"page":void 0,children:t.title}),o.jsx("button",{className:"tree-item-add-child",onClick:p,"aria-label":`Add child page to ${t.title}`,title:"Add child page",children:"+"})]}),c&&s&&o.jsx("div",{className:"tree-item-children",children:y.map(x=>o.jsx(e,{page:x,level:n+1,isActive:x.id===l,currentPageId:l,onPageClick:a,onAddChild:r},x.id))})]})});function Tk({pages:e,currentPageId:t,onPageClick:n}){const i=Je(),l=b.useMemo(()=>[...e].sort((r,s)=>r.order-s.order),[e]),a=r=>{i(`/context/page/${r}/new`)};return o.jsx("div",{className:"page-tree",children:l.map(r=>o.jsx(Ck,{page:r,level:0,isActive:r.id===t,currentPageId:t,onPageClick:n,onAddChild:a},r.id))})}B.BASE=el;const kk=Mv("/context"),Tr=()=>{const[e,t]=b.useState([]),[n,i]=b.useState(null),[l,a]=b.useState(!1),[r,s]=b.useState(!1),[u,c]=b.useState(!1),[d,f]=b.useState(!1),[h,p]=b.useState(!1),[y,x]=b.useState(null),[E,g]=b.useState(null),[m,v]=b.useState(!1),C=b.useCallback(async()=>{a(!0),x(null);try{const j=await Kt.contextControllerListBlocks();t(j.items)}catch(j){x(j instanceof Error?j.message:"Failed to load wiki pages")}finally{a(!1)}},[]),A=b.useCallback(async j=>{s(!0),x(null),i(null);try{const O=await Kt.contextControllerGetBlock(j);i(O)}catch(O){x(O instanceof Error?O.message:"Failed to fetch wiki page")}finally{s(!1)}},[]),N=b.useCallback(async j=>{c(!0),x(null);try{const O=await Kt.contextControllerCreateBlock(j);return t(w=>{const X=w.filter(S=>S.id!==O.id);return[{id:O.id,title:O.title,createdBy:O.createdBy,createdByActorId:O.createdByActorId,tags:O.tags,parentId:O.parentId,order:O.order,createdAt:O.createdAt,updatedAt:O.updatedAt},...X]}),i(O),O}catch(O){throw x(O instanceof Error?O.message:"Failed to create wiki page"),O}finally{c(!1)}},[]),_=b.useCallback(j=>{A(j)},[A]),U=b.useCallback(async(j,O)=>{f(!0),x(null);try{const w=await Kt.contextControllerUpdateBlock(j,O);return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to update page"),w}finally{f(!1)}},[n]),D=b.useCallback(async j=>{p(!0),x(null);try{await Kt.contextControllerDeleteBlock(j),t(O=>O.filter(w=>w.id!==j)),(n==null?void 0:n.id)===j&&i(null)}catch(O){throw x(O instanceof Error?O.message:"Failed to delete page"),O}finally{p(!1)}},[n]),T=b.useCallback(async(j,O)=>{f(!0),x(null);try{const w=await Kt.contextControllerAppendToBlock(j,{content:O});return(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to append content"),w}finally{f(!1)}},[n]),M=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerAddTagToBlock(j,O);return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to add tag"),w}},[n]),q=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerRemoveTagFromBlock(j,O);return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to remove tag"),w}},[n]),P=b.useCallback(async()=>{x(null);try{return await Kt.contextControllerGetBlockTree()}catch(j){throw x(j instanceof Error?j.message:"Failed to fetch page tree"),j}},[]),F=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerReorderBlock(j,{newOrder:O});return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to reorder page"),w}},[n]),V=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerMoveBlock(j,{newParentId:O});return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to move page"),w}},[n]);return b.useEffect(()=>{const j=Ha(kk,{transports:["websocket","polling"],withCredentials:!0});return j.on("connect",()=>{console.log("Connected to Context websocket"),j.emit("context.subscribe",{},O=>{O.ok?(console.log(O),console.log("Subscribed to room:",O.room),v(!0)):(console.error("Failed to subscribe to room"),v(!1))}),v(!0),C()}),j.on("disconnect",()=>{console.log("Context WebSocket disconnected"),v(!1)}),j.on("page.created",O=>{t(w=>w.some(X=>X.id===O.id)?w:[{id:O.id,title:O.title,createdBy:O.createdBy,createdByActorId:O.createdByActorId,tags:O.tags,parentId:O.parentId,order:O.order,createdAt:O.createdAt,updatedAt:O.updatedAt},...w])}),j.on("page.updated",O=>{t(w=>w.map(X=>X.id===O.id?{id:O.id,title:O.title,createdBy:O.createdBy,createdByActorId:O.createdByActorId,tags:O.tags,parentId:O.parentId,order:O.order,createdAt:O.createdAt,updatedAt:O.updatedAt}:X)),(n==null?void 0:n.id)===O.id&&i(O)}),j.on("page.deleted",({pageId:O})=>{t(w=>w.filter(X=>X.id!==O)),(n==null?void 0:n.id)===O&&i(null)}),g(j),()=>{j.disconnect()}},[C,n==null?void 0:n.id]),b.useEffect(()=>{C()},[C]),{pages:e,selectedPage:n,isLoadingList:l,isLoadingPage:r,isCreating:u,isUpdating:d,isDeleting:h,error:y,isConnected:m,socket:E,loadPages:C,createPage:N,selectPage:_,updatePage:U,appendToPage:T,deletePage:D,addTagToPage:M,removeTagFromPage:q,getPageTree:P,reorderPage:F,movePage:V}},pm="context-sidebar-collapsed";function Nk(){const{pageId:e}=Wi(),t=Je(),{getPageTree:n,isConnected:i,socket:l}=Tr(),[a,r]=b.useState([]),[s,u]=b.useState(!1),[c,d]=b.useState(()=>{const y=localStorage.getItem(pm);return y!==null?y==="true":ar()});b.useEffect(()=>{localStorage.setItem(pm,String(c))},[c]);const f=b.useCallback(async()=>{u(!0);try{const y=await n();r(y)}catch(y){console.error("Failed to load page tree:",y)}finally{u(!1)}},[n]);b.useEffect(()=>{f()},[f]),b.useEffect(()=>{if(!l)return;const y=()=>{f()},x=()=>{f()},E=()=>{f()};return l.on("page.created",y),l.on("page.updated",x),l.on("page.deleted",E),()=>{l.off("page.created",y),l.off("page.updated",x),l.off("page.deleted",E)}},[l,f]);const h=b.useCallback(y=>{t(`/context/page/${y}`)},[t]),p=()=>{d(!c)};return o.jsxs("div",{className:"context-with-sidebar",children:[o.jsxs("aside",{className:`sidebar-app-specific ${c?"collapsed":""}`,children:[o.jsxs("nav",{className:"sidebar-content",children:[c&&o.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px"},children:o.jsx("span",{className:`context-status-dot ${i?"connected":"disconnected"}`,title:i?"WebSocket connected":"WebSocket disconnected","aria-label":i?"WebSocket connected":"WebSocket disconnected"})}),!c&&o.jsxs("div",{children:[o.jsxs("div",{className:"context-sidebar-header",children:[o.jsxs("h2",{className:"context-sidebar-title",children:["📚 Context",o.jsx("span",{className:`context-status-dot ${i?"connected":"disconnected"}`,title:i?"WebSocket connected":"WebSocket disconnected","aria-label":i?"WebSocket connected":"WebSocket disconnected"})]}),o.jsx("button",{className:"context-button primary context-sidebar-new-page",type:"button",onClick:()=>t("/context/new"),title:"Create new page",children:"+ New page"})]}),s&&o.jsx("div",{className:"context-status",children:"Loading pages…"}),a.length>0&&o.jsx(Tk,{pages:a,currentPageId:e,onPageClick:h}),a.length===0&&!s&&o.jsx("div",{className:"context-empty-sidebar",children:o.jsx("span",{children:"No pages yet"})})]})]}),o.jsx("button",{className:"sidebar-toggle",onClick:p,"aria-label":c?"Expand sidebar":"Collapse sidebar",children:c?"→":"←"})]}),o.jsx("main",{className:"context-content",children:o.jsx(md,{})})]})}const ib=({tag:e,onRemove:t,small:n=!1})=>{const i=e.color||"#6B7280";return o.jsxs("span",{className:`tag-badge ${n?"tag-badge-small":""}`,style:{backgroundColor:i,color:"#ffffff",padding:n?"1px 4px":"2px 6px",borderRadius:"3px",fontSize:n?"0.65rem":"0.7rem",fontWeight:"500",display:"inline-flex",alignItems:"center",gap:"2px",marginRight:"4px",marginBottom:"4px"},children:[e.name,t&&o.jsx("button",{onClick:l=>{l.stopPropagation(),t()},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:n?"0.75rem":"0.85rem",lineHeight:"1"},"aria-label":`Remove ${e.name} tag`,children:"×"})]})};function wk(){const e=Je(),{pages:t,isLoadingList:n}=Tr();return n?o.jsx("div",{className:"context-welcome",children:o.jsx("p",{children:"Loading pages..."})}):t.length===0?o.jsxs("div",{className:"context-welcome",children:[o.jsx("h2",{children:"Context"}),o.jsx("br",{}),o.jsx("button",{className:"context-button primary",type:"button",onClick:()=>e("/context/new"),title:"Create new page",children:"+ New page"})]}):o.jsxs("div",{className:"context-content",style:{padding:"24px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px"},children:[o.jsx("h2",{style:{margin:0},children:"All Pages"}),o.jsx("button",{className:"context-button primary",type:"button",onClick:()=>e("/context/new"),title:"Create new page",children:"+ New page"})]}),o.jsx("div",{className:"context-grid",children:t.map(i=>o.jsxs("div",{className:"context-card",onClick:()=>e(`/context/page/${i.id}`),style:{cursor:"pointer"},children:[o.jsx("h3",{children:i.title}),i.tags&&i.tags.length>0&&o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.tags.map(l=>o.jsx(ib,{tag:l},l.name))}),o.jsxs("div",{className:"context-card-meta",children:[o.jsxs("span",{children:["By ",i.createdBy||"unknown"]}),o.jsxs("span",{children:["Created ",new Date(i.createdAt).toLocaleDateString()]}),i.updatedAt!==i.createdAt&&o.jsxs("span",{children:["Updated ",new Date(i.updatedAt).toLocaleDateString()]})]})]},i.id))})]})}const Ak=({value:e,onChange:t,placeholder:n="Type to add tags..."})=>{const[i,l]=b.useState(""),[a,r]=b.useState([]),[s,u]=b.useState(!1),[c,d]=b.useState(-1),[f,h]=b.useState([]),p=b.useRef(null),y=b.useRef(null);b.useEffect(()=>{(async()=>{try{const v=await zv.metaControllerGetAllTags();h(v)}catch(v){console.error("Failed to load tags:",v)}})()},[]),b.useEffect(()=>{const v=setTimeout(()=>{if(i.trim().length>0){const C=i.trim().toLowerCase(),A=f.filter(N=>N.name.toLowerCase().includes(C)&&!e.includes(N.name));r(A),u(!0)}else r([]),u(!1)},150);return()=>clearTimeout(v)},[i,e,f]),b.useEffect(()=>{const m=v=>{y.current&&!y.current.contains(v.target)&&u(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const x=m=>{var C;const v=m.trim();v&&!e.includes(v)&&t([...e,v]),l(""),r([]),u(!1),d(-1),(C=p.current)==null||C.focus()},E=m=>{t(e.filter(v=>v!==m))},g=m=>{m.key==="Tab"&&i.trim()||m.key==="Enter"&&i.trim()?(m.preventDefault(),c>=0&&a[c]?x(a[c].name):x(i)):m.key==="ArrowDown"?(m.preventDefault(),d(v=>v<a.length-1?v+1:v)):m.key==="ArrowUp"?(m.preventDefault(),d(v=>v>0?v-1:-1)):m.key==="Escape"?(u(!1),d(-1)):m.key==="Backspace"&&!i&&e.length>0&&t(e.slice(0,-1))};return o.jsxs("div",{ref:y,style:{position:"relative"},children:[o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",padding:"6px",border:"1px solid #ddd",borderRadius:"4px",minHeight:"38px",cursor:"text"},onClick:()=>{var m;return(m=p.current)==null?void 0:m.focus()},children:[e.map(m=>{const v=f.find(A=>A.name===m),C=(v==null?void 0:v.color)||"#3B82F6";return o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",backgroundColor:C,color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"0.7rem",fontWeight:"500"},children:[m,o.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),E(m)},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:"0.85rem",lineHeight:"1"},children:"×"})]},m)}),o.jsx("input",{ref:p,type:"text",value:i,onChange:m=>l(m.target.value),onKeyDown:g,onFocus:()=>i&&u(!0),placeholder:e.length===0?n:"",style:{flex:"1",minWidth:"120px",border:"none",outline:"none",fontSize:"0.875rem",padding:"2px"}})]}),s&&a.length>0&&o.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3},children:a.map((m,v)=>o.jsxs("div",{onClick:()=>x(m.name),style:{padding:"8px 12px",cursor:"pointer",backgroundColor:v===c?"#EFF6FF":"white",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:()=>d(v),children:[o.jsx("span",{style:{width:"12px",height:"12px",borderRadius:"2px",backgroundColor:m.color||"#6B7280"}}),o.jsx("span",{style:{fontSize:"0.875rem"},children:m.name})]},m.name))}),s&&i&&a.length===0&&o.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",padding:"8px 12px",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3,fontSize:"0.875rem",color:"#6B7280"},children:['Press Tab or Enter to create "',i,'"']})]})};function jk(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _k=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ok={};function mm(e,t){return(Ok.jsx?Rk:_k).test(e)}const Dk=/[ \t\n\f\r]/g;function zk(e){return typeof e=="object"?e.type==="text"?gm(e.value):!1:gm(e)}function gm(e){return e.replace(Dk,"")===""}class kr{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}kr.prototype.normal={};kr.prototype.property={};kr.prototype.space=void 0;function lb(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new kr(n,i,t)}function $c(e){return e.toLowerCase()}class yt{constructor(t,n){this.attribute=n,this.property=t}}yt.prototype.attribute="";yt.prototype.booleanish=!1;yt.prototype.boolean=!1;yt.prototype.commaOrSpaceSeparated=!1;yt.prototype.commaSeparated=!1;yt.prototype.defined=!1;yt.prototype.mustUseProperty=!1;yt.prototype.number=!1;yt.prototype.overloadedBoolean=!1;yt.prototype.property="";yt.prototype.spaceSeparated=!1;yt.prototype.space=void 0;let Lk=0;const W=nl(),De=nl(),Jc=nl(),H=nl(),ve=nl(),Rl=nl(),vt=nl();function nl(){return 2**++Lk}const Wc=Object.freeze(Object.defineProperty({__proto__:null,boolean:W,booleanish:De,commaOrSpaceSeparated:vt,commaSeparated:Rl,number:H,overloadedBoolean:Jc,spaceSeparated:ve},Symbol.toStringTag,{value:"Module"})),Au=Object.keys(Wc);class jd extends yt{constructor(t,n,i,l){let a=-1;if(super(t,n),ym(this,"space",l),typeof i=="number")for(;++a<Au.length;){const r=Au[a];ym(this,Au[a],(i&Wc[r])===Wc[r])}}}jd.prototype.defined=!0;function ym(e,t,n){n&&(e[t]=n)}function ia(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const a=new jd(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),t[i]=a,n[$c(i)]=i,n[$c(a.attribute)]=i}return new kr(t,n,e.space)}const ab=ia({properties:{ariaActiveDescendant:null,ariaAtomic:De,ariaAutoComplete:null,ariaBusy:De,ariaChecked:De,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:ve,ariaCurrent:null,ariaDescribedBy:ve,ariaDetails:null,ariaDisabled:De,ariaDropEffect:ve,ariaErrorMessage:null,ariaExpanded:De,ariaFlowTo:ve,ariaGrabbed:De,ariaHasPopup:null,ariaHidden:De,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ve,ariaLevel:H,ariaLive:null,ariaModal:De,ariaMultiLine:De,ariaMultiSelectable:De,ariaOrientation:null,ariaOwns:ve,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:De,ariaReadOnly:De,ariaRelevant:null,ariaRequired:De,ariaRoleDescription:ve,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:De,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function rb(e,t){return t in e?e[t]:t}function sb(e,t){return rb(e,t.toLowerCase())}const Mk=ia({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rl,acceptCharset:ve,accessKey:ve,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:ve,autoFocus:W,autoPlay:W,blocking:ve,capture:null,charSet:null,checked:W,cite:null,className:ve,cols:H,colSpan:null,content:null,contentEditable:De,controls:W,controlsList:ve,coords:H|Rl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:Jc,draggable:De,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:ve,height:H,hidden:Jc,high:H,href:null,hrefLang:null,htmlFor:ve,httpEquiv:ve,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:ve,itemRef:ve,itemScope:W,itemType:ve,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:H,pattern:null,ping:ve,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:ve,required:W,reversed:W,rows:H,rowSpan:H,sandbox:ve,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:De,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:De,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ve,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:De,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:W,disableRemotePlayback:W,prefix:null,property:null,results:H,security:null,unselectable:null},space:"html",transform:sb}),Bk=ia({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vt,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:ve,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Rl,g2:Rl,glyphName:Rl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ve,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vt,rev:vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vt,requiredFeatures:vt,requiredFonts:vt,requiredFormats:vt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vt,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:rb}),ob=ia({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ub=ia({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:sb}),cb=ia({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Uk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ik=/[A-Z]/g,xm=/-[a-z]/g,Hk=/^data[-\w.:]+$/i;function qk(e,t){const n=$c(t);let i=t,l=yt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Hk.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(xm,Gk);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!xm.test(a)){let r=a.replace(Ik,Fk);r.charAt(0)!=="-"&&(r="-"+r),t="data"+r}}l=jd}return new l(i,t)}function Fk(e){return"-"+e.toLowerCase()}function Gk(e){return e.charAt(1).toUpperCase()}const Vk=lb([ab,Mk,ob,ub,cb],"html"),_d=lb([ab,Bk,ob,ub,cb],"svg");function Yk(e){return e.join(" ").trim()}var Rd={},vm=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Pk=/\n/g,Xk=/^\s*/,Qk=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Zk=/^:\s*/,Kk=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,$k=/^[;\s]*/,Jk=/^\s+|\s+$/g,Wk=`
60
+ Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let d=rt(),f;if(t){let g=typeof t=="string"?Wl(t):t;Ne(u==="/"||((E=g.pathname)==null?void 0:E.startsWith(u)),`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 "${u}" but pathname "${g.pathname}" was given in the \`location\` prop.`),f=g}else f=d;let h=f.pathname||"/",p=h;if(u!=="/"){let g=u.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(g.length).join("/")}let y=gv(e,{pathname:p});Yt(c||y!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Yt(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.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 x=rC(y&&y.map(g=>Object.assign({},g,{params:Object.assign({},r,g.params),pathname:pn([u,i.encodeLocation?i.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?u:pn([u,i.encodeLocation?i.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),l,n);return t&&x?b.createElement(Sr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},x):x}function nC(){let e=fC(),t=qE(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)",l={padding:"0.5rem",backgroundColor:i},a={padding:"2px 4px",backgroundColor:i},r=null;return console.error("Error handled by React Router default ErrorBoundary:",e),r=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:a},"ErrorBoundary")," or"," ",b.createElement("code",{style:a},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:l},n):null,r)}var iC=b.createElement(nC,null),Av=class extends b.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=KE(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(Pt.Provider,{value:this.props.routeContext},b.createElement(dd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(lC,{error:e},t):t}};Av.contextType=Ev;var Su=new WeakMap;function lC({children:e,error:t}){let{basename:n}=b.useContext(Rt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=ZE(t.digest);if(i){let l=Su.get(t);if(l)throw l;let a=bv(i.location,n);if(vv&&!Su.get(t))if(a.isExternal||i.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const r=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:i.replace}));throw Su.set(t,r),r}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function aC({routeContext:e,match:t,children:n}){let i=b.useContext(ea);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(Pt.Provider,{value:e},n)}function rC(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 l=e,a=i==null?void 0:i.errors;if(a!=null){let d=l.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);Ne(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),l=l.slice(0,Math.min(l.length,d+1))}let r=!1,s=-1;if(n&&i){r=i.renderFallback;for(let d=0;d<l.length;d++){let f=l[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(s=d),f.route.id){let{loaderData:h,errors:p}=i,y=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||y){n.isStatic&&(r=!0),s>=0?l=l.slice(0,s+1):l=[l[0]];break}}}}let u=n==null?void 0:n.onError,c=i&&u?(d,f)=>{var h,p;u(d,{location:i.location,params:((p=(h=i.matches)==null?void 0:h[0])==null?void 0:p.params)??{},unstable_pattern:FE(i.matches),errorInfo:f})}:void 0;return l.reduceRight((d,f,h)=>{let p,y=!1,x=null,E=null;i&&(p=a&&f.route.id?a[f.route.id]:void 0,x=f.route.errorElement||iC,r&&(s<0&&h===0?(jv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,E=null):s===h&&(y=!0,E=f.route.hydrateFallbackElement||null)));let g=t.concat(l.slice(0,h+1)),m=()=>{let v;return p?v=x:y?v=E:f.route.Component?v=b.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=d,b.createElement(aC,{match:f,routeContext:{outlet:d,matches:g,isDataRoute:i!=null},children:v})};return i&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?b.createElement(Av,{location:i.location,revalidation:i.revalidation,component:x,error:p,children:m(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:c}):m()},null)}function hd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sC(e){let t=b.useContext(ea);return Ne(t,hd(e)),t}function oC(e){let t=b.useContext(To);return Ne(t,hd(e)),t}function uC(e){let t=b.useContext(Pt);return Ne(t,hd(e)),t}function pd(e){let t=uC(e),n=t.matches[t.matches.length-1];return Ne(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function cC(){return pd("useRouteId")}function fC(){var i;let e=b.useContext(dd),t=oC("useRouteError"),n=pd("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[n]}function dC(){let{router:e}=sC("useNavigate"),t=pd("useNavigate"),n=b.useRef(!1);return Nv(()=>{n.current=!0}),b.useCallback(async(l,a={})=>{Yt(n.current,kv),n.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...a}))},[e,t])}var Rp={};function jv(e,t,n){!t&&!Rp[e]&&(Rp[e]=!0,Yt(!1,n))}b.memo(hC);function hC({routes:e,future:t,state:n,isStatic:i,onError:l}){return wv(e,void 0,{state:n,isStatic:i,onError:l})}function pC({to:e,replace:t,state:n,relative:i}){Ne(ta(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=b.useContext(Rt);Yt(!l,"<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:a}=b.useContext(Pt),{pathname:r}=rt(),s=Je(),u=Co(e,fd(a),r,i==="path"),c=JSON.stringify(u);return b.useEffect(()=>{s(JSON.parse(c),{replace:t,state:n,relative:i})},[s,c,i,t,n]),null}function md(e){return eC(e.context)}function qe(e){Ne(!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 mC({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:l,static:a=!1,unstable_useTransitions:r}){Ne(!ta(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:s,navigator:l,static:a,unstable_useTransitions:r,future:{}}),[s,l,a,r]);typeof n=="string"&&(n=Wl(n));let{pathname:c="/",search:d="",hash:f="",state:h=null,key:p="default",unstable_mask:y}=n,x=b.useMemo(()=>{let E=Hn(c,s);return E==null?null:{location:{pathname:E,search:d,hash:f,state:h,key:p,unstable_mask:y},navigationType:i}},[s,c,d,f,h,p,i,y]);return Yt(x!=null,`<Router basename="${s}"> is not able to match the URL "${c}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:b.createElement(Rt.Provider,{value:u},b.createElement(Sr.Provider,{children:t,value:x}))}function gC({children:e,location:t}){return tC(Hc(e),t)}function Hc(e,t=[]){let n=[];return b.Children.forEach(e,(i,l)=>{if(!b.isValidElement(i))return;let a=[...t,l];if(i.type===b.Fragment){n.push.apply(n,Hc(i.props.children,a));return}Ne(i.type===qe,`[${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>`),Ne(!i.props.index||!i.props.children,"An index route cannot have child routes.");let r={id:i.props.id||a.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&&(r.children=Hc(i.props.children,a)),n.push(r)}),n}var ms="get",gs="application/x-www-form-urlencoded";function ko(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function yC(e){return ko(e)&&e.tagName.toLowerCase()==="button"}function xC(e){return ko(e)&&e.tagName.toLowerCase()==="form"}function vC(e){return ko(e)&&e.tagName.toLowerCase()==="input"}function bC(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function SC(e,t){return e.button===0&&(!t||t==="_self")&&!bC(e)}function qc(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let i=e[n];return t.concat(Array.isArray(i)?i.map(l=>[n,l]):[[n,i]])},[]))}function EC(e,t){let n=qc(e);return t&&t.forEach((i,l)=>{n.has(l)||t.getAll(l).forEach(a=>{n.append(l,a)})}),n}var Yr=null;function CC(){if(Yr===null)try{new FormData(document.createElement("form"),0),Yr=!1}catch{Yr=!0}return Yr}var TC=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eu(e){return e!=null&&!TC.has(e)?(Yt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${gs}"`),null):e}function kC(e,t){let n,i,l,a,r;if(xC(e)){let s=e.getAttribute("action");i=s?Hn(s,t):null,n=e.getAttribute("method")||ms,l=Eu(e.getAttribute("enctype"))||gs,a=new FormData(e)}else if(yC(e)||vC(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||s.getAttribute("action");if(i=u?Hn(u,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||ms,l=Eu(e.getAttribute("formenctype"))||Eu(s.getAttribute("enctype"))||gs,a=new FormData(s,e),!CC()){let{name:c,type:d,value:f}=e;if(d==="image"){let h=c?`${c}.`:"";a.append(`${h}x`,"0"),a.append(`${h}y`,"0")}else c&&a.append(c,f)}}else{if(ko(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ms,i=null,l=gs,r=e}return a&&l==="text/plain"&&(r=a,a=void 0),{action:i,method:n.toLowerCase(),encType:l,formData:a,body:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _v(e,t,n,i){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${i}`:l.pathname=`${l.pathname}.${i}`:l.pathname==="/"?l.pathname=`_root.${i}`:t&&Hn(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${i}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${i}`,l}async function NC(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 wC(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 AC(e,t,n){let i=await Promise.all(e.map(async l=>{let a=t.routes[l.route.id];if(a){let r=await NC(a,n);return r.links?r.links():[]}return[]}));return OC(i.flat(1).filter(wC).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function Op(e,t,n,i,l,a){let r=(u,c)=>n[c]?u.route.id!==n[c].route.id:!0,s=(u,c)=>{var d;return n[c].pathname!==u.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==u.params["*"]};return a==="assets"?t.filter((u,c)=>r(u,c)||s(u,c)):a==="data"?t.filter((u,c)=>{var f;let d=i.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(r(u,c)||s(u,c))return!0;if(u.route.shouldRevalidate){let h=u.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function jC(e,t,{includeHydrateFallback:n}={}){return _C(e.map(i=>{let l=t.routes[i.route.id];if(!l)return[];let a=[l.module];return l.clientActionModule&&(a=a.concat(l.clientActionModule)),l.clientLoaderModule&&(a=a.concat(l.clientLoaderModule)),n&&l.hydrateFallbackModule&&(a=a.concat(l.hydrateFallbackModule)),l.imports&&(a=a.concat(l.imports)),a}).flat(1))}function _C(e){return[...new Set(e)]}function RC(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function OC(e,t){let n=new Set;return new Set(t),e.reduce((i,l)=>{let a=JSON.stringify(RC(l));return n.has(a)||(n.add(a),i.push({key:a,link:l})),i},[])}function yd(){let e=b.useContext(ea);return gd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function DC(){let e=b.useContext(To);return gd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var xd=b.createContext(void 0);xd.displayName="FrameworkContext";function vd(){let e=b.useContext(xd);return gd(e,"You must render this element inside a <HydratedRouter> element"),e}function zC(e,t){let n=b.useContext(xd),[i,l]=b.useState(!1),[a,r]=b.useState(!1),{onFocus:s,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=t,h=b.useRef(null);b.useEffect(()=>{if(e==="render"&&r(!0),e==="viewport"){let x=g=>{g.forEach(m=>{r(m.isIntersecting)})},E=new IntersectionObserver(x,{threshold:.5});return h.current&&E.observe(h.current),()=>{E.disconnect()}}},[e]),b.useEffect(()=>{if(i){let x=setTimeout(()=>{r(!0)},100);return()=>{clearTimeout(x)}}},[i]);let p=()=>{l(!0)},y=()=>{l(!1),r(!1)};return n?e!=="intent"?[a,h,{}]:[a,h,{onFocus:pa(s,p),onBlur:pa(u,y),onMouseEnter:pa(c,p),onMouseLeave:pa(d,y),onTouchStart:pa(f,p)}]:[!1,h,{}]}function pa(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function LC({page:e,...t}){let n=VE(),{router:i}=yd(),l=b.useMemo(()=>gv(i.routes,e,i.basename),[i.routes,e,i.basename]);return l?n?b.createElement(BC,{page:e,matches:l,...t}):b.createElement(UC,{page:e,matches:l,...t}):null}function MC(e){let{manifest:t,routeModules:n}=vd(),[i,l]=b.useState([]);return b.useEffect(()=>{let a=!1;return AC(e,t,n).then(r=>{a||l(r)}),()=>{a=!0}},[e,t,n]),i}function BC({page:e,matches:t,...n}){let i=rt(),{future:l}=vd(),{basename:a}=yd(),r=b.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let s=_v(e,a,l.unstable_trailingSlashAwareDataRequests,"rsc"),u=!1,c=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?u=!0:c.push(d.route.id);return u&&c.length>0&&s.searchParams.set("_routes",c.join(",")),[s.pathname+s.search]},[a,l.unstable_trailingSlashAwareDataRequests,e,i,t]);return b.createElement(b.Fragment,null,r.map(s=>b.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...n})))}function UC({page:e,matches:t,...n}){let i=rt(),{future:l,manifest:a,routeModules:r}=vd(),{basename:s}=yd(),{loaderData:u,matches:c}=DC(),d=b.useMemo(()=>Op(e,t,c,a,i,"data"),[e,t,c,a,i]),f=b.useMemo(()=>Op(e,t,c,a,i,"assets"),[e,t,c,a,i]),h=b.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,E=!1;if(t.forEach(m=>{var C;let v=a.routes[m.route.id];!v||!v.hasLoader||(!d.some(A=>A.route.id===m.route.id)&&m.route.id in u&&((C=r[m.route.id])!=null&&C.shouldRevalidate)||v.hasClientLoader?E=!0:x.add(m.route.id))}),x.size===0)return[];let g=_v(e,s,l.unstable_trailingSlashAwareDataRequests,"data");return E&&x.size>0&&g.searchParams.set("_routes",t.filter(m=>x.has(m.route.id)).map(m=>m.route.id).join(",")),[g.pathname+g.search]},[s,l.unstable_trailingSlashAwareDataRequests,u,i,a,d,t,e,r]),p=b.useMemo(()=>jC(f,a),[f,a]),y=MC(f);return b.createElement(b.Fragment,null,h.map(x=>b.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),p.map(x=>b.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),y.map(({key:x,link:E})=>b.createElement("link",{key:x,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function IC(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var HC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{HC&&(window.__reactRouterVersion="7.14.0")}catch{}function qC({basename:e,children:t,unstable_useTransitions:n,window:i}){let l=b.useRef();l.current==null&&(l.current=yE({window:i,v5Compat:!0}));let a=l.current,[r,s]=b.useState({action:a.action,location:a.location}),u=b.useCallback(c=>{n===!1?s(c):b.startTransition(()=>s(c))},[n]);return b.useLayoutEffect(()=>a.listen(u),[a,u]),b.createElement(mC,{basename:e,children:t,location:r.location,navigationType:r.action,navigator:a,unstable_useTransitions:n})}var Rv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pi=b.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:l,reloadDocument:a,replace:r,unstable_mask:s,state:u,target:c,to:d,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:p,...y},x){let{basename:E,navigator:g,unstable_useTransitions:m}=b.useContext(Rt),v=typeof d=="string"&&Rv.test(d),C=bv(d,E);d=C.to;let A=$E(d,{relative:l}),N=rt(),_=null;if(s){let V=Co(s,[],N.unstable_mask?N.unstable_mask.pathname:"/",!0);E!=="/"&&(V.pathname=V.pathname==="/"?E:pn([E,V.pathname])),_=g.createHref(V)}let[U,D,T]=zC(i,y),M=VC(d,{replace:r,unstable_mask:s,state:u,target:c,preventScrollReset:f,relative:l,viewTransition:h,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m});function q(V){t&&t(V),V.defaultPrevented||M(V)}let P=!(C.isExternal||a),F=b.createElement("a",{...y,...T,href:(P?_:void 0)||C.absoluteURL||A,onClick:P?q:t,ref:IC(x,D),target:c,"data-discover":!v&&n==="render"?"true":void 0});return U&&!v?b.createElement(b.Fragment,null,F,b.createElement(LC,{page:A})):F});Pi.displayName="Link";var Fc=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:l=!1,style:a,to:r,viewTransition:s,children:u,...c},d){let f=Er(r,{relative:c.relative}),h=rt(),p=b.useContext(To),{navigator:y,basename:x}=b.useContext(Rt),E=p!=null&&KC(f)&&s===!0,g=y.encodeLocation?y.encodeLocation(f).pathname:f.pathname,m=h.pathname,v=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(m=m.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&x&&(v=Hn(v,x)||v);const C=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let A=m===g||!l&&m.startsWith(g)&&m.charAt(C)==="/",N=v!=null&&(v===g||!l&&v.startsWith(g)&&v.charAt(g.length)==="/"),_={isActive:A,isPending:N,isTransitioning:E},U=A?t:void 0,D;typeof i=="function"?D=i(_):D=[i,A?"active":null,N?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let T=typeof a=="function"?a(_):a;return b.createElement(Pi,{...c,"aria-current":U,className:D,ref:d,style:T,to:r,viewTransition:s},typeof u=="function"?u(_):u)});Fc.displayName="NavLink";var FC=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:l,state:a,method:r=ms,action:s,onSubmit:u,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:h,...p},y)=>{let{unstable_useTransitions:x}=b.useContext(Rt),E=QC(),g=ZC(s,{relative:c}),m=r.toLowerCase()==="get"?"get":"post",v=typeof s=="string"&&Rv.test(s),C=A=>{if(u&&u(A),A.defaultPrevented)return;A.preventDefault();let N=A.nativeEvent.submitter,_=(N==null?void 0:N.getAttribute("formmethod"))||r,U=()=>E(N||A.currentTarget,{fetcherKey:t,method:_,navigate:n,replace:l,state:a,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:h});x&&n!==!1?b.startTransition(()=>U()):U()};return b.createElement("form",{ref:y,method:m,action:g,onSubmit:i?u:C,...p,"data-discover":!v&&e==="render"?"true":void 0})});FC.displayName="Form";function GC(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ov(e){let t=b.useContext(ea);return Ne(t,GC(e)),t}function VC(e,{target:t,replace:n,unstable_mask:i,state:l,preventScrollReset:a,relative:r,viewTransition:s,unstable_defaultShouldRevalidate:u,unstable_useTransitions:c}={}){let d=Je(),f=rt(),h=Er(e,{relative:r});return b.useCallback(p=>{if(SC(p,t)){p.preventDefault();let y=n!==void 0?n:lr(f)===lr(h),x=()=>d(e,{replace:y,unstable_mask:i,state:l,preventScrollReset:a,relative:r,viewTransition:s,unstable_defaultShouldRevalidate:u});c?b.startTransition(()=>x()):x()}},[f,d,h,n,i,l,t,e,a,r,s,u,c])}function YC(e){Yt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=b.useRef(qc(e)),n=b.useRef(!1),i=rt(),l=b.useMemo(()=>EC(i.search,n.current?null:t.current),[i.search]),a=Je(),r=b.useCallback((s,u)=>{const c=qc(typeof s=="function"?s(new URLSearchParams(l)):s);n.current=!0,a("?"+c,u)},[a,l]);return[l,r]}var PC=0,XC=()=>`__${String(++PC)}__`;function QC(){let{router:e}=Ov("useSubmit"),{basename:t}=b.useContext(Rt),n=cC(),i=e.fetch,l=e.navigate;return b.useCallback(async(a,r={})=>{let{action:s,method:u,encType:c,formData:d,body:f}=kC(a,t);if(r.navigate===!1){let h=r.fetcherKey||XC();await i(h,n,r.action||s,{unstable_defaultShouldRevalidate:r.unstable_defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:d,body:f,formMethod:r.method||u,formEncType:r.encType||c,flushSync:r.flushSync})}else await l(r.action||s,{unstable_defaultShouldRevalidate:r.unstable_defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:d,body:f,formMethod:r.method||u,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,l,t,n])}function ZC(e,{relative:t}={}){let{basename:n}=b.useContext(Rt),i=b.useContext(Pt);Ne(i,"useFormAction must be used inside a RouteContext");let[l]=i.matches.slice(-1),a={...Er(e||".",{relative:t})},r=rt();if(e==null){a.search=r.search;let s=new URLSearchParams(a.search),u=s.getAll("index");if(u.some(d=>d==="")){s.delete("index"),u.filter(f=>f).forEach(f=>s.append("index",f));let d=s.toString();a.search=d?`?${d}`:""}}return(!e||e===".")&&l.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:pn([n,a.pathname])),lr(a)}function KC(e,{relative:t}={}){let n=b.useContext(Cv);Ne(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Ov("useViewTransitionState"),l=Er(e,{relative:t});if(!n.isTransitioning)return!1;let a=Hn(n.currentLocation.pathname,i)||n.currentLocation.pathname,r=Hn(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Js(l.pathname,r)!=null||Js(l.pathname,a)!=null}const $C="/beta";class Dp extends Error{constructor(n,i,l){super(l);ll(this,"url");ll(this,"status");ll(this,"statusText");ll(this,"body");ll(this,"request");this.name="ApiError",this.url=i.url,this.status=i.status,this.statusText=i.statusText,this.body=i.body,this.request=n}}class JC extends Error{constructor(t){super(t),this.name="CancelError"}get isCancelled(){return!0}}var on,un,$t,ti,Li,Ol,ni;class WC{constructor(t){Yn(this,on);Yn(this,un);Yn(this,$t);Yn(this,ti);Yn(this,Li);Yn(this,Ol);Yn(this,ni);Qt(this,on,!1),Qt(this,un,!1),Qt(this,$t,!1),Qt(this,ti,[]),Qt(this,Li,new Promise((n,i)=>{Qt(this,Ol,n),Qt(this,ni,i);const l=s=>{fe(this,on)||fe(this,un)||fe(this,$t)||(Qt(this,on,!0),fe(this,Ol)&&fe(this,Ol).call(this,s))},a=s=>{fe(this,on)||fe(this,un)||fe(this,$t)||(Qt(this,un,!0),fe(this,ni)&&fe(this,ni).call(this,s))},r=s=>{fe(this,on)||fe(this,un)||fe(this,$t)||fe(this,ti).push(s)};return Object.defineProperty(r,"isResolved",{get:()=>fe(this,on)}),Object.defineProperty(r,"isRejected",{get:()=>fe(this,un)}),Object.defineProperty(r,"isCancelled",{get:()=>fe(this,$t)}),t(l,a,r)}))}get[Symbol.toStringTag](){return"Cancellable Promise"}then(t,n){return fe(this,Li).then(t,n)}catch(t){return fe(this,Li).catch(t)}finally(t){return fe(this,Li).finally(t)}cancel(){if(!(fe(this,on)||fe(this,un)||fe(this,$t))){if(Qt(this,$t,!0),fe(this,ti).length)try{for(const t of fe(this,ti))t()}catch(t){console.warn("Cancellation threw an error",t);return}fe(this,ti).length=0,fe(this,ni)&&fe(this,ni).call(this,new JC("Request aborted"))}}get isCancelled(){return fe(this,$t)}}on=new WeakMap,un=new WeakMap,$t=new WeakMap,ti=new WeakMap,Li=new WeakMap,Ol=new WeakMap,ni=new WeakMap;const B={BASE:"",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var zp;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatus||(e.taskStatus={})),(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatusBeforeClaim||(e.taskStatusBeforeClaim={}))})(zp||(zp={}));var Lp;(function(e){(function(t){t.HUMAN="human",t.AGENT="agent"})(e.type||(e.type={}))})(Lp||(Lp={}));var Mp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Mp||(Mp={}));var Bp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Bp||(Bp={}));var Up;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Up||(Up={}));var Ip;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})(Ip||(Ip={}));var rn;(function(e){(function(t){t.NOT_STARTED="not_started",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.MCP_AUTH_FLOW_STARTED="mcp_auth_flow_started",t.MCP_AUTH_FLOW_COMPLETED="mcp_auth_flow_completed",t.CONNECTIONS_FLOW_STARTED="connections_flow_started",t.CONNECTIONS_FLOW_COMPLETED="connections_flow_completed",t.AUTHORIZATION_CODE_ISSUED="authorization_code_issued",t.AUTHORIZATION_CODE_EXCHANGED="authorization_code_exchanged"})(e.status||(e.status={}))})(rn||(rn={}));var Hp;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.status||(e.status={}))})(Hp||(Hp={}));var qp;(function(e){(function(t){t.OPENAI="openai",t.ADK="adk"})(e.type||(e.type={}))})(qp||(qp={}));var Fp;(function(e){(function(t){t.NONE="none",t.CLIENT_SECRET_BASIC="client_secret_basic"})(e.token_endpoint_auth_method||(e.token_endpoint_auth_method={}))})(Fp||(Fp={}));var Kn;(function(e){(function(t){t.PENDING="pending",t.AUTHORIZED="authorized",t.FAILED="failed"})(e.status||(e.status={}))})(Kn||(Kn={}));var Gp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Gp||(Gp={}));var Vp;(function(e){(function(t){t.OPENAI="openai",t.ADK="adk"})(e.type||(e.type={}))})(Vp||(Vp={}));var Gc;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})(Gc||(Gc={}));var Yp;(function(e){(function(t){t.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",t.CLIENT_REGISTERED="CLIENT_REGISTERED",t.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",t.USER_CONSENT_OK="USER_CONSENT_OK",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",t.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",t.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(e.status||(e.status={}))})(Yp||(Yp={}));var Pp;(function(e){(function(t){t.TASK="task",t.CONTEXT_BLOCK="context_block",t.AGENT="agent",t.PROJECT="project",t.TAG="tag",t.TOOL="tool"})(e.type||(e.type={}))})(Pp||(Pp={}));var Xp;(function(e){(function(t){t.ACCESS_TOKEN="access_token",t.REFRESH_TOKEN="refresh_token"})(e.token_type_hint||(e.token_type_hint={}))})(Xp||(Xp={}));var Qp;(function(e){(function(t){t.BEARER="Bearer"})(e.token_type||(e.token_type={}))})(Qp||(Qp={}));var Ia;(function(e){(function(t){t.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",t.CLIENT_REGISTERED="CLIENT_REGISTERED",t.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",t.USER_CONSENT_OK="USER_CONSENT_OK",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",t.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",t.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(e.status||(e.status={}))})(Ia||(Ia={}));var Zp;(function(e){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(e.type||(e.type={}))})(Zp||(Zp={}));var Kp;(function(e){(function(t){t.NONE="none",t.CLIENT_SECRET_BASIC="client_secret_basic"})(e.token_endpoint_auth_method||(e.token_endpoint_auth_method={}))})(Kp||(Kp={}));var $p;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})($p||($p={}));var Jp;(function(e){(function(t){t.SUCCEEDED="SUCCEEDED",t.FAILED="FAILED",t.STALE="STALE",t.CANCELLED="CANCELLED"})(e.status||(e.status={})),(function(t){t.OUT_OF_QUOTA="OUT_OF_QUOTA",t.INTERRUPTED="INTERRUPTED",t.UNKNOWN="UNKNOWN"})(e.errorCode||(e.errorCode={}))})(Jp||(Jp={}));var Wp;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatus||(e.taskStatus={})),(function(t){t.SUCCEEDED="SUCCEEDED",t.FAILED="FAILED",t.STALE="STALE",t.CANCELLED="CANCELLED"})(e.status||(e.status={})),(function(t){t.OUT_OF_QUOTA="OUT_OF_QUOTA",t.INTERRUPTED="INTERRUPTED",t.UNKNOWN="UNKNOWN"})(e.errorCode||(e.errorCode={}))})(Wp||(Wp={}));var em;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.taskStatus||(e.taskStatus={}))})(em||(em={}));var Vc;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.status||(e.status={}))})(Vc||(Vc={}));var tm;(function(e){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(e.status||(e.status={}))})(tm||(tm={}));var nm;(function(e){(function(t){t.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE="urn:ietf:params:oauth:grant-type:token-exchange"})(e.grant_type||(e.grant_type={})),(function(t){t.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN="urn:ietf:params:oauth:token-type:access_token"})(e.subject_token_type||(e.subject_token_type={}))})(nm||(nm={}));var im;(function(e){(function(t){t.AUTHORIZATION_CODE="authorization_code",t.REFRESH_TOKEN="refresh_token"})(e.grant_type||(e.grant_type={}))})(im||(im={}));var lm;(function(e){(function(t){t.BEARER="Bearer"})(e.token_type||(e.token_type={}))})(lm||(lm={}));var am;(function(e){(function(t){t.HTTP="http",t.STDIO="stdio"})(e.type||(e.type={}))})(am||(am={}));var rm;(function(e){(function(t){t.ADMIN="admin",t.STANDARD="standard"})(e.role||(e.role={})),(function(t){t.FULL_PAGE="FULL_PAGE",t.BANNER="BANNER",t.OFF="OFF"})(e.onboardingDisplayMode||(e.onboardingDisplayMode={}))})(rm||(rm={}));var sm;(function(e){(function(t){t.FULL_PAGE="FULL_PAGE",t.BANNER="BANNER",t.OFF="OFF"})(e.onboardingDisplayMode||(e.onboardingDisplayMode={}))})(sm||(sm={}));const bd=e=>e!=null,Cr=e=>typeof e=="string",Cu=e=>Cr(e)&&e!=="",Sd=e=>typeof e=="object"&&typeof e.type=="string"&&typeof e.stream=="function"&&typeof e.arrayBuffer=="function"&&typeof e.constructor=="function"&&typeof e.constructor.name=="string"&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag]),Dv=e=>e instanceof FormData,eT=e=>{try{return btoa(e)}catch{return Buffer.from(e).toString("base64")}},tT=e=>{const t=[],n=(l,a)=>{t.push(`${encodeURIComponent(l)}=${encodeURIComponent(String(a))}`)},i=(l,a)=>{bd(a)&&(Array.isArray(a)?a.forEach(r=>{i(l,r)}):typeof a=="object"?Object.entries(a).forEach(([r,s])=>{i(`${l}[${r}]`,s)}):n(l,a))};return Object.entries(e).forEach(([l,a])=>{i(l,a)}),t.length>0?`?${t.join("&")}`:""},nT=(e,t)=>{const n=e.ENCODE_PATH||encodeURI,i=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,(a,r)=>{var s;return(s=t.path)!=null&&s.hasOwnProperty(r)?n(String(t.path[r])):a}),l=`${e.BASE}${i}`;return t.query?`${l}${tT(t.query)}`:l},iT=e=>{if(e.formData){const t=new FormData,n=(i,l)=>{Cr(l)||Sd(l)?t.append(i,l):t.append(i,JSON.stringify(l))};return Object.entries(e.formData).filter(([i,l])=>bd(l)).forEach(([i,l])=>{Array.isArray(l)?l.forEach(a=>n(i,a)):n(i,l)}),t}},Pr=async(e,t)=>typeof t=="function"?t(e):t,lT=async(e,t)=>{const[n,i,l,a]=await Promise.all([Pr(t,e.TOKEN),Pr(t,e.USERNAME),Pr(t,e.PASSWORD),Pr(t,e.HEADERS)]),r=Object.entries({Accept:"application/json",...a,...t.headers}).filter(([s,u])=>bd(u)).reduce((s,[u,c])=>({...s,[u]:String(c)}),{});if(Cu(n)&&(r.Authorization=`Bearer ${n}`),Cu(i)&&Cu(l)){const s=eT(`${i}:${l}`);r.Authorization=`Basic ${s}`}return t.body!==void 0&&(t.mediaType?r["Content-Type"]=t.mediaType:Sd(t.body)?r["Content-Type"]=t.body.type||"application/octet-stream":Cr(t.body)?r["Content-Type"]="text/plain":Dv(t.body)||(r["Content-Type"]="application/json")),new Headers(r)},aT=e=>{var t;if(e.body!==void 0)return(t=e.mediaType)!=null&&t.includes("/json")?JSON.stringify(e.body):Cr(e.body)||Sd(e.body)||Dv(e.body)?e.body:JSON.stringify(e.body)},rT=async(e,t,n,i,l,a,r)=>{const s=new AbortController,u={headers:a,body:i??l,method:t.method,signal:s.signal};return e.WITH_CREDENTIALS&&(u.credentials=e.CREDENTIALS),r(()=>s.abort()),await fetch(n,u)},sT=(e,t)=>{if(t){const n=e.headers.get(t);if(Cr(n))return n}},oT=async e=>{if(e.status!==204)try{const t=e.headers.get("Content-Type");if(t)return["application/json","application/problem+json"].some(l=>t.toLowerCase().startsWith(l))?await e.json():await e.text()}catch(t){console.error(t)}},uT=(e,t)=>{const i={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...e.errors}[t.status];if(i)throw new Dp(e,t,i);if(!t.ok){const l=t.status??"unknown",a=t.statusText??"unknown",r=(()=>{try{return JSON.stringify(t.body,null,2)}catch{return}})();throw new Dp(e,t,`Generic Error: status: ${l}; status text: ${a}; body: ${r}`)}},I=(e,t)=>new WC(async(n,i,l)=>{try{const a=nT(e,t),r=iT(t),s=aT(t),u=await lT(e,t);if(!l.isCancelled){const c=await rT(e,t,a,s,r,u,l),d=await oT(c),f=sT(c,t.responseHeader),h={url:a,ok:c.ok,status:c.status,statusText:c.statusText,body:f??d};uT(t,h),n(h.body)}}catch(a){i(a)}});class Tu{static agentsControllerCreateAgent(t,n=B){return I(n,{method:"POST",url:"/api/v1/agents",body:t,mediaType:"application/json"})}static agentsControllerListAgents(t,n=1,i=20,l=B){return I(l,{method:"GET",url:"/api/v1/agents",query:{isActive:t,page:n,limit:i}})}static agentsControllerListAgentTemplates(t=B){return I(t,{method:"GET",url:"/api/v1/agents/templates"})}static agentsControllerGetAgentBySlug(t,n=B){return I(n,{method:"GET",url:"/api/v1/agents/{slug}",path:{slug:t}})}static agentsControllerPatchAgent(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/agents/{actorId}",path:{actorId:t},body:n,mediaType:"application/json"})}static agentsControllerDeleteAgent(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/agents/{actorId}",path:{actorId:t}})}static agentToolPermissionsControllerListAgentToolPermissions(t,n=B){return I(n,{method:"GET",url:"/api/v1/agents/{actorId}/tool-permissions",path:{actorId:t}})}static agentToolPermissionsControllerUpsertAgentToolPermission(t,n,i,l=B){return I(l,{method:"PUT",url:"/api/v1/agents/{actorId}/tool-permissions/{serverId}",path:{actorId:t,serverId:n},body:i,mediaType:"application/json"})}static agentToolPermissionsControllerDeleteAgentToolPermission(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/agents/{actorId}/tool-permissions/{serverId}",path:{actorId:t,serverId:n}})}}class cT{static authJourneysControllerGetAuthJourneys(t,n=B){return I(n,{method:"GET",url:"/api/v1/auth-journeys/servers/{serverId}",path:{serverId:t},errors:{404:"Server not found"}})}}class fT{static clientRegistrationControllerRegisterClient(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/clients/register/mcp/{serverId}/{version}",path:{serverId:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid client metadata (missing fields, invalid redirect URIs, unsupported grant types, or PKCE not configured)",409:"A client with this name is already registered"}})}static clientRegistrationControllerGetClient(t,n=B){return I(n,{method:"GET",url:"/api/v1/auth/clients/{clientId}",path:{clientId:t},errors:{404:"Client not found"}})}static clientRegistrationControllerListClients(t=B){return I(t,{method:"GET",url:"/api/v1/auth/clients"})}static authorizationControllerAuthorize(t,n,i,l,a,r,s,u,c,d,f=B){return I(f,{method:"GET",url:"/api/v1/auth/authorize/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:s,version:u},query:{response_type:t,scope:c,client_id:n,code_challenge:i,code_challenge_method:l,redirect_uri:a,state:r,resource:d},errors:{302:"Redirects to consent screen with authorization request ID",400:"Invalid authorization request parameters",404:"MCP server or client not found"}})}static authorizationControllerAuthorizeConsent(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/authorize/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{302:"Redirects to client redirect_uri with authorization code or error",400:"Invalid consent decision or flow state",401:"Authorization flow has already been used",404:"Authorization flow not found"}})}static authorizationControllerGetConsentMetadata(t,n=B){return I(n,{method:"GET",url:"/api/v1/auth/consent/{flowId}",path:{flowId:t},errors:{401:"Authentication required to access consent metadata",404:"Authorization flow not found"}})}static authorizationControllerToken(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/token/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid token request parameters",401:"Invalid authorization code, code_verifier, or expired code"}})}static authorizationControllerIntrospect(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/introspect/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid introspection request parameters"}})}static authorizationControllerTokenExchange(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/auth/token-exchange/mcp/{serverIdentifier}/{version}",path:{serverIdentifier:t,version:n},body:i,mediaType:"application/json",errors:{400:"Invalid token exchange request parameters",401:"Invalid or expired MCP JWT",403:"Insufficient scope - requested scope not entitled",404:"Connection not found"}})}static authorizationControllerCallback(t,n,i,l,a,r=B){return I(r,{method:"GET",url:"/api/v1/auth/callback",query:{code:t,state:n,error:i,scope:l,error_description:a},errors:{302:"Redirects to next step in the authorization flow",400:"Invalid callback parameters or state",404:"Connection flow not found for provided state"}})}static authorizationControllerGetScopes(t=B){return I(t,{method:"GET",url:"/api/v1/auth/scopes"})}}class Kt{static contextControllerCreateBlock(t,n=B){return I(n,{method:"POST",url:"/api/v1/context/blocks",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static contextControllerListBlocks(t,n=B){return I(n,{method:"GET",url:"/api/v1/context/blocks",query:{tag:t}})}static contextControllerSearchBlocks(t,n=10,i=.3,l=B){return I(l,{method:"GET",url:"/api/v1/context/blocks/search/query",query:{query:t,limit:n,threshold:i}})}static contextControllerGetBlockTree(t=B){return I(t,{method:"GET",url:"/api/v1/context/blocks/tree"})}static contextControllerExportBlocks(t=B){return I(t,{method:"GET",url:"/api/v1/context/blocks/export"})}static contextControllerImportBlocks(t,n=B){return I(n,{method:"POST",url:"/api/v1/context/blocks/import",formData:t,mediaType:"multipart/form-data",errors:{400:"No archive file uploaded or invalid file type"}})}static contextControllerGetBlock(t,n=B){return I(n,{method:"GET",url:"/api/v1/context/blocks/{id}",path:{id:t}})}static contextControllerUpdateBlock(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/context/blocks/{id}",path:{id:t},body:n,mediaType:"application/json",errors:{400:"No update fields provided"}})}static contextControllerDeleteBlock(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/context/blocks/{id}",path:{id:t}})}static contextControllerAppendToBlock(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/context/blocks/{id}/append",path:{id:t},body:n,mediaType:"application/json"})}static contextControllerReorderBlock(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/context/blocks/{id}/reorder",path:{id:t},body:n,mediaType:"application/json"})}static contextControllerMoveBlock(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/context/blocks/{id}/move",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Circular reference detected or parent not found"}})}static contextControllerAddTagToBlock(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/context/blocks/{id}/tags",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data"}})}static contextControllerRemoveTagFromBlock(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/context/blocks/{id}/tags/{tagId}",path:{id:t,tagId:n}})}static contextControllerHandleMcpGet(t=B){return I(t,{method:"GET",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpPost(t=B){return I(t,{method:"POST",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpPut(t=B){return I(t,{method:"PUT",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpDelete(t=B){return I(t,{method:"DELETE",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpPatch(t=B){return I(t,{method:"PATCH",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpOptions(t=B){return I(t,{method:"OPTIONS",url:"/api/v1/context/blocks/mcp"})}static contextControllerHandleMcpHead(t=B){return I(t,{method:"HEAD",url:"/api/v1/context/blocks/mcp"})}}class zv{static metaControllerCreateTag(t,n=B){return I(n,{method:"POST",url:"/api/v1/meta/tags",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static metaControllerGetAllTags(t=B){return I(t,{method:"GET",url:"/api/v1/meta/tags"})}static metaControllerGetTagColors(t=B){return I(t,{method:"GET",url:"/api/v1/meta/tags/colors"})}static metaControllerDeleteTag(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/meta/tags/{tagId}",path:{tagId:t},errors:{404:"Tag not found"}})}}class en{static tasksControllerCreateTask(t,n=B){return I(n,{method:"POST",url:"/api/v1/tasks/tasks",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static tasksControllerListTasks(t,n,i,l=1,a=20,r=B){return I(r,{method:"GET",url:"/api/v1/tasks/tasks",query:{assignee:t,sessionId:n,tag:i,page:l,limit:a}})}static tasksControllerUpdateTask(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerDeleteTask(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/tasks/tasks/{id}",path:{id:t},errors:{404:"Task not found"}})}static tasksControllerGetTask(t,n=B){return I(n,{method:"GET",url:"/api/v1/tasks/tasks/{id}",path:{id:t},errors:{404:"Task not found"}})}static tasksControllerAssignTask(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}/assign",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerAssignTaskToMe(t,n=B){return I(n,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}/assign-to-me",path:{id:t},errors:{404:"Task not found"}})}static tasksControllerSearchTasks(t,n=10,i=.3,l=B){return I(l,{method:"GET",url:"/api/v1/tasks/tasks/search/query",query:{query:t,limit:n,threshold:i}})}static tasksControllerAddComment(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/comments",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerAddArtefact(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/artefacts",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerChangeStatus(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/tasks/tasks/{id}/status",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid status transition or comment required",404:"Task not found"}})}static tasksControllerAddTagToTask(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/tags",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerRemoveTagFromTask(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/tasks/tasks/{id}/tags/{tagId}",path:{id:t,tagId:n},errors:{404:"Task not found"}})}static tasksControllerCreateInputRequest(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/tasks/tasks/{id}/input-requests",path:{id:t},body:n,mediaType:"application/json",errors:{400:"Invalid input data",404:"Task not found"}})}static tasksControllerAnswerInputRequest(t,n,i,l=B){return I(l,{method:"POST",url:"/api/v1/tasks/tasks/{id}/input-requests/{inputRequestId}/answer",path:{id:t,inputRequestId:n},body:i,mediaType:"application/json",errors:{400:"Invalid input data",404:"Input request not found"}})}static tasksControllerHandleMcpGet(t=B){return I(t,{method:"GET",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpPost(t=B){return I(t,{method:"POST",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpPut(t=B){return I(t,{method:"PUT",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpDelete(t=B){return I(t,{method:"DELETE",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpPatch(t=B){return I(t,{method:"PATCH",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpOptions(t=B){return I(t,{method:"OPTIONS",url:"/api/v1/tasks/tasks/mcp"})}static tasksControllerHandleMcpHead(t=B){return I(t,{method:"HEAD",url:"/api/v1/tasks/tasks/mcp"})}}class ct{static mcpRegistryControllerCreateServer(t,n=B){return I(n,{method:"POST",url:"/api/v1/mcp/servers",body:t,mediaType:"application/json",errors:{409:"Server with providedId already exists"}})}static mcpRegistryControllerListServers(t,n,i=B){return I(i,{method:"GET",url:"/api/v1/mcp/servers",query:{page:t,limit:n}})}static mcpRegistryControllerGetServer(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/servers/{serverId}",path:{serverId:t},errors:{404:"Server not found"}})}static mcpRegistryControllerUpdateServer(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/mcp/servers/{serverId}",path:{serverId:t},body:n,mediaType:"application/json",errors:{404:"Server not found"}})}static mcpRegistryControllerDeleteServer(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/mcp/servers/{serverId}",path:{serverId:t},errors:{404:"Server not found",409:"Server has dependencies"}})}static mcpRegistryControllerCreateScopes(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/mcp/servers/{serverId}/scopes",path:{serverId:t},body:n,mediaType:"application/json",errors:{404:"Server not found",409:"Scope already exists"}})}static mcpRegistryControllerListScopes(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/scopes",path:{serverId:t},errors:{404:"Server not found"}})}static mcpRegistryControllerGetScope(t,n,i=B){return I(i,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/scopes/{scopeId}",path:{serverId:t,scopeId:n},errors:{404:"Scope not found"}})}static mcpRegistryControllerDeleteScope(t,n,i=B){return I(i,{method:"DELETE",url:"/api/v1/mcp/servers/{serverId}/scopes/{scopeId}",path:{serverId:t,scopeId:n},errors:{404:"Scope not found",409:"Scope has mappings"}})}static mcpRegistryControllerCreateConnection(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/mcp/servers/{serverId}/connections",path:{serverId:t},body:n,mediaType:"application/json",errors:{404:"Server not found",409:"Connection name conflict"}})}static mcpRegistryControllerListConnections(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/connections",path:{serverId:t},errors:{404:"Server not found"}})}static mcpRegistryControllerGetConnection(t,n=B){return I(n,{method:"GET",url:"/api/v1/mcp/connections/{connectionId}",path:{connectionId:t},errors:{404:"Connection not found"}})}static mcpRegistryControllerUpdateConnection(t,n,i=B){return I(i,{method:"PATCH",url:"/api/v1/mcp/connections/{connectionId}",path:{connectionId:t},body:n,mediaType:"application/json",errors:{404:"Connection not found",409:"Connection name conflict"}})}static mcpRegistryControllerDeleteConnection(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/mcp/connections/{connectionId}",path:{connectionId:t},errors:{404:"Connection not found",409:"Connection has mappings"}})}static mcpRegistryControllerCreateMapping(t,n,i=B){return I(i,{method:"POST",url:"/api/v1/mcp/servers/{serverId}/mappings",path:{serverId:t},body:n,mediaType:"application/json",errors:{400:"Invalid mapping",404:"Scope or connection not found"}})}static mcpRegistryControllerListMappings(t,n,i=B){return I(i,{method:"GET",url:"/api/v1/mcp/servers/{serverId}/scopes/{scopeId}/mappings",path:{serverId:t,scopeId:n},errors:{404:"Scope not found"}})}static mcpRegistryControllerDeleteMapping(t,n=B){return I(n,{method:"DELETE",url:"/api/v1/mcp/mappings/{mappingId}",path:{mappingId:t},errors:{404:"Mapping not found"}})}}class ma{static webAuthControllerLogin(t,n=B){return I(n,{method:"POST",url:"/api/v1/auth/login",body:t,mediaType:"application/json",errors:{401:"Invalid credentials"}})}static webAuthControllerRefresh(t=B){return I(t,{method:"POST",url:"/api/v1/auth/refresh",errors:{401:"Invalid or expired refresh token"}})}static webAuthControllerLogout(t=B){return I(t,{method:"POST",url:"/api/v1/auth/logout"})}static webAuthControllerMe(t=B){return I(t,{method:"GET",url:"/api/v1/auth/me",errors:{401:"Not authenticated"}})}static webAuthControllerChangePassword(t,n=B){return I(n,{method:"POST",url:"/api/v1/auth/change-password",body:t,mediaType:"application/json",errors:{401:"Not authenticated or current password is incorrect"}})}static webAuthControllerGetOnboardingStatus(t=B){return I(t,{method:"GET",url:"/api/v1/auth/onboarding-status"})}static webAuthControllerOnboard(t,n=B){return I(n,{method:"POST",url:"/api/v1/auth/onboard",body:t,mediaType:"application/json",errors:{409:"Admin users already exist, onboarding not allowed"}})}static webAuthControllerMarkWalkthroughSeen(t=B){return I(t,{method:"POST",url:"/api/v1/auth/mark-walkthrough-seen",errors:{401:"Not authenticated"}})}}const Lv=()=>"",Mv=e=>e,el=Lv();B.BASE=el;B.CREDENTIALS="include";B.BASE=el;const Bv=b.createContext(void 0);function dT({children:e}){const[t,n]=b.useState(null),[i,l]=b.useState(!0);b.useEffect(()=>{ma.webAuthControllerMe().then(c=>{console.log("found me"),n(c)}).catch(()=>{console.log("not me"),n(null)}).finally(()=>{l(!1)})},[]),b.useEffect(()=>{if(!t)return;const c=setInterval(async()=>{try{const d=await ma.webAuthControllerRefresh();n(d.user)}catch(d){console.error("Token refresh failed:",d),n(null)}},480*1e3);return()=>clearInterval(c)},[t]);const u={user:t,isAuthenticated:!!t,isLoading:i,login:async(c,d)=>{const f=await ma.webAuthControllerLogin({email:c,password:d});n(f.user)},logout:async()=>{try{await ma.webAuthControllerLogout()}finally{n(null)}},refreshAuth:async()=>{const c=await ma.webAuthControllerRefresh();n(c.user)}};return o.jsx(Bv.Provider,{value:u,children:e})}function Ed(){const e=b.useContext(Bv);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function hT({children:e}){const{isAuthenticated:t,isLoading:n}=Ed(),i=rt();return n?o.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},children:o.jsx("div",{style:{color:"white",fontSize:"18px",fontWeight:"600"},children:"Loading..."})}):t?o.jsx(o.Fragment,{children:e}):o.jsx(pC,{to:"/login",state:{from:i},replace:!0})}function pT(){var p,y;const[e,t]=b.useState(""),[n,i]=b.useState(""),[l,a]=b.useState(""),[r,s]=b.useState(!1),{login:u}=Ed(),c=Je(),f=((y=(p=rt().state)==null?void 0:p.from)==null?void 0:y.pathname)||"/",h=async x=>{x.preventDefault(),s(!0),a("");try{await u(e,n),c(f,{replace:!0})}catch{a("Invalid email or password")}finally{s(!1)}};return o.jsx("div",{className:"login-page",children:o.jsx("div",{className:"login-container",children:o.jsxs("div",{className:"login-card",children:[o.jsxs("div",{className:"login-header",children:[o.jsx("h1",{className:"login-title",children:"Welcome Back"}),o.jsx("p",{className:"login-subtitle",children:"Sign in to your account"})]}),o.jsxs("form",{onSubmit:h,className:"login-form",children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"email",className:"form-label",children:"Email"}),o.jsx("input",{id:"email",type:"email",value:e,onChange:x=>t(x.target.value),className:"form-input",placeholder:"you@example.com",required:!0,disabled:r,autoComplete:"email"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"password",className:"form-label",children:"Password"}),o.jsx("input",{id:"password",type:"password",value:n,onChange:x=>i(x.target.value),className:"form-input",placeholder:"••••••••",required:!0,disabled:r,autoComplete:"current-password"})]}),l&&o.jsx("div",{className:"login-error",children:l}),o.jsx("button",{type:"submit",className:"login-button",disabled:r,children:r?"Signing in...":"Sign In"})]})]})})})}function mT({collapsed:e}){const t=[{name:"Home",path:"/",icon:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),o.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]})},{name:"Agents",path:"/agents",icon:"🤖"},{name:"Tasks",path:"/tasks",icon:"📋"},{name:"Context",path:"/context",icon:"📚"},{name:"Tools",path:"/mcp-registry",icon:"🔧"}];return o.jsxs("nav",{className:"sidebar-nav-container",children:[o.jsx("div",{className:"sidebar-nav-main",children:t.map(n=>o.jsxs(Fc,{to:n.path,className:({isActive:i})=>`sidebar-nav-link ${i?"active":""} ${e?"collapsed":""}`,end:n.path==="/",children:[o.jsx("div",{className:"sidebar-nav-icon",children:typeof n.icon=="string"?o.jsx("span",{children:n.icon}):n.icon}),o.jsx("span",{className:"nav-link-text",children:n.name})]},n.path))}),o.jsx("div",{className:"sidebar-nav-bottom",children:o.jsxs(Fc,{to:"/logout",className:({isActive:n})=>`sidebar-nav-link ${n?"active":""} ${e?"collapsed":""}`,end:!0,children:[o.jsx("div",{className:"sidebar-nav-icon",children:o.jsx("span",{children:"🔓"})}),o.jsx("span",{className:"nav-link-text",children:"Logout"})]},"213")})]})}const gT=768;function ar(){return window.innerWidth<gT}function yT(){const[e,t]=b.useState(()=>ar());return b.useEffect(()=>{const n=()=>{t(ar())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}const om="app-nav-collapsed";function xT(){const[e,t]=b.useState(()=>{const i=localStorage.getItem(om);return i!==null?i==="true":ar()});b.useEffect(()=>{localStorage.setItem(om,String(e))},[e]);const n=()=>{t(!e)};return o.jsxs("div",{className:"root-layout",children:[o.jsxs("aside",{className:`sidebar-app-nav ${e?"collapsed":""}`,children:[o.jsx("nav",{className:"sidebar-content",children:o.jsx(mT,{collapsed:e})}),o.jsx("button",{className:"sidebar-toggle",onClick:n,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:e?"→":"←"})]}),o.jsx("div",{className:"root-layout-main",children:o.jsx(md,{})})]})}function tl(e){const t=b.useRef(null);b.useEffect(()=>(t.current=document.title,document.title=e,()=>{t.current!==null&&(document.title=t.current)}),[e])}function vT(){tl("taico — Home");const e=[{name:"Tasks",description:"Manage and track your tasks across different stages with our Kanban board.",path:"/tasks",icon:"📋",color:"#3b82f6"},{name:"Context",description:"Create, edit, and organize your knowledge base with our wiki platform.",path:"/context",icon:"📚",color:"#10b981"},{name:"Tools",description:"Manage Model Context Protocol servers, scopes, and OAuth connections.",path:"/mcp-registry",icon:"🔧",color:"#8b5cf6"}];return o.jsx("div",{className:"home-page",children:o.jsxs("div",{className:"home-container",children:[o.jsxs("header",{className:"home-header",children:[o.jsx("h1",{className:"home-title",children:"taico"}),o.jsx("p",{className:"home-subtitle",children:"Your all-in-one platform for task management, knowledge organization, and protocol integration"})]}),o.jsx("div",{className:"apps-grid",children:e.map(t=>o.jsxs(Pi,{to:t.path,className:"app-card",style:{"--app-color":t.color},children:[o.jsx("div",{className:"app-icon",children:t.icon}),o.jsx("h2",{className:"app-name",children:t.name}),o.jsx("p",{className:"app-description",children:t.description}),o.jsx("div",{className:"app-arrow",children:"→"})]},t.path))}),o.jsx("footer",{className:"home-footer",children:o.jsx("p",{children:"Built with React + TypeScript + Vite"})})]})})}const Uv=({tag:e,onRemove:t,small:n=!1})=>{const i=e.color||"#6B7280";return o.jsxs("span",{className:`tag-badge ${n?"tag-badge-small":""}`,style:{backgroundColor:i,color:"#ffffff",padding:n?"1px 4px":"2px 6px",borderRadius:"3px",fontSize:n?"0.65rem":"0.7rem",fontWeight:"500",display:"inline-flex",alignItems:"center",gap:"2px",marginRight:"4px",marginBottom:"4px"},children:[e.name,t&&o.jsx("button",{onClick:l=>{l.stopPropagation(),t()},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:n?"0.75rem":"0.85rem",lineHeight:"1"},"aria-label":`Remove ${e.name} tag`,children:"×"})]})};function bT({task:e,onClick:t}){var l,a;const n=r=>{const s=new Date(r);return(new Date().getTime()-s.getTime())/(1e3*60*60)<24?s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):s.toLocaleDateString("en-US",{month:"short",day:"numeric"})},i=((l=e.comments)==null?void 0:l.length)??0;return o.jsxs("div",{className:"task-card",onClick:t,children:[o.jsx("h3",{className:"task-card-title",children:e.name}),o.jsx("p",{className:"task-card-description",children:e.description}),e.tags&&e.tags.length>0&&o.jsx("div",{style:{marginTop:"8px",marginBottom:"8px"},children:e.tags.map(r=>o.jsx(Uv,{tag:r,small:!0},r.name))}),o.jsx("div",{className:"task-card-divider"}),o.jsxs("div",{className:"task-card-footer",children:[o.jsxs("div",{className:"task-card-assignee",children:[e.assignee?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"assignee-emoji",children:"👤"}),o.jsx("span",{className:"assignee-name",children:((a=e.assigneeActor)==null?void 0:a.displayName)||"unassigned"})]}):o.jsx("span",{className:"unassigned-text",children:"Unassigned"}),i>0?o.jsxs("span",{className:"comment-count","aria-label":`${i} comments`,children:["💬 ",i]}):null]}),o.jsx("div",{className:"task-card-date",children:n(e.updatedAt)})]})]})}B.BASE=el;function Iv(){const[e,t]=b.useState([]),n=b.useCallback((l,a="info")=>{const r=Date.now();t(s=>[...s,{id:r,message:l,type:a}])},[]),i=b.useCallback(l=>{t(a=>a.filter(r=>r.id!==l))},[]);return{toasts:e,showToast:n,removeToast:i}}function Hv({message:e,type:t="info",onClose:n,duration:i=3e3}){return b.useEffect(()=>{const l=setTimeout(n,i);return()=>clearTimeout(l)},[n,i]),o.jsxs("div",{className:`toast toast-${t}`,children:[o.jsx("span",{children:e}),o.jsx("button",{onClick:n,className:"toast-close","aria-label":"Close",children:"×"})]})}const Cd=({value:e,onChange:t,placeholder:n="Type to add tags..."})=>{const[i,l]=b.useState(""),[a,r]=b.useState([]),[s,u]=b.useState(!1),[c,d]=b.useState(-1),[f,h]=b.useState([]),p=b.useRef(null),y=b.useRef(null);b.useEffect(()=>{(async()=>{try{const v=await zv.metaControllerGetAllTags();h(v)}catch(v){console.error("Failed to load tags:",v)}})()},[]),b.useEffect(()=>{const v=setTimeout(()=>{if(i.trim().length>0){const C=i.trim().toLowerCase(),A=f.filter(N=>N.name.toLowerCase().includes(C)&&!e.includes(N.name));r(A),u(!0)}else r([]),u(!1)},150);return()=>clearTimeout(v)},[i,e,f]),b.useEffect(()=>{const m=v=>{y.current&&!y.current.contains(v.target)&&u(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const x=m=>{var C;const v=m.trim();v&&!e.includes(v)&&t([...e,v]),l(""),r([]),u(!1),d(-1),(C=p.current)==null||C.focus()},E=m=>{t(e.filter(v=>v!==m))},g=m=>{m.key==="Tab"&&i.trim()||m.key==="Enter"&&i.trim()?(m.preventDefault(),c>=0&&a[c]?x(a[c].name):x(i)):m.key==="ArrowDown"?(m.preventDefault(),d(v=>v<a.length-1?v+1:v)):m.key==="ArrowUp"?(m.preventDefault(),d(v=>v>0?v-1:-1)):m.key==="Escape"?(u(!1),d(-1)):m.key==="Backspace"&&!i&&e.length>0&&t(e.slice(0,-1))};return o.jsxs("div",{ref:y,style:{position:"relative"},children:[o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",padding:"6px",border:"1px solid #ddd",borderRadius:"4px",minHeight:"38px",cursor:"text"},onClick:()=>{var m;return(m=p.current)==null?void 0:m.focus()},children:[e.map(m=>{const v=f.find(A=>A.name===m),C=(v==null?void 0:v.color)||"#3B82F6";return o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",backgroundColor:C,color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"0.7rem",fontWeight:"500"},children:[m,o.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),E(m)},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:"0.85rem",lineHeight:"1"},children:"×"})]},m)}),o.jsx("input",{ref:p,type:"text",value:i,onChange:m=>l(m.target.value),onKeyDown:g,onFocus:()=>i&&u(!0),placeholder:e.length===0?n:"",style:{flex:"1",minWidth:"120px",border:"none",outline:"none",fontSize:"0.875rem",padding:"2px"}})]}),s&&a.length>0&&o.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3},children:a.map((m,v)=>o.jsxs("div",{onClick:()=>x(m.name),style:{padding:"8px 12px",cursor:"pointer",backgroundColor:v===c?"#EFF6FF":"white",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:()=>d(v),children:[o.jsx("span",{style:{width:"12px",height:"12px",borderRadius:"2px",backgroundColor:m.color||"#6B7280"}}),o.jsx("span",{style:{fontSize:"0.875rem"},children:m.name})]},m.name))}),s&&i&&a.length===0&&o.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",padding:"8px 12px",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3,fontSize:"0.875rem",color:"#6B7280"},children:['Press Tab or Enter to create "',i,'"']})]})};function ST({key:e,defaultValue:t,debounceMs:n=500}){const[i,l]=b.useState(()=>{try{const s=localStorage.getItem(e);if(s)return JSON.parse(s)}catch(s){console.error("Error loading draft from localStorage:",s)}return t}),a=b.useRef(void 0);return b.useEffect(()=>(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{try{localStorage.setItem(e,JSON.stringify(i))}catch(s){console.error("Error saving draft to localStorage:",s)}},n),()=>{a.current&&clearTimeout(a.current)}),[i,e,n]),[i,l,()=>{try{localStorage.removeItem(e),l(t)}catch(s){console.error("Error clearing draft from localStorage:",s)}}]}const ET={name:"",description:"",assignee:"",sessionId:"",tagNames:[],dependsOnIds:[]};function CT({onClose:e}){const{toasts:t,showToast:n,removeToast:i}=Iv(),[l,a,r]=ST({key:"create-task-draft",defaultValue:ET}),[s,u]=b.useState(!1),{name:c,description:d,assignee:f,sessionId:h,tagNames:p,dependsOnIds:y}=l,x=(g,m)=>{a({...l,[g]:m})};b.useEffect(()=>{const g=m=>{m.key==="Escape"&&e()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[e]);const E=async g=>{var m;g.preventDefault(),u(!0);try{await en.tasksControllerCreateTask({name:c,description:d,...f&&{assignee:f},...h&&{sessionId:h},...p.length>0&&{tagNames:p},...y.length>0&&{dependsOnIds:y}}),r(),e()}catch(v){const C=((m=v==null?void 0:v.body)==null?void 0:m.detail)||(v==null?void 0:v.message)||"Failed to create task";n(`Error: ${C}`,"error"),console.error(v)}finally{u(!1)}};return o.jsx("div",{className:"modal-overlay",onClick:e,children:o.jsxs("div",{className:"modal-content",onClick:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:"Create New Task"}),o.jsx("button",{onClick:e,className:"btn-close",children:"×"})]}),o.jsxs("form",{onSubmit:E,children:[o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"name",children:"Title *"}),o.jsx("input",{id:"name",type:"text",value:c,onChange:g=>x("name",g.target.value),required:!0,placeholder:"Enter task name"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"description",children:"Description *"}),o.jsx("textarea",{id:"description",value:d,onChange:g=>x("description",g.target.value),required:!0,placeholder:"Enter task description",rows:4})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"assignee",children:"Assigned to"}),o.jsx("input",{id:"assignee",type:"text",value:f,onChange:g=>x("assignee",g.target.value),placeholder:"Agent name or assignee"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"sessionId",children:"Session ID"}),o.jsx("input",{id:"sessionId",type:"text",value:h,onChange:g=>x("sessionId",g.target.value),placeholder:"Agent session ID"})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"tags",children:"Tags"}),o.jsx(Cd,{value:p,onChange:g=>x("tagNames",g),placeholder:"Type to add tags..."})]}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"dependsOn",children:"Depends On (Task IDs)"}),o.jsx("input",{id:"dependsOn",type:"text",value:y.join(", "),onChange:g=>x("dependsOnIds",g.target.value.split(",").map(m=>m.trim()).filter(m=>m)),placeholder:"Enter task IDs separated by commas"})]}),o.jsxs("div",{className:"form-actions",children:[o.jsx("button",{type:"button",onClick:e,className:"btn-secondary",children:"Cancel"}),o.jsx("button",{type:"submit",className:"btn-primary",disabled:s,children:s?"Creating...":"Create Task"})]})]}),t.map(g=>o.jsx(Hv,{message:g.message,type:g.type,onClose:()=>i(g.id)},g.id))]})})}const re=Vc.status;function qv({task:e,onClose:t,onUpdate:n}){var D,T,M,q;const[i,l]=b.useState(e.description),[a,r]=b.useState((D=e.assigneeActor)==null?void 0:D.id),[s,u]=b.useState(e.sessionId||""),[c,d]=b.useState(((T=e.tags)==null?void 0:T.map(P=>P.name))||[]),[f,h]=b.useState(""),[p,y]=b.useState(""),[x,E]=b.useState(!1),[g,m]=b.useState("");b.useEffect(()=>{const P=F=>{F.key==="Escape"&&t()};return document.addEventListener("keydown",P),()=>{document.removeEventListener("keydown",P)}},[t]);const v=async()=>{var P;if(i!==e.description)try{const F=await en.tasksControllerUpdateTask(e.id,{description:i});n(F),m("")}catch(F){console.error("Failed to update task:",F);const V=((P=F==null?void 0:F.body)==null?void 0:P.detail)||(F==null?void 0:F.message)||"Failed to update description";m(V)}},C=async()=>{console.log("NOT IMPLEMENTED - ASSIGNEE STRUCTURE CHANGED")},A=async()=>{var P;if(f.trim())try{await en.tasksControllerAddComment(e.id,{content:f});const F=await en.tasksControllerGetTask(e.id);n(F),h(""),m("")}catch(F){console.error("Failed to add comment:",F);const V=((P=F==null?void 0:F.body)==null?void 0:P.detail)||(F==null?void 0:F.message)||"Failed to add comment";m(V)}},N=async P=>{var F;try{const V={status:P};P===re.DONE&&p.trim()&&(V.comment=p);const j=await en.tasksControllerChangeStatus(e.id,V);n(j),y(""),m("")}catch(V){console.error("Failed to change status:",V);const j=((F=V==null?void 0:V.body)==null?void 0:F.detail)||(V==null?void 0:V.message)||"Failed to change status";m(j)}},_=async()=>{var P;try{await en.tasksControllerDeleteTask(e.id),t()}catch(F){console.error("Failed to delete task:",F);const V=((P=F==null?void 0:F.body)==null?void 0:P.detail)||(F==null?void 0:F.message)||"Failed to delete task";m(V)}},U=async P=>{var F,V;d(P);try{const j=await en.tasksControllerUpdateTask(e.id,{tagNames:P});n(j),m("")}catch(j){console.error("Failed to update tags:",j);const O=((F=j==null?void 0:j.body)==null?void 0:F.detail)||(j==null?void 0:j.message)||"Failed to update tags";m(O),d(((V=e.tags)==null?void 0:V.map(w=>w.name))||[])}};return o.jsx("div",{className:"modal-overlay",onClick:t,children:o.jsxs("div",{className:"modal-content task-detail",onClick:P=>P.stopPropagation(),children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:e.name}),o.jsx("button",{onClick:t,className:"btn-close",children:"×"})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Description"}),o.jsx("textarea",{value:i,onChange:P=>l(P.target.value),onBlur:v,placeholder:"Enter task description...",className:"description-textarea"})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Status"}),g&&o.jsxs("div",{className:"error-message",children:[o.jsx("strong",{children:"Error:"})," ",g]}),o.jsxs("div",{className:"status-buttons",children:[o.jsx("button",{onClick:()=>N(re.NOT_STARTED),className:`status-btn ${e.status===re.NOT_STARTED?"active status-not-started":""}`,children:"Not Started"}),o.jsx("button",{onClick:()=>N(re.IN_PROGRESS),className:`status-btn ${e.status===re.IN_PROGRESS?"active status-in-progress":""}`,children:"In Progress"}),o.jsx("button",{onClick:()=>N(re.FOR_REVIEW),className:`status-btn ${e.status===re.FOR_REVIEW?"active status-for-review":""}`,children:"For Review"}),o.jsx("button",{onClick:()=>N(re.DONE),className:`status-btn ${e.status===re.DONE?"active status-done":""}`,children:"Done"})]})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Assignee & Session"}),o.jsxs("div",{className:"assignee-form",children:[o.jsxs("div",{className:"form-row",children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{children:"Assignee"}),o.jsx("input",{type:"text",value:e.assignee?`@${e.assignee}`:"@",onChange:P=>r(P.target.value),placeholder:"Enter assignee name"})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{children:"Session ID"}),o.jsx("input",{type:"text",value:s,onChange:P=>u(P.target.value),placeholder:"Enter session ID"})]})]}),o.jsx("button",{onClick:C,className:"btn-primary",children:"Update Assignment"})]})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Tags"}),o.jsx(Cd,{value:c,onChange:U,placeholder:"Type to add tags..."})]}),o.jsxs("div",{className:"detail-section",children:[o.jsx("h3",{children:"Task Info"}),o.jsxs("div",{className:"task-info-grid",children:[o.jsxs("div",{className:"info-item",children:[o.jsx("label",{children:"Created By"}),o.jsxs("span",{children:["@",e.createdByActor.slug]})]}),e.dependsOnIds&&e.dependsOnIds.length>0&&o.jsxs("div",{className:"info-item",children:[o.jsx("label",{children:"Depends On"}),o.jsx("div",{className:"dependency-list",children:e.dependsOnIds.map(P=>o.jsx("span",{className:"dependency-id",children:P},P))})]})]})]}),o.jsxs("div",{className:"detail-section",children:[o.jsxs("h3",{children:["Comments (",((M=e.comments)==null?void 0:M.length)||0,")"]}),o.jsx("div",{className:"comments-list",children:(q=e.comments)==null?void 0:q.map(P=>o.jsxs("div",{className:"comment",children:[o.jsx("strong",{children:P.commenterName}),o.jsx("p",{children:P.content}),o.jsx("span",{className:"comment-date",children:new Date(P.createdAt).toLocaleString()})]},P.id))}),o.jsxs("div",{className:"add-comment",children:[o.jsx("textarea",{placeholder:"Add a comment...",value:f,onChange:P=>h(P.target.value),rows:3}),o.jsx("button",{onClick:A,className:"btn-primary",children:"Add Comment"})]})]}),o.jsx("div",{className:"detail-section",children:o.jsxs("div",{className:"task-actions",children:[e.status===re.FOR_REVIEW&&o.jsxs("div",{className:"review-shortcuts",children:[o.jsx("button",{onClick:()=>N(re.DONE),className:"btn-review-done",children:"✓ Done"}),o.jsx("button",{onClick:()=>N(re.IN_PROGRESS),className:"btn-review-needs-work",children:"← Needs work"})]}),x?o.jsxs("div",{className:"delete-confirm",children:[o.jsx("button",{onClick:_,className:"btn-danger",children:"Confirm Delete"}),o.jsx("button",{onClick:()=>E(!1),className:"btn-secondary",children:"Cancel"})]}):o.jsx("button",{onClick:()=>E(!0),className:"btn-danger",children:"Delete Task"})]})})]})})}function rr(){return o.jsx(Pi,{to:"/",className:"home-link",title:"Back to Home",children:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),o.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]})})}const gn=Object.create(null);gn.open="0";gn.close="1";gn.ping="2";gn.pong="3";gn.message="4";gn.upgrade="5";gn.noop="6";const ys=Object.create(null);Object.keys(gn).forEach(e=>{ys[gn[e]]=e});const Yc={type:"error",data:"parser error"},Fv=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Gv=typeof ArrayBuffer=="function",Vv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Td=({type:e,data:t},n,i)=>Fv&&t instanceof Blob?n?i(t):um(t,i):Gv&&(t instanceof ArrayBuffer||Vv(t))?n?i(t):um(new Blob([t]),i):i(gn[e]+(t||"")),um=(e,t)=>{const n=new FileReader;return n.onload=function(){const i=n.result.split(",")[1];t("b"+(i||""))},n.readAsDataURL(e)};function cm(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let ku;function TT(e,t){if(Fv&&e.data instanceof Blob)return e.data.arrayBuffer().then(cm).then(t);if(Gv&&(e.data instanceof ArrayBuffer||Vv(e.data)))return t(cm(e.data));Td(e,!1,n=>{ku||(ku=new TextEncoder),t(ku.encode(n))})}const fm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ta=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<fm.length;e++)Ta[fm.charCodeAt(e)]=e;const kT=e=>{let t=e.length*.75,n=e.length,i,l=0,a,r,s,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),d=new Uint8Array(c);for(i=0;i<n;i+=4)a=Ta[e.charCodeAt(i)],r=Ta[e.charCodeAt(i+1)],s=Ta[e.charCodeAt(i+2)],u=Ta[e.charCodeAt(i+3)],d[l++]=a<<2|r>>4,d[l++]=(r&15)<<4|s>>2,d[l++]=(s&3)<<6|u&63;return c},NT=typeof ArrayBuffer=="function",kd=(e,t)=>{if(typeof e!="string")return{type:"message",data:Yv(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:wT(e.substring(1),t)}:ys[n]?e.length>1?{type:ys[n],data:e.substring(1)}:{type:ys[n]}:Yc},wT=(e,t)=>{if(NT){const n=kT(e);return Yv(n,t)}else return{base64:!0,data:e}},Yv=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Pv="",AT=(e,t)=>{const n=e.length,i=new Array(n);let l=0;e.forEach((a,r)=>{Td(a,!1,s=>{i[r]=s,++l===n&&t(i.join(Pv))})})},jT=(e,t)=>{const n=e.split(Pv),i=[];for(let l=0;l<n.length;l++){const a=kd(n[l],t);if(i.push(a),a.type==="error")break}return i};function _T(){return new TransformStream({transform(e,t){TT(e,n=>{const i=n.length;let l;if(i<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,i);else if(i<65536){l=new Uint8Array(3);const a=new DataView(l.buffer);a.setUint8(0,126),a.setUint16(1,i)}else{l=new Uint8Array(9);const a=new DataView(l.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(i))}e.data&&typeof e.data!="string"&&(l[0]|=128),t.enqueue(l),t.enqueue(n)})}})}let Nu;function Xr(e){return e.reduce((t,n)=>t+n.length,0)}function Qr(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let i=0;for(let l=0;l<t;l++)n[l]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),n}function RT(e,t){Nu||(Nu=new TextDecoder);const n=[];let i=0,l=-1,a=!1;return new TransformStream({transform(r,s){for(n.push(r);;){if(i===0){if(Xr(n)<1)break;const u=Qr(n,1);a=(u[0]&128)===128,l=u[0]&127,l<126?i=3:l===126?i=1:i=2}else if(i===1){if(Xr(n)<2)break;const u=Qr(n,2);l=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),i=3}else if(i===2){if(Xr(n)<8)break;const u=Qr(n,8),c=new DataView(u.buffer,u.byteOffset,u.length),d=c.getUint32(0);if(d>Math.pow(2,21)-1){s.enqueue(Yc);break}l=d*Math.pow(2,32)+c.getUint32(4),i=3}else{if(Xr(n)<l)break;const u=Qr(n,l);s.enqueue(kd(a?u:Nu.decode(u),t)),i=0}if(l===0||l>e){s.enqueue(Yc);break}}}})}const Xv=4;function Ue(e){if(e)return OT(e)}function OT(e){for(var t in Ue.prototype)e[t]=Ue.prototype[t];return e}Ue.prototype.on=Ue.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Ue.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Ue.prototype.off=Ue.prototype.removeListener=Ue.prototype.removeAllListeners=Ue.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var i,l=0;l<n.length;l++)if(i=n[l],i===t||i.fn===t){n.splice(l,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Ue.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){n=n.slice(0);for(var i=0,l=n.length;i<l;++i)n[i].apply(this,t)}return this};Ue.prototype.emitReserved=Ue.prototype.emit;Ue.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Ue.prototype.hasListeners=function(e){return!!this.listeners(e).length};const No=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Bt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),DT="arraybuffer";function Qv(e,...t){return t.reduce((n,i)=>(e.hasOwnProperty(i)&&(n[i]=e[i]),n),{})}const zT=Bt.setTimeout,LT=Bt.clearTimeout;function wo(e,t){t.useNativeTimers?(e.setTimeoutFn=zT.bind(Bt),e.clearTimeoutFn=LT.bind(Bt)):(e.setTimeoutFn=Bt.setTimeout.bind(Bt),e.clearTimeoutFn=Bt.clearTimeout.bind(Bt))}const MT=1.33;function BT(e){return typeof e=="string"?UT(e):Math.ceil((e.byteLength||e.size)*MT)}function UT(e){let t=0,n=0;for(let i=0,l=e.length;i<l;i++)t=e.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}function Zv(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function IT(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function HT(e){let t={},n=e.split("&");for(let i=0,l=n.length;i<l;i++){let a=n[i].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class qT extends Error{constructor(t,n,i){super(t),this.description=n,this.context=i,this.type="TransportError"}}class Nd extends Ue{constructor(t){super(),this.writable=!1,wo(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,i){return super.emitReserved("error",new qT(t,n,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=kd(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=IT(t);return n.length?"?"+n:""}}class FT extends Nd{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||n()})),this.writable||(i++,this.once("drain",function(){--i||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};jT(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,AT(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Zv()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Kv=!1;try{Kv=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const GT=Kv;function VT(){}class YT extends FT{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let i=location.port;i||(i=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,n){const i=this.request({method:"POST",data:t});i.on("success",n),i.on("error",(l,a)=>{this.onError("xhr post error",l,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,i)=>{this.onError("xhr poll error",n,i)}),this.pollXhr=t}}class mn extends Ue{constructor(t,n,i){super(),this.createRequest=t,wo(this,i),this._opts=i,this._method=i.method||"GET",this._uri=n,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const n=Qv(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(n);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&i.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var l;i.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=mn.requestsCount++,mn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=VT,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete mn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}mn.requestsCount=0;mn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",dm);else if(typeof addEventListener=="function"){const e="onpagehide"in Bt?"pagehide":"unload";addEventListener(e,dm,!1)}}function dm(){for(let e in mn.requests)mn.requests.hasOwnProperty(e)&&mn.requests[e].abort()}const PT=(function(){const e=$v({xdomain:!1});return e&&e.responseType!==null})();class XT extends YT{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=PT&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new mn($v,this.uri(),t)}}function $v(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||GT))return new XMLHttpRequest}catch{}if(!t)try{return new Bt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Jv=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class QT extends Nd{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,i=Jv?{}:Qv(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,i)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const i=t[n],l=n===t.length-1;Td(i,this.supportsBinary,a=>{try{this.doWrite(i,a)}catch{}l&&No(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Zv()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const wu=Bt.WebSocket||Bt.MozWebSocket;class ZT extends QT{createSocket(t,n,i){return Jv?new wu(t,n,i):n?new wu(t,n):new wu(t)}doWrite(t,n){this.ws.send(n)}}class KT extends Nd{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=RT(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(n).getReader(),l=_T();l.readable.pipeTo(t.writable),this._writer=l.writable.getWriter();const a=()=>{i.read().then(({done:s,value:u})=>{s||(this.onPacket(u),a())}).catch(s=>{})};a();const r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this._writer.write(r).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const i=t[n],l=n===t.length-1;this._writer.write(i).then(()=>{l&&No(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const $T={websocket:ZT,webtransport:KT,polling:XT},JT=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,WT=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Pc(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),i=e.indexOf("]");n!=-1&&i!=-1&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let l=JT.exec(e||""),a={},r=14;for(;r--;)a[WT[r]]=l[r]||"";return n!=-1&&i!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=ek(a,a.path),a.queryKey=tk(a,a.query),a}function ek(e,t){const n=/\/{2,9}/g,i=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function tk(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,l,a){l&&(n[l]=a)}),n}const Xc=typeof addEventListener=="function"&&typeof removeEventListener=="function",xs=[];Xc&&addEventListener("offline",()=>{xs.forEach(e=>e())},!1);class yi extends Ue{constructor(t,n){if(super(),this.binaryType=DT,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const i=Pc(t);n.hostname=i.host,n.secure=i.protocol==="https"||i.protocol==="wss",n.port=i.port,i.query&&(n.query=i.query)}else n.host&&(n.hostname=Pc(n.host).host);wo(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(i=>{const l=i.prototype.name;this.transports.push(l),this._transportsByName[l]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=HT(this.opts.query)),Xc&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},xs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Xv,n.transport=t,this.id&&(n.sid=this.id);const i=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&yi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",yi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let i=0;i<this.writeBuffer.length;i++){const l=this.writeBuffer[i].data;if(l&&(n+=BT(l)),i>0&&n>this._maxPayload)return this.writeBuffer.slice(0,i);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,No(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,i){return this._sendPacket("message",t,n,i),this}send(t,n,i){return this._sendPacket("message",t,n,i),this}_sendPacket(t,n,i,l){if(typeof n=="function"&&(l=n,n=void 0),typeof i=="function"&&(l=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const a={type:t,data:n,options:i};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),l&&this.once("flush",l),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},i=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(yi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Xc&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=xs.indexOf(this._offlineEventListener);i!==-1&&xs.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}yi.protocol=Xv;class nk extends yi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),i=!1;yi.priorWebsocketSuccess=!1;const l=()=>{i||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!i)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;yi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function a(){i||(i=!0,d(),n.close(),n=null)}const r=f=>{const h=new Error("probe error: "+f);h.transport=n.name,a(),this.emitReserved("upgradeError",h)};function s(){r("transport closed")}function u(){r("socket closed")}function c(f){n&&f.name!==n.name&&a()}const d=()=>{n.removeListener("open",l),n.removeListener("error",r),n.removeListener("close",s),this.off("close",u),this.off("upgrading",c)};n.once("open",l),n.once("error",r),n.once("close",s),this.once("close",u),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&n.push(t[i]);return n}}let ik=class extends nk{constructor(t,n={}){const i=typeof t=="object"?t:n;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(l=>$T[l]).filter(l=>!!l)),super(t,i)}};function lk(e,t="",n){let i=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),i=Pc(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const a=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+a+":"+i.port+t,i.href=i.protocol+"://"+a+(n&&n.port===i.port?"":":"+i.port),i}const ak=typeof ArrayBuffer=="function",rk=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Wv=Object.prototype.toString,sk=typeof Blob=="function"||typeof Blob<"u"&&Wv.call(Blob)==="[object BlobConstructor]",ok=typeof File=="function"||typeof File<"u"&&Wv.call(File)==="[object FileConstructor]";function wd(e){return ak&&(e instanceof ArrayBuffer||rk(e))||sk&&e instanceof Blob||ok&&e instanceof File}function vs(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,i=e.length;n<i;n++)if(vs(e[n]))return!0;return!1}if(wd(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return vs(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&vs(e[n]))return!0;return!1}function uk(e){const t=[],n=e.data,i=e;return i.data=Qc(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Qc(e,t){if(!e)return e;if(wd(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=Qc(e[i],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Qc(e[i],t));return n}return e}function ck(e,t){return e.data=Zc(e.data,t),delete e.attachments,e}function Zc(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Zc(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Zc(e[n],t));return e}const fk=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ae;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ae||(ae={}));class dk{constructor(t){this.replacer=t}encode(t){return(t.type===ae.EVENT||t.type===ae.ACK)&&vs(t)?this.encodeAsBinary({type:t.type===ae.EVENT?ae.BINARY_EVENT:ae.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ae.BINARY_EVENT||t.type===ae.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=uk(t),i=this.encodeAsString(n.packet),l=n.buffers;return l.unshift(i),l}}class Ad extends Ue{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const i=n.type===ae.BINARY_EVENT;i||n.type===ae.BINARY_ACK?(n.type=i?ae.EVENT:ae.ACK,this.reconstructor=new hk(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(wd(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const i={type:Number(t.charAt(0))};if(ae[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ae.BINARY_EVENT||i.type===ae.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const r=t.substring(a,n);if(r!=Number(r)||t.charAt(n)!=="-")throw new Error("Illegal attachments");const s=Number(r);if(!pk(s)||s<0)throw new Error("Illegal attachments");if(s>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=s}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););i.nsp=t.substring(a,n)}else i.nsp="/";const l=t.charAt(n+1);if(l!==""&&Number(l)==l){const a=n+1;for(;++n;){const r=t.charAt(n);if(r==null||Number(r)!=r){--n;break}if(n===t.length)break}i.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(Ad.isPayloadValid(i.type,a))i.data=a;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ae.CONNECT:return hm(n);case ae.DISCONNECT:return n===void 0;case ae.CONNECT_ERROR:return typeof n=="string"||hm(n);case ae.EVENT:case ae.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&fk.indexOf(n[0])===-1);case ae.ACK:case ae.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class hk{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=ck(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const pk=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function hm(e){return Object.prototype.toString.call(e)==="[object Object]"}const mk=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ad,Encoder:dk,get PacketType(){return ae}},Symbol.toStringTag,{value:"Module"}));function Wt(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const gk=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class eb extends Ue{constructor(t,n,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Wt(t,"open",this.onopen.bind(this)),Wt(t,"packet",this.onpacket.bind(this)),Wt(t,"error",this.onerror.bind(this)),Wt(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var i,l,a;if(gk.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:ae.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,f=n.pop();this._registerAckCallback(d,f),r.id=d}const s=(l=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||l===void 0?void 0:l.writable,u=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!s||(u?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,n){var i;const l=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(l===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let s=0;s<this.sendBuffer.length;s++)this.sendBuffer[s].id===t&&this.sendBuffer.splice(s,1);n.call(this,new Error("operation has timed out"))},l),r=(...s)=>{this.io.clearTimeoutFn(a),n.apply(this,s)};r.withError=!0,this.acks[t]=r}emitWithAck(t,...n){return new Promise((i,l)=>{const a=(r,s)=>r?l(r):i(s);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((l,...a)=>(this._queue[0],l!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(l)):(this._queue.shift(),n&&n(null,...a)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ae.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ae.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ae.EVENT:case ae.BINARY_EVENT:this.onevent(t);break;case ae.ACK:case ae.BINARY_ACK:this.onack(t);break;case ae.DISCONNECT:this.ondisconnect();break;case ae.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const i of n)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let i=!1;return function(...l){i||(i=!0,n.packet({type:ae.ACK,id:t,data:l}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ae.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const i of n)i.apply(this,t.data)}}}function na(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}na.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};na.prototype.reset=function(){this.attempts=0};na.prototype.setMin=function(e){this.ms=e};na.prototype.setMax=function(e){this.max=e};na.prototype.setJitter=function(e){this.jitter=e};class Kc extends Ue{constructor(t,n){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,wo(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((i=n.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new na({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const l=n.parser||mk;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ik(this.uri,this.opts);const n=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const l=Wt(n,"open",function(){i.onopen(),t&&t()}),a=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},r=Wt(n,"error",a);if(this._timeout!==!1){const s=this._timeout,u=this.setTimeoutFn(()=>{l(),a(new Error("timeout")),n.close()},s);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(l),this.subs.push(r),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Wt(t,"ping",this.onping.bind(this)),Wt(t,"data",this.ondata.bind(this)),Wt(t,"error",this.onerror.bind(this)),Wt(t,"close",this.onclose.bind(this)),Wt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){No(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new eb(this,t,n),this.nsps[t]=i),i}_destroy(t){const n=Object.keys(this.nsps);for(const i of n)if(this.nsps[i].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let i=0;i<n.length;i++)this.engine.write(n[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(l=>{l?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",l)):t.onreconnect()}))},n);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ga={};function Ha(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=lk(e,t.path||"/socket.io"),i=n.source,l=n.id,a=n.path,r=ga[l]&&a in ga[l].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||r;let u;return s?u=new Kc(i,t):(ga[l]||(ga[l]=new Kc(i,t)),u=ga[l]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(Ha,{Manager:Kc,Socket:eb,io:Ha,connect:Ha});const yk=Mv("/tasks"),tb=()=>{const[e,t]=b.useState(!1),[n,i]=b.useState(null),[l,a]=b.useState([]),[r,s]=b.useState(null),[u,c]=b.useState(!1);b.useEffect(()=>(f(),h(),()=>{r&&r.disconnect()}),[]);const d=p=>[...p].sort((y,x)=>{const E=new Date(y.updatedAt).getTime();return new Date(x.updatedAt).getTime()-E}),f=async()=>{t(!0),i(null);try{const p=await en.tasksControllerListTasks();a(d(p.items))}catch(p){i(p instanceof Error?p.message:"Failed to load tasks")}finally{t(!1)}},h=()=>{const p=Ha(yk,{transports:["websocket","polling"],withCredentials:!0});return p.on("connect",()=>{console.log("Connected to websocket"),p.emit("tasks.subscribe",{},y=>{y.ok?(console.log(y),console.log("Subscribed to room:",y.room),c(!0)):(console.error("Failed to subscribe to room"),c(!1))}),f()}),p.on("disconnect",()=>{console.log("WebSocket disconnected"),c(!1)}),p.on("task.created",y=>{a(x=>x.some(E=>E.id===y.id)?x:d([y,...x]))}),p.on("task.updated",y=>{a(x=>d(x.map(E=>E.id===y.id?y:E)))}),p.on("task.deleted",({taskId:y})=>{a(x=>x.filter(E=>E.id!==y))}),p.on("task.assigned",y=>{a(x=>d(x.map(E=>E.id===y.id?y:E)))}),p.on("task.commented",async y=>{try{const x=await en.tasksControllerGetTask(y.taskId);a(E=>E.findIndex(m=>m.id===x.id)===-1?d([x,...E]):d(E.map(m=>m.id===x.id?x:m)))}catch(x){console.error("Failed to refresh task after comment",x)}}),p.on("input.request.answered",async y=>{try{const x=await en.tasksControllerGetTask(y.taskId);a(E=>E.findIndex(m=>m.id===x.id)===-1?d([x,...E]):d(E.map(m=>m.id===x.id?x:m)))}catch(x){console.error("Failed to refresh task after input request answer",x)}}),p.on("task.status_changed",y=>{a(x=>d(x.map(E=>E.id===y.id?y:E)))}),s(p),()=>{p.close()}};return{isLoading:e,error:n,tasks:l,isConnected:u}};function xk(){const{tasks:e,isConnected:t}=tb(),[n,i]=b.useState(null),[l,a]=b.useState(!1);tl("Tasks");const r={[re.NOT_STARTED]:e.filter(s=>s.status===re.NOT_STARTED),[re.IN_PROGRESS]:e.filter(s=>s.status===re.IN_PROGRESS),[re.FOR_REVIEW]:e.filter(s=>s.status===re.FOR_REVIEW),[re.DONE]:e.filter(s=>s.status===re.DONE)};return o.jsxs("div",{className:"task-board",children:[o.jsxs("div",{className:"task-board-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:"Tasks"}),o.jsx("p",{className:"subtitle",children:"Manage and track your tasks across different stages"})]}),o.jsxs("div",{className:"header-actions",children:[o.jsx(rr,{}),o.jsx("span",{className:`status-indicator ${t?"connected":"disconnected"}`,children:t?"● Connected":"○ Disconnected"})]})]}),o.jsx("div",{className:"kanban-board",children:Object.entries(r).map(([s,u])=>o.jsxs("div",{className:`kanban-column column-${s.replace(" ","-")}`,children:[o.jsxs("div",{className:"column-header",children:[o.jsx("h2",{children:s.toUpperCase()}),o.jsx("span",{className:"task-count",children:u.length})]}),o.jsxs("div",{className:"column-content",children:[s===re.NOT_STARTED&&o.jsx("button",{onClick:()=>a(!0),className:"btn-add-task",children:"+ Add New Task"}),u.map(c=>o.jsx(bT,{task:c,onClick:()=>i(c)},c.id))]})]},s))}),l&&o.jsx(CT,{onClose:()=>a(!1)}),n&&o.jsx(qv,{task:n,onClose:()=>i(null),onUpdate:s=>i(s)})]})}function vk(){const[e,t]=b.useState(!1),n=rt(),i=()=>t(!e),l=()=>t(!1),a=[{name:"Home",path:"/",icon:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),o.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),color:"#8e8e93"},{name:"Tasks",path:"/tasks",icon:"📋",color:"#3b82f6"},{name:"Context",path:"/context",icon:"📚",color:"#10b981"},{name:"Tools",path:"/mcp-registry",icon:"🔧",color:"#8b5cf6"},{name:"Logout",path:"/logout",icon:"🔒"}];return o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"hamburger-button",onClick:i,"aria-label":"Menu",children:o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),o.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),o.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),e&&o.jsx("div",{className:"hamburger-overlay",onClick:l}),o.jsxs("div",{className:`hamburger-drawer ${e?"open":""}`,children:[o.jsxs("div",{className:"hamburger-header",children:[o.jsx("h2",{children:"Menu"}),o.jsx("button",{className:"hamburger-close",onClick:l,"aria-label":"Close menu",children:o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("nav",{className:"hamburger-nav",children:a.map(r=>{const s=n.pathname===r.path||r.path!=="/"&&n.pathname.startsWith(r.path);return o.jsxs(Pi,{to:r.path,className:`hamburger-nav-item ${s?"active":""}`,onClick:l,children:[o.jsx("div",{className:"hamburger-nav-icon",style:{color:r.color},children:typeof r.icon=="string"?o.jsx("span",{className:"hamburger-emoji",children:r.icon}):r.icon}),o.jsx("span",{className:"hamburger-nav-label",children:r.name}),s&&o.jsx("svg",{className:"hamburger-nav-check",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})})]},r.path)})})]})]})}const bk=[re.NOT_STARTED,re.IN_PROGRESS,re.FOR_REVIEW,re.DONE],Zr={[re.NOT_STARTED]:{label:"Queued",icon:"○",sublabel:"Ideas + intake"},[re.IN_PROGRESS]:{label:"Building",icon:"▣",sublabel:"Actively running"},[re.FOR_REVIEW]:{label:"Review",icon:"◆",sublabel:"Needs eyeballs"},[re.DONE]:{label:"Shipped",icon:"▴",sublabel:"Mission complete"}};function Sk(){const{tasks:e,isConnected:t}=tb(),[n,i]=b.useState(null),[l,a]=b.useState(!1),[r,s]=b.useState(re.NOT_STARTED);tl("Tasks");const u=b.useMemo(()=>e.reduce((f,h)=>(f[h.status]=f[h.status]?[...f[h.status],h]:[h],f),{[re.NOT_STARTED]:[],[re.IN_PROGRESS]:[],[re.FOR_REVIEW]:[],[re.DONE]:[]}),[e]),c=u[r]??[],d=f=>{const h=new Date(f),y=Math.round((new Date().getTime()-h.getTime())/(1e3*60));if(y<60)return`${Math.max(y,1)}m ago`;const x=Math.round(y/60);return x<24?`${x}h ago`:h.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return o.jsxs("div",{className:"task-board-mobile",children:[o.jsxs("div",{className:"matrix-frame",children:[o.jsxs("header",{className:"matrix-header",children:[o.jsx(vk,{}),o.jsx("div",{className:"matrix-header-copy",children:o.jsx("h1",{children:"Tasks"})}),o.jsxs("div",{className:"matrix-connection",children:[o.jsx("span",{className:`matrix-connection-dot ${t?"online":"offline"}`,"aria-hidden":!0}),o.jsx("span",{children:t?"":"offline"})]})]}),o.jsxs("section",{className:"matrix-status-panel",children:[o.jsxs("div",{children:[o.jsx("h2",{children:Zr[r].label}),o.jsx("p",{className:"matrix-status-sub",children:Zr[r].sublabel})]}),o.jsxs("div",{className:"matrix-status-count",children:[o.jsx("span",{className:"matrix-count-number",children:c.length}),o.jsx("span",{className:"matrix-count-text",children:"tasks"})]})]}),o.jsxs("section",{className:"matrix-task-feed",children:[c.length===0&&o.jsxs("div",{className:"matrix-empty-state",children:[o.jsx("p",{children:"No entries in this lane."}),r===re.NOT_STARTED&&o.jsx("button",{type:"button",className:"matrix-link",onClick:()=>a(!0),children:"create the first task"})]}),c.map(f=>o.jsxs("article",{className:"matrix-task-card",onClick:()=>i(f),children:[o.jsxs("div",{className:"matrix-task-meta-row",children:[o.jsxs("span",{className:"matrix-task-id",children:["#",f.id.slice(0,6).toUpperCase()]}),o.jsx("span",{className:"matrix-task-updated",children:d(f.updatedAt)})]}),o.jsx("h3",{children:f.name}),o.jsx("p",{children:f.description}),f.tags&&f.tags.length>0&&o.jsx("div",{className:"matrix-task-tags",children:f.tags.map(h=>o.jsx(Uv,{tag:h,small:!0},h.name))}),o.jsxs("div",{className:"matrix-task-footer",children:[o.jsx("span",{children:f.assignee?`Assigned: ${f.assignee}`:"Unassigned"}),f.comments&&f.comments.length>0&&o.jsxs("span",{children:["💬 ",f.comments.length]})]})]},f.id))]})]}),o.jsx("nav",{className:"matrix-bottom-nav","aria-label":"Task status navigation",children:bk.map(f=>o.jsxs("button",{className:`matrix-nav-item ${f===r?"active":""}`,onClick:()=>s(f),type:"button",children:[o.jsx("span",{className:"matrix-nav-icon",children:Zr[f].icon}),o.jsx("span",{className:"matrix-nav-label",children:Zr[f].label}),o.jsx("span",{className:"matrix-nav-count",children:u[f].length})]},f))}),o.jsx("button",{type:"button",className:"matrix-fab",onClick:()=>a(!0),"aria-label":"Create task",children:"➕"}),n&&o.jsx(qv,{task:n,onClose:()=>i(null),onUpdate:f=>i(f)}),l&&o.jsx(Ek,{onClose:()=>a(!1)})]})}function Ek({onClose:e}){const{toasts:t,showToast:n,removeToast:i}=Iv(),[l,a]=b.useState(""),[r,s]=b.useState(""),[u,c]=b.useState(""),[d,f]=b.useState(""),[h,p]=b.useState([]),[y,x]=b.useState(""),[E,g]=b.useState(!1),m=async v=>{var C;if(v.preventDefault(),!l.trim()||!r.trim()){n("Name and description are required","error");return}g(!0);try{const A=y.split(",").map(N=>N.trim()).filter(Boolean);await en.tasksControllerCreateTask({name:l,description:r,...u&&{assignee:u},...d&&{sessionId:d},...h.length>0&&{tagNames:h},...A.length>0&&{dependsOnIds:A}}),e()}catch(A){const N=((C=A==null?void 0:A.body)==null?void 0:C.detail)||(A==null?void 0:A.message)||"Failed to create task";n(N,"error")}finally{g(!1)}};return o.jsx("div",{className:"mobile-create-overlay",onClick:e,children:o.jsxs("div",{className:"mobile-create-panel",onClick:v=>v.stopPropagation(),children:[o.jsxs("header",{className:"mobile-create-header",children:[o.jsxs("div",{children:[o.jsx("p",{className:"matrix-status-label",children:"New task payload"}),o.jsx("h2",{children:"Compose"})]}),o.jsx("button",{type:"button",className:"matrix-link",onClick:e,children:"close"})]}),o.jsxs("form",{className:"mobile-create-form",onSubmit:m,children:[o.jsxs("label",{children:[o.jsx("span",{children:"Title *"}),o.jsx("input",{type:"text",value:l,onChange:v=>a(v.target.value),placeholder:"Ship a feature",required:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Description *"}),o.jsx("textarea",{value:r,onChange:v=>s(v.target.value),placeholder:"Outline what needs to happen",rows:4,required:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Assignee"}),o.jsx("input",{type:"text",value:u,onChange:v=>c(v.target.value),placeholder:"agent or human"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Session ID"}),o.jsx("input",{type:"text",value:d,onChange:v=>f(v.target.value),placeholder:"link a running session"})]}),o.jsxs("div",{className:"mobile-form-control",children:[o.jsx("span",{children:"Tags"}),o.jsx(Cd,{value:h,onChange:p,placeholder:"ops, agents, ui"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Depends on task IDs"}),o.jsx("input",{type:"text",value:y,onChange:v=>x(v.target.value),placeholder:"comma separated"})]}),o.jsx("button",{type:"submit",className:"matrix-submit",disabled:E,children:E?"Transmitting…":"Create Task"})]}),t.map(v=>o.jsx(Hv,{message:v.message,type:v.type,onClose:()=>i(v.id)},v.id))]})})}function nb(e,t){return t?e.id===t?!0:e.children?e.children.some(n=>nb(n,t)):!1:!1}const Ck=b.memo(function e({page:t,level:n,isActive:i,currentPageId:l,onPageClick:a,onAddChild:r}){const s=t.children&&t.children.length>0,u=s&&nb(t,l),[c,d]=b.useState(u);b.useEffect(()=>{u&&d(!0)},[u]);const f=x=>{x.stopPropagation(),d(!c)},h=x=>{x.preventDefault(),a(t.id)},p=x=>{x.preventDefault(),x.stopPropagation(),r(t.id)},y=b.useMemo(()=>s?[...t.children].sort((x,E)=>x.order-E.order):[],[s,t.children]);return o.jsxs("div",{className:"page-tree-item",children:[o.jsxs("div",{className:`tree-item-content ${i?"active":""}`,style:{paddingLeft:`${n*20}px`},children:[s?o.jsx("button",{className:"tree-toggle",onClick:f,"aria-label":c?"Collapse":"Expand","aria-expanded":c,children:c?"▼":"▶"}):o.jsx("span",{className:"tree-spacer"}),o.jsx("a",{href:"#",className:"tree-item-link",onClick:h,"aria-current":i?"page":void 0,children:t.title}),o.jsx("button",{className:"tree-item-add-child",onClick:p,"aria-label":`Add child page to ${t.title}`,title:"Add child page",children:"+"})]}),c&&s&&o.jsx("div",{className:"tree-item-children",children:y.map(x=>o.jsx(e,{page:x,level:n+1,isActive:x.id===l,currentPageId:l,onPageClick:a,onAddChild:r},x.id))})]})});function Tk({pages:e,currentPageId:t,onPageClick:n}){const i=Je(),l=b.useMemo(()=>[...e].sort((r,s)=>r.order-s.order),[e]),a=r=>{i(`/context/page/${r}/new`)};return o.jsx("div",{className:"page-tree",children:l.map(r=>o.jsx(Ck,{page:r,level:0,isActive:r.id===t,currentPageId:t,onPageClick:n,onAddChild:a},r.id))})}B.BASE=el;const kk=Mv("/context"),Tr=()=>{const[e,t]=b.useState([]),[n,i]=b.useState(null),[l,a]=b.useState(!1),[r,s]=b.useState(!1),[u,c]=b.useState(!1),[d,f]=b.useState(!1),[h,p]=b.useState(!1),[y,x]=b.useState(null),[E,g]=b.useState(null),[m,v]=b.useState(!1),C=b.useCallback(async()=>{a(!0),x(null);try{const j=await Kt.contextControllerListBlocks();t(j.items)}catch(j){x(j instanceof Error?j.message:"Failed to load wiki pages")}finally{a(!1)}},[]),A=b.useCallback(async j=>{s(!0),x(null),i(null);try{const O=await Kt.contextControllerGetBlock(j);i(O)}catch(O){x(O instanceof Error?O.message:"Failed to fetch wiki page")}finally{s(!1)}},[]),N=b.useCallback(async j=>{c(!0),x(null);try{const O=await Kt.contextControllerCreateBlock(j);return t(w=>{const X=w.filter(S=>S.id!==O.id);return[{id:O.id,title:O.title,createdBy:O.createdBy,createdByActorId:O.createdByActorId,tags:O.tags,parentId:O.parentId,order:O.order,createdAt:O.createdAt,updatedAt:O.updatedAt},...X]}),i(O),O}catch(O){throw x(O instanceof Error?O.message:"Failed to create wiki page"),O}finally{c(!1)}},[]),_=b.useCallback(j=>{A(j)},[A]),U=b.useCallback(async(j,O)=>{f(!0),x(null);try{const w=await Kt.contextControllerUpdateBlock(j,O);return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to update page"),w}finally{f(!1)}},[n]),D=b.useCallback(async j=>{p(!0),x(null);try{await Kt.contextControllerDeleteBlock(j),t(O=>O.filter(w=>w.id!==j)),(n==null?void 0:n.id)===j&&i(null)}catch(O){throw x(O instanceof Error?O.message:"Failed to delete page"),O}finally{p(!1)}},[n]),T=b.useCallback(async(j,O)=>{f(!0),x(null);try{const w=await Kt.contextControllerAppendToBlock(j,{content:O});return(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to append content"),w}finally{f(!1)}},[n]),M=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerAddTagToBlock(j,O);return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to add tag"),w}},[n]),q=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerRemoveTagFromBlock(j,O);return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to remove tag"),w}},[n]),P=b.useCallback(async()=>{x(null);try{return await Kt.contextControllerGetBlockTree()}catch(j){throw x(j instanceof Error?j.message:"Failed to fetch page tree"),j}},[]),F=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerReorderBlock(j,{newOrder:O});return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to reorder page"),w}},[n]),V=b.useCallback(async(j,O)=>{x(null);try{const w=await Kt.contextControllerMoveBlock(j,{newParentId:O});return t(X=>X.map(S=>S.id===j?{id:w.id,title:w.title,createdBy:w.createdBy,createdByActorId:w.createdByActorId,tags:w.tags,parentId:w.parentId,order:w.order,createdAt:w.createdAt,updatedAt:w.updatedAt}:S)),(n==null?void 0:n.id)===j&&i(w),w}catch(w){throw x(w instanceof Error?w.message:"Failed to move page"),w}},[n]);return b.useEffect(()=>{const j=Ha(kk,{transports:["websocket","polling"],withCredentials:!0});return j.on("connect",()=>{console.log("Connected to Context websocket"),j.emit("context.subscribe",{},O=>{O.ok?(console.log(O),console.log("Subscribed to room:",O.room),v(!0)):(console.error("Failed to subscribe to room"),v(!1))}),v(!0),C()}),j.on("disconnect",()=>{console.log("Context WebSocket disconnected"),v(!1)}),j.on("page.created",O=>{t(w=>w.some(X=>X.id===O.id)?w:[{id:O.id,title:O.title,createdBy:O.createdBy,createdByActorId:O.createdByActorId,tags:O.tags,parentId:O.parentId,order:O.order,createdAt:O.createdAt,updatedAt:O.updatedAt},...w])}),j.on("page.updated",O=>{t(w=>w.map(X=>X.id===O.id?{id:O.id,title:O.title,createdBy:O.createdBy,createdByActorId:O.createdByActorId,tags:O.tags,parentId:O.parentId,order:O.order,createdAt:O.createdAt,updatedAt:O.updatedAt}:X)),(n==null?void 0:n.id)===O.id&&i(O)}),j.on("page.deleted",({pageId:O})=>{t(w=>w.filter(X=>X.id!==O)),(n==null?void 0:n.id)===O&&i(null)}),g(j),()=>{j.disconnect()}},[C,n==null?void 0:n.id]),b.useEffect(()=>{C()},[C]),{pages:e,selectedPage:n,isLoadingList:l,isLoadingPage:r,isCreating:u,isUpdating:d,isDeleting:h,error:y,isConnected:m,socket:E,loadPages:C,createPage:N,selectPage:_,updatePage:U,appendToPage:T,deletePage:D,addTagToPage:M,removeTagFromPage:q,getPageTree:P,reorderPage:F,movePage:V}},pm="context-sidebar-collapsed";function Nk(){const{pageId:e}=Wi(),t=Je(),{getPageTree:n,isConnected:i,socket:l}=Tr(),[a,r]=b.useState([]),[s,u]=b.useState(!1),[c,d]=b.useState(()=>{const y=localStorage.getItem(pm);return y!==null?y==="true":ar()});b.useEffect(()=>{localStorage.setItem(pm,String(c))},[c]);const f=b.useCallback(async()=>{u(!0);try{const y=await n();r(y)}catch(y){console.error("Failed to load page tree:",y)}finally{u(!1)}},[n]);b.useEffect(()=>{f()},[f]),b.useEffect(()=>{if(!l)return;const y=()=>{f()},x=()=>{f()},E=()=>{f()};return l.on("page.created",y),l.on("page.updated",x),l.on("page.deleted",E),()=>{l.off("page.created",y),l.off("page.updated",x),l.off("page.deleted",E)}},[l,f]);const h=b.useCallback(y=>{t(`/context/page/${y}`)},[t]),p=()=>{d(!c)};return o.jsxs("div",{className:"context-with-sidebar",children:[o.jsxs("aside",{className:`sidebar-app-specific ${c?"collapsed":""}`,children:[o.jsxs("nav",{className:"sidebar-content",children:[c&&o.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px"},children:o.jsx("span",{className:`context-status-dot ${i?"connected":"disconnected"}`,title:i?"WebSocket connected":"WebSocket disconnected","aria-label":i?"WebSocket connected":"WebSocket disconnected"})}),!c&&o.jsxs("div",{children:[o.jsxs("div",{className:"context-sidebar-header",children:[o.jsxs("h2",{className:"context-sidebar-title",children:["📚 Context",o.jsx("span",{className:`context-status-dot ${i?"connected":"disconnected"}`,title:i?"WebSocket connected":"WebSocket disconnected","aria-label":i?"WebSocket connected":"WebSocket disconnected"})]}),o.jsx("button",{className:"context-button primary context-sidebar-new-page",type:"button",onClick:()=>t("/context/new"),title:"Create new page",children:"+ New page"})]}),s&&o.jsx("div",{className:"context-status",children:"Loading pages…"}),a.length>0&&o.jsx(Tk,{pages:a,currentPageId:e,onPageClick:h}),a.length===0&&!s&&o.jsx("div",{className:"context-empty-sidebar",children:o.jsx("span",{children:"No pages yet"})})]})]}),o.jsx("button",{className:"sidebar-toggle",onClick:p,"aria-label":c?"Expand sidebar":"Collapse sidebar",children:c?"→":"←"})]}),o.jsx("main",{className:"context-content",children:o.jsx(md,{})})]})}const ib=({tag:e,onRemove:t,small:n=!1})=>{const i=e.color||"#6B7280";return o.jsxs("span",{className:`tag-badge ${n?"tag-badge-small":""}`,style:{backgroundColor:i,color:"#ffffff",padding:n?"1px 4px":"2px 6px",borderRadius:"3px",fontSize:n?"0.65rem":"0.7rem",fontWeight:"500",display:"inline-flex",alignItems:"center",gap:"2px",marginRight:"4px",marginBottom:"4px"},children:[e.name,t&&o.jsx("button",{onClick:l=>{l.stopPropagation(),t()},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:n?"0.75rem":"0.85rem",lineHeight:"1"},"aria-label":`Remove ${e.name} tag`,children:"×"})]})};function wk(){const e=Je(),{pages:t,isLoadingList:n}=Tr();return n?o.jsx("div",{className:"context-welcome",children:o.jsx("p",{children:"Loading pages..."})}):t.length===0?o.jsxs("div",{className:"context-welcome",children:[o.jsx("h2",{children:"Context"}),o.jsx("br",{}),o.jsx("button",{className:"context-button primary",type:"button",onClick:()=>e("/context/new"),title:"Create new page",children:"+ New page"})]}):o.jsxs("div",{className:"context-content",style:{padding:"24px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px"},children:[o.jsx("h2",{style:{margin:0},children:"All Pages"}),o.jsx("button",{className:"context-button primary",type:"button",onClick:()=>e("/context/new"),title:"Create new page",children:"+ New page"})]}),o.jsx("div",{className:"context-grid",children:t.map(i=>o.jsxs("div",{className:"context-card",onClick:()=>e(`/context/page/${i.id}`),style:{cursor:"pointer"},children:[o.jsx("h3",{children:i.title}),i.tags&&i.tags.length>0&&o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.tags.map(l=>o.jsx(ib,{tag:l},l.name))}),o.jsxs("div",{className:"context-card-meta",children:[o.jsxs("span",{children:["By ",i.createdBy||"unknown"]}),o.jsxs("span",{children:["Created ",new Date(i.createdAt).toLocaleDateString()]}),i.updatedAt!==i.createdAt&&o.jsxs("span",{children:["Updated ",new Date(i.updatedAt).toLocaleDateString()]})]})]},i.id))})]})}const Ak=({value:e,onChange:t,placeholder:n="Type to add tags..."})=>{const[i,l]=b.useState(""),[a,r]=b.useState([]),[s,u]=b.useState(!1),[c,d]=b.useState(-1),[f,h]=b.useState([]),p=b.useRef(null),y=b.useRef(null);b.useEffect(()=>{(async()=>{try{const v=await zv.metaControllerGetAllTags();h(v)}catch(v){console.error("Failed to load tags:",v)}})()},[]),b.useEffect(()=>{const v=setTimeout(()=>{if(i.trim().length>0){const C=i.trim().toLowerCase(),A=f.filter(N=>N.name.toLowerCase().includes(C)&&!e.includes(N.name));r(A),u(!0)}else r([]),u(!1)},150);return()=>clearTimeout(v)},[i,e,f]),b.useEffect(()=>{const m=v=>{y.current&&!y.current.contains(v.target)&&u(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const x=m=>{var C;const v=m.trim();v&&!e.includes(v)&&t([...e,v]),l(""),r([]),u(!1),d(-1),(C=p.current)==null||C.focus()},E=m=>{t(e.filter(v=>v!==m))},g=m=>{m.key==="Tab"&&i.trim()||m.key==="Enter"&&i.trim()?(m.preventDefault(),c>=0&&a[c]?x(a[c].name):x(i)):m.key==="ArrowDown"?(m.preventDefault(),d(v=>v<a.length-1?v+1:v)):m.key==="ArrowUp"?(m.preventDefault(),d(v=>v>0?v-1:-1)):m.key==="Escape"?(u(!1),d(-1)):m.key==="Backspace"&&!i&&e.length>0&&t(e.slice(0,-1))};return o.jsxs("div",{ref:y,style:{position:"relative"},children:[o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",padding:"6px",border:"1px solid #ddd",borderRadius:"4px",minHeight:"38px",cursor:"text"},onClick:()=>{var m;return(m=p.current)==null?void 0:m.focus()},children:[e.map(m=>{const v=f.find(A=>A.name===m),C=(v==null?void 0:v.color)||"#3B82F6";return o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",backgroundColor:C,color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"0.7rem",fontWeight:"500"},children:[m,o.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),E(m)},style:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"0",marginLeft:"1px",fontSize:"0.85rem",lineHeight:"1"},children:"×"})]},m)}),o.jsx("input",{ref:p,type:"text",value:i,onChange:m=>l(m.target.value),onKeyDown:g,onFocus:()=>i&&u(!0),placeholder:e.length===0?n:"",style:{flex:"1",minWidth:"120px",border:"none",outline:"none",fontSize:"0.875rem",padding:"2px"}})]}),s&&a.length>0&&o.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3},children:a.map((m,v)=>o.jsxs("div",{onClick:()=>x(m.name),style:{padding:"8px 12px",cursor:"pointer",backgroundColor:v===c?"#EFF6FF":"white",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:()=>d(v),children:[o.jsx("span",{style:{width:"12px",height:"12px",borderRadius:"2px",backgroundColor:m.color||"#6B7280"}}),o.jsx("span",{style:{fontSize:"0.875rem"},children:m.name})]},m.name))}),s&&i&&a.length===0&&o.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,backgroundColor:"white",border:"1px solid #ddd",borderRadius:"4px",marginTop:"2px",padding:"8px 12px",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e3,fontSize:"0.875rem",color:"#6B7280"},children:['Press Tab or Enter to create "',i,'"']})]})};function jk(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _k=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ok={};function mm(e,t){return(Ok.jsx?Rk:_k).test(e)}const Dk=/[ \t\n\f\r]/g;function zk(e){return typeof e=="object"?e.type==="text"?gm(e.value):!1:gm(e)}function gm(e){return e.replace(Dk,"")===""}class kr{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}kr.prototype.normal={};kr.prototype.property={};kr.prototype.space=void 0;function lb(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new kr(n,i,t)}function $c(e){return e.toLowerCase()}class yt{constructor(t,n){this.attribute=n,this.property=t}}yt.prototype.attribute="";yt.prototype.booleanish=!1;yt.prototype.boolean=!1;yt.prototype.commaOrSpaceSeparated=!1;yt.prototype.commaSeparated=!1;yt.prototype.defined=!1;yt.prototype.mustUseProperty=!1;yt.prototype.number=!1;yt.prototype.overloadedBoolean=!1;yt.prototype.property="";yt.prototype.spaceSeparated=!1;yt.prototype.space=void 0;let Lk=0;const W=nl(),De=nl(),Jc=nl(),H=nl(),ve=nl(),Rl=nl(),vt=nl();function nl(){return 2**++Lk}const Wc=Object.freeze(Object.defineProperty({__proto__:null,boolean:W,booleanish:De,commaOrSpaceSeparated:vt,commaSeparated:Rl,number:H,overloadedBoolean:Jc,spaceSeparated:ve},Symbol.toStringTag,{value:"Module"})),Au=Object.keys(Wc);class jd extends yt{constructor(t,n,i,l){let a=-1;if(super(t,n),ym(this,"space",l),typeof i=="number")for(;++a<Au.length;){const r=Au[a];ym(this,Au[a],(i&Wc[r])===Wc[r])}}}jd.prototype.defined=!0;function ym(e,t,n){n&&(e[t]=n)}function ia(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const a=new jd(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),t[i]=a,n[$c(i)]=i,n[$c(a.attribute)]=i}return new kr(t,n,e.space)}const ab=ia({properties:{ariaActiveDescendant:null,ariaAtomic:De,ariaAutoComplete:null,ariaBusy:De,ariaChecked:De,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:ve,ariaCurrent:null,ariaDescribedBy:ve,ariaDetails:null,ariaDisabled:De,ariaDropEffect:ve,ariaErrorMessage:null,ariaExpanded:De,ariaFlowTo:ve,ariaGrabbed:De,ariaHasPopup:null,ariaHidden:De,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ve,ariaLevel:H,ariaLive:null,ariaModal:De,ariaMultiLine:De,ariaMultiSelectable:De,ariaOrientation:null,ariaOwns:ve,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:De,ariaReadOnly:De,ariaRelevant:null,ariaRequired:De,ariaRoleDescription:ve,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:De,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function rb(e,t){return t in e?e[t]:t}function sb(e,t){return rb(e,t.toLowerCase())}const Mk=ia({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rl,acceptCharset:ve,accessKey:ve,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:ve,autoFocus:W,autoPlay:W,blocking:ve,capture:null,charSet:null,checked:W,cite:null,className:ve,cols:H,colSpan:null,content:null,contentEditable:De,controls:W,controlsList:ve,coords:H|Rl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:Jc,draggable:De,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:ve,height:H,hidden:Jc,high:H,href:null,hrefLang:null,htmlFor:ve,httpEquiv:ve,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:ve,itemRef:ve,itemScope:W,itemType:ve,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:H,pattern:null,ping:ve,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:ve,required:W,reversed:W,rows:H,rowSpan:H,sandbox:ve,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:De,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:De,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ve,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:De,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:W,disableRemotePlayback:W,prefix:null,property:null,results:H,security:null,unselectable:null},space:"html",transform:sb}),Bk=ia({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vt,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:ve,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Rl,g2:Rl,glyphName:Rl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ve,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vt,rev:vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vt,requiredFeatures:vt,requiredFonts:vt,requiredFormats:vt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vt,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:rb}),ob=ia({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ub=ia({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:sb}),cb=ia({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Uk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ik=/[A-Z]/g,xm=/-[a-z]/g,Hk=/^data[-\w.:]+$/i;function qk(e,t){const n=$c(t);let i=t,l=yt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Hk.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(xm,Gk);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!xm.test(a)){let r=a.replace(Ik,Fk);r.charAt(0)!=="-"&&(r="-"+r),t="data"+r}}l=jd}return new l(i,t)}function Fk(e){return"-"+e.toLowerCase()}function Gk(e){return e.charAt(1).toUpperCase()}const Vk=lb([ab,Mk,ob,ub,cb],"html"),_d=lb([ab,Bk,ob,ub,cb],"svg");function Yk(e){return e.join(" ").trim()}var Rd={},vm=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Pk=/\n/g,Xk=/^\s*/,Qk=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Zk=/^:\s*/,Kk=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,$k=/^[;\s]*/,Jk=/^\s+|\s+$/g,Wk=`
61
61
  `,bm="/",Sm="*",zi="",eN="comment",tN="declaration";function nN(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,i=1;function l(y){var x=y.match(Pk);x&&(n+=x.length);var E=y.lastIndexOf(Wk);i=~E?y.length-E:i+y.length}function a(){var y={line:n,column:i};return function(x){return x.position=new r(y),c(),x}}function r(y){this.start=y,this.end={line:n,column:i},this.source=t.source}r.prototype.content=e;function s(y){var x=new Error(t.source+":"+n+":"+i+": "+y);if(x.reason=y,x.filename=t.source,x.line=n,x.column=i,x.source=e,!t.silent)throw x}function u(y){var x=y.exec(e);if(x){var E=x[0];return l(E),e=e.slice(E.length),x}}function c(){u(Xk)}function d(y){var x;for(y=y||[];x=f();)x!==!1&&y.push(x);return y}function f(){var y=a();if(!(bm!=e.charAt(0)||Sm!=e.charAt(1))){for(var x=2;zi!=e.charAt(x)&&(Sm!=e.charAt(x)||bm!=e.charAt(x+1));)++x;if(x+=2,zi===e.charAt(x-1))return s("End of comment missing");var E=e.slice(2,x-2);return i+=2,l(E),e=e.slice(x),i+=2,y({type:eN,comment:E})}}function h(){var y=a(),x=u(Qk);if(x){if(f(),!u(Zk))return s("property missing ':'");var E=u(Kk),g=y({type:tN,property:Em(x[0].replace(vm,zi)),value:E?Em(E[0].replace(vm,zi)):zi});return u($k),g}}function p(){var y=[];d(y);for(var x;x=h();)x!==!1&&(y.push(x),d(y));return y}return c(),p()}function Em(e){return e?e.replace(Jk,zi):zi}var iN=nN,lN=Es&&Es.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Rd,"__esModule",{value:!0});Rd.default=rN;const aN=lN(iN);function rN(e,t){let n=null;if(!e||typeof e!="string")return n;const i=(0,aN.default)(e),l=typeof t=="function";return i.forEach(a=>{if(a.type!=="declaration")return;const{property:r,value:s}=a;l?t(r,s,a):s&&(n=n||{},n[r]=s)}),n}var Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.camelCase=void 0;var sN=/^--[a-zA-Z0-9_-]+$/,oN=/-([a-z])/g,uN=/^[^-]+$/,cN=/^-(webkit|moz|ms|o|khtml)-/,fN=/^-(ms)-/,dN=function(e){return!e||uN.test(e)||sN.test(e)},hN=function(e,t){return t.toUpperCase()},Cm=function(e,t){return"".concat(t,"-")},pN=function(e,t){return t===void 0&&(t={}),dN(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(fN,Cm):e=e.replace(cN,Cm),e.replace(oN,hN))};Ao.camelCase=pN;var mN=Es&&Es.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},gN=mN(Rd),yN=Ao;function ef(e,t){var n={};return!e||typeof e!="string"||(0,gN.default)(e,function(i,l){i&&l&&(n[(0,yN.camelCase)(i,t)]=l)}),n}ef.default=ef;var xN=ef;const vN=hg(xN),fb=db("end"),Od=db("start");function db(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function bN(e){const t=Od(e),n=fb(e);if(t&&n)return{start:t,end:n}}function qa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Tm(e.position):"start"in e||"end"in e?Tm(e):"line"in e||"column"in e?tf(e):""}function tf(e){return km(e&&e.line)+":"+km(e&&e.column)}function Tm(e){return tf(e&&e.start)+"-"+tf(e&&e.end)}function km(e){return e&&typeof e=="number"?e:1}class tt extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let l="",a={},r=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?l=t:!a.cause&&t&&(r=!0,l=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?a.ruleId=i:(a.source=i.slice(0,u),a.ruleId=i.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=s?s.line:void 0,this.name=qa(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=r&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tt.prototype.file="";tt.prototype.name="";tt.prototype.reason="";tt.prototype.message="";tt.prototype.stack="";tt.prototype.column=void 0;tt.prototype.line=void 0;tt.prototype.ancestors=void 0;tt.prototype.cause=void 0;tt.prototype.fatal=void 0;tt.prototype.place=void 0;tt.prototype.ruleId=void 0;tt.prototype.source=void 0;const Dd={}.hasOwnProperty,SN=new Map,EN=/[A-Z]/g,CN=new Set(["table","tbody","thead","tfoot","tr"]),TN=new Set(["td","th"]),hb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function kN(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=DN(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=ON(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?_d:Vk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=pb(l,e,void 0);return a&&typeof a!="string"?a:l.create(e,l.Fragment,{children:a||void 0},void 0)}function pb(e,t,n){if(t.type==="element")return NN(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return wN(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jN(e,t,n);if(t.type==="mdxjsEsm")return AN(e,t);if(t.type==="root")return _N(e,t,n);if(t.type==="text")return RN(e,t)}function NN(e,t,n){const i=e.schema;let l=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=_d,e.schema=l),e.ancestors.push(t);const a=gb(e,t.tagName,!1),r=zN(e,t);let s=Ld(e,t);return CN.has(t.tagName)&&(s=s.filter(function(u){return typeof u=="string"?!zk(u):!0})),mb(e,r,a,t),zd(r,s),e.ancestors.pop(),e.schema=i,e.create(t,a,r,n)}function wN(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}sr(e,t.position)}function AN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);sr(e,t.position)}function jN(e,t,n){const i=e.schema;let l=i;t.name==="svg"&&i.space==="html"&&(l=_d,e.schema=l),e.ancestors.push(t);const a=t.name===null?e.Fragment:gb(e,t.name,!0),r=LN(e,t),s=Ld(e,t);return mb(e,r,a,t),zd(r,s),e.ancestors.pop(),e.schema=i,e.create(t,a,r,n)}function _N(e,t,n){const i={};return zd(i,Ld(e,t)),e.create(t,e.Fragment,i,n)}function RN(e,t){return t.value}function mb(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function zd(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ON(e,t,n){return i;function i(l,a,r,s){const c=Array.isArray(r.children)?n:t;return s?c(a,r,s):c(a,r)}}function DN(e,t){return n;function n(i,l,a,r){const s=Array.isArray(a.children),u=Od(i);return t(l,a,r,s,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function zN(e,t){const n={};let i,l;for(l in t.properties)if(l!=="children"&&Dd.call(t.properties,l)){const a=MN(e,l,t.properties[l]);if(a){const[r,s]=a;e.tableCellAlignToStyle&&r==="align"&&typeof s=="string"&&TN.has(t.tagName)?i=s:n[r]=s}}if(i){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function LN(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const a=i.data.estree.body[0];a.type;const r=a.expression;r.type;const s=r.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else sr(e,t.position);else{const l=i.name;let a;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const s=i.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else sr(e,t.position);else a=i.value===null?!0:i.value;n[l]=a}return n}function Ld(e,t){const n=[];let i=-1;const l=e.passKeys?new Map:SN;for(;++i<t.children.length;){const a=t.children[i];let r;if(e.passKeys){const u=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(u){const c=l.get(u)||0;r=u+"-"+c,l.set(u,c+1)}}const s=pb(e,a,r);s!==void 0&&n.push(s)}return n}function MN(e,t,n){const i=qk(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?jk(n):Yk(n)),i.property==="style"){let l=typeof n=="object"?n:BN(e,String(n));return e.stylePropertyNameCase==="css"&&(l=UN(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&i.space?Uk[i.property]||i.property:i.attribute,n]}}function BN(e,t){try{return vN(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,l=new tt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=hb+"#cannot-parse-style-attribute",l}}function gb(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let a=-1,r;for(;++a<l.length;){const s=mm(l[a])?{type:"Identifier",name:l[a]}:{type:"Literal",value:l[a]};r=r?{type:"MemberExpression",object:r,property:s,computed:!!(a&&s.type==="Literal"),optional:!1}:s}i=r}else i=mm(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const l=i.value;return Dd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(i);sr(e)}function sr(e,t){const n=new tt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=hb+"#cannot-handle-mdx-estrees-without-createevaluater",n}function UN(e){const t={};let n;for(n in e)Dd.call(e,n)&&(t[IN(n)]=e[n]);return t}function IN(e){let t=e.replace(EN,HN);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function HN(e){return"-"+e.toLowerCase()}const ju={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},qN={};function Md(e,t){const n=qN,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return yb(e,i,l)}function yb(e,t,n){if(FN(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Nm(e.children,t,n)}return Array.isArray(e)?Nm(e,t,n):""}function Nm(e,t,n){const i=[];let l=-1;for(;++l<e.length;)i[l]=yb(e[l],t,n);return i.join("")}function FN(e){return!!(e&&typeof e=="object")}const wm=document.createElement("i");function Bd(e){const t="&"+e+";";wm.innerHTML=t;const n=wm.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function At(e,t,n,i){const l=e.length;let a=0,r;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,i.length<1e4)r=Array.from(i),r.unshift(t,n),e.splice(...r);else for(n&&e.splice(t,n);a<i.length;)r=i.slice(a,a+1e4),r.unshift(t,0),e.splice(...r),a+=1e4,t+=1e4}function Ut(e,t){return e.length>0?(At(e,e.length,0,t),e):t}const Am={}.hasOwnProperty;function xb(e){const t={};let n=-1;for(;++n<e.length;)GN(t,e[n]);return t}function GN(e,t){let n;for(n in t){const l=(Am.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let r;if(a)for(r in a){Am.call(l,r)||(l[r]=[]);const s=a[r];VN(l[r],Array.isArray(s)?s:s?[s]:[])}}}function VN(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);At(e,0,0,i)}function vb(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function tn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const it=Ti(/[A-Za-z]/),et=Ti(/[\dA-Za-z]/),YN=Ti(/[#-'*+\--9=?A-Z^-~]/);function Ws(e){return e!==null&&(e<32||e===127)}const nf=Ti(/\d/),PN=Ti(/[\dA-Fa-f]/),XN=Ti(/[!-/:-@[-`{-~]/);function Q(e){return e!==null&&e<-2}function xe(e){return e!==null&&(e<0||e===32)}function ne(e){return e===-2||e===-1||e===32}const jo=Ti(new RegExp("\\p{P}|\\p{S}","u")),Xi=Ti(/\s/);function Ti(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function la(e){const t=[];let n=-1,i=0,l=0;for(;++n<e.length;){const a=e.charCodeAt(n);let r="";if(a===37&&et(e.charCodeAt(n+1))&&et(e.charCodeAt(n+2)))l=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(r=String.fromCharCode(a));else if(a>55295&&a<57344){const s=e.charCodeAt(n+1);a<56320&&s>56319&&s<57344?(r=String.fromCharCode(a,s),l=1):r="�"}else r=String.fromCharCode(a);r&&(t.push(e.slice(i,n),encodeURIComponent(r)),i=n+l+1,r=""),l&&(n+=l,l=0)}return t.join("")+e.slice(i)}function oe(e,t,n,i){const l=i?i-1:Number.POSITIVE_INFINITY;let a=0;return r;function r(u){return ne(u)?(e.enter(n),s(u)):t(u)}function s(u){return ne(u)&&a++<l?(e.consume(u),s):(e.exit(n),t(u))}}const QN={tokenize:ZN};function ZN(e){const t=e.attempt(this.parser.constructs.contentInitial,i,l);let n;return t;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),oe(e,t,"linePrefix")}function l(s){return e.enter("paragraph"),a(s)}function a(s){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,r(s)}function r(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return Q(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),r)}}const KN={tokenize:$N},jm={tokenize:JN};function $N(e){const t=this,n=[];let i=0,l,a,r;return s;function s(v){if(i<n.length){const C=n[i];return t.containerState=C[1],e.attempt(C[0].continuation,u,c)(v)}return c(v)}function u(v){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&m();const C=t.events.length;let A=C,N;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){N=t.events[A][1].end;break}g(i);let _=C;for(;_<t.events.length;)t.events[_][1].end={...N},_++;return At(t.events,A+1,0,t.events.slice(C)),t.events.length=_,c(v)}return s(v)}function c(v){if(i===n.length){if(!l)return h(v);if(l.currentConstruct&&l.currentConstruct.concrete)return y(v);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(jm,d,f)(v)}function d(v){return l&&m(),g(i),h(v)}function f(v){return t.parser.lazy[t.now().line]=i!==n.length,r=t.now().offset,y(v)}function h(v){return t.containerState={},e.attempt(jm,p,y)(v)}function p(v){return i++,n.push([t.currentConstruct,t.containerState]),h(v)}function y(v){if(v===null){l&&m(),g(0),e.consume(v);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:a}),x(v)}function x(v){if(v===null){E(e.exit("chunkFlow"),!0),g(0),e.consume(v);return}return Q(v)?(e.consume(v),E(e.exit("chunkFlow")),i=0,t.interrupt=void 0,s):(e.consume(v),x)}function E(v,C){const A=t.sliceStream(v);if(C&&A.push(null),v.previous=a,a&&(a.next=v),a=v,l.defineSkip(v.start),l.write(A),t.parser.lazy[v.start.line]){let N=l.events.length;for(;N--;)if(l.events[N][1].start.offset<r&&(!l.events[N][1].end||l.events[N][1].end.offset>r))return;const _=t.events.length;let U=_,D,T;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(D){T=t.events[U][1].end;break}D=!0}for(g(i),N=_;N<t.events.length;)t.events[N][1].end={...T},N++;At(t.events,U+1,0,t.events.slice(_)),t.events.length=N}}function g(v){let C=n.length;for(;C-- >v;){const A=n[C];t.containerState=A[1],A[0].exit.call(t,e)}n.length=v}function m(){l.write([null]),a=void 0,l=void 0,t.containerState._closeFlow=void 0}}function JN(e,t,n){return oe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vl(e){if(e===null||xe(e)||Xi(e))return 1;if(jo(e))return 2}function _o(e,t,n){const i=[];let l=-1;for(;++l<e.length;){const a=e[l].resolveAll;a&&!i.includes(a)&&(t=a(t,n),i.push(a))}return t}const lf={name:"attention",resolveAll:WN,tokenize:ew};function WN(e,t){let n=-1,i,l,a,r,s,u,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[i][1].end},h={...e[n][1].start};_m(f,-u),_m(h,u),r={type:u>1?"strongSequence":"emphasisSequence",start:f,end:{...e[i][1].end}},s={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},a={type:u>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},l={type:u>1?"strong":"emphasis",start:{...r.start},end:{...s.end}},e[i][1].end={...r.start},e[n][1].start={...s.end},c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=Ut(c,[["enter",e[i][1],t],["exit",e[i][1],t]])),c=Ut(c,[["enter",l,t],["enter",r,t],["exit",r,t],["enter",a,t]]),c=Ut(c,_o(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),c=Ut(c,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Ut(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,At(e,i-1,n-i+3,c),n=i+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ew(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,l=Vl(i);let a;return r;function r(u){return a=u,e.enter("attentionSequence"),s(u)}function s(u){if(u===a)return e.consume(u),s;const c=e.exit("attentionSequence"),d=Vl(u),f=!d||d===2&&l||n.includes(u),h=!l||l===2&&d||n.includes(i);return c._open=!!(a===42?f:f&&(l||!h)),c._close=!!(a===42?h:h&&(d||!f)),t(u)}}function _m(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const tw={name:"autolink",tokenize:nw};function nw(e,t,n){let i=0;return l;function l(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return it(p)?(e.consume(p),r):p===64?n(p):c(p)}function r(p){return p===43||p===45||p===46||et(p)?(i=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),i=0,u):(p===43||p===45||p===46||et(p))&&i++<32?(e.consume(p),s):(i=0,c(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Ws(p)?n(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),d):YN(p)?(e.consume(p),c):n(p)}function d(p){return et(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),i=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||et(p))&&i++<63){const y=p===45?h:f;return e.consume(p),y}return n(p)}}const Nr={partial:!0,tokenize:iw};function iw(e,t,n){return i;function i(a){return ne(a)?oe(e,l,"linePrefix")(a):l(a)}function l(a){return a===null||Q(a)?t(a):n(a)}}const bb={continuation:{tokenize:aw},exit:rw,name:"blockQuote",tokenize:lw};function lw(e,t,n){const i=this;return l;function l(r){if(r===62){const s=i.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(r),e.exit("blockQuoteMarker"),a}return n(r)}function a(r){return ne(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}function aw(e,t,n){const i=this;return l;function l(r){return ne(r)?oe(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(r):a(r)}function a(r){return e.attempt(bb,t,n)(r)}}function rw(e){e.exit("blockQuote")}const Sb={name:"characterEscape",tokenize:sw};function sw(e,t,n){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),l}function l(a){return XN(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Eb={name:"characterReference",tokenize:ow};function ow(e,t,n){const i=this;let l=0,a,r;return s;function s(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),u}function u(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),a=31,r=et,d(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,r=PN,d):(e.enter("characterReferenceValue"),a=7,r=nf,d(f))}function d(f){if(f===59&&l){const h=e.exit("characterReferenceValue");return r===et&&!Bd(i.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return r(f)&&l++<a?(e.consume(f),d):n(f)}}const Rm={partial:!0,tokenize:cw},Om={concrete:!0,name:"codeFenced",tokenize:uw};function uw(e,t,n){const i=this,l={partial:!0,tokenize:A};let a=0,r=0,s;return u;function u(N){return c(N)}function c(N){const _=i.events[i.events.length-1];return a=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,s=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(N)}function d(N){return N===s?(r++,e.consume(N),d):r<3?n(N):(e.exit("codeFencedFenceSequence"),ne(N)?oe(e,f,"whitespace")(N):f(N))}function f(N){return N===null||Q(N)?(e.exit("codeFencedFence"),i.interrupt?t(N):e.check(Rm,x,C)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(N))}function h(N){return N===null||Q(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(N)):ne(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),oe(e,p,"whitespace")(N)):N===96&&N===s?n(N):(e.consume(N),h)}function p(N){return N===null||Q(N)?f(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||Q(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(N)):N===96&&N===s?n(N):(e.consume(N),y)}function x(N){return e.attempt(l,C,E)(N)}function E(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),g}function g(N){return a>0&&ne(N)?oe(e,m,"linePrefix",a+1)(N):m(N)}function m(N){return N===null||Q(N)?e.check(Rm,x,C)(N):(e.enter("codeFlowValue"),v(N))}function v(N){return N===null||Q(N)?(e.exit("codeFlowValue"),m(N)):(e.consume(N),v)}function C(N){return e.exit("codeFenced"),t(N)}function A(N,_,U){let D=0;return T;function T(V){return N.enter("lineEnding"),N.consume(V),N.exit("lineEnding"),M}function M(V){return N.enter("codeFencedFence"),ne(V)?oe(N,q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):q(V)}function q(V){return V===s?(N.enter("codeFencedFenceSequence"),P(V)):U(V)}function P(V){return V===s?(D++,N.consume(V),P):D>=r?(N.exit("codeFencedFenceSequence"),ne(V)?oe(N,F,"whitespace")(V):F(V)):U(V)}function F(V){return V===null||Q(V)?(N.exit("codeFencedFence"),_(V)):U(V)}}}function cw(e,t,n){const i=this;return l;function l(r){return r===null?n(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),a)}function a(r){return i.parser.lazy[i.now().line]?n(r):t(r)}}const _u={name:"codeIndented",tokenize:dw},fw={partial:!0,tokenize:hw};function dw(e,t,n){const i=this;return l;function l(c){return e.enter("codeIndented"),oe(e,a,"linePrefix",5)(c)}function a(c){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?r(c):n(c)}function r(c){return c===null?u(c):Q(c)?e.attempt(fw,r,u)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||Q(c)?(e.exit("codeFlowValue"),r(c)):(e.consume(c),s)}function u(c){return e.exit("codeIndented"),t(c)}}function hw(e,t,n){const i=this;return l;function l(r){return i.parser.lazy[i.now().line]?n(r):Q(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),l):oe(e,a,"linePrefix",5)(r)}function a(r){const s=i.events[i.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(r):Q(r)?l(r):n(r)}}const pw={name:"codeText",previous:gw,resolve:mw,tokenize:yw};function mw(e){let t=e.length-4,n=3,i,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)l===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(l=i):(i===t||e[i][1].type==="lineEnding")&&(e[l][1].type="codeTextData",i!==l+2&&(e[l][1].end=e[i-1][1].end,e.splice(l+2,i-l-2),t-=i-l-2,i=l+2),l=void 0);return e}function gw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function yw(e,t,n){let i=0,l,a;return r;function r(f){return e.enter("codeText"),e.enter("codeTextSequence"),s(f)}function s(f){return f===96?(e.consume(f),i++,s):(e.exit("codeTextSequence"),u(f))}function u(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),u):f===96?(a=e.enter("codeTextSequence"),l=0,d(f)):Q(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||Q(f)?(e.exit("codeTextData"),u(f)):(e.consume(f),c)}function d(f){return f===96?(e.consume(f),l++,d):l===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(a.type="codeTextData",c(f))}}class xw{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const l=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&ya(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ya(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ya(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ya(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ya(this.left,n.reverse())}}}function ya(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Cb(e){const t={};let n=-1,i,l,a,r,s,u,c;const d=new xw(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(i=d.get(n),n&&i[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(u=i[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type==="lineEndingBlank"&&(a+=2),a<u.length&&u[a][1].type==="content"))for(;++a<u.length&&u[a][1].type!=="content";)u[a][1].type==="chunkText"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,vw(d,n)),n=t[n],c=!0);else if(i[1]._container){for(a=n,l=void 0;a--;)if(r=d.get(a),r[1].type==="lineEnding"||r[1].type==="lineEndingBlank")r[0]==="enter"&&(l&&(d.get(l)[1].type="lineEndingBlank"),r[1].type="lineEnding",l=a);else if(!(r[1].type==="linePrefix"||r[1].type==="listItemIndent"))break;l&&(i[1].end={...d.get(l)[1].start},s=d.slice(l,n),s.unshift(i),d.splice(l,n-l+1,s))}}return At(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function vw(e,t){const n=e.get(t)[1],i=e.get(t)[2];let l=t-1;const a=[];let r=n._tokenizer;r||(r=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(r._contentTypeTextTrailing=!0));const s=r.events,u=[],c={};let d,f,h=-1,p=n,y=0,x=0;const E=[x];for(;p;){for(;e.get(++l)[1]!==p;);a.push(l),p._tokenizer||(d=i.sliceStream(p),p.next||d.push(null),f&&r.defineSkip(p.start),p._isInFirstContentOfListItem&&(r._gfmTasklistFirstContentOfListItem=!0),r.write(d),p._isInFirstContentOfListItem&&(r._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<s.length;)s[h][0]==="exit"&&s[h-1][0]==="enter"&&s[h][1].type===s[h-1][1].type&&s[h][1].start.line!==s[h][1].end.line&&(x=h+1,E.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(r.events=[],p?(p._tokenizer=void 0,p.previous=void 0):E.pop(),h=E.length;h--;){const g=s.slice(E[h],E[h+1]),m=a.pop();u.push([m,m+g.length-1]),e.splice(m,2,g)}for(u.reverse(),h=-1;++h<u.length;)c[y+u[h][0]]=y+u[h][1],y+=u[h][1]-u[h][0]-1;return c}const bw={resolve:Ew,tokenize:Cw},Sw={partial:!0,tokenize:Tw};function Ew(e){return Cb(e),e}function Cw(e,t){let n;return i;function i(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(s)}function l(s){return s===null?a(s):Q(s)?e.check(Sw,r,a)(s):(e.consume(s),l)}function a(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function r(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,l}}function Tw(e,t,n){const i=this;return l;function l(r){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),oe(e,a,"linePrefix")}function a(r){if(r===null||Q(r))return n(r);const s=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(r):e.interrupt(i.parser.constructs.flow,n,t)(r)}}function Tb(e,t,n,i,l,a,r,s,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(i),e.enter(l),e.enter(a),e.consume(g),e.exit(a),h):g===null||g===32||g===41||Ws(g)?n(g):(e.enter(i),e.enter(r),e.enter(s),e.enter("chunkString",{contentType:"string"}),x(g))}function h(g){return g===62?(e.enter(a),e.consume(g),e.exit(a),e.exit(l),e.exit(i),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(s),h(g)):g===null||g===60||Q(g)?n(g):(e.consume(g),g===92?y:p)}function y(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function x(g){return!d&&(g===null||g===41||xe(g))?(e.exit("chunkString"),e.exit(s),e.exit(r),e.exit(i),t(g)):d<c&&g===40?(e.consume(g),d++,x):g===41?(e.consume(g),d--,x):g===null||g===32||g===40||Ws(g)?n(g):(e.consume(g),g===92?E:x)}function E(g){return g===40||g===41||g===92?(e.consume(g),x):x(g)}}function kb(e,t,n,i,l,a){const r=this;let s=0,u;return c;function c(p){return e.enter(i),e.enter(l),e.consume(p),e.exit(l),e.enter(a),d}function d(p){return s>999||p===null||p===91||p===93&&!u||p===94&&!s&&"_hiddenFootnoteSupport"in r.parser.constructs?n(p):p===93?(e.exit(a),e.enter(l),e.consume(p),e.exit(l),e.exit(i),t):Q(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Q(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),u||(u=!ne(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),s++,f):f(p)}}function Nb(e,t,n,i,l,a){let r;return s;function s(h){return h===34||h===39||h===40?(e.enter(i),e.enter(l),e.consume(h),e.exit(l),r=h===40?41:h,u):n(h)}function u(h){return h===r?(e.enter(l),e.consume(h),e.exit(l),e.exit(i),t):(e.enter(a),c(h))}function c(h){return h===r?(e.exit(a),u(r)):h===null?n(h):Q(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),oe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===r||h===null||Q(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?f:d)}function f(h){return h===r||h===92?(e.consume(h),d):d(h)}}function Fa(e,t){let n;return i;function i(l){return Q(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,i):ne(l)?oe(e,i,n?"linePrefix":"lineSuffix")(l):t(l)}}const kw={name:"definition",tokenize:ww},Nw={partial:!0,tokenize:Aw};function ww(e,t,n){const i=this;let l;return a;function a(p){return e.enter("definition"),r(p)}function r(p){return kb.call(i,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return l=tn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return xe(p)?Fa(e,c)(p):c(p)}function c(p){return Tb(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Nw,f,f)(p)}function f(p){return ne(p)?oe(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Q(p)?(e.exit("definition"),i.parser.defined.push(l),t(p)):n(p)}}function Aw(e,t,n){return i;function i(s){return xe(s)?Fa(e,l)(s):n(s)}function l(s){return Nb(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return ne(s)?oe(e,r,"whitespace")(s):r(s)}function r(s){return s===null||Q(s)?t(s):n(s)}}const jw={name:"hardBreakEscape",tokenize:_w};function _w(e,t,n){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),l}function l(a){return Q(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const Rw={name:"headingAtx",resolve:Ow,tokenize:Dw};function Ow(e,t){let n=e.length-2,i=3,l,a;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(l={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},a={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},At(e,i,n-i+1,[["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t]])),e}function Dw(e,t,n){let i=0;return l;function l(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),r(d)}function r(d){return d===35&&i++<6?(e.consume(d),r):d===null||xe(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||Q(d)?(e.exit("atxHeading"),t(d)):ne(d)?oe(e,s,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),s(d))}function c(d){return d===null||d===35||xe(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),c)}}const zw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Dm=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Iw},Mw={partial:!0,tokenize:qw},Bw={partial:!0,tokenize:Hw};function Uw(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Iw(e,t,n){const i=this;let l,a,r,s,u;return c;function c(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),f}function f(k){return k===33?(e.consume(k),h):k===47?(e.consume(k),a=!0,x):k===63?(e.consume(k),l=3,i.interrupt?t:S):it(k)?(e.consume(k),r=String.fromCharCode(k),E):n(k)}function h(k){return k===45?(e.consume(k),l=2,p):k===91?(e.consume(k),l=5,s=0,y):it(k)?(e.consume(k),l=4,i.interrupt?t:S):n(k)}function p(k){return k===45?(e.consume(k),i.interrupt?t:S):n(k)}function y(k){const _e="CDATA[";return k===_e.charCodeAt(s++)?(e.consume(k),s===_e.length?i.interrupt?t:q:y):n(k)}function x(k){return it(k)?(e.consume(k),r=String.fromCharCode(k),E):n(k)}function E(k){if(k===null||k===47||k===62||xe(k)){const _e=k===47,st=r.toLowerCase();return!_e&&!a&&Dm.includes(st)?(l=1,i.interrupt?t(k):q(k)):zw.includes(r.toLowerCase())?(l=6,_e?(e.consume(k),g):i.interrupt?t(k):q(k)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(k):a?m(k):v(k))}return k===45||et(k)?(e.consume(k),r+=String.fromCharCode(k),E):n(k)}function g(k){return k===62?(e.consume(k),i.interrupt?t:q):n(k)}function m(k){return ne(k)?(e.consume(k),m):T(k)}function v(k){return k===47?(e.consume(k),T):k===58||k===95||it(k)?(e.consume(k),C):ne(k)?(e.consume(k),v):T(k)}function C(k){return k===45||k===46||k===58||k===95||et(k)?(e.consume(k),C):A(k)}function A(k){return k===61?(e.consume(k),N):ne(k)?(e.consume(k),A):v(k)}function N(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),u=k,_):ne(k)?(e.consume(k),N):U(k)}function _(k){return k===u?(e.consume(k),u=null,D):k===null||Q(k)?n(k):(e.consume(k),_)}function U(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||xe(k)?A(k):(e.consume(k),U)}function D(k){return k===47||k===62||ne(k)?v(k):n(k)}function T(k){return k===62?(e.consume(k),M):n(k)}function M(k){return k===null||Q(k)?q(k):ne(k)?(e.consume(k),M):n(k)}function q(k){return k===45&&l===2?(e.consume(k),j):k===60&&l===1?(e.consume(k),O):k===62&&l===4?(e.consume(k),we):k===63&&l===3?(e.consume(k),S):k===93&&l===5?(e.consume(k),X):Q(k)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(Mw,We,P)(k)):k===null||Q(k)?(e.exit("htmlFlowData"),P(k)):(e.consume(k),q)}function P(k){return e.check(Bw,F,We)(k)}function F(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),V}function V(k){return k===null||Q(k)?P(k):(e.enter("htmlFlowData"),q(k))}function j(k){return k===45?(e.consume(k),S):q(k)}function O(k){return k===47?(e.consume(k),r="",w):q(k)}function w(k){if(k===62){const _e=r.toLowerCase();return Dm.includes(_e)?(e.consume(k),we):q(k)}return it(k)&&r.length<8?(e.consume(k),r+=String.fromCharCode(k),w):q(k)}function X(k){return k===93?(e.consume(k),S):q(k)}function S(k){return k===62?(e.consume(k),we):k===45&&l===2?(e.consume(k),S):q(k)}function we(k){return k===null||Q(k)?(e.exit("htmlFlowData"),We(k)):(e.consume(k),we)}function We(k){return e.exit("htmlFlow"),t(k)}}function Hw(e,t,n){const i=this;return l;function l(r){return Q(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),a):n(r)}function a(r){return i.parser.lazy[i.now().line]?n(r):t(r)}}function qw(e,t,n){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Nr,t,n)}}const Fw={name:"htmlText",tokenize:Gw};function Gw(e,t,n){const i=this;let l,a,r;return s;function s(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),u}function u(S){return S===33?(e.consume(S),c):S===47?(e.consume(S),A):S===63?(e.consume(S),v):it(S)?(e.consume(S),U):n(S)}function c(S){return S===45?(e.consume(S),d):S===91?(e.consume(S),a=0,y):it(S)?(e.consume(S),m):n(S)}function d(S){return S===45?(e.consume(S),p):n(S)}function f(S){return S===null?n(S):S===45?(e.consume(S),h):Q(S)?(r=f,O(S)):(e.consume(S),f)}function h(S){return S===45?(e.consume(S),p):f(S)}function p(S){return S===62?j(S):S===45?h(S):f(S)}function y(S){const we="CDATA[";return S===we.charCodeAt(a++)?(e.consume(S),a===we.length?x:y):n(S)}function x(S){return S===null?n(S):S===93?(e.consume(S),E):Q(S)?(r=x,O(S)):(e.consume(S),x)}function E(S){return S===93?(e.consume(S),g):x(S)}function g(S){return S===62?j(S):S===93?(e.consume(S),g):x(S)}function m(S){return S===null||S===62?j(S):Q(S)?(r=m,O(S)):(e.consume(S),m)}function v(S){return S===null?n(S):S===63?(e.consume(S),C):Q(S)?(r=v,O(S)):(e.consume(S),v)}function C(S){return S===62?j(S):v(S)}function A(S){return it(S)?(e.consume(S),N):n(S)}function N(S){return S===45||et(S)?(e.consume(S),N):_(S)}function _(S){return Q(S)?(r=_,O(S)):ne(S)?(e.consume(S),_):j(S)}function U(S){return S===45||et(S)?(e.consume(S),U):S===47||S===62||xe(S)?D(S):n(S)}function D(S){return S===47?(e.consume(S),j):S===58||S===95||it(S)?(e.consume(S),T):Q(S)?(r=D,O(S)):ne(S)?(e.consume(S),D):j(S)}function T(S){return S===45||S===46||S===58||S===95||et(S)?(e.consume(S),T):M(S)}function M(S){return S===61?(e.consume(S),q):Q(S)?(r=M,O(S)):ne(S)?(e.consume(S),M):D(S)}function q(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,P):Q(S)?(r=q,O(S)):ne(S)?(e.consume(S),q):(e.consume(S),F)}function P(S){return S===l?(e.consume(S),l=void 0,V):S===null?n(S):Q(S)?(r=P,O(S)):(e.consume(S),P)}function F(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||xe(S)?D(S):(e.consume(S),F)}function V(S){return S===47||S===62||xe(S)?D(S):n(S)}function j(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function O(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),w}function w(S){return ne(S)?oe(e,X,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):X(S)}function X(S){return e.enter("htmlTextData"),r(S)}}const Ud={name:"labelEnd",resolveAll:Xw,resolveTo:Qw,tokenize:Zw},Vw={tokenize:Kw},Yw={tokenize:$w},Pw={tokenize:Jw};function Xw(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const l=i.type==="labelImage"?4:2;i.type="data",t+=l}}return e.length!==n.length&&At(e,0,e.length,n),e}function Qw(e,t){let n=e.length,i=0,l,a,r,s;for(;n--;)if(l=e[n][1],a){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[n][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(r){if(e[n][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(a=n,l.type!=="labelLink")){i=2;break}}else l.type==="labelEnd"&&(r=n);const u={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[a][1].start},end:{...e[r][1].end}},d={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[r-2][1].start}};return s=[["enter",u,t],["enter",c,t]],s=Ut(s,e.slice(a+1,a+i+3)),s=Ut(s,[["enter",d,t]]),s=Ut(s,_o(t.parser.constructs.insideSpan.null,e.slice(a+i+4,r-3),t)),s=Ut(s,[["exit",d,t],e[r-2],e[r-1],["exit",c,t]]),s=Ut(s,e.slice(r+1)),s=Ut(s,[["exit",u,t]]),At(e,a,e.length,s),e}function Zw(e,t,n){const i=this;let l=i.events.length,a,r;for(;l--;)if((i.events[l][1].type==="labelImage"||i.events[l][1].type==="labelLink")&&!i.events[l][1]._balanced){a=i.events[l][1];break}return s;function s(h){return a?a._inactive?f(h):(r=i.parser.defined.includes(tn(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),u):n(h)}function u(h){return h===40?e.attempt(Vw,d,r?d:f)(h):h===91?e.attempt(Yw,d,r?c:f)(h):r?d(h):f(h)}function c(h){return e.attempt(Pw,d,f)(h)}function d(h){return t(h)}function f(h){return a._balanced=!0,n(h)}}function Kw(e,t,n){return i;function i(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),l}function l(f){return xe(f)?Fa(e,a)(f):a(f)}function a(f){return f===41?d(f):Tb(e,r,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function r(f){return xe(f)?Fa(e,u)(f):d(f)}function s(f){return n(f)}function u(f){return f===34||f===39||f===40?Nb(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function c(f){return xe(f)?Fa(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function $w(e,t,n){const i=this;return l;function l(s){return kb.call(i,e,a,r,"reference","referenceMarker","referenceString")(s)}function a(s){return i.parser.defined.includes(tn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function r(s){return n(s)}}function Jw(e,t,n){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),l}function l(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const Ww={name:"labelStartImage",resolveAll:Ud.resolveAll,tokenize:eA};function eA(e,t,n){const i=this;return l;function l(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),a}function a(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),r):n(s)}function r(s){return s===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(s):t(s)}}const tA={name:"labelStartLink",resolveAll:Ud.resolveAll,tokenize:nA};function nA(e,t,n){const i=this;return l;function l(r){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(r),e.exit("labelMarker"),e.exit("labelLink"),a}function a(r){return r===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(r):t(r)}}const Ru={name:"lineEnding",tokenize:iA};function iA(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),oe(e,t,"linePrefix")}}const bs={name:"thematicBreak",tokenize:lA};function lA(e,t,n){let i=0,l;return a;function a(c){return e.enter("thematicBreak"),r(c)}function r(c){return l=c,s(c)}function s(c){return c===l?(e.enter("thematicBreakSequence"),u(c)):i>=3&&(c===null||Q(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===l?(e.consume(c),i++,u):(e.exit("thematicBreakSequence"),ne(c)?oe(e,s,"whitespace")(c):s(c))}}const ft={continuation:{tokenize:oA},exit:cA,name:"list",tokenize:sA},aA={partial:!0,tokenize:fA},rA={partial:!0,tokenize:uA};function sA(e,t,n){const i=this,l=i.events[i.events.length-1];let a=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,r=0;return s;function s(p){const y=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:nf(p)){if(i.containerState.type||(i.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(bs,n,c)(p):c(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return nf(p)&&++r<10?(e.consume(p),u):(!i.interrupt||r<2)&&(i.containerState.marker?p===i.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||p,e.check(Nr,i.interrupt?n:d,e.attempt(aA,h,f))}function d(p){return i.containerState.initialBlankLine=!0,a++,h(p)}function f(p){return ne(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function oA(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Nr,l,a);function l(s){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,oe(e,t,"listItemIndent",i.containerState.size+1)(s)}function a(s){return i.containerState.furtherBlankLines||!ne(s)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,r(s)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(rA,t,r)(s))}function r(s){return i.containerState._closeFlow=!0,i.interrupt=void 0,oe(e,e.attempt(ft,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function uA(e,t,n){const i=this;return oe(e,l,"listItemIndent",i.containerState.size+1);function l(a){const r=i.events[i.events.length-1];return r&&r[1].type==="listItemIndent"&&r[2].sliceSerialize(r[1],!0).length===i.containerState.size?t(a):n(a)}}function cA(e){e.exit(this.containerState.type)}function fA(e,t,n){const i=this;return oe(e,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(a){const r=i.events[i.events.length-1];return!ne(a)&&r&&r[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const zm={name:"setextUnderline",resolveTo:dA,tokenize:hA};function dA(e,t){let n=e.length,i,l,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const r={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",a?(e.splice(l,0,["enter",r,t]),e.splice(a+1,0,["exit",e[i][1],t]),e[i][1].end={...e[a][1].end}):e[i][1]=r,e.push(["exit",r,t]),e}function hA(e,t,n){const i=this;let l;return a;function a(c){let d=i.events.length,f;for(;d--;)if(i.events[d][1].type!=="lineEnding"&&i.events[d][1].type!=="linePrefix"&&i.events[d][1].type!=="content"){f=i.events[d][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||f)?(e.enter("setextHeadingLine"),l=c,r(c)):n(c)}function r(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===l?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),ne(c)?oe(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||Q(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const pA={tokenize:mA};function mA(e){const t=this,n=e.attempt(Nr,i,e.attempt(this.parser.constructs.flowInitial,l,oe(e,e.attempt(this.parser.constructs.flow,l,e.attempt(bw,l)),"linePrefix")));return n;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const gA={resolveAll:Ab()},yA=wb("string"),xA=wb("text");function wb(e){return{resolveAll:Ab(e==="text"?vA:void 0),tokenize:t};function t(n){const i=this,l=this.parser.constructs[e],a=n.attempt(l,r,s);return r;function r(d){return c(d)?a(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return c(d)?(n.exit("data"),a(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const f=l[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(i,i.previous))return!0}return!1}}}function Ab(e){return t;function t(n,i){let l=-1,a;for(;++l<=n.length;)a===void 0?n[l]&&n[l][1].type==="data"&&(a=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==a+2&&(n[a][1].end=n[l-1][1].end,n.splice(a+2,l-a-2),l=a+2),a=void 0);return e?e(n,i):n}}function vA(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],l=t.sliceStream(i);let a=l.length,r=-1,s=0,u;for(;a--;){const c=l[a];if(typeof c=="string"){for(r=c.length;c.charCodeAt(r-1)===32;)s++,r--;if(r)break;r=-1}else if(c===-2)u=!0,s++;else if(c!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const c={type:n===e.length||u||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?r:i.start._bufferIndex+r,_index:i.start._index+a,line:i.end.line,column:i.end.column-s,offset:i.end.offset-s},end:{...i.end}};i.end={...c.start},i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const bA={42:ft,43:ft,45:ft,48:ft,49:ft,50:ft,51:ft,52:ft,53:ft,54:ft,55:ft,56:ft,57:ft,62:bb},SA={91:kw},EA={[-2]:_u,[-1]:_u,32:_u},CA={35:Rw,42:bs,45:[zm,bs],60:Lw,61:zm,95:bs,96:Om,126:Om},TA={38:Eb,92:Sb},kA={[-5]:Ru,[-4]:Ru,[-3]:Ru,33:Ww,38:Eb,42:lf,60:[tw,Fw],91:tA,92:[jw,Sb],93:Ud,95:lf,96:pw},NA={null:[lf,gA]},wA={null:[42,95]},AA={null:[]},jA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:wA,contentInitial:SA,disable:AA,document:bA,flow:CA,flowInitial:EA,insideSpan:NA,string:TA,text:kA},Symbol.toStringTag,{value:"Module"}));function _A(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const l={},a=[];let r=[],s=[];const u={attempt:_(A),check:_(N),consume:m,enter:v,exit:C,interrupt:_(N,{interrupt:!0})},c={code:null,containerState:{},defineSkip:x,events:[],now:y,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=t.tokenize.call(c,u);return t.resolveAll&&a.push(t),c;function f(M){return r=Ut(r,M),E(),r[r.length-1]!==null?[]:(U(t,0),c.events=_o(a,c.events,c),c.events)}function h(M,q){return OA(p(M),q)}function p(M){return RA(r,M)}function y(){const{_bufferIndex:M,_index:q,line:P,column:F,offset:V}=i;return{_bufferIndex:M,_index:q,line:P,column:F,offset:V}}function x(M){l[M.line]=M.column,T()}function E(){let M;for(;i._index<r.length;){const q=r[i._index];if(typeof q=="string")for(M=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===M&&i._bufferIndex<q.length;)g(q.charCodeAt(i._bufferIndex));else g(q)}}function g(M){d=d(M)}function m(M){Q(M)?(i.line++,i.column=1,i.offset+=M===-3?2:1,T()):M!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===r[i._index].length&&(i._bufferIndex=-1,i._index++)),c.previous=M}function v(M,q){const P=q||{};return P.type=M,P.start=y(),c.events.push(["enter",P,c]),s.push(P),P}function C(M){const q=s.pop();return q.end=y(),c.events.push(["exit",q,c]),q}function A(M,q){U(M,q.from)}function N(M,q){q.restore()}function _(M,q){return P;function P(F,V,j){let O,w,X,S;return Array.isArray(F)?We(F):"tokenize"in F?We([F]):we(F);function we(Ie){return ki;function ki(ln){const Gn=ln!==null&&Ie[ln],Vn=ln!==null&&Ie.null,Ni=[...Array.isArray(Gn)?Gn:Gn?[Gn]:[],...Array.isArray(Vn)?Vn:Vn?[Vn]:[]];return We(Ni)(ln)}}function We(Ie){return O=Ie,w=0,Ie.length===0?j:k(Ie[w])}function k(Ie){return ki;function ki(ln){return S=D(),X=Ie,Ie.partial||(c.currentConstruct=Ie),Ie.name&&c.parser.constructs.disable.null.includes(Ie.name)?st():Ie.tokenize.call(q?Object.assign(Object.create(c),q):c,u,_e,st)(ln)}}function _e(Ie){return M(X,S),V}function st(Ie){return S.restore(),++w<O.length?k(O[w]):j}}}function U(M,q){M.resolveAll&&!a.includes(M)&&a.push(M),M.resolve&&At(c.events,q,c.events.length-q,M.resolve(c.events.slice(q),c)),M.resolveTo&&(c.events=M.resolveTo(c.events,c))}function D(){const M=y(),q=c.previous,P=c.currentConstruct,F=c.events.length,V=Array.from(s);return{from:F,restore:j};function j(){i=M,c.previous=q,c.currentConstruct=P,c.events.length=F,s=V,T()}}function T(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function RA(e,t){const n=t.start._index,i=t.start._bufferIndex,l=t.end._index,a=t.end._bufferIndex;let r;if(n===l)r=[e[n].slice(i,a)];else{if(r=e.slice(n,l),i>-1){const s=r[0];typeof s=="string"?r[0]=s.slice(i):r.shift()}a>0&&r.push(e[l].slice(0,a))}return r}function OA(e,t){let n=-1;const i=[];let l;for(;++n<e.length;){const a=e[n];let r;if(typeof a=="string")r=a;else switch(a){case-5:{r="\r";break}case-4:{r=`
62
62
  `;break}case-3:{r=`\r
63
63
  `;break}case-2:{r=t?" ":" ";break}case-1:{if(!t&&l)continue;r=" ";break}default:r=String.fromCharCode(a)}l=a===-2,i.push(r)}return i.join("")}function DA(e){const i={constructs:xb([jA,...(e||{}).extensions||[]]),content:l(QN),defined:[],document:l(KN),flow:l(pA),lazy:{},string:l(yA),text:l(xA)};return i;function l(a){return r;function r(s){return _A(i,a,s)}}}function zA(e){for(;!Cb(e););return e}const Lm=/[\0\t\n\r]/g;function LA(){let e=1,t="",n=!0,i;return l;function l(a,r,s){const u=[];let c,d,f,h,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(r||void 0).decode(a)),f=0,t="",n&&(a.charCodeAt(0)===65279&&f++,n=void 0);f<a.length;){if(Lm.lastIndex=f,c=Lm.exec(a),h=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(h),!c){t=a.slice(f);break}if(p===10&&f===h&&i)u.push(-3),i=void 0;else switch(i&&(u.push(-5),i=void 0),f<h&&(u.push(a.slice(f,h)),e+=h-f),p){case 0:{u.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,u.push(-2);e++<d;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:i=!0,e=1}f=h+1}return s&&(i&&u.push(-5),t&&u.push(t),u.push(null)),u}}const MA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function BA(e){return e.replace(MA,UA)}function UA(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),a=l===120||l===88;return vb(n.slice(a?2:1),a?16:10)}return Bd(n)||e}const jb={}.hasOwnProperty;function IA(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),HA(n)(zA(DA(n).document().write(LA()(e,t,!0))))}function HA(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Ot),autolinkProtocol:D,autolinkEmail:D,atxHeading:a(Ar),blockQuote:a(Vn),characterEscape:D,characterReference:D,codeFenced:a(Ni),codeFencedFenceInfo:r,codeFencedFenceMeta:r,codeIndented:a(Ni,r),codeText:a(zo,r),codeTextData:D,data:D,codeFlowValue:D,definition:a(Lo),definitionDestinationString:r,definitionLabelString:r,definitionTitleString:r,emphasis:a(Mo),hardBreakEscape:a(R),hardBreakTrailing:a(R),htmlFlow:a(G,r),htmlFlowData:D,htmlText:a(G,r),htmlTextData:D,image:a(He),label:r,link:a(Ot),listItem:a(h0),listItemValue:h,listOrdered:a(an,f),listUnordered:a(an),paragraph:a(p0),reference:k,referenceString:r,resourceDestinationString:r,resourceTitleString:r,setextHeading:a(Ar),strong:a(m0),thematicBreak:a(y0)},exit:{atxHeading:u(),atxHeadingSequence:A,autolink:u(),autolinkEmail:Gn,autolinkProtocol:ln,blockQuote:u(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:st,characterReferenceMarkerNumeric:st,characterReferenceValue:Ie,characterReference:ki,codeFenced:u(E),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:y,codeFlowValue:T,codeIndented:u(g),codeText:u(V),codeTextData:T,data:T,definition:u(),definitionDestinationString:C,definitionLabelString:m,definitionTitleString:v,emphasis:u(),hardBreakEscape:u(q),hardBreakTrailing:u(q),htmlFlow:u(P),htmlFlowData:T,htmlText:u(F),htmlTextData:T,image:u(O),label:X,labelText:w,lineEnding:M,link:u(j),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:_e,resourceDestinationString:S,resourceTitleString:we,resource:We,setextHeading:u(U),setextHeadingLineSequence:_,setextHeadingText:N,strong:u(),thematicBreak:u()}};_b(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(z){let Y={type:"root",children:[]};const K={stack:[Y],tokenStack:[],config:t,enter:s,exit:c,buffer:r,resume:d,data:n},le=[];let ge=-1;for(;++ge<z.length;)if(z[ge][1].type==="listOrdered"||z[ge][1].type==="listUnordered")if(z[ge][0]==="enter")le.push(ge);else{const Xt=le.pop();ge=l(z,Xt,ge)}for(ge=-1;++ge<z.length;){const Xt=t[z[ge][0]];jb.call(Xt,z[ge][1].type)&&Xt[z[ge][1].type].call(Object.assign({sliceSerialize:z[ge][2].sliceSerialize},K),z[ge][1])}if(K.tokenStack.length>0){const Xt=K.tokenStack[K.tokenStack.length-1];(Xt[1]||Mm).call(K,void 0,Xt[0])}for(Y.position={start:Xn(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:Xn(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<t.transforms.length;)Y=t.transforms[ge](Y)||Y;return Y}function l(z,Y,K){let le=Y-1,ge=-1,Xt=!1,wi,bn,aa,ra;for(;++le<=K;){const xt=z[le];switch(xt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xt[0]==="enter"?ge++:ge--,ra=void 0;break}case"lineEndingBlank":{xt[0]==="enter"&&(wi&&!ra&&!ge&&!aa&&(aa=le),ra=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ra=void 0}if(!ge&&xt[0]==="enter"&&xt[1].type==="listItemPrefix"||ge===-1&&xt[0]==="exit"&&(xt[1].type==="listUnordered"||xt[1].type==="listOrdered")){if(wi){let il=le;for(bn=void 0;il--;){const Sn=z[il];if(Sn[1].type==="lineEnding"||Sn[1].type==="lineEndingBlank"){if(Sn[0]==="exit")continue;bn&&(z[bn][1].type="lineEndingBlank",Xt=!0),Sn[1].type="lineEnding",bn=il}else if(!(Sn[1].type==="linePrefix"||Sn[1].type==="blockQuotePrefix"||Sn[1].type==="blockQuotePrefixWhitespace"||Sn[1].type==="blockQuoteMarker"||Sn[1].type==="listItemIndent"))break}aa&&(!bn||aa<bn)&&(wi._spread=!0),wi.end=Object.assign({},bn?z[bn][1].start:xt[1].end),z.splice(bn||le,0,["exit",wi,xt[2]]),le++,K++}if(xt[1].type==="listItemPrefix"){const il={type:"listItem",_spread:!1,start:Object.assign({},xt[1].start),end:void 0};wi=il,z.splice(le,0,["enter",il,xt[2]]),le++,K++,aa=void 0,ra=!0}}}return z[Y][1]._spread=Xt,K}function a(z,Y){return K;function K(le){s.call(this,z(le),le),Y&&Y.call(this,le)}}function r(){this.stack.push({type:"fragment",children:[]})}function s(z,Y,K){this.stack[this.stack.length-1].children.push(z),this.stack.push(z),this.tokenStack.push([Y,K||void 0]),z.position={start:Xn(Y.start),end:void 0}}function u(z){return Y;function Y(K){z&&z.call(this,K),c.call(this,K)}}function c(z,Y){const K=this.stack.pop(),le=this.tokenStack.pop();if(le)le[0].type!==z.type&&(Y?Y.call(this,z,le[0]):(le[1]||Mm).call(this,z,le[0]));else throw new Error("Cannot close `"+z.type+"` ("+qa({start:z.start,end:z.end})+"): it’s not open");K.position.end=Xn(z.end)}function d(){return Md(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(z){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(z),10),this.data.expectingFirstListItemValue=void 0}}function p(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=z}function y(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=z}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z.replace(/(\r?\n|\r)$/g,"")}function m(z){const Y=this.resume(),K=this.stack[this.stack.length-1];K.label=Y,K.identifier=tn(this.sliceSerialize(z)).toLowerCase()}function v(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.title=z}function C(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.url=z}function A(z){const Y=this.stack[this.stack.length-1];if(!Y.depth){const K=this.sliceSerialize(z).length;Y.depth=K}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function _(z){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(z).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function D(z){const K=this.stack[this.stack.length-1].children;let le=K[K.length-1];(!le||le.type!=="text")&&(le=g0(),le.position={start:Xn(z.start),end:void 0},K.push(le)),this.stack.push(le)}function T(z){const Y=this.stack.pop();Y.value+=this.sliceSerialize(z),Y.position.end=Xn(z.end)}function M(z){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const K=Y.children[Y.children.length-1];K.position.end=Xn(z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(D.call(this,z),T.call(this,z))}function q(){this.data.atHardBreak=!0}function P(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z}function F(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z}function V(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.value=z}function j(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=Y,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function O(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=Y,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function w(z){const Y=this.sliceSerialize(z),K=this.stack[this.stack.length-2];K.label=BA(Y),K.identifier=tn(Y).toLowerCase()}function X(){const z=this.stack[this.stack.length-1],Y=this.resume(),K=this.stack[this.stack.length-1];if(this.data.inReference=!0,K.type==="link"){const le=z.children;K.children=le}else K.alt=Y}function S(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.url=z}function we(){const z=this.resume(),Y=this.stack[this.stack.length-1];Y.title=z}function We(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function _e(z){const Y=this.resume(),K=this.stack[this.stack.length-1];K.label=Y,K.identifier=tn(this.sliceSerialize(z)).toLowerCase(),this.data.referenceType="full"}function st(z){this.data.characterReferenceType=z.type}function Ie(z){const Y=this.sliceSerialize(z),K=this.data.characterReferenceType;let le;K?(le=vb(Y,K==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):le=Bd(Y);const ge=this.stack[this.stack.length-1];ge.value+=le}function ki(z){const Y=this.stack.pop();Y.position.end=Xn(z.end)}function ln(z){T.call(this,z);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(z)}function Gn(z){T.call(this,z);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(z)}function Vn(){return{type:"blockquote",children:[]}}function Ni(){return{type:"code",lang:null,meta:null,value:""}}function zo(){return{type:"inlineCode",value:""}}function Lo(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Mo(){return{type:"emphasis",children:[]}}function Ar(){return{type:"heading",depth:0,children:[]}}function R(){return{type:"break"}}function G(){return{type:"html",value:""}}function He(){return{type:"image",title:null,url:"",alt:null}}function Ot(){return{type:"link",title:null,url:"",children:[]}}function an(z){return{type:"list",ordered:z.type==="listOrdered",start:null,spread:z._spread,children:[]}}function h0(z){return{type:"listItem",spread:z._spread,checked:null,children:[]}}function p0(){return{type:"paragraph",children:[]}}function m0(){return{type:"strong",children:[]}}function g0(){return{type:"text",value:""}}function y0(){return{type:"thematicBreak"}}}function Xn(e){return{line:e.line,column:e.column,offset:e.offset}}function _b(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?_b(e,i):qA(e,i)}}function qA(e,t){let n;for(n in t)if(jb.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function Mm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+qa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+qa({start:t.start,end:t.end})+") is still open")}function FA(e){const t=this;t.parser=n;function n(i){return IA(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function GA(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function VA(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`