fourth-spark 0.7.13 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "ad8d05dd-4d8b-4cab-b49f-c102fac04eba",
2
+ "id": "0c877e00-de01-4d7c-9f1f-e21651a04fb5",
3
3
  "prevId": "04cabd55-cedd-49ea-b94d-305c7cea5bc0",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
@@ -40,8 +40,8 @@
40
40
  {
41
41
  "idx": 5,
42
42
  "version": "7",
43
- "when": 1786028488742,
44
- "tag": "0005_zippy_selene",
43
+ "when": 1786096003764,
44
+ "tag": "0005_green_marrow",
45
45
  "breakpoints": true
46
46
  }
47
47
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fourth-spark",
3
- "version": "0.7.13",
3
+ "version": "0.8.0",
4
4
  "description": "AI Agent Platform — multi-repo agent management based on OpenCode",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -417,7 +417,7 @@ Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}
417
417
  *
418
418
  * This source code is licensed under the ISC license.
419
419
  * See the LICENSE file in the root directory of this source tree.
420
- */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"}]],Oh=we("zap",m3);function KE(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=KE(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function ue(){for(var e,t,a=0,s="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=KE(e))&&(s&&(s+=" "),s+=t);return s}const ax=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},h3=(e=>e?ax(e):ax),p3=e=>e;function g3(e,t=p3){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 rx=e=>{const t=h3(e),a=s=>g3(t,s);return Object.assign(a,t),a},Sr=(e=>e?rx(e):rx),mm="fs-theme";function VE(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function sx(e){return e==="system"?VE():e}function ix(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Km=Sr((e,t)=>({preference:localStorage.getItem(mm)??"system",resolved:sx(localStorage.getItem(mm)??"system"),setPreference(a){const s=sx(a);localStorage.setItem(mm,a),ix(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(){ix(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{const{preference:l}=t();if(l==="system"){const o=VE();e({resolved:o})}};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)}})),xc="fourth-spark-server-url";function QE(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function XE(){return localStorage.getItem(xc)??""}function b3(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(xc,t):localStorage.removeItem(xc)}function Vm(){return localStorage.getItem(xc)??""}class Fs extends Error{constructor(a,s){super(a);rn(this,"status");this.name="ApiError",this.status=s}}async function ve(e,t){let a;try{a=await fetch(XE()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(l){throw new Fs(l instanceof Error?l.message:"Network request failed",0)}if(!a.ok){const l=await a.text().catch(()=>"");throw new Fs(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 Dn(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 x3(){return Dn(await ve("/api/repos"),"repos")}async function E3(e,t,a){return ve("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a})})}async function y3(e){return ve("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function T3(e){await ve(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function _3(e){await ve(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function N3(e){await ve(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function S3(e){return ve(`/api/repos/${encodeURIComponent(e)}/branches`)}async function v3(e,t){return ve(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function A3(e){return ve(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function We(e){return`/api/repos/${encodeURIComponent(e)}`}async function C3(e){return Dn(await ve(`${We(e)}/sessions`),"sessions")}async function w3(e,t,a,s,l,o,d){return ve(`${We(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:s,variant:l,issueId:o,customAgentId:d})})}async function k3(e,t){return ve(`${We(e)}/sessions/${encodeURIComponent(t)}`)}async function R3(e,t){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function O3(e,t,a,s,l){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:s,model:l})})}async function I3(e,t){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function M3(e,t,a){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function D3(e,t){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}function L3(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 j3(e,t){return Dn(await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/messages`),"messages").map(L3)}async function B3(e,t){return Dn(await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/todos`),"todos")}async function WE(e,t){return ve(`${We(e)}/sessions/${encodeURIComponent(t)}/status`)}async function lx(e,t){return ve(`${We(e)}/sessions/${encodeURIComponent(t)}/links`)}async function ox(e){return ve(`${We(e)}/sessions/all-links`)}async function P3(e,t,a,s){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:s})})}async function U3(e,t,a,s){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:s})})}async function ZE(){return Dn(await ve("/api/custom-agents"))}async function JE(e){return ve("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function ey(e,t){return ve(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function ty(e){await ve(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function ux(e){return ve(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function H3(e){return ve("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function F3(e){return Dn(await ve(`${We(e)}/custom-agents`))}async function z3(e,t){return ve(`${We(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Ih(e){return Dn(await ve(`${We(e)}/models`))}async function q3(){return Dn(await ve("/api/prompt-fragments"))}async function Y3(e){return ve("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function $3(e,t){return ve(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function G3(e){await ve(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function cx(e){return Dn(await ve(`${We(e)}/tags`))}async function dx(e,t){return Dn(await ve(`${We(e)}/milestones`))}async function fx(e,t="open"){return Dn(await ve(`${We(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function K3(e,t="all"){return ve(`${We(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function V3(e,t,a){return ve(`${We(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Q3(e,t,a){await ve(`${We(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function ny(e,t,a){return ve(`${We(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function mx(e,t){return Dn(await ve(`${We(e)}/issues/${t}/pulls`))}async function X3(e,t,a,s=!1){await ve(`${We(e)}/issues/${t}/pulls/${a}/merge`,{method:"POST",body:JSON.stringify({closeIssue:s})})}async function hx(e,t="open"){return Dn(await ve(`${We(e)}/pulls?state=${encodeURIComponent(t)}`))}async function W3(e,t="all"){return ve(`${We(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function Z3(e,t){await ve(`${We(e)}/pulls/${t}/merge`,{method:"POST"})}async function ay(e,t){return Dn(await ve(`${We(e)}/pulls/${t}/issues`))}async function J3(e,t,a){await ve(`${We(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function eC(e,t,a){await ve(`${We(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function tC(e,t){return ve(`${We(e)}/pulls/${t}/comments`)}async function nC(e,t){return ve(`${We(e)}/issues/${t}/comments`)}async function px(e,t,a){return ve(`${We(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function aC(e,t,a){return ve(`${We(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function gx(e,t){return ve(`${We(e)}/issues/${t}/draft`)}async function rC(e,t,a){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function sC(e,t,a){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function iC(){return ve("/api/agents-md")}async function lC(e){await ve("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function oC(e){return ve(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function uC(e,t){await ve(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function cC(e){return`${XE()}${We(e)}/events`}async function dC(e){return ve(`${We(e)}/sessions/status`)}async function Fc(){return ve("/api/settings")}async function Qm(e,t){await ve(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function Xm(){return ve("/api/cloud/status")}async function fC(){return ve("/api/cloud/reload",{method:"POST"})}async function mC(e){try{return(await ve("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function hC(){return Dn(await ve("/api/git-hosts"),"gitHosts")}async function pC(e,t,a,s="gitea"){return ve("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:s})})}async function gC(e){await ve(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function ry(){return ve("/api/usage")}async function sy(e){return ve("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function bC(e,t="ios"){await ve("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ts="fs-active-repo",ze=Sr((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ts),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await x3(),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 o=t().activeRepoId;o?localStorage.setItem(ts,o):localStorage.removeItem(ts)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ts,a):localStorage.removeItem(ts)},addRepo:async(a,s,l)=>{try{const o=await E3(a,s,l);return e(d=>({repos:[...d.repos,o],activeRepoId:o.id})),localStorage.setItem(ts,o.id),o}catch(o){return e({loadError:o instanceof Error?o.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await T3(a)}catch{}e(s=>{const l=s.repos.filter(d=>d.id!==a),o=s.activeRepoId===a?l.length>0?l[0].id:null:s.activeRepoId;return o?localStorage.setItem(ts,o):localStorage.removeItem(ts),{repos:l,activeRepoId:o}})},updateRepoBranch:(a,s)=>{e(l=>({repos:l.repos.map(o=>o.id===a?{...o,branch:s}:o)}))}})),La=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},hm="fs-nav-collapsed",pm="fs-session-panel-collapsed",Ec=Sr(e=>({navCollapsed:localStorage.getItem(hm)==="true",sessionPanelCollapsed:localStorage.getItem(pm)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(hm,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(pm,String(a)),{sessionPanelCollapsed:a}})},setNavCollapsed(t){localStorage.setItem(hm,String(t)),e({navCollapsed:t})},setSessionPanelCollapsed(t){localStorage.setItem(pm,String(t)),e({sessionPanelCollapsed:t})}})),iy=[{segment:"repos",icon:Hv,label:"仓库管理",global:!0},{segment:"run",icon:Uc,label:"运行面板",global:!1},{segment:"issues",icon:fo,label:"Issues",global:!1},{segment:"pulls",icon:mo,label:"PRs",global:!1},{segment:"settings",icon:JA,label:"设置",global:!0}];function ly(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function xC({repoId:e,currentBranch:t}){const a=ze(A=>A.updateRepoBranch),[s,l]=C.useState(!1),[o,d]=C.useState(null),[f,m]=C.useState(!1),[h,x]=C.useState(null),[b,y]=C.useState(null),T=C.useRef(null),N=C.useCallback(()=>{l(!1),y(null)},[]);C.useEffect(()=>{if(!s)return;const A=I=>{T.current&&!T.current.contains(I.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 S3(e))}catch{y("加载分支失败")}finally{m(!1)}},S=async A=>{if(!(A===t||h)){x(A),y(null);try{const I=await v3(e,A);a(e,I.branch),N()}catch(I){y(I instanceof Error?I.message:"切换失败")}finally{x(null)}}};return t?u.jsxs("div",{ref:T,className:"relative",children:[u.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:[u.jsx(_o,{className:"h-3 w-3"}),t,u.jsx(ss,{className:ue("h-3 w-3 transition-transform",s&&"rotate-180")})]}),s&&u.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?u.jsx("div",{className:"flex items-center justify-center py-4",children:u.jsx(Sa,{className:"h-4 w-4 animate-spin text-fg-4"})}):o?u.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[o.local.map(A=>u.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>S(A),className:ue("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?u.jsx(oa,{className:"h-3 w-3 shrink-0"}):h===A?u.jsx(Sa,{className:"h-3 w-3 shrink-0 animate-spin"}):u.jsx("span",{className:"h-3 w-3 shrink-0"}),u.jsx("span",{className:"truncate",children:A})]},A)),o.remote.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"mx-3 my-1 border-t border-line"}),u.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),o.remote.map(A=>u.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>S(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?u.jsx(Sa,{className:"h-3 w-3 shrink-0 animate-spin"}):u.jsx("span",{className:"h-3 w-3 shrink-0"}),u.jsx("span",{className:"truncate",children:A})]},`remote-${A}`))]})]}):null,b&&u.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:b})]})]}):null}function EC(){const[e,t]=C.useState(null);return C.useEffect(()=>{const a=()=>fetch("/api/health").then(o=>o.json()).then(o=>{o.latestVersion&&o.latestVersion!=="0.7.13"&&t(o.latestVersion)}).catch(()=>{});a();const s=setInterval(a,30*6e4),l=()=>a();return window.addEventListener("focus",l),()=>{clearInterval(s),window.removeEventListener("focus",l)}},[]),e}function yC(){const e=Aa(),t=ca(),a=ze(b=>b.repos),s=ze(b=>b.activeRepoId),l=ze(b=>b.setActiveRepo),o=Km(b=>b.preference),d=Km(b=>b.cycle),f=o==="light"?a3:o==="dark"?HA:PA,m=a.find(b=>b.id===s),h=EC(),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 u.jsx("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:u.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx(Oh,{className:"h-5 w-5 text-blue-500"}),u.jsx("span",{className:"text-sm font-bold tracking-tight text-fg",children:"Fourth Spark"}),u.jsxs("span",{className:"rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4",children:["v","0.7.13"]}),h&&u.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",u.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.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=>u.jsx("option",{value:b.id,children:b.name},b.id))}),m&&s&&u.jsx(xC,{repoId:s,currentBranch:m.branch})]}),u.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:u.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:u.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"})})}),u.jsx("button",{type:"button",onClick:d,"aria-label":`主题: ${o}`,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:u.jsx(f,{className:"h-4 w-4"})})]})]})})}function TC(){const e=ze(La),t=Ec(s=>s.navCollapsed),a=Ec(s=>s.toggleNav);return u.jsxs("nav",{className:ue("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:[u.jsx("div",{className:"flex flex-1 flex-col",children:iy.map(s=>u.jsxs(Ch,{to:ly(s.segment,s.global,e),title:t?s.label:void 0,className:({isActive:l})=>ue("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:[u.jsx(s.icon,{className:"h-4 w-4 shrink-0"}),u.jsx("span",{className:ue("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))}),u.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?u.jsx(Qv,{className:"h-4 w-4"}):u.jsx(Kv,{className:"h-4 w-4"})})]})}function _C(){const e=ze(La);return u.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:u.jsx("div",{className:"flex h-14 items-center justify-around",children:iy.map(t=>u.jsx(Ch,{to:ly(t.segment,t.global,e),"aria-label":t.label,className:({isActive:a})=>ue("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:u.jsx(t.icon,{className:"h-5 w-5 shrink-0"})},t.segment))})})}function NC(){return u.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[u.jsx(yC,{}),u.jsxs("div",{className:"flex min-h-0 flex-1",children:[u.jsx(TC,{}),u.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:u.jsx(US,{})})]}),u.jsx(_C,{})]})}function SC({onClose:e}){const[t,a]=C.useState(""),[s,l]=C.useState(""),[o,d]=C.useState(""),[f,m]=C.useState(!1),[h,x]=C.useState(""),b=ze(S=>S.addRepo),y=s.trim()!==""&&o.trim()!==""&&t.trim()!==""&&!f,T=async S=>{const A=S.trim();if(A){m(!0),x("");try{const I=await y3(A);I.name&&!s.trim()&&l(I.name),I.gitUrl&&!o.trim()&&d(I.gitUrl)}catch(I){const k=I instanceof Error?I.message:"无法解析路径";try{const D=JSON.parse(k);x(D.error??k)}catch{x(k)}}m(!1)}},N=C.useRef(T);N.current=T,C.useEffect(()=>{const S=t.trim();if(!S)return;const A=setTimeout(()=>{N.current(S)},500);return()=>clearTimeout(A)},[t]);const v=async()=>{if(!y)return;x(""),await b(s.trim(),o.trim(),t.trim())&&e()};return u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[u.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[u.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),u.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:u.jsx(Tt,{className:"h-4 w-4"})})]}),u.jsxs("div",{className:"flex flex-col gap-4",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),u.jsx("input",{id:"m-path",value:t,onChange:S=>a(S.target.value),onBlur:S=>void T(S.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"}),u.jsx("span",{className:"text-[11px] text-fg-5",children:f?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),u.jsx("input",{id:"m-name",value:s,onChange:S=>l(S.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"})]}),u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),u.jsx("input",{id:"m-git",value:o,onChange:S=>d(S.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"})]}),h&&u.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:h}),u.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[u.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:"取消"}),u.jsx("button",{type:"button",onClick:v,disabled:!y,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 vC({repoId:e,repoName:t,onClose:a}){const[s,l]=C.useState(""),[o,d]=C.useState(""),[f,m]=C.useState(!0),[h,x]=C.useState(!1),[b,y]=C.useState(null);C.useEffect(()=>{oC(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 uC(e,s),d(s)}catch(v){y(v instanceof Error?v.message:String(v))}x(!1)},N=s!==o;return u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:u.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:[u.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),u.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),u.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:u.jsx(Tt,{className:"h-4 w-4"})})]}),b&&u.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:[u.jsx(Mn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),u.jsx("span",{className:"min-w-0 break-words",children:b})]}),f?u.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[u.jsx(Sa,{className:"h-5 w-5 fs-spin"}),u.jsx("p",{className:"text-xs",children:"加载中…"})]}):u.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
420
+ */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"}]],Oh=we("zap",m3);function KE(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=KE(e[t]))&&(s&&(s+=" "),s+=a)}else for(a in e)e[a]&&(s&&(s+=" "),s+=a);return s}function ue(){for(var e,t,a=0,s="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=KE(e))&&(s&&(s+=" "),s+=t);return s}const ax=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},h3=(e=>e?ax(e):ax),p3=e=>e;function g3(e,t=p3){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 rx=e=>{const t=h3(e),a=s=>g3(t,s);return Object.assign(a,t),a},Sr=(e=>e?rx(e):rx),mm="fs-theme";function VE(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function sx(e){return e==="system"?VE():e}function ix(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Km=Sr((e,t)=>({preference:localStorage.getItem(mm)??"system",resolved:sx(localStorage.getItem(mm)??"system"),setPreference(a){const s=sx(a);localStorage.setItem(mm,a),ix(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(){ix(t().preference);const a=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{const{preference:l}=t();if(l==="system"){const o=VE();e({resolved:o})}};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)}})),xc="fourth-spark-server-url";function QE(){if(typeof window>"u")return!1;const t=window.Capacitor;return typeof(t==null?void 0:t.isNativePlatform)=="function"&&t.isNativePlatform()}function XE(){return localStorage.getItem(xc)??""}function b3(e){const t=e.replace(/\/+$/,"");t?localStorage.setItem(xc,t):localStorage.removeItem(xc)}function Vm(){return localStorage.getItem(xc)??""}class Fs extends Error{constructor(a,s){super(a);rn(this,"status");this.name="ApiError",this.status=s}}async function ve(e,t){let a;try{a=await fetch(XE()+e,{...t,headers:{Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers}})}catch(l){throw new Fs(l instanceof Error?l.message:"Network request failed",0)}if(!a.ok){const l=await a.text().catch(()=>"");throw new Fs(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 Dn(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 x3(){return Dn(await ve("/api/repos"),"repos")}async function E3(e,t,a){return ve("/api/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,localPath:a})})}async function y3(e){return ve("/api/repos/resolve",{method:"POST",body:JSON.stringify({localPath:e})})}async function T3(e){await ve(`/api/repos/${encodeURIComponent(e)}`,{method:"DELETE"})}async function _3(e){await ve(`/api/repos/${encodeURIComponent(e)}/start`,{method:"POST"})}async function N3(e){await ve(`/api/repos/${encodeURIComponent(e)}/stop`,{method:"POST"})}async function S3(e){return ve(`/api/repos/${encodeURIComponent(e)}/branches`)}async function v3(e,t){return ve(`/api/repos/${encodeURIComponent(e)}/checkout`,{method:"POST",body:JSON.stringify({branch:t})})}async function A3(e){return ve(`/api/repos/${encodeURIComponent(e)}/pull`,{method:"POST"})}function We(e){return`/api/repos/${encodeURIComponent(e)}`}async function C3(e){return Dn(await ve(`${We(e)}/sessions`),"sessions")}async function w3(e,t,a,s,l,o,d){return ve(`${We(e)}/sessions`,{method:"POST",body:JSON.stringify({message:t,agent:a,model:s,variant:l,issueId:o,customAgentId:d})})}async function k3(e,t){return ve(`${We(e)}/sessions/${encodeURIComponent(t)}`)}async function R3(e,t){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async function O3(e,t,a,s,l){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/prompt`,{method:"POST",body:JSON.stringify({content:a,agent:s,model:l})})}async function I3(e,t){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/abort`,{method:"POST"})}async function M3(e,t,a){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/questions/reply`,{method:"POST",body:JSON.stringify({answers:a})})}async function D3(e,t){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/questions/reject`,{method:"POST"})}function L3(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 j3(e,t){return Dn(await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/messages`),"messages").map(L3)}async function B3(e,t){return Dn(await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/todos`),"todos")}async function WE(e,t){return ve(`${We(e)}/sessions/${encodeURIComponent(t)}/status`)}async function lx(e,t){return ve(`${We(e)}/sessions/${encodeURIComponent(t)}/links`)}async function ox(e){return ve(`${We(e)}/sessions/all-links`)}async function P3(e,t,a,s){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"POST",body:JSON.stringify({type:a,targetId:s})})}async function U3(e,t,a,s){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}/links`,{method:"DELETE",body:JSON.stringify({type:a,targetId:s})})}async function ZE(){return Dn(await ve("/api/custom-agents"))}async function JE(e){return ve("/api/custom-agents",{method:"POST",body:JSON.stringify(e)})}async function ey(e,t){return ve(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function ty(e){await ve(`/api/custom-agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async function ux(e){return ve(`/api/custom-agents/${encodeURIComponent(e)}/export`)}async function H3(e){return ve("/api/custom-agents/import",{method:"POST",body:JSON.stringify(e)})}async function F3(e){return Dn(await ve(`${We(e)}/custom-agents`))}async function z3(e,t){return ve(`${We(e)}/custom-agents`,{method:"POST",body:JSON.stringify(t)})}async function Ih(e){return Dn(await ve(`${We(e)}/models`))}async function q3(){return Dn(await ve("/api/prompt-fragments"))}async function Y3(e){return ve("/api/prompt-fragments",{method:"POST",body:JSON.stringify(e)})}async function $3(e,t){return ve(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function G3(e){await ve(`/api/prompt-fragments/${encodeURIComponent(e)}`,{method:"DELETE"})}async function cx(e){return Dn(await ve(`${We(e)}/tags`))}async function dx(e,t){return Dn(await ve(`${We(e)}/milestones`))}async function fx(e,t="open"){return Dn(await ve(`${We(e)}/issues?state=${encodeURIComponent(t)}`),"issues")}async function K3(e,t="all"){return ve(`${We(e)}/issues/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function V3(e,t,a){return ve(`${We(e)}/issues`,{method:"POST",body:JSON.stringify({title:t,body:a})})}async function Q3(e,t,a){await ve(`${We(e)}/issues/${t}/children`,{method:"POST",body:JSON.stringify({childNumber:a})})}async function ny(e,t,a){return ve(`${We(e)}/issues/${t}`,{method:"PATCH",body:JSON.stringify(a)})}async function mx(e,t){return Dn(await ve(`${We(e)}/issues/${t}/pulls`))}async function X3(e,t,a,s=!1){await ve(`${We(e)}/issues/${t}/pulls/${a}/merge`,{method:"POST",body:JSON.stringify({closeIssue:s})})}async function hx(e,t="open"){return Dn(await ve(`${We(e)}/pulls?state=${encodeURIComponent(t)}`))}async function W3(e,t="all"){return ve(`${We(e)}/pulls/sync`,{method:"POST",body:JSON.stringify({state:t})})}async function Z3(e,t){await ve(`${We(e)}/pulls/${t}/merge`,{method:"POST"})}async function ay(e,t){return Dn(await ve(`${We(e)}/pulls/${t}/issues`))}async function J3(e,t,a){await ve(`${We(e)}/pulls/${t}/issues`,{method:"POST",body:JSON.stringify({issueNumber:a})})}async function eC(e,t,a){await ve(`${We(e)}/pulls/${t}/issues/${a}`,{method:"DELETE"})}async function tC(e,t){return ve(`${We(e)}/pulls/${t}/comments`)}async function nC(e,t){return ve(`${We(e)}/issues/${t}/comments`)}async function px(e,t,a){return ve(`${We(e)}/issues/${t}/comments`,{method:"POST",body:JSON.stringify({body:a})})}async function aC(e,t,a){return ve(`${We(e)}/issues/${t}/polish`,{method:"POST",body:JSON.stringify({draft:a})})}async function gx(e,t){return ve(`${We(e)}/issues/${t}/draft`)}async function rC(e,t,a){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({title:a})})}async function sC(e,t,a){await ve(`${We(e)}/sessions/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({completedAt:a})})}async function iC(){return ve("/api/agents-md")}async function lC(e){await ve("/api/agents-md",{method:"PUT",body:JSON.stringify({content:e})})}async function oC(e){return ve(`/api/repos/${encodeURIComponent(e)}/agents-md`)}async function uC(e,t){await ve(`/api/repos/${encodeURIComponent(e)}/agents-md`,{method:"PUT",body:JSON.stringify({content:t})})}function cC(e){return`${XE()}${We(e)}/events`}async function dC(e){return ve(`${We(e)}/sessions/status`)}async function Fc(){return ve("/api/settings")}async function Qm(e,t){await ve(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({value:t})})}async function Xm(){return ve("/api/cloud/status")}async function fC(){return ve("/api/cloud/reload",{method:"POST"})}async function mC(e){try{return(await ve("/api/cloud/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})})).connected}catch{return!1}}async function hC(){return Dn(await ve("/api/git-hosts"),"gitHosts")}async function pC(e,t,a,s="gitea"){return ve("/api/git-hosts",{method:"POST",body:JSON.stringify({host:e,name:t,token:a,platform:s})})}async function gC(e){await ve(`/api/git-hosts/${encodeURIComponent(e)}`,{method:"DELETE"})}async function ry(){return ve("/api/usage")}async function sy(e){return ve("/api/usage/switch",{method:"POST",body:JSON.stringify({accountId:e})})}async function bC(e,t="ios"){await ve("/api/push/register",{method:"POST",body:JSON.stringify({token:e,platform:t})})}const ts="fs-active-repo",ze=Sr((e,t)=>({repos:[],activeRepoId:localStorage.getItem(ts),loading:!1,loadError:null,loadRepos:async()=>{e({loading:!0,loadError:null});try{const a=await x3(),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 o=t().activeRepoId;o?localStorage.setItem(ts,o):localStorage.removeItem(ts)}catch(a){e({loading:!1,loadError:a instanceof Error?a.message:"Failed to load repos"})}},setActiveRepo:a=>{e({activeRepoId:a}),a?localStorage.setItem(ts,a):localStorage.removeItem(ts)},addRepo:async(a,s,l)=>{try{const o=await E3(a,s,l);return e(d=>({repos:[...d.repos,o],activeRepoId:o.id})),localStorage.setItem(ts,o.id),o}catch(o){return e({loadError:o instanceof Error?o.message:"Failed to add repo"}),null}},removeRepo:async a=>{try{await T3(a)}catch{}e(s=>{const l=s.repos.filter(d=>d.id!==a),o=s.activeRepoId===a?l.length>0?l[0].id:null:s.activeRepoId;return o?localStorage.setItem(ts,o):localStorage.removeItem(ts),{repos:l,activeRepoId:o}})},updateRepoBranch:(a,s)=>{e(l=>({repos:l.repos.map(o=>o.id===a?{...o,branch:s}:o)}))}})),La=e=>{var t;return((t=e.repos.find(a=>a.id===e.activeRepoId))==null?void 0:t.name)??null},hm="fs-nav-collapsed",pm="fs-session-panel-collapsed",Ec=Sr(e=>({navCollapsed:localStorage.getItem(hm)==="true",sessionPanelCollapsed:localStorage.getItem(pm)==="true",toggleNav(){e(t=>{const a=!t.navCollapsed;return localStorage.setItem(hm,String(a)),{navCollapsed:a}})},toggleSessionPanel(){e(t=>{const a=!t.sessionPanelCollapsed;return localStorage.setItem(pm,String(a)),{sessionPanelCollapsed:a}})},setNavCollapsed(t){localStorage.setItem(hm,String(t)),e({navCollapsed:t})},setSessionPanelCollapsed(t){localStorage.setItem(pm,String(t)),e({sessionPanelCollapsed:t})}})),iy=[{segment:"repos",icon:Hv,label:"仓库管理",global:!0},{segment:"run",icon:Uc,label:"运行面板",global:!1},{segment:"issues",icon:fo,label:"Issues",global:!1},{segment:"pulls",icon:mo,label:"PRs",global:!1},{segment:"settings",icon:JA,label:"设置",global:!0}];function ly(e,t,a){return t?`/${e}`:a?`/${encodeURIComponent(a)}/${e}`:`/${e}`}function xC({repoId:e,currentBranch:t}){const a=ze(A=>A.updateRepoBranch),[s,l]=C.useState(!1),[o,d]=C.useState(null),[f,m]=C.useState(!1),[h,x]=C.useState(null),[b,y]=C.useState(null),T=C.useRef(null),N=C.useCallback(()=>{l(!1),y(null)},[]);C.useEffect(()=>{if(!s)return;const A=I=>{T.current&&!T.current.contains(I.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 S3(e))}catch{y("加载分支失败")}finally{m(!1)}},S=async A=>{if(!(A===t||h)){x(A),y(null);try{const I=await v3(e,A);a(e,I.branch),N()}catch(I){y(I instanceof Error?I.message:"切换失败")}finally{x(null)}}};return t?u.jsxs("div",{ref:T,className:"relative",children:[u.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:[u.jsx(_o,{className:"h-3 w-3"}),t,u.jsx(ss,{className:ue("h-3 w-3 transition-transform",s&&"rotate-180")})]}),s&&u.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?u.jsx("div",{className:"flex items-center justify-center py-4",children:u.jsx(Sa,{className:"h-4 w-4 animate-spin text-fg-4"})}):o?u.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",children:[o.local.map(A=>u.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>S(A),className:ue("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?u.jsx(oa,{className:"h-3 w-3 shrink-0"}):h===A?u.jsx(Sa,{className:"h-3 w-3 shrink-0 animate-spin"}):u.jsx("span",{className:"h-3 w-3 shrink-0"}),u.jsx("span",{className:"truncate",children:A})]},A)),o.remote.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"mx-3 my-1 border-t border-line"}),u.jsx("div",{className:"px-3 py-1 text-[10px] font-medium uppercase tracking-wider text-fg-4",children:"Remote"}),o.remote.map(A=>u.jsxs("button",{type:"button",disabled:h!==null,onClick:()=>S(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?u.jsx(Sa,{className:"h-3 w-3 shrink-0 animate-spin"}):u.jsx("span",{className:"h-3 w-3 shrink-0"}),u.jsx("span",{className:"truncate",children:A})]},`remote-${A}`))]})]}):null,b&&u.jsx("div",{className:"border-t border-line px-3 py-2 text-xs text-red-500",children:b})]})]}):null}function EC(){const[e,t]=C.useState(null);return C.useEffect(()=>{const a=()=>fetch("/api/health").then(o=>o.json()).then(o=>{o.latestVersion&&o.latestVersion!=="0.8.0"&&t(o.latestVersion)}).catch(()=>{});a();const s=setInterval(a,30*6e4),l=()=>a();return window.addEventListener("focus",l),()=>{clearInterval(s),window.removeEventListener("focus",l)}},[]),e}function yC(){const e=Aa(),t=ca(),a=ze(b=>b.repos),s=ze(b=>b.activeRepoId),l=ze(b=>b.setActiveRepo),o=Km(b=>b.preference),d=Km(b=>b.cycle),f=o==="light"?a3:o==="dark"?HA:PA,m=a.find(b=>b.id===s),h=EC(),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 u.jsx("header",{className:"shrink-0 border-b border-line bg-surface pt-[var(--safe-top)]",children:u.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx(Oh,{className:"h-5 w-5 text-blue-500"}),u.jsx("span",{className:"text-sm font-bold tracking-tight text-fg",children:"Fourth Spark"}),u.jsxs("span",{className:"rounded bg-elevated px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-4",children:["v","0.8.0"]}),h&&u.jsxs("span",{className:"text-[10px] text-amber-500",children:["→ v",h," 可用,运行 ",u.jsx("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"fourth-spark upgrade"})," 更新"]})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[a.length>0&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.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=>u.jsx("option",{value:b.id,children:b.name},b.id))}),m&&s&&u.jsx(xC,{repoId:s,currentBranch:m.branch})]}),u.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:u.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:u.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"})})}),u.jsx("button",{type:"button",onClick:d,"aria-label":`主题: ${o}`,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:u.jsx(f,{className:"h-4 w-4"})})]})]})})}function TC(){const e=ze(La),t=Ec(s=>s.navCollapsed),a=Ec(s=>s.toggleNav);return u.jsxs("nav",{className:ue("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:[u.jsx("div",{className:"flex flex-1 flex-col",children:iy.map(s=>u.jsxs(Ch,{to:ly(s.segment,s.global,e),title:t?s.label:void 0,className:({isActive:l})=>ue("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:[u.jsx(s.icon,{className:"h-4 w-4 shrink-0"}),u.jsx("span",{className:ue("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))}),u.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?u.jsx(Qv,{className:"h-4 w-4"}):u.jsx(Kv,{className:"h-4 w-4"})})]})}function _C(){const e=ze(La);return u.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:u.jsx("div",{className:"flex h-14 items-center justify-around",children:iy.map(t=>u.jsx(Ch,{to:ly(t.segment,t.global,e),"aria-label":t.label,className:({isActive:a})=>ue("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:u.jsx(t.icon,{className:"h-5 w-5 shrink-0"})},t.segment))})})}function NC(){return u.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-base text-fg",children:[u.jsx(yC,{}),u.jsxs("div",{className:"flex min-h-0 flex-1",children:[u.jsx(TC,{}),u.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden pb-[calc(3.5rem_+_var(--safe-bottom))] md:pb-0",children:u.jsx(US,{})})]}),u.jsx(_C,{})]})}function SC({onClose:e}){const[t,a]=C.useState(""),[s,l]=C.useState(""),[o,d]=C.useState(""),[f,m]=C.useState(!1),[h,x]=C.useState(""),b=ze(S=>S.addRepo),y=s.trim()!==""&&o.trim()!==""&&t.trim()!==""&&!f,T=async S=>{const A=S.trim();if(A){m(!0),x("");try{const I=await y3(A);I.name&&!s.trim()&&l(I.name),I.gitUrl&&!o.trim()&&d(I.gitUrl)}catch(I){const k=I instanceof Error?I.message:"无法解析路径";try{const D=JSON.parse(k);x(D.error??k)}catch{x(k)}}m(!1)}},N=C.useRef(T);N.current=T,C.useEffect(()=>{const S=t.trim();if(!S)return;const A=setTimeout(()=>{N.current(S)},500);return()=>clearTimeout(A)},[t]);const v=async()=>{if(!y)return;x(""),await b(s.trim(),o.trim(),t.trim())&&e()};return u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:e,children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-line bg-surface p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[u.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[u.jsx("h2",{className:"text-base font-semibold text-fg",children:"添加仓库"}),u.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:u.jsx(Tt,{className:"h-4 w-4"})})]}),u.jsxs("div",{className:"flex flex-col gap-4",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"m-path",className:"text-xs font-medium text-fg-3",children:"本地路径"}),u.jsx("input",{id:"m-path",value:t,onChange:S=>a(S.target.value),onBlur:S=>void T(S.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"}),u.jsx("span",{className:"text-[11px] text-fg-5",children:f?"正在读取 Git 信息…":"输入路径后自动读取仓库信息"})]}),u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"m-name",className:"text-xs font-medium text-fg-3",children:"名称"}),u.jsx("input",{id:"m-name",value:s,onChange:S=>l(S.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"})]}),u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx("label",{htmlFor:"m-git",className:"text-xs font-medium text-fg-3",children:"Git 远程地址"}),u.jsx("input",{id:"m-git",value:o,onChange:S=>d(S.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"})]}),h&&u.jsx("p",{className:"rounded-md bg-red-500/10 px-3 py-2 text-xs text-red-500",children:h}),u.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[u.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:"取消"}),u.jsx("button",{type:"button",onClick:v,disabled:!y,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 vC({repoId:e,repoName:t,onClose:a}){const[s,l]=C.useState(""),[o,d]=C.useState(""),[f,m]=C.useState(!0),[h,x]=C.useState(!1),[b,y]=C.useState(null);C.useEffect(()=>{oC(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 uC(e,s),d(s)}catch(v){y(v instanceof Error?v.message:String(v))}x(!1)},N=s!==o;return u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:a,children:u.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:[u.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("h2",{className:"text-base font-semibold text-fg",children:[t," — AGENTS.md"]}),u.jsx("p",{className:"mt-0.5 text-xs text-fg-4",children:"仅对此仓库生效,修改后 opencode 热加载即时生效。"})]}),u.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-md p-1 text-fg-4 hover:bg-elevated hover:text-fg-2",children:u.jsx(Tt,{className:"h-4 w-4"})})]}),b&&u.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:[u.jsx(Mn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),u.jsx("span",{className:"min-w-0 break-words",children:b})]}),f?u.jsxs("div",{className:"flex flex-col items-center gap-2.5 py-16 text-fg-5",children:[u.jsx(Sa,{className:"h-5 w-5 fs-spin"}),u.jsx("p",{className:"text-xs",children:"加载中…"})]}):u.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
421
421
 
