@cjhyy/code-shell-web 0.9.22 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/lib/environment.d.ts +16 -0
- package/dist/lib/environment.js +25 -0
- package/dist-app/assets/index-C9YhaFPF.js +50 -0
- package/dist-app/assets/index-Dtx33DyF.css +1 -0
- package/dist-app/index.html +2 -2
- package/package.json +3 -3
- package/dist-app/assets/index-D4xno_7a.js +0 -50
- package/dist-app/assets/index-Dz4kCU3p.css +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))s(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const o of d.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();function sf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var dc={exports:{}},Fr={};var Cp;function jv(){if(Cp)return Fr;Cp=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function r(s,c,d){var o=null;if(d!==void 0&&(o=""+d),c.key!==void 0&&(o=""+c.key),"key"in c){d={};for(var g in c)g!=="key"&&(d[g]=c[g])}else d=c;return c=d.ref,{$$typeof:n,type:s,key:o,ref:c!==void 0?c:null,props:d}}return Fr.Fragment=i,Fr.jsx=r,Fr.jsxs=r,Fr}var Ep;function kv(){return Ep||(Ep=1,dc.exports=jv()),dc.exports}var u=kv(),hc={exports:{}},Ye={};var Np;function wv(){if(Np)return Ye;Np=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),o=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),v=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=v&&A[v]||A["@@iterator"],typeof A=="function"?A:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O=Object.assign,z={};function D(A,X,E){this.props=A,this.context=X,this.refs=z,this.updater=E||N}D.prototype.isReactComponent={},D.prototype.setState=function(A,X){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,X,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function R(){}R.prototype=D.prototype;function U(A,X,E){this.props=A,this.context=X,this.refs=z,this.updater=E||N}var F=U.prototype=new R;F.constructor=U,O(F,D.prototype),F.isPureReactComponent=!0;var ue=Array.isArray;function L(){}var le={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function W(A,X,E){var ee=E.ref;return{$$typeof:n,type:A,key:X,ref:ee!==void 0?ee:null,props:E}}function T(A,X){return W(A.type,X,A.props)}function q(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function H(A){var X={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(E){return X[E]})}var re=/\/+/g;function me(A,X){return typeof A=="object"&&A!==null&&A.key!=null?H(""+A.key):X.toString(36)}function te(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(L,L):(A.status="pending",A.then(function(X){A.status==="pending"&&(A.status="fulfilled",A.value=X)},function(X){A.status==="pending"&&(A.status="rejected",A.reason=X)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function C(A,X,E,ee,ge){var $=typeof A;($==="undefined"||$==="boolean")&&(A=null);var ae=!1;if(A===null)ae=!0;else switch($){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(A.$$typeof){case n:case i:ae=!0;break;case b:return ae=A._init,C(ae(A._payload),X,E,ee,ge)}}if(ae)return ge=ge(A),ae=ee===""?"."+me(A,0):ee,ue(ge)?(E="",ae!=null&&(E=ae.replace(re,"$&/")+"/"),C(ge,X,E,"",function(Se){return Se})):ge!=null&&(q(ge)&&(ge=T(ge,E+(ge.key==null||A&&A.key===ge.key?"":(""+ge.key).replace(re,"$&/")+"/")+ae)),X.push(ge)),1;ae=0;var ke=ee===""?".":ee+":";if(ue(A))for(var Q=0;Q<A.length;Q++)ee=A[Q],$=ke+me(ee,Q),ae+=C(ee,X,E,$,ge);else if(Q=S(A),typeof Q=="function")for(A=Q.call(A),Q=0;!(ee=A.next()).done;)ee=ee.value,$=ke+me(ee,Q++),ae+=C(ee,X,E,$,ge);else if($==="object"){if(typeof A.then=="function")return C(te(A),X,E,ee,ge);throw X=String(A),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ae}function Y(A,X,E){if(A==null)return A;var ee=[],ge=0;return C(A,ee,"","",function($){return X.call(E,$,ge++)}),ee}function fe(A){if(A._status===-1){var X=A._result;X=X(),X.then(function(E){(A._status===0||A._status===-1)&&(A._status=1,A._result=E)},function(E){(A._status===0||A._status===-1)&&(A._status=2,A._result=E)}),A._status===-1&&(A._status=0,A._result=X)}if(A._status===1)return A._result.default;throw A._result}var be=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},k={map:Y,forEach:function(A,X,E){Y(A,function(){X.apply(this,arguments)},E)},count:function(A){var X=0;return Y(A,function(){X++}),X},toArray:function(A){return Y(A,function(X){return X})||[]},only:function(A){if(!q(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return Ye.Activity=y,Ye.Children=k,Ye.Component=D,Ye.Fragment=r,Ye.Profiler=c,Ye.PureComponent=U,Ye.StrictMode=s,Ye.Suspense=p,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=le,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(A){return le.H.useMemoCache(A)}},Ye.cache=function(A){return function(){return A.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(A,X,E){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var ee=O({},A.props),ge=A.key;if(X!=null)for($ in X.key!==void 0&&(ge=""+X.key),X)!oe.call(X,$)||$==="key"||$==="__self"||$==="__source"||$==="ref"&&X.ref===void 0||(ee[$]=X[$]);var $=arguments.length-2;if($===1)ee.children=E;else if(1<$){for(var ae=Array($),ke=0;ke<$;ke++)ae[ke]=arguments[ke+2];ee.children=ae}return W(A.type,ge,ee)},Ye.createContext=function(A){return A={$$typeof:o,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:d,_context:A},A},Ye.createElement=function(A,X,E){var ee,ge={},$=null;if(X!=null)for(ee in X.key!==void 0&&($=""+X.key),X)oe.call(X,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(ge[ee]=X[ee]);var ae=arguments.length-2;if(ae===1)ge.children=E;else if(1<ae){for(var ke=Array(ae),Q=0;Q<ae;Q++)ke[Q]=arguments[Q+2];ge.children=ke}if(A&&A.defaultProps)for(ee in ae=A.defaultProps,ae)ge[ee]===void 0&&(ge[ee]=ae[ee]);return W(A,$,ge)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(A){return{$$typeof:g,render:A}},Ye.isValidElement=q,Ye.lazy=function(A){return{$$typeof:b,_payload:{_status:-1,_result:A},_init:fe}},Ye.memo=function(A,X){return{$$typeof:m,type:A,compare:X===void 0?null:X}},Ye.startTransition=function(A){var X=le.T,E={};le.T=E;try{var ee=A(),ge=le.S;ge!==null&&ge(E,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(L,be)}catch($){be($)}finally{X!==null&&E.types!==null&&(X.types=E.types),le.T=X}},Ye.unstable_useCacheRefresh=function(){return le.H.useCacheRefresh()},Ye.use=function(A){return le.H.use(A)},Ye.useActionState=function(A,X,E){return le.H.useActionState(A,X,E)},Ye.useCallback=function(A,X){return le.H.useCallback(A,X)},Ye.useContext=function(A){return le.H.useContext(A)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(A,X){return le.H.useDeferredValue(A,X)},Ye.useEffect=function(A,X){return le.H.useEffect(A,X)},Ye.useEffectEvent=function(A){return le.H.useEffectEvent(A)},Ye.useId=function(){return le.H.useId()},Ye.useImperativeHandle=function(A,X,E){return le.H.useImperativeHandle(A,X,E)},Ye.useInsertionEffect=function(A,X){return le.H.useInsertionEffect(A,X)},Ye.useLayoutEffect=function(A,X){return le.H.useLayoutEffect(A,X)},Ye.useMemo=function(A,X){return le.H.useMemo(A,X)},Ye.useOptimistic=function(A,X){return le.H.useOptimistic(A,X)},Ye.useReducer=function(A,X,E){return le.H.useReducer(A,X,E)},Ye.useRef=function(A){return le.H.useRef(A)},Ye.useState=function(A){return le.H.useState(A)},Ye.useSyncExternalStore=function(A,X,E){return le.H.useSyncExternalStore(A,X,E)},Ye.useTransition=function(){return le.H.useTransition()},Ye.version="19.2.6",Ye}var Tp;function uf(){return Tp||(Tp=1,hc.exports=wv()),hc.exports}var Cv=uf();const j=sf(Cv);let fa,Zs=null;const Ev=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,$g=/^\/p\/([0-9a-f-]{36})(\/.*)$/;function sa(n){return typeof n=="string"&&Ev.test(n)}function Ts(n){if(n!==null&&!sa(n))throw new Error("项目标识无效。");Zs=n}function ua(){return Zs}function Zg(){return{workspace:fa??"",projectId:Zs}}function As(n){fa=void 0}function Hs(){return fa}function Nv(n=fa){return n?{"X-CodeShell-Workspace":encodeURIComponent(n)}:{}}function Kg(n){return/^\/api\/v1\/(?:auth|projects|environment)(?:\/|\?|$)/.test(n)||/^\/api\/v1\/desktop\/session(?:\?|$)/.test(n)}function Tv(n){const i=$g.exec(n);return!!i&&sa(i[1])}function yt(n,i=fa,r=Zs){const s=$g.exec(n),c=s?s[2]:n;if(s&&!sa(s[1])||!c.startsWith("/api/v1/")&&c!=="/ws"||/[\\\r\n]/.test(n))throw new Error("Workspace URLs must use the local API");const d=new URL(c,"http://codeshell.invalid");if(d.pathname!==c.split(/[?#]/,1)[0])throw new Error("Workspace URLs must use the local API");if(Kg(c))return c;if(s)return n;if(r!==null&&!sa(r))throw new Error("项目标识无效。");return i&&c.startsWith("/api/v1/")&&d.searchParams.set("workspace",i),`${r?`/p/${r}`:""}${d.pathname}${d.search}${d.hash}`}class Xe extends Error{constructor(i,r,s,c){super(i),this.status=r,this.code=s,this.retryAfterMs=c}status;code;retryAfterMs}async function Ie(n,i={}){const r=Nv(),s={...i};if(Object.keys(r).length&&!Kg(n)&&!Tv(n)&&!n.includes("workspace=")){const o=new Headers(i.headers);for(const[g,p]of Object.entries(r))o.has(g)||o.set(g,p);s.headers=o}const c=await fetch(yt(n,""),{...s,credentials:"same-origin",cache:"no-store"}),d=await c.json().catch(()=>({}));if(!c.ok){const o=typeof d.error=="string"?d.error:d.error?.message;throw new Xe(o??d.message??`请求失败(${c.status})`,c.status,typeof d.code=="string"?d.code:void 0,typeof d.retryAfterMs=="number"?d.retryAfterMs:void 0)}return d}function Fg(n,i={}){return Ie(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}async function Av(){try{const n=await Ie("/api/v1/auth/status");if(typeof n.initialized!="boolean"||typeof n.authenticated!="boolean")throw new Error("服务端返回了无效的登录状态,请稍后重试。");return n}catch(n){if(n instanceof Xe&&n.status===404)return null;throw n}}function zv(n,i){const r=new URLSearchParams(n.hash.replace(/^#/,"")),s=r.get("setup")??"";if(r.has("setup")){r.delete("setup");const c=r.toString();i.replaceState(i.state,"",`${n.pathname}${n.search}${c?`#${c}`:""}`)}return s}function da(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const n=crypto.getRandomValues(new Uint8Array(16));n[6]=n[6]&15|64,n[8]=n[8]&63|128;const i=Array.from(n,r=>r.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}async function Rv(n,i={}){const r=i.scope??Zg();return Ie(yt(`/api/v1/uploads/${da()}`,r.workspace,r.projectId),{method:"PUT",headers:{"Content-Type":n.type||"application/octet-stream","X-File-Name":encodeURIComponent(n.name)},body:n,signal:i.signal})}const Ic="codeshell.remote-link.authorization.v1",of="/api/v1/links/authorizations/",Yc="[a-f0-9-]{36}",Dv=new RegExp(`^(?:/p/${Yc})?${of}${Yc}$`);function cf(n){return n==="/link/callback"?"/":n==="/mobile/link/callback"?"/mobile/":void 0}function _v(n,i){const r=new URL(n),s=new URL(i);if(r.origin!==s.origin||r.pathname!=="/oauth/authorize"||r.username||r.password||r.hash||r.protocol!=="https:"&&!(r.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(r.hostname)))throw new Error("授权地址无效,请检查 Link 服务配置。");return r}function Ov(n,i,r,s=window.location.origin,c=window.sessionStorage){if(!n.redirect||!new RegExp(`^${Yc}$`).test(n.id))throw new Error("授权请求无效。");const d=_v(n.redirect.authorizationUrl,i),o=d.searchParams.get("state"),g=d.searchParams.get("redirect_uri"),p=Date.parse(n.redirect.expiresAt),m=g?cf(new URL(g,s).pathname):void 0;if(!o||!g||!m||g!==`${s}${m}link/callback`||m==="/mobile/"&&r.projectId!==null||d.searchParams.getAll("state").length!==1||d.searchParams.getAll("redirect_uri").length!==1||!Number.isFinite(p)||p<=Date.now())throw new Error("授权回调地址或有效期无效,请检查服务配置。");const b=yt(of+n.id,r.workspace,r.projectId),y=new URLSearchParams({view:"links",...r.projectId?{project:r.projectId}:{},...m==="/mobile/"?{workspace:r.workspace}:{}});return c.setItem(Ic,JSON.stringify({target:b,state:o,redirectUri:g,returnUrl:`${m}?${y}`,expiresAt:p})),d.href}function Mv(n,i,r){const s=cf(n.pathname);if(!s)return;const c=n.href;i.replaceState(i.state,"",n.pathname);try{const d=r.getItem(Ic);r.removeItem(Ic);const o=JSON.parse(d??"null");if(!o||!Number.isFinite(o.expiresAt)||o.expiresAt<=Date.now())throw new Error;const g=new URL(c),p=new URL(o.target,n.origin),m=new URL(o.returnUrl,n.origin);if(o.redirectUri!==`${n.origin}${n.pathname}`||g.origin!==n.origin||g.hash||g.searchParams.getAll("state").length!==1||g.searchParams.get("state")!==o.state||p.origin!==n.origin||!Dv.test(p.pathname)||p.hash||p.username||p.password||[...p.searchParams.keys()].some(b=>b!=="workspace")||p.searchParams.getAll("workspace").length>1||m.origin!==n.origin||m.pathname!==s||m.username||m.password||m.hash||[...m.searchParams.keys()].some(b=>!(s==="/mobile/"?["workspace","view"]:["project","view"]).includes(b))||m.searchParams.getAll("view").length!==1||m.searchParams.get("view")!=="links"||s==="/mobile/"&&(!p.pathname.startsWith(of)||m.searchParams.getAll("workspace").length!==1||m.searchParams.get("workspace")!==(p.searchParams.get("workspace")??"")))throw new Error;return{callbackUrl:c,pending:o,denied:g.searchParams.has("error")}}catch{return{error:"找不到匹配的授权,或授权已过期。请返回原项目重新连接。",home:s}}}async function Lv(n){if(n.denied)return await Ie(n.pending.target,{method:"DELETE"}),{id:"",providerId:"github",state:"cancelled"};const i=new URL(n.pending.target,window.location.origin);return i.pathname+="/complete",Ie(i.pathname+i.search,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:n.callbackUrl})})}function Uv(){const n=cf(window.location.pathname);if(n)try{return Mv(window.location,window.history,window.sessionStorage)}catch{return window.history.replaceState(window.history.state,"",window.location.pathname),{error:"浏览器无法读取原授权记录。请允许此站点保存临时数据后重新连接。",home:n}}}function Bv({callback:n}){const i=j.useRef(void 0),[r,s]=j.useState(),[c,d]=j.useState("error"in n?n.error:""),[o,g]=j.useState(!1),p=b=>d(b instanceof Xe&&b.status===401?"原登录已失效。请返回工作台登录,并重新发起授权。":b instanceof Error?b.message:"无法确认授权结果,请检查结果或返回项目重新连接。");j.useEffect(()=>{if("error"in n)return;let b=!0;return i.current??=Lv(n),i.current.then(y=>{b&&s(y)},y=>{b&&p(y)}),()=>{b=!1}},[n]);const m=!r&&!c;return u.jsx("main",{className:"auth-page",children:u.jsxs("section",{className:"auth-card",children:[u.jsx("h1",{children:"Link 授权"}),m&&u.jsx("p",{role:"status",children:"正在确认授权并保存到原项目…"}),r?.state==="connected"&&u.jsxs("p",{role:"status",children:["已连接 ",r.connection?.account?.label??"GitHub",",授权已保存到原项目。"]}),r?.previousGrantRevocationPending&&u.jsx("p",{role:"alert",children:"新连接已保存。有遗留授权等待撤销,项目所在环境将自动重试,重启后仍会继续;也可在 Link 服务中撤销。"}),r?.state==="cancelled"&&u.jsx("p",{role:"status",children:"授权已取消,没有新增连接。"}),r?.state==="failed"&&u.jsx("p",{role:"alert",children:"授权未完成。请返回原项目重新连接。"}),r?.state==="pending"&&u.jsx("p",{role:"status",children:"服务端尚未确认完成。可以稍后检查结果,或返回项目重新发起授权。"}),c&&u.jsx("p",{className:"form-error",role:"alert",children:c}),!("error"in n)&&(c||r?.state==="pending")&&u.jsx("button",{disabled:o,onClick:()=>{o||(g(!0),Ie(n.pending.target).then(b=>{s(b),d("")},p).finally(()=>g(!1)))},children:o?"正在查询…":"检查授权结果"}),!m&&u.jsx("a",{href:"error"in n?n.home??"/":n.pending.returnUrl,children:"返回原项目"})]})})}var mc={exports:{}},Jr={},pc={exports:{}},gc={};var Ap;function qv(){return Ap||(Ap=1,(function(n){function i(C,Y){var fe=C.length;C.push(Y);e:for(;0<fe;){var be=fe-1>>>1,k=C[be];if(0<c(k,Y))C[be]=Y,C[fe]=k,fe=be;else break e}}function r(C){return C.length===0?null:C[0]}function s(C){if(C.length===0)return null;var Y=C[0],fe=C.pop();if(fe!==Y){C[0]=fe;e:for(var be=0,k=C.length,A=k>>>1;be<A;){var X=2*(be+1)-1,E=C[X],ee=X+1,ge=C[ee];if(0>c(E,fe))ee<k&&0>c(ge,E)?(C[be]=ge,C[ee]=fe,be=ee):(C[be]=E,C[X]=fe,be=X);else if(ee<k&&0>c(ge,fe))C[be]=ge,C[ee]=fe,be=ee;else break e}}return Y}function c(C,Y){var fe=C.sortIndex-Y.sortIndex;return fe!==0?fe:C.id-Y.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var o=Date,g=o.now();n.unstable_now=function(){return o.now()-g}}var p=[],m=[],b=1,y=null,v=3,S=!1,N=!1,O=!1,z=!1,D=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function F(C){for(var Y=r(m);Y!==null;){if(Y.callback===null)s(m);else if(Y.startTime<=C)s(m),Y.sortIndex=Y.expirationTime,i(p,Y);else break;Y=r(m)}}function ue(C){if(O=!1,F(C),!N)if(r(p)!==null)N=!0,L||(L=!0,H());else{var Y=r(m);Y!==null&&te(ue,Y.startTime-C)}}var L=!1,le=-1,oe=5,W=-1;function T(){return z?!0:!(n.unstable_now()-W<oe)}function q(){if(z=!1,L){var C=n.unstable_now();W=C;var Y=!0;try{e:{N=!1,O&&(O=!1,R(le),le=-1),S=!0;var fe=v;try{t:{for(F(C),y=r(p);y!==null&&!(y.expirationTime>C&&T());){var be=y.callback;if(typeof be=="function"){y.callback=null,v=y.priorityLevel;var k=be(y.expirationTime<=C);if(C=n.unstable_now(),typeof k=="function"){y.callback=k,F(C),Y=!0;break t}y===r(p)&&s(p),F(C)}else s(p);y=r(p)}if(y!==null)Y=!0;else{var A=r(m);A!==null&&te(ue,A.startTime-C),Y=!1}}break e}finally{y=null,v=fe,S=!1}Y=void 0}}finally{Y?H():L=!1}}}var H;if(typeof U=="function")H=function(){U(q)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,me=re.port2;re.port1.onmessage=q,H=function(){me.postMessage(null)}}else H=function(){D(q,0)};function te(C,Y){le=D(function(){C(n.unstable_now())},Y)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(C){C.callback=null},n.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<C?Math.floor(1e3/C):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(C){switch(v){case 1:case 2:case 3:var Y=3;break;default:Y=v}var fe=v;v=Y;try{return C()}finally{v=fe}},n.unstable_requestPaint=function(){z=!0},n.unstable_runWithPriority=function(C,Y){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var fe=v;v=C;try{return Y()}finally{v=fe}},n.unstable_scheduleCallback=function(C,Y,fe){var be=n.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?be+fe:be):fe=be,C){case 1:var k=-1;break;case 2:k=250;break;case 5:k=1073741823;break;case 4:k=1e4;break;default:k=5e3}return k=fe+k,C={id:b++,callback:Y,priorityLevel:C,startTime:fe,expirationTime:k,sortIndex:-1},fe>be?(C.sortIndex=fe,i(m,C),r(p)===null&&C===r(m)&&(O?(R(le),le=-1):O=!0,te(ue,fe-be))):(C.sortIndex=k,i(p,C),N||S||(N=!0,L||(L=!0,H()))),C},n.unstable_shouldYield=T,n.unstable_wrapCallback=function(C){var Y=v;return function(){var fe=v;v=Y;try{return C.apply(this,arguments)}finally{v=fe}}}})(gc)),gc}var zp;function Hv(){return zp||(zp=1,pc.exports=qv()),pc.exports}var yc={exports:{}},Jt={};var Rp;function Iv(){if(Rp)return Jt;Rp=1;var n=uf();function i(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)m+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(i(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(p,m,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:p,containerInfo:m,implementation:b}}var o=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Jt.createPortal=function(p,m){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(i(299));return d(p,m,null,b)},Jt.flushSync=function(p){var m=o.T,b=s.p;try{if(o.T=null,s.p=2,p)return p()}finally{o.T=m,s.p=b,s.d.f()}},Jt.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(p,m))},Jt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Jt.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var b=m.as,y=g(b,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;b==="style"?s.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:y,integrity:v,fetchPriority:S}):b==="script"&&s.d.X(p,{crossOrigin:y,integrity:v,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Jt.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var b=g(m.as,m.crossOrigin);s.d.M(p,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(p)},Jt.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var b=m.as,y=g(b,m.crossOrigin);s.d.L(p,b,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Jt.preloadModule=function(p,m){if(typeof p=="string")if(m){var b=g(m.as,m.crossOrigin);s.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(p)},Jt.requestFormReset=function(p){s.d.r(p)},Jt.unstable_batchedUpdates=function(p,m){return p(m)},Jt.useFormState=function(p,m,b){return o.H.useFormState(p,m,b)},Jt.useFormStatus=function(){return o.H.useHostTransitionStatus()},Jt.version="19.2.6",Jt}var Dp;function Jg(){if(Dp)return yc.exports;Dp=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),yc.exports=Iv(),yc.exports}var _p;function Yv(){if(_p)return Jr;_p=1;var n=Hv(),i=uf(),r=Jg();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function o(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(s(188))}function m(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(s(188));return t!==e?null:e}for(var l=e,a=t;;){var f=l.return;if(f===null)break;var h=f.alternate;if(h===null){if(a=f.return,a!==null){l=a;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===l)return p(f),e;if(h===a)return p(f),t;h=h.sibling}throw Error(s(188))}if(l.return!==a.return)l=f,a=h;else{for(var x=!1,w=f.child;w;){if(w===l){x=!0,l=f,a=h;break}if(w===a){x=!0,a=f,l=h;break}w=w.sibling}if(!x){for(w=h.child;w;){if(w===l){x=!0,l=h,a=f;break}if(w===a){x=!0,a=h,l=f;break}w=w.sibling}if(!x)throw Error(s(189))}}if(l.alternate!==a)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var y=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),U=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function H(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||e["@@iterator"],typeof e=="function"?e:null)}var re=Symbol.for("react.client.reference");function me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case D:return"Profiler";case z:return"StrictMode";case ue:return"Suspense";case L:return"SuspenseList";case W:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case U:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case le:return t=e.displayName||null,t!==null?t:me(e.type)||"Memo";case oe:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}var te=Array.isArray,C=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},be=[],k=-1;function A(e){return{current:e}}function X(e){0>k||(e.current=be[k],be[k]=null,k--)}function E(e,t){k++,be[k]=e.current,e.current=t}var ee=A(null),ge=A(null),$=A(null),ae=A(null);function ke(e,t){switch(E($,t),E(ge,e),E(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Zm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Zm(t),e=Km(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X(ee),E(ee,e)}function Q(){X(ee),X(ge),X($)}function Se(e){e.memoizedState!==null&&E(ae,e);var t=ee.current,l=Km(t,e.type);t!==l&&(E(ge,e),E(ee,l))}function G(e){ge.current===e&&(X(ee),X(ge)),ae.current===e&&(X(ae),Xr._currentValue=fe)}var he,ze;function Ce(e){if(he===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||"",ze=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+he+e+ze}var Oe=!1;function Qe(e,t){if(!e||Oe)return"";Oe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ne){var P=ne}Reflect.construct(e,[],de)}else{try{de.call()}catch(ne){P=ne}e.call(de.prototype)}}else{try{throw Error()}catch(ne){P=ne}(de=e())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ne){if(ne&&P&&typeof ne.stack=="string")return[ne.stack,P.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=a.DetermineComponentFrameRoot(),x=h[0],w=h[1];if(x&&w){var M=x.split(`
|
|
4
|
+
`),K=w.split(`
|
|
5
|
+
`);for(f=a=0;a<M.length&&!M[a].includes("DetermineComponentFrameRoot");)a++;for(;f<K.length&&!K[f].includes("DetermineComponentFrameRoot");)f++;if(a===M.length||f===K.length)for(a=M.length-1,f=K.length-1;1<=a&&0<=f&&M[a]!==K[f];)f--;for(;1<=a&&0<=f;a--,f--)if(M[a]!==K[f]){if(a!==1||f!==1)do if(a--,f--,0>f||M[a]!==K[f]){var se=`
|
|
6
|
+
`+M[a].replace(" at new "," at ");return e.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",e.displayName)),se}while(1<=a&&0<=f);break}}}finally{Oe=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?Ce(l):""}function at(e,t){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce("Lazy");case 13:return e.child!==t&&t!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return Qe(e.type,!1);case 11:return Qe(e.type.render,!1);case 1:return Qe(e.type,!0);case 31:return Ce("Activity");default:return""}}function zt(e){try{var t="",l=null;do t+=at(e,l),l=e,e=e.return;while(e);return t}catch(a){return`
|
|
7
|
+
Error generating stack: `+a.message+`
|
|
8
|
+
`+a.stack}}var st=Object.prototype.hasOwnProperty,dt=n.unstable_scheduleCallback,jt=n.unstable_cancelCallback,tt=n.unstable_shouldYield,Mt=n.unstable_requestPaint,ut=n.unstable_now,Ft=n.unstable_getCurrentPriorityLevel,ie=n.unstable_ImmediatePriority,pe=n.unstable_UserBlockingPriority,De=n.unstable_NormalPriority,_e=n.unstable_LowPriority,qe=n.unstable_IdlePriority,kt=n.log,wt=n.unstable_setDisableYieldValue,Nt=null,ot=null;function ht(e){if(typeof kt=="function"&&wt(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(Nt,e)}catch{}}var $e=Math.clz32?Math.clz32:Ae,I=Math.log,xe=Math.LN2;function Ae(e){return e>>>=0,e===0?32:31-(I(e)/xe|0)|0}var J=256,je=262144,Be=4194304;function we(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ne(e,t,l){var a=e.pendingLanes;if(a===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var w=a&134217727;return w!==0?(a=w&~h,a!==0?f=we(a):(x&=w,x!==0?f=we(x):l||(l=w&~e,l!==0&&(f=we(l))))):(w=a&~h,w!==0?f=we(w):x!==0?f=we(x):l||(l=a&~e,l!==0&&(f=we(l)))),f===0?0:t!==0&&t!==f&&(t&h)===0&&(h=f&-f,l=t&-t,h>=l||h===32&&(l&4194048)!==0)?t:f}function ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function _(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ee(){var e=Be;return Be<<=1,(Be&62914560)===0&&(Be=4194304),e}function it(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function en(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Kn(e,t,l,a,f,h){var x=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var w=e.entanglements,M=e.expirationTimes,K=e.hiddenUpdates;for(l=x&~l;0<l;){var se=31-$e(l),de=1<<se;w[se]=0,M[se]=-1;var P=K[se];if(P!==null)for(K[se]=null,se=0;se<P.length;se++){var ne=P[se];ne!==null&&(ne.lane&=-536870913)}l&=~de}a!==0&&Vl(e,a,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~t))}function Vl(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-$e(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|l&261930}function Mn(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var a=31-$e(l),f=1<<a;f&t|e[a]&t&&(e[a]|=t),l&=~f}}function pl(e,t){var l=t&-t;return l=(l&42)!==0?1:Vt(l),(l&(e.suspendedLanes|t))!==0?0:l}function Vt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function gl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ar(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:bp(e.type))}function hi(e,t){var l=Y.p;try{return Y.p=e,t()}finally{Y.p=l}}var tn=Math.random().toString(36).slice(2),Qt="__reactFiber$"+tn,rn="__reactProps$"+tn,mi="__reactContainer$"+tn,nu="__reactEvents$"+tn,fb="__reactListeners$"+tn,db="__reactHandles$"+tn,Mf="__reactResources$"+tn,sr="__reactMarker$"+tn;function lu(e){delete e[Qt],delete e[rn],delete e[nu],delete e[fb],delete e[db]}function pi(e){var t=e[Qt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[mi]||l[Qt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=np(e);e!==null;){if(l=e[Qt])return l;e=np(e)}return t}e=l,l=e.parentNode}return null}function gi(e){if(e=e[Qt]||e[mi]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ur(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function yi(e){var t=e[Mf];return t||(t=e[Mf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Yt(e){e[sr]=!0}var Lf=new Set,Uf={};function Ql(e,t){bi(e,t),bi(e+"Capture",t)}function bi(e,t){for(Uf[e]=t,e=0;e<t.length;e++)Lf.add(t[e])}var hb=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Bf={},qf={};function mb(e){return st.call(qf,e)?!0:st.call(Bf,e)?!1:hb.test(e)?qf[e]=!0:(Bf[e]=!0,!1)}function ga(e,t,l){if(mb(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function ya(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Fn(e,t,l,a){if(a===null)e.removeAttribute(l);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+a)}}function wn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pb(e,t,l){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,h=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return f.call(this)},set:function(x){l=""+x,h.call(this,x)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(x){l=""+x},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function iu(e){if(!e._valueTracker){var t=Hf(e)?"checked":"value";e._valueTracker=pb(e,t,""+e[t])}}function If(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),a="";return e&&(a=Hf(e)?e.checked?"true":"false":e.value),e=a,e!==l?(t.setValue(e),!0):!1}function ba(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var gb=/[\n"\\]/g;function Cn(e){return e.replace(gb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ru(e,t,l,a,f,h,x,w){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),t!=null?x==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+wn(t)):e.value!==""+wn(t)&&(e.value=""+wn(t)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),t!=null?au(e,x,wn(t)):l!=null?au(e,x,wn(l)):a!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+wn(w):e.removeAttribute("name")}function Yf(e,t,l,a,f,h,x,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),t!=null||l!=null){if(!(h!=="submit"&&h!=="reset"||t!=null)){iu(e);return}l=l!=null?""+wn(l):"",t=t!=null?""+wn(t):l,w||t===e.value||(e.value=t),e.defaultValue=t}a=a??f,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=w?e.checked:!!a,e.defaultChecked=!!a,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),iu(e)}function au(e,t,l){t==="number"&&ba(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function xi(e,t,l,a){if(e=e.options,t){t={};for(var f=0;f<l.length;f++)t["$"+l[f]]=!0;for(l=0;l<e.length;l++)f=t.hasOwnProperty("$"+e[l].value),e[l].selected!==f&&(e[l].selected=f),f&&a&&(e[l].defaultSelected=!0)}else{for(l=""+wn(l),t=null,f=0;f<e.length;f++){if(e[f].value===l){e[f].selected=!0,a&&(e[f].defaultSelected=!0);return}t!==null||e[f].disabled||(t=e[f])}t!==null&&(t.selected=!0)}}function Gf(e,t,l){if(t!=null&&(t=""+wn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+wn(l):""}function Vf(e,t,l,a){if(t==null){if(a!=null){if(l!=null)throw Error(s(92));if(te(a)){if(1<a.length)throw Error(s(93));a=a[0]}l=a}l==null&&(l=""),t=l}l=wn(t),e.defaultValue=l,a=e.textContent,a===l&&a!==""&&a!==null&&(e.value=a),iu(e)}function vi(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var yb=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Qf(e,t,l){var a=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,l):typeof l!="number"||l===0||yb.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Xf(e,t,l){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,l!=null){for(var a in l)!l.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var f in t)a=t[f],t.hasOwnProperty(f)&&l[f]!==a&&Qf(e,f,a)}else for(var h in t)t.hasOwnProperty(h)&&Qf(e,h,t[h])}function su(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bb=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),xb=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function xa(e){return xb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Jn(){}var uu=null;function ou(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Si=null,ji=null;function $f(e){var t=gi(e);if(t&&(e=t.stateNode)){var l=e[rn]||null;e:switch(e=t.stateNode,t.type){case"input":if(ru(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Cn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var a=l[t];if(a!==e&&a.form===e.form){var f=a[rn]||null;if(!f)throw Error(s(90));ru(a,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(t=0;t<l.length;t++)a=l[t],a.form===e.form&&If(a)}break e;case"textarea":Gf(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&xi(e,!!l.multiple,t,!1)}}}var cu=!1;function Zf(e,t,l){if(cu)return e(t,l);cu=!0;try{var a=e(t);return a}finally{if(cu=!1,(Si!==null||ji!==null)&&(as(),Si&&(t=Si,e=ji,ji=Si=null,$f(t),e)))for(t=0;t<e.length;t++)$f(e[t])}}function or(e,t){var l=e.stateNode;if(l===null)return null;var a=l[rn]||null;if(a===null)return null;l=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(s(231,t,typeof l));return l}var Pn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fu=!1;if(Pn)try{var cr={};Object.defineProperty(cr,"passive",{get:function(){fu=!0}}),window.addEventListener("test",cr,cr),window.removeEventListener("test",cr,cr)}catch{fu=!1}var yl=null,du=null,va=null;function Kf(){if(va)return va;var e,t=du,l=t.length,a,f="value"in yl?yl.value:yl.textContent,h=f.length;for(e=0;e<l&&t[e]===f[e];e++);var x=l-e;for(a=1;a<=x&&t[l-a]===f[h-a];a++);return va=f.slice(e,1<a?1-a:void 0)}function Sa(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ja(){return!0}function Ff(){return!1}function an(e){function t(l,a,f,h,x){this._reactName=l,this._targetInst=f,this.type=a,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(l=e[w],this[w]=l?l(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?ja:Ff,this.isPropagationStopped=Ff,this}return y(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=ja)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ja)},persist:function(){},isPersistent:ja}),t}var Xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ka=an(Xl),fr=y({},Xl,{view:0,detail:0}),vb=an(fr),hu,mu,dr,wa=y({},fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==dr&&(dr&&e.type==="mousemove"?(hu=e.screenX-dr.screenX,mu=e.screenY-dr.screenY):mu=hu=0,dr=e),hu)},movementY:function(e){return"movementY"in e?e.movementY:mu}}),Jf=an(wa),Sb=y({},wa,{dataTransfer:0}),jb=an(Sb),kb=y({},fr,{relatedTarget:0}),pu=an(kb),wb=y({},Xl,{animationName:0,elapsedTime:0,pseudoElement:0}),Cb=an(wb),Eb=y({},Xl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Nb=an(Eb),Tb=y({},Xl,{data:0}),Pf=an(Tb),Ab={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Rb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Db(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Rb[e])?!!t[e]:!1}function gu(){return Db}var _b=y({},fr,{key:function(e){if(e.key){var t=Ab[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Sa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gu,charCode:function(e){return e.type==="keypress"?Sa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Sa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ob=an(_b),Mb=y({},wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wf=an(Mb),Lb=y({},fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gu}),Ub=an(Lb),Bb=y({},Xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),qb=an(Bb),Hb=y({},wa,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ib=an(Hb),Yb=y({},Xl,{newState:0,oldState:0}),Gb=an(Yb),Vb=[9,13,27,32],yu=Pn&&"CompositionEvent"in window,hr=null;Pn&&"documentMode"in document&&(hr=document.documentMode);var Qb=Pn&&"TextEvent"in window&&!hr,ed=Pn&&(!yu||hr&&8<hr&&11>=hr),td=" ",nd=!1;function ld(e,t){switch(e){case"keyup":return Vb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function id(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ki=!1;function Xb(e,t){switch(e){case"compositionend":return id(t);case"keypress":return t.which!==32?null:(nd=!0,td);case"textInput":return e=t.data,e===td&&nd?null:e;default:return null}}function $b(e,t){if(ki)return e==="compositionend"||!yu&&ld(e,t)?(e=Kf(),va=du=yl=null,ki=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return ed&&t.locale!=="ko"?null:t.data;default:return null}}var Zb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Zb[e.type]:t==="textarea"}function ad(e,t,l,a){Si?ji?ji.push(a):ji=[a]:Si=a,t=hs(t,"onChange"),0<t.length&&(l=new ka("onChange","change",null,l,a),e.push({event:l,listeners:t}))}var mr=null,pr=null;function Kb(e){Ym(e,0)}function Ca(e){var t=ur(e);if(If(t))return e}function sd(e,t){if(e==="change")return t}var ud=!1;if(Pn){var bu;if(Pn){var xu="oninput"in document;if(!xu){var od=document.createElement("div");od.setAttribute("oninput","return;"),xu=typeof od.oninput=="function"}bu=xu}else bu=!1;ud=bu&&(!document.documentMode||9<document.documentMode)}function cd(){mr&&(mr.detachEvent("onpropertychange",fd),pr=mr=null)}function fd(e){if(e.propertyName==="value"&&Ca(pr)){var t=[];ad(t,pr,e,ou(e)),Zf(Kb,t)}}function Fb(e,t,l){e==="focusin"?(cd(),mr=t,pr=l,mr.attachEvent("onpropertychange",fd)):e==="focusout"&&cd()}function Jb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ca(pr)}function Pb(e,t){if(e==="click")return Ca(t)}function Wb(e,t){if(e==="input"||e==="change")return Ca(t)}function ex(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pn=typeof Object.is=="function"?Object.is:ex;function gr(e,t){if(pn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),a=Object.keys(t);if(l.length!==a.length)return!1;for(a=0;a<l.length;a++){var f=l[a];if(!st.call(t,f)||!pn(e[f],t[f]))return!1}return!0}function dd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hd(e,t){var l=dd(e);e=0;for(var a;l;){if(l.nodeType===3){if(a=e+l.textContent.length,e<=t&&a>=t)return{node:l,offset:t-e};e=a}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=dd(l)}}function md(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?md(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function pd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ba(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=ba(e.document)}return t}function vu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var tx=Pn&&"documentMode"in document&&11>=document.documentMode,wi=null,Su=null,yr=null,ju=!1;function gd(e,t,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ju||wi==null||wi!==ba(a)||(a=wi,"selectionStart"in a&&vu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),yr&&gr(yr,a)||(yr=a,a=hs(Su,"onSelect"),0<a.length&&(t=new ka("onSelect","select",null,t,l),e.push({event:t,listeners:a}),t.target=wi)))}function $l(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ci={animationend:$l("Animation","AnimationEnd"),animationiteration:$l("Animation","AnimationIteration"),animationstart:$l("Animation","AnimationStart"),transitionrun:$l("Transition","TransitionRun"),transitionstart:$l("Transition","TransitionStart"),transitioncancel:$l("Transition","TransitionCancel"),transitionend:$l("Transition","TransitionEnd")},ku={},yd={};Pn&&(yd=document.createElement("div").style,"AnimationEvent"in window||(delete Ci.animationend.animation,delete Ci.animationiteration.animation,delete Ci.animationstart.animation),"TransitionEvent"in window||delete Ci.transitionend.transition);function Zl(e){if(ku[e])return ku[e];if(!Ci[e])return e;var t=Ci[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in yd)return ku[e]=t[l];return e}var bd=Zl("animationend"),xd=Zl("animationiteration"),vd=Zl("animationstart"),nx=Zl("transitionrun"),lx=Zl("transitionstart"),ix=Zl("transitioncancel"),Sd=Zl("transitionend"),jd=new Map,wu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");wu.push("scrollEnd");function Ln(e,t){jd.set(e,t),Ql(t,[e])}var Ea=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],Ei=0,Cu=0;function Na(){for(var e=Ei,t=Cu=Ei=0;t<e;){var l=En[t];En[t++]=null;var a=En[t];En[t++]=null;var f=En[t];En[t++]=null;var h=En[t];if(En[t++]=null,a!==null&&f!==null){var x=a.pending;x===null?f.next=f:(f.next=x.next,x.next=f),a.pending=f}h!==0&&kd(l,f,h)}}function Ta(e,t,l,a){En[Ei++]=e,En[Ei++]=t,En[Ei++]=l,En[Ei++]=a,Cu|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Eu(e,t,l,a){return Ta(e,t,l,a),Aa(e)}function Kl(e,t){return Ta(e,null,null,t),Aa(e)}function kd(e,t,l){e.lanes|=l;var a=e.alternate;a!==null&&(a.lanes|=l);for(var f=!1,h=e.return;h!==null;)h.childLanes|=l,a=h.alternate,a!==null&&(a.childLanes|=l),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&t!==null&&(f=31-$e(l),e=h.hiddenUpdates,a=e[f],a===null?e[f]=[t]:a.push(t),t.lane=l|536870912),h):null}function Aa(e){if(50<qr)throw qr=0,Lo=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ni={};function rx(e,t,l,a){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gn(e,t,l,a){return new rx(e,t,l,a)}function Nu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Wn(e,t){var l=e.alternate;return l===null?(l=gn(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function wd(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function za(e,t,l,a,f,h){var x=0;if(a=e,typeof e=="function")Nu(e)&&(x=1);else if(typeof e=="string")x=cv(e,l,ee.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case W:return e=gn(31,l,t,f),e.elementType=W,e.lanes=h,e;case O:return Fl(l.children,f,h,t);case z:x=8,f|=24;break;case D:return e=gn(12,l,t,f|2),e.elementType=D,e.lanes=h,e;case ue:return e=gn(13,l,t,f),e.elementType=ue,e.lanes=h,e;case L:return e=gn(19,l,t,f),e.elementType=L,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case U:x=10;break e;case R:x=9;break e;case F:x=11;break e;case le:x=14;break e;case oe:x=16,a=null;break e}x=29,l=Error(s(130,e===null?"null":typeof e,"")),a=null}return t=gn(x,l,t,f),t.elementType=e,t.type=a,t.lanes=h,t}function Fl(e,t,l,a){return e=gn(7,e,a,t),e.lanes=l,e}function Tu(e,t,l){return e=gn(6,e,null,t),e.lanes=l,e}function Cd(e){var t=gn(18,null,null,0);return t.stateNode=e,t}function Au(e,t,l){return t=gn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ed=new WeakMap;function Nn(e,t){if(typeof e=="object"&&e!==null){var l=Ed.get(e);return l!==void 0?l:(t={value:e,source:t,stack:zt(t)},Ed.set(e,t),t)}return{value:e,source:t,stack:zt(t)}}var Ti=[],Ai=0,Ra=null,br=0,Tn=[],An=0,bl=null,Gn=1,Vn="";function el(e,t){Ti[Ai++]=br,Ti[Ai++]=Ra,Ra=e,br=t}function Nd(e,t,l){Tn[An++]=Gn,Tn[An++]=Vn,Tn[An++]=bl,bl=e;var a=Gn;e=Vn;var f=32-$e(a)-1;a&=~(1<<f),l+=1;var h=32-$e(t)+f;if(30<h){var x=f-f%5;h=(a&(1<<x)-1).toString(32),a>>=x,f-=x,Gn=1<<32-$e(t)+f|l<<f|a,Vn=h+e}else Gn=1<<h|l<<f|a,Vn=e}function zu(e){e.return!==null&&(el(e,1),Nd(e,1,0))}function Ru(e){for(;e===Ra;)Ra=Ti[--Ai],Ti[Ai]=null,br=Ti[--Ai],Ti[Ai]=null;for(;e===bl;)bl=Tn[--An],Tn[An]=null,Vn=Tn[--An],Tn[An]=null,Gn=Tn[--An],Tn[An]=null}function Td(e,t){Tn[An++]=Gn,Tn[An++]=Vn,Tn[An++]=bl,Gn=t.id,Vn=t.overflow,bl=e}var Xt=null,Ct=null,We=!1,xl=null,zn=!1,Du=Error(s(519));function vl(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw xr(Nn(t,e)),Du}function Ad(e){var t=e.stateNode,l=e.type,a=e.memoizedProps;switch(t[Qt]=e,t[rn]=a,l){case"dialog":Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":case"embed":Ke("load",t);break;case"video":case"audio":for(l=0;l<Ir.length;l++)Ke(Ir[l],t);break;case"source":Ke("error",t);break;case"img":case"image":case"link":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"input":Ke("invalid",t),Yf(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":Ke("invalid",t);break;case"textarea":Ke("invalid",t),Vf(t,a.value,a.defaultValue,a.children)}l=a.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||a.suppressHydrationWarning===!0||Xm(t.textContent,l)?(a.popover!=null&&(Ke("beforetoggle",t),Ke("toggle",t)),a.onScroll!=null&&Ke("scroll",t),a.onScrollEnd!=null&&Ke("scrollend",t),a.onClick!=null&&(t.onclick=Jn),t=!0):t=!1,t||vl(e,!0)}function zd(e){for(Xt=e.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Xt=Xt.return}}function zi(e){if(e!==Xt)return!1;if(!We)return zd(e),We=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Jo(e.type,e.memoizedProps)),l=!l),l&&Ct&&vl(e),zd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Ct=tp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Ct=tp(e)}else t===27?(t=Ct,Ol(e.type)?(e=nc,nc=null,Ct=e):Ct=t):Ct=Xt?Dn(e.stateNode.nextSibling):null;return!0}function Jl(){Ct=Xt=null,We=!1}function _u(){var e=xl;return e!==null&&(cn===null?cn=e:cn.push.apply(cn,e),xl=null),e}function xr(e){xl===null?xl=[e]:xl.push(e)}var Ou=A(null),Pl=null,tl=null;function Sl(e,t,l){E(Ou,t._currentValue),t._currentValue=l}function nl(e){e._currentValue=Ou.current,X(Ou)}function Mu(e,t,l){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===l)break;e=e.return}}function Lu(e,t,l,a){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var M=0;M<t.length;M++)if(w.context===t[M]){h.lanes|=l,w=h.alternate,w!==null&&(w.lanes|=l),Mu(h.return,l,e),a||(x=null);break e}h=w.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(s(341));x.lanes|=l,h=x.alternate,h!==null&&(h.lanes|=l),Mu(x,l,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function Ri(e,t,l,a){e=null;for(var f=t,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var w=f.type;pn(f.pendingProps.value,x.value)||(e!==null?e.push(w):e=[w])}}else if(f===ae.current){if(x=f.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Xr):e=[Xr])}f=f.return}e!==null&&Lu(t,e,l,a),t.flags|=262144}function Da(e){for(e=e.firstContext;e!==null;){if(!pn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wl(e){Pl=e,tl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $t(e){return Rd(Pl,e)}function _a(e,t){return Pl===null&&Wl(e),Rd(e,t)}function Rd(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},tl===null){if(e===null)throw Error(s(308));tl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else tl=tl.next=t;return l}var ax=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},sx=n.unstable_scheduleCallback,ux=n.unstable_NormalPriority,Lt={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uu(){return{controller:new ax,data:new Map,refCount:0}}function vr(e){e.refCount--,e.refCount===0&&sx(ux,function(){e.controller.abort()})}var Sr=null,Bu=0,Di=0,_i=null;function ox(e,t){if(Sr===null){var l=Sr=[];Bu=0,Di=Yo(),_i={status:"pending",value:void 0,then:function(a){l.push(a)}}}return Bu++,t.then(Dd,Dd),t}function Dd(){if(--Bu===0&&Sr!==null){_i!==null&&(_i.status="fulfilled");var e=Sr;Sr=null,Di=0,_i=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function cx(e,t){var l=[],a={status:"pending",value:null,reason:null,then:function(f){l.push(f)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var f=0;f<l.length;f++)(0,l[f])(t)},function(f){for(a.status="rejected",a.reason=f,f=0;f<l.length;f++)(0,l[f])(void 0)}),a}var _d=C.S;C.S=function(e,t){gm=ut(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ox(e,t),_d!==null&&_d(e,t)};var ei=A(null);function qu(){var e=ei.current;return e!==null?e:bt.pooledCache}function Oa(e,t){t===null?E(ei,ei.current):E(ei,t.pool)}function Od(){var e=qu();return e===null?null:{parent:Lt._currentValue,pool:e}}var Oi=Error(s(460)),Hu=Error(s(474)),Ma=Error(s(542)),La={then:function(){}};function Md(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ld(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(Jn,Jn),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bd(e),e;default:if(typeof t.status=="string")t.then(Jn,Jn);else{if(e=bt,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var f=t;f.status="fulfilled",f.value=a}},function(a){if(t.status==="pending"){var f=t;f.status="rejected",f.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bd(e),e}throw ni=t,Oi}}function ti(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ni=l,Oi):l}}var ni=null;function Ud(){if(ni===null)throw Error(s(459));var e=ni;return ni=null,e}function Bd(e){if(e===Oi||e===Ma)throw Error(s(483))}var Mi=null,jr=0;function Ua(e){var t=jr;return jr+=1,Mi===null&&(Mi=[]),Ld(Mi,e,t)}function kr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ba(e,t){throw t.$$typeof===v?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function qd(e){function t(V,B){if(e){var Z=V.deletions;Z===null?(V.deletions=[B],V.flags|=16):Z.push(B)}}function l(V,B){if(!e)return null;for(;B!==null;)t(V,B),B=B.sibling;return null}function a(V){for(var B=new Map;V!==null;)V.key!==null?B.set(V.key,V):B.set(V.index,V),V=V.sibling;return B}function f(V,B){return V=Wn(V,B),V.index=0,V.sibling=null,V}function h(V,B,Z){return V.index=Z,e?(Z=V.alternate,Z!==null?(Z=Z.index,Z<B?(V.flags|=67108866,B):Z):(V.flags|=67108866,B)):(V.flags|=1048576,B)}function x(V){return e&&V.alternate===null&&(V.flags|=67108866),V}function w(V,B,Z,ce){return B===null||B.tag!==6?(B=Tu(Z,V.mode,ce),B.return=V,B):(B=f(B,Z),B.return=V,B)}function M(V,B,Z,ce){var Me=Z.type;return Me===O?se(V,B,Z.props.children,ce,Z.key):B!==null&&(B.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===oe&&ti(Me)===B.type)?(B=f(B,Z.props),kr(B,Z),B.return=V,B):(B=za(Z.type,Z.key,Z.props,null,V.mode,ce),kr(B,Z),B.return=V,B)}function K(V,B,Z,ce){return B===null||B.tag!==4||B.stateNode.containerInfo!==Z.containerInfo||B.stateNode.implementation!==Z.implementation?(B=Au(Z,V.mode,ce),B.return=V,B):(B=f(B,Z.children||[]),B.return=V,B)}function se(V,B,Z,ce,Me){return B===null||B.tag!==7?(B=Fl(Z,V.mode,ce,Me),B.return=V,B):(B=f(B,Z),B.return=V,B)}function de(V,B,Z){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=Tu(""+B,V.mode,Z),B.return=V,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case S:return Z=za(B.type,B.key,B.props,null,V.mode,Z),kr(Z,B),Z.return=V,Z;case N:return B=Au(B,V.mode,Z),B.return=V,B;case oe:return B=ti(B),de(V,B,Z)}if(te(B)||H(B))return B=Fl(B,V.mode,Z,null),B.return=V,B;if(typeof B.then=="function")return de(V,Ua(B),Z);if(B.$$typeof===U)return de(V,_a(V,B),Z);Ba(V,B)}return null}function P(V,B,Z,ce){var Me=B!==null?B.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Me!==null?null:w(V,B,""+Z,ce);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case S:return Z.key===Me?M(V,B,Z,ce):null;case N:return Z.key===Me?K(V,B,Z,ce):null;case oe:return Z=ti(Z),P(V,B,Z,ce)}if(te(Z)||H(Z))return Me!==null?null:se(V,B,Z,ce,null);if(typeof Z.then=="function")return P(V,B,Ua(Z),ce);if(Z.$$typeof===U)return P(V,B,_a(V,Z),ce);Ba(V,Z)}return null}function ne(V,B,Z,ce,Me){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return V=V.get(Z)||null,w(B,V,""+ce,Me);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case S:return V=V.get(ce.key===null?Z:ce.key)||null,M(B,V,ce,Me);case N:return V=V.get(ce.key===null?Z:ce.key)||null,K(B,V,ce,Me);case oe:return ce=ti(ce),ne(V,B,Z,ce,Me)}if(te(ce)||H(ce))return V=V.get(Z)||null,se(B,V,ce,Me,null);if(typeof ce.then=="function")return ne(V,B,Z,Ua(ce),Me);if(ce.$$typeof===U)return ne(V,B,Z,_a(B,ce),Me);Ba(B,ce)}return null}function Te(V,B,Z,ce){for(var Me=null,nt=null,Re=B,Ve=B=0,Pe=null;Re!==null&&Ve<Z.length;Ve++){Re.index>Ve?(Pe=Re,Re=null):Pe=Re.sibling;var lt=P(V,Re,Z[Ve],ce);if(lt===null){Re===null&&(Re=Pe);break}e&&Re&<.alternate===null&&t(V,Re),B=h(lt,B,Ve),nt===null?Me=lt:nt.sibling=lt,nt=lt,Re=Pe}if(Ve===Z.length)return l(V,Re),We&&el(V,Ve),Me;if(Re===null){for(;Ve<Z.length;Ve++)Re=de(V,Z[Ve],ce),Re!==null&&(B=h(Re,B,Ve),nt===null?Me=Re:nt.sibling=Re,nt=Re);return We&&el(V,Ve),Me}for(Re=a(Re);Ve<Z.length;Ve++)Pe=ne(Re,V,Ve,Z[Ve],ce),Pe!==null&&(e&&Pe.alternate!==null&&Re.delete(Pe.key===null?Ve:Pe.key),B=h(Pe,B,Ve),nt===null?Me=Pe:nt.sibling=Pe,nt=Pe);return e&&Re.forEach(function(ql){return t(V,ql)}),We&&el(V,Ve),Me}function Ue(V,B,Z,ce){if(Z==null)throw Error(s(151));for(var Me=null,nt=null,Re=B,Ve=B=0,Pe=null,lt=Z.next();Re!==null&&!lt.done;Ve++,lt=Z.next()){Re.index>Ve?(Pe=Re,Re=null):Pe=Re.sibling;var ql=P(V,Re,lt.value,ce);if(ql===null){Re===null&&(Re=Pe);break}e&&Re&&ql.alternate===null&&t(V,Re),B=h(ql,B,Ve),nt===null?Me=ql:nt.sibling=ql,nt=ql,Re=Pe}if(lt.done)return l(V,Re),We&&el(V,Ve),Me;if(Re===null){for(;!lt.done;Ve++,lt=Z.next())lt=de(V,lt.value,ce),lt!==null&&(B=h(lt,B,Ve),nt===null?Me=lt:nt.sibling=lt,nt=lt);return We&&el(V,Ve),Me}for(Re=a(Re);!lt.done;Ve++,lt=Z.next())lt=ne(Re,V,Ve,lt.value,ce),lt!==null&&(e&<.alternate!==null&&Re.delete(lt.key===null?Ve:lt.key),B=h(lt,B,Ve),nt===null?Me=lt:nt.sibling=lt,nt=lt);return e&&Re.forEach(function(Sv){return t(V,Sv)}),We&&el(V,Ve),Me}function gt(V,B,Z,ce){if(typeof Z=="object"&&Z!==null&&Z.type===O&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case S:e:{for(var Me=Z.key;B!==null;){if(B.key===Me){if(Me=Z.type,Me===O){if(B.tag===7){l(V,B.sibling),ce=f(B,Z.props.children),ce.return=V,V=ce;break e}}else if(B.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===oe&&ti(Me)===B.type){l(V,B.sibling),ce=f(B,Z.props),kr(ce,Z),ce.return=V,V=ce;break e}l(V,B);break}else t(V,B);B=B.sibling}Z.type===O?(ce=Fl(Z.props.children,V.mode,ce,Z.key),ce.return=V,V=ce):(ce=za(Z.type,Z.key,Z.props,null,V.mode,ce),kr(ce,Z),ce.return=V,V=ce)}return x(V);case N:e:{for(Me=Z.key;B!==null;){if(B.key===Me)if(B.tag===4&&B.stateNode.containerInfo===Z.containerInfo&&B.stateNode.implementation===Z.implementation){l(V,B.sibling),ce=f(B,Z.children||[]),ce.return=V,V=ce;break e}else{l(V,B);break}else t(V,B);B=B.sibling}ce=Au(Z,V.mode,ce),ce.return=V,V=ce}return x(V);case oe:return Z=ti(Z),gt(V,B,Z,ce)}if(te(Z))return Te(V,B,Z,ce);if(H(Z)){if(Me=H(Z),typeof Me!="function")throw Error(s(150));return Z=Me.call(Z),Ue(V,B,Z,ce)}if(typeof Z.then=="function")return gt(V,B,Ua(Z),ce);if(Z.$$typeof===U)return gt(V,B,_a(V,Z),ce);Ba(V,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,B!==null&&B.tag===6?(l(V,B.sibling),ce=f(B,Z),ce.return=V,V=ce):(l(V,B),ce=Tu(Z,V.mode,ce),ce.return=V,V=ce),x(V)):l(V,B)}return function(V,B,Z,ce){try{jr=0;var Me=gt(V,B,Z,ce);return Mi=null,Me}catch(Re){if(Re===Oi||Re===Ma)throw Re;var nt=gn(29,Re,null,V.mode);return nt.lanes=ce,nt.return=V,nt}}}var li=qd(!0),Hd=qd(!1),jl=!1;function Iu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function kl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wl(e,t,l){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(rt&2)!==0){var f=a.pending;return f===null?t.next=t:(t.next=f.next,f.next=t),a.pending=t,t=Aa(e),kd(e,null,l),t}return Ta(e,a,t,l),Aa(e)}function wr(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,Mn(e,l)}}function Gu(e,t){var l=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var f=null,h=null;if(l=l.firstBaseUpdate,l!==null){do{var x={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,l=l.next}while(l!==null);h===null?f=h=t:h=h.next=t}else f=h=t;l={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,callbacks:a.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Vu=!1;function Cr(){if(Vu){var e=_i;if(e!==null)throw e}}function Er(e,t,l,a){Vu=!1;var f=e.updateQueue;jl=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var M=w,K=M.next;M.next=null,x===null?h=K:x.next=K,x=M;var se=e.alternate;se!==null&&(se=se.updateQueue,w=se.lastBaseUpdate,w!==x&&(w===null?se.firstBaseUpdate=K:w.next=K,se.lastBaseUpdate=M))}if(h!==null){var de=f.baseState;x=0,se=K=M=null,w=h;do{var P=w.lane&-536870913,ne=P!==w.lane;if(ne?(Je&P)===P:(a&P)===P){P!==0&&P===Di&&(Vu=!0),se!==null&&(se=se.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Te=e,Ue=w;P=t;var gt=l;switch(Ue.tag){case 1:if(Te=Ue.payload,typeof Te=="function"){de=Te.call(gt,de,P);break e}de=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ue.payload,P=typeof Te=="function"?Te.call(gt,de,P):Te,P==null)break e;de=y({},de,P);break e;case 2:jl=!0}}P=w.callback,P!==null&&(e.flags|=64,ne&&(e.flags|=8192),ne=f.callbacks,ne===null?f.callbacks=[P]:ne.push(P))}else ne={lane:P,tag:w.tag,payload:w.payload,callback:w.callback,next:null},se===null?(K=se=ne,M=de):se=se.next=ne,x|=P;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;ne=w,w=ne.next,ne.next=null,f.lastBaseUpdate=ne,f.shared.pending=null}}while(!0);se===null&&(M=de),f.baseState=M,f.firstBaseUpdate=K,f.lastBaseUpdate=se,h===null&&(f.shared.lanes=0),Al|=x,e.lanes=x,e.memoizedState=de}}function Id(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function Yd(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Id(l[e],t)}var Li=A(null),qa=A(0);function Gd(e,t){e=fl,E(qa,e),E(Li,t),fl=e|t.baseLanes}function Qu(){E(qa,fl),E(Li,Li.current)}function Xu(){fl=qa.current,X(Li),X(qa)}var yn=A(null),Rn=null;function Cl(e){var t=e.alternate;E(_t,_t.current&1),E(yn,e),Rn===null&&(t===null||Li.current!==null||t.memoizedState!==null)&&(Rn=e)}function $u(e){E(_t,_t.current),E(yn,e),Rn===null&&(Rn=e)}function Vd(e){e.tag===22?(E(_t,_t.current),E(yn,e),Rn===null&&(Rn=e)):El()}function El(){E(_t,_t.current),E(yn,yn.current)}function bn(e){X(yn),Rn===e&&(Rn=null),X(_t)}var _t=A(0);function Ha(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||ec(l)||tc(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ll=0,Ge=null,mt=null,Ut=null,Ia=!1,Ui=!1,ii=!1,Ya=0,Nr=0,Bi=null,fx=0;function Rt(){throw Error(s(321))}function Zu(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!pn(e[l],t[l]))return!1;return!0}function Ku(e,t,l,a,f,h){return ll=h,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,C.H=e===null||e.memoizedState===null?Nh:co,ii=!1,h=l(a,f),ii=!1,Ui&&(h=Xd(t,l,a,f)),Qd(e),h}function Qd(e){C.H=zr;var t=mt!==null&&mt.next!==null;if(ll=0,Ut=mt=Ge=null,Ia=!1,Nr=0,Bi=null,t)throw Error(s(300));e===null||Bt||(e=e.dependencies,e!==null&&Da(e)&&(Bt=!0))}function Xd(e,t,l,a){Ge=e;var f=0;do{if(Ui&&(Bi=null),Nr=0,Ui=!1,25<=f)throw Error(s(301));if(f+=1,Ut=mt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}C.H=Th,h=t(l,a)}while(Ui);return h}function dx(){var e=C.H,t=e.useState()[0];return t=typeof t.then=="function"?Tr(t):t,e=e.useState()[0],(mt!==null?mt.memoizedState:null)!==e&&(Ge.flags|=1024),t}function Fu(){var e=Ya!==0;return Ya=0,e}function Ju(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Pu(e){if(Ia){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ia=!1}ll=0,Ut=mt=Ge=null,Ui=!1,Nr=Ya=0,Bi=null}function nn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?Ge.memoizedState=Ut=e:Ut=Ut.next=e,Ut}function Ot(){if(mt===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=mt.next;var t=Ut===null?Ge.memoizedState:Ut.next;if(t!==null)Ut=t,mt=e;else{if(e===null)throw Ge.alternate===null?Error(s(467)):Error(s(310));mt=e,e={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},Ut===null?Ge.memoizedState=Ut=e:Ut=Ut.next=e}return Ut}function Ga(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tr(e){var t=Nr;return Nr+=1,Bi===null&&(Bi=[]),e=Ld(Bi,e,t),t=Ge,(Ut===null?t.memoizedState:Ut.next)===null&&(t=t.alternate,C.H=t===null||t.memoizedState===null?Nh:co),e}function Va(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Tr(e);if(e.$$typeof===U)return $t(e)}throw Error(s(438,String(e)))}function Wu(e){var t=null,l=Ge.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var a=Ge.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(f){return f.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=Ga(),Ge.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),a=0;a<e;a++)l[a]=T;return t.index++,l}function il(e,t){return typeof t=="function"?t(e):t}function Qa(e){var t=Ot();return eo(t,mt,e)}function eo(e,t,l){var a=e.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=l;var f=e.baseQueue,h=a.pending;if(h!==null){if(f!==null){var x=f.next;f.next=h.next,h.next=x}t.baseQueue=f=h,a.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{t=f.next;var w=x=null,M=null,K=t,se=!1;do{var de=K.lane&-536870913;if(de!==K.lane?(Je&de)===de:(ll&de)===de){var P=K.revertLane;if(P===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),de===Di&&(se=!0);else if((ll&P)===P){K=K.next,P===Di&&(se=!0);continue}else de={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},M===null?(w=M=de,x=h):M=M.next=de,Ge.lanes|=P,Al|=P;de=K.action,ii&&l(h,de),h=K.hasEagerState?K.eagerState:l(h,de)}else P={lane:de,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},M===null?(w=M=P,x=h):M=M.next=P,Ge.lanes|=de,Al|=de;K=K.next}while(K!==null&&K!==t);if(M===null?x=h:M.next=w,!pn(h,e.memoizedState)&&(Bt=!0,se&&(l=_i,l!==null)))throw l;e.memoizedState=h,e.baseState=x,e.baseQueue=M,a.lastRenderedState=h}return f===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function to(e){var t=Ot(),l=t.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=e;var a=l.dispatch,f=l.pending,h=t.memoizedState;if(f!==null){l.pending=null;var x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);pn(h,t.memoizedState)||(Bt=!0),t.memoizedState=h,t.baseQueue===null&&(t.baseState=h),l.lastRenderedState=h}return[h,a]}function $d(e,t,l){var a=Ge,f=Ot(),h=We;if(h){if(l===void 0)throw Error(s(407));l=l()}else l=t();var x=!pn((mt||f).memoizedState,l);if(x&&(f.memoizedState=l,Bt=!0),f=f.queue,io(Fd.bind(null,a,f,e),[e]),f.getSnapshot!==t||x||Ut!==null&&Ut.memoizedState.tag&1){if(a.flags|=2048,qi(9,{destroy:void 0},Kd.bind(null,a,f,l,t),null),bt===null)throw Error(s(349));h||(ll&127)!==0||Zd(a,t,l)}return l}function Zd(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Ge.updateQueue,t===null?(t=Ga(),Ge.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Kd(e,t,l,a){t.value=l,t.getSnapshot=a,Jd(t)&&Pd(e)}function Fd(e,t,l){return l(function(){Jd(t)&&Pd(e)})}function Jd(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!pn(e,l)}catch{return!0}}function Pd(e){var t=Kl(e,2);t!==null&&fn(t,e,2)}function no(e){var t=nn();if(typeof e=="function"){var l=e;if(e=l(),ii){ht(!0);try{l()}finally{ht(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:il,lastRenderedState:e},t}function Wd(e,t,l,a){return e.baseState=l,eo(e,mt,typeof a=="function"?a:il)}function hx(e,t,l,a,f){if(Za(e))throw Error(s(485));if(e=t.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};C.T!==null?l(!0):h.isTransition=!1,a(h),l=t.pending,l===null?(h.next=t.pending=h,eh(t,h)):(h.next=l.next,t.pending=l.next=h)}}function eh(e,t){var l=t.action,a=t.payload,f=e.state;if(t.isTransition){var h=C.T,x={};C.T=x;try{var w=l(f,a),M=C.S;M!==null&&M(x,w),th(e,t,w)}catch(K){lo(e,t,K)}finally{h!==null&&x.types!==null&&(h.types=x.types),C.T=h}}else try{h=l(f,a),th(e,t,h)}catch(K){lo(e,t,K)}}function th(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(a){nh(e,t,a)},function(a){return lo(e,t,a)}):nh(e,t,l)}function nh(e,t,l){t.status="fulfilled",t.value=l,lh(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,eh(e,l)))}function lo(e,t,l){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=l,lh(t),t=t.next;while(t!==a)}e.action=null}function lh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ih(e,t){return t}function rh(e,t){if(We){var l=bt.formState;if(l!==null){e:{var a=Ge;if(We){if(Ct){t:{for(var f=Ct,h=zn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Dn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){Ct=Dn(f.nextSibling),a=f.data==="F!";break e}}vl(a)}a=!1}a&&(t=l[0])}}return l=nn(),l.memoizedState=l.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ih,lastRenderedState:t},l.queue=a,l=wh.bind(null,Ge,a),a.dispatch=l,a=no(!1),h=oo.bind(null,Ge,!1,a.queue),a=nn(),f={state:t,dispatch:null,action:e,pending:null},a.queue=f,l=hx.bind(null,Ge,f,h,l),f.dispatch=l,a.memoizedState=e,[t,l,!1]}function ah(e){var t=Ot();return sh(t,mt,e)}function sh(e,t,l){if(t=eo(e,t,ih)[0],e=Qa(il)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Tr(t)}catch(x){throw x===Oi?Ma:x}else a=t;t=Ot();var f=t.queue,h=f.dispatch;return l!==t.memoizedState&&(Ge.flags|=2048,qi(9,{destroy:void 0},mx.bind(null,f,l),null)),[a,h,e]}function mx(e,t){e.action=t}function uh(e){var t=Ot(),l=mt;if(l!==null)return sh(t,l,e);Ot(),t=t.memoizedState,l=Ot();var a=l.queue.dispatch;return l.memoizedState=e,[t,a,!1]}function qi(e,t,l,a){return e={tag:e,create:l,deps:a,inst:t,next:null},t=Ge.updateQueue,t===null&&(t=Ga(),Ge.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(a=l.next,l.next=e,e.next=a,t.lastEffect=e),e}function oh(){return Ot().memoizedState}function Xa(e,t,l,a){var f=nn();Ge.flags|=e,f.memoizedState=qi(1|t,{destroy:void 0},l,a===void 0?null:a)}function $a(e,t,l,a){var f=Ot();a=a===void 0?null:a;var h=f.memoizedState.inst;mt!==null&&a!==null&&Zu(a,mt.memoizedState.deps)?f.memoizedState=qi(t,h,l,a):(Ge.flags|=e,f.memoizedState=qi(1|t,h,l,a))}function ch(e,t){Xa(8390656,8,e,t)}function io(e,t){$a(2048,8,e,t)}function px(e){Ge.flags|=4;var t=Ge.updateQueue;if(t===null)t=Ga(),Ge.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function fh(e){var t=Ot().memoizedState;return px({ref:t,nextImpl:e}),function(){if((rt&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function dh(e,t){return $a(4,2,e,t)}function hh(e,t){return $a(4,4,e,t)}function mh(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ph(e,t,l){l=l!=null?l.concat([e]):null,$a(4,4,mh.bind(null,t,e),l)}function ro(){}function gh(e,t){var l=Ot();t=t===void 0?null:t;var a=l.memoizedState;return t!==null&&Zu(t,a[1])?a[0]:(l.memoizedState=[e,t],e)}function yh(e,t){var l=Ot();t=t===void 0?null:t;var a=l.memoizedState;if(t!==null&&Zu(t,a[1]))return a[0];if(a=e(),ii){ht(!0);try{e()}finally{ht(!1)}}return l.memoizedState=[a,t],a}function ao(e,t,l){return l===void 0||(ll&1073741824)!==0&&(Je&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=bm(),Ge.lanes|=e,Al|=e,l)}function bh(e,t,l,a){return pn(l,t)?l:Li.current!==null?(e=ao(e,l,a),pn(e,t)||(Bt=!0),e):(ll&42)===0||(ll&1073741824)!==0&&(Je&261930)===0?(Bt=!0,e.memoizedState=l):(e=bm(),Ge.lanes|=e,Al|=e,t)}function xh(e,t,l,a,f){var h=Y.p;Y.p=h!==0&&8>h?h:8;var x=C.T,w={};C.T=w,oo(e,!1,t,l);try{var M=f(),K=C.S;if(K!==null&&K(w,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var se=cx(M,a);Ar(e,t,se,Sn(e))}else Ar(e,t,a,Sn(e))}catch(de){Ar(e,t,{then:function(){},status:"rejected",reason:de},Sn())}finally{Y.p=h,x!==null&&w.types!==null&&(x.types=w.types),C.T=x}}function gx(){}function so(e,t,l,a){if(e.tag!==5)throw Error(s(476));var f=vh(e).queue;xh(e,f,t,fe,l===null?gx:function(){return Sh(e),l(a)})}function vh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:il,lastRenderedState:fe},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:il,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Sh(e){var t=vh(e);t.next===null&&(t=e.alternate.memoizedState),Ar(e,t.next.queue,{},Sn())}function uo(){return $t(Xr)}function jh(){return Ot().memoizedState}function kh(){return Ot().memoizedState}function yx(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Sn();e=kl(l);var a=wl(t,e,l);a!==null&&(fn(a,t,l),wr(a,t,l)),t={cache:Uu()},e.payload=t;return}t=t.return}}function bx(e,t,l){var a=Sn();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Za(e)?Ch(t,l):(l=Eu(e,t,l,a),l!==null&&(fn(l,e,a),Eh(l,t,a)))}function wh(e,t,l){var a=Sn();Ar(e,t,l,a)}function Ar(e,t,l,a){var f={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Za(e))Ch(t,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=t.lastRenderedReducer,h!==null))try{var x=t.lastRenderedState,w=h(x,l);if(f.hasEagerState=!0,f.eagerState=w,pn(w,x))return Ta(e,t,f,0),bt===null&&Na(),!1}catch{}if(l=Eu(e,t,f,a),l!==null)return fn(l,e,a),Eh(l,t,a),!0}return!1}function oo(e,t,l,a){if(a={lane:2,revertLane:Yo(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Za(e)){if(t)throw Error(s(479))}else t=Eu(e,l,a,2),t!==null&&fn(t,e,2)}function Za(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Ch(e,t){Ui=Ia=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Eh(e,t,l){if((l&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,Mn(e,l)}}var zr={readContext:$t,use:Va,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};zr.useEffectEvent=Rt;var Nh={readContext:$t,use:Va,useCallback:function(e,t){return nn().memoizedState=[e,t===void 0?null:t],e},useContext:$t,useEffect:ch,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Xa(4194308,4,mh.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Xa(4194308,4,e,t)},useInsertionEffect:function(e,t){Xa(4,2,e,t)},useMemo:function(e,t){var l=nn();t=t===void 0?null:t;var a=e();if(ii){ht(!0);try{e()}finally{ht(!1)}}return l.memoizedState=[a,t],a},useReducer:function(e,t,l){var a=nn();if(l!==void 0){var f=l(t);if(ii){ht(!0);try{l(t)}finally{ht(!1)}}}else f=t;return a.memoizedState=a.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},a.queue=e,e=e.dispatch=bx.bind(null,Ge,e),[a.memoizedState,e]},useRef:function(e){var t=nn();return e={current:e},t.memoizedState=e},useState:function(e){e=no(e);var t=e.queue,l=wh.bind(null,Ge,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:ro,useDeferredValue:function(e,t){var l=nn();return ao(l,e,t)},useTransition:function(){var e=no(!1);return e=xh.bind(null,Ge,e.queue,!0,!1),nn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var a=Ge,f=nn();if(We){if(l===void 0)throw Error(s(407));l=l()}else{if(l=t(),bt===null)throw Error(s(349));(Je&127)!==0||Zd(a,t,l)}f.memoizedState=l;var h={value:l,getSnapshot:t};return f.queue=h,ch(Fd.bind(null,a,h,e),[e]),a.flags|=2048,qi(9,{destroy:void 0},Kd.bind(null,a,h,l,t),null),l},useId:function(){var e=nn(),t=bt.identifierPrefix;if(We){var l=Vn,a=Gn;l=(a&~(1<<32-$e(a)-1)).toString(32)+l,t="_"+t+"R_"+l,l=Ya++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=fx++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:uo,useFormState:rh,useActionState:rh,useOptimistic:function(e){var t=nn();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=oo.bind(null,Ge,!0,l),l.dispatch=t,[e,t]},useMemoCache:Wu,useCacheRefresh:function(){return nn().memoizedState=yx.bind(null,Ge)},useEffectEvent:function(e){var t=nn(),l={impl:e};return t.memoizedState=l,function(){if((rt&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},co={readContext:$t,use:Va,useCallback:gh,useContext:$t,useEffect:io,useImperativeHandle:ph,useInsertionEffect:dh,useLayoutEffect:hh,useMemo:yh,useReducer:Qa,useRef:oh,useState:function(){return Qa(il)},useDebugValue:ro,useDeferredValue:function(e,t){var l=Ot();return bh(l,mt.memoizedState,e,t)},useTransition:function(){var e=Qa(il)[0],t=Ot().memoizedState;return[typeof e=="boolean"?e:Tr(e),t]},useSyncExternalStore:$d,useId:jh,useHostTransitionStatus:uo,useFormState:ah,useActionState:ah,useOptimistic:function(e,t){var l=Ot();return Wd(l,mt,e,t)},useMemoCache:Wu,useCacheRefresh:kh};co.useEffectEvent=fh;var Th={readContext:$t,use:Va,useCallback:gh,useContext:$t,useEffect:io,useImperativeHandle:ph,useInsertionEffect:dh,useLayoutEffect:hh,useMemo:yh,useReducer:to,useRef:oh,useState:function(){return to(il)},useDebugValue:ro,useDeferredValue:function(e,t){var l=Ot();return mt===null?ao(l,e,t):bh(l,mt.memoizedState,e,t)},useTransition:function(){var e=to(il)[0],t=Ot().memoizedState;return[typeof e=="boolean"?e:Tr(e),t]},useSyncExternalStore:$d,useId:jh,useHostTransitionStatus:uo,useFormState:uh,useActionState:uh,useOptimistic:function(e,t){var l=Ot();return mt!==null?Wd(l,mt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Wu,useCacheRefresh:kh};Th.useEffectEvent=fh;function fo(e,t,l,a){t=e.memoizedState,l=l(a,t),l=l==null?t:y({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var ho={enqueueSetState:function(e,t,l){e=e._reactInternals;var a=Sn(),f=kl(a);f.payload=t,l!=null&&(f.callback=l),t=wl(e,f,a),t!==null&&(fn(t,e,a),wr(t,e,a))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var a=Sn(),f=kl(a);f.tag=1,f.payload=t,l!=null&&(f.callback=l),t=wl(e,f,a),t!==null&&(fn(t,e,a),wr(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Sn(),a=kl(l);a.tag=2,t!=null&&(a.callback=t),t=wl(e,a,l),t!==null&&(fn(t,e,l),wr(t,e,l))}};function Ah(e,t,l,a,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,h,x):t.prototype&&t.prototype.isPureReactComponent?!gr(l,a)||!gr(f,h):!0}function zh(e,t,l,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,a),t.state!==e&&ho.enqueueReplaceState(t,t.state,null)}function ri(e,t){var l=t;if("ref"in t){l={};for(var a in t)a!=="ref"&&(l[a]=t[a])}if(e=e.defaultProps){l===t&&(l=y({},l));for(var f in e)l[f]===void 0&&(l[f]=e[f])}return l}function Rh(e){Ea(e)}function Dh(e){console.error(e)}function _h(e){Ea(e)}function Ka(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Oh(e,t,l){try{var a=e.onCaughtError;a(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function mo(e,t,l){return l=kl(l),l.tag=3,l.payload={element:null},l.callback=function(){Ka(e,t)},l}function Mh(e){return e=kl(e),e.tag=3,e}function Lh(e,t,l,a){var f=l.type.getDerivedStateFromError;if(typeof f=="function"){var h=a.value;e.payload=function(){return f(h)},e.callback=function(){Oh(t,l,a)}}var x=l.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Oh(t,l,a),typeof f!="function"&&(zl===null?zl=new Set([this]):zl.add(this));var w=a.stack;this.componentDidCatch(a.value,{componentStack:w!==null?w:""})})}function xx(e,t,l,a,f){if(l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=l.alternate,t!==null&&Ri(t,l,f,!0),l=yn.current,l!==null){switch(l.tag){case 31:case 13:return Rn===null?ss():l.alternate===null&&Dt===0&&(Dt=3),l.flags&=-257,l.flags|=65536,l.lanes=f,a===La?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([a]):t.add(a),qo(e,a,f)),!1;case 22:return l.flags|=65536,a===La?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([a]):l.add(a)),qo(e,a,f)),!1}throw Error(s(435,l.tag))}return qo(e,a,f),ss(),!1}if(We)return t=yn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=f,a!==Du&&(e=Error(s(422),{cause:a}),xr(Nn(e,l)))):(a!==Du&&(t=Error(s(423),{cause:a}),xr(Nn(t,l))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,a=Nn(a,l),f=mo(e.stateNode,a,f),Gu(e,f),Dt!==4&&(Dt=2)),!1;var h=Error(s(520),{cause:a});if(h=Nn(h,l),Br===null?Br=[h]:Br.push(h),Dt!==4&&(Dt=2),t===null)return!0;a=Nn(a,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=f&-f,l.lanes|=e,e=mo(l.stateNode,a,e),Gu(l,e),!1;case 1:if(t=l.type,h=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(zl===null||!zl.has(h))))return l.flags|=65536,f&=-f,l.lanes|=f,f=Mh(f),Lh(f,e,l,a),Gu(l,f),!1}l=l.return}while(l!==null);return!1}var po=Error(s(461)),Bt=!1;function Zt(e,t,l,a){t.child=e===null?Hd(t,null,l,a):li(t,e.child,l,a)}function Uh(e,t,l,a,f){l=l.render;var h=t.ref;if("ref"in a){var x={};for(var w in a)w!=="ref"&&(x[w]=a[w])}else x=a;return Wl(t),a=Ku(e,t,l,x,h,f),w=Fu(),e!==null&&!Bt?(Ju(e,t,f),rl(e,t,f)):(We&&w&&zu(t),t.flags|=1,Zt(e,t,a,f),t.child)}function Bh(e,t,l,a,f){if(e===null){var h=l.type;return typeof h=="function"&&!Nu(h)&&h.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=h,qh(e,t,h,a,f)):(e=za(l.type,null,a,t,t.mode,f),e.ref=t.ref,e.return=t,t.child=e)}if(h=e.child,!ko(e,f)){var x=h.memoizedProps;if(l=l.compare,l=l!==null?l:gr,l(x,a)&&e.ref===t.ref)return rl(e,t,f)}return t.flags|=1,e=Wn(h,a),e.ref=t.ref,e.return=t,t.child=e}function qh(e,t,l,a,f){if(e!==null){var h=e.memoizedProps;if(gr(h,a)&&e.ref===t.ref)if(Bt=!1,t.pendingProps=a=h,ko(e,f))(e.flags&131072)!==0&&(Bt=!0);else return t.lanes=e.lanes,rl(e,t,f)}return go(e,t,l,a,f)}function Hh(e,t,l,a){var f=a.children,h=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(h=h!==null?h.baseLanes|l:l,e!==null){for(a=t.child=e.child,f=0;a!==null;)f=f|a.lanes|a.childLanes,a=a.sibling;a=f&~h}else a=0,t.child=null;return Ih(e,t,h,l,a)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Oa(t,h!==null?h.cachePool:null),h!==null?Gd(t,h):Qu(),Vd(t);else return a=t.lanes=536870912,Ih(e,t,h!==null?h.baseLanes|l:l,l,a)}else h!==null?(Oa(t,h.cachePool),Gd(t,h),El(),t.memoizedState=null):(e!==null&&Oa(t,null),Qu(),El());return Zt(e,t,f,l),t.child}function Rr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ih(e,t,l,a,f){var h=qu();return h=h===null?null:{parent:Lt._currentValue,pool:h},t.memoizedState={baseLanes:l,cachePool:h},e!==null&&Oa(t,null),Qu(),Vd(t),e!==null&&Ri(e,t,a,!0),t.childLanes=f,null}function Fa(e,t){return t=Pa({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Yh(e,t,l){return li(t,e.child,null,l),e=Fa(t,t.pendingProps),e.flags|=2,bn(t),t.memoizedState=null,e}function vx(e,t,l){var a=t.pendingProps,f=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(We){if(a.mode==="hidden")return e=Fa(t,a),t.lanes=536870912,Rr(null,e);if($u(t),(e=Ct)?(e=ep(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bl!==null?{id:Gn,overflow:Vn}:null,retryLane:536870912,hydrationErrors:null},l=Cd(e),l.return=t,t.child=l,Xt=t,Ct=null)):e=null,e===null)throw vl(t);return t.lanes=536870912,null}return Fa(t,a)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if($u(t),f)if(t.flags&256)t.flags&=-257,t=Yh(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(Bt||Ri(e,t,l,!1),f=(l&e.childLanes)!==0,Bt||f){if(a=bt,a!==null&&(x=pl(a,l),x!==0&&x!==h.retryLane))throw h.retryLane=x,Kl(e,x),fn(a,e,x),po;ss(),t=Yh(e,t,l)}else e=h.treeContext,Ct=Dn(x.nextSibling),Xt=t,We=!0,xl=null,zn=!1,e!==null&&Td(t,e),t=Fa(t,a),t.flags|=4096;return t}return e=Wn(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ja(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function go(e,t,l,a,f){return Wl(t),l=Ku(e,t,l,a,void 0,f),a=Fu(),e!==null&&!Bt?(Ju(e,t,f),rl(e,t,f)):(We&&a&&zu(t),t.flags|=1,Zt(e,t,l,f),t.child)}function Gh(e,t,l,a,f,h){return Wl(t),t.updateQueue=null,l=Xd(t,a,l,f),Qd(e),a=Fu(),e!==null&&!Bt?(Ju(e,t,h),rl(e,t,h)):(We&&a&&zu(t),t.flags|=1,Zt(e,t,l,h),t.child)}function Vh(e,t,l,a,f){if(Wl(t),t.stateNode===null){var h=Ni,x=l.contextType;typeof x=="object"&&x!==null&&(h=$t(x)),h=new l(a,h),t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=ho,t.stateNode=h,h._reactInternals=t,h=t.stateNode,h.props=a,h.state=t.memoizedState,h.refs={},Iu(t),x=l.contextType,h.context=typeof x=="object"&&x!==null?$t(x):Ni,h.state=t.memoizedState,x=l.getDerivedStateFromProps,typeof x=="function"&&(fo(t,l,x,a),h.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&ho.enqueueReplaceState(h,h.state,null),Er(t,a,h,f),Cr(),h.state=t.memoizedState),typeof h.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){h=t.stateNode;var w=t.memoizedProps,M=ri(l,w);h.props=M;var K=h.context,se=l.contextType;x=Ni,typeof se=="object"&&se!==null&&(x=$t(se));var de=l.getDerivedStateFromProps;se=typeof de=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,se||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||K!==x)&&zh(t,h,a,x),jl=!1;var P=t.memoizedState;h.state=P,Er(t,a,h,f),Cr(),K=t.memoizedState,w||P!==K||jl?(typeof de=="function"&&(fo(t,l,de,a),K=t.memoizedState),(M=jl||Ah(t,l,M,a,P,K,x))?(se||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=K),h.props=a,h.state=K,h.context=x,a=M):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{h=t.stateNode,Yu(e,t),x=t.memoizedProps,se=ri(l,x),h.props=se,de=t.pendingProps,P=h.context,K=l.contextType,M=Ni,typeof K=="object"&&K!==null&&(M=$t(K)),w=l.getDerivedStateFromProps,(K=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==de||P!==M)&&zh(t,h,a,M),jl=!1,P=t.memoizedState,h.state=P,Er(t,a,h,f),Cr();var ne=t.memoizedState;x!==de||P!==ne||jl||e!==null&&e.dependencies!==null&&Da(e.dependencies)?(typeof w=="function"&&(fo(t,l,w,a),ne=t.memoizedState),(se=jl||Ah(t,l,se,a,P,ne,M)||e!==null&&e.dependencies!==null&&Da(e.dependencies))?(K||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(a,ne,M),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(a,ne,M)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&P===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=ne),h.props=a,h.state=ne,h.context=M,a=se):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&P===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),a=!1)}return h=a,Ja(e,t),a=(t.flags&128)!==0,h||a?(h=t.stateNode,l=a&&typeof l.getDerivedStateFromError!="function"?null:h.render(),t.flags|=1,e!==null&&a?(t.child=li(t,e.child,null,f),t.child=li(t,null,l,f)):Zt(e,t,l,f),t.memoizedState=h.state,e=t.child):e=rl(e,t,f),e}function Qh(e,t,l,a){return Jl(),t.flags|=256,Zt(e,t,l,a),t.child}var yo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bo(e){return{baseLanes:e,cachePool:Od()}}function xo(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function Xh(e,t,l){var a=t.pendingProps,f=!1,h=(t.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(_t.current&2)!==0),x&&(f=!0,t.flags&=-129),x=(t.flags&32)!==0,t.flags&=-33,e===null){if(We){if(f?Cl(t):El(),(e=Ct)?(e=ep(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bl!==null?{id:Gn,overflow:Vn}:null,retryLane:536870912,hydrationErrors:null},l=Cd(e),l.return=t,t.child=l,Xt=t,Ct=null)):e=null,e===null)throw vl(t);return tc(e)?t.lanes=32:t.lanes=536870912,null}var w=a.children;return a=a.fallback,f?(El(),f=t.mode,w=Pa({mode:"hidden",children:w},f),a=Fl(a,f,l,null),w.return=t,a.return=t,w.sibling=a,t.child=w,a=t.child,a.memoizedState=bo(l),a.childLanes=xo(e,x,l),t.memoizedState=yo,Rr(null,a)):(Cl(t),vo(t,w))}var M=e.memoizedState;if(M!==null&&(w=M.dehydrated,w!==null)){if(h)t.flags&256?(Cl(t),t.flags&=-257,t=So(e,t,l)):t.memoizedState!==null?(El(),t.child=e.child,t.flags|=128,t=null):(El(),w=a.fallback,f=t.mode,a=Pa({mode:"visible",children:a.children},f),w=Fl(w,f,l,null),w.flags|=2,a.return=t,w.return=t,a.sibling=w,t.child=a,li(t,e.child,null,l),a=t.child,a.memoizedState=bo(l),a.childLanes=xo(e,x,l),t.memoizedState=yo,t=Rr(null,a));else if(Cl(t),tc(w)){if(x=w.nextSibling&&w.nextSibling.dataset,x)var K=x.dgst;x=K,a=Error(s(419)),a.stack="",a.digest=x,xr({value:a,source:null,stack:null}),t=So(e,t,l)}else if(Bt||Ri(e,t,l,!1),x=(l&e.childLanes)!==0,Bt||x){if(x=bt,x!==null&&(a=pl(x,l),a!==0&&a!==M.retryLane))throw M.retryLane=a,Kl(e,a),fn(x,e,a),po;ec(w)||ss(),t=So(e,t,l)}else ec(w)?(t.flags|=192,t.child=e.child,t=null):(e=M.treeContext,Ct=Dn(w.nextSibling),Xt=t,We=!0,xl=null,zn=!1,e!==null&&Td(t,e),t=vo(t,a.children),t.flags|=4096);return t}return f?(El(),w=a.fallback,f=t.mode,M=e.child,K=M.sibling,a=Wn(M,{mode:"hidden",children:a.children}),a.subtreeFlags=M.subtreeFlags&65011712,K!==null?w=Wn(K,w):(w=Fl(w,f,l,null),w.flags|=2),w.return=t,a.return=t,a.sibling=w,t.child=a,Rr(null,a),a=t.child,w=e.child.memoizedState,w===null?w=bo(l):(f=w.cachePool,f!==null?(M=Lt._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=Od(),w={baseLanes:w.baseLanes|l,cachePool:f}),a.memoizedState=w,a.childLanes=xo(e,x,l),t.memoizedState=yo,Rr(e.child,a)):(Cl(t),l=e.child,e=l.sibling,l=Wn(l,{mode:"visible",children:a.children}),l.return=t,l.sibling=null,e!==null&&(x=t.deletions,x===null?(t.deletions=[e],t.flags|=16):x.push(e)),t.child=l,t.memoizedState=null,l)}function vo(e,t){return t=Pa({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Pa(e,t){return e=gn(22,e,null,t),e.lanes=0,e}function So(e,t,l){return li(t,e.child,null,l),e=vo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function $h(e,t,l){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),Mu(e.return,t,l)}function jo(e,t,l,a,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:l,tailMode:f,treeForkCount:h}:(x.isBackwards=t,x.rendering=null,x.renderingStartTime=0,x.last=a,x.tail=l,x.tailMode=f,x.treeForkCount=h)}function Zh(e,t,l){var a=t.pendingProps,f=a.revealOrder,h=a.tail;a=a.children;var x=_t.current,w=(x&2)!==0;if(w?(x=x&1|2,t.flags|=128):x&=1,E(_t,x),Zt(e,t,a,l),a=We?br:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&$h(e,l,t);else if(e.tag===19)$h(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(l=t.child,f=null;l!==null;)e=l.alternate,e!==null&&Ha(e)===null&&(f=l),l=l.sibling;l=f,l===null?(f=t.child,t.child=null):(f=l.sibling,l.sibling=null),jo(t,!1,f,l,h,a);break;case"backwards":case"unstable_legacy-backwards":for(l=null,f=t.child,t.child=null;f!==null;){if(e=f.alternate,e!==null&&Ha(e)===null){t.child=f;break}e=f.sibling,f.sibling=l,l=f,f=e}jo(t,!0,l,null,h,a);break;case"together":jo(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function rl(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Al|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ri(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,l=Wn(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=Wn(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function ko(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Da(e)))}function Sx(e,t,l){switch(t.tag){case 3:ke(t,t.stateNode.containerInfo),Sl(t,Lt,e.memoizedState.cache),Jl();break;case 27:case 5:Se(t);break;case 4:ke(t,t.stateNode.containerInfo);break;case 10:Sl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$u(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(Cl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Xh(e,t,l):(Cl(t),e=rl(e,t,l),e!==null?e.sibling:null);Cl(t);break;case 19:var f=(e.flags&128)!==0;if(a=(l&t.childLanes)!==0,a||(Ri(e,t,l,!1),a=(l&t.childLanes)!==0),f){if(a)return Zh(e,t,l);t.flags|=128}if(f=t.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),E(_t,_t.current),a)break;return null;case 22:return t.lanes=0,Hh(e,t,l,t.pendingProps);case 24:Sl(t,Lt,e.memoizedState.cache)}return rl(e,t,l)}function Kh(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Bt=!0;else{if(!ko(e,l)&&(t.flags&128)===0)return Bt=!1,Sx(e,t,l);Bt=(e.flags&131072)!==0}else Bt=!1,We&&(t.flags&1048576)!==0&&Nd(t,br,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=ti(t.elementType),t.type=e,typeof e=="function")Nu(e)?(a=ri(e,a),t.tag=1,t=Vh(null,t,e,a,l)):(t.tag=0,t=go(null,t,e,a,l));else{if(e!=null){var f=e.$$typeof;if(f===F){t.tag=11,t=Uh(null,t,e,a,l);break e}else if(f===le){t.tag=14,t=Bh(null,t,e,a,l);break e}}throw t=me(e)||e,Error(s(306,t,""))}}return t;case 0:return go(e,t,t.type,t.pendingProps,l);case 1:return a=t.type,f=ri(a,t.pendingProps),Vh(e,t,a,f,l);case 3:e:{if(ke(t,t.stateNode.containerInfo),e===null)throw Error(s(387));a=t.pendingProps;var h=t.memoizedState;f=h.element,Yu(e,t),Er(t,a,null,l);var x=t.memoizedState;if(a=x.cache,Sl(t,Lt,a),a!==h.cache&&Lu(t,[Lt],l,!0),Cr(),a=x.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:x.cache},t.updateQueue.baseState=h,t.memoizedState=h,t.flags&256){t=Qh(e,t,a,l);break e}else if(a!==f){f=Nn(Error(s(424)),t),xr(f),t=Qh(e,t,a,l);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ct=Dn(e.firstChild),Xt=t,We=!0,xl=null,zn=!0,l=Hd(t,null,a,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Jl(),a===f){t=rl(e,t,l);break e}Zt(e,t,a,l)}t=t.child}return t;case 26:return Ja(e,t),e===null?(l=ap(t.type,null,t.pendingProps,null))?t.memoizedState=l:We||(l=t.type,e=t.pendingProps,a=ms($.current).createElement(l),a[Qt]=t,a[rn]=e,Kt(a,l,e),Yt(a),t.stateNode=a):t.memoizedState=ap(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Se(t),e===null&&We&&(a=t.stateNode=lp(t.type,t.pendingProps,$.current),Xt=t,zn=!0,f=Ct,Ol(t.type)?(nc=f,Ct=Dn(a.firstChild)):Ct=f),Zt(e,t,t.pendingProps.children,l),Ja(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&We&&((f=a=Ct)&&(a=Jx(a,t.type,t.pendingProps,zn),a!==null?(t.stateNode=a,Xt=t,Ct=Dn(a.firstChild),zn=!1,f=!0):f=!1),f||vl(t)),Se(t),f=t.type,h=t.pendingProps,x=e!==null?e.memoizedProps:null,a=h.children,Jo(f,h)?a=null:x!==null&&Jo(f,x)&&(t.flags|=32),t.memoizedState!==null&&(f=Ku(e,t,dx,null,null,l),Xr._currentValue=f),Ja(e,t),Zt(e,t,a,l),t.child;case 6:return e===null&&We&&((e=l=Ct)&&(l=Px(l,t.pendingProps,zn),l!==null?(t.stateNode=l,Xt=t,Ct=null,e=!0):e=!1),e||vl(t)),null;case 13:return Xh(e,t,l);case 4:return ke(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=li(t,null,a,l):Zt(e,t,a,l),t.child;case 11:return Uh(e,t,t.type,t.pendingProps,l);case 7:return Zt(e,t,t.pendingProps,l),t.child;case 8:return Zt(e,t,t.pendingProps.children,l),t.child;case 12:return Zt(e,t,t.pendingProps.children,l),t.child;case 10:return a=t.pendingProps,Sl(t,t.type,a.value),Zt(e,t,a.children,l),t.child;case 9:return f=t.type._context,a=t.pendingProps.children,Wl(t),f=$t(f),a=a(f),t.flags|=1,Zt(e,t,a,l),t.child;case 14:return Bh(e,t,t.type,t.pendingProps,l);case 15:return qh(e,t,t.type,t.pendingProps,l);case 19:return Zh(e,t,l);case 31:return vx(e,t,l);case 22:return Hh(e,t,l,t.pendingProps);case 24:return Wl(t),a=$t(Lt),e===null?(f=qu(),f===null&&(f=bt,h=Uu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=l),f=h),t.memoizedState={parent:a,cache:f},Iu(t),Sl(t,Lt,f)):((e.lanes&l)!==0&&(Yu(e,t),Er(t,null,null,l),Cr()),f=e.memoizedState,h=t.memoizedState,f.parent!==a?(f={parent:a,cache:a},t.memoizedState=f,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=f),Sl(t,Lt,a)):(a=h.cache,Sl(t,Lt,a),a!==f.cache&&Lu(t,[Lt],l,!0))),Zt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function al(e){e.flags|=4}function wo(e,t,l,a,f){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(jm())e.flags|=8192;else throw ni=La,Hu}else e.flags&=-16777217}function Fh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!fp(t))if(jm())e.flags|=8192;else throw ni=La,Hu}function Wa(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ee():536870912,e.lanes|=t,Gi|=t)}function Dr(e,t){if(!We)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var a=null;l!==null;)l.alternate!==null&&(a=l),l=l.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Et(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,a=0;if(t)for(var f=e.child;f!==null;)l|=f.lanes|f.childLanes,a|=f.subtreeFlags&65011712,a|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)l|=f.lanes|f.childLanes,a|=f.subtreeFlags,a|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=a,e.childLanes=l,t}function jx(e,t,l){var a=t.pendingProps;switch(Ru(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(t),null;case 1:return Et(t),null;case 3:return l=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),nl(Lt),Q(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(zi(t)?al(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,_u())),Et(t),null;case 26:var f=t.type,h=t.memoizedState;return e===null?(al(t),h!==null?(Et(t),Fh(t,h)):(Et(t),wo(t,f,null,a,l))):h?h!==e.memoizedState?(al(t),Et(t),Fh(t,h)):(Et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&al(t),Et(t),wo(t,f,e,a,l)),null;case 27:if(G(t),l=$.current,f=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&al(t);else{if(!a){if(t.stateNode===null)throw Error(s(166));return Et(t),null}e=ee.current,zi(t)?Ad(t):(e=lp(f,a,l),t.stateNode=e,al(t))}return Et(t),null;case 5:if(G(t),f=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&al(t);else{if(!a){if(t.stateNode===null)throw Error(s(166));return Et(t),null}if(h=ee.current,zi(t))Ad(t);else{var x=ms($.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof a.is=="string"?x.createElement("select",{is:a.is}):x.createElement("select"),a.multiple?h.multiple=!0:a.size&&(h.size=a.size);break;default:h=typeof a.is=="string"?x.createElement(f,{is:a.is}):x.createElement(f)}}h[Qt]=t,h[rn]=a;e:for(x=t.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===t)break e;for(;x.sibling===null;){if(x.return===null||x.return===t)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}t.stateNode=h;e:switch(Kt(h,f,a),f){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&al(t)}}return Et(t),wo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&al(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(s(166));if(e=$.current,zi(t)){if(e=t.stateNode,l=t.memoizedProps,a=null,f=Xt,f!==null)switch(f.tag){case 27:case 5:a=f.memoizedProps}e[Qt]=t,e=!!(e.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Xm(e.nodeValue,l)),e||vl(t,!0)}else e=ms(e).createTextNode(a),e[Qt]=t,t.stateNode=e}return Et(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(a=zi(t),l!==null){if(e===null){if(!a)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[Qt]=t}else Jl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Et(t),e=!1}else l=_u(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(bn(t),t):(bn(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Et(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=zi(t),a!==null&&a.dehydrated!==null){if(e===null){if(!f)throw Error(s(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));f[Qt]=t}else Jl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Et(t),f=!1}else f=_u(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return t.flags&256?(bn(t),t):(bn(t),null)}return bn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=a!==null,e=e!==null&&e.memoizedState!==null,l&&(a=t.child,f=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(f=a.alternate.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==f&&(a.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Wa(t,t.updateQueue),Et(t),null);case 4:return Q(),e===null&&Xo(t.stateNode.containerInfo),Et(t),null;case 10:return nl(t.type),Et(t),null;case 19:if(X(_t),a=t.memoizedState,a===null)return Et(t),null;if(f=(t.flags&128)!==0,h=a.rendering,h===null)if(f)Dr(a,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(h=Ha(e),h!==null){for(t.flags|=128,Dr(a,!1),e=h.updateQueue,t.updateQueue=e,Wa(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)wd(l,e),l=l.sibling;return E(_t,_t.current&1|2),We&&el(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ut()>is&&(t.flags|=128,f=!0,Dr(a,!1),t.lanes=4194304)}else{if(!f)if(e=Ha(h),e!==null){if(t.flags|=128,f=!0,e=e.updateQueue,t.updateQueue=e,Wa(t,e),Dr(a,!0),a.tail===null&&a.tailMode==="hidden"&&!h.alternate&&!We)return Et(t),null}else 2*ut()-a.renderingStartTime>is&&l!==536870912&&(t.flags|=128,f=!0,Dr(a,!1),t.lanes=4194304);a.isBackwards?(h.sibling=t.child,t.child=h):(e=a.last,e!==null?e.sibling=h:t.child=h,a.last=h)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ut(),e.sibling=null,l=_t.current,E(_t,f?l&1|2:l&1),We&&el(t,a.treeForkCount),e):(Et(t),null);case 22:case 23:return bn(t),Xu(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(l&536870912)!==0&&(t.flags&128)===0&&(Et(t),t.subtreeFlags&6&&(t.flags|=8192)):Et(t),l=t.updateQueue,l!==null&&Wa(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==l&&(t.flags|=2048),e!==null&&X(ei),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),nl(Lt),Et(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function kx(e,t){switch(Ru(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return nl(Lt),Q(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return G(t),null;case 31:if(t.memoizedState!==null){if(bn(t),t.alternate===null)throw Error(s(340));Jl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(bn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Jl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(_t),null;case 4:return Q(),null;case 10:return nl(t.type),null;case 22:case 23:return bn(t),Xu(),e!==null&&X(ei),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return nl(Lt),null;case 25:return null;default:return null}}function Jh(e,t){switch(Ru(t),t.tag){case 3:nl(Lt),Q();break;case 26:case 27:case 5:G(t);break;case 4:Q();break;case 31:t.memoizedState!==null&&bn(t);break;case 13:bn(t);break;case 19:X(_t);break;case 10:nl(t.type);break;case 22:case 23:bn(t),Xu(),e!==null&&X(ei);break;case 24:nl(Lt)}}function _r(e,t){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var f=a.next;l=f;do{if((l.tag&e)===e){a=void 0;var h=l.create,x=l.inst;a=h(),x.destroy=a}l=l.next}while(l!==f)}}catch(w){ft(t,t.return,w)}}function Nl(e,t,l){try{var a=t.updateQueue,f=a!==null?a.lastEffect:null;if(f!==null){var h=f.next;a=h;do{if((a.tag&e)===e){var x=a.inst,w=x.destroy;if(w!==void 0){x.destroy=void 0,f=t;var M=l,K=w;try{K()}catch(se){ft(f,M,se)}}}a=a.next}while(a!==h)}}catch(se){ft(t,t.return,se)}}function Ph(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Yd(t,l)}catch(a){ft(e,e.return,a)}}}function Wh(e,t,l){l.props=ri(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(a){ft(e,t,a)}}function Or(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof l=="function"?e.refCleanup=l(a):l.current=a}}catch(f){ft(e,t,f)}}function Qn(e,t){var l=e.ref,a=e.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(f){ft(e,t,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(f){ft(e,t,f)}else l.current=null}function em(e){var t=e.type,l=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break e;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(f){ft(e,e.return,f)}}function Co(e,t,l){try{var a=e.stateNode;Qx(a,e.type,l,t),a[rn]=t}catch(f){ft(e,e.return,f)}}function tm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ol(e.type)||e.tag===4}function Eo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||tm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ol(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function No(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=Jn));else if(a!==4&&(a===27&&Ol(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(No(e,t,l),e=e.sibling;e!==null;)No(e,t,l),e=e.sibling}function es(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(a!==4&&(a===27&&Ol(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(es(e,t,l),e=e.sibling;e!==null;)es(e,t,l),e=e.sibling}function nm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var a=e.type,f=t.attributes;f.length;)t.removeAttributeNode(f[0]);Kt(t,a,l),t[Qt]=e,t[rn]=l}catch(h){ft(e,e.return,h)}}var sl=!1,qt=!1,To=!1,lm=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function wx(e,t){if(e=e.containerInfo,Ko=Ss,e=pd(e),vu(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{l.nodeType,h.nodeType}catch{l=null;break e}var x=0,w=-1,M=-1,K=0,se=0,de=e,P=null;t:for(;;){for(var ne;de!==l||f!==0&&de.nodeType!==3||(w=x+f),de!==h||a!==0&&de.nodeType!==3||(M=x+a),de.nodeType===3&&(x+=de.nodeValue.length),(ne=de.firstChild)!==null;)P=de,de=ne;for(;;){if(de===e)break t;if(P===l&&++K===f&&(w=x),P===h&&++se===a&&(M=x),(ne=de.nextSibling)!==null)break;de=P,P=de.parentNode}de=ne}l=w===-1||M===-1?null:{start:w,end:M}}else l=null}l=l||{start:0,end:0}}else l=null;for(Fo={focusedElem:e,selectionRange:l},Ss=!1,Gt=t;Gt!==null;)if(t=Gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Gt=e;else for(;Gt!==null;){switch(t=Gt,h=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)f=e[l],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,l=t,f=h.memoizedProps,h=h.memoizedState,a=l.stateNode;try{var Te=ri(l.type,f);e=a.getSnapshotBeforeUpdate(Te,h),a.__reactInternalSnapshotBeforeUpdate=e}catch(Ue){ft(l,l.return,Ue)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Wo(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Wo(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,Gt=e;break}Gt=t.return}}function im(e,t,l){var a=l.flags;switch(l.tag){case 0:case 11:case 15:ol(e,l),a&4&&_r(5,l);break;case 1:if(ol(e,l),a&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(x){ft(l,l.return,x)}else{var f=ri(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(f,t,e.__reactInternalSnapshotBeforeUpdate)}catch(x){ft(l,l.return,x)}}a&64&&Ph(l),a&512&&Or(l,l.return);break;case 3:if(ol(e,l),a&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{Yd(e,t)}catch(x){ft(l,l.return,x)}}break;case 27:t===null&&a&4&&nm(l);case 26:case 5:ol(e,l),t===null&&a&4&&em(l),a&512&&Or(l,l.return);break;case 12:ol(e,l);break;case 31:ol(e,l),a&4&&sm(e,l);break;case 13:ol(e,l),a&4&&um(e,l),a&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=_x.bind(null,l),Wx(e,l))));break;case 22:if(a=l.memoizedState!==null||sl,!a){t=t!==null&&t.memoizedState!==null||qt,f=sl;var h=qt;sl=a,(qt=t)&&!h?cl(e,l,(l.subtreeFlags&8772)!==0):ol(e,l),sl=f,qt=h}break;case 30:break;default:ol(e,l)}}function rm(e){var t=e.alternate;t!==null&&(e.alternate=null,rm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&lu(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Tt=null,sn=!1;function ul(e,t,l){for(l=l.child;l!==null;)am(e,t,l),l=l.sibling}function am(e,t,l){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(Nt,l)}catch{}switch(l.tag){case 26:qt||Qn(l,t),ul(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:qt||Qn(l,t);var a=Tt,f=sn;Ol(l.type)&&(Tt=l.stateNode,sn=!1),ul(e,t,l),Gr(l.stateNode),Tt=a,sn=f;break;case 5:qt||Qn(l,t);case 6:if(a=Tt,f=sn,Tt=null,ul(e,t,l),Tt=a,sn=f,Tt!==null)if(sn)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(l.stateNode)}catch(h){ft(l,t,h)}else try{Tt.removeChild(l.stateNode)}catch(h){ft(l,t,h)}break;case 18:Tt!==null&&(sn?(e=Tt,Pm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Ji(e)):Pm(Tt,l.stateNode));break;case 4:a=Tt,f=sn,Tt=l.stateNode.containerInfo,sn=!0,ul(e,t,l),Tt=a,sn=f;break;case 0:case 11:case 14:case 15:Nl(2,l,t),qt||Nl(4,l,t),ul(e,t,l);break;case 1:qt||(Qn(l,t),a=l.stateNode,typeof a.componentWillUnmount=="function"&&Wh(l,t,a)),ul(e,t,l);break;case 21:ul(e,t,l);break;case 22:qt=(a=qt)||l.memoizedState!==null,ul(e,t,l),qt=a;break;default:ul(e,t,l)}}function sm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ji(e)}catch(l){ft(t,t.return,l)}}}function um(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ji(e)}catch(l){ft(t,t.return,l)}}function Cx(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new lm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new lm),t;default:throw Error(s(435,e.tag))}}function ts(e,t){var l=Cx(e);t.forEach(function(a){if(!l.has(a)){l.add(a);var f=Ox.bind(null,e,a);a.then(f,f)}})}function un(e,t){var l=t.deletions;if(l!==null)for(var a=0;a<l.length;a++){var f=l[a],h=e,x=t,w=x;e:for(;w!==null;){switch(w.tag){case 27:if(Ol(w.type)){Tt=w.stateNode,sn=!1;break e}break;case 5:Tt=w.stateNode,sn=!1;break e;case 3:case 4:Tt=w.stateNode.containerInfo,sn=!0;break e}w=w.return}if(Tt===null)throw Error(s(160));am(h,x,f),Tt=null,sn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)om(t,e),t=t.sibling}var Un=null;function om(e,t){var l=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:un(t,e),on(e),a&4&&(Nl(3,e,e.return),_r(3,e),Nl(5,e,e.return));break;case 1:un(t,e),on(e),a&512&&(qt||l===null||Qn(l,l.return)),a&64&&sl&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?a:l.concat(a))));break;case 26:var f=Un;if(un(t,e),on(e),a&512&&(qt||l===null||Qn(l,l.return)),a&4){var h=l!==null?l.memoizedState:null;if(a=e.memoizedState,l===null)if(a===null)if(e.stateNode===null){e:{a=e.type,l=e.memoizedProps,f=f.ownerDocument||f;t:switch(a){case"title":h=f.getElementsByTagName("title")[0],(!h||h[sr]||h[Qt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(a),f.head.insertBefore(h,f.querySelector("head > title"))),Kt(h,a,l),h[Qt]=e,Yt(h),a=h;break e;case"link":var x=op("link","href",f).get(a+(l.href||""));if(x){for(var w=0;w<x.length;w++)if(h=x[w],h.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&h.getAttribute("rel")===(l.rel==null?null:l.rel)&&h.getAttribute("title")===(l.title==null?null:l.title)&&h.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){x.splice(w,1);break t}}h=f.createElement(a),Kt(h,a,l),f.head.appendChild(h);break;case"meta":if(x=op("meta","content",f).get(a+(l.content||""))){for(w=0;w<x.length;w++)if(h=x[w],h.getAttribute("content")===(l.content==null?null:""+l.content)&&h.getAttribute("name")===(l.name==null?null:l.name)&&h.getAttribute("property")===(l.property==null?null:l.property)&&h.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&h.getAttribute("charset")===(l.charSet==null?null:l.charSet)){x.splice(w,1);break t}}h=f.createElement(a),Kt(h,a,l),f.head.appendChild(h);break;default:throw Error(s(468,a))}h[Qt]=e,Yt(h),a=h}e.stateNode=a}else cp(f,e.type,e.stateNode);else e.stateNode=up(f,a,e.memoizedProps);else h!==a?(h===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):h.count--,a===null?cp(f,e.type,e.stateNode):up(f,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Co(e,e.memoizedProps,l.memoizedProps)}break;case 27:un(t,e),on(e),a&512&&(qt||l===null||Qn(l,l.return)),l!==null&&a&4&&Co(e,e.memoizedProps,l.memoizedProps);break;case 5:if(un(t,e),on(e),a&512&&(qt||l===null||Qn(l,l.return)),e.flags&32){f=e.stateNode;try{vi(f,"")}catch(Te){ft(e,e.return,Te)}}a&4&&e.stateNode!=null&&(f=e.memoizedProps,Co(e,f,l!==null?l.memoizedProps:f)),a&1024&&(To=!0);break;case 6:if(un(t,e),on(e),a&4){if(e.stateNode===null)throw Error(s(162));a=e.memoizedProps,l=e.stateNode;try{l.nodeValue=a}catch(Te){ft(e,e.return,Te)}}break;case 3:if(ys=null,f=Un,Un=ps(t.containerInfo),un(t,e),Un=f,on(e),a&4&&l!==null&&l.memoizedState.isDehydrated)try{Ji(t.containerInfo)}catch(Te){ft(e,e.return,Te)}To&&(To=!1,cm(e));break;case 4:a=Un,Un=ps(e.stateNode.containerInfo),un(t,e),on(e),Un=a;break;case 12:un(t,e),on(e);break;case 31:un(t,e),on(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ts(e,a)));break;case 13:un(t,e),on(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(ls=ut()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ts(e,a)));break;case 22:f=e.memoizedState!==null;var M=l!==null&&l.memoizedState!==null,K=sl,se=qt;if(sl=K||f,qt=se||M,un(t,e),qt=se,sl=K,on(e),a&8192)e:for(t=e.stateNode,t._visibility=f?t._visibility&-2:t._visibility|1,f&&(l===null||M||sl||qt||ai(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){M=l=t;try{if(h=M.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{w=M.stateNode;var de=M.memoizedProps.style,P=de!=null&&de.hasOwnProperty("display")?de.display:null;w.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(Te){ft(M,M.return,Te)}}}else if(t.tag===6){if(l===null){M=t;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(Te){ft(M,M.return,Te)}}}else if(t.tag===18){if(l===null){M=t;try{var ne=M.stateNode;f?Wm(ne,!0):Wm(M.stateNode,!1)}catch(Te){ft(M,M.return,Te)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(l=a.retryQueue,l!==null&&(a.retryQueue=null,ts(e,l))));break;case 19:un(t,e),on(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ts(e,a)));break;case 30:break;case 21:break;default:un(t,e),on(e)}}function on(e){var t=e.flags;if(t&2){try{for(var l,a=e.return;a!==null;){if(tm(a)){l=a;break}a=a.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var f=l.stateNode,h=Eo(e);es(e,h,f);break;case 5:var x=l.stateNode;l.flags&32&&(vi(x,""),l.flags&=-33);var w=Eo(e);es(e,w,x);break;case 3:case 4:var M=l.stateNode.containerInfo,K=Eo(e);No(e,K,M);break;default:throw Error(s(161))}}catch(se){ft(e,e.return,se)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function cm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;cm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ol(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)im(e,t.alternate,t),t=t.sibling}function ai(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Nl(4,t,t.return),ai(t);break;case 1:Qn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Wh(t,t.return,l),ai(t);break;case 27:Gr(t.stateNode);case 26:case 5:Qn(t,t.return),ai(t);break;case 22:t.memoizedState===null&&ai(t);break;case 30:ai(t);break;default:ai(t)}e=e.sibling}}function cl(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,f=e,h=t,x=h.flags;switch(h.tag){case 0:case 11:case 15:cl(f,h,l),_r(4,h);break;case 1:if(cl(f,h,l),a=h,f=a.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(K){ft(a,a.return,K)}if(a=h,f=a.updateQueue,f!==null){var w=a.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)Id(M[f],w)}catch(K){ft(a,a.return,K)}}l&&x&64&&Ph(h),Or(h,h.return);break;case 27:nm(h);case 26:case 5:cl(f,h,l),l&&a===null&&x&4&&em(h),Or(h,h.return);break;case 12:cl(f,h,l);break;case 31:cl(f,h,l),l&&x&4&&sm(f,h);break;case 13:cl(f,h,l),l&&x&4&&um(f,h);break;case 22:h.memoizedState===null&&cl(f,h,l),Or(h,h.return);break;case 30:break;default:cl(f,h,l)}t=t.sibling}}function Ao(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&vr(l))}function zo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&vr(e))}function Bn(e,t,l,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)fm(e,t,l,a),t=t.sibling}function fm(e,t,l,a){var f=t.flags;switch(t.tag){case 0:case 11:case 15:Bn(e,t,l,a),f&2048&&_r(9,t);break;case 1:Bn(e,t,l,a);break;case 3:Bn(e,t,l,a),f&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&vr(e)));break;case 12:if(f&2048){Bn(e,t,l,a),e=t.stateNode;try{var h=t.memoizedProps,x=h.id,w=h.onPostCommit;typeof w=="function"&&w(x,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){ft(t,t.return,M)}}else Bn(e,t,l,a);break;case 31:Bn(e,t,l,a);break;case 13:Bn(e,t,l,a);break;case 23:break;case 22:h=t.stateNode,x=t.alternate,t.memoizedState!==null?h._visibility&2?Bn(e,t,l,a):Mr(e,t):h._visibility&2?Bn(e,t,l,a):(h._visibility|=2,Hi(e,t,l,a,(t.subtreeFlags&10256)!==0||!1)),f&2048&&Ao(x,t);break;case 24:Bn(e,t,l,a),f&2048&&zo(t.alternate,t);break;default:Bn(e,t,l,a)}}function Hi(e,t,l,a,f){for(f=f&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var h=e,x=t,w=l,M=a,K=x.flags;switch(x.tag){case 0:case 11:case 15:Hi(h,x,w,M,f),_r(8,x);break;case 23:break;case 22:var se=x.stateNode;x.memoizedState!==null?se._visibility&2?Hi(h,x,w,M,f):Mr(h,x):(se._visibility|=2,Hi(h,x,w,M,f)),f&&K&2048&&Ao(x.alternate,x);break;case 24:Hi(h,x,w,M,f),f&&K&2048&&zo(x.alternate,x);break;default:Hi(h,x,w,M,f)}t=t.sibling}}function Mr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,a=t,f=a.flags;switch(a.tag){case 22:Mr(l,a),f&2048&&Ao(a.alternate,a);break;case 24:Mr(l,a),f&2048&&zo(a.alternate,a);break;default:Mr(l,a)}t=t.sibling}}var Lr=8192;function Ii(e,t,l){if(e.subtreeFlags&Lr)for(e=e.child;e!==null;)dm(e,t,l),e=e.sibling}function dm(e,t,l){switch(e.tag){case 26:Ii(e,t,l),e.flags&Lr&&e.memoizedState!==null&&fv(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Ii(e,t,l);break;case 3:case 4:var a=Un;Un=ps(e.stateNode.containerInfo),Ii(e,t,l),Un=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=Lr,Lr=16777216,Ii(e,t,l),Lr=a):Ii(e,t,l));break;default:Ii(e,t,l)}}function hm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ur(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Gt=a,pm(a,e)}hm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)mm(e),e=e.sibling}function mm(e){switch(e.tag){case 0:case 11:case 15:Ur(e),e.flags&2048&&Nl(9,e,e.return);break;case 3:Ur(e);break;case 12:Ur(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ns(e)):Ur(e);break;default:Ur(e)}}function ns(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Gt=a,pm(a,e)}hm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Nl(8,t,t.return),ns(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ns(t));break;default:ns(t)}e=e.sibling}}function pm(e,t){for(;Gt!==null;){var l=Gt;switch(l.tag){case 0:case 11:case 15:Nl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var a=l.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:vr(l.memoizedState.cache)}if(a=l.child,a!==null)a.return=l,Gt=a;else e:for(l=e;Gt!==null;){a=Gt;var f=a.sibling,h=a.return;if(rm(a),a===l){Gt=null;break e}if(f!==null){f.return=h,Gt=f;break e}Gt=h}}}var Ex={getCacheForType:function(e){var t=$t(Lt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return $t(Lt).controller.signal}},Nx=typeof WeakMap=="function"?WeakMap:Map,rt=0,bt=null,Ze=null,Je=0,ct=0,xn=null,Tl=!1,Yi=!1,Ro=!1,fl=0,Dt=0,Al=0,si=0,Do=0,vn=0,Gi=0,Br=null,cn=null,_o=!1,ls=0,gm=0,is=1/0,rs=null,zl=null,It=0,Rl=null,Vi=null,dl=0,Oo=0,Mo=null,ym=null,qr=0,Lo=null;function Sn(){return(rt&2)!==0&&Je!==0?Je&-Je:C.T!==null?Yo():ar()}function bm(){if(vn===0)if((Je&536870912)===0||We){var e=je;je<<=1,(je&3932160)===0&&(je=262144),vn=e}else vn=536870912;return e=yn.current,e!==null&&(e.flags|=32),vn}function fn(e,t,l){(e===bt&&(ct===2||ct===9)||e.cancelPendingCommit!==null)&&(Qi(e,0),Dl(e,Je,vn,!1)),en(e,l),((rt&2)===0||e!==bt)&&(e===bt&&((rt&2)===0&&(si|=l),Dt===4&&Dl(e,Je,vn,!1)),Xn(e))}function xm(e,t,l){if((rt&6)!==0)throw Error(s(327));var a=!l&&(t&127)===0&&(t&e.expiredLanes)===0||ye(e,t),f=a?zx(e,t):Bo(e,t,!0),h=a;do{if(f===0){Yi&&!a&&Dl(e,t,0,!1);break}else{if(l=e.current.alternate,h&&!Tx(l)){f=Bo(e,t,!1),h=!1;continue}if(f===2){if(h=t,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){t=x;e:{var w=e;f=Br;var M=w.current.memoizedState.isDehydrated;if(M&&(Qi(w,x).flags|=256),x=Bo(w,x,!1),x!==2){if(Ro&&!M){w.errorRecoveryDisabledLanes|=h,si|=h,f=4;break e}h=cn,cn=f,h!==null&&(cn===null?cn=h:cn.push.apply(cn,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){Qi(e,0),Dl(e,t,0,!0);break}e:{switch(a=e,h=f,h){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:Dl(a,t,vn,!Tl);break e;case 2:cn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(f=ls+300-ut(),10<f)){if(Dl(a,t,vn,!Tl),Ne(a,0,!0)!==0)break e;dl=t,a.timeoutHandle=Fm(vm.bind(null,a,l,cn,rs,_o,t,vn,si,Gi,Tl,h,"Throttled",-0,0),f);break e}vm(a,l,cn,rs,_o,t,vn,si,Gi,Tl,h,null,-0,0)}}break}while(!0);Xn(e)}function vm(e,t,l,a,f,h,x,w,M,K,se,de,P,ne){if(e.timeoutHandle=-1,de=t.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},dm(t,h,de);var Te=(h&62914560)===h?ls-ut():(h&4194048)===h?gm-ut():0;if(Te=dv(de,Te),Te!==null){dl=h,e.cancelPendingCommit=Te(Tm.bind(null,e,t,h,l,a,f,x,w,M,se,de,null,P,ne)),Dl(e,h,x,!K);return}}Tm(e,t,h,l,a,f,x,w,M)}function Tx(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var a=0;a<l.length;a++){var f=l[a],h=f.getSnapshot;f=f.value;try{if(!pn(h(),f))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Dl(e,t,l,a){t&=~Do,t&=~si,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var f=t;0<f;){var h=31-$e(f),x=1<<h;a[h]=-1,f&=~x}l!==0&&Vl(e,l,t)}function as(){return(rt&6)===0?(Hr(0),!1):!0}function Uo(){if(Ze!==null){if(ct===0)var e=Ze.return;else e=Ze,tl=Pl=null,Pu(e),Mi=null,jr=0,e=Ze;for(;e!==null;)Jh(e.alternate,e),e=e.return;Ze=null}}function Qi(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Zx(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),dl=0,Uo(),bt=e,Ze=l=Wn(e.current,null),Je=t,ct=0,xn=null,Tl=!1,Yi=ye(e,t),Ro=!1,Gi=vn=Do=si=Al=Dt=0,cn=Br=null,_o=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var f=31-$e(a),h=1<<f;t|=e[f],a&=~h}return fl=t,Na(),l}function Sm(e,t){Ge=null,C.H=zr,t===Oi||t===Ma?(t=Ud(),ct=3):t===Hu?(t=Ud(),ct=4):ct=t===po?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,xn=t,Ze===null&&(Dt=1,Ka(e,Nn(t,e.current)))}function jm(){var e=yn.current;return e===null?!0:(Je&4194048)===Je?Rn===null:(Je&62914560)===Je||(Je&536870912)!==0?e===Rn:!1}function km(){var e=C.H;return C.H=zr,e===null?zr:e}function wm(){var e=C.A;return C.A=Ex,e}function ss(){Dt=4,Tl||(Je&4194048)!==Je&&yn.current!==null||(Yi=!0),(Al&134217727)===0&&(si&134217727)===0||bt===null||Dl(bt,Je,vn,!1)}function Bo(e,t,l){var a=rt;rt|=2;var f=km(),h=wm();(bt!==e||Je!==t)&&(rs=null,Qi(e,t)),t=!1;var x=Dt;e:do try{if(ct!==0&&Ze!==null){var w=Ze,M=xn;switch(ct){case 8:Uo(),x=6;break e;case 3:case 2:case 9:case 6:yn.current===null&&(t=!0);var K=ct;if(ct=0,xn=null,Xi(e,w,M,K),l&&Yi){x=0;break e}break;default:K=ct,ct=0,xn=null,Xi(e,w,M,K)}}Ax(),x=Dt;break}catch(se){Sm(e,se)}while(!0);return t&&e.shellSuspendCounter++,tl=Pl=null,rt=a,C.H=f,C.A=h,Ze===null&&(bt=null,Je=0,Na()),x}function Ax(){for(;Ze!==null;)Cm(Ze)}function zx(e,t){var l=rt;rt|=2;var a=km(),f=wm();bt!==e||Je!==t?(rs=null,is=ut()+500,Qi(e,t)):Yi=ye(e,t);e:do try{if(ct!==0&&Ze!==null){t=Ze;var h=xn;t:switch(ct){case 1:ct=0,xn=null,Xi(e,t,h,1);break;case 2:case 9:if(Md(h)){ct=0,xn=null,Em(t);break}t=function(){ct!==2&&ct!==9||bt!==e||(ct=7),Xn(e)},h.then(t,t);break e;case 3:ct=7;break e;case 4:ct=5;break e;case 7:Md(h)?(ct=0,xn=null,Em(t)):(ct=0,xn=null,Xi(e,t,h,7));break;case 5:var x=null;switch(Ze.tag){case 26:x=Ze.memoizedState;case 5:case 27:var w=Ze;if(x?fp(x):w.stateNode.complete){ct=0,xn=null;var M=w.sibling;if(M!==null)Ze=M;else{var K=w.return;K!==null?(Ze=K,us(K)):Ze=null}break t}}ct=0,xn=null,Xi(e,t,h,5);break;case 6:ct=0,xn=null,Xi(e,t,h,6);break;case 8:Uo(),Dt=6;break e;default:throw Error(s(462))}}Rx();break}catch(se){Sm(e,se)}while(!0);return tl=Pl=null,C.H=a,C.A=f,rt=l,Ze!==null?0:(bt=null,Je=0,Na(),Dt)}function Rx(){for(;Ze!==null&&!tt();)Cm(Ze)}function Cm(e){var t=Kh(e.alternate,e,fl);e.memoizedProps=e.pendingProps,t===null?us(e):Ze=t}function Em(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Gh(l,t,t.pendingProps,t.type,void 0,Je);break;case 11:t=Gh(l,t,t.pendingProps,t.type.render,t.ref,Je);break;case 5:Pu(t);default:Jh(l,t),t=Ze=wd(t,fl),t=Kh(l,t,fl)}e.memoizedProps=e.pendingProps,t===null?us(e):Ze=t}function Xi(e,t,l,a){tl=Pl=null,Pu(t),Mi=null,jr=0;var f=t.return;try{if(xx(e,f,t,l,Je)){Dt=1,Ka(e,Nn(l,e.current)),Ze=null;return}}catch(h){if(f!==null)throw Ze=f,h;Dt=1,Ka(e,Nn(l,e.current)),Ze=null;return}t.flags&32768?(We||a===1?e=!0:Yi||(Je&536870912)!==0?e=!1:(Tl=e=!0,(a===2||a===9||a===3||a===6)&&(a=yn.current,a!==null&&a.tag===13&&(a.flags|=16384))),Nm(t,e)):us(t)}function us(e){var t=e;do{if((t.flags&32768)!==0){Nm(t,Tl);return}e=t.return;var l=jx(t.alternate,t,fl);if(l!==null){Ze=l;return}if(t=t.sibling,t!==null){Ze=t;return}Ze=t=e}while(t!==null);Dt===0&&(Dt=5)}function Nm(e,t){do{var l=kx(e.alternate,e);if(l!==null){l.flags&=32767,Ze=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Ze=e;return}Ze=e=l}while(e!==null);Dt=6,Ze=null}function Tm(e,t,l,a,f,h,x,w,M){e.cancelPendingCommit=null;do os();while(It!==0);if((rt&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(h=t.lanes|t.childLanes,h|=Cu,Kn(e,l,h,x,w,M),e===bt&&(Ze=bt=null,Je=0),Vi=t,Rl=e,dl=l,Oo=h,Mo=f,ym=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Mx(De,function(){return _m(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=C.T,C.T=null,f=Y.p,Y.p=2,x=rt,rt|=4;try{wx(e,t,l)}finally{rt=x,Y.p=f,C.T=a}}It=1,Am(),zm(),Rm()}}function Am(){if(It===1){It=0;var e=Rl,t=Vi,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=C.T,C.T=null;var a=Y.p;Y.p=2;var f=rt;rt|=4;try{om(t,e);var h=Fo,x=pd(e.containerInfo),w=h.focusedElem,M=h.selectionRange;if(x!==w&&w&&w.ownerDocument&&md(w.ownerDocument.documentElement,w)){if(M!==null&&vu(w)){var K=M.start,se=M.end;if(se===void 0&&(se=K),"selectionStart"in w)w.selectionStart=K,w.selectionEnd=Math.min(se,w.value.length);else{var de=w.ownerDocument||document,P=de&&de.defaultView||window;if(P.getSelection){var ne=P.getSelection(),Te=w.textContent.length,Ue=Math.min(M.start,Te),gt=M.end===void 0?Ue:Math.min(M.end,Te);!ne.extend&&Ue>gt&&(x=gt,gt=Ue,Ue=x);var V=hd(w,Ue),B=hd(w,gt);if(V&&B&&(ne.rangeCount!==1||ne.anchorNode!==V.node||ne.anchorOffset!==V.offset||ne.focusNode!==B.node||ne.focusOffset!==B.offset)){var Z=de.createRange();Z.setStart(V.node,V.offset),ne.removeAllRanges(),Ue>gt?(ne.addRange(Z),ne.extend(B.node,B.offset)):(Z.setEnd(B.node,B.offset),ne.addRange(Z))}}}}for(de=[],ne=w;ne=ne.parentNode;)ne.nodeType===1&&de.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<de.length;w++){var ce=de[w];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Ss=!!Ko,Fo=Ko=null}finally{rt=f,Y.p=a,C.T=l}}e.current=t,It=2}}function zm(){if(It===2){It=0;var e=Rl,t=Vi,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=C.T,C.T=null;var a=Y.p;Y.p=2;var f=rt;rt|=4;try{im(e,t.alternate,t)}finally{rt=f,Y.p=a,C.T=l}}It=3}}function Rm(){if(It===4||It===3){It=0,Mt();var e=Rl,t=Vi,l=dl,a=ym;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?It=5:(It=0,Vi=Rl=null,Dm(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(zl=null),gl(l),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(Nt,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=C.T,f=Y.p,Y.p=2,C.T=null;try{for(var h=e.onRecoverableError,x=0;x<a.length;x++){var w=a[x];h(w.value,{componentStack:w.stack})}}finally{C.T=t,Y.p=f}}(dl&3)!==0&&os(),Xn(e),f=e.pendingLanes,(l&261930)!==0&&(f&42)!==0?e===Lo?qr++:(qr=0,Lo=e):qr=0,Hr(0)}}function Dm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,vr(t)))}function os(){return Am(),zm(),Rm(),_m()}function _m(){if(It!==5)return!1;var e=Rl,t=Oo;Oo=0;var l=gl(dl),a=C.T,f=Y.p;try{Y.p=32>l?32:l,C.T=null,l=Mo,Mo=null;var h=Rl,x=dl;if(It=0,Vi=Rl=null,dl=0,(rt&6)!==0)throw Error(s(331));var w=rt;if(rt|=4,mm(h.current),fm(h,h.current,x,l),rt=w,Hr(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Nt,h)}catch{}return!0}finally{Y.p=f,C.T=a,Dm(e,t)}}function Om(e,t,l){t=Nn(l,t),t=mo(e.stateNode,t,2),e=wl(e,t,2),e!==null&&(en(e,2),Xn(e))}function ft(e,t,l){if(e.tag===3)Om(e,e,l);else for(;t!==null;){if(t.tag===3){Om(t,e,l);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(zl===null||!zl.has(a))){e=Nn(l,e),l=Mh(2),a=wl(t,l,2),a!==null&&(Lh(l,a,t,e),en(a,2),Xn(a));break}}t=t.return}}function qo(e,t,l){var a=e.pingCache;if(a===null){a=e.pingCache=new Nx;var f=new Set;a.set(t,f)}else f=a.get(t),f===void 0&&(f=new Set,a.set(t,f));f.has(l)||(Ro=!0,f.add(l),e=Dx.bind(null,e,t,l),t.then(e,e))}function Dx(e,t,l){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,bt===e&&(Je&l)===l&&(Dt===4||Dt===3&&(Je&62914560)===Je&&300>ut()-ls?(rt&2)===0&&Qi(e,0):Do|=l,Gi===Je&&(Gi=0)),Xn(e)}function Mm(e,t){t===0&&(t=Ee()),e=Kl(e,t),e!==null&&(en(e,t),Xn(e))}function _x(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Mm(e,l)}function Ox(e,t){var l=0;switch(e.tag){case 31:case 13:var a=e.stateNode,f=e.memoizedState;f!==null&&(l=f.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(s(314))}a!==null&&a.delete(t),Mm(e,l)}function Mx(e,t){return dt(e,t)}var cs=null,$i=null,Ho=!1,fs=!1,Io=!1,_l=0;function Xn(e){e!==$i&&e.next===null&&($i===null?cs=$i=e:$i=$i.next=e),fs=!0,Ho||(Ho=!0,Ux())}function Hr(e,t){if(!Io&&fs){Io=!0;do for(var l=!1,a=cs;a!==null;){if(e!==0){var f=a.pendingLanes;if(f===0)var h=0;else{var x=a.suspendedLanes,w=a.pingedLanes;h=(1<<31-$e(42|e)+1)-1,h&=f&~(x&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(l=!0,qm(a,h))}else h=Je,h=Ne(a,a===bt?h:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(h&3)===0||ye(a,h)||(l=!0,qm(a,h));a=a.next}while(l);Io=!1}}function Lx(){Lm()}function Lm(){fs=Ho=!1;var e=0;_l!==0&&$x()&&(e=_l);for(var t=ut(),l=null,a=cs;a!==null;){var f=a.next,h=Um(a,t);h===0?(a.next=null,l===null?cs=f:l.next=f,f===null&&($i=l)):(l=a,(e!==0||(h&3)!==0)&&(fs=!0)),a=f}It!==0&&It!==5||Hr(e),_l!==0&&(_l=0)}function Um(e,t){for(var l=e.suspendedLanes,a=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-$e(h),w=1<<x,M=f[x];M===-1?((w&l)===0||(w&a)!==0)&&(f[x]=_(w,t)):M<=t&&(e.expiredLanes|=w),h&=~w}if(t=bt,l=Je,l=Ne(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,l===0||e===t&&(ct===2||ct===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&jt(a),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||ye(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(a!==null&&jt(a),gl(l)){case 2:case 8:l=pe;break;case 32:l=De;break;case 268435456:l=qe;break;default:l=De}return a=Bm.bind(null,e),l=dt(l,a),e.callbackPriority=t,e.callbackNode=l,t}return a!==null&&a!==null&&jt(a),e.callbackPriority=2,e.callbackNode=null,2}function Bm(e,t){if(It!==0&&It!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(os()&&e.callbackNode!==l)return null;var a=Je;return a=Ne(e,e===bt?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(xm(e,a,t),Um(e,ut()),e.callbackNode!=null&&e.callbackNode===l?Bm.bind(null,e):null)}function qm(e,t){if(os())return null;xm(e,t,!0)}function Ux(){Kx(function(){(rt&6)!==0?dt(ie,Lx):Lm()})}function Yo(){if(_l===0){var e=Di;e===0&&(e=J,J<<=1,(J&261888)===0&&(J=256)),_l=e}return _l}function Hm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:xa(""+e)}function Im(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Bx(e,t,l,a,f){if(t==="submit"&&l&&l.stateNode===f){var h=Hm((f[rn]||null).action),x=a.submitter;x&&(t=(t=x[rn]||null)?Hm(t.formAction):x.getAttribute("formAction"),t!==null&&(h=t,x=null));var w=new ka("action","action",null,a,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(_l!==0){var M=x?Im(f,x):new FormData(f);so(l,{pending:!0,data:M,method:f.method,action:h},null,M)}}else typeof h=="function"&&(w.preventDefault(),M=x?Im(f,x):new FormData(f),so(l,{pending:!0,data:M,method:f.method,action:h},h,M))},currentTarget:f}]})}}for(var Go=0;Go<wu.length;Go++){var Vo=wu[Go],qx=Vo.toLowerCase(),Hx=Vo[0].toUpperCase()+Vo.slice(1);Ln(qx,"on"+Hx)}Ln(bd,"onAnimationEnd"),Ln(xd,"onAnimationIteration"),Ln(vd,"onAnimationStart"),Ln("dblclick","onDoubleClick"),Ln("focusin","onFocus"),Ln("focusout","onBlur"),Ln(nx,"onTransitionRun"),Ln(lx,"onTransitionStart"),Ln(ix,"onTransitionCancel"),Ln(Sd,"onTransitionEnd"),bi("onMouseEnter",["mouseout","mouseover"]),bi("onMouseLeave",["mouseout","mouseover"]),bi("onPointerEnter",["pointerout","pointerover"]),bi("onPointerLeave",["pointerout","pointerover"]),Ql("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ql("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ql("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ql("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ql("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ql("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ir="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ix=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ir));function Ym(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var a=e[l],f=a.event;a=a.listeners;e:{var h=void 0;if(t)for(var x=a.length-1;0<=x;x--){var w=a[x],M=w.instance,K=w.currentTarget;if(w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=K;try{h(f)}catch(se){Ea(se)}f.currentTarget=null,h=M}else for(x=0;x<a.length;x++){if(w=a[x],M=w.instance,K=w.currentTarget,w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=K;try{h(f)}catch(se){Ea(se)}f.currentTarget=null,h=M}}}}function Ke(e,t){var l=t[nu];l===void 0&&(l=t[nu]=new Set);var a=e+"__bubble";l.has(a)||(Gm(t,e,2,!1),l.add(a))}function Qo(e,t,l){var a=0;t&&(a|=4),Gm(l,e,a,t)}var ds="_reactListening"+Math.random().toString(36).slice(2);function Xo(e){if(!e[ds]){e[ds]=!0,Lf.forEach(function(l){l!=="selectionchange"&&(Ix.has(l)||Qo(l,!1,e),Qo(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ds]||(t[ds]=!0,Qo("selectionchange",!1,t))}}function Gm(e,t,l,a){switch(bp(t)){case 2:var f=pv;break;case 8:f=gv;break;default:f=sc}l=f.bind(null,t,l,e),f=void 0,!fu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(f=!0),a?f!==void 0?e.addEventListener(t,l,{capture:!0,passive:f}):e.addEventListener(t,l,!0):f!==void 0?e.addEventListener(t,l,{passive:f}):e.addEventListener(t,l,!1)}function $o(e,t,l,a,f){var h=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var x=a.tag;if(x===3||x===4){var w=a.stateNode.containerInfo;if(w===f)break;if(x===4)for(x=a.return;x!==null;){var M=x.tag;if((M===3||M===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;w!==null;){if(x=pi(w),x===null)return;if(M=x.tag,M===5||M===6||M===26||M===27){a=h=x;continue e}w=w.parentNode}}a=a.return}Zf(function(){var K=h,se=ou(l),de=[];e:{var P=jd.get(e);if(P!==void 0){var ne=ka,Te=e;switch(e){case"keypress":if(Sa(l)===0)break e;case"keydown":case"keyup":ne=Ob;break;case"focusin":Te="focus",ne=pu;break;case"focusout":Te="blur",ne=pu;break;case"beforeblur":case"afterblur":ne=pu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=Jf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=jb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=Ub;break;case bd:case xd:case vd:ne=Cb;break;case Sd:ne=qb;break;case"scroll":case"scrollend":ne=vb;break;case"wheel":ne=Ib;break;case"copy":case"cut":case"paste":ne=Nb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=Wf;break;case"toggle":case"beforetoggle":ne=Gb}var Ue=(t&4)!==0,gt=!Ue&&(e==="scroll"||e==="scrollend"),V=Ue?P!==null?P+"Capture":null:P;Ue=[];for(var B=K,Z;B!==null;){var ce=B;if(Z=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Z===null||V===null||(ce=or(B,V),ce!=null&&Ue.push(Yr(B,ce,Z))),gt)break;B=B.return}0<Ue.length&&(P=new ne(P,Te,null,l,se),de.push({event:P,listeners:Ue}))}}if((t&7)===0){e:{if(P=e==="mouseover"||e==="pointerover",ne=e==="mouseout"||e==="pointerout",P&&l!==uu&&(Te=l.relatedTarget||l.fromElement)&&(pi(Te)||Te[mi]))break e;if((ne||P)&&(P=se.window===se?se:(P=se.ownerDocument)?P.defaultView||P.parentWindow:window,ne?(Te=l.relatedTarget||l.toElement,ne=K,Te=Te?pi(Te):null,Te!==null&&(gt=d(Te),Ue=Te.tag,Te!==gt||Ue!==5&&Ue!==27&&Ue!==6)&&(Te=null)):(ne=null,Te=K),ne!==Te)){if(Ue=Jf,ce="onMouseLeave",V="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Ue=Wf,ce="onPointerLeave",V="onPointerEnter",B="pointer"),gt=ne==null?P:ur(ne),Z=Te==null?P:ur(Te),P=new Ue(ce,B+"leave",ne,l,se),P.target=gt,P.relatedTarget=Z,ce=null,pi(se)===K&&(Ue=new Ue(V,B+"enter",Te,l,se),Ue.target=Z,Ue.relatedTarget=gt,ce=Ue),gt=ce,ne&&Te)t:{for(Ue=Yx,V=ne,B=Te,Z=0,ce=V;ce;ce=Ue(ce))Z++;ce=0;for(var Me=B;Me;Me=Ue(Me))ce++;for(;0<Z-ce;)V=Ue(V),Z--;for(;0<ce-Z;)B=Ue(B),ce--;for(;Z--;){if(V===B||B!==null&&V===B.alternate){Ue=V;break t}V=Ue(V),B=Ue(B)}Ue=null}else Ue=null;ne!==null&&Vm(de,P,ne,Ue,!1),Te!==null&>!==null&&Vm(de,gt,Te,Ue,!0)}}e:{if(P=K?ur(K):window,ne=P.nodeName&&P.nodeName.toLowerCase(),ne==="select"||ne==="input"&&P.type==="file")var nt=sd;else if(rd(P))if(ud)nt=Wb;else{nt=Jb;var Re=Fb}else ne=P.nodeName,!ne||ne.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?K&&su(K.elementType)&&(nt=sd):nt=Pb;if(nt&&(nt=nt(e,K))){ad(de,nt,l,se);break e}Re&&Re(e,P,K),e==="focusout"&&K&&P.type==="number"&&K.memoizedProps.value!=null&&au(P,"number",P.value)}switch(Re=K?ur(K):window,e){case"focusin":(rd(Re)||Re.contentEditable==="true")&&(wi=Re,Su=K,yr=null);break;case"focusout":yr=Su=wi=null;break;case"mousedown":ju=!0;break;case"contextmenu":case"mouseup":case"dragend":ju=!1,gd(de,l,se);break;case"selectionchange":if(tx)break;case"keydown":case"keyup":gd(de,l,se)}var Ve;if(yu)e:{switch(e){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else ki?ld(e,l)&&(Pe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Pe="onCompositionStart");Pe&&(ed&&l.locale!=="ko"&&(ki||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&ki&&(Ve=Kf()):(yl=se,du="value"in yl?yl.value:yl.textContent,ki=!0)),Re=hs(K,Pe),0<Re.length&&(Pe=new Pf(Pe,e,null,l,se),de.push({event:Pe,listeners:Re}),Ve?Pe.data=Ve:(Ve=id(l),Ve!==null&&(Pe.data=Ve)))),(Ve=Qb?Xb(e,l):$b(e,l))&&(Pe=hs(K,"onBeforeInput"),0<Pe.length&&(Re=new Pf("onBeforeInput","beforeinput",null,l,se),de.push({event:Re,listeners:Pe}),Re.data=Ve)),Bx(de,e,K,l,se)}Ym(de,t)})}function Yr(e,t,l){return{instance:e,listener:t,currentTarget:l}}function hs(e,t){for(var l=t+"Capture",a=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=or(e,l),f!=null&&a.unshift(Yr(e,f,h)),f=or(e,t),f!=null&&a.push(Yr(e,f,h))),e.tag===3)return a;e=e.return}return[]}function Yx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Vm(e,t,l,a,f){for(var h=t._reactName,x=[];l!==null&&l!==a;){var w=l,M=w.alternate,K=w.stateNode;if(w=w.tag,M!==null&&M===a)break;w!==5&&w!==26&&w!==27||K===null||(M=K,f?(K=or(l,h),K!=null&&x.unshift(Yr(l,K,M))):f||(K=or(l,h),K!=null&&x.push(Yr(l,K,M)))),l=l.return}x.length!==0&&e.push({event:t,listeners:x})}var Gx=/\r\n?/g,Vx=/\u0000|\uFFFD/g;function Qm(e){return(typeof e=="string"?e:""+e).replace(Gx,`
|
|
9
|
+
`).replace(Vx,"")}function Xm(e,t){return t=Qm(t),Qm(e)===t}function pt(e,t,l,a,f,h){switch(l){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||vi(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&vi(e,""+a);break;case"className":ya(e,"class",a);break;case"tabIndex":ya(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":ya(e,l,a);break;case"style":Xf(e,a,h);break;case"data":if(t!=="object"){ya(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=xa(""+a),e.setAttribute(l,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(l==="formAction"?(t!=="input"&&pt(e,t,"name",f.name,f,null),pt(e,t,"formEncType",f.formEncType,f,null),pt(e,t,"formMethod",f.formMethod,f,null),pt(e,t,"formTarget",f.formTarget,f,null)):(pt(e,t,"encType",f.encType,f,null),pt(e,t,"method",f.method,f,null),pt(e,t,"target",f.target,f,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=xa(""+a),e.setAttribute(l,a);break;case"onClick":a!=null&&(e.onclick=Jn);break;case"onScroll":a!=null&&Ke("scroll",e);break;case"onScrollEnd":a!=null&&Ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(s(61));if(l=a.__html,l!=null){if(f.children!=null)throw Error(s(60));e.innerHTML=l}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}l=xa(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""+a):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":a===!0?e.setAttribute(l,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(l,a):e.removeAttribute(l);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(l):e.setAttribute(l,a);break;case"popover":Ke("beforetoggle",e),Ke("toggle",e),ga(e,"popover",a);break;case"xlinkActuate":Fn(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Fn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Fn(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Fn(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Fn(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Fn(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Fn(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":ga(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=bb.get(l)||l,ga(e,l,a))}}function Zo(e,t,l,a,f,h){switch(l){case"style":Xf(e,a,h);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(s(61));if(l=a.__html,l!=null){if(f.children!=null)throw Error(s(60));e.innerHTML=l}}break;case"children":typeof a=="string"?vi(e,a):(typeof a=="number"||typeof a=="bigint")&&vi(e,""+a);break;case"onScroll":a!=null&&Ke("scroll",e);break;case"onScrollEnd":a!=null&&Ke("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Uf.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(f=l.endsWith("Capture"),t=l.slice(2,f?l.length-7:void 0),h=e[rn]||null,h=h!=null?h[l]:null,typeof h=="function"&&e.removeEventListener(t,h,f),typeof a=="function")){typeof h!="function"&&h!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,a,f);break e}l in e?e[l]=a:a===!0?e.setAttribute(l,""):ga(e,l,a)}}}function Kt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",e),Ke("load",e);var a=!1,f=!1,h;for(h in l)if(l.hasOwnProperty(h)){var x=l[h];if(x!=null)switch(h){case"src":a=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:pt(e,t,h,x,l,null)}}f&&pt(e,t,"srcSet",l.srcSet,l,null),a&&pt(e,t,"src",l.src,l,null);return;case"input":Ke("invalid",e);var w=h=x=f=null,M=null,K=null;for(a in l)if(l.hasOwnProperty(a)){var se=l[a];if(se!=null)switch(a){case"name":f=se;break;case"type":x=se;break;case"checked":M=se;break;case"defaultChecked":K=se;break;case"value":h=se;break;case"defaultValue":w=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(s(137,t));break;default:pt(e,t,a,se,l,null)}}Yf(e,h,w,M,K,x,f,!1);return;case"select":Ke("invalid",e),a=x=h=null;for(f in l)if(l.hasOwnProperty(f)&&(w=l[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":x=w;break;case"multiple":a=w;default:pt(e,t,f,w,l,null)}t=h,l=x,e.multiple=!!a,t!=null?xi(e,!!a,t,!1):l!=null&&xi(e,!!a,l,!0);return;case"textarea":Ke("invalid",e),h=f=a=null;for(x in l)if(l.hasOwnProperty(x)&&(w=l[x],w!=null))switch(x){case"value":a=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:pt(e,t,x,w,l,null)}Vf(e,a,f,h);return;case"option":for(M in l)l.hasOwnProperty(M)&&(a=l[M],a!=null)&&(M==="selected"?e.selected=a&&typeof a!="function"&&typeof a!="symbol":pt(e,t,M,a,l,null));return;case"dialog":Ke("beforetoggle",e),Ke("toggle",e),Ke("cancel",e),Ke("close",e);break;case"iframe":case"object":Ke("load",e);break;case"video":case"audio":for(a=0;a<Ir.length;a++)Ke(Ir[a],e);break;case"image":Ke("error",e),Ke("load",e);break;case"details":Ke("toggle",e);break;case"embed":case"source":case"link":Ke("error",e),Ke("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in l)if(l.hasOwnProperty(K)&&(a=l[K],a!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:pt(e,t,K,a,l,null)}return;default:if(su(t)){for(se in l)l.hasOwnProperty(se)&&(a=l[se],a!==void 0&&Zo(e,t,se,a,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(a=l[w],a!=null&&pt(e,t,w,a,l,null))}function Qx(e,t,l,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,x=null,w=null,M=null,K=null,se=null;for(ne in l){var de=l[ne];if(l.hasOwnProperty(ne)&&de!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":M=de;default:a.hasOwnProperty(ne)||pt(e,t,ne,null,a,de)}}for(var P in a){var ne=a[P];if(de=l[P],a.hasOwnProperty(P)&&(ne!=null||de!=null))switch(P){case"type":h=ne;break;case"name":f=ne;break;case"checked":K=ne;break;case"defaultChecked":se=ne;break;case"value":x=ne;break;case"defaultValue":w=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,t));break;default:ne!==de&&pt(e,t,P,ne,a,de)}}ru(e,x,w,M,K,se,h,f);return;case"select":ne=x=w=P=null;for(h in l)if(M=l[h],l.hasOwnProperty(h)&&M!=null)switch(h){case"value":break;case"multiple":ne=M;default:a.hasOwnProperty(h)||pt(e,t,h,null,a,M)}for(f in a)if(h=a[f],M=l[f],a.hasOwnProperty(f)&&(h!=null||M!=null))switch(f){case"value":P=h;break;case"defaultValue":w=h;break;case"multiple":x=h;default:h!==M&&pt(e,t,f,h,a,M)}t=w,l=x,a=ne,P!=null?xi(e,!!l,P,!1):!!a!=!!l&&(t!=null?xi(e,!!l,t,!0):xi(e,!!l,l?[]:"",!1));return;case"textarea":ne=P=null;for(w in l)if(f=l[w],l.hasOwnProperty(w)&&f!=null&&!a.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:pt(e,t,w,null,a,f)}for(x in a)if(f=a[x],h=l[x],a.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":P=f;break;case"defaultValue":ne=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(s(91));break;default:f!==h&&pt(e,t,x,f,a,h)}Gf(e,P,ne);return;case"option":for(var Te in l)P=l[Te],l.hasOwnProperty(Te)&&P!=null&&!a.hasOwnProperty(Te)&&(Te==="selected"?e.selected=!1:pt(e,t,Te,null,a,P));for(M in a)P=a[M],ne=l[M],a.hasOwnProperty(M)&&P!==ne&&(P!=null||ne!=null)&&(M==="selected"?e.selected=P&&typeof P!="function"&&typeof P!="symbol":pt(e,t,M,P,a,ne));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in l)P=l[Ue],l.hasOwnProperty(Ue)&&P!=null&&!a.hasOwnProperty(Ue)&&pt(e,t,Ue,null,a,P);for(K in a)if(P=a[K],ne=l[K],a.hasOwnProperty(K)&&P!==ne&&(P!=null||ne!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(s(137,t));break;default:pt(e,t,K,P,a,ne)}return;default:if(su(t)){for(var gt in l)P=l[gt],l.hasOwnProperty(gt)&&P!==void 0&&!a.hasOwnProperty(gt)&&Zo(e,t,gt,void 0,a,P);for(se in a)P=a[se],ne=l[se],!a.hasOwnProperty(se)||P===ne||P===void 0&&ne===void 0||Zo(e,t,se,P,a,ne);return}}for(var V in l)P=l[V],l.hasOwnProperty(V)&&P!=null&&!a.hasOwnProperty(V)&&pt(e,t,V,null,a,P);for(de in a)P=a[de],ne=l[de],!a.hasOwnProperty(de)||P===ne||P==null&&ne==null||pt(e,t,de,P,a,ne)}function $m(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Xx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),a=0;a<l.length;a++){var f=l[a],h=f.transferSize,x=f.initiatorType,w=f.duration;if(h&&w&&$m(x)){for(x=0,w=f.responseEnd,a+=1;a<l.length;a++){var M=l[a],K=M.startTime;if(K>w)break;var se=M.transferSize,de=M.initiatorType;se&&$m(de)&&(M=M.responseEnd,x+=se*(M<w?1:(w-K)/(M-K)))}if(--a,t+=8*(h+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ko=null,Fo=null;function ms(e){return e.nodeType===9?e:e.ownerDocument}function Zm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Km(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Jo(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Po=null;function $x(){var e=window.event;return e&&e.type==="popstate"?e===Po?!1:(Po=e,!0):(Po=null,!1)}var Fm=typeof setTimeout=="function"?setTimeout:void 0,Zx=typeof clearTimeout=="function"?clearTimeout:void 0,Jm=typeof Promise=="function"?Promise:void 0,Kx=typeof queueMicrotask=="function"?queueMicrotask:typeof Jm<"u"?function(e){return Jm.resolve(null).then(e).catch(Fx)}:Fm;function Fx(e){setTimeout(function(){throw e})}function Ol(e){return e==="head"}function Pm(e,t){var l=t,a=0;do{var f=l.nextSibling;if(e.removeChild(l),f&&f.nodeType===8)if(l=f.data,l==="/$"||l==="/&"){if(a===0){e.removeChild(f),Ji(t);return}a--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")a++;else if(l==="html")Gr(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Gr(l);for(var h=l.firstChild;h;){var x=h.nextSibling,w=h.nodeName;h[sr]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||l.removeChild(h),h=x}}else l==="body"&&Gr(e.ownerDocument.body);l=f}while(l);Ji(t)}function Wm(e,t){var l=e;e=0;do{var a=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),a&&a.nodeType===8)if(l=a.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=a}while(l)}function Wo(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Wo(l),lu(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Jx(e,t,l,a){for(;e.nodeType===1;){var f=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[sr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Dn(e.nextSibling),e===null)break}return null}function Px(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Dn(e.nextSibling),e===null))return null;return e}function ep(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Dn(e.nextSibling),e===null))return null;return e}function ec(e){return e.data==="$?"||e.data==="$~"}function tc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Wx(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var a=function(){t(),l.removeEventListener("DOMContentLoaded",a)};l.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function Dn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var nc=null;function tp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Dn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function np(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function lp(e,t,l){switch(t=ms(l),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function Gr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);lu(e)}var _n=new Map,ip=new Set;function ps(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var hl=Y.d;Y.d={f:ev,r:tv,D:nv,C:lv,L:iv,m:rv,X:sv,S:av,M:uv};function ev(){var e=hl.f(),t=as();return e||t}function tv(e){var t=gi(e);t!==null&&t.tag===5&&t.type==="form"?Sh(t):hl.r(e)}var Zi=typeof document>"u"?null:document;function rp(e,t,l){var a=Zi;if(a&&typeof t=="string"&&t){var f=Cn(t);f='link[rel="'+e+'"][href="'+f+'"]',typeof l=="string"&&(f+='[crossorigin="'+l+'"]'),ip.has(f)||(ip.add(f),e={rel:e,crossOrigin:l,href:t},a.querySelector(f)===null&&(t=a.createElement("link"),Kt(t,"link",e),Yt(t),a.head.appendChild(t)))}}function nv(e){hl.D(e),rp("dns-prefetch",e,null)}function lv(e,t){hl.C(e,t),rp("preconnect",e,t)}function iv(e,t,l){hl.L(e,t,l);var a=Zi;if(a&&e&&t){var f='link[rel="preload"][as="'+Cn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(f+='[imagesrcset="'+Cn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(f+='[imagesizes="'+Cn(l.imageSizes)+'"]')):f+='[href="'+Cn(e)+'"]';var h=f;switch(t){case"style":h=Ki(e);break;case"script":h=Fi(e)}_n.has(h)||(e=y({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),_n.set(h,e),a.querySelector(f)!==null||t==="style"&&a.querySelector(Vr(h))||t==="script"&&a.querySelector(Qr(h))||(t=a.createElement("link"),Kt(t,"link",e),Yt(t),a.head.appendChild(t)))}}function rv(e,t){hl.m(e,t);var l=Zi;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",f='link[rel="modulepreload"][as="'+Cn(a)+'"][href="'+Cn(e)+'"]',h=f;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Fi(e)}if(!_n.has(h)&&(e=y({rel:"modulepreload",href:e},t),_n.set(h,e),l.querySelector(f)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Qr(h)))return}a=l.createElement("link"),Kt(a,"link",e),Yt(a),l.head.appendChild(a)}}}function av(e,t,l){hl.S(e,t,l);var a=Zi;if(a&&e){var f=yi(a).hoistableStyles,h=Ki(e);t=t||"default";var x=f.get(h);if(!x){var w={loading:0,preload:null};if(x=a.querySelector(Vr(h)))w.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},l),(l=_n.get(h))&&lc(e,l);var M=x=a.createElement("link");Yt(M),Kt(M,"link",e),M._p=new Promise(function(K,se){M.onload=K,M.onerror=se}),M.addEventListener("load",function(){w.loading|=1}),M.addEventListener("error",function(){w.loading|=2}),w.loading|=4,gs(x,t,a)}x={type:"stylesheet",instance:x,count:1,state:w},f.set(h,x)}}}function sv(e,t){hl.X(e,t);var l=Zi;if(l&&e){var a=yi(l).hoistableScripts,f=Fi(e),h=a.get(f);h||(h=l.querySelector(Qr(f)),h||(e=y({src:e,async:!0},t),(t=_n.get(f))&&ic(e,t),h=l.createElement("script"),Yt(h),Kt(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},a.set(f,h))}}function uv(e,t){hl.M(e,t);var l=Zi;if(l&&e){var a=yi(l).hoistableScripts,f=Fi(e),h=a.get(f);h||(h=l.querySelector(Qr(f)),h||(e=y({src:e,async:!0,type:"module"},t),(t=_n.get(f))&&ic(e,t),h=l.createElement("script"),Yt(h),Kt(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},a.set(f,h))}}function ap(e,t,l,a){var f=(f=$.current)?ps(f):null;if(!f)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=Ki(l.href),l=yi(f).hoistableStyles,a=l.get(t),a||(a={type:"style",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Ki(l.href);var h=yi(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(Vr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),_n.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},_n.set(e,l),h||ov(f,e,l,x.state))),t&&a===null)throw Error(s(528,""));return x}if(t&&a!==null)throw Error(s(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Fi(l),l=yi(f).hoistableScripts,a=l.get(t),a||(a={type:"script",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Ki(e){return'href="'+Cn(e)+'"'}function Vr(e){return'link[rel="stylesheet"]['+e+"]"}function sp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function ov(e,t,l,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Kt(t,"link",l),Yt(t),e.head.appendChild(t))}function Fi(e){return'[src="'+Cn(e)+'"]'}function Qr(e){return"script[async]"+e}function up(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Cn(l.href)+'"]');if(a)return t.instance=a,Yt(a),a;var f=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Yt(a),Kt(a,"style",f),gs(a,l.precedence,e),t.instance=a;case"stylesheet":f=Ki(l.href);var h=e.querySelector(Vr(f));if(h)return t.state.loading|=4,t.instance=h,Yt(h),h;a=sp(l),(f=_n.get(f))&&lc(a,f),h=(e.ownerDocument||e).createElement("link"),Yt(h);var x=h;return x._p=new Promise(function(w,M){x.onload=w,x.onerror=M}),Kt(h,"link",a),t.state.loading|=4,gs(h,l.precedence,e),t.instance=h;case"script":return h=Fi(l.src),(f=e.querySelector(Qr(h)))?(t.instance=f,Yt(f),f):(a=l,(f=_n.get(h))&&(a=y({},l),ic(a,f)),e=e.ownerDocument||e,f=e.createElement("script"),Yt(f),Kt(f,"link",a),e.head.appendChild(f),t.instance=f);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,gs(a,l.precedence,e));return t.instance}function gs(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=a.length?a[a.length-1]:null,h=f,x=0;x<a.length;x++){var w=a[x];if(w.dataset.precedence===t)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function lc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ic(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ys=null;function op(e,t,l){if(ys===null){var a=new Map,f=ys=new Map;f.set(l,a)}else f=ys,a=f.get(l),a||(a=new Map,f.set(l,a));if(a.has(e))return a;for(a.set(e,null),l=l.getElementsByTagName(e),f=0;f<l.length;f++){var h=l[f];if(!(h[sr]||h[Qt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(t)||"";x=e+x;var w=a.get(x);w?w.push(h):a.set(x,[h])}}return a}function cp(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function cv(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function fp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function fv(e,t,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var f=Ki(a.href),h=t.querySelector(Vr(f));if(h){t=h._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=bs.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=h,Yt(h);return}h=t.ownerDocument||t,a=sp(a),(f=_n.get(f))&&lc(a,f),h=h.createElement("link"),Yt(h);var x=h;x._p=new Promise(function(w,M){x.onload=w,x.onerror=M}),Kt(h,"link",a),l.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=bs.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var rc=0;function dv(e,t){return e.stylesheets&&e.count===0&&vs(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var a=setTimeout(function(){if(e.stylesheets&&vs(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+t);0<e.imgBytes&&rc===0&&(rc=62500*Xx());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&vs(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>rc?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(f)}}:null}function bs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var xs=null;function vs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,xs=new Map,t.forEach(hv,e),xs=null,bs.call(e))}function hv(e,t){if(!(t.state.loading&4)){var l=xs.get(e);if(l)var a=l.get(null);else{l=new Map,xs.set(e,l);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(l.set(x.dataset.precedence,x),a=x)}a&&l.set(null,a)}f=t.instance,x=f.getAttribute("data-precedence"),h=l.get(x)||a,h===a&&l.set(null,f),l.set(x,f),this.count++,a=bs.bind(this),f.addEventListener("load",a),f.addEventListener("error",a),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),t.state.loading|=4}}var Xr={$$typeof:U,Provider:null,Consumer:null,_currentValue:fe,_currentValue2:fe,_threadCount:0};function mv(e,t,l,a,f,h,x,w,M){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=it(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=it(0),this.hiddenUpdates=it(null),this.identifierPrefix=a,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function dp(e,t,l,a,f,h,x,w,M,K,se,de){return e=new mv(e,t,l,x,M,K,se,de,w),t=1,h===!0&&(t|=24),h=gn(3,null,null,t),e.current=h,h.stateNode=e,t=Uu(),t.refCount++,e.pooledCache=t,t.refCount++,h.memoizedState={element:a,isDehydrated:l,cache:t},Iu(h),e}function hp(e){return e?(e=Ni,e):Ni}function mp(e,t,l,a,f,h){f=hp(f),a.context===null?a.context=f:a.pendingContext=f,a=kl(t),a.payload={element:l},h=h===void 0?null:h,h!==null&&(a.callback=h),l=wl(e,a,t),l!==null&&(fn(l,e,t),wr(l,e,t))}function pp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function ac(e,t){pp(e,t),(e=e.alternate)&&pp(e,t)}function gp(e){if(e.tag===13||e.tag===31){var t=Kl(e,67108864);t!==null&&fn(t,e,67108864),ac(e,67108864)}}function yp(e){if(e.tag===13||e.tag===31){var t=Sn();t=Vt(t);var l=Kl(e,t);l!==null&&fn(l,e,t),ac(e,t)}}var Ss=!0;function pv(e,t,l,a){var f=C.T;C.T=null;var h=Y.p;try{Y.p=2,sc(e,t,l,a)}finally{Y.p=h,C.T=f}}function gv(e,t,l,a){var f=C.T;C.T=null;var h=Y.p;try{Y.p=8,sc(e,t,l,a)}finally{Y.p=h,C.T=f}}function sc(e,t,l,a){if(Ss){var f=uc(a);if(f===null)$o(e,t,a,js,l),xp(e,a);else if(bv(f,e,t,l,a))a.stopPropagation();else if(xp(e,a),t&4&&-1<yv.indexOf(e)){for(;f!==null;){var h=gi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=we(h.pendingLanes);if(x!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;x;){var M=1<<31-$e(x);w.entanglements[1]|=M,x&=~M}Xn(h),(rt&6)===0&&(is=ut()+500,Hr(0))}}break;case 31:case 13:w=Kl(h,2),w!==null&&fn(w,h,2),as(),ac(h,2)}if(h=uc(a),h===null&&$o(e,t,a,js,l),h===f)break;f=h}f!==null&&a.stopPropagation()}else $o(e,t,a,null,l)}}function uc(e){return e=ou(e),oc(e)}var js=null;function oc(e){if(js=null,e=pi(e),e!==null){var t=d(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=o(t),e!==null)return e;e=null}else if(l===31){if(e=g(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return js=e,null}function bp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ft()){case ie:return 2;case pe:return 8;case De:case _e:return 32;case qe:return 268435456;default:return 32}default:return 32}}var cc=!1,Ml=null,Ll=null,Ul=null,$r=new Map,Zr=new Map,Bl=[],yv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function xp(e,t){switch(e){case"focusin":case"focusout":Ml=null;break;case"dragenter":case"dragleave":Ll=null;break;case"mouseover":case"mouseout":Ul=null;break;case"pointerover":case"pointerout":$r.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zr.delete(t.pointerId)}}function Kr(e,t,l,a,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:t,domEventName:l,eventSystemFlags:a,nativeEvent:h,targetContainers:[f]},t!==null&&(t=gi(t),t!==null&&gp(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,f!==null&&t.indexOf(f)===-1&&t.push(f),e)}function bv(e,t,l,a,f){switch(t){case"focusin":return Ml=Kr(Ml,e,t,l,a,f),!0;case"dragenter":return Ll=Kr(Ll,e,t,l,a,f),!0;case"mouseover":return Ul=Kr(Ul,e,t,l,a,f),!0;case"pointerover":var h=f.pointerId;return $r.set(h,Kr($r.get(h)||null,e,t,l,a,f)),!0;case"gotpointercapture":return h=f.pointerId,Zr.set(h,Kr(Zr.get(h)||null,e,t,l,a,f)),!0}return!1}function vp(e){var t=pi(e.target);if(t!==null){var l=d(t);if(l!==null){if(t=l.tag,t===13){if(t=o(l),t!==null){e.blockedOn=t,hi(e.priority,function(){yp(l)});return}}else if(t===31){if(t=g(l),t!==null){e.blockedOn=t,hi(e.priority,function(){yp(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ks(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=uc(e.nativeEvent);if(l===null){l=e.nativeEvent;var a=new l.constructor(l.type,l);uu=a,l.target.dispatchEvent(a),uu=null}else return t=gi(l),t!==null&&gp(t),e.blockedOn=l,!1;t.shift()}return!0}function Sp(e,t,l){ks(e)&&l.delete(t)}function xv(){cc=!1,Ml!==null&&ks(Ml)&&(Ml=null),Ll!==null&&ks(Ll)&&(Ll=null),Ul!==null&&ks(Ul)&&(Ul=null),$r.forEach(Sp),Zr.forEach(Sp)}function ws(e,t){e.blockedOn===t&&(e.blockedOn=null,cc||(cc=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,xv)))}var Cs=null;function jp(e){Cs!==e&&(Cs=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Cs===e&&(Cs=null);for(var t=0;t<e.length;t+=3){var l=e[t],a=e[t+1],f=e[t+2];if(typeof a!="function"){if(oc(a||l)===null)continue;break}var h=gi(l);h!==null&&(e.splice(t,3),t-=3,so(h,{pending:!0,data:f,method:l.method,action:a},a,f))}}))}function Ji(e){function t(M){return ws(M,e)}Ml!==null&&ws(Ml,e),Ll!==null&&ws(Ll,e),Ul!==null&&ws(Ul,e),$r.forEach(t),Zr.forEach(t);for(var l=0;l<Bl.length;l++){var a=Bl[l];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Bl.length&&(l=Bl[0],l.blockedOn===null);)vp(l),l.blockedOn===null&&Bl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(a=0;a<l.length;a+=3){var f=l[a],h=l[a+1],x=f[rn]||null;if(typeof h=="function")x||jp(l);else if(x){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[rn]||null)w=x.formAction;else if(oc(f)!==null)continue}else w=x.action;typeof w=="function"?l[a+1]=w:(l.splice(a,3),a-=3),jp(l)}}}function kp(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function t(){f!==null&&(f(),f=null),a||setTimeout(l,20)}function l(){if(!a&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),f!==null&&(f(),f=null)}}}function fc(e){this._internalRoot=e}Es.prototype.render=fc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var l=t.current,a=Sn();mp(l,a,e,t,null,null)},Es.prototype.unmount=fc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mp(e.current,2,null,e,null,null),as(),t[mi]=null}};function Es(e){this._internalRoot=e}Es.prototype.unstable_scheduleHydration=function(e){if(e){var t=ar();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Bl.length&&t!==0&&t<Bl[l].priority;l++);Bl.splice(l,0,e),l===0&&vp(e)}};var wp=i.version;if(wp!=="19.2.6")throw Error(s(527,wp,"19.2.6"));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=m(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var vv={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ns=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ns.isDisabled&&Ns.supportsFiber)try{Nt=Ns.inject(vv),ot=Ns}catch{}}return Jr.createRoot=function(e,t){if(!c(e))throw Error(s(299));var l=!1,a="",f=Rh,h=Dh,x=_h;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(f=t.onUncaughtError),t.onCaughtError!==void 0&&(h=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError)),t=dp(e,1,!1,null,null,l,a,null,f,h,x,kp),e[mi]=t.current,Xo(e),new fc(t)},Jr.hydrateRoot=function(e,t,l){if(!c(e))throw Error(s(299));var a=!1,f="",h=Rh,x=Dh,w=_h,M=null;return l!=null&&(l.unstable_strictMode===!0&&(a=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(h=l.onUncaughtError),l.onCaughtError!==void 0&&(x=l.onCaughtError),l.onRecoverableError!==void 0&&(w=l.onRecoverableError),l.formState!==void 0&&(M=l.formState)),t=dp(e,1,!0,t,l??null,a,f,M,h,x,w,kp),t.context=hp(null),l=t.current,a=Sn(),a=Vt(a),f=kl(a),f.callback=null,wl(l,f,a),l=a,t.current.lanes=l,en(t,l),Xn(t),e[mi]=t.current,Xo(e),new Es(t)},Jr.version="19.2.6",Jr}var Op;function Gv(){if(Op)return mc.exports;Op=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),mc.exports=Yv(),mc.exports}var Vv=Gv();const Qv=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function Pg(n){if(!n||typeof n!="object")return!1;const i=n;return i.version===1&&typeof i.id=="string"&&Qv.test(i.id)&&typeof i.name=="string"&&i.name.trim().length>0&&i.name.length<=128&&!/[\u0000-\u001f\u007f]/.test(i.name)&&["desktop","hub","project-host"].includes(i.kind)&&i.entryPath===(i.kind==="desktop"?"/mobile":"/")}const ff="codeshell.environments.v1",Wg=32;function df(n){if(n.length>2048||/[\\\u0000-\u0020\u007f]/.test(n))throw new Error("请输入完整的工作台地址。");const i=new URL(n);if(!["https:","http:"].includes(i.protocol)||i.username||i.password||i.search||i.hash)throw new Error("请使用不含密码、配对令牌或查询参数的工作台地址。");if(!["/","/mobile","/mobile/"].includes(i.pathname))throw new Error("请填写工作台首页或桌面 /mobile 地址。");return i.origin+(i.pathname.startsWith("/mobile")?"/mobile":"/")}function ey(n){if(!n||typeof n!="object")throw new Error("无效的连接记录。");const i=n;if(typeof i.address!="string"||typeof i.name!="string"||!i.name.trim()||i.name.length>80||/[\u0000-\u001f\u007f]/.test(i.name))throw new Error("连接名称需为 1–80 个字符。");if(i.environmentId!==void 0&&!Pg({version:1,id:i.environmentId,name:"Host",kind:"hub",entryPath:"/"}))throw new Error("无效的环境身份。");return{address:df(i.address),name:i.name.trim(),...i.environmentId?{environmentId:i.environmentId}:{}}}function Is(n){const i=n.getItem(ff);if(i===null)return[];if(i.length>1e5)throw new Error("连接记录过大,请清理当前工作台的连接记录。");const r=JSON.parse(i);if(!Array.isArray(r)||r.length>Wg)throw new Error("连接记录格式无效。");return r.map(ey)}function Mp(n,i){const r=ey(i),s=Is(n),c=s.find(o=>o.address===r.address);if(c?.environmentId&&r.environmentId&&c.environmentId!==r.environmentId)throw new Error("这个地址的环境身份已变化。请确认目标后,删除旧连接再添加。");const d=[...s.filter(o=>o.address!==r.address),{...r,...c?.environmentId?{environmentId:c.environmentId}:{}}];if(d.length>Wg)throw new Error("最多保存 32 个环境,请先移除不再使用的连接。");return n.setItem(ff,JSON.stringify(d)),d}function Xv(n,i){const r=Is(n).filter(s=>s.address!==df(i));return n.setItem(ff,JSON.stringify(r)),r}function $v(n,i,r){const s=n.find(c=>c.address===i+r.entryPath);if(s?.environmentId&&s.environmentId!==r.id)throw new Error("当前地址对应的环境已变化,请核对项目后重新保存连接。")}function hf({discover:n=!0,navigate:i}){const[r,s]=j.useState(!1),[c,d]=j.useState(),[o,g]=j.useState([]),[p,m]=j.useState(""),[b,y]=j.useState(""),[v,S]=j.useState(""),N=j.useRef(null),O=j.useRef(null);j.useEffect(()=>{try{g(Is(window.localStorage))}catch{S("无法读取连接记录。当前项目仍可使用。")}},[]),j.useEffect(()=>{if(!n)return;const R=new AbortController;return Ie("/api/v1/environment",{signal:R.signal}).then(U=>{if(!R.signal.aborted){if(!Pg(U))throw new Error("环境信息无效,请更新工作台后重试。");d(U),$v(Is(window.localStorage),window.location.origin,U)}}).catch(U=>{R.signal.aborted||U instanceof Xe&&[401,404].includes(U.status)||S(U instanceof Error?U.message:"无法读取环境信息。")}),()=>R.abort()},[n]),j.useEffect(()=>{r&&(N.current?.showModal(),O.current?.focus())},[r]);const z=R=>{try{g(R()),S("")}catch(U){S(U instanceof Error?U.message:"保存连接失败。")}},D=R=>{const U=df(R);s(!1),i?i(U):window.location.assign(U)};return u.jsxs("div",{className:"environment-switcher",children:[u.jsxs("button",{type:"button",className:"ghost environment-trigger",onClick:()=>s(!0),children:[c?.name??"连接环境",u.jsx("span",{"aria-hidden":"true",children:" ▾"})]}),r?u.jsxs("dialog",{ref:N,className:"environment-dialog","aria-labelledby":"environment-title",onCancel:()=>s(!1),onClose:()=>s(!1),children:[u.jsxs("header",{children:[u.jsx("h2",{id:"environment-title",children:"电脑与云端"}),u.jsx("button",{ref:O,type:"button",className:"ghost",onClick:()=>s(!1),children:"关闭"})]}),u.jsx("p",{children:"打开目标环境后选择项目。切换入口不会移动文件或正在运行的任务。"}),u.jsxs("p",{className:"environment-location",children:["当前地址:",window.location.origin]}),v?u.jsx("p",{role:"alert",className:"form-error",children:v}):null,c?u.jsx("button",{type:"button",className:"library-button",onClick:()=>z(()=>Mp(window.localStorage,{name:c.name,address:window.location.origin+c.entryPath,environmentId:c.id})),children:"保存当前环境"}):null,u.jsx("ul",{className:"environment-list",children:o.map(R=>u.jsxs("li",{children:[u.jsxs("div",{children:[u.jsx("strong",{children:R.name}),u.jsx("small",{children:R.address})]}),u.jsx("button",{type:"button",className:"library-button",onClick:()=>D(R.address),children:"打开"}),u.jsx("button",{type:"button",className:"ghost","aria-label":`移除 ${R.name}`,onClick:()=>z(()=>Xv(window.localStorage,R.address)),children:"移除"})]},R.address))}),u.jsxs("form",{onSubmit:R=>{R.preventDefault(),z(()=>Mp(window.localStorage,{name:p,address:b.trim()}))},children:[u.jsxs("label",{children:["连接名称",u.jsx("input",{required:!0,maxLength:80,value:p,onChange:R=>m(R.target.value),placeholder:"例如:家里的电脑"})]}),u.jsxs("label",{children:["工作台地址",u.jsx("input",{required:!0,type:"url",maxLength:2048,value:b,onChange:R=>y(R.target.value),placeholder:"https://example.com/"})]}),u.jsx("button",{type:"submit",className:"library-button primary",children:"添加连接"})]}),u.jsx("p",{className:"environment-hint",children:"连接记录保存在当前工作台的浏览器存储中。目标环境需要单独登录或配对,请勿保存带配对令牌的地址。未连接的环境不会显示为在线。"})]}):null]})}function Zv({session:n,onClose:i,onAuthLost:r}){const[s,c]=j.useState([]),[d,o]=j.useState(""),[g,p]=j.useState("loading"),m=j.useRef(null),b=j.useCallback(S=>{S instanceof Xe&&S.status===401?r():o(S instanceof Error?S.message:"操作失败,请重试。")},[r]);j.useEffect(()=>{let S=!0;return m.current?.showModal(),Ie("/api/v1/auth/sessions").then(N=>{S&&c(N.sessions)}).catch(N=>{S&&b(N)}).finally(()=>{S&&p(null)}),()=>{S=!1}},[b]);const y=async S=>{p(S.id),o("");try{await Ie(`/api/v1/auth/sessions/${encodeURIComponent(S.id)}`,{method:"DELETE"}),S.current?r():c(N=>N.filter(O=>O.id!==S.id))}catch(N){b(N)}finally{p(null)}},v=async()=>{p("logout"),o("");try{await Fg("/api/v1/auth/logout"),r()}catch(S){b(S)}finally{p(null)}};return u.jsxs("dialog",{className:"devices-dialog",ref:m,onCancel:i,"aria-labelledby":"devices-title",children:[u.jsxs("div",{className:"dialog-head",children:[u.jsx("h2",{id:"devices-title",children:"账号与设备"}),u.jsx("button",{className:"ghost",onClick:i,"aria-label":"关闭",children:"×"})]}),u.jsxs("p",{className:"muted",children:[n?.username," · ",n?.deviceName||"当前设备"]}),d?u.jsx("p",{className:"form-error",role:"alert",children:d}):null,g==="loading"?u.jsx("p",{role:"status",children:"正在读取设备…"}):null,u.jsx("ul",{className:"device-list",children:s.map(S=>u.jsxs("li",{children:[u.jsxs("div",{children:[u.jsxs("strong",{children:[S.deviceName||"未命名设备",S.current?"(当前)":""]}),u.jsxs("span",{children:["最近活动 ",new Date(S.lastSeenAt).toLocaleString()]})]}),u.jsx("button",{className:"ghost",disabled:g!==null,onClick:()=>{y(S)},children:g===S.id?"处理中…":"撤销登录"})]},S.id))}),u.jsx("button",{className:"stop",disabled:g!==null,onClick:()=>{v()},children:"退出当前设备"})]})}function bc(n){return{expectedRevision:n?n.revision:null,id:n?.id??"",catalogId:n?.catalogId??"",model:n?.model??"",baseUrl:n?.baseUrl??"",apiKey:""}}function Kv(n){const i={id:n.id.trim(),catalogId:n.catalogId,model:n.model.trim(),baseUrl:n.baseUrl.trim()};return n.expectedRevision!==void 0&&(i.expectedRevision=n.expectedRevision),n.apiKey.trim()&&(i.apiKey=n.apiKey.trim()),i}function mf(n){if(!n||typeof n.workspace?.path!="string"||!n.defaults||!Array.isArray(n.connections)||!Array.isArray(n.catalog)||!Array.isArray(n.skills)||!Array.isArray(n.mcpServers)||!Array.isArray(n.workspace.skillDirectories))throw new Error("服务端返回了无效的设置,请刷新后重试。");return n}async function ty(n){return mf(await Ie("/api/v1/configuration",{signal:n}))}async function pf(n,i,r){return mf(await Ie(`/api/v1/configuration/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:r}))}function Fv(n,i){return pf("connections",Kv(n),i)}function Jv(n,i){return pf("defaults",n,i)}function Pv(n,i,r){return pf("skills",{name:n,enabled:i},r)}function ny(n){const i=n instanceof Error?n.message:"设置更新失败,请重试。",r={"provide an API key when changing the endpoint origin":"更换服务地址时,请同时填写该服务使用的 API Key。现有密钥不会自动发送到新的服务地址。","baseUrl must be an HTTP(S) URL without credentials, query or fragment":"请填写 HTTP 或 HTTPS 服务地址,不要在地址中包含账号、密码、查询参数或片段。","enable the owning plugin on the server first":"请先在服务器上启用这个 Skill 所属的插件。","select an existing text connection":"这个模型连接已不可用,请刷新后重新选择。","configuration request failed":"配置操作未完成,请刷新设置确认当前状态后重试。","too many model connections":"模型连接数量已达上限,请先删除不用的连接。","skill not found":"这个 Skill 已不在服务器上,请刷新列表。","unknown text provider":"这个模型服务商不可用,请刷新设置后重新选择。","existing connection provider cannot be changed":"已有连接的服务商不能直接更换,请创建新连接。"};return r[i]?r[i]:/^(id|catalogId|model|text|auxText|apiKey) is invalid$/.exec(i)?"配置字段无效,请检查名称、模型与密钥后重试。":i}async function Wv(n,i,r,s){return mf(await Ie("/api/v1/configuration/connections",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,...i?{replacementText:i}:{},...s?{expectedRevision:s}:{}}),signal:r}))}async function e0(n,i){const r=da(),s=yt("/api/v1/configuration/connections/probe"),c=yt("/api/v1/configuration/connections/probe/cancel");let d;try{d=await Ie(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n,requestId:r}),signal:i})}catch(o){throw i?.aborted&&await Ie(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:r}),signal:AbortSignal.timeout(2e3)}).catch(()=>{}),o}if(!d||d.connectionId!==n||typeof d.ok!="boolean"||typeof d.message!="string"||typeof d.code!="string"||!Number.isFinite(d.latencyMs))throw new Error("服务端返回了无效的测试结果,请重试。");return d}const gf="/api/v1/skills";async function Lp(n){const i=await Ie(gf,{signal:n});if(!i||!Array.isArray(i.skills)||!Array.isArray(i.directories))throw new Error("Skills 列表读取失败,请刷新重试。");return i}async function t0(n,i){const r=await Ie(`${gf}/detail?name=${encodeURIComponent(n)}`,{signal:i});if(r.name!==n||typeof r.content!="string"||typeof r.revision!="string")throw new Error("Skill 内容读取失败,请重试。");return r}function fi(n,i,r,s){return Ie(`${gf}${n}`,{method:i,headers:{"Content-Type":"application/json"},body:JSON.stringify(r),signal:s})}const n0=(n,i,r)=>fi("/local","POST",{name:n,content:i},r),l0=(n,i,r,s)=>fi("/local","PUT",{name:n,content:i,revision:r},s),i0=(n,i,r)=>fi("/local","DELETE",{name:n,revision:i},r),r0=(n,i)=>fi("/github/preview","POST",{url:n.trim()},i),a0=(n,i,r,s)=>fi("/github/install","POST",{reviewToken:n,pathInRepo:i,name:r.trim()},s),s0=(n,i,r)=>fi("/github/update-preview","POST",{name:n,revision:i},r),u0=(n,i)=>fi("/github/update","POST",{reviewToken:n},i);function zs(n){return`---
|
|
10
|
+
name: ${n||"my-skill"}
|
|
11
|
+
description: 描述这个 Skill 适合处理什么任务
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# 工作方式
|
|
15
|
+
|
|
16
|
+
在这里写下具体步骤、输入要求和完成标准。
|
|
17
|
+
`}function Gc(n){return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(n)&&!n.includes("..")}function o0(n,i,r){const s=i.trim().toLocaleLowerCase();return n.filter(c=>(r==="all"||c.source===r)&&(!s||`${c.name} ${c.description}`.toLocaleLowerCase().includes(s)))}const Up={project:"工作区",user:"用户级",plugin:"插件","panel-app":"Panel App"};function c0({onAuthLost:n,onChanged:i,onDirtyChange:r,configurationVersion:s=0}){const[c,d]=j.useState(null),[o,g]=j.useState(null),[p,m]=j.useState(""),[b,y]=j.useState("all"),[v,S]=j.useState(""),[N,O]=j.useState(""),[z,D]=j.useState(""),[R,U]=j.useState(0),[F,ue]=j.useState(!1),[L,le]=j.useState(!1),oe=j.useRef(null),W=j.useRef(null),T=j.useRef(!1),q=j.useRef({onAuthLost:n,onChanged:i});q.current={onAuthLost:n,onChanged:i};const H=j.useRef(null),re=j.useRef(null),me=j.useCallback(k=>{k instanceof Xe&&k.status===401?q.current.onAuthLost():O(k instanceof Error?k.message:"操作失败,请重试。")},[]);j.useEffect(()=>()=>{oe.current?.abort(),W.current?.abort()},[]),j.useEffect(()=>{if(oe.current){T.current=!0;return}const k=new AbortController;return W.current=k,Lp(k.signal).then(A=>{k.signal.aborted||d(A)}).catch(A=>{k.signal.aborted||me(A)}),()=>k.abort()},[R,s,me]),j.useEffect(()=>{o&&H.current?.focus()},[o?.kind]);const te=k=>{re.current=document.activeElement,O(""),D(""),ue(!1),le(!1),g(k)},C=()=>{g(null),ue(!1),le(!1),O(""),re.current?.focus()},Y=()=>{if(!oe.current){if(F){le(!0);return}C()}},fe=async(k,A,X=!1)=>{if(oe.current)return;W.current?.abort();const E=new AbortController;oe.current=E,S(k),O(""),D("");try{const ee=await A(E.signal);if(E.signal.aborted)return;if(X){try{const ge=await Lp(E.signal);E.signal.aborted||d(ge)}catch(ge){if(ge instanceof Xe&&ge.status===401)throw ge;E.signal.aborted||O("操作已完成,但列表刷新失败。请点击刷新查看最新状态。")}if(E.signal.aborted)return;D(ee.message||"设置已保存,下次任务生效。"),q.current.onChanged?.()}return ee}catch(ee){E.signal.aborted||me(ee);return}finally{oe.current===E&&(oe.current=null),E.signal.aborted||(S(""),T.current&&(T.current=!1,U(ee=>ee+1)))}};j.useEffect(()=>(r?.(F||!!v),()=>r?.(!1)),[F,v,r]);const be=o0(c?.skills??[],p,b);return u.jsxs("section",{className:"hub-skills","aria-labelledby":"skills-title",onKeyDown:k=>{k.key==="Escape"&&o&&!v&&(k.preventDefault(),Y())},children:[u.jsxs("header",{className:"skills-heading",children:[u.jsxs("div",{children:[u.jsx("span",{className:"skills-eyebrow",children:"工作区能力"}),u.jsx("h1",{id:"skills-title",children:"Skills"}),u.jsx("p",{children:"创建工作说明,导入社区技能,把常用流程留在工作区。"})]}),u.jsxs("div",{className:"skills-actions",children:[u.jsx("button",{className:"config-button",disabled:!!v||!!o,onClick:()=>te({kind:"import"}),children:"从 GitHub 导入"}),u.jsx("button",{className:"config-button config-button-primary",disabled:!!v||!!o,onClick:()=>te({kind:"create"}),children:"+ 创建 Skill"})]})]}),N&&u.jsx("div",{className:"config-message config-error",role:"alert",children:N}),z&&u.jsx("div",{className:"config-message config-success",role:"status",children:z}),v&&u.jsxs("p",{className:"skills-progress",role:"status",children:[v,"…"]}),o&&u.jsxs("section",{className:"skills-workspace-panel","aria-labelledby":"skills-panel-title",children:[u.jsxs("header",{children:[u.jsx("h2",{id:"skills-panel-title",ref:H,tabIndex:-1,children:o.kind==="create"?"创建 Skill":o.kind==="detail"?o.detail.editable?`编辑 ${o.detail.name}`:o.detail.name:o.kind==="import"?"从 GitHub 导入":o.kind==="update"?`更新 ${o.preview.name}`:`移除 ${o.skill.name}`}),u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v,onClick:Y,children:"关闭"})]}),L&&u.jsxs("div",{className:"skills-discard-confirm",role:"alert",children:[u.jsx("p",{children:"还有未保存的修改。关闭会丢弃这些修改。"}),u.jsxs("div",{className:"skills-actions",children:[u.jsx("button",{className:"config-button",onClick:()=>le(!1),children:"继续编辑"}),u.jsx("button",{className:"config-button skills-danger",onClick:C,children:"放弃修改并关闭"})]})]}),(o.kind==="create"||o.kind==="detail")&&u.jsx(f0,{detail:o.kind==="detail"?o.detail:void 0,busy:!!v,run:fe,onSaved:C,onDirtyChange:ue},o.kind==="detail"?o.detail.name+o.detail.revision:"create"),o.kind==="import"&&u.jsx(d0,{preview:o.preview,busy:!!v,run:fe,onPreview:k=>g({kind:"import",preview:k}),onInstalled:C},o.preview?.reviewToken??"url"),o.kind==="update"&&u.jsx(h0,{preview:o.preview,busy:!!v,run:fe,onUpdated:C}),o.kind==="remove"&&u.jsxs("div",{className:"skills-remove-confirm",children:[u.jsxs("p",{children:["确认从当前工作区移除 ",u.jsx("strong",{children:o.skill.name}),"?它的 SKILL.md、脚本和资源文件都会移除。"]}),u.jsx("p",{className:"config-help",children:"已保存的对话会保留。其他设备下一次运行任务时将不再使用这个工作区 Skill。"}),u.jsxs("div",{className:"skills-actions",children:[u.jsx("button",{className:"config-button",disabled:!!v,onClick:Y,children:"取消"}),u.jsx("button",{className:"config-button skills-danger",disabled:!!v,onClick:()=>{fe("正在移除 Skill",k=>i0(o.skill.name,o.skill.revision,k),!0).then(k=>{k&&C()})},children:"确认移除"})]})]})]}),u.jsxs("div",{className:"skills-filter",children:[u.jsxs("label",{children:[u.jsx("span",{className:"config-sr-only",children:"搜索 Skills"}),u.jsx("input",{type:"search","aria-label":"搜索 Skills",value:p,onChange:k=>m(k.target.value),placeholder:"搜索名称或用途…"})]}),u.jsxs("select",{"aria-label":"Skill 来源",value:b,onChange:k=>y(k.target.value),children:[u.jsx("option",{value:"all",children:"全部来源"}),Object.entries(Up).map(([k,A])=>u.jsx("option",{value:k,children:A},k))]}),u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v,onClick:()=>{O(""),U(k=>k+1)},children:"刷新"})]}),!c&&!N?u.jsx("p",{className:"config-help",children:"正在读取 Skills…"}):c?u.jsxs("p",{className:"skills-count",children:[be.length===c.skills.length?`${be.length} 个 Skill`:`显示 ${be.length} / ${c.skills.length} 个 Skill`," · ",c.skills.filter(k=>k.enabled).length," 个已启用"]}):null,c&&!be.length&&u.jsxs("div",{className:"skills-empty",children:[u.jsx("h2",{children:p||b!=="all"?"没有匹配的 Skills":"从一个常用流程开始"}),u.jsx("p",{children:p||b!=="all"?"调整搜索词或来源筛选。":"创建自己的 Skill,或粘贴 GitHub 地址导入完整的社区技能。"})]}),u.jsx("div",{className:"skills-list",children:be.map(k=>u.jsxs("article",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-heading",children:[u.jsxs("div",{children:[u.jsx("h2",{children:k.name}),u.jsx("span",{className:"config-badge",children:Up[k.source]}),k.origin&&u.jsx("span",{className:"config-badge",children:"GitHub"})]}),u.jsx("button",{className:"config-switch",role:"switch","aria-checked":k.enabled,"aria-label":`${k.enabled?"停用":"启用"} ${k.name}`,disabled:!!v||!!k.disabledReason,title:k.disabledReason,onClick:()=>{fe("正在更新 Skill",async A=>(await Pv(k.name,!k.enabled,A),{ok:!0,name:k.name,message:k.enabled?"Skill 已停用,下次任务生效。":"Skill 已启用,下次任务生效。"}),!0)},children:u.jsx("span",{})})]}),u.jsx("p",{children:k.description||"暂未填写用途描述。"}),k.origin&&u.jsxs("p",{className:"skills-source",children:[k.origin.url.replace("https://github.com/","")," · ",k.origin.ref," ·"," ",k.origin.commit.slice(0,8)]}),k.readOnlyReason&&u.jsx("p",{className:"config-help",children:k.readOnlyReason}),k.disabledReason&&u.jsx("p",{className:"config-help",children:k.disabledReason}),u.jsxs("footer",{className:"skills-actions",children:[u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v||!!o,onClick:()=>{re.current=document.activeElement,fe("正在读取 Skill",A=>t0(k.name,A)).then(A=>{A&&te({kind:"detail",detail:A})})},children:k.editable?"查看与编辑":"查看说明"}),k.editable&&k.origin&&u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v||!!o,onClick:()=>{fe("正在检查来源更新",A=>s0(k.name,k.revision,A)).then(A=>{A?.changed?te({kind:"update",preview:A}):A&&D(`${k.name} 已是最新版本。`)})},children:"检查更新"}),k.removable&&u.jsx("button",{className:"config-button config-button-quiet skills-remove",disabled:!!v||!!o,onClick:()=>te({kind:"remove",skill:k}),children:"移除"})]})]},k.name))}),c&&u.jsxs("details",{className:"skills-directories",children:[u.jsx("summary",{children:"Skills 存在哪里"}),u.jsx("p",{children:"这里管理当前工作区。用户级、插件和 Panel App 的 Skills 可以查看和启停,安装内容由各自来源管理。"}),u.jsx("ul",{children:c.directories.map(k=>u.jsx("li",{children:u.jsx("code",{children:k})},k))})]})]})}function f0({detail:n,busy:i,run:r,onSaved:s,onDirtyChange:c}){const[d,o]=j.useState(n?.name??"my-skill"),[g,p]=j.useState(n?.content??zs("my-skill")),m=g!==n?.content,b=!n||n.editable;return j.useEffect(()=>{c(b&&(n?g!==n.content:d!=="my-skill"||g!==zs("my-skill")))},[g,d,n,b,c]),u.jsx("form",{className:"skills-editor",onSubmit:y=>{y.preventDefault(),r(n?"正在保存 Skill":"正在创建 Skill",v=>n?l0(n.name,g,n.revision,v):n0(d.trim(),g,v),!0).then(v=>{v&&s()})},children:u.jsxs("fieldset",{disabled:i,children:[!n&&u.jsxs("label",{children:[u.jsx("span",{children:"名称"}),u.jsx("input",{required:!0,value:d,maxLength:128,onChange:y=>{const v=y.target.value;g===zs(d)&&p(zs(v)),o(v)},"aria-describedby":"skill-name-help","aria-label":"Skill 名称"}),u.jsx("small",{id:"skill-name-help",children:"字母、数字、短横线、下划线或点;创建后名称保持不变。"}),!Gc(d)&&u.jsx("span",{className:"skills-field-error",children:"请输入有效名称。"})]}),u.jsxs("label",{children:[u.jsxs("span",{children:[b?"SKILL.md":"说明",n&&b&&m&&u.jsx("small",{className:"skills-unsaved",children:"未保存"})]}),u.jsx("textarea",{value:g,readOnly:!b,onChange:y=>p(y.target.value),rows:18,spellCheck:!1,"aria-label":"SKILL.md 内容"})]}),n?.origin&&b&&u.jsx("p",{className:"config-help",children:"手动编辑会保留 GitHub 来源;以后更新来源时,会预览将替换的完整内容。"}),b&&u.jsxs("div",{className:"skills-actions",children:[u.jsx("span",{className:"config-help",children:"支持 Markdown 和 YAML Frontmatter。变更在下一次任务中生效。"}),u.jsx("button",{className:"config-button config-button-primary",type:"submit",disabled:!g.trim()||!n&&!Gc(d)||!!n&&!m,children:n?"保存修改":"创建 Skill"})]})]})})}function d0({preview:n,busy:i,run:r,onPreview:s,onInstalled:c}){const[d,o]=j.useState(""),[g,p]=j.useState(n?.skills[0]?.pathInRepo??""),[m,b]=j.useState(n?.skills[0]?.name??"");return n?u.jsxs("form",{className:"skills-import-preview",onSubmit:y=>{y.preventDefault(),r("正在导入 Skill 与资源",v=>a0(n.reviewToken,g,m,v),!0).then(v=>{v&&c()})},children:[u.jsxs("p",{children:[u.jsx("a",{href:n.repoUrl,target:"_blank",rel:"noreferrer",children:n.repoUrl.replace("https://github.com/","")})," ",u.jsx("span",{className:"config-badge",children:n.commit.slice(0,8)})]}),n.warning&&u.jsx("p",{className:"config-help",children:n.warning}),u.jsxs("fieldset",{disabled:i,children:[u.jsx("legend",{children:"选择一个 Skill"}),u.jsx("div",{className:"skills-source-choices",children:n.skills.map(y=>u.jsxs("label",{children:[u.jsx("input",{type:"radio",name:"github-skill",checked:g===y.pathInRepo,onChange:()=>{p(y.pathInRepo),b(y.name)}}),u.jsxs("span",{children:[u.jsx("strong",{children:y.name}),u.jsx("small",{children:y.description||y.pathInRepo}),y.alreadyInstalled&&u.jsx("small",{children:"已有同名 Skill,可修改安装名称。"})]})]},y.pathInRepo))}),!!n.skills.length&&u.jsxs(u.Fragment,{children:[u.jsxs("label",{children:[u.jsx("span",{children:"安装到工作区时使用的名称"}),u.jsx("input",{required:!0,maxLength:128,value:m,onChange:y=>b(y.target.value)})]}),u.jsx("p",{className:"config-help",children:"将导入预览时的确定版本。不会执行其中的脚本。"}),u.jsx("button",{className:"config-button config-button-primary",disabled:!g||!Gc(m),type:"submit",children:"确认导入到工作区"})]})]})]}):u.jsxs("form",{className:"skills-import-url",onSubmit:y=>{y.preventDefault(),r("正在检查 GitHub 来源",v=>r0(d,v)).then(v=>{v&&s(v)})},children:[u.jsxs("label",{children:[u.jsx("span",{children:"GitHub 仓库或 Skill 目录地址"}),u.jsx("input",{type:"url",required:!0,value:d,onChange:y=>o(y.target.value),placeholder:"https://github.com/owner/repository/tree/main/skills/example",disabled:i})]}),u.jsx("p",{className:"config-help",children:"先查看可导入的技能,再确认安装。脚本和资源文件会一起保留。"}),u.jsx("button",{className:"config-button config-button-primary",disabled:i||!d.trim(),children:"预览来源"})]})}function h0({preview:n,busy:i,run:r,onUpdated:s}){return u.jsxs("div",{className:"skills-update-preview",children:[u.jsxs("p",{children:["来源版本 ",u.jsx("code",{children:n.currentCommit.slice(0,8)})," →"," ",u.jsx("code",{children:n.latestCommit.slice(0,8)})]}),u.jsx("p",{children:"确认后会用下方版本替换此 Skill 的说明、脚本和资源,包括你在其中做过的本地修改。"}),u.jsxs("details",{children:[u.jsxs("summary",{children:["查看将导入的 ",n.files?.length??0," 个文件"]}),u.jsx("ul",{children:n.files?.map(c=>u.jsxs("li",{children:[u.jsx("code",{children:c.path}),u.jsxs("span",{children:[Math.ceil(c.size/1024)," KB",c.executable?" · 可执行脚本":""]})]},c.path))})]}),u.jsxs("label",{children:[u.jsx("span",{children:"新的 SKILL.md"}),u.jsx("textarea",{value:n.content??"",readOnly:!0,rows:16,"aria-label":"更新后的 SKILL.md"})]}),u.jsx("button",{className:"config-button config-button-primary",disabled:i||!n.reviewToken,onClick:()=>{r("正在更新 Skill",c=>u0(n.reviewToken,c),!0).then(c=>{c&&s()})},children:"确认更新到预览版本"})]})}function m0(n){const i=r=>r.map((s,c)=>({id:`stored-${c}`,name:s,value:"",stored:!0,removed:!1}));return{name:n?.name??"",transport:n?.transport??"stdio",command:n?.command??"",args:"",clearArgs:!1,url:n?.url??"",env:i(n?.envKeys??[]),headers:i(n?.headerKeys??[]),envHeaders:Object.entries(n?.envHeaders??{}).map(([r,s],c)=>({id:`stored-${c}`,name:r,value:s,initialValue:s,stored:!0,removed:!1})),envVars:(n?.envVars??[]).join(`
|
|
18
|
+
`),bearerTokenEnvVar:n?.bearerTokenEnvVar??"",credentialRef:n?.credentialRef??"",enabled:n?.enabled??!0,restrictTools:n?.allowedTools!==void 0,allowedTools:(n?.allowedTools??[]).join(`
|
|
19
|
+
`),disabledTools:(n?.disabledTools??[]).join(`
|
|
20
|
+
`),reuseStoredSecrets:!1}}function xc(n){return n.split(/\r?\n/).map(i=>i.trim()).filter(Boolean)}function p0(n,i){const r={},s=new Set;for(const c of n){if(!c.stored&&c.removed)continue;const d=c.name.trim();if(["__proto__","prototype","constructor"].includes(d))throw new Error(`${i}名称无效。`);if(!d&&!c.value&&!c.stored)continue;if(!d||!c.stored&&!c.value)throw new Error(`请完整填写${i}的名称和值,或移除空行。`);const o=i==="环境变量"?d:d.toLowerCase();if(s.has(o))throw new Error(`${i}名称不能重复。`);s.add(o),c.removed?r[d]=null:c.value&&c.value!==c.initialValue&&(r[d]=c.value)}return r}function Bp(n){try{return new URL(n).origin}catch{return""}}function g0(n,i){if(!i)return!1;const r=i.envKeys.length||i.headerKeys.length||i.envVars.length||Object.keys(i.envHeaders).length||i.credentialRef||i.bearerTokenEnvVar||i.argsCount,s=n.transport!==i.transport||(n.transport==="stdio"?n.command.trim()!==i.command||!!n.args.trim()||n.clearArgs:Bp(n.url)!==Bp(i.url??""));return!!r&&s}function y0(n,i){const r={name:n.name.trim()};(!i||n.transport!==i.transport)&&(r.transport=n.transport),(!i||n.enabled!==i.enabled)&&(r.enabled=n.enabled),n.transport==="stdio"?((!i||n.command.trim()!==i.command)&&(r.command=n.command.trim()),n.clearArgs?r.args=[]:n.args.trim()&&(r.args=n.args.split(/\r?\n/).filter(o=>o.length>0))):(!i||n.url.trim()!==i.url)&&(r.url=n.url.trim());for(const[o,g]of[["env","环境变量"],["headers","请求头"],["envHeaders","环境变量请求头"]]){const p=p0(n[o],g);Object.keys(p).length&&(r[o]=p)}const s=xc(n.envVars);(!i||JSON.stringify(s)!==JSON.stringify(i.envVars))&&(r.envVars=s);for(const o of["bearerTokenEnvVar","credentialRef"])(!i||n[o].trim()!==(i[o]??""))&&(r[o]=n[o].trim()||null);const c=n.restrictTools?xc(n.allowedTools):void 0;(!i||JSON.stringify(c)!==JSON.stringify(i.allowedTools))&&(r.allowedTools=c??null);const d=xc(n.disabledTools);return(!i||JSON.stringify(d)!==JSON.stringify(i.disabledTools))&&(r.disabledTools=d),n.reuseStoredSecrets&&(r.reuseStoredSecrets=!0),r}function ly(n){if(!n||typeof n.workspacePath!="string"||!Array.isArray(n.servers)||!Array.isArray(n.removed))throw new Error("服务端返回了无效的 MCP 配置,请刷新重试。");return n}const lr=(n,i="")=>`/api/v1/mcp/servers/${encodeURIComponent(n)}${i}`;async function b0(n){return ly(await Ie("/api/v1/mcp",{signal:n}))}async function Ks(n,i,r,s){return ly(await Ie(n,{method:i,headers:{"Content-Type":"application/json"},...r===void 0?{}:{body:JSON.stringify(r)},signal:s}))}function x0(n,i,r){return Ks(i?lr(i.name):"/api/v1/mcp/servers",i?"PUT":"POST",y0(n,i),r)}function v0(n,i,r){return Ks(lr(n,"/enabled"),"PUT",{enabled:i},r)}function S0(n,i){return Ks(lr(n),"DELETE",void 0,i)}function qp(n,i){return Ks(lr(n,"/inherit"),"POST",{},i)}async function j0(n,i){const r=await Ie(lr(n,"/probe"),{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",signal:i});if(r.name!==n||!["ok","error","cancelled"].includes(r.status))throw new Error("服务端返回了无效的连接测试结果。");return r}function Hp(n,i,r){return Ie(yt(lr(n,"/cancel-probe"),i,r),{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",keepalive:!0})}const k0={local:"工作区本地",project:"工作区配置",user:"用户级",managed:"启动配置",plugin:"插件提供"};function w0({onAuthLost:n,onConfigurationChange:i,configurationVersion:r=0,onDirtyChange:s}){const[c,d]=j.useState(null),[o,g]=j.useState(!0),[p,m]=j.useState(!1),[b,y]=j.useState(!1),[v,S]=j.useState(""),[N,O]=j.useState(""),[z,D]=j.useState(null),[R,U]=j.useState(null),[F,ue]=j.useState(""),[L,le]=j.useState({}),[oe,W]=j.useState(null),[T,q]=j.useState(0),H=j.useRef({onAuthLost:n,onConfigurationChange:i,onDirtyChange:s});H.current={onAuthLost:n,onConfigurationChange:i,onDirtyChange:s};const re=j.useRef(!1),me=j.useRef(null),te=j.useRef(null),C=j.useRef(null),Y=j.useRef(0),fe=j.useRef(!1),be=j.useRef(r);j.useEffect(()=>{H.current.onDirtyChange?.(b||p)},[b,p]);const k=j.useCallback(Q=>{Q instanceof Xe&&Q.status===401?H.current.onAuthLost():S(Q instanceof Error?Q.message:"MCP 操作失败,请重试。")},[]);j.useEffect(()=>(re.current=!0,()=>{re.current=!1,H.current.onDirtyChange?.(!1),te.current?.abort();const Q=C.current;Q&&(Q.controller.abort(),Hp(Q.name,Q.workspace,Q.projectId).catch(()=>{}))}),[]),j.useEffect(()=>{be.current!==r&&(be.current=r,te.current?fe.current=!0:q(Q=>Q+1))},[r]),j.useEffect(()=>{const Q=new AbortController;me.current=Q;const Se=Date.now(),G=++Y.current;return g(!0),S(""),b0(Q.signal).then(he=>{!Q.signal.aborted&&G===Y.current&&(d(he),le(ze=>Object.fromEntries(Object.entries(ze).filter(([,Ce])=>Date.parse(Ce.checkedAt)>=Se))))}).catch(he=>{!Q.signal.aborted&&G===Y.current&&k(he)}).finally(()=>{!Q.signal.aborted&&G===Y.current&&g(!1)}),()=>Q.abort()},[T,k]);const A=async(Q,Se="MCP 设置已保存,任务进程会加载新的配置。")=>{if(te.current||C.current)return!1;me.current?.abort();const G=++Y.current,he=new AbortController;te.current=he,m(!0),g(!1),S(""),O("");try{const ze=await Q(he.signal);return!re.current||he.signal.aborted||G!==Y.current?!1:(d(ze),le({}),O(Se),H.current.onConfigurationChange?.(),!0)}catch(ze){return re.current&&!he.signal.aborted&&k(ze),!1}finally{te.current===he&&(te.current=null),re.current&&!he.signal.aborted&&(m(!1),fe.current&&(fe.current=!1,q(ze=>ze+1)))}},X=async Q=>{if(C.current||te.current)return;const Se=new AbortController;C.current={name:Q,controller:Se,workspace:Hs()??"",projectId:ua()},W(Q),S(""),O(""),le(G=>{const he={...G};return delete he[Q],he});try{const G=await j0(Q,Se.signal);re.current&&!Se.signal.aborted&&le(he=>({...he,[Q]:G}))}catch(G){re.current&&!Se.signal.aborted&&k(G)}finally{C.current?.controller===Se&&(C.current=null),re.current&&W(null)}},E=async()=>{const Q=C.current;if(Q)try{await Hp(Q.name,Q.workspace,Q.projectId)}catch(Se){re.current&&k(Se)}finally{Q.controller.abort(),C.current===Q&&(C.current=null),re.current&&(W(null),le(Se=>({...Se,[Q.name]:{name:Q.name,status:"cancelled",checkedAt:new Date().toISOString(),durationMs:0,error:{code:"cancelled",message:"测试已取消。"}}})))}},ee=p||o||oe!==null,ge=F.trim().toLocaleLowerCase(),$=[...c?.servers??[]];z?.kind==="edit"&&!$.some(Q=>Q.name===z.name)&&$.push(z.original);const ae=$.filter(Q=>!ge||Q.name.toLocaleLowerCase().includes(ge)||z?.kind==="edit"&&z.name===Q.name),ke=z?.kind==="edit"?$.find(Q=>Q.name===z.name):void 0;return u.jsxs("div",{className:"hub-mcp",children:[u.jsxs("div",{className:"config-section-heading hub-mcp-toolbar",children:[u.jsxs("label",{className:"config-search",children:[u.jsx("span",{"aria-hidden":"true",children:"⌕"}),u.jsx("input",{type:"search",value:F,onChange:Q=>ue(Q.target.value),placeholder:"搜索 MCP 服务…","aria-label":"搜索 MCP 服务"})]}),u.jsxs("div",{className:"hub-mcp-toolbar-actions",children:[u.jsx("button",{className:"config-button config-button-quiet",disabled:ee,onClick:()=>q(Q=>Q+1),children:"刷新 MCP"}),u.jsx("button",{className:"config-button",disabled:ee||z!==null,onClick:()=>D({kind:"new"}),children:"+ 添加服务"})]})]}),v&&u.jsx("p",{className:"config-message config-error",role:"alert",children:v}),N&&u.jsx("p",{className:"config-message config-success",role:"status",children:N}),p&&u.jsx("p",{className:"config-help",role:"status",children:"正在保存 MCP 配置…"}),o&&!c&&u.jsx("p",{className:"config-help",role:"status",children:"正在读取 MCP 配置…"}),z?.kind==="new"&&u.jsxs("div",{className:"config-card hub-mcp-editor-card",children:[u.jsx("h2",{children:"添加 MCP 服务"}),u.jsx(Ip,{disabled:ee,save:A,onDone:()=>D(null),onProbe:Q=>{X(Q)},onDirtyChange:y})]}),!ae.length&&c&&z?.kind!=="new"&&u.jsxs("div",{className:"config-empty",children:[u.jsx("span",{"aria-hidden":"true",children:"⌘"}),u.jsx("h3",{children:ge?"没有匹配的服务":"连接你的工具与数据"}),u.jsx("p",{children:ge?"试试其他服务名称。":"添加运行 CodeShell 的设备上的命令,或连接提供 MCP 接口的 HTTP 服务。"})]}),u.jsx("div",{className:"hub-mcp-list",children:ae.map(Q=>u.jsxs("article",{className:"config-card hub-mcp-card",children:[u.jsxs("div",{className:"hub-mcp-card-head",children:[u.jsx("span",{className:"config-row-icon","aria-hidden":"true",children:"⌘"}),u.jsxs("div",{className:"config-row-copy",children:[u.jsx("strong",{children:Q.name}),u.jsxs("span",{children:[Q.transport==="stdio"?"本地命令":Q.transport==="inprocess"?"内置工具":"HTTP 服务"," ","· ",k0[Q.scope]]})]}),u.jsx("button",{className:"config-switch",type:"button",role:"switch","aria-checked":Q.enabled,"aria-label":`${Q.enabled?"停用":"启用"} MCP ${Q.name}`,disabled:ee||Q.pluginDisabled,onClick:()=>{A(Se=>v0(Q.name,!Q.enabled,Se))},children:u.jsx("span",{})})]}),z?.kind==="edit"&&z.name===Q.name&&ke?u.jsx(Ip,{server:ke,disabled:ee,save:A,onDone:()=>D(null),onProbe:Se=>{X(Se)},onDirtyChange:y},Q.name):u.jsxs(u.Fragment,{children:[u.jsxs("p",{className:"hub-mcp-endpoint",children:[u.jsx("code",{children:Q.transport==="stdio"?Q.command:Q.url||"由任务进程提供"}),Q.argsCount>0&&u.jsxs("span",{children:[Q.argsCount," 个已保存参数"]})]}),u.jsxs("div",{className:"hub-mcp-metadata",children:[u.jsx("span",{className:`config-badge${Q.enabled?" config-badge-accent":""}`,children:Q.enabled?"配置启用":"配置停用"}),Q.envKeys.length>0&&u.jsxs("span",{children:[Q.envKeys.length," 个环境变量"]}),(Q.headerKeys.length>0||Q.credentialRef||Q.bearerTokenEnvVar||Object.keys(Q.envHeaders).length>0)&&u.jsx("span",{children:"已配置认证"}),Q.hasLocalOverride&&u.jsx("span",{children:"本地覆盖"})]}),Q.source==="plugin"&&u.jsx("p",{className:"config-help",children:Q.pluginDisabled?"所属插件已停用。启用插件后,才能启用或测试这个服务。":"连接命令与地址由插件提供,可在此启停或测试。"}),u.jsxs("div",{className:"hub-mcp-card-actions",children:[oe===Q.name?u.jsx("button",{className:"config-button",onClick:()=>{E()},children:"取消测试"}):u.jsx("button",{className:"config-button",disabled:ee||Q.pluginDisabled||Q.transport==="inprocess",onClick:()=>{X(Q.name)},children:"测试连接"}),Q.editable&&u.jsx("button",{className:"config-button config-button-quiet",disabled:ee||z!==null,onClick:()=>{U(null),D({kind:"edit",name:Q.name,original:Q})},children:"编辑"}),Q.hasLocalOverride&&u.jsx("button",{className:"config-button config-button-quiet",disabled:ee,onClick:()=>{A(Se=>qp(Q.name,Se),"已移除本地覆盖,恢复继承配置。")},children:"恢复继承"}),Q.deletable&&u.jsx("button",{className:"config-button config-button-quiet hub-mcp-remove",disabled:ee||z!==null,onClick:()=>U(Q.name),children:"移除"})]}),R===Q.name&&u.jsxs("div",{className:"hub-mcp-delete",role:"alert",children:[u.jsxs("span",{children:["从当前工作区移除 ",Q.name,"?其他工作区的配置不受影响。"]}),u.jsxs("div",{children:[u.jsx("button",{className:"config-button config-button-quiet",disabled:ee,onClick:()=>U(null),children:"取消"}),u.jsx("button",{className:"config-button hub-mcp-remove",disabled:ee,onClick:async()=>{await A(Se=>S0(Q.name,Se),"已从当前工作区移除服务。")&&U(null)},children:"确认移除"})]})]}),oe===Q.name&&u.jsx("p",{className:"hub-mcp-probing",role:"status",children:"正在建立测试连接并读取工具列表…"}),L[Q.name]&&u.jsx(C0,{result:L[Q.name]})]})]},Q.name))}),!!c?.removed.length&&u.jsxs("details",{className:"hub-mcp-removed",children:[u.jsxs("summary",{children:["已在当前工作区移除(",c.removed.length,")"]}),c.removed.map(Q=>u.jsxs("div",{className:"hub-mcp-removed-row",children:[u.jsx("span",{children:Q.name}),u.jsx("button",{className:"config-button config-button-quiet",disabled:ee,onClick:()=>{A(Se=>qp(Q.name,Se),"已恢复继承的 MCP 配置。")},children:"恢复继承"})]},Q.name))]}),u.jsx("p",{className:"config-help hub-mcp-explanation",children:"连接使用运行 CodeShell 的设备上的网络、环境和凭据。测试只建立一次短连接并读取工具列表,完成后关闭;不会调用工具或改变启用状态。"})]})}function Ip({server:n,disabled:i,save:r,onDone:s,onProbe:c,onDirtyChange:d}){const o=j.useRef(n).current,[g,p]=j.useState(()=>m0(o)),m=j.useRef(JSON.stringify(g)).current,b=JSON.stringify(g)!==m;j.useEffect(()=>{d(b)},[b,d]),j.useEffect(()=>()=>d(!1),[d]);const[y,v]=j.useState(""),S=(z,D)=>p(R=>({...R,[z]:D})),N=g0(g,o),O=g.transport==="stdio";return u.jsx("form",{className:"hub-mcp-editor",onSubmit:async z=>{z.preventDefault(),v("");const D=z.nativeEvent.submitter?.getAttribute("data-probe")==="true";try{await r(R=>x0(g,o,R))&&(s(),D&&c(g.name.trim()))}catch(R){v(R instanceof Error?R.message:"请检查填写内容。")}},children:u.jsxs("fieldset",{disabled:i,children:[u.jsx("legend",{className:"config-sr-only",children:o?`编辑 MCP ${o.name}`:"新 MCP 服务"}),u.jsxs("div",{className:"config-form-grid",children:[u.jsxs("label",{children:[u.jsx("span",{children:"服务名称"}),u.jsx("input",{required:!0,readOnly:!!o,maxLength:128,pattern:"[A-Za-z0-9][A-Za-z0-9._:\\-]*",value:g.name,onChange:z=>S("name",z.target.value),placeholder:"例如 workspace-tools"})]}),u.jsxs("label",{children:[u.jsx("span",{children:"连接方式"}),u.jsxs("select",{"aria-label":"连接方式",value:g.transport,onChange:z=>S("transport",z.target.value),children:[u.jsx("option",{value:"stdio",children:"本地命令(stdio)"}),u.jsx("option",{value:"streamable-http",children:"HTTP(Streamable HTTP)"}),o?.transport==="sse"&&u.jsx("option",{value:"sse",children:"HTTP(已有 SSE 配置)"})]})]}),O?u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"启动命令"}),u.jsx("input",{required:!0,"aria-label":"启动命令",value:g.command,onChange:z=>S("command",z.target.value),placeholder:"例如 node、uvx 或可执行文件路径"}),u.jsx("small",{children:"在当前工作区执行。命令与参数分别填写。"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"命令参数"}),u.jsx("textarea",{"aria-label":"命令参数",rows:3,disabled:g.clearArgs,value:g.args,onChange:z=>S("args",z.target.value),placeholder:o?.argsCount?`已有 ${o.argsCount} 个参数,留空保留。填写后将完整替换。`:"每行一个参数,不需要额外添加引号",autoComplete:"off",spellCheck:!1}),u.jsx("small",{children:"参数可能含密钥,因此不会读回已有值。每一行会作为一个完整参数。"})]}),!!o?.argsCount&&u.jsxs("label",{className:"hub-mcp-check config-full-width",children:[u.jsx("input",{type:"checkbox",checked:g.clearArgs,onChange:z=>S("clearArgs",z.target.checked)}),u.jsx("span",{children:"清空已保存的所有参数"})]})]}):u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"MCP 接口地址"}),u.jsx("input",{type:"url","aria-label":"MCP 接口地址",required:!0,value:g.url,onChange:z=>S("url",z.target.value),placeholder:"https://example.com/mcp"}),o?.urlHasHiddenParts&&u.jsx("small",{children:"已有地址的查询参数已隐藏;不修改地址时会保留。"})]})]}),O?u.jsx(vc,{title:"环境变量",rows:g.env,onChange:z=>S("env",z)}):u.jsx(vc,{title:"请求头",rows:g.headers,onChange:z=>S("headers",z)}),u.jsxs("details",{className:"hub-mcp-advanced",children:[u.jsx("summary",{children:"高级配置"}),u.jsx("div",{className:"config-form-grid",children:O?u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"转发运行环境变量"}),u.jsx("textarea",{"aria-label":"转发运行环境变量",rows:2,value:g.envVars,onChange:z=>S("envVars",z.target.value),placeholder:"每行一个环境变量名称,例如 GITHUB_TOKEN"}),u.jsx("small",{children:"只填写名称,实际值在连接时从CodeShell 的启动环境读取。"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("label",{children:[u.jsx("span",{children:"Bearer Token 环境变量"}),u.jsx("input",{"aria-label":"Bearer Token 环境变量",value:g.bearerTokenEnvVar,onChange:z=>S("bearerTokenEnvVar",z.target.value),placeholder:"例如 MCP_ACCESS_TOKEN",autoComplete:"off"}),u.jsx("small",{children:"填写运行环境中的变量名称。"})]}),u.jsxs("label",{children:[u.jsx("span",{children:"已存储的凭据 ID"}),u.jsx("input",{"aria-label":"已存储的凭据 ID",value:g.credentialRef,onChange:z=>S("credentialRef",z.target.value),placeholder:"可选",autoComplete:"off"}),u.jsx("small",{children:"引用已有凭据;优先于 Bearer 环境变量。"})]})]})}),!O&&u.jsx(vc,{title:"环境变量请求头",rows:g.envHeaders,onChange:z=>S("envHeaders",z),visibleValues:!0}),u.jsxs("label",{className:"hub-mcp-check",children:[u.jsx("input",{type:"checkbox",checked:g.restrictTools,onChange:z=>S("restrictTools",z.target.checked)}),u.jsx("span",{children:"只允许指定工具"})]}),u.jsxs("div",{className:"config-form-grid",children:[g.restrictTools&&u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"允许的工具名称"}),u.jsx("textarea",{rows:2,value:g.allowedTools,onChange:z=>S("allowedTools",z.target.value),placeholder:"每行一个精确工具名称;留空则不开放任何工具"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"停用的工具名称"}),u.jsx("textarea",{rows:2,value:g.disabledTools,onChange:z=>S("disabledTools",z.target.value),placeholder:"每行一个精确工具名称,可留空"})]})]})]}),u.jsxs("label",{className:"hub-mcp-check",children:[u.jsx("input",{type:"checkbox",checked:g.enabled,onChange:z=>S("enabled",z.target.checked)}),u.jsx("span",{children:"启用服务,让任务可以使用这些工具"})]}),N&&u.jsxs("label",{className:"hub-mcp-check hub-mcp-reuse",children:[u.jsx("input",{type:"checkbox",required:!0,checked:g.reuseStoredSecrets,onChange:z=>S("reuseStoredSecrets",z.target.checked)}),u.jsx("span",{children:"允许新的启动方式或服务地址使用已保存的参数、环境变量和认证配置。"})]}),y&&u.jsx("p",{className:"config-error config-message",role:"alert",children:y}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{type:"button",className:"config-button config-button-quiet",onClick:s,children:"取消"}),u.jsx("button",{type:"submit","data-probe":"true",className:"config-button",children:"保存并测试"}),u.jsx("button",{type:"submit",className:"config-button config-button-primary",children:"保存配置"})]})]})})}function vc({title:n,rows:i,onChange:r,visibleValues:s=!1}){const c=(d,o)=>r(i.map(g=>g.id===d?{...g,...o}:g));return u.jsxs("div",{className:"hub-mcp-keys",children:[u.jsxs("div",{className:"hub-mcp-key-heading",children:[u.jsx("h3",{children:n}),u.jsxs("button",{className:"config-text-button",type:"button",onClick:()=>r([...i,{id:da(),name:"",value:"",stored:!1,removed:!1}]),children:["+ 添加",n]})]}),!i.length&&u.jsx("p",{className:"config-help",children:s?"可按请求头名称引用运行环境变量。":"无需此项时可以留空。"}),i.map(d=>u.jsxs("div",{className:`hub-mcp-key-row${d.removed?" hub-mcp-key-removed":""}`,children:[u.jsxs("label",{children:[u.jsxs("span",{className:"config-sr-only",children:[n,"名称"]}),u.jsx("input",{"aria-label":`${n}名称`,value:d.name,readOnly:d.stored,disabled:d.removed,onChange:o=>c(d.id,{name:o.target.value}),placeholder:n==="环境变量"?"例如 API_KEY":"例如 Authorization",autoComplete:"off"})]}),u.jsxs("label",{children:[u.jsxs("span",{className:"config-sr-only",children:[n,"值"]}),u.jsx("input",{"aria-label":`${n} ${d.name||"新条目"} 的值`,type:s?"text":"password",value:d.value,disabled:d.removed,onChange:o=>c(d.id,{value:o.target.value}),placeholder:d.removed?"保存时移除":s?"运行环境变量名称":d.stored?"已配置 · 留空保留":"输入值",autoComplete:s?"off":"new-password",spellCheck:!1})]}),u.jsx("button",{className:"config-button config-button-quiet",type:"button",onClick:()=>d.stored?c(d.id,{removed:!d.removed}):r(i.filter(o=>o.id!==d.id)),children:d.removed?"撤销移除":"移除"})]},d.id)),!!i.length&&!s&&u.jsx("p",{className:"config-help",children:"已有值保留在运行 CodeShell 的设备上;留空保留,填写新值替换,点击“移除”后保存才能删除。"})]})}function C0({result:n}){return u.jsxs("div",{className:`hub-mcp-probe-result hub-mcp-probe-${n.status}`,role:"status",children:[u.jsxs("div",{className:"hub-mcp-probe-summary",children:[u.jsx("strong",{children:n.status==="ok"?"测试连接成功":n.status==="cancelled"?"测试已取消":"连接测试失败"}),u.jsxs("span",{children:[new Date(n.checkedAt).toLocaleTimeString()," ·"," ",n.durationMs<1e3?`${n.durationMs} ms`:`${(n.durationMs/1e3).toFixed(1)} 秒`]})]}),n.error&&u.jsx("p",{children:n.error.message}),n.status==="ok"&&u.jsxs(u.Fragment,{children:[u.jsxs("p",{children:["发现 ",n.toolCount??0," 个工具",n.truncated?"(列表已截取)":"","。测试连接现已关闭。"]}),!!n.tools?.length&&u.jsxs("details",{children:[u.jsx("summary",{children:"查看工具列表"}),u.jsx("ul",{children:n.tools.map((i,r)=>u.jsxs("li",{children:[u.jsxs("div",{children:[u.jsx("code",{children:i.name}),!i.allowed&&u.jsx("span",{className:"config-badge",children:"被工具策略停用"})]}),i.description&&u.jsx("p",{children:i.description})]},`${i.name}-${r}`))})]})]})]})}const E0={overview:{title:"设置",description:"管理当前工作区的模型、Skills 和工具连接。"},models:{title:"模型与连接",description:"选择默认模型,管理工作区使用的服务商连接与凭据。"},skills:{title:"Skills",description:"让 CodeShell 按照你熟悉的工作方式完成任务。"},mcp:{title:"MCP 工具",description:"管理工具连接,测试连接并查看可用工具。"}};function N0(n){return n.section==="skills"?u.jsx(c0,{onAuthLost:n.onAuthLost,onDirtyChange:n.onDirtyChange,onChanged:n.onConfigurationChange,configurationVersion:n.configurationVersion}):u.jsx(T0,{...n})}function T0({host:n="hub",section:i,onSectionChange:r,onAuthLost:s,onDirtyChange:c,onConfigurationChange:d,configurationVersion:o=0}){const[g,p]=j.useState(null),[m,b]=j.useState(!0),[y,v]=j.useState(""),[S,N]=j.useState(""),[O,z]=j.useState(null),[D,R]=j.useState(0),U=j.useRef({onAuthLost:s,onConfigurationChange:d});U.current={onAuthLost:s,onConfigurationChange:d};const F=j.useRef(!1),ue=j.useRef(0),L=j.useRef(null),le=j.useRef(null),oe=j.useRef(!1),W=j.useRef(o),T=j.useCallback(re=>{re instanceof Xe&&re.status===401?U.current.onAuthLost():v(ny(re))},[]);j.useEffect(()=>{o!==W.current&&(W.current=o,le.current?oe.current=!0:R(re=>re+1))},[o]),j.useEffect(()=>(F.current=!0,()=>{F.current=!1,le.current?.abort()}),[]),j.useEffect(()=>{const re=new AbortController;L.current=re;const me=++ue.current;return b(!0),v(""),ty(re.signal).then(te=>{!re.signal.aborted&&me===ue.current&&p(te)}).catch(te=>{!re.signal.aborted&&me===ue.current&&T(te)}).finally(()=>{!re.signal.aborted&&me===ue.current&&b(!1)}),()=>re.abort()},[D,T]);const q=async(re,me)=>{if(le.current)return!1;L.current?.abort();const te=++ue.current,C=new AbortController;le.current=C,b(!1),z(re),v(""),N("");try{const Y=await me(C.signal);return!F.current||C.signal.aborted||te!==ue.current?!1:(p(Y),N(Y.restartRequired?"设置已保存,重启服务后生效。":"设置已保存,下次运行任务时生效。"),U.current.onConfigurationChange?.(),!0)}catch(Y){return Y instanceof Xe&&Y.status===409&&(oe.current=!0),F.current&&!C.signal.aborted&&T(Y),!1}finally{le.current===C&&(le.current=null),F.current&&!C.signal.aborted&&(z(null),oe.current&&(oe.current=!1,R(Y=>Y+1)))}},H=E0[i];return u.jsxs("section",{className:"hub-settings","aria-labelledby":"hub-settings-title",children:[u.jsxs("div",{className:"hub-settings-heading",children:[u.jsxs("div",{children:[u.jsx("span",{className:"hub-settings-eyebrow",children:n==="desktop"?"桌面工作区":"服务端工作区"}),u.jsx("h1",{id:"hub-settings-title",children:H.title}),u.jsx("p",{children:H.description})]}),u.jsx("button",{className:"config-button config-button-quiet",disabled:m||O!==null,onClick:()=>{N(""),R(re=>re+1)},children:m?"读取中…":"刷新"})]}),y&&u.jsx("div",{className:"config-message config-error",role:"alert",children:y}),S&&u.jsx("div",{className:"config-message config-success",role:"status",children:S}),O&&u.jsxs("p",{className:"config-loading",role:"status",children:["正在保存",O,"…"]}),!g&&m?u.jsx("p",{className:"config-loading",role:"status",children:"正在读取工作区设置…"}):null,g&&u.jsxs(u.Fragment,{children:[i==="overview"&&u.jsx(A0,{host:n,configuration:g,onSectionChange:r}),i==="models"&&u.jsx(z0,{configuration:g,disabled:O!==null||m,saving:O!==null,save:q,onDirtyChange:c,onAuthLost:s}),i==="mcp"&&u.jsx(w0,{onAuthLost:s,onDirtyChange:c,onConfigurationChange:d,configurationVersion:o}),u.jsx("p",{className:"config-scope-note",children:"配置作用于当前工作区,所有连接到这里的设备共用。"})]})]})}function A0({host:n,configuration:i,onSectionChange:r}){const s=i.connections.find(o=>o.id===i.defaults.text),c=i.skills.filter(o=>o.enabled).length,d=[{section:"models",title:"模型与连接",summary:s?`${s.id} · ${s.model}`:"尚未设置默认模型",icon:"◈"},{section:"skills",title:"Skills",summary:`${i.skills.length} 个可用 · ${c} 个已启用`,icon:"✧"},{section:"mcp",title:"MCP 工具",summary:`${i.mcpServers.length} 个已配置的工具服务`,icon:"⌘"}];return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"config-workspace-card",children:[u.jsx("span",{className:"config-workspace-icon","aria-hidden":"true",children:"▱"}),u.jsxs("div",{children:[u.jsx("strong",{children:"当前工作区"}),u.jsx("code",{children:i.workspace.path}),u.jsx("p",{children:n==="desktop"?"对话、文件操作和工具都由已连接的桌面端执行。":"对话、文件操作和工具都在服务端运行。"})]}),u.jsx("span",{className:"config-badge",children:n==="desktop"?"桌面工作区":"服务端工作区"})]}),u.jsx("h2",{className:"config-section-title",children:"工作区配置"}),u.jsx("div",{className:"config-card config-overview-list",children:d.map(o=>{const g=u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"config-row-icon","aria-hidden":"true",children:o.icon}),u.jsxs("span",{className:"config-row-copy",children:[u.jsx("strong",{children:o.title}),u.jsx("span",{children:o.summary})]}),r&&u.jsx("span",{className:"config-chevron","aria-hidden":"true",children:"›"})]});return r?u.jsx("button",{className:"config-overview-row",onClick:()=>r(o.section),children:g},o.section):u.jsx("div",{className:"config-overview-row",children:g},o.section)})}),u.jsxs("div",{className:"config-explanation",children:[u.jsx("h2",{children:"工作区与执行位置"}),u.jsx("p",{children:n==="desktop"?"这里直接使用桌面端的任务、模型、Skills 和工具连接。修改配置后,桌面窗口和已配对的网页共同使用。":"这里使用服务端的任务、模型、Skills 和工具连接。修改配置后,连接到这个服务端的网页共同使用。"}),u.jsx("p",{children:n==="desktop"?"切换项目会切换对应的文件、历史和工作区设置;无需复制桌面配置。":"独立部署使用自己的运行环境。部署到另一台机器时,需要迁移配置和数据,或在这里重新设置。"})]})]})}function z0({configuration:n,disabled:i,saving:r,save:s,onDirtyChange:c,onAuthLost:d}){const[o,g]=j.useState(null),[p,m]=j.useState(null),[b,y]=j.useState(""),[v,S]=j.useState(!1),[N,O]=j.useState(!1),[z,D]=j.useState(null),[R,U]=j.useState({}),F=j.useRef(null),ue=n.connections.filter(T=>T.tag==="text"),L=n.connections.length-ue.length,le=i||!!z;j.useEffect(()=>{p&&!n.connections.some(T=>T.id===p.id)&&m(null)},[n.connections,p]),j.useEffect(()=>()=>F.current?.abort(),[]);const oe=j.useRef(new Map);j.useEffect(()=>{const T=new Map(n.connections.map(H=>[H.id,H.revision??JSON.stringify(H)])),q=new Set([...oe.current].filter(([H,re])=>T.get(H)!==re).map(([H])=>H));oe.current=T,z&&q.has(z)&&F.current?.abort(),q.size&&U(H=>Object.fromEntries(Object.entries(H).filter(([re])=>!q.has(re))))},[n,z]),j.useEffect(()=>(c?.(v||N||r||!!z),()=>c?.(!1)),[v,N,r,z,c]);const W=async T=>{if(F.current)return;const q=new AbortController;F.current=q,D(T.id),U(H=>({...H,[T.id]:"正在发送一条简短测试请求…"}));try{const H=await e0(T.id,q.signal);q.signal.aborted||U(re=>({...re,[T.id]:H}))}catch(H){q.signal.aborted||(H instanceof Xe&&H.status===401?d():U(re=>({...re,[T.id]:ny(H)})))}finally{F.current===q&&(F.current=null,D(null))}};return u.jsxs(u.Fragment,{children:[u.jsx(R0,{configuration:n,disabled:le,save:s,onDirtyChange:O}),u.jsxs("div",{className:"config-section-heading",children:[u.jsxs("h2",{children:["文字模型连接 ",u.jsx("span",{className:"config-count",children:ue.length})]}),u.jsxs("button",{className:"config-button",disabled:le||o!==null||p!==null||!n.catalog.length,onClick:()=>g("__new__"),children:[u.jsx("span",{"aria-hidden":"true",children:"+"})," 添加连接"]})]}),o!==null&&u.jsxs("div",{className:"config-card config-editor-card",children:[u.jsx("h3",{children:o==="__new__"?"添加模型连接":`编辑 ${o.id}`}),u.jsx(D0,{connection:o==="__new__"?void 0:o,configuration:n,disabled:le,save:s,onDone:()=>g(null),onDirtyChange:S},o==="__new__"?"new":o.id)]}),!ue.length&&o!=="__new__"&&u.jsx(_0,{title:"还没有文字模型连接",description:"添加服务商地址、模型名称和 API Key,再选择一个默认模型。"}),u.jsx("div",{className:"config-connection-list",children:ue.map(T=>{const q=n.catalog.find(C=>C.id===T.catalogId),H=p?.id===T.id,re=H&&p?.revision!==T.revision,me=n.defaults.text===T.id&&ue.length>1,te=R[T.id];return u.jsxs("article",{className:"config-card config-connection-card",children:[u.jsxs("div",{className:"config-connection-head",children:[u.jsx("span",{className:"config-model-icon","aria-hidden":"true",children:"◈"}),u.jsxs("div",{className:"config-row-copy",children:[u.jsx("strong",{children:T.id}),u.jsx("span",{children:q?.displayName??T.catalogId})]}),n.defaults.text===T.id&&u.jsx("span",{className:"config-badge config-badge-accent",children:"默认"}),u.jsx("button",{className:"config-button config-button-quiet",disabled:le||o!==null||p!==null,onClick:()=>g(T),children:"编辑"})]}),u.jsxs("dl",{className:"config-connection-facts",children:[u.jsxs("div",{children:[u.jsx("dt",{children:"模型"}),u.jsx("dd",{children:T.model||"未填写"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"服务地址"}),u.jsx("dd",{children:T.baseUrl||q?.defaultBaseUrl||"服务商默认地址"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"API Key"}),u.jsx("dd",{children:T.hasApiKey?"•••••••• · 已配置":T.needsKey?"未配置":"无需 API Key"})]})]}),u.jsxs("div",{className:"config-model-actions",children:[z===T.id?u.jsx("button",{className:"config-button",onClick:()=>{F.current?.abort(),U(C=>({...C,[T.id]:"已取消连接测试。"}))},children:"取消测试"}):u.jsx("button",{className:"config-button",disabled:le||o!==null||p!==null,onClick:()=>{W(T)},children:"测试连接"}),u.jsx("span",{className:"config-help",children:"发送一条简短请求,服务商可能计费。"}),u.jsx("button",{className:"config-button config-button-quiet config-remove-connection",disabled:le||o!==null||p!==null,onClick:()=>{m(T),y("")},children:"删除"})]}),te&&u.jsxs("div",{className:`config-probe-result ${typeof te!="string"&&te.ok?"is-success":""}`,role:"status",children:[u.jsx("span",{children:typeof te=="string"?te:te.message}),typeof te!="string"&&u.jsxs("small",{children:[Math.max(.01,te.latencyMs/1e3).toFixed(2)," 秒 ·"," ",new Date(te.checkedAt).toLocaleTimeString()]})]}),H&&u.jsxs("div",{className:"config-remove-confirm",children:[u.jsxs("h3",{children:["删除连接 ",T.id,"?"]}),u.jsx("p",{children:"连接会从当前工作区移除,已有对话记录会保留。"}),re&&u.jsx("p",{role:"alert",children:"连接已被其他设备更新,请取消后重新检查再删除。"}),ue.length===1&&u.jsx("p",{children:"这是最后一个文字模型连接。删除后需重新添加连接才能继续对话。"}),me&&u.jsxs("label",{children:[u.jsx("span",{children:"替代默认模型"}),u.jsxs("select",{"aria-label":"替代默认模型",value:b,onChange:C=>y(C.target.value),disabled:le,children:[u.jsx("option",{value:"",children:"请选择其他连接"}),ue.filter(C=>C.id!==T.id).map(C=>u.jsxs("option",{value:C.id,children:[C.id," · ",C.model]},C.id))]})]}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{className:"config-button",disabled:le,onClick:()=>m(null),children:"取消删除"}),u.jsx("button",{className:"config-button config-button-danger",disabled:le||re||me&&!b,onClick:()=>{s("删除连接",C=>Wv(T.id,b||void 0,C,p?.revision)).then(C=>{C&&m(null)})},children:"确认删除连接"})]})]})]},T.id)})}),L>0&&u.jsxs("p",{className:"config-help",children:["另有 ",L," 个其他类型的模型连接,保留在工作区配置中。目前此处提供文字模型编辑。"]})]})}function R0({configuration:n,disabled:i,save:r,onDirtyChange:s}){const[c,d]=j.useState(n.defaults.text??""),[o,g]=j.useState(n.defaults.auxText??""),p=j.useRef(n.defaults);j.useEffect(()=>{const y=p.current;p.current=n.defaults,d(v=>v===(y.text??"")?n.defaults.text??"":v),g(v=>v===(y.auxText??"")?n.defaults.auxText??"":v)},[n.defaults]);const m=n.connections.filter(y=>y.tag==="text"),b=c!==(n.defaults.text??"")||o!==(n.defaults.auxText??"");return j.useEffect(()=>(s(b),()=>s(!1)),[b,s]),u.jsx("form",{className:"config-card config-defaults",onSubmit:y=>{y.preventDefault(),r("默认模型",v=>Jv({text:c,auxText:o||null},v))},children:u.jsxs("fieldset",{disabled:i||!m.length,children:[u.jsx("legend",{children:"默认模型"}),u.jsxs("div",{className:"config-form-grid",children:[u.jsxs("label",{children:[u.jsx("span",{children:"对话模型"}),u.jsxs("select",{required:!0,value:c,onChange:y=>d(y.target.value),"aria-label":"默认对话模型",children:[u.jsx("option",{value:"",disabled:!0,children:"选择模型连接"}),c&&!m.some(y=>y.id===c)&&u.jsxs("option",{value:c,disabled:!0,children:[c,"(连接不可用)"]}),m.map(y=>u.jsxs("option",{value:y.id,children:[y.id," · ",y.model]},y.id))]})]}),u.jsxs("label",{children:[u.jsx("span",{children:"辅助模型"}),u.jsxs("select",{value:o,onChange:y=>g(y.target.value),"aria-label":"默认辅助模型",children:[u.jsx("option",{value:"",children:"跟随对话模型"}),o&&!m.some(y=>y.id===o)&&u.jsxs("option",{value:o,disabled:!0,children:[o,"(连接不可用)"]}),m.map(y=>u.jsxs("option",{value:y.id,children:[y.id," · ",y.model]},y.id))]})]})]}),u.jsxs("div",{className:"config-form-footer",children:[u.jsx("p",{className:"config-help",children:"辅助模型用于标题生成等轻量任务。"}),u.jsx("button",{className:"config-button",disabled:!b||!c,type:"submit",children:"保存默认模型"})]})]})})}function D0({connection:n,configuration:i,disabled:r,save:s,onDone:c,onDirtyChange:d}){const[o,g]=j.useState(()=>{const R=bc(n);return n||(R.catalogId=i.catalog[0]?.id??""),R}),p=j.useRef(o),m=JSON.stringify(o)!==JSON.stringify(p.current),[b,y]=j.useState(!1),v=n?i.connections.find(R=>R.id===n.id):void 0,S=!!n&&(!v||o.expectedRevision!==v.revision);j.useEffect(()=>{if(!m&&v&&o.expectedRevision!==v.revision){const R=bc(v);p.current=R,g(R)}},[m,v,o.expectedRevision]);const N=()=>{if(!v)return;const R=bc(v);p.current=R,g(R),y(!1)};j.useEffect(()=>(d(m),()=>d(!1)),[m,d]);const O=i.catalog.find(R=>R.id===o.catalogId),z=!n&&i.connections.some(R=>R.id===o.id.trim()),D=(R,U)=>g(F=>({...F,[R]:U}));return u.jsx("form",{className:"config-connection-editor",onSubmit:async R=>{R.preventDefault(),!S&&await s("模型连接",U=>Fv(o,U))&&c()},children:u.jsxs("fieldset",{disabled:r,children:[u.jsx("legend",{className:"config-sr-only",children:n?`编辑 ${n.id}`:"新模型连接"}),S&&u.jsxs("div",{className:"config-remove-confirm",role:"alert",children:[u.jsx("p",{children:v?"其他设备已更新这个连接。你的草稿已保留,请检查最新设置后再保存。":"这个连接已被其他设备删除。草稿仍保留,你可以复制内容后关闭编辑。"}),v&&u.jsx("button",{className:"config-button",type:"button",onClick:N,children:"放弃草稿并载入最新设置"})]}),u.jsxs("div",{className:"config-form-grid",children:[u.jsxs("label",{children:[u.jsx("span",{children:"连接名称"}),u.jsx("input",{required:!0,maxLength:120,value:o.id,readOnly:!!n,onChange:R=>D("id",R.target.value),placeholder:"例如 work-model",autoComplete:"off"})]}),u.jsxs("label",{children:[u.jsx("span",{children:"服务商"}),u.jsxs("select",{required:!0,disabled:!!n,"aria-label":"服务商",value:o.catalogId,onChange:R=>D("catalogId",R.target.value),children:[n&&!O&&u.jsx("option",{value:o.catalogId,children:o.catalogId}),i.catalog.map(R=>u.jsx("option",{value:R.id,children:R.displayName},R.id))]})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"模型名称"}),u.jsx("input",{required:!0,maxLength:240,value:o.model,onChange:R=>D("model",R.target.value),placeholder:"服务商提供的模型 ID",autoComplete:"off"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"服务地址"}),u.jsx("input",{type:"url","aria-label":"服务地址",value:o.baseUrl,onChange:R=>D("baseUrl",R.target.value),placeholder:O?.defaultBaseUrl||"使用服务商默认地址",autoComplete:"off"}),u.jsx("small",{children:"留空使用服务商默认地址,支持兼容接口。"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsxs("span",{children:["API Key ",n?.hasApiKey&&u.jsx("span",{className:"config-field-meta",children:"已配置"})]}),u.jsx("input",{type:"password","aria-label":"API Key",required:O?.needsKey&&!n?.hasApiKey,value:o.apiKey,onChange:R=>D("apiKey",R.target.value),placeholder:n?.hasApiKey?"留空保留现有 API Key":O?.needsKey?"输入 API Key":"可选",autoComplete:"new-password",spellCheck:!1}),u.jsx("small",{children:n?.hasApiKey?"现有密钥保留在运行 CodeShell 的设备上,输入新值可替换。":"密钥保存在当前工作区配置中。"})]})]}),z&&u.jsx("p",{className:"config-error config-message",role:"alert",children:"连接名称已存在,请使用其他名称或编辑现有连接。"}),u.jsx("p",{className:"config-help",children:"保存后可在连接卡片中测试实际连接。"}),b&&u.jsxs("div",{className:"config-remove-confirm",role:"alert",children:[u.jsx("p",{children:"还有未保存的修改,确定放弃?"}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{type:"button",className:"config-button",onClick:()=>y(!1),children:"继续编辑"}),u.jsx("button",{type:"button",className:"config-button config-button-danger",onClick:c,children:"放弃修改"})]})]}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{type:"button",className:"config-button config-button-quiet",onClick:()=>m?y(!0):c(),children:"取消"}),u.jsx("button",{type:"submit",className:"config-button config-button-primary",disabled:z||S,children:"保存连接"})]})]})})}function _0({title:n,description:i}){return u.jsxs("div",{className:"config-empty",children:[u.jsx("span",{"aria-hidden":"true",children:"◇"}),u.jsx("h3",{children:n}),u.jsx("p",{children:i})]})}function Sc(n,i=!1){return yt(`/api/v1/files/content?path=${encodeURIComponent(n)}${i?"&inline=true":""}`)}function Yp(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function O0({initialPath:n,openVersion:i=0,onAuthLost:r}){const[s,c]=j.useState(""),[d,o]=j.useState(null),[g,p]=j.useState(null),[m,b]=j.useState(!1),[y,v]=j.useState(!1),[S,N]=j.useState(""),[O,z]=j.useState(0),[D,R]=j.useState(""),U=j.useRef(null),F=j.useRef(r);F.current=r;const ue=j.useCallback(W=>{W instanceof Xe&&W.status===401?F.current():N(W instanceof Error?W.message:"文件读取失败,请重试。")},[]);j.useEffect(()=>{const W=new AbortController;return b(!0),N(""),Ie(`/api/v1/files?path=${encodeURIComponent(s)}`,{signal:W.signal}).then(T=>{W.signal.aborted||o(T)}).catch(T=>{W.signal.aborted||ue(T)}).finally(()=>{W.signal.aborted||b(!1)}),()=>W.abort()},[s,O,ue]);const L=j.useCallback((W,T=!1)=>{U.current?.abort();const q=new AbortController;U.current=q,p(null),v(!0),N(""),Ie(`${Sc(W)}&preview=true`,{signal:q.signal}).then(H=>{q.signal.aborted||(T&&c(H.path.split("/").slice(0,-1).join("/")),p(H))}).catch(H=>{q.signal.aborted||ue(H)}).finally(()=>{q.signal.aborted||v(!1)})},[ue]);j.useEffect(()=>{n&&L(n,!0)},[n,i,L]),j.useEffect(()=>()=>U.current?.abort(),[]);const le=W=>{U.current?.abort(),v(!1),p(null),c(W),R("")},oe=d?.files.filter(W=>W.name.toLocaleLowerCase().includes(D.toLocaleLowerCase()))??[];return u.jsxs("section",{className:"hub-library hub-files","aria-labelledby":"hub-files-heading",children:[u.jsxs("header",{className:"library-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{id:"hub-files-heading",children:"工作区文件"}),u.jsx("p",{children:"查看任务生成的内容,下载到当前设备。"})]}),u.jsx("button",{className:"library-button",onClick:()=>{z(W=>W+1),g&&L(g.path)},children:"刷新"})]}),S?u.jsx("div",{className:"library-error",role:"alert",children:S}):null,u.jsxs("nav",{className:"file-breadcrumbs","aria-label":"文件位置",children:[u.jsx("button",{onClick:()=>le(""),children:"工作区"}),(d?.path??s).split("/").filter(Boolean).map((W,T,q)=>u.jsxs(j.Fragment,{children:[u.jsx("span",{"aria-hidden":"true",children:"/"}),u.jsx("button",{onClick:()=>le(q.slice(0,T+1).join("/")),children:W})]},T))]}),u.jsxs("div",{className:`file-columns${g||y?" has-preview":""}`,children:[u.jsxs("div",{className:"file-directory",children:[u.jsxs("label",{className:"library-search",children:[u.jsx("span",{className:"sr-only",children:"筛选当前文件夹"}),u.jsx("input",{type:"search",placeholder:"筛选当前文件夹…",value:D,onChange:W=>R(W.target.value)})]}),u.jsx("div",{className:"file-entries","aria-busy":m,children:m?u.jsx("p",{className:"library-empty",role:"status",children:"正在读取文件…"}):oe.length===0?u.jsx("p",{className:"library-empty",children:D?"没有匹配的文件。":"这个文件夹还没有文件。"}):oe.map(W=>u.jsxs("button",{className:`file-entry${g?.path===W.path?" selected":""}`,onClick:()=>W.kind==="directory"?le(W.path):L(W.path),children:[u.jsx("span",{className:"file-glyph","aria-hidden":"true",children:W.kind==="directory"?"▱":"▤"}),u.jsx("span",{className:"file-entry-name",children:W.name}),u.jsx("span",{className:"file-entry-size",children:W.kind==="directory"?"文件夹":Yp(W.size)})]},W.path))}),d?.truncated?u.jsx("p",{className:"library-hint",children:"这里只显示前 500 项。可以进入子文件夹继续查看。"}):null]}),y||g?u.jsxs("article",{className:"file-preview","aria-label":"文件预览",children:[u.jsxs("header",{children:[u.jsxs("div",{children:[u.jsx("strong",{children:g?.name??"正在打开…"}),g?u.jsx("span",{children:Yp(g.size)}):null]}),u.jsxs("div",{className:"library-actions",children:[g?u.jsx("a",{className:"library-button",href:Sc(g.path),download:!0,children:"下载"}):null,u.jsx("button",{className:"library-button",onClick:()=>{U.current?.abort(),v(!1),p(null)},children:"关闭预览"})]})]}),y?u.jsx("p",{className:"library-empty",role:"status",children:"正在读取内容…"}):g?.kind==="text"?u.jsxs(u.Fragment,{children:[u.jsx("pre",{tabIndex:0,children:g.content}),g.truncated?u.jsx("p",{className:"library-hint",children:"预览显示前 512 KB,下载可获取完整内容。"}):null]}):g?.kind==="image"?u.jsx("img",{src:Sc(g.path,!0),alt:g.name,onError:()=>N("图片无法预览,可以下载后打开。")}):u.jsx("div",{className:"library-empty",children:"这个文件暂不支持直接预览,可以下载后打开。"})]}):null]})]})}async function Vc(n={}){const i=new URLSearchParams({archived:n.archived??"false",limit:"50"});return n.query&&i.set("query",n.query),n.cursor&&i.set("cursor",n.cursor),Ie(`/api/v1/sessions?${i}`,{signal:n.signal})}function Gp(n,i="markdown"){return yt(`/api/v1/sessions/${encodeURIComponent(n)}/export?format=${i}`)}function M0({onAuthLost:n,onOpen:i,onChanged:r,version:s=0,onDirtyChange:c}){const[d,o]=j.useState(""),[g,p]=j.useState(""),[m,b]=j.useState("false"),[y,v]=j.useState([]),[S,N]=j.useState(null),[O,z]=j.useState(!0),[D,R]=j.useState(!1),[U,F]=j.useState(""),[ue,L]=j.useState(""),[le,oe]=j.useState(0),[W,T]=j.useState(""),[q,H]=j.useState(null),re=j.useRef(null),me=j.useRef(null),te=j.useRef(null),C=j.useRef(null);j.useEffect(()=>{q?.id&&re.current?.focus()},[q?.id]),j.useEffect(()=>{q?.error&&me.current?.focus()},[q?.error]);const Y=()=>{H(null),requestAnimationFrame(()=>{te.current?.isConnected?te.current.focus():C.current?.focus()})};j.useEffect(()=>{c?.(!!q||!!W)},[q,W,c]),j.useEffect(()=>()=>c?.(!1),[c]);const fe=j.useRef(null),be=j.useRef(null),k=j.useRef({onAuthLost:n,onChanged:r,onOpen:i});k.current={onAuthLost:n,onChanged:r,onOpen:i};const A=j.useCallback($=>{$ instanceof Xe&&$.status===401?k.current.onAuthLost():F($ instanceof Error?$.message:"会话操作失败,请重试。")},[]);j.useEffect(()=>{const $=setTimeout(()=>p(d.trim()),200);return()=>clearTimeout($)},[d]),j.useEffect(()=>{fe.current?.abort();const $=new AbortController;return fe.current=$,z(!0),R(!1),F(""),Vc({query:g,archived:m,signal:$.signal}).then(ae=>{$.signal.aborted||(v(ae.sessions),N(ae.nextCursor))}).catch(ae=>{$.signal.aborted||A(ae)}).finally(()=>{$.signal.aborted||z(!1)}),()=>$.abort()},[g,m,s,le,A]),j.useEffect(()=>()=>{fe.current?.abort(),be.current?.abort()},[]);const X=()=>{if(!S||D||O)return;const $=new AbortController;fe.current?.abort(),fe.current=$,R(!0),Vc({query:g,archived:m,cursor:S,signal:$.signal}).then(ae=>{$.signal.aborted||(v(ke=>{const Q=new Set(ke.map(Se=>Se.sessionId));return[...ke,...ae.sessions.filter(Se=>!Q.has(Se.sessionId))]}),N(ae.nextCursor))}).catch(ae=>{$.signal.aborted||A(ae)}).finally(()=>{$.signal.aborted||R(!1)})},E=async($,ae,ke=!1)=>{if(be.current)return;const Q=new AbortController;be.current=Q,T($),F(""),L(""),"title"in ae&&H(Se=>Se&&{...Se,error:""});try{if(await Ie(`/api/v1/sessions/${encodeURIComponent($)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(ae),signal:Q.signal}),Q.signal.aborted)return;"title"in ae?(Y(),L(ae.title?"标题已保存。":"已恢复自动标题。")):L(ae.archived?"对话已归档,可以在“已归档”中恢复。":"对话已恢复。"),oe(Se=>Se+1),k.current.onChanged?.(),ke&&k.current.onOpen($)}catch(Se){Q.signal.aborted||("title"in ae&&!(Se instanceof Xe&&Se.status===401)?H(G=>G?.id===$?{...G,error:Se instanceof Error?Se.message:"标题保存失败,请重试。",conflict:Se instanceof Xe&&Se.status===409,unavailable:Se instanceof Xe&&Se.status===404}:G):A(Se))}finally{be.current===Q&&(be.current=null),Q.signal.aborted||T("")}},ee=async()=>{if(!q||be.current)return;const $=q.id,ae=new AbortController;be.current=ae,T($),H(ke=>ke&&{...ke,error:""});try{const ke=await Ie(`/api/v1/sessions/${encodeURIComponent($)}`,{signal:ae.signal});if(ae.signal.aborted)return;H(Q=>Q?.id===$?{...Q,expectedTitle:ke.customTitle,reviewedTitle:ke.title,conflict:!1,unavailable:!1,error:""}:Q),re.current?.focus()}catch(ke){ae.signal.aborted||(ke instanceof Xe&&ke.status===401?A(ke):H(Q=>Q?.id===$?{...Q,error:ke instanceof Error?ke.message:"无法读取最新标题,请重试。",unavailable:ke instanceof Xe&&ke.status===404}:Q))}finally{be.current===ae&&(be.current=null),ae.signal.aborted||T("")}},ge=$=>$.archivedAt?void E($.sessionId,{archived:!1},!0):k.current.onOpen($.sessionId);return u.jsxs("section",{className:"hub-library hub-sessions","aria-labelledby":"hub-history-heading",children:[u.jsxs("header",{className:"library-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{id:"hub-history-heading",children:"历史对话"}),u.jsx("p",{children:"查找、整理并导出当前工作区的对话。"})]}),u.jsx("button",{className:"library-button",onClick:()=>oe($=>$+1),children:"刷新"})]}),U?u.jsx("div",{className:"library-error",role:"alert",children:U}):null,ue?u.jsx("p",{className:"library-hint",role:"status",children:ue}):null,u.jsxs("div",{className:"session-toolbar",children:[u.jsxs("label",{className:"library-search",children:[u.jsx("span",{className:"sr-only",children:"搜索对话标题"}),u.jsx("input",{ref:C,type:"search",placeholder:"搜索对话标题…",value:d,onChange:$=>o($.target.value)})]}),u.jsxs("label",{children:[u.jsx("span",{className:"sr-only",children:"对话范围"}),u.jsxs("select",{value:m,onChange:$=>b($.target.value),children:[u.jsx("option",{value:"false",children:"当前对话"}),u.jsx("option",{value:"true",children:"已归档"}),u.jsx("option",{value:"all",children:"全部对话"})]})]})]}),q?u.jsxs("form",{className:"session-history-editor","aria-labelledby":"session-title-editor-heading",onSubmit:$=>{$.preventDefault(),!W&&!q.conflict&&!q.unavailable&&E(q.id,{title:q.title,expectedTitle:q.expectedTitle})},children:[u.jsxs("div",{children:[u.jsx("h2",{id:"session-title-editor-heading",children:"重命名对话"}),u.jsxs("p",{className:"library-hint",children:["正在编辑:",q.originalTitle]}),!O&&!y.some($=>$.sessionId===q.id)?u.jsx("p",{className:"library-hint",children:"此对话已不在当前列表中,标题草稿仍保留在这里。"}):null]}),q.error?u.jsx("div",{className:"library-error",id:"session-title-error",role:"alert",tabIndex:-1,ref:me,children:q.error}):null,q.reviewedTitle?u.jsxs("p",{className:"session-title-review",role:"status",children:["最新标题:",u.jsx("strong",{children:q.reviewedTitle}),"。你的草稿仍保留,请核对后再保存。"]}):null,u.jsxs("label",{children:[u.jsx("span",{children:"对话标题"}),u.jsx("input",{ref:re,className:"library-title-input",value:q.title,maxLength:1024,"aria-describedby":q.error?"session-title-error":void 0,onChange:$=>{const ae=$.target.value;H(ke=>ke&&{...ke,title:ae})},readOnly:!!W})]}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{type:"submit",className:"library-button primary",disabled:!!W||q.conflict||q.unavailable,children:W?"处理中…":q.reviewedTitle?"确认保存我的标题":"保存标题"}),q.conflict||q.unavailable?u.jsx("button",{type:"button",className:"library-button",disabled:!!W,onClick:()=>{ee()},children:"读取最新标题"}):null,u.jsx("button",{type:"button",className:"library-button",disabled:!!W,onClick:Y,children:"取消"}),q.expectedTitle?u.jsx("button",{type:"button",className:"library-button",disabled:!!W||q.conflict||q.unavailable,onClick:()=>{E(q.id,{title:"",expectedTitle:q.expectedTitle})},children:"使用自动标题"}):null]})]}):null,u.jsx("div",{className:"session-history-list","aria-busy":O,children:O?u.jsx("p",{className:"library-empty",role:"status",children:"正在读取对话…"}):y.length===0?u.jsx("p",{className:"library-empty",children:g?"没有找到匹配的对话。":m==="true"?"还没有归档的对话。":"还没有保存的对话,开始一条新对话后会显示在这里。"}):y.map($=>u.jsxs("article",{className:"session-history-row",children:[u.jsxs("div",{className:"session-history-info",children:[u.jsx("button",{className:"session-history-title",onClick:()=>ge($),children:$.title}),$.preview&&$.preview!==$.title?u.jsx("p",{children:$.preview.slice(0,150)}):null,u.jsxs("div",{className:"session-history-meta",children:[u.jsx("span",{children:new Date($.lastActiveAt||$.startedAt).toLocaleString()}),u.jsxs("span",{children:[$.turnCount," 轮"]}),$.running?u.jsx("span",{children:"正在运行"}):$.archivedAt?u.jsx("span",{children:"已归档"}):null]})]}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button",disabled:!!W||!!q,onClick:ae=>{te.current=ae.currentTarget,L(""),H({id:$.sessionId,title:$.title,originalTitle:$.title,expectedTitle:$.customTitle})},children:q?.id===$.sessionId?"正在编辑":"重命名"}),u.jsx("button",{className:"library-button",disabled:!!W||$.running,onClick:()=>{E($.sessionId,{archived:!$.archivedAt})},children:W===$.sessionId?"处理中…":$.archivedAt?"恢复":"归档"}),$.running?u.jsx("button",{className:"library-button",disabled:!0,children:"运行结束后导出"}):u.jsxs("details",{className:"session-export",children:[u.jsx("summary",{className:"library-button",children:"导出"}),u.jsxs("div",{children:[u.jsx("a",{href:Gp($.sessionId),download:!0,children:"Markdown 文档"}),u.jsx("a",{href:Gp($.sessionId,"json"),download:!0,children:"完整 JSON 记录"})]})]})]})]},$.sessionId))}),S&&!O?u.jsx("div",{className:"session-load-more",children:u.jsx("button",{className:"library-button",disabled:D,onClick:X,children:D?"读取中…":"加载更多"})}):null]})}var L0=Jg();const qn="/api/v1/links",U0={connected:"已连接",expired:"授权已过期",invalid:"需要重新连接",unavailable:"凭据不可用"};function Pi(n){try{const i=new URL(n??"");return i.protocol==="https:"&&!i.username&&!i.password?i.href:void 0}catch{return}}function B0({onAuthLost:n,onDirtyChange:i,hostLabel:r="服务端",configurationVersion:s=0}){const[c,d]=j.useState(),[o,g]=j.useState(),[p,m]=j.useState(""),[b,y]=j.useState(""),[v,S]=j.useState(""),[N,O]=j.useState(!0),[z,D]=j.useState(!1),[R,U]=j.useState(),[F,ue]=j.useState(),[L,le]=j.useState(),[oe,W]=j.useState(0),T=j.useRef(!1),q=j.useRef(void 0),H=j.useRef(void 0),re=j.useRef(void 0),me=j.useRef({onAuthLost:n,onDirtyChange:i});me.current={onAuthLost:n,onDirtyChange:i};const te=z||L?.state==="pending"||!!(o&&(o.token||o.label!==(o.original?.label??o.provider.displayName))),C=j.useCallback(G=>{G instanceof Xe&&G.status===401?me.current.onAuthLost():y(G instanceof Error?G.message:"连接操作失败,请重试。")},[]);j.useEffect(()=>{me.current.onDirtyChange?.(te)},[te]),j.useEffect(()=>(T.current=!0,()=>{T.current=!1,me.current.onDirtyChange?.(!1),q.current?.abort(),H.current&&Ie(H.current,{method:"DELETE",keepalive:!0}).catch(()=>{})}),[]),j.useEffect(()=>{const G=new AbortController;return re.current=G,O(!0),Ie(qn,{signal:G.signal}).then(he=>{G.signal.aborted||d(he)}).catch(he=>{G.signal.aborted||C(he)}).finally(()=>{G.signal.aborted||O(!1)}),()=>G.abort()},[oe,s,C]),j.useEffect(()=>{if(!c?.remoteCleanupPending)return;const G=setInterval(()=>W(he=>he+1),3e4);return()=>clearInterval(G)},[c?.remoteCleanupPending]),j.useEffect(()=>{if(L?.state!=="pending"||!H.current)return;const G=H.current,he=new AbortController;let ze;const Ce=async()=>{try{const Oe=await Ie(G,{signal:he.signal});if(he.signal.aborted||H.current!==G)return;le(Oe),Oe.state==="connected"?(H.current=void 0,g(void 0),S("授权完成,连接已保存。"),W(Qe=>Qe+1)):Oe.state!=="pending"?(H.current=void 0,y(Oe.state==="cancelled"?"授权已取消。":"授权未完成或已过期,请重新开始。")):ze=setTimeout(()=>{Ce()},2e3)}catch(Oe){if(he.signal.aborted||H.current!==G)return;C(Oe),Oe instanceof Xe&&[401,404].includes(Oe.status)?(H.current=void 0,le(Qe=>Qe?{...Qe,state:"failed"}:void 0)):ze=setTimeout(()=>{Ce()},4e3)}};return ze=setTimeout(()=>{Ce()},1e3),()=>{he.abort(),clearTimeout(ze)}},[L?.id,L?.state,C]);async function Y(G,he){if(q.current)return;const ze=new AbortController;q.current=ze,re.current?.abort(),D(!0),O(!1),y(""),S("");try{const Ce=await G(ze.signal);T.current&&!ze.signal.aborted&&he(Ce)}catch(Ce){T.current&&!ze.signal.aborted&&(C(Ce),Ce instanceof Xe&&[409,503].includes(Ce.status)&&W(Oe=>Oe+1))}finally{q.current===ze&&(q.current=void 0),T.current&&D(!1)}}function fe(G,he,ze,Ce){return Ie(G,{method:he,headers:{"Content-Type":"application/json"},body:JSON.stringify(ze),signal:Ce})}function be(){return{providerId:o.provider.id,methodId:o.methodId,label:o.label.trim(),expectedRevision:o.original?.revision??null,...o.original?{connectionId:o.original.id}:{}}}function k(){g(void 0),ue(void 0),S("连接已保存。"),W(G=>G+1)}function A(G,he,ze=!1){if(z||L?.state==="pending"||te&&!window.confirm("放弃当前未保存的连接修改?"))return;(ze||he?.authSource==="remote-link")&&(G={...G,actions:G.actions.filter(Oe=>["list_repositories","list_issues","get_issue"].includes(Oe.id)),connectionMethods:[...G.connectionMethods,{id:"remote-link",displayName:{zh:"独立 Link 授权",en:"Remote Link"},executionRuntime:"server",secretLocation:"server",authKind:"oauth",availability:"available"}]});const Ce=(ze?G.connectionMethods.find(Oe=>Oe.id==="remote-link"):void 0)??G.connectionMethods.find(Oe=>Oe.id===he?.methodId)??G.connectionMethods.find(Oe=>Oe.executionRuntime==="local"&&Oe.availability==="available");Ce&&(g({provider:G,original:he,methodId:Ce.id,label:he?.label??G.displayName,token:""}),ue(void 0),le(void 0),y(""),S(""))}async function X(){if(!H.current)return;const G=H.current;await Y(he=>Ie(G,{method:"DELETE",signal:he}),()=>{H.current=void 0,le(void 0),S("授权已取消。")})}function E(G){const he=o?.original?.id===G.id&&L?.state==="pending"?H.current:void 0,ze=yt(`${qn}/connections/${encodeURIComponent(G.id)}`);Y(async Ce=>{if(he){try{await Ie(he,{method:"DELETE",signal:Ce})}catch(Oe){if(!(Oe instanceof Xe&&Oe.status===404))throw Oe}T.current&&!Ce.aborted&&H.current===he&&(H.current=void 0,le(void 0))}return fe(ze,"DELETE",{expectedRevision:G.revision},Ce)},()=>{o?.original?.id===G.id&&g(void 0),U(void 0),W(Ce=>Ce+1),S("连接已断开。")})}const ee=o?.provider.connectionMethods.find(G=>G.id===o.methodId),ge=L?.state==="pending",$=z||ge,ae=p.trim().toLowerCase(),ke=(c?.providers??[]).filter(G=>`${G.displayName} ${G.description.zh}`.toLowerCase().includes(ae)),Q=o&&c?.connections.find(G=>o.original?G.id===o.original.id:G.id===`link-${o.provider.id}-${o.methodId}`&&G.providerId===o.provider.id&&G.methodId===o.methodId),Se=o&&c&&(o.original?Q?.revision!==o.original.revision:!!Q);return u.jsxs("section",{className:"hub-links",children:[u.jsxs("header",{className:"links-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{children:"Link"}),u.jsx("p",{children:"连接你的工具与账号,让任务访问已授权的服务。"})]}),u.jsx("button",{onClick:()=>{y(""),W(G=>G+1)},disabled:z||N,children:"刷新"})]}),!!c?.remoteCleanupPending&&u.jsxs("p",{role:"status",className:"links-muted",children:["有 ",c.remoteCleanupPending," 项遗留授权等待撤销。项目所在环境 会自动重试,重启后仍会继续;也可在 Link 服务中撤销。"]}),u.jsxs("p",{className:"links-host",children:["本地连接由",r,"执行,CLI 使用这台机器上已有的登录。独立 Link 连接在 Link 服务中访问第三方,原始凭据留在 Link。"]}),b&&u.jsx("p",{className:"form-error",role:"alert",children:b}),v&&u.jsx("p",{className:"links-notice",role:"status",children:v}),N&&!c&&u.jsx("p",{role:"status",children:"正在加载连接…"}),u.jsx("h2",{children:"已连接"}),c&&c.connections.length===0&&u.jsx("p",{className:"links-muted",children:"还没有连接。选择下面的服务开始。"}),u.jsx("div",{className:"links-connections",children:c?.connections.map(G=>{const he=c.providers.find(ze=>ze.id===G.providerId);return u.jsxs("article",{className:"links-connection",children:[u.jsxs("div",{children:[u.jsx("strong",{children:G.label}),u.jsxs("p",{children:[he?.displayName??G.providerId," ·"," ",G.account?.label??G.account?.id??"已授权账号"]}),u.jsx("span",{className:`links-state ${G.status==="connected"?"ready":""}`,children:U0[G.status]}),u.jsxs("small",{children:[G.authSource==="remote-link"?"独立 Link 授权":G.authSource==="cli-session"?"CLI 登录":G.authSource==="browser-oauth"?"浏览器授权":"Token",G.expiresAt?` · 到期 ${new Date(G.expiresAt).toLocaleString()}`:""]}),G.account?.resources.length?u.jsx("p",{children:G.account.resources.join("、")}):null]}),u.jsx("div",{className:"links-actions",children:G.editable?u.jsxs(u.Fragment,{children:[u.jsx("button",{disabled:$||!he,onClick:()=>he&&A(he,G),children:"管理连接"}),u.jsx("button",{disabled:z,onClick:()=>U(G),children:"断开"})]}):u.jsx("small",{children:"项目配置管理"})})]},G.id)})}),R&&u.jsxs("div",{className:"links-confirm",role:"alertdialog","aria-label":"断开连接",children:[u.jsxs("p",{children:["断开「",R.label,"」后,后续任务将无法使用这个连接,正在执行的请求会尝试停止。"]}),u.jsx("button",{disabled:z,onClick:()=>E(R),children:"确认断开"}),u.jsx("button",{disabled:z,onClick:()=>U(void 0),children:"取消"})]}),o&&ee&&u.jsxs("section",{className:"links-editor","aria-label":`${o.provider.displayName} 连接设置`,children:[u.jsxs("div",{className:"links-heading",children:[u.jsxs("h2",{children:[o.provider.displayName," · ",o.original?"管理连接":"添加连接"]}),u.jsx("button",{disabled:$,onClick:()=>{(!te||window.confirm("放弃未保存的连接修改?"))&&g(void 0)},children:"关闭"})]}),u.jsxs("label",{children:["连接名称",u.jsx("input",{maxLength:100,value:o.label,disabled:$,onChange:G=>g({...o,label:G.target.value})})]}),Se&&u.jsxs("div",{className:"links-conflict",role:"alert",children:[u.jsx("p",{children:"这个连接已在其他设备创建、修改或删除。你的输入仍然保留,请先载入最新版本。"}),u.jsx("button",{disabled:$,onClick:()=>g({...o,original:Q||void 0}),children:"载入最新版本,保留输入"})]}),ee.id==="remote-link"&&u.jsxs("div",{className:"links-auth-option",children:[u.jsx("h3",{children:"独立 Link 授权"}),u.jsxs("p",{children:["在 Link 服务选择账号、仓库和只读操作,授权将保存到当前项目所属的",r,"。"]}),c?.remoteServer&&u.jsxs("p",{className:"links-muted",children:["服务:",c.remoteServer.issuer]}),u.jsx("button",{disabled:$||!c?.capabilities.remoteAuth||!o.label.trim()||!!Se,onClick:()=>{const G=Hs()??"",he=ua(),ze=yt(`${qn}/authorizations/remote`,G,he);Y(async Ce=>{const Oe=await fe(ze,"POST",be(),Ce),Qe=yt(`${qn}/authorizations/${encodeURIComponent(Oe.id)}`,G,he);try{return{url:Ov(Oe,c.remoteServer.issuer,{workspace:G,projectId:he}),pendingTarget:Qe}}catch(at){throw await Ie(Qe,{method:"DELETE"}).catch(()=>{}),at}},({url:Ce})=>{L0.flushSync(()=>{g(void 0),D(!1),me.current.onDirtyChange?.(!1)}),window.location.assign(Ce)})},children:o.original?"重新授权":"前往 Link 授权"}),!c?.capabilities.remoteAuth&&u.jsx("p",{className:"links-muted",children:"当前 Host 尚未配置独立 Link 服务。"}),o.original&&u.jsx("button",{disabled:$||!!Se||!o.label.trim(),onClick:()=>{Y(G=>fe(`${qn}/connections/${encodeURIComponent(o.original.id)}`,"PATCH",{label:o.label.trim(),expectedRevision:o.original.revision},G),k)},children:"保存名称"})]}),ee.browserAuth&&u.jsxs("div",{className:"links-auth-option",children:[u.jsx("h3",{children:"浏览器授权"}),o.provider.deviceAuth?.configured?u.jsx("button",{disabled:$||!o.label.trim()||!!Se,onClick:()=>{const G=Hs()??"",he=ua(),ze=yt(`${qn}/authorizations/device`,G,he);Y(Ce=>fe(ze,"POST",be(),Ce),Ce=>{H.current=yt(`${qn}/authorizations/${encodeURIComponent(Ce.id)}`,G,he),le(Ce)})},children:"开始授权"}):u.jsxs("p",{className:"links-muted",children:["这台",r,"尚未配置此服务的浏览器授权,可使用下面的连接方式。"]}),ge&&L.prompt&&u.jsxs("div",{className:"links-device-code",role:"status",children:[u.jsx("p",{children:"在服务商页面输入验证码:"}),u.jsx("strong",{children:L.prompt.userCode}),u.jsx("p",{children:Pi(L.prompt.verificationUriComplete??L.prompt.verificationUri)&&u.jsx("a",{href:Pi(L.prompt.verificationUriComplete??L.prompt.verificationUri),target:"_blank",rel:"noreferrer",children:"打开授权页面 ↗"})}),u.jsxs("p",{children:["完成后会自动保存。有效期至"," ",new Date(L.prompt.expiresAt).toLocaleTimeString(),"。"]}),u.jsx("button",{disabled:z,onClick:()=>{X()},children:"取消授权"})]})]}),ee.quickAuth&&u.jsxs("div",{className:"links-auth-option",children:[u.jsx("h3",{children:"使用已登录的 CLI"}),u.jsxs("p",{children:[r,"需要已安装并登录 ",ee.quickAuth.command,"。"]}),u.jsx("button",{disabled:$,onClick:()=>{Y(G=>Ie(`${qn}/providers/${encodeURIComponent(o.provider.id)}/cli`,{signal:G}),ue)},children:"检查登录状态"}),F&&u.jsx("p",{role:"status",children:F.authenticated?`已登录${F.account?`:${F.account}`:""}`:F.installed?"已安装,尚未登录。请在运行服务的机器上登录。":"尚未安装。"}),F?.authenticated&&u.jsx("button",{disabled:$||!o.label.trim()||!!Se,onClick:()=>{Y(G=>fe(`${qn}/connections/cli`,"POST",be(),G),k)},children:"绑定这个登录"})]}),ee.id!=="remote-link"&&u.jsxs("form",{className:"links-auth-option",onSubmit:G=>{G.preventDefault(),!($||Se)&&Y(he=>o.original&&!o.token.trim()?fe(`${qn}/connections/${encodeURIComponent(o.original.id)}`,"PATCH",{label:o.label.trim(),expectedRevision:o.original.revision},he):fe(`${qn}/connections/token`,"POST",{...be(),token:o.token.trim()},he),k)},children:[u.jsx("h3",{children:o.original?"名称与 Token":"使用 Token"}),ee.authGuide&&u.jsxs(u.Fragment,{children:[u.jsx("p",{children:ee.authGuide.summary.zh}),u.jsxs("div",{className:"links-actions",children:[Pi(ee.authGuide.createCredentialUrl)&&u.jsx("a",{href:Pi(ee.authGuide.createCredentialUrl),target:"_blank",rel:"noreferrer",children:"创建凭据 ↗"}),Pi(ee.authGuide.docsUrl)&&u.jsx("a",{href:Pi(ee.authGuide.docsUrl),target:"_blank",rel:"noreferrer",children:"授权说明 ↗"})]}),u.jsxs("details",{children:[u.jsx("summary",{children:"所需权限与设置步骤"}),u.jsx("ul",{children:ee.authGuide.permissions.map(G=>u.jsxs("li",{children:[G.label,"(",G.level==="required"?"必需":"可选",")",G.description?`:${G.description.zh}`:""]},G.id))}),u.jsx("ol",{children:ee.authGuide.steps.map((G,he)=>u.jsx("li",{children:G.zh},he))})]})]}),u.jsxs("label",{children:[ee.tokenLabel??o.provider.tokenLabel,u.jsx("input",{type:"password",autoComplete:"off",value:o.token,disabled:$,placeholder:o.original?"留空保留当前授权,仅修改名称":ee.tokenPlaceholder??o.provider.tokenPlaceholder,onChange:G=>g({...o,token:G.target.value}),required:!o.original,maxLength:16384})]}),u.jsx("button",{type:"submit",className:"send",disabled:$||!!Se||!o.label.trim(),children:z?"正在验证并保存…":o.token.trim()||!o.original?"验证并保存":"保存名称"})]}),u.jsxs("details",{children:[u.jsxs("summary",{children:["可用操作(",o.provider.actions.length,")"]}),u.jsx("ul",{children:o.provider.actions.map(G=>u.jsxs("li",{children:[u.jsx("strong",{children:G.title}),G.risk==="write"?" · 执行前需要确认":"",u.jsx("p",{children:G.description})]},G.id))})]})]}),u.jsxs("div",{className:"links-heading",children:[u.jsx("h2",{children:"添加服务"}),u.jsx("input",{type:"search","aria-label":"搜索 Link 服务",placeholder:"搜索服务",value:p,onChange:G=>m(G.target.value)})]}),u.jsx("div",{className:"links-providers",children:ke.map(G=>{const he=c?.connections.find(ze=>ze.providerId===G.id&&ze.authSource!=="remote-link");return u.jsxs("article",{className:"links-provider",children:[u.jsx("div",{className:`links-brand accent-${G.accent}`,"aria-hidden":"true",children:G.brandText}),u.jsx("h3",{children:G.displayName}),u.jsx("p",{children:G.description.zh}),u.jsxs("small",{children:[G.actions.length," 项操作"]}),u.jsx("button",{disabled:$||!!(he&&!he.editable),onClick:()=>A(G,he),children:he?he.editable?"管理连接":"项目配置管理":"添加连接"}),G.id==="github"&&c?.capabilities.remoteAuth&&u.jsx("button",{disabled:$,onClick:()=>A(G,void 0,!0),children:"通过 Link 添加账号"})]},G.id)})}),c&&ke.length===0&&u.jsx("p",{className:"links-muted",children:"没有匹配的服务。"})]})}const jc="/api/v1/panels",Vp="https://github.com/cjhyy/codeshell-panel-apps.git",Qp={"context.session":"读取当前对话信息","context.workspace":"读取当前工作区信息",storage:"保存面板自己的数据","external.open":"打开外部网页","agent.submitPrompt":"向当前对话提交任务","agent.task":"创建和管理 Agent 任务","workspace.info":"查看工作区信息","workspace.read":"读取工作区文件","workspace.write":"修改工作区文件","notifications.send":"发送通知","audio.transcribe":"将音频转成文字","credentials.cookies":"使用宿主授权的浏览器 Cookie","automations.manage":"管理自动化任务",process:"在宿主运行命令和进程",media:"处理宿主上的音视频文件","media.capture":"使用麦克风、摄像头或屏幕录制"};function Hn(n){return n["zh-CN"]||n.default}function Rs({value:n}){return n.supported&&n.reasons.length===0?null:u.jsxs("div",{className:"panels-warning",children:[u.jsx("strong",{children:n.supported?"部分功能可用":"当前 Web 工作台暂不支持此面板"}),n.supported&&u.jsx("p",{children:"可以打开面板,以下功能当前不可用或需要额外配置。"}),n.reasons.length>0&&u.jsx("ul",{children:n.reasons.map(i=>u.jsx("li",{children:i},i))})]})}function q0({onAuthLost:n,onDirtyChange:i,onChanged:r,onOpen:s,hostLabel:c="服务端",configurationVersion:d=0}){const[o,g]=j.useState(),[p,m]=j.useState(""),[b,y]=j.useState(""),[v,S]=j.useState(""),[N,O]=j.useState(""),[z,D]=j.useState(),[R,U]=j.useState(),[F,ue]=j.useState(),[L,le]=j.useState(),[oe,W]=j.useState(!1),[T,q]=j.useState(),[H,re]=j.useState(),[me,te]=j.useState(!1),[C,Y]=j.useState(!0),[fe,be]=j.useState(!1),[k,A]=j.useState(),[X,E]=j.useState(!0),[ee,ge]=j.useState(""),[$,ae]=j.useState(""),[ke,Q]=j.useState(""),[Se,G]=j.useState(0),he=j.useRef(!1),ze=j.useRef(void 0),Ce=j.useRef(void 0),Oe=j.useRef(!1),Qe=j.useRef(void 0),at=j.useRef(null),zt=j.useRef({onAuthLost:n,onDirtyChange:i,onChanged:r,onOpen:s});zt.current={onAuthLost:n,onDirtyChange:i,onChanged:r,onOpen:s};function st(_){fetch(_.target,{method:"DELETE",credentials:"same-origin",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewToken:_.token}),keepalive:!0,signal:AbortSignal.timeout(5e3)}).catch(()=>{})}const dt=!!(ee||R||F||H||k||p.trim()||b.trim()||v.trim()),jt=j.useCallback(_=>{_ instanceof Xe&&_.status===401?zt.current.onAuthLost():ae(_ instanceof Error?_.message:"面板操作失败,请重试。")},[]);j.useEffect(()=>(he.current=!0,()=>{he.current=!1,ze.current?.abort(),Ce.current?.abort(),Qe.current&&(st(Qe.current),Qe.current=void 0),zt.current.onDirtyChange?.(!1)}),[]),j.useEffect(()=>{zt.current.onDirtyChange?.(dt)},[dt]),j.useEffect(()=>{if(ze.current){Oe.current=!0;return}const _=new AbortController;return Ce.current=_,E(!0),Ie(yt(jc),{signal:_.signal}).then(Ee=>{_.signal.aborted||g(Ee)}).catch(Ee=>{_.signal.aborted||jt(Ee)}).finally(()=>{_.signal.aborted||E(!1)}),()=>_.abort()},[Se,d,jt]),j.useEffect(()=>{R&&at.current?.focus()},[R?.reviewToken]);async function tt(_,Ee,it,en,Kn=!1,Vl){if(ze.current||!he.current)return;const Mn=new AbortController;ze.current=Mn,Ce.current?.abort(),E(!1),ge(_),ae(""),Q("");const pl=yt(`${jc}${Ee}`);try{const Vt=await Ie(pl,{method:it,headers:{"Content-Type":"application/json"},body:JSON.stringify(en),signal:Mn.signal});if(Mn.signal.aborted||!he.current){Vl?.(Vt);return}return Kn&&(Oe.current=!0,zt.current.onChanged?.()),Vt}catch(Vt){if(Mn.signal.aborted||!he.current)return;Vt instanceof Xe&&(Vt.status===409||Vt.status===410)&&(R&&te(!0),L&&W(!0),Oe.current=!0),jt(Vt);return}finally{ze.current===Mn&&(ze.current=void 0),he.current&&!Mn.signal.aborted&&(ge(""),Oe.current&&(Oe.current=!1,G(Vt=>Vt+1)))}}const Mt=async _=>{if(!await wt())return;ue(void 0),le(void 0),re(void 0),U(void 0),A(void 0),D(void 0);const Ee=await tt("正在读取仓库…","/github/discover","POST",{url:_.url,..._.ref?{ref:_.ref}:{},..._.subdir?{subdir:_.subdir}:{}});Ee&&D(Ee)},ut=async _=>{if(!await wt())return;ue(void 0),le(void 0);const Ee=await tt("正在准备安装审阅…","/preview","POST",{source:_});Ee&&(A(void 0),q(_),U(Ee),te(!1),be(!1),Y(!!o?.hasProject&&Ee.compatibility.supported))},Ft=async _=>{if(!await wt())return;ue(void 0),le(void 0);const Ee=await tt("正在检查更新…",`/${encodeURIComponent(_.id)}/update-preview`,"POST",{expectedRevision:_.revision});Ee&&(A(void 0),q(void 0),U(Ee),te(!1),be(_.bound),Y(_.bound&&Ee.compatibility.supported))},ie=()=>{if(R)if(R.kind==="update"){const _=o?.panels.find(Ee=>Ee.id===R.preview.id);_?Ft(_):(ae("此面板已被卸载,请重新从 GitHub 选择安装。"),U(void 0))}else T&&ut(T)},pe=()=>{re(void 0),D(void 0),m(""),y(""),S("")},De=async()=>{if(U(void 0),!H||H.position+1>=H.candidates.length){pe();return}const _=H.position+1;re({...H,position:_}),await ut(H.candidates[_].source)},_e=async _=>{_.length&&(re({candidates:_,position:0}),await ut(_[0].source))},qe=async()=>{if(!R||me)return;if(R.expiresAt<=Date.now()){te(!0),ae("安装审阅已过期,请重新审阅后继续。");return}await tt(R.kind==="update"?"正在更新面板…":"正在安装面板…","/install","POST",{reviewToken:R.reviewToken,bind:C},!0)&&(Q(`${Hn(R.preview.title)} 已${R.kind==="update"?"更新":"安装"}${C?"并绑定当前工作区":""}。`),U(void 0),H?await De():pe())},kt=async _=>{const Ee=await tt(_.bound?"正在解除绑定…":"正在绑定工作区…",`/${encodeURIComponent(_.id)}/binding`,"PATCH",{bound:!_.bound,expectedRevision:_.revision},!0);Ee&&(g(Ee),Q(`${Hn(_.title)} 已${_.bound?"解除当前工作区绑定":"绑定当前工作区"}。`))},wt=async()=>L?(await tt("正在关闭版本审阅…","/restore/review","DELETE",{reviewToken:L.reviewToken}))?.cancelled?(Qe.current=void 0,le(void 0),!0):!1:!0,Nt=async()=>{await wt()&&ue(void 0)},ot=async _=>{if(!await wt())return;U(void 0),A(void 0),le(void 0),ue(void 0);const Ee=await tt("正在检查保留版本…",`/${encodeURIComponent(_.id)}/versions`,"POST",{expectedRevision:_.revision});Ee&&(ue(Ee),W(!1))},ht=async _=>{if(!F||!await wt())return;const Ee=yt(`${jc}/restore/review`),it=await tt("正在审阅项目版本…",`/${encodeURIComponent(F.appId)}/restore-preview`,"POST",{packageDigest:_,expectedRevision:F.expectedRevision},!1,en=>st({target:Ee,token:en.reviewToken}));if(it){if(!he.current){st({target:Ee,token:it.reviewToken});return}Qe.current={target:Ee,token:it.reviewToken},le(it),W(!1)}},$e=async()=>{if(!L||ye)return;if(L.expiresAt<=Date.now()){W(!0),ae("版本审阅已过期,请重新选择版本。");return}await tt("正在恢复项目版本…","/restore","POST",{reviewToken:L.reviewToken},!0)&&(Qe.current=void 0,Q(`${Hn(L.title)} 的项目版本已恢复为 v${L.version}。`),ue(void 0),le(void 0))},I=async()=>{if(!k||o?.panels.find(Ee=>Ee.id===k.id)?.revision!==k.revision)return;(await tt("正在卸载面板…",`/${encodeURIComponent(k.id)}`,"DELETE",{expectedRevision:k.revision},!0))?.removed&&(Q(`${Hn(k.title)} 已卸载。`),A(void 0))},xe=!!ee||!o||!!H,Ae=N.trim().toLowerCase(),J=(o?.panels??[]).filter(_=>[Hn(_.title),_.id,_.description??"",_.source.label].join(" ").toLowerCase().includes(Ae)),je=z?.panels.filter(_=>!o?.panels.some(Ee=>Ee.id===_.id)&&!o?.issues?.some(Ee=>Ee.id===_.id)&&z.panels.filter(Ee=>Ee.id===_.id).length===1)??[],Be=k&&o?.panels.find(_=>_.id===k.id),we=!!k&&Be?.revision!==k.revision,Ne=R?.kind==="update"?o?.panels.find(_=>_.id===R.preview.id):void 0,ye=oe||!!F&&(o?.panels.find(_=>_.id===F.appId)?.revision??o?.issues?.find(_=>_.id===F.appId)?.revision)!==F.expectedRevision;return u.jsxs("section",{className:"hub-panels",children:[u.jsxs("header",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{children:"面板"}),u.jsx("p",{children:"从 GitHub 安装工具面板,绑定工作区后直接在工作台中打开。"})]}),u.jsx("button",{disabled:!!ee||X,onClick:()=>G(_=>_+1),children:X?"正在刷新…":"刷新"})]}),u.jsxs("p",{className:"panels-muted",children:["面板安装在",c,"上,文件和任务操作使用当前工作区。"]}),o&&!o.hasProject&&u.jsx("div",{className:"panels-warning",children:"请先选择一个项目,才能绑定和打开面板。"}),$&&u.jsx("p",{role:"alert",className:"error",children:$}),ke&&u.jsx("p",{role:"status",className:"panels-notice",children:ke}),ee&&u.jsx("p",{role:"status",className:"panels-muted",children:ee}),o?.issues?.filter(_=>_.id.toLowerCase().includes(Ae)).map(_=>u.jsxs("section",{className:"panels-warning","aria-label":"需要修复的面板",children:[u.jsx("h2",{children:_.id}),u.jsxs("p",{children:["项目记录版本:",_.version??"未记录","。安装包缺失或无法校验,面板暂不可用。"]}),u.jsx("p",{children:"项目数据和任务记录仍保留。可检查宿主保留的版本,审阅权限后恢复。"}),u.jsx("button",{disabled:!!ee||!_.bound||!o.canRestorePackages,onClick:()=>{ot(_)},children:"检查可用版本"})]},_.id)),F&&u.jsxs("section",{className:"panels-review","aria-label":"项目保留版本",children:[u.jsxs("header",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsxs("h2",{children:[Hn(F.title)," · 项目版本"]}),u.jsxs("p",{children:["项目记录版本:",F.current.version]})]}),u.jsx("button",{disabled:!!ee,onClick:()=>{Nt()},children:"关闭版本记录"})]}),u.jsx("p",{children:"选择宿主已保留的程序版本,仅切换当前项目。其他项目继续使用各自版本。"}),u.jsx("p",{className:"panels-warning",children:"切换程序版本不会恢复旧数据。请先备份项目,确认该版本支持当前文档格式;任务与产物记录会保留。"}),F.current.unavailable&&u.jsx("p",{role:"status",children:"当前安装包不可用,无法读取原权限;恢复前需重新审阅目标版本的全部权限。"}),F.unavailablePackages>0&&u.jsxs("p",{role:"status",children:["有 ",F.unavailablePackages," 个保留包无法校验,暂不能选择。"]}),!F.versions.length&&u.jsx("p",{children:"没有可用的保留版本。"}),u.jsx("div",{className:"panels-grid",children:F.versions.map(_=>u.jsxs("article",{className:"panels-card",children:[u.jsxs("h3",{children:["v",_.version]}),u.jsxs("small",{children:["内容编号 ",_.packageDigest.slice(0,12)]}),u.jsx(Rs,{value:_.compatibility}),u.jsx("button",{disabled:!!ee||!_.compatibility.supported||_.packageDigest===F.current.packageDigest,onClick:()=>{ht(_.packageDigest)},children:_.packageDigest===F.current.packageDigest?"当前项目版本":`审阅 v${_.version}`})]},_.packageDigest))}),L&&u.jsxs("section",{className:"panels-confirm","aria-label":"确认恢复项目版本",children:[u.jsxs("h3",{children:["v",L.current.version," → v",L.version]}),u.jsx("h4",{children:"此版本请求的权限"}),!L.permissions.length&&u.jsx("p",{children:"未申请宿主权限。"}),L.permissions.map(_=>u.jsxs("div",{className:"panels-permission",children:[u.jsx("span",{children:Qp[_]??_}),L.addedPermissions.includes(_)&&u.jsx("strong",{children:L.current.unavailable?"需重新确认":"新增权限"})]},_)),u.jsx(Rs,{value:L.compatibility}),ye&&u.jsx("p",{role:"alert",children:"项目或审阅已变化,请关闭版本记录并重新读取。"}),u.jsx("button",{disabled:!!ee||ye||!L.compatibility.supported,onClick:()=>{$e()},children:"确认权限并恢复项目版本"})]})]}),H&&u.jsxs("section",{className:"panels-confirm","aria-label":"逐个审阅面板",children:[u.jsxs("p",{children:["正在审阅第 ",H.position+1," / ",H.candidates.length," 个面板:",Hn(H.candidates[H.position].title),"。每个面板都需要单独确认安装。"]}),u.jsxs("div",{className:"panels-actions",children:[!R&&u.jsx("button",{disabled:!!ee,onClick:()=>{ut(H.candidates[H.position].source)},children:"重新读取此面板"}),u.jsx("button",{disabled:!!ee,onClick:()=>{De()},children:"跳过此面板"}),u.jsx("button",{disabled:!!ee,onClick:()=>{re(void 0),U(void 0),ae("")},children:"取消逐个审阅"})]})]}),R&&u.jsxs("section",{className:"panels-review","aria-labelledby":"panel-review-heading",children:[u.jsxs("header",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsx("h2",{id:"panel-review-heading",ref:at,tabIndex:-1,children:R.kind==="update"?"审阅面板更新":"审阅面板安装"}),u.jsxs("p",{children:[Hn(R.preview.title)," · ",R.preview.id," · v",R.preview.version]})]}),u.jsx("button",{disabled:!!ee,onClick:()=>{re(void 0),U(void 0),ae("")},children:"取消审阅"})]}),R.preview.description&&u.jsx("p",{children:R.preview.description}),Ne&&u.jsxs("p",{className:"panels-warning",children:["当前版本 v",Ne.version," → 更新后 v",R.preview.version,Ne.source.commit&&u.jsxs(u.Fragment,{children:[u.jsx("br",{}),"当前提交 ",u.jsx("code",{children:Ne.source.commit.slice(0,12)})," → 更新提交"," ",u.jsx("code",{children:R.source.commit.slice(0,12)})]})]}),u.jsxs("section",{children:[u.jsx("h3",{children:"安装来源"}),u.jsxs("dl",{children:[u.jsx("dt",{children:"仓库"}),u.jsx("dd",{children:R.source.url}),u.jsx("dt",{children:"分支 / 标签"}),u.jsx("dd",{children:R.source.ref}),u.jsx("dt",{children:"已锁定提交"}),u.jsx("dd",{children:u.jsx("code",{children:R.source.commit})}),u.jsx("dt",{children:"面板目录"}),u.jsx("dd",{children:R.source.subdir||"仓库根目录"}),u.jsx("dt",{children:"界面入口"}),u.jsx("dd",{children:u.jsx("code",{children:R.preview.entry})})]})]}),u.jsxs("section",{children:[u.jsx("h3",{children:"面板请求的权限"}),R.preview.permissions.length===0?u.jsx("p",{className:"panels-muted",children:"未申请宿主权限。"}):R.preview.permissions.map(_=>u.jsxs("div",{className:"panels-permission",children:[u.jsx("span",{children:Qp[_]??_}),u.jsx("small",{children:_})]},_))]}),u.jsxs("section",{children:[u.jsx("h3",{children:"随面板安装的工具与 Skills"}),R.preview.agent?.tools.length||R.preview.agent?.skills.length?u.jsxs("div",{className:"panels-badges",children:[R.preview.agent?.tools.map(_=>u.jsxs("span",{className:"panels-badge",title:_.description,children:[_.name," · ",_.readOnly?"只读":"可修改数据"]},_.name)),R.preview.agent?.skills.map(_=>u.jsxs("span",{className:"panels-badge",children:["Skill · ",_.split("/").at(-2)??_]},_))]}):u.jsx("p",{className:"panels-muted",children:"此面板没有额外的 Agent 工具或 Skills。"})]}),u.jsx(Rs,{value:R.compatibility}),R.preview.warnings.length>0&&u.jsx("div",{className:"panels-warning",children:u.jsx("ul",{children:R.preview.warnings.map(_=>u.jsx("li",{children:_},_))})}),u.jsxs("footer",{children:[!R.compatibility.supported&&u.jsxs("p",{className:"panels-muted",children:["可以安装到",c,",但当前 Web 工作台无法绑定或打开它。"]}),fe?u.jsx("p",{className:"panels-muted",children:"已绑定当前工作区,更新将保留绑定。"}):u.jsxs("label",{className:"panels-check",children:[u.jsx("input",{type:"checkbox",checked:C,disabled:!!ee||!o?.hasProject||!R.compatibility.supported,onChange:_=>Y(_.target.checked)}),"绑定当前工作区"]}),me?u.jsxs("div",{className:"panels-actions",children:[u.jsx("span",{className:"panels-muted",children:"安装内容或本地版本已变化,请重新审阅。"}),u.jsx("button",{disabled:!!ee,onClick:ie,children:"重新审阅"})]}):u.jsx("button",{className:"panels-primary",disabled:!!ee,onClick:()=>{qe()},children:R.kind==="update"?"确认更新":"确认安装"})]})]}),u.jsxs("section",{className:"panels-section","aria-labelledby":"installed-panels-heading",children:[u.jsxs("div",{className:"panels-heading",children:[u.jsxs("h2",{id:"installed-panels-heading",children:["已安装面板",o?` · ${o.panels.length+(o.issues?.length??0)}`:""]}),u.jsx("input",{type:"search","aria-label":"搜索已安装面板",placeholder:"搜索已安装面板",value:N,onChange:_=>O(_.target.value)})]}),!o&&u.jsx("p",{className:"panels-muted",children:X?"正在读取面板…":"暂时无法读取面板,请刷新重试。"}),o&&J.length===0&&!o.issues?.some(_=>_.id.toLowerCase().includes(Ae))&&u.jsxs("div",{className:"panels-empty",children:[u.jsx("strong",{children:o.panels.length||o.issues?.length?"没有匹配的面板":"还没有安装面板"}),u.jsx("p",{className:"panels-muted",children:o.panels.length||o.issues?.length?"试试其他名称或清除搜索。":"在下方粘贴 GitHub 仓库地址,或浏览官方面板仓库。"})]}),u.jsx("div",{className:"panels-grid",children:J.map(_=>u.jsxs("article",{className:"panels-card",children:[u.jsxs("div",{className:"panels-card-heading",children:[u.jsx("h3",{children:Hn(_.title)}),u.jsxs("span",{className:"panels-badge",children:["v",_.version]})]}),u.jsx("small",{children:_.id}),_.description&&u.jsx("p",{children:_.description}),u.jsx("div",{className:"panels-badges",children:u.jsx("span",{className:`panels-badge ${_.enabled&&_.compatibility.supported?"panels-badge-ready":""}`,children:_.globalDisabled?"已全局停用":_.bound?"已绑定当前工作区":"未绑定当前工作区"})}),u.jsxs("dl",{children:[u.jsx("dt",{children:"来源"}),u.jsx("dd",{children:_.source.label}),_.source.ref&&u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"分支 / 标签"}),u.jsx("dd",{children:_.source.ref})]})]}),u.jsx(Rs,{value:_.compatibility}),_.globalDisabled&&u.jsx("p",{className:"panels-muted",children:"请在宿主配置中启用此面板后使用。"}),u.jsxs("div",{className:"panels-actions",children:[u.jsx("button",{className:"panels-primary",disabled:xe||!_.enabled||!_.compatibility.supported,onClick:()=>zt.current.onOpen(_),children:"打开面板"}),u.jsx("button",{disabled:xe||!o?.hasProject||!_.bound&&(_.globalDisabled||!_.compatibility.supported),onClick:()=>{kt(_)},children:_.bound?"解除绑定":"绑定工作区"}),_.updatable&&u.jsx("button",{disabled:xe,onClick:()=>{Ft(_)},children:"检查更新"}),o?.canRestorePackages&&_.bound&&u.jsx("button",{disabled:xe,onClick:()=>{ot(_)},children:"项目版本"}),u.jsx("button",{className:"panels-danger",disabled:xe,onClick:async()=>{!await wt()||!he.current||(A(_),U(void 0),ue(void 0),le(void 0),ae(""),Q(""))},children:"卸载"})]})]},_.id))}),k&&u.jsxs("section",{className:"panels-confirm","aria-label":"确认卸载面板",children:[u.jsxs("p",{children:["卸载「",Hn(k.title),"」v",k.version,"?面板将从",c,"移除,其他工作区也将无法打开它。"]}),u.jsxs("div",{className:"panels-actions",children:[u.jsx("button",{disabled:!!ee,onClick:()=>A(void 0),children:"取消卸载"}),we&&u.jsx("span",{className:"panels-muted",children:Be?"面板已被其他设备修改,请查看最新版本后重新确认。":"此面板已被其他设备卸载。"}),we&&Be&&u.jsx("button",{disabled:!!ee||X,onClick:()=>{A(Be),ae("")},children:"查看最新版本"}),u.jsx("button",{className:"panels-danger",disabled:!!ee||X||we,onClick:()=>{I()},children:"确认卸载"})]})]})]}),u.jsxs("section",{className:"panels-import panels-section","aria-labelledby":"github-panels-heading",children:[u.jsxs("div",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsx("h2",{id:"github-panels-heading",children:"从 GitHub 安装"}),u.jsx("p",{children:"先读取仓库并选择面板,再查看安装内容和所需权限。"})]}),u.jsx("button",{disabled:xe,onClick:()=>{m(Vp),y(""),S(""),Mt({url:Vp})},children:"浏览官方仓库"})]}),u.jsxs("form",{onSubmit:_=>{_.preventDefault(),p.trim()&&Mt({url:p.trim(),...b.trim()?{ref:b.trim()}:{},...v.trim()?{subdir:v.trim()}:{}})},children:[u.jsxs("label",{children:["GitHub 仓库地址",u.jsx("input",{type:"url",placeholder:"https://github.com/owner/repository",value:p,required:!0,disabled:!!ee||!!H,onChange:_=>{m(_.target.value),D(void 0)}})]}),u.jsxs("details",{children:[u.jsx("summary",{children:"指定分支或子目录"}),u.jsxs("div",{className:"panels-source-fields",children:[u.jsxs("label",{children:["分支 / 标签(可选)",u.jsx("input",{value:b,placeholder:"使用默认分支",disabled:!!ee||!!H,onChange:_=>{y(_.target.value),D(void 0)}})]}),u.jsxs("label",{children:["子目录(可选)",u.jsx("input",{value:v,placeholder:"例如 apps/my-panel",disabled:!!ee||!!H,onChange:_=>{S(_.target.value),D(void 0)}})]})]})]}),u.jsxs("div",{className:"panels-actions",children:[u.jsx("button",{type:"submit",disabled:xe||!p.trim(),children:"读取仓库"}),(p||b||v||z)&&u.jsx("button",{type:"button",disabled:!!ee,onClick:()=>{pe(),U(void 0)},children:"清除"})]})]}),z&&u.jsxs("div",{className:"panels-candidates",children:[u.jsxs("h3",{children:["找到 ",z.panels.length," 个面板"]}),u.jsxs("p",{className:"panels-muted",children:[z.source.url," · ",z.source.ref," ·"," ",u.jsx("code",{children:z.source.commit.slice(0,12)})]}),z.panels.length===0&&u.jsx("p",{className:"panels-muted",children:"仓库中没有找到可安装的面板。请检查地址和子目录。"}),je.length>1&&u.jsxs("div",{className:"panels-actions panels-batch-start",children:[u.jsxs("button",{disabled:xe,onClick:()=>{_e(je)},children:["逐个审阅未安装面板(",je.length,")"]}),u.jsx("small",{children:"按顺序确认,可随时跳过或停止。"})]}),u.jsx("div",{className:"panels-grid",children:z.panels.map(_=>{const Ee=o?.panels.find(it=>it.id===_.id);return u.jsxs("article",{className:"panels-card",children:[u.jsxs("div",{className:"panels-card-heading",children:[u.jsx("h3",{children:Hn(_.title)}),u.jsxs("span",{className:"panels-badge",children:["v",_.version]})]}),_.description&&u.jsx("p",{children:_.description}),u.jsx("small",{children:_.subdir==="."?"仓库根目录":_.subdir}),u.jsx("div",{className:"panels-actions",children:u.jsx("button",{disabled:xe||!!(Ee&&!Ee.updatable),onClick:()=>Ee?void Ft(Ee):void ut(_.source),children:Ee?Ee.updatable?"已安装 · 检查更新":"已从其他来源安装":"审阅安装"})})]},`${_.id}:${_.subdir}`)})}),z.issues.length>0&&u.jsxs("div",{className:"panels-warning",children:[u.jsx("strong",{children:"部分目录无法作为面板安装"}),u.jsx("ul",{children:z.issues.map(_=>u.jsxs("li",{children:[_.subdir,":",_.error]},_.subdir))})]})]})]})]})}function H0(n){const i=n.projectId===void 0?ua():n.projectId,r=`/api/v1/panels/runtime/${encodeURIComponent(n.instanceId)}`,s=new Set,c=new Set;let d=!1,o=n.expiresAt,g=o-6e4,p,m=0,b=0,y=0,v,S;const N=(T,q)=>{const H=setTimeout(()=>{s.delete(H),d||T()},Math.max(0,Math.min(q,2147483647)));return s.add(H),H},O=T=>{T!==void 0&&(clearTimeout(T),s.delete(T))},z=()=>{if(!d){d=!0;for(const T of s)clearTimeout(T);s.clear();for(const T of c)T.abort();c.clear()}},D=T=>{d||(z(),n.onTerminal(T))},R=()=>D(new Error("面板连接已到期,请重新打开继续使用。")),U=T=>T instanceof Xe&&[401,403,410].includes(T.status),F=()=>{d||n.onStatus(m||b?"面板连接暂时中断,正在重试;当前内容会保留。":"")},ue=async(T,q="GET")=>{const H=new AbortController;c.add(H);const re=N(()=>H.abort(),8e3);try{return await Ie(yt(`${r}${T}`,n.workspace,i),{method:q,...q==="POST"?{headers:{"Content-Type":"application/json"},body:"{}"}:{},signal:H.signal})}finally{O(re),c.delete(H)}},L=()=>{O(v),v=N(()=>{Date.now()>=o?R():L()},o-Date.now())},le=()=>{O(S),m<5&&(S=N(oe,g-Date.now()))};function oe(){if(!d){if(Date.now()>=o){R();return}p||m>=5||Date.now()<g||(p=(async()=>{try{const T=await ue("/renew","POST");if(d)return;if(!T||typeof T!="object"||!("expiresAt"in T)||typeof T.expiresAt!="number"||!Number.isFinite(T.expiresAt)||T.expiresAt<=Date.now()+6e4)throw new Error("面板续期响应无效。");o=T.expiresAt,g=o-6e4,m=0,L(),F()}catch(T){if(d)return;if(U(T)){D(T);return}m++,g=Date.now()+Math.min(5e3*2**(m-1),3e4),F()}finally{p=void 0,d||le()}})())}}async function W(){try{const T=await ue(`/events?after=${y}`);if(d)return;if(!T||typeof T!="object"||!("cursor"in T)||!("events"in T))throw new Error("面板事件响应无效。");if(!Number.isSafeInteger(T.cursor)||T.cursor<y||!Array.isArray(T.events)||T.events.length>2048)throw new Error("面板事件响应无效。");const q=[];let H=y;for(const re of T.events){if(!re||typeof re!="object"||!Number.isSafeInteger(re.id)||re.id<=H||re.id>T.cursor||typeof re.event!="string"||!/^[A-Za-z][A-Za-z0-9._-]{0,100}$/.test(re.event))throw new Error("面板事件响应无效。");H=re.id,q.push(re)}n.onEvents(q),y=T.cursor,b=0,F()}catch(T){if(d)return;if(U(T)){D(T);return}b++,F()}finally{d||N(()=>{W()},Math.min(1e3*2**b,5e3))}}return L(),le(),W(),{stop:z,refresh:oe}}function I0(n){if(!Number.isInteger(n.maxDurationSeconds)||n.maxDurationSeconds<1||n.maxDurationSeconds>600||!Number.isInteger(n.maxBytes)||n.maxBytes<1||n.maxBytes>25*1024*1024)throw new Error("录音限制无效。");let i={phase:"idle",elapsedSeconds:0,message:"点击开始录音后,浏览器才会请求麦克风。"},r=0,s,c,d,o=[],g=0,p="",m=n.signal.aborted;const b=N=>{i={...i,...N},m||n.onChange({...i})},y=()=>{s?.getTracks().forEach(N=>N.stop()),s=void 0,d&&clearInterval(d),d=void 0},v=()=>{try{c?.state!=="inactive"&&c?.stop()}finally{y()}},S=()=>{if(!m){m=!0,r++,c&&(c.ondataavailable=null,c.onstop=null,c.onerror=null);try{v()}finally{y()}o=[],i={phase:"closed",elapsedSeconds:0,message:"录音已关闭。"},n.signal.removeEventListener("abort",S)}};return m?i={phase:"closed",elapsedSeconds:0,message:"录音授权已结束。"}:n.signal.addEventListener("abort",S,{once:!0}),{snapshot:()=>({...i}),async start(){if(m||n.signal.aborted)throw new Error("录音授权已结束。");if(["requesting","recording"].includes(i.phase))throw new Error("已有录音正在进行。");const N=++r,O=()=>!m&&N===r&&!n.signal.aborted;o=[],g=0,p="",b({phase:"requesting",elapsedSeconds:0,blob:void 0,message:"正在等待麦克风授权…"});try{const z=await(n.getStream?n.getStream():navigator.mediaDevices.getUserMedia({audio:!0,video:!1}));if(!O()){z.getTracks().forEach(F=>F.stop());return}s=z;const D=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"].find(F=>typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(F));c=n.makeRecorder?n.makeRecorder(s):new MediaRecorder(s,{...D?{mimeType:D}:{},audioBitsPerSecond:128e3});const R=c;R.ondataavailable=F=>{!O()||!F.data.size||(o.push(F.data),g+=F.data.size,g>n.maxBytes&&(p="录音超过大小限制;可以下载备份,或重新录制较短的音频。",v()))},R.onerror=()=>{if(O()){p="录音设备发生错误;请检查麦克风后重新录制。";try{v()}catch{y()}b({phase:"error",message:p})}},R.onstop=()=>{if(!O())return;y();const F=new Blob(o,{type:R.mimeType.split(";")[0]||"audio/webm"});o=[],b({phase:F.size&&!p?"review":"error",blob:F.size?F:void 0,message:p||(F.size?"录音已停止。可以试听,再保存到当前项目。":"没有录到声音,请重新录制。")})};const U=Date.now();R.start(250),b({phase:"recording",message:"正在使用这台设备的麦克风录音。"}),d=setInterval(()=>{if(!O())return;const F=Math.floor((Date.now()-U)/1e3);b({elapsedSeconds:F}),F>=n.maxDurationSeconds&&v()},250)}catch(z){if(y(),!O())return;b({phase:"error",message:z instanceof Error&&["NotAllowedError","SecurityError"].includes(z.name)?"麦克风未获授权,请检查浏览器和系统的麦克风权限。":"无法启动录音,请确认安全连接、麦克风和浏览器录音支持。"})}},stop:v,close:S}}function Y0(n){let i,r=!1,s;const c=()=>n.signal.throwIfAborted(),d=async(g,p)=>{c();const m=await n.call(g,p);return c(),m},o=g=>{const p=g;if(!p||typeof p.sessionId!="string"||!/^upload-[a-f0-9-]{36}$/.test(p.sessionId)||i&&i!==p.sessionId||p.mimeType!==n.blob.type||!["uploading","finished"].includes(String(p.state))||!Number.isSafeInteger(p.receivedBytes)||Number(p.receivedBytes)<0||Number(p.receivedBytes)>n.blob.size||!Number.isSafeInteger(p.nextSequence)||Number(p.nextSequence)<0||!Number.isSafeInteger(p.maxChunkBytes)||Number(p.maxChunkBytes)<1||Number(p.maxChunkBytes)>32768)throw new Error("录音上传状态无效,请保留本机备份后重新打开面板。");return p};return{async save(){if(c(),r)throw new Error("录音正在保存,请稍候。");if(!n.blob.size||n.blob.size>25*1024*1024||!["audio/webm","audio/mp4","audio/ogg","audio/wav"].includes(n.blob.type))throw new Error("录音格式或大小无效。");r=!0;try{if(!s){const m=await n.blob.arrayBuffer();c(),s=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",m)),b=>b.toString(16).padStart(2,"0")).join(""),c()}let g=o(i?await d("resources.upload.get",{sessionId:i}):await d("resources.upload.begin",{name:n.name,mimeType:n.blob.type,expectedBytes:n.blob.size,expectedSha256:s}));for(i=g.sessionId,n.onProgress(g.receivedBytes);g.receivedBytes<n.blob.size;){if(g.state!=="uploading")throw new Error("录音上传已结束,文件大小不匹配。");const m=g.receivedBytes,b=new Uint8Array(await n.blob.slice(m,m+g.maxChunkBytes).arrayBuffer());c();const y=o(await d("resources.upload.write",{sessionId:i,sequence:g.nextSequence,offset:m,dataBase64:btoa(String.fromCharCode(...b))}));if(y.receivedBytes!==m+b.length||y.nextSequence!==g.nextSequence+1)throw new Error("录音上传进度不匹配,请重试保存以核对服务端状态。");g=y,n.onProgress(g.receivedBytes)}const p=await d("resources.upload.finish",{sessionId:i});if(!p?.asset||p.asset.id!==`asset-${s}`||p.asset.bytes!==n.blob.size||p.asset.mimeType!==n.blob.type)throw new Error("录音保存回执不匹配,请保留本机备份并重试。");return p}finally{r=!1}}}}function G0({request:n}){const[i,r]=j.useState({phase:"idle",elapsedSeconds:0,message:"点击开始录音后,浏览器才会请求麦克风。"}),[s,c]=j.useState(""),[d,o]=j.useState(!1),[g,p]=j.useState(0),[m,b]=j.useState(""),y=j.useRef(null),v=j.useRef(void 0),S=j.useRef(void 0),N=j.useRef(void 0);j.useEffect(()=>{const D=new AbortController;N.current=D;const R=AbortSignal.any([n.signal,D.signal]);return v.current=I0({...n,signal:R,onChange:r}),y.current?.focus(),y.current?.scrollIntoView?.({block:"nearest"}),()=>{D.abort(),v.current?.close(),v.current=void 0,S.current=void 0}},[n]),j.useEffect(()=>{if(!i.blob){b("");return}const D=URL.createObjectURL(i.blob);return b(D),()=>URL.revokeObjectURL(D)},[i.blob]);const O=i.blob?.type==="audio/mp4"?"m4a":i.blob?.type==="audio/ogg"?"ogg":"webm",z=async()=>{const D=i.blob,R=N.current;if(!D||!R||d||i.phase!=="review")return;const U=AbortSignal.any([n.signal,R.signal]);o(!0),c("");try{S.current?.blob!==D&&(S.current={blob:D,transfer:Y0({blob:D,name:`recording.${O}`,signal:U,call:(ue,L)=>n.call(ue,L,U),onProgress:p})});const F=await S.current.transfer.save();U.throwIfAborted(),n.finish(F)}catch(F){U.aborted||c(`${F instanceof Error?F.message:"保存失败。"} 录音仍保留在本页,可重试保存或下载备份。`)}finally{U.aborted||o(!1)}};return u.jsxs("section",{className:"panel-host-audio panel-host-preview","aria-label":"录音",tabIndex:-1,ref:y,children:[u.jsxs("header",{children:[u.jsx("h2",{children:"录音并保存到当前项目"}),u.jsx("button",{onClick:()=>n.finish({cancelled:!0}),children:"取消录音"})]}),u.jsxs("p",{children:["使用当前设备的麦克风;最长 ",n.maxDurationSeconds," ","秒。停止后可试听,点击保存才会上传到当前项目。关闭面板会丢弃未保存录音。"]}),u.jsxs("p",{role:"status",children:[i.message," ",i.elapsedSeconds>0&&`${i.elapsedSeconds} 秒`]}),m&&u.jsx("audio",{controls:!0,src:m}),s&&u.jsx("p",{role:"alert",children:s}),d&&u.jsxs("p",{role:"status",children:["正在保存录音:",Math.round(g/(i.blob?.size||1)*100),"%"]}),u.jsxs("div",{className:"panel-host-actions",children:[["idle","error"].includes(i.phase)&&!i.blob&&u.jsx("button",{onClick:()=>{c(""),v.current?.start().catch(D=>c(String(D)))},children:"开始录音"}),i.phase==="recording"&&u.jsx("button",{onClick:()=>v.current?.stop(),children:"停止录音"}),i.phase==="review"&&u.jsx("button",{disabled:d,className:"panel-host-primary",onClick:()=>{z()},children:d?"正在保存…":"保存到当前项目"}),m&&u.jsx("button",{disabled:d,onClick:()=>{c(""),S.current=void 0,v.current?.start().catch(D=>c(String(D)))},children:"丢弃并重新录制"}),m&&u.jsx("a",{href:m,download:`recording.${O}`,children:"下载本机备份"})]})]})}const Il="/api/v1/panels/runtime";function hn(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function V0(n){try{if(typeof n!="string"||n.length>2048)return;const i=new URL(n);if(i.protocol==="https:"&&!i.username&&!i.password)return i.href}catch{}}function Q0(n,i){const r=`${Il}/${i}/directory/`;return typeof n=="string"&&n.startsWith(r)&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.slice(r.length))}function X0(n,i,r){if(!hn(n)||n.effect!=="resources.open"||!hn(n.asset))return;const s=n.asset;if(typeof s.id!="string"||!/^(?:asset|external)-[a-f0-9]{64}$/.test(s.id)||s.id!==r||n.url!==`${Il}/${i}/resources/${s.id}`||typeof s.name!="string"||!s.name||s.name.length>1024||typeof s.mimeType!="string"||!Number.isSafeInteger(s.bytes)||Number(s.bytes)<0)return;const c=["video/mp4","video/webm","video/ogg","video/quicktime"].includes(s.mimeType)?"video":["audio/mpeg","audio/mp4","audio/ogg","audio/wav","audio/webm","audio/flac","audio/aac"].includes(s.mimeType)?"audio":["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp"].includes(s.mimeType)?"image":"file";return{name:s.name,url:n.url,kind:c}}function $0(n){if(typeof n!="string"||!/^\/api\/v1\/panel-assets\/[A-Za-z0-9_-]{20,128}\/[A-Za-z0-9_%./-]+$/.test(n))return!1;try{return n.split("/").slice(5).every(i=>{const r=decodeURIComponent(i);return!!r&&!r.startsWith(".")&&!/[\\/:\u0000-\u001f\u007f]/.test(r)})}catch{return!1}}function Z0(n){return hn(n)?typeof n.instanceId=="string"&&/^[A-Za-z0-9_-]{20,128}$/.test(n.instanceId)&&$0(n.src)&&typeof n.expiresAt=="number"&&Number.isFinite(n.expiresAt)&&hn(n.context)&&Array.isArray(n.limitations)&&n.limitations.every(i=>typeof i=="string"):!1}function K0({panel:n,sessionId:i,busy:r,onClose:s,onAuthLost:c,onDirtyChange:d,onSubmitPrompt:o}){const g=j.useRef(null),[p,m]=j.useState(),[b,y]=j.useState(!0),[v,S]=j.useState(""),[N,O]=j.useState(""),[z,D]=j.useState(),[R,U]=j.useState(),[F,ue]=j.useState(!1),L=j.useRef(null);j.useEffect(()=>{R&&(L.current?.focus(),L.current?.scrollIntoView?.({block:"nearest"}))},[R]);const[le,oe]=j.useState(""),[W,T]=j.useState(""),[q,H]=j.useState(),[re,me]=j.useState(),te=j.useRef(void 0),[C,Y]=j.useState(!1),[fe,be]=j.useState(0),k=j.useRef({onClose:s,onAuthLost:c,onDirtyChange:d,onSubmitPrompt:o,busy:r});k.current={onClose:s,onAuthLost:c,onDirtyChange:d,onSubmitPrompt:o,busy:r};const A=j.useRef(!1),X=j.useRef(void 0),E=j.useRef(void 0),ee=j.useRef(null);return j.useEffect(()=>{k.current.onDirtyChange?.(!!q||C||!!re),q&&(ee.current?.focus(),ee.current?.scrollIntoView?.({block:"nearest"}))},[q,C,re]),j.useEffect(()=>{const ge=Hs()??"",$=ua(),ae={workspace:ge,grant:void 0},ke=new AbortController,Q=new Set,Se=new Set;let G=!1,he;const ze=[],Ce=[],Oe=new Set,Qe=new Set;let at,zt=!1,st=!1,dt=!1,jt=!1;const tt=()=>{const I=g.current?.contentWindow;if(!(G||!ae.grant||!I||!jt))for(const xe of ze.splice(0))xe.event==="tools.invoke"&&hn(xe.payload)&&typeof xe.payload.requestId=="string"&&/^[A-Za-z0-9_-]{1,128}$/.test(xe.payload.requestId)&&Qe.add(xe.payload.requestId),I.postMessage({type:"codeshell-panel:event",instanceId:ae.grant.instanceId,event:xe.event,payload:xe.payload},"*")},Mt=()=>{G||!dt||!jt||!ae.grant||(at&&clearTimeout(at),y(!1),tt())},ut={loaded:()=>{dt=!0,Mt()}};E.current=ut,m(void 0),y(!0),S(""),O(""),D(void 0),U(void 0),ue(!1),oe(""),T(""),H(void 0),Y(!1),me(void 0);const Ft=I=>{zt||(zt=!0,Ie(yt(`${Il}/${encodeURIComponent(I.instanceId)}`,ge,$),{method:"DELETE",keepalive:!0}).catch(()=>{}))},ie=I=>{G||(I instanceof Xe&&I.status===401&&!A.current&&(A.current=!0,k.current.onAuthLost()),S(I instanceof Error?I.message:"面板连接失败,请重新打开。"))},pe=I=>{if(G||!ae.grant)return;const xe=ae.grant;ae.grant=void 0,he?.stop(),X.current?.cancel(),Ce.length=0,ze.length=0,Ft(xe);for(const Ae of Q)Ae.abort();at&&clearTimeout(at),m(void 0),D(void 0),U(void 0),y(!1),Y(!1),oe(""),ie(I)},De=I=>({...I,...typeof I.sessionId=="string"?{busy:k.current.busy}:{}}),_e=(I,xe,Ae,J,je)=>{G||!ae.grant||I!==g.current?.contentWindow||I.postMessage({type:"codeshell-panel:response",instanceId:ae.grant.instanceId,requestId:xe,...J?{error:J,...je?.code?{code:je.code}:{},...je?.retryAfterMs!==void 0?{retryAfterMs:je.retryAfterMs}:{}}:{result:Ae}},"*")},qe=()=>{if(G||!ae.grant||X.current||te.current||st)return;const I=Ce.shift();if(!I)return;if(I.expiresAt<=Date.now()){qe();return}let xe=!1;const Ae={effect:I,cancel:()=>{X.current===Ae&&(clearTimeout(J),X.current=void 0,G||(H(void 0),T(""),Y(!1)))},finish:je=>{if(G||!ae.grant||X.current!==Ae||xe)return;xe=!0,Y(!0),T("");const Be=new AbortController;Q.add(Be);const we=setTimeout(()=>Be.abort(),8e3);Ie(yt(`${Il}/${ae.grant.instanceId}/confirm`,ge,$),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:I.requestId,allowed:je}),signal:Be.signal}).then(Ne=>{if(!(G||X.current!==Ae)){if(typeof Ne.allowed!="boolean")throw new Error("确认响应无效。");je&&Ne.allowed===!1&&O("此确认已超时或被取消,操作未获准执行,请在面板中重新发起。"),!je&&Ne.allowed===!0&&O("该操作此前已获准执行,请在面板中查看进度或停止。"),Ae.cancel(),qe()}}).catch(Ne=>{if(!(G||X.current!==Ae)){if(Ne instanceof Xe&&[401,403,410].includes(Ne.status)){pe(Ne);return}if(Ne instanceof Xe&&Ne.status===409){Ae.cancel(),O("面板操作确认已失效,请在面板中重新发起。"),qe();return}T("暂未收到确认结果。可以重试本次确认,或取消尚未执行的请求。")}}).finally(()=>{clearTimeout(we),Q.delete(Be),xe=!1,!G&&X.current===Ae&&Y(!1)})}},J=setTimeout(()=>{Ae.cancel(),!G&&ae.grant&&(O("面板操作确认已超时,请在面板中重新发起。"),qe())},I.expiresAt-Date.now());X.current=Ae,H(Ae),T("")},kt=I=>{for(const xe of I){if(xe.event!=="host.confirm"){ze.push(xe);continue}const Ae=xe.payload;if(!hn(Ae)||typeof Ae.requestId!="string"||!/^[A-Za-z0-9_-]{1,128}$/.test(Ae.requestId)||typeof Ae.title!="string"||Ae.title.length>500||typeof Ae.body!="string"||Ae.body.length>3e4)throw new Error("面板操作确认格式无效。");Oe.has(Ae.requestId)||(Oe.add(Ae.requestId),Ce.push({effect:"host.confirm",requestId:Ae.requestId,title:Ae.title,body:Ae.body,expiresAt:Date.now()+5e4}))}if(ze.length>2048||Ce.length>32){pe(new Error("面板状态积压过多,请重新打开面板。"));return}qe(),tt()},wt=I=>new Promise(xe=>{if(X.current||te.current||st){xe(!1);return}const Ae={effect:I,finish:je=>{X.current===Ae&&(clearTimeout(J),X.current=void 0,G||H(void 0),xe(je),queueMicrotask(qe))},cancel:()=>Ae.finish(!1)},J=setTimeout(()=>Ae.finish(!1),55e3);X.current=Ae,H(Ae)}),Nt=async I=>{const xe=g.current?.contentWindow,Ae=ae.grant,J=I.data;if(G||!xe||I.source!==xe||I.origin!=="null"||!Ae||!hn(J)||J.instanceId!==Ae.instanceId)return;if(J.type==="codeshell-panel:ready"){jt=!0,Mt();return}if(J.type==="codeshell-panel:tool-result"){if(typeof J.requestId!="string"||!Qe.has(J.requestId)||Q.size>=32)return;let ye;try{if(ye=JSON.stringify({requestId:J.requestId,...typeof J.error=="string"?{error:J.error}:{result:J.result}}),new TextEncoder().encode(ye).length>512*1024)return}catch{return}Qe.delete(J.requestId);const _=new AbortController;Q.add(_);const Ee=setTimeout(()=>_.abort(),8e3);try{await Ie(yt(`${Il}/${Ae.instanceId}/tool-results`,ge,$),{method:"POST",headers:{"Content-Type":"application/json"},body:ye,signal:_.signal})}catch(it){!G&&ae.grant&&(it instanceof Xe&&[401,410].includes(it.status)?pe(it):O("面板工具结果未能送达,请在对话中重新发起操作。"))}finally{clearTimeout(Ee),Q.delete(_)}return}if(J.type!=="codeshell-panel:call"||typeof J.requestId!="string"||!/^[A-Za-z0-9_-]{1,80}$/.test(J.requestId))return;const je=J.requestId;if(Se.has(je)){_e(xe,je,void 0,"此请求已经处理,请重新发起。");return}if(Se.size>=8192||Q.size>=32){_e(xe,je,void 0,"面板请求过于频繁,请稍后重试。");return}if(Se.add(je),typeof J.method!="string"||!/^[A-Za-z][A-Za-z0-9.]{0,63}$/.test(J.method)){_e(xe,je,void 0,"面板方法无效。");return}let Be;try{if(Be=JSON.stringify({method:J.method,params:J.params}),new TextEncoder().encode(Be).length>3*1024*1024)throw new Error("too large")}catch{_e(xe,je,void 0,"面板请求内容过大或格式无效。");return}const we=new AbortController;let Ne=!1;Q.add(we);try{const ye=await Ie(yt(`${Il}/${Ae.instanceId}/call`,ge,$),{method:"POST",headers:{"Content-Type":"application/json"},body:Be,signal:we.signal});if(G||we.signal.aborted)return;if(J.method==="context.get"&&(jt=!0,Mt()),J.method==="external.open"){const _=hn(ye)&&ye.effect===J.method?V0(ye.url):void 0;if(!_)throw new Error("面板返回的外部链接无效。");if(!await wt({effect:"external.open",url:_}))throw new Error("你取消了打开链接,或确认已超时。");_e(xe,je,{opened:!0})}else if(J.method==="agent.submitPrompt"){if(!hn(ye)||ye.effect!==J.method||typeof ye.prompt!="string"||!ye.prompt.trim()||ye.prompt.length>2e4||ye.sessionId!==i)throw new Error("面板任务与当前对话不匹配,请重新打开面板。");if(!await wt({effect:"agent.submitPrompt",prompt:ye.prompt,sessionId:i}))throw new Error("你取消了发送任务,或确认已超时。");if(G||we.signal.aborted)return;Ne=!0,st=!0,Y(!0);const _=await k.current.onSubmitPrompt({prompt:ye.prompt,sessionId:i});if(G||we.signal.aborted)return;O("面板任务已提交到当前对话,可切换到对话查看进度。"),_e(xe,je,_)}else if(J.method==="resources.recordAudio"){if(!hn(ye)||ye.effect!==J.method||!Number.isInteger(ye.maxDurationSeconds)||Number(ye.maxDurationSeconds)<1||Number(ye.maxDurationSeconds)>600||!Number.isInteger(ye.maxBytes)||Number(ye.maxBytes)<1||Number(ye.maxBytes)>25*1024*1024)throw new Error("录音请求无效。");if(te.current||X.current||st)throw new Error("请先完成当前的录音或确认操作。");const _=await new Promise((Ee,it)=>{let en=!1;const Kn=(Vt,gl)=>{en||(en=!0,clearTimeout(Mn),we.signal.removeEventListener("abort",Vl),te.current===pl&&(te.current=void 0,G||me(void 0)),gl?it(gl):Ee(Vt),qe())},Vl=()=>Kn(void 0,new Error("录音已关闭或授权已结束。")),Mn=setTimeout(()=>Kn(void 0,new Error("录音操作已超时,请重新打开。")),25*6e4),pl={signal:we.signal,maxDurationSeconds:Number(ye.maxDurationSeconds),maxBytes:Number(ye.maxBytes),call:async(Vt,gl,ar)=>{const hi=ar?AbortSignal.any([we.signal,ar]):we.signal;if(hi.throwIfAborted(),G||ae.grant!==Ae)throw new Error("当前项目授权已结束。");try{const tn=await Ie(yt(`${Il}/${Ae.instanceId}/call`,ge,$),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:Vt,params:gl}),signal:hi});if(hi.throwIfAborted(),G||ae.grant!==Ae)throw new Error("当前项目授权已结束。");return tn}catch(tn){throw tn instanceof Xe&&[401,403,410].includes(tn.status)&&pe(tn),tn}},finish:Kn};te.current=pl,we.signal.addEventListener("abort",Vl,{once:!0}),me(pl)});_e(xe,je,_)}else if(J.method==="resources.open"){U(void 0),ue(!1);const _=X0(ye,Ae.instanceId,hn(J.params)?J.params.assetId:void 0);if(!_)throw new Error("面板文件预览链接无效,请重新打开文件。");U({..._,url:yt(_.url,ge,$),downloadUrl:yt(`${_.url}?download=1`,ge,$)}),_e(xe,je,{opened:!0})}else if(J.method==="filesystem.openDirectory"){if(D(void 0),!hn(ye)||ye.effect!==J.method||typeof ye.path!="string")throw new Error("面板目录信息无效。");if(ye.url!==void 0&&!Q0(ye.url,Ae.instanceId))throw new Error("面板目录链接无效,请重新打开目录。");D({path:ye.path,...typeof ye.url=="string"?{url:yt(ye.url,ge,$)}:{}}),_e(xe,je,{opened:!1,path:ye.path})}else if(J.method==="notifications.send"){if(!hn(ye)||ye.effect!==J.method||typeof ye.title!="string"||ye.title.length>160||typeof ye.body!="string"||ye.body.length>2e3)throw new Error("面板通知格式无效。");O(`${ye.title}${ye.body?`:${ye.body}`:""}`),_e(xe,je,{sent:!0})}else _e(xe,je,J.method==="context.get"&&hn(ye)?De(ye):ye)}catch(ye){!G&&!we.signal.aborted&&(ye instanceof Xe&&[401,410].includes(ye.status)&&pe(ye),(J.method==="agent.submitPrompt"||J.method==="external.open")&&O(ye instanceof Error?ye.message:"面板操作未完成。"),_e(xe,je,void 0,ye instanceof Error?ye.message:"面板请求失败。",ye instanceof Xe?{code:ye.code,retryAfterMs:ye.retryAfterMs}:void 0))}finally{Q.delete(we),Ne&&(st=!1,G||Y(!1),qe())}},ot=I=>{Nt(I)};window.addEventListener("message",ot);const ht=()=>he?.refresh(),$e=()=>{document.visibilityState==="visible"&&ht()};return window.addEventListener("focus",ht),window.addEventListener("online",ht),document.addEventListener("visibilitychange",$e),Ie(yt(`${Il}/prepare`,ge,$),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({appId:n.id,revision:n.revision,...i?{sessionId:i}:{},theme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",locale:"zh-CN"}),signal:ke.signal}).then(I=>{if(!Z0(I))throw new Error("面板启动信息无效,请刷新面板列表后重试。");if(G||ke.signal.aborted){Ft(I);return}if(I.expiresAt<=Date.now())throw Ft(I),new Error("面板授权已过期,请重新打开。");ae.grant=I,m({...I,src:yt(I.src,ge,$)}),at=setTimeout(()=>{pe(new Error("面板未能完成加载,请重新打开。若仍无法加载,可检查面板文件或使用桌面客户端。"))},45e3),he=H0({instanceId:I.instanceId,expiresAt:I.expiresAt,workspace:ge,projectId:$,onEvents:kt,onTerminal:pe,onStatus:oe})}).catch(I=>{!G&&!ke.signal.aborted&&(y(!1),ie(I))}),()=>{G=!0,X.current?.cancel(),window.removeEventListener("message",ot),window.removeEventListener("focus",ht),window.removeEventListener("online",ht),document.removeEventListener("visibilitychange",$e),he?.stop(),ke.abort();for(const I of Q)I.abort();at&&clearTimeout(at),ae.grant&&Ft(ae.grant),k.current.onDirtyChange?.(!1),E.current===ut&&(E.current=void 0)}},[n.id,n.revision,i,fe]),j.useEffect(()=>{!p||!g.current?.contentWindow||g.current.contentWindow.postMessage({type:"codeshell-panel:event",instanceId:p.instanceId,event:"context.changed",payload:{...p.context,...typeof p.context.sessionId=="string"?{busy:r}:{}}},"*")},[r,p]),u.jsxs("section",{className:"panel-host",children:[u.jsxs("header",{className:"panel-host-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{children:n.title["zh-CN"]||n.title.default}),u.jsxs("p",{children:["v",n.version," · 运行于当前工作区"]})]}),u.jsx("button",{onClick:s,children:"返回面板"})]}),(p?.limitations??n.compatibility.reasons).length>0&&u.jsxs("details",{className:"panel-host-limitations",open:!0,children:[u.jsx("summary",{children:"部分功能可用"}),u.jsx("p",{children:"面板界面可以使用;以下功能尚未接入网页,使用时会显示具体限制。"}),u.jsx("ul",{children:(p?.limitations??n.compatibility.reasons).map(ge=>u.jsx("li",{children:ge},ge))})]}),N&&u.jsx("p",{className:"panel-host-notice",role:"status",children:N}),z&&u.jsxs("div",{className:"panel-host-notice panel-host-directory",role:"status",children:[u.jsxs("p",{children:["文件保存在服务器目录:",z.path]}),z.url&&u.jsx("a",{href:z.url,target:"_blank",rel:"noopener noreferrer",children:"查看并下载文件"})]}),R&&u.jsxs("section",{className:"panel-host-preview","aria-label":"文件预览",tabIndex:-1,ref:L,children:[u.jsxs("header",{children:[u.jsx("h2",{children:R.name}),u.jsx("button",{onClick:()=>U(void 0),children:"关闭预览"})]}),!F&&R.kind==="video"&&u.jsx("video",{src:R.url,controls:!0,playsInline:!0,preload:"metadata",onError:()=>ue(!0)},R.url),!F&&R.kind==="audio"&&u.jsx("audio",{src:R.url,controls:!0,preload:"metadata",onError:()=>ue(!0)},R.url),!F&&R.kind==="image"&&u.jsx("img",{src:R.url,alt:R.name,onError:()=>ue(!0)},R.url),(F||R.kind==="file")&&u.jsx("p",{role:"status",children:"当前浏览器无法预览此文件。可以保存后打开;若保存失败,请重新打开面板检查访问权限。"}),u.jsx("a",{href:R.downloadUrl,download:R.name,children:"保存到此设备"})]}),le&&u.jsx("p",{className:"panel-host-notice",role:"status",children:le}),v&&u.jsxs("div",{className:"panel-host-error",role:"alert",children:[u.jsx("p",{children:v}),u.jsx("button",{disabled:b,onClick:()=>be(ge=>ge+1),children:"重新打开面板"})]}),b&&u.jsx("p",{className:"panel-host-loading",role:"status",children:"正在打开面板…"}),re&&u.jsx(G0,{request:re}),q&&u.jsxs("section",{className:"panel-host-confirm",ref:ee,tabIndex:-1,onKeyDown:ge=>{ge.key==="Escape"&&!C&&(ge.preventDefault(),q.finish(!1))},"aria-label":q.effect.effect==="external.open"?"确认打开外部链接":q.effect.effect==="host.confirm"?"确认面板操作":"确认发送面板任务",children:[u.jsx("h2",{children:q.effect.effect==="external.open"?"面板请求打开网页":q.effect.effect==="host.confirm"?q.effect.title:"面板请求向当前对话发送任务"}),q.effect.effect==="external.open"?u.jsx("p",{className:"panel-host-url",children:q.effect.url}):q.effect.effect==="host.confirm"?u.jsx("pre",{children:q.effect.body}):u.jsx("pre",{children:q.effect.prompt}),W&&u.jsx("p",{role:"alert",children:W}),u.jsxs("div",{className:"panel-host-actions",children:[u.jsx("button",{disabled:C,onClick:()=>q.finish(!1),children:"取消"}),q.effect.effect==="external.open"?u.jsx("a",{href:q.effect.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>q.finish(!0),children:"确认打开网页"}):u.jsx("button",{className:"panel-host-primary",disabled:C,onClick:()=>q.finish(!0),children:C?"正在确认…":q.effect.effect==="host.confirm"?"确认执行":"确认发送任务"})]})]}),p&&u.jsx("iframe",{ref:g,src:p.src,title:`${n.title["zh-CN"]||n.title.default}面板`,sandbox:"allow-scripts allow-downloads",referrerPolicy:"no-referrer",inert:!!q||C||!!re,onLoad:()=>E.current?.loaded(),allow:"camera 'none'; microphone 'none'; geolocation 'none'; display-capture 'none'; clipboard-read 'none'; clipboard-write 'none'",className:"panel-host-frame"})]})}function F0(n,i){const r={};return(n[n.length-1]===""?[...n,""]:n).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const J0=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,P0=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W0={};function Xp(n,i){return(W0.jsx?P0:J0).test(n)}const e1=/[ \t\n\f\r]/g;function t1(n){return typeof n=="object"?n.type==="text"?$p(n.value):!1:$p(n)}function $p(n){return n.replace(e1,"")===""}class ha{constructor(i,r,s){this.normal=r,this.property=i,s&&(this.space=s)}}ha.prototype.normal={};ha.prototype.property={};ha.prototype.space=void 0;function iy(n,i){const r={},s={};for(const c of n)Object.assign(r,c.property),Object.assign(s,c.normal);return new ha(r,s,i)}function Qc(n){return n.toLowerCase()}class mn{constructor(i,r){this.attribute=r,this.property=i}}mn.prototype.attribute="";mn.prototype.booleanish=!1;mn.prototype.boolean=!1;mn.prototype.commaOrSpaceSeparated=!1;mn.prototype.commaSeparated=!1;mn.prototype.defined=!1;mn.prototype.mustUseProperty=!1;mn.prototype.number=!1;mn.prototype.overloadedBoolean=!1;mn.prototype.property="";mn.prototype.spaceSeparated=!1;mn.prototype.space=void 0;let n1=0;const He=di(),Ht=di(),Xc=di(),ve=di(),vt=di(),oi=di(),jn=di();function di(){return 2**++n1}const $c=Object.freeze(Object.defineProperty({__proto__:null,boolean:He,booleanish:Ht,commaOrSpaceSeparated:jn,commaSeparated:oi,number:ve,overloadedBoolean:Xc,spaceSeparated:vt},Symbol.toStringTag,{value:"Module"})),kc=Object.keys($c);class yf extends mn{constructor(i,r,s,c){let d=-1;if(super(i,r),Zp(this,"space",c),typeof s=="number")for(;++d<kc.length;){const o=kc[d];Zp(this,kc[d],(s&$c[o])===$c[o])}}}yf.prototype.defined=!0;function Zp(n,i,r){r&&(n[i]=r)}function ir(n){const i={},r={};for(const[s,c]of Object.entries(n.properties)){const d=new yf(s,n.transform(n.attributes||{},s),c,n.space);n.mustUseProperty&&n.mustUseProperty.includes(s)&&(d.mustUseProperty=!0),i[s]=d,r[Qc(s)]=s,r[Qc(d.attribute)]=s}return new ha(i,r,n.space)}const ry=ir({properties:{ariaActiveDescendant:null,ariaAtomic:Ht,ariaAutoComplete:null,ariaBusy:Ht,ariaChecked:Ht,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:vt,ariaCurrent:null,ariaDescribedBy:vt,ariaDetails:null,ariaDisabled:Ht,ariaDropEffect:vt,ariaErrorMessage:null,ariaExpanded:Ht,ariaFlowTo:vt,ariaGrabbed:Ht,ariaHasPopup:null,ariaHidden:Ht,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vt,ariaLevel:ve,ariaLive:null,ariaModal:Ht,ariaMultiLine:Ht,ariaMultiSelectable:Ht,ariaOrientation:null,ariaOwns:vt,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:Ht,ariaReadOnly:Ht,ariaRelevant:null,ariaRequired:Ht,ariaRoleDescription:vt,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:Ht,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(n,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function ay(n,i){return i in n?n[i]:i}function sy(n,i){return ay(n,i.toLowerCase())}const l1=ir({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oi,acceptCharset:vt,accessKey:vt,action:null,allow:null,allowFullScreen:He,allowPaymentRequest:He,allowUserMedia:He,alpha:He,alt:null,as:null,async:He,autoCapitalize:null,autoComplete:vt,autoFocus:He,autoPlay:He,blocking:vt,capture:null,charSet:null,checked:He,cite:null,className:vt,closedBy:null,colorSpace:null,cols:ve,colSpan:ve,command:null,commandFor:null,content:null,contentEditable:Ht,controls:He,controlsList:vt,coords:ve|oi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:He,defer:He,dir:null,dirName:null,disabled:He,download:Xc,draggable:Ht,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:He,formTarget:null,headers:vt,height:ve,hidden:Xc,high:ve,href:null,hrefLang:null,htmlFor:vt,httpEquiv:vt,id:null,imageSizes:null,imageSrcSet:null,inert:He,inputMode:null,integrity:null,is:null,isMap:He,itemId:null,itemProp:vt,itemRef:vt,itemScope:He,itemType:vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:He,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:He,muted:He,name:null,nonce:null,noModule:He,noValidate:He,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:He,optimum:ve,pattern:null,ping:vt,placeholder:null,playsInline:He,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:He,referrerPolicy:null,rel:vt,required:He,reversed:He,rows:ve,rowSpan:ve,sandbox:vt,scope:null,scoped:He,seamless:He,selected:He,shadowRootClonable:He,shadowRootCustomElementRegistry:He,shadowRootDelegatesFocus:He,shadowRootMode:null,shadowRootSerializable:He,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:Ht,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:He,useMap:null,value:Ht,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vt,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:He,declare:He,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:He,noHref:He,noShade:He,noWrap:He,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:Ht,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:He,disablePictureInPicture:He,disableRemotePlayback:He,exportParts:oi,part:vt,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:sy}),i1=ir({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:jn,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:vt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:He,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:oi,g2:oi,glyphName:oi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:jn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:jn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:jn,rev:jn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:jn,requiredFeatures:jn,requiredFonts:jn,requiredFormats:jn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:jn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:jn,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:jn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ay}),uy=ir({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,i){return"xlink:"+i.slice(5).toLowerCase()}}),oy=ir({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:sy}),cy=ir({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,i){return"xml:"+i.slice(3).toLowerCase()}}),r1={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"},a1=/[A-Z]/g,Kp=/-[a-z]/g,s1=/^data[-\w.:]+$/i;function u1(n,i){const r=Qc(i);let s=i,c=mn;if(r in n.normal)return n.property[n.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&s1.test(i)){if(i.charAt(4)==="-"){const d=i.slice(5).replace(Kp,c1);s="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=i.slice(4);if(!Kp.test(d)){let o=d.replace(a1,o1);o.charAt(0)!=="-"&&(o="-"+o),i="data"+o}}c=yf}return new c(s,i)}function o1(n){return"-"+n.toLowerCase()}function c1(n){return n.charAt(1).toUpperCase()}const f1=iy([ry,l1,uy,oy,cy],"html"),bf=iy([ry,i1,uy,oy,cy],"svg");function d1(n){return n.join(" ").trim()}var Wi={},wc,Fp;function h1(){if(Fp)return wc;Fp=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,g=/^\s+|\s+$/g,p=`
|
|
21
|
+
`,m="/",b="*",y="",v="comment",S="declaration";function N(z,D){if(typeof z!="string")throw new TypeError("First argument must be a string");if(!z)return[];D=D||{};var R=1,U=1;function F(me){var te=me.match(i);te&&(R+=te.length);var C=me.lastIndexOf(p);U=~C?me.length-C:U+me.length}function ue(){var me={line:R,column:U};return function(te){return te.position=new L(me),W(),te}}function L(me){this.start=me,this.end={line:R,column:U},this.source=D.source}L.prototype.content=z;function le(me){var te=new Error(D.source+":"+R+":"+U+": "+me);if(te.reason=me,te.filename=D.source,te.line=R,te.column=U,te.source=z,!D.silent)throw te}function oe(me){var te=me.exec(z);if(te){var C=te[0];return F(C),z=z.slice(C.length),te}}function W(){oe(r)}function T(me){var te;for(me=me||[];te=q();)te!==!1&&me.push(te);return me}function q(){var me=ue();if(!(m!=z.charAt(0)||b!=z.charAt(1))){for(var te=2;y!=z.charAt(te)&&(b!=z.charAt(te)||m!=z.charAt(te+1));)++te;if(te+=2,y===z.charAt(te-1))return le("End of comment missing");var C=z.slice(2,te-2);return U+=2,F(C),z=z.slice(te),U+=2,me({type:v,comment:C})}}function H(){var me=ue(),te=oe(s);if(te){if(q(),!oe(c))return le("property missing ':'");var C=oe(d),Y=me({type:S,property:O(te[0].replace(n,y)),value:C?O(C[0].replace(n,y)):y});return oe(o),Y}}function re(){var me=[];T(me);for(var te;te=H();)te!==!1&&(me.push(te),T(me));return me}return W(),re()}function O(z){return z?z.replace(g,y):y}return wc=N,wc}var Jp;function m1(){if(Jp)return Wi;Jp=1;var n=Wi&&Wi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.default=r;const i=n(h1());function r(s,c){let d=null;if(!s||typeof s!="string")return d;const o=(0,i.default)(s),g=typeof c=="function";return o.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:b}=p;g?c(m,b,p):b&&(d=d||{},d[m]=b)}),d}return Wi}var Pr={},Pp;function p1(){if(Pp)return Pr;Pp=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,d=function(m){return!m||r.test(m)||n.test(m)},o=function(m,b){return b.toUpperCase()},g=function(m,b){return"".concat(b,"-")},p=function(m,b){return b===void 0&&(b={}),d(m)?m:(m=m.toLowerCase(),b.reactCompat?m=m.replace(c,g):m=m.replace(s,g),m.replace(i,o))};return Pr.camelCase=p,Pr}var Wr,Wp;function g1(){if(Wp)return Wr;Wp=1;var n=Wr&&Wr.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},i=n(m1()),r=p1();function s(c,d){var o={};return!c||typeof c!="string"||(0,i.default)(c,function(g,p){g&&p&&(o[(0,r.camelCase)(g,d)]=p)}),o}return s.default=s,Wr=s,Wr}var y1=g1();const b1=sf(y1),fy=dy("end"),xf=dy("start");function dy(n){return i;function i(r){const s=r&&r.position&&r.position[n]||{};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 x1(n){const i=xf(n),r=fy(n);if(i&&r)return{start:i,end:r}}function ia(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?eg(n.position):"start"in n||"end"in n?eg(n):"line"in n||"column"in n?Zc(n):""}function Zc(n){return tg(n&&n.line)+":"+tg(n&&n.column)}function eg(n){return Zc(n&&n.start)+"-"+Zc(n&&n.end)}function tg(n){return n&&typeof n=="number"?n:1}class Wt extends Error{constructor(i,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let c="",d={},o=!1;if(r&&("line"in r&&"column"in r?d={place:r}:"start"in r&&"end"in r?d={place:r}:"type"in r?d={ancestors:[r],place:r.position}:d={...r}),typeof i=="string"?c=i:!d.cause&&i&&(o=!0,c=i.message,d.cause=i),!d.ruleId&&!d.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?d.ruleId=s:(d.source=s.slice(0,p),d.ruleId=s.slice(p+1))}if(!d.place&&d.ancestors&&d.ancestors){const p=d.ancestors[d.ancestors.length-1];p&&(d.place=p.position)}const g=d.place&&"start"in d.place?d.place.start:d.place;this.ancestors=d.ancestors||void 0,this.cause=d.cause||void 0,this.column=g?g.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=g?g.line:void 0,this.name=ia(d.place)||"1:1",this.place=d.place||void 0,this.reason=this.message,this.ruleId=d.ruleId||void 0,this.source=d.source||void 0,this.stack=o&&d.cause&&typeof d.cause.stack=="string"?d.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Wt.prototype.file="";Wt.prototype.name="";Wt.prototype.reason="";Wt.prototype.message="";Wt.prototype.stack="";Wt.prototype.column=void 0;Wt.prototype.line=void 0;Wt.prototype.ancestors=void 0;Wt.prototype.cause=void 0;Wt.prototype.fatal=void 0;Wt.prototype.place=void 0;Wt.prototype.ruleId=void 0;Wt.prototype.source=void 0;const vf={}.hasOwnProperty,v1=new Map,S1=/[A-Z]/g,j1=new Set(["table","tbody","thead","tfoot","tr"]),k1=new Set(["td","th"]),hy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function w1(n,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=i.filePath||void 0;let s;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=D1(r,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=R1(r,i.jsx,i.jsxs)}const c={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:s,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?bf:f1,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},d=my(c,n,void 0);return d&&typeof d!="string"?d:c.create(n,c.Fragment,{children:d||void 0},void 0)}function my(n,i,r){if(i.type==="element")return C1(n,i,r);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return E1(n,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return T1(n,i,r);if(i.type==="mdxjsEsm")return N1(n,i);if(i.type==="root")return A1(n,i,r);if(i.type==="text")return z1(n,i)}function C1(n,i,r){const s=n.schema;let c=s;i.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=bf,n.schema=c),n.ancestors.push(i);const d=gy(n,i.tagName,!1),o=_1(n,i);let g=jf(n,i);return j1.has(i.tagName)&&(g=g.filter(function(p){return typeof p=="string"?!t1(p):!0})),py(n,o,d,i),Sf(o,g),n.ancestors.pop(),n.schema=s,n.create(i,d,o,r)}function E1(n,i){if(i.data&&i.data.estree&&n.evaluater){const s=i.data.estree.body[0];return s.type,n.evaluater.evaluateExpression(s.expression)}oa(n,i.position)}function N1(n,i){if(i.data&&i.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(i.data.estree);oa(n,i.position)}function T1(n,i,r){const s=n.schema;let c=s;i.name==="svg"&&s.space==="html"&&(c=bf,n.schema=c),n.ancestors.push(i);const d=i.name===null?n.Fragment:gy(n,i.name,!0),o=O1(n,i),g=jf(n,i);return py(n,o,d,i),Sf(o,g),n.ancestors.pop(),n.schema=s,n.create(i,d,o,r)}function A1(n,i,r){const s={};return Sf(s,jf(n,i)),n.create(i,n.Fragment,s,r)}function z1(n,i){return i.value}function py(n,i,r,s){typeof r!="string"&&r!==n.Fragment&&n.passNode&&(i.node=s)}function Sf(n,i){if(i.length>0){const r=i.length>1?i:i[0];r&&(n.children=r)}}function R1(n,i,r){return s;function s(c,d,o,g){const m=Array.isArray(o.children)?r:i;return g?m(d,o,g):m(d,o)}}function D1(n,i){return r;function r(s,c,d,o){const g=Array.isArray(d.children),p=xf(s);return i(c,d,o,g,{columnNumber:p?p.column-1:void 0,fileName:n,lineNumber:p?p.line:void 0},void 0)}}function _1(n,i){const r={};let s,c;for(c in i.properties)if(c!=="children"&&vf.call(i.properties,c)){const d=M1(n,c,i.properties[c]);if(d){const[o,g]=d;n.tableCellAlignToStyle&&o==="align"&&typeof g=="string"&&k1.has(i.tagName)?s=g:r[o]=g}}if(s){const d=r.style||(r.style={});d[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function O1(n,i){const r={};for(const s of i.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&n.evaluater){const d=s.data.estree.body[0];d.type;const o=d.expression;o.type;const g=o.properties[0];g.type,Object.assign(r,n.evaluater.evaluateExpression(g.argument))}else oa(n,i.position);else{const c=s.name;let d;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&n.evaluater){const g=s.value.data.estree.body[0];g.type,d=n.evaluater.evaluateExpression(g.expression)}else oa(n,i.position);else d=s.value===null?!0:s.value;r[c]=d}return r}function jf(n,i){const r=[];let s=-1;const c=n.passKeys?new Map:v1;for(;++s<i.children.length;){const d=i.children[s];let o;if(n.passKeys){const p=d.type==="element"?d.tagName:d.type==="mdxJsxFlowElement"||d.type==="mdxJsxTextElement"?d.name:void 0;if(p){const m=c.get(p)||0;o=p+"-"+m,c.set(p,m+1)}}const g=my(n,d,o);g!==void 0&&r.push(g)}return r}function M1(n,i,r){const s=u1(n.schema,i);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?F0(r):d1(r)),s.property==="style"){let c=typeof r=="object"?r:L1(n,String(r));return n.stylePropertyNameCase==="css"&&(c=U1(c)),["style",c]}return[n.elementAttributeNameCase==="react"&&s.space?r1[s.property]||s.property:s.attribute,r]}}function L1(n,i){try{return b1(i,{reactCompat:!0})}catch(r){if(n.ignoreInvalidStyle)return{};const s=r,c=new Wt("Cannot parse `style` attribute",{ancestors:n.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=n.filePath||void 0,c.url=hy+"#cannot-parse-style-attribute",c}}function gy(n,i,r){let s;if(!r)s={type:"Literal",value:i};else if(i.includes(".")){const c=i.split(".");let d=-1,o;for(;++d<c.length;){const g=Xp(c[d])?{type:"Identifier",name:c[d]}:{type:"Literal",value:c[d]};o=o?{type:"MemberExpression",object:o,property:g,computed:!!(d&&g.type==="Literal"),optional:!1}:g}s=o}else s=Xp(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(s.type==="Literal"){const c=s.value;return vf.call(n.components,c)?n.components[c]:c}if(n.evaluater)return n.evaluater.evaluateExpression(s);oa(n)}function oa(n,i){const r=new Wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:n.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=n.filePath||void 0,r.url=hy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function U1(n){const i={};let r;for(r in n)vf.call(n,r)&&(i[B1(r)]=n[r]);return i}function B1(n){let i=n.replace(S1,q1);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function q1(n){return"-"+n.toLowerCase()}const Cc={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"]},H1={};function kf(n,i){const r=H1,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return yy(n,s,c)}function yy(n,i,r){if(I1(n)){if("value"in n)return n.type==="html"&&!r?"":n.value;if(i&&"alt"in n&&n.alt)return n.alt;if("children"in n)return ng(n.children,i,r)}return Array.isArray(n)?ng(n,i,r):""}function ng(n,i,r){const s=[];let c=-1;for(;++c<n.length;)s[c]=yy(n[c],i,r);return s.join("")}function I1(n){return!!(n&&typeof n=="object")}const lg=document.createElement("i");function wf(n){const i="&"+n+";";lg.innerHTML=i;const r=lg.textContent;return r.charCodeAt(r.length-1)===59&&n!=="semi"||r===i?!1:r}function kn(n,i,r,s){const c=n.length;let d=0,o;if(i<0?i=-i>c?0:c+i:i=i>c?c:i,r=r>0?r:0,s.length<1e4)o=Array.from(s),o.unshift(i,r),n.splice(...o);else for(r&&n.splice(i,r);d<s.length;)o=s.slice(d,d+1e4),o.unshift(i,0),n.splice(...o),d+=1e4,i+=1e4}function On(n,i){return n.length>0?(kn(n,n.length,0,i),n):i}const ig={}.hasOwnProperty;function by(n){const i={};let r=-1;for(;++r<n.length;)Y1(i,n[r]);return i}function Y1(n,i){let r;for(r in i){const c=(ig.call(n,r)?n[r]:void 0)||(n[r]={}),d=i[r];let o;if(d)for(o in d){ig.call(c,o)||(c[o]=[]);const g=d[o];G1(c[o],Array.isArray(g)?g:g?[g]:[])}}}function G1(n,i){let r=-1;const s=[];for(;++r<i.length;)(i[r].add==="after"?n:s).push(i[r]);kn(n,0,0,s)}function xy(n,i){const r=Number.parseInt(n,i);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Yn(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ln=Gl(/[A-Za-z]/),Pt=Gl(/[\dA-Za-z]/),V1=Gl(/[#-'*+\--9=?A-Z^-~]/);function Ys(n){return n!==null&&(n<32||n===127)}const Kc=Gl(/\d/),Q1=Gl(/[\dA-Fa-f]/),X1=Gl(/[!-/:-@[-`{-~]/);function Le(n){return n!==null&&n<-2}function St(n){return n!==null&&(n<0||n===32)}function Fe(n){return n===-2||n===-1||n===32}const Fs=Gl(new RegExp("\\p{P}|\\p{S}","u")),ci=Gl(/\s/);function Gl(n){return i;function i(r){return r!==null&&r>-1&&n.test(String.fromCharCode(r))}}function rr(n){const i=[];let r=-1,s=0,c=0;for(;++r<n.length;){const d=n.charCodeAt(r);let o="";if(d===37&&Pt(n.charCodeAt(r+1))&&Pt(n.charCodeAt(r+2)))c=2;else if(d<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(d))||(o=String.fromCharCode(d));else if(d>55295&&d<57344){const g=n.charCodeAt(r+1);d<56320&&g>56319&&g<57344?(o=String.fromCharCode(d,g),c=1):o="�"}else o=String.fromCharCode(d);o&&(i.push(n.slice(s,r),encodeURIComponent(o)),s=r+c+1,o=""),c&&(r+=c,c=0)}return i.join("")+n.slice(s)}function et(n,i,r,s){const c=s?s-1:Number.POSITIVE_INFINITY;let d=0;return o;function o(p){return Fe(p)?(n.enter(r),g(p)):i(p)}function g(p){return Fe(p)&&d++<c?(n.consume(p),g):(n.exit(r),i(p))}}const $1={tokenize:Z1};function Z1(n){const i=n.attempt(this.parser.constructs.contentInitial,s,c);let r;return i;function s(g){if(g===null){n.consume(g);return}return n.enter("lineEnding"),n.consume(g),n.exit("lineEnding"),et(n,i,"linePrefix")}function c(g){return n.enter("paragraph"),d(g)}function d(g){const p=n.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=p),r=p,o(g)}function o(g){if(g===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(g);return}return Le(g)?(n.consume(g),n.exit("chunkText"),d):(n.consume(g),o)}}const K1={tokenize:F1},rg={tokenize:J1};function F1(n){const i=this,r=[];let s=0,c,d,o;return g;function g(U){if(s<r.length){const F=r[s];return i.containerState=F[1],n.attempt(F[0].continuation,p,m)(U)}return m(U)}function p(U){if(s++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,c&&R();const F=i.events.length;let ue=F,L;for(;ue--;)if(i.events[ue][0]==="exit"&&i.events[ue][1].type==="chunkFlow"){L=i.events[ue][1].end;break}D(s);let le=F;for(;le<i.events.length;)i.events[le][1].end={...L},le++;return kn(i.events,ue+1,0,i.events.slice(F)),i.events.length=le,m(U)}return g(U)}function m(U){if(s===r.length){if(!c)return v(U);if(c.currentConstruct&&c.currentConstruct.concrete)return N(U);i.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return i.containerState={},n.check(rg,b,y)(U)}function b(U){return c&&R(),D(s),v(U)}function y(U){return i.parser.lazy[i.now().line]=s!==r.length,o=i.now().offset,N(U)}function v(U){return i.containerState={},n.attempt(rg,S,N)(U)}function S(U){return s++,r.push([i.currentConstruct,i.containerState]),v(U)}function N(U){if(U===null){c&&R(),D(0),n.consume(U);return}return c=c||i.parser.flow(i.now()),n.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:d}),O(U)}function O(U){if(U===null){z(n.exit("chunkFlow"),!0),D(0),n.consume(U);return}return Le(U)?(n.consume(U),z(n.exit("chunkFlow")),s=0,i.interrupt=void 0,g):(n.consume(U),O)}function z(U,F){const ue=i.sliceStream(U);if(F&&ue.push(null),U.previous=d,d&&(d.next=U),d=U,c.defineSkip(U.start),c.write(ue),i.parser.lazy[U.start.line]){let L=c.events.length;for(;L--;)if(c.events[L][1].start.offset<o&&(!c.events[L][1].end||c.events[L][1].end.offset>o))return;const le=i.events.length;let oe=le,W,T;for(;oe--;)if(i.events[oe][0]==="exit"&&i.events[oe][1].type==="chunkFlow"){if(W){T=i.events[oe][1].end;break}W=!0}for(D(s),L=le;L<i.events.length;)i.events[L][1].end={...T},L++;kn(i.events,oe+1,0,i.events.slice(le)),i.events.length=L}}function D(U){let F=r.length;for(;F-- >U;){const ue=r[F];i.containerState=ue[1],ue[0].exit.call(i,n)}r.length=U}function R(){c.write([null]),d=void 0,c=void 0,i.containerState._closeFlow=void 0}}function J1(n,i,r){return et(n,n.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nr(n){if(n===null||St(n)||ci(n))return 1;if(Fs(n))return 2}function Js(n,i,r){const s=[];let c=-1;for(;++c<n.length;){const d=n[c].resolveAll;d&&!s.includes(d)&&(i=d(i,r),s.push(d))}return i}const Fc={name:"attention",resolveAll:P1,tokenize:W1};function P1(n,i){let r=-1,s,c,d,o,g,p,m,b;for(;++r<n.length;)if(n[r][0]==="enter"&&n[r][1].type==="attentionSequence"&&n[r][1]._close){for(s=r;s--;)if(n[s][0]==="exit"&&n[s][1].type==="attentionSequence"&&n[s][1]._open&&i.sliceSerialize(n[s][1]).charCodeAt(0)===i.sliceSerialize(n[r][1]).charCodeAt(0)){if((n[s][1]._close||n[r][1]._open)&&(n[r][1].end.offset-n[r][1].start.offset)%3&&!((n[s][1].end.offset-n[s][1].start.offset+n[r][1].end.offset-n[r][1].start.offset)%3))continue;p=n[s][1].end.offset-n[s][1].start.offset>1&&n[r][1].end.offset-n[r][1].start.offset>1?2:1;const y={...n[s][1].end},v={...n[r][1].start};ag(y,-p),ag(v,p),o={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...n[s][1].end}},g={type:p>1?"strongSequence":"emphasisSequence",start:{...n[r][1].start},end:v},d={type:p>1?"strongText":"emphasisText",start:{...n[s][1].end},end:{...n[r][1].start}},c={type:p>1?"strong":"emphasis",start:{...o.start},end:{...g.end}},n[s][1].end={...o.start},n[r][1].start={...g.end},m=[],n[s][1].end.offset-n[s][1].start.offset&&(m=On(m,[["enter",n[s][1],i],["exit",n[s][1],i]])),m=On(m,[["enter",c,i],["enter",o,i],["exit",o,i],["enter",d,i]]),m=On(m,Js(i.parser.constructs.insideSpan.null,n.slice(s+1,r),i)),m=On(m,[["exit",d,i],["enter",g,i],["exit",g,i],["exit",c,i]]),n[r][1].end.offset-n[r][1].start.offset?(b=2,m=On(m,[["enter",n[r][1],i],["exit",n[r][1],i]])):b=0,kn(n,s-1,r-s+3,m),r=s+m.length-b-2;break}}for(r=-1;++r<n.length;)n[r][1].type==="attentionSequence"&&(n[r][1].type="data");return n}function W1(n,i){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,c=nr(s);let d;return o;function o(p){return d=p,n.enter("attentionSequence"),g(p)}function g(p){if(p===d)return n.consume(p),g;const m=n.exit("attentionSequence"),b=nr(p),y=!b||b===2&&c||r.includes(p),v=!c||c===2&&b||r.includes(s);return m._open=!!(d===42?y:y&&(c||!v)),m._close=!!(d===42?v:v&&(b||!y)),i(p)}}function ag(n,i){n.column+=i,n.offset+=i,n._bufferIndex+=i}const eS={name:"autolink",tokenize:tS};function tS(n,i,r){let s=0;return c;function c(S){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(S),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),d}function d(S){return ln(S)?(n.consume(S),o):S===64?r(S):m(S)}function o(S){return S===43||S===45||S===46||Pt(S)?(s=1,g(S)):m(S)}function g(S){return S===58?(n.consume(S),s=0,p):(S===43||S===45||S===46||Pt(S))&&s++<32?(n.consume(S),g):(s=0,m(S))}function p(S){return S===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(S),n.exit("autolinkMarker"),n.exit("autolink"),i):S===null||S===32||S===60||Ys(S)?r(S):(n.consume(S),p)}function m(S){return S===64?(n.consume(S),b):V1(S)?(n.consume(S),m):r(S)}function b(S){return Pt(S)?y(S):r(S)}function y(S){return S===46?(n.consume(S),s=0,b):S===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(S),n.exit("autolinkMarker"),n.exit("autolink"),i):v(S)}function v(S){if((S===45||Pt(S))&&s++<63){const N=S===45?v:y;return n.consume(S),N}return r(S)}}const ma={partial:!0,tokenize:nS};function nS(n,i,r){return s;function s(d){return Fe(d)?et(n,c,"linePrefix")(d):c(d)}function c(d){return d===null||Le(d)?i(d):r(d)}}const vy={continuation:{tokenize:iS},exit:rS,name:"blockQuote",tokenize:lS};function lS(n,i,r){const s=this;return c;function c(o){if(o===62){const g=s.containerState;return g.open||(n.enter("blockQuote",{_container:!0}),g.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(o),n.exit("blockQuoteMarker"),d}return r(o)}function d(o){return Fe(o)?(n.enter("blockQuotePrefixWhitespace"),n.consume(o),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),i):(n.exit("blockQuotePrefix"),i(o))}}function iS(n,i,r){const s=this;return c;function c(o){return Fe(o)?et(n,d,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):d(o)}function d(o){return n.attempt(vy,i,r)(o)}}function rS(n){n.exit("blockQuote")}const Sy={name:"characterEscape",tokenize:aS};function aS(n,i,r){return s;function s(d){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(d),n.exit("escapeMarker"),c}function c(d){return X1(d)?(n.enter("characterEscapeValue"),n.consume(d),n.exit("characterEscapeValue"),n.exit("characterEscape"),i):r(d)}}const jy={name:"characterReference",tokenize:sS};function sS(n,i,r){const s=this;let c=0,d,o;return g;function g(y){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(y),n.exit("characterReferenceMarker"),p}function p(y){return y===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(y),n.exit("characterReferenceMarkerNumeric"),m):(n.enter("characterReferenceValue"),d=31,o=Pt,b(y))}function m(y){return y===88||y===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(y),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),d=6,o=Q1,b):(n.enter("characterReferenceValue"),d=7,o=Kc,b(y))}function b(y){if(y===59&&c){const v=n.exit("characterReferenceValue");return o===Pt&&!wf(s.sliceSerialize(v))?r(y):(n.enter("characterReferenceMarker"),n.consume(y),n.exit("characterReferenceMarker"),n.exit("characterReference"),i)}return o(y)&&c++<d?(n.consume(y),b):r(y)}}const sg={partial:!0,tokenize:oS},ug={concrete:!0,name:"codeFenced",tokenize:uS};function uS(n,i,r){const s=this,c={partial:!0,tokenize:ue};let d=0,o=0,g;return p;function p(L){return m(L)}function m(L){const le=s.events[s.events.length-1];return d=le&&le[1].type==="linePrefix"?le[2].sliceSerialize(le[1],!0).length:0,g=L,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),b(L)}function b(L){return L===g?(o++,n.consume(L),b):o<3?r(L):(n.exit("codeFencedFenceSequence"),Fe(L)?et(n,y,"whitespace")(L):y(L))}function y(L){return L===null||Le(L)?(n.exit("codeFencedFence"),s.interrupt?i(L):n.check(sg,O,F)(L)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),v(L))}function v(L){return L===null||Le(L)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),y(L)):Fe(L)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),et(n,S,"whitespace")(L)):L===96&&L===g?r(L):(n.consume(L),v)}function S(L){return L===null||Le(L)?y(L):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),N(L))}function N(L){return L===null||Le(L)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),y(L)):L===96&&L===g?r(L):(n.consume(L),N)}function O(L){return n.attempt(c,F,z)(L)}function z(L){return n.enter("lineEnding"),n.consume(L),n.exit("lineEnding"),D}function D(L){return d>0&&Fe(L)?et(n,R,"linePrefix",d+1)(L):R(L)}function R(L){return L===null||Le(L)?n.check(sg,O,F)(L):(n.enter("codeFlowValue"),U(L))}function U(L){return L===null||Le(L)?(n.exit("codeFlowValue"),R(L)):(n.consume(L),U)}function F(L){return n.exit("codeFenced"),i(L)}function ue(L,le,oe){let W=0;return T;function T(te){return L.enter("lineEnding"),L.consume(te),L.exit("lineEnding"),q}function q(te){return L.enter("codeFencedFence"),Fe(te)?et(L,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):H(te)}function H(te){return te===g?(L.enter("codeFencedFenceSequence"),re(te)):oe(te)}function re(te){return te===g?(W++,L.consume(te),re):W>=o?(L.exit("codeFencedFenceSequence"),Fe(te)?et(L,me,"whitespace")(te):me(te)):oe(te)}function me(te){return te===null||Le(te)?(L.exit("codeFencedFence"),le(te)):oe(te)}}}function oS(n,i,r){const s=this;return c;function c(o){return o===null?r(o):(n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),d)}function d(o){return s.parser.lazy[s.now().line]?r(o):i(o)}}const Ec={name:"codeIndented",tokenize:fS},cS={partial:!0,tokenize:dS};function fS(n,i,r){const s=this;return c;function c(m){return n.enter("codeIndented"),et(n,d,"linePrefix",5)(m)}function d(m){const b=s.events[s.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?o(m):r(m)}function o(m){return m===null?p(m):Le(m)?n.attempt(cS,o,p)(m):(n.enter("codeFlowValue"),g(m))}function g(m){return m===null||Le(m)?(n.exit("codeFlowValue"),o(m)):(n.consume(m),g)}function p(m){return n.exit("codeIndented"),i(m)}}function dS(n,i,r){const s=this;return c;function c(o){return s.parser.lazy[s.now().line]?r(o):Le(o)?(n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),c):et(n,d,"linePrefix",5)(o)}function d(o){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?i(o):Le(o)?c(o):r(o)}}const hS={name:"codeText",previous:pS,resolve:mS,tokenize:gS};function mS(n){let i=n.length-4,r=3,s,c;if((n[r][1].type==="lineEnding"||n[r][1].type==="space")&&(n[i][1].type==="lineEnding"||n[i][1].type==="space")){for(s=r;++s<i;)if(n[s][1].type==="codeTextData"){n[r][1].type="codeTextPadding",n[i][1].type="codeTextPadding",r+=2,i-=2;break}}for(s=r-1,i++;++s<=i;)c===void 0?s!==i&&n[s][1].type!=="lineEnding"&&(c=s):(s===i||n[s][1].type==="lineEnding")&&(n[c][1].type="codeTextData",s!==c+2&&(n[c][1].end=n[s-1][1].end,n.splice(c+2,s-c-2),i-=s-c-2,s=c+2),c=void 0);return n}function pS(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gS(n,i,r){let s=0,c,d;return o;function o(y){return n.enter("codeText"),n.enter("codeTextSequence"),g(y)}function g(y){return y===96?(n.consume(y),s++,g):(n.exit("codeTextSequence"),p(y))}function p(y){return y===null?r(y):y===32?(n.enter("space"),n.consume(y),n.exit("space"),p):y===96?(d=n.enter("codeTextSequence"),c=0,b(y)):Le(y)?(n.enter("lineEnding"),n.consume(y),n.exit("lineEnding"),p):(n.enter("codeTextData"),m(y))}function m(y){return y===null||y===32||y===96||Le(y)?(n.exit("codeTextData"),p(y)):(n.consume(y),m)}function b(y){return y===96?(n.consume(y),c++,b):c===s?(n.exit("codeTextSequence"),n.exit("codeText"),i(y)):(d.type="codeTextData",m(y))}}class yS{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(i,s):i>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(i,r,s){const c=r||0;this.setCursor(Math.trunc(i));const d=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&ea(this.left,s),d.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),ea(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),ea(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i<this.left.length){const r=this.left.splice(i,Number.POSITIVE_INFINITY);ea(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);ea(this.left,r.reverse())}}}function ea(n,i){let r=0;if(i.length<1e4)n.push(...i);else for(;r<i.length;)n.push(...i.slice(r,r+1e4)),r+=1e4}function ky(n){const i={};let r=-1,s,c,d,o,g,p,m;const b=new yS(n);for(;++r<b.length;){for(;r in i;)r=i[r];if(s=b.get(r),r&&s[1].type==="chunkFlow"&&b.get(r-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,d=0,d<p.length&&p[d][1].type==="lineEndingBlank"&&(d+=2),d<p.length&&p[d][1].type==="content"))for(;++d<p.length&&p[d][1].type!=="content";)p[d][1].type==="chunkText"&&(p[d][1]._isInFirstContentOfListItem=!0,d++);if(s[0]==="enter")s[1].contentType&&(Object.assign(i,bS(b,r)),r=i[r],m=!0);else if(s[1]._container){for(d=r,c=void 0;d--;)if(o=b.get(d),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(c&&(b.get(c)[1].type="lineEndingBlank"),o[1].type="lineEnding",c=d);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;c&&(s[1].end={...b.get(c)[1].start},g=b.slice(c,r),g.unshift(s),b.splice(c,r-c+1,g))}}return kn(n,0,Number.POSITIVE_INFINITY,b.slice(0)),!m}function bS(n,i){const r=n.get(i)[1],s=n.get(i)[2];let c=i-1;const d=[];let o=r._tokenizer;o||(o=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const g=o.events,p=[],m={};let b,y,v=-1,S=r,N=0,O=0;const z=[O];for(;S;){for(;n.get(++c)[1]!==S;);d.push(c),S._tokenizer||(b=s.sliceStream(S),S.next||b.push(null),y&&o.defineSkip(S.start),S._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(b),S._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),y=S,S=S.next}for(S=r;++v<g.length;)g[v][0]==="exit"&&g[v-1][0]==="enter"&&g[v][1].type===g[v-1][1].type&&g[v][1].start.line!==g[v][1].end.line&&(O=v+1,z.push(O),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(o.events=[],S?(S._tokenizer=void 0,S.previous=void 0):z.pop(),v=z.length;v--;){const D=g.slice(z[v],z[v+1]),R=d.pop();p.push([R,R+D.length-1]),n.splice(R,2,D)}for(p.reverse(),v=-1;++v<p.length;)m[N+p[v][0]]=N+p[v][1],N+=p[v][1]-p[v][0]-1;return m}const xS={resolve:SS,tokenize:jS},vS={partial:!0,tokenize:kS};function SS(n){return ky(n),n}function jS(n,i){let r;return s;function s(g){return n.enter("content"),r=n.enter("chunkContent",{contentType:"content"}),c(g)}function c(g){return g===null?d(g):Le(g)?n.check(vS,o,d)(g):(n.consume(g),c)}function d(g){return n.exit("chunkContent"),n.exit("content"),i(g)}function o(g){return n.consume(g),n.exit("chunkContent"),r.next=n.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function kS(n,i,r){const s=this;return c;function c(o){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),et(n,d,"linePrefix")}function d(o){if(o===null||Le(o))return r(o);const g=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?i(o):n.interrupt(s.parser.constructs.flow,r,i)(o)}}function wy(n,i,r,s,c,d,o,g,p){const m=p||Number.POSITIVE_INFINITY;let b=0;return y;function y(D){return D===60?(n.enter(s),n.enter(c),n.enter(d),n.consume(D),n.exit(d),v):D===null||D===32||D===41||Ys(D)?r(D):(n.enter(s),n.enter(o),n.enter(g),n.enter("chunkString",{contentType:"string"}),O(D))}function v(D){return D===62?(n.enter(d),n.consume(D),n.exit(d),n.exit(c),n.exit(s),i):(n.enter(g),n.enter("chunkString",{contentType:"string"}),S(D))}function S(D){return D===62?(n.exit("chunkString"),n.exit(g),v(D)):D===null||D===60||Le(D)?r(D):(n.consume(D),D===92?N:S)}function N(D){return D===60||D===62||D===92?(n.consume(D),S):S(D)}function O(D){return!b&&(D===null||D===41||St(D))?(n.exit("chunkString"),n.exit(g),n.exit(o),n.exit(s),i(D)):b<m&&D===40?(n.consume(D),b++,O):D===41?(n.consume(D),b--,O):D===null||D===32||D===40||Ys(D)?r(D):(n.consume(D),D===92?z:O)}function z(D){return D===40||D===41||D===92?(n.consume(D),O):O(D)}}function Cy(n,i,r,s,c,d){const o=this;let g=0,p;return m;function m(S){return n.enter(s),n.enter(c),n.consume(S),n.exit(c),n.enter(d),b}function b(S){return g>999||S===null||S===91||S===93&&!p||S===94&&!g&&"_hiddenFootnoteSupport"in o.parser.constructs?r(S):S===93?(n.exit(d),n.enter(c),n.consume(S),n.exit(c),n.exit(s),i):Le(S)?(n.enter("lineEnding"),n.consume(S),n.exit("lineEnding"),b):(n.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===null||S===91||S===93||Le(S)||g++>999?(n.exit("chunkString"),b(S)):(n.consume(S),p||(p=!Fe(S)),S===92?v:y)}function v(S){return S===91||S===92||S===93?(n.consume(S),g++,y):y(S)}}function Ey(n,i,r,s,c,d){let o;return g;function g(v){return v===34||v===39||v===40?(n.enter(s),n.enter(c),n.consume(v),n.exit(c),o=v===40?41:v,p):r(v)}function p(v){return v===o?(n.enter(c),n.consume(v),n.exit(c),n.exit(s),i):(n.enter(d),m(v))}function m(v){return v===o?(n.exit(d),p(o)):v===null?r(v):Le(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),et(n,m,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===o||v===null||Le(v)?(n.exit("chunkString"),m(v)):(n.consume(v),v===92?y:b)}function y(v){return v===o||v===92?(n.consume(v),b):b(v)}}function ra(n,i){let r;return s;function s(c){return Le(c)?(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),r=!0,s):Fe(c)?et(n,s,r?"linePrefix":"lineSuffix")(c):i(c)}}const wS={name:"definition",tokenize:ES},CS={partial:!0,tokenize:NS};function ES(n,i,r){const s=this;let c;return d;function d(S){return n.enter("definition"),o(S)}function o(S){return Cy.call(s,n,g,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function g(S){return c=Yn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),S===58?(n.enter("definitionMarker"),n.consume(S),n.exit("definitionMarker"),p):r(S)}function p(S){return St(S)?ra(n,m)(S):m(S)}function m(S){return wy(n,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function b(S){return n.attempt(CS,y,y)(S)}function y(S){return Fe(S)?et(n,v,"whitespace")(S):v(S)}function v(S){return S===null||Le(S)?(n.exit("definition"),s.parser.defined.push(c),i(S)):r(S)}}function NS(n,i,r){return s;function s(g){return St(g)?ra(n,c)(g):r(g)}function c(g){return Ey(n,d,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(g)}function d(g){return Fe(g)?et(n,o,"whitespace")(g):o(g)}function o(g){return g===null||Le(g)?i(g):r(g)}}const TS={name:"hardBreakEscape",tokenize:AS};function AS(n,i,r){return s;function s(d){return n.enter("hardBreakEscape"),n.consume(d),c}function c(d){return Le(d)?(n.exit("hardBreakEscape"),i(d)):r(d)}}const zS={name:"headingAtx",resolve:RS,tokenize:DS};function RS(n,i){let r=n.length-2,s=3,c,d;return n[s][1].type==="whitespace"&&(s+=2),r-2>s&&n[r][1].type==="whitespace"&&(r-=2),n[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&n[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(c={type:"atxHeadingText",start:n[s][1].start,end:n[r][1].end},d={type:"chunkText",start:n[s][1].start,end:n[r][1].end,contentType:"text"},kn(n,s,r-s+1,[["enter",c,i],["enter",d,i],["exit",d,i],["exit",c,i]])),n}function DS(n,i,r){let s=0;return c;function c(b){return n.enter("atxHeading"),d(b)}function d(b){return n.enter("atxHeadingSequence"),o(b)}function o(b){return b===35&&s++<6?(n.consume(b),o):b===null||St(b)?(n.exit("atxHeadingSequence"),g(b)):r(b)}function g(b){return b===35?(n.enter("atxHeadingSequence"),p(b)):b===null||Le(b)?(n.exit("atxHeading"),i(b)):Fe(b)?et(n,g,"whitespace")(b):(n.enter("atxHeadingText"),m(b))}function p(b){return b===35?(n.consume(b),p):(n.exit("atxHeadingSequence"),g(b))}function m(b){return b===null||b===35||St(b)?(n.exit("atxHeadingText"),g(b)):(n.consume(b),m)}}const _S=["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"],og=["pre","script","style","textarea"],OS={concrete:!0,name:"htmlFlow",resolveTo:US,tokenize:BS},MS={partial:!0,tokenize:HS},LS={partial:!0,tokenize:qS};function US(n){let i=n.length;for(;i--&&!(n[i][0]==="enter"&&n[i][1].type==="htmlFlow"););return i>1&&n[i-2][1].type==="linePrefix"&&(n[i][1].start=n[i-2][1].start,n[i+1][1].start=n[i-2][1].start,n.splice(i-2,2)),n}function BS(n,i,r){const s=this;let c,d,o,g,p;return m;function m(E){return b(E)}function b(E){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(E),y}function y(E){return E===33?(n.consume(E),v):E===47?(n.consume(E),d=!0,O):E===63?(n.consume(E),c=3,s.interrupt?i:k):ln(E)?(n.consume(E),o=String.fromCharCode(E),z):r(E)}function v(E){return E===45?(n.consume(E),c=2,S):E===91?(n.consume(E),c=5,g=0,N):ln(E)?(n.consume(E),c=4,s.interrupt?i:k):r(E)}function S(E){return E===45?(n.consume(E),s.interrupt?i:k):r(E)}function N(E){const ee="CDATA[";return E===ee.charCodeAt(g++)?(n.consume(E),g===ee.length?s.interrupt?i:H:N):r(E)}function O(E){return ln(E)?(n.consume(E),o=String.fromCharCode(E),z):r(E)}function z(E){if(E===null||E===47||E===62||St(E)){const ee=E===47,ge=o.toLowerCase();return!ee&&!d&&og.includes(ge)?(c=1,s.interrupt?i(E):H(E)):_S.includes(o.toLowerCase())?(c=6,ee?(n.consume(E),D):s.interrupt?i(E):H(E)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(E):d?R(E):U(E))}return E===45||Pt(E)?(n.consume(E),o+=String.fromCharCode(E),z):r(E)}function D(E){return E===62?(n.consume(E),s.interrupt?i:H):r(E)}function R(E){return Fe(E)?(n.consume(E),R):T(E)}function U(E){return E===47?(n.consume(E),T):E===58||E===95||ln(E)?(n.consume(E),F):Fe(E)?(n.consume(E),U):T(E)}function F(E){return E===45||E===46||E===58||E===95||Pt(E)?(n.consume(E),F):ue(E)}function ue(E){return E===61?(n.consume(E),L):Fe(E)?(n.consume(E),ue):U(E)}function L(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(n.consume(E),p=E,le):Fe(E)?(n.consume(E),L):oe(E)}function le(E){return E===p?(n.consume(E),p=null,W):E===null||Le(E)?r(E):(n.consume(E),le)}function oe(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||St(E)?ue(E):(n.consume(E),oe)}function W(E){return E===47||E===62||Fe(E)?U(E):r(E)}function T(E){return E===62?(n.consume(E),q):r(E)}function q(E){return E===null||Le(E)?H(E):Fe(E)?(n.consume(E),q):r(E)}function H(E){return E===45&&c===2?(n.consume(E),C):E===60&&c===1?(n.consume(E),Y):E===62&&c===4?(n.consume(E),A):E===63&&c===3?(n.consume(E),k):E===93&&c===5?(n.consume(E),be):Le(E)&&(c===6||c===7)?(n.exit("htmlFlowData"),n.check(MS,X,re)(E)):E===null||Le(E)?(n.exit("htmlFlowData"),re(E)):(n.consume(E),H)}function re(E){return n.check(LS,me,X)(E)}function me(E){return n.enter("lineEnding"),n.consume(E),n.exit("lineEnding"),te}function te(E){return E===null||Le(E)?re(E):(n.enter("htmlFlowData"),H(E))}function C(E){return E===45?(n.consume(E),k):H(E)}function Y(E){return E===47?(n.consume(E),o="",fe):H(E)}function fe(E){if(E===62){const ee=o.toLowerCase();return og.includes(ee)?(n.consume(E),A):H(E)}return ln(E)&&o.length<8?(n.consume(E),o+=String.fromCharCode(E),fe):H(E)}function be(E){return E===93?(n.consume(E),k):H(E)}function k(E){return E===62?(n.consume(E),A):E===45&&c===2?(n.consume(E),k):H(E)}function A(E){return E===null||Le(E)?(n.exit("htmlFlowData"),X(E)):(n.consume(E),A)}function X(E){return n.exit("htmlFlow"),i(E)}}function qS(n,i,r){const s=this;return c;function c(o){return Le(o)?(n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),d):r(o)}function d(o){return s.parser.lazy[s.now().line]?r(o):i(o)}}function HS(n,i,r){return s;function s(c){return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),n.attempt(ma,i,r)}}const IS={name:"htmlText",tokenize:YS};function YS(n,i,r){const s=this;let c,d,o;return g;function g(k){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(k),p}function p(k){return k===33?(n.consume(k),m):k===47?(n.consume(k),ue):k===63?(n.consume(k),U):ln(k)?(n.consume(k),oe):r(k)}function m(k){return k===45?(n.consume(k),b):k===91?(n.consume(k),d=0,N):ln(k)?(n.consume(k),R):r(k)}function b(k){return k===45?(n.consume(k),S):r(k)}function y(k){return k===null?r(k):k===45?(n.consume(k),v):Le(k)?(o=y,Y(k)):(n.consume(k),y)}function v(k){return k===45?(n.consume(k),S):y(k)}function S(k){return k===62?C(k):k===45?v(k):y(k)}function N(k){const A="CDATA[";return k===A.charCodeAt(d++)?(n.consume(k),d===A.length?O:N):r(k)}function O(k){return k===null?r(k):k===93?(n.consume(k),z):Le(k)?(o=O,Y(k)):(n.consume(k),O)}function z(k){return k===93?(n.consume(k),D):O(k)}function D(k){return k===62?C(k):k===93?(n.consume(k),D):O(k)}function R(k){return k===null||k===62?C(k):Le(k)?(o=R,Y(k)):(n.consume(k),R)}function U(k){return k===null?r(k):k===63?(n.consume(k),F):Le(k)?(o=U,Y(k)):(n.consume(k),U)}function F(k){return k===62?C(k):U(k)}function ue(k){return ln(k)?(n.consume(k),L):r(k)}function L(k){return k===45||Pt(k)?(n.consume(k),L):le(k)}function le(k){return Le(k)?(o=le,Y(k)):Fe(k)?(n.consume(k),le):C(k)}function oe(k){return k===45||Pt(k)?(n.consume(k),oe):k===47||k===62||St(k)?W(k):r(k)}function W(k){return k===47?(n.consume(k),C):k===58||k===95||ln(k)?(n.consume(k),T):Le(k)?(o=W,Y(k)):Fe(k)?(n.consume(k),W):C(k)}function T(k){return k===45||k===46||k===58||k===95||Pt(k)?(n.consume(k),T):q(k)}function q(k){return k===61?(n.consume(k),H):Le(k)?(o=q,Y(k)):Fe(k)?(n.consume(k),q):W(k)}function H(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(n.consume(k),c=k,re):Le(k)?(o=H,Y(k)):Fe(k)?(n.consume(k),H):(n.consume(k),me)}function re(k){return k===c?(n.consume(k),c=void 0,te):k===null?r(k):Le(k)?(o=re,Y(k)):(n.consume(k),re)}function me(k){return k===null||k===34||k===39||k===60||k===61||k===96?r(k):k===47||k===62||St(k)?W(k):(n.consume(k),me)}function te(k){return k===47||k===62||St(k)?W(k):r(k)}function C(k){return k===62?(n.consume(k),n.exit("htmlTextData"),n.exit("htmlText"),i):r(k)}function Y(k){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(k),n.exit("lineEnding"),fe}function fe(k){return Fe(k)?et(n,be,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):be(k)}function be(k){return n.enter("htmlTextData"),o(k)}}const Cf={name:"labelEnd",resolveAll:XS,resolveTo:$S,tokenize:ZS},GS={tokenize:KS},VS={tokenize:FS},QS={tokenize:JS};function XS(n){let i=-1;const r=[];for(;++i<n.length;){const s=n[i][1];if(r.push(n[i]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const c=s.type==="labelImage"?4:2;s.type="data",i+=c}}return n.length!==r.length&&kn(n,0,n.length,r),n}function $S(n,i){let r=n.length,s=0,c,d,o,g;for(;r--;)if(c=n[r][1],d){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;n[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(o){if(n[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(d=r,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(o=r);const p={type:n[d][1].type==="labelLink"?"link":"image",start:{...n[d][1].start},end:{...n[n.length-1][1].end}},m={type:"label",start:{...n[d][1].start},end:{...n[o][1].end}},b={type:"labelText",start:{...n[d+s+2][1].end},end:{...n[o-2][1].start}};return g=[["enter",p,i],["enter",m,i]],g=On(g,n.slice(d+1,d+s+3)),g=On(g,[["enter",b,i]]),g=On(g,Js(i.parser.constructs.insideSpan.null,n.slice(d+s+4,o-3),i)),g=On(g,[["exit",b,i],n[o-2],n[o-1],["exit",m,i]]),g=On(g,n.slice(o+1)),g=On(g,[["exit",p,i]]),kn(n,d,n.length,g),n}function ZS(n,i,r){const s=this;let c=s.events.length,d,o;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){d=s.events[c][1];break}return g;function g(v){return d?d._inactive?y(v):(o=s.parser.defined.includes(Yn(s.sliceSerialize({start:d.end,end:s.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(v),n.exit("labelMarker"),n.exit("labelEnd"),p):r(v)}function p(v){return v===40?n.attempt(GS,b,o?b:y)(v):v===91?n.attempt(VS,b,o?m:y)(v):o?b(v):y(v)}function m(v){return n.attempt(QS,b,y)(v)}function b(v){return i(v)}function y(v){return d._balanced=!0,r(v)}}function KS(n,i,r){return s;function s(y){return n.enter("resource"),n.enter("resourceMarker"),n.consume(y),n.exit("resourceMarker"),c}function c(y){return St(y)?ra(n,d)(y):d(y)}function d(y){return y===41?b(y):wy(n,o,g,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function o(y){return St(y)?ra(n,p)(y):b(y)}function g(y){return r(y)}function p(y){return y===34||y===39||y===40?Ey(n,m,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):b(y)}function m(y){return St(y)?ra(n,b)(y):b(y)}function b(y){return y===41?(n.enter("resourceMarker"),n.consume(y),n.exit("resourceMarker"),n.exit("resource"),i):r(y)}}function FS(n,i,r){const s=this;return c;function c(g){return Cy.call(s,n,d,o,"reference","referenceMarker","referenceString")(g)}function d(g){return s.parser.defined.includes(Yn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?i(g):r(g)}function o(g){return r(g)}}function JS(n,i,r){return s;function s(d){return n.enter("reference"),n.enter("referenceMarker"),n.consume(d),n.exit("referenceMarker"),c}function c(d){return d===93?(n.enter("referenceMarker"),n.consume(d),n.exit("referenceMarker"),n.exit("reference"),i):r(d)}}const PS={name:"labelStartImage",resolveAll:Cf.resolveAll,tokenize:WS};function WS(n,i,r){const s=this;return c;function c(g){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(g),n.exit("labelImageMarker"),d}function d(g){return g===91?(n.enter("labelMarker"),n.consume(g),n.exit("labelMarker"),n.exit("labelImage"),o):r(g)}function o(g){return g===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(g):i(g)}}const ej={name:"labelStartLink",resolveAll:Cf.resolveAll,tokenize:tj};function tj(n,i,r){const s=this;return c;function c(o){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(o),n.exit("labelMarker"),n.exit("labelLink"),d}function d(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(o):i(o)}}const Nc={name:"lineEnding",tokenize:nj};function nj(n,i){return r;function r(s){return n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),et(n,i,"linePrefix")}}const Bs={name:"thematicBreak",tokenize:lj};function lj(n,i,r){let s=0,c;return d;function d(m){return n.enter("thematicBreak"),o(m)}function o(m){return c=m,g(m)}function g(m){return m===c?(n.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||Le(m))?(n.exit("thematicBreak"),i(m)):r(m)}function p(m){return m===c?(n.consume(m),s++,p):(n.exit("thematicBreakSequence"),Fe(m)?et(n,g,"whitespace")(m):g(m))}}const dn={continuation:{tokenize:sj},exit:oj,name:"list",tokenize:aj},ij={partial:!0,tokenize:cj},rj={partial:!0,tokenize:uj};function aj(n,i,r){const s=this,c=s.events[s.events.length-1];let d=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,o=0;return g;function g(S){const N=s.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!s.containerState.marker||S===s.containerState.marker:Kc(S)){if(s.containerState.type||(s.containerState.type=N,n.enter(N,{_container:!0})),N==="listUnordered")return n.enter("listItemPrefix"),S===42||S===45?n.check(Bs,r,m)(S):m(S);if(!s.interrupt||S===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),p(S)}return r(S)}function p(S){return Kc(S)&&++o<10?(n.consume(S),p):(!s.interrupt||o<2)&&(s.containerState.marker?S===s.containerState.marker:S===41||S===46)?(n.exit("listItemValue"),m(S)):r(S)}function m(S){return n.enter("listItemMarker"),n.consume(S),n.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||S,n.check(ma,s.interrupt?r:b,n.attempt(ij,v,y))}function b(S){return s.containerState.initialBlankLine=!0,d++,v(S)}function y(S){return Fe(S)?(n.enter("listItemPrefixWhitespace"),n.consume(S),n.exit("listItemPrefixWhitespace"),v):r(S)}function v(S){return s.containerState.size=d+s.sliceSerialize(n.exit("listItemPrefix"),!0).length,i(S)}}function sj(n,i,r){const s=this;return s.containerState._closeFlow=void 0,n.check(ma,c,d);function c(g){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,et(n,i,"listItemIndent",s.containerState.size+1)(g)}function d(g){return s.containerState.furtherBlankLines||!Fe(g)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(g)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,n.attempt(rj,i,o)(g))}function o(g){return s.containerState._closeFlow=!0,s.interrupt=void 0,et(n,n.attempt(dn,i,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g)}}function uj(n,i,r){const s=this;return et(n,c,"listItemIndent",s.containerState.size+1);function c(d){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?i(d):r(d)}}function oj(n){n.exit(this.containerState.type)}function cj(n,i,r){const s=this;return et(n,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(d){const o=s.events[s.events.length-1];return!Fe(d)&&o&&o[1].type==="listItemPrefixWhitespace"?i(d):r(d)}}const cg={name:"setextUnderline",resolveTo:fj,tokenize:dj};function fj(n,i){let r=n.length,s,c,d;for(;r--;)if(n[r][0]==="enter"){if(n[r][1].type==="content"){s=r;break}n[r][1].type==="paragraph"&&(c=r)}else n[r][1].type==="content"&&n.splice(r,1),!d&&n[r][1].type==="definition"&&(d=r);const o={type:"setextHeading",start:{...n[s][1].start},end:{...n[n.length-1][1].end}};return n[c][1].type="setextHeadingText",d?(n.splice(c,0,["enter",o,i]),n.splice(d+1,0,["exit",n[s][1],i]),n[s][1].end={...n[d][1].end}):n[s][1]=o,n.push(["exit",o,i]),n}function dj(n,i,r){const s=this;let c;return d;function d(m){let b=s.events.length,y;for(;b--;)if(s.events[b][1].type!=="lineEnding"&&s.events[b][1].type!=="linePrefix"&&s.events[b][1].type!=="content"){y=s.events[b][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||y)?(n.enter("setextHeadingLine"),c=m,o(m)):r(m)}function o(m){return n.enter("setextHeadingLineSequence"),g(m)}function g(m){return m===c?(n.consume(m),g):(n.exit("setextHeadingLineSequence"),Fe(m)?et(n,p,"lineSuffix")(m):p(m))}function p(m){return m===null||Le(m)?(n.exit("setextHeadingLine"),i(m)):r(m)}}const hj={tokenize:mj};function mj(n){const i=this,r=n.attempt(ma,s,n.attempt(this.parser.constructs.flowInitial,c,et(n,n.attempt(this.parser.constructs.flow,c,n.attempt(xS,c)),"linePrefix")));return r;function s(d){if(d===null){n.consume(d);return}return n.enter("lineEndingBlank"),n.consume(d),n.exit("lineEndingBlank"),i.currentConstruct=void 0,r}function c(d){if(d===null){n.consume(d);return}return n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),i.currentConstruct=void 0,r}}const pj={resolveAll:Ty()},gj=Ny("string"),yj=Ny("text");function Ny(n){return{resolveAll:Ty(n==="text"?bj:void 0),tokenize:i};function i(r){const s=this,c=this.parser.constructs[n],d=r.attempt(c,o,g);return o;function o(b){return m(b)?d(b):g(b)}function g(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),p}function p(b){return m(b)?(r.exit("data"),d(b)):(r.consume(b),p)}function m(b){if(b===null)return!0;const y=c[b];let v=-1;if(y)for(;++v<y.length;){const S=y[v];if(!S.previous||S.previous.call(s,s.previous))return!0}return!1}}}function Ty(n){return i;function i(r,s){let c=-1,d;for(;++c<=r.length;)d===void 0?r[c]&&r[c][1].type==="data"&&(d=c,c++):(!r[c]||r[c][1].type!=="data")&&(c!==d+2&&(r[d][1].end=r[c-1][1].end,r.splice(d+2,c-d-2),c=d+2),d=void 0);return n?n(r,s):r}}function bj(n,i){let r=0;for(;++r<=n.length;)if((r===n.length||n[r][1].type==="lineEnding")&&n[r-1][1].type==="data"){const s=n[r-1][1],c=i.sliceStream(s);let d=c.length,o=-1,g=0,p;for(;d--;){const m=c[d];if(typeof m=="string"){for(o=m.length;m.charCodeAt(o-1)===32;)g++,o--;if(o)break;o=-1}else if(m===-2)p=!0,g++;else if(m!==-1){d++;break}}if(i._contentTypeTextTrailing&&r===n.length&&(g=0),g){const m={type:r===n.length||p||g<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?o:s.start._bufferIndex+o,_index:s.start._index+d,line:s.end.line,column:s.end.column-g,offset:s.end.offset-g},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(n.splice(r,0,["enter",m,i],["exit",m,i]),r+=2)}r++}return n}const xj={42:dn,43:dn,45:dn,48:dn,49:dn,50:dn,51:dn,52:dn,53:dn,54:dn,55:dn,56:dn,57:dn,62:vy},vj={91:wS},Sj={[-2]:Ec,[-1]:Ec,32:Ec},jj={35:zS,42:Bs,45:[cg,Bs],60:OS,61:cg,95:Bs,96:ug,126:ug},kj={38:jy,92:Sy},wj={[-5]:Nc,[-4]:Nc,[-3]:Nc,33:PS,38:jy,42:Fc,60:[eS,IS],91:ej,92:[TS,Sy],93:Cf,95:Fc,96:hS},Cj={null:[Fc,pj]},Ej={null:[42,95]},Nj={null:[]},Tj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Ej,contentInitial:vj,disable:Nj,document:xj,flow:jj,flowInitial:Sj,insideSpan:Cj,string:kj,text:wj},Symbol.toStringTag,{value:"Module"}));function Aj(n,i,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const c={},d=[];let o=[],g=[];const p={attempt:le(ue),check:le(L),consume:R,enter:U,exit:F,interrupt:le(L,{interrupt:!0})},m={code:null,containerState:{},defineSkip:O,events:[],now:N,parser:n,previous:null,sliceSerialize:v,sliceStream:S,write:y};let b=i.tokenize.call(m,p);return i.resolveAll&&d.push(i),m;function y(q){return o=On(o,q),z(),o[o.length-1]!==null?[]:(oe(i,0),m.events=Js(d,m.events,m),m.events)}function v(q,H){return Rj(S(q),H)}function S(q){return zj(o,q)}function N(){const{_bufferIndex:q,_index:H,line:re,column:me,offset:te}=s;return{_bufferIndex:q,_index:H,line:re,column:me,offset:te}}function O(q){c[q.line]=q.column,T()}function z(){let q;for(;s._index<o.length;){const H=o[s._index];if(typeof H=="string")for(q=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===q&&s._bufferIndex<H.length;)D(H.charCodeAt(s._bufferIndex));else D(H)}}function D(q){b=b(q)}function R(q){Le(q)?(s.line++,s.column=1,s.offset+=q===-3?2:1,T()):q!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=q}function U(q,H){const re=H||{};return re.type=q,re.start=N(),m.events.push(["enter",re,m]),g.push(re),re}function F(q){const H=g.pop();return H.end=N(),m.events.push(["exit",H,m]),H}function ue(q,H){oe(q,H.from)}function L(q,H){H.restore()}function le(q,H){return re;function re(me,te,C){let Y,fe,be,k;return Array.isArray(me)?X(me):"tokenize"in me?X([me]):A(me);function A($){return ae;function ae(ke){const Q=ke!==null&&$[ke],Se=ke!==null&&$.null,G=[...Array.isArray(Q)?Q:Q?[Q]:[],...Array.isArray(Se)?Se:Se?[Se]:[]];return X(G)(ke)}}function X($){return Y=$,fe=0,$.length===0?C:E($[fe])}function E($){return ae;function ae(ke){return k=W(),be=$,$.partial||(m.currentConstruct=$),$.name&&m.parser.constructs.disable.null.includes($.name)?ge():$.tokenize.call(H?Object.assign(Object.create(m),H):m,p,ee,ge)(ke)}}function ee($){return q(be,k),te}function ge($){return k.restore(),++fe<Y.length?E(Y[fe]):C}}}function oe(q,H){q.resolveAll&&!d.includes(q)&&d.push(q),q.resolve&&kn(m.events,H,m.events.length-H,q.resolve(m.events.slice(H),m)),q.resolveTo&&(m.events=q.resolveTo(m.events,m))}function W(){const q=N(),H=m.previous,re=m.currentConstruct,me=m.events.length,te=Array.from(g);return{from:me,restore:C};function C(){s=q,m.previous=H,m.currentConstruct=re,m.events.length=me,g=te,T()}}function T(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function zj(n,i){const r=i.start._index,s=i.start._bufferIndex,c=i.end._index,d=i.end._bufferIndex;let o;if(r===c)o=[n[r].slice(s,d)];else{if(o=n.slice(r,c),s>-1){const g=o[0];typeof g=="string"?o[0]=g.slice(s):o.shift()}d>0&&o.push(n[c].slice(0,d))}return o}function Rj(n,i){let r=-1;const s=[];let c;for(;++r<n.length;){const d=n[r];let o;if(typeof d=="string")o=d;else switch(d){case-5:{o="\r";break}case-4:{o=`
|
|
22
|
+
`;break}case-3:{o=`\r
|
|
23
|
+
`;break}case-2:{o=i?" ":" ";break}case-1:{if(!i&&c)continue;o=" ";break}default:o=String.fromCharCode(d)}c=d===-2,s.push(o)}return s.join("")}function Dj(n){const s={constructs:by([Tj,...(n||{}).extensions||[]]),content:c($1),defined:[],document:c(K1),flow:c(hj),lazy:{},string:c(gj),text:c(yj)};return s;function c(d){return o;function o(g){return Aj(s,d,g)}}}function _j(n){for(;!ky(n););return n}const fg=/[\0\t\n\r]/g;function Oj(){let n=1,i="",r=!0,s;return c;function c(d,o,g){const p=[];let m,b,y,v,S;for(d=i+(typeof d=="string"?d.toString():new TextDecoder(o||void 0).decode(d)),y=0,i="",r&&(d.charCodeAt(0)===65279&&y++,r=void 0);y<d.length;){if(fg.lastIndex=y,m=fg.exec(d),v=m&&m.index!==void 0?m.index:d.length,S=d.charCodeAt(v),!m){i=d.slice(y);break}if(S===10&&y===v&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),y<v&&(p.push(d.slice(y,v)),n+=v-y),S){case 0:{p.push(65533),n++;break}case 9:{for(b=Math.ceil(n/4)*4,p.push(-2);n++<b;)p.push(-1);break}case 10:{p.push(-4),n=1;break}default:s=!0,n=1}y=v+1}return g&&(s&&p.push(-5),i&&p.push(i),p.push(null)),p}}const Mj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Lj(n){return n.replace(Mj,Uj)}function Uj(n,i,r){if(i)return i;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),d=c===120||c===88;return xy(r.slice(d?2:1),d?16:10)}return wf(r)||n}const Ay={}.hasOwnProperty;function Bj(n,i,r){return i&&typeof i=="object"&&(r=i,i=void 0),qj(r)(_j(Dj(r).document().write(Oj()(n,i,!0))))}function qj(n){const i={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(st),autolinkProtocol:W,autolinkEmail:W,atxHeading:d(Oe),blockQuote:d(Se),characterEscape:W,characterReference:W,codeFenced:d(G),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:d(G,o),codeText:d(he,o),codeTextData:W,data:W,codeFlowValue:W,definition:d(ze),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:d(Ce),hardBreakEscape:d(Qe),hardBreakTrailing:d(Qe),htmlFlow:d(at,o),htmlFlowData:W,htmlText:d(at,o),htmlTextData:W,image:d(zt),label:o,link:d(st),listItem:d(jt),listItemValue:v,listOrdered:d(dt,y),listUnordered:d(dt),paragraph:d(tt),reference:E,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:d(Oe),strong:d(Mt),thematicBreak:d(Ft)},exit:{atxHeading:p(),atxHeadingSequence:ue,autolink:p(),autolinkEmail:Q,autolinkProtocol:ke,blockQuote:p(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:$,characterReference:ae,codeFenced:p(z),codeFencedFence:O,codeFencedFenceInfo:S,codeFencedFenceMeta:N,codeFlowValue:T,codeIndented:p(D),codeText:p(te),codeTextData:T,data:T,definition:p(),definitionDestinationString:F,definitionLabelString:R,definitionTitleString:U,emphasis:p(),hardBreakEscape:p(H),hardBreakTrailing:p(H),htmlFlow:p(re),htmlFlowData:T,htmlText:p(me),htmlTextData:T,image:p(Y),label:be,labelText:fe,lineEnding:q,link:p(C),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ee,resourceDestinationString:k,resourceTitleString:A,resource:X,setextHeading:p(oe),setextHeadingLineSequence:le,setextHeadingText:L,strong:p(),thematicBreak:p()}};zy(i,(n||{}).mdastExtensions||[]);const r={};return s;function s(ie){let pe={type:"root",children:[]};const De={stack:[pe],tokenStack:[],config:i,enter:g,exit:m,buffer:o,resume:b,data:r},_e=[];let qe=-1;for(;++qe<ie.length;)if(ie[qe][1].type==="listOrdered"||ie[qe][1].type==="listUnordered")if(ie[qe][0]==="enter")_e.push(qe);else{const kt=_e.pop();qe=c(ie,kt,qe)}for(qe=-1;++qe<ie.length;){const kt=i[ie[qe][0]];Ay.call(kt,ie[qe][1].type)&&kt[ie[qe][1].type].call(Object.assign({sliceSerialize:ie[qe][2].sliceSerialize},De),ie[qe][1])}if(De.tokenStack.length>0){const kt=De.tokenStack[De.tokenStack.length-1];(kt[1]||dg).call(De,void 0,kt[0])}for(pe.position={start:Hl(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:Hl(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<i.transforms.length;)pe=i.transforms[qe](pe)||pe;return pe}function c(ie,pe,De){let _e=pe-1,qe=-1,kt=!1,wt,Nt,ot,ht;for(;++_e<=De;){const $e=ie[_e];switch($e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$e[0]==="enter"?qe++:qe--,ht=void 0;break}case"lineEndingBlank":{$e[0]==="enter"&&(wt&&!ht&&!qe&&!ot&&(ot=_e),ht=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ht=void 0}if(!qe&&$e[0]==="enter"&&$e[1].type==="listItemPrefix"||qe===-1&&$e[0]==="exit"&&($e[1].type==="listUnordered"||$e[1].type==="listOrdered")){if(wt){let I=_e;for(Nt=void 0;I--;){const xe=ie[I];if(xe[1].type==="lineEnding"||xe[1].type==="lineEndingBlank"){if(xe[0]==="exit")continue;Nt&&(ie[Nt][1].type="lineEndingBlank",kt=!0),xe[1].type="lineEnding",Nt=I}else if(!(xe[1].type==="linePrefix"||xe[1].type==="blockQuotePrefix"||xe[1].type==="blockQuotePrefixWhitespace"||xe[1].type==="blockQuoteMarker"||xe[1].type==="listItemIndent"))break}ot&&(!Nt||ot<Nt)&&(wt._spread=!0),wt.end=Object.assign({},Nt?ie[Nt][1].start:$e[1].end),ie.splice(Nt||_e,0,["exit",wt,$e[2]]),_e++,De++}if($e[1].type==="listItemPrefix"){const I={type:"listItem",_spread:!1,start:Object.assign({},$e[1].start),end:void 0};wt=I,ie.splice(_e,0,["enter",I,$e[2]]),_e++,De++,ot=void 0,ht=!0}}}return ie[pe][1]._spread=kt,De}function d(ie,pe){return De;function De(_e){g.call(this,ie(_e),_e),pe&&pe.call(this,_e)}}function o(){this.stack.push({type:"fragment",children:[]})}function g(ie,pe,De){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([pe,De||void 0]),ie.position={start:Hl(pe.start),end:void 0}}function p(ie){return pe;function pe(De){ie&&ie.call(this,De),m.call(this,De)}}function m(ie,pe){const De=this.stack.pop(),_e=this.tokenStack.pop();if(_e)_e[0].type!==ie.type&&(pe?pe.call(this,ie,_e[0]):(_e[1]||dg).call(this,ie,_e[0]));else throw new Error("Cannot close `"+ie.type+"` ("+ia({start:ie.start,end:ie.end})+"): it’s not open");De.position.end=Hl(ie.end)}function b(){return kf(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function v(ie){if(this.data.expectingFirstListItemValue){const pe=this.stack[this.stack.length-2];pe.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function S(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.lang=ie}function N(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.meta=ie}function O(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function z(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function D(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.value=ie.replace(/(\r?\n|\r)$/g,"")}function R(ie){const pe=this.resume(),De=this.stack[this.stack.length-1];De.label=pe,De.identifier=Yn(this.sliceSerialize(ie)).toLowerCase()}function U(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.title=ie}function F(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.url=ie}function ue(ie){const pe=this.stack[this.stack.length-1];if(!pe.depth){const De=this.sliceSerialize(ie).length;pe.depth=De}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function le(ie){const pe=this.stack[this.stack.length-1];pe.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function oe(){this.data.setextHeadingSlurpLineEnding=void 0}function W(ie){const De=this.stack[this.stack.length-1].children;let _e=De[De.length-1];(!_e||_e.type!=="text")&&(_e=ut(),_e.position={start:Hl(ie.start),end:void 0},De.push(_e)),this.stack.push(_e)}function T(ie){const pe=this.stack.pop();pe.value+=this.sliceSerialize(ie),pe.position.end=Hl(ie.end)}function q(ie){const pe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=pe.children[pe.children.length-1];De.position.end=Hl(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(pe.type)&&(W.call(this,ie),T.call(this,ie))}function H(){this.data.atHardBreak=!0}function re(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.value=ie}function me(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.value=ie}function te(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.value=ie}function C(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=pe,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function Y(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const pe=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=pe,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function fe(ie){const pe=this.sliceSerialize(ie),De=this.stack[this.stack.length-2];De.label=Lj(pe),De.identifier=Yn(pe).toLowerCase()}function be(){const ie=this.stack[this.stack.length-1],pe=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const _e=ie.children;De.children=_e}else De.alt=pe}function k(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.url=ie}function A(){const ie=this.resume(),pe=this.stack[this.stack.length-1];pe.title=ie}function X(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function ee(ie){const pe=this.resume(),De=this.stack[this.stack.length-1];De.label=pe,De.identifier=Yn(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ge(ie){this.data.characterReferenceType=ie.type}function $(ie){const pe=this.sliceSerialize(ie),De=this.data.characterReferenceType;let _e;De?(_e=xy(pe,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_e=wf(pe);const qe=this.stack[this.stack.length-1];qe.value+=_e}function ae(ie){const pe=this.stack.pop();pe.position.end=Hl(ie.end)}function ke(ie){T.call(this,ie);const pe=this.stack[this.stack.length-1];pe.url=this.sliceSerialize(ie)}function Q(ie){T.call(this,ie);const pe=this.stack[this.stack.length-1];pe.url="mailto:"+this.sliceSerialize(ie)}function Se(){return{type:"blockquote",children:[]}}function G(){return{type:"code",lang:null,meta:null,value:""}}function he(){return{type:"inlineCode",value:""}}function ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ce(){return{type:"emphasis",children:[]}}function Oe(){return{type:"heading",depth:0,children:[]}}function Qe(){return{type:"break"}}function at(){return{type:"html",value:""}}function zt(){return{type:"image",title:null,url:"",alt:null}}function st(){return{type:"link",title:null,url:"",children:[]}}function dt(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function jt(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Mt(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function Ft(){return{type:"thematicBreak"}}}function Hl(n){return{line:n.line,column:n.column,offset:n.offset}}function zy(n,i){let r=-1;for(;++r<i.length;){const s=i[r];Array.isArray(s)?zy(n,s):Hj(n,s)}}function Hj(n,i){let r;for(r in i)if(Ay.call(i,r))switch(r){case"canContainEols":{const s=i[r];s&&n[r].push(...s);break}case"transforms":{const s=i[r];s&&n[r].push(...s);break}case"enter":case"exit":{const s=i[r];s&&Object.assign(n[r],s);break}}}function dg(n,i){throw n?new Error("Cannot close `"+n.type+"` ("+ia({start:n.start,end:n.end})+"): a different token (`"+i.type+"`, "+ia({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+ia({start:i.start,end:i.end})+") is still open")}function Ij(n){const i=this;i.parser=r;function r(s){return Bj(s,{...i.data("settings"),...n,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function Yj(n,i){const r={type:"element",tagName:"blockquote",properties:{},children:n.wrap(n.all(i),!0)};return n.patch(i,r),n.applyData(i,r)}function Gj(n,i){const r={type:"element",tagName:"br",properties:{},children:[]};return n.patch(i,r),[n.applyData(i,r),{type:"text",value:`
|
|
24
|
+
`}]}function Vj(n,i){const r=i.value?i.value+`
|
|
25
|
+
`:"",s={},c=i.lang?i.lang.split(/\s+/):[];c.length>0&&(s.className=["language-"+c[0]]);let d={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return i.meta&&(d.data={meta:i.meta}),n.patch(i,d),d=n.applyData(i,d),d={type:"element",tagName:"pre",properties:{},children:[d]},n.patch(i,d),d}function Qj(n,i){const r={type:"element",tagName:"del",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function Xj(n,i){const r={type:"element",tagName:"em",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function $j(n,i){const r=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",s=String(i.identifier).toUpperCase(),c=rr(s.toLowerCase()),d=n.footnoteOrder.indexOf(s);let o,g=n.footnoteCounts.get(s);g===void 0?(g=0,n.footnoteOrder.push(s),o=n.footnoteOrder.length):o=d+1,g+=1,n.footnoteCounts.set(s,g);const p={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+c,id:r+"fnref-"+c+(g>1?"-"+g:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};n.patch(i,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return n.patch(i,m),n.applyData(i,m)}function Zj(n,i){const r={type:"element",tagName:"h"+i.depth,properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function Kj(n,i){if(n.options.allowDangerousHtml){const r={type:"raw",value:i.value};return n.patch(i,r),n.applyData(i,r)}}function Ry(n,i){const r=i.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+s}];const c=n.all(i),d=c[0];d&&d.type==="text"?d.value="["+d.value:c.unshift({type:"text",value:"["});const o=c[c.length-1];return o&&o.type==="text"?o.value+=s:c.push({type:"text",value:s}),c}function Fj(n,i){const r=String(i.identifier).toUpperCase(),s=n.definitionById.get(r);if(!s)return Ry(n,i);const c={src:rr(s.url||""),alt:i.alt};s.title!==null&&s.title!==void 0&&(c.title=s.title);const d={type:"element",tagName:"img",properties:c,children:[]};return n.patch(i,d),n.applyData(i,d)}function Jj(n,i){const r={src:rr(i.url)};i.alt!==null&&i.alt!==void 0&&(r.alt=i.alt),i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"img",properties:r,children:[]};return n.patch(i,s),n.applyData(i,s)}function Pj(n,i){const r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};n.patch(i,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return n.patch(i,s),n.applyData(i,s)}function Wj(n,i){const r=String(i.identifier).toUpperCase(),s=n.definitionById.get(r);if(!s)return Ry(n,i);const c={href:rr(s.url||"")};s.title!==null&&s.title!==void 0&&(c.title=s.title);const d={type:"element",tagName:"a",properties:c,children:n.all(i)};return n.patch(i,d),n.applyData(i,d)}function ek(n,i){const r={href:rr(i.url)};i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"a",properties:r,children:n.all(i)};return n.patch(i,s),n.applyData(i,s)}function tk(n,i,r){const s=n.all(i),c=r?nk(r):Dy(i),d={},o=[];if(typeof i.checked=="boolean"){const b=s[0];let y;b&&b.type==="element"&&b.tagName==="p"?y=b:(y={type:"element",tagName:"p",properties:{},children:[]},s.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),d.className=["task-list-item"]}let g=-1;for(;++g<s.length;){const b=s[g];(c||g!==0||b.type!=="element"||b.tagName!=="p")&&o.push({type:"text",value:`
|
|
26
|
+
`}),b.type==="element"&&b.tagName==="p"&&!c?o.push(...b.children):o.push(b)}const p=s[s.length-1];p&&(c||p.type!=="element"||p.tagName!=="p")&&o.push({type:"text",value:`
|
|
27
|
+
`});const m={type:"element",tagName:"li",properties:d,children:o};return n.patch(i,m),n.applyData(i,m)}function nk(n){let i=!1;if(n.type==="list"){i=n.spread||!1;const r=n.children;let s=-1;for(;!i&&++s<r.length;)i=Dy(r[s])}return i}function Dy(n){const i=n.spread;return i??n.children.length>1}function lk(n,i){const r={},s=n.all(i);let c=-1;for(typeof i.start=="number"&&i.start!==1&&(r.start=i.start);++c<s.length;){const o=s[c];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const d={type:"element",tagName:i.ordered?"ol":"ul",properties:r,children:n.wrap(s,!0)};return n.patch(i,d),n.applyData(i,d)}function ik(n,i){const r={type:"element",tagName:"p",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function rk(n,i){const r={type:"root",children:n.wrap(n.all(i))};return n.patch(i,r),n.applyData(i,r)}function ak(n,i){const r={type:"element",tagName:"strong",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function sk(n,i){const r=n.all(i),s=r.shift(),c=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:n.wrap([s],!0)};n.patch(i.children[0],o),c.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:n.wrap(r,!0)},g=xf(i.children[1]),p=fy(i.children[i.children.length-1]);g&&p&&(o.position={start:g,end:p}),c.push(o)}const d={type:"element",tagName:"table",properties:{},children:n.wrap(c,!0)};return n.patch(i,d),n.applyData(i,d)}function uk(n,i,r){const s=r?r.children:void 0,d=(s?s.indexOf(i):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,g=o?o.length:i.children.length;let p=-1;const m=[];for(;++p<g;){const y=i.children[p],v={},S=o?o[p]:void 0;S&&(v.align=S);let N={type:"element",tagName:d,properties:v,children:[]};y&&(N.children=n.all(y),n.patch(y,N),N=n.applyData(y,N)),m.push(N)}const b={type:"element",tagName:"tr",properties:{},children:n.wrap(m,!0)};return n.patch(i,b),n.applyData(i,b)}function ok(n,i){const r={type:"element",tagName:"td",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}const hg=9,mg=32;function ck(n){const i=String(n),r=/\r?\n|\r/g;let s=r.exec(i),c=0;const d=[];for(;s;)d.push(pg(i.slice(c,s.index),c>0,!0),s[0]),c=s.index+s[0].length,s=r.exec(i);return d.push(pg(i.slice(c),c>0,!1)),d.join("")}function pg(n,i,r){let s=0,c=n.length;if(i){let d=n.codePointAt(s);for(;d===hg||d===mg;)s++,d=n.codePointAt(s)}if(r){let d=n.codePointAt(c-1);for(;d===hg||d===mg;)c--,d=n.codePointAt(c-1)}return c>s?n.slice(s,c):""}function fk(n,i){const r={type:"text",value:ck(String(i.value))};return n.patch(i,r),n.applyData(i,r)}function dk(n,i){const r={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(i,r),n.applyData(i,r)}const hk={blockquote:Yj,break:Gj,code:Vj,delete:Qj,emphasis:Xj,footnoteReference:$j,heading:Zj,html:Kj,imageReference:Fj,image:Jj,inlineCode:Pj,linkReference:Wj,link:ek,listItem:tk,list:lk,paragraph:ik,root:rk,strong:ak,table:sk,tableCell:ok,tableRow:uk,text:fk,thematicBreak:dk,toml:Ds,yaml:Ds,definition:Ds,footnoteDefinition:Ds};function Ds(){}const _y=-1,Ps=0,aa=1,Gs=2,Ef=3,Nf=4,Tf=5,Af=6,Oy=7,My=8,mk=typeof self=="object"?self:globalThis,gg=(n,i)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new mk[n](i)},pk=(n,i)=>{const r=(c,d)=>(n.set(d,c),c),s=c=>{if(n.has(c))return n.get(c);const[d,o]=i[c];switch(d){case Ps:case _y:return r(o,c);case aa:{const g=r([],c);for(const p of o)g.push(s(p));return g}case Gs:{const g=r({},c);for(const[p,m]of o)g[s(p)]=s(m);return g}case Ef:return r(new Date(o),c);case Nf:{const{source:g,flags:p}=o;return r(new RegExp(g,p),c)}case Tf:{const g=r(new Map,c);for(const[p,m]of o)g.set(s(p),s(m));return g}case Af:{const g=r(new Set,c);for(const p of o)g.add(s(p));return g}case Oy:{const{name:g,message:p}=o;return r(gg(g,p),c)}case My:return r(BigInt(o),c);case"BigInt":return r(Object(BigInt(o)),c);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:g}=new Uint8Array(o);return r(new DataView(g),o)}}return r(gg(d,o),c)};return s},yg=n=>pk(new Map,n)(0),er="",{toString:gk}={},{keys:yk}=Object,ta=n=>{const i=typeof n;if(i!=="object"||!n)return[Ps,i];const r=gk.call(n).slice(8,-1);switch(r){case"Array":return[aa,er];case"Object":return[Gs,er];case"Date":return[Ef,er];case"RegExp":return[Nf,er];case"Map":return[Tf,er];case"Set":return[Af,er];case"DataView":return[aa,r]}return r.includes("Array")?[aa,r]:r.includes("Error")?[Oy,r]:[Gs,r]},_s=([n,i])=>n===Ps&&(i==="function"||i==="symbol"),bk=(n,i,r,s)=>{const c=(o,g)=>{const p=s.push(o)-1;return r.set(g,p),p},d=o=>{if(r.has(o))return r.get(o);let[g,p]=ta(o);switch(g){case Ps:{let b=o;switch(p){case"bigint":g=My,b=o.toString();break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+p);b=null;break;case"undefined":return c([_y],o)}return c([g,b],o)}case aa:{if(p){let v=o;return p==="DataView"?v=new Uint8Array(o.buffer):p==="ArrayBuffer"&&(v=new Uint8Array(o)),c([p,[...v]],o)}const b=[],y=c([g,b],o);for(const v of o)b.push(d(v));return y}case Gs:{if(p)switch(p){case"BigInt":return c([p,o.toString()],o);case"Boolean":case"Number":case"String":return c([p,o.valueOf()],o)}if(i&&"toJSON"in o)return d(o.toJSON());const b=[],y=c([g,b],o);for(const v of yk(o))(n||!_s(ta(o[v])))&&b.push([d(v),d(o[v])]);return y}case Ef:return c([g,o.toISOString()],o);case Nf:{const{source:b,flags:y}=o;return c([g,{source:b,flags:y}],o)}case Tf:{const b=[],y=c([g,b],o);for(const[v,S]of o)(n||!(_s(ta(v))||_s(ta(S))))&&b.push([d(v),d(S)]);return y}case Af:{const b=[],y=c([g,b],o);for(const v of o)(n||!_s(ta(v)))&&b.push(d(v));return y}}const{message:m}=o;return c([g,{name:p,message:m}],o)};return d},bg=(n,{json:i,lossy:r}={})=>{const s=[];return bk(!(i||r),!!i,new Map,s)(n),s},Vs=typeof structuredClone=="function"?(n,i)=>i&&("json"in i||"lossy"in i)?yg(bg(n,i)):structuredClone(n):(n,i)=>yg(bg(n,i));function xk(n,i){const r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function vk(n,i){return"Back to reference "+(n+1)+(i>1?"-"+i:"")}function Sk(n){const i=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",r=n.options.footnoteBackContent||xk,s=n.options.footnoteBackLabel||vk,c=n.options.footnoteLabel||"Footnotes",d=n.options.footnoteLabelTagName||"h2",o=n.options.footnoteLabelProperties||{className:["sr-only"]},g=[];let p=-1;for(;++p<n.footnoteOrder.length;){const m=n.footnoteById.get(n.footnoteOrder[p]);if(!m)continue;const b=n.all(m),y=String(m.identifier).toUpperCase(),v=rr(y.toLowerCase());let S=0;const N=[],O=n.footnoteCounts.get(y);for(;O!==void 0&&++S<=O;){N.length>0&&N.push({type:"text",value:" "});let R=typeof r=="string"?r:r(p,S);typeof R=="string"&&(R={type:"text",value:R}),N.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+v+(S>1?"-"+S:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,S),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const z=b[b.length-1];if(z&&z.type==="element"&&z.tagName==="p"){const R=z.children[z.children.length-1];R&&R.type==="text"?R.value+=" ":z.children.push({type:"text",value:" "}),z.children.push(...N)}else b.push(...N);const D={type:"element",tagName:"li",properties:{id:i+"fn-"+v},children:n.wrap(b,!0)};n.patch(m,D),g.push(D)}if(g.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:d,properties:{...Vs(o),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
28
|
+
`},{type:"element",tagName:"ol",properties:{},children:n.wrap(g,!0)},{type:"text",value:`
|
|
29
|
+
`}]}}const Ws=(function(n){if(n==null)return Ck;if(typeof n=="function")return eu(n);if(typeof n=="object")return Array.isArray(n)?jk(n):kk(n);if(typeof n=="string")return wk(n);throw new Error("Expected function, string, or object as test")});function jk(n){const i=[];let r=-1;for(;++r<n.length;)i[r]=Ws(n[r]);return eu(s);function s(...c){let d=-1;for(;++d<i.length;)if(i[d].apply(this,c))return!0;return!1}}function kk(n){const i=n;return eu(r);function r(s){const c=s;let d;for(d in n)if(c[d]!==i[d])return!1;return!0}}function wk(n){return eu(i);function i(r){return r&&r.type===n}}function eu(n){return i;function i(r,s,c){return!!(Ek(r)&&n.call(this,r,typeof s=="number"?s:void 0,c||void 0))}}function Ck(){return!0}function Ek(n){return n!==null&&typeof n=="object"&&"type"in n}const Ly=[],Nk=!0,Jc=!1,Tk="skip";function Uy(n,i,r,s){let c;typeof i=="function"&&typeof r!="function"?(s=r,r=i):c=i;const d=Ws(c),o=s?-1:1;g(n,void 0,[])();function g(p,m,b){const y=p&&typeof p=="object"?p:{};if(typeof y.type=="string"){const S=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(p.type+(S?"<"+S+">":""))+")"})}return v;function v(){let S=Ly,N,O,z;if((!i||d(p,m,b[b.length-1]||void 0))&&(S=Ak(r(p,b)),S[0]===Jc))return S;if("children"in p&&p.children){const D=p;if(D.children&&S[0]!==Tk)for(O=(s?D.children.length:-1)+o,z=b.concat(D);O>-1&&O<D.children.length;){const R=D.children[O];if(N=g(R,O,z)(),N[0]===Jc)return N;O=typeof N[1]=="number"?N[1]:O+o}}return S}}}function Ak(n){return Array.isArray(n)?n:typeof n=="number"?[Nk,n]:n==null?Ly:[n]}function zf(n,i,r,s){let c,d,o;typeof i=="function"&&typeof r!="function"?(d=void 0,o=i,c=r):(d=i,o=r,c=s),Uy(n,d,g,c);function g(p,m){const b=m[m.length-1],y=b?b.children.indexOf(p):void 0;return o(p,y,b)}}const Pc={}.hasOwnProperty,zk={};function Rk(n,i){const r=i||zk,s=new Map,c=new Map,d=new Map,o={...hk,...r.handlers},g={all:m,applyData:_k,definitionById:s,footnoteById:c,footnoteCounts:d,footnoteOrder:[],handlers:o,one:p,options:r,patch:Dk,wrap:Mk};return zf(n,function(b){if(b.type==="definition"||b.type==="footnoteDefinition"){const y=b.type==="definition"?s:c,v=String(b.identifier).toUpperCase();y.has(v)||y.set(v,b)}}),g;function p(b,y){const v=b.type,S=g.handlers[v];if(Pc.call(g.handlers,v)&&S)return S(g,b,y);if(g.options.passThrough&&g.options.passThrough.includes(v)){if("children"in b){const{children:O,...z}=b,D=Vs(z);return D.children=g.all(b),D}return Vs(b)}return(g.options.unknownHandler||Ok)(g,b,y)}function m(b){const y=[];if("children"in b){const v=b.children;let S=-1;for(;++S<v.length;){const N=g.one(v[S],b);if(N){if(S&&v[S-1].type==="break"&&(!Array.isArray(N)&&N.type==="text"&&(N.value=xg(N.value)),!Array.isArray(N)&&N.type==="element")){const O=N.children[0];O&&O.type==="text"&&(O.value=xg(O.value))}Array.isArray(N)?y.push(...N):y.push(N)}}}return y}}function Dk(n,i){n.position&&(i.position=x1(n))}function _k(n,i){let r=i;if(n&&n.data){const s=n.data.hName,c=n.data.hChildren,d=n.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const o="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:o}}r.type==="element"&&d&&Object.assign(r.properties,Vs(d)),"children"in r&&r.children&&c!==null&&c!==void 0&&(r.children=c)}return r}function Ok(n,i){const r=i.data||{},s="value"in i&&!(Pc.call(r,"hProperties")||Pc.call(r,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:n.all(i)};return n.patch(i,s),n.applyData(i,s)}function Mk(n,i){const r=[];let s=-1;for(i&&r.push({type:"text",value:`
|
|
30
|
+
`});++s<n.length;)s&&r.push({type:"text",value:`
|
|
31
|
+
`}),r.push(n[s]);return i&&n.length>0&&r.push({type:"text",value:`
|
|
32
|
+
`}),r}function xg(n){let i=0,r=n.charCodeAt(i);for(;r===9||r===32;)i++,r=n.charCodeAt(i);return n.slice(i)}function vg(n,i){const r=Rk(n,i),s=r.one(n,void 0),c=Sk(r),d=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return c&&d.children.push({type:"text",value:`
|
|
33
|
+
`},c),d}function Lk(n,i){return n&&"run"in n?async function(r,s){const c=vg(r,{file:s,...i});await n.run(c,s)}:function(r,s){return vg(r,{file:s,...n||i})}}function Sg(n){if(n)throw n}var Tc,jg;function Uk(){if(jg)return Tc;jg=1;var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=function(m){return typeof Array.isArray=="function"?Array.isArray(m):i.call(m)==="[object Array]"},d=function(m){if(!m||i.call(m)!=="[object Object]")return!1;var b=n.call(m,"constructor"),y=m.constructor&&m.constructor.prototype&&n.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!b&&!y)return!1;var v;for(v in m);return typeof v>"u"||n.call(m,v)},o=function(m,b){r&&b.name==="__proto__"?r(m,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):m[b.name]=b.newValue},g=function(m,b){if(b==="__proto__")if(n.call(m,b)){if(s)return s(m,b).value}else return;return m[b]};return Tc=function p(){var m,b,y,v,S,N,O=arguments[0],z=1,D=arguments.length,R=!1;for(typeof O=="boolean"&&(R=O,O=arguments[1]||{},z=2),(O==null||typeof O!="object"&&typeof O!="function")&&(O={});z<D;++z)if(m=arguments[z],m!=null)for(b in m)y=g(O,b),v=g(m,b),O!==v&&(R&&v&&(d(v)||(S=c(v)))?(S?(S=!1,N=y&&c(y)?y:[]):N=y&&d(y)?y:{},o(O,{name:b,newValue:p(R,N,v)})):typeof v<"u"&&o(O,{name:b,newValue:v}));return O},Tc}var Bk=Uk();const Ac=sf(Bk);function Wc(n){if(typeof n!="object"||n===null)return!1;const i=Object.getPrototypeOf(n);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function qk(){const n=[],i={run:r,use:s};return i;function r(...c){let d=-1;const o=c.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);g(null,...c);function g(p,...m){const b=n[++d];let y=-1;if(p){o(p);return}for(;++y<c.length;)(m[y]===null||m[y]===void 0)&&(m[y]=c[y]);c=m,b?Hk(b,g)(...m):o(null,...m)}}function s(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return n.push(c),i}}function Hk(n,i){let r;return s;function s(...o){const g=n.length>o.length;let p;g&&o.push(c);try{p=n.apply(this,o)}catch(m){const b=m;if(g&&r)throw b;return c(b)}g||(p&&p.then&&typeof p.then=="function"?p.then(d,c):p instanceof Error?c(p):d(p))}function c(o,...g){r||(r=!0,i(o,...g))}function d(o){c(null,o)}}const $n={basename:Ik,dirname:Yk,extname:Gk,join:Vk,sep:"/"};function Ik(n,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');pa(n);let r=0,s=-1,c=n.length,d;if(i===void 0||i.length===0||i.length>n.length){for(;c--;)if(n.codePointAt(c)===47){if(d){r=c+1;break}}else s<0&&(d=!0,s=c+1);return s<0?"":n.slice(r,s)}if(i===n)return"";let o=-1,g=i.length-1;for(;c--;)if(n.codePointAt(c)===47){if(d){r=c+1;break}}else o<0&&(d=!0,o=c+1),g>-1&&(n.codePointAt(c)===i.codePointAt(g--)?g<0&&(s=c):(g=-1,s=o));return r===s?s=o:s<0&&(s=n.length),n.slice(r,s)}function Yk(n){if(pa(n),n.length===0)return".";let i=-1,r=n.length,s;for(;--r;)if(n.codePointAt(r)===47){if(s){i=r;break}}else s||(s=!0);return i<0?n.codePointAt(0)===47?"/":".":i===1&&n.codePointAt(0)===47?"//":n.slice(0,i)}function Gk(n){pa(n);let i=n.length,r=-1,s=0,c=-1,d=0,o;for(;i--;){const g=n.codePointAt(i);if(g===47){if(o){s=i+1;break}continue}r<0&&(o=!0,r=i+1),g===46?c<0?c=i:d!==1&&(d=1):c>-1&&(d=-1)}return c<0||r<0||d===0||d===1&&c===r-1&&c===s+1?"":n.slice(c,r)}function Vk(...n){let i=-1,r;for(;++i<n.length;)pa(n[i]),n[i]&&(r=r===void 0?n[i]:r+"/"+n[i]);return r===void 0?".":Qk(r)}function Qk(n){pa(n);const i=n.codePointAt(0)===47;let r=Xk(n,!i);return r.length===0&&!i&&(r="."),r.length>0&&n.codePointAt(n.length-1)===47&&(r+="/"),i?"/"+r:r}function Xk(n,i){let r="",s=0,c=-1,d=0,o=-1,g,p;for(;++o<=n.length;){if(o<n.length)g=n.codePointAt(o);else{if(g===47)break;g=47}if(g===47){if(!(c===o-1||d===1))if(c!==o-1&&d===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(p=r.lastIndexOf("/"),p!==r.length-1){p<0?(r="",s=0):(r=r.slice(0,p),s=r.length-1-r.lastIndexOf("/")),c=o,d=0;continue}}else if(r.length>0){r="",s=0,c=o,d=0;continue}}i&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+n.slice(c+1,o):r=n.slice(c+1,o),s=o-c-1;c=o,d=0}else g===46&&d>-1?d++:d=-1}return r}function pa(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const $k={cwd:Zk};function Zk(){return"/"}function ef(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Kk(n){if(typeof n=="string")n=new URL(n);else if(!ef(n)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(n.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return Fk(n)}function Fk(n){if(n.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const i=n.pathname;let r=-1;for(;++r<i.length;)if(i.codePointAt(r)===37&&i.codePointAt(r+1)===50){const s=i.codePointAt(r+2);if(s===70||s===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(i)}const zc=["history","path","basename","stem","extname","dirname"];class By{constructor(i){let r;i?ef(i)?r={path:i}:typeof i=="string"||Jk(i)?r={value:i}:r=i:r={},this.cwd="cwd"in r?"":$k.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<zc.length;){const d=zc[s];d in r&&r[d]!==void 0&&r[d]!==null&&(this[d]=d==="history"?[...r[d]]:r[d])}let c;for(c in r)zc.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?$n.basename(this.path):void 0}set basename(i){Dc(i,"basename"),Rc(i,"basename"),this.path=$n.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?$n.dirname(this.path):void 0}set dirname(i){kg(this.basename,"dirname"),this.path=$n.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?$n.extname(this.path):void 0}set extname(i){if(Rc(i,"extname"),kg(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=$n.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){ef(i)&&(i=Kk(i)),Dc(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?$n.basename(this.path,this.extname):void 0}set stem(i){Dc(i,"stem"),Rc(i,"stem"),this.path=$n.join(this.dirname||"",i+(this.extname||""))}fail(i,r,s){const c=this.message(i,r,s);throw c.fatal=!0,c}info(i,r,s){const c=this.message(i,r,s);return c.fatal=void 0,c}message(i,r,s){const c=new Wt(i,r,s);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function Rc(n,i){if(n&&n.includes($n.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+$n.sep+"`")}function Dc(n,i){if(!n)throw new Error("`"+i+"` cannot be empty")}function kg(n,i){if(!n)throw new Error("Setting `"+i+"` requires `path` to be set too")}function Jk(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const Pk=(function(n){const s=this.constructor.prototype,c=s[n],d=function(){return c.apply(d,arguments)};return Object.setPrototypeOf(d,s),d}),Wk={}.hasOwnProperty;class Rf extends Pk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=qk()}copy(){const i=new Rf;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];i.use(...s)}return i.data(Ac(!0,{},this.namespace)),i}data(i,r){return typeof i=="string"?arguments.length===2?(Mc("data",this.frozen),this.namespace[i]=r,this):Wk.call(this.namespace,i)&&this.namespace[i]||void 0:i?(Mc("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const c=r.call(i,...s);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const r=Os(i),s=this.parser||this.Parser;return _c("parse",s),s(String(r),r)}process(i,r){const s=this;return this.freeze(),_c("process",this.parser||this.Parser),Oc("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(d,o){const g=Os(i),p=s.parse(g);s.run(p,g,function(b,y,v){if(b||!y||!v)return m(b);const S=y,N=s.stringify(S,v);nw(N)?v.value=N:v.result=N,m(b,v)});function m(b,y){b||!y?o(b):d?d(y):r(void 0,y)}}}processSync(i){let r=!1,s;return this.freeze(),_c("processSync",this.parser||this.Parser),Oc("processSync",this.compiler||this.Compiler),this.process(i,c),Cg("processSync","process",r),s;function c(d,o){r=!0,Sg(d),s=o}}run(i,r,s){wg(i),this.freeze();const c=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?d(void 0,s):new Promise(d);function d(o,g){const p=Os(r);c.run(i,p,m);function m(b,y,v){const S=y||i;b?g(b):o?o(S):s(void 0,S,v)}}}runSync(i,r){let s=!1,c;return this.run(i,r,d),Cg("runSync","run",s),c;function d(o,g){Sg(o),c=g,s=!0}}stringify(i,r){this.freeze();const s=Os(r),c=this.compiler||this.Compiler;return Oc("stringify",c),wg(i),c(i,s)}use(i,...r){const s=this.attachers,c=this.namespace;if(Mc("use",this.frozen),i!=null)if(typeof i=="function")p(i,r);else if(typeof i=="object")Array.isArray(i)?g(i):o(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function d(m){if(typeof m=="function")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[b,...y]=m;p(b,y)}else o(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function o(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");g(m.plugins),m.settings&&(c.settings=Ac(!0,c.settings,m.settings))}function g(m){let b=-1;if(m!=null)if(Array.isArray(m))for(;++b<m.length;){const y=m[b];d(y)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,b){let y=-1,v=-1;for(;++y<s.length;)if(s[y][0]===m){v=y;break}if(v===-1)s.push([m,...b]);else if(b.length>0){let[S,...N]=b;const O=s[v][1];Wc(O)&&Wc(S)&&(S=Ac(!0,O,S)),s[v]=[m,S,...N]}}}}const ew=new Rf().freeze();function _c(n,i){if(typeof i!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Oc(n,i){if(typeof i!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function Mc(n,i){if(i)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function wg(n){if(!Wc(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function Cg(n,i,r){if(!r)throw new Error("`"+n+"` finished async. Use `"+i+"` instead")}function Os(n){return tw(n)?n:new By(n)}function tw(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function nw(n){return typeof n=="string"||lw(n)}function lw(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const iw="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Eg=[],Ng={allowDangerousHtml:!0},rw=/^(https?|ircs?|mailto|xmpp)$/i,aw=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function sw(n){const i=uw(n),r=ow(n);return cw(i.runSync(i.parse(r),r),n)}function uw(n){const i=n.rehypePlugins||Eg,r=n.remarkPlugins||Eg,s=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...Ng}:Ng;return ew().use(Ij).use(r).use(Lk,s).use(i)}function ow(n){const i=n.children||"",r=new By;return typeof i=="string"&&(r.value=i),r}function cw(n,i){const r=i.allowedElements,s=i.allowElement,c=i.components,d=i.disallowedElements,o=i.skipHtml,g=i.unwrapDisallowed,p=i.urlTransform||fw;for(const b of aw)Object.hasOwn(i,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+iw+b.id,void 0);return i.className&&(n={type:"element",tagName:"div",properties:{className:i.className},children:n.type==="root"?n.children:[n]}),zf(n,m),w1(n,{Fragment:u.Fragment,components:c,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function m(b,y,v){if(b.type==="raw"&&v&&typeof y=="number")return o?v.children.splice(y,1):v.children[y]={type:"text",value:b.value},y;if(b.type==="element"){let S;for(S in Cc)if(Object.hasOwn(Cc,S)&&Object.hasOwn(b.properties,S)){const N=b.properties[S],O=Cc[S];(O===null||O.includes(b.tagName))&&(b.properties[S]=p(String(N||""),S,b))}}if(b.type==="element"){let S=r?!r.includes(b.tagName):d?d.includes(b.tagName):!1;if(!S&&s&&typeof y=="number"&&(S=!s(b,y,v)),S&&v&&typeof y=="number")return g&&b.children?v.children.splice(y,1,...b.children):v.children.splice(y,1),y}}}function fw(n){const i=n.indexOf(":"),r=n.indexOf("?"),s=n.indexOf("#"),c=n.indexOf("/");return i===-1||c!==-1&&i>c||r!==-1&&i>r||s!==-1&&i>s||rw.test(n.slice(0,i))?n:""}function Tg(n,i){const r=String(n);if(typeof i!="string")throw new TypeError("Expected character");let s=0,c=r.indexOf(i);for(;c!==-1;)s++,c=r.indexOf(i,c+i.length);return s}function dw(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function hw(n,i,r){const c=Ws((r||{}).ignore||[]),d=mw(i);let o=-1;for(;++o<d.length;)Uy(n,"text",g);function g(m,b){let y=-1,v;for(;++y<b.length;){const S=b[y],N=v?v.children:void 0;if(c(S,N?N.indexOf(S):void 0,v))return;v=S}if(v)return p(m,b)}function p(m,b){const y=b[b.length-1],v=d[o][0],S=d[o][1];let N=0;const z=y.children.indexOf(m);let D=!1,R=[];v.lastIndex=0;let U=v.exec(m.value);for(;U;){const F=U.index,ue={index:U.index,input:U.input,stack:[...b,m]};let L=S(...U,ue);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?v.lastIndex=F+1:(N!==F&&R.push({type:"text",value:m.value.slice(N,F)}),Array.isArray(L)?R.push(...L):L&&R.push(L),N=F+U[0].length,D=!0),!v.global)break;U=v.exec(m.value)}return D?(N<m.value.length&&R.push({type:"text",value:m.value.slice(N)}),y.children.splice(z,1,...R)):R=[m],z+R.length}}function mw(n){const i=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!n[0]||Array.isArray(n[0])?n:[n];let s=-1;for(;++s<r.length;){const c=r[s];i.push([pw(c[0]),gw(c[1])])}return i}function pw(n){return typeof n=="string"?new RegExp(dw(n),"g"):n}function gw(n){return typeof n=="function"?n:function(){return n}}const Lc="phrasing",Uc=["autolink","link","image","label"];function yw(){return{transforms:[ww],enter:{literalAutolink:xw,literalAutolinkEmail:Bc,literalAutolinkHttp:Bc,literalAutolinkWww:Bc},exit:{literalAutolink:kw,literalAutolinkEmail:jw,literalAutolinkHttp:vw,literalAutolinkWww:Sw}}}function bw(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lc,notInConstruct:Uc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lc,notInConstruct:Uc},{character:":",before:"[ps]",after:"\\/",inConstruct:Lc,notInConstruct:Uc}]}}function xw(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function Bc(n){this.config.enter.autolinkProtocol.call(this,n)}function vw(n){this.config.exit.autolinkProtocol.call(this,n)}function Sw(n){this.config.exit.data.call(this,n);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(n)}function jw(n){this.config.exit.autolinkEmail.call(this,n)}function kw(n){this.exit(n)}function ww(n){hw(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Cw],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ew]],{ignore:["link","linkReference"]})}function Cw(n,i,r,s,c){let d="";if(!qy(c)||(/^w/i.test(i)&&(r=i+r,i="",d="http://"),!Nw(r)))return!1;const o=Tw(r+s);if(!o[0])return!1;const g={type:"link",title:null,url:d+i+o[0],children:[{type:"text",value:i+o[0]}]};return o[1]?[g,{type:"text",value:o[1]}]:g}function Ew(n,i,r,s){return!qy(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+r,children:[{type:"text",value:i+"@"+r}]}}function Nw(n){const i=n.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))}function Tw(n){const i=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!i)return[n,void 0];n=n.slice(0,i.index);let r=i[0],s=r.indexOf(")");const c=Tg(n,"(");let d=Tg(n,")");for(;s!==-1&&c>d;)n+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),d++;return[n,r]}function qy(n,i){const r=n.input.charCodeAt(n.index-1);return(n.index===0||ci(r)||Fs(r))&&(!i||r!==47)}Hy.peek=Uw;function Aw(){this.buffer()}function zw(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function Rw(){this.buffer()}function Dw(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function _w(n){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(n)).toLowerCase(),r.label=i}function Ow(n){this.exit(n)}function Mw(n){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(n)).toLowerCase(),r.label=i}function Lw(n){this.exit(n)}function Uw(){return"["}function Hy(n,i,r,s){const c=r.createTracker(s);let d=c.move("[^");const o=r.enter("footnoteReference"),g=r.enter("reference");return d+=c.move(r.safe(r.associationId(n),{after:"]",before:d})),g(),o(),d+=c.move("]"),d}function Bw(){return{enter:{gfmFootnoteCallString:Aw,gfmFootnoteCall:zw,gfmFootnoteDefinitionLabelString:Rw,gfmFootnoteDefinition:Dw},exit:{gfmFootnoteCallString:_w,gfmFootnoteCall:Ow,gfmFootnoteDefinitionLabelString:Mw,gfmFootnoteDefinition:Lw}}}function qw(n){let i=!1;return n&&n.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:r,footnoteReference:Hy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,c,d,o){const g=d.createTracker(o);let p=g.move("[^");const m=d.enter("footnoteDefinition"),b=d.enter("label");return p+=g.move(d.safe(d.associationId(s),{before:p,after:"]"})),b(),p+=g.move("]:"),s.children&&s.children.length>0&&(g.shift(4),p+=g.move((i?`
|
|
34
|
+
`:" ")+d.indentLines(d.containerFlow(s,g.current()),i?Iy:Hw))),m(),p}}function Hw(n,i,r){return i===0?n:Iy(n,i,r)}function Iy(n,i,r){return(r?"":" ")+n}const Iw=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Yy.peek=Xw;function Yw(){return{canContainEols:["delete"],enter:{strikethrough:Vw},exit:{strikethrough:Qw}}}function Gw(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Iw}],handlers:{delete:Yy}}}function Vw(n){this.enter({type:"delete",children:[]},n)}function Qw(n){this.exit(n)}function Yy(n,i,r,s){const c=r.createTracker(s),d=r.enter("strikethrough");let o=c.move("~~");return o+=r.containerPhrasing(n,{...c.current(),before:o,after:"~"}),o+=c.move("~~"),d(),o}function Xw(){return"~"}function $w(n){return n.length}function Zw(n,i){const r=i||{},s=(r.align||[]).concat(),c=r.stringLength||$w,d=[],o=[],g=[],p=[];let m=0,b=-1;for(;++b<n.length;){const O=[],z=[];let D=-1;for(n[b].length>m&&(m=n[b].length);++D<n[b].length;){const R=Kw(n[b][D]);if(r.alignDelimiters!==!1){const U=c(R);z[D]=U,(p[D]===void 0||U>p[D])&&(p[D]=U)}O.push(R)}o[b]=O,g[b]=z}let y=-1;if(typeof s=="object"&&"length"in s)for(;++y<m;)d[y]=Ag(s[y]);else{const O=Ag(s);for(;++y<m;)d[y]=O}y=-1;const v=[],S=[];for(;++y<m;){const O=d[y];let z="",D="";O===99?(z=":",D=":"):O===108?z=":":O===114&&(D=":");let R=r.alignDelimiters===!1?1:Math.max(1,p[y]-z.length-D.length);const U=z+"-".repeat(R)+D;r.alignDelimiters!==!1&&(R=z.length+R+D.length,R>p[y]&&(p[y]=R),S[y]=R),v[y]=U}o.splice(1,0,v),g.splice(1,0,S),b=-1;const N=[];for(;++b<o.length;){const O=o[b],z=g[b];y=-1;const D=[];for(;++y<m;){const R=O[y]||"";let U="",F="";if(r.alignDelimiters!==!1){const ue=p[y]-(z[y]||0),L=d[y];L===114?U=" ".repeat(ue):L===99?ue%2?(U=" ".repeat(ue/2+.5),F=" ".repeat(ue/2-.5)):(U=" ".repeat(ue/2),F=U):F=" ".repeat(ue)}r.delimiterStart!==!1&&!y&&D.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&R==="")&&(r.delimiterStart!==!1||y)&&D.push(" "),r.alignDelimiters!==!1&&D.push(U),D.push(R),r.alignDelimiters!==!1&&D.push(F),r.padding!==!1&&D.push(" "),(r.delimiterEnd!==!1||y!==m-1)&&D.push("|")}N.push(r.delimiterEnd===!1?D.join("").replace(/ +$/,""):D.join(""))}return N.join(`
|
|
35
|
+
`)}function Kw(n){return n==null?"":String(n)}function Ag(n){const i=typeof n=="string"?n.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}function Fw(n,i,r,s){const c=r.enter("blockquote"),d=r.createTracker(s);d.move("> "),d.shift(2);const o=r.indentLines(r.containerFlow(n,d.current()),Jw);return c(),o}function Jw(n,i,r){return">"+(r?"":" ")+n}function Pw(n,i){return zg(n,i.inConstruct,!0)&&!zg(n,i.notInConstruct,!1)}function zg(n,i,r){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return r;let s=-1;for(;++s<i.length;)if(n.includes(i[s]))return!0;return!1}function Rg(n,i,r,s){let c=-1;for(;++c<r.unsafe.length;)if(r.unsafe[c].character===`
|
|
36
|
+
`&&Pw(r.stack,r.unsafe[c]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
37
|
+
`}function Ww(n,i){const r=String(n);let s=r.indexOf(i),c=s,d=0,o=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===c?++d>o&&(o=d):d=1,c=s+i.length,s=r.indexOf(i,c);return o}function eC(n,i){return!!(i.options.fences===!1&&n.value&&!n.lang&&/[^ \r\n]/.test(n.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(n.value))}function tC(n){const i=n.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function nC(n,i,r,s){const c=tC(r),d=n.value||"",o=c==="`"?"GraveAccent":"Tilde";if(eC(n,r)){const y=r.enter("codeIndented"),v=r.indentLines(d,lC);return y(),v}const g=r.createTracker(s),p=c.repeat(Math.max(Ww(d,c)+1,3)),m=r.enter("codeFenced");let b=g.move(p);if(n.lang){const y=r.enter(`codeFencedLang${o}`);b+=g.move(r.safe(n.lang,{before:b,after:" ",encode:["`"],...g.current()})),y()}if(n.lang&&n.meta){const y=r.enter(`codeFencedMeta${o}`);b+=g.move(" "),b+=g.move(r.safe(n.meta,{before:b,after:`
|
|
38
|
+
`,encode:["`"],...g.current()})),y()}return b+=g.move(`
|
|
39
|
+
`),d&&(b+=g.move(d+`
|
|
40
|
+
`)),b+=g.move(p),m(),b}function lC(n,i,r){return(r?"":" ")+n}function Df(n){const i=n.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function iC(n,i,r,s){const c=Df(r),d=c==='"'?"Quote":"Apostrophe",o=r.enter("definition");let g=r.enter("label");const p=r.createTracker(s);let m=p.move("[");return m+=p.move(r.safe(r.associationId(n),{before:m,after:"]",...p.current()})),m+=p.move("]: "),g(),!n.url||/[\0- \u007F]/.test(n.url)?(g=r.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(r.safe(n.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(g=r.enter("destinationRaw"),m+=p.move(r.safe(n.url,{before:m,after:n.title?" ":`
|
|
41
|
+
`,...p.current()}))),g(),n.title&&(g=r.enter(`title${d}`),m+=p.move(" "+c),m+=p.move(r.safe(n.title,{before:m,after:c,...p.current()})),m+=p.move(c),g()),o(),m}function rC(n){const i=n.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function ca(n){return"&#x"+n.toString(16).toUpperCase()+";"}function Qs(n,i,r){const s=nr(n),c=nr(i);return s===void 0?c===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Gy.peek=aC;function Gy(n,i,r,s){const c=rC(r),d=r.enter("emphasis"),o=r.createTracker(s),g=o.move(c);let p=o.move(r.containerPhrasing(n,{after:c,before:g,...o.current()}));const m=p.charCodeAt(0),b=Qs(s.before.charCodeAt(s.before.length-1),m,c);b.inside&&(p=ca(m)+p.slice(1));const y=p.charCodeAt(p.length-1),v=Qs(s.after.charCodeAt(0),y,c);v.inside&&(p=p.slice(0,-1)+ca(y));const S=o.move(c);return d(),r.attentionEncodeSurroundingInfo={after:v.outside,before:b.outside},g+p+S}function aC(n,i,r){return r.options.emphasis||"*"}function sC(n,i){let r=!1;return zf(n,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,Jc}),!!((!n.depth||n.depth<3)&&kf(n)&&(i.options.setext||r))}function uC(n,i,r,s){const c=Math.max(Math.min(6,n.depth||1),1),d=r.createTracker(s);if(sC(n,r)){const b=r.enter("headingSetext"),y=r.enter("phrasing"),v=r.containerPhrasing(n,{...d.current(),before:`
|
|
42
|
+
`,after:`
|
|
43
|
+
`});return y(),b(),v+`
|
|
44
|
+
`+(c===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
45
|
+
`))+1))}const o="#".repeat(c),g=r.enter("headingAtx"),p=r.enter("phrasing");d.move(o+" ");let m=r.containerPhrasing(n,{before:"# ",after:`
|
|
46
|
+
`,...d.current()});return/^[\t ]/.test(m)&&(m=ca(m.charCodeAt(0))+m.slice(1)),m=m?o+" "+m:o,r.options.closeAtx&&(m+=" "+o),p(),g(),m}Vy.peek=oC;function Vy(n){return n.value||""}function oC(){return"<"}Qy.peek=cC;function Qy(n,i,r,s){const c=Df(r),d=c==='"'?"Quote":"Apostrophe",o=r.enter("image");let g=r.enter("label");const p=r.createTracker(s);let m=p.move("![");return m+=p.move(r.safe(n.alt,{before:m,after:"]",...p.current()})),m+=p.move("]("),g(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(g=r.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(r.safe(n.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(g=r.enter("destinationRaw"),m+=p.move(r.safe(n.url,{before:m,after:n.title?" ":")",...p.current()}))),g(),n.title&&(g=r.enter(`title${d}`),m+=p.move(" "+c),m+=p.move(r.safe(n.title,{before:m,after:c,...p.current()})),m+=p.move(c),g()),m+=p.move(")"),o(),m}function cC(){return"!"}Xy.peek=fC;function Xy(n,i,r,s){const c=n.referenceType,d=r.enter("imageReference");let o=r.enter("label");const g=r.createTracker(s);let p=g.move("![");const m=r.safe(n.alt,{before:p,after:"]",...g.current()});p+=g.move(m+"]["),o();const b=r.stack;r.stack=[],o=r.enter("reference");const y=r.safe(r.associationId(n),{before:p,after:"]",...g.current()});return o(),r.stack=b,d(),c==="full"||!m||m!==y?p+=g.move(y+"]"):c==="shortcut"?p=p.slice(0,-1):p+=g.move("]"),p}function fC(){return"!"}$y.peek=dC;function $y(n,i,r){let s=n.value||"",c="`",d=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(s);)c+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++d<r.unsafe.length;){const o=r.unsafe[d],g=r.compilePattern(o);let p;if(o.atBreak)for(;p=g.exec(s);){let m=p.index;s.charCodeAt(m)===10&&s.charCodeAt(m-1)===13&&m--,s=s.slice(0,m)+" "+s.slice(p.index+1)}}return c+s+c}function dC(){return"`"}function Zy(n,i){const r=kf(n);return!!(!i.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(r===n.url||"mailto:"+r===n.url)&&/^[a-z][a-z+.-]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}Ky.peek=hC;function Ky(n,i,r,s){const c=Df(r),d=c==='"'?"Quote":"Apostrophe",o=r.createTracker(s);let g,p;if(Zy(n,r)){const b=r.stack;r.stack=[],g=r.enter("autolink");let y=o.move("<");return y+=o.move(r.containerPhrasing(n,{before:y,after:">",...o.current()})),y+=o.move(">"),g(),r.stack=b,y}g=r.enter("link"),p=r.enter("label");let m=o.move("[");return m+=o.move(r.containerPhrasing(n,{before:m,after:"](",...o.current()})),m+=o.move("]("),p(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(p=r.enter("destinationLiteral"),m+=o.move("<"),m+=o.move(r.safe(n.url,{before:m,after:">",...o.current()})),m+=o.move(">")):(p=r.enter("destinationRaw"),m+=o.move(r.safe(n.url,{before:m,after:n.title?" ":")",...o.current()}))),p(),n.title&&(p=r.enter(`title${d}`),m+=o.move(" "+c),m+=o.move(r.safe(n.title,{before:m,after:c,...o.current()})),m+=o.move(c),p()),m+=o.move(")"),g(),m}function hC(n,i,r){return Zy(n,r)?"<":"["}Fy.peek=mC;function Fy(n,i,r,s){const c=n.referenceType,d=r.enter("linkReference");let o=r.enter("label");const g=r.createTracker(s);let p=g.move("[");const m=r.containerPhrasing(n,{before:p,after:"]",...g.current()});p+=g.move(m+"]["),o();const b=r.stack;r.stack=[],o=r.enter("reference");const y=r.safe(r.associationId(n),{before:p,after:"]",...g.current()});return o(),r.stack=b,d(),c==="full"||!m||m!==y?p+=g.move(y+"]"):c==="shortcut"?p=p.slice(0,-1):p+=g.move("]"),p}function mC(){return"["}function _f(n){const i=n.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function pC(n){const i=_f(n),r=n.options.bulletOther;if(!r)return i==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+r+"`) to be different");return r}function gC(n){const i=n.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function Jy(n){const i=n.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function yC(n,i,r,s){const c=r.enter("list"),d=r.bulletCurrent;let o=n.ordered?gC(r):_f(r);const g=n.ordered?o==="."?")":".":pC(r);let p=i&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!n.ordered){const b=n.children?n.children[0]:void 0;if((o==="*"||o==="-")&&b&&(!b.children||!b.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(p=!0),Jy(r)===o&&b){let y=-1;for(;++y<n.children.length;){const v=n.children[y];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(o=g),r.bulletCurrent=o;const m=r.containerFlow(n,s);return r.bulletLastUsed=o,r.bulletCurrent=d,c(),m}function bC(n){const i=n.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function xC(n,i,r,s){const c=bC(r);let d=r.bulletCurrent||_f(r);i&&i.type==="list"&&i.ordered&&(d=(typeof i.start=="number"&&i.start>-1?i.start:1)+(r.options.incrementListMarker===!1?0:i.children.indexOf(n))+d);let o=d.length+1;(c==="tab"||c==="mixed"&&(i&&i.type==="list"&&i.spread||n.spread))&&(o=Math.ceil(o/4)*4);const g=r.createTracker(s);g.move(d+" ".repeat(o-d.length)),g.shift(o);const p=r.enter("listItem"),m=r.indentLines(r.containerFlow(n,g.current()),b);return p(),m;function b(y,v,S){return v?(S?"":" ".repeat(o))+y:(S?d:d+" ".repeat(o-d.length))+y}}function vC(n,i,r,s){const c=r.enter("paragraph"),d=r.enter("phrasing"),o=r.containerPhrasing(n,s);return d(),c(),o}const SC=Ws(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function jC(n,i,r,s){return(n.children.some(function(o){return SC(o)})?r.containerPhrasing:r.containerFlow).call(r,n,s)}function kC(n){const i=n.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}Py.peek=wC;function Py(n,i,r,s){const c=kC(r),d=r.enter("strong"),o=r.createTracker(s),g=o.move(c+c);let p=o.move(r.containerPhrasing(n,{after:c,before:g,...o.current()}));const m=p.charCodeAt(0),b=Qs(s.before.charCodeAt(s.before.length-1),m,c);b.inside&&(p=ca(m)+p.slice(1));const y=p.charCodeAt(p.length-1),v=Qs(s.after.charCodeAt(0),y,c);v.inside&&(p=p.slice(0,-1)+ca(y));const S=o.move(c+c);return d(),r.attentionEncodeSurroundingInfo={after:v.outside,before:b.outside},g+p+S}function wC(n,i,r){return r.options.strong||"*"}function CC(n,i,r,s){return r.safe(n.value,s)}function EC(n){const i=n.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function NC(n,i,r){const s=(Jy(r)+(r.options.ruleSpaces?" ":"")).repeat(EC(r));return r.options.ruleSpaces?s.slice(0,-1):s}const Wy={blockquote:Fw,break:Rg,code:nC,definition:iC,emphasis:Gy,hardBreak:Rg,heading:uC,html:Vy,image:Qy,imageReference:Xy,inlineCode:$y,link:Ky,linkReference:Fy,list:yC,listItem:xC,paragraph:vC,root:jC,strong:Py,text:CC,thematicBreak:NC};function TC(){return{enter:{table:AC,tableData:Dg,tableHeader:Dg,tableRow:RC},exit:{codeText:DC,table:zC,tableData:qc,tableHeader:qc,tableRow:qc}}}function AC(n){const i=n._align;this.enter({type:"table",align:i.map(function(r){return r==="none"?null:r}),children:[]},n),this.data.inTable=!0}function zC(n){this.exit(n),this.data.inTable=void 0}function RC(n){this.enter({type:"tableRow",children:[]},n)}function qc(n){this.exit(n)}function Dg(n){this.enter({type:"tableCell",children:[]},n)}function DC(n){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,_C));const r=this.stack[this.stack.length-1];r.type,r.value=i,this.exit(n)}function _C(n,i){return i==="|"?i:n}function OC(n){const i=n||{},r=i.tableCellPadding,s=i.tablePipeAlign,c=i.stringLength,d=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
47
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:o,tableCell:p,tableRow:g}};function o(S,N,O,z){return m(b(S,O,z),S.align)}function g(S,N,O,z){const D=y(S,O,z),R=m([D]);return R.slice(0,R.indexOf(`
|
|
48
|
+
`))}function p(S,N,O,z){const D=O.enter("tableCell"),R=O.enter("phrasing"),U=O.containerPhrasing(S,{...z,before:d,after:d});return R(),D(),U}function m(S,N){return Zw(S,{align:N,alignDelimiters:s,padding:r,stringLength:c})}function b(S,N,O){const z=S.children;let D=-1;const R=[],U=N.enter("table");for(;++D<z.length;)R[D]=y(z[D],N,O);return U(),R}function y(S,N,O){const z=S.children;let D=-1;const R=[],U=N.enter("tableRow");for(;++D<z.length;)R[D]=p(z[D],S,N,O);return U(),R}function v(S,N,O){let z=Wy.inlineCode(S,N,O);return O.stack.includes("tableCell")&&(z=z.replace(/\|/g,"\\$&")),z}}function MC(){return{exit:{taskListCheckValueChecked:_g,taskListCheckValueUnchecked:_g,paragraph:UC}}}function LC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:BC}}}function _g(n){const i=this.stack[this.stack.length-2];i.type,i.checked=n.type==="taskListCheckValueChecked"}function UC(n){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const c=i.children;let d=-1,o;for(;++d<c.length;){const g=c[d];if(g.type==="paragraph"){o=g;break}}o===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(n)}function BC(n,i,r,s){const c=n.children[0],d=typeof n.checked=="boolean"&&c&&c.type==="paragraph",o="["+(n.checked?"x":" ")+"] ",g=r.createTracker(s);d&&g.move(o);let p=Wy.listItem(n,i,r,{...s,...g.current()});return d&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),p;function m(b){return b+o}}function qC(){return[yw(),Bw(),Yw(),TC(),MC()]}function HC(n){return{extensions:[bw(),qw(n),Gw(),OC(n),LC()]}}const IC={tokenize:$C,partial:!0},eb={tokenize:ZC,partial:!0},tb={tokenize:KC,partial:!0},nb={tokenize:FC,partial:!0},YC={tokenize:JC,partial:!0},lb={name:"wwwAutolink",tokenize:QC,previous:rb},ib={name:"protocolAutolink",tokenize:XC,previous:ab},ml={name:"emailAutolink",tokenize:VC,previous:sb},Zn={};function GC(){return{text:Zn}}let ui=48;for(;ui<123;)Zn[ui]=ml,ui++,ui===58?ui=65:ui===91&&(ui=97);Zn[43]=ml;Zn[45]=ml;Zn[46]=ml;Zn[95]=ml;Zn[72]=[ml,ib];Zn[104]=[ml,ib];Zn[87]=[ml,lb];Zn[119]=[ml,lb];function VC(n,i,r){const s=this;let c,d;return o;function o(y){return!tf(y)||!sb.call(s,s.previous)||Of(s.events)?r(y):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),g(y))}function g(y){return tf(y)?(n.consume(y),g):y===64?(n.consume(y),p):r(y)}function p(y){return y===46?n.check(YC,b,m)(y):y===45||y===95||Pt(y)?(d=!0,n.consume(y),p):b(y)}function m(y){return n.consume(y),c=!0,p}function b(y){return d&&c&&ln(s.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),i(y)):r(y)}}function QC(n,i,r){const s=this;return c;function c(o){return o!==87&&o!==119||!rb.call(s,s.previous)||Of(s.events)?r(o):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(IC,n.attempt(eb,n.attempt(tb,d),r),r)(o))}function d(o){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),i(o)}}function XC(n,i,r){const s=this;let c="",d=!1;return o;function o(y){return(y===72||y===104)&&ab.call(s,s.previous)&&!Of(s.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),n.consume(y),g):r(y)}function g(y){if(ln(y)&&c.length<5)return c+=String.fromCodePoint(y),n.consume(y),g;if(y===58){const v=c.toLowerCase();if(v==="http"||v==="https")return n.consume(y),p}return r(y)}function p(y){return y===47?(n.consume(y),d?m:(d=!0,p)):r(y)}function m(y){return y===null||Ys(y)||St(y)||ci(y)||Fs(y)?r(y):n.attempt(eb,n.attempt(tb,b),r)(y)}function b(y){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),i(y)}}function $C(n,i,r){let s=0;return c;function c(o){return(o===87||o===119)&&s<3?(s++,n.consume(o),c):o===46&&s===3?(n.consume(o),d):r(o)}function d(o){return o===null?r(o):i(o)}}function ZC(n,i,r){let s,c,d;return o;function o(m){return m===46||m===95?n.check(nb,p,g)(m):m===null||St(m)||ci(m)||m!==45&&Fs(m)?p(m):(d=!0,n.consume(m),o)}function g(m){return m===95?s=!0:(c=s,s=void 0),n.consume(m),o}function p(m){return c||s||!d?r(m):i(m)}}function KC(n,i){let r=0,s=0;return c;function c(o){return o===40?(r++,n.consume(o),c):o===41&&s<r?d(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?n.check(nb,i,d)(o):o===null||St(o)||ci(o)?i(o):(n.consume(o),c)}function d(o){return o===41&&s++,n.consume(o),c}}function FC(n,i,r){return s;function s(g){return g===33||g===34||g===39||g===41||g===42||g===44||g===46||g===58||g===59||g===63||g===95||g===126?(n.consume(g),s):g===38?(n.consume(g),d):g===93?(n.consume(g),c):g===60||g===null||St(g)||ci(g)?i(g):r(g)}function c(g){return g===null||g===40||g===91||St(g)||ci(g)?i(g):s(g)}function d(g){return ln(g)?o(g):r(g)}function o(g){return g===59?(n.consume(g),s):ln(g)?(n.consume(g),o):r(g)}}function JC(n,i,r){return s;function s(d){return n.consume(d),c}function c(d){return Pt(d)?r(d):i(d)}}function rb(n){return n===null||n===40||n===42||n===95||n===91||n===93||n===126||St(n)}function ab(n){return!ln(n)}function sb(n){return!(n===47||tf(n))}function tf(n){return n===43||n===45||n===46||n===95||Pt(n)}function Of(n){let i=n.length,r=!1;for(;i--;){const s=n[i][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return n.length>0&&!r&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const PC={tokenize:aE,partial:!0};function WC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:lE,continuation:{tokenize:iE},exit:rE}},text:{91:{name:"gfmFootnoteCall",tokenize:nE},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:eE,resolveTo:tE}}}}function eE(n,i,r){const s=this;let c=s.events.length;const d=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;c--;){const p=s.events[c][1];if(p.type==="labelImage"){o=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return g;function g(p){if(!o||!o._balanced)return r(p);const m=Yn(s.sliceSerialize({start:o.end,end:s.now()}));return m.codePointAt(0)!==94||!d.includes(m.slice(1))?r(p):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(p),n.exit("gfmFootnoteCallLabelMarker"),i(p))}}function tE(n,i){let r=n.length;for(;r--;)if(n[r][1].type==="labelImage"&&n[r][0]==="enter"){n[r][1];break}n[r+1][1].type="data",n[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},n[r+3][1].start),end:Object.assign({},n[n.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},n[r+3][1].end),end:Object.assign({},n[r+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const d={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},n[n.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},d.start),end:Object.assign({},d.end)},g=[n[r+1],n[r+2],["enter",s,i],n[r+3],n[r+4],["enter",c,i],["exit",c,i],["enter",d,i],["enter",o,i],["exit",o,i],["exit",d,i],n[n.length-2],n[n.length-1],["exit",s,i]];return n.splice(r,n.length-r+1,...g),n}function nE(n,i,r){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let d=0,o;return g;function g(y){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?r(y):(n.enter("gfmFootnoteCallMarker"),n.consume(y),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",m)}function m(y){if(d>999||y===93&&!o||y===null||y===91||St(y))return r(y);if(y===93){n.exit("chunkString");const v=n.exit("gfmFootnoteCallString");return c.includes(Yn(s.sliceSerialize(v)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),i):r(y)}return St(y)||(o=!0),d++,n.consume(y),y===92?b:m}function b(y){return y===91||y===92||y===93?(n.consume(y),d++,m):m(y)}}function lE(n,i,r){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let d,o=0,g;return p;function p(N){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(N),n.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(N){return N===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(N),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",b):r(N)}function b(N){if(o>999||N===93&&!g||N===null||N===91||St(N))return r(N);if(N===93){n.exit("chunkString");const O=n.exit("gfmFootnoteDefinitionLabelString");return d=Yn(s.sliceSerialize(O)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(N),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),v}return St(N)||(g=!0),o++,n.consume(N),N===92?y:b}function y(N){return N===91||N===92||N===93?(n.consume(N),o++,b):b(N)}function v(N){return N===58?(n.enter("definitionMarker"),n.consume(N),n.exit("definitionMarker"),c.includes(d)||c.push(d),et(n,S,"gfmFootnoteDefinitionWhitespace")):r(N)}function S(N){return i(N)}}function iE(n,i,r){return n.check(ma,i,n.attempt(PC,i,r))}function rE(n){n.exit("gfmFootnoteDefinition")}function aE(n,i,r){const s=this;return et(n,c,"gfmFootnoteDefinitionIndent",5);function c(d){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?i(d):r(d)}}function sE(n){let r=(n||{}).singleTilde;const s={name:"strikethrough",tokenize:d,resolveAll:c};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function c(o,g){let p=-1;for(;++p<o.length;)if(o[p][0]==="enter"&&o[p][1].type==="strikethroughSequenceTemporary"&&o[p][1]._close){let m=p;for(;m--;)if(o[m][0]==="exit"&&o[m][1].type==="strikethroughSequenceTemporary"&&o[m][1]._open&&o[p][1].end.offset-o[p][1].start.offset===o[m][1].end.offset-o[m][1].start.offset){o[p][1].type="strikethroughSequence",o[m][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},o[m][1].start),end:Object.assign({},o[p][1].end)},y={type:"strikethroughText",start:Object.assign({},o[m][1].end),end:Object.assign({},o[p][1].start)},v=[["enter",b,g],["enter",o[m][1],g],["exit",o[m][1],g],["enter",y,g]],S=g.parser.constructs.insideSpan.null;S&&kn(v,v.length,0,Js(S,o.slice(m+1,p),g)),kn(v,v.length,0,[["exit",y,g],["enter",o[p][1],g],["exit",o[p][1],g],["exit",b,g]]),kn(o,m-1,p-m+3,v),p=m+v.length-2;break}}for(p=-1;++p<o.length;)o[p][1].type==="strikethroughSequenceTemporary"&&(o[p][1].type="data");return o}function d(o,g,p){const m=this.previous,b=this.events;let y=0;return v;function v(N){return m===126&&b[b.length-1][1].type!=="characterEscape"?p(N):(o.enter("strikethroughSequenceTemporary"),S(N))}function S(N){const O=nr(m);if(N===126)return y>1?p(N):(o.consume(N),y++,S);if(y<2&&!r)return p(N);const z=o.exit("strikethroughSequenceTemporary"),D=nr(N);return z._open=!D||D===2&&!!O,z._close=!O||O===2&&!!D,g(N)}}}class uE{constructor(){this.map=[]}add(i,r,s){oE(this,i,r,s)}consume(i){if(this.map.sort(function(d,o){return d[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];s.push(i.slice()),i.length=0;let c=s.pop();for(;c;){for(const d of c)i.push(d);c=s.pop()}this.map.length=0}}function oE(n,i,r,s){let c=0;if(!(r===0&&s.length===0)){for(;c<n.map.length;){if(n.map[c][0]===i){n.map[c][1]+=r,n.map[c][2].push(...s);return}c+=1}n.map.push([i,r,s])}}function cE(n,i){let r=!1;const s=[];for(;i<n.length;){const c=n[i];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(n[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(n[i-1][1].type==="tableDelimiterMarker"){const d=s.length-1;s[d]=s[d]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(r=!0);i+=1}return s}function fE(){return{flow:{null:{name:"table",tokenize:dE,resolveAll:hE}}}}function dE(n,i,r){const s=this;let c=0,d=0,o;return g;function g(T){let q=s.events.length-1;for(;q>-1;){const me=s.events[q][1].type;if(me==="lineEnding"||me==="linePrefix")q--;else break}const H=q>-1?s.events[q][1].type:null,re=H==="tableHead"||H==="tableRow"?L:p;return re===L&&s.parser.lazy[s.now().line]?r(T):re(T)}function p(T){return n.enter("tableHead"),n.enter("tableRow"),m(T)}function m(T){return T===124||(o=!0,d+=1),b(T)}function b(T){return T===null?r(T):Le(T)?d>1?(d=0,s.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(T),n.exit("lineEnding"),S):r(T):Fe(T)?et(n,b,"whitespace")(T):(d+=1,o&&(o=!1,c+=1),T===124?(n.enter("tableCellDivider"),n.consume(T),n.exit("tableCellDivider"),o=!0,b):(n.enter("data"),y(T)))}function y(T){return T===null||T===124||St(T)?(n.exit("data"),b(T)):(n.consume(T),T===92?v:y)}function v(T){return T===92||T===124?(n.consume(T),y):y(T)}function S(T){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(T):(n.enter("tableDelimiterRow"),o=!1,Fe(T)?et(n,N,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):N(T))}function N(T){return T===45||T===58?z(T):T===124?(o=!0,n.enter("tableCellDivider"),n.consume(T),n.exit("tableCellDivider"),O):ue(T)}function O(T){return Fe(T)?et(n,z,"whitespace")(T):z(T)}function z(T){return T===58?(d+=1,o=!0,n.enter("tableDelimiterMarker"),n.consume(T),n.exit("tableDelimiterMarker"),D):T===45?(d+=1,D(T)):T===null||Le(T)?F(T):ue(T)}function D(T){return T===45?(n.enter("tableDelimiterFiller"),R(T)):ue(T)}function R(T){return T===45?(n.consume(T),R):T===58?(o=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(T),n.exit("tableDelimiterMarker"),U):(n.exit("tableDelimiterFiller"),U(T))}function U(T){return Fe(T)?et(n,F,"whitespace")(T):F(T)}function F(T){return T===124?N(T):T===null||Le(T)?!o||c!==d?ue(T):(n.exit("tableDelimiterRow"),n.exit("tableHead"),i(T)):ue(T)}function ue(T){return r(T)}function L(T){return n.enter("tableRow"),le(T)}function le(T){return T===124?(n.enter("tableCellDivider"),n.consume(T),n.exit("tableCellDivider"),le):T===null||Le(T)?(n.exit("tableRow"),i(T)):Fe(T)?et(n,le,"whitespace")(T):(n.enter("data"),oe(T))}function oe(T){return T===null||T===124||St(T)?(n.exit("data"),le(T)):(n.consume(T),T===92?W:oe)}function W(T){return T===92||T===124?(n.consume(T),oe):oe(T)}}function hE(n,i){let r=-1,s=!0,c=0,d=[0,0,0,0],o=[0,0,0,0],g=!1,p=0,m,b,y;const v=new uE;for(;++r<n.length;){const S=n[r],N=S[1];S[0]==="enter"?N.type==="tableHead"?(g=!1,p!==0&&(Og(v,i,p,m,b),b=void 0,p=0),m={type:"table",start:Object.assign({},N.start),end:Object.assign({},N.end)},v.add(r,0,[["enter",m,i]])):N.type==="tableRow"||N.type==="tableDelimiterRow"?(s=!0,y=void 0,d=[0,0,0,0],o=[0,r+1,0,0],g&&(g=!1,b={type:"tableBody",start:Object.assign({},N.start),end:Object.assign({},N.end)},v.add(r,0,[["enter",b,i]])),c=N.type==="tableDelimiterRow"?2:b?3:1):c&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(d[1]!==0&&(o[0]=o[1],y=Ms(v,i,d,c,void 0,y),d=[0,0,0,0]),o[2]=r)):N.type==="tableCellDivider"&&(s?s=!1:(d[1]!==0&&(o[0]=o[1],y=Ms(v,i,d,c,void 0,y)),d=o,o=[d[1],r,0,0])):N.type==="tableHead"?(g=!0,p=r):N.type==="tableRow"||N.type==="tableDelimiterRow"?(p=r,d[1]!==0?(o[0]=o[1],y=Ms(v,i,d,c,r,y)):o[1]!==0&&(y=Ms(v,i,o,c,r,y)),c=0):c&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")&&(o[3]=r)}for(p!==0&&Og(v,i,p,m,b),v.consume(i.events),r=-1;++r<i.events.length;){const S=i.events[r];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=cE(i.events,r))}return n}function Ms(n,i,r,s,c,d){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",g="tableContent";r[0]!==0&&(d.end=Object.assign({},tr(i.events,r[0])),n.add(r[0],0,[["exit",d,i]]));const p=tr(i.events,r[1]);if(d={type:o,start:Object.assign({},p),end:Object.assign({},p)},n.add(r[1],0,[["enter",d,i]]),r[2]!==0){const m=tr(i.events,r[2]),b=tr(i.events,r[3]),y={type:g,start:Object.assign({},m),end:Object.assign({},b)};if(n.add(r[2],0,[["enter",y,i]]),s!==2){const v=i.events[r[2]],S=i.events[r[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",r[3]>r[2]+1){const N=r[2]+1,O=r[3]-r[2]-1;n.add(N,O,[])}}n.add(r[3]+1,0,[["exit",y,i]])}return c!==void 0&&(d.end=Object.assign({},tr(i.events,c)),n.add(c,0,[["exit",d,i]]),d=void 0),d}function Og(n,i,r,s,c){const d=[],o=tr(i.events,r);c&&(c.end=Object.assign({},o),d.push(["exit",c,i])),s.end=Object.assign({},o),d.push(["exit",s,i]),n.add(r+1,0,d)}function tr(n,i){const r=n[i],s=r[0]==="enter"?"start":"end";return r[1][s]}const mE={name:"tasklistCheck",tokenize:gE};function pE(){return{text:{91:mE}}}function gE(n,i,r){const s=this;return c;function c(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(p):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(p),n.exit("taskListCheckMarker"),d)}function d(p){return St(p)?(n.enter("taskListCheckValueUnchecked"),n.consume(p),n.exit("taskListCheckValueUnchecked"),o):p===88||p===120?(n.enter("taskListCheckValueChecked"),n.consume(p),n.exit("taskListCheckValueChecked"),o):r(p)}function o(p){return p===93?(n.enter("taskListCheckMarker"),n.consume(p),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),g):r(p)}function g(p){return Le(p)?i(p):Fe(p)?n.check({tokenize:yE},i,r)(p):r(p)}}function yE(n,i,r){return et(n,s,"whitespace");function s(c){return c===null?r(c):i(c)}}function bE(n){return by([GC(),WC(),sE(n),fE(),pE()])}const xE={};function vE(n){const i=this,r=n||xE,s=i.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),d=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(bE(r)),d.push(qC()),o.push(HC(r))}function nf(n){const i=n.trim();if(!(!i||/[\u0000-\u0020\u007f]/.test(i)))try{const r=new URL(i);if(r.protocol==="https:"||r.protocol==="http:"||r.protocol==="mailto:")return i}catch{}}function lf(n){return!!n&&!/[\u0000-\u001f\u007f]/.test(n)&&!/^[a-z][a-z\d+.-]*:/i.test(n)&&!n.startsWith("//")}function Mg(n){if(!lf(n))return;const i=n.split(/[?#]/,1)[0];if(i)try{const r=decodeURIComponent(i);return lf(r)?r:void 0}catch{return}}async function SE(n){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(n);return}const i=document.activeElement,r=document.createElement("textarea");r.value=n,r.setAttribute("aria-label","复制内容"),r.style.cssText="position:fixed;left:-10000px;top:0",document.body.append(r);try{if(r.select(),!document.execCommand("copy"))throw new Error("复制不可用")}finally{r.remove(),i instanceof HTMLElement&&i.focus({preventScroll:!0})}}function tu({text:n,label:i="复制"}){const[r,s]=j.useState("idle"),c=j.useRef(!0),d=j.useRef(void 0);j.useEffect(()=>(c.current=!0,()=>{c.current=!1,clearTimeout(d.current)}),[]);const o=async()=>{clearTimeout(d.current);try{await SE(n),c.current&&s("copied")}catch{c.current&&s("error")}c.current&&(d.current=setTimeout(()=>s("idle"),2500))};return u.jsx("button",{className:"message-copy",onClick:()=>{o()},"aria-label":i,title:i,children:r==="copied"?"已复制":r==="error"?"复制失败":i})}function rf(n){return typeof n=="string"||typeof n=="number"?String(n):Array.isArray(n)?n.map(rf).join(""):j.isValidElement(n)?rf(n.props.children):""}function jE({children:n}){const i=j.Children.toArray(n).find(d=>j.isValidElement(d)),s=(j.isValidElement(i)?i.props.className??"":"").match(/(?:^|\s)language-([\w+-]+)/)?.[1]??"代码",c=rf(n).replace(/\n$/,"");return u.jsxs("div",{className:"message-code-block",children:[u.jsxs("div",{className:"message-code-heading",children:[u.jsx("span",{children:s}),u.jsx(tu,{text:c,label:"复制代码"})]}),u.jsx("pre",{tabIndex:0,children:n})]})}function kE(n){return{a:({href:i,children:r,title:s})=>{const c=nf(i??"");if(c)return u.jsx("a",{href:c,title:s,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:r});const d=i?Mg(i):void 0;return d?u.jsxs("span",{className:"message-file-reference",title:d,children:[n?u.jsx("button",{className:"message-file-open",onClick:()=>n(d),children:r}):r,u.jsx(tu,{text:d,label:"复制路径"})]}):u.jsx("span",{children:r})},img:({src:i,alt:r})=>{const s=nf(typeof i=="string"?i:""),c=typeof i=="string"?Mg(i):void 0;return s?u.jsxs("a",{className:"message-image-reference",href:s,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:[r||"图片",u.jsx("span",{children:"打开图片 ↗"})]}):c&&n?u.jsxs("button",{className:"message-image-reference",title:c,onClick:()=>n(c),children:[r||"图片",u.jsx("span",{children:"查看图片"})]}):u.jsxs("span",{className:"message-image-reference",children:[r||"图片",u.jsx("span",{children:"图片路径不可直接访问"})]})},pre:({children:i})=>u.jsx(jE,{children:i}),table:({children:i})=>u.jsx("div",{className:"message-table-scroll",role:"region","aria-label":"表格",tabIndex:0,children:u.jsx("table",{children:i})})}}const wE=j.memo(function({text:i,reasoning:r="",streaming:s=!1,onOpenFile:c}){const d=j.useMemo(()=>kE(c),[c]);return u.jsxs("div",{className:"message-content",children:[r?u.jsxs("details",{className:"message-reasoning",children:[u.jsx("summary",{children:s&&!i?"思考中…":"思考过程"}),u.jsx("pre",{children:r})]}):null,s?u.jsxs("div",{className:"message-streaming",children:[i||(r?"":"正在思考…"),u.jsx("span",{className:"cursor","aria-hidden":"true",children:"▍"})]}):i?u.jsx(sw,{remarkPlugins:[vE],skipHtml:!0,urlTransform:o=>nf(o)??(lf(o)?o:""),components:d,children:i}):null,!s&&i?u.jsx("div",{className:"message-actions",children:u.jsx(tu,{text:i,label:"复制回复"})}):null]})});function CE(n){const i=n.args??{},r=n.summary||[i.description,i.command,i.file_path,i.path,i.query,i.url].find(s=>typeof s=="string"&&s.trim());return typeof r=="string"?r.replace(/\s+/g," ").slice(0,180):""}const EE=j.memo(function({item:i,running:r}){const s=CE(i),c=i.done?i.error?"失败":"已完成":r?"执行中":"未完成";return u.jsxs("details",{className:`message-tool-card${i.error?" message-tool-error":""}`,children:[u.jsxs("summary",{children:[u.jsx("span",{className:"message-tool-indicator","aria-hidden":"true",children:i.done?i.error?"!":"✓":"·"}),u.jsx("span",{className:"message-tool-name",children:i.name}),u.jsx("span",{className:"message-tool-summary",children:s}),u.jsx("span",{className:"message-tool-status",children:c})]}),i.args&&Object.keys(i.args).length?u.jsxs("div",{className:"message-tool-section",children:[u.jsx("strong",{children:"参数"}),u.jsx("pre",{tabIndex:0,children:JSON.stringify(i.args,null,2)})]}):null,u.jsxs("div",{className:"message-tool-section",children:[u.jsxs("div",{className:"message-tool-result-heading",children:[u.jsx("strong",{children:"结果"}),i.result?u.jsx(tu,{text:i.result,label:"复制结果"}):null]}),u.jsx("pre",{tabIndex:0,children:i.result??(i.done?"工具没有返回文本内容。":r?"等待工具返回结果…":"这次工具调用没有保存结果。")})]})]})});function NE(n){return{running:"运行中",completed:"已完成",error:"失败",recorded:"历史记录"}[n]??n}function Lg(n){return n.replace(/<system-reminder>[\s\S]*?<\/system-reminder>\s*/g,"")}function qs(){return{items:[],run:"idle",seq:0,liveByAgent:{}}}function na(n){return n.agentId??""}function Ls(n,i,r=!1){const s=i.goalId;if(n.goalId!==s&&!(r&&n.goalId===void 0&&s!==void 0))return!0;const c=i.revision;return n.goalRevision!==void 0&&(c===void 0||c<n.goalRevision)}function TE(n){switch(n){case"aborted_streaming":case"aborted_tools":return"idle";case"prompt_too_long":case"model_error":case"image_error":case"replay_incomplete":return"error";default:return"completed"}}function AE(n){if(!n||typeof n!="object")return null;const i=n;if(i.method==="agent/streamEvent"&&i.params&&typeof i.params=="object"){const r=i.params;if(r.event&&typeof r.event=="object")return{event:r.event,sessionId:typeof r.sessionId=="string"?r.sessionId:void 0}}return typeof i.type=="string"?{event:i}:null}function Xs(n,i){const r=AE(i);if(!r)return n;const{event:s,sessionId:c}=r,d=s.type;let o=n;c&&c!==o.sessionId&&(o={...o,sessionId:c});const g=p=>{const m=o.seq+1;return[`${p}-${m}`,{...o,seq:m}]};switch(d){case"stream_request_start":{const p=na(s),[m,b]=g("a"),y={kind:"assistant",id:m,text:"",reasoning:"",done:!1,agentId:s.agentId,...typeof s.messageId=="string"?{messageId:s.messageId}:{}};return{...b,items:[...b.items,y],liveByAgent:{...b.liveByAgent,[p]:m},run:"running"}}case"text_delta":{const p=s.text??"",m=na(s),b=o.liveByAgent[m];if(b&&o.items.find(O=>O.id===b&&O.kind==="assistant"))return{...o,run:"running",items:o.items.map(O=>O.id===b&&O.kind==="assistant"?{...O,text:O.text+p}:O)};const[v,S]=g("a"),N={kind:"assistant",id:v,text:p,reasoning:"",done:!1,agentId:s.agentId};return{...S,items:[...S.items,N],liveByAgent:{...S.liveByAgent,[m]:v},run:"running"}}case"thinking_delta":{const p=s.text??"",m=na(s),b=o.liveByAgent[m];if(b&&o.items.some(N=>N.id===b&&N.kind==="assistant"))return{...o,run:"running",items:o.items.map(N=>N.id===b&&N.kind==="assistant"?{...N,reasoning:N.reasoning+p}:N)};const[y,v]=g("a"),S={kind:"assistant",id:y,text:"",reasoning:p,done:!1,agentId:s.agentId};return{...v,items:[...v.items,S],liveByAgent:{...v.liveByAgent,[m]:y},run:"running"}}case"tool_use_start":{const p=s.toolCall;if(!p||o.items.some(v=>v.kind==="tool"&&v.id===p.id))return o;const m=o.orphanResults?.[p.id],b={kind:"tool",id:p.id,name:p.toolName,args:p.args,summary:p.summary,done:!!m,result:m?.result,error:m?.error,agentId:s.agentId};let y=o.orphanResults;if(m){const{[p.id]:v,...S}=o.orphanResults;y=Object.keys(S).length>0?S:void 0}return{...o,run:"running",items:[...o.items,b],orphanResults:y}}case"tool_use_args_delta":{const p=s.toolCallId,m=s.args;return!p||!m?o:{...o,items:o.items.map(b=>b.kind==="tool"&&b.id===p?{...b,args:{...b.args??{},...m}}:b)}}case"tool_result":{const p=s.result;return p?o.items.some(b=>b.kind==="tool"&&b.id===p.id)?{...o,items:o.items.map(b=>b.kind==="tool"&&b.id===p.id?{...b,done:!0,result:Lg(p.result??p.error??""),error:!!(p.isError||p.error)}:b)}:{...o,orphanResults:{...o.orphanResults??{},[p.id]:{result:p.result??p.error??"",error:!!(p.isError||p.error)}}}:o}case"room_tool_result":{const p=s.summary??"",m=Lg(p),b=!!s.isError;let y=-1;for(let N=o.items.length-1;N>=0;N--)if(o.items[N].kind==="tool"&&!o.items[N].done){y=N;break}if(y===-1)return o;const v=o.items.slice(),S=v[y];return v[y]={...S,done:!0,result:m,summary:m||S.summary,error:b},{...o,items:v}}case"tool_summary":{const p=s.summary??"",m=Array.isArray(s.toolCallIds)?s.toolCallIds.filter(O=>typeof O=="string"):[],y=m.length>0?m[m.length-1]:void 0,v=s.agentId;if(y){let O=!1;const z=o.items.map(D=>D.kind!=="tool"||D.id!==y||D.agentId!==v?D:(O=!0,{...D,summary:p}));return O?{...o,items:z}:o}if(v){let O=-1;for(let D=o.items.length-1;D>=0;D--){const R=o.items[D];if(R.kind==="tool"&&R.agentId===v){O=D;break}}if(O===-1)return o;const z=o.items.slice();return z[O]={...z[O],summary:p},{...o,items:z}}let S=-1;for(let O=o.items.length-1;O>=0;O--){const z=o.items[O];if(z.kind==="tool"&&z.agentId===void 0){S=O;break}}if(S===-1)return o;const N=o.items.slice();return N[S]={...N[S],summary:p},{...o,items:N}}case"tombstone":{if(typeof s.messageId!="string")return o;const p=new Set(o.items.filter(m=>m.kind==="assistant"&&m.messageId===s.messageId||m.kind==="tool"&&m.id===s.messageId).map(m=>m.id));return p.size?{...o,items:o.items.filter(m=>!p.has(m.id)),liveByAgent:Object.fromEntries(Object.entries(o.liveByAgent).filter(([,m])=>!p.has(m)))}:o}case"assistant_message":{const p=na(s);if(!(p in o.liveByAgent))return o;const{[p]:m,...b}=o.liveByAgent,y=o.items.map(v=>v.kind==="assistant"&&!v.done&&(v.agentId??"")===p?{...v,done:!0}:v);return{...o,liveByAgent:b,items:y}}case"turn_complete":{const p=s.reason??"completed",m=na(s),{[m]:b,...y}=o.liveByAgent,v=o.items.map(S=>S.kind==="assistant"&&!S.done&&(S.agentId??"")===m?{...S,done:!0}:S);return s.agentId?{...o,liveByAgent:y,items:v}:{...o,liveByAgent:y,items:v,run:TE(p)}}case"goal_set":{const p=s.objective??"",m=!!s.paused;return o.goal&&o.goalId===s.goalId&&Ls(o,s)?o:{...o,goal:p?`◎ ${p}${m?" (已暂停)":""}`:"◎ 目标",goalId:s.goalId,goalPaused:m,goalRevision:s.revision}}case"goal_updated":{if(o.goal&&Ls(o,s,!0))return o;const p=s.goalId,m=s.objective??"",b=!!s.paused;return{...o,goal:m?`◎ ${m}${b?" (已暂停)":""}`:o.goal,goalId:p??o.goalId,goalPaused:b,goalRevision:s.revision??o.goalRevision}}case"goal_cleared":return o.goal&&Ls(o,s)?o:{...o,goal:void 0,goalId:void 0,goalPaused:void 0,goalRevision:void 0};case"goal_progress":{if(o.goal&&Ls(o,s))return o;const p=s.status??"";if(p==="met"||p==="exhausted")return{...o,goal:void 0,goalId:void 0,goalPaused:void 0,goalRevision:void 0};const m=s.round,b=m?`目标 · 第 ${m} 轮 (${p})`:`目标 (${p})`;return{...o,goal:b,goalRevision:s.revision??o.goalRevision}}case"task_update":{const p=s.agentId;if(!p)return o;const m=s.tasks??[],b=m.filter(N=>N.status==="completed").length,y=`任务 ${b}/${m.length}`,v=o.items.findIndex(N=>N.kind==="subagent"&&N.agentId===p),S={kind:"subagent",id:`sub-${p}`,agentId:p,label:y,status:m.length>0&&b===m.length?"completed":"running"};if(v>=0){const N=o.items.slice();return N[v]=S,{...o,items:N}}return{...o,items:[...o.items,S]}}case"agent_start":{const p=s.agentId;if(!p)return o;const m={kind:"subagent",id:`sub-${p}`,agentId:p,label:s.name||s.description||"子代理",status:s.status==="recorded"?"recorded":"running"};return o.items.some(b=>b.kind==="subagent"&&b.agentId===p)?o:{...o,items:[...o.items,m]}}case"agent_end":{const p=s.agentId;return{...o,items:o.items.map(m=>m.kind==="subagent"&&m.agentId===p?{...m,status:s.error?"error":"completed"}:m)}}case"error":{const[p,m]=g("err");return{...m,run:"error",liveByAgent:{},items:[...m.items,{kind:"system_error",id:p,text:s.error||"运行出错"}]}}case"session_title":return{...o,title:s.title};case"session_user_message":case"user_message":{const p=typeof s.clientMessageId=="string"?s.clientMessageId:void 0,m=Array.isArray(s.attachments)?s.attachments.map(v=>v).filter(v=>!!v&&typeof v.name=="string"&&typeof v.size=="number"&&Number.isFinite(v.size)&&v.size>=0).map(v=>({name:v.name,size:v.size,...typeof v.mime=="string"?{mime:v.mime}:{},...typeof v.path=="string"?{path:v.path}:{}})):void 0;if(p&&o.items.some(v=>v.kind==="user"&&v.clientMessageId===p))return m?.length?{...o,items:o.items.map(v=>v.kind==="user"&&v.clientMessageId===p?{...v,attachments:m.map((S,N)=>{const O=v.attachments?.[N];return O?.name===S.name?{...O,...S}:S})}:v)}:o;const[b,y]=g("u");return{...y,items:[...y.items,{kind:"user",id:b,text:s.text??"",...m?.length?{attachments:m}:{},...p?{clientMessageId:p}:{}}]}}case"assistant_text":{const[p,m]=g("a");return{...m,run:"running",items:[...m.items,{kind:"assistant",id:p,text:s.text??"",reasoning:"",done:!0,agentId:s.agentId}]}}default:return o}}function zE(n,i,r,s){const c=`u-${n.seq+1}`;return{...n,seq:n.seq+1,items:[...n.items,{kind:"user",id:c,text:i,...r?.length?{attachments:r}:{},...s?{clientMessageId:s}:{}}]}}function In(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function xt(n){return typeof n=="string"?n:""}function $s(n){return Array.isArray(n)?n.map(In).filter(i=>i!==void 0):[]}function af(n){return typeof n=="string"?n:$s(n).filter(i=>i.type==="text").map(i=>xt(i.text)).join("")}function Us(n){return n.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function Hc(n){const i=n.replace(/\\/g,"/").split("/").filter(Boolean).pop()||"附件";return n.includes(".code-shell/attachments/")?i.replace(/^[a-f0-9]{16}-/,""):i}function Ug(n){const i=typeof n=="number"?n:Number(n);return Number.isSafeInteger(i)&&i>=0?i:0}function RE(n){const i=[],r=[];let s=af(n.content);s=s.replace(/<attached-file\s+path="([^"]*)">\s*([\s\S]*?)<\/attached-file>/g,(o,g,p)=>{if(!/^absolutePath:\s*.+$/m.test(p)||!/^origin:\s*.+$/m.test(p))return o;const m=p.match(/^mime:\s*(.+)$/m)?.[1]?.trim();return i.push({name:Hc(Us(g)),path:Us(g),size:Ug(p.match(/^size:\s*(\d+)\s*$/m)?.[1]),...m?{mime:m}:{}}),""}),s=s.replace(/<attached-directory\s+path="([^"]*)"[^>]*>[\s\S]*?<\/attached-directory>/g,(o,g)=>(i.push({name:`${Hc(Us(g))}/`,path:Us(g),size:0}),"")),s=s.replace(/<attached-image-paths>\s*([\s\S]*?)<\/attached-image-paths>\s*(?:\(上面附带的图片在工作区的真实路径[^\n]*\))?/g,(o,g)=>(r.push(...g.split(`
|
|
49
|
+
`).map(p=>p.trim()).filter(Boolean)),""));const c=$s(n.content).filter(o=>o.type==="image");for(let o=0;o<Math.max(c.length,r.length);o++){const g=In(c[o]?.source),p=xt(g?.data).replace(/\s/g,"");i.push({name:r[o]?Hc(r[o]):`图片 ${o+1}`,...r[o]?{path:r[o]}:{},size:p?Math.max(0,Math.floor(p.length*3/4)-(p.match(/=+$/)?.[0].length??0)):0,...typeof g?.media_type=="string"?{mime:g.media_type}:{}})}const d=Array.isArray(n.attachments)?n.attachments.flatMap(o=>{const g=In(o),p=xt(g?.name)||xt(g?.originalName);return p?[{name:p,size:Ug(g?.size),...typeof g?.mime=="string"?{mime:g.mime}:{},...typeof g?.path=="string"?{path:g.path}:{}}]:[]}):[];return{text:typeof n.displayText=="string"?n.displayText:s.trim(),attachments:d.length?d:i}}function Bg(n){return In(n.data)??In(n.message)??n}function DE(n){const i=[],r=new Set,s=new Set,c=new Map;for(const g of n){const p=In(g);if(!p)continue;const m=Bg(p);p.type==="tool_use"&&xt(m.toolCallId)&&c.set(xt(m.toolCallId),{name:xt(m.toolName)||"工具",args:In(m.args)??{}});for(const b of $s(m.content))b.type==="tool_use"&&xt(b.id)&&c.set(xt(b.id),{name:xt(b.name)||"工具",args:In(b.input)??{}})}const d=(g,p,m,b)=>{g&&(s.has(g)?i.push({type:"tool_use_args_delta",toolCallId:g,args:m,...b?{agentId:b}:{}}):(s.add(g),i.push({type:"tool_use_start",toolCall:{id:g,toolName:p||"工具",args:m},...b?{agentId:b}:{}})))},o=(g,p,m)=>{if(!g)return;const b=c.get(g);s.has(g)||d(g,b?.name||xt(p.toolName)||"工具",b?.args??{},m);const y=typeof p.result=="string"?p.result:af(p.content??p.contentBlocks),v=xt(p.error);i.push({type:"tool_result",result:{id:g,result:y||v,...v?{error:v}:{},isError:p.isError===!0||p.is_error===!0||!!v},...m?{agentId:m}:{}})};for(const g of n){const p=In(g);if(!p)continue;const m=xt(p.id);if(m&&r.has(m))continue;m&&r.add(m);const b=Bg(p),y=xt(b.agentId)||void 0;switch(typeof p.type=="string"?p.type:typeof b.role=="string"?"message":""){case"message":{const S=$s(b.content);if(b.role==="user"){if(b.injected===!0||b.authority==="agent"||b.authority==="system"||b.authority==="policy")break;const N=RE(b);if(N.text.startsWith("<system-reminder>"))break;(N.text||N.attachments.length)&&i.push({type:"user_message",...N,...typeof b.clientMessageId=="string"?{clientMessageId:b.clientMessageId}:{}});for(const O of S)O.type==="tool_result"&&o(xt(O.tool_use_id),O,y)}else if(b.role==="assistant"){const N=af(b.content),O=S.filter(z=>z.type==="reasoning").map(z=>xt(z.reasoningContent)||xt(z.text)).join("");if(N||O){const z=y?{agentId:y}:{};i.push({type:"stream_request_start",...z}),O&&i.push({type:"thinking_delta",text:O,...z}),N&&i.push({type:"text_delta",text:N,...z}),i.push({type:"assistant_message",...z})}for(const z of S)z.type==="tool_use"&&d(xt(z.id),xt(z.name),In(z.input)??{},y)}else b.role==="tool"&&o(xt(b.tool_call_id),b,y);break}case"tool_use":d(xt(b.toolCallId),xt(b.toolName),In(b.args)??{},y);break;case"tool_result":o(xt(b.toolCallId),b,y);break;case"subagent":y&&i.push({type:"agent_start",agentId:y,name:xt(b.name),description:xt(b.description),status:"recorded"});break;case"error":xt(b.error)&&i.push({type:"error",error:b.error});break;case"turn_stopped":i.push({type:"turn_complete",reason:"aborted_tools"});break;case"session_meta":xt(b.sessionId)&&i.push({type:"session_started",sessionId:b.sessionId});break}}return i}function _E(n){let i=qs();for(const r of DE(n))i=Xs(i,r);return{...i,run:i.run==="error"?"error":"idle",liveByAgent:{}}}function OE(n){const i=new URLSearchParams(n).get("session");return i&&/^[a-zA-Z0-9_-]{1,128}$/.test(i)?i:null}function ub(n,i){return!i||!n.hubEpoch||n.hubSequence===void 0?!0:n.hubEpoch===i.epoch&&n.hubSequence>i.sequence}function qg(n,i=[]){let r=_E(n.transcript);for(const c of n.liveStream?.events??[])r=Xs(r,c.event);n.running?r={...r,run:"running"}:n.running===!1&&(r.run==="running"||r.run==="waiting")&&(r={...r,run:"idle"});let s=n.streamCursor;for(const c of i)ub(c,s)&&(r=Xs(r,c.event),c.hubEpoch&&c.hubSequence!==void 0&&(s={epoch:c.hubEpoch,sequence:c.hubSequence}));return{chat:r,cursor:s,truncated:n.liveStream?.truncated??!1}}function ob(n,i){if(n?.title)return n.title;const r=n?.items.find(s=>s.kind==="user");if(r&&r.kind==="user"&&r.text.trim()){const s=r.text.trim().split(`
|
|
50
|
+
`)[0];return s.length>32?`${s.slice(0,32)}…`:s}return r?.kind==="user"&&r.attachments?.length?`附件:${r.attachments[0].name}`:i.slice(0,8)}function ME(n,i){if(i.workspaceKey!==n.workspaceKey||i.sessionId!==n.activeId)throw new Error("当前工作区或对话已经变化,请重新打开面板后发送。");if(n.connection!=="open"||n.loading)throw new Error("工作台尚未连接,请连接后重新发送面板任务。");if(n.readOnly)throw new Error("当前对话为只读,无法发送面板任务。");if(n.running||n.chat.run==="running"||n.chat.run==="waiting"||n.approvals.some(r=>!r.sessionId||r.sessionId===i.sessionId))throw new Error("当前对话仍在处理任务,请完成后再发送面板任务。");if(n.uncertain||n.uploading||n.uploadBusy)throw new Error("当前消息或附件仍在发送,请等待结果后重试。");if(n.draft.length>0||n.files.length>0)throw new Error("当前对话还有草稿或附件,请先处理它们,再发送面板任务。");if(!i.prompt.trim()||i.prompt.length>2e4)throw new Error("面板任务内容无效。");if(n.setDraft(i.prompt),!n.send())throw n.setDraft(""),new Error("当前对话暂时无法接收任务,请稍后重新发送。");return{accepted:!0}}function LE({controller:n,onBackToProjects:i,projectName:r}){const{connection:s,sessions:c,activeId:d,chat:o,draft:g,files:p,uploading:m,workerNote:b,replayNote:y,error:v,workspaceCwd:S,workspaceName:N,configuration:O,configurationVersion:z,sessionsVersion:D,localDrafts:R,running:U,title:F,approvalCount:ue,onAuthLost:L,refreshSessions:le,refreshConfiguration:oe,session:W}=n,T=n.workspaceApi,q=n.host==="desktop"?"桌面":"服务端",[H,re]=j.useState(!1),me=j.useRef(null),te=j.useRef(null),[C,Y]=j.useState(()=>new URLSearchParams(window.location?.search??"").get("view")==="links"?"links":"chat"),[fe,be]=j.useState(),[k,A]=j.useState(),[X,E]=j.useState(0),[ee,ge]=j.useState(!1),[$,ae]=j.useState(null),[ke,Q]=j.useState("overview"),[Se,G]=j.useState(()=>window.matchMedia("(max-width: 760px)").matches),[he,ze]=j.useState(()=>!window.matchMedia("(max-width: 760px)").matches),Ce=j.useRef(null),Oe=j.useRef(null),Qe=j.useRef(!1),at=j.useRef(null),zt=j.useRef(null),st=j.useRef(!0);j.useEffect(()=>{be(void 0),Y(I=>I==="panel"?"panels":I)},[n.workspaceKey]),j.useEffect(()=>{Se&&!he&&Qe.current&&!H&&Oe.current?.focus(),Qe.current=he},[Se,he,H]),j.useEffect(()=>{const I=window.matchMedia("(max-width: 760px)"),xe=()=>{G(I.matches),ze(!I.matches)};return I.addEventListener("change",xe),()=>I.removeEventListener("change",xe)},[]),j.useEffect(()=>{if(!Se||!he)return;const I=Ce.current;I?.querySelector("button")?.focus();const xe=Ae=>{if(!document.querySelector("dialog[open]")){if(Ae.key==="Escape"&&!Ae.isComposing)Ae.preventDefault(),ze(!1),Oe.current?.focus();else if(Ae.key==="Tab"){const J=Array.from(I?.querySelectorAll('button:not(:disabled), select:not(:disabled), input:not(:disabled), textarea:not(:disabled), a[href], summary, [tabindex]:not([tabindex="-1"])')??[]).filter(we=>we.getClientRects().length>0),je=J?.[0],Be=J?.[J.length-1];Ae.shiftKey&&document.activeElement===je?(Ae.preventDefault(),Be?.focus()):!Ae.shiftKey&&document.activeElement===Be&&(Ae.preventDefault(),je?.focus())}}};return document.addEventListener("keydown",xe),()=>document.removeEventListener("keydown",xe)},[Se,he]),j.useLayoutEffect(()=>{const I=zt.current;!I||C!=="chat"||(I.style.height="auto",I.style.height=`${Math.min(180,Math.max(64,I.scrollHeight))}px`)},[g,C]),j.useLayoutEffect(()=>{const I=at.current;I&&st.current&&C==="chat"&&(I.scrollTop=I.scrollHeight)},[o.items,n.approvals.length,C]);const dt=()=>{Se&&(ze(!1),Oe.current?.focus())},jt=I=>{if(C==="settings"&&ke===I){dt();return}tt(()=>{Q(I),Y("settings"),dt()})},tt=I=>{ee?ae(()=>I):I()},Mt=I=>tt(()=>{A(I),E(xe=>xe+1),Y("files"),dt()}),ut=j.useRef(Mt);ut.current=Mt;const Ft=j.useCallback(I=>ut.current(I),[]);j.useEffect(()=>{if(!ee&&!n.uploadBusy&&!n.hasUnsent)return;const I=xe=>{xe.preventDefault(),xe.returnValue=""};return window.addEventListener("beforeunload",I),()=>window.removeEventListener("beforeunload",I)},[ee,n.uploadBusy,n.hasUnsent]);const ie=I=>tt(()=>{Y("chat"),dt(),st.current=!0,I()}),pe=I=>ie(()=>{n.selectSession(I)}),De=()=>ie(n.newSession),_e=()=>{st.current=!0,n.send()},qe=n.stop,kt=n.approvals.filter(I=>!I.sessionId||I.sessionId===d),wt=n.approvals.filter(I=>I.sessionId&&I.sessionId!==d),Nt=o.items.length===0&&kt.length===0,ot=O?.connections.find(I=>I.id===O.defaults.text),ht=s==="open"?"已连接":s==="connecting"?"连接中":"正在重连",$e=C==="chat"?F:C==="files"?"工作区文件":C==="history"?"历史对话":C==="links"?"Link":C==="panels"||C==="panel"?fe&&C==="panel"?fe.panel.title["zh-CN"]||fe.panel.title.default:"面板":ke==="skills"?"Skills":"设置";return u.jsxs("div",{className:`shell${he?" sidebar-open":""}`,children:[Se&&he?u.jsx("div",{className:"sidebar-backdrop",onClick:()=>{ze(!1),Oe.current?.focus()},"aria-hidden":"true"}):null,u.jsxs("aside",{id:"workbench-sidebar",ref:Ce,className:"rail",hidden:!he,role:Se?"dialog":void 0,"aria-modal":Se&&he?!0:void 0,"aria-label":"工作台导航",children:[u.jsxs("div",{className:"rail-head",children:[u.jsx("span",{className:"brand-mark",children:u.jsx(At,{name:"brand"})}),u.jsx("strong",{children:"CodeShell"}),u.jsx("span",{className:"hub-badge",children:n.host==="desktop"?"Desktop":T?"Hub":"Web"}),u.jsx("button",{className:"icon-button sidebar-close","aria-label":"收起侧栏",onClick:()=>{ze(!1),Oe.current?.focus()},children:u.jsx(At,{name:"sidebar"})})]}),u.jsx(hf,{discover:n.workspaceApi,navigate:I=>{const xe=()=>window.location.assign(I);ee||n.hasUnsent||n.uploadBusy?ae(()=>xe):xe()}}),u.jsxs("nav",{className:"workbench-nav","aria-label":"主要功能",children:[i?u.jsxs("button",{className:"nav-button",title:r,onClick:()=>{ee||n.hasUnsent||n.uploadBusy?ae(()=>i):i()},children:[u.jsx(At,{name:"folder"}),u.jsx("span",{children:"返回项目列表"})]}):null,u.jsxs("button",{className:"nav-button new-chat-button",onClick:De,children:[u.jsx(At,{name:"plus"}),u.jsx("span",{children:"新对话"})]}),u.jsxs("button",{className:`nav-button${C==="chat"?" active":""}`,onClick:()=>{tt(()=>{Y("chat"),dt()})},"aria-current":C==="chat"?"page":void 0,children:[u.jsx(At,{name:"chat"}),u.jsx("span",{children:"对话"})]}),T?u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:`nav-button${C==="history"?" active":""}`,onClick:()=>tt(()=>{Y("history"),dt()}),"aria-current":C==="history"?"page":void 0,children:[u.jsx(At,{name:"history"}),u.jsx("span",{children:"历史对话"})]}),u.jsxs("button",{className:`nav-button${C==="files"?" active":""}`,onClick:()=>Mt(),"aria-current":C==="files"?"page":void 0,children:[u.jsx(At,{name:"folder"}),u.jsx("span",{children:"文件"})]}),u.jsxs("button",{className:`nav-button${C==="settings"&&ke==="skills"?" active":""}`,onClick:()=>jt("skills"),"aria-current":C==="settings"&&ke==="skills"?"page":void 0,children:[u.jsx(At,{name:"skills"}),u.jsx("span",{children:"Skills"})]}),u.jsxs("button",{className:`nav-button${C==="panels"||C==="panel"?" active":""}`,onClick:()=>tt(()=>{Y("panels"),dt()}),"aria-current":C==="panels"||C==="panel"?"page":void 0,children:[u.jsx(At,{name:"panels"}),u.jsx("span",{children:"面板"})]}),u.jsxs("button",{className:`nav-button${C==="links"?" active":""}`,onClick:()=>tt(()=>{Y("links"),dt()}),"aria-current":C==="links"?"page":void 0,children:[u.jsx(At,{name:"links"}),u.jsx("span",{children:"Link"})]}),u.jsxs("button",{className:`nav-button${C==="settings"&&ke!=="skills"?" active":""}`,onClick:()=>jt("overview"),"aria-current":C==="settings"&&ke!=="skills"?"page":void 0,children:[u.jsx(At,{name:"settings"}),u.jsx("span",{children:"设置"})]})]}):null]}),u.jsx("div",{className:"rail-section-label",children:"工作区"}),T?u.jsxs("button",{className:"workspace-button",title:S??void 0,onClick:()=>Mt(),children:[u.jsx(At,{name:"folder"}),u.jsx("span",{children:r??N}),u.jsx(At,{name:"chevron"})]}):u.jsxs("div",{className:"workspace-button",title:S??void 0,children:[u.jsx(At,{name:"folder"}),u.jsx("span",{children:r??N})]}),u.jsxs("div",{className:"rail-section-label history-label",children:[u.jsx("span",{children:"最近对话"}),u.jsx("span",{children:c.length})]}),n.renderSidebar?.({guard:tt,conversation:ie}),u.jsxs("ul",{className:"sessions","aria-label":"最近对话",children:[R.map(({sessionId:I,draft:xe})=>u.jsx("li",{children:u.jsxs("button",{className:I===d&&C==="chat"?"session active":"session",onClick:()=>{pe(I)},children:[u.jsx("span",{className:"session-title",children:xe.text.trim()||`附件:${xe.files[0]?.name??"新对话"}`}),u.jsx("span",{className:"session-meta",children:"草稿"})]})},`draft-${I}`)),c.map(I=>u.jsx("li",{children:u.jsxs("button",{className:I.sessionId===d&&C==="chat"?"session active":"session",onClick:()=>{pe(I.sessionId)},"aria-current":I.sessionId===d&&C==="chat"?"page":void 0,children:[u.jsx("span",{className:"session-title",children:I.sessionId===d?I.customTitle||o.title||I.title||ob(o,I.sessionId):I.title||I.preview?.trim()||I.sessionId.slice(0,8)}),u.jsxs("span",{className:"session-meta",children:[n.unreadSessionIds?.has(I.sessionId)&&I.sessionId!==d?u.jsxs("span",{className:"session-unread","aria-label":"有新消息",children:["●"," "]}):null,ue(I.sessionId)?`${ue(I.sessionId)} 项待审批`:I.running?"进行中":BE(I.status),n.showTurnCounts!==!1?u.jsxs("span",{children:[" · ",I.turnCount," 轮"]}):null]})]})},I.sessionId)),c.length===0&&R.length===0?u.jsx("li",{className:"empty",children:"开始对话后,记录会保存在这里。"}):null]}),u.jsxs("div",{className:"rail-footer",children:[u.jsxs("div",{className:"host-label",children:[u.jsx("span",{className:`dot ${s}`}),u.jsxs("span",{children:[q,ht]})]}),n.host==="hub"?u.jsxs("button",{className:"account-button",onClick:()=>{dt(),re(!0)},children:[u.jsx("span",{className:"account-avatar",children:(W?.username||"C").slice(0,1).toUpperCase()}),u.jsxs("span",{className:"account-copy",children:[u.jsx("strong",{children:W?.username||"账号"}),u.jsx("span",{children:"设备与退出"})]}),u.jsx(At,{name:"chevron"})]}):null,n.logout?u.jsxs("button",{className:"account-button",onClick:n.logout,children:[u.jsx("span",{className:"account-avatar",children:(n.accountName||"D").slice(0,1)}),u.jsxs("span",{className:"account-copy",children:[u.jsx("strong",{children:n.accountName||"已配对设备"}),u.jsx("span",{children:"退出此设备"})]})]}):null]})]}),u.jsxs("main",{className:"workbench-main",inert:Se&&he?!0:void 0,children:[u.jsxs("header",{className:"workbench-topbar",children:[u.jsx("button",{ref:Oe,className:"icon-button","aria-label":he?"收起侧栏":"展开侧栏","aria-expanded":he,"aria-controls":"workbench-sidebar",onClick:()=>ze(I=>!I),children:u.jsx(At,{name:"sidebar"})}),u.jsxs("div",{className:"topbar-context",children:[u.jsx("span",{className:"topbar-project","aria-label":"当前项目",title:r??N,children:r??N}),u.jsx("span",{className:"topbar-title",title:$e,children:$e})]}),u.jsxs("span",{className:"connection-pill",title:`任务在${q}工作区执行`,children:[u.jsx("span",{className:`dot ${s}`}),u.jsx("span",{children:q})]})]}),b?u.jsx("div",{className:"banner",children:b}):null,y?u.jsx("div",{className:"banner",children:y}):null,v?u.jsxs("div",{className:"banner form-error",role:"alert",children:[v,u.jsx("button",{className:"ghost","aria-label":"关闭错误提示",onClick:n.clearError,children:"×"})]}):null,wt.length?u.jsxs("div",{className:"banner",children:["其他会话有待处理审批。",wt.map(I=>u.jsxs("button",{className:"ghost",onClick:()=>{pe(I.sessionId)},children:["打开 ",I.sessionId.slice(0,8)]},I.id))]}):null,s!=="open"?u.jsxs("div",{className:"banner",children:["连接",s==="connecting"?"中…":"已断开,重连中…"]}):null,C!=="chat"&&kt.length>0?u.jsxs("div",{className:"banner",children:["当前对话需要你的确认。",u.jsx("button",{className:"ghost",onClick:()=>tt(()=>Y("chat")),children:"返回对话"})]}):null,u.jsxs("section",{className:`chat${Nt?" chat-empty":""}`,hidden:C!=="chat","aria-label":"对话",children:[u.jsx("div",{className:"messages",ref:at,onScroll:I=>{const xe=I.currentTarget;st.current=xe.scrollHeight-xe.scrollTop-xe.clientHeight<100},children:u.jsxs("div",{className:"transcript",children:[n.chatControls,n.loading?u.jsx("div",{className:"banner",role:"status",children:"正在恢复会话记录…"}):null,o.goal?u.jsxs("div",{className:"banner goal",children:[u.jsx("span",{children:o.goal}),n.goalActions]}):null,o.items.map(I=>{switch(I.kind){case"user":return u.jsxs("div",{className:"msg user",children:[I.text,I.attachments?.map((xe,Ae)=>T&&xe.path?u.jsxs("button",{className:"attachment attachment-open",onClick:()=>Mt(xe.path),children:["📎 ",xe.name]},Ae):u.jsxs("span",{className:"attachment",children:["📎 ",xe.name]},Ae))]},I.id);case"assistant":return I.done&&!I.text&&!I.reasoning?null:u.jsx("div",{className:"msg assistant",children:u.jsx(wE,{text:I.text,reasoning:I.reasoning,streaming:!I.done,onOpenFile:T?Ft:void 0})},I.id);case"tool":return u.jsx("div",{className:`msg tool${I.error?" tool-error":""}`,children:u.jsx(EE,{item:I,running:U})},I.id);case"subagent":return u.jsxs("div",{className:"msg info",children:["↳ ",I.label," · ",NE(I.status)]},I.id);case"system_error":return u.jsx("div",{className:"msg error",children:I.text},I.id);default:return null}}),n.approvalContent,Nt?u.jsxs("div",{className:"empty-chat",children:[u.jsx("span",{className:"welcome-mark",children:u.jsx(At,{name:"brand"})}),u.jsx("h1",{children:"今天想完成什么?"}),u.jsx("p",{children:"从一个问题或想法开始,让 CodeShell 帮你一步步完成。"}),u.jsxs("span",{className:"welcome-workspace",children:[u.jsx(At,{name:"folder"}),r??N]})]}):null]})}),n.readOnlyNote?u.jsx("div",{className:"banner",children:n.readOnlyNote}):null,u.jsxs("div",{className:"composer-wrap",children:[u.jsxs("footer",{className:"composer",children:[p.length||m&&n.host==="hub"?u.jsxs("div",{className:"attachments","aria-live":"polite",children:[p.map(I=>u.jsxs("span",{className:"attachment",children:[u.jsx(At,{name:"attachment"}),I.name,u.jsx("button",{className:"ghost","aria-label":`移除 ${I.name}`,onClick:()=>{n.removeFile(I.id)},children:"×"})]},I.id)),m&&n.host==="hub"?u.jsx("span",{children:"正在上传…"}):null]}):null,u.jsx("textarea",{ref:zt,"aria-label":"任务内容",value:g,disabled:n.readOnly,rows:2,placeholder:"描述你的任务,或提出一个问题…",onChange:I=>{n.setDraft(I.target.value)},onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&!I.nativeEvent.isComposing&&(I.preventDefault(),_e())}}),u.jsxs("div",{className:"composer-toolbar",children:[T?u.jsxs(u.Fragment,{children:[u.jsx("input",{hidden:!0,multiple:!0,type:"file",accept:n.attachmentAccept,ref:me,onChange:I=>{const xe=I.currentTarget;Promise.resolve(n.addFiles(xe.files)).finally(()=>{xe.value=""})}}),u.jsx("button",{className:"icon-button attach-button","aria-label":"添加附件",title:"添加附件",disabled:n.uploadBusy||s!=="open"||n.readOnly,onClick:()=>me.current?.click(),children:u.jsx(At,{name:"plus"})}),n.cameraAttachments?u.jsxs(u.Fragment,{children:[u.jsx("input",{hidden:!0,type:"file",accept:"image/*",capture:"environment",ref:te,onChange:I=>{const xe=I.currentTarget;Promise.resolve(n.addFiles(xe.files)).finally(()=>{xe.value=""})}}),u.jsx("button",{className:"icon-button attach-button","aria-label":"拍照",title:"拍照",disabled:n.uploadBusy||s!=="open"||n.readOnly,onClick:()=>te.current?.click(),children:u.jsx(At,{name:"camera"})})]}):null,u.jsxs("button",{className:"model-button",title:"打开模型设置",onClick:()=>jt("models"),children:[u.jsx("span",{children:ot?.model||"配置模型"}),u.jsx(At,{name:"chevron"})]})]}):null,u.jsx("span",{className:"composer-run-status",role:"status",children:n.uncertain?"正在核对消息…":m?n.host==="desktop"?"正在发送…":"正在上传附件…":kt.length?"等待你的确认":U?"正在处理…":""}),U?u.jsx("button",{className:"stop composer-submit","aria-label":"停止",title:"停止",onClick:qe,disabled:s!=="open",children:u.jsx(At,{name:"stop"})}):u.jsx("button",{className:"send composer-submit","aria-label":"发送",title:"发送",onClick:_e,disabled:s!=="open"||m||n.uncertain||n.readOnly||!g.trim()&&!p.length,children:u.jsx(At,{name:"send"})})]})]}),u.jsxs("div",{className:"composer-caption",children:[u.jsxs("span",{children:["任务在",q,"工作区执行"]}),u.jsx("span",{children:"Enter 发送 · Shift + Enter 换行"})]})]})]}),C==="settings"&&T?u.jsx(N0,{host:n.host==="desktop"?"desktop":"hub",section:ke,onSectionChange:jt,onAuthLost:L,onConfigurationChange:()=>{oe()},configurationVersion:z,onDirtyChange:ge},`${n.workspaceKey}:settings`):null,C==="files"&&T?u.jsx(O0,{initialPath:k,openVersion:X,onAuthLost:L},`${n.workspaceKey}:files`):null,C==="history"&&T?u.jsx(M0,{onAuthLost:L,onOpen:I=>{pe(I)},onChanged:()=>{le()},version:D,onDirtyChange:ge},`${n.workspaceKey}:history`):null,C==="links"&&T?u.jsx(B0,{onAuthLost:L,onDirtyChange:ge,hostLabel:q,configurationVersion:z},`${n.workspaceKey}:links`):null,C==="panels"&&T?u.jsx(q0,{onAuthLost:L,onDirtyChange:ge,onChanged:()=>{oe()},hostLabel:q,configurationVersion:z,onOpen:I=>tt(()=>{be({panel:I,workspaceKey:n.workspaceKey}),Y("panel"),dt()})},`${n.workspaceKey}:panels`):null,C==="panel"&&T&&fe?.workspaceKey===n.workspaceKey?u.jsx(K0,{panel:fe.panel,sessionId:d,busy:U||m||n.uncertain,onAuthLost:L,onDirtyChange:ge,onClose:()=>tt(()=>Y("panels")),onSubmitPrompt:async I=>ME(n,{...I,workspaceKey:fe.workspaceKey})},`${n.workspaceKey}:panel:${fe.panel.id}:${d}`):null]}),$?u.jsx(UE,{onStay:()=>ae(null),onLeave:()=>{const I=$;ae(null),ge(!1),I()}}):null,H&&n.host==="hub"?u.jsx(Zv,{session:W,onClose:()=>re(!1),onAuthLost:L}):null]})}function UE({onStay:n,onLeave:i}){const r=j.useRef(null);return j.useEffect(()=>{const s=document.activeElement;return r.current?.showModal(),()=>{r.current?.close(),s?.focus()}},[]),u.jsxs("dialog",{className:"navigation-prompt",ref:r,"aria-labelledby":"navigation-prompt-title",onCancel:s=>{s.preventDefault(),n()},children:[u.jsx("h2",{id:"navigation-prompt-title",children:"还有未保存的修改"}),u.jsx("p",{children:"离开会丢弃未提交的修改;切换项目还会清除未发送的草稿和附件。已经提交的操作可能仍会完成,请等待结果后再离开。"}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button primary",onClick:n,autoFocus:!0,children:"留在此页"}),u.jsx("button",{className:"library-button",onClick:i,children:"放弃修改并离开"})]})]})}function BE(n){switch(n){case"running":return"进行中";case"waiting":case"waiting_approval":return"等待确认";case"completed":return"已完成";case"cancelled":case"canceled":return"已停止";case"failed":case"error":return"发生错误";case"idle":return"可继续";default:return"对话"}}function At({name:n}){const i={panels:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),u.jsx("path",{d:"M15 3v18M15 10h6"})]}),camera:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 7h4l2-3h6l2 3h4v13H3Z"}),u.jsx("circle",{cx:"12",cy:"13",r:"4"})]}),links:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-2 2"}),u.jsx("path",{d:"M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l2-2"})]}),brand:u.jsx(u.Fragment,{children:u.jsx("path",{d:"m5 7 5 5-5 5M13 17h6"})}),sidebar:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M9 4v16"})]}),plus:u.jsx("path",{d:"M12 5v14M5 12h14"}),chat:u.jsx("path",{d:"M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5Z"}),history:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),u.jsx("path",{d:"M3 3v5h5M12 7v5l3 2"})]}),skills:u.jsx(u.Fragment,{children:u.jsx("path",{d:"m12 3 2.7 5.5L21 9.4l-4.5 4.4 1.1 6.2L12 17.1 6.4 20l1.1-6.2L3 9.4l6.3-.9L12 3Z"})}),settings:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"m9 3-.7 3-2.6 1-2.6 2 1.4 3-1.4 3 2.6 2 2.6 1 .7 3h6l.7-3 2.6-1 2.6-2-1.4-3 1.4-3-2.6-2-2.6-1L15 3H9Z"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),folder:u.jsx("path",{d:"M3 7V5a1 1 0 0 1 1-1h5l2 3h9a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7Z"}),chevron:u.jsx("path",{d:"m9 5 7 7-7 7"}),attachment:u.jsx("path",{d:"m21 11-8 8a6 6 0 0 1-8.5-8.5l9-9A4 4 0 0 1 19 7l-9 9a2 2 0 0 1-2.8-2.8l8-8"}),send:u.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),stop:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor",stroke:"none"})};return u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i[n]})}class Yl extends Error{constructor(i,r,s){super(i),this.kind=r,this.code=s,this.name="ProtocolRequestError"}kind;code}const qE=3e4,Hg=800,HE=15e3;class IE{constructor(i){this.url=i}url;ws=null;nextId=1;pending=new Map;notificationHandlers=new Set;stateHandlers=new Set;reconnectDelay=Hg;closedByUser=!1;reconnectTimer;authHandlers=new Set;connect(){this.ws||(clearTimeout(this.reconnectTimer),this.closedByUser=!1,this.openSocket())}openSocket(){if(this.closedByUser)return;this.reconnectTimer=void 0,this.emitState("connecting");const i=new WebSocket(this.url);this.ws=i,i.onopen=()=>{this.ws!==i||this.closedByUser||(this.reconnectDelay=Hg,this.emitState("open"))},i.onmessage=r=>{if(this.ws!==i||this.closedByUser)return;let s;try{if(s=JSON.parse(String(r.data)),!s||typeof s!="object"||Array.isArray(s))return}catch{return}if(s.id!==void 0&&s.method===void 0){const c=this.pending.get(String(s.id));if(!c)return;this.pending.delete(String(s.id)),clearTimeout(c.timer),s.error?c.reject(new Yl(s.error.message??"request failed","response",s.error.code)):c.resolve(s.result);return}if(s.method)for(const c of this.notificationHandlers)c(s.method,s.params??{})},i.onclose=r=>{if(this.ws===i){if(this.ws=null,this.emitState("closed"),this.failAllPending(new Yl("connection closed","transport")),r.code===4401||r.code===4403){this.closedByUser=!0;for(const s of this.authHandlers)s()}this.closedByUser||(this.reconnectTimer=setTimeout(()=>this.openSocket(),this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,HE))}},i.onerror=()=>{}}close(){this.closedByUser=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0;const i=this.ws;this.ws=null,i?.close(),this.failAllPending(new Yl("connection closed","transport"))}onNotification(i){return this.notificationHandlers.add(i),()=>this.notificationHandlers.delete(i)}onStateChange(i){return this.stateHandlers.add(i),()=>this.stateHandlers.delete(i)}onAuthLost(i){return this.authHandlers.add(i),()=>this.authHandlers.delete(i)}request(i,r,s=qE){const c=this.ws;if(!c||c.readyState!==WebSocket.OPEN)return Promise.reject(new Yl("not connected","not-sent"));const d=`web-${this.nextId++}`;return new Promise((o,g)=>{const p=s>0?setTimeout(()=>{this.pending.delete(d),g(new Yl(`request timed out: ${i}`,"timeout"))},s):void 0;this.pending.set(d,{resolve:o,reject:g,timer:p});try{c.send(JSON.stringify({jsonrpc:"2.0",id:d,method:i,params:r}))}catch(m){clearTimeout(p),this.pending.delete(d),g(new Yl(m instanceof Error?m.message:"send failed","not-sent"))}})}run(i){return this.request("agent/run",i,0)}listSessions(){return this.request("agent/query",{type:"sessions"})}sessionDetail(i){return this.request("agent/query",{type:"session_detail",sessionId:i})}approve(i,r,s){return this.request("agent/approve",{sessionId:i.sessionId??"",...i.connectionId?{connectionId:i.connectionId}:{},...i.generation!==void 0?{generation:i.generation}:{},requestId:i.requestId,decision:r?{approved:!0,...s?{answer:s}:{}}:{approved:!1}})}cancel(i){return this.request("agent/cancel",{sessionId:i})}emitState(i){for(const r of this.stateHandlers)r(i)}failAllPending(i){for(const[,r]of this.pending)clearTimeout(r.timer),r.reject(i);this.pending.clear()}}function YE(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${yt("/ws")}`}function GE(n,i){const{method:r,params:s}=i;if(r==="serve/approvalSnapshot"){if(!Array.isArray(s.approvals))return n;const d={};for(const o of s.approvals)o?.requestId&&o.request&&(d[o.requestId]={payload:o});return d}if(r==="agent/approvalRequest"){const d=s;return!d.requestId||!d.request?n:{...n,[d.requestId]:{...n[d.requestId],payload:d}}}const c=s.requestId;if(typeof c!="string"||!n[c])return n;if(r==="agent/approvalResolved"){const d={...n};return delete d[c],d}return r==="serve/approvalLease"?{...n,[c]:{...n[c],lease:s}}:n}class VE{drafts=new Map;get(i){return this.drafts.get(i)??{text:"",files:[],revision:0}}update(i,r){const s={...r,revision:this.get(i).revision+1};return this.drafts.set(i,s),s}setText(i,r){return this.update(i,{...this.get(i),text:r})}addFile(i,r){const s=this.get(i);return this.update(i,{...s,files:[...s.files,r]})}removeFile(i,r){const s=this.get(i);return this.update(i,{...s,files:s.files.filter(c=>c.id!==r)})}take(i){const r=this.get(i),s=this.update(i,{text:"",files:[]});return{sessionId:i,draft:r,clearedRevision:s.revision}}restore(i){const r=this.get(i.sessionId);return r.revision!==i.clearedRevision||r.text||r.files.length?!1:(this.update(i.sessionId,i.draft),!0)}unsent(){return[...this.drafts].flatMap(([i,r])=>r.text.trim()||r.files.length?[{sessionId:i,draft:r}]:[])}}const QE="codeshell.uiLanguage";function XE(){try{const n=globalThis.localStorage?.getItem(QE);if(n==="zh"||n==="en")return n}catch{}return"zh"}const $E={zh:{mobile:{app:{extendGoal:"延长目标",clearGoal:"清除目标",loadingCcSession:"正在加载 CC 会话…",loadingSession:"正在加载会话…",conversationFallback:"对话",desktopSession:"桌面会话",newSession:"新会话",openSessionsAria:"打开会话",leaveSessionAria:"退出会话",deviceFallback:"设备",logoutAria:"退出登录",permission:"权限",ccRoomObserving:"此会话当前为只读查看;请在桌面端明确接管后再发送消息。"},approval:{risk:{low:"低风险",medium:"中风险",high:"高风险"},readSourceSummary:"读取数据源 {source} / {scope} / {resource}",question:"问题",customPlaceholder:"或输入自定义回答…",sendCustom:"发送自定义回答",rememberScope:"记住范围",scope:{once:"仅本次",session:"本会话",project:"本项目"},pathScopeLabel:"路径范围",pathScope:{file:"此文件",dir:"此目录",tool:"此工具"},allow:"允许",reject:"拒绝"},cc:{title:"CC 会话",subtitle:"外部 {label} 会话",selectProjectFirst:"先选择一个项目。",probingCli:"正在检测 {label} CLI…",cliMissing:"未检测到 {label} CLI(需在桌面端机器的 PATH 中)。",loadingSessions:"正在加载 cc 会话…",empty:"该项目下没有 {label} 会话。",messageCount:"{count} 条"},sidePane:{localTab:"会话",ccTab:"CC 会话"},composer:{disconnected:"未连接",placeholder:"发消息…",stop:"停止",send:"发送",chooseImages:"从相册选择图片",takePhoto:"拍照",removeImage:"移除图片",uploading:"上传中…",tooManyImages:"每条消息最多发送 4 张图片",unsupportedImage:"不支持此图片格式",sendFailed:"图片发送失败,请重试"},connection:{connectingTitle:"正在连接…",connectingBody:"与 CodeShell 建立通道",authenticatingTitle:"认证中…",authenticatingBody:"正在校验设备身份",unpairedTitle:"未配对",unpairedBody:"请在 CodeShell 桌面端打开「设置 → 远程」,扫码或打开配对链接。",offlineTitle:"连接断开",offlineBody:"正在自动重连…"},format:{noProject:"无项目",justNow:"刚刚",minutesAgo:"{n} 分钟前",hoursAgo:"{n} 小时前",daysAgo:"{n} 天前",monthsAgo:"{n} 个月前",yearsAgo:"{n} 年前"},notice:{roomMissing:"会话不存在或未就绪",roomError:"会话错误",sessionRecoveryIncomplete:"当前回复的开头尚未恢复,请重新打开会话以读取已保存的内容。",sessionRecoveryHistoryOnly:"已恢复保存的聊天记录。当前回复的实时部分暂时无法接续,请稍后重新打开会话。",goalExtendFailed:"延长目标失败",ccRoomOpenFailed:"cc 会话无法打开",ccRoomObserving:"此 CC 会话当前为只读查看,消息未发送",attachmentSendFailed:"图片发送失败:{error}"},permissionMode:{default:"默认",acceptEdits:"自动改",bypassPermissions:"全放行",defaultDesc:"每个工具调用都要你确认",acceptEditsDesc:"自动放行文件编辑,其余仍确认",bypassDesc:"跳过所有权限确认(危险)",title:"选择权限模式",confirmBypass:"全放行模式会跳过所有权限确认。确定吗?"},sessionList:{title:"会话",takeoverCount:"{count} 个可接管",refreshAria:"刷新会话",new:"新建",createHint:"新会话默认使用当前目录",currentProject:"当前项目 · {name}",noProjectConversation:"无项目对话",desktopCwd:"当前桌面目录",unboundRepo:"不绑定 repo",followsDesktopCwd:"跟随桌面当前 cwd",otherProjects:"其他项目",loading:"正在加载会话…",empty:"还没有会话。点「新建」开一个,或在桌面端开始。",automation:"自动",noProjectPath:"无项目路径",unreadAria:"有新内容",primaryRoot:"主目录",secondaryRoot:"次目录"},status:{conn:{connecting:"连接中…",authenticating:"认证中…",unpaired:"未配对",online:"在线",offline:"已断开"},run:{idle:"空闲",running:"运行中",waiting:"待审批",completed:"已完成",error:"出错"}},storage:{browserDevice:"{platform} 浏览器"},stream:{showReasoning:"显示思考",hideReasoning:"隐藏思考",subagent:"子代理",loading:"正在加载…",generating:"正在生成回复",emptyHint:"发个任务试试,或在侧栏打开一个 Claude Code 会话。"},tool:{running:"运行中",failed:"失败",completed:"完成",fallbackName:"操作",truncated:"… (已截断)"}}},en:{mobile:{app:{extendGoal:"Extend goal",clearGoal:"Clear goal",loadingCcSession:"Loading CC session…",loadingSession:"Loading conversation…",conversationFallback:"Conversation",desktopSession:"Desktop session",newSession:"New session",openSessionsAria:"Open sessions",leaveSessionAria:"Leave session",deviceFallback:"Device",logoutAria:"Log out",permission:"Permission",ccRoomObserving:"This session is read-only. Take it over explicitly on desktop before sending messages."},approval:{risk:{low:"Low risk",medium:"Medium risk",high:"High risk"},readSourceSummary:"Read data source {source} / {scope} / {resource}",question:"Question",customPlaceholder:"Or enter a custom answer…",sendCustom:"Send custom answer",rememberScope:"Remember scope",scope:{once:"Once",session:"This session",project:"This project"},pathScopeLabel:"Path scope",pathScope:{file:"This file",dir:"This directory",tool:"This tool"},allow:"Allow",reject:"Deny"},cc:{title:"CC sessions",subtitle:"External {label} sessions",selectProjectFirst:"Select a project first.",probingCli:"Checking {label} CLI…",cliMissing:"{label} CLI was not found (it must be in PATH on the desktop machine).",loadingSessions:"Loading cc sessions…",empty:"No {label} sessions in this project.",messageCount:"{count} messages"},sidePane:{localTab:"Sessions",ccTab:"CC"},composer:{disconnected:"Disconnected",placeholder:"Message…",stop:"Stop",send:"Send",chooseImages:"Choose images",takePhoto:"Take photo",removeImage:"Remove image",uploading:"Uploading…",tooManyImages:"Up to 4 images can be sent per message",unsupportedImage:"This image format is not supported",sendFailed:"Could not send images; try again"},connection:{connectingTitle:"Connecting…",connectingBody:"Opening a channel to CodeShell",authenticatingTitle:"Authenticating…",authenticatingBody:"Verifying this device",unpairedTitle:"Not paired",unpairedBody:"Open Settings → Remote in CodeShell desktop, then scan the QR code or open the pairing link.",offlineTitle:"Disconnected",offlineBody:"Reconnecting automatically…"},format:{noProject:"No project",justNow:"Just now",minutesAgo:"{n} min ago",hoursAgo:"{n} hr ago",daysAgo:"{n} days ago",monthsAgo:"{n} mo ago",yearsAgo:"{n} yr ago"},notice:{roomMissing:"Session does not exist or is not ready",roomError:"Session error",sessionRecoveryIncomplete:"The beginning of this reply could not be restored. Reopen the conversation to read its saved content.",sessionRecoveryHistoryOnly:"Saved chat history has been restored. Reopen the conversation later to see the rest of this reply.",goalExtendFailed:"Failed to extend goal",ccRoomOpenFailed:"Could not open cc session",ccRoomObserving:"This CC session is read-only; the message was not sent",attachmentSendFailed:"Could not send images: {error}"},permissionMode:{default:"Default",acceptEdits:"Auto-edit",bypassPermissions:"Allow all",defaultDesc:"Confirm every tool call",acceptEditsDesc:"Allow file edits automatically; confirm everything else",bypassDesc:"Skip all permission confirmations (dangerous)",title:"Choose permission mode",confirmBypass:"Allow all mode skips every permission confirmation. Continue?"},sessionList:{title:"Sessions",takeoverCount:"{count} available",refreshAria:"Refresh sessions",new:"New",createHint:"New sessions default to the current directory",currentProject:"Current project · {name}",noProjectConversation:"No-project conversation",desktopCwd:"Current desktop directory",unboundRepo:"Do not bind a repo",followsDesktopCwd:"Follow desktop current cwd",otherProjects:"Other projects",loading:"Loading sessions…",empty:"No sessions yet. Tap “New” to start one, or start from desktop.",automation:"Automation",noProjectPath:"No project path",unreadAria:"New content",primaryRoot:"Primary",secondaryRoot:"Secondary"},status:{conn:{connecting:"Connecting…",authenticating:"Authenticating…",unpaired:"Not paired",online:"Online",offline:"Disconnected"},run:{idle:"Idle",running:"Running",waiting:"Awaiting approval",completed:"Completed",error:"Error"}},storage:{browserDevice:"{platform} browser"},stream:{showReasoning:"Show reasoning",hideReasoning:"Hide reasoning",subagent:"Subagent",loading:"Loading…",generating:"Generating response",emptyHint:"Send a task, or open a Claude Code session from the sidebar."},tool:{running:"Running",failed:"Failed",completed:"Completed",fallbackName:"Operation",truncated:"… (truncated)"}}}},Ig=$E;function Yg(n,i){let r=n;for(const s of i.split(".")){if(r==null||typeof r!="object")return;r=r[s]}return typeof r=="string"?r:void 0}function ZE(n,i){return i?n.replace(/\{(\w+)\}/g,(r,s)=>s in i?String(i[s]):r):n}function KE(n,i,r){const s=Yg(Ig[n],i)??Yg(Ig.zh,i)??i;return ZE(s,r)}function FE(n,i){return KE(XE(),n,i)}const JE=["command","file_path","path","url","pattern","query"];function PE(n,i,r){let s="";const c=n?.source,d=n?.scope,o=n?.resource;if(r==="ReadSource"&&typeof c=="string"&&c.length>0&&typeof d=="string"&&d.length>0&&typeof o=="string"&&o.length>0)s=FE("mobile.approval.readSourceSummary",{source:c,scope:d,resource:o});else for(const p of JE){const m=n?.[p];if(typeof m=="string"&&m.length>0){s=m;break}}s||(s=JSON.stringify(n??{}));let g;return i==="low"||i==="medium"||i==="high"?g=i:i===void 0||i===""?g="medium":g="high",{summary:s,risk:g}}function WE({payload:n,onDecide:i,busy:r,connected:s}){const[c,d]=j.useState(""),o=n.request.toolName==="__ask_user__",{summary:g,risk:p}=PE(n.request.args,n.request.riskLevel,n.request.toolName);return u.jsxs("div",{className:"approval",children:[u.jsxs("div",{className:"approval-title",children:[o?"Agent 提问":`工具审批:${n.request.toolName}`,o?null:u.jsxs("em",{children:[" · ",p]})]}),n.request.description?u.jsx("div",{className:"approval-desc",children:n.request.description}):null,o?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"approval-summary",children:g}),u.jsxs("details",{className:"approval-raw",children:[u.jsx("summary",{children:"原始参数"}),u.jsx("pre",{className:"approval-args",children:JSON.stringify(n.request.args,null,2)})]})]}),o?u.jsx("textarea",{className:"approval-answer",value:c,placeholder:"输入回答…",onChange:m=>d(m.target.value)}):null,r?u.jsx("span",{className:"muted",role:"status",children:"设备正在处理此审批…"}):null,u.jsxs("div",{className:"approval-actions",children:[u.jsx("button",{className:"send",disabled:r||!s||o&&!c.trim(),onClick:()=>i(n,!0,o?c:void 0),children:o?"回答":"允许"}),u.jsx("button",{className:"stop",disabled:r||!s,onClick:()=>i(n,!1),children:"拒绝"})]})]})}function Gg(){return da()}const eN=()=>{},tN=async()=>{};function nN({session:n,hub:i=!1,onAuthLost:r=eN,onCheckAuth:s=tN}){const c=j.useRef(null),[d,o]=j.useState("connecting"),[g,p]=j.useState([]),m=j.useRef([]),[b,y]=j.useState(()=>OE(window.location.search)??Gg()),[v,S]=j.useState(qs()),[N,O]=j.useReducer(GE,{}),[z,D]=j.useState({}),[R,U]=j.useState(""),[F,ue]=j.useState([]),L=j.useRef(new VE),[le,oe]=j.useState(0),[W,T]=j.useState(null),q=W===b,[H,re]=j.useState(null),[me,te]=j.useState(null),[C,Y]=j.useState(""),[fe,be]=j.useState(Date.now()),[k,A]=j.useState(0),[X,E]=j.useState(null),[ee,ge]=j.useState(0),$=j.useRef(0),ae=j.useRef(b),ke=j.useRef(null),Q=j.useRef(new Map),Se=j.useRef(new Map),G=j.useRef(new Set),he=j.useRef(new Set),ze=j.useRef(new Set),Ce=j.useRef(!1),Oe=j.useRef(null),Qe=j.useRef(null),at=j.useCallback(J=>{if(oe(Be=>Be+1),ae.current!==J)return;const je=L.current.get(J);U(je.text),ue(je.files)},[]);j.useEffect(()=>{const J=new URL(window.location.href);J.searchParams.set("session",b),window.history.replaceState(window.history.state,"",J)},[b]);const zt=j.useCallback((J,je)=>{const Be=L.current.restore(J.draft);at(J.draft.sessionId),ae.current===J.draft.sessionId&&(S(we=>({...we,run:"error",items:we.items.filter(Ne=>Ne.kind!=="user"||Ne.clientMessageId!==J.clientMessageId)})),Be&&Y(`${je?`${je} `:"消息未送达。"}内容和附件已恢复,可以重试。`))},[at]),st=j.useCallback(J=>{Ce.current&&(J instanceof Xe&&J.status===401?r():Y(J instanceof Error?J.message:"操作失败,请重试。"))},[r]),dt=j.useCallback(async()=>{if(!i||!Ce.current)return;const J=++$.current;try{const je=await ty();Ce.current&&J===$.current&&E(je)}catch(je){Ce.current&&je instanceof Xe&&je.status===401&&r()}},[i,r]),jt=j.useCallback(async()=>{const J=c.current;if(J)try{const je=i?(await Vc()).sessions:(await J.listSessions()).data;if(c.current===J&&Ce.current){const Be=[...je].sort((we,Ne)=>(Ne.lastActiveAt??Ne.startedAt)-(we.lastActiveAt??we.startedAt));m.current=Be,p(Be)}}catch(je){st(je)}},[st,i]),tt=j.useCallback(async()=>{const J=c.current;if(J)for(const[je,Be]of Se.current)try{const we=await J.sessionDetail(je);if(!Ce.current||J!==c.current||Se.current.get(je)!==Be)continue;qg(we.data).chat.items.some(_=>_.kind==="user"&&_.clientMessageId===Be.clientMessageId)?Se.current.delete(je):we.data.running||(Se.current.delete(je),zt(Be))}catch(we){if(!Ce.current||J!==c.current||Se.current.get(je)!==Be)continue;we instanceof Yl&&we.kind==="response"&&we.code===-32001&&we.message===`Session not found: ${je}`&&(Se.current.delete(je),zt(Be))}},[zt]),Mt=j.useCallback(async J=>{const je=c.current;if(!je)return;const Be={sessionId:J,events:[]};Qe.current=Be;try{const we=await je.sessionDetail(J);if(!Ce.current||Qe.current!==Be||ae.current!==J)return;const Ne=Be.running??we.data.running;Ne?he.current.add(J):Ne===!1&&he.current.delete(J);const ye=qg(we.data,Be.events),_=ye.chat;ke.current=ye.cursor??null,te(ye.truncated?"这次运行的实时记录较长,已恢复已保存的内容;结束后重新打开可查看完整记录。":null),Ne||G.current.has(J)?_.run="running":Ne===!1&&(_.run==="running"||_.run==="waiting")&&(_.run="idle"),S(_)}catch(we){ae.current===J&&st(we)}finally{Qe.current===Be&&(Qe.current=null)}},[st]);j.useEffect(()=>{Ce.current=!0;const J=new IE(YE());c.current=J;const je=J.onAuthLost(r),Be=J.onStateChange(Ne=>{o(Ne),Ne==="open"?(re(null),Y(""),jt().then(()=>{const ye=ae.current;Ce.current&&c.current===J&&(m.current.some(_=>_.sessionId===ye)||he.current.has(ye)||G.current.has(ye)||Se.current.has(ye))&&Mt(ye)}),dt(),tt()):Ne==="closed"&&(i&&s(),S(ye=>({...ye,run:"idle"})))}),we=J.onNotification((Ne,ye)=>{if(Ne==="serve/sessionsChanged"){jt(),A(_=>_+1);return}if(Ne==="agent/runAccepted"&&typeof ye.sessionId=="string"){const _=Q.current.get(ye.sessionId);_&&(_.accepted=!0);return}if(Ne==="serve/configurationChanged"){dt(),ge(_=>_+1);return}if(Ne==="agent/streamEvent"){const _=ye,{sessionId:Ee,event:it}=_,en=Q.current.get(Ee);if(en&&["stream_request_start","text_delta","thinking_delta","tool_use_start"].includes(String(it.type))&&(en.accepted=!0),Ee===ae.current){if(Qe.current?.sessionId===Ee&&Qe.current.events.push(_),!ub(_,ke.current))return;_.hubEpoch&&_.hubSequence!==void 0&&(ke.current={epoch:_.hubEpoch,sequence:_.hubSequence}),S(Kn=>Xs(Kn,it))}it.type==="stream_request_start"&&re(null),it.type==="turn_complete"&&jt();return}if(Ne==="serve/sessionStatus"){A(it=>it+1);const{sessionId:_,running:Ee}=ye;if(typeof _!="string"||typeof Ee!="boolean")return;Qe.current?.sessionId===_&&(Qe.current.running=Ee),Ee?he.current.add(_):he.current.delete(_),!Ee&&Se.current.has(_)&&tt(),_===ae.current&&S(it=>Ee?{...it,run:"running"}:it.run==="running"||it.run==="waiting"?{...it,run:"idle"}:it),jt();return}if(Ne==="agent/approvalRequest"||Ne==="agent/approvalResolved"||Ne==="serve/approvalSnapshot"||Ne==="serve/approvalLease"){O({method:Ne,params:ye});return}if(Ne==="serve/workerExit"){he.current.clear();const _=ye.clean;re(_?"服务进程已退出,发送消息会自动重启":"服务进程异常退出,发送消息会自动重启"),S(Ee=>({...Ee,run:"idle"}))}});return J.connect(),()=>{Ce.current=!1,Oe.current?.abort(),Be(),we(),je(),J.close(),c.current=null}},[jt,Mt,dt,tt,r,s,i]);const ut=Object.values(N).some(J=>J.lease?.holderId&&(J.lease.expiresAt??0)>fe);j.useEffect(()=>{if(!ut)return;be(Date.now());const J=setInterval(()=>be(Date.now()),1e3);return()=>clearInterval(J)},[ut]);const Ft=async J=>{ae.current=J,ke.current=null,y(J),at(J),S(qs()),Y(""),te(null),!(!g.some(je=>je.sessionId===J)&&!he.current.has(J)&&L.current.unsent().some(je=>je.sessionId===J))&&await Mt(J)},ie=()=>{const J=Gg();ae.current=J,ke.current=null,Qe.current=null,y(J),at(J),S(qs()),Y(""),te(null)},pe=()=>{const J=L.current.get(ae.current),je=J.text.trim(),Be=c.current;if(!je&&!J.files.length||!Be||d!=="open"||q)return!1;const we=ae.current;if(G.current.has(we)||he.current.has(we)||v.run==="running"||v.run==="waiting"||Object.values(N).some(_=>_.payload.sessionId===we)||Se.current.has(we))return!1;ae.current=we,y(we),G.current.add(we);const Ne={clientMessageId:da(),draft:L.current.take(we),accepted:!1};Q.current.set(we,Ne);const ye=Ne.draft.draft.files;return at(we),Y(""),S(_=>({...zE(_,je,ye.map(Ee=>({name:Ee.name,mime:Ee.mimeType,size:Ee.size})),Ne.clientMessageId),run:"running"})),Be.run({sessionId:we,task:je,clientMessageId:Ne.clientMessageId,displayText:je,...ye.length?{uploadIds:ye.map(_=>_.id)}:{}}).catch(_=>{Ce.current&&(st(_),_ instanceof Yl&&(_.kind==="transport"||_.kind==="timeout")?(Se.current.set(we,Ne),Y("连接中断,重新连接后会核对这条消息是否已经送达。")):Ne.accepted||zt(Ne,_ instanceof Error?_.message==="upload not found or expired"?"附件已失效,请移除后重新上传。":_.message:void 0),ae.current===we&&S(Ee=>({...Ee,run:"error"})))}).finally(()=>{G.current.delete(we),Q.current.get(we)===Ne&&Q.current.delete(we),Ce.current&&ae.current===we&&!he.current.has(we)&&S(_=>_.run==="running"?{..._,run:"idle"}:_)}),!0},De=(J,je,Be)=>{const we=c.current;!we||d!=="open"||ze.current.has(J.requestId)||(ze.current.add(J.requestId),D(Ne=>({...Ne,[J.requestId]:!0})),Y(""),we.approve({...J,sessionId:J.sessionId??ae.current??""},je,Be).then(()=>O({method:"agent/approvalResolved",params:{requestId:J.requestId}})).catch(st).finally(()=>{ze.current.delete(J.requestId),D(Ne=>{const ye={...Ne};return delete ye[J.requestId],ye})}))},_e=()=>{b&&c.current?.cancel(b).catch(st)},qe=async J=>{if(!J?.length||Oe.current)return;const je=new AbortController,Be=Zg();Oe.current=je,T(ae.current),Y("");const we=ae.current;try{for(const Ne of Array.from(J)){if(!Ce.current||je.signal.aborted)break;const ye=await Rv(Ne,{signal:je.signal,scope:Be});Ce.current&&!je.signal.aborted&&(L.current.addFile(we,ye),at(we))}}catch(Ne){st(Ne)}finally{Oe.current===je&&(Oe.current=null),Ce.current&&T(null)}},kt=Object.values(N).filter(J=>!J.payload.sessionId||J.payload.sessionId===b),wt=J=>Object.values(N).filter(je=>je.payload.sessionId===J).length,Nt=v.run==="running"||v.run==="waiting"||kt.length>0,ot=j.useMemo(()=>L.current.unsent().filter(J=>!g.some(je=>je.sessionId===J.sessionId)),[le,g]),ht=X?.workspace.path??g.find(J=>J.sessionId===b)?.cwd??g[0]?.cwd??null,$e=ht?.split(/[\\/]/).filter(Boolean).pop()??"服务端工作区",I=v.items.length===0&&kt.length===0,xe=g.find(J=>J.sessionId===b),Ae=I?"新对话":xe?.customTitle||v.title||xe?.title||xe?.preview?.trim()||ob(v,b??"新对话");return{host:i?"hub":"legacy",workspaceApi:i,connection:d,session:n,activeId:b,chat:v,sessions:g,workspaceCwd:ht,workspaceName:$e,title:Ae,workspaceKey:ht??"hub",configuration:X,configurationVersion:ee,sessionsVersion:k,draft:R,files:F,uploading:q,uploadBusy:W!==null,hasUnsent:L.current.unsent().length>0,localDrafts:ot,uncertain:Se.current.has(b),running:Nt,approvals:Object.values(N).map(J=>({id:J.payload.requestId,sessionId:J.payload.sessionId})),approvalCount:wt,approvalContent:kt.map(J=>u.jsx(WE,{payload:J.payload,onDecide:De,busy:!!z[J.payload.requestId]||!!(J.lease?.holderId&&(J.lease.expiresAt??0)>fe),connected:d==="open"},J.payload.requestId)),workerNote:H,replayNote:me,error:C,clearError:()=>Y(""),setDraft:J=>{L.current.setText(ae.current,J),at(ae.current)},removeFile:J=>{L.current.removeFile(ae.current,J),at(ae.current)},selectSession:Ft,newSession:ie,send:pe,stop:_e,addFiles:qe,refreshSessions:jt,refreshConfiguration:dt,onAuthLost:r}}function Vg({onBackToProjects:n,projectName:i,...r}){return u.jsx(LE,{controller:nN(r),onBackToProjects:n,projectName:i})}function cb(n){if(!n||typeof n!="object")return!1;const i=n;return sa(i.id)&&typeof i.name=="string"&&i.name.length>0&&["stopped","starting","running","stopping","error"].includes(i.status)&&Number.isSafeInteger(i.generation)&&i.generation>=0&&Number.isSafeInteger(i.createdAt)&&i.createdAt>=0&&(i.error===void 0||typeof i.error=="string")}function lN(n){const i=n;if(!i||i.runtime!=="docker"||typeof i.available!="boolean"||!Array.isArray(i.projects)||!i.projects.every(cb)||new Set(i.projects.map(r=>r.id)).size!==i.projects.length||i.error!==void 0&&typeof i.error!="string")throw new Error("服务端返回了无效的项目列表,请重试。");return i}function Qg(){return new URL(window.location.href).searchParams.get("project")}function la(n,i=!1){const r=new URL(window.location.href);n?r.searchParams.set("project",n):r.searchParams.delete("project"),i||r.searchParams.delete("session"),window.history.replaceState(window.history.state,"",r)}const iN={stopped:"已停止",starting:"正在启动",running:"运行中",stopping:"正在停止",error:"启动失败"};function rN({children:n,onAuthLost:i}){const[r,s]=j.useState(null),[c,d]=j.useState(!1),[o,g]=j.useState(null),[p,m]=j.useState(""),[b,y]=j.useState(!0),[v,S]=j.useState(null),[N,O]=j.useState(""),[z,D]=j.useState(null),R=j.useRef(null),U=j.useRef(Qg()),F=j.useRef(o),ue=j.useRef(r),L=j.useRef(0),le=j.useRef(0),oe=j.useRef(null),W=j.useRef(i),T=j.useRef(!1);W.current=i,F.current=o,ue.current=r;const q=j.useCallback(C=>{if(C.status!=="running")return;const Y=Qg()===C.id;As(),Ts(C.id),la(C.id,Y),U.current=null,F.current=C,g(C),m("")},[]),H=j.useCallback(()=>{U.current=null,F.current=null,g(null),Ts(null),As(),la(null)},[]),re=j.useCallback(async C=>{if(T.current)return;const Y=++le.current,fe=L.current;try{const be=lN(await Ie("/api/v1/projects",{signal:C}));if(C?.aborted||Y!==le.current||fe!==L.current)return;s(be),ue.current=be,y(!1),m("");const k=F.current;if(k){const X=be.projects.find(E=>E.id===k.id);(!X||X.status!=="running"||X.generation!==k.generation)&&(H(),m("项目运行状态已经变化,请重新打开项目。未发送的内容不会带入其他项目。"));return}if(!U.current)return;const A=be.projects.find(X=>X.id===U.current);A?A.status==="running"&&be.available&&q(A):(U.current=null,la(null),m("链接中的项目不存在或当前账号无权访问,请选择一个项目。"))}catch(be){if(C?.aborted||Y!==le.current||fe!==L.current)return;y(!1),be instanceof Xe&&be.status===404&&!ue.current?(Ts(null),As(),T.current=!0,d(!0)):be instanceof Xe&&be.status===401?W.current():m(be instanceof Error?be.message:"无法读取项目,请重试。")}},[H,q]);j.useEffect(()=>{L.current++;const C=new AbortController;re(C.signal);const Y=()=>{re(C.signal)},fe=()=>{document.visibilityState==="visible"&&Y()};return window.addEventListener("focus",Y),document.addEventListener("visibilitychange",fe),()=>{L.current++,C.abort(),oe.current?.abort(),window.removeEventListener("focus",Y),document.removeEventListener("visibilitychange",fe),Ts(null),As()}},[re]);const me=r?.projects.some(C=>C.status==="starting"||C.status==="stopping");j.useEffect(()=>{if(c||!r)return;const C=new AbortController,Y=setInterval(()=>{re(C.signal)},me?2e3:1e4);return()=>{clearInterval(Y),C.abort()}},[c,!!r,me,re]),j.useEffect(()=>{if(!z)return;const C=document.activeElement,Y=R.current;return Y?.showModal?.(),()=>{Y?.close?.(),C?.focus()}},[z]);const te=async(C,Y)=>{if(oe.current||C==="create"&&!N.trim())return;const fe=new AbortController;oe.current=fe,S(Y?.id??"create"),m(""),le.current++;try{const be=await Ie(C==="create"?"/api/v1/projects":`/api/v1/projects/${Y.id}/${C}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C==="create"?{name:N.trim()}:{}),signal:fe.signal});if(fe.signal.aborted)return;if(!cb(be.project)||Y&&Y.id!==be.project.id)throw new Error("服务端返回了无效的项目状态,请刷新列表。");const k=be.project;s(A=>A&&{...A,projects:A.projects.some(X=>X.id===k.id)?A.projects.map(X=>X.id===k.id?k:X):[...A.projects,k]}),C==="create"&&O(""),C==="start"&&(U.current=k.id,la(k.id),k.status==="running"&&q(k)),C==="stop"&&(U.current===k.id&&(U.current=null,la(null)),D(null)),await re(fe.signal)}catch(be){if(fe.signal.aborted)return;be instanceof Xe&&be.status===401?W.current():m(be instanceof Error?be.message:"项目操作失败,请重试。")}finally{oe.current===fe&&(oe.current=null),fe.signal.aborted||S(null)}};return c?u.jsx(j.Fragment,{children:n(null)},"single-project"):o?u.jsxs(j.Fragment,{children:[p?u.jsxs("div",{className:"project-connection-note",role:"status",children:["项目状态暂时无法刷新,当前工作台会保留。",p]}):null,n(o,H)]},`${o.id}:${o.generation}`):u.jsxs("main",{className:"projects-page",children:[u.jsxs("header",{className:"projects-header",children:[u.jsxs("div",{className:"auth-brand",children:["CodeShell ",u.jsx("span",{children:"Hub"})]}),u.jsx(hf,{}),u.jsx("h1",{children:"你的项目"}),u.jsx("p",{children:"每个项目有独立的运行环境、文件、会话和配置。启动后进入同一个工作台。"})]}),b?u.jsx("p",{role:"status",children:"正在读取项目…"}):null,p?u.jsxs("div",{className:"form-error",role:"alert",children:[p,u.jsx("button",{className:"library-button",onClick:()=>{re()},children:"刷新项目"})]}):null,r?u.jsxs(u.Fragment,{children:[r.available?null:u.jsxs("p",{className:"form-error",role:"alert",children:["项目运行环境暂不可用。",r.error||"请检查服务端 Docker 是否已启动。"]}),u.jsxs("form",{className:"project-create",onSubmit:C=>{C.preventDefault(),te("create")},children:[u.jsxs("label",{children:["新项目名称",u.jsx("input",{value:N,maxLength:80,required:!0,placeholder:"例如:个人网站",onChange:C=>O(C.target.value)})]}),u.jsx("button",{className:"library-button primary",disabled:!!v||!N.trim(),type:"submit",children:v==="create"?"正在创建…":"创建项目"})]}),u.jsxs("section",{className:"projects-grid","aria-label":"项目列表",children:[r.projects.length===0?u.jsx("p",{className:"project-empty",children:"创建第一个项目,开始配置模型、添加技能和使用面板。"}):null,r.projects.map(C=>u.jsxs("article",{className:"project-card",children:[u.jsxs("div",{className:"project-card-heading",children:[u.jsx("h2",{children:C.name}),u.jsx("span",{className:`project-status ${C.status}`,children:iN[C.status]})]}),u.jsxs("p",{className:"project-date",children:["创建于 ",new Date(C.createdAt).toLocaleDateString()]}),C.error?u.jsx("p",{className:"form-error",role:"alert",children:C.error}):null,u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button primary",disabled:!!v||!r.available||C.status==="starting"||C.status==="stopping",onClick:()=>C.status==="running"?q(C):void te("start",C),children:v===C.id||C.status==="starting"||C.status==="stopping"?"正在处理…":C.status==="running"?"打开项目":"启动并打开"}),C.status==="running"?u.jsx("button",{className:"library-button",disabled:!!v,onClick:()=>D(C),children:"停止项目"}):null]})]},C.id))]})]}):null,z?u.jsxs("dialog",{className:"project-stop-confirm",ref:R,role:"alertdialog","aria-modal":"true","aria-labelledby":"project-stop-title",onCancel:C=>{C.preventDefault(),v||D(null)},children:[u.jsxs("h2",{id:"project-stop-title",children:["停止 ",z.name,"?"]}),u.jsx("p",{children:"正在运行的任务和面板进程会中断。项目文件和配置保留,可稍后重新启动。"}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button primary",disabled:!!v,onClick:()=>D(null),children:"继续运行"}),u.jsx("button",{className:"library-button",disabled:!!v,onClick:()=>{te("stop",z)},children:"确认停止"})]})]}):null]})}function aN({setupToken:n}){const[i,r]=j.useState("checking"),[s,c]=j.useState(),[d,o]=j.useState(""),[g,p]=j.useState(""),[m,b]=j.useState(""),[y,v]=j.useState(n),[S,N]=j.useState(""),[O,z]=j.useState(!1),D=j.useRef(!1),R=j.useRef(0),U=j.useRef(i);U.current=i;const F=j.useCallback(oe=>{D.current&&(c(oe?.session),r(oe===null?"legacy":oe.initialized?oe.authenticated?"authenticated":"login":"setup"),N(""),oe?.initialized&&v(""))},[]),ue=j.useCallback(async()=>{const oe=++R.current;try{const W=await Av();oe===R.current&&F(W)}catch(W){if(!D.current||oe!==R.current||U.current==="authenticated"||U.current==="legacy")return;r("error"),N(W instanceof Error?W.message:"无法连接服务端")}},[F]);j.useEffect(()=>{D.current=!0,ue();const oe=()=>{ue()},W=()=>{document.visibilityState==="visible"&&ue()};return window.addEventListener("focus",oe),document.addEventListener("visibilitychange",W),()=>{D.current=!1,window.removeEventListener("focus",oe),document.removeEventListener("visibilitychange",W)}},[ue]);const L=j.useCallback(()=>{R.current++,c(void 0),r("login"),p(""),N("登录已过期或此设备已被撤销,请重新登录。")},[]),le=async oe=>{if(oe.preventDefault(),!O){R.current++,z(!0),N("");try{const W=await Fg(`/api/v1/auth/${i==="setup"?"setup":"login"}`,{username:d.trim(),password:g,deviceName:m.trim()||void 0,...i==="setup"?{token:y.trim()}:{}});if(!W.authenticated)throw new Error("登录失败,请重试。");R.current++,p(""),v(""),F({initialized:!0,authenticated:!0,session:W.session})}catch(W){N(W instanceof Error?W.message:"登录失败,请重试。"),W instanceof Xe&&W.status===409&&ue()}finally{z(!1)}}};return i==="authenticated"?u.jsx(rN,{onAuthLost:L,children:(oe,W)=>u.jsx(Vg,{session:s,hub:!0,onAuthLost:L,onCheckAuth:ue,projectName:oe?.name,onBackToProjects:W})}):i==="legacy"?u.jsx(Vg,{session:s,hub:!1,onAuthLost:L,onCheckAuth:ue}):u.jsx("main",{className:"auth-page",children:u.jsxs("section",{className:"auth-card",children:[u.jsx(hf,{discover:!1}),u.jsxs("div",{className:"auth-brand",children:["CodeShell ",u.jsx("span",{children:"Hub"})]}),i==="checking"?u.jsx("p",{role:"status",children:"正在连接你的工作空间…"}):null,i==="error"?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"form-error",role:"alert",children:S}),u.jsx("button",{className:"send",onClick:()=>{ue()},children:"重试连接"})]}):null,i==="setup"||i==="login"?u.jsxs("form",{onSubmit:oe=>{le(oe)},children:[u.jsx("h1",{children:i==="setup"?"创建管理员账号":"登录工作空间"}),u.jsx("p",{children:i==="setup"?"首次启动需要服务端提供的初始化令牌。创建后,可在其他设备使用此账号登录。":"连接服务端,继续你的会话与任务。"}),i==="setup"?u.jsxs("label",{children:["初始化令牌",u.jsx("input",{type:"password",autoComplete:"off",required:!0,value:y,onChange:oe=>v(oe.target.value)})]}):null,u.jsxs("label",{children:["用户名",u.jsx("input",{autoComplete:"username",required:!0,maxLength:64,value:d,onChange:oe=>o(oe.target.value)})]}),u.jsxs("label",{children:["密码",u.jsx("input",{type:"password",autoComplete:i==="setup"?"new-password":"current-password",required:!0,maxLength:256,minLength:i==="setup"?12:void 0,value:g,onChange:oe=>p(oe.target.value)})]}),i==="setup"?u.jsx("small",{children:"密码至少 12 个字符。"}):null,u.jsxs("label",{children:["设备名称 ",u.jsx("span",{children:"(可选)"}),u.jsx("input",{autoComplete:"off",maxLength:100,placeholder:"例如:我的笔记本",value:m,onChange:oe=>b(oe.target.value)})]}),S?u.jsx("p",{className:"form-error",role:"alert",children:S}):null,u.jsx("button",{className:"send",type:"submit",disabled:O,children:O?"正在连接…":i==="setup"?"创建并进入":"登录"})]}):null]})})}function sN(n="/"){"serviceWorker"in navigator&&window.isSecureContext&&navigator.serviceWorker.register(`${n}sw.js`).catch(()=>{})}const Xg=Uv(),uN=zv(window.location,window.history);Vv.createRoot(document.getElementById("root")).render(u.jsx(j.StrictMode,{children:Xg?u.jsx(Bv,{callback:Xg}):u.jsx(aN,{setupToken:uN})}));sN("/");
|