@gobing-ai/spur 0.3.49 → 0.3.50

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 (61) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/config/corpus-baseline.json +12144 -3
  3. package/package.json +9 -9
  4. package/plugins/sp/plugin.json +1 -1
  5. package/plugins/sp/skills/code-verification/SKILL.md +14 -0
  6. package/plugins/sp/skills/spur-cli/references/tasks.md +1 -0
  7. package/plugins/sp/skills/spur-dev/references/ac-style-guide.md +18 -2
  8. package/plugins/sp/skills/spur-dev/references/cross-cutting.md +14 -6
  9. package/spur.js +4754 -5592
  10. package/web/_astro/BoardApp.pdtYu-yW.js +1 -0
  11. package/web/_astro/{BoardApp.BjQUNhuj.js → BoardApp.plVXYkKo.js} +11 -11
  12. package/web/_astro/{TaskDetail.CVBuD6dF.js → TaskDetail.5DIyVQ_N.js} +1 -1
  13. package/web/_astro/{arc.BMMjdODi.js → arc.BnUgL7ho.js} +1 -1
  14. package/web/_astro/{architectureDiagram-3BPJPVTR.BU5ShzXf.js → architectureDiagram-3BPJPVTR.B9YMJau-.js} +1 -1
  15. package/web/_astro/{blockDiagram-GPEHLZMM.Bj1iEqPD.js → blockDiagram-GPEHLZMM.Dw2qgvWJ.js} +1 -1
  16. package/web/_astro/{c4Diagram-AAUBKEIU.vX8wepCL.js → c4Diagram-AAUBKEIU.jTbU0-Nk.js} +1 -1
  17. package/web/_astro/channel.DEqvaz-I.js +1 -0
  18. package/web/_astro/{chunk-2J33WTMH.BKAipTym.js → chunk-2J33WTMH.Di46EtkU.js} +1 -1
  19. package/web/_astro/{chunk-4BX2VUAB.B68XkPG7.js → chunk-4BX2VUAB.DweHBwqQ.js} +1 -1
  20. package/web/_astro/{chunk-55IACEB6.BmeDLcrc.js → chunk-55IACEB6.rRjTKaa7.js} +1 -1
  21. package/web/_astro/{chunk-727SXJPM.PDuBA3Kw.js → chunk-727SXJPM.BkEQIkSV.js} +1 -1
  22. package/web/_astro/{chunk-AQP2D5EJ.C7A044za.js → chunk-AQP2D5EJ.Cfe9IvAd.js} +1 -1
  23. package/web/_astro/{chunk-FMBD7UC4.BtzKKFqR.js → chunk-FMBD7UC4.fI6tLbeN.js} +1 -1
  24. package/web/_astro/{chunk-ND2GUHAM.BJuDeeOy.js → chunk-ND2GUHAM.BIjgpq0O.js} +1 -1
  25. package/web/_astro/{chunk-QZHKN3VN.DSeMDgcQ.js → chunk-QZHKN3VN.ZwLnVxyz.js} +1 -1
  26. package/web/_astro/{classDiagram-4FO5ZUOK.D53Q4tCw.js → classDiagram-4FO5ZUOK.BJAGYidE.js} +1 -1
  27. package/web/_astro/{classDiagram-v2-Q7XG4LA2.D53Q4tCw.js → classDiagram-v2-Q7XG4LA2.BJAGYidE.js} +1 -1
  28. package/web/_astro/{cose-bilkent-S5V4N54A.c712AFRH.js → cose-bilkent-S5V4N54A.B5y3nz26.js} +1 -1
  29. package/web/_astro/{dagre-BM42HDAG.D-idisph.js → dagre-BM42HDAG.DHmw0ZBC.js} +1 -1
  30. package/web/_astro/{diagram-2AECGRRQ.DLgnsJCU.js → diagram-2AECGRRQ.10gapJfY.js} +1 -1
  31. package/web/_astro/{diagram-5GNKFQAL.BiaxBVqx.js → diagram-5GNKFQAL.Gh33_drM.js} +1 -1
  32. package/web/_astro/{diagram-KO2AKTUF.C8HX1vd8.js → diagram-KO2AKTUF.8ROWlfcX.js} +1 -1
  33. package/web/_astro/{diagram-LMA3HP47.CfqDLLes.js → diagram-LMA3HP47.BsP3tKmg.js} +1 -1
  34. package/web/_astro/{diagram-OG6HWLK6.15SDiEed.js → diagram-OG6HWLK6.DM2WFDhU.js} +1 -1
  35. package/web/_astro/{erDiagram-TEJ5UH35.DksYtOYM.js → erDiagram-TEJ5UH35.royaC_lH.js} +1 -1
  36. package/web/_astro/{flowDiagram-I6XJVG4X.DR_Au-HV.js → flowDiagram-I6XJVG4X.C9GEvIie.js} +1 -1
  37. package/web/_astro/{ganttDiagram-6RSMTGT7.CHhHrffI.js → ganttDiagram-6RSMTGT7.CXO4T2U0.js} +1 -1
  38. package/web/_astro/{gitGraphDiagram-PVQCEYII.B2Xehvam.js → gitGraphDiagram-PVQCEYII.Q02KzYH7.js} +1 -1
  39. package/web/_astro/{infoDiagram-5YYISTIA.C9c3CNNN.js → infoDiagram-5YYISTIA.DNfSDKJt.js} +1 -1
  40. package/web/_astro/{ishikawaDiagram-YF4QCWOH.BibUHkh8.js → ishikawaDiagram-YF4QCWOH.BFttvtgJ.js} +1 -1
  41. package/web/_astro/{journeyDiagram-JHISSGLW.BYoVHiyO.js → journeyDiagram-JHISSGLW.Cfm-2SbG.js} +1 -1
  42. package/web/_astro/{kanban-definition-UN3LZRKU.CM1K5wHE.js → kanban-definition-UN3LZRKU.BWGNW6fV.js} +1 -1
  43. package/web/_astro/{linear.SPpjJUb-.js → linear.BprdUk2Y.js} +1 -1
  44. package/web/_astro/{mermaid.core.BAgx3nnb.js → mermaid.core.B2zRNxtX.js} +4 -4
  45. package/web/_astro/{mindmap-definition-RKZ34NQL.D35oPG1R.js → mindmap-definition-RKZ34NQL.g9jij8sw.js} +1 -1
  46. package/web/_astro/{pieDiagram-4H26LBE5.DiWuRwk7.js → pieDiagram-4H26LBE5.CbzR4n5b.js} +1 -1
  47. package/web/_astro/{quadrantDiagram-W4KKPZXB.B9PBzTWn.js → quadrantDiagram-W4KKPZXB.DxV3viWt.js} +1 -1
  48. package/web/_astro/{requirementDiagram-4Y6WPE33.CYuuamFN.js → requirementDiagram-4Y6WPE33.DvAb90JS.js} +1 -1
  49. package/web/_astro/{sankeyDiagram-5OEKKPKP.W24UhhtD.js → sankeyDiagram-5OEKKPKP.CIFz5t4D.js} +1 -1
  50. package/web/_astro/{sequenceDiagram-3UESZ5HK.BpbNjA51.js → sequenceDiagram-3UESZ5HK.DzlEQynd.js} +1 -1
  51. package/web/_astro/{stateDiagram-AJRCARHV.DqVsHudf.js → stateDiagram-AJRCARHV.Dph2V-ts.js} +1 -1
  52. package/web/_astro/{stateDiagram-v2-BHNVJYJU.CzwHYX81.js → stateDiagram-v2-BHNVJYJU.wJhfrLAy.js} +1 -1
  53. package/web/_astro/{timeline-definition-PNZ67QCA.Bc3B6djw.js → timeline-definition-PNZ67QCA.BrSiyubX.js} +1 -1
  54. package/web/_astro/{vennDiagram-CIIHVFJN.C-D5rh8O.js → vennDiagram-CIIHVFJN.COobPrUX.js} +1 -1
  55. package/web/_astro/{wardley-L42UT6IY.D7PdYCqn.js → wardley-L42UT6IY.CrjeTx8A.js} +1 -1
  56. package/web/_astro/{wardleyDiagram-YWT4CUSO.CwmJKXF3.js → wardleyDiagram-YWT4CUSO.B8_fTQ8E.js} +1 -1
  57. package/web/_astro/{xychartDiagram-2RQKCTM6.avDYnLsb.js → xychartDiagram-2RQKCTM6.BPpokgVv.js} +1 -1
  58. package/web/favicon.svg +1 -0
  59. package/web/index.html +1 -1
  60. package/web/_astro/BoardApp.8hiqShQn.js +0 -1
  61. package/web/_astro/channel.EwdSemIC.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/mermaid.core.BAgx3nnb.js","_astro/index.A0eX93qW.js","_astro/TaskDetail.CVBuD6dF.js"])))=>i.map(i=>d[i]);
2
- import{r as g,a as fv,g as bu,R as We,c as mv}from"./index.A0eX93qW.js";var bl={exports:{}},Ai={};var hb;function hv(){if(hb)return Ai;hb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var s=null;if(i!==void 0&&(s=""+i),a.key!==void 0&&(s=""+a.key),"key"in a){i={};for(var o in a)o!=="key"&&(i[o]=a[o])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:s,ref:a!==void 0?a:null,props:i}}return Ai.Fragment=t,Ai.jsx=n,Ai.jsxs=n,Ai}var gb;function gv(){return gb||(gb=1,bl.exports=hv()),bl.exports}var c=gv();var cx=e=>{throw TypeError(e)},bv=(e,t,n)=>t.has(e)||cx("Cannot "+n),El=(e,t,n)=>(bv(e,t,"read from private field"),n?n.call(e):t.get(e)),Ev=(e,t,n)=>t.has(e)?cx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),bb="popstate";function yv(e={}){function t(r,a){let{pathname:i,search:s,hash:o}=r.location;return os("",{pathname:i,search:s,hash:o},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:br(a)}return Tv(t,n,null,e)}function Je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Bt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xv(){return Math.random().toString(36).substring(2,10)}function Eb(e,t){return{usr:e.state,key:e.key,idx:t}}function os(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Kr(t):t,state:n,key:t&&t.key||r||xv()}}function br({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 Kr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Tv(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,s=a.history,o="POP",u=null,l=p();l==null&&(l=0,s.replaceState({...s.state,idx:l},""));function p(){return(s.state||{idx:null}).idx}function d(){o="POP";let y=p(),x=y==null?null:y-l;l=y,u&&u({action:o,location:E.location,delta:x})}function f(y,x){o="PUSH";let w=os(E.location,y,x);l=p()+1;let T=Eb(w,l),I=E.createHref(w);try{s.pushState(T,"",I)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(I)}i&&u&&u({action:o,location:E.location,delta:1})}function m(y,x){o="REPLACE";let w=os(E.location,y,x);l=p();let T=Eb(w,l),I=E.createHref(w);s.replaceState(T,"",I),i&&u&&u({action:o,location:E.location,delta:0})}function b(y){return dx(y)}let E={get action(){return o},get location(){return e(a,s)},listen(y){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(bb,d),u=y,()=>{a.removeEventListener(bb,d),u=null}},createHref(y){return t(a,y)},createURL:b,encodeLocation(y){let x=b(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:m,go(y){return s.go(y)}};return E}function dx(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Je(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:br(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Bi,yb=class{constructor(e){if(Ev(this,Bi,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(El(this,Bi).has(e))return El(this,Bi).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){El(this,Bi).set(e,t)}};Bi=new WeakMap;var Sv=new Set(["lazy","caseSensitive","path","id","index","children"]);function Av(e){return Sv.has(e)}var vv=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function wv(e){return vv.has(e)}function _v(e){return e.index===!0}function us(e,t,n=[],r={},a=!1){return e.map((i,s)=>{let o=[...n,String(s)],u=typeof i.id=="string"?i.id:o.join("-");if(Je(i.index!==!0||!i.children,"Cannot specify children on an index route"),Je(a||!r[u],`Found a route id collision on id "${u}". Route id's must be globally unique within Data Router usages`),_v(i)){let l={...i,id:u};return r[u]=xb(l,t(l)),l}else{let l={...i,id:u,children:void 0};return r[u]=xb(l,t(l)),i.children&&(l.children=us(i.children,t,o,r,a)),l}})}function xb(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function Hr(e,t,n="/"){return Ui(e,t,n,!1)}function Ui(e,t,n,r){let a=typeof t=="string"?Kr(t):t,i=er(a.pathname||"/",n);if(i==null)return null;let s=px(e);Cv(s);let o=null;for(let u=0;o==null&&u<s.length;++u){let l=Uv(i);o=Pv(s[u],l,r)}return o}function Nv(e,t){let{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function px(e,t=[],n=[],r="",a=!1){let i=(s,o,u=a,l)=>{let p={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&u)return;Je(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let d=gr([r,p.relativePath]),f=n.concat(p);s.children&&s.children.length>0&&(Je(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),px(s.children,t,f,d,u)),!(s.path==null&&!s.index)&&t.push({path:d,score:Fv(d,s.index),routesMeta:f})};return e.forEach((s,o)=>{if(s.path===""||!s.path?.includes("?"))i(s,o);else for(let u of fx(s.path))i(s,o,!0,u)}),t}function fx(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let s=fx(r.join("/")),o=[];return o.push(...s.map(u=>u===""?i:[i,u].join("/"))),a&&o.push(...s),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function Cv(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Mv(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Iv=/^:[\w-]+$/,kv=3,Rv=2,Dv=1,Ov=10,Lv=-2,Tb=e=>e==="*";function Fv(e,t){let n=e.split("/"),r=n.length;return n.some(Tb)&&(r+=Lv),t&&(r+=Rv),n.filter(a=>!Tb(a)).reduce((a,i)=>a+(Iv.test(i)?kv:i===""?Dv:Ov),r)}function Mv(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function Pv(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",s=[];for(let o=0;o<r.length;++o){let u=r[o],l=o===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",d=Mo({path:u.relativePath,caseSensitive:u.caseSensitive,end:l},p),f=u.route;if(!d&&l&&n&&!r[r.length-1].route.index&&(d=Mo({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!d)return null;Object.assign(a,d.params),s.push({params:a,pathname:gr([i,d.pathname]),pathnameBase:zv(gr([i,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(i=gr([i,d.pathnameBase]))}return s}function Mo(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Bv(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],s=i.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:r.reduce((l,{paramName:p,isOptional:d},f)=>{if(p==="*"){let b=o[f]||"";s=i.slice(0,i.length-b.length).replace(/(.)\/+$/,"$1")}const m=o[f];return d&&!m?l[p]=void 0:l[p]=(m||"").replace(/%2F/g,"/"),l},{}),pathname:i,pathnameBase:s,pattern:e}}function Bv(e,t=!1,n=!0){Bt(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 r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Uv(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Bt(!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 er(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function jv({basename:e,pathname:t}){return t==="/"?e:gr([e,t])}var mx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Eu=e=>mx.test(e);function $v(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Kr(e):e,i;if(n)if(Eu(n))i=n;else{if(n.includes("//")){let s=n;n=n.replace(/\/\/+/g,"/"),Bt(!1,`Pathnames cannot have embedded double slashes - normalizing ${s} -> ${n}`)}n.startsWith("/")?i=Sb(n.substring(1),"/"):i=Sb(n,t)}else i=t;return{pathname:i,search:Hv(r),hash:Gv(a)}}function Sb(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function yl(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. 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 hx(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function yu(e){let t=hx(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function xu(e,t,n,r=!1){let a;typeof e=="string"?a=Kr(e):(a={...e},Je(!a.pathname||!a.pathname.includes("?"),yl("?","pathname","search",a)),Je(!a.pathname||!a.pathname.includes("#"),yl("#","pathname","hash",a)),Je(!a.search||!a.search.includes("#"),yl("#","search","hash",a)));let i=e===""||a.pathname==="",s=i?"/":a.pathname,o;if(s==null)o=n;else{let d=t.length-1;if(!r&&s.startsWith("..")){let f=s.split("/");for(;f[0]==="..";)f.shift(),d-=1;a.pathname=f.join("/")}o=d>=0?t[d]:"/"}let u=$v(a,o),l=s&&s!=="/"&&s.endsWith("/"),p=(i||s===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(l||p)&&(u.pathname+="/"),u}var gr=e=>e.join("/").replace(/\/\/+/g,"/"),zv=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Hv=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Gv=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,vs=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ls(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ws(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var gx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bx(e,t){let n=e;if(typeof n!="string"||!mx.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(gx)try{let i=new URL(window.location.href),s=n.startsWith("//")?new URL(i.protocol+n):new URL(n),o=er(s.pathname,t);s.origin===i.origin&&o!=null?n=o+s.search+s.hash:a=!0}catch{Bt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}var Vr=Symbol("Uninstrumented");function Wv(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(a=>a({id:t.id,index:t.index,path:t.path,instrument(i){let s=Object.keys(n);for(let o of s)i[o]&&n[o].push(i[o])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let a=La(n.lazy,t.lazy,()=>{});a&&(r.lazy=a)}if(typeof t.lazy=="object"){let a=t.lazy;["middleware","loader","action"].forEach(i=>{let s=a[i],o=n[`lazy.${i}`];if(typeof s=="function"&&o.length>0){let u=La(o,s,()=>{});u&&(r.lazy=Object.assign(r.lazy||{},{[i]:u}))}})}return["loader","action"].forEach(a=>{let i=t[a];if(typeof i=="function"&&n[a].length>0){let s=i[Vr]??i,o=La(n[a],s,(...u)=>Ab(u[0]));o&&(o[Vr]=s,r[a]=o)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let i=a[Vr]??a,s=La(n.middleware,i,(...o)=>Ab(o[0]));return s?(s[Vr]=i,s):a})),r}function Vv(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(a){let i=Object.keys(a);for(let s of i)a[s]&&n[s].push(a[s])}})),n.navigate.length>0){let r=e.navigate[Vr]??e.navigate,a=La(n.navigate,r,(...i)=>{let[s,o]=i;return{to:typeof s=="number"||typeof s=="string"?s:s?br(s):".",...vb(e,o??{})}});a&&(a[Vr]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[Vr]??e.fetch,a=La(n.fetch,r,(...i)=>{let[s,,o,u]=i;return{href:o??".",fetcherKey:s,...vb(e,u??{})}});a&&(a[Vr]=r,e.fetch=a)}return e}function La(e,t,n){return e.length===0?null:async(...r)=>{let a=await Ex(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function Ex(e,t,n,r){let a=e[r],i;if(a){let s,o=async()=>(s?console.error("You cannot call instrumented handlers more than once"):s=Ex(e,t,n,r-1),i=await s,Je(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await a(o,t)}catch(u){console.error("An instrumentation function threw an error:",u)}s||await o(),await s}else try{i={type:"success",value:await n()}}catch(s){i={type:"error",value:s}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Ab(e){let{request:t,context:n,params:r,unstable_pattern:a}=e;return{request:qv(t),params:{...r},unstable_pattern:a,context:Yv(n)}}function vb(e,t){return{currentUrl:br(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function qv(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Yv(e){if(Kv(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Zv=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Kv(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===Zv}var yx=["POST","PUT","PATCH","DELETE"],Xv=new Set(yx),Qv=["GET",...yx],Jv=new Set(Qv),xx=new Set([301,302,303,307,308]),ew=new Set([307,308]),xl={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},tw={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},vi={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},nw=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Tx="remix-router-transitions",Sx=Symbol("ResetLoaderData");function rw(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";Je(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||nw,i=a;if(e.unstable_instrumentations){let P=e.unstable_instrumentations;i=$=>({...a($),...Wv(P.map(G=>G.route).filter(Boolean),$)})}let s={},o=us(e.routes,i,void 0,s),u,l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let p=e.dataStrategy||uw,d={...e.future},f=null,m=new Set,b=null,E=null,y=null,x=e.hydrationData!=null,w=Hr(o,e.history.location,l),T=!1,I=null,R;if(w==null&&!e.patchRoutesOnNavigation){let P=Zn(404,{pathname:e.history.location.pathname}),{matches:$,route:G}=Xs(o);R=!0,w=$,I={[G.id]:P}}else if(w&&!e.hydrationData&&Ve(w,o,e.history.location.pathname).active&&(w=null),w)if(w.some(P=>P.route.lazy))R=!1;else if(!w.some(P=>dd(P.route)))R=!0;else{let P=e.hydrationData?e.hydrationData.loaderData:null,$=e.hydrationData?e.hydrationData.errors:null;if($){let G=w.findIndex(ee=>$[ee.route.id]!==void 0);R=w.slice(0,G+1).every(ee=>!Sc(ee.route,P,$))}else R=w.every(G=>!Sc(G.route,P,$))}else{R=!1,w=[];let P=Ve(null,o,e.history.location.pathname);P.active&&P.matches&&(T=!0,w=P.matches)}let v,A={historyAction:e.history.action,location:e.history.location,matches:w,initialized:R,navigation:xl,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||I,fetchers:new Map,blockers:new Map},N="POP",F=null,_=!1,M,j=!1,H=new Map,Z=null,V=!1,ie=!1,X=new Set,re=new Map,ue=0,k=-1,Y=new Map,le=new Set,D=new Map,ke=new Map,Le=new Set,ve=new Map,Ue,Ee=null;function he(){if(f=e.history.listen(({action:P,location:$,delta:G})=>{if(Ue){Ue(),Ue=void 0;return}Bt(ve.size===0||G!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ee=Wt({currentLocation:A.location,nextLocation:$,historyAction:P});if(ee&&G!=null){let se=new Promise(Se=>{Ue=Se});e.history.go(G*-1),xt(ee,{state:"blocked",location:$,proceed(){xt(ee,{state:"proceeding",proceed:void 0,reset:void 0,location:$}),se.then(()=>e.history.go(G))},reset(){let Se=new Map(A.blockers);Se.set(ee,vi),ge({blockers:Se})}}),F?.resolve(),F=null;return}return rt(P,$)}),n){_w(t,H);let P=()=>Nw(t,H);t.addEventListener("pagehide",P),Z=()=>t.removeEventListener("pagehide",P)}return A.initialized||rt("POP",A.location,{initialHydration:!0}),v}function ct(){f&&f(),Z&&Z(),m.clear(),M&&M.abort(),A.fetchers.forEach((P,$)=>_t($)),A.blockers.forEach((P,$)=>Re($))}function $e(P){return m.add(P),()=>m.delete(P)}function ge(P,$={}){P.matches&&(P.matches=P.matches.map(se=>{let Se=s[se.route.id],xe=se.route;return xe.element!==Se.element||xe.errorElement!==Se.errorElement||xe.hydrateFallbackElement!==Se.hydrateFallbackElement?{...se,route:Se}:se})),A={...A,...P};let G=[],ee=[];A.fetchers.forEach((se,Se)=>{se.state==="idle"&&(Le.has(Se)?G.push(Se):ee.push(Se))}),Le.forEach(se=>{!A.fetchers.has(se)&&!re.has(se)&&G.push(se)}),[...m].forEach(se=>se(A,{deletedFetchers:G,newErrors:P.errors??null,viewTransitionOpts:$.viewTransitionOpts,flushSync:$.flushSync===!0})),G.forEach(se=>_t(se)),ee.forEach(se=>A.fetchers.delete(se))}function Pe(P,$,{flushSync:G}={}){let ee=A.actionData!=null&&A.navigation.formMethod!=null&&An(A.navigation.formMethod)&&A.navigation.state==="loading"&&P.state?._isRedirect!==!0,se;$.actionData?Object.keys($.actionData).length>0?se=$.actionData:se=null:ee?se=A.actionData:se=null;let Se=$.loaderData?Lb(A.loaderData,$.loaderData,$.matches||[],$.errors):A.loaderData,xe=A.blockers;xe.size>0&&(xe=new Map(xe),xe.forEach((Be,De)=>xe.set(De,vi)));let _e=V?!1:Xe(P,$.matches||A.matches),me=_===!0||A.navigation.formMethod!=null&&An(A.navigation.formMethod)&&P.state?._isRedirect!==!0;u&&(o=u,u=void 0),V||N==="POP"||(N==="PUSH"?e.history.push(P,P.state):N==="REPLACE"&&e.history.replace(P,P.state));let Ce;if(N==="POP"){let Be=H.get(A.location.pathname);Be&&Be.has(P.pathname)?Ce={currentLocation:A.location,nextLocation:P}:H.has(P.pathname)&&(Ce={currentLocation:P,nextLocation:A.location})}else if(j){let Be=H.get(A.location.pathname);Be?Be.add(P.pathname):(Be=new Set([P.pathname]),H.set(A.location.pathname,Be)),Ce={currentLocation:A.location,nextLocation:P}}ge({...$,actionData:se,loaderData:Se,historyAction:N,location:P,initialized:!0,navigation:xl,revalidation:"idle",restoreScrollPosition:_e,preventScrollReset:me,blockers:xe},{viewTransitionOpts:Ce,flushSync:G===!0}),N="POP",_=!1,j=!1,V=!1,ie=!1,F?.resolve(),F=null,Ee?.resolve(),Ee=null}async function pt(P,$){if(F?.resolve(),F=null,typeof P=="number"){F||(F=Bb());let dt=F.promise;return e.history.go(P),dt}let G=Tc(A.location,A.matches,l,P,$?.fromRouteId,$?.relative),{path:ee,submission:se,error:Se}=wb(!1,G,$),xe=A.location,_e=os(A.location,ee,$&&$.state);_e={..._e,...e.history.encodeLocation(_e)};let me=$&&$.replace!=null?$.replace:void 0,Ce="PUSH";me===!0?Ce="REPLACE":me===!1||se!=null&&An(se.formMethod)&&se.formAction===A.location.pathname+A.location.search&&(Ce="REPLACE");let Be=$&&"preventScrollReset"in $?$.preventScrollReset===!0:void 0,De=($&&$.flushSync)===!0,lt=Wt({currentLocation:xe,nextLocation:_e,historyAction:Ce});if(lt){xt(lt,{state:"blocked",location:_e,proceed(){xt(lt,{state:"proceeding",proceed:void 0,reset:void 0,location:_e}),pt(P,$)},reset(){let dt=new Map(A.blockers);dt.set(lt,vi),ge({blockers:dt})}});return}await rt(Ce,_e,{submission:se,pendingError:Se,preventScrollReset:Be,replace:$&&$.replace,enableViewTransition:$&&$.viewTransition,flushSync:De,callSiteDefaultShouldRevalidate:$&&$.unstable_defaultShouldRevalidate})}function de(){Ee||(Ee=Bb()),te(),ge({revalidation:"loading"});let P=Ee.promise;return A.navigation.state==="submitting"?P:A.navigation.state==="idle"?(rt(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),P):(rt(N||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:j===!0}),P)}async function rt(P,$,G){M&&M.abort(),M=null,N=P,V=(G&&G.startUninterruptedRevalidation)===!0,ze(A.location,A.matches),_=(G&&G.preventScrollReset)===!0,j=(G&&G.enableViewTransition)===!0;let ee=u||o,se=G&&G.overrideNavigation,Se=G?.initialHydration&&A.matches&&A.matches.length>0&&!T?A.matches:Hr(ee,$,l),xe=(G&&G.flushSync)===!0;if(Se&&A.initialized&&!ie&&gw(A.location,$)&&!(G&&G.submission&&An(G.submission.formMethod))){Pe($,{matches:Se},{flushSync:xe});return}let _e=Ve(Se,ee,$.pathname);if(_e.active&&_e.matches&&(Se=_e.matches),!Se){let{error:Yt,notFoundMatches:pn,route:yt}=U($.pathname);Pe($,{matches:pn,loaderData:{},errors:{[yt.id]:Yt}},{flushSync:xe});return}M=new AbortController;let me=Ra(e.history,$,M.signal,G&&G.submission),Ce=e.getContext?await e.getContext():new yb,Be;if(G&&G.pendingError)Be=[Gr(Se).route.id,{type:"error",error:G.pendingError}];else if(G&&G.submission&&An(G.submission.formMethod)){let Yt=await Ot(me,$,G.submission,Se,Ce,_e.active,G&&G.initialHydration===!0,{replace:G.replace,flushSync:xe});if(Yt.shortCircuited)return;if(Yt.pendingActionResult){let[pn,yt]=Yt.pendingActionResult;if($n(yt)&&ls(yt.error)&&yt.error.status===404){M=null,Pe($,{matches:Yt.matches,loaderData:{},errors:{[pn]:yt.error}});return}}Se=Yt.matches||Se,Be=Yt.pendingActionResult,se=Tl($,G.submission),xe=!1,_e.active=!1,me=Ra(e.history,me.url,me.signal)}let{shortCircuited:De,matches:lt,loaderData:dt,errors:qt}=await ft(me,$,Se,Ce,_e.active,se,G&&G.submission,G&&G.fetcherSubmission,G&&G.replace,G&&G.initialHydration===!0,xe,Be,G&&G.callSiteDefaultShouldRevalidate);De||(M=null,Pe($,{matches:lt||Se,...Fb(Be),loaderData:dt,errors:qt}))}async function Ot(P,$,G,ee,se,Se,xe,_e={}){te();let me=vw($,G);if(ge({navigation:me},{flushSync:_e.flushSync===!0}),Se){let De=await At(ee,$.pathname,P.signal);if(De.type==="aborted")return{shortCircuited:!0};if(De.type==="error"){if(De.partialMatches.length===0){let{matches:dt,route:qt}=Xs(o);return{matches:dt,pendingActionResult:[qt.id,{type:"error",error:De.error}]}}let lt=Gr(De.partialMatches).route.id;return{matches:De.partialMatches,pendingActionResult:[lt,{type:"error",error:De.error}]}}else if(De.matches)ee=De.matches;else{let{notFoundMatches:lt,error:dt,route:qt}=U($.pathname);return{matches:lt,pendingActionResult:[qt.id,{type:"error",error:dt}]}}}let Ce,Be=Ao(ee,$);if(!Be.route.action&&!Be.route.lazy)Ce={type:"error",error:Zn(405,{method:P.method,pathname:$.pathname,routeId:Be.route.id})};else{let De=$a(i,s,P,ee,Be,xe?[]:r,se),lt=await Ye(P,De,se,null);if(Ce=lt[Be.route.id],!Ce){for(let dt of ee)if(lt[dt.route.id]){Ce=lt[dt.route.id];break}}if(P.signal.aborted)return{shortCircuited:!0}}if(ra(Ce)){let De;return _e&&_e.replace!=null?De=_e.replace:De=Rb(Ce.response.headers.get("Location"),new URL(P.url),l)===A.location.pathname+A.location.search,await Ae(P,Ce,!0,{submission:G,replace:De}),{shortCircuited:!0}}if($n(Ce)){let De=Gr(ee,Be.route.id);return(_e&&_e.replace)!==!0&&(N="PUSH"),{matches:ee,pendingActionResult:[De.route.id,Ce,Be.route.id]}}return{matches:ee,pendingActionResult:[Be.route.id,Ce]}}async function ft(P,$,G,ee,se,Se,xe,_e,me,Ce,Be,De,lt){let dt=Se||Tl($,xe),qt=xe||_e||Pb(dt),Yt=!V&&!Ce;if(se){if(Yt){let Pt=kt(De);ge({navigation:dt,...Pt!==void 0?{actionData:Pt}:{}},{flushSync:Be})}let tt=await At(G,$.pathname,P.signal);if(tt.type==="aborted")return{shortCircuited:!0};if(tt.type==="error"){if(tt.partialMatches.length===0){let{matches:Vn,route:fn}=Xs(o);return{matches:Vn,loaderData:{},errors:{[fn.id]:tt.error}}}let Pt=Gr(tt.partialMatches).route.id;return{matches:tt.partialMatches,loaderData:{},errors:{[Pt]:tt.error}}}else if(tt.matches)G=tt.matches;else{let{error:Pt,notFoundMatches:Vn,route:fn}=U($.pathname);return{matches:Vn,loaderData:{},errors:{[fn.id]:Pt}}}}let pn=u||o,{dsMatches:yt,revalidatingFetchers:Ln}=_b(P,ee,i,s,e.history,A,G,qt,$,Ce?[]:r,Ce===!0,ie,X,Le,D,le,pn,l,e.patchRoutesOnNavigation!=null,De,lt);if(k=++ue,!e.dataStrategy&&!yt.some(tt=>tt.shouldLoad)&&!yt.some(tt=>tt.route.middleware&&tt.route.middleware.length>0)&&Ln.length===0){let tt=J();return Pe($,{matches:G,loaderData:{},errors:De&&$n(De[1])?{[De[0]]:De[1].error}:null,...Fb(De),...tt?{fetchers:new Map(A.fetchers)}:{}},{flushSync:Be}),{shortCircuited:!0}}if(Yt){let tt={};if(!se){tt.navigation=dt;let Pt=kt(De);Pt!==void 0&&(tt.actionData=Pt)}Ln.length>0&&(tt.fetchers=wt(Ln)),ge(tt,{flushSync:Be})}Ln.forEach(tt=>{Et(tt.key),tt.controller&&re.set(tt.key,tt.controller)});let Tn=()=>Ln.forEach(tt=>Et(tt.key));M&&M.signal.addEventListener("abort",Tn);let{loaderResults:Or,fetcherResults:Sn}=await q(yt,Ln,P,ee);if(P.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",Tn),Ln.forEach(tt=>re.delete(tt.key));let Wn=Qs(Or);if(Wn)return await Ae(P,Wn.result,!0,{replace:me}),{shortCircuited:!0};if(Wn=Qs(Sn),Wn)return le.add(Wn.key),await Ae(P,Wn.result,!0,{replace:me}),{shortCircuited:!0};let{loaderData:Ti,errors:Lr}=Ob(A,G,Or,De,Ln,Sn);Ce&&A.errors&&(Lr={...A.errors,...Lr});let cr=J(),Ar=be(k),Fr=cr||Ar||Ln.length>0;return{matches:G,loaderData:Ti,errors:Lr,...Fr?{fetchers:new Map(A.fetchers)}:{}}}function kt(P){if(P&&!$n(P[1]))return{[P[0]]:P[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function wt(P){return P.forEach($=>{let G=A.fetchers.get($.key),ee=wi(void 0,G?G.data:void 0);A.fetchers.set($.key,ee)}),new Map(A.fetchers)}async function zt(P,$,G,ee){Et(P);let se=(ee&&ee.flushSync)===!0,Se=u||o,xe=Tc(A.location,A.matches,l,G,$,ee?.relative),_e=Hr(Se,xe,l),me=Ve(_e,Se,xe);if(me.active&&me.matches&&(_e=me.matches),!_e){we(P,$,Zn(404,{pathname:xe}),{flushSync:se});return}let{path:Ce,submission:Be,error:De}=wb(!0,xe,ee);if(De){we(P,$,De,{flushSync:se});return}let lt=e.getContext?await e.getContext():new yb,dt=(ee&&ee.preventScrollReset)===!0;if(Be&&An(Be.formMethod)){await nn(P,$,Ce,_e,lt,me.active,se,dt,Be,ee&&ee.unstable_defaultShouldRevalidate);return}D.set(P,{routeId:$,path:Ce}),await ut(P,$,Ce,_e,lt,me.active,se,dt,Be)}async function nn(P,$,G,ee,se,Se,xe,_e,me,Ce){te(),D.delete(P);let Be=A.fetchers.get(P);ye(P,ww(me,Be),{flushSync:xe});let De=new AbortController,lt=Ra(e.history,G,De.signal,me);if(Se){let Lt=await At(ee,new URL(lt.url).pathname,lt.signal,P);if(Lt.type==="aborted")return;if(Lt.type==="error"){we(P,$,Lt.error,{flushSync:xe});return}else if(Lt.matches)ee=Lt.matches;else{we(P,$,Zn(404,{pathname:G}),{flushSync:xe});return}}let dt=Ao(ee,G);if(!dt.route.action&&!dt.route.lazy){let Lt=Zn(405,{method:me.formMethod,pathname:G,routeId:$});we(P,$,Lt,{flushSync:xe});return}re.set(P,De);let qt=ue,Yt=$a(i,s,lt,ee,dt,r,se),pn=await Ye(lt,Yt,se,P),yt=pn[dt.route.id];if(!yt){for(let Lt of Yt)if(pn[Lt.route.id]){yt=pn[Lt.route.id];break}}if(lt.signal.aborted){re.get(P)===De&&re.delete(P);return}if(Le.has(P)){if(ra(yt)||$n(yt)){ye(P,vr(void 0));return}}else{if(ra(yt))if(re.delete(P),k>qt){ye(P,vr(void 0));return}else return le.add(P),ye(P,wi(me)),Ae(lt,yt,!1,{fetcherSubmission:me,preventScrollReset:_e});if($n(yt)){we(P,$,yt.error);return}}let Ln=A.navigation.location||A.location,Tn=Ra(e.history,Ln,De.signal),Or=u||o,Sn=A.navigation.state!=="idle"?Hr(Or,A.navigation.location,l):A.matches;Je(Sn,"Didn't find any matches after fetcher action");let Wn=++ue;Y.set(P,Wn);let Ti=wi(me,yt.data);A.fetchers.set(P,Ti);let{dsMatches:Lr,revalidatingFetchers:cr}=_b(Tn,se,i,s,e.history,A,Sn,me,Ln,r,!1,ie,X,Le,D,le,Or,l,e.patchRoutesOnNavigation!=null,[dt.route.id,yt],Ce);cr.filter(Lt=>Lt.key!==P).forEach(Lt=>{let wa=Lt.key,Si=A.fetchers.get(wa),Zs=wi(void 0,Si?Si.data:void 0);A.fetchers.set(wa,Zs),Et(wa),Lt.controller&&re.set(wa,Lt.controller)}),ge({fetchers:new Map(A.fetchers)});let Ar=()=>cr.forEach(Lt=>Et(Lt.key));De.signal.addEventListener("abort",Ar);let{loaderResults:Fr,fetcherResults:tt}=await q(Lr,cr,Tn,se);if(De.signal.aborted)return;if(De.signal.removeEventListener("abort",Ar),Y.delete(P),re.delete(P),cr.forEach(Lt=>re.delete(Lt.key)),A.fetchers.has(P)){let Lt=vr(yt.data);A.fetchers.set(P,Lt)}let Pt=Qs(Fr);if(Pt)return Ae(Tn,Pt.result,!1,{preventScrollReset:_e});if(Pt=Qs(tt),Pt)return le.add(Pt.key),Ae(Tn,Pt.result,!1,{preventScrollReset:_e});let{loaderData:Vn,errors:fn}=Ob(A,Sn,Fr,void 0,cr,tt);be(Wn),A.navigation.state==="loading"&&Wn>k?(Je(N,"Expected pending action"),M&&M.abort(),Pe(A.navigation.location,{matches:Sn,loaderData:Vn,errors:fn,fetchers:new Map(A.fetchers)})):(ge({errors:fn,loaderData:Lb(A.loaderData,Vn,Sn,fn),fetchers:new Map(A.fetchers)}),ie=!1)}async function ut(P,$,G,ee,se,Se,xe,_e,me){let Ce=A.fetchers.get(P);ye(P,wi(me,Ce?Ce.data:void 0),{flushSync:xe});let Be=new AbortController,De=Ra(e.history,G,Be.signal);if(Se){let yt=await At(ee,new URL(De.url).pathname,De.signal,P);if(yt.type==="aborted")return;if(yt.type==="error"){we(P,$,yt.error,{flushSync:xe});return}else if(yt.matches)ee=yt.matches;else{we(P,$,Zn(404,{pathname:G}),{flushSync:xe});return}}let lt=Ao(ee,G);re.set(P,Be);let dt=ue,qt=$a(i,s,De,ee,lt,r,se),pn=(await Ye(De,qt,se,P))[lt.route.id];if(re.get(P)===Be&&re.delete(P),!De.signal.aborted){if(Le.has(P)){ye(P,vr(void 0));return}if(ra(pn))if(k>dt){ye(P,vr(void 0));return}else{le.add(P),await Ae(De,pn,!1,{preventScrollReset:_e});return}if($n(pn)){we(P,$,pn.error);return}ye(P,vr(pn.data))}}async function Ae(P,$,G,{submission:ee,fetcherSubmission:se,preventScrollReset:Se,replace:xe}={}){G||(F?.resolve(),F=null),$.response.headers.has("X-Remix-Revalidate")&&(ie=!0);let _e=$.response.headers.get("Location");Je(_e,"Expected a Location header on the redirect Response"),_e=Rb(_e,new URL(P.url),l);let me=os(A.location,_e,{_isRedirect:!0});if(n){let qt=!1;if($.response.headers.has("X-Remix-Reload-Document"))qt=!0;else if(Eu(_e)){const Yt=dx(_e,!0);qt=Yt.origin!==t.location.origin||er(Yt.pathname,l)==null}if(qt){xe?t.location.replace(_e):t.location.assign(_e);return}}M=null;let Ce=xe===!0||$.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Be,formAction:De,formEncType:lt}=A.navigation;!ee&&!se&&Be&&De&&lt&&(ee=Pb(A.navigation));let dt=ee||se;if(ew.has($.response.status)&&dt&&An(dt.formMethod))await rt(Ce,me,{submission:{...dt,formAction:_e},preventScrollReset:Se||_,enableViewTransition:G?j:void 0});else{let qt=Tl(me,ee);await rt(Ce,me,{overrideNavigation:qt,fetcherSubmission:se,preventScrollReset:Se||_,enableViewTransition:G?j:void 0})}}async function Ye(P,$,G,ee){let se,Se={};try{se=await cw(p,P,$,ee,G,!1)}catch(xe){return $.filter(_e=>_e.shouldLoad).forEach(_e=>{Se[_e.route.id]={type:"error",error:xe}}),Se}if(P.signal.aborted)return Se;if(!An(P.method))for(let xe of $){if(se[xe.route.id]?.type==="error")break;!se.hasOwnProperty(xe.route.id)&&!A.loaderData.hasOwnProperty(xe.route.id)&&(!A.errors||!A.errors.hasOwnProperty(xe.route.id))&&xe.shouldCallHandler()&&(se[xe.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${xe.route.id}`)})}for(let[xe,_e]of Object.entries(se))if(xw(_e)){let me=_e.result;Se[xe]={type:"redirect",response:mw(me,P,xe,$,l)}}else Se[xe]=await fw(_e);return Se}async function q(P,$,G,ee){let se=Ye(G,P,ee,null),Se=Promise.all($.map(async me=>{if(me.matches&&me.match&&me.request&&me.controller){let Be=(await Ye(me.request,me.matches,ee,me.key))[me.match.route.id];return{[me.key]:Be}}else return Promise.resolve({[me.key]:{type:"error",error:Zn(404,{pathname:me.path})}})})),xe=await se,_e=(await Se).reduce((me,Ce)=>Object.assign(me,Ce),{});return{loaderResults:xe,fetcherResults:_e}}function te(){ie=!0,D.forEach((P,$)=>{re.has($)&&X.add($),Et($)})}function ye(P,$,G={}){A.fetchers.set(P,$),ge({fetchers:new Map(A.fetchers)},{flushSync:(G&&G.flushSync)===!0})}function we(P,$,G,ee={}){let se=Gr(A.matches,$);_t(P),ge({errors:{[se.route.id]:G},fetchers:new Map(A.fetchers)},{flushSync:(ee&&ee.flushSync)===!0})}function je(P){return ke.set(P,(ke.get(P)||0)+1),Le.has(P)&&Le.delete(P),A.fetchers.get(P)||tw}function Ze(P,$){Et(P,$?.reason),ye(P,vr(null))}function _t(P){let $=A.fetchers.get(P);re.has(P)&&!($&&$.state==="loading"&&Y.has(P))&&Et(P),D.delete(P),Y.delete(P),le.delete(P),Le.delete(P),X.delete(P),A.fetchers.delete(P)}function St(P){let $=(ke.get(P)||0)-1;$<=0?(ke.delete(P),Le.add(P)):ke.set(P,$),ge({fetchers:new Map(A.fetchers)})}function Et(P,$){let G=re.get(P);G&&(G.abort($),re.delete(P))}function Nt(P){for(let $ of P){let G=je($),ee=vr(G.data);A.fetchers.set($,ee)}}function J(){let P=[],$=!1;for(let G of le){let ee=A.fetchers.get(G);Je(ee,`Expected fetcher: ${G}`),ee.state==="loading"&&(le.delete(G),P.push(G),$=!0)}return Nt(P),$}function be(P){let $=[];for(let[G,ee]of Y)if(ee<P){let se=A.fetchers.get(G);Je(se,`Expected fetcher: ${G}`),se.state==="loading"&&(Et(G),Y.delete(G),$.push(G))}return Nt($),$.length>0}function Fe(P,$){let G=A.blockers.get(P)||vi;return ve.get(P)!==$&&ve.set(P,$),G}function Re(P){A.blockers.delete(P),ve.delete(P)}function xt(P,$){let G=A.blockers.get(P)||vi;Je(G.state==="unblocked"&&$.state==="blocked"||G.state==="blocked"&&$.state==="blocked"||G.state==="blocked"&&$.state==="proceeding"||G.state==="blocked"&&$.state==="unblocked"||G.state==="proceeding"&&$.state==="unblocked",`Invalid blocker state transition: ${G.state} -> ${$.state}`);let ee=new Map(A.blockers);ee.set(P,$),ge({blockers:ee})}function Wt({currentLocation:P,nextLocation:$,historyAction:G}){if(ve.size===0)return;ve.size>1&&Bt(!1,"A router only supports one blocker at a time");let ee=Array.from(ve.entries()),[se,Se]=ee[ee.length-1],xe=A.blockers.get(se);if(!(xe&&xe.state==="proceeding")&&Se({currentLocation:P,nextLocation:$,historyAction:G}))return se}function U(P){let $=Zn(404,{pathname:P}),G=u||o,{matches:ee,route:se}=Xs(G);return{notFoundMatches:ee,route:se,error:$}}function Te(P,$,G){if(b=P,y=$,E=G||null,!x&&A.navigation===xl){x=!0;let ee=Xe(A.location,A.matches);ee!=null&&ge({restoreScrollPosition:ee})}return()=>{b=null,y=null,E=null}}function Ne(P,$){return E&&E(P,$.map(ee=>Nv(ee,A.loaderData)))||P.key}function ze(P,$){if(b&&y){let G=Ne(P,$);b[G]=y()}}function Xe(P,$){if(b){let G=Ne(P,$),ee=b[G];if(typeof ee=="number")return ee}return null}function Ve(P,$,G){if(e.patchRoutesOnNavigation)if(P){if(Object.keys(P[0].params).length>0)return{active:!0,matches:Ui($,G,l,!0)}}else return{active:!0,matches:Ui($,G,l,!0)||[]};return{active:!1,matches:null}}async function At(P,$,G,ee){if(!e.patchRoutesOnNavigation)return{type:"success",matches:P};let se=P;for(;;){let Se=u==null,xe=u||o,_e=s;try{await e.patchRoutesOnNavigation({signal:G,path:$,matches:se,fetcherKey:ee,patch:(Be,De)=>{G.aborted||Nb(Be,De,xe,_e,i,!1)}})}catch(Be){return{type:"error",error:Be,partialMatches:se}}finally{Se&&!G.aborted&&(o=[...o])}if(G.aborted)return{type:"aborted"};let me=Hr(xe,$,l),Ce=null;if(me){if(Object.keys(me[0].params).length===0)return{type:"success",matches:me};if(Ce=Ui(xe,$,l,!0),!(Ce&&se.length<Ce.length&&rn(se,Ce.slice(0,se.length))))return{type:"success",matches:me}}if(Ce||(Ce=Ui(xe,$,l,!0)),!Ce||rn(se,Ce))return{type:"success",matches:null};se=Ce}}function rn(P,$){return P.length===$.length&&P.every((G,ee)=>G.route.id===$[ee].route.id)}function Rt(P){s={},u=us(P,i,void 0,s)}function Vt(P,$,G=!1){let ee=u==null;Nb(P,$,u||o,s,i,G),ee&&(o=[...o],ge({}))}return v={get basename(){return l},get future(){return d},get state(){return A},get routes(){return o},get window(){return t},initialize:he,subscribe:$e,enableScrollRestoration:Te,navigate:pt,fetch:zt,revalidate:de,createHref:P=>e.history.createHref(P),encodeLocation:P=>e.history.encodeLocation(P),getFetcher:je,resetFetcher:Ze,deleteFetcher:St,dispose:ct,getBlocker:Fe,deleteBlocker:Re,patchRoutes:Vt,_internalFetchControllers:re,_internalSetRoutes:Rt,_internalSetStateDoNotUseOrYouWillBreakYourApp(P){ge(P)}},e.unstable_instrumentations&&(v=Vv(v,e.unstable_instrumentations.map(P=>P.router).filter(Boolean))),v}function aw(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Tc(e,t,n,r,a,i){let s,o;if(a){s=[];for(let l of t)if(s.push(l),l.route.id===a){o=l;break}}else s=t,o=t[t.length-1];let u=xu(r||".",yu(s),er(e.pathname,n)||e.pathname,i==="path");if(r==null&&(u.search=e.search,u.hash=e.hash),(r==null||r===""||r===".")&&o){let l=fd(u.search);if(o.route.index&&!l)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!o.route.index&&l){let p=new URLSearchParams(u.search),d=p.getAll("index");p.delete("index"),d.filter(m=>m).forEach(m=>p.append("index",m));let f=p.toString();u.search=f?`?${f}`:""}}return n!=="/"&&(u.pathname=jv({basename:n,pathname:u.pathname})),br(u)}function wb(e,t,n){if(!n||!aw(n))return{path:t};if(n.formMethod&&!Aw(n.formMethod))return{path:t,error:Zn(405,{method:n.formMethod})};let r=()=>({path:t,error:Zn(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),s=Cx(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!An(i))return r();let d=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[m,b])=>`${f}${m}=${b}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/mermaid.core.B2zRNxtX.js","_astro/index.A0eX93qW.js","_astro/TaskDetail.5DIyVQ_N.js"])))=>i.map(i=>d[i]);
2
+ import{r as g,a as fv,g as bu,R as We,c as mv}from"./index.A0eX93qW.js";var bl={exports:{}},Ai={};var hb;function hv(){if(hb)return Ai;hb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var s=null;if(i!==void 0&&(s=""+i),a.key!==void 0&&(s=""+a.key),"key"in a){i={};for(var o in a)o!=="key"&&(i[o]=a[o])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:s,ref:a!==void 0?a:null,props:i}}return Ai.Fragment=t,Ai.jsx=n,Ai.jsxs=n,Ai}var gb;function gv(){return gb||(gb=1,bl.exports=hv()),bl.exports}var c=gv();var cx=e=>{throw TypeError(e)},bv=(e,t,n)=>t.has(e)||cx("Cannot "+n),El=(e,t,n)=>(bv(e,t,"read from private field"),n?n.call(e):t.get(e)),Ev=(e,t,n)=>t.has(e)?cx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),bb="popstate";function yv(e={}){function t(r,a){let{pathname:i,search:s,hash:o}=r.location;return os("",{pathname:i,search:s,hash:o},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:br(a)}return Tv(t,n,null,e)}function Je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Bt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xv(){return Math.random().toString(36).substring(2,10)}function Eb(e,t){return{usr:e.state,key:e.key,idx:t}}function os(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Kr(t):t,state:n,key:t&&t.key||r||xv()}}function br({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 Kr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Tv(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:i=!1}=r,s=a.history,o="POP",u=null,l=p();l==null&&(l=0,s.replaceState({...s.state,idx:l},""));function p(){return(s.state||{idx:null}).idx}function d(){o="POP";let y=p(),x=y==null?null:y-l;l=y,u&&u({action:o,location:E.location,delta:x})}function f(y,x){o="PUSH";let w=os(E.location,y,x);l=p()+1;let T=Eb(w,l),I=E.createHref(w);try{s.pushState(T,"",I)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(I)}i&&u&&u({action:o,location:E.location,delta:1})}function m(y,x){o="REPLACE";let w=os(E.location,y,x);l=p();let T=Eb(w,l),I=E.createHref(w);s.replaceState(T,"",I),i&&u&&u({action:o,location:E.location,delta:0})}function b(y){return dx(y)}let E={get action(){return o},get location(){return e(a,s)},listen(y){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(bb,d),u=y,()=>{a.removeEventListener(bb,d),u=null}},createHref(y){return t(a,y)},createURL:b,encodeLocation(y){let x=b(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:m,go(y){return s.go(y)}};return E}function dx(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Je(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:br(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Bi,yb=class{constructor(e){if(Ev(this,Bi,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(El(this,Bi).has(e))return El(this,Bi).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){El(this,Bi).set(e,t)}};Bi=new WeakMap;var Sv=new Set(["lazy","caseSensitive","path","id","index","children"]);function Av(e){return Sv.has(e)}var vv=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function wv(e){return vv.has(e)}function _v(e){return e.index===!0}function us(e,t,n=[],r={},a=!1){return e.map((i,s)=>{let o=[...n,String(s)],u=typeof i.id=="string"?i.id:o.join("-");if(Je(i.index!==!0||!i.children,"Cannot specify children on an index route"),Je(a||!r[u],`Found a route id collision on id "${u}". Route id's must be globally unique within Data Router usages`),_v(i)){let l={...i,id:u};return r[u]=xb(l,t(l)),l}else{let l={...i,id:u,children:void 0};return r[u]=xb(l,t(l)),i.children&&(l.children=us(i.children,t,o,r,a)),l}})}function xb(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function Hr(e,t,n="/"){return Ui(e,t,n,!1)}function Ui(e,t,n,r){let a=typeof t=="string"?Kr(t):t,i=er(a.pathname||"/",n);if(i==null)return null;let s=px(e);Cv(s);let o=null;for(let u=0;o==null&&u<s.length;++u){let l=Uv(i);o=Pv(s[u],l,r)}return o}function Nv(e,t){let{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function px(e,t=[],n=[],r="",a=!1){let i=(s,o,u=a,l)=>{let p={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&u)return;Je(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let d=gr([r,p.relativePath]),f=n.concat(p);s.children&&s.children.length>0&&(Je(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),px(s.children,t,f,d,u)),!(s.path==null&&!s.index)&&t.push({path:d,score:Fv(d,s.index),routesMeta:f})};return e.forEach((s,o)=>{if(s.path===""||!s.path?.includes("?"))i(s,o);else for(let u of fx(s.path))i(s,o,!0,u)}),t}function fx(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let s=fx(r.join("/")),o=[];return o.push(...s.map(u=>u===""?i:[i,u].join("/"))),a&&o.push(...s),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function Cv(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Mv(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Iv=/^:[\w-]+$/,kv=3,Rv=2,Dv=1,Ov=10,Lv=-2,Tb=e=>e==="*";function Fv(e,t){let n=e.split("/"),r=n.length;return n.some(Tb)&&(r+=Lv),t&&(r+=Rv),n.filter(a=>!Tb(a)).reduce((a,i)=>a+(Iv.test(i)?kv:i===""?Dv:Ov),r)}function Mv(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function Pv(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",s=[];for(let o=0;o<r.length;++o){let u=r[o],l=o===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",d=Mo({path:u.relativePath,caseSensitive:u.caseSensitive,end:l},p),f=u.route;if(!d&&l&&n&&!r[r.length-1].route.index&&(d=Mo({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!d)return null;Object.assign(a,d.params),s.push({params:a,pathname:gr([i,d.pathname]),pathnameBase:zv(gr([i,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(i=gr([i,d.pathnameBase]))}return s}function Mo(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Bv(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],s=i.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:r.reduce((l,{paramName:p,isOptional:d},f)=>{if(p==="*"){let b=o[f]||"";s=i.slice(0,i.length-b.length).replace(/(.)\/+$/,"$1")}const m=o[f];return d&&!m?l[p]=void 0:l[p]=(m||"").replace(/%2F/g,"/"),l},{}),pathname:i,pathnameBase:s,pattern:e}}function Bv(e,t=!1,n=!0){Bt(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 r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Uv(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Bt(!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 er(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function jv({basename:e,pathname:t}){return t==="/"?e:gr([e,t])}var mx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Eu=e=>mx.test(e);function $v(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Kr(e):e,i;if(n)if(Eu(n))i=n;else{if(n.includes("//")){let s=n;n=n.replace(/\/\/+/g,"/"),Bt(!1,`Pathnames cannot have embedded double slashes - normalizing ${s} -> ${n}`)}n.startsWith("/")?i=Sb(n.substring(1),"/"):i=Sb(n,t)}else i=t;return{pathname:i,search:Hv(r),hash:Gv(a)}}function Sb(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function yl(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. 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 hx(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function yu(e){let t=hx(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function xu(e,t,n,r=!1){let a;typeof e=="string"?a=Kr(e):(a={...e},Je(!a.pathname||!a.pathname.includes("?"),yl("?","pathname","search",a)),Je(!a.pathname||!a.pathname.includes("#"),yl("#","pathname","hash",a)),Je(!a.search||!a.search.includes("#"),yl("#","search","hash",a)));let i=e===""||a.pathname==="",s=i?"/":a.pathname,o;if(s==null)o=n;else{let d=t.length-1;if(!r&&s.startsWith("..")){let f=s.split("/");for(;f[0]==="..";)f.shift(),d-=1;a.pathname=f.join("/")}o=d>=0?t[d]:"/"}let u=$v(a,o),l=s&&s!=="/"&&s.endsWith("/"),p=(i||s===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(l||p)&&(u.pathname+="/"),u}var gr=e=>e.join("/").replace(/\/\/+/g,"/"),zv=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Hv=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Gv=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,vs=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ls(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ws(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var gx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bx(e,t){let n=e;if(typeof n!="string"||!mx.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(gx)try{let i=new URL(window.location.href),s=n.startsWith("//")?new URL(i.protocol+n):new URL(n),o=er(s.pathname,t);s.origin===i.origin&&o!=null?n=o+s.search+s.hash:a=!0}catch{Bt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}var Vr=Symbol("Uninstrumented");function Wv(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(a=>a({id:t.id,index:t.index,path:t.path,instrument(i){let s=Object.keys(n);for(let o of s)i[o]&&n[o].push(i[o])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let a=La(n.lazy,t.lazy,()=>{});a&&(r.lazy=a)}if(typeof t.lazy=="object"){let a=t.lazy;["middleware","loader","action"].forEach(i=>{let s=a[i],o=n[`lazy.${i}`];if(typeof s=="function"&&o.length>0){let u=La(o,s,()=>{});u&&(r.lazy=Object.assign(r.lazy||{},{[i]:u}))}})}return["loader","action"].forEach(a=>{let i=t[a];if(typeof i=="function"&&n[a].length>0){let s=i[Vr]??i,o=La(n[a],s,(...u)=>Ab(u[0]));o&&(o[Vr]=s,r[a]=o)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let i=a[Vr]??a,s=La(n.middleware,i,(...o)=>Ab(o[0]));return s?(s[Vr]=i,s):a})),r}function Vv(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(a){let i=Object.keys(a);for(let s of i)a[s]&&n[s].push(a[s])}})),n.navigate.length>0){let r=e.navigate[Vr]??e.navigate,a=La(n.navigate,r,(...i)=>{let[s,o]=i;return{to:typeof s=="number"||typeof s=="string"?s:s?br(s):".",...vb(e,o??{})}});a&&(a[Vr]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[Vr]??e.fetch,a=La(n.fetch,r,(...i)=>{let[s,,o,u]=i;return{href:o??".",fetcherKey:s,...vb(e,u??{})}});a&&(a[Vr]=r,e.fetch=a)}return e}function La(e,t,n){return e.length===0?null:async(...r)=>{let a=await Ex(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function Ex(e,t,n,r){let a=e[r],i;if(a){let s,o=async()=>(s?console.error("You cannot call instrumented handlers more than once"):s=Ex(e,t,n,r-1),i=await s,Je(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await a(o,t)}catch(u){console.error("An instrumentation function threw an error:",u)}s||await o(),await s}else try{i={type:"success",value:await n()}}catch(s){i={type:"error",value:s}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Ab(e){let{request:t,context:n,params:r,unstable_pattern:a}=e;return{request:qv(t),params:{...r},unstable_pattern:a,context:Yv(n)}}function vb(e,t){return{currentUrl:br(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function qv(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Yv(e){if(Kv(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Zv=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Kv(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===Zv}var yx=["POST","PUT","PATCH","DELETE"],Xv=new Set(yx),Qv=["GET",...yx],Jv=new Set(Qv),xx=new Set([301,302,303,307,308]),ew=new Set([307,308]),xl={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},tw={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},vi={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},nw=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Tx="remix-router-transitions",Sx=Symbol("ResetLoaderData");function rw(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";Je(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||nw,i=a;if(e.unstable_instrumentations){let P=e.unstable_instrumentations;i=$=>({...a($),...Wv(P.map(G=>G.route).filter(Boolean),$)})}let s={},o=us(e.routes,i,void 0,s),u,l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let p=e.dataStrategy||uw,d={...e.future},f=null,m=new Set,b=null,E=null,y=null,x=e.hydrationData!=null,w=Hr(o,e.history.location,l),T=!1,I=null,R;if(w==null&&!e.patchRoutesOnNavigation){let P=Zn(404,{pathname:e.history.location.pathname}),{matches:$,route:G}=Xs(o);R=!0,w=$,I={[G.id]:P}}else if(w&&!e.hydrationData&&Ve(w,o,e.history.location.pathname).active&&(w=null),w)if(w.some(P=>P.route.lazy))R=!1;else if(!w.some(P=>dd(P.route)))R=!0;else{let P=e.hydrationData?e.hydrationData.loaderData:null,$=e.hydrationData?e.hydrationData.errors:null;if($){let G=w.findIndex(ee=>$[ee.route.id]!==void 0);R=w.slice(0,G+1).every(ee=>!Sc(ee.route,P,$))}else R=w.every(G=>!Sc(G.route,P,$))}else{R=!1,w=[];let P=Ve(null,o,e.history.location.pathname);P.active&&P.matches&&(T=!0,w=P.matches)}let v,A={historyAction:e.history.action,location:e.history.location,matches:w,initialized:R,navigation:xl,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||I,fetchers:new Map,blockers:new Map},N="POP",F=null,_=!1,M,j=!1,H=new Map,Z=null,V=!1,ie=!1,X=new Set,re=new Map,ue=0,k=-1,Y=new Map,le=new Set,D=new Map,ke=new Map,Le=new Set,ve=new Map,Ue,Ee=null;function he(){if(f=e.history.listen(({action:P,location:$,delta:G})=>{if(Ue){Ue(),Ue=void 0;return}Bt(ve.size===0||G!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ee=Wt({currentLocation:A.location,nextLocation:$,historyAction:P});if(ee&&G!=null){let se=new Promise(Se=>{Ue=Se});e.history.go(G*-1),Tt(ee,{state:"blocked",location:$,proceed(){Tt(ee,{state:"proceeding",proceed:void 0,reset:void 0,location:$}),se.then(()=>e.history.go(G))},reset(){let Se=new Map(A.blockers);Se.set(ee,vi),ge({blockers:Se})}}),F?.resolve(),F=null;return}return rt(P,$)}),n){_w(t,H);let P=()=>Nw(t,H);t.addEventListener("pagehide",P),Z=()=>t.removeEventListener("pagehide",P)}return A.initialized||rt("POP",A.location,{initialHydration:!0}),v}function ct(){f&&f(),Z&&Z(),m.clear(),M&&M.abort(),A.fetchers.forEach((P,$)=>_t($)),A.blockers.forEach((P,$)=>Re($))}function $e(P){return m.add(P),()=>m.delete(P)}function ge(P,$={}){P.matches&&(P.matches=P.matches.map(se=>{let Se=s[se.route.id],xe=se.route;return xe.element!==Se.element||xe.errorElement!==Se.errorElement||xe.hydrateFallbackElement!==Se.hydrateFallbackElement?{...se,route:Se}:se})),A={...A,...P};let G=[],ee=[];A.fetchers.forEach((se,Se)=>{se.state==="idle"&&(Le.has(Se)?G.push(Se):ee.push(Se))}),Le.forEach(se=>{!A.fetchers.has(se)&&!re.has(se)&&G.push(se)}),[...m].forEach(se=>se(A,{deletedFetchers:G,newErrors:P.errors??null,viewTransitionOpts:$.viewTransitionOpts,flushSync:$.flushSync===!0})),G.forEach(se=>_t(se)),ee.forEach(se=>A.fetchers.delete(se))}function Pe(P,$,{flushSync:G}={}){let ee=A.actionData!=null&&A.navigation.formMethod!=null&&An(A.navigation.formMethod)&&A.navigation.state==="loading"&&P.state?._isRedirect!==!0,se;$.actionData?Object.keys($.actionData).length>0?se=$.actionData:se=null:ee?se=A.actionData:se=null;let Se=$.loaderData?Lb(A.loaderData,$.loaderData,$.matches||[],$.errors):A.loaderData,xe=A.blockers;xe.size>0&&(xe=new Map(xe),xe.forEach((Be,De)=>xe.set(De,vi)));let _e=V?!1:Xe(P,$.matches||A.matches),me=_===!0||A.navigation.formMethod!=null&&An(A.navigation.formMethod)&&P.state?._isRedirect!==!0;u&&(o=u,u=void 0),V||N==="POP"||(N==="PUSH"?e.history.push(P,P.state):N==="REPLACE"&&e.history.replace(P,P.state));let Ce;if(N==="POP"){let Be=H.get(A.location.pathname);Be&&Be.has(P.pathname)?Ce={currentLocation:A.location,nextLocation:P}:H.has(P.pathname)&&(Ce={currentLocation:P,nextLocation:A.location})}else if(j){let Be=H.get(A.location.pathname);Be?Be.add(P.pathname):(Be=new Set([P.pathname]),H.set(A.location.pathname,Be)),Ce={currentLocation:A.location,nextLocation:P}}ge({...$,actionData:se,loaderData:Se,historyAction:N,location:P,initialized:!0,navigation:xl,revalidation:"idle",restoreScrollPosition:_e,preventScrollReset:me,blockers:xe},{viewTransitionOpts:Ce,flushSync:G===!0}),N="POP",_=!1,j=!1,V=!1,ie=!1,F?.resolve(),F=null,Ee?.resolve(),Ee=null}async function pt(P,$){if(F?.resolve(),F=null,typeof P=="number"){F||(F=Bb());let dt=F.promise;return e.history.go(P),dt}let G=Tc(A.location,A.matches,l,P,$?.fromRouteId,$?.relative),{path:ee,submission:se,error:Se}=wb(!1,G,$),xe=A.location,_e=os(A.location,ee,$&&$.state);_e={..._e,...e.history.encodeLocation(_e)};let me=$&&$.replace!=null?$.replace:void 0,Ce="PUSH";me===!0?Ce="REPLACE":me===!1||se!=null&&An(se.formMethod)&&se.formAction===A.location.pathname+A.location.search&&(Ce="REPLACE");let Be=$&&"preventScrollReset"in $?$.preventScrollReset===!0:void 0,De=($&&$.flushSync)===!0,lt=Wt({currentLocation:xe,nextLocation:_e,historyAction:Ce});if(lt){Tt(lt,{state:"blocked",location:_e,proceed(){Tt(lt,{state:"proceeding",proceed:void 0,reset:void 0,location:_e}),pt(P,$)},reset(){let dt=new Map(A.blockers);dt.set(lt,vi),ge({blockers:dt})}});return}await rt(Ce,_e,{submission:se,pendingError:Se,preventScrollReset:Be,replace:$&&$.replace,enableViewTransition:$&&$.viewTransition,flushSync:De,callSiteDefaultShouldRevalidate:$&&$.unstable_defaultShouldRevalidate})}function de(){Ee||(Ee=Bb()),te(),ge({revalidation:"loading"});let P=Ee.promise;return A.navigation.state==="submitting"?P:A.navigation.state==="idle"?(rt(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),P):(rt(N||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:j===!0}),P)}async function rt(P,$,G){M&&M.abort(),M=null,N=P,V=(G&&G.startUninterruptedRevalidation)===!0,ze(A.location,A.matches),_=(G&&G.preventScrollReset)===!0,j=(G&&G.enableViewTransition)===!0;let ee=u||o,se=G&&G.overrideNavigation,Se=G?.initialHydration&&A.matches&&A.matches.length>0&&!T?A.matches:Hr(ee,$,l),xe=(G&&G.flushSync)===!0;if(Se&&A.initialized&&!ie&&gw(A.location,$)&&!(G&&G.submission&&An(G.submission.formMethod))){Pe($,{matches:Se},{flushSync:xe});return}let _e=Ve(Se,ee,$.pathname);if(_e.active&&_e.matches&&(Se=_e.matches),!Se){let{error:Yt,notFoundMatches:pn,route:yt}=U($.pathname);Pe($,{matches:pn,loaderData:{},errors:{[yt.id]:Yt}},{flushSync:xe});return}M=new AbortController;let me=Ra(e.history,$,M.signal,G&&G.submission),Ce=e.getContext?await e.getContext():new yb,Be;if(G&&G.pendingError)Be=[Gr(Se).route.id,{type:"error",error:G.pendingError}];else if(G&&G.submission&&An(G.submission.formMethod)){let Yt=await Ot(me,$,G.submission,Se,Ce,_e.active,G&&G.initialHydration===!0,{replace:G.replace,flushSync:xe});if(Yt.shortCircuited)return;if(Yt.pendingActionResult){let[pn,yt]=Yt.pendingActionResult;if($n(yt)&&ls(yt.error)&&yt.error.status===404){M=null,Pe($,{matches:Yt.matches,loaderData:{},errors:{[pn]:yt.error}});return}}Se=Yt.matches||Se,Be=Yt.pendingActionResult,se=Tl($,G.submission),xe=!1,_e.active=!1,me=Ra(e.history,me.url,me.signal)}let{shortCircuited:De,matches:lt,loaderData:dt,errors:qt}=await ft(me,$,Se,Ce,_e.active,se,G&&G.submission,G&&G.fetcherSubmission,G&&G.replace,G&&G.initialHydration===!0,xe,Be,G&&G.callSiteDefaultShouldRevalidate);De||(M=null,Pe($,{matches:lt||Se,...Fb(Be),loaderData:dt,errors:qt}))}async function Ot(P,$,G,ee,se,Se,xe,_e={}){te();let me=vw($,G);if(ge({navigation:me},{flushSync:_e.flushSync===!0}),Se){let De=await At(ee,$.pathname,P.signal);if(De.type==="aborted")return{shortCircuited:!0};if(De.type==="error"){if(De.partialMatches.length===0){let{matches:dt,route:qt}=Xs(o);return{matches:dt,pendingActionResult:[qt.id,{type:"error",error:De.error}]}}let lt=Gr(De.partialMatches).route.id;return{matches:De.partialMatches,pendingActionResult:[lt,{type:"error",error:De.error}]}}else if(De.matches)ee=De.matches;else{let{notFoundMatches:lt,error:dt,route:qt}=U($.pathname);return{matches:lt,pendingActionResult:[qt.id,{type:"error",error:dt}]}}}let Ce,Be=Ao(ee,$);if(!Be.route.action&&!Be.route.lazy)Ce={type:"error",error:Zn(405,{method:P.method,pathname:$.pathname,routeId:Be.route.id})};else{let De=$a(i,s,P,ee,Be,xe?[]:r,se),lt=await Ye(P,De,se,null);if(Ce=lt[Be.route.id],!Ce){for(let dt of ee)if(lt[dt.route.id]){Ce=lt[dt.route.id];break}}if(P.signal.aborted)return{shortCircuited:!0}}if(ra(Ce)){let De;return _e&&_e.replace!=null?De=_e.replace:De=Rb(Ce.response.headers.get("Location"),new URL(P.url),l)===A.location.pathname+A.location.search,await Ae(P,Ce,!0,{submission:G,replace:De}),{shortCircuited:!0}}if($n(Ce)){let De=Gr(ee,Be.route.id);return(_e&&_e.replace)!==!0&&(N="PUSH"),{matches:ee,pendingActionResult:[De.route.id,Ce,Be.route.id]}}return{matches:ee,pendingActionResult:[Be.route.id,Ce]}}async function ft(P,$,G,ee,se,Se,xe,_e,me,Ce,Be,De,lt){let dt=Se||Tl($,xe),qt=xe||_e||Pb(dt),Yt=!V&&!Ce;if(se){if(Yt){let Pt=kt(De);ge({navigation:dt,...Pt!==void 0?{actionData:Pt}:{}},{flushSync:Be})}let tt=await At(G,$.pathname,P.signal);if(tt.type==="aborted")return{shortCircuited:!0};if(tt.type==="error"){if(tt.partialMatches.length===0){let{matches:Vn,route:fn}=Xs(o);return{matches:Vn,loaderData:{},errors:{[fn.id]:tt.error}}}let Pt=Gr(tt.partialMatches).route.id;return{matches:tt.partialMatches,loaderData:{},errors:{[Pt]:tt.error}}}else if(tt.matches)G=tt.matches;else{let{error:Pt,notFoundMatches:Vn,route:fn}=U($.pathname);return{matches:Vn,loaderData:{},errors:{[fn.id]:Pt}}}}let pn=u||o,{dsMatches:yt,revalidatingFetchers:Ln}=_b(P,ee,i,s,e.history,A,G,qt,$,Ce?[]:r,Ce===!0,ie,X,Le,D,le,pn,l,e.patchRoutesOnNavigation!=null,De,lt);if(k=++ue,!e.dataStrategy&&!yt.some(tt=>tt.shouldLoad)&&!yt.some(tt=>tt.route.middleware&&tt.route.middleware.length>0)&&Ln.length===0){let tt=J();return Pe($,{matches:G,loaderData:{},errors:De&&$n(De[1])?{[De[0]]:De[1].error}:null,...Fb(De),...tt?{fetchers:new Map(A.fetchers)}:{}},{flushSync:Be}),{shortCircuited:!0}}if(Yt){let tt={};if(!se){tt.navigation=dt;let Pt=kt(De);Pt!==void 0&&(tt.actionData=Pt)}Ln.length>0&&(tt.fetchers=wt(Ln)),ge(tt,{flushSync:Be})}Ln.forEach(tt=>{Et(tt.key),tt.controller&&re.set(tt.key,tt.controller)});let Tn=()=>Ln.forEach(tt=>Et(tt.key));M&&M.signal.addEventListener("abort",Tn);let{loaderResults:Or,fetcherResults:Sn}=await q(yt,Ln,P,ee);if(P.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",Tn),Ln.forEach(tt=>re.delete(tt.key));let Wn=Qs(Or);if(Wn)return await Ae(P,Wn.result,!0,{replace:me}),{shortCircuited:!0};if(Wn=Qs(Sn),Wn)return le.add(Wn.key),await Ae(P,Wn.result,!0,{replace:me}),{shortCircuited:!0};let{loaderData:Ti,errors:Lr}=Ob(A,G,Or,De,Ln,Sn);Ce&&A.errors&&(Lr={...A.errors,...Lr});let cr=J(),Ar=be(k),Fr=cr||Ar||Ln.length>0;return{matches:G,loaderData:Ti,errors:Lr,...Fr?{fetchers:new Map(A.fetchers)}:{}}}function kt(P){if(P&&!$n(P[1]))return{[P[0]]:P[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function wt(P){return P.forEach($=>{let G=A.fetchers.get($.key),ee=wi(void 0,G?G.data:void 0);A.fetchers.set($.key,ee)}),new Map(A.fetchers)}async function zt(P,$,G,ee){Et(P);let se=(ee&&ee.flushSync)===!0,Se=u||o,xe=Tc(A.location,A.matches,l,G,$,ee?.relative),_e=Hr(Se,xe,l),me=Ve(_e,Se,xe);if(me.active&&me.matches&&(_e=me.matches),!_e){we(P,$,Zn(404,{pathname:xe}),{flushSync:se});return}let{path:Ce,submission:Be,error:De}=wb(!0,xe,ee);if(De){we(P,$,De,{flushSync:se});return}let lt=e.getContext?await e.getContext():new yb,dt=(ee&&ee.preventScrollReset)===!0;if(Be&&An(Be.formMethod)){await nn(P,$,Ce,_e,lt,me.active,se,dt,Be,ee&&ee.unstable_defaultShouldRevalidate);return}D.set(P,{routeId:$,path:Ce}),await ut(P,$,Ce,_e,lt,me.active,se,dt,Be)}async function nn(P,$,G,ee,se,Se,xe,_e,me,Ce){te(),D.delete(P);let Be=A.fetchers.get(P);ye(P,ww(me,Be),{flushSync:xe});let De=new AbortController,lt=Ra(e.history,G,De.signal,me);if(Se){let Lt=await At(ee,new URL(lt.url).pathname,lt.signal,P);if(Lt.type==="aborted")return;if(Lt.type==="error"){we(P,$,Lt.error,{flushSync:xe});return}else if(Lt.matches)ee=Lt.matches;else{we(P,$,Zn(404,{pathname:G}),{flushSync:xe});return}}let dt=Ao(ee,G);if(!dt.route.action&&!dt.route.lazy){let Lt=Zn(405,{method:me.formMethod,pathname:G,routeId:$});we(P,$,Lt,{flushSync:xe});return}re.set(P,De);let qt=ue,Yt=$a(i,s,lt,ee,dt,r,se),pn=await Ye(lt,Yt,se,P),yt=pn[dt.route.id];if(!yt){for(let Lt of Yt)if(pn[Lt.route.id]){yt=pn[Lt.route.id];break}}if(lt.signal.aborted){re.get(P)===De&&re.delete(P);return}if(Le.has(P)){if(ra(yt)||$n(yt)){ye(P,vr(void 0));return}}else{if(ra(yt))if(re.delete(P),k>qt){ye(P,vr(void 0));return}else return le.add(P),ye(P,wi(me)),Ae(lt,yt,!1,{fetcherSubmission:me,preventScrollReset:_e});if($n(yt)){we(P,$,yt.error);return}}let Ln=A.navigation.location||A.location,Tn=Ra(e.history,Ln,De.signal),Or=u||o,Sn=A.navigation.state!=="idle"?Hr(Or,A.navigation.location,l):A.matches;Je(Sn,"Didn't find any matches after fetcher action");let Wn=++ue;Y.set(P,Wn);let Ti=wi(me,yt.data);A.fetchers.set(P,Ti);let{dsMatches:Lr,revalidatingFetchers:cr}=_b(Tn,se,i,s,e.history,A,Sn,me,Ln,r,!1,ie,X,Le,D,le,Or,l,e.patchRoutesOnNavigation!=null,[dt.route.id,yt],Ce);cr.filter(Lt=>Lt.key!==P).forEach(Lt=>{let wa=Lt.key,Si=A.fetchers.get(wa),Zs=wi(void 0,Si?Si.data:void 0);A.fetchers.set(wa,Zs),Et(wa),Lt.controller&&re.set(wa,Lt.controller)}),ge({fetchers:new Map(A.fetchers)});let Ar=()=>cr.forEach(Lt=>Et(Lt.key));De.signal.addEventListener("abort",Ar);let{loaderResults:Fr,fetcherResults:tt}=await q(Lr,cr,Tn,se);if(De.signal.aborted)return;if(De.signal.removeEventListener("abort",Ar),Y.delete(P),re.delete(P),cr.forEach(Lt=>re.delete(Lt.key)),A.fetchers.has(P)){let Lt=vr(yt.data);A.fetchers.set(P,Lt)}let Pt=Qs(Fr);if(Pt)return Ae(Tn,Pt.result,!1,{preventScrollReset:_e});if(Pt=Qs(tt),Pt)return le.add(Pt.key),Ae(Tn,Pt.result,!1,{preventScrollReset:_e});let{loaderData:Vn,errors:fn}=Ob(A,Sn,Fr,void 0,cr,tt);be(Wn),A.navigation.state==="loading"&&Wn>k?(Je(N,"Expected pending action"),M&&M.abort(),Pe(A.navigation.location,{matches:Sn,loaderData:Vn,errors:fn,fetchers:new Map(A.fetchers)})):(ge({errors:fn,loaderData:Lb(A.loaderData,Vn,Sn,fn),fetchers:new Map(A.fetchers)}),ie=!1)}async function ut(P,$,G,ee,se,Se,xe,_e,me){let Ce=A.fetchers.get(P);ye(P,wi(me,Ce?Ce.data:void 0),{flushSync:xe});let Be=new AbortController,De=Ra(e.history,G,Be.signal);if(Se){let yt=await At(ee,new URL(De.url).pathname,De.signal,P);if(yt.type==="aborted")return;if(yt.type==="error"){we(P,$,yt.error,{flushSync:xe});return}else if(yt.matches)ee=yt.matches;else{we(P,$,Zn(404,{pathname:G}),{flushSync:xe});return}}let lt=Ao(ee,G);re.set(P,Be);let dt=ue,qt=$a(i,s,De,ee,lt,r,se),pn=(await Ye(De,qt,se,P))[lt.route.id];if(re.get(P)===Be&&re.delete(P),!De.signal.aborted){if(Le.has(P)){ye(P,vr(void 0));return}if(ra(pn))if(k>dt){ye(P,vr(void 0));return}else{le.add(P),await Ae(De,pn,!1,{preventScrollReset:_e});return}if($n(pn)){we(P,$,pn.error);return}ye(P,vr(pn.data))}}async function Ae(P,$,G,{submission:ee,fetcherSubmission:se,preventScrollReset:Se,replace:xe}={}){G||(F?.resolve(),F=null),$.response.headers.has("X-Remix-Revalidate")&&(ie=!0);let _e=$.response.headers.get("Location");Je(_e,"Expected a Location header on the redirect Response"),_e=Rb(_e,new URL(P.url),l);let me=os(A.location,_e,{_isRedirect:!0});if(n){let qt=!1;if($.response.headers.has("X-Remix-Reload-Document"))qt=!0;else if(Eu(_e)){const Yt=dx(_e,!0);qt=Yt.origin!==t.location.origin||er(Yt.pathname,l)==null}if(qt){xe?t.location.replace(_e):t.location.assign(_e);return}}M=null;let Ce=xe===!0||$.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Be,formAction:De,formEncType:lt}=A.navigation;!ee&&!se&&Be&&De&&lt&&(ee=Pb(A.navigation));let dt=ee||se;if(ew.has($.response.status)&&dt&&An(dt.formMethod))await rt(Ce,me,{submission:{...dt,formAction:_e},preventScrollReset:Se||_,enableViewTransition:G?j:void 0});else{let qt=Tl(me,ee);await rt(Ce,me,{overrideNavigation:qt,fetcherSubmission:se,preventScrollReset:Se||_,enableViewTransition:G?j:void 0})}}async function Ye(P,$,G,ee){let se,Se={};try{se=await cw(p,P,$,ee,G,!1)}catch(xe){return $.filter(_e=>_e.shouldLoad).forEach(_e=>{Se[_e.route.id]={type:"error",error:xe}}),Se}if(P.signal.aborted)return Se;if(!An(P.method))for(let xe of $){if(se[xe.route.id]?.type==="error")break;!se.hasOwnProperty(xe.route.id)&&!A.loaderData.hasOwnProperty(xe.route.id)&&(!A.errors||!A.errors.hasOwnProperty(xe.route.id))&&xe.shouldCallHandler()&&(se[xe.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${xe.route.id}`)})}for(let[xe,_e]of Object.entries(se))if(xw(_e)){let me=_e.result;Se[xe]={type:"redirect",response:mw(me,P,xe,$,l)}}else Se[xe]=await fw(_e);return Se}async function q(P,$,G,ee){let se=Ye(G,P,ee,null),Se=Promise.all($.map(async me=>{if(me.matches&&me.match&&me.request&&me.controller){let Be=(await Ye(me.request,me.matches,ee,me.key))[me.match.route.id];return{[me.key]:Be}}else return Promise.resolve({[me.key]:{type:"error",error:Zn(404,{pathname:me.path})}})})),xe=await se,_e=(await Se).reduce((me,Ce)=>Object.assign(me,Ce),{});return{loaderResults:xe,fetcherResults:_e}}function te(){ie=!0,D.forEach((P,$)=>{re.has($)&&X.add($),Et($)})}function ye(P,$,G={}){A.fetchers.set(P,$),ge({fetchers:new Map(A.fetchers)},{flushSync:(G&&G.flushSync)===!0})}function we(P,$,G,ee={}){let se=Gr(A.matches,$);_t(P),ge({errors:{[se.route.id]:G},fetchers:new Map(A.fetchers)},{flushSync:(ee&&ee.flushSync)===!0})}function je(P){return ke.set(P,(ke.get(P)||0)+1),Le.has(P)&&Le.delete(P),A.fetchers.get(P)||tw}function Ze(P,$){Et(P,$?.reason),ye(P,vr(null))}function _t(P){let $=A.fetchers.get(P);re.has(P)&&!($&&$.state==="loading"&&Y.has(P))&&Et(P),D.delete(P),Y.delete(P),le.delete(P),Le.delete(P),X.delete(P),A.fetchers.delete(P)}function St(P){let $=(ke.get(P)||0)-1;$<=0?(ke.delete(P),Le.add(P)):ke.set(P,$),ge({fetchers:new Map(A.fetchers)})}function Et(P,$){let G=re.get(P);G&&(G.abort($),re.delete(P))}function Nt(P){for(let $ of P){let G=je($),ee=vr(G.data);A.fetchers.set($,ee)}}function J(){let P=[],$=!1;for(let G of le){let ee=A.fetchers.get(G);Je(ee,`Expected fetcher: ${G}`),ee.state==="loading"&&(le.delete(G),P.push(G),$=!0)}return Nt(P),$}function be(P){let $=[];for(let[G,ee]of Y)if(ee<P){let se=A.fetchers.get(G);Je(se,`Expected fetcher: ${G}`),se.state==="loading"&&(Et(G),Y.delete(G),$.push(G))}return Nt($),$.length>0}function Fe(P,$){let G=A.blockers.get(P)||vi;return ve.get(P)!==$&&ve.set(P,$),G}function Re(P){A.blockers.delete(P),ve.delete(P)}function Tt(P,$){let G=A.blockers.get(P)||vi;Je(G.state==="unblocked"&&$.state==="blocked"||G.state==="blocked"&&$.state==="blocked"||G.state==="blocked"&&$.state==="proceeding"||G.state==="blocked"&&$.state==="unblocked"||G.state==="proceeding"&&$.state==="unblocked",`Invalid blocker state transition: ${G.state} -> ${$.state}`);let ee=new Map(A.blockers);ee.set(P,$),ge({blockers:ee})}function Wt({currentLocation:P,nextLocation:$,historyAction:G}){if(ve.size===0)return;ve.size>1&&Bt(!1,"A router only supports one blocker at a time");let ee=Array.from(ve.entries()),[se,Se]=ee[ee.length-1],xe=A.blockers.get(se);if(!(xe&&xe.state==="proceeding")&&Se({currentLocation:P,nextLocation:$,historyAction:G}))return se}function U(P){let $=Zn(404,{pathname:P}),G=u||o,{matches:ee,route:se}=Xs(G);return{notFoundMatches:ee,route:se,error:$}}function Te(P,$,G){if(b=P,y=$,E=G||null,!x&&A.navigation===xl){x=!0;let ee=Xe(A.location,A.matches);ee!=null&&ge({restoreScrollPosition:ee})}return()=>{b=null,y=null,E=null}}function Ne(P,$){return E&&E(P,$.map(ee=>Nv(ee,A.loaderData)))||P.key}function ze(P,$){if(b&&y){let G=Ne(P,$);b[G]=y()}}function Xe(P,$){if(b){let G=Ne(P,$),ee=b[G];if(typeof ee=="number")return ee}return null}function Ve(P,$,G){if(e.patchRoutesOnNavigation)if(P){if(Object.keys(P[0].params).length>0)return{active:!0,matches:Ui($,G,l,!0)}}else return{active:!0,matches:Ui($,G,l,!0)||[]};return{active:!1,matches:null}}async function At(P,$,G,ee){if(!e.patchRoutesOnNavigation)return{type:"success",matches:P};let se=P;for(;;){let Se=u==null,xe=u||o,_e=s;try{await e.patchRoutesOnNavigation({signal:G,path:$,matches:se,fetcherKey:ee,patch:(Be,De)=>{G.aborted||Nb(Be,De,xe,_e,i,!1)}})}catch(Be){return{type:"error",error:Be,partialMatches:se}}finally{Se&&!G.aborted&&(o=[...o])}if(G.aborted)return{type:"aborted"};let me=Hr(xe,$,l),Ce=null;if(me){if(Object.keys(me[0].params).length===0)return{type:"success",matches:me};if(Ce=Ui(xe,$,l,!0),!(Ce&&se.length<Ce.length&&rn(se,Ce.slice(0,se.length))))return{type:"success",matches:me}}if(Ce||(Ce=Ui(xe,$,l,!0)),!Ce||rn(se,Ce))return{type:"success",matches:null};se=Ce}}function rn(P,$){return P.length===$.length&&P.every((G,ee)=>G.route.id===$[ee].route.id)}function Rt(P){s={},u=us(P,i,void 0,s)}function Vt(P,$,G=!1){let ee=u==null;Nb(P,$,u||o,s,i,G),ee&&(o=[...o],ge({}))}return v={get basename(){return l},get future(){return d},get state(){return A},get routes(){return o},get window(){return t},initialize:he,subscribe:$e,enableScrollRestoration:Te,navigate:pt,fetch:zt,revalidate:de,createHref:P=>e.history.createHref(P),encodeLocation:P=>e.history.encodeLocation(P),getFetcher:je,resetFetcher:Ze,deleteFetcher:St,dispose:ct,getBlocker:Fe,deleteBlocker:Re,patchRoutes:Vt,_internalFetchControllers:re,_internalSetRoutes:Rt,_internalSetStateDoNotUseOrYouWillBreakYourApp(P){ge(P)}},e.unstable_instrumentations&&(v=Vv(v,e.unstable_instrumentations.map(P=>P.router).filter(Boolean))),v}function aw(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Tc(e,t,n,r,a,i){let s,o;if(a){s=[];for(let l of t)if(s.push(l),l.route.id===a){o=l;break}}else s=t,o=t[t.length-1];let u=xu(r||".",yu(s),er(e.pathname,n)||e.pathname,i==="path");if(r==null&&(u.search=e.search,u.hash=e.hash),(r==null||r===""||r===".")&&o){let l=fd(u.search);if(o.route.index&&!l)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!o.route.index&&l){let p=new URLSearchParams(u.search),d=p.getAll("index");p.delete("index"),d.filter(m=>m).forEach(m=>p.append("index",m));let f=p.toString();u.search=f?`?${f}`:""}}return n!=="/"&&(u.pathname=jv({basename:n,pathname:u.pathname})),br(u)}function wb(e,t,n){if(!n||!aw(n))return{path:t};if(n.formMethod&&!Aw(n.formMethod))return{path:t,error:Zn(405,{method:n.formMethod})};let r=()=>({path:t,error:Zn(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),s=Cx(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!An(i))return r();let d=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[m,b])=>`${f}${m}=${b}
3
3
  `,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:void 0,text:d}}}else if(n.formEncType==="application/json"){if(!An(i))return r();try{let d=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:d,text:void 0}}}catch{return r()}}}Je(typeof FormData=="function","FormData is not available in this environment");let o,u;if(n.formData)o=vc(n.formData),u=n.formData;else if(n.body instanceof FormData)o=vc(n.body),u=n.body;else if(n.body instanceof URLSearchParams)o=n.body,u=Db(o);else if(n.body==null)o=new URLSearchParams,u=new FormData;else try{o=new URLSearchParams(n.body),u=Db(o)}catch{return r()}let l={formMethod:i,formAction:s,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(An(l.formMethod))return{path:t,submission:l};let p=Kr(t);return e&&p.search&&fd(p.search)&&o.append("index",""),p.search=`?${o}`,{path:br(p),submission:l}}function _b(e,t,n,r,a,i,s,o,u,l,p,d,f,m,b,E,y,x,w,T,I){let R=T?$n(T[1])?T[1].error:T[1].data:void 0,v=a.createURL(i.location),A=a.createURL(u),N;if(p&&i.errors){let V=Object.keys(i.errors)[0];N=s.findIndex(ie=>ie.route.id===V)}else if(T&&$n(T[1])){let V=T[0];N=s.findIndex(ie=>ie.route.id===V)-1}let F=T?T[1].statusCode:void 0,_=F&&F>=400,M={currentUrl:v,currentParams:i.matches[0]?.params||{},nextUrl:A,nextParams:s[0].params,...o,actionResult:R,actionStatus:F},j=ws(s),H=s.map((V,ie)=>{let{route:X}=V,re=null;if(N!=null&&ie>N?re=!1:X.lazy?re=!0:dd(X)?p?re=Sc(X,i.loaderData,i.errors):iw(i.loaderData,i.matches[ie],V)&&(re=!0):re=!1,re!==null)return Ac(n,r,e,j,V,l,t,re);let ue=!1;typeof I=="boolean"?ue=I:_?ue=!1:(d||v.pathname+v.search===A.pathname+A.search||v.search!==A.search||sw(i.matches[ie],V))&&(ue=!0);let k={...M,defaultShouldRevalidate:ue},Y=Gi(V,k);return Ac(n,r,e,j,V,l,t,Y,k,I)}),Z=[];return b.forEach((V,ie)=>{if(p||!s.some(ke=>ke.route.id===V.routeId)||m.has(ie))return;let X=i.fetchers.get(ie),re=X&&X.state!=="idle"&&X.data===void 0,ue=Hr(y,V.path,x);if(!ue){if(w&&re)return;Z.push({key:ie,routeId:V.routeId,path:V.path,matches:null,match:null,request:null,controller:null});return}if(E.has(ie))return;let k=Ao(ue,V.path),Y=new AbortController,le=Ra(a,V.path,Y.signal),D=null;if(f.has(ie))f.delete(ie),D=$a(n,r,le,ue,k,l,t);else if(re)d&&(D=$a(n,r,le,ue,k,l,t));else{let ke;typeof I=="boolean"?ke=I:_?ke=!1:ke=d;let Le={...M,defaultShouldRevalidate:ke};Gi(k,Le)&&(D=$a(n,r,le,ue,k,l,t,Le))}D&&Z.push({key:ie,routeId:V.routeId,path:V.path,matches:D,match:k,request:le,controller:Y})}),{dsMatches:H,revalidatingFetchers:Z}}function dd(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Sc(e,t,n){if(e.lazy)return!0;if(!dd(e))return!1;let r=t!=null&&e.id in t,a=n!=null&&n[e.id]!==void 0;return!r&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!a}function iw(e,t,n){let r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a}function sw(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Gi(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Nb(e,t,n,r,a,i){let s;if(e){let l=r[e];Je(l,`No route found to patch children into: routeId = ${e}`),l.children||(l.children=[]),s=l.children}else s=n;let o=[],u=[];if(t.forEach(l=>{let p=s.find(d=>Ax(l,d));p?u.push({existingRoute:p,newRoute:l}):o.push(l)}),o.length>0){let l=us(o,a,[e||"_","patch",String(s?.length||"0")],r);s.push(...l)}if(i&&u.length>0)for(let l=0;l<u.length;l++){let{existingRoute:p,newRoute:d}=u[l],f=p,[m]=us([d],a,[],{},!0);Object.assign(f,{element:m.element?m.element:f.element,errorElement:m.errorElement?m.errorElement:f.errorElement,hydrateFallbackElement:m.hydrateFallbackElement?m.hydrateFallbackElement:f.hydrateFallbackElement})}}function Ax(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>t.children?.some(a=>Ax(n,a))):!1}var Cb=new WeakMap,vx=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let a=n[t.id];if(Je(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let i=a.lazy[e];if(!i)return;let s=Cb.get(a);s||(s={},Cb.set(a,s));let o=s[e];if(o)return o;let u=(async()=>{let l=Av(e),d=a[e]!==void 0&&e!=="hasErrorBoundary";if(l)Bt(!l,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),s[e]=Promise.resolve();else if(d)Bt(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let f=await i();f!=null&&(Object.assign(a,{[e]:f}),Object.assign(a,r(a)))}typeof a.lazy=="object"&&(a.lazy[e]=void 0,Object.values(a.lazy).every(f=>f===void 0)&&(a.lazy=void 0))})();return s[e]=u,u},Ib=new WeakMap;function ow(e,t,n,r,a){let i=n[e.id];if(Je(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=Ib.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let d=(async()=>{Je(typeof e.lazy=="function","No lazy route function found");let f=await e.lazy(),m={};for(let b in f){let E=f[b];if(E===void 0)continue;let y=wv(b),w=i[b]!==void 0&&b!=="hasErrorBoundary";y?Bt(!y,"Route property "+b+" is not a supported property to be returned from a lazy route function. This property will be ignored."):w?Bt(!w,`Route "${i.id}" has a static property "${b}" defined but its lazy function is also returning a value for this property. The lazy route property "${b}" will be ignored.`):m[b]=E}Object.assign(i,m),Object.assign(i,{...r(i),lazy:void 0})})();return Ib.set(i,d),d.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:d}}let s=Object.keys(e.lazy),o=[],u;for(let p of s){if(a&&a.includes(p))continue;let d=vx({key:p,route:e,manifest:n,mapRouteProperties:r});d&&(o.push(d),p===t&&(u=d))}let l=o.length>0?Promise.all(o).then(()=>{}):void 0;return l?.catch(()=>{}),u?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:u}}async function kb(e){let t=e.matches.filter(a=>a.shouldLoad),n={};return(await Promise.all(t.map(a=>a.resolve()))).forEach((a,i)=>{n[t[i].route.id]=a}),n}async function uw(e){return e.matches.some(t=>t.route.middleware)?wx(e,()=>kb(e)):kb(e)}function wx(e,t){return lw(e,t,r=>{if(Sw(r))throw r;return r},Ew,n);function n(r,a,i){if(i)return Promise.resolve(Object.assign(i.value,{[a]:{type:"error",result:r}}));{let{matches:s}=e,o=Math.min(Math.max(s.findIndex(l=>l.route.id===a),0),Math.max(s.findIndex(l=>l.shouldCallHandler()),0)),u=Gr(s,s[o].route.id).route.id;return Promise.resolve({[u]:{type:"error",result:r}})}}}async function lw(e,t,n,r,a){let{matches:i,request:s,params:o,context:u,unstable_pattern:l}=e,p=i.flatMap(f=>f.route.middleware?f.route.middleware.map(m=>[f.route.id,m]):[]);return await _x({request:s,params:o,context:u,unstable_pattern:l},p,t,n,r,a)}async function _x(e,t,n,r,a,i,s=0){let{request:o}=e;if(o.signal.aborted)throw o.signal.reason??new Error(`Request aborted: ${o.method} ${o.url}`);let u=t[s];if(!u)return await n();let[l,p]=u,d,f=async()=>{if(d)throw new Error("You may only call `next()` once per middleware");try{return d={value:await _x(e,t,n,r,a,i,s+1)},d.value}catch(m){return d={value:await i(m,l,d)},d.value}};try{let m=await p(e,f),b=m!=null?r(m):void 0;return a(b)?b:d?b??d.value:(d={value:await f()},d.value)}catch(m){return await i(m,l,d)}}function Nx(e,t,n,r,a){let i=vx({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),s=ow(r.route,An(n.method)?"action":"loader",t,e,a);return{middleware:i,route:s.lazyRoutePromise,handler:s.lazyHandlerPromise}}function Ac(e,t,n,r,a,i,s,o,u=null,l){let p=!1,d=Nx(e,t,n,a,i);return{...a,_lazyPromises:d,shouldLoad:o,shouldRevalidateArgs:u,shouldCallHandler(f){return p=!0,u?typeof l=="boolean"?Gi(a,{...u,defaultShouldRevalidate:l}):typeof f=="boolean"?Gi(a,{...u,defaultShouldRevalidate:f}):Gi(a,u):o},resolve(f){let{lazy:m,loader:b,middleware:E}=a.route,y=p||o||f&&!An(n.method)&&(m||b),x=E&&E.length>0&&!b&&!m;return y&&(An(n.method)||!x)?dw({request:n,unstable_pattern:r,match:a,lazyHandlerPromise:d?.handler,lazyRoutePromise:d?.route,handlerOverride:f,scopedContext:s}):Promise.resolve({type:"data",result:void 0})}}}function $a(e,t,n,r,a,i,s,o=null){return r.map(u=>u.route.id!==a.route.id?{...u,shouldLoad:!1,shouldRevalidateArgs:o,shouldCallHandler:()=>!1,_lazyPromises:Nx(e,t,n,u,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Ac(e,t,n,ws(r),u,i,s,!0,o))}async function cw(e,t,n,r,a,i){n.some(l=>l._lazyPromises?.middleware)&&await Promise.all(n.map(l=>l._lazyPromises?.middleware));let s={request:t,unstable_pattern:ws(n),params:n[0].params,context:a,matches:n},u=await e({...s,fetcherKey:r,runClientMiddleware:l=>{let p=s;return wx(p,()=>l({...p,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(l=>[l._lazyPromises?.handler,l._lazyPromises?.route]))}catch{}return u}async function dw({request:e,unstable_pattern:t,match:n,lazyHandlerPromise:r,lazyRoutePromise:a,handlerOverride:i,scopedContext:s}){let o,u,l=An(e.method),p=l?"action":"loader",d=f=>{let m,b=new Promise((x,w)=>m=w);u=()=>m(),e.signal.addEventListener("abort",u);let E=x=>typeof f!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${p}" [routeId: ${n.route.id}]`)):f({request:e,unstable_pattern:t,params:n.params,context:s},...x!==void 0?[x]:[]),y=(async()=>{try{return{type:"data",result:await(i?i(w=>E(w)):E())}}catch(x){return{type:"error",result:x}}})();return Promise.race([y,b])};try{let f=l?n.route.action:n.route.loader;if(r||a)if(f){let m,[b]=await Promise.all([d(f).catch(E=>{m=E}),r,a]);if(m!==void 0)throw m;o=b}else{await r;let m=l?n.route.action:n.route.loader;if(m)[o]=await Promise.all([d(m),a]);else if(p==="action"){let b=new URL(e.url),E=b.pathname+b.search;throw Zn(405,{method:e.method,pathname:E,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(f)o=await d(f);else{let m=new URL(e.url),b=m.pathname+m.search;throw Zn(404,{pathname:b})}}catch(f){return{type:"error",result:f}}finally{u&&e.signal.removeEventListener("abort",u)}return o}async function pw(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function fw(e){let{result:t,type:n}=e;if(pd(t)){let r;try{r=await pw(t)}catch(a){return{type:"error",error:a}}return n==="error"?{type:"error",error:new vs(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?Mb(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:bw(t),statusCode:ls(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:ls(t)?t.status:void 0}:Mb(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function mw(e,t,n,r,a){let i=e.headers.get("Location");if(Je(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Eu(i)){let s=r.slice(0,r.findIndex(o=>o.route.id===n)+1);i=Tc(new URL(t.url),s,a,i),e.headers.set("Location",i)}return e}function Rb(e,t,n){if(Eu(e)){let r=e,a=r.startsWith("//")?new URL(t.protocol+r):new URL(r),i=er(a.pathname,n)!=null;if(a.origin===t.origin&&i)return a.pathname+a.search+a.hash}return e}function Ra(e,t,n,r){let a=e.createURL(Cx(t)).toString(),i={signal:n};if(r&&An(r.formMethod)){let{formMethod:s,formEncType:o}=r;i.method=s.toUpperCase(),o==="application/json"?(i.headers=new Headers({"Content-Type":o}),i.body=JSON.stringify(r.json)):o==="text/plain"?i.body=r.text:o==="application/x-www-form-urlencoded"&&r.formData?i.body=vc(r.formData):i.body=r.formData}return new Request(a,i)}function vc(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Db(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function hw(e,t,n,r=!1,a=!1){let i={},s=null,o,u=!1,l={},p=n&&$n(n[1])?n[1].error:void 0;return e.forEach(d=>{if(!(d.route.id in t))return;let f=d.route.id,m=t[f];if(Je(!ra(m),"Cannot handle redirect results in processLoaderData"),$n(m)){let b=m.error;if(p!==void 0&&(b=p,p=void 0),s=s||{},a)s[f]=b;else{let E=Gr(e,f);s[E.route.id]==null&&(s[E.route.id]=b)}r||(i[f]=Sx),u||(u=!0,o=ls(m.error)?m.error.status:500),m.headers&&(l[f]=m.headers)}else i[f]=m.data,m.statusCode&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(l[f]=m.headers)}),p!==void 0&&n&&(s={[n[0]]:p},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:s,statusCode:o||200,loaderHeaders:l}}function Ob(e,t,n,r,a,i){let{loaderData:s,errors:o}=hw(t,n,r);return a.filter(u=>!u.matches||u.matches.some(l=>l.shouldLoad)).forEach(u=>{let{key:l,match:p,controller:d}=u;if(d&&d.signal.aborted)return;let f=i[l];if(Je(f,"Did not find corresponding fetcher result"),$n(f)){let m=Gr(e.matches,p?.route.id);o&&o[m.route.id]||(o={...o,[m.route.id]:f.error}),e.fetchers.delete(l)}else if(ra(f))Je(!1,"Unhandled fetcher revalidation redirect");else{let m=vr(f.data);e.fetchers.set(l,m)}}),{loaderData:s,errors:o}}function Lb(e,t,n,r){let a=Object.entries(t).filter(([,i])=>i!==Sx).reduce((i,[s,o])=>(i[s]=o,i),{});for(let i of n){let s=i.route.id;if(!t.hasOwnProperty(s)&&e.hasOwnProperty(s)&&i.route.loader&&(a[s]=e[s]),r&&r.hasOwnProperty(s))break}return a}function Fb(e){return e?$n(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Gr(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Xs(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Zn(e,{pathname:t,routeId:n,method:r,type:a,message:i}={}){let s="Unknown Server Error",o="Unknown @remix-run/router error";return e===400?(s="Bad Request",r&&t&&n?o=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:a==="invalid-body"&&(o="Unable to encode submission body")):e===403?(s="Forbidden",o=`Route "${n}" does not match URL "${t}"`):e===404?(s="Not Found",o=`No route matches URL "${t}"`):e===405&&(s="Method Not Allowed",r&&t&&n?o=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(o=`Invalid request method "${r.toUpperCase()}"`)),new vs(e||500,s,new Error(o),!0)}function Qs(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(ra(a))return{key:r,result:a}}}function Cx(e){let t=typeof e=="string"?Kr(e):e;return br({...t,hash:""})}function gw(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function bw(e){return new vs(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function Ew(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&yw(n))}function yw(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function xw(e){return pd(e.result)&&xx.has(e.result.status)}function $n(e){return e.type==="error"}function ra(e){return(e&&e.type)==="redirect"}function Mb(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function pd(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Tw(e){return xx.has(e)}function Sw(e){return pd(e)&&Tw(e.status)&&e.headers.has("Location")}function Aw(e){return Jv.has(e.toUpperCase())}function An(e){return Xv.has(e.toUpperCase())}function fd(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Ao(e,t){let n=typeof t=="string"?Kr(t).search:t.search;if(e[e.length-1].route.index&&fd(n||""))return e[e.length-1];let r=hx(e);return r[r.length-1]}function Pb(e){let{formMethod:t,formAction:n,formEncType:r,text:a,formData:i,json:s}=e;if(!(!t||!n||!r)){if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function Tl(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function vw(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function wi(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ww(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function vr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function _w(e,t){try{let n=e.sessionStorage.getItem(Tx);if(n){let r=JSON.parse(n);for(let[a,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function Nw(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(Tx,JSON.stringify(n))}catch(r){Bt(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function Bb(){let e,t,n=new Promise((r,a)=>{e=async i=>{r(i);try{await n}catch{}},t=async i=>{a(i);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var fa=g.createContext(null);fa.displayName="DataRouter";var _s=g.createContext(null);_s.displayName="DataRouterState";var Ix=g.createContext(!1);function Cw(){return g.useContext(Ix)}var md=g.createContext({isTransitioning:!1});md.displayName="ViewTransition";var kx=g.createContext(new Map);kx.displayName="Fetchers";var Iw=g.createContext(null);Iw.displayName="Await";var Gn=g.createContext(null);Gn.displayName="Navigation";var Tu=g.createContext(null);Tu.displayName="Location";var sr=g.createContext({outlet:null,matches:[],isDataRoute:!1});sr.displayName="Route";var hd=g.createContext(null);hd.displayName="RouteError";var Rx="REACT_ROUTER_ERROR",kw="REDIRECT",Rw="ROUTE_ERROR_RESPONSE";function Dw(e){if(e.startsWith(`${Rx}:${kw}:{`))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 Ow(e){if(e.startsWith(`${Rx}:${Rw}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new vs(t.status,t.statusText,t.data)}catch{}}function Lw(e,{relative:t}={}){Je(ni(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=g.useContext(Gn),{hash:a,pathname:i,search:s}=Ns(e,{relative:t}),o=i;return n!=="/"&&(o=i==="/"?n:gr([n,i])),r.createHref({pathname:o,search:s,hash:a})}function ni(){return g.useContext(Tu)!=null}function tr(){return Je(ni(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Tu).location}var Dx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ox(e){g.useContext(Gn).static||g.useLayoutEffect(e)}function Su(){let{isDataRoute:e}=g.useContext(sr);return e?Zw():Fw()}function Fw(){Je(ni(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(fa),{basename:t,navigator:n}=g.useContext(Gn),{matches:r}=g.useContext(sr),{pathname:a}=tr(),i=JSON.stringify(yu(r)),s=g.useRef(!1);return Ox(()=>{s.current=!0}),g.useCallback((u,l={})=>{if(Bt(s.current,Dx),!s.current)return;if(typeof u=="number"){n.go(u);return}let p=xu(u,JSON.parse(i),a,l.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:gr([t,p.pathname])),(l.replace?n.replace:n.push)(p,l.state,l)},[t,n,i,a,e])}var Mw=g.createContext(null);function Pw(e){let t=g.useContext(sr).outlet;return g.useMemo(()=>t&&g.createElement(Mw.Provider,{value:e},t),[t,e])}function Ns(e,{relative:t}={}){let{matches:n}=g.useContext(sr),{pathname:r}=tr(),a=JSON.stringify(yu(n));return g.useMemo(()=>xu(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function Bw(e,t,n,r,a){Je(ni(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=g.useContext(Gn),{matches:s}=g.useContext(sr),o=s[s.length-1],u=o?o.params:{},l=o?o.pathname:"/",p=o?o.pathnameBase:"/",d=o&&o.route;{let w=d&&d.path||"";Fx(l,!d||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${w}">) 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.
4
4
 
5
5
  Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let f=tr(),m;m=f;let b=m.pathname||"/",E=b;if(p!=="/"){let w=p.replace(/^\//,"").split("/");E="/"+b.replace(/^\//,"").split("/").slice(w.length).join("/")}let y=Hr(e,{pathname:E});return Bt(d||y!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Bt(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 "${m.pathname}${m.search}${m.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.`),Hw(y&&y.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:gr([p,i.encodeLocation?i.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?p:gr([p,i.encodeLocation?i.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,n,r,a)}function Uw(){let e=Yw(),t=ls(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:i},"ErrorBoundary")," or"," ",g.createElement("code",{style:i},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:a},n):null,s)}var jw=g.createElement(Uw,null),Lx=class extends g.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=Ow(e.digest);n&&(e=n)}let t=e!==void 0?g.createElement(sr.Provider,{value:this.props.routeContext},g.createElement(hd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement($w,{error:e},t):t}};Lx.contextType=Ix;var Sl=new WeakMap;function $w({children:e,error:t}){let{basename:n}=g.useContext(Gn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Dw(t.digest);if(r){let a=Sl.get(t);if(a)throw a;let i=bx(r.location,n);if(gx&&!Sl.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Sl.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function zw({routeContext:e,match:t,children:n}){let r=g.useContext(fa);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(sr.Provider,{value:e},n)}function Hw(e,t=[],n=null,r=null,a=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,s=n?.errors;if(s!=null){let p=i.findIndex(d=>d.route.id&&s?.[d.route.id]!==void 0);Je(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,p+1))}let o=!1,u=-1;if(n)for(let p=0;p<i.length;p++){let d=i[p];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=p),d.route.id){let{loaderData:f,errors:m}=n,b=d.route.loader&&!f.hasOwnProperty(d.route.id)&&(!m||m[d.route.id]===void 0);if(d.route.lazy||b){o=!0,u>=0?i=i.slice(0,u+1):i=[i[0]];break}}}let l=n&&r?(p,d)=>{r(p,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:ws(n.matches),errorInfo:d})}:void 0;return i.reduceRight((p,d,f)=>{let m,b=!1,E=null,y=null;n&&(m=s&&d.route.id?s[d.route.id]:void 0,E=d.route.errorElement||jw,o&&(u<0&&f===0?(Fx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,y=null):u===f&&(b=!0,y=d.route.hydrateFallbackElement||null)));let x=t.concat(i.slice(0,f+1)),w=()=>{let T;return m?T=E:b?T=y:d.route.Component?T=g.createElement(d.route.Component,null):d.route.element?T=d.route.element:T=p,g.createElement(zw,{match:d,routeContext:{outlet:p,matches:x,isDataRoute:n!=null},children:T})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?g.createElement(Lx,{location:n.location,revalidation:n.revalidation,component:E,error:m,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:l}):w()},null)}function gd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Gw(e){let t=g.useContext(fa);return Je(t,gd(e)),t}function Ww(e){let t=g.useContext(_s);return Je(t,gd(e)),t}function Vw(e){let t=g.useContext(sr);return Je(t,gd(e)),t}function bd(e){let t=Vw(e),n=t.matches[t.matches.length-1];return Je(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function qw(){return bd("useRouteId")}function Yw(){let e=g.useContext(hd),t=Ww("useRouteError"),n=bd("useRouteError");return e!==void 0?e:t.errors?.[n]}function Zw(){let{router:e}=Gw("useNavigate"),t=bd("useNavigate"),n=g.useRef(!1);return Ox(()=>{n.current=!0}),g.useCallback(async(a,i={})=>{Bt(n.current,Dx),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var Ub={};function Fx(e,t,n){!t&&!Ub[e]&&(Ub[e]=!0,Bt(!1,n))}var jb={};function $b(e,t){!e&&!jb[t]&&(jb[t]=!0,console.warn(t))}var Kw="useOptimistic",zb=fv[Kw],Xw=()=>{};function Qw(e){return zb?zb(e):[e,Xw]}function Jw(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Bt(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:g.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Bt(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:g.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Bt(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:g.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var e_=["HydrateFallback","hydrateFallbackElement"],t_=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function n_({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=Cw()||r;let[i,s]=g.useState(e.state),[o,u]=Qw(i),[l,p]=g.useState(),[d,f]=g.useState({isTransitioning:!1}),[m,b]=g.useState(),[E,y]=g.useState(),[x,w]=g.useState(),T=g.useRef(new Map),I=g.useCallback((N,{deletedFetchers:F,newErrors:_,flushSync:M,viewTransitionOpts:j})=>{_&&n&&Object.values(_).forEach(Z=>n(Z,{location:N.location,params:N.matches[0]?.params??{},unstable_pattern:ws(N.matches)})),N.fetchers.forEach((Z,V)=>{Z.data!==void 0&&T.current.set(V,Z.data)}),F.forEach(Z=>T.current.delete(Z)),$b(M===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let H=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if($b(j==null||H,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!j||!H){t&&M?t(()=>s(N)):r===!1?s(N):g.startTransition(()=>{r===!0&&u(Z=>Hb(Z,N)),s(N)});return}if(t&&M){t(()=>{E&&(m?.resolve(),E.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:j.currentLocation,nextLocation:j.nextLocation})});let Z=e.window.document.startViewTransition(()=>{t(()=>s(N))});Z.finished.finally(()=>{t(()=>{b(void 0),y(void 0),p(void 0),f({isTransitioning:!1})})}),t(()=>y(Z));return}E?(m?.resolve(),E.skipTransition(),w({state:N,currentLocation:j.currentLocation,nextLocation:j.nextLocation})):(p(N),f({isTransitioning:!0,flushSync:!1,currentLocation:j.currentLocation,nextLocation:j.nextLocation}))},[e.window,t,E,m,r,u,n]);g.useLayoutEffect(()=>e.subscribe(I),[e,I]),g.useEffect(()=>{d.isTransitioning&&!d.flushSync&&b(new t_)},[d]),g.useEffect(()=>{if(m&&l&&e.window){let N=l,F=m.promise,_=e.window.document.startViewTransition(async()=>{r===!1?s(N):g.startTransition(()=>{r===!0&&u(M=>Hb(M,N)),s(N)}),await F});_.finished.finally(()=>{b(void 0),y(void 0),p(void 0),f({isTransitioning:!1})}),y(_)}},[l,m,e.window,r,u]),g.useEffect(()=>{m&&l&&o.location.key===l.location.key&&m.resolve()},[m,E,o.location,l]),g.useEffect(()=>{!d.isTransitioning&&x&&(p(x.state),f({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),w(void 0))},[d.isTransitioning,x]);let R=g.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:N=>e.navigate(N),push:(N,F,_)=>e.navigate(N,{state:F,preventScrollReset:_?.preventScrollReset}),replace:(N,F,_)=>e.navigate(N,{replace:!0,state:F,preventScrollReset:_?.preventScrollReset})}),[e]),v=e.basename||"/",A=g.useMemo(()=>({router:e,navigator:R,static:!1,basename:v,onError:n}),[e,R,v,n]);return g.createElement(g.Fragment,null,g.createElement(fa.Provider,{value:A},g.createElement(_s.Provider,{value:o},g.createElement(kx.Provider,{value:T.current},g.createElement(md.Provider,{value:d},g.createElement(s_,{basename:v,location:o.location,navigationType:o.historyAction,navigator:R,unstable_useTransitions:r},g.createElement(r_,{routes:e.routes,future:e.future,state:o,onError:n})))))),null)}function Hb(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var r_=g.memo(a_);function a_({routes:e,future:t,state:n,onError:r}){return Bw(e,void 0,n,r,t)}function Gb({to:e,replace:t,state:n,relative:r}){Je(ni(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=g.useContext(Gn);Bt(!a,"<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:i}=g.useContext(sr),{pathname:s}=tr(),o=Su(),u=xu(e,yu(i),s,r==="path"),l=JSON.stringify(u);return g.useEffect(()=>{o(JSON.parse(l),{replace:t,state:n,relative:r})},[o,l,r,t,n]),null}function i_(e){return Pw(e.context)}function s_({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,unstable_useTransitions:s}){Je(!ni(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:o,navigator:a,static:i,unstable_useTransitions:s,future:{}}),[o,a,i,s]);typeof n=="string"&&(n=Kr(n));let{pathname:l="/",search:p="",hash:d="",state:f=null,key:m="default"}=n,b=g.useMemo(()=>{let E=er(l,o);return E==null?null:{location:{pathname:E,search:p,hash:d,state:f,key:m},navigationType:r}},[o,l,p,d,f,m,r]);return Bt(b!=null,`<Router basename="${o}"> is not able to match the URL "${l}${p}${d}" because it does not start with the basename, so the <Router> won't render anything.`),b==null?null:g.createElement(Gn.Provider,{value:u},g.createElement(Tu.Provider,{children:t,value:b}))}var vo="get",wo="application/x-www-form-urlencoded";function Au(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function o_(e){return Au(e)&&e.tagName.toLowerCase()==="button"}function u_(e){return Au(e)&&e.tagName.toLowerCase()==="form"}function l_(e){return Au(e)&&e.tagName.toLowerCase()==="input"}function c_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function d_(e,t){return e.button===0&&(!t||t==="_self")&&!c_(e)}function wc(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function p_(e,t){let n=wc(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}var Js=null;function f_(){if(Js===null)try{new FormData(document.createElement("form"),0),Js=!1}catch{Js=!0}return Js}var m_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Al(e){return e!=null&&!m_.has(e)?(Bt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wo}"`),null):e}function h_(e,t){let n,r,a,i,s;if(u_(e)){let o=e.getAttribute("action");r=o?er(o,t):null,n=e.getAttribute("method")||vo,a=Al(e.getAttribute("enctype"))||wo,i=new FormData(e)}else if(o_(e)||l_(e)&&(e.type==="submit"||e.type==="image")){let o=e.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||o.getAttribute("action");if(r=u?er(u,t):null,n=e.getAttribute("formmethod")||o.getAttribute("method")||vo,a=Al(e.getAttribute("formenctype"))||Al(o.getAttribute("enctype"))||wo,i=new FormData(o,e),!f_()){let{name:l,type:p,value:d}=e;if(p==="image"){let f=l?`${l}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else l&&i.append(l,d)}}else{if(Au(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=vo,r=null,a=wo,s=e}return i&&a==="text/plain"&&(s=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ed(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function g_(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&er(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function b_(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 E_(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 y_(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let s=await b_(i,n);return s.links?s.links():[]}return[]}));return A_(r.flat(1).filter(E_).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Wb(e,t,n,r,a,i){let s=(u,l)=>n[l]?u.route.id!==n[l].route.id:!0,o=(u,l)=>n[l].pathname!==u.pathname||n[l].route.path?.endsWith("*")&&n[l].params["*"]!==u.params["*"];return i==="assets"?t.filter((u,l)=>s(u,l)||o(u,l)):i==="data"?t.filter((u,l)=>{let p=r.routes[u.route.id];if(!p||!p.hasLoader)return!1;if(s(u,l)||o(u,l))return!0;if(u.route.shouldRevalidate){let d=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function x_(e,t,{includeHydrateFallback:n}={}){return T_(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function T_(e){return[...new Set(e)]}function S_(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function A_(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(S_(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function Mx(){let e=g.useContext(fa);return Ed(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function v_(){let e=g.useContext(_s);return Ed(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var yd=g.createContext(void 0);yd.displayName="FrameworkContext";function Px(){let e=g.useContext(yd);return Ed(e,"You must render this element inside a <HydratedRouter> element"),e}function w_(e,t){let n=g.useContext(yd),[r,a]=g.useState(!1),[i,s]=g.useState(!1),{onFocus:o,onBlur:u,onMouseEnter:l,onMouseLeave:p,onTouchStart:d}=t,f=g.useRef(null);g.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let E=x=>{x.forEach(w=>{s(w.isIntersecting)})},y=new IntersectionObserver(E,{threshold:.5});return f.current&&y.observe(f.current),()=>{y.disconnect()}}},[e]),g.useEffect(()=>{if(r){let E=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(E)}}},[r]);let m=()=>{a(!0)},b=()=>{a(!1),s(!1)};return n?e!=="intent"?[i,f,{}]:[i,f,{onFocus:_i(o,m),onBlur:_i(u,b),onMouseEnter:_i(l,m),onMouseLeave:_i(p,b),onTouchStart:_i(d,m)}]:[!1,f,{}]}function _i(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function __({page:e,...t}){let{router:n}=Mx(),r=g.useMemo(()=>Hr(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?g.createElement(C_,{page:e,matches:r,...t}):null}function N_(e){let{manifest:t,routeModules:n}=Px(),[r,a]=g.useState([]);return g.useEffect(()=>{let i=!1;return y_(e,t,n).then(s=>{i||a(s)}),()=>{i=!0}},[e,t,n]),r}function C_({page:e,matches:t,...n}){let r=tr(),{manifest:a,routeModules:i}=Px(),{basename:s}=Mx(),{loaderData:o,matches:u}=v_(),l=g.useMemo(()=>Wb(e,t,u,a,r,"data"),[e,t,u,a,r]),p=g.useMemo(()=>Wb(e,t,u,a,r,"assets"),[e,t,u,a,r]),d=g.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let b=new Set,E=!1;if(t.forEach(x=>{let w=a.routes[x.route.id];!w||!w.hasLoader||(!l.some(T=>T.route.id===x.route.id)&&x.route.id in o&&i[x.route.id]?.shouldRevalidate||w.hasClientLoader?E=!0:b.add(x.route.id))}),b.size===0)return[];let y=g_(e,s,"data");return E&&b.size>0&&y.searchParams.set("_routes",t.filter(x=>b.has(x.route.id)).map(x=>x.route.id).join(",")),[y.pathname+y.search]},[s,o,r,a,l,t,e,i]),f=g.useMemo(()=>x_(p,a),[p,a]),m=N_(p);return g.createElement(g.Fragment,null,d.map(b=>g.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),f.map(b=>g.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),m.map(({key:b,link:E})=>g.createElement("link",{key:b,nonce:n.nonce,...E})))}function I_(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var k_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{k_&&(window.__reactRouterVersion="7.11.0")}catch{}function R_(e,t){return rw({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:yv({window:t?.window}),hydrationData:D_(),routes:e,mapRouteProperties:Jw,hydrationRouteProperties:e_,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function D_(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:O_(e.errors)}),e}function O_(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,a]of t)if(a&&a.__type==="RouteErrorResponse")n[r]=new vs(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let s=new i(a.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(a.message);i.stack="",n[r]=i}}else n[r]=a;return n}var Bx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ux=g.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:i,replace:s,state:o,target:u,to:l,preventScrollReset:p,viewTransition:d,unstable_defaultShouldRevalidate:f,...m},b){let{basename:E,unstable_useTransitions:y}=g.useContext(Gn),x=typeof l=="string"&&Bx.test(l),w=bx(l,E);l=w.to;let T=Lw(l,{relative:a}),[I,R,v]=w_(r,m),A=M_(l,{replace:s,state:o,target:u,preventScrollReset:p,relative:a,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:y});function N(_){t&&t(_),_.defaultPrevented||A(_)}let F=g.createElement("a",{...m,...v,href:w.absoluteURL||T,onClick:w.isExternal||i?t:N,ref:I_(b,R),target:u,"data-discover":!x&&n==="render"?"true":void 0});return I&&!x?g.createElement(g.Fragment,null,F,g.createElement(__,{page:T})):F});Ux.displayName="Link";var jx=g.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:s,viewTransition:o,children:u,...l},p){let d=Ns(s,{relative:l.relative}),f=tr(),m=g.useContext(_s),{navigator:b,basename:E}=g.useContext(Gn),y=m!=null&&z_(d)&&o===!0,x=b.encodeLocation?b.encodeLocation(d).pathname:d.pathname,w=f.pathname,T=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(w=w.toLowerCase(),T=T?T.toLowerCase():null,x=x.toLowerCase()),T&&E&&(T=er(T,E)||T);const I=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let R=w===x||!a&&w.startsWith(x)&&w.charAt(I)==="/",v=T!=null&&(T===x||!a&&T.startsWith(x)&&T.charAt(x.length)==="/"),A={isActive:R,isPending:v,isTransitioning:y},N=R?t:void 0,F;typeof r=="function"?F=r(A):F=[r,R?"active":null,v?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let _=typeof i=="function"?i(A):i;return g.createElement(Ux,{...l,"aria-current":N,className:F,ref:p,style:_,to:s,viewTransition:o},typeof u=="function"?u(A):u)});jx.displayName="NavLink";var L_=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:s=vo,action:o,onSubmit:u,relative:l,preventScrollReset:p,viewTransition:d,unstable_defaultShouldRevalidate:f,...m},b)=>{let{unstable_useTransitions:E}=g.useContext(Gn),y=j_(),x=$_(o,{relative:l}),w=s.toLowerCase()==="get"?"get":"post",T=typeof o=="string"&&Bx.test(o),I=R=>{if(u&&u(R),R.defaultPrevented)return;R.preventDefault();let v=R.nativeEvent.submitter,A=v?.getAttribute("formmethod")||s,N=()=>y(v||R.currentTarget,{fetcherKey:t,method:A,navigate:n,replace:a,state:i,relative:l,preventScrollReset:p,viewTransition:d,unstable_defaultShouldRevalidate:f});E&&n!==!1?g.startTransition(()=>N()):N()};return g.createElement("form",{ref:b,method:w,action:x,onSubmit:r?u:I,...m,"data-discover":!T&&e==="render"?"true":void 0})});L_.displayName="Form";function F_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $x(e){let t=g.useContext(fa);return Je(t,F_(e)),t}function M_(e,{target:t,replace:n,state:r,preventScrollReset:a,relative:i,viewTransition:s,unstable_defaultShouldRevalidate:o,unstable_useTransitions:u}={}){let l=Su(),p=tr(),d=Ns(e,{relative:i});return g.useCallback(f=>{if(d_(f,t)){f.preventDefault();let m=n!==void 0?n:br(p)===br(d),b=()=>l(e,{replace:m,state:r,preventScrollReset:a,relative:i,viewTransition:s,unstable_defaultShouldRevalidate:o});u?g.startTransition(()=>b()):b()}},[p,l,d,n,r,t,e,a,i,s,o,u])}function P_(e){Bt(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=g.useRef(wc(e)),n=g.useRef(!1),r=tr(),a=g.useMemo(()=>p_(r.search,n.current?null:t.current),[r.search]),i=Su(),s=g.useCallback((o,u)=>{const l=wc(typeof o=="function"?o(new URLSearchParams(a)):o);n.current=!0,i("?"+l,u)},[i,a]);return[a,s]}var B_=0,U_=()=>`__${String(++B_)}__`;function j_(){let{router:e}=$x("useSubmit"),{basename:t}=g.useContext(Gn),n=qw(),r=e.fetch,a=e.navigate;return g.useCallback(async(i,s={})=>{let{action:o,method:u,encType:l,formData:p,body:d}=h_(i,t);if(s.navigate===!1){let f=s.fetcherKey||U_();await r(f,n,s.action||o,{unstable_defaultShouldRevalidate:s.unstable_defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:p,body:d,formMethod:s.method||u,formEncType:s.encType||l,flushSync:s.flushSync})}else await a(s.action||o,{unstable_defaultShouldRevalidate:s.unstable_defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:p,body:d,formMethod:s.method||u,formEncType:s.encType||l,replace:s.replace,state:s.state,fromRouteId:n,flushSync:s.flushSync,viewTransition:s.viewTransition})},[r,a,t,n])}function $_(e,{relative:t}={}){let{basename:n}=g.useContext(Gn),r=g.useContext(sr);Je(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...Ns(e||".",{relative:t})},s=tr();if(e==null){i.search=s.search;let o=new URLSearchParams(i.search),u=o.getAll("index");if(u.some(p=>p==="")){o.delete("index"),u.filter(d=>d).forEach(d=>o.append("index",d));let p=o.toString();i.search=p?`?${p}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:gr([n,i.pathname])),br(i)}function z_(e,{relative:t}={}){let n=g.useContext(md);Je(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=$x("useViewTransitionState"),a=Ns(e,{relative:t});if(!n.isTransitioning)return!1;let i=er(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=er(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Mo(a.pathname,s)!=null||Mo(a.pathname,i)!=null}function at(){return at=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},at.apply(null,arguments)}const Cs=(function(e){if(e==null)return V_;if(typeof e=="function")return vu(e);if(typeof e=="object")return Array.isArray(e)?H_(e):G_(e);if(typeof e=="string")return W_(e);throw new Error("Expected function, string, or object as test")});function H_(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Cs(e[n]);return vu(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function G_(e){const t=e;return vu(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function W_(e){return vu(t);function t(n){return n&&n.type===e}}function vu(e){return t;function t(n,r,a){return!!(q_(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function V_(){return!0}function q_(e){return e!==null&&typeof e=="object"&&"type"in e}const zx=[],Y_=!0,Po=!1,Wi="skip";function xd(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=Cs(a),s=r?-1:1;o(e,void 0,[])();function o(u,l,p){const d=u&&typeof u=="object"?u:{};if(typeof d.type=="string"){const m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(u.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=zx,b,E,y;if((!t||i(u,l,p[p.length-1]||void 0))&&(m=Z_(n(u,p)),m[0]===Po))return m;if("children"in u&&u.children){const x=u;if(x.children&&m[0]!==Wi)for(E=(r?x.children.length:-1)+s,y=p.concat(x);E>-1&&E<x.children.length;){const w=x.children[E];if(b=o(w,E,y)(),b[0]===Po)return b;E=typeof b[1]=="number"?b[1]:E+s}}return m}}}function Z_(e){return Array.isArray(e)?e:typeof e=="number"?[Y_,e]:e==null?zx:[e]}function Pn(e,t,n,r){let a,i,s;typeof t=="function"&&typeof n!="function"?(i=void 0,s=t,a=n):(i=t,s=n,a=r),xd(e,i,o,a);function o(u,l){const p=l[l.length-1],d=p?p.children.indexOf(u):void 0;return s(u,d,p)}}function Fa(e){return"children"in e?Hx(e):"value"in e?e.value:""}function K_(e){return e.type==="text"?e.value:"children"in e?Hx(e):""}function Hx(e){let t=-1;const n=[];for(;++t<e.children.length;)n[t]=K_(e.children[t]);return n.join("")}const X_={}.hasOwnProperty;function Q_(e,t,n){const r=Cs(t),a=t&&typeof t=="object"&&"cascade"in t?t.cascade:void 0,i=a??!0;return s(e);function s(o,u,l){const p=[];if(!r(o,u,l))return;if(J_(o)){let m=-1;for(;++m<o.children.length;){const b=s(o.children[m],m,o);b&&p.push(b)}if(i&&o.children.length>0&&p.length===0)return}const d={};let f;for(f in o)X_.call(o,f)&&(d[f]=f==="children"?p:o[f]);return d}}function J_(e){return"children"in e&&e.children!==void 0}var eo={exports:{}},Vb;function eN(){return Vb||(Vb=1,(function(e,t){function n(r){let a=[],i;for(let s of r.split(",").map(o=>o.trim()))if(/^-?\d+$/.test(s))a.push(parseInt(s,10));else if(i=s.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[o,u,l,p]=i;if(u&&p){u=parseInt(u),p=parseInt(p);const d=u<p?1:-1;(l==="-"||l===".."||l==="‥")&&(p+=d);for(let f=u;f!==p;f+=d)a.push(f)}}return a}t.default=n,e.exports=n})(eo,eo.exports)),eo.exports}var tN=eN();const nN=bu(tN);ot.displayName="clike";ot.aliases=[];function ot(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}or.displayName="c";or.aliases=[];function or(e){e.register(ot),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}ma.displayName="cpp";ma.aliases=[];function ma(e){e.register(or),(function(t){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return n.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}wu.displayName="arduino";wu.aliases=["ino"];function wu(e){e.register(ma),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}Is.displayName="bash";Is.aliases=["sh","shell"];function Is(e){(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],s=a.variable[1].inside,o=0;o<i.length;o++)s[i[o]]=t.languages.bash[i[o]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(e)}ha.displayName="csharp";ha.aliases=["cs","dotnet"];function ha(e){e.register(ot),(function(t){function n(k,Y){return k.replace(/<<(\d+)>>/g,function(le,D){return"(?:"+Y[+D]+")"})}function r(k,Y,le){return RegExp(n(k,Y),"")}function a(k,Y){for(var le=0;le<Y;le++)k=k.replace(/<<self>>/g,function(){return"(?:"+k+")"});return k.replace(/<<self>>/g,"[^\\s\\S]")}var i={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function s(k){return"\\b(?:"+k.trim().replace(/ /g,"|")+")\\b"}var o=s(i.typeDeclaration),u=RegExp(s(i.type+" "+i.typeDeclaration+" "+i.contextual+" "+i.other)),l=s(i.typeDeclaration+" "+i.contextual+" "+i.other),p=s(i.type+" "+i.typeDeclaration+" "+i.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),f=a(/\((?:[^()]|<<self>>)*\)/.source,2),m=/@?\b[A-Za-z_]\w*\b/.source,b=n(/<<0>>(?:\s*<<1>>)?/.source,[m,d]),E=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[l,b]),y=/\[\s*(?:,\s*)*\]/.source,x=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[E,y]),w=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,f,y]),T=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[w]),I=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[T,E,y]),R={keyword:u,punctuation:/[<>()?,.:[\]]/},v=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,A=/"(?:\\.|[^\\"\r\n])*"/.source,N=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[N]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[A]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[E]),lookbehind:!0,inside:R},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[m,I]),lookbehind:!0,inside:R},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[m]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,b]),lookbehind:!0,inside:R},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[E]),lookbehind:!0,inside:R},{pattern:r(/(\bwhere\s+)<<0>>/.source,[m]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[x]),lookbehind:!0,inside:R},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[I,p,m]),inside:R}],keyword:u,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[m]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[m]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[f]),lookbehind:!0,alias:"class-name",inside:R},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[I,E]),inside:R,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[I]),lookbehind:!0,inside:R,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[m,d]),inside:{function:r(/^<<0>>/.source,[m]),generic:{pattern:RegExp(d),alias:"class-name",inside:R}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,b,m,I,u.source,f,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[b,f]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:u,"class-name":{pattern:RegExp(I),greedy:!0,inside:R},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var F=A+"|"+v,_=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[F]),M=a(n(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[_]),2),j=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,H=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[E,M]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[j,H]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[j]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[M]),inside:t.languages.csharp},"class-name":{pattern:RegExp(E),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var Z=/:[^}\r\n]+/.source,V=a(n(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[_]),2),ie=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[V,Z]),X=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[F]),2),re=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,Z]);function ue(k,Y){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[k]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[Y,Z]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[ie]),lookbehind:!0,greedy:!0,inside:ue(ie,V)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[re]),lookbehind:!0,greedy:!0,inside:ue(re,X)}],char:{pattern:RegExp(v),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}dn.displayName="markup";dn.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function dn(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&amp;/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:a}};i["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var s={};s[n]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore("markup","cdata",s)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}Xr.displayName="css";Xr.aliases=[];function Xr(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}_u.displayName="diff";_u.aliases=[];function _u(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],i=[];/^\w+$/.test(r)||i.push(/\w+/.exec(r)[0]),r==="diff"&&i.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r
@@ -8,11 +8,11 @@ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}
8
8
  ]))(?:`+(/[^\s\\]/.source+'|[ ]+(?:(?![ "])|'+r+")|"+/\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;])/.source)+")*"),lookbehind:!0,greedy:!0,alias:"attr-value",inside:{comment:n,quoted:{pattern:RegExp(/(^|\s)/.source+r),lookbehind:!0,greedy:!0},punctuation:/\\$/m,boolean:{pattern:/^(?:false|no|off|on|true|yes)$/,greedy:!0}}},punctuation:/=/}})(e)}Bs.displayName="t4-templating";Bs.aliases=[];function Bs(e){(function(t){function n(a,i,s){return{pattern:RegExp("<#"+a+"[\\s\\S]*?#>"),alias:"block",inside:{delimiter:{pattern:RegExp("^<#"+a+"|#>$"),alias:"important"},content:{pattern:/[\s\S]+/,inside:i,alias:s}}}}function r(a){var i=t.languages[a],s="language-"+a;return{block:{pattern:/<#[\s\S]+?#>/,inside:{directive:n("@",{"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/,inside:{punctuation:/^=|^["']|["']$/}},keyword:/\b\w+(?=\s)/,"attr-name":/\b\w+/}),expression:n("=",i,s),"class-feature":n("\\+",i,s),standard:n("",i,s)}}}}t.languages["t4-templating"]=Object.defineProperty({},"createT4",{value:r})})(e)}Rh.displayName="t4-cs";Rh.aliases=["t4"];function Rh(e){e.register(ha),e.register(Bs),e.languages.t4=e.languages["t4-cs"]=e.languages["t4-templating"].createT4("csharp")}Dh.displayName="t4-vb";Dh.aliases=[];function Dh(e){e.register(Bs),e.register(Ls),e.languages["t4-vb"]=e.languages["t4-templating"].createT4("vbnet")}Oh.displayName="tap";Oh.aliases=[];function Oh(e){e.register(Rs),e.languages.tap={fail:/not ok[^#{\n\r]*/,pass:/ok[^#{\n\r]*/,pragma:/pragma [+-][a-z]+/,bailout:/bail out!.*/i,version:/TAP version \d+/i,plan:/\b\d+\.\.\d+(?: +#.*)?/,subtest:{pattern:/# Subtest(?:: .*)?/,greedy:!0},punctuation:/[{}]/,directive:/#.*/,yamlish:{pattern:/(^[ \t]*)---[\s\S]*?[\r\n][ \t]*\.\.\.$/m,lookbehind:!0,inside:e.languages.yaml,alias:"language-yaml"}}}Lh.displayName="tcl";Lh.aliases=[];function Lh(e){e.languages.tcl={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:{pattern:/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"/,greedy:!0},variable:[{pattern:/(\$)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/,lookbehind:!0},{pattern:/(\$)\{[^}]+\}/,lookbehind:!0},{pattern:/(^[\t ]*set[ \t]+)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/m,lookbehind:!0}],function:{pattern:/(^[\t ]*proc[ \t]+)\S+/m,lookbehind:!0},builtin:[{pattern:/(^[\t ]*)(?:break|class|continue|error|eval|exit|for|foreach|if|proc|return|switch|while)\b/m,lookbehind:!0},/\b(?:else|elseif)\b/],scope:{pattern:/(^[\t ]*)(?:global|upvar|variable)\b/m,lookbehind:!0,alias:"constant"},keyword:{pattern:/(^[\t ]*|\[)(?:Safe_Base|Tcl|after|append|apply|array|auto_(?:execok|import|load|mkindex|qualify|reset)|automkindex_old|bgerror|binary|catch|cd|chan|clock|close|concat|dde|dict|encoding|eof|exec|expr|fblocked|fconfigure|fcopy|file(?:event|name)?|flush|gets|glob|history|http|incr|info|interp|join|lappend|lassign|lindex|linsert|list|llength|load|lrange|lrepeat|lreplace|lreverse|lsearch|lset|lsort|math(?:func|op)|memory|msgcat|namespace|open|package|parray|pid|pkg_mkIndex|platform|puts|pwd|re_syntax|read|refchan|regexp|registry|regsub|rename|scan|seek|set|socket|source|split|string|subst|tcl(?:_endOfWord|_findLibrary|startOf(?:Next|Previous)Word|test|vars|wordBreak(?:After|Before))|tell|time|tm|trace|unknown|unload|unset|update|uplevel|vwait)\b/m,lookbehind:!0},operator:/!=?|\*\*?|==|&&?|\|\|?|<[=<]?|>[=>]?|[-+~\/%?^]|\b(?:eq|in|ne|ni)\b/,punctuation:/[{}()\[\]]/}}Fh.displayName="tt2";Fh.aliases=[];function Fh(e){e.register(ot),e.register(yn),(function(t){t.languages.tt2=t.languages.extend("clike",{comment:/#.*|\[%#[\s\S]*?%\]/,keyword:/\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|SWITCH|TAGS|THROW|TRY|UNLESS|USE|WHILE|WRAPPER)\b/,punctuation:/[[\]{},()]/}),t.languages.insertBefore("tt2","number",{operator:/=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|not|or)\b/,variable:{pattern:/\b[a-z]\w*(?:\s*\.\s*(?:\d+|\$?[a-z]\w*))*\b/i}}),t.languages.insertBefore("tt2","keyword",{delimiter:{pattern:/^(?:\[%|%%)-?|-?%\]$/,alias:"punctuation"}}),t.languages.insertBefore("tt2","string",{"single-quoted-string":{pattern:/'[^\\']*(?:\\[\s\S][^\\']*)*'/,greedy:!0,alias:"string"},"double-quoted-string":{pattern:/"[^\\"]*(?:\\[\s\S][^\\"]*)*"/,greedy:!0,alias:"string",inside:{variable:{pattern:/\$(?:[a-z]\w*(?:\.(?:\d+|\$?[a-z]\w*))*)/i}}}}),delete t.languages.tt2.string,t.hooks.add("before-tokenize",function(n){var r=/\[%[\s\S]+?%\]/g;t.languages["markup-templating"].buildPlaceholders(n,"tt2",r)}),t.hooks.add("after-tokenize",function(n){t.languages["markup-templating"].tokenizePlaceholders(n,"tt2")})})(e)}Mh.displayName="toml";Mh.aliases=[];function Mh(e){(function(t){var n=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function r(a){return a.replace(/__/g,function(){return n})}t.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(r(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(r(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}Ph.displayName="tremor";Ph.aliases=["trickle","troy"];function Ph(e){(function(t){t.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},"interpolated-string":null,extractor:{pattern:/\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i,greedy:!0,inside:{regex:{pattern:/(^re)\|[\s\S]+/,lookbehind:!0},function:/^\w+/,value:/\|[\s\S]+/}},identifier:{pattern:/`[^`]*`/,greedy:!0},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:args|as|by|case|config|connect|connector|const|copy|create|default|define|deploy|drop|each|emit|end|erase|event|flow|fn|for|from|group|having|insert|into|intrinsic|let|links|match|merge|mod|move|of|operator|patch|pipeline|recur|script|select|set|sliding|state|stream|to|tumbling|update|use|when|where|window|with)\b/,boolean:/\b(?:false|null|true)\b/i,number:/\b(?:0b[01_]*|0x[0-9a-fA-F_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee][+-]?[\d_]+)?)\b/,"pattern-punctuation":{pattern:/%(?=[({[])/,alias:"punctuation"},operator:/[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?>?=?|(?:absent|and|not|or|present|xor)\b/,punctuation:/::|[;\[\]()\{\},.:]/};var n=/#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*")*\}/.source;t.languages.tremor["interpolated-string"]={pattern:RegExp(/(^|[^\\])/.source+'(?:"""(?:'+/[^"\\#]|\\[\s\S]|"(?!"")|#(?!\{)/.source+"|"+n+')*"""|"(?:'+/[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)/.source+"|"+n+')*")'),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:RegExp(n),inside:{punctuation:/^#\{|\}$/,expression:{pattern:/[\s\S]+/,inside:t.languages.tremor}}},string:/[\s\S]+/}},t.languages.troy=t.languages.tremor,t.languages.trickle=t.languages.tremor})(e)}Bh.displayName="typoscript";Bh.aliases=["tsconfig"];function Bh(e){(function(t){var n=/\b(?:ACT|ACTIFSUB|CARRAY|CASE|CLEARGIF|COA|COA_INT|CONSTANTS|CONTENT|CUR|EDITPANEL|EFFECT|EXT|FILE|FLUIDTEMPLATE|FORM|FRAME|FRAMESET|GIFBUILDER|GMENU|GMENU_FOLDOUT|GMENU_LAYERS|GP|HMENU|HRULER|HTML|IENV|IFSUB|IMAGE|IMGMENU|IMGMENUITEM|IMGTEXT|IMG_RESOURCE|INCLUDE_TYPOSCRIPT|JSMENU|JSMENUITEM|LLL|LOAD_REGISTER|NO|PAGE|RECORDS|RESTORE_REGISTER|TEMPLATE|TEXT|TMENU|TMENUITEM|TMENU_LAYERS|USER|USER_INT|_GIFBUILDER|global|globalString|globalVar)\b/;t.languages.typoscript={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:= \t]|(?:^|[^= \t])[ \t]+)\/\/.*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^"'])#.*/,lookbehind:!0,greedy:!0}],function:[{pattern:/<INCLUDE_TYPOSCRIPT:\s*source\s*=\s*(?:"[^"\r\n]*"|'[^'\r\n]*')\s*>/,inside:{string:{pattern:/"[^"\r\n]*"|'[^'\r\n]*'/,inside:{keyword:n}},keyword:{pattern:/INCLUDE_TYPOSCRIPT/}}},{pattern:/@import\s*(?:"[^"\r\n]*"|'[^'\r\n]*')/,inside:{string:/"[^"\r\n]*"|'[^'\r\n]*'/}}],string:{pattern:/^([^=]*=[< ]?)(?:(?!\]\n).)*/,lookbehind:!0,inside:{function:/\{\$.*\}/,keyword:n,number:/^\d+$/,punctuation:/[,|:]/}},keyword:n,number:{pattern:/\b\d+\s*[.{=]/,inside:{operator:/[.{=]/}},tag:{pattern:/\.?[-\w\\]+\.?/,inside:{punctuation:/\./}},punctuation:/[{}[\];(),.:|]/,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/},t.languages.tsconfig=t.languages.typoscript})(e)}Uh.displayName="unrealscript";Uh.aliases=["uc","uscript"];function Uh(e){e.languages.unrealscript={comment:/\/\/.*|\/\*[\s\S]*?\*\//,string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},category:{pattern:/(\b(?:(?:autoexpand|hide|show)categories|var)\s*\()[^()]+(?=\))/,lookbehind:!0,greedy:!0,alias:"property"},metadata:{pattern:/(\w\s*)<\s*\w+\s*=[^<>|=\r\n]+(?:\|\s*\w+\s*=[^<>|=\r\n]+)*>/,lookbehind:!0,greedy:!0,inside:{property:/\b\w+(?=\s*=)/,operator:/=/,punctuation:/[<>|]/}},macro:{pattern:/`\w+/,alias:"property"},"class-name":{pattern:/(\b(?:class|enum|extends|interface|state(?:\(\))?|struct|within)\s+)\w+/,lookbehind:!0},keyword:/\b(?:abstract|actor|array|auto|autoexpandcategories|bool|break|byte|case|class|classgroup|client|coerce|collapsecategories|config|const|continue|default|defaultproperties|delegate|dependson|deprecated|do|dontcollapsecategories|editconst|editinlinenew|else|enum|event|exec|export|extends|final|float|for|forcescriptorder|foreach|function|goto|guid|hidecategories|hidedropdown|if|ignores|implements|inherits|input|int|interface|iterator|latent|local|material|name|native|nativereplication|noexport|nontransient|noteditinlinenew|notplaceable|operator|optional|out|pawn|perobjectconfig|perobjectlocalized|placeable|postoperator|preoperator|private|protected|reliable|replication|return|server|showcategories|simulated|singular|state|static|string|struct|structdefault|structdefaultproperties|switch|texture|transient|travel|unreliable|until|var|vector|while|within)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,boolean:/\b(?:false|true)\b/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/>>|<<|--|\+\+|\*\*|[-+*/~!=<>$@]=?|&&?|\|\|?|\^\^?|[?:%]|\b(?:ClockwiseFrom|Cross|Dot)\b/,punctuation:/[()[\]{};,.]/},e.languages.uc=e.languages.uscript=e.languages.unrealscript}jh.displayName="uorazor";jh.aliases=[];function jh(e){e.languages.uorazor={"comment-hash":{pattern:/#.*/,alias:"comment",greedy:!0},"comment-slash":{pattern:/\/\/.*/,alias:"comment",greedy:!0},string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,inside:{punctuation:/^['"]|['"]$/},greedy:!0},"source-layers":{pattern:/\b(?:arms|backpack|blue|bracelet|cancel|clear|cloak|criminal|earrings|enemy|facialhair|friend|friendly|gloves|gray|grey|ground|hair|head|innerlegs|innertorso|innocent|lefthand|middletorso|murderer|neck|nonfriendly|onehandedsecondary|outerlegs|outertorso|pants|red|righthand|ring|self|shirt|shoes|talisman|waist)\b/i,alias:"function"},"source-commands":{pattern:/\b(?:alliance|attack|cast|clearall|clearignore|clearjournal|clearlist|clearsysmsg|createlist|createtimer|dclick|dclicktype|dclickvar|dress|dressconfig|drop|droprelloc|emote|getlabel|guild|gumpclose|gumpresponse|hotkey|ignore|lasttarget|lift|lifttype|menu|menuresponse|msg|org|organize|organizer|overhead|pause|poplist|potion|promptresponse|pushlist|removelist|removetimer|rename|restock|say|scav|scavenger|script|setability|setlasttarget|setskill|settimer|setvar|sysmsg|target|targetloc|targetrelloc|targettype|undress|unignore|unsetvar|useobject|useonce|useskill|usetype|virtue|wait|waitforgump|waitformenu|waitforprompt|waitforstat|waitforsysmsg|waitfortarget|walk|wfsysmsg|wft|whisper|yell)\b/,alias:"function"},"tag-name":{pattern:/(^\{%-?\s*)\w+/,lookbehind:!0,alias:"keyword"},delimiter:{pattern:/^\{[{%]-?|-?[%}]\}$/,alias:"punctuation"},function:/\b(?:atlist|close|closest|count|counter|counttype|dead|dex|diffhits|diffmana|diffstam|diffweight|find|findbuff|finddebuff|findlayer|findtype|findtypelist|followers|gumpexists|hidden|hits|hp|hue|human|humanoid|ingump|inlist|insysmessage|insysmsg|int|invul|lhandempty|list|listexists|mana|maxhits|maxhp|maxmana|maxstam|maxweight|monster|mounted|name|next|noto|paralyzed|poisoned|position|prev|previous|queued|rand|random|rhandempty|skill|stam|str|targetexists|timer|timerexists|varexist|warmode|weight)\b/,keyword:/\b(?:and|as|break|continue|else|elseif|endfor|endif|endwhile|for|if|loop|not|or|replay|stop|while)\b/,boolean:/\b(?:false|null|true)\b/,number:/\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,operator:[{pattern:/(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,lookbehind:!0},/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/],punctuation:/[()\[\]{}:.,]/}}$h.displayName="v";$h.aliases=[];function $h(e){e.register(ot),(function(t){var n={pattern:/[\s\S]+/,inside:null};t.languages.v=t.languages.extend("clike",{string:{pattern:/r?(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,alias:"quoted-string",greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\{[^{}]*\}|\w+(?:\.\w+(?:\([^\(\)]*\))?|\[[^\[\]]+\])*)/,lookbehind:!0,inside:{"interpolation-variable":{pattern:/^\$\w[\s\S]*$/,alias:"variable"},"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},"interpolation-expression":n}}}},"class-name":{pattern:/(\b(?:enum|interface|struct|type)\s+)(?:C\.)?\w+/,lookbehind:!0},keyword:/(?:\b(?:__global|as|asm|assert|atomic|break|chan|const|continue|defer|else|embed|enum|fn|for|go(?:to)?|if|import|in|interface|is|lock|match|module|mut|none|or|pub|return|rlock|select|shared|sizeof|static|struct|type(?:of)?|union|unsafe)|\$(?:else|for|if)|#(?:flag|include))\b/,number:/\b(?:0x[a-f\d]+(?:_[a-f\d]+)*|0b[01]+(?:_[01]+)*|0o[0-7]+(?:_[0-7]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?)\b/i,operator:/~|\?|[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\.?/,builtin:/\b(?:any(?:_float|_int)?|bool|byte(?:ptr)?|charptr|f(?:32|64)|i(?:8|16|64|128|nt)|rune|size_t|string|u(?:16|32|64|128)|voidptr)\b/}),n.inside=t.languages.v,t.languages.insertBefore("v","string",{char:{pattern:/`(?:\\`|\\?[^`]{1,2})`/,alias:"rune"}}),t.languages.insertBefore("v","operator",{attribute:{pattern:/(^[\t ]*)\[(?:deprecated|direct_array_access|flag|inline|live|ref_only|typedef|unsafe_fn|windows_stdcall)\]/m,lookbehind:!0,alias:"annotation",inside:{punctuation:/[\[\]]/,keyword:/\w+/}},generic:{pattern:/<\w+>(?=\s*[\)\{])/,inside:{punctuation:/[<>]/,"class-name":/\w+/}}}),t.languages.insertBefore("v","function",{"generic-function":{pattern:/\b\w+\s*<\w+>(?=\()/,inside:{function:/^\w+/,generic:{pattern:/<\w+>/,inside:t.languages.v.generic.inside}}}})})(e)}zh.displayName="vala";zh.aliases=[];function zh(e){e.register(ot),e.languages.vala=e.languages.extend("clike",{"class-name":[{pattern:/\b[A-Z]\w*(?:\.\w+)*\b(?=(?:\?\s+|\*?\s+\*?)\w)/,inside:{punctuation:/\./}},{pattern:/(\[)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/((?:\b(?:class|enum|interface|new|struct)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}}],keyword:/\b(?:abstract|as|assert|async|base|bool|break|case|catch|char|class|const|construct|continue|default|delegate|delete|do|double|dynamic|else|ensures|enum|errordomain|extern|finally|float|for|foreach|get|if|in|inline|int|int16|int32|int64|int8|interface|internal|is|lock|long|namespace|new|null|out|override|owned|params|private|protected|public|ref|requires|return|set|short|signal|sizeof|size_t|ssize_t|static|string|struct|switch|this|throw|throws|try|typeof|uchar|uint|uint16|uint32|uint64|uint8|ulong|unichar|unowned|ushort|using|value|var|virtual|void|volatile|weak|while|yield)\b/i,function:/\b\w+(?=\s*\()/,number:/(?:\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)(?:f|u?l?)?/i,operator:/\+\+|--|&&|\|\||<<=?|>>=?|=>|->|~|[+\-*\/%&^|=!<>]=?|\?\??|\.\.\./,punctuation:/[{}[\];(),.:]/,constant:/\b[A-Z0-9_]+\b/}),e.languages.insertBefore("vala","string",{"raw-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},"template-string":{pattern:/@"[\s\S]*?"/,greedy:!0,inside:{interpolation:{pattern:/\$(?:\([^)]*\)|[a-zA-Z]\w*)/,inside:{delimiter:{pattern:/^\$\(?|\)$/,alias:"punctuation"},rest:e.languages.vala}},string:/[\s\S]+/}}}),e.languages.insertBefore("vala","keyword",{regex:{pattern:/\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[imsx]{0,4}(?=\s*(?:$|[\r\n,.;})\]]))/,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\//,"regex-flags":/^[a-z]+$/}}})}Hh.displayName="velocity";Hh.aliases=[];function Hh(e){e.register(dn),(function(t){t.languages.velocity=t.languages.extend("markup",{});var n={variable:{pattern:/(^|[^\\](?:\\\\)*)\$!?(?:[a-z][\w-]*(?:\([^)]*\))?(?:\.[a-z][\w-]*(?:\([^)]*\))?|\[[^\]]+\])*|\{[^}]+\})/i,lookbehind:!0,inside:{}},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},number:/\b\d+\b/,boolean:/\b(?:false|true)\b/,operator:/[=!<>]=?|[+*/%-]|&&|\|\||\.\.|\b(?:eq|g[et]|l[et]|n(?:e|ot))\b/,punctuation:/[(){}[\]:,.]/};n.variable.inside={string:n.string,function:{pattern:/([^\w-])[a-z][\w-]*(?=\()/,lookbehind:!0},number:n.number,boolean:n.boolean,punctuation:n.punctuation},t.languages.insertBefore("velocity","comment",{unparsed:{pattern:/(^|[^\\])#\[\[[\s\S]*?\]\]#/,lookbehind:!0,greedy:!0,inside:{punctuation:/^#\[\[|\]\]#$/}},"velocity-comment":[{pattern:/(^|[^\\])#\*[\s\S]*?\*#/,lookbehind:!0,greedy:!0,alias:"comment"},{pattern:/(^|[^\\])##.*/,lookbehind:!0,greedy:!0,alias:"comment"}],directive:{pattern:/(^|[^\\](?:\\\\)*)#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})(?:\s*\((?:[^()]|\([^()]*\))*\))?/i,lookbehind:!0,inside:{keyword:{pattern:/^#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})|\bin\b/,inside:{punctuation:/[{}]/}},rest:n}},variable:n.variable}),t.languages.velocity.tag.inside["attr-value"].inside.rest=t.languages.velocity})(e)}Gh.displayName="verilog";Gh.aliases=[];function Gh(e){e.languages.verilog={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"kernel-function":{pattern:/\B\$\w+\b/,alias:"property"},constant:/\B`\w+\b/,function:/\b\w+(?=\()/,keyword:/\b(?:alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|cell|chandle|class|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endsequence|endspecify|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_ondetect|pulsestyle_onevent|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,important:/\b(?:always|always_comb|always_ff|always_latch)\b(?: *@)?/,number:/\B##?\d+|(?:\b\d+)?'[odbh] ?[\da-fzx_?]+|\b(?:\d*[._])?\d+(?:e[-+]?\d+)?/i,operator:/[-+{}^~%*\/?=!<>&|]+/,punctuation:/[[\];(),.:]/}}Wh.displayName="vhdl";Wh.aliases=[];function Wh(e){e.languages.vhdl={comment:/--.+/,"vhdl-vectors":{pattern:/\b[oxb]"[\da-f_]+"|"[01uxzwlh-]+"/i,alias:"number"},"quoted-function":{pattern:/"\S+?"(?=\()/,alias:"function"},string:/"(?:[^\\"\r\n]|\\(?:\r\n|[\s\S]))*"/,attribute:{pattern:/\b'\w+/,alias:"attr-name"},keyword:/\b(?:access|after|alias|all|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|new|next|null|of|on|open|others|out|package|port|postponed|private|procedure|process|pure|range|record|register|reject|report|return|select|severity|shared|signal|subtype|then|to|transport|type|unaffected|units|until|use|variable|view|wait|when|while|with)\b/i,boolean:/\b(?:false|true)\b/i,function:/\w+(?=\()/,number:/'[01uxzwlh-]'|\b(?:\d+#[\da-f_.]+#|\d[\d_.]*)(?:e[-+]?\d+)?/i,operator:/[<>]=?|:=|[-+*/&=]|\b(?:abs|and|mod|nand|nor|not|or|rem|rol|ror|sla|sll|sra|srl|xnor|xor)\b/i,punctuation:/[{}[\];(),.:]/}}Vh.displayName="vim";Vh.aliases=[];function Vh(e){e.languages.vim={string:/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\r\n]|'')*'/,comment:/".*/,function:/\b\w+(?=\()/,keyword:/\b(?:N|Next|P|Print|X|XMLent|XMLns|ab|abbreviate|abc|abclear|abo|aboveleft|al|all|ar|arga|argadd|argd|argdelete|argdo|arge|argedit|argg|argglobal|argl|arglocal|args|argu|argument|as|ascii|b|bN|bNext|ba|bad|badd|ball|bd|bdelete|be|bel|belowright|bf|bfirst|bl|blast|bm|bmodified|bn|bnext|bo|botright|bp|bprevious|br|brea|break|breaka|breakadd|breakd|breakdel|breakl|breaklist|brewind|bro|browse|bufdo|buffer|buffers|bun|bunload|bw|bwipeout|c|cN|cNext|cNfcNfile|ca|cabbrev|cabc|cabclear|cad|caddb|caddbuffer|caddexpr|caddf|caddfile|cal|call|cat|catch|cb|cbuffer|cc|ccl|cclose|cd|ce|center|cex|cexpr|cf|cfile|cfir|cfirst|cg|cgetb|cgetbuffer|cgete|cgetexpr|cgetfile|change|changes|chd|chdir|che|checkpath|checkt|checktime|cl|cla|clast|clist|clo|close|cmapc|cmapclear|cn|cnew|cnewer|cnext|cnf|cnfile|cnorea|cnoreabbrev|co|col|colder|colo|colorscheme|comc|comclear|comp|compiler|con|conf|confirm|continue|cope|copen|copy|cp|cpf|cpfile|cprevious|cq|cquit|cr|crewind|cu|cuna|cunabbrev|cunmap|cw|cwindow|d|debugg|debuggreedy|delc|delcommand|delete|delf|delfunction|delm|delmarks|di|diffg|diffget|diffoff|diffpatch|diffpu|diffput|diffsplit|diffthis|diffu|diffupdate|dig|digraphs|display|dj|djump|dl|dlist|dr|drop|ds|dsearch|dsp|dsplit|e|earlier|echoe|echoerr|echom|echomsg|echon|edit|el|else|elsei|elseif|em|emenu|en|endf|endfo|endfor|endfun|endfunction|endif|endt|endtry|endw|endwhile|ene|enew|ex|exi|exit|exu|exusage|f|file|files|filetype|fin|fina|finally|find|fini|finish|fir|first|fix|fixdel|fo|fold|foldc|foldclose|foldd|folddoc|folddoclosed|folddoopen|foldo|foldopen|for|fu|fun|function|go|goto|gr|grep|grepa|grepadd|h|ha|hardcopy|help|helpf|helpfind|helpg|helpgrep|helpt|helptags|hid|hide|his|history|ia|iabbrev|iabc|iabclear|if|ij|ijump|il|ilist|imapc|imapclear|in|inorea|inoreabbrev|isearch|isp|isplit|iu|iuna|iunabbrev|iunmap|j|join|ju|jumps|k|kee|keepalt|keepj|keepjumps|keepmarks|l|lN|lNext|lNf|lNfile|la|lad|laddb|laddbuffer|laddexpr|laddf|laddfile|lan|language|last|later|lb|lbuffer|lc|lcd|lch|lchdir|lcl|lclose|left|lefta|leftabove|let|lex|lexpr|lf|lfile|lfir|lfirst|lg|lgetb|lgetbuffer|lgete|lgetexpr|lgetfile|lgr|lgrep|lgrepa|lgrepadd|lh|lhelpgrep|list|ll|lla|llast|lli|llist|lm|lmak|lmake|lmap|lmapc|lmapclear|ln|lne|lnew|lnewer|lnext|lnf|lnfile|lnoremap|lo|loadview|loc|lockmarks|lockv|lockvar|lol|lolder|lop|lopen|lp|lpf|lpfile|lprevious|lr|lrewind|ls|lt|ltag|lu|lunmap|lv|lvimgrep|lvimgrepa|lvimgrepadd|lw|lwindow|m|ma|mak|make|mark|marks|mat|match|menut|menutranslate|mk|mkexrc|mks|mksession|mksp|mkspell|mkv|mkvie|mkview|mkvimrc|mod|mode|move|mz|mzf|mzfile|mzscheme|n|nbkey|new|next|nmapc|nmapclear|noh|nohlsearch|norea|noreabbrev|nu|number|nun|nunmap|o|omapc|omapclear|on|only|open|opt|options|ou|ounmap|p|pc|pclose|pe|ped|pedit|perl|perld|perldo|po|pop|popu|popup|pp|ppop|pre|preserve|prev|previous|print|prof|profd|profdel|profile|promptf|promptfind|promptr|promptrepl|ps|psearch|ptN|ptNext|pta|ptag|ptf|ptfirst|ptj|ptjump|ptl|ptlast|ptn|ptnext|ptp|ptprevious|ptr|ptrewind|pts|ptselect|pu|put|pw|pwd|py|pyf|pyfile|python|q|qa|qall|quit|quita|quitall|r|read|rec|recover|red|redi|redir|redo|redr|redraw|redraws|redrawstatus|reg|registers|res|resize|ret|retab|retu|return|rew|rewind|ri|right|rightb|rightbelow|ru|rub|ruby|rubyd|rubydo|rubyf|rubyfile|runtime|rv|rviminfo|sN|sNext|sa|sal|sall|san|sandbox|sargument|sav|saveas|sb|sbN|sbNext|sba|sball|sbf|sbfirst|sbl|sblast|sbm|sbmodified|sbn|sbnext|sbp|sbprevious|sbr|sbrewind|sbuffer|scrip|scripte|scriptencoding|scriptnames|se|set|setf|setfiletype|setg|setglobal|setl|setlocal|sf|sfind|sfir|sfirst|sh|shell|sign|sil|silent|sim|simalt|sl|sla|slast|sleep|sm|smagic|smap|smapc|smapclear|sme|smenu|sn|snext|sni|sniff|sno|snomagic|snor|snoremap|snoreme|snoremenu|so|sor|sort|source|sp|spe|spelld|spelldump|spellgood|spelli|spellinfo|spellr|spellrepall|spellu|spellundo|spellw|spellwrong|split|spr|sprevious|sre|srewind|st|sta|stag|star|startg|startgreplace|startinsert|startr|startreplace|stj|stjump|stop|stopi|stopinsert|sts|stselect|sun|sunhide|sunm|sunmap|sus|suspend|sv|sview|syncbind|t|tN|tNext|ta|tab|tabN|tabNext|tabc|tabclose|tabd|tabdo|tabe|tabedit|tabf|tabfind|tabfir|tabfirst|tabl|tablast|tabm|tabmove|tabn|tabnew|tabnext|tabo|tabonly|tabp|tabprevious|tabr|tabrewind|tabs|tag|tags|tc|tcl|tcld|tcldo|tclf|tclfile|te|tearoff|tf|tfirst|th|throw|tj|tjump|tl|tlast|tm|tmenu|tn|tnext|to|topleft|tp|tprevious|tr|trewind|try|ts|tselect|tu|tunmenu|u|una|unabbreviate|undo|undoj|undojoin|undol|undolist|unh|unhide|unlet|unlo|unlockvar|unm|unmap|up|update|ve|verb|verbose|version|vert|vertical|vi|vie|view|vim|vimgrep|vimgrepa|vimgrepadd|visual|viu|viusage|vmapc|vmapclear|vne|vnew|vs|vsplit|vu|vunmap|w|wN|wNext|wa|wall|wh|while|win|winc|wincmd|windo|winp|winpos|winsize|wn|wnext|wp|wprevious|wq|wqa|wqall|write|ws|wsverb|wv|wviminfo|x|xa|xall|xit|xm|xmap|xmapc|xmapclear|xme|xmenu|xn|xnoremap|xnoreme|xnoremenu|xu|xunmap|y|yank)\b/,builtin:/\b(?:acd|ai|akm|aleph|allowrevins|altkeymap|ambiwidth|ambw|anti|antialias|arab|arabic|arabicshape|ari|arshape|autochdir|autocmd|autoindent|autoread|autowrite|autowriteall|aw|awa|background|backspace|backup|backupcopy|backupdir|backupext|backupskip|balloondelay|ballooneval|balloonexpr|bdir|bdlay|beval|bex|bexpr|bg|bh|bin|binary|biosk|bioskey|bk|bkc|bomb|breakat|brk|browsedir|bs|bsdir|bsk|bt|bufhidden|buflisted|buftype|casemap|ccv|cdpath|cedit|cfu|ch|charconvert|ci|cin|cindent|cink|cinkeys|cino|cinoptions|cinw|cinwords|clipboard|cmdheight|cmdwinheight|cmp|cms|columns|com|comments|commentstring|compatible|complete|completefunc|completeopt|consk|conskey|copyindent|cot|cpo|cpoptions|cpt|cscopepathcomp|cscopeprg|cscopequickfix|cscopetag|cscopetagorder|cscopeverbose|cspc|csprg|csqf|cst|csto|csverb|cuc|cul|cursorcolumn|cursorline|cwh|debug|deco|def|define|delcombine|dex|dg|dict|dictionary|diff|diffexpr|diffopt|digraph|dip|dir|directory|dy|ea|ead|eadirection|eb|ed|edcompatible|ef|efm|ei|ek|enc|encoding|endofline|eol|ep|equalalways|equalprg|errorbells|errorfile|errorformat|esckeys|et|eventignore|expandtab|exrc|fcl|fcs|fdc|fde|fdi|fdl|fdls|fdm|fdn|fdo|fdt|fen|fenc|fencs|fex|ff|ffs|fileencoding|fileencodings|fileformat|fileformats|fillchars|fk|fkmap|flp|fml|fmr|foldcolumn|foldenable|foldexpr|foldignore|foldlevel|foldlevelstart|foldmarker|foldmethod|foldminlines|foldnestmax|foldtext|formatexpr|formatlistpat|formatoptions|formatprg|fp|fs|fsync|ft|gcr|gd|gdefault|gfm|gfn|gfs|gfw|ghr|gp|grepformat|grepprg|gtl|gtt|guicursor|guifont|guifontset|guifontwide|guiheadroom|guioptions|guipty|guitablabel|guitabtooltip|helpfile|helpheight|helplang|hf|hh|hi|hidden|highlight|hk|hkmap|hkmapp|hkp|hl|hlg|hls|hlsearch|ic|icon|iconstring|ignorecase|im|imactivatekey|imak|imc|imcmdline|imd|imdisable|imi|iminsert|ims|imsearch|inc|include|includeexpr|incsearch|inde|indentexpr|indentkeys|indk|inex|inf|infercase|insertmode|invacd|invai|invakm|invallowrevins|invaltkeymap|invanti|invantialias|invar|invarab|invarabic|invarabicshape|invari|invarshape|invautochdir|invautoindent|invautoread|invautowrite|invautowriteall|invaw|invawa|invbackup|invballooneval|invbeval|invbin|invbinary|invbiosk|invbioskey|invbk|invbl|invbomb|invbuflisted|invcf|invci|invcin|invcindent|invcompatible|invconfirm|invconsk|invconskey|invcopyindent|invcp|invcscopetag|invcscopeverbose|invcst|invcsverb|invcuc|invcul|invcursorcolumn|invcursorline|invdeco|invdelcombine|invdg|invdiff|invdigraph|invdisable|invea|inveb|inved|invedcompatible|invek|invendofline|inveol|invequalalways|inverrorbells|invesckeys|invet|invex|invexpandtab|invexrc|invfen|invfk|invfkmap|invfoldenable|invgd|invgdefault|invguipty|invhid|invhidden|invhk|invhkmap|invhkmapp|invhkp|invhls|invhlsearch|invic|invicon|invignorecase|invim|invimc|invimcmdline|invimd|invincsearch|invinf|invinfercase|invinsertmode|invis|invjoinspaces|invjs|invlazyredraw|invlbr|invlinebreak|invlisp|invlist|invloadplugins|invlpl|invlz|invma|invmacatsui|invmagic|invmh|invml|invmod|invmodeline|invmodifiable|invmodified|invmore|invmousef|invmousefocus|invmousehide|invnu|invnumber|invodev|invopendevice|invpaste|invpi|invpreserveindent|invpreviewwindow|invprompt|invpvw|invreadonly|invremap|invrestorescreen|invrevins|invri|invrightleft|invrightleftcmd|invrl|invrlc|invro|invrs|invru|invruler|invsb|invsc|invscb|invscrollbind|invscs|invsecure|invsft|invshellslash|invshelltemp|invshiftround|invshortname|invshowcmd|invshowfulltag|invshowmatch|invshowmode|invsi|invsm|invsmartcase|invsmartindent|invsmarttab|invsmd|invsn|invsol|invspell|invsplitbelow|invsplitright|invspr|invsr|invssl|invsta|invstartofline|invstmp|invswapfile|invswf|invta|invtagbsearch|invtagrelative|invtagstack|invtbi|invtbidi|invtbs|invtermbidi|invterse|invtextauto|invtextmode|invtf|invtgst|invtildeop|invtimeout|invtitle|invto|invtop|invtr|invttimeout|invttybuiltin|invttyfast|invtx|invvb|invvisualbell|invwa|invwarn|invwb|invweirdinvert|invwfh|invwfw|invwildmenu|invwinfixheight|invwinfixwidth|invwiv|invwmnu|invwrap|invwrapscan|invwrite|invwriteany|invwritebackup|invws|isf|isfname|isi|isident|isk|iskeyword|isprint|joinspaces|js|key|keymap|keymodel|keywordprg|km|kmp|kp|langmap|langmenu|laststatus|lazyredraw|lbr|lcs|linebreak|lines|linespace|lisp|lispwords|listchars|loadplugins|lpl|lsp|lz|macatsui|magic|makeef|makeprg|matchpairs|matchtime|maxcombine|maxfuncdepth|maxmapdepth|maxmem|maxmempattern|maxmemtot|mco|mef|menuitems|mfd|mh|mis|mkspellmem|ml|mls|mm|mmd|mmp|mmt|modeline|modelines|modifiable|modified|more|mouse|mousef|mousefocus|mousehide|mousem|mousemodel|mouses|mouseshape|mouset|mousetime|mp|mps|msm|mzq|mzquantum|nf|noacd|noai|noakm|noallowrevins|noaltkeymap|noanti|noantialias|noar|noarab|noarabic|noarabicshape|noari|noarshape|noautochdir|noautoindent|noautoread|noautowrite|noautowriteall|noaw|noawa|nobackup|noballooneval|nobeval|nobin|nobinary|nobiosk|nobioskey|nobk|nobl|nobomb|nobuflisted|nocf|noci|nocin|nocindent|nocompatible|noconfirm|noconsk|noconskey|nocopyindent|nocp|nocscopetag|nocscopeverbose|nocst|nocsverb|nocuc|nocul|nocursorcolumn|nocursorline|nodeco|nodelcombine|nodg|nodiff|nodigraph|nodisable|noea|noeb|noed|noedcompatible|noek|noendofline|noeol|noequalalways|noerrorbells|noesckeys|noet|noex|noexpandtab|noexrc|nofen|nofk|nofkmap|nofoldenable|nogd|nogdefault|noguipty|nohid|nohidden|nohk|nohkmap|nohkmapp|nohkp|nohls|noic|noicon|noignorecase|noim|noimc|noimcmdline|noimd|noincsearch|noinf|noinfercase|noinsertmode|nois|nojoinspaces|nojs|nolazyredraw|nolbr|nolinebreak|nolisp|nolist|noloadplugins|nolpl|nolz|noma|nomacatsui|nomagic|nomh|noml|nomod|nomodeline|nomodifiable|nomodified|nomore|nomousef|nomousefocus|nomousehide|nonu|nonumber|noodev|noopendevice|nopaste|nopi|nopreserveindent|nopreviewwindow|noprompt|nopvw|noreadonly|noremap|norestorescreen|norevins|nori|norightleft|norightleftcmd|norl|norlc|noro|nors|noru|noruler|nosb|nosc|noscb|noscrollbind|noscs|nosecure|nosft|noshellslash|noshelltemp|noshiftround|noshortname|noshowcmd|noshowfulltag|noshowmatch|noshowmode|nosi|nosm|nosmartcase|nosmartindent|nosmarttab|nosmd|nosn|nosol|nospell|nosplitbelow|nosplitright|nospr|nosr|nossl|nosta|nostartofline|nostmp|noswapfile|noswf|nota|notagbsearch|notagrelative|notagstack|notbi|notbidi|notbs|notermbidi|noterse|notextauto|notextmode|notf|notgst|notildeop|notimeout|notitle|noto|notop|notr|nottimeout|nottybuiltin|nottyfast|notx|novb|novisualbell|nowa|nowarn|nowb|noweirdinvert|nowfh|nowfw|nowildmenu|nowinfixheight|nowinfixwidth|nowiv|nowmnu|nowrap|nowrapscan|nowrite|nowriteany|nowritebackup|nows|nrformats|numberwidth|nuw|odev|oft|ofu|omnifunc|opendevice|operatorfunc|opfunc|osfiletype|pa|para|paragraphs|paste|pastetoggle|patchexpr|patchmode|path|pdev|penc|pex|pexpr|pfn|ph|pheader|pi|pm|pmbcs|pmbfn|popt|preserveindent|previewheight|previewwindow|printdevice|printencoding|printexpr|printfont|printheader|printmbcharset|printmbfont|printoptions|prompt|pt|pumheight|pvh|pvw|qe|quoteescape|readonly|remap|report|restorescreen|revins|rightleft|rightleftcmd|rl|rlc|ro|rs|rtp|ruf|ruler|rulerformat|runtimepath|sbo|sc|scb|scr|scroll|scrollbind|scrolljump|scrolloff|scrollopt|scs|sect|sections|secure|sel|selection|selectmode|sessionoptions|sft|shcf|shellcmdflag|shellpipe|shellquote|shellredir|shellslash|shelltemp|shelltype|shellxquote|shiftround|shiftwidth|shm|shortmess|shortname|showbreak|showcmd|showfulltag|showmatch|showmode|showtabline|shq|si|sidescroll|sidescrolloff|siso|sj|slm|smartcase|smartindent|smarttab|smc|smd|softtabstop|sol|spc|spell|spellcapcheck|spellfile|spelllang|spellsuggest|spf|spl|splitbelow|splitright|sps|sr|srr|ss|ssl|ssop|stal|startofline|statusline|stl|stmp|su|sua|suffixes|suffixesadd|sw|swapfile|swapsync|swb|swf|switchbuf|sws|sxq|syn|synmaxcol|syntax|t_AB|t_AF|t_AL|t_CS|t_CV|t_Ce|t_Co|t_Cs|t_DL|t_EI|t_F1|t_F2|t_F3|t_F4|t_F5|t_F6|t_F7|t_F8|t_F9|t_IE|t_IS|t_K1|t_K3|t_K4|t_K5|t_K6|t_K7|t_K8|t_K9|t_KA|t_KB|t_KC|t_KD|t_KE|t_KF|t_KG|t_KH|t_KI|t_KJ|t_KK|t_KL|t_RI|t_RV|t_SI|t_Sb|t_Sf|t_WP|t_WS|t_ZH|t_ZR|t_al|t_bc|t_cd|t_ce|t_cl|t_cm|t_cs|t_da|t_db|t_dl|t_fs|t_k1|t_k2|t_k3|t_k4|t_k5|t_k6|t_k7|t_k8|t_k9|t_kB|t_kD|t_kI|t_kN|t_kP|t_kb|t_kd|t_ke|t_kh|t_kl|t_kr|t_ks|t_ku|t_le|t_mb|t_md|t_me|t_mr|t_ms|t_nd|t_op|t_se|t_so|t_sr|t_te|t_ti|t_ts|t_ue|t_us|t_ut|t_vb|t_ve|t_vi|t_vs|t_xs|tabline|tabpagemax|tabstop|tagbsearch|taglength|tagrelative|tagstack|tal|tb|tbi|tbidi|tbis|tbs|tenc|term|termbidi|termencoding|terse|textauto|textmode|textwidth|tgst|thesaurus|tildeop|timeout|timeoutlen|title|titlelen|titleold|titlestring|toolbar|toolbariconsize|top|tpm|tsl|tsr|ttimeout|ttimeoutlen|ttm|tty|ttybuiltin|ttyfast|ttym|ttymouse|ttyscroll|ttytype|tw|tx|uc|ul|undolevels|updatecount|updatetime|ut|vb|vbs|vdir|verbosefile|vfile|viewdir|viewoptions|viminfo|virtualedit|visualbell|vop|wak|warn|wb|wc|wcm|wd|weirdinvert|wfh|wfw|whichwrap|wi|wig|wildchar|wildcharm|wildignore|wildmenu|wildmode|wildoptions|wim|winaltkeys|window|winfixheight|winfixwidth|winheight|winminheight|winminwidth|winwidth|wiv|wiw|wm|wmh|wmnu|wmw|wop|wrap|wrapmargin|wrapscan|writeany|writebackup|writedelay|ww)\b/,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?)\b/i,operator:/\|\||&&|[-+.]=?|[=!](?:[=~][#?]?)?|[<>]=?[#?]?|[*\/%?]|\b(?:is(?:not)?)\b/,punctuation:/[{}[\](),;:]/}}qh.displayName="visual-basic";qh.aliases=["vb","vba"];function qh(e){e.languages["visual-basic"]={comment:{pattern:/(?:['‘’]|REM\b)(?:[^\r\n_]|_(?:\r\n?|\n)?)*/i,inside:{keyword:/^REM/i}},directive:{pattern:/#(?:Const|Else|ElseIf|End|ExternalChecksum|ExternalSource|If|Region)(?:\b_[ \t]*(?:\r\n?|\n)|.)+/i,alias:"property",greedy:!0},string:{pattern:/\$?["“”](?:["“”]{2}|[^"“”])*["“”]C?/i,greedy:!0},date:{pattern:/#[ \t]*(?:\d+([/-])\d+\1\d+(?:[ \t]+(?:\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?))?|\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?)[ \t]*#/i,alias:"number"},number:/(?:(?:\b\d+(?:\.\d+)?|\.\d+)(?:E[+-]?\d+)?|&[HO][\dA-F]+)(?:[FRD]|U?[ILS])?/i,boolean:/\b(?:False|Nothing|True)\b/i,keyword:/\b(?:AddHandler|AddressOf|Alias|And(?:Also)?|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|C(?:Bool|Byte|Char|Date|Dbl|Dec|Int|Lng|Obj|SByte|Short|Sng|Str|Type|UInt|ULng|UShort)|Char|Class|Const|Continue|Currency|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else(?:If)?|End(?:If)?|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get(?:Type|XMLNamespace)?|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|Must(?:Inherit|Override)|My(?:Base|Class)|Namespace|Narrowing|New|Next|Not(?:Inheritable|Overridable)?|Object|Of|On|Operator|Option(?:al)?|Or(?:Else)?|Out|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TryCast|Type|TypeOf|U(?:Integer|Long|Short)|Until|Using|Variant|Wend|When|While|Widening|With(?:Events)?|WriteOnly|Xor)\b/i,operator:/[+\-*/\\^<=>&#@$%!]|\b_(?=[ \t]*[\r\n])/,punctuation:/[{}().,:?]/},e.languages.vb=e.languages["visual-basic"],e.languages.vba=e.languages["visual-basic"]}Yh.displayName="warpscript";Yh.aliases=[];function Yh(e){e.languages.warpscript={comment:/#.*|\/\/.*|\/\*[\s\S]*?\*\//,string:{pattern:/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'|<'(?:[^\\']|'(?!>)|\\.)*'>/,greedy:!0},variable:/\$\S+/,macro:{pattern:/@\S+/,alias:"property"},keyword:/\b(?:BREAK|CHECKMACRO|CONTINUE|CUDF|DEFINED|DEFINEDMACRO|EVAL|FAIL|FOR|FOREACH|FORSTEP|IFT|IFTE|MSGFAIL|NRETURN|RETHROW|RETURN|SWITCH|TRY|UDF|UNTIL|WHILE)\b/,number:/[+-]?\b(?:NaN|Infinity|\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+)\b/,boolean:/\b(?:F|T|false|true)\b/,punctuation:/<%|%>|[{}[\]()]/,operator:/==|&&?|\|\|?|\*\*?|>>>?|<<|[<>!~]=?|[-/%^]|\+!?|\b(?:AND|NOT|OR)\b/}}Zh.displayName="wasm";Zh.aliases=[];function Zh(e){e.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/}}Kh.displayName="web-idl";Kh.aliases=["webidl"];function Kh(e){(function(t){var n=/(?:\B-|\b_|\b)[A-Za-z][\w-]*(?![\w-])/.source,r="(?:"+/\b(?:unsigned\s+)?long\s+long(?![\w-])/.source+"|"+/\b(?:unrestricted|unsigned)\s+[a-z]+(?![\w-])/.source+"|"+/(?!(?:unrestricted|unsigned)\b)/.source+n+/(?:\s*<(?:[^<>]|<[^<>]*>)*>)?/.source+")"+/(?:\s*\?)?/.source,a={};t.languages["web-idl"]={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"[^"]*"/,greedy:!0},namespace:{pattern:RegExp(/(\bnamespace\s+)/.source+n),lookbehind:!0},"class-name":[{pattern:/(^|[^\w-])(?:iterable|maplike|setlike)\s*<(?:[^<>]|<[^<>]*>)*>/,lookbehind:!0,inside:a},{pattern:RegExp(/(\b(?:attribute|const|deleter|getter|optional|setter)\s+)/.source+r),lookbehind:!0,inside:a},{pattern:RegExp("("+/\bcallback\s+/.source+n+/\s*=\s*/.source+")"+r),lookbehind:!0,inside:a},{pattern:RegExp(/(\btypedef\b\s*)/.source+r),lookbehind:!0,inside:a},{pattern:RegExp(/(\b(?:callback|dictionary|enum|interface(?:\s+mixin)?)\s+)(?!(?:interface|mixin)\b)/.source+n),lookbehind:!0},{pattern:RegExp(/(:\s*)/.source+n),lookbehind:!0},RegExp(n+/(?=\s+(?:implements|includes)\b)/.source),{pattern:RegExp(/(\b(?:implements|includes)\s+)/.source+n),lookbehind:!0},{pattern:RegExp(r+"(?="+/\s*(?:\.{3}\s*)?/.source+n+/\s*[(),;=]/.source+")"),inside:a}],builtin:/\b(?:ArrayBuffer|BigInt64Array|BigUint64Array|ByteString|DOMString|DataView|Float32Array|Float64Array|FrozenArray|Int16Array|Int32Array|Int8Array|ObservableArray|Promise|USVString|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray)\b/,keyword:[/\b(?:async|attribute|callback|const|constructor|deleter|dictionary|enum|getter|implements|includes|inherit|interface|mixin|namespace|null|optional|or|partial|readonly|required|setter|static|stringifier|typedef|unrestricted)\b/,/\b(?:any|bigint|boolean|byte|double|float|iterable|long|maplike|object|octet|record|sequence|setlike|short|symbol|undefined|unsigned|void)\b/],boolean:/\b(?:false|true)\b/,number:{pattern:/(^|[^\w-])-?(?:0x[0-9a-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|NaN|Infinity)(?![\w-])/i,lookbehind:!0},operator:/\.{3}|[=:?<>-]/,punctuation:/[(){}[\].,;]/};for(var i in t.languages["web-idl"])i!=="class-name"&&(a[i]=t.languages["web-idl"][i]);t.languages.webidl=t.languages["web-idl"]})(e)}Xh.displayName="wgsl";Xh.aliases=[];function Xh(e){e.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},"builtin-attribute":{pattern:/(@)builtin\(.*?\)/,lookbehind:!0,inside:{attribute:{pattern:/^builtin/,alias:"attr-name"},punctuation:/[(),]/,"built-in-values":{pattern:/\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/,alias:"attr-value"}}},attributes:{pattern:/(@)(?:align|binding|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i,lookbehind:!0,alias:"attr-name"},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:false|true)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+[eE](?:\+|-)?\d+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}}Qh.displayName="wiki";Qh.aliases=[];function Qh(e){e.register(dn),e.languages.wiki=e.languages.extend("markup",{"block-comment":{pattern:/(^|[^\\])\/\*[\s\S]*?\*\//,lookbehind:!0,alias:"comment"},heading:{pattern:/^(=+)[^=\r\n].*?\1/m,inside:{punctuation:/^=+|=+$/,important:/.+/}},emphasis:{pattern:/('{2,5}).+?\1/,inside:{"bold-italic":{pattern:/(''''').+?(?=\1)/,lookbehind:!0,alias:["bold","italic"]},bold:{pattern:/(''')[^'](?:.*?[^'])?(?=\1)/,lookbehind:!0},italic:{pattern:/('')[^'](?:.*?[^'])?(?=\1)/,lookbehind:!0},punctuation:/^''+|''+$/}},hr:{pattern:/^-{4,}/m,alias:"punctuation"},url:[/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:PMID|RFC) +\d+/i,/\[\[.+?\]\]|\[.+?\]/],variable:[/__[A-Z]+__/,/\{{3}.+?\}{3}/,/\{\{.+?\}\}/],symbol:[/^#redirect/im,/~{3,5}/],"table-tag":{pattern:/((?:^|[|!])[|!])[^|\r\n]+\|(?!\|)/m,lookbehind:!0,inside:{"table-bar":{pattern:/\|$/,alias:"punctuation"},rest:e.languages.markup.tag.inside}},punctuation:/^(?:\{\||\|\}|\|-|[*#:;!|])|\|\||!!/m}),e.languages.insertBefore("wiki","tag",{nowiki:{pattern:/<(nowiki|pre|source)\b[^>]*>[\s\S]*?<\/\1>/i,inside:{tag:{pattern:/<(?:nowiki|pre|source)\b[^>]*>|<\/(?:nowiki|pre|source)>/i,inside:e.languages.markup.tag.inside}}}})}Jh.displayName="wolfram";Jh.aliases=["mathematica","nb","wl"];function Jh(e){e.languages.wolfram={comment:/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,string:{pattern:/"(?:\\.|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:Abs|AbsArg|Accuracy|Block|Do|For|Function|If|Manipulate|Module|Nest|NestList|None|Return|Switch|Table|Which|While)\b/,context:{pattern:/\b\w+`+\w*/,alias:"class-name"},blank:{pattern:/\b\w+_\b/,alias:"regex"},"global-variable":{pattern:/\$\w+/,alias:"variable"},boolean:/\b(?:False|True)\b/,number:/(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/\/\.|;|=\.|\^=|\^:=|:=|<<|>>|<\||\|>|:>|\|->|->|<-|@@@|@@|@|\/@|=!=|===|==|=|\+|-|\[\/-+%=\]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.mathematica=e.languages.wolfram,e.languages.wl=e.languages.wolfram,e.languages.nb=e.languages.wolfram}eg.displayName="wren";eg.aliases=[];function eg(e){e.languages.wren={comment:[{pattern:/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*))*\*\/)*\*\/)*\*\//,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],"triple-quoted-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},"string-literal":null,hashbang:{pattern:/^#!\/.+/,greedy:!0,alias:"comment"},attribute:{pattern:/#!?[ \t\u3000]*\w+/,alias:"keyword"},"class-name":[{pattern:/(\bclass\s+)\w+/,lookbehind:!0},/\b[A-Z][a-z\d_]*\b/],constant:/\b[A-Z][A-Z\d_]*\b/,null:{pattern:/\bnull\b/,alias:"keyword"},keyword:/\b(?:as|break|class|construct|continue|else|for|foreign|if|import|in|is|return|static|super|this|var|while)\b/,boolean:/\b(?:false|true)\b/,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,function:/\b[a-z_]\w*(?=\s*[({])/i,operator:/<<|>>|[=!<>]=?|&&|\|\||[-+*/%~^&|?:]|\.{2,3}/,punctuation:/[\[\](){}.,;]/},e.languages.wren["string-literal"]={pattern:/(^|[^\\"])"(?:[^\\"%]|\\[\s\S]|%(?!\()|%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\))*"/,lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\)/,lookbehind:!0,inside:{expression:{pattern:/^(%\()[\s\S]+(?=\)$)/,lookbehind:!0,inside:e.languages.wren},"interpolation-punctuation":{pattern:/^%\(|\)$/,alias:"punctuation"}}},string:/[\s\S]+/}}}tg.displayName="xeora";tg.aliases=["xeoracube"];function tg(e){e.register(dn),(function(t){t.languages.xeora=t.languages.extend("markup",{constant:{pattern:/\$(?:DomainContents|PageRenderDuration)\$/,inside:{punctuation:{pattern:/\$/}}},variable:{pattern:/\$@?(?:#+|[-+*~=^])?[\w.]+\$/,inside:{punctuation:{pattern:/[$.]/},operator:{pattern:/#+|[-+*~=^@]/}}},"function-inline":{pattern:/\$F:[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\$/,inside:{variable:{pattern:/(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/,inside:{punctuation:{pattern:/[,.|]/},operator:{pattern:/#+|[-+*~=^@]/}}},punctuation:{pattern:/\$\w:|[$:?.,|]/}},alias:"function"},"function-block":{pattern:/\$XF:\{[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\}:XF\$/,inside:{punctuation:{pattern:/[$:{}?.,|]/}},alias:"function"},"directive-inline":{pattern:/\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\/\w.]+\$/,inside:{punctuation:{pattern:/\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,inside:{tag:{pattern:/#\d/}}}},alias:"function"},"directive-block-open":{pattern:/\$\w+:\{|\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\w.]+:\{(?:![A-Z]+)?/,inside:{punctuation:{pattern:/\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,inside:{tag:{pattern:/#\d/}}},attribute:{pattern:/![A-Z]+$/,inside:{punctuation:{pattern:/!/}},alias:"keyword"}},alias:"function"},"directive-block-separator":{pattern:/\}:[-\w.]+:\{/,inside:{punctuation:{pattern:/[:{}]/}},alias:"function"},"directive-block-close":{pattern:/\}:[-\w.]+\$/,inside:{punctuation:{pattern:/[:{}$]/}},alias:"function"}}),t.languages.insertBefore("inside","punctuation",{variable:t.languages.xeora["function-inline"].inside.variable},t.languages.xeora["function-block"]),t.languages.xeoracube=t.languages.xeora})(e)}ng.displayName="xml-doc";ng.aliases=[];function ng(e){e.register(dn),(function(t){function n(s,o){t.languages[s]&&t.languages.insertBefore(s,"comment",{"doc-comment":o})}var r=t.languages.markup.tag,a={pattern:/\/\/\/.*/,greedy:!0,alias:"comment",inside:{tag:r}},i={pattern:/'''.*/,greedy:!0,alias:"comment",inside:{tag:r}};n("csharp",a),n("fsharp",a),n("vbnet",i)})(e)}rg.displayName="xojo";rg.aliases=[];function rg(e){e.languages.xojo={comment:{pattern:/(?:'|\/\/|Rem\b).+/i,greedy:!0},string:{pattern:/"(?:""|[^"])*"/,greedy:!0},number:[/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,/&[bchou][a-z\d]+/i],directive:{pattern:/#(?:Else|ElseIf|Endif|If|Pragma)\b/i,alias:"property"},keyword:/\b(?:AddHandler|App|Array|As(?:signs)?|Auto|Boolean|Break|By(?:Ref|Val)|Byte|Call|Case|Catch|CFStringRef|CGFloat|Class|Color|Const|Continue|CString|Currency|CurrentMethodName|Declare|Delegate|Dim|Do(?:uble|wnTo)?|Each|Else(?:If)?|End|Enumeration|Event|Exception|Exit|Extends|False|Finally|For|Function|Get|GetTypeInfo|Global|GOTO|If|Implements|In|Inherits|Int(?:8|16|32|64|eger|erface)?|Lib|Loop|Me|Module|Next|Nil|Object|Optional|OSType|ParamArray|Private|Property|Protected|PString|Ptr|Raise(?:Event)?|ReDim|RemoveHandler|Return|Select(?:or)?|Self|Set|Shared|Short|Single|Soft|Static|Step|String|Sub|Super|Text|Then|To|True|Try|Ubound|UInt(?:8|16|32|64|eger)?|Until|Using|Var(?:iant)?|Wend|While|WindowPtr|WString)\b/i,operator:/<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|WeakAddressOf|Xor)\b/i,punctuation:/[.,;:()]/}}ag.displayName="xquery";ag.aliases=[];function ag(e){e.register(dn),(function(t){t.languages.xquery=t.languages.extend("markup",{"xquery-comment":{pattern:/\(:[\s\S]*?:\)/,greedy:!0,alias:"comment"},string:{pattern:/(["'])(?:\1\1|(?!\1)[\s\S])*\1/,greedy:!0},extension:{pattern:/\(#.+?#\)/,alias:"symbol"},variable:/\$[-\w:]+/,axis:{pattern:/(^|[^-])(?:ancestor(?:-or-self)?|attribute|child|descendant(?:-or-self)?|following(?:-sibling)?|parent|preceding(?:-sibling)?|self)(?=::)/,lookbehind:!0,alias:"operator"},"keyword-operator":{pattern:/(^|[^:-])\b(?:and|castable as|div|eq|except|ge|gt|idiv|instance of|intersect|is|le|lt|mod|ne|or|union)\b(?=$|[^:-])/,lookbehind:!0,alias:"operator"},keyword:{pattern:/(^|[^:-])\b(?:as|ascending|at|base-uri|boundary-space|case|cast as|collation|construction|copy-namespaces|declare|default|descending|else|empty (?:greatest|least)|encoding|every|external|for|function|if|import|in|inherit|lax|let|map|module|namespace|no-inherit|no-preserve|option|order(?: by|ed|ing)?|preserve|return|satisfies|schema|some|stable|strict|strip|then|to|treat as|typeswitch|unordered|validate|variable|version|where|xquery)\b(?=$|[^:-])/,lookbehind:!0},function:/[\w-]+(?::[\w-]+)*(?=\s*\()/,"xquery-element":{pattern:/(element\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"tag"},"xquery-attribute":{pattern:/(attribute\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"attr-name"},builtin:{pattern:/(^|[^:-])\b(?:attribute|comment|document|element|processing-instruction|text|xs:(?:ENTITIES|ENTITY|ID|IDREFS?|NCName|NMTOKENS?|NOTATION|Name|QName|anyAtomicType|anyType|anyURI|base64Binary|boolean|byte|date|dateTime|dayTimeDuration|decimal|double|duration|float|gDay|gMonth|gMonthDay|gYear|gYearMonth|hexBinary|int|integer|language|long|negativeInteger|nonNegativeInteger|nonPositiveInteger|normalizedString|positiveInteger|short|string|time|token|unsigned(?:Byte|Int|Long|Short)|untyped(?:Atomic)?|yearMonthDuration))\b(?=$|[^:-])/,lookbehind:!0},number:/\b\d+(?:\.\d+)?(?:E[+-]?\d+)?/,operator:[/[+*=?|@]|\.\.?|:=|!=|<[=<]?|>[=>]?/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}],punctuation:/[[\](){},;:/]/}),t.languages.xquery.tag.pattern=/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/,t.languages.xquery.tag.inside["attr-value"].pattern=/=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+)/,t.languages.xquery.tag.inside["attr-value"].inside.punctuation=/^="|"$/,t.languages.xquery.tag.inside["attr-value"].inside.expression={pattern:/\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}/,inside:t.languages.xquery,alias:"language-xquery"};var n=function(a){return typeof a=="string"?a:typeof a.content=="string"?a.content:a.content.map(n).join("")},r=function(a){for(var i=[],s=0;s<a.length;s++){var o=a[s],u=!1;if(typeof o!="string"&&(o.type==="tag"&&o.content[0]&&o.content[0].type==="tag"?o.content[0].content[0].content==="</"?i.length>0&&i[i.length-1].tagName===n(o.content[0].content[1])&&i.pop():o.content[o.content.length-1].content==="/>"||i.push({tagName:n(o.content[0].content[1]),openedBraces:0}):i.length>0&&o.type==="punctuation"&&o.content==="{"&&(!a[s+1]||a[s+1].type!=="punctuation"||a[s+1].content!=="{")&&(!a[s-1]||a[s-1].type!=="plain-text"||a[s-1].content!=="{")?i[i.length-1].openedBraces++:i.length>0&&i[i.length-1].openedBraces>0&&o.type==="punctuation"&&o.content==="}"?i[i.length-1].openedBraces--:o.type!=="comment"&&(u=!0)),(u||typeof o=="string")&&i.length>0&&i[i.length-1].openedBraces===0){var l=n(o);s<a.length-1&&(typeof a[s+1]=="string"||a[s+1].type==="plain-text")&&(l+=n(a[s+1]),a.splice(s+1,1)),s>0&&(typeof a[s-1]=="string"||a[s-1].type==="plain-text")&&(l=n(a[s-1])+l,a.splice(s-1,1),s--),/^\s+$/.test(l)?a[s]=l:a[s]=new t.Token("plain-text",l,null,l)}o.content&&typeof o.content!="string"&&r(o.content)}};t.hooks.add("after-tokenize",function(a){a.language==="xquery"&&r(a.tokens)})})(e)}ig.displayName="yang";ig.aliases=[];function ig(e){e.languages.yang={comment:/\/\*[\s\S]*?\*\/|\/\/.*/,string:{pattern:/"(?:[^\\"]|\\.)*"|'[^']*'/,greedy:!0},keyword:{pattern:/(^|[{};\r\n][ \t]*)[a-z_][\w.-]*/i,lookbehind:!0},namespace:{pattern:/(\s)[a-z_][\w.-]*(?=:)/i,lookbehind:!0},boolean:/\b(?:false|true)\b/,operator:/\+/,punctuation:/[{};:]/}}sg.displayName="zig";sg.aliases=[];function sg(e){(function(t){function n(l){return function(){return l}}var r=/\b(?:align|allowzero|and|anyframe|anytype|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|fn|for|if|inline|linksection|nakedcc|noalias|nosuspend|null|or|orelse|packed|promise|pub|resume|return|stdcallcc|struct|suspend|switch|test|threadlocal|try|undefined|union|unreachable|usingnamespace|var|volatile|while)\b/,a="\\b(?!"+r.source+")(?!\\d)\\w+\\b",i=/align\s*\((?:[^()]|\([^()]*\))*\)/.source,s=/(?:\?|\bpromise->|(?:\[[^[\]]*\]|\*(?!\*)|\*\*)(?:\s*<ALIGN>|\s*const\b|\s*volatile\b|\s*allowzero\b)*)/.source.replace(/<ALIGN>/g,n(i)),o=/(?:\bpromise\b|(?:\berror\.)?<ID>(?:\.<ID>)*(?!\s+<ID>))/.source.replace(/<ID>/g,n(a)),u="(?!\\s)(?:!?\\s*(?:"+s+"\\s*)*"+o+")+";t.languages.zig={comment:[{pattern:/\/\/[/!].*/,alias:"doc-comment"},/\/{2}.*/],string:[{pattern:/(^|[^\\@])c?"(?:[^"\\\r\n]|\\.)*"/,lookbehind:!0,greedy:!0},{pattern:/([\r\n])([ \t]+c?\\{2}).*(?:(?:\r\n?|\n)\2.*)*/,lookbehind:!0,greedy:!0}],char:{pattern:/(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,lookbehind:!0,greedy:!0},builtin:/\B@(?!\d)\w+(?=\s*\()/,label:{pattern:/(\b(?:break|continue)\s*:\s*)\w+\b|\b(?!\d)\w+\b(?=\s*:\s*(?:\{|while\b))/,lookbehind:!0},"class-name":[/\b(?!\d)\w+(?=\s*=\s*(?:(?:extern|packed)\s+)?(?:enum|struct|union)\s*[({])/,{pattern:RegExp(/(:\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?[=;,)])|<TYPE>(?=\s*(?:<ALIGN>\s*)?\{)/.source.replace(/<TYPE>/g,n(u)).replace(/<ALIGN>/g,n(i))),lookbehind:!0,inside:null},{pattern:RegExp(/(\)\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?;)/.source.replace(/<TYPE>/g,n(u)).replace(/<ALIGN>/g,n(i))),lookbehind:!0,inside:null}],"builtin-type":{pattern:/\b(?:anyerror|bool|c_u?(?:int|long|longlong|short)|c_longdouble|c_void|comptime_(?:float|int)|f(?:16|32|64|128)|[iu](?:8|16|32|64|128|size)|noreturn|type|void)\b/,alias:"keyword"},keyword:r,function:/\b(?!\d)\w+(?=\s*\()/,number:/\b(?:0b[01]+|0o[0-7]+|0x[a-fA-F\d]+(?:\.[a-fA-F\d]*)?(?:[pP][+-]?[a-fA-F\d]+)?|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)\b/,boolean:/\b(?:false|true)\b/,operator:/\.[*?]|\.{2,3}|[-=]>|\*\*|\+\+|\|\||(?:<<|>>|[-+*]%|[-+*/%^&|<>!=])=?|[?~]/,punctuation:/[.:,;(){}[\]]/},t.languages.zig["class-name"].forEach(function(l){l.inside===null&&(l.inside=t.languages.zig)})})(e)}S.register(dn);S.register(Xr);S.register(ot);S.register(Iu);S.register(En);S.register(Sd);S.register(Ad);S.register(vd);S.register(wd);S.register(_d);S.register(Nd);S.register(Cd);S.register(Id);S.register(ai);S.register(kd);S.register(Rd);S.register(Dd);S.register(Od);S.register(or);S.register(ma);S.register(wu);S.register(Ld);S.register(Fd);S.register(Is);S.register(Rs);S.register(Ou);S.register(Md);S.register(Pd);S.register(ha);S.register(Bd);S.register(Ud);S.register(jd);S.register($d);S.register(zd);S.register(Hd);S.register(Gd);S.register(Wd);S.register(Os);S.register(Vd);S.register(qd);S.register(Yd);S.register(Zd);S.register(Kd);S.register(Xd);S.register(Qd);S.register(Jd);S.register(ep);S.register(tp);S.register(np);S.register(rp);S.register(ap);S.register(ip);S.register(sp);S.register(op);S.register(up);S.register(lp);S.register(cp);S.register(dp);S.register(pp);S.register(fp);S.register(mp);S.register(hp);S.register(gp);S.register(Ea);S.register(bp);S.register(Ep);S.register(yp);S.register(xp);S.register(Tp);S.register(Sp);S.register(Ap);S.register(vp);S.register(wp);S.register(_p);S.register(_u);S.register(yn);S.register(Np);S.register(Cp);S.register(Ip);S.register(kp);S.register(Rp);S.register(Dp);S.register(Op);S.register(Lp);S.register(Fp);S.register(Mp);S.register(ks);S.register(Pp);S.register(Bp);S.register(Up);S.register(jp);S.register($p);S.register(zp);S.register(Hp);S.register(Gp);S.register(Wp);S.register(Vp);S.register(qp);S.register(Yp);S.register(Zp);S.register(Kp);S.register(Xp);S.register(Qp);S.register(Jp);S.register(ef);S.register(tf);S.register(nf);S.register(rf);S.register(af);S.register(Nu);S.register(sf);S.register(of);S.register(uf);S.register(lf);S.register(Ru);S.register(Uu);S.register(cf);S.register(df);S.register(pf);S.register(Ms);S.register(ff);S.register(mf);S.register(hf);S.register(gf);S.register(bf);S.register(Ef);S.register(ri);S.register(yf);S.register(xf);S.register(Tf);S.register(Sf);S.register(Af);S.register(vf);S.register(wf);S.register(_f);S.register(Cu);S.register(Nf);S.register(Cf);S.register(ga);S.register(ba);S.register(ui);S.register(If);S.register(kf);S.register(Rf);S.register(Df);S.register(Of);S.register(Lf);S.register(Ff);S.register(ii);S.register(Mf);S.register(Pf);S.register(Bf);S.register(Uf);S.register(jf);S.register($f);S.register(zf);S.register(Hf);S.register(Gf);S.register(ku);S.register(Wf);S.register(Vf);S.register(qf);S.register(Yf);S.register(Ps);S.register(Zf);S.register(Kf);S.register(Xf);S.register(Qf);S.register(Jf);S.register(em);S.register(tm);S.register(nm);S.register(Du);S.register(Hu);S.register(rm);S.register(am);S.register(im);S.register(sm);S.register(om);S.register(um);S.register(lm);S.register(cm);S.register(dm);S.register(pm);S.register(fm);S.register(mm);S.register(hm);S.register(gm);S.register(bm);S.register(Em);S.register(ym);S.register(xm);S.register(Tm);S.register(Lu);S.register(Sm);S.register(Am);S.register(vm);S.register(wm);S.register(_m);S.register(Nm);S.register(Cm);S.register(Im);S.register(km);S.register(Rm);S.register(Dm);S.register(Om);S.register(Fu);S.register(Lm);S.register(Fm);S.register(Mm);S.register(Pm);S.register(Bm);S.register(Um);S.register(jm);S.register($m);S.register(zm);S.register(Hm);S.register(Gm);S.register(Wm);S.register(Vm);S.register(qm);S.register(Ym);S.register(Zm);S.register(Km);S.register(Xm);S.register(Ds);S.register(Qm);S.register(Jm);S.register(eh);S.register(th);S.register(Mu);S.register(nh);S.register(rh);S.register(Gu);S.register(ah);S.register(ih);S.register(sh);S.register(oh);S.register(uh);S.register(lh);S.register(ch);S.register(dh);S.register(ph);S.register(Pu);S.register(fh);S.register(Bu);S.register(mh);S.register(hh);S.register(gh);S.register(bh);S.register(Eh);S.register(yh);S.register(xh);S.register(Th);S.register(Wu);S.register(Sh);S.register(Ah);S.register(vh);S.register(wh);S.register(_h);S.register(Nh);S.register(Ch);S.register(Ih);S.register(ju);S.register(kh);S.register(Bs);S.register(Rh);S.register(Ls);S.register(Dh);S.register(Oh);S.register(Lh);S.register(Fh);S.register(Mh);S.register(Ph);S.register(Bh);S.register(Uh);S.register(jh);S.register($h);S.register(zh);S.register(Hh);S.register(Gh);S.register(Wh);S.register(Vh);S.register(qh);S.register(Yh);S.register(Zh);S.register(Kh);S.register(Xh);S.register(Qh);S.register(Jh);S.register(eg);S.register(tg);S.register(ng);S.register(rg);S.register(ag);S.register(ig);S.register(sg);function Dc(){Dc=function(a,i){return new n(a,void 0,i)};var e=RegExp.prototype,t=new WeakMap;function n(a,i,s){var o=new RegExp(a,i);return t.set(o,s||t.get(a)),Bo(o,n.prototype)}function r(a,i){var s=t.get(i);return Object.keys(s).reduce(function(o,u){var l=s[u];if(typeof l=="number")o[u]=a[l];else{for(var p=0;a[l[p]]===void 0&&p+1<l.length;)p++;o[u]=a[l[p]]}return o},Object.create(null))}return(function(a,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(i&&i.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),i&&Bo(a,i)})(n,RegExp),n.prototype.exec=function(a){var i=e.exec.call(this,a);if(i){i.groups=r(i,this);var s=i.indices;s&&(s.groups=r(s,this))}return i},n.prototype[Symbol.replace]=function(a,i){if(typeof i=="string"){var s=t.get(this);return e[Symbol.replace].call(this,a,i.replace(/\$<([^>]+)>/g,function(u,l){var p=s[l];return"$"+(Array.isArray(p)?p.join("$"):p)}))}if(typeof i=="function"){var o=this;return e[Symbol.replace].call(this,a,function(){var u=arguments;return typeof u[u.length-1]!="object"&&(u=[].slice.call(u)).push(r(u,o)),i.apply(this,u)})}return e[Symbol.replace].call(this,a,i)},Dc.apply(this,arguments)}function Bo(e,t){return Bo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Bo(e,t)}function tE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wl(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=(function(a,i){if(a){if(typeof a=="string")return tE(a,i);var s=Object.prototype.toString.call(a).slice(8,-1);return s==="Object"&&a.constructor&&(s=a.constructor.name),s==="Map"||s==="Set"?Array.from(a):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?tE(a,i):void 0}})(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
9
9
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var FN=function(e){return function(t){return t===void 0&&(t={}),(function(r,a){if(a&&!r.registered(a))throw new Error('The default language "'+a+'" is not registered with refractor.')})(e,t.defaultLanguage),function(r){Pn(r,"element",n)};function n(r,a,i){var s,o;if(i&&i.tagName==="pre"&&r.tagName==="code"){var u=(r==null||(s=r.data)==null?void 0:s.meta)||(r==null||(o=r.properties)==null?void 0:o.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var l,p,d=(function(R){for(var v,A=wl(R.properties.className);!(v=A()).done;){var N=v.value;if(N.slice(0,9)==="language-")return N.slice(9).toLowerCase()}return null})(r);if(!d&&t.defaultLanguage&&r.properties.className.push("language-"+(d=t.defaultLanguage)),r.properties.className.push("code-highlight"),d)try{var f,m;m=(f=d)!=null&&f.includes("diff-")?d.split("-")[1]:d,l=e.highlight(Fa(r),m),i.properties.className=(i.properties.className||[]).concat("language-"+m)}catch(R){if(!t.ignoreMissing||!/Unknown language/.test(R.message))throw R;l=r}else l=r;l.children=(p=1,function R(v){return v.reduce(function(A,N){if(N.type==="text"){var F=N.value,_=(F.match(/\n/g)||"").length;if(_===0)N.position={start:{line:p,column:1},end:{line:p,column:1}},A.push(N);else for(var M,j=F.split(`
10
10
  `),H=wl(j.entries());!(M=H()).done;){var Z=M.value,V=Z[0],ie=Z[1];A.push({type:"text",value:V===j.length-1?ie:ie+`
11
- `,position:{start:{line:p+V,column:1},end:{line:p+V,column:1}}})}return p+=_,A}if(Object.prototype.hasOwnProperty.call(N,"children")){var X=p;return N.children=R(N.children),A.push(N),N.position={start:{line:X,column:1},end:{line:p,column:1}},A}return A.push(N),A},[])})(l.children),l.position=l.children.length>0?{start:{line:l.children[0].position.start.line,column:0},end:{line:l.children[l.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var b,E=(function(R){var v=/{([\d,-]+)}/,A=R.split(",").map(function(_){return _.trim()}).join();if(v.test(A)){var N=v.exec(A)[1],F=nN(N);return function(_){return F.includes(_+1)}}return function(){return!1}})(u),y=(function(R){var v=Dc(/showLineNumbers=(\d+)/i,{lines:1});if(v.test(R)){var A=v.exec(R);return Number(A.groups.lines)}return 1})(u),x=(function(R){for(var v=new Array(R),A=0;A<R;A++)v[A]={type:"element",tagName:"span",properties:{className:[]},children:[]};return v})(l.position.end.line),w=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],T=function(){var R,v,A=b.value,N=A[0],F=A[1];F.properties.className=["code-line"];var _=Q_(l,function(M){return M.position.start.line<=N+1&&M.position.end.line>=N+1});F.children=_.children,(u.toLowerCase().includes("showLineNumbers".toLowerCase())||t.showLineNumbers===!0||typeof t.showLineNumbers=="object"&&t.showLineNumbers.includes(d))&&!w.some(function(M){return u.toLowerCase().includes(M)})&&(F.properties.line=[(N+y).toString()],F.properties.className.push("line-number")),E(N)&&F.properties.className.push("highlight-line"),(d==="diff"||(R=d)!=null&&R.includes("diff-"))&&Fa(F).substring(0,1)==="-"?F.properties.className.push("deleted"):(d==="diff"||(v=d)!=null&&v.includes("diff-"))&&Fa(F).substring(0,1)==="+"&&F.properties.className.push("inserted")},I=wl(x.entries());!(b=I()).done;)T();x.length>0&&Fa(x[x.length-1]).trim()===""&&x.pop(),r.children=x}}}},aT=FN(S),No={},Oc={};function MN(e,t){for(var n=t,r=0;r<e.length;r++){var a=r===e.length-1,i=e.charAt(r),s=n[i]||(n[i]={chars:{}});a&&(s.self=e),n=s.chars}}function nE(e){if(e.length===0)return No;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];MN(a,t)}return t}function PN(e){if(e.length===0)return Oc;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];t[a]=!0}return t}var no={},rE={type:"String",optional:!0};function BN(e){var t={type:"NoArgument",optional:!1};function n(s){if(t.type&&t.type!==s&&t.type!=="NoArgument")throw new Error('Conflicting pseudo-class argument type: "'.concat(t.type,'" vs "').concat(s,'".'));t.type=s}for(var r=0,a=e;r<a.length;r++){var i=a[r];i==="NoArgument"&&(t.optional=!0),i==="Formula"&&n("Formula"),i==="FormulaOfSelector"&&(n("Formula"),t.ofSelector=!0),i==="String"&&n("String"),i==="Selector"&&n("Selector")}return t}function UN(e){for(var t={},n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],i=e[a];if(i)for(var s=0,o=i;s<o.length;s++){var u=o[s];(t[u]||(t[u]=[])).push(a)}}return t}function aE(e){for(var t=UN(e),n={},r=0,a=Object.keys(t);r<a.length;r++){var i=a[r],s=t[i];s&&(n[i]=BN(s))}return n}var qa=function(){return qa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},qa.apply(this,arguments)},jN={},Lc={wildcard:!0};function $N(e){return e?typeof e=="boolean"?Lc:e:jN}function zN(e,t){return function(n,r){return t(e(n),e(r))}}function HN(e){return function(t,n){var r=e(t,n);if(!r)throw new Error("Syntax definition cannot be null or undefined.");return r}}function iE(e,t){return function(n,r){return r===!0?e:t(n===!0?e:n,r)}}function _a(e){return function(t,n){if(!n||!t)return n;if(typeof n!="object"||n===null)throw new Error("Unexpected syntax definition extension type: ".concat(n,"."));for(var r=qa({},t),a=0,i=Object.entries(n);a<i.length;a++){var s=i[a],o=s[0],u=s[1];if(o!=="latest"){var l=e[o];r[o]=l(t[o],u)}}return r}}function dr(e,t){return t!==void 0?t:e}function ro(e,t){return t?e?e.concat(t):t:e}function sE(e,t){if(!t)return e;if(!e)return t;for(var n=qa({},e),r=0,a=Object.entries(t);r<a.length;r++){var i=a[r],s=i[0],o=i[1];if(!o){delete n[s];continue}var u=e[s];if(!u){n[s]=o;continue}n[s]=u.concat(o)}return n}var ia=HN(_a({baseSyntax:dr,modules:ro,tag:iE(Lc,_a({wildcard:dr})),ids:dr,classNames:dr,nestingSelector:dr,namespace:iE(Lc,_a({wildcard:dr})),combinators:ro,attributes:_a({operators:ro,caseSensitivityModifiers:ro,unknownCaseSensitivityModifiers:dr}),pseudoClasses:_a({unknown:dr,definitions:sE}),pseudoElements:_a({unknown:dr,notation:dr,definitions:zN(function(e){return Array.isArray(e)?{NoArgument:e}:e},sE)})})),iT={tag:{},ids:!0,classNames:!0,combinators:[],pseudoElements:{unknown:"reject",notation:"singleColon",definitions:["first-letter","first-line"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["link","visited","active"]}}},sT=ia(iT,{tag:{wildcard:!0},combinators:[">","+"],attributes:{unknownCaseSensitivityModifiers:"reject",operators:["=","~=","|="]},pseudoElements:{definitions:["before","after"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["hover","focus","first-child"],String:["lang"]}}}),Fc=ia(sT,{namespace:{wildcard:!0},combinators:["~"],attributes:{operators:["^=","$=","*="]},pseudoElements:{notation:"both"},pseudoClasses:{definitions:{NoArgument:["root","last-child","first-of-type","last-of-type","only-child","only-of-type","empty","target","enabled","disabled","checked","indeterminate"],Formula:["nth-child","nth-last-child","nth-of-type","nth-last-of-type"],Selector:["not"]}}}),oT=ia(Fc,{combinators:["||"],attributes:{caseSensitivityModifiers:["i","I","s","S"]},pseudoClasses:{definitions:{NoArgument:["any-link","local-link","target-within","scope","current","past","future","focus-within","focus-visible","read-write","read-only","placeholder-shown","default","valid","invalid","in-range","out-of-range","required","optional","blank","user-invalid","playing","paused","autofill","modal","fullscreen","picture-in-picture","defined","loading","popover-open"],Formula:["nth-col","nth-last-col"],String:["dir"],FormulaOfSelector:["nth-child","nth-last-child"],Selector:["current","is","where","has","state"]}},pseudoElements:{definitions:{NoArgument:["marker"]}}}),Uo={"css-position-1":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute"]}}},"css-position-2":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute","fixed"]}}},"css-position-3":{latest:!1,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static"]}}},"css-position-4":{latest:!0,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static","initial"]}}},"css-scoping-1":{latest:!0,pseudoClasses:{definitions:{NoArgument:["host","host-context"],Selector:["host","host-context"]}},pseudoElements:{definitions:{Selector:["slotted"]}}},"css-pseudo-4":{latest:!0,pseudoElements:{definitions:{NoArgument:["marker","selection","target-text","search-text","spelling-error","grammar-error","backdrop","file-selector-button","prefix","postfix","placeholder","details-content"],String:["highlight"]}}},"css-shadow-parts-1":{latest:!0,pseudoElements:{definitions:{String:["part"]}}},"css-nesting-1":{latest:!0,nestingSelector:!0}},uT=qa(qa({},oT),{modules:Object.entries(Uo).filter(function(e){var t=e[1].latest;return t}).map(function(e){var t=e[0];return t})}),GN=ia(uT,{pseudoElements:{unknown:"accept"},pseudoClasses:{unknown:"accept"},attributes:{unknownCaseSensitivityModifiers:"accept"}}),Mc={css1:iT,css2:sT,css3:Fc,"selectors-3":Fc,"selectors-4":oT,latest:uT,progressive:GN};function WN(){for(var e={pseudoClasses:{},pseudoElements:{}},t=["css1","css2","css3","selectors-3","selectors-4"],n=0,r=t;n<r.length;n++){var a=r[n],i=Mc[a];if(i.pseudoClasses&&typeof i.pseudoClasses=="object"){var s=i.pseudoClasses.definitions;if(s)for(var o=0,u=Object.entries(s);o<u.length;o++)for(var l=u[o],p=l[1],d=0,f=p;d<f.length;d++){var m=f[d];e.pseudoClasses[m]||(e.pseudoClasses[m]=[]),e.pseudoClasses[m].includes(a)||e.pseudoClasses[m].push(a)}}if(i.pseudoElements&&typeof i.pseudoElements=="object"){var s=i.pseudoElements.definitions;if(s)if(Array.isArray(s))for(var b=0,E=s;b<E.length;b++){var y=E[b];e.pseudoElements[y]||(e.pseudoElements[y]=[]),e.pseudoElements[y].includes(a)||e.pseudoElements[y].push(a)}else for(var x=0,w=Object.values(s);x<w.length;x++)for(var p=w[x],T=0,I=p;T<I.length;T++){var R=I[T];e.pseudoElements[R]||(e.pseudoElements[R]=[]),e.pseudoElements[R].includes(a)||e.pseudoElements[R].push(a)}}}for(var v=0,A=Object.entries(Uo);v<A.length;v++){var N=A[v],F=N[0],_=N[1];if(_.pseudoClasses&&typeof _.pseudoClasses=="object"){var s=_.pseudoClasses.definitions;if(s)for(var M=0,j=Object.values(s);M<j.length;M++)for(var p=j[M],H=0,Z=p;H<Z.length;H++){var V=Z[H];e.pseudoClasses[V]||(e.pseudoClasses[V]=[]),e.pseudoClasses[V].includes(F)||e.pseudoClasses[V].push(F)}}if(_.pseudoElements&&typeof _.pseudoElements=="object"){var s=_.pseudoElements.definitions;if(s)if(Array.isArray(s))for(var ie=0,X=s;ie<X.length;ie++){var re=X[ie];e.pseudoElements[re]||(e.pseudoElements[re]=[]),e.pseudoElements[re].includes(F)||e.pseudoElements[re].push(F)}else for(var ue=0,k=Object.values(s);ue<k.length;ue++)for(var p=k[ue],Y=0,le=p;Y<le.length;Y++){var D=le[Y];e.pseudoElements[D]||(e.pseudoElements[D]=[]),e.pseudoElements[D].includes(F)||e.pseudoElements[D].push(F)}}}return e}var oE=WN();function Ni(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="-"||e==="_"||e==="\\"||e>=" "}function uE(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="-"||e==="_"||e>=" "}function Ci(e){return e>="a"&&e<="f"||e>="A"&&e<="F"||e>="0"&&e<="9"}var VN={" ":!0," ":!0,"\n":!0,"\r":!0,"\f":!0},qN={'"':!0,"'":!0},_l={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0},YN=6,Nl="css-selector-parser parse error: ";function ZN(e){e===void 0&&(e={});var t=e.syntax,n=t===void 0?"latest":t,r=e.substitutes,a=e.strict,i=a===void 0?!0:a,s=e.modules,o=typeof n=="object"?n:Mc[n];if(o.baseSyntax&&(o=ia(Mc[o.baseSyntax],o)),o.modules&&o.modules.length>0)for(var u=0,l=o.modules;u<l.length;u++){var p=l[u],d=Uo[p];d&&(o=ia(d,o))}if(s&&s.length>0)for(var f=0,m=s;f<m.length;f++){var b=m[f],d=Uo[b];d&&(o=ia(d,o))}var E=o.tag?[!0,!!$N(o.tag).wildcard]:[!1,!1],y=E[0],x=E[1],w=!!o.ids,T=!!o.classNames,I=!!o.nestingSelector,R=!!o.namespace,v=o.namespace&&(o.namespace===!0||o.namespace.wildcard===!0);if(R&&!y)throw new Error("".concat(Nl,"Namespaces cannot be enabled while tags are disabled."));var A=!!r,N=o.combinators?nE(o.combinators):No,F=o.attributes?[!0,o.attributes.operators?nE(o.attributes.operators):No,o.attributes.caseSensitivityModifiers?PN(o.attributes.caseSensitivityModifiers):Oc,o.attributes.unknownCaseSensitivityModifiers==="accept"]:[!1,No,Oc,!1],_=F[0],M=F[1],j=F[2],H=F[3],Z=H||Object.keys(j).length>0,V=o.pseudoClasses?[!0,o.pseudoClasses.definitions?aE(o.pseudoClasses.definitions):no,o.pseudoClasses.unknown==="accept"]:[!1,no,!1],ie=V[0],X=V[1],re=V[2],ue=o.pseudoElements?[!0,o.pseudoElements.notation==="singleColon"||o.pseudoElements.notation==="both",!o.pseudoElements.notation||o.pseudoElements.notation==="doubleColon"||o.pseudoElements.notation==="both",o.pseudoElements.definitions?aE(Array.isArray(o.pseudoElements.definitions)?{NoArgument:o.pseudoElements.definitions}:o.pseudoElements.definitions):no,o.pseudoElements.unknown==="accept"]:[!1,!1,!1,no,!1],k=ue[0],Y=ue[1],le=ue[2],D=ue[3],ke=ue[4],Le="",ve=Le.length,Ue=0,Ee="",he=function(J){return Ee===J},ct=function(){return he("*")||Ni(Ee)},$e=function(J){Ue=J,Ee=Le.charAt(Ue)},ge=function(){Ue++,Ee=Le.charAt(Ue)},Pe=function(){var J=Ee;return Ue++,Ee=Le.charAt(Ue),J};function pt(J){var be=Math.min(ve-1,Ue),Fe=new Error("".concat(Nl).concat(J," Pos: ").concat(be,"."));throw Fe.position=be,Fe.name="ParserError",Fe}function de(J,be){if(!J)return pt(be)}var rt=function(){de(Ue<ve,"Unexpected end of input.")},Ot=function(){return Ue>=ve},ft=function(J){de(Ue<ve,'Expected "'.concat(J,'" but end of input reached.')),de(Ee===J,'Expected "'.concat(J,'" but "').concat(Ee,'" found.')),Ue++,Ee=Le.charAt(Ue)};function kt(J){var be=wt(J,Ue);if(be)return Ue+=be.length,Ee=Le.charAt(Ue),be}function wt(J,be){var Fe=Le.charAt(be),Re=J[Fe];if(Re){var xt=wt(Re.chars,be+1);if(xt)return xt;if(Re.self)return Re.self}}function zt(){for(var J=Pe(),be=1;Ci(Ee)&&be<YN;)J+=Pe(),be++;return Ye(),String.fromCharCode(parseInt(J,16))}function nn(J){var be="";for(ft(J);Ue<ve;){if(he(J))return ge(),be;he("\\")?(ge(),he(J)?(be+=J,ge()):Ee===`
11
+ `,position:{start:{line:p+V,column:1},end:{line:p+V,column:1}}})}return p+=_,A}if(Object.prototype.hasOwnProperty.call(N,"children")){var X=p;return N.children=R(N.children),A.push(N),N.position={start:{line:X,column:1},end:{line:p,column:1}},A}return A.push(N),A},[])})(l.children),l.position=l.children.length>0?{start:{line:l.children[0].position.start.line,column:0},end:{line:l.children[l.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var b,E=(function(R){var v=/{([\d,-]+)}/,A=R.split(",").map(function(_){return _.trim()}).join();if(v.test(A)){var N=v.exec(A)[1],F=nN(N);return function(_){return F.includes(_+1)}}return function(){return!1}})(u),y=(function(R){var v=Dc(/showLineNumbers=(\d+)/i,{lines:1});if(v.test(R)){var A=v.exec(R);return Number(A.groups.lines)}return 1})(u),x=(function(R){for(var v=new Array(R),A=0;A<R;A++)v[A]={type:"element",tagName:"span",properties:{className:[]},children:[]};return v})(l.position.end.line),w=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],T=function(){var R,v,A=b.value,N=A[0],F=A[1];F.properties.className=["code-line"];var _=Q_(l,function(M){return M.position.start.line<=N+1&&M.position.end.line>=N+1});F.children=_.children,(u.toLowerCase().includes("showLineNumbers".toLowerCase())||t.showLineNumbers===!0||typeof t.showLineNumbers=="object"&&t.showLineNumbers.includes(d))&&!w.some(function(M){return u.toLowerCase().includes(M)})&&(F.properties.line=[(N+y).toString()],F.properties.className.push("line-number")),E(N)&&F.properties.className.push("highlight-line"),(d==="diff"||(R=d)!=null&&R.includes("diff-"))&&Fa(F).substring(0,1)==="-"?F.properties.className.push("deleted"):(d==="diff"||(v=d)!=null&&v.includes("diff-"))&&Fa(F).substring(0,1)==="+"&&F.properties.className.push("inserted")},I=wl(x.entries());!(b=I()).done;)T();x.length>0&&Fa(x[x.length-1]).trim()===""&&x.pop(),r.children=x}}}},aT=FN(S),No={},Oc={};function MN(e,t){for(var n=t,r=0;r<e.length;r++){var a=r===e.length-1,i=e.charAt(r),s=n[i]||(n[i]={chars:{}});a&&(s.self=e),n=s.chars}}function nE(e){if(e.length===0)return No;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];MN(a,t)}return t}function PN(e){if(e.length===0)return Oc;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];t[a]=!0}return t}var no={},rE={type:"String",optional:!0};function BN(e){var t={type:"NoArgument",optional:!1};function n(s){if(t.type&&t.type!==s&&t.type!=="NoArgument")throw new Error('Conflicting pseudo-class argument type: "'.concat(t.type,'" vs "').concat(s,'".'));t.type=s}for(var r=0,a=e;r<a.length;r++){var i=a[r];i==="NoArgument"&&(t.optional=!0),i==="Formula"&&n("Formula"),i==="FormulaOfSelector"&&(n("Formula"),t.ofSelector=!0),i==="String"&&n("String"),i==="Selector"&&n("Selector")}return t}function UN(e){for(var t={},n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],i=e[a];if(i)for(var s=0,o=i;s<o.length;s++){var u=o[s];(t[u]||(t[u]=[])).push(a)}}return t}function aE(e){for(var t=UN(e),n={},r=0,a=Object.keys(t);r<a.length;r++){var i=a[r],s=t[i];s&&(n[i]=BN(s))}return n}var qa=function(){return qa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},qa.apply(this,arguments)},jN={},Lc={wildcard:!0};function $N(e){return e?typeof e=="boolean"?Lc:e:jN}function zN(e,t){return function(n,r){return t(e(n),e(r))}}function HN(e){return function(t,n){var r=e(t,n);if(!r)throw new Error("Syntax definition cannot be null or undefined.");return r}}function iE(e,t){return function(n,r){return r===!0?e:t(n===!0?e:n,r)}}function _a(e){return function(t,n){if(!n||!t)return n;if(typeof n!="object"||n===null)throw new Error("Unexpected syntax definition extension type: ".concat(n,"."));for(var r=qa({},t),a=0,i=Object.entries(n);a<i.length;a++){var s=i[a],o=s[0],u=s[1];if(o!=="latest"){var l=e[o];r[o]=l(t[o],u)}}return r}}function dr(e,t){return t!==void 0?t:e}function ro(e,t){return t?e?e.concat(t):t:e}function sE(e,t){if(!t)return e;if(!e)return t;for(var n=qa({},e),r=0,a=Object.entries(t);r<a.length;r++){var i=a[r],s=i[0],o=i[1];if(!o){delete n[s];continue}var u=e[s];if(!u){n[s]=o;continue}n[s]=u.concat(o)}return n}var ia=HN(_a({baseSyntax:dr,modules:ro,tag:iE(Lc,_a({wildcard:dr})),ids:dr,classNames:dr,nestingSelector:dr,namespace:iE(Lc,_a({wildcard:dr})),combinators:ro,attributes:_a({operators:ro,caseSensitivityModifiers:ro,unknownCaseSensitivityModifiers:dr}),pseudoClasses:_a({unknown:dr,definitions:sE}),pseudoElements:_a({unknown:dr,notation:dr,definitions:zN(function(e){return Array.isArray(e)?{NoArgument:e}:e},sE)})})),iT={tag:{},ids:!0,classNames:!0,combinators:[],pseudoElements:{unknown:"reject",notation:"singleColon",definitions:["first-letter","first-line"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["link","visited","active"]}}},sT=ia(iT,{tag:{wildcard:!0},combinators:[">","+"],attributes:{unknownCaseSensitivityModifiers:"reject",operators:["=","~=","|="]},pseudoElements:{definitions:["before","after"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["hover","focus","first-child"],String:["lang"]}}}),Fc=ia(sT,{namespace:{wildcard:!0},combinators:["~"],attributes:{operators:["^=","$=","*="]},pseudoElements:{notation:"both"},pseudoClasses:{definitions:{NoArgument:["root","last-child","first-of-type","last-of-type","only-child","only-of-type","empty","target","enabled","disabled","checked","indeterminate"],Formula:["nth-child","nth-last-child","nth-of-type","nth-last-of-type"],Selector:["not"]}}}),oT=ia(Fc,{combinators:["||"],attributes:{caseSensitivityModifiers:["i","I","s","S"]},pseudoClasses:{definitions:{NoArgument:["any-link","local-link","target-within","scope","current","past","future","focus-within","focus-visible","read-write","read-only","placeholder-shown","default","valid","invalid","in-range","out-of-range","required","optional","blank","user-invalid","playing","paused","autofill","modal","fullscreen","picture-in-picture","defined","loading","popover-open"],Formula:["nth-col","nth-last-col"],String:["dir"],FormulaOfSelector:["nth-child","nth-last-child"],Selector:["current","is","where","has","state"]}},pseudoElements:{definitions:{NoArgument:["marker"]}}}),Uo={"css-position-1":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute"]}}},"css-position-2":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute","fixed"]}}},"css-position-3":{latest:!1,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static"]}}},"css-position-4":{latest:!0,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static","initial"]}}},"css-scoping-1":{latest:!0,pseudoClasses:{definitions:{NoArgument:["host","host-context"],Selector:["host","host-context"]}},pseudoElements:{definitions:{Selector:["slotted"]}}},"css-pseudo-4":{latest:!0,pseudoElements:{definitions:{NoArgument:["marker","selection","target-text","search-text","spelling-error","grammar-error","backdrop","file-selector-button","prefix","postfix","placeholder","details-content"],String:["highlight"]}}},"css-shadow-parts-1":{latest:!0,pseudoElements:{definitions:{String:["part"]}}},"css-nesting-1":{latest:!0,nestingSelector:!0}},uT=qa(qa({},oT),{modules:Object.entries(Uo).filter(function(e){var t=e[1].latest;return t}).map(function(e){var t=e[0];return t})}),GN=ia(uT,{pseudoElements:{unknown:"accept"},pseudoClasses:{unknown:"accept"},attributes:{unknownCaseSensitivityModifiers:"accept"}}),Mc={css1:iT,css2:sT,css3:Fc,"selectors-3":Fc,"selectors-4":oT,latest:uT,progressive:GN};function WN(){for(var e={pseudoClasses:{},pseudoElements:{}},t=["css1","css2","css3","selectors-3","selectors-4"],n=0,r=t;n<r.length;n++){var a=r[n],i=Mc[a];if(i.pseudoClasses&&typeof i.pseudoClasses=="object"){var s=i.pseudoClasses.definitions;if(s)for(var o=0,u=Object.entries(s);o<u.length;o++)for(var l=u[o],p=l[1],d=0,f=p;d<f.length;d++){var m=f[d];e.pseudoClasses[m]||(e.pseudoClasses[m]=[]),e.pseudoClasses[m].includes(a)||e.pseudoClasses[m].push(a)}}if(i.pseudoElements&&typeof i.pseudoElements=="object"){var s=i.pseudoElements.definitions;if(s)if(Array.isArray(s))for(var b=0,E=s;b<E.length;b++){var y=E[b];e.pseudoElements[y]||(e.pseudoElements[y]=[]),e.pseudoElements[y].includes(a)||e.pseudoElements[y].push(a)}else for(var x=0,w=Object.values(s);x<w.length;x++)for(var p=w[x],T=0,I=p;T<I.length;T++){var R=I[T];e.pseudoElements[R]||(e.pseudoElements[R]=[]),e.pseudoElements[R].includes(a)||e.pseudoElements[R].push(a)}}}for(var v=0,A=Object.entries(Uo);v<A.length;v++){var N=A[v],F=N[0],_=N[1];if(_.pseudoClasses&&typeof _.pseudoClasses=="object"){var s=_.pseudoClasses.definitions;if(s)for(var M=0,j=Object.values(s);M<j.length;M++)for(var p=j[M],H=0,Z=p;H<Z.length;H++){var V=Z[H];e.pseudoClasses[V]||(e.pseudoClasses[V]=[]),e.pseudoClasses[V].includes(F)||e.pseudoClasses[V].push(F)}}if(_.pseudoElements&&typeof _.pseudoElements=="object"){var s=_.pseudoElements.definitions;if(s)if(Array.isArray(s))for(var ie=0,X=s;ie<X.length;ie++){var re=X[ie];e.pseudoElements[re]||(e.pseudoElements[re]=[]),e.pseudoElements[re].includes(F)||e.pseudoElements[re].push(F)}else for(var ue=0,k=Object.values(s);ue<k.length;ue++)for(var p=k[ue],Y=0,le=p;Y<le.length;Y++){var D=le[Y];e.pseudoElements[D]||(e.pseudoElements[D]=[]),e.pseudoElements[D].includes(F)||e.pseudoElements[D].push(F)}}}return e}var oE=WN();function Ni(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="-"||e==="_"||e==="\\"||e>=" "}function uE(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="-"||e==="_"||e>=" "}function Ci(e){return e>="a"&&e<="f"||e>="A"&&e<="F"||e>="0"&&e<="9"}var VN={" ":!0," ":!0,"\n":!0,"\r":!0,"\f":!0},qN={'"':!0,"'":!0},_l={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0},YN=6,Nl="css-selector-parser parse error: ";function ZN(e){e===void 0&&(e={});var t=e.syntax,n=t===void 0?"latest":t,r=e.substitutes,a=e.strict,i=a===void 0?!0:a,s=e.modules,o=typeof n=="object"?n:Mc[n];if(o.baseSyntax&&(o=ia(Mc[o.baseSyntax],o)),o.modules&&o.modules.length>0)for(var u=0,l=o.modules;u<l.length;u++){var p=l[u],d=Uo[p];d&&(o=ia(d,o))}if(s&&s.length>0)for(var f=0,m=s;f<m.length;f++){var b=m[f],d=Uo[b];d&&(o=ia(d,o))}var E=o.tag?[!0,!!$N(o.tag).wildcard]:[!1,!1],y=E[0],x=E[1],w=!!o.ids,T=!!o.classNames,I=!!o.nestingSelector,R=!!o.namespace,v=o.namespace&&(o.namespace===!0||o.namespace.wildcard===!0);if(R&&!y)throw new Error("".concat(Nl,"Namespaces cannot be enabled while tags are disabled."));var A=!!r,N=o.combinators?nE(o.combinators):No,F=o.attributes?[!0,o.attributes.operators?nE(o.attributes.operators):No,o.attributes.caseSensitivityModifiers?PN(o.attributes.caseSensitivityModifiers):Oc,o.attributes.unknownCaseSensitivityModifiers==="accept"]:[!1,No,Oc,!1],_=F[0],M=F[1],j=F[2],H=F[3],Z=H||Object.keys(j).length>0,V=o.pseudoClasses?[!0,o.pseudoClasses.definitions?aE(o.pseudoClasses.definitions):no,o.pseudoClasses.unknown==="accept"]:[!1,no,!1],ie=V[0],X=V[1],re=V[2],ue=o.pseudoElements?[!0,o.pseudoElements.notation==="singleColon"||o.pseudoElements.notation==="both",!o.pseudoElements.notation||o.pseudoElements.notation==="doubleColon"||o.pseudoElements.notation==="both",o.pseudoElements.definitions?aE(Array.isArray(o.pseudoElements.definitions)?{NoArgument:o.pseudoElements.definitions}:o.pseudoElements.definitions):no,o.pseudoElements.unknown==="accept"]:[!1,!1,!1,no,!1],k=ue[0],Y=ue[1],le=ue[2],D=ue[3],ke=ue[4],Le="",ve=Le.length,Ue=0,Ee="",he=function(J){return Ee===J},ct=function(){return he("*")||Ni(Ee)},$e=function(J){Ue=J,Ee=Le.charAt(Ue)},ge=function(){Ue++,Ee=Le.charAt(Ue)},Pe=function(){var J=Ee;return Ue++,Ee=Le.charAt(Ue),J};function pt(J){var be=Math.min(ve-1,Ue),Fe=new Error("".concat(Nl).concat(J," Pos: ").concat(be,"."));throw Fe.position=be,Fe.name="ParserError",Fe}function de(J,be){if(!J)return pt(be)}var rt=function(){de(Ue<ve,"Unexpected end of input.")},Ot=function(){return Ue>=ve},ft=function(J){de(Ue<ve,'Expected "'.concat(J,'" but end of input reached.')),de(Ee===J,'Expected "'.concat(J,'" but "').concat(Ee,'" found.')),Ue++,Ee=Le.charAt(Ue)};function kt(J){var be=wt(J,Ue);if(be)return Ue+=be.length,Ee=Le.charAt(Ue),be}function wt(J,be){var Fe=Le.charAt(be),Re=J[Fe];if(Re){var Tt=wt(Re.chars,be+1);if(Tt)return Tt;if(Re.self)return Re.self}}function zt(){for(var J=Pe(),be=1;Ci(Ee)&&be<YN;)J+=Pe(),be++;return Ye(),String.fromCharCode(parseInt(J,16))}function nn(J){var be="";for(ft(J);Ue<ve;){if(he(J))return ge(),be;he("\\")?(ge(),he(J)?(be+=J,ge()):Ee===`
12
12
  `||Ee==="\f"?ge():Ee==="\r"?(ge(),he(`
13
13
  `)&&ge()):Ci(Ee)?be+=zt():(be+=Ee,ge())):(be+=Ee,ge())}return be}function ut(){if(!Ni(Ee))return null;for(var J="";he("-");)J+=Ee,ge();for(J==="-"&&!uE(Ee)&&!he("\\")&&pt("Identifiers cannot consist of a single hyphen."),i&&J.length>=2&&pt("Identifiers cannot start with two hyphens with strict mode on."),_l[Ee]&&pt("Identifiers cannot start with hyphens followed by digits.");Ue<ve;)if(uE(Ee))J+=Pe();else if(he("\\"))ge(),rt(),Ci(Ee)?J+=zt():J+=Pe();else break;return J}function Ae(){for(var J="";Ue<ve&&!he(")");)if(he("\\")){if(ge(),Ot()&&!i)return(J+"\\").trim();rt(),Ci(Ee)?J+=zt():J+=Pe()}else J+=Pe();return J.trim()}function Ye(){if(Ee===" "||Ee===" "||Ee==="\f"||Ee===`
14
14
  `){ge();return}Ee==="\r"&&ge(),Ee===`
15
- `&&ge()}function q(){for(;VN[Ee];)ge()}function te(J){J===void 0&&(J=!1),q();for(var be=[Nt(J)];he(",");)ge(),q(),be.push(Nt(J));return{type:"Selector",rules:be}}function ye(){ft("["),q();var J;if(he("|")){de(R,"Namespaces are not enabled."),ge();var be=ut();de(be,"Expected attribute name."),J={type:"Attribute",name:be,namespace:{type:"NoNamespace"}}}else if(he("*")){de(R,"Namespaces are not enabled."),de(v,"Wildcard namespace is not enabled."),ge(),ft("|");var Fe=ut();de(Fe,"Expected attribute name."),J={type:"Attribute",name:Fe,namespace:{type:"WildcardNamespace"}}}else{var Re=ut();if(de(Re,"Expected attribute name."),J={type:"Attribute",name:Re},he("|")){var xt=Ue;if(ge(),Ni(Ee)){de(R,"Namespaces are not enabled.");var Wt=ut();de(Wt,"Expected attribute name."),J={type:"Attribute",name:Wt,namespace:{type:"NamespaceName",name:Re}}}else $e(xt)}}if(de(J.name,"Expected attribute name."),q(),Ot()&&!i)return J;if(he("]"))ge();else{if(J.operator=kt(M),de(J.operator,"Expected a valid attribute selector operator."),q(),rt(),qN[Ee])J.value={type:"String",value:nn(Ee)};else if(A&&he("$")){ge();var U=ut();de(U,"Expected substitute name."),J.value={type:"Substitution",name:U}}else{var Te=ut();de(Te,"Expected attribute value."),J.value={type:"String",value:Te}}if(q(),Ot()&&!i)return J;if(!he("]")){var Ne=ut();if(de(Ne,"Expected end of attribute selector."),J.caseSensitivityModifier=Ne,de(Z,"Attribute case sensitivity modifiers are not enabled."),de(H||j[J.caseSensitivityModifier],"Unknown attribute case sensitivity modifier."),q(),Ot()&&!i)return J}ft("]")}return J}function we(){for(var J="";_l[Ee];)J+=Pe();return de(J!=="","Formula parse error."),parseInt(J)}var je=function(){return he("-")||he("+")||_l[Ee]};function Ze(){if(he("e")||he("o")){var J=ut();if(J==="even")return q(),[2,0];if(J==="odd")return q(),[2,1]}var be=null,Fe=1;if(he("-")&&(ge(),Fe=-1),je()&&(he("+")&&ge(),be=we(),!he("\\")&&!he("n")))return[0,be*Fe];be===null&&(be=1),be*=Fe;var Re;if(he("\\")?(ge(),Ci(Ee)?Re=zt():Re=Pe()):Re=Pe(),de(Re==="n",'Formula parse error: expected "n".'),q(),he("+")||he("-")){var xt=he("+")?1:-1;return ge(),q(),[be,xt*we()]}else return[be,0]}function _t(J,be,Fe){var Re;if(he("(")){if(ge(),q(),A&&he("$")){ge();var xt=ut();de(xt,"Expected substitute name."),Re={type:"Substitution",name:xt}}else if(Fe.type==="String")Re={type:"String",value:Ae()},de(Re.value,"Expected ".concat(be," argument value."));else if(Fe.type==="Selector")Re=te(!0);else if(Fe.type==="Formula"){var Wt=Ze(),U=Wt[0],Te=Wt[1];if(Re={type:"Formula",a:U,b:Te},Fe.ofSelector&&(q(),he("o")||he("\\"))){var Ne=ut();de(Ne==="of","Formula of selector parse error."),q(),Re={type:"FormulaOfSelector",a:U,b:Te,selector:Nt()}}}else return pt("Invalid ".concat(be," signature."));if(q(),Ot()&&!i)return Re;ft(")")}else de(Fe.optional,"Argument is required for ".concat(be,' "').concat(J,'".'));return Re}function St(){if(he("*"))return de(x,"Wildcard tag name is not enabled."),ge(),{type:"WildcardTag"};if(Ni(Ee)){de(y,"Tag names are not enabled.");var J=ut();return de(J,"Expected tag name."),{type:"TagName",name:J}}else return pt("Expected tag name.")}function Et(){if(he("*")){var J=Ue;if(ge(),!he("|")||(ge(),!ct()))return $e(J),St();de(R,"Namespaces are not enabled."),de(v,"Wildcard namespace is not enabled.");var be=St();return be.namespace={type:"WildcardNamespace"},be}else if(he("|")){de(R,"Namespaces are not enabled."),ge();var be=St();return be.namespace={type:"NoNamespace"},be}else if(Ni(Ee)){var Fe=ut();if(de(Fe,"Expected tag name."),!he("|"))return de(y,"Tag names are not enabled."),{type:"TagName",name:Fe};var J=Ue;if(ge(),!ct())return $e(J),{type:"TagName",name:Fe};de(R,"Namespaces are not enabled.");var be=St();return be.namespace={type:"NamespaceName",name:Fe},be}else return pt("Expected tag name.")}function Nt(J){var be,Fe;J===void 0&&(J=!1);var Re={type:"Rule",items:[]};if(J){var xt=kt(N);xt&&(Re.combinator=xt,q())}for(;Ue<ve;)if(ct())de(Re.items.length===0,"Unexpected tag/namespace start."),Re.items.push(Et());else if(he("|")){var Wt=Ue;if(ge(),ct())de(Re.items.length===0,"Unexpected tag/namespace start."),$e(Wt),Re.items.push(Et());else{$e(Wt);break}}else if(he(".")){de(T,"Class names are not enabled."),ge();var U=ut();de(U,"Expected class name."),Re.items.push({type:"ClassName",name:U})}else if(he("#")){de(w,"IDs are not enabled."),ge();var Te=ut();de(Te,"Expected ID name."),Re.items.push({type:"Id",name:Te})}else if(he("&"))de(I,"Nesting selector is not enabled."),ge(),Re.items.push({type:"NestingSelector"});else if(he("["))de(_,"Attributes are not enabled."),Re.items.push(ye());else if(he(":")){var Ne=!1,ze=!1;ge(),he(":")&&(de(k,"Pseudo elements are not enabled."),de(le,"Pseudo elements double colon notation is not enabled."),Ne=!0,ge());var Xe=ut();if(de(Ne||Xe,"Expected pseudo-class name."),de(!Ne||Xe,"Expected pseudo-element name."),de(Xe,"Expected pseudo-class name."),!(!Ne||ke||Object.prototype.hasOwnProperty.call(D,Xe))){var Ve=oE.pseudoElements[Xe],At='Unknown pseudo-element "'.concat(Xe,'"');Ve&&Ve.length>0&&(At+=". It is defined in: ".concat(Ve.join(", "))),pt(At+".")}if(ze=k&&(Ne||!Ne&&Y&&Object.prototype.hasOwnProperty.call(D,Xe)),ze){var rn=(be=D[Xe])!==null&&be!==void 0?be:ke&&rE,Rt={type:"PseudoElement",name:Xe},Vt=_t(Xe,"pseudo-element",rn);Vt&&(de(Vt.type!=="Formula"&&Vt.type!=="FormulaOfSelector","Pseudo-elements cannot have formula argument."),Rt.argument=Vt),Re.items.push(Rt)}else{de(ie,"Pseudo-classes are not enabled.");var rn=(Fe=X[Xe])!==null&&Fe!==void 0?Fe:re&&rE;if(!rn){var Ve=oE.pseudoClasses[Xe],At='Unknown pseudo-class: "'.concat(Xe,'"');Ve&&Ve.length>0&&(At+=". It is defined in: ".concat(Ve.join(", "))),pt(At+".")}var Vt=_t(Xe,"pseudo-class",rn),P={type:"PseudoClass",name:Xe};Vt&&(P.argument=Vt),Re.items.push(P)}}else break;if(Re.items.length===0)return Ot()?pt("Expected rule but end of input reached."):pt('Expected rule but "'.concat(Ee,'" found.'));if(q(),!Ot()&&!he(",")&&!he(")")){var xt=kt(N);q(),Re.nestedRule=Nt(),Re.nestedRule.combinator=xt}return Re}return function(J){if(typeof J!="string")throw new Error("".concat(Nl,"Expected string input."));return Le=J,ve=Le.length,Ue=0,Ee=Le.charAt(0),te()}}const KN=ZN({syntax:"selectors-4"});function XN(e){if(typeof e!="string")throw new TypeError("Expected `string` as selector, not `"+e+"`");return KN(e)}const lT="֑-߿יִ-﷽ﹰ-ﻼ",cT="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",QN=new RegExp("^[^"+cT+"]*["+lT+"]"),JN=new RegExp("^[^"+lT+"]*["+cT+"]");function eC(e){const t=String(e||"");return QN.test(t)?"rtl":JN.test(t)?"ltr":"neutral"}function tC(e,t){const n=e.schema,r=e.language,a=e.direction,i=e.editableOrEditingHost;let s;if(t.type==="element"){const l=t.properties.xmlLang||t.properties.lang,p=t.properties.type||"text",d=lE(t);l!=null&&(e.language=String(l)),n&&n.space==="html"?(t.properties.contentEditable==="true"&&(e.editableOrEditingHost=!0),t.tagName==="svg"&&(e.schema=ur),d==="rtl"?s=d:d==="ltr"||d!=="auto"&&t.tagName==="html"||d!=="auto"&&t.tagName==="input"&&p==="tel"?s="ltr":(d==="auto"||t.tagName==="bdi")&&(t.tagName==="textarea"?s=Cl(Fa(t)):t.tagName==="input"&&(p==="email"||p==="search"||p==="tel"||p==="text")?s=t.properties.value?Cl(String(t.properties.value)):"ltr":Pn(t,u)),s&&(e.direction=s)):e.editableOrEditingHost&&(e.editableOrEditingHost=!1)}return o;function o(){e.schema=n,e.language=r,e.direction=a,e.editableOrEditingHost=i}function u(l){if(l.type==="text")return s=Cl(l.value),s?Po:void 0;if(l!==t&&l.type==="element"&&(l.tagName==="bdi"||l.tagName==="script"||l.tagName==="style"||l.tagName==="textare"||lE(l)))return Wi}}function Cl(e){const t=eC(e);return t==="neutral"?void 0:t}function lE(e){const t=e.type==="element"&&typeof e.properties.dir=="string"?e.properties.dir.toLowerCase():void 0;return t==="auto"||t==="ltr"||t==="rtl"?t:void 0}function nC(e,t,n){const r=oi(n,e.name),a=t.properties[r.property];let i=rC(a,r);if(!e.value)return i!==void 0;e.value.type;let s=e.value.value;if(e.caseSensitivityModifier==="i"&&(s=s.toLowerCase(),i&&(i=i.toLowerCase())),i!==void 0)switch(e.operator){case"=":return s===i;case"$=":return s===i.slice(-s.length);case"*=":return i.includes(s);case"^=":return s===i.slice(0,s.length);case"|=":return s===i||s===i.slice(0,s.length)&&i.charAt(s.length)==="-";case"~=":return s===i||Ic(i).includes(s)}return!1}function rC(e,t){if(e!=null)if(typeof e=="boolean"){if(e)return t.attribute}else if(Array.isArray(e)){if(e.length>0)return(t.commaSeparated?$u:zu)(e)}else return String(e)}const aC=[];function iC(e,t){return(t.properties.className||aC).includes(e.name)}function sC(e,t){return t.properties.id===e.name}function oC(e,t){return e.name===t.tagName}function uC(e,t){return function(n,r){let a=cE(n,"tag");const i=cE(r??"*","range"),s=[];let o=-1;for(;++o<i.length;){const u=i[o].toLowerCase();if(!t&&u==="*")continue;let l=-1;const p=[];for(;++l<a.length;)if(e(a[l].toLowerCase(),u)){if(!t)return a[l];s.push(a[l])}else p.push(a[l]);a=p}return t?s:void 0}}const lC=uC(function(e,t){const n=e.split("-"),r=t.split("-");let a=0,i=0;if(r[i]!=="*"&&n[a]!==r[i])return!1;for(a++,i++;i<r.length;){if(r[i]==="*"){i++;continue}if(!n[a])return!1;if(n[a]===r[i]){a++,i++;continue}if(n[a].length===1)return!1;a++}return!0},!0);function cE(e,t){const n=e&&typeof e=="string"?[e]:e;if(!n||typeof n!="object"||!("length"in n))throw new Error("Invalid "+t+" `"+n+"`, expected non-empty string");return n}const cC={}.hasOwnProperty;function oa(e,t){const n=e.type==="element"&&cC.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}const dC=/[ \t\n\f\r]/g;function Us(e){return typeof e=="object"?e.type==="text"?dE(e.value):!1:dE(e)}function dE(e){return e.replace(dC,"")===""}const pC=new Set([9,10,12,13,32]),pE=48,fC=57;function mC(e){if(e=e.trim().toLowerCase(),e==="even")return[2,0];if(e==="odd")return[2,1];let t=0,n=0,r=i(),a=s();if(t<e.length&&e.charAt(t)==="n"&&(t++,n=r*(a??1),o(),t<e.length?(r=i(),o(),a=s()):r=a=0),a===null||t<e.length)throw new Error(`n-th rule couldn't be parsed ('${e}')`);return[n,r*a];function i(){return e.charAt(t)==="-"?(t++,-1):(e.charAt(t)==="+"&&t++,1)}function s(){const u=t;let l=0;for(;t<e.length&&e.charCodeAt(t)>=pE&&e.charCodeAt(t)<=fC;)l=l*10+(e.charCodeAt(t)-pE),t++;return t===u?null:l}function o(){for(;t<e.length&&pC.has(e.charCodeAt(t));)t++}}var Il,fE;function hC(){return fE||(fE=1,Il={trueFunc:function(){return!0},falseFunc:function(){return!1}}),Il}var gC=hC();const mE=bu(gC);function bC(e){const t=e[0],n=e[1]-1;if(n<0&&t<=0)return mE.falseFunc;if(t===-1)return i=>i<=n;if(t===0)return i=>i===n;if(t===1)return n<0?mE.trueFunc:i=>i>=n;const r=Math.abs(t),a=(n%r+r)%r;return t>1?i=>i>=n&&i%r===a:i=>i<=n&&i%r===a}function hE(e){return bC(mC(e))}const gE={}.hasOwnProperty;function Vu(e,t){const n=t||{};function r(a,...i){let s=r.invalid;const o=r.handlers;if(a&&gE.call(a,e)){const u=String(a[e]);s=gE.call(o,u)?o[u]:r.unknown}if(s)return s.call(this,a,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const EC=hE.default||hE,yC=Vu("name",{handlers:{"any-link":xC,blank:TC,checked:SC,dir:AC,disabled:dT,empty:vC,enabled:wC,"first-child":_C,"first-of-type":NC,has:CC,is:pT,lang:kC,"last-child":RC,"last-of-type":DC,not:OC,"nth-child":LC,"nth-last-child":FC,"nth-last-of-type":MC,"nth-of-type":PC,"only-child":BC,"only-of-type":UC,optional:jC,"read-only":$C,"read-write":fT,required:mT,root:zC,scope:HC},invalid:IC,unknown:GC});function xC(e,t){return(t.tagName==="a"||t.tagName==="area"||t.tagName==="link")&&oa(t,"href")}function Er(e,t){if(e.shallow)throw new Error("Cannot use `:"+t.name+"` without parent")}function TC(e,t){return!hT(t,n);function n(r){return r.type==="element"||r.type==="text"&&!Us(r)}}function SC(e,t){return t.tagName==="input"||t.tagName==="menuitem"?!!((t.properties.type==="checkbox"||t.properties.type==="radio")&&oa(t,"checked")):t.tagName==="option"?oa(t,"selected"):!1}function AC(e,t,n,r,a){return e.argument,e.argument.type,a.direction===e.argument.value}function dT(e,t){return(t.tagName==="button"||t.tagName==="input"||t.tagName==="select"||t.tagName==="textarea"||t.tagName==="optgroup"||t.tagName==="option"||t.tagName==="menuitem"||t.tagName==="fieldset")&&oa(t,"disabled")}function vC(e,t){return!hT(t,n);function n(r){return r.type==="element"||r.type==="text"}}function wC(e,t){return!dT(e,t)}function _C(e,t,n,r,a){return Er(a,e),a.elementIndex===0}function NC(e,t,n,r,a){return Er(a,e),a.typeIndex===0}function qu(e){let t=e._cachedFn;if(!t){const n=e.argument;if(n.type!=="Formula")throw new Error("Expected `nth` formula, such as `even` or `2n+1` (`of` is not yet supported)");t=EC(n.a+"n+"+n.b),e._cachedFn=t}return t}function CC(e,t,n,r,a){e.argument,e.argument.type;const i={...a,found:!1,one:!0,results:[],rootQuery:e.argument,scopeElements:[t],shallow:!1};return og(i,{type:"root",children:t.children}),i.results.length>0}function IC(){}function pT(e,t,n,r,a){e.argument,e.argument.type;const i={...a,found:!1,one:!0,results:[],rootQuery:e.argument,scopeElements:[t],shallow:!1};return og(i,t),i.results[0]===t}function kC(e,t,n,r,a){return e.argument,e.argument.type,a.language!==""&&a.language!==void 0&&lC(a.language,Cc(e.argument.value)).length>0}function RC(e,t,n,r,a){return Er(a,e),!!(a.elementCount&&a.elementIndex===a.elementCount-1)}function DC(e,t,n,r,a){return Er(a,e),typeof a.typeIndex=="number"&&typeof a.typeCount=="number"&&a.typeIndex===a.typeCount-1}function OC(e,t,n,r,a){return!pT(e,t,n,r,a)}function LC(e,t,n,r,a){const i=qu(e);return Er(a,e),typeof a.elementIndex=="number"&&i(a.elementIndex)}function FC(e,t,n,r,a){const i=qu(e);return Er(a,e),!!(typeof a.elementCount=="number"&&typeof a.elementIndex=="number"&&i(a.elementCount-a.elementIndex-1))}function MC(e,t,n,r,a){const i=qu(e);return Er(a,e),typeof a.typeCount=="number"&&typeof a.typeIndex=="number"&&i(a.typeCount-1-a.typeIndex)}function PC(e,t,n,r,a){const i=qu(e);return Er(a,e),typeof a.typeIndex=="number"&&i(a.typeIndex)}function BC(e,t,n,r,a){return Er(a,e),a.elementCount===1}function UC(e,t,n,r,a){return Er(a,e),a.typeCount===1}function jC(e,t){return!mT(e,t)}function $C(e,t,n,r,a){return!fT(e,t,n,r,a)}function fT(e,t,n,r,a){return t.tagName==="input"||t.tagName==="textarea"?!oa(t,"readOnly")&&!oa(t,"disabled"):!!a.editableOrEditingHost}function mT(e,t){return(t.tagName==="input"||t.tagName==="textarea"||t.tagName==="select")&&oa(t,"required")}function zC(e,t,n,r,a){return!!((!r||r.type==="root")&&a.schema&&(a.schema.space==="html"||a.schema.space==="svg")&&(t.tagName==="html"||t.tagName==="svg"))}function HC(e,t,n,r,a){return a.scopeElements.includes(t)}function hT(e,t){const n=e.children;let r=-1;for(;++r<n.length;)if(t(n[r]))return!0;return!1}function GC(e){const t=e;throw new Error("Unknown pseudo-selector `"+t.name+"`")}function WC(e,t,n,r,a){for(const i of e.items)if(i.type==="Attribute"){if(!nC(i,t,a.schema))return!1}else if(i.type==="Id"){if(!sC(i,t))return!1}else if(i.type==="ClassName"){if(!iC(i,t))return!1}else if(i.type==="PseudoClass"){if(!yC(i,t,n,r,a))return!1}else{if(i.type==="PseudoElement")throw new Error("Invalid selector: `::"+i.name+"`");if(i.type==="TagName"&&!oC(i,t))return!1}return!0}const VC=[];function og(e,t){t&&gT(e,[],t,void 0,void 0,t)}function kl(e,t,n){const r=e[t];r?r.push(n):e[t]=[n]}function qC(e,t,n,r){const a=Co(t.descendant,t.directChild);let i,s=-1;const o={count:0,types:new Map},u={count:0,types:new Map};for(;++s<n.children.length;)bE(o,n.children[s]);for(s=-1;++s<n.children.length;){const l=n.children[s],p=l.type==="element"?l.tagName.toUpperCase():void 0;if(e.elementIndex=u.count,e.typeIndex=p&&u.types.get(p)||0,e.elementCount=o.count,e.typeCount=p?o.types.get(p):0,"children"in l){const d=Co(a,i),f=gT(e,d,n.children[s],s,n,r);i=Co(f.generalSibling,f.adjacentSibling)}if(e.one&&e.found)break;bE(u,n.children[s])}}function YC(e,t,n,r,a){const i={adjacentSibling:void 0,descendant:void 0,directChild:void 0,generalSibling:void 0};let s=-1;for(;++s<t.length;){const o=t[s];if(e.one&&e.found)break;if(e.shallow&&o.nestedRule)throw new Error("Expected selector without nesting");if(WC(o,n,r,a,e)){const u=o.nestedRule;if(u){const l=u.combinator==="+"?"adjacentSibling":u.combinator==="~"?"generalSibling":u.combinator===">"?"directChild":"descendant";kl(i,l,u)}else e.found=!0,e.results.includes(n)||e.results.push(n)}o.combinator===void 0?kl(i,"descendant",o):o.combinator==="~"&&kl(i,"generalSibling",o)}return i}function Co(e,t){return e&&t&&e.length>0&&t.length>0?[...e,...t]:e&&e.length>0?e:t&&t.length>0?t:VC}function bE(e,t){if(t.type==="element"){const n=t.tagName.toUpperCase(),r=(e.types.get(n)||0)+1;e.count++,e.types.set(n,r)}}function gT(e,t,n,r,a,i){let s={adjacentSibling:void 0,descendant:void 0,directChild:void 0,generalSibling:void 0};const o=tC(e,n);if(n.type==="element"){let u=e.rootQuery.rules;a&&a!==i&&(u=e.rootQuery.rules.filter(l=>l.combinator===void 0||l.combinator===">"&&a===i)),s=YC(e,Co(t,u),n,r,a)}return"children"in n&&!e.shallow&&!(e.one&&e.found)&&qC(e,s,n,i),o(),s}function ZC(e,t,n){const r=KC(e,t);return og(r,t||void 0),r.results}function KC(e,t,n){return{direction:"ltr",editableOrEditingHost:!1,elementCount:void 0,elementIndex:void 0,found:!1,language:void 0,one:!1,results:[],rootQuery:XN(e),schema:xa,scopeElements:t?t.type==="root"?t.children:[t]:[],shallow:!1,typeIndex:void 0,typeCount:void 0}}const bT=(e=[],t="")=>(e.forEach(n=>{n.type==="text"?t+=n.value:n.type==="element"&&n.children&&Array.isArray(n.children)&&(t+=bT(n.children))}),t),XC=e=>{const{selector:t,rewrite:n}=e||{};return r=>{if(!(!n||typeof n!="function")){if(t&&typeof t=="string"){const a=ZC(t,r);a&&a.length>0&&Pn(r,a,(i,s,o)=>{n(i,s,o)});return}Pn(r,(a,i,s)=>{n(a,i,s)})}}};function QC(e,t,n,r){let a,i,s;i=t,s=n,a=r,xd(e,i,o,a);function o(u,l){const p=l[l.length-1],d=p?p.children.indexOf(u):void 0;return s(u,d,p)}}const JC=(e="")=>(e.match(/([^?=&]+)(=([^&]*))/g)||[]).reduce((t,n)=>(t[n.slice(0,n.indexOf("="))]=n.slice(n.indexOf("=")+1),t),{}),eI=(e=[],t)=>{let n=t;for(;n>-1;){if(n--,!e[n])return;if(e[n]&&e[n].value&&e[n].value.replace(/(\n|\s)/g,"")!==""||e[n].type!=="text")return!/^rehype:/.test(e[n].value)||e[n].type!=="comment"?void 0:e[n]}},ET=(e=[],t,n,r="<!--",a="-->")=>{let i=t;for(;i<e.length;)if(i++,n){const s=e[i];if(s&&s.value&&s.value.replace(/(\n|\s)/g,"")!==""||e[i]&&e[i].type==="element")return s.tagName===n?s:void 0}else{const s=e[i];if(!s||s.type==="element")return;if(s.type==="text"){const o=ET(e,i,void 0);if(o)return o}if(s.type&&/^(comment|raw|text)$/ig.test(s.type)){const o=new RegExp(`^(s+)?${r}(.*?)${a}`);if(s.value&&!/^rehype:/.test(s.value.replace(/^(\n|\s)+/,"").replace(o,"$2")||""))return;let u=s.value.replace(/^(\n|\s)+/,"");return s.value=u,s}}},EE=({value:e=""},t="<!--",n="-->")=>{let r;try{r=new RegExp(`^${t}(.*?)${n}`)}catch{return{}}const a=e.match(r),s=(a?a[1]:e).replace(/^rehype:/,""),o=JC(s);return Object.keys(o).forEach(u=>{o[u]==="true"?o[u]=!0:o[u]==="false"?o[u]=!1:typeof o[u]=="string"&&!/^0/.test(o[u])&&!isNaN(+o[u])&&(o[u]=+o[u])}),o},yE=(e,t,n)=>n==="string"?{...e,"data-config":JSON.stringify({...t,rehyp:!0})}:n==="attr"?{...e,...t}:{...e,"data-config":{...t,rehyp:!0}},tI=(e={})=>{const{properties:t="data",codeBlockParames:n=!0,commentStart:r="<!--",commentEnd:a="-->"}=e;return i=>{QC(i,"element",(s,o,u)=>{if(n&&s.tagName==="pre"&&s&&Array.isArray(s.children)&&u&&Array.isArray(u.children)&&u.children.length>1){const p=s.children[0];if(p&&p.tagName==="code"&&typeof o=="number"){const d=eI(u.children,o);if(d){const f=EE(d,r,a);Object.keys(f).length>0&&(s.properties={...s.properties,"data-type":"rehyp"},p.properties=yE(p.properties,f,t))}}}let l=u;if((/^(em|strong|b|a|i|p|pre|kbd|blockquote|h(1|2|3|4|5|6)|code|table|img|del|ul|ol)$/.test(s.tagName)||l.type=="root")&&u&&Array.isArray(u.children)&&typeof o=="number"){const p=ET(u.children,o,"",r,a);if(p){const d=EE(p,r,a);Object.keys(d).length>0&&(s.properties=yE(s.properties,d,t))}}})}},yT=-1,Yu=0,qi=1,jo=2,ug=3,lg=4,cg=5,dg=6,xT=7,TT=8,nI=typeof self=="object"?self:globalThis,xE=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new nI[e](t)},rI=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,s]=t[a];switch(i){case Yu:case yT:return n(s,a);case qi:{const o=n([],a);for(const u of s)o.push(r(u));return o}case jo:{const o=n({},a);for(const[u,l]of s)o[r(u)]=r(l);return o}case ug:return n(new Date(s),a);case lg:{const{source:o,flags:u}=s;return n(new RegExp(o,u),a)}case cg:{const o=n(new Map,a);for(const[u,l]of s)o.set(r(u),r(l));return o}case dg:{const o=n(new Set,a);for(const u of s)o.add(r(u));return o}case xT:{const{name:o,message:u}=s;return n(xE(o,u),a)}case TT:return n(BigInt(s),a);case"BigInt":return n(Object(BigInt(s)),a);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:o}=new Uint8Array(s);return n(new DataView(o),s)}}return n(xE(i,s),a)};return r},TE=e=>rI(new Map,e)(0),Na="",{toString:aI}={},{keys:iI}=Object,Ii=e=>{const t=typeof e;if(t!=="object"||!e)return[Yu,t];const n=aI.call(e).slice(8,-1);switch(n){case"Array":return[qi,Na];case"Object":return[jo,Na];case"Date":return[ug,Na];case"RegExp":return[lg,Na];case"Map":return[cg,Na];case"Set":return[dg,Na];case"DataView":return[qi,n]}return n.includes("Array")?[qi,n]:n.includes("Error")?[xT,n]:[jo,n]},ao=([e,t])=>e===Yu&&(t==="function"||t==="symbol"),sI=(e,t,n,r)=>{const a=(s,o)=>{const u=r.push(s)-1;return n.set(o,u),u},i=s=>{if(n.has(s))return n.get(s);let[o,u]=Ii(s);switch(o){case Yu:{let p=s;switch(u){case"bigint":o=TT,p=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return a([yT],s)}return a([o,p],s)}case qi:{if(u){let f=s;return u==="DataView"?f=new Uint8Array(s.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(s)),a([u,[...f]],s)}const p=[],d=a([o,p],s);for(const f of s)p.push(i(f));return d}case jo:{if(u)switch(u){case"BigInt":return a([u,s.toString()],s);case"Boolean":case"Number":case"String":return a([u,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const p=[],d=a([o,p],s);for(const f of iI(s))(e||!ao(Ii(s[f])))&&p.push([i(f),i(s[f])]);return d}case ug:return a([o,s.toISOString()],s);case lg:{const{source:p,flags:d}=s;return a([o,{source:p,flags:d}],s)}case cg:{const p=[],d=a([o,p],s);for(const[f,m]of s)(e||!(ao(Ii(f))||ao(Ii(m))))&&p.push([i(f),i(m)]);return d}case dg:{const p=[],d=a([o,p],s);for(const f of s)(e||!ao(Ii(f)))&&p.push(i(f));return d}}const{message:l}=s;return a([o,{name:u,message:l}],s)};return i},SE=(e,{json:t,lossy:n}={})=>{const r=[];return sI(!(t||n),!!t,new Map,r)(e),r},ua=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?TE(SE(e,t)):structuredClone(e):(e,t)=>TE(SE(e,t));function oI(e){const t=String(e),n=[];return{toOffset:a,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=t.length){let s=0;for(;;){let o=n[s];if(o===void 0){const u=AE(t,n[s-1]);o=u===-1?t.length+1:u+1,n[s]=o}if(o>i)return{line:s+1,column:i-(s>0?n[s-1]:0)+1,offset:i};s++}}}function a(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const o=n[n.length-1],u=AE(t,o),l=u===-1?t.length+1:u+1;if(o===l)break;n.push(l)}const s=(i.line>1?n[i.line-2]:0)+i.column-1;if(s<n[i.line-1])return s}}}function AE(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
15
+ `&&ge()}function q(){for(;VN[Ee];)ge()}function te(J){J===void 0&&(J=!1),q();for(var be=[Nt(J)];he(",");)ge(),q(),be.push(Nt(J));return{type:"Selector",rules:be}}function ye(){ft("["),q();var J;if(he("|")){de(R,"Namespaces are not enabled."),ge();var be=ut();de(be,"Expected attribute name."),J={type:"Attribute",name:be,namespace:{type:"NoNamespace"}}}else if(he("*")){de(R,"Namespaces are not enabled."),de(v,"Wildcard namespace is not enabled."),ge(),ft("|");var Fe=ut();de(Fe,"Expected attribute name."),J={type:"Attribute",name:Fe,namespace:{type:"WildcardNamespace"}}}else{var Re=ut();if(de(Re,"Expected attribute name."),J={type:"Attribute",name:Re},he("|")){var Tt=Ue;if(ge(),Ni(Ee)){de(R,"Namespaces are not enabled.");var Wt=ut();de(Wt,"Expected attribute name."),J={type:"Attribute",name:Wt,namespace:{type:"NamespaceName",name:Re}}}else $e(Tt)}}if(de(J.name,"Expected attribute name."),q(),Ot()&&!i)return J;if(he("]"))ge();else{if(J.operator=kt(M),de(J.operator,"Expected a valid attribute selector operator."),q(),rt(),qN[Ee])J.value={type:"String",value:nn(Ee)};else if(A&&he("$")){ge();var U=ut();de(U,"Expected substitute name."),J.value={type:"Substitution",name:U}}else{var Te=ut();de(Te,"Expected attribute value."),J.value={type:"String",value:Te}}if(q(),Ot()&&!i)return J;if(!he("]")){var Ne=ut();if(de(Ne,"Expected end of attribute selector."),J.caseSensitivityModifier=Ne,de(Z,"Attribute case sensitivity modifiers are not enabled."),de(H||j[J.caseSensitivityModifier],"Unknown attribute case sensitivity modifier."),q(),Ot()&&!i)return J}ft("]")}return J}function we(){for(var J="";_l[Ee];)J+=Pe();return de(J!=="","Formula parse error."),parseInt(J)}var je=function(){return he("-")||he("+")||_l[Ee]};function Ze(){if(he("e")||he("o")){var J=ut();if(J==="even")return q(),[2,0];if(J==="odd")return q(),[2,1]}var be=null,Fe=1;if(he("-")&&(ge(),Fe=-1),je()&&(he("+")&&ge(),be=we(),!he("\\")&&!he("n")))return[0,be*Fe];be===null&&(be=1),be*=Fe;var Re;if(he("\\")?(ge(),Ci(Ee)?Re=zt():Re=Pe()):Re=Pe(),de(Re==="n",'Formula parse error: expected "n".'),q(),he("+")||he("-")){var Tt=he("+")?1:-1;return ge(),q(),[be,Tt*we()]}else return[be,0]}function _t(J,be,Fe){var Re;if(he("(")){if(ge(),q(),A&&he("$")){ge();var Tt=ut();de(Tt,"Expected substitute name."),Re={type:"Substitution",name:Tt}}else if(Fe.type==="String")Re={type:"String",value:Ae()},de(Re.value,"Expected ".concat(be," argument value."));else if(Fe.type==="Selector")Re=te(!0);else if(Fe.type==="Formula"){var Wt=Ze(),U=Wt[0],Te=Wt[1];if(Re={type:"Formula",a:U,b:Te},Fe.ofSelector&&(q(),he("o")||he("\\"))){var Ne=ut();de(Ne==="of","Formula of selector parse error."),q(),Re={type:"FormulaOfSelector",a:U,b:Te,selector:Nt()}}}else return pt("Invalid ".concat(be," signature."));if(q(),Ot()&&!i)return Re;ft(")")}else de(Fe.optional,"Argument is required for ".concat(be,' "').concat(J,'".'));return Re}function St(){if(he("*"))return de(x,"Wildcard tag name is not enabled."),ge(),{type:"WildcardTag"};if(Ni(Ee)){de(y,"Tag names are not enabled.");var J=ut();return de(J,"Expected tag name."),{type:"TagName",name:J}}else return pt("Expected tag name.")}function Et(){if(he("*")){var J=Ue;if(ge(),!he("|")||(ge(),!ct()))return $e(J),St();de(R,"Namespaces are not enabled."),de(v,"Wildcard namespace is not enabled.");var be=St();return be.namespace={type:"WildcardNamespace"},be}else if(he("|")){de(R,"Namespaces are not enabled."),ge();var be=St();return be.namespace={type:"NoNamespace"},be}else if(Ni(Ee)){var Fe=ut();if(de(Fe,"Expected tag name."),!he("|"))return de(y,"Tag names are not enabled."),{type:"TagName",name:Fe};var J=Ue;if(ge(),!ct())return $e(J),{type:"TagName",name:Fe};de(R,"Namespaces are not enabled.");var be=St();return be.namespace={type:"NamespaceName",name:Fe},be}else return pt("Expected tag name.")}function Nt(J){var be,Fe;J===void 0&&(J=!1);var Re={type:"Rule",items:[]};if(J){var Tt=kt(N);Tt&&(Re.combinator=Tt,q())}for(;Ue<ve;)if(ct())de(Re.items.length===0,"Unexpected tag/namespace start."),Re.items.push(Et());else if(he("|")){var Wt=Ue;if(ge(),ct())de(Re.items.length===0,"Unexpected tag/namespace start."),$e(Wt),Re.items.push(Et());else{$e(Wt);break}}else if(he(".")){de(T,"Class names are not enabled."),ge();var U=ut();de(U,"Expected class name."),Re.items.push({type:"ClassName",name:U})}else if(he("#")){de(w,"IDs are not enabled."),ge();var Te=ut();de(Te,"Expected ID name."),Re.items.push({type:"Id",name:Te})}else if(he("&"))de(I,"Nesting selector is not enabled."),ge(),Re.items.push({type:"NestingSelector"});else if(he("["))de(_,"Attributes are not enabled."),Re.items.push(ye());else if(he(":")){var Ne=!1,ze=!1;ge(),he(":")&&(de(k,"Pseudo elements are not enabled."),de(le,"Pseudo elements double colon notation is not enabled."),Ne=!0,ge());var Xe=ut();if(de(Ne||Xe,"Expected pseudo-class name."),de(!Ne||Xe,"Expected pseudo-element name."),de(Xe,"Expected pseudo-class name."),!(!Ne||ke||Object.prototype.hasOwnProperty.call(D,Xe))){var Ve=oE.pseudoElements[Xe],At='Unknown pseudo-element "'.concat(Xe,'"');Ve&&Ve.length>0&&(At+=". It is defined in: ".concat(Ve.join(", "))),pt(At+".")}if(ze=k&&(Ne||!Ne&&Y&&Object.prototype.hasOwnProperty.call(D,Xe)),ze){var rn=(be=D[Xe])!==null&&be!==void 0?be:ke&&rE,Rt={type:"PseudoElement",name:Xe},Vt=_t(Xe,"pseudo-element",rn);Vt&&(de(Vt.type!=="Formula"&&Vt.type!=="FormulaOfSelector","Pseudo-elements cannot have formula argument."),Rt.argument=Vt),Re.items.push(Rt)}else{de(ie,"Pseudo-classes are not enabled.");var rn=(Fe=X[Xe])!==null&&Fe!==void 0?Fe:re&&rE;if(!rn){var Ve=oE.pseudoClasses[Xe],At='Unknown pseudo-class: "'.concat(Xe,'"');Ve&&Ve.length>0&&(At+=". It is defined in: ".concat(Ve.join(", "))),pt(At+".")}var Vt=_t(Xe,"pseudo-class",rn),P={type:"PseudoClass",name:Xe};Vt&&(P.argument=Vt),Re.items.push(P)}}else break;if(Re.items.length===0)return Ot()?pt("Expected rule but end of input reached."):pt('Expected rule but "'.concat(Ee,'" found.'));if(q(),!Ot()&&!he(",")&&!he(")")){var Tt=kt(N);q(),Re.nestedRule=Nt(),Re.nestedRule.combinator=Tt}return Re}return function(J){if(typeof J!="string")throw new Error("".concat(Nl,"Expected string input."));return Le=J,ve=Le.length,Ue=0,Ee=Le.charAt(0),te()}}const KN=ZN({syntax:"selectors-4"});function XN(e){if(typeof e!="string")throw new TypeError("Expected `string` as selector, not `"+e+"`");return KN(e)}const lT="֑-߿יִ-﷽ﹰ-ﻼ",cT="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",QN=new RegExp("^[^"+cT+"]*["+lT+"]"),JN=new RegExp("^[^"+lT+"]*["+cT+"]");function eC(e){const t=String(e||"");return QN.test(t)?"rtl":JN.test(t)?"ltr":"neutral"}function tC(e,t){const n=e.schema,r=e.language,a=e.direction,i=e.editableOrEditingHost;let s;if(t.type==="element"){const l=t.properties.xmlLang||t.properties.lang,p=t.properties.type||"text",d=lE(t);l!=null&&(e.language=String(l)),n&&n.space==="html"?(t.properties.contentEditable==="true"&&(e.editableOrEditingHost=!0),t.tagName==="svg"&&(e.schema=ur),d==="rtl"?s=d:d==="ltr"||d!=="auto"&&t.tagName==="html"||d!=="auto"&&t.tagName==="input"&&p==="tel"?s="ltr":(d==="auto"||t.tagName==="bdi")&&(t.tagName==="textarea"?s=Cl(Fa(t)):t.tagName==="input"&&(p==="email"||p==="search"||p==="tel"||p==="text")?s=t.properties.value?Cl(String(t.properties.value)):"ltr":Pn(t,u)),s&&(e.direction=s)):e.editableOrEditingHost&&(e.editableOrEditingHost=!1)}return o;function o(){e.schema=n,e.language=r,e.direction=a,e.editableOrEditingHost=i}function u(l){if(l.type==="text")return s=Cl(l.value),s?Po:void 0;if(l!==t&&l.type==="element"&&(l.tagName==="bdi"||l.tagName==="script"||l.tagName==="style"||l.tagName==="textare"||lE(l)))return Wi}}function Cl(e){const t=eC(e);return t==="neutral"?void 0:t}function lE(e){const t=e.type==="element"&&typeof e.properties.dir=="string"?e.properties.dir.toLowerCase():void 0;return t==="auto"||t==="ltr"||t==="rtl"?t:void 0}function nC(e,t,n){const r=oi(n,e.name),a=t.properties[r.property];let i=rC(a,r);if(!e.value)return i!==void 0;e.value.type;let s=e.value.value;if(e.caseSensitivityModifier==="i"&&(s=s.toLowerCase(),i&&(i=i.toLowerCase())),i!==void 0)switch(e.operator){case"=":return s===i;case"$=":return s===i.slice(-s.length);case"*=":return i.includes(s);case"^=":return s===i.slice(0,s.length);case"|=":return s===i||s===i.slice(0,s.length)&&i.charAt(s.length)==="-";case"~=":return s===i||Ic(i).includes(s)}return!1}function rC(e,t){if(e!=null)if(typeof e=="boolean"){if(e)return t.attribute}else if(Array.isArray(e)){if(e.length>0)return(t.commaSeparated?$u:zu)(e)}else return String(e)}const aC=[];function iC(e,t){return(t.properties.className||aC).includes(e.name)}function sC(e,t){return t.properties.id===e.name}function oC(e,t){return e.name===t.tagName}function uC(e,t){return function(n,r){let a=cE(n,"tag");const i=cE(r??"*","range"),s=[];let o=-1;for(;++o<i.length;){const u=i[o].toLowerCase();if(!t&&u==="*")continue;let l=-1;const p=[];for(;++l<a.length;)if(e(a[l].toLowerCase(),u)){if(!t)return a[l];s.push(a[l])}else p.push(a[l]);a=p}return t?s:void 0}}const lC=uC(function(e,t){const n=e.split("-"),r=t.split("-");let a=0,i=0;if(r[i]!=="*"&&n[a]!==r[i])return!1;for(a++,i++;i<r.length;){if(r[i]==="*"){i++;continue}if(!n[a])return!1;if(n[a]===r[i]){a++,i++;continue}if(n[a].length===1)return!1;a++}return!0},!0);function cE(e,t){const n=e&&typeof e=="string"?[e]:e;if(!n||typeof n!="object"||!("length"in n))throw new Error("Invalid "+t+" `"+n+"`, expected non-empty string");return n}const cC={}.hasOwnProperty;function oa(e,t){const n=e.type==="element"&&cC.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}const dC=/[ \t\n\f\r]/g;function Us(e){return typeof e=="object"?e.type==="text"?dE(e.value):!1:dE(e)}function dE(e){return e.replace(dC,"")===""}const pC=new Set([9,10,12,13,32]),pE=48,fC=57;function mC(e){if(e=e.trim().toLowerCase(),e==="even")return[2,0];if(e==="odd")return[2,1];let t=0,n=0,r=i(),a=s();if(t<e.length&&e.charAt(t)==="n"&&(t++,n=r*(a??1),o(),t<e.length?(r=i(),o(),a=s()):r=a=0),a===null||t<e.length)throw new Error(`n-th rule couldn't be parsed ('${e}')`);return[n,r*a];function i(){return e.charAt(t)==="-"?(t++,-1):(e.charAt(t)==="+"&&t++,1)}function s(){const u=t;let l=0;for(;t<e.length&&e.charCodeAt(t)>=pE&&e.charCodeAt(t)<=fC;)l=l*10+(e.charCodeAt(t)-pE),t++;return t===u?null:l}function o(){for(;t<e.length&&pC.has(e.charCodeAt(t));)t++}}var Il,fE;function hC(){return fE||(fE=1,Il={trueFunc:function(){return!0},falseFunc:function(){return!1}}),Il}var gC=hC();const mE=bu(gC);function bC(e){const t=e[0],n=e[1]-1;if(n<0&&t<=0)return mE.falseFunc;if(t===-1)return i=>i<=n;if(t===0)return i=>i===n;if(t===1)return n<0?mE.trueFunc:i=>i>=n;const r=Math.abs(t),a=(n%r+r)%r;return t>1?i=>i>=n&&i%r===a:i=>i<=n&&i%r===a}function hE(e){return bC(mC(e))}const gE={}.hasOwnProperty;function Vu(e,t){const n=t||{};function r(a,...i){let s=r.invalid;const o=r.handlers;if(a&&gE.call(a,e)){const u=String(a[e]);s=gE.call(o,u)?o[u]:r.unknown}if(s)return s.call(this,a,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const EC=hE.default||hE,yC=Vu("name",{handlers:{"any-link":xC,blank:TC,checked:SC,dir:AC,disabled:dT,empty:vC,enabled:wC,"first-child":_C,"first-of-type":NC,has:CC,is:pT,lang:kC,"last-child":RC,"last-of-type":DC,not:OC,"nth-child":LC,"nth-last-child":FC,"nth-last-of-type":MC,"nth-of-type":PC,"only-child":BC,"only-of-type":UC,optional:jC,"read-only":$C,"read-write":fT,required:mT,root:zC,scope:HC},invalid:IC,unknown:GC});function xC(e,t){return(t.tagName==="a"||t.tagName==="area"||t.tagName==="link")&&oa(t,"href")}function Er(e,t){if(e.shallow)throw new Error("Cannot use `:"+t.name+"` without parent")}function TC(e,t){return!hT(t,n);function n(r){return r.type==="element"||r.type==="text"&&!Us(r)}}function SC(e,t){return t.tagName==="input"||t.tagName==="menuitem"?!!((t.properties.type==="checkbox"||t.properties.type==="radio")&&oa(t,"checked")):t.tagName==="option"?oa(t,"selected"):!1}function AC(e,t,n,r,a){return e.argument,e.argument.type,a.direction===e.argument.value}function dT(e,t){return(t.tagName==="button"||t.tagName==="input"||t.tagName==="select"||t.tagName==="textarea"||t.tagName==="optgroup"||t.tagName==="option"||t.tagName==="menuitem"||t.tagName==="fieldset")&&oa(t,"disabled")}function vC(e,t){return!hT(t,n);function n(r){return r.type==="element"||r.type==="text"}}function wC(e,t){return!dT(e,t)}function _C(e,t,n,r,a){return Er(a,e),a.elementIndex===0}function NC(e,t,n,r,a){return Er(a,e),a.typeIndex===0}function qu(e){let t=e._cachedFn;if(!t){const n=e.argument;if(n.type!=="Formula")throw new Error("Expected `nth` formula, such as `even` or `2n+1` (`of` is not yet supported)");t=EC(n.a+"n+"+n.b),e._cachedFn=t}return t}function CC(e,t,n,r,a){e.argument,e.argument.type;const i={...a,found:!1,one:!0,results:[],rootQuery:e.argument,scopeElements:[t],shallow:!1};return og(i,{type:"root",children:t.children}),i.results.length>0}function IC(){}function pT(e,t,n,r,a){e.argument,e.argument.type;const i={...a,found:!1,one:!0,results:[],rootQuery:e.argument,scopeElements:[t],shallow:!1};return og(i,t),i.results[0]===t}function kC(e,t,n,r,a){return e.argument,e.argument.type,a.language!==""&&a.language!==void 0&&lC(a.language,Cc(e.argument.value)).length>0}function RC(e,t,n,r,a){return Er(a,e),!!(a.elementCount&&a.elementIndex===a.elementCount-1)}function DC(e,t,n,r,a){return Er(a,e),typeof a.typeIndex=="number"&&typeof a.typeCount=="number"&&a.typeIndex===a.typeCount-1}function OC(e,t,n,r,a){return!pT(e,t,n,r,a)}function LC(e,t,n,r,a){const i=qu(e);return Er(a,e),typeof a.elementIndex=="number"&&i(a.elementIndex)}function FC(e,t,n,r,a){const i=qu(e);return Er(a,e),!!(typeof a.elementCount=="number"&&typeof a.elementIndex=="number"&&i(a.elementCount-a.elementIndex-1))}function MC(e,t,n,r,a){const i=qu(e);return Er(a,e),typeof a.typeCount=="number"&&typeof a.typeIndex=="number"&&i(a.typeCount-1-a.typeIndex)}function PC(e,t,n,r,a){const i=qu(e);return Er(a,e),typeof a.typeIndex=="number"&&i(a.typeIndex)}function BC(e,t,n,r,a){return Er(a,e),a.elementCount===1}function UC(e,t,n,r,a){return Er(a,e),a.typeCount===1}function jC(e,t){return!mT(e,t)}function $C(e,t,n,r,a){return!fT(e,t,n,r,a)}function fT(e,t,n,r,a){return t.tagName==="input"||t.tagName==="textarea"?!oa(t,"readOnly")&&!oa(t,"disabled"):!!a.editableOrEditingHost}function mT(e,t){return(t.tagName==="input"||t.tagName==="textarea"||t.tagName==="select")&&oa(t,"required")}function zC(e,t,n,r,a){return!!((!r||r.type==="root")&&a.schema&&(a.schema.space==="html"||a.schema.space==="svg")&&(t.tagName==="html"||t.tagName==="svg"))}function HC(e,t,n,r,a){return a.scopeElements.includes(t)}function hT(e,t){const n=e.children;let r=-1;for(;++r<n.length;)if(t(n[r]))return!0;return!1}function GC(e){const t=e;throw new Error("Unknown pseudo-selector `"+t.name+"`")}function WC(e,t,n,r,a){for(const i of e.items)if(i.type==="Attribute"){if(!nC(i,t,a.schema))return!1}else if(i.type==="Id"){if(!sC(i,t))return!1}else if(i.type==="ClassName"){if(!iC(i,t))return!1}else if(i.type==="PseudoClass"){if(!yC(i,t,n,r,a))return!1}else{if(i.type==="PseudoElement")throw new Error("Invalid selector: `::"+i.name+"`");if(i.type==="TagName"&&!oC(i,t))return!1}return!0}const VC=[];function og(e,t){t&&gT(e,[],t,void 0,void 0,t)}function kl(e,t,n){const r=e[t];r?r.push(n):e[t]=[n]}function qC(e,t,n,r){const a=Co(t.descendant,t.directChild);let i,s=-1;const o={count:0,types:new Map},u={count:0,types:new Map};for(;++s<n.children.length;)bE(o,n.children[s]);for(s=-1;++s<n.children.length;){const l=n.children[s],p=l.type==="element"?l.tagName.toUpperCase():void 0;if(e.elementIndex=u.count,e.typeIndex=p&&u.types.get(p)||0,e.elementCount=o.count,e.typeCount=p?o.types.get(p):0,"children"in l){const d=Co(a,i),f=gT(e,d,n.children[s],s,n,r);i=Co(f.generalSibling,f.adjacentSibling)}if(e.one&&e.found)break;bE(u,n.children[s])}}function YC(e,t,n,r,a){const i={adjacentSibling:void 0,descendant:void 0,directChild:void 0,generalSibling:void 0};let s=-1;for(;++s<t.length;){const o=t[s];if(e.one&&e.found)break;if(e.shallow&&o.nestedRule)throw new Error("Expected selector without nesting");if(WC(o,n,r,a,e)){const u=o.nestedRule;if(u){const l=u.combinator==="+"?"adjacentSibling":u.combinator==="~"?"generalSibling":u.combinator===">"?"directChild":"descendant";kl(i,l,u)}else e.found=!0,e.results.includes(n)||e.results.push(n)}o.combinator===void 0?kl(i,"descendant",o):o.combinator==="~"&&kl(i,"generalSibling",o)}return i}function Co(e,t){return e&&t&&e.length>0&&t.length>0?[...e,...t]:e&&e.length>0?e:t&&t.length>0?t:VC}function bE(e,t){if(t.type==="element"){const n=t.tagName.toUpperCase(),r=(e.types.get(n)||0)+1;e.count++,e.types.set(n,r)}}function gT(e,t,n,r,a,i){let s={adjacentSibling:void 0,descendant:void 0,directChild:void 0,generalSibling:void 0};const o=tC(e,n);if(n.type==="element"){let u=e.rootQuery.rules;a&&a!==i&&(u=e.rootQuery.rules.filter(l=>l.combinator===void 0||l.combinator===">"&&a===i)),s=YC(e,Co(t,u),n,r,a)}return"children"in n&&!e.shallow&&!(e.one&&e.found)&&qC(e,s,n,i),o(),s}function ZC(e,t,n){const r=KC(e,t);return og(r,t||void 0),r.results}function KC(e,t,n){return{direction:"ltr",editableOrEditingHost:!1,elementCount:void 0,elementIndex:void 0,found:!1,language:void 0,one:!1,results:[],rootQuery:XN(e),schema:xa,scopeElements:t?t.type==="root"?t.children:[t]:[],shallow:!1,typeIndex:void 0,typeCount:void 0}}const bT=(e=[],t="")=>(e.forEach(n=>{n.type==="text"?t+=n.value:n.type==="element"&&n.children&&Array.isArray(n.children)&&(t+=bT(n.children))}),t),XC=e=>{const{selector:t,rewrite:n}=e||{};return r=>{if(!(!n||typeof n!="function")){if(t&&typeof t=="string"){const a=ZC(t,r);a&&a.length>0&&Pn(r,a,(i,s,o)=>{n(i,s,o)});return}Pn(r,(a,i,s)=>{n(a,i,s)})}}};function QC(e,t,n,r){let a,i,s;i=t,s=n,a=r,xd(e,i,o,a);function o(u,l){const p=l[l.length-1],d=p?p.children.indexOf(u):void 0;return s(u,d,p)}}const JC=(e="")=>(e.match(/([^?=&]+)(=([^&]*))/g)||[]).reduce((t,n)=>(t[n.slice(0,n.indexOf("="))]=n.slice(n.indexOf("=")+1),t),{}),eI=(e=[],t)=>{let n=t;for(;n>-1;){if(n--,!e[n])return;if(e[n]&&e[n].value&&e[n].value.replace(/(\n|\s)/g,"")!==""||e[n].type!=="text")return!/^rehype:/.test(e[n].value)||e[n].type!=="comment"?void 0:e[n]}},ET=(e=[],t,n,r="<!--",a="-->")=>{let i=t;for(;i<e.length;)if(i++,n){const s=e[i];if(s&&s.value&&s.value.replace(/(\n|\s)/g,"")!==""||e[i]&&e[i].type==="element")return s.tagName===n?s:void 0}else{const s=e[i];if(!s||s.type==="element")return;if(s.type==="text"){const o=ET(e,i,void 0);if(o)return o}if(s.type&&/^(comment|raw|text)$/ig.test(s.type)){const o=new RegExp(`^(s+)?${r}(.*?)${a}`);if(s.value&&!/^rehype:/.test(s.value.replace(/^(\n|\s)+/,"").replace(o,"$2")||""))return;let u=s.value.replace(/^(\n|\s)+/,"");return s.value=u,s}}},EE=({value:e=""},t="<!--",n="-->")=>{let r;try{r=new RegExp(`^${t}(.*?)${n}`)}catch{return{}}const a=e.match(r),s=(a?a[1]:e).replace(/^rehype:/,""),o=JC(s);return Object.keys(o).forEach(u=>{o[u]==="true"?o[u]=!0:o[u]==="false"?o[u]=!1:typeof o[u]=="string"&&!/^0/.test(o[u])&&!isNaN(+o[u])&&(o[u]=+o[u])}),o},yE=(e,t,n)=>n==="string"?{...e,"data-config":JSON.stringify({...t,rehyp:!0})}:n==="attr"?{...e,...t}:{...e,"data-config":{...t,rehyp:!0}},tI=(e={})=>{const{properties:t="data",codeBlockParames:n=!0,commentStart:r="<!--",commentEnd:a="-->"}=e;return i=>{QC(i,"element",(s,o,u)=>{if(n&&s.tagName==="pre"&&s&&Array.isArray(s.children)&&u&&Array.isArray(u.children)&&u.children.length>1){const p=s.children[0];if(p&&p.tagName==="code"&&typeof o=="number"){const d=eI(u.children,o);if(d){const f=EE(d,r,a);Object.keys(f).length>0&&(s.properties={...s.properties,"data-type":"rehyp"},p.properties=yE(p.properties,f,t))}}}let l=u;if((/^(em|strong|b|a|i|p|pre|kbd|blockquote|h(1|2|3|4|5|6)|code|table|img|del|ul|ol)$/.test(s.tagName)||l.type=="root")&&u&&Array.isArray(u.children)&&typeof o=="number"){const p=ET(u.children,o,"",r,a);if(p){const d=EE(p,r,a);Object.keys(d).length>0&&(s.properties=yE(s.properties,d,t))}}})}},yT=-1,Yu=0,qi=1,jo=2,ug=3,lg=4,cg=5,dg=6,xT=7,TT=8,nI=typeof self=="object"?self:globalThis,xE=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new nI[e](t)},rI=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,s]=t[a];switch(i){case Yu:case yT:return n(s,a);case qi:{const o=n([],a);for(const u of s)o.push(r(u));return o}case jo:{const o=n({},a);for(const[u,l]of s)o[r(u)]=r(l);return o}case ug:return n(new Date(s),a);case lg:{const{source:o,flags:u}=s;return n(new RegExp(o,u),a)}case cg:{const o=n(new Map,a);for(const[u,l]of s)o.set(r(u),r(l));return o}case dg:{const o=n(new Set,a);for(const u of s)o.add(r(u));return o}case xT:{const{name:o,message:u}=s;return n(xE(o,u),a)}case TT:return n(BigInt(s),a);case"BigInt":return n(Object(BigInt(s)),a);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:o}=new Uint8Array(s);return n(new DataView(o),s)}}return n(xE(i,s),a)};return r},TE=e=>rI(new Map,e)(0),Na="",{toString:aI}={},{keys:iI}=Object,Ii=e=>{const t=typeof e;if(t!=="object"||!e)return[Yu,t];const n=aI.call(e).slice(8,-1);switch(n){case"Array":return[qi,Na];case"Object":return[jo,Na];case"Date":return[ug,Na];case"RegExp":return[lg,Na];case"Map":return[cg,Na];case"Set":return[dg,Na];case"DataView":return[qi,n]}return n.includes("Array")?[qi,n]:n.includes("Error")?[xT,n]:[jo,n]},ao=([e,t])=>e===Yu&&(t==="function"||t==="symbol"),sI=(e,t,n,r)=>{const a=(s,o)=>{const u=r.push(s)-1;return n.set(o,u),u},i=s=>{if(n.has(s))return n.get(s);let[o,u]=Ii(s);switch(o){case Yu:{let p=s;switch(u){case"bigint":o=TT,p=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return a([yT],s)}return a([o,p],s)}case qi:{if(u){let f=s;return u==="DataView"?f=new Uint8Array(s.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(s)),a([u,[...f]],s)}const p=[],d=a([o,p],s);for(const f of s)p.push(i(f));return d}case jo:{if(u)switch(u){case"BigInt":return a([u,s.toString()],s);case"Boolean":case"Number":case"String":return a([u,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const p=[],d=a([o,p],s);for(const f of iI(s))(e||!ao(Ii(s[f])))&&p.push([i(f),i(s[f])]);return d}case ug:return a([o,s.toISOString()],s);case lg:{const{source:p,flags:d}=s;return a([o,{source:p,flags:d}],s)}case cg:{const p=[],d=a([o,p],s);for(const[f,m]of s)(e||!(ao(Ii(f))||ao(Ii(m))))&&p.push([i(f),i(m)]);return d}case dg:{const p=[],d=a([o,p],s);for(const f of s)(e||!ao(Ii(f)))&&p.push(i(f));return d}}const{message:l}=s;return a([o,{name:u,message:l}],s)};return i},SE=(e,{json:t,lossy:n}={})=>{const r=[];return sI(!(t||n),!!t,new Map,r)(e),r},ua=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?TE(SE(e,t)):structuredClone(e):(e,t)=>TE(SE(e,t));function oI(e){const t=String(e),n=[];return{toOffset:a,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=t.length){let s=0;for(;;){let o=n[s];if(o===void 0){const u=AE(t,n[s-1]);o=u===-1?t.length+1:u+1,n[s]=o}if(o>i)return{line:s+1,column:i-(s>0?n[s-1]:0)+1,offset:i};s++}}}function a(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const o=n[n.length-1],u=AE(t,o),l=u===-1?t.length+1:u+1;if(o===l)break;n.push(l)}const s=(i.line>1?n[i.line-2]:0)+i.column-1;if(s<n[i.line-1])return s}}}function AE(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
16
16
  `,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const aa={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},ST={}.hasOwnProperty,uI=Object.prototype;function AT(e,t){const n=t||{};return pg({file:n.file||void 0,location:!1,schema:n.space==="svg"?ur:xa,verbose:n.verbose||!1},e)}function pg(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},Io(e,r,n),n}case"#document":case"#document-fragment":{const r=t,a="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:vT(e,t.childNodes),data:{quirksMode:a}},e.file&&e.location){const i=String(e.file),s=oI(i),o=s.toPoint(0),u=s.toPoint(i.length);n.position={start:o,end:u}}return n}case"#documentType":{const r=t;return n={type:"doctype"},Io(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},Io(e,r,n),n}default:return n=lI(e,t),n}}function vT(e,t){let n=-1;const r=[];for(;++n<t.length;){const a=pg(e,t[n]);r.push(a)}return r}function lI(e,t){const n=e.schema;e.schema=t.namespaceURI===aa.svg?ur:xa;let r=-1;const a={};for(;++r<t.attrs.length;){const o=t.attrs[r],u=(o.prefix?o.prefix+":":"")+o.name;ST.call(uI,u)||(a[u]=o.value)}const s=(e.schema.space==="svg"?bN:Qx)(t.tagName,a,vT(e,t.childNodes));if(Io(e,t,s),s.tagName==="template"){const o=t,u=o.sourceCodeLocation,l=u&&u.startTag&&Ma(u.startTag),p=u&&u.endTag&&Ma(u.endTag),d=pg(e,o.content);l&&p&&e.file&&(d.position={start:l.end,end:p.start}),s.content=d}return e.schema=n,s}function Io(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=cI(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function cI(e,t,n){const r=Ma(n);if(t.type==="element"){const a=t.children[t.children.length-1];if(r&&!n.endTag&&a&&a.position&&a.position.end&&(r.end=Object.assign({},a.position.end)),e.verbose){const i={};let s;if(n.attrs)for(s in n.attrs)ST.call(n.attrs,s)&&(i[oi(e.schema,s).property]=Ma(n.attrs[s]));n.startTag;const o=Ma(n.startTag),u=n.endTag?Ma(n.endTag):void 0,l={opening:o};u&&(l.closing=u),l.properties=i,t.data={position:l}}}return r}function Ma(e){const t=vE({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=vE({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function vE(e){return e.line&&e.column?e:void 0}const dI={},pI={}.hasOwnProperty,wT=Vu("type",{handlers:{root:mI,element:yI,text:bI,comment:EI,doctype:gI}});function fI(e,t){const r=(t||dI).space;return wT(e,r==="svg"?ur:xa)}function mI(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=fg(e.children,n,t),li(e,n),n}function hI(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=fg(e.children,n,t),li(e,n),n}function gI(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return li(e,t),t}function bI(e){const t={nodeName:"#text",value:e.value,parentNode:null};return li(e,t),t}function EI(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return li(e,t),t}function yI(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=ur);const a=[];let i;if(e.properties){for(i in e.properties)if(i!=="children"&&pI.call(e.properties,i)){const u=xI(r,i,e.properties[i]);u&&a.push(u)}}const s=r.space,o={nodeName:e.tagName,tagName:e.tagName,attrs:a,namespaceURI:aa[s],childNodes:[],parentNode:null};return o.childNodes=fg(e.children,o,r),li(e,o),e.tagName==="template"&&e.content&&(o.content=hI(e.content,r)),o}function xI(e,t,n){const r=oi(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?$u(n):zu(n));const a={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const i=a.name.indexOf(":");i<0?a.prefix="":(a.name=a.name.slice(i+1),a.prefix=r.attribute.slice(0,i)),a.namespace=aa[r.space]}return a}function fg(e,t,n){let r=-1;const a=[];if(e)for(;++r<e.length;){const i=wT(e[r],n);i.parentNode=t,a.push(i)}return a}function li(e,t){const n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}const _T=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],TI=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),Ft="�";var C;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(C||(C={}));const Fn={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function NT(e){return e>=55296&&e<=57343}function SI(e){return e>=56320&&e<=57343}function AI(e,t){return(e-55296)*1024+9216+t}function CT(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function IT(e){return e>=64976&&e<=65007||TI.has(e)}var K;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(K||(K={}));const vI=65536;class wI{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=vI,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:a,offset:i}=this,s=a+n,o=i+n;return{code:t,startLine:r,endLine:r,startCol:s,endCol:s,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(SI(n))return this.pos++,this._addGap(),AI(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,C.EOF;return this._err(K.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,C.EOF;const r=this.html.charCodeAt(n);return r===C.CARRIAGE_RETURN?C.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,C.EOF;let t=this.html.charCodeAt(this.pos);return t===C.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,C.LINE_FEED):t===C.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,NT(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===C.LINE_FEED||t===C.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){CT(t)?this._err(K.controlCharacterInInputStream):IT(t)&&this._err(K.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var nt;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(nt||(nt={}));function kT(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const _I=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),NI=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function CI(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=NI.get(e))!==null&&t!==void 0?t:e}var cn;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(cn||(cn={}));const II=32;var qr;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(qr||(qr={}));function Pc(e){return e>=cn.ZERO&&e<=cn.NINE}function kI(e){return e>=cn.UPPER_A&&e<=cn.UPPER_F||e>=cn.LOWER_A&&e<=cn.LOWER_F}function RI(e){return e>=cn.UPPER_A&&e<=cn.UPPER_Z||e>=cn.LOWER_A&&e<=cn.LOWER_Z||Pc(e)}function DI(e){return e===cn.EQUALS||RI(e)}var on;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(on||(on={}));var wr;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(wr||(wr={}));class OI{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=on.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=wr.Strict}startEntity(t){this.decodeMode=t,this.state=on.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case on.EntityStart:return t.charCodeAt(n)===cn.NUM?(this.state=on.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=on.NamedEntity,this.stateNamedEntity(t,n));case on.NumericStart:return this.stateNumericStart(t,n);case on.NumericDecimal:return this.stateNumericDecimal(t,n);case on.NumericHex:return this.stateNumericHex(t,n);case on.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|II)===cn.LOWER_X?(this.state=on.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=on.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,a){if(n!==r){const i=r-n;this.result=this.result*Math.pow(a,i)+Number.parseInt(t.substr(n,i),a),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(Pc(a)||kI(a))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(a,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(Pc(a))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(a,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===cn.SEMI)this.consumed+=1;else if(this.decodeMode===wr.Strict)return 0;return this.emitCodePoint(CI(this.result),this.consumed),this.errors&&(t!==cn.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let a=r[this.treeIndex],i=(a&qr.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const s=t.charCodeAt(n);if(this.treeIndex=LI(r,a,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return this.result===0||this.decodeMode===wr.Attribute&&(i===0||DI(s))?0:this.emitNotTerminatedNamedEntity();if(a=r[this.treeIndex],i=(a&qr.VALUE_LENGTH)>>14,i!==0){if(s===cn.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==wr.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,a=(r[n]&qr.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,a,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:a}=this;return this.emitCodePoint(n===1?a[t]&~qr.VALUE_LENGTH:a[t+1],r),n===3&&this.emitCodePoint(a[t+2],r),r}end(){var t;switch(this.state){case on.NamedEntity:return this.result!==0&&(this.decodeMode!==wr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case on.NumericDecimal:return this.emitNumericEntity(0,2);case on.NumericHex:return this.emitNumericEntity(0,3);case on.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case on.EntityStart:return 0}}}function LI(e,t,n,r){const a=(t&qr.BRANCH_LENGTH)>>7,i=t&qr.JUMP_TABLE;if(a===0)return i!==0&&r===i?n:-1;if(i){const u=r-i;return u<0||u>=a?-1:e[n+u]-1}let s=n,o=s+a-1;for(;s<=o;){const u=s+o>>>1,l=e[u];if(l<r)s=u+1;else if(l>r)o=u-1;else return e[u+a]}return-1}var ne;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(ne||(ne={}));var sa;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(sa||(sa={}));var Xn;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Xn||(Xn={}));var z;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(z||(z={}));var h;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(h||(h={}));const FI=new Map([[z.A,h.A],[z.ADDRESS,h.ADDRESS],[z.ANNOTATION_XML,h.ANNOTATION_XML],[z.APPLET,h.APPLET],[z.AREA,h.AREA],[z.ARTICLE,h.ARTICLE],[z.ASIDE,h.ASIDE],[z.B,h.B],[z.BASE,h.BASE],[z.BASEFONT,h.BASEFONT],[z.BGSOUND,h.BGSOUND],[z.BIG,h.BIG],[z.BLOCKQUOTE,h.BLOCKQUOTE],[z.BODY,h.BODY],[z.BR,h.BR],[z.BUTTON,h.BUTTON],[z.CAPTION,h.CAPTION],[z.CENTER,h.CENTER],[z.CODE,h.CODE],[z.COL,h.COL],[z.COLGROUP,h.COLGROUP],[z.DD,h.DD],[z.DESC,h.DESC],[z.DETAILS,h.DETAILS],[z.DIALOG,h.DIALOG],[z.DIR,h.DIR],[z.DIV,h.DIV],[z.DL,h.DL],[z.DT,h.DT],[z.EM,h.EM],[z.EMBED,h.EMBED],[z.FIELDSET,h.FIELDSET],[z.FIGCAPTION,h.FIGCAPTION],[z.FIGURE,h.FIGURE],[z.FONT,h.FONT],[z.FOOTER,h.FOOTER],[z.FOREIGN_OBJECT,h.FOREIGN_OBJECT],[z.FORM,h.FORM],[z.FRAME,h.FRAME],[z.FRAMESET,h.FRAMESET],[z.H1,h.H1],[z.H2,h.H2],[z.H3,h.H3],[z.H4,h.H4],[z.H5,h.H5],[z.H6,h.H6],[z.HEAD,h.HEAD],[z.HEADER,h.HEADER],[z.HGROUP,h.HGROUP],[z.HR,h.HR],[z.HTML,h.HTML],[z.I,h.I],[z.IMG,h.IMG],[z.IMAGE,h.IMAGE],[z.INPUT,h.INPUT],[z.IFRAME,h.IFRAME],[z.KEYGEN,h.KEYGEN],[z.LABEL,h.LABEL],[z.LI,h.LI],[z.LINK,h.LINK],[z.LISTING,h.LISTING],[z.MAIN,h.MAIN],[z.MALIGNMARK,h.MALIGNMARK],[z.MARQUEE,h.MARQUEE],[z.MATH,h.MATH],[z.MENU,h.MENU],[z.META,h.META],[z.MGLYPH,h.MGLYPH],[z.MI,h.MI],[z.MO,h.MO],[z.MN,h.MN],[z.MS,h.MS],[z.MTEXT,h.MTEXT],[z.NAV,h.NAV],[z.NOBR,h.NOBR],[z.NOFRAMES,h.NOFRAMES],[z.NOEMBED,h.NOEMBED],[z.NOSCRIPT,h.NOSCRIPT],[z.OBJECT,h.OBJECT],[z.OL,h.OL],[z.OPTGROUP,h.OPTGROUP],[z.OPTION,h.OPTION],[z.P,h.P],[z.PARAM,h.PARAM],[z.PLAINTEXT,h.PLAINTEXT],[z.PRE,h.PRE],[z.RB,h.RB],[z.RP,h.RP],[z.RT,h.RT],[z.RTC,h.RTC],[z.RUBY,h.RUBY],[z.S,h.S],[z.SCRIPT,h.SCRIPT],[z.SEARCH,h.SEARCH],[z.SECTION,h.SECTION],[z.SELECT,h.SELECT],[z.SOURCE,h.SOURCE],[z.SMALL,h.SMALL],[z.SPAN,h.SPAN],[z.STRIKE,h.STRIKE],[z.STRONG,h.STRONG],[z.STYLE,h.STYLE],[z.SUB,h.SUB],[z.SUMMARY,h.SUMMARY],[z.SUP,h.SUP],[z.TABLE,h.TABLE],[z.TBODY,h.TBODY],[z.TEMPLATE,h.TEMPLATE],[z.TEXTAREA,h.TEXTAREA],[z.TFOOT,h.TFOOT],[z.TD,h.TD],[z.TH,h.TH],[z.THEAD,h.THEAD],[z.TITLE,h.TITLE],[z.TR,h.TR],[z.TRACK,h.TRACK],[z.TT,h.TT],[z.U,h.U],[z.UL,h.UL],[z.SVG,h.SVG],[z.VAR,h.VAR],[z.WBR,h.WBR],[z.XMP,h.XMP]]);function ci(e){var t;return(t=FI.get(e))!==null&&t!==void 0?t:h.UNKNOWN}const ae=h,MI={[ne.HTML]:new Set([ae.ADDRESS,ae.APPLET,ae.AREA,ae.ARTICLE,ae.ASIDE,ae.BASE,ae.BASEFONT,ae.BGSOUND,ae.BLOCKQUOTE,ae.BODY,ae.BR,ae.BUTTON,ae.CAPTION,ae.CENTER,ae.COL,ae.COLGROUP,ae.DD,ae.DETAILS,ae.DIR,ae.DIV,ae.DL,ae.DT,ae.EMBED,ae.FIELDSET,ae.FIGCAPTION,ae.FIGURE,ae.FOOTER,ae.FORM,ae.FRAME,ae.FRAMESET,ae.H1,ae.H2,ae.H3,ae.H4,ae.H5,ae.H6,ae.HEAD,ae.HEADER,ae.HGROUP,ae.HR,ae.HTML,ae.IFRAME,ae.IMG,ae.INPUT,ae.LI,ae.LINK,ae.LISTING,ae.MAIN,ae.MARQUEE,ae.MENU,ae.META,ae.NAV,ae.NOEMBED,ae.NOFRAMES,ae.NOSCRIPT,ae.OBJECT,ae.OL,ae.P,ae.PARAM,ae.PLAINTEXT,ae.PRE,ae.SCRIPT,ae.SECTION,ae.SELECT,ae.SOURCE,ae.STYLE,ae.SUMMARY,ae.TABLE,ae.TBODY,ae.TD,ae.TEMPLATE,ae.TEXTAREA,ae.TFOOT,ae.TH,ae.THEAD,ae.TITLE,ae.TR,ae.TRACK,ae.UL,ae.WBR,ae.XMP]),[ne.MATHML]:new Set([ae.MI,ae.MO,ae.MN,ae.MS,ae.MTEXT,ae.ANNOTATION_XML]),[ne.SVG]:new Set([ae.TITLE,ae.FOREIGN_OBJECT,ae.DESC]),[ne.XLINK]:new Set,[ne.XML]:new Set,[ne.XMLNS]:new Set},Bc=new Set([ae.H1,ae.H2,ae.H3,ae.H4,ae.H5,ae.H6]);z.STYLE,z.SCRIPT,z.XMP,z.IFRAME,z.NOEMBED,z.NOFRAMES,z.PLAINTEXT;var O;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(O||(O={}));const Gt={DATA:O.DATA,RCDATA:O.RCDATA,RAWTEXT:O.RAWTEXT,SCRIPT_DATA:O.SCRIPT_DATA,PLAINTEXT:O.PLAINTEXT,CDATA_SECTION:O.CDATA_SECTION};function PI(e){return e>=C.DIGIT_0&&e<=C.DIGIT_9}function ji(e){return e>=C.LATIN_CAPITAL_A&&e<=C.LATIN_CAPITAL_Z}function BI(e){return e>=C.LATIN_SMALL_A&&e<=C.LATIN_SMALL_Z}function Ur(e){return BI(e)||ji(e)}function wE(e){return Ur(e)||PI(e)}function io(e){return e+32}function RT(e){return e===C.SPACE||e===C.LINE_FEED||e===C.TABULATION||e===C.FORM_FEED}function _E(e){return RT(e)||e===C.SOLIDUS||e===C.GREATER_THAN_SIGN}function UI(e){return e===C.NULL?K.nullCharacterReference:e>1114111?K.characterReferenceOutsideUnicodeRange:NT(e)?K.surrogateCharacterReference:IT(e)?K.noncharacterCharacterReference:CT(e)||e===C.CARRIAGE_RETURN?K.controlCharacterReference:null}class jI{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=O.DATA,this.returnState=O.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new wI(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new OI(_I,(r,a)=>{this.preprocessor.pos=this.entityStartPos+a-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(K.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(K.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const a=UI(r);a&&this._err(a,1)}}:void 0)}_err(t,n=0){var r,a;(a=(r=this.handler).onParseError)===null||a===void 0||a.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:nt.START_TAG,tagName:"",tagID:h.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:nt.END_TAG,tagName:"",tagID:h.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:nt.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:nt.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(kT(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const a=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);a[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(K.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=ci(t.tagName),t.type===nt.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(K.endTagWithAttributes),t.selfClosing&&this._err(K.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case nt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case nt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case nt.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:nt.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=RT(t)?nt.WHITESPACE_CHARACTER:t===C.NULL?nt.NULL_CHARACTER:nt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(nt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=O.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?wr.Attribute:wr.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===O.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===O.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===O.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case O.DATA:{this._stateData(t);break}case O.RCDATA:{this._stateRcdata(t);break}case O.RAWTEXT:{this._stateRawtext(t);break}case O.SCRIPT_DATA:{this._stateScriptData(t);break}case O.PLAINTEXT:{this._statePlaintext(t);break}case O.TAG_OPEN:{this._stateTagOpen(t);break}case O.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case O.TAG_NAME:{this._stateTagName(t);break}case O.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case O.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case O.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case O.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case O.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case O.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case O.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case O.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case O.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case O.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case O.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case O.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case O.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case O.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case O.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case O.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case O.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case O.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case O.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case O.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case O.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case O.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case O.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case O.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case O.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case O.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case O.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case O.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case O.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case O.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case O.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case O.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case O.BOGUS_COMMENT:{this._stateBogusComment(t);break}case O.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case O.COMMENT_START:{this._stateCommentStart(t);break}case O.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case O.COMMENT:{this._stateComment(t);break}case O.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case O.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case O.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case O.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case O.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case O.COMMENT_END:{this._stateCommentEnd(t);break}case O.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case O.DOCTYPE:{this._stateDoctype(t);break}case O.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case O.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case O.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case O.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case O.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case O.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case O.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case O.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case O.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case O.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case O.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case O.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case O.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case O.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case O.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case O.CDATA_SECTION:{this._stateCdataSection(t);break}case O.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case O.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case O.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case O.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case C.LESS_THAN_SIGN:{this.state=O.TAG_OPEN;break}case C.AMPERSAND:{this._startCharacterReference();break}case C.NULL:{this._err(K.unexpectedNullCharacter),this._emitCodePoint(t);break}case C.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case C.AMPERSAND:{this._startCharacterReference();break}case C.LESS_THAN_SIGN:{this.state=O.RCDATA_LESS_THAN_SIGN;break}case C.NULL:{this._err(K.unexpectedNullCharacter),this._emitChars(Ft);break}case C.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case C.LESS_THAN_SIGN:{this.state=O.RAWTEXT_LESS_THAN_SIGN;break}case C.NULL:{this._err(K.unexpectedNullCharacter),this._emitChars(Ft);break}case C.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case C.LESS_THAN_SIGN:{this.state=O.SCRIPT_DATA_LESS_THAN_SIGN;break}case C.NULL:{this._err(K.unexpectedNullCharacter),this._emitChars(Ft);break}case C.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case C.NULL:{this._err(K.unexpectedNullCharacter),this._emitChars(Ft);break}case C.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Ur(t))this._createStartTagToken(),this.state=O.TAG_NAME,this._stateTagName(t);else switch(t){case C.EXCLAMATION_MARK:{this.state=O.MARKUP_DECLARATION_OPEN;break}case C.SOLIDUS:{this.state=O.END_TAG_OPEN;break}case C.QUESTION_MARK:{this._err(K.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=O.BOGUS_COMMENT,this._stateBogusComment(t);break}case C.EOF:{this._err(K.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(K.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=O.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Ur(t))this._createEndTagToken(),this.state=O.TAG_NAME,this._stateTagName(t);else switch(t){case C.GREATER_THAN_SIGN:{this._err(K.missingEndTagName),this.state=O.DATA;break}case C.EOF:{this._err(K.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(K.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=O.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this.state=O.BEFORE_ATTRIBUTE_NAME;break}case C.SOLIDUS:{this.state=O.SELF_CLOSING_START_TAG;break}case C.GREATER_THAN_SIGN:{this.state=O.DATA,this.emitCurrentTagToken();break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.tagName+=Ft;break}case C.EOF:{this._err(K.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(ji(t)?io(t):t)}}_stateRcdataLessThanSign(t){t===C.SOLIDUS?this.state=O.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=O.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){Ur(t)?(this.state=O.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=O.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=O.BEFORE_ATTRIBUTE_NAME,!1;case C.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=O.SELF_CLOSING_START_TAG,!1;case C.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=O.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=O.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===C.SOLIDUS?this.state=O.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=O.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){Ur(t)?(this.state=O.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=O.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=O.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case C.SOLIDUS:{this.state=O.SCRIPT_DATA_END_TAG_OPEN;break}case C.EXCLAMATION_MARK:{this.state=O.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=O.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){Ur(t)?(this.state=O.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=O.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=O.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===C.HYPHEN_MINUS?(this.state=O.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=O.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===C.HYPHEN_MINUS?(this.state=O.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=O.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case C.HYPHEN_MINUS:{this.state=O.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case C.LESS_THAN_SIGN:{this.state=O.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case C.NULL:{this._err(K.unexpectedNullCharacter),this._emitChars(Ft);break}case C.EOF:{this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case C.HYPHEN_MINUS:{this.state=O.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case C.LESS_THAN_SIGN:{this.state=O.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.state=O.SCRIPT_DATA_ESCAPED,this._emitChars(Ft);break}case C.EOF:{this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=O.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case C.HYPHEN_MINUS:{this._emitChars("-");break}case C.LESS_THAN_SIGN:{this.state=O.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case C.GREATER_THAN_SIGN:{this.state=O.SCRIPT_DATA,this._emitChars(">");break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.state=O.SCRIPT_DATA_ESCAPED,this._emitChars(Ft);break}case C.EOF:{this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=O.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===C.SOLIDUS?this.state=O.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ur(t)?(this._emitChars("<"),this.state=O.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=O.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Ur(t)?(this.state=O.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=O.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=O.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Fn.SCRIPT,!1)&&_E(this.preprocessor.peek(Fn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Fn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=O.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case C.HYPHEN_MINUS:{this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case C.LESS_THAN_SIGN:{this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case C.NULL:{this._err(K.unexpectedNullCharacter),this._emitChars(Ft);break}case C.EOF:{this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case C.HYPHEN_MINUS:{this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case C.LESS_THAN_SIGN:{this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ft);break}case C.EOF:{this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case C.HYPHEN_MINUS:{this._emitChars("-");break}case C.LESS_THAN_SIGN:{this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case C.GREATER_THAN_SIGN:{this.state=O.SCRIPT_DATA,this._emitChars(">");break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ft);break}case C.EOF:{this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===C.SOLIDUS?(this.state=O.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Fn.SCRIPT,!1)&&_E(this.preprocessor.peek(Fn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Fn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=O.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=O.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.SOLIDUS:case C.GREATER_THAN_SIGN:case C.EOF:{this.state=O.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case C.EQUALS_SIGN:{this._err(K.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=O.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=O.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:case C.SOLIDUS:case C.GREATER_THAN_SIGN:case C.EOF:{this._leaveAttrName(),this.state=O.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case C.EQUALS_SIGN:{this._leaveAttrName(),this.state=O.BEFORE_ATTRIBUTE_VALUE;break}case C.QUOTATION_MARK:case C.APOSTROPHE:case C.LESS_THAN_SIGN:{this._err(K.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.currentAttr.name+=Ft;break}default:this.currentAttr.name+=String.fromCodePoint(ji(t)?io(t):t)}}_stateAfterAttributeName(t){switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.SOLIDUS:{this.state=O.SELF_CLOSING_START_TAG;break}case C.EQUALS_SIGN:{this.state=O.BEFORE_ATTRIBUTE_VALUE;break}case C.GREATER_THAN_SIGN:{this.state=O.DATA,this.emitCurrentTagToken();break}case C.EOF:{this._err(K.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=O.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.QUOTATION_MARK:{this.state=O.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case C.APOSTROPHE:{this.state=O.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case C.GREATER_THAN_SIGN:{this._err(K.missingAttributeValue),this.state=O.DATA,this.emitCurrentTagToken();break}default:this.state=O.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case C.QUOTATION_MARK:{this.state=O.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case C.AMPERSAND:{this._startCharacterReference();break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.currentAttr.value+=Ft;break}case C.EOF:{this._err(K.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case C.APOSTROPHE:{this.state=O.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case C.AMPERSAND:{this._startCharacterReference();break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.currentAttr.value+=Ft;break}case C.EOF:{this._err(K.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this._leaveAttrValue(),this.state=O.BEFORE_ATTRIBUTE_NAME;break}case C.AMPERSAND:{this._startCharacterReference();break}case C.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=O.DATA,this.emitCurrentTagToken();break}case C.NULL:{this._err(K.unexpectedNullCharacter),this.currentAttr.value+=Ft;break}case C.QUOTATION_MARK:case C.APOSTROPHE:case C.LESS_THAN_SIGN:case C.EQUALS_SIGN:case C.GRAVE_ACCENT:{this._err(K.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case C.EOF:{this._err(K.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this._leaveAttrValue(),this.state=O.BEFORE_ATTRIBUTE_NAME;break}case C.SOLIDUS:{this._leaveAttrValue(),this.state=O.SELF_CLOSING_START_TAG;break}case C.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=O.DATA,this.emitCurrentTagToken();break}case C.EOF:{this._err(K.eofInTag),this._emitEOFToken();break}default:this._err(K.missingWhitespaceBetweenAttributes),this.state=O.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case C.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=O.DATA,this.emitCurrentTagToken();break}case C.EOF:{this._err(K.eofInTag),this._emitEOFToken();break}default:this._err(K.unexpectedSolidusInTag),this.state=O.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case C.GREATER_THAN_SIGN:{this.state=O.DATA,this.emitCurrentComment(n);break}case C.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.data+=Ft;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Fn.DASH_DASH,!0)?(this._createCommentToken(Fn.DASH_DASH.length+1),this.state=O.COMMENT_START):this._consumeSequenceIfMatch(Fn.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Fn.DOCTYPE.length+1),this.state=O.DOCTYPE):this._consumeSequenceIfMatch(Fn.CDATA_START,!0)?this.inForeignNode?this.state=O.CDATA_SECTION:(this._err(K.cdataInHtmlContent),this._createCommentToken(Fn.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=O.BOGUS_COMMENT):this._ensureHibernation()||(this._err(K.incorrectlyOpenedComment),this._createCommentToken(2),this.state=O.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case C.HYPHEN_MINUS:{this.state=O.COMMENT_START_DASH;break}case C.GREATER_THAN_SIGN:{this._err(K.abruptClosingOfEmptyComment),this.state=O.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=O.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case C.HYPHEN_MINUS:{this.state=O.COMMENT_END;break}case C.GREATER_THAN_SIGN:{this._err(K.abruptClosingOfEmptyComment),this.state=O.DATA,this.emitCurrentComment(n);break}case C.EOF:{this._err(K.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=O.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case C.HYPHEN_MINUS:{this.state=O.COMMENT_END_DASH;break}case C.LESS_THAN_SIGN:{n.data+="<",this.state=O.COMMENT_LESS_THAN_SIGN;break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.data+=Ft;break}case C.EOF:{this._err(K.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case C.EXCLAMATION_MARK:{n.data+="!",this.state=O.COMMENT_LESS_THAN_SIGN_BANG;break}case C.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=O.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===C.HYPHEN_MINUS?this.state=O.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=O.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===C.HYPHEN_MINUS?this.state=O.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=O.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==C.GREATER_THAN_SIGN&&t!==C.EOF&&this._err(K.nestedComment),this.state=O.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case C.HYPHEN_MINUS:{this.state=O.COMMENT_END;break}case C.EOF:{this._err(K.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=O.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case C.GREATER_THAN_SIGN:{this.state=O.DATA,this.emitCurrentComment(n);break}case C.EXCLAMATION_MARK:{this.state=O.COMMENT_END_BANG;break}case C.HYPHEN_MINUS:{n.data+="-";break}case C.EOF:{this._err(K.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=O.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case C.HYPHEN_MINUS:{n.data+="--!",this.state=O.COMMENT_END_DASH;break}case C.GREATER_THAN_SIGN:{this._err(K.incorrectlyClosedComment),this.state=O.DATA,this.emitCurrentComment(n);break}case C.EOF:{this._err(K.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=O.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this.state=O.BEFORE_DOCTYPE_NAME;break}case C.GREATER_THAN_SIGN:{this.state=O.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case C.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.missingWhitespaceBeforeDoctypeName),this.state=O.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(ji(t))this._createDoctypeToken(String.fromCharCode(io(t))),this.state=O.DOCTYPE_NAME;else switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.NULL:{this._err(K.unexpectedNullCharacter),this._createDoctypeToken(Ft),this.state=O.DOCTYPE_NAME;break}case C.GREATER_THAN_SIGN:{this._err(K.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=O.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this.state=O.AFTER_DOCTYPE_NAME;break}case C.GREATER_THAN_SIGN:{this.state=O.DATA,this.emitCurrentDoctype(n);break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.name+=Ft;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(ji(t)?io(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.GREATER_THAN_SIGN:{this.state=O.DATA,this.emitCurrentDoctype(n);break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Fn.PUBLIC,!1)?this.state=O.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Fn.SYSTEM,!1)?this.state=O.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(K.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this.state=O.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case C.QUOTATION_MARK:{this._err(K.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=O.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case C.APOSTROPHE:{this._err(K.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=O.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case C.GREATER_THAN_SIGN:{this._err(K.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=O.DATA,this.emitCurrentDoctype(n);break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.QUOTATION_MARK:{n.publicId="",this.state=O.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case C.APOSTROPHE:{n.publicId="",this.state=O.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case C.GREATER_THAN_SIGN:{this._err(K.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=O.DATA,this.emitCurrentDoctype(n);break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case C.QUOTATION_MARK:{this.state=O.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.publicId+=Ft;break}case C.GREATER_THAN_SIGN:{this._err(K.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case C.APOSTROPHE:{this.state=O.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.publicId+=Ft;break}case C.GREATER_THAN_SIGN:{this._err(K.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this.state=O.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case C.GREATER_THAN_SIGN:{this.state=O.DATA,this.emitCurrentDoctype(n);break}case C.QUOTATION_MARK:{this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case C.APOSTROPHE:{this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.QUOTATION_MARK:{n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case C.APOSTROPHE:{n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:{this.state=O.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case C.QUOTATION_MARK:{this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case C.APOSTROPHE:{this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case C.GREATER_THAN_SIGN:{this._err(K.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=O.DATA,this.emitCurrentDoctype(n);break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.QUOTATION_MARK:{n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case C.APOSTROPHE:{n.systemId="",this.state=O.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case C.GREATER_THAN_SIGN:{this._err(K.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=O.DATA,this.emitCurrentDoctype(n);break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case C.QUOTATION_MARK:{this.state=O.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.systemId+=Ft;break}case C.GREATER_THAN_SIGN:{this._err(K.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case C.APOSTROPHE:{this.state=O.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case C.NULL:{this._err(K.unexpectedNullCharacter),n.systemId+=Ft;break}case C.GREATER_THAN_SIGN:{this._err(K.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case C.SPACE:case C.LINE_FEED:case C.TABULATION:case C.FORM_FEED:break;case C.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.EOF:{this._err(K.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(K.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=O.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case C.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=O.DATA;break}case C.NULL:{this._err(K.unexpectedNullCharacter);break}case C.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case C.RIGHT_SQUARE_BRACKET:{this.state=O.CDATA_SECTION_BRACKET;break}case C.EOF:{this._err(K.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===C.RIGHT_SQUARE_BRACKET?this.state=O.CDATA_SECTION_END:(this._emitChars("]"),this.state=O.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case C.GREATER_THAN_SIGN:{this.state=O.DATA;break}case C.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=O.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(C.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&wE(this.preprocessor.peek(1))?O.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){wE(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===C.SEMICOLON&&this._err(K.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const DT=new Set([h.DD,h.DT,h.LI,h.OPTGROUP,h.OPTION,h.P,h.RB,h.RP,h.RT,h.RTC]),NE=new Set([...DT,h.CAPTION,h.COLGROUP,h.TBODY,h.TD,h.TFOOT,h.TH,h.THEAD,h.TR]),$o=new Set([h.APPLET,h.CAPTION,h.HTML,h.MARQUEE,h.OBJECT,h.TABLE,h.TD,h.TEMPLATE,h.TH]),$I=new Set([...$o,h.OL,h.UL]),zI=new Set([...$o,h.BUTTON]),CE=new Set([h.ANNOTATION_XML,h.MI,h.MN,h.MO,h.MS,h.MTEXT]),IE=new Set([h.DESC,h.FOREIGN_OBJECT,h.TITLE]),HI=new Set([h.TR,h.TEMPLATE,h.HTML]),GI=new Set([h.TBODY,h.TFOOT,h.THEAD,h.TEMPLATE,h.HTML]),WI=new Set([h.TABLE,h.TEMPLATE,h.HTML]),VI=new Set([h.TD,h.TH]);class qI{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=h.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===h.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ne.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const a=this._indexOf(t)+1;this.items.splice(a,0,n),this.tagIDs.splice(a,0,r),this.stackTop++,a===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,a===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==ne.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Bc,ne.HTML)}popUntilTableCellPopped(){this.popUntilPopped(VI,ne.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(WI,ne.HTML)}clearBackToTableBodyContext(){this.clearBackTo(GI,ne.HTML)}clearBackToTableRowContext(){this.clearBackTo(HI,ne.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===h.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===h.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const a=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ne.HTML:{if(a===t)return!0;if(n.has(a))return!1;break}case ne.SVG:{if(IE.has(a))return!1;break}case ne.MATHML:{if(CE.has(a))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,$o)}hasInListItemScope(t){return this.hasInDynamicScope(t,$I)}hasInButtonScope(t){return this.hasInDynamicScope(t,zI)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ne.HTML:{if(Bc.has(n))return!0;if($o.has(n))return!1;break}case ne.SVG:{if(IE.has(n))return!1;break}case ne.MATHML:{if(CE.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ne.HTML)switch(this.tagIDs[n]){case t:return!0;case h.TABLE:case h.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ne.HTML)switch(this.tagIDs[t]){case h.TBODY:case h.THEAD:case h.TFOOT:return!0;case h.TABLE:case h.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ne.HTML)switch(this.tagIDs[n]){case t:return!0;case h.OPTION:case h.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&DT.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&NE.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&NE.has(this.currentTagId);)this.pop()}}const Rl=3;var hr;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(hr||(hr={}));const kE={type:hr.Marker};class YI{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],a=n.length,i=this.treeAdapter.getTagName(t),s=this.treeAdapter.getNamespaceURI(t);for(let o=0;o<this.entries.length;o++){const u=this.entries[o];if(u.type===hr.Marker)break;const{element:l}=u;if(this.treeAdapter.getTagName(l)===i&&this.treeAdapter.getNamespaceURI(l)===s){const p=this.treeAdapter.getAttrList(l);p.length===a&&r.push({idx:o,attrs:p})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<Rl)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<Rl)return;const a=new Map(n.map(s=>[s.name,s.value]));let i=0;for(let s=0;s<r.length;s++){const o=r[s];o.attrs.every(u=>a.get(u.name)===u.value)&&(i+=1,i>=Rl&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(kE)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:hr.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:hr.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(kE);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===hr.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===hr.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===hr.Element&&n.element===t)}}const jr={createDocument(){return{nodeName:"#document",mode:Xn.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const a=e.childNodes.find(i=>i.nodeName==="#documentType");if(a)a.name=t,a.publicId=n,a.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};jr.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(jr.isTextNode(n)){n.value+=t;return}}jr.appendChild(e,jr.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&jr.isTextNode(r)?r.value+=t:jr.insertBefore(e,jr.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},OT="html",ZI="about:legacy-compat",KI="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",LT=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],XI=[...LT,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],QI=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),FT=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],JI=[...FT,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function RE(e,t){return t.some(n=>e.startsWith(n))}function ek(e){return e.name===OT&&e.publicId===null&&(e.systemId===null||e.systemId===ZI)}function tk(e){if(e.name!==OT)return Xn.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===KI)return Xn.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),QI.has(n))return Xn.QUIRKS;let r=t===null?XI:LT;if(RE(n,r))return Xn.QUIRKS;if(r=t===null?FT:JI,RE(n,r))return Xn.LIMITED_QUIRKS}return Xn.NO_QUIRKS}const DE={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},nk="definitionurl",rk="definitionURL",ak=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),ik=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ne.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ne.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ne.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ne.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ne.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ne.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ne.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ne.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ne.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ne.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ne.XMLNS}]]),sk=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),ok=new Set([h.B,h.BIG,h.BLOCKQUOTE,h.BODY,h.BR,h.CENTER,h.CODE,h.DD,h.DIV,h.DL,h.DT,h.EM,h.EMBED,h.H1,h.H2,h.H3,h.H4,h.H5,h.H6,h.HEAD,h.HR,h.I,h.IMG,h.LI,h.LISTING,h.MENU,h.META,h.NOBR,h.OL,h.P,h.PRE,h.RUBY,h.S,h.SMALL,h.SPAN,h.STRONG,h.STRIKE,h.SUB,h.SUP,h.TABLE,h.TT,h.U,h.UL,h.VAR]);function uk(e){const t=e.tagID;return t===h.FONT&&e.attrs.some(({name:r})=>r===sa.COLOR||r===sa.SIZE||r===sa.FACE)||ok.has(t)}function MT(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===nk){e.attrs[t].name=rk;break}}function PT(e){for(let t=0;t<e.attrs.length;t++){const n=ak.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function mg(e){for(let t=0;t<e.attrs.length;t++){const n=ik.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function lk(e){const t=sk.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=ci(e.tagName))}function ck(e,t){return t===ne.MATHML&&(e===h.MI||e===h.MO||e===h.MN||e===h.MS||e===h.MTEXT)}function dk(e,t,n){if(t===ne.MATHML&&e===h.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===sa.ENCODING){const a=n[r].value.toLowerCase();return a===DE.TEXT_HTML||a===DE.APPLICATION_XML}}return t===ne.SVG&&(e===h.FOREIGN_OBJECT||e===h.DESC||e===h.TITLE)}function pk(e,t,n,r){return(!r||r===ne.HTML)&&dk(e,t,n)||(!r||r===ne.MATHML)&&ck(e,t)}const fk="hidden",mk=8,hk=3;var B;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(B||(B={}));const gk={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},BT=new Set([h.TABLE,h.TBODY,h.TFOOT,h.THEAD,h.TR]),OE={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:jr,onParseError:null};class zo{constructor(t,n,r=null,a=null){this.fragmentContext=r,this.scriptHandler=a,this.currentToken=null,this.stopped=!1,this.insertionMode=B.INITIAL,this.originalInsertionMode=B.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...OE,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new jI(this.options,this),this.activeFormattingElements=new YI(this.treeAdapter),this.fragmentContextID=r?ci(this.treeAdapter.getTagName(r)):h.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new qI(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...OE,...n};t??(t=r.treeAdapter.createElement(z.TEMPLATE,ne.HTML,[]));const a=r.treeAdapter.createElement("documentmock",ne.HTML,[]),i=new this(r,a,t);return i.fragmentContextID===h.TEMPLATE&&i.tmplInsertionModeStack.unshift(B.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var a;if(!this.onParseError)return;const i=(a=t.location)!==null&&a!==void 0?a:gk,s={code:n,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:r?i.startLine:i.endLine,endCol:r?i.startCol:i.endCol,endOffset:r?i.startOffset:i.endOffset};this.onParseError(s)}onItemPush(t,n,r){var a,i;(i=(a=this.treeAdapter).onItemPush)===null||i===void 0||i.call(a,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,a;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(a=(r=this.treeAdapter).onItemPop)===null||a===void 0||a.call(r,t,this.openElements.current),n){let i,s;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,s=this.fragmentContextID):{current:i,currentTagId:s}=this.openElements,this._setContextModes(i,s)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ne.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ne.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=B.TEXT}switchToPlaintextParsing(){this.insertionMode=B.TEXT,this.originalInsertionMode=B.IN_BODY,this.tokenizer.state=Gt.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===z.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ne.HTML))switch(this.fragmentContextID){case h.TITLE:case h.TEXTAREA:{this.tokenizer.state=Gt.RCDATA;break}case h.STYLE:case h.XMP:case h.IFRAME:case h.NOEMBED:case h.NOFRAMES:case h.NOSCRIPT:{this.tokenizer.state=Gt.RAWTEXT;break}case h.SCRIPT:{this.tokenizer.state=Gt.SCRIPT_DATA;break}case h.PLAINTEXT:{this.tokenizer.state=Gt.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",a=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,a),t.location){const s=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));s&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,ne.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ne.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(z.HTML,ne.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,h.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const a=this.treeAdapter.getChildNodes(n),i=r?a.lastIndexOf(r):a.length,s=a[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:u,endCol:l,endOffset:p}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:u,endCol:l,endOffset:p})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,a=this.treeAdapter.getTagName(t),i=n.type===nt.END_TAG&&a===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===h.SVG&&this.treeAdapter.getTagName(n)===z.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ne.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===h.MGLYPH||t.tagID===h.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ne.HTML)}_processToken(t){switch(t.type){case nt.CHARACTER:{this.onCharacter(t);break}case nt.NULL_CHARACTER:{this.onNullCharacter(t);break}case nt.COMMENT:{this.onComment(t);break}case nt.DOCTYPE:{this.onDoctype(t);break}case nt.START_TAG:{this._processStartTag(t);break}case nt.END_TAG:{this.onEndTag(t);break}case nt.EOF:{this.onEof(t);break}case nt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const a=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return pk(t,a,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(a=>a.type===hr.Marker||this.openElements.contains(a.element)),r=n===-1?t-1:n-1;for(let a=r;a>=0;a--){const i=this.activeFormattingElements.entries[a];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=B.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(h.P),this.openElements.popUntilTagNamePopped(h.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case h.TR:{this.insertionMode=B.IN_ROW;return}case h.TBODY:case h.THEAD:case h.TFOOT:{this.insertionMode=B.IN_TABLE_BODY;return}case h.CAPTION:{this.insertionMode=B.IN_CAPTION;return}case h.COLGROUP:{this.insertionMode=B.IN_COLUMN_GROUP;return}case h.TABLE:{this.insertionMode=B.IN_TABLE;return}case h.BODY:{this.insertionMode=B.IN_BODY;return}case h.FRAMESET:{this.insertionMode=B.IN_FRAMESET;return}case h.SELECT:{this._resetInsertionModeForSelect(t);return}case h.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case h.HTML:{this.insertionMode=this.headElement?B.AFTER_HEAD:B.BEFORE_HEAD;return}case h.TD:case h.TH:{if(t>0){this.insertionMode=B.IN_CELL;return}break}case h.HEAD:{if(t>0){this.insertionMode=B.IN_HEAD;return}break}}this.insertionMode=B.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===h.TEMPLATE)break;if(r===h.TABLE){this.insertionMode=B.IN_SELECT_IN_TABLE;return}}this.insertionMode=B.IN_SELECT}_isElementCausesFosterParenting(t){return BT.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case h.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ne.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case h.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return MI[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){VR(this,t);return}switch(this.insertionMode){case B.INITIAL:{ki(this,t);break}case B.BEFORE_HTML:{Yi(this,t);break}case B.BEFORE_HEAD:{Zi(this,t);break}case B.IN_HEAD:{Ki(this,t);break}case B.IN_HEAD_NO_SCRIPT:{Xi(this,t);break}case B.AFTER_HEAD:{Qi(this,t);break}case B.IN_BODY:case B.IN_CAPTION:case B.IN_CELL:case B.IN_TEMPLATE:{jT(this,t);break}case B.TEXT:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case B.IN_TABLE:case B.IN_TABLE_BODY:case B.IN_ROW:{Dl(this,t);break}case B.IN_TABLE_TEXT:{VT(this,t);break}case B.IN_COLUMN_GROUP:{Ho(this,t);break}case B.AFTER_BODY:{Go(this,t);break}case B.AFTER_AFTER_BODY:{ko(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){WR(this,t);return}switch(this.insertionMode){case B.INITIAL:{ki(this,t);break}case B.BEFORE_HTML:{Yi(this,t);break}case B.BEFORE_HEAD:{Zi(this,t);break}case B.IN_HEAD:{Ki(this,t);break}case B.IN_HEAD_NO_SCRIPT:{Xi(this,t);break}case B.AFTER_HEAD:{Qi(this,t);break}case B.TEXT:{this._insertCharacters(t);break}case B.IN_TABLE:case B.IN_TABLE_BODY:case B.IN_ROW:{Dl(this,t);break}case B.IN_COLUMN_GROUP:{Ho(this,t);break}case B.AFTER_BODY:{Go(this,t);break}case B.AFTER_AFTER_BODY:{ko(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){Uc(this,t);return}switch(this.insertionMode){case B.INITIAL:case B.BEFORE_HTML:case B.BEFORE_HEAD:case B.IN_HEAD:case B.IN_HEAD_NO_SCRIPT:case B.AFTER_HEAD:case B.IN_BODY:case B.IN_TABLE:case B.IN_CAPTION:case B.IN_COLUMN_GROUP:case B.IN_TABLE_BODY:case B.IN_ROW:case B.IN_CELL:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:case B.IN_TEMPLATE:case B.IN_FRAMESET:case B.AFTER_FRAMESET:{Uc(this,t);break}case B.IN_TABLE_TEXT:{Ri(this,t);break}case B.AFTER_BODY:{Ak(this,t);break}case B.AFTER_AFTER_BODY:case B.AFTER_AFTER_FRAMESET:{vk(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case B.INITIAL:{wk(this,t);break}case B.BEFORE_HEAD:case B.IN_HEAD:case B.IN_HEAD_NO_SCRIPT:case B.AFTER_HEAD:{this._err(t,K.misplacedDoctype);break}case B.IN_TABLE_TEXT:{Ri(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,K.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?qR(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case B.INITIAL:{ki(this,t);break}case B.BEFORE_HTML:{_k(this,t);break}case B.BEFORE_HEAD:{Ck(this,t);break}case B.IN_HEAD:{lr(this,t);break}case B.IN_HEAD_NO_SCRIPT:{Rk(this,t);break}case B.AFTER_HEAD:{Ok(this,t);break}case B.IN_BODY:{wn(this,t);break}case B.IN_TABLE:{Ya(this,t);break}case B.IN_TABLE_TEXT:{Ri(this,t);break}case B.IN_CAPTION:{IR(this,t);break}case B.IN_COLUMN_GROUP:{bg(this,t);break}case B.IN_TABLE_BODY:{Xu(this,t);break}case B.IN_ROW:{Qu(this,t);break}case B.IN_CELL:{DR(this,t);break}case B.IN_SELECT:{ZT(this,t);break}case B.IN_SELECT_IN_TABLE:{LR(this,t);break}case B.IN_TEMPLATE:{MR(this,t);break}case B.AFTER_BODY:{BR(this,t);break}case B.IN_FRAMESET:{UR(this,t);break}case B.AFTER_FRAMESET:{$R(this,t);break}case B.AFTER_AFTER_BODY:{HR(this,t);break}case B.AFTER_AFTER_FRAMESET:{GR(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?YR(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case B.INITIAL:{ki(this,t);break}case B.BEFORE_HTML:{Nk(this,t);break}case B.BEFORE_HEAD:{Ik(this,t);break}case B.IN_HEAD:{kk(this,t);break}case B.IN_HEAD_NO_SCRIPT:{Dk(this,t);break}case B.AFTER_HEAD:{Lk(this,t);break}case B.IN_BODY:{Ku(this,t);break}case B.TEXT:{yR(this,t);break}case B.IN_TABLE:{ps(this,t);break}case B.IN_TABLE_TEXT:{Ri(this,t);break}case B.IN_CAPTION:{kR(this,t);break}case B.IN_COLUMN_GROUP:{RR(this,t);break}case B.IN_TABLE_BODY:{jc(this,t);break}case B.IN_ROW:{YT(this,t);break}case B.IN_CELL:{OR(this,t);break}case B.IN_SELECT:{KT(this,t);break}case B.IN_SELECT_IN_TABLE:{FR(this,t);break}case B.IN_TEMPLATE:{PR(this,t);break}case B.AFTER_BODY:{QT(this,t);break}case B.IN_FRAMESET:{jR(this,t);break}case B.AFTER_FRAMESET:{zR(this,t);break}case B.AFTER_AFTER_BODY:{ko(this,t);break}}}onEof(t){switch(this.insertionMode){case B.INITIAL:{ki(this,t);break}case B.BEFORE_HTML:{Yi(this,t);break}case B.BEFORE_HEAD:{Zi(this,t);break}case B.IN_HEAD:{Ki(this,t);break}case B.IN_HEAD_NO_SCRIPT:{Xi(this,t);break}case B.AFTER_HEAD:{Qi(this,t);break}case B.IN_BODY:case B.IN_TABLE:case B.IN_CAPTION:case B.IN_COLUMN_GROUP:case B.IN_TABLE_BODY:case B.IN_ROW:case B.IN_CELL:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:{GT(this,t);break}case B.TEXT:{xR(this,t);break}case B.IN_TABLE_TEXT:{Ri(this,t);break}case B.IN_TEMPLATE:{XT(this,t);break}case B.AFTER_BODY:case B.IN_FRAMESET:case B.AFTER_FRAMESET:case B.AFTER_AFTER_BODY:case B.AFTER_AFTER_FRAMESET:{gg(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===C.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case B.IN_HEAD:case B.IN_HEAD_NO_SCRIPT:case B.AFTER_HEAD:case B.TEXT:case B.IN_COLUMN_GROUP:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:case B.IN_FRAMESET:case B.AFTER_FRAMESET:{this._insertCharacters(t);break}case B.IN_BODY:case B.IN_CAPTION:case B.IN_CELL:case B.IN_TEMPLATE:case B.AFTER_BODY:case B.AFTER_AFTER_BODY:case B.AFTER_AFTER_FRAMESET:{UT(this,t);break}case B.IN_TABLE:case B.IN_TABLE_BODY:case B.IN_ROW:{Dl(this,t);break}case B.IN_TABLE_TEXT:{WT(this,t);break}}}}function bk(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):HT(e,t),n}function Ek(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const a=e.openElements.items[r];if(a===t.element)break;e._isSpecialElement(a,e.openElements.tagIDs[r])&&(n=a)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function yk(e,t,n){let r=t,a=e.openElements.getCommonAncestor(t);for(let i=0,s=a;s!==n;i++,s=a){a=e.openElements.getCommonAncestor(s);const o=e.activeFormattingElements.getElementEntry(s),u=o&&i>=hk;!o||u?(u&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(s)):(s=xk(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(s,r),r=s)}return r}function xk(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function Tk(e,t,n){const r=e.treeAdapter.getTagName(t),a=ci(r);if(e._isElementCausesFosterParenting(a))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);a===h.TEMPLATE&&i===ne.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Sk(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:a}=n,i=e.treeAdapter.createElement(a.tagName,r,a.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,a),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,a.tagID)}function hg(e,t){for(let n=0;n<mk;n++){const r=bk(e,t);if(!r)break;const a=Ek(e,r);if(!a)break;e.activeFormattingElements.bookmark=r;const i=yk(e,a,r.element),s=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(i),s&&Tk(e,s,i),Sk(e,a,r)}}function Uc(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Ak(e,t){e._appendCommentNode(t,e.openElements.items[0])}function vk(e,t){e._appendCommentNode(t,e.document)}function gg(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],a=e.treeAdapter.getNodeSourceCodeLocation(r);if(a&&!a.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],s=e.treeAdapter.getNodeSourceCodeLocation(i);s&&!s.endTag&&e._setEndLocation(i,t)}}}}function wk(e,t){e._setDocumentType(t);const n=t.forceQuirks?Xn.QUIRKS:tk(t);ek(t)||e._err(t,K.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=B.BEFORE_HTML}function ki(e,t){e._err(t,K.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Xn.QUIRKS),e.insertionMode=B.BEFORE_HTML,e._processToken(t)}function _k(e,t){t.tagID===h.HTML?(e._insertElement(t,ne.HTML),e.insertionMode=B.BEFORE_HEAD):Yi(e,t)}function Nk(e,t){const n=t.tagID;(n===h.HTML||n===h.HEAD||n===h.BODY||n===h.BR)&&Yi(e,t)}function Yi(e,t){e._insertFakeRootElement(),e.insertionMode=B.BEFORE_HEAD,e._processToken(t)}function Ck(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.HEAD:{e._insertElement(t,ne.HTML),e.headElement=e.openElements.current,e.insertionMode=B.IN_HEAD;break}default:Zi(e,t)}}function Ik(e,t){const n=t.tagID;n===h.HEAD||n===h.BODY||n===h.HTML||n===h.BR?Zi(e,t):e._err(t,K.endTagWithoutMatchingOpenElement)}function Zi(e,t){e._insertFakeElement(z.HEAD,h.HEAD),e.headElement=e.openElements.current,e.insertionMode=B.IN_HEAD,e._processToken(t)}function lr(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:{e._appendElement(t,ne.HTML),t.ackSelfClosing=!0;break}case h.TITLE:{e._switchToTextParsing(t,Gt.RCDATA);break}case h.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Gt.RAWTEXT):(e._insertElement(t,ne.HTML),e.insertionMode=B.IN_HEAD_NO_SCRIPT);break}case h.NOFRAMES:case h.STYLE:{e._switchToTextParsing(t,Gt.RAWTEXT);break}case h.SCRIPT:{e._switchToTextParsing(t,Gt.SCRIPT_DATA);break}case h.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=B.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(B.IN_TEMPLATE);break}case h.HEAD:{e._err(t,K.misplacedStartTagForHeadElement);break}default:Ki(e,t)}}function kk(e,t){switch(t.tagID){case h.HEAD:{e.openElements.pop(),e.insertionMode=B.AFTER_HEAD;break}case h.BODY:case h.BR:case h.HTML:{Ki(e,t);break}case h.TEMPLATE:{Ta(e,t);break}default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function Ta(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==h.TEMPLATE&&e._err(t,K.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(h.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,K.endTagWithoutMatchingOpenElement)}function Ki(e,t){e.openElements.pop(),e.insertionMode=B.AFTER_HEAD,e._processToken(t)}function Rk(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.BASEFONT:case h.BGSOUND:case h.HEAD:case h.LINK:case h.META:case h.NOFRAMES:case h.STYLE:{lr(e,t);break}case h.NOSCRIPT:{e._err(t,K.nestedNoscriptInHead);break}default:Xi(e,t)}}function Dk(e,t){switch(t.tagID){case h.NOSCRIPT:{e.openElements.pop(),e.insertionMode=B.IN_HEAD;break}case h.BR:{Xi(e,t);break}default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function Xi(e,t){const n=t.type===nt.EOF?K.openElementsLeftAfterEof:K.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=B.IN_HEAD,e._processToken(t)}function Ok(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.BODY:{e._insertElement(t,ne.HTML),e.framesetOk=!1,e.insertionMode=B.IN_BODY;break}case h.FRAMESET:{e._insertElement(t,ne.HTML),e.insertionMode=B.IN_FRAMESET;break}case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:case h.NOFRAMES:case h.SCRIPT:case h.STYLE:case h.TEMPLATE:case h.TITLE:{e._err(t,K.abandonedHeadElementChild),e.openElements.push(e.headElement,h.HEAD),lr(e,t),e.openElements.remove(e.headElement);break}case h.HEAD:{e._err(t,K.misplacedStartTagForHeadElement);break}default:Qi(e,t)}}function Lk(e,t){switch(t.tagID){case h.BODY:case h.HTML:case h.BR:{Qi(e,t);break}case h.TEMPLATE:{Ta(e,t);break}default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function Qi(e,t){e._insertFakeElement(z.BODY,h.BODY),e.insertionMode=B.IN_BODY,Zu(e,t)}function Zu(e,t){switch(t.type){case nt.CHARACTER:{jT(e,t);break}case nt.WHITESPACE_CHARACTER:{UT(e,t);break}case nt.COMMENT:{Uc(e,t);break}case nt.START_TAG:{wn(e,t);break}case nt.END_TAG:{Ku(e,t);break}case nt.EOF:{GT(e,t);break}}}function UT(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function jT(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Fk(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Mk(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function Pk(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ne.HTML),e.insertionMode=B.IN_FRAMESET)}function Bk(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ne.HTML)}function Uk(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Bc.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ne.HTML)}function jk(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ne.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function $k(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ne.HTML),n||(e.formElement=e.openElements.current))}function zk(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const a=e.openElements.tagIDs[r];if(n===h.LI&&a===h.LI||(n===h.DD||n===h.DT)&&(a===h.DD||a===h.DT)){e.openElements.generateImpliedEndTagsWithExclusion(a),e.openElements.popUntilTagNamePopped(a);break}if(a!==h.ADDRESS&&a!==h.DIV&&a!==h.P&&e._isSpecialElement(e.openElements.items[r],a))break}e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ne.HTML)}function Hk(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ne.HTML),e.tokenizer.state=Gt.PLAINTEXT}function Gk(e,t){e.openElements.hasInScope(h.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(h.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ne.HTML),e.framesetOk=!1}function Wk(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(z.A);n&&(hg(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ne.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Vk(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ne.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function qk(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(h.NOBR)&&(hg(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ne.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Yk(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ne.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Zk(e,t){e.treeAdapter.getDocumentMode(e.document)!==Xn.QUIRKS&&e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ne.HTML),e.framesetOk=!1,e.insertionMode=B.IN_TABLE}function $T(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ne.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function zT(e){const t=kT(e,sa.TYPE);return t!=null&&t.toLowerCase()===fk}function Kk(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ne.HTML),zT(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Xk(e,t){e._appendElement(t,ne.HTML),t.ackSelfClosing=!0}function Qk(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._appendElement(t,ne.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Jk(e,t){t.tagName=z.IMG,t.tagID=h.IMG,$T(e,t)}function eR(e,t){e._insertElement(t,ne.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Gt.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=B.TEXT}function tR(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Gt.RAWTEXT)}function nR(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Gt.RAWTEXT)}function LE(e,t){e._switchToTextParsing(t,Gt.RAWTEXT)}function rR(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ne.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===B.IN_TABLE||e.insertionMode===B.IN_CAPTION||e.insertionMode===B.IN_TABLE_BODY||e.insertionMode===B.IN_ROW||e.insertionMode===B.IN_CELL?B.IN_SELECT_IN_TABLE:B.IN_SELECT}function aR(e,t){e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ne.HTML)}function iR(e,t){e.openElements.hasInScope(h.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ne.HTML)}function sR(e,t){e.openElements.hasInScope(h.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(h.RTC),e._insertElement(t,ne.HTML)}function oR(e,t){e._reconstructActiveFormattingElements(),MT(t),mg(t),t.selfClosing?e._appendElement(t,ne.MATHML):e._insertElement(t,ne.MATHML),t.ackSelfClosing=!0}function uR(e,t){e._reconstructActiveFormattingElements(),PT(t),mg(t),t.selfClosing?e._appendElement(t,ne.SVG):e._insertElement(t,ne.SVG),t.ackSelfClosing=!0}function FE(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ne.HTML)}function wn(e,t){switch(t.tagID){case h.I:case h.S:case h.B:case h.U:case h.EM:case h.TT:case h.BIG:case h.CODE:case h.FONT:case h.SMALL:case h.STRIKE:case h.STRONG:{Vk(e,t);break}case h.A:{Wk(e,t);break}case h.H1:case h.H2:case h.H3:case h.H4:case h.H5:case h.H6:{Uk(e,t);break}case h.P:case h.DL:case h.OL:case h.UL:case h.DIV:case h.DIR:case h.NAV:case h.MAIN:case h.MENU:case h.ASIDE:case h.CENTER:case h.FIGURE:case h.FOOTER:case h.HEADER:case h.HGROUP:case h.DIALOG:case h.DETAILS:case h.ADDRESS:case h.ARTICLE:case h.SEARCH:case h.SECTION:case h.SUMMARY:case h.FIELDSET:case h.BLOCKQUOTE:case h.FIGCAPTION:{Bk(e,t);break}case h.LI:case h.DD:case h.DT:{zk(e,t);break}case h.BR:case h.IMG:case h.WBR:case h.AREA:case h.EMBED:case h.KEYGEN:{$T(e,t);break}case h.HR:{Qk(e,t);break}case h.RB:case h.RTC:{iR(e,t);break}case h.RT:case h.RP:{sR(e,t);break}case h.PRE:case h.LISTING:{jk(e,t);break}case h.XMP:{tR(e,t);break}case h.SVG:{uR(e,t);break}case h.HTML:{Fk(e,t);break}case h.BASE:case h.LINK:case h.META:case h.STYLE:case h.TITLE:case h.SCRIPT:case h.BGSOUND:case h.BASEFONT:case h.TEMPLATE:{lr(e,t);break}case h.BODY:{Mk(e,t);break}case h.FORM:{$k(e,t);break}case h.NOBR:{qk(e,t);break}case h.MATH:{oR(e,t);break}case h.TABLE:{Zk(e,t);break}case h.INPUT:{Kk(e,t);break}case h.PARAM:case h.TRACK:case h.SOURCE:{Xk(e,t);break}case h.IMAGE:{Jk(e,t);break}case h.BUTTON:{Gk(e,t);break}case h.APPLET:case h.OBJECT:case h.MARQUEE:{Yk(e,t);break}case h.IFRAME:{nR(e,t);break}case h.SELECT:{rR(e,t);break}case h.OPTION:case h.OPTGROUP:{aR(e,t);break}case h.NOEMBED:case h.NOFRAMES:{LE(e,t);break}case h.FRAMESET:{Pk(e,t);break}case h.TEXTAREA:{eR(e,t);break}case h.NOSCRIPT:{e.options.scriptingEnabled?LE(e,t):FE(e,t);break}case h.PLAINTEXT:{Hk(e,t);break}case h.COL:case h.TH:case h.TD:case h.TR:case h.HEAD:case h.FRAME:case h.TBODY:case h.TFOOT:case h.THEAD:case h.CAPTION:case h.COLGROUP:break;default:FE(e,t)}}function lR(e,t){if(e.openElements.hasInScope(h.BODY)&&(e.insertionMode=B.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function cR(e,t){e.openElements.hasInScope(h.BODY)&&(e.insertionMode=B.AFTER_BODY,QT(e,t))}function dR(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function pR(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(h.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(h.FORM):n&&e.openElements.remove(n))}function fR(e){e.openElements.hasInButtonScope(h.P)||e._insertFakeElement(z.P,h.P),e._closePElement()}function mR(e){e.openElements.hasInListItemScope(h.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(h.LI),e.openElements.popUntilTagNamePopped(h.LI))}function hR(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function gR(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function bR(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function ER(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(z.BR,h.BR),e.openElements.pop(),e.framesetOk=!1}function HT(e,t){const n=t.tagName,r=t.tagID;for(let a=e.openElements.stackTop;a>0;a--){const i=e.openElements.items[a],s=e.openElements.tagIDs[a];if(r===s&&(r!==h.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=a&&e.openElements.shortenToLength(a);break}if(e._isSpecialElement(i,s))break}}function Ku(e,t){switch(t.tagID){case h.A:case h.B:case h.I:case h.S:case h.U:case h.EM:case h.TT:case h.BIG:case h.CODE:case h.FONT:case h.NOBR:case h.SMALL:case h.STRIKE:case h.STRONG:{hg(e,t);break}case h.P:{fR(e);break}case h.DL:case h.UL:case h.OL:case h.DIR:case h.DIV:case h.NAV:case h.PRE:case h.MAIN:case h.MENU:case h.ASIDE:case h.BUTTON:case h.CENTER:case h.FIGURE:case h.FOOTER:case h.HEADER:case h.HGROUP:case h.DIALOG:case h.ADDRESS:case h.ARTICLE:case h.DETAILS:case h.SEARCH:case h.SECTION:case h.SUMMARY:case h.LISTING:case h.FIELDSET:case h.BLOCKQUOTE:case h.FIGCAPTION:{dR(e,t);break}case h.LI:{mR(e);break}case h.DD:case h.DT:{hR(e,t);break}case h.H1:case h.H2:case h.H3:case h.H4:case h.H5:case h.H6:{gR(e);break}case h.BR:{ER(e);break}case h.BODY:{lR(e,t);break}case h.HTML:{cR(e,t);break}case h.FORM:{pR(e);break}case h.APPLET:case h.OBJECT:case h.MARQUEE:{bR(e,t);break}case h.TEMPLATE:{Ta(e,t);break}default:HT(e,t)}}function GT(e,t){e.tmplInsertionModeStack.length>0?XT(e,t):gg(e,t)}function yR(e,t){var n;t.tagID===h.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function xR(e,t){e._err(t,K.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Dl(e,t){if(e.openElements.currentTagId!==void 0&&BT.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=B.IN_TABLE_TEXT,t.type){case nt.CHARACTER:{VT(e,t);break}case nt.WHITESPACE_CHARACTER:{WT(e,t);break}}else js(e,t)}function TR(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ne.HTML),e.insertionMode=B.IN_CAPTION}function SR(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ne.HTML),e.insertionMode=B.IN_COLUMN_GROUP}function AR(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(z.COLGROUP,h.COLGROUP),e.insertionMode=B.IN_COLUMN_GROUP,bg(e,t)}function vR(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ne.HTML),e.insertionMode=B.IN_TABLE_BODY}function wR(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(z.TBODY,h.TBODY),e.insertionMode=B.IN_TABLE_BODY,Xu(e,t)}function _R(e,t){e.openElements.hasInTableScope(h.TABLE)&&(e.openElements.popUntilTagNamePopped(h.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function NR(e,t){zT(t)?e._appendElement(t,ne.HTML):js(e,t),t.ackSelfClosing=!0}function CR(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ne.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Ya(e,t){switch(t.tagID){case h.TD:case h.TH:case h.TR:{wR(e,t);break}case h.STYLE:case h.SCRIPT:case h.TEMPLATE:{lr(e,t);break}case h.COL:{AR(e,t);break}case h.FORM:{CR(e,t);break}case h.TABLE:{_R(e,t);break}case h.TBODY:case h.TFOOT:case h.THEAD:{vR(e,t);break}case h.INPUT:{NR(e,t);break}case h.CAPTION:{TR(e,t);break}case h.COLGROUP:{SR(e,t);break}default:js(e,t)}}function ps(e,t){switch(t.tagID){case h.TABLE:{e.openElements.hasInTableScope(h.TABLE)&&(e.openElements.popUntilTagNamePopped(h.TABLE),e._resetInsertionMode());break}case h.TEMPLATE:{Ta(e,t);break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TBODY:case h.TD:case h.TFOOT:case h.TH:case h.THEAD:case h.TR:break;default:js(e,t)}}function js(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Zu(e,t),e.fosterParentingEnabled=n}function WT(e,t){e.pendingCharacterTokens.push(t)}function VT(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Ri(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)js(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const qT=new Set([h.CAPTION,h.COL,h.COLGROUP,h.TBODY,h.TD,h.TFOOT,h.TH,h.THEAD,h.TR]);function IR(e,t){const n=t.tagID;qT.has(n)?e.openElements.hasInTableScope(h.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(h.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=B.IN_TABLE,Ya(e,t)):wn(e,t)}function kR(e,t){const n=t.tagID;switch(n){case h.CAPTION:case h.TABLE:{e.openElements.hasInTableScope(h.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(h.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=B.IN_TABLE,n===h.TABLE&&ps(e,t));break}case h.BODY:case h.COL:case h.COLGROUP:case h.HTML:case h.TBODY:case h.TD:case h.TFOOT:case h.TH:case h.THEAD:case h.TR:break;default:Ku(e,t)}}function bg(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.COL:{e._appendElement(t,ne.HTML),t.ackSelfClosing=!0;break}case h.TEMPLATE:{lr(e,t);break}default:Ho(e,t)}}function RR(e,t){switch(t.tagID){case h.COLGROUP:{e.openElements.currentTagId===h.COLGROUP&&(e.openElements.pop(),e.insertionMode=B.IN_TABLE);break}case h.TEMPLATE:{Ta(e,t);break}case h.COL:break;default:Ho(e,t)}}function Ho(e,t){e.openElements.currentTagId===h.COLGROUP&&(e.openElements.pop(),e.insertionMode=B.IN_TABLE,e._processToken(t))}function Xu(e,t){switch(t.tagID){case h.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,ne.HTML),e.insertionMode=B.IN_ROW;break}case h.TH:case h.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(z.TR,h.TR),e.insertionMode=B.IN_ROW,Qu(e,t);break}case h.CAPTION:case h.COL:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE,Ya(e,t));break}default:Ya(e,t)}}function jc(e,t){const n=t.tagID;switch(t.tagID){case h.TBODY:case h.TFOOT:case h.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE);break}case h.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE,ps(e,t));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TD:case h.TH:case h.TR:break;default:ps(e,t)}}function Qu(e,t){switch(t.tagID){case h.TH:case h.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,ne.HTML),e.insertionMode=B.IN_CELL,e.activeFormattingElements.insertMarker();break}case h.CAPTION:case h.COL:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:case h.TR:{e.openElements.hasInTableScope(h.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY,Xu(e,t));break}default:Ya(e,t)}}function YT(e,t){switch(t.tagID){case h.TR:{e.openElements.hasInTableScope(h.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY);break}case h.TABLE:{e.openElements.hasInTableScope(h.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY,jc(e,t));break}case h.TBODY:case h.TFOOT:case h.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(h.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY,jc(e,t));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TD:case h.TH:break;default:ps(e,t)}}function DR(e,t){const n=t.tagID;qT.has(n)?(e.openElements.hasInTableScope(h.TD)||e.openElements.hasInTableScope(h.TH))&&(e._closeTableCell(),Qu(e,t)):wn(e,t)}function OR(e,t){const n=t.tagID;switch(n){case h.TD:case h.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=B.IN_ROW);break}case h.TABLE:case h.TBODY:case h.TFOOT:case h.THEAD:case h.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),YT(e,t));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:break;default:Ku(e,t)}}function ZT(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.OPTION:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e._insertElement(t,ne.HTML);break}case h.OPTGROUP:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e.openElements.currentTagId===h.OPTGROUP&&e.openElements.pop(),e._insertElement(t,ne.HTML);break}case h.HR:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e.openElements.currentTagId===h.OPTGROUP&&e.openElements.pop(),e._appendElement(t,ne.HTML),t.ackSelfClosing=!0;break}case h.INPUT:case h.KEYGEN:case h.TEXTAREA:case h.SELECT:{e.openElements.hasInSelectScope(h.SELECT)&&(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode(),t.tagID!==h.SELECT&&e._processStartTag(t));break}case h.SCRIPT:case h.TEMPLATE:{lr(e,t);break}}}function KT(e,t){switch(t.tagID){case h.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===h.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===h.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===h.OPTGROUP&&e.openElements.pop();break}case h.OPTION:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop();break}case h.SELECT:{e.openElements.hasInSelectScope(h.SELECT)&&(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode());break}case h.TEMPLATE:{Ta(e,t);break}}}function LR(e,t){const n=t.tagID;n===h.CAPTION||n===h.TABLE||n===h.TBODY||n===h.TFOOT||n===h.THEAD||n===h.TR||n===h.TD||n===h.TH?(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode(),e._processStartTag(t)):ZT(e,t)}function FR(e,t){const n=t.tagID;n===h.CAPTION||n===h.TABLE||n===h.TBODY||n===h.TFOOT||n===h.THEAD||n===h.TR||n===h.TD||n===h.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode(),e.onEndTag(t)):KT(e,t)}function MR(e,t){switch(t.tagID){case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:case h.NOFRAMES:case h.SCRIPT:case h.STYLE:case h.TEMPLATE:case h.TITLE:{lr(e,t);break}case h.CAPTION:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:{e.tmplInsertionModeStack[0]=B.IN_TABLE,e.insertionMode=B.IN_TABLE,Ya(e,t);break}case h.COL:{e.tmplInsertionModeStack[0]=B.IN_COLUMN_GROUP,e.insertionMode=B.IN_COLUMN_GROUP,bg(e,t);break}case h.TR:{e.tmplInsertionModeStack[0]=B.IN_TABLE_BODY,e.insertionMode=B.IN_TABLE_BODY,Xu(e,t);break}case h.TD:case h.TH:{e.tmplInsertionModeStack[0]=B.IN_ROW,e.insertionMode=B.IN_ROW,Qu(e,t);break}default:e.tmplInsertionModeStack[0]=B.IN_BODY,e.insertionMode=B.IN_BODY,wn(e,t)}}function PR(e,t){t.tagID===h.TEMPLATE&&Ta(e,t)}function XT(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(h.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):gg(e,t)}function BR(e,t){t.tagID===h.HTML?wn(e,t):Go(e,t)}function QT(e,t){var n;if(t.tagID===h.HTML){if(e.fragmentContext||(e.insertionMode=B.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===h.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Go(e,t)}function Go(e,t){e.insertionMode=B.IN_BODY,Zu(e,t)}function UR(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.FRAMESET:{e._insertElement(t,ne.HTML);break}case h.FRAME:{e._appendElement(t,ne.HTML),t.ackSelfClosing=!0;break}case h.NOFRAMES:{lr(e,t);break}}}function jR(e,t){t.tagID===h.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==h.FRAMESET&&(e.insertionMode=B.AFTER_FRAMESET))}function $R(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.NOFRAMES:{lr(e,t);break}}}function zR(e,t){t.tagID===h.HTML&&(e.insertionMode=B.AFTER_AFTER_FRAMESET)}function HR(e,t){t.tagID===h.HTML?wn(e,t):ko(e,t)}function ko(e,t){e.insertionMode=B.IN_BODY,Zu(e,t)}function GR(e,t){switch(t.tagID){case h.HTML:{wn(e,t);break}case h.NOFRAMES:{lr(e,t);break}}}function WR(e,t){t.chars=Ft,e._insertCharacters(t)}function VR(e,t){e._insertCharacters(t),e.framesetOk=!1}function JT(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ne.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function qR(e,t){if(uk(t))JT(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ne.MATHML?MT(t):r===ne.SVG&&(lk(t),PT(t)),mg(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function YR(e,t){if(t.tagID===h.P||t.tagID===h.BR){JT(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===ne.HTML){e._endTagOutsideForeignContent(t);break}const a=e.treeAdapter.getTagName(r);if(a.toLowerCase()===t.tagName){t.tagName=a,e.openElements.shortenToLength(n);break}}}z.AREA,z.BASE,z.BASEFONT,z.BGSOUND,z.BR,z.COL,z.EMBED,z.FRAME,z.HR,z.IMG,z.INPUT,z.KEYGEN,z.LINK,z.META,z.PARAM,z.SOURCE,z.TRACK,z.WBR;function ZR(e,t){return zo.parse(e,t)}function KR(e,t,n){typeof e=="string"&&(n=t,t=e,e=null);const r=zo.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}const Ju=eS("end"),yr=eS("start");function eS(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function XR(e){const t=yr(e),n=Ju(e);if(t&&n)return{start:t,end:n}}const QR=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,JR=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),ME={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function tS(e,t){const n=l2(e),r=Vu("type",{handlers:{root:e2,element:t2,text:n2,comment:rS,doctype:r2,raw:i2},unknown:s2}),a={parser:n?new zo(ME):zo.getFragmentParser(void 0,ME),handle(o){r(o,a)},stitches:!1,options:t||{}};r(e,a),di(a,yr());const i=n?a.parser.document:a.parser.getFragment(),s=AT(i,{file:a.options.file});return a.stitches&&Pn(s,"comment",function(o,u,l){const p=o;if(p.value.stitch&&l&&u!==void 0){const d=l.children;return d[u]=p.value.stitch,u}}),s.type==="root"&&s.children.length===1&&s.children[0].type===e.type?s.children[0]:s}function nS(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function e2(e,t){nS(e.children,t)}function t2(e,t){o2(e,t),nS(e.children,t),u2(e,t)}function n2(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:nt.CHARACTER,chars:e.value,location:$s(e)};di(t,yr(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function r2(e,t){const n={type:nt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:$s(e)};di(t,yr(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function a2(e,t){t.stitches=!0;const n=c2(e);if("children"in e&&"children"in n){const r=tS({type:"root",children:e.children},t.options);n.children=r.children}rS({type:"comment",value:{stitch:n}},t)}function rS(e,t){const n=e.value,r={type:nt.COMMENT,data:n,location:$s(e)};di(t,yr(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function i2(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,aS(t,yr(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(QR,"&lt;$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function s2(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))a2(n,t);else{let r="";throw JR.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function di(e,t){aS(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=Gt.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function aS(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function o2(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Gt.PLAINTEXT)return;di(t,yr(e));const r=t.parser.openElements.current;let a="namespaceURI"in r?r.namespaceURI:aa.html;a===aa.html&&n==="svg"&&(a=aa.svg);const i=fI({...e,children:[]},{space:a===aa.svg?"svg":"html"}),s={type:nt.START_TAG,tagName:n,tagID:ci(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:$s(e)};t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function u2(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&_T.includes(n)||t.parser.tokenizer.state===Gt.PLAINTEXT)return;di(t,Ju(e));const r={type:nt.END_TAG,tagName:n,tagID:ci(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:$s(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Gt.RCDATA||t.parser.tokenizer.state===Gt.RAWTEXT||t.parser.tokenizer.state===Gt.SCRIPT_DATA)&&(t.parser.tokenizer.state=Gt.DATA)}function l2(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function $s(e){const t=yr(e)||{line:void 0,column:void 0,offset:void 0},n=Ju(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function c2(e){return"children"in e?ua({...e,children:[]}):ua(e)}function iS(e){return function(t,n){return tS(t,{...e,file:n})}}function fs(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}const d2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,f2={};function PE(e,t){return(f2.jsx?p2:d2).test(e)}var Ca={},Ol,BE;function m2(){if(BE)return Ol;BE=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,o=/^\s+|\s+$/g,u=`
17
17
  `,l="/",p="*",d="",f="comment",m="declaration";function b(y,x){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];x=x||{};var w=1,T=1;function I(Z){var V=Z.match(t);V&&(w+=V.length);var ie=Z.lastIndexOf(u);T=~ie?Z.length-ie:T+Z.length}function R(){var Z={line:w,column:T};return function(V){return V.position=new v(Z),F(),V}}function v(Z){this.start=Z,this.end={line:w,column:T},this.source=x.source}v.prototype.content=y;function A(Z){var V=new Error(x.source+":"+w+":"+T+": "+Z);if(V.reason=Z,V.filename=x.source,V.line=w,V.column=T,V.source=y,!x.silent)throw V}function N(Z){var V=Z.exec(y);if(V){var ie=V[0];return I(ie),y=y.slice(ie.length),V}}function F(){N(n)}function _(Z){var V;for(Z=Z||[];V=M();)V!==!1&&Z.push(V);return Z}function M(){var Z=R();if(!(l!=y.charAt(0)||p!=y.charAt(1))){for(var V=2;d!=y.charAt(V)&&(p!=y.charAt(V)||l!=y.charAt(V+1));)++V;if(V+=2,d===y.charAt(V-1))return A("End of comment missing");var ie=y.slice(2,V-2);return T+=2,I(ie),y=y.slice(V),T+=2,Z({type:f,comment:ie})}}function j(){var Z=R(),V=N(r);if(V){if(M(),!N(a))return A("property missing ':'");var ie=N(i),X=Z({type:m,property:E(V[0].replace(e,d)),value:ie?E(ie[0].replace(e,d)):d});return N(s),X}}function H(){var Z=[];_(Z);for(var V;V=j();)V!==!1&&(Z.push(V),_(Z));return Z}return F(),H()}function E(y){return y?y.replace(o,d):d}return Ol=b,Ol}var UE;function h2(){if(UE)return Ca;UE=1;var e=Ca&&Ca.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.default=n;const t=e(m2());function n(r,a){let i=null;if(!r||typeof r!="string")return i;const s=(0,t.default)(r),o=typeof a=="function";return s.forEach(u=>{if(u.type!=="declaration")return;const{property:l,value:p}=u;o?a(l,p,u):p&&(i=i||{},i[l]=p)}),i}return Ca}var Di={},jE;function g2(){if(jE)return Di;jE=1,Object.defineProperty(Di,"__esModule",{value:!0}),Di.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(l){return!l||n.test(l)||e.test(l)},s=function(l,p){return p.toUpperCase()},o=function(l,p){return"".concat(p,"-")},u=function(l,p){return p===void 0&&(p={}),i(l)?l:(l=l.toLowerCase(),p.reactCompat?l=l.replace(a,o):l=l.replace(r,o),l.replace(t,s))};return Di.camelCase=u,Di}var Oi,$E;function b2(){if($E)return Oi;$E=1;var e=Oi&&Oi.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(h2()),n=g2();function r(a,i){var s={};return!a||typeof a!="string"||(0,t.default)(a,function(o,u){o&&u&&(s[(0,n.camelCase)(o,i)]=u)}),s}return r.default=r,Oi=r,Oi}var E2=b2();const y2=bu(E2);function Ji(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?zE(e.position):"start"in e||"end"in e?zE(e):"line"in e||"column"in e?$c(e):""}function $c(e){return HE(e&&e.line)+":"+HE(e&&e.column)}function zE(e){return $c(e&&e.start)+"-"+$c(e&&e.end)}function HE(e){return e&&typeof e=="number"?e:1}class xn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){const u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Ji(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}xn.prototype.file="";xn.prototype.name="";xn.prototype.reason="";xn.prototype.message="";xn.prototype.stack="";xn.prototype.column=void 0;xn.prototype.line=void 0;xn.prototype.ancestors=void 0;xn.prototype.cause=void 0;xn.prototype.fatal=void 0;xn.prototype.place=void 0;xn.prototype.ruleId=void 0;xn.prototype.source=void 0;const Eg={}.hasOwnProperty,x2=new Map,T2=/[A-Z]/g,S2=new Set(["table","tbody","thead","tfoot","tr"]),A2=new Set(["td","th"]),sS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function v2(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=D2(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");r=R2(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,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"?ur:xa,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=oS(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function oS(e,t,n){if(t.type==="element")return w2(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return _2(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return C2(e,t,n);if(t.type==="mdxjsEsm")return N2(e,t);if(t.type==="root")return I2(e,t,n);if(t.type==="text")return k2(e,t)}function w2(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=ur,e.schema=a),e.ancestors.push(t);const i=lS(e,t.tagName,!1),s=O2(e,t);let o=xg(e,t);return S2.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!Us(u):!0})),uS(e,s,i,t),yg(s,o),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function _2(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ms(e,t.position)}function N2(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ms(e,t.position)}function C2(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=ur,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:lS(e,t.name,!0),s=L2(e,t),o=xg(e,t);return uS(e,s,i,t),yg(s,o),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function I2(e,t,n){const r={};return yg(r,xg(e,t)),e.create(t,e.Fragment,r,n)}function k2(e,t){return t.value}function uS(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function yg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function R2(e,t,n){return r;function r(a,i,s,o){const l=Array.isArray(s.children)?n:t;return o?l(i,s,o):l(i,s)}}function D2(e,t){return n;function n(r,a,i,s){const o=Array.isArray(i.children),u=yr(r);return t(a,i,s,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function O2(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Eg.call(t.properties,a)){const i=F2(e,a,t.properties[a]);if(i){const[s,o]=i;e.tableCellAlignToStyle&&s==="align"&&typeof o=="string"&&A2.has(t.tagName)?r=o:n[s]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function L2(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const o=s.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else ms(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else ms(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function xg(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:x2;for(;++r<t.children.length;){const i=t.children[r];let s;if(e.passKeys){const u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){const l=a.get(u)||0;s=u+"-"+l,a.set(u,l+1)}}const o=oS(e,i,s);o!==void 0&&n.push(o)}return n}function F2(e,t,n){const r=oi(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?$u(n):zu(n)),r.property==="style"){let a=typeof n=="object"?n:M2(e,String(n));return e.stylePropertyNameCase==="css"&&(a=P2(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?sN[r.property]||r.property:r.attribute,n]}}function M2(e,t){try{return y2(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new xn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=sS+"#cannot-parse-style-attribute",a}}function lS(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,s;for(;++i<a.length;){const o=PE(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};s=s?{type:"MemberExpression",object:s,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}r=s}else r=PE(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Eg.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);ms(e)}function ms(e,t){const n=new xn("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=sS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function P2(e){const t={};let n;for(n in e)Eg.call(e,n)&&(t[B2(n)]=e[n]);return t}function B2(e){let t=e.replace(T2,U2);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function U2(e){return"-"+e.toLowerCase()}const Ll={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"]},j2={};function Tg(e,t){const n=j2,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return cS(e,r,a)}function cS(e,t,n){if($2(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 GE(e.children,t,n)}return Array.isArray(e)?GE(e,t,n):""}function GE(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=cS(e[a],t,n);return r.join("")}function $2(e){return!!(e&&typeof e=="object")}function zn(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Qn(e,t){return e.length>0?(zn(e,e.length,0,t),e):t}const WE={}.hasOwnProperty;function dS(e){const t={};let n=-1;for(;++n<e.length;)z2(t,e[n]);return t}function z2(e,t){let n;for(n in t){const a=(WE.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){WE.call(a,s)||(a[s]=[]);const o=i[s];H2(a[s],Array.isArray(o)?o:o?[o]:[])}}}function H2(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);zn(e,0,0,r)}function pS(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 ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kn=Qr(/[A-Za-z]/),vn=Qr(/[\dA-Za-z]/),G2=Qr(/[#-'*+\--9=?A-Z^-~]/);function Wo(e){return e!==null&&(e<32||e===127)}const zc=Qr(/\d/),W2=Qr(/[\dA-Fa-f]/),V2=Qr(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function It(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const el=Qr(/\p{P}|\p{S}/u),la=Qr(/\s/);function Qr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pi(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&vn(e.charCodeAt(n+1))&&vn(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(s=String.fromCharCode(i,o),a=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+a+1,s=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function ht(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(u){return it(u)?(e.enter(n),o(u)):t(u)}function o(u){return it(u)&&i++<a?(e.consume(u),o):(e.exit(n),t(u))}}const q2={tokenize:Y2};function Y2(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ht(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return Me(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const Z2={tokenize:K2},VE={tokenize:X2};function K2(e){const t=this,n=[];let r=0,a,i,s;return o;function o(T){if(r<n.length){const I=n[r];return t.containerState=I[1],e.attempt(I[0].continuation,u,l)(T)}return l(T)}function u(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const I=t.events.length;let R=I,v;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){v=t.events[R][1].end;break}x(r);let A=I;for(;A<t.events.length;)t.events[A][1].end={...v},A++;return zn(t.events,R+1,0,t.events.slice(I)),t.events.length=A,l(T)}return o(T)}function l(T){if(r===n.length){if(!a)return f(T);if(a.currentConstruct&&a.currentConstruct.concrete)return b(T);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(VE,p,d)(T)}function p(T){return a&&w(),x(r),f(T)}function d(T){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,b(T)}function f(T){return t.containerState={},e.attempt(VE,m,b)(T)}function m(T){return r++,n.push([t.currentConstruct,t.containerState]),f(T)}function b(T){if(T===null){a&&w(),x(0),e.consume(T);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),E(T)}function E(T){if(T===null){y(e.exit("chunkFlow"),!0),x(0),e.consume(T);return}return Me(T)?(e.consume(T),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(T),E)}function y(T,I){const R=t.sliceStream(T);if(I&&R.push(null),T.previous=i,i&&(i.next=T),i=T,a.defineSkip(T.start),a.write(R),t.parser.lazy[T.start.line]){let v=a.events.length;for(;v--;)if(a.events[v][1].start.offset<s&&(!a.events[v][1].end||a.events[v][1].end.offset>s))return;const A=t.events.length;let N=A,F,_;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(F){_=t.events[N][1].end;break}F=!0}for(x(r),v=A;v<t.events.length;)t.events[v][1].end={..._},v++;zn(t.events,N+1,0,t.events.slice(A)),t.events.length=v}}function x(T){let I=n.length;for(;I-- >T;){const R=n[I];t.containerState=R[1],R[0].exit.call(t,e)}n.length=T}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function X2(e,t,n){return ht(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Za(e){if(e===null||It(e)||la(e))return 1;if(el(e))return 2}function tl(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Hc={name:"attention",resolveAll:Q2,tokenize:J2};function Q2(e,t){let n=-1,r,a,i,s,o,u,l,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};qE(d,-u),qE(f,u),s={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:u>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[r][1].end={...s.start},e[n][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Qn(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=Qn(l,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),l=Qn(l,tl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Qn(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,l=Qn(l,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,zn(e,r-1,n-r+3,l),n=r+l.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function J2(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Za(r);let i;return s;function s(u){return i=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===i)return e.consume(u),o;const l=e.exit("attentionSequence"),p=Za(u),d=!p||p===2&&a||n.includes(u),f=!a||a===2&&p||n.includes(r);return l._open=!!(i===42?d:d&&(a||!f)),l._close=!!(i===42?f:f&&(p||!d)),t(u)}}function qE(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const eD={name:"autolink",tokenize:tD};function tD(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return kn(m)?(e.consume(m),s):m===64?n(m):l(m)}function s(m){return m===43||m===45||m===46||vn(m)?(r=1,o(m)):l(m)}function o(m){return m===58?(e.consume(m),r=0,u):(m===43||m===45||m===46||vn(m))&&r++<32?(e.consume(m),o):(r=0,l(m))}function u(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Wo(m)?n(m):(e.consume(m),u)}function l(m){return m===64?(e.consume(m),p):G2(m)?(e.consume(m),l):n(m)}function p(m){return vn(m)?d(m):n(m)}function d(m){return m===46?(e.consume(m),r=0,p):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||vn(m))&&r++<63){const b=m===45?f:d;return e.consume(m),b}return n(m)}}const zs={partial:!0,tokenize:nD};function nD(e,t,n){return r;function r(i){return it(i)?ht(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Me(i)?t(i):n(i)}}const fS={continuation:{tokenize:aD},exit:iD,name:"blockQuote",tokenize:rD};function rD(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return it(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function aD(e,t,n){const r=this;return a;function a(s){return it(s)?ht(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(fS,t,n)(s)}}function iD(e){e.exit("blockQuote")}const mS={name:"characterEscape",tokenize:sD};function sD(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return V2(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const hS={name:"characterReference",tokenize:oD};function oD(e,t,n){const r=this;let a=0,i,s;return o;function o(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),i=31,s=vn,p(d))}function l(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=W2,p):(e.enter("characterReferenceValue"),i=7,s=zc,p(d))}function p(d){if(d===59&&a){const f=e.exit("characterReferenceValue");return s===vn&&!ds(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(d)&&a++<i?(e.consume(d),p):n(d)}}const YE={partial:!0,tokenize:lD},ZE={concrete:!0,name:"codeFenced",tokenize:uD};function uD(e,t,n){const r=this,a={partial:!0,tokenize:R};let i=0,s=0,o;return u;function u(v){return l(v)}function l(v){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,o=v,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(v)}function p(v){return v===o?(s++,e.consume(v),p):s<3?n(v):(e.exit("codeFencedFenceSequence"),it(v)?ht(e,d,"whitespace")(v):d(v))}function d(v){return v===null||Me(v)?(e.exit("codeFencedFence"),r.interrupt?t(v):e.check(YE,E,I)(v)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===null||Me(v)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(v)):it(v)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ht(e,m,"whitespace")(v)):v===96&&v===o?n(v):(e.consume(v),f)}function m(v){return v===null||Me(v)?d(v):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===null||Me(v)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(v)):v===96&&v===o?n(v):(e.consume(v),b)}function E(v){return e.attempt(a,I,y)(v)}function y(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),x}function x(v){return i>0&&it(v)?ht(e,w,"linePrefix",i+1)(v):w(v)}function w(v){return v===null||Me(v)?e.check(YE,E,I)(v):(e.enter("codeFlowValue"),T(v))}function T(v){return v===null||Me(v)?(e.exit("codeFlowValue"),w(v)):(e.consume(v),T)}function I(v){return e.exit("codeFenced"),t(v)}function R(v,A,N){let F=0;return _;function _(V){return v.enter("lineEnding"),v.consume(V),v.exit("lineEnding"),M}function M(V){return v.enter("codeFencedFence"),it(V)?ht(v,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):j(V)}function j(V){return V===o?(v.enter("codeFencedFenceSequence"),H(V)):N(V)}function H(V){return V===o?(F++,v.consume(V),H):F>=s?(v.exit("codeFencedFenceSequence"),it(V)?ht(v,Z,"whitespace")(V):Z(V)):N(V)}function Z(V){return V===null||Me(V)?(v.exit("codeFencedFence"),A(V)):N(V)}}}function lD(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Fl={name:"codeIndented",tokenize:dD},cD={partial:!0,tokenize:pD};function dD(e,t,n){const r=this;return a;function a(l){return e.enter("codeIndented"),ht(e,i,"linePrefix",5)(l)}function i(l){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?u(l):Me(l)?e.attempt(cD,s,u)(l):(e.enter("codeFlowValue"),o(l))}function o(l){return l===null||Me(l)?(e.exit("codeFlowValue"),s(l)):(e.consume(l),o)}function u(l){return e.exit("codeIndented"),t(l)}}function pD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):Me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):ht(e,i,"linePrefix",5)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):Me(s)?a(s):n(s)}}const fD={name:"codeText",previous:hD,resolve:mD,tokenize:gD};function mD(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function hD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gD(e,t,n){let r=0,a,i;return s;function s(d){return e.enter("codeText"),e.enter("codeTextSequence"),o(d)}function o(d){return d===96?(e.consume(d),r++,o):(e.exit("codeTextSequence"),u(d))}function u(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),u):d===96?(i=e.enter("codeTextSequence"),a=0,p(d)):Me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||Me(d)?(e.exit("codeTextData"),u(d)):(e.consume(d),l)}function p(d){return d===96?(e.consume(d),a++,p):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",l(d))}}class bD{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 r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Li(this.left,r),i.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),Li(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Li(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);Li(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Li(this.left,n.reverse())}}}function Li(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 gS(e){const t={};let n=-1,r,a,i,s,o,u,l;const p=new bD(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,ED(p,n)),n=t[n],l=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(s=p.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(a&&(p.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;a&&(r[1].end={...p.get(a)[1].start},o=p.slice(a,n),o.unshift(r),p.splice(a,n-a+1,o))}}return zn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!l}function ED(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const o=s.events,u=[],l={};let p,d,f=-1,m=n,b=0,E=0;const y=[E];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(p=r.sliceStream(m),m.next||p.push(null),d&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(p),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(E=f+1,y.push(E),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):y.pop(),f=y.length;f--;){const x=o.slice(y[f],y[f+1]),w=i.pop();u.push([w,w+x.length-1]),e.splice(w,2,x)}for(u.reverse(),f=-1;++f<u.length;)l[b+u[f][0]]=b+u[f][1],b+=u[f][1]-u[f][0]-1;return l}const yD={resolve:TD,tokenize:SD},xD={partial:!0,tokenize:AD};function TD(e){return gS(e),e}function SD(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):Me(o)?e.check(xD,s,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function AD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ht(e,i,"linePrefix")}function i(s){if(s===null||Me(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function bS(e,t,n,r,a,i,s,o,u){const l=u||Number.POSITIVE_INFINITY;let p=0;return d;function d(x){return x===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(x),e.exit(i),f):x===null||x===32||x===41||Wo(x)?n(x):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),E(x))}function f(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===62?(e.exit("chunkString"),e.exit(o),f(x)):x===null||x===60||Me(x)?n(x):(e.consume(x),x===92?b:m)}function b(x){return x===60||x===62||x===92?(e.consume(x),m):m(x)}function E(x){return!p&&(x===null||x===41||It(x))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(x)):p<l&&x===40?(e.consume(x),p++,E):x===41?(e.consume(x),p--,E):x===null||x===32||x===40||Wo(x)?n(x):(e.consume(x),x===92?y:E)}function y(x){return x===40||x===41||x===92?(e.consume(x),E):E(x)}}function ES(e,t,n,r,a,i){const s=this;let o=0,u;return l;function l(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),p}function p(m){return o>999||m===null||m===91||m===93&&!u||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):Me(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||Me(m)||o++>999?(e.exit("chunkString"),p(m)):(e.consume(m),u||(u=!it(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function yS(e,t,n,r,a,i){let s;return o;function o(f){return f===34||f===39||f===40?(e.enter(r),e.enter(a),e.consume(f),e.exit(a),s=f===40?41:f,u):n(f)}function u(f){return f===s?(e.enter(a),e.consume(f),e.exit(a),e.exit(r),t):(e.enter(i),l(f))}function l(f){return f===s?(e.exit(i),u(s)):f===null?n(f):Me(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ht(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===s||f===null||Me(f)?(e.exit("chunkString"),l(f)):(e.consume(f),f===92?d:p)}function d(f){return f===s||f===92?(e.consume(f),p):p(f)}}function es(e,t){let n;return r;function r(a){return Me(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):it(a)?ht(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const vD={name:"definition",tokenize:_D},wD={partial:!0,tokenize:ND};function _D(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return ES.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),u):n(m)}function u(m){return It(m)?es(e,l)(m):l(m)}function l(m){return bS(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function p(m){return e.attempt(wD,d,d)(m)}function d(m){return it(m)?ht(e,f,"whitespace")(m):f(m)}function f(m){return m===null||Me(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function ND(e,t,n){return r;function r(o){return It(o)?es(e,a)(o):n(o)}function a(o){return yS(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return it(o)?ht(e,s,"whitespace")(o):s(o)}function s(o){return o===null||Me(o)?t(o):n(o)}}const CD={name:"hardBreakEscape",tokenize:ID};function ID(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return Me(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const kD={name:"headingAtx",resolve:RD,tokenize:DD};function RD(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},zn(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function DD(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),s(p)}function s(p){return p===35&&r++<6?(e.consume(p),s):p===null||It(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||Me(p)?(e.exit("atxHeading"),t(p)):it(p)?ht(e,o,"whitespace")(p):(e.enter("atxHeadingText"),l(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),o(p))}function l(p){return p===null||p===35||It(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),l)}}const OD=["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"],KE=["pre","script","style","textarea"],LD={concrete:!0,name:"htmlFlow",resolveTo:PD,tokenize:BD},FD={partial:!0,tokenize:jD},MD={partial:!0,tokenize:UD};function PD(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 BD(e,t,n){const r=this;let a,i,s,o,u;return l;function l(D){return p(D)}function p(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),d}function d(D){return D===33?(e.consume(D),f):D===47?(e.consume(D),i=!0,E):D===63?(e.consume(D),a=3,r.interrupt?t:k):kn(D)?(e.consume(D),s=String.fromCharCode(D),y):n(D)}function f(D){return D===45?(e.consume(D),a=2,m):D===91?(e.consume(D),a=5,o=0,b):kn(D)?(e.consume(D),a=4,r.interrupt?t:k):n(D)}function m(D){return D===45?(e.consume(D),r.interrupt?t:k):n(D)}function b(D){const ke="CDATA[";return D===ke.charCodeAt(o++)?(e.consume(D),o===ke.length?r.interrupt?t:j:b):n(D)}function E(D){return kn(D)?(e.consume(D),s=String.fromCharCode(D),y):n(D)}function y(D){if(D===null||D===47||D===62||It(D)){const ke=D===47,Le=s.toLowerCase();return!ke&&!i&&KE.includes(Le)?(a=1,r.interrupt?t(D):j(D)):OD.includes(s.toLowerCase())?(a=6,ke?(e.consume(D),x):r.interrupt?t(D):j(D)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):i?w(D):T(D))}return D===45||vn(D)?(e.consume(D),s+=String.fromCharCode(D),y):n(D)}function x(D){return D===62?(e.consume(D),r.interrupt?t:j):n(D)}function w(D){return it(D)?(e.consume(D),w):_(D)}function T(D){return D===47?(e.consume(D),_):D===58||D===95||kn(D)?(e.consume(D),I):it(D)?(e.consume(D),T):_(D)}function I(D){return D===45||D===46||D===58||D===95||vn(D)?(e.consume(D),I):R(D)}function R(D){return D===61?(e.consume(D),v):it(D)?(e.consume(D),R):T(D)}function v(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),u=D,A):it(D)?(e.consume(D),v):N(D)}function A(D){return D===u?(e.consume(D),u=null,F):D===null||Me(D)?n(D):(e.consume(D),A)}function N(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||It(D)?R(D):(e.consume(D),N)}function F(D){return D===47||D===62||it(D)?T(D):n(D)}function _(D){return D===62?(e.consume(D),M):n(D)}function M(D){return D===null||Me(D)?j(D):it(D)?(e.consume(D),M):n(D)}function j(D){return D===45&&a===2?(e.consume(D),ie):D===60&&a===1?(e.consume(D),X):D===62&&a===4?(e.consume(D),Y):D===63&&a===3?(e.consume(D),k):D===93&&a===5?(e.consume(D),ue):Me(D)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(FD,le,H)(D)):D===null||Me(D)?(e.exit("htmlFlowData"),H(D)):(e.consume(D),j)}function H(D){return e.check(MD,Z,le)(D)}function Z(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),V}function V(D){return D===null||Me(D)?H(D):(e.enter("htmlFlowData"),j(D))}function ie(D){return D===45?(e.consume(D),k):j(D)}function X(D){return D===47?(e.consume(D),s="",re):j(D)}function re(D){if(D===62){const ke=s.toLowerCase();return KE.includes(ke)?(e.consume(D),Y):j(D)}return kn(D)&&s.length<8?(e.consume(D),s+=String.fromCharCode(D),re):j(D)}function ue(D){return D===93?(e.consume(D),k):j(D)}function k(D){return D===62?(e.consume(D),Y):D===45&&a===2?(e.consume(D),k):j(D)}function Y(D){return D===null||Me(D)?(e.exit("htmlFlowData"),le(D)):(e.consume(D),Y)}function le(D){return e.exit("htmlFlow"),t(D)}}function UD(e,t,n){const r=this;return a;function a(s){return Me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function jD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(zs,t,n)}}const $D={name:"htmlText",tokenize:zD};function zD(e,t,n){const r=this;let a,i,s;return o;function o(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),u}function u(k){return k===33?(e.consume(k),l):k===47?(e.consume(k),R):k===63?(e.consume(k),T):kn(k)?(e.consume(k),N):n(k)}function l(k){return k===45?(e.consume(k),p):k===91?(e.consume(k),i=0,b):kn(k)?(e.consume(k),w):n(k)}function p(k){return k===45?(e.consume(k),m):n(k)}function d(k){return k===null?n(k):k===45?(e.consume(k),f):Me(k)?(s=d,X(k)):(e.consume(k),d)}function f(k){return k===45?(e.consume(k),m):d(k)}function m(k){return k===62?ie(k):k===45?f(k):d(k)}function b(k){const Y="CDATA[";return k===Y.charCodeAt(i++)?(e.consume(k),i===Y.length?E:b):n(k)}function E(k){return k===null?n(k):k===93?(e.consume(k),y):Me(k)?(s=E,X(k)):(e.consume(k),E)}function y(k){return k===93?(e.consume(k),x):E(k)}function x(k){return k===62?ie(k):k===93?(e.consume(k),x):E(k)}function w(k){return k===null||k===62?ie(k):Me(k)?(s=w,X(k)):(e.consume(k),w)}function T(k){return k===null?n(k):k===63?(e.consume(k),I):Me(k)?(s=T,X(k)):(e.consume(k),T)}function I(k){return k===62?ie(k):T(k)}function R(k){return kn(k)?(e.consume(k),v):n(k)}function v(k){return k===45||vn(k)?(e.consume(k),v):A(k)}function A(k){return Me(k)?(s=A,X(k)):it(k)?(e.consume(k),A):ie(k)}function N(k){return k===45||vn(k)?(e.consume(k),N):k===47||k===62||It(k)?F(k):n(k)}function F(k){return k===47?(e.consume(k),ie):k===58||k===95||kn(k)?(e.consume(k),_):Me(k)?(s=F,X(k)):it(k)?(e.consume(k),F):ie(k)}function _(k){return k===45||k===46||k===58||k===95||vn(k)?(e.consume(k),_):M(k)}function M(k){return k===61?(e.consume(k),j):Me(k)?(s=M,X(k)):it(k)?(e.consume(k),M):F(k)}function j(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),a=k,H):Me(k)?(s=j,X(k)):it(k)?(e.consume(k),j):(e.consume(k),Z)}function H(k){return k===a?(e.consume(k),a=void 0,V):k===null?n(k):Me(k)?(s=H,X(k)):(e.consume(k),H)}function Z(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||It(k)?F(k):(e.consume(k),Z)}function V(k){return k===47||k===62||It(k)?F(k):n(k)}function ie(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function X(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),re}function re(k){return it(k)?ht(e,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):ue(k)}function ue(k){return e.enter("htmlTextData"),s(k)}}const Sg={name:"labelEnd",resolveAll:VD,resolveTo:qD,tokenize:YD},HD={tokenize:ZD},GD={tokenize:KD},WD={tokenize:XD};function VD(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&zn(e,0,e.length,n),e}function qD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},l={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return o=[["enter",u,t],["enter",l,t]],o=Qn(o,e.slice(i+1,i+r+3)),o=Qn(o,[["enter",p,t]]),o=Qn(o,tl(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Qn(o,[["exit",p,t],e[s-2],e[s-1],["exit",l,t]]),o=Qn(o,e.slice(s+1)),o=Qn(o,[["exit",u,t]]),zn(e,i,e.length,o),e}function YD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(f){return i?i._inactive?d(f):(s=r.parser.defined.includes(ar(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):n(f)}function u(f){return f===40?e.attempt(HD,p,s?p:d)(f):f===91?e.attempt(GD,p,s?l:d)(f):s?p(f):d(f)}function l(f){return e.attempt(WD,p,d)(f)}function p(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function ZD(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),a}function a(d){return It(d)?es(e,i)(d):i(d)}function i(d){return d===41?p(d):bS(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return It(d)?es(e,u)(d):p(d)}function o(d){return n(d)}function u(d){return d===34||d===39||d===40?yS(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):p(d)}function l(d){return It(d)?es(e,p)(d):p(d)}function p(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function KD(e,t,n){const r=this;return a;function a(o){return ES.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function XD(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const QD={name:"labelStartImage",resolveAll:Sg.resolveAll,tokenize:JD};function JD(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const eO={name:"labelStartLink",resolveAll:Sg.resolveAll,tokenize:tO};function tO(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Ml={name:"lineEnding",tokenize:nO};function nO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ht(e,t,"linePrefix")}}const Ro={name:"thematicBreak",tokenize:rO};function rO(e,t,n){let r=0,a;return i;function i(l){return e.enter("thematicBreak"),s(l)}function s(l){return a=l,o(l)}function o(l){return l===a?(e.enter("thematicBreakSequence"),u(l)):r>=3&&(l===null||Me(l))?(e.exit("thematicBreak"),t(l)):n(l)}function u(l){return l===a?(e.consume(l),r++,u):(e.exit("thematicBreakSequence"),it(l)?ht(e,o,"whitespace")(l):o(l))}}const Mn={continuation:{tokenize:oO},exit:lO,name:"list",tokenize:sO},aO={partial:!0,tokenize:cO},iO={partial:!0,tokenize:uO};function sO(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(m){const b=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:zc(m)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ro,n,l)(m):l(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(m)}return n(m)}function u(m){return zc(m)&&++s<10?(e.consume(m),u):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),l(m)):n(m)}function l(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(zs,r.interrupt?n:p,e.attempt(aO,f,d))}function p(m){return r.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return it(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function oO(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(zs,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ht(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!it(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(iO,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ht(e,e.attempt(Mn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function uO(e,t,n){const r=this;return ht(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function lO(e){e.exit(this.containerState.type)}function cO(e,t,n){const r=this;return ht(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const s=r.events[r.events.length-1];return!it(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const XE={name:"setextUnderline",resolveTo:dO,tokenize:pO};function dO(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function pO(e,t,n){const r=this;let a;return i;function i(l){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=l,s(l)):n(l)}function s(l){return e.enter("setextHeadingLineSequence"),o(l)}function o(l){return l===a?(e.consume(l),o):(e.exit("setextHeadingLineSequence"),it(l)?ht(e,u,"lineSuffix")(l):u(l))}function u(l){return l===null||Me(l)?(e.exit("setextHeadingLine"),t(l)):n(l)}}const fO={tokenize:mO};function mO(e){const t=this,n=e.attempt(zs,r,e.attempt(this.parser.constructs.flowInitial,a,ht(e,e.attempt(this.parser.constructs.flow,a,e.attempt(yD,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const hO={resolveAll:TS()},gO=xS("string"),bO=xS("text");function xS(e){return{resolveAll:TS(e==="text"?EO:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(p){return l(p)?i(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return l(p)?(n.exit("data"),i(p)):(n.consume(p),u)}function l(p){if(p===null)return!0;const d=a[p];let f=-1;if(d)for(;++f<d.length;){const m=d[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function TS(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function EO(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 r=e[n-1][1],a=t.sliceStream(r);let i=a.length,s=-1,o=0,u;for(;i--;){const l=a[i];if(typeof l=="string"){for(s=l.length;l.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(l===-2)u=!0,o++;else if(l!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const l={type:n===e.length||u||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...l.start},r.start.offset===r.end.offset?Object.assign(r,l):(e.splice(n,0,["enter",l,t],["exit",l,t]),n+=2)}n++}return e}const yO={42:Mn,43:Mn,45:Mn,48:Mn,49:Mn,50:Mn,51:Mn,52:Mn,53:Mn,54:Mn,55:Mn,56:Mn,57:Mn,62:fS},xO={91:vD},TO={[-2]:Fl,[-1]:Fl,32:Fl},SO={35:kD,42:Ro,45:[XE,Ro],60:LD,61:XE,95:Ro,96:ZE,126:ZE},AO={38:hS,92:mS},vO={[-5]:Ml,[-4]:Ml,[-3]:Ml,33:QD,38:hS,42:Hc,60:[eD,$D],91:eO,92:[CD,mS],93:Sg,95:Hc,96:fD},wO={null:[Hc,hO]},_O={null:[42,95]},NO={null:[]},CO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:_O,contentInitial:xO,disable:NO,document:yO,flow:SO,flowInitial:TO,insideSpan:wO,string:AO,text:vO},Symbol.toStringTag,{value:"Module"}));function IO(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let s=[],o=[];const u={attempt:A(R),check:A(v),consume:w,enter:T,exit:I,interrupt:A(v,{interrupt:!0})},l={code:null,containerState:{},defineSkip:E,events:[],now:b,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:d};let p=t.tokenize.call(l,u);return t.resolveAll&&i.push(t),l;function d(M){return s=Qn(s,M),y(),s[s.length-1]!==null?[]:(N(t,0),l.events=tl(i,l.events,l),l.events)}function f(M,j){return RO(m(M),j)}function m(M){return kO(s,M)}function b(){const{_bufferIndex:M,_index:j,line:H,column:Z,offset:V}=r;return{_bufferIndex:M,_index:j,line:H,column:Z,offset:V}}function E(M){a[M.line]=M.column,_()}function y(){let M;for(;r._index<s.length;){const j=s[r._index];if(typeof j=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<j.length;)x(j.charCodeAt(r._bufferIndex));else x(j)}}function x(M){p=p(M)}function w(M){Me(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,_()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=M}function T(M,j){const H=j||{};return H.type=M,H.start=b(),l.events.push(["enter",H,l]),o.push(H),H}function I(M){const j=o.pop();return j.end=b(),l.events.push(["exit",j,l]),j}function R(M,j){N(M,j.from)}function v(M,j){j.restore()}function A(M,j){return H;function H(Z,V,ie){let X,re,ue,k;return Array.isArray(Z)?le(Z):"tokenize"in Z?le([Z]):Y(Z);function Y(ve){return Ue;function Ue(Ee){const he=Ee!==null&&ve[Ee],ct=Ee!==null&&ve.null,$e=[...Array.isArray(he)?he:he?[he]:[],...Array.isArray(ct)?ct:ct?[ct]:[]];return le($e)(Ee)}}function le(ve){return X=ve,re=0,ve.length===0?ie:D(ve[re])}function D(ve){return Ue;function Ue(Ee){return k=F(),ue=ve,ve.partial||(l.currentConstruct=ve),ve.name&&l.parser.constructs.disable.null.includes(ve.name)?Le():ve.tokenize.call(j?Object.assign(Object.create(l),j):l,u,ke,Le)(Ee)}}function ke(ve){return M(ue,k),V}function Le(ve){return k.restore(),++re<X.length?D(X[re]):ie}}}function N(M,j){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&zn(l.events,j,l.events.length-j,M.resolve(l.events.slice(j),l)),M.resolveTo&&(l.events=M.resolveTo(l.events,l))}function F(){const M=b(),j=l.previous,H=l.currentConstruct,Z=l.events.length,V=Array.from(o);return{from:Z,restore:ie};function ie(){r=M,l.previous=j,l.currentConstruct=H,l.events.length=Z,o=V,_()}}function _(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function kO(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function RO(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
18
18
  `;break}case-3:{s=`\r
@@ -87,8 +87,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
87
87
  * `),(s.startsWith("- [ ]")||s.startsWith("- [X]")||s.startsWith("- [x]"))&&(T=`
88
88
  - [ ] `),/^\d+.\s/.test(s)&&(T=`
89
89
  `+(parseInt(s)+1)+". "),Ga(r,T)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){Oo(e);var I={start:r.selectionStart,end:r.selectionEnd},R=I;I=ts({text:r.value,selection:I});var v=r.value.slice(I.start,I.end);o.setSelectionRange({start:I.end,end:I.end}),Ga(r,`
90
- `+v),o.setSelectionRange({start:R.start,end:R.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?_0(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&_0(e,1)}var BM=["prefixCls","onChange"],UM=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function jM(e){var t=e.prefixCls,n=e.onChange,r=fs(e,BM),a=g.useContext(Sa),i=a.markdown,s=a.commands,o=a.fullscreen,u=a.preview,l=a.highlightEnable,p=a.extraCommands,d=a.tabSize,f=a.defaultTabEnable,m=a.autoFocusEnd,b=a.textareaWarp,E=a.dispatch;fs(a,UM);var y=We.useRef(null),x=We.useRef(),w=We.useRef({fullscreen:o,preview:u});g.useEffect(()=>{w.current={fullscreen:o,preview:u,highlightEnable:l}},[o,u,l]),g.useEffect(()=>{if(y.current&&E){var I=new Og(y.current);x.current=I,E({textarea:y.current,commandOrchestrator:I})}},[]),g.useEffect(()=>{if(m&&y.current&&b){y.current.focus();var I=y.current.value.length;y.current.setSelectionRange(I,I),setTimeout(()=>{b&&(b.scrollTop=b.scrollHeight),y.current&&(y.current.scrollTop=y.current.scrollHeight)},0)}},[b]);var T=I=>{PM(I,d,f),s1(I,[...s||[],...p||[]],x.current,E,w.current)};return g.useEffect(()=>(y.current&&y.current.addEventListener("keydown",T),()=>{y.current&&y.current.removeEventListener("keydown",T)}),[]),c.jsx("textarea",at({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:y,className:t+"-text-input "+(r.className?r.className:""),value:i,onChange:I=>{E&&E({markdown:I.target.value}),n&&n(I)}}))}var $M=["prefixCls","className","onScroll","renderTextarea"];function zM(e){var t,n=e?.Markdown,r=(t=e?.useMinHeight)!=null?t:!1;return function(i){var s=i||{},o=s.prefixCls,u=s.className,l=s.onScroll,p=s.renderTextarea,d=fs(s,$M),f=g.useContext(Sa),m=f.markdown,b=f.scrollTop,E=f.commands,y=f.minHeight,x=f.highlightEnable,w=f.extraCommands,T=f.dispatch,I=We.useRef(null),R=We.useRef(),v=We.createRef();g.useEffect(()=>{var N={};v.current&&(N.textareaWarp=v.current||void 0,v.current.scrollTop=b||0),T&&T(at({},N))},[]),g.useEffect(()=>{if(I.current&&T){var N=new Og(I.current);R.current=N,T({textarea:I.current,commandOrchestrator:N})}},[]);var A=n&&x?{}:{WebkitTextFillColor:"initial",overflow:"auto"};return c.jsx("div",{ref:v,className:o+"-area "+(u||""),onScroll:l,children:c.jsx("div",{className:o+"-text",style:r?{minHeight:y}:void 0,children:p?We.cloneElement(p(at({},d,{value:m,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:o+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:T,onChange:d.onChange,shortcuts:s1,useContext:{commands:E,extraCommands:w,commandOrchestrator:R.current}}),{ref:I}):c.jsxs(g.Fragment,{children:[n&&x&&c.jsx(n,{prefixCls:o}),c.jsx(jM,at({prefixCls:o},d,{style:A}))]})})})}}const HM=zM({Markdown:nM,useMinHeight:!0});function GM(e){var t=e||{},n=t.prefixCls,r=t.groupName,a=t.commands,i=t.children,s=g.useContext(Sa),o=s.barPopup,u=o===void 0?{}:o;return g.useMemo(()=>c.jsx("div",{className:n+"-toolbar-child "+(r&&u[r]?"active":""),onClick:l=>l.stopPropagation(),children:Array.isArray(a)?c.jsx(d1,at({commands:a},e,{isChild:!0})):i}),[a,u,r,n])}function N0(e){var t=e.prefixCls,n=e.overflow,r=g.useContext(Sa),a=r.fullscreen,i=r.preview,s=r.barPopup,o=s===void 0?{}:s,u=r.components,l=r.commandOrchestrator,p=r.dispatch,d=g.useRef("");function f(m,b){if(p){var E={barPopup:at({},o)};m.keyCommand==="preview"&&(E.preview=m.value),m.keyCommand==="fullscreen"&&(E.fullscreen=!a),e.commands&&m.keyCommand==="group"?e.commands.forEach(y=>{b===y.groupName?E.barPopup[b]=!0:y.keyCommand&&(E.barPopup[y.groupName]=!1)}):(b||m.parent)&&Object.keys(E.barPopup||{}).forEach(y=>{E.barPopup[y]=!1}),Object.keys(E).length&&p(at({},E)),l&&l.executeCommand(m)}}return g.useEffect(()=>{document&&n&&(a?document.body.style.overflow="hidden":(d.current||(d.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=d.current))},[a,d,n]),c.jsx("ul",{children:(e.commands||[]).map((m,b)=>{if(m.keyCommand==="divider")return c.jsx("li",at({},m.liProps,{className:t+"-toolbar-divider"}),b);if(!m.keyCommand)return c.jsx(g.Fragment,{},b);var E=a&&m.keyCommand==="fullscreen"||m.keyCommand==="preview"&&i===m.value,y=m.children&&typeof m.children=="function"?m.children({getState:()=>l.getState(),textApi:l?l.textApi:void 0,close:()=>f({},m.groupName),execute:()=>f({execute:m.execute}),dispatch:p}):void 0,x=o&&i&&i==="preview"&&!/(preview|fullscreen)/.test(m.keyCommand),w=u?.toolbar||m.render,T=w&&typeof w=="function"?w(m,!!x,f,b):null;return c.jsxs("li",at({},m.liProps,{className:E?"active":"",children:[T&&We.isValidElement(T)&&T,!T&&!m.buttonProps&&m.icon,!T&&m.buttonProps&&We.createElement("button",at({type:"button",key:b,disabled:x,"data-name":m.name},m.buttonProps,{onClick:I=>{I.stopPropagation(),f(m,m.groupName)}}),m.icon),m.children&&c.jsx(GM,{overflow:n,groupName:m.groupName,prefixCls:t,children:y,commands:Array.isArray(m.children)?m.children:void 0})]}),b)})})}function d1(e){e===void 0&&(e={});var t=e,n=t.prefixCls,r=t.isChild,a=t.className,i=g.useContext(Sa),s=i.commands,o=i.extraCommands;return c.jsxs("div",{className:n+"-toolbar "+a,children:[c.jsx(N0,at({},e,{commands:e.commands||s||[]})),!r&&c.jsx(N0,at({},e,{commands:o||[]}))]})}function C0(e){var t=e.hideToolbar,n=e.toolbarBottom,r=e.placement,a=e.overflow,i=e.prefixCls;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var s=n?"bottom":"";return c.jsx(d1,{prefixCls:i,overflow:a,className:s})}var WM=e=>{var t=e||{},n=t.prefixCls,r=t.onChange,a=g.useRef(null),i=g.useRef(),s=g.useRef(e.height);g.useEffect(()=>{s.current!==e.height&&(s.current=e.height)},[e.height]);function o(d){if(i.current){var f,m=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY),b=i.current.height+m-i.current.dragY;b>=e.minHeight&&b<=e.maxHeight&&r&&r(i.current.height+(m-i.current.dragY))}}function u(){var d,f;i.current=void 0,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",u),(d=a.current)==null||d.removeEventListener("touchmove",o),(f=a.current)==null||f.removeEventListener("touchend",u)}function l(d){var f,m,b;d.preventDefault();var E=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY);i.current={height:s.current,dragY:E},document.addEventListener("mousemove",o),document.addEventListener("mouseup",u),(m=a.current)==null||m.addEventListener("touchmove",o,{passive:!1}),(b=a.current)==null||b.addEventListener("touchend",u,{passive:!1})}g.useEffect(()=>{if(document){var d,f;(d=a.current)==null||d.addEventListener("touchstart",l,{passive:!1}),(f=a.current)==null||f.addEventListener("mousedown",l)}return()=>{if(document){var m;(m=a.current)==null||m.removeEventListener("touchstart",l),document.removeEventListener("mousemove",o)}}},[]);var p=g.useMemo(()=>c.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:c.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return c.jsx("div",{className:n+"-bar",ref:a,children:p})},VM=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function qM(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}function YM(e){var t=e.MarkdownPreview,n=e.TextArea,r=t,a=n,i=We.forwardRef((o,u)=>{var l=o||{},p=l.prefixCls,d=p===void 0?"w-md-editor":p,f=l.className,m=l.value,b=l.commands,E=b===void 0?FM():b,y=l.commandsFilter,x=l.direction,w=l.extraCommands,T=w===void 0?MM():w,I=l.height,R=I===void 0?200:I,v=l.enableScroll,A=v===void 0?!0:v,N=l.visibleDragbar,F=N===void 0?typeof o.visiableDragbar=="boolean"?o.visiableDragbar:!0:N,_=l.highlightEnable,M=_===void 0?!0:_,j=l.preview,H=j===void 0?"live":j,Z=l.fullscreen,V=Z===void 0?!1:Z,ie=l.overflow,X=ie===void 0?!0:ie,re=l.previewOptions,ue=re===void 0?{}:re,k=l.textareaProps,Y=l.maxHeight,le=Y===void 0?1200:Y,D=l.minHeight,ke=D===void 0?100:D,Le=l.autoFocus,ve=l.autoFocusEnd,Ue=ve===void 0?!1:ve,Ee=l.tabSize,he=Ee===void 0?2:Ee,ct=l.defaultTabEnable,$e=ct===void 0?!1:ct,ge=l.onChange,Pe=l.onStatistics,pt=l.onHeightChange,de=l.hideToolbar,rt=l.toolbarBottom,Ot=rt===void 0?!1:rt,ft=l.components,kt=l.renderTextarea,wt=fs(l,VM),zt=E.map(U=>y?y(U,!1):U).filter(Boolean),nn=T.map(U=>y?y(U,!0):U).filter(Boolean),ut=g.useReducer(eM,{markdown:m,preview:H,components:ft,height:R,minHeight:ke,highlightEnable:M,tabSize:he,defaultTabEnable:$e,scrollTop:0,scrollTopPreview:0,commands:zt,extraCommands:nn,fullscreen:V,barPopup:{}}),Ae=ut[0],Ye=ut[1],q=g.useRef(null),te=g.useRef(null),ye=g.useRef(A);g.useImperativeHandle(u,()=>at({},Ae,{container:q.current,dispatch:Ye})),g.useMemo(()=>ye.current=A,[A]),g.useEffect(()=>{var U={};q.current&&(U.container=q.current||void 0),U.markdown=m||"",U.barPopup={},Ye&&Ye(at({},Ae,U))},[]);var we=[f,"wmde-markdown-var",x?d+"-"+x:null,d,Ae.preview?d+"-show-"+Ae.preview:null,Ae.fullscreen?d+"-fullscreen":null].filter(Boolean).join(" ").trim();g.useMemo(()=>m!==Ae.markdown&&Ye({markdown:m||""}),[m,Ae.markdown]),g.useMemo(()=>H!==Ae.preview&&Ye({preview:H}),[H]),g.useMemo(()=>he!==Ae.tabSize&&Ye({tabSize:he}),[he]),g.useMemo(()=>M!==Ae.highlightEnable&&Ye({highlightEnable:M}),[M]),g.useMemo(()=>Le!==Ae.autoFocus&&Ye({autoFocus:Le}),[Le]),g.useMemo(()=>Ue!==Ae.autoFocusEnd&&Ye({autoFocusEnd:Ue}),[Ue]),g.useMemo(()=>V!==Ae.fullscreen&&Ye({fullscreen:V}),[V]),g.useMemo(()=>R!==Ae.height&&Ye({height:R}),[R]),g.useMemo(()=>R!==Ae.height&&pt&&pt(Ae.height,R,Ae),[R,pt,Ae]),g.useMemo(()=>E!==Ae.commands&&Ye({commands:zt}),[o.commands]),g.useMemo(()=>T!==Ae.extraCommands&&Ye({extraCommands:nn}),[o.extraCommands]);var je=g.useRef(),Ze=g.useRef("preview"),_t=g.useRef(!1);g.useMemo(()=>{je.current=Ae.textareaWarp,Ae.textareaWarp&&(Ae.textareaWarp.addEventListener("mouseover",()=>{Ze.current="text"}),Ae.textareaWarp.addEventListener("mouseleave",()=>{Ze.current="preview"}))},[Ae.textareaWarp]);var St=(U,Te)=>{if(ye.current){var Ne=je.current,ze=te.current?te.current:void 0;if(_t.current||(Ze.current=Te,_t.current=!0),Ne&&ze){var Xe=(Ne.scrollHeight-Ne.offsetHeight)/(ze.scrollHeight-ze.offsetHeight);U.target===Ne&&Ze.current==="text"&&(ze.scrollTop=Ne.scrollTop/Xe),U.target===ze&&Ze.current==="preview"&&(Ne.scrollTop=ze.scrollTop*Xe);var Ve=0;Ze.current==="text"?Ve=Ne.scrollTop||0:Ze.current==="preview"&&(Ve=ze.scrollTop||0),Ye({scrollTop:Ve})}}},Et=d+"-preview "+(ue.className||""),Nt=U=>St(U,"preview"),J=g.useMemo(()=>c.jsx("div",{ref:te,className:Et,children:c.jsx(r,at({},ue,{onScroll:Nt,source:Ae.markdown||""}))}),[Et,ue,Ae.markdown]),be=ft?.preview&&ft?.preview(Ae.markdown||"",Ae,Ye);be&&We.isValidElement(be)&&(J=c.jsx("div",{className:Et,ref:te,onScroll:Nt,children:be}));var Fe=at({},wt.style,{height:Ae.height||"100%"}),Re=()=>Ye({barPopup:at({},qM(Ae.barPopup))}),xt=U=>Ye({height:U}),Wt=U=>{if(ge&&ge(U.target.value,U,Ae),k&&k.onChange&&k.onChange(U),Ae.textarea&&Ae.textarea instanceof HTMLTextAreaElement&&Pe){var Te=new Og(Ae.textarea),Ne=Te.getState()||{};Pe(at({},Ne,{lineCount:U.target.value.split(`
91
- `).length,length:U.target.value.length}))}};return c.jsx(Sa.Provider,{value:at({},Ae,{dispatch:Ye}),children:c.jsxs("div",at({ref:q,className:we},wt,{onClick:Re,style:Fe,children:[c.jsx(C0,{hideToolbar:de,toolbarBottom:Ot,prefixCls:d,overflow:X,placement:"top"}),c.jsxs("div",{className:d+"-content",children:[/(edit|live)/.test(Ae.preview||"")&&c.jsx(a,at({className:d+"-input",prefixCls:d,autoFocus:Le},k,{onChange:Wt,renderTextarea:ft?.textarea||kt,onScroll:U=>St(U,"text")})),/(live|preview)/.test(Ae.preview||"")&&J]}),F&&!Ae.fullscreen&&c.jsx(WM,{prefixCls:d,height:Ae.height,maxHeight:le,minHeight:ke,onChange:xt}),c.jsx(C0,{hideToolbar:de,toolbarBottom:Ot,prefixCls:d,overflow:X,placement:"bottom"})]}))})}),s=i;return s.Markdown=t,s.displayName="MDEditor",s}const Ko=YM({MarkdownPreview:M6,TextArea:HM}),ZM={neutral:"badge-neutral",primary:"badge-primary",secondary:"badge-secondary",accent:"badge-accent",ghost:"badge-ghost",info:"badge-info",success:"badge-success",warning:"badge-warning",error:"badge-error",outline:"badge-outline"},KM={xs:"badge-xs",sm:"badge-sm",md:"badge-md",lg:"badge-lg"};function st({variant:e,size:t,className:n,...r}){const a=["badge",e&&ZM[e],t&&KM[t],n].filter(Boolean).join(" ");return c.jsx("span",{className:a,...r})}const XM={primary:"btn-primary",ghost:"btn-ghost",error:"btn-error",outline:"btn-outline",accent:"btn-accent",warning:"btn-warning"},QM={xs:"btn-xs",sm:"btn-sm",md:"btn-md",lg:"btn-lg"};function He({variant:e,size:t,loading:n,asChild:r,className:a,disabled:i,children:s,...o}){const u=["btn",e&&XM[e],t&&QM[t],a].filter(Boolean).join(" ");if(r&&We.isValidElement(s)){const l=s,p=[u,l.props.className].filter(Boolean).join(" ");return We.cloneElement(l,{className:p})}return c.jsxs("button",{className:u,disabled:i||n,...o,children:[n&&c.jsx("span",{className:"loading loading-spinner"}),s]})}const JM={bordered:"card-bordered",primary:"card-primary",secondary:"card-secondary",accent:"card-accent",neutral:"card-neutral",imagefull:"card-image-full",compact:"card-compact",normal:"card-normal",side:"card-side"};function mi({variant:e,asChild:t,className:n,children:r,...a}){const i=["card",e&&JM[e],n].filter(Boolean).join(" ");if(t&&We.isValidElement(r)){const s=r,o=[i,s.props.className].filter(Boolean).join(" ");return We.cloneElement(s,{className:o})}return c.jsx("div",{className:i,...a,children:r})}function hi({className:e,...t}){const n=["card-body",e].filter(Boolean).join(" ");return c.jsx("div",{className:n,...t})}const eP={primary:"checkbox-primary",secondary:"checkbox-secondary",accent:"checkbox-accent",neutral:"checkbox-neutral",success:"checkbox-success",warning:"checkbox-warning",error:"checkbox-error",info:"checkbox-info"},tP={xs:"checkbox-xs",sm:"checkbox-sm",md:"checkbox-md",lg:"checkbox-lg"};function Lg({variant:e,size:t,className:n,...r}){const a=["checkbox",e&&eP[e],t&&tP[t],n].filter(Boolean).join(" ");return c.jsx("input",{type:"checkbox",className:a,...r})}const nP={bordered:"input-bordered",ghost:"input-ghost",primary:"input-primary",secondary:"input-secondary",accent:"input-accent",info:"input-info",success:"input-success",warning:"input-warning",error:"input-error"},rP={xs:"input-xs",sm:"input-sm",md:"input-md",lg:"input-lg",xl:"input-xl"};function gs({variant:e,size:t,error:n,className:r,...a}){const i=["input",e&&nP[e],t&&rP[t],n&&"input-error",r].filter(Boolean).join(" ");return c.jsx("input",{className:i,...a})}const aP={spinner:"loading-spinner",dots:"loading-dots",ring:"loading-ring",ball:"loading-ball",bars:"loading-bars",infinity:"loading-infinity"},iP={xs:"loading-xs",sm:"loading-sm",md:"loading-md",lg:"loading-lg",xl:"loading-xl"};function Tr({variant:e="spinner",size:t,className:n,...r}){const a=["loading",aP[e],t&&iP[t],n].filter(Boolean).join(" ");return c.jsx("span",{className:a,...r})}const sP={primary:"modal-primary",secondary:"modal-secondary",accent:"modal-accent",neutral:"modal-neutral",success:"modal-success",warning:"modal-warning",error:"modal-error",info:"modal-info"};function Xo({variant:e,open:t,onClose:n,className:r,children:a,...i}){if(!t)return null;const s=["modal-box",e&&sP[e],r].filter(Boolean).join(" ");return c.jsx("div",{className:"modal modal-open",role:"dialog","aria-modal":"true",tabIndex:-1,onClick:o=>{o.target===o.currentTarget&&n?.()},onKeyDown:o=>{o.key==="Escape"&&n?.()},...i,children:c.jsx("div",{className:s,children:a})})}const oP={bordered:"select-bordered",ghost:"select-ghost",primary:"select-primary",secondary:"select-secondary",accent:"select-accent",info:"select-info",success:"select-success",warning:"select-warning",error:"select-error"},uP={xs:"select-xs",sm:"select-sm",md:"select-md",lg:"select-lg"};function Zr({variant:e,size:t,className:n,children:r,...a}){const i=["select",e&&oP[e],t&&uP[t],n].filter(Boolean).join(" ");return c.jsx("select",{className:i,...a,children:r})}const lP={top:"tooltip-top",bottom:"tooltip-bottom",left:"tooltip-left",right:"tooltip-right"};function cP({position:e,tip:t,className:n,...r}){const a=["tooltip",e&&lP[e],n].filter(Boolean).join(" ");return c.jsx("span",{className:a,"data-tip":t,...r})}const p1="spur-board-layout",Ia={sidebarWidth:240,rightPanelWidth:320,sidebarCollapsed:!1,rightPanelCollapsed:!0};function dP(){try{const e=localStorage.getItem(p1);if(!e)return{...Ia};const t=JSON.parse(e);return{sidebarWidth:typeof t.sidebarWidth=="number"?t.sidebarWidth:Ia.sidebarWidth,rightPanelWidth:typeof t.rightPanelWidth=="number"?t.rightPanelWidth:Ia.rightPanelWidth,sidebarCollapsed:typeof t.sidebarCollapsed=="boolean"?t.sidebarCollapsed:Ia.sidebarCollapsed,rightPanelCollapsed:typeof t.rightPanelCollapsed=="boolean"?t.rightPanelCollapsed:Ia.rightPanelCollapsed}}catch{return{...Ia}}}function pP(e){try{localStorage.setItem(p1,JSON.stringify(e))}catch{}}const fP=[];function mP(e){return e[0]??{}}function Qo(e){return Array.isArray(e)?e:e==null?[]:[e]}const I0="orpc",hP="@orpc/shared",gP="1.14.4";class bP extends Error{constructor(...t){super(...t),this.name="AbortError"}}function EP(e){let t;return()=>{if(t)return t.result;const n=e();return t={result:n},n}}function yP(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}const xP=2,TP=`__${hP}@${gP}/otel/config__`;function nl(){return globalThis[TP]}function Fg(e,t={},n){return nl()?.tracer?.startSpan(e,t,n)}function ca(e,t,n={}){if(!e)return;const r=SP(t);e.recordException(r),(!n.signal?.aborted||n.signal.reason!==t)&&e.setStatus({code:xP,message:r.message})}function SP(e){if(e instanceof Error){const t={message:e.message,name:e.name,stack:e.stack};return"code"in e&&(typeof e.code=="string"||typeof e.code=="number")&&(t.code=e.code),t}return{message:String(e)}}async function $i({name:e,context:t,...n},r){const a=nl()?.tracer;if(!a)return r();const i=async s=>{try{return await r(s)}catch(o){throw ca(s,o,n),o}finally{s.end()}};return t?a.startActiveSpan(e,n,t,i):a.startActiveSpan(e,n,i)}async function Ka(e,t){const n=nl();if(!e||!n)return t();const r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function bs(e){return!e||typeof e!="object"?!1:"next"in e&&typeof e.next=="function"&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}const AP=Symbol.for("asyncDispose"),vP=Symbol.asyncDispose??AP;class Mg{#e=!1;#t=!1;#n;#r;constructor(t,n){this.#n=n,this.#r=yP(async()=>{if(this.#e)return{done:!0,value:void 0};try{const r=await t();return r.done&&(this.#e=!0),r}catch(r){throw this.#e=!0,r}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n("next"))}})}next(){return this.#r()}async return(t){return this.#e=!0,this.#t||(this.#t=!0,await this.#n("return")),{done:!0,value:t}}async throw(t){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n("throw")),t}async[vP](){this.#e=!0,this.#t||(this.#t=!0,await this.#n("dispose"))}[Symbol.asyncIterator](){return this}}function k0({name:e,...t},n){let r;return new Mg(async()=>{r??=Fg(e);try{const a=await Ka(r,()=>n.next());return r?.addEvent(a.done?"completed":"yielded"),a}catch(a){throw ca(r,a,t),a}},async a=>{try{a!=="next"&&await Ka(r,()=>n.return?.())}catch(i){throw ca(r,i,t),i}finally{r?.end()}})}function wP(e){return async(t,...n)=>{try{return await t.next()}catch(r){throw await e(r,t,...n),r}}}function Zc(e,t,n){const r=(a,i)=>{const s=e[i];return s?s({...a,next:(o=a)=>r(o,i+1)}):n(a)};return r(t,0)}function Lo(e){if(e)return JSON.parse(e)}function Kc(e){return JSON.stringify(e)}function _P(e){return da(e)?Object.getPrototypeOf(e)?.constructor:null}function Yr(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function da(e){return!!e&&(typeof e=="object"||typeof e=="function")}function R0(e,t){let n=e;for(const r of t){if(!da(n))return;n=n[r]}return n}const f1=(()=>{const e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function D0(e,...t){return typeof e=="function"?e(...t):e}function m1(e){return new Proxy(e,{get(t,n,r){const a=Reflect.get(t,n,r);return n!=="then"||typeof a!="function"?a:new Proxy(a,{apply(i,s,o){if(o.length!==2||o.some(l=>!CP(l)))return Reflect.apply(i,s,o);let u=!0;o[0].call(s,m1(new Proxy(t,{get:(l,p,d)=>{if(u&&p==="then"){u=!1;return}return Reflect.get(l,p,d)}})))}})}})}const NP=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;function CP(e){return typeof e=="function"&&NP.test(e.toString())}function IP(e){try{return decodeURIComponent(e)}catch{return e}}const kP="@orpc/client",RP="1.14.4",Pg={BAD_REQUEST:{status:400,message:"Bad Request"},UNAUTHORIZED:{status:401,message:"Unauthorized"},FORBIDDEN:{status:403,message:"Forbidden"},NOT_FOUND:{status:404,message:"Not Found"},METHOD_NOT_SUPPORTED:{status:405,message:"Method Not Supported"},NOT_ACCEPTABLE:{status:406,message:"Not Acceptable"},TIMEOUT:{status:408,message:"Request Timeout"},CONFLICT:{status:409,message:"Conflict"},PRECONDITION_FAILED:{status:412,message:"Precondition Failed"},PAYLOAD_TOO_LARGE:{status:413,message:"Payload Too Large"},UNSUPPORTED_MEDIA_TYPE:{status:415,message:"Unsupported Media Type"},UNPROCESSABLE_CONTENT:{status:422,message:"Unprocessable Content"},TOO_MANY_REQUESTS:{status:429,message:"Too Many Requests"},CLIENT_CLOSED_REQUEST:{status:499,message:"Client Closed Request"},INTERNAL_SERVER_ERROR:{status:500,message:"Internal Server Error"},NOT_IMPLEMENTED:{status:501,message:"Not Implemented"},BAD_GATEWAY:{status:502,message:"Bad Gateway"},SERVICE_UNAVAILABLE:{status:503,message:"Service Unavailable"},GATEWAY_TIMEOUT:{status:504,message:"Gateway Timeout"}};function DP(e,t){return t??Pg[e]?.status??500}function OP(e,t){return t||Pg[e]?.message||e}const h1=Symbol.for(`__${kP}@${RP}/error/ORPC_ERROR_CONSTRUCTORS__`);globalThis[h1]??=new WeakSet;const Xc=globalThis[h1];class Es extends Error{defined;code;status;data;constructor(t,...n){const r=mP(n);if(r.status!==void 0&&!ys(r.status))throw new Error("[ORPCError] Invalid error status code.");const a=OP(t,r.message);super(a,r),this.code=t,this.status=DP(t,r.status),this.defined=r.defined??!1,this.data=r.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](t){if(Xc.has(this)){const n=_P(t);if(n&&Xc.has(n))return!0}return super[Symbol.hasInstance](t)}}Xc.add(Es);function LP(e){return e instanceof Es?e:new Es("INTERNAL_SERVER_ERROR",{message:"Internal server error",cause:e})}function ys(e){return e<200||e>=400}function g1(e){if(!Yr(e))return!1;const t=["defined","code","status","message","data"];return Object.keys(e).some(n=>!t.includes(n))?!1:"defined"in e&&typeof e.defined=="boolean"&&"code"in e&&typeof e.code=="string"&&"status"in e&&typeof e.status=="number"&&ys(e.status)&&"message"in e&&typeof e.message=="string"}function b1(e,t={}){return new Es(e.code,{...t,...e})}class rl extends TypeError{}class FP extends TypeError{}class xs extends Error{data;constructor(t){super(t?.message??"An error event was received",t),this.data=t?.data}}function MP(e){const t=e.replace(/\n+$/,"").split(/\n/),n={data:void 0,event:void 0,id:void 0,retry:void 0,comments:[]};for(const r of t){const a=r.indexOf(":"),i=a===-1?r:r.slice(0,a),s=a===-1?"":r.slice(a+1).replace(/^\s/,"");if(a===0)n.comments.push(s);else if(i==="data")n.data??="",n.data+=`${s}
90
+ `+v),o.setSelectionRange({start:R.start,end:R.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?_0(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&_0(e,1)}var BM=["prefixCls","onChange"],UM=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function jM(e){var t=e.prefixCls,n=e.onChange,r=fs(e,BM),a=g.useContext(Sa),i=a.markdown,s=a.commands,o=a.fullscreen,u=a.preview,l=a.highlightEnable,p=a.extraCommands,d=a.tabSize,f=a.defaultTabEnable,m=a.autoFocusEnd,b=a.textareaWarp,E=a.dispatch;fs(a,UM);var y=We.useRef(null),x=We.useRef(),w=We.useRef({fullscreen:o,preview:u});g.useEffect(()=>{w.current={fullscreen:o,preview:u,highlightEnable:l}},[o,u,l]),g.useEffect(()=>{if(y.current&&E){var I=new Og(y.current);x.current=I,E({textarea:y.current,commandOrchestrator:I})}},[]),g.useEffect(()=>{if(m&&y.current&&b){y.current.focus();var I=y.current.value.length;y.current.setSelectionRange(I,I),setTimeout(()=>{b&&(b.scrollTop=b.scrollHeight),y.current&&(y.current.scrollTop=y.current.scrollHeight)},0)}},[b]);var T=I=>{PM(I,d,f),s1(I,[...s||[],...p||[]],x.current,E,w.current)};return g.useEffect(()=>(y.current&&y.current.addEventListener("keydown",T),()=>{y.current&&y.current.removeEventListener("keydown",T)}),[]),c.jsx("textarea",at({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:y,className:t+"-text-input "+(r.className?r.className:""),value:i,onChange:I=>{E&&E({markdown:I.target.value}),n&&n(I)}}))}var $M=["prefixCls","className","onScroll","renderTextarea"];function zM(e){var t,n=e?.Markdown,r=(t=e?.useMinHeight)!=null?t:!1;return function(i){var s=i||{},o=s.prefixCls,u=s.className,l=s.onScroll,p=s.renderTextarea,d=fs(s,$M),f=g.useContext(Sa),m=f.markdown,b=f.scrollTop,E=f.commands,y=f.minHeight,x=f.highlightEnable,w=f.extraCommands,T=f.dispatch,I=We.useRef(null),R=We.useRef(),v=We.createRef();g.useEffect(()=>{var N={};v.current&&(N.textareaWarp=v.current||void 0,v.current.scrollTop=b||0),T&&T(at({},N))},[]),g.useEffect(()=>{if(I.current&&T){var N=new Og(I.current);R.current=N,T({textarea:I.current,commandOrchestrator:N})}},[]);var A=n&&x?{}:{WebkitTextFillColor:"initial",overflow:"auto"};return c.jsx("div",{ref:v,className:o+"-area "+(u||""),onScroll:l,children:c.jsx("div",{className:o+"-text",style:r?{minHeight:y}:void 0,children:p?We.cloneElement(p(at({},d,{value:m,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:o+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:T,onChange:d.onChange,shortcuts:s1,useContext:{commands:E,extraCommands:w,commandOrchestrator:R.current}}),{ref:I}):c.jsxs(g.Fragment,{children:[n&&x&&c.jsx(n,{prefixCls:o}),c.jsx(jM,at({prefixCls:o},d,{style:A}))]})})})}}const HM=zM({Markdown:nM,useMinHeight:!0});function GM(e){var t=e||{},n=t.prefixCls,r=t.groupName,a=t.commands,i=t.children,s=g.useContext(Sa),o=s.barPopup,u=o===void 0?{}:o;return g.useMemo(()=>c.jsx("div",{className:n+"-toolbar-child "+(r&&u[r]?"active":""),onClick:l=>l.stopPropagation(),children:Array.isArray(a)?c.jsx(d1,at({commands:a},e,{isChild:!0})):i}),[a,u,r,n])}function N0(e){var t=e.prefixCls,n=e.overflow,r=g.useContext(Sa),a=r.fullscreen,i=r.preview,s=r.barPopup,o=s===void 0?{}:s,u=r.components,l=r.commandOrchestrator,p=r.dispatch,d=g.useRef("");function f(m,b){if(p){var E={barPopup:at({},o)};m.keyCommand==="preview"&&(E.preview=m.value),m.keyCommand==="fullscreen"&&(E.fullscreen=!a),e.commands&&m.keyCommand==="group"?e.commands.forEach(y=>{b===y.groupName?E.barPopup[b]=!0:y.keyCommand&&(E.barPopup[y.groupName]=!1)}):(b||m.parent)&&Object.keys(E.barPopup||{}).forEach(y=>{E.barPopup[y]=!1}),Object.keys(E).length&&p(at({},E)),l&&l.executeCommand(m)}}return g.useEffect(()=>{document&&n&&(a?document.body.style.overflow="hidden":(d.current||(d.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=d.current))},[a,d,n]),c.jsx("ul",{children:(e.commands||[]).map((m,b)=>{if(m.keyCommand==="divider")return c.jsx("li",at({},m.liProps,{className:t+"-toolbar-divider"}),b);if(!m.keyCommand)return c.jsx(g.Fragment,{},b);var E=a&&m.keyCommand==="fullscreen"||m.keyCommand==="preview"&&i===m.value,y=m.children&&typeof m.children=="function"?m.children({getState:()=>l.getState(),textApi:l?l.textApi:void 0,close:()=>f({},m.groupName),execute:()=>f({execute:m.execute}),dispatch:p}):void 0,x=o&&i&&i==="preview"&&!/(preview|fullscreen)/.test(m.keyCommand),w=u?.toolbar||m.render,T=w&&typeof w=="function"?w(m,!!x,f,b):null;return c.jsxs("li",at({},m.liProps,{className:E?"active":"",children:[T&&We.isValidElement(T)&&T,!T&&!m.buttonProps&&m.icon,!T&&m.buttonProps&&We.createElement("button",at({type:"button",key:b,disabled:x,"data-name":m.name},m.buttonProps,{onClick:I=>{I.stopPropagation(),f(m,m.groupName)}}),m.icon),m.children&&c.jsx(GM,{overflow:n,groupName:m.groupName,prefixCls:t,children:y,commands:Array.isArray(m.children)?m.children:void 0})]}),b)})})}function d1(e){e===void 0&&(e={});var t=e,n=t.prefixCls,r=t.isChild,a=t.className,i=g.useContext(Sa),s=i.commands,o=i.extraCommands;return c.jsxs("div",{className:n+"-toolbar "+a,children:[c.jsx(N0,at({},e,{commands:e.commands||s||[]})),!r&&c.jsx(N0,at({},e,{commands:o||[]}))]})}function C0(e){var t=e.hideToolbar,n=e.toolbarBottom,r=e.placement,a=e.overflow,i=e.prefixCls;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var s=n?"bottom":"";return c.jsx(d1,{prefixCls:i,overflow:a,className:s})}var WM=e=>{var t=e||{},n=t.prefixCls,r=t.onChange,a=g.useRef(null),i=g.useRef(),s=g.useRef(e.height);g.useEffect(()=>{s.current!==e.height&&(s.current=e.height)},[e.height]);function o(d){if(i.current){var f,m=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY),b=i.current.height+m-i.current.dragY;b>=e.minHeight&&b<=e.maxHeight&&r&&r(i.current.height+(m-i.current.dragY))}}function u(){var d,f;i.current=void 0,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",u),(d=a.current)==null||d.removeEventListener("touchmove",o),(f=a.current)==null||f.removeEventListener("touchend",u)}function l(d){var f,m,b;d.preventDefault();var E=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY);i.current={height:s.current,dragY:E},document.addEventListener("mousemove",o),document.addEventListener("mouseup",u),(m=a.current)==null||m.addEventListener("touchmove",o,{passive:!1}),(b=a.current)==null||b.addEventListener("touchend",u,{passive:!1})}g.useEffect(()=>{if(document){var d,f;(d=a.current)==null||d.addEventListener("touchstart",l,{passive:!1}),(f=a.current)==null||f.addEventListener("mousedown",l)}return()=>{if(document){var m;(m=a.current)==null||m.removeEventListener("touchstart",l),document.removeEventListener("mousemove",o)}}},[]);var p=g.useMemo(()=>c.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:c.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return c.jsx("div",{className:n+"-bar",ref:a,children:p})},VM=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function qM(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}function YM(e){var t=e.MarkdownPreview,n=e.TextArea,r=t,a=n,i=We.forwardRef((o,u)=>{var l=o||{},p=l.prefixCls,d=p===void 0?"w-md-editor":p,f=l.className,m=l.value,b=l.commands,E=b===void 0?FM():b,y=l.commandsFilter,x=l.direction,w=l.extraCommands,T=w===void 0?MM():w,I=l.height,R=I===void 0?200:I,v=l.enableScroll,A=v===void 0?!0:v,N=l.visibleDragbar,F=N===void 0?typeof o.visiableDragbar=="boolean"?o.visiableDragbar:!0:N,_=l.highlightEnable,M=_===void 0?!0:_,j=l.preview,H=j===void 0?"live":j,Z=l.fullscreen,V=Z===void 0?!1:Z,ie=l.overflow,X=ie===void 0?!0:ie,re=l.previewOptions,ue=re===void 0?{}:re,k=l.textareaProps,Y=l.maxHeight,le=Y===void 0?1200:Y,D=l.minHeight,ke=D===void 0?100:D,Le=l.autoFocus,ve=l.autoFocusEnd,Ue=ve===void 0?!1:ve,Ee=l.tabSize,he=Ee===void 0?2:Ee,ct=l.defaultTabEnable,$e=ct===void 0?!1:ct,ge=l.onChange,Pe=l.onStatistics,pt=l.onHeightChange,de=l.hideToolbar,rt=l.toolbarBottom,Ot=rt===void 0?!1:rt,ft=l.components,kt=l.renderTextarea,wt=fs(l,VM),zt=E.map(U=>y?y(U,!1):U).filter(Boolean),nn=T.map(U=>y?y(U,!0):U).filter(Boolean),ut=g.useReducer(eM,{markdown:m,preview:H,components:ft,height:R,minHeight:ke,highlightEnable:M,tabSize:he,defaultTabEnable:$e,scrollTop:0,scrollTopPreview:0,commands:zt,extraCommands:nn,fullscreen:V,barPopup:{}}),Ae=ut[0],Ye=ut[1],q=g.useRef(null),te=g.useRef(null),ye=g.useRef(A);g.useImperativeHandle(u,()=>at({},Ae,{container:q.current,dispatch:Ye})),g.useMemo(()=>ye.current=A,[A]),g.useEffect(()=>{var U={};q.current&&(U.container=q.current||void 0),U.markdown=m||"",U.barPopup={},Ye&&Ye(at({},Ae,U))},[]);var we=[f,"wmde-markdown-var",x?d+"-"+x:null,d,Ae.preview?d+"-show-"+Ae.preview:null,Ae.fullscreen?d+"-fullscreen":null].filter(Boolean).join(" ").trim();g.useMemo(()=>m!==Ae.markdown&&Ye({markdown:m||""}),[m,Ae.markdown]),g.useMemo(()=>H!==Ae.preview&&Ye({preview:H}),[H]),g.useMemo(()=>he!==Ae.tabSize&&Ye({tabSize:he}),[he]),g.useMemo(()=>M!==Ae.highlightEnable&&Ye({highlightEnable:M}),[M]),g.useMemo(()=>Le!==Ae.autoFocus&&Ye({autoFocus:Le}),[Le]),g.useMemo(()=>Ue!==Ae.autoFocusEnd&&Ye({autoFocusEnd:Ue}),[Ue]),g.useMemo(()=>V!==Ae.fullscreen&&Ye({fullscreen:V}),[V]),g.useMemo(()=>R!==Ae.height&&Ye({height:R}),[R]),g.useMemo(()=>R!==Ae.height&&pt&&pt(Ae.height,R,Ae),[R,pt,Ae]),g.useMemo(()=>E!==Ae.commands&&Ye({commands:zt}),[o.commands]),g.useMemo(()=>T!==Ae.extraCommands&&Ye({extraCommands:nn}),[o.extraCommands]);var je=g.useRef(),Ze=g.useRef("preview"),_t=g.useRef(!1);g.useMemo(()=>{je.current=Ae.textareaWarp,Ae.textareaWarp&&(Ae.textareaWarp.addEventListener("mouseover",()=>{Ze.current="text"}),Ae.textareaWarp.addEventListener("mouseleave",()=>{Ze.current="preview"}))},[Ae.textareaWarp]);var St=(U,Te)=>{if(ye.current){var Ne=je.current,ze=te.current?te.current:void 0;if(_t.current||(Ze.current=Te,_t.current=!0),Ne&&ze){var Xe=(Ne.scrollHeight-Ne.offsetHeight)/(ze.scrollHeight-ze.offsetHeight);U.target===Ne&&Ze.current==="text"&&(ze.scrollTop=Ne.scrollTop/Xe),U.target===ze&&Ze.current==="preview"&&(Ne.scrollTop=ze.scrollTop*Xe);var Ve=0;Ze.current==="text"?Ve=Ne.scrollTop||0:Ze.current==="preview"&&(Ve=ze.scrollTop||0),Ye({scrollTop:Ve})}}},Et=d+"-preview "+(ue.className||""),Nt=U=>St(U,"preview"),J=g.useMemo(()=>c.jsx("div",{ref:te,className:Et,children:c.jsx(r,at({},ue,{onScroll:Nt,source:Ae.markdown||""}))}),[Et,ue,Ae.markdown]),be=ft?.preview&&ft?.preview(Ae.markdown||"",Ae,Ye);be&&We.isValidElement(be)&&(J=c.jsx("div",{className:Et,ref:te,onScroll:Nt,children:be}));var Fe=at({},wt.style,{height:Ae.height||"100%"}),Re=()=>Ye({barPopup:at({},qM(Ae.barPopup))}),Tt=U=>Ye({height:U}),Wt=U=>{if(ge&&ge(U.target.value,U,Ae),k&&k.onChange&&k.onChange(U),Ae.textarea&&Ae.textarea instanceof HTMLTextAreaElement&&Pe){var Te=new Og(Ae.textarea),Ne=Te.getState()||{};Pe(at({},Ne,{lineCount:U.target.value.split(`
91
+ `).length,length:U.target.value.length}))}};return c.jsx(Sa.Provider,{value:at({},Ae,{dispatch:Ye}),children:c.jsxs("div",at({ref:q,className:we},wt,{onClick:Re,style:Fe,children:[c.jsx(C0,{hideToolbar:de,toolbarBottom:Ot,prefixCls:d,overflow:X,placement:"top"}),c.jsxs("div",{className:d+"-content",children:[/(edit|live)/.test(Ae.preview||"")&&c.jsx(a,at({className:d+"-input",prefixCls:d,autoFocus:Le},k,{onChange:Wt,renderTextarea:ft?.textarea||kt,onScroll:U=>St(U,"text")})),/(live|preview)/.test(Ae.preview||"")&&J]}),F&&!Ae.fullscreen&&c.jsx(WM,{prefixCls:d,height:Ae.height,maxHeight:le,minHeight:ke,onChange:Tt}),c.jsx(C0,{hideToolbar:de,toolbarBottom:Ot,prefixCls:d,overflow:X,placement:"bottom"})]}))})}),s=i;return s.Markdown=t,s.displayName="MDEditor",s}const Ko=YM({MarkdownPreview:M6,TextArea:HM}),ZM={neutral:"badge-neutral",primary:"badge-primary",secondary:"badge-secondary",accent:"badge-accent",ghost:"badge-ghost",info:"badge-info",success:"badge-success",warning:"badge-warning",error:"badge-error",outline:"badge-outline"},KM={xs:"badge-xs",sm:"badge-sm",md:"badge-md",lg:"badge-lg"};function st({variant:e,size:t,className:n,...r}){const a=["badge",e&&ZM[e],t&&KM[t],n].filter(Boolean).join(" ");return c.jsx("span",{className:a,...r})}const XM={primary:"btn-primary",ghost:"btn-ghost",error:"btn-error",outline:"btn-outline",accent:"btn-accent",warning:"btn-warning"},QM={xs:"btn-xs",sm:"btn-sm",md:"btn-md",lg:"btn-lg"};function He({variant:e,size:t,loading:n,asChild:r,className:a,disabled:i,children:s,...o}){const u=["btn",e&&XM[e],t&&QM[t],a].filter(Boolean).join(" ");if(r&&We.isValidElement(s)){const l=s,p=[u,l.props.className].filter(Boolean).join(" ");return We.cloneElement(l,{className:p})}return c.jsxs("button",{className:u,disabled:i||n,...o,children:[n&&c.jsx("span",{className:"loading loading-spinner"}),s]})}const JM={bordered:"card-bordered",primary:"card-primary",secondary:"card-secondary",accent:"card-accent",neutral:"card-neutral",imagefull:"card-image-full",compact:"card-compact",normal:"card-normal",side:"card-side"};function mi({variant:e,asChild:t,className:n,children:r,...a}){const i=["card",e&&JM[e],n].filter(Boolean).join(" ");if(t&&We.isValidElement(r)){const s=r,o=[i,s.props.className].filter(Boolean).join(" ");return We.cloneElement(s,{className:o})}return c.jsx("div",{className:i,...a,children:r})}function hi({className:e,...t}){const n=["card-body",e].filter(Boolean).join(" ");return c.jsx("div",{className:n,...t})}const eP={primary:"checkbox-primary",secondary:"checkbox-secondary",accent:"checkbox-accent",neutral:"checkbox-neutral",success:"checkbox-success",warning:"checkbox-warning",error:"checkbox-error",info:"checkbox-info"},tP={xs:"checkbox-xs",sm:"checkbox-sm",md:"checkbox-md",lg:"checkbox-lg"};function Lg({variant:e,size:t,className:n,...r}){const a=["checkbox",e&&eP[e],t&&tP[t],n].filter(Boolean).join(" ");return c.jsx("input",{type:"checkbox",className:a,...r})}const nP={bordered:"input-bordered",ghost:"input-ghost",primary:"input-primary",secondary:"input-secondary",accent:"input-accent",info:"input-info",success:"input-success",warning:"input-warning",error:"input-error"},rP={xs:"input-xs",sm:"input-sm",md:"input-md",lg:"input-lg",xl:"input-xl"};function gs({variant:e,size:t,error:n,className:r,...a}){const i=["input",e&&nP[e],t&&rP[t],n&&"input-error",r].filter(Boolean).join(" ");return c.jsx("input",{className:i,...a})}const aP={spinner:"loading-spinner",dots:"loading-dots",ring:"loading-ring",ball:"loading-ball",bars:"loading-bars",infinity:"loading-infinity"},iP={xs:"loading-xs",sm:"loading-sm",md:"loading-md",lg:"loading-lg",xl:"loading-xl"};function Tr({variant:e="spinner",size:t,className:n,...r}){const a=["loading",aP[e],t&&iP[t],n].filter(Boolean).join(" ");return c.jsx("span",{className:a,...r})}const sP={primary:"modal-primary",secondary:"modal-secondary",accent:"modal-accent",neutral:"modal-neutral",success:"modal-success",warning:"modal-warning",error:"modal-error",info:"modal-info"};function Xo({variant:e,open:t,onClose:n,className:r,children:a,...i}){if(!t)return null;const s=["modal-box",e&&sP[e],r].filter(Boolean).join(" ");return c.jsx("div",{className:"modal modal-open",role:"dialog","aria-modal":"true",tabIndex:-1,onClick:o=>{o.target===o.currentTarget&&n?.()},onKeyDown:o=>{o.key==="Escape"&&n?.()},...i,children:c.jsx("div",{className:s,children:a})})}const oP={bordered:"select-bordered",ghost:"select-ghost",primary:"select-primary",secondary:"select-secondary",accent:"select-accent",info:"select-info",success:"select-success",warning:"select-warning",error:"select-error"},uP={xs:"select-xs",sm:"select-sm",md:"select-md",lg:"select-lg"};function Zr({variant:e,size:t,className:n,children:r,...a}){const i=["select",e&&oP[e],t&&uP[t],n].filter(Boolean).join(" ");return c.jsx("select",{className:i,...a,children:r})}const lP={top:"tooltip-top",bottom:"tooltip-bottom",left:"tooltip-left",right:"tooltip-right"};function cP({position:e,tip:t,className:n,...r}){const a=["tooltip",e&&lP[e],n].filter(Boolean).join(" ");return c.jsx("span",{className:a,"data-tip":t,...r})}const p1="spur-board-layout",Ia={sidebarWidth:240,rightPanelWidth:320,sidebarCollapsed:!1,rightPanelCollapsed:!0};function dP(){try{const e=localStorage.getItem(p1);if(!e)return{...Ia};const t=JSON.parse(e);return{sidebarWidth:typeof t.sidebarWidth=="number"?t.sidebarWidth:Ia.sidebarWidth,rightPanelWidth:typeof t.rightPanelWidth=="number"?t.rightPanelWidth:Ia.rightPanelWidth,sidebarCollapsed:typeof t.sidebarCollapsed=="boolean"?t.sidebarCollapsed:Ia.sidebarCollapsed,rightPanelCollapsed:typeof t.rightPanelCollapsed=="boolean"?t.rightPanelCollapsed:Ia.rightPanelCollapsed}}catch{return{...Ia}}}function pP(e){try{localStorage.setItem(p1,JSON.stringify(e))}catch{}}const fP=[];function mP(e){return e[0]??{}}function Qo(e){return Array.isArray(e)?e:e==null?[]:[e]}const I0="orpc",hP="@orpc/shared",gP="1.14.4";class bP extends Error{constructor(...t){super(...t),this.name="AbortError"}}function EP(e){let t;return()=>{if(t)return t.result;const n=e();return t={result:n},n}}function yP(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}const xP=2,TP=`__${hP}@${gP}/otel/config__`;function nl(){return globalThis[TP]}function Fg(e,t={},n){return nl()?.tracer?.startSpan(e,t,n)}function ca(e,t,n={}){if(!e)return;const r=SP(t);e.recordException(r),(!n.signal?.aborted||n.signal.reason!==t)&&e.setStatus({code:xP,message:r.message})}function SP(e){if(e instanceof Error){const t={message:e.message,name:e.name,stack:e.stack};return"code"in e&&(typeof e.code=="string"||typeof e.code=="number")&&(t.code=e.code),t}return{message:String(e)}}async function $i({name:e,context:t,...n},r){const a=nl()?.tracer;if(!a)return r();const i=async s=>{try{return await r(s)}catch(o){throw ca(s,o,n),o}finally{s.end()}};return t?a.startActiveSpan(e,n,t,i):a.startActiveSpan(e,n,i)}async function Ka(e,t){const n=nl();if(!e||!n)return t();const r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function bs(e){return!e||typeof e!="object"?!1:"next"in e&&typeof e.next=="function"&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}const AP=Symbol.for("asyncDispose"),vP=Symbol.asyncDispose??AP;class Mg{#e=!1;#t=!1;#n;#r;constructor(t,n){this.#n=n,this.#r=yP(async()=>{if(this.#e)return{done:!0,value:void 0};try{const r=await t();return r.done&&(this.#e=!0),r}catch(r){throw this.#e=!0,r}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n("next"))}})}next(){return this.#r()}async return(t){return this.#e=!0,this.#t||(this.#t=!0,await this.#n("return")),{done:!0,value:t}}async throw(t){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n("throw")),t}async[vP](){this.#e=!0,this.#t||(this.#t=!0,await this.#n("dispose"))}[Symbol.asyncIterator](){return this}}function k0({name:e,...t},n){let r;return new Mg(async()=>{r??=Fg(e);try{const a=await Ka(r,()=>n.next());return r?.addEvent(a.done?"completed":"yielded"),a}catch(a){throw ca(r,a,t),a}},async a=>{try{a!=="next"&&await Ka(r,()=>n.return?.())}catch(i){throw ca(r,i,t),i}finally{r?.end()}})}function wP(e){return async(t,...n)=>{try{return await t.next()}catch(r){throw await e(r,t,...n),r}}}function Zc(e,t,n){const r=(a,i)=>{const s=e[i];return s?s({...a,next:(o=a)=>r(o,i+1)}):n(a)};return r(t,0)}function Lo(e){if(e)return JSON.parse(e)}function Kc(e){return JSON.stringify(e)}function _P(e){return da(e)?Object.getPrototypeOf(e)?.constructor:null}function Yr(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function da(e){return!!e&&(typeof e=="object"||typeof e=="function")}function R0(e,t){let n=e;for(const r of t){if(!da(n))return;n=n[r]}return n}const f1=(()=>{const e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function D0(e,...t){return typeof e=="function"?e(...t):e}function m1(e){return new Proxy(e,{get(t,n,r){const a=Reflect.get(t,n,r);return n!=="then"||typeof a!="function"?a:new Proxy(a,{apply(i,s,o){if(o.length!==2||o.some(l=>!CP(l)))return Reflect.apply(i,s,o);let u=!0;o[0].call(s,m1(new Proxy(t,{get:(l,p,d)=>{if(u&&p==="then"){u=!1;return}return Reflect.get(l,p,d)}})))}})}})}const NP=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;function CP(e){return typeof e=="function"&&NP.test(e.toString())}function IP(e){try{return decodeURIComponent(e)}catch{return e}}const kP="@orpc/client",RP="1.14.4",Pg={BAD_REQUEST:{status:400,message:"Bad Request"},UNAUTHORIZED:{status:401,message:"Unauthorized"},FORBIDDEN:{status:403,message:"Forbidden"},NOT_FOUND:{status:404,message:"Not Found"},METHOD_NOT_SUPPORTED:{status:405,message:"Method Not Supported"},NOT_ACCEPTABLE:{status:406,message:"Not Acceptable"},TIMEOUT:{status:408,message:"Request Timeout"},CONFLICT:{status:409,message:"Conflict"},PRECONDITION_FAILED:{status:412,message:"Precondition Failed"},PAYLOAD_TOO_LARGE:{status:413,message:"Payload Too Large"},UNSUPPORTED_MEDIA_TYPE:{status:415,message:"Unsupported Media Type"},UNPROCESSABLE_CONTENT:{status:422,message:"Unprocessable Content"},TOO_MANY_REQUESTS:{status:429,message:"Too Many Requests"},CLIENT_CLOSED_REQUEST:{status:499,message:"Client Closed Request"},INTERNAL_SERVER_ERROR:{status:500,message:"Internal Server Error"},NOT_IMPLEMENTED:{status:501,message:"Not Implemented"},BAD_GATEWAY:{status:502,message:"Bad Gateway"},SERVICE_UNAVAILABLE:{status:503,message:"Service Unavailable"},GATEWAY_TIMEOUT:{status:504,message:"Gateway Timeout"}};function DP(e,t){return t??Pg[e]?.status??500}function OP(e,t){return t||Pg[e]?.message||e}const h1=Symbol.for(`__${kP}@${RP}/error/ORPC_ERROR_CONSTRUCTORS__`);globalThis[h1]??=new WeakSet;const Xc=globalThis[h1];class Es extends Error{defined;code;status;data;constructor(t,...n){const r=mP(n);if(r.status!==void 0&&!ys(r.status))throw new Error("[ORPCError] Invalid error status code.");const a=OP(t,r.message);super(a,r),this.code=t,this.status=DP(t,r.status),this.defined=r.defined??!1,this.data=r.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](t){if(Xc.has(this)){const n=_P(t);if(n&&Xc.has(n))return!0}return super[Symbol.hasInstance](t)}}Xc.add(Es);function LP(e){return e instanceof Es?e:new Es("INTERNAL_SERVER_ERROR",{message:"Internal server error",cause:e})}function ys(e){return e<200||e>=400}function g1(e){if(!Yr(e))return!1;const t=["defined","code","status","message","data"];return Object.keys(e).some(n=>!t.includes(n))?!1:"defined"in e&&typeof e.defined=="boolean"&&"code"in e&&typeof e.code=="string"&&"status"in e&&typeof e.status=="number"&&ys(e.status)&&"message"in e&&typeof e.message=="string"}function b1(e,t={}){return new Es(e.code,{...t,...e})}class rl extends TypeError{}class FP extends TypeError{}class xs extends Error{data;constructor(t){super(t?.message??"An error event was received",t),this.data=t?.data}}function MP(e){const t=e.replace(/\n+$/,"").split(/\n/),n={data:void 0,event:void 0,id:void 0,retry:void 0,comments:[]};for(const r of t){const a=r.indexOf(":"),i=a===-1?r:r.slice(0,a),s=a===-1?"":r.slice(a+1).replace(/^\s/,"");if(a===0)n.comments.push(s);else if(i==="data")n.data??="",n.data+=`${s}
92
92
  `;else if(i==="event")n.event=s;else if(i==="id")n.id=s;else if(i==="retry"){const o=Number.parseInt(s);Number.isInteger(o)&&o>=0&&o.toString()===s&&(n.retry=o)}}return n.data=n.data?.replace(/\n$/,""),n}class PP{constructor(t={}){this.options=t}incomplete="";feed(t){this.incomplete+=t;const n=this.incomplete.lastIndexOf(`
93
93
 
94
94
  `);if(n===-1)return;const r=this.incomplete.slice(0,n).split(/\n\n/);this.incomplete=this.incomplete.slice(n+2);for(const a of r){const i=MP(`${a}
@@ -165,15 +165,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
165
165
 
166
166
  `)}m.write("payload.value = newResult;"),m.write("return payload;");const w=m.compile();return(T,I)=>w(f,T,I)};let i;const s=eu,o=!Ug.jitless,l=o&&d5.value,p=t.catchall;let d;e._zod.parse=(f,m)=>{d??(d=r.value);const b=f.value;return s(b)?o&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=a(t.shape)),f=i(f,m),p?G1([],b,f,m,d,e):f):n(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),f)}});function $0(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const a=e.filter(i=>!Pa(i));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>Ir(s,r,Cr())))}),t)}const JB=Q("$ZodUnion",(e,t)=>{Ut.init(e,t),vt(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),vt(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),vt(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),vt(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${r.map(a=>zg(a.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,a)=>{if(n)return n(r,a);let i=!1;const s=[];for(const o of t.options){const u=o._zod.run({value:r.value,issues:[]},a);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}return i?Promise.all(s).then(o=>$0(o,r,e,a)):$0(s,r,e,a)}}),e8=Q("$ZodIntersection",(e,t)=>{Ut.init(e,t),e._zod.parse=(n,r)=>{const a=n.value,i=t.left._zod.run({value:a,issues:[]},r),s=t.right._zod.run({value:a,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,l])=>z0(n,u,l)):z0(n,i,s)}});function ed(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Xa(e)&&Xa(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),a={...e,...t};for(const i of r){const s=ed(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};a[i]=s.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const a=e[r],i=t[r],s=ed(a,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function z0(e,t,n){const r=new Map;let a;for(const o of t.issues)if(o.code==="unrecognized_keys"){a??(a=o);for(const u of o.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(o);for(const o of n.issues)if(o.code==="unrecognized_keys")for(const u of o.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(o);const i=[...r].filter(([,o])=>o.l&&o.r).map(([o])=>o);if(i.length&&a&&e.issues.push({...a,keys:i}),Pa(e))return e;const s=ed(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const t8=Q("$ZodRecord",(e,t)=>{Ut.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Xa(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const o=new Set;for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){o.add(typeof l=="number"?l.toString():l);const p=t.keyType._zod.run({value:l,issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(m=>Ir(m,r,Cr())),input:l,path:[l],inst:e});continue}const d=p.value,f=t.valueType._zod.run({value:a[l],issues:[]},r);f instanceof Promise?i.push(f.then(m=>{m.issues.length&&n.issues.push(...Ba(l,m.issues)),n.value[d]=m.value})):(f.issues.length&&n.issues.push(...Ba(l,f.issues)),n.value[d]=f.value)}let u;for(const l in a)o.has(l)||(u=u??[],u.push(l));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:u})}else{n.value={};for(const o of Reflect.ownKeys(a)){if(o==="__proto__"||!Object.prototype.propertyIsEnumerable.call(a,o))continue;let u=t.keyType._zod.run({value:o,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof o=="string"&&P1.test(o)&&u.issues.length){const d=t.keyType._zod.run({value:Number(o),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(u=d)}if(u.issues.length){t.mode==="loose"?n.value[o]=a[o]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>Ir(d,r,Cr())),input:o,path:[o],inst:e});continue}const p=t.valueType._zod.run({value:a[o],issues:[]},r);p instanceof Promise?i.push(p.then(d=>{d.issues.length&&n.issues.push(...Ba(o,d.issues)),n.value[u.value]=d.value})):(p.issues.length&&n.issues.push(...Ba(o,p.issues)),n.value[u.value]=p.value)}}return i.length?Promise.all(i).then(()=>n):n}}),n8=Q("$ZodEnum",(e,t)=>{Ut.init(e,t);const n=C1(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(a=>p5.has(typeof a)).map(a=>typeof a=="string"?Qa(a):a.toString()).join("|")})$`),e._zod.parse=(a,i)=>{const s=a.value;return r.has(s)||a.issues.push({code:"invalid_value",values:n,input:s,inst:e}),a}}),r8=Q("$ZodLiteral",(e,t)=>{if(Ut.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Qa(r):r?Qa(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,a)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),a8=Q("$ZodTransform",(e,t)=>{Ut.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new N1(e.constructor.name);const a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(s=>(n.value=s,n.fallback=!0,n));if(a instanceof Promise)throw new Wa;return n.value=a,n.fallback=!0,n}});function H0(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const W1=Q("$ZodOptional",(e,t)=>{Ut.init(e,t),e._zod.optin="optional",e._zod.optout="optional",vt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),vt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${zg(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const a=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>H0(s,a)):H0(i,a)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),i8=Q("$ZodExactOptional",(e,t)=>{W1.init(e,t),vt(e._zod,"values",()=>t.innerType._zod.values),vt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),s8=Q("$ZodNullable",(e,t)=>{Ut.init(e,t),vt(e._zod,"optin",()=>t.innerType._zod.optin),vt(e._zod,"optout",()=>t.innerType._zod.optout),vt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${zg(n.source)}|null)$`):void 0}),vt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),o8=Q("$ZodDefault",(e,t)=>{Ut.init(e,t),e._zod.optin="optional",vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>G0(i,t)):G0(a,t)}});function G0(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const u8=Q("$ZodPrefault",(e,t)=>{Ut.init(e,t),e._zod.optin="optional",vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),l8=Q("$ZodNonOptional",(e,t)=>{Ut.init(e,t),vt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>W0(i,e)):W0(a,e)}});function W0(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const c8=Q("$ZodCatch",(e,t)=>{Ut.init(e,t),e._zod.optin="optional",vt(e._zod,"optout",()=>t.innerType._zod.optout),vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>Ir(s,r,Cr()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(i=>Ir(i,r,Cr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),V1=Q("$ZodPipe",(e,t)=>{Ut.init(e,t),vt(e._zod,"values",()=>t.in._zod.values),vt(e._zod,"optin",()=>t.in._zod.optin),vt(e._zod,"optout",()=>t.out._zod.optout),vt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>go(s,t.in,r)):go(i,t.in,r)}const a=t.in._zod.run(n,r);return a instanceof Promise?a.then(i=>go(i,t.out,r)):go(a,t.out,r)}});function go(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const d8=Q("$ZodPreprocess",(e,t)=>{V1.init(e,t)}),p8=Q("$ZodReadonly",(e,t)=>{Ut.init(e,t),vt(e._zod,"propValues",()=>t.innerType._zod.propValues),vt(e._zod,"values",()=>t.innerType._zod.values),vt(e._zod,"optin",()=>t.innerType?._zod?.optin),vt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(V0):V0(a)}});function V0(e){return e.value=Object.freeze(e.value),e}const f8=Q("$ZodCustom",(e,t)=>{Un.init(e,t),Ut.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(i=>q0(i,n,r,e));q0(a,n,r,e)}});function q0(e,t,n,r){if(!e){const a={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(a.params=r._zod.def.params),t.issues.push(Ts(a))}}var Y0;class m8{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const a={...r,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function h8(){return new m8}(Y0=globalThis).__zod_globalRegistry??(Y0.__zod_globalRegistry=h8());const zi=globalThis.__zod_globalRegistry;function g8(e,t){return new e({type:"string",...Oe(t)})}function b8(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Oe(t)})}function Z0(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Oe(t)})}function E8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Oe(t)})}function y8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Oe(t)})}function x8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Oe(t)})}function T8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Oe(t)})}function S8(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Oe(t)})}function A8(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Oe(t)})}function v8(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Oe(t)})}function w8(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Oe(t)})}function _8(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Oe(t)})}function N8(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Oe(t)})}function C8(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Oe(t)})}function I8(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Oe(t)})}function k8(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Oe(t)})}function R8(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Oe(t)})}function D8(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Oe(t)})}function O8(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Oe(t)})}function L8(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Oe(t)})}function F8(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Oe(t)})}function M8(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Oe(t)})}function P8(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Oe(t)})}function B8(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Oe(t)})}function U8(e,t){return new e({type:"string",format:"date",check:"string_format",...Oe(t)})}function j8(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Oe(t)})}function $8(e,t){return new e({type:"string",format:"duration",check:"string_format",...Oe(t)})}function z8(e,t){return new e({type:"number",checks:[],...Oe(t)})}function H8(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Oe(t)})}function G8(e,t){return new e({type:"boolean",...Oe(t)})}function W8(e){return new e({type:"unknown"})}function V8(e,t){return new e({type:"never",...Oe(t)})}function K0(e,t){return new U1({check:"less_than",...Oe(t),value:e,inclusive:!1})}function Jl(e,t){return new U1({check:"less_than",...Oe(t),value:e,inclusive:!0})}function X0(e,t){return new j1({check:"greater_than",...Oe(t),value:e,inclusive:!1})}function ec(e,t){return new j1({check:"greater_than",...Oe(t),value:e,inclusive:!0})}function Q0(e,t){return new oB({check:"multiple_of",...Oe(t),value:e})}function q1(e,t){return new lB({check:"max_length",...Oe(t),maximum:e})}function nu(e,t){return new cB({check:"min_length",...Oe(t),minimum:e})}function Y1(e,t){return new dB({check:"length_equals",...Oe(t),length:e})}function q8(e,t){return new pB({check:"string_format",format:"regex",...Oe(t),pattern:e})}function Y8(e){return new fB({check:"string_format",format:"lowercase",...Oe(e)})}function Z8(e){return new mB({check:"string_format",format:"uppercase",...Oe(e)})}function K8(e,t){return new hB({check:"string_format",format:"includes",...Oe(t),includes:e})}function X8(e,t){return new gB({check:"string_format",format:"starts_with",...Oe(t),prefix:e})}function Q8(e,t){return new bB({check:"string_format",format:"ends_with",...Oe(t),suffix:e})}function gi(e){return new EB({check:"overwrite",tx:e})}function J8(e){return gi(t=>t.normalize(e))}function eU(){return gi(e=>e.trim())}function tU(){return gi(e=>e.toLowerCase())}function nU(){return gi(e=>e.toUpperCase())}function rU(){return gi(e=>c5(e))}function aU(e,t,n){return new e({type:"array",element:t,...Oe(n)})}function iU(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Oe(n)})}function sU(e,t){const n=oU(r=>(r.addIssue=a=>{if(typeof a=="string")r.issues.push(Ts(a,r.value,n._zod.def));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Ts(i))}},e(r.value,r)),t);return n}function oU(e,t){const n=new Un({check:"custom",...Oe(t)});return n._zod.check=e,n}function Z1(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??zi,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Xt(e,t,n={path:[],schemaPath:[]}){var r;const a=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const o=e._zod.toJSONSchema?.();if(o)s.schema=o;else{const p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{const f=s.schema,m=t.processors[a.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);m(e,t,f,p)}const d=e._zod.parent;d&&(s.ref||(s.ref=d),Xt(d,t,p),t.seen.get(d).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&Nn(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function K1(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const o=e.metadataRegistry.get(s[0])?.id;if(o){const u=r.get(o);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${o}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(o,s[0])}}const a=s=>{const o=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(s[0])?.id,f=e.external.uri??(b=>b);if(d)return{ref:f(d)};const m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${f("__shared")}#/${o}/${m}`}}if(s[1]===n)return{ref:"#"};const l=`#/${o}/`,p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:l+p}},i=s=>{if(s[1].schema.$ref)return;const o=s[1],{ref:u,defId:l}=a(s);o.def={...o.schema},l&&(o.defId=l);const p=o.schema;for(const d in p)delete p[d];p.$ref=u};if(e.cycles==="throw")for(const s of e.seen.entries()){const o=s[1];if(o.cycle)throw new Error(`Cycle detected: #/${o.cycle?.join("/")}/<root>
167
167
 
168
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const o=s[1];if(t===s[0]){i(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(o.cycle){i(s);continue}if(o.count>1&&e.reused==="ref"){i(s);continue}}}function X1(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=o=>{const u=e.seen.get(o);if(u.ref===null)return;const l=u.def??u.schema,p={...l},d=u.ref;if(u.ref=null,d){r(d);const m=e.seen.get(d),b=m.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(b)):Object.assign(l,b),Object.assign(l,p),o._zod.parent===d)for(const y in l)y==="$ref"||y==="allOf"||y in p||delete l[y];if(b.$ref&&m.def)for(const y in l)y==="$ref"||y==="allOf"||y in m.def&&JSON.stringify(l[y])===JSON.stringify(m.def[y])&&delete l[y]}const f=o._zod.parent;if(f&&f!==d){r(f);const m=e.seen.get(f);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(const b in l)b==="$ref"||b==="allOf"||b in m.def&&JSON.stringify(l[b])===JSON.stringify(m.def[b])&&delete l[b]}e.override({zodSchema:o,jsonSchema:l,path:u.path??[]})};for(const o of[...e.seen.entries()].reverse())r(o[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const o=e.external.registry.get(t)?.id;if(!o)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(o)}Object.assign(a,n.def??n.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&a.id===i&&delete a.id;const s=e.external?.defs??{};for(const o of e.seen.entries()){const u=o[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,s[u.defId]=u.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?a.$defs=s:a.definitions=s);try{const o=JSON.parse(JSON.stringify(a));return Object.defineProperty(o,"~standard",{value:{...t["~standard"],jsonSchema:{input:ru(t,"input",e.processors),output:ru(t,"output",e.processors)}},enumerable:!1,writable:!1}),o}catch{throw new Error("Error converting schema to JSON.")}}function Nn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Nn(r.element,n);if(r.type==="set")return Nn(r.valueType,n);if(r.type==="lazy")return Nn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Nn(r.innerType,n);if(r.type==="intersection")return Nn(r.left,n)||Nn(r.right,n);if(r.type==="record"||r.type==="map")return Nn(r.keyType,n)||Nn(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Nn(r.in,n)||Nn(r.out,n);if(r.type==="object"){for(const a in r.shape)if(Nn(r.shape[a],n))return!0;return!1}if(r.type==="union"){for(const a of r.options)if(Nn(a,n))return!0;return!1}if(r.type==="tuple"){for(const a of r.items)if(Nn(a,n))return!0;return!!(r.rest&&Nn(r.rest,n))}return!1}const uU=(e,t={})=>n=>{const r=Z1({...n,processors:t});return Xt(e,r),K1(r,e),X1(r,e)},ru=(e,t,n={})=>r=>{const{libraryOptions:a,target:i}=r??{},s=Z1({...a??{},target:i,io:t,processors:n});return Xt(e,s),K1(s,e),X1(s,e)},lU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},cU=(e,t,n,r)=>{const a=n;a.type="string";const{minimum:i,maximum:s,format:o,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(a.minLength=i),typeof s=="number"&&(a.maxLength=s),o&&(a.format=lU[o]??o,a.format===""&&delete a.format,o==="time"&&delete a.format),l&&(a.contentEncoding=l),u&&u.size>0){const p=[...u];p.length===1?a.pattern=p[0].source:p.length>1&&(a.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},dU=(e,t,n,r)=>{const a=n,{minimum:i,maximum:s,format:o,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:p}=e._zod.bag;typeof o=="string"&&o.includes("int")?a.type="integer":a.type="number";const d=typeof p=="number"&&p>=(i??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(a.minimum=p,a.exclusiveMinimum=!0):a.exclusiveMinimum=p:typeof i=="number"&&(a.minimum=i),f?m?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:typeof s=="number"&&(a.maximum=s),typeof u=="number"&&(a.multipleOf=u)},pU=(e,t,n,r)=>{n.type="boolean"},fU=(e,t,n,r)=>{n.not={}},mU=(e,t,n,r)=>{},hU=(e,t,n,r)=>{const a=e._zod.def,i=C1(a.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},gU=(e,t,n,r)=>{const a=e._zod.def,i=[];for(const s of a.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},bU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},EU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},yU=(e,t,n,r)=>{const a=n,i=e._zod.def,{minimum:s,maximum:o}=e._zod.bag;typeof s=="number"&&(a.minItems=s),typeof o=="number"&&(a.maxItems=o),a.type="array",a.items=Xt(i.element,t,{...r,path:[...r.path,"items"]})},xU=(e,t,n,r)=>{const a=n,i=e._zod.def;a.type="object",a.properties={};const s=i.shape;for(const l in s)a.properties[l]=Xt(s[l],t,{...r,path:[...r.path,"properties",l]});const o=new Set(Object.keys(s)),u=new Set([...o].filter(l=>{const p=i.shape[l]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));u.size>0&&(a.required=Array.from(u)),i.catchall?._zod.def.type==="never"?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=Xt(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},TU=(e,t,n,r)=>{const a=e._zod.def,i=a.inclusive===!1,s=a.options.map((o,u)=>Xt(o,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},SU=(e,t,n,r)=>{const a=e._zod.def,i=Xt(a.left,t,{...r,path:[...r.path,"allOf",0]}),s=Xt(a.right,t,{...r,path:[...r.path,"allOf",1]}),o=l=>"allOf"in l&&Object.keys(l).length===1,u=[...o(i)?i.allOf:[i],...o(s)?s.allOf:[s]];n.allOf=u},AU=(e,t,n,r)=>{const a=n,i=e._zod.def;a.type="object";const s=i.keyType,u=s._zod.bag?.patterns;if(i.mode==="loose"&&u&&u.size>0){const p=Xt(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});a.patternProperties={};for(const d of u)a.patternProperties[d.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(a.propertyNames=Xt(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),a.additionalProperties=Xt(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const l=s._zod.values;if(l){const p=[...l].filter(d=>typeof d=="string"||typeof d=="number");p.length>0&&(a.required=p)}},vU=(e,t,n,r)=>{const a=e._zod.def,i=Xt(a.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=a.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},wU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType},_U=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},NU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},CU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType;let s;try{s=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},IU=(e,t,n,r)=>{const a=e._zod.def,i=a.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?a.out:a.in:a.out;Xt(s,t,r);const o=t.seen.get(e);o.ref=s},kU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,n.readOnly=!0},Q1=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType},RU=Q("ZodISODateTime",(e,t)=>{DB.init(e,t),$t.init(e,t)});function DU(e){return B8(RU,e)}const OU=Q("ZodISODate",(e,t)=>{OB.init(e,t),$t.init(e,t)});function LU(e){return U8(OU,e)}const FU=Q("ZodISOTime",(e,t)=>{LB.init(e,t),$t.init(e,t)});function MU(e){return j8(FU,e)}const PU=Q("ZodISODuration",(e,t)=>{FB.init(e,t),$t.init(e,t)});function BU(e){return $8(PU,e)}const UU=(e,t)=>{D1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>v5(e,n)},flatten:{value:n=>A5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Jc,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Jc,2)}},isEmpty:{get(){return e.issues.length===0}}})},nr=Q("ZodError",UU,{Parent:Error}),jU=Gg(nr),$U=Wg(nr),zU=al(nr),HU=il(nr),GU=N5(nr),WU=C5(nr),VU=I5(nr),qU=k5(nr),YU=R5(nr),ZU=D5(nr),KU=O5(nr),XU=L5(nr),J0=new WeakMap;function Gs(e,t,n){const r=Object.getPrototypeOf(e);let a=J0.get(r);if(a||(a=new Set,J0.set(r,a)),!a.has(t)){a.add(t);for(const i in n){const s=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const o=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:o}),o},set(o){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:o})}})}}}const jt=Q("ZodType",(e,t)=>(Ut.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ru(e,"input"),output:ru(e,"output")}}),e.toJSONSchema=uU(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>jU(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>zU(e,n,r),e.parseAsync=async(n,r)=>$U(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>HU(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>GU(e,n,r),e.decode=(n,r)=>WU(e,n,r),e.encodeAsync=async(n,r)=>VU(e,n,r),e.decodeAsync=async(n,r)=>qU(e,n,r),e.safeEncode=(n,r)=>YU(e,n,r),e.safeDecode=(n,r)=>ZU(e,n,r),e.safeEncodeAsync=async(n,r)=>KU(e,n,r),e.safeDecodeAsync=async(n,r)=>XU(e,n,r),Gs(e,"ZodType",{check(...n){const r=this.def;return this.clone(Jr(r,{checks:[...r.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return ea(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(Hj(n,r))},superRefine(n,r){return this.check(Gj(n,r))},overwrite(n){return this.check(gi(n))},optional(){return ry(this)},exactOptional(){return kj(this)},nullable(){return ay(this)},nullish(){return ry(ay(this))},nonoptional(n){return Mj(this,n)},array(){return Jn(this)},or(n){return vj([this,n])},and(n){return _j(this,n)},transform(n){return iy(this,tA(n))},default(n){return Oj(this,n)},prefault(n){return Fj(this,n)},catch(n){return Bj(this,n)},pipe(n){return iy(this,n)},readonly(){return $j(this)},describe(n){const r=this.clone();return zi.add(r,{description:n}),r},meta(...n){if(n.length===0)return zi.get(this);const r=this.clone();return zi.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return zi.get(e)?.description},configurable:!0}),e)),J1=Q("_ZodString",(e,t)=>{Vg.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(r,a,i)=>cU(e,r,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Gs(e,"_ZodString",{regex(...r){return this.check(q8(...r))},includes(...r){return this.check(K8(...r))},startsWith(...r){return this.check(X8(...r))},endsWith(...r){return this.check(Q8(...r))},min(...r){return this.check(nu(...r))},max(...r){return this.check(q1(...r))},length(...r){return this.check(Y1(...r))},nonempty(...r){return this.check(nu(1,...r))},lowercase(r){return this.check(Y8(r))},uppercase(r){return this.check(Z8(r))},trim(){return this.check(eU())},normalize(...r){return this.check(J8(...r))},toLowerCase(){return this.check(tU())},toUpperCase(){return this.check(nU())},slugify(){return this.check(rU())}})}),QU=Q("ZodString",(e,t)=>{Vg.init(e,t),J1.init(e,t),e.email=n=>e.check(b8(JU,n)),e.url=n=>e.check(S8(ej,n)),e.jwt=n=>e.check(P8(hj,n)),e.emoji=n=>e.check(A8(tj,n)),e.guid=n=>e.check(Z0(ey,n)),e.uuid=n=>e.check(E8(bo,n)),e.uuidv4=n=>e.check(y8(bo,n)),e.uuidv6=n=>e.check(x8(bo,n)),e.uuidv7=n=>e.check(T8(bo,n)),e.nanoid=n=>e.check(v8(nj,n)),e.guid=n=>e.check(Z0(ey,n)),e.cuid=n=>e.check(w8(rj,n)),e.cuid2=n=>e.check(_8(aj,n)),e.ulid=n=>e.check(N8(ij,n)),e.base64=n=>e.check(L8(pj,n)),e.base64url=n=>e.check(F8(fj,n)),e.xid=n=>e.check(C8(sj,n)),e.ksuid=n=>e.check(I8(oj,n)),e.ipv4=n=>e.check(k8(uj,n)),e.ipv6=n=>e.check(R8(lj,n)),e.cidrv4=n=>e.check(D8(cj,n)),e.cidrv6=n=>e.check(O8(dj,n)),e.e164=n=>e.check(M8(mj,n)),e.datetime=n=>e.check(DU(n)),e.date=n=>e.check(LU(n)),e.time=n=>e.check(MU(n)),e.duration=n=>e.check(BU(n))});function oe(e){return g8(QU,e)}const $t=Q("ZodStringFormat",(e,t)=>{Mt.init(e,t),J1.init(e,t)}),JU=Q("ZodEmail",(e,t)=>{AB.init(e,t),$t.init(e,t)}),ey=Q("ZodGUID",(e,t)=>{TB.init(e,t),$t.init(e,t)}),bo=Q("ZodUUID",(e,t)=>{SB.init(e,t),$t.init(e,t)}),ej=Q("ZodURL",(e,t)=>{vB.init(e,t),$t.init(e,t)}),tj=Q("ZodEmoji",(e,t)=>{wB.init(e,t),$t.init(e,t)}),nj=Q("ZodNanoID",(e,t)=>{_B.init(e,t),$t.init(e,t)}),rj=Q("ZodCUID",(e,t)=>{NB.init(e,t),$t.init(e,t)}),aj=Q("ZodCUID2",(e,t)=>{CB.init(e,t),$t.init(e,t)}),ij=Q("ZodULID",(e,t)=>{IB.init(e,t),$t.init(e,t)}),sj=Q("ZodXID",(e,t)=>{kB.init(e,t),$t.init(e,t)}),oj=Q("ZodKSUID",(e,t)=>{RB.init(e,t),$t.init(e,t)}),uj=Q("ZodIPv4",(e,t)=>{MB.init(e,t),$t.init(e,t)}),lj=Q("ZodIPv6",(e,t)=>{PB.init(e,t),$t.init(e,t)}),cj=Q("ZodCIDRv4",(e,t)=>{BB.init(e,t),$t.init(e,t)}),dj=Q("ZodCIDRv6",(e,t)=>{UB.init(e,t),$t.init(e,t)}),pj=Q("ZodBase64",(e,t)=>{jB.init(e,t),$t.init(e,t)}),fj=Q("ZodBase64URL",(e,t)=>{zB.init(e,t),$t.init(e,t)}),mj=Q("ZodE164",(e,t)=>{HB.init(e,t),$t.init(e,t)}),hj=Q("ZodJWT",(e,t)=>{WB.init(e,t),$t.init(e,t)}),eA=Q("ZodNumber",(e,t)=>{z1.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(r,a,i)=>dU(e,r,a),Gs(e,"ZodNumber",{gt(r,a){return this.check(X0(r,a))},gte(r,a){return this.check(ec(r,a))},min(r,a){return this.check(ec(r,a))},lt(r,a){return this.check(K0(r,a))},lte(r,a){return this.check(Jl(r,a))},max(r,a){return this.check(Jl(r,a))},int(r){return this.check(ty(r))},safe(r){return this.check(ty(r))},positive(r){return this.check(X0(0,r))},nonnegative(r){return this.check(ec(0,r))},negative(r){return this.check(K0(0,r))},nonpositive(r){return this.check(Jl(0,r))},multipleOf(r,a){return this.check(Q0(r,a))},step(r,a){return this.check(Q0(r,a))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ol(e){return z8(eA,e)}const gj=Q("ZodNumberFormat",(e,t)=>{VB.init(e,t),eA.init(e,t)});function ty(e){return H8(gj,e)}const bj=Q("ZodBoolean",(e,t)=>{qB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>pU(e,n,r)});function pa(e){return G8(bj,e)}const Ej=Q("ZodUnknown",(e,t)=>{YB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>mU()});function Ja(){return W8(Ej)}const yj=Q("ZodNever",(e,t)=>{ZB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>fU(e,n,r)});function xj(e){return V8(yj,e)}const Tj=Q("ZodArray",(e,t)=>{KB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>yU(e,n,r,a),e.element=t.element,Gs(e,"ZodArray",{min(n,r){return this.check(nu(n,r))},nonempty(n){return this.check(nu(1,n))},max(n,r){return this.check(q1(n,r))},length(n,r){return this.check(Y1(n,r))},unwrap(){return this.element}})});function Jn(e,t){return aU(Tj,e,t)}const Sj=Q("ZodObject",(e,t)=>{QB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>xU(e,n,r,a),vt(e,"shape",()=>t.shape),Gs(e,"ZodObject",{keyof(){return Tt(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Ja()})},loose(){return this.clone({...this._zod.def,catchall:Ja()})},strict(){return this.clone({...this._zod.def,catchall:xj()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return b5(this,n)},safeExtend(n){return E5(this,n)},merge(n){return y5(this,n)},pick(n){return h5(this,n)},omit(n){return g5(this,n)},partial(...n){return x5(nA,this,n[0])},required(...n){return T5(rA,this,n[0])}})});function Ge(e,t){const n={type:"object",shape:e??{},...Oe(t)};return new Sj(n)}const Aj=Q("ZodUnion",(e,t)=>{JB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>TU(e,n,r,a),e.options=t.options});function vj(e,t){return new Aj({type:"union",options:e,...Oe(t)})}const wj=Q("ZodIntersection",(e,t)=>{e8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>SU(e,n,r,a)});function _j(e,t){return new wj({type:"intersection",left:e,right:t})}const ny=Q("ZodRecord",(e,t)=>{t8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>AU(e,n,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function qg(e,t,n){return!t||!t._zod?new ny({type:"record",keyType:oe(),valueType:e,...Oe(t)}):new ny({type:"record",keyType:e,valueType:t,...Oe(n)})}const td=Q("ZodEnum",(e,t)=>{n8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(r,a,i)=>hU(e,r,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new td({...t,checks:[],...Oe(a),entries:i})},e.exclude=(r,a)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new td({...t,checks:[],...Oe(a),entries:i})}});function Tt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new td({type:"enum",entries:n,...Oe(t)})}const Nj=Q("ZodLiteral",(e,t)=>{r8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>gU(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function kr(e,t){return new Nj({type:"literal",values:Array.isArray(e)?e:[e],...Oe(t)})}const Cj=Q("ZodTransform",(e,t)=>{a8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>EU(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new N1(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ts(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Ts(s))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function tA(e){return new Cj({type:"transform",transform:e})}const nA=Q("ZodOptional",(e,t)=>{W1.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Q1(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function ry(e){return new nA({type:"optional",innerType:e})}const Ij=Q("ZodExactOptional",(e,t)=>{i8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Q1(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function kj(e){return new Ij({type:"optional",innerType:e})}const Rj=Q("ZodNullable",(e,t)=>{s8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>vU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function ay(e){return new Rj({type:"nullable",innerType:e})}const Dj=Q("ZodDefault",(e,t)=>{o8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>_U(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Oj(e,t){return new Dj({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k1(t)}})}const Lj=Q("ZodPrefault",(e,t)=>{u8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>NU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function Fj(e,t){return new Lj({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k1(t)}})}const rA=Q("ZodNonOptional",(e,t)=>{l8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>wU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function Mj(e,t){return new rA({type:"nonoptional",innerType:e,...Oe(t)})}const Pj=Q("ZodCatch",(e,t)=>{c8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>CU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bj(e,t){return new Pj({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const aA=Q("ZodPipe",(e,t)=>{V1.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>IU(e,n,r,a),e.in=t.in,e.out=t.out});function iy(e,t){return new aA({type:"pipe",in:e,out:t})}const Uj=Q("ZodPreprocess",(e,t)=>{aA.init(e,t),d8.init(e,t)}),jj=Q("ZodReadonly",(e,t)=>{p8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>kU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function $j(e){return new jj({type:"readonly",innerType:e})}const zj=Q("ZodCustom",(e,t)=>{f8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>bU(e,n)});function Hj(e,t={}){return iU(zj,e,t)}function Gj(e,t){return sU(e,t)}function tc(e,t){return new Uj({type:"pipe",in:tA(e),out:t})}const va=["backlog","todo","wip","testing","blocked","done","cancelled"],bi=["backlog","active","verifying","blocked","done","cancelled"],Wj={backlog:"📋",todo:"🔲",wip:"🚧",testing:"🧪",blocked:"🚫",done:"✅",cancelled:"⛔"};function Yg(e){try{return Wj[sA(e)]??""}catch{return""}}const ul=["P0","P1","P2","P3"],Vj=["simple","standard","complex","research","refine","plan","unit","review","docs"],iA=["task","issue","review","meta","brainstorm"],ll=["standard","feature-impl","issue","review","meta","brainstorm"],Zg=/^[A-Z][1-9]*$/,qj={completed:"done",complete:"done","in-progress":"wip","in progress":"wip",in_progress:"wip",dropped:"cancelled",cancel:"cancelled",canceled:"cancelled",new:"backlog",pending:"backlog",blocked:"blocked",wip:"wip",testing:"testing",done:"done",cancelled:"cancelled",backlog:"backlog",todo:"todo"};function sA(e){const t=e.trim().toLowerCase(),n=qj[t];if(n===void 0)throw new Error(`Unknown task status: ${JSON.stringify(e)} (allowed: ${va.join(", ")})`);return n}const au=oe().min(1).refine(e=>!Number.isNaN(Date.parse(e)),{message:"must be an ISO 8601 timestamp"}),oA=oe().regex(Zg,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}).nullable().optional(),uA=oe().regex(/^\d{4}$/,{message:"parent_wbs must be a 4-digit WBS string"}).nullable().optional();Ge({schema_version:kr(1),name:oe().min(1),description:oe().optional(),status:tc(e=>{if(typeof e=="string")try{return sA(e)}catch{}return e},Tt(va)),type:Tt(iA).optional().default("task"),template:Tt(ll).optional(),profile:Tt(Vj).optional(),feature_id:oA,parent_wbs:uA,priority:Tt(ul).optional(),tags:Jn(oe()).optional(),dependencies:Jn(oe()).optional(),ac_numbering:kr("task-local").optional(),done_forced:tc(e=>typeof e=="string"?e==="true":e,pa().optional()),done_reason:oe().optional(),feature_link_declined:tc(e=>typeof e=="string"?e==="true":e,pa().optional()),created_at:au,updated_at:au});Ge({schema_version:kr(1),id:oe().regex(Zg,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),name:oe().min(1),status:Tt(bi),priority:Tt(ul).optional(),tags:Jn(oe()).optional(),created_at:au,updated_at:au});const Yj=Ge({name:oe().min(1,"name is required"),background:oe().optional(),requirements:oe().optional(),design:oe().optional(),plan:oe().optional(),acceptance_criteria:oe().optional(),feature_id:oA,parent_wbs:uA,priority:Tt(ul).optional(),tags:Jn(oe()).optional(),template:Tt(ll).optional()}).strict();Jn(Yj).min(1,"batch must contain at least one task");const Zj=["NOT_FOUND","VALIDATION_FAILED","GUARD_DENIED","LOCK_TIMEOUT","CONFLICT","INTERNAL_ERROR"];function Qt(e){return Ge({ok:kr(!0),data:e})}Ge({ok:kr(!1),error:Ge({code:Tt(Zj),message:oe(),details:Ja().optional()})});Ge({nextCursor:oe().optional(),hasMore:pa(),limit:ol().int().positive()});const Hn=oe().regex(Zg,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),Kj=Ge({id:Hn,name:oe().min(1),status:Tt(bi),priority:Tt(ul).optional(),parentId:Hn.nullable().optional(),wbsCount:ol().int().nonnegative().optional()}),Xj=Qt(Jn(Kj)),Qj=Qt(Ge({id:Hn,name:oe(),status:Tt(bi),frontmatter:qg(oe(),Ja()),content:oe(),filePath:oe()})),Jj=Ge({id:Hn}),e9=Ge({name:oe().min(1),parentId:Hn.optional()}),t9=Qt(Ge({id:oe(),filePath:oe()})),n9=Ge({id:Hn,toStatus:Tt(bi),actor:oe().optional()}),r9=Qt(Ge({id:oe(),status:Tt(bi)})),a9=Ge({id:Hn,body:oe(),actor:oe().optional()}),i9=Qt(Ge({})),s9=Tt(["brainstorm","plan"]),o9=Tt(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),u9=Ge({id:Hn,action:s9,channel:o9.optional(),skipDeps:pa().optional()}),l9=Ge({runId:oe(),action:oe(),status:kr("queued")}),c9=Qt(l9),d9=Ge({id:Hn,name:oe().min(1)}),p9=Qt(Ge({id:oe(),filePath:oe()})),f9=Ge({id:Hn,title:oe().min(1)}),m9=Qt(Ge({wbs:oe(),filePath:oe()})),h9=Ge({id:Hn,wbs:oe().regex(/^\d{4}$/)}),g9=Qt(Ge({})),lA=Tt(["pull","push"]),b9=Ge({id:Hn,direction:lA}),E9=Qt(Ge({direction:lA,affectedTasks:ol().int().nonnegative(),applied:pa(),newStatus:oe().optional()})),y9={list:Ht.route({method:"GET",path:"/features",summary:"List features",tags:["feature"]}).output(Xj),show:Ht.route({method:"GET",path:"/features/{id}",summary:"Show feature detail",tags:["feature"]}).input(Jj).output(Qj),create:Ht.route({method:"POST",path:"/features",summary:"Create a feature",tags:["feature"]}).input(e9).output(t9),transition:Ht.route({method:"PATCH",path:"/features/{id}/status",summary:"Transition feature status",tags:["feature"]}).input(n9).output(r9),refresh:Ht.route({method:"POST",path:"/features/refresh",summary:"Refresh feature index and kanban",tags:["feature"]}).output(Qt(Ge({rebuilt:ol().int().nonnegative()}))),check:Ht.route({method:"POST",path:"/features/{id}/check",summary:"Run the four-layer feature check",tags:["feature"]}).input(Ge({id:Hn})).output(Qt(Ge({id:oe(),status:oe(),pass:pa(),findings:Jn(Ge({layer:Tt(["L1","L2","L3","L4"]),severity:Tt(["error","warning","info"]),section:oe(),message:oe()})),requiredSections:Jn(oe()),missingSections:Jn(oe())}))),body:Ht.route({method:"PATCH",path:"/features/{id}/body",summary:"Update feature body",tags:["feature"]}).input(a9).output(i9),action:Ht.route({method:"POST",path:"/features/{id}/action",summary:"Run a feature workflow action",tags:["feature"]}).input(u9).output(c9),children:Ht.route({method:"POST",path:"/features/{id}/children",summary:"Create a child feature",tags:["feature"]}).input(d9).output(p9),tasks:Ht.route({method:"POST",path:"/features/{id}/tasks",summary:"Create a task linked to feature",tags:["feature"]}).input(f9).output(m9),link:Ht.route({method:"PATCH",path:"/features/{id}/link",summary:"Link an existing task to feature",tags:["feature"]}).input(h9).output(g9),sync:Ht.route({method:"POST",path:"/features/{id}/sync",summary:"Sync feature status with linked tasks",tags:["feature"]}).input(b9).output(E9)},x9=Qt(Ge({eventName:oe(),occurredAt:oe().datetime(),actor:oe().nullable().optional(),payload:qg(oe(),Ja())})),T9={stream:Ht.route({method:"GET",path:"/events/planning",summary:"Stream planning events (SSE)",tags:["events"]}).output(x9)},S9=Ge({wbs:oe().regex(/^\d{4}$/),name:oe().min(1),status:Tt(va),priority:oe().optional(),featureId:oe().nullable().optional(),parentWbs:oe().regex(/^\d{4}$/).nullable().optional(),type:Tt(iA).optional(),filePath:oe(),updatedAt:oe().optional()}),A9=Qt(Jn(S9)),v9=Ge({folder:oe().optional(),status:oe().optional(),parent:oe().optional()}),w9=Qt(Ge({wbs:oe(),name:oe(),status:Tt(va),frontmatter:qg(oe(),Ja()),content:oe(),filePath:oe()})),_9=Ge({wbs:oe().regex(/^\d{4}$/)}),N9=Ge({title:oe().min(1),featureId:oe().optional(),parentWbs:oe().regex(/^\d{4}$/).optional(),folder:oe().optional(),template:Tt(ll).optional()}),C9=Qt(Ge({wbs:oe(),filePath:oe()})),I9=Ge({wbs:oe().regex(/^\d{4}$/),toStatus:Tt(va),actor:oe().optional()}),k9=Qt(Ge({wbs:oe(),status:Tt(va)})),R9=Ge({wbs:oe().regex(/^\d{4}$/),body:oe(),actor:oe().optional()}),D9=Qt(Ge({wbs:oe(),filePath:oe()})),O9=Tt(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),L9=Tt(["refine","plan","run","verify","decompose","evaluate"]),F9=Ge({wbs:oe().regex(/^\d{4}$/),action:L9,channel:O9.optional(),skipDeps:pa().optional()}),M9=Qt(Ge({runId:oe(),action:oe(),status:kr("queued")})),P9=Ge({path:oe(),label:oe().optional()}),B9=Qt(Jn(P9)).extend({activeFolder:oe().optional()}),U9={list:Ht.route({method:"GET",path:"/tasks",summary:"List tasks",tags:["task"]}).input(v9).output(A9),folders:Ht.route({method:"GET",path:"/tasks/folders",summary:"List configured task folders",tags:["task"]}).output(B9),show:Ht.route({method:"GET",path:"/tasks/{wbs}",summary:"Show task detail",tags:["task"]}).input(_9).output(w9),create:Ht.route({method:"POST",path:"/tasks",summary:"Create a task",tags:["task"]}).input(N9).output(C9),transition:Ht.route({method:"PATCH",path:"/tasks/{wbs}/status",summary:"Transition task status",tags:["task"]}).input(I9).output(k9),body:Ht.route({method:"PATCH",path:"/tasks/{wbs}/body",summary:"Update task body",tags:["task"]}).input(R9).output(D9),action:Ht.route({method:"POST",path:"/tasks/{wbs}/actions",summary:"Run a task action",tags:["task"]}).input(F9).output(M9)},j9=Ge({status:kr("ok"),timestamp:oe(),service:kr("spur"),version:oe()}),$9={health:Ht.route({method:"GET",path:"/health",summary:"Read application health",tags:["system"]}).output(j9),task:{...U9},feature:{...y9},...T9};class z9 extends w1{initRuntimeAdapter(t){for(const n of this.plugins)n.initRuntimeAdapter?.(t)}}class H9{fetch;toFetchRequestOptions;adapterInterceptors;constructor(t){new z9(t.plugins).initRuntimeAdapter(t),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=t,this.adapterInterceptors=Qo(t.adapterInterceptors)}async call(t,n,r,a){const i=KP(t,this.toFetchRequestOptions),s=await Zc(this.adapterInterceptors,{...n,request:i,path:r,input:a,init:{redirect:"manual"}},({request:u,path:l,input:p,init:d,...f})=>this.fetch(u,d,f,l,p));return XP(s,{signal:i.signal})}}class G9{maxArrayIndex;constructor(t={}){this.maxArrayIndex=t.maxBracketNotationArrayIndex??9999}serialize(t,n=[],r=[]){if(Array.isArray(t))t.forEach((a,i)=>{this.serialize(a,[...n,i],r)});else if(Yr(t))for(const a in t)this.serialize(t[a],[...n,a],r);else r.push([this.stringifyPath(n),t]);return r}deserialize(t){if(t.length===0)return{};const n=new WeakSet,r={value:[]};for(const[a,i]of t){const s=this.parsePath(a);let o=r,u="value";s.forEach((l,p)=>{!Array.isArray(o[u])&&!Yr(o[u])&&(o[u]=[]),p!==s.length-1?Array.isArray(o[u])&&!sy(l,this.maxArrayIndex)&&(n.has(o[u])?(n.delete(o[u]),o[u]=oy(o[u])):o[u]=nc(o[u])):Array.isArray(o[u])&&(l===""?o[u].length&&!n.has(o[u])&&(o[u]=nc(o[u])):n.has(o[u])?(n.delete(o[u]),o[u]=oy(o[u])):sy(l,this.maxArrayIndex)||(o[u]=nc(o[u]))),o=o[u],u=l}),Array.isArray(o)&&u===""?(n.add(o),o.push(i)):u in o?Array.isArray(o[u])?o[u].push(i):o[u]=[o[u],i]:o[u]=i}return r.value}stringifyPath(t){return t.map(n=>n.toString().replace(/[\\[\]]/g,r=>{switch(r){case"\\":return"\\\\";case"[":return"\\[";case"]":return"\\]";default:return r}})).reduce((n,r,a)=>a===0?r:`${n}[${r}]`,"")}parsePath(t){const n=[];let r=!1,a="",i=0;for(let s=0;s<t.length;s++){const o=t[s],u=t[s+1];r&&o==="]"&&(u===void 0||u==="[")&&i%2===0?(u===void 0&&(r=!1),n.push(a),a="",s++):n.length===0&&o==="["&&i%2===0?(r=!0,n.push(a),a=""):o==="\\"?i++:(a+="\\".repeat(i/2)+o,i=0)}return r||n.length===0?[t]:n}}function sy(e,t){return/^0$|^[1-9]\d*$/.test(e)&&Number(e)<=t}function nc(e){const t=new f1;return e.forEach((n,r)=>{t[r]=n}),t}function oy(e){const t=new f1;return t[""]=e.length===1?e[0]:e,t}class W9{customSerializers;constructor(t={}){this.customSerializers=t.customJsonSerializers??[]}serialize(t,n={value:!1}){for(const r of this.customSerializers)if(r.condition(t))return this.serialize(r.serialize(t),n);if(t instanceof Blob)return n.value=!0,[t,n.value];if(t instanceof Set)return this.serialize(Array.from(t),n);if(t instanceof Map)return this.serialize(Array.from(t.entries()),n);if(Array.isArray(t))return[t.map(a=>a===void 0?null:this.serialize(a,n)[0]),n.value];if(Yr(t)){const r={};for(const a in t)a==="toJSON"&&typeof t[a]=="function"||(r[a]=this.serialize(t[a],n)[0]);return[r,n.value]}return typeof t=="bigint"||t instanceof RegExp||t instanceof URL?[t.toString(),n.value]:t instanceof Date?[Number.isNaN(t.getTime())?null:t.toISOString(),n.value]:Number.isNaN(t)?[null,n.value]:[t,n.value]}}function nd(e){return`/${e.replace(/\/{2,}/g,"/").replace(/^\/|\/$/g,"")}`}function uy(e){return e?nd(e).match(/\/\{[^}]+\}/g)?.map(t=>({raw:t,name:t.match(/\{\+?([^}]+)\}/)[1]})):void 0}class V9{constructor(t,n,r){this.contract=t,this.serializer=n,this.baseUrl=r.url,this.headers=r.headers??{},this.customErrorResponseBodyDecoder=r.customErrorResponseBodyDecoder}baseUrl;headers;customErrorResponseBodyDecoder;async encode(t,n,r){let a=JP(await D0(this.headers,r,t,n));r.lastEventId!==void 0&&(a=O0(a,{"last-event-id":r.lastEventId}));const i=await D0(this.baseUrl,r,t,n),s=R0(this.contract,t);if(!Qc(s))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${t.join(".")}`);return mo("defaultInputStructure",s["~orpc"].route.inputStructure)==="compact"?this.#e(s,t,n,r,i,a):this.#t(s,t,n,r,i,a)}#e(t,n,r,a,i,s){let o=nd(t["~orpc"].route.path??F0(n)),u=r;const l=uy(o);if(l?.length){if(!Yr(r))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "compact" structure when has dynamic params at ${n.join(".")}.`);const f={...r};for(const m of l){const b=r[m.name];o=o.replace(m.raw,`/${encodeURIComponent(`${this.serializer.serialize(b)}`)}`),delete f[m.name]}u=Object.keys(f).length?f:void 0}const p=mo("defaultMethod",t["~orpc"].route.method),d=new URL(i);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,p==="GET"){const f=this.serializer.serialize(u,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b);return{url:d,method:p,headers:s,body:void 0,signal:a.signal}}return{url:d,method:p,headers:s,body:this.serializer.serialize(u),signal:a.signal}}#t(t,n,r,a,i,s){let o=nd(t["~orpc"].route.path??F0(n));const u=uy(o);if(!Yr(r)&&r!==void 0)throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "detailed" structure at ${n.join(".")}.`);if(u?.length){if(!Yr(r?.params))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.params shape for "detailed" structure when has dynamic params at ${n.join(".")}.`);for(const f of u){const m=r.params[f.name];o=o.replace(f.raw,`/${encodeURIComponent(`${this.serializer.serialize(m)}`)}`)}}let l=s;if(r?.headers!==void 0){if(!Yr(r.headers))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.headers shape for "detailed" structure at ${n.join(".")}.`);l=O0(r.headers,s)}const p=mo("defaultMethod",t["~orpc"].route.method),d=new URL(i);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,r?.query!==void 0){const f=this.serializer.serialize(r.query,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b)}return p==="GET"?{url:d,method:p,headers:l,body:void 0,signal:a.signal}:{url:d,method:p,headers:l,body:this.serializer.serialize(r?.body),signal:a.signal}}async decode(t,n,r){const a=!ys(t.status),i=await(async()=>{let u=!1;try{const l=await t.body();return u=!0,this.serializer.deserialize(l)}catch(l){throw u?new Error("Invalid OpenAPI response format.",{cause:l}):new Error("Cannot parse response body, please check the response body and content-type.",{cause:l})}})();if(!a){const u=this.customErrorResponseBodyDecoder?.(i,t);throw u??(g1(i)?b1(i):new Es(e5(t.status),{status:t.status,data:{...t,body:i}}))}const s=R0(this.contract,r);if(!Qc(s))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${r.join(".")}`);return mo("defaultOutputStructure",s["~orpc"].route.outputStructure)==="compact"?i:{status:t.status,headers:t.headers,body:i}}}class q9{constructor(t,n){this.jsonSerializer=t,this.bracketNotation=n}serialize(t,n={}){return bs(t)&&!n.outputFormat?L0(t,{value:async r=>this.#e(r,{outputFormat:"plain"}),error:async r=>new xs({data:this.#e(LP(r).toJSON(),{outputFormat:"plain"}),cause:r})}):this.#e(t,n)}#e(t,n){const[r,a]=this.jsonSerializer.serialize(t);if(n.outputFormat==="plain")return r;if(n.outputFormat==="URLSearchParams"){const s=new URLSearchParams;for(const[o,u]of this.bracketNotation.serialize(r))(typeof u=="string"||typeof u=="number"||typeof u=="boolean")&&s.append(o,u.toString());return s}if(r instanceof Blob||r===void 0||!a)return r;const i=new FormData;for(const[s,o]of this.bracketNotation.serialize(r))typeof o=="string"||typeof o=="number"||typeof o=="boolean"?i.append(s,o.toString()):o instanceof Blob&&i.append(s,o);return i}deserialize(t){return t instanceof URLSearchParams||t instanceof FormData?this.bracketNotation.deserialize(Array.from(t.entries())):bs(t)?L0(t,{value:async n=>n,error:async n=>n instanceof xs&&g1(n.data)?b1(n.data,{cause:n}):n}):t}}class Y9 extends QP{constructor(t,n,r){const a=new W9(r),i=new G9({maxBracketNotationArrayIndex:4294967294}),s=new q9(a,i),o=new V9(t,s,r);super(o,n,r)}}class Z9 extends Y9{constructor(t,n){const r=new H9(n);super(t,r,n)}}function et(e=void 0,t=globalThis.location?.origin,n=!1){return e||(t&&t!=="null"?new URL("/api",t).toString():"http://localhost:3000/api")}function Ke(e,t=1e4){const n=new AbortController,r=setTimeout(()=>n.abort(),t),a=e.signal;a&&a.addEventListener("abort",()=>n.abort(),{once:!0});const i=new Request(e,{signal:n.signal});return fetch(i).finally(()=>clearTimeout(r))}function K9(e){return Ke(e)}function X9(e){typeof globalThis<"u"&&globalThis.dispatchEvent&&globalThis.dispatchEvent(new CustomEvent("api-error",{detail:{message:e instanceof Error?e.message:String(e)}}))}const _r=S1(new Z9($9,{url:et(),fetch:K9,adapterInterceptors:[wP(X9)]})),Sr=()=>`${et()}/features`;async function Q9(e){const t=await Ke(new Request(Sr(),{signal:e}));if(!t.ok)throw new Error(`feature list fetch failed: ${t.status}`);const r=await t.json();if(!r.ok||!Array.isArray(r.data))throw new Error("feature list: invalid response shape");return r.data}async function ly(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e)}`,{signal:t}));if(!n.ok)throw new Error(`feature show fetch failed: ${n.status}`);const a=await n.json();if(!a.ok||!a.data)throw new Error("feature show: invalid response shape");return a.data}async function J9(e,t,n){const r=await Ke(new Request(`${Sr()}/${encodeURIComponent(e)}/status`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,toStatus:t}),signal:n})),a=await r.json();if(!r.ok){const s=a;throw new Error(s.error?.message??`transition failed: ${r.status}`)}return a.data?.status??t}async function e7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/body`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const a=await n.json();throw new Error(a.error?.message??`body update failed: ${n.status}`)}}async function t7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`action dispatch failed: ${n.status}`)}return await n.json()}async function cA(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/children`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`create child failed: ${n.status}`)}return await n.json()}async function n7(e,t){const n=await Ke(new Request(Sr(),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e}),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`create feature failed: ${n.status}`)}const a=await n.json();if(!a.ok||!a.data)throw new Error("create feature: invalid response shape");return a.data}async function r7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/tasks`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`create task failed: ${n.status}`)}return await n.json()}async function a7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/link`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`link task failed: ${n.status}`)}return await n.json()}async function i7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/sync`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`sync failed: ${n.status}`)}return await n.json()}const s7=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),o7=function(e){return"/"+e},cy={},dA=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");a=u(n.map(l=>{if(l=o7(l),l in cy)return;cy[l]=!0;const p=l.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":s7,p||(f.as="script"),f.crossOrigin="",f.href=l,o&&f.setAttribute("nonce",o),document.head.appendChild(f),p)return new Promise((m,b)=>{f.addEventListener("load",m),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return a.then(s=>{for(const o of s||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function dy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u7(e){if(Array.isArray(e))return e}function l7(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,s,o=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(u=(r=i.call(n)).done)&&(o.push(r.value),o.length!==t);u=!0);}catch(p){l=!0,a=p}finally{try{if(!u&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw a}}return o}}function c7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
169
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d7(e,t){return u7(e)||l7(e,t)||p7(e,t)||c7()}function p7(e,t){if(e){if(typeof e=="string")return dy(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dy(e,t):void 0}}const pA=Object.entries,py=Object.setPrototypeOf,f7=Object.isFrozen,m7=Object.getPrototypeOf,h7=Object.getOwnPropertyDescriptor;let hn=Object.freeze,bn=Object.seal,Oa=Object.create,fA=typeof Reflect<"u"&&Reflect,rd=fA.apply,ad=fA.construct;hn||(hn=function(t){return t});bn||(bn=function(t){return t});rd||(rd=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i];return t.apply(n,a)});ad||(ad=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const Fi=Jt(Array.prototype.forEach),g7=Jt(Array.prototype.lastIndexOf),fy=Jt(Array.prototype.pop),ka=Jt(Array.prototype.push),b7=Jt(Array.prototype.splice),Wr=Array.isArray,Hi=Jt(String.prototype.toLowerCase),rc=Jt(String.prototype.toString),my=Jt(String.prototype.match),Mi=Jt(String.prototype.replace),hy=Jt(String.prototype.indexOf),E7=Jt(String.prototype.trim),y7=Jt(Number.prototype.toString),x7=Jt(Boolean.prototype.toString),gy=typeof BigInt>"u"?null:Jt(BigInt.prototype.toString),by=typeof Symbol>"u"?null:Jt(Symbol.prototype.toString),un=Jt(Object.prototype.hasOwnProperty),Pi=Jt(Object.prototype.toString),mn=Jt(RegExp.prototype.test),na=T7(TypeError);function Jt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return rd(e,t,r)}}function T7(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ad(e,n)}}function mt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hi;if(py&&py(e,null),!Wr(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const i=n(a);i!==a&&(f7(t)||(t[r]=i),a=i)}e[a]=!0}return e}function S7(e){for(let t=0;t<e.length;t++)un(e,t)||(e[t]=null);return e}function Cn(e){const t=Oa(null);for(const r of pA(e)){var n=d7(r,2);const a=n[0],i=n[1];un(e,a)&&(Wr(i)?t[a]=S7(i):i&&typeof i=="object"&&i.constructor===Object?t[a]=Cn(i):t[a]=i)}return t}function A7(e){switch(typeof e){case"string":return e;case"number":return y7(e);case"boolean":return x7(e);case"bigint":return gy?gy(e):"0";case"symbol":return by?by(e):"Symbol()";case"undefined":return Pi(e);case"function":case"object":{if(e===null)return Pi(e);const t=e,n=fr(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Pi(r)}return Pi(e)}default:return Pi(e)}}function fr(e,t){for(;e!==null;){const r=h7(e,t);if(r){if(r.get)return Jt(r.get);if(typeof r.value=="function")return Jt(r.value)}e=m7(e)}function n(){return null}return n}function v7(e){try{return mn(e,""),!0}catch{return!1}}const Ey=hn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ac=hn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ic=hn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),w7=hn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sc=hn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_7=hn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yy=hn(["#text"]),xy=hn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),oc=hn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ty=hn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Eo=hn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),N7=bn(/{{[\w\W]*|^[\w\W]*}}/g),C7=bn(/<%[\w\W]*|^[\w\W]*%>/g),I7=bn(/\${[\w\W]*/g),k7=bn(/^data-[\-\w.\u00B7-\uFFFF]+$/),R7=bn(/^aria-[\-\w]+$/),Sy=bn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),D7=bn(/^(?:\w+script|data):/i),O7=bn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),L7=bn(/^html$/i),F7=bn(/^[a-z][.\w]*(-[.\w]+)+$/i),Ay=bn(/<[/\w!]/g),M7=bn(/<[/\w]/g),P7=bn(/<\/no(script|embed|frames)/i),B7=bn(/\/>/i),pr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},U7=function(){return typeof window>"u"?null:window},j7=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},vy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Pr=function(t,n,r,a){return un(t,n)&&Wr(t[n])?mt(a.base?Cn(a.base):{},t[n],a.transform):r};function mA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:U7();const t=fe=>mA(fe);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==pr.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const i=e.HTMLTemplateElement,s=e.Node,o=e.Element,u=e.NodeFilter,l=e.NamedNodeMap;l===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const p=e.DOMParser,d=e.trustedTypes,f=o.prototype,m=fr(f,"cloneNode"),b=fr(f,"remove"),E=fr(f,"nextSibling"),y=fr(f,"childNodes"),x=fr(f,"parentNode"),w=fr(f,"shadowRoot"),T=fr(f,"attributes"),I=s&&s.prototype?fr(s.prototype,"nodeType"):null,R=s&&s.prototype?fr(s.prototype,"nodeName"):null;if(typeof i=="function"){const fe=n.createElement("template");fe.content&&fe.content.ownerDocument&&(n=fe.content.ownerDocument)}let v,A="",N,F=!1,_=0;const M=function(){if(_>0)throw na('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},j=function(L){M(),_++;try{return v.createHTML(L)}finally{_--}},H=function(L){M(),_++;try{return v.createScriptURL(L)}finally{_--}},Z=function(){return F||(N=j7(d,a),F=!0),N},V=n,ie=V.implementation,X=V.createNodeIterator,re=V.createDocumentFragment,ue=V.getElementsByTagName,k=r.importNode;let Y=vy();t.isSupported=typeof pA=="function"&&typeof x=="function"&&ie&&ie.createHTMLDocument!==void 0;const le=N7,D=C7,ke=I7,Le=k7,ve=R7,Ue=D7,Ee=O7,he=F7;let ct=Sy,$e=null;const ge=mt({},[...Ey,...ac,...ic,...sc,...yy]);let Pe=null;const pt=mt({},[...xy,...oc,...Ty,...Eo]);let de=Object.seal(Oa(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),rt=null,Ot=null;const ft=Object.seal(Oa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let kt=!0,wt=!0,zt=!1,nn=!0,ut=!1,Ae=!0,Ye=!1,q=!1,te=null,ye=null,we=!1,je=!1,Ze=!1,_t=!1,St=!0,Et=!1;const Nt="user-content-";let J=!0,be=!1,Fe={},Re=null;const xt=mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Wt=null;const U=mt({},["audio","video","img","source","image","track"]);let Te=null;const Ne=mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ze="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let At=Ve,rn=!1,Rt=null;const Vt=mt({},[ze,Xe,Ve],rc),P=hn(["mi","mo","mn","ms","mtext"]);let $=mt({},P);const G=hn(["annotation-xml"]);let ee=mt({},G);const se=mt({},["title","style","font","a","script"]);let Se=null;const xe=["application/xhtml+xml","text/html"],_e="text/html";let me=null,Ce=null;const Be=n.createElement("form"),De=function(L){return L instanceof RegExp||L instanceof Function},lt=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ce&&Ce===L)return;(!L||typeof L!="object")&&(L={}),L=Cn(L),Se=xe.indexOf(L.PARSER_MEDIA_TYPE)===-1?_e:L.PARSER_MEDIA_TYPE,me=Se==="application/xhtml+xml"?rc:Hi,$e=Pr(L,"ALLOWED_TAGS",ge,{transform:me}),Pe=Pr(L,"ALLOWED_ATTR",pt,{transform:me}),Rt=Pr(L,"ALLOWED_NAMESPACES",Vt,{transform:rc}),Te=Pr(L,"ADD_URI_SAFE_ATTR",Ne,{transform:me,base:Ne}),Wt=Pr(L,"ADD_DATA_URI_TAGS",U,{transform:me,base:U}),Re=Pr(L,"FORBID_CONTENTS",xt,{transform:me}),rt=Pr(L,"FORBID_TAGS",Cn({}),{transform:me}),Ot=Pr(L,"FORBID_ATTR",Cn({}),{transform:me}),Fe=un(L,"USE_PROFILES")?L.USE_PROFILES&&typeof L.USE_PROFILES=="object"?Cn(L.USE_PROFILES):L.USE_PROFILES:!1,kt=L.ALLOW_ARIA_ATTR!==!1,wt=L.ALLOW_DATA_ATTR!==!1,zt=L.ALLOW_UNKNOWN_PROTOCOLS||!1,nn=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ut=L.SAFE_FOR_TEMPLATES||!1,Ae=L.SAFE_FOR_XML!==!1,Ye=L.WHOLE_DOCUMENT||!1,je=L.RETURN_DOM||!1,Ze=L.RETURN_DOM_FRAGMENT||!1,_t=L.RETURN_TRUSTED_TYPE||!1,we=L.FORCE_BODY||!1,St=L.SANITIZE_DOM!==!1,Et=L.SANITIZE_NAMED_PROPS||!1,J=L.KEEP_CONTENT!==!1,be=L.IN_PLACE||!1,ct=v7(L.ALLOWED_URI_REGEXP)?L.ALLOWED_URI_REGEXP:Sy,At=typeof L.NAMESPACE=="string"?L.NAMESPACE:Ve,$=un(L,"MATHML_TEXT_INTEGRATION_POINTS")&&L.MATHML_TEXT_INTEGRATION_POINTS&&typeof L.MATHML_TEXT_INTEGRATION_POINTS=="object"?Cn(L.MATHML_TEXT_INTEGRATION_POINTS):mt({},P),ee=un(L,"HTML_INTEGRATION_POINTS")&&L.HTML_INTEGRATION_POINTS&&typeof L.HTML_INTEGRATION_POINTS=="object"?Cn(L.HTML_INTEGRATION_POINTS):mt({},G);const W=un(L,"CUSTOM_ELEMENT_HANDLING")&&L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING=="object"?Cn(L.CUSTOM_ELEMENT_HANDLING):Oa(null);if(de=Oa(null),un(W,"tagNameCheck")&&De(W.tagNameCheck)&&(de.tagNameCheck=W.tagNameCheck),un(W,"attributeNameCheck")&&De(W.attributeNameCheck)&&(de.attributeNameCheck=W.attributeNameCheck),un(W,"allowCustomizedBuiltInElements")&&typeof W.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=W.allowCustomizedBuiltInElements),bn(de),ut&&(wt=!1),Ze&&(je=!0),Fe&&($e=mt({},yy),Pe=Oa(null),Fe.html===!0&&(mt($e,Ey),mt(Pe,xy)),Fe.svg===!0&&(mt($e,ac),mt(Pe,oc),mt(Pe,Eo)),Fe.svgFilters===!0&&(mt($e,ic),mt(Pe,oc),mt(Pe,Eo)),Fe.mathMl===!0&&(mt($e,sc),mt(Pe,Ty),mt(Pe,Eo))),ft.tagCheck=null,ft.attributeCheck=null,un(L,"ADD_TAGS")&&(typeof L.ADD_TAGS=="function"?ft.tagCheck=L.ADD_TAGS:Wr(L.ADD_TAGS)&&($e===ge&&($e=Cn($e)),mt($e,L.ADD_TAGS,me))),un(L,"ADD_ATTR")&&(typeof L.ADD_ATTR=="function"?ft.attributeCheck=L.ADD_ATTR:Wr(L.ADD_ATTR)&&(Pe===pt&&(Pe=Cn(Pe)),mt(Pe,L.ADD_ATTR,me))),un(L,"ADD_URI_SAFE_ATTR")&&Wr(L.ADD_URI_SAFE_ATTR)&&mt(Te,L.ADD_URI_SAFE_ATTR,me),un(L,"FORBID_CONTENTS")&&Wr(L.FORBID_CONTENTS)&&(Re===xt&&(Re=Cn(Re)),mt(Re,L.FORBID_CONTENTS,me)),un(L,"ADD_FORBID_CONTENTS")&&Wr(L.ADD_FORBID_CONTENTS)&&(Re===xt&&(Re=Cn(Re)),mt(Re,L.ADD_FORBID_CONTENTS,me)),J&&($e["#text"]=!0),Ye&&mt($e,["html","head","body"]),$e.table&&(mt($e,["tbody"]),delete rt.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw na('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw na('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const pe=v;v=L.TRUSTED_TYPES_POLICY;try{A=j("")}catch(Ie){throw v=pe,Ie}}else L.TRUSTED_TYPES_POLICY===null?(v=void 0,A=""):(v===void 0&&(v=Z()),v&&typeof A=="string"&&(A=j("")));hn&&hn(L),Ce=L},dt=mt({},[...ac,...ic,...w7]),qt=mt({},[...sc,..._7]),Yt=function(L,W,pe){return W.namespaceURI===Ve?L==="svg":W.namespaceURI===ze?L==="svg"&&(pe==="annotation-xml"||$[pe]):!!dt[L]},pn=function(L,W,pe){return W.namespaceURI===Ve?L==="math":W.namespaceURI===Xe?L==="math"&&ee[pe]:!!qt[L]},yt=function(L,W,pe){return W.namespaceURI===Xe&&!ee[pe]||W.namespaceURI===ze&&!$[pe]?!1:!qt[L]&&(se[L]||!dt[L])},Ln=function(L){let W=x(L);(!W||!W.tagName)&&(W={namespaceURI:At,tagName:"template"});const pe=Hi(L.tagName),Ie=Hi(W.tagName);return Rt[L.namespaceURI]?L.namespaceURI===Xe?Yt(pe,W,Ie):L.namespaceURI===ze?pn(pe,W,Ie):L.namespaceURI===Ve?yt(pe,W,Ie):!!(Se==="application/xhtml+xml"&&Rt[L.namespaceURI]):!1},Tn=function(L){ka(t.removed,{element:L});try{x(L).removeChild(L)}catch{if(b(L),!x(L))throw na("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Or=function(L){const W=y(L);if(W){const Ie=[];Fi(W,Qe=>{ka(Ie,Qe)}),Fi(Ie,Qe=>{try{b(Qe)}catch{}})}const pe=T(L);if(pe)for(let Ie=pe.length-1;Ie>=0;--Ie){const Qe=pe[Ie],gt=Qe&&Qe.name;if(typeof gt=="string")try{L.removeAttribute(gt)}catch{}}},Sn=function(L,W){try{ka(t.removed,{attribute:W.getAttributeNode(L),from:W})}catch{ka(t.removed,{attribute:null,from:W})}if(W.removeAttribute(L),L==="is")if(je||Ze)try{Tn(W)}catch{}else try{W.setAttribute(L,"")}catch{}},Wn=function(L){const W=T(L);if(W)for(let pe=W.length-1;pe>=0;--pe){const Ie=W[pe],Qe=Ie&&Ie.name;if(!(typeof Qe!="string"||Pe[me(Qe)]))try{L.removeAttribute(Qe)}catch{}}},Ti=function(L){const W=[L];for(;W.length>0;){const pe=W.pop();(I?I(pe):pe.nodeType)===pr.element&&Wn(pe);const Qe=y(pe);if(Qe)for(let gt=Qe.length-1;gt>=0;--gt)W.push(Qe[gt])}},Lr=function(L){let W=null,pe=null;if(we)L="<remove></remove>"+L;else{const gt=my(L,/^[\r\n\t ]+/);pe=gt&&gt[0]}Se==="application/xhtml+xml"&&At===Ve&&(L='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+L+"</body></html>");const Ie=v?j(L):L;if(At===Ve)try{W=new p().parseFromString(Ie,Se)}catch{}if(!W||!W.documentElement){W=ie.createDocument(At,"template",null);try{W.documentElement.innerHTML=rn?A:Ie}catch{}}const Qe=W.body||W.documentElement;return L&&pe&&Qe.insertBefore(n.createTextNode(pe),Qe.childNodes[0]||null),At===Ve?ue.call(W,Ye?"html":"body")[0]:Ye?W.documentElement:Qe},cr=function(L){return X.call(L.ownerDocument||L,L,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ar=function(L){return L=Mi(L,le," "),L=Mi(L,D," "),L=Mi(L,ke," "),L},Fr=function(L){var W;L.normalize();const pe=X.call(L.ownerDocument||L,L,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let Ie=pe.nextNode();for(;Ie;)Ie.data=Ar(Ie.data),Ie=pe.nextNode();const Qe=(W=L.querySelectorAll)===null||W===void 0?void 0:W.call(L,"template");Qe&&Fi(Qe,gt=>{Pt(gt.content)&&Fr(gt.content)})},tt=function(L){const W=R?R(L):null;return typeof W!="string"||me(W)!=="form"?!1:typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||L.attributes!==T(L)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function"||L.nodeType!==I(L)||L.childNodes!==y(L)},Pt=function(L){if(!I||typeof L!="object"||L===null)return!1;try{return I(L)===pr.documentFragment}catch{return!1}},Vn=function(L){if(!I||typeof L!="object"||L===null)return!1;try{return typeof I(L)=="number"}catch{return!1}};function fn(fe,L,W){fe.length!==0&&Fi(fe,pe=>{pe.call(t,L,W,Ce)})}const Lt=function(L,W){return!!(Ae&&L.hasChildNodes()&&!Vn(L.firstElementChild)&&mn(Ay,L.textContent)&&mn(Ay,L.innerHTML)||Ae&&L.namespaceURI===Ve&&W==="style"&&Vn(L.firstElementChild)||L.nodeType===pr.processingInstruction||Ae&&L.nodeType===pr.comment&&mn(M7,L.data))},wa=function(L,W){if(!rt[W]&&fb(W)&&(de.tagNameCheck instanceof RegExp&&mn(de.tagNameCheck,W)||de.tagNameCheck instanceof Function&&de.tagNameCheck(W)))return!1;if(J&&!Re[W]){const pe=x(L),Ie=y(L);if(Ie&&pe){const Qe=Ie.length;for(let gt=Qe-1;gt>=0;--gt){const an=be?Ie[gt]:m(Ie[gt],!0);pe.insertBefore(an,E(L))}}}return Tn(L),!0},Si=function(L){if(fn(Y.beforeSanitizeElements,L,null),tt(L))return Tn(L),!0;const W=me(R?R(L):L.nodeName);if(fn(Y.uponSanitizeElement,L,{tagName:W,allowedTags:$e}),Lt(L,W))return Tn(L),!0;if(rt[W]||!(ft.tagCheck instanceof Function&&ft.tagCheck(W))&&!$e[W])return wa(L,W);if((I?I(L):L.nodeType)===pr.element&&!Ln(L)||(W==="noscript"||W==="noembed"||W==="noframes")&&mn(P7,L.innerHTML))return Tn(L),!0;if(ut&&L.nodeType===pr.text){const Ie=Ar(L.textContent);L.textContent!==Ie&&(ka(t.removed,{element:L.cloneNode()}),L.textContent=Ie)}return fn(Y.afterSanitizeElements,L,null),!1},Zs=function(L,W,pe){if(Ot[W]||St&&(W==="id"||W==="name")&&(pe in n||pe in Be))return!1;const Ie=Pe[W]||ft.attributeCheck instanceof Function&&ft.attributeCheck(W,L);if(!(wt&&mn(Le,W))){if(!(kt&&mn(ve,W))){if(Ie){if(!Te[W]){if(!mn(ct,Mi(pe,Ee,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&L!=="script"&&hy(pe,"data:")===0&&Wt[L])){if(!(zt&&!mn(Ue,Mi(pe,Ee,"")))){if(pe)return!1}}}}}else if(!(fb(L)&&(de.tagNameCheck instanceof RegExp&&mn(de.tagNameCheck,L)||de.tagNameCheck instanceof Function&&de.tagNameCheck(L))&&(de.attributeNameCheck instanceof RegExp&&mn(de.attributeNameCheck,W)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(W,L))||W==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&mn(de.tagNameCheck,pe)||de.tagNameCheck instanceof Function&&de.tagNameCheck(pe))))return!1}}return!0},cv=mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),fb=function(L){return!cv[Hi(L)]&&mn(he,L)},dv=function(L,W,pe,Ie){if(v&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!pe)switch(d.getAttributeType(L,W)){case"TrustedHTML":return j(Ie);case"TrustedScriptURL":return H(Ie)}return Ie},pv=function(L,W,pe,Ie){try{pe?L.setAttributeNS(pe,W,Ie):L.setAttribute(W,Ie),tt(L)?Tn(L):fy(t.removed)}catch{Sn(W,L)}},mb=function(L){fn(Y.beforeSanitizeAttributes,L,null);const W=L.attributes;if(!W||tt(L))return;const pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Pe,forceKeepAttr:void 0};let Ie=W.length;const Qe=me(L.nodeName);for(;Ie--;){const gt=W[Ie],an=gt.name,Zt=gt.namespaceURI,qn=gt.value,rr=me(an),gl=qn;let _n=an==="value"?gl:E7(gl);if(pe.attrName=rr,pe.attrValue=_n,pe.keepAttr=!0,pe.forceKeepAttr=void 0,fn(Y.uponSanitizeAttribute,L,pe),_n=pe.attrValue,Et&&(rr==="id"||rr==="name")&&hy(_n,Nt)!==0&&(Sn(an,L),_n=Nt+_n),Ae&&mn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,_n)){Sn(an,L);continue}if(rr==="attributename"&&my(_n,"href")){Sn(an,L);continue}if(!pe.forceKeepAttr){if(!pe.keepAttr){Sn(an,L);continue}if(!nn&&mn(B7,_n)){Sn(an,L);continue}if(ut&&(_n=Ar(_n)),!Zs(Qe,rr,_n)){Sn(an,L);continue}_n=dv(Qe,rr,Zt,_n),_n!==gl&&pv(L,an,Zt,_n)}}fn(Y.afterSanitizeAttributes,L,null)},Ks=function(L){let W=null;const pe=cr(L);for(fn(Y.beforeSanitizeShadowDOM,L,null);W=pe.nextNode();)if(fn(Y.uponSanitizeShadowNode,W,null),Si(W),mb(W),Pt(W.content)&&Ks(W.content),(I?I(W):W.nodeType)===pr.element){const Qe=w(W);Pt(Qe)&&(hl(Qe),Ks(Qe))}fn(Y.afterSanitizeShadowDOM,L,null)},hl=function(L){const W=[{node:L,shadow:null}];for(;W.length>0;){const pe=W.pop();if(pe.shadow){Ks(pe.shadow);continue}const Ie=pe.node,gt=(I?I(Ie):Ie.nodeType)===pr.element,an=y(Ie);if(an)for(let Zt=an.length-1;Zt>=0;--Zt)W.push({node:an[Zt],shadow:null});if(gt){const Zt=R?R(Ie):null;if(typeof Zt=="string"&&me(Zt)==="template"){const qn=Ie.content;Pt(qn)&&W.push({node:qn,shadow:null})}}if(gt){const Zt=w(Ie);Pt(Zt)&&W.push({node:null,shadow:Zt},{node:Zt,shadow:null})}}};return t.sanitize=function(fe){let L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,pe=null,Ie=null,Qe=null;if(rn=!fe,rn&&(fe="<!-->"),typeof fe!="string"&&!Vn(fe)&&(fe=A7(fe),typeof fe!="string"))throw na("dirty is not a string, aborting");if(!t.isSupported)return fe;q?($e=te,Pe=ye):lt(L),(Y.uponSanitizeElement.length>0||Y.uponSanitizeAttribute.length>0)&&($e=Cn($e)),Y.uponSanitizeAttribute.length>0&&(Pe=Cn(Pe)),t.removed=[];const gt=be&&typeof fe!="string"&&Vn(fe);if(gt){const qn=R?R(fe):fe.nodeName;if(typeof qn=="string"){const rr=me(qn);if(!$e[rr]||rt[rr])throw na("root node is forbidden and cannot be sanitized in-place")}if(tt(fe))throw na("root node is clobbered and cannot be sanitized in-place");try{hl(fe)}catch(rr){throw Or(fe),rr}}else if(Vn(fe))W=Lr("<!---->"),pe=W.ownerDocument.importNode(fe,!0),pe.nodeType===pr.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?W=pe:W.appendChild(pe),hl(pe);else{if(!je&&!ut&&!Ye&&fe.indexOf("<")===-1)return v&&_t?j(fe):fe;if(W=Lr(fe),!W)return je?null:_t?A:""}W&&we&&Tn(W.firstChild);const an=cr(gt?fe:W);try{for(;Ie=an.nextNode();)Si(Ie),mb(Ie),Pt(Ie.content)&&Ks(Ie.content)}catch(qn){throw gt&&Or(fe),qn}if(gt)return Fi(t.removed,qn=>{qn.element&&Ti(qn.element)}),ut&&Fr(fe),fe;if(je){if(ut&&Fr(W),Ze)for(Qe=re.call(W.ownerDocument);W.firstChild;)Qe.appendChild(W.firstChild);else Qe=W;return(Pe.shadowroot||Pe.shadowrootmode)&&(Qe=k.call(r,Qe,!0)),Qe}let Zt=Ye?W.outerHTML:W.innerHTML;return Ye&&$e["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&mn(L7,W.ownerDocument.doctype.name)&&(Zt="<!DOCTYPE "+W.ownerDocument.doctype.name+`>
170
- `+Zt),ut&&(Zt=Ar(Zt)),v&&_t?j(Zt):Zt},t.setConfig=function(){let fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(fe),q=!0,te=$e,ye=Pe},t.clearConfig=function(){Ce=null,q=!1,te=null,ye=null,v=N,A=""},t.isValidAttribute=function(fe,L,W){Ce||lt({});const pe=me(fe),Ie=me(L);return Zs(pe,Ie,W)},t.addHook=function(fe,L){typeof L=="function"&&un(Y,fe)&&ka(Y[fe],L)},t.removeHook=function(fe,L){if(un(Y,fe)){if(L!==void 0){const W=g7(Y[fe],L);return W===-1?void 0:b7(Y[fe],W,1)[0]}return fy(Y[fe])}},t.removeHooks=function(fe){un(Y,fe)&&(Y[fe]=[])},t.removeAllHooks=function(){Y=vy()},t}var $7=mA();function z7({code:e}){const t=g.useId().replace(/:/g,""),n=g.useRef(null),[r,a]=g.useState(null),[i,s]=g.useState(!1);return g.useEffect(()=>{let o=!1;return(async()=>{try{const u=(await dA(async()=>{const{default:d}=await import("./mermaid.core.BAgx3nnb.js").then(f=>f.aH);return{default:d}},__vite__mapDeps([0,1]))).default;u.initialize({startOnLoad:!1,theme:"dark",securityLevel:"strict"});const l=await u.render(`mermaid-${t}`,e),p=$7.sanitize(l.svg,{USE_PROFILES:{svg:!0,svgFilters:!0}});o||a(p)}catch{o||s(!0)}})(),()=>{o=!0}},[e,t]),g.useEffect(()=>{n.current&&(n.current.innerHTML=r??"")},[r]),i?c.jsx("pre",{children:c.jsx("code",{children:e})}):c.jsx("div",{ref:n,className:"mermaid-diagram flex justify-center","data-testid":"mermaid-diagram"})}function H7(e){return(e??"").match(/language-(\w+)/)?.[1]??null}function id(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(id).join(""):typeof e=="object"&&"props"in e?id(e.props.children):""}function G7({className:e,children:t,...n}){return H7(e)==="mermaid"?c.jsx(z7,{code:id(t).trim()}):c.jsx("code",{className:e,...n,children:t})}function W7({source:e}){return c.jsx(Ko.Markdown,{source:e,wrapperElement:{"data-color-mode":"light"},components:{code:G7}})}function iu({targetVar:e,onResizeEnd:t,direction:n="horizontal",invert:r=!1}){const a=g.useRef(null),i=g.useCallback(o=>{o.preventDefault();const u=document.documentElement,p=getComputedStyle(u).getPropertyValue(e).trim(),d=parseFloat(p)||0;a.current={x:o.clientX,y:o.clientY,w:d},o.target.setPointerCapture(o.pointerId);const f=b=>{if(!a.current)return;const E=n==="horizontal"?b.clientX-a.current.x:b.clientY-a.current.y,y=r?-E:E,x=Math.max(0,a.current.w+y);u.style.setProperty(e,`${x}px`)},m=()=>{if(!a.current)return;const b=getComputedStyle(u).getPropertyValue(e).trim(),E=parseFloat(b)||a.current.w;t(Math.round(E)),a.current=null,window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",m)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",m,{once:!0})},[e,t,n,r]),s=n==="horizontal";return c.jsx("hr",{"data-testid":`resize-handle-${s?"h":"v"}`,"aria-orientation":s?"vertical":"horizontal","aria-label":s?"Resize sidebar":"Resize panel",tabIndex:0,className:"resize-handle shrink-0 bg-spur-border hover:bg-spur-accent cursor-col-resize transition-colors border-0",style:{width:s?4:"100%",height:s?"100%":4,margin:0},onPointerDown:i})}const wy="spur:new-task-panel-width",_y=384,uc=384;function Ny({id:e,label:t,placeholder:n,value:r,mode:a,onChange:i,onModeChange:s,disabled:o}){return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[c.jsxs("label",{htmlFor:e,className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:[t," ",c.jsx("span",{className:"text-spur-text-muted font-normal",children:"(optional, markdown)"})]}),c.jsxs("fieldset",{className:"flex items-center gap-1",children:[c.jsxs("legend",{className:"sr-only",children:[t," mode"]}),c.jsx(He,{type:"button",variant:a==="edit"?"primary":"ghost",size:"xs",onClick:()=>s("edit"),disabled:o,"aria-pressed":a==="edit",children:"Edit"}),c.jsx(He,{type:"button",variant:a==="preview"?"primary":"ghost",size:"xs",onClick:()=>s("preview"),disabled:o,"aria-pressed":a==="preview",children:"Preview"})]})]}),a==="edit"?c.jsx("div",{className:"min-h-40","data-testid":`${e}-editor`,children:c.jsx(Ko,{value:r,onChange:u=>i(u??""),height:160,textareaProps:{id:e,placeholder:n,disabled:o,"aria-label":t},"data-color-mode":"dark"})}):c.jsx("div",{className:"min-h-40 rounded border border-spur-border bg-spur-bg p-3 text-sm text-spur-text overflow-y-auto","data-testid":`${e}-preview`,children:r.trim()?c.jsx(Ko.Markdown,{source:r,"data-color-mode":"dark"}):c.jsx("p",{className:"text-xs text-spur-text-muted",children:n})})]})}function hA({open:e,onClose:t,onCreated:n,folder:r,featureId:a}){const[i,s]=g.useState(""),[o,u]=g.useState(""),[l,p]=g.useState(""),[d,f]=g.useState("edit"),[m,b]=g.useState("edit"),[E,y]=g.useState("standard"),[x,w]=g.useState(!1),[T,I]=g.useState(""),[R,v]=g.useState(!1),[A,N]=g.useState(()=>{if(typeof window>"u")return _y;try{const j=Number.parseFloat(window.localStorage.getItem(wy)??"");if(Number.isFinite(j)&&j>0)return Math.max(uc,Math.min(j,window.innerWidth*.9))}catch{}return _y}),F=R&&i.trim()===""?"Name is required":"";g.useEffect(()=>{document.documentElement.style.setProperty("--new-task-panel-w",`${A}px`)},[A]);const _=()=>{x||(s(""),u(""),p(""),f("edit"),b("edit"),y("standard"),I(""),v(!1),t())},M=async()=>{v(!0);const j=i.trim();if(j!==""){w(!0),I("");try{const Z=(await _r.task.create({title:j,folder:r,template:E,featureId:a})).data.wbs,V=[];if(o.trim()&&V.push(`### Background
168
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const o=s[1];if(t===s[0]){i(s);continue}if(e.external){const l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(o.cycle){i(s);continue}if(o.count>1&&e.reused==="ref"){i(s);continue}}}function X1(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=o=>{const u=e.seen.get(o);if(u.ref===null)return;const l=u.def??u.schema,p={...l},d=u.ref;if(u.ref=null,d){r(d);const m=e.seen.get(d),b=m.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(b)):Object.assign(l,b),Object.assign(l,p),o._zod.parent===d)for(const y in l)y==="$ref"||y==="allOf"||y in p||delete l[y];if(b.$ref&&m.def)for(const y in l)y==="$ref"||y==="allOf"||y in m.def&&JSON.stringify(l[y])===JSON.stringify(m.def[y])&&delete l[y]}const f=o._zod.parent;if(f&&f!==d){r(f);const m=e.seen.get(f);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(const b in l)b==="$ref"||b==="allOf"||b in m.def&&JSON.stringify(l[b])===JSON.stringify(m.def[b])&&delete l[b]}e.override({zodSchema:o,jsonSchema:l,path:u.path??[]})};for(const o of[...e.seen.entries()].reverse())r(o[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const o=e.external.registry.get(t)?.id;if(!o)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(o)}Object.assign(a,n.def??n.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&a.id===i&&delete a.id;const s=e.external?.defs??{};for(const o of e.seen.entries()){const u=o[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,s[u.defId]=u.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?a.$defs=s:a.definitions=s);try{const o=JSON.parse(JSON.stringify(a));return Object.defineProperty(o,"~standard",{value:{...t["~standard"],jsonSchema:{input:ru(t,"input",e.processors),output:ru(t,"output",e.processors)}},enumerable:!1,writable:!1}),o}catch{throw new Error("Error converting schema to JSON.")}}function Nn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Nn(r.element,n);if(r.type==="set")return Nn(r.valueType,n);if(r.type==="lazy")return Nn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Nn(r.innerType,n);if(r.type==="intersection")return Nn(r.left,n)||Nn(r.right,n);if(r.type==="record"||r.type==="map")return Nn(r.keyType,n)||Nn(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Nn(r.in,n)||Nn(r.out,n);if(r.type==="object"){for(const a in r.shape)if(Nn(r.shape[a],n))return!0;return!1}if(r.type==="union"){for(const a of r.options)if(Nn(a,n))return!0;return!1}if(r.type==="tuple"){for(const a of r.items)if(Nn(a,n))return!0;return!!(r.rest&&Nn(r.rest,n))}return!1}const uU=(e,t={})=>n=>{const r=Z1({...n,processors:t});return Xt(e,r),K1(r,e),X1(r,e)},ru=(e,t,n={})=>r=>{const{libraryOptions:a,target:i}=r??{},s=Z1({...a??{},target:i,io:t,processors:n});return Xt(e,s),K1(s,e),X1(s,e)},lU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},cU=(e,t,n,r)=>{const a=n;a.type="string";const{minimum:i,maximum:s,format:o,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(a.minLength=i),typeof s=="number"&&(a.maxLength=s),o&&(a.format=lU[o]??o,a.format===""&&delete a.format,o==="time"&&delete a.format),l&&(a.contentEncoding=l),u&&u.size>0){const p=[...u];p.length===1?a.pattern=p[0].source:p.length>1&&(a.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},dU=(e,t,n,r)=>{const a=n,{minimum:i,maximum:s,format:o,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:p}=e._zod.bag;typeof o=="string"&&o.includes("int")?a.type="integer":a.type="number";const d=typeof p=="number"&&p>=(i??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(a.minimum=p,a.exclusiveMinimum=!0):a.exclusiveMinimum=p:typeof i=="number"&&(a.minimum=i),f?m?(a.maximum=l,a.exclusiveMaximum=!0):a.exclusiveMaximum=l:typeof s=="number"&&(a.maximum=s),typeof u=="number"&&(a.multipleOf=u)},pU=(e,t,n,r)=>{n.type="boolean"},fU=(e,t,n,r)=>{n.not={}},mU=(e,t,n,r)=>{},hU=(e,t,n,r)=>{const a=e._zod.def,i=C1(a.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},gU=(e,t,n,r)=>{const a=e._zod.def,i=[];for(const s of a.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},bU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},EU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},yU=(e,t,n,r)=>{const a=n,i=e._zod.def,{minimum:s,maximum:o}=e._zod.bag;typeof s=="number"&&(a.minItems=s),typeof o=="number"&&(a.maxItems=o),a.type="array",a.items=Xt(i.element,t,{...r,path:[...r.path,"items"]})},xU=(e,t,n,r)=>{const a=n,i=e._zod.def;a.type="object",a.properties={};const s=i.shape;for(const l in s)a.properties[l]=Xt(s[l],t,{...r,path:[...r.path,"properties",l]});const o=new Set(Object.keys(s)),u=new Set([...o].filter(l=>{const p=i.shape[l]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));u.size>0&&(a.required=Array.from(u)),i.catchall?._zod.def.type==="never"?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=Xt(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},TU=(e,t,n,r)=>{const a=e._zod.def,i=a.inclusive===!1,s=a.options.map((o,u)=>Xt(o,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},SU=(e,t,n,r)=>{const a=e._zod.def,i=Xt(a.left,t,{...r,path:[...r.path,"allOf",0]}),s=Xt(a.right,t,{...r,path:[...r.path,"allOf",1]}),o=l=>"allOf"in l&&Object.keys(l).length===1,u=[...o(i)?i.allOf:[i],...o(s)?s.allOf:[s]];n.allOf=u},AU=(e,t,n,r)=>{const a=n,i=e._zod.def;a.type="object";const s=i.keyType,u=s._zod.bag?.patterns;if(i.mode==="loose"&&u&&u.size>0){const p=Xt(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});a.patternProperties={};for(const d of u)a.patternProperties[d.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(a.propertyNames=Xt(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),a.additionalProperties=Xt(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const l=s._zod.values;if(l){const p=[...l].filter(d=>typeof d=="string"||typeof d=="number");p.length>0&&(a.required=p)}},vU=(e,t,n,r)=>{const a=e._zod.def,i=Xt(a.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=a.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},wU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType},_U=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},NU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},CU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType;let s;try{s=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},IU=(e,t,n,r)=>{const a=e._zod.def,i=a.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?a.out:a.in:a.out;Xt(s,t,r);const o=t.seen.get(e);o.ref=s},kU=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,n.readOnly=!0},Q1=(e,t,n,r)=>{const a=e._zod.def;Xt(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType},RU=Q("ZodISODateTime",(e,t)=>{DB.init(e,t),$t.init(e,t)});function DU(e){return B8(RU,e)}const OU=Q("ZodISODate",(e,t)=>{OB.init(e,t),$t.init(e,t)});function LU(e){return U8(OU,e)}const FU=Q("ZodISOTime",(e,t)=>{LB.init(e,t),$t.init(e,t)});function MU(e){return j8(FU,e)}const PU=Q("ZodISODuration",(e,t)=>{FB.init(e,t),$t.init(e,t)});function BU(e){return $8(PU,e)}const UU=(e,t)=>{D1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>v5(e,n)},flatten:{value:n=>A5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Jc,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Jc,2)}},isEmpty:{get(){return e.issues.length===0}}})},nr=Q("ZodError",UU,{Parent:Error}),jU=Gg(nr),$U=Wg(nr),zU=al(nr),HU=il(nr),GU=N5(nr),WU=C5(nr),VU=I5(nr),qU=k5(nr),YU=R5(nr),ZU=D5(nr),KU=O5(nr),XU=L5(nr),J0=new WeakMap;function Gs(e,t,n){const r=Object.getPrototypeOf(e);let a=J0.get(r);if(a||(a=new Set,J0.set(r,a)),!a.has(t)){a.add(t);for(const i in n){const s=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const o=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:o}),o},set(o){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:o})}})}}}const jt=Q("ZodType",(e,t)=>(Ut.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ru(e,"input"),output:ru(e,"output")}}),e.toJSONSchema=uU(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>jU(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>zU(e,n,r),e.parseAsync=async(n,r)=>$U(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>HU(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>GU(e,n,r),e.decode=(n,r)=>WU(e,n,r),e.encodeAsync=async(n,r)=>VU(e,n,r),e.decodeAsync=async(n,r)=>qU(e,n,r),e.safeEncode=(n,r)=>YU(e,n,r),e.safeDecode=(n,r)=>ZU(e,n,r),e.safeEncodeAsync=async(n,r)=>KU(e,n,r),e.safeDecodeAsync=async(n,r)=>XU(e,n,r),Gs(e,"ZodType",{check(...n){const r=this.def;return this.clone(Jr(r,{checks:[...r.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return ea(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(Hj(n,r))},superRefine(n,r){return this.check(Gj(n,r))},overwrite(n){return this.check(gi(n))},optional(){return ry(this)},exactOptional(){return kj(this)},nullable(){return ay(this)},nullish(){return ry(ay(this))},nonoptional(n){return Mj(this,n)},array(){return Jn(this)},or(n){return vj([this,n])},and(n){return _j(this,n)},transform(n){return iy(this,tA(n))},default(n){return Oj(this,n)},prefault(n){return Fj(this,n)},catch(n){return Bj(this,n)},pipe(n){return iy(this,n)},readonly(){return $j(this)},describe(n){const r=this.clone();return zi.add(r,{description:n}),r},meta(...n){if(n.length===0)return zi.get(this);const r=this.clone();return zi.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return zi.get(e)?.description},configurable:!0}),e)),J1=Q("_ZodString",(e,t)=>{Vg.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(r,a,i)=>cU(e,r,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Gs(e,"_ZodString",{regex(...r){return this.check(q8(...r))},includes(...r){return this.check(K8(...r))},startsWith(...r){return this.check(X8(...r))},endsWith(...r){return this.check(Q8(...r))},min(...r){return this.check(nu(...r))},max(...r){return this.check(q1(...r))},length(...r){return this.check(Y1(...r))},nonempty(...r){return this.check(nu(1,...r))},lowercase(r){return this.check(Y8(r))},uppercase(r){return this.check(Z8(r))},trim(){return this.check(eU())},normalize(...r){return this.check(J8(...r))},toLowerCase(){return this.check(tU())},toUpperCase(){return this.check(nU())},slugify(){return this.check(rU())}})}),QU=Q("ZodString",(e,t)=>{Vg.init(e,t),J1.init(e,t),e.email=n=>e.check(b8(JU,n)),e.url=n=>e.check(S8(ej,n)),e.jwt=n=>e.check(P8(hj,n)),e.emoji=n=>e.check(A8(tj,n)),e.guid=n=>e.check(Z0(ey,n)),e.uuid=n=>e.check(E8(bo,n)),e.uuidv4=n=>e.check(y8(bo,n)),e.uuidv6=n=>e.check(x8(bo,n)),e.uuidv7=n=>e.check(T8(bo,n)),e.nanoid=n=>e.check(v8(nj,n)),e.guid=n=>e.check(Z0(ey,n)),e.cuid=n=>e.check(w8(rj,n)),e.cuid2=n=>e.check(_8(aj,n)),e.ulid=n=>e.check(N8(ij,n)),e.base64=n=>e.check(L8(pj,n)),e.base64url=n=>e.check(F8(fj,n)),e.xid=n=>e.check(C8(sj,n)),e.ksuid=n=>e.check(I8(oj,n)),e.ipv4=n=>e.check(k8(uj,n)),e.ipv6=n=>e.check(R8(lj,n)),e.cidrv4=n=>e.check(D8(cj,n)),e.cidrv6=n=>e.check(O8(dj,n)),e.e164=n=>e.check(M8(mj,n)),e.datetime=n=>e.check(DU(n)),e.date=n=>e.check(LU(n)),e.time=n=>e.check(MU(n)),e.duration=n=>e.check(BU(n))});function oe(e){return g8(QU,e)}const $t=Q("ZodStringFormat",(e,t)=>{Mt.init(e,t),J1.init(e,t)}),JU=Q("ZodEmail",(e,t)=>{AB.init(e,t),$t.init(e,t)}),ey=Q("ZodGUID",(e,t)=>{TB.init(e,t),$t.init(e,t)}),bo=Q("ZodUUID",(e,t)=>{SB.init(e,t),$t.init(e,t)}),ej=Q("ZodURL",(e,t)=>{vB.init(e,t),$t.init(e,t)}),tj=Q("ZodEmoji",(e,t)=>{wB.init(e,t),$t.init(e,t)}),nj=Q("ZodNanoID",(e,t)=>{_B.init(e,t),$t.init(e,t)}),rj=Q("ZodCUID",(e,t)=>{NB.init(e,t),$t.init(e,t)}),aj=Q("ZodCUID2",(e,t)=>{CB.init(e,t),$t.init(e,t)}),ij=Q("ZodULID",(e,t)=>{IB.init(e,t),$t.init(e,t)}),sj=Q("ZodXID",(e,t)=>{kB.init(e,t),$t.init(e,t)}),oj=Q("ZodKSUID",(e,t)=>{RB.init(e,t),$t.init(e,t)}),uj=Q("ZodIPv4",(e,t)=>{MB.init(e,t),$t.init(e,t)}),lj=Q("ZodIPv6",(e,t)=>{PB.init(e,t),$t.init(e,t)}),cj=Q("ZodCIDRv4",(e,t)=>{BB.init(e,t),$t.init(e,t)}),dj=Q("ZodCIDRv6",(e,t)=>{UB.init(e,t),$t.init(e,t)}),pj=Q("ZodBase64",(e,t)=>{jB.init(e,t),$t.init(e,t)}),fj=Q("ZodBase64URL",(e,t)=>{zB.init(e,t),$t.init(e,t)}),mj=Q("ZodE164",(e,t)=>{HB.init(e,t),$t.init(e,t)}),hj=Q("ZodJWT",(e,t)=>{WB.init(e,t),$t.init(e,t)}),eA=Q("ZodNumber",(e,t)=>{z1.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(r,a,i)=>dU(e,r,a),Gs(e,"ZodNumber",{gt(r,a){return this.check(X0(r,a))},gte(r,a){return this.check(ec(r,a))},min(r,a){return this.check(ec(r,a))},lt(r,a){return this.check(K0(r,a))},lte(r,a){return this.check(Jl(r,a))},max(r,a){return this.check(Jl(r,a))},int(r){return this.check(ty(r))},safe(r){return this.check(ty(r))},positive(r){return this.check(X0(0,r))},nonnegative(r){return this.check(ec(0,r))},negative(r){return this.check(K0(0,r))},nonpositive(r){return this.check(Jl(0,r))},multipleOf(r,a){return this.check(Q0(r,a))},step(r,a){return this.check(Q0(r,a))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ol(e){return z8(eA,e)}const gj=Q("ZodNumberFormat",(e,t)=>{VB.init(e,t),eA.init(e,t)});function ty(e){return H8(gj,e)}const bj=Q("ZodBoolean",(e,t)=>{qB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>pU(e,n,r)});function pa(e){return G8(bj,e)}const Ej=Q("ZodUnknown",(e,t)=>{YB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>mU()});function Ja(){return W8(Ej)}const yj=Q("ZodNever",(e,t)=>{ZB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>fU(e,n,r)});function xj(e){return V8(yj,e)}const Tj=Q("ZodArray",(e,t)=>{KB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>yU(e,n,r,a),e.element=t.element,Gs(e,"ZodArray",{min(n,r){return this.check(nu(n,r))},nonempty(n){return this.check(nu(1,n))},max(n,r){return this.check(q1(n,r))},length(n,r){return this.check(Y1(n,r))},unwrap(){return this.element}})});function Jn(e,t){return aU(Tj,e,t)}const Sj=Q("ZodObject",(e,t)=>{QB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>xU(e,n,r,a),vt(e,"shape",()=>t.shape),Gs(e,"ZodObject",{keyof(){return xt(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Ja()})},loose(){return this.clone({...this._zod.def,catchall:Ja()})},strict(){return this.clone({...this._zod.def,catchall:xj()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return b5(this,n)},safeExtend(n){return E5(this,n)},merge(n){return y5(this,n)},pick(n){return h5(this,n)},omit(n){return g5(this,n)},partial(...n){return x5(nA,this,n[0])},required(...n){return T5(rA,this,n[0])}})});function Ge(e,t){const n={type:"object",shape:e??{},...Oe(t)};return new Sj(n)}const Aj=Q("ZodUnion",(e,t)=>{JB.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>TU(e,n,r,a),e.options=t.options});function vj(e,t){return new Aj({type:"union",options:e,...Oe(t)})}const wj=Q("ZodIntersection",(e,t)=>{e8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>SU(e,n,r,a)});function _j(e,t){return new wj({type:"intersection",left:e,right:t})}const ny=Q("ZodRecord",(e,t)=>{t8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>AU(e,n,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function qg(e,t,n){return!t||!t._zod?new ny({type:"record",keyType:oe(),valueType:e,...Oe(t)}):new ny({type:"record",keyType:e,valueType:t,...Oe(n)})}const td=Q("ZodEnum",(e,t)=>{n8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(r,a,i)=>hU(e,r,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new td({...t,checks:[],...Oe(a),entries:i})},e.exclude=(r,a)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new td({...t,checks:[],...Oe(a),entries:i})}});function xt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new td({type:"enum",entries:n,...Oe(t)})}const Nj=Q("ZodLiteral",(e,t)=>{r8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>gU(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function kr(e,t){return new Nj({type:"literal",values:Array.isArray(e)?e:[e],...Oe(t)})}const Cj=Q("ZodTransform",(e,t)=>{a8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>EU(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new N1(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ts(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Ts(s))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function tA(e){return new Cj({type:"transform",transform:e})}const nA=Q("ZodOptional",(e,t)=>{W1.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Q1(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function ry(e){return new nA({type:"optional",innerType:e})}const Ij=Q("ZodExactOptional",(e,t)=>{i8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Q1(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function kj(e){return new Ij({type:"optional",innerType:e})}const Rj=Q("ZodNullable",(e,t)=>{s8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>vU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function ay(e){return new Rj({type:"nullable",innerType:e})}const Dj=Q("ZodDefault",(e,t)=>{o8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>_U(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Oj(e,t){return new Dj({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k1(t)}})}const Lj=Q("ZodPrefault",(e,t)=>{u8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>NU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function Fj(e,t){return new Lj({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k1(t)}})}const rA=Q("ZodNonOptional",(e,t)=>{l8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>wU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function Mj(e,t){return new rA({type:"nonoptional",innerType:e,...Oe(t)})}const Pj=Q("ZodCatch",(e,t)=>{c8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>CU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bj(e,t){return new Pj({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const aA=Q("ZodPipe",(e,t)=>{V1.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>IU(e,n,r,a),e.in=t.in,e.out=t.out});function iy(e,t){return new aA({type:"pipe",in:e,out:t})}const Uj=Q("ZodPreprocess",(e,t)=>{aA.init(e,t),d8.init(e,t)}),jj=Q("ZodReadonly",(e,t)=>{p8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>kU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function $j(e){return new jj({type:"readonly",innerType:e})}const zj=Q("ZodCustom",(e,t)=>{f8.init(e,t),jt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>bU(e,n)});function Hj(e,t={}){return iU(zj,e,t)}function Gj(e,t){return sU(e,t)}function tc(e,t){return new Uj({type:"pipe",in:tA(e),out:t})}const va=["backlog","todo","wip","testing","blocked","done","cancelled"],bi=["backlog","active","verifying","blocked","done","cancelled"],Wj={backlog:"📋",todo:"🔲",wip:"🚧",testing:"🧪",blocked:"🚫",done:"✅",cancelled:"⛔"};function Yg(e){try{return Wj[sA(e)]??""}catch{return""}}const ul=["P0","P1","P2","P3"],Vj=["simple","standard","complex","research","refine","plan","unit","review","docs"],iA=["task","issue","review","meta","brainstorm"],ll=["standard","feature-impl","issue","review","meta","brainstorm"],Zg=/^[A-Z][1-9]*$/,qj={completed:"done",complete:"done","in-progress":"wip","in progress":"wip",in_progress:"wip",dropped:"cancelled",cancel:"cancelled",canceled:"cancelled",new:"backlog",pending:"backlog",blocked:"blocked",wip:"wip",testing:"testing",done:"done",cancelled:"cancelled",backlog:"backlog",todo:"todo"};function sA(e){const t=e.trim().toLowerCase(),n=qj[t];if(n===void 0)throw new Error(`Unknown task status: ${JSON.stringify(e)} (allowed: ${va.join(", ")})`);return n}const au=oe().min(1).refine(e=>!Number.isNaN(Date.parse(e)),{message:"must be an ISO 8601 timestamp"}),oA=oe().regex(Zg,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}).nullable().optional(),uA=oe().regex(/^\d{4}$/,{message:"parent_wbs must be a 4-digit WBS string"}).nullable().optional();Ge({schema_version:kr(1),name:oe().min(1),description:oe().optional(),status:tc(e=>{if(typeof e=="string")try{return sA(e)}catch{}return e},xt(va)),type:xt(iA).optional().default("task"),template:xt(ll).optional(),profile:xt(Vj).optional(),feature_id:oA,parent_wbs:uA,priority:xt(ul).optional(),tags:Jn(oe()).optional(),dependencies:Jn(oe()).optional(),ac_numbering:kr("task-local").optional(),ac_altitude:xt(["graduating","task-local"]).optional(),done_forced:tc(e=>typeof e=="string"?e==="true":e,pa().optional()),done_reason:oe().optional(),feature_link_declined:tc(e=>typeof e=="string"?e==="true":e,pa().optional()),created_at:au,updated_at:au});Ge({schema_version:kr(1),id:oe().regex(Zg,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),name:oe().min(1),status:xt(bi),priority:xt(ul).optional(),tags:Jn(oe()).optional(),created_at:au,updated_at:au});const Yj=Ge({name:oe().min(1,"name is required"),background:oe().optional(),requirements:oe().optional(),design:oe().optional(),plan:oe().optional(),acceptance_criteria:oe().optional(),feature_id:oA,parent_wbs:uA,priority:xt(ul).optional(),tags:Jn(oe()).optional(),template:xt(ll).optional()}).strict();Jn(Yj).min(1,"batch must contain at least one task");const Zj=["NOT_FOUND","VALIDATION_FAILED","GUARD_DENIED","LOCK_TIMEOUT","CONFLICT","INTERNAL_ERROR"];function Qt(e){return Ge({ok:kr(!0),data:e})}Ge({ok:kr(!1),error:Ge({code:xt(Zj),message:oe(),details:Ja().optional()})});Ge({nextCursor:oe().optional(),hasMore:pa(),limit:ol().int().positive()});const Hn=oe().regex(Zg,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),Kj=Ge({id:Hn,name:oe().min(1),status:xt(bi),priority:xt(ul).optional(),parentId:Hn.nullable().optional(),wbsCount:ol().int().nonnegative().optional()}),Xj=Qt(Jn(Kj)),Qj=Qt(Ge({id:Hn,name:oe(),status:xt(bi),frontmatter:qg(oe(),Ja()),content:oe(),filePath:oe()})),Jj=Ge({id:Hn}),e9=Ge({name:oe().min(1),parentId:Hn.optional()}),t9=Qt(Ge({id:oe(),filePath:oe()})),n9=Ge({id:Hn,toStatus:xt(bi),actor:oe().optional()}),r9=Qt(Ge({id:oe(),status:xt(bi)})),a9=Ge({id:Hn,body:oe(),actor:oe().optional()}),i9=Qt(Ge({})),s9=xt(["brainstorm","plan"]),o9=xt(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),u9=Ge({id:Hn,action:s9,channel:o9.optional(),skipDeps:pa().optional()}),l9=Ge({runId:oe(),action:oe(),status:kr("queued")}),c9=Qt(l9),d9=Ge({id:Hn,name:oe().min(1)}),p9=Qt(Ge({id:oe(),filePath:oe()})),f9=Ge({id:Hn,title:oe().min(1)}),m9=Qt(Ge({wbs:oe(),filePath:oe()})),h9=Ge({id:Hn,wbs:oe().regex(/^\d{4}$/)}),g9=Qt(Ge({})),lA=xt(["pull","push"]),b9=Ge({id:Hn,direction:lA}),E9=Qt(Ge({direction:lA,affectedTasks:ol().int().nonnegative(),applied:pa(),newStatus:oe().optional()})),y9={list:Ht.route({method:"GET",path:"/features",summary:"List features",tags:["feature"]}).output(Xj),show:Ht.route({method:"GET",path:"/features/{id}",summary:"Show feature detail",tags:["feature"]}).input(Jj).output(Qj),create:Ht.route({method:"POST",path:"/features",summary:"Create a feature",tags:["feature"]}).input(e9).output(t9),transition:Ht.route({method:"PATCH",path:"/features/{id}/status",summary:"Transition feature status",tags:["feature"]}).input(n9).output(r9),refresh:Ht.route({method:"POST",path:"/features/refresh",summary:"Refresh feature index and kanban",tags:["feature"]}).output(Qt(Ge({rebuilt:ol().int().nonnegative()}))),check:Ht.route({method:"POST",path:"/features/{id}/check",summary:"Run the four-layer feature check",tags:["feature"]}).input(Ge({id:Hn})).output(Qt(Ge({id:oe(),status:oe(),pass:pa(),findings:Jn(Ge({layer:xt(["L1","L2","L3","L4"]),severity:xt(["error","warning","info"]),section:oe(),message:oe()})),requiredSections:Jn(oe()),missingSections:Jn(oe())}))),body:Ht.route({method:"PATCH",path:"/features/{id}/body",summary:"Update feature body",tags:["feature"]}).input(a9).output(i9),action:Ht.route({method:"POST",path:"/features/{id}/action",summary:"Run a feature workflow action",tags:["feature"]}).input(u9).output(c9),children:Ht.route({method:"POST",path:"/features/{id}/children",summary:"Create a child feature",tags:["feature"]}).input(d9).output(p9),tasks:Ht.route({method:"POST",path:"/features/{id}/tasks",summary:"Create a task linked to feature",tags:["feature"]}).input(f9).output(m9),link:Ht.route({method:"PATCH",path:"/features/{id}/link",summary:"Link an existing task to feature",tags:["feature"]}).input(h9).output(g9),sync:Ht.route({method:"POST",path:"/features/{id}/sync",summary:"Sync feature status with linked tasks",tags:["feature"]}).input(b9).output(E9)},x9=Qt(Ge({eventName:oe(),occurredAt:oe().datetime(),actor:oe().nullable().optional(),payload:qg(oe(),Ja())})),T9={stream:Ht.route({method:"GET",path:"/events/planning",summary:"Stream planning events (SSE)",tags:["events"]}).output(x9)},S9=Ge({wbs:oe().regex(/^\d{4}$/),name:oe().min(1),status:xt(va),priority:oe().optional(),featureId:oe().nullable().optional(),parentWbs:oe().regex(/^\d{4}$/).nullable().optional(),type:xt(iA).optional(),filePath:oe(),updatedAt:oe().optional()}),A9=Qt(Jn(S9)),v9=Ge({folder:oe().optional(),status:oe().optional(),parent:oe().optional()}),w9=Qt(Ge({wbs:oe(),name:oe(),status:xt(va),frontmatter:qg(oe(),Ja()),content:oe(),filePath:oe()})),_9=Ge({wbs:oe().regex(/^\d{4}$/)}),N9=Ge({title:oe().min(1),featureId:oe().optional(),parentWbs:oe().regex(/^\d{4}$/).optional(),folder:oe().optional(),template:xt(ll).optional()}),C9=Qt(Ge({wbs:oe(),filePath:oe()})),I9=Ge({wbs:oe().regex(/^\d{4}$/),toStatus:xt(va),actor:oe().optional()}),k9=Qt(Ge({wbs:oe(),status:xt(va)})),R9=Ge({wbs:oe().regex(/^\d{4}$/),body:oe(),actor:oe().optional()}),D9=Qt(Ge({wbs:oe(),filePath:oe()})),O9=xt(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),L9=xt(["refine","plan","run","verify","decompose","evaluate"]),F9=Ge({wbs:oe().regex(/^\d{4}$/),action:L9,channel:O9.optional(),skipDeps:pa().optional()}),M9=Qt(Ge({runId:oe(),action:oe(),status:kr("queued")})),P9=Ge({path:oe(),label:oe().optional()}),B9=Qt(Jn(P9)).extend({activeFolder:oe().optional()}),U9={list:Ht.route({method:"GET",path:"/tasks",summary:"List tasks",tags:["task"]}).input(v9).output(A9),folders:Ht.route({method:"GET",path:"/tasks/folders",summary:"List configured task folders",tags:["task"]}).output(B9),show:Ht.route({method:"GET",path:"/tasks/{wbs}",summary:"Show task detail",tags:["task"]}).input(_9).output(w9),create:Ht.route({method:"POST",path:"/tasks",summary:"Create a task",tags:["task"]}).input(N9).output(C9),transition:Ht.route({method:"PATCH",path:"/tasks/{wbs}/status",summary:"Transition task status",tags:["task"]}).input(I9).output(k9),body:Ht.route({method:"PATCH",path:"/tasks/{wbs}/body",summary:"Update task body",tags:["task"]}).input(R9).output(D9),action:Ht.route({method:"POST",path:"/tasks/{wbs}/actions",summary:"Run a task action",tags:["task"]}).input(F9).output(M9)},j9=Ge({status:kr("ok"),timestamp:oe(),service:kr("spur"),version:oe()}),$9={health:Ht.route({method:"GET",path:"/health",summary:"Read application health",tags:["system"]}).output(j9),task:{...U9},feature:{...y9},...T9};class z9 extends w1{initRuntimeAdapter(t){for(const n of this.plugins)n.initRuntimeAdapter?.(t)}}class H9{fetch;toFetchRequestOptions;adapterInterceptors;constructor(t){new z9(t.plugins).initRuntimeAdapter(t),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=t,this.adapterInterceptors=Qo(t.adapterInterceptors)}async call(t,n,r,a){const i=KP(t,this.toFetchRequestOptions),s=await Zc(this.adapterInterceptors,{...n,request:i,path:r,input:a,init:{redirect:"manual"}},({request:u,path:l,input:p,init:d,...f})=>this.fetch(u,d,f,l,p));return XP(s,{signal:i.signal})}}class G9{maxArrayIndex;constructor(t={}){this.maxArrayIndex=t.maxBracketNotationArrayIndex??9999}serialize(t,n=[],r=[]){if(Array.isArray(t))t.forEach((a,i)=>{this.serialize(a,[...n,i],r)});else if(Yr(t))for(const a in t)this.serialize(t[a],[...n,a],r);else r.push([this.stringifyPath(n),t]);return r}deserialize(t){if(t.length===0)return{};const n=new WeakSet,r={value:[]};for(const[a,i]of t){const s=this.parsePath(a);let o=r,u="value";s.forEach((l,p)=>{!Array.isArray(o[u])&&!Yr(o[u])&&(o[u]=[]),p!==s.length-1?Array.isArray(o[u])&&!sy(l,this.maxArrayIndex)&&(n.has(o[u])?(n.delete(o[u]),o[u]=oy(o[u])):o[u]=nc(o[u])):Array.isArray(o[u])&&(l===""?o[u].length&&!n.has(o[u])&&(o[u]=nc(o[u])):n.has(o[u])?(n.delete(o[u]),o[u]=oy(o[u])):sy(l,this.maxArrayIndex)||(o[u]=nc(o[u]))),o=o[u],u=l}),Array.isArray(o)&&u===""?(n.add(o),o.push(i)):u in o?Array.isArray(o[u])?o[u].push(i):o[u]=[o[u],i]:o[u]=i}return r.value}stringifyPath(t){return t.map(n=>n.toString().replace(/[\\[\]]/g,r=>{switch(r){case"\\":return"\\\\";case"[":return"\\[";case"]":return"\\]";default:return r}})).reduce((n,r,a)=>a===0?r:`${n}[${r}]`,"")}parsePath(t){const n=[];let r=!1,a="",i=0;for(let s=0;s<t.length;s++){const o=t[s],u=t[s+1];r&&o==="]"&&(u===void 0||u==="[")&&i%2===0?(u===void 0&&(r=!1),n.push(a),a="",s++):n.length===0&&o==="["&&i%2===0?(r=!0,n.push(a),a=""):o==="\\"?i++:(a+="\\".repeat(i/2)+o,i=0)}return r||n.length===0?[t]:n}}function sy(e,t){return/^0$|^[1-9]\d*$/.test(e)&&Number(e)<=t}function nc(e){const t=new f1;return e.forEach((n,r)=>{t[r]=n}),t}function oy(e){const t=new f1;return t[""]=e.length===1?e[0]:e,t}class W9{customSerializers;constructor(t={}){this.customSerializers=t.customJsonSerializers??[]}serialize(t,n={value:!1}){for(const r of this.customSerializers)if(r.condition(t))return this.serialize(r.serialize(t),n);if(t instanceof Blob)return n.value=!0,[t,n.value];if(t instanceof Set)return this.serialize(Array.from(t),n);if(t instanceof Map)return this.serialize(Array.from(t.entries()),n);if(Array.isArray(t))return[t.map(a=>a===void 0?null:this.serialize(a,n)[0]),n.value];if(Yr(t)){const r={};for(const a in t)a==="toJSON"&&typeof t[a]=="function"||(r[a]=this.serialize(t[a],n)[0]);return[r,n.value]}return typeof t=="bigint"||t instanceof RegExp||t instanceof URL?[t.toString(),n.value]:t instanceof Date?[Number.isNaN(t.getTime())?null:t.toISOString(),n.value]:Number.isNaN(t)?[null,n.value]:[t,n.value]}}function nd(e){return`/${e.replace(/\/{2,}/g,"/").replace(/^\/|\/$/g,"")}`}function uy(e){return e?nd(e).match(/\/\{[^}]+\}/g)?.map(t=>({raw:t,name:t.match(/\{\+?([^}]+)\}/)[1]})):void 0}class V9{constructor(t,n,r){this.contract=t,this.serializer=n,this.baseUrl=r.url,this.headers=r.headers??{},this.customErrorResponseBodyDecoder=r.customErrorResponseBodyDecoder}baseUrl;headers;customErrorResponseBodyDecoder;async encode(t,n,r){let a=JP(await D0(this.headers,r,t,n));r.lastEventId!==void 0&&(a=O0(a,{"last-event-id":r.lastEventId}));const i=await D0(this.baseUrl,r,t,n),s=R0(this.contract,t);if(!Qc(s))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${t.join(".")}`);return mo("defaultInputStructure",s["~orpc"].route.inputStructure)==="compact"?this.#e(s,t,n,r,i,a):this.#t(s,t,n,r,i,a)}#e(t,n,r,a,i,s){let o=nd(t["~orpc"].route.path??F0(n)),u=r;const l=uy(o);if(l?.length){if(!Yr(r))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "compact" structure when has dynamic params at ${n.join(".")}.`);const f={...r};for(const m of l){const b=r[m.name];o=o.replace(m.raw,`/${encodeURIComponent(`${this.serializer.serialize(b)}`)}`),delete f[m.name]}u=Object.keys(f).length?f:void 0}const p=mo("defaultMethod",t["~orpc"].route.method),d=new URL(i);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,p==="GET"){const f=this.serializer.serialize(u,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b);return{url:d,method:p,headers:s,body:void 0,signal:a.signal}}return{url:d,method:p,headers:s,body:this.serializer.serialize(u),signal:a.signal}}#t(t,n,r,a,i,s){let o=nd(t["~orpc"].route.path??F0(n));const u=uy(o);if(!Yr(r)&&r!==void 0)throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "detailed" structure at ${n.join(".")}.`);if(u?.length){if(!Yr(r?.params))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.params shape for "detailed" structure when has dynamic params at ${n.join(".")}.`);for(const f of u){const m=r.params[f.name];o=o.replace(f.raw,`/${encodeURIComponent(`${this.serializer.serialize(m)}`)}`)}}let l=s;if(r?.headers!==void 0){if(!Yr(r.headers))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.headers shape for "detailed" structure at ${n.join(".")}.`);l=O0(r.headers,s)}const p=mo("defaultMethod",t["~orpc"].route.method),d=new URL(i);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,r?.query!==void 0){const f=this.serializer.serialize(r.query,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b)}return p==="GET"?{url:d,method:p,headers:l,body:void 0,signal:a.signal}:{url:d,method:p,headers:l,body:this.serializer.serialize(r?.body),signal:a.signal}}async decode(t,n,r){const a=!ys(t.status),i=await(async()=>{let u=!1;try{const l=await t.body();return u=!0,this.serializer.deserialize(l)}catch(l){throw u?new Error("Invalid OpenAPI response format.",{cause:l}):new Error("Cannot parse response body, please check the response body and content-type.",{cause:l})}})();if(!a){const u=this.customErrorResponseBodyDecoder?.(i,t);throw u??(g1(i)?b1(i):new Es(e5(t.status),{status:t.status,data:{...t,body:i}}))}const s=R0(this.contract,r);if(!Qc(s))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${r.join(".")}`);return mo("defaultOutputStructure",s["~orpc"].route.outputStructure)==="compact"?i:{status:t.status,headers:t.headers,body:i}}}class q9{constructor(t,n){this.jsonSerializer=t,this.bracketNotation=n}serialize(t,n={}){return bs(t)&&!n.outputFormat?L0(t,{value:async r=>this.#e(r,{outputFormat:"plain"}),error:async r=>new xs({data:this.#e(LP(r).toJSON(),{outputFormat:"plain"}),cause:r})}):this.#e(t,n)}#e(t,n){const[r,a]=this.jsonSerializer.serialize(t);if(n.outputFormat==="plain")return r;if(n.outputFormat==="URLSearchParams"){const s=new URLSearchParams;for(const[o,u]of this.bracketNotation.serialize(r))(typeof u=="string"||typeof u=="number"||typeof u=="boolean")&&s.append(o,u.toString());return s}if(r instanceof Blob||r===void 0||!a)return r;const i=new FormData;for(const[s,o]of this.bracketNotation.serialize(r))typeof o=="string"||typeof o=="number"||typeof o=="boolean"?i.append(s,o.toString()):o instanceof Blob&&i.append(s,o);return i}deserialize(t){return t instanceof URLSearchParams||t instanceof FormData?this.bracketNotation.deserialize(Array.from(t.entries())):bs(t)?L0(t,{value:async n=>n,error:async n=>n instanceof xs&&g1(n.data)?b1(n.data,{cause:n}):n}):t}}class Y9 extends QP{constructor(t,n,r){const a=new W9(r),i=new G9({maxBracketNotationArrayIndex:4294967294}),s=new q9(a,i),o=new V9(t,s,r);super(o,n,r)}}class Z9 extends Y9{constructor(t,n){const r=new H9(n);super(t,r,n)}}function et(e=void 0,t=globalThis.location?.origin,n=!1){return e||(t&&t!=="null"?new URL("/api",t).toString():"http://localhost:3000/api")}function Ke(e,t=1e4){const n=new AbortController,r=setTimeout(()=>n.abort(),t),a=e.signal;a&&a.addEventListener("abort",()=>n.abort(),{once:!0});const i=new Request(e,{signal:n.signal});return fetch(i).finally(()=>clearTimeout(r))}function K9(e){return Ke(e)}function X9(e){typeof globalThis<"u"&&globalThis.dispatchEvent&&globalThis.dispatchEvent(new CustomEvent("api-error",{detail:{message:e instanceof Error?e.message:String(e)}}))}const _r=S1(new Z9($9,{url:et(),fetch:K9,adapterInterceptors:[wP(X9)]})),Sr=()=>`${et()}/features`;async function Q9(e){const t=await Ke(new Request(Sr(),{signal:e}));if(!t.ok)throw new Error(`feature list fetch failed: ${t.status}`);const r=await t.json();if(!r.ok||!Array.isArray(r.data))throw new Error("feature list: invalid response shape");return r.data}async function ly(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e)}`,{signal:t}));if(!n.ok)throw new Error(`feature show fetch failed: ${n.status}`);const a=await n.json();if(!a.ok||!a.data)throw new Error("feature show: invalid response shape");return a.data}async function J9(e,t,n){const r=await Ke(new Request(`${Sr()}/${encodeURIComponent(e)}/status`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,toStatus:t}),signal:n})),a=await r.json();if(!r.ok){const s=a;throw new Error(s.error?.message??`transition failed: ${r.status}`)}return a.data?.status??t}async function e7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/body`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const a=await n.json();throw new Error(a.error?.message??`body update failed: ${n.status}`)}}async function t7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`action dispatch failed: ${n.status}`)}return await n.json()}async function cA(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/children`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`create child failed: ${n.status}`)}return await n.json()}async function n7(e,t){const n=await Ke(new Request(Sr(),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e}),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`create feature failed: ${n.status}`)}const a=await n.json();if(!a.ok||!a.data)throw new Error("create feature: invalid response shape");return a.data}async function r7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/tasks`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`create task failed: ${n.status}`)}return await n.json()}async function a7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/link`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`link task failed: ${n.status}`)}return await n.json()}async function i7(e,t){const n=await Ke(new Request(`${Sr()}/${encodeURIComponent(e.id)}/sync`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`sync failed: ${n.status}`)}return await n.json()}const s7=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),o7=function(e){return"/"+e},cy={},dA=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");a=u(n.map(l=>{if(l=o7(l),l in cy)return;cy[l]=!0;const p=l.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":s7,p||(f.as="script"),f.crossOrigin="",f.href=l,o&&f.setAttribute("nonce",o),document.head.appendChild(f),p)return new Promise((m,b)=>{f.addEventListener("load",m),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return a.then(s=>{for(const o of s||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function dy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u7(e){if(Array.isArray(e))return e}function l7(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,s,o=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(u=(r=i.call(n)).done)&&(o.push(r.value),o.length!==t);u=!0);}catch(p){l=!0,a=p}finally{try{if(!u&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw a}}return o}}function c7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
169
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d7(e,t){return u7(e)||l7(e,t)||p7(e,t)||c7()}function p7(e,t){if(e){if(typeof e=="string")return dy(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dy(e,t):void 0}}const pA=Object.entries,py=Object.setPrototypeOf,f7=Object.isFrozen,m7=Object.getPrototypeOf,h7=Object.getOwnPropertyDescriptor;let hn=Object.freeze,bn=Object.seal,Oa=Object.create,fA=typeof Reflect<"u"&&Reflect,rd=fA.apply,ad=fA.construct;hn||(hn=function(t){return t});bn||(bn=function(t){return t});rd||(rd=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i];return t.apply(n,a)});ad||(ad=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const Fi=Jt(Array.prototype.forEach),g7=Jt(Array.prototype.lastIndexOf),fy=Jt(Array.prototype.pop),ka=Jt(Array.prototype.push),b7=Jt(Array.prototype.splice),Wr=Array.isArray,Hi=Jt(String.prototype.toLowerCase),rc=Jt(String.prototype.toString),my=Jt(String.prototype.match),Mi=Jt(String.prototype.replace),hy=Jt(String.prototype.indexOf),E7=Jt(String.prototype.trim),y7=Jt(Number.prototype.toString),x7=Jt(Boolean.prototype.toString),gy=typeof BigInt>"u"?null:Jt(BigInt.prototype.toString),by=typeof Symbol>"u"?null:Jt(Symbol.prototype.toString),un=Jt(Object.prototype.hasOwnProperty),Pi=Jt(Object.prototype.toString),mn=Jt(RegExp.prototype.test),na=T7(TypeError);function Jt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return rd(e,t,r)}}function T7(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ad(e,n)}}function mt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hi;if(py&&py(e,null),!Wr(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const i=n(a);i!==a&&(f7(t)||(t[r]=i),a=i)}e[a]=!0}return e}function S7(e){for(let t=0;t<e.length;t++)un(e,t)||(e[t]=null);return e}function Cn(e){const t=Oa(null);for(const r of pA(e)){var n=d7(r,2);const a=n[0],i=n[1];un(e,a)&&(Wr(i)?t[a]=S7(i):i&&typeof i=="object"&&i.constructor===Object?t[a]=Cn(i):t[a]=i)}return t}function A7(e){switch(typeof e){case"string":return e;case"number":return y7(e);case"boolean":return x7(e);case"bigint":return gy?gy(e):"0";case"symbol":return by?by(e):"Symbol()";case"undefined":return Pi(e);case"function":case"object":{if(e===null)return Pi(e);const t=e,n=fr(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Pi(r)}return Pi(e)}default:return Pi(e)}}function fr(e,t){for(;e!==null;){const r=h7(e,t);if(r){if(r.get)return Jt(r.get);if(typeof r.value=="function")return Jt(r.value)}e=m7(e)}function n(){return null}return n}function v7(e){try{return mn(e,""),!0}catch{return!1}}const Ey=hn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ac=hn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ic=hn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),w7=hn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sc=hn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_7=hn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yy=hn(["#text"]),xy=hn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),oc=hn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ty=hn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Eo=hn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),N7=bn(/{{[\w\W]*|^[\w\W]*}}/g),C7=bn(/<%[\w\W]*|^[\w\W]*%>/g),I7=bn(/\${[\w\W]*/g),k7=bn(/^data-[\-\w.\u00B7-\uFFFF]+$/),R7=bn(/^aria-[\-\w]+$/),Sy=bn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),D7=bn(/^(?:\w+script|data):/i),O7=bn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),L7=bn(/^html$/i),F7=bn(/^[a-z][.\w]*(-[.\w]+)+$/i),Ay=bn(/<[/\w!]/g),M7=bn(/<[/\w]/g),P7=bn(/<\/no(script|embed|frames)/i),B7=bn(/\/>/i),pr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},U7=function(){return typeof window>"u"?null:window},j7=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},vy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Pr=function(t,n,r,a){return un(t,n)&&Wr(t[n])?mt(a.base?Cn(a.base):{},t[n],a.transform):r};function mA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:U7();const t=fe=>mA(fe);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==pr.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const i=e.HTMLTemplateElement,s=e.Node,o=e.Element,u=e.NodeFilter,l=e.NamedNodeMap;l===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const p=e.DOMParser,d=e.trustedTypes,f=o.prototype,m=fr(f,"cloneNode"),b=fr(f,"remove"),E=fr(f,"nextSibling"),y=fr(f,"childNodes"),x=fr(f,"parentNode"),w=fr(f,"shadowRoot"),T=fr(f,"attributes"),I=s&&s.prototype?fr(s.prototype,"nodeType"):null,R=s&&s.prototype?fr(s.prototype,"nodeName"):null;if(typeof i=="function"){const fe=n.createElement("template");fe.content&&fe.content.ownerDocument&&(n=fe.content.ownerDocument)}let v,A="",N,F=!1,_=0;const M=function(){if(_>0)throw na('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},j=function(L){M(),_++;try{return v.createHTML(L)}finally{_--}},H=function(L){M(),_++;try{return v.createScriptURL(L)}finally{_--}},Z=function(){return F||(N=j7(d,a),F=!0),N},V=n,ie=V.implementation,X=V.createNodeIterator,re=V.createDocumentFragment,ue=V.getElementsByTagName,k=r.importNode;let Y=vy();t.isSupported=typeof pA=="function"&&typeof x=="function"&&ie&&ie.createHTMLDocument!==void 0;const le=N7,D=C7,ke=I7,Le=k7,ve=R7,Ue=D7,Ee=O7,he=F7;let ct=Sy,$e=null;const ge=mt({},[...Ey,...ac,...ic,...sc,...yy]);let Pe=null;const pt=mt({},[...xy,...oc,...Ty,...Eo]);let de=Object.seal(Oa(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),rt=null,Ot=null;const ft=Object.seal(Oa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let kt=!0,wt=!0,zt=!1,nn=!0,ut=!1,Ae=!0,Ye=!1,q=!1,te=null,ye=null,we=!1,je=!1,Ze=!1,_t=!1,St=!0,Et=!1;const Nt="user-content-";let J=!0,be=!1,Fe={},Re=null;const Tt=mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Wt=null;const U=mt({},["audio","video","img","source","image","track"]);let Te=null;const Ne=mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ze="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let At=Ve,rn=!1,Rt=null;const Vt=mt({},[ze,Xe,Ve],rc),P=hn(["mi","mo","mn","ms","mtext"]);let $=mt({},P);const G=hn(["annotation-xml"]);let ee=mt({},G);const se=mt({},["title","style","font","a","script"]);let Se=null;const xe=["application/xhtml+xml","text/html"],_e="text/html";let me=null,Ce=null;const Be=n.createElement("form"),De=function(L){return L instanceof RegExp||L instanceof Function},lt=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ce&&Ce===L)return;(!L||typeof L!="object")&&(L={}),L=Cn(L),Se=xe.indexOf(L.PARSER_MEDIA_TYPE)===-1?_e:L.PARSER_MEDIA_TYPE,me=Se==="application/xhtml+xml"?rc:Hi,$e=Pr(L,"ALLOWED_TAGS",ge,{transform:me}),Pe=Pr(L,"ALLOWED_ATTR",pt,{transform:me}),Rt=Pr(L,"ALLOWED_NAMESPACES",Vt,{transform:rc}),Te=Pr(L,"ADD_URI_SAFE_ATTR",Ne,{transform:me,base:Ne}),Wt=Pr(L,"ADD_DATA_URI_TAGS",U,{transform:me,base:U}),Re=Pr(L,"FORBID_CONTENTS",Tt,{transform:me}),rt=Pr(L,"FORBID_TAGS",Cn({}),{transform:me}),Ot=Pr(L,"FORBID_ATTR",Cn({}),{transform:me}),Fe=un(L,"USE_PROFILES")?L.USE_PROFILES&&typeof L.USE_PROFILES=="object"?Cn(L.USE_PROFILES):L.USE_PROFILES:!1,kt=L.ALLOW_ARIA_ATTR!==!1,wt=L.ALLOW_DATA_ATTR!==!1,zt=L.ALLOW_UNKNOWN_PROTOCOLS||!1,nn=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ut=L.SAFE_FOR_TEMPLATES||!1,Ae=L.SAFE_FOR_XML!==!1,Ye=L.WHOLE_DOCUMENT||!1,je=L.RETURN_DOM||!1,Ze=L.RETURN_DOM_FRAGMENT||!1,_t=L.RETURN_TRUSTED_TYPE||!1,we=L.FORCE_BODY||!1,St=L.SANITIZE_DOM!==!1,Et=L.SANITIZE_NAMED_PROPS||!1,J=L.KEEP_CONTENT!==!1,be=L.IN_PLACE||!1,ct=v7(L.ALLOWED_URI_REGEXP)?L.ALLOWED_URI_REGEXP:Sy,At=typeof L.NAMESPACE=="string"?L.NAMESPACE:Ve,$=un(L,"MATHML_TEXT_INTEGRATION_POINTS")&&L.MATHML_TEXT_INTEGRATION_POINTS&&typeof L.MATHML_TEXT_INTEGRATION_POINTS=="object"?Cn(L.MATHML_TEXT_INTEGRATION_POINTS):mt({},P),ee=un(L,"HTML_INTEGRATION_POINTS")&&L.HTML_INTEGRATION_POINTS&&typeof L.HTML_INTEGRATION_POINTS=="object"?Cn(L.HTML_INTEGRATION_POINTS):mt({},G);const W=un(L,"CUSTOM_ELEMENT_HANDLING")&&L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING=="object"?Cn(L.CUSTOM_ELEMENT_HANDLING):Oa(null);if(de=Oa(null),un(W,"tagNameCheck")&&De(W.tagNameCheck)&&(de.tagNameCheck=W.tagNameCheck),un(W,"attributeNameCheck")&&De(W.attributeNameCheck)&&(de.attributeNameCheck=W.attributeNameCheck),un(W,"allowCustomizedBuiltInElements")&&typeof W.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=W.allowCustomizedBuiltInElements),bn(de),ut&&(wt=!1),Ze&&(je=!0),Fe&&($e=mt({},yy),Pe=Oa(null),Fe.html===!0&&(mt($e,Ey),mt(Pe,xy)),Fe.svg===!0&&(mt($e,ac),mt(Pe,oc),mt(Pe,Eo)),Fe.svgFilters===!0&&(mt($e,ic),mt(Pe,oc),mt(Pe,Eo)),Fe.mathMl===!0&&(mt($e,sc),mt(Pe,Ty),mt(Pe,Eo))),ft.tagCheck=null,ft.attributeCheck=null,un(L,"ADD_TAGS")&&(typeof L.ADD_TAGS=="function"?ft.tagCheck=L.ADD_TAGS:Wr(L.ADD_TAGS)&&($e===ge&&($e=Cn($e)),mt($e,L.ADD_TAGS,me))),un(L,"ADD_ATTR")&&(typeof L.ADD_ATTR=="function"?ft.attributeCheck=L.ADD_ATTR:Wr(L.ADD_ATTR)&&(Pe===pt&&(Pe=Cn(Pe)),mt(Pe,L.ADD_ATTR,me))),un(L,"ADD_URI_SAFE_ATTR")&&Wr(L.ADD_URI_SAFE_ATTR)&&mt(Te,L.ADD_URI_SAFE_ATTR,me),un(L,"FORBID_CONTENTS")&&Wr(L.FORBID_CONTENTS)&&(Re===Tt&&(Re=Cn(Re)),mt(Re,L.FORBID_CONTENTS,me)),un(L,"ADD_FORBID_CONTENTS")&&Wr(L.ADD_FORBID_CONTENTS)&&(Re===Tt&&(Re=Cn(Re)),mt(Re,L.ADD_FORBID_CONTENTS,me)),J&&($e["#text"]=!0),Ye&&mt($e,["html","head","body"]),$e.table&&(mt($e,["tbody"]),delete rt.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw na('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw na('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const pe=v;v=L.TRUSTED_TYPES_POLICY;try{A=j("")}catch(Ie){throw v=pe,Ie}}else L.TRUSTED_TYPES_POLICY===null?(v=void 0,A=""):(v===void 0&&(v=Z()),v&&typeof A=="string"&&(A=j("")));hn&&hn(L),Ce=L},dt=mt({},[...ac,...ic,...w7]),qt=mt({},[...sc,..._7]),Yt=function(L,W,pe){return W.namespaceURI===Ve?L==="svg":W.namespaceURI===ze?L==="svg"&&(pe==="annotation-xml"||$[pe]):!!dt[L]},pn=function(L,W,pe){return W.namespaceURI===Ve?L==="math":W.namespaceURI===Xe?L==="math"&&ee[pe]:!!qt[L]},yt=function(L,W,pe){return W.namespaceURI===Xe&&!ee[pe]||W.namespaceURI===ze&&!$[pe]?!1:!qt[L]&&(se[L]||!dt[L])},Ln=function(L){let W=x(L);(!W||!W.tagName)&&(W={namespaceURI:At,tagName:"template"});const pe=Hi(L.tagName),Ie=Hi(W.tagName);return Rt[L.namespaceURI]?L.namespaceURI===Xe?Yt(pe,W,Ie):L.namespaceURI===ze?pn(pe,W,Ie):L.namespaceURI===Ve?yt(pe,W,Ie):!!(Se==="application/xhtml+xml"&&Rt[L.namespaceURI]):!1},Tn=function(L){ka(t.removed,{element:L});try{x(L).removeChild(L)}catch{if(b(L),!x(L))throw na("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Or=function(L){const W=y(L);if(W){const Ie=[];Fi(W,Qe=>{ka(Ie,Qe)}),Fi(Ie,Qe=>{try{b(Qe)}catch{}})}const pe=T(L);if(pe)for(let Ie=pe.length-1;Ie>=0;--Ie){const Qe=pe[Ie],gt=Qe&&Qe.name;if(typeof gt=="string")try{L.removeAttribute(gt)}catch{}}},Sn=function(L,W){try{ka(t.removed,{attribute:W.getAttributeNode(L),from:W})}catch{ka(t.removed,{attribute:null,from:W})}if(W.removeAttribute(L),L==="is")if(je||Ze)try{Tn(W)}catch{}else try{W.setAttribute(L,"")}catch{}},Wn=function(L){const W=T(L);if(W)for(let pe=W.length-1;pe>=0;--pe){const Ie=W[pe],Qe=Ie&&Ie.name;if(!(typeof Qe!="string"||Pe[me(Qe)]))try{L.removeAttribute(Qe)}catch{}}},Ti=function(L){const W=[L];for(;W.length>0;){const pe=W.pop();(I?I(pe):pe.nodeType)===pr.element&&Wn(pe);const Qe=y(pe);if(Qe)for(let gt=Qe.length-1;gt>=0;--gt)W.push(Qe[gt])}},Lr=function(L){let W=null,pe=null;if(we)L="<remove></remove>"+L;else{const gt=my(L,/^[\r\n\t ]+/);pe=gt&&gt[0]}Se==="application/xhtml+xml"&&At===Ve&&(L='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+L+"</body></html>");const Ie=v?j(L):L;if(At===Ve)try{W=new p().parseFromString(Ie,Se)}catch{}if(!W||!W.documentElement){W=ie.createDocument(At,"template",null);try{W.documentElement.innerHTML=rn?A:Ie}catch{}}const Qe=W.body||W.documentElement;return L&&pe&&Qe.insertBefore(n.createTextNode(pe),Qe.childNodes[0]||null),At===Ve?ue.call(W,Ye?"html":"body")[0]:Ye?W.documentElement:Qe},cr=function(L){return X.call(L.ownerDocument||L,L,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ar=function(L){return L=Mi(L,le," "),L=Mi(L,D," "),L=Mi(L,ke," "),L},Fr=function(L){var W;L.normalize();const pe=X.call(L.ownerDocument||L,L,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let Ie=pe.nextNode();for(;Ie;)Ie.data=Ar(Ie.data),Ie=pe.nextNode();const Qe=(W=L.querySelectorAll)===null||W===void 0?void 0:W.call(L,"template");Qe&&Fi(Qe,gt=>{Pt(gt.content)&&Fr(gt.content)})},tt=function(L){const W=R?R(L):null;return typeof W!="string"||me(W)!=="form"?!1:typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||L.attributes!==T(L)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function"||L.nodeType!==I(L)||L.childNodes!==y(L)},Pt=function(L){if(!I||typeof L!="object"||L===null)return!1;try{return I(L)===pr.documentFragment}catch{return!1}},Vn=function(L){if(!I||typeof L!="object"||L===null)return!1;try{return typeof I(L)=="number"}catch{return!1}};function fn(fe,L,W){fe.length!==0&&Fi(fe,pe=>{pe.call(t,L,W,Ce)})}const Lt=function(L,W){return!!(Ae&&L.hasChildNodes()&&!Vn(L.firstElementChild)&&mn(Ay,L.textContent)&&mn(Ay,L.innerHTML)||Ae&&L.namespaceURI===Ve&&W==="style"&&Vn(L.firstElementChild)||L.nodeType===pr.processingInstruction||Ae&&L.nodeType===pr.comment&&mn(M7,L.data))},wa=function(L,W){if(!rt[W]&&fb(W)&&(de.tagNameCheck instanceof RegExp&&mn(de.tagNameCheck,W)||de.tagNameCheck instanceof Function&&de.tagNameCheck(W)))return!1;if(J&&!Re[W]){const pe=x(L),Ie=y(L);if(Ie&&pe){const Qe=Ie.length;for(let gt=Qe-1;gt>=0;--gt){const an=be?Ie[gt]:m(Ie[gt],!0);pe.insertBefore(an,E(L))}}}return Tn(L),!0},Si=function(L){if(fn(Y.beforeSanitizeElements,L,null),tt(L))return Tn(L),!0;const W=me(R?R(L):L.nodeName);if(fn(Y.uponSanitizeElement,L,{tagName:W,allowedTags:$e}),Lt(L,W))return Tn(L),!0;if(rt[W]||!(ft.tagCheck instanceof Function&&ft.tagCheck(W))&&!$e[W])return wa(L,W);if((I?I(L):L.nodeType)===pr.element&&!Ln(L)||(W==="noscript"||W==="noembed"||W==="noframes")&&mn(P7,L.innerHTML))return Tn(L),!0;if(ut&&L.nodeType===pr.text){const Ie=Ar(L.textContent);L.textContent!==Ie&&(ka(t.removed,{element:L.cloneNode()}),L.textContent=Ie)}return fn(Y.afterSanitizeElements,L,null),!1},Zs=function(L,W,pe){if(Ot[W]||St&&(W==="id"||W==="name")&&(pe in n||pe in Be))return!1;const Ie=Pe[W]||ft.attributeCheck instanceof Function&&ft.attributeCheck(W,L);if(!(wt&&mn(Le,W))){if(!(kt&&mn(ve,W))){if(Ie){if(!Te[W]){if(!mn(ct,Mi(pe,Ee,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&L!=="script"&&hy(pe,"data:")===0&&Wt[L])){if(!(zt&&!mn(Ue,Mi(pe,Ee,"")))){if(pe)return!1}}}}}else if(!(fb(L)&&(de.tagNameCheck instanceof RegExp&&mn(de.tagNameCheck,L)||de.tagNameCheck instanceof Function&&de.tagNameCheck(L))&&(de.attributeNameCheck instanceof RegExp&&mn(de.attributeNameCheck,W)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(W,L))||W==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&mn(de.tagNameCheck,pe)||de.tagNameCheck instanceof Function&&de.tagNameCheck(pe))))return!1}}return!0},cv=mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),fb=function(L){return!cv[Hi(L)]&&mn(he,L)},dv=function(L,W,pe,Ie){if(v&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!pe)switch(d.getAttributeType(L,W)){case"TrustedHTML":return j(Ie);case"TrustedScriptURL":return H(Ie)}return Ie},pv=function(L,W,pe,Ie){try{pe?L.setAttributeNS(pe,W,Ie):L.setAttribute(W,Ie),tt(L)?Tn(L):fy(t.removed)}catch{Sn(W,L)}},mb=function(L){fn(Y.beforeSanitizeAttributes,L,null);const W=L.attributes;if(!W||tt(L))return;const pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Pe,forceKeepAttr:void 0};let Ie=W.length;const Qe=me(L.nodeName);for(;Ie--;){const gt=W[Ie],an=gt.name,Zt=gt.namespaceURI,qn=gt.value,rr=me(an),gl=qn;let _n=an==="value"?gl:E7(gl);if(pe.attrName=rr,pe.attrValue=_n,pe.keepAttr=!0,pe.forceKeepAttr=void 0,fn(Y.uponSanitizeAttribute,L,pe),_n=pe.attrValue,Et&&(rr==="id"||rr==="name")&&hy(_n,Nt)!==0&&(Sn(an,L),_n=Nt+_n),Ae&&mn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,_n)){Sn(an,L);continue}if(rr==="attributename"&&my(_n,"href")){Sn(an,L);continue}if(!pe.forceKeepAttr){if(!pe.keepAttr){Sn(an,L);continue}if(!nn&&mn(B7,_n)){Sn(an,L);continue}if(ut&&(_n=Ar(_n)),!Zs(Qe,rr,_n)){Sn(an,L);continue}_n=dv(Qe,rr,Zt,_n),_n!==gl&&pv(L,an,Zt,_n)}}fn(Y.afterSanitizeAttributes,L,null)},Ks=function(L){let W=null;const pe=cr(L);for(fn(Y.beforeSanitizeShadowDOM,L,null);W=pe.nextNode();)if(fn(Y.uponSanitizeShadowNode,W,null),Si(W),mb(W),Pt(W.content)&&Ks(W.content),(I?I(W):W.nodeType)===pr.element){const Qe=w(W);Pt(Qe)&&(hl(Qe),Ks(Qe))}fn(Y.afterSanitizeShadowDOM,L,null)},hl=function(L){const W=[{node:L,shadow:null}];for(;W.length>0;){const pe=W.pop();if(pe.shadow){Ks(pe.shadow);continue}const Ie=pe.node,gt=(I?I(Ie):Ie.nodeType)===pr.element,an=y(Ie);if(an)for(let Zt=an.length-1;Zt>=0;--Zt)W.push({node:an[Zt],shadow:null});if(gt){const Zt=R?R(Ie):null;if(typeof Zt=="string"&&me(Zt)==="template"){const qn=Ie.content;Pt(qn)&&W.push({node:qn,shadow:null})}}if(gt){const Zt=w(Ie);Pt(Zt)&&W.push({node:null,shadow:Zt},{node:Zt,shadow:null})}}};return t.sanitize=function(fe){let L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,pe=null,Ie=null,Qe=null;if(rn=!fe,rn&&(fe="<!-->"),typeof fe!="string"&&!Vn(fe)&&(fe=A7(fe),typeof fe!="string"))throw na("dirty is not a string, aborting");if(!t.isSupported)return fe;q?($e=te,Pe=ye):lt(L),(Y.uponSanitizeElement.length>0||Y.uponSanitizeAttribute.length>0)&&($e=Cn($e)),Y.uponSanitizeAttribute.length>0&&(Pe=Cn(Pe)),t.removed=[];const gt=be&&typeof fe!="string"&&Vn(fe);if(gt){const qn=R?R(fe):fe.nodeName;if(typeof qn=="string"){const rr=me(qn);if(!$e[rr]||rt[rr])throw na("root node is forbidden and cannot be sanitized in-place")}if(tt(fe))throw na("root node is clobbered and cannot be sanitized in-place");try{hl(fe)}catch(rr){throw Or(fe),rr}}else if(Vn(fe))W=Lr("<!---->"),pe=W.ownerDocument.importNode(fe,!0),pe.nodeType===pr.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?W=pe:W.appendChild(pe),hl(pe);else{if(!je&&!ut&&!Ye&&fe.indexOf("<")===-1)return v&&_t?j(fe):fe;if(W=Lr(fe),!W)return je?null:_t?A:""}W&&we&&Tn(W.firstChild);const an=cr(gt?fe:W);try{for(;Ie=an.nextNode();)Si(Ie),mb(Ie),Pt(Ie.content)&&Ks(Ie.content)}catch(qn){throw gt&&Or(fe),qn}if(gt)return Fi(t.removed,qn=>{qn.element&&Ti(qn.element)}),ut&&Fr(fe),fe;if(je){if(ut&&Fr(W),Ze)for(Qe=re.call(W.ownerDocument);W.firstChild;)Qe.appendChild(W.firstChild);else Qe=W;return(Pe.shadowroot||Pe.shadowrootmode)&&(Qe=k.call(r,Qe,!0)),Qe}let Zt=Ye?W.outerHTML:W.innerHTML;return Ye&&$e["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&mn(L7,W.ownerDocument.doctype.name)&&(Zt="<!DOCTYPE "+W.ownerDocument.doctype.name+`>
170
+ `+Zt),ut&&(Zt=Ar(Zt)),v&&_t?j(Zt):Zt},t.setConfig=function(){let fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(fe),q=!0,te=$e,ye=Pe},t.clearConfig=function(){Ce=null,q=!1,te=null,ye=null,v=N,A=""},t.isValidAttribute=function(fe,L,W){Ce||lt({});const pe=me(fe),Ie=me(L);return Zs(pe,Ie,W)},t.addHook=function(fe,L){typeof L=="function"&&un(Y,fe)&&ka(Y[fe],L)},t.removeHook=function(fe,L){if(un(Y,fe)){if(L!==void 0){const W=g7(Y[fe],L);return W===-1?void 0:b7(Y[fe],W,1)[0]}return fy(Y[fe])}},t.removeHooks=function(fe){un(Y,fe)&&(Y[fe]=[])},t.removeAllHooks=function(){Y=vy()},t}var $7=mA();function z7({code:e}){const t=g.useId().replace(/:/g,""),n=g.useRef(null),[r,a]=g.useState(null),[i,s]=g.useState(!1);return g.useEffect(()=>{let o=!1;return(async()=>{try{const u=(await dA(async()=>{const{default:d}=await import("./mermaid.core.B2zRNxtX.js").then(f=>f.aH);return{default:d}},__vite__mapDeps([0,1]))).default;u.initialize({startOnLoad:!1,theme:"dark",securityLevel:"strict"});const l=await u.render(`mermaid-${t}`,e),p=$7.sanitize(l.svg,{USE_PROFILES:{svg:!0,svgFilters:!0}});o||a(p)}catch{o||s(!0)}})(),()=>{o=!0}},[e,t]),g.useEffect(()=>{n.current&&(n.current.innerHTML=r??"")},[r]),i?c.jsx("pre",{children:c.jsx("code",{children:e})}):c.jsx("div",{ref:n,className:"mermaid-diagram flex justify-center","data-testid":"mermaid-diagram"})}function H7(e){return(e??"").match(/language-(\w+)/)?.[1]??null}function id(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(id).join(""):typeof e=="object"&&"props"in e?id(e.props.children):""}function G7({className:e,children:t,...n}){return H7(e)==="mermaid"?c.jsx(z7,{code:id(t).trim()}):c.jsx("code",{className:e,...n,children:t})}function W7({source:e}){return c.jsx(Ko.Markdown,{source:e,wrapperElement:{"data-color-mode":"light"},components:{code:G7}})}function iu({targetVar:e,onResizeEnd:t,direction:n="horizontal",invert:r=!1}){const a=g.useRef(null),i=g.useCallback(o=>{o.preventDefault();const u=document.documentElement,p=getComputedStyle(u).getPropertyValue(e).trim(),d=parseFloat(p)||0;a.current={x:o.clientX,y:o.clientY,w:d},o.target.setPointerCapture(o.pointerId);const f=b=>{if(!a.current)return;const E=n==="horizontal"?b.clientX-a.current.x:b.clientY-a.current.y,y=r?-E:E,x=Math.max(0,a.current.w+y);u.style.setProperty(e,`${x}px`)},m=()=>{if(!a.current)return;const b=getComputedStyle(u).getPropertyValue(e).trim(),E=parseFloat(b)||a.current.w;t(Math.round(E)),a.current=null,window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",m)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",m,{once:!0})},[e,t,n,r]),s=n==="horizontal";return c.jsx("hr",{"data-testid":`resize-handle-${s?"h":"v"}`,"aria-orientation":s?"vertical":"horizontal","aria-label":s?"Resize sidebar":"Resize panel",tabIndex:0,className:"resize-handle shrink-0 bg-spur-border hover:bg-spur-accent cursor-col-resize transition-colors border-0",style:{width:s?4:"100%",height:s?"100%":4,margin:0},onPointerDown:i})}const wy="spur:new-task-panel-width",_y=384,uc=384;function Ny({id:e,label:t,placeholder:n,value:r,mode:a,onChange:i,onModeChange:s,disabled:o}){return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[c.jsxs("label",{htmlFor:e,className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:[t," ",c.jsx("span",{className:"text-spur-text-muted font-normal",children:"(optional, markdown)"})]}),c.jsxs("fieldset",{className:"flex items-center gap-1",children:[c.jsxs("legend",{className:"sr-only",children:[t," mode"]}),c.jsx(He,{type:"button",variant:a==="edit"?"primary":"ghost",size:"xs",onClick:()=>s("edit"),disabled:o,"aria-pressed":a==="edit",children:"Edit"}),c.jsx(He,{type:"button",variant:a==="preview"?"primary":"ghost",size:"xs",onClick:()=>s("preview"),disabled:o,"aria-pressed":a==="preview",children:"Preview"})]})]}),a==="edit"?c.jsx("div",{className:"min-h-40","data-testid":`${e}-editor`,children:c.jsx(Ko,{value:r,onChange:u=>i(u??""),height:160,textareaProps:{id:e,placeholder:n,disabled:o,"aria-label":t},"data-color-mode":"dark"})}):c.jsx("div",{className:"min-h-40 rounded border border-spur-border bg-spur-bg p-3 text-sm text-spur-text overflow-y-auto","data-testid":`${e}-preview`,children:r.trim()?c.jsx(Ko.Markdown,{source:r,"data-color-mode":"dark"}):c.jsx("p",{className:"text-xs text-spur-text-muted",children:n})})]})}function hA({open:e,onClose:t,onCreated:n,folder:r,featureId:a}){const[i,s]=g.useState(""),[o,u]=g.useState(""),[l,p]=g.useState(""),[d,f]=g.useState("edit"),[m,b]=g.useState("edit"),[E,y]=g.useState("standard"),[x,w]=g.useState(!1),[T,I]=g.useState(""),[R,v]=g.useState(!1),[A,N]=g.useState(()=>{if(typeof window>"u")return _y;try{const j=Number.parseFloat(window.localStorage.getItem(wy)??"");if(Number.isFinite(j)&&j>0)return Math.max(uc,Math.min(j,window.innerWidth*.9))}catch{}return _y}),F=R&&i.trim()===""?"Name is required":"";g.useEffect(()=>{document.documentElement.style.setProperty("--new-task-panel-w",`${A}px`)},[A]);const _=()=>{x||(s(""),u(""),p(""),f("edit"),b("edit"),y("standard"),I(""),v(!1),t())},M=async()=>{v(!0);const j=i.trim();if(j!==""){w(!0),I("");try{const Z=(await _r.task.create({title:j,folder:r,template:E,featureId:a})).data.wbs,V=[];if(o.trim()&&V.push(`### Background
171
171
  ${o.trim()}`),l.trim()&&V.push(`### Requirements
172
172
  ${l.trim()}`),V.length>0)try{await _r.task.body({wbs:Z,body:V.join(`
173
173
 
174
- `)})}catch(ie){const X=ie instanceof Error?ie.message:"Body seeding failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:`Task created but body seeding failed: ${X}`}}))}_(),n()}catch(H){const Z=H instanceof Error?H.message:"Create failed";I(Z),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Z}}))}finally{w(!1)}}};return e?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-40",onClick:_,"aria-hidden":"true"}),c.jsxs("div",{className:"fixed inset-y-0 right-0 max-w-[90vw] bg-spur-surface border-l border-spur-border z-50 flex shadow-2xl",style:{width:A,minWidth:uc},role:"dialog","aria-label":"New Task",children:[c.jsx(iu,{targetVar:"--new-task-panel-w",onResizeEnd:j=>{const H=typeof window<"u"?window.innerWidth*.9:j,Z=Math.max(uc,Math.min(j,H));N(Z);try{window.localStorage.setItem(wy,String(Z))}catch{}},direction:"horizontal",invert:!0}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-spur-border shrink-0",children:[c.jsx("h2",{className:"text-sm font-semibold text-spur-text",children:"New Task"}),c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:_,"aria-label":"Close",disabled:x,children:"✕"})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("label",{htmlFor:"new-task-name",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:["Name ",c.jsx("span",{className:"text-spur-error",children:"*"})]}),c.jsx(gs,{id:"new-task-name",type:"text",variant:"bordered",size:"sm",error:!!F,className:"w-full bg-spur-bg text-spur-text",placeholder:"Task name",value:i,onChange:j=>{s(j.target.value),R||v(!0)},onBlur:()=>v(!0),disabled:x}),F&&c.jsx("p",{className:"text-xs text-spur-error mt-1",children:F})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:"new-task-template",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:"Template"}),c.jsx(Zr,{id:"new-task-template",variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:E,onChange:j=>y(j.target.value),disabled:x,children:ll.map(j=>c.jsx("option",{value:j,children:j},j))})]}),c.jsx(Ny,{id:"new-task-background",label:"Background",placeholder:"Why this task exists…",value:o,mode:d,onChange:u,onModeChange:f,disabled:x}),c.jsx(Ny,{id:"new-task-requirements",label:"Requirements",placeholder:"What must be done…",value:l,mode:m,onChange:p,onModeChange:b,disabled:x}),T&&c.jsx("div",{className:"text-xs text-spur-error bg-spur-error/10 border border-spur-error/20 rounded p-2",children:T})]}),c.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-spur-border shrink-0",children:[c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:_,disabled:x,children:"Cancel"}),c.jsx(He,{variant:"primary",size:"sm",onClick:M,disabled:x,children:x?"Creating…":"Create Task"})]})]})]})]}):null}const V7=5e3,q7=()=>`${et()}/events/planning`,Y7=async(e={})=>_r.task.list(e);class gA{state={tasks:[],loading:!0,error:null,connected:!1};listeners=[];interval;eventSource;refCount=0;listFn;constructor(t=Y7){this.listFn=t}getState=()=>this.state;setListFn=t=>{t!==this.listFn&&(this.listFn=t,this.refresh())};subscribe=t=>(this.listeners.push(t),this.refCount++,this.refCount===1&&(this.refresh(),this.interval=setInterval(this.refresh,V7),this.connectSSE()),()=>{this.listeners=this.listeners.filter(n=>n!==t),this.refCount--,this.refCount===0&&(this.interval&&(clearInterval(this.interval),this.interval=void 0),this.disconnectSSE())});refresh=async()=>{try{const t=await this.listFn();this.state={tasks:t.data??[],loading:!1,error:null,connected:this.state.connected}}catch(t){this.state={...this.state,loading:!1,error:t}}this.emit()};setTasks=t=>{const n=typeof t=="function"?t(this.state.tasks):t;this.state={...this.state,tasks:n},this.emit()};handleSSEOpen=()=>{this.state={...this.state,connected:!0},this.emit()};handleSSEMessage=()=>{this.refresh()};handleSSEError=()=>{this.state={...this.state,connected:!1},this.emit()};async connectSSE(){if(this.eventSource||typeof EventSource>"u")return;const t=new EventSource(q7());this.eventSource=t,t.onopen=this.handleSSEOpen,t.onmessage=this.handleSSEMessage,t.onerror=this.handleSSEError}disconnectSSE(){this.eventSource&&(this.eventSource.close(),this.eventSource=void 0,this.state={...this.state,connected:!1})}emit(){for(const t of this.listeners)t()}}let lc=null;function Z7(){return lc||(lc=new gA),lc}function bA(e){const t=g.useRef(null);e&&!t.current&&(t.current=new gA(e));const n=t.current??Z7();return g.useEffect(()=>{e&&t.current&&t.current.setListFn(e)},[e]),{...g.useSyncExternalStore(n.subscribe,n.getState),setTasks:n.setTasks}}function K7({progress:e,isDismissed:t,onDismiss:n,onReopen:r}){const{status:a,runId:i,action:s,error:o}=e,u=g.useRef(null);if(g.useEffect(()=>{a==="failed"&&t&&i&&u.current!==i&&(u.current=i,typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:o||`Action ${s||"job"} failed`}})))},[a,t,i,s,o]),a==="idle"||!i)return null;const l=a==="queued"||a==="running";if(t)return l?c.jsx("div",{className:"fixed bottom-4 right-4 z-40",children:c.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-2 px-3 py-1.5 bg-spur-bg border border-spur-border hover:border-spur-primary text-spur-text text-xs rounded-full shadow-md font-medium transition-colors",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 animate-pulse"}),c.jsxs("span",{children:[s?`${s.charAt(0).toUpperCase()}${s.slice(1)}`:"Action"," (",a,")"]}),c.jsx("span",{className:"text-spur-text-muted",children:"⤢"})]})}):null;const p=a==="succeeded"?"success":a==="failed"?"error":a==="running"?"accent":"warning";return c.jsxs("div",{className:"fixed bottom-4 right-4 z-40 w-80 p-4 bg-spur-bg border border-spur-border rounded-lg shadow-xl backdrop-blur flex flex-col gap-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:s?`${s.charAt(0).toUpperCase()}${s.slice(1)}`:"Action"}),c.jsx(st,{variant:p,children:a})]}),c.jsx("button",{type:"button",onClick:n,className:"text-spur-text-muted hover:text-spur-text text-base font-bold leading-none p-1","aria-label":"Dismiss progress panel",children:"×"})]}),c.jsxs("div",{className:"text-xs text-spur-text-muted font-mono truncate",children:["ID: ",i]}),l&&c.jsxs("div",{className:"flex items-center gap-2 text-xs text-spur-text",children:[c.jsx(Tr,{className:"w-3.5 h-3.5"}),c.jsx("span",{children:a==="queued"?"Enqueued in job runner...":"Running agent slash command..."})]}),a==="succeeded"&&c.jsx("div",{className:"text-xs text-green-400 font-medium",children:"✓ Action completed successfully."}),a==="failed"&&c.jsxs("div",{className:"text-xs text-red-400 font-medium break-words",children:["✕ ",o||"Action job failed."]}),!l&&c.jsx("div",{className:"flex justify-end pt-1",children:c.jsx(He,{variant:"outline",size:"sm",onClick:n,children:"Close"})})]})}const X7={backlog:["brainstorm","plan","add-child","add-task","start","cancel"],active:["add-child","add-task","link-task","sync-status","verify","block","cancel"],verifying:["sync-status","complete","rework","cancel"],blocked:["add-child","add-task","unblock","cancel"],done:[],cancelled:[]},Br={brainstorm:"Brainstorm",plan:"Plan","add-child":"+ Child","add-task":"+ Task","link-task":"Link Task","sync-status":"Sync",start:"Start",verify:"Verify",complete:"Complete",rework:"Rework",block:"Block",unblock:"Unblock",cancel:"Cancel"},Q7={start:!0,verify:!0,complete:!0,rework:!0,block:!0,unblock:!0,cancel:!0},J7={start:"active",verify:"verifying",complete:"done",rework:"active",block:"blocked",unblock:"active",cancel:"cancelled"};function EA({open:e,parentId:t,onClose:n,onCreated:r}){const[a,i]=g.useState(""),[s,o]=g.useState(!1),[u,l]=g.useState(""),[p,d]=g.useState(!1),f=p&&a.trim()===""?"Name is required":"",m=()=>{i(""),d(!1),l(""),n()},b=async()=>{d(!0);const E=a.trim();if(E!==""){o(!0),l("");try{t?await cA({id:t,name:E}):await n7(E),m(),r()}catch(y){const x=y instanceof Error?y.message:"Create failed";l(x)}finally{o(!1)}}};return e?c.jsx("div",{className:"fixed inset-y-0 right-0 z-40 flex","data-new-feature-panel":!0,children:c.jsxs("div",{className:"w-96 border-l border-spur-border bg-spur-surface shadow-xl flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-spur-border shrink-0",children:[c.jsx("h3",{className:"text-sm font-semibold text-spur-text",children:t?"New Child Feature":"New Feature"}),c.jsx(He,{variant:"ghost",size:"xs",onClick:m,"aria-label":"Close panel",children:"✕"})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[t&&c.jsxs("div",{className:"text-xs text-spur-text-muted",children:["Parent: ",c.jsx("span",{className:"font-mono text-spur-accent",children:t})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:"new-feature-name",className:"block text-xs font-medium text-spur-text mb-1",children:"Feature Name *"}),c.jsx(gs,{id:"new-feature-name",value:a,onChange:E=>{i(E.target.value),p||d(!0)},onKeyDown:E=>{E.key==="Enter"&&a.trim()&&b()},placeholder:"e.g. Authentication module",disabled:s}),f&&c.jsx("p",{className:"text-xs text-red-500 mt-1",children:f}),u&&c.jsx("p",{className:"text-xs text-red-500 mt-1",children:u})]}),c.jsx("div",{className:"text-xs text-spur-text-muted",children:t?`The feature ID will be auto-allocated (next free digit under ${t}).`:"The feature ID will be auto-allocated (next free letter A–Z)."})]}),c.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-spur-border shrink-0",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:m,disabled:s,children:"Cancel"}),c.jsx(He,{variant:"primary",size:"xs",onClick:b,disabled:s||a.trim()==="",loading:s,children:"Create Feature"})]})]})}):null}const yA={backlog:{status:"backlog",label:"Backlog",colorClass:"text-spur-text-muted",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:c.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"2.5",strokeDasharray:"2 2"})})},active:{status:"active",label:"Active",colorClass:"text-spur-accent",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":t,children:c.jsx("circle",{cx:"8",cy:"8",r:"4.5"})})},verifying:{status:"verifying",label:"Verifying",colorClass:"text-spur-warning",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:[c.jsx("path",{d:"M1.5 8s2.5-4 6.5-4 6.5 4 6.5 4-2.5 4-6.5 4-6.5-4-6.5-4z"}),c.jsx("circle",{cx:"8",cy:"8",r:"2"})]})},blocked:{status:"blocked",label:"Blocked",colorClass:"text-spur-error",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[c.jsx("path",{d:"M8 2.5l5.5 10.5H2.5L8 2.5z"}),c.jsx("path",{d:"M8 6v3"}),c.jsx("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor"})]})},done:{status:"done",label:"Done",colorClass:"text-spur-success",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:c.jsx("path",{d:"M3.5 8.5l3.5 3.5 5.5-7"})})},cancelled:{status:"cancelled",label:"Cancelled",colorClass:"text-spur-text-faint",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[c.jsx("path",{d:"M5.5 2.5h5l3 3v5l-3 3h-5l-3-3v-5l3-3z"}),c.jsx("path",{d:"M6.25 6.25l3.5 3.5M9.75 6.25l-3.5 3.5"})]})}};function xA(e){const t=yA[e.toLowerCase()];return t?t.label:`Unknown status: ${e}`}function Kg({status:e,className:t}){const n=e.toLowerCase(),r=yA[n];if(r){const a=r.Icon;return c.jsx(a,{className:`${r.colorClass} ${t??"w-3.5 h-3.5"}`,ariaLabel:r.label})}return c.jsx("svg",{className:`inline-block shrink-0 text-spur-text-muted ${t??"w-3.5 h-3.5"}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":xA(e),children:c.jsx("circle",{cx:"8",cy:"8",r:"4"})})}function TA(e){return e?e.startsWith("feature.")||e.startsWith("queue.job."):!1}function e$(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.jobId=="string"&&t.jobId.length>0)return t.jobId;if(typeof t.runId=="string"&&t.runId.length>0)return t.runId;if(t.job&&typeof t.job=="object"){const n=t.job;if(typeof n.id=="string"&&n.id.length>0)return n.id;if(typeof n.jobId=="string"&&n.jobId.length>0)return n.jobId}return null}function t$(e,t){return t?e$(e)===t:!1}const cc={status:"idle"};function n$(e,t,n){if(e.status==="idle"||!e.runId||!t$(n,e.runId))return e;switch(t){case"queue.job.enqueued":case"queue.job.created":return{...e,status:"queued"};case"queue.job.started":case"queue.job.running":return{...e,status:"running"};case"queue.job.completed":return{...e,status:"succeeded"};case"queue.job.failed":{const r=n&&typeof n=="object"&&typeof n.error=="string"?n.error:"Job failed";return{...e,status:"failed",error:r}}default:return e}}const r$=()=>`${et()}/events/planning`;function a$(e){const[t,n]=g.useState(cc);g.useEffect(()=>{e&&n(cc)},[e]);const r=g.useCallback((i,s)=>{n({status:"queued",runId:i,action:s})},[]),a=g.useCallback(()=>{n(cc)},[]);return g.useEffect(()=>{if(typeof EventSource>"u"||!t.runId)return;const i=new EventSource(r$());return i.onmessage=s=>{try{const o=JSON.parse(s.data),u=o.eventName;if(!TA(u)||!u)return;n(l=>n$(l,u,o.payload))}catch{}},()=>{i.close()}},[t.runId]),{progress:t,trackAction:r,clearProgress:a}}function i$({featureId:e,onClose:t,refreshKey:n=0,childFeatures:r=[],onSelectFeature:a}){const[i,s]=g.useState(null),[o,u]=g.useState(""),[l,p]=g.useState(""),[d,f]=g.useState("preview"),[m,b]=g.useState(!1),[E,y]=g.useState(!1),[x,w]=g.useState(null),[T,I]=g.useState({}),[R,v]=g.useState(!1),[A,N]=g.useState(null),[F,_]=g.useState(null),[M,j]=g.useState(!1),[H,Z]=g.useState(null),[V,ie]=g.useState(null),[X,re]=g.useState(""),[ue,k]=g.useState("claude"),[Y,le]=g.useState("push"),[D,ke]=g.useState(!1),[Le,ve]=g.useState(!1),{progress:Ue,trackAction:Ee}=a$(e),[he,ct]=g.useState(!1),$e=g.useRef(null),{tasks:ge}=bA(),Pe=(ge??[]).filter(U=>U.featureId===e),pt=g.useRef(0),de=g.useCallback(()=>++pt.current,[]),rt=g.useCallback(U=>U===pt.current,[]),Ot=g.useCallback(async()=>{const U=de(),Te=await ly(e);return rt(U)?Te:null},[e,de,rt]),ft=g.useCallback((U,Te)=>{if(s(U),$e.current=U.id,I(U.frontmatter),Te?.body!==!1){const Ne=s$(U.content);u(Ne),p(Ne)}},[]),kt=g.useCallback(async U=>{const Te=await Ot();return Te&&(ft(Te,U),b(!1)),Te},[Ot,ft]),wt=g.useCallback((U,Te)=>{const Ne=U instanceof Error?U.message:Te;_({kind:"error",message:Ne}),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Ne}}))},[]),zt=g.useMemo(()=>({featureId:e,generation:n}),[e,n]);g.useEffect(()=>{const{featureId:U}=zt;if(!U){s(null),$e.current=null,u(""),p(""),f("preview"),w(null),_(null);return}$e.current!==U&&b(!0),w(null);const Ne=de();(async()=>{try{const ze=await ly(U);if(!rt(Ne))return;ft(ze)}catch(ze){if(!rt(Ne))return;w(ze instanceof Error?ze.message:"Failed to load feature")}finally{rt(Ne)&&b(!1)}})()},[zt,de,rt,ft]);const nn=async()=>{ke(!1);try{await kt({body:!1})}catch{}},ut=async()=>{ve(!1);try{await kt()}catch{}};if(x)return c.jsx("div",{className:"flex items-center justify-center h-full p-4",children:c.jsx("p",{className:"text-sm text-red-500",children:x})});if(!i)return c.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Select a feature to view details"});const Ae=()=>{p(o),f("edit")},Ye=()=>{p(o),f("preview")},q=async()=>{y(!0);try{await e7({id:e,body:l}),u(l),f("preview"),await kt()}catch(U){p(o),f("preview");const Te=U instanceof Error?U.message:"Save failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Te}}))}finally{y(!1)}},te=U=>{if(!A){if(_(null),Q7[U]){we(U);return}if(U==="brainstorm"||U==="plan"){Z(U);return}if(U==="add-child"){ve(!0);return}if(U==="add-task"){ke(!0);return}if(U==="link-task"){ie(U),re("");return}if(U==="sync-status"){Z("sync-status");return}}},ye=async U=>{const Te=J7[U];if(Te){N(U),_(null);try{const Ne=await J9(e,Te);s(ze=>ze&&{...ze,status:Ne}),await kt({body:!1}),_({kind:"ok",message:`${Br[U]??U}: status is now ${Ne}.`})}catch(Ne){wt(Ne,"Transition failed")}finally{N(null)}}},we=async U=>{if(U==="cancel"){j(!0);return}await ye(U)},je=async()=>{j(!1),await ye("cancel")},Ze=async()=>{const U=V;if(!(!U||!X.trim())){ie(null),N(U),_(null);try{U==="add-child"?await cA({id:e,name:X.trim()}):U==="add-task"?await r7({id:e,title:X.trim()}):U==="link-task"&&await a7({id:e,wbs:X.trim()}),await kt({body:!1}),_({kind:"ok",message:`${Br[U]??U} completed.`})}catch(Te){wt(Te,"Action failed")}finally{N(null)}}},_t=async()=>{if(!H)return;const U=H;Z(null),N(U),_(null);try{if(U==="sync-status"){const Te=await i7({id:e,direction:Y});await kt({body:!1});const Ne=Te.data?.applied,ze=Te.data?.newStatus;_({kind:"ok",message:Ne?`Sync applied${ze?`: status is now ${ze}`:""}.`:"Sync finished — no status change was needed."})}else{const Te=await t7({id:e,action:U,channel:ue});Te?.data?.runId&&(Ee(Te.data.runId,U),ct(!1)),await kt({body:!1}),_({kind:"ok",message:`${Br[U]??U} dispatched on ${ue}.`})}}catch(Te){wt(Te,"Action failed")}finally{N(null)}},St=U=>{if(!U)return"";try{const Te=new Date(U);return Number.isNaN(Te.getTime())?"":Te.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}},Et=U=>{if(!U)return"";try{const Te=new Date(U);if(Number.isNaN(Te.getTime()))return"";const Ne=Date.now()-Te.getTime(),ze=Math.floor(Ne/864e5);return ze===0?"today":ze===1?"yesterday":ze<30?`${ze}d ago`:ze<365?`${Math.floor(ze/30)}mo ago`:`${Math.floor(ze/365)}y ago`}catch{return""}},Nt=Array.isArray(T.tags)?T.tags:[],J=St(T.created_at),be=Et(T.created_at),Fe=St(T.updated_at),Re=Et(T.updated_at),xt=U=>{window.location.assign(`/board/tasks/${U}`)},Wt=X7[i.status]??[];return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3 p-3 border-b border-spur-border shrink-0",children:[c.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[c.jsxs("h3",{className:"text-sm font-semibold text-spur-text truncate",children:[i.id," — ",i.name]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1","data-testid":"header-chips",children:[c.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted","data-testid":"status-pill",children:i.status}),typeof i.frontmatter.priority=="string"&&c.jsx("span",{className:"px-2 py-0.5 rounded-full bg-spur-accent/15 text-xs text-spur-accent",children:i.frontmatter.priority}),Nt.map(U=>c.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted",children:U},U))]})]}),c.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1 shrink-0",children:[Wt.map(U=>{let Te="accent";return U==="cancel"?Te="error":(U==="add-child"||U==="add-task"||U==="link-task")&&(Te="outline"),c.jsx(He,{variant:Te,size:"xs",onClick:()=>te(U),disabled:A!==null,"aria-busy":A===U,"aria-label":Br[U],children:A===U?"…":Br[U]},U)}),t&&c.jsx(He,{variant:"ghost",size:"xs",className:"text-spur-text-muted",onClick:t,"aria-label":"Close detail",children:"✕"})]})]}),F&&c.jsx("div",{role:"status","data-testid":"action-feedback","data-kind":F.kind,className:`px-3 py-1.5 text-xs border-b border-spur-border shrink-0 ${F.kind==="error"?"bg-spur-error/10 text-spur-error":"bg-spur-success/10 text-spur-success"}`,children:F.message}),c.jsxs("div",{className:"border-b border-spur-border shrink-0",children:[c.jsxs("button",{type:"button",onClick:()=>v(U=>!U),className:"flex items-center justify-between w-full p-3 text-xs font-semibold text-spur-text-muted uppercase tracking-wide hover:text-spur-text transition-colors","aria-expanded":R,children:[c.jsx("span",{children:"Metadata"}),c.jsxs("svg",{className:`w-3 h-3 transition-transform ${R?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("title",{children:R?"Collapse metadata":"Expand metadata"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})]})]}),R&&c.jsxs("div",{className:"px-3 pb-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Status"}),c.jsx("span",{className:"text-sm text-spur-text","data-testid":"metadata-status",children:i.status})]}),(J||Fe)&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("span",{className:"text-xs text-spur-text-muted block",children:"Dates"}),J&&c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Created"}),c.jsx("span",{className:"text-spur-text",children:J}),c.jsxs("span",{className:"text-spur-text-muted",children:["(",be,")"]})]}),Fe&&c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Updated"}),c.jsx("span",{className:"text-spur-text",children:Fe}),c.jsxs("span",{className:"text-spur-text-muted",children:["(",Re,")"]})]})]}),Nt.length>0&&c.jsxs("div",{children:[c.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Tags"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:Nt.map(U=>c.jsx(st,{variant:"outline",size:"xs",className:"text-spur-text-muted",children:U},U))})]}),c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"File"}),c.jsx("span",{className:"text-spur-text font-mono truncate",children:i.filePath})]}),r.length>0&&c.jsxs("div",{children:[c.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Child features (",r.length,")"]}),c.jsx("div",{className:"space-y-1",children:r.map(U=>c.jsxs("button",{type:"button",onClick:()=>a?.(U.id),className:"flex items-center gap-2 w-full text-xs text-left hover:underline cursor-pointer","aria-label":`Open child feature ${U.id}: ${U.name}`,children:[c.jsx("span",{className:"shrink-0 text-[13px]",title:U.status,children:c.jsx(Kg,{status:U.status})}),c.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:U.id}),c.jsx("span",{className:"text-spur-text truncate flex-1 min-w-0",children:U.name})]},U.id))})]}),c.jsxs("div",{children:[c.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Linked Tasks (",Pe.length,")"]}),Pe.length===0?c.jsx("span",{className:"text-xs text-spur-text-muted italic",children:"No linked tasks"}):c.jsx("div",{className:"space-y-1",children:Pe.map(U=>c.jsxs("div",{className:"flex items-center gap-2 w-full text-xs",children:[c.jsx("span",{className:"shrink-0 text-[13px]",title:U.status,children:Yg(U.status)}),c.jsxs("button",{type:"button",onClick:()=>xt(U.wbs),className:"flex items-center gap-2 flex-1 min-w-0 text-left hover:underline cursor-pointer","aria-label":`Go to task ${U.wbs}: ${U.name}`,children:[c.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:U.wbs}),c.jsx("span",{className:"text-spur-text truncate",children:U.name})]}),c.jsx("span",{className:"px-1.5 py-0.5 rounded-full border border-spur-border text-[10px] text-spur-text-muted shrink-0",children:U.status})]},U.wbs))})]})]})]}),c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-3","data-testid":"feature-body-section",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Body"}),c.jsx("div",{className:"flex gap-1",children:d==="preview"?c.jsx(He,{variant:"ghost",size:"xs",onClick:Ae,disabled:m,"aria-label":"Edit body",children:"Edit"}):c.jsxs(c.Fragment,{children:[c.jsx(He,{variant:"primary",size:"xs",onClick:q,disabled:E,"aria-label":"Save body",children:E?"Saving…":"Save"}),c.jsx(He,{variant:"ghost",size:"xs",onClick:Ye,disabled:E,"aria-label":"Cancel edit",children:"Cancel"})]})})]}),m?c.jsxs("div",{className:"flex items-center gap-2 text-sm text-spur-text-muted",children:[c.jsx(Tr,{size:"xs",className:"text-spur-accent"}),"Loading body…"]}):d==="edit"?c.jsx("div",{className:"flex-1 min-h-0","data-testid":"body-editor",children:c.jsx(Ko,{value:l,onChange:U=>p(U??""),height:"100%","data-color-mode":"light"})}):c.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"body-preview",children:c.jsx(W7,{source:o})})]}),M&&c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Confirm cancel feature",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:U=>{U.target===U.currentTarget&&j(!1)},onKeyDown:U=>{U.key==="Escape"&&j(!1)},children:c.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-xs w-full",children:[c.jsxs("p",{className:"text-sm text-spur-text mb-4",children:["Cancel feature ",c.jsx("strong",{children:e}),"? This marks it as cancelled and cannot be undone from the board."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>j(!1),children:"Keep"}),c.jsx(He,{variant:"error",size:"xs",onClick:je,children:"Cancel feature"})]})]})}),H&&c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`Configure ${H} action`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:U=>{U.target===U.currentTarget&&Z(null)},onKeyDown:U=>{U.key==="Escape"&&Z(null)},children:c.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[H==="sync-status"?c.jsxs(c.Fragment,{children:[c.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:"Sync Status — Direction"}),c.jsx("div",{className:"space-y-3",children:c.jsxs(Zr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:Y,onChange:U=>le(U.target.value),children:[c.jsx("option",{value:"push",children:"Push (feature → tasks)"}),c.jsx("option",{value:"pull",children:"Pull (tasks → feature)"})]})})]}):c.jsxs(c.Fragment,{children:[c.jsxs("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:[Br[H]," — Select Channel"]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(Zr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:ue,onChange:U=>k(U.target.value),children:["claude","codex","gemini","pi","opencode","antigravity","openclaw"].map(U=>c.jsx("option",{value:U,children:U},U))}),c.jsxs("label",{htmlFor:"skip-deps",className:"flex items-center gap-2 cursor-pointer",children:[c.jsx(Lg,{id:"skip-deps",size:"xs",checked:!1,onChange:()=>{}}),c.jsx("span",{className:"text-xs text-spur-text",children:"Skip dependencies"})]})]})]}),c.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>Z(null),children:"Cancel"}),c.jsx(He,{variant:"primary",size:"xs",onClick:_t,children:A===H?"Dispatching…":"Dispatch"})]})]})}),V&&c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`${Br[V]} input`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:U=>{U.target===U.currentTarget&&ie(null)},onKeyDown:U=>{U.key==="Escape"&&ie(null)},children:c.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[c.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:Br[V]}),V==="link-task"?c.jsxs(Zr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:X,onChange:U=>re(U.target.value),children:[c.jsx("option",{value:"",children:"— Select a task —"}),(ge??[]).filter(U=>U.featureId!==e).map(U=>c.jsxs("option",{value:U.wbs,children:[U.wbs," — ",U.name]},U.wbs))]}):c.jsx("input",{type:"text",className:"w-full px-3 py-2 rounded border border-spur-border bg-spur-bg text-sm text-spur-text focus:outline-none focus:border-spur-accent",placeholder:"Enter child feature name",value:X,onChange:U=>re(U.target.value),onKeyDown:U=>{U.key==="Enter"&&X.trim()&&Ze()}}),c.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>ie(null),children:"Cancel"}),c.jsx(He,{variant:"primary",size:"xs",onClick:Ze,disabled:!X.trim()||A===V,children:A===V?"…":"Create"})]})]})}),c.jsx(hA,{open:D,onClose:()=>ke(!1),onCreated:nn,folder:["docs","tasks2"].join("/"),featureId:e}),c.jsx(EA,{open:Le,parentId:e,onClose:()=>ve(!1),onCreated:ut}),c.jsx(K7,{progress:Ue,isDismissed:he,onDismiss:()=>ct(!0),onReopen:()=>ct(!1)})]})}function s$(e){const t=e.match(/^---\n[\s\S]*?\n---\n/);return t?e.slice(t[0].length):e}function SA(e,t){return e.id.localeCompare(t.id)}function o$({features:e,selectedId:t,onSelect:n}){const r=e.filter(i=>i.id.length===1).slice().sort(SA),a=AA(e);return c.jsx("ul",{className:"py-1","data-feature-tree":!0,children:r.map(i=>c.jsx(vA,{feature:i,childrenMap:a,selectedId:t,onSelect:n,depth:0},i.id))})}function AA(e){const t=new Map;for(const n of e){if(n.id.length<=1)continue;const r=n.id.slice(0,-1),a=t.get(r);a?a.push(n):t.set(r,[n])}for(const n of t.values())n.sort(SA);return t}function vA({feature:e,childrenMap:t,selectedId:n,onSelect:r,depth:a}){const i=t.get(e.id),s=e.id===n,o=`${a*16}px`;return c.jsxs("li",{children:[c.jsxs("button",{type:"button",onClick:()=>r(e.id),className:`w-full flex items-center gap-1.5 px-2 py-1 text-left text-sm transition-colors hover:bg-base-300 ${s?"bg-spur-accent/10 text-spur-accent font-semibold":"text-spur-text"}`,style:{paddingLeft:`calc(0.5rem + ${o})`},children:[c.jsx(cP,{position:"right",tip:xA(e.status),className:"flex! w-4 shrink-0 items-center justify-center","data-testid":"feature-tree-status",children:c.jsx(Kg,{status:e.status})}),c.jsx("span",{className:"text-xs font-mono text-spur-text-muted shrink-0",children:e.id}),c.jsx("span",{className:"flex-1 truncate",children:e.name})]}),i&&i.length>0&&c.jsx("ul",{children:i.map(u=>c.jsx(vA,{feature:u,childrenMap:t,selectedId:n,onSelect:r,depth:a+1},u.id))})]})}const u$=()=>`${et()}/events/planning`;function l$({className:e="w-3.5 h-3.5"}){return c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("polygon",{points:"1.5 2.5 14.5 2.5 9.5 8.5 9.5 13.5 6.5 13.5 6.5 8.5 1.5 2.5"})})}function c$(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,i]=g.useState(!1),[s,o]=g.useState("all"),[u,l]=g.useState(!1),[p,d]=g.useState(null),[f,m]=g.useState(0),b=g.useRef(null),E=g.useMemo(()=>AA(e??[]),[e]),y=g.useCallback(async R=>{try{const v=await Q9(R);t(v),d(null)}catch(v){if(R?.aborted)return;d(v instanceof Error?v.message:String(v))}},[]);if(g.useEffect(()=>{const R=new AbortController;return y(R.signal),()=>R.abort()},[y]),g.useEffect(()=>{if(!u)return;const R=A=>{b.current&&!b.current.contains(A.target)&&l(!1)},v=A=>{A.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",R),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",v)}},[u]),g.useEffect(()=>{if(typeof EventSource>"u")return;const R=new EventSource(u$());return R.onmessage=v=>{try{const N=JSON.parse(v.data).eventName;if(!TA(N))return;y(),n&&(N==="feature.updated"||N==="feature.transitioned"||N==="queue.job.completed")&&m(F=>F+1)}catch{}},()=>R.close()},[y,n]),p)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load features: ",p]});if(e===null)return c.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Loading features…"});const x=()=>{i(!1),y()},T=(R=>{if(s==="all")return R;const v=s.toLowerCase(),A=new Set;for(const N of R)if(N.status.toLowerCase()===v){A.add(N.id);let F=N.id;for(;F.length>1;)F=F.slice(0,-1),A.add(F)}return R.filter(N=>A.has(N.id))})(e),I=n?E.get(n)??[]:[];return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex h-full overflow-hidden","data-features-shell":!0,children:[c.jsxs("div",{className:"w-72 shrink-0 border-r border-spur-border overflow-y-auto bg-base-200",children:[c.jsxs("div",{className:"px-3 py-2 border-b border-spur-border flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Features"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsxs("div",{className:"relative",ref:b,children:[c.jsxs(He,{variant:"ghost",size:"xs",className:`relative text-spur-text-muted hover:text-spur-accent flex items-center gap-1 ${s!=="all"?"text-spur-accent font-semibold":""}`,onClick:()=>l(R=>!R),"aria-label":"Filter features by status","aria-expanded":u,title:"Filter features by status",children:[c.jsx(l$,{className:"w-3.5 h-3.5"}),s!=="all"&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-spur-accent shrink-0","aria-hidden":"true"})]}),u&&c.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 w-44 rounded-md shadow-lg bg-base-100 border border-spur-border py-1 text-xs","data-filter-menu":!0,children:[c.jsxs("div",{className:"px-2.5 py-1 font-semibold text-spur-text-muted border-b border-spur-border flex items-center justify-between",children:[c.jsx("span",{children:"Filter by Status"}),s!=="all"&&c.jsx("button",{type:"button",onClick:()=>{o("all"),l(!1)},className:"text-[10px] text-spur-accent hover:underline",children:"Reset"})]}),c.jsxs("button",{type:"button",onClick:()=>{o("all"),l(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 ${s==="all"?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[c.jsx("span",{className:"flex-1",children:"All"}),s==="all"&&c.jsx("span",{children:"✓"})]}),bi.map(R=>c.jsxs("button",{type:"button",onClick:()=>{o(R),l(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 capitalize ${s===R?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[c.jsx(Kg,{status:R}),c.jsx("span",{className:"flex-1 capitalize",children:R}),s===R&&c.jsx("span",{children:"✓"})]},R))]})]}),c.jsx(He,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:()=>i(!0),"aria-label":"Add root feature",title:"Add root feature",children:"+"})]})]}),e.length===0?c.jsx("div",{className:"p-3 text-xs text-spur-text-muted italic",children:"No features found."}):T.length===0?c.jsxs("div",{className:"p-3 text-xs text-spur-text-muted italic",children:['No features match status filter "',s,'".']}):c.jsx(o$,{features:T,selectedId:n,onSelect:r})]}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:n?c.jsx(i$,{featureId:n,refreshKey:f,onClose:()=>r(null),childFeatures:I,onSelectFeature:r}):c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-spur-text-muted italic",children:"Select a feature to view details"})})]}),c.jsx(EA,{open:a,parentId:"",onClose:()=>i(!1),onCreated:x})]})}const d$={id:"features",name:"Feature Board",icon:"🏷️",route:"features",component:c$,sidebarLabel:"Features"},p$=Object.freeze(Object.defineProperty({__proto__:null,module:d$},Symbol.toStringTag,{value:"Module"}));function f$(e){if(!e||typeof e!="object"||!("teams"in e))return null;const t=e.teams;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.teamId!="string"||typeof a.name!="string"||!Array.isArray(a.members))continue;const i=[];for(const s of a.members){if(!s||typeof s!="object")continue;const o=s;typeof o.id!="string"||typeof o.type!="string"||typeof o.status!="string"||i.push({id:o.id,type:o.type,status:o.status,...typeof o.model=="string"&&o.model.length>0?{model:o.model}:{},...typeof o.autoStart=="boolean"?{autoStart:o.autoStart}:{},...typeof o.pid=="number"?{pid:o.pid}:{},...typeof o.role=="string"&&o.role.length>0?{role:o.role}:{},...typeof o.executor=="string"&&o.executor.length>0?{executor:o.executor}:{}})}n.push({teamId:a.teamId,name:a.name,workDir:typeof a.workDir=="string"?a.workDir:null,isCurrentProject:a.isCurrentProject===!0,members:i})}return n}const m$=()=>`${et()}/team/teams`,h$=5e3;function Ei(){const[e,t]=g.useState([]),[n,r]=g.useState(null),a=g.useRef(!0),i=g.useCallback(async()=>{try{const s=await Ke(new Request(m$()));if(!s.ok)throw new Error(`teams fetch failed: ${s.status}`);const o=await s.json(),u=f$(o);u&&a.current&&(t(u),r(null))}catch(s){a.current&&r(s instanceof Error?s.message:String(s))}},[]);return g.useEffect(()=>{a.current=!0,i();const s=setInterval(i,h$);return()=>{a.current=!1,clearInterval(s)}},[i]),{teams:e,error:n,reload:i}}const g$=(e=50)=>`${et()}/messages?limit=${e}`,b$=()=>`${et()}/events/planning`,E$=new Set(["message.sent","message.replied"]);function Cy(e,t){if(e&&typeof e=="object"){const n=e;return{agentId:typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:t,...typeof n.teamId=="string"&&n.teamId?{teamId:n.teamId}:{},...typeof n.teamName=="string"&&n.teamName?{teamName:n.teamName}:{},...typeof n.memberLabel=="string"&&n.memberLabel?{memberLabel:n.memberLabel}:{},...typeof n.agentType=="string"&&n.agentType?{agentType:n.agentType}:{}}}return{agentId:t}}function y$(e){if(!e||typeof e!="object"||!("messages"in e))return null;const t=e.messages;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.id!="string"||typeof a.toId!="string"||typeof a.body!="string"||typeof a.status!="string"||typeof a.createdAt!="string")continue;const i=a.fromId===null||a.fromId===void 0?null:typeof a.fromId=="string"?a.fromId:null;n.push({id:a.id,fromId:i,toId:a.toId,body:a.body,status:a.status,createdAt:a.createdAt,inReplyTo:typeof a.inReplyTo=="string"?a.inReplyTo:null,hasReply:a.hasReply===!0,replyCount:typeof a.replyCount=="number"&&Number.isFinite(a.replyCount)?a.replyCount:0,...i!==null?{from:Cy(a.from,i)}:{},to:Cy(a.to,a.toId)})}return n}function wA(e,t){return e.filter(n=>n.to.teamId===t||n.from?.teamId===t)}function Xg(){const[e,t]=g.useState(null),[n,r]=g.useState(null),a=g.useCallback(async i=>{try{const s=await Ke(new Request(g$(),{signal:i}));if(!s.ok)throw new Error(`messages fetch failed: ${s.status}`);const o=y$(await s.json());o&&t(o)}catch(s){if(i?.aborted)return;r(s instanceof Error?s.message:String(s))}},[]);return g.useEffect(()=>{const i=new AbortController;a(i.signal);const s=setInterval(()=>{a(i.signal)},1e4);return()=>{i.abort(),clearInterval(s)}},[a]),g.useEffect(()=>{if(typeof EventSource>"u")return;const i=new AbortController,s=new EventSource(b$());return s.onmessage=o=>{try{const u=JSON.parse(o.data);if(u===null||typeof u!="object")return;const l=u.eventName;typeof l=="string"&&E$.has(l)&&a(i.signal)}catch{}},()=>{i.abort(),s.close()}},[a]),{messages:e,error:n}}function Qg({messages:e}){return e.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-message-feed-empty":!0,children:"No messages yet."}):c.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:e.map(t=>{const n=t.from?[t.from.memberLabel??t.from.agentId,t.from.agentType].filter(Boolean).join(" · "):t.fromId??"system",r=[t.to.memberLabel??t.to.agentId,t.to.agentType].filter(Boolean).join(" · "),a=t.from?.teamName,i=t.to.teamName,s=t.status==="injected"?"injected":t.status==="queued"?"queued":null;return c.jsxs("li",{className:"p-2 bg-spur-surface-2 border border-spur-border rounded-xl text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2 text-spur-text-muted text-xs",children:[c.jsxs("span",{"data-message-route":!0,className:"truncate",children:[a&&c.jsxs("span",{className:"text-xs opacity-70",children:[a," / "]}),c.jsx("span",{children:n}),c.jsx("span",{className:"mx-1",children:"→"}),i&&c.jsxs("span",{className:"text-xs opacity-70",children:[i," / "]}),c.jsx("span",{children:r})]}),s&&c.jsx("span",{className:`text-xs px-1 rounded ${s==="injected"?"bg-success/20 text-success":"bg-warning/20 text-warning"}`,"data-message-delivery":!0,children:s}),c.jsx("span",{className:`text-xs ${t.hasReply?"text-info":"text-spur-text-muted"}`,"data-message-reply-badge":!0,"data-message-reply-state":t.hasReply?"replied":"awaiting",children:t.hasReply?t.replyCount>1?`Replied (${t.replyCount})`:"Replied":"Awaiting reply"}),c.jsx("span",{className:"ml-auto font-mono text-xs text-spur-text-muted",children:t.createdAt})]}),c.jsx("p",{className:"text-spur-text mt-1 whitespace-pre-wrap break-words",children:t.body})]},t.id)})})}function x$({teamId:e}){const{messages:t,error:n}=Xg();if(n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=e?wA(t,e):t;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-all-tab":!0,children:[c.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:e?`Message · ${e}`:"Message · all teams"})}),c.jsx(Qg,{messages:r})]})}function T$(e,t){return e.filter(n=>n.fromId===t||n.toId===t)}function S$({agentId:e}){const{messages:t,error:n}=Xg();if(n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=T$(t,e);return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-agent-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Messages"}),c.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e})]}),c.jsx(Qg,{messages:r})]})}const Iy="supervisor";function A$(e){return e.fromId===Iy||e.toId===Iy}function v$({teamId:e}){const{messages:t,error:n}=Xg();if(n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=t.filter(A$),a=e?wA(r,e):r;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-supervisor-tab":!0,children:[c.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Message · supervisor"})}),c.jsx(Qg,{messages:a})]})}const w$=[{id:"all",label:"All"},{id:"supervisor",label:"Supervisor"}],su="agent-";function _$(e,t,n){if(e==="all")return c.jsx(x$,{teamId:n});if(e==="supervisor")return c.jsx(v$,{teamId:n});if(e.startsWith(su)){const r=e.slice(su.length);if(t.includes(r))return c.jsx(S$,{agentId:r})}return null}function _A({teamId:e}){const{teams:t}=Ei(),[n,r]=g.useState(""),[a,i]=g.useState("all");g.useEffect(()=>{e||!n&&t.length>0&&r(t[0]?.teamId??"")},[e,t,n]);const s=e??n,o=t.find(d=>d.teamId===s)??t[0]??null,u=o?o.members.map(d=>d.id):[],l=a==="all"||a==="supervisor"||u.includes(a.slice(su.length))?a:"all",p=g.useMemo(()=>{const d=u.map(f=>({id:`${su}${f}`,label:f}));return[...w$,...d]},[u]);return c.jsxs("div",{className:"inbox flex flex-col h-full overflow-hidden bg-spur-bg","data-inbox-shell":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Inbox"}),!e&&t.length>0&&c.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"inbox-team-select",children:[c.jsx("span",{className:"text-spur-text-muted",children:"Team"}),c.jsxs(Zr,{id:"inbox-team-select",variant:"bordered",size:"sm",value:o?.teamId??"",onChange:d=>{r(d.target.value),i("all")},"data-inbox-team-select":!0,children:[c.jsx("option",{value:"",children:"Select team…"}),t.map(d=>c.jsx("option",{value:d.teamId,children:d.name},d.teamId))]})]})]}),c.jsx("div",{role:"tablist","aria-label":"Inbox tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:p.map(d=>{const f=d.id===l;return c.jsx("button",{type:"button",role:"tab","aria-selected":f,"aria-controls":`inbox-tab-panel-${d.id}`,id:`inbox-tab-${d.id}`,onClick:()=>i(d.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${f?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-inbox-tab":!0,children:d.label},d.id)})}),c.jsx("div",{role:"tabpanel",id:`inbox-tab-panel-${l}`,"aria-labelledby":`inbox-tab-${l}`,className:"flex-1 overflow-hidden",children:_$(l,u,e)})]})}const N$={id:"inbox",name:"Inbox",icon:"💬",route:"inbox",component:_A,sidebarLabel:"Inbox",order:1},C$=Object.freeze(Object.defineProperty({__proto__:null,module:N$},Symbol.toStringTag,{value:"Module"}));var Ua=mv();const I$=()=>`${et()}/events/planning`,sd=100;function ky(e){const t=`${et()}/events/history`,n=[],r=e.limit??sd;return n.push(`limit=${r}`),e.prefix&&n.push(`prefix=${encodeURIComponent(e.prefix)}`),e.names&&n.push(`names=${encodeURIComponent(e.names)}`),e.actor&&n.push(`actor=${encodeURIComponent(e.actor)}`),e.runId&&n.push(`runId=${encodeURIComponent(e.runId)}`),e.since&&n.push(`since=${encodeURIComponent(e.since)}`),e.cursor&&n.push(`cursor=${encodeURIComponent(e.cursor)}`),`${t}?${n.join("&")}`}const k$={workflow:"text-cyan-400",task:"text-emerald-400",feature:"text-emerald-400",agent:"text-amber-400",rule:"text-rose-400",message:"text-sky-400",process:"text-violet-400",queue:"text-orange-400",bus:"text-pink-400",api:"text-teal-400"},Ry="text-spur-text-muted";function NA(e){return e?k$[e]??Ry:Ry}const dc={selectedPrefixes:new Set,searchQuery:"",searchScope:"all",tierFilter:"all",timeWindow:"all",runId:""};function R$(){const e=g.useRef([]),[t,n]=g.useState(0);g.useEffect(()=>{const a=window.setInterval(()=>{const i=Date.now()-6e4,s=e.current.filter(o=>o>=i);e.current=s,n(s.length)},1e3);return()=>window.clearInterval(a)},[]);const r=g.useCallback(()=>{const a=Date.now(),i=a-6e4,s=e.current.filter(o=>o>=i);s.push(a),e.current=s,n(s.length)},[]);return{rate:t,recordEvent:r}}function ei(e){if(e===null||typeof e!="object"||!("events"in e)||!("count"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=e.count;if(typeof n!="number")return null;const r=e.nextCursor,a=typeof r=="string"?r:null,i=e.hasMore,s=typeof i=="boolean"?i:!1,o=[];for(const p of t){const d=D$(p);d&&o.push(d)}const u=e.catalog,l=Array.isArray(u)?O$(u):void 0;return{events:o,count:n,nextCursor:a,hasMore:s,...l?{catalog:l}:{}}}function D$(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.eventName!="string"||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const i=t.payload,s=typeof t.runId=="string"?t.runId:t.runId===null?null:void 0,o=typeof t.entityKind=="string"?t.entityKind:t.entityKind===null?null:void 0,u=typeof t.entityId=="string"?t.entityId:t.entityId===null?null:void 0,l=typeof t.sequence=="number"&&Number.isFinite(t.sequence)?t.sequence:t.sequence===null?null:void 0,p={id:t.id,eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{}};if(i===null)return{...p,payload:null,view:uu(t.eventName,null),...ou(s,o,u,l)};if(typeof i!="object")return null;const d=i,f=d.schemaVersion===2?d:void 0;return{...p,payload:CA(d),...f?{envelope:f}:{},view:uu(t.eventName,d),...ou(s,o,u,l)}}function ou(e,t,n,r){const a={};return e!==void 0&&(a.runId=e),t!==void 0&&(a.entityKind=t),n!==void 0&&(a.entityId=n),r!==void 0&&(a.sequence=r),a}function O$(e){const t=[];for(const n of e){if(n===null||typeof n!="object")return;const r=n;if(typeof r.name!="string"||typeof r.prefix!="string"||typeof r.source!="string"||typeof r.renderer!="string")return;const a=typeof r.tier=="string"?r.tier:void 0,i={name:r.name,prefix:r.prefix,source:r.source,renderer:r.renderer,...a!==void 0?{tier:a}:{}};t.push(i)}return t}function L$(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||t.eventName.length===0||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const i=t.payload;if(i!==null&&typeof i!="object")return null;const s=i,o=s?.schemaVersion===2?s:void 0,u=CA(s),l=t.runId??u?.runId,p=t.entityKind??u?.entityKind,d=t.entityId??u?.entityId,f=t.sequence??u?.sequence,m=typeof l=="string"?l:l===null?null:void 0,b=typeof p=="string"?p:p===null?null:void 0,E=typeof d=="string"?d:d===null?null:void 0,y=typeof f=="number"&&Number.isFinite(f)?f:f===null?null:void 0;return{eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{},payload:u,...o?{envelope:o}:{},view:uu(t.eventName,s),...ou(m,b,E,y)}}function uu(e,t){const n=F$(e);if(t?.schemaVersion!==2)return n;const r=$r(t.context),a=$r(t.presentation),i=$r(r?.project),s=$r(r?.producer),o=$r(r?.correlation);if(!r||!a||!i||!s||!o)return n;const u=a.severity==="info"||a.severity==="warning"||a.severity==="error"?a.severity:"warning",l=Array.isArray(a.fields)?a.fields.flatMap(b=>{const E=$r(b),y=In(E?.label,64),x=In(E?.value,256);return y&&x?[{label:y,value:x}]:[]}).slice(0,8):[],p=[],d=(b,E)=>{const y=In(E,128);y&&p.push({label:b,value:y})};d("Run",o.runId),d("Execution",o.executionId),d("Action",o.actionId),d("Entity",P$(o.entityKind,o.entityId)),d("Job",o.jobId),typeof o.sequence=="number"&&Number.isFinite(o.sequence)&&p.push({label:"Sequence",value:String(o.sequence)});const f=In(s.package,128)??"unavailable",m=In(s.subsystem,128);return{severity:u,summary:In(a.summary,512)??"unavailable",description:In(a.description,512)??"Description unavailable.",fields:l,projectName:In(i.name,128)??"unavailable",projectRoot:In(i.root,256)??"unavailable",producer:m?`${f} / ${m}`:f,correlation:p.map(({label:b,value:E})=>`${b.toLowerCase()} ${E}`).join(" · ")||"unavailable",correlationFields:p,outcome:In(a.outcome,128)??"unavailable",action:M$(a.action)}}function F$(e){return{severity:"warning",summary:"unavailable",description:`Canonical context unavailable for ${In(e,128)??"unknown"}.`,fields:[],projectName:"unavailable",projectRoot:"unavailable",producer:"unavailable",correlation:"unavailable",correlationFields:[],outcome:"unavailable",action:null}}function M$(e){const t=$r(e);if(!t||t.kind!=="command"&&t.kind!=="filter"&&t.kind!=="path")return null;const n=In(t.label,128),r=In(t.value,256);return n&&r?{label:n,kind:t.kind,value:r}:null}function In(e,t){return typeof e!="string"||e.length===0?null:e.length<=t?e:`${e.slice(0,t-1)}…`}function P$(e,t){const n=In(e,64),r=In(t,128);return n&&r?`${n}:${r}`:n??r}function $r(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function CA(e){return e?.schemaVersion!==2?e:$r(e.data)}const B$=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function U$(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=B$[t.getMonth()],r=t.getDate(),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${n} ${r} ${a}:${i}:${s}`}function lu(e){return typeof e!="number"||!Number.isFinite(e)?null:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function bt(e){return e&&e!=="unavailable"?e:"-"}function j$(e){const t={};e.selectedPrefixes.size===1&&(t.prefix=[...e.selectedPrefixes][0]);const n=e.searchQuery.trim();if(n!==""&&e.searchScope==="name"&&(t.names=n),n!==""&&e.searchScope==="actor"&&(t.actor=n),e.runId.trim()!==""&&(t.runId=e.runId.trim()),e.timeWindow!=="all"){const r=e.timeWindow==="30s"?3e4:3e5;t.since=new Date(Date.now()-r).toISOString()}return t}function Dy(e,t,n){if(t.selectedPrefixes.size>=1){const r=e.prefix??e.eventName.split(".")[0]??e.eventName;if(!t.selectedPrefixes.has(r))return!1}if(t.tierFilter!=="all"){const r=n.get(e.eventName);if(r!==t.tierFilter&&!(t.tierFilter==="default"&&r===void 0))return!1}if(t.searchQuery.trim()!==""){const r=t.searchQuery.toLowerCase();let a=!1;if((t.searchScope==="name"||t.searchScope==="all")&&(a=a||e.eventName.toLowerCase().includes(r)),(t.searchScope==="actor"||t.searchScope==="all")&&(a=a||(e.actor?.toLowerCase().includes(r)??!1)),t.searchScope==="payload"&&e.payload&&(a=a||JSON.stringify(e.payload).toLowerCase().includes(r)),!a)return!1}if(t.timeWindow!=="all"){const r=t.timeWindow==="30s"?3e4:3e5,a=Date.now()-r,i=new Date(e.occurredAt).getTime();if(Number.isNaN(i)||i<a)return!1}return!(t.runId.trim()!==""&&e.runId!==t.runId.trim())}function $$(){const[e,t]=g.useState([]),[n,r]=g.useState([]),[a,i]=g.useState("idle"),[s,o]=g.useState(null),[u,l]=g.useState(null),[p,d]=g.useState(!1),[f,m]=g.useState(!1),[b,E]=g.useState(dc),[y,x]=g.useState(dc),[w,T]=g.useState("connecting"),{rate:I,recordEvent:R}=R$(),v=g.useMemo(()=>{const X=new Map;for(const re of n)re.tier&&X.set(re.name,re.tier);return X},[n]);g.useEffect(()=>{const X=window.setTimeout(()=>{x(b)},250);return()=>window.clearTimeout(X)},[b]);const A=g.useMemo(()=>j$(y),[y]),N=g.useRef(0);g.useEffect(()=>{const X=++N.current,re=new AbortController;return i("loading"),o(null),(async()=>{try{const ue=await Ke(new Request(ky({...A,limit:sd}),{signal:re.signal}));if(!ue.ok){const le=await ue.json().catch(()=>null),D=le?.code;throw D==="UNKNOWN_PREFIX"||D==="MALFORMED_CURSOR"?new Error(`${D}: ${le.error??ue.status}`):new Error(`history fetch failed: ${ue.status}`)}const k=await ue.json(),Y=ei(k);if(!Y)throw new Error("history response failed schema validation");if(X!==N.current)return;t(Y.events),Y.catalog&&r(Y.catalog),l(Y.nextCursor),d(Y.hasMore),i("loaded")}catch(ue){if(re.signal.aborted||X!==N.current)return;o(ue instanceof Error?ue.message:String(ue)),i("error")}})(),()=>re.abort()},[A]);const F=g.useCallback(async()=>{if(!(!p||f||u===null)){m(!0);try{const X=await Ke(new Request(ky({...A,limit:sd,cursor:u})));if(!X.ok)throw new Error(`history fetch failed: ${X.status}`);const re=await X.json(),ue=ei(re);if(!ue)throw new Error("history response failed schema validation");t(k=>{const Y=new Set(k.map(D=>D.id)),le=ue.events.filter(D=>!Y.has(D.id));return[...k,...le]}),ue.catalog&&r(ue.catalog),l(ue.nextCursor),d(ue.hasMore)}catch(X){o(X instanceof Error?X.message:String(X))}finally{m(!1)}}},[p,f,u,A]),_=g.useRef(b);_.current=b;const M=g.useRef(v);M.current=v,g.useEffect(()=>{if(typeof EventSource>"u")return;const X=new EventSource(I$());return X.onopen=()=>{T("live")},X.onerror=()=>{T("errored")},X.onmessage=re=>{try{const ue=JSON.parse(re.data),k=L$(ue);if(!k||k.eventName==="connected")return;const Y=_.current,le=M.current;if(!Dy({eventName:k.eventName,occurredAt:k.occurredAt,actor:k.actor,...k.prefix?{prefix:k.prefix}:{},payload:k.payload,...k.runId!==void 0?{runId:k.runId}:{}},Y,le))return;const D={id:`live-${k.occurredAt}-${k.eventName}`,eventName:k.eventName,occurredAt:k.occurredAt,actor:k.actor,...k.prefix?{prefix:k.prefix}:{},...k.renderer?{renderer:k.renderer}:{},payload:k.payload,...k.envelope?{envelope:k.envelope}:{},view:k.view,...ou(k.runId,k.entityKind,k.entityId,k.sequence)};t(ke=>[D,...ke]),R()}catch{}},()=>X.close()},[R]);const j=g.useMemo(()=>Array.from(new Set([...n.map(X=>X.prefix),...e.map(X=>X.prefix??X.eventName.split(".")[0]??X.eventName)])).sort(),[n,e]),H=b.selectedPrefixes.size>0||b.searchQuery.trim()!==""||b.searchScope!=="all"||b.tierFilter!=="all"||b.timeWindow!=="all"||b.runId.trim()!=="",Z=g.useCallback(()=>{E(dc)},[]),V=g.useCallback(X=>{E(re=>{const ue=new Set(re.selectedPrefixes);return ue.has(X)?ue.delete(X):ue.add(X),{...re,selectedPrefixes:ue}})},[]);if(a==="error")return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load event history: ",s]});if(a==="idle"||a==="loading")return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading event history…"]});const ie=e.filter(X=>Dy(X,b,v));return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center justify-between gap-3 flex-wrap",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"System Events"}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"newest first · live tail"})]}),c.jsx(z$,{status:w,rate:I,shown:ie.length,total:e.length,hasMore:p})]}),c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-100 shrink-0 flex flex-col gap-2",children:[c.jsxs("fieldset",{className:"flex flex-wrap items-center gap-1.5 border-0 p-0 m-0","aria-label":"Filter by prefix",children:[c.jsx("legend",{className:"sr-only",children:"Filter by prefix"}),j.map(X=>{const re=b.selectedPrefixes.has(X),ue=NA(X);return c.jsxs("button",{type:"button",role:"switch","aria-checked":re,"aria-label":`Prefix ${X}${re?" (selected)":""}`,onClick:()=>V(X),className:`px-2 py-0.5 rounded-full text-[11px] font-mono border transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 ${re?`${ue} border-current bg-base-200`:"text-spur-text-muted border-spur-border/40 hover:bg-base-200/60"}`,children:[X,".*"]},X)})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Oy,{label:"Tier",value:b.tierFilter,onChange:X=>E(re=>({...re,tierFilter:X})),options:[{value:"all",label:"All"},{value:"default",label:"Default"},{value:"diagnostic",label:"Diagnostic"}]}),c.jsx(Oy,{label:"Window",value:b.timeWindow,onChange:X=>E(re=>({...re,timeWindow:X})),options:[{value:"all",label:"All"},{value:"30s",label:"30s"},{value:"5m",label:"5m"}]}),c.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[220px]",children:[c.jsxs("select",{value:b.searchScope,onChange:X=>E(re=>({...re,searchScope:X.target.value})),className:"bg-base-200 border border-spur-border rounded px-1.5 py-0.5 text-[11px] text-spur-text focus:outline-none focus:ring-2 focus:ring-spur-text/40 cursor-pointer","aria-label":"Search scope",children:[c.jsx("option",{value:"all",children:"all"}),c.jsx("option",{value:"name",children:"name"}),c.jsx("option",{value:"actor",children:"actor"}),c.jsx("option",{value:"payload",children:"payload"})]}),c.jsx(gs,{size:"sm",variant:"bordered",placeholder:"Search…",value:b.searchQuery,onChange:X=>E(re=>({...re,searchQuery:X.target.value})),className:"flex-1 min-w-[120px] input-sm","aria-label":`Search ${b.searchScope}`})]}),c.jsx(gs,{size:"sm",variant:"bordered",placeholder:"run id…",value:b.runId,onChange:X=>E(re=>({...re,runId:X.target.value})),className:"w-32 input-sm","aria-label":"Filter by run id"}),H&&c.jsx("button",{type:"button",onClick:Z,className:"text-[11px] text-spur-text-muted hover:text-error px-2 py-0.5 rounded border border-spur-border/40 hover:border-error/40 transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40","aria-label":"Clear all filters",children:"Clear"}),c.jsxs("span",{"aria-live":"polite",className:"text-[11px] font-mono text-spur-text-muted whitespace-nowrap",children:[ie.length," of ",e.length]})]})]}),ie.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic flex-1 overflow-y-auto",children:e.length===0?"No system events yet. New events from the planning bus will appear here in real time.":"No events match the active filters."}):c.jsx(G$,{rows:ie,catalog:n}),p&&c.jsx("div",{className:"px-4 py-2 border-t border-spur-border bg-base-100 shrink-0 flex justify-center",children:c.jsx("button",{type:"button",onClick:F,disabled:f,"data-load-older":!0,className:"text-[11px] text-spur-text-muted hover:text-spur-text px-3 py-1 rounded border border-spur-border/40 hover:border-spur-text/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-wait focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:f?"Loading…":"Load older"})})]})}function z$({status:e,rate:t,shown:n,total:r,hasMore:a}){const i=g.useMemo(()=>{switch(e){case"live":return"bg-success";case"connecting":return"bg-spur-text-muted";case"errored":return"bg-error"}},[e]),s=e==="live"?{animation:"spur-pulse 1.6s ease-in-out infinite"}:void 0;return c.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-spur-text-muted font-mono whitespace-nowrap",children:[c.jsxs("span",{role:"status","aria-label":`SSE connection ${e}`,className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{"aria-hidden":"true",className:`inline-block w-2 h-2 rounded-full ${i}`,style:s}),c.jsx("span",{className:"text-spur-text uppercase tracking-wide",children:e})]}),c.jsxs("span",{"aria-live":"polite","aria-atomic":"true",children:[t," events / 60s"]}),c.jsxs("span",{"aria-live":"polite","aria-atomic":"true",children:[n," of ",r," shown",a?" · more available":""]})]})}function H$(e){const[t,n]=g.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches);return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(e),a=()=>n(r.matches);return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),t}function G$({rows:e,catalog:t}){const n=g.useMemo(()=>{const a=new Map;for(const i of t)i.tier&&a.set(i.name,i.tier);return a},[t]),r=H$("(max-width: 639px)");return c.jsx("section",{className:"flex-1 overflow-y-auto min-w-0","data-system-events-tab":!0,"aria-label":"System events",children:c.jsxs("table",{className:`w-full ${r?"min-w-0":"min-w-[1180px]"} text-xs border-separate border-spacing-0 table-fixed`,children:[c.jsxs("colgroup",{children:[c.jsx("col",{className:r?"w-24":"w-36"}),!r&&c.jsx("col",{className:"w-24"}),c.jsx("col",{className:"w-[17%]"}),!r&&c.jsx("col",{className:"w-[22%]"}),!r&&c.jsx("col",{className:"w-[18%]"}),!r&&c.jsx("col",{className:"w-[20%]"}),!r&&c.jsx("col",{className:"w-28"}),!r&&c.jsx("col",{className:"w-[18%]"})]}),c.jsx("thead",{className:"sticky top-0 z-10 bg-base-200",children:c.jsxs("tr",{className:"text-left text-spur-text-muted uppercase tracking-wide text-[10px]",children:[c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Time"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Severity"}),c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Event"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Summary"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Producer"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Correlation"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Outcome"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Action"})]})}),c.jsx("tbody",{children:e.map(a=>c.jsx(V$,{event:a,tier:n.get(a.eventName)??"default",compact:r},a.id))})]})})}const pc="system-events-payload-tooltip-pin",W$={info:{icon:"●",className:"text-spur-text-muted"},warning:{icon:"▲",className:"text-warning"},error:{icon:"✕",className:"text-error"}};function fc({severity:e}){const t=W$[e];return c.jsxs("span",{className:`inline-flex items-center gap-1 whitespace-nowrap ${t.className}`,children:[c.jsx("span",{"aria-hidden":"true",children:t.icon}),c.jsx("span",{children:e})]})}function V$({event:e,tier:t,compact:n}){const r=e.prefix??e.eventName.split(".")[0]??e.eventName,a=g.useMemo(()=>e.view??uu(e.eventName,e.payload),[e.eventName,e.payload,e.view]),i=NA(r),[s,o]=g.useState(!1),[u,l]=g.useState(!1),[p,d]=g.useState(!1),[f,m]=g.useState(null),b=g.useRef(null),E=g.useRef(null),y=g.useRef(0),x=g.useRef(null),w=bt(e.actor),T=u||p,I=g.useCallback(()=>{x.current!==null&&(clearTimeout(x.current),x.current=null)},[]),R=g.useCallback(()=>{d(!1),m(null)},[]),v=g.useCallback((M,j)=>{y.current=performance.now()+400,d(!0),l(!1),I();const H=Number.isFinite(M)&&M>0?M:8,Z=Number.isFinite(j)&&j>0?j:8;m({x:H,y:Z}),window.dispatchEvent(new CustomEvent(pc,{detail:{id:e.id}}))},[e.id,I]),A=g.useCallback((M,j,H)=>{const Z=M.getBoundingClientRect(),V=j&&j>0?j:Z.left,ie=H&&H>0?H+4:Z.bottom+6;v(V,ie)},[v]);g.useEffect(()=>{const M=j=>{j.detail?.id!==e.id&&R()};return window.addEventListener(pc,M),()=>window.removeEventListener(pc,M)},[e.id,R]),g.useEffect(()=>{if(!p)return;const M=H=>{performance.now()<y.current||b.current?.contains(H.target)||E.current?.contains(H.target)||R()},j=H=>{H.key==="Escape"&&(R(),H.stopPropagation())};return document.addEventListener("pointerdown",M,!0),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",M,!0),document.removeEventListener("keydown",j,!0)}},[p,R]),g.useEffect(()=>()=>{I()},[I]);const N=g.useCallback(()=>o(M=>!M),[]),F=g.useCallback(M=>{if(M.key==="Escape"){if(p){R(),M.stopPropagation();return}o(!1),M.stopPropagation()}},[p,R]),_=T?c.jsxs("div",{ref:b,id:`system-event-tooltip-${e.id}`,role:"tooltip","data-testid":"system-event-payload-tooltip","data-pinned":p?"true":"false",className:p?"pointer-events-auto fixed z-50 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9] select-text cursor-text":"pointer-events-auto absolute left-0 top-full mt-1 z-30 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9]",style:p&&f?{top:f.y,left:f.x}:void 0,onMouseEnter:()=>{I(),l(!0)},onMouseLeave:()=>{p||(I(),x.current=setTimeout(()=>l(!1),150))},onFocusCapture:()=>l(!0),onBlurCapture:M=>{!p&&!M.currentTarget.contains(M.relatedTarget)&&l(!1)},onPointerDown:M=>{p&&M.stopPropagation()},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[c.jsxs("div",{className:"text-[10px] text-[#8b949e] font-sans",children:["event context",p?" · select to copy · Esc / outside click to close":" · click event name or Pin to lock for copy"]}),c.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!p&&c.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-pin",className:"text-[10px] text-[#c9d1d9] hover:text-white px-1.5 py-0.5 rounded border border-[#30363d] bg-[#21262d] cursor-pointer",onClick:M=>{M.stopPropagation(),M.preventDefault();const j=E.current;j?A(j):v(M.clientX,M.clientY)},children:"Pin"}),p&&c.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-close",className:"text-[10px] text-[#8b949e] hover:text-[#c9d1d9] px-1 rounded border border-[#30363d] cursor-pointer",onClick:M=>{M.stopPropagation(),R()},children:"close"})]})]}),c.jsx("p",{className:"mb-2 text-spur-text leading-relaxed","data-testid":"system-event-description",children:a.description}),c.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 max-h-80 overflow-y-auto",children:[c.jsx("dt",{className:"text-spur-text-muted",children:"Summary"}),c.jsx("dd",{className:"break-words",children:bt(a.summary)}),c.jsx("dt",{className:"text-spur-text-muted",children:"Severity"}),c.jsx("dd",{children:c.jsx(fc,{severity:a.severity})}),a.fields.map(M=>c.jsxs("div",{className:"contents",children:[c.jsx("dt",{className:"text-spur-text-muted",children:M.label}),c.jsx("dd",{className:"font-mono break-all",children:bt(M.value)})]},M.label+M.value)),c.jsx("dt",{className:"text-spur-text-muted",children:"Producer"}),c.jsx("dd",{className:"font-mono break-all",children:bt(a.producer)}),a.correlationFields.length>0?a.correlationFields.map(M=>c.jsxs("div",{className:"contents",children:[c.jsx("dt",{className:"text-spur-text-muted",children:M.label}),c.jsx("dd",{className:"font-mono break-all",children:bt(M.value)})]},`correlation-${M.label}`)):c.jsxs(c.Fragment,{children:[c.jsx("dt",{className:"text-spur-text-muted",children:"Correlation"}),c.jsx("dd",{className:"font-mono",children:"-"})]}),c.jsx("dt",{className:"text-spur-text-muted",children:"Outcome"}),c.jsx("dd",{className:"font-mono break-all",children:bt(a.outcome)})]}),a.action&&c.jsxs("div",{className:"mt-2 border-t border-[#30363d] pt-2","data-testid":"system-event-remediation",children:[c.jsx("div",{className:"text-spur-text-muted",children:a.action.label}),c.jsx("code",{className:"block mt-0.5 font-mono break-all select-text",children:a.action.value})]})]}):null;return c.jsxs(c.Fragment,{children:[c.jsxs("tr",{className:"group hover:bg-base-200/60 transition-colors",style:{height:n?void 0:28},children:[c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-spur-text-muted whitespace-nowrap align-middle",children:U$(e.occurredAt)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 align-middle text-[10px]",children:c.jsx(fc,{severity:a.severity})}),c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 relative align-middle min-w-0",children:c.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[c.jsx("button",{type:"button","aria-expanded":s,"aria-controls":`detail-${e.id}`,"aria-label":`${s?"Collapse":"Expand"} detail for ${e.eventName}`,onClick:N,onKeyDown:F,className:"inline-flex items-center justify-center w-4 h-4 text-spur-text-muted hover:text-spur-text text-[10px] transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 shrink-0",children:s?"▾":"▸"}),c.jsxs("div",{className:"relative min-w-0 max-w-full",children:[c.jsx("button",{ref:E,type:"button",className:`font-mono font-semibold truncate block max-w-full text-left cursor-pointer bg-transparent border-0 p-0 ${i}`,"data-testid":"system-event-name","aria-label":`Context for ${e.eventName}. Hover to preview; click to pin for select and copy.`,"aria-describedby":T?`system-event-tooltip-${e.id}`:void 0,onMouseEnter:()=>{I(),l(!0)},onFocus:()=>{I(),l(!0)},onBlur:M=>{!p&&!b.current?.contains(M.relatedTarget)&&l(!1)},onMouseLeave:()=>{I(),x.current=setTimeout(()=>{p||l(!1)},200)},onClick:M=>{M.preventDefault(),M.stopPropagation(),!p&&A(M.currentTarget,M.clientX,M.clientY)},onKeyDown:M=>{if(M.key==="Enter"||M.key===" "){if(M.preventDefault(),p)return;A(M.currentTarget)}},children:e.eventName}),!p&&_]})]}),n&&c.jsxs("div",{className:"flex flex-col gap-0.5 text-[10px] text-spur-text-muted min-w-0",children:[c.jsx(fc,{severity:a.severity}),c.jsx("span",{className:"truncate text-spur-text",title:bt(a.summary),children:bt(a.summary)}),c.jsx("span",{className:"truncate",title:bt(a.producer),children:bt(a.producer)}),c.jsx("span",{className:"truncate",title:bt(a.correlation),children:bt(a.correlation)}),c.jsxs("span",{className:"truncate",children:["outcome: ",bt(a.outcome)]}),c.jsxs("span",{className:"truncate",title:bt(a.action?.value),children:["action: ",bt(a.action?.value)]})]})]})}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 text-spur-text align-middle truncate",title:bt(a.summary),children:bt(a.summary)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.producer),children:bt(a.producer)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.correlation),children:bt(a.correlation)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.outcome),children:bt(a.outcome)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.action?.value),children:bt(a.action?.value)})]}),s&&c.jsx("tr",{children:c.jsx("td",{colSpan:n?2:8,className:"px-3 py-2 border-b border-spur-border/40 bg-base-300/40",children:c.jsxs("section",{id:`detail-${e.id}`,"aria-label":`Detail for ${e.eventName}`,onKeyDown:F,tabIndex:-1,className:"flex flex-col gap-2 text-[11px] text-spur-text max-w-full",children:[c.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px]",children:[c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"project:"})," ",bt(a.projectName)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"root:"})," ",bt(a.projectRoot)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"producer:"})," ",bt(a.producer)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"correlation:"})," ",bt(a.correlation)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"actor:"})," ",w]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"prefix:"})," ",r]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"tier:"})," ",t]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"outcome:"})," ",bt(a.outcome)]})]}),a.fields.length>0&&c.jsx("dl",{className:"space-y-0.5",children:a.fields.map(M=>c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("dt",{className:"text-spur-text-muted shrink-0",children:[M.label,":"]}),c.jsx("dd",{className:"font-mono break-all",children:bt(M.value)})]},M.label+M.value))}),c.jsxs("div",{className:"border-t border-spur-border/40 pt-1",children:[c.jsx("div",{className:"text-spur-text-muted text-[10px] mb-0.5",children:"payload (redacted):"}),c.jsx("pre",{className:"font-mono text-[10px] text-spur-text-muted overflow-x-auto whitespace-pre-wrap break-all",children:e.envelope?JSON.stringify(e.envelope,null,2):"-"})]}),c.jsx("button",{type:"button",onClick:()=>o(!1),className:"self-start text-[10px] text-spur-text-muted hover:text-error px-2 py-0.5 rounded border border-spur-border/40 hover:border-error/40 transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:"Close (Esc)"})]})})}),p&&_&&typeof document<"u"?Ua.createPortal(_,document.body):null]})}function Oy({label:e,value:t,onChange:n,options:r}){return c.jsxs("fieldset",{"aria-label":e,className:"inline-flex rounded border border-spur-border/40 overflow-hidden text-[11px] border-0 p-0 m-0",children:[c.jsx("legend",{className:"sr-only",children:e}),r.map(a=>{const i=a.value===t;return c.jsxs("label",{className:`px-2 py-0.5 font-mono cursor-pointer focus-within:ring-2 focus-within:ring-spur-text/40 transition-colors ${i?"bg-spur-text/15 text-spur-text":"text-spur-text-muted hover:bg-base-200/60"}`,children:[c.jsx("input",{type:"radio",name:e,value:a.value,checked:i,onChange:()=>n(a.value),className:"sr-only"}),a.label]},a.value)})]})}const IA=et(),q$=`${IA}/jobs/stats`,Ly=`${IA}/events/history`,Fy=50;function Y$(e){if(e===null||typeof e!="object")return null;const t=e.stats;if(t===null||typeof t!="object")return null;const n=t;return typeof n.pending!="number"||typeof n.processing!="number"||typeof n.completed!="number"||typeof n.failed!="number"?null:{stats:{pending:n.pending,processing:n.processing,completed:n.completed,failed:n.failed}}}function kA(e){switch(e.split(".").pop()??""){case"enqueued":return"pending";case"retrying":return"retrying";case"completed":return"completed";case"failed":return"failed";case"executed":return"executed";default:return null}}function cu(e,t){const n={};if(!t)return n;const r=s=>{const o=t[s];return typeof o=="string"&&o.length>0?o:void 0},a=s=>{const o=t[s];return typeof o=="number"&&Number.isFinite(o)?o:void 0},i=e.split(".").pop()??"";return n.durationMs=a("durationMs"),i==="executed"?(n.name=r("name"),n.error=r("error")):(n.jobId=r("jobId"),n.type=r("type"),(i==="failed"||i==="retrying")&&(n.attempt=a("attempt")),i==="failed"&&(n.error=r("error"))),n}function RA(e){switch(e){case"completed":case"executed":return"success";case"retrying":return"warning";case"failed":return"error";default:return"neutral"}}function Z$(e,t){const n=[];let r=0,a=0;for(;r<e.length&&a<t.length;){const i=e[r],s=t[a];if(i&&s&&i.occurredAt>=s.occurredAt)n.push(i),r++;else if(s)n.push(s),a++;else if(i)n.push(i),r++;else break}for(;r<e.length;){const i=e[r];i&&n.push(i),r++}for(;a<t.length;){const i=t[a];i&&n.push(i),a++}return n}function K$(e){const t=[],n=new Map;for(const r of e){const i=r.eventName.startsWith("queue.job.")?cu(r.eventName,r.payload).jobId:void 0;if(i!==void 0){const s=n.get(i);if(s)s.events.push(r);else{const o={kind:"thread",jobId:i,events:[r]};n.set(i,o),t.push(o)}}else t.push({kind:"standalone",row:r})}return t}function X$(e){if(e.length<2)return null;const t=Date.parse(e[0]?.occurredAt??""),n=Date.parse(e.at(-1)?.occurredAt??"");return!Number.isFinite(t)||!Number.isFinite(n)?null:Math.max(0,t-n)}function Q$(){const[e,t]=g.useState(null),[n,r]=g.useState(null);if(g.useEffect(()=>{const i=new AbortController;return(async()=>{try{const[s,o,u]=await Promise.all([Ke(new Request(q$,{signal:i.signal})),Ke(new Request(`${Ly}?prefix=queue&limit=${Fy}`,{signal:i.signal})),Ke(new Request(`${Ly}?prefix=scheduler&limit=${Fy}`,{signal:i.signal}))]);if(!s.ok)throw new Error(`job stats fetch failed: ${s.status}`);if(!o.ok)throw new Error(`queue history fetch failed: ${o.status}`);if(!u.ok)throw new Error(`scheduler history fetch failed: ${u.status}`);const l=Y$(await s.json()),p=ei(await o.json()),d=ei(await u.json());if(!l)throw new Error("job stats response failed schema validation");if(!p)throw new Error("queue history response failed schema validation");if(!d)throw new Error("scheduler history response failed schema validation");const f=Z$(p.events,d.events);t({stats:l.stats,events:f})}catch(s){if(i.signal.aborted)return;r(s instanceof Error?s.message:String(s))}})(),()=>i.abort()},[]),n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load jobs: ",n]});if(e===null)return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading jobs…"]});const a=[["Pending",e.stats.pending,"text-spur-text"],["Processing",e.stats.processing,"text-info"],["Completed",e.stats.completed,"text-success"],["Failed",e.stats.failed,"text-error"]];return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-jobs-tab":!0,children:[c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 border-b border-spur-border bg-base-200 shrink-0",children:a.map(([i,s,o])=>c.jsx(mi,{variant:"compact",className:"bg-base-100 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsx("span",{className:"text-[10px] uppercase text-spur-text-muted font-semibold",children:i}),c.jsx("span",{className:`text-xl font-semibold tabular-nums ${o}`,children:s})]})},i))}),c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Recent Job Events"}),c.jsxs("span",{className:"ml-2 text-xs text-spur-text-muted",children:[e.events.length," event(s)"]})]}),e.events.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-jobs-empty":!0,children:"No job events yet - the queue has not processed any jobs."}):c.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:K$(e.events).map(i=>i.kind==="thread"?c.jsx(ez,{item:i},`thread-${i.jobId}`):c.jsx(J$,{row:i.row},i.row.id))})]})}function J$({row:e}){const t=g.useMemo(()=>cu(e.eventName,e.payload),[e.eventName,e.payload]),n=kA(e.eventName),r=e.eventName.startsWith("scheduler."),a=r?t.name??"scheduler":t.jobId??"job",i=r?"scheduler":t.type??"unknown",s=t.durationMs!==void 0?lu(t.durationMs):null;return c.jsx("li",{children:c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n!==null&&c.jsx(st,{variant:RA(n),size:"xs",children:n}),c.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:a}),c.jsx(st,{variant:"outline",size:"xs",children:i}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:e.occurredAt})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[t.attempt!==void 0&&c.jsxs("span",{children:["attempt ",c.jsx("span",{className:"font-mono text-spur-text",children:t.attempt})]}),c.jsxs("span",{children:["duration ",c.jsx("span",{className:"font-mono text-spur-text",children:s??"unavailable"})]}),t.error!==void 0&&c.jsx("span",{className:"text-error truncate max-w-md",title:t.error,children:t.error}),!r&&t.type===void 0&&c.jsx("span",{className:"italic",children:"unknown job type"})]}),e.payload!==null&&Object.keys(e.payload).length>0&&c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),c.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(e.payload,null,2)})]})]})})})}function ez({item:e}){const t=e.events[0],n=g.useMemo(()=>t?cu(t.eventName,t.payload):null,[t]);if(!t||!n)return null;const r=kA(t.eventName),a=X$(e.events),i=n.durationMs!==void 0?lu(n.durationMs):a!==null?lu(a):null;return c.jsx("li",{children:c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r!==null&&c.jsx(st,{variant:RA(r),size:"xs",children:r}),c.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:e.jobId}),n.type!==void 0&&c.jsx(st,{variant:"outline",size:"xs",children:n.type}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:t.occurredAt})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[n.attempt!==void 0&&c.jsxs("span",{children:["attempt ",c.jsx("span",{className:"font-mono text-spur-text",children:n.attempt})]}),c.jsxs("span",{children:["duration ",c.jsx("span",{className:"font-mono text-spur-text",children:i??"unavailable"})]}),n.error!==void 0&&c.jsx("span",{className:"text-error truncate max-w-md",title:n.error,children:n.error}),c.jsxs("span",{className:"italic",children:[e.events.length," event(s)"]})]}),e.events.length>1&&c.jsxs("details",{className:"mt-1",children:[c.jsxs("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:["event sequence (",e.events.length,")"]}),c.jsx("ol",{className:"mt-1 space-y-1",children:e.events.map(s=>{const o=cu(s.eventName,s.payload);return c.jsxs("li",{className:"text-[10px] text-spur-text-muted flex items-center gap-2",children:[c.jsx("span",{className:"font-mono",children:s.occurredAt}),c.jsx("span",{children:s.eventName}),o.attempt!==void 0&&c.jsxs("span",{children:["attempt ",o.attempt]})]},s.id)})})]}),t.payload!==null&&Object.keys(t.payload).length>0&&c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),c.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(t.payload,null,2)})]})]})})})}function My(e){if(e===null||typeof e!="object")return null;const t=e;return typeof t.inputTokens!="number"||typeof t.outputTokens!="number"||typeof t.cacheReadTokens!="number"||typeof t.cacheCreationTokens!="number"||typeof t.records!="number"||typeof t.recordsWithUsage!="number"?null:{inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens,cacheCreationTokens:t.cacheCreationTokens,records:t.records,recordsWithUsage:t.recordsWithUsage}}function tz(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.totalRuns!="number"||typeof t.matchedRuns!="number"||typeof t.unmeasured!="boolean"?null:{role:t.role,totalRuns:t.totalRuns,matchedRuns:t.matchedRuns,exact:My(t.exact),estimated:My(t.estimated),unmeasured:t.unmeasured}}function nz(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.executor!="string"||!(t.source===null||typeof t.source=="string")||typeof t.runs!="number"||typeof t.escalations!="number"?null:{role:t.role,executor:t.executor,source:t.source,runs:t.runs,escalations:t.escalations}}function rz(e){if(e===null||typeof e!="object")return null;const t=e,n=t.routing,r=t.tokens;if(n===null||typeof n!="object"||r===null||typeof r!="object")return null;const a=n,i=r,s=a.window;if(s===null||typeof s!="object")return null;const o=s;if(typeof o.since!="string"||typeof o.until!="string"||!Array.isArray(a.pairs)||!Array.isArray(i.roles))return null;const u=[];for(const p of a.pairs){const d=nz(p);d&&u.push(d)}const l=[];for(const p of i.roles){const d=tz(p);d&&l.push(d)}return{window:{since:o.since,until:o.until},pairs:u,roles:l}}function az(e){switch(e){case"explicit":return"pinned";case"role":return"resolved";case"default":return"default";case null:return"—";default:return e}}const iz=new Intl.NumberFormat("en-US");function ja(e){return iz.format(e)}function Py({label:e,totals:t}){return c.jsxs("div",{"data-token-bucket":e,className:"text-xs",children:[c.jsx(st,{size:"xs",variant:e==="estimated"?"warning":"success",children:e}),c.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1",children:[c.jsx("dt",{className:"text-spur-text-muted",children:"input"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.inputTokens)}),c.jsx("dt",{className:"text-spur-text-muted",children:"cache read"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.cacheReadTokens)}),c.jsx("dt",{className:"text-spur-text-muted",children:"cache write"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.cacheCreationTokens)}),c.jsx("dt",{className:"text-spur-text-muted",children:"output"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.outputTokens)})]})]})}function sz({role:e}){const t=e.role??"—";return c.jsxs("div",{className:"bg-base-100 border border-spur-border rounded-md p-3","data-role-attribution":t,children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:t}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums",children:["matched ",e.matchedRuns," of ",e.totalRuns," runs"]})]}),e.unmeasured?c.jsxs("div",{className:"mt-1 text-xs","data-unmeasured":!0,children:[c.jsx(st,{size:"xs",variant:"ghost",children:"unmeasured"}),c.jsx("span",{className:"ml-1 text-spur-text-muted",children:"no token data recorded for this role — not a measured zero"})]}):c.jsxs("div",{className:"mt-2 flex flex-wrap gap-4",children:[e.exact?c.jsx(Py,{label:"exact",totals:e.exact}):null,e.estimated?c.jsx(Py,{label:"estimated",totals:e.estimated}):null]})]})}function oz(){const[e,t]=g.useState(null),[n,r]=g.useState(null);if(g.useEffect(()=>{const i=new AbortController;return(async()=>{try{const s=await Ke(new Request(`${et()}/observability/routing-summary`,{signal:i.signal}));if(!s.ok)throw new Error(`routing summary fetch failed: ${s.status}`);const o=rz(await s.json());if(!o)throw new Error("routing summary response failed schema validation");t(o)}catch(s){if(i.signal.aborted)return;r(s instanceof Error?s.message:String(s))}})(),()=>i.abort()},[]),n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load routing summary: ",n]});if(e===null)return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading routing summary…"]});const a=e.pairs.length===0&&e.roles.length===0;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-routing-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-baseline justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Routing & token consumption"}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums","data-covered-window":!0,children:["covered ",e.window.since," → ",e.window.until]})]}),a?c.jsx("div",{className:"flex-1 flex items-center justify-center p-4","data-routing-empty":!0,children:c.jsx("div",{className:"text-sm text-spur-text-muted italic",children:"No routing attribution has been recorded in the covered window — nothing to show yet."})}):c.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-4",children:[e.pairs.length>0?c.jsxs("section",{className:"bg-base-100 border border-spur-border rounded-md","data-routing-table":!0,children:[c.jsxs("div",{className:"px-3 py-2 border-b border-spur-border",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Role → executor"}),c.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"runs and escalations per pair; pinned and role-resolved counted separately"})]}),c.jsxs("table",{className:"table table-sm w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-[10px] uppercase text-spur-text-muted",children:[c.jsx("th",{children:"Role"}),c.jsx("th",{children:"Executor"}),c.jsx("th",{children:"Source"}),c.jsx("th",{className:"text-right",children:"Runs"}),c.jsx("th",{className:"text-right",children:"Escalations"})]})}),c.jsx("tbody",{children:e.pairs.map(i=>c.jsxs("tr",{children:[c.jsx("td",{className:"text-sm text-spur-text",children:i.role??"—"}),c.jsx("td",{className:"text-sm text-spur-text",children:i.executor}),c.jsx("td",{children:c.jsx(st,{size:"xs",variant:i.source==="explicit"?"warning":"ghost",children:az(i.source)})}),c.jsx("td",{className:"text-right tabular-nums text-spur-text",children:ja(i.runs)}),c.jsx("td",{className:"text-right tabular-nums text-spur-text",children:ja(i.escalations)})]},`${i.role??""}:${i.executor}:${i.source??""}`))})]}),c.jsx("div",{className:"px-3 py-1.5 border-t border-spur-border text-[10px] text-spur-text-muted",children:"“—” role groups pure pins (no role recorded); escalations count runs that started too cheap on this executor."})]}):null,e.roles.length>0?c.jsxs("section",{"data-token-section":!0,children:[c.jsxs("div",{className:"px-1 pb-1.5",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Token consumption by role"}),c.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"input, cache read, cache write, output — token totals only"})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:e.roles.map(i=>c.jsx(sz,{role:i},i.role??"pin"))})]}):null]})]})}function Rn(e){return typeof e=="string"}function Nr(e){return e===null||typeof e=="string"}function uz(e){return e===null||typeof e=="number"&&Number.isFinite(e)}function lz(e){return e===null||typeof e=="boolean"}function Jg(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.id)||!Nr(t.workflowName)||!Rn(t.status)||!Nr(t.mode)||!Nr(t.agent)||!Rn(t.startedAt)||!Nr(t.completedAt)?null:{id:t.id,workflowName:t.workflowName,status:t.status,mode:t.mode,agent:t.agent,startedAt:t.startedAt,completedAt:t.completedAt}}function cz(e){if(e===null||typeof e!="object")return null;const t=e;if(!Array.isArray(t.runs)||typeof t.count!="number")return null;const n=[];for(const r of t.runs){const a=Jg(r);a&&n.push(a)}return{runs:n,count:t.count,nextCursor:Rn(t.nextCursor)?t.nextCursor:null,hasMore:typeof t.hasMore=="boolean"?t.hasMore:!1}}function dz(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.phase)||!Rn(t.status)||!Nr(t.startedAt)||!Nr(t.completedAt)?null:{phase:t.phase,status:t.status,startedAt:t.startedAt,completedAt:t.completedAt}}function pz(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.from)||!Rn(t.to)||!Nr(t.trigger)?null:{from:t.from,to:t.to,trigger:t.trigger}}function fz(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.id)||!Rn(t.node)||!Rn(t.kind)||!Rn(t.status)||!uz(t.durationMs)||!lz(t.ok)||!Nr(t.startedAt)||!Nr(t.completedAt)?null:{id:t.id,node:t.node,kind:t.kind,status:t.status,durationMs:t.durationMs,ok:t.ok,resultSummary:t.resultSummary,startedAt:t.startedAt,completedAt:t.completedAt}}function mz(e){if(e===null||typeof e!="object")return null;const t=e,n=Jg(t.run);if(!n||!Array.isArray(t.phases)||!Array.isArray(t.transitions)||!Array.isArray(t.actions))return null;const r=[];for(const s of t.phases){const o=dz(s);o&&r.push(o)}const a=[];for(const s of t.transitions){const o=pz(s);o&&a.push(o)}const i=[];for(const s of t.actions){const o=fz(s);o&&i.push(o)}return{run:n,phases:r,transitions:a,actions:i}}function hz(e){const t=Array.isArray(e)?e:e!==null&&typeof e=="object"&&Array.isArray(e.links)?e.links:null;if(!t)return null;const n=[];for(const r of t){if(r===null||typeof r!="object")continue;const a=r;!Rn(a.runId)||!Rn(a.kind)||!Rn(a.linkedAt)||n.push({runId:a.runId,kind:a.kind,linkedAt:a.linkedAt,run:Jg(a.run)})}return n}const gz=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rs(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=gz[t.getMonth()],r=t.getDate(),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${n} ${r} ${a}:${i}:${s}`}function bz(e){const t=e.toLowerCase();return t==="completed"||t==="done"||t==="succeeded"?"success":t==="failed"||t==="error"||t==="cancelled"?"error":t==="running"||t==="active"||t==="processing"?"info":t==="paused"||t==="pending"||t==="waiting"?"warning":"neutral"}function By(e){const t=e.toLowerCase();return t==="completed"||t==="failed"||t==="skipped"||t==="cancelled"}function Ez(e){const t=e.toLowerCase();return t==="failed"||t==="error"||t==="cancelled"}function yz(e){if(e==null)return null;if(typeof e=="string")return e.length>0?e:null;if(typeof e=="object"){const t=e,n=t.error??t.message??t.reason??t.summary;if(typeof n=="string"&&n.length>0)return n}return null}const xz=50;function Tz(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,i]=g.useState(null),[s,o]=g.useState(new Map);g.useEffect(()=>{const l=new AbortController;return(async()=>{try{const p=`${et()}/runs?limit=${xz}`,d=`${et()}/events/history?prefix=task&limit=50`,f=`${et()}/events/history?prefix=feature&limit=50`,[m,b,E]=await Promise.all([Ke(new Request(p,{signal:l.signal})),Ke(new Request(d,{signal:l.signal})),Ke(new Request(f,{signal:l.signal}))]);if(!m.ok)throw new Error(`runs fetch failed: ${m.status}`);const y=cz(await m.json());if(!y)throw new Error("runs response failed schema validation");const x=[];if(b.ok){const T=ei(await b.json());T&&x.push(...T.events)}if(E.ok){const T=ei(await E.json());T&&x.push(...T.events)}const w=new Map;try{const T=`${et()}/runs/by-wbs/`,I=await Ke(new Request(`${et()}/tasks?limit=200`,{signal:l.signal}));if(I.ok){const R=await I.json();if(R!==null&&typeof R=="object"){const v=R,A=v.items??v.tasks??v.data;if(Array.isArray(A))for(const N of A){if(N===null||typeof N!="object")continue;const F=N.wbs;if(typeof F=="string")try{const _=await Ke(new Request(`${T}${F}`,{signal:l.signal}));if(!_.ok)continue;const M=hz(await _.json());if(!M)continue;for(const j of M)w.set(j.runId,F)}catch{}}}}}catch{}t({runs:y.runs,hasMore:y.hasMore,nextCursor:y.nextCursor,wbsIndex:w,corpusEvents:x})}catch(p){if(l.signal.aborted)return;r(p instanceof Error?p.message:String(p))}})(),()=>l.abort()},[]);const u=g.useCallback(l=>{if(a===l){i(null);return}i(l),!s.get(l)&&(o(d=>{const f=new Map(d);return f.set(l,{detail:null,error:null,loading:!0}),f}),(async()=>{try{const d=await Ke(new Request(`${et()}/runs/${l}`));if(!d.ok){const b=(await d.json().catch(()=>null))?.error??`run detail fetch failed: ${d.status}`;o(E=>{const y=new Map(E);return y.set(l,{detail:null,error:typeof b=="string"?b:String(b),loading:!1}),y});return}const f=mz(await d.json());if(!f){o(m=>{const b=new Map(m);return b.set(l,{detail:null,error:"run detail failed schema validation",loading:!1}),b});return}o(m=>{const b=new Map(m);return b.set(l,{detail:f,error:null,loading:!1}),b})}catch(d){o(f=>{const m=new Map(f);return m.set(l,{detail:null,error:d instanceof Error?d.message:String(d),loading:!1}),m})}})())},[a,s]);return n?c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load runs: ",n]}):e===null?c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading runs…"]}):c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-tasks-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Pipeline Runs"}),c.jsxs("span",{className:"ml-2 text-xs text-spur-text-muted",children:[e.runs.length," run(s)"]})]}),e.runs.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-tasks-empty":!0,children:"No pipeline runs yet."}):c.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:e.runs.map(l=>{const p=e.wbsIndex.get(l.id),d=a===l.id?s.get(l.id):void 0;return c.jsx(Sz,{run:l,wbs:p,expanded:a===l.id,detailState:d,onToggle:u},l.id)})}),e.corpusEvents.length>0&&c.jsxs("div",{className:"border-t-2 border-dashed border-spur-border bg-base-300/50 shrink-0 max-h-64 overflow-y-auto","data-corpus-lane":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border sticky top-0 bg-base-300/90 backdrop-blur",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Corpus Activity"}),c.jsx(st,{variant:"outline",size:"xs",className:"ml-2",children:"corpus-only"}),c.jsxs("span",{className:"ml-2 text-xs text-spur-text-muted",children:[e.corpusEvents.length," event(s)"]})]}),c.jsx("ul",{className:"p-2 space-y-1",children:e.corpusEvents.map(l=>c.jsx(vz,{evt:l},l.id))})]})]})}function Sz({run:e,wbs:t,expanded:n,detailState:r,onToggle:a}){return c.jsx("li",{children:c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-2 gap-1",children:[c.jsxs("button",{type:"button",onClick:()=>a(e.id),className:"w-full text-left flex items-center gap-2 flex-wrap cursor-pointer","aria-expanded":n,children:[c.jsx("span",{className:"text-[10px] text-spur-text-muted",children:n?"▼":"▶"}),t!==void 0?c.jsx(st,{variant:"info",size:"xs",children:t}):c.jsx(st,{variant:"neutral",size:"xs",children:"unlinked"}),c.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:e.workflowName??"unknown"}),c.jsx(st,{variant:bz(e.status),size:"xs",children:e.status}),e.mode&&c.jsx(st,{variant:"outline",size:"xs",children:e.mode}),e.agent&&c.jsx("span",{className:"text-[10px] text-spur-text-muted",children:e.agent}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:rs(e.startedAt)})]}),n&&r&&c.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-spur-border",children:[r.loading&&c.jsxs("div",{className:"flex items-center gap-2 text-xs text-spur-text-muted py-2",children:[c.jsx(Tr,{size:"xs"})," Loading run detail…"]}),r.error&&c.jsxs("div",{className:"text-xs text-error py-2",role:"alert",children:["Failed to load run detail: ",r.error]}),r.detail&&c.jsx(Az,{detail:r.detail})]})]})})})}function Az({detail:e}){const t=g.useMemo(()=>{for(let n=e.phases.length-1;n>=0;n--){const r=e.phases[n];if(r&&!By(r.status))return n}return-1},[e.phases]);return c.jsxs("div",{className:"space-y-3",children:[e.phases.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase text-spur-text-muted font-semibold mb-1",children:"Phases"}),c.jsx("ol",{className:"space-y-1",children:e.phases.map((n,r)=>{const a=r===t,i=Ez(n.status),s=By(n.status);return c.jsxs("li",{className:`text-[11px] flex items-center gap-2 ${i?"text-error":a?"text-info font-semibold":s?"text-spur-text-muted":"text-spur-text"}`,children:[c.jsx("span",{className:"font-mono",children:s?i?"✗":"✓":a?"●":"○"}),c.jsx("span",{children:n.phase}),c.jsx(st,{variant:i?"error":a?"info":s?"neutral":"warning",size:"xs",children:n.status}),n.startedAt&&c.jsx("span",{className:"text-[10px] text-spur-text-muted font-mono",children:rs(n.startedAt)}),n.completedAt&&n.startedAt&&c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:["→ ",rs(n.completedAt)]})]},`phase:${n.phase}`)})})]}),e.transitions.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase text-spur-text-muted font-semibold mb-1",children:"Transitions"}),c.jsx("div",{className:"flex items-center gap-1 flex-wrap text-[11px]",children:e.transitions.map((n,r)=>c.jsxs("span",{className:"flex items-center gap-1",children:[r>0&&c.jsx("span",{className:"text-spur-text-muted",children:"→"}),c.jsxs(st,{variant:"outline",size:"xs",children:[n.from," → ",n.to]})]},`tr:${n.from}->${n.to}`))})]}),e.actions.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase text-spur-text-muted font-semibold mb-1",children:"Action Log"}),c.jsx("ul",{className:"space-y-1","data-action-log":!0,children:e.actions.map(n=>{const r=lu(n.durationMs),a=n.ok===!1?yz(n.resultSummary):null;return c.jsxs("li",{className:"text-[11px] flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"font-mono text-spur-text",children:n.node}),c.jsx(st,{variant:"outline",size:"xs",children:n.kind}),c.jsx(st,{variant:n.ok===!1?"error":n.ok===!0?"success":"neutral",size:"xs",children:n.status}),r!==null&&c.jsx("span",{className:"text-spur-text-muted font-mono",children:r}),a!==null&&c.jsx("span",{className:"text-error truncate max-w-md",title:a,children:a}),n.startedAt&&c.jsx("span",{className:"text-[10px] text-spur-text-muted font-mono ml-auto",children:rs(n.startedAt)})]},n.id)})})]}),e.phases.length===0&&e.actions.length===0&&e.transitions.length===0&&c.jsx("div",{className:"text-xs text-spur-text-muted italic",children:"No phase or action detail available."})]})}function vz({evt:e}){const t=g.useMemo(()=>{if(!e.payload)return null;const n=e.payload.entity;if(n!==null&&typeof n=="object"){const a=n.id;if(typeof a=="string")return a}const r=e.payload.id??e.payload.wbs;return typeof r=="string"?r:null},[e.payload]);return c.jsxs("li",{className:"text-[11px] flex items-center gap-2 flex-wrap text-spur-text-muted",children:[c.jsx("span",{className:"font-mono text-[10px]",children:rs(e.occurredAt)}),c.jsx(st,{variant:"outline",size:"xs",children:e.eventName}),t!==null&&c.jsx("span",{className:"font-mono",children:t}),e.actor&&c.jsx("span",{className:"text-[10px]",children:e.actor})]})}const mc=new Set(["read","write","bash","grep","glob"]),wz=3e3,DA=200,Uy=(e=DA,t)=>{const n=`${et()}/observability/tool-use?limit=${e}`;return t?`${n}&before=${encodeURIComponent(t)}`:n},_z=()=>`${et()}/observability/tool-use/stream`;function Nz(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,i]=g.useState(null),[s,o]=g.useState(!0),[u,l]=g.useState("off"),[p,d]=g.useState(!1),f=g.useRef(0),m=g.useCallback((T,I)=>{const R=(T.events??[]).map((v,A)=>({...v,seq:typeof v.seq=="number"?v.seq:A,_key:`${I==="append"?T.nextBefore??"p":"head"}:${v.ts}:${v.session}:${v.type}:${v.file??""}:${v.summary??""}:${v.seq??A}`}));t(v=>{if(I==="replace"||!v)return R;const A=new Set(v.map(yo)),N=R.filter(F=>!A.has(yo(F)));return[...v,...N]}),r({path:T.path??"",truncated:T.truncated??!1,sparseToolActivity:T.sparseToolActivity??(R.length===0||!R.some(v=>mc.has(v.type))),nextBefore:T.nextBefore??null})},[]),b=g.useCallback(async T=>{try{const I=await Ke(new Request(Uy(),{signal:T}));if(!I.ok){let v=`tool-use fetch failed: ${I.status}`;try{const N=(await I.json()).error;N&&(v=N)}catch{}throw new Error(v)}const R=await I.json();m(R,"replace"),i(null)}catch(I){if(T.aborted)return;i(I instanceof Error?I.message:String(I))}},[m]);g.useEffect(()=>{const T=new AbortController;return b(T.signal),()=>T.abort()},[b]),g.useEffect(()=>{if(!s){l("off");return}if(typeof EventSource>"u"){l("polling");const I=new AbortController,R=setInterval(()=>{b(I.signal)},wz);return()=>{I.abort(),clearInterval(R)}}l("connecting");const T=new EventSource(_z());return T.onopen=()=>l("live"),T.onerror=()=>l("errored"),T.onmessage=I=>{try{const v=JSON.parse(I.data);if(v.type==="connected"){l("live");return}if(v.type!=="tool-use"||!v.event)return;const A=v.event;f.current-=1;const N={...A,seq:f.current,_key:`live:${f.current}:${A.ts}:${A.session}:${A.type}:${A.file??""}:${A.summary??""}`};t(F=>{const _=F??[];return _[0]&&yo(_[0])===yo(N)?_:[N,..._]}),r(F=>F&&{...F,sparseToolActivity:mc.has(N.type)?!1:F.sparseToolActivity})}catch{}},()=>{T.close(),l("off")}},[s,b]);const E=g.useCallback(async()=>{if(!(!n?.nextBefore||p)){d(!0);try{const T=await Ke(new Request(Uy(DA,n.nextBefore)));if(!T.ok)throw new Error(`load more failed: ${T.status}`);const I=await T.json();m(I,"append"),r(R=>R&&{...R,nextBefore:I.nextBefore??null,truncated:I.truncated??!1})}catch(T){i(T instanceof Error?T.message:String(T))}finally{d(!1)}}},[n?.nextBefore,p,m]);if(a&&!e)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load tool use: ",a]});if(e===null)return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading tool use…"]});const y=e.some(T=>T.agent),x=e.some(T=>T.model),w=n?.sparseToolActivity??(e.length===0||!e.some(T=>mc.has(T.type)));return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-tool-using-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Tool Using"}),c.jsxs("span",{className:"text-xs text-spur-text-muted","data-event-count":!0,children:[e.length," event(s)",n?.nextBefore?" · more available":""]}),c.jsxs("label",{htmlFor:"live-toggle",className:"flex items-center gap-1.5 text-xs text-spur-text ml-2 cursor-pointer",children:[c.jsx(Lg,{id:"live-toggle",size:"xs",checked:s,onChange:T=>o(T.target.checked),"data-live-toggle":!0,"aria-label":"Live refresh"}),"Live"]}),c.jsx("span",{className:"text-[10px] text-spur-text-muted font-mono","data-sse-status":!0,children:kz(u)}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono truncate max-w-[40%]",title:n?.path??"","data-ledger-path":!0,children:n?.path?OA(n.path):""})]}),a?c.jsxs("div",{className:"px-4 py-1 text-xs text-warning",role:"status",children:["Refresh warning: ",a]}):null,e.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-empty-state":!0,children:"No tool-use events yet. File tools are logged when agent hooks write token-ledger.jsonl (requires SessionStart + supported agent PostToolUse for Read/Write/Edit)."}):c.jsxs(c.Fragment,{children:[w?c.jsxs("div",{className:"px-4 py-2 text-xs text-spur-text-muted bg-base-200/60 border-b border-spur-border",role:"status","data-sparse-banner":!0,children:["Limited recent tool activity in this window (session markers only, or no read/write rows). Hooks record tools only for supported agents after SessionStart. Ledger: ",n?.path||"—"]}):null,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsxs("table",{className:"table table-xs table-pin-rows w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-[10px] uppercase text-spur-text-muted",children:[c.jsx("th",{children:"Time"}),c.jsx("th",{children:"Type"}),c.jsx("th",{title:"File path or Bash/Grep/Glob summary",children:"Target"}),c.jsx("th",{children:"Action"}),c.jsx("th",{className:"text-right",children:"Tokens"}),c.jsx("th",{children:"Session"}),y?c.jsx("th",{children:"Agent"}):null,x?c.jsx("th",{children:"Model"}):null]})}),c.jsx("tbody",{children:e.map(T=>c.jsxs("tr",{className:"border-spur-border","data-event-seq":T.seq,children:[c.jsx("td",{className:"font-mono text-[10px] text-spur-text-muted whitespace-nowrap",children:Dz(T.ts)}),c.jsx("td",{children:c.jsx(Rz,{type:T.type})}),c.jsx("td",{className:"font-mono text-[10px] text-spur-text max-w-[16rem] truncate",title:Iz(T),children:Cz(T)}),c.jsx("td",{className:"text-xs text-spur-text-muted",children:T.action??"—"}),c.jsx("td",{className:"font-mono text-xs whitespace-nowrap text-right",children:Oz(T)}),c.jsx("td",{className:"font-mono text-[10px] text-spur-text-muted max-w-[8rem] truncate",title:T.sessionId??T.session,children:T.session}),y?c.jsx("td",{className:"text-[10px] text-spur-text-muted max-w-[6rem] truncate",children:T.agent??"—"}):null,x?c.jsx("td",{className:"text-[10px] text-spur-text-muted max-w-[8rem] truncate",children:T.model??"—"}):null]},T._key??`${T.seq}-${T.ts}`))})]})}),n?.nextBefore?c.jsx("div",{className:"px-4 py-2 border-t border-spur-border shrink-0 flex justify-center",children:c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>{E()},disabled:p,"data-load-more":!0,children:p?"Loading…":"Load older events"})}):null]})]})}function yo(e){return[e.ts,e.session,e.type,e.file??"",e.summary??"",e.action??"",String(e.tokens??"")].join("|")}function Cz(e){return e.summary?e.summary:e.file?OA(e.file):"—"}function Iz(e){return e.summary&&e.file?`${e.summary}
174
+ `)})}catch(ie){const X=ie instanceof Error?ie.message:"Body seeding failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:`Task created but body seeding failed: ${X}`}}))}_(),n()}catch(H){const Z=H instanceof Error?H.message:"Create failed";I(Z),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Z}}))}finally{w(!1)}}};return e?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-40",onClick:_,"aria-hidden":"true"}),c.jsxs("div",{className:"fixed inset-y-0 right-0 max-w-[90vw] bg-spur-surface border-l border-spur-border z-50 flex shadow-2xl",style:{width:A,minWidth:uc},role:"dialog","aria-label":"New Task",children:[c.jsx(iu,{targetVar:"--new-task-panel-w",onResizeEnd:j=>{const H=typeof window<"u"?window.innerWidth*.9:j,Z=Math.max(uc,Math.min(j,H));N(Z);try{window.localStorage.setItem(wy,String(Z))}catch{}},direction:"horizontal",invert:!0}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-spur-border shrink-0",children:[c.jsx("h2",{className:"text-sm font-semibold text-spur-text",children:"New Task"}),c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:_,"aria-label":"Close",disabled:x,children:"✕"})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("label",{htmlFor:"new-task-name",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:["Name ",c.jsx("span",{className:"text-spur-error",children:"*"})]}),c.jsx(gs,{id:"new-task-name",type:"text",variant:"bordered",size:"sm",error:!!F,className:"w-full bg-spur-bg text-spur-text",placeholder:"Task name",value:i,onChange:j=>{s(j.target.value),R||v(!0)},onBlur:()=>v(!0),disabled:x}),F&&c.jsx("p",{className:"text-xs text-spur-error mt-1",children:F})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:"new-task-template",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:"Template"}),c.jsx(Zr,{id:"new-task-template",variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:E,onChange:j=>y(j.target.value),disabled:x,children:ll.map(j=>c.jsx("option",{value:j,children:j},j))})]}),c.jsx(Ny,{id:"new-task-background",label:"Background",placeholder:"Why this task exists…",value:o,mode:d,onChange:u,onModeChange:f,disabled:x}),c.jsx(Ny,{id:"new-task-requirements",label:"Requirements",placeholder:"What must be done…",value:l,mode:m,onChange:p,onModeChange:b,disabled:x}),T&&c.jsx("div",{className:"text-xs text-spur-error bg-spur-error/10 border border-spur-error/20 rounded p-2",children:T})]}),c.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-spur-border shrink-0",children:[c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:_,disabled:x,children:"Cancel"}),c.jsx(He,{variant:"primary",size:"sm",onClick:M,disabled:x,children:x?"Creating…":"Create Task"})]})]})]})]}):null}const V7=5e3,q7=()=>`${et()}/events/planning`,Y7=async(e={})=>_r.task.list(e);class gA{state={tasks:[],loading:!0,error:null,connected:!1};listeners=[];interval;eventSource;refCount=0;listFn;constructor(t=Y7){this.listFn=t}getState=()=>this.state;setListFn=t=>{t!==this.listFn&&(this.listFn=t,this.refresh())};subscribe=t=>(this.listeners.push(t),this.refCount++,this.refCount===1&&(this.refresh(),this.interval=setInterval(this.refresh,V7),this.connectSSE()),()=>{this.listeners=this.listeners.filter(n=>n!==t),this.refCount--,this.refCount===0&&(this.interval&&(clearInterval(this.interval),this.interval=void 0),this.disconnectSSE())});refresh=async()=>{try{const t=await this.listFn();this.state={tasks:t.data??[],loading:!1,error:null,connected:this.state.connected}}catch(t){this.state={...this.state,loading:!1,error:t}}this.emit()};setTasks=t=>{const n=typeof t=="function"?t(this.state.tasks):t;this.state={...this.state,tasks:n},this.emit()};handleSSEOpen=()=>{this.state={...this.state,connected:!0},this.emit()};handleSSEMessage=()=>{this.refresh()};handleSSEError=()=>{this.state={...this.state,connected:!1},this.emit()};async connectSSE(){if(this.eventSource||typeof EventSource>"u")return;const t=new EventSource(q7());this.eventSource=t,t.onopen=this.handleSSEOpen,t.onmessage=this.handleSSEMessage,t.onerror=this.handleSSEError}disconnectSSE(){this.eventSource&&(this.eventSource.close(),this.eventSource=void 0,this.state={...this.state,connected:!1})}emit(){for(const t of this.listeners)t()}}let lc=null;function Z7(){return lc||(lc=new gA),lc}function bA(e){const t=g.useRef(null);e&&!t.current&&(t.current=new gA(e));const n=t.current??Z7();return g.useEffect(()=>{e&&t.current&&t.current.setListFn(e)},[e]),{...g.useSyncExternalStore(n.subscribe,n.getState),setTasks:n.setTasks}}function K7({progress:e,isDismissed:t,onDismiss:n,onReopen:r}){const{status:a,runId:i,action:s,error:o}=e,u=g.useRef(null);if(g.useEffect(()=>{a==="failed"&&t&&i&&u.current!==i&&(u.current=i,typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:o||`Action ${s||"job"} failed`}})))},[a,t,i,s,o]),a==="idle"||!i)return null;const l=a==="queued"||a==="running";if(t)return l?c.jsx("div",{className:"fixed bottom-4 right-4 z-40",children:c.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-2 px-3 py-1.5 bg-spur-bg border border-spur-border hover:border-spur-primary text-spur-text text-xs rounded-full shadow-md font-medium transition-colors",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 animate-pulse"}),c.jsxs("span",{children:[s?`${s.charAt(0).toUpperCase()}${s.slice(1)}`:"Action"," (",a,")"]}),c.jsx("span",{className:"text-spur-text-muted",children:"⤢"})]})}):null;const p=a==="succeeded"?"success":a==="failed"?"error":a==="running"?"accent":"warning";return c.jsxs("div",{className:"fixed bottom-4 right-4 z-40 w-80 p-4 bg-spur-bg border border-spur-border rounded-lg shadow-xl backdrop-blur flex flex-col gap-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:s?`${s.charAt(0).toUpperCase()}${s.slice(1)}`:"Action"}),c.jsx(st,{variant:p,children:a})]}),c.jsx("button",{type:"button",onClick:n,className:"text-spur-text-muted hover:text-spur-text text-base font-bold leading-none p-1","aria-label":"Dismiss progress panel",children:"×"})]}),c.jsxs("div",{className:"text-xs text-spur-text-muted font-mono truncate",children:["ID: ",i]}),l&&c.jsxs("div",{className:"flex items-center gap-2 text-xs text-spur-text",children:[c.jsx(Tr,{className:"w-3.5 h-3.5"}),c.jsx("span",{children:a==="queued"?"Enqueued in job runner...":"Running agent slash command..."})]}),a==="succeeded"&&c.jsx("div",{className:"text-xs text-green-400 font-medium",children:"✓ Action completed successfully."}),a==="failed"&&c.jsxs("div",{className:"text-xs text-red-400 font-medium break-words",children:["✕ ",o||"Action job failed."]}),!l&&c.jsx("div",{className:"flex justify-end pt-1",children:c.jsx(He,{variant:"outline",size:"sm",onClick:n,children:"Close"})})]})}const X7={backlog:["brainstorm","plan","add-child","add-task","start","cancel"],active:["add-child","add-task","link-task","sync-status","verify","block","cancel"],verifying:["sync-status","complete","rework","cancel"],blocked:["add-child","add-task","unblock","cancel"],done:[],cancelled:[]},Br={brainstorm:"Brainstorm",plan:"Plan","add-child":"+ Child","add-task":"+ Task","link-task":"Link Task","sync-status":"Sync",start:"Start",verify:"Verify",complete:"Complete",rework:"Rework",block:"Block",unblock:"Unblock",cancel:"Cancel"},Q7={start:!0,verify:!0,complete:!0,rework:!0,block:!0,unblock:!0,cancel:!0},J7={start:"active",verify:"verifying",complete:"done",rework:"active",block:"blocked",unblock:"active",cancel:"cancelled"};function EA({open:e,parentId:t,onClose:n,onCreated:r}){const[a,i]=g.useState(""),[s,o]=g.useState(!1),[u,l]=g.useState(""),[p,d]=g.useState(!1),f=p&&a.trim()===""?"Name is required":"",m=()=>{i(""),d(!1),l(""),n()},b=async()=>{d(!0);const E=a.trim();if(E!==""){o(!0),l("");try{t?await cA({id:t,name:E}):await n7(E),m(),r()}catch(y){const x=y instanceof Error?y.message:"Create failed";l(x)}finally{o(!1)}}};return e?c.jsx("div",{className:"fixed inset-y-0 right-0 z-40 flex","data-new-feature-panel":!0,children:c.jsxs("div",{className:"w-96 border-l border-spur-border bg-spur-surface shadow-xl flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-spur-border shrink-0",children:[c.jsx("h3",{className:"text-sm font-semibold text-spur-text",children:t?"New Child Feature":"New Feature"}),c.jsx(He,{variant:"ghost",size:"xs",onClick:m,"aria-label":"Close panel",children:"✕"})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[t&&c.jsxs("div",{className:"text-xs text-spur-text-muted",children:["Parent: ",c.jsx("span",{className:"font-mono text-spur-accent",children:t})]}),c.jsxs("div",{children:[c.jsx("label",{htmlFor:"new-feature-name",className:"block text-xs font-medium text-spur-text mb-1",children:"Feature Name *"}),c.jsx(gs,{id:"new-feature-name",value:a,onChange:E=>{i(E.target.value),p||d(!0)},onKeyDown:E=>{E.key==="Enter"&&a.trim()&&b()},placeholder:"e.g. Authentication module",disabled:s}),f&&c.jsx("p",{className:"text-xs text-red-500 mt-1",children:f}),u&&c.jsx("p",{className:"text-xs text-red-500 mt-1",children:u})]}),c.jsx("div",{className:"text-xs text-spur-text-muted",children:t?`The feature ID will be auto-allocated (next free digit under ${t}).`:"The feature ID will be auto-allocated (next free letter A–Z)."})]}),c.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-spur-border shrink-0",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:m,disabled:s,children:"Cancel"}),c.jsx(He,{variant:"primary",size:"xs",onClick:b,disabled:s||a.trim()==="",loading:s,children:"Create Feature"})]})]})}):null}const yA={backlog:{status:"backlog",label:"Backlog",colorClass:"text-spur-text-muted",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:c.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"2.5",strokeDasharray:"2 2"})})},active:{status:"active",label:"Active",colorClass:"text-spur-accent",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":t,children:c.jsx("circle",{cx:"8",cy:"8",r:"4.5"})})},verifying:{status:"verifying",label:"Verifying",colorClass:"text-spur-warning",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:[c.jsx("path",{d:"M1.5 8s2.5-4 6.5-4 6.5 4 6.5 4-2.5 4-6.5 4-6.5-4-6.5-4z"}),c.jsx("circle",{cx:"8",cy:"8",r:"2"})]})},blocked:{status:"blocked",label:"Blocked",colorClass:"text-spur-error",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[c.jsx("path",{d:"M8 2.5l5.5 10.5H2.5L8 2.5z"}),c.jsx("path",{d:"M8 6v3"}),c.jsx("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor"})]})},done:{status:"done",label:"Done",colorClass:"text-spur-success",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:c.jsx("path",{d:"M3.5 8.5l3.5 3.5 5.5-7"})})},cancelled:{status:"cancelled",label:"Cancelled",colorClass:"text-spur-text-faint",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>c.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[c.jsx("path",{d:"M5.5 2.5h5l3 3v5l-3 3h-5l-3-3v-5l3-3z"}),c.jsx("path",{d:"M6.25 6.25l3.5 3.5M9.75 6.25l-3.5 3.5"})]})}};function xA(e){const t=yA[e.toLowerCase()];return t?t.label:`Unknown status: ${e}`}function Kg({status:e,className:t}){const n=e.toLowerCase(),r=yA[n];if(r){const a=r.Icon;return c.jsx(a,{className:`${r.colorClass} ${t??"w-3.5 h-3.5"}`,ariaLabel:r.label})}return c.jsx("svg",{className:`inline-block shrink-0 text-spur-text-muted ${t??"w-3.5 h-3.5"}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":xA(e),children:c.jsx("circle",{cx:"8",cy:"8",r:"4"})})}function TA(e){return e?e.startsWith("feature.")||e.startsWith("queue.job."):!1}function e$(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.jobId=="string"&&t.jobId.length>0)return t.jobId;if(typeof t.runId=="string"&&t.runId.length>0)return t.runId;if(t.job&&typeof t.job=="object"){const n=t.job;if(typeof n.id=="string"&&n.id.length>0)return n.id;if(typeof n.jobId=="string"&&n.jobId.length>0)return n.jobId}return null}function t$(e,t){return t?e$(e)===t:!1}const cc={status:"idle"};function n$(e,t,n){if(e.status==="idle"||!e.runId||!t$(n,e.runId))return e;switch(t){case"queue.job.enqueued":case"queue.job.created":return{...e,status:"queued"};case"queue.job.started":case"queue.job.running":return{...e,status:"running"};case"queue.job.completed":return{...e,status:"succeeded"};case"queue.job.failed":{const r=n&&typeof n=="object"&&typeof n.error=="string"?n.error:"Job failed";return{...e,status:"failed",error:r}}default:return e}}const r$=()=>`${et()}/events/planning`;function a$(e){const[t,n]=g.useState(cc);g.useEffect(()=>{e&&n(cc)},[e]);const r=g.useCallback((i,s)=>{n({status:"queued",runId:i,action:s})},[]),a=g.useCallback(()=>{n(cc)},[]);return g.useEffect(()=>{if(typeof EventSource>"u"||!t.runId)return;const i=new EventSource(r$());return i.onmessage=s=>{try{const o=JSON.parse(s.data),u=o.eventName;if(!TA(u)||!u)return;n(l=>n$(l,u,o.payload))}catch{}},()=>{i.close()}},[t.runId]),{progress:t,trackAction:r,clearProgress:a}}function i$({featureId:e,onClose:t,refreshKey:n=0,childFeatures:r=[],onSelectFeature:a}){const[i,s]=g.useState(null),[o,u]=g.useState(""),[l,p]=g.useState(""),[d,f]=g.useState("preview"),[m,b]=g.useState(!1),[E,y]=g.useState(!1),[x,w]=g.useState(null),[T,I]=g.useState({}),[R,v]=g.useState(!1),[A,N]=g.useState(null),[F,_]=g.useState(null),[M,j]=g.useState(!1),[H,Z]=g.useState(null),[V,ie]=g.useState(null),[X,re]=g.useState(""),[ue,k]=g.useState("claude"),[Y,le]=g.useState("push"),[D,ke]=g.useState(!1),[Le,ve]=g.useState(!1),{progress:Ue,trackAction:Ee}=a$(e),[he,ct]=g.useState(!1),$e=g.useRef(null),{tasks:ge}=bA(),Pe=(ge??[]).filter(U=>U.featureId===e),pt=g.useRef(0),de=g.useCallback(()=>++pt.current,[]),rt=g.useCallback(U=>U===pt.current,[]),Ot=g.useCallback(async()=>{const U=de(),Te=await ly(e);return rt(U)?Te:null},[e,de,rt]),ft=g.useCallback((U,Te)=>{if(s(U),$e.current=U.id,I(U.frontmatter),Te?.body!==!1){const Ne=s$(U.content);u(Ne),p(Ne)}},[]),kt=g.useCallback(async U=>{const Te=await Ot();return Te&&(ft(Te,U),b(!1)),Te},[Ot,ft]),wt=g.useCallback((U,Te)=>{const Ne=U instanceof Error?U.message:Te;_({kind:"error",message:Ne}),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Ne}}))},[]),zt=g.useMemo(()=>({featureId:e,generation:n}),[e,n]);g.useEffect(()=>{const{featureId:U}=zt;if(!U){s(null),$e.current=null,u(""),p(""),f("preview"),w(null),_(null);return}$e.current!==U&&b(!0),w(null);const Ne=de();(async()=>{try{const ze=await ly(U);if(!rt(Ne))return;ft(ze)}catch(ze){if(!rt(Ne))return;w(ze instanceof Error?ze.message:"Failed to load feature")}finally{rt(Ne)&&b(!1)}})()},[zt,de,rt,ft]);const nn=async()=>{ke(!1);try{await kt({body:!1})}catch{}},ut=async()=>{ve(!1);try{await kt()}catch{}};if(x)return c.jsx("div",{className:"flex items-center justify-center h-full p-4",children:c.jsx("p",{className:"text-sm text-red-500",children:x})});if(!i)return c.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Select a feature to view details"});const Ae=()=>{p(o),f("edit")},Ye=()=>{p(o),f("preview")},q=async()=>{y(!0);try{await e7({id:e,body:l}),u(l),f("preview"),await kt()}catch(U){p(o),f("preview");const Te=U instanceof Error?U.message:"Save failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Te}}))}finally{y(!1)}},te=U=>{if(!A){if(_(null),Q7[U]){we(U);return}if(U==="brainstorm"||U==="plan"){Z(U);return}if(U==="add-child"){ve(!0);return}if(U==="add-task"){ke(!0);return}if(U==="link-task"){ie(U),re("");return}if(U==="sync-status"){Z("sync-status");return}}},ye=async U=>{const Te=J7[U];if(Te){N(U),_(null);try{const Ne=await J9(e,Te);s(ze=>ze&&{...ze,status:Ne}),await kt({body:!1}),_({kind:"ok",message:`${Br[U]??U}: status is now ${Ne}.`})}catch(Ne){wt(Ne,"Transition failed")}finally{N(null)}}},we=async U=>{if(U==="cancel"){j(!0);return}await ye(U)},je=async()=>{j(!1),await ye("cancel")},Ze=async()=>{const U=V;if(!(!U||!X.trim())){ie(null),N(U),_(null);try{U==="add-child"?await cA({id:e,name:X.trim()}):U==="add-task"?await r7({id:e,title:X.trim()}):U==="link-task"&&await a7({id:e,wbs:X.trim()}),await kt({body:!1}),_({kind:"ok",message:`${Br[U]??U} completed.`})}catch(Te){wt(Te,"Action failed")}finally{N(null)}}},_t=async()=>{if(!H)return;const U=H;Z(null),N(U),_(null);try{if(U==="sync-status"){const Te=await i7({id:e,direction:Y});await kt({body:!1});const Ne=Te.data?.applied,ze=Te.data?.newStatus;_({kind:"ok",message:Ne?`Sync applied${ze?`: status is now ${ze}`:""}.`:"Sync finished — no status change was needed."})}else{const Te=await t7({id:e,action:U,channel:ue});Te?.data?.runId&&(Ee(Te.data.runId,U),ct(!1)),await kt({body:!1}),_({kind:"ok",message:`${Br[U]??U} dispatched on ${ue}.`})}}catch(Te){wt(Te,"Action failed")}finally{N(null)}},St=U=>{if(!U)return"";try{const Te=new Date(U);return Number.isNaN(Te.getTime())?"":Te.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}},Et=U=>{if(!U)return"";try{const Te=new Date(U);if(Number.isNaN(Te.getTime()))return"";const Ne=Date.now()-Te.getTime(),ze=Math.floor(Ne/864e5);return ze===0?"today":ze===1?"yesterday":ze<30?`${ze}d ago`:ze<365?`${Math.floor(ze/30)}mo ago`:`${Math.floor(ze/365)}y ago`}catch{return""}},Nt=Array.isArray(T.tags)?T.tags:[],J=St(T.created_at),be=Et(T.created_at),Fe=St(T.updated_at),Re=Et(T.updated_at),Tt=U=>{window.location.assign(`/board/tasks/${U}`)},Wt=X7[i.status]??[];return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3 p-3 border-b border-spur-border shrink-0",children:[c.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[c.jsxs("h3",{className:"text-sm font-semibold text-spur-text truncate",children:[i.id," — ",i.name]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1","data-testid":"header-chips",children:[c.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted","data-testid":"status-pill",children:i.status}),typeof i.frontmatter.priority=="string"&&c.jsx("span",{className:"px-2 py-0.5 rounded-full bg-spur-accent/15 text-xs text-spur-accent",children:i.frontmatter.priority}),Nt.map(U=>c.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted",children:U},U))]})]}),c.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1 shrink-0",children:[Wt.map(U=>{let Te="accent";return U==="cancel"?Te="error":(U==="add-child"||U==="add-task"||U==="link-task")&&(Te="outline"),c.jsx(He,{variant:Te,size:"xs",onClick:()=>te(U),disabled:A!==null,"aria-busy":A===U,"aria-label":Br[U],children:A===U?"…":Br[U]},U)}),t&&c.jsx(He,{variant:"ghost",size:"xs",className:"text-spur-text-muted",onClick:t,"aria-label":"Close detail",children:"✕"})]})]}),F&&c.jsx("div",{role:"status","data-testid":"action-feedback","data-kind":F.kind,className:`px-3 py-1.5 text-xs border-b border-spur-border shrink-0 ${F.kind==="error"?"bg-spur-error/10 text-spur-error":"bg-spur-success/10 text-spur-success"}`,children:F.message}),c.jsxs("div",{className:"border-b border-spur-border shrink-0",children:[c.jsxs("button",{type:"button",onClick:()=>v(U=>!U),className:"flex items-center justify-between w-full p-3 text-xs font-semibold text-spur-text-muted uppercase tracking-wide hover:text-spur-text transition-colors","aria-expanded":R,children:[c.jsx("span",{children:"Metadata"}),c.jsxs("svg",{className:`w-3 h-3 transition-transform ${R?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("title",{children:R?"Collapse metadata":"Expand metadata"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})]})]}),R&&c.jsxs("div",{className:"px-3 pb-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Status"}),c.jsx("span",{className:"text-sm text-spur-text","data-testid":"metadata-status",children:i.status})]}),(J||Fe)&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("span",{className:"text-xs text-spur-text-muted block",children:"Dates"}),J&&c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Created"}),c.jsx("span",{className:"text-spur-text",children:J}),c.jsxs("span",{className:"text-spur-text-muted",children:["(",be,")"]})]}),Fe&&c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Updated"}),c.jsx("span",{className:"text-spur-text",children:Fe}),c.jsxs("span",{className:"text-spur-text-muted",children:["(",Re,")"]})]})]}),Nt.length>0&&c.jsxs("div",{children:[c.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Tags"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:Nt.map(U=>c.jsx(st,{variant:"outline",size:"xs",className:"text-spur-text-muted",children:U},U))})]}),c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"File"}),c.jsx("span",{className:"text-spur-text font-mono truncate",children:i.filePath})]}),r.length>0&&c.jsxs("div",{children:[c.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Child features (",r.length,")"]}),c.jsx("div",{className:"space-y-1",children:r.map(U=>c.jsxs("button",{type:"button",onClick:()=>a?.(U.id),className:"flex items-center gap-2 w-full text-xs text-left hover:underline cursor-pointer","aria-label":`Open child feature ${U.id}: ${U.name}`,children:[c.jsx("span",{className:"shrink-0 text-[13px]",title:U.status,children:c.jsx(Kg,{status:U.status})}),c.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:U.id}),c.jsx("span",{className:"text-spur-text truncate flex-1 min-w-0",children:U.name})]},U.id))})]}),c.jsxs("div",{children:[c.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Linked Tasks (",Pe.length,")"]}),Pe.length===0?c.jsx("span",{className:"text-xs text-spur-text-muted italic",children:"No linked tasks"}):c.jsx("div",{className:"space-y-1",children:Pe.map(U=>c.jsxs("div",{className:"flex items-center gap-2 w-full text-xs",children:[c.jsx("span",{className:"shrink-0 text-[13px]",title:U.status,children:Yg(U.status)}),c.jsxs("button",{type:"button",onClick:()=>Tt(U.wbs),className:"flex items-center gap-2 flex-1 min-w-0 text-left hover:underline cursor-pointer","aria-label":`Go to task ${U.wbs}: ${U.name}`,children:[c.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:U.wbs}),c.jsx("span",{className:"text-spur-text truncate",children:U.name})]}),c.jsx("span",{className:"px-1.5 py-0.5 rounded-full border border-spur-border text-[10px] text-spur-text-muted shrink-0",children:U.status})]},U.wbs))})]})]})]}),c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-3","data-testid":"feature-body-section",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Body"}),c.jsx("div",{className:"flex gap-1",children:d==="preview"?c.jsx(He,{variant:"ghost",size:"xs",onClick:Ae,disabled:m,"aria-label":"Edit body",children:"Edit"}):c.jsxs(c.Fragment,{children:[c.jsx(He,{variant:"primary",size:"xs",onClick:q,disabled:E,"aria-label":"Save body",children:E?"Saving…":"Save"}),c.jsx(He,{variant:"ghost",size:"xs",onClick:Ye,disabled:E,"aria-label":"Cancel edit",children:"Cancel"})]})})]}),m?c.jsxs("div",{className:"flex items-center gap-2 text-sm text-spur-text-muted",children:[c.jsx(Tr,{size:"xs",className:"text-spur-accent"}),"Loading body…"]}):d==="edit"?c.jsx("div",{className:"flex-1 min-h-0","data-testid":"body-editor",children:c.jsx(Ko,{value:l,onChange:U=>p(U??""),height:"100%","data-color-mode":"light"})}):c.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"body-preview",children:c.jsx(W7,{source:o})})]}),M&&c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Confirm cancel feature",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:U=>{U.target===U.currentTarget&&j(!1)},onKeyDown:U=>{U.key==="Escape"&&j(!1)},children:c.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-xs w-full",children:[c.jsxs("p",{className:"text-sm text-spur-text mb-4",children:["Cancel feature ",c.jsx("strong",{children:e}),"? This marks it as cancelled and cannot be undone from the board."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>j(!1),children:"Keep"}),c.jsx(He,{variant:"error",size:"xs",onClick:je,children:"Cancel feature"})]})]})}),H&&c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`Configure ${H} action`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:U=>{U.target===U.currentTarget&&Z(null)},onKeyDown:U=>{U.key==="Escape"&&Z(null)},children:c.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[H==="sync-status"?c.jsxs(c.Fragment,{children:[c.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:"Sync Status — Direction"}),c.jsx("div",{className:"space-y-3",children:c.jsxs(Zr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:Y,onChange:U=>le(U.target.value),children:[c.jsx("option",{value:"push",children:"Push (feature → tasks)"}),c.jsx("option",{value:"pull",children:"Pull (tasks → feature)"})]})})]}):c.jsxs(c.Fragment,{children:[c.jsxs("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:[Br[H]," — Select Channel"]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(Zr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:ue,onChange:U=>k(U.target.value),children:["claude","codex","gemini","pi","opencode","antigravity","openclaw"].map(U=>c.jsx("option",{value:U,children:U},U))}),c.jsxs("label",{htmlFor:"skip-deps",className:"flex items-center gap-2 cursor-pointer",children:[c.jsx(Lg,{id:"skip-deps",size:"xs",checked:!1,onChange:()=>{}}),c.jsx("span",{className:"text-xs text-spur-text",children:"Skip dependencies"})]})]})]}),c.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>Z(null),children:"Cancel"}),c.jsx(He,{variant:"primary",size:"xs",onClick:_t,children:A===H?"Dispatching…":"Dispatch"})]})]})}),V&&c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`${Br[V]} input`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:U=>{U.target===U.currentTarget&&ie(null)},onKeyDown:U=>{U.key==="Escape"&&ie(null)},children:c.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[c.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:Br[V]}),V==="link-task"?c.jsxs(Zr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:X,onChange:U=>re(U.target.value),children:[c.jsx("option",{value:"",children:"— Select a task —"}),(ge??[]).filter(U=>U.featureId!==e).map(U=>c.jsxs("option",{value:U.wbs,children:[U.wbs," — ",U.name]},U.wbs))]}):c.jsx("input",{type:"text",className:"w-full px-3 py-2 rounded border border-spur-border bg-spur-bg text-sm text-spur-text focus:outline-none focus:border-spur-accent",placeholder:"Enter child feature name",value:X,onChange:U=>re(U.target.value),onKeyDown:U=>{U.key==="Enter"&&X.trim()&&Ze()}}),c.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>ie(null),children:"Cancel"}),c.jsx(He,{variant:"primary",size:"xs",onClick:Ze,disabled:!X.trim()||A===V,children:A===V?"…":"Create"})]})]})}),c.jsx(hA,{open:D,onClose:()=>ke(!1),onCreated:nn,folder:["docs","tasks2"].join("/"),featureId:e}),c.jsx(EA,{open:Le,parentId:e,onClose:()=>ve(!1),onCreated:ut}),c.jsx(K7,{progress:Ue,isDismissed:he,onDismiss:()=>ct(!0),onReopen:()=>ct(!1)})]})}function s$(e){const t=e.match(/^---\n[\s\S]*?\n---\n/);return t?e.slice(t[0].length):e}function SA(e,t){return e.id.localeCompare(t.id)}function o$({features:e,selectedId:t,onSelect:n}){const r=e.filter(i=>i.id.length===1).slice().sort(SA),a=AA(e);return c.jsx("ul",{className:"py-1","data-feature-tree":!0,children:r.map(i=>c.jsx(vA,{feature:i,childrenMap:a,selectedId:t,onSelect:n,depth:0},i.id))})}function AA(e){const t=new Map;for(const n of e){if(n.id.length<=1)continue;const r=n.id.slice(0,-1),a=t.get(r);a?a.push(n):t.set(r,[n])}for(const n of t.values())n.sort(SA);return t}function vA({feature:e,childrenMap:t,selectedId:n,onSelect:r,depth:a}){const i=t.get(e.id),s=e.id===n,o=`${a*16}px`;return c.jsxs("li",{children:[c.jsxs("button",{type:"button",onClick:()=>r(e.id),className:`w-full flex items-center gap-1.5 px-2 py-1 text-left text-sm transition-colors hover:bg-base-300 ${s?"bg-spur-accent/10 text-spur-accent font-semibold":"text-spur-text"}`,style:{paddingLeft:`calc(0.5rem + ${o})`},children:[c.jsx(cP,{position:"right",tip:xA(e.status),className:"flex! w-4 shrink-0 items-center justify-center","data-testid":"feature-tree-status",children:c.jsx(Kg,{status:e.status})}),c.jsx("span",{className:"text-xs font-mono text-spur-text-muted shrink-0",children:e.id}),c.jsx("span",{className:"flex-1 truncate",children:e.name})]}),i&&i.length>0&&c.jsx("ul",{children:i.map(u=>c.jsx(vA,{feature:u,childrenMap:t,selectedId:n,onSelect:r,depth:a+1},u.id))})]})}const u$=()=>`${et()}/events/planning`;function l$({className:e="w-3.5 h-3.5"}){return c.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("polygon",{points:"1.5 2.5 14.5 2.5 9.5 8.5 9.5 13.5 6.5 13.5 6.5 8.5 1.5 2.5"})})}function c$(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,i]=g.useState(!1),[s,o]=g.useState("all"),[u,l]=g.useState(!1),[p,d]=g.useState(null),[f,m]=g.useState(0),b=g.useRef(null),E=g.useMemo(()=>AA(e??[]),[e]),y=g.useCallback(async R=>{try{const v=await Q9(R);t(v),d(null)}catch(v){if(R?.aborted)return;d(v instanceof Error?v.message:String(v))}},[]);if(g.useEffect(()=>{const R=new AbortController;return y(R.signal),()=>R.abort()},[y]),g.useEffect(()=>{if(!u)return;const R=A=>{b.current&&!b.current.contains(A.target)&&l(!1)},v=A=>{A.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",R),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",v)}},[u]),g.useEffect(()=>{if(typeof EventSource>"u")return;const R=new EventSource(u$());return R.onmessage=v=>{try{const N=JSON.parse(v.data).eventName;if(!TA(N))return;y(),n&&(N==="feature.updated"||N==="feature.transitioned"||N==="queue.job.completed")&&m(F=>F+1)}catch{}},()=>R.close()},[y,n]),p)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load features: ",p]});if(e===null)return c.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Loading features…"});const x=()=>{i(!1),y()},T=(R=>{if(s==="all")return R;const v=s.toLowerCase(),A=new Set;for(const N of R)if(N.status.toLowerCase()===v){A.add(N.id);let F=N.id;for(;F.length>1;)F=F.slice(0,-1),A.add(F)}return R.filter(N=>A.has(N.id))})(e),I=n?E.get(n)??[]:[];return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex h-full overflow-hidden","data-features-shell":!0,children:[c.jsxs("div",{className:"w-72 shrink-0 border-r border-spur-border overflow-y-auto bg-base-200",children:[c.jsxs("div",{className:"px-3 py-2 border-b border-spur-border flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Features"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsxs("div",{className:"relative",ref:b,children:[c.jsxs(He,{variant:"ghost",size:"xs",className:`relative text-spur-text-muted hover:text-spur-accent flex items-center gap-1 ${s!=="all"?"text-spur-accent font-semibold":""}`,onClick:()=>l(R=>!R),"aria-label":"Filter features by status","aria-expanded":u,title:"Filter features by status",children:[c.jsx(l$,{className:"w-3.5 h-3.5"}),s!=="all"&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-spur-accent shrink-0","aria-hidden":"true"})]}),u&&c.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 w-44 rounded-md shadow-lg bg-base-100 border border-spur-border py-1 text-xs","data-filter-menu":!0,children:[c.jsxs("div",{className:"px-2.5 py-1 font-semibold text-spur-text-muted border-b border-spur-border flex items-center justify-between",children:[c.jsx("span",{children:"Filter by Status"}),s!=="all"&&c.jsx("button",{type:"button",onClick:()=>{o("all"),l(!1)},className:"text-[10px] text-spur-accent hover:underline",children:"Reset"})]}),c.jsxs("button",{type:"button",onClick:()=>{o("all"),l(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 ${s==="all"?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[c.jsx("span",{className:"flex-1",children:"All"}),s==="all"&&c.jsx("span",{children:"✓"})]}),bi.map(R=>c.jsxs("button",{type:"button",onClick:()=>{o(R),l(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 capitalize ${s===R?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[c.jsx(Kg,{status:R}),c.jsx("span",{className:"flex-1 capitalize",children:R}),s===R&&c.jsx("span",{children:"✓"})]},R))]})]}),c.jsx(He,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:()=>i(!0),"aria-label":"Add root feature",title:"Add root feature",children:"+"})]})]}),e.length===0?c.jsx("div",{className:"p-3 text-xs text-spur-text-muted italic",children:"No features found."}):T.length===0?c.jsxs("div",{className:"p-3 text-xs text-spur-text-muted italic",children:['No features match status filter "',s,'".']}):c.jsx(o$,{features:T,selectedId:n,onSelect:r})]}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:n?c.jsx(i$,{featureId:n,refreshKey:f,onClose:()=>r(null),childFeatures:I,onSelectFeature:r}):c.jsx("div",{className:"flex items-center justify-center h-full text-sm text-spur-text-muted italic",children:"Select a feature to view details"})})]}),c.jsx(EA,{open:a,parentId:"",onClose:()=>i(!1),onCreated:x})]})}const d$={id:"features",name:"Feature Board",icon:"🏷️",route:"features",component:c$,sidebarLabel:"Features"},p$=Object.freeze(Object.defineProperty({__proto__:null,module:d$},Symbol.toStringTag,{value:"Module"}));function f$(e){if(!e||typeof e!="object"||!("teams"in e))return null;const t=e.teams;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.teamId!="string"||typeof a.name!="string"||!Array.isArray(a.members))continue;const i=[];for(const s of a.members){if(!s||typeof s!="object")continue;const o=s;typeof o.id!="string"||typeof o.type!="string"||typeof o.status!="string"||i.push({id:o.id,type:o.type,status:o.status,...typeof o.model=="string"&&o.model.length>0?{model:o.model}:{},...typeof o.autoStart=="boolean"?{autoStart:o.autoStart}:{},...typeof o.pid=="number"?{pid:o.pid}:{},...typeof o.role=="string"&&o.role.length>0?{role:o.role}:{},...typeof o.executor=="string"&&o.executor.length>0?{executor:o.executor}:{}})}n.push({teamId:a.teamId,name:a.name,workDir:typeof a.workDir=="string"?a.workDir:null,isCurrentProject:a.isCurrentProject===!0,members:i})}return n}const m$=()=>`${et()}/team/teams`,h$=5e3;function Ei(){const[e,t]=g.useState([]),[n,r]=g.useState(null),a=g.useRef(!0),i=g.useCallback(async()=>{try{const s=await Ke(new Request(m$()));if(!s.ok)throw new Error(`teams fetch failed: ${s.status}`);const o=await s.json(),u=f$(o);u&&a.current&&(t(u),r(null))}catch(s){a.current&&r(s instanceof Error?s.message:String(s))}},[]);return g.useEffect(()=>{a.current=!0,i();const s=setInterval(i,h$);return()=>{a.current=!1,clearInterval(s)}},[i]),{teams:e,error:n,reload:i}}const g$=(e=50)=>`${et()}/messages?limit=${e}`,b$=()=>`${et()}/events/planning`,E$=new Set(["message.sent","message.replied"]);function Cy(e,t){if(e&&typeof e=="object"){const n=e;return{agentId:typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:t,...typeof n.teamId=="string"&&n.teamId?{teamId:n.teamId}:{},...typeof n.teamName=="string"&&n.teamName?{teamName:n.teamName}:{},...typeof n.memberLabel=="string"&&n.memberLabel?{memberLabel:n.memberLabel}:{},...typeof n.agentType=="string"&&n.agentType?{agentType:n.agentType}:{}}}return{agentId:t}}function y$(e){if(!e||typeof e!="object"||!("messages"in e))return null;const t=e.messages;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.id!="string"||typeof a.toId!="string"||typeof a.body!="string"||typeof a.status!="string"||typeof a.createdAt!="string")continue;const i=a.fromId===null||a.fromId===void 0?null:typeof a.fromId=="string"?a.fromId:null;n.push({id:a.id,fromId:i,toId:a.toId,body:a.body,status:a.status,createdAt:a.createdAt,inReplyTo:typeof a.inReplyTo=="string"?a.inReplyTo:null,hasReply:a.hasReply===!0,replyCount:typeof a.replyCount=="number"&&Number.isFinite(a.replyCount)?a.replyCount:0,...i!==null?{from:Cy(a.from,i)}:{},to:Cy(a.to,a.toId)})}return n}function wA(e,t){return e.filter(n=>n.to.teamId===t||n.from?.teamId===t)}function Xg(){const[e,t]=g.useState(null),[n,r]=g.useState(null),a=g.useCallback(async i=>{try{const s=await Ke(new Request(g$(),{signal:i}));if(!s.ok)throw new Error(`messages fetch failed: ${s.status}`);const o=y$(await s.json());o&&t(o)}catch(s){if(i?.aborted)return;r(s instanceof Error?s.message:String(s))}},[]);return g.useEffect(()=>{const i=new AbortController;a(i.signal);const s=setInterval(()=>{a(i.signal)},1e4);return()=>{i.abort(),clearInterval(s)}},[a]),g.useEffect(()=>{if(typeof EventSource>"u")return;const i=new AbortController,s=new EventSource(b$());return s.onmessage=o=>{try{const u=JSON.parse(o.data);if(u===null||typeof u!="object")return;const l=u.eventName;typeof l=="string"&&E$.has(l)&&a(i.signal)}catch{}},()=>{i.abort(),s.close()}},[a]),{messages:e,error:n}}function Qg({messages:e}){return e.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-message-feed-empty":!0,children:"No messages yet."}):c.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:e.map(t=>{const n=t.from?[t.from.memberLabel??t.from.agentId,t.from.agentType].filter(Boolean).join(" · "):t.fromId??"system",r=[t.to.memberLabel??t.to.agentId,t.to.agentType].filter(Boolean).join(" · "),a=t.from?.teamName,i=t.to.teamName,s=t.status==="injected"?"injected":t.status==="queued"?"queued":null;return c.jsxs("li",{className:"p-2 bg-spur-surface-2 border border-spur-border rounded-xl text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2 text-spur-text-muted text-xs",children:[c.jsxs("span",{"data-message-route":!0,className:"truncate",children:[a&&c.jsxs("span",{className:"text-xs opacity-70",children:[a," / "]}),c.jsx("span",{children:n}),c.jsx("span",{className:"mx-1",children:"→"}),i&&c.jsxs("span",{className:"text-xs opacity-70",children:[i," / "]}),c.jsx("span",{children:r})]}),s&&c.jsx("span",{className:`text-xs px-1 rounded ${s==="injected"?"bg-success/20 text-success":"bg-warning/20 text-warning"}`,"data-message-delivery":!0,children:s}),c.jsx("span",{className:`text-xs ${t.hasReply?"text-info":"text-spur-text-muted"}`,"data-message-reply-badge":!0,"data-message-reply-state":t.hasReply?"replied":"awaiting",children:t.hasReply?t.replyCount>1?`Replied (${t.replyCount})`:"Replied":"Awaiting reply"}),c.jsx("span",{className:"ml-auto font-mono text-xs text-spur-text-muted",children:t.createdAt})]}),c.jsx("p",{className:"text-spur-text mt-1 whitespace-pre-wrap break-words",children:t.body})]},t.id)})})}function x$({teamId:e}){const{messages:t,error:n}=Xg();if(n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=e?wA(t,e):t;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-all-tab":!0,children:[c.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:e?`Message · ${e}`:"Message · all teams"})}),c.jsx(Qg,{messages:r})]})}function T$(e,t){return e.filter(n=>n.fromId===t||n.toId===t)}function S$({agentId:e}){const{messages:t,error:n}=Xg();if(n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=T$(t,e);return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-agent-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Messages"}),c.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e})]}),c.jsx(Qg,{messages:r})]})}const Iy="supervisor";function A$(e){return e.fromId===Iy||e.toId===Iy}function v$({teamId:e}){const{messages:t,error:n}=Xg();if(n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=t.filter(A$),a=e?wA(r,e):r;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-supervisor-tab":!0,children:[c.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Message · supervisor"})}),c.jsx(Qg,{messages:a})]})}const w$=[{id:"all",label:"All"},{id:"supervisor",label:"Supervisor"}],su="agent-";function _$(e,t,n){if(e==="all")return c.jsx(x$,{teamId:n});if(e==="supervisor")return c.jsx(v$,{teamId:n});if(e.startsWith(su)){const r=e.slice(su.length);if(t.includes(r))return c.jsx(S$,{agentId:r})}return null}function _A({teamId:e}){const{teams:t}=Ei(),[n,r]=g.useState(""),[a,i]=g.useState("all");g.useEffect(()=>{e||!n&&t.length>0&&r(t[0]?.teamId??"")},[e,t,n]);const s=e??n,o=t.find(d=>d.teamId===s)??t[0]??null,u=o?o.members.map(d=>d.id):[],l=a==="all"||a==="supervisor"||u.includes(a.slice(su.length))?a:"all",p=g.useMemo(()=>{const d=u.map(f=>({id:`${su}${f}`,label:f}));return[...w$,...d]},[u]);return c.jsxs("div",{className:"inbox flex flex-col h-full overflow-hidden bg-spur-bg","data-inbox-shell":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Inbox"}),!e&&t.length>0&&c.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"inbox-team-select",children:[c.jsx("span",{className:"text-spur-text-muted",children:"Team"}),c.jsxs(Zr,{id:"inbox-team-select",variant:"bordered",size:"sm",value:o?.teamId??"",onChange:d=>{r(d.target.value),i("all")},"data-inbox-team-select":!0,children:[c.jsx("option",{value:"",children:"Select team…"}),t.map(d=>c.jsx("option",{value:d.teamId,children:d.name},d.teamId))]})]})]}),c.jsx("div",{role:"tablist","aria-label":"Inbox tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:p.map(d=>{const f=d.id===l;return c.jsx("button",{type:"button",role:"tab","aria-selected":f,"aria-controls":`inbox-tab-panel-${d.id}`,id:`inbox-tab-${d.id}`,onClick:()=>i(d.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${f?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-inbox-tab":!0,children:d.label},d.id)})}),c.jsx("div",{role:"tabpanel",id:`inbox-tab-panel-${l}`,"aria-labelledby":`inbox-tab-${l}`,className:"flex-1 overflow-hidden",children:_$(l,u,e)})]})}const N$={id:"inbox",name:"Inbox",icon:"💬",route:"inbox",component:_A,sidebarLabel:"Inbox",order:1},C$=Object.freeze(Object.defineProperty({__proto__:null,module:N$},Symbol.toStringTag,{value:"Module"}));var Ua=mv();const I$=()=>`${et()}/events/planning`,sd=100;function ky(e){const t=`${et()}/events/history`,n=[],r=e.limit??sd;return n.push(`limit=${r}`),e.prefix&&n.push(`prefix=${encodeURIComponent(e.prefix)}`),e.names&&n.push(`names=${encodeURIComponent(e.names)}`),e.actor&&n.push(`actor=${encodeURIComponent(e.actor)}`),e.runId&&n.push(`runId=${encodeURIComponent(e.runId)}`),e.since&&n.push(`since=${encodeURIComponent(e.since)}`),e.cursor&&n.push(`cursor=${encodeURIComponent(e.cursor)}`),`${t}?${n.join("&")}`}const k$={workflow:"text-cyan-400",task:"text-emerald-400",feature:"text-emerald-400",agent:"text-amber-400",rule:"text-rose-400",message:"text-sky-400",process:"text-violet-400",queue:"text-orange-400",bus:"text-pink-400",api:"text-teal-400"},Ry="text-spur-text-muted";function NA(e){return e?k$[e]??Ry:Ry}const dc={selectedPrefixes:new Set,searchQuery:"",searchScope:"all",tierFilter:"all",timeWindow:"all",runId:""};function R$(){const e=g.useRef([]),[t,n]=g.useState(0);g.useEffect(()=>{const a=window.setInterval(()=>{const i=Date.now()-6e4,s=e.current.filter(o=>o>=i);e.current=s,n(s.length)},1e3);return()=>window.clearInterval(a)},[]);const r=g.useCallback(()=>{const a=Date.now(),i=a-6e4,s=e.current.filter(o=>o>=i);s.push(a),e.current=s,n(s.length)},[]);return{rate:t,recordEvent:r}}function ei(e){if(e===null||typeof e!="object"||!("events"in e)||!("count"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=e.count;if(typeof n!="number")return null;const r=e.nextCursor,a=typeof r=="string"?r:null,i=e.hasMore,s=typeof i=="boolean"?i:!1,o=[];for(const p of t){const d=D$(p);d&&o.push(d)}const u=e.catalog,l=Array.isArray(u)?O$(u):void 0;return{events:o,count:n,nextCursor:a,hasMore:s,...l?{catalog:l}:{}}}function D$(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.eventName!="string"||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const i=t.payload,s=typeof t.runId=="string"?t.runId:t.runId===null?null:void 0,o=typeof t.entityKind=="string"?t.entityKind:t.entityKind===null?null:void 0,u=typeof t.entityId=="string"?t.entityId:t.entityId===null?null:void 0,l=typeof t.sequence=="number"&&Number.isFinite(t.sequence)?t.sequence:t.sequence===null?null:void 0,p={id:t.id,eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{}};if(i===null)return{...p,payload:null,view:uu(t.eventName,null),...ou(s,o,u,l)};if(typeof i!="object")return null;const d=i,f=d.schemaVersion===2?d:void 0;return{...p,payload:CA(d),...f?{envelope:f}:{},view:uu(t.eventName,d),...ou(s,o,u,l)}}function ou(e,t,n,r){const a={};return e!==void 0&&(a.runId=e),t!==void 0&&(a.entityKind=t),n!==void 0&&(a.entityId=n),r!==void 0&&(a.sequence=r),a}function O$(e){const t=[];for(const n of e){if(n===null||typeof n!="object")return;const r=n;if(typeof r.name!="string"||typeof r.prefix!="string"||typeof r.source!="string"||typeof r.renderer!="string")return;const a=typeof r.tier=="string"?r.tier:void 0,i={name:r.name,prefix:r.prefix,source:r.source,renderer:r.renderer,...a!==void 0?{tier:a}:{}};t.push(i)}return t}function L$(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||t.eventName.length===0||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const i=t.payload;if(i!==null&&typeof i!="object")return null;const s=i,o=s?.schemaVersion===2?s:void 0,u=CA(s),l=t.runId??u?.runId,p=t.entityKind??u?.entityKind,d=t.entityId??u?.entityId,f=t.sequence??u?.sequence,m=typeof l=="string"?l:l===null?null:void 0,b=typeof p=="string"?p:p===null?null:void 0,E=typeof d=="string"?d:d===null?null:void 0,y=typeof f=="number"&&Number.isFinite(f)?f:f===null?null:void 0;return{eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{},payload:u,...o?{envelope:o}:{},view:uu(t.eventName,s),...ou(m,b,E,y)}}function uu(e,t){const n=F$(e);if(t?.schemaVersion!==2)return n;const r=$r(t.context),a=$r(t.presentation),i=$r(r?.project),s=$r(r?.producer),o=$r(r?.correlation);if(!r||!a||!i||!s||!o)return n;const u=a.severity==="info"||a.severity==="warning"||a.severity==="error"?a.severity:"warning",l=Array.isArray(a.fields)?a.fields.flatMap(b=>{const E=$r(b),y=In(E?.label,64),x=In(E?.value,256);return y&&x?[{label:y,value:x}]:[]}).slice(0,8):[],p=[],d=(b,E)=>{const y=In(E,128);y&&p.push({label:b,value:y})};d("Run",o.runId),d("Execution",o.executionId),d("Action",o.actionId),d("Entity",P$(o.entityKind,o.entityId)),d("Job",o.jobId),typeof o.sequence=="number"&&Number.isFinite(o.sequence)&&p.push({label:"Sequence",value:String(o.sequence)});const f=In(s.package,128)??"unavailable",m=In(s.subsystem,128);return{severity:u,summary:In(a.summary,512)??"unavailable",description:In(a.description,512)??"Description unavailable.",fields:l,projectName:In(i.name,128)??"unavailable",projectRoot:In(i.root,256)??"unavailable",producer:m?`${f} / ${m}`:f,correlation:p.map(({label:b,value:E})=>`${b.toLowerCase()} ${E}`).join(" · ")||"unavailable",correlationFields:p,outcome:In(a.outcome,128)??"unavailable",action:M$(a.action)}}function F$(e){return{severity:"warning",summary:"unavailable",description:`Canonical context unavailable for ${In(e,128)??"unknown"}.`,fields:[],projectName:"unavailable",projectRoot:"unavailable",producer:"unavailable",correlation:"unavailable",correlationFields:[],outcome:"unavailable",action:null}}function M$(e){const t=$r(e);if(!t||t.kind!=="command"&&t.kind!=="filter"&&t.kind!=="path")return null;const n=In(t.label,128),r=In(t.value,256);return n&&r?{label:n,kind:t.kind,value:r}:null}function In(e,t){return typeof e!="string"||e.length===0?null:e.length<=t?e:`${e.slice(0,t-1)}…`}function P$(e,t){const n=In(e,64),r=In(t,128);return n&&r?`${n}:${r}`:n??r}function $r(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function CA(e){return e?.schemaVersion!==2?e:$r(e.data)}const B$=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function U$(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=B$[t.getMonth()],r=t.getDate(),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${n} ${r} ${a}:${i}:${s}`}function lu(e){return typeof e!="number"||!Number.isFinite(e)?null:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function bt(e){return e&&e!=="unavailable"?e:"-"}function j$(e){const t={};e.selectedPrefixes.size===1&&(t.prefix=[...e.selectedPrefixes][0]);const n=e.searchQuery.trim();if(n!==""&&e.searchScope==="name"&&(t.names=n),n!==""&&e.searchScope==="actor"&&(t.actor=n),e.runId.trim()!==""&&(t.runId=e.runId.trim()),e.timeWindow!=="all"){const r=e.timeWindow==="30s"?3e4:3e5;t.since=new Date(Date.now()-r).toISOString()}return t}function Dy(e,t,n){if(t.selectedPrefixes.size>=1){const r=e.prefix??e.eventName.split(".")[0]??e.eventName;if(!t.selectedPrefixes.has(r))return!1}if(t.tierFilter!=="all"){const r=n.get(e.eventName);if(r!==t.tierFilter&&!(t.tierFilter==="default"&&r===void 0))return!1}if(t.searchQuery.trim()!==""){const r=t.searchQuery.toLowerCase();let a=!1;if((t.searchScope==="name"||t.searchScope==="all")&&(a=a||e.eventName.toLowerCase().includes(r)),(t.searchScope==="actor"||t.searchScope==="all")&&(a=a||(e.actor?.toLowerCase().includes(r)??!1)),t.searchScope==="payload"&&e.payload&&(a=a||JSON.stringify(e.payload).toLowerCase().includes(r)),!a)return!1}if(t.timeWindow!=="all"){const r=t.timeWindow==="30s"?3e4:3e5,a=Date.now()-r,i=new Date(e.occurredAt).getTime();if(Number.isNaN(i)||i<a)return!1}return!(t.runId.trim()!==""&&e.runId!==t.runId.trim())}function $$(){const[e,t]=g.useState([]),[n,r]=g.useState([]),[a,i]=g.useState("idle"),[s,o]=g.useState(null),[u,l]=g.useState(null),[p,d]=g.useState(!1),[f,m]=g.useState(!1),[b,E]=g.useState(dc),[y,x]=g.useState(dc),[w,T]=g.useState("connecting"),{rate:I,recordEvent:R}=R$(),v=g.useMemo(()=>{const X=new Map;for(const re of n)re.tier&&X.set(re.name,re.tier);return X},[n]);g.useEffect(()=>{const X=window.setTimeout(()=>{x(b)},250);return()=>window.clearTimeout(X)},[b]);const A=g.useMemo(()=>j$(y),[y]),N=g.useRef(0);g.useEffect(()=>{const X=++N.current,re=new AbortController;return i("loading"),o(null),(async()=>{try{const ue=await Ke(new Request(ky({...A,limit:sd}),{signal:re.signal}));if(!ue.ok){const le=await ue.json().catch(()=>null),D=le?.code;throw D==="UNKNOWN_PREFIX"||D==="MALFORMED_CURSOR"?new Error(`${D}: ${le.error??ue.status}`):new Error(`history fetch failed: ${ue.status}`)}const k=await ue.json(),Y=ei(k);if(!Y)throw new Error("history response failed schema validation");if(X!==N.current)return;t(Y.events),Y.catalog&&r(Y.catalog),l(Y.nextCursor),d(Y.hasMore),i("loaded")}catch(ue){if(re.signal.aborted||X!==N.current)return;o(ue instanceof Error?ue.message:String(ue)),i("error")}})(),()=>re.abort()},[A]);const F=g.useCallback(async()=>{if(!(!p||f||u===null)){m(!0);try{const X=await Ke(new Request(ky({...A,limit:sd,cursor:u})));if(!X.ok)throw new Error(`history fetch failed: ${X.status}`);const re=await X.json(),ue=ei(re);if(!ue)throw new Error("history response failed schema validation");t(k=>{const Y=new Set(k.map(D=>D.id)),le=ue.events.filter(D=>!Y.has(D.id));return[...k,...le]}),ue.catalog&&r(ue.catalog),l(ue.nextCursor),d(ue.hasMore)}catch(X){o(X instanceof Error?X.message:String(X))}finally{m(!1)}}},[p,f,u,A]),_=g.useRef(b);_.current=b;const M=g.useRef(v);M.current=v,g.useEffect(()=>{if(typeof EventSource>"u")return;const X=new EventSource(I$());return X.onopen=()=>{T("live")},X.onerror=()=>{T("errored")},X.onmessage=re=>{try{const ue=JSON.parse(re.data),k=L$(ue);if(!k||k.eventName==="connected")return;const Y=_.current,le=M.current;if(!Dy({eventName:k.eventName,occurredAt:k.occurredAt,actor:k.actor,...k.prefix?{prefix:k.prefix}:{},payload:k.payload,...k.runId!==void 0?{runId:k.runId}:{}},Y,le))return;const D={id:`live-${k.occurredAt}-${k.eventName}`,eventName:k.eventName,occurredAt:k.occurredAt,actor:k.actor,...k.prefix?{prefix:k.prefix}:{},...k.renderer?{renderer:k.renderer}:{},payload:k.payload,...k.envelope?{envelope:k.envelope}:{},view:k.view,...ou(k.runId,k.entityKind,k.entityId,k.sequence)};t(ke=>[D,...ke]),R()}catch{}},()=>X.close()},[R]);const j=g.useMemo(()=>Array.from(new Set([...n.map(X=>X.prefix),...e.map(X=>X.prefix??X.eventName.split(".")[0]??X.eventName)])).sort(),[n,e]),H=b.selectedPrefixes.size>0||b.searchQuery.trim()!==""||b.searchScope!=="all"||b.tierFilter!=="all"||b.timeWindow!=="all"||b.runId.trim()!=="",Z=g.useCallback(()=>{E(dc)},[]),V=g.useCallback(X=>{E(re=>{const ue=new Set(re.selectedPrefixes);return ue.has(X)?ue.delete(X):ue.add(X),{...re,selectedPrefixes:ue}})},[]);if(a==="error")return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load event history: ",s]});if(a==="idle"||a==="loading")return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading event history…"]});const ie=e.filter(X=>Dy(X,b,v));return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center justify-between gap-3 flex-wrap",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"System Events"}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"newest first · live tail"})]}),c.jsx(z$,{status:w,rate:I,shown:ie.length,total:e.length,hasMore:p})]}),c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-100 shrink-0 flex flex-col gap-2",children:[c.jsxs("fieldset",{className:"flex flex-wrap items-center gap-1.5 border-0 p-0 m-0","aria-label":"Filter by prefix",children:[c.jsx("legend",{className:"sr-only",children:"Filter by prefix"}),j.map(X=>{const re=b.selectedPrefixes.has(X),ue=NA(X);return c.jsxs("button",{type:"button",role:"switch","aria-checked":re,"aria-label":`Prefix ${X}${re?" (selected)":""}`,onClick:()=>V(X),className:`px-2 py-0.5 rounded-full text-[11px] font-mono border transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 ${re?`${ue} border-current bg-base-200`:"text-spur-text-muted border-spur-border/40 hover:bg-base-200/60"}`,children:[X,".*"]},X)})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Oy,{label:"Tier",value:b.tierFilter,onChange:X=>E(re=>({...re,tierFilter:X})),options:[{value:"all",label:"All"},{value:"default",label:"Default"},{value:"diagnostic",label:"Diagnostic"}]}),c.jsx(Oy,{label:"Window",value:b.timeWindow,onChange:X=>E(re=>({...re,timeWindow:X})),options:[{value:"all",label:"All"},{value:"30s",label:"30s"},{value:"5m",label:"5m"}]}),c.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[220px]",children:[c.jsxs("select",{value:b.searchScope,onChange:X=>E(re=>({...re,searchScope:X.target.value})),className:"bg-base-200 border border-spur-border rounded px-1.5 py-0.5 text-[11px] text-spur-text focus:outline-none focus:ring-2 focus:ring-spur-text/40 cursor-pointer","aria-label":"Search scope",children:[c.jsx("option",{value:"all",children:"all"}),c.jsx("option",{value:"name",children:"name"}),c.jsx("option",{value:"actor",children:"actor"}),c.jsx("option",{value:"payload",children:"payload"})]}),c.jsx(gs,{size:"sm",variant:"bordered",placeholder:"Search…",value:b.searchQuery,onChange:X=>E(re=>({...re,searchQuery:X.target.value})),className:"flex-1 min-w-[120px] input-sm","aria-label":`Search ${b.searchScope}`})]}),c.jsx(gs,{size:"sm",variant:"bordered",placeholder:"run id…",value:b.runId,onChange:X=>E(re=>({...re,runId:X.target.value})),className:"w-32 input-sm","aria-label":"Filter by run id"}),H&&c.jsx("button",{type:"button",onClick:Z,className:"text-[11px] text-spur-text-muted hover:text-error px-2 py-0.5 rounded border border-spur-border/40 hover:border-error/40 transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40","aria-label":"Clear all filters",children:"Clear"}),c.jsxs("span",{"aria-live":"polite",className:"text-[11px] font-mono text-spur-text-muted whitespace-nowrap",children:[ie.length," of ",e.length]})]})]}),ie.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic flex-1 overflow-y-auto",children:e.length===0?"No system events yet. New events from the planning bus will appear here in real time.":"No events match the active filters."}):c.jsx(G$,{rows:ie,catalog:n}),p&&c.jsx("div",{className:"px-4 py-2 border-t border-spur-border bg-base-100 shrink-0 flex justify-center",children:c.jsx("button",{type:"button",onClick:F,disabled:f,"data-load-older":!0,className:"text-[11px] text-spur-text-muted hover:text-spur-text px-3 py-1 rounded border border-spur-border/40 hover:border-spur-text/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-wait focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:f?"Loading…":"Load older"})})]})}function z$({status:e,rate:t,shown:n,total:r,hasMore:a}){const i=g.useMemo(()=>{switch(e){case"live":return"bg-success";case"connecting":return"bg-spur-text-muted";case"errored":return"bg-error"}},[e]),s=e==="live"?{animation:"spur-pulse 1.6s ease-in-out infinite"}:void 0;return c.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-spur-text-muted font-mono whitespace-nowrap",children:[c.jsxs("span",{role:"status","aria-label":`SSE connection ${e}`,className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{"aria-hidden":"true",className:`inline-block w-2 h-2 rounded-full ${i}`,style:s}),c.jsx("span",{className:"text-spur-text uppercase tracking-wide",children:e})]}),c.jsxs("span",{"aria-live":"polite","aria-atomic":"true",children:[t," events / 60s"]}),c.jsxs("span",{"aria-live":"polite","aria-atomic":"true",children:[n," of ",r," shown",a?" · more available":""]})]})}function H$(e){const[t,n]=g.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches);return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(e),a=()=>n(r.matches);return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),t}function G$({rows:e,catalog:t}){const n=g.useMemo(()=>{const a=new Map;for(const i of t)i.tier&&a.set(i.name,i.tier);return a},[t]),r=H$("(max-width: 639px)");return c.jsx("section",{className:"flex-1 overflow-y-auto min-w-0","data-system-events-tab":!0,"aria-label":"System events",children:c.jsxs("table",{className:`w-full ${r?"min-w-0":"min-w-[1180px]"} text-xs border-separate border-spacing-0 table-fixed`,children:[c.jsxs("colgroup",{children:[c.jsx("col",{className:r?"w-24":"w-36"}),!r&&c.jsx("col",{className:"w-24"}),c.jsx("col",{className:"w-[17%]"}),!r&&c.jsx("col",{className:"w-[22%]"}),!r&&c.jsx("col",{className:"w-[18%]"}),!r&&c.jsx("col",{className:"w-[20%]"}),!r&&c.jsx("col",{className:"w-28"}),!r&&c.jsx("col",{className:"w-[18%]"})]}),c.jsx("thead",{className:"sticky top-0 z-10 bg-base-200",children:c.jsxs("tr",{className:"text-left text-spur-text-muted uppercase tracking-wide text-[10px]",children:[c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Time"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Severity"}),c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Event"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Summary"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Producer"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Correlation"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Outcome"}),!r&&c.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Action"})]})}),c.jsx("tbody",{children:e.map(a=>c.jsx(V$,{event:a,tier:n.get(a.eventName)??"default",compact:r},a.id))})]})})}const pc="system-events-payload-tooltip-pin",W$={info:{icon:"●",className:"text-spur-text-muted"},warning:{icon:"▲",className:"text-warning"},error:{icon:"✕",className:"text-error"}};function fc({severity:e}){const t=W$[e];return c.jsxs("span",{className:`inline-flex items-center gap-1 whitespace-nowrap ${t.className}`,children:[c.jsx("span",{"aria-hidden":"true",children:t.icon}),c.jsx("span",{children:e})]})}function V$({event:e,tier:t,compact:n}){const r=e.prefix??e.eventName.split(".")[0]??e.eventName,a=g.useMemo(()=>e.view??uu(e.eventName,e.payload),[e.eventName,e.payload,e.view]),i=NA(r),[s,o]=g.useState(!1),[u,l]=g.useState(!1),[p,d]=g.useState(!1),[f,m]=g.useState(null),b=g.useRef(null),E=g.useRef(null),y=g.useRef(0),x=g.useRef(null),w=bt(e.actor),T=u||p,I=g.useCallback(()=>{x.current!==null&&(clearTimeout(x.current),x.current=null)},[]),R=g.useCallback(()=>{d(!1),m(null)},[]),v=g.useCallback((M,j)=>{y.current=performance.now()+400,d(!0),l(!1),I();const H=Number.isFinite(M)&&M>0?M:8,Z=Number.isFinite(j)&&j>0?j:8;m({x:H,y:Z}),window.dispatchEvent(new CustomEvent(pc,{detail:{id:e.id}}))},[e.id,I]),A=g.useCallback((M,j,H)=>{const Z=M.getBoundingClientRect(),V=j&&j>0?j:Z.left,ie=H&&H>0?H+4:Z.bottom+6;v(V,ie)},[v]);g.useEffect(()=>{const M=j=>{j.detail?.id!==e.id&&R()};return window.addEventListener(pc,M),()=>window.removeEventListener(pc,M)},[e.id,R]),g.useEffect(()=>{if(!p)return;const M=H=>{performance.now()<y.current||b.current?.contains(H.target)||E.current?.contains(H.target)||R()},j=H=>{H.key==="Escape"&&(R(),H.stopPropagation())};return document.addEventListener("pointerdown",M,!0),document.addEventListener("keydown",j,!0),()=>{document.removeEventListener("pointerdown",M,!0),document.removeEventListener("keydown",j,!0)}},[p,R]),g.useEffect(()=>()=>{I()},[I]);const N=g.useCallback(()=>o(M=>!M),[]),F=g.useCallback(M=>{if(M.key==="Escape"){if(p){R(),M.stopPropagation();return}o(!1),M.stopPropagation()}},[p,R]),_=T?c.jsxs("div",{ref:b,id:`system-event-tooltip-${e.id}`,role:"tooltip","data-testid":"system-event-payload-tooltip","data-pinned":p?"true":"false",className:p?"pointer-events-auto fixed z-50 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9] select-text cursor-text":"pointer-events-auto absolute left-0 top-full mt-1 z-30 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9]",style:p&&f?{top:f.y,left:f.x}:void 0,onMouseEnter:()=>{I(),l(!0)},onMouseLeave:()=>{p||(I(),x.current=setTimeout(()=>l(!1),150))},onFocusCapture:()=>l(!0),onBlurCapture:M=>{!p&&!M.currentTarget.contains(M.relatedTarget)&&l(!1)},onPointerDown:M=>{p&&M.stopPropagation()},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[c.jsxs("div",{className:"text-[10px] text-[#8b949e] font-sans",children:["event context",p?" · select to copy · Esc / outside click to close":" · click event name or Pin to lock for copy"]}),c.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!p&&c.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-pin",className:"text-[10px] text-[#c9d1d9] hover:text-white px-1.5 py-0.5 rounded border border-[#30363d] bg-[#21262d] cursor-pointer",onClick:M=>{M.stopPropagation(),M.preventDefault();const j=E.current;j?A(j):v(M.clientX,M.clientY)},children:"Pin"}),p&&c.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-close",className:"text-[10px] text-[#8b949e] hover:text-[#c9d1d9] px-1 rounded border border-[#30363d] cursor-pointer",onClick:M=>{M.stopPropagation(),R()},children:"close"})]})]}),c.jsx("p",{className:"mb-2 text-spur-text leading-relaxed","data-testid":"system-event-description",children:a.description}),c.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 max-h-80 overflow-y-auto",children:[c.jsx("dt",{className:"text-spur-text-muted",children:"Summary"}),c.jsx("dd",{className:"break-words",children:bt(a.summary)}),c.jsx("dt",{className:"text-spur-text-muted",children:"Severity"}),c.jsx("dd",{children:c.jsx(fc,{severity:a.severity})}),a.fields.map(M=>c.jsxs("div",{className:"contents",children:[c.jsx("dt",{className:"text-spur-text-muted",children:M.label}),c.jsx("dd",{className:"font-mono break-all",children:bt(M.value)})]},M.label+M.value)),c.jsx("dt",{className:"text-spur-text-muted",children:"Producer"}),c.jsx("dd",{className:"font-mono break-all",children:bt(a.producer)}),a.correlationFields.length>0?a.correlationFields.map(M=>c.jsxs("div",{className:"contents",children:[c.jsx("dt",{className:"text-spur-text-muted",children:M.label}),c.jsx("dd",{className:"font-mono break-all",children:bt(M.value)})]},`correlation-${M.label}`)):c.jsxs(c.Fragment,{children:[c.jsx("dt",{className:"text-spur-text-muted",children:"Correlation"}),c.jsx("dd",{className:"font-mono",children:"-"})]}),c.jsx("dt",{className:"text-spur-text-muted",children:"Outcome"}),c.jsx("dd",{className:"font-mono break-all",children:bt(a.outcome)})]}),a.action&&c.jsxs("div",{className:"mt-2 border-t border-[#30363d] pt-2","data-testid":"system-event-remediation",children:[c.jsx("div",{className:"text-spur-text-muted",children:a.action.label}),c.jsx("code",{className:"block mt-0.5 font-mono break-all select-text",children:a.action.value})]})]}):null;return c.jsxs(c.Fragment,{children:[c.jsxs("tr",{className:"group hover:bg-base-200/60 transition-colors",style:{height:n?void 0:28},children:[c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-spur-text-muted whitespace-nowrap align-middle",children:U$(e.occurredAt)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 align-middle text-[10px]",children:c.jsx(fc,{severity:a.severity})}),c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 relative align-middle min-w-0",children:c.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[c.jsx("button",{type:"button","aria-expanded":s,"aria-controls":`detail-${e.id}`,"aria-label":`${s?"Collapse":"Expand"} detail for ${e.eventName}`,onClick:N,onKeyDown:F,className:"inline-flex items-center justify-center w-4 h-4 text-spur-text-muted hover:text-spur-text text-[10px] transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 shrink-0",children:s?"▾":"▸"}),c.jsxs("div",{className:"relative min-w-0 max-w-full",children:[c.jsx("button",{ref:E,type:"button",className:`font-mono font-semibold truncate block max-w-full text-left cursor-pointer bg-transparent border-0 p-0 ${i}`,"data-testid":"system-event-name","aria-label":`Context for ${e.eventName}. Hover to preview; click to pin for select and copy.`,"aria-describedby":T?`system-event-tooltip-${e.id}`:void 0,onMouseEnter:()=>{I(),l(!0)},onFocus:()=>{I(),l(!0)},onBlur:M=>{!p&&!b.current?.contains(M.relatedTarget)&&l(!1)},onMouseLeave:()=>{I(),x.current=setTimeout(()=>{p||l(!1)},200)},onClick:M=>{M.preventDefault(),M.stopPropagation(),!p&&A(M.currentTarget,M.clientX,M.clientY)},onKeyDown:M=>{if(M.key==="Enter"||M.key===" "){if(M.preventDefault(),p)return;A(M.currentTarget)}},children:e.eventName}),!p&&_]})]}),n&&c.jsxs("div",{className:"flex flex-col gap-0.5 text-[10px] text-spur-text-muted min-w-0",children:[c.jsx(fc,{severity:a.severity}),c.jsx("span",{className:"truncate text-spur-text",title:bt(a.summary),children:bt(a.summary)}),c.jsx("span",{className:"truncate",title:bt(a.producer),children:bt(a.producer)}),c.jsx("span",{className:"truncate",title:bt(a.correlation),children:bt(a.correlation)}),c.jsxs("span",{className:"truncate",children:["outcome: ",bt(a.outcome)]}),c.jsxs("span",{className:"truncate",title:bt(a.action?.value),children:["action: ",bt(a.action?.value)]})]})]})}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 text-spur-text align-middle truncate",title:bt(a.summary),children:bt(a.summary)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.producer),children:bt(a.producer)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.correlation),children:bt(a.correlation)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.outcome),children:bt(a.outcome)}),!n&&c.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:bt(a.action?.value),children:bt(a.action?.value)})]}),s&&c.jsx("tr",{children:c.jsx("td",{colSpan:n?2:8,className:"px-3 py-2 border-b border-spur-border/40 bg-base-300/40",children:c.jsxs("section",{id:`detail-${e.id}`,"aria-label":`Detail for ${e.eventName}`,onKeyDown:F,tabIndex:-1,className:"flex flex-col gap-2 text-[11px] text-spur-text max-w-full",children:[c.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px]",children:[c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"project:"})," ",bt(a.projectName)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"root:"})," ",bt(a.projectRoot)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"producer:"})," ",bt(a.producer)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"correlation:"})," ",bt(a.correlation)]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"actor:"})," ",w]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"prefix:"})," ",r]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"tier:"})," ",t]}),c.jsxs("span",{children:[c.jsx("span",{className:"text-spur-text-muted",children:"outcome:"})," ",bt(a.outcome)]})]}),a.fields.length>0&&c.jsx("dl",{className:"space-y-0.5",children:a.fields.map(M=>c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("dt",{className:"text-spur-text-muted shrink-0",children:[M.label,":"]}),c.jsx("dd",{className:"font-mono break-all",children:bt(M.value)})]},M.label+M.value))}),c.jsxs("div",{className:"border-t border-spur-border/40 pt-1",children:[c.jsx("div",{className:"text-spur-text-muted text-[10px] mb-0.5",children:"payload (redacted):"}),c.jsx("pre",{className:"font-mono text-[10px] text-spur-text-muted overflow-x-auto whitespace-pre-wrap break-all",children:e.envelope?JSON.stringify(e.envelope,null,2):"-"})]}),c.jsx("button",{type:"button",onClick:()=>o(!1),className:"self-start text-[10px] text-spur-text-muted hover:text-error px-2 py-0.5 rounded border border-spur-border/40 hover:border-error/40 transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:"Close (Esc)"})]})})}),p&&_&&typeof document<"u"?Ua.createPortal(_,document.body):null]})}function Oy({label:e,value:t,onChange:n,options:r}){return c.jsxs("fieldset",{"aria-label":e,className:"inline-flex rounded border border-spur-border/40 overflow-hidden text-[11px] border-0 p-0 m-0",children:[c.jsx("legend",{className:"sr-only",children:e}),r.map(a=>{const i=a.value===t;return c.jsxs("label",{className:`px-2 py-0.5 font-mono cursor-pointer focus-within:ring-2 focus-within:ring-spur-text/40 transition-colors ${i?"bg-spur-text/15 text-spur-text":"text-spur-text-muted hover:bg-base-200/60"}`,children:[c.jsx("input",{type:"radio",name:e,value:a.value,checked:i,onChange:()=>n(a.value),className:"sr-only"}),a.label]},a.value)})]})}const IA=et(),q$=`${IA}/jobs/stats`,Ly=`${IA}/events/history`,Fy=50;function Y$(e){if(e===null||typeof e!="object")return null;const t=e.stats;if(t===null||typeof t!="object")return null;const n=t;return typeof n.pending!="number"||typeof n.processing!="number"||typeof n.completed!="number"||typeof n.failed!="number"?null:{stats:{pending:n.pending,processing:n.processing,completed:n.completed,failed:n.failed}}}function kA(e){switch(e.split(".").pop()??""){case"enqueued":return"pending";case"retrying":return"retrying";case"completed":return"completed";case"failed":return"failed";case"executed":return"executed";default:return null}}function cu(e,t){const n={};if(!t)return n;const r=s=>{const o=t[s];return typeof o=="string"&&o.length>0?o:void 0},a=s=>{const o=t[s];return typeof o=="number"&&Number.isFinite(o)?o:void 0},i=e.split(".").pop()??"";return n.durationMs=a("durationMs"),i==="executed"?(n.name=r("name"),n.error=r("error")):(n.jobId=r("jobId"),n.type=r("type"),(i==="failed"||i==="retrying")&&(n.attempt=a("attempt")),i==="failed"&&(n.error=r("error"))),n}function RA(e){switch(e){case"completed":case"executed":return"success";case"retrying":return"warning";case"failed":return"error";default:return"neutral"}}function Z$(e,t){const n=[];let r=0,a=0;for(;r<e.length&&a<t.length;){const i=e[r],s=t[a];if(i&&s&&i.occurredAt>=s.occurredAt)n.push(i),r++;else if(s)n.push(s),a++;else if(i)n.push(i),r++;else break}for(;r<e.length;){const i=e[r];i&&n.push(i),r++}for(;a<t.length;){const i=t[a];i&&n.push(i),a++}return n}function K$(e){const t=[],n=new Map;for(const r of e){const i=r.eventName.startsWith("queue.job.")?cu(r.eventName,r.payload).jobId:void 0;if(i!==void 0){const s=n.get(i);if(s)s.events.push(r);else{const o={kind:"thread",jobId:i,events:[r]};n.set(i,o),t.push(o)}}else t.push({kind:"standalone",row:r})}return t}function X$(e){if(e.length<2)return null;const t=Date.parse(e[0]?.occurredAt??""),n=Date.parse(e.at(-1)?.occurredAt??"");return!Number.isFinite(t)||!Number.isFinite(n)?null:Math.max(0,t-n)}function Q$(){const[e,t]=g.useState(null),[n,r]=g.useState(null);if(g.useEffect(()=>{const i=new AbortController;return(async()=>{try{const[s,o,u]=await Promise.all([Ke(new Request(q$,{signal:i.signal})),Ke(new Request(`${Ly}?prefix=queue&limit=${Fy}`,{signal:i.signal})),Ke(new Request(`${Ly}?prefix=scheduler&limit=${Fy}`,{signal:i.signal}))]);if(!s.ok)throw new Error(`job stats fetch failed: ${s.status}`);if(!o.ok)throw new Error(`queue history fetch failed: ${o.status}`);if(!u.ok)throw new Error(`scheduler history fetch failed: ${u.status}`);const l=Y$(await s.json()),p=ei(await o.json()),d=ei(await u.json());if(!l)throw new Error("job stats response failed schema validation");if(!p)throw new Error("queue history response failed schema validation");if(!d)throw new Error("scheduler history response failed schema validation");const f=Z$(p.events,d.events);t({stats:l.stats,events:f})}catch(s){if(i.signal.aborted)return;r(s instanceof Error?s.message:String(s))}})(),()=>i.abort()},[]),n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load jobs: ",n]});if(e===null)return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading jobs…"]});const a=[["Pending",e.stats.pending,"text-spur-text"],["Processing",e.stats.processing,"text-info"],["Completed",e.stats.completed,"text-success"],["Failed",e.stats.failed,"text-error"]];return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-jobs-tab":!0,children:[c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 border-b border-spur-border bg-base-200 shrink-0",children:a.map(([i,s,o])=>c.jsx(mi,{variant:"compact",className:"bg-base-100 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsx("span",{className:"text-[10px] uppercase text-spur-text-muted font-semibold",children:i}),c.jsx("span",{className:`text-xl font-semibold tabular-nums ${o}`,children:s})]})},i))}),c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Recent Job Events"}),c.jsxs("span",{className:"ml-2 text-xs text-spur-text-muted",children:[e.events.length," event(s)"]})]}),e.events.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-jobs-empty":!0,children:"No job events yet - the queue has not processed any jobs."}):c.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:K$(e.events).map(i=>i.kind==="thread"?c.jsx(ez,{item:i},`thread-${i.jobId}`):c.jsx(J$,{row:i.row},i.row.id))})]})}function J$({row:e}){const t=g.useMemo(()=>cu(e.eventName,e.payload),[e.eventName,e.payload]),n=kA(e.eventName),r=e.eventName.startsWith("scheduler."),a=r?t.name??"scheduler":t.jobId??"job",i=r?"scheduler":t.type??"unknown",s=t.durationMs!==void 0?lu(t.durationMs):null;return c.jsx("li",{children:c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n!==null&&c.jsx(st,{variant:RA(n),size:"xs",children:n}),c.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:a}),c.jsx(st,{variant:"outline",size:"xs",children:i}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:e.occurredAt})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[t.attempt!==void 0&&c.jsxs("span",{children:["attempt ",c.jsx("span",{className:"font-mono text-spur-text",children:t.attempt})]}),c.jsxs("span",{children:["duration ",c.jsx("span",{className:"font-mono text-spur-text",children:s??"unavailable"})]}),t.error!==void 0&&c.jsx("span",{className:"text-error truncate max-w-md",title:t.error,children:t.error}),!r&&t.type===void 0&&c.jsx("span",{className:"italic",children:"unknown job type"})]}),e.payload!==null&&Object.keys(e.payload).length>0&&c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),c.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(e.payload,null,2)})]})]})})})}function ez({item:e}){const t=e.events[0],n=g.useMemo(()=>t?cu(t.eventName,t.payload):null,[t]);if(!t||!n)return null;const r=kA(t.eventName),a=X$(e.events),i=n.durationMs!==void 0?lu(n.durationMs):a!==null?lu(a):null;return c.jsx("li",{children:c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r!==null&&c.jsx(st,{variant:RA(r),size:"xs",children:r}),c.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:e.jobId}),n.type!==void 0&&c.jsx(st,{variant:"outline",size:"xs",children:n.type}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:t.occurredAt})]}),c.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[n.attempt!==void 0&&c.jsxs("span",{children:["attempt ",c.jsx("span",{className:"font-mono text-spur-text",children:n.attempt})]}),c.jsxs("span",{children:["duration ",c.jsx("span",{className:"font-mono text-spur-text",children:i??"unavailable"})]}),n.error!==void 0&&c.jsx("span",{className:"text-error truncate max-w-md",title:n.error,children:n.error}),c.jsxs("span",{className:"italic",children:[e.events.length," event(s)"]})]}),e.events.length>1&&c.jsxs("details",{className:"mt-1",children:[c.jsxs("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:["event sequence (",e.events.length,")"]}),c.jsx("ol",{className:"mt-1 space-y-1",children:e.events.map(s=>{const o=cu(s.eventName,s.payload);return c.jsxs("li",{className:"text-[10px] text-spur-text-muted flex items-center gap-2",children:[c.jsx("span",{className:"font-mono",children:s.occurredAt}),c.jsx("span",{children:s.eventName}),o.attempt!==void 0&&c.jsxs("span",{children:["attempt ",o.attempt]})]},s.id)})})]}),t.payload!==null&&Object.keys(t.payload).length>0&&c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),c.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(t.payload,null,2)})]})]})})})}function My(e){if(e===null||typeof e!="object")return null;const t=e;return typeof t.inputTokens!="number"||typeof t.outputTokens!="number"||typeof t.cacheReadTokens!="number"||typeof t.cacheCreationTokens!="number"||typeof t.records!="number"||typeof t.recordsWithUsage!="number"?null:{inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens,cacheCreationTokens:t.cacheCreationTokens,records:t.records,recordsWithUsage:t.recordsWithUsage}}function tz(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.totalRuns!="number"||typeof t.matchedRuns!="number"||typeof t.unmeasured!="boolean"?null:{role:t.role,totalRuns:t.totalRuns,matchedRuns:t.matchedRuns,exact:My(t.exact),estimated:My(t.estimated),unmeasured:t.unmeasured}}function nz(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.executor!="string"||!(t.source===null||typeof t.source=="string")||typeof t.runs!="number"||typeof t.escalations!="number"?null:{role:t.role,executor:t.executor,source:t.source,runs:t.runs,escalations:t.escalations}}function rz(e){if(e===null||typeof e!="object")return null;const t=e,n=t.routing,r=t.tokens;if(n===null||typeof n!="object"||r===null||typeof r!="object")return null;const a=n,i=r,s=a.window;if(s===null||typeof s!="object")return null;const o=s;if(typeof o.since!="string"||typeof o.until!="string"||!Array.isArray(a.pairs)||!Array.isArray(i.roles))return null;const u=[];for(const p of a.pairs){const d=nz(p);d&&u.push(d)}const l=[];for(const p of i.roles){const d=tz(p);d&&l.push(d)}return{window:{since:o.since,until:o.until},pairs:u,roles:l}}function az(e){switch(e){case"explicit":return"pinned";case"role":return"resolved";case"default":return"default";case null:return"—";default:return e}}const iz=new Intl.NumberFormat("en-US");function ja(e){return iz.format(e)}function Py({label:e,totals:t}){return c.jsxs("div",{"data-token-bucket":e,className:"text-xs",children:[c.jsx(st,{size:"xs",variant:e==="estimated"?"warning":"success",children:e}),c.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1",children:[c.jsx("dt",{className:"text-spur-text-muted",children:"input"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.inputTokens)}),c.jsx("dt",{className:"text-spur-text-muted",children:"cache read"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.cacheReadTokens)}),c.jsx("dt",{className:"text-spur-text-muted",children:"cache write"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.cacheCreationTokens)}),c.jsx("dt",{className:"text-spur-text-muted",children:"output"}),c.jsx("dd",{className:"tabular-nums text-right",children:ja(t.outputTokens)})]})]})}function sz({role:e}){const t=e.role??"—";return c.jsxs("div",{className:"bg-base-100 border border-spur-border rounded-md p-3","data-role-attribution":t,children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:t}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums",children:["matched ",e.matchedRuns," of ",e.totalRuns," runs"]})]}),e.unmeasured?c.jsxs("div",{className:"mt-1 text-xs","data-unmeasured":!0,children:[c.jsx(st,{size:"xs",variant:"ghost",children:"unmeasured"}),c.jsx("span",{className:"ml-1 text-spur-text-muted",children:"no token data recorded for this role — not a measured zero"})]}):c.jsxs("div",{className:"mt-2 flex flex-wrap gap-4",children:[e.exact?c.jsx(Py,{label:"exact",totals:e.exact}):null,e.estimated?c.jsx(Py,{label:"estimated",totals:e.estimated}):null]})]})}function oz(){const[e,t]=g.useState(null),[n,r]=g.useState(null);if(g.useEffect(()=>{const i=new AbortController;return(async()=>{try{const s=await Ke(new Request(`${et()}/observability/routing-summary`,{signal:i.signal}));if(!s.ok)throw new Error(`routing summary fetch failed: ${s.status}`);const o=rz(await s.json());if(!o)throw new Error("routing summary response failed schema validation");t(o)}catch(s){if(i.signal.aborted)return;r(s instanceof Error?s.message:String(s))}})(),()=>i.abort()},[]),n)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load routing summary: ",n]});if(e===null)return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading routing summary…"]});const a=e.pairs.length===0&&e.roles.length===0;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-routing-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-baseline justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Routing & token consumption"}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums","data-covered-window":!0,children:["covered ",e.window.since," → ",e.window.until]})]}),a?c.jsx("div",{className:"flex-1 flex items-center justify-center p-4","data-routing-empty":!0,children:c.jsx("div",{className:"text-sm text-spur-text-muted italic",children:"No routing attribution has been recorded in the covered window — nothing to show yet."})}):c.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-4",children:[e.pairs.length>0?c.jsxs("section",{className:"bg-base-100 border border-spur-border rounded-md","data-routing-table":!0,children:[c.jsxs("div",{className:"px-3 py-2 border-b border-spur-border",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Role → executor"}),c.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"runs and escalations per pair; pinned and role-resolved counted separately"})]}),c.jsxs("table",{className:"table table-sm w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-[10px] uppercase text-spur-text-muted",children:[c.jsx("th",{children:"Role"}),c.jsx("th",{children:"Executor"}),c.jsx("th",{children:"Source"}),c.jsx("th",{className:"text-right",children:"Runs"}),c.jsx("th",{className:"text-right",children:"Escalations"})]})}),c.jsx("tbody",{children:e.pairs.map(i=>c.jsxs("tr",{children:[c.jsx("td",{className:"text-sm text-spur-text",children:i.role??"—"}),c.jsx("td",{className:"text-sm text-spur-text",children:i.executor}),c.jsx("td",{children:c.jsx(st,{size:"xs",variant:i.source==="explicit"?"warning":"ghost",children:az(i.source)})}),c.jsx("td",{className:"text-right tabular-nums text-spur-text",children:ja(i.runs)}),c.jsx("td",{className:"text-right tabular-nums text-spur-text",children:ja(i.escalations)})]},`${i.role??""}:${i.executor}:${i.source??""}`))})]}),c.jsx("div",{className:"px-3 py-1.5 border-t border-spur-border text-[10px] text-spur-text-muted",children:"“—” role groups pure pins (no role recorded); escalations count runs that started too cheap on this executor."})]}):null,e.roles.length>0?c.jsxs("section",{"data-token-section":!0,children:[c.jsxs("div",{className:"px-1 pb-1.5",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Token consumption by role"}),c.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"input, cache read, cache write, output — token totals only"})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:e.roles.map(i=>c.jsx(sz,{role:i},i.role??"pin"))})]}):null]})]})}function Rn(e){return typeof e=="string"}function Nr(e){return e===null||typeof e=="string"}function uz(e){return e===null||typeof e=="number"&&Number.isFinite(e)}function lz(e){return e===null||typeof e=="boolean"}function Jg(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.id)||!Nr(t.workflowName)||!Rn(t.status)||!Nr(t.mode)||!Nr(t.agent)||!Rn(t.startedAt)||!Nr(t.completedAt)?null:{id:t.id,workflowName:t.workflowName,status:t.status,mode:t.mode,agent:t.agent,startedAt:t.startedAt,completedAt:t.completedAt}}function cz(e){if(e===null||typeof e!="object")return null;const t=e;if(!Array.isArray(t.runs)||typeof t.count!="number")return null;const n=[];for(const r of t.runs){const a=Jg(r);a&&n.push(a)}return{runs:n,count:t.count,nextCursor:Rn(t.nextCursor)?t.nextCursor:null,hasMore:typeof t.hasMore=="boolean"?t.hasMore:!1}}function dz(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.phase)||!Rn(t.status)||!Nr(t.startedAt)||!Nr(t.completedAt)?null:{phase:t.phase,status:t.status,startedAt:t.startedAt,completedAt:t.completedAt}}function pz(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.from)||!Rn(t.to)||!Nr(t.trigger)?null:{from:t.from,to:t.to,trigger:t.trigger}}function fz(e){if(e===null||typeof e!="object")return null;const t=e;return!Rn(t.id)||!Rn(t.node)||!Rn(t.kind)||!Rn(t.status)||!uz(t.durationMs)||!lz(t.ok)||!Nr(t.startedAt)||!Nr(t.completedAt)?null:{id:t.id,node:t.node,kind:t.kind,status:t.status,durationMs:t.durationMs,ok:t.ok,resultSummary:t.resultSummary,startedAt:t.startedAt,completedAt:t.completedAt}}function mz(e){if(e===null||typeof e!="object")return null;const t=e,n=Jg(t.run);if(!n||!Array.isArray(t.phases)||!Array.isArray(t.transitions)||!Array.isArray(t.actions))return null;const r=[];for(const s of t.phases){const o=dz(s);o&&r.push(o)}const a=[];for(const s of t.transitions){const o=pz(s);o&&a.push(o)}const i=[];for(const s of t.actions){const o=fz(s);o&&i.push(o)}return{run:n,phases:r,transitions:a,actions:i}}function hz(e){const t=Array.isArray(e)?e:e!==null&&typeof e=="object"&&Array.isArray(e.links)?e.links:null;if(!t)return null;const n=[];for(const r of t){if(r===null||typeof r!="object")continue;const a=r;!Rn(a.runId)||!Rn(a.kind)||!Rn(a.linkedAt)||n.push({runId:a.runId,kind:a.kind,linkedAt:a.linkedAt,run:Jg(a.run)})}return n}const gz=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rs(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=gz[t.getMonth()],r=t.getDate(),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${n} ${r} ${a}:${i}:${s}`}function bz(e){const t=e.toLowerCase();return t==="completed"||t==="done"||t==="succeeded"?"success":t==="failed"||t==="error"||t==="cancelled"?"error":t==="running"||t==="active"||t==="processing"?"info":t==="paused"||t==="pending"||t==="waiting"?"warning":"neutral"}function By(e){const t=e.toLowerCase();return t==="completed"||t==="failed"||t==="skipped"||t==="cancelled"}function Ez(e){const t=e.toLowerCase();return t==="failed"||t==="error"||t==="cancelled"}function yz(e){if(e==null)return null;if(typeof e=="string")return e.length>0?e:null;if(typeof e=="object"){const t=e,n=t.error??t.message??t.reason??t.summary;if(typeof n=="string"&&n.length>0)return n}return null}const xz=50;function Tz(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,i]=g.useState(null),[s,o]=g.useState(new Map);g.useEffect(()=>{const l=new AbortController;return(async()=>{try{const p=`${et()}/runs?limit=${xz}`,d=`${et()}/events/history?prefix=task&limit=50`,f=`${et()}/events/history?prefix=feature&limit=50`,[m,b,E]=await Promise.all([Ke(new Request(p,{signal:l.signal})),Ke(new Request(d,{signal:l.signal})),Ke(new Request(f,{signal:l.signal}))]);if(!m.ok)throw new Error(`runs fetch failed: ${m.status}`);const y=cz(await m.json());if(!y)throw new Error("runs response failed schema validation");const x=[];if(b.ok){const T=ei(await b.json());T&&x.push(...T.events)}if(E.ok){const T=ei(await E.json());T&&x.push(...T.events)}const w=new Map;try{const T=`${et()}/runs/by-wbs/`,I=await Ke(new Request(`${et()}/tasks?limit=200`,{signal:l.signal}));if(I.ok){const R=await I.json();if(R!==null&&typeof R=="object"){const v=R,A=v.items??v.tasks??v.data;if(Array.isArray(A))for(const N of A){if(N===null||typeof N!="object")continue;const F=N.wbs;if(typeof F=="string")try{const _=await Ke(new Request(`${T}${F}`,{signal:l.signal}));if(!_.ok)continue;const M=hz(await _.json());if(!M)continue;for(const j of M)w.set(j.runId,F)}catch{}}}}}catch{}t({runs:y.runs,hasMore:y.hasMore,nextCursor:y.nextCursor,wbsIndex:w,corpusEvents:x})}catch(p){if(l.signal.aborted)return;r(p instanceof Error?p.message:String(p))}})(),()=>l.abort()},[]);const u=g.useCallback(l=>{if(a===l){i(null);return}i(l),!s.get(l)&&(o(d=>{const f=new Map(d);return f.set(l,{detail:null,error:null,loading:!0}),f}),(async()=>{try{const d=await Ke(new Request(`${et()}/runs/${l}`));if(!d.ok){const b=(await d.json().catch(()=>null))?.error??`run detail fetch failed: ${d.status}`;o(E=>{const y=new Map(E);return y.set(l,{detail:null,error:typeof b=="string"?b:String(b),loading:!1}),y});return}const f=mz(await d.json());if(!f){o(m=>{const b=new Map(m);return b.set(l,{detail:null,error:"run detail failed schema validation",loading:!1}),b});return}o(m=>{const b=new Map(m);return b.set(l,{detail:f,error:null,loading:!1}),b})}catch(d){o(f=>{const m=new Map(f);return m.set(l,{detail:null,error:d instanceof Error?d.message:String(d),loading:!1}),m})}})())},[a,s]);return n?c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load runs: ",n]}):e===null?c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading runs…"]}):c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-tasks-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Pipeline Runs"}),c.jsxs("span",{className:"ml-2 text-xs text-spur-text-muted",children:[e.runs.length," run(s)"]})]}),e.runs.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-tasks-empty":!0,children:"No pipeline runs yet."}):c.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:e.runs.map(l=>{const p=e.wbsIndex.get(l.id),d=a===l.id?s.get(l.id):void 0;return c.jsx(Sz,{run:l,wbs:p,expanded:a===l.id,detailState:d,onToggle:u},l.id)})}),e.corpusEvents.length>0&&c.jsxs("div",{className:"border-t-2 border-dashed border-spur-border bg-base-300/50 shrink-0 max-h-64 overflow-y-auto","data-corpus-lane":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border sticky top-0 bg-base-300/90 backdrop-blur",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Corpus Activity"}),c.jsx(st,{variant:"outline",size:"xs",className:"ml-2",children:"corpus-only"}),c.jsxs("span",{className:"ml-2 text-xs text-spur-text-muted",children:[e.corpusEvents.length," event(s)"]})]}),c.jsx("ul",{className:"p-2 space-y-1",children:e.corpusEvents.map(l=>c.jsx(vz,{evt:l},l.id))})]})]})}function Sz({run:e,wbs:t,expanded:n,detailState:r,onToggle:a}){return c.jsx("li",{children:c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-2 gap-1",children:[c.jsxs("button",{type:"button",onClick:()=>a(e.id),className:"w-full text-left flex items-center gap-2 flex-wrap cursor-pointer","aria-expanded":n,children:[c.jsx("span",{className:"text-[10px] text-spur-text-muted",children:n?"▼":"▶"}),t!==void 0?c.jsx(st,{variant:"info",size:"xs",children:t}):c.jsx(st,{variant:"neutral",size:"xs",children:"unlinked"}),c.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:e.workflowName??"unknown"}),c.jsx(st,{variant:bz(e.status),size:"xs",children:e.status}),e.mode&&c.jsx(st,{variant:"outline",size:"xs",children:e.mode}),e.agent&&c.jsx("span",{className:"text-[10px] text-spur-text-muted",children:e.agent}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:rs(e.startedAt)})]}),n&&r&&c.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-spur-border",children:[r.loading&&c.jsxs("div",{className:"flex items-center gap-2 text-xs text-spur-text-muted py-2",children:[c.jsx(Tr,{size:"xs"})," Loading run detail…"]}),r.error&&c.jsxs("div",{className:"text-xs text-error py-2",role:"alert",children:["Failed to load run detail: ",r.error]}),r.detail&&c.jsx(Az,{detail:r.detail})]})]})})})}function Az({detail:e}){const t=g.useMemo(()=>{for(let n=e.phases.length-1;n>=0;n--){const r=e.phases[n];if(r&&!By(r.status))return n}return-1},[e.phases]);return c.jsxs("div",{className:"space-y-3",children:[e.phases.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase text-spur-text-muted font-semibold mb-1",children:"Phases"}),c.jsx("ol",{className:"space-y-1",children:e.phases.map((n,r)=>{const a=r===t,i=Ez(n.status),s=By(n.status);return c.jsxs("li",{className:`text-[11px] flex items-center gap-2 ${i?"text-error":a?"text-info font-semibold":s?"text-spur-text-muted":"text-spur-text"}`,children:[c.jsx("span",{className:"font-mono",children:s?i?"✗":"✓":a?"●":"○"}),c.jsx("span",{children:n.phase}),c.jsx(st,{variant:i?"error":a?"info":s?"neutral":"warning",size:"xs",children:n.status}),n.startedAt&&c.jsx("span",{className:"text-[10px] text-spur-text-muted font-mono",children:rs(n.startedAt)}),n.completedAt&&n.startedAt&&c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:["→ ",rs(n.completedAt)]})]},`phase:${n.phase}`)})})]}),e.transitions.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase text-spur-text-muted font-semibold mb-1",children:"Transitions"}),c.jsx("div",{className:"flex items-center gap-1 flex-wrap text-[11px]",children:e.transitions.map((n,r)=>c.jsxs("span",{className:"flex items-center gap-1",children:[r>0&&c.jsx("span",{className:"text-spur-text-muted",children:"→"}),c.jsxs(st,{variant:"outline",size:"xs",children:[n.from," → ",n.to]})]},`tr:${n.from}->${n.to}`))})]}),e.actions.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase text-spur-text-muted font-semibold mb-1",children:"Action Log"}),c.jsx("ul",{className:"space-y-1","data-action-log":!0,children:e.actions.map(n=>{const r=lu(n.durationMs),a=n.ok===!1?yz(n.resultSummary):null;return c.jsxs("li",{className:"text-[11px] flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"font-mono text-spur-text",children:n.node}),c.jsx(st,{variant:"outline",size:"xs",children:n.kind}),c.jsx(st,{variant:n.ok===!1?"error":n.ok===!0?"success":"neutral",size:"xs",children:n.status}),r!==null&&c.jsx("span",{className:"text-spur-text-muted font-mono",children:r}),a!==null&&c.jsx("span",{className:"text-error truncate max-w-md",title:a,children:a}),n.startedAt&&c.jsx("span",{className:"text-[10px] text-spur-text-muted font-mono ml-auto",children:rs(n.startedAt)})]},n.id)})})]}),e.phases.length===0&&e.actions.length===0&&e.transitions.length===0&&c.jsx("div",{className:"text-xs text-spur-text-muted italic",children:"No phase or action detail available."})]})}function vz({evt:e}){const t=g.useMemo(()=>{if(!e.payload)return null;const n=e.payload.entity;if(n!==null&&typeof n=="object"){const a=n.id;if(typeof a=="string")return a}const r=e.payload.id??e.payload.wbs;return typeof r=="string"?r:null},[e.payload]);return c.jsxs("li",{className:"text-[11px] flex items-center gap-2 flex-wrap text-spur-text-muted",children:[c.jsx("span",{className:"font-mono text-[10px]",children:rs(e.occurredAt)}),c.jsx(st,{variant:"outline",size:"xs",children:e.eventName}),t!==null&&c.jsx("span",{className:"font-mono",children:t}),e.actor&&c.jsx("span",{className:"text-[10px]",children:e.actor})]})}const mc=new Set(["read","write","bash","grep","glob"]),wz=3e3,DA=200,Uy=(e=DA,t)=>{const n=`${et()}/observability/tool-use?limit=${e}`;return t?`${n}&before=${encodeURIComponent(t)}`:n},_z=()=>`${et()}/observability/tool-use/stream`;function Nz(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,i]=g.useState(null),[s,o]=g.useState(!0),[u,l]=g.useState("off"),[p,d]=g.useState(!1),f=g.useRef(0),m=g.useCallback((T,I)=>{const R=(T.events??[]).map((v,A)=>({...v,seq:typeof v.seq=="number"?v.seq:A,_key:`${I==="append"?T.nextBefore??"p":"head"}:${v.ts}:${v.session}:${v.type}:${v.file??""}:${v.summary??""}:${v.seq??A}`}));t(v=>{if(I==="replace"||!v)return R;const A=new Set(v.map(yo)),N=R.filter(F=>!A.has(yo(F)));return[...v,...N]}),r({path:T.path??"",truncated:T.truncated??!1,sparseToolActivity:T.sparseToolActivity??(R.length===0||!R.some(v=>mc.has(v.type))),nextBefore:T.nextBefore??null})},[]),b=g.useCallback(async T=>{try{const I=await Ke(new Request(Uy(),{signal:T}));if(!I.ok){let v=`tool-use fetch failed: ${I.status}`;try{const N=(await I.json()).error;N&&(v=N)}catch{}throw new Error(v)}const R=await I.json();m(R,"replace"),i(null)}catch(I){if(T.aborted)return;i(I instanceof Error?I.message:String(I))}},[m]);g.useEffect(()=>{const T=new AbortController;return b(T.signal),()=>T.abort()},[b]),g.useEffect(()=>{if(!s){l("off");return}if(typeof EventSource>"u"){l("polling");const I=new AbortController,R=setInterval(()=>{b(I.signal)},wz);return()=>{I.abort(),clearInterval(R)}}l("connecting");const T=new EventSource(_z());return T.onopen=()=>l("live"),T.onerror=()=>l("errored"),T.onmessage=I=>{try{const v=JSON.parse(I.data);if(v.type==="connected"){l("live");return}if(v.type!=="tool-use"||!v.event)return;const A=v.event;f.current-=1;const N={...A,seq:f.current,_key:`live:${f.current}:${A.ts}:${A.session}:${A.type}:${A.file??""}:${A.summary??""}`};t(F=>{const _=F??[];return _[0]&&yo(_[0])===yo(N)?_:[N,..._]}),r(F=>F&&{...F,sparseToolActivity:mc.has(N.type)?!1:F.sparseToolActivity})}catch{}},()=>{T.close(),l("off")}},[s,b]);const E=g.useCallback(async()=>{if(!(!n?.nextBefore||p)){d(!0);try{const T=await Ke(new Request(Uy(DA,n.nextBefore)));if(!T.ok)throw new Error(`load more failed: ${T.status}`);const I=await T.json();m(I,"append"),r(R=>R&&{...R,nextBefore:I.nextBefore??null,truncated:I.truncated??!1})}catch(T){i(T instanceof Error?T.message:String(T))}finally{d(!1)}}},[n?.nextBefore,p,m]);if(a&&!e)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load tool use: ",a]});if(e===null)return c.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[c.jsx(Tr,{size:"sm"})," Loading tool use…"]});const y=e.some(T=>T.agent),x=e.some(T=>T.model),w=n?.sparseToolActivity??(e.length===0||!e.some(T=>mc.has(T.type)));return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-tool-using-tab":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Tool Using"}),c.jsxs("span",{className:"text-xs text-spur-text-muted","data-event-count":!0,children:[e.length," event(s)",n?.nextBefore?" · more available":""]}),c.jsxs("label",{htmlFor:"live-toggle",className:"flex items-center gap-1.5 text-xs text-spur-text ml-2 cursor-pointer",children:[c.jsx(Lg,{id:"live-toggle",size:"xs",checked:s,onChange:T=>o(T.target.checked),"data-live-toggle":!0,"aria-label":"Live refresh"}),"Live"]}),c.jsx("span",{className:"text-[10px] text-spur-text-muted font-mono","data-sse-status":!0,children:kz(u)}),c.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono truncate max-w-[40%]",title:n?.path??"","data-ledger-path":!0,children:n?.path?OA(n.path):""})]}),a?c.jsxs("div",{className:"px-4 py-1 text-xs text-warning",role:"status",children:["Refresh warning: ",a]}):null,e.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-empty-state":!0,children:"No tool-use events yet. File tools are logged when agent hooks write token-ledger.jsonl (requires SessionStart + supported agent PostToolUse for Read/Write/Edit)."}):c.jsxs(c.Fragment,{children:[w?c.jsxs("div",{className:"px-4 py-2 text-xs text-spur-text-muted bg-base-200/60 border-b border-spur-border",role:"status","data-sparse-banner":!0,children:["Limited recent tool activity in this window (session markers only, or no read/write rows). Hooks record tools only for supported agents after SessionStart. Ledger: ",n?.path||"—"]}):null,c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsxs("table",{className:"table table-xs table-pin-rows w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-[10px] uppercase text-spur-text-muted",children:[c.jsx("th",{children:"Time"}),c.jsx("th",{children:"Type"}),c.jsx("th",{title:"File path or Bash/Grep/Glob summary",children:"Target"}),c.jsx("th",{children:"Action"}),c.jsx("th",{className:"text-right",children:"Tokens"}),c.jsx("th",{children:"Session"}),y?c.jsx("th",{children:"Agent"}):null,x?c.jsx("th",{children:"Model"}):null]})}),c.jsx("tbody",{children:e.map(T=>c.jsxs("tr",{className:"border-spur-border","data-event-seq":T.seq,children:[c.jsx("td",{className:"font-mono text-[10px] text-spur-text-muted whitespace-nowrap",children:Dz(T.ts)}),c.jsx("td",{children:c.jsx(Rz,{type:T.type})}),c.jsx("td",{className:"font-mono text-[10px] text-spur-text max-w-[16rem] truncate",title:Iz(T),children:Cz(T)}),c.jsx("td",{className:"text-xs text-spur-text-muted",children:T.action??"—"}),c.jsx("td",{className:"font-mono text-xs whitespace-nowrap text-right",children:Oz(T)}),c.jsx("td",{className:"font-mono text-[10px] text-spur-text-muted max-w-[8rem] truncate",title:T.sessionId??T.session,children:T.session}),y?c.jsx("td",{className:"text-[10px] text-spur-text-muted max-w-[6rem] truncate",children:T.agent??"—"}):null,x?c.jsx("td",{className:"text-[10px] text-spur-text-muted max-w-[8rem] truncate",children:T.model??"—"}):null]},T._key??`${T.seq}-${T.ts}`))})]})}),n?.nextBefore?c.jsx("div",{className:"px-4 py-2 border-t border-spur-border shrink-0 flex justify-center",children:c.jsx(He,{variant:"ghost",size:"xs",onClick:()=>{E()},disabled:p,"data-load-more":!0,children:p?"Loading…":"Load older events"})}):null]})]})}function yo(e){return[e.ts,e.session,e.type,e.file??"",e.summary??"",e.action??"",String(e.tokens??"")].join("|")}function Cz(e){return e.summary?e.summary:e.file?OA(e.file):"—"}function Iz(e){return e.summary&&e.file?`${e.summary}
175
175
  ${e.file}`:e.summary??e.file??""}function kz(e){switch(e){case"live":return"sse:live";case"connecting":return"sse:connecting";case"errored":return"sse:retry";case"polling":return"poll";default:return""}}function Rz({type:e}){const t=e==="session_start"?"secondary":e==="session_end"?"ghost":e==="write"?"warning":e==="read"?"primary":e==="bash"?"accent":e==="grep"||e==="glob"?"info":"ghost";return c.jsx(st,{variant:t,size:"xs",children:e})}function Dz(e){try{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return e}}function Oz(e){return e.type==="session_end"&&e.totals?`r${e.totals.reads}/w${e.totals.writes}/t${jy(e.totals.tokens)}`:e.tokens!=null&&Number.isFinite(e.tokens)?jy(e.tokens):"—"}function jy(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)}function OA(e){const t=e.split(/[/\\]/);return t[t.length-1]||e}const hc=[{id:"system-events",label:"System Events",component:$$},{id:"jobs",label:"Jobs",component:Q$},{id:"tasks",label:"Tasks",component:Tz},{id:"tool-using",label:"Tool Using",component:Nz},{id:"routing",label:"Routing",component:oz}];function Lz(){const[e,t]=g.useState(hc[0]?.id??""),r=hc.find(a=>a.id===e)?.component;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-observability-shell":!0,children:[c.jsx("div",{role:"tablist","aria-label":"Observability tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-base-200 shrink-0",children:hc.map(a=>{const i=a.id===e;return c.jsx("button",{type:"button",role:"tab","aria-selected":i,"aria-controls":`observability-tab-panel-${a.id}`,id:`observability-tab-${a.id}`,onClick:()=>t(a.id),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${i?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-base-300"}`,children:a.label},a.id)})}),c.jsx("div",{role:"tabpanel",id:`observability-tab-panel-${e}`,"aria-labelledby":`observability-tab-${e}`,className:"flex-1 overflow-hidden",children:r?c.jsx(r,{}):null})]})}const Fz={id:"observability",name:"Observability",icon:"🛰️",route:"observability",component:Lz,sidebarLabel:"Observability",order:0},Mz=Object.freeze(Object.defineProperty({__proto__:null,module:Fz},Symbol.toStringTag,{value:"Module"})),cl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function eb(e){return"nodeType"in e}function On(e){var t,n;return e?yi(e)?e:eb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function tb(e){const{Document:t}=On(e);return e instanceof t}function Ws(e){return yi(e)?!1:e instanceof On(e).HTMLElement}function LA(e){return e instanceof On(e).SVGElement}function xi(e){return e?yi(e)?e.document:eb(e)?tb(e)?e:Ws(e)||LA(e)?e.ownerDocument:document:document:document}const Rr=cl?g.useLayoutEffect:g.useEffect;function dl(e){const t=g.useRef(e);return Rr(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function Pz(){const e=g.useRef(null),t=g.useCallback((r,a)=>{e.current=setInterval(r,a)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ss(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Rr(()=>{n.current!==e&&(n.current=e)},t),n}function Vs(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function du(e){const t=dl(e),n=g.useRef(null),r=g.useCallback(a=>{a!==n.current&&t?.(a,n.current),n.current=a},[]);return[n,r]}function pu(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let gc={};function pl(e,t){return g.useMemo(()=>{if(t)return t;const n=gc[e]==null?0:gc[e]+1;return gc[e]=n,e+"-"+n},[e,t])}function FA(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>{const o=Object.entries(s);for(const[u,l]of o){const p=i[u];p!=null&&(i[u]=p+e*l)}return i},{...t})}}const Va=FA(1),fu=FA(-1);function Bz(e){return"clientX"in e&&"clientY"in e}function nb(e){if(!e)return!1;const{KeyboardEvent:t}=On(e.target);return t&&e instanceof t}function Uz(e){if(!e)return!1;const{TouchEvent:t}=On(e.target);return t&&e instanceof t}function mu(e){if(Uz(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Bz(e)?{x:e.clientX,y:e.clientY}:null}const ti=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ti.Translate.toString(e),ti.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),$y="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function jz(e){return e.matches($y)?e:e.querySelector($y)}const $z={display:"none"};function zz(e){let{id:t,value:n}=e;return We.createElement("div",{id:t,style:$z},n)}function Hz(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return We.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function Gz(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const MA=g.createContext(null);function Wz(e){const t=g.useContext(MA);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Vz(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:a,event:i}=r;e.forEach(s=>{var o;return(o=s[a])==null?void 0:o.call(s,i)})},[e]),t]}const qz={draggable:`
176
176
  To pick up a draggable item, press the space bar.
177
177
  While dragging, use the arrow keys to move the item.
178
178
  Press space again to drop the item in its new position, or press escape to cancel.
179
- `},Yz={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Zz(e){let{announcements:t=Yz,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=qz}=e;const{announce:i,announcement:s}=Gz(),o=pl("DndLiveRegion"),[u,l]=g.useState(!1);if(g.useEffect(()=>{l(!0)},[]),Wz(g.useMemo(()=>({onDragStart(d){let{active:f}=d;i(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:m}=d;t.onDragMove&&i(t.onDragMove({active:f,over:m}))},onDragOver(d){let{active:f,over:m}=d;i(t.onDragOver({active:f,over:m}))},onDragEnd(d){let{active:f,over:m}=d;i(t.onDragEnd({active:f,over:m}))},onDragCancel(d){let{active:f,over:m}=d;i(t.onDragCancel({active:f,over:m}))}}),[i,t])),!u)return null;const p=We.createElement(We.Fragment,null,We.createElement(zz,{id:r,value:a.draggable}),We.createElement(Hz,{id:o,announcement:s}));return n?Ua.createPortal(p,n):p}var en;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function hu(){}function zy(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Kz(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ir=Object.freeze({x:0,y:0});function Xz(e,t){const n=mu(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Qz(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Jz(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function eH(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=a-r,o=i-n;if(r<a&&n<i){const u=t.width*t.height,l=e.width*e.height,p=s*o,d=p/(u+l-p);return Number(d.toFixed(4))}return 0}const tH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const i of r){const{id:s}=i,o=n.get(s);if(o){const u=eH(o,t);u>0&&a.push({id:s,data:{droppableContainer:i,value:u}})}}return a.sort(Qz)};function nH(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function PA(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ir}function rH(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return a.reduce((s,o)=>({...s,top:s.top+e*o.y,bottom:s.bottom+e*o.y,left:s.left+e*o.x,right:s.right+e*o.x}),{...n})}}const aH=rH(1);function BA(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function iH(e,t,n){const r=BA(t);if(!r)return e;const{scaleX:a,scaleY:i,x:s,y:o}=r,u=e.left-s-(1-a)*parseFloat(n),l=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),p=a?e.width/a:e.width,d=i?e.height/i:e.height;return{width:p,height:d,top:l,right:u+p,bottom:l+d,left:u}}const sH={ignoreTransform:!1};function qs(e,t){t===void 0&&(t=sH);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:l,transformOrigin:p}=On(e).getComputedStyle(e);l&&(n=iH(n,l,p))}const{top:r,left:a,width:i,height:s,bottom:o,right:u}=n;return{top:r,left:a,width:i,height:s,bottom:o,right:u}}function Hy(e){return qs(e,{ignoreTransform:!0})}function oH(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function uH(e,t){return t===void 0&&(t=On(e).getComputedStyle(e)),t.position==="fixed"}function lH(e,t){t===void 0&&(t=On(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const i=t[a];return typeof i=="string"?n.test(i):!1})}function rb(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(tb(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Ws(a)||LA(a)||n.includes(a))return n;const i=On(e).getComputedStyle(a);return a!==e&&lH(a,i)&&n.push(a),uH(a,i)?n:r(a.parentNode)}return e?r(e):n}function UA(e){const[t]=rb(e,1);return t??null}function bc(e){return!cl||!e?null:yi(e)?e:eb(e)?tb(e)||e===xi(e).scrollingElement?window:Ws(e)?e:null:null}function jA(e){return yi(e)?e.scrollX:e.scrollLeft}function $A(e){return yi(e)?e.scrollY:e.scrollTop}function od(e){return{x:jA(e),y:$A(e)}}var ln;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ln||(ln={}));function zA(e){return!cl||!e?!1:e===document.scrollingElement}function HA(e){const t={x:0,y:0},n=zA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,o=e.scrollLeft>=r.x;return{isTop:a,isLeft:i,isBottom:s,isRight:o,maxScroll:r,minScroll:t}}const cH={x:.2,y:.2};function dH(e,t,n,r,a){let{top:i,left:s,right:o,bottom:u}=n;r===void 0&&(r=10),a===void 0&&(a=cH);const{isTop:l,isBottom:p,isLeft:d,isRight:f}=HA(e),m={x:0,y:0},b={x:0,y:0},E={height:t.height*a.y,width:t.width*a.x};return!l&&i<=t.top+E.height?(m.y=ln.Backward,b.y=r*Math.abs((t.top+E.height-i)/E.height)):!p&&u>=t.bottom-E.height&&(m.y=ln.Forward,b.y=r*Math.abs((t.bottom-E.height-u)/E.height)),!f&&o>=t.right-E.width?(m.x=ln.Forward,b.x=r*Math.abs((t.right-E.width-o)/E.width)):!d&&s<=t.left+E.width&&(m.x=ln.Backward,b.x=r*Math.abs((t.left+E.width-s)/E.width)),{direction:m,speed:b}}function pH(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function GA(e){return e.reduce((t,n)=>Va(t,od(n)),ir)}function fH(e){return e.reduce((t,n)=>t+jA(n),0)}function mH(e){return e.reduce((t,n)=>t+$A(n),0)}function WA(e,t){if(t===void 0&&(t=qs),!e)return;const{top:n,left:r,bottom:a,right:i}=t(e);UA(e)&&(a<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const hH=[["x",["left","right"],fH],["y",["top","bottom"],mH]];class ab{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=rb(n),a=GA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,o]of hH)for(const u of s)Object.defineProperty(this,u,{get:()=>{const l=o(r),p=a[i]-l;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class as{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function gH(e){const{EventTarget:t}=On(e);return e instanceof t?e:xi(e)}function Ec(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Kn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Kn||(Kn={}));function Gy(e){e.preventDefault()}function bH(e){e.stopPropagation()}var Ct;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ct||(Ct={}));const VA={start:[Ct.Space,Ct.Enter],cancel:[Ct.Esc],end:[Ct.Space,Ct.Enter,Ct.Tab]},EH=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ct.Right:return{...n,x:n.x+25};case Ct.Left:return{...n,x:n.x-25};case Ct.Down:return{...n,y:n.y+25};case Ct.Up:return{...n,y:n.y-25}}};class ib{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new as(xi(n)),this.windowListeners=new as(On(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Kn.Resize,this.handleCancel),this.windowListeners.add(Kn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Kn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&WA(r),n(ir)}handleKeyDown(t){if(nb(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:i=VA,coordinateGetter:s=EH,scrollBehavior:o="smooth"}=a,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:l}=r.current,p=l?{x:l.left,y:l.top}:ir;this.referenceCoordinates||(this.referenceCoordinates=p);const d=s(t,{active:n,context:r.current,currentCoordinates:p});if(d){const f=fu(d,p),m={x:0,y:0},{scrollableAncestors:b}=r.current;for(const E of b){const y=t.code,{isTop:x,isRight:w,isLeft:T,isBottom:I,maxScroll:R,minScroll:v}=HA(E),A=pH(E),N={x:Math.min(y===Ct.Right?A.right-A.width/2:A.right,Math.max(y===Ct.Right?A.left:A.left+A.width/2,d.x)),y:Math.min(y===Ct.Down?A.bottom-A.height/2:A.bottom,Math.max(y===Ct.Down?A.top:A.top+A.height/2,d.y))},F=y===Ct.Right&&!w||y===Ct.Left&&!T,_=y===Ct.Down&&!I||y===Ct.Up&&!x;if(F&&N.x!==d.x){const M=E.scrollLeft+f.x,j=y===Ct.Right&&M<=R.x||y===Ct.Left&&M>=v.x;if(j&&!f.y){E.scrollTo({left:M,behavior:o});return}j?m.x=E.scrollLeft-M:m.x=y===Ct.Right?E.scrollLeft-R.x:E.scrollLeft-v.x,m.x&&E.scrollBy({left:-m.x,behavior:o});break}else if(_&&N.y!==d.y){const M=E.scrollTop+f.y,j=y===Ct.Down&&M<=R.y||y===Ct.Up&&M>=v.y;if(j&&!f.x){E.scrollTo({top:M,behavior:o});return}j?m.y=E.scrollTop-M:m.y=y===Ct.Down?E.scrollTop-R.y:E.scrollTop-v.y,m.y&&E.scrollBy({top:-m.y,behavior:o});break}}this.handleMove(t,Va(fu(d,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ib.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=VA,onActivation:a}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const o=i.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function Wy(e){return!!(e&&"distance"in e)}function Vy(e){return!!(e&&"delay"in e)}class sb{constructor(t,n,r){var a;r===void 0&&(r=gH(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=xi(s),this.documentListeners=new as(this.document),this.listeners=new as(r),this.windowListeners=new as(On(s)),this.initialCoordinates=(a=mu(i))!=null?a:ir,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Kn.Resize,this.handleCancel),this.windowListeners.add(Kn.DragStart,Gy),this.windowListeners.add(Kn.VisibilityChange,this.handleCancel),this.windowListeners.add(Kn.ContextMenu,Gy),this.documentListeners.add(Kn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vy(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Wy(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Kn.Click,bH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Kn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:i}=this,{onMove:s,options:{activationConstraint:o}}=i;if(!a)return;const u=(n=mu(t))!=null?n:ir,l=fu(a,u);if(!r&&o){if(Wy(o)){if(o.tolerance!=null&&Ec(l,o.tolerance))return this.handleCancel();if(Ec(l,o.distance))return this.handleStart()}if(Vy(o)&&Ec(l,o.tolerance))return this.handleCancel();this.handlePending(o,l);return}t.cancelable&&t.preventDefault(),s(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ct.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const yH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ob extends sb{constructor(t){const{event:n}=t,r=xi(n.target);super(t,yH,r)}}ob.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const xH={move:{name:"mousemove"},end:{name:"mouseup"}};var ud;(function(e){e[e.RightClick=2]="RightClick"})(ud||(ud={}));class TH extends sb{constructor(t){super(t,xH,xi(t.event.target))}}TH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ud.RightClick?!1:(r?.({event:n}),!0)}}];const yc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class SH extends sb{constructor(t){super(t,yc)}static setup(){return window.addEventListener(yc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(yc.move.name,t)};function t(){}}}SH.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var is;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(is||(is={}));var gu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(gu||(gu={}));function AH(e){let{acceleration:t,activator:n=is.Pointer,canScroll:r,draggingRect:a,enabled:i,interval:s=5,order:o=gu.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:p,delta:d,threshold:f}=e;const m=wH({delta:d,disabled:!i}),[b,E]=Pz(),y=g.useRef({x:0,y:0}),x=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case is.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case is.DraggableRect:return a}},[n,a,u]),T=g.useRef(null),I=g.useCallback(()=>{const v=T.current;if(!v)return;const A=y.current.x*x.current.x,N=y.current.y*x.current.y;v.scrollBy(A,N)},[]),R=g.useMemo(()=>o===gu.TreeOrder?[...l].reverse():l,[o,l]);g.useEffect(()=>{if(!i||!l.length||!w){E();return}for(const v of R){if(r?.(v)===!1)continue;const A=l.indexOf(v),N=p[A];if(!N)continue;const{direction:F,speed:_}=dH(v,N,w,t,f);for(const M of["x","y"])m[M][F[M]]||(_[M]=0,F[M]=0);if(_.x>0||_.y>0){E(),T.current=v,b(I,s),y.current=_,x.current=F;return}}y.current={x:0,y:0},x.current={x:0,y:0},E()},[t,I,r,E,i,s,JSON.stringify(w),JSON.stringify(m),b,l,R,p,JSON.stringify(f)])}const vH={x:{[ln.Backward]:!1,[ln.Forward]:!1},y:{[ln.Backward]:!1,[ln.Forward]:!1}};function wH(e){let{delta:t,disabled:n}=e;const r=pu(t);return Vs(a=>{if(n||!r||!a)return vH;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ln.Backward]:a.x[ln.Backward]||i.x===-1,[ln.Forward]:a.x[ln.Forward]||i.x===1},y:{[ln.Backward]:a.y[ln.Backward]||i.y===-1,[ln.Forward]:a.y[ln.Forward]||i.y===1}}},[n,t,r])}function _H(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Vs(a=>{var i;return t==null?null:(i=r??a)!=null?i:null},[r,t])}function NH(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,i=a.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var As;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(As||(As={}));var ld;(function(e){e.Optimized="optimized"})(ld||(ld={}));const qy=new Map;function CH(e,t){let{dragging:n,dependencies:r,config:a}=t;const[i,s]=g.useState(null),{frequency:o,measure:u,strategy:l}=a,p=g.useRef(e),d=y(),f=Ss(d),m=g.useCallback(function(x){x===void 0&&(x=[]),!f.current&&s(w=>w===null?x:w.concat(x.filter(T=>!w.includes(T))))},[f]),b=g.useRef(null),E=Vs(x=>{if(d&&!n)return qy;if(!x||x===qy||p.current!==e||i!=null){const w=new Map;for(let T of e){if(!T)continue;if(i&&i.length>0&&!i.includes(T.id)&&T.rect.current){w.set(T.id,T.rect.current);continue}const I=T.node.current,R=I?new ab(u(I),I):null;T.rect.current=R,R&&w.set(T.id,R)}return w}return x},[e,i,n,d,u]);return g.useEffect(()=>{p.current=e},[e]),g.useEffect(()=>{d||m()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},o))},[o,d,m,...r]),{droppableRects:E,measureDroppableContainers:m,measuringScheduled:i!=null};function y(){switch(l){case As.Always:return!1;case As.BeforeDragging:return n;default:return!n}}}function ub(e,t){return Vs(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function IH(e,t){return ub(e,t)}function kH(e){let{callback:t,disabled:n}=e;const r=dl(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function fl(e){let{callback:t,disabled:n}=e;const r=dl(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function RH(e){return new ab(qs(e),e)}function Yy(e,t,n){t===void 0&&(t=RH);const[r,a]=g.useState(null);function i(){a(u=>{if(!e)return null;if(e.isConnected===!1){var l;return(l=u??n)!=null?l:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const s=kH({callback(u){if(e)for(const l of u){const{type:p,target:d}=l;if(p==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),o=fl({callback:i});return Rr(()=>{i(),e?(o?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),s?.disconnect())},[e]),r}function DH(e){const t=ub(e);return PA(e,t)}const Zy=[];function OH(e){const t=g.useRef(e),n=Vs(r=>e?r&&r!==Zy&&e&&t.current&&e.parentNode===t.current.parentNode?r:rb(e):Zy,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function LH(e){const[t,n]=g.useState(null),r=g.useRef(e),a=g.useCallback(i=>{const s=bc(i.target);s&&n(o=>o?(o.set(s,od(s)),new Map(o)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const o=e.map(u=>{const l=bc(u);return l?(l.addEventListener("scroll",a,{passive:!0}),[l,od(l)]):null}).filter(u=>u!=null);n(o.length?new Map(o):null),r.current=e}return()=>{s(e),s(i)};function s(o){o.forEach(u=>{const l=bc(u);l?.removeEventListener("scroll",a)})}},[a,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Va(i,s),ir):GA(e):ir,[e,t])}function Ky(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==ir;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?fu(e,n.current):ir}function FH(e){g.useEffect(()=>{if(!cl)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function MH(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:i}=r;return n[a]=s=>{i(s,t)},n},{}),[e,t])}function qA(e){return g.useMemo(()=>e?oH(e):null,[e])}const Xy=[];function PH(e,t){t===void 0&&(t=qs);const[n]=e,r=qA(n?On(n):null),[a,i]=g.useState(Xy);function s(){i(()=>e.length?e.map(u=>zA(u)?r:new ab(t(u),u)):Xy)}const o=fl({callback:s});return Rr(()=>{o?.disconnect(),s(),e.forEach(u=>o?.observe(u))},[e]),a}function YA(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ws(t)?t:e}function BH(e){let{measure:t}=e;const[n,r]=g.useState(null),a=g.useCallback(l=>{for(const{target:p}of l)if(Ws(p)){r(d=>{const f=t(p);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),i=fl({callback:a}),s=g.useCallback(l=>{const p=YA(l);i?.disconnect(),p&&i?.observe(p),r(p?t(p):null)},[t,i]),[o,u]=du(s);return g.useMemo(()=>({nodeRef:o,rect:n,setRef:u}),[n,o,u])}const UH=[{sensor:ob,options:{}},{sensor:ib,options:{}}],jH={current:{}},Fo={draggable:{measure:Hy},droppable:{measure:Hy,strategy:As.WhileDragging,frequency:ld.Optimized},dragOverlay:{measure:qs}};class ss extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const $H={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ss,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:hu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Fo,measureDroppableContainers:hu,windowRect:null,measuringScheduled:!1},ZA={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:hu,draggableNodes:new Map,over:null,measureDroppableContainers:hu},Ys=g.createContext(ZA),KA=g.createContext($H);function zH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ss}}}function HH(e,t){switch(t.type){case en.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new ss(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case en.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new ss(e.droppable.containers);return s.set(n,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:s}}}case en.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new ss(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function GH(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=g.useContext(Ys),i=pu(r),s=pu(n?.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!nb(i)||document.activeElement===i.target)return;const o=a.get(s);if(!o)return;const{activatorNode:u,node:l}=o;if(!u.current&&!l.current)return;requestAnimationFrame(()=>{for(const p of[u.current,l.current]){if(!p)continue;const d=jz(p);if(d){d.focus();break}}})}},[r,t,a,s,i]),null}function XA(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,i)=>i({transform:a,...r}),n):n}function WH(e){return g.useMemo(()=>({draggable:{...Fo.draggable,...e?.draggable},droppable:{...Fo.droppable,...e?.droppable},dragOverlay:{...Fo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function VH(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const i=g.useRef(!1),{x:s,y:o}=typeof a=="boolean"?{x:a,y:a}:a;Rr(()=>{if(!s&&!o||!t){i.current=!1;return}if(i.current||!r)return;const l=t?.node.current;if(!l||l.isConnected===!1)return;const p=n(l),d=PA(p,r);if(s||(d.x=0),o||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=UA(l);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,o,r,n])}const ml=g.createContext({...ir,scaleX:1,scaleY:1});var zr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(zr||(zr={}));const qH=g.memo(function(t){var n,r,a,i;let{id:s,accessibility:o,autoScroll:u=!0,children:l,sensors:p=UH,collisionDetection:d=tH,measuring:f,modifiers:m,...b}=t;const E=g.useReducer(HH,void 0,zH),[y,x]=E,[w,T]=Vz(),[I,R]=g.useState(zr.Uninitialized),v=I===zr.Initialized,{draggable:{active:A,nodes:N,translate:F},droppable:{containers:_}}=y,M=A!=null?N.get(A):null,j=g.useRef({initial:null,translated:null}),H=g.useMemo(()=>{var U;return A!=null?{id:A,data:(U=M?.data)!=null?U:jH,rect:j}:null},[A,M]),Z=g.useRef(null),[V,ie]=g.useState(null),[X,re]=g.useState(null),ue=Ss(b,Object.values(b)),k=pl("DndDescribedBy",s),Y=g.useMemo(()=>_.getEnabled(),[_]),le=WH(f),{droppableRects:D,measureDroppableContainers:ke,measuringScheduled:Le}=CH(Y,{dragging:v,dependencies:[F.x,F.y],config:le.droppable}),ve=_H(N,A),Ue=g.useMemo(()=>X?mu(X):null,[X]),Ee=Wt(),he=IH(ve,le.draggable.measure);VH({activeNode:A!=null?N.get(A):null,config:Ee.layoutShiftCompensation,initialRect:he,measure:le.draggable.measure});const ct=Yy(ve,le.draggable.measure,he),$e=Yy(ve?ve.parentElement:null),ge=g.useRef({activatorEvent:null,active:null,activeNode:ve,collisionRect:null,collisions:null,droppableRects:D,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Pe=_.getNodeFor((n=ge.current.over)==null?void 0:n.id),pt=BH({measure:le.dragOverlay.measure}),de=(r=pt.nodeRef.current)!=null?r:ve,rt=v?(a=pt.rect)!=null?a:ct:null,Ot=!!(pt.nodeRef.current&&pt.rect),ft=DH(Ot?null:ct),kt=qA(de?On(de):null),wt=OH(v?Pe??ve:null),zt=PH(wt),nn=XA(m,{transform:{x:F.x-ft.x,y:F.y-ft.y,scaleX:1,scaleY:1},activatorEvent:X,active:H,activeNodeRect:ct,containerNodeRect:$e,draggingNodeRect:rt,over:ge.current.over,overlayNodeRect:pt.rect,scrollableAncestors:wt,scrollableAncestorRects:zt,windowRect:kt}),ut=Ue?Va(Ue,F):null,Ae=LH(wt),Ye=Ky(Ae),q=Ky(Ae,[ct]),te=Va(nn,Ye),ye=rt?aH(rt,nn):null,we=H&&ye?d({active:H,collisionRect:ye,droppableRects:D,droppableContainers:Y,pointerCoordinates:ut}):null,je=Jz(we,"id"),[Ze,_t]=g.useState(null),St=Ot?nn:Va(nn,q),Et=nH(St,(i=Ze?.rect)!=null?i:null,ct),Nt=g.useRef(null),J=g.useCallback((U,Te)=>{let{sensor:Ne,options:ze}=Te;if(Z.current==null)return;const Xe=N.get(Z.current);if(!Xe)return;const Ve=U.nativeEvent,At=new Ne({active:Z.current,activeNode:Xe,event:Ve,options:ze,context:ge,onAbort(Rt){if(!N.get(Rt))return;const{onDragAbort:P}=ue.current,$={id:Rt};P?.($),w({type:"onDragAbort",event:$})},onPending(Rt,Vt,P,$){if(!N.get(Rt))return;const{onDragPending:ee}=ue.current,se={id:Rt,constraint:Vt,initialCoordinates:P,offset:$};ee?.(se),w({type:"onDragPending",event:se})},onStart(Rt){const Vt=Z.current;if(Vt==null)return;const P=N.get(Vt);if(!P)return;const{onDragStart:$}=ue.current,G={activatorEvent:Ve,active:{id:Vt,data:P.data,rect:j}};Ua.unstable_batchedUpdates(()=>{$?.(G),R(zr.Initializing),x({type:en.DragStart,initialCoordinates:Rt,active:Vt}),w({type:"onDragStart",event:G}),ie(Nt.current),re(Ve)})},onMove(Rt){x({type:en.DragMove,coordinates:Rt})},onEnd:rn(en.DragEnd),onCancel:rn(en.DragCancel)});Nt.current=At;function rn(Rt){return async function(){const{active:P,collisions:$,over:G,scrollAdjustedTranslate:ee}=ge.current;let se=null;if(P&&ee){const{cancelDrop:Se}=ue.current;se={activatorEvent:Ve,active:P,collisions:$,delta:ee,over:G},Rt===en.DragEnd&&typeof Se=="function"&&await Promise.resolve(Se(se))&&(Rt=en.DragCancel)}Z.current=null,Ua.unstable_batchedUpdates(()=>{x({type:Rt}),R(zr.Uninitialized),_t(null),ie(null),re(null),Nt.current=null;const Se=Rt===en.DragEnd?"onDragEnd":"onDragCancel";if(se){const xe=ue.current[Se];xe?.(se),w({type:Se,event:se})}})}}},[N]),be=g.useCallback((U,Te)=>(Ne,ze)=>{const Xe=Ne.nativeEvent,Ve=N.get(ze);if(Z.current!==null||!Ve||Xe.dndKit||Xe.defaultPrevented)return;const At={active:Ve};U(Ne,Te.options,At)===!0&&(Xe.dndKit={capturedBy:Te.sensor},Z.current=ze,J(Ne,Te))},[N,J]),Fe=NH(p,be);FH(p),Rr(()=>{ct&&I===zr.Initializing&&R(zr.Initialized)},[ct,I]),g.useEffect(()=>{const{onDragMove:U}=ue.current,{active:Te,activatorEvent:Ne,collisions:ze,over:Xe}=ge.current;if(!Te||!Ne)return;const Ve={active:Te,activatorEvent:Ne,collisions:ze,delta:{x:te.x,y:te.y},over:Xe};Ua.unstable_batchedUpdates(()=>{U?.(Ve),w({type:"onDragMove",event:Ve})})},[te.x,te.y]),g.useEffect(()=>{const{active:U,activatorEvent:Te,collisions:Ne,droppableContainers:ze,scrollAdjustedTranslate:Xe}=ge.current;if(!U||Z.current==null||!Te||!Xe)return;const{onDragOver:Ve}=ue.current,At=ze.get(je),rn=At&&At.rect.current?{id:At.id,rect:At.rect.current,data:At.data,disabled:At.disabled}:null,Rt={active:U,activatorEvent:Te,collisions:Ne,delta:{x:Xe.x,y:Xe.y},over:rn};Ua.unstable_batchedUpdates(()=>{_t(rn),Ve?.(Rt),w({type:"onDragOver",event:Rt})})},[je]),Rr(()=>{ge.current={activatorEvent:X,active:H,activeNode:ve,collisionRect:ye,collisions:we,droppableRects:D,draggableNodes:N,draggingNode:de,draggingNodeRect:rt,droppableContainers:_,over:Ze,scrollableAncestors:wt,scrollAdjustedTranslate:te},j.current={initial:rt,translated:ye}},[H,ve,we,ye,N,de,rt,D,_,Ze,wt,te]),AH({...Ee,delta:F,draggingRect:ye,pointerCoordinates:ut,scrollableAncestors:wt,scrollableAncestorRects:zt});const Re=g.useMemo(()=>({active:H,activeNode:ve,activeNodeRect:ct,activatorEvent:X,collisions:we,containerNodeRect:$e,dragOverlay:pt,draggableNodes:N,droppableContainers:_,droppableRects:D,over:Ze,measureDroppableContainers:ke,scrollableAncestors:wt,scrollableAncestorRects:zt,measuringConfiguration:le,measuringScheduled:Le,windowRect:kt}),[H,ve,ct,X,we,$e,pt,N,_,D,Ze,ke,wt,zt,le,Le,kt]),xt=g.useMemo(()=>({activatorEvent:X,activators:Fe,active:H,activeNodeRect:ct,ariaDescribedById:{draggable:k},dispatch:x,draggableNodes:N,over:Ze,measureDroppableContainers:ke}),[X,Fe,H,ct,x,k,N,Ze,ke]);return We.createElement(MA.Provider,{value:T},We.createElement(Ys.Provider,{value:xt},We.createElement(KA.Provider,{value:Re},We.createElement(ml.Provider,{value:Et},l)),We.createElement(GH,{disabled:o?.restoreFocus===!1})),We.createElement(Zz,{...o,hiddenTextDescribedById:k}));function Wt(){const U=V?.autoScrollEnabled===!1,Te=typeof u=="object"?u.enabled===!1:u===!1,Ne=v&&!U&&!Te;return typeof u=="object"?{...u,enabled:Ne}:{enabled:Ne}}}),YH=g.createContext(null),Qy="button",ZH="Draggable";function KH(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const i=pl(ZH),{activators:s,activatorEvent:o,active:u,activeNodeRect:l,ariaDescribedById:p,draggableNodes:d,over:f}=g.useContext(Ys),{role:m=Qy,roleDescription:b="draggable",tabIndex:E=0}=a??{},y=u?.id===t,x=g.useContext(y?ml:YH),[w,T]=du(),[I,R]=du(),v=MH(s,t),A=Ss(n);Rr(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:I,data:A}),()=>{const F=d.get(t);F&&F.key===i&&d.delete(t)}),[d,t]);const N=g.useMemo(()=>({role:m,tabIndex:E,"aria-disabled":r,"aria-pressed":y&&m===Qy?!0:void 0,"aria-roledescription":b,"aria-describedby":p.draggable}),[r,m,E,y,b,p.draggable]);return{active:u,activatorEvent:o,activeNodeRect:l,attributes:N,isDragging:y,listeners:r?void 0:v,node:w,over:f,setNodeRef:T,setActivatorNodeRef:R,transform:x}}function XH(){return g.useContext(KA)}const QH="Droppable",JH={timeout:25};function eG(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const i=pl(QH),{active:s,dispatch:o,over:u,measureDroppableContainers:l}=g.useContext(Ys),p=g.useRef({disabled:n}),d=g.useRef(!1),f=g.useRef(null),m=g.useRef(null),{disabled:b,updateMeasurementsFor:E,timeout:y}={...JH,...a},x=Ss(E??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{l(Array.isArray(x.current)?x.current:[x.current]),m.current=null},y)},[y]),T=fl({callback:w,disabled:b||!s}),I=g.useCallback((N,F)=>{T&&(F&&(T.unobserve(F),d.current=!1),N&&T.observe(N))},[T]),[R,v]=du(I),A=Ss(t);return g.useEffect(()=>{!T||!R.current||(T.disconnect(),d.current=!1,T.observe(R.current))},[R,T]),g.useEffect(()=>(o({type:en.RegisterDroppable,element:{id:r,key:i,disabled:n,node:R,rect:f,data:A}}),()=>o({type:en.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==p.current.disabled&&(o({type:en.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,o]),{active:s,rect:f,isOver:u?.id===r,node:R,over:u,setNodeRef:v}}function tG(e){let{animation:t,children:n}=e;const[r,a]=g.useState(null),[i,s]=g.useState(null),o=pu(n);return!n&&!r&&o&&a(o),Rr(()=>{if(!i)return;const u=r?.key,l=r?.props.id;if(u==null||l==null){a(null);return}Promise.resolve(t(l,i)).then(()=>{a(null)})},[t,r,i]),We.createElement(We.Fragment,null,n,r?g.cloneElement(r,{ref:s}):null)}const nG={x:0,y:0,scaleX:1,scaleY:1};function rG(e){let{children:t}=e;return We.createElement(Ys.Provider,{value:ZA},We.createElement(ml.Provider,{value:nG},t))}const aG={position:"fixed",touchAction:"none"},iG=e=>nb(e)?"transform 250ms ease":void 0,sG=g.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:i,className:s,rect:o,style:u,transform:l,transition:p=iG}=e;if(!o)return null;const d=a?l:{...l,scaleX:1,scaleY:1},f={...aG,width:o.width,height:o.height,top:o.top,left:o.left,transform:ti.Transform.toString(d),transformOrigin:a&&r?Xz(r,o):void 0,transition:typeof p=="function"?p(r):p,...u};return We.createElement(n,{className:s,style:f,ref:t},i)}),oG=e=>t=>{let{active:n,dragOverlay:r}=t;const a={},{styles:i,className:s}=e;if(i!=null&&i.active)for(const[o,u]of Object.entries(i.active))u!==void 0&&(a[o]=n.node.style.getPropertyValue(o),n.node.style.setProperty(o,u));if(i!=null&&i.dragOverlay)for(const[o,u]of Object.entries(i.dragOverlay))u!==void 0&&r.node.style.setProperty(o,u);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[u,l]of Object.entries(a))n.node.style.setProperty(u,l);s!=null&&s.active&&n.node.classList.remove(s.active)}},uG=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ti.Transform.toString(t)},{transform:ti.Transform.toString(n)}]},lG={duration:250,easing:"ease",keyframes:uG,sideEffects:oG({styles:{active:{opacity:"0"}}})};function cG(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:a}=e;return dl((i,s)=>{if(t===null)return;const o=n.get(i);if(!o)return;const u=o.node.current;if(!u)return;const l=YA(s);if(!l)return;const{transform:p}=On(s).getComputedStyle(s),d=BA(p);if(!d)return;const f=typeof t=="function"?t:dG(t);return WA(u,a.draggable.measure),f({active:{id:i,data:o.data,node:u,rect:a.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:s,rect:a.dragOverlay.measure(l)},droppableContainers:r,measuringConfiguration:a,transform:d})})}function dG(e){const{duration:t,easing:n,sideEffects:r,keyframes:a}={...lG,...e};return i=>{let{active:s,dragOverlay:o,transform:u,...l}=i;if(!t)return;const p={x:o.rect.left-s.rect.left,y:o.rect.top-s.rect.top},d={scaleX:u.scaleX!==1?s.rect.width*u.scaleX/o.rect.width:1,scaleY:u.scaleY!==1?s.rect.height*u.scaleY/o.rect.height:1},f={x:u.x-p.x,y:u.y-p.y,...d},m=a({...l,active:s,dragOverlay:o,transform:{initial:u,final:f}}),[b]=m,E=m[m.length-1];if(JSON.stringify(b)===JSON.stringify(E))return;const y=r?.({active:s,dragOverlay:o,...l}),x=o.node.animate(m,{duration:t,easing:n,fill:"forwards"});return new Promise(w=>{x.onfinish=()=>{y?.(),w()}})}}let Jy=0;function pG(e){return g.useMemo(()=>{if(e!=null)return Jy++,Jy},[e])}const fG=We.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:i,modifiers:s,wrapperElement:o="div",className:u,zIndex:l=999}=e;const{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggableNodes:b,droppableContainers:E,dragOverlay:y,over:x,measuringConfiguration:w,scrollableAncestors:T,scrollableAncestorRects:I,windowRect:R}=XH(),v=g.useContext(ml),A=pG(d?.id),N=XA(s,{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggingNodeRect:y.rect,over:x,overlayNodeRect:y.rect,scrollableAncestors:T,scrollableAncestorRects:I,transform:v,windowRect:R}),F=ub(f),_=cG({config:r,draggableNodes:b,droppableContainers:E,measuringConfiguration:w}),M=F?y.setRef:void 0;return We.createElement(rG,null,We.createElement(tG,{animation:_},d&&A?We.createElement(sG,{key:A,id:d.id,ref:M,as:o,activatorEvent:p,adjustScale:t,className:u,transition:i,rect:F,style:{zIndex:l,...a},transform:N},n):null))}),mG=6e4;function hG(e,t){const n=new Date(e).getTime(),r=t-n,a=Math.floor(r/1e3);if(a<60)return"just now";const i=Math.floor(a/60);if(i<60)return`${i}m ago`;const s=Math.floor(i/60);if(s<24)return`${s}h ago`;const o=Math.floor(s/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function QA({task:e,onClick:t}){const{attributes:n,listeners:r,setNodeRef:a,transform:i,isDragging:s}=KH({id:e.wbs,data:{task:e}}),[o,u]=g.useState(Date.now());g.useEffect(()=>{const p=setInterval(()=>u(Date.now()),mG);return()=>clearInterval(p)},[]);const l=i?{transform:ti.Transform.toString(i),zIndex:s?50:void 0}:void 0;return c.jsx(mi,{variant:"compact",asChild:!0,className:`bg-spur-surface-2 hover:bg-spur-surface-3 rounded-xl border border-spur-border cursor-pointer transition-colors w-full text-left ${s?"opacity-30":""}`,children:c.jsx("button",{ref:a,type:"button",style:l,onClick:()=>t(e.wbs),...r,...n,"aria-roledescription":"draggable card",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-xs font-mono text-spur-text-muted",children:e.wbs}),e.priority&&c.jsx(st,{variant:"outline",size:"xs",children:e.priority})]}),c.jsx("p",{className:"text-sm font-medium text-spur-text leading-snug",children:e.name}),c.jsxs("div",{className:"flex gap-1 flex-wrap items-center",children:[e.type&&e.type!=="task"&&c.jsx(st,{variant:"outline",size:"xs",children:e.type}),e.featureId&&c.jsx(st,{variant:"outline",size:"xs",children:e.featureId}),e.updatedAt&&c.jsx("span",{className:"text-xs font-mono text-spur-text-muted ml-auto",title:e.updatedAt,children:hG(e.updatedAt,o)})]})]})})})}function gG({status:e,label:t,tasks:n,onCardClick:r,sortDir:a,onSortToggle:i}){const{setNodeRef:s,isOver:o}=eG({id:e,data:{status:e}});return c.jsxs("section",{ref:s,"aria-label":`${t} column`,className:`flex flex-col flex-1 min-w-[16rem] rounded-xl border transition-colors duration-200 ${o?"bg-spur-surface-2 border-spur-accent shadow-lg":"bg-spur-surface border-spur-border"}`,children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border shrink-0",children:[c.jsxs("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:[Yg(e)," ",t]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(st,{variant:"ghost",size:"sm",children:n.length}),i&&c.jsx(He,{variant:"ghost",size:"xs",className:"px-1",onClick:i,"aria-label":`Sort ${t} by WBS`,title:`Sort ${t}: ${a==="asc"?"WBS ↓":a==="desc"?"WBS ↑":"none"}`,children:a==="asc"?"↓":a==="desc"?"↑":"⇅"})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-[4rem]",children:[n.map(u=>c.jsx(QA,{task:u,onClick:r},u.wbs)),n.length===0&&c.jsx("div",{className:"flex items-center justify-center h-16 text-xs text-spur-text-muted italic",children:"No tasks"})]})]})}const bG=[{key:"feature",field:"featureId",label:"Filter by feature",placeholder:"Feature"},{key:"parent",field:"parentWbs",label:"Filter by parent WBS",placeholder:"Parent WBS"},{key:"assignee",field:"assignee",label:"Filter by assignee",placeholder:"Assignee"}];function EG({filters:e,onChange:t}){const n=r=>{t(r.currentTarget.dataset.key,r.currentTarget.value||null)};return c.jsx("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2 border-b border-spur-border",children:bG.map(r=>c.jsx(gs,{"aria-label":r.label,"data-key":r.key,type:"text",placeholder:r.placeholder,variant:"bordered",size:"xs",className:"w-28",value:e[r.field]??"",onChange:n},r.key))})}const yG=g.lazy(()=>dA(()=>import("./TaskDetail.CVBuD6dF.js"),__vite__mapDeps([2,1]))),ex=va,tx="docs/tasks",nx="spur:detail-width";function xG(e,t){return t?e.filter(n=>!(t.status&&n.status!==t.status||t.featureId&&n.featureId!==t.featureId||t.parentWbs&&n.parentWbs!==t.parentWbs)):e}function TG({onSelectTask:e,filters:t,onFilterChange:n}){const[r,a]=g.useState({}),[i,s]=g.useState(new Set(["blocked","cancelled"])),[o,u]=g.useState(tx),[l,p]=g.useState([{path:tx,label:"Primary"}]),[d,f]=g.useState(null),[m,b]=g.useState(()=>{const Y=typeof window<"u"?Math.min(1728,window.innerWidth*.8):1728;if(typeof window>"u")return Y;try{const le=Number.parseFloat(window.localStorage.getItem(nx)??"");if(Number.isFinite(le)&&le>0)return Math.min(le,window.innerWidth*.8)}catch{}return Y}),E=g.useCallback(()=>_r.task.list({folder:o}),[o]),{tasks:y,loading:x,error:w,connected:T,setTasks:I}=bA(E),[R,v]=g.useState(!1),[A,N]=g.useState(null);g.useEffect(()=>{typeof _r.task.folders=="function"&&_r.task.folders({}).then(Y=>{const{data:le,activeFolder:D}=Y,ke=D??le?.[0]?.path;le&&ke!==void 0&&(p(le),u(ke))}).catch(()=>{})},[]),g.useEffect(()=>{document.documentElement.style.setProperty("--detail-w",`${m}px`)},[m]),g.useEffect(()=>{if(!d)return;const Y=le=>{le.key==="Escape"&&f(null)};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[d]);const F=tr();g.useEffect(()=>{const Y=F.pathname.split("/"),le=Y.indexOf("tasks"),D=le>=0?Y[le+1]:void 0;D&&/^\d{4}$/.test(D)&&f(D)},[F.pathname]);const _=zy(ob,{activationConstraint:{distance:5}}),M=zy(ib),j=Kz(_,M),H=async()=>{try{const Y=await E();I(Y.data??[])}catch{}},Z=xG(y,t),V=Y=>{a(le=>{const D={...le};return le[Y]==="asc"?D[Y]="desc":le[Y]==="desc"?delete D[Y]:D[Y]="asc",D})},ie=Y=>{s(le=>{const D=new Set(le);return D.has(Y)?D.delete(Y):D.add(Y),D})},X=Y=>{const le=Z.filter(ke=>ke.status===Y),D=r[Y]??"desc";return[...le].sort((ke,Le)=>{const ve=ke.wbs.localeCompare(Le.wbs);return D==="asc"?ve:-ve})},re=Y=>y.find(le=>le.wbs===Y),ue=Y=>{N(String(Y.active.id))},k=Y=>{N(null);const{active:le,over:D}=Y;if(!D)return;const ke=String(le.id),Le=String(D.id),ve=re(ke);if(!ve||ve.status===Le)return;const Ue=[...y];I(Ee=>Ee.map(he=>he.wbs===ke?{...he,status:Le}:he)),_r.task.transition({wbs:ke,toStatus:Le}).catch(Ee=>{I(Ue);const he=Ee instanceof Error?Ee.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:he}}))})};return x?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(Tr,{size:"lg",className:"text-spur-accent"})}):w?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center text-spur-text-muted",children:[c.jsx("p",{className:"text-lg font-semibold",children:"Failed to load tasks"}),c.jsx("p",{className:"text-sm",children:w.message})]})}):c.jsxs(qH,{sensors:j,onDragStart:ue,onDragEnd:k,children:[c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 pb-1 shrink-0",children:[n&&c.jsx(EG,{filters:t??{},onChange:n}),c.jsxs("div",{className:"flex items-center gap-1.5",title:T?"Live updates active":"Polling (stream disconnected)",children:[c.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${T?"bg-spur-success":"bg-spur-error"}`}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:T?"Live":"Polling"})]}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"|"}),c.jsx(Zr,{variant:"ghost",size:"xs",className:"text-xs",value:o,onChange:Y=>u(Y.target.value),"aria-label":"Task folder",children:l.map(Y=>c.jsx("option",{value:Y.path,children:Y.label?`${Y.label} (${Y.path})`:Y.path},Y.path))}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"|"}),c.jsx("div",{className:"flex-1"}),ex.map(Y=>c.jsxs("label",{htmlFor:`kanban-col-toggle-${Y}`,className:"flex items-center gap-1 cursor-pointer",children:[c.jsx(Lg,{id:`kanban-col-toggle-${Y}`,size:"xs",checked:!i.has(Y),onChange:()=>ie(Y)}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[Yg(Y)," ",Y]})]},Y)),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"|"}),c.jsx(He,{variant:"primary",size:"sm",onClick:()=>v(!0),children:"+ New Task"})]}),c.jsx("div",{className:"flex gap-3 overflow-x-auto h-full p-4",children:ex.filter(Y=>!i.has(Y)).map(Y=>c.jsx(gG,{status:Y,label:Y,tasks:X(Y),onCardClick:le=>{f(le),e(le)},sortDir:r[Y],onSortToggle:()=>V(Y)},Y))}),c.jsx(hA,{open:R,onClose:()=>v(!1),onCreated:H,folder:o}),d&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","aria-label":"Close task detail",className:"fixed inset-0 z-50 bg-black/40 border-0 p-0 cursor-default",onClick:()=>f(null)}),c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Task detail",className:"fixed top-0 right-0 h-full z-50 bg-spur-surface border-l border-spur-border shadow-2xl flex",style:{width:"var(--detail-w)",minWidth:"36rem",maxWidth:"80vw"},children:[c.jsx(iu,{targetVar:"--detail-w",onResizeEnd:Y=>{const le=Math.max(576,Math.min(Y,window.innerWidth*.8));b(le);try{window.localStorage.setItem(nx,String(le))}catch{}},direction:"horizontal",invert:!0}),c.jsx("div",{className:"flex flex-col flex-1 overflow-hidden",children:c.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"detail-body",children:(()=>{const Y=y.find(le=>le.wbs===d);return Y?c.jsx(g.Suspense,{fallback:c.jsx("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:"Loading detail..."}),children:c.jsx(yG,{task:Y,onClose:()=>f(null),onTransition:(le,D)=>{I(ke=>ke.map(Le=>Le.wbs===le?{...Le,status:D}:Le)),_r.task.transition({wbs:le,toStatus:D}).catch(ke=>{const Le=ke instanceof Error?ke.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Le}}))})}})}):null})()})})]})]})]}),c.jsx(fG,{dropAnimation:null,children:A?(()=>{const Y=re(A);return Y?c.jsx("div",{className:"opacity-90",children:c.jsx(QA,{task:Y,onClick:()=>{}})}):null})():null})]})}function SG(){const[e,t]=P_(),n=tr(),r=Su(),a=g.useMemo(()=>{const u=n.pathname.split("/"),l=u.indexOf("tasks"),p=l>=0?u[l+1]:void 0;return p&&/^\d{4}$/.test(p)?p:e.get("selected")},[n.pathname,e]),i=g.useMemo(()=>{const u={},l=e.get("status"),p=e.get("feature"),d=e.get("parent"),f=e.get("assignee");return l&&(u.status=l),p&&(u.featureId=p),d&&(u.parentWbs=d),f&&(u.assignee=f),u},[e]);return{selected:a,filters:i,selectTask:u=>{const l=new URLSearchParams(e);l.delete("selected");const p=l.toString(),d=u?`/board/tasks/${u}`:"/board/tasks";r(`${d}${p?`?${p}`:""}`,{replace:!0})},setFilter:(u,l)=>{t(p=>{const d=new URLSearchParams(p);return l?d.set(u,l):d.delete(u),d},{replace:!0})}}}function AG(e,t){_r.task.transition({wbs:e,toStatus:t}).catch(n=>{const r=n instanceof Error?n.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:r}}))})}function lb(){const{filters:e,selectTask:t,setFilter:n}=SG();return c.jsx("div",{className:"task-kanban flex flex-col h-full",children:c.jsx("div",{"data-kanban-board":!0,className:"flex-1 overflow-hidden",children:c.jsx(TG,{onSelectTask:t,filters:e,onFilterChange:n})})})}const vG={id:"tasks",name:"Tasks",icon:"📋",route:"tasks",component:lb},wG=Object.freeze(Object.defineProperty({__proto__:null,TaskKanbanView:lb,module:vG,transition:AG},Symbol.toStringTag,{value:"Module"}));function JA(e){const t=new Map;for(const n of e)for(const r of n.members)t.set(r.id,{teamId:n.teamId,memberLabel:r.id,agentType:r.type});return t}function ev(e,t){if(e.teamId&&e.memberLabel&&e.agentType)return e;const n=e.memberLabel??e.actor;if(!n)return e;const r=t.get(n);return r?{...e,teamId:e.teamId??r.teamId,memberLabel:e.memberLabel??r.memberLabel,agentType:e.agentType??r.agentType}:e}const cd=100;function tv(e,t){const n=[t,...e??[]];return n.length>cd&&(n.length=cd),n}const nv=()=>`${et()}/events/history?limit=${cd}`,rv=()=>`${et()}/events/planning`,_G=["agent.","message.","team.","supervisor.","process."];function NG(e){return _G.some(t=>e.startsWith(t))}function cb(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||typeof t.occurredAt!="string"||!NG(t.eventName))return null;const n=t.payload!==null&&typeof t.payload=="object"?t.payload:null,r=n&&typeof n.teamId=="string"&&n.teamId.length>0?n.teamId:void 0,a=n&&typeof n.agentType=="string"&&n.agentType.length>0?n.agentType:void 0,i=n&&typeof n.memberLabel=="string"&&n.memberLabel.length>0?n.memberLabel:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:void 0,s=typeof t.actor=="string"&&t.actor.length>0?t.actor:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:null;return{id:typeof t.id=="string"?t.id:`${t.eventName}-${t.occurredAt}`,eventName:t.eventName,occurredAt:t.occurredAt,actor:s,...r?{teamId:r}:{},...i?{memberLabel:i}:{},...a?{agentType:a}:{}}}function av(e){if(e===null||typeof e!="object"||!("events"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=[];for(const r of t){const a=cb(r);a&&n.push(a)}return n}function CG({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),{teams:i}=Ei(),s=g.useMemo(()=>JA(i),[i]),o=g.useCallback(async()=>{try{const l=await Ke(new Request(nv()));if(!l.ok)throw new Error(`events fetch failed: ${l.status}`);const p=av(await l.json());if(!p)throw new Error("events response failed schema validation");n(p)}catch(l){a(l instanceof Error?l.message:String(l))}},[]);g.useEffect(()=>{o()},[o]),g.useEffect(()=>{if(typeof EventSource>"u")return;const l=new EventSource(rv());return l.onmessage=p=>{try{const d=cb(JSON.parse(p.data));d&&n(f=>tv(f,d))}catch{}},()=>l.close()},[]);const u=g.useMemo(()=>t===null?null:t.map(l=>ev(l,s)).filter(l=>!e||l.teamId===e),[t,s,e]);return r?c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load activity: ",r]}):u===null?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading activity…"}):c.jsx("div",{className:"flex flex-col h-full overflow-y-auto","data-activity-tab":!0,children:u.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic",children:"No team activity yet."}):c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{className:"sticky top-0 bg-base-200",children:c.jsxs("tr",{className:"text-left text-spur-text-muted",children:[c.jsx("th",{className:"px-3 py-1 font-medium",children:"Time"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Event"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Team"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Member"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Agent"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Actor"})]})}),c.jsx("tbody",{children:u.map(l=>c.jsxs("tr",{className:"border-t border-spur-border","data-activity-row":l.eventName,children:[c.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:l.occurredAt}),c.jsx("td",{className:"px-3 py-1 text-spur-text",children:l.eventName}),c.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:l.teamId??"—"}),c.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:l.memberLabel??"—"}),c.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:l.agentType??"—"}),c.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:l.actor??"system"})]},l.id))})]})})}const IG=3e3,kG=()=>`${et()}/team/processes`;function RG(e,t){const n=e.map(i=>({key:`sup:${i.agentId}`,label:i.agentId,agentId:i.agentId,pid:i.pid,status:i.status,startedAt:i.startedAt,source:"supervisor",teamId:i.teamId??null})),r=new Set(e.map(i=>i.agentId)),a=new Set(e.map(i=>i.pid).filter(i=>i!=null));for(const i of t)i.agentId&&r.has(i.agentId)||i.pid!=null&&a.has(i.pid)||n.push({key:`reg:${i.id}`,label:i.label||i.command,agentId:i.agentId??void 0,pid:i.pid,status:i.status,startedAt:i.startedAt,source:i.source,teamId:i.teamId??null});return n}function DG(e,t){return e.filter(n=>{if(t.runningOnly&&n.status!=="running")return!1;if(t.source==="other"){if(n.source==="supervisor"||n.source==="one-shot")return!1}else if(t.source!=="all"&&n.source!==t.source)return!1;if(t.team==="unassigned"){if(n.teamId!=null)return!1}else if(t.team!=="all"&&n.teamId!==t.team)return!1;return!0})}function rx({filters:e,onFilters:t,teamIds:n,totalCount:r,shownCount:a}){return c.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-2 text-xs","data-processes-filters":!0,children:[c.jsxs("label",{className:"flex items-center gap-1","data-processes-filter-running":!0,children:[c.jsx("input",{type:"checkbox",checked:e.runningOnly,onChange:i=>t({...e,runningOnly:i.target.checked}),"data-processes-filter-running-input":!0}),c.jsx("span",{children:"Running only"})]}),c.jsxs("label",{className:"flex items-center gap-1",children:[c.jsx("span",{children:"Source"}),c.jsxs("select",{value:e.source,onChange:i=>t({...e,source:i.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-source":!0,"aria-label":"Source filter",children:[c.jsx("option",{value:"all",children:"all"}),c.jsx("option",{value:"supervisor",children:"supervisor"}),c.jsx("option",{value:"one-shot",children:"one-shot"}),c.jsx("option",{value:"other",children:"other"})]})]}),c.jsxs("label",{className:"flex items-center gap-1",children:[c.jsx("span",{children:"Team"}),c.jsxs("select",{value:e.team,onChange:i=>t({...e,team:i.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-team":!0,"aria-label":"Team filter",children:[c.jsx("option",{value:"all",children:"all teams"}),c.jsx("option",{value:"unassigned",children:"unassigned"}),n.map(i=>c.jsx("option",{value:i,children:i},i))]})]}),c.jsx("button",{type:"button",className:"border border-spur-border rounded px-2 py-0.5 text-spur-text hover:bg-base-200 transition-colors cursor-pointer",onClick:()=>t({runningOnly:!1,source:"all",team:"all"}),"data-processes-filter-clear":!0,children:"Clear"}),c.jsxs("span",{className:"text-spur-text-muted","data-processes-filter-count":!0,children:[a,"/",r," shown"]})]})}function OG({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),[i,s]=g.useState({runningOnly:!1,source:"all",team:"all"}),o=g.useRef(!0),u=g.useCallback(async b=>{try{const E=await Ke(new Request(kG(),{signal:b}));if(!E.ok)throw new Error(`processes fetch failed: ${E.status}`);const x=await E.json();o.current&&(n({processes:x.processes??[],count:x.count??0,executions:x.executions??[],executionsCount:x.executionsCount??0}),a(null))}catch(E){if(b.aborted)return;o.current&&a(E instanceof Error?E.message:String(E))}},[]);g.useEffect(()=>{o.current=!0;let b=null;const E=()=>{b?.abort(),b=new AbortController,u(b.signal)};E();const y=setInterval(E,IG);return()=>{o.current=!1,b?.abort(),clearInterval(y)}},[u]);const l=g.useMemo(()=>t?RG(t.processes,t.executions):[],[t]),p=g.useMemo(()=>{const b=e?l.filter(E=>E.teamId===e):l;return DG(b,i)},[l,i,e]),d=g.useMemo(()=>{const b=new Set;for(const E of t?.processes??[])E.teamId&&b.add(E.teamId);for(const E of t?.executions??[])E.teamId&&b.add(E.teamId);return[...b].sort()},[t]);if(r&&(!t||l.length===0))return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-processes-tab-error":!0,children:["Failed to load processes: ",r]});if(!t)return c.jsx("div",{className:"p-4","data-processes-tab-loading":!0,children:c.jsx(Tr,{size:"sm"})});if(l.length===0)return c.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-empty":!0,children:["No processes. Start a team agent from the Terminal tab or via"," ",c.jsx("code",{className:"font-mono",children:"spur team start"}),"."]});if(p.length===0)return c.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,"data-processes-tab-filtered-empty":!0,children:[c.jsx(rx,{filters:i,onFilters:s,teamIds:d,totalCount:l.length,shownCount:0}),c.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-no-matches":!0,children:"No processes match the current filters. Adjust or clear filters to see rows."})]});const f=t.processes.length,m=Math.max(0,l.length-f);return c.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,children:[c.jsx(rx,{filters:i,onFilters:s,teamIds:d,totalCount:l.length,shownCount:p.length}),c.jsxs("div",{className:"flex items-center gap-2 mb-2 text-xs text-spur-text-muted",children:[c.jsxs("span",{"data-processes-header":!0,children:["Process watch list (",l.length,f>0||m>0?` · ${f} supervised${m>0?` · ${m} other`:""}`:"",")"]}),c.jsx("span",{className:"italic",children:"— ProcessExecutor registry (ts-runtime)"})]}),c.jsxs("table",{className:"table table-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Name"}),c.jsx("th",{children:"Source"}),c.jsx("th",{children:"Team"}),c.jsx("th",{children:"PID"}),c.jsx("th",{children:"Status"}),c.jsx("th",{children:"Started"})]})}),c.jsx("tbody",{children:p.map(b=>{const E=b.status==="running";return c.jsxs("tr",{"data-processes-row":b.key,children:[c.jsx("td",{className:"font-mono text-xs",children:b.label}),c.jsx("td",{className:"text-xs text-spur-text-muted","data-process-source":b.source,children:b.source}),c.jsx("td",{className:"font-mono text-xs text-spur-text-muted","data-process-team":b.teamId??"",children:b.teamId??"—"}),c.jsx("td",{className:"font-mono text-xs text-spur-text-muted",children:b.pid??"—"}),c.jsx("td",{children:c.jsx(st,{variant:E?"success":"ghost",size:"xs",children:b.status})}),c.jsx("td",{className:"text-xs text-spur-text-muted",children:new Date(b.startedAt).toLocaleTimeString()})]},b.key)})})]})]})}const LG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/start`,FG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/stop`,MG=e=>`${et()}/team/${encodeURIComponent(e)}/up`,PG=e=>`${et()}/team/${encodeURIComponent(e)}/down`;function BG(e){if(e<0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),a=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:a>0?`${a}m ${i}s`:`${i}s`}function ax(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function UG(e){const t=new Map;for(const n of e){if(!n.teamId||!n.memberLabel)continue;const r=`${n.teamId}:${n.memberLabel}`;let a=t.get(r);a||(a={startedAt:null,lastActivity:null},t.set(r,a)),n.eventName==="team.member.started"&&(!a.startedAt||n.occurredAt>a.startedAt)&&(a.startedAt=n.occurredAt),(!a.lastActivity||n.occurredAt>a.lastActivity.time)&&(a.lastActivity={time:n.occurredAt,eventName:n.eventName})}return t}function jG({teamId:e}){const{teams:t,error:n,reload:r}=Ei(),[a,i]=g.useState(null),[s,o]=g.useState(null),[u,l]=g.useState(!1),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(null),[y,x]=g.useState(()=>Date.now()),w=g.useMemo(()=>e?t.filter(N=>N.teamId===e):t,[t,e]),T=g.useMemo(()=>JA(w),[w]);g.useEffect(()=>{let N=!1;return(async()=>{try{const F=await Ke(new Request(nv()));if(N)return;if(!F.ok)throw new Error(`events fetch failed: ${F.status}`);const _=av(await F.json());if(N)return;if(!_)throw new Error("events response failed schema validation");i(_)}catch(F){if(N)return;o(F instanceof Error?F.message:String(F))}})(),()=>{N=!0}},[]),g.useEffect(()=>{if(typeof EventSource>"u")return;const N=new EventSource(rv());return N.onmessage=F=>{try{const _=cb(JSON.parse(F.data));_&&i(M=>tv(M,_))}catch{}},()=>N.close()},[]),g.useEffect(()=>{const N=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(N)},[]);const I=g.useMemo(()=>a===null?null:a.map(N=>ev(N,T)).filter(N=>!e||N.teamId===e),[a,T,e]),R=g.useMemo(()=>I===null?new Map:UG(I),[I]),v=g.useCallback(async(N,F)=>{l(!0),d(null);try{const _=F?FG(N):LG(N),M=await Ke(new Request(_,{method:"POST"}));if(!M.ok){const j=await M.json().catch(()=>null),H=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${M.status})`;d(H)}}catch(_){d(_ instanceof Error?_.message:String(_))}finally{l(!1),r()}},[r]),A=g.useCallback(async(N,F)=>{l(!0),d(null);try{const _=F==="up"?MG(N):PG(N),M=await Ke(new Request(_,{method:"POST"}));if(!M.ok){const j=await M.json().catch(()=>null),H=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${M.status})`;d(H)}}catch(_){d(_ instanceof Error?_.message:String(_))}finally{l(!1),r()}},[r]);return c.jsxs("div",{className:"flex flex-col h-full overflow-y-auto","data-supervisor-tab":!0,children:[n&&w.length===0?c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-supervisor-tab-error":!0,children:["Failed to load teams: ",n,". Event-derived activity remains available below."]}):n&&c.jsxs("div",{className:"px-3 py-1 text-xs text-error bg-error/10 border-b border-error/30",role:"alert","data-supervisor-roster-error":!0,children:["Roster feed error: ",n,". Showing last-known state."]}),w.length===0&&!n&&c.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-supervisor-tab-loading":!0,children:"Loading teams…"}),p&&c.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-supervisor-action-error":!0,children:p}),s&&c.jsxs("div",{className:"px-3 py-1 text-xs text-warning",role:"alert","data-supervisor-event-error":!0,children:["Activity feed error: ",s,". Live updates may be delayed."]}),c.jsx("div",{className:"p-2 space-y-2",children:w.map(N=>c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:N.name}),c.jsx(st,{variant:"outline",size:"xs",children:N.teamId}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[N.members.length," member(s)"]}),c.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>{A(N.teamId,"up")},"data-supervisor-team-up":N.teamId,children:"Up"}),c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>E(N.teamId),"data-supervisor-team-down":N.teamId,children:"Down"})]})]}),N.members.length===0?c.jsx("div",{className:"text-xs text-spur-text-muted italic py-2","data-supervisor-empty-roster":N.teamId,children:"No members configured for this team."}):c.jsx("ul",{className:"space-y-1",children:N.members.map(F=>{const _=F.status==="running",M=`${N.teamId}:${F.id}`,j=R.get(M),H=_&&j?.startedAt?BG(y-Date.parse(j.startedAt)):"-",Z=j?.lastActivity??null;return c.jsxs("li",{className:"text-xs flex items-center gap-2 flex-wrap py-1 border-b border-spur-border/50 last:border-b-0","data-supervisor-member-row":F.id,children:[c.jsx(st,{variant:_?"success":"ghost",size:"xs",children:F.status}),c.jsx("span",{className:"font-mono text-spur-text",children:F.id}),c.jsx(st,{variant:"outline",size:"xs",children:F.type}),c.jsx(st,{variant:F.role!==void 0?"accent":"ghost",size:"xs","data-supervisor-member-role":F.id,children:F.role??"unset"}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted font-mono","data-supervisor-uptime":F.id,children:["up ",H]}),Z?c.jsxs("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":F.id,children:["last: ",ax(Z.time)," (",Z.eventName,")"]}):c.jsx("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":F.id,children:"last: -"}),c.jsx(He,{type:"button",variant:_?"ghost":"primary",size:"xs",disabled:u,className:"ml-auto",onClick:()=>{_?m(F.id):v(F.id,!1)},"data-supervisor-toggle":F.id,children:_?"Stop":"Start"})]},F.id)})})]})},N.teamId))}),I!==null&&c.jsxs("section",{className:"border-t border-spur-border bg-base-300/40","aria-label":"Recent team activity","data-supervisor-activity":!0,children:[c.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted",children:"Recent team activity"}),I.length===0?c.jsx("div",{className:"px-3 pb-3 text-xs text-spur-text-muted italic",children:"No team activity yet."}):c.jsx("ul",{className:"px-3 pb-3 space-y-1",children:I.slice(0,20).map(N=>c.jsxs("li",{className:"flex items-center gap-2 flex-wrap text-[10px] text-spur-text-muted","data-supervisor-activity-row":N.eventName,children:[c.jsx("span",{className:"font-mono",children:ax(N.occurredAt)}),c.jsx(st,{variant:"outline",size:"xs",children:N.eventName}),N.teamId&&c.jsx("span",{children:N.teamId}),N.memberLabel&&c.jsx("span",{className:"font-mono",children:N.memberLabel}),N.actor&&c.jsx("span",{children:N.actor})]},N.id))})]}),c.jsxs(Xo,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-stop-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",c.jsx("span",{className:"font-mono",children:f})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!f)return;const N=f;m(null),v(N,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),c.jsxs(Xo,{open:b!==null,variant:"warning",onClose:()=>E(null),"data-down-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",c.jsx("span",{className:"font-mono",children:b}),"."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(null),"data-down-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!b)return;const N=b;E(null),A(N,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const xo=1e3,xc=[1e3,2e3,4e3,8e3,15e3],$G=15e3;function zG(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.stream!="string"||typeof t.ts!="string"||typeof t.line!="string")return null;const n=t.stream;if(n!=="stdout"&&n!=="stderr"&&n!=="meta")return null;const r=t.seq;return r!==void 0&&typeof r!="number"?null:{stream:n,ts:t.ts,line:t.line,...r!==void 0?{seq:r}:{}}}function HG(e){return e<0?xc[0]:e>=xc.length?$G:xc[e]}function ix(e,t,n){if(t.seq===void 0){const a=[...e,t];return a.length>xo&&a.splice(0,a.length-xo),{frames:a,lastSeq:n}}if(t.seq<=n)return{frames:e,lastSeq:n};const r=[...e,t];return r.length>xo&&r.splice(0,r.length-xo),{frames:r,lastSeq:t.seq}}const GG=(e,t)=>t!==void 0?`${et()}/team/processes/${encodeURIComponent(e)}/stream?sinceSeq=${t}`:`${et()}/team/processes/${encodeURIComponent(e)}/stream`,WG=3e3;function VG(e){if(e===null||typeof e!="object")return null;const t=e;if(!Array.isArray(t.processes))return null;const n=[];for(const r of t.processes){if(r===null||typeof r!="object")return null;const a=r;if(typeof a.agentId!="string"||typeof a.status!="string"||typeof a.startedAt!="string"||typeof a.pid!="number")return null;const i=a.exitCode;if(i!==null&&typeof i!="number")return null;n.push({agentId:a.agentId,pid:a.pid,status:a.status,startedAt:a.startedAt,exitCode:i})}return n}const qG=e=>`${et()}/team/processes/${encodeURIComponent(e)}/stdin`,YG=()=>`${et()}/messages`,ZG=()=>`${et()}/team/processes`;function KG({agentId:e}){const[t,n]=g.useState([]),[r,a]=g.useState("unknown"),[i,s]=g.useState(""),[o,u]=g.useState(null),[l,p]=g.useState(!1),d=g.useRef(-1),f=g.useRef(null),m=g.useRef(void 0),b=g.useRef(0),E=g.useRef(!0),y=g.useRef(null),x=g.useCallback(async v=>{try{const A=await Ke(new Request(ZG(),{signal:v}));if(!A.ok)return;const N=await A.json(),F=VG(N);if(!F)return;const _=F.find(M=>M.agentId===e);_&&E.current&&a(_.status)}catch{}},[e]);g.useEffect(()=>{E.current=!0;let v=null;const A=()=>{v?.abort(),v=new AbortController,x(v.signal)};A();const N=setInterval(A,WG);return()=>{E.current=!1,v?.abort(),clearInterval(N)}},[x]);const w=g.useCallback(()=>{if(!E.current)return;const v=new EventSource(GG(e,d.current>-1?d.current:void 0));f.current=v,v.onmessage=A=>{try{const N=JSON.parse(A.data),F=zG(N);if(!F)return;n(_=>{const M=ix(_,F,d.current);return d.current=M.lastSeq,M.frames}),b.current=0,p(!0)}catch{}},v.onerror=()=>{if(v.close(),f.current=null,p(!1),!E.current)return;const A=HG(b.current);b.current+=1,m.current=setTimeout(w,A)}},[e]);g.useEffect(()=>(w(),()=>{E.current=!1,f.current?.close(),f.current=null,m.current&&clearTimeout(m.current)}),[w]),g.useEffect(()=>{y.current&&t.length>0&&(y.current.scrollTop=y.current.scrollHeight)},[t]);const T=g.useCallback(async()=>{const v=i;if(v.length===0)return;u(null);const A={stream:"meta",ts:new Date().toISOString(),line:`> ${v}`};n(N=>ix(N,A,d.current).frames);try{const N=await Ke(new Request(qG(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({line:v})}));if(Ke(new Request(YG(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"terminal",to:e,body:v})})).catch(()=>{}),!N.ok){const _=(await N.json().catch(()=>null))?.error??`stdin POST failed: ${N.status}`;u(_);return}s("")}catch(N){u(N instanceof Error?N.message:String(N))}},[e,i]),I=r==="running",R=v=>{v.key==="Enter"&&I&&(v.preventDefault(),T())};return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-member-terminal":e,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Terminal"}),c.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e}),c.jsx(st,{variant:I?"success":"ghost",size:"xs","data-terminal-status":!0,children:r}),c.jsx("span",{className:"text-[10px] text-spur-text-muted","data-terminal-connected":!0,children:l?"connected":"reconnecting…"})]}),!I&&c.jsxs("div",{className:"px-4 py-1 text-xs text-warning border-b border-spur-border",role:"status","data-status-banner":!0,children:["Member is ",r," — input disabled."]}),c.jsx("pre",{ref:y,className:"flex-1 overflow-y-auto p-2 text-xs font-mono leading-snug bg-base-100","data-terminal-output":!0,children:t.length===0?c.jsxs("span",{className:"text-spur-text-muted italic",children:["Waiting for output from ",e,"…"]}):t.map((v,A)=>c.jsx("div",{className:v.stream==="stderr"?"text-error":v.stream==="meta"?"text-spur-text-muted italic":"text-spur-text","data-stream":v.stream,children:v.line},v.seq??`meta-${A}`))}),o&&c.jsx("div",{className:"px-4 py-1 text-xs text-error border-t border-spur-border",role:"alert","data-input-error":!0,children:o}),c.jsx("div",{className:"flex items-center gap-2 px-2 py-2 border-t border-spur-border bg-base-200 shrink-0",children:c.jsx("input",{type:"text",value:i,onChange:v=>s(v.target.value),onKeyDown:R,disabled:!I,placeholder:I?"Type a line and press Enter…":"Input disabled (member not running)",className:"flex-1 input input-sm font-mono","data-terminal-input":!0})})]})}const XG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/start`,QG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/stop`,JG=e=>`${et()}/team/${encodeURIComponent(e)}/up`,eW=e=>`${et()}/team/${encodeURIComponent(e)}/down`,db="spur:board:teams:lastTerminal";function tW(){try{const e=globalThis.localStorage?.getItem(db);if(!e)return null;const t=JSON.parse(e);if(t&&typeof t=="object"&&"teamId"in t&&"memberId"in t&&typeof t.teamId=="string"&&typeof t.memberId=="string"){const n=t;return{teamId:n.teamId,memberId:n.memberId}}}catch{}return null}function nW(e){try{globalThis.localStorage?.setItem(db,JSON.stringify(e))}catch{}}function rW(){try{globalThis.localStorage?.removeItem(db)}catch{}}function aW({teamId:e}){const{teams:t,error:n,reload:r}=Ei(),[a,i]=g.useState(""),[s,o]=g.useState(""),[u,l]=g.useState(null),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(!1),[y]=g.useState({done:!1}),x=g.useMemo(()=>e?t.filter(F=>F.teamId===e):t,[t,e]),w=e??a;g.useEffect(()=>{if(y.done||x.length===0)return;y.done=!0;const F=tW();if(!F)return;const _=x.find(j=>j.teamId===F.teamId),M=_?.members.find(j=>j.id===F.memberId);if(!_||!M){rW();return}i(F.teamId),o(F.memberId)},[x,y]);const T=x.find(F=>F.teamId===w),I=T?.members.find(F=>F.id===s)??null;g.useEffect(()=>{s&&T&&!T.members.some(F=>F.id===s)&&o("")},[s,T]),g.useEffect(()=>{w&&s&&nW({teamId:w,memberId:s})},[w,s]);const R=g.useCallback(async(F,_)=>{E(!0);try{const M=_?QG(F):XG(F),j=await Ke(new Request(M,{method:"POST"}));if(!j.ok){const H=await j.json().catch(()=>null),Z=H&&typeof H=="object"&&"error"in H&&typeof H.error=="string"?H.error:`request failed (${j.status})`;l(Z)}}catch(M){l(M instanceof Error?M.message:String(M))}finally{E(!1),r()}},[r]),v=g.useCallback(async(F,_)=>{E(!0),l(null);try{const M=_==="up"?JG(F):eW(F),j=await Ke(new Request(M,{method:"POST"}));if(!j.ok){const H=await j.json().catch(()=>null),Z=H&&typeof H=="object"&&"error"in H&&typeof H.error=="string"?H.error:`request failed (${j.status})`;l(Z)}}catch(M){l(M instanceof Error?M.message:String(M))}finally{E(!1),r()}},[r]),A=g.useCallback(F=>{o(F)},[]);if(n&&x.length===0)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-terminal-tab-error":!0,children:["Failed to load teams: ",n]});if(x.length===0)return c.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-terminal-tab-empty":!0,children:["No teams defined in ",c.jsx("code",{className:"font-mono",children:".spur/config.yaml"}),". Configure"," ",c.jsx("code",{className:"font-mono",children:"agent.team"})," entries to open a terminal."]});const N=I?.status==="running";return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-terminal-tab":!0,children:[c.jsxs("div",{className:"px-3 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center justify-between","data-terminal-toolbar":!0,children:[c.jsxs("div",{className:"flex items-center gap-2","data-terminal-focus":!0,children:[c.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-team-select",children:[c.jsx("span",{className:"text-spur-text-muted",children:"Team"}),c.jsxs(Zr,{id:"terminal-team-select",variant:"bordered",size:"sm",disabled:!!e,value:w,onChange:F=>{i(F.target.value),o("")},"data-terminal-team-select":!0,children:[!e&&c.jsx("option",{value:"",children:"Select team…"}),x.map(F=>c.jsx("option",{value:F.teamId,children:F.name},F.teamId))]})]}),c.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-member-select",children:[c.jsx("span",{className:"text-spur-text-muted",children:"Member"}),c.jsxs(Zr,{id:"terminal-member-select",variant:"bordered",size:"sm",value:s,onChange:F=>o(F.target.value),disabled:!T,"data-terminal-member-select":!0,children:[c.jsx("option",{value:"",children:"Select member…"}),T?.members.map(F=>c.jsxs("option",{value:F.id,children:[F.id," · ",F.type]},F.id))]})]}),I?.model?c.jsx("span",{className:"text-xs text-spur-text-muted font-mono","data-terminal-model":!0,children:I.model}):null,I&&c.jsxs(c.Fragment,{children:[c.jsx(st,{variant:N?"success":"ghost",size:"xs","data-terminal-status-badge":!0,children:I.status}),c.jsx(He,{type:"button",variant:N?"warning":"primary",size:"xs",disabled:b,onClick:()=>{N?d(I.id):R(I.id,!1)},"data-terminal-toggle-btn":!0,children:N?"Stop":"Start"})]})]}),c.jsxs("div",{className:"flex items-center gap-2","data-terminal-roster":!0,children:[T?.members.map(F=>c.jsx("button",{type:"button",title:`${F.id} · ${F.type}`,onClick:()=>A(F.id),className:"cursor-pointer p-0 bg-transparent border-0","data-terminal-roster-chip":!0,children:c.jsx(st,{variant:F.id===s?"accent":F.status==="running"?"success":"ghost",size:"xs",children:F.id})},F.id)),c.jsx("div",{className:"border-l border-spur-border mx-1 h-5","aria-hidden":"true"}),c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:b||!T,onClick:()=>T&&v(T.teamId,"up"),"data-terminal-up-btn":!0,children:"Up"}),c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:b||!T,onClick:()=>T&&m(T.teamId),"data-terminal-down-btn":!0,children:"Down"})]})]}),u&&c.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-terminal-tab-action-error":!0,children:u}),s&&I?c.jsx(KG,{agentId:s}):c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-terminal-tab-prompt":!0,children:"Choose a team and member above to open a terminal."}),c.jsxs(Xo,{open:p!==null,variant:"warning",onClose:()=>d(null),"data-stop-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",c.jsx("span",{className:"font-mono",children:p})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!p)return;const F=p;d(null),R(F,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),c.jsxs(Xo,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-down-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",c.jsx("span",{className:"font-mono",children:f}),"."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-down-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!f)return;const F=f;m(null),v(F,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const sx=[{id:"supervisor",label:"Supervisor",component:jG},{id:"terminal",label:"Terminal",component:aW},{id:"processes",label:"Process",component:OG},{id:"activity",label:"Activity",component:CG}];function iv({teamId:e}){const[t,n]=g.useState("supervisor"),a=sx.find(i=>i.id===t)?.component;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-teams-shell":!0,children:[c.jsx("div",{role:"tablist","aria-label":"Teams tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-base-200 shrink-0",children:sx.map(i=>{const s=i.id===t;return c.jsx("button",{type:"button",role:"tab","aria-selected":s,"aria-controls":`teams-tab-panel-${i.id}`,id:`teams-tab-${i.id}`,onClick:()=>n(i.id),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${s?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-base-300"}`,children:i.label},i.id)})}),c.jsx("div",{role:"tabpanel",id:`teams-tab-panel-${t}`,"aria-labelledby":`teams-tab-${t}`,className:"flex-1 overflow-hidden",children:a?c.jsx(a,{teamId:e}):null})]})}const iW={id:"teams",name:"Teams",icon:"👥",route:"teams",component:iv,sidebarLabel:"Teams",order:2},sW=Object.freeze(Object.defineProperty({__proto__:null,module:iW},Symbol.toStringTag,{value:"Module"}));function oW(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function uW({teamId:e}){const{teams:t}=Ei(),n=e?t.find(r=>r.teamId===e):t.find(r=>r.isCurrentProject);return n?c.jsxs("div",{className:"flex flex-col h-full overflow-y-auto bg-spur-bg","data-workspace-overview":!0,children:[c.jsxs("div",{className:"px-4 py-3 border-b border-spur-border bg-spur-surface",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text","data-workspace-overview-name":!0,children:n.name}),c.jsx(st,{variant:"outline",size:"xs",children:n.teamId}),c.jsx(st,{variant:n.isCurrentProject?"success":"ghost",size:"xs",children:"current project"})]}),n.workDir&&c.jsx("div",{className:"mt-1 font-mono text-xs text-spur-text-muted","data-workspace-overview-workdir":!0,children:n.workDir})]}),c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted mb-2",children:"Members"}),n.members.length===0?c.jsx("div",{className:"text-xs text-spur-text-muted italic","data-workspace-overview-no-members":!0,children:"No members materialized for this team yet."}):c.jsx("ul",{className:"space-y-1",children:n.members.map(r=>c.jsxs("li",{className:"text-xs flex items-center gap-2 py-1 border-b border-spur-border/50 last:border-b-0","data-workspace-overview-member":r.id,children:[c.jsx(st,{variant:r.status==="running"?"success":"ghost",size:"xs",children:r.status}),c.jsx("span",{className:"font-mono text-spur-text",children:r.id}),c.jsx(st,{variant:"outline",size:"xs",children:r.type}),r.model&&c.jsx("span",{className:"font-mono text-[10px] text-spur-text-muted",children:r.model})]},r.id))}),c.jsxs("div",{className:"mt-3 text-[10px] text-spur-text-faint",children:["Last refresh: ",oW(new Date().toISOString())]})]})]}):c.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-workspace-overview-empty":!0,children:"No team selected for this workspace."})}const ox=[{id:"overview",label:"Overview",component:uW},{id:"team",label:"Team",component:iv},{id:"inbox",label:"Inbox",component:_A},{id:"tasks",label:"Tasks",component:lb}];function lW(){const{teams:e}=Ei(),t=g.useMemo(()=>e.filter(l=>l.isCurrentProject),[e]),[n,r]=g.useState(""),[a,i]=g.useState("overview");g.useEffect(()=>{!n&&t.length>0&&r(t[0]?.teamId??"")},[t,n]);const s=t.find(l=>l.teamId===n)??null,u=ox.find(l=>l.id===a)?.component;return t.length===0?c.jsxs("div",{className:"workspace flex flex-col h-full items-center justify-center gap-3 p-6 bg-spur-bg","data-workspace-empty":!0,children:[c.jsx("div",{className:"text-sm font-semibold text-spur-text",children:"No project-local team"}),c.jsxs("p",{className:"text-xs text-spur-text-muted max-w-sm text-center",children:["No configured team resolves to this project's working directory. Add an"," ",c.jsx("code",{className:"font-mono",children:"agent.team"})," entry in"," ",c.jsx("code",{className:"font-mono",children:".spur/config.yaml"})," whose"," ",c.jsx("code",{className:"font-mono",children:"work_dir"})," points at the current project to compose a Workspace."]})]}):c.jsxs("div",{className:"workspace flex flex-col h-full overflow-hidden bg-spur-bg","data-workspace-shell":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Workspace"}),c.jsx("select",{value:s?.teamId??"",onChange:l=>{r(l.target.value),i("overview")},"aria-label":"Workspace team","data-workspace-team-select":!0,className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text text-xs",children:t.map(l=>c.jsx("option",{value:l.teamId,children:l.name},l.teamId))})]}),c.jsx("div",{role:"tablist","aria-label":"Workspace tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:ox.map(l=>{const p=l.id===a;return c.jsx("button",{type:"button",role:"tab","aria-selected":p,"aria-controls":`workspace-tab-panel-${l.id}`,id:`workspace-tab-${l.id}`,onClick:()=>i(l.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${p?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-workspace-tab":!0,children:l.label},l.id)})}),c.jsx("div",{role:"tabpanel",id:`workspace-tab-panel-${a}`,"aria-labelledby":`workspace-tab-${a}`,className:"flex-1 overflow-hidden",children:u?c.jsx(u,{teamId:s?.teamId}):null})]})}const cW={id:"workspace",name:"Workspace",icon:"🧩",route:"workspace",component:lW,sidebarLabel:"Workspace",order:0},dW=Object.freeze(Object.defineProperty({__proto__:null,module:cW},Symbol.toStringTag,{value:"Module"}));function sv(e){return e===null||typeof e!="object"?null:"module"in e&&ux(e.module)?e.module:"default"in e&&ux(e.default)?e.default:null}function ux(e){return e===null||typeof e!="object"?!1:"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"&&"icon"in e&&typeof e.icon=="string"&&"route"in e&&typeof e.route=="string"&&"component"in e&&typeof e.component=="function"}function ov(e,t){const n=typeof e.order=="number",r=typeof t.order=="number";return n&&r?e.order-t.order:n?-1:r?1:0}function pW(e){const t=[],n=e("./*/index.{ts,tsx}",{eager:!0});for(const r of Object.values(n)){const a=sv(r);a&&t.push(a)}return t.sort((r,a)=>r.id.localeCompare(a.id)),t.sort(ov),t}function fW(){try{return pW(()=>Object.assign({"./features/index.tsx":p$,"./inbox/index.tsx":C$,"./observability/index.tsx":Mz,"./task-kanban/index.tsx":wG,"./teams/index.tsx":sW,"./workspace/index.tsx":dW}))}catch(a){if(typeof require!="function")throw a}const e=require("node:fs"),t=require("node:path"),n=require("node:url"),r=typeof __dirname<"u"?__dirname:t.dirname(n.fileURLToPath(import.meta.url));return mW(r,{readdirSync:(a,i)=>e.readdirSync(a,i),tryRequire:a=>require(a)})}function mW(e,t){const n=require("node:path"),r=[];let a=[];try{a=t.readdirSync(e,{withFileTypes:!0})}catch{return r}const i=a.filter(s=>s.isDirectory()).map(s=>s.name).sort((s,o)=>s.localeCompare(o));for(const s of i)for(const o of["tsx","ts"]){const u=n.join(e,s,`index.${o}`);try{const l=t.tryRequire(u),p=sv(l);if(p){r.push(p);break}}catch{}}return r.sort(ov),r}function hW(e,t){const n=new Set(t?.disabled??[]),r=e.slice(),a=new Set(n);function i(){return r.filter(s=>!a.has(s.id))}return gW(r),{get modules(){return i()},getModule(s){return i().find(o=>o.id===s)},get defaultModule(){return i()[0]},disableModule(s){a.add(s)},enableModule(s){a.delete(s)},getEnabledModules(){return i().map(s=>s.id)},registerModuleRoot(s){}}}function gW(e){const t=new Map,n=new Map;for(const r of e){const a=t.get(r.id);if(a!==void 0)throw new Error(`Duplicate module id "${r.id}" discovered in two sources: ${a} and ${To(r)}`);t.set(r.id,To(r));const i=n.get(r.route);if(i!==void 0)throw new Error(`Duplicate module route "${r.route}" discovered in two sources: ${i} and ${To(r)}`);n.set(r.route,To(r))}}function To(e){return e.id}const pb=hW(fW(),{disabled:fP}),uv=pb.modules;function bW(e){return pb.getModule(e)}const So=pb.defaultModule;function EW(){const[e,t]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u")return;const n=r=>{const i=r.detail?.message||"An error occurred",s=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;t(o=>[...o,{id:s,message:i}]),setTimeout(()=>{t(o=>o.filter(u=>u.id!==s))},5e3)};return window.addEventListener("api-error",n),()=>{window.removeEventListener("api-error",n)}},[]),e.length===0?null:c.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-md w-full px-4 pointer-events-none",children:e.map(n=>c.jsxs("div",{className:"pointer-events-auto flex items-center justify-between gap-3 p-3 bg-red-950/90 border border-red-500/40 text-red-200 text-sm rounded-md shadow-lg backdrop-blur",role:"alert",children:[c.jsx("span",{className:"flex-1 break-words",children:n.message}),c.jsx("button",{type:"button",className:"text-red-400 hover:text-red-100 text-base font-bold leading-none px-1",onClick:()=>t(r=>r.filter(a=>a.id!==n.id)),"aria-label":"Close error toast",children:"×"})]},n.id))})}function yW({currentName:e}){const[t,n]=g.useState(!1),[r,a]=g.useState([]),[i,s]=g.useState(null),[o,u]=g.useState(null),l=g.useRef(null);g.useEffect(()=>{if(!t)return;const d=new AbortController;return Ke(new Request(`${et()}/projects`,{signal:d.signal})).then(async f=>{if(!f.ok)return;const m=await f.json();a(m.projects??[])}).catch(()=>{u("Failed to load projects")}),()=>d.abort()},[t]),g.useEffect(()=>{if(!t)return;const d=m=>{m.key==="Escape"&&n(!1)},f=m=>{l.current&&!l.current.contains(m.target)&&n(!1)};return document.addEventListener("keydown",d),document.addEventListener("mousedown",f),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",f)}},[t]);const p=async d=>{if(d.current){n(!1);return}if(d.running&&d.port>0){window.location.href=`http://localhost:${d.port}/board`;return}s(d.name);try{const f=await Ke(new Request(`${et()}/projects/start`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:d.name,path:d.path})}));if(!f.ok)throw new Error("Failed to start project");const m=await f.json();window.location.href=m.url||`http://localhost:${m.port}/board`}catch(f){u(f instanceof Error?f.message:"Start failed"),s(null)}};return c.jsxs("div",{className:"relative min-w-0 flex-1",ref:l,children:[c.jsxs("button",{type:"button",onClick:()=>n(d=>!d),"aria-haspopup":"listbox","aria-expanded":t,"aria-label":"Switch project",title:e,"data-testid":"project-switcher-trigger",className:"flex w-full items-center justify-between gap-1 rounded-md px-1.5 py-1 text-left text-sm font-semibold text-spur-text hover:bg-spur-border/30 focus-visible:outline focus-visible:outline-2 focus-visible:outline-spur-accent",children:[c.jsx("span",{className:"font-semibold truncate",children:e}),c.jsx("svg",{className:`h-4 w-4 shrink-0 transition-transform ${t?"rotate-180":""}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M4 6l4 4 4-4"})})]}),t&&c.jsxs("div",{role:"listbox","aria-label":"Registered projects","data-testid":"project-switcher-menu",className:"absolute left-0 top-full z-50 mt-1 w-64 rounded-md border border-spur-border bg-spur-surface p-1 shadow-lg",children:[c.jsx("div",{className:"px-2 py-1 text-xs font-medium text-spur-text-muted border-b border-spur-border/50 mb-1",children:"Projects"}),r.length===0?c.jsx("div",{className:"px-2 py-1.5 text-xs text-spur-text-muted",children:o||"No projects registered"}):r.map(d=>c.jsxs("button",{type:"button",role:"option","aria-selected":d.current,disabled:i===d.name,onClick:()=>p(d),"data-testid":`project-item-${d.name}`,className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-xs text-left transition-colors ${d.current?"bg-spur-accent/15 text-spur-accent font-medium":"text-spur-text hover:bg-spur-border/30"}`,children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[c.jsx("span",{className:`h-2 w-2 rounded-full shrink-0 ${d.running?"bg-green-500":"bg-gray-400"}`,title:d.running?`Running on port ${d.port}`:"Stopped"}),c.jsx("span",{className:"truncate",children:d.name})]}),i===d.name?c.jsx("span",{className:"text-[10px] text-spur-accent animate-pulse",children:"Starting..."}):d.current?c.jsx("span",{className:"text-[10px] font-semibold text-spur-accent",children:"current"}):d.running?c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[":",d.port]}):c.jsx("span",{className:"text-[10px] text-spur-text-muted",children:"stopped"})]},d.path))]})]})}const lv="spur-theme";function xW(){try{const e=localStorage.getItem(lv);if(e==="light"||e==="dark")return e}catch{}return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function TW(e){document.documentElement.setAttribute("data-theme",e);try{localStorage.setItem(lv,e)}catch{}}function SW(e){const t=e==="dark"?"light":"dark";return TW(t),t}function AW(){const[e,t]=g.useState(xW);g.useEffect(()=>{const r=window.matchMedia("(prefers-color-scheme: dark)"),a=i=>{if(!(()=>{try{return localStorage.getItem("spur-theme")}catch{return null}})()){const o=i.matches?"dark":"light";t(o),document.documentElement.setAttribute("data-theme",o)}};return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[]);const n=g.useCallback(()=>t(SW),[]);return c.jsx(He,{variant:"ghost",size:"sm",onClick:n,className:"text-spur-text-muted","aria-label":e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?"☀️":"🌙"})}const vW="Modules";function wW(){const[e,t]=g.useState(vW);return g.useEffect(()=>{const n=new AbortController;return Ke(new Request(`${et()}/project`,{signal:n.signal})).then(async r=>{if(!r.ok)return;const a=await r.json();a.name&&t(a.name)}).catch(()=>{}),()=>n.abort()},[]),e}function _W({direction:e}){const t=e==="expand";return c.jsx("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t?c.jsx("path",{d:"M6 3l5 5-5 5"}):c.jsx("path",{d:"M10 3L5 8l5 5"})})}function lx({collapsed:e,onToggle:t}){const n=e?"Expand sidebar":"Collapse sidebar";return c.jsx("button",{type:"button",onClick:t,"aria-label":n,title:n,"data-testid":e?"sidebar-expand":"sidebar-collapse",className:"flex h-8 w-8 items-center justify-center rounded-md text-spur-text-muted hover:bg-spur-accent/20 hover:text-spur-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-spur-accent",children:c.jsx(_W,{direction:e?"expand":"collapse"})})}function NW({collapsed:e,onToggle:t,onMobileClose:n}){const r=wW();return c.jsxs("aside",{className:"flex flex-col bg-spur-surface border-r border-spur-border overflow-hidden",children:[e?c.jsx("div",{className:"flex items-center justify-center border-b border-spur-border shrink-0 py-1",children:c.jsx(lx,{collapsed:!0,onToggle:t})}):c.jsxs("div",{className:"flex items-center justify-between gap-1 p-3 border-b border-spur-border shrink-0",children:[c.jsx(yW,{currentName:r}),c.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[c.jsx(lx,{collapsed:!1,onToggle:t}),c.jsx(AW,{}),n&&c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close navigation",children:"✕"})]})]}),c.jsx("nav",{className:"flex-1 overflow-y-auto",children:uv.map(a=>c.jsxs(jx,{to:`/board/${a.route}`,className:({isActive:i})=>`flex items-center gap-2 px-3 py-2 text-sm transition-colors ${i?"bg-spur-accent/20 text-spur-accent":"text-spur-text-muted hover:text-spur-text hover:bg-spur-border/30"} ${e?"justify-center py-3":""}`,title:e?a.name:void 0,children:[c.jsx("span",{className:"text-lg",children:a.icon}),!e&&c.jsx("span",{children:a.sidebarLabel??a.name})]},a.id))})]})}function CW({children:e,mobileHeader:t}){return c.jsxs("main",{className:"flex flex-col overflow-hidden bg-spur-bg",children:[t,c.jsx("div",{className:"flex-1 overflow-auto",children:e})]})}function IW({collapsed:e,onToggle:t,onMobileClose:n,children:r,actions:a}){return c.jsxs("aside",{className:"flex flex-col bg-spur-surface border-l border-spur-border overflow-hidden",children:[n&&c.jsx("div",{className:"hidden max-md:flex items-center justify-center py-2 shrink-0",children:c.jsx("div",{className:"w-10 h-1 rounded-full bg-spur-border"})}),c.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-spur-border shrink-0",children:[!e&&c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:r?"Context":""}),c.jsx("div",{className:"flex items-center gap-1",children:a}),c.jsxs("div",{className:"flex items-center gap-1",children:[n&&c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close panel",children:"✕"}),c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted hidden md:inline-flex",onClick:t,"aria-label":e?"Expand panel":"Collapse panel",children:e?"◀":"▶"})]})]}),!e&&c.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:r})]})}const kW=g.createContext(void 0);function RW(){const[e,t]=g.useState(()=>dP()),[n,r]=g.useState(!1),[a,i]=g.useState(!1),s=tr(),o=(()=>{const w=s.pathname.split("/"),T=w.indexOf("board"),I=T>=0?w[T+1]:void 0;return bW(I??"")})();g.useLayoutEffect(()=>{const w=document.documentElement;w.style.setProperty("--sidebar-w",`${e.sidebarWidth}px`),w.style.setProperty("--rightpanel-w",`${e.rightPanelWidth}px`)},[e.sidebarWidth,e.rightPanelWidth]);const u=g.useCallback(w=>pP(w),[]),l=g.useCallback(()=>{t(w=>{const T={...w,sidebarCollapsed:!w.sidebarCollapsed};return u(T),T})},[u]),p=g.useCallback(()=>{t(w=>{const T={...w,rightPanelCollapsed:!w.rightPanelCollapsed};return u(T),T})},[u]),d=g.useCallback(w=>t(T=>{const I={...T,sidebarWidth:w};return u(I),I}),[u]),f=g.useCallback(w=>t(T=>{const I={...T,rightPanelWidth:w};return u(I),I}),[u]),m=g.useCallback(()=>{r(!1),i(!1)},[]),b=g.useCallback(w=>{w.key==="Escape"&&m()},[m]),E=o?.rightPanelComponent;g.useLayoutEffect(()=>{E&&e.rightPanelCollapsed&&t(w=>({...w,rightPanelCollapsed:!1}))},[E,e.rightPanelCollapsed]);const y=c.jsxs("div",{className:"mobile-bar",children:[c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>r(!0),"aria-label":"Open navigation",children:"☰"}),c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:o?.name??"Spur"}),c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>i(!0),"aria-label":"Open panel",children:"◧"})]}),x=n||a;return c.jsxs(c.Fragment,{children:[x&&c.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:m,onKeyDown:b,"aria-hidden":"true"}),c.jsx("div",{className:"board-layout","data-sidebar-collapsed":String(e.sidebarCollapsed),"data-rightpanel-collapsed":String(e.rightPanelCollapsed),"data-mobile-sidebar-open":String(n),"data-mobile-panel-open":String(a),children:c.jsxs(kW.Provider,{value:o,children:[c.jsx(NW,{collapsed:e.sidebarCollapsed,onToggle:l,onMobileClose:m}),c.jsx(iu,{targetVar:"--sidebar-w",onResizeEnd:d}),c.jsx(CW,{mobileHeader:y,children:c.jsx(i_,{})}),c.jsx(iu,{targetVar:"--rightpanel-w",onResizeEnd:f}),c.jsx(IW,{collapsed:e.rightPanelCollapsed,onToggle:p,onMobileClose:m,children:E?c.jsx(E,{}):null})]})}),c.jsx(EW,{})]})}const DW=[{path:"/board",element:c.jsx(RW,{}),children:[{index:!0,element:c.jsx(Gb,{to:So?So.route:"/board",replace:!0})},...uv.flatMap(e=>[{path:e.route,element:c.jsx(e.component,{})},{path:`${e.route}/*`,element:c.jsx(e.component,{})}])]},{path:"/",element:c.jsx(Gb,{to:So?`/board/${So.route}`:"/board",replace:!0})}];function OW(){return R_(DW)}function FW(){const[e]=g.useState(OW);return c.jsx(n_,{router:e})}export{st as B,Lg as C,Tr as L,Ko as M,Zr as S,dA as _,FW as a,He as b,W7 as c,_r as d,c as j,$7 as p,Yg as t,bA as u};
179
+ `},Yz={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Zz(e){let{announcements:t=Yz,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=qz}=e;const{announce:i,announcement:s}=Gz(),o=pl("DndLiveRegion"),[u,l]=g.useState(!1);if(g.useEffect(()=>{l(!0)},[]),Wz(g.useMemo(()=>({onDragStart(d){let{active:f}=d;i(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:m}=d;t.onDragMove&&i(t.onDragMove({active:f,over:m}))},onDragOver(d){let{active:f,over:m}=d;i(t.onDragOver({active:f,over:m}))},onDragEnd(d){let{active:f,over:m}=d;i(t.onDragEnd({active:f,over:m}))},onDragCancel(d){let{active:f,over:m}=d;i(t.onDragCancel({active:f,over:m}))}}),[i,t])),!u)return null;const p=We.createElement(We.Fragment,null,We.createElement(zz,{id:r,value:a.draggable}),We.createElement(Hz,{id:o,announcement:s}));return n?Ua.createPortal(p,n):p}var en;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function hu(){}function zy(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Kz(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ir=Object.freeze({x:0,y:0});function Xz(e,t){const n=mu(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Qz(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Jz(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function eH(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=a-r,o=i-n;if(r<a&&n<i){const u=t.width*t.height,l=e.width*e.height,p=s*o,d=p/(u+l-p);return Number(d.toFixed(4))}return 0}const tH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const i of r){const{id:s}=i,o=n.get(s);if(o){const u=eH(o,t);u>0&&a.push({id:s,data:{droppableContainer:i,value:u}})}}return a.sort(Qz)};function nH(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function PA(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ir}function rH(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return a.reduce((s,o)=>({...s,top:s.top+e*o.y,bottom:s.bottom+e*o.y,left:s.left+e*o.x,right:s.right+e*o.x}),{...n})}}const aH=rH(1);function BA(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function iH(e,t,n){const r=BA(t);if(!r)return e;const{scaleX:a,scaleY:i,x:s,y:o}=r,u=e.left-s-(1-a)*parseFloat(n),l=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),p=a?e.width/a:e.width,d=i?e.height/i:e.height;return{width:p,height:d,top:l,right:u+p,bottom:l+d,left:u}}const sH={ignoreTransform:!1};function qs(e,t){t===void 0&&(t=sH);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:l,transformOrigin:p}=On(e).getComputedStyle(e);l&&(n=iH(n,l,p))}const{top:r,left:a,width:i,height:s,bottom:o,right:u}=n;return{top:r,left:a,width:i,height:s,bottom:o,right:u}}function Hy(e){return qs(e,{ignoreTransform:!0})}function oH(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function uH(e,t){return t===void 0&&(t=On(e).getComputedStyle(e)),t.position==="fixed"}function lH(e,t){t===void 0&&(t=On(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const i=t[a];return typeof i=="string"?n.test(i):!1})}function rb(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(tb(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Ws(a)||LA(a)||n.includes(a))return n;const i=On(e).getComputedStyle(a);return a!==e&&lH(a,i)&&n.push(a),uH(a,i)?n:r(a.parentNode)}return e?r(e):n}function UA(e){const[t]=rb(e,1);return t??null}function bc(e){return!cl||!e?null:yi(e)?e:eb(e)?tb(e)||e===xi(e).scrollingElement?window:Ws(e)?e:null:null}function jA(e){return yi(e)?e.scrollX:e.scrollLeft}function $A(e){return yi(e)?e.scrollY:e.scrollTop}function od(e){return{x:jA(e),y:$A(e)}}var ln;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ln||(ln={}));function zA(e){return!cl||!e?!1:e===document.scrollingElement}function HA(e){const t={x:0,y:0},n=zA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,o=e.scrollLeft>=r.x;return{isTop:a,isLeft:i,isBottom:s,isRight:o,maxScroll:r,minScroll:t}}const cH={x:.2,y:.2};function dH(e,t,n,r,a){let{top:i,left:s,right:o,bottom:u}=n;r===void 0&&(r=10),a===void 0&&(a=cH);const{isTop:l,isBottom:p,isLeft:d,isRight:f}=HA(e),m={x:0,y:0},b={x:0,y:0},E={height:t.height*a.y,width:t.width*a.x};return!l&&i<=t.top+E.height?(m.y=ln.Backward,b.y=r*Math.abs((t.top+E.height-i)/E.height)):!p&&u>=t.bottom-E.height&&(m.y=ln.Forward,b.y=r*Math.abs((t.bottom-E.height-u)/E.height)),!f&&o>=t.right-E.width?(m.x=ln.Forward,b.x=r*Math.abs((t.right-E.width-o)/E.width)):!d&&s<=t.left+E.width&&(m.x=ln.Backward,b.x=r*Math.abs((t.left+E.width-s)/E.width)),{direction:m,speed:b}}function pH(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function GA(e){return e.reduce((t,n)=>Va(t,od(n)),ir)}function fH(e){return e.reduce((t,n)=>t+jA(n),0)}function mH(e){return e.reduce((t,n)=>t+$A(n),0)}function WA(e,t){if(t===void 0&&(t=qs),!e)return;const{top:n,left:r,bottom:a,right:i}=t(e);UA(e)&&(a<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const hH=[["x",["left","right"],fH],["y",["top","bottom"],mH]];class ab{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=rb(n),a=GA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,o]of hH)for(const u of s)Object.defineProperty(this,u,{get:()=>{const l=o(r),p=a[i]-l;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class as{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function gH(e){const{EventTarget:t}=On(e);return e instanceof t?e:xi(e)}function Ec(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Kn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Kn||(Kn={}));function Gy(e){e.preventDefault()}function bH(e){e.stopPropagation()}var Ct;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ct||(Ct={}));const VA={start:[Ct.Space,Ct.Enter],cancel:[Ct.Esc],end:[Ct.Space,Ct.Enter,Ct.Tab]},EH=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ct.Right:return{...n,x:n.x+25};case Ct.Left:return{...n,x:n.x-25};case Ct.Down:return{...n,y:n.y+25};case Ct.Up:return{...n,y:n.y-25}}};class ib{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new as(xi(n)),this.windowListeners=new as(On(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Kn.Resize,this.handleCancel),this.windowListeners.add(Kn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Kn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&WA(r),n(ir)}handleKeyDown(t){if(nb(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:i=VA,coordinateGetter:s=EH,scrollBehavior:o="smooth"}=a,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:l}=r.current,p=l?{x:l.left,y:l.top}:ir;this.referenceCoordinates||(this.referenceCoordinates=p);const d=s(t,{active:n,context:r.current,currentCoordinates:p});if(d){const f=fu(d,p),m={x:0,y:0},{scrollableAncestors:b}=r.current;for(const E of b){const y=t.code,{isTop:x,isRight:w,isLeft:T,isBottom:I,maxScroll:R,minScroll:v}=HA(E),A=pH(E),N={x:Math.min(y===Ct.Right?A.right-A.width/2:A.right,Math.max(y===Ct.Right?A.left:A.left+A.width/2,d.x)),y:Math.min(y===Ct.Down?A.bottom-A.height/2:A.bottom,Math.max(y===Ct.Down?A.top:A.top+A.height/2,d.y))},F=y===Ct.Right&&!w||y===Ct.Left&&!T,_=y===Ct.Down&&!I||y===Ct.Up&&!x;if(F&&N.x!==d.x){const M=E.scrollLeft+f.x,j=y===Ct.Right&&M<=R.x||y===Ct.Left&&M>=v.x;if(j&&!f.y){E.scrollTo({left:M,behavior:o});return}j?m.x=E.scrollLeft-M:m.x=y===Ct.Right?E.scrollLeft-R.x:E.scrollLeft-v.x,m.x&&E.scrollBy({left:-m.x,behavior:o});break}else if(_&&N.y!==d.y){const M=E.scrollTop+f.y,j=y===Ct.Down&&M<=R.y||y===Ct.Up&&M>=v.y;if(j&&!f.x){E.scrollTo({top:M,behavior:o});return}j?m.y=E.scrollTop-M:m.y=y===Ct.Down?E.scrollTop-R.y:E.scrollTop-v.y,m.y&&E.scrollBy({top:-m.y,behavior:o});break}}this.handleMove(t,Va(fu(d,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ib.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=VA,onActivation:a}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const o=i.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function Wy(e){return!!(e&&"distance"in e)}function Vy(e){return!!(e&&"delay"in e)}class sb{constructor(t,n,r){var a;r===void 0&&(r=gH(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=xi(s),this.documentListeners=new as(this.document),this.listeners=new as(r),this.windowListeners=new as(On(s)),this.initialCoordinates=(a=mu(i))!=null?a:ir,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Kn.Resize,this.handleCancel),this.windowListeners.add(Kn.DragStart,Gy),this.windowListeners.add(Kn.VisibilityChange,this.handleCancel),this.windowListeners.add(Kn.ContextMenu,Gy),this.documentListeners.add(Kn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vy(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Wy(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Kn.Click,bH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Kn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:i}=this,{onMove:s,options:{activationConstraint:o}}=i;if(!a)return;const u=(n=mu(t))!=null?n:ir,l=fu(a,u);if(!r&&o){if(Wy(o)){if(o.tolerance!=null&&Ec(l,o.tolerance))return this.handleCancel();if(Ec(l,o.distance))return this.handleStart()}if(Vy(o)&&Ec(l,o.tolerance))return this.handleCancel();this.handlePending(o,l);return}t.cancelable&&t.preventDefault(),s(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ct.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const yH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ob extends sb{constructor(t){const{event:n}=t,r=xi(n.target);super(t,yH,r)}}ob.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const xH={move:{name:"mousemove"},end:{name:"mouseup"}};var ud;(function(e){e[e.RightClick=2]="RightClick"})(ud||(ud={}));class TH extends sb{constructor(t){super(t,xH,xi(t.event.target))}}TH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ud.RightClick?!1:(r?.({event:n}),!0)}}];const yc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class SH extends sb{constructor(t){super(t,yc)}static setup(){return window.addEventListener(yc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(yc.move.name,t)};function t(){}}}SH.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var is;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(is||(is={}));var gu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(gu||(gu={}));function AH(e){let{acceleration:t,activator:n=is.Pointer,canScroll:r,draggingRect:a,enabled:i,interval:s=5,order:o=gu.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:p,delta:d,threshold:f}=e;const m=wH({delta:d,disabled:!i}),[b,E]=Pz(),y=g.useRef({x:0,y:0}),x=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case is.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case is.DraggableRect:return a}},[n,a,u]),T=g.useRef(null),I=g.useCallback(()=>{const v=T.current;if(!v)return;const A=y.current.x*x.current.x,N=y.current.y*x.current.y;v.scrollBy(A,N)},[]),R=g.useMemo(()=>o===gu.TreeOrder?[...l].reverse():l,[o,l]);g.useEffect(()=>{if(!i||!l.length||!w){E();return}for(const v of R){if(r?.(v)===!1)continue;const A=l.indexOf(v),N=p[A];if(!N)continue;const{direction:F,speed:_}=dH(v,N,w,t,f);for(const M of["x","y"])m[M][F[M]]||(_[M]=0,F[M]=0);if(_.x>0||_.y>0){E(),T.current=v,b(I,s),y.current=_,x.current=F;return}}y.current={x:0,y:0},x.current={x:0,y:0},E()},[t,I,r,E,i,s,JSON.stringify(w),JSON.stringify(m),b,l,R,p,JSON.stringify(f)])}const vH={x:{[ln.Backward]:!1,[ln.Forward]:!1},y:{[ln.Backward]:!1,[ln.Forward]:!1}};function wH(e){let{delta:t,disabled:n}=e;const r=pu(t);return Vs(a=>{if(n||!r||!a)return vH;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ln.Backward]:a.x[ln.Backward]||i.x===-1,[ln.Forward]:a.x[ln.Forward]||i.x===1},y:{[ln.Backward]:a.y[ln.Backward]||i.y===-1,[ln.Forward]:a.y[ln.Forward]||i.y===1}}},[n,t,r])}function _H(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Vs(a=>{var i;return t==null?null:(i=r??a)!=null?i:null},[r,t])}function NH(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,i=a.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var As;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(As||(As={}));var ld;(function(e){e.Optimized="optimized"})(ld||(ld={}));const qy=new Map;function CH(e,t){let{dragging:n,dependencies:r,config:a}=t;const[i,s]=g.useState(null),{frequency:o,measure:u,strategy:l}=a,p=g.useRef(e),d=y(),f=Ss(d),m=g.useCallback(function(x){x===void 0&&(x=[]),!f.current&&s(w=>w===null?x:w.concat(x.filter(T=>!w.includes(T))))},[f]),b=g.useRef(null),E=Vs(x=>{if(d&&!n)return qy;if(!x||x===qy||p.current!==e||i!=null){const w=new Map;for(let T of e){if(!T)continue;if(i&&i.length>0&&!i.includes(T.id)&&T.rect.current){w.set(T.id,T.rect.current);continue}const I=T.node.current,R=I?new ab(u(I),I):null;T.rect.current=R,R&&w.set(T.id,R)}return w}return x},[e,i,n,d,u]);return g.useEffect(()=>{p.current=e},[e]),g.useEffect(()=>{d||m()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},o))},[o,d,m,...r]),{droppableRects:E,measureDroppableContainers:m,measuringScheduled:i!=null};function y(){switch(l){case As.Always:return!1;case As.BeforeDragging:return n;default:return!n}}}function ub(e,t){return Vs(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function IH(e,t){return ub(e,t)}function kH(e){let{callback:t,disabled:n}=e;const r=dl(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function fl(e){let{callback:t,disabled:n}=e;const r=dl(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function RH(e){return new ab(qs(e),e)}function Yy(e,t,n){t===void 0&&(t=RH);const[r,a]=g.useState(null);function i(){a(u=>{if(!e)return null;if(e.isConnected===!1){var l;return(l=u??n)!=null?l:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const s=kH({callback(u){if(e)for(const l of u){const{type:p,target:d}=l;if(p==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),o=fl({callback:i});return Rr(()=>{i(),e?(o?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),s?.disconnect())},[e]),r}function DH(e){const t=ub(e);return PA(e,t)}const Zy=[];function OH(e){const t=g.useRef(e),n=Vs(r=>e?r&&r!==Zy&&e&&t.current&&e.parentNode===t.current.parentNode?r:rb(e):Zy,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function LH(e){const[t,n]=g.useState(null),r=g.useRef(e),a=g.useCallback(i=>{const s=bc(i.target);s&&n(o=>o?(o.set(s,od(s)),new Map(o)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const o=e.map(u=>{const l=bc(u);return l?(l.addEventListener("scroll",a,{passive:!0}),[l,od(l)]):null}).filter(u=>u!=null);n(o.length?new Map(o):null),r.current=e}return()=>{s(e),s(i)};function s(o){o.forEach(u=>{const l=bc(u);l?.removeEventListener("scroll",a)})}},[a,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Va(i,s),ir):GA(e):ir,[e,t])}function Ky(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==ir;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?fu(e,n.current):ir}function FH(e){g.useEffect(()=>{if(!cl)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function MH(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:i}=r;return n[a]=s=>{i(s,t)},n},{}),[e,t])}function qA(e){return g.useMemo(()=>e?oH(e):null,[e])}const Xy=[];function PH(e,t){t===void 0&&(t=qs);const[n]=e,r=qA(n?On(n):null),[a,i]=g.useState(Xy);function s(){i(()=>e.length?e.map(u=>zA(u)?r:new ab(t(u),u)):Xy)}const o=fl({callback:s});return Rr(()=>{o?.disconnect(),s(),e.forEach(u=>o?.observe(u))},[e]),a}function YA(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ws(t)?t:e}function BH(e){let{measure:t}=e;const[n,r]=g.useState(null),a=g.useCallback(l=>{for(const{target:p}of l)if(Ws(p)){r(d=>{const f=t(p);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),i=fl({callback:a}),s=g.useCallback(l=>{const p=YA(l);i?.disconnect(),p&&i?.observe(p),r(p?t(p):null)},[t,i]),[o,u]=du(s);return g.useMemo(()=>({nodeRef:o,rect:n,setRef:u}),[n,o,u])}const UH=[{sensor:ob,options:{}},{sensor:ib,options:{}}],jH={current:{}},Fo={draggable:{measure:Hy},droppable:{measure:Hy,strategy:As.WhileDragging,frequency:ld.Optimized},dragOverlay:{measure:qs}};class ss extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const $H={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ss,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:hu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Fo,measureDroppableContainers:hu,windowRect:null,measuringScheduled:!1},ZA={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:hu,draggableNodes:new Map,over:null,measureDroppableContainers:hu},Ys=g.createContext(ZA),KA=g.createContext($H);function zH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ss}}}function HH(e,t){switch(t.type){case en.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new ss(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case en.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new ss(e.droppable.containers);return s.set(n,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:s}}}case en.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new ss(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function GH(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=g.useContext(Ys),i=pu(r),s=pu(n?.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!nb(i)||document.activeElement===i.target)return;const o=a.get(s);if(!o)return;const{activatorNode:u,node:l}=o;if(!u.current&&!l.current)return;requestAnimationFrame(()=>{for(const p of[u.current,l.current]){if(!p)continue;const d=jz(p);if(d){d.focus();break}}})}},[r,t,a,s,i]),null}function XA(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,i)=>i({transform:a,...r}),n):n}function WH(e){return g.useMemo(()=>({draggable:{...Fo.draggable,...e?.draggable},droppable:{...Fo.droppable,...e?.droppable},dragOverlay:{...Fo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function VH(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const i=g.useRef(!1),{x:s,y:o}=typeof a=="boolean"?{x:a,y:a}:a;Rr(()=>{if(!s&&!o||!t){i.current=!1;return}if(i.current||!r)return;const l=t?.node.current;if(!l||l.isConnected===!1)return;const p=n(l),d=PA(p,r);if(s||(d.x=0),o||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=UA(l);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,o,r,n])}const ml=g.createContext({...ir,scaleX:1,scaleY:1});var zr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(zr||(zr={}));const qH=g.memo(function(t){var n,r,a,i;let{id:s,accessibility:o,autoScroll:u=!0,children:l,sensors:p=UH,collisionDetection:d=tH,measuring:f,modifiers:m,...b}=t;const E=g.useReducer(HH,void 0,zH),[y,x]=E,[w,T]=Vz(),[I,R]=g.useState(zr.Uninitialized),v=I===zr.Initialized,{draggable:{active:A,nodes:N,translate:F},droppable:{containers:_}}=y,M=A!=null?N.get(A):null,j=g.useRef({initial:null,translated:null}),H=g.useMemo(()=>{var U;return A!=null?{id:A,data:(U=M?.data)!=null?U:jH,rect:j}:null},[A,M]),Z=g.useRef(null),[V,ie]=g.useState(null),[X,re]=g.useState(null),ue=Ss(b,Object.values(b)),k=pl("DndDescribedBy",s),Y=g.useMemo(()=>_.getEnabled(),[_]),le=WH(f),{droppableRects:D,measureDroppableContainers:ke,measuringScheduled:Le}=CH(Y,{dragging:v,dependencies:[F.x,F.y],config:le.droppable}),ve=_H(N,A),Ue=g.useMemo(()=>X?mu(X):null,[X]),Ee=Wt(),he=IH(ve,le.draggable.measure);VH({activeNode:A!=null?N.get(A):null,config:Ee.layoutShiftCompensation,initialRect:he,measure:le.draggable.measure});const ct=Yy(ve,le.draggable.measure,he),$e=Yy(ve?ve.parentElement:null),ge=g.useRef({activatorEvent:null,active:null,activeNode:ve,collisionRect:null,collisions:null,droppableRects:D,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Pe=_.getNodeFor((n=ge.current.over)==null?void 0:n.id),pt=BH({measure:le.dragOverlay.measure}),de=(r=pt.nodeRef.current)!=null?r:ve,rt=v?(a=pt.rect)!=null?a:ct:null,Ot=!!(pt.nodeRef.current&&pt.rect),ft=DH(Ot?null:ct),kt=qA(de?On(de):null),wt=OH(v?Pe??ve:null),zt=PH(wt),nn=XA(m,{transform:{x:F.x-ft.x,y:F.y-ft.y,scaleX:1,scaleY:1},activatorEvent:X,active:H,activeNodeRect:ct,containerNodeRect:$e,draggingNodeRect:rt,over:ge.current.over,overlayNodeRect:pt.rect,scrollableAncestors:wt,scrollableAncestorRects:zt,windowRect:kt}),ut=Ue?Va(Ue,F):null,Ae=LH(wt),Ye=Ky(Ae),q=Ky(Ae,[ct]),te=Va(nn,Ye),ye=rt?aH(rt,nn):null,we=H&&ye?d({active:H,collisionRect:ye,droppableRects:D,droppableContainers:Y,pointerCoordinates:ut}):null,je=Jz(we,"id"),[Ze,_t]=g.useState(null),St=Ot?nn:Va(nn,q),Et=nH(St,(i=Ze?.rect)!=null?i:null,ct),Nt=g.useRef(null),J=g.useCallback((U,Te)=>{let{sensor:Ne,options:ze}=Te;if(Z.current==null)return;const Xe=N.get(Z.current);if(!Xe)return;const Ve=U.nativeEvent,At=new Ne({active:Z.current,activeNode:Xe,event:Ve,options:ze,context:ge,onAbort(Rt){if(!N.get(Rt))return;const{onDragAbort:P}=ue.current,$={id:Rt};P?.($),w({type:"onDragAbort",event:$})},onPending(Rt,Vt,P,$){if(!N.get(Rt))return;const{onDragPending:ee}=ue.current,se={id:Rt,constraint:Vt,initialCoordinates:P,offset:$};ee?.(se),w({type:"onDragPending",event:se})},onStart(Rt){const Vt=Z.current;if(Vt==null)return;const P=N.get(Vt);if(!P)return;const{onDragStart:$}=ue.current,G={activatorEvent:Ve,active:{id:Vt,data:P.data,rect:j}};Ua.unstable_batchedUpdates(()=>{$?.(G),R(zr.Initializing),x({type:en.DragStart,initialCoordinates:Rt,active:Vt}),w({type:"onDragStart",event:G}),ie(Nt.current),re(Ve)})},onMove(Rt){x({type:en.DragMove,coordinates:Rt})},onEnd:rn(en.DragEnd),onCancel:rn(en.DragCancel)});Nt.current=At;function rn(Rt){return async function(){const{active:P,collisions:$,over:G,scrollAdjustedTranslate:ee}=ge.current;let se=null;if(P&&ee){const{cancelDrop:Se}=ue.current;se={activatorEvent:Ve,active:P,collisions:$,delta:ee,over:G},Rt===en.DragEnd&&typeof Se=="function"&&await Promise.resolve(Se(se))&&(Rt=en.DragCancel)}Z.current=null,Ua.unstable_batchedUpdates(()=>{x({type:Rt}),R(zr.Uninitialized),_t(null),ie(null),re(null),Nt.current=null;const Se=Rt===en.DragEnd?"onDragEnd":"onDragCancel";if(se){const xe=ue.current[Se];xe?.(se),w({type:Se,event:se})}})}}},[N]),be=g.useCallback((U,Te)=>(Ne,ze)=>{const Xe=Ne.nativeEvent,Ve=N.get(ze);if(Z.current!==null||!Ve||Xe.dndKit||Xe.defaultPrevented)return;const At={active:Ve};U(Ne,Te.options,At)===!0&&(Xe.dndKit={capturedBy:Te.sensor},Z.current=ze,J(Ne,Te))},[N,J]),Fe=NH(p,be);FH(p),Rr(()=>{ct&&I===zr.Initializing&&R(zr.Initialized)},[ct,I]),g.useEffect(()=>{const{onDragMove:U}=ue.current,{active:Te,activatorEvent:Ne,collisions:ze,over:Xe}=ge.current;if(!Te||!Ne)return;const Ve={active:Te,activatorEvent:Ne,collisions:ze,delta:{x:te.x,y:te.y},over:Xe};Ua.unstable_batchedUpdates(()=>{U?.(Ve),w({type:"onDragMove",event:Ve})})},[te.x,te.y]),g.useEffect(()=>{const{active:U,activatorEvent:Te,collisions:Ne,droppableContainers:ze,scrollAdjustedTranslate:Xe}=ge.current;if(!U||Z.current==null||!Te||!Xe)return;const{onDragOver:Ve}=ue.current,At=ze.get(je),rn=At&&At.rect.current?{id:At.id,rect:At.rect.current,data:At.data,disabled:At.disabled}:null,Rt={active:U,activatorEvent:Te,collisions:Ne,delta:{x:Xe.x,y:Xe.y},over:rn};Ua.unstable_batchedUpdates(()=>{_t(rn),Ve?.(Rt),w({type:"onDragOver",event:Rt})})},[je]),Rr(()=>{ge.current={activatorEvent:X,active:H,activeNode:ve,collisionRect:ye,collisions:we,droppableRects:D,draggableNodes:N,draggingNode:de,draggingNodeRect:rt,droppableContainers:_,over:Ze,scrollableAncestors:wt,scrollAdjustedTranslate:te},j.current={initial:rt,translated:ye}},[H,ve,we,ye,N,de,rt,D,_,Ze,wt,te]),AH({...Ee,delta:F,draggingRect:ye,pointerCoordinates:ut,scrollableAncestors:wt,scrollableAncestorRects:zt});const Re=g.useMemo(()=>({active:H,activeNode:ve,activeNodeRect:ct,activatorEvent:X,collisions:we,containerNodeRect:$e,dragOverlay:pt,draggableNodes:N,droppableContainers:_,droppableRects:D,over:Ze,measureDroppableContainers:ke,scrollableAncestors:wt,scrollableAncestorRects:zt,measuringConfiguration:le,measuringScheduled:Le,windowRect:kt}),[H,ve,ct,X,we,$e,pt,N,_,D,Ze,ke,wt,zt,le,Le,kt]),Tt=g.useMemo(()=>({activatorEvent:X,activators:Fe,active:H,activeNodeRect:ct,ariaDescribedById:{draggable:k},dispatch:x,draggableNodes:N,over:Ze,measureDroppableContainers:ke}),[X,Fe,H,ct,x,k,N,Ze,ke]);return We.createElement(MA.Provider,{value:T},We.createElement(Ys.Provider,{value:Tt},We.createElement(KA.Provider,{value:Re},We.createElement(ml.Provider,{value:Et},l)),We.createElement(GH,{disabled:o?.restoreFocus===!1})),We.createElement(Zz,{...o,hiddenTextDescribedById:k}));function Wt(){const U=V?.autoScrollEnabled===!1,Te=typeof u=="object"?u.enabled===!1:u===!1,Ne=v&&!U&&!Te;return typeof u=="object"?{...u,enabled:Ne}:{enabled:Ne}}}),YH=g.createContext(null),Qy="button",ZH="Draggable";function KH(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const i=pl(ZH),{activators:s,activatorEvent:o,active:u,activeNodeRect:l,ariaDescribedById:p,draggableNodes:d,over:f}=g.useContext(Ys),{role:m=Qy,roleDescription:b="draggable",tabIndex:E=0}=a??{},y=u?.id===t,x=g.useContext(y?ml:YH),[w,T]=du(),[I,R]=du(),v=MH(s,t),A=Ss(n);Rr(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:I,data:A}),()=>{const F=d.get(t);F&&F.key===i&&d.delete(t)}),[d,t]);const N=g.useMemo(()=>({role:m,tabIndex:E,"aria-disabled":r,"aria-pressed":y&&m===Qy?!0:void 0,"aria-roledescription":b,"aria-describedby":p.draggable}),[r,m,E,y,b,p.draggable]);return{active:u,activatorEvent:o,activeNodeRect:l,attributes:N,isDragging:y,listeners:r?void 0:v,node:w,over:f,setNodeRef:T,setActivatorNodeRef:R,transform:x}}function XH(){return g.useContext(KA)}const QH="Droppable",JH={timeout:25};function eG(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const i=pl(QH),{active:s,dispatch:o,over:u,measureDroppableContainers:l}=g.useContext(Ys),p=g.useRef({disabled:n}),d=g.useRef(!1),f=g.useRef(null),m=g.useRef(null),{disabled:b,updateMeasurementsFor:E,timeout:y}={...JH,...a},x=Ss(E??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{l(Array.isArray(x.current)?x.current:[x.current]),m.current=null},y)},[y]),T=fl({callback:w,disabled:b||!s}),I=g.useCallback((N,F)=>{T&&(F&&(T.unobserve(F),d.current=!1),N&&T.observe(N))},[T]),[R,v]=du(I),A=Ss(t);return g.useEffect(()=>{!T||!R.current||(T.disconnect(),d.current=!1,T.observe(R.current))},[R,T]),g.useEffect(()=>(o({type:en.RegisterDroppable,element:{id:r,key:i,disabled:n,node:R,rect:f,data:A}}),()=>o({type:en.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==p.current.disabled&&(o({type:en.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,o]),{active:s,rect:f,isOver:u?.id===r,node:R,over:u,setNodeRef:v}}function tG(e){let{animation:t,children:n}=e;const[r,a]=g.useState(null),[i,s]=g.useState(null),o=pu(n);return!n&&!r&&o&&a(o),Rr(()=>{if(!i)return;const u=r?.key,l=r?.props.id;if(u==null||l==null){a(null);return}Promise.resolve(t(l,i)).then(()=>{a(null)})},[t,r,i]),We.createElement(We.Fragment,null,n,r?g.cloneElement(r,{ref:s}):null)}const nG={x:0,y:0,scaleX:1,scaleY:1};function rG(e){let{children:t}=e;return We.createElement(Ys.Provider,{value:ZA},We.createElement(ml.Provider,{value:nG},t))}const aG={position:"fixed",touchAction:"none"},iG=e=>nb(e)?"transform 250ms ease":void 0,sG=g.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:i,className:s,rect:o,style:u,transform:l,transition:p=iG}=e;if(!o)return null;const d=a?l:{...l,scaleX:1,scaleY:1},f={...aG,width:o.width,height:o.height,top:o.top,left:o.left,transform:ti.Transform.toString(d),transformOrigin:a&&r?Xz(r,o):void 0,transition:typeof p=="function"?p(r):p,...u};return We.createElement(n,{className:s,style:f,ref:t},i)}),oG=e=>t=>{let{active:n,dragOverlay:r}=t;const a={},{styles:i,className:s}=e;if(i!=null&&i.active)for(const[o,u]of Object.entries(i.active))u!==void 0&&(a[o]=n.node.style.getPropertyValue(o),n.node.style.setProperty(o,u));if(i!=null&&i.dragOverlay)for(const[o,u]of Object.entries(i.dragOverlay))u!==void 0&&r.node.style.setProperty(o,u);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[u,l]of Object.entries(a))n.node.style.setProperty(u,l);s!=null&&s.active&&n.node.classList.remove(s.active)}},uG=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ti.Transform.toString(t)},{transform:ti.Transform.toString(n)}]},lG={duration:250,easing:"ease",keyframes:uG,sideEffects:oG({styles:{active:{opacity:"0"}}})};function cG(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:a}=e;return dl((i,s)=>{if(t===null)return;const o=n.get(i);if(!o)return;const u=o.node.current;if(!u)return;const l=YA(s);if(!l)return;const{transform:p}=On(s).getComputedStyle(s),d=BA(p);if(!d)return;const f=typeof t=="function"?t:dG(t);return WA(u,a.draggable.measure),f({active:{id:i,data:o.data,node:u,rect:a.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:s,rect:a.dragOverlay.measure(l)},droppableContainers:r,measuringConfiguration:a,transform:d})})}function dG(e){const{duration:t,easing:n,sideEffects:r,keyframes:a}={...lG,...e};return i=>{let{active:s,dragOverlay:o,transform:u,...l}=i;if(!t)return;const p={x:o.rect.left-s.rect.left,y:o.rect.top-s.rect.top},d={scaleX:u.scaleX!==1?s.rect.width*u.scaleX/o.rect.width:1,scaleY:u.scaleY!==1?s.rect.height*u.scaleY/o.rect.height:1},f={x:u.x-p.x,y:u.y-p.y,...d},m=a({...l,active:s,dragOverlay:o,transform:{initial:u,final:f}}),[b]=m,E=m[m.length-1];if(JSON.stringify(b)===JSON.stringify(E))return;const y=r?.({active:s,dragOverlay:o,...l}),x=o.node.animate(m,{duration:t,easing:n,fill:"forwards"});return new Promise(w=>{x.onfinish=()=>{y?.(),w()}})}}let Jy=0;function pG(e){return g.useMemo(()=>{if(e!=null)return Jy++,Jy},[e])}const fG=We.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:i,modifiers:s,wrapperElement:o="div",className:u,zIndex:l=999}=e;const{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggableNodes:b,droppableContainers:E,dragOverlay:y,over:x,measuringConfiguration:w,scrollableAncestors:T,scrollableAncestorRects:I,windowRect:R}=XH(),v=g.useContext(ml),A=pG(d?.id),N=XA(s,{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggingNodeRect:y.rect,over:x,overlayNodeRect:y.rect,scrollableAncestors:T,scrollableAncestorRects:I,transform:v,windowRect:R}),F=ub(f),_=cG({config:r,draggableNodes:b,droppableContainers:E,measuringConfiguration:w}),M=F?y.setRef:void 0;return We.createElement(rG,null,We.createElement(tG,{animation:_},d&&A?We.createElement(sG,{key:A,id:d.id,ref:M,as:o,activatorEvent:p,adjustScale:t,className:u,transition:i,rect:F,style:{zIndex:l,...a},transform:N},n):null))}),mG=6e4;function hG(e,t){const n=new Date(e).getTime(),r=t-n,a=Math.floor(r/1e3);if(a<60)return"just now";const i=Math.floor(a/60);if(i<60)return`${i}m ago`;const s=Math.floor(i/60);if(s<24)return`${s}h ago`;const o=Math.floor(s/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function QA({task:e,onClick:t}){const{attributes:n,listeners:r,setNodeRef:a,transform:i,isDragging:s}=KH({id:e.wbs,data:{task:e}}),[o,u]=g.useState(Date.now());g.useEffect(()=>{const p=setInterval(()=>u(Date.now()),mG);return()=>clearInterval(p)},[]);const l=i?{transform:ti.Transform.toString(i),zIndex:s?50:void 0}:void 0;return c.jsx(mi,{variant:"compact",asChild:!0,className:`bg-spur-surface-2 hover:bg-spur-surface-3 rounded-xl border border-spur-border cursor-pointer transition-colors w-full text-left ${s?"opacity-30":""}`,children:c.jsx("button",{ref:a,type:"button",style:l,onClick:()=>t(e.wbs),...r,...n,"aria-roledescription":"draggable card",children:c.jsxs(hi,{className:"p-3 gap-1",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-xs font-mono text-spur-text-muted",children:e.wbs}),e.priority&&c.jsx(st,{variant:"outline",size:"xs",children:e.priority})]}),c.jsx("p",{className:"text-sm font-medium text-spur-text leading-snug",children:e.name}),c.jsxs("div",{className:"flex gap-1 flex-wrap items-center",children:[e.type&&e.type!=="task"&&c.jsx(st,{variant:"outline",size:"xs",children:e.type}),e.featureId&&c.jsx(st,{variant:"outline",size:"xs",children:e.featureId}),e.updatedAt&&c.jsx("span",{className:"text-xs font-mono text-spur-text-muted ml-auto",title:e.updatedAt,children:hG(e.updatedAt,o)})]})]})})})}function gG({status:e,label:t,tasks:n,onCardClick:r,sortDir:a,onSortToggle:i}){const{setNodeRef:s,isOver:o}=eG({id:e,data:{status:e}});return c.jsxs("section",{ref:s,"aria-label":`${t} column`,className:`flex flex-col flex-1 min-w-[16rem] rounded-xl border transition-colors duration-200 ${o?"bg-spur-surface-2 border-spur-accent shadow-lg":"bg-spur-surface border-spur-border"}`,children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border shrink-0",children:[c.jsxs("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:[Yg(e)," ",t]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(st,{variant:"ghost",size:"sm",children:n.length}),i&&c.jsx(He,{variant:"ghost",size:"xs",className:"px-1",onClick:i,"aria-label":`Sort ${t} by WBS`,title:`Sort ${t}: ${a==="asc"?"WBS ↓":a==="desc"?"WBS ↑":"none"}`,children:a==="asc"?"↓":a==="desc"?"↑":"⇅"})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-[4rem]",children:[n.map(u=>c.jsx(QA,{task:u,onClick:r},u.wbs)),n.length===0&&c.jsx("div",{className:"flex items-center justify-center h-16 text-xs text-spur-text-muted italic",children:"No tasks"})]})]})}const bG=[{key:"feature",field:"featureId",label:"Filter by feature",placeholder:"Feature"},{key:"parent",field:"parentWbs",label:"Filter by parent WBS",placeholder:"Parent WBS"},{key:"assignee",field:"assignee",label:"Filter by assignee",placeholder:"Assignee"}];function EG({filters:e,onChange:t}){const n=r=>{t(r.currentTarget.dataset.key,r.currentTarget.value||null)};return c.jsx("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2 border-b border-spur-border",children:bG.map(r=>c.jsx(gs,{"aria-label":r.label,"data-key":r.key,type:"text",placeholder:r.placeholder,variant:"bordered",size:"xs",className:"w-28",value:e[r.field]??"",onChange:n},r.key))})}const yG=g.lazy(()=>dA(()=>import("./TaskDetail.5DIyVQ_N.js"),__vite__mapDeps([2,1]))),ex=va,tx="docs/tasks",nx="spur:detail-width";function xG(e,t){return t?e.filter(n=>!(t.status&&n.status!==t.status||t.featureId&&n.featureId!==t.featureId||t.parentWbs&&n.parentWbs!==t.parentWbs)):e}function TG({onSelectTask:e,filters:t,onFilterChange:n}){const[r,a]=g.useState({}),[i,s]=g.useState(new Set(["blocked","cancelled"])),[o,u]=g.useState(tx),[l,p]=g.useState([{path:tx,label:"Primary"}]),[d,f]=g.useState(null),[m,b]=g.useState(()=>{const Y=typeof window<"u"?Math.min(1728,window.innerWidth*.8):1728;if(typeof window>"u")return Y;try{const le=Number.parseFloat(window.localStorage.getItem(nx)??"");if(Number.isFinite(le)&&le>0)return Math.min(le,window.innerWidth*.8)}catch{}return Y}),E=g.useCallback(()=>_r.task.list({folder:o}),[o]),{tasks:y,loading:x,error:w,connected:T,setTasks:I}=bA(E),[R,v]=g.useState(!1),[A,N]=g.useState(null);g.useEffect(()=>{typeof _r.task.folders=="function"&&_r.task.folders({}).then(Y=>{const{data:le,activeFolder:D}=Y,ke=D??le?.[0]?.path;le&&ke!==void 0&&(p(le),u(ke))}).catch(()=>{})},[]),g.useEffect(()=>{document.documentElement.style.setProperty("--detail-w",`${m}px`)},[m]),g.useEffect(()=>{if(!d)return;const Y=le=>{le.key==="Escape"&&f(null)};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[d]);const F=tr();g.useEffect(()=>{const Y=F.pathname.split("/"),le=Y.indexOf("tasks"),D=le>=0?Y[le+1]:void 0;D&&/^\d{4}$/.test(D)&&f(D)},[F.pathname]);const _=zy(ob,{activationConstraint:{distance:5}}),M=zy(ib),j=Kz(_,M),H=async()=>{try{const Y=await E();I(Y.data??[])}catch{}},Z=xG(y,t),V=Y=>{a(le=>{const D={...le};return le[Y]==="asc"?D[Y]="desc":le[Y]==="desc"?delete D[Y]:D[Y]="asc",D})},ie=Y=>{s(le=>{const D=new Set(le);return D.has(Y)?D.delete(Y):D.add(Y),D})},X=Y=>{const le=Z.filter(ke=>ke.status===Y),D=r[Y]??"desc";return[...le].sort((ke,Le)=>{const ve=ke.wbs.localeCompare(Le.wbs);return D==="asc"?ve:-ve})},re=Y=>y.find(le=>le.wbs===Y),ue=Y=>{N(String(Y.active.id))},k=Y=>{N(null);const{active:le,over:D}=Y;if(!D)return;const ke=String(le.id),Le=String(D.id),ve=re(ke);if(!ve||ve.status===Le)return;const Ue=[...y];I(Ee=>Ee.map(he=>he.wbs===ke?{...he,status:Le}:he)),_r.task.transition({wbs:ke,toStatus:Le}).catch(Ee=>{I(Ue);const he=Ee instanceof Error?Ee.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:he}}))})};return x?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(Tr,{size:"lg",className:"text-spur-accent"})}):w?c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsxs("div",{className:"text-center text-spur-text-muted",children:[c.jsx("p",{className:"text-lg font-semibold",children:"Failed to load tasks"}),c.jsx("p",{className:"text-sm",children:w.message})]})}):c.jsxs(qH,{sensors:j,onDragStart:ue,onDragEnd:k,children:[c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 pb-1 shrink-0",children:[n&&c.jsx(EG,{filters:t??{},onChange:n}),c.jsxs("div",{className:"flex items-center gap-1.5",title:T?"Live updates active":"Polling (stream disconnected)",children:[c.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${T?"bg-spur-success":"bg-spur-error"}`}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:T?"Live":"Polling"})]}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"|"}),c.jsx(Zr,{variant:"ghost",size:"xs",className:"text-xs",value:o,onChange:Y=>u(Y.target.value),"aria-label":"Task folder",children:l.map(Y=>c.jsx("option",{value:Y.path,children:Y.label?`${Y.label} (${Y.path})`:Y.path},Y.path))}),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"|"}),c.jsx("div",{className:"flex-1"}),ex.map(Y=>c.jsxs("label",{htmlFor:`kanban-col-toggle-${Y}`,className:"flex items-center gap-1 cursor-pointer",children:[c.jsx(Lg,{id:`kanban-col-toggle-${Y}`,size:"xs",checked:!i.has(Y),onChange:()=>ie(Y)}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[Yg(Y)," ",Y]})]},Y)),c.jsx("span",{className:"text-xs text-spur-text-muted",children:"|"}),c.jsx(He,{variant:"primary",size:"sm",onClick:()=>v(!0),children:"+ New Task"})]}),c.jsx("div",{className:"flex gap-3 overflow-x-auto h-full p-4",children:ex.filter(Y=>!i.has(Y)).map(Y=>c.jsx(gG,{status:Y,label:Y,tasks:X(Y),onCardClick:le=>{f(le),e(le)},sortDir:r[Y],onSortToggle:()=>V(Y)},Y))}),c.jsx(hA,{open:R,onClose:()=>v(!1),onCreated:H,folder:o}),d&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","aria-label":"Close task detail",className:"fixed inset-0 z-50 bg-black/40 border-0 p-0 cursor-default",onClick:()=>f(null)}),c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Task detail",className:"fixed top-0 right-0 h-full z-50 bg-spur-surface border-l border-spur-border shadow-2xl flex",style:{width:"var(--detail-w)",minWidth:"36rem",maxWidth:"80vw"},children:[c.jsx(iu,{targetVar:"--detail-w",onResizeEnd:Y=>{const le=Math.max(576,Math.min(Y,window.innerWidth*.8));b(le);try{window.localStorage.setItem(nx,String(le))}catch{}},direction:"horizontal",invert:!0}),c.jsx("div",{className:"flex flex-col flex-1 overflow-hidden",children:c.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"detail-body",children:(()=>{const Y=y.find(le=>le.wbs===d);return Y?c.jsx(g.Suspense,{fallback:c.jsx("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:"Loading detail..."}),children:c.jsx(yG,{task:Y,onClose:()=>f(null),onTransition:(le,D)=>{I(ke=>ke.map(Le=>Le.wbs===le?{...Le,status:D}:Le)),_r.task.transition({wbs:le,toStatus:D}).catch(ke=>{const Le=ke instanceof Error?ke.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Le}}))})}})}):null})()})})]})]})]}),c.jsx(fG,{dropAnimation:null,children:A?(()=>{const Y=re(A);return Y?c.jsx("div",{className:"opacity-90",children:c.jsx(QA,{task:Y,onClick:()=>{}})}):null})():null})]})}function SG(){const[e,t]=P_(),n=tr(),r=Su(),a=g.useMemo(()=>{const u=n.pathname.split("/"),l=u.indexOf("tasks"),p=l>=0?u[l+1]:void 0;return p&&/^\d{4}$/.test(p)?p:e.get("selected")},[n.pathname,e]),i=g.useMemo(()=>{const u={},l=e.get("status"),p=e.get("feature"),d=e.get("parent"),f=e.get("assignee");return l&&(u.status=l),p&&(u.featureId=p),d&&(u.parentWbs=d),f&&(u.assignee=f),u},[e]);return{selected:a,filters:i,selectTask:u=>{const l=new URLSearchParams(e);l.delete("selected");const p=l.toString(),d=u?`/board/tasks/${u}`:"/board/tasks";r(`${d}${p?`?${p}`:""}`,{replace:!0})},setFilter:(u,l)=>{t(p=>{const d=new URLSearchParams(p);return l?d.set(u,l):d.delete(u),d},{replace:!0})}}}function AG(e,t){_r.task.transition({wbs:e,toStatus:t}).catch(n=>{const r=n instanceof Error?n.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:r}}))})}function lb(){const{filters:e,selectTask:t,setFilter:n}=SG();return c.jsx("div",{className:"task-kanban flex flex-col h-full",children:c.jsx("div",{"data-kanban-board":!0,className:"flex-1 overflow-hidden",children:c.jsx(TG,{onSelectTask:t,filters:e,onFilterChange:n})})})}const vG={id:"tasks",name:"Tasks",icon:"📋",route:"tasks",component:lb},wG=Object.freeze(Object.defineProperty({__proto__:null,TaskKanbanView:lb,module:vG,transition:AG},Symbol.toStringTag,{value:"Module"}));function JA(e){const t=new Map;for(const n of e)for(const r of n.members)t.set(r.id,{teamId:n.teamId,memberLabel:r.id,agentType:r.type});return t}function ev(e,t){if(e.teamId&&e.memberLabel&&e.agentType)return e;const n=e.memberLabel??e.actor;if(!n)return e;const r=t.get(n);return r?{...e,teamId:e.teamId??r.teamId,memberLabel:e.memberLabel??r.memberLabel,agentType:e.agentType??r.agentType}:e}const cd=100;function tv(e,t){const n=[t,...e??[]];return n.length>cd&&(n.length=cd),n}const nv=()=>`${et()}/events/history?limit=${cd}`,rv=()=>`${et()}/events/planning`,_G=["agent.","message.","team.","supervisor.","process."];function NG(e){return _G.some(t=>e.startsWith(t))}function cb(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||typeof t.occurredAt!="string"||!NG(t.eventName))return null;const n=t.payload!==null&&typeof t.payload=="object"?t.payload:null,r=n&&typeof n.teamId=="string"&&n.teamId.length>0?n.teamId:void 0,a=n&&typeof n.agentType=="string"&&n.agentType.length>0?n.agentType:void 0,i=n&&typeof n.memberLabel=="string"&&n.memberLabel.length>0?n.memberLabel:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:void 0,s=typeof t.actor=="string"&&t.actor.length>0?t.actor:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:null;return{id:typeof t.id=="string"?t.id:`${t.eventName}-${t.occurredAt}`,eventName:t.eventName,occurredAt:t.occurredAt,actor:s,...r?{teamId:r}:{},...i?{memberLabel:i}:{},...a?{agentType:a}:{}}}function av(e){if(e===null||typeof e!="object"||!("events"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=[];for(const r of t){const a=cb(r);a&&n.push(a)}return n}function CG({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),{teams:i}=Ei(),s=g.useMemo(()=>JA(i),[i]),o=g.useCallback(async()=>{try{const l=await Ke(new Request(nv()));if(!l.ok)throw new Error(`events fetch failed: ${l.status}`);const p=av(await l.json());if(!p)throw new Error("events response failed schema validation");n(p)}catch(l){a(l instanceof Error?l.message:String(l))}},[]);g.useEffect(()=>{o()},[o]),g.useEffect(()=>{if(typeof EventSource>"u")return;const l=new EventSource(rv());return l.onmessage=p=>{try{const d=cb(JSON.parse(p.data));d&&n(f=>tv(f,d))}catch{}},()=>l.close()},[]);const u=g.useMemo(()=>t===null?null:t.map(l=>ev(l,s)).filter(l=>!e||l.teamId===e),[t,s,e]);return r?c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load activity: ",r]}):u===null?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading activity…"}):c.jsx("div",{className:"flex flex-col h-full overflow-y-auto","data-activity-tab":!0,children:u.length===0?c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic",children:"No team activity yet."}):c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{className:"sticky top-0 bg-base-200",children:c.jsxs("tr",{className:"text-left text-spur-text-muted",children:[c.jsx("th",{className:"px-3 py-1 font-medium",children:"Time"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Event"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Team"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Member"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Agent"}),c.jsx("th",{className:"px-3 py-1 font-medium",children:"Actor"})]})}),c.jsx("tbody",{children:u.map(l=>c.jsxs("tr",{className:"border-t border-spur-border","data-activity-row":l.eventName,children:[c.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:l.occurredAt}),c.jsx("td",{className:"px-3 py-1 text-spur-text",children:l.eventName}),c.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:l.teamId??"—"}),c.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:l.memberLabel??"—"}),c.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:l.agentType??"—"}),c.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:l.actor??"system"})]},l.id))})]})})}const IG=3e3,kG=()=>`${et()}/team/processes`;function RG(e,t){const n=e.map(i=>({key:`sup:${i.agentId}`,label:i.agentId,agentId:i.agentId,pid:i.pid,status:i.status,startedAt:i.startedAt,source:"supervisor",teamId:i.teamId??null})),r=new Set(e.map(i=>i.agentId)),a=new Set(e.map(i=>i.pid).filter(i=>i!=null));for(const i of t)i.agentId&&r.has(i.agentId)||i.pid!=null&&a.has(i.pid)||n.push({key:`reg:${i.id}`,label:i.label||i.command,agentId:i.agentId??void 0,pid:i.pid,status:i.status,startedAt:i.startedAt,source:i.source,teamId:i.teamId??null});return n}function DG(e,t){return e.filter(n=>{if(t.runningOnly&&n.status!=="running")return!1;if(t.source==="other"){if(n.source==="supervisor"||n.source==="one-shot")return!1}else if(t.source!=="all"&&n.source!==t.source)return!1;if(t.team==="unassigned"){if(n.teamId!=null)return!1}else if(t.team!=="all"&&n.teamId!==t.team)return!1;return!0})}function rx({filters:e,onFilters:t,teamIds:n,totalCount:r,shownCount:a}){return c.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-2 text-xs","data-processes-filters":!0,children:[c.jsxs("label",{className:"flex items-center gap-1","data-processes-filter-running":!0,children:[c.jsx("input",{type:"checkbox",checked:e.runningOnly,onChange:i=>t({...e,runningOnly:i.target.checked}),"data-processes-filter-running-input":!0}),c.jsx("span",{children:"Running only"})]}),c.jsxs("label",{className:"flex items-center gap-1",children:[c.jsx("span",{children:"Source"}),c.jsxs("select",{value:e.source,onChange:i=>t({...e,source:i.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-source":!0,"aria-label":"Source filter",children:[c.jsx("option",{value:"all",children:"all"}),c.jsx("option",{value:"supervisor",children:"supervisor"}),c.jsx("option",{value:"one-shot",children:"one-shot"}),c.jsx("option",{value:"other",children:"other"})]})]}),c.jsxs("label",{className:"flex items-center gap-1",children:[c.jsx("span",{children:"Team"}),c.jsxs("select",{value:e.team,onChange:i=>t({...e,team:i.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-team":!0,"aria-label":"Team filter",children:[c.jsx("option",{value:"all",children:"all teams"}),c.jsx("option",{value:"unassigned",children:"unassigned"}),n.map(i=>c.jsx("option",{value:i,children:i},i))]})]}),c.jsx("button",{type:"button",className:"border border-spur-border rounded px-2 py-0.5 text-spur-text hover:bg-base-200 transition-colors cursor-pointer",onClick:()=>t({runningOnly:!1,source:"all",team:"all"}),"data-processes-filter-clear":!0,children:"Clear"}),c.jsxs("span",{className:"text-spur-text-muted","data-processes-filter-count":!0,children:[a,"/",r," shown"]})]})}function OG({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),[i,s]=g.useState({runningOnly:!1,source:"all",team:"all"}),o=g.useRef(!0),u=g.useCallback(async b=>{try{const E=await Ke(new Request(kG(),{signal:b}));if(!E.ok)throw new Error(`processes fetch failed: ${E.status}`);const x=await E.json();o.current&&(n({processes:x.processes??[],count:x.count??0,executions:x.executions??[],executionsCount:x.executionsCount??0}),a(null))}catch(E){if(b.aborted)return;o.current&&a(E instanceof Error?E.message:String(E))}},[]);g.useEffect(()=>{o.current=!0;let b=null;const E=()=>{b?.abort(),b=new AbortController,u(b.signal)};E();const y=setInterval(E,IG);return()=>{o.current=!1,b?.abort(),clearInterval(y)}},[u]);const l=g.useMemo(()=>t?RG(t.processes,t.executions):[],[t]),p=g.useMemo(()=>{const b=e?l.filter(E=>E.teamId===e):l;return DG(b,i)},[l,i,e]),d=g.useMemo(()=>{const b=new Set;for(const E of t?.processes??[])E.teamId&&b.add(E.teamId);for(const E of t?.executions??[])E.teamId&&b.add(E.teamId);return[...b].sort()},[t]);if(r&&(!t||l.length===0))return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-processes-tab-error":!0,children:["Failed to load processes: ",r]});if(!t)return c.jsx("div",{className:"p-4","data-processes-tab-loading":!0,children:c.jsx(Tr,{size:"sm"})});if(l.length===0)return c.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-empty":!0,children:["No processes. Start a team agent from the Terminal tab or via"," ",c.jsx("code",{className:"font-mono",children:"spur team start"}),"."]});if(p.length===0)return c.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,"data-processes-tab-filtered-empty":!0,children:[c.jsx(rx,{filters:i,onFilters:s,teamIds:d,totalCount:l.length,shownCount:0}),c.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-no-matches":!0,children:"No processes match the current filters. Adjust or clear filters to see rows."})]});const f=t.processes.length,m=Math.max(0,l.length-f);return c.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,children:[c.jsx(rx,{filters:i,onFilters:s,teamIds:d,totalCount:l.length,shownCount:p.length}),c.jsxs("div",{className:"flex items-center gap-2 mb-2 text-xs text-spur-text-muted",children:[c.jsxs("span",{"data-processes-header":!0,children:["Process watch list (",l.length,f>0||m>0?` · ${f} supervised${m>0?` · ${m} other`:""}`:"",")"]}),c.jsx("span",{className:"italic",children:"— ProcessExecutor registry (ts-runtime)"})]}),c.jsxs("table",{className:"table table-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Name"}),c.jsx("th",{children:"Source"}),c.jsx("th",{children:"Team"}),c.jsx("th",{children:"PID"}),c.jsx("th",{children:"Status"}),c.jsx("th",{children:"Started"})]})}),c.jsx("tbody",{children:p.map(b=>{const E=b.status==="running";return c.jsxs("tr",{"data-processes-row":b.key,children:[c.jsx("td",{className:"font-mono text-xs",children:b.label}),c.jsx("td",{className:"text-xs text-spur-text-muted","data-process-source":b.source,children:b.source}),c.jsx("td",{className:"font-mono text-xs text-spur-text-muted","data-process-team":b.teamId??"",children:b.teamId??"—"}),c.jsx("td",{className:"font-mono text-xs text-spur-text-muted",children:b.pid??"—"}),c.jsx("td",{children:c.jsx(st,{variant:E?"success":"ghost",size:"xs",children:b.status})}),c.jsx("td",{className:"text-xs text-spur-text-muted",children:new Date(b.startedAt).toLocaleTimeString()})]},b.key)})})]})]})}const LG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/start`,FG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/stop`,MG=e=>`${et()}/team/${encodeURIComponent(e)}/up`,PG=e=>`${et()}/team/${encodeURIComponent(e)}/down`;function BG(e){if(e<0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),a=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:a>0?`${a}m ${i}s`:`${i}s`}function ax(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function UG(e){const t=new Map;for(const n of e){if(!n.teamId||!n.memberLabel)continue;const r=`${n.teamId}:${n.memberLabel}`;let a=t.get(r);a||(a={startedAt:null,lastActivity:null},t.set(r,a)),n.eventName==="team.member.started"&&(!a.startedAt||n.occurredAt>a.startedAt)&&(a.startedAt=n.occurredAt),(!a.lastActivity||n.occurredAt>a.lastActivity.time)&&(a.lastActivity={time:n.occurredAt,eventName:n.eventName})}return t}function jG({teamId:e}){const{teams:t,error:n,reload:r}=Ei(),[a,i]=g.useState(null),[s,o]=g.useState(null),[u,l]=g.useState(!1),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(null),[y,x]=g.useState(()=>Date.now()),w=g.useMemo(()=>e?t.filter(N=>N.teamId===e):t,[t,e]),T=g.useMemo(()=>JA(w),[w]);g.useEffect(()=>{let N=!1;return(async()=>{try{const F=await Ke(new Request(nv()));if(N)return;if(!F.ok)throw new Error(`events fetch failed: ${F.status}`);const _=av(await F.json());if(N)return;if(!_)throw new Error("events response failed schema validation");i(_)}catch(F){if(N)return;o(F instanceof Error?F.message:String(F))}})(),()=>{N=!0}},[]),g.useEffect(()=>{if(typeof EventSource>"u")return;const N=new EventSource(rv());return N.onmessage=F=>{try{const _=cb(JSON.parse(F.data));_&&i(M=>tv(M,_))}catch{}},()=>N.close()},[]),g.useEffect(()=>{const N=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(N)},[]);const I=g.useMemo(()=>a===null?null:a.map(N=>ev(N,T)).filter(N=>!e||N.teamId===e),[a,T,e]),R=g.useMemo(()=>I===null?new Map:UG(I),[I]),v=g.useCallback(async(N,F)=>{l(!0),d(null);try{const _=F?FG(N):LG(N),M=await Ke(new Request(_,{method:"POST"}));if(!M.ok){const j=await M.json().catch(()=>null),H=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${M.status})`;d(H)}}catch(_){d(_ instanceof Error?_.message:String(_))}finally{l(!1),r()}},[r]),A=g.useCallback(async(N,F)=>{l(!0),d(null);try{const _=F==="up"?MG(N):PG(N),M=await Ke(new Request(_,{method:"POST"}));if(!M.ok){const j=await M.json().catch(()=>null),H=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${M.status})`;d(H)}}catch(_){d(_ instanceof Error?_.message:String(_))}finally{l(!1),r()}},[r]);return c.jsxs("div",{className:"flex flex-col h-full overflow-y-auto","data-supervisor-tab":!0,children:[n&&w.length===0?c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-supervisor-tab-error":!0,children:["Failed to load teams: ",n,". Event-derived activity remains available below."]}):n&&c.jsxs("div",{className:"px-3 py-1 text-xs text-error bg-error/10 border-b border-error/30",role:"alert","data-supervisor-roster-error":!0,children:["Roster feed error: ",n,". Showing last-known state."]}),w.length===0&&!n&&c.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-supervisor-tab-loading":!0,children:"Loading teams…"}),p&&c.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-supervisor-action-error":!0,children:p}),s&&c.jsxs("div",{className:"px-3 py-1 text-xs text-warning",role:"alert","data-supervisor-event-error":!0,children:["Activity feed error: ",s,". Live updates may be delayed."]}),c.jsx("div",{className:"p-2 space-y-2",children:w.map(N=>c.jsx(mi,{variant:"compact",className:"bg-base-200 border border-spur-border",children:c.jsxs(hi,{className:"p-3 gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:N.name}),c.jsx(st,{variant:"outline",size:"xs",children:N.teamId}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[N.members.length," member(s)"]}),c.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>{A(N.teamId,"up")},"data-supervisor-team-up":N.teamId,children:"Up"}),c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>E(N.teamId),"data-supervisor-team-down":N.teamId,children:"Down"})]})]}),N.members.length===0?c.jsx("div",{className:"text-xs text-spur-text-muted italic py-2","data-supervisor-empty-roster":N.teamId,children:"No members configured for this team."}):c.jsx("ul",{className:"space-y-1",children:N.members.map(F=>{const _=F.status==="running",M=`${N.teamId}:${F.id}`,j=R.get(M),H=_&&j?.startedAt?BG(y-Date.parse(j.startedAt)):"-",Z=j?.lastActivity??null;return c.jsxs("li",{className:"text-xs flex items-center gap-2 flex-wrap py-1 border-b border-spur-border/50 last:border-b-0","data-supervisor-member-row":F.id,children:[c.jsx(st,{variant:_?"success":"ghost",size:"xs",children:F.status}),c.jsx("span",{className:"font-mono text-spur-text",children:F.id}),c.jsx(st,{variant:"outline",size:"xs",children:F.type}),c.jsx(st,{variant:F.role!==void 0?"accent":"ghost",size:"xs","data-supervisor-member-role":F.id,children:F.role??"unset"}),c.jsxs("span",{className:"text-[10px] text-spur-text-muted font-mono","data-supervisor-uptime":F.id,children:["up ",H]}),Z?c.jsxs("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":F.id,children:["last: ",ax(Z.time)," (",Z.eventName,")"]}):c.jsx("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":F.id,children:"last: -"}),c.jsx(He,{type:"button",variant:_?"ghost":"primary",size:"xs",disabled:u,className:"ml-auto",onClick:()=>{_?m(F.id):v(F.id,!1)},"data-supervisor-toggle":F.id,children:_?"Stop":"Start"})]},F.id)})})]})},N.teamId))}),I!==null&&c.jsxs("section",{className:"border-t border-spur-border bg-base-300/40","aria-label":"Recent team activity","data-supervisor-activity":!0,children:[c.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted",children:"Recent team activity"}),I.length===0?c.jsx("div",{className:"px-3 pb-3 text-xs text-spur-text-muted italic",children:"No team activity yet."}):c.jsx("ul",{className:"px-3 pb-3 space-y-1",children:I.slice(0,20).map(N=>c.jsxs("li",{className:"flex items-center gap-2 flex-wrap text-[10px] text-spur-text-muted","data-supervisor-activity-row":N.eventName,children:[c.jsx("span",{className:"font-mono",children:ax(N.occurredAt)}),c.jsx(st,{variant:"outline",size:"xs",children:N.eventName}),N.teamId&&c.jsx("span",{children:N.teamId}),N.memberLabel&&c.jsx("span",{className:"font-mono",children:N.memberLabel}),N.actor&&c.jsx("span",{children:N.actor})]},N.id))})]}),c.jsxs(Xo,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-stop-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",c.jsx("span",{className:"font-mono",children:f})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!f)return;const N=f;m(null),v(N,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),c.jsxs(Xo,{open:b!==null,variant:"warning",onClose:()=>E(null),"data-down-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",c.jsx("span",{className:"font-mono",children:b}),"."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(null),"data-down-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!b)return;const N=b;E(null),A(N,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const xo=1e3,xc=[1e3,2e3,4e3,8e3,15e3],$G=15e3;function zG(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.stream!="string"||typeof t.ts!="string"||typeof t.line!="string")return null;const n=t.stream;if(n!=="stdout"&&n!=="stderr"&&n!=="meta")return null;const r=t.seq;return r!==void 0&&typeof r!="number"?null:{stream:n,ts:t.ts,line:t.line,...r!==void 0?{seq:r}:{}}}function HG(e){return e<0?xc[0]:e>=xc.length?$G:xc[e]}function ix(e,t,n){if(t.seq===void 0){const a=[...e,t];return a.length>xo&&a.splice(0,a.length-xo),{frames:a,lastSeq:n}}if(t.seq<=n)return{frames:e,lastSeq:n};const r=[...e,t];return r.length>xo&&r.splice(0,r.length-xo),{frames:r,lastSeq:t.seq}}const GG=(e,t)=>t!==void 0?`${et()}/team/processes/${encodeURIComponent(e)}/stream?sinceSeq=${t}`:`${et()}/team/processes/${encodeURIComponent(e)}/stream`,WG=3e3;function VG(e){if(e===null||typeof e!="object")return null;const t=e;if(!Array.isArray(t.processes))return null;const n=[];for(const r of t.processes){if(r===null||typeof r!="object")return null;const a=r;if(typeof a.agentId!="string"||typeof a.status!="string"||typeof a.startedAt!="string"||typeof a.pid!="number")return null;const i=a.exitCode;if(i!==null&&typeof i!="number")return null;n.push({agentId:a.agentId,pid:a.pid,status:a.status,startedAt:a.startedAt,exitCode:i})}return n}const qG=e=>`${et()}/team/processes/${encodeURIComponent(e)}/stdin`,YG=()=>`${et()}/messages`,ZG=()=>`${et()}/team/processes`;function KG({agentId:e}){const[t,n]=g.useState([]),[r,a]=g.useState("unknown"),[i,s]=g.useState(""),[o,u]=g.useState(null),[l,p]=g.useState(!1),d=g.useRef(-1),f=g.useRef(null),m=g.useRef(void 0),b=g.useRef(0),E=g.useRef(!0),y=g.useRef(null),x=g.useCallback(async v=>{try{const A=await Ke(new Request(ZG(),{signal:v}));if(!A.ok)return;const N=await A.json(),F=VG(N);if(!F)return;const _=F.find(M=>M.agentId===e);_&&E.current&&a(_.status)}catch{}},[e]);g.useEffect(()=>{E.current=!0;let v=null;const A=()=>{v?.abort(),v=new AbortController,x(v.signal)};A();const N=setInterval(A,WG);return()=>{E.current=!1,v?.abort(),clearInterval(N)}},[x]);const w=g.useCallback(()=>{if(!E.current)return;const v=new EventSource(GG(e,d.current>-1?d.current:void 0));f.current=v,v.onmessage=A=>{try{const N=JSON.parse(A.data),F=zG(N);if(!F)return;n(_=>{const M=ix(_,F,d.current);return d.current=M.lastSeq,M.frames}),b.current=0,p(!0)}catch{}},v.onerror=()=>{if(v.close(),f.current=null,p(!1),!E.current)return;const A=HG(b.current);b.current+=1,m.current=setTimeout(w,A)}},[e]);g.useEffect(()=>(w(),()=>{E.current=!1,f.current?.close(),f.current=null,m.current&&clearTimeout(m.current)}),[w]),g.useEffect(()=>{y.current&&t.length>0&&(y.current.scrollTop=y.current.scrollHeight)},[t]);const T=g.useCallback(async()=>{const v=i;if(v.length===0)return;u(null);const A={stream:"meta",ts:new Date().toISOString(),line:`> ${v}`};n(N=>ix(N,A,d.current).frames);try{const N=await Ke(new Request(qG(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({line:v})}));if(Ke(new Request(YG(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"terminal",to:e,body:v})})).catch(()=>{}),!N.ok){const _=(await N.json().catch(()=>null))?.error??`stdin POST failed: ${N.status}`;u(_);return}s("")}catch(N){u(N instanceof Error?N.message:String(N))}},[e,i]),I=r==="running",R=v=>{v.key==="Enter"&&I&&(v.preventDefault(),T())};return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-member-terminal":e,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Terminal"}),c.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e}),c.jsx(st,{variant:I?"success":"ghost",size:"xs","data-terminal-status":!0,children:r}),c.jsx("span",{className:"text-[10px] text-spur-text-muted","data-terminal-connected":!0,children:l?"connected":"reconnecting…"})]}),!I&&c.jsxs("div",{className:"px-4 py-1 text-xs text-warning border-b border-spur-border",role:"status","data-status-banner":!0,children:["Member is ",r," — input disabled."]}),c.jsx("pre",{ref:y,className:"flex-1 overflow-y-auto p-2 text-xs font-mono leading-snug bg-base-100","data-terminal-output":!0,children:t.length===0?c.jsxs("span",{className:"text-spur-text-muted italic",children:["Waiting for output from ",e,"…"]}):t.map((v,A)=>c.jsx("div",{className:v.stream==="stderr"?"text-error":v.stream==="meta"?"text-spur-text-muted italic":"text-spur-text","data-stream":v.stream,children:v.line},v.seq??`meta-${A}`))}),o&&c.jsx("div",{className:"px-4 py-1 text-xs text-error border-t border-spur-border",role:"alert","data-input-error":!0,children:o}),c.jsx("div",{className:"flex items-center gap-2 px-2 py-2 border-t border-spur-border bg-base-200 shrink-0",children:c.jsx("input",{type:"text",value:i,onChange:v=>s(v.target.value),onKeyDown:R,disabled:!I,placeholder:I?"Type a line and press Enter…":"Input disabled (member not running)",className:"flex-1 input input-sm font-mono","data-terminal-input":!0})})]})}const XG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/start`,QG=e=>`${et()}/team/agents/${encodeURIComponent(e)}/stop`,JG=e=>`${et()}/team/${encodeURIComponent(e)}/up`,eW=e=>`${et()}/team/${encodeURIComponent(e)}/down`,db="spur:board:teams:lastTerminal";function tW(){try{const e=globalThis.localStorage?.getItem(db);if(!e)return null;const t=JSON.parse(e);if(t&&typeof t=="object"&&"teamId"in t&&"memberId"in t&&typeof t.teamId=="string"&&typeof t.memberId=="string"){const n=t;return{teamId:n.teamId,memberId:n.memberId}}}catch{}return null}function nW(e){try{globalThis.localStorage?.setItem(db,JSON.stringify(e))}catch{}}function rW(){try{globalThis.localStorage?.removeItem(db)}catch{}}function aW({teamId:e}){const{teams:t,error:n,reload:r}=Ei(),[a,i]=g.useState(""),[s,o]=g.useState(""),[u,l]=g.useState(null),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(!1),[y]=g.useState({done:!1}),x=g.useMemo(()=>e?t.filter(F=>F.teamId===e):t,[t,e]),w=e??a;g.useEffect(()=>{if(y.done||x.length===0)return;y.done=!0;const F=tW();if(!F)return;const _=x.find(j=>j.teamId===F.teamId),M=_?.members.find(j=>j.id===F.memberId);if(!_||!M){rW();return}i(F.teamId),o(F.memberId)},[x,y]);const T=x.find(F=>F.teamId===w),I=T?.members.find(F=>F.id===s)??null;g.useEffect(()=>{s&&T&&!T.members.some(F=>F.id===s)&&o("")},[s,T]),g.useEffect(()=>{w&&s&&nW({teamId:w,memberId:s})},[w,s]);const R=g.useCallback(async(F,_)=>{E(!0);try{const M=_?QG(F):XG(F),j=await Ke(new Request(M,{method:"POST"}));if(!j.ok){const H=await j.json().catch(()=>null),Z=H&&typeof H=="object"&&"error"in H&&typeof H.error=="string"?H.error:`request failed (${j.status})`;l(Z)}}catch(M){l(M instanceof Error?M.message:String(M))}finally{E(!1),r()}},[r]),v=g.useCallback(async(F,_)=>{E(!0),l(null);try{const M=_==="up"?JG(F):eW(F),j=await Ke(new Request(M,{method:"POST"}));if(!j.ok){const H=await j.json().catch(()=>null),Z=H&&typeof H=="object"&&"error"in H&&typeof H.error=="string"?H.error:`request failed (${j.status})`;l(Z)}}catch(M){l(M instanceof Error?M.message:String(M))}finally{E(!1),r()}},[r]),A=g.useCallback(F=>{o(F)},[]);if(n&&x.length===0)return c.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-terminal-tab-error":!0,children:["Failed to load teams: ",n]});if(x.length===0)return c.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-terminal-tab-empty":!0,children:["No teams defined in ",c.jsx("code",{className:"font-mono",children:".spur/config.yaml"}),". Configure"," ",c.jsx("code",{className:"font-mono",children:"agent.team"})," entries to open a terminal."]});const N=I?.status==="running";return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-terminal-tab":!0,children:[c.jsxs("div",{className:"px-3 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center justify-between","data-terminal-toolbar":!0,children:[c.jsxs("div",{className:"flex items-center gap-2","data-terminal-focus":!0,children:[c.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-team-select",children:[c.jsx("span",{className:"text-spur-text-muted",children:"Team"}),c.jsxs(Zr,{id:"terminal-team-select",variant:"bordered",size:"sm",disabled:!!e,value:w,onChange:F=>{i(F.target.value),o("")},"data-terminal-team-select":!0,children:[!e&&c.jsx("option",{value:"",children:"Select team…"}),x.map(F=>c.jsx("option",{value:F.teamId,children:F.name},F.teamId))]})]}),c.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-member-select",children:[c.jsx("span",{className:"text-spur-text-muted",children:"Member"}),c.jsxs(Zr,{id:"terminal-member-select",variant:"bordered",size:"sm",value:s,onChange:F=>o(F.target.value),disabled:!T,"data-terminal-member-select":!0,children:[c.jsx("option",{value:"",children:"Select member…"}),T?.members.map(F=>c.jsxs("option",{value:F.id,children:[F.id," · ",F.type]},F.id))]})]}),I?.model?c.jsx("span",{className:"text-xs text-spur-text-muted font-mono","data-terminal-model":!0,children:I.model}):null,I&&c.jsxs(c.Fragment,{children:[c.jsx(st,{variant:N?"success":"ghost",size:"xs","data-terminal-status-badge":!0,children:I.status}),c.jsx(He,{type:"button",variant:N?"warning":"primary",size:"xs",disabled:b,onClick:()=>{N?d(I.id):R(I.id,!1)},"data-terminal-toggle-btn":!0,children:N?"Stop":"Start"})]})]}),c.jsxs("div",{className:"flex items-center gap-2","data-terminal-roster":!0,children:[T?.members.map(F=>c.jsx("button",{type:"button",title:`${F.id} · ${F.type}`,onClick:()=>A(F.id),className:"cursor-pointer p-0 bg-transparent border-0","data-terminal-roster-chip":!0,children:c.jsx(st,{variant:F.id===s?"accent":F.status==="running"?"success":"ghost",size:"xs",children:F.id})},F.id)),c.jsx("div",{className:"border-l border-spur-border mx-1 h-5","aria-hidden":"true"}),c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:b||!T,onClick:()=>T&&v(T.teamId,"up"),"data-terminal-up-btn":!0,children:"Up"}),c.jsx(He,{type:"button",variant:"ghost",size:"xs",disabled:b||!T,onClick:()=>T&&m(T.teamId),"data-terminal-down-btn":!0,children:"Down"})]})]}),u&&c.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-terminal-tab-action-error":!0,children:u}),s&&I?c.jsx(KG,{agentId:s}):c.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-terminal-tab-prompt":!0,children:"Choose a team and member above to open a terminal."}),c.jsxs(Xo,{open:p!==null,variant:"warning",onClose:()=>d(null),"data-stop-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",c.jsx("span",{className:"font-mono",children:p})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!p)return;const F=p;d(null),R(F,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),c.jsxs(Xo,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-down-confirm-modal":!0,children:[c.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),c.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",c.jsx("span",{className:"font-mono",children:f}),"."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-down-confirm-cancel":!0,children:"Cancel"}),c.jsx(He,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!f)return;const F=f;m(null),v(F,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const sx=[{id:"supervisor",label:"Supervisor",component:jG},{id:"terminal",label:"Terminal",component:aW},{id:"processes",label:"Process",component:OG},{id:"activity",label:"Activity",component:CG}];function iv({teamId:e}){const[t,n]=g.useState("supervisor"),a=sx.find(i=>i.id===t)?.component;return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-teams-shell":!0,children:[c.jsx("div",{role:"tablist","aria-label":"Teams tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-base-200 shrink-0",children:sx.map(i=>{const s=i.id===t;return c.jsx("button",{type:"button",role:"tab","aria-selected":s,"aria-controls":`teams-tab-panel-${i.id}`,id:`teams-tab-${i.id}`,onClick:()=>n(i.id),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${s?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-base-300"}`,children:i.label},i.id)})}),c.jsx("div",{role:"tabpanel",id:`teams-tab-panel-${t}`,"aria-labelledby":`teams-tab-${t}`,className:"flex-1 overflow-hidden",children:a?c.jsx(a,{teamId:e}):null})]})}const iW={id:"teams",name:"Teams",icon:"👥",route:"teams",component:iv,sidebarLabel:"Teams",order:2},sW=Object.freeze(Object.defineProperty({__proto__:null,module:iW},Symbol.toStringTag,{value:"Module"}));function oW(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function uW({teamId:e}){const{teams:t}=Ei(),n=e?t.find(r=>r.teamId===e):t.find(r=>r.isCurrentProject);return n?c.jsxs("div",{className:"flex flex-col h-full overflow-y-auto bg-spur-bg","data-workspace-overview":!0,children:[c.jsxs("div",{className:"px-4 py-3 border-b border-spur-border bg-spur-surface",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-sm font-semibold text-spur-text","data-workspace-overview-name":!0,children:n.name}),c.jsx(st,{variant:"outline",size:"xs",children:n.teamId}),c.jsx(st,{variant:n.isCurrentProject?"success":"ghost",size:"xs",children:"current project"})]}),n.workDir&&c.jsx("div",{className:"mt-1 font-mono text-xs text-spur-text-muted","data-workspace-overview-workdir":!0,children:n.workDir})]}),c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted mb-2",children:"Members"}),n.members.length===0?c.jsx("div",{className:"text-xs text-spur-text-muted italic","data-workspace-overview-no-members":!0,children:"No members materialized for this team yet."}):c.jsx("ul",{className:"space-y-1",children:n.members.map(r=>c.jsxs("li",{className:"text-xs flex items-center gap-2 py-1 border-b border-spur-border/50 last:border-b-0","data-workspace-overview-member":r.id,children:[c.jsx(st,{variant:r.status==="running"?"success":"ghost",size:"xs",children:r.status}),c.jsx("span",{className:"font-mono text-spur-text",children:r.id}),c.jsx(st,{variant:"outline",size:"xs",children:r.type}),r.model&&c.jsx("span",{className:"font-mono text-[10px] text-spur-text-muted",children:r.model})]},r.id))}),c.jsxs("div",{className:"mt-3 text-[10px] text-spur-text-faint",children:["Last refresh: ",oW(new Date().toISOString())]})]})]}):c.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-workspace-overview-empty":!0,children:"No team selected for this workspace."})}const ox=[{id:"overview",label:"Overview",component:uW},{id:"team",label:"Team",component:iv},{id:"inbox",label:"Inbox",component:_A},{id:"tasks",label:"Tasks",component:lb}];function lW(){const{teams:e}=Ei(),t=g.useMemo(()=>e.filter(l=>l.isCurrentProject),[e]),[n,r]=g.useState(""),[a,i]=g.useState("overview");g.useEffect(()=>{!n&&t.length>0&&r(t[0]?.teamId??"")},[t,n]);const s=t.find(l=>l.teamId===n)??null,u=ox.find(l=>l.id===a)?.component;return t.length===0?c.jsxs("div",{className:"workspace flex flex-col h-full items-center justify-center gap-3 p-6 bg-spur-bg","data-workspace-empty":!0,children:[c.jsx("div",{className:"text-sm font-semibold text-spur-text",children:"No project-local team"}),c.jsxs("p",{className:"text-xs text-spur-text-muted max-w-sm text-center",children:["No configured team resolves to this project's working directory. Add an"," ",c.jsx("code",{className:"font-mono",children:"agent.team"})," entry in"," ",c.jsx("code",{className:"font-mono",children:".spur/config.yaml"})," whose"," ",c.jsx("code",{className:"font-mono",children:"work_dir"})," points at the current project to compose a Workspace."]})]}):c.jsxs("div",{className:"workspace flex flex-col h-full overflow-hidden bg-spur-bg","data-workspace-shell":!0,children:[c.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Workspace"}),c.jsx("select",{value:s?.teamId??"",onChange:l=>{r(l.target.value),i("overview")},"aria-label":"Workspace team","data-workspace-team-select":!0,className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text text-xs",children:t.map(l=>c.jsx("option",{value:l.teamId,children:l.name},l.teamId))})]}),c.jsx("div",{role:"tablist","aria-label":"Workspace tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:ox.map(l=>{const p=l.id===a;return c.jsx("button",{type:"button",role:"tab","aria-selected":p,"aria-controls":`workspace-tab-panel-${l.id}`,id:`workspace-tab-${l.id}`,onClick:()=>i(l.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${p?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-workspace-tab":!0,children:l.label},l.id)})}),c.jsx("div",{role:"tabpanel",id:`workspace-tab-panel-${a}`,"aria-labelledby":`workspace-tab-${a}`,className:"flex-1 overflow-hidden",children:u?c.jsx(u,{teamId:s?.teamId}):null})]})}const cW={id:"workspace",name:"Workspace",icon:"🧩",route:"workspace",component:lW,sidebarLabel:"Workspace",order:0},dW=Object.freeze(Object.defineProperty({__proto__:null,module:cW},Symbol.toStringTag,{value:"Module"}));function sv(e){return e===null||typeof e!="object"?null:"module"in e&&ux(e.module)?e.module:"default"in e&&ux(e.default)?e.default:null}function ux(e){return e===null||typeof e!="object"?!1:"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"&&"icon"in e&&typeof e.icon=="string"&&"route"in e&&typeof e.route=="string"&&"component"in e&&typeof e.component=="function"}function ov(e,t){const n=typeof e.order=="number",r=typeof t.order=="number";return n&&r?e.order-t.order:n?-1:r?1:0}function pW(e){const t=[],n=e("./*/index.{ts,tsx}",{eager:!0});for(const r of Object.values(n)){const a=sv(r);a&&t.push(a)}return t.sort((r,a)=>r.id.localeCompare(a.id)),t.sort(ov),t}function fW(){try{return pW(()=>Object.assign({"./features/index.tsx":p$,"./inbox/index.tsx":C$,"./observability/index.tsx":Mz,"./task-kanban/index.tsx":wG,"./teams/index.tsx":sW,"./workspace/index.tsx":dW}))}catch(a){if(typeof require!="function")throw a}const e=require("node:fs"),t=require("node:path"),n=require("node:url"),r=typeof __dirname<"u"?__dirname:t.dirname(n.fileURLToPath(import.meta.url));return mW(r,{readdirSync:(a,i)=>e.readdirSync(a,i),tryRequire:a=>require(a)})}function mW(e,t){const n=require("node:path"),r=[];let a=[];try{a=t.readdirSync(e,{withFileTypes:!0})}catch{return r}const i=a.filter(s=>s.isDirectory()).map(s=>s.name).sort((s,o)=>s.localeCompare(o));for(const s of i)for(const o of["tsx","ts"]){const u=n.join(e,s,`index.${o}`);try{const l=t.tryRequire(u),p=sv(l);if(p){r.push(p);break}}catch{}}return r.sort(ov),r}function hW(e,t){const n=new Set(t?.disabled??[]),r=e.slice(),a=new Set(n);function i(){return r.filter(s=>!a.has(s.id))}return gW(r),{get modules(){return i()},getModule(s){return i().find(o=>o.id===s)},get defaultModule(){return i()[0]},disableModule(s){a.add(s)},enableModule(s){a.delete(s)},getEnabledModules(){return i().map(s=>s.id)},registerModuleRoot(s){}}}function gW(e){const t=new Map,n=new Map;for(const r of e){const a=t.get(r.id);if(a!==void 0)throw new Error(`Duplicate module id "${r.id}" discovered in two sources: ${a} and ${To(r)}`);t.set(r.id,To(r));const i=n.get(r.route);if(i!==void 0)throw new Error(`Duplicate module route "${r.route}" discovered in two sources: ${i} and ${To(r)}`);n.set(r.route,To(r))}}function To(e){return e.id}const pb=hW(fW(),{disabled:fP}),uv=pb.modules;function bW(e){return pb.getModule(e)}const So=pb.defaultModule;function EW(){const[e,t]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u")return;const n=r=>{const i=r.detail?.message||"An error occurred",s=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;t(o=>[...o,{id:s,message:i}]),setTimeout(()=>{t(o=>o.filter(u=>u.id!==s))},5e3)};return window.addEventListener("api-error",n),()=>{window.removeEventListener("api-error",n)}},[]),e.length===0?null:c.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-md w-full px-4 pointer-events-none",children:e.map(n=>c.jsxs("div",{className:"pointer-events-auto flex items-center justify-between gap-3 p-3 bg-red-950/90 border border-red-500/40 text-red-200 text-sm rounded-md shadow-lg backdrop-blur",role:"alert",children:[c.jsx("span",{className:"flex-1 break-words",children:n.message}),c.jsx("button",{type:"button",className:"text-red-400 hover:text-red-100 text-base font-bold leading-none px-1",onClick:()=>t(r=>r.filter(a=>a.id!==n.id)),"aria-label":"Close error toast",children:"×"})]},n.id))})}function yW({currentName:e}){const[t,n]=g.useState(!1),[r,a]=g.useState([]),[i,s]=g.useState(null),[o,u]=g.useState(null),l=g.useRef(null);g.useEffect(()=>{if(!t)return;const d=new AbortController;return Ke(new Request(`${et()}/projects`,{signal:d.signal})).then(async f=>{if(!f.ok)return;const m=await f.json();a(m.projects??[])}).catch(()=>{u("Failed to load projects")}),()=>d.abort()},[t]),g.useEffect(()=>{if(!t)return;const d=m=>{m.key==="Escape"&&n(!1)},f=m=>{l.current&&!l.current.contains(m.target)&&n(!1)};return document.addEventListener("keydown",d),document.addEventListener("mousedown",f),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",f)}},[t]);const p=async d=>{if(d.current){n(!1);return}if(d.running&&d.port>0){window.location.href=`http://localhost:${d.port}/board`;return}s(d.name);try{const f=await Ke(new Request(`${et()}/projects/start`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:d.name,path:d.path})}));if(!f.ok)throw new Error("Failed to start project");const m=await f.json();window.location.href=m.url||`http://localhost:${m.port}/board`}catch(f){u(f instanceof Error?f.message:"Start failed"),s(null)}};return c.jsxs("div",{className:"relative min-w-0 flex-1",ref:l,children:[c.jsxs("button",{type:"button",onClick:()=>n(d=>!d),"aria-haspopup":"listbox","aria-expanded":t,"aria-label":"Switch project",title:e,"data-testid":"project-switcher-trigger",className:"flex w-full items-center justify-between gap-1 rounded-md px-1.5 py-1 text-left text-sm font-semibold text-spur-text hover:bg-spur-border/30 focus-visible:outline focus-visible:outline-2 focus-visible:outline-spur-accent",children:[c.jsx("span",{className:"font-semibold truncate",children:e}),c.jsx("svg",{className:`h-4 w-4 shrink-0 transition-transform ${t?"rotate-180":""}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M4 6l4 4 4-4"})})]}),t&&c.jsxs("div",{role:"listbox","aria-label":"Registered projects","data-testid":"project-switcher-menu",className:"absolute left-0 top-full z-50 mt-1 w-64 rounded-md border border-spur-border bg-spur-surface p-1 shadow-lg",children:[c.jsx("div",{className:"px-2 py-1 text-xs font-medium text-spur-text-muted border-b border-spur-border/50 mb-1",children:"Projects"}),r.length===0?c.jsx("div",{className:"px-2 py-1.5 text-xs text-spur-text-muted",children:o||"No projects registered"}):r.map(d=>c.jsxs("button",{type:"button",role:"option","aria-selected":d.current,disabled:i===d.name,onClick:()=>p(d),"data-testid":`project-item-${d.name}`,className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-xs text-left transition-colors ${d.current?"bg-spur-accent/15 text-spur-accent font-medium":"text-spur-text hover:bg-spur-border/30"}`,children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[c.jsx("span",{className:`h-2 w-2 rounded-full shrink-0 ${d.running?"bg-green-500":"bg-gray-400"}`,title:d.running?`Running on port ${d.port}`:"Stopped"}),c.jsx("span",{className:"truncate",children:d.name})]}),i===d.name?c.jsx("span",{className:"text-[10px] text-spur-accent animate-pulse",children:"Starting..."}):d.current?c.jsx("span",{className:"text-[10px] font-semibold text-spur-accent",children:"current"}):d.running?c.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[":",d.port]}):c.jsx("span",{className:"text-[10px] text-spur-text-muted",children:"stopped"})]},d.path))]})]})}const lv="spur-theme";function xW(){try{const e=localStorage.getItem(lv);if(e==="light"||e==="dark")return e}catch{}return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function TW(e){document.documentElement.setAttribute("data-theme",e);try{localStorage.setItem(lv,e)}catch{}}function SW(e){const t=e==="dark"?"light":"dark";return TW(t),t}function AW(){const[e,t]=g.useState(xW);g.useEffect(()=>{const r=window.matchMedia("(prefers-color-scheme: dark)"),a=i=>{if(!(()=>{try{return localStorage.getItem("spur-theme")}catch{return null}})()){const o=i.matches?"dark":"light";t(o),document.documentElement.setAttribute("data-theme",o)}};return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[]);const n=g.useCallback(()=>t(SW),[]);return c.jsx(He,{variant:"ghost",size:"sm",onClick:n,className:"text-spur-text-muted","aria-label":e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?"☀️":"🌙"})}const vW="Modules";function wW(){const[e,t]=g.useState(vW);return g.useEffect(()=>{const n=new AbortController;return Ke(new Request(`${et()}/project`,{signal:n.signal})).then(async r=>{if(!r.ok)return;const a=await r.json();a.name&&t(a.name)}).catch(()=>{}),()=>n.abort()},[]),e}function _W({direction:e}){const t=e==="expand";return c.jsx("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t?c.jsx("path",{d:"M6 3l5 5-5 5"}):c.jsx("path",{d:"M10 3L5 8l5 5"})})}function lx({collapsed:e,onToggle:t}){const n=e?"Expand sidebar":"Collapse sidebar";return c.jsx("button",{type:"button",onClick:t,"aria-label":n,title:n,"data-testid":e?"sidebar-expand":"sidebar-collapse",className:"flex h-8 w-8 items-center justify-center rounded-md text-spur-text-muted hover:bg-spur-accent/20 hover:text-spur-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-spur-accent",children:c.jsx(_W,{direction:e?"expand":"collapse"})})}function NW({collapsed:e,onToggle:t,onMobileClose:n}){const r=wW();return c.jsxs("aside",{className:"flex flex-col bg-spur-surface border-r border-spur-border overflow-hidden",children:[e?c.jsx("div",{className:"flex items-center justify-center border-b border-spur-border shrink-0 py-1",children:c.jsx(lx,{collapsed:!0,onToggle:t})}):c.jsxs("div",{className:"flex items-center justify-between gap-1 p-3 border-b border-spur-border shrink-0",children:[c.jsx(yW,{currentName:r}),c.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[c.jsx(lx,{collapsed:!1,onToggle:t}),c.jsx(AW,{}),n&&c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close navigation",children:"✕"})]})]}),c.jsx("nav",{className:"flex-1 overflow-y-auto",children:uv.map(a=>c.jsxs(jx,{to:`/board/${a.route}`,className:({isActive:i})=>`flex items-center gap-2 px-3 py-2 text-sm transition-colors ${i?"bg-spur-accent/20 text-spur-accent":"text-spur-text-muted hover:text-spur-text hover:bg-spur-border/30"} ${e?"justify-center py-3":""}`,title:e?a.name:void 0,children:[c.jsx("span",{className:"text-lg",children:a.icon}),!e&&c.jsx("span",{children:a.sidebarLabel??a.name})]},a.id))})]})}function CW({children:e,mobileHeader:t}){return c.jsxs("main",{className:"flex flex-col overflow-hidden bg-spur-bg",children:[t,c.jsx("div",{className:"flex-1 overflow-auto",children:e})]})}function IW({collapsed:e,onToggle:t,onMobileClose:n,children:r,actions:a}){return c.jsxs("aside",{className:"flex flex-col bg-spur-surface border-l border-spur-border overflow-hidden",children:[n&&c.jsx("div",{className:"hidden max-md:flex items-center justify-center py-2 shrink-0",children:c.jsx("div",{className:"w-10 h-1 rounded-full bg-spur-border"})}),c.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-spur-border shrink-0",children:[!e&&c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:r?"Context":""}),c.jsx("div",{className:"flex items-center gap-1",children:a}),c.jsxs("div",{className:"flex items-center gap-1",children:[n&&c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close panel",children:"✕"}),c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text-muted hidden md:inline-flex",onClick:t,"aria-label":e?"Expand panel":"Collapse panel",children:e?"◀":"▶"})]})]}),!e&&c.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:r})]})}const kW=g.createContext(void 0);function RW(){const[e,t]=g.useState(()=>dP()),[n,r]=g.useState(!1),[a,i]=g.useState(!1),s=tr(),o=(()=>{const w=s.pathname.split("/"),T=w.indexOf("board"),I=T>=0?w[T+1]:void 0;return bW(I??"")})();g.useLayoutEffect(()=>{const w=document.documentElement;w.style.setProperty("--sidebar-w",`${e.sidebarWidth}px`),w.style.setProperty("--rightpanel-w",`${e.rightPanelWidth}px`)},[e.sidebarWidth,e.rightPanelWidth]);const u=g.useCallback(w=>pP(w),[]),l=g.useCallback(()=>{t(w=>{const T={...w,sidebarCollapsed:!w.sidebarCollapsed};return u(T),T})},[u]),p=g.useCallback(()=>{t(w=>{const T={...w,rightPanelCollapsed:!w.rightPanelCollapsed};return u(T),T})},[u]),d=g.useCallback(w=>t(T=>{const I={...T,sidebarWidth:w};return u(I),I}),[u]),f=g.useCallback(w=>t(T=>{const I={...T,rightPanelWidth:w};return u(I),I}),[u]),m=g.useCallback(()=>{r(!1),i(!1)},[]),b=g.useCallback(w=>{w.key==="Escape"&&m()},[m]),E=o?.rightPanelComponent;g.useLayoutEffect(()=>{E&&e.rightPanelCollapsed&&t(w=>({...w,rightPanelCollapsed:!1}))},[E,e.rightPanelCollapsed]);const y=c.jsxs("div",{className:"mobile-bar",children:[c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>r(!0),"aria-label":"Open navigation",children:"☰"}),c.jsx("span",{className:"text-sm font-semibold text-spur-text",children:o?.name??"Spur"}),c.jsx(He,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>i(!0),"aria-label":"Open panel",children:"◧"})]}),x=n||a;return c.jsxs(c.Fragment,{children:[x&&c.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:m,onKeyDown:b,"aria-hidden":"true"}),c.jsx("div",{className:"board-layout","data-sidebar-collapsed":String(e.sidebarCollapsed),"data-rightpanel-collapsed":String(e.rightPanelCollapsed),"data-mobile-sidebar-open":String(n),"data-mobile-panel-open":String(a),children:c.jsxs(kW.Provider,{value:o,children:[c.jsx(NW,{collapsed:e.sidebarCollapsed,onToggle:l,onMobileClose:m}),c.jsx(iu,{targetVar:"--sidebar-w",onResizeEnd:d}),c.jsx(CW,{mobileHeader:y,children:c.jsx(i_,{})}),c.jsx(iu,{targetVar:"--rightpanel-w",onResizeEnd:f}),c.jsx(IW,{collapsed:e.rightPanelCollapsed,onToggle:p,onMobileClose:m,children:E?c.jsx(E,{}):null})]})}),c.jsx(EW,{})]})}const DW=[{path:"/board",element:c.jsx(RW,{}),children:[{index:!0,element:c.jsx(Gb,{to:So?So.route:"/board",replace:!0})},...uv.flatMap(e=>[{path:e.route,element:c.jsx(e.component,{})},{path:`${e.route}/*`,element:c.jsx(e.component,{})}])]},{path:"/",element:c.jsx(Gb,{to:So?`/board/${So.route}`:"/board",replace:!0})}];function OW(){return R_(DW)}function FW(){const[e]=g.useState(OW);return c.jsx(n_,{router:e})}export{st as B,Lg as C,Tr as L,Ko as M,Zr as S,dA as _,FW as a,He as b,W7 as c,_r as d,c as j,$7 as p,Yg as t,bA as u};