422
422
  在此编写该仓库的 Agent 指令…`}),u.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[u.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:"关闭"}),u.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:[u.jsx(Hc,{className:"h-3.5 w-3.5"}),h?"保存中…":"保存"]})]})]})})}function AC(){const e=ze(k=>k.repos),t=ze(k=>k.activeRepoId),a=ze(k=>k.setActiveRepo),s=ze(k=>k.removeRepo),l=ze(k=>k.loadRepos),[o,d]=C.useState(!1),[f,m]=C.useState(null),[h,x]=C.useState(null),[b,y]=C.useState(null),[T,N]=C.useState(null),[v,S]=C.useState(null),A=async(k,D)=>{x(k);try{D?await N3(k):await _3(k),await l()}catch{}x(null)},I=async k=>{y(k),N(null);try{await A3(k),await l()}catch(D){let V="拉取失败";if(D instanceof Fs)try{V=JSON.parse(D.message).error??D.message}catch{V=D.message}N(V)}y(null)};return u.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[u.jsxs("div",{className:"mx-auto max-w-4xl",children:[u.jsxs("div",{className:"mb-6 flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h1",{className:"text-lg font-semibold text-fg",children:"仓库管理"}),u.jsx("p",{className:"mt-0.5 text-sm text-fg-4",children:"管理代码仓库,每个仓库对应一个独立的 Agent 运行环境"})]}),u.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:[u.jsx(Nr,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden md:inline",children:"添加仓库"})]})]}),T&&u.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:[u.jsx("span",{children:T}),u.jsx("button",{type:"button",onClick:()=>N(null),className:"shrink-0 rounded p-0.5 transition-colors hover:bg-red-500/10",children:u.jsx(Tt,{className:"h-3.5 w-3.5"})})]}),e.length===0?u.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed border-line-hard py-16 text-center",children:[u.jsx("div",{className:"rounded-full bg-elevated p-3",children:u.jsx(Nr,{className:"h-6 w-6 text-fg-4"})}),u.jsx("p",{className:"text-sm font-medium text-fg-3",children:"暂无代码仓库"}),u.jsx("p",{className:"text-xs text-fg-5",children:"添加一个本地仓库开始使用"}),u.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:"添加仓库"})]}):u.jsx(u.Fragment,{children:u.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:e.map(k=>{const D=k.id===t;return u.jsxs("div",{className:ue("rounded-xl border p-4 transition-colors",D?"border-blue-500/40 bg-blue-500/5":"border-line"),children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("button",{type:"button",onClick:()=>a(k.id),className:"flex min-w-0 items-center gap-2 text-left",children:[D?u.jsx(fo,{className:"h-4 w-4 shrink-0 text-blue-500"}):u.jsx(eA,{className:"h-4 w-4 shrink-0 text-fg-5"}),u.jsx("span",{className:ue("truncate font-medium",D?"text-fg":"text-fg-2"),children:k.name})]}),u.jsxs("span",{className:ue("inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",k.running?"bg-emerald-500/10 text-emerald-600":"bg-fg-6/30 text-fg-4"),children:[u.jsx("span",{className:ue("h-1.5 w-1.5 rounded-full",k.running?"bg-emerald-500":"bg-fg-5")}),k.running?"运行中":"已停止"]})]}),u.jsxs("dl",{className:"mt-3 space-y-1 font-mono text-xs text-fg-4",children:[u.jsxs("div",{className:"flex gap-2",children:[u.jsx("dt",{className:"shrink-0 text-fg-5",children:"Git"}),u.jsx("dd",{className:"min-w-0 truncate",children:k.gitUrl})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("dt",{className:"shrink-0 text-fg-5",children:"路径"}),u.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx("span",{className:"truncate",children:k.localPath}),u.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(k.localPath),title:"复制路径",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:u.jsx(hc,{className:"h-3 w-3"})})]})]}),k.running&&k.port&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("dt",{className:"shrink-0 text-fg-5",children:"直连"}),u.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsxs("a",{href:`http://127.0.0.1:${k.port}`,target:"_blank",rel:"noopener noreferrer",className:"truncate text-blue-500 hover:underline",children:["127.0.0.1:",k.port]}),u.jsx("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(`http://127.0.0.1:${k.port}`),title:"复制链接",className:"shrink-0 rounded p-0.5 text-fg-5 transition-colors hover:text-fg-3",children:u.jsx(hc,{className:"h-3 w-3"})})]})]})]}),u.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[u.jsxs("button",{type:"button",onClick:()=>S({id:k.id,name:k.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:[u.jsx(UE,{className:"h-3 w-3"}),"配置"]}),u.jsx("button",{type:"button",onClick:()=>void I(k.id),disabled:b===k.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===k.id?u.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):u.jsxs(u.Fragment,{children:[u.jsx(kv,{className:"h-3 w-3"}),"拉取"]})}),u.jsx("button",{type:"button",onClick:()=>void A(k.id,k.running),disabled:h===k.id,className:ue("flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md border text-xs font-medium transition-colors disabled:opacity-50",k.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===k.id?u.jsx("span",{className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):k.running?u.jsxs(u.Fragment,{children:[u.jsx(zE,{className:"h-3 w-3 fill-current"}),"停止"]}):u.jsxs(u.Fragment,{children:[u.jsx(Uc,{className:"h-3 w-3 fill-current"}),"启动"]})}),f===k.id?u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",onClick:()=>{s(k.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:u.jsx(oa,{className:"h-3.5 w-3.5"})}),u.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:u.jsx(Tt,{className:"h-3.5 w-3.5"})})]}):u.jsx("button",{type:"button",onClick:()=>m(k.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:u.jsx(ji,{className:"h-3.5 w-3.5"})})]})]},k.id)})})}),u.jsxs("p",{className:"mt-3 text-xs text-fg-5",children:[e.length," 个仓库"]})]}),o&&u.jsx(SC,{onClose:()=>d(!1)}),v&&u.jsx(vC,{repoId:v.id,repoName:v.name,onClose:()=>S(null)})]})}const CC=new Set(["tool","tool-use","tool_use","tool-call","tool_call","tool-result","tool_result"]),wC=new Set(["thinking","reasoning","reason"]),kC=new Set(["text","output_text","message"]);function Mh(e){var a;const t=((a=e.type)==null?void 0:a.toLowerCase())??"";return CC.has(t)||e.toolName!=null||e.tool!=null?"tool":wC.has(t)?"thinking":kC.has(t)||e.content!=null||e.text!=null?"text":"other"}function yc(e){return e.content??e.text??""}function oy(e){return e.toolName??e.tool??"tool"}function zc(e){var t;return e.input??((t=e.state)==null?void 0:t.input)}function Dh(e){var t;return e.output??((t=e.state)==null?void 0:t.output)}function Lh(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":Dh(e)!=null?"completed":"running"}function bx(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Bi(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 RC(e){return e.filter(t=>Bi(t.status)==="completed").length}function ho(e){const t=oy(e).toLowerCase();return t==="question"||t==="mcp_question"}function OC(e){const t=zc(e);if(!t||typeof t!="object")return null;const a=t;return Array.isArray(a.questions)?a.questions:null}function Tc(e){if(!ho(e))return!1;const t=Lh(e);return t==="pending"||t==="running"}const IC=/\bses_[a-zA-Z0-9]+/;function MC(e){var l;const t=zc(e);if(t&&typeof t=="object"){const o=t;if(typeof o.task_id=="string"&&o.task_id.startsWith("ses_"))return o.task_id}const a=(l=e.state)==null?void 0:l.metadata;if(a){const o=a.session_id??a.sessionId;if(typeof o=="string"&&o.startsWith("ses_"))return o}const s=Dh(e);if(typeof s=="string"){const o=IC.exec(s);if(o)return o[0]}if(s&&typeof s=="object"){const o=s,d=o.session_id??o.sessionId??o.task_id;if(typeof d=="string"&&d.startsWith("ses_"))return d}return null}let DC=0;const Yt=Sr(e=>({toasts:[],addToast:(t,a="info",s,l)=>{const o=(l==null?void 0:l.id)??`toast-${++DC}-${Date.now()}`;e(d=>d.toasts.some(f=>f.id===o)?d:{toasts:[...d.toasts,{id:o,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!==o)}))},4e3)},removeToast:t=>{e(a=>({toasts:a.toasts.filter(s=>s.id!==t)}))}}));function uy(e){return`question-${e}`}function gm(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:uy(e),persistent:!0})}function LC(e){var t;for(const a of e)if((t=a.parts)!=null&&t.some(s=>ho(s)&&Tc(s)))return!0;return!1}const po=[],_c=[],xx=[],Ms={};function Ex(e){return e.id??e.callID}function $n(){return ze.getState().activeRepoId}const Me=Sr((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 o=l.completedAt?null:Date.now();e(d=>({sessions:d.sessions.map(f=>f.id===a?{...f,completedAt:o??void 0}:f)}));try{await sC(s,a,o)}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([C3(a),ox(a).catch(()=>null)]),o={sessions:s,loadingSessions:!1};l&&(o.allSessionLinks=l),e(o)}catch(s){e({loadingSessions:!1,loadError:s instanceof Error?s.message:"Failed to load sessions"})}},createSession:async(a,s,l,o,d,f)=>{const m=$n();if(!m)return null;e({sendError:null});try{const h=await w3(m,a,s,l,o,d,f);return e(x=>({sessions:[h,...x.sessions.filter(b=>b.id!==h.id)],activeSessionId:h.id,messages:{...x.messages,[h.id]:[]}})),t().setSessionStatus(h.id,"busy"),h}catch(h){return e({sendError:h instanceof Error?h.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,o,d,f,m]=await Promise.allSettled([j3(s,a),B3(s,a),WE(s,a),k3(s,a),lx(s,a)]);e(h=>{const x={};if(l.status==="fulfilled"&&(x.messages={...h.messages,[a]:l.value}),o.status==="fulfilled"&&(x.todos={...h.todos,[a]:o.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"&&LC(l.value)&&gm(a,t().sessions)},refreshSessionLinks:async a=>{const s=$n();if(s)try{const[l,o]=await Promise.all([lx(s,a),ox(s).catch(()=>null)]);e(d=>{const f={sessionLinks:{...d.sessionLinks,[a]:l}};return o&&(f.allSessionLinks=o),f})}catch{}},addLink:async(a,s,l)=>{const o=$n();if(!o)return!1;try{return await P3(o,a,s,l),await t().refreshSessionLinks(a),!0}catch{return!1}},removeLink:async(a,s,l)=>{const o=$n();if(!o)return!1;try{return await U3(o,a,s,l),await t().refreshSessionLinks(a),!0}catch{return!1}},deleteSession:async a=>{const s=$n();if(s)try{await R3(s,a)}catch{}delete Ms[a],e(l=>{const{[a]:o,...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,...S}=l.sessionLinks,{[a]:A,...I}=l.allSessionLinks;return{sessions:l.sessions.filter(k=>k.id!==a),messages:d,todos:m,sessionStatuses:x,errorReasons:y,queuedMessageIds:N,sessionLinks:S,allSessionLinks:I,activeSessionId:l.activeSessionId===a?null:l.activeSessionId}})},sendMessage:async(a,s)=>{const l=$n(),o=t().activeSessionId;if(!l||!o)return!1;const d=t().sessions.find(m=>m.id===o),f=t().sessionStatuses[o]==="busy";e({sendError:null}),f||t().setSessionStatus(o,"busy");try{return await O3(l,o,a,d==null?void 0:d.agent,s),f&&(Ms[o]=(Ms[o]||0)+1),!0}catch(m){return e({sendError:m instanceof Error?m.message:"Failed to send message"}),f||t().setSessionStatus(o,"idle"),!1}},replyQuestion:async a=>{const s=$n(),l=t().activeSessionId;if(!(!s||!l))try{await M3(s,l,a)}catch(o){e({sendError:o instanceof Error?o.message:"Failed to reply to question"})}},rejectQuestion:async()=>{const a=$n(),s=t().activeSessionId;if(!(!a||!s))try{await D3(a,s)}catch{}},abortSession:async()=>{const a=$n(),s=t().activeSessionId;if(!(!a||!s)){try{await I3(a,s)}catch{}t().setSessionStatus(s,"idle")}},clearSessions:()=>{for(const a of Object.keys(Ms))delete Ms[a];e({sessions:[],activeSessionId:null,messages:{},todos:{},sessionStatuses:{},errorReasons:{},queuedMessageIds:{},sessionLinks:{},allSessionLinks:{},loadError:null,sendError:null})},updateMessage:(a,s)=>{var l;e(o=>{const d=o.messages[a]??[],f=d.findIndex(x=>x.id===s.id);let m,h=o.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=Ms[a]||0;if(s.role==="user"&&x>0){const b=[...h[a]??[]];b.push(s.id),h={...h,[a]:b},Ms[a]=x-1}else if(s.role==="assistant"){const b=h[a];b&&b.length>0&&(h={...h,[a]:b.slice(1)})}}return{messages:{...o.messages,[a]:m},queuedMessageIds:h}}),(l=s.parts)!=null&&l.some(o=>ho(o)&&Tc(o))&&gm(a,t().sessions)},updateMessagePart:(a,s,l)=>{e(o=>{const d=o.messages[a]??[],f=d.findIndex(N=>N.id===s),m=f>=0?d[f]:{id:s,role:"assistant"},h=m.parts?[...m.parts]:[],x=Ex(l),b=x!=null?h.findIndex(N=>Ex(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:{...o.messages,[a]:T}}}),ho(l)&&Tc(l)&&gm(a,t().sessions)},appendMessagePartDelta:(a,s,l,o)=>{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=yc(N)+o;x[b]=N.content!=null?{...N,content:v}:{...N,text:v}}else x.push({id:l,type:"text",text:o});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(o=>o.id===a.id)?{sessions:s.sessions.map(o=>o.id===a.id?{...o,...a}:o)}:{sessions:[a,...s.sessions]})},setSessionStatus:(a,s,l)=>{const o=t().sessionStatuses[a];if(o!==s){const d=t().sessions.find(m=>m.id===a),f=(d==null?void 0:d.title)||a.slice(-8);if(s==="idle"&&o!==void 0&&o!=="idle")Yt.getState().removeToast(uy(a)),Yt.getState().addToast(`${f} — 完成`,"success",a);else if(s==="busy"&&(o===void 0||o==="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(o=>({sessions:o.sessions.map(d=>d.id===a?{...d,title:s}:d)}));try{await rC(l,a,s)}catch{await t().loadSessions()}}}})),Ge=Sr((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 o;const l=ze.getState().activeRepoId;if(!l)return!1;try{await Q3(l,a,s);const d=(o=t().issues.find(f=>f.number===a))==null?void 0:o.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=ze.getState().activeRepoId;if(!l)return!1;try{const o=await ny(l,a,{state:s});return e(d=>({issues:d.issues.map(f=>f.number===a?{...f,state:o.state}:f)})),!0}catch{return!1}},loadIssues:async()=>{const a=ze.getState().activeRepoId;if(!a){e({issues:[],loaded:!0});return}try{const s=await fx(a,"all");e({issues:s,loaded:!0})}catch{e({loaded:!0})}},syncIssues:async()=>{const a=ze.getState().activeRepoId;if(a){e({syncing:!0});try{await K3(a);const[s,l,o]=await Promise.all([fx(a,"all"),cx(a),dx(a)]);e({issues:s,tags:l,milestones:o,syncing:!1})}catch(s){e({syncing:!1});let l="同步 Issue 失败";if(s instanceof Fs)try{const o=JSON.parse(s.message);o.error&&(l=o.error)}catch{s.message&&(l=s.message)}Yt.getState().addToast(l,"error")}}},createIssue:async(a,s)=>{const l=ze.getState().activeRepoId;if(!l)return null;try{const o=await V3(l,a,s);return e(d=>({issues:[o,...d.issues]})),o}catch{return null}},loadTags:async()=>{const a=ze.getState().activeRepoId;if(!a){e({tags:[]});return}try{const s=await cx(a);e({tags:s})}catch{}},cycleTagFilter:a=>{e(s=>{const l=new Map(s.tagFilterMode),o=l.get(a);return o?o==="include"?l.set(a,"exclude"):l.delete(a):l.set(a,"include"),{tagFilterMode:l}})},clearTagFilter:()=>e({tagFilterMode:new Map}),loadMilestones:async()=>{const a=ze.getState().activeRepoId;if(!a){e({milestones:[]});return}try{const s=await dx(a);e({milestones:s})}catch{}},setMilestoneFilter:a=>e({selectedMilestoneId:a})})),oc=Sr(e=>({drafts:{},setDraft:(t,a)=>e(s=>{if(!a.trim()){const{[t]:l,...o}=s.drafts;return{drafts:o}}return{drafts:{...s.drafts,[t]:a}}}),clearDraft:t=>e(a=>{const{[t]:s,...l}=a.drafts;return{drafts:l}})}));function yx(e){const t=[],a=String(e||"");let s=a.indexOf(","),l=0,o=!1;for(;!o;){s===-1&&(s=a.length,o=!0);const d=a.slice(l,s).trim();(d||!o)&&t.push(d),l=s+1,s=a.indexOf(",",l)}return t}function cy(e,t){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const jC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,PC={};function Tx(e,t){return(PC.jsx?BC:jC).test(e)}const UC=/[ \t\n\f\r]/g;function HC(e){return typeof e=="object"?e.type==="text"?_x(e.value):!1:_x(e)}function _x(e){return e.replace(UC,"")===""}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 dy(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 go(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 FC=0;const Ke=qs(),sn=qs(),Wm=qs(),Ee=qs(),kt=qs(),Ps=qs(),ia=qs();function qs(){return 2**++FC}const Zm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:sn,commaOrSpaceSeparated:ia,commaSeparated:Ps,number:Ee,overloadedBoolean:Wm,spaceSeparated:kt},Symbol.toStringTag,{value:"Module"})),bm=Object.keys(Zm);class jh extends Qn{constructor(t,a,s,l){let o=-1;if(super(t,a),Nx(this,"space",l),typeof s=="number")for(;++o<bm.length;){const d=bm[o];Nx(this,bm[o],(s&Zm[d])===Zm[d])}}}jh.prototype.defined=!0;function Nx(e,t,a){a&&(e[t]=a)}function $i(e){const t={},a={};for(const[s,l]of Object.entries(e.properties)){const o=new jh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,a[go(s)]=s,a[go(o.attribute)]=s}return new No(t,a,e.space)}const fy=$i({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 my(e,t){return t in e?e[t]:t}function hy(e,t){return my(e,t.toLowerCase())}const zC=$i({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ps,acceptCharset:kt,accessKey:kt,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alpha:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:kt,autoFocus:Ke,autoPlay:Ke,blocking:kt,capture:null,charSet:null,checked:Ke,cite:null,className:kt,closedBy:null,colorSpace:null,cols:Ee,colSpan:Ee,command:null,commandFor:null,content:null,contentEditable:sn,controls:Ke,controlsList:kt,coords:Ee|Ps,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:Wm,draggable:sn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:kt,height:Ee,hidden:Wm,high:Ee,href:null,hrefLang:null,htmlFor:kt,httpEquiv:kt,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:kt,itemRef:kt,itemScope:Ke,itemType:kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,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:Ke,optimum:Ee,pattern:null,ping:kt,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:kt,required:Ke,reversed:Ke,rows:Ee,rowSpan:Ee,sandbox:kt,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootCustomElementRegistry:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shadowRootSerializable:Ke,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:Ke,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:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,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:Ke,disablePictureInPicture:Ke,disableRemotePlayback:Ke,exportParts:Ps,part:kt,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:hy}),qC=$i({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:Ke,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:Ps,g2:Ps,glyphName:Ps,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:my}),py=$i({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()}}),gy=$i({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hy}),by=$i({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),YC={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"},$C=/[A-Z]/g,Sx=/-[a-z]/g,GC=/^data[-\w.:]+$/i;function qc(e,t){const a=go(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"&&GC.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Sx,VC);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Sx.test(o)){let d=o.replace($C,KC);d.charAt(0)!=="-"&&(d="-"+d),t="data"+d}}l=jh}return new l(s,t)}function KC(e){return"-"+e.toLowerCase()}function VC(e){return e.charAt(1).toUpperCase()}const So=dy([fy,zC,py,gy,by],"html"),cs=dy([fy,qC,py,gy,by],"svg");function vx(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function xy(e){return e.join(" ").trim()}var Ri={},xm,Ax;function QC(){if(Ax)return xm;Ax=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,a=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
