fourth-spark 0.9.3 → 0.9.4
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.
package/package.json
CHANGED
|
@@ -437,7 +437,7 @@ Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}
|
|
|
437
437
|
*
|
|
438
438
|
* This source code is licensed under the ISC license.
|
|
439
439
|
* See the LICENSE file in the root directory of this source tree.
|
|
440
|
-
*/const M3=[["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"}]],jh=Ce("zap",M3);function JE(e){var t,a,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(a=JE(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function oe(){for(var e,t,a=0,s="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=JE(e))&&(s&&(s+=" "),s+=t);return s}const ix=e=>{let t;const a=new Set,s=(h,x)=>{const b=typeof h=="function"?h(t):h;if(!Object.is(b,t)){const y=t;t=x??(typeof b!="object"||b===null)?b:Object.assign({},t,b),a.forEach(T=>T(t,y))}},l=()=>t,f={setState:s,getState:l,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=t=e(s,l,f);return f},D3=(e=>e?ix(e):ix),L3=e=>e;function j3(e,t=L3){const a=Ku.useSyncExternalStore(e.subscribe,Ku.useCallback(()=>t(e.getState()),[e,t]),Ku.useCallback(()=>t(e.getInitialState()),[e,t]));return Ku.useDebugValue(a),a}const lx=e=>{const t=D3(e),a=s=>j3(t,s);return Object.assign(a,t),a},Wa=(e=>e?lx(e):lx),pm="fs-theme";function ey(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ox(e){return e==="system"?ey():e}function ux(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Xm=Wa((e,t)=>({preference:localStorage.getItem(pm)??"system",resolved:ox(localStorage.getItem(pm)??"system"),setPreference(a){const s=ox(a);localStorage.setItem(pm,a),ux(a),e({preference:a,resolved:s})},cycle(){const a=["system","light","dark"],s=a[(a.indexOf(t().preference)+1)%a.length];t().setPreference(s)},init(){ux(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{const{preference:l}=t();if(l==="system"){const u=ey();e({resolved:u})}};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)}})),xc="fourth-spark-server-url";function ty(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function ny(){return localStorage.getItem(xc)??""}function B3(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(xc,t):localStorage.removeItem(xc)}function Wm(){return localStorage.getItem(xc)??""}class Qa extends Error{constructor(a,s){super(a);rn(this,"status");this.name="ApiError",this.status=s}}async function Ne(e,t){let a;try{a=await fetch(ny()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(l){throw new Qa(l instanceof Error?l.message:"Network request failed",0)}if(!a.ok){const l=await a.text().catch(()=>"");throw new Qa(l.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const s=await a.text();if(s)return JSON.parse(s)}function yn(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const s of[...t,"data","items"])if(Array.isArray(a[s]))return a[s]}return[]}async function P3(){return yn(await Ne("/api/repos"),"repos")}async function U3(e,t,a,s){return Ne("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:s})})}async function H3(e){return Ne("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function F3(e){await Ne(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function z3(e){await Ne(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function q3(e){await Ne(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function Y3(e){return Ne(`/api/repos/${encodeURIComponent(e)}/branches`)}async function $3(e,t){return Ne(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function G3(e){return Ne(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ke(e){return`/api/repos/${encodeURIComponent(e)}`}async function K3(e){return yn(await Ne(`${Ke(e)}/workspaces`),"workspaces")}async function V3(e,t){await Ne(`${Ke(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Q3(e){return Ne(`${Ke(e)}/workspaces/cleanup`,{method:"POST"})}async function X3(e,t){await Ne(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function W3(e,t){await Ne(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function Z3(e){return yn(await Ne(`${Ke(e)}/sessions`),"sessions")}async function J3(e,t,a,s,l,u,d,f){return Ne(`${Ke(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:s,variant:l,issueId:u,customAgentId:d,files:f})})}async function eC(e,t){return Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`)}async function tC(e,t){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function nC(e,t,a,s,l,u){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:s,model:l,files:u})})}async function aC(e,t){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function rC(e,t,a){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function sC(e,t){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}function iC(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const s=Array.isArray(t.parts)?t.parts:void 0;return{...a,...s?{parts:s}:{}}}return t}async function lC(e,t){return yn(await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/messages`),"messages").map(iC)}async function oC(e,t){return yn(await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/todos`),"todos")}async function ay(e,t){return Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/status`)}async function cx(e,t){return Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/links`)}async function dx(e){return Ne(`${Ke(e)}/sessions/all-links`)}async function uC(e,t,a,s){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:s})})}async function cC(e,t,a,s){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:s})})}async function dC(e){return yn(await Ne(`${Ke(e)}/agents`),"agents")}async function ry(){return yn(await Ne("/api/custom-agents"))}async function sy(e){return Ne("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function iy(e,t){return Ne(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function ly(e){await Ne(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function fx(e){return Ne(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function fC(e){return Ne("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function mC(e){return yn(await Ne(`${Ke(e)}/custom-agents`))}async function hC(e,t){return Ne(`${Ke(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function zc(e){return yn(await Ne(`${Ke(e)}/models`))}async function pC(){return yn(await Ne("/api/prompt-fragments"))}async function gC(e){return Ne("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function bC(e,t){return Ne(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function xC(e){await Ne(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function mx(e){return yn(await Ne(`${Ke(e)}/tags`))}async function hx(e,t){return yn(await Ne(`${Ke(e)}/milestones`))}async function px(e,t="open"){return yn(await Ne(`${Ke(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function EC(e,t="all"){return Ne(`${Ke(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function yC(e,t,a){return Ne(`${Ke(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function TC(e,t,a){await Ne(`${Ke(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function oy(e,t,a){return Ne(`${Ke(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function gx(e,t){return yn(await Ne(`${Ke(e)}/issues/${t}/pulls`))}async function _C(e,t,a,s=!1){await Ne(`${Ke(e)}/issues/${t}/pulls/${a}/merge`,{method:"POST",body:JSON.stringify({closeIssue:s})})}async function bx(e,t="open"){return yn(await Ne(`${Ke(e)}/pulls?state=${encodeURIComponent(t)}`))}async function NC(e,t="all"){return Ne(`${Ke(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function vC(e,t){await Ne(`${Ke(e)}/pulls/${t}/merge`,{method:"POST"})}async function uy(e,t){return yn(await Ne(`${Ke(e)}/pulls/${t}/issues`))}async function SC(e,t,a){await Ne(`${Ke(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function AC(e,t,a){await Ne(`${Ke(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function CC(e,t){return Ne(`${Ke(e)}/pulls/${t}/comments`)}async function wC(e,t){return Ne(`${Ke(e)}/issues/${t}/comments`)}async function xx(e,t,a){return Ne(`${Ke(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function kC(e,t,a){return Ne(`${Ke(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function Ex(e,t){return Ne(`${Ke(e)}/issues/${t}/draft`)}async function RC(e,t,a){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function OC(e,t,a){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function IC(){return Ne("/api/agents-md")}async function MC(e){await Ne("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function DC(e){return Ne(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function LC(e,t){await Ne(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function jC(e){return`${ny()}${Ke(e)}/events`}async function BC(e){return Ne(`${Ke(e)}/sessions/status`)}async function qc(){return Ne("/api/settings")}async function Zm(e,t){await Ne(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function Jm(){return Ne("/api/cloud/status")}async function PC(){return Ne("/api/cloud/reload",{method:"POST"})}async function UC(e){try{return(await Ne("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function HC(){return yn(await Ne("/api/git-hosts"),"gitHosts")}async function FC(e,t,a,s="gitea"){return Ne("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:s})})}async function zC(e){await Ne(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function cy(){return Ne("/api/usage")}async function dy(e){return Ne("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function qC(e,t="ios"){await Ne("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const as="fs-active-repo",Fe=Wa((e,t)=>({repos:[],activeRepoId:localStorage.getItem(as),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await P3(),s=t().activeRepoId,l=s&&a.some(d=>d.id===s);e({repos:a,loading:!1,activeRepoId:l?s:a.length>0?a[0].id:null});const u=t().activeRepoId;u?localStorage.setItem(as,u):localStorage.removeItem(as)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(as,a):localStorage.removeItem(as)},addRepo:async(a,s,l,u)=>{try{const d=await U3(a,s,l,u);return e(f=>({repos:[...f.repos,d],activeRepoId:d.id})),localStorage.setItem(as,d.id),d}catch(d){return e({loadError:d instanceof Error?d.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await F3(a)}catch{}e(s=>{const l=s.repos.filter(d=>d.id!==a),u=s.activeRepoId===a?l.length>0?l[0].id:null:s.activeRepoId;return u?localStorage.setItem(as,u):localStorage.removeItem(as),{repos:l,activeRepoId:u}})},updateRepoBranch:(a,s)=>{e(l=>({repos:l.repos.map(u=>u.id===a?{...u,branch:s}:u)}))}})),La=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},gm="fs-nav-collapsed",bm="fs-session-panel-collapsed",Ec=Wa(e=>({navCollapsed:localStorage.getItem(gm)==="true",sessionPanelCollapsed:localStorage.getItem(bm)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(gm,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(bm,String(a)),{sessionPanelCollapsed:a}})},setNavCollapsed(t){localStorage.setItem(gm,String(t)),e({navCollapsed:t})},setSessionPanelCollapsed(t){localStorage.setItem(bm,String(t)),e({sessionPanelCollapsed:t})}})),fy=[{segment:"repos",icon:ZS,label:"仓库管理",global:!0},{segment:"run",icon:Hc,label:"运行面板",global:!1},{segment:"issues",icon:mo,label:"Issues",global:!1},{segment:"pulls",icon:ho,label:"PRs",global:!1},{segment:"settings",icon:E3,label:"设置",global:!0}];function my(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function YC({repoId:e,currentBranch:t}){const a=Fe(A=>A.updateRepoBranch),[s,l]=S.useState(!1),[u,d]=S.useState(null),[f,m]=S.useState(!1),[h,x]=S.useState(null),[b,y]=S.useState(null),T=S.useRef(null),N=S.useCallback(()=>{l(!1),y(null)},[]);S.useEffect(()=>{if(!s)return;const A=R=>{T.current&&!T.current.contains(R.target)&&N()};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[s,N]);const v=async()=>{if(s){N();return}l(!0),m(!0),y(null);try{d(await Y3(e))}catch{y("加载分支失败")}finally{m(!1)}},C=async A=>{if(!(A===t||h)){x(A),y(null);try{const R=await $3(e,A);a(e,R.branch),N()}catch(R){y(R instanceof Error?R.message:"切换失败")}finally{x(null)}}};return t?o.jsxs("div",{ref:T,className:"relative",children:[o.jsxs("button",{type:"button",onClick:v,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:[o.jsx(Ys,{className:"h-3 w-3"}),t,o.jsx(vr,{className:oe("h-3 w-3 transition-transform",s&&"rotate-180")})]}),s&&o.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?o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(va,{className:"h-4 w-4 animate-spin text-fg-4"})}):u?o.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[u.local.map(A=>o.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:oe("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",A===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[A===t?o.jsx(oa,{className:"h-3 w-3 shrink-0"}):h===A?o.jsx(va,{className:"h-3 w-3 shrink-0 animate-spin"}):o.jsx("span",{className:"h-3 w-3 shrink-0"}),o.jsx("span",{className:"truncate",children:A})]},A)),u.remote.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-3 my-1 border-t border-line"}),o.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),u.remote.map(A=>o.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-fg-2 transition-colors hover:bg-elevated",children:[h===A?o.jsx(va,{className:"h-3 w-3 shrink-0 animate-spin"}):o.jsx("span",{className:"h-3 w-3 shrink-0"}),o.jsx("span",{className:"truncate",children:A})]},`remote-${A}`))]})]}):null,b&&o.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:b})]})]}):null}function $C(){const[e,t]=S.useState(null);return S.useEffect(()=>{const a=()=>fetch("/api/health").then(u=>u.json()).then(u=>{u.latestVersion&&u.latestVersion!=="0.9.3"&&t(u.latestVersion)}).catch(()=>{});a();const s=setInterval(a,30*6e4),l=()=>a();return window.addEventListener("focus",l),()=>{clearInterval(s),window.removeEventListener("focus",l)}},[]),e}function GC(){const e=Aa(),t=ca(),a=Fe(b=>b.repos),s=Fe(b=>b.activeRepoId),l=Fe(b=>b.setActiveRepo),u=Xm(b=>b.preference),d=Xm(b=>b.cycle),f=u==="light"?N3:u==="dark"?r3:n3,m=a.find(b=>b.id===s),h=$C(),x=b=>{var N;if(!b)return;l(b);const y=a.find(v=>v.id===b);if(!y)return;const T=((N=t.pathname.match(/\/(run|issues|pulls)/))==null?void 0:N[1])??"run";e(`/${encodeURIComponent(y.name)}/${T}`)};return o.jsx("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:o.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(jh,{className:"h-5 w-5 text-blue-500"}),o.jsx("span",{className:"text-sm font-bold tracking-tight text-fg",children:"Fourth Spark"}),o.jsxs("span",{className:"rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4",children:["v","0.9.3"]}),h&&o.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",o.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("select",{value:s??"",onChange:b=>x(b.target.value),className:"rounded-md border border-line bg-base px-2.5 py-1 text-xs text-fg-2 focus:border-blue-500 focus:outline-none",children:a.map(b=>o.jsx("option",{value:b.id,children:b.name},b.id))}),m&&s&&o.jsx(YC,{repoId:s,currentBranch:m.branch})]}),o.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:o.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:o.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"})})}),o.jsx("button",{type:"button",onClick:d,"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:o.jsx(f,{className:"h-4 w-4"})})]})]})})}function KC(){const e=Fe(La),t=Ec(s=>s.navCollapsed),a=Ec(s=>s.toggleNav);return o.jsxs("nav",{className:oe("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:[o.jsx("div",{className:"flex flex-1 flex-col",children:fy.map(s=>o.jsxs(Ih,{to:my(s.segment,s.global,e),title:t?s.label:void 0,className:({isActive:l})=>oe("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",l?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[o.jsx(s.icon,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:oe("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:s.label})]},s.segment))}),o.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?o.jsx(uA,{className:"h-4 w-4"}):o.jsx(lA,{className:"h-4 w-4"})})]})}function VC(){const e=Fe(La);return o.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:o.jsx("div",{className:"flex h-14 items-center justify-around",children:fy.map(t=>o.jsx(Ih,{to:my(t.segment,t.global,e),"aria-label":t.label,className:({isActive:a})=>oe("flex h-10 w-10 items-center justify-center rounded-md transition-colors",a?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:o.jsx(t.icon,{className:"h-5 w-5 shrink-0"})},t.segment))})})}function QC(){return o.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[o.jsx(GC,{}),o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx(KC,{}),o.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:o.jsx(Wv,{})})]}),o.jsx(VC,{})]})}function XC({onClose:e}){const[t,a]=S.useState(""),[s,l]=S.useState(""),[u,d]=S.useState(""),[f,m]=S.useState("opencode"),[h,x]=S.useState(!1),[b,y]=S.useState(""),T=Fe(R=>R.addRepo),N=s.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,v=async R=>{const w=R.trim();if(w){x(!0),y("");try{const U=await H3(w);U.name&&!s.trim()&&l(U.name),U.gitUrl&&!u.trim()&&d(U.gitUrl)}catch(U){const G=U instanceof Error?U.message:"无法解析路径";try{const L=JSON.parse(G);y(L.error??G)}catch{y(G)}}x(!1)}},C=S.useRef(v);C.current=v,S.useEffect(()=>{const R=t.trim();if(!R)return;const w=setTimeout(()=>{C.current(R)},500);return()=>clearTimeout(w)},[t]);const A=async()=>{if(!N)return;y(""),await T(s.trim(),u.trim(),t.trim(),f)&&e()};return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:o.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:R=>R.stopPropagation(),children:[o.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[o.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),o.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:o.jsx(gt,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),o.jsx("input",{id:"m-path",value:t,onChange:R=>a(R.target.value),onBlur:R=>void v(R.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"}),o.jsx("span",{className:"text-[11px] text-fg-5",children:h?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),o.jsx("input",{id:"m-name",value:s,onChange:R=>l(R.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"})]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),o.jsx("input",{id:"m-git",value:u,onChange:R=>d(R.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"})]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{className:"text-xs font-medium text-fg-3",children:"运行时"}),o.jsx("div",{className:"flex gap-2",children:[{value:"opencode",label:"OpenCode"},{value:"claude-code",label:"Claude Code"}].map(R=>o.jsx("button",{type:"button",onClick:()=>m(R.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===R.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:R.label},R.value))}),o.jsx("span",{className:"text-[11px] text-fg-5",children:f==="claude-code"?"需要本地安装 Claude Code CLI":"需要本地安装 OpenCode CLI"})]}),b&&o.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:b}),o.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[o.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:"取消"}),o.jsx("button",{type:"button",onClick:A,disabled:!N,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 WC({repoId:e,repoName:t,onClose:a}){const[s,l]=S.useState(""),[u,d]=S.useState(""),[f,m]=S.useState(!0),[h,x]=S.useState(!1),[b,y]=S.useState(null);S.useEffect(()=>{DC(e).then(v=>{l(v.content),d(v.content),m(!1)}).catch(v=>{y(v instanceof Error?v.message:String(v)),m(!1)})},[e]);const T=async()=>{x(!0),y(null);try{await LC(e,s),d(s)}catch(v){y(v instanceof Error?v.message:String(v))}x(!1)},N=s!==u;return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:o.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:v=>v.stopPropagation(),children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),o.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),o.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:o.jsx(gt,{className:"h-4 w-4"})})]}),b&&o.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:[o.jsx(Dn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"min-w-0 break-words",children:b})]}),f?o.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[o.jsx(va,{className:"h-5 w-5 fs-spin"}),o.jsx("p",{className:"text-xs",children:"加载中…"})]}):o.jsx("textarea",{value:s,onChange:v=>l(v.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
|
|
440
|
+
*/const M3=[["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"}]],jh=Ce("zap",M3);function JE(e){var t,a,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(a=JE(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function oe(){for(var e,t,a=0,s="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=JE(e))&&(s&&(s+=" "),s+=t);return s}const ix=e=>{let t;const a=new Set,s=(h,x)=>{const b=typeof h=="function"?h(t):h;if(!Object.is(b,t)){const y=t;t=x??(typeof b!="object"||b===null)?b:Object.assign({},t,b),a.forEach(T=>T(t,y))}},l=()=>t,f={setState:s,getState:l,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=t=e(s,l,f);return f},D3=(e=>e?ix(e):ix),L3=e=>e;function j3(e,t=L3){const a=Ku.useSyncExternalStore(e.subscribe,Ku.useCallback(()=>t(e.getState()),[e,t]),Ku.useCallback(()=>t(e.getInitialState()),[e,t]));return Ku.useDebugValue(a),a}const lx=e=>{const t=D3(e),a=s=>j3(t,s);return Object.assign(a,t),a},Wa=(e=>e?lx(e):lx),pm="fs-theme";function ey(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ox(e){return e==="system"?ey():e}function ux(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Xm=Wa((e,t)=>({preference:localStorage.getItem(pm)??"system",resolved:ox(localStorage.getItem(pm)??"system"),setPreference(a){const s=ox(a);localStorage.setItem(pm,a),ux(a),e({preference:a,resolved:s})},cycle(){const a=["system","light","dark"],s=a[(a.indexOf(t().preference)+1)%a.length];t().setPreference(s)},init(){ux(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{const{preference:l}=t();if(l==="system"){const u=ey();e({resolved:u})}};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)}})),xc="fourth-spark-server-url";function ty(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function ny(){return localStorage.getItem(xc)??""}function B3(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(xc,t):localStorage.removeItem(xc)}function Wm(){return localStorage.getItem(xc)??""}class Qa extends Error{constructor(a,s){super(a);rn(this,"status");this.name="ApiError",this.status=s}}async function Ne(e,t){let a;try{a=await fetch(ny()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(l){throw new Qa(l instanceof Error?l.message:"Network request failed",0)}if(!a.ok){const l=await a.text().catch(()=>"");throw new Qa(l.trim()||`${a.status} ${a.statusText}`,a.status)}if(a.status===204)return;const s=await a.text();if(s)return JSON.parse(s)}function yn(e,...t){if(Array.isArray(e))return e;if(e&&typeof e=="object"){const a=e;for(const s of[...t,"data","items"])if(Array.isArray(a[s]))return a[s]}return[]}async function P3(){return yn(await Ne("/api/repos"),"repos")}async function U3(e,t,a,s){return Ne("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a,runtimeType:s})})}async function H3(e){return Ne("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function F3(e){await Ne(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function z3(e){await Ne(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function q3(e){await Ne(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function Y3(e){return Ne(`/api/repos/${encodeURIComponent(e)}/branches`)}async function $3(e,t){return Ne(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function G3(e){return Ne(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function Ke(e){return`/api/repos/${encodeURIComponent(e)}`}async function K3(e){return yn(await Ne(`${Ke(e)}/workspaces`),"workspaces")}async function V3(e,t){await Ne(`${Ke(e)}/workspaces/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Q3(e){return Ne(`${Ke(e)}/workspaces/cleanup`,{method:"POST"})}async function X3(e,t){await Ne(`/api/repos/${e}/worktree`,{method:"PATCH",body:JSON.stringify({enabled:t})})}async function W3(e,t){await Ne(`/api/repos/${e}/runtime`,{method:"PATCH",body:JSON.stringify({runtimeType:t})})}async function Z3(e){return yn(await Ne(`${Ke(e)}/sessions`),"sessions")}async function J3(e,t,a,s,l,u,d,f){return Ne(`${Ke(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:s,variant:l,issueId:u,customAgentId:d,files:f})})}async function eC(e,t){return Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`)}async function tC(e,t){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function nC(e,t,a,s,l,u){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:s,model:l,files:u})})}async function aC(e,t){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function rC(e,t,a){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function sC(e,t){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}function iC(e){const t=e,a=t.info;if(a&&typeof a.id=="string"){const s=Array.isArray(t.parts)?t.parts:void 0;return{...a,...s?{parts:s}:{}}}return t}async function lC(e,t){return yn(await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/messages`),"messages").map(iC)}async function oC(e,t){return yn(await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/todos`),"todos")}async function ay(e,t){return Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/status`)}async function cx(e,t){return Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/links`)}async function dx(e){return Ne(`${Ke(e)}/sessions/all-links`)}async function uC(e,t,a,s){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:s})})}async function cC(e,t,a,s){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:s})})}async function dC(e){return yn(await Ne(`${Ke(e)}/agents`),"agents")}async function ry(){return yn(await Ne("/api/custom-agents"))}async function sy(e){return Ne("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function iy(e,t){return Ne(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function ly(e){await Ne(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function fx(e){return Ne(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function fC(e){return Ne("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function mC(e){return yn(await Ne(`${Ke(e)}/custom-agents`))}async function hC(e,t){return Ne(`${Ke(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function zc(e){return yn(await Ne(`${Ke(e)}/models`))}async function pC(){return yn(await Ne("/api/prompt-fragments"))}async function gC(e){return Ne("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function bC(e,t){return Ne(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function xC(e){await Ne(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function mx(e){return yn(await Ne(`${Ke(e)}/tags`))}async function hx(e,t){return yn(await Ne(`${Ke(e)}/milestones`))}async function px(e,t="open"){return yn(await Ne(`${Ke(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function EC(e,t="all"){return Ne(`${Ke(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function yC(e,t,a){return Ne(`${Ke(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function TC(e,t,a){await Ne(`${Ke(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function oy(e,t,a){return Ne(`${Ke(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function gx(e,t){return yn(await Ne(`${Ke(e)}/issues/${t}/pulls`))}async function _C(e,t,a,s=!1){await Ne(`${Ke(e)}/issues/${t}/pulls/${a}/merge`,{method:"POST",body:JSON.stringify({closeIssue:s})})}async function bx(e,t="open"){return yn(await Ne(`${Ke(e)}/pulls?state=${encodeURIComponent(t)}`))}async function NC(e,t="all"){return Ne(`${Ke(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function vC(e,t){await Ne(`${Ke(e)}/pulls/${t}/merge`,{method:"POST"})}async function uy(e,t){return yn(await Ne(`${Ke(e)}/pulls/${t}/issues`))}async function SC(e,t,a){await Ne(`${Ke(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function AC(e,t,a){await Ne(`${Ke(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function CC(e,t){return Ne(`${Ke(e)}/pulls/${t}/comments`)}async function wC(e,t){return Ne(`${Ke(e)}/issues/${t}/comments`)}async function xx(e,t,a){return Ne(`${Ke(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function kC(e,t,a){return Ne(`${Ke(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function Ex(e,t){return Ne(`${Ke(e)}/issues/${t}/draft`)}async function RC(e,t,a){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function OC(e,t,a){await Ne(`${Ke(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function IC(){return Ne("/api/agents-md")}async function MC(e){await Ne("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function DC(e){return Ne(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function LC(e,t){await Ne(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function jC(e){return`${ny()}${Ke(e)}/events`}async function BC(e){return Ne(`${Ke(e)}/sessions/status`)}async function qc(){return Ne("/api/settings")}async function Zm(e,t){await Ne(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function Jm(){return Ne("/api/cloud/status")}async function PC(){return Ne("/api/cloud/reload",{method:"POST"})}async function UC(e){try{return(await Ne("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function HC(){return yn(await Ne("/api/git-hosts"),"gitHosts")}async function FC(e,t,a,s="gitea"){return Ne("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:s})})}async function zC(e){await Ne(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function cy(){return Ne("/api/usage")}async function dy(e){return Ne("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function qC(e,t="ios"){await Ne("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const as="fs-active-repo",Fe=Wa((e,t)=>({repos:[],activeRepoId:localStorage.getItem(as),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await P3(),s=t().activeRepoId,l=s&&a.some(d=>d.id===s);e({repos:a,loading:!1,activeRepoId:l?s:a.length>0?a[0].id:null});const u=t().activeRepoId;u?localStorage.setItem(as,u):localStorage.removeItem(as)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(as,a):localStorage.removeItem(as)},addRepo:async(a,s,l,u)=>{try{const d=await U3(a,s,l,u);return e(f=>({repos:[...f.repos,d],activeRepoId:d.id})),localStorage.setItem(as,d.id),d}catch(d){return e({loadError:d instanceof Error?d.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await F3(a)}catch{}e(s=>{const l=s.repos.filter(d=>d.id!==a),u=s.activeRepoId===a?l.length>0?l[0].id:null:s.activeRepoId;return u?localStorage.setItem(as,u):localStorage.removeItem(as),{repos:l,activeRepoId:u}})},updateRepoBranch:(a,s)=>{e(l=>({repos:l.repos.map(u=>u.id===a?{...u,branch:s}:u)}))}})),La=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},gm="fs-nav-collapsed",bm="fs-session-panel-collapsed",Ec=Wa(e=>({navCollapsed:localStorage.getItem(gm)==="true",sessionPanelCollapsed:localStorage.getItem(bm)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(gm,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(bm,String(a)),{sessionPanelCollapsed:a}})},setNavCollapsed(t){localStorage.setItem(gm,String(t)),e({navCollapsed:t})},setSessionPanelCollapsed(t){localStorage.setItem(bm,String(t)),e({sessionPanelCollapsed:t})}})),fy=[{segment:"repos",icon:ZS,label:"仓库管理",global:!0},{segment:"run",icon:Hc,label:"运行面板",global:!1},{segment:"issues",icon:mo,label:"Issues",global:!1},{segment:"pulls",icon:ho,label:"PRs",global:!1},{segment:"settings",icon:E3,label:"设置",global:!0}];function my(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function YC({repoId:e,currentBranch:t}){const a=Fe(A=>A.updateRepoBranch),[s,l]=S.useState(!1),[u,d]=S.useState(null),[f,m]=S.useState(!1),[h,x]=S.useState(null),[b,y]=S.useState(null),T=S.useRef(null),N=S.useCallback(()=>{l(!1),y(null)},[]);S.useEffect(()=>{if(!s)return;const A=R=>{T.current&&!T.current.contains(R.target)&&N()};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[s,N]);const v=async()=>{if(s){N();return}l(!0),m(!0),y(null);try{d(await Y3(e))}catch{y("加载分支失败")}finally{m(!1)}},C=async A=>{if(!(A===t||h)){x(A),y(null);try{const R=await $3(e,A);a(e,R.branch),N()}catch(R){y(R instanceof Error?R.message:"切换失败")}finally{x(null)}}};return t?o.jsxs("div",{ref:T,className:"relative",children:[o.jsxs("button",{type:"button",onClick:v,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:[o.jsx(Ys,{className:"h-3 w-3"}),t,o.jsx(vr,{className:oe("h-3 w-3 transition-transform",s&&"rotate-180")})]}),s&&o.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?o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(va,{className:"h-4 w-4 animate-spin text-fg-4"})}):u?o.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[u.local.map(A=>o.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:oe("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",A===t?"font-medium text-blue-600":"text-fg-2 hover:bg-elevated"),children:[A===t?o.jsx(oa,{className:"h-3 w-3 shrink-0"}):h===A?o.jsx(va,{className:"h-3 w-3 shrink-0 animate-spin"}):o.jsx("span",{className:"h-3 w-3 shrink-0"}),o.jsx("span",{className:"truncate",children:A})]},A)),u.remote.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-3 my-1 border-t border-line"}),o.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),u.remote.map(A=>o.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>C(A),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-fg-2 transition-colors hover:bg-elevated",children:[h===A?o.jsx(va,{className:"h-3 w-3 shrink-0 animate-spin"}):o.jsx("span",{className:"h-3 w-3 shrink-0"}),o.jsx("span",{className:"truncate",children:A})]},`remote-${A}`))]})]}):null,b&&o.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:b})]})]}):null}function $C(){const[e,t]=S.useState(null);return S.useEffect(()=>{const a=()=>fetch("/api/health").then(u=>u.json()).then(u=>{u.latestVersion&&u.latestVersion!=="0.9.4"&&t(u.latestVersion)}).catch(()=>{});a();const s=setInterval(a,30*6e4),l=()=>a();return window.addEventListener("focus",l),()=>{clearInterval(s),window.removeEventListener("focus",l)}},[]),e}function GC(){const e=Aa(),t=ca(),a=Fe(b=>b.repos),s=Fe(b=>b.activeRepoId),l=Fe(b=>b.setActiveRepo),u=Xm(b=>b.preference),d=Xm(b=>b.cycle),f=u==="light"?N3:u==="dark"?r3:n3,m=a.find(b=>b.id===s),h=$C(),x=b=>{var N;if(!b)return;l(b);const y=a.find(v=>v.id===b);if(!y)return;const T=((N=t.pathname.match(/\/(run|issues|pulls)/))==null?void 0:N[1])??"run";e(`/${encodeURIComponent(y.name)}/${T}`)};return o.jsx("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:o.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(jh,{className:"h-5 w-5 text-blue-500"}),o.jsx("span",{className:"text-sm font-bold tracking-tight text-fg",children:"Fourth Spark"}),o.jsxs("span",{className:"rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4",children:["v","0.9.4"]}),h&&o.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",o.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("select",{value:s??"",onChange:b=>x(b.target.value),className:"rounded-md border border-line bg-base px-2.5 py-1 text-xs text-fg-2 focus:border-blue-500 focus:outline-none",children:a.map(b=>o.jsx("option",{value:b.id,children:b.name},b.id))}),m&&s&&o.jsx(YC,{repoId:s,currentBranch:m.branch})]}),o.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:o.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:o.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"})})}),o.jsx("button",{type:"button",onClick:d,"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:o.jsx(f,{className:"h-4 w-4"})})]})]})})}function KC(){const e=Fe(La),t=Ec(s=>s.navCollapsed),a=Ec(s=>s.toggleNav);return o.jsxs("nav",{className:oe("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:[o.jsx("div",{className:"flex flex-1 flex-col",children:fy.map(s=>o.jsxs(Ih,{to:my(s.segment,s.global,e),title:t?s.label:void 0,className:({isActive:l})=>oe("mx-2 flex items-center rounded-md py-2 text-sm transition-colors",t?"justify-center px-2":"gap-2.5 px-3",l?"bg-blue-500/10 font-medium text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:[o.jsx(s.icon,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:oe("truncate transition-[opacity,max-width] duration-200 ease-in-out",t?"max-w-0 opacity-0":"max-w-[8rem] opacity-100"),children:s.label})]},s.segment))}),o.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?o.jsx(uA,{className:"h-4 w-4"}):o.jsx(lA,{className:"h-4 w-4"})})]})}function VC(){const e=Fe(La);return o.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:o.jsx("div",{className:"flex h-14 items-center justify-around",children:fy.map(t=>o.jsx(Ih,{to:my(t.segment,t.global,e),"aria-label":t.label,className:({isActive:a})=>oe("flex h-10 w-10 items-center justify-center rounded-md transition-colors",a?"bg-blue-500/10 text-blue-600":"text-fg-3 hover:bg-elevated hover:text-fg"),children:o.jsx(t.icon,{className:"h-5 w-5 shrink-0"})},t.segment))})})}function QC(){return o.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[o.jsx(GC,{}),o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx(KC,{}),o.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:o.jsx(Wv,{})})]}),o.jsx(VC,{})]})}function XC({onClose:e}){const[t,a]=S.useState(""),[s,l]=S.useState(""),[u,d]=S.useState(""),[f,m]=S.useState("opencode"),[h,x]=S.useState(!1),[b,y]=S.useState(""),T=Fe(R=>R.addRepo),N=s.trim()!==""&&u.trim()!==""&&t.trim()!==""&&!h,v=async R=>{const w=R.trim();if(w){x(!0),y("");try{const U=await H3(w);U.name&&!s.trim()&&l(U.name),U.gitUrl&&!u.trim()&&d(U.gitUrl)}catch(U){const G=U instanceof Error?U.message:"无法解析路径";try{const L=JSON.parse(G);y(L.error??G)}catch{y(G)}}x(!1)}},C=S.useRef(v);C.current=v,S.useEffect(()=>{const R=t.trim();if(!R)return;const w=setTimeout(()=>{C.current(R)},500);return()=>clearTimeout(w)},[t]);const A=async()=>{if(!N)return;y(""),await T(s.trim(),u.trim(),t.trim(),f)&&e()};return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:o.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:R=>R.stopPropagation(),children:[o.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[o.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),o.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:o.jsx(gt,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),o.jsx("input",{id:"m-path",value:t,onChange:R=>a(R.target.value),onBlur:R=>void v(R.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"}),o.jsx("span",{className:"text-[11px] text-fg-5",children:h?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),o.jsx("input",{id:"m-name",value:s,onChange:R=>l(R.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"})]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),o.jsx("input",{id:"m-git",value:u,onChange:R=>d(R.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"})]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{className:"text-xs font-medium text-fg-3",children:"运行时"}),o.jsx("div",{className:"flex gap-2",children:[{value:"opencode",label:"OpenCode"},{value:"claude-code",label:"Claude Code"}].map(R=>o.jsx("button",{type:"button",onClick:()=>m(R.value),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${f===R.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:R.label},R.value))}),o.jsx("span",{className:"text-[11px] text-fg-5",children:f==="claude-code"?"需要本地安装 Claude Code CLI":"需要本地安装 OpenCode CLI"})]}),b&&o.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:b}),o.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[o.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:"取消"}),o.jsx("button",{type:"button",onClick:A,disabled:!N,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 WC({repoId:e,repoName:t,onClose:a}){const[s,l]=S.useState(""),[u,d]=S.useState(""),[f,m]=S.useState(!0),[h,x]=S.useState(!1),[b,y]=S.useState(null);S.useEffect(()=>{DC(e).then(v=>{l(v.content),d(v.content),m(!1)}).catch(v=>{y(v instanceof Error?v.message:String(v)),m(!1)})},[e]);const T=async()=>{x(!0),y(null);try{await LC(e,s),d(s)}catch(v){y(v instanceof Error?v.message:String(v))}x(!1)},N=s!==u;return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:o.jsxs("div",{className:"flex w-full max-w-2xl flex-col rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:v=>v.stopPropagation(),children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),o.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),o.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:o.jsx(gt,{className:"h-4 w-4"})})]}),b&&o.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:[o.jsx(Dn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"min-w-0 break-words",children:b})]}),f?o.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[o.jsx(va,{className:"h-5 w-5 fs-spin"}),o.jsx("p",{className:"text-xs",children:"加载中…"})]}):o.jsx("textarea",{value:s,onChange:v=>l(v.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
|
|
441
441
|
|
|
442
442
|
在此编写该仓库的 Agent 指令…`}),o.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[o.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:"关闭"}),o.jsxs("button",{type:"button",onClick:()=>void T(),disabled:h||!N,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:[o.jsx(Fc,{className:"h-3.5 w-3.5"}),h?"保存中…":"保存"]})]})]})})}const eh=1024,th=eh*1024,yx=th*1024;function Tx(e){return!e||e<=0?"0 B":e<eh?`${e} B`:e<th?`${(e/eh).toFixed(1)} KB`:e<yx?`${(e/th).toFixed(1)} MB`:`${(e/yx).toFixed(2)} GB`}const xm="ws/";function ZC({repoId:e}){const[t,a]=S.useState(!1),[s,l]=S.useState(null),[u,d]=S.useState(!1),[f,m]=S.useState(null),[h,x]=S.useState(null),[b,y]=S.useState(!1),T=async()=>{d(!0),m(null);try{const R=await K3(e);l(R)}catch(R){m(R instanceof Qa?R.message:"加载失败")}d(!1)};S.useEffect(()=>{t&&s===null&&T()},[t]);const N=async R=>{x(R);try{await V3(e,R),await T()}catch(w){m(w instanceof Qa?w.message:"删除失败")}x(null)},v=async()=>{y(!0);try{await Q3(e),await T()}catch(R){m(R instanceof Qa?R.message:"清理失败")}y(!1)},C=(s==null?void 0:s.length)??0,A=(s==null?void 0:s.reduce((R,w)=>R+(w.diskUsage||0),0))??0;return o.jsxs("div",{className:"mt-3 border-t border-line pt-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("button",{type:"button",onClick:()=>a(R=>!R),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?o.jsx(sA,{className:"h-3 w-3 shrink-0"}):o.jsx(vr,{className:"h-3 w-3 shrink-0"}),o.jsx(Ys,{className:"h-3 w-3 shrink-0 text-fg-5"}),o.jsx("span",{children:"工作空间"}),s!==null&&o.jsxs("span",{className:"text-fg-5",children:["(",C,") · ",Tx(A)]})]}),t&&C>0&&o.jsxs("button",{type:"button",onClick:()=>void v(),disabled:b,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:[b?o.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):null,"清理已合并"]})]}),t&&o.jsxs("div",{className:"mt-2",children:[f&&o.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:[o.jsx("span",{className:"truncate",children:f}),o.jsx("button",{type:"button",onClick:()=>m(null),className:"shrink-0 rounded p-0.5 transition-colors hover:bg-red-500/10",children:o.jsx(gt,{className:"h-3 w-3"})})]}),u&&s===null?o.jsx("div",{className:"flex justify-center py-3",children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-fg-5 border-t-transparent"})}):C===0?o.jsx("p",{className:"py-2 text-center text-xs text-fg-5",children:"暂无工作空间"}):o.jsx("ul",{className:"space-y-1",children:s==null?void 0:s.map(R=>{const w=R.branch.startsWith(xm),U=w?R.branch.slice(xm.length):R.branch,G=R.status==="active"?"bg-emerald-500/10 text-emerald-600":R.status==="idle"?"bg-amber-500/10 text-amber-600":"bg-fg-6/30 text-fg-4",L=R.status==="active"?"活跃":R.status==="idle"?"空闲":R.status==="merged"?"已合并":R.status==="stale"?"陈旧":R.status,D=R.status!=="active";return o.jsxs("li",{className:"flex items-center gap-2 rounded-md border border-line bg-elevated/40 px-2 py-1.5 text-xs",children:[o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[R.running&&R.port&&o.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500",title:`运行中 :${R.port}`}),o.jsxs("span",{className:"min-w-0 truncate font-mono",children:[w&&o.jsx("span",{className:"text-fg-5",children:xm}),o.jsx("span",{className:"text-fg-2",children:U})]})]}),o.jsx("span",{className:oe("shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium",G),children:L}),o.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 text-fg-5",children:[o.jsx(BA,{className:"h-2.5 w-2.5"}),Tx(R.diskUsage)]}),o.jsx("button",{type:"button",onClick:()=>void N(R.id),disabled:!D||h===R.id,title:D?"删除工作空间":"活跃工作空间无法删除",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===R.id?o.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):o.jsx(zs,{className:"h-3 w-3"})})]},R.id)})})]})]})}function JC(){const e=Fe(w=>w.repos),t=Fe(w=>w.activeRepoId),a=Fe(w=>w.setActiveRepo),s=Fe(w=>w.removeRepo),l=Fe(w=>w.loadRepos),[u,d]=S.useState(!1),[f,m]=S.useState(null),[h,x]=S.useState(null),[b,y]=S.useState(null),[T,N]=S.useState(null),[v,C]=S.useState(null),A=async(w,U)=>{x(w);try{U?await q3(w):await z3(w),await l()}catch{}x(null)},R=async w=>{y(w),N(null);try{await G3(w),await l()}catch(U){let G="拉取失败";if(U instanceof Qa)try{G=JSON.parse(U.message).error??U.message}catch{G=U.message}N(G)}y(null)};return o.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o.jsxs("div",{className:"mx-auto max-w-4xl",children:[o.jsxs("div",{className:"mb-6 flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h1",{className:"text-lg font-semibold text-fg",children:"仓库管理"}),o.jsx("p",{className:"mt-0.5 text-sm text-fg-4",children:"管理代码仓库,每个仓库对应一个独立的 Agent 运行环境"})]}),o.jsxs("button",{type:"button",onClick:()=>d(!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:[o.jsx(Xa,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden md:inline",children:"添加仓库"})]})]}),T&&o.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/5 px-4 py-2.5 text-sm text-red-600",children:[o.jsx("span",{children:T}),o.jsx("button",{type:"button",onClick:()=>N(null),className:"shrink-0 rounded p-0.5 transition-colors hover:bg-red-500/10",children:o.jsx(gt,{className:"h-3.5 w-3.5"})})]}),e.length===0?o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed border-line-hard py-16 text-center",children:[o.jsx("div",{className:"rounded-full bg-elevated p-3",children:o.jsx(Xa,{className:"h-6 w-6 text-fg-4"})}),o.jsx("p",{className:"text-sm font-medium text-fg-3",children:"暂无代码仓库"}),o.jsx("p",{className:"text-xs text-fg-5",children:"添加一个本地仓库开始使用"}),o.jsx("button",{type:"button",onClick:()=>d(!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:"添加仓库"})]}):o.jsx(o.Fragment,{children:o.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:e.map(w=>{const U=w.id===t;return o.jsxs("div",{className:oe("rounded-xl border p-4 transition-colors",U?"border-blue-500/40 bg-blue-500/5":"border-line"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("button",{type:"button",onClick:()=>a(w.id),className:"flex min-w-0 items-center gap-2 text-left",children:[U?o.jsx(mo,{className:"h-4 w-4 shrink-0 text-blue-500"}):o.jsx(hA,{className:"h-4 w-4 shrink-0 text-fg-5"}),o.jsx("span",{className:oe("truncate font-medium",U?"text-fg":"text-fg-2"),children:w.name})]}),o.jsxs("span",{className:oe("inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",w.running?"bg-emerald-500/10 text-emerald-600":"bg-fg-6/30 text-fg-4"),children:[o.jsx("span",{className:oe("h-1.5 w-1.5 rounded-full",w.running?"bg-emerald-500":"bg-fg-5")}),w.running?"运行中":"已停止"]})]}),o.jsxs("dl",{className:"mt-3 space-y-1 font-mono text-xs text-fg-4",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("dt",{className:"shrink-0 text-fg-5",children:"Git"}),o.jsx("dd",{className:"min-w-0 truncate",children:w.gitUrl})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("dt",{className:"shrink-0 text-fg-5",children:"路径"}),o.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx("span",{className:"truncate",children:w.localPath}),o.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(w.localPath),title:"复制路径",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:o.jsx(hc,{className:"h-3 w-3"})})]})]}),w.running&&w.port&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("dt",{className:"shrink-0 text-fg-5",children:"直连"}),o.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsxs("a",{href:`http://127.0.0.1:${w.port}`,target:"_blank",rel:"noopener noreferrer",className:"truncate text-blue-500 hover:underline",children:["127.0.0.1:",w.port]}),o.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(`http://127.0.0.1:${w.port}`),title:"复制链接",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:o.jsx(hc,{className:"h-3 w-3"})})]})]})]}),o.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:async()=>{const G=w.runtimeType==="claude-code"?"opencode":"claude-code";await W3(w.id,G),l()},className:oe("flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-md border px-2.5 text-xs font-medium transition-colors",w.runtimeType==="claude-code"?"border-orange-500/30 text-orange-600 hover:bg-orange-500/10":"border-sky-500/30 text-sky-600 hover:bg-sky-500/10"),title:`当前运行时: ${w.runtimeType==="claude-code"?"Claude Code":"OpenCode"},点击切换`,children:w.runtimeType==="claude-code"?"Claude":"OpenCode"}),o.jsxs("button",{type:"button",onClick:async()=>{await X3(w.id,!w.worktreeEnabled),l()},className:oe("flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-md border px-2.5 text-xs font-medium transition-colors",w.worktreeEnabled?"border-violet-500/30 text-violet-600 hover:bg-violet-500/10":"border-line text-fg-4 hover:bg-elevated hover:text-fg-2"),title:w.worktreeEnabled?"Worktree 已开启":"Worktree 已关闭",children:[o.jsx(Ys,{className:"h-3 w-3"}),"Worktree"]}),o.jsxs("button",{type:"button",onClick:()=>C({id:w.id,name:w.name}),className:"flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-md border border-line px-2.5 text-xs font-medium text-fg-4 transition-colors hover:bg-elevated hover:text-fg-2",children:[o.jsx($E,{className:"h-3 w-3"}),"配置"]}),o.jsx("button",{type:"button",onClick:()=>void R(w.id),disabled:b===w.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:b===w.id?o.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):o.jsxs(o.Fragment,{children:[o.jsx(FS,{className:"h-3 w-3"}),"拉取"]})}),o.jsx("button",{type:"button",onClick:()=>void A(w.id,w.running),disabled:h===w.id,className:oe("flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md border text-xs font-medium transition-colors disabled:opacity-50",w.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===w.id?o.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):w.running?o.jsxs(o.Fragment,{children:[o.jsx(VE,{className:"h-3 w-3 fill-current"}),"停止"]}):o.jsxs(o.Fragment,{children:[o.jsx(Hc,{className:"h-3 w-3 fill-current"}),"启动"]})}),f===w.id?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:()=>{s(w.id),m(null)},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-red-500/30 text-red-500 transition-colors hover:bg-red-500/10",children:o.jsx(oa,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>m(null),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",children:o.jsx(gt,{className:"h-3.5 w-3.5"})})]}):o.jsx("button",{type:"button",onClick:()=>m(w.id),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line text-fg-5 transition-colors hover:bg-red-500/10 hover:text-red-500",children:o.jsx(zs,{className:"h-3.5 w-3.5"})})]}),w.worktreeEnabled&&o.jsx(ZC,{repoId:w.id})]},w.id)})})}),o.jsxs("p",{className:"mt-3 text-xs text-fg-5",children:[e.length," 个仓库"]})]}),u&&o.jsx(XC,{onClose:()=>d(!1)}),v&&o.jsx(WC,{repoId:v.id,repoName:v.name,onClose:()=>C(null)})]})}const ew=new Set(["tool","tool-use","tool_use","tool-call","tool_call","tool-result","tool_result"]),tw=new Set(["thinking","reasoning","reason"]),nw=new Set(["text","output_text","message"]),aw=new Set(["file","image"]);function yc(e){var a;const t=((a=e.type)==null?void 0:a.toLowerCase())??"";return ew.has(t)||e.toolName!=null||e.tool!=null?"tool":aw.has(t)?"file":tw.has(t)?"thinking":nw.has(t)||e.content!=null||e.text!=null?"text":"other"}function Tc(e){return e.content??e.text??""}function hy(e){return e.toolName??e.tool??"tool"}function Yc(e){var t;return e.input??((t=e.state)==null?void 0:t.input)}function Bh(e){var t;return e.output??((t=e.state)==null?void 0:t.output)}function Ph(e){var a,s,l;const t=(s=(a=e.state)==null?void 0:a.status)==null?void 0:s.toLowerCase();return t==="completed"||t==="done"||t==="success"?"completed":t==="error"||t==="failed"||((l=e.state)==null?void 0:l.error)!=null?"error":t==="pending"||t==="queued"?"pending":t==="running"||t==="in_progress"?"running":Bh(e)!=null?"completed":"running"}function _x(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Pi(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 rw(e){return e.filter(t=>Pi(t.status)==="completed").length}function po(e){const t=hy(e).toLowerCase();return t==="question"||t==="mcp_question"}function sw(e){const t=Yc(e);if(!t||typeof t!="object")return null;const a=t;return Array.isArray(a.questions)?a.questions:null}function _c(e){if(!po(e))return!1;const t=Ph(e);return t==="pending"||t==="running"}const iw=/\bses_[a-zA-Z0-9]+/;function lw(e){var l;const t=Yc(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=(l=e.state)==null?void 0:l.metadata;if(a){const u=a.session_id??a.sessionId;if(typeof u=="string"&&u.startsWith("ses_"))return u}const s=Bh(e);if(typeof s=="string"){const u=iw.exec(s);if(u)return u[0]}if(s&&typeof s=="object"){const u=s,d=u.session_id??u.sessionId??u.task_id;if(typeof d=="string"&&d.startsWith("ses_"))return d}return null}const ow=["Sisyphus","Prometheus","Atlas"];function uw(e){const t=(e.name||e.id||"").toLowerCase();return ow.some(a=>t.startsWith(a.toLowerCase()))}const cw=Wa(e=>({agents:[],loaded:!1,loadAgents:async()=>{const t=Fe.getState().activeRepoId;if(!t){e({agents:[],loaded:!0});return}try{const a=await dC(t);e({agents:a.filter(uw),loaded:!0})}catch{e({loaded:!0})}}}));let dw=0;const Yt=Wa(e=>({toasts:[],addToast:(t,a="info",s,l)=>{const u=(l==null?void 0:l.id)??`toast-${++dw}-${Date.now()}`;e(d=>d.toasts.some(f=>f.id===u)?d:{toasts:[...d.toasts,{id:u,message:t,variant:a,sessionId:s,persistent:l==null?void 0:l.persistent}]}),l!=null&&l.persistent||setTimeout(()=>{e(d=>({toasts:d.toasts.filter(f=>f.id!==u)}))},4e3)},removeToast:t=>{e(a=>({toasts:a.toasts.filter(s=>s.id!==t)}))}}));function py(e){return`question-${e}`}function Em(e,t){const a=t.find(l=>l.id===e),s=(a==null?void 0:a.title)||e.slice(-8);Yt.getState().addToast(`${s} — 等待回复`,"warning",e,{id:py(e),persistent:!0})}function fw(e){var t;for(const a of e)if((t=a.parts)!=null&&t.some(s=>po(s)&&_c(s)))return!0;return!1}const go=[],Nc=[],Nx=[],Ds={};function vx(e){return e.id??e.callID}function $n(){return Fe.getState().activeRepoId}const Ie=Wa((e,t)=>({sessions:[],activeSessionId:null,messages:{},todos:{},sessionStatuses:{},errorReasons:{},queuedMessageIds:{},sessionLinks:{},allSessionLinks:{},sessionFilter:"all",loadingSessions:!1,loadError:null,sendError:null,setSessionFilter:a=>e({sessionFilter:a}),toggleSessionComplete:async a=>{const s=$n();if(!s)return;const l=t().sessions.find(d=>d.id===a);if(!l)return;const u=l.completedAt?null:Date.now();e(d=>({sessions:d.sessions.map(f=>f.id===a?{...f,completedAt:u??void 0}:f)}));try{await OC(s,a,u)}catch{await t().loadSessions()}},loadSessions:async()=>{const a=$n();if(!a){e({sessions:[],loadingSessions:!1});return}e({loadingSessions:!0,loadError:null});try{const[s,l]=await Promise.all([Z3(a),dx(a).catch(()=>null)]),u={sessions:s,loadingSessions:!1};l&&(u.allSessionLinks=l),e(u)}catch(s){e({loadingSessions:!1,loadError:s instanceof Error?s.message:"Failed to load sessions"})}},createSession:async(a,s,l,u,d,f,m)=>{const h=$n();if(!h)return null;e({sendError:null});try{const x=await J3(h,a,s,l,u,d,f,m);return e(b=>({sessions:[x,...b.sessions.filter(y=>y.id!==x.id)],activeSessionId:x.id,messages:{...b.messages,[x.id]:[]}})),t().setSessionStatus(x.id,"busy"),x}catch(x){return e({sendError:x instanceof Error?x.message:"Failed to create session"}),null}},setActiveSession:async a=>{$n()&&(e({activeSessionId:a,sendError:null}),await t().refreshSessionData(a))},refreshSessionData:async a=>{const s=$n();if(!s)return;const[l,u,d,f,m]=await Promise.allSettled([lC(s,a),oC(s,a),ay(s,a),eC(s,a),cx(s,a)]);e(h=>{const x={};if(l.status==="fulfilled"&&(x.messages={...h.messages,[a]:l.value}),u.status==="fulfilled"&&(x.todos={...h.todos,[a]:u.value}),d.status==="fulfilled"&&(x.sessionStatuses={...h.sessionStatuses,[a]:d.value.type}),f.status==="fulfilled"){const b=f.value;x.sessions=h.sessions.map(y=>y.id===a?{...y,...b}:y)}return m.status==="fulfilled"&&(x.sessionLinks={...h.sessionLinks,[a]:m.value}),x}),l.status==="fulfilled"&&fw(l.value)&&Em(a,t().sessions)},refreshSessionLinks:async a=>{const s=$n();if(s)try{const[l,u]=await Promise.all([cx(s,a),dx(s).catch(()=>null)]);e(d=>{const f={sessionLinks:{...d.sessionLinks,[a]:l}};return u&&(f.allSessionLinks=u),f})}catch{}},addLink:async(a,s,l)=>{const u=$n();if(!u)return!1;try{return await uC(u,a,s,l),await t().refreshSessionLinks(a),!0}catch{return!1}},removeLink:async(a,s,l)=>{const u=$n();if(!u)return!1;try{return await cC(u,a,s,l),await t().refreshSessionLinks(a),!0}catch{return!1}},deleteSession:async a=>{const s=$n();if(s)try{await tC(s,a)}catch{}delete Ds[a],e(l=>{const{[a]:u,...d}=l.messages,{[a]:f,...m}=l.todos,{[a]:h,...x}=l.sessionStatuses,{[a]:b,...y}=l.errorReasons,{[a]:T,...N}=l.queuedMessageIds,{[a]:v,...C}=l.sessionLinks,{[a]:A,...R}=l.allSessionLinks;return{sessions:l.sessions.filter(w=>w.id!==a),messages:d,todos:m,sessionStatuses:x,errorReasons:y,queuedMessageIds:N,sessionLinks:C,allSessionLinks:R,activeSessionId:l.activeSessionId===a?null:l.activeSessionId}})},sendMessage:async(a,s,l)=>{const u=$n(),d=t().activeSessionId;if(!u||!d)return!1;const f=t().sessions.find(h=>h.id===d),m=t().sessionStatuses[d]==="busy";e({sendError:null}),m||t().setSessionStatus(d,"busy");try{const h=cw.getState(),x=f!=null&&f.agent&&h.loaded&&h.agents.some(b=>b.name===f.agent||b.id===f.agent)?f.agent:void 0;return await nC(u,d,a,x,s,l),m&&(Ds[d]=(Ds[d]||0)+1),!0}catch(h){return e({sendError:h instanceof Error?h.message:"Failed to send message"}),m||t().setSessionStatus(d,"idle"),!1}},replyQuestion:async a=>{const s=$n(),l=t().activeSessionId;if(!(!s||!l))try{await rC(s,l,a)}catch(u){e({sendError:u instanceof Error?u.message:"Failed to reply to question"})}},rejectQuestion:async()=>{const a=$n(),s=t().activeSessionId;if(!(!a||!s))try{await sC(a,s)}catch{}},abortSession:async()=>{const a=$n(),s=t().activeSessionId;if(!(!a||!s)){try{await aC(a,s)}catch{}t().setSessionStatus(s,"idle")}},clearSessions:()=>{for(const a of Object.keys(Ds))delete Ds[a];e({sessions:[],activeSessionId:null,messages:{},todos:{},sessionStatuses:{},errorReasons:{},queuedMessageIds:{},sessionLinks:{},allSessionLinks:{},loadError:null,sendError:null})},updateMessage:(a,s)=>{var l;e(u=>{const d=u.messages[a]??[],f=d.findIndex(x=>x.id===s.id);let m,h=u.queuedMessageIds;if(f>=0){const x={...d[f],...s};(!s.parts||s.parts.length===0)&&d[f].parts&&(x.parts=d[f].parts),m=[...d],m[f]=x}else{m=[...d,s];const x=Ds[a]||0;if(s.role==="user"&&x>0){const b=[...h[a]??[]];b.push(s.id),h={...h,[a]:b},Ds[a]=x-1}else if(s.role==="assistant"){const b=h[a];b&&b.length>0&&(h={...h,[a]:b.slice(1)})}}return{messages:{...u.messages,[a]:m},queuedMessageIds:h}}),(l=s.parts)!=null&&l.some(u=>po(u)&&_c(u))&&Em(a,t().sessions)},updateMessagePart:(a,s,l)=>{e(u=>{const d=u.messages[a]??[],f=d.findIndex(N=>N.id===s),m=f>=0?d[f]:{id:s,role:"assistant"},h=m.parts?[...m.parts]:[],x=vx(l),b=x!=null?h.findIndex(N=>vx(N)===x):-1;b>=0?h[b]={...h[b],...l}:h.push(l);const y={...m,parts:h},T=f>=0?[...d]:[...d,y];return f>=0&&(T[f]=y),{messages:{...u.messages,[a]:T}}}),po(l)&&_c(l)&&Em(a,t().sessions)},appendMessagePartDelta:(a,s,l,u)=>{e(d=>{const f=d.messages[a]??[],m=f.findIndex(N=>N.id===s),h=m>=0?f[m]:{id:s,role:"assistant"},x=h.parts?[...h.parts]:[],b=x.findIndex(N=>N.id===l);if(b>=0){const N=x[b],v=Tc(N)+u;x[b]=N.content!=null?{...N,content:v}:{...N,text:v}}else x.push({id:l,type:"text",text:u});const y={...h,parts:x},T=m>=0?[...f]:[...f,y];return m>=0&&(T[m]=y),{messages:{...d.messages,[a]:T}}})},updateTodos:(a,s)=>{e(l=>({todos:{...l.todos,[a]:s}}))},updateSessionInfo:a=>{e(s=>s.sessions.some(u=>u.id===a.id)?{sessions:s.sessions.map(u=>u.id===a.id?{...u,...a}:u)}:{sessions:[a,...s.sessions]})},setSessionStatus:(a,s,l)=>{const u=t().sessionStatuses[a];if(u!==s){const d=t().sessions.find(m=>m.id===a),f=(d==null?void 0:d.title)||a.slice(-8);if(s==="idle"&&u!==void 0&&u!=="idle")Yt.getState().removeToast(py(a)),Yt.getState().addToast(`${f} — 完成`,"success",a);else if(s==="busy"&&(u===void 0||u==="idle"))Yt.getState().addToast(`${f} — 开始运行`,"info",a);else if(s==="retry")Yt.getState().addToast(`${f} — 进入重试`,"warning",a);else if(s==="error"){const m=l?`${f} — 错误: ${l}`:`${f} — 发生错误`;Yt.getState().addToast(m,"error",a)}}e(d=>{const f=l?{...d.errorReasons,[a]:l}:s!=="error"?(()=>{const{[a]:m,...h}=d.errorReasons;return h})():d.errorReasons;return{sessionStatuses:{...d.sessionStatuses,[a]:s},errorReasons:f}})},bulkSetStatuses:a=>{e({sessionStatuses:{...t().sessionStatuses,...a}})},renameSession:async(a,s)=>{const l=$n();if(l){e(u=>({sessions:u.sessions.map(d=>d.id===a?{...d,title:s}:d)}));try{await RC(l,a,s)}catch{await t().loadSessions()}}}})),Ge=Wa((e,t)=>({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,syncing:!1,selectedIssueId:null,previewIssueId:null,matchingParentId:null,matchingCandidateId:null,pendingDraft:null,clearIssues:()=>e({issues:[],tags:[],tagFilterMode:new Map,milestones:[],selectedMilestoneId:null,loaded:!1,selectedIssueId:null,previewIssueId:null,matchingParentId:null,matchingCandidateId:null,pendingDraft:null}),setSelectedIssue:a=>e({selectedIssueId:a}),setPreviewIssue:a=>e({previewIssueId:a}),setPendingDraft:a=>e({pendingDraft:a}),enterMatchMode:a=>e({matchingParentId:a,matchingCandidateId:null,previewIssueId:null}),exitMatchMode:()=>{const a=t().matchingParentId;e({matchingParentId:null,matchingCandidateId:null,previewIssueId:a})},setMatchCandidate:a=>e({matchingCandidateId:a}),linkChild:async(a,s)=>{var u;const l=Fe.getState().activeRepoId;if(!l)return!1;try{await TC(l,a,s);const d=(u=t().issues.find(f=>f.number===a))==null?void 0:u.id;return d&&e(f=>({issues:f.issues.map(m=>m.number===s?{...m,parentId:d}:m),matchingCandidateId:null})),!0}catch{return!1}},updateIssueState:async(a,s)=>{const l=Fe.getState().activeRepoId;if(!l)return!1;try{const u=await oy(l,a,{state:s});return e(d=>({issues:d.issues.map(f=>f.number===a?{...f,state:u.state}:f)})),!0}catch{return!1}},loadIssues:async()=>{const a=Fe.getState().activeRepoId;if(!a){e({issues:[],loaded:!0});return}try{const s=await px(a,"all");e({issues:s,loaded:!0})}catch{e({loaded:!0})}},syncIssues:async()=>{const a=Fe.getState().activeRepoId;if(a){e({syncing:!0});try{await EC(a);const[s,l,u]=await Promise.all([px(a,"all"),mx(a),hx(a)]);e({issues:s,tags:l,milestones:u,syncing:!1})}catch(s){e({syncing:!1});let l="同步 Issue 失败";if(s instanceof Qa)try{const u=JSON.parse(s.message);u.error&&(l=u.error)}catch{s.message&&(l=s.message)}Yt.getState().addToast(l,"error")}}},createIssue:async(a,s)=>{const l=Fe.getState().activeRepoId;if(!l)return null;try{const u=await yC(l,a,s);return e(d=>({issues:[u,...d.issues]})),u}catch{return null}},loadTags:async()=>{const a=Fe.getState().activeRepoId;if(!a){e({tags:[]});return}try{const s=await mx(a);e({tags:s})}catch{}},cycleTagFilter:a=>{e(s=>{const l=new Map(s.tagFilterMode),u=l.get(a);return u?u==="include"?l.set(a,"exclude"):l.delete(a):l.set(a,"include"),{tagFilterMode:l}})},clearTagFilter:()=>e({tagFilterMode:new Map}),loadMilestones:async()=>{const a=Fe.getState().activeRepoId;if(!a){e({milestones:[]});return}try{const s=await hx(a);e({milestones:s})}catch{}},setMilestoneFilter:a=>e({selectedMilestoneId:a})})),oc=Wa(e=>({drafts:{},setDraft:(t,a)=>e(s=>{if(!a.trim()){const{[t]:l,...u}=s.drafts;return{drafts:u}}return{drafts:{...s.drafts,[t]:a}}}),clearDraft:t=>e(a=>{const{[t]:s,...l}=a.drafts;return{drafts:l}})}));function Sx(e){const t=[],a=String(e||"");let s=a.indexOf(","),l=0,u=!1;for(;!u;){s===-1&&(s=a.length,u=!0);const d=a.slice(l,s).trim();(d||!u)&&t.push(d),l=s+1,s=a.indexOf(",",l)}return t}function gy(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const mw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pw={};function Ax(e,t){return(pw.jsx?hw:mw).test(e)}const gw=/[ \t\n\f\r]/g;function bw(e){return typeof e=="object"?e.type==="text"?Cx(e.value):!1:Cx(e)}function Cx(e){return e.replace(gw,"")===""}class No{constructor(t,a,s){this.normal=a,this.property=t,s&&(this.space=s)}}No.prototype.normal={};No.prototype.property={};No.prototype.space=void 0;function by(e,t){const a={},s={};for(const l of e)Object.assign(a,l.property),Object.assign(s,l.normal);return new No(a,s,t)}function bo(e){return e.toLowerCase()}class Qn{constructor(t,a){this.attribute=a,this.property=t}}Qn.prototype.attribute="";Qn.prototype.booleanish=!1;Qn.prototype.boolean=!1;Qn.prototype.commaOrSpaceSeparated=!1;Qn.prototype.commaSeparated=!1;Qn.prototype.defined=!1;Qn.prototype.mustUseProperty=!1;Qn.prototype.number=!1;Qn.prototype.overloadedBoolean=!1;Qn.prototype.property="";Qn.prototype.spaceSeparated=!1;Qn.prototype.space=void 0;let xw=0;const Ve=$s(),sn=$s(),nh=$s(),Ee=$s(),kt=$s(),Us=$s(),ia=$s();function $s(){return 2**++xw}const ah=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:sn,commaOrSpaceSeparated:ia,commaSeparated:Us,number:Ee,overloadedBoolean:nh,spaceSeparated:kt},Symbol.toStringTag,{value:"Module"})),ym=Object.keys(ah);class Uh extends Qn{constructor(t,a,s,l){let u=-1;if(super(t,a),wx(this,"space",l),typeof s=="number")for(;++u<ym.length;){const d=ym[u];wx(this,ym[u],(s&ah[d])===ah[d])}}}Uh.prototype.defined=!0;function wx(e,t,a){a&&(e[t]=a)}function Gi(e){const t={},a={};for(const[s,l]of Object.entries(e.properties)){const u=new Uh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),t[s]=u,a[bo(s)]=s,a[bo(u.attribute)]=s}return new No(t,a,e.space)}const xy=Gi({properties:{ariaActiveDescendant:null,ariaAtomic:sn,ariaAutoComplete:null,ariaBusy:sn,ariaChecked:sn,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:kt,ariaCurrent:null,ariaDescribedBy:kt,ariaDetails:null,ariaDisabled:sn,ariaDropEffect:kt,ariaErrorMessage:null,ariaExpanded:sn,ariaFlowTo:kt,ariaGrabbed:sn,ariaHasPopup:null,ariaHidden:sn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kt,ariaLevel:Ee,ariaLive:null,ariaModal:sn,ariaMultiLine:sn,ariaMultiSelectable:sn,ariaOrientation:null,ariaOwns:kt,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:sn,ariaReadOnly:sn,ariaRelevant:null,ariaRequired:sn,ariaRoleDescription:kt,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:sn,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Ey(e,t){return t in e?e[t]:t}function yy(e,t){return Ey(e,t.toLowerCase())}const Ew=Gi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Us,acceptCharset:kt,accessKey:kt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alpha:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:kt,autoFocus:Ve,autoPlay:Ve,blocking:kt,capture:null,charSet:null,checked:Ve,cite:null,className:kt,closedBy:null,colorSpace:null,cols:Ee,colSpan:Ee,command:null,commandFor:null,content:null,contentEditable:sn,controls:Ve,controlsList:kt,coords:Ee|Us,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:nh,draggable:sn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:kt,height:Ee,hidden:nh,high:Ee,href:null,hrefLang:null,htmlFor:kt,httpEquiv:kt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:kt,itemRef:kt,itemScope:Ve,itemType:kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:Ee,pattern:null,ping:kt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:kt,required:Ve,reversed:Ve,rows:Ee,rowSpan:Ee,sandbox:kt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootCustomElementRegistry:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shadowRootSerializable:Ve,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:sn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:sn,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kt,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:sn,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ve,disablePictureInPicture:Ve,disableRemotePlayback:Ve,exportParts:Us,part:kt,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:yy}),yw=Gi({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:ia,accentHeight:Ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ee,amplitude:Ee,arabicForm:null,ascent:Ee,attributeName:null,attributeType:null,azimuth:Ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ee,by:null,calcMode:null,capHeight:Ee,className:kt,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:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,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:Us,g2:Us,glyphName:Us,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix:ia,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ee,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:Ee,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:Ee,overlineThickness:Ee,paintOrder:null,panose1:null,path:null,pathLength:Ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:kt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ia,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ia,rev:ia,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ia,requiredFeatures:ia,requiredFonts:ia,requiredFormats:ia,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:Ee,specularExponent:Ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ee,strikethroughThickness:Ee,string:null,stroke:null,strokeDashArray:ia,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ee,strokeOpacity:Ee,strokeWidth:null,style:null,surfaceScale:Ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ia,tabIndex:Ee,tableValues:null,target:null,targetX:Ee,targetY:Ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ia,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ee,underlineThickness:Ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ee,values:null,vAlphabetic:Ee,vMathematical:Ee,vectorEffect:null,vHanging:Ee,vIdeographic:Ee,version:null,vertAdvY:Ee,vertOriginX:Ee,vertOriginY:Ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ey}),Ty=Gi({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()}}),_y=Gi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yy}),Ny=Gi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Tw={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"},_w=/[A-Z]/g,kx=/-[a-z]/g,Nw=/^data[-\w.:]+$/i;function $c(e,t){const a=bo(t);let s=t,l=Qn;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&Nw.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(kx,Sw);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!kx.test(u)){let d=u.replace(_w,vw);d.charAt(0)!=="-"&&(d="-"+d),t="data"+d}}l=Uh}return new l(s,t)}function vw(e){return"-"+e.toLowerCase()}function Sw(e){return e.charAt(1).toUpperCase()}const vo=by([xy,Ew,Ty,_y,Ny],"html"),ds=by([xy,yw,Ty,_y,Ny],"svg");function Rx(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function vy(e){return e.join(" ").trim()}var Ii={},Tm,Ox;function Aw(){if(Ox)return Tm;Ox=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,a=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
443
443
|
`,h="/",x="*",b="",y="comment",T="declaration";function N(C,A){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];A=A||{};var R=1,w=1;function U(ie){var se=ie.match(t);se&&(R+=se.length);var K=ie.lastIndexOf(m);w=~K?ie.length-K:w+ie.length}function G(){var ie={line:R,column:w};return function(se){return se.position=new L(ie),Z(),se}}function L(ie){this.start=ie,this.end={line:R,column:w},this.source=A.source}L.prototype.content=C;function D(ie){var se=new Error(A.source+":"+R+":"+w+": "+ie);if(se.reason=ie,se.filename=A.source,se.line=R,se.column=w,se.source=C,!A.silent)throw se}function V(ie){var se=ie.exec(C);if(se){var K=se[0];return U(K),C=C.slice(K.length),se}}function Z(){V(a)}function j(ie){var se;for(ie=ie||[];se=Q();)se!==!1&&ie.push(se);return ie}function Q(){var ie=G();if(!(h!=C.charAt(0)||x!=C.charAt(1))){for(var se=2;b!=C.charAt(se)&&(x!=C.charAt(se)||h!=C.charAt(se+1));)++se;if(se+=2,b===C.charAt(se-1))return D("End of comment missing");var K=C.slice(2,se-2);return w+=2,U(K),C=C.slice(se),w+=2,ie({type:y,comment:K})}}function ee(){var ie=G(),se=V(s);if(se){if(Q(),!V(l))return D("property missing ':'");var K=V(u),H=ie({type:T,property:v(se[0].replace(e,b)),value:K?v(K[0].replace(e,b)):b});return V(d),H}}function X(){var ie=[];j(ie);for(var se;se=ee();)se!==!1&&(ie.push(se),j(ie));return ie}return Z(),X()}function v(C){return C?C.replace(f,b):b}return Tm=N,Tm}var Ix;function Cw(){if(Ix)return Ii;Ix=1;var e=Ii&&Ii.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.default=a;const t=e(Aw());function a(s,l){let u=null;if(!s||typeof s!="string")return u;const d=(0,t.default)(s),f=typeof l=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:x}=m;f?l(h,x,m):x&&(u=u||{},u[h]=x)}),u}return Ii}var Kl={},Mx;function ww(){if(Mx)return Kl;Mx=1,Object.defineProperty(Kl,"__esModule",{value:!0}),Kl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,a=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(h){return!h||a.test(h)||e.test(h)},d=function(h,x){return x.toUpperCase()},f=function(h,x){return"".concat(x,"-")},m=function(h,x){return x===void 0&&(x={}),u(h)?h:(h=h.toLowerCase(),x.reactCompat?h=h.replace(l,f):h=h.replace(s,f),h.replace(t,d))};return Kl.camelCase=m,Kl}var Vl,Dx;function kw(){if(Dx)return Vl;Dx=1;var e=Vl&&Vl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(Cw()),a=ww();function s(l,u){var d={};return!l||typeof l!="string"||(0,t.default)(l,function(f,m){f&&m&&(d[(0,a.camelCase)(f,u)]=m)}),d}return s.default=s,Vl=s,Vl}var Rw=kw();const Ow=Mc(Rw),Gc=Sy("end"),Za=Sy("start");function Sy(e){return t;function t(a){const s=a&&a.position&&a.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function Iw(e){const t=Za(e),a=Gc(e);if(t&&a)return{start:t,end:a}}function no(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Lx(e.position):"start"in e||"end"in e?Lx(e):"line"in e||"column"in e?rh(e):""}function rh(e){return jx(e&&e.line)+":"+jx(e&&e.column)}function Lx(e){return rh(e&&e.start)+"-"+rh(e&&e.end)}function jx(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,a,s){super(),typeof a=="string"&&(s=a,a=void 0);let l="",u={},d=!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"?l=t:!u.cause&&t&&(d=!0,l=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?u.ruleId=s:(u.source=s.slice(0,m),u.ruleId=s.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=l,this.line=f?f.line:void 0,this.name=no(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=d&&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}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const Hh={}.hasOwnProperty,Mw=new Map,Dw=/[A-Z]/g,Lw=new Set(["table","tbody","thead","tfoot","tr"]),jw=new Set(["td","th"]),Ay="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Bw(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=$w(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");s=Yw(a,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?ds:vo,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=Cy(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Cy(e,t,a){if(t.type==="element")return Pw(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Uw(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Fw(e,t,a);if(t.type==="mdxjsEsm")return Hw(e,t);if(t.type==="root")return zw(e,t,a);if(t.type==="text")return qw(e,t)}function Pw(e,t,a){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=ds,e.schema=l),e.ancestors.push(t);const u=ky(e,t.tagName,!1),d=Gw(e,t);let f=zh(e,t);return Lw.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!bw(m):!0})),wy(e,d,u,t),Fh(d,f),e.ancestors.pop(),e.schema=s,e.create(t,u,d,a)}function Uw(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}xo(e,t.position)}function Hw(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xo(e,t.position)}function Fw(e,t,a){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=ds,e.schema=l),e.ancestors.push(t);const u=t.name===null?e.Fragment:ky(e,t.name,!0),d=Kw(e,t),f=zh(e,t);return wy(e,d,u,t),Fh(d,f),e.ancestors.pop(),e.schema=s,e.create(t,u,d,a)}function zw(e,t,a){const s={};return Fh(s,zh(e,t)),e.create(t,e.Fragment,s,a)}function qw(e,t){return t.value}function wy(e,t,a,s){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=s)}function Fh(e,t){if(t.length>0){const a=t.length>1?t:t[0];a&&(e.children=a)}}function Yw(e,t,a){return s;function s(l,u,d,f){const h=Array.isArray(d.children)?a:t;return f?h(u,d,f):h(u,d)}}function $w(e,t){return a;function a(s,l,u,d){const f=Array.isArray(u.children),m=Za(s);return t(l,u,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function Gw(e,t){const a={};let s,l;for(l in t.properties)if(l!=="children"&&Hh.call(t.properties,l)){const u=Vw(e,l,t.properties[l]);if(u){const[d,f]=u;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&jw.has(t.tagName)?s=f:a[d]=f}}if(s){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return a}function Kw(e,t){const a={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const d=u.expression;d.type;const f=d.properties[0];f.type,Object.assign(a,e.evaluater.evaluateExpression(f.argument))}else xo(e,t.position);else{const l=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else xo(e,t.position);else u=s.value===null?!0:s.value;a[l]=u}return a}function zh(e,t){const a=[];let s=-1;const l=e.passKeys?new Map:Mw;for(;++s<t.children.length;){const u=t.children[s];let d;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const h=l.get(m)||0;d=m+"-"+h,l.set(m,h+1)}}const f=Cy(e,u,d);f!==void 0&&a.push(f)}return a}function Vw(e,t,a){const s=$c(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=s.commaSeparated?gy(a):vy(a)),s.property==="style"){let l=typeof a=="object"?a:Qw(e,String(a));return e.stylePropertyNameCase==="css"&&(l=Xw(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?Tw[s.property]||s.property:s.attribute,a]}}function Qw(e,t){try{return Ow(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const s=a,l=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Ay+"#cannot-parse-style-attribute",l}}function ky(e,t,a){let s;if(!a)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let u=-1,d;for(;++u<l.length;){const f=Ax(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}s=d}else s=Ax(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Hh.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);xo(e)}function xo(e,t){const a=new An("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=Ay+"#cannot-handle-mdx-estrees-without-createevaluater",a}function Xw(e){const t={};let a;for(a in e)Hh.call(e,a)&&(t[Ww(a)]=e[a]);return t}function Ww(e){let t=e.replace(Dw,Zw);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Zw(e){return"-"+e.toLowerCase()}const _m={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"]},Jw={};function qh(e,t){const a=Jw,s=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,l=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Ry(e,s,l)}function Ry(e,t,a){if(e5(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 Bx(e.children,t,a)}return Array.isArray(e)?Bx(e,t,a):""}function Bx(e,t,a){const s=[];let l=-1;for(;++l<e.length;)s[l]=Ry(e[l],t,a);return s.join("")}function e5(e){return!!(e&&typeof e=="object")}const Px=document.createElement("i");function Yh(e){const t="&"+e+";";Px.innerHTML=t;const a=Px.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===t?!1:a}function la(e,t,a,s){const l=e.length;let u=0,d;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,a=a>0?a:0,s.length<1e4)d=Array.from(s),d.unshift(t,a),e.splice(...d);else for(a&&e.splice(t,a);u<s.length;)d=s.slice(u,u+1e4),d.unshift(t,0),e.splice(...d),u+=1e4,t+=1e4}function _a(e,t){return e.length>0?(la(e,e.length,0,t),e):t}const Ux={}.hasOwnProperty;function Oy(e){const t={};let a=-1;for(;++a<e.length;)t5(t,e[a]);return t}function t5(e,t){let a;for(a in t){const l=(Ux.call(e,a)?e[a]:void 0)||(e[a]={}),u=t[a];let d;if(u)for(d in u){Ux.call(l,d)||(l[d]=[]);const f=u[d];n5(l[d],Array.isArray(f)?f:f?[f]:[])}}}function n5(e,t){let a=-1;const s=[];for(;++a<t.length;)(t[a].add==="after"?e:s).push(t[a]);la(e,0,0,s)}function Iy(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 Ma(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mn=fs(/[A-Za-z]/),Sn=fs(/[\dA-Za-z]/),a5=fs(/[#-'*+\--9=?A-Z^-~]/);function vc(e){return e!==null&&(e<32||e===127)}const sh=fs(/\d/),r5=fs(/[\dA-Fa-f]/),s5=fs(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function Rt(e){return e!==null&&(e<0||e===32)}function rt(e){return e===-2||e===-1||e===32}const Kc=fs(new RegExp("\\p{P}|\\p{S}","u")),qs=fs(/\s/);function fs(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Ki(e){const t=[];let a=-1,s=0,l=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&Sn(e.charCodeAt(a+1))&&Sn(e.charCodeAt(a+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(a+1);u<56320&&f>56319&&f<57344?(d=String.fromCharCode(u,f),l=1):d="�"}else d=String.fromCharCode(u);d&&(t.push(e.slice(s,a),encodeURIComponent(d)),s=a+l+1,d=""),l&&(a+=l,l=0)}return t.join("")+e.slice(s)}function ct(e,t,a,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(m){return rt(m)?(e.enter(a),f(m)):t(m)}function f(m){return rt(m)&&u++<l?(e.consume(m),f):(e.exit(a),t(m))}}const i5={tokenize:l5};function l5(e){const t=e.attempt(this.parser.constructs.contentInitial,s,l);let a;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ct(e,t,"linePrefix")}function l(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,d(f)}function d(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Ue(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),d)}}const o5={tokenize:u5},Hx={tokenize:c5};function u5(e){const t=this,a=[];let s=0,l,u,d;return f;function f(w){if(s<a.length){const U=a[s];return t.containerState=U[1],e.attempt(U[0].continuation,m,h)(w)}return h(w)}function m(w){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&R();const U=t.events.length;let G=U,L;for(;G--;)if(t.events[G][0]==="exit"&&t.events[G][1].type==="chunkFlow"){L=t.events[G][1].end;break}A(s);let D=U;for(;D<t.events.length;)t.events[D][1].end={...L},D++;return la(t.events,G+1,0,t.events.slice(U)),t.events.length=D,h(w)}return f(w)}function h(w){if(s===a.length){if(!l)return y(w);if(l.currentConstruct&&l.currentConstruct.concrete)return N(w);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Hx,x,b)(w)}function x(w){return l&&R(),A(s),y(w)}function b(w){return t.parser.lazy[t.now().line]=s!==a.length,d=t.now().offset,N(w)}function y(w){return t.containerState={},e.attempt(Hx,T,N)(w)}function T(w){return s++,a.push([t.currentConstruct,t.containerState]),y(w)}function N(w){if(w===null){l&&R(),A(0),e.consume(w);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),v(w)}function v(w){if(w===null){C(e.exit("chunkFlow"),!0),A(0),e.consume(w);return}return Ue(w)?(e.consume(w),C(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(w),v)}function C(w,U){const G=t.sliceStream(w);if(U&&G.push(null),w.previous=u,u&&(u.next=w),u=w,l.defineSkip(w.start),l.write(G),t.parser.lazy[w.start.line]){let L=l.events.length;for(;L--;)if(l.events[L][1].start.offset<d&&(!l.events[L][1].end||l.events[L][1].end.offset>d))return;const D=t.events.length;let V=D,Z,j;for(;V--;)if(t.events[V][0]==="exit"&&t.events[V][1].type==="chunkFlow"){if(Z){j=t.events[V][1].end;break}Z=!0}for(A(s),L=D;L<t.events.length;)t.events[L][1].end={...j},L++;la(t.events,V+1,0,t.events.slice(D)),t.events.length=L}}function A(w){let U=a.length;for(;U-- >w;){const G=a[U];t.containerState=G[1],G[0].exit.call(t,e)}a.length=w}function R(){l.write([null]),u=void 0,l=void 0,t.containerState._closeFlow=void 0}}function c5(e,t,a){return ct(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ui(e){if(e===null||Rt(e)||qs(e))return 1;if(Kc(e))return 2}function Vc(e,t,a){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(t=u(t,a),s.push(u))}return t}const ih={name:"attention",resolveAll:d5,tokenize:f5};function d5(e,t){let a=-1,s,l,u,d,f,m,h,x;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(s=a;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[s][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const b={...e[s][1].end},y={...e[a][1].start};Fx(b,-m),Fx(y,m),d={type:m>1?"strongSequence":"emphasisSequence",start:b,end:{...e[s][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:y},u={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[a][1].start}},l={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[s][1].end={...d.start},e[a][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=_a(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=_a(h,[["enter",l,t],["enter",d,t],["exit",d,t],["enter",u,t]]),h=_a(h,Vc(t.parser.constructs.insideSpan.null,e.slice(s+1,a),t)),h=_a(h,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[a][1].end.offset-e[a][1].start.offset?(x=2,h=_a(h,[["enter",e[a][1],t],["exit",e[a][1],t]])):x=0,la(e,s-1,a-s+3,h),a=s+h.length-x-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function f5(e,t){const a=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Ui(s);let u;return d;function d(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"),x=Ui(m),b=!x||x===2&&l||a.includes(m),y=!l||l===2&&x||a.includes(s);return h._open=!!(u===42?b:b&&(l||!y)),h._close=!!(u===42?y:y&&(x||!b)),t(m)}}function Fx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const m5={name:"autolink",tokenize:h5};function h5(e,t,a){let s=0;return l;function l(T){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(T){return Mn(T)?(e.consume(T),d):T===64?a(T):h(T)}function d(T){return T===43||T===45||T===46||Sn(T)?(s=1,f(T)):h(T)}function f(T){return T===58?(e.consume(T),s=0,m):(T===43||T===45||T===46||Sn(T))&&s++<32?(e.consume(T),f):(s=0,h(T))}function m(T){return T===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.exit("autolink"),t):T===null||T===32||T===60||vc(T)?a(T):(e.consume(T),m)}function h(T){return T===64?(e.consume(T),x):a5(T)?(e.consume(T),h):a(T)}function x(T){return Sn(T)?b(T):a(T)}function b(T){return T===46?(e.consume(T),s=0,x):T===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.exit("autolink"),t):y(T)}function y(T){if((T===45||Sn(T))&&s++<63){const N=T===45?y:b;return e.consume(T),N}return a(T)}}const So={partial:!0,tokenize:p5};function p5(e,t,a){return s;function s(u){return rt(u)?ct(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Ue(u)?t(u):a(u)}}const My={continuation:{tokenize:b5},exit:x5,name:"blockQuote",tokenize:g5};function g5(e,t,a){const s=this;return l;function l(d){if(d===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return a(d)}function u(d){return rt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(d))}}function b5(e,t,a){const s=this;return l;function l(d){return rt(d)?ct(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(My,t,a)(d)}}function x5(e){e.exit("blockQuote")}const Dy={name:"characterEscape",tokenize:E5};function E5(e,t,a){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return s5(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(u)}}const Ly={name:"characterReference",tokenize:y5};function y5(e,t,a){const s=this;let l=0,u,d;return f;function f(b){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),m}function m(b){return b===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(b),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),u=31,d=Sn,x(b))}function h(b){return b===88||b===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(b),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=r5,x):(e.enter("characterReferenceValue"),u=7,d=sh,x(b))}function x(b){if(b===59&&l){const y=e.exit("characterReferenceValue");return d===Sn&&!Yh(s.sliceSerialize(y))?a(b):(e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return d(b)&&l++<u?(e.consume(b),x):a(b)}}const zx={partial:!0,tokenize:_5},qx={concrete:!0,name:"codeFenced",tokenize:T5};function T5(e,t,a){const s=this,l={partial:!0,tokenize:G};let u=0,d=0,f;return m;function m(L){return h(L)}function h(L){const D=s.events[s.events.length-1];return u=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(L)}function x(L){return L===f?(d++,e.consume(L),x):d<3?a(L):(e.exit("codeFencedFenceSequence"),rt(L)?ct(e,b,"whitespace")(L):b(L))}function b(L){return L===null||Ue(L)?(e.exit("codeFencedFence"),s.interrupt?t(L):e.check(zx,v,U)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(L))}function y(L){return L===null||Ue(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),b(L)):rt(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ct(e,T,"whitespace")(L)):L===96&&L===f?a(L):(e.consume(L),y)}function T(L){return L===null||Ue(L)?b(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),N(L))}function N(L){return L===null||Ue(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),b(L)):L===96&&L===f?a(L):(e.consume(L),N)}function v(L){return e.attempt(l,U,C)(L)}function C(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),A}function A(L){return u>0&&rt(L)?ct(e,R,"linePrefix",u+1)(L):R(L)}function R(L){return L===null||Ue(L)?e.check(zx,v,U)(L):(e.enter("codeFlowValue"),w(L))}function w(L){return L===null||Ue(L)?(e.exit("codeFlowValue"),R(L)):(e.consume(L),w)}function U(L){return e.exit("codeFenced"),t(L)}function G(L,D,V){let Z=0;return j;function j(se){return L.enter("lineEnding"),L.consume(se),L.exit("lineEnding"),Q}function Q(se){return L.enter("codeFencedFence"),rt(se)?ct(L,ee,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(se):ee(se)}function ee(se){return se===f?(L.enter("codeFencedFenceSequence"),X(se)):V(se)}function X(se){return se===f?(Z++,L.consume(se),X):Z>=d?(L.exit("codeFencedFenceSequence"),rt(se)?ct(L,ie,"whitespace")(se):ie(se)):V(se)}function ie(se){return se===null||Ue(se)?(L.exit("codeFencedFence"),D(se)):V(se)}}}function _5(e,t,a){const s=this;return l;function l(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return s.parser.lazy[s.now().line]?a(d):t(d)}}const Nm={name:"codeIndented",tokenize:v5},N5={partial:!0,tokenize:S5};function v5(e,t,a){const s=this;return l;function l(h){return e.enter("codeIndented"),ct(e,u,"linePrefix",5)(h)}function u(h){const x=s.events[s.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?d(h):a(h)}function d(h){return h===null?m(h):Ue(h)?e.attempt(N5,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Ue(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function S5(e,t,a){const s=this;return l;function l(d){return s.parser.lazy[s.now().line]?a(d):Ue(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):ct(e,u,"linePrefix",5)(d)}function u(d){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(d):Ue(d)?l(d):a(d)}}const A5={name:"codeText",previous:w5,resolve:C5,tokenize:k5};function C5(e){let t=e.length-4,a=3,s,l;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=a;++s<t;)if(e[s][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[t][1].type="codeTextPadding",a+=2,t-=2;break}}for(s=a-1,t++;++s<=t;)l===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(l=s):(s===t||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),t-=s-l-2,s=l+2),l=void 0);return e}function w5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function k5(e,t,a){let s=0,l,u;return d;function d(b){return e.enter("codeText"),e.enter("codeTextSequence"),f(b)}function f(b){return b===96?(e.consume(b),s++,f):(e.exit("codeTextSequence"),m(b))}function m(b){return b===null?a(b):b===32?(e.enter("space"),e.consume(b),e.exit("space"),m):b===96?(u=e.enter("codeTextSequence"),l=0,x(b)):Ue(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(b))}function h(b){return b===null||b===32||b===96||Ue(b)?(e.exit("codeTextData"),m(b)):(e.consume(b),h)}function x(b){return b===96?(e.consume(b),l++,x):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(b)):(u.type="codeTextData",h(b))}}class R5{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 s=a??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,a,s){const l=a||0;this.setCursor(Math.trunc(t));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Ql(this.left,s),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),Ql(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ql(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);Ql(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ql(this.left,a.reverse())}}}function Ql(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 jy(e){const t={};let a=-1,s,l,u,d,f,m,h;const x=new R5(e);for(;++a<x.length;){for(;a in t;)a=t[a];if(s=x.get(a),a&&s[1].type==="chunkFlow"&&x.get(a-1)[1].type==="listItemPrefix"&&(m=s[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(s[0]==="enter")s[1].contentType&&(Object.assign(t,O5(x,a)),a=t[a],h=!0);else if(s[1]._container){for(u=a,l=void 0;u--;)if(d=x.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(l&&(x.get(l)[1].type="lineEndingBlank"),d[1].type="lineEnding",l=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;l&&(s[1].end={...x.get(l)[1].start},f=x.slice(l,a),f.unshift(s),x.splice(l,a-l+1,f))}}return la(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!h}function O5(e,t){const a=e.get(t)[1],s=e.get(t)[2];let l=t-1;const u=[];let d=a._tokenizer;d||(d=s.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let x,b,y=-1,T=a,N=0,v=0;const C=[v];for(;T;){for(;e.get(++l)[1]!==T;);u.push(l),T._tokenizer||(x=s.sliceStream(T),T.next||x.push(null),b&&d.defineSkip(T.start),T._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(x),T._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),b=T,T=T.next}for(T=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&&(v=y+1,C.push(v),T._tokenizer=void 0,T.previous=void 0,T=T.next);for(d.events=[],T?(T._tokenizer=void 0,T.previous=void 0):C.pop(),y=C.length;y--;){const A=f.slice(C[y],C[y+1]),R=u.pop();m.push([R,R+A.length-1]),e.splice(R,2,A)}for(m.reverse(),y=-1;++y<m.length;)h[N+m[y][0]]=N+m[y][1],N+=m[y][1]-m[y][0]-1;return h}const I5={resolve:D5,tokenize:L5},M5={partial:!0,tokenize:j5};function D5(e){return jy(e),e}function L5(e,t){let a;return s;function s(f){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Ue(f)?e.check(M5,d,u)(f):(e.consume(f),l)}function u(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function d(f){return e.consume(f),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,l}}function j5(e,t,a){const s=this;return l;function l(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),ct(e,u,"linePrefix")}function u(d){if(d===null||Ue(d))return a(d);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(d):e.interrupt(s.parser.constructs.flow,a,t)(d)}}function By(e,t,a,s,l,u,d,f,m){const h=m||Number.POSITIVE_INFINITY;let x=0;return b;function b(A){return A===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(A),e.exit(u),y):A===null||A===32||A===41||vc(A)?a(A):(e.enter(s),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),v(A))}function y(A){return A===62?(e.enter(u),e.consume(A),e.exit(u),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),T(A))}function T(A){return A===62?(e.exit("chunkString"),e.exit(f),y(A)):A===null||A===60||Ue(A)?a(A):(e.consume(A),A===92?N:T)}function N(A){return A===60||A===62||A===92?(e.consume(A),T):T(A)}function v(A){return!x&&(A===null||A===41||Rt(A))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(s),t(A)):x<h&&A===40?(e.consume(A),x++,v):A===41?(e.consume(A),x--,v):A===null||A===32||A===40||vc(A)?a(A):(e.consume(A),A===92?C:v)}function C(A){return A===40||A===41||A===92?(e.consume(A),v):v(A)}}function Py(e,t,a,s,l,u){const d=this;let f=0,m;return h;function h(T){return e.enter(s),e.enter(l),e.consume(T),e.exit(l),e.enter(u),x}function x(T){return f>999||T===null||T===91||T===93&&!m||T===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?a(T):T===93?(e.exit(u),e.enter(l),e.consume(T),e.exit(l),e.exit(s),t):Ue(T)?(e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||T===91||T===93||Ue(T)||f++>999?(e.exit("chunkString"),x(T)):(e.consume(T),m||(m=!rt(T)),T===92?y:b)}function y(T){return T===91||T===92||T===93?(e.consume(T),f++,b):b(T)}}function Uy(e,t,a,s,l,u){let d;return f;function f(y){return y===34||y===39||y===40?(e.enter(s),e.enter(l),e.consume(y),e.exit(l),d=y===40?41:y,m):a(y)}function m(y){return y===d?(e.enter(l),e.consume(y),e.exit(l),e.exit(s),t):(e.enter(u),h(y))}function h(y){return y===d?(e.exit(u),m(d)):y===null?a(y):Ue(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ct(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===d||y===null||Ue(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?b:x)}function b(y){return y===d||y===92?(e.consume(y),x):x(y)}}function ao(e,t){let a;return s;function s(l){return Ue(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a=!0,s):rt(l)?ct(e,s,a?"linePrefix":"lineSuffix")(l):t(l)}}const B5={name:"definition",tokenize:U5},P5={partial:!0,tokenize:H5};function U5(e,t,a){const s=this;let l;return u;function u(T){return e.enter("definition"),d(T)}function d(T){return Py.call(s,e,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(T)}function f(T){return l=Ma(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),T===58?(e.enter("definitionMarker"),e.consume(T),e.exit("definitionMarker"),m):a(T)}function m(T){return Rt(T)?ao(e,h)(T):h(T)}function h(T){return By(e,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(T)}function x(T){return e.attempt(P5,b,b)(T)}function b(T){return rt(T)?ct(e,y,"whitespace")(T):y(T)}function y(T){return T===null||Ue(T)?(e.exit("definition"),s.parser.defined.push(l),t(T)):a(T)}}function H5(e,t,a){return s;function s(f){return Rt(f)?ao(e,l)(f):a(f)}function l(f){return Uy(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return rt(f)?ct(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Ue(f)?t(f):a(f)}}const F5={name:"hardBreakEscape",tokenize:z5};function z5(e,t,a){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Ue(u)?(e.exit("hardBreakEscape"),t(u)):a(u)}}const q5={name:"headingAtx",resolve:Y5,tokenize:$5};function Y5(e,t){let a=e.length-2,s=3,l,u;return e[s][1].type==="whitespace"&&(s+=2),a-2>s&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(s===a-1||a-4>s&&e[a-2][1].type==="whitespace")&&(a-=s+1===a?2:4),a>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[a][1].end},u={type:"chunkText",start:e[s][1].start,end:e[a][1].end,contentType:"text"},la(e,s,a-s+1,[["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t]])),e}function $5(e,t,a){let s=0;return l;function l(x){return e.enter("atxHeading"),u(x)}function u(x){return e.enter("atxHeadingSequence"),d(x)}function d(x){return x===35&&s++<6?(e.consume(x),d):x===null||Rt(x)?(e.exit("atxHeadingSequence"),f(x)):a(x)}function f(x){return x===35?(e.enter("atxHeadingSequence"),m(x)):x===null||Ue(x)?(e.exit("atxHeading"),t(x)):rt(x)?ct(e,f,"whitespace")(x):(e.enter("atxHeadingText"),h(x))}function m(x){return x===35?(e.consume(x),m):(e.exit("atxHeadingSequence"),f(x))}function h(x){return x===null||x===35||Rt(x)?(e.exit("atxHeadingText"),f(x)):(e.consume(x),h)}}const G5=["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"],Yx=["pre","script","style","textarea"],K5={concrete:!0,name:"htmlFlow",resolveTo:X5,tokenize:W5},V5={partial:!0,tokenize:J5},Q5={partial:!0,tokenize:Z5};function X5(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 W5(e,t,a){const s=this;let l,u,d,f,m;return h;function h(M){return x(M)}function x(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),b}function b(M){return M===33?(e.consume(M),y):M===47?(e.consume(M),u=!0,v):M===63?(e.consume(M),l=3,s.interrupt?t:P):Mn(M)?(e.consume(M),d=String.fromCharCode(M),C):a(M)}function y(M){return M===45?(e.consume(M),l=2,T):M===91?(e.consume(M),l=5,f=0,N):Mn(M)?(e.consume(M),l=4,s.interrupt?t:P):a(M)}function T(M){return M===45?(e.consume(M),s.interrupt?t:P):a(M)}function N(M){const Te="CDATA[";return M===Te.charCodeAt(f++)?(e.consume(M),f===Te.length?s.interrupt?t:ee:N):a(M)}function v(M){return Mn(M)?(e.consume(M),d=String.fromCharCode(M),C):a(M)}function C(M){if(M===null||M===47||M===62||Rt(M)){const Te=M===47,ke=d.toLowerCase();return!Te&&!u&&Yx.includes(ke)?(l=1,s.interrupt?t(M):ee(M)):G5.includes(d.toLowerCase())?(l=6,Te?(e.consume(M),A):s.interrupt?t(M):ee(M)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?a(M):u?R(M):w(M))}return M===45||Sn(M)?(e.consume(M),d+=String.fromCharCode(M),C):a(M)}function A(M){return M===62?(e.consume(M),s.interrupt?t:ee):a(M)}function R(M){return rt(M)?(e.consume(M),R):j(M)}function w(M){return M===47?(e.consume(M),j):M===58||M===95||Mn(M)?(e.consume(M),U):rt(M)?(e.consume(M),w):j(M)}function U(M){return M===45||M===46||M===58||M===95||Sn(M)?(e.consume(M),U):G(M)}function G(M){return M===61?(e.consume(M),L):rt(M)?(e.consume(M),G):w(M)}function L(M){return M===null||M===60||M===61||M===62||M===96?a(M):M===34||M===39?(e.consume(M),m=M,D):rt(M)?(e.consume(M),L):V(M)}function D(M){return M===m?(e.consume(M),m=null,Z):M===null||Ue(M)?a(M):(e.consume(M),D)}function V(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Rt(M)?G(M):(e.consume(M),V)}function Z(M){return M===47||M===62||rt(M)?w(M):a(M)}function j(M){return M===62?(e.consume(M),Q):a(M)}function Q(M){return M===null||Ue(M)?ee(M):rt(M)?(e.consume(M),Q):a(M)}function ee(M){return M===45&&l===2?(e.consume(M),K):M===60&&l===1?(e.consume(M),H):M===62&&l===4?(e.consume(M),O):M===63&&l===3?(e.consume(M),P):M===93&&l===5?(e.consume(M),Ae):Ue(M)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(V5,re,X)(M)):M===null||Ue(M)?(e.exit("htmlFlowData"),X(M)):(e.consume(M),ee)}function X(M){return e.check(Q5,ie,re)(M)}function ie(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),se}function se(M){return M===null||Ue(M)?X(M):(e.enter("htmlFlowData"),ee(M))}function K(M){return M===45?(e.consume(M),P):ee(M)}function H(M){return M===47?(e.consume(M),d="",de):ee(M)}function de(M){if(M===62){const Te=d.toLowerCase();return Yx.includes(Te)?(e.consume(M),O):ee(M)}return Mn(M)&&d.length<8?(e.consume(M),d+=String.fromCharCode(M),de):ee(M)}function Ae(M){return M===93?(e.consume(M),P):ee(M)}function P(M){return M===62?(e.consume(M),O):M===45&&l===2?(e.consume(M),P):ee(M)}function O(M){return M===null||Ue(M)?(e.exit("htmlFlowData"),re(M)):(e.consume(M),O)}function re(M){return e.exit("htmlFlow"),t(M)}}function Z5(e,t,a){const s=this;return l;function l(d){return Ue(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):a(d)}function u(d){return s.parser.lazy[s.now().line]?a(d):t(d)}}function J5(e,t,a){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(So,t,a)}}const ek={name:"htmlText",tokenize:tk};function tk(e,t,a){const s=this;let l,u,d;return f;function f(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),m}function m(P){return P===33?(e.consume(P),h):P===47?(e.consume(P),G):P===63?(e.consume(P),w):Mn(P)?(e.consume(P),V):a(P)}function h(P){return P===45?(e.consume(P),x):P===91?(e.consume(P),u=0,N):Mn(P)?(e.consume(P),R):a(P)}function x(P){return P===45?(e.consume(P),T):a(P)}function b(P){return P===null?a(P):P===45?(e.consume(P),y):Ue(P)?(d=b,H(P)):(e.consume(P),b)}function y(P){return P===45?(e.consume(P),T):b(P)}function T(P){return P===62?K(P):P===45?y(P):b(P)}function N(P){const O="CDATA[";return P===O.charCodeAt(u++)?(e.consume(P),u===O.length?v:N):a(P)}function v(P){return P===null?a(P):P===93?(e.consume(P),C):Ue(P)?(d=v,H(P)):(e.consume(P),v)}function C(P){return P===93?(e.consume(P),A):v(P)}function A(P){return P===62?K(P):P===93?(e.consume(P),A):v(P)}function R(P){return P===null||P===62?K(P):Ue(P)?(d=R,H(P)):(e.consume(P),R)}function w(P){return P===null?a(P):P===63?(e.consume(P),U):Ue(P)?(d=w,H(P)):(e.consume(P),w)}function U(P){return P===62?K(P):w(P)}function G(P){return Mn(P)?(e.consume(P),L):a(P)}function L(P){return P===45||Sn(P)?(e.consume(P),L):D(P)}function D(P){return Ue(P)?(d=D,H(P)):rt(P)?(e.consume(P),D):K(P)}function V(P){return P===45||Sn(P)?(e.consume(P),V):P===47||P===62||Rt(P)?Z(P):a(P)}function Z(P){return P===47?(e.consume(P),K):P===58||P===95||Mn(P)?(e.consume(P),j):Ue(P)?(d=Z,H(P)):rt(P)?(e.consume(P),Z):K(P)}function j(P){return P===45||P===46||P===58||P===95||Sn(P)?(e.consume(P),j):Q(P)}function Q(P){return P===61?(e.consume(P),ee):Ue(P)?(d=Q,H(P)):rt(P)?(e.consume(P),Q):Z(P)}function ee(P){return P===null||P===60||P===61||P===62||P===96?a(P):P===34||P===39?(e.consume(P),l=P,X):Ue(P)?(d=ee,H(P)):rt(P)?(e.consume(P),ee):(e.consume(P),ie)}function X(P){return P===l?(e.consume(P),l=void 0,se):P===null?a(P):Ue(P)?(d=X,H(P)):(e.consume(P),X)}function ie(P){return P===null||P===34||P===39||P===60||P===61||P===96?a(P):P===47||P===62||Rt(P)?Z(P):(e.consume(P),ie)}function se(P){return P===47||P===62||Rt(P)?Z(P):a(P)}function K(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):a(P)}function H(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),de}function de(P){return rt(P)?ct(e,Ae,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):Ae(P)}function Ae(P){return e.enter("htmlTextData"),d(P)}}const $h={name:"labelEnd",resolveAll:sk,resolveTo:ik,tokenize:lk},nk={tokenize:ok},ak={tokenize:uk},rk={tokenize:ck};function sk(e){let t=-1;const a=[];for(;++t<e.length;){const s=e[t][1];if(a.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",t+=l}}return e.length!==a.length&&la(e,0,e.length,a),e}function ik(e,t){let a=e.length,s=0,l,u,d,f;for(;a--;)if(l=e[a][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[a][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(d){if(e[a][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=a,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(d=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[d][1].end}},x={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=_a(f,e.slice(u+1,u+s+3)),f=_a(f,[["enter",x,t]]),f=_a(f,Vc(t.parser.constructs.insideSpan.null,e.slice(u+s+4,d-3),t)),f=_a(f,[["exit",x,t],e[d-2],e[d-1],["exit",h,t]]),f=_a(f,e.slice(d+1)),f=_a(f,[["exit",m,t]]),la(e,u,e.length,f),e}function lk(e,t,a){const s=this;let l=s.events.length,u,d;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return f;function f(y){return u?u._inactive?b(y):(d=s.parser.defined.includes(Ma(s.sliceSerialize({start:u.end,end:s.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(nk,x,d?x:b)(y):y===91?e.attempt(ak,x,d?h:b)(y):d?x(y):b(y)}function h(y){return e.attempt(rk,x,b)(y)}function x(y){return t(y)}function b(y){return u._balanced=!0,a(y)}}function ok(e,t,a){return s;function s(b){return e.enter("resource"),e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),l}function l(b){return Rt(b)?ao(e,u)(b):u(b)}function u(b){return b===41?x(b):By(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function d(b){return Rt(b)?ao(e,m)(b):x(b)}function f(b){return a(b)}function m(b){return b===34||b===39||b===40?Uy(e,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):x(b)}function h(b){return Rt(b)?ao(e,x)(b):x(b)}function x(b){return b===41?(e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),e.exit("resource"),t):a(b)}}function uk(e,t,a){const s=this;return l;function l(f){return Py.call(s,e,u,d,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(Ma(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):a(f)}function d(f){return a(f)}}function ck(e,t,a){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):a(u)}}const dk={name:"labelStartImage",resolveAll:$h.resolveAll,tokenize:fk};function fk(e,t,a){const s=this;return l;function l(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"),d):a(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?a(f):t(f)}}const mk={name:"labelStartLink",resolveAll:$h.resolveAll,tokenize:hk};function hk(e,t,a){const s=this;return l;function l(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?a(d):t(d)}}const vm={name:"lineEnding",tokenize:pk};function pk(e,t){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ct(e,t,"linePrefix")}}const uc={name:"thematicBreak",tokenize:gk};function gk(e,t,a){let s=0,l;return u;function u(h){return e.enter("thematicBreak"),d(h)}function d(h){return l=h,f(h)}function f(h){return h===l?(e.enter("thematicBreakSequence"),m(h)):s>=3&&(h===null||Ue(h))?(e.exit("thematicBreak"),t(h)):a(h)}function m(h){return h===l?(e.consume(h),s++,m):(e.exit("thematicBreakSequence"),rt(h)?ct(e,f,"whitespace")(h):f(h))}}const Kn={continuation:{tokenize:yk},exit:_k,name:"list",tokenize:Ek},bk={partial:!0,tokenize:Nk},xk={partial:!0,tokenize:Tk};function Ek(e,t,a){const s=this,l=s.events[s.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,d=0;return f;function f(T){const N=s.containerState.type||(T===42||T===43||T===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!s.containerState.marker||T===s.containerState.marker:sh(T)){if(s.containerState.type||(s.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),T===42||T===45?e.check(uc,a,h)(T):h(T);if(!s.interrupt||T===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(T)}return a(T)}function m(T){return sh(T)&&++d<10?(e.consume(T),m):(!s.interrupt||d<2)&&(s.containerState.marker?T===s.containerState.marker:T===41||T===46)?(e.exit("listItemValue"),h(T)):a(T)}function h(T){return e.enter("listItemMarker"),e.consume(T),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||T,e.check(So,s.interrupt?a:x,e.attempt(bk,y,b))}function x(T){return s.containerState.initialBlankLine=!0,u++,y(T)}function b(T){return rt(T)?(e.enter("listItemPrefixWhitespace"),e.consume(T),e.exit("listItemPrefixWhitespace"),y):a(T)}function y(T){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(T)}}function yk(e,t,a){const s=this;return s.containerState._closeFlow=void 0,e.check(So,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ct(e,t,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!rt(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,d(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(xk,t,d)(f))}function d(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ct(e,e.attempt(Kn,t,a),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function Tk(e,t,a){const s=this;return ct(e,l,"listItemIndent",s.containerState.size+1);function l(u){const d=s.events[s.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===s.containerState.size?t(u):a(u)}}function _k(e){e.exit(this.containerState.type)}function Nk(e,t,a){const s=this;return ct(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const d=s.events[s.events.length-1];return!rt(u)&&d&&d[1].type==="listItemPrefixWhitespace"?t(u):a(u)}}const $x={name:"setextUnderline",resolveTo:vk,tokenize:Sk};function vk(e,t){let a=e.length,s,l,u;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){s=a;break}e[a][1].type==="paragraph"&&(l=a)}else e[a][1].type==="content"&&e.splice(a,1),!u&&e[a][1].type==="definition"&&(u=a);const d={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",d,t]),e.splice(u+1,0,["exit",e[s][1],t]),e[s][1].end={...e[u][1].end}):e[s][1]=d,e.push(["exit",d,t]),e}function Sk(e,t,a){const s=this;let l;return u;function u(h){let x=s.events.length,b;for(;x--;)if(s.events[x][1].type!=="lineEnding"&&s.events[x][1].type!=="linePrefix"&&s.events[x][1].type!=="content"){b=s.events[x][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||b)?(e.enter("setextHeadingLine"),l=h,d(h)):a(h)}function d(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===l?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),rt(h)?ct(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Ue(h)?(e.exit("setextHeadingLine"),t(h)):a(h)}}const Ak={tokenize:Ck};function Ck(e){const t=this,a=e.attempt(So,s,e.attempt(this.parser.constructs.flowInitial,l,ct(e,e.attempt(this.parser.constructs.flow,l,e.attempt(I5,l)),"linePrefix")));return a;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,a}}const wk={resolveAll:Fy()},kk=Hy("string"),Rk=Hy("text");function Hy(e){return{resolveAll:Fy(e==="text"?Ok:void 0),tokenize:t};function t(a){const s=this,l=this.parser.constructs[e],u=a.attempt(l,d,f);return d;function d(x){return h(x)?u(x):f(x)}function f(x){if(x===null){a.consume(x);return}return a.enter("data"),a.consume(x),m}function m(x){return h(x)?(a.exit("data"),u(x)):(a.consume(x),m)}function h(x){if(x===null)return!0;const b=l[x];let y=-1;if(b)for(;++y<b.length;){const T=b[y];if(!T.previous||T.previous.call(s,s.previous))return!0}return!1}}}function Fy(e){return t;function t(a,s){let l=-1,u;for(;++l<=a.length;)u===void 0?a[l]&&a[l][1].type==="data"&&(u=l,l++):(!a[l]||a[l][1].type!=="data")&&(l!==u+2&&(a[u][1].end=a[l-1][1].end,a.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(a,s):a}}function Ok(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 s=e[a-1][1],l=t.sliceStream(s);let u=l.length,d=-1,f=0,m;for(;u--;){const h=l[u];if(typeof h=="string"){for(d=h.length;h.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-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?d:s.start._bufferIndex+d,_index:s.start._index+u,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(a,0,["enter",h,t],["exit",h,t]),a+=2)}a++}return e}const Ik={42:Kn,43:Kn,45:Kn,48:Kn,49:Kn,50:Kn,51:Kn,52:Kn,53:Kn,54:Kn,55:Kn,56:Kn,57:Kn,62:My},Mk={91:B5},Dk={[-2]:Nm,[-1]:Nm,32:Nm},Lk={35:q5,42:uc,45:[$x,uc],60:K5,61:$x,95:uc,96:qx,126:qx},jk={38:Ly,92:Dy},Bk={[-5]:vm,[-4]:vm,[-3]:vm,33:dk,38:Ly,42:ih,60:[m5,ek],91:mk,92:[F5,Dy],93:$h,95:ih,96:A5},Pk={null:[ih,wk]},Uk={null:[42,95]},Hk={null:[]},Fk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Uk,contentInitial:Mk,disable:Hk,document:Ik,flow:Lk,flowInitial:Dk,insideSpan:Pk,string:jk,text:Bk},Symbol.toStringTag,{value:"Module"}));function zk(e,t,a){let s={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const l={},u=[];let d=[],f=[];const m={attempt:D(G),check:D(L),consume:R,enter:w,exit:U,interrupt:D(L,{interrupt:!0})},h={code:null,containerState:{},defineSkip:v,events:[],now:N,parser:e,previous:null,sliceSerialize:y,sliceStream:T,write:b};let x=t.tokenize.call(h,m);return t.resolveAll&&u.push(t),h;function b(Q){return d=_a(d,Q),C(),d[d.length-1]!==null?[]:(V(t,0),h.events=Vc(u,h.events,h),h.events)}function y(Q,ee){return Yk(T(Q),ee)}function T(Q){return qk(d,Q)}function N(){const{_bufferIndex:Q,_index:ee,line:X,column:ie,offset:se}=s;return{_bufferIndex:Q,_index:ee,line:X,column:ie,offset:se}}function v(Q){l[Q.line]=Q.column,j()}function C(){let Q;for(;s._index<d.length;){const ee=d[s._index];if(typeof ee=="string")for(Q=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===Q&&s._bufferIndex<ee.length;)A(ee.charCodeAt(s._bufferIndex));else A(ee)}}function A(Q){x=x(Q)}function R(Q){Ue(Q)?(s.line++,s.column=1,s.offset+=Q===-3?2:1,j()):Q!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===d[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=Q}function w(Q,ee){const X=ee||{};return X.type=Q,X.start=N(),h.events.push(["enter",X,h]),f.push(X),X}function U(Q){const ee=f.pop();return ee.end=N(),h.events.push(["exit",ee,h]),ee}function G(Q,ee){V(Q,ee.from)}function L(Q,ee){ee.restore()}function D(Q,ee){return X;function X(ie,se,K){let H,de,Ae,P;return Array.isArray(ie)?re(ie):"tokenize"in ie?re([ie]):O(ie);function O(Re){return Ye;function Ye(dt){const ut=dt!==null&&Re[dt],Ft=dt!==null&&Re.null,Tn=[...Array.isArray(ut)?ut:ut?[ut]:[],...Array.isArray(Ft)?Ft:Ft?[Ft]:[]];return re(Tn)(dt)}}function re(Re){return H=Re,de=0,Re.length===0?K:M(Re[de])}function M(Re){return Ye;function Ye(dt){return P=Z(),Ae=Re,Re.partial||(h.currentConstruct=Re),Re.name&&h.parser.constructs.disable.null.includes(Re.name)?ke():Re.tokenize.call(ee?Object.assign(Object.create(h),ee):h,m,Te,ke)(dt)}}function Te(Re){return Q(Ae,P),se}function ke(Re){return P.restore(),++de<H.length?M(H[de]):K}}}function V(Q,ee){Q.resolveAll&&!u.includes(Q)&&u.push(Q),Q.resolve&&la(h.events,ee,h.events.length-ee,Q.resolve(h.events.slice(ee),h)),Q.resolveTo&&(h.events=Q.resolveTo(h.events,h))}function Z(){const Q=N(),ee=h.previous,X=h.currentConstruct,ie=h.events.length,se=Array.from(f);return{from:ie,restore:K};function K(){s=Q,h.previous=ee,h.currentConstruct=X,h.events.length=ie,f=se,j()}}function j(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function qk(e,t){const a=t.start._index,s=t.start._bufferIndex,l=t.end._index,u=t.end._bufferIndex;let d;if(a===l)d=[e[a].slice(s,u)];else{if(d=e.slice(a,l),s>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(s):d.shift()}u>0&&d.push(e[l].slice(0,u))}return d}function Yk(e,t){let a=-1;const s=[];let l;for(;++a<e.length;){const u=e[a];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
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-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-B2QRdSjl.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-CeGwOeUd.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|