fourth-spark 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "f58c3b9a-25bc-4c9e-9a30-63f4d23b235b",
2
+ "id": "baf63c9f-93ba-4c1a-88e4-e8d80f3f5bce",
3
3
  "prevId": "7cc6db26-a6b1-412a-bd46-9db4650f98b6",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
@@ -54,8 +54,8 @@
54
54
  {
55
55
  "idx": 7,
56
56
  "version": "7",
57
- "when": 1787564926883,
58
- "tag": "0007_outgoing_xorn",
57
+ "when": 1787928920053,
58
+ "tag": "0007_chubby_anthem",
59
59
  "breakpoints": true
60
60
  }
61
61
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fourth-spark",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "description": "AI Agent Platform — multi-repo agent management based on OpenCode",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -457,7 +457,7 @@ Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}
457
457
  *
458
458
  * This source code is licensed under the ISC license.
459
459
  * See the LICENSE file in the root directory of this source tree.
460
- */const NC=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Qc=ke("zap",NC);function Cy(e){var t,a,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(a=Cy(e[t]))&&(r&&(r+=" "),r+=a)}else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function ae(){for(var e,t,a=0,r="",o=arguments.length;a<o;a++)(e=arguments[a])&&(t=Cy(e))&&(r&&(r+=" "),r+=t);return r}const Nx=e=>{let t;const a=new Set,r=(h,b)=>{const g=typeof h=="function"?h(t):h;if(!Object.is(g,t)){const y=t;t=b??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(N=>N(t,y))}},o=()=>t,f={setState:r,getState:o,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=t=e(r,o,f);return f},TC=(e=>e?Nx(e):Nx),_C=e=>e;function vC(e,t=_C){const a=ac.useSyncExternalStore(e.subscribe,ac.useCallback(()=>t(e.getState()),[e,t]),ac.useCallback(()=>t(e.getInitialState()),[e,t]));return ac.useDebugValue(a),a}const Tx=e=>{const t=TC(e),a=r=>vC(t,r);return Object.assign(a,t),a},es=(e=>e?Tx(e):Tx),Nm="fs-theme";function wy(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function _x(e){return e==="system"?wy():e}function vx(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const ah=es((e,t)=>({preference:localStorage.getItem(Nm)??"system",resolved:_x(localStorage.getItem(Nm)??"system"),cycle(){const a=["system","light","dark"],r=a[(a.indexOf(t().preference)+1)%a.length],o=_x(r);localStorage.setItem(Nm,r),vx(r),e({preference:r,resolved:o})},init(){vx(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{const{preference:o}=t();if(o==="system"){const u=wy();e({resolved:u})}};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)}})),Ac="fourth-spark-server-url";function ky(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function Ry(){return localStorage.getItem(Ac)??""}function SC(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(Ac,t):localStorage.removeItem(Ac)}function sh(){return localStorage.getItem(Ac)??""}class Ss extends Error{constructor(a,r){super(a);sn(this,"status");this.name="ApiError",this.status=r}}async function Se(e,t){let a;try{a=await fetch(Ry()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(o){throw new Ss(o instanceof Error?o.message:"Network request failed",0)}if(!a.ok){const o=await a.text().catch(()=>"");throw new Ss(o.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const r=await a.text();if(r)return JSON.parse(r)}function sa(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const r of[...t,"data","items"])if(Array.isArray(a[r]))return a[r]}return[]}async function AC(){return sa(await Se("/api/repos"),"repos")}async function CC(e,t,a,r){return Se("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:r})})}async function wC(e){return Se("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function kC(e){await Se(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function RC(e){await Se(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function OC(e){await Se(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function IC(e){return Se(`/api/repos/${encodeURIComponent(e)}/branches`)}async function MC(e,t){return Se(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function DC(e){return Se(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ge(e){return`/api/repos/${encodeURIComponent(e)}`}async function LC(e){return sa(await Se(`${Ge(e)}/workspaces`),"workspaces")}async function jC(e,t){await Se(`${Ge(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function BC(e){return Se(`${Ge(e)}/workspaces/cleanup`,{method:"POST"})}async function PC(e,t){await Se(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function UC(e,t){await Se(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function HC(e){return sa(await Se(`${Ge(e)}/sessions`),"sessions")}async function FC(e,t,a,r,o,u,c,f){return Se(`${Ge(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:r,variant:o,issueId:u,customAgentId:c,files:f})})}async function zC(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function $C(e,t,a,r,o,u){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:r,model:o,files:u})})}async function qC(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function YC(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function GC(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}async function KC(e,t,a){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({messageID:a})})}function Sx(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const r=Array.isArray(t.parts)?t.parts:void 0;return{...a,...r?{parts:r}:{}}}return t}async function Ax(e,t,a){const r=new URLSearchParams;a!=null&&a.limit&&r.set("limit",String(a.limit)),a!=null&&a.before&&r.set("before",a.before);const o=r.toString(),u=`${Ge(e)}/sessions/${encodeURIComponent(t)}/messages${o?`?${o}`:""}`,c=await Se(u);if(Array.isArray(c)){const h=c.map(Sx);return{messages:h,total:h.length,hasMore:!1}}const f=c,m=Array.isArray(f.messages)?f.messages:[];return{messages:m.map(Sx),total:f.total??m.length,hasMore:f.hasMore??!1}}async function VC(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/status`)}async function XC(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`)}async function QC(e,t){return Se(`${Ge(e)}/sessions/snapshot/${encodeURIComponent(t)}`)}async function Oy(e){return Se(`${Ge(e)}/sessions/all-links`)}async function WC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:r})})}async function ZC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:r})})}async function Iy(){return sa(await Se("/api/custom-agents"))}async function JC(e){return Se("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function ew(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function My(e){await Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Cx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function tw(e){return Se("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function Dy(e,t){const a=new URLSearchParams;t!=null&&t.category&&a.set("category",t.category),t!=null&&t.includeSuperseded&&a.set("includeSuperseded","true");const r=a.toString();return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories${r?`?${r}`:""}`)}async function nw(e,t,a){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(a)})}async function aw(e,t){await Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"DELETE"})}async function sw(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/extract`,{method:"POST",body:JSON.stringify({sessionIds:t})})}async function Xh(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/sessions`)}async function Ly(e){return sa(await Se(`${Ge(e)}/custom-agents`))}async function rw(e,t){return Se(`${Ge(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Ro(e){return sa(await Se(`${Ge(e)}/models`))}async function jy(){return sa(await Se("/api/prompt-fragments"))}async function iw(e){return Se("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function lw(e,t){return Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function ow(e){await Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function wx(e){return sa(await Se(`${Ge(e)}/tags`))}async function kx(e,t){return sa(await Se(`${Ge(e)}/milestones`))}async function Rx(e,t="open"){return sa(await Se(`${Ge(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function uw(e,t="all"){return Se(`${Ge(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function cw(e,t,a){return Se(`${Ge(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function dw(e,t,a){await Se(`${Ge(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function By(e,t,a){return Se(`${Ge(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function fw(e,t){return sa(await Se(`${Ge(e)}/issues/${t}/pulls`))}async function Ox(e,t="open"){return sa(await Se(`${Ge(e)}/pulls?state=${encodeURIComponent(t)}`))}async function mw(e,t="all"){return Se(`${Ge(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function hw(e,t){return Se(`${Ge(e)}/pulls/${t}`)}async function pw(e,t){await Se(`${Ge(e)}/pulls/${t}/merge`,{method:"POST"})}async function Qh(e,t){return sa(await Se(`${Ge(e)}/pulls/${t}/issues`))}async function gw(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function bw(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function xw(e,t){return Se(`${Ge(e)}/pulls/${t}/comments`)}async function Ew(e,t){return Se(`${Ge(e)}/issues/${t}/comments`)}async function Ix(e,t,a){return Se(`${Ge(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function yw(e,t,a){return Se(`${Ge(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function Mx(e,t){return Se(`${Ge(e)}/issues/${t}/draft`)}async function Nw(e,t,a){return Se(`${Ge(e)}/issues/polish-create`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Dx(e){return Se(`${Ge(e)}/issues/draft-create`)}async function Tw(e){await Se(`${Ge(e)}/issues/draft-create`,{method:"DELETE"})}async function _w(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function vw(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function Sw(){return Se("/api/agents-md")}async function Aw(e){await Se("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function Cw(e){return Se(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function ww(e,t){await Se(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function kw(e){return`${Ry()}${Ge(e)}/events`}async function Rw(e){return Se(`${Ge(e)}/sessions/status`)}async function Oo(){return Se("/api/settings")}async function rh(e,t){await Se(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function ih(){return Se("/api/cloud/status")}async function Ow(){return Se("/api/cloud/reload",{method:"POST"})}async function Iw(e){try{return(await Se("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function Mw(){return sa(await Se("/api/git-hosts"),"gitHosts")}async function Dw(e,t,a,r="gitea"){return Se("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:r})})}async function Lw(e){await Se(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Py(){return Se("/api/usage")}async function Uy(e){return Se("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function jw(e,t="ios"){await Se("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ar="fs-active-repo",je=es((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ar),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await AC(),r=t().activeRepoId,o=r&&a.some(c=>c.id===r);e({repos:a,loading:!1,activeRepoId:o?r:a.length>0?a[0].id:null});const u=t().activeRepoId;u?localStorage.setItem(ar,u):localStorage.removeItem(ar)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ar,a):localStorage.removeItem(ar)},addRepo:async(a,r,o,u)=>{try{const c=await CC(a,r,o,u);return e(f=>({repos:[...f.repos,c],activeRepoId:c.id})),localStorage.setItem(ar,c.id),c}catch(c){return e({loadError:c instanceof Error?c.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await kC(a)}catch{}e(r=>{const o=r.repos.filter(c=>c.id!==a),u=r.activeRepoId===a?o.length>0?o[0].id:null:r.activeRepoId;return u?localStorage.setItem(ar,u):localStorage.removeItem(ar),{repos:o,activeRepoId:u}})},updateRepoBranch:(a,r)=>{e(o=>({repos:o.repos.map(u=>u.id===a?{...u,branch:r}:u)}))}})),zn=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},Lx="fs-nav-collapsed",jx="fs-session-panel-collapsed",Cc=es(e=>({navCollapsed:localStorage.getItem(Lx)==="true",sessionPanelCollapsed:localStorage.getItem(jx)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(Lx,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(jx,String(a)),{sessionPanelCollapsed:a}})}})),Hy=[{segment:"run",icon:Kh,label:"运行面板",global:!1},{segment:"agents",icon:DA,label:"Agents",global:!1},{segment:"dev/issues",icon:a3,label:"研发",global:!1,matchPrefix:"dev"}];function Fy(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function zy(e,t,a){if(!e.matchPrefix)return!1;const r=e.global?`/${e.matchPrefix}`:a?`/${encodeURIComponent(a)}/${e.matchPrefix}`:null;return r?t===r||t.startsWith(`${r}/`):!1}function Bw(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function Pw({repos:e,activeRepoId:t,onRepoChange:a}){const r=vn(),[o,u]=T.useState(!1),c=T.useRef(null),f=e.find(h=>h.id===t),m=T.useCallback(()=>u(!1),[]);return T.useEffect(()=>{if(!o)return;const h=b=>{c.current&&!c.current.contains(b.target)&&m()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o,m]),i.jsxs("div",{ref:c,className:"relative",children:[i.jsxs("button",{type:"button",onClick:()=>u(h=>!h),className:"flex max-w-[140px] items-center gap-1 rounded-md border border-line bg-base px-2 py-1 text-xs text-fg-2 transition-colors hover:border-blue-500 sm:max-w-[200px]",children:[i.jsx(xy,{className:"h-3 w-3 shrink-0 text-fg-4"}),i.jsxs("span",{className:"truncate",children:[i.jsx("span",{className:"sm:hidden",children:f?Bw(f.name):""}),i.jsx("span",{className:"hidden sm:inline",children:(f==null?void 0:f.name)??""})]}),i.jsx(ba,{className:ae("h-3 w-3 shrink-0 text-fg-4 transition-transform",o&&"rotate-180")})]}),o&&i.jsxs("div",{className:"absolute left-0 top-full z-50 mt-1 w-64 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[i.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:e.map(h=>i.jsxs("button",{type:"button",onClick:()=>{a(h.id),m()},className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",h.id===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[h.id===t?i.jsx(On,{className:"h-3 w-3 shrink-0"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:h.name})]},h.id))}),i.jsx("div",{className:"border-t border-line",children:i.jsxs("button",{type:"button",onClick:()=>{r("/repos"),m()},className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:[i.jsx(Vh,{className:"h-3 w-3 shrink-0"}),i.jsx("span",{children:"管理仓库"})]})})]})]})}function Uw({repoId:e,currentBranch:t}){const a=je(A=>A.updateRepoBranch),[r,o]=T.useState(!1),[u,c]=T.useState(null),[f,m]=T.useState(!1),[h,b]=T.useState(null),[g,y]=T.useState(null),N=T.useRef(null),v=T.useCallback(()=>{o(!1),y(null)},[]);T.useEffect(()=>{if(!r)return;const A=O=>{N.current&&!N.current.contains(O.target)&&v()};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[r,v]);const S=async()=>{if(r){v();return}o(!0),m(!0),y(null);try{c(await IC(e))}catch{y("加载分支失败")}finally{m(!1)}},C=async A=>{if(!(A===t||h)){b(A),y(null);try{const O=await MC(e,A);a(e,O.branch),v()}catch(O){y(O instanceof Error?O.message:"切换失败")}finally{b(null)}}};return t?i.jsxs("div",{ref:N,className:"relative",children:[i.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 rounded-md bg-elevated px-2 py-1 text-xs text-fg-3 transition-colors hover:bg-blue-500/10 hover:text-blue-600",children:[i.jsx(ko,{className:"h-3 w-3"}),t,i.jsx(ba,{className:ae("h-3 w-3 transition-transform",r&&"rotate-180")})]}),r&&i.jsxs("div",{className:"absolute right-0 top-full z-50 mt-1 w-56 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[f?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx(ln,{className:"h-4 w-4 animate-spin text-fg-4"})}):u?i.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[u.local.map(A=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",A===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[A===t?i.jsx(On,{className:"h-3 w-3 shrink-0"}):h===A?i.jsx(ln,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:A})]},A)),u.remote.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mx-3 my-1 border-t border-line"}),i.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),u.remote.map(A=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-fg-2 transition-colors hover:bg-elevated",children:[h===A?i.jsx(ln,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:A})]},`remote-${A}`))]})]}):null,g&&i.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:g})]})]}):null}function Hw(){const[e,t]=T.useState(null);return T.useEffect(()=>{const a=()=>fetch("/api/health").then(u=>u.json()).then(u=>{u.latestVersion&&u.latestVersion!=="0.10.6"&&t(u.latestVersion)}).catch(()=>{});a();const r=setInterval(a,30*6e4),o=()=>a();return window.addEventListener("focus",o),()=>{clearInterval(r),window.removeEventListener("focus",o)}},[]),e}function Fw(){const e=vn(),t=_n(),a=je(g=>g.repos),r=je(g=>g.activeRepoId),o=je(g=>g.setActiveRepo),u=ah(g=>g.preference),c=ah(g=>g.cycle),f=u==="light"?dC:u==="dark"?Y3:$3,m=a.find(g=>g.id===r),h=Hw(),b=g=>{var S;if(!g)return;o(g);const y=a.find(C=>C.id===g);if(!y)return;const N=t.pathname.match(/\/dev\/(issues|pulls)/);if(N){e(`/${encodeURIComponent(y.name)}/dev/${N[1]}`);return}const v=((S=t.pathname.match(/\/(run|agents|issues|pulls)/))==null?void 0:S[1])??"run";e(`/${encodeURIComponent(y.name)}/${v}`)};return i.jsxs("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:[i.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(Qc,{className:"h-5 w-5 text-blue-500"}),i.jsx("span",{className:"hidden text-sm font-bold tracking-tight text-fg sm:inline",children:"Fourth Spark"}),i.jsxs("span",{className:"hidden rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4 sm:inline",children:["v","0.10.6"]}),h&&i.jsxs("span",{className:"hidden text-[10px] text-amber-500 sm:inline",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Pw,{repos:a,activeRepoId:r,onRepoChange:b}),m&&r&&i.jsx(Uw,{repoId:r,currentBranch:m.branch})]}),i.jsx("button",{type:"button",onClick:()=>e("/settings"),"aria-label":"设置",className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:i.jsx(Vh,{className:"h-4 w-4"})}),i.jsx("a",{href:"https://github.com/kinminghao/fourth-spark",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:i.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}),i.jsx("button",{type:"button",onClick:c,"aria-label":`主题: ${u}`,className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:i.jsx(f,{className:"h-4 w-4"})})]})]}),h&&i.jsx("div",{className:"border-t border-line px-4 py-1.5 sm:hidden",children:i.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})})]})}function zw(){const e=je(zn),t=Cc(o=>o.navCollapsed),a=Cc(o=>o.toggleNav),r=_n();return i.jsxs("nav",{className:ae("hidden shrink-0 flex-col border-r border-line bg-surface py-2 transition-[width] duration-200 ease-in-out md:flex",t?"w-14":"w-48"),children:[i.jsx("div",{className:"flex flex-1 flex-col",children:Hy.map(o=>{const u=zy(o,r.pathname,e);return i.jsxs(vc,{to:Fy(o.segment,o.global,e),title:t?o.label:void 0,className:({isActive:c})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",c||u?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[i.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:o.label})]},o.segment)})}),i.jsxs(vc,{to:"/settings",title:t?"设置":void 0,className:({isActive:o})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",o?"bg-blue-500/10 font-medium text-blue-600":"text-fg-4 hover:bg-elevated hover:text-fg-2"),children:[i.jsx(Vh,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:"设置"})]}),i.jsx("button",{type:"button",onClick:a,title:t?"展开导航":"收起导航",className:"mx-2 flex items-center justify-center rounded-md py-2 text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:t?i.jsx(GA,{className:"h-4 w-4"}):i.jsx(qA,{className:"h-4 w-4"})})]})}function $w(){const e=je(zn),t=_n();return i.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-30 border-t border-line bg-surface pb-[var(--safe-bottom)] md:hidden",children:i.jsx("div",{className:"flex h-14 items-center justify-around",children:Hy.map(a=>{const r=zy(a,t.pathname,e);return i.jsx(vc,{to:Fy(a.segment,a.global,e),"aria-label":a.label,className:({isActive:o})=>ae("flex h-10 w-10 items-center justify-center rounded-md transition-colors",o||r?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:i.jsx(a.icon,{className:"h-5 w-5 shrink-0"})},a.segment)})})})}function qw(){return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[i.jsx(Fw,{}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx(zw,{}),i.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:i.jsx(jS,{})})]}),i.jsx($w,{})]})}let Yw=0;const Qt=es(e=>({toasts:[],addToast:(t,a="info",r,o)=>{const u=(o==null?void 0:o.id)??`toast-${++Yw}-${Date.now()}`;e(c=>c.toasts.some(f=>f.id===u)?c:{toasts:[...c.toasts,{id:u,message:t,variant:a,sessionId:r,persistent:o==null?void 0:o.persistent}]}),o!=null&&o.persistent||setTimeout(()=>{e(c=>({toasts:c.toasts.filter(f=>f.id!==u)}))},4e3)},removeToast:t=>{e(a=>({toasts:a.toasts.filter(r=>r.id!==t)}))}}));function Gw({onClose:e}){const[t,a]=T.useState(""),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState("opencode"),[h,b]=T.useState(!1),[g,y]=T.useState(""),N=je(O=>O.addRepo),v=r.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,S=async O=>{const k=O.trim();if(k){b(!0),y("");try{const B=await wC(k);B.name&&!r.trim()&&o(B.name),B.gitUrl&&!u.trim()&&c(B.gitUrl)}catch(B){const R=B instanceof Error?B.message:"无法解析路径";try{const H=JSON.parse(R);y(H.error??R)}catch{y(R)}}b(!1)}},C=T.useRef(S);C.current=S,T.useEffect(()=>{const O=t.trim();if(!O)return;const k=setTimeout(()=>{C.current(O)},500);return()=>clearTimeout(k)},[t]);const A=async()=>{if(!v)return;y(""),await N(r.trim(),u.trim(),t.trim(),f)&&e()};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:O=>O.stopPropagation(),children:[i.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[i.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),i.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(gt,{className:"h-4 w-4"})})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),i.jsx("input",{id:"m-path",value:t,onChange:O=>a(O.target.value),onBlur:O=>void S(O.target.value),placeholder:"/Users/you/code/repo",autoFocus:!0,className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"}),i.jsx("span",{className:"text-[11px] text-fg-5",children:h?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),i.jsx("input",{id:"m-name",value:r,onChange:O=>o(O.target.value),placeholder:"my-project",className:"w-full rounded-lg border border-line bg-base px-3 py-2 text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),i.jsx("input",{id:"m-git",value:u,onChange:O=>c(O.target.value),placeholder:"https://github.com/org/repo.git",className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-xs text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-fg-3",children:"运行时"}),i.jsx("div",{className:"flex gap-2",children:[{value:"opencode",label:"OpenCode"},{value:"claude-code",label:"Claude Code"}].map(O=>i.jsx("button",{type:"button",onClick:()=>m(O.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===O.value?"border-blue-500 bg-blue-500/10 text-blue-600":"border-line bg-base text-fg-4 hover:bg-elevated hover:text-fg-2"}`,children:O.label},O.value))}),i.jsx("span",{className:"text-[11px] text-fg-5",children:f==="claude-code"?"需要本地安装 Claude Code CLI":"需要本地安装 OpenCode CLI"})]}),g&&i.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:g}),i.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[i.jsx("button",{type:"button",onClick:e,className:"rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),i.jsx("button",{type:"button",onClick:A,disabled:!v,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 disabled:cursor-not-allowed disabled:bg-fg-6 disabled:text-fg-4",children:"添加仓库"})]})]})]})})}function Kw({repoId:e,repoName:t,onClose:a}){const[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(!0),[h,b]=T.useState(!1),[g,y]=T.useState(null);T.useEffect(()=>{Cw(e).then(S=>{o(S.content),c(S.content),m(!1)}).catch(S=>{y(S instanceof Error?S.message:String(S)),m(!1)})},[e]);const N=async()=>{b(!0),y(null);try{await ww(e,r),c(r)}catch(S){y(S instanceof Error?S.message:String(S))}b(!1)},v=r!==u;return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:i.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),i.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),i.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(gt,{className:"h-4 w-4"})})]}),g&&i.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg bg-red-500/10 px-3 py-2 text-xs text-red-400",children:[i.jsx(Tn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 break-words",children:g})]}),f?i.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[i.jsx(ln,{className:"h-5 w-5 fs-spin"}),i.jsx("p",{className:"text-xs",children:"加载中…"})]}):i.jsx("textarea",{value:r,onChange:S=>o(S.target.value),spellCheck:!1,className:"h-96 w-full resize-y rounded-lg border border-line bg-base px-4 py-3 font-mono text-sm leading-relaxed text-fg placeholder:text-fg-6 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20",placeholder:`# AGENTS.md
460
+ */const NC=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Qc=ke("zap",NC);function Cy(e){var t,a,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(a=Cy(e[t]))&&(r&&(r+=" "),r+=a)}else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function ae(){for(var e,t,a=0,r="",o=arguments.length;a<o;a++)(e=arguments[a])&&(t=Cy(e))&&(r&&(r+=" "),r+=t);return r}const Nx=e=>{let t;const a=new Set,r=(h,b)=>{const g=typeof h=="function"?h(t):h;if(!Object.is(g,t)){const y=t;t=b??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(N=>N(t,y))}},o=()=>t,f={setState:r,getState:o,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=t=e(r,o,f);return f},TC=(e=>e?Nx(e):Nx),_C=e=>e;function vC(e,t=_C){const a=ac.useSyncExternalStore(e.subscribe,ac.useCallback(()=>t(e.getState()),[e,t]),ac.useCallback(()=>t(e.getInitialState()),[e,t]));return ac.useDebugValue(a),a}const Tx=e=>{const t=TC(e),a=r=>vC(t,r);return Object.assign(a,t),a},es=(e=>e?Tx(e):Tx),Nm="fs-theme";function wy(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function _x(e){return e==="system"?wy():e}function vx(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const ah=es((e,t)=>({preference:localStorage.getItem(Nm)??"system",resolved:_x(localStorage.getItem(Nm)??"system"),cycle(){const a=["system","light","dark"],r=a[(a.indexOf(t().preference)+1)%a.length],o=_x(r);localStorage.setItem(Nm,r),vx(r),e({preference:r,resolved:o})},init(){vx(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{const{preference:o}=t();if(o==="system"){const u=wy();e({resolved:u})}};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)}})),Ac="fourth-spark-server-url";function ky(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function Ry(){return localStorage.getItem(Ac)??""}function SC(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(Ac,t):localStorage.removeItem(Ac)}function sh(){return localStorage.getItem(Ac)??""}class Ss extends Error{constructor(a,r){super(a);sn(this,"status");this.name="ApiError",this.status=r}}async function Se(e,t){let a;try{a=await fetch(Ry()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(o){throw new Ss(o instanceof Error?o.message:"Network request failed",0)}if(!a.ok){const o=await a.text().catch(()=>"");throw new Ss(o.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const r=await a.text();if(r)return JSON.parse(r)}function sa(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const r of[...t,"data","items"])if(Array.isArray(a[r]))return a[r]}return[]}async function AC(){return sa(await Se("/api/repos"),"repos")}async function CC(e,t,a,r){return Se("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:r})})}async function wC(e){return Se("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function kC(e){await Se(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function RC(e){await Se(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function OC(e){await Se(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function IC(e){return Se(`/api/repos/${encodeURIComponent(e)}/branches`)}async function MC(e,t){return Se(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function DC(e){return Se(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ge(e){return`/api/repos/${encodeURIComponent(e)}`}async function LC(e){return sa(await Se(`${Ge(e)}/workspaces`),"workspaces")}async function jC(e,t){await Se(`${Ge(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function BC(e){return Se(`${Ge(e)}/workspaces/cleanup`,{method:"POST"})}async function PC(e,t){await Se(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function UC(e,t){await Se(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function HC(e){return sa(await Se(`${Ge(e)}/sessions`),"sessions")}async function FC(e,t,a,r,o,u,c,f){return Se(`${Ge(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:r,variant:o,issueId:u,customAgentId:c,files:f})})}async function zC(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function $C(e,t,a,r,o,u){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:r,model:o,files:u})})}async function qC(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function YC(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function GC(e,t){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}async function KC(e,t,a){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({messageID:a})})}function Sx(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const r=Array.isArray(t.parts)?t.parts:void 0;return{...a,...r?{parts:r}:{}}}return t}async function Ax(e,t,a){const r=new URLSearchParams;a!=null&&a.limit&&r.set("limit",String(a.limit)),a!=null&&a.before&&r.set("before",a.before);const o=r.toString(),u=`${Ge(e)}/sessions/${encodeURIComponent(t)}/messages${o?`?${o}`:""}`,c=await Se(u);if(Array.isArray(c)){const h=c.map(Sx);return{messages:h,total:h.length,hasMore:!1}}const f=c,m=Array.isArray(f.messages)?f.messages:[];return{messages:m.map(Sx),total:f.total??m.length,hasMore:f.hasMore??!1}}async function VC(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/status`)}async function XC(e,t){return Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`)}async function QC(e,t){return Se(`${Ge(e)}/sessions/snapshot/${encodeURIComponent(t)}`)}async function Oy(e){return Se(`${Ge(e)}/sessions/all-links`)}async function WC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:r})})}async function ZC(e,t,a,r){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:r})})}async function Iy(){return sa(await Se("/api/custom-agents"))}async function JC(e){return Se("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function ew(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function My(e){await Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Cx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function tw(e){return Se("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function Dy(e,t){const a=new URLSearchParams;t!=null&&t.category&&a.set("category",t.category),t!=null&&t.includeSuperseded&&a.set("includeSuperseded","true");const r=a.toString();return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories${r?`?${r}`:""}`)}async function nw(e,t,a){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(a)})}async function aw(e,t){await Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"DELETE"})}async function sw(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/extract`,{method:"POST",body:JSON.stringify({sessionIds:t})})}async function Xh(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/sessions`)}async function Ly(e){return sa(await Se(`${Ge(e)}/custom-agents`))}async function rw(e,t){return Se(`${Ge(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Ro(e){return sa(await Se(`${Ge(e)}/models`))}async function jy(){return sa(await Se("/api/prompt-fragments"))}async function iw(e){return Se("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function lw(e,t){return Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function ow(e){await Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function wx(e){return sa(await Se(`${Ge(e)}/tags`))}async function kx(e,t){return sa(await Se(`${Ge(e)}/milestones`))}async function Rx(e,t="open"){return sa(await Se(`${Ge(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function uw(e,t="all"){return Se(`${Ge(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function cw(e,t,a){return Se(`${Ge(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function dw(e,t,a){await Se(`${Ge(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function By(e,t,a){return Se(`${Ge(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function fw(e,t){return sa(await Se(`${Ge(e)}/issues/${t}/pulls`))}async function Ox(e,t="open"){return sa(await Se(`${Ge(e)}/pulls?state=${encodeURIComponent(t)}`))}async function mw(e,t="all"){return Se(`${Ge(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function hw(e,t){return Se(`${Ge(e)}/pulls/${t}`)}async function pw(e,t){await Se(`${Ge(e)}/pulls/${t}/merge`,{method:"POST"})}async function Qh(e,t){return sa(await Se(`${Ge(e)}/pulls/${t}/issues`))}async function gw(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function bw(e,t,a){await Se(`${Ge(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function xw(e,t){return Se(`${Ge(e)}/pulls/${t}/comments`)}async function Ew(e,t){return Se(`${Ge(e)}/issues/${t}/comments`)}async function Ix(e,t,a){return Se(`${Ge(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function yw(e,t,a){return Se(`${Ge(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function Mx(e,t){return Se(`${Ge(e)}/issues/${t}/draft`)}async function Nw(e,t,a){return Se(`${Ge(e)}/issues/polish-create`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Dx(e){return Se(`${Ge(e)}/issues/draft-create`)}async function Tw(e){await Se(`${Ge(e)}/issues/draft-create`,{method:"DELETE"})}async function _w(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function vw(e,t,a){await Se(`${Ge(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function Sw(){return Se("/api/agents-md")}async function Aw(e){await Se("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function Cw(e){return Se(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function ww(e,t){await Se(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function kw(e){return`${Ry()}${Ge(e)}/events`}async function Rw(e){return Se(`${Ge(e)}/sessions/status`)}async function Oo(){return Se("/api/settings")}async function rh(e,t){await Se(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function ih(){return Se("/api/cloud/status")}async function Ow(){return Se("/api/cloud/reload",{method:"POST"})}async function Iw(e){try{return(await Se("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function Mw(){return sa(await Se("/api/git-hosts"),"gitHosts")}async function Dw(e,t,a,r="gitea"){return Se("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:r})})}async function Lw(e){await Se(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Py(){return Se("/api/usage")}async function Uy(e){return Se("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function jw(e,t="ios"){await Se("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ar="fs-active-repo",je=es((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ar),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await AC(),r=t().activeRepoId,o=r&&a.some(c=>c.id===r);e({repos:a,loading:!1,activeRepoId:o?r:a.length>0?a[0].id:null});const u=t().activeRepoId;u?localStorage.setItem(ar,u):localStorage.removeItem(ar)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ar,a):localStorage.removeItem(ar)},addRepo:async(a,r,o,u)=>{try{const c=await CC(a,r,o,u);return e(f=>({repos:[...f.repos,c],activeRepoId:c.id})),localStorage.setItem(ar,c.id),c}catch(c){return e({loadError:c instanceof Error?c.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await kC(a)}catch{}e(r=>{const o=r.repos.filter(c=>c.id!==a),u=r.activeRepoId===a?o.length>0?o[0].id:null:r.activeRepoId;return u?localStorage.setItem(ar,u):localStorage.removeItem(ar),{repos:o,activeRepoId:u}})},updateRepoBranch:(a,r)=>{e(o=>({repos:o.repos.map(u=>u.id===a?{...u,branch:r}:u)}))}})),zn=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},Lx="fs-nav-collapsed",jx="fs-session-panel-collapsed",Cc=es(e=>({navCollapsed:localStorage.getItem(Lx)==="true",sessionPanelCollapsed:localStorage.getItem(jx)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(Lx,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(jx,String(a)),{sessionPanelCollapsed:a}})}})),Hy=[{segment:"run",icon:Kh,label:"运行面板",global:!1},{segment:"agents",icon:DA,label:"Agents",global:!1},{segment:"dev/issues",icon:a3,label:"研发",global:!1,matchPrefix:"dev"}];function Fy(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function zy(e,t,a){if(!e.matchPrefix)return!1;const r=e.global?`/${e.matchPrefix}`:a?`/${encodeURIComponent(a)}/${e.matchPrefix}`:null;return r?t===r||t.startsWith(`${r}/`):!1}function Bw(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function Pw({repos:e,activeRepoId:t,onRepoChange:a}){const r=vn(),[o,u]=T.useState(!1),c=T.useRef(null),f=e.find(h=>h.id===t),m=T.useCallback(()=>u(!1),[]);return T.useEffect(()=>{if(!o)return;const h=b=>{c.current&&!c.current.contains(b.target)&&m()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o,m]),i.jsxs("div",{ref:c,className:"relative",children:[i.jsxs("button",{type:"button",onClick:()=>u(h=>!h),className:"flex max-w-[140px] items-center gap-1 rounded-md border border-line bg-base px-2 py-1 text-xs text-fg-2 transition-colors hover:border-blue-500 sm:max-w-[200px]",children:[i.jsx(xy,{className:"h-3 w-3 shrink-0 text-fg-4"}),i.jsxs("span",{className:"truncate",children:[i.jsx("span",{className:"sm:hidden",children:f?Bw(f.name):""}),i.jsx("span",{className:"hidden sm:inline",children:(f==null?void 0:f.name)??""})]}),i.jsx(ba,{className:ae("h-3 w-3 shrink-0 text-fg-4 transition-transform",o&&"rotate-180")})]}),o&&i.jsxs("div",{className:"absolute left-0 top-full z-50 mt-1 w-64 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[i.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:e.map(h=>i.jsxs("button",{type:"button",onClick:()=>{a(h.id),m()},className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",h.id===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[h.id===t?i.jsx(On,{className:"h-3 w-3 shrink-0"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:h.name})]},h.id))}),i.jsx("div",{className:"border-t border-line",children:i.jsxs("button",{type:"button",onClick:()=>{r("/repos"),m()},className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:[i.jsx(Vh,{className:"h-3 w-3 shrink-0"}),i.jsx("span",{children:"管理仓库"})]})})]})]})}function Uw({repoId:e,currentBranch:t}){const a=je(A=>A.updateRepoBranch),[r,o]=T.useState(!1),[u,c]=T.useState(null),[f,m]=T.useState(!1),[h,b]=T.useState(null),[g,y]=T.useState(null),N=T.useRef(null),v=T.useCallback(()=>{o(!1),y(null)},[]);T.useEffect(()=>{if(!r)return;const A=O=>{N.current&&!N.current.contains(O.target)&&v()};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[r,v]);const S=async()=>{if(r){v();return}o(!0),m(!0),y(null);try{c(await IC(e))}catch{y("加载分支失败")}finally{m(!1)}},C=async A=>{if(!(A===t||h)){b(A),y(null);try{const O=await MC(e,A);a(e,O.branch),v()}catch(O){y(O instanceof Error?O.message:"切换失败")}finally{b(null)}}};return t?i.jsxs("div",{ref:N,className:"relative",children:[i.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 rounded-md bg-elevated px-2 py-1 text-xs text-fg-3 transition-colors hover:bg-blue-500/10 hover:text-blue-600",children:[i.jsx(ko,{className:"h-3 w-3"}),t,i.jsx(ba,{className:ae("h-3 w-3 transition-transform",r&&"rotate-180")})]}),r&&i.jsxs("div",{className:"absolute right-0 top-full z-50 mt-1 w-56 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",children:[f?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx(ln,{className:"h-4 w-4 animate-spin text-fg-4"})}):u?i.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[u.local.map(A=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",A===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[A===t?i.jsx(On,{className:"h-3 w-3 shrink-0"}):h===A?i.jsx(ln,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:A})]},A)),u.remote.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mx-3 my-1 border-t border-line"}),i.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),u.remote.map(A=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-fg-2 transition-colors hover:bg-elevated",children:[h===A?i.jsx(ln,{className:"h-3 w-3 shrink-0 animate-spin"}):i.jsx("span",{className:"h-3 w-3 shrink-0"}),i.jsx("span",{className:"truncate",children:A})]},`remote-${A}`))]})]}):null,g&&i.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:g})]})]}):null}function Hw(){const[e,t]=T.useState(null);return T.useEffect(()=>{const a=()=>fetch("/api/health").then(u=>u.json()).then(u=>{u.latestVersion&&u.latestVersion!=="0.10.7"&&t(u.latestVersion)}).catch(()=>{});a();const r=setInterval(a,30*6e4),o=()=>a();return window.addEventListener("focus",o),()=>{clearInterval(r),window.removeEventListener("focus",o)}},[]),e}function Fw(){const e=vn(),t=_n(),a=je(g=>g.repos),r=je(g=>g.activeRepoId),o=je(g=>g.setActiveRepo),u=ah(g=>g.preference),c=ah(g=>g.cycle),f=u==="light"?dC:u==="dark"?Y3:$3,m=a.find(g=>g.id===r),h=Hw(),b=g=>{var S;if(!g)return;o(g);const y=a.find(C=>C.id===g);if(!y)return;const N=t.pathname.match(/\/dev\/(issues|pulls)/);if(N){e(`/${encodeURIComponent(y.name)}/dev/${N[1]}`);return}const v=((S=t.pathname.match(/\/(run|agents|issues|pulls)/))==null?void 0:S[1])??"run";e(`/${encodeURIComponent(y.name)}/${v}`)};return i.jsxs("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:[i.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(Qc,{className:"h-5 w-5 text-blue-500"}),i.jsx("span",{className:"hidden text-sm font-bold tracking-tight text-fg sm:inline",children:"Fourth Spark"}),i.jsxs("span",{className:"hidden rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4 sm:inline",children:["v","0.10.7"]}),h&&i.jsxs("span",{className:"hidden text-[10px] text-amber-500 sm:inline",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Pw,{repos:a,activeRepoId:r,onRepoChange:b}),m&&r&&i.jsx(Uw,{repoId:r,currentBranch:m.branch})]}),i.jsx("button",{type:"button",onClick:()=>e("/settings"),"aria-label":"设置",className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:i.jsx(Vh,{className:"h-4 w-4"})}),i.jsx("a",{href:"https://github.com/kinminghao/fourth-spark",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:i.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}),i.jsx("button",{type:"button",onClick:c,"aria-label":`主题: ${u}`,className:"flex h-8 w-8 items-center justify-center rounded-md text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:i.jsx(f,{className:"h-4 w-4"})})]})]}),h&&i.jsx("div",{className:"border-t border-line px-4 py-1.5 sm:hidden",children:i.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",i.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})})]})}function zw(){const e=je(zn),t=Cc(o=>o.navCollapsed),a=Cc(o=>o.toggleNav),r=_n();return i.jsxs("nav",{className:ae("hidden shrink-0 flex-col border-r border-line bg-surface py-2 transition-[width] duration-200 ease-in-out md:flex",t?"w-14":"w-48"),children:[i.jsx("div",{className:"flex flex-1 flex-col",children:Hy.map(o=>{const u=zy(o,r.pathname,e);return i.jsxs(vc,{to:Fy(o.segment,o.global,e),title:t?o.label:void 0,className:({isActive:c})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",c||u?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[i.jsx(o.icon,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:o.label})]},o.segment)})}),i.jsxs(vc,{to:"/settings",title:t?"设置":void 0,className:({isActive:o})=>ae("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",o?"bg-blue-500/10 font-medium text-blue-600":"text-fg-4 hover:bg-elevated hover:text-fg-2"),children:[i.jsx(Vh,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:ae("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:"设置"})]}),i.jsx("button",{type:"button",onClick:a,title:t?"展开导航":"收起导航",className:"mx-2 flex items-center justify-center rounded-md py-2 text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:t?i.jsx(GA,{className:"h-4 w-4"}):i.jsx(qA,{className:"h-4 w-4"})})]})}function $w(){const e=je(zn),t=_n();return i.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-30 border-t border-line bg-surface pb-[var(--safe-bottom)] md:hidden",children:i.jsx("div",{className:"flex h-14 items-center justify-around",children:Hy.map(a=>{const r=zy(a,t.pathname,e);return i.jsx(vc,{to:Fy(a.segment,a.global,e),"aria-label":a.label,className:({isActive:o})=>ae("flex h-10 w-10 items-center justify-center rounded-md transition-colors",o||r?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:i.jsx(a.icon,{className:"h-5 w-5 shrink-0"})},a.segment)})})})}function qw(){return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[i.jsx(Fw,{}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx(zw,{}),i.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:i.jsx(jS,{})})]}),i.jsx($w,{})]})}let Yw=0;const Qt=es(e=>({toasts:[],addToast:(t,a="info",r,o)=>{const u=(o==null?void 0:o.id)??`toast-${++Yw}-${Date.now()}`;e(c=>c.toasts.some(f=>f.id===u)?c:{toasts:[...c.toasts,{id:u,message:t,variant:a,sessionId:r,persistent:o==null?void 0:o.persistent}]}),o!=null&&o.persistent||setTimeout(()=>{e(c=>({toasts:c.toasts.filter(f=>f.id!==u)}))},4e3)},removeToast:t=>{e(a=>({toasts:a.toasts.filter(r=>r.id!==t)}))}}));function Gw({onClose:e}){const[t,a]=T.useState(""),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState("opencode"),[h,b]=T.useState(!1),[g,y]=T.useState(""),N=je(O=>O.addRepo),v=r.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,S=async O=>{const k=O.trim();if(k){b(!0),y("");try{const B=await wC(k);B.name&&!r.trim()&&o(B.name),B.gitUrl&&!u.trim()&&c(B.gitUrl)}catch(B){const R=B instanceof Error?B.message:"无法解析路径";try{const H=JSON.parse(R);y(H.error??R)}catch{y(R)}}b(!1)}},C=T.useRef(S);C.current=S,T.useEffect(()=>{const O=t.trim();if(!O)return;const k=setTimeout(()=>{C.current(O)},500);return()=>clearTimeout(k)},[t]);const A=async()=>{if(!v)return;y(""),await N(r.trim(),u.trim(),t.trim(),f)&&e()};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:i.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:O=>O.stopPropagation(),children:[i.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[i.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),i.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(gt,{className:"h-4 w-4"})})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),i.jsx("input",{id:"m-path",value:t,onChange:O=>a(O.target.value),onBlur:O=>void S(O.target.value),placeholder:"/Users/you/code/repo",autoFocus:!0,className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"}),i.jsx("span",{className:"text-[11px] text-fg-5",children:h?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),i.jsx("input",{id:"m-name",value:r,onChange:O=>o(O.target.value),placeholder:"my-project",className:"w-full rounded-lg border border-line bg-base px-3 py-2 text-sm text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),i.jsx("input",{id:"m-git",value:u,onChange:O=>c(O.target.value),placeholder:"https://github.com/org/repo.git",className:"w-full rounded-lg border border-line bg-base px-3 py-2 font-mono text-xs text-fg placeholder:text-fg-5 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{className:"text-xs font-medium text-fg-3",children:"运行时"}),i.jsx("div",{className:"flex gap-2",children:[{value:"opencode",label:"OpenCode"},{value:"claude-code",label:"Claude Code"}].map(O=>i.jsx("button",{type:"button",onClick:()=>m(O.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===O.value?"border-blue-500 bg-blue-500/10 text-blue-600":"border-line bg-base text-fg-4 hover:bg-elevated hover:text-fg-2"}`,children:O.label},O.value))}),i.jsx("span",{className:"text-[11px] text-fg-5",children:f==="claude-code"?"需要本地安装 Claude Code CLI":"需要本地安装 OpenCode CLI"})]}),g&&i.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:g}),i.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[i.jsx("button",{type:"button",onClick:e,className:"rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),i.jsx("button",{type:"button",onClick:A,disabled:!v,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 disabled:cursor-not-allowed disabled:bg-fg-6 disabled:text-fg-4",children:"添加仓库"})]})]})]})})}function Kw({repoId:e,repoName:t,onClose:a}){const[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(!0),[h,b]=T.useState(!1),[g,y]=T.useState(null);T.useEffect(()=>{Cw(e).then(S=>{o(S.content),c(S.content),m(!1)}).catch(S=>{y(S instanceof Error?S.message:String(S)),m(!1)})},[e]);const N=async()=>{b(!0),y(null);try{await ww(e,r),c(r)}catch(S){y(S instanceof Error?S.message:String(S))}b(!1)},v=r!==u;return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:i.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),i.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),i.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:i.jsx(gt,{className:"h-4 w-4"})})]}),g&&i.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg bg-red-500/10 px-3 py-2 text-xs text-red-400",children:[i.jsx(Tn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 break-words",children:g})]}),f?i.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[i.jsx(ln,{className:"h-5 w-5 fs-spin"}),i.jsx("p",{className:"text-xs",children:"加载中…"})]}):i.jsx("textarea",{value:r,onChange:S=>o(S.target.value),spellCheck:!1,className:"h-96 w-full resize-y rounded-lg border border-line bg-base px-4 py-3 font-mono text-sm leading-relaxed text-fg placeholder:text-fg-6 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20",placeholder:`# AGENTS.md
461
461
 
462
462
  在此编写该仓库的 Agent 指令…`}),i.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[i.jsx("button",{type:"button",onClick:a,className:"rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"关闭"}),i.jsxs("button",{type:"button",onClick:()=>void N(),disabled:h||!v,className:"flex items-center gap-1.5 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 disabled:opacity-40",children:[i.jsx(Xc,{className:"h-3.5 w-3.5"}),h?"保存中…":"保存"]})]})]})})}const lh=1024,oh=lh*1024,Bx=oh*1024;function Px(e){return!e||e<=0?"0 B":e<lh?`${e} B`:e<oh?`${(e/lh).toFixed(1)} KB`:e<Bx?`${(e/oh).toFixed(1)} MB`:`${(e/Bx).toFixed(2)} GB`}const Tm="ws/";function Vw({repoId:e}){const[t,a]=T.useState(!1),[r,o]=T.useState(null),[u,c]=T.useState(!1),[f,m]=T.useState(null),[h,b]=T.useState(null),[g,y]=T.useState(!1),N=async()=>{c(!0),m(null);try{const O=await LC(e);o(O)}catch(O){m(O instanceof Ss?O.message:"加载失败")}c(!1)};T.useEffect(()=>{t&&r===null&&N()},[t]);const v=async O=>{b(O);try{await jC(e,O),await N()}catch(k){m(k instanceof Ss?k.message:"删除失败")}b(null)},S=async()=>{y(!0);try{await BC(e),await N()}catch(O){m(O instanceof Ss?O.message:"清理失败")}y(!1)},C=(r==null?void 0:r.length)??0,A=(r==null?void 0:r.reduce((O,k)=>O+(k.diskUsage||0),0))??0;return i.jsxs("div",{className:"mt-3 border-t border-line pt-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>a(O=>!O),className:"flex min-w-0 flex-1 items-center gap-1.5 text-left text-xs font-medium text-fg-3 transition-colors hover:text-fg-2",children:[t?i.jsx(zA,{className:"h-3 w-3 shrink-0"}):i.jsx(ba,{className:"h-3 w-3 shrink-0"}),i.jsx(ko,{className:"h-3 w-3 shrink-0 text-fg-5"}),i.jsx("span",{children:"工作空间"}),r!==null&&i.jsxs("span",{className:"text-fg-5",children:["(",C,") · ",Px(A)]})]}),t&&C>0&&i.jsxs("button",{type:"button",onClick:()=>void S(),disabled:g,className:"flex h-6 shrink-0 items-center gap-1 rounded border border-line px-2 text-xs text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2 disabled:opacity-50",children:[g?i.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):null,"清理已合并"]})]}),t&&i.jsxs("div",{className:"mt-2",children:[f&&i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2 rounded border border-red-500/30 bg-red-500/5 px-2 py-1 text-xs text-red-600",children:[i.jsx("span",{className:"truncate",children:f}),i.jsx("button",{type:"button",onClick:()=>m(null),className:"shrink-0 rounded p-0.5 transition-colors hover:bg-red-500/10",children:i.jsx(gt,{className:"h-3 w-3"})})]}),u&&r===null?i.jsx("div",{className:"flex justify-center py-3",children:i.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-fg-5 border-t-transparent"})}):C===0?i.jsx("p",{className:"py-2 text-center text-xs text-fg-5",children:"暂无工作空间"}):i.jsx("ul",{className:"space-y-1",children:r==null?void 0:r.map(O=>{const k=O.branch.startsWith(Tm),B=k?O.branch.slice(Tm.length):O.branch,R=O.status==="active"?"bg-emerald-500/10 text-emerald-600":O.status==="idle"?"bg-amber-500/10 text-amber-600":"bg-fg-6/30 text-fg-4",H=O.status==="active"?"活跃":O.status==="idle"?"空闲":O.status==="merged"?"已合并":O.status==="stale"?"陈旧":O.status,q=O.status!=="active";return i.jsxs("li",{className:"flex items-center gap-2 rounded-md border border-line bg-elevated/40 px-2 py-1.5 text-xs",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[O.running&&O.port&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",title:`运行中 :${O.port}`}),i.jsxs("span",{className:"min-w-0 truncate font-mono",children:[k&&i.jsx("span",{className:"text-fg-5",children:Tm}),i.jsx("span",{className:"text-fg-2",children:B})]})]}),i.jsx("span",{className:ae("shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium",R),children:H}),i.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 text-fg-5",children:[i.jsx(v3,{className:"h-2.5 w-2.5"}),Px(O.diskUsage)]}),i.jsx("button",{type:"button",onClick:()=>void v(O.id),disabled:!q||h===O.id,title:q?"删除工作空间":"活跃工作空间无法删除",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-fg-5 transition-colors hover:bg-red-500/10 hover:text-red-500 disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-fg-5",children:h===O.id?i.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):i.jsx(Cs,{className:"h-3 w-3"})})]},O.id)})})]})]})}function $y(){const e=je(R=>R.repos),t=je(R=>R.activeRepoId),a=je(R=>R.setActiveRepo),r=je(R=>R.removeRepo),o=je(R=>R.loadRepos),[u,c]=T.useState(!1),[f,m]=T.useState(null),[h,b]=T.useState(null),[g,y]=T.useState(null),N=Qt(R=>R.addToast),[v,S]=T.useState(null),[C,A]=T.useState(null),O=T.useRef(null);T.useEffect(()=>{if(!C)return;const R=H=>{O.current&&!O.current.contains(H.target)&&A(null)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[C]);const k=async(R,H)=>{b(R);try{H?await OC(R):await RC(R),await o()}catch{}b(null)},B=async R=>{y(R);try{const H=await DC(R);await o();const q=H.alreadyUpToDate?"info":"success";N(H.summary,q,void 0,{persistent:!0})}catch(H){let q="拉取失败";if(H instanceof Ss)try{q=JSON.parse(H.message).error??H.message}catch{q=H.message}N(q,"error",void 0,{persistent:!0})}y(null)};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-6 flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-lg font-semibold text-fg",children:"仓库管理"}),i.jsx("p",{className:"mt-0.5 text-sm text-fg-4",children:"管理代码仓库,每个仓库对应一个独立的 Agent 运行环境"})]}),i.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 md:px-4",children:[i.jsx(Ia,{className:"h-4 w-4"}),i.jsx("span",{className:"hidden md:inline",children:"添加仓库"})]})]}),e.length===0?i.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed border-line-hard py-16 text-center",children:[i.jsx("div",{className:"rounded-full bg-elevated p-3",children:i.jsx(Ia,{className:"h-6 w-6 text-fg-4"})}),i.jsx("p",{className:"text-sm font-medium text-fg-3",children:"暂无代码仓库"}),i.jsx("p",{className:"text-xs text-fg-5",children:"添加一个本地仓库开始使用"}),i.jsx("button",{type:"button",onClick:()=>c(!0),className:"mt-2 rounded-lg border border-line px-4 py-2 text-sm text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"添加仓库"})]}):i.jsx(i.Fragment,{children:i.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:e.map(R=>{const H=R.id===t;return i.jsxs("div",{className:ae("rounded-xl border p-4 transition-colors",H?"border-blue-500/40 bg-blue-500/5":"border-line"),children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>a(R.id),className:"flex min-w-0 items-center gap-2 text-left",children:[H?i.jsx(Yr,{className:"h-4 w-4 shrink-0 text-blue-500"}):i.jsx(WA,{className:"h-4 w-4 shrink-0 text-fg-5"}),i.jsx("span",{className:ae("truncate font-medium",H?"text-fg":"text-fg-2"),children:R.name})]}),i.jsxs("span",{className:ae("inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",R.running?"bg-emerald-500/10 text-emerald-600":"bg-fg-6/30 text-fg-4"),children:[i.jsx("span",{className:ae("h-1.5 w-1.5 rounded-full",R.running?"bg-emerald-500":"bg-fg-5")}),R.running?"运行中":"已停止"]})]}),i.jsxs("dl",{className:"mt-3 space-y-1 font-mono text-xs text-fg-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("dt",{className:"shrink-0 text-fg-5",children:"Git"}),i.jsx("dd",{className:"min-w-0 truncate",children:R.gitUrl})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("dt",{className:"shrink-0 text-fg-5",children:"路径"}),i.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsx("span",{className:"truncate",children:R.localPath}),i.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(R.localPath),title:"复制路径",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:i.jsx(Sc,{className:"h-3 w-3"})})]})]}),R.running&&R.port&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("dt",{className:"shrink-0 text-fg-5",children:"直连"}),i.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsxs("a",{href:`http://127.0.0.1:${R.port}`,target:"_blank",rel:"noopener noreferrer",className:"truncate text-blue-500 hover:underline",children:["127.0.0.1:",R.port]}),i.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(`http://127.0.0.1:${R.port}`),title:"复制链接",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:i.jsx(Sc,{className:"h-3 w-3"})})]})]})]}),i.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>void B(R.id),disabled:g===R.id,className:"flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-md border border-blue-500/30 px-2.5 text-xs font-medium text-blue-600 transition-colors hover:bg-blue-500/10 disabled:opacity-50",children:g===R.id?i.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):i.jsxs(i.Fragment,{children:[i.jsx(AA,{className:"h-3 w-3"}),"拉取"]})}),i.jsx("button",{type:"button",onClick:()=>void k(R.id,R.running),disabled:h===R.id,className:ae("flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md border text-xs font-medium transition-colors disabled:opacity-50",R.running?"border-amber-500/30 text-amber-600 hover:bg-amber-500/10":"border-emerald-500/30 text-emerald-600 hover:bg-emerald-500/10"),children:h===R.id?i.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):R.running?i.jsxs(i.Fragment,{children:[i.jsx(nh,{className:"h-3 w-3 fill-current"}),"停止"]}):i.jsxs(i.Fragment,{children:[i.jsx(Kh,{className:"h-3 w-3 fill-current"}),"启动"]})}),i.jsxs("div",{className:"relative",ref:C===R.id?O:void 0,children:[i.jsx("button",{type:"button",onClick:()=>A(C===R.id?null:R.id),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:i.jsx(Fh,{className:"h-4 w-4"})}),C===R.id&&i.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 min-w-[160px] overflow-hidden rounded-lg border border-line bg-elevated shadow-lg",children:[i.jsx("button",{type:"button",className:ae("flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-base/60",R.runtimeType==="claude-code"?"text-orange-500":"text-sky-500"),onClick:async()=>{A(null);const q=R.runtimeType==="claude-code"?"opencode":"claude-code";await UC(R.id,q),o()},children:R.runtimeType==="claude-code"?"Claude → OpenCode":"OpenCode → Claude"}),i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-base/60",onClick:async()=>{A(null),await PC(R.id,!R.worktreeEnabled),o()},children:[i.jsx(ko,{className:"h-3 w-3"}),i.jsx("span",{children:"Worktree"}),i.jsx("span",{className:ae("ml-auto text-[10px]",R.worktreeEnabled?"text-violet-500":"text-fg-5"),children:R.worktreeEnabled?"已开启":"已关闭"})]}),i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-fg-3 transition-colors hover:bg-base/60",onClick:()=>{A(null),S({id:R.id,name:R.name})},children:[i.jsx(zh,{className:"h-3 w-3"}),"配置"]}),i.jsx("div",{className:"my-0.5 border-t border-line"}),i.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs text-red-500 transition-colors hover:bg-red-500/10",onClick:()=>{A(null),m(R.id)},children:[i.jsx(Cs,{className:"h-3 w-3"}),"删除仓库"]})]})]})]}),f===R.id&&i.jsxs("div",{className:"mt-2 flex items-center justify-between rounded-md border border-red-500/20 bg-red-500/5 px-3 py-2",children:[i.jsx("span",{className:"text-xs text-red-500",children:"确认删除此仓库?"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>{r(R.id),m(null)},className:"flex h-6 items-center gap-1 rounded border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10",children:[i.jsx(On,{className:"h-3 w-3"}),"确认"]}),i.jsx("button",{type:"button",onClick:()=>m(null),className:"flex h-6 items-center gap-1 rounded border border-line px-2 text-xs text-fg-4 transition-colors hover:bg-elevated",children:"取消"})]})]}),R.worktreeEnabled&&i.jsx(Vw,{repoId:R.id})]},R.id)})})}),i.jsxs("p",{className:"mt-3 text-xs text-fg-5",children:[e.length," 个仓库"]}),u&&i.jsx(Gw,{onClose:()=>c(!1)}),v&&i.jsx(Kw,{repoId:v.id,repoName:v.name,onClose:()=>S(null)})]})}function Xw(){return i.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:i.jsx("div",{className:"mx-auto max-w-4xl",children:i.jsx($y,{})})})}const Qw=new Set(["tool","tool-use","tool_use","tool-call","tool_call","tool-result","tool_result"]),Ww=new Set(["thinking","reasoning","reason"]),Zw=new Set(["text","output_text","message"]),Jw=new Set(["file","image"]);function wc(e){var a;const t=((a=e.type)==null?void 0:a.toLowerCase())??"";return Qw.has(t)||e.toolName!=null||e.tool!=null?"tool":Jw.has(t)?"file":Ww.has(t)?"thinking":Zw.has(t)||e.content!=null||e.text!=null?"text":"other"}function kc(e){return e.content??e.text??""}function qy(e){return e.toolName??e.tool??"tool"}function Wc(e){var t;return e.input??((t=e.state)==null?void 0:t.input)}function Wh(e){var t;return e.output??((t=e.state)==null?void 0:t.output)}function Zh(e){var a,r,o;const t=(r=(a=e.state)==null?void 0:a.status)==null?void 0:r.toLowerCase();return t==="completed"||t==="done"||t==="success"?"completed":t==="error"||t==="failed"||((o=e.state)==null?void 0:o.error)!=null?"error":t==="pending"||t==="queued"?"pending":t==="running"||t==="in_progress"?"running":Wh(e)!=null?"completed":"running"}function Ux(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function $r(e){const t=e==null?void 0:e.toLowerCase();return t==="in_progress"||t==="in-progress"||t==="active"?"in_progress":t==="completed"||t==="done"||t==="complete"?"completed":t==="cancelled"||t==="canceled"?"cancelled":"pending"}function Yy(e){return e.filter(t=>$r(t.status)==="completed").length}function yo(e){const t=qy(e).toLowerCase();return t==="question"||t==="mcp_question"}function e5(e){const t=Wc(e);if(!t||typeof t!="object")return null;const a=t;return Array.isArray(a.questions)?a.questions:null}function Rc(e){if(!yo(e))return!1;const t=Zh(e);return t==="pending"||t==="running"}const t5=/\bses_[a-zA-Z0-9]+/;function n5(e){var o;const t=Wc(e);if(t&&typeof t=="object"){const u=t;if(typeof u.task_id=="string"&&u.task_id.startsWith("ses_"))return u.task_id}const a=(o=e.state)==null?void 0:o.metadata;if(a){const u=a.session_id??a.sessionId;if(typeof u=="string"&&u.startsWith("ses_"))return u}const r=Wh(e);if(typeof r=="string"){const u=t5.exec(r);if(u)return u[0]}if(r&&typeof r=="object"){const u=r,c=u.session_id??u.sessionId??u.task_id;if(typeof c=="string"&&c.startsWith("ses_"))return c}return null}const a5=es(()=>({agents:[],loaded:!1}));function Gy(e){return`question-${e}`}function _m(e,t){const a=t.find(o=>o.id===e),r=(a==null?void 0:a.title)||e.slice(-8);Qt.getState().addToast(`${r} — 等待回复`,"warning",e,{id:Gy(e),persistent:!0})}function s5(e){var t;for(const a of e)if((t=a.parts)!=null&&t.some(r=>yo(r)&&Rc(r)))return!0;return!1}const No=[],To=[],Hx=[],Ir={};function Fx(e){return e.id??e.callID}function kn(){return je.getState().activeRepoId}async function zx(e,t){const a=kn();if(a)try{const[r,o]=await Promise.all([XC(a,e),Oy(a).catch(()=>null)]);t(u=>{const c={sessionLinks:{...u.sessionLinks,[e]:r}};return o&&(c.allSessionLinks=o),c})}catch{}}const $x=20,Re=es((e,t)=>({sessions:[],activeSessionId:null,messages:{},messagesMeta:{},todos:{},sessionStatuses:{},errorReasons:{},queuedMessageIds:{},sessionLinks:{},allSessionLinks:{},sessionFilter:"active",loadingSessions:!1,loadError:null,sendError:null,setSessionFilter:a=>e({sessionFilter:a}),toggleSessionComplete:async a=>{const r=kn();if(!r)return;const o=t().sessions.find(c=>c.id===a);if(!o)return;const u=o.completedAt?null:Date.now();e(c=>({sessions:c.sessions.map(f=>f.id===a?{...f,completedAt:u??void 0}:f)}));try{await vw(r,a,u)}catch{await t().loadSessions()}},loadSessions:async()=>{const a=kn();if(!a){e({sessions:[],loadingSessions:!1});return}e({loadingSessions:!0,loadError:null});try{const[r,o]=await Promise.all([HC(a),Oy(a).catch(()=>null)]),u={sessions:r,loadingSessions:!1};o&&(u.allSessionLinks=o),e(u)}catch(r){e({loadingSessions:!1,loadError:r instanceof Error?r.message:"Failed to load sessions"})}},createSession:async(a,r,o,u,c,f,m)=>{const h=kn();if(!h)return null;e({sendError:null});try{const b=await FC(h,a,r,o,u,c,f,m);return e(g=>({sessions:[b,...g.sessions.filter(y=>y.id!==b.id)],activeSessionId:b.id,messages:{...g.messages,[b.id]:[]}})),t().setSessionStatus(b.id,"busy"),b}catch(b){return e({sendError:b instanceof Error?b.message:"Failed to create session"}),null}},setActiveSession:async a=>{kn()&&(e({activeSessionId:a,sendError:null}),await t().refreshSessionData(a))},refreshSessionData:async a=>{var b,g;const r=kn();if(!r)return;const u=!t().messages[a]||t().messages[a].length===0?{limit:$x}:void 0,[c,f]=await Promise.allSettled([QC(r,a),Ax(r,a,u)]),m=c.status==="fulfilled"?c.value:null,h=(g=(b=m==null?void 0:m.session)==null?void 0:b.revert)==null?void 0:g.messageID;e(y=>{const N={};if(m&&(m.status&&(N.sessionStatuses={...y.sessionStatuses,[a]:m.status.type}),m.todos&&(N.todos={...y.todos,[a]:m.todos}),m.links&&(N.sessionLinks={...y.sessionLinks,[a]:m.links}),m.session&&(N.sessions=y.sessions.map(v=>v.id===a?{...v,...m.session}:v))),f.status==="fulfilled"){let v=f.value.messages;if(h){const C=v.findIndex(A=>A.id===h);C>=0&&(v=v.slice(0,C+1))}const S=y.messages[a]??[];v.length>=S.length&&(N.messages={...y.messages,[a]:v}),N.messagesMeta={...y.messagesMeta,[a]:{total:Math.max(f.value.total,S.length),hasMore:f.value.hasMore,loading:!1}}}return N}),f.status==="fulfilled"&&s5(f.value.messages)&&_m(a,t().sessions)},loadMoreMessages:async a=>{var f;const r=kn();if(!r)return;const o=t().messagesMeta[a];if(!(o!=null&&o.hasMore)||o.loading)return;const c=(f=(t().messages[a]??[])[0])==null?void 0:f.id;e(m=>({messagesMeta:{...m.messagesMeta,[a]:{...o,loading:!0}}}));try{const m=await Ax(r,a,{limit:$x,before:c});e(h=>{const b=h.messages[a]??[];return{messages:{...h.messages,[a]:[...m.messages,...b]},messagesMeta:{...h.messagesMeta,[a]:{total:m.total,hasMore:m.hasMore,loading:!1}}}})}catch{e(m=>({messagesMeta:{...m.messagesMeta,[a]:{...o,loading:!1}}}))}},addLink:async(a,r,o)=>{const u=kn();if(!u)return!1;try{return await WC(u,a,r,o),await zx(a,e),!0}catch{return!1}},removeLink:async(a,r,o)=>{const u=kn();if(!u)return!1;try{return await ZC(u,a,r,o),await zx(a,e),!0}catch{return!1}},deleteSession:async a=>{const r=kn();if(r)try{await zC(r,a)}catch{}delete Ir[a],e(o=>{const{[a]:u,...c}=o.messages,{[a]:f,...m}=o.messagesMeta,{[a]:h,...b}=o.todos,{[a]:g,...y}=o.sessionStatuses,{[a]:N,...v}=o.errorReasons,{[a]:S,...C}=o.queuedMessageIds,{[a]:A,...O}=o.sessionLinks,{[a]:k,...B}=o.allSessionLinks;return{sessions:o.sessions.filter(R=>R.id!==a),messages:c,messagesMeta:m,todos:b,sessionStatuses:y,errorReasons:v,queuedMessageIds:C,sessionLinks:O,allSessionLinks:B,activeSessionId:o.activeSessionId===a?null:o.activeSessionId}})},sendMessage:async(a,r,o)=>{const u=kn(),c=t().activeSessionId;if(!u||!c)return!1;const f=t().sessions.find(h=>h.id===c),m=t().sessionStatuses[c]==="busy";e({sendError:null}),m||t().setSessionStatus(c,"busy");try{const h=a5.getState(),b=f!=null&&f.agent&&h.loaded&&h.agents.some(g=>g.name===f.agent||g.id===f.agent)?f.agent:void 0;return await $C(u,c,a,b,r,o),m&&(Ir[c]=(Ir[c]||0)+1),!0}catch(h){return e({sendError:h instanceof Error?h.message:"Failed to send message"}),m||t().setSessionStatus(c,"idle"),!1}},replyQuestion:async a=>{const r=kn(),o=t().activeSessionId;if(!(!r||!o))try{await YC(r,o,a)}catch(u){e({sendError:u instanceof Error?u.message:"Failed to reply to question"})}},rejectQuestion:async()=>{const a=kn(),r=t().activeSessionId;if(!(!a||!r))try{await GC(a,r)}catch{}},abortSession:async()=>{const a=kn(),r=t().activeSessionId;if(!(!a||!r)){try{await qC(a,r)}catch{}t().setSessionStatus(r,"idle")}},clearSessions:()=>{for(const a of Object.keys(Ir))delete Ir[a];e({sessions:[],activeSessionId:null,messages:{},messagesMeta:{},todos:{},sessionStatuses:{},errorReasons:{},queuedMessageIds:{},sessionLinks:{},allSessionLinks:{},loadError:null,sendError:null})},updateMessage:(a,r)=>{var o;e(u=>{const c=u.messages[a]??[],f=c.findIndex(g=>g.id===r.id);let m,h=u.queuedMessageIds,b=u.messagesMeta;if(f>=0){const g={...c[f],...r};(!r.parts||r.parts.length===0)&&c[f].parts&&(g.parts=c[f].parts),m=[...c],m[f]=g}else{m=[...c,r];const g=b[a];g&&(b={...b,[a]:{...g,total:g.total+1}});const y=Ir[a]||0;if(r.role==="user"&&y>0){const N=[...h[a]??[]];N.push(r.id),h={...h,[a]:N},Ir[a]=y-1}else if(r.role==="assistant"){const N=h[a];N&&N.length>0&&(h={...h,[a]:N.slice(1)})}}return{messages:{...u.messages,[a]:m},messagesMeta:b,queuedMessageIds:h}}),(o=r.parts)!=null&&o.some(u=>yo(u)&&Rc(u))&&_m(a,t().sessions)},updateMessagePart:(a,r,o)=>{e(u=>{const c=u.messages[a]??[],f=c.findIndex(v=>v.id===r),m=f>=0?c[f]:{id:r,role:"assistant"},h=m.parts?[...m.parts]:[],b=Fx(o),g=b!=null?h.findIndex(v=>Fx(v)===b):-1;g>=0?h[g]={...h[g],...o}:h.push(o);const y={...m,parts:h},N=f>=0?[...c]:[...c,y];return f>=0&&(N[f]=y),{messages:{...u.messages,[a]:N}}}),yo(o)&&Rc(o)&&_m(a,t().sessions)},appendMessagePartDelta:(a,r,o,u)=>{e(c=>{const f=c.messages[a]??[],m=f.findIndex(v=>v.id===r),h=m>=0?f[m]:{id:r,role:"assistant"},b=h.parts?[...h.parts]:[],g=b.findIndex(v=>v.id===o);if(g>=0){const v=b[g],S=kc(v)+u;b[g]=v.content!=null?{...v,content:S}:{...v,text:S}}else b.push({id:o,type:"text",text:u});const y={...h,parts:b},N=m>=0?[...f]:[...f,y];return m>=0&&(N[m]=y),{messages:{...c.messages,[a]:N}}})},updateTodos:(a,r)=>{e(o=>({todos:{...o.todos,[a]:r}}))},updateSessionInfo:a=>{e(r=>r.sessions.some(u=>u.id===a.id)?{sessions:r.sessions.map(u=>u.id===a.id?{...u,...a}:u)}:{sessions:[a,...r.sessions]})},setSessionStatus:(a,r,o)=>{const u=t().sessionStatuses[a];if(u!==r){const c=t().sessions.find(m=>m.id===a),f=(c==null?void 0:c.title)||a.slice(-8);if(r==="idle"&&u!==void 0&&u!=="idle")Qt.getState().removeToast(Gy(a)),Qt.getState().addToast(`${f} — 完成`,"success",a);else if(r==="busy"&&(u===void 0||u==="idle"))Qt.getState().addToast(`${f} — 开始运行`,"info",a);else if(r==="retry")Qt.getState().addToast(`${f} — 进入重试`,"warning",a);else if(r==="error"){const m=o?`${f} — 错误: ${o}`:`${f} — 发生错误`;Qt.getState().addToast(m,"error",a)}}e(c=>{const f=o?{...c.errorReasons,[a]:o}:r!=="error"?(()=>{const{[a]:m,...h}=c.errorReasons;return h})():c.errorReasons;return{sessionStatuses:{...c.sessionStatuses,[a]:r},errorReasons:f}})},bulkSetStatuses:a=>{e({sessionStatuses:{...t().sessionStatuses,...a}})},renameSession:async(a,r)=>{const o=kn();if(o){e(u=>({sessions:u.sessions.map(c=>c.id===a?{...c,title:r}:c)}));try{await _w(o,a,r)}catch{await t().loadSessions()}}},revertToMessage:async(a,r)=>{const o=kn();if(!o)return!1;try{return await KC(o,a,r),await t().refreshSessionData(a),!0}catch{return!1}}})),Ve=es((e,t)=>({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,syncing:!1,selectedIssueId:null,viewingIssueId:null,viewingTreeRootId:null,matchingParentId:null,matchingCandidateId:null,clearIssues:()=>e({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,selectedIssueId:null,viewingIssueId:null,viewingTreeRootId:null,matchingParentId:null,matchingCandidateId:null}),setSelectedIssue:a=>e({selectedIssueId:a}),setViewingIssue:(a,r)=>e({viewingIssueId:a,viewingTreeRootId:r??null}),enterMatchMode:a=>e({matchingParentId:a,matchingCandidateId:null}),exitMatchMode:()=>{e({matchingParentId:null,matchingCandidateId:null})},linkChild:async(a,r)=>{var u;const o=je.getState().activeRepoId;if(!o)return!1;try{await dw(o,a,r);const c=(u=t().issues.find(f=>f.number===a))==null?void 0:u.id;return c&&e(f=>({issues:f.issues.map(m=>m.number===r?{...m,parentId:c}:m),matchingCandidateId:null})),!0}catch{return!1}},updateIssueState:async(a,r)=>{const o=je.getState().activeRepoId;if(!o)return!1;try{const u=await By(o,a,{state:r});return e(c=>({issues:c.issues.map(f=>f.number===a?{...f,state:u.state}:f)})),!0}catch{return!1}},loadIssues:async()=>{const a=je.getState().activeRepoId;if(!a){e({issues:[],loaded:!0});return}try{const r=await Rx(a,"all");e({issues:r,loaded:!0})}catch{e({loaded:!0})}},syncIssues:async()=>{const a=je.getState().activeRepoId;if(a){e({syncing:!0});try{await uw(a,"open");const[r,o,u]=await Promise.all([Rx(a,"all"),wx(a),kx(a)]);e({issues:r,tags:o,milestones:u,syncing:!1})}catch(r){e({syncing:!1});let o="同步 Issue 失败";if(r instanceof Ss)try{const u=JSON.parse(r.message);u.error&&(o=u.error)}catch{r.message&&(o=r.message)}Qt.getState().addToast(o,"error")}}},createIssue:async(a,r)=>{const o=je.getState().activeRepoId;if(!o)return null;try{const u=await cw(o,a,r);return e(c=>({issues:[u,...c.issues]})),u}catch{return null}},loadTags:async()=>{const a=je.getState().activeRepoId;if(!a){e({tags:[]});return}try{const r=await wx(a);e({tags:r})}catch{}},cycleTagFilter:a=>{e(r=>{const o=new Map(r.tagFilterMode),u=o.get(a);return u?u==="include"?o.set(a,"exclude"):o.delete(a):o.set(a,"include"),{tagFilterMode:o}})},clearTagFilter:()=>e({tagFilterMode:new Map}),loadMilestones:async()=>{const a=je.getState().activeRepoId;if(!a){e({milestones:[]});return}try{const r=await kx(a);e({milestones:r})}catch{}},setMilestoneFilter:a=>e({selectedMilestoneId:a})})),xc=es(e=>({drafts:{},setDraft:(t,a)=>e(r=>{if(!a.trim()){const{[t]:o,...u}=r.drafts;return{drafts:u}}return{drafts:{...r.drafts,[t]:a}}}),clearDraft:t=>e(a=>{const{[t]:r,...o}=a.drafts;return{drafts:o}})}));function qx(e){const t=[],a=String(e||"");let r=a.indexOf(","),o=0,u=!1;for(;!u;){r===-1&&(r=a.length,u=!0);const c=a.slice(o,r).trim();(c||!u)&&t.push(c),o=r+1,r=a.indexOf(",",o)}return t}function Ky(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const r5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l5={};function Yx(e,t){return(l5.jsx?i5:r5).test(e)}const o5=/[ \t\n\f\r]/g;function u5(e){return typeof e=="object"?e.type==="text"?Gx(e.value):!1:Gx(e)}function Gx(e){return e.replace(o5,"")===""}class Io{constructor(t,a,r){this.normal=a,this.property=t,r&&(this.space=r)}}Io.prototype.normal={};Io.prototype.property={};Io.prototype.space=void 0;function Vy(e,t){const a={},r={};for(const o of e)Object.assign(a,o.property),Object.assign(r,o.normal);return new Io(a,r,t)}function _o(e){return e.toLowerCase()}class ra{constructor(t,a){this.attribute=a,this.property=t}}ra.prototype.attribute="";ra.prototype.booleanish=!1;ra.prototype.boolean=!1;ra.prototype.commaOrSpaceSeparated=!1;ra.prototype.commaSeparated=!1;ra.prototype.defined=!1;ra.prototype.mustUseProperty=!1;ra.prototype.number=!1;ra.prototype.overloadedBoolean=!1;ra.prototype.property="";ra.prototype.spaceSeparated=!1;ra.prototype.space=void 0;let c5=0;const Xe=Gr(),rn=Gr(),uh=Gr(),_e=Gr(),Rt=Gr(),Ur=Gr(),ga=Gr();function Gr(){return 2**++c5}const ch=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:rn,commaOrSpaceSeparated:ga,commaSeparated:Ur,number:_e,overloadedBoolean:uh,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),vm=Object.keys(ch);class Jh extends ra{constructor(t,a,r,o){let u=-1;if(super(t,a),Kx(this,"space",o),typeof r=="number")for(;++u<vm.length;){const c=vm[u];Kx(this,vm[u],(r&ch[c])===ch[c])}}}Jh.prototype.defined=!0;function Kx(e,t,a){a&&(e[t]=a)}function Zi(e){const t={},a={};for(const[r,o]of Object.entries(e.properties)){const u=new Jh(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(u.mustUseProperty=!0),t[r]=u,a[_o(r)]=r,a[_o(u.attribute)]=r}return new Io(t,a,e.space)}const Xy=Zi({properties:{ariaActiveDescendant:null,ariaAtomic:rn,ariaAutoComplete:null,ariaBusy:rn,ariaChecked:rn,ariaColCount:_e,ariaColIndex:_e,ariaColSpan:_e,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:rn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:rn,ariaFlowTo:Rt,ariaGrabbed:rn,ariaHasPopup:null,ariaHidden:rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:_e,ariaLive:null,ariaModal:rn,ariaMultiLine:rn,ariaMultiSelectable:rn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:_e,ariaPressed:rn,ariaReadOnly:rn,ariaRelevant:null,ariaRequired:rn,ariaRoleDescription:Rt,ariaRowCount:_e,ariaRowIndex:_e,ariaRowSpan:_e,ariaSelected:rn,ariaSetSize:_e,ariaSort:null,ariaValueMax:_e,ariaValueMin:_e,ariaValueNow:_e,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Qy(e,t){return t in e?e[t]:t}function Wy(e,t){return Qy(e,t.toLowerCase())}const d5=Zi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ur,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alpha:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:Rt,autoFocus:Xe,autoPlay:Xe,blocking:Rt,capture:null,charSet:null,checked:Xe,cite:null,className:Rt,closedBy:null,colorSpace:null,cols:_e,colSpan:_e,command:null,commandFor:null,content:null,contentEditable:rn,controls:Xe,controlsList:Rt,coords:_e|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:uh,draggable:rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:_e,hidden:uh,high:_e,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Xe,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:_e,manifest:null,max:null,maxLength:_e,media:null,method:null,min:null,minLength:_e,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Xe,optimum:_e,pattern:null,ping:Rt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:Rt,required:Xe,reversed:Xe,rows:_e,rowSpan:_e,sandbox:Rt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootCustomElementRegistry:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shadowRootSerializable:Xe,shape:null,size:_e,sizes:null,slot:null,span:_e,spellCheck:rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_e,step:null,style:null,tabIndex:_e,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:rn,width:_e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:_e,borderColor:null,bottomMargin:_e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:_e,leftMargin:_e,link:null,longDesc:null,lowSrc:null,marginHeight:_e,marginWidth:_e,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:_e,rules:null,scheme:null,scrolling:rn,standby:null,summary:null,text:null,topMargin:_e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_e,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Xe,disablePictureInPicture:Xe,disableRemotePlayback:Xe,exportParts:Ur,part:Rt,prefix:null,property:null,results:_e,security:null,unselectable:null},space:"html",transform:Wy}),f5=Zi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ga,accentHeight:_e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_e,amplitude:_e,arabicForm:null,ascent:_e,attributeName:null,attributeType:null,azimuth:_e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_e,by:null,calcMode:null,capHeight:_e,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:_e,diffuseConstant:_e,direction:null,display:null,dur:null,divisor:_e,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:_e,enableBackground:null,end:null,event:null,exponent:_e,externalResourcesRequired:null,fill:null,fillOpacity:_e,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ur,g2:Ur,glyphName:Ur,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_e,horizOriginX:_e,horizOriginY:_e,id:null,ideographic:_e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_e,k:_e,k1:_e,k2:_e,k3:_e,k4:_e,kernelMatrix:ga,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_e,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:_e,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:_e,overlineThickness:_e,paintOrder:null,panose1:null,path:null,pathLength:_e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_e,pointsAtY:_e,pointsAtZ:_e,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ga,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ga,rev:ga,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ga,requiredFeatures:ga,requiredFonts:ga,requiredFormats:ga,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:_e,specularExponent:_e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_e,strikethroughThickness:_e,string:null,stroke:null,strokeDashArray:ga,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_e,strokeOpacity:_e,strokeWidth:null,style:null,surfaceScale:_e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ga,tabIndex:_e,tableValues:null,target:null,targetX:_e,targetY:_e,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ga,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_e,underlineThickness:_e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_e,values:null,vAlphabetic:_e,vMathematical:_e,vectorEffect:null,vHanging:_e,vIdeographic:_e,version:null,vertAdvY:_e,vertOriginX:_e,vertOriginY:_e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Qy}),Zy=Zi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Jy=Zi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wy}),eN=Zi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),m5={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},h5=/[A-Z]/g,Vx=/-[a-z]/g,p5=/^data[-\w.:]+$/i;function Zc(e,t){const a=_o(t);let r=t,o=ra;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&p5.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(Vx,b5);r="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!Vx.test(u)){let c=u.replace(h5,g5);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}o=Jh}return new o(r,t)}function g5(e){return"-"+e.toLowerCase()}function b5(e){return e.charAt(1).toUpperCase()}const Mo=Vy([Xy,d5,Zy,Jy,eN],"html"),ur=Vy([Xy,f5,Zy,Jy,eN],"svg");function Xx(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tN(e){return e.join(" ").trim()}var Di={},Sm,Qx;function x5(){if(Qx)return Sm;Qx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,a=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
463
463
  `,h="/",b="*",g="",y="comment",N="declaration";function v(C,A){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];A=A||{};var O=1,k=1;function B(Y){var j=Y.match(t);j&&(O+=j.length);var D=Y.lastIndexOf(m);k=~D?Y.length-D:k+Y.length}function R(){var Y={line:O,column:k};return function(j){return j.position=new H(Y),K(),j}}function H(Y){this.start=Y,this.end={line:O,column:k},this.source=A.source}H.prototype.content=C;function q(Y){var j=new Error(A.source+":"+O+":"+k+": "+Y);if(j.reason=Y,j.filename=A.source,j.line=O,j.column=k,j.source=C,!A.silent)throw j}function Z(Y){var j=Y.exec(C);if(j){var D=j[0];return B(D),C=C.slice(D.length),j}}function K(){Z(a)}function M(Y){var j;for(Y=Y||[];j=ne();)j!==!1&&Y.push(j);return Y}function ne(){var Y=R();if(!(h!=C.charAt(0)||b!=C.charAt(1))){for(var j=2;g!=C.charAt(j)&&(b!=C.charAt(j)||h!=C.charAt(j+1));)++j;if(j+=2,g===C.charAt(j-1))return q("End of comment missing");var D=C.slice(2,j-2);return k+=2,B(D),C=C.slice(j),k+=2,Y({type:y,comment:D})}}function le(){var Y=R(),j=Z(r);if(j){if(ne(),!Z(o))return q("property missing ':'");var D=Z(u),F=Y({type:N,property:S(j[0].replace(e,g)),value:D?S(D[0].replace(e,g)):g});return Z(c),F}}function te(){var Y=[];M(Y);for(var j;j=le();)j!==!1&&(Y.push(j),M(Y));return Y}return K(),te()}function S(C){return C?C.replace(f,g):g}return Sm=v,Sm}var Wx;function E5(){if(Wx)return Di;Wx=1;var e=Di&&Di.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Di,"__esModule",{value:!0}),Di.default=a;const t=e(x5());function a(r,o){let u=null;if(!r||typeof r!="string")return u;const c=(0,t.default)(r),f=typeof o=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:b}=m;f?o(h,b,m):b&&(u=u||{},u[h]=b)}),u}return Di}var Jl={},Zx;function y5(){if(Zx)return Jl;Zx=1,Object.defineProperty(Jl,"__esModule",{value:!0}),Jl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,a=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||a.test(h)||e.test(h)},c=function(h,b){return b.toUpperCase()},f=function(h,b){return"".concat(b,"-")},m=function(h,b){return b===void 0&&(b={}),u(h)?h:(h=h.toLowerCase(),b.reactCompat?h=h.replace(o,f):h=h.replace(r,f),h.replace(t,c))};return Jl.camelCase=m,Jl}var eo,Jx;function N5(){if(Jx)return eo;Jx=1;var e=eo&&eo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(E5()),a=y5();function r(o,u){var c={};return!o||typeof o!="string"||(0,t.default)(o,function(f,m){f&&m&&(c[(0,a.camelCase)(f,u)]=m)}),c}return r.default=r,eo=r,eo}var T5=N5();const _5=zc(T5),Jc=nN("end"),ts=nN("start");function nN(e){return t;function t(a){const r=a&&a.position&&a.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 v5(e){const t=ts(e),a=Jc(e);if(t&&a)return{start:t,end:a}}function oo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?e1(e.position):"start"in e||"end"in e?e1(e):"line"in e||"column"in e?dh(e):""}function dh(e){return t1(e&&e.line)+":"+t1(e&&e.column)}function e1(e){return dh(e&&e.start)+"-"+dh(e&&e.end)}function t1(e){return e&&typeof e=="number"?e:1}class In extends Error{constructor(t,a,r){super(),typeof a=="string"&&(r=a,a=void 0);let o="",u={},c=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof t=="string"?o=t:!u.cause&&t&&(c=!0,o=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof r=="string"){const m=r.indexOf(":");m===-1?u.ruleId=r:(u.source=r.slice(0,m),u.ruleId=r.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=oo(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}In.prototype.file="";In.prototype.name="";In.prototype.reason="";In.prototype.message="";In.prototype.stack="";In.prototype.column=void 0;In.prototype.line=void 0;In.prototype.ancestors=void 0;In.prototype.cause=void 0;In.prototype.fatal=void 0;In.prototype.place=void 0;In.prototype.ruleId=void 0;In.prototype.source=void 0;const ep={}.hasOwnProperty,S5=new Map,A5=/[A-Z]/g,C5=new Set(["table","tbody","thead","tfoot","tr"]),w5=new Set(["td","th"]),aN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function k5(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=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=B5(a,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=j5(a,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ur:Mo,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=sN(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function sN(e,t,a){if(t.type==="element")return R5(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return O5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return M5(e,t,a);if(t.type==="mdxjsEsm")return I5(e,t);if(t.type==="root")return D5(e,t,a);if(t.type==="text")return L5(e,t)}function R5(e,t,a){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=ur,e.schema=o),e.ancestors.push(t);const u=iN(e,t.tagName,!1),c=P5(e,t);let f=np(e,t);return C5.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!u5(m):!0})),rN(e,c,u,t),tp(c,f),e.ancestors.pop(),e.schema=r,e.create(t,u,c,a)}function O5(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)}vo(e,t.position)}function I5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vo(e,t.position)}function M5(e,t,a){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=ur,e.schema=o),e.ancestors.push(t);const u=t.name===null?e.Fragment:iN(e,t.name,!0),c=U5(e,t),f=np(e,t);return rN(e,c,u,t),tp(c,f),e.ancestors.pop(),e.schema=r,e.create(t,u,c,a)}function D5(e,t,a){const r={};return tp(r,np(e,t)),e.create(t,e.Fragment,r,a)}function L5(e,t){return t.value}function rN(e,t,a,r){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=r)}function tp(e,t){if(t.length>0){const a=t.length>1?t:t[0];a&&(e.children=a)}}function j5(e,t,a){return r;function r(o,u,c,f){const h=Array.isArray(c.children)?a:t;return f?h(u,c,f):h(u,c)}}function B5(e,t){return a;function a(r,o,u,c){const f=Array.isArray(u.children),m=ts(r);return t(o,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function P5(e,t){const a={};let r,o;for(o in t.properties)if(o!=="children"&&ep.call(t.properties,o)){const u=H5(e,o,t.properties[o]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&w5.has(t.tagName)?r=f:a[c]=f}}if(r){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return a}function U5(e,t){const a={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const u=r.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(a,e.evaluater.evaluateExpression(f.argument))}else vo(e,t.position);else{const o=r.name;let u;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const f=r.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else vo(e,t.position);else u=r.value===null?!0:r.value;a[o]=u}return a}function np(e,t){const a=[];let r=-1;const o=e.passKeys?new Map:S5;for(;++r<t.children.length;){const u=t.children[r];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const h=o.get(m)||0;c=m+"-"+h,o.set(m,h+1)}}const f=sN(e,u,c);f!==void 0&&a.push(f)}return a}function H5(e,t,a){const r=Zc(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=r.commaSeparated?Ky(a):tN(a)),r.property==="style"){let o=typeof a=="object"?a:F5(e,String(a));return e.stylePropertyNameCase==="css"&&(o=z5(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?m5[r.property]||r.property:r.attribute,a]}}function F5(e,t){try{return _5(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const r=a,o=new In("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=aN+"#cannot-parse-style-attribute",o}}function iN(e,t,a){let r;if(!a)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let u=-1,c;for(;++u<o.length;){const f=Yx(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}r=c}else r=Yx(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return ep.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);vo(e)}function vo(e,t){const a=new In("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=aN+"#cannot-handle-mdx-estrees-without-createevaluater",a}function z5(e){const t={};let a;for(a in e)ep.call(e,a)&&(t[$5(a)]=e[a]);return t}function $5(e){let t=e.replace(A5,q5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function q5(e){return"-"+e.toLowerCase()}const Am={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"]},Y5={};function ap(e,t){const a=Y5,r=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return lN(e,r,o)}function lN(e,t,a){if(G5(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return n1(e.children,t,a)}return Array.isArray(e)?n1(e,t,a):""}function n1(e,t,a){const r=[];let o=-1;for(;++o<e.length;)r[o]=lN(e[o],t,a);return r.join("")}function G5(e){return!!(e&&typeof e=="object")}const a1=document.createElement("i");function sp(e){const t="&"+e+";";a1.innerHTML=t;const a=a1.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===t?!1:a}function xa(e,t,a,r){const o=e.length;let u=0,c;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,a=a>0?a:0,r.length<1e4)c=Array.from(r),c.unshift(t,a),e.splice(...c);else for(a&&e.splice(t,a);u<r.length;)c=r.slice(u,u+1e4),c.unshift(t,0),e.splice(...c),u+=1e4,t+=1e4}function ka(e,t){return e.length>0?(xa(e,e.length,0,t),e):t}const s1={}.hasOwnProperty;function oN(e){const t={};let a=-1;for(;++a<e.length;)K5(t,e[a]);return t}function K5(e,t){let a;for(a in t){const o=(s1.call(e,a)?e[a]:void 0)||(e[a]={}),u=t[a];let c;if(u)for(c in u){s1.call(o,c)||(o[c]=[]);const f=u[c];V5(o[c],Array.isArray(f)?f:f?[f]:[])}}}function V5(e,t){let a=-1;const r=[];for(;++a<t.length;)(t[a].add==="after"?e:r).push(t[a]);xa(e,0,0,r)}function uN(e,t){const a=Number.parseInt(e,t);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Ha(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fn=cr(/[A-Za-z]/),Rn=cr(/[\dA-Za-z]/),X5=cr(/[#-'*+\--9=?A-Z^-~]/);function Oc(e){return e!==null&&(e<32||e===127)}const fh=cr(/\d/),Q5=cr(/[\dA-Fa-f]/),W5=cr(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Ot(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const ed=cr(new RegExp("\\p{P}|\\p{S}","u")),qr=cr(/\s/);function cr(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Ji(e){const t=[];let a=-1,r=0,o=0;for(;++a<e.length;){const u=e.charCodeAt(a);let c="";if(u===37&&Rn(e.charCodeAt(a+1))&&Rn(e.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(a+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),o=1):c="�"}else c=String.fromCharCode(u);c&&(t.push(e.slice(r,a),encodeURIComponent(c)),r=a+o+1,c=""),o&&(a+=o,o=0)}return t.join("")+e.slice(r)}function ft(e,t,a,r){const o=r?r-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return it(m)?(e.enter(a),f(m)):t(m)}function f(m){return it(m)&&u++<o?(e.consume(m),f):(e.exit(a),t(m))}}const Z5={tokenize:J5};function J5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let a;return t;function r(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ft(e,t,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=m),a=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Fe(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const ek={tokenize:tk},r1={tokenize:nk};function tk(e){const t=this,a=[];let r=0,o,u,c;return f;function f(k){if(r<a.length){const B=a[r];return t.containerState=B[1],e.attempt(B[0].continuation,m,h)(k)}return h(k)}function m(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&O();const B=t.events.length;let R=B,H;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){H=t.events[R][1].end;break}A(r);let q=B;for(;q<t.events.length;)t.events[q][1].end={...H},q++;return xa(t.events,R+1,0,t.events.slice(B)),t.events.length=q,h(k)}return f(k)}function h(k){if(r===a.length){if(!o)return y(k);if(o.currentConstruct&&o.currentConstruct.concrete)return v(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(r1,b,g)(k)}function b(k){return o&&O(),A(r),y(k)}function g(k){return t.parser.lazy[t.now().line]=r!==a.length,c=t.now().offset,v(k)}function y(k){return t.containerState={},e.attempt(r1,N,v)(k)}function N(k){return r++,a.push([t.currentConstruct,t.containerState]),y(k)}function v(k){if(k===null){o&&O(),A(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),S(k)}function S(k){if(k===null){C(e.exit("chunkFlow"),!0),A(0),e.consume(k);return}return Fe(k)?(e.consume(k),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(k),S)}function C(k,B){const R=t.sliceStream(k);if(B&&R.push(null),k.previous=u,u&&(u.next=k),u=k,o.defineSkip(k.start),o.write(R),t.parser.lazy[k.start.line]){let H=o.events.length;for(;H--;)if(o.events[H][1].start.offset<c&&(!o.events[H][1].end||o.events[H][1].end.offset>c))return;const q=t.events.length;let Z=q,K,M;for(;Z--;)if(t.events[Z][0]==="exit"&&t.events[Z][1].type==="chunkFlow"){if(K){M=t.events[Z][1].end;break}K=!0}for(A(r),H=q;H<t.events.length;)t.events[H][1].end={...M},H++;xa(t.events,Z+1,0,t.events.slice(q)),t.events.length=H}}function A(k){let B=a.length;for(;B-- >k;){const R=a[B];t.containerState=R[1],R[0].exit.call(t,e)}a.length=k}function O(){o.write([null]),u=void 0,o=void 0,t.containerState._closeFlow=void 0}}function nk(e,t,a){return ft(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $i(e){if(e===null||Ot(e)||qr(e))return 1;if(ed(e))return 2}function td(e,t,a){const r=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!r.includes(u)&&(t=u(t,a),r.push(u))}return t}const mh={name:"attention",resolveAll:ak,tokenize:sk};function ak(e,t){let a=-1,r,o,u,c,f,m,h,b;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(r=a;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[a][1]).charCodeAt(0)){if((e[r][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;m=e[r][1].end.offset-e[r][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const g={...e[r][1].end},y={...e[a][1].start};i1(g,-m),i1(y,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:y},u={type:m>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[a][1].start}},o={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[r][1].end={...c.start},e[a][1].start={...f.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=ka(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=ka(h,[["enter",o,t],["enter",c,t],["exit",c,t],["enter",u,t]]),h=ka(h,td(t.parser.constructs.insideSpan.null,e.slice(r+1,a),t)),h=ka(h,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",o,t]]),e[a][1].end.offset-e[a][1].start.offset?(b=2,h=ka(h,[["enter",e[a][1],t],["exit",e[a][1],t]])):b=0,xa(e,r-1,a-r+3,h),a=r+h.length-b-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function sk(e,t){const a=this.parser.constructs.attentionMarkers.null,r=this.previous,o=$i(r);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const h=e.exit("attentionSequence"),b=$i(m),g=!b||b===2&&o||a.includes(m),y=!o||o===2&&b||a.includes(r);return h._open=!!(u===42?g:g&&(o||!y)),h._close=!!(u===42?y:y&&(b||!g)),t(m)}}function i1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rk={name:"autolink",tokenize:ik};function ik(e,t,a){let r=0;return o;function o(N){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(N),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(N){return Fn(N)?(e.consume(N),c):N===64?a(N):h(N)}function c(N){return N===43||N===45||N===46||Rn(N)?(r=1,f(N)):h(N)}function f(N){return N===58?(e.consume(N),r=0,m):(N===43||N===45||N===46||Rn(N))&&r++<32?(e.consume(N),f):(r=0,h(N))}function m(N){return N===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(N),e.exit("autolinkMarker"),e.exit("autolink"),t):N===null||N===32||N===60||Oc(N)?a(N):(e.consume(N),m)}function h(N){return N===64?(e.consume(N),b):X5(N)?(e.consume(N),h):a(N)}function b(N){return Rn(N)?g(N):a(N)}function g(N){return N===46?(e.consume(N),r=0,b):N===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(N),e.exit("autolinkMarker"),e.exit("autolink"),t):y(N)}function y(N){if((N===45||Rn(N))&&r++<63){const v=N===45?y:g;return e.consume(N),v}return a(N)}}const Do={partial:!0,tokenize:lk};function lk(e,t,a){return r;function r(u){return it(u)?ft(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||Fe(u)?t(u):a(u)}}const cN={continuation:{tokenize:uk},exit:ck,name:"blockQuote",tokenize:ok};function ok(e,t,a){const r=this;return o;function o(c){if(c===62){const f=r.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return a(c)}function u(c){return it(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function uk(e,t,a){const r=this;return o;function o(c){return it(c)?ft(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(cN,t,a)(c)}}function ck(e){e.exit("blockQuote")}const dN={name:"characterEscape",tokenize:dk};function dk(e,t,a){return r;function r(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return W5(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(u)}}const fN={name:"characterReference",tokenize:fk};function fk(e,t,a){const r=this;let o=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),u=31,c=Rn,b(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=Q5,b):(e.enter("characterReferenceValue"),u=7,c=fh,b(g))}function b(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return c===Rn&&!sp(r.sliceSerialize(y))?a(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&o++<u?(e.consume(g),b):a(g)}}const l1={partial:!0,tokenize:hk},o1={concrete:!0,name:"codeFenced",tokenize:mk};function mk(e,t,a){const r=this,o={partial:!0,tokenize:R};let u=0,c=0,f;return m;function m(H){return h(H)}function h(H){const q=r.events[r.events.length-1];return u=q&&q[1].type==="linePrefix"?q[2].sliceSerialize(q[1],!0).length:0,f=H,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(H)}function b(H){return H===f?(c++,e.consume(H),b):c<3?a(H):(e.exit("codeFencedFenceSequence"),it(H)?ft(e,g,"whitespace")(H):g(H))}function g(H){return H===null||Fe(H)?(e.exit("codeFencedFence"),r.interrupt?t(H):e.check(l1,S,B)(H)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(H))}function y(H){return H===null||Fe(H)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(H)):it(H)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ft(e,N,"whitespace")(H)):H===96&&H===f?a(H):(e.consume(H),y)}function N(H){return H===null||Fe(H)?g(H):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(H))}function v(H){return H===null||Fe(H)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(H)):H===96&&H===f?a(H):(e.consume(H),v)}function S(H){return e.attempt(o,B,C)(H)}function C(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),A}function A(H){return u>0&&it(H)?ft(e,O,"linePrefix",u+1)(H):O(H)}function O(H){return H===null||Fe(H)?e.check(l1,S,B)(H):(e.enter("codeFlowValue"),k(H))}function k(H){return H===null||Fe(H)?(e.exit("codeFlowValue"),O(H)):(e.consume(H),k)}function B(H){return e.exit("codeFenced"),t(H)}function R(H,q,Z){let K=0;return M;function M(j){return H.enter("lineEnding"),H.consume(j),H.exit("lineEnding"),ne}function ne(j){return H.enter("codeFencedFence"),it(j)?ft(H,le,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):le(j)}function le(j){return j===f?(H.enter("codeFencedFenceSequence"),te(j)):Z(j)}function te(j){return j===f?(K++,H.consume(j),te):K>=c?(H.exit("codeFencedFenceSequence"),it(j)?ft(H,Y,"whitespace")(j):Y(j)):Z(j)}function Y(j){return j===null||Fe(j)?(H.exit("codeFencedFence"),q(j)):Z(j)}}}function hk(e,t,a){const r=this;return o;function o(c){return c===null?a(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return r.parser.lazy[r.now().line]?a(c):t(c)}}const Cm={name:"codeIndented",tokenize:gk},pk={partial:!0,tokenize:bk};function gk(e,t,a){const r=this;return o;function o(h){return e.enter("codeIndented"),ft(e,u,"linePrefix",5)(h)}function u(h){const b=r.events[r.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(h):a(h)}function c(h){return h===null?m(h):Fe(h)?e.attempt(pk,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Fe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function bk(e,t,a){const r=this;return o;function o(c){return r.parser.lazy[r.now().line]?a(c):Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):ft(e,u,"linePrefix",5)(c)}function u(c){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Fe(c)?o(c):a(c)}}const xk={name:"codeText",previous:yk,resolve:Ek,tokenize:Nk};function Ek(e){let t=e.length-4,a=3,r,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=a;++r<t;)if(e[r][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[t][1].type="codeTextPadding",a+=2,t-=2;break}}for(r=a-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function yk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Nk(e,t,a){let r=0,o,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),r++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?a(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),o=0,b(g)):Fe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Fe(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function b(g){return g===96?(e.consume(g),o++,b):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",h(g))}}class Tk{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,a){const r=a??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,a,r){const o=a||0;this.setCursor(Math.trunc(t));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&to(this.left,r),u.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),to(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),to(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 a=this.left.splice(t,Number.POSITIVE_INFINITY);to(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);to(this.left,a.reverse())}}}function to(e,t){let a=0;if(t.length<1e4)e.push(...t);else for(;a<t.length;)e.push(...t.slice(a,a+1e4)),a+=1e4}function mN(e){const t={};let a=-1,r,o,u,c,f,m,h;const b=new Tk(e);for(;++a<b.length;){for(;a in t;)a=t[a];if(r=b.get(a),a&&r[1].type==="chunkFlow"&&b.get(a-1)[1].type==="listItemPrefix"&&(m=r[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,_k(b,a)),a=t[a],h=!0);else if(r[1]._container){for(u=a,o=void 0;u--;)if(c=b.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(o&&(b.get(o)[1].type="lineEndingBlank"),c[1].type="lineEnding",o=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;o&&(r[1].end={...b.get(o)[1].start},f=b.slice(o,a),f.unshift(r),b.splice(o,a-o+1,f))}}return xa(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!h}function _k(e,t){const a=e.get(t)[1],r=e.get(t)[2];let o=t-1;const u=[];let c=a._tokenizer;c||(c=r.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let b,g,y=-1,N=a,v=0,S=0;const C=[S];for(;N;){for(;e.get(++o)[1]!==N;);u.push(o),N._tokenizer||(b=r.sliceStream(N),N.next||b.push(null),g&&c.defineSkip(N.start),N._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),N._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=N,N=N.next}for(N=a;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(S=y+1,C.push(S),N._tokenizer=void 0,N.previous=void 0,N=N.next);for(c.events=[],N?(N._tokenizer=void 0,N.previous=void 0):C.pop(),y=C.length;y--;){const A=f.slice(C[y],C[y+1]),O=u.pop();m.push([O,O+A.length-1]),e.splice(O,2,A)}for(m.reverse(),y=-1;++y<m.length;)h[v+m[y][0]]=v+m[y][1],v+=m[y][1]-m[y][0]-1;return h}const vk={resolve:Ak,tokenize:Ck},Sk={partial:!0,tokenize:wk};function Ak(e){return mN(e),e}function Ck(e,t){let a;return r;function r(f){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):Fe(f)?e.check(Sk,c,u)(f):(e.consume(f),o)}function u(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function wk(e,t,a){const r=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ft(e,u,"linePrefix")}function u(c){if(c===null||Fe(c))return a(c);const f=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(r.parser.constructs.flow,a,t)(c)}}function hN(e,t,a,r,o,u,c,f,m){const h=m||Number.POSITIVE_INFINITY;let b=0;return g;function g(A){return A===60?(e.enter(r),e.enter(o),e.enter(u),e.consume(A),e.exit(u),y):A===null||A===32||A===41||Oc(A)?a(A):(e.enter(r),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),S(A))}function y(A){return A===62?(e.enter(u),e.consume(A),e.exit(u),e.exit(o),e.exit(r),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),N(A))}function N(A){return A===62?(e.exit("chunkString"),e.exit(f),y(A)):A===null||A===60||Fe(A)?a(A):(e.consume(A),A===92?v:N)}function v(A){return A===60||A===62||A===92?(e.consume(A),N):N(A)}function S(A){return!b&&(A===null||A===41||Ot(A))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(r),t(A)):b<h&&A===40?(e.consume(A),b++,S):A===41?(e.consume(A),b--,S):A===null||A===32||A===40||Oc(A)?a(A):(e.consume(A),A===92?C:S)}function C(A){return A===40||A===41||A===92?(e.consume(A),S):S(A)}}function pN(e,t,a,r,o,u){const c=this;let f=0,m;return h;function h(N){return e.enter(r),e.enter(o),e.consume(N),e.exit(o),e.enter(u),b}function b(N){return f>999||N===null||N===91||N===93&&!m||N===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?a(N):N===93?(e.exit(u),e.enter(o),e.consume(N),e.exit(o),e.exit(r),t):Fe(N)?(e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),g(N))}function g(N){return N===null||N===91||N===93||Fe(N)||f++>999?(e.exit("chunkString"),b(N)):(e.consume(N),m||(m=!it(N)),N===92?y:g)}function y(N){return N===91||N===92||N===93?(e.consume(N),f++,g):g(N)}}function gN(e,t,a,r,o,u){let c;return f;function f(y){return y===34||y===39||y===40?(e.enter(r),e.enter(o),e.consume(y),e.exit(o),c=y===40?41:y,m):a(y)}function m(y){return y===c?(e.enter(o),e.consume(y),e.exit(o),e.exit(r),t):(e.enter(u),h(y))}function h(y){return y===c?(e.exit(u),m(c)):y===null?a(y):Fe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ft(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(y))}function b(y){return y===c||y===null||Fe(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?g:b)}function g(y){return y===c||y===92?(e.consume(y),b):b(y)}}function uo(e,t){let a;return r;function r(o){return Fe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,r):it(o)?ft(e,r,a?"linePrefix":"lineSuffix")(o):t(o)}}const kk={name:"definition",tokenize:Ok},Rk={partial:!0,tokenize:Ik};function Ok(e,t,a){const r=this;let o;return u;function u(N){return e.enter("definition"),c(N)}function c(N){return pN.call(r,e,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(N)}function f(N){return o=Ha(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),m):a(N)}function m(N){return Ot(N)?uo(e,h)(N):h(N)}function h(N){return hN(e,b,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(N)}function b(N){return e.attempt(Rk,g,g)(N)}function g(N){return it(N)?ft(e,y,"whitespace")(N):y(N)}function y(N){return N===null||Fe(N)?(e.exit("definition"),r.parser.defined.push(o),t(N)):a(N)}}function Ik(e,t,a){return r;function r(f){return Ot(f)?uo(e,o)(f):a(f)}function o(f){return gN(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return it(f)?ft(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Fe(f)?t(f):a(f)}}const Mk={name:"hardBreakEscape",tokenize:Dk};function Dk(e,t,a){return r;function r(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return Fe(u)?(e.exit("hardBreakEscape"),t(u)):a(u)}}const Lk={name:"headingAtx",resolve:jk,tokenize:Bk};function jk(e,t){let a=e.length-2,r=3,o,u;return e[r][1].type==="whitespace"&&(r+=2),a-2>r&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(r===a-1||a-4>r&&e[a-2][1].type==="whitespace")&&(a-=r+1===a?2:4),a>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[a][1].end},u={type:"chunkText",start:e[r][1].start,end:e[a][1].end,contentType:"text"},xa(e,r,a-r+1,[["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t]])),e}function Bk(e,t,a){let r=0;return o;function o(b){return e.enter("atxHeading"),u(b)}function u(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&r++<6?(e.consume(b),c):b===null||Ot(b)?(e.exit("atxHeadingSequence"),f(b)):a(b)}function f(b){return b===35?(e.enter("atxHeadingSequence"),m(b)):b===null||Fe(b)?(e.exit("atxHeading"),t(b)):it(b)?ft(e,f,"whitespace")(b):(e.enter("atxHeadingText"),h(b))}function m(b){return b===35?(e.consume(b),m):(e.exit("atxHeadingSequence"),f(b))}function h(b){return b===null||b===35||Ot(b)?(e.exit("atxHeadingText"),f(b)):(e.consume(b),h)}}const Pk=["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"],u1=["pre","script","style","textarea"],Uk={concrete:!0,name:"htmlFlow",resolveTo:zk,tokenize:$k},Hk={partial:!0,tokenize:Yk},Fk={partial:!0,tokenize:qk};function zk(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 $k(e,t,a){const r=this;let o,u,c,f,m;return h;function h(L){return b(L)}function b(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),g}function g(L){return L===33?(e.consume(L),y):L===47?(e.consume(L),u=!0,S):L===63?(e.consume(L),o=3,r.interrupt?t:I):Fn(L)?(e.consume(L),c=String.fromCharCode(L),C):a(L)}function y(L){return L===45?(e.consume(L),o=2,N):L===91?(e.consume(L),o=5,f=0,v):Fn(L)?(e.consume(L),o=4,r.interrupt?t:I):a(L)}function N(L){return L===45?(e.consume(L),r.interrupt?t:I):a(L)}function v(L){const Ne="CDATA[";return L===Ne.charCodeAt(f++)?(e.consume(L),f===Ne.length?r.interrupt?t:le:v):a(L)}function S(L){return Fn(L)?(e.consume(L),c=String.fromCharCode(L),C):a(L)}function C(L){if(L===null||L===47||L===62||Ot(L)){const Ne=L===47,Te=c.toLowerCase();return!Ne&&!u&&u1.includes(Te)?(o=1,r.interrupt?t(L):le(L)):Pk.includes(c.toLowerCase())?(o=6,Ne?(e.consume(L),A):r.interrupt?t(L):le(L)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(L):u?O(L):k(L))}return L===45||Rn(L)?(e.consume(L),c+=String.fromCharCode(L),C):a(L)}function A(L){return L===62?(e.consume(L),r.interrupt?t:le):a(L)}function O(L){return it(L)?(e.consume(L),O):M(L)}function k(L){return L===47?(e.consume(L),M):L===58||L===95||Fn(L)?(e.consume(L),B):it(L)?(e.consume(L),k):M(L)}function B(L){return L===45||L===46||L===58||L===95||Rn(L)?(e.consume(L),B):R(L)}function R(L){return L===61?(e.consume(L),H):it(L)?(e.consume(L),R):k(L)}function H(L){return L===null||L===60||L===61||L===62||L===96?a(L):L===34||L===39?(e.consume(L),m=L,q):it(L)?(e.consume(L),H):Z(L)}function q(L){return L===m?(e.consume(L),m=null,K):L===null||Fe(L)?a(L):(e.consume(L),q)}function Z(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Ot(L)?R(L):(e.consume(L),Z)}function K(L){return L===47||L===62||it(L)?k(L):a(L)}function M(L){return L===62?(e.consume(L),ne):a(L)}function ne(L){return L===null||Fe(L)?le(L):it(L)?(e.consume(L),ne):a(L)}function le(L){return L===45&&o===2?(e.consume(L),D):L===60&&o===1?(e.consume(L),F):L===62&&o===4?(e.consume(L),$):L===63&&o===3?(e.consume(L),I):L===93&&o===5?(e.consume(L),J):Fe(L)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Hk,oe,te)(L)):L===null||Fe(L)?(e.exit("htmlFlowData"),te(L)):(e.consume(L),le)}function te(L){return e.check(Fk,Y,oe)(L)}function Y(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),j}function j(L){return L===null||Fe(L)?te(L):(e.enter("htmlFlowData"),le(L))}function D(L){return L===45?(e.consume(L),I):le(L)}function F(L){return L===47?(e.consume(L),c="",U):le(L)}function U(L){if(L===62){const Ne=c.toLowerCase();return u1.includes(Ne)?(e.consume(L),$):le(L)}return Fn(L)&&c.length<8?(e.consume(L),c+=String.fromCharCode(L),U):le(L)}function J(L){return L===93?(e.consume(L),I):le(L)}function I(L){return L===62?(e.consume(L),$):L===45&&o===2?(e.consume(L),I):le(L)}function $(L){return L===null||Fe(L)?(e.exit("htmlFlowData"),oe(L)):(e.consume(L),$)}function oe(L){return e.exit("htmlFlow"),t(L)}}function qk(e,t,a){const r=this;return o;function o(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):a(c)}function u(c){return r.parser.lazy[r.now().line]?a(c):t(c)}}function Yk(e,t,a){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Do,t,a)}}const Gk={name:"htmlText",tokenize:Kk};function Kk(e,t,a){const r=this;let o,u,c;return f;function f(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),m}function m(I){return I===33?(e.consume(I),h):I===47?(e.consume(I),R):I===63?(e.consume(I),k):Fn(I)?(e.consume(I),Z):a(I)}function h(I){return I===45?(e.consume(I),b):I===91?(e.consume(I),u=0,v):Fn(I)?(e.consume(I),O):a(I)}function b(I){return I===45?(e.consume(I),N):a(I)}function g(I){return I===null?a(I):I===45?(e.consume(I),y):Fe(I)?(c=g,F(I)):(e.consume(I),g)}function y(I){return I===45?(e.consume(I),N):g(I)}function N(I){return I===62?D(I):I===45?y(I):g(I)}function v(I){const $="CDATA[";return I===$.charCodeAt(u++)?(e.consume(I),u===$.length?S:v):a(I)}function S(I){return I===null?a(I):I===93?(e.consume(I),C):Fe(I)?(c=S,F(I)):(e.consume(I),S)}function C(I){return I===93?(e.consume(I),A):S(I)}function A(I){return I===62?D(I):I===93?(e.consume(I),A):S(I)}function O(I){return I===null||I===62?D(I):Fe(I)?(c=O,F(I)):(e.consume(I),O)}function k(I){return I===null?a(I):I===63?(e.consume(I),B):Fe(I)?(c=k,F(I)):(e.consume(I),k)}function B(I){return I===62?D(I):k(I)}function R(I){return Fn(I)?(e.consume(I),H):a(I)}function H(I){return I===45||Rn(I)?(e.consume(I),H):q(I)}function q(I){return Fe(I)?(c=q,F(I)):it(I)?(e.consume(I),q):D(I)}function Z(I){return I===45||Rn(I)?(e.consume(I),Z):I===47||I===62||Ot(I)?K(I):a(I)}function K(I){return I===47?(e.consume(I),D):I===58||I===95||Fn(I)?(e.consume(I),M):Fe(I)?(c=K,F(I)):it(I)?(e.consume(I),K):D(I)}function M(I){return I===45||I===46||I===58||I===95||Rn(I)?(e.consume(I),M):ne(I)}function ne(I){return I===61?(e.consume(I),le):Fe(I)?(c=ne,F(I)):it(I)?(e.consume(I),ne):K(I)}function le(I){return I===null||I===60||I===61||I===62||I===96?a(I):I===34||I===39?(e.consume(I),o=I,te):Fe(I)?(c=le,F(I)):it(I)?(e.consume(I),le):(e.consume(I),Y)}function te(I){return I===o?(e.consume(I),o=void 0,j):I===null?a(I):Fe(I)?(c=te,F(I)):(e.consume(I),te)}function Y(I){return I===null||I===34||I===39||I===60||I===61||I===96?a(I):I===47||I===62||Ot(I)?K(I):(e.consume(I),Y)}function j(I){return I===47||I===62||Ot(I)?K(I):a(I)}function D(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):a(I)}function F(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),U}function U(I){return it(I)?ft(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):J(I)}function J(I){return e.enter("htmlTextData"),c(I)}}const rp={name:"labelEnd",resolveAll:Wk,resolveTo:Zk,tokenize:Jk},Vk={tokenize:eR},Xk={tokenize:tR},Qk={tokenize:nR};function Wk(e){let t=-1;const a=[];for(;++t<e.length;){const r=e[t][1];if(a.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==a.length&&xa(e,0,e.length,a),e}function Zk(e,t){let a=e.length,r=0,o,u,c,f;for(;a--;)if(o=e[a][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(c){if(e[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=a,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(c=a);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},b={type:"labelText",start:{...e[u+r+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=ka(f,e.slice(u+1,u+r+3)),f=ka(f,[["enter",b,t]]),f=ka(f,td(t.parser.constructs.insideSpan.null,e.slice(u+r+4,c-3),t)),f=ka(f,[["exit",b,t],e[c-2],e[c-1],["exit",h,t]]),f=ka(f,e.slice(c+1)),f=ka(f,[["exit",m,t]]),xa(e,u,e.length,f),e}function Jk(e,t,a){const r=this;let o=r.events.length,u,c;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){u=r.events[o][1];break}return f;function f(y){return u?u._inactive?g(y):(c=r.parser.defined.includes(Ha(r.sliceSerialize({start:u.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),m):a(y)}function m(y){return y===40?e.attempt(Vk,b,c?b:g)(y):y===91?e.attempt(Xk,b,c?h:g)(y):c?b(y):g(y)}function h(y){return e.attempt(Qk,b,g)(y)}function b(y){return t(y)}function g(y){return u._balanced=!0,a(y)}}function eR(e,t,a){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return Ot(g)?uo(e,u)(g):u(g)}function u(g){return g===41?b(g):hN(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Ot(g)?uo(e,m)(g):b(g)}function f(g){return a(g)}function m(g){return g===34||g===39||g===40?gN(e,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):b(g)}function h(g){return Ot(g)?uo(e,b)(g):b(g)}function b(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):a(g)}}function tR(e,t,a){const r=this;return o;function o(f){return pN.call(r,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return r.parser.defined.includes(Ha(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(f):a(f)}function c(f){return a(f)}}function nR(e,t,a){return r;function r(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):a(u)}}const aR={name:"labelStartImage",resolveAll:rp.resolveAll,tokenize:sR};function sR(e,t,a){const r=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):a(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(f):t(f)}}const rR={name:"labelStartLink",resolveAll:rp.resolveAll,tokenize:iR};function iR(e,t,a){const r=this;return o;function o(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(c):t(c)}}const wm={name:"lineEnding",tokenize:lR};function lR(e,t){return a;function a(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ft(e,t,"linePrefix")}}const Ec={name:"thematicBreak",tokenize:oR};function oR(e,t,a){let r=0,o;return u;function u(h){return e.enter("thematicBreak"),c(h)}function c(h){return o=h,f(h)}function f(h){return h===o?(e.enter("thematicBreakSequence"),m(h)):r>=3&&(h===null||Fe(h))?(e.exit("thematicBreak"),t(h)):a(h)}function m(h){return h===o?(e.consume(h),r++,m):(e.exit("thematicBreakSequence"),it(h)?ft(e,f,"whitespace")(h):f(h))}}const aa={continuation:{tokenize:fR},exit:hR,name:"list",tokenize:dR},uR={partial:!0,tokenize:pR},cR={partial:!0,tokenize:mR};function dR(e,t,a){const r=this,o=r.events[r.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,c=0;return f;function f(N){const v=r.containerState.type||(N===42||N===43||N===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||N===r.containerState.marker:fh(N)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),N===42||N===45?e.check(Ec,a,h)(N):h(N);if(!r.interrupt||N===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(N)}return a(N)}function m(N){return fh(N)&&++c<10?(e.consume(N),m):(!r.interrupt||c<2)&&(r.containerState.marker?N===r.containerState.marker:N===41||N===46)?(e.exit("listItemValue"),h(N)):a(N)}function h(N){return e.enter("listItemMarker"),e.consume(N),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||N,e.check(Do,r.interrupt?a:b,e.attempt(uR,y,g))}function b(N){return r.containerState.initialBlankLine=!0,u++,y(N)}function g(N){return it(N)?(e.enter("listItemPrefixWhitespace"),e.consume(N),e.exit("listItemPrefixWhitespace"),y):a(N)}function y(N){return r.containerState.size=u+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(N)}}function fR(e,t,a){const r=this;return r.containerState._closeFlow=void 0,e.check(Do,o,u);function o(f){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ft(e,t,"listItemIndent",r.containerState.size+1)(f)}function u(f){return r.containerState.furtherBlankLines||!it(f)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(f)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(cR,t,c)(f))}function c(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,ft(e,e.attempt(aa,t,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function mR(e,t,a){const r=this;return ft(e,o,"listItemIndent",r.containerState.size+1);function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(u):a(u)}}function hR(e){e.exit(this.containerState.type)}function pR(e,t,a){const r=this;return ft(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const c=r.events[r.events.length-1];return!it(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):a(u)}}const c1={name:"setextUnderline",resolveTo:gR,tokenize:bR};function gR(e,t){let a=e.length,r,o,u;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){r=a;break}e[a][1].type==="paragraph"&&(o=a)}else e[a][1].type==="content"&&e.splice(a,1),!u&&e[a][1].type==="definition"&&(u=a);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",c,t]),e.splice(u+1,0,["exit",e[r][1],t]),e[r][1].end={...e[u][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function bR(e,t,a){const r=this;let o;return u;function u(h){let b=r.events.length,g;for(;b--;)if(r.events[b][1].type!=="lineEnding"&&r.events[b][1].type!=="linePrefix"&&r.events[b][1].type!=="content"){g=r.events[b][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),o=h,c(h)):a(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),it(h)?ft(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):a(h)}}const xR={tokenize:ER};function ER(e){const t=this,a=e.attempt(Do,r,e.attempt(this.parser.constructs.flowInitial,o,ft(e,e.attempt(this.parser.constructs.flow,o,e.attempt(vk,o)),"linePrefix")));return a;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,a}}const yR={resolveAll:xN()},NR=bN("string"),TR=bN("text");function bN(e){return{resolveAll:xN(e==="text"?_R:void 0),tokenize:t};function t(a){const r=this,o=this.parser.constructs[e],u=a.attempt(o,c,f);return c;function c(b){return h(b)?u(b):f(b)}function f(b){if(b===null){a.consume(b);return}return a.enter("data"),a.consume(b),m}function m(b){return h(b)?(a.exit("data"),u(b)):(a.consume(b),m)}function h(b){if(b===null)return!0;const g=o[b];let y=-1;if(g)for(;++y<g.length;){const N=g[y];if(!N.previous||N.previous.call(r,r.previous))return!0}return!1}}}function xN(e){return t;function t(a,r){let o=-1,u;for(;++o<=a.length;)u===void 0?a[o]&&a[o][1].type==="data"&&(u=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==u+2&&(a[u][1].end=a[o-1][1].end,a.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(a,r):a}}function _R(e,t){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){const r=e[a-1][1],o=t.sliceStream(r);let u=o.length,c=-1,f=0,m;for(;u--;){const h=o[u];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)m=!0,f++;else if(h!==-1){u++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(f=0),f){const h={type:a===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:r.start._bufferIndex+c,_index:r.start._index+u,line:r.end.line,column:r.end.column-f,offset:r.end.offset-f},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(e.splice(a,0,["enter",h,t],["exit",h,t]),a+=2)}a++}return e}const vR={42:aa,43:aa,45:aa,48:aa,49:aa,50:aa,51:aa,52:aa,53:aa,54:aa,55:aa,56:aa,57:aa,62:cN},SR={91:kk},AR={[-2]:Cm,[-1]:Cm,32:Cm},CR={35:Lk,42:Ec,45:[c1,Ec],60:Uk,61:c1,95:Ec,96:o1,126:o1},wR={38:fN,92:dN},kR={[-5]:wm,[-4]:wm,[-3]:wm,33:aR,38:fN,42:mh,60:[rk,Gk],91:rR,92:[Mk,dN],93:rp,95:mh,96:xk},RR={null:[mh,yR]},OR={null:[42,95]},IR={null:[]},MR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:OR,contentInitial:SR,disable:IR,document:vR,flow:CR,flowInitial:AR,insideSpan:RR,string:wR,text:kR},Symbol.toStringTag,{value:"Module"}));function DR(e,t,a){let r={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},u=[];let c=[],f=[];const m={attempt:q(R),check:q(H),consume:O,enter:k,exit:B,interrupt:q(H,{interrupt:!0})},h={code:null,containerState:{},defineSkip:S,events:[],now:v,parser:e,previous:null,sliceSerialize:y,sliceStream:N,write:g};let b=t.tokenize.call(h,m);return t.resolveAll&&u.push(t),h;function g(ne){return c=ka(c,ne),C(),c[c.length-1]!==null?[]:(Z(t,0),h.events=td(u,h.events,h),h.events)}function y(ne,le){return jR(N(ne),le)}function N(ne){return LR(c,ne)}function v(){const{_bufferIndex:ne,_index:le,line:te,column:Y,offset:j}=r;return{_bufferIndex:ne,_index:le,line:te,column:Y,offset:j}}function S(ne){o[ne.line]=ne.column,M()}function C(){let ne;for(;r._index<c.length;){const le=c[r._index];if(typeof le=="string")for(ne=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ne&&r._bufferIndex<le.length;)A(le.charCodeAt(r._bufferIndex));else A(le)}}function A(ne){b=b(ne)}function O(ne){Fe(ne)?(r.line++,r.column=1,r.offset+=ne===-3?2:1,M()):ne!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=ne}function k(ne,le){const te=le||{};return te.type=ne,te.start=v(),h.events.push(["enter",te,h]),f.push(te),te}function B(ne){const le=f.pop();return le.end=v(),h.events.push(["exit",le,h]),le}function R(ne,le){Z(ne,le.from)}function H(ne,le){le.restore()}function q(ne,le){return te;function te(Y,j,D){let F,U,J,I;return Array.isArray(Y)?oe(Y):"tokenize"in Y?oe([Y]):$(Y);function $(X){return ve;function ve(Be){const Ue=Be!==null&&X[Be],xt=Be!==null&&X.null,un=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(xt)?xt:xt?[xt]:[]];return oe(un)(Be)}}function oe(X){return F=X,U=0,X.length===0?D:L(X[U])}function L(X){return ve;function ve(Be){return I=K(),J=X,X.partial||(h.currentConstruct=X),X.name&&h.parser.constructs.disable.null.includes(X.name)?Te():X.tokenize.call(le?Object.assign(Object.create(h),le):h,m,Ne,Te)(Be)}}function Ne(X){return ne(J,I),j}function Te(X){return I.restore(),++U<F.length?L(F[U]):D}}}function Z(ne,le){ne.resolveAll&&!u.includes(ne)&&u.push(ne),ne.resolve&&xa(h.events,le,h.events.length-le,ne.resolve(h.events.slice(le),h)),ne.resolveTo&&(h.events=ne.resolveTo(h.events,h))}function K(){const ne=v(),le=h.previous,te=h.currentConstruct,Y=h.events.length,j=Array.from(f);return{from:Y,restore:D};function D(){r=ne,h.previous=le,h.currentConstruct=te,h.events.length=Y,f=j,M()}}function M(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function LR(e,t){const a=t.start._index,r=t.start._bufferIndex,o=t.end._index,u=t.end._bufferIndex;let c;if(a===o)c=[e[a].slice(r,u)];else{if(c=e.slice(a,o),r>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(r):c.shift()}u>0&&c.push(e[o].slice(0,u))}return c}function jR(e,t){let a=-1;const r=[];let o;for(;++a<e.length;){const u=e[a];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
@@ -487,7 +487,7 @@ Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}
487
487
  `))+1))}const c="#".repeat(o),f=a.enter("headingAtx"),m=a.enter("phrasing");u.move(c+" ");let h=a.containerPhrasing(e,{before:"# ",after:`
488
488
  `,...u.current()});return/^[\t ]/.test(h)&&(h=So(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,a.options.closeAtx&&(h+=" "+c),m(),f(),h}jN.peek=fI;function jN(e){return e.value||""}function fI(){return"<"}BN.peek=mI;function BN(e,t,a,r){const o=dp(a),u=o==='"'?"Quote":"Apostrophe",c=a.enter("image");let f=a.enter("label");const m=a.createTracker(r);let h=m.move("![");return h+=m.move(a.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=a.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(a.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=a.enter("destinationRaw"),h+=m.move(a.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=a.enter(`title${u}`),h+=m.move(" "+o),h+=m.move(a.safe(e.title,{before:h,after:o,...m.current()})),h+=m.move(o),f()),h+=m.move(")"),c(),h}function mI(){return"!"}PN.peek=hI;function PN(e,t,a,r){const o=e.referenceType,u=a.enter("imageReference");let c=a.enter("label");const f=a.createTracker(r);let m=f.move("![");const h=a.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const b=a.stack;a.stack=[],c=a.enter("reference");const g=a.safe(a.associationId(e),{before:m,after:"]",...f.current()});return c(),a.stack=b,u(),o==="full"||!h||h!==g?m+=f.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function hI(){return"!"}UN.peek=pI;function UN(e,t,a){let r=e.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++u<a.unsafe.length;){const c=a.unsafe[u],f=a.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(r);){let h=m.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(m.index+1)}}return o+r+o}function pI(){return"`"}function HN(e,t){const a=ap(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(a===e.url||"mailto:"+a===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}FN.peek=gI;function FN(e,t,a,r){const o=dp(a),u=o==='"'?"Quote":"Apostrophe",c=a.createTracker(r);let f,m;if(HN(e,a)){const b=a.stack;a.stack=[],f=a.enter("autolink");let g=c.move("<");return g+=c.move(a.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),a.stack=b,g}f=a.enter("link"),m=a.enter("label");let h=c.move("[");return h+=c.move(a.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=a.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(a.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(m=a.enter("destinationRaw"),h+=c.move(a.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=a.enter(`title${u}`),h+=c.move(" "+o),h+=c.move(a.safe(e.title,{before:h,after:o,...c.current()})),h+=c.move(o),m()),h+=c.move(")"),f(),h}function gI(e,t,a){return HN(e,a)?"<":"["}zN.peek=bI;function zN(e,t,a,r){const o=e.referenceType,u=a.enter("linkReference");let c=a.enter("label");const f=a.createTracker(r);let m=f.move("[");const h=a.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const b=a.stack;a.stack=[],c=a.enter("reference");const g=a.safe(a.associationId(e),{before:m,after:"]",...f.current()});return c(),a.stack=b,u(),o==="full"||!h||h!==g?m+=f.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function bI(){return"["}function fp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function xI(e){const t=fp(e),a=e.options.bulletOther;if(!a)return t==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+a+"`) to be different");return a}function EI(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function $N(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function yI(e,t,a,r){const o=a.enter("list"),u=a.bulletCurrent;let c=e.ordered?EI(a):fp(a);const f=e.ordered?c==="."?")":".":xI(a);let m=t&&a.bulletLastUsed?c===a.bulletLastUsed:!1;if(!e.ordered){const b=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&b&&(!b.children||!b.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(m=!0),$N(a)===c&&b){let g=-1;for(;++g<e.children.length;){const y=e.children[g];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),a.bulletCurrent=c;const h=a.containerFlow(e,r);return a.bulletLastUsed=c,a.bulletCurrent=u,o(),h}function NI(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function TI(e,t,a,r){const o=NI(a);let u=a.bulletCurrent||fp(a);t&&t.type==="list"&&t.ordered&&(u=(typeof t.start=="number"&&t.start>-1?t.start:1)+(a.options.incrementListMarker===!1?0:t.children.indexOf(e))+u);let c=u.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=a.createTracker(r);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=a.enter("listItem"),h=a.indentLines(a.containerFlow(e,f.current()),b);return m(),h;function b(g,y,N){return y?(N?"":" ".repeat(c))+g:(N?u:u+" ".repeat(c-u.length))+g}}function _I(e,t,a,r){const o=a.enter("paragraph"),u=a.enter("phrasing"),c=a.containerPhrasing(e,r);return u(),o(),c}const vI=Lo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function SI(e,t,a,r){return(e.children.some(function(c){return vI(c)})?a.containerPhrasing:a.containerFlow).call(a,e,r)}function AI(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}qN.peek=CI;function qN(e,t,a,r){const o=AI(a),u=a.enter("strong"),c=a.createTracker(r),f=c.move(o+o);let m=c.move(a.containerPhrasing(e,{after:o,before:f,...c.current()}));const h=m.charCodeAt(0),b=Mc(r.before.charCodeAt(r.before.length-1),h,o);b.inside&&(m=So(h)+m.slice(1));const g=m.charCodeAt(m.length-1),y=Mc(r.after.charCodeAt(0),g,o);y.inside&&(m=m.slice(0,-1)+So(g));const N=c.move(o+o);return u(),a.attentionEncodeSurroundingInfo={after:y.outside,before:b.outside},f+m+N}function CI(e,t,a){return a.options.strong||"*"}function wI(e,t,a,r){return a.safe(e.value,r)}function kI(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function RI(e,t,a){const r=($N(a)+(a.options.ruleSpaces?" ":"")).repeat(kI(a));return a.options.ruleSpaces?r.slice(0,-1):r}const YN={blockquote:JO,break:I1,code:rI,definition:lI,emphasis:LN,hardBreak:I1,heading:dI,html:jN,image:BN,imageReference:PN,inlineCode:UN,link:FN,linkReference:zN,list:yI,listItem:TI,paragraph:_I,root:SI,strong:qN,text:wI,thematicBreak:RI};function OI(){return{enter:{table:II,tableData:M1,tableHeader:M1,tableRow:DI},exit:{codeText:LI,table:MI,tableData:Hm,tableHeader:Hm,tableRow:Hm}}}function II(e){const t=e._align;this.enter({type:"table",align:t.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function MI(e){this.exit(e),this.data.inTable=void 0}function DI(e){this.enter({type:"tableRow",children:[]},e)}function Hm(e){this.exit(e)}function M1(e){this.enter({type:"tableCell",children:[]},e)}function LI(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,jI));const a=this.stack[this.stack.length-1];a.type,a.value=t,this.exit(e)}function jI(e,t){return t==="|"?t:e}function BI(e){const t=e||{},a=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
489
489
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:c,tableCell:m,tableRow:f}};function c(N,v,S,C){return h(b(N,S,C),N.align)}function f(N,v,S,C){const A=g(N,S,C),O=h([A]);return O.slice(0,O.indexOf(`
490
- `))}function m(N,v,S,C){const A=S.enter("tableCell"),O=S.enter("phrasing"),k=S.containerPhrasing(N,{...C,before:u,after:u});return O(),A(),k}function h(N,v){return WO(N,{align:v,alignDelimiters:r,padding:a,stringLength:o})}function b(N,v,S){const C=N.children;let A=-1;const O=[],k=v.enter("table");for(;++A<C.length;)O[A]=g(C[A],v,S);return k(),O}function g(N,v,S){const C=N.children;let A=-1;const O=[],k=v.enter("tableRow");for(;++A<C.length;)O[A]=m(C[A],N,v,S);return k(),O}function y(N,v,S){let C=YN.inlineCode(N,v,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function PI(){return{exit:{taskListCheckValueChecked:D1,taskListCheckValueUnchecked:D1,paragraph:HI}}}function UI(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:FI}}}function D1(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function HI(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const r=a.children[0];if(r&&r.type==="text"){const o=t.children;let u=-1,c;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){c=f;break}}c===a&&(r.value=r.value.slice(1),r.value.length===0?a.children.shift():a.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,a.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function FI(e,t,a,r){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=a.createTracker(r);u&&f.move(c);let m=YN.listItem(e,t,a,{...r,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(b){return b+c}}function zI(){return[yO(),FO(),YO(),OI(),PI()]}function $I(e){return{extensions:[NO(),zO(e),GO(),BI(e),UI()]}}const qI={tokenize:QI,partial:!0},GN={tokenize:WI,partial:!0},KN={tokenize:ZI,partial:!0},VN={tokenize:JI,partial:!0},YI={tokenize:e6,partial:!0},XN={name:"wwwAutolink",tokenize:VI,previous:WN},QN={name:"protocolAutolink",tokenize:XI,previous:ZN},ws={name:"emailAutolink",tokenize:KI,previous:JN},ns={};function GI(){return{text:ns}}let Mr=48;for(;Mr<123;)ns[Mr]=ws,Mr++,Mr===58?Mr=65:Mr===91&&(Mr=97);ns[43]=ws;ns[45]=ws;ns[46]=ws;ns[95]=ws;ns[72]=[ws,QN];ns[104]=[ws,QN];ns[87]=[ws,XN];ns[119]=[ws,XN];function KI(e,t,a){const r=this;let o,u;return c;function c(g){return!xh(g)||!JN.call(r,r.previous)||mp(r.events)?a(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return xh(g)?(e.consume(g),f):g===64?(e.consume(g),m):a(g)}function m(g){return g===46?e.check(YI,b,h)(g):g===45||g===95||Rn(g)?(u=!0,e.consume(g),m):b(g)}function h(g){return e.consume(g),o=!0,m}function b(g){return u&&o&&Fn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):a(g)}}function VI(e,t,a){const r=this;return o;function o(c){return c!==87&&c!==119||!WN.call(r,r.previous)||mp(r.events)?a(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(qI,e.attempt(GN,e.attempt(KN,u),a),a)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function XI(e,t,a){const r=this;let o="",u=!1;return c;function c(g){return(g===72||g===104)&&ZN.call(r,r.previous)&&!mp(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),f):a(g)}function f(g){if(Fn(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const y=o.toLowerCase();if(y==="http"||y==="https")return e.consume(g),m}return a(g)}function m(g){return g===47?(e.consume(g),u?h:(u=!0,m)):a(g)}function h(g){return g===null||Oc(g)||Ot(g)||qr(g)||ed(g)?a(g):e.attempt(GN,e.attempt(KN,b),a)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function QI(e,t,a){let r=0;return o;function o(c){return(c===87||c===119)&&r<3?(r++,e.consume(c),o):c===46&&r===3?(e.consume(c),u):a(c)}function u(c){return c===null?a(c):t(c)}}function WI(e,t,a){let r,o,u;return c;function c(h){return h===46||h===95?e.check(VN,m,f)(h):h===null||Ot(h)||qr(h)||h!==45&&ed(h)?m(h):(u=!0,e.consume(h),c)}function f(h){return h===95?r=!0:(o=r,r=void 0),e.consume(h),c}function m(h){return o||r||!u?a(h):t(h)}}function ZI(e,t){let a=0,r=0;return o;function o(c){return c===40?(a++,e.consume(c),o):c===41&&r<a?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(VN,t,u)(c):c===null||Ot(c)||qr(c)?t(c):(e.consume(c),o)}function u(c){return c===41&&r++,e.consume(c),o}}function JI(e,t,a){return r;function r(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),r):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||Ot(f)||qr(f)?t(f):a(f)}function o(f){return f===null||f===40||f===91||Ot(f)||qr(f)?t(f):r(f)}function u(f){return Fn(f)?c(f):a(f)}function c(f){return f===59?(e.consume(f),r):Fn(f)?(e.consume(f),c):a(f)}}function e6(e,t,a){return r;function r(u){return e.consume(u),o}function o(u){return Rn(u)?a(u):t(u)}}function WN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ot(e)}function ZN(e){return!Fn(e)}function JN(e){return!(e===47||xh(e))}function xh(e){return e===43||e===45||e===46||e===95||Rn(e)}function mp(e){let t=e.length,a=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){a=!0;break}if(r._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const t6={tokenize:u6,partial:!0};function n6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:i6,continuation:{tokenize:l6},exit:o6}},text:{91:{name:"gfmFootnoteCall",tokenize:r6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:a6,resolveTo:s6}}}}function a6(e,t,a){const r=this;let o=r.events.length;const u=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;o--;){const m=r.events[o][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return a(m);const h=Ha(r.sliceSerialize({start:c.end,end:r.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?a(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function s6(e,t){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...f),e}function r6(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?a(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(u>999||g===93&&!c||g===null||g===91||Ot(g))return a(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return o.includes(Ha(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(g)}return Ot(g)||(c=!0),u++,e.consume(g),g===92?b:h}function b(g){return g===91||g===92||g===93?(e.consume(g),u++,h):h(g)}}function i6(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",b):a(v)}function b(v){if(c>999||v===93&&!f||v===null||v===91||Ot(v))return a(v);if(v===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return u=Ha(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Ot(v)||(f=!0),c++,e.consume(v),v===92?g:b}function g(v){return v===91||v===92||v===93?(e.consume(v),c++,b):b(v)}function y(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),o.includes(u)||o.push(u),ft(e,N,"gfmFootnoteDefinitionWhitespace")):a(v)}function N(v){return t(v)}}function l6(e,t,a){return e.check(Do,t,e.attempt(t6,t,a))}function o6(e){e.exit("gfmFootnoteDefinition")}function u6(e,t,a){const r=this;return ft(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):a(u)}}function c6(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:u,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},y=[["enter",b,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],N=f.parser.constructs.insideSpan.null;N&&xa(y,y.length,0,td(N,c.slice(h+1,m),f)),xa(y,y.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",b,f]]),xa(c,h-1,m-h+3,y),m=h+y.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const h=this.previous,b=this.events;let g=0;return y;function y(v){return h===126&&b[b.length-1][1].type!=="characterEscape"?m(v):(c.enter("strikethroughSequenceTemporary"),N(v))}function N(v){const S=$i(h);if(v===126)return g>1?m(v):(c.consume(v),g++,N);if(g<2&&!a)return m(v);const C=c.exit("strikethroughSequenceTemporary"),A=$i(v);return C._open=!A||A===2&&!!S,C._close=!S||S===2&&!!A,f(v)}}}class d6{constructor(){this.map=[]}add(t,a,r){f6(this,t,a,r)}consume(t){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const u of o)t.push(u);o=r.pop()}this.map.length=0}}function f6(e,t,a,r){let o=0;if(!(a===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=a,e.map[o][2].push(...r);return}o+=1}e.map.push([t,a,r])}}function m6(e,t){let a=!1;const r=[];for(;t<e.length;){const o=e[t];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const u=r.length-1;r[u]=r[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);t+=1}return r}function h6(){return{flow:{null:{name:"table",tokenize:p6,resolveAll:g6}}}}function p6(e,t,a){const r=this;let o=0,u=0,c;return f;function f(M){let ne=r.events.length-1;for(;ne>-1;){const Y=r.events[ne][1].type;if(Y==="lineEnding"||Y==="linePrefix")ne--;else break}const le=ne>-1?r.events[ne][1].type:null,te=le==="tableHead"||le==="tableRow"?H:m;return te===H&&r.parser.lazy[r.now().line]?a(M):te(M)}function m(M){return e.enter("tableHead"),e.enter("tableRow"),h(M)}function h(M){return M===124||(c=!0,u+=1),b(M)}function b(M){return M===null?a(M):Fe(M)?u>1?(u=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),N):a(M):it(M)?ft(e,b,"whitespace")(M):(u+=1,c&&(c=!1,o+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(M)))}function g(M){return M===null||M===124||Ot(M)?(e.exit("data"),b(M)):(e.consume(M),M===92?y:g)}function y(M){return M===92||M===124?(e.consume(M),g):g(M)}function N(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(M):(e.enter("tableDelimiterRow"),c=!1,it(M)?ft(e,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):v(M))}function v(M){return M===45||M===58?C(M):M===124?(c=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),S):R(M)}function S(M){return it(M)?ft(e,C,"whitespace")(M):C(M)}function C(M){return M===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),A):M===45?(u+=1,A(M)):M===null||Fe(M)?B(M):R(M)}function A(M){return M===45?(e.enter("tableDelimiterFiller"),O(M)):R(M)}function O(M){return M===45?(e.consume(M),O):M===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(M))}function k(M){return it(M)?ft(e,B,"whitespace")(M):B(M)}function B(M){return M===124?v(M):M===null||Fe(M)?!c||o!==u?R(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(M)):R(M)}function R(M){return a(M)}function H(M){return e.enter("tableRow"),q(M)}function q(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),q):M===null||Fe(M)?(e.exit("tableRow"),t(M)):it(M)?ft(e,q,"whitespace")(M):(e.enter("data"),Z(M))}function Z(M){return M===null||M===124||Ot(M)?(e.exit("data"),q(M)):(e.consume(M),M===92?K:Z)}function K(M){return M===92||M===124?(e.consume(M),Z):Z(M)}}function g6(e,t){let a=-1,r=!0,o=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,b,g;const y=new d6;for(;++a<e.length;){const N=e[a],v=N[1];N[0]==="enter"?v.type==="tableHead"?(f=!1,m!==0&&(L1(y,t,m,h,b),b=void 0,m=0),h={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(a,0,[["enter",h,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,g=void 0,u=[0,0,0,0],c=[0,a+1,0,0],f&&(f=!1,b={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(a,0,[["enter",b,t]])),o=v.type==="tableDelimiterRow"?2:b?3:1):o&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=oc(y,t,u,o,void 0,g),u=[0,0,0,0]),c[2]=a)):v.type==="tableCellDivider"&&(r?r=!1:(u[1]!==0&&(c[0]=c[1],g=oc(y,t,u,o,void 0,g)),u=c,c=[u[1],a,0,0])):v.type==="tableHead"?(f=!0,m=a):v.type==="tableRow"||v.type==="tableDelimiterRow"?(m=a,u[1]!==0?(c[0]=c[1],g=oc(y,t,u,o,a,g)):c[1]!==0&&(g=oc(y,t,c,o,a,g)),o=0):o&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(c[3]=a)}for(m!==0&&L1(y,t,m,h,b),y.consume(t.events),a=-1;++a<t.events.length;){const N=t.events[a];N[0]==="enter"&&N[1].type==="table"&&(N[1]._align=m6(t.events,a))}return e}function oc(e,t,a,r,o,u){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";a[0]!==0&&(u.end=Object.assign({},ji(t.events,a[0])),e.add(a[0],0,[["exit",u,t]]));const m=ji(t.events,a[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(a[1],0,[["enter",u,t]]),a[2]!==0){const h=ji(t.events,a[2]),b=ji(t.events,a[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},b)};if(e.add(a[2],0,[["enter",g,t]]),r!==2){const y=t.events[a[2]],N=t.events[a[3]];if(y[1].end=Object.assign({},N[1].end),y[1].type="chunkText",y[1].contentType="text",a[3]>a[2]+1){const v=a[2]+1,S=a[3]-a[2]-1;e.add(v,S,[])}}e.add(a[3]+1,0,[["exit",g,t]])}return o!==void 0&&(u.end=Object.assign({},ji(t.events,o)),e.add(o,0,[["exit",u,t]]),u=void 0),u}function L1(e,t,a,r,o){const u=[],c=ji(t.events,a);o&&(o.end=Object.assign({},c),u.push(["exit",o,t])),r.end=Object.assign({},c),u.push(["exit",r,t]),e.add(a+1,0,u)}function ji(e,t){const a=e[t],r=a[0]==="enter"?"start":"end";return a[1][r]}const b6={name:"tasklistCheck",tokenize:E6};function x6(){return{text:{91:b6}}}function E6(e,t,a){const r=this;return o;function o(m){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Ot(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):a(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):a(m)}function f(m){return Fe(m)?t(m):it(m)?e.check({tokenize:y6},t,a)(m):a(m)}}function y6(e,t,a){return ft(e,r,"whitespace");function r(o){return o===null?a(o):t(o)}}function N6(e){return oN([GI(),n6(),c6(e),h6(),x6()])}const T6={};function Gi(e){const t=this,a=e||T6,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(N6(a)),u.push(zI()),c.push($I(a))}const _6=5*1024*1024,j1=10,eT=["image/png","image/jpeg","image/gif","image/webp"];let v6=0;function S6(e){return new Promise((t,a)=>{const r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>a(r.error),r.readAsDataURL(e)})}function A6({url:e,label:t,onClose:a}){return T.useEffect(()=>{const r=o=>{o.key==="Escape"&&(o.preventDefault(),a())};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[a]),i.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t,onClick:a,className:"fixed inset-0 z-50 flex cursor-zoom-out items-center justify-center bg-black/80 p-8 backdrop-blur-sm",children:i.jsx("img",{src:e,alt:t,className:"max-h-full max-w-full object-contain"})})}function tT({url:e,label:t,className:a}){const[r,o]=T.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>o(!0),"aria-label":`预览 ${t}`,className:"block cursor-zoom-in rounded-md transition-opacity duration-150 hover:opacity-80",children:i.jsx("img",{src:e,alt:t,className:ae("rounded-md border border-line",a)})}),r&&i.jsx(A6,{url:e,label:t,onClose:()=>o(!1)})]})}function nT(e=!0){const[t,a]=T.useState([]),[r,o]=T.useState(null);T.useEffect(()=>{o(null),e||a([])},[e]);const u=async b=>{const g=[],y=[],N=t.length;let v=j1-N;for(const S of b){if(v<=0){y.push(`最多 ${j1} 张图片`);break}if(!eT.includes(S.type)){y.push(`${S.name||"文件"}:格式不支持`);continue}if(S.size>_6){y.push(`${S.name}:超过 5MB`);continue}g.push({_id:`att-${++v6}`,mime:S.type,url:await S6(S),filename:S.name}),v--}g.length>0&&a(S=>[...S,...g]),o(y.length>0?y.join(";"):null)},c=b=>{const g=Array.from(b.clipboardData.files);if(g.length!==0){if(b.preventDefault(),!e){o("当前模型不支持图片");return}u(g)}},f=b=>a(g=>g.filter(y=>y._id!==b)),m=T.useCallback(()=>{a([]),o(null)},[]),h=t.map(({mime:b,url:g,filename:y})=>({mime:b,url:g,filename:y}));return{attachments:t,promptFiles:h,error:r,setError:o,addFiles:u,onPaste:c,remove:f,clear:m}}function aT({onFiles:e,disabled:t,allowed:a}){const r=T.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:r,type:"file",accept:eT.join(","),multiple:!0,hidden:!0,onChange:o=>{e(Array.from(o.target.files??[])),o.target.value=""}}),i.jsx("button",{type:"button",onClick:()=>{var o;return(o=r.current)==null?void 0:o.click()},disabled:t||!a,"aria-label":"Attach image",title:a?"附加图片":"当前模型不支持图片",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-fg-5 transition-colors duration-150 hover:text-fg-3 disabled:cursor-not-allowed disabled:text-fg-6/40",children:i.jsx(A3,{className:"h-4 w-4"})})]})}function sT({attachments:e,error:t,onRemove:a,className:r}){return e.length===0&&!t?null:i.jsxs("div",{className:r,children:[e.length>0&&i.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:e.map(o=>i.jsxs("div",{className:"group relative",children:[i.jsx(tT,{url:o.url,label:o.filename??"attachment",className:"h-16 w-16 object-cover"}),i.jsx("button",{type:"button",onClick:()=>a(o._id),"aria-label":"Remove attachment",className:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-line bg-term text-fg-4 opacity-0 transition-opacity duration-150 hover:text-fg-2 group-hover:opacity-100",children:i.jsx(gt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]},o._id))}),t&&i.jsx("div",{className:"mb-2 font-mono text-[11px] text-red-400",children:t})]})}function rT({isListening:e,disabled:t,onStart:a,onStop:r}){const o=T.useRef(!1),u=f=>{if(t)return;f.preventDefault(),o.current=!0,a();const m=()=>{document.removeEventListener("touchend",m),document.removeEventListener("touchcancel",m),o.current=!1,r()};document.addEventListener("touchend",m,{once:!0}),document.addEventListener("touchcancel",m,{once:!0})},c=()=>{if(t||o.current)return;a();const f=()=>{document.removeEventListener("mouseup",f),r()};document.addEventListener("mouseup",f,{once:!0})};return i.jsx("button",{type:"button",disabled:t,onTouchStart:u,onMouseDown:c,onContextMenu:f=>f.preventDefault(),"aria-label":"按住说话",title:"按住说话",style:{WebkitTouchCallout:"none"},className:ae("flex shrink-0 select-none touch-none items-center justify-center transition-colors duration-150 disabled:cursor-not-allowed disabled:text-fg-6/40","order-first self-stretch w-12 rounded-xl sm:order-none sm:self-auto sm:h-7 sm:w-7 sm:rounded-md",e?"bg-red-500/15 text-red-400 hover:bg-red-500/25":"text-fg-5 hover:text-fg-3"),children:i.jsx(B3,{className:ae("h-6 w-6 sm:h-4 sm:w-4",e&&"animate-pulse")})})}const C6=[.85,1.25,.65,1.4,.75,1.15,.95],Fm=4,B1=24;function w6(e){const t=Math.floor(e/60).toString().padStart(2,"0"),a=Math.floor(e%60).toString().padStart(2,"0");return`${t}:${a}`}function k6({volumeLevel:e}){const t=Math.min(Math.max(e,0),1);return i.jsx("div",{className:"flex h-6 items-center gap-1","aria-hidden":"true",children:C6.map((a,r)=>{const o=Fm+t*a*(B1-Fm),u=Math.max(Fm,Math.min(B1,o));return i.jsx("span",{className:"w-1 rounded-full bg-red-400 transition-[height] duration-150 ease-out",style:{height:`${u}px`}},r)})})}function iT({phase:e,transcript:t,interimTranscript:a,editText:r,onEditTextChange:o,onTextareaKeyDown:u,textareaRef:c,wrapperClassName:f}){if(e==="idle")return null;const m=t.length>0||a.length>0;return i.jsx("div",{className:f,children:i.jsxs("div",{className:"max-h-[40vh] overflow-y-auto px-4 py-4",children:[e==="recording"&&i.jsx("div",{className:"text-xl leading-relaxed",children:m?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-fg",children:t}),a&&i.jsx("span",{className:"text-fg-4",children:a})]}):i.jsx("span",{className:"italic text-fg-5",children:"正在聆听…"})}),e==="recognizing"&&i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ln,{className:"h-5 w-5 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-sm text-emerald-400",children:"识别中…"}),a&&i.jsx("span",{className:"truncate text-base text-fg-4",children:a})]}),e==="done"&&i.jsx("textarea",{ref:c,value:r,onChange:h=>o(h.target.value),onKeyDown:u,rows:2,placeholder:"识别结果(可编辑)",className:"w-full resize-none bg-transparent text-xl leading-relaxed text-fg placeholder:text-fg-5 focus:outline-none"})]})})}function lT({phase:e,volumeLevel:t,elapsed:a,editText:r,error:o,onCancel:u,onConfirm:c,idleHint:f,className:m}){return e==="idle"?i.jsx("div",{className:m,children:o?i.jsx("span",{className:"font-mono text-[10px] text-red-400",children:o}):f?i.jsx("span",{className:"font-mono text-[10px] text-fg-6",children:f}):null}):e==="done"?i.jsxs("div",{className:m,children:[i.jsx("span",{className:"hidden font-mono text-[10px] text-fg-6 sm:inline",children:"⌘/Ctrl+⏎ 发送 · Esc 取消"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:u,className:"rounded-md border border-line px-3 py-1 text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),i.jsxs("button",{type:"button",onClick:c,disabled:r.trim().length===0,"aria-label":"发送",className:"flex items-center gap-1.5 rounded-md bg-emerald-600 px-3 py-1 text-xs font-medium text-white transition-colors hover:bg-emerald-500 disabled:cursor-not-allowed disabled:bg-fg-6/30 disabled:text-fg-5",children:[i.jsx(Eo,{className:"h-3.5 w-3.5",strokeWidth:2.5}),i.jsx("span",{children:"发送"})]})]})]}):i.jsx("div",{className:m,children:e==="recording"?i.jsxs(i.Fragment,{children:[i.jsx(k6,{volumeLevel:t}),i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[11px] font-medium text-red-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-red-400"}),"录音中"]}),i.jsx("span",{className:"font-mono text-[11px] tabular-nums text-fg-4",children:w6(a)})]}):i.jsxs(i.Fragment,{children:[i.jsx(ln,{className:"h-4 w-4 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-[11px] text-emerald-400",children:"识别中…"})]})})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Ki;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Ki||(Ki={}));class zm extends Error{constructor(t,a,r){super(t),this.message=t,this.code=a,this.data=r}}const R6=e=>{var t,a;return e!=null&&e.androidBridge?"android":!((a=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||a===void 0)&&a.bridge?"ios":"web"},O6=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},r=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:R6(e),u=()=>o()!=="web",c=g=>{const y=h.get(g);return!!(y!=null&&y.platforms.has(o())||f(g))},f=g=>{var y;return(y=a.PluginHeaders)===null||y===void 0?void 0:y.find(N=>N.name===g)},m=g=>e.console.error(g),h=new Map,b=(g,y={})=>{const N=h.get(g);if(N)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),N.proxy;const v=o(),S=f(g);let C;const A=async()=>(!C&&v in y?C=typeof y[v]=="function"?C=await y[v]():C=y[v]:t!==null&&!C&&"web"in y&&(C=typeof y.web=="function"?C=await y.web():C=y.web),C),O=(Z,K)=>{var M,ne;if(S){const le=S==null?void 0:S.methods.find(te=>K===te.name);if(le)return le.rtype==="promise"?te=>a.nativePromise(g,K.toString(),te):(te,Y)=>a.nativeCallback(g,K.toString(),te,Y);if(Z)return(M=Z[K])===null||M===void 0?void 0:M.bind(Z)}else{if(Z)return(ne=Z[K])===null||ne===void 0?void 0:ne.bind(Z);throw new zm(`"${g}" plugin is not implemented on ${v}`,Ki.Unimplemented)}},k=Z=>{let K;const M=(...ne)=>{const le=A().then(te=>{const Y=O(te,Z);if(Y){const j=Y(...ne);return K=j==null?void 0:j.remove,j}else throw new zm(`"${g}.${Z}()" is not implemented on ${v}`,Ki.Unimplemented)});return Z==="addListener"&&(le.remove=async()=>K()),le};return M.toString=()=>`${Z.toString()}() { [capacitor code] }`,Object.defineProperty(M,"name",{value:Z,writable:!1,configurable:!1}),M},B=k("addListener"),R=k("removeListener"),H=(Z,K)=>{const M=B({eventName:Z},K),ne=async()=>{const te=await M;R({eventName:Z,callbackId:te},K)},le=new Promise(te=>M.then(()=>te({remove:ne})));return le.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ne()},le},q=new Proxy({},{get(Z,K){switch(K){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return S?H:B;case"removeListener":return R;default:return k(K)}}});return r[g]=q,h.set(g,{name:g,proxy:q,platforms:new Set([...Object.keys(y),...S?[v]:[]])}),q};return a.convertFileSrc||(a.convertFileSrc=g=>g),a.getPlatform=o,a.handleError=m,a.isNativePlatform=u,a.isPluginAvailable=c,a.registerPlugin=b,a.Exception=zm,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},I6=e=>e.Capacitor=O6(e),Dc=I6(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Po=Dc.registerPlugin;class hp{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,a){let r=!1;this.listeners[t]||(this.listeners[t]=[],r=!0),this.listeners[t].push(a);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),r&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,a);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,a,r){const o=this.listeners[t];if(!o){if(r){let u=this.retainedEventArguments[t];u||(u=[]),u.push(a),this.retainedEventArguments[t]=u}return}o.forEach(u=>u(a))}hasListeners(t){var a;return!!(!((a=this.listeners[t])===null||a===void 0)&&a.length)}registerWindowListener(t,a){this.windowListeners[a]={registered:!1,windowEventName:t,pluginEventName:a,handler:r=>{this.notifyListeners(a,r)}}}unimplemented(t="not implemented"){return new Dc.Exception(t,Ki.Unimplemented)}unavailable(t="not available"){return new Dc.Exception(t,Ki.Unavailable)}async removeListener(t,a){const r=this.listeners[t];if(!r)return;const o=r.indexOf(a);this.listeners[t].splice(o,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const a=this.retainedEventArguments[t];a&&(delete this.retainedEventArguments[t],a.forEach(r=>{this.notifyListeners(t,r)}))}}const P1=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),U1=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class M6 extends hp{async getCookies(){const t=document.cookie,a={};return t.split(";").forEach(r=>{if(r.length<=0)return;let[o,u]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=U1(o).trim(),u=U1(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=P1(t.key),r=P1(t.value),o=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${a}=${r||""}${o}; path=${u}; ${c};`}catch(a){return Promise.reject(a)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(a){return Promise.reject(a)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const a of t)document.cookie=a.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}Po("CapacitorCookies",{web:()=>new M6});const D6=async e=>new Promise((t,a)=>{const r=new FileReader;r.onload=()=>{const o=r.result;t(o.indexOf(",")>=0?o.split(",")[1]:o)},r.onerror=o=>a(o),r.readAsDataURL(e)}),L6=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,c)=>(o[u]=e[t[c]],o),{})},j6=(e,t=!0)=>e?Object.entries(e).reduce((r,o)=>{const[u,c]=o;let f,m;return Array.isArray(c)?(m="",c.forEach(h=>{f=t?encodeURIComponent(h):h,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=t?encodeURIComponent(c):c,m=`${u}=${f}`),`${r}&${m}`},"").substr(1):null,B6=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=L6(e.headers)["content-type"]||"";if(typeof e.data=="string")a.body=e.data;else if(o.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);a.body=u.toString()}else if(o.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,m)=>{u.append(m,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);a.body=u;const c=new Headers(a.headers);c.delete("content-type"),a.headers=c}else(o.includes("application/json")||typeof e.data=="object")&&(a.body=JSON.stringify(e.data));return a};class P6 extends hp{async request(t){const a=B6(t,t.webFetchExtra),r=j6(t.params,t.shouldEncodeUrlParams),o=r?`${t.url}?${r}`:t.url,u=await fetch(o,a),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?t:{};c.includes("application/json")&&(f="json");let m,h;switch(f){case"arraybuffer":case"blob":h=await u.blob(),m=await D6(h);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const b={};return u.headers.forEach((g,y)=>{b[y]=g}),{data:m,headers:b,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}Po("CapacitorHttp",{web:()=>new P6});var H1;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(H1||(H1={}));var F1;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(F1||(F1={}));class U6 extends hp{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}Po("SystemBars",{web:()=>new U6});const H6="modulepreload",F6=function(e){return"/"+e},z1={},z6=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let c=function(h){return Promise.all(h.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=c(a.map(h=>{if(h=F6(h),h in z1)return;z1[h]=!0;const b=h.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const y=document.createElement("link");if(y.rel=b?"stylesheet":H6,b||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),b)return new Promise((N,v)=>{y.addEventListener("load",N),y.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return o.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},Li=Po("SpeechRecognition",{web:()=>z6(()=>import("./web-_hN4u8zq.js"),[]).then(e=>new e.SpeechRecognitionWeb)});function $6(e,t){const a=e.length,r=new ArrayBuffer(44+a*2),o=new DataView(r),u=(c,f)=>{for(let m=0;m<f.length;m++)o.setUint8(c+m,f.charCodeAt(m))};u(0,"RIFF"),o.setUint32(4,36+a*2,!0),u(8,"WAVE"),u(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,t,!0),o.setUint32(28,t*2,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),u(36,"data"),o.setUint32(40,a*2,!0);for(let c=0;c<a;c++){const f=Math.max(-1,Math.min(1,e[c]));o.setInt16(44+c*2,f<0?f*32768:f*32767,!0)}return new Blob([r],{type:"audio/wav"})}const Eh=Dc.isNativePlatform(),$m=!Eh&&typeof window<"u"?window.SpeechRecognition??window.webkitSpeechRecognition:void 0,qm=16e3;function q6(e="zh-CN"){const[t,a]=T.useState(!1),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(null),[h,b]=T.useState(0),[g,y]=T.useState("idle"),N=T.useRef(null),v=T.useRef(!1),S=T.useRef([]),C=T.useRef(!1),A=T.useRef(null),O=T.useRef(!1),k=T.useRef(null),B=T.useRef(null),R=T.useRef(null),H=T.useRef([]),q=T.useRef(!1),Z=!0,K=T.useCallback(async()=>{var oe,L,Ne;(oe=R.current)==null||oe.disconnect(),(L=B.current)==null||L.getTracks().forEach(Te=>Te.stop()),await((Ne=k.current)==null?void 0:Ne.close().catch(()=>{}));const D=H.current;if(H.current=[],R.current=null,B.current=null,k.current=null,D.length===0||q.current){a(!1),y("idle");return}c("识别中…"),y("recognizing");const F=D.reduce((Te,X)=>Te+X.length,0),U=new Float32Array(F);let J=0;for(const Te of D)U.set(Te,J),J+=Te.length;const I=$6(U,qm),$=new FormData;$.append("audio",I,"recording.wav");try{const Te=await fetch("/api/transcribe",{method:"POST",body:$});if(q.current)return;if(Te.ok){const{text:X}=await Te.json();X?(o(X),y("done")):y("idle")}else{const X=await Te.json().catch(()=>({error:`HTTP ${Te.status}`}));m(X.error??`HTTP ${Te.status}`),y("idle")}}catch(Te){m(`语音识别失败:${Te instanceof Error?Te.message:String(Te)}`),y("idle")}finally{c(""),a(!1)}},[]),M=T.useCallback(async()=>{if(v.current=!0,A.current&&(clearTimeout(A.current),A.current=null),Eh){await Li.stop().catch(()=>{});for(const D of S.current)await D.remove().catch(()=>{});S.current=[],a(!1),c("")}else N.current?N.current.stop():k.current?await K():(a(!1),y("idle"))},[K]),ne=T.useCallback(async()=>{var J;q.current=!1,o(""),c(""),m(null),y("idle");const{available:D}=await Li.available();if(!D){m("当前设备不支持语音识别");return}if((await Li.requestPermissions()).speechRecognition!=="granted"){m("请允许语音识别权限");return}const U=[];U.push(await Li.addListener("partialResults",I=>{c(I.matches[0]??"")})),U.push(await Li.addListener("listeningState",I=>{const $=I.status==="started";a($),$&&y("recording"),$||c("")})),S.current=U;try{const I=await Li.start({language:e,partialResults:!0,maxResults:1});(J=I.matches)!=null&&J.length&&o($=>$+I.matches.join(""))}catch(I){m(`语音识别错误:${I instanceof Error?I.message:String(I)}`);for(const $ of U)await $.remove().catch(()=>{});S.current=[]}},[e]),le=T.useCallback(()=>{if(!$m)return!1;q.current=!1,o(""),c(""),m(null),y("idle"),v.current=!1;const D=new $m;D.lang=e,D.continuous=!0,D.interimResults=!0,D.maxAlternatives=1,D.onstart=()=>{a(!0),y("recording"),C.current=!1,A.current=setTimeout(()=>{!C.current&&!v.current&&(O.current=!0,v.current=!0,D.stop(),m("语音识别服务不可用(Chrome/Edge 需连接 Google 服务器),下次将使用服务端识别"))},5e3)},D.onresult=F=>{C.current=!0,A.current&&(clearTimeout(A.current),A.current=null);let U="",J="";for(let I=F.resultIndex;I<F.results.length;I++){const $=F.results[I][0].transcript;F.results[I].isFinal?U+=$:J+=$}U&&o(I=>I+U),c(J)},D.onerror=F=>{switch(F.error!=="no-speech"&&F.error!=="aborted"&&(v.current=!0),F.error){case"not-allowed":m("请允许麦克风权限");break;case"network":m("网络错误,请检查连接");break;case"no-speech":case"aborted":return;default:m(`语音识别错误:${F.error}`)}},D.onend=()=>{if(c(""),!v.current)try{D.start();return}catch{}a(!1),N.current=null},N.current=D;try{return D.start(),!0}catch{return!1}},[e]),te=T.useCallback(async()=>{q.current=!1,o(""),c(""),m(null),y("idle");try{const I=await fetch("/api/transcribe/status"),{available:$}=await I.json();if(!$){m("语音识别服务未就绪,请稍后重试");return}}catch{m("无法连接语音识别服务");return}let D;try{D=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:qm,channelCount:1}})}catch{m("请允许麦克风权限");return}const F=new AudioContext({sampleRate:qm}),U=F.createMediaStreamSource(D),J=F.createScriptProcessor(4096,1,1);H.current=[],J.onaudioprocess=I=>{H.current.push(new Float32Array(I.inputBuffer.getChannelData(0)))},U.connect(J),J.connect(F.destination),k.current=F,B.current=D,R.current=J,a(!0),y("recording")},[]),Y=T.useCallback(()=>{Eh?ne():$m&&!O.current&&le()||te()},[ne,le,te]);T.useEffect(()=>{if(!t){b(0);return}if(N.current)return;let D=!1,F=null,U=null,J=0;return(async()=>{try{if(F=await navigator.mediaDevices.getUserMedia({audio:!0}),D){F.getTracks().forEach(Te=>Te.stop());return}U=new AudioContext;const I=U.createMediaStreamSource(F),$=U.createAnalyser();$.fftSize=256,I.connect($);const oe=new Uint8Array($.frequencyBinCount);let L=0;const Ne=()=>{if(D)return;$.getByteFrequencyData(oe);const Te=performance.now();if(Te-L>80){let X=0;for(let ve=0;ve<oe.length;ve++)X+=oe[ve];b(X/(oe.length*255)),L=Te}J=requestAnimationFrame(Ne)};J=requestAnimationFrame(Ne)}catch{}})(),()=>{D=!0,cancelAnimationFrame(J),F==null||F.getTracks().forEach(I=>I.stop()),U==null||U.close().catch(()=>{}),b(0)}},[t]),T.useEffect(()=>{!t&&g==="recording"&&y(r?"done":"idle")},[t,g,r]),T.useEffect(()=>()=>{var D,F,U,J;v.current=!0,(D=N.current)==null||D.stop(),(F=R.current)==null||F.disconnect(),(U=B.current)==null||U.getTracks().forEach(I=>I.stop()),(J=k.current)==null||J.close().catch(()=>{});for(const I of S.current)I.remove().catch(()=>{})},[]);const j=T.useCallback(()=>{q.current=!0,o(""),c(""),y("idle")},[]);return{isSupported:Z,isListening:t,phase:g,transcript:r,interimTranscript:u,error:f,volumeLevel:h,start:Y,stop:M,resetTranscript:j}}const Y6=240,G6=1e3;function oT(e){const t=q6(),[a,r]=T.useState(""),[o,u]=T.useState(0),c=T.useRef(null),f=T.useRef(null),m=T.useRef(0);T.useEffect(()=>(t.phase==="recording"?(m.current=Date.now(),u(0),f.current=setInterval(()=>{u(Math.floor((Date.now()-m.current)/1e3))},G6)):f.current&&(clearInterval(f.current),f.current=null),()=>{f.current&&(clearInterval(f.current),f.current=null)}),[t.phase]),T.useEffect(()=>{t.phase==="done"&&(r(t.transcript),requestAnimationFrame(()=>{const y=c.current;y&&(y.focus(),y.setSelectionRange(y.value.length,y.value.length))}))},[t.phase,t.transcript]),T.useLayoutEffect(()=>{if(t.phase!=="done")return;const y=c.current;y&&(y.style.height="auto",y.style.height=`${Math.min(y.scrollHeight,Y6)}px`)},[t.phase,a]);const h=T.useCallback(()=>{t.stop(),t.resetTranscript(),r("")},[t]),b=T.useCallback(async()=>{const y=a.trim();if(!y){h();return}await e(y)!==!1&&(t.resetTranscript(),r(""))},[a,e,h,t]);T.useEffect(()=>{if(t.phase==="idle")return;const y=N=>{if(N.key==="Escape"&&t.phase!=="recognizing"){N.preventDefault(),h();return}if(t.phase==="done"&&N.key==="Enter"&&(N.metaKey||N.ctrlKey)){if(N.isComposing)return;N.preventDefault(),b()}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t.phase,h,b]);const g=T.useCallback(y=>{y.nativeEvent.isComposing||y.keyCode===229||y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),b())},[b]);return{stt:t,editText:a,setEditText:r,elapsed:o,textareaRef:c,cancel:h,confirm:b,handleTextareaKeyDown:g}}const or=es(e=>({agents:[],loaded:!1,loadAgents:async()=>{const t=je.getState().activeRepoId;try{const a=t?await Ly(t):await Iy();e({agents:a,loaded:!0})}catch{e({loaded:!0})}}}));function K6(e){if(typeof e!="string")return e;const t=e.trim();if(t)try{return JSON.parse(t)}catch{return t}}function pn(e){return e&&typeof e=="object"?e:null}function Kr(e){const t=pn(e);return t&&"properties"in t?t.properties:e}function V6(e){const t=pn(e);return typeof(t==null?void 0:t.type)=="string"?t.type:void 0}function X6(e){const t=pn(Kr(e));if(!t)return null;const a=pn(t.info);if(a&&typeof a.id=="string"){const o=Array.isArray(t.parts)?t.parts:void 0;return{...a,...o?{parts:o}:{}}}if(typeof t.id=="string"&&typeof t.role=="string")return t;const r=pn(t.message);return r&&typeof r.id=="string"?r:null}function Q6(e){const t=pn(Kr(e));if(!t)return{};const a=pn(t.part)??t;return typeof a.type!="string"?{}:{messageId:typeof a.messageID=="string"&&a.messageID||typeof a.messageId=="string"&&a.messageId||typeof t.messageID=="string"&&t.messageID||typeof t.messageId=="string"&&t.messageId||void 0,part:a}}function W6(e){const t=pn(Kr(e));if(!t||t.field!=="text")return null;const a=typeof t.messageID=="string"?t.messageID:null,r=typeof t.partID=="string"?t.partID:null,o=typeof t.delta=="string"?t.delta:null;return!a||!r||o===null?null:{messageId:a,partId:r,delta:o}}function Z6(e){const t=Kr(e);if(Array.isArray(t))return t;const a=pn(t);return a&&Array.isArray(a.todos)?a.todos:[]}function Xa(e){return typeof e=="number"?e:0}function J6(e){const t=pn(Kr(e));if(!t||typeof t.id!="string")return null;const a={id:t.id};typeof t.title=="string"&&(a.title=t.title),typeof t.agent=="string"&&(a.agent=t.agent),typeof t.cost=="number"&&(a.cost=t.cost);const r=typeof t.parentID=="string"?t.parentID:typeof t.parent_id=="string"?t.parent_id:void 0;r&&(a.parentID=r);const o=pn(t.tokens),u=typeof t.tokens_input=="number"||typeof t.tokens_output=="number";if(o||u){const f=o?pn(o.cache):null;a.tokens={input:Xa(o==null?void 0:o.input)||Xa(t.tokens_input),output:Xa(o==null?void 0:o.output)||Xa(t.tokens_output),reasoning:Xa(o==null?void 0:o.reasoning)||Xa(t.tokens_reasoning),cache:{read:Xa(f==null?void 0:f.read)||Xa(t.tokens_cache_read),write:Xa(f==null?void 0:f.write)||Xa(t.tokens_cache_write)}}}const c=pn(t.model);return c&&(a.model={providerID:typeof c.providerID=="string"?c.providerID:void 0,modelID:typeof c.modelID=="string"?c.modelID:void 0,variant:typeof c.variant=="string"?c.variant:void 0}),a}function eM(e){const t=pn(Kr(e));if(!t)return null;if(typeof t.message=="string")return t.message;const a=pn(t.error);if(a){const r=pn(a.data);if(typeof(r==null?void 0:r.message)=="string")return`${a.name??"Error"}: ${r.message}`;if(typeof a.message=="string")return`${a.name??"Error"}: ${a.message}`;if(typeof a.name=="string")return String(a.name)}return typeof t.reason=="string"?t.reason:null}function tM(e){const t=Kr(e);if(typeof t=="string")return t;const a=pn(t);if(typeof(a==null?void 0:a.status)=="string")return a.status;const r=pn(a==null?void 0:a.status);return typeof(r==null?void 0:r.type)=="string"?r.type:typeof(a==null?void 0:a.type)=="string"?a.type:null}function nM(e,t,a,r){switch(e==="message"||e===""?V6(t)??e:e){case"message.updated":{const u=X6(t);u&&r.updateMessage(a,u);break}case"session.updated":{const u=J6(t);u&&r.updateSessionInfo(u);break}case"message.part.updated":{const{messageId:u,part:c}=Q6(t);c&&u&&r.updateMessagePart(a,u,c);break}case"message.part.delta":{const u=W6(t);u&&r.appendMessagePartDelta(a,u.messageId,u.partId,u.delta);break}case"todo.updated":{r.updateTodos(a,Z6(t));break}case"session.status":{const u=tM(t);u&&r.setSessionStatus(a,u);break}case"session.idle":{r.setSessionStatus(a,"idle");break}case"session.error":{const u=eM(t);r.setSessionStatus(a,"error",u??void 0);break}}}const aM=600*1e3;class sM{constructor(t,a){sn(this,"sessionId");sn(this,"idleTimer",null);sn(this,"active",!1);sn(this,"alive",!0);sn(this,"callbacks");this.sessionId=t,this.callbacks=a,this.resetIdleTimer()}dispatch(t,a){if(!this.alive)return;this.resetIdleTimer();const r=Re.getState();nM(t,a,this.sessionId,r)}activate(){this.active=!0,this.clearIdleTimer()}deactivate(){this.active=!1,this.resetIdleTimer()}refreshOnIdle(){Re.getState().refreshSessionData(this.sessionId)}stop(){this.alive=!1,this.clearIdleTimer()}resetIdleTimer(){this.clearIdleTimer(),!this.active&&(this.idleTimer=setTimeout(()=>{this.callbacks.onWorkerIdle(this.sessionId)},aM))}clearIdleTimer(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}}const rM=1e3,iM=3e4;class lM{constructor(t,a){sn(this,"source",null);sn(this,"reconnectTimer",null);sn(this,"attempts",0);sn(this,"disposed",!1);sn(this,"repoId");sn(this,"onEvent");this.repoId=t,this.onEvent=a}start(){this.connect()}stop(){var t;this.disposed=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.source)==null||t.close(),this.source=null}connect(){if(this.disposed)return;const t=kw(this.repoId),a=new EventSource(t);this.source=a,a.onopen=()=>{this.attempts=0},a.onmessage=o=>{this.handleRaw("message",o)};const r=["message.updated","message.part.updated","message.part.delta","message.removed","todo.updated","session.status","session.idle","session.error","session.updated"];for(const o of r)a.addEventListener(o,u=>{this.handleRaw(o,u)});a.onerror=()=>{if(!(this.disposed||!this.source)&&this.source.readyState===EventSource.CLOSED){this.source.close(),this.source=null;const o=Math.min(rM*2**this.attempts,iM);this.attempts++,this.reconnectTimer=setTimeout(()=>this.connect(),o)}}}handleRaw(t,a){if(!(a instanceof MessageEvent))return;const r=K6(a.data);if(r===void 0)return;const o=this.extractSessionId(r);if(!o)return;let u=t;if(t==="message"||t===""){const c=r&&typeof r=="object"?r:null;typeof(c==null?void 0:c.type)=="string"&&(u=c.type)}this.onEvent(o,u,r)}extractSessionId(t){if(!t||typeof t!="object")return null;const a=t;if(a.properties&&typeof a.properties=="object"){const r=a.properties;if(typeof r.sessionID=="string")return r.sessionID;if(typeof r.id=="string")return r.id}return typeof a.sessionID=="string"?a.sessionID:typeof a.sessionId=="string"?a.sessionId:null}}const oM=6e4;class uM{constructor(t){sn(this,"timer",null);sn(this,"paused",!1);sn(this,"callbacks");this.callbacks=t}start(){this.tick(),this.timer=setInterval(()=>{this.paused||this.tick()},oM)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null)}pause(){this.paused=!0}resume(){this.paused=!1,this.tick()}tick(){const t=je.getState().activeRepoId;t&&(Re.getState().loadSessions(),Rw(t).then(a=>{const r={};for(const[o,u]of Object.entries(a))r[o]=u.type??"idle";Re.getState().bulkSetStatuses(r);for(const[o,u]of Object.entries(r))(u==="busy"||u==="retry")&&this.callbacks.ensureWorker(o)}).catch(()=>{}))}}class cM{constructor(){sn(this,"workers",new Map);sn(this,"dispatcher",null);sn(this,"supervisor",null);sn(this,"visibilityHandler",null)}start(t){this.stop();const a={onWorkerIdle:r=>this.removeWorker(r)};this.dispatcher=new lM(t,(r,o,u)=>{const c=this.ensureWorker(r,a);if(o==="session.idle"||o==="session.status"){const f=Re.getState().sessionStatuses[r];c.dispatch(o,u);const m=Re.getState().sessionStatuses[r];f&&f!=="idle"&&m==="idle"&&c.refreshOnIdle()}else c.dispatch(o,u)}),this.dispatcher.start(),this.supervisor=new uM({ensureWorker:r=>this.ensureWorker(r,a)}),this.supervisor.start(),this.visibilityHandler=()=>{var r,o;document.hidden?(r=this.supervisor)==null||r.pause():(o=this.supervisor)==null||o.resume()},document.addEventListener("visibilitychange",this.visibilityHandler)}stop(){var t,a;(t=this.dispatcher)==null||t.stop(),this.dispatcher=null,(a=this.supervisor)==null||a.stop(),this.supervisor=null;for(const r of this.workers.values())r.stop();this.workers.clear(),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null)}activateSession(t){for(const o of this.workers.values())o.sessionId!==t&&o.deactivate();if(!t)return;const a={onWorkerIdle:o=>this.removeWorker(o)};this.ensureWorker(t,a).activate(),Re.getState().refreshSessionData(t)}deactivateSession(t){var a;(a=this.workers.get(t))==null||a.deactivate()}ensureWorker(t,a){let r=this.workers.get(t);return r||(r=new sM(t,a),this.workers.set(t,r)),r}removeWorker(t){const a=Re.getState().activeSessionId;if(t===a)return;const r=this.workers.get(t);r&&(r.stop(),this.workers.delete(t))}}const Lc=new cM,$1=(function(e,t,a){const r=Lo(a);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Vr=(function(e){if(e==null)return mM;if(typeof e=="string")return fM(e);if(typeof e=="object")return dM(e);if(typeof e=="function")return pp(e);throw new Error("Expected function, string, or array as `test`")});function dM(e){const t=[];let a=-1;for(;++a<e.length;)t[a]=Vr(e[a]);return pp(r);function r(...o){let u=-1;for(;++u<t.length;)if(t[u].apply(this,o))return!0;return!1}}function fM(e){return pp(t);function t(a){return a.tagName===e}}function pp(e){return t;function t(a,r,o){return!!(hM(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function mM(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function hM(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const q1=/\n/g,Y1=/[\t ]+/g,yh=Vr("br"),G1=Vr(TM),pM=Vr("p"),K1=Vr("tr"),gM=Vr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",NM,_M]),uT=Vr(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function bM(e,t){const a=t||{},r="children"in e?e.children:[],o=uT(e),u=fT(e,{whitespace:a.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...dT(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<r.length;)c.push(...cT(r[f],e,{whitespace:u,breakBefore:f?void 0:o,breakAfter:f<r.length-1?yh(r[f+1]):o}));const m=[];let h;for(f=-1;++f<c.length;){const b=c[f];typeof b=="number"?h!==void 0&&b>h&&(h=b):b&&(h!==void 0&&h>-1&&m.push(`
490
+ `))}function m(N,v,S,C){const A=S.enter("tableCell"),O=S.enter("phrasing"),k=S.containerPhrasing(N,{...C,before:u,after:u});return O(),A(),k}function h(N,v){return WO(N,{align:v,alignDelimiters:r,padding:a,stringLength:o})}function b(N,v,S){const C=N.children;let A=-1;const O=[],k=v.enter("table");for(;++A<C.length;)O[A]=g(C[A],v,S);return k(),O}function g(N,v,S){const C=N.children;let A=-1;const O=[],k=v.enter("tableRow");for(;++A<C.length;)O[A]=m(C[A],N,v,S);return k(),O}function y(N,v,S){let C=YN.inlineCode(N,v,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function PI(){return{exit:{taskListCheckValueChecked:D1,taskListCheckValueUnchecked:D1,paragraph:HI}}}function UI(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:FI}}}function D1(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function HI(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const r=a.children[0];if(r&&r.type==="text"){const o=t.children;let u=-1,c;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){c=f;break}}c===a&&(r.value=r.value.slice(1),r.value.length===0?a.children.shift():a.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,a.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function FI(e,t,a,r){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=a.createTracker(r);u&&f.move(c);let m=YN.listItem(e,t,a,{...r,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(b){return b+c}}function zI(){return[yO(),FO(),YO(),OI(),PI()]}function $I(e){return{extensions:[NO(),zO(e),GO(),BI(e),UI()]}}const qI={tokenize:QI,partial:!0},GN={tokenize:WI,partial:!0},KN={tokenize:ZI,partial:!0},VN={tokenize:JI,partial:!0},YI={tokenize:e6,partial:!0},XN={name:"wwwAutolink",tokenize:VI,previous:WN},QN={name:"protocolAutolink",tokenize:XI,previous:ZN},ws={name:"emailAutolink",tokenize:KI,previous:JN},ns={};function GI(){return{text:ns}}let Mr=48;for(;Mr<123;)ns[Mr]=ws,Mr++,Mr===58?Mr=65:Mr===91&&(Mr=97);ns[43]=ws;ns[45]=ws;ns[46]=ws;ns[95]=ws;ns[72]=[ws,QN];ns[104]=[ws,QN];ns[87]=[ws,XN];ns[119]=[ws,XN];function KI(e,t,a){const r=this;let o,u;return c;function c(g){return!xh(g)||!JN.call(r,r.previous)||mp(r.events)?a(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return xh(g)?(e.consume(g),f):g===64?(e.consume(g),m):a(g)}function m(g){return g===46?e.check(YI,b,h)(g):g===45||g===95||Rn(g)?(u=!0,e.consume(g),m):b(g)}function h(g){return e.consume(g),o=!0,m}function b(g){return u&&o&&Fn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):a(g)}}function VI(e,t,a){const r=this;return o;function o(c){return c!==87&&c!==119||!WN.call(r,r.previous)||mp(r.events)?a(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(qI,e.attempt(GN,e.attempt(KN,u),a),a)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function XI(e,t,a){const r=this;let o="",u=!1;return c;function c(g){return(g===72||g===104)&&ZN.call(r,r.previous)&&!mp(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),f):a(g)}function f(g){if(Fn(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const y=o.toLowerCase();if(y==="http"||y==="https")return e.consume(g),m}return a(g)}function m(g){return g===47?(e.consume(g),u?h:(u=!0,m)):a(g)}function h(g){return g===null||Oc(g)||Ot(g)||qr(g)||ed(g)?a(g):e.attempt(GN,e.attempt(KN,b),a)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function QI(e,t,a){let r=0;return o;function o(c){return(c===87||c===119)&&r<3?(r++,e.consume(c),o):c===46&&r===3?(e.consume(c),u):a(c)}function u(c){return c===null?a(c):t(c)}}function WI(e,t,a){let r,o,u;return c;function c(h){return h===46||h===95?e.check(VN,m,f)(h):h===null||Ot(h)||qr(h)||h!==45&&ed(h)?m(h):(u=!0,e.consume(h),c)}function f(h){return h===95?r=!0:(o=r,r=void 0),e.consume(h),c}function m(h){return o||r||!u?a(h):t(h)}}function ZI(e,t){let a=0,r=0;return o;function o(c){return c===40?(a++,e.consume(c),o):c===41&&r<a?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(VN,t,u)(c):c===null||Ot(c)||qr(c)?t(c):(e.consume(c),o)}function u(c){return c===41&&r++,e.consume(c),o}}function JI(e,t,a){return r;function r(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),r):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||Ot(f)||qr(f)?t(f):a(f)}function o(f){return f===null||f===40||f===91||Ot(f)||qr(f)?t(f):r(f)}function u(f){return Fn(f)?c(f):a(f)}function c(f){return f===59?(e.consume(f),r):Fn(f)?(e.consume(f),c):a(f)}}function e6(e,t,a){return r;function r(u){return e.consume(u),o}function o(u){return Rn(u)?a(u):t(u)}}function WN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ot(e)}function ZN(e){return!Fn(e)}function JN(e){return!(e===47||xh(e))}function xh(e){return e===43||e===45||e===46||e===95||Rn(e)}function mp(e){let t=e.length,a=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){a=!0;break}if(r._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const t6={tokenize:u6,partial:!0};function n6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:i6,continuation:{tokenize:l6},exit:o6}},text:{91:{name:"gfmFootnoteCall",tokenize:r6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:a6,resolveTo:s6}}}}function a6(e,t,a){const r=this;let o=r.events.length;const u=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;o--;){const m=r.events[o][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return a(m);const h=Ha(r.sliceSerialize({start:c.end,end:r.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?a(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function s6(e,t){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...f),e}function r6(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?a(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(u>999||g===93&&!c||g===null||g===91||Ot(g))return a(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return o.includes(Ha(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(g)}return Ot(g)||(c=!0),u++,e.consume(g),g===92?b:h}function b(g){return g===91||g===92||g===93?(e.consume(g),u++,h):h(g)}}function i6(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",b):a(v)}function b(v){if(c>999||v===93&&!f||v===null||v===91||Ot(v))return a(v);if(v===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return u=Ha(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Ot(v)||(f=!0),c++,e.consume(v),v===92?g:b}function g(v){return v===91||v===92||v===93?(e.consume(v),c++,b):b(v)}function y(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),o.includes(u)||o.push(u),ft(e,N,"gfmFootnoteDefinitionWhitespace")):a(v)}function N(v){return t(v)}}function l6(e,t,a){return e.check(Do,t,e.attempt(t6,t,a))}function o6(e){e.exit("gfmFootnoteDefinition")}function u6(e,t,a){const r=this;return ft(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):a(u)}}function c6(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:u,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},y=[["enter",b,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],N=f.parser.constructs.insideSpan.null;N&&xa(y,y.length,0,td(N,c.slice(h+1,m),f)),xa(y,y.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",b,f]]),xa(c,h-1,m-h+3,y),m=h+y.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const h=this.previous,b=this.events;let g=0;return y;function y(v){return h===126&&b[b.length-1][1].type!=="characterEscape"?m(v):(c.enter("strikethroughSequenceTemporary"),N(v))}function N(v){const S=$i(h);if(v===126)return g>1?m(v):(c.consume(v),g++,N);if(g<2&&!a)return m(v);const C=c.exit("strikethroughSequenceTemporary"),A=$i(v);return C._open=!A||A===2&&!!S,C._close=!S||S===2&&!!A,f(v)}}}class d6{constructor(){this.map=[]}add(t,a,r){f6(this,t,a,r)}consume(t){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const u of o)t.push(u);o=r.pop()}this.map.length=0}}function f6(e,t,a,r){let o=0;if(!(a===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=a,e.map[o][2].push(...r);return}o+=1}e.map.push([t,a,r])}}function m6(e,t){let a=!1;const r=[];for(;t<e.length;){const o=e[t];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const u=r.length-1;r[u]=r[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);t+=1}return r}function h6(){return{flow:{null:{name:"table",tokenize:p6,resolveAll:g6}}}}function p6(e,t,a){const r=this;let o=0,u=0,c;return f;function f(M){let ne=r.events.length-1;for(;ne>-1;){const Y=r.events[ne][1].type;if(Y==="lineEnding"||Y==="linePrefix")ne--;else break}const le=ne>-1?r.events[ne][1].type:null,te=le==="tableHead"||le==="tableRow"?H:m;return te===H&&r.parser.lazy[r.now().line]?a(M):te(M)}function m(M){return e.enter("tableHead"),e.enter("tableRow"),h(M)}function h(M){return M===124||(c=!0,u+=1),b(M)}function b(M){return M===null?a(M):Fe(M)?u>1?(u=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),N):a(M):it(M)?ft(e,b,"whitespace")(M):(u+=1,c&&(c=!1,o+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(M)))}function g(M){return M===null||M===124||Ot(M)?(e.exit("data"),b(M)):(e.consume(M),M===92?y:g)}function y(M){return M===92||M===124?(e.consume(M),g):g(M)}function N(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(M):(e.enter("tableDelimiterRow"),c=!1,it(M)?ft(e,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):v(M))}function v(M){return M===45||M===58?C(M):M===124?(c=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),S):R(M)}function S(M){return it(M)?ft(e,C,"whitespace")(M):C(M)}function C(M){return M===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),A):M===45?(u+=1,A(M)):M===null||Fe(M)?B(M):R(M)}function A(M){return M===45?(e.enter("tableDelimiterFiller"),O(M)):R(M)}function O(M){return M===45?(e.consume(M),O):M===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(M))}function k(M){return it(M)?ft(e,B,"whitespace")(M):B(M)}function B(M){return M===124?v(M):M===null||Fe(M)?!c||o!==u?R(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(M)):R(M)}function R(M){return a(M)}function H(M){return e.enter("tableRow"),q(M)}function q(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),q):M===null||Fe(M)?(e.exit("tableRow"),t(M)):it(M)?ft(e,q,"whitespace")(M):(e.enter("data"),Z(M))}function Z(M){return M===null||M===124||Ot(M)?(e.exit("data"),q(M)):(e.consume(M),M===92?K:Z)}function K(M){return M===92||M===124?(e.consume(M),Z):Z(M)}}function g6(e,t){let a=-1,r=!0,o=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,b,g;const y=new d6;for(;++a<e.length;){const N=e[a],v=N[1];N[0]==="enter"?v.type==="tableHead"?(f=!1,m!==0&&(L1(y,t,m,h,b),b=void 0,m=0),h={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(a,0,[["enter",h,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,g=void 0,u=[0,0,0,0],c=[0,a+1,0,0],f&&(f=!1,b={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},y.add(a,0,[["enter",b,t]])),o=v.type==="tableDelimiterRow"?2:b?3:1):o&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=oc(y,t,u,o,void 0,g),u=[0,0,0,0]),c[2]=a)):v.type==="tableCellDivider"&&(r?r=!1:(u[1]!==0&&(c[0]=c[1],g=oc(y,t,u,o,void 0,g)),u=c,c=[u[1],a,0,0])):v.type==="tableHead"?(f=!0,m=a):v.type==="tableRow"||v.type==="tableDelimiterRow"?(m=a,u[1]!==0?(c[0]=c[1],g=oc(y,t,u,o,a,g)):c[1]!==0&&(g=oc(y,t,c,o,a,g)),o=0):o&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(c[3]=a)}for(m!==0&&L1(y,t,m,h,b),y.consume(t.events),a=-1;++a<t.events.length;){const N=t.events[a];N[0]==="enter"&&N[1].type==="table"&&(N[1]._align=m6(t.events,a))}return e}function oc(e,t,a,r,o,u){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";a[0]!==0&&(u.end=Object.assign({},ji(t.events,a[0])),e.add(a[0],0,[["exit",u,t]]));const m=ji(t.events,a[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(a[1],0,[["enter",u,t]]),a[2]!==0){const h=ji(t.events,a[2]),b=ji(t.events,a[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},b)};if(e.add(a[2],0,[["enter",g,t]]),r!==2){const y=t.events[a[2]],N=t.events[a[3]];if(y[1].end=Object.assign({},N[1].end),y[1].type="chunkText",y[1].contentType="text",a[3]>a[2]+1){const v=a[2]+1,S=a[3]-a[2]-1;e.add(v,S,[])}}e.add(a[3]+1,0,[["exit",g,t]])}return o!==void 0&&(u.end=Object.assign({},ji(t.events,o)),e.add(o,0,[["exit",u,t]]),u=void 0),u}function L1(e,t,a,r,o){const u=[],c=ji(t.events,a);o&&(o.end=Object.assign({},c),u.push(["exit",o,t])),r.end=Object.assign({},c),u.push(["exit",r,t]),e.add(a+1,0,u)}function ji(e,t){const a=e[t],r=a[0]==="enter"?"start":"end";return a[1][r]}const b6={name:"tasklistCheck",tokenize:E6};function x6(){return{text:{91:b6}}}function E6(e,t,a){const r=this;return o;function o(m){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Ot(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):a(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):a(m)}function f(m){return Fe(m)?t(m):it(m)?e.check({tokenize:y6},t,a)(m):a(m)}}function y6(e,t,a){return ft(e,r,"whitespace");function r(o){return o===null?a(o):t(o)}}function N6(e){return oN([GI(),n6(),c6(e),h6(),x6()])}const T6={};function Gi(e){const t=this,a=e||T6,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(N6(a)),u.push(zI()),c.push($I(a))}const _6=5*1024*1024,j1=10,eT=["image/png","image/jpeg","image/gif","image/webp"];let v6=0;function S6(e){return new Promise((t,a)=>{const r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>a(r.error),r.readAsDataURL(e)})}function A6({url:e,label:t,onClose:a}){return T.useEffect(()=>{const r=o=>{o.key==="Escape"&&(o.preventDefault(),a())};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[a]),i.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t,onClick:a,className:"fixed inset-0 z-50 flex cursor-zoom-out items-center justify-center bg-black/80 p-8 backdrop-blur-sm",children:i.jsx("img",{src:e,alt:t,className:"max-h-full max-w-full object-contain"})})}function tT({url:e,label:t,className:a}){const[r,o]=T.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>o(!0),"aria-label":`预览 ${t}`,className:"block cursor-zoom-in rounded-md transition-opacity duration-150 hover:opacity-80",children:i.jsx("img",{src:e,alt:t,className:ae("rounded-md border border-line",a)})}),r&&i.jsx(A6,{url:e,label:t,onClose:()=>o(!1)})]})}function nT(e=!0){const[t,a]=T.useState([]),[r,o]=T.useState(null);T.useEffect(()=>{o(null),e||a([])},[e]);const u=async b=>{const g=[],y=[],N=t.length;let v=j1-N;for(const S of b){if(v<=0){y.push(`最多 ${j1} 张图片`);break}if(!eT.includes(S.type)){y.push(`${S.name||"文件"}:格式不支持`);continue}if(S.size>_6){y.push(`${S.name}:超过 5MB`);continue}g.push({_id:`att-${++v6}`,mime:S.type,url:await S6(S),filename:S.name}),v--}g.length>0&&a(S=>[...S,...g]),o(y.length>0?y.join(";"):null)},c=b=>{const g=Array.from(b.clipboardData.files);if(g.length!==0){if(b.preventDefault(),!e){o("当前模型不支持图片");return}u(g)}},f=b=>a(g=>g.filter(y=>y._id!==b)),m=T.useCallback(()=>{a([]),o(null)},[]),h=t.map(({mime:b,url:g,filename:y})=>({mime:b,url:g,filename:y}));return{attachments:t,promptFiles:h,error:r,setError:o,addFiles:u,onPaste:c,remove:f,clear:m}}function aT({onFiles:e,disabled:t,allowed:a}){const r=T.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:r,type:"file",accept:eT.join(","),multiple:!0,hidden:!0,onChange:o=>{e(Array.from(o.target.files??[])),o.target.value=""}}),i.jsx("button",{type:"button",onClick:()=>{var o;return(o=r.current)==null?void 0:o.click()},disabled:t||!a,"aria-label":"Attach image",title:a?"附加图片":"当前模型不支持图片",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-fg-5 transition-colors duration-150 hover:text-fg-3 disabled:cursor-not-allowed disabled:text-fg-6/40",children:i.jsx(A3,{className:"h-4 w-4"})})]})}function sT({attachments:e,error:t,onRemove:a,className:r}){return e.length===0&&!t?null:i.jsxs("div",{className:r,children:[e.length>0&&i.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:e.map(o=>i.jsxs("div",{className:"group relative",children:[i.jsx(tT,{url:o.url,label:o.filename??"attachment",className:"h-16 w-16 object-cover"}),i.jsx("button",{type:"button",onClick:()=>a(o._id),"aria-label":"Remove attachment",className:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-line bg-term text-fg-4 opacity-0 transition-opacity duration-150 hover:text-fg-2 group-hover:opacity-100",children:i.jsx(gt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]},o._id))}),t&&i.jsx("div",{className:"mb-2 font-mono text-[11px] text-red-400",children:t})]})}function rT({isListening:e,disabled:t,onStart:a,onStop:r}){const o=T.useRef(!1),u=f=>{if(t)return;f.preventDefault(),o.current=!0,a();const m=()=>{document.removeEventListener("touchend",m),document.removeEventListener("touchcancel",m),o.current=!1,r()};document.addEventListener("touchend",m,{once:!0}),document.addEventListener("touchcancel",m,{once:!0})},c=()=>{if(t||o.current)return;a();const f=()=>{document.removeEventListener("mouseup",f),r()};document.addEventListener("mouseup",f,{once:!0})};return i.jsx("button",{type:"button",disabled:t,onTouchStart:u,onMouseDown:c,onContextMenu:f=>f.preventDefault(),"aria-label":"按住说话",title:"按住说话",style:{WebkitTouchCallout:"none"},className:ae("flex shrink-0 select-none touch-none items-center justify-center transition-colors duration-150 disabled:cursor-not-allowed disabled:text-fg-6/40","order-first self-stretch w-12 rounded-xl sm:order-none sm:self-auto sm:h-7 sm:w-7 sm:rounded-md",e?"bg-red-500/15 text-red-400 hover:bg-red-500/25":"text-fg-5 hover:text-fg-3"),children:i.jsx(B3,{className:ae("h-6 w-6 sm:h-4 sm:w-4",e&&"animate-pulse")})})}const C6=[.85,1.25,.65,1.4,.75,1.15,.95],Fm=4,B1=24;function w6(e){const t=Math.floor(e/60).toString().padStart(2,"0"),a=Math.floor(e%60).toString().padStart(2,"0");return`${t}:${a}`}function k6({volumeLevel:e}){const t=Math.min(Math.max(e,0),1);return i.jsx("div",{className:"flex h-6 items-center gap-1","aria-hidden":"true",children:C6.map((a,r)=>{const o=Fm+t*a*(B1-Fm),u=Math.max(Fm,Math.min(B1,o));return i.jsx("span",{className:"w-1 rounded-full bg-red-400 transition-[height] duration-150 ease-out",style:{height:`${u}px`}},r)})})}function iT({phase:e,transcript:t,interimTranscript:a,editText:r,onEditTextChange:o,onTextareaKeyDown:u,textareaRef:c,wrapperClassName:f}){if(e==="idle")return null;const m=t.length>0||a.length>0;return i.jsx("div",{className:f,children:i.jsxs("div",{className:"max-h-[40vh] overflow-y-auto px-4 py-4",children:[e==="recording"&&i.jsx("div",{className:"text-xl leading-relaxed",children:m?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-fg",children:t}),a&&i.jsx("span",{className:"text-fg-4",children:a})]}):i.jsx("span",{className:"italic text-fg-5",children:"正在聆听…"})}),e==="recognizing"&&i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ln,{className:"h-5 w-5 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-sm text-emerald-400",children:"识别中…"}),a&&i.jsx("span",{className:"truncate text-base text-fg-4",children:a})]}),e==="done"&&i.jsx("textarea",{ref:c,value:r,onChange:h=>o(h.target.value),onKeyDown:u,rows:2,placeholder:"识别结果(可编辑)",className:"w-full resize-none bg-transparent text-xl leading-relaxed text-fg placeholder:text-fg-5 focus:outline-none"})]})})}function lT({phase:e,volumeLevel:t,elapsed:a,editText:r,error:o,onCancel:u,onConfirm:c,idleHint:f,className:m}){return e==="idle"?i.jsx("div",{className:m,children:o?i.jsx("span",{className:"font-mono text-[10px] text-red-400",children:o}):f?i.jsx("span",{className:"font-mono text-[10px] text-fg-6",children:f}):null}):e==="done"?i.jsxs("div",{className:m,children:[i.jsx("span",{className:"hidden font-mono text-[10px] text-fg-6 sm:inline",children:"⌘/Ctrl+⏎ 发送 · Esc 取消"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:u,className:"rounded-md border border-line px-3 py-1 text-xs text-fg-3 transition-colors hover:bg-elevated hover:text-fg",children:"取消"}),i.jsxs("button",{type:"button",onClick:c,disabled:r.trim().length===0,"aria-label":"发送",className:"flex items-center gap-1.5 rounded-md bg-emerald-600 px-3 py-1 text-xs font-medium text-white transition-colors hover:bg-emerald-500 disabled:cursor-not-allowed disabled:bg-fg-6/30 disabled:text-fg-5",children:[i.jsx(Eo,{className:"h-3.5 w-3.5",strokeWidth:2.5}),i.jsx("span",{children:"发送"})]})]})]}):i.jsx("div",{className:m,children:e==="recording"?i.jsxs(i.Fragment,{children:[i.jsx(k6,{volumeLevel:t}),i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[11px] font-medium text-red-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-red-400"}),"录音中"]}),i.jsx("span",{className:"font-mono text-[11px] tabular-nums text-fg-4",children:w6(a)})]}):i.jsxs(i.Fragment,{children:[i.jsx(ln,{className:"h-4 w-4 shrink-0 text-emerald-400 fs-spin"}),i.jsx("span",{className:"font-mono text-[11px] text-emerald-400",children:"识别中…"})]})})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var Ki;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Ki||(Ki={}));class zm extends Error{constructor(t,a,r){super(t),this.message=t,this.code=a,this.data=r}}const R6=e=>{var t,a;return e!=null&&e.androidBridge?"android":!((a=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||a===void 0)&&a.bridge?"ios":"web"},O6=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},r=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:R6(e),u=()=>o()!=="web",c=g=>{const y=h.get(g);return!!(y!=null&&y.platforms.has(o())||f(g))},f=g=>{var y;return(y=a.PluginHeaders)===null||y===void 0?void 0:y.find(N=>N.name===g)},m=g=>e.console.error(g),h=new Map,b=(g,y={})=>{const N=h.get(g);if(N)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),N.proxy;const v=o(),S=f(g);let C;const A=async()=>(!C&&v in y?C=typeof y[v]=="function"?C=await y[v]():C=y[v]:t!==null&&!C&&"web"in y&&(C=typeof y.web=="function"?C=await y.web():C=y.web),C),O=(Z,K)=>{var M,ne;if(S){const le=S==null?void 0:S.methods.find(te=>K===te.name);if(le)return le.rtype==="promise"?te=>a.nativePromise(g,K.toString(),te):(te,Y)=>a.nativeCallback(g,K.toString(),te,Y);if(Z)return(M=Z[K])===null||M===void 0?void 0:M.bind(Z)}else{if(Z)return(ne=Z[K])===null||ne===void 0?void 0:ne.bind(Z);throw new zm(`"${g}" plugin is not implemented on ${v}`,Ki.Unimplemented)}},k=Z=>{let K;const M=(...ne)=>{const le=A().then(te=>{const Y=O(te,Z);if(Y){const j=Y(...ne);return K=j==null?void 0:j.remove,j}else throw new zm(`"${g}.${Z}()" is not implemented on ${v}`,Ki.Unimplemented)});return Z==="addListener"&&(le.remove=async()=>K()),le};return M.toString=()=>`${Z.toString()}() { [capacitor code] }`,Object.defineProperty(M,"name",{value:Z,writable:!1,configurable:!1}),M},B=k("addListener"),R=k("removeListener"),H=(Z,K)=>{const M=B({eventName:Z},K),ne=async()=>{const te=await M;R({eventName:Z,callbackId:te},K)},le=new Promise(te=>M.then(()=>te({remove:ne})));return le.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ne()},le},q=new Proxy({},{get(Z,K){switch(K){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return S?H:B;case"removeListener":return R;default:return k(K)}}});return r[g]=q,h.set(g,{name:g,proxy:q,platforms:new Set([...Object.keys(y),...S?[v]:[]])}),q};return a.convertFileSrc||(a.convertFileSrc=g=>g),a.getPlatform=o,a.handleError=m,a.isNativePlatform=u,a.isPluginAvailable=c,a.registerPlugin=b,a.Exception=zm,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},I6=e=>e.Capacitor=O6(e),Dc=I6(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Po=Dc.registerPlugin;class hp{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,a){let r=!1;this.listeners[t]||(this.listeners[t]=[],r=!0),this.listeners[t].push(a);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),r&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,a);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,a,r){const o=this.listeners[t];if(!o){if(r){let u=this.retainedEventArguments[t];u||(u=[]),u.push(a),this.retainedEventArguments[t]=u}return}o.forEach(u=>u(a))}hasListeners(t){var a;return!!(!((a=this.listeners[t])===null||a===void 0)&&a.length)}registerWindowListener(t,a){this.windowListeners[a]={registered:!1,windowEventName:t,pluginEventName:a,handler:r=>{this.notifyListeners(a,r)}}}unimplemented(t="not implemented"){return new Dc.Exception(t,Ki.Unimplemented)}unavailable(t="not available"){return new Dc.Exception(t,Ki.Unavailable)}async removeListener(t,a){const r=this.listeners[t];if(!r)return;const o=r.indexOf(a);this.listeners[t].splice(o,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const a=this.retainedEventArguments[t];a&&(delete this.retainedEventArguments[t],a.forEach(r=>{this.notifyListeners(t,r)}))}}const P1=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),U1=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class M6 extends hp{async getCookies(){const t=document.cookie,a={};return t.split(";").forEach(r=>{if(r.length<=0)return;let[o,u]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=U1(o).trim(),u=U1(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=P1(t.key),r=P1(t.value),o=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${a}=${r||""}${o}; path=${u}; ${c};`}catch(a){return Promise.reject(a)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(a){return Promise.reject(a)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const a of t)document.cookie=a.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}Po("CapacitorCookies",{web:()=>new M6});const D6=async e=>new Promise((t,a)=>{const r=new FileReader;r.onload=()=>{const o=r.result;t(o.indexOf(",")>=0?o.split(",")[1]:o)},r.onerror=o=>a(o),r.readAsDataURL(e)}),L6=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,c)=>(o[u]=e[t[c]],o),{})},j6=(e,t=!0)=>e?Object.entries(e).reduce((r,o)=>{const[u,c]=o;let f,m;return Array.isArray(c)?(m="",c.forEach(h=>{f=t?encodeURIComponent(h):h,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=t?encodeURIComponent(c):c,m=`${u}=${f}`),`${r}&${m}`},"").substr(1):null,B6=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=L6(e.headers)["content-type"]||"";if(typeof e.data=="string")a.body=e.data;else if(o.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);a.body=u.toString()}else if(o.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,m)=>{u.append(m,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);a.body=u;const c=new Headers(a.headers);c.delete("content-type"),a.headers=c}else(o.includes("application/json")||typeof e.data=="object")&&(a.body=JSON.stringify(e.data));return a};class P6 extends hp{async request(t){const a=B6(t,t.webFetchExtra),r=j6(t.params,t.shouldEncodeUrlParams),o=r?`${t.url}?${r}`:t.url,u=await fetch(o,a),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?t:{};c.includes("application/json")&&(f="json");let m,h;switch(f){case"arraybuffer":case"blob":h=await u.blob(),m=await D6(h);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const b={};return u.headers.forEach((g,y)=>{b[y]=g}),{data:m,headers:b,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}Po("CapacitorHttp",{web:()=>new P6});var H1;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(H1||(H1={}));var F1;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(F1||(F1={}));class U6 extends hp{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}Po("SystemBars",{web:()=>new U6});const H6="modulepreload",F6=function(e){return"/"+e},z1={},z6=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let c=function(h){return Promise.all(h.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=c(a.map(h=>{if(h=F6(h),h in z1)return;z1[h]=!0;const b=h.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const y=document.createElement("link");if(y.rel=b?"stylesheet":H6,b||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),b)return new Promise((N,v)=>{y.addEventListener("load",N),y.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return o.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},Li=Po("SpeechRecognition",{web:()=>z6(()=>import("./web-DKFB8L_6.js"),[]).then(e=>new e.SpeechRecognitionWeb)});function $6(e,t){const a=e.length,r=new ArrayBuffer(44+a*2),o=new DataView(r),u=(c,f)=>{for(let m=0;m<f.length;m++)o.setUint8(c+m,f.charCodeAt(m))};u(0,"RIFF"),o.setUint32(4,36+a*2,!0),u(8,"WAVE"),u(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,t,!0),o.setUint32(28,t*2,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),u(36,"data"),o.setUint32(40,a*2,!0);for(let c=0;c<a;c++){const f=Math.max(-1,Math.min(1,e[c]));o.setInt16(44+c*2,f<0?f*32768:f*32767,!0)}return new Blob([r],{type:"audio/wav"})}const Eh=Dc.isNativePlatform(),$m=!Eh&&typeof window<"u"?window.SpeechRecognition??window.webkitSpeechRecognition:void 0,qm=16e3;function q6(e="zh-CN"){const[t,a]=T.useState(!1),[r,o]=T.useState(""),[u,c]=T.useState(""),[f,m]=T.useState(null),[h,b]=T.useState(0),[g,y]=T.useState("idle"),N=T.useRef(null),v=T.useRef(!1),S=T.useRef([]),C=T.useRef(!1),A=T.useRef(null),O=T.useRef(!1),k=T.useRef(null),B=T.useRef(null),R=T.useRef(null),H=T.useRef([]),q=T.useRef(!1),Z=!0,K=T.useCallback(async()=>{var oe,L,Ne;(oe=R.current)==null||oe.disconnect(),(L=B.current)==null||L.getTracks().forEach(Te=>Te.stop()),await((Ne=k.current)==null?void 0:Ne.close().catch(()=>{}));const D=H.current;if(H.current=[],R.current=null,B.current=null,k.current=null,D.length===0||q.current){a(!1),y("idle");return}c("识别中…"),y("recognizing");const F=D.reduce((Te,X)=>Te+X.length,0),U=new Float32Array(F);let J=0;for(const Te of D)U.set(Te,J),J+=Te.length;const I=$6(U,qm),$=new FormData;$.append("audio",I,"recording.wav");try{const Te=await fetch("/api/transcribe",{method:"POST",body:$});if(q.current)return;if(Te.ok){const{text:X}=await Te.json();X?(o(X),y("done")):y("idle")}else{const X=await Te.json().catch(()=>({error:`HTTP ${Te.status}`}));m(X.error??`HTTP ${Te.status}`),y("idle")}}catch(Te){m(`语音识别失败:${Te instanceof Error?Te.message:String(Te)}`),y("idle")}finally{c(""),a(!1)}},[]),M=T.useCallback(async()=>{if(v.current=!0,A.current&&(clearTimeout(A.current),A.current=null),Eh){await Li.stop().catch(()=>{});for(const D of S.current)await D.remove().catch(()=>{});S.current=[],a(!1),c("")}else N.current?N.current.stop():k.current?await K():(a(!1),y("idle"))},[K]),ne=T.useCallback(async()=>{var J;q.current=!1,o(""),c(""),m(null),y("idle");const{available:D}=await Li.available();if(!D){m("当前设备不支持语音识别");return}if((await Li.requestPermissions()).speechRecognition!=="granted"){m("请允许语音识别权限");return}const U=[];U.push(await Li.addListener("partialResults",I=>{c(I.matches[0]??"")})),U.push(await Li.addListener("listeningState",I=>{const $=I.status==="started";a($),$&&y("recording"),$||c("")})),S.current=U;try{const I=await Li.start({language:e,partialResults:!0,maxResults:1});(J=I.matches)!=null&&J.length&&o($=>$+I.matches.join(""))}catch(I){m(`语音识别错误:${I instanceof Error?I.message:String(I)}`);for(const $ of U)await $.remove().catch(()=>{});S.current=[]}},[e]),le=T.useCallback(()=>{if(!$m)return!1;q.current=!1,o(""),c(""),m(null),y("idle"),v.current=!1;const D=new $m;D.lang=e,D.continuous=!0,D.interimResults=!0,D.maxAlternatives=1,D.onstart=()=>{a(!0),y("recording"),C.current=!1,A.current=setTimeout(()=>{!C.current&&!v.current&&(O.current=!0,v.current=!0,D.stop(),m("语音识别服务不可用(Chrome/Edge 需连接 Google 服务器),下次将使用服务端识别"))},5e3)},D.onresult=F=>{C.current=!0,A.current&&(clearTimeout(A.current),A.current=null);let U="",J="";for(let I=F.resultIndex;I<F.results.length;I++){const $=F.results[I][0].transcript;F.results[I].isFinal?U+=$:J+=$}U&&o(I=>I+U),c(J)},D.onerror=F=>{switch(F.error!=="no-speech"&&F.error!=="aborted"&&(v.current=!0),F.error){case"not-allowed":m("请允许麦克风权限");break;case"network":m("网络错误,请检查连接");break;case"no-speech":case"aborted":return;default:m(`语音识别错误:${F.error}`)}},D.onend=()=>{if(c(""),!v.current)try{D.start();return}catch{}a(!1),N.current=null},N.current=D;try{return D.start(),!0}catch{return!1}},[e]),te=T.useCallback(async()=>{q.current=!1,o(""),c(""),m(null),y("idle");try{const I=await fetch("/api/transcribe/status"),{available:$}=await I.json();if(!$){m("语音识别服务未就绪,请稍后重试");return}}catch{m("无法连接语音识别服务");return}let D;try{D=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:qm,channelCount:1}})}catch{m("请允许麦克风权限");return}const F=new AudioContext({sampleRate:qm}),U=F.createMediaStreamSource(D),J=F.createScriptProcessor(4096,1,1);H.current=[],J.onaudioprocess=I=>{H.current.push(new Float32Array(I.inputBuffer.getChannelData(0)))},U.connect(J),J.connect(F.destination),k.current=F,B.current=D,R.current=J,a(!0),y("recording")},[]),Y=T.useCallback(()=>{Eh?ne():$m&&!O.current&&le()||te()},[ne,le,te]);T.useEffect(()=>{if(!t){b(0);return}if(N.current)return;let D=!1,F=null,U=null,J=0;return(async()=>{try{if(F=await navigator.mediaDevices.getUserMedia({audio:!0}),D){F.getTracks().forEach(Te=>Te.stop());return}U=new AudioContext;const I=U.createMediaStreamSource(F),$=U.createAnalyser();$.fftSize=256,I.connect($);const oe=new Uint8Array($.frequencyBinCount);let L=0;const Ne=()=>{if(D)return;$.getByteFrequencyData(oe);const Te=performance.now();if(Te-L>80){let X=0;for(let ve=0;ve<oe.length;ve++)X+=oe[ve];b(X/(oe.length*255)),L=Te}J=requestAnimationFrame(Ne)};J=requestAnimationFrame(Ne)}catch{}})(),()=>{D=!0,cancelAnimationFrame(J),F==null||F.getTracks().forEach(I=>I.stop()),U==null||U.close().catch(()=>{}),b(0)}},[t]),T.useEffect(()=>{!t&&g==="recording"&&y(r?"done":"idle")},[t,g,r]),T.useEffect(()=>()=>{var D,F,U,J;v.current=!0,(D=N.current)==null||D.stop(),(F=R.current)==null||F.disconnect(),(U=B.current)==null||U.getTracks().forEach(I=>I.stop()),(J=k.current)==null||J.close().catch(()=>{});for(const I of S.current)I.remove().catch(()=>{})},[]);const j=T.useCallback(()=>{q.current=!0,o(""),c(""),y("idle")},[]);return{isSupported:Z,isListening:t,phase:g,transcript:r,interimTranscript:u,error:f,volumeLevel:h,start:Y,stop:M,resetTranscript:j}}const Y6=240,G6=1e3;function oT(e){const t=q6(),[a,r]=T.useState(""),[o,u]=T.useState(0),c=T.useRef(null),f=T.useRef(null),m=T.useRef(0);T.useEffect(()=>(t.phase==="recording"?(m.current=Date.now(),u(0),f.current=setInterval(()=>{u(Math.floor((Date.now()-m.current)/1e3))},G6)):f.current&&(clearInterval(f.current),f.current=null),()=>{f.current&&(clearInterval(f.current),f.current=null)}),[t.phase]),T.useEffect(()=>{t.phase==="done"&&(r(t.transcript),requestAnimationFrame(()=>{const y=c.current;y&&(y.focus(),y.setSelectionRange(y.value.length,y.value.length))}))},[t.phase,t.transcript]),T.useLayoutEffect(()=>{if(t.phase!=="done")return;const y=c.current;y&&(y.style.height="auto",y.style.height=`${Math.min(y.scrollHeight,Y6)}px`)},[t.phase,a]);const h=T.useCallback(()=>{t.stop(),t.resetTranscript(),r("")},[t]),b=T.useCallback(async()=>{const y=a.trim();if(!y){h();return}await e(y)!==!1&&(t.resetTranscript(),r(""))},[a,e,h,t]);T.useEffect(()=>{if(t.phase==="idle")return;const y=N=>{if(N.key==="Escape"&&t.phase!=="recognizing"){N.preventDefault(),h();return}if(t.phase==="done"&&N.key==="Enter"&&(N.metaKey||N.ctrlKey)){if(N.isComposing)return;N.preventDefault(),b()}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t.phase,h,b]);const g=T.useCallback(y=>{y.nativeEvent.isComposing||y.keyCode===229||y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),b())},[b]);return{stt:t,editText:a,setEditText:r,elapsed:o,textareaRef:c,cancel:h,confirm:b,handleTextareaKeyDown:g}}const or=es(e=>({agents:[],loaded:!1,loadAgents:async()=>{const t=je.getState().activeRepoId;try{const a=t?await Ly(t):await Iy();e({agents:a,loaded:!0})}catch{e({loaded:!0})}}}));function K6(e){if(typeof e!="string")return e;const t=e.trim();if(t)try{return JSON.parse(t)}catch{return t}}function pn(e){return e&&typeof e=="object"?e:null}function Kr(e){const t=pn(e);return t&&"properties"in t?t.properties:e}function V6(e){const t=pn(e);return typeof(t==null?void 0:t.type)=="string"?t.type:void 0}function X6(e){const t=pn(Kr(e));if(!t)return null;const a=pn(t.info);if(a&&typeof a.id=="string"){const o=Array.isArray(t.parts)?t.parts:void 0;return{...a,...o?{parts:o}:{}}}if(typeof t.id=="string"&&typeof t.role=="string")return t;const r=pn(t.message);return r&&typeof r.id=="string"?r:null}function Q6(e){const t=pn(Kr(e));if(!t)return{};const a=pn(t.part)??t;return typeof a.type!="string"?{}:{messageId:typeof a.messageID=="string"&&a.messageID||typeof a.messageId=="string"&&a.messageId||typeof t.messageID=="string"&&t.messageID||typeof t.messageId=="string"&&t.messageId||void 0,part:a}}function W6(e){const t=pn(Kr(e));if(!t||t.field!=="text")return null;const a=typeof t.messageID=="string"?t.messageID:null,r=typeof t.partID=="string"?t.partID:null,o=typeof t.delta=="string"?t.delta:null;return!a||!r||o===null?null:{messageId:a,partId:r,delta:o}}function Z6(e){const t=Kr(e);if(Array.isArray(t))return t;const a=pn(t);return a&&Array.isArray(a.todos)?a.todos:[]}function Xa(e){return typeof e=="number"?e:0}function J6(e){const t=pn(Kr(e));if(!t||typeof t.id!="string")return null;const a={id:t.id};typeof t.title=="string"&&(a.title=t.title),typeof t.agent=="string"&&(a.agent=t.agent),typeof t.cost=="number"&&(a.cost=t.cost);const r=typeof t.parentID=="string"?t.parentID:typeof t.parent_id=="string"?t.parent_id:void 0;r&&(a.parentID=r);const o=pn(t.tokens),u=typeof t.tokens_input=="number"||typeof t.tokens_output=="number";if(o||u){const f=o?pn(o.cache):null;a.tokens={input:Xa(o==null?void 0:o.input)||Xa(t.tokens_input),output:Xa(o==null?void 0:o.output)||Xa(t.tokens_output),reasoning:Xa(o==null?void 0:o.reasoning)||Xa(t.tokens_reasoning),cache:{read:Xa(f==null?void 0:f.read)||Xa(t.tokens_cache_read),write:Xa(f==null?void 0:f.write)||Xa(t.tokens_cache_write)}}}const c=pn(t.model);return c&&(a.model={providerID:typeof c.providerID=="string"?c.providerID:void 0,modelID:typeof c.modelID=="string"?c.modelID:void 0,variant:typeof c.variant=="string"?c.variant:void 0}),a}function eM(e){const t=pn(Kr(e));if(!t)return null;if(typeof t.message=="string")return t.message;const a=pn(t.error);if(a){const r=pn(a.data);if(typeof(r==null?void 0:r.message)=="string")return`${a.name??"Error"}: ${r.message}`;if(typeof a.message=="string")return`${a.name??"Error"}: ${a.message}`;if(typeof a.name=="string")return String(a.name)}return typeof t.reason=="string"?t.reason:null}function tM(e){const t=Kr(e);if(typeof t=="string")return t;const a=pn(t);if(typeof(a==null?void 0:a.status)=="string")return a.status;const r=pn(a==null?void 0:a.status);return typeof(r==null?void 0:r.type)=="string"?r.type:typeof(a==null?void 0:a.type)=="string"?a.type:null}function nM(e,t,a,r){switch(e==="message"||e===""?V6(t)??e:e){case"message.updated":{const u=X6(t);u&&r.updateMessage(a,u);break}case"session.updated":{const u=J6(t);u&&r.updateSessionInfo(u);break}case"message.part.updated":{const{messageId:u,part:c}=Q6(t);c&&u&&r.updateMessagePart(a,u,c);break}case"message.part.delta":{const u=W6(t);u&&r.appendMessagePartDelta(a,u.messageId,u.partId,u.delta);break}case"todo.updated":{r.updateTodos(a,Z6(t));break}case"session.status":{const u=tM(t);u&&r.setSessionStatus(a,u);break}case"session.idle":{r.setSessionStatus(a,"idle");break}case"session.error":{const u=eM(t);r.setSessionStatus(a,"error",u??void 0);break}}}const aM=600*1e3;class sM{constructor(t,a){sn(this,"sessionId");sn(this,"idleTimer",null);sn(this,"active",!1);sn(this,"alive",!0);sn(this,"callbacks");this.sessionId=t,this.callbacks=a,this.resetIdleTimer()}dispatch(t,a){if(!this.alive)return;this.resetIdleTimer();const r=Re.getState();nM(t,a,this.sessionId,r)}activate(){this.active=!0,this.clearIdleTimer()}deactivate(){this.active=!1,this.resetIdleTimer()}refreshOnIdle(){Re.getState().refreshSessionData(this.sessionId)}stop(){this.alive=!1,this.clearIdleTimer()}resetIdleTimer(){this.clearIdleTimer(),!this.active&&(this.idleTimer=setTimeout(()=>{this.callbacks.onWorkerIdle(this.sessionId)},aM))}clearIdleTimer(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}}const rM=1e3,iM=3e4;class lM{constructor(t,a){sn(this,"source",null);sn(this,"reconnectTimer",null);sn(this,"attempts",0);sn(this,"disposed",!1);sn(this,"repoId");sn(this,"onEvent");this.repoId=t,this.onEvent=a}start(){this.connect()}stop(){var t;this.disposed=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.source)==null||t.close(),this.source=null}connect(){if(this.disposed)return;const t=kw(this.repoId),a=new EventSource(t);this.source=a,a.onopen=()=>{this.attempts=0},a.onmessage=o=>{this.handleRaw("message",o)};const r=["message.updated","message.part.updated","message.part.delta","message.removed","todo.updated","session.status","session.idle","session.error","session.updated"];for(const o of r)a.addEventListener(o,u=>{this.handleRaw(o,u)});a.onerror=()=>{if(!(this.disposed||!this.source)&&this.source.readyState===EventSource.CLOSED){this.source.close(),this.source=null;const o=Math.min(rM*2**this.attempts,iM);this.attempts++,this.reconnectTimer=setTimeout(()=>this.connect(),o)}}}handleRaw(t,a){if(!(a instanceof MessageEvent))return;const r=K6(a.data);if(r===void 0)return;const o=this.extractSessionId(r);if(!o)return;let u=t;if(t==="message"||t===""){const c=r&&typeof r=="object"?r:null;typeof(c==null?void 0:c.type)=="string"&&(u=c.type)}this.onEvent(o,u,r)}extractSessionId(t){if(!t||typeof t!="object")return null;const a=t;if(a.properties&&typeof a.properties=="object"){const r=a.properties;if(typeof r.sessionID=="string")return r.sessionID;if(typeof r.id=="string")return r.id}return typeof a.sessionID=="string"?a.sessionID:typeof a.sessionId=="string"?a.sessionId:null}}const oM=6e4;class uM{constructor(t){sn(this,"timer",null);sn(this,"paused",!1);sn(this,"callbacks");this.callbacks=t}start(){this.tick(),this.timer=setInterval(()=>{this.paused||this.tick()},oM)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null)}pause(){this.paused=!0}resume(){this.paused=!1,this.tick()}tick(){const t=je.getState().activeRepoId;t&&(Re.getState().loadSessions(),Rw(t).then(a=>{const r={};for(const[o,u]of Object.entries(a))r[o]=u.type??"idle";Re.getState().bulkSetStatuses(r);for(const[o,u]of Object.entries(r))(u==="busy"||u==="retry")&&this.callbacks.ensureWorker(o)}).catch(()=>{}))}}class cM{constructor(){sn(this,"workers",new Map);sn(this,"dispatcher",null);sn(this,"supervisor",null);sn(this,"visibilityHandler",null)}start(t){this.stop();const a={onWorkerIdle:r=>this.removeWorker(r)};this.dispatcher=new lM(t,(r,o,u)=>{const c=this.ensureWorker(r,a);if(o==="session.idle"||o==="session.status"){const f=Re.getState().sessionStatuses[r];c.dispatch(o,u);const m=Re.getState().sessionStatuses[r];f&&f!=="idle"&&m==="idle"&&c.refreshOnIdle()}else c.dispatch(o,u)}),this.dispatcher.start(),this.supervisor=new uM({ensureWorker:r=>this.ensureWorker(r,a)}),this.supervisor.start(),this.visibilityHandler=()=>{var r,o;document.hidden?(r=this.supervisor)==null||r.pause():(o=this.supervisor)==null||o.resume()},document.addEventListener("visibilitychange",this.visibilityHandler)}stop(){var t,a;(t=this.dispatcher)==null||t.stop(),this.dispatcher=null,(a=this.supervisor)==null||a.stop(),this.supervisor=null;for(const r of this.workers.values())r.stop();this.workers.clear(),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null)}activateSession(t){for(const o of this.workers.values())o.sessionId!==t&&o.deactivate();if(!t)return;const a={onWorkerIdle:o=>this.removeWorker(o)};this.ensureWorker(t,a).activate(),Re.getState().refreshSessionData(t)}deactivateSession(t){var a;(a=this.workers.get(t))==null||a.deactivate()}ensureWorker(t,a){let r=this.workers.get(t);return r||(r=new sM(t,a),this.workers.set(t,r)),r}removeWorker(t){const a=Re.getState().activeSessionId;if(t===a)return;const r=this.workers.get(t);r&&(r.stop(),this.workers.delete(t))}}const Lc=new cM,$1=(function(e,t,a){const r=Lo(a);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Vr=(function(e){if(e==null)return mM;if(typeof e=="string")return fM(e);if(typeof e=="object")return dM(e);if(typeof e=="function")return pp(e);throw new Error("Expected function, string, or array as `test`")});function dM(e){const t=[];let a=-1;for(;++a<e.length;)t[a]=Vr(e[a]);return pp(r);function r(...o){let u=-1;for(;++u<t.length;)if(t[u].apply(this,o))return!0;return!1}}function fM(e){return pp(t);function t(a){return a.tagName===e}}function pp(e){return t;function t(a,r,o){return!!(hM(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function mM(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function hM(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const q1=/\n/g,Y1=/[\t ]+/g,yh=Vr("br"),G1=Vr(TM),pM=Vr("p"),K1=Vr("tr"),gM=Vr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",NM,_M]),uT=Vr(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function bM(e,t){const a=t||{},r="children"in e?e.children:[],o=uT(e),u=fT(e,{whitespace:a.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...dT(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<r.length;)c.push(...cT(r[f],e,{whitespace:u,breakBefore:f?void 0:o,breakAfter:f<r.length-1?yh(r[f+1]):o}));const m=[];let h;for(f=-1;++f<c.length;){const b=c[f];typeof b=="number"?h!==void 0&&b>h&&(h=b):b&&(h!==void 0&&h>-1&&m.push(`
491
491
  `.repeat(h)||" "),h=-1,m.push(b))}return m.join("")}function cT(e,t,a){return e.type==="element"?xM(e,t,a):e.type==="text"?a.whitespace==="normal"?dT(e,a):EM(e):[]}function xM(e,t,a){const r=fT(e,a),o=e.children||[];let u=-1,c=[];if(gM(e))return c;let f,m;for(yh(e)||K1(e)&&$1(t,e,K1)?m=`
492
492
  `:pM(e)?(f=2,m=2):uT(e)&&(f=1,m=1);++u<o.length;)c=c.concat(cT(o[u],e,{whitespace:r,breakBefore:u?void 0:f,breakAfter:u<o.length-1?yh(o[u+1]):m}));return G1(e)&&$1(t,e,G1)&&c.push(" "),f&&c.unshift(f),m&&c.push(m),c}function dT(e,t){const a=String(e.value),r=[],o=[];let u=0;for(;u<=a.length;){q1.lastIndex=u;const m=q1.exec(a),h=m&&"index"in m?m.index:a.length;r.push(yM(a.slice(u,h).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),u===0?t.breakBefore:!0,h===a.length?t.breakAfter:!0)),u=h+1}let c=-1,f;for(;++c<r.length;)r[c].charCodeAt(r[c].length-1)===8203||c<r.length-1&&r[c+1].charCodeAt(0)===8203?(o.push(r[c]),f=void 0):r[c]?(typeof f=="number"&&o.push(f),o.push(r[c]),f=0):(c===0||c===r.length-1)&&o.push(0);return o}function EM(e){return[String(e.value)]}function yM(e,t,a){const r=[];let o=0,u;for(;o<e.length;){Y1.lastIndex=o;const c=Y1.exec(e);u=c?c.index:e.length,!o&&!u&&c&&!t&&r.push(""),o!==u&&r.push(e.slice(o,u)),o=c?u+c[0].length:u}return o!==u&&!a&&r.push(""),r.join(" ")}function fT(e,t){if(e.type==="element"){const a=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return a.wrap?"pre-wrap":"pre";case"td":case"th":return a.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function NM(e){return!!(e.properties||{}).hidden}function TM(e){return e.tagName==="td"||e.tagName==="th"}function _M(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function vM(e){const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",c="(?!struct)("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},h={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},b={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(h,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},N=t.optional(o)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],S=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],A=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],B={type:S,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},R={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},H=[R,g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],q={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:B,contains:H.concat([{begin:/\(/,end:/\)/,keywords:B,contains:H.concat(["self"]),relevance:0}]),relevance:0},Z={className:"function",begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:B,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:B,relevance:0},{begin:N,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[h,b]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:B,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:B,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,h,b,f]}]},f,a,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:B,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(q,Z,R,H,[g,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:B,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:B},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function SM(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},a=vM(e),r=a.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,a.name="Arduino",a.aliases=["ino"],a.supersetOf="cpp",a}function AM(e){const t=e.regex,a={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[a]}]};Object.assign(a,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},u=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},f={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,a,o]};o.contains.push(f);const m={match:/\\"/},h={className:"string",begin:/'/,end:/'/},b={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,a]},y=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],N=e.SHEBANG({binary:`(${y.join("|")})`,relevance:10}),v={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},S=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],C=["true","false"],A={match:/(\/[a-z._-]+)+/},O=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],k=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],B=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],R=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:S,literal:C,built_in:[...O,...k,"set","shopt",...B,...R]},contains:[N,e.SHEBANG(),v,g,u,c,A,f,m,h,b,a]}}function CM(e){const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",c="("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},h={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},b={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(h,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},N=t.optional(o)+e.IDENT_RE+"\\s*\\(",C={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},A=[g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],O={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:C,contains:A.concat([{begin:/\(/,end:/\)/,keywords:C,contains:A.concat(["self"]),relevance:0}]),relevance:0},k={begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:C,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:C,relevance:0},{begin:N,returnBegin:!0,contains:[e.inherit(y,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,h,b,f]}]},f,a,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C",aliases:["h"],keywords:C,disableAutodetect:!0,illegal:"</",contains:[].concat(O,k,A,[g,{begin:e.IDENT_RE+"::",keywords:C},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:g,strings:h,keywords:C}}}function wM(e){const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",c="(?!struct)("+r+"|"+t.optional(o)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},h={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},b={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},g={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(h,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(o)+e.IDENT_RE,relevance:0},N=t.optional(o)+e.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],S=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],A=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],B={type:S,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},R={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},H=[R,g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],q={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:B,contains:H.concat([{begin:/\(/,end:/\)/,keywords:B,contains:H.concat(["self"]),relevance:0}]),relevance:0},Z={className:"function",begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:B,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:B,relevance:0},{begin:N,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[h,b]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:B,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:B,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,h,b,f]}]},f,a,e.C_BLOCK_COMMENT_MODE,g]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:B,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(q,Z,R,H,[g,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:B,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:B},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function kM(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],a=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],o=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],u=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],c={keyword:o.concat(u),built_in:t,literal:r},f=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),m={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},b={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},g=e.inherit(b,{illegal:/\n/}),y={className:"subst",begin:/\{/,end:/\}/,keywords:c},N=e.inherit(y,{illegal:/\n/}),v={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,N]},S={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]},C=e.inherit(S,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},N]});y.contains=[S,v,b,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,e.C_BLOCK_COMMENT_MODE],N.contains=[C,v,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const A={variants:[h,S,v,b,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},O={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},k=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",B={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:c,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},A,m,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},f,O,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,O,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+k+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:c,contains:[{beginKeywords:a.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,O],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,relevance:0,contains:[A,m,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},B]}}const RM=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),OM=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],IM=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],MM=[...OM,...IM],DM=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),LM=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),jM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),BM=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function PM(e){const t=e.regex,a=RM(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},o="and or not only",u=/@-?\w[\w]*(-\w+)*/,c="[a-zA-Z-][a-zA-Z0-9_-]*",f=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[a.BLOCK_COMMENT,r,a.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+c,relevance:0},a.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+LM.join("|")+")"},{begin:":(:)?("+jM.join("|")+")"}]},a.CSS_VARIABLE,{className:"attribute",begin:"\\b("+BM.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[a.BLOCK_COMMENT,a.HEXCOLOR,a.IMPORTANT,a.CSS_NUMBER_MODE,...f,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...f,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},a.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:u},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:DM.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...f,a.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+MM.join("|")+")\\b"}]}}function UM(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function HM(e){const u={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:u,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:u,illegal:/["']/}]}]}}function FM(e){const t=e.regex,a=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(a,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function zM(e){const t=e.regex,a={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const o={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},u={className:"literal",begin:/\bon|off|true|false|yes|no\b/},c={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},f={begin:/\[/,end:/\]/,contains:[r,u,o,c,a,"self"],relevance:0},m=/[A-Za-z0-9_-]+/,h=/"(\\"|[^"])*"/,b=/'[^']*'/,g=t.either(m,h,b),y=t.concat(g,"(\\s*\\.\\s*",g,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:y,className:"attr",starts:{end:/$/,contains:[r,f,u,o,c,a]}}]}}var Bi="[0-9](_*[0-9])*",uc=`\\.(${Bi})`,cc="[0-9a-fA-F](_*[0-9a-fA-F])*",V1={className:"number",variants:[{begin:`(\\b(${Bi})((${uc})|\\.)?|(${uc}))[eE][+-]?(${Bi})[fFdD]?\\b`},{begin:`\\b(${Bi})((${uc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${uc})[fFdD]?\\b`},{begin:`\\b(${Bi})[fFdD]\\b`},{begin:`\\b0[xX]((${cc})\\.?|(${cc})?\\.(${cc}))[pP][+-]?(${Bi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${cc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function mT(e,t,a){return a===-1?"":e.replace(t,r=>mT(e,t,a-1))}function $M(e){const t=e.regex,a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=a+mT("(?:<"+a+"~~~(?:\\s*,\\s*"+a+"~~~)*>)?",/~~~/g,2),m={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},h={className:"meta",begin:"@"+a,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},b={className:"params",begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:m,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,a),/\s+/,a,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,a],className:{1:"keyword",3:"title.class"},contains:[b,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:m,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:[h,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,V1,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},V1,h]}}const X1="[A-Za-z$_][0-9A-Za-z$_]*",qM=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],YM=["true","false","null","undefined","NaN","Infinity"],hT=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],pT=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],gT=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],GM=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],KM=[].concat(gT,hT,pT);function VM(e){const t=e.regex,a=(U,{after:J})=>{const I="</"+U[0].slice(1);return U.input.indexOf(I,J)!==-1},r=X1,o={begin:"<>",end:"</>"},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(U,J)=>{const I=U[0].length+U.index,$=U.input[I];if($==="<"||$===","){J.ignoreMatch();return}$===">"&&(a(U,{after:I})||J.ignoreMatch());let oe;const L=U.input.substring(I);if(oe=L.match(/^\s*=/)){J.ignoreMatch();return}if((oe=L.match(/^\s+extends\s+/))&&oe.index===0){J.ignoreMatch();return}}},f={$pattern:X1,keyword:qM,literal:YM,built_in:KM,"variable.language":GM},m="[0-9](_?[0-9])*",h=`\\.(${m})`,b="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${b})((${h})|\\.)?|(${h}))[eE][+-]?(${m})\\b`},{begin:`\\b(${b})\\b((${h})\\b|\\.)?|(${h})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:f,contains:[]},N={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},S={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},O={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},k=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,N,v,S,C,{match:/\$\d+/},g];y.contains=k.concat({begin:/\{/,end:/\}/,keywords:f,contains:["self"].concat(k)});const B=[].concat(O,y.contains),R=B.concat([{begin:/(\s*)\(/,end:/\)/,keywords:f,contains:["self"].concat(B)}]),H={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:R},q={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},Z={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...hT,...pT]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[H],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function le(U){return t.concat("(?!",U.join("|"),")")}const te={match:t.concat(/\b/,le([...gT,"super","import"].map(U=>`${U}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},H]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",F={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[H]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:f,exports:{PARAMS_CONTAINS:R,CLASS_REFERENCE:Z},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,N,v,S,C,O,{match:/\$\d+/},g,Z,{scope:"attr",match:r+t.lookahead(":"),relevance:0},F,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[O,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:R}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:u},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[H,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[H]},te,ne,q,j,{match:/\$[(.]/}]}}function XM(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},a={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],o={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,a,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Pi="[0-9](_*[0-9])*",dc=`\\.(${Pi})`,fc="[0-9a-fA-F](_*[0-9a-fA-F])*",QM={className:"number",variants:[{begin:`(\\b(${Pi})((${dc})|\\.)?|(${dc}))[eE][+-]?(${Pi})[fFdD]?\\b`},{begin:`\\b(${Pi})((${dc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${dc})[fFdD]?\\b`},{begin:`\\b(${Pi})[fFdD]\\b`},{begin:`\\b0[xX]((${fc})\\.?|(${fc})?\\.(${fc}))[pP][+-]?(${Pi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${fc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function WM(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},a={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},u={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},c={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[u,o]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,u,o]}]};o.contains.push(c);const f={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},m={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(c,{className:"string"}),"self"]}]},h=QM,b=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),g={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},y=g;return y.variants[1].contains=[g],g.variants[1].contains=[y],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,b,a,r,f,m,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[g,e.C_LINE_COMMENT_MODE,b],relevance:0},e.C_LINE_COMMENT_MODE,b,f,m,c,e.C_NUMBER_MODE]},b]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},f,m]},c,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
493
493
  `},h]}}const ZM=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),JM=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],eD=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],tD=[...JM,...eD],nD=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),bT=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),xT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),aD=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),sD=bT.concat(xT).sort().reverse();function rD(e){const t=ZM(e),a=sD,r="and or not only",o="[\\w-]+",u="("+o+"|@\\{"+o+"\\})",c=[],f=[],m=function(k){return{className:"string",begin:"~?"+k+".*?"+k}},h=function(k,B,R){return{className:k,begin:B,relevance:R}},b={$pattern:/[a-z-]+/,keyword:r,attribute:nD.join(" ")},g={begin:"\\(",end:"\\)",contains:f,keywords:b,relevance:0};f.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m("'"),m('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,g,h("variable","@@?"+o,10),h("variable","@\\{"+o+"\\}"),h("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const y=f.concat({begin:/\{/,end:/\}/,contains:c}),N={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(f)},v={begin:u+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+aD.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:f}}]},S={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:b,returnEnd:!0,contains:f,relevance:0}},C={className:"variable",variants:[{begin:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:y}},A={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:u,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,N,h("keyword","all\\b"),h("variable","@\\{"+o+"\\}"),{begin:"\\b("+tD.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,h("selector-tag",u,0),h("selector-id","#"+u),h("selector-class","\\."+u,0),h("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+bT.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+xT.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:y},{begin:"!important"},t.FUNCTION_DISPATCH]},O={begin:o+`:(:)?(${a.join("|")})`,returnBegin:!0,contains:[A]};return c.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,S,C,O,v,A,N,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:c}}function iD(e){const t="\\[=*\\[",a="\\]=*\\]",r={begin:t,end:a,contains:["self"]},o=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,a,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:o.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:o}].concat(o)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:a,contains:[r],relevance:5}])}}function lD(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,a]},o={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},u={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},c={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,a,r,o,u,c]}}function oD(e){const t=e.regex,a={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},u={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},f=/[A-Za-z][A-Za-z0-9+.-]*/,m={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,f,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},h={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},b={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(h,{contains:[]}),y=e.inherit(b,{contains:[]});h.contains.push(y),b.contains.push(g);let N=[a,m];return[h,b,g,y].forEach(A=>{A.contains=A.contains.concat(N)}),N=N.concat(h,b),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:N},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:N}]}]},a,u,h,b,{className:"quote",begin:"^>\\s+",contains:N,end:"$"},o,r,m,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function uD(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},a=/[a-zA-Z@][a-zA-Z0-9_]*/,f={"variable.language":["this","super"],$pattern:a,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},m={$pattern:a,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:f,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+m.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:m,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function cD(e){const t=e.regex,a=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,o={$pattern:/[\w.]+/,keyword:a.join(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},c={begin:/->\{/,end:/\}/},f={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},m={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[f]},h={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},b=[e.BACKSLASH_ESCAPE,u,m],g=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],y=(S,C,A="\\1")=>{const O=A==="\\1"?A:t.concat(A,C);return t.concat(t.concat("(?:",S,")"),C,/(?:\\.|[^\\\/])*?/,O,/(?:\\.|[^\\\/])*?/,A,r)},N=(S,C,A)=>t.concat(t.concat("(?:",S,")"),C,/(?:\\.|[^\\\/])*?/,A,r),v=[m,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),c,{className:"string",contains:b,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},h,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:y("s|tr|y",t.either(...g,{capture:!0}))},{begin:y("s|tr|y","\\(","\\)")},{begin:y("s|tr|y","\\[","\\]")},{begin:y("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:N("(?:m|qr)?",/\//,/\//)},{begin:N("m|qr",t.either(...g,{capture:!0}),/\1/)},{begin:N("m|qr",/\(/,/\)/)},{begin:N("m|qr",/\[/,/\]/)},{begin:N("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,f]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,f,h]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=v,c.contains=v,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:v}}function dD(e){const t=e.regex,a=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,a),o=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,a),u=t.concat(/[A-Z]+/,a),c={scope:"variable",match:"\\$+"+r},f={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},m={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},h=e.inherit(e.APOS_STRING_MODE,{illegal:null}),b=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(m)}),g={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(m),"on:begin":(Y,j)=>{j.data._beginMatch=Y[1]||Y[2]},"on:end":(Y,j)=>{j.data._beginMatch!==Y[1]&&j.ignoreMatch()}},y=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),N=`[
@@ -1 +1 @@
1
- import{W as e}from"./index-AmddI40G.js";class t extends e{available(){throw this.unimplemented("Method not implemented on web.")}start(o){throw this.unimplemented("Method not implemented on web.")}stop(){throw this.unimplemented("Method not implemented on web.")}getSupportedLanguages(){throw this.unimplemented("Method not implemented on web.")}hasPermission(){throw this.unimplemented("Method not implemented on web.")}isListening(){throw this.unimplemented("Method not implemented on web.")}requestPermission(){throw this.unimplemented("Method not implemented on web.")}checkPermissions(){throw this.unimplemented("Method not implemented on web.")}requestPermissions(){throw this.unimplemented("Method not implemented on web.")}}const m=new t;export{m as SpeechRecognition,t as SpeechRecognitionWeb};
1
+ import{W as e}from"./index-DH3aMEyv.js";class t extends e{available(){throw this.unimplemented("Method not implemented on web.")}start(o){throw this.unimplemented("Method not implemented on web.")}stop(){throw this.unimplemented("Method not implemented on web.")}getSupportedLanguages(){throw this.unimplemented("Method not implemented on web.")}hasPermission(){throw this.unimplemented("Method not implemented on web.")}isListening(){throw this.unimplemented("Method not implemented on web.")}requestPermission(){throw this.unimplemented("Method not implemented on web.")}checkPermissions(){throw this.unimplemented("Method not implemented on web.")}requestPermissions(){throw this.unimplemented("Method not implemented on web.")}}const m=new t;export{m as SpeechRecognition,t as SpeechRecognitionWeb};
package/public/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover" />
6
6
  <title>Fourth Spark</title>
7
- <script type="module" crossorigin src="/assets/index-AmddI40G.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DH3aMEyv.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-DtMEEsX0.css">
9
9
  </head>
10
10
  <body>