423
423
  `,h="/",x="*",b="",y="comment",T="declaration";function N(S,A){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];A=A||{};var I=1,k=1;function D(le){var re=le.match(t);re&&(I+=re.length);var Q=le.lastIndexOf(m);k=~Q?le.length-Q:k+le.length}function V(){var le={line:I,column:k};return function(re){return re.position=new L(le),W(),re}}function L(le){this.start=le,this.end={line:I,column:k},this.source=A.source}L.prototype.content=S;function M(le){var re=new Error(A.source+":"+I+":"+k+": "+le);if(re.reason=le,re.filename=A.source,re.line=I,re.column=k,re.source=S,!A.silent)throw re}function K(le){var re=le.exec(S);if(re){var Q=re[0];return D(Q),S=S.slice(Q.length),re}}function W(){K(a)}function j(le){var re;for(le=le||[];re=U();)re!==!1&&le.push(re);return le}function U(){var le=V();if(!(h!=S.charAt(0)||x!=S.charAt(1))){for(var re=2;b!=S.charAt(re)&&(x!=S.charAt(re)||h!=S.charAt(re+1));)++re;if(re+=2,b===S.charAt(re-1))return M("End of comment missing");var Q=S.slice(2,re-2);return k+=2,D(Q),S=S.slice(re),k+=2,le({type:y,comment:Q})}}function J(){var le=V(),re=K(s);if(re){if(U(),!K(l))return M("property missing ':'");var Q=K(o),F=le({type:T,property:v(re[0].replace(e,b)),value:Q?v(Q[0].replace(e,b)):b});return K(d),F}}function se(){var le=[];j(le);for(var re;re=J();)re!==!1&&(le.push(re),j(le));return le}return W(),se()}function v(S){return S?S.replace(f,b):b}return xm=N,xm}var Cx;function XC(){if(Cx)return Ri;Cx=1;var e=Ri&&Ri.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.default=a;const t=e(QC());function a(s,l){let o=null;if(!s||typeof s!="string")return o;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&&(o=o||{},o[h]=x)}),o}return Ri}var Gl={},wx;function WC(){if(wx)return Gl;wx=1,Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,a=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=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={}),o(h)?h:(h=h.toLowerCase(),x.reactCompat?h=h.replace(l,f):h=h.replace(s,f),h.replace(t,d))};return Gl.camelCase=m,Gl}var Kl,kx;function ZC(){if(kx)return Kl;kx=1;var e=Kl&&Kl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(XC()),a=WC();function s(l,o){var d={};return!l||typeof l!="string"||(0,t.default)(l,function(f,m){f&&m&&(d[(0,a.camelCase)(f,o)]=m)}),d}return s.default=s,Kl=s,Kl}var JC=ZC();const ew=Ic(JC),Yc=Ey("end"),Qa=Ey("start");function Ey(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 tw(e){const t=Qa(e),a=Yc(e);if(t&&a)return{start:t,end:a}}function to(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rx(e.position):"start"in e||"end"in e?Rx(e):"line"in e||"column"in e?Jm(e):""}function Jm(e){return Ox(e&&e.line)+":"+Ox(e&&e.column)}function Rx(e){return Jm(e&&e.start)+"-"+Jm(e&&e.end)}function Ox(e){return e&&typeof e=="number"?e:1}class vn extends Error{constructor(t,a,s){super(),typeof a=="string"&&(s=a,a=void 0);let l="",o={},d=!1;if(a&&("line"in a&&"column"in a?o={place:a}:"start"in a&&"end"in a?o={place:a}:"type"in a?o={ancestors:[a],place:a.position}:o={...a}),typeof t=="string"?l=t:!o.cause&&t&&(d=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?o.ruleId=s:(o.source=s.slice(0,m),o.ruleId=s.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.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=to(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=d&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vn.prototype.file="";vn.prototype.name="";vn.prototype.reason="";vn.prototype.message="";vn.prototype.stack="";vn.prototype.column=void 0;vn.prototype.line=void 0;vn.prototype.ancestors=void 0;vn.prototype.cause=void 0;vn.prototype.fatal=void 0;vn.prototype.place=void 0;vn.prototype.ruleId=void 0;vn.prototype.source=void 0;const Bh={}.hasOwnProperty,nw=new Map,aw=/[A-Z]/g,rw=new Set(["table","tbody","thead","tfoot","tr"]),sw=new Set(["td","th"]),yy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function iw(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=hw(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=mw(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"?cs:So,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Ty(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function Ty(e,t,a){if(t.type==="element")return lw(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ow(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return cw(e,t,a);if(t.type==="mdxjsEsm")return uw(e,t);if(t.type==="root")return dw(e,t,a);if(t.type==="text")return fw(e,t)}function lw(e,t,a){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=cs,e.schema=l),e.ancestors.push(t);const o=Ny(e,t.tagName,!1),d=pw(e,t);let f=Uh(e,t);return rw.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!HC(m):!0})),_y(e,d,o,t),Ph(d,f),e.ancestors.pop(),e.schema=s,e.create(t,o,d,a)}function ow(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)}bo(e,t.position)}function uw(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bo(e,t.position)}function cw(e,t,a){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=cs,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:Ny(e,t.name,!0),d=gw(e,t),f=Uh(e,t);return _y(e,d,o,t),Ph(d,f),e.ancestors.pop(),e.schema=s,e.create(t,o,d,a)}function dw(e,t,a){const s={};return Ph(s,Uh(e,t)),e.create(t,e.Fragment,s,a)}function fw(e,t){return t.value}function _y(e,t,a,s){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=s)}function Ph(e,t){if(t.length>0){const a=t.length>1?t:t[0];a&&(e.children=a)}}function mw(e,t,a){return s;function s(l,o,d,f){const h=Array.isArray(d.children)?a:t;return f?h(o,d,f):h(o,d)}}function hw(e,t){return a;function a(s,l,o,d){const f=Array.isArray(o.children),m=Qa(s);return t(l,o,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function pw(e,t){const a={};let s,l;for(l in t.properties)if(l!=="children"&&Bh.call(t.properties,l)){const o=bw(e,l,t.properties[l]);if(o){const[d,f]=o;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&sw.has(t.tagName)?s=f:a[d]=f}}if(s){const o=a.style||(a.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return a}function gw(e,t){const a={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const d=o.expression;d.type;const f=d.properties[0];f.type,Object.assign(a,e.evaluater.evaluateExpression(f.argument))}else bo(e,t.position);else{const l=s.name;let o;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,o=e.evaluater.evaluateExpression(f.expression)}else bo(e,t.position);else o=s.value===null?!0:s.value;a[l]=o}return a}function Uh(e,t){const a=[];let s=-1;const l=e.passKeys?new Map:nw;for(;++s<t.children.length;){const o=t.children[s];let d;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=l.get(m)||0;d=m+"-"+h,l.set(m,h+1)}}const f=Ty(e,o,d);f!==void 0&&a.push(f)}return a}function bw(e,t,a){const s=qc(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=s.commaSeparated?cy(a):xy(a)),s.property==="style"){let l=typeof a=="object"?a:xw(e,String(a));return e.stylePropertyNameCase==="css"&&(l=Ew(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?YC[s.property]||s.property:s.attribute,a]}}function xw(e,t){try{return ew(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const s=a,l=new vn("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=yy+"#cannot-parse-style-attribute",l}}function Ny(e,t,a){let s;if(!a)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let o=-1,d;for(;++o<l.length;){const f=Tx(l[o])?{type:"Identifier",name:l[o]}:{type:"Literal",value:l[o]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=d}else s=Tx(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Bh.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);bo(e)}function bo(e,t){const a=new vn("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=yy+"#cannot-handle-mdx-estrees-without-createevaluater",a}function Ew(e){const t={};let a;for(a in e)Bh.call(e,a)&&(t[yw(a)]=e[a]);return t}function yw(e){let t=e.replace(aw,Tw);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Tw(e){return"-"+e.toLowerCase()}const Em={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"]},_w={};function Hh(e,t){const a=_w,s=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,l=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Sy(e,s,l)}function Sy(e,t,a){if(Nw(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 Ix(e.children,t,a)}return Array.isArray(e)?Ix(e,t,a):""}function Ix(e,t,a){const s=[];let l=-1;for(;++l<e.length;)s[l]=Sy(e[l],t,a);return s.join("")}function Nw(e){return!!(e&&typeof e=="object")}const Mx=document.createElement("i");function Fh(e){const t="&"+e+";";Mx.innerHTML=t;const a=Mx.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 o=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);o<s.length;)d=s.slice(o,o+1e4),d.unshift(t,0),e.splice(...d),o+=1e4,t+=1e4}function _a(e,t){return e.length>0?(la(e,e.length,0,t),e):t}const Dx={}.hasOwnProperty;function vy(e){const t={};let a=-1;for(;++a<e.length;)Sw(t,e[a]);return t}function Sw(e,t){let a;for(a in t){const l=(Dx.call(e,a)?e[a]:void 0)||(e[a]={}),o=t[a];let d;if(o)for(d in o){Dx.call(l,d)||(l[d]=[]);const f=o[d];vw(l[d],Array.isArray(f)?f:f?[f]:[])}}}function vw(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 Ay(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 In=ds(/[A-Za-z]/),Sn=ds(/[\dA-Za-z]/),Aw=ds(/[#-'*+\--9=?A-Z^-~]/);function Nc(e){return e!==null&&(e<32||e===127)}const eh=ds(/\d/),Cw=ds(/[\dA-Fa-f]/),ww=ds(/[!-/:-@[-`{-~]/);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 $c=ds(new RegExp("\\p{P}|\\p{S}","u")),zs=ds(/\s/);function ds(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Gi(e){const t=[];let a=-1,s=0,l=0;for(;++a<e.length;){const o=e.charCodeAt(a);let d="";if(o===37&&Sn(e.charCodeAt(a+1))&&Sn(e.charCodeAt(a+2)))l=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(d=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(a+1);o<56320&&f>56319&&f<57344?(d=String.fromCharCode(o,f),l=1):d="�"}else d=String.fromCharCode(o);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 o=0;return d;function d(m){return rt(m)?(e.enter(a),f(m)):t(m)}function f(m){return rt(m)&&o++<l?(e.consume(m),f):(e.exit(a),t(m))}}const kw={tokenize:Rw};function Rw(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"),o(f)}function o(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"),o):(e.consume(f),d)}}const Ow={tokenize:Iw},Lx={tokenize:Mw};function Iw(e){const t=this,a=[];let s=0,l,o,d;return f;function f(k){if(s<a.length){const D=a[s];return t.containerState=D[1],e.attempt(D[0].continuation,m,h)(k)}return h(k)}function m(k){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&I();const D=t.events.length;let V=D,L;for(;V--;)if(t.events[V][0]==="exit"&&t.events[V][1].type==="chunkFlow"){L=t.events[V][1].end;break}A(s);let M=D;for(;M<t.events.length;)t.events[M][1].end={...L},M++;return la(t.events,V+1,0,t.events.slice(D)),t.events.length=M,h(k)}return f(k)}function h(k){if(s===a.length){if(!l)return y(k);if(l.currentConstruct&&l.currentConstruct.concrete)return N(k);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Lx,x,b)(k)}function x(k){return l&&I(),A(s),y(k)}function b(k){return t.parser.lazy[t.now().line]=s!==a.length,d=t.now().offset,N(k)}function y(k){return t.containerState={},e.attempt(Lx,T,N)(k)}function T(k){return s++,a.push([t.currentConstruct,t.containerState]),y(k)}function N(k){if(k===null){l&&I(),A(0),e.consume(k);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),v(k)}function v(k){if(k===null){S(e.exit("chunkFlow"),!0),A(0),e.consume(k);return}return Ue(k)?(e.consume(k),S(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(k),v)}function S(k,D){const V=t.sliceStream(k);if(D&&V.push(null),k.previous=o,o&&(o.next=k),o=k,l.defineSkip(k.start),l.write(V),t.parser.lazy[k.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 M=t.events.length;let K=M,W,j;for(;K--;)if(t.events[K][0]==="exit"&&t.events[K][1].type==="chunkFlow"){if(W){j=t.events[K][1].end;break}W=!0}for(A(s),L=M;L<t.events.length;)t.events[L][1].end={...j},L++;la(t.events,K+1,0,t.events.slice(M)),t.events.length=L}}function A(k){let D=a.length;for(;D-- >k;){const V=a[D];t.containerState=V[1],V[0].exit.call(t,e)}a.length=k}function I(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function Mw(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 Pi(e){if(e===null||Rt(e)||zs(e))return 1;if($c(e))return 2}function Gc(e,t,a){const s=[];let l=-1;for(;++l<e.length;){const o=e[l].resolveAll;o&&!s.includes(o)&&(t=o(t,a),s.push(o))}return t}const th={name:"attention",resolveAll:Dw,tokenize:Lw};function Dw(e,t){let a=-1,s,l,o,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};jx(b,-m),jx(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},o={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",o,t]]),h=_a(h,Gc(t.parser.constructs.insideSpan.null,e.slice(s+1,a),t)),h=_a(h,[["exit",o,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 Lw(e,t){const a=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Pi(s);let o;return d;function d(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),x=Pi(m),b=!x||x===2&&l||a.includes(m),y=!l||l===2&&x||a.includes(s);return h._open=!!(o===42?b:b&&(l||!y)),h._close=!!(o===42?y:y&&(x||!b)),t(m)}}function jx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const jw={name:"autolink",tokenize:Bw};function Bw(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"),o}function o(T){return In(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||Nc(T)?a(T):(e.consume(T),m)}function h(T){return T===64?(e.consume(T),x):Aw(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 vo={partial:!0,tokenize:Pw};function Pw(e,t,a){return s;function s(o){return rt(o)?ct(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||Ue(o)?t(o):a(o)}}const Cy={continuation:{tokenize:Hw},exit:Fw,name:"blockQuote",tokenize:Uw};function Uw(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"),o}return a(d)}function o(d){return rt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(d))}}function Hw(e,t,a){const s=this;return l;function l(d){return rt(d)?ct(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):o(d)}function o(d){return e.attempt(Cy,t,a)(d)}}function Fw(e){e.exit("blockQuote")}const wy={name:"characterEscape",tokenize:zw};function zw(e,t,a){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),l}function l(o){return ww(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(o)}}const ky={name:"characterReference",tokenize:qw};function qw(e,t,a){const s=this;let l=0,o,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"),o=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"),o=6,d=Cw,x):(e.enter("characterReferenceValue"),o=7,d=eh,x(b))}function x(b){if(b===59&&l){const y=e.exit("characterReferenceValue");return d===Sn&&!Fh(s.sliceSerialize(y))?a(b):(e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return d(b)&&l++<o?(e.consume(b),x):a(b)}}const Bx={partial:!0,tokenize:$w},Px={concrete:!0,name:"codeFenced",tokenize:Yw};function Yw(e,t,a){const s=this,l={partial:!0,tokenize:V};let o=0,d=0,f;return m;function m(L){return h(L)}function h(L){const M=s.events[s.events.length-1];return o=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[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(Bx,v,D)(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,D,S)(L)}function S(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),A}function A(L){return o>0&&rt(L)?ct(e,I,"linePrefix",o+1)(L):I(L)}function I(L){return L===null||Ue(L)?e.check(Bx,v,D)(L):(e.enter("codeFlowValue"),k(L))}function k(L){return L===null||Ue(L)?(e.exit("codeFlowValue"),I(L)):(e.consume(L),k)}function D(L){return e.exit("codeFenced"),t(L)}function V(L,M,K){let W=0;return j;function j(re){return L.enter("lineEnding"),L.consume(re),L.exit("lineEnding"),U}function U(re){return L.enter("codeFencedFence"),rt(re)?ct(L,J,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):J(re)}function J(re){return re===f?(L.enter("codeFencedFenceSequence"),se(re)):K(re)}function se(re){return re===f?(W++,L.consume(re),se):W>=d?(L.exit("codeFencedFenceSequence"),rt(re)?ct(L,le,"whitespace")(re):le(re)):K(re)}function le(re){return re===null||Ue(re)?(L.exit("codeFencedFence"),M(re)):K(re)}}}function $w(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"),o)}function o(d){return s.parser.lazy[s.now().line]?a(d):t(d)}}const ym={name:"codeIndented",tokenize:Kw},Gw={partial:!0,tokenize:Vw};function Kw(e,t,a){const s=this;return l;function l(h){return e.enter("codeIndented"),ct(e,o,"linePrefix",5)(h)}function o(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(Gw,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 Vw(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,o,"linePrefix",5)(d)}function o(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 Qw={name:"codeText",previous:Ww,resolve:Xw,tokenize:Zw};function Xw(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 Ww(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Zw(e,t,a){let s=0,l,o;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?(o=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)):(o.type="codeTextData",h(b))}}class Jw{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 o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Vl(this.left,s),o.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),Vl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Vl(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);Vl(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Vl(this.left,a.reverse())}}}function Vl(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 Ry(e){const t={};let a=-1,s,l,o,d,f,m,h;const x=new Jw(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,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,e5(x,a)),a=t[a],h=!0);else if(s[1]._container){for(o=a,l=void 0;o--;)if(d=x.get(o),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(l&&(x.get(l)[1].type="lineEndingBlank"),d[1].type="lineEnding",l=o);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 e5(e,t){const a=e.get(t)[1],s=e.get(t)[2];let l=t-1;const o=[];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 S=[v];for(;T;){for(;e.get(++l)[1]!==T;);o.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,S.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):S.pop(),y=S.length;y--;){const A=f.slice(S[y],S[y+1]),I=o.pop();m.push([I,I+A.length-1]),e.splice(I,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 t5={resolve:a5,tokenize:r5},n5={partial:!0,tokenize:s5};function a5(e){return Ry(e),e}function r5(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?o(f):Ue(f)?e.check(n5,d,o)(f):(e.consume(f),l)}function o(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 s5(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,o,"linePrefix")}function o(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 Oy(e,t,a,s,l,o,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(o),e.consume(A),e.exit(o),y):A===null||A===32||A===41||Nc(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(o),e.consume(A),e.exit(o),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||Nc(A)?a(A):(e.consume(A),A===92?S:v)}function S(A){return A===40||A===41||A===92?(e.consume(A),v):v(A)}}function Iy(e,t,a,s,l,o){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(o),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(o),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 My(e,t,a,s,l,o){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(o),h(y))}function h(y){return y===d?(e.exit(o),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 no(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 i5={name:"definition",tokenize:o5},l5={partial:!0,tokenize:u5};function o5(e,t,a){const s=this;let l;return o;function o(T){return e.enter("definition"),d(T)}function d(T){return Iy.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)?no(e,h)(T):h(T)}function h(T){return Oy(e,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(T)}function x(T){return e.attempt(l5,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 u5(e,t,a){return s;function s(f){return Rt(f)?no(e,l)(f):a(f)}function l(f){return My(e,o,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return rt(f)?ct(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Ue(f)?t(f):a(f)}}const c5={name:"hardBreakEscape",tokenize:d5};function d5(e,t,a){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return Ue(o)?(e.exit("hardBreakEscape"),t(o)):a(o)}}const f5={name:"headingAtx",resolve:m5,tokenize:h5};function m5(e,t){let a=e.length-2,s=3,l,o;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},o={type:"chunkText",start:e[s][1].start,end:e[a][1].end,contentType:"text"},la(e,s,a-s+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function h5(e,t,a){let s=0;return l;function l(x){return e.enter("atxHeading"),o(x)}function o(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 p5=["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"],Ux=["pre","script","style","textarea"],g5={concrete:!0,name:"htmlFlow",resolveTo:E5,tokenize:y5},b5={partial:!0,tokenize:_5},x5={partial:!0,tokenize:T5};function E5(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 y5(e,t,a){const s=this;let l,o,d,f,m;return h;function h(O){return x(O)}function x(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),b}function b(O){return O===33?(e.consume(O),y):O===47?(e.consume(O),o=!0,v):O===63?(e.consume(O),l=3,s.interrupt?t:P):In(O)?(e.consume(O),d=String.fromCharCode(O),S):a(O)}function y(O){return O===45?(e.consume(O),l=2,T):O===91?(e.consume(O),l=5,f=0,N):In(O)?(e.consume(O),l=4,s.interrupt?t:P):a(O)}function T(O){return O===45?(e.consume(O),s.interrupt?t:P):a(O)}function N(O){const Te="CDATA[";return O===Te.charCodeAt(f++)?(e.consume(O),f===Te.length?s.interrupt?t:J:N):a(O)}function v(O){return In(O)?(e.consume(O),d=String.fromCharCode(O),S):a(O)}function S(O){if(O===null||O===47||O===62||Rt(O)){const Te=O===47,ke=d.toLowerCase();return!Te&&!o&&Ux.includes(ke)?(l=1,s.interrupt?t(O):J(O)):p5.includes(d.toLowerCase())?(l=6,Te?(e.consume(O),A):s.interrupt?t(O):J(O)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?a(O):o?I(O):k(O))}return O===45||Sn(O)?(e.consume(O),d+=String.fromCharCode(O),S):a(O)}function A(O){return O===62?(e.consume(O),s.interrupt?t:J):a(O)}function I(O){return rt(O)?(e.consume(O),I):j(O)}function k(O){return O===47?(e.consume(O),j):O===58||O===95||In(O)?(e.consume(O),D):rt(O)?(e.consume(O),k):j(O)}function D(O){return O===45||O===46||O===58||O===95||Sn(O)?(e.consume(O),D):V(O)}function V(O){return O===61?(e.consume(O),L):rt(O)?(e.consume(O),V):k(O)}function L(O){return O===null||O===60||O===61||O===62||O===96?a(O):O===34||O===39?(e.consume(O),m=O,M):rt(O)?(e.consume(O),L):K(O)}function M(O){return O===m?(e.consume(O),m=null,W):O===null||Ue(O)?a(O):(e.consume(O),M)}function K(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Rt(O)?V(O):(e.consume(O),K)}function W(O){return O===47||O===62||rt(O)?k(O):a(O)}function j(O){return O===62?(e.consume(O),U):a(O)}function U(O){return O===null||Ue(O)?J(O):rt(O)?(e.consume(O),U):a(O)}function J(O){return O===45&&l===2?(e.consume(O),Q):O===60&&l===1?(e.consume(O),F):O===62&&l===4?(e.consume(O),q):O===63&&l===3?(e.consume(O),P):O===93&&l===5?(e.consume(O),Ae):Ue(O)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(b5,ae,se)(O)):O===null||Ue(O)?(e.exit("htmlFlowData"),se(O)):(e.consume(O),J)}function se(O){return e.check(x5,le,ae)(O)}function le(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),re}function re(O){return O===null||Ue(O)?se(O):(e.enter("htmlFlowData"),J(O))}function Q(O){return O===45?(e.consume(O),P):J(O)}function F(O){return O===47?(e.consume(O),d="",fe):J(O)}function fe(O){if(O===62){const Te=d.toLowerCase();return Ux.includes(Te)?(e.consume(O),q):J(O)}return In(O)&&d.length<8?(e.consume(O),d+=String.fromCharCode(O),fe):J(O)}function Ae(O){return O===93?(e.consume(O),P):J(O)}function P(O){return O===62?(e.consume(O),q):O===45&&l===2?(e.consume(O),P):J(O)}function q(O){return O===null||Ue(O)?(e.exit("htmlFlowData"),ae(O)):(e.consume(O),q)}function ae(O){return e.exit("htmlFlow"),t(O)}}function T5(e,t,a){const s=this;return l;function l(d){return Ue(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):a(d)}function o(d){return s.parser.lazy[s.now().line]?a(d):t(d)}}function _5(e,t,a){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(vo,t,a)}}const N5={name:"htmlText",tokenize:S5};function S5(e,t,a){const s=this;let l,o,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),V):P===63?(e.consume(P),k):In(P)?(e.consume(P),K):a(P)}function h(P){return P===45?(e.consume(P),x):P===91?(e.consume(P),o=0,N):In(P)?(e.consume(P),I):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,F(P)):(e.consume(P),b)}function y(P){return P===45?(e.consume(P),T):b(P)}function T(P){return P===62?Q(P):P===45?y(P):b(P)}function N(P){const q="CDATA[";return P===q.charCodeAt(o++)?(e.consume(P),o===q.length?v:N):a(P)}function v(P){return P===null?a(P):P===93?(e.consume(P),S):Ue(P)?(d=v,F(P)):(e.consume(P),v)}function S(P){return P===93?(e.consume(P),A):v(P)}function A(P){return P===62?Q(P):P===93?(e.consume(P),A):v(P)}function I(P){return P===null||P===62?Q(P):Ue(P)?(d=I,F(P)):(e.consume(P),I)}function k(P){return P===null?a(P):P===63?(e.consume(P),D):Ue(P)?(d=k,F(P)):(e.consume(P),k)}function D(P){return P===62?Q(P):k(P)}function V(P){return In(P)?(e.consume(P),L):a(P)}function L(P){return P===45||Sn(P)?(e.consume(P),L):M(P)}function M(P){return Ue(P)?(d=M,F(P)):rt(P)?(e.consume(P),M):Q(P)}function K(P){return P===45||Sn(P)?(e.consume(P),K):P===47||P===62||Rt(P)?W(P):a(P)}function W(P){return P===47?(e.consume(P),Q):P===58||P===95||In(P)?(e.consume(P),j):Ue(P)?(d=W,F(P)):rt(P)?(e.consume(P),W):Q(P)}function j(P){return P===45||P===46||P===58||P===95||Sn(P)?(e.consume(P),j):U(P)}function U(P){return P===61?(e.consume(P),J):Ue(P)?(d=U,F(P)):rt(P)?(e.consume(P),U):W(P)}function J(P){return P===null||P===60||P===61||P===62||P===96?a(P):P===34||P===39?(e.consume(P),l=P,se):Ue(P)?(d=J,F(P)):rt(P)?(e.consume(P),J):(e.consume(P),le)}function se(P){return P===l?(e.consume(P),l=void 0,re):P===null?a(P):Ue(P)?(d=se,F(P)):(e.consume(P),se)}function le(P){return P===null||P===34||P===39||P===60||P===61||P===96?a(P):P===47||P===62||Rt(P)?W(P):(e.consume(P),le)}function re(P){return P===47||P===62||Rt(P)?W(P):a(P)}function Q(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):a(P)}function F(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),fe}function fe(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 zh={name:"labelEnd",resolveAll:w5,resolveTo:k5,tokenize:R5},v5={tokenize:O5},A5={tokenize:I5},C5={tokenize:M5};function w5(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 k5(e,t){let a=e.length,s=0,l,o,d,f;for(;a--;)if(l=e[a][1],o){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&&(o=a,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(d=a);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[d][1].end}},x={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=_a(f,e.slice(o+1,o+s+3)),f=_a(f,[["enter",x,t]]),f=_a(f,Gc(t.parser.constructs.insideSpan.null,e.slice(o+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,o,e.length,f),e}function R5(e,t,a){const s=this;let l=s.events.length,o,d;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){o=s.events[l][1];break}return f;function f(y){return o?o._inactive?b(y):(d=s.parser.defined.includes(Ma(s.sliceSerialize({start:o.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(v5,x,d?x:b)(y):y===91?e.attempt(A5,x,d?h:b)(y):d?x(y):b(y)}function h(y){return e.attempt(C5,x,b)(y)}function x(y){return t(y)}function b(y){return o._balanced=!0,a(y)}}function O5(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)?no(e,o)(b):o(b)}function o(b){return b===41?x(b):Oy(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function d(b){return Rt(b)?no(e,m)(b):x(b)}function f(b){return a(b)}function m(b){return b===34||b===39||b===40?My(e,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):x(b)}function h(b){return Rt(b)?no(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 I5(e,t,a){const s=this;return l;function l(f){return Iy.call(s,e,o,d,"reference","referenceMarker","referenceString")(f)}function o(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 M5(e,t,a){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),l}function l(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):a(o)}}const D5={name:"labelStartImage",resolveAll:zh.resolveAll,tokenize:L5};function L5(e,t,a){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(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 j5={name:"labelStartLink",resolveAll:zh.resolveAll,tokenize:B5};function B5(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"),o}function o(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?a(d):t(d)}}const Tm={name:"lineEnding",tokenize:P5};function P5(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:U5};function U5(e,t,a){let s=0,l;return o;function o(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:q5},exit:$5,name:"list",tokenize:z5},H5={partial:!0,tokenize:G5},F5={partial:!0,tokenize:Y5};function z5(e,t,a){const s=this,l=s.events[s.events.length-1];let o=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:eh(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 eh(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(vo,s.interrupt?a:x,e.attempt(H5,y,b))}function x(T){return s.containerState.initialBlankLine=!0,o++,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=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(T)}}function q5(e,t,a){const s=this;return s.containerState._closeFlow=void 0,e.check(vo,l,o);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ct(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(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(F5,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 Y5(e,t,a){const s=this;return ct(e,l,"listItemIndent",s.containerState.size+1);function l(o){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(o):a(o)}}function $5(e){e.exit(this.containerState.type)}function G5(e,t,a){const s=this;return ct(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const d=s.events[s.events.length-1];return!rt(o)&&d&&d[1].type==="listItemPrefixWhitespace"?t(o):a(o)}}const Hx={name:"setextUnderline",resolveTo:K5,tokenize:V5};function K5(e,t){let a=e.length,s,l,o;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),!o&&e[a][1].type==="definition"&&(o=a);const d={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",d,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=d,e.push(["exit",d,t]),e}function V5(e,t,a){const s=this;let l;return o;function o(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 Q5={tokenize:X5};function X5(e){const t=this,a=e.attempt(vo,s,e.attempt(this.parser.constructs.flowInitial,l,ct(e,e.attempt(this.parser.constructs.flow,l,e.attempt(t5,l)),"linePrefix")));return a;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,a}}const W5={resolveAll:Ly()},Z5=Dy("string"),J5=Dy("text");function Dy(e){return{resolveAll:Ly(e==="text"?ek:void 0),tokenize:t};function t(a){const s=this,l=this.parser.constructs[e],o=a.attempt(l,d,f);return d;function d(x){return h(x)?o(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"),o(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 Ly(e){return t;function t(a,s){let l=-1,o;for(;++l<=a.length;)o===void 0?a[l]&&a[l][1].type==="data"&&(o=l,l++):(!a[l]||a[l][1].type!=="data")&&(l!==o+2&&(a[o][1].end=a[l-1][1].end,a.splice(o+2,l-o-2),l=o+2),o=void 0);return e?e(a,s):a}}function ek(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 o=l.length,d=-1,f=0,m;for(;o--;){const h=l[o];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){o++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(f=0),f){const h={type:a===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?d:s.start._bufferIndex+d,_index:s.start._index+o,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 tk={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:Cy},nk={91:i5},ak={[-2]:ym,[-1]:ym,32:ym},rk={35:f5,42:uc,45:[Hx,uc],60:g5,61:Hx,95:uc,96:Px,126:Px},sk={38:ky,92:wy},ik={[-5]:Tm,[-4]:Tm,[-3]:Tm,33:D5,38:ky,42:th,60:[jw,N5],91:j5,92:[c5,wy],93:zh,95:th,96:Qw},lk={null:[th,W5]},ok={null:[42,95]},uk={null:[]},ck=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ok,contentInitial:nk,disable:uk,document:tk,flow:rk,flowInitial:ak,insideSpan:lk,string:sk,text:ik},Symbol.toStringTag,{value:"Module"}));function dk(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={},o=[];let d=[],f=[];const m={attempt:M(V),check:M(L),consume:I,enter:k,exit:D,interrupt:M(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&&o.push(t),h;function b(U){return d=_a(d,U),S(),d[d.length-1]!==null?[]:(K(t,0),h.events=Gc(o,h.events,h),h.events)}function y(U,J){return mk(T(U),J)}function T(U){return fk(d,U)}function N(){const{_bufferIndex:U,_index:J,line:se,column:le,offset:re}=s;return{_bufferIndex:U,_index:J,line:se,column:le,offset:re}}function v(U){l[U.line]=U.column,j()}function S(){let U;for(;s._index<d.length;){const J=d[s._index];if(typeof J=="string")for(U=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===U&&s._bufferIndex<J.length;)A(J.charCodeAt(s._bufferIndex));else A(J)}}function A(U){x=x(U)}function I(U){Ue(U)?(s.line++,s.column=1,s.offset+=U===-3?2:1,j()):U!==-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=U}function k(U,J){const se=J||{};return se.type=U,se.start=N(),h.events.push(["enter",se,h]),f.push(se),se}function D(U){const J=f.pop();return J.end=N(),h.events.push(["exit",J,h]),J}function V(U,J){K(U,J.from)}function L(U,J){J.restore()}function M(U,J){return se;function se(le,re,Q){let F,fe,Ae,P;return Array.isArray(le)?ae(le):"tokenize"in le?ae([le]):q(le);function q(Re){return Ye;function Ye(dt){const ut=dt!==null&&Re[dt],Ft=dt!==null&&Re.null,yn=[...Array.isArray(ut)?ut:ut?[ut]:[],...Array.isArray(Ft)?Ft:Ft?[Ft]:[]];return ae(yn)(dt)}}function ae(Re){return F=Re,fe=0,Re.length===0?Q:O(Re[fe])}function O(Re){return Ye;function Ye(dt){return P=W(),Ae=Re,Re.partial||(h.currentConstruct=Re),Re.name&&h.parser.constructs.disable.null.includes(Re.name)?ke():Re.tokenize.call(J?Object.assign(Object.create(h),J):h,m,Te,ke)(dt)}}function Te(Re){return U(Ae,P),re}function ke(Re){return P.restore(),++fe<F.length?O(F[fe]):Q}}}function K(U,J){U.resolveAll&&!o.includes(U)&&o.push(U),U.resolve&&la(h.events,J,h.events.length-J,U.resolve(h.events.slice(J),h)),U.resolveTo&&(h.events=U.resolveTo(h.events,h))}function W(){const U=N(),J=h.previous,se=h.currentConstruct,le=h.events.length,re=Array.from(f);return{from:le,restore:Q};function Q(){s=U,h.previous=J,h.currentConstruct=se,h.events.length=le,f=re,j()}}function j(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function fk(e,t){const a=t.start._index,s=t.start._bufferIndex,l=t.end._index,o=t.end._bufferIndex;let d;if(a===l)d=[e[a].slice(s,o)];else{if(d=e.slice(a,l),s>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(s):d.shift()}o>0&&d.push(e[l].slice(0,o))}return d}function mk(e,t){let a=-1;const s=[];let l;for(;++a<e.length;){const o=e[a];let d;if(typeof o=="string")d=o;else switch(o){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-DcQGwiRk.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CAbA8spX.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-IS4Y5evQ.css">
9
9
  </head>
10
10
  <body>