fourth-spark 0.10.25 → 0.10.26

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": "a1a502b2-0020-4cde-82c8-4aa43cdfcd1d",
2
+ "id": "6286b1f6-0cb8-4a4e-bbb2-8295a7214315",
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": 1788136079587,
58
- "tag": "0007_known_genesis",
57
+ "when": 1788144831535,
58
+ "tag": "0007_kind_photon",
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.25",
3
+ "version": "0.10.26",
4
4
  "description": "AI Agent Platform — multi-repo agent management based on OpenCode",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -467,7 +467,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
467
467
  *
468
468
  * This source code is licensed under the ISC license.
469
469
  * See the LICENSE file in the root directory of this source tree.
470
- */const Mw=[["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"}]],Zc=ke("zap",Mw);function Dy(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=Dy(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=Dy(e))&&(r&&(r+=" "),r+=t);return r}const _x=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},Lw=(e=>e?_x(e):_x),Dw=e=>e;function jw(e,t=Dw){const a=rc.useSyncExternalStore(e.subscribe,rc.useCallback(()=>t(e.getState()),[e,t]),rc.useCallback(()=>t(e.getInitialState()),[e,t]));return rc.useDebugValue(a),a}const vx=e=>{const t=Lw(e),a=r=>jw(t,r);return Object.assign(a,t),a},es=(e=>e?vx(e):vx),_m="fs-theme";function jy(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Sx(e){return e==="system"?jy():e}function Ax(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const ih=es((e,t)=>({preference:localStorage.getItem(_m)??"system",resolved:Sx(localStorage.getItem(_m)??"system"),cycle(){const a=["system","light","dark"],r=a[(a.indexOf(t().preference)+1)%a.length],o=Sx(r);localStorage.setItem(_m,r),Ax(r),e({preference:r,resolved:o})},init(){Ax(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{const{preference:o}=t();if(o==="system"){const u=jy();e({resolved:u})}};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)}})),Cc="fourth-spark-server-url";function By(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function Qh(){return localStorage.getItem(Cc)??""}function Bw(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(Cc,t):localStorage.removeItem(Cc)}function lh(){return localStorage.getItem(Cc)??""}class Ss extends Error{constructor(a,r){super(a);ln(this,"status");this.name="ApiError",this.status=r}}async function Se(e,t){let a;try{a=await fetch(Qh()+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 ra(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 Pw(){return ra(await Se("/api/repos"),"repos")}async function Uw(e,t,a,r){return Se("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:r})})}async function Hw(e){return Se("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function Fw(e){await Se(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function zw(e){await Se(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function $w(e){await Se(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function qw(e){return Se(`/api/repos/${encodeURIComponent(e)}/branches`)}async function Yw(e,t){return Se(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function Gw(e){return Se(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ye(e){return`/api/repos/${encodeURIComponent(e)}`}async function Kw(e){return ra(await Se(`${Ye(e)}/workspaces`),"workspaces")}async function Vw(e,t){await Se(`${Ye(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Xw(e){return Se(`${Ye(e)}/workspaces/cleanup`,{method:"POST"})}async function Qw(e,t){await Se(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function Ww(e,t){await Se(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function Zw(e){return ra(await Se(`${Ye(e)}/sessions`),"sessions")}async function Jw(e,t,a,r,o,u,c,f){return Se(`${Ye(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:r,variant:o,issueId:u,customAgentId:c,files:f})})}async function e5(e,t){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function t5(e,t,a,r,o,u,c){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:r,model:o,variant:u,files:c})})}async function n5(e,t){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function a5(e,t,a){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function s5(e,t){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}async function r5(e,t,a){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({messageID:a})})}function wx(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 Cx(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=`${Ye(e)}/sessions/${encodeURIComponent(t)}/messages${o?`?${o}`:""}`,c=await Se(u);if(Array.isArray(c)){const h=c.map(wx);return{messages:h,total:h.length,hasMore:!1}}const f=c,m=Array.isArray(f.messages)?f.messages:[];return{messages:m.map(wx),total:f.total??m.length,hasMore:f.hasMore??!1}}async function i5(e,t){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/status`)}async function l5(e,t){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/links`)}async function o5(e,t){return Se(`${Ye(e)}/sessions/snapshot/${encodeURIComponent(t)}`)}async function Py(e){return Se(`${Ye(e)}/sessions/all-links`)}async function u5(e,t,a,r){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:r})})}async function c5(e,t,a,r){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:r})})}async function Uy(){return ra(await Se("/api/custom-agents"))}async function d5(e){return Se("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function f5(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Hy(e){await Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function kx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function m5(e){return Se("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function Fy(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 h5(e,t,a){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(a)})}async function p5(e,t){await Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"DELETE"})}async function g5(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/extract`,{method:"POST",body:JSON.stringify({sessionIds:t})})}async function Rx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/stats`)}async function b5(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/consolidate`,{method:"POST"})}async function Wh(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/sessions`)}async function zy(e){return ra(await Se(`${Ye(e)}/custom-agents`))}async function x5(e,t){return Se(`${Ye(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Io(e){return ra(await Se(`${Ye(e)}/models`))}async function $y(){return ra(await Se("/api/prompt-fragments"))}async function E5(e){return Se("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function y5(e,t){return Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function N5(e){await Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Ox(e){return ra(await Se(`${Ye(e)}/tags`))}async function Ix(e,t){return ra(await Se(`${Ye(e)}/milestones`))}async function Mx(e,t="open"){return ra(await Se(`${Ye(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function T5(e,t="all"){return Se(`${Ye(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function _5(e,t,a){return Se(`${Ye(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function v5(e,t,a){await Se(`${Ye(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function qy(e,t,a){return Se(`${Ye(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function S5(e,t){return ra(await Se(`${Ye(e)}/issues/${t}/pulls`))}async function Lx(e,t="open"){return ra(await Se(`${Ye(e)}/pulls?state=${encodeURIComponent(t)}`))}async function A5(e,t="all"){return Se(`${Ye(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function w5(e,t){return Se(`${Ye(e)}/pulls/${t}`)}async function C5(e,t){await Se(`${Ye(e)}/pulls/${t}/merge`,{method:"POST"})}async function Zh(e,t){return ra(await Se(`${Ye(e)}/pulls/${t}/issues`))}async function k5(e,t,a){await Se(`${Ye(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function R5(e,t,a){await Se(`${Ye(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function O5(e,t){return Se(`${Ye(e)}/pulls/${t}/comments`)}async function I5(e,t){return Se(`${Ye(e)}/issues/${t}/comments`)}async function Dx(e,t,a){return Se(`${Ye(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function M5(e,t,a){return Se(`${Ye(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function jx(e,t){return Se(`${Ye(e)}/issues/${t}/draft`)}async function L5(e,t,a){return Se(`${Ye(e)}/issues/polish-create`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Bx(e){return Se(`${Ye(e)}/issues/draft-create`)}async function D5(e){await Se(`${Ye(e)}/issues/draft-create`,{method:"DELETE"})}async function j5(e,t,a){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function B5(e,t,a){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function P5(){return Se("/api/agents-md")}async function U5(e){await Se("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function H5(e){return Se(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function F5(e,t){await Se(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function z5(e){return`${Qh()}${Ye(e)}/events`}async function $5(e){return Se(`${Ye(e)}/sessions/status`)}async function Mo(){return Se("/api/settings")}async function oh(e,t){await Se(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function uh(){return Se("/api/cloud/status")}async function q5(){return Se("/api/cloud/reload",{method:"POST"})}async function Y5(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 G5(){return ra(await Se("/api/git-hosts"),"gitHosts")}async function K5(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 V5(e){await Se(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Yy(){return Se("/api/usage")}async function Gy(e){return Se("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function X5(e,t="ios"){await Se("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}async function Q5(e,t){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/files`)}function W5(e,t,a){return`${Qh()}${Ye(e)}/sessions/${encodeURIComponent(t)}/files/${a}`}const ar="fs-active-repo",Le=es((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ar),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await Pw(),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 Uw(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 Fw(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},Px="fs-nav-collapsed",Ux="fs-session-panel-collapsed",kc=es(e=>({navCollapsed:localStorage.getItem(Px)==="true",sessionPanelCollapsed:localStorage.getItem(Ux)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(Px,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(Ux,String(a)),{sessionPanelCollapsed:a}})}})),Ky=[{segment:"run",icon:Vh,label:"运行面板",global:!1},{segment:"dev/issues",icon:dA,label:"研发",global:!1,matchPrefix:"dev"},{segment:"agents",icon:$3,label:"Agents",global:!1}];function Vy(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function Xy(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 Z5(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function J5({repos:e,activeRepoId:t,onRepoChange:a}){const r=Sn(),[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(Sy,{className:"h-3 w-3 shrink-0 text-fg-4"}),i.jsxs("span",{className:"truncate",children:[i.jsx("span",{className:"sm:hidden",children:f?Z5(f.name):""}),i.jsx("span",{className:"hidden sm:inline",children:(f==null?void 0:f.name)??""})]}),i.jsx(sa,{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(In,{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(Xh,{className:"h-3 w-3 shrink-0"}),i.jsx("span",{children:"管理仓库"})]})})]})]})}function eC({repoId:e,currentBranch:t}){const a=Le(_=>_.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),S=T.useCallback(()=>{o(!1),y(null)},[]);T.useEffect(()=>{if(!r)return;const _=M=>{N.current&&!N.current.contains(M.target)&&S()};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[r,S]);const A=async()=>{if(r){S();return}o(!0),m(!0),y(null);try{c(await qw(e))}catch{y("加载分支失败")}finally{m(!1)}},w=async _=>{if(!(_===t||h)){b(_),y(null);try{const M=await Yw(e,_);a(e,M.branch),S()}catch(M){y(M instanceof Error?M.message:"切换失败")}finally{b(null)}}};return t?i.jsxs("div",{ref:N,className:"relative",children:[i.jsxs("button",{type:"button",onClick:A,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(Oo,{className:"h-3 w-3"}),t,i.jsx(sa,{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(un,{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(_=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>w(_),className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",_===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[_===t?i.jsx(In,{className:"h-3 w-3 shrink-0"}):h===_?i.jsx(un,{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:_})]},_)),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(_=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>w(_),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===_?i.jsx(un,{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:_})]},`remote-${_}`))]})]}):null,g&&i.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:g})]})]}):null}function tC(){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.25"&&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 nC(){const e=Sn(),t=vn(),a=Le(g=>g.repos),r=Le(g=>g.activeRepoId),o=Le(g=>g.setActiveRepo),u=ih(g=>g.preference),c=ih(g=>g.cycle),f=u==="light"?_w:u==="dark"?aw:tw,m=a.find(g=>g.id===r),h=tC(),b=g=>{var A;if(!g)return;o(g);const y=a.find(w=>w.id===g);if(!y)return;const N=t.pathname.match(/\/dev\/(issues|pulls)/);if(N){e(`/${encodeURIComponent(y.name)}/dev/${N[1]}`);return}const S=((A=t.pathname.match(/\/(run|agents|issues|pulls)/))==null?void 0:A[1])??"run";e(`/${encodeURIComponent(y.name)}/${S}`)};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(Zc,{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.25"]}),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(J5,{repos:a,activeRepoId:r,onRepoChange:b}),m&&r&&i.jsx(eC,{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(Xh,{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 aC(){const e=Le(zn),t=kc(o=>o.navCollapsed),a=kc(o=>o.toggleNav),r=vn();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:Ky.map(o=>{const u=Xy(o,r.pathname,e);return i.jsxs(Ac,{to:Vy(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(Ac,{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(Xh,{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(eA,{className:"h-4 w-4"}):i.jsx(Z3,{className:"h-4 w-4"})})]})}function sC(){const e=Le(zn),t=vn();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:Ky.map(a=>{const r=Xy(a,t.pathname,e);return i.jsx(Ac,{to:Vy(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 rC(){return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[i.jsx(nC,{}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx(aC,{}),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(YS,{})})]}),i.jsx(sC,{})]})}let iC=0;const Gt=es(e=>({toasts:[],addToast:(t,a="info",r,o)=>{const u=(o==null?void 0:o.id)??`toast-${++iC}-${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 lC({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=Le(M=>M.addRepo),S=r.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,A=async M=>{const k=M.trim();if(k){b(!0),y("");try{const L=await Hw(k);L.name&&!r.trim()&&o(L.name),L.gitUrl&&!u.trim()&&c(L.gitUrl)}catch(L){const O=L instanceof Error?L.message:"无法解析路径";try{const P=JSON.parse(O);y(P.error??O)}catch{y(O)}}b(!1)}},w=T.useRef(A);w.current=A,T.useEffect(()=>{const M=t.trim();if(!M)return;const k=setTimeout(()=>{w.current(M)},500);return()=>clearTimeout(k)},[t]);const _=async()=>{if(!S)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:M=>M.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(dt,{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:M=>a(M.target.value),onBlur:M=>void A(M.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:M=>o(M.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:M=>c(M.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(M=>i.jsx("button",{type:"button",onClick:()=>m(M.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===M.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:M.label},M.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:_,disabled:!S,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 oC({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(()=>{H5(e).then(A=>{o(A.content),c(A.content),m(!1)}).catch(A=>{y(A instanceof Error?A.message:String(A)),m(!1)})},[e]);const N=async()=>{b(!0),y(null);try{await F5(e,r),c(r)}catch(A){y(A instanceof Error?A.message:String(A))}b(!1)},S=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:A=>A.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(dt,{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(_n,{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(un,{className:"h-5 w-5 fs-spin"}),i.jsx("p",{className:"text-xs",children:"加载中…"})]}):i.jsx("textarea",{value:r,onChange:A=>o(A.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
470
+ */const Mw=[["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"}]],Zc=ke("zap",Mw);function Dy(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=Dy(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=Dy(e))&&(r&&(r+=" "),r+=t);return r}const _x=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},Lw=(e=>e?_x(e):_x),Dw=e=>e;function jw(e,t=Dw){const a=rc.useSyncExternalStore(e.subscribe,rc.useCallback(()=>t(e.getState()),[e,t]),rc.useCallback(()=>t(e.getInitialState()),[e,t]));return rc.useDebugValue(a),a}const vx=e=>{const t=Lw(e),a=r=>jw(t,r);return Object.assign(a,t),a},es=(e=>e?vx(e):vx),_m="fs-theme";function jy(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Sx(e){return e==="system"?jy():e}function Ax(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const ih=es((e,t)=>({preference:localStorage.getItem(_m)??"system",resolved:Sx(localStorage.getItem(_m)??"system"),cycle(){const a=["system","light","dark"],r=a[(a.indexOf(t().preference)+1)%a.length],o=Sx(r);localStorage.setItem(_m,r),Ax(r),e({preference:r,resolved:o})},init(){Ax(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{const{preference:o}=t();if(o==="system"){const u=jy();e({resolved:u})}};return a.addEventListener("change",r),()=>a.removeEventListener("change",r)}})),Cc="fourth-spark-server-url";function By(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function Qh(){return localStorage.getItem(Cc)??""}function Bw(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(Cc,t):localStorage.removeItem(Cc)}function lh(){return localStorage.getItem(Cc)??""}class Ss extends Error{constructor(a,r){super(a);ln(this,"status");this.name="ApiError",this.status=r}}async function Se(e,t){let a;try{a=await fetch(Qh()+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 ra(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 Pw(){return ra(await Se("/api/repos"),"repos")}async function Uw(e,t,a,r){return Se("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:r})})}async function Hw(e){return Se("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function Fw(e){await Se(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function zw(e){await Se(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function $w(e){await Se(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function qw(e){return Se(`/api/repos/${encodeURIComponent(e)}/branches`)}async function Yw(e,t){return Se(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function Gw(e){return Se(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ye(e){return`/api/repos/${encodeURIComponent(e)}`}async function Kw(e){return ra(await Se(`${Ye(e)}/workspaces`),"workspaces")}async function Vw(e,t){await Se(`${Ye(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Xw(e){return Se(`${Ye(e)}/workspaces/cleanup`,{method:"POST"})}async function Qw(e,t){await Se(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function Ww(e,t){await Se(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function Zw(e){return ra(await Se(`${Ye(e)}/sessions`),"sessions")}async function Jw(e,t,a,r,o,u,c,f){return Se(`${Ye(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:r,variant:o,issueId:u,customAgentId:c,files:f})})}async function e5(e,t){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function t5(e,t,a,r,o,u,c){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:r,model:o,variant:u,files:c})})}async function n5(e,t){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function a5(e,t,a){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function s5(e,t){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}async function r5(e,t,a){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({messageID:a})})}function wx(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 Cx(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=`${Ye(e)}/sessions/${encodeURIComponent(t)}/messages${o?`?${o}`:""}`,c=await Se(u);if(Array.isArray(c)){const h=c.map(wx);return{messages:h,total:h.length,hasMore:!1}}const f=c,m=Array.isArray(f.messages)?f.messages:[];return{messages:m.map(wx),total:f.total??m.length,hasMore:f.hasMore??!1}}async function i5(e,t){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/status`)}async function l5(e,t){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/links`)}async function o5(e,t){return Se(`${Ye(e)}/sessions/snapshot/${encodeURIComponent(t)}`)}async function Py(e){return Se(`${Ye(e)}/sessions/all-links`)}async function u5(e,t,a,r){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:r})})}async function c5(e,t,a,r){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:r})})}async function Uy(){return ra(await Se("/api/custom-agents"))}async function d5(e){return Se("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function f5(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Hy(e){await Se(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function kx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function m5(e){return Se("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function Fy(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 h5(e,t,a){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(a)})}async function p5(e,t){await Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/${encodeURIComponent(t)}`,{method:"DELETE"})}async function g5(e,t){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/extract`,{method:"POST",body:JSON.stringify({sessionIds:t})})}async function Rx(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/stats`)}async function b5(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/memories/consolidate`,{method:"POST"})}async function Wh(e){return Se(`/api/custom-agents/${encodeURIComponent(e)}/sessions`)}async function zy(e){return ra(await Se(`${Ye(e)}/custom-agents`))}async function x5(e,t){return Se(`${Ye(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Io(e){return ra(await Se(`${Ye(e)}/models`))}async function $y(){return ra(await Se("/api/prompt-fragments"))}async function E5(e){return Se("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function y5(e,t){return Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function N5(e){await Se(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Ox(e){return ra(await Se(`${Ye(e)}/tags`))}async function Ix(e,t){return ra(await Se(`${Ye(e)}/milestones`))}async function Mx(e,t="open"){return ra(await Se(`${Ye(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function T5(e,t="all"){return Se(`${Ye(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function _5(e,t,a){return Se(`${Ye(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function v5(e,t,a){await Se(`${Ye(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function qy(e,t,a){return Se(`${Ye(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function S5(e,t){return ra(await Se(`${Ye(e)}/issues/${t}/pulls`))}async function Lx(e,t="open"){return ra(await Se(`${Ye(e)}/pulls?state=${encodeURIComponent(t)}`))}async function A5(e,t="all"){return Se(`${Ye(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function w5(e,t){return Se(`${Ye(e)}/pulls/${t}`)}async function C5(e,t){await Se(`${Ye(e)}/pulls/${t}/merge`,{method:"POST"})}async function Zh(e,t){return ra(await Se(`${Ye(e)}/pulls/${t}/issues`))}async function k5(e,t,a){await Se(`${Ye(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function R5(e,t,a){await Se(`${Ye(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function O5(e,t){return Se(`${Ye(e)}/pulls/${t}/comments`)}async function I5(e,t){return Se(`${Ye(e)}/issues/${t}/comments`)}async function Dx(e,t,a){return Se(`${Ye(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function M5(e,t,a){return Se(`${Ye(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function jx(e,t){return Se(`${Ye(e)}/issues/${t}/draft`)}async function L5(e,t,a){return Se(`${Ye(e)}/issues/polish-create`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Bx(e){return Se(`${Ye(e)}/issues/draft-create`)}async function D5(e){await Se(`${Ye(e)}/issues/draft-create`,{method:"DELETE"})}async function j5(e,t,a){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function B5(e,t,a){await Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function P5(){return Se("/api/agents-md")}async function U5(e){await Se("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function H5(e){return Se(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function F5(e,t){await Se(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function z5(e){return`${Qh()}${Ye(e)}/events`}async function $5(e){return Se(`${Ye(e)}/sessions/status`)}async function Mo(){return Se("/api/settings")}async function oh(e,t){await Se(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function uh(){return Se("/api/cloud/status")}async function q5(){return Se("/api/cloud/reload",{method:"POST"})}async function Y5(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 G5(){return ra(await Se("/api/git-hosts"),"gitHosts")}async function K5(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 V5(e){await Se(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Yy(){return Se("/api/usage")}async function Gy(e){return Se("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function X5(e,t="ios"){await Se("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}async function Q5(e,t){return Se(`${Ye(e)}/sessions/${encodeURIComponent(t)}/files`)}function W5(e,t,a){return`${Qh()}${Ye(e)}/sessions/${encodeURIComponent(t)}/files/${a}`}const ar="fs-active-repo",Le=es((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ar),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await Pw(),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 Uw(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 Fw(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},Px="fs-nav-collapsed",Ux="fs-session-panel-collapsed",kc=es(e=>({navCollapsed:localStorage.getItem(Px)==="true",sessionPanelCollapsed:localStorage.getItem(Ux)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(Px,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(Ux,String(a)),{sessionPanelCollapsed:a}})}})),Ky=[{segment:"run",icon:Vh,label:"运行面板",global:!1},{segment:"dev/issues",icon:dA,label:"研发",global:!1,matchPrefix:"dev"},{segment:"agents",icon:$3,label:"Agents",global:!1}];function Vy(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function Xy(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 Z5(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function J5({repos:e,activeRepoId:t,onRepoChange:a}){const r=Sn(),[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(Sy,{className:"h-3 w-3 shrink-0 text-fg-4"}),i.jsxs("span",{className:"truncate",children:[i.jsx("span",{className:"sm:hidden",children:f?Z5(f.name):""}),i.jsx("span",{className:"hidden sm:inline",children:(f==null?void 0:f.name)??""})]}),i.jsx(sa,{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(In,{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(Xh,{className:"h-3 w-3 shrink-0"}),i.jsx("span",{children:"管理仓库"})]})})]})]})}function eC({repoId:e,currentBranch:t}){const a=Le(_=>_.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),S=T.useCallback(()=>{o(!1),y(null)},[]);T.useEffect(()=>{if(!r)return;const _=M=>{N.current&&!N.current.contains(M.target)&&S()};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[r,S]);const A=async()=>{if(r){S();return}o(!0),m(!0),y(null);try{c(await qw(e))}catch{y("加载分支失败")}finally{m(!1)}},w=async _=>{if(!(_===t||h)){b(_),y(null);try{const M=await Yw(e,_);a(e,M.branch),S()}catch(M){y(M instanceof Error?M.message:"切换失败")}finally{b(null)}}};return t?i.jsxs("div",{ref:N,className:"relative",children:[i.jsxs("button",{type:"button",onClick:A,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(Oo,{className:"h-3 w-3"}),t,i.jsx(sa,{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(un,{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(_=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>w(_),className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",_===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[_===t?i.jsx(In,{className:"h-3 w-3 shrink-0"}):h===_?i.jsx(un,{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:_})]},_)),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(_=>i.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>w(_),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===_?i.jsx(un,{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:_})]},`remote-${_}`))]})]}):null,g&&i.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:g})]})]}):null}function tC(){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.26"&&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 nC(){const e=Sn(),t=vn(),a=Le(g=>g.repos),r=Le(g=>g.activeRepoId),o=Le(g=>g.setActiveRepo),u=ih(g=>g.preference),c=ih(g=>g.cycle),f=u==="light"?_w:u==="dark"?aw:tw,m=a.find(g=>g.id===r),h=tC(),b=g=>{var A;if(!g)return;o(g);const y=a.find(w=>w.id===g);if(!y)return;const N=t.pathname.match(/\/dev\/(issues|pulls)/);if(N){e(`/${encodeURIComponent(y.name)}/dev/${N[1]}`);return}const S=((A=t.pathname.match(/\/(run|agents|issues|pulls)/))==null?void 0:A[1])??"run";e(`/${encodeURIComponent(y.name)}/${S}`)};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(Zc,{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.26"]}),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(J5,{repos:a,activeRepoId:r,onRepoChange:b}),m&&r&&i.jsx(eC,{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(Xh,{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 aC(){const e=Le(zn),t=kc(o=>o.navCollapsed),a=kc(o=>o.toggleNav),r=vn();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:Ky.map(o=>{const u=Xy(o,r.pathname,e);return i.jsxs(Ac,{to:Vy(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(Ac,{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(Xh,{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(eA,{className:"h-4 w-4"}):i.jsx(Z3,{className:"h-4 w-4"})})]})}function sC(){const e=Le(zn),t=vn();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:Ky.map(a=>{const r=Xy(a,t.pathname,e);return i.jsx(Ac,{to:Vy(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 rC(){return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[i.jsx(nC,{}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx(aC,{}),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(YS,{})})]}),i.jsx(sC,{})]})}let iC=0;const Gt=es(e=>({toasts:[],addToast:(t,a="info",r,o)=>{const u=(o==null?void 0:o.id)??`toast-${++iC}-${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 lC({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=Le(M=>M.addRepo),S=r.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,A=async M=>{const k=M.trim();if(k){b(!0),y("");try{const L=await Hw(k);L.name&&!r.trim()&&o(L.name),L.gitUrl&&!u.trim()&&c(L.gitUrl)}catch(L){const O=L instanceof Error?L.message:"无法解析路径";try{const P=JSON.parse(O);y(P.error??O)}catch{y(O)}}b(!1)}},w=T.useRef(A);w.current=A,T.useEffect(()=>{const M=t.trim();if(!M)return;const k=setTimeout(()=>{w.current(M)},500);return()=>clearTimeout(k)},[t]);const _=async()=>{if(!S)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:M=>M.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(dt,{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:M=>a(M.target.value),onBlur:M=>void A(M.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:M=>o(M.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:M=>c(M.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(M=>i.jsx("button",{type:"button",onClick:()=>m(M.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===M.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:M.label},M.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:_,disabled:!S,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 oC({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(()=>{H5(e).then(A=>{o(A.content),c(A.content),m(!1)}).catch(A=>{y(A instanceof Error?A.message:String(A)),m(!1)})},[e]);const N=async()=>{b(!0),y(null);try{await F5(e,r),c(r)}catch(A){y(A instanceof Error?A.message:String(A))}b(!1)},S=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:A=>A.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(dt,{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(_n,{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(un,{className:"h-5 w-5 fs-spin"}),i.jsx("p",{className:"text-xs",children:"加载中…"})]}):i.jsx("textarea",{value:r,onChange:A=>o(A.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
471
471
 
472
472
  在此编写该仓库的 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||!S,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(Wc,{className:"h-3.5 w-3.5"}),h?"保存中…":"保存"]})]})]})})}const ch=1024,dh=ch*1024,Hx=dh*1024;function Fx(e){return!e||e<=0?"0 B":e<ch?`${e} B`:e<dh?`${(e/ch).toFixed(1)} KB`:e<Hx?`${(e/dh).toFixed(1)} MB`:`${(e/Hx).toFixed(2)} GB`}const vm="ws/";function uC({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 M=await Kw(e);o(M)}catch(M){m(M instanceof Ss?M.message:"加载失败")}c(!1)};T.useEffect(()=>{t&&r===null&&N()},[t]);const S=async M=>{b(M);try{await Vw(e,M),await N()}catch(k){m(k instanceof Ss?k.message:"删除失败")}b(null)},A=async()=>{y(!0);try{await Xw(e),await N()}catch(M){m(M instanceof Ss?M.message:"清理失败")}y(!1)},w=(r==null?void 0:r.length)??0,_=(r==null?void 0:r.reduce((M,k)=>M+(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(M=>!M),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(Ay,{className:"h-3 w-3 shrink-0"}):i.jsx(sa,{className:"h-3 w-3 shrink-0"}),i.jsx(Oo,{className:"h-3 w-3 shrink-0 text-fg-5"}),i.jsx("span",{children:"工作空间"}),r!==null&&i.jsxs("span",{className:"text-fg-5",children:["(",w,") · ",Fx(_)]})]}),t&&w>0&&i.jsxs("button",{type:"button",onClick:()=>void A(),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(dt,{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"})}):w===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(M=>{const k=M.branch.startsWith(vm),L=k?M.branch.slice(vm.length):M.branch,O=M.status==="active"?"bg-emerald-500/10 text-emerald-600":M.status==="idle"?"bg-amber-500/10 text-amber-600":"bg-fg-6/30 text-fg-4",P=M.status==="active"?"活跃":M.status==="idle"?"空闲":M.status==="merged"?"已合并":M.status==="stale"?"陈旧":M.status,z=M.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:[M.running&&M.port&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",title:`运行中 :${M.port}`}),i.jsxs("span",{className:"min-w-0 truncate font-mono",children:[k&&i.jsx("span",{className:"text-fg-5",children:vm}),i.jsx("span",{className:"text-fg-2",children:L})]})]}),i.jsx("span",{className:ae("shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium",O),children:P}),i.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 text-fg-5",children:[i.jsx(LA,{className:"h-2.5 w-2.5"}),Fx(M.diskUsage)]}),i.jsx("button",{type:"button",onClick:()=>void S(M.id),disabled:!z||h===M.id,title:z?"删除工作空间":"活跃工作空间无法删除",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===M.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(ws,{className:"h-3 w-3"})})]},M.id)})})]})]})}function Qy(){const e=Le(O=>O.repos),t=Le(O=>O.activeRepoId),a=Le(O=>O.setActiveRepo),r=Le(O=>O.removeRepo),o=Le(O=>O.loadRepos),[u,c]=T.useState(!1),[f,m]=T.useState(null),[h,b]=T.useState(null),[g,y]=T.useState(null),N=Gt(O=>O.addToast),[S,A]=T.useState(null),[w,_]=T.useState(null),M=T.useRef(null);T.useEffect(()=>{if(!w)return;const O=P=>{M.current&&!M.current.contains(P.target)&&_(null)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[w]);const k=async(O,P)=>{b(O);try{P?await $w(O):await zw(O),await o()}catch{}b(null)},L=async O=>{y(O);try{const P=await Gw(O);await o();const z=P.alreadyUpToDate?"info":"success";N(P.summary,z,void 0,{persistent:!0})}catch(P){let z="拉取失败";if(P instanceof Ss)try{z=JSON.parse(P.message).error??P.message}catch{z=P.message}N(z,"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(Ma,{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(Ma,{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(O=>{const P=O.id===t;return i.jsxs("div",{className:ae("rounded-xl border p-4 transition-colors",P?"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(O.id),className:"flex min-w-0 items-center gap-2 text-left",children:[P?i.jsx(Vr,{className:"h-4 w-4 shrink-0 text-blue-500"}):i.jsx(rA,{className:"h-4 w-4 shrink-0 text-fg-5"}),i.jsx("span",{className:ae("truncate font-medium",P?"text-fg":"text-fg-2"),children:O.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",O.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",O.running?"bg-emerald-500":"bg-fg-5")}),O.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:O.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:O.localPath}),i.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(O.localPath),title:"复制路径",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:i.jsx(wc,{className:"h-3 w-3"})})]})]}),O.running&&O.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:${O.port}`,target:"_blank",rel:"noopener noreferrer",className:"truncate text-blue-500 hover:underline",children:["127.0.0.1:",O.port]}),i.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(`http://127.0.0.1:${O.port}`),title:"复制链接",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:i.jsx(wc,{className:"h-3 w-3"})})]})]})]}),i.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>void L(O.id),disabled:g===O.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===O.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(D3,{className:"h-3 w-3"}),"拉取"]})}),i.jsx("button",{type:"button",onClick:()=>void k(O.id,O.running),disabled:h===O.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",O.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===O.id?i.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):O.running?i.jsxs(i.Fragment,{children:[i.jsx(rh,{className:"h-3 w-3 fill-current"}),"停止"]}):i.jsxs(i.Fragment,{children:[i.jsx(Vh,{className:"h-3 w-3 fill-current"}),"启动"]})}),i.jsxs("div",{className:"relative",ref:w===O.id?M:void 0,children:[i.jsx("button",{type:"button",onClick:()=>_(w===O.id?null:O.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($h,{className:"h-4 w-4"})}),w===O.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",O.runtimeType==="claude-code"?"text-orange-500":"text-sky-500"),onClick:async()=>{_(null);const z=O.runtimeType==="claude-code"?"opencode":"claude-code";await Ww(O.id,z),o()},children:O.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()=>{_(null),await Qw(O.id,!O.worktreeEnabled),o()},children:[i.jsx(Oo,{className:"h-3 w-3"}),i.jsx("span",{children:"Worktree"}),i.jsx("span",{className:ae("ml-auto text-[10px]",O.worktreeEnabled?"text-violet-500":"text-fg-5"),children:O.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:()=>{_(null),A({id:O.id,name:O.name})},children:[i.jsx(ur,{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:()=>{_(null),m(O.id)},children:[i.jsx(ws,{className:"h-3 w-3"}),"删除仓库"]})]})]})]}),f===O.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(O.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(In,{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:"取消"})]})]}),O.worktreeEnabled&&i.jsx(uC,{repoId:O.id})]},O.id)})})}),i.jsxs("p",{className:"mt-3 text-xs text-fg-5",children:[e.length," 个仓库"]}),u&&i.jsx(lC,{onClose:()=>c(!1)}),S&&i.jsx(oC,{repoId:S.id,repoName:S.name,onClose:()=>A(null)})]})}function cC(){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(Qy,{})})})}function zx(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 Wy(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const dC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mC={};function $x(e,t){return(mC.jsx?fC:dC).test(e)}const hC=/[ \t\n\f\r]/g;function pC(e){return typeof e=="object"?e.type==="text"?qx(e.value):!1:qx(e)}function qx(e){return e.replace(hC,"")===""}class Lo{constructor(t,a,r){this.normal=a,this.property=t,r&&(this.space=r)}}Lo.prototype.normal={};Lo.prototype.property={};Lo.prototype.space=void 0;function Zy(e,t){const a={},r={};for(const o of e)Object.assign(a,o.property),Object.assign(r,o.normal);return new Lo(a,r,t)}function To(e){return e.toLowerCase()}class ia{constructor(t,a){this.attribute=a,this.property=t}}ia.prototype.attribute="";ia.prototype.booleanish=!1;ia.prototype.boolean=!1;ia.prototype.commaOrSpaceSeparated=!1;ia.prototype.commaSeparated=!1;ia.prototype.defined=!1;ia.prototype.mustUseProperty=!1;ia.prototype.number=!1;ia.prototype.overloadedBoolean=!1;ia.prototype.property="";ia.prototype.spaceSeparated=!1;ia.prototype.space=void 0;let gC=0;const Xe=Xr(),on=Xr(),fh=Xr(),ve=Xr(),Rt=Xr(),Hr=Xr(),ba=Xr();function Xr(){return 2**++gC}const mh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:on,commaOrSpaceSeparated:ba,commaSeparated:Hr,number:ve,overloadedBoolean:fh,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Sm=Object.keys(mh);class Jh extends ia{constructor(t,a,r,o){let u=-1;if(super(t,a),Yx(this,"space",o),typeof r=="number")for(;++u<Sm.length;){const c=Sm[u];Yx(this,Sm[u],(r&mh[c])===mh[c])}}}Jh.prototype.defined=!0;function Yx(e,t,a){a&&(e[t]=a)}function el(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[To(r)]=r,a[To(u.attribute)]=r}return new Lo(t,a,e.space)}const Jy=el({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Rt,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:ve,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Rt,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:on,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function eN(e,t){return t in e?e[t]:t}function tN(e,t){return eN(e,t.toLowerCase())}const bC=el({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Hr,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:ve,colSpan:ve,command:null,commandFor:null,content:null,contentEditable:on,controls:Xe,controlsList:Rt,coords:ve|Hr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:fh,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:ve,hidden:fh,high:ve,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:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,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:ve,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:ve,rowSpan:ve,sandbox:Rt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootCustomElementRegistry:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shadowRootSerializable:Xe,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:on,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,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:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Xe,disablePictureInPicture:Xe,disableRemotePlayback:Xe,exportParts:Hr,part:Rt,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:tN}),xC=el({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:ba,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,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:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,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:Hr,g2:Hr,glyphName:Hr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:ba,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,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:ve,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:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ba,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ba,rev:ba,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ba,requiredFeatures:ba,requiredFonts:ba,requiredFormats:ba,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:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:ba,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ba,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ba,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:eN}),nN=el({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()}}),aN=el({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:tN}),sN=el({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),EC={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"},yC=/[A-Z]/g,Gx=/-[a-z]/g,NC=/^data[-\w.:]+$/i;function Jc(e,t){const a=To(t);let r=t,o=ia;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&NC.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(Gx,_C);r="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!Gx.test(u)){let c=u.replace(yC,TC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}o=Jh}return new o(r,t)}function TC(e){return"-"+e.toLowerCase()}function _C(e){return e.charAt(1).toUpperCase()}const Do=Zy([Jy,bC,nN,aN,sN],"html"),cr=Zy([Jy,xC,nN,aN,sN],"svg");function Kx(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function rN(e){return e.join(" ").trim()}var Bi={},Am,Vx;function vC(){if(Vx)return Am;Vx=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=`
473
473
  `,h="/",b="*",g="",y="comment",N="declaration";function S(w,_){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];_=_||{};var M=1,k=1;function L(te){var K=te.match(t);K&&(M+=K.length);var G=te.lastIndexOf(m);k=~G?te.length-G:k+te.length}function O(){var te={line:M,column:k};return function(K){return K.position=new P(te),V(),K}}function P(te){this.start=te,this.end={line:M,column:k},this.source=_.source}P.prototype.content=w;function z(te){var K=new Error(_.source+":"+M+":"+k+": "+te);if(K.reason=te,K.filename=_.source,K.line=M,K.column=k,K.source=w,!_.silent)throw K}function J(te){var K=te.exec(w);if(K){var G=K[0];return L(G),w=w.slice(G.length),K}}function V(){J(a)}function j(te){var K;for(te=te||[];K=ee();)K!==!1&&te.push(K);return te}function ee(){var te=O();if(!(h!=w.charAt(0)||b!=w.charAt(1))){for(var K=2;g!=w.charAt(K)&&(b!=w.charAt(K)||h!=w.charAt(K+1));)++K;if(K+=2,g===w.charAt(K-1))return z("End of comment missing");var G=w.slice(2,K-2);return k+=2,L(G),w=w.slice(K),k+=2,te({type:y,comment:G})}}function se(){var te=O(),K=J(r);if(K){if(ee(),!J(o))return z("property missing ':'");var G=J(u),F=te({type:N,property:A(K[0].replace(e,g)),value:G?A(G[0].replace(e,g)):g});return J(c),F}}function he(){var te=[];j(te);for(var K;K=se();)K!==!1&&(te.push(K),j(te));return te}return V(),he()}function A(w){return w?w.replace(f,g):g}return Am=S,Am}var Xx;function SC(){if(Xx)return Bi;Xx=1;var e=Bi&&Bi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.default=a;const t=e(vC());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 Bi}var to={},Qx;function AC(){if(Qx)return to;Qx=1,Object.defineProperty(to,"__esModule",{value:!0}),to.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 to.camelCase=m,to}var no,Wx;function wC(){if(Wx)return no;Wx=1;var e=no&&no.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(SC()),a=AC();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,no=r,no}var CC=wC();const kC=qc(CC),ed=iN("end"),ts=iN("start");function iN(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 RC(e){const t=ts(e),a=ed(e);if(t&&a)return{start:t,end:a}}function co(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Zx(e.position):"start"in e||"end"in e?Zx(e):"line"in e||"column"in e?hh(e):""}function hh(e){return Jx(e&&e.line)+":"+Jx(e&&e.column)}function Zx(e){return hh(e&&e.start)+"-"+hh(e&&e.end)}function Jx(e){return e&&typeof e=="number"?e:1}class Mn 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=co(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}}Mn.prototype.file="";Mn.prototype.name="";Mn.prototype.reason="";Mn.prototype.message="";Mn.prototype.stack="";Mn.prototype.column=void 0;Mn.prototype.line=void 0;Mn.prototype.ancestors=void 0;Mn.prototype.cause=void 0;Mn.prototype.fatal=void 0;Mn.prototype.place=void 0;Mn.prototype.ruleId=void 0;Mn.prototype.source=void 0;const ep={}.hasOwnProperty,OC=new Map,IC=/[A-Z]/g,MC=new Set(["table","tbody","thead","tfoot","tr"]),LC=new Set(["td","th"]),lN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function DC(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=$C(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=zC(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"?cr:Do,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=oN(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function oN(e,t,a){if(t.type==="element")return jC(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return BC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return UC(e,t,a);if(t.type==="mdxjsEsm")return PC(e,t);if(t.type==="root")return HC(e,t,a);if(t.type==="text")return FC(e,t)}function jC(e,t,a){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=cr,e.schema=o),e.ancestors.push(t);const u=cN(e,t.tagName,!1),c=qC(e,t);let f=np(e,t);return MC.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!pC(m):!0})),uN(e,c,u,t),tp(c,f),e.ancestors.pop(),e.schema=r,e.create(t,u,c,a)}function BC(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)}_o(e,t.position)}function PC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_o(e,t.position)}function UC(e,t,a){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=cr,e.schema=o),e.ancestors.push(t);const u=t.name===null?e.Fragment:cN(e,t.name,!0),c=YC(e,t),f=np(e,t);return uN(e,c,u,t),tp(c,f),e.ancestors.pop(),e.schema=r,e.create(t,u,c,a)}function HC(e,t,a){const r={};return tp(r,np(e,t)),e.create(t,e.Fragment,r,a)}function FC(e,t){return t.value}function uN(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 zC(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 $C(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 qC(e,t){const a={};let r,o;for(o in t.properties)if(o!=="children"&&ep.call(t.properties,o)){const u=GC(e,o,t.properties[o]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&LC.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 YC(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 _o(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 _o(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:OC;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=oN(e,u,c);f!==void 0&&a.push(f)}return a}function GC(e,t,a){const r=Jc(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=r.commaSeparated?Wy(a):rN(a)),r.property==="style"){let o=typeof a=="object"?a:KC(e,String(a));return e.stylePropertyNameCase==="css"&&(o=VC(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?EC[r.property]||r.property:r.attribute,a]}}function KC(e,t){try{return kC(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const r=a,o=new Mn("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=lN+"#cannot-parse-style-attribute",o}}function cN(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=$x(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=$x(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);_o(e)}function _o(e,t){const a=new Mn("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=lN+"#cannot-handle-mdx-estrees-without-createevaluater",a}function VC(e){const t={};let a;for(a in e)ep.call(e,a)&&(t[XC(a)]=e[a]);return t}function XC(e){let t=e.replace(IC,QC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function QC(e){return"-"+e.toLowerCase()}const wm={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"]},WC={};function ap(e,t){const a=WC,r=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return dN(e,r,o)}function dN(e,t,a){if(ZC(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 e1(e.children,t,a)}return Array.isArray(e)?e1(e,t,a):""}function e1(e,t,a){const r=[];let o=-1;for(;++o<e.length;)r[o]=dN(e[o],t,a);return r.join("")}function ZC(e){return!!(e&&typeof e=="object")}const t1=document.createElement("i");function sp(e){const t="&"+e+";";t1.innerHTML=t;const a=t1.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 Ra(e,t){return e.length>0?(xa(e,e.length,0,t),e):t}const n1={}.hasOwnProperty;function fN(e){const t={};let a=-1;for(;++a<e.length;)JC(t,e[a]);return t}function JC(e,t){let a;for(a in t){const o=(n1.call(e,a)?e[a]:void 0)||(e[a]={}),u=t[a];let c;if(u)for(c in u){n1.call(o,c)||(o[c]=[]);const f=u[c];ek(o[c],Array.isArray(f)?f:f?[f]:[])}}}function ek(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 mN(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 Fa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fn=dr(/[A-Za-z]/),On=dr(/[\dA-Za-z]/),tk=dr(/[#-'*+\--9=?A-Z^-~]/);function Rc(e){return e!==null&&(e<32||e===127)}const ph=dr(/\d/),nk=dr(/[\dA-Fa-f]/),ak=dr(/[!-/:-@[-`{-~]/);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 td=dr(new RegExp("\\p{P}|\\p{S}","u")),qr=dr(/\s/);function dr(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function tl(e){const t=[];let a=-1,r=0,o=0;for(;++a<e.length;){const u=e.charCodeAt(a);let c="";if(u===37&&On(e.charCodeAt(a+1))&&On(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 ht(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 sk={tokenize:rk};function rk(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"),ht(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 ik={tokenize:lk},a1={tokenize:ok};function lk(e){const t=this,a=[];let r=0,o,u,c;return f;function f(k){if(r<a.length){const L=a[r];return t.containerState=L[1],e.attempt(L[0].continuation,m,h)(k)}return h(k)}function m(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&M();const L=t.events.length;let O=L,P;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){P=t.events[O][1].end;break}_(r);let z=L;for(;z<t.events.length;)t.events[z][1].end={...P},z++;return xa(t.events,O+1,0,t.events.slice(L)),t.events.length=z,h(k)}return f(k)}function h(k){if(r===a.length){if(!o)return y(k);if(o.currentConstruct&&o.currentConstruct.concrete)return S(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(a1,b,g)(k)}function b(k){return o&&M(),_(r),y(k)}function g(k){return t.parser.lazy[t.now().line]=r!==a.length,c=t.now().offset,S(k)}function y(k){return t.containerState={},e.attempt(a1,N,S)(k)}function N(k){return r++,a.push([t.currentConstruct,t.containerState]),y(k)}function S(k){if(k===null){o&&M(),_(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),A(k)}function A(k){if(k===null){w(e.exit("chunkFlow"),!0),_(0),e.consume(k);return}return Fe(k)?(e.consume(k),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(k),A)}function w(k,L){const O=t.sliceStream(k);if(L&&O.push(null),k.previous=u,u&&(u.next=k),u=k,o.defineSkip(k.start),o.write(O),t.parser.lazy[k.start.line]){let P=o.events.length;for(;P--;)if(o.events[P][1].start.offset<c&&(!o.events[P][1].end||o.events[P][1].end.offset>c))return;const z=t.events.length;let J=z,V,j;for(;J--;)if(t.events[J][0]==="exit"&&t.events[J][1].type==="chunkFlow"){if(V){j=t.events[J][1].end;break}V=!0}for(_(r),P=z;P<t.events.length;)t.events[P][1].end={...j},P++;xa(t.events,J+1,0,t.events.slice(z)),t.events.length=P}}function _(k){let L=a.length;for(;L-- >k;){const O=a[L];t.containerState=O[1],O[0].exit.call(t,e)}a.length=k}function M(){o.write([null]),u=void 0,o=void 0,t.containerState._closeFlow=void 0}}function ok(e,t,a){return ht(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Gi(e){if(e===null||Ot(e)||qr(e))return 1;if(td(e))return 2}function nd(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 gh={name:"attention",resolveAll:uk,tokenize:ck};function uk(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};s1(g,-m),s1(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=Ra(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=Ra(h,[["enter",o,t],["enter",c,t],["exit",c,t],["enter",u,t]]),h=Ra(h,nd(t.parser.constructs.insideSpan.null,e.slice(r+1,a),t)),h=Ra(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=Ra(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 ck(e,t){const a=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Gi(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=Gi(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 s1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const dk={name:"autolink",tokenize:fk};function fk(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||On(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||On(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||Rc(N)?a(N):(e.consume(N),m)}function h(N){return N===64?(e.consume(N),b):tk(N)?(e.consume(N),h):a(N)}function b(N){return On(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||On(N))&&r++<63){const S=N===45?y:g;return e.consume(N),S}return a(N)}}const jo={partial:!0,tokenize:mk};function mk(e,t,a){return r;function r(u){return it(u)?ht(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||Fe(u)?t(u):a(u)}}const hN={continuation:{tokenize:pk},exit:gk,name:"blockQuote",tokenize:hk};function hk(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 pk(e,t,a){const r=this;return o;function o(c){return it(c)?ht(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(hN,t,a)(c)}}function gk(e){e.exit("blockQuote")}const pN={name:"characterEscape",tokenize:bk};function bk(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 ak(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(u)}}const gN={name:"characterReference",tokenize:xk};function xk(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=On,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=nk,b):(e.enter("characterReferenceValue"),u=7,c=ph,b(g))}function b(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return c===On&&!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 r1={partial:!0,tokenize:yk},i1={concrete:!0,name:"codeFenced",tokenize:Ek};function Ek(e,t,a){const r=this,o={partial:!0,tokenize:O};let u=0,c=0,f;return m;function m(P){return h(P)}function h(P){const z=r.events[r.events.length-1];return u=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,f=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(P)}function b(P){return P===f?(c++,e.consume(P),b):c<3?a(P):(e.exit("codeFencedFenceSequence"),it(P)?ht(e,g,"whitespace")(P):g(P))}function g(P){return P===null||Fe(P)?(e.exit("codeFencedFence"),r.interrupt?t(P):e.check(r1,A,L)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(P))}function y(P){return P===null||Fe(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(P)):it(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ht(e,N,"whitespace")(P)):P===96&&P===f?a(P):(e.consume(P),y)}function N(P){return P===null||Fe(P)?g(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(P))}function S(P){return P===null||Fe(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(P)):P===96&&P===f?a(P):(e.consume(P),S)}function A(P){return e.attempt(o,L,w)(P)}function w(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),_}function _(P){return u>0&&it(P)?ht(e,M,"linePrefix",u+1)(P):M(P)}function M(P){return P===null||Fe(P)?e.check(r1,A,L)(P):(e.enter("codeFlowValue"),k(P))}function k(P){return P===null||Fe(P)?(e.exit("codeFlowValue"),M(P)):(e.consume(P),k)}function L(P){return e.exit("codeFenced"),t(P)}function O(P,z,J){let V=0;return j;function j(K){return P.enter("lineEnding"),P.consume(K),P.exit("lineEnding"),ee}function ee(K){return P.enter("codeFencedFence"),it(K)?ht(P,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):se(K)}function se(K){return K===f?(P.enter("codeFencedFenceSequence"),he(K)):J(K)}function he(K){return K===f?(V++,P.consume(K),he):V>=c?(P.exit("codeFencedFenceSequence"),it(K)?ht(P,te,"whitespace")(K):te(K)):J(K)}function te(K){return K===null||Fe(K)?(P.exit("codeFencedFence"),z(K)):J(K)}}}function yk(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:Tk},Nk={partial:!0,tokenize:_k};function Tk(e,t,a){const r=this;return o;function o(h){return e.enter("codeIndented"),ht(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(Nk,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 _k(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):ht(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 vk={name:"codeText",previous:Ak,resolve:Sk,tokenize:wk};function Sk(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 Ak(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wk(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 Ck{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&&ao(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),ao(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ao(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);ao(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ao(this.left,a.reverse())}}}function ao(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 bN(e){const t={};let a=-1,r,o,u,c,f,m,h;const b=new Ck(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,kk(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 kk(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,S=0,A=0;const w=[A];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&&(A=y+1,w.push(A),N._tokenizer=void 0,N.previous=void 0,N=N.next);for(c.events=[],N?(N._tokenizer=void 0,N.previous=void 0):w.pop(),y=w.length;y--;){const _=f.slice(w[y],w[y+1]),M=u.pop();m.push([M,M+_.length-1]),e.splice(M,2,_)}for(m.reverse(),y=-1;++y<m.length;)h[S+m[y][0]]=S+m[y][1],S+=m[y][1]-m[y][0]-1;return h}const Rk={resolve:Ik,tokenize:Mk},Ok={partial:!0,tokenize:Lk};function Ik(e){return bN(e),e}function Mk(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(Ok,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 Lk(e,t,a){const r=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ht(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 xN(e,t,a,r,o,u,c,f,m){const h=m||Number.POSITIVE_INFINITY;let b=0;return g;function g(_){return _===60?(e.enter(r),e.enter(o),e.enter(u),e.consume(_),e.exit(u),y):_===null||_===32||_===41||Rc(_)?a(_):(e.enter(r),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),A(_))}function y(_){return _===62?(e.enter(u),e.consume(_),e.exit(u),e.exit(o),e.exit(r),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),N(_))}function N(_){return _===62?(e.exit("chunkString"),e.exit(f),y(_)):_===null||_===60||Fe(_)?a(_):(e.consume(_),_===92?S:N)}function S(_){return _===60||_===62||_===92?(e.consume(_),N):N(_)}function A(_){return!b&&(_===null||_===41||Ot(_))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(r),t(_)):b<h&&_===40?(e.consume(_),b++,A):_===41?(e.consume(_),b--,A):_===null||_===32||_===40||Rc(_)?a(_):(e.consume(_),_===92?w:A)}function w(_){return _===40||_===41||_===92?(e.consume(_),A):A(_)}}function EN(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 yN(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"),ht(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 fo(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)?ht(e,r,a?"linePrefix":"lineSuffix")(o):t(o)}}const Dk={name:"definition",tokenize:Bk},jk={partial:!0,tokenize:Pk};function Bk(e,t,a){const r=this;let o;return u;function u(N){return e.enter("definition"),c(N)}function c(N){return EN.call(r,e,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(N)}function f(N){return o=Fa(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)?fo(e,h)(N):h(N)}function h(N){return xN(e,b,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(N)}function b(N){return e.attempt(jk,g,g)(N)}function g(N){return it(N)?ht(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 Pk(e,t,a){return r;function r(f){return Ot(f)?fo(e,o)(f):a(f)}function o(f){return yN(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return it(f)?ht(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Fe(f)?t(f):a(f)}}const Uk={name:"hardBreakEscape",tokenize:Hk};function Hk(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 Fk={name:"headingAtx",resolve:zk,tokenize:$k};function zk(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 $k(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)?ht(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 qk=["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"],l1=["pre","script","style","textarea"],Yk={concrete:!0,name:"htmlFlow",resolveTo:Vk,tokenize:Xk},Gk={partial:!0,tokenize:Wk},Kk={partial:!0,tokenize:Qk};function Vk(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 Xk(e,t,a){const r=this;let o,u,c,f,m;return h;function h(C){return b(C)}function b(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),g}function g(C){return C===33?(e.consume(C),y):C===47?(e.consume(C),u=!0,A):C===63?(e.consume(C),o=3,r.interrupt?t:D):Fn(C)?(e.consume(C),c=String.fromCharCode(C),w):a(C)}function y(C){return C===45?(e.consume(C),o=2,N):C===91?(e.consume(C),o=5,f=0,S):Fn(C)?(e.consume(C),o=4,r.interrupt?t:D):a(C)}function N(C){return C===45?(e.consume(C),r.interrupt?t:D):a(C)}function S(C){const de="CDATA[";return C===de.charCodeAt(f++)?(e.consume(C),f===de.length?r.interrupt?t:se:S):a(C)}function A(C){return Fn(C)?(e.consume(C),c=String.fromCharCode(C),w):a(C)}function w(C){if(C===null||C===47||C===62||Ot(C)){const de=C===47,_e=c.toLowerCase();return!de&&!u&&l1.includes(_e)?(o=1,r.interrupt?t(C):se(C)):qk.includes(c.toLowerCase())?(o=6,de?(e.consume(C),_):r.interrupt?t(C):se(C)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(C):u?M(C):k(C))}return C===45||On(C)?(e.consume(C),c+=String.fromCharCode(C),w):a(C)}function _(C){return C===62?(e.consume(C),r.interrupt?t:se):a(C)}function M(C){return it(C)?(e.consume(C),M):j(C)}function k(C){return C===47?(e.consume(C),j):C===58||C===95||Fn(C)?(e.consume(C),L):it(C)?(e.consume(C),k):j(C)}function L(C){return C===45||C===46||C===58||C===95||On(C)?(e.consume(C),L):O(C)}function O(C){return C===61?(e.consume(C),P):it(C)?(e.consume(C),O):k(C)}function P(C){return C===null||C===60||C===61||C===62||C===96?a(C):C===34||C===39?(e.consume(C),m=C,z):it(C)?(e.consume(C),P):J(C)}function z(C){return C===m?(e.consume(C),m=null,V):C===null||Fe(C)?a(C):(e.consume(C),z)}function J(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Ot(C)?O(C):(e.consume(C),J)}function V(C){return C===47||C===62||it(C)?k(C):a(C)}function j(C){return C===62?(e.consume(C),ee):a(C)}function ee(C){return C===null||Fe(C)?se(C):it(C)?(e.consume(C),ee):a(C)}function se(C){return C===45&&o===2?(e.consume(C),G):C===60&&o===1?(e.consume(C),F):C===62&&o===4?(e.consume(C),I):C===63&&o===3?(e.consume(C),D):C===93&&o===5?(e.consume(C),q):Fe(C)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Gk,W,he)(C)):C===null||Fe(C)?(e.exit("htmlFlowData"),he(C)):(e.consume(C),se)}function he(C){return e.check(Kk,te,W)(C)}function te(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),K}function K(C){return C===null||Fe(C)?he(C):(e.enter("htmlFlowData"),se(C))}function G(C){return C===45?(e.consume(C),D):se(C)}function F(C){return C===47?(e.consume(C),c="",$):se(C)}function $(C){if(C===62){const de=c.toLowerCase();return l1.includes(de)?(e.consume(C),I):se(C)}return Fn(C)&&c.length<8?(e.consume(C),c+=String.fromCharCode(C),$):se(C)}function q(C){return C===93?(e.consume(C),D):se(C)}function D(C){return C===62?(e.consume(C),I):C===45&&o===2?(e.consume(C),D):se(C)}function I(C){return C===null||Fe(C)?(e.exit("htmlFlowData"),W(C)):(e.consume(C),I)}function W(C){return e.exit("htmlFlow"),t(C)}}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 Wk(e,t,a){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(jo,t,a)}}const Zk={name:"htmlText",tokenize:Jk};function Jk(e,t,a){const r=this;let o,u,c;return f;function f(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),m}function m(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),O):D===63?(e.consume(D),k):Fn(D)?(e.consume(D),J):a(D)}function h(D){return D===45?(e.consume(D),b):D===91?(e.consume(D),u=0,S):Fn(D)?(e.consume(D),M):a(D)}function b(D){return D===45?(e.consume(D),N):a(D)}function g(D){return D===null?a(D):D===45?(e.consume(D),y):Fe(D)?(c=g,F(D)):(e.consume(D),g)}function y(D){return D===45?(e.consume(D),N):g(D)}function N(D){return D===62?G(D):D===45?y(D):g(D)}function S(D){const I="CDATA[";return D===I.charCodeAt(u++)?(e.consume(D),u===I.length?A:S):a(D)}function A(D){return D===null?a(D):D===93?(e.consume(D),w):Fe(D)?(c=A,F(D)):(e.consume(D),A)}function w(D){return D===93?(e.consume(D),_):A(D)}function _(D){return D===62?G(D):D===93?(e.consume(D),_):A(D)}function M(D){return D===null||D===62?G(D):Fe(D)?(c=M,F(D)):(e.consume(D),M)}function k(D){return D===null?a(D):D===63?(e.consume(D),L):Fe(D)?(c=k,F(D)):(e.consume(D),k)}function L(D){return D===62?G(D):k(D)}function O(D){return Fn(D)?(e.consume(D),P):a(D)}function P(D){return D===45||On(D)?(e.consume(D),P):z(D)}function z(D){return Fe(D)?(c=z,F(D)):it(D)?(e.consume(D),z):G(D)}function J(D){return D===45||On(D)?(e.consume(D),J):D===47||D===62||Ot(D)?V(D):a(D)}function V(D){return D===47?(e.consume(D),G):D===58||D===95||Fn(D)?(e.consume(D),j):Fe(D)?(c=V,F(D)):it(D)?(e.consume(D),V):G(D)}function j(D){return D===45||D===46||D===58||D===95||On(D)?(e.consume(D),j):ee(D)}function ee(D){return D===61?(e.consume(D),se):Fe(D)?(c=ee,F(D)):it(D)?(e.consume(D),ee):V(D)}function se(D){return D===null||D===60||D===61||D===62||D===96?a(D):D===34||D===39?(e.consume(D),o=D,he):Fe(D)?(c=se,F(D)):it(D)?(e.consume(D),se):(e.consume(D),te)}function he(D){return D===o?(e.consume(D),o=void 0,K):D===null?a(D):Fe(D)?(c=he,F(D)):(e.consume(D),he)}function te(D){return D===null||D===34||D===39||D===60||D===61||D===96?a(D):D===47||D===62||Ot(D)?V(D):(e.consume(D),te)}function K(D){return D===47||D===62||Ot(D)?V(D):a(D)}function G(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):a(D)}function F(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),$}function $(D){return it(D)?ht(e,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):q(D)}function q(D){return e.enter("htmlTextData"),c(D)}}const rp={name:"labelEnd",resolveAll:aR,resolveTo:sR,tokenize:rR},eR={tokenize:iR},tR={tokenize:lR},nR={tokenize:oR};function aR(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 sR(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=Ra(f,e.slice(u+1,u+r+3)),f=Ra(f,[["enter",b,t]]),f=Ra(f,nd(t.parser.constructs.insideSpan.null,e.slice(u+r+4,c-3),t)),f=Ra(f,[["exit",b,t],e[c-2],e[c-1],["exit",h,t]]),f=Ra(f,e.slice(c+1)),f=Ra(f,[["exit",m,t]]),xa(e,u,e.length,f),e}function rR(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(Fa(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(eR,b,c?b:g)(y):y===91?e.attempt(tR,b,c?h:g)(y):c?b(y):g(y)}function h(y){return e.attempt(nR,b,g)(y)}function b(y){return t(y)}function g(y){return u._balanced=!0,a(y)}}function iR(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)?fo(e,u)(g):u(g)}function u(g){return g===41?b(g):xN(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Ot(g)?fo(e,m)(g):b(g)}function f(g){return a(g)}function m(g){return g===34||g===39||g===40?yN(e,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):b(g)}function h(g){return Ot(g)?fo(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 lR(e,t,a){const r=this;return o;function o(f){return EN.call(r,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return r.parser.defined.includes(Fa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(f):a(f)}function c(f){return a(f)}}function oR(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 uR={name:"labelStartImage",resolveAll:rp.resolveAll,tokenize:cR};function cR(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 dR={name:"labelStartLink",resolveAll:rp.resolveAll,tokenize:fR};function fR(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 km={name:"lineEnding",tokenize:mR};function mR(e,t){return a;function a(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ht(e,t,"linePrefix")}}const yc={name:"thematicBreak",tokenize:hR};function hR(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)?ht(e,f,"whitespace")(h):f(h))}}const aa={continuation:{tokenize:xR},exit:yR,name:"list",tokenize:bR},pR={partial:!0,tokenize:NR},gR={partial:!0,tokenize:ER};function bR(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 S=r.containerState.type||(N===42||N===43||N===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||N===r.containerState.marker:ph(N)){if(r.containerState.type||(r.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),N===42||N===45?e.check(yc,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 ph(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(jo,r.interrupt?a:b,e.attempt(pR,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 xR(e,t,a){const r=this;return r.containerState._closeFlow=void 0,e.check(jo,o,u);function o(f){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ht(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(gR,t,c)(f))}function c(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,ht(e,e.attempt(aa,t,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function ER(e,t,a){const r=this;return ht(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 yR(e){e.exit(this.containerState.type)}function NR(e,t,a){const r=this;return ht(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 o1={name:"setextUnderline",resolveTo:TR,tokenize:_R};function TR(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 _R(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)?ht(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):a(h)}}const vR={tokenize:SR};function SR(e){const t=this,a=e.attempt(jo,r,e.attempt(this.parser.constructs.flowInitial,o,ht(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Rk,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 AR={resolveAll:TN()},wR=NN("string"),CR=NN("text");function NN(e){return{resolveAll:TN(e==="text"?kR: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 TN(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 kR(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 RR={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:hN},OR={91:Dk},IR={[-2]:Cm,[-1]:Cm,32:Cm},MR={35:Fk,42:yc,45:[o1,yc],60:Yk,61:o1,95:yc,96:i1,126:i1},LR={38:gN,92:pN},DR={[-5]:km,[-4]:km,[-3]:km,33:uR,38:gN,42:gh,60:[dk,Zk],91:dR,92:[Uk,pN],93:rp,95:gh,96:vk},jR={null:[gh,AR]},BR={null:[42,95]},PR={null:[]},UR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:BR,contentInitial:OR,disable:PR,document:RR,flow:MR,flowInitial:IR,insideSpan:jR,string:LR,text:DR},Symbol.toStringTag,{value:"Module"}));function HR(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:z(O),check:z(P),consume:M,enter:k,exit:L,interrupt:z(P,{interrupt:!0})},h={code:null,containerState:{},defineSkip:A,events:[],now:S,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(ee){return c=Ra(c,ee),w(),c[c.length-1]!==null?[]:(J(t,0),h.events=nd(u,h.events,h),h.events)}function y(ee,se){return zR(N(ee),se)}function N(ee){return FR(c,ee)}function S(){const{_bufferIndex:ee,_index:se,line:he,column:te,offset:K}=r;return{_bufferIndex:ee,_index:se,line:he,column:te,offset:K}}function A(ee){o[ee.line]=ee.column,j()}function w(){let ee;for(;r._index<c.length;){const se=c[r._index];if(typeof se=="string")for(ee=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ee&&r._bufferIndex<se.length;)_(se.charCodeAt(r._bufferIndex));else _(se)}}function _(ee){b=b(ee)}function M(ee){Fe(ee)?(r.line++,r.column=1,r.offset+=ee===-3?2:1,j()):ee!==-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=ee}function k(ee,se){const he=se||{};return he.type=ee,he.start=S(),h.events.push(["enter",he,h]),f.push(he),he}function L(ee){const se=f.pop();return se.end=S(),h.events.push(["exit",se,h]),se}function O(ee,se){J(ee,se.from)}function P(ee,se){se.restore()}function z(ee,se){return he;function he(te,K,G){let F,$,q,D;return Array.isArray(te)?W(te):"tokenize"in te?W([te]):I(te);function I(B){return pe;function pe(Re){const De=Re!==null&&B[Re],lt=Re!==null&&B.null,Bt=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(lt)?lt:lt?[lt]:[]];return W(Bt)(Re)}}function W(B){return F=B,$=0,B.length===0?G:C(B[$])}function C(B){return pe;function pe(Re){return D=V(),q=B,B.partial||(h.currentConstruct=B),B.name&&h.parser.constructs.disable.null.includes(B.name)?_e():B.tokenize.call(se?Object.assign(Object.create(h),se):h,m,de,_e)(Re)}}function de(B){return ee(q,D),K}function _e(B){return D.restore(),++$<F.length?C(F[$]):G}}}function J(ee,se){ee.resolveAll&&!u.includes(ee)&&u.push(ee),ee.resolve&&xa(h.events,se,h.events.length-se,ee.resolve(h.events.slice(se),h)),ee.resolveTo&&(h.events=ee.resolveTo(h.events,h))}function V(){const ee=S(),se=h.previous,he=h.currentConstruct,te=h.events.length,K=Array.from(f);return{from:te,restore:G};function G(){r=ee,h.previous=se,h.currentConstruct=he,h.events.length=te,f=K,j()}}function j(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function FR(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 zR(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=`
@@ -500,7 +500,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
500
500
  `))}function m(N,S,A,w){const _=A.enter("tableCell"),M=A.enter("phrasing"),k=A.containerPhrasing(N,{...w,before:u,after:u});return M(),_(),k}function h(N,S){return aI(N,{align:S,alignDelimiters:r,padding:a,stringLength:o})}function b(N,S,A){const w=N.children;let _=-1;const M=[],k=S.enter("table");for(;++_<w.length;)M[_]=g(w[_],S,A);return k(),M}function g(N,S,A){const w=N.children;let _=-1;const M=[],k=S.enter("tableRow");for(;++_<w.length;)M[_]=m(w[_],N,S,A);return k(),M}function y(N,S,A){let w=XN.inlineCode(N,S,A);return A.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function qI(){return{exit:{taskListCheckValueChecked:I1,taskListCheckValueUnchecked:I1,paragraph:GI}}}function YI(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KI}}}function I1(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function GI(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 KI(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=XN.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 VI(){return[AO(),KO(),WO(),BI(),qI()]}function XI(e){return{extensions:[wO(),VO(e),ZO(),$I(e),YI()]}}const QI={tokenize:n6,partial:!0},QN={tokenize:a6,partial:!0},WN={tokenize:s6,partial:!0},ZN={tokenize:r6,partial:!0},WI={tokenize:i6,partial:!0},JN={name:"wwwAutolink",tokenize:e6,previous:tT},eT={name:"protocolAutolink",tokenize:t6,previous:nT},Cs={name:"emailAutolink",tokenize:JI,previous:aT},ns={};function ZI(){return{text:ns}}let Mr=48;for(;Mr<123;)ns[Mr]=Cs,Mr++,Mr===58?Mr=65:Mr===91&&(Mr=97);ns[43]=Cs;ns[45]=Cs;ns[46]=Cs;ns[95]=Cs;ns[72]=[Cs,eT];ns[104]=[Cs,eT];ns[87]=[Cs,JN];ns[119]=[Cs,JN];function JI(e,t,a){const r=this;let o,u;return c;function c(g){return!Nh(g)||!aT.call(r,r.previous)||mp(r.events)?a(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Nh(g)?(e.consume(g),f):g===64?(e.consume(g),m):a(g)}function m(g){return g===46?e.check(WI,b,h)(g):g===45||g===95||On(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 e6(e,t,a){const r=this;return o;function o(c){return c!==87&&c!==119||!tT.call(r,r.previous)||mp(r.events)?a(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(QI,e.attempt(QN,e.attempt(WN,u),a),a)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function t6(e,t,a){const r=this;let o="",u=!1;return c;function c(g){return(g===72||g===104)&&nT.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||Rc(g)||Ot(g)||qr(g)||td(g)?a(g):e.attempt(QN,e.attempt(WN,b),a)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function n6(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 a6(e,t,a){let r,o,u;return c;function c(h){return h===46||h===95?e.check(ZN,m,f)(h):h===null||Ot(h)||qr(h)||h!==45&&td(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 s6(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(ZN,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 r6(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 i6(e,t,a){return r;function r(u){return e.consume(u),o}function o(u){return On(u)?a(u):t(u)}}function tT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ot(e)}function nT(e){return!Fn(e)}function aT(e){return!(e===47||Nh(e))}function Nh(e){return e===43||e===45||e===46||e===95||On(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 l6={tokenize:p6,partial:!0};function o6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:f6,continuation:{tokenize:m6},exit:h6}},text:{91:{name:"gfmFootnoteCall",tokenize:d6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:u6,resolveTo:c6}}}}function u6(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=Fa(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 c6(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 d6(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(Fa(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 f6(e,t,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",b):a(S)}function b(S){if(c>999||S===93&&!f||S===null||S===91||Ot(S))return a(S);if(S===93){e.exit("chunkString");const A=e.exit("gfmFootnoteDefinitionLabelString");return u=Fa(r.sliceSerialize(A)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Ot(S)||(f=!0),c++,e.consume(S),S===92?g:b}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,b):b(S)}function y(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),o.includes(u)||o.push(u),ht(e,N,"gfmFootnoteDefinitionWhitespace")):a(S)}function N(S){return t(S)}}function m6(e,t,a){return e.check(jo,t,e.attempt(l6,t,a))}function h6(e){e.exit("gfmFootnoteDefinition")}function p6(e,t,a){const r=this;return ht(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 g6(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,nd(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(S){return h===126&&b[b.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),N(S))}function N(S){const A=Gi(h);if(S===126)return g>1?m(S):(c.consume(S),g++,N);if(g<2&&!a)return m(S);const w=c.exit("strikethroughSequenceTemporary"),_=Gi(S);return w._open=!_||_===2&&!!A,w._close=!A||A===2&&!!_,f(S)}}}class b6{constructor(){this.map=[]}add(t,a,r){x6(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 x6(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 E6(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 y6(){return{flow:{null:{name:"table",tokenize:N6,resolveAll:T6}}}}function N6(e,t,a){const r=this;let o=0,u=0,c;return f;function f(j){let ee=r.events.length-1;for(;ee>-1;){const te=r.events[ee][1].type;if(te==="lineEnding"||te==="linePrefix")ee--;else break}const se=ee>-1?r.events[ee][1].type:null,he=se==="tableHead"||se==="tableRow"?P:m;return he===P&&r.parser.lazy[r.now().line]?a(j):he(j)}function m(j){return e.enter("tableHead"),e.enter("tableRow"),h(j)}function h(j){return j===124||(c=!0,u+=1),b(j)}function b(j){return j===null?a(j):Fe(j)?u>1?(u=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),N):a(j):it(j)?ht(e,b,"whitespace")(j):(u+=1,c&&(c=!1,o+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(j)))}function g(j){return j===null||j===124||Ot(j)?(e.exit("data"),b(j)):(e.consume(j),j===92?y:g)}function y(j){return j===92||j===124?(e.consume(j),g):g(j)}function N(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(j):(e.enter("tableDelimiterRow"),c=!1,it(j)?ht(e,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):S(j))}function S(j){return j===45||j===58?w(j):j===124?(c=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),A):O(j)}function A(j){return it(j)?ht(e,w,"whitespace")(j):w(j)}function w(j){return j===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),_):j===45?(u+=1,_(j)):j===null||Fe(j)?L(j):O(j)}function _(j){return j===45?(e.enter("tableDelimiterFiller"),M(j)):O(j)}function M(j){return j===45?(e.consume(j),M):j===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(j))}function k(j){return it(j)?ht(e,L,"whitespace")(j):L(j)}function L(j){return j===124?S(j):j===null||Fe(j)?!c||o!==u?O(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):O(j)}function O(j){return a(j)}function P(j){return e.enter("tableRow"),z(j)}function z(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),z):j===null||Fe(j)?(e.exit("tableRow"),t(j)):it(j)?ht(e,z,"whitespace")(j):(e.enter("data"),J(j))}function J(j){return j===null||j===124||Ot(j)?(e.exit("data"),z(j)):(e.consume(j),j===92?V:J)}function V(j){return j===92||j===124?(e.consume(j),J):J(j)}}function T6(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 b6;for(;++a<e.length;){const N=e[a],S=N[1];N[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(M1(y,t,m,h,b),b=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},y.add(a,0,[["enter",h,t]])):S.type==="tableRow"||S.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({},S.start),end:Object.assign({},S.end)},y.add(a,0,[["enter",b,t]])),o=S.type==="tableDelimiterRow"?2:b?3:1):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(r=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=cc(y,t,u,o,void 0,g),u=[0,0,0,0]),c[2]=a)):S.type==="tableCellDivider"&&(r?r=!1:(u[1]!==0&&(c[0]=c[1],g=cc(y,t,u,o,void 0,g)),u=c,c=[u[1],a,0,0])):S.type==="tableHead"?(f=!0,m=a):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=a,u[1]!==0?(c[0]=c[1],g=cc(y,t,u,o,a,g)):c[1]!==0&&(g=cc(y,t,c,o,a,g)),o=0):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=a)}for(m!==0&&M1(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=E6(t.events,a))}return e}function cc(e,t,a,r,o,u){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";a[0]!==0&&(u.end=Object.assign({},Ui(t.events,a[0])),e.add(a[0],0,[["exit",u,t]]));const m=Ui(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=Ui(t.events,a[2]),b=Ui(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 S=a[2]+1,A=a[3]-a[2]-1;e.add(S,A,[])}}e.add(a[3]+1,0,[["exit",g,t]])}return o!==void 0&&(u.end=Object.assign({},Ui(t.events,o)),e.add(o,0,[["exit",u,t]]),u=void 0),u}function M1(e,t,a,r,o){const u=[],c=Ui(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 Ui(e,t){const a=e[t],r=a[0]==="enter"?"start":"end";return a[1][r]}const _6={name:"tasklistCheck",tokenize:S6};function v6(){return{text:{91:_6}}}function S6(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:A6},t,a)(m):a(m)}}function A6(e,t,a){return ht(e,r,"whitespace");function r(o){return o===null?a(o):t(o)}}function w6(e){return fN([ZI(),o6(),g6(e),y6(),v6()])}const C6={};function Gr(e){const t=this,a=e||C6,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(w6(a)),u.push(VI()),c.push(XI(a))}const k6=new Set(["tool","tool-use","tool_use","tool-call","tool_call","tool-result","tool_result"]),R6=new Set(["thinking","reasoning","reason"]),O6=new Set(["text","output_text","message"]),I6=new Set(["file","image"]);function Mc(e){var a;const t=((a=e.type)==null?void 0:a.toLowerCase())??"";return k6.has(t)||e.toolName!=null||e.tool!=null?"tool":I6.has(t)?"file":R6.has(t)?"thinking":O6.has(t)||e.content!=null||e.text!=null?"text":"other"}function Lc(e){return e.content??e.text??""}function sT(e){return e.toolName??e.tool??"tool"}function rd(e){var t;return e.input??((t=e.state)==null?void 0:t.input)}function hp(e){var t;return e.output??((t=e.state)==null?void 0:t.output)}function pp(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":hp(e)!=null?"completed":"running"}function L1(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Kr(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 rT(e){return e.filter(t=>Kr(t.status)==="completed").length}function So(e){const t=sT(e).toLowerCase();return t==="question"||t==="mcp_question"}function M6(e){const t=rd(e);if(!t||typeof t!="object")return null;const a=t;return Array.isArray(a.questions)?a.questions:null}function Dc(e){if(!So(e))return!1;const t=pp(e);return t==="pending"||t==="running"}const L6=/\bses_[a-zA-Z0-9]+/;function D6(e){var o;const t=rd(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=hp(e);if(typeof r=="string"){const u=L6.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 j6=es(()=>({agents:[],loaded:!1}));function iT(e){return`question-${e}`}function zm(e,t){const a=t.find(o=>o.id===e),r=(a==null?void 0:a.title)||e.slice(-8);Gt.getState().addToast(`${r} — 等待回复`,"warning",e,{id:iT(e),persistent:!0})}function B6(e){var t;for(const a of e)if((t=a.parts)!=null&&t.some(r=>So(r)&&Dc(r)))return!0;return!1}const Ao=[],wo=[],D1=[],Lr={};function j1(e){return e.id??e.callID}function Rn(){return Le.getState().activeRepoId}async function B1(e,t){const a=Rn();if(a)try{const[r,o]=await Promise.all([l5(a,e),Py(a).catch(()=>null)]);t(u=>{const c={sessionLinks:{...u.sessionLinks,[e]:r}};return o&&(c.allSessionLinks=o),c})}catch{}}const P1=20,Oe=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=Rn();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 B5(r,a,u)}catch{await t().loadSessions()}},loadSessions:async()=>{const a=Rn();if(!a){e({sessions:[],loadingSessions:!1});return}e({loadingSessions:!0,loadError:null});try{const[r,o]=await Promise.all([Zw(a),Py(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=Rn();if(!h)return null;e({sendError:null});try{const b=await Jw(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"),c&&Gt.getState().addToast("已自动分配为处理人","success"),b}catch(b){return e({sendError:b instanceof Error?b.message:"Failed to create session"}),null}},setActiveSession:async a=>{Rn()&&(e({activeSessionId:a,sendError:null}),await t().refreshSessionData(a))},refreshSessionData:async a=>{var b,g;const r=Rn();if(!r)return;const u=!t().messages[a]||t().messages[a].length===0?{limit:P1}:void 0,[c,f]=await Promise.allSettled([o5(r,a),Cx(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(S=>S.id===a?{...S,...m.session}:S))),f.status==="fulfilled"){let S=f.value.messages;if(h){const w=S.findIndex(_=>_.id===h);w>=0&&(S=S.slice(0,w+1))}const A=y.messages[a]??[];S.length>=A.length&&(N.messages={...y.messages,[a]:S}),N.messagesMeta={...y.messagesMeta,[a]:{total:Math.max(f.value.total,A.length),hasMore:f.value.hasMore,loading:!1}}}return N}),f.status==="fulfilled"&&B6(f.value.messages)&&zm(a,t().sessions)},loadMoreMessages:async a=>{var f;const r=Rn();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 Cx(r,a,{limit:P1,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=Rn();if(!u)return!1;try{return await u5(u,a,r,o),await B1(a,e),!0}catch{return!1}},removeLink:async(a,r,o)=>{const u=Rn();if(!u)return!1;try{return await c5(u,a,r,o),await B1(a,e),!0}catch{return!1}},deleteSession:async a=>{const r=Rn();if(r)try{await e5(r,a)}catch{}delete Lr[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,...S}=o.errorReasons,{[a]:A,...w}=o.queuedMessageIds,{[a]:_,...M}=o.sessionLinks,{[a]:k,...L}=o.allSessionLinks;return{sessions:o.sessions.filter(O=>O.id!==a),messages:c,messagesMeta:m,todos:b,sessionStatuses:y,errorReasons:S,queuedMessageIds:w,sessionLinks:M,allSessionLinks:L,activeSessionId:o.activeSessionId===a?null:o.activeSessionId}})},sendMessage:async(a,r,o,u)=>{const c=Rn(),f=t().activeSessionId;if(!c||!f)return!1;const m=t().sessions.find(b=>b.id===f),h=t().sessionStatuses[f]==="busy";e({sendError:null}),m!=null&&m.completedAt&&e(b=>({sessions:b.sessions.map(g=>g.id===f?{...g,completedAt:void 0}:g)})),h||t().setSessionStatus(f,"busy");try{const b=j6.getState(),g=m!=null&&m.agent&&b.loaded&&b.agents.some(y=>y.name===m.agent||y.id===m.agent)?m.agent:void 0;return await t5(c,f,a,g,r,o,u),h&&(Lr[f]=(Lr[f]||0)+1),!0}catch(b){return e({sendError:b instanceof Error?b.message:"Failed to send message"}),h||t().setSessionStatus(f,"idle"),!1}},replyQuestion:async a=>{const r=Rn(),o=t().activeSessionId;if(!(!r||!o))try{await a5(r,o,a)}catch(u){e({sendError:u instanceof Error?u.message:"Failed to reply to question"})}},rejectQuestion:async()=>{const a=Rn(),r=t().activeSessionId;if(!(!a||!r))try{await s5(a,r)}catch{}},abortSession:async()=>{const a=Rn(),r=t().activeSessionId;if(!(!a||!r)){try{await n5(a,r)}catch{}t().setSessionStatus(r,"idle")}},clearSessions:()=>{for(const a of Object.keys(Lr))delete Lr[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=Lr[a]||0;if(r.role==="user"&&y>0){const N=[...h[a]??[]];N.push(r.id),h={...h,[a]:N},Lr[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=>So(u)&&Dc(u))&&zm(a,t().sessions)},updateMessagePart:(a,r,o)=>{e(u=>{const c=u.messages[a]??[],f=c.findIndex(S=>S.id===r),m=f>=0?c[f]:{id:r,role:"assistant"},h=m.parts?[...m.parts]:[],b=j1(o),g=b!=null?h.findIndex(S=>j1(S)===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}}}),So(o)&&Dc(o)&&zm(a,t().sessions)},appendMessagePartDelta:(a,r,o,u)=>{e(c=>{const f=c.messages[a]??[],m=f.findIndex(S=>S.id===r),h=m>=0?f[m]:{id:r,role:"assistant"},b=h.parts?[...h.parts]:[],g=b.findIndex(S=>S.id===o);if(g>=0){const S=b[g],A=Lc(S)+u;b[g]=S.content!=null?{...S,content:A}:{...S,text:A}}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")Gt.getState().removeToast(iT(a)),Gt.getState().addToast(`${f} — 完成`,"success",a);else if(r==="busy"&&(u===void 0||u==="idle"))Gt.getState().addToast(`${f} — 开始运行`,"info",a);else if(r==="retry")Gt.getState().addToast(`${f} — 进入重试`,"warning",a);else if(r==="error"){const m=o?`${f} — 错误: ${o}`:`${f} — 发生错误`;Gt.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=Rn();if(o){e(u=>({sessions:u.sessions.map(c=>c.id===a?{...c,title:r}:c)}));try{await j5(o,a,r)}catch{await t().loadSessions()}}},revertToMessage:async(a,r)=>{const o=Rn();if(!o)return!1;try{return await r5(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=Le.getState().activeRepoId;if(!o)return!1;try{await v5(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=Le.getState().activeRepoId;if(!o)return!1;try{const u=await qy(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=Le.getState().activeRepoId;if(!a){e({issues:[],loaded:!0});return}try{const r=await Mx(a,"all");e({issues:r,loaded:!0})}catch{e({loaded:!0})}},syncIssues:async()=>{const a=Le.getState().activeRepoId;if(a){e({syncing:!0});try{await T5(a,"open");const[r,o,u]=await Promise.all([Mx(a,"all"),Ox(a),Ix(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)}Gt.getState().addToast(o,"error")}}},createIssue:async(a,r)=>{const o=Le.getState().activeRepoId;if(!o)return null;try{const u=await _5(o,a,r);return e(c=>({issues:[u,...c.issues]})),u}catch{return null}},loadTags:async()=>{const a=Le.getState().activeRepoId;if(!a){e({tags:[]});return}try{const r=await Ox(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=Le.getState().activeRepoId;if(!a){e({milestones:[]});return}try{const r=await Ix(a);e({milestones:r})}catch{}},setMilestoneFilter:a=>e({selectedMilestoneId:a})})),Nc=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}})})),P6=5*1024*1024,U1=10,lT=["image/png","image/jpeg","image/gif","image/webp"],U6=5,H6=500;let H1=0;function oT(e){return e.split(`
501
501
  `).length>U6||e.length>H6}function F6(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function z6(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 $6({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 gp({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($6,{url:e,label:t,onClose:()=>o(!1)})]})}function uT(e=!0){const[t,a]=T.useState([]),[r,o]=T.useState([]),[u,c]=T.useState(null);T.useEffect(()=>{c(null),e||a([])},[e]);const f=async A=>{const w=[],_=[],M=t.length;let k=U1-M;for(const L of A){if(k<=0){_.push(`最多 ${U1} 张图片`);break}if(!lT.includes(L.type)){_.push(`${L.name||"文件"}:格式不支持`);continue}if(L.size>P6){_.push(`${L.name}:超过 5MB`);continue}w.push({_id:`att-${++H1}`,mime:L.type,url:await z6(L),filename:L.name}),k--}w.length>0&&a(L=>[...L,...w]),c(_.length>0?_.join(";"):null)},m=A=>{const w=Array.from(A.clipboardData.files);if(w.length!==0){if(A.preventDefault(),!e){c("当前模型不支持图片");return}f(w)}},h=A=>{const w=++H1,_=A.split(`
502
502
  `).length,M=new TextEncoder().encode(A).byteLength,k=`[粘贴文本 #${w} · ${_}行]`,L={_id:`fold-${w}`,text:A,lineCount:_,byteSize:M,placeholder:k};return o(O=>[...O,L]),L},b=A=>{let w=A;for(const _ of r)w=w.replace(_.placeholder,_.text);return w},g=A=>a(w=>w.filter(_=>_._id!==A)),y=A=>o(w=>w.filter(_=>_._id!==A)),N=T.useCallback(()=>{a([]),o([]),c(null)},[]),S=t.map(({mime:A,url:w,filename:_})=>({mime:A,url:w,filename:_}));return{attachments:t,foldedTexts:r,promptFiles:S,error:u,setError:c,addFiles:f,onPaste:m,addFoldedText:h,expandFoldedTexts:b,remove:g,removeFoldedText:y,clear:N}}function q6({text:e,label:t,onClose:a}){T.useEffect(()=>{const u=c=>{c.key==="Escape"&&(c.preventDefault(),a())};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[a]);const r=e.split(`
503
- `),o=String(r.length).length;return i.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t,onClick:a,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 backdrop-blur-sm md:p-8",children:i.jsxs("div",{onClick:u=>u.stopPropagation(),className:"flex max-h-full w-full max-w-4xl flex-col overflow-hidden rounded-lg border border-line bg-term",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-line px-4 py-2",children:[i.jsx("span",{className:"font-mono text-xs text-fg-3",children:t}),i.jsx("button",{type:"button",onClick:a,className:"text-fg-5 hover:text-fg-2",children:i.jsx(dt,{className:"h-4 w-4"})})]}),i.jsx("pre",{className:"overflow-auto p-4 font-mono text-xs leading-relaxed text-fg-2",children:r.map((u,c)=>i.jsxs("div",{children:[i.jsx("span",{className:"mr-3 inline-block select-none text-right text-fg-6",style:{width:`${o}ch`},children:c+1}),u]},c))})]})})}function Y6({fold:e,index:t,onRemove:a}){const[r,o]=T.useState(!1),u=`粘贴文本 #${t} · ${e.lineCount}行 · ${F6(e.byteSize)}`;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"group relative flex items-center gap-1.5 rounded-md border border-line bg-elevated/50 px-2.5 py-1.5",children:[i.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex items-center gap-1.5 font-mono text-xs text-fg-3 transition-colors hover:text-fg",children:[i.jsx(ur,{className:"h-3.5 w-3.5 shrink-0 text-fg-5"}),i.jsx("span",{children:u})]}),i.jsx("button",{type:"button",onClick:a,"aria-label":"移除粘贴文本",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-fg-5 transition-colors hover:text-fg-2",children:i.jsx(dt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]}),r&&i.jsx(q6,{text:e.text,label:u,onClose:()=>o(!1)})]})}function cT({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:lT.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(jA,{className:"h-4 w-4"})})]})}function dT({attachments:e,foldedTexts:t,error:a,onRemove:r,onRemoveFoldedText:o,className:u}){const c=e.length>0||(t??[]).length>0;return!c&&!a?null:i.jsxs("div",{className:u,children:[c&&i.jsxs("div",{className:"mb-2 flex flex-wrap gap-2",children:[e.map(f=>i.jsxs("div",{className:"group relative",children:[i.jsx(gp,{url:f.url,label:f.filename??"attachment",className:"h-16 w-16 object-cover"}),i.jsx("button",{type:"button",onClick:()=>r(f._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(dt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]},f._id)),(t??[]).map((f,m)=>i.jsx(Y6,{fold:f,index:m+1,onRemove:()=>o==null?void 0:o(f._id)},f._id))]}),a&&i.jsx("div",{className:"mb-2 font-mono text-[11px] text-red-400",children:a})]})}function fT({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(XA,{className:ae("h-6 w-6 sm:h-4 sm:w-4",e&&"animate-pulse")})})}const G6=[.85,1.25,.65,1.4,.75,1.15,.95],$m=4,F1=24;function K6(e){const t=Math.floor(e/60).toString().padStart(2,"0"),a=Math.floor(e%60).toString().padStart(2,"0");return`${t}:${a}`}function V6({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:G6.map((a,r)=>{const o=$m+t*a*(F1-$m),u=Math.max($m,Math.min(F1,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 mT({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(un,{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 hT({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(No,{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(V6,{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:K6(a)})]}):i.jsxs(i.Fragment,{children:[i.jsx(un,{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 Vi;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Vi||(Vi={}));class qm extends Error{constructor(t,a,r){super(t),this.message=t,this.code=a,this.data=r}}const X6=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"},Q6=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},r=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:X6(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 S=o(),A=f(g);let w;const _=async()=>(!w&&S in y?w=typeof y[S]=="function"?w=await y[S]():w=y[S]:t!==null&&!w&&"web"in y&&(w=typeof y.web=="function"?w=await y.web():w=y.web),w),M=(J,V)=>{var j,ee;if(A){const se=A==null?void 0:A.methods.find(he=>V===he.name);if(se)return se.rtype==="promise"?he=>a.nativePromise(g,V.toString(),he):(he,te)=>a.nativeCallback(g,V.toString(),he,te);if(J)return(j=J[V])===null||j===void 0?void 0:j.bind(J)}else{if(J)return(ee=J[V])===null||ee===void 0?void 0:ee.bind(J);throw new qm(`"${g}" plugin is not implemented on ${S}`,Vi.Unimplemented)}},k=J=>{let V;const j=(...ee)=>{const se=_().then(he=>{const te=M(he,J);if(te){const K=te(...ee);return V=K==null?void 0:K.remove,K}else throw new qm(`"${g}.${J}()" is not implemented on ${S}`,Vi.Unimplemented)});return J==="addListener"&&(se.remove=async()=>V()),se};return j.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(j,"name",{value:J,writable:!1,configurable:!1}),j},L=k("addListener"),O=k("removeListener"),P=(J,V)=>{const j=L({eventName:J},V),ee=async()=>{const he=await j;O({eventName:J,callbackId:he},V)},se=new Promise(he=>j.then(()=>he({remove:ee})));return se.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ee()},se},z=new Proxy({},{get(J,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return A?P:L;case"removeListener":return O;default:return k(V)}}});return r[g]=z,h.set(g,{name:g,proxy:z,platforms:new Set([...Object.keys(y),...A?[S]:[]])}),z};return a.convertFileSrc||(a.convertFileSrc=g=>g),a.getPlatform=o,a.handleError=m,a.isNativePlatform=u,a.isPluginAvailable=c,a.registerPlugin=b,a.Exception=qm,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},W6=e=>e.Capacitor=Q6(e),jc=W6(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Ho=jc.registerPlugin;class bp{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 jc.Exception(t,Vi.Unimplemented)}unavailable(t="not available"){return new jc.Exception(t,Vi.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 z1=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),$1=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Z6 extends bp{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=$1(o).trim(),u=$1(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=z1(t.key),r=z1(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)}}}Ho("CapacitorCookies",{web:()=>new Z6});const J6=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)}),eM=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,c)=>(o[u]=e[t[c]],o),{})},tM=(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,nM=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=eM(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 aM extends bp{async request(t){const a=nM(t,t.webFetchExtra),r=tM(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 J6(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"}))}}Ho("CapacitorHttp",{web:()=>new aM});var q1;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(q1||(q1={}));var Y1;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(Y1||(Y1={}));class sM extends bp{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")}}Ho("SystemBars",{web:()=>new sM});const rM="modulepreload",iM=function(e){return"/"+e},G1={},lM=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=iM(h),h in G1)return;G1[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":rM,b||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),b)return new Promise((N,S)=>{y.addEventListener("load",N),y.addEventListener("error",()=>S(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)})},Pi=Ho("SpeechRecognition",{web:()=>lM(()=>import("./web-B2e7vjit.js"),[]).then(e=>new e.SpeechRecognitionWeb)});function oM(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 Th=jc.isNativePlatform(),Ym=!Th&&typeof window<"u"?window.SpeechRecognition??window.webkitSpeechRecognition:void 0,Gm=16e3;function uM(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),S=T.useRef(!1),A=T.useRef([]),w=T.useRef(!1),_=T.useRef(null),M=T.useRef(!1),k=T.useRef(""),L=T.useRef(null),O=T.useRef(null),P=T.useRef(null),z=T.useRef([]),J=T.useRef(!1),V=!0,j=T.useCallback(async()=>{var C,de,_e;(C=P.current)==null||C.disconnect(),(de=O.current)==null||de.getTracks().forEach(B=>B.stop()),await((_e=L.current)==null?void 0:_e.close().catch(()=>{}));const F=z.current;if(z.current=[],P.current=null,O.current=null,L.current=null,F.length===0||J.current){a(!1),y("idle");return}c("识别中…"),y("recognizing");const $=F.reduce((B,pe)=>B+pe.length,0),q=new Float32Array($);let D=0;for(const B of F)q.set(B,D),D+=B.length;const I=oM(q,Gm),W=new FormData;W.append("audio",I,"recording.wav");try{const B=await fetch("/api/transcribe",{method:"POST",body:W});if(J.current)return;if(B.ok){const{text:pe}=await B.json();pe?(o(pe),y("done")):y("idle")}else{const pe=await B.json().catch(()=>({error:`HTTP ${B.status}`}));m(pe.error??`HTTP ${B.status}`),y("idle")}}catch(B){m(`语音识别失败:${B instanceof Error?B.message:String(B)}`),y("idle")}finally{c(""),a(!1)}},[]),ee=T.useCallback(async()=>{if(S.current=!0,_.current&&(clearTimeout(_.current),_.current=null),Th){await Pi.stop().catch(()=>{});for(const F of A.current)await F.remove().catch(()=>{});A.current=[],a(!1),c("")}else N.current?N.current.stop():L.current?await j():(a(!1),y("idle"))},[j]),se=T.useCallback(async()=>{var D;J.current=!1,o(""),c(""),m(null),y("idle");const{available:F}=await Pi.available();if(!F){m("当前设备不支持语音识别");return}if((await Pi.requestPermissions()).speechRecognition!=="granted"){m("请允许语音识别权限");return}const q=[];q.push(await Pi.addListener("partialResults",I=>{c(I.matches[0]??"")})),q.push(await Pi.addListener("listeningState",I=>{const W=I.status==="started";a(W),W&&y("recording"),W||c("")})),A.current=q;try{const I=await Pi.start({language:e,partialResults:!0,maxResults:1});(D=I.matches)!=null&&D.length&&o(W=>W+I.matches.join(""))}catch(I){m(`语音识别错误:${I instanceof Error?I.message:String(I)}`);for(const W of q)await W.remove().catch(()=>{});A.current=[]}},[e]),he=T.useCallback(()=>{if(!Ym)return!1;J.current=!1,o(""),c(""),k.current="",m(null),y("idle"),S.current=!1;const F=new Ym;F.lang=e,F.continuous=!0,F.interimResults=!0,F.maxAlternatives=1,F.onstart=()=>{a(!0),y("recording"),w.current=!1,_.current=setTimeout(()=>{!w.current&&!S.current&&(M.current=!0,S.current=!0,F.stop(),m("语音识别服务不可用(Chrome/Edge 需连接 Google 服务器),下次将使用服务端识别"))},5e3)},F.onresult=$=>{w.current=!0,_.current&&(clearTimeout(_.current),_.current=null);let q="",D="";for(let I=$.resultIndex;I<$.results.length;I++){const W=$.results[I][0].transcript;$.results[I].isFinal?q+=W:D+=W}q&&o(I=>I+q),c(D),k.current=D},F.onerror=$=>{switch($.error!=="no-speech"&&$.error!=="aborted"&&(S.current=!0),$.error){case"not-allowed":m("请允许麦克风权限");break;case"network":m("网络错误,请检查连接");break;case"no-speech":case"aborted":return;default:m(`语音识别错误:${$.error}`)}},F.onend=()=>{if(S.current&&k.current&&o($=>$+k.current),c(""),k.current="",!S.current)try{F.start();return}catch{}a(!1),N.current=null},N.current=F;try{return F.start(),!0}catch{return!1}},[e]),te=T.useCallback(async()=>{J.current=!1,o(""),c(""),m(null),y("idle");try{const I=await fetch("/api/transcribe/status"),{available:W}=await I.json();if(!W){m("语音识别服务未就绪,请稍后重试");return}}catch{m("无法连接语音识别服务");return}let F;try{F=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:Gm,channelCount:1}})}catch{m("请允许麦克风权限");return}const $=new AudioContext({sampleRate:Gm}),q=$.createMediaStreamSource(F),D=$.createScriptProcessor(4096,1,1);z.current=[],D.onaudioprocess=I=>{z.current.push(new Float32Array(I.inputBuffer.getChannelData(0)))},q.connect(D),D.connect($.destination),L.current=$,O.current=F,P.current=D,a(!0),y("recording")},[]),K=T.useCallback(()=>{Th?se():Ym&&!M.current&&he()||te()},[se,he,te]);T.useEffect(()=>{if(!t){b(0);return}if(N.current)return;let F=!1,$=null,q=null,D=0;return(async()=>{try{if($=await navigator.mediaDevices.getUserMedia({audio:!0}),F){$.getTracks().forEach(B=>B.stop());return}q=new AudioContext;const I=q.createMediaStreamSource($),W=q.createAnalyser();W.fftSize=256,I.connect(W);const C=new Uint8Array(W.frequencyBinCount);let de=0;const _e=()=>{if(F)return;W.getByteFrequencyData(C);const B=performance.now();if(B-de>80){let pe=0;for(let Re=0;Re<C.length;Re++)pe+=C[Re];b(pe/(C.length*255)),de=B}D=requestAnimationFrame(_e)};D=requestAnimationFrame(_e)}catch{}})(),()=>{F=!0,cancelAnimationFrame(D),$==null||$.getTracks().forEach(I=>I.stop()),q==null||q.close().catch(()=>{}),b(0)}},[t]),T.useEffect(()=>{!t&&g==="recording"&&y(r?"done":"idle")},[t,g,r]),T.useEffect(()=>()=>{var F,$,q,D;S.current=!0,(F=N.current)==null||F.stop(),($=P.current)==null||$.disconnect(),(q=O.current)==null||q.getTracks().forEach(I=>I.stop()),(D=L.current)==null||D.close().catch(()=>{});for(const I of A.current)I.remove().catch(()=>{})},[]);const G=T.useCallback(()=>{J.current=!0,o(""),c(""),k.current="",y("idle")},[]);return{isSupported:V,isListening:t,phase:g,transcript:r,interimTranscript:u,error:f,volumeLevel:h,start:K,stop:ee,resetTranscript:G}}const cM=240,dM=1e3;function pT(e){const t=uM(),[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))},dM)):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,cM)}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=Le.getState().activeRepoId;try{const a=t?await zy(t):await Uy();e({agents:a,loaded:!0})}catch{e({loaded:!0})}}}));function fM(e){if(typeof e!="string")return e;const t=e.trim();if(t)try{return JSON.parse(t)}catch{return t}}function gn(e){return e&&typeof e=="object"?e:null}function Qr(e){const t=gn(e);return t&&"properties"in t?t.properties:e}function mM(e){const t=gn(e);return typeof(t==null?void 0:t.type)=="string"?t.type:void 0}function hM(e){const t=gn(Qr(e));if(!t)return null;const a=gn(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=gn(t.message);return r&&typeof r.id=="string"?r:null}function pM(e){const t=gn(Qr(e));if(!t)return{};const a=gn(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 gM(e){const t=gn(Qr(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 bM(e){const t=Qr(e);if(Array.isArray(t))return t;const a=gn(t);return a&&Array.isArray(a.todos)?a.todos:[]}function Xa(e){return typeof e=="number"?e:0}function xM(e){const t=gn(Qr(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=gn(t.tokens),u=typeof t.tokens_input=="number"||typeof t.tokens_output=="number";if(o||u){const f=o?gn(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=gn(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=gn(Qr(e));if(!t)return null;if(typeof t.message=="string")return t.message;const a=gn(t.error);if(a){const r=gn(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 yM(e){const t=Qr(e);if(typeof t=="string")return t;const a=gn(t);if(typeof(a==null?void 0:a.status)=="string")return a.status;const r=gn(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===""?mM(t)??e:e){case"message.updated":{const u=hM(t);u&&r.updateMessage(a,u);break}case"session.updated":{const u=xM(t);u&&r.updateSessionInfo(u);break}case"message.part.updated":{const{messageId:u,part:c}=pM(t);c&&u&&r.updateMessagePart(a,u,c);break}case"message.part.delta":{const u=gM(t);u&&r.appendMessagePartDelta(a,u.messageId,u.partId,u.delta);break}case"todo.updated":{r.updateTodos(a,bM(t));break}case"session.status":{const u=yM(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 TM=600*1e3;class _M{constructor(t,a){ln(this,"sessionId");ln(this,"idleTimer",null);ln(this,"active",!1);ln(this,"alive",!0);ln(this,"callbacks");this.sessionId=t,this.callbacks=a,this.resetIdleTimer()}dispatch(t,a){if(!this.alive)return;this.resetIdleTimer();const r=Oe.getState();NM(t,a,this.sessionId,r)}activate(){this.active=!0,this.clearIdleTimer()}deactivate(){this.active=!1,this.resetIdleTimer()}refreshOnIdle(){Oe.getState().refreshSessionData(this.sessionId)}stop(){this.alive=!1,this.clearIdleTimer()}resetIdleTimer(){this.clearIdleTimer(),!this.active&&(this.idleTimer=setTimeout(()=>{this.callbacks.onWorkerIdle(this.sessionId)},TM))}clearIdleTimer(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}}const vM=1e3,SM=3e4;class AM{constructor(t,a){ln(this,"source",null);ln(this,"reconnectTimer",null);ln(this,"attempts",0);ln(this,"disposed",!1);ln(this,"repoId");ln(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=z5(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(vM*2**this.attempts,SM);this.attempts++,this.reconnectTimer=setTimeout(()=>this.connect(),o)}}}handleRaw(t,a){if(!(a instanceof MessageEvent))return;const r=fM(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 wM=6e4;class CM{constructor(t){ln(this,"timer",null);ln(this,"paused",!1);ln(this,"callbacks");this.callbacks=t}start(){this.tick(),this.timer=setInterval(()=>{this.paused||this.tick()},wM)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null)}pause(){this.paused=!0}resume(){this.paused=!1,this.tick()}tick(){const t=Le.getState().activeRepoId;t&&(Oe.getState().loadSessions(),$5(t).then(a=>{const r={};for(const[o,u]of Object.entries(a))r[o]=u.type??"idle";Oe.getState().bulkSetStatuses(r);for(const[o,u]of Object.entries(r))(u==="busy"||u==="retry")&&this.callbacks.ensureWorker(o)}).catch(()=>{}))}}class kM{constructor(){ln(this,"workers",new Map);ln(this,"dispatcher",null);ln(this,"supervisor",null);ln(this,"visibilityHandler",null)}start(t){this.stop();const a={onWorkerIdle:r=>this.removeWorker(r)};this.dispatcher=new AM(t,(r,o,u)=>{const c=this.ensureWorker(r,a);if(o==="session.idle"||o==="session.status"){const f=Oe.getState().sessionStatuses[r];c.dispatch(o,u);const m=Oe.getState().sessionStatuses[r];f&&f!=="idle"&&m==="idle"&&c.refreshOnIdle()}else c.dispatch(o,u)}),this.dispatcher.start(),this.supervisor=new CM({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(),Oe.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 _M(t,a),this.workers.set(t,r)),r}removeWorker(t){const a=Oe.getState().activeSessionId;if(t===a)return;const r=this.workers.get(t);r&&(r.stop(),this.workers.delete(t))}}const Bc=new kM,K1=(function(e,t,a){const r=Bo(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]}),Wr=(function(e){if(e==null)return IM;if(typeof e=="string")return OM(e);if(typeof e=="object")return RM(e);if(typeof e=="function")return xp(e);throw new Error("Expected function, string, or array as `test`")});function RM(e){const t=[];let a=-1;for(;++a<e.length;)t[a]=Wr(e[a]);return xp(r);function r(...o){let u=-1;for(;++u<t.length;)if(t[u].apply(this,o))return!0;return!1}}function OM(e){return xp(t);function t(a){return a.tagName===e}}function xp(e){return t;function t(a,r,o){return!!(MM(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function IM(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function MM(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const V1=/\n/g,X1=/[\t ]+/g,_h=Wr("br"),Q1=Wr(FM),LM=Wr("p"),W1=Wr("tr"),DM=Wr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",HM,zM]),gT=Wr(["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 jM(e,t){const a=t||{},r="children"in e?e.children:[],o=gT(e),u=ET(e,{whitespace:a.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...xT(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<r.length;)c.push(...bT(r[f],e,{whitespace:u,breakBefore:f?void 0:o,breakAfter:f<r.length-1?_h(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(`
503
+ `),o=String(r.length).length;return i.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t,onClick:a,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 backdrop-blur-sm md:p-8",children:i.jsxs("div",{onClick:u=>u.stopPropagation(),className:"flex max-h-full w-full max-w-4xl flex-col overflow-hidden rounded-lg border border-line bg-term",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-line px-4 py-2",children:[i.jsx("span",{className:"font-mono text-xs text-fg-3",children:t}),i.jsx("button",{type:"button",onClick:a,className:"text-fg-5 hover:text-fg-2",children:i.jsx(dt,{className:"h-4 w-4"})})]}),i.jsx("pre",{className:"overflow-auto p-4 font-mono text-xs leading-relaxed text-fg-2",children:r.map((u,c)=>i.jsxs("div",{children:[i.jsx("span",{className:"mr-3 inline-block select-none text-right text-fg-6",style:{width:`${o}ch`},children:c+1}),u]},c))})]})})}function Y6({fold:e,index:t,onRemove:a}){const[r,o]=T.useState(!1),u=`粘贴文本 #${t} · ${e.lineCount}行 · ${F6(e.byteSize)}`;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"group relative flex items-center gap-1.5 rounded-md border border-line bg-elevated/50 px-2.5 py-1.5",children:[i.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex items-center gap-1.5 font-mono text-xs text-fg-3 transition-colors hover:text-fg",children:[i.jsx(ur,{className:"h-3.5 w-3.5 shrink-0 text-fg-5"}),i.jsx("span",{children:u})]}),i.jsx("button",{type:"button",onClick:a,"aria-label":"移除粘贴文本",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-fg-5 transition-colors hover:text-fg-2",children:i.jsx(dt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]}),r&&i.jsx(q6,{text:e.text,label:u,onClose:()=>o(!1)})]})}function cT({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:lT.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(jA,{className:"h-4 w-4"})})]})}function dT({attachments:e,foldedTexts:t,error:a,onRemove:r,onRemoveFoldedText:o,className:u}){const c=e.length>0||(t??[]).length>0;return!c&&!a?null:i.jsxs("div",{className:u,children:[c&&i.jsxs("div",{className:"mb-2 flex flex-wrap gap-2",children:[e.map(f=>i.jsxs("div",{className:"group relative",children:[i.jsx(gp,{url:f.url,label:f.filename??"attachment",className:"h-16 w-16 object-cover"}),i.jsx("button",{type:"button",onClick:()=>r(f._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(dt,{className:"h-2.5 w-2.5",strokeWidth:2.5})})]},f._id)),(t??[]).map((f,m)=>i.jsx(Y6,{fold:f,index:m+1,onRemove:()=>o==null?void 0:o(f._id)},f._id))]}),a&&i.jsx("div",{className:"mb-2 font-mono text-[11px] text-red-400",children:a})]})}function fT({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(XA,{className:ae("h-6 w-6 sm:h-4 sm:w-4",e&&"animate-pulse")})})}const G6=[.85,1.25,.65,1.4,.75,1.15,.95],$m=4,F1=24;function K6(e){const t=Math.floor(e/60).toString().padStart(2,"0"),a=Math.floor(e%60).toString().padStart(2,"0");return`${t}:${a}`}function V6({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:G6.map((a,r)=>{const o=$m+t*a*(F1-$m),u=Math.max($m,Math.min(F1,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 mT({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(un,{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 hT({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(No,{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(V6,{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:K6(a)})]}):i.jsxs(i.Fragment,{children:[i.jsx(un,{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 Vi;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(Vi||(Vi={}));class qm extends Error{constructor(t,a,r){super(t),this.message=t,this.code=a,this.data=r}}const X6=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"},Q6=e=>{const t=e.CapacitorCustomPlatform||null,a=e.Capacitor||{},r=a.Plugins=a.Plugins||{},o=()=>t!==null?t.name:X6(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 S=o(),A=f(g);let w;const _=async()=>(!w&&S in y?w=typeof y[S]=="function"?w=await y[S]():w=y[S]:t!==null&&!w&&"web"in y&&(w=typeof y.web=="function"?w=await y.web():w=y.web),w),M=(J,V)=>{var j,ee;if(A){const se=A==null?void 0:A.methods.find(he=>V===he.name);if(se)return se.rtype==="promise"?he=>a.nativePromise(g,V.toString(),he):(he,te)=>a.nativeCallback(g,V.toString(),he,te);if(J)return(j=J[V])===null||j===void 0?void 0:j.bind(J)}else{if(J)return(ee=J[V])===null||ee===void 0?void 0:ee.bind(J);throw new qm(`"${g}" plugin is not implemented on ${S}`,Vi.Unimplemented)}},k=J=>{let V;const j=(...ee)=>{const se=_().then(he=>{const te=M(he,J);if(te){const K=te(...ee);return V=K==null?void 0:K.remove,K}else throw new qm(`"${g}.${J}()" is not implemented on ${S}`,Vi.Unimplemented)});return J==="addListener"&&(se.remove=async()=>V()),se};return j.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(j,"name",{value:J,writable:!1,configurable:!1}),j},L=k("addListener"),O=k("removeListener"),P=(J,V)=>{const j=L({eventName:J},V),ee=async()=>{const he=await j;O({eventName:J,callbackId:he},V)},se=new Promise(he=>j.then(()=>he({remove:ee})));return se.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await ee()},se},z=new Proxy({},{get(J,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return A?P:L;case"removeListener":return O;default:return k(V)}}});return r[g]=z,h.set(g,{name:g,proxy:z,platforms:new Set([...Object.keys(y),...A?[S]:[]])}),z};return a.convertFileSrc||(a.convertFileSrc=g=>g),a.getPlatform=o,a.handleError=m,a.isNativePlatform=u,a.isPluginAvailable=c,a.registerPlugin=b,a.Exception=qm,a.DEBUG=!!a.DEBUG,a.isLoggingEnabled=!!a.isLoggingEnabled,a},W6=e=>e.Capacitor=Q6(e),jc=W6(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Ho=jc.registerPlugin;class bp{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 jc.Exception(t,Vi.Unimplemented)}unavailable(t="not available"){return new jc.Exception(t,Vi.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 z1=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),$1=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Z6 extends bp{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=$1(o).trim(),u=$1(u).trim(),a[o]=u}),a}async setCookie(t){try{const a=z1(t.key),r=z1(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)}}}Ho("CapacitorCookies",{web:()=>new Z6});const J6=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)}),eM=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,u,c)=>(o[u]=e[t[c]],o),{})},tM=(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,nM=(e,t={})=>{const a=Object.assign({method:e.method||"GET",headers:e.headers},t),o=eM(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 aM extends bp{async request(t){const a=nM(t,t.webFetchExtra),r=tM(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 J6(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"}))}}Ho("CapacitorHttp",{web:()=>new aM});var q1;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(q1||(q1={}));var Y1;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(Y1||(Y1={}));class sM extends bp{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")}}Ho("SystemBars",{web:()=>new sM});const rM="modulepreload",iM=function(e){return"/"+e},G1={},lM=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=iM(h),h in G1)return;G1[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":rM,b||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),b)return new Promise((N,S)=>{y.addEventListener("load",N),y.addEventListener("error",()=>S(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)})},Pi=Ho("SpeechRecognition",{web:()=>lM(()=>import("./web-CtgAbHHH.js"),[]).then(e=>new e.SpeechRecognitionWeb)});function oM(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 Th=jc.isNativePlatform(),Ym=!Th&&typeof window<"u"?window.SpeechRecognition??window.webkitSpeechRecognition:void 0,Gm=16e3;function uM(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),S=T.useRef(!1),A=T.useRef([]),w=T.useRef(!1),_=T.useRef(null),M=T.useRef(!1),k=T.useRef(""),L=T.useRef(null),O=T.useRef(null),P=T.useRef(null),z=T.useRef([]),J=T.useRef(!1),V=!0,j=T.useCallback(async()=>{var C,de,_e;(C=P.current)==null||C.disconnect(),(de=O.current)==null||de.getTracks().forEach(B=>B.stop()),await((_e=L.current)==null?void 0:_e.close().catch(()=>{}));const F=z.current;if(z.current=[],P.current=null,O.current=null,L.current=null,F.length===0||J.current){a(!1),y("idle");return}c("识别中…"),y("recognizing");const $=F.reduce((B,pe)=>B+pe.length,0),q=new Float32Array($);let D=0;for(const B of F)q.set(B,D),D+=B.length;const I=oM(q,Gm),W=new FormData;W.append("audio",I,"recording.wav");try{const B=await fetch("/api/transcribe",{method:"POST",body:W});if(J.current)return;if(B.ok){const{text:pe}=await B.json();pe?(o(pe),y("done")):y("idle")}else{const pe=await B.json().catch(()=>({error:`HTTP ${B.status}`}));m(pe.error??`HTTP ${B.status}`),y("idle")}}catch(B){m(`语音识别失败:${B instanceof Error?B.message:String(B)}`),y("idle")}finally{c(""),a(!1)}},[]),ee=T.useCallback(async()=>{if(S.current=!0,_.current&&(clearTimeout(_.current),_.current=null),Th){await Pi.stop().catch(()=>{});for(const F of A.current)await F.remove().catch(()=>{});A.current=[],a(!1),c("")}else N.current?N.current.stop():L.current?await j():(a(!1),y("idle"))},[j]),se=T.useCallback(async()=>{var D;J.current=!1,o(""),c(""),m(null),y("idle");const{available:F}=await Pi.available();if(!F){m("当前设备不支持语音识别");return}if((await Pi.requestPermissions()).speechRecognition!=="granted"){m("请允许语音识别权限");return}const q=[];q.push(await Pi.addListener("partialResults",I=>{c(I.matches[0]??"")})),q.push(await Pi.addListener("listeningState",I=>{const W=I.status==="started";a(W),W&&y("recording"),W||c("")})),A.current=q;try{const I=await Pi.start({language:e,partialResults:!0,maxResults:1});(D=I.matches)!=null&&D.length&&o(W=>W+I.matches.join(""))}catch(I){m(`语音识别错误:${I instanceof Error?I.message:String(I)}`);for(const W of q)await W.remove().catch(()=>{});A.current=[]}},[e]),he=T.useCallback(()=>{if(!Ym)return!1;J.current=!1,o(""),c(""),k.current="",m(null),y("idle"),S.current=!1;const F=new Ym;F.lang=e,F.continuous=!0,F.interimResults=!0,F.maxAlternatives=1,F.onstart=()=>{a(!0),y("recording"),w.current=!1,_.current=setTimeout(()=>{!w.current&&!S.current&&(M.current=!0,S.current=!0,F.stop(),m("语音识别服务不可用(Chrome/Edge 需连接 Google 服务器),下次将使用服务端识别"))},5e3)},F.onresult=$=>{w.current=!0,_.current&&(clearTimeout(_.current),_.current=null);let q="",D="";for(let I=$.resultIndex;I<$.results.length;I++){const W=$.results[I][0].transcript;$.results[I].isFinal?q+=W:D+=W}q&&o(I=>I+q),c(D),k.current=D},F.onerror=$=>{switch($.error!=="no-speech"&&$.error!=="aborted"&&(S.current=!0),$.error){case"not-allowed":m("请允许麦克风权限");break;case"network":m("网络错误,请检查连接");break;case"no-speech":case"aborted":return;default:m(`语音识别错误:${$.error}`)}},F.onend=()=>{if(S.current&&k.current&&o($=>$+k.current),c(""),k.current="",!S.current)try{F.start();return}catch{}a(!1),N.current=null},N.current=F;try{return F.start(),!0}catch{return!1}},[e]),te=T.useCallback(async()=>{J.current=!1,o(""),c(""),m(null),y("idle");try{const I=await fetch("/api/transcribe/status"),{available:W}=await I.json();if(!W){m("语音识别服务未就绪,请稍后重试");return}}catch{m("无法连接语音识别服务");return}let F;try{F=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:Gm,channelCount:1}})}catch{m("请允许麦克风权限");return}const $=new AudioContext({sampleRate:Gm}),q=$.createMediaStreamSource(F),D=$.createScriptProcessor(4096,1,1);z.current=[],D.onaudioprocess=I=>{z.current.push(new Float32Array(I.inputBuffer.getChannelData(0)))},q.connect(D),D.connect($.destination),L.current=$,O.current=F,P.current=D,a(!0),y("recording")},[]),K=T.useCallback(()=>{Th?se():Ym&&!M.current&&he()||te()},[se,he,te]);T.useEffect(()=>{if(!t){b(0);return}if(N.current)return;let F=!1,$=null,q=null,D=0;return(async()=>{try{if($=await navigator.mediaDevices.getUserMedia({audio:!0}),F){$.getTracks().forEach(B=>B.stop());return}q=new AudioContext;const I=q.createMediaStreamSource($),W=q.createAnalyser();W.fftSize=256,I.connect(W);const C=new Uint8Array(W.frequencyBinCount);let de=0;const _e=()=>{if(F)return;W.getByteFrequencyData(C);const B=performance.now();if(B-de>80){let pe=0;for(let Re=0;Re<C.length;Re++)pe+=C[Re];b(pe/(C.length*255)),de=B}D=requestAnimationFrame(_e)};D=requestAnimationFrame(_e)}catch{}})(),()=>{F=!0,cancelAnimationFrame(D),$==null||$.getTracks().forEach(I=>I.stop()),q==null||q.close().catch(()=>{}),b(0)}},[t]),T.useEffect(()=>{!t&&g==="recording"&&y(r?"done":"idle")},[t,g,r]),T.useEffect(()=>()=>{var F,$,q,D;S.current=!0,(F=N.current)==null||F.stop(),($=P.current)==null||$.disconnect(),(q=O.current)==null||q.getTracks().forEach(I=>I.stop()),(D=L.current)==null||D.close().catch(()=>{});for(const I of A.current)I.remove().catch(()=>{})},[]);const G=T.useCallback(()=>{J.current=!0,o(""),c(""),k.current="",y("idle")},[]);return{isSupported:V,isListening:t,phase:g,transcript:r,interimTranscript:u,error:f,volumeLevel:h,start:K,stop:ee,resetTranscript:G}}const cM=240,dM=1e3;function pT(e){const t=uM(),[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))},dM)):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,cM)}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=Le.getState().activeRepoId;try{const a=t?await zy(t):await Uy();e({agents:a,loaded:!0})}catch{e({loaded:!0})}}}));function fM(e){if(typeof e!="string")return e;const t=e.trim();if(t)try{return JSON.parse(t)}catch{return t}}function gn(e){return e&&typeof e=="object"?e:null}function Qr(e){const t=gn(e);return t&&"properties"in t?t.properties:e}function mM(e){const t=gn(e);return typeof(t==null?void 0:t.type)=="string"?t.type:void 0}function hM(e){const t=gn(Qr(e));if(!t)return null;const a=gn(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=gn(t.message);return r&&typeof r.id=="string"?r:null}function pM(e){const t=gn(Qr(e));if(!t)return{};const a=gn(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 gM(e){const t=gn(Qr(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 bM(e){const t=Qr(e);if(Array.isArray(t))return t;const a=gn(t);return a&&Array.isArray(a.todos)?a.todos:[]}function Xa(e){return typeof e=="number"?e:0}function xM(e){const t=gn(Qr(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=gn(t.tokens),u=typeof t.tokens_input=="number"||typeof t.tokens_output=="number";if(o||u){const f=o?gn(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=gn(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=gn(Qr(e));if(!t)return null;if(typeof t.message=="string")return t.message;const a=gn(t.error);if(a){const r=gn(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 yM(e){const t=Qr(e);if(typeof t=="string")return t;const a=gn(t);if(typeof(a==null?void 0:a.status)=="string")return a.status;const r=gn(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===""?mM(t)??e:e){case"message.updated":{const u=hM(t);u&&r.updateMessage(a,u);break}case"session.updated":{const u=xM(t);u&&r.updateSessionInfo(u);break}case"message.part.updated":{const{messageId:u,part:c}=pM(t);c&&u&&r.updateMessagePart(a,u,c);break}case"message.part.delta":{const u=gM(t);u&&r.appendMessagePartDelta(a,u.messageId,u.partId,u.delta);break}case"todo.updated":{r.updateTodos(a,bM(t));break}case"session.status":{const u=yM(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 TM=600*1e3;class _M{constructor(t,a){ln(this,"sessionId");ln(this,"idleTimer",null);ln(this,"active",!1);ln(this,"alive",!0);ln(this,"callbacks");this.sessionId=t,this.callbacks=a,this.resetIdleTimer()}dispatch(t,a){if(!this.alive)return;this.resetIdleTimer();const r=Oe.getState();NM(t,a,this.sessionId,r)}activate(){this.active=!0,this.clearIdleTimer()}deactivate(){this.active=!1,this.resetIdleTimer()}refreshOnIdle(){Oe.getState().refreshSessionData(this.sessionId)}stop(){this.alive=!1,this.clearIdleTimer()}resetIdleTimer(){this.clearIdleTimer(),!this.active&&(this.idleTimer=setTimeout(()=>{this.callbacks.onWorkerIdle(this.sessionId)},TM))}clearIdleTimer(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}}const vM=1e3,SM=3e4;class AM{constructor(t,a){ln(this,"source",null);ln(this,"reconnectTimer",null);ln(this,"attempts",0);ln(this,"disposed",!1);ln(this,"repoId");ln(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=z5(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(vM*2**this.attempts,SM);this.attempts++,this.reconnectTimer=setTimeout(()=>this.connect(),o)}}}handleRaw(t,a){if(!(a instanceof MessageEvent))return;const r=fM(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 wM=6e4;class CM{constructor(t){ln(this,"timer",null);ln(this,"paused",!1);ln(this,"callbacks");this.callbacks=t}start(){this.tick(),this.timer=setInterval(()=>{this.paused||this.tick()},wM)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null)}pause(){this.paused=!0}resume(){this.paused=!1,this.tick()}tick(){const t=Le.getState().activeRepoId;t&&(Oe.getState().loadSessions(),$5(t).then(a=>{const r={};for(const[o,u]of Object.entries(a))r[o]=u.type??"idle";Oe.getState().bulkSetStatuses(r);for(const[o,u]of Object.entries(r))(u==="busy"||u==="retry")&&this.callbacks.ensureWorker(o)}).catch(()=>{}))}}class kM{constructor(){ln(this,"workers",new Map);ln(this,"dispatcher",null);ln(this,"supervisor",null);ln(this,"visibilityHandler",null)}start(t){this.stop();const a={onWorkerIdle:r=>this.removeWorker(r)};this.dispatcher=new AM(t,(r,o,u)=>{const c=this.ensureWorker(r,a);if(o==="session.idle"||o==="session.status"){const f=Oe.getState().sessionStatuses[r];c.dispatch(o,u);const m=Oe.getState().sessionStatuses[r];f&&f!=="idle"&&m==="idle"&&c.refreshOnIdle()}else c.dispatch(o,u)}),this.dispatcher.start(),this.supervisor=new CM({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(),Oe.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 _M(t,a),this.workers.set(t,r)),r}removeWorker(t){const a=Oe.getState().activeSessionId;if(t===a)return;const r=this.workers.get(t);r&&(r.stop(),this.workers.delete(t))}}const Bc=new kM,K1=(function(e,t,a){const r=Bo(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]}),Wr=(function(e){if(e==null)return IM;if(typeof e=="string")return OM(e);if(typeof e=="object")return RM(e);if(typeof e=="function")return xp(e);throw new Error("Expected function, string, or array as `test`")});function RM(e){const t=[];let a=-1;for(;++a<e.length;)t[a]=Wr(e[a]);return xp(r);function r(...o){let u=-1;for(;++u<t.length;)if(t[u].apply(this,o))return!0;return!1}}function OM(e){return xp(t);function t(a){return a.tagName===e}}function xp(e){return t;function t(a,r,o){return!!(MM(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function IM(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function MM(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const V1=/\n/g,X1=/[\t ]+/g,_h=Wr("br"),Q1=Wr(FM),LM=Wr("p"),W1=Wr("tr"),DM=Wr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",HM,zM]),gT=Wr(["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 jM(e,t){const a=t||{},r="children"in e?e.children:[],o=gT(e),u=ET(e,{whitespace:a.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...xT(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<r.length;)c.push(...bT(r[f],e,{whitespace:u,breakBefore:f?void 0:o,breakAfter:f<r.length-1?_h(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(`
504
504
  `.repeat(h)||" "),h=-1,m.push(b))}return m.join("")}function bT(e,t,a){return e.type==="element"?BM(e,t,a):e.type==="text"?a.whitespace==="normal"?xT(e,a):PM(e):[]}function BM(e,t,a){const r=ET(e,a),o=e.children||[];let u=-1,c=[];if(DM(e))return c;let f,m;for(_h(e)||W1(e)&&K1(t,e,W1)?m=`
505
505
  `:LM(e)?(f=2,m=2):gT(e)&&(f=1,m=1);++u<o.length;)c=c.concat(bT(o[u],e,{whitespace:r,breakBefore:u?void 0:f,breakAfter:u<o.length-1?_h(o[u+1]):m}));return Q1(e)&&K1(t,e,Q1)&&c.push(" "),f&&c.unshift(f),m&&c.push(m),c}function xT(e,t){const a=String(e.value),r=[],o=[];let u=0;for(;u<=a.length;){V1.lastIndex=u;const m=V1.exec(a),h=m&&"index"in m?m.index:a.length;r.push(UM(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 PM(e){return[String(e.value)]}function UM(e,t,a){const r=[];let o=0,u;for(;o<e.length;){X1.lastIndex=o;const c=X1.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 ET(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 HM(e){return!!(e.properties||{}).hidden}function FM(e){return e.tagName==="td"||e.tagName==="th"}function zM(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function $M(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*\\(",S=["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"],A=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],w=["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"],_=["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"],L={type:A,keyword:S,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:w},O={className:"function.dispatch",relevance:0,keywords:{_hint:_},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},P=[O,g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:L,contains:P.concat([{begin:/\(/,end:/\)/,keywords:L,contains:P.concat(["self"]),relevance:0}]),relevance:0},J={className:"function",begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:L,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:L,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:L,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:L,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:L,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(z,J,O,P,[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:L,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:L},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function qM(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=$M(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 YM(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}),S={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},A=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],w=["true","false"],_={match:/(\/[a-z._-]+)+/},M=["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"],L=["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"],O=["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:A,literal:w,built_in:[...M,...k,"set","shopt",...L,...O]},contains:[N,e.SHEBANG(),S,g,u,c,_,f,m,h,b,a]}}function GM(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*\\(",w={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"},_=[g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:_.concat([{begin:/\(/,end:/\)/,keywords:w,contains:_.concat(["self"]),relevance:0}]),relevance:0},k={begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:N,returnBegin:!0,contains:[e.inherit(y,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:w,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:w,disableAutodetect:!0,illegal:"</",contains:[].concat(M,k,_,[g,{begin:e.IDENT_RE+"::",keywords:w},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:g,strings:h,keywords:w}}}function KM(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*\\(",S=["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"],A=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],w=["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"],_=["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"],L={type:A,keyword:S,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:w},O={className:"function.dispatch",relevance:0,keywords:{_hint:_},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},P=[O,g,f,a,e.C_BLOCK_COMMENT_MODE,b,h],z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:L,contains:P.concat([{begin:/\(/,end:/\)/,keywords:L,contains:P.concat(["self"]),relevance:0}]),relevance:0},J={className:"function",begin:"("+c+"[\\*&\\s]+)+"+N,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:L,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:L,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:L,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,h,b,f,{begin:/\(/,end:/\)/,keywords:L,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:L,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(z,J,O,P,[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:L,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:L},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function VM(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/}),S={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,N]},A={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]},w=e.inherit(A,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},N]});y.contains=[A,S,b,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,e.C_BLOCK_COMMENT_MODE],N.contains=[w,S,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const _={variants:[h,A,S,b,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},M={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},k=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",L={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"}},_,m,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},f,M,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,M,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,M],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,relevance:0,contains:[_,m,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},L]}}const XM=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_-]*/}}),QM=["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"],WM=["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"],ZM=[...QM,...WM],JM=["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(),eL=["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(),tL=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),nL=["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 aL(e){const t=e.regex,a=XM(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:":("+eL.join("|")+")"},{begin:":(:)?("+tL.join("|")+")"}]},a.CSS_VARIABLE,{className:"attribute",begin:"\\b("+nL.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:JM.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...f,a.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+ZM.join("|")+")\\b"}]}}function sL(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 rL(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 iL(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 lL(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 Hi="[0-9](_*[0-9])*",dc=`\\.(${Hi})`,fc="[0-9a-fA-F](_*[0-9a-fA-F])*",Z1={className:"number",variants:[{begin:`(\\b(${Hi})((${dc})|\\.)?|(${dc}))[eE][+-]?(${Hi})[fFdD]?\\b`},{begin:`\\b(${Hi})((${dc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${dc})[fFdD]?\\b`},{begin:`\\b(${Hi})[fFdD]\\b`},{begin:`\\b0[xX]((${fc})\\.?|(${fc})?\\.(${fc}))[pP][+-]?(${Hi})[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 yT(e,t,a){return a===-1?"":e.replace(t,r=>yT(e,t,a-1))}function oL(e){const t=e.regex,a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=a+yT("(?:<"+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,Z1,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Z1,h]}}const J1="[A-Za-z$_][0-9A-Za-z$_]*",uL=["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"],cL=["true","false","null","undefined","NaN","Infinity"],NT=["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"],TT=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],_T=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],dL=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],fL=[].concat(_T,NT,TT);function mL(e){const t=e.regex,a=($,{after:q})=>{const D="</"+$[0].slice(1);return $.input.indexOf(D,q)!==-1},r=J1,o={begin:"<>",end:"</>"},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,q)=>{const D=$[0].length+$.index,I=$.input[D];if(I==="<"||I===","){q.ignoreMatch();return}I===">"&&(a($,{after:D})||q.ignoreMatch());let W;const C=$.input.substring(D);if(W=C.match(/^\s*=/)){q.ignoreMatch();return}if((W=C.match(/^\s+extends\s+/))&&W.index===0){q.ignoreMatch();return}}},f={$pattern:J1,keyword:uL,literal:cL,built_in:fL,"variable.language":dL},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"}},S={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},A={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},M={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,S,A,w,{match:/\$\d+/},g];y.contains=k.concat({begin:/\{/,end:/\}/,keywords:f,contains:["self"].concat(k)});const L=[].concat(M,y.contains),O=L.concat([{begin:/(\s*)\(/,end:/\)/,keywords:f,contains:["self"].concat(L)}]),P={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:O},z={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"}}]},J={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:{_:[...NT,...TT]}},V={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},j={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[P],illegal:/%/},ee={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function se($){return t.concat("(?!",$.join("|"),")")}const he={match:t.concat(/\b/,se([..._T,"super","import"].map($=>`${$}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},te={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},K={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},P]},G="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",F={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(G)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[P]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:f,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),V,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,N,S,A,w,M,{match:/\$\d+/},g,J,{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:[M,e.REGEXP_MODE,{className:"function",begin:G,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:O}]}]},{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"]}]}]},j,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[P,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},te,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[P]},he,ee,z,K,{match:/\$[(.]/}]}}function hL(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 Fi="[0-9](_*[0-9])*",mc=`\\.(${Fi})`,hc="[0-9a-fA-F](_*[0-9a-fA-F])*",pL={className:"number",variants:[{begin:`(\\b(${Fi})((${mc})|\\.)?|(${mc}))[eE][+-]?(${Fi})[fFdD]?\\b`},{begin:`\\b(${Fi})((${mc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${mc})[fFdD]?\\b`},{begin:`\\b(${Fi})[fFdD]\\b`},{begin:`\\b0[xX]((${hc})\\.?|(${hc})?\\.(${hc}))[pP][+-]?(${Fi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${hc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function gL(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=pL,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:`
506
506
  `},h]}}const bL=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_-]*/}}),xL=["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"],EL=["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"],yL=[...xL,...EL],NL=["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(),vT=["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(),ST=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),TL=["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(),_L=vT.concat(ST).sort().reverse();function vL(e){const t=bL(e),a=_L,r="and or not only",o="[\\w-]+",u="("+o+"|@\\{"+o+"\\})",c=[],f=[],m=function(k){return{className:"string",begin:"~?"+k+".*?"+k}},h=function(k,L,O){return{className:k,begin:L,relevance:O}},b={$pattern:/[a-z-]+/,keyword:r,attribute:NL.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)},S={begin:u+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+TL.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:f}}]},A={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}},w={className:"variable",variants:[{begin:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:y}},_={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("+yL.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:":("+vT.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+ST.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:y},{begin:"!important"},t.FUNCTION_DISPATCH]},M={begin:o+`:(:)?(${a.join("|")})`,returnBegin:!0,contains:[_]};return c.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,A,w,M,S,_,N,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:c}}function SL(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 AL(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 wL(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(_=>{_.contains=_.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 CL(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 kL(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=(A,w,_="\\1")=>{const M=_==="\\1"?_:t.concat(_,w);return t.concat(t.concat("(?:",A,")"),w,/(?:\\.|[^\\\/])*?/,M,/(?:\\.|[^\\\/])*?/,_,r)},N=(A,w,_)=>t.concat(t.concat("(?:",A,")"),w,/(?:\\.|[^\\\/])*?/,_,r),S=[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=S,c.contains=S,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:S}}function RL(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":(te,K)=>{K.data._beginMatch=te[1]||te[2]},"on:end":(te,K)=>{K.data._beginMatch!==te[1]&&K.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-koSigv5u.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-CcU3jOU6.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-koSigv5u.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CcU3jOU6.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-SJA3BfFF.css">
9
9
  </head>
10
10
  <body>