@tea-agent/loop-agent 0.35.0 → 0.35.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +108 -108
- package/CHANGELOG.md +30 -0
- package/README.md +165 -165
- package/bin/agent-worker.js +0 -0
- package/bin/loop-agent.js +21 -21
- package/dist/application/task-lifecycle/advance.js +1 -0
- package/dist/commands/cursor-prompt.js +6 -6
- package/dist/commands/init-upgrade.js +351 -19
- package/dist/commands/init.js +14 -67
- package/dist/commands/loop-benchmark.js +11 -11
- package/dist/commands/pi-reuse-benchmark.js +16 -16
- package/dist/commands/run-dag-progress.js +14 -0
- package/dist/commands/task-advance.js +33 -3
- package/dist/shared/operator/capabilities.js +38 -1
- package/dist/sidecars/cursor-prompt/executor.js +1 -1
- package/dist/worker/console/chat/pi-runtime.js +41 -25
- package/dist/worker/console/chat/routes.js +27 -4
- package/dist/worker/console/operation-runner.js +24 -0
- package/dist/worker/console/operation-wait.js +241 -0
- package/dist/worker/console/operator-actions.js +58 -0
- package/dist/worker/console/static/assets/{index-hJqCPs_g.css → index-Dups4sSM.css} +1 -1
- package/dist/worker/console/static/assets/index-SjjjZnV3.js +56 -0
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/operator-chat/slash-palette-nav.js +141 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +13 -2
- package/dist/worker/console/static-src/operator-chat/useComposer.js +30 -7
- package/dist/worker/observe/static/copy.js +67 -67
- package/dist/worker/observe/static/dag-layout.d.ts +36 -36
- package/dist/worker/observe/static/dom.js +220 -220
- package/dist/worker/observe/static/relations.js +133 -133
- package/dist/worker/observe/static/run-processing.js +148 -148
- package/dist/worker/observe/static/views/batch.js +227 -227
- package/dist/worker/observe/static/views/failures.js +143 -143
- package/dist/worker/observe/static/views/feature.js +492 -492
- package/dist/worker/observe/static/views/run.js +453 -453
- package/dist/worker/observe/static/views/shell.js +7 -7
- package/dist/worker/observe/static/views/timeline.js +163 -163
- package/dist/workflows/dag/canvas-observer.js +275 -275
- package/docs/architecture/evolution.md +73 -73
- package/docs/architecture/system-overview.md +100 -100
- package/docs/architecture/worker-and-feature.md +122 -122
- package/docs/skills/README.md +7 -7
- package/docs/templates/adr.md +60 -60
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
- package/docs/templates/agent-dag-report.schema.json +473 -473
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
- package/docs/templates/backend-test-result.schema.json +99 -99
- package/docs/templates/evaluation/agents-map-slim-v1.md +87 -87
- package/docs/templates/evaluation/agents-map-verbose-v0.md +153 -153
- package/docs/templates/feature-spec.md +53 -53
- package/docs/templates/frontend-design-contract.md +42 -42
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -17
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -21
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -27
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -27
- package/docs/templates/frontend-eval/metrics.md +138 -138
- package/docs/templates/frontend-eval/smoke-targets.md +53 -53
- package/docs/templates/frontend-task-constraints.md +35 -35
- package/docs/templates/frontend-task-requirement.md +70 -70
- package/docs/templates/init-evolution-review.md +35 -35
- package/docs/templates/init-managed-agents.md +156 -154
- package/docs/templates/interactive-ui-round2-experiment.md +66 -66
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -118
- package/docs/templates/knowledge-sync-dag.json +178 -178
- package/docs/templates/knowledge-sync-draft.schema.json +71 -71
- package/docs/templates/product-line/closeout.yaml +9 -9
- package/docs/templates/product-line/design.md +13 -13
- package/docs/templates/product-line/links.md +10 -10
- package/docs/templates/product-line/requirement.md +17 -17
- package/docs/templates/product-line/test-plan.md +7 -7
- package/docs/templates/project-start-checklist.md +9 -9
- package/docs/templates/qa-report.md +48 -48
- package/docs/templates/sprint-contract.md +29 -29
- package/docs/templates/worker-dogfood-evidence.md +80 -80
- package/docs/templates/worker-dogfood-setup.md +68 -68
- package/harness.json +5 -2
- package/package.json +1 -1
- package/scripts/kb-bootstrap-init-skeleton.sh +0 -0
- package/scripts/kb-graph-incremental-prepare.mjs +0 -0
- package/scripts/kb-graph-materialize.mjs +105 -105
- package/scripts/kb-graph-promote.mjs +164 -164
- package/scripts/kb-query.mjs +554 -554
- package/skills/agent-worker/SKILL.md +48 -48
- package/skills/agent-worker/references/agent-worker-operator.md +159 -159
- package/skills/ai-engineering-context/SKILL.md +48 -48
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +0 -0
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +0 -0
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +0 -0
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +0 -0
- package/skills/analyze-product-requirements/scripts/compute-source-identity.mjs +0 -0
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +0 -0
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +0 -0
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +0 -0
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +0 -0
- package/skills/browser-tools/browser-content.js +103 -103
- package/skills/browser-tools/browser-cookies.js +35 -35
- package/skills/browser-tools/browser-eval.js +53 -53
- package/skills/browser-tools/browser-hn-scraper.js +108 -108
- package/skills/browser-tools/browser-nav.js +44 -44
- package/skills/browser-tools/browser-pick.js +162 -162
- package/skills/browser-tools/browser-screenshot.js +34 -34
- package/skills/browser-tools/browser-start.js +86 -86
- package/skills/browser-tools/package-lock.json +2556 -2556
- package/skills/browser-tools/package.json +19 -19
- package/skills/code-review-core/SKILL.md +20 -20
- package/skills/codebase-scout/SKILL.md +19 -19
- package/skills/grill-me/SKILL.md +10 -10
- package/skills/local-jacoco-coverage/scripts/run-coverage-analysis.sh +0 -0
- package/skills/local-jacoco-coverage/scripts/start-jacoco-agent.sh +0 -0
- package/skills/loop-agent/SKILL.md +1 -0
- package/skills/loop-agent/references/command-reference.md +641 -639
- package/skills/loop-agent/references/docs-converge.md +126 -126
- package/skills/loop-agent/references/learned/README.md +21 -21
- package/skills/loop-agent/references/pi-prompt.md +23 -23
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -84
- package/skills/playwright-cli/references/element-attributes.md +23 -23
- package/skills/playwright-cli/references/playwright-tests.md +39 -39
- package/skills/playwright-cli/references/request-mocking.md +87 -87
- package/skills/playwright-cli/references/running-code.md +241 -241
- package/skills/playwright-cli/references/session-management.md +225 -225
- package/skills/playwright-cli/references/storage-state.md +275 -275
- package/skills/playwright-cli/references/test-generation.md +433 -433
- package/skills/requesting-code-review/SKILL.md +101 -101
- package/skills/requesting-code-review/code-reviewer.md +168 -168
- package/skills/systematic-debugging/CREATION-LOG.md +119 -119
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
- package/skills/systematic-debugging/condition-based-waiting.md +115 -115
- package/skills/systematic-debugging/defense-in-depth.md +122 -122
- package/skills/systematic-debugging/find-polluter.sh +63 -63
- package/skills/systematic-debugging/root-cause-tracing.md +169 -169
- package/skills/systematic-debugging/test-academic.md +14 -14
- package/skills/systematic-debugging/test-pressure-1.md +58 -58
- package/skills/systematic-debugging/test-pressure-2.md +68 -68
- package/skills/systematic-debugging/test-pressure-3.md +69 -69
- package/skills/using-git-worktrees/SKILL.md +215 -215
- package/skills/verification-before-completion/SKILL.md +154 -154
- package/skills/webapp-testing/SKILL.md +19 -19
- package/dist/worker/console/static/assets/index-fsjzREob.js +0 -56
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function i(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(o){if(o.ep)return;o.ep=!0;const d=i(o);fetch(o.href,d)}})();function ld(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hc={exports:{}},Ya={};var Np;function i1(){if(Np)return Ya;Np=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(l,o,d){var u=null;if(d!==void 0&&(u=""+d),o.key!==void 0&&(u=""+o.key),"key"in o){d={};for(var h in o)h!=="key"&&(d[h]=o[h])}else d=o;return o=d.ref,{$$typeof:t,type:l,key:u,ref:o!==void 0?o:null,props:d}}return Ya.Fragment=r,Ya.jsx=i,Ya.jsxs=i,Ya}var Ap;function a1(){return Ap||(Ap=1,hc.exports=i1()),hc.exports}var c=a1(),mc={exports:{}},Ae={};var Ip;function l1(){if(Ip)return Ae;Ip=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),S=Symbol.iterator;function x(R){return R===null||typeof R!="object"?null:(R=S&&R[S]||R["@@iterator"],typeof R=="function"?R:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,M={};function O(R,z,C){this.props=R,this.context=z,this.refs=M,this.updater=C||w}O.prototype.isReactComponent={},O.prototype.setState=function(R,z){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,z,"setState")},O.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function E(){}E.prototype=O.prototype;function D(R,z,C){this.props=R,this.context=z,this.refs=M,this.updater=C||w}var G=D.prototype=new E;G.constructor=D,A(G,O.prototype),G.isPureReactComponent=!0;var K=Array.isArray;function N(){}var $={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function ce(R,z,C){var ie=C.ref;return{$$typeof:t,type:R,key:z,ref:ie!==void 0?ie:null,props:C}}function _(R,z){return ce(R.type,z,R.props)}function F(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Y(R){var z={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(C){return z[C]})}var oe=/\/+/g;function X(R,z){return typeof R=="object"&&R!==null&&R.key!=null?Y(""+R.key):z.toString(36)}function B(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(N,N):(R.status="pending",R.then(function(z){R.status==="pending"&&(R.status="fulfilled",R.value=z)},function(z){R.status==="pending"&&(R.status="rejected",R.reason=z)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function I(R,z,C,ie,fe){var V=typeof R;(V==="undefined"||V==="boolean")&&(R=null);var ae=!1;if(R===null)ae=!0;else switch(V){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(R.$$typeof){case t:case r:ae=!0;break;case v:return ae=R._init,I(ae(R._payload),z,C,ie,fe)}}if(ae)return fe=fe(R),ae=ie===""?"."+X(R,0):ie,K(fe)?(C="",ae!=null&&(C=ae.replace(oe,"$&/")+"/"),I(fe,z,C,"",function(ye){return ye})):fe!=null&&(F(fe)&&(fe=_(fe,C+(fe.key==null||R&&R.key===fe.key?"":(""+fe.key).replace(oe,"$&/")+"/")+ae)),z.push(fe)),1;ae=0;var he=ie===""?".":ie+":";if(K(R))for(var me=0;me<R.length;me++)ie=R[me],V=he+X(ie,me),ae+=I(ie,z,C,V,fe);else if(me=x(R),typeof me=="function")for(R=me.call(R),me=0;!(ie=R.next()).done;)ie=ie.value,V=he+X(ie,me++),ae+=I(ie,z,C,V,fe);else if(V==="object"){if(typeof R.then=="function")return I(B(R),z,C,ie,fe);throw z=String(R),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return ae}function H(R,z,C){if(R==null)return R;var ie=[],fe=0;return I(R,ie,"","",function(V){return z.call(C,V,fe++)}),ie}function U(R){if(R._status===-1){var z=R._result;z=z(),z.then(function(C){(R._status===0||R._status===-1)&&(R._status=1,R._result=C)},function(C){(R._status===0||R._status===-1)&&(R._status=2,R._result=C)}),R._status===-1&&(R._status=0,R._result=z)}if(R._status===1)return R._result.default;throw R._result}var re=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},T={map:H,forEach:function(R,z,C){H(R,function(){z.apply(this,arguments)},C)},count:function(R){var z=0;return H(R,function(){z++}),z},toArray:function(R){return H(R,function(z){return z})||[]},only:function(R){if(!F(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ae.Activity=y,Ae.Children=T,Ae.Component=O,Ae.Fragment=i,Ae.Profiler=o,Ae.PureComponent=D,Ae.StrictMode=l,Ae.Suspense=g,Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Ae.__COMPILER_RUNTIME={__proto__:null,c:function(R){return $.H.useMemoCache(R)}},Ae.cache=function(R){return function(){return R.apply(null,arguments)}},Ae.cacheSignal=function(){return null},Ae.cloneElement=function(R,z,C){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ie=A({},R.props),fe=R.key;if(z!=null)for(V in z.key!==void 0&&(fe=""+z.key),z)!ne.call(z,V)||V==="key"||V==="__self"||V==="__source"||V==="ref"&&z.ref===void 0||(ie[V]=z[V]);var V=arguments.length-2;if(V===1)ie.children=C;else if(1<V){for(var ae=Array(V),he=0;he<V;he++)ae[he]=arguments[he+2];ie.children=ae}return ce(R.type,fe,ie)},Ae.createContext=function(R){return R={$$typeof:u,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:d,_context:R},R},Ae.createElement=function(R,z,C){var ie,fe={},V=null;if(z!=null)for(ie in z.key!==void 0&&(V=""+z.key),z)ne.call(z,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(fe[ie]=z[ie]);var ae=arguments.length-2;if(ae===1)fe.children=C;else if(1<ae){for(var he=Array(ae),me=0;me<ae;me++)he[me]=arguments[me+2];fe.children=he}if(R&&R.defaultProps)for(ie in ae=R.defaultProps,ae)fe[ie]===void 0&&(fe[ie]=ae[ie]);return ce(R,V,fe)},Ae.createRef=function(){return{current:null}},Ae.forwardRef=function(R){return{$$typeof:h,render:R}},Ae.isValidElement=F,Ae.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:U}},Ae.memo=function(R,z){return{$$typeof:p,type:R,compare:z===void 0?null:z}},Ae.startTransition=function(R){var z=$.T,C={};$.T=C;try{var ie=R(),fe=$.S;fe!==null&&fe(C,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(N,re)}catch(V){re(V)}finally{z!==null&&C.types!==null&&(z.types=C.types),$.T=z}},Ae.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ae.use=function(R){return $.H.use(R)},Ae.useActionState=function(R,z,C){return $.H.useActionState(R,z,C)},Ae.useCallback=function(R,z){return $.H.useCallback(R,z)},Ae.useContext=function(R){return $.H.useContext(R)},Ae.useDebugValue=function(){},Ae.useDeferredValue=function(R,z){return $.H.useDeferredValue(R,z)},Ae.useEffect=function(R,z){return $.H.useEffect(R,z)},Ae.useEffectEvent=function(R){return $.H.useEffectEvent(R)},Ae.useId=function(){return $.H.useId()},Ae.useImperativeHandle=function(R,z,C){return $.H.useImperativeHandle(R,z,C)},Ae.useInsertionEffect=function(R,z){return $.H.useInsertionEffect(R,z)},Ae.useLayoutEffect=function(R,z){return $.H.useLayoutEffect(R,z)},Ae.useMemo=function(R,z){return $.H.useMemo(R,z)},Ae.useOptimistic=function(R,z){return $.H.useOptimistic(R,z)},Ae.useReducer=function(R,z,C){return $.H.useReducer(R,z,C)},Ae.useRef=function(R){return $.H.useRef(R)},Ae.useState=function(R){return $.H.useState(R)},Ae.useSyncExternalStore=function(R,z,C){return $.H.useSyncExternalStore(R,z,C)},Ae.useTransition=function(){return $.H.useTransition()},Ae.version="19.2.8",Ae}var Dp;function sd(){return Dp||(Dp=1,mc.exports=l1()),mc.exports}var k=sd();const Ar=ld(k);var pc={exports:{}},Ka={},gc={exports:{}},yc={};var Op;function s1(){return Op||(Op=1,(function(t){function r(I,H){var U=I.length;I.push(H);e:for(;0<U;){var re=U-1>>>1,T=I[re];if(0<o(T,H))I[re]=H,I[U]=T,U=re;else break e}}function i(I){return I.length===0?null:I[0]}function l(I){if(I.length===0)return null;var H=I[0],U=I.pop();if(U!==H){I[0]=U;e:for(var re=0,T=I.length,R=T>>>1;re<R;){var z=2*(re+1)-1,C=I[z],ie=z+1,fe=I[ie];if(0>o(C,U))ie<T&&0>o(fe,C)?(I[re]=fe,I[ie]=U,re=ie):(I[re]=C,I[z]=U,re=z);else if(ie<T&&0>o(fe,U))I[re]=fe,I[ie]=U,re=ie;else break e}}return H}function o(I,H){var U=I.sortIndex-H.sortIndex;return U!==0?U:I.id-H.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,h=u.now();t.unstable_now=function(){return u.now()-h}}var g=[],p=[],v=1,y=null,S=3,x=!1,w=!1,A=!1,M=!1,O=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function G(I){for(var H=i(p);H!==null;){if(H.callback===null)l(p);else if(H.startTime<=I)l(p),H.sortIndex=H.expirationTime,r(g,H);else break;H=i(p)}}function K(I){if(A=!1,G(I),!w)if(i(g)!==null)w=!0,N||(N=!0,Y());else{var H=i(p);H!==null&&B(K,H.startTime-I)}}var N=!1,$=-1,ne=5,ce=-1;function _(){return M?!0:!(t.unstable_now()-ce<ne)}function F(){if(M=!1,N){var I=t.unstable_now();ce=I;var H=!0;try{e:{w=!1,A&&(A=!1,E($),$=-1),x=!0;var U=S;try{t:{for(G(I),y=i(g);y!==null&&!(y.expirationTime>I&&_());){var re=y.callback;if(typeof re=="function"){y.callback=null,S=y.priorityLevel;var T=re(y.expirationTime<=I);if(I=t.unstable_now(),typeof T=="function"){y.callback=T,G(I),H=!0;break t}y===i(g)&&l(g),G(I)}else l(g);y=i(g)}if(y!==null)H=!0;else{var R=i(p);R!==null&&B(K,R.startTime-I),H=!1}}break e}finally{y=null,S=U,x=!1}H=void 0}}finally{H?Y():N=!1}}}var Y;if(typeof D=="function")Y=function(){D(F)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,X=oe.port2;oe.port1.onmessage=F,Y=function(){X.postMessage(null)}}else Y=function(){O(F,0)};function B(I,H){$=O(function(){I(t.unstable_now())},H)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(I){I.callback=null},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ne=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return S},t.unstable_next=function(I){switch(S){case 1:case 2:case 3:var H=3;break;default:H=S}var U=S;S=H;try{return I()}finally{S=U}},t.unstable_requestPaint=function(){M=!0},t.unstable_runWithPriority=function(I,H){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var U=S;S=I;try{return H()}finally{S=U}},t.unstable_scheduleCallback=function(I,H,U){var re=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?re+U:re):U=re,I){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=U+T,I={id:v++,callback:H,priorityLevel:I,startTime:U,expirationTime:T,sortIndex:-1},U>re?(I.sortIndex=U,r(p,I),i(g)===null&&I===i(p)&&(A?(E($),$=-1):A=!0,B(K,U-re))):(I.sortIndex=T,r(g,I),w||x||(w=!0,N||(N=!0,Y()))),I},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(I){var H=S;return function(){var U=S;S=H;try{return I.apply(this,arguments)}finally{S=U}}}})(yc)),yc}var Mp;function o1(){return Mp||(Mp=1,gc.exports=s1()),gc.exports}var vc={exports:{}},_t={};var zp;function u1(){if(zp)return _t;zp=1;var t=sd();function r(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var l={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function d(g,p,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:g,containerInfo:p,implementation:v}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return _t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,_t.createPortal=function(g,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return d(g,p,null,v)},_t.flushSync=function(g){var p=u.T,v=l.p;try{if(u.T=null,l.p=2,g)return g()}finally{u.T=p,l.p=v,l.d.f()}},_t.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(g,p))},_t.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},_t.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var v=p.as,y=h(v,p.crossOrigin),S=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?l.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:S,fetchPriority:x}):v==="script"&&l.d.X(g,{crossOrigin:y,integrity:S,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},_t.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=h(p.as,p.crossOrigin);l.d.M(g,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(g)},_t.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,y=h(v,p.crossOrigin);l.d.L(g,v,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},_t.preloadModule=function(g,p){if(typeof g=="string")if(p){var v=h(p.as,p.crossOrigin);l.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(g)},_t.requestFormReset=function(g){l.d.r(g)},_t.unstable_batchedUpdates=function(g,p){return g(p)},_t.useFormState=function(g,p,v){return u.H.useFormState(g,p,v)},_t.useFormStatus=function(){return u.H.useHostTransitionStatus()},_t.version="19.2.8",_t}var _p;function ry(){if(_p)return vc.exports;_p=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),vc.exports=u1(),vc.exports}var Lp;function c1(){if(Lp)return Ka;Lp=1;var t=o1(),r=sd(),i=ry();function l(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function h(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(l(188))}function p(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(l(188));return n!==e?null:e}for(var a=e,s=n;;){var f=a.return;if(f===null)break;var m=f.alternate;if(m===null){if(s=f.return,s!==null){a=s;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return g(f),e;if(m===s)return g(f),n;m=m.sibling}throw Error(l(188))}if(a.return!==s.return)a=f,s=m;else{for(var b=!1,j=f.child;j;){if(j===a){b=!0,a=f,s=m;break}if(j===s){b=!0,s=f,a=m;break}j=j.sibling}if(!b){for(j=m.child;j;){if(j===a){b=!0,a=m,s=f;break}if(j===s){b=!0,s=m,a=f;break}j=j.sibling}if(!b)throw Error(l(189))}}if(a.alternate!==s)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,S=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),D=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function Y(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case O:return"Profiler";case M:return"StrictMode";case K:return"Suspense";case N:return"SuspenseList";case ce:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case D:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case G:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return n=e.displayName||null,n!==null?n:X(e.type)||"Memo";case ne:n=e._payload,e=e._init;try{return X(e(n))}catch{}}return null}var B=Array.isArray,I=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},re=[],T=-1;function R(e){return{current:e}}function z(e){0>T||(e.current=re[T],re[T]=null,T--)}function C(e,n){T++,re[T]=e.current,e.current=n}var ie=R(null),fe=R(null),V=R(null),ae=R(null);function he(e,n){switch(C(V,n),C(fe,e),C(ie,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Jm(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Jm(n),e=Wm(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(ie),C(ie,e)}function me(){z(ie),z(fe),z(V)}function ye(e){e.memoizedState!==null&&C(ae,e);var n=ie.current,a=Wm(n,e.type);n!==a&&(C(fe,e),C(ie,a))}function Re(e){fe.current===e&&(z(ie),z(fe)),ae.current===e&&(z(ae),$a._currentValue=U)}var Ge,Pe;function ze(e){if(Ge===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Ge=n&&n[1]||"",Pe=-1<a.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Ge+e+Pe}var Ze=!1;function yt(e,n){if(!e||Ze)return"";Ze=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ee){var W=ee}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(ee){W=ee}e.call(ue.prototype)}}else{try{throw Error()}catch(ee){W=ee}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ee){if(ee&&W&&typeof ee.stack=="string")return[ee.stack,W.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=s.DetermineComponentFrameRoot(),b=m[0],j=m[1];if(b&&j){var L=b.split(`
|
|
4
|
+
`),Z=j.split(`
|
|
5
|
+
`);for(f=s=0;s<L.length&&!L[s].includes("DetermineComponentFrameRoot");)s++;for(;f<Z.length&&!Z[f].includes("DetermineComponentFrameRoot");)f++;if(s===L.length||f===Z.length)for(s=L.length-1,f=Z.length-1;1<=s&&0<=f&&L[s]!==Z[f];)f--;for(;1<=s&&0<=f;s--,f--)if(L[s]!==Z[f]){if(s!==1||f!==1)do if(s--,f--,0>f||L[s]!==Z[f]){var le=`
|
|
6
|
+
`+L[s].replace(" at new "," at ");return e.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",e.displayName)),le}while(1<=s&&0<=f);break}}}finally{Ze=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ze(a):""}function wt(e,n){switch(e.tag){case 26:case 27:case 5:return ze(e.type);case 16:return ze("Lazy");case 13:return e.child!==n&&n!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return yt(e.type,!1);case 11:return yt(e.type.render,!1);case 1:return yt(e.type,!0);case 31:return ze("Activity");default:return""}}function Rn(e){try{var n="",a=null;do n+=wt(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
|
|
7
|
+
Error generating stack: `+s.message+`
|
|
8
|
+
`+s.stack}}var qt=Object.prototype.hasOwnProperty,Gt=t.unstable_scheduleCallback,Te=t.unstable_cancelCallback,$e=t.unstable_shouldYield,ut=t.unstable_requestPaint,Xe=t.unstable_now,zt=t.unstable_getCurrentPriorityLevel,te=t.unstable_ImmediatePriority,de=t.unstable_UserBlockingPriority,xe=t.unstable_NormalPriority,Ee=t.unstable_LowPriority,J=t.unstable_IdlePriority,ge=t.log,Me=t.unstable_setDisableYieldValue,je=null,we=null;function Fe(e){if(typeof ge=="function"&&Me(e),we&&typeof we.setStrictMode=="function")try{we.setStrictMode(je,e)}catch{}}var Oe=Math.clz32?Math.clz32:xn,Rt=Math.log,Tt=Math.LN2;function xn(e){return e>>>=0,e===0?32:31-(Rt(e)/Tt|0)|0}var ct=256,Dr=262144,ul=4194304;function Or(e){var n=e&42;if(n!==0)return n;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 cl(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var f=0,m=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var j=s&134217727;return j!==0?(s=j&~m,s!==0?f=Or(s):(b&=j,b!==0?f=Or(b):a||(a=j&~e,a!==0&&(f=Or(a))))):(j=s&~m,j!==0?f=Or(j):b!==0?f=Or(b):a||(a=s&~e,a!==0&&(f=Or(a)))),f===0?0:n!==0&&n!==f&&(n&m)===0&&(m=f&-f,a=n&-n,m>=a||m===32&&(a&4194048)!==0)?n:f}function na(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Vv(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Dd(){var e=ul;return ul<<=1,(ul&62914560)===0&&(ul=4194304),e}function eo(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function ra(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Pv(e,n,a,s,f,m){var b=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var j=e.entanglements,L=e.expirationTimes,Z=e.hiddenUpdates;for(a=b&~a;0<a;){var le=31-Oe(a),ue=1<<le;j[le]=0,L[le]=-1;var W=Z[le];if(W!==null)for(Z[le]=null,le=0;le<W.length;le++){var ee=W[le];ee!==null&&(ee.lane&=-536870913)}a&=~ue}s!==0&&Od(e,s,0),m!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=m&~(b&~n))}function Od(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-Oe(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Md(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-Oe(a),f=1<<s;f&n|e[s]&n&&(e[s]|=n),a&=~f}}function zd(e,n){var a=n&-n;return a=(a&42)!==0?1:to(a),(a&(e.suspendedLanes|n))!==0?0:a}function to(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 no(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function _d(){var e=H.p;return e!==0?e:(e=window.event,e===void 0?32:kp(e.type))}function Ld(e,n){var a=H.p;try{return H.p=e,n()}finally{H.p=a}}var rr=Math.random().toString(36).slice(2),At="__reactFiber$"+rr,$t="__reactProps$"+rr,li="__reactContainer$"+rr,ro="__reactEvents$"+rr,Yv="__reactListeners$"+rr,Kv="__reactHandles$"+rr,Bd="__reactResources$"+rr,ia="__reactMarker$"+rr;function io(e){delete e[At],delete e[$t],delete e[ro],delete e[Yv],delete e[Kv]}function si(e){var n=e[At];if(n)return n;for(var a=e.parentNode;a;){if(n=a[li]||a[At]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=lp(e);e!==null;){if(a=e[At])return a;e=lp(e)}return n}e=a,a=e.parentNode}return null}function oi(e){if(e=e[At]||e[li]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function aa(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(l(33))}function ui(e){var n=e[Bd];return n||(n=e[Bd]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Et(e){e[ia]=!0}var Hd=new Set,Ud={};function Mr(e,n){ci(e,n),ci(e+"Capture",n)}function ci(e,n){for(Ud[e]=n,e=0;e<n.length;e++)Hd.add(n[e])}var Xv=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]*$"),qd={},Gd={};function Qv(e){return qt.call(Gd,e)?!0:qt.call(qd,e)?!1:Xv.test(e)?Gd[e]=!0:(qd[e]=!0,!1)}function dl(e,n,a){if(Qv(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function fl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function zn(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+s)}}function un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $d(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Zv(e,n,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,m=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(b){a=""+b,m.call(this,b)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(b){a=""+b},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ao(e){if(!e._valueTracker){var n=$d(e)?"checked":"value";e._valueTracker=Zv(e,n,""+e[n])}}function Fd(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=$d(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function hl(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 Jv=/[\n"\\]/g;function cn(e){return e.replace(Jv,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function lo(e,n,a,s,f,m,b,j){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),n!=null?b==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+un(n)):e.value!==""+un(n)&&(e.value=""+un(n)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),n!=null?so(e,b,un(n)):a!=null?so(e,b,un(a)):s!=null&&e.removeAttribute("value"),f==null&&m!=null&&(e.defaultChecked=!!m),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+un(j):e.removeAttribute("name")}function Vd(e,n,a,s,f,m,b,j){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),n!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){ao(e);return}a=a!=null?""+un(a):"",n=n!=null?""+un(n):a,j||n===e.value||(e.value=n),e.defaultValue=n}s=s??f,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=j?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),ao(e)}function so(e,n,a){n==="number"&&hl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function di(e,n,a,s){if(e=e.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=n.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&s&&(e[a].defaultSelected=!0)}else{for(a=""+un(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,s&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Pd(e,n,a){if(n!=null&&(n=""+un(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+un(a):""}function Yd(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(l(92));if(B(s)){if(1<s.length)throw Error(l(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=un(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),ao(e)}function fi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Wv=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 Kd(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||Wv.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function Xd(e,n,a){if(n!=null&&typeof n!="object")throw Error(l(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var f in n)s=n[f],n.hasOwnProperty(f)&&a[f]!==s&&Kd(e,f,s)}else for(var m in n)n.hasOwnProperty(m)&&Kd(e,m,n[m])}function oo(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 eb=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"]]),tb=/^[\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 ml(e){return tb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function _n(){}var uo=null;function co(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hi=null,mi=null;function Qd(e){var n=oi(e);if(n&&(e=n.stateNode)){var a=e[$t]||null;e:switch(e=n.stateNode,n.type){case"input":if(lo(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+cn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var f=s[$t]||null;if(!f)throw Error(l(90));lo(s,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&Fd(s)}break e;case"textarea":Pd(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&di(e,!!a.multiple,n,!1)}}}var fo=!1;function Zd(e,n,a){if(fo)return e(n,a);fo=!0;try{var s=e(n);return s}finally{if(fo=!1,(hi!==null||mi!==null)&&(ts(),hi&&(n=hi,e=mi,mi=hi=null,Qd(n),e)))for(n=0;n<e.length;n++)Qd(e[n])}}function la(e,n){var a=e.stateNode;if(a===null)return null;var s=a[$t]||null;if(s===null)return null;a=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,n,typeof a));return a}var Ln=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ho=!1;if(Ln)try{var sa={};Object.defineProperty(sa,"passive",{get:function(){ho=!0}}),window.addEventListener("test",sa,sa),window.removeEventListener("test",sa,sa)}catch{ho=!1}var ir=null,mo=null,pl=null;function Jd(){if(pl)return pl;var e,n=mo,a=n.length,s,f="value"in ir?ir.value:ir.textContent,m=f.length;for(e=0;e<a&&n[e]===f[e];e++);var b=a-e;for(s=1;s<=b&&n[a-s]===f[m-s];s++);return pl=f.slice(e,1<s?1-s:void 0)}function gl(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function yl(){return!0}function Wd(){return!1}function Ft(e){function n(a,s,f,m,b){this._reactName=a,this._targetInst=f,this.type=s,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(a=e[j],this[j]=a?a(m):m[j]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?yl:Wd,this.isPropagationStopped=Wd,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=yl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=yl)},persist:function(){},isPersistent:yl}),n}var zr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vl=Ft(zr),oa=y({},zr,{view:0,detail:0}),nb=Ft(oa),po,go,ua,bl=y({},oa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vo,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!==ua&&(ua&&e.type==="mousemove"?(po=e.screenX-ua.screenX,go=e.screenY-ua.screenY):go=po=0,ua=e),po)},movementY:function(e){return"movementY"in e?e.movementY:go}}),ef=Ft(bl),rb=y({},bl,{dataTransfer:0}),ib=Ft(rb),ab=y({},oa,{relatedTarget:0}),yo=Ft(ab),lb=y({},zr,{animationName:0,elapsedTime:0,pseudoElement:0}),sb=Ft(lb),ob=y({},zr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ub=Ft(ob),cb=y({},zr,{data:0}),tf=Ft(cb),db={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fb={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"},hb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=hb[e])?!!n[e]:!1}function vo(){return mb}var pb=y({},oa,{key:function(e){if(e.key){var n=db[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?fb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vo,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),gb=Ft(pb),yb=y({},bl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nf=Ft(yb),vb=y({},oa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vo}),bb=Ft(vb),xb=y({},zr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sb=Ft(xb),kb=y({},bl,{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}),wb=Ft(kb),Cb=y({},zr,{newState:0,oldState:0}),jb=Ft(Cb),Rb=[9,13,27,32],bo=Ln&&"CompositionEvent"in window,ca=null;Ln&&"documentMode"in document&&(ca=document.documentMode);var Tb=Ln&&"TextEvent"in window&&!ca,rf=Ln&&(!bo||ca&&8<ca&&11>=ca),af=" ",lf=!1;function sf(e,n){switch(e){case"keyup":return Rb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function of(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pi=!1;function Eb(e,n){switch(e){case"compositionend":return of(n);case"keypress":return n.which!==32?null:(lf=!0,af);case"textInput":return e=n.data,e===af&&lf?null:e;default:return null}}function Nb(e,n){if(pi)return e==="compositionend"||!bo&&sf(e,n)?(e=Jd(),pl=mo=ir=null,pi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return rf&&n.locale!=="ko"?null:n.data;default:return null}}var Ab={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 uf(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Ab[e.type]:n==="textarea"}function cf(e,n,a,s){hi?mi?mi.push(s):mi=[s]:hi=s,n=os(n,"onChange"),0<n.length&&(a=new vl("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var da=null,fa=null;function Ib(e){Pm(e,0)}function xl(e){var n=aa(e);if(Fd(n))return e}function df(e,n){if(e==="change")return n}var ff=!1;if(Ln){var xo;if(Ln){var So="oninput"in document;if(!So){var hf=document.createElement("div");hf.setAttribute("oninput","return;"),So=typeof hf.oninput=="function"}xo=So}else xo=!1;ff=xo&&(!document.documentMode||9<document.documentMode)}function mf(){da&&(da.detachEvent("onpropertychange",pf),fa=da=null)}function pf(e){if(e.propertyName==="value"&&xl(fa)){var n=[];cf(n,fa,e,co(e)),Zd(Ib,n)}}function Db(e,n,a){e==="focusin"?(mf(),da=n,fa=a,da.attachEvent("onpropertychange",pf)):e==="focusout"&&mf()}function Ob(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return xl(fa)}function Mb(e,n){if(e==="click")return xl(n)}function zb(e,n){if(e==="input"||e==="change")return xl(n)}function _b(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Wt=typeof Object.is=="function"?Object.is:_b;function ha(e,n){if(Wt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var f=a[s];if(!qt.call(n,f)||!Wt(e[f],n[f]))return!1}return!0}function gf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yf(e,n){var a=gf(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=gf(a)}}function vf(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?vf(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function bf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=hl(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=hl(e.document)}return n}function ko(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Lb=Ln&&"documentMode"in document&&11>=document.documentMode,gi=null,wo=null,ma=null,Co=!1;function xf(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Co||gi==null||gi!==hl(s)||(s=gi,"selectionStart"in s&&ko(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ma&&ha(ma,s)||(ma=s,s=os(wo,"onSelect"),0<s.length&&(n=new vl("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=gi)))}function _r(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var yi={animationend:_r("Animation","AnimationEnd"),animationiteration:_r("Animation","AnimationIteration"),animationstart:_r("Animation","AnimationStart"),transitionrun:_r("Transition","TransitionRun"),transitionstart:_r("Transition","TransitionStart"),transitioncancel:_r("Transition","TransitionCancel"),transitionend:_r("Transition","TransitionEnd")},jo={},Sf={};Ln&&(Sf=document.createElement("div").style,"AnimationEvent"in window||(delete yi.animationend.animation,delete yi.animationiteration.animation,delete yi.animationstart.animation),"TransitionEvent"in window||delete yi.transitionend.transition);function Lr(e){if(jo[e])return jo[e];if(!yi[e])return e;var n=yi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Sf)return jo[e]=n[a];return e}var kf=Lr("animationend"),wf=Lr("animationiteration"),Cf=Lr("animationstart"),Bb=Lr("transitionrun"),Hb=Lr("transitionstart"),Ub=Lr("transitioncancel"),jf=Lr("transitionend"),Rf=new Map,Ro="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(" ");Ro.push("scrollEnd");function Sn(e,n){Rf.set(e,n),Mr(n,[e])}var Sl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},dn=[],vi=0,To=0;function kl(){for(var e=vi,n=To=vi=0;n<e;){var a=dn[n];dn[n++]=null;var s=dn[n];dn[n++]=null;var f=dn[n];dn[n++]=null;var m=dn[n];if(dn[n++]=null,s!==null&&f!==null){var b=s.pending;b===null?f.next=f:(f.next=b.next,b.next=f),s.pending=f}m!==0&&Tf(a,f,m)}}function wl(e,n,a,s){dn[vi++]=e,dn[vi++]=n,dn[vi++]=a,dn[vi++]=s,To|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Eo(e,n,a,s){return wl(e,n,a,s),Cl(e)}function Br(e,n){return wl(e,null,null,n),Cl(e)}function Tf(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var f=!1,m=e.return;m!==null;)m.childLanes|=a,s=m.alternate,s!==null&&(s.childLanes|=a),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(f=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,f&&n!==null&&(f=31-Oe(a),e=m.hiddenUpdates,s=e[f],s===null?e[f]=[n]:s.push(n),n.lane=a|536870912),m):null}function Cl(e){if(50<_a)throw _a=0,Lu=null,Error(l(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var bi={};function qb(e,n,a,s){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(e,n,a,s){return new qb(e,n,a,s)}function No(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bn(e,n){var a=e.alternate;return a===null?(a=en(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Ef(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function jl(e,n,a,s,f,m){var b=0;if(s=e,typeof e=="function")No(e)&&(b=1);else if(typeof e=="string")b=Px(e,a,ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ce:return e=en(31,a,n,f),e.elementType=ce,e.lanes=m,e;case A:return Hr(a.children,f,m,n);case M:b=8,f|=24;break;case O:return e=en(12,a,n,f|2),e.elementType=O,e.lanes=m,e;case K:return e=en(13,a,n,f),e.elementType=K,e.lanes=m,e;case N:return e=en(19,a,n,f),e.elementType=N,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:b=10;break e;case E:b=9;break e;case G:b=11;break e;case $:b=14;break e;case ne:b=16,s=null;break e}b=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return n=en(b,a,n,f),n.elementType=e,n.type=s,n.lanes=m,n}function Hr(e,n,a,s){return e=en(7,e,s,n),e.lanes=a,e}function Ao(e,n,a){return e=en(6,e,null,n),e.lanes=a,e}function Nf(e){var n=en(18,null,null,0);return n.stateNode=e,n}function Io(e,n,a){return n=en(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Af=new WeakMap;function fn(e,n){if(typeof e=="object"&&e!==null){var a=Af.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Rn(n)},Af.set(e,n),n)}return{value:e,source:n,stack:Rn(n)}}var xi=[],Si=0,Rl=null,pa=0,hn=[],mn=0,ar=null,Tn=1,En="";function Hn(e,n){xi[Si++]=pa,xi[Si++]=Rl,Rl=e,pa=n}function If(e,n,a){hn[mn++]=Tn,hn[mn++]=En,hn[mn++]=ar,ar=e;var s=Tn;e=En;var f=32-Oe(s)-1;s&=~(1<<f),a+=1;var m=32-Oe(n)+f;if(30<m){var b=f-f%5;m=(s&(1<<b)-1).toString(32),s>>=b,f-=b,Tn=1<<32-Oe(n)+f|a<<f|s,En=m+e}else Tn=1<<m|a<<f|s,En=e}function Do(e){e.return!==null&&(Hn(e,1),If(e,1,0))}function Oo(e){for(;e===Rl;)Rl=xi[--Si],xi[Si]=null,pa=xi[--Si],xi[Si]=null;for(;e===ar;)ar=hn[--mn],hn[mn]=null,En=hn[--mn],hn[mn]=null,Tn=hn[--mn],hn[mn]=null}function Df(e,n){hn[mn++]=Tn,hn[mn++]=En,hn[mn++]=ar,Tn=n.id,En=n.overflow,ar=e}var It=null,lt=null,qe=!1,lr=null,pn=!1,Mo=Error(l(519));function sr(e){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ga(fn(n,e)),Mo}function Of(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[At]=e,n[$t]=s,a){case"dialog":Le("cancel",n),Le("close",n);break;case"iframe":case"object":case"embed":Le("load",n);break;case"video":case"audio":for(a=0;a<Ba.length;a++)Le(Ba[a],n);break;case"source":Le("error",n);break;case"img":case"image":case"link":Le("error",n),Le("load",n);break;case"details":Le("toggle",n);break;case"input":Le("invalid",n),Vd(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Le("invalid",n);break;case"textarea":Le("invalid",n),Yd(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||Qm(n.textContent,a)?(s.popover!=null&&(Le("beforetoggle",n),Le("toggle",n)),s.onScroll!=null&&Le("scroll",n),s.onScrollEnd!=null&&Le("scrollend",n),s.onClick!=null&&(n.onclick=_n),n=!0):n=!1,n||sr(e,!0)}function Mf(e){for(It=e.return;It;)switch(It.tag){case 5:case 31:case 13:pn=!1;return;case 27:case 3:pn=!0;return;default:It=It.return}}function ki(e){if(e!==It)return!1;if(!qe)return Mf(e),qe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Ju(e.type,e.memoizedProps)),a=!a),a&<&&sr(e),Mf(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));lt=ap(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));lt=ap(e)}else n===27?(n=lt,Sr(e.type)?(e=rc,rc=null,lt=e):lt=n):lt=It?yn(e.stateNode.nextSibling):null;return!0}function Ur(){lt=It=null,qe=!1}function zo(){var e=lr;return e!==null&&(Kt===null?Kt=e:Kt.push.apply(Kt,e),lr=null),e}function ga(e){lr===null?lr=[e]:lr.push(e)}var _o=R(null),qr=null,Un=null;function or(e,n,a){C(_o,n._currentValue),n._currentValue=a}function qn(e){e._currentValue=_o.current,z(_o)}function Lo(e,n,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===a)break;e=e.return}}function Bo(e,n,a,s){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var m=f.dependencies;if(m!==null){var b=f.child;m=m.firstContext;e:for(;m!==null;){var j=m;m=f;for(var L=0;L<n.length;L++)if(j.context===n[L]){m.lanes|=a,j=m.alternate,j!==null&&(j.lanes|=a),Lo(m.return,a,e),s||(b=null);break e}m=j.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(l(341));b.lanes|=a,m=b.alternate,m!==null&&(m.lanes|=a),Lo(b,a,e),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===e){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function wi(e,n,a,s){e=null;for(var f=n,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var b=f.alternate;if(b===null)throw Error(l(387));if(b=b.memoizedProps,b!==null){var j=f.type;Wt(f.pendingProps.value,b.value)||(e!==null?e.push(j):e=[j])}}else if(f===ae.current){if(b=f.alternate,b===null)throw Error(l(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push($a):e=[$a])}f=f.return}e!==null&&Bo(n,e,a,s),n.flags|=262144}function Tl(e){for(e=e.firstContext;e!==null;){if(!Wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Gr(e){qr=e,Un=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Dt(e){return zf(qr,e)}function El(e,n){return qr===null&&Gr(e),zf(e,n)}function zf(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Un===null){if(e===null)throw Error(l(308));Un=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Un=Un.next=n;return a}var Gb=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},$b=t.unstable_scheduleCallback,Fb=t.unstable_NormalPriority,vt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ho(){return{controller:new Gb,data:new Map,refCount:0}}function ya(e){e.refCount--,e.refCount===0&&$b(Fb,function(){e.controller.abort()})}var va=null,Uo=0,Ci=0,ji=null;function Vb(e,n){if(va===null){var a=va=[];Uo=0,Ci=$u(),ji={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Uo++,n.then(_f,_f),n}function _f(){if(--Uo===0&&va!==null){ji!==null&&(ji.status="fulfilled");var e=va;va=null,Ci=0,ji=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Pb(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(s.status="rejected",s.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),s}var Lf=I.S;I.S=function(e,n){xm=Xe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Vb(e,n),Lf!==null&&Lf(e,n)};var $r=R(null);function qo(){var e=$r.current;return e!==null?e:rt.pooledCache}function Nl(e,n){n===null?C($r,$r.current):C($r,n.pool)}function Bf(){var e=qo();return e===null?null:{parent:vt._currentValue,pool:e}}var Ri=Error(l(460)),Go=Error(l(474)),Al=Error(l(542)),Il={then:function(){}};function Hf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Uf(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(_n,_n),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Gf(e),e;default:if(typeof n.status=="string")n.then(_n,_n);else{if(e=rt,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=s}},function(s){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Gf(e),e}throw Vr=n,Ri}}function Fr(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Vr=a,Ri):a}}var Vr=null;function qf(){if(Vr===null)throw Error(l(459));var e=Vr;return Vr=null,e}function Gf(e){if(e===Ri||e===Al)throw Error(l(483))}var Ti=null,ba=0;function Dl(e){var n=ba;return ba+=1,Ti===null&&(Ti=[]),Uf(Ti,e,n)}function xa(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ol(e,n){throw n.$$typeof===S?Error(l(525)):(e=Object.prototype.toString.call(n),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function $f(e){function n(P,q){if(e){var Q=P.deletions;Q===null?(P.deletions=[q],P.flags|=16):Q.push(q)}}function a(P,q){if(!e)return null;for(;q!==null;)n(P,q),q=q.sibling;return null}function s(P){for(var q=new Map;P!==null;)P.key!==null?q.set(P.key,P):q.set(P.index,P),P=P.sibling;return q}function f(P,q){return P=Bn(P,q),P.index=0,P.sibling=null,P}function m(P,q,Q){return P.index=Q,e?(Q=P.alternate,Q!==null?(Q=Q.index,Q<q?(P.flags|=67108866,q):Q):(P.flags|=67108866,q)):(P.flags|=1048576,q)}function b(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function j(P,q,Q,se){return q===null||q.tag!==6?(q=Ao(Q,P.mode,se),q.return=P,q):(q=f(q,Q),q.return=P,q)}function L(P,q,Q,se){var Se=Q.type;return Se===A?le(P,q,Q.props.children,se,Q.key):q!==null&&(q.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===ne&&Fr(Se)===q.type)?(q=f(q,Q.props),xa(q,Q),q.return=P,q):(q=jl(Q.type,Q.key,Q.props,null,P.mode,se),xa(q,Q),q.return=P,q)}function Z(P,q,Q,se){return q===null||q.tag!==4||q.stateNode.containerInfo!==Q.containerInfo||q.stateNode.implementation!==Q.implementation?(q=Io(Q,P.mode,se),q.return=P,q):(q=f(q,Q.children||[]),q.return=P,q)}function le(P,q,Q,se,Se){return q===null||q.tag!==7?(q=Hr(Q,P.mode,se,Se),q.return=P,q):(q=f(q,Q),q.return=P,q)}function ue(P,q,Q){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Ao(""+q,P.mode,Q),q.return=P,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return Q=jl(q.type,q.key,q.props,null,P.mode,Q),xa(Q,q),Q.return=P,Q;case w:return q=Io(q,P.mode,Q),q.return=P,q;case ne:return q=Fr(q),ue(P,q,Q)}if(B(q)||Y(q))return q=Hr(q,P.mode,Q,null),q.return=P,q;if(typeof q.then=="function")return ue(P,Dl(q),Q);if(q.$$typeof===D)return ue(P,El(P,q),Q);Ol(P,q)}return null}function W(P,q,Q,se){var Se=q!==null?q.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Se!==null?null:j(P,q,""+Q,se);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:return Q.key===Se?L(P,q,Q,se):null;case w:return Q.key===Se?Z(P,q,Q,se):null;case ne:return Q=Fr(Q),W(P,q,Q,se)}if(B(Q)||Y(Q))return Se!==null?null:le(P,q,Q,se,null);if(typeof Q.then=="function")return W(P,q,Dl(Q),se);if(Q.$$typeof===D)return W(P,q,El(P,Q),se);Ol(P,Q)}return null}function ee(P,q,Q,se,Se){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return P=P.get(Q)||null,j(q,P,""+se,Se);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case x:return P=P.get(se.key===null?Q:se.key)||null,L(q,P,se,Se);case w:return P=P.get(se.key===null?Q:se.key)||null,Z(q,P,se,Se);case ne:return se=Fr(se),ee(P,q,Q,se,Se)}if(B(se)||Y(se))return P=P.get(Q)||null,le(q,P,se,Se,null);if(typeof se.then=="function")return ee(P,q,Q,Dl(se),Se);if(se.$$typeof===D)return ee(P,q,Q,El(q,se),Se);Ol(q,se)}return null}function ve(P,q,Q,se){for(var Se=null,Ye=null,be=q,De=q=0,Ue=null;be!==null&&De<Q.length;De++){be.index>De?(Ue=be,be=null):Ue=be.sibling;var Ke=W(P,be,Q[De],se);if(Ke===null){be===null&&(be=Ue);break}e&&be&&Ke.alternate===null&&n(P,be),q=m(Ke,q,De),Ye===null?Se=Ke:Ye.sibling=Ke,Ye=Ke,be=Ue}if(De===Q.length)return a(P,be),qe&&Hn(P,De),Se;if(be===null){for(;De<Q.length;De++)be=ue(P,Q[De],se),be!==null&&(q=m(be,q,De),Ye===null?Se=be:Ye.sibling=be,Ye=be);return qe&&Hn(P,De),Se}for(be=s(be);De<Q.length;De++)Ue=ee(be,P,De,Q[De],se),Ue!==null&&(e&&Ue.alternate!==null&&be.delete(Ue.key===null?De:Ue.key),q=m(Ue,q,De),Ye===null?Se=Ue:Ye.sibling=Ue,Ye=Ue);return e&&be.forEach(function(Rr){return n(P,Rr)}),qe&&Hn(P,De),Se}function Ce(P,q,Q,se){if(Q==null)throw Error(l(151));for(var Se=null,Ye=null,be=q,De=q=0,Ue=null,Ke=Q.next();be!==null&&!Ke.done;De++,Ke=Q.next()){be.index>De?(Ue=be,be=null):Ue=be.sibling;var Rr=W(P,be,Ke.value,se);if(Rr===null){be===null&&(be=Ue);break}e&&be&&Rr.alternate===null&&n(P,be),q=m(Rr,q,De),Ye===null?Se=Rr:Ye.sibling=Rr,Ye=Rr,be=Ue}if(Ke.done)return a(P,be),qe&&Hn(P,De),Se;if(be===null){for(;!Ke.done;De++,Ke=Q.next())Ke=ue(P,Ke.value,se),Ke!==null&&(q=m(Ke,q,De),Ye===null?Se=Ke:Ye.sibling=Ke,Ye=Ke);return qe&&Hn(P,De),Se}for(be=s(be);!Ke.done;De++,Ke=Q.next())Ke=ee(be,P,De,Ke.value,se),Ke!==null&&(e&&Ke.alternate!==null&&be.delete(Ke.key===null?De:Ke.key),q=m(Ke,q,De),Ye===null?Se=Ke:Ye.sibling=Ke,Ye=Ke);return e&&be.forEach(function(r1){return n(P,r1)}),qe&&Hn(P,De),Se}function nt(P,q,Q,se){if(typeof Q=="object"&&Q!==null&&Q.type===A&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:e:{for(var Se=Q.key;q!==null;){if(q.key===Se){if(Se=Q.type,Se===A){if(q.tag===7){a(P,q.sibling),se=f(q,Q.props.children),se.return=P,P=se;break e}}else if(q.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===ne&&Fr(Se)===q.type){a(P,q.sibling),se=f(q,Q.props),xa(se,Q),se.return=P,P=se;break e}a(P,q);break}else n(P,q);q=q.sibling}Q.type===A?(se=Hr(Q.props.children,P.mode,se,Q.key),se.return=P,P=se):(se=jl(Q.type,Q.key,Q.props,null,P.mode,se),xa(se,Q),se.return=P,P=se)}return b(P);case w:e:{for(Se=Q.key;q!==null;){if(q.key===Se)if(q.tag===4&&q.stateNode.containerInfo===Q.containerInfo&&q.stateNode.implementation===Q.implementation){a(P,q.sibling),se=f(q,Q.children||[]),se.return=P,P=se;break e}else{a(P,q);break}else n(P,q);q=q.sibling}se=Io(Q,P.mode,se),se.return=P,P=se}return b(P);case ne:return Q=Fr(Q),nt(P,q,Q,se)}if(B(Q))return ve(P,q,Q,se);if(Y(Q)){if(Se=Y(Q),typeof Se!="function")throw Error(l(150));return Q=Se.call(Q),Ce(P,q,Q,se)}if(typeof Q.then=="function")return nt(P,q,Dl(Q),se);if(Q.$$typeof===D)return nt(P,q,El(P,Q),se);Ol(P,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,q!==null&&q.tag===6?(a(P,q.sibling),se=f(q,Q),se.return=P,P=se):(a(P,q),se=Ao(Q,P.mode,se),se.return=P,P=se),b(P)):a(P,q)}return function(P,q,Q,se){try{ba=0;var Se=nt(P,q,Q,se);return Ti=null,Se}catch(be){if(be===Ri||be===Al)throw be;var Ye=en(29,be,null,P.mode);return Ye.lanes=se,Ye.return=P,Ye}}}var Pr=$f(!0),Ff=$f(!1),ur=!1;function $o(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fo(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function cr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function dr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Qe&2)!==0){var f=s.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),s.pending=n,n=Cl(e),Tf(e,null,a),n}return wl(e,s,n,a),Cl(e)}function Sa(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Md(e,a)}}function Vo(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var f=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=b:m=m.next=b,a=a.next}while(a!==null);m===null?f=m=n:m=m.next=n}else f=m=n;a={baseState:s.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var Po=!1;function ka(){if(Po){var e=ji;if(e!==null)throw e}}function wa(e,n,a,s){Po=!1;var f=e.updateQueue;ur=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var L=j,Z=L.next;L.next=null,b===null?m=Z:b.next=Z,b=L;var le=e.alternate;le!==null&&(le=le.updateQueue,j=le.lastBaseUpdate,j!==b&&(j===null?le.firstBaseUpdate=Z:j.next=Z,le.lastBaseUpdate=L))}if(m!==null){var ue=f.baseState;b=0,le=Z=L=null,j=m;do{var W=j.lane&-536870913,ee=W!==j.lane;if(ee?(He&W)===W:(s&W)===W){W!==0&&W===Ci&&(Po=!0),le!==null&&(le=le.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ve=e,Ce=j;W=n;var nt=a;switch(Ce.tag){case 1:if(ve=Ce.payload,typeof ve=="function"){ue=ve.call(nt,ue,W);break e}ue=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Ce.payload,W=typeof ve=="function"?ve.call(nt,ue,W):ve,W==null)break e;ue=y({},ue,W);break e;case 2:ur=!0}}W=j.callback,W!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=f.callbacks,ee===null?f.callbacks=[W]:ee.push(W))}else ee={lane:W,tag:j.tag,payload:j.payload,callback:j.callback,next:null},le===null?(Z=le=ee,L=ue):le=le.next=ee,b|=W;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;ee=j,j=ee.next,ee.next=null,f.lastBaseUpdate=ee,f.shared.pending=null}}while(!0);le===null&&(L=ue),f.baseState=L,f.firstBaseUpdate=Z,f.lastBaseUpdate=le,m===null&&(f.shared.lanes=0),gr|=b,e.lanes=b,e.memoizedState=ue}}function Vf(e,n){if(typeof e!="function")throw Error(l(191,e));e.call(n)}function Pf(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Vf(a[e],n)}var Ei=R(null),Ml=R(0);function Yf(e,n){e=Qn,C(Ml,e),C(Ei,n),Qn=e|n.baseLanes}function Yo(){C(Ml,Qn),C(Ei,Ei.current)}function Ko(){Qn=Ml.current,z(Ei),z(Ml)}var tn=R(null),gn=null;function fr(e){var n=e.alternate;C(mt,mt.current&1),C(tn,e),gn===null&&(n===null||Ei.current!==null||n.memoizedState!==null)&&(gn=e)}function Xo(e){C(mt,mt.current),C(tn,e),gn===null&&(gn=e)}function Kf(e){e.tag===22?(C(mt,mt.current),C(tn,e),gn===null&&(gn=e)):hr()}function hr(){C(mt,mt.current),C(tn,tn.current)}function nn(e){z(tn),gn===e&&(gn=null),z(mt)}var mt=R(0);function zl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||tc(a)||nc(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Gn=0,Ie=null,et=null,bt=null,_l=!1,Ni=!1,Yr=!1,Ll=0,Ca=0,Ai=null,Yb=0;function dt(){throw Error(l(321))}function Qo(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Wt(e[a],n[a]))return!1;return!0}function Zo(e,n,a,s,f,m){return Gn=m,Ie=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,I.H=e===null||e.memoizedState===null?Ih:fu,Yr=!1,m=a(s,f),Yr=!1,Ni&&(m=Qf(n,a,s,f)),Xf(e),m}function Xf(e){I.H=Ta;var n=et!==null&&et.next!==null;if(Gn=0,bt=et=Ie=null,_l=!1,Ca=0,Ai=null,n)throw Error(l(300));e===null||xt||(e=e.dependencies,e!==null&&Tl(e)&&(xt=!0))}function Qf(e,n,a,s){Ie=e;var f=0;do{if(Ni&&(Ai=null),Ca=0,Ni=!1,25<=f)throw Error(l(301));if(f+=1,bt=et=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}I.H=Dh,m=n(a,s)}while(Ni);return m}function Kb(){var e=I.H,n=e.useState()[0];return n=typeof n.then=="function"?ja(n):n,e=e.useState()[0],(et!==null?et.memoizedState:null)!==e&&(Ie.flags|=1024),n}function Jo(){var e=Ll!==0;return Ll=0,e}function Wo(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function eu(e){if(_l){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}_l=!1}Gn=0,bt=et=Ie=null,Ni=!1,Ca=Ll=0,Ai=null}function Ht(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Ie.memoizedState=bt=e:bt=bt.next=e,bt}function pt(){if(et===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=et.next;var n=bt===null?Ie.memoizedState:bt.next;if(n!==null)bt=n,et=e;else{if(e===null)throw Ie.alternate===null?Error(l(467)):Error(l(310));et=e,e={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},bt===null?Ie.memoizedState=bt=e:bt=bt.next=e}return bt}function Bl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ja(e){var n=Ca;return Ca+=1,Ai===null&&(Ai=[]),e=Uf(Ai,e,n),n=Ie,(bt===null?n.memoizedState:bt.next)===null&&(n=n.alternate,I.H=n===null||n.memoizedState===null?Ih:fu),e}function Hl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ja(e);if(e.$$typeof===D)return Dt(e)}throw Error(l(438,String(e)))}function tu(e){var n=null,a=Ie.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=Ie.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Bl(),Ie.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=_;return n.index++,a}function $n(e,n){return typeof n=="function"?n(e):n}function Ul(e){var n=pt();return nu(n,et,e)}function nu(e,n,a){var s=e.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=a;var f=e.baseQueue,m=s.pending;if(m!==null){if(f!==null){var b=f.next;f.next=m.next,m.next=b}n.baseQueue=f=m,s.pending=null}if(m=e.baseState,f===null)e.memoizedState=m;else{n=f.next;var j=b=null,L=null,Z=n,le=!1;do{var ue=Z.lane&-536870913;if(ue!==Z.lane?(He&ue)===ue:(Gn&ue)===ue){var W=Z.revertLane;if(W===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),ue===Ci&&(le=!0);else if((Gn&W)===W){Z=Z.next,W===Ci&&(le=!0);continue}else ue={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},L===null?(j=L=ue,b=m):L=L.next=ue,Ie.lanes|=W,gr|=W;ue=Z.action,Yr&&a(m,ue),m=Z.hasEagerState?Z.eagerState:a(m,ue)}else W={lane:ue,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},L===null?(j=L=W,b=m):L=L.next=W,Ie.lanes|=ue,gr|=ue;Z=Z.next}while(Z!==null&&Z!==n);if(L===null?b=m:L.next=j,!Wt(m,e.memoizedState)&&(xt=!0,le&&(a=ji,a!==null)))throw a;e.memoizedState=m,e.baseState=b,e.baseQueue=L,s.lastRenderedState=m}return f===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function ru(e){var n=pt(),a=n.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var s=a.dispatch,f=a.pending,m=n.memoizedState;if(f!==null){a.pending=null;var b=f=f.next;do m=e(m,b.action),b=b.next;while(b!==f);Wt(m,n.memoizedState)||(xt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,s]}function Zf(e,n,a){var s=Ie,f=pt(),m=qe;if(m){if(a===void 0)throw Error(l(407));a=a()}else a=n();var b=!Wt((et||f).memoizedState,a);if(b&&(f.memoizedState=a,xt=!0),f=f.queue,lu(eh.bind(null,s,f,e),[e]),f.getSnapshot!==n||b||bt!==null&&bt.memoizedState.tag&1){if(s.flags|=2048,Ii(9,{destroy:void 0},Wf.bind(null,s,f,a,n),null),rt===null)throw Error(l(349));m||(Gn&127)!==0||Jf(s,n,a)}return a}function Jf(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ie.updateQueue,n===null?(n=Bl(),Ie.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Wf(e,n,a,s){n.value=a,n.getSnapshot=s,th(n)&&nh(e)}function eh(e,n,a){return a(function(){th(n)&&nh(e)})}function th(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Wt(e,a)}catch{return!0}}function nh(e){var n=Br(e,2);n!==null&&Xt(n,e,2)}function iu(e){var n=Ht();if(typeof e=="function"){var a=e;if(e=a(),Yr){Fe(!0);try{a()}finally{Fe(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$n,lastRenderedState:e},n}function rh(e,n,a,s){return e.baseState=a,nu(e,et,typeof s=="function"?s:$n)}function Xb(e,n,a,s,f){if($l(e))throw Error(l(485));if(e=n.action,e!==null){var m={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};I.T!==null?a(!0):m.isTransition=!1,s(m),a=n.pending,a===null?(m.next=n.pending=m,ih(n,m)):(m.next=a.next,n.pending=a.next=m)}}function ih(e,n){var a=n.action,s=n.payload,f=e.state;if(n.isTransition){var m=I.T,b={};I.T=b;try{var j=a(f,s),L=I.S;L!==null&&L(b,j),ah(e,n,j)}catch(Z){au(e,n,Z)}finally{m!==null&&b.types!==null&&(m.types=b.types),I.T=m}}else try{m=a(f,s),ah(e,n,m)}catch(Z){au(e,n,Z)}}function ah(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){lh(e,n,s)},function(s){return au(e,n,s)}):lh(e,n,a)}function lh(e,n,a){n.status="fulfilled",n.value=a,sh(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,ih(e,a)))}function au(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,sh(n),n=n.next;while(n!==s)}e.action=null}function sh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function oh(e,n){return n}function uh(e,n){if(qe){var a=rt.formState;if(a!==null){e:{var s=Ie;if(qe){if(lt){t:{for(var f=lt,m=pn;f.nodeType!==8;){if(!m){f=null;break t}if(f=yn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){lt=yn(f.nextSibling),s=f.data==="F!";break e}}sr(s)}s=!1}s&&(n=a[0])}}return a=Ht(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oh,lastRenderedState:n},a.queue=s,a=Eh.bind(null,Ie,s),s.dispatch=a,s=iu(!1),m=du.bind(null,Ie,!1,s.queue),s=Ht(),f={state:n,dispatch:null,action:e,pending:null},s.queue=f,a=Xb.bind(null,Ie,f,m,a),f.dispatch=a,s.memoizedState=e,[n,a,!1]}function ch(e){var n=pt();return dh(n,et,e)}function dh(e,n,a){if(n=nu(e,n,oh)[0],e=Ul($n)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=ja(n)}catch(b){throw b===Ri?Al:b}else s=n;n=pt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(Ie.flags|=2048,Ii(9,{destroy:void 0},Qb.bind(null,f,a),null)),[s,m,e]}function Qb(e,n){e.action=n}function fh(e){var n=pt(),a=et;if(a!==null)return dh(n,a,e);pt(),n=n.memoizedState,a=pt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function Ii(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=Ie.updateQueue,n===null&&(n=Bl(),Ie.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function hh(){return pt().memoizedState}function ql(e,n,a,s){var f=Ht();Ie.flags|=e,f.memoizedState=Ii(1|n,{destroy:void 0},a,s===void 0?null:s)}function Gl(e,n,a,s){var f=pt();s=s===void 0?null:s;var m=f.memoizedState.inst;et!==null&&s!==null&&Qo(s,et.memoizedState.deps)?f.memoizedState=Ii(n,m,a,s):(Ie.flags|=e,f.memoizedState=Ii(1|n,m,a,s))}function mh(e,n){ql(8390656,8,e,n)}function lu(e,n){Gl(2048,8,e,n)}function Zb(e){Ie.flags|=4;var n=Ie.updateQueue;if(n===null)n=Bl(),Ie.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function ph(e){var n=pt().memoizedState;return Zb({ref:n,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function gh(e,n){return Gl(4,2,e,n)}function yh(e,n){return Gl(4,4,e,n)}function vh(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function bh(e,n,a){a=a!=null?a.concat([e]):null,Gl(4,4,vh.bind(null,n,e),a)}function su(){}function xh(e,n){var a=pt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Qo(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function Sh(e,n){var a=pt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Qo(n,s[1]))return s[0];if(s=e(),Yr){Fe(!0);try{e()}finally{Fe(!1)}}return a.memoizedState=[s,n],s}function ou(e,n,a){return a===void 0||(Gn&1073741824)!==0&&(He&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=km(),Ie.lanes|=e,gr|=e,a)}function kh(e,n,a,s){return Wt(a,n)?a:Ei.current!==null?(e=ou(e,a,s),Wt(e,n)||(xt=!0),e):(Gn&42)===0||(Gn&1073741824)!==0&&(He&261930)===0?(xt=!0,e.memoizedState=a):(e=km(),Ie.lanes|=e,gr|=e,n)}function wh(e,n,a,s,f){var m=H.p;H.p=m!==0&&8>m?m:8;var b=I.T,j={};I.T=j,du(e,!1,n,a);try{var L=f(),Z=I.S;if(Z!==null&&Z(j,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var le=Pb(L,s);Ra(e,n,le,ln(e))}else Ra(e,n,s,ln(e))}catch(ue){Ra(e,n,{then:function(){},status:"rejected",reason:ue},ln())}finally{H.p=m,b!==null&&j.types!==null&&(b.types=j.types),I.T=b}}function Jb(){}function uu(e,n,a,s){if(e.tag!==5)throw Error(l(476));var f=Ch(e).queue;wh(e,f,n,U,a===null?Jb:function(){return jh(e),a(s)})}function Ch(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$n,lastRenderedState:U},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$n,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function jh(e){var n=Ch(e);n.next===null&&(n=e.alternate.memoizedState),Ra(e,n.next.queue,{},ln())}function cu(){return Dt($a)}function Rh(){return pt().memoizedState}function Th(){return pt().memoizedState}function Wb(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=ln();e=cr(a);var s=dr(n,e,a);s!==null&&(Xt(s,n,a),Sa(s,n,a)),n={cache:Ho()},e.payload=n;return}n=n.return}}function ex(e,n,a){var s=ln();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$l(e)?Nh(n,a):(a=Eo(e,n,a,s),a!==null&&(Xt(a,e,s),Ah(a,n,s)))}function Eh(e,n,a){var s=ln();Ra(e,n,a,s)}function Ra(e,n,a,s){var f={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($l(e))Nh(n,f);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var b=n.lastRenderedState,j=m(b,a);if(f.hasEagerState=!0,f.eagerState=j,Wt(j,b))return wl(e,n,f,0),rt===null&&kl(),!1}catch{}if(a=Eo(e,n,f,s),a!==null)return Xt(a,e,s),Ah(a,n,s),!0}return!1}function du(e,n,a,s){if(s={lane:2,revertLane:$u(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},$l(e)){if(n)throw Error(l(479))}else n=Eo(e,a,s,2),n!==null&&Xt(n,e,2)}function $l(e){var n=e.alternate;return e===Ie||n!==null&&n===Ie}function Nh(e,n){Ni=_l=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Ah(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Md(e,a)}}var Ta={readContext:Dt,use:Hl,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt,useHostTransitionStatus:dt,useFormState:dt,useActionState:dt,useOptimistic:dt,useMemoCache:dt,useCacheRefresh:dt};Ta.useEffectEvent=dt;var Ih={readContext:Dt,use:Hl,useCallback:function(e,n){return Ht().memoizedState=[e,n===void 0?null:n],e},useContext:Dt,useEffect:mh,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,ql(4194308,4,vh.bind(null,n,e),a)},useLayoutEffect:function(e,n){return ql(4194308,4,e,n)},useInsertionEffect:function(e,n){ql(4,2,e,n)},useMemo:function(e,n){var a=Ht();n=n===void 0?null:n;var s=e();if(Yr){Fe(!0);try{e()}finally{Fe(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=Ht();if(a!==void 0){var f=a(n);if(Yr){Fe(!0);try{a(n)}finally{Fe(!1)}}}else f=n;return s.memoizedState=s.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},s.queue=e,e=e.dispatch=ex.bind(null,Ie,e),[s.memoizedState,e]},useRef:function(e){var n=Ht();return e={current:e},n.memoizedState=e},useState:function(e){e=iu(e);var n=e.queue,a=Eh.bind(null,Ie,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:su,useDeferredValue:function(e,n){var a=Ht();return ou(a,e,n)},useTransition:function(){var e=iu(!1);return e=wh.bind(null,Ie,e.queue,!0,!1),Ht().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=Ie,f=Ht();if(qe){if(a===void 0)throw Error(l(407));a=a()}else{if(a=n(),rt===null)throw Error(l(349));(He&127)!==0||Jf(s,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,mh(eh.bind(null,s,m,e),[e]),s.flags|=2048,Ii(9,{destroy:void 0},Wf.bind(null,s,m,a,n),null),a},useId:function(){var e=Ht(),n=rt.identifierPrefix;if(qe){var a=En,s=Tn;a=(s&~(1<<32-Oe(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Ll++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Yb++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:cu,useFormState:uh,useActionState:uh,useOptimistic:function(e){var n=Ht();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=du.bind(null,Ie,!0,a),a.dispatch=n,[e,n]},useMemoCache:tu,useCacheRefresh:function(){return Ht().memoizedState=Wb.bind(null,Ie)},useEffectEvent:function(e){var n=Ht(),a={impl:e};return n.memoizedState=a,function(){if((Qe&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},fu={readContext:Dt,use:Hl,useCallback:xh,useContext:Dt,useEffect:lu,useImperativeHandle:bh,useInsertionEffect:gh,useLayoutEffect:yh,useMemo:Sh,useReducer:Ul,useRef:hh,useState:function(){return Ul($n)},useDebugValue:su,useDeferredValue:function(e,n){var a=pt();return kh(a,et.memoizedState,e,n)},useTransition:function(){var e=Ul($n)[0],n=pt().memoizedState;return[typeof e=="boolean"?e:ja(e),n]},useSyncExternalStore:Zf,useId:Rh,useHostTransitionStatus:cu,useFormState:ch,useActionState:ch,useOptimistic:function(e,n){var a=pt();return rh(a,et,e,n)},useMemoCache:tu,useCacheRefresh:Th};fu.useEffectEvent=ph;var Dh={readContext:Dt,use:Hl,useCallback:xh,useContext:Dt,useEffect:lu,useImperativeHandle:bh,useInsertionEffect:gh,useLayoutEffect:yh,useMemo:Sh,useReducer:ru,useRef:hh,useState:function(){return ru($n)},useDebugValue:su,useDeferredValue:function(e,n){var a=pt();return et===null?ou(a,e,n):kh(a,et.memoizedState,e,n)},useTransition:function(){var e=ru($n)[0],n=pt().memoizedState;return[typeof e=="boolean"?e:ja(e),n]},useSyncExternalStore:Zf,useId:Rh,useHostTransitionStatus:cu,useFormState:fh,useActionState:fh,useOptimistic:function(e,n){var a=pt();return et!==null?rh(a,et,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:tu,useCacheRefresh:Th};Dh.useEffectEvent=ph;function hu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var mu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=ln(),f=cr(s);f.payload=n,a!=null&&(f.callback=a),n=dr(e,f,s),n!==null&&(Xt(n,e,s),Sa(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=ln(),f=cr(s);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=dr(e,f,s),n!==null&&(Xt(n,e,s),Sa(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=ln(),s=cr(a);s.tag=2,n!=null&&(s.callback=n),n=dr(e,s,a),n!==null&&(Xt(n,e,a),Sa(n,e,a))}};function Oh(e,n,a,s,f,m,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,m,b):n.prototype&&n.prototype.isPureReactComponent?!ha(a,s)||!ha(f,m):!0}function Mh(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&mu.enqueueReplaceState(n,n.state,null)}function Kr(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function zh(e){Sl(e)}function _h(e){console.error(e)}function Lh(e){Sl(e)}function Fl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function Bh(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function pu(e,n,a){return a=cr(a),a.tag=3,a.payload={element:null},a.callback=function(){Fl(e,n)},a}function Hh(e){return e=cr(e),e.tag=3,e}function Uh(e,n,a,s){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=s.value;e.payload=function(){return f(m)},e.callback=function(){Bh(n,a,s)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Bh(n,a,s),typeof f!="function"&&(yr===null?yr=new Set([this]):yr.add(this));var j=s.stack;this.componentDidCatch(s.value,{componentStack:j!==null?j:""})})}function tx(e,n,a,s,f){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&wi(n,a,f,!0),a=tn.current,a!==null){switch(a.tag){case 31:case 13:return gn===null?ns():a.alternate===null&&ft===0&&(ft=3),a.flags&=-257,a.flags|=65536,a.lanes=f,s===Il?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),Uu(e,s,f)),!1;case 22:return a.flags|=65536,s===Il?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),Uu(e,s,f)),!1}throw Error(l(435,a.tag))}return Uu(e,s,f),ns(),!1}if(qe)return n=tn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,s!==Mo&&(e=Error(l(422),{cause:s}),ga(fn(e,a)))):(s!==Mo&&(n=Error(l(423),{cause:s}),ga(fn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,s=fn(s,a),f=pu(e.stateNode,s,f),Vo(e,f),ft!==4&&(ft=2)),!1;var m=Error(l(520),{cause:s});if(m=fn(m,a),za===null?za=[m]:za.push(m),ft!==4&&(ft=2),n===null)return!0;s=fn(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=pu(a.stateNode,s,e),Vo(a,e),!1;case 1:if(n=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(yr===null||!yr.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Hh(f),Uh(f,e,a,s),Vo(a,f),!1}a=a.return}while(a!==null);return!1}var gu=Error(l(461)),xt=!1;function Ot(e,n,a,s){n.child=e===null?Ff(n,null,a,s):Pr(n,e.child,a,s)}function qh(e,n,a,s,f){a=a.render;var m=n.ref;if("ref"in s){var b={};for(var j in s)j!=="ref"&&(b[j]=s[j])}else b=s;return Gr(n),s=Zo(e,n,a,b,m,f),j=Jo(),e!==null&&!xt?(Wo(e,n,f),Fn(e,n,f)):(qe&&j&&Do(n),n.flags|=1,Ot(e,n,s,f),n.child)}function Gh(e,n,a,s,f){if(e===null){var m=a.type;return typeof m=="function"&&!No(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,$h(e,n,m,s,f)):(e=jl(a.type,null,s,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!Cu(e,f)){var b=m.memoizedProps;if(a=a.compare,a=a!==null?a:ha,a(b,s)&&e.ref===n.ref)return Fn(e,n,f)}return n.flags|=1,e=Bn(m,s),e.ref=n.ref,e.return=n,n.child=e}function $h(e,n,a,s,f){if(e!==null){var m=e.memoizedProps;if(ha(m,s)&&e.ref===n.ref)if(xt=!1,n.pendingProps=s=m,Cu(e,f))(e.flags&131072)!==0&&(xt=!0);else return n.lanes=e.lanes,Fn(e,n,f)}return yu(e,n,a,s,f)}function Fh(e,n,a,s){var f=s.children,m=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(m=m!==null?m.baseLanes|a:a,e!==null){for(s=n.child=e.child,f=0;s!==null;)f=f|s.lanes|s.childLanes,s=s.sibling;s=f&~m}else s=0,n.child=null;return Vh(e,n,m,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nl(n,m!==null?m.cachePool:null),m!==null?Yf(n,m):Yo(),Kf(n);else return s=n.lanes=536870912,Vh(e,n,m!==null?m.baseLanes|a:a,a,s)}else m!==null?(Nl(n,m.cachePool),Yf(n,m),hr(),n.memoizedState=null):(e!==null&&Nl(n,null),Yo(),hr());return Ot(e,n,f,a),n.child}function Ea(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Vh(e,n,a,s,f){var m=qo();return m=m===null?null:{parent:vt._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&Nl(n,null),Yo(),Kf(n),e!==null&&wi(e,n,s,!0),n.childLanes=f,null}function Vl(e,n){return n=Yl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Ph(e,n,a){return Pr(n,e.child,null,a),e=Vl(n,n.pendingProps),e.flags|=2,nn(n),n.memoizedState=null,e}function nx(e,n,a){var s=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(qe){if(s.mode==="hidden")return e=Vl(n,s),n.lanes=536870912,Ea(null,e);if(Xo(n),(e=lt)?(e=ip(e,pn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ar!==null?{id:Tn,overflow:En}:null,retryLane:536870912,hydrationErrors:null},a=Nf(e),a.return=n,n.child=a,It=n,lt=null)):e=null,e===null)throw sr(n);return n.lanes=536870912,null}return Vl(n,s)}var m=e.memoizedState;if(m!==null){var b=m.dehydrated;if(Xo(n),f)if(n.flags&256)n.flags&=-257,n=Ph(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(l(558));else if(xt||wi(e,n,a,!1),f=(a&e.childLanes)!==0,xt||f){if(s=rt,s!==null&&(b=zd(s,a),b!==0&&b!==m.retryLane))throw m.retryLane=b,Br(e,b),Xt(s,e,b),gu;ns(),n=Ph(e,n,a)}else e=m.treeContext,lt=yn(b.nextSibling),It=n,qe=!0,lr=null,pn=!1,e!==null&&Df(n,e),n=Vl(n,s),n.flags|=4096;return n}return e=Bn(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Pl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function yu(e,n,a,s,f){return Gr(n),a=Zo(e,n,a,s,void 0,f),s=Jo(),e!==null&&!xt?(Wo(e,n,f),Fn(e,n,f)):(qe&&s&&Do(n),n.flags|=1,Ot(e,n,a,f),n.child)}function Yh(e,n,a,s,f,m){return Gr(n),n.updateQueue=null,a=Qf(n,s,a,f),Xf(e),s=Jo(),e!==null&&!xt?(Wo(e,n,m),Fn(e,n,m)):(qe&&s&&Do(n),n.flags|=1,Ot(e,n,a,m),n.child)}function Kh(e,n,a,s,f){if(Gr(n),n.stateNode===null){var m=bi,b=a.contextType;typeof b=="object"&&b!==null&&(m=Dt(b)),m=new a(s,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=mu,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=s,m.state=n.memoizedState,m.refs={},$o(n),b=a.contextType,m.context=typeof b=="object"&&b!==null?Dt(b):bi,m.state=n.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(hu(n,a,b,s),m.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&mu.enqueueReplaceState(m,m.state,null),wa(n,s,m,f),ka(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){m=n.stateNode;var j=n.memoizedProps,L=Kr(a,j);m.props=L;var Z=m.context,le=a.contextType;b=bi,typeof le=="object"&&le!==null&&(b=Dt(le));var ue=a.getDerivedStateFromProps;le=typeof ue=="function"||typeof m.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,le||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(j||Z!==b)&&Mh(n,m,s,b),ur=!1;var W=n.memoizedState;m.state=W,wa(n,s,m,f),ka(),Z=n.memoizedState,j||W!==Z||ur?(typeof ue=="function"&&(hu(n,a,ue,s),Z=n.memoizedState),(L=ur||Oh(n,a,L,s,W,Z,b))?(le||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(n.flags|=4194308)):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=Z),m.props=s,m.state=Z,m.context=b,s=L):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{m=n.stateNode,Fo(e,n),b=n.memoizedProps,le=Kr(a,b),m.props=le,ue=n.pendingProps,W=m.context,Z=a.contextType,L=bi,typeof Z=="object"&&Z!==null&&(L=Dt(Z)),j=a.getDerivedStateFromProps,(Z=typeof j=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==ue||W!==L)&&Mh(n,m,s,L),ur=!1,W=n.memoizedState,m.state=W,wa(n,s,m,f),ka();var ee=n.memoizedState;b!==ue||W!==ee||ur||e!==null&&e.dependencies!==null&&Tl(e.dependencies)?(typeof j=="function"&&(hu(n,a,j,s),ee=n.memoizedState),(le=ur||Oh(n,a,le,s,W,ee,L)||e!==null&&e.dependencies!==null&&Tl(e.dependencies))?(Z||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(s,ee,L),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(s,ee,L)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=ee),m.props=s,m.state=ee,m.context=L,s=le):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&W===e.memoizedState||(n.flags|=1024),s=!1)}return m=s,Pl(e,n),s=(n.flags&128)!==0,m||s?(m=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,e!==null&&s?(n.child=Pr(n,e.child,null,f),n.child=Pr(n,null,a,f)):Ot(e,n,a,f),n.memoizedState=m.state,e=n.child):e=Fn(e,n,f),e}function Xh(e,n,a,s){return Ur(),n.flags|=256,Ot(e,n,a,s),n.child}var vu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bu(e){return{baseLanes:e,cachePool:Bf()}}function xu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=an),e}function Qh(e,n,a){var s=n.pendingProps,f=!1,m=(n.flags&128)!==0,b;if((b=m)||(b=e!==null&&e.memoizedState===null?!1:(mt.current&2)!==0),b&&(f=!0,n.flags&=-129),b=(n.flags&32)!==0,n.flags&=-33,e===null){if(qe){if(f?fr(n):hr(),(e=lt)?(e=ip(e,pn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ar!==null?{id:Tn,overflow:En}:null,retryLane:536870912,hydrationErrors:null},a=Nf(e),a.return=n,n.child=a,It=n,lt=null)):e=null,e===null)throw sr(n);return nc(e)?n.lanes=32:n.lanes=536870912,null}var j=s.children;return s=s.fallback,f?(hr(),f=n.mode,j=Yl({mode:"hidden",children:j},f),s=Hr(s,f,a,null),j.return=n,s.return=n,j.sibling=s,n.child=j,s=n.child,s.memoizedState=bu(a),s.childLanes=xu(e,b,a),n.memoizedState=vu,Ea(null,s)):(fr(n),Su(n,j))}var L=e.memoizedState;if(L!==null&&(j=L.dehydrated,j!==null)){if(m)n.flags&256?(fr(n),n.flags&=-257,n=ku(e,n,a)):n.memoizedState!==null?(hr(),n.child=e.child,n.flags|=128,n=null):(hr(),j=s.fallback,f=n.mode,s=Yl({mode:"visible",children:s.children},f),j=Hr(j,f,a,null),j.flags|=2,s.return=n,j.return=n,s.sibling=j,n.child=s,Pr(n,e.child,null,a),s=n.child,s.memoizedState=bu(a),s.childLanes=xu(e,b,a),n.memoizedState=vu,n=Ea(null,s));else if(fr(n),nc(j)){if(b=j.nextSibling&&j.nextSibling.dataset,b)var Z=b.dgst;b=Z,s=Error(l(419)),s.stack="",s.digest=b,ga({value:s,source:null,stack:null}),n=ku(e,n,a)}else if(xt||wi(e,n,a,!1),b=(a&e.childLanes)!==0,xt||b){if(b=rt,b!==null&&(s=zd(b,a),s!==0&&s!==L.retryLane))throw L.retryLane=s,Br(e,s),Xt(b,e,s),gu;tc(j)||ns(),n=ku(e,n,a)}else tc(j)?(n.flags|=192,n.child=e.child,n=null):(e=L.treeContext,lt=yn(j.nextSibling),It=n,qe=!0,lr=null,pn=!1,e!==null&&Df(n,e),n=Su(n,s.children),n.flags|=4096);return n}return f?(hr(),j=s.fallback,f=n.mode,L=e.child,Z=L.sibling,s=Bn(L,{mode:"hidden",children:s.children}),s.subtreeFlags=L.subtreeFlags&65011712,Z!==null?j=Bn(Z,j):(j=Hr(j,f,a,null),j.flags|=2),j.return=n,s.return=n,s.sibling=j,n.child=s,Ea(null,s),s=n.child,j=e.child.memoizedState,j===null?j=bu(a):(f=j.cachePool,f!==null?(L=vt._currentValue,f=f.parent!==L?{parent:L,pool:L}:f):f=Bf(),j={baseLanes:j.baseLanes|a,cachePool:f}),s.memoizedState=j,s.childLanes=xu(e,b,a),n.memoizedState=vu,Ea(e.child,s)):(fr(n),a=e.child,e=a.sibling,a=Bn(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(b=n.deletions,b===null?(n.deletions=[e],n.flags|=16):b.push(e)),n.child=a,n.memoizedState=null,a)}function Su(e,n){return n=Yl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Yl(e,n){return e=en(22,e,null,n),e.lanes=0,e}function ku(e,n,a){return Pr(n,e.child,null,a),e=Su(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Zh(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),Lo(e.return,n,a)}function wu(e,n,a,s,f,m){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:f,treeForkCount:m}:(b.isBackwards=n,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=a,b.tailMode=f,b.treeForkCount=m)}function Jh(e,n,a){var s=n.pendingProps,f=s.revealOrder,m=s.tail;s=s.children;var b=mt.current,j=(b&2)!==0;if(j?(b=b&1|2,n.flags|=128):b&=1,C(mt,b),Ot(e,n,s,a),s=qe?pa:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zh(e,a,n);else if(e.tag===19)Zh(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=n.child,f=null;a!==null;)e=a.alternate,e!==null&&zl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),wu(n,!1,f,a,m,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&zl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}wu(n,!0,a,null,m,s);break;case"together":wu(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Fn(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),gr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(wi(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(l(153));if(n.child!==null){for(e=n.child,a=Bn(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Bn(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Cu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Tl(e)))}function rx(e,n,a){switch(n.tag){case 3:he(n,n.stateNode.containerInfo),or(n,vt,e.memoizedState.cache),Ur();break;case 27:case 5:ye(n);break;case 4:he(n,n.stateNode.containerInfo);break;case 10:or(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Xo(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(fr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Qh(e,n,a):(fr(n),e=Fn(e,n,a),e!==null?e.sibling:null);fr(n);break;case 19:var f=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(wi(e,n,a,!1),s=(a&n.childLanes)!==0),f){if(s)return Jh(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),C(mt,mt.current),s)break;return null;case 22:return n.lanes=0,Fh(e,n,a,n.pendingProps);case 24:or(n,vt,e.memoizedState.cache)}return Fn(e,n,a)}function Wh(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)xt=!0;else{if(!Cu(e,a)&&(n.flags&128)===0)return xt=!1,rx(e,n,a);xt=(e.flags&131072)!==0}else xt=!1,qe&&(n.flags&1048576)!==0&&If(n,pa,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=Fr(n.elementType),n.type=e,typeof e=="function")No(e)?(s=Kr(e,s),n.tag=1,n=Kh(null,n,e,s,a)):(n.tag=0,n=yu(null,n,e,s,a));else{if(e!=null){var f=e.$$typeof;if(f===G){n.tag=11,n=qh(null,n,e,s,a);break e}else if(f===$){n.tag=14,n=Gh(null,n,e,s,a);break e}}throw n=X(e)||e,Error(l(306,n,""))}}return n;case 0:return yu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,f=Kr(s,n.pendingProps),Kh(e,n,s,f,a);case 3:e:{if(he(n,n.stateNode.containerInfo),e===null)throw Error(l(387));s=n.pendingProps;var m=n.memoizedState;f=m.element,Fo(e,n),wa(n,s,null,a);var b=n.memoizedState;if(s=b.cache,or(n,vt,s),s!==m.cache&&Bo(n,[vt],a,!0),ka(),s=b.element,m.isDehydrated)if(m={element:s,isDehydrated:!1,cache:b.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=Xh(e,n,s,a);break e}else if(s!==f){f=fn(Error(l(424)),n),ga(f),n=Xh(e,n,s,a);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,lt=yn(e.firstChild),It=n,qe=!0,lr=null,pn=!0,a=Ff(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Ur(),s===f){n=Fn(e,n,a);break e}Ot(e,n,s,a)}n=n.child}return n;case 26:return Pl(e,n),e===null?(a=cp(n.type,null,n.pendingProps,null))?n.memoizedState=a:qe||(a=n.type,e=n.pendingProps,s=us(V.current).createElement(a),s[At]=n,s[$t]=e,Mt(s,a,e),Et(s),n.stateNode=s):n.memoizedState=cp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ye(n),e===null&&qe&&(s=n.stateNode=sp(n.type,n.pendingProps,V.current),It=n,pn=!0,f=lt,Sr(n.type)?(rc=f,lt=yn(s.firstChild)):lt=f),Ot(e,n,n.pendingProps.children,a),Pl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&qe&&((f=s=lt)&&(s=Ox(s,n.type,n.pendingProps,pn),s!==null?(n.stateNode=s,It=n,lt=yn(s.firstChild),pn=!1,f=!0):f=!1),f||sr(n)),ye(n),f=n.type,m=n.pendingProps,b=e!==null?e.memoizedProps:null,s=m.children,Ju(f,m)?s=null:b!==null&&Ju(f,b)&&(n.flags|=32),n.memoizedState!==null&&(f=Zo(e,n,Kb,null,null,a),$a._currentValue=f),Pl(e,n),Ot(e,n,s,a),n.child;case 6:return e===null&&qe&&((e=a=lt)&&(a=Mx(a,n.pendingProps,pn),a!==null?(n.stateNode=a,It=n,lt=null,e=!0):e=!1),e||sr(n)),null;case 13:return Qh(e,n,a);case 4:return he(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=Pr(n,null,s,a):Ot(e,n,s,a),n.child;case 11:return qh(e,n,n.type,n.pendingProps,a);case 7:return Ot(e,n,n.pendingProps,a),n.child;case 8:return Ot(e,n,n.pendingProps.children,a),n.child;case 12:return Ot(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,or(n,n.type,s.value),Ot(e,n,s.children,a),n.child;case 9:return f=n.type._context,s=n.pendingProps.children,Gr(n),f=Dt(f),s=s(f),n.flags|=1,Ot(e,n,s,a),n.child;case 14:return Gh(e,n,n.type,n.pendingProps,a);case 15:return $h(e,n,n.type,n.pendingProps,a);case 19:return Jh(e,n,a);case 31:return nx(e,n,a);case 22:return Fh(e,n,a,n.pendingProps);case 24:return Gr(n),s=Dt(vt),e===null?(f=qo(),f===null&&(f=rt,m=Ho(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:s,cache:f},$o(n),or(n,vt,f)):((e.lanes&a)!==0&&(Fo(e,n),wa(n,null,null,a),ka()),f=e.memoizedState,m=n.memoizedState,f.parent!==s?(f={parent:s,cache:s},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),or(n,vt,s)):(s=m.cache,or(n,vt,s),s!==f.cache&&Bo(n,[vt],a,!0))),Ot(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(l(156,n.tag))}function Vn(e){e.flags|=4}function ju(e,n,a,s,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Rm())e.flags|=8192;else throw Vr=Il,Go}else e.flags&=-16777217}function em(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!pp(n))if(Rm())e.flags|=8192;else throw Vr=Il,Go}function Kl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Dd():536870912,e.lanes|=n,zi|=n)}function Na(e,n){if(!qe)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function st(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,s|=f.subtreeFlags&65011712,s|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,s|=f.subtreeFlags,s|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function ix(e,n,a){var s=n.pendingProps;switch(Oo(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return st(n),null;case 1:return st(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),qn(vt),me(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(ki(n)?Vn(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,zo())),st(n),null;case 26:var f=n.type,m=n.memoizedState;return e===null?(Vn(n),m!==null?(st(n),em(n,m)):(st(n),ju(n,f,null,s,a))):m?m!==e.memoizedState?(Vn(n),st(n),em(n,m)):(st(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Vn(n),st(n),ju(n,f,e,s,a)),null;case 27:if(Re(n),a=V.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Vn(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return st(n),null}e=ie.current,ki(n)?Of(n):(e=sp(f,s,a),n.stateNode=e,Vn(n))}return st(n),null;case 5:if(Re(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Vn(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return st(n),null}if(m=ie.current,ki(n))Of(n);else{var b=us(V.current);switch(m){case 1:m=b.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=b.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=b.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?m.multiple=!0:s.size&&(m.size=s.size);break;default:m=typeof s.is=="string"?b.createElement(f,{is:s.is}):b.createElement(f)}}m[At]=n,m[$t]=s;e:for(b=n.child;b!==null;){if(b.tag===5||b.tag===6)m.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===n)break e;for(;b.sibling===null;){if(b.return===null||b.return===n)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}n.stateNode=m;e:switch(Mt(m,f,s),f){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Vn(n)}}return st(n),ju(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Vn(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(l(166));if(e=V.current,ki(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,f=It,f!==null)switch(f.tag){case 27:case 5:s=f.memoizedProps}e[At]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Qm(e.nodeValue,a)),e||sr(n,!0)}else e=us(e).createTextNode(s),e[At]=n,n.stateNode=e}return st(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=ki(n),a!==null){if(e===null){if(!s)throw Error(l(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[At]=n}else Ur(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;st(n),e=!1}else a=zo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(nn(n),n):(nn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return st(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=ki(n),s!==null&&s.dehydrated!==null){if(e===null){if(!f)throw Error(l(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[At]=n}else Ur(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;st(n),f=!1}else f=zo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(nn(n),n):(nn(n),null)}return nn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,f=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(f=s.alternate.memoizedState.cachePool.pool),m=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(m=s.memoizedState.cachePool.pool),m!==f&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Kl(n,n.updateQueue),st(n),null);case 4:return me(),e===null&&Yu(n.stateNode.containerInfo),st(n),null;case 10:return qn(n.type),st(n),null;case 19:if(z(mt),s=n.memoizedState,s===null)return st(n),null;if(f=(n.flags&128)!==0,m=s.rendering,m===null)if(f)Na(s,!1);else{if(ft!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=zl(e),m!==null){for(n.flags|=128,Na(s,!1),e=m.updateQueue,n.updateQueue=e,Kl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Ef(a,e),a=a.sibling;return C(mt,mt.current&1|2),qe&&Hn(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&Xe()>Wl&&(n.flags|=128,f=!0,Na(s,!1),n.lanes=4194304)}else{if(!f)if(e=zl(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Kl(n,e),Na(s,!0),s.tail===null&&s.tailMode==="hidden"&&!m.alternate&&!qe)return st(n),null}else 2*Xe()-s.renderingStartTime>Wl&&a!==536870912&&(n.flags|=128,f=!0,Na(s,!1),n.lanes=4194304);s.isBackwards?(m.sibling=n.child,n.child=m):(e=s.last,e!==null?e.sibling=m:n.child=m,s.last=m)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Xe(),e.sibling=null,a=mt.current,C(mt,f?a&1|2:a&1),qe&&Hn(n,s.treeForkCount),e):(st(n),null);case 22:case 23:return nn(n),Ko(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(st(n),n.subtreeFlags&6&&(n.flags|=8192)):st(n),a=n.updateQueue,a!==null&&Kl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&z($r),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),qn(vt),st(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function ax(e,n){switch(Oo(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return qn(vt),me(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Re(n),null;case 31:if(n.memoizedState!==null){if(nn(n),n.alternate===null)throw Error(l(340));Ur()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(nn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));Ur()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return z(mt),null;case 4:return me(),null;case 10:return qn(n.type),null;case 22:case 23:return nn(n),Ko(),e!==null&&z($r),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return qn(vt),null;case 25:return null;default:return null}}function tm(e,n){switch(Oo(n),n.tag){case 3:qn(vt),me();break;case 26:case 27:case 5:Re(n);break;case 4:me();break;case 31:n.memoizedState!==null&&nn(n);break;case 13:nn(n);break;case 19:z(mt);break;case 10:qn(n.type);break;case 22:case 23:nn(n),Ko(),e!==null&&z($r);break;case 24:qn(vt)}}function Aa(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var f=s.next;a=f;do{if((a.tag&e)===e){s=void 0;var m=a.create,b=a.inst;s=m(),b.destroy=s}a=a.next}while(a!==f)}}catch(j){We(n,n.return,j)}}function mr(e,n,a){try{var s=n.updateQueue,f=s!==null?s.lastEffect:null;if(f!==null){var m=f.next;s=m;do{if((s.tag&e)===e){var b=s.inst,j=b.destroy;if(j!==void 0){b.destroy=void 0,f=n;var L=a,Z=j;try{Z()}catch(le){We(f,L,le)}}}s=s.next}while(s!==m)}}catch(le){We(n,n.return,le)}}function nm(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Pf(n,a)}catch(s){We(e,e.return,s)}}}function rm(e,n,a){a.props=Kr(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){We(e,n,s)}}function Ia(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(f){We(e,n,f)}}function Nn(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(f){We(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){We(e,n,f)}else a.current=null}function im(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(f){We(e,e.return,f)}}function Ru(e,n,a){try{var s=e.stateNode;Tx(s,e.type,a,n),s[$t]=n}catch(f){We(e,e.return,f)}}function am(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sr(e.type)||e.tag===4}function Tu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||am(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&&Sr(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 Eu(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=_n));else if(s!==4&&(s===27&&Sr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Eu(e,n,a),e=e.sibling;e!==null;)Eu(e,n,a),e=e.sibling}function Xl(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&Sr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Xl(e,n,a),e=e.sibling;e!==null;)Xl(e,n,a),e=e.sibling}function lm(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Mt(n,s,a),n[At]=e,n[$t]=a}catch(m){We(e,e.return,m)}}var Pn=!1,St=!1,Nu=!1,sm=typeof WeakSet=="function"?WeakSet:Set,Nt=null;function lx(e,n){if(e=e.containerInfo,Qu=gs,e=bf(e),ko(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var f=s.anchorOffset,m=s.focusNode;s=s.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var b=0,j=-1,L=-1,Z=0,le=0,ue=e,W=null;t:for(;;){for(var ee;ue!==a||f!==0&&ue.nodeType!==3||(j=b+f),ue!==m||s!==0&&ue.nodeType!==3||(L=b+s),ue.nodeType===3&&(b+=ue.nodeValue.length),(ee=ue.firstChild)!==null;)W=ue,ue=ee;for(;;){if(ue===e)break t;if(W===a&&++Z===f&&(j=b),W===m&&++le===s&&(L=b),(ee=ue.nextSibling)!==null)break;ue=W,W=ue.parentNode}ue=ee}a=j===-1||L===-1?null:{start:j,end:L}}else a=null}a=a||{start:0,end:0}}else a=null;for(Zu={focusedElem:e,selectionRange:a},gs=!1,Nt=n;Nt!==null;)if(n=Nt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Nt=e;else for(;Nt!==null;){switch(n=Nt,m=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&m!==null){e=void 0,a=n,f=m.memoizedProps,m=m.memoizedState,s=a.stateNode;try{var ve=Kr(a.type,f);e=s.getSnapshotBeforeUpdate(ve,m),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){We(a,a.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)ec(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ec(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(l(163))}if(e=n.sibling,e!==null){e.return=n.return,Nt=e;break}Nt=n.return}}function om(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Kn(e,a),s&4&&Aa(5,a);break;case 1:if(Kn(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(b){We(a,a.return,b)}else{var f=Kr(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(b){We(a,a.return,b)}}s&64&&nm(a),s&512&&Ia(a,a.return);break;case 3:if(Kn(e,a),s&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Pf(e,n)}catch(b){We(a,a.return,b)}}break;case 27:n===null&&s&4&&lm(a);case 26:case 5:Kn(e,a),n===null&&s&4&&im(a),s&512&&Ia(a,a.return);break;case 12:Kn(e,a);break;case 31:Kn(e,a),s&4&&dm(e,a);break;case 13:Kn(e,a),s&4&&fm(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=px.bind(null,a),zx(e,a))));break;case 22:if(s=a.memoizedState!==null||Pn,!s){n=n!==null&&n.memoizedState!==null||St,f=Pn;var m=St;Pn=s,(St=n)&&!m?Xn(e,a,(a.subtreeFlags&8772)!==0):Kn(e,a),Pn=f,St=m}break;case 30:break;default:Kn(e,a)}}function um(e){var n=e.alternate;n!==null&&(e.alternate=null,um(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&io(n)),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 ot=null,Vt=!1;function Yn(e,n,a){for(a=a.child;a!==null;)cm(e,n,a),a=a.sibling}function cm(e,n,a){if(we&&typeof we.onCommitFiberUnmount=="function")try{we.onCommitFiberUnmount(je,a)}catch{}switch(a.tag){case 26:St||Nn(a,n),Yn(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:St||Nn(a,n);var s=ot,f=Vt;Sr(a.type)&&(ot=a.stateNode,Vt=!1),Yn(e,n,a),Ua(a.stateNode),ot=s,Vt=f;break;case 5:St||Nn(a,n);case 6:if(s=ot,f=Vt,ot=null,Yn(e,n,a),ot=s,Vt=f,ot!==null)if(Vt)try{(ot.nodeType===9?ot.body:ot.nodeName==="HTML"?ot.ownerDocument.body:ot).removeChild(a.stateNode)}catch(m){We(a,n,m)}else try{ot.removeChild(a.stateNode)}catch(m){We(a,n,m)}break;case 18:ot!==null&&(Vt?(e=ot,np(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),$i(e)):np(ot,a.stateNode));break;case 4:s=ot,f=Vt,ot=a.stateNode.containerInfo,Vt=!0,Yn(e,n,a),ot=s,Vt=f;break;case 0:case 11:case 14:case 15:mr(2,a,n),St||mr(4,a,n),Yn(e,n,a);break;case 1:St||(Nn(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&rm(a,n,s)),Yn(e,n,a);break;case 21:Yn(e,n,a);break;case 22:St=(s=St)||a.memoizedState!==null,Yn(e,n,a),St=s;break;default:Yn(e,n,a)}}function dm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{$i(e)}catch(a){We(n,n.return,a)}}}function fm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{$i(e)}catch(a){We(n,n.return,a)}}function sx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new sm),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new sm),n;default:throw Error(l(435,e.tag))}}function Ql(e,n){var a=sx(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var f=gx.bind(null,e,s);s.then(f,f)}})}function Pt(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var f=a[s],m=e,b=n,j=b;e:for(;j!==null;){switch(j.tag){case 27:if(Sr(j.type)){ot=j.stateNode,Vt=!1;break e}break;case 5:ot=j.stateNode,Vt=!1;break e;case 3:case 4:ot=j.stateNode.containerInfo,Vt=!0;break e}j=j.return}if(ot===null)throw Error(l(160));cm(m,b,f),ot=null,Vt=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)hm(n,e),n=n.sibling}var kn=null;function hm(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Pt(n,e),Yt(e),s&4&&(mr(3,e,e.return),Aa(3,e),mr(5,e,e.return));break;case 1:Pt(n,e),Yt(e),s&512&&(St||a===null||Nn(a,a.return)),s&64&&Pn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var f=kn;if(Pt(n,e),Yt(e),s&512&&(St||a===null||Nn(a,a.return)),s&4){var m=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(s){case"title":m=f.getElementsByTagName("title")[0],(!m||m[ia]||m[At]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(s),f.head.insertBefore(m,f.querySelector("head > title"))),Mt(m,s,a),m[At]=e,Et(m),s=m;break e;case"link":var b=hp("link","href",f).get(s+(a.href||""));if(b){for(var j=0;j<b.length;j++)if(m=b[j],m.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&m.getAttribute("rel")===(a.rel==null?null:a.rel)&&m.getAttribute("title")===(a.title==null?null:a.title)&&m.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){b.splice(j,1);break t}}m=f.createElement(s),Mt(m,s,a),f.head.appendChild(m);break;case"meta":if(b=hp("meta","content",f).get(s+(a.content||""))){for(j=0;j<b.length;j++)if(m=b[j],m.getAttribute("content")===(a.content==null?null:""+a.content)&&m.getAttribute("name")===(a.name==null?null:a.name)&&m.getAttribute("property")===(a.property==null?null:a.property)&&m.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&m.getAttribute("charset")===(a.charSet==null?null:a.charSet)){b.splice(j,1);break t}}m=f.createElement(s),Mt(m,s,a),f.head.appendChild(m);break;default:throw Error(l(468,s))}m[At]=e,Et(m),s=m}e.stateNode=s}else mp(f,e.type,e.stateNode);else e.stateNode=fp(f,s,e.memoizedProps);else m!==s?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,s===null?mp(f,e.type,e.stateNode):fp(f,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Ru(e,e.memoizedProps,a.memoizedProps)}break;case 27:Pt(n,e),Yt(e),s&512&&(St||a===null||Nn(a,a.return)),a!==null&&s&4&&Ru(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Pt(n,e),Yt(e),s&512&&(St||a===null||Nn(a,a.return)),e.flags&32){f=e.stateNode;try{fi(f,"")}catch(ve){We(e,e.return,ve)}}s&4&&e.stateNode!=null&&(f=e.memoizedProps,Ru(e,f,a!==null?a.memoizedProps:f)),s&1024&&(Nu=!0);break;case 6:if(Pt(n,e),Yt(e),s&4){if(e.stateNode===null)throw Error(l(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(ve){We(e,e.return,ve)}}break;case 3:if(fs=null,f=kn,kn=cs(n.containerInfo),Pt(n,e),kn=f,Yt(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{$i(n.containerInfo)}catch(ve){We(e,e.return,ve)}Nu&&(Nu=!1,mm(e));break;case 4:s=kn,kn=cs(e.stateNode.containerInfo),Pt(n,e),Yt(e),kn=s;break;case 12:Pt(n,e),Yt(e);break;case 31:Pt(n,e),Yt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ql(e,s)));break;case 13:Pt(n,e),Yt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Jl=Xe()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ql(e,s)));break;case 22:f=e.memoizedState!==null;var L=a!==null&&a.memoizedState!==null,Z=Pn,le=St;if(Pn=Z||f,St=le||L,Pt(n,e),St=le,Pn=Z,Yt(e),s&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||L||Pn||St||Xr(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){L=a=n;try{if(m=L.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{j=L.stateNode;var ue=L.memoizedProps.style,W=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;j.style.display=W==null||typeof W=="boolean"?"":(""+W).trim()}}catch(ve){We(L,L.return,ve)}}}else if(n.tag===6){if(a===null){L=n;try{L.stateNode.nodeValue=f?"":L.memoizedProps}catch(ve){We(L,L.return,ve)}}}else if(n.tag===18){if(a===null){L=n;try{var ee=L.stateNode;f?rp(ee,!0):rp(L.stateNode,!1)}catch(ve){We(L,L.return,ve)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Ql(e,a))));break;case 19:Pt(n,e),Yt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ql(e,s)));break;case 30:break;case 21:break;default:Pt(n,e),Yt(e)}}function Yt(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(am(s)){a=s;break}s=s.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var f=a.stateNode,m=Tu(e);Xl(e,m,f);break;case 5:var b=a.stateNode;a.flags&32&&(fi(b,""),a.flags&=-33);var j=Tu(e);Xl(e,j,b);break;case 3:case 4:var L=a.stateNode.containerInfo,Z=Tu(e);Eu(e,Z,L);break;default:throw Error(l(161))}}catch(le){We(e,e.return,le)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function mm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;mm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Kn(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)om(e,n.alternate,n),n=n.sibling}function Xr(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:mr(4,n,n.return),Xr(n);break;case 1:Nn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&rm(n,n.return,a),Xr(n);break;case 27:Ua(n.stateNode);case 26:case 5:Nn(n,n.return),Xr(n);break;case 22:n.memoizedState===null&&Xr(n);break;case 30:Xr(n);break;default:Xr(n)}e=e.sibling}}function Xn(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,f=e,m=n,b=m.flags;switch(m.tag){case 0:case 11:case 15:Xn(f,m,a),Aa(4,m);break;case 1:if(Xn(f,m,a),s=m,f=s.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(Z){We(s,s.return,Z)}if(s=m,f=s.updateQueue,f!==null){var j=s.stateNode;try{var L=f.shared.hiddenCallbacks;if(L!==null)for(f.shared.hiddenCallbacks=null,f=0;f<L.length;f++)Vf(L[f],j)}catch(Z){We(s,s.return,Z)}}a&&b&64&&nm(m),Ia(m,m.return);break;case 27:lm(m);case 26:case 5:Xn(f,m,a),a&&s===null&&b&4&&im(m),Ia(m,m.return);break;case 12:Xn(f,m,a);break;case 31:Xn(f,m,a),a&&b&4&&dm(f,m);break;case 13:Xn(f,m,a),a&&b&4&&fm(f,m);break;case 22:m.memoizedState===null&&Xn(f,m,a),Ia(m,m.return);break;case 30:break;default:Xn(f,m,a)}n=n.sibling}}function Au(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ya(a))}function Iu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ya(e))}function wn(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)pm(e,n,a,s),n=n.sibling}function pm(e,n,a,s){var f=n.flags;switch(n.tag){case 0:case 11:case 15:wn(e,n,a,s),f&2048&&Aa(9,n);break;case 1:wn(e,n,a,s);break;case 3:wn(e,n,a,s),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ya(e)));break;case 12:if(f&2048){wn(e,n,a,s),e=n.stateNode;try{var m=n.memoizedProps,b=m.id,j=m.onPostCommit;typeof j=="function"&&j(b,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){We(n,n.return,L)}}else wn(e,n,a,s);break;case 31:wn(e,n,a,s);break;case 13:wn(e,n,a,s);break;case 23:break;case 22:m=n.stateNode,b=n.alternate,n.memoizedState!==null?m._visibility&2?wn(e,n,a,s):Da(e,n):m._visibility&2?wn(e,n,a,s):(m._visibility|=2,Di(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Au(b,n);break;case 24:wn(e,n,a,s),f&2048&&Iu(n.alternate,n);break;default:wn(e,n,a,s)}}function Di(e,n,a,s,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=e,b=n,j=a,L=s,Z=b.flags;switch(b.tag){case 0:case 11:case 15:Di(m,b,j,L,f),Aa(8,b);break;case 23:break;case 22:var le=b.stateNode;b.memoizedState!==null?le._visibility&2?Di(m,b,j,L,f):Da(m,b):(le._visibility|=2,Di(m,b,j,L,f)),f&&Z&2048&&Au(b.alternate,b);break;case 24:Di(m,b,j,L,f),f&&Z&2048&&Iu(b.alternate,b);break;default:Di(m,b,j,L,f)}n=n.sibling}}function Da(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,f=s.flags;switch(s.tag){case 22:Da(a,s),f&2048&&Au(s.alternate,s);break;case 24:Da(a,s),f&2048&&Iu(s.alternate,s);break;default:Da(a,s)}n=n.sibling}}var Oa=8192;function Oi(e,n,a){if(e.subtreeFlags&Oa)for(e=e.child;e!==null;)gm(e,n,a),e=e.sibling}function gm(e,n,a){switch(e.tag){case 26:Oi(e,n,a),e.flags&Oa&&e.memoizedState!==null&&Yx(a,kn,e.memoizedState,e.memoizedProps);break;case 5:Oi(e,n,a);break;case 3:case 4:var s=kn;kn=cs(e.stateNode.containerInfo),Oi(e,n,a),kn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Oa,Oa=16777216,Oi(e,n,a),Oa=s):Oi(e,n,a));break;default:Oi(e,n,a)}}function ym(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ma(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];Nt=s,bm(s,e)}ym(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)vm(e),e=e.sibling}function vm(e){switch(e.tag){case 0:case 11:case 15:Ma(e),e.flags&2048&&mr(9,e,e.return);break;case 3:Ma(e);break;case 12:Ma(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Zl(e)):Ma(e);break;default:Ma(e)}}function Zl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];Nt=s,bm(s,e)}ym(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:mr(8,n,n.return),Zl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Zl(n));break;default:Zl(n)}e=e.sibling}}function bm(e,n){for(;Nt!==null;){var a=Nt;switch(a.tag){case 0:case 11:case 15:mr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:ya(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,Nt=s;else e:for(a=e;Nt!==null;){s=Nt;var f=s.sibling,m=s.return;if(um(s),s===a){Nt=null;break e}if(f!==null){f.return=m,Nt=f;break e}Nt=m}}}var ox={getCacheForType:function(e){var n=Dt(vt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Dt(vt).controller.signal}},ux=typeof WeakMap=="function"?WeakMap:Map,Qe=0,rt=null,_e=null,He=0,Je=0,rn=null,pr=!1,Mi=!1,Du=!1,Qn=0,ft=0,gr=0,Qr=0,Ou=0,an=0,zi=0,za=null,Kt=null,Mu=!1,Jl=0,xm=0,Wl=1/0,es=null,yr=null,Ct=0,vr=null,_i=null,Zn=0,zu=0,_u=null,Sm=null,_a=0,Lu=null;function ln(){return(Qe&2)!==0&&He!==0?He&-He:I.T!==null?$u():_d()}function km(){if(an===0)if((He&536870912)===0||qe){var e=Dr;Dr<<=1,(Dr&3932160)===0&&(Dr=262144),an=e}else an=536870912;return e=tn.current,e!==null&&(e.flags|=32),an}function Xt(e,n,a){(e===rt&&(Je===2||Je===9)||e.cancelPendingCommit!==null)&&(Li(e,0),br(e,He,an,!1)),ra(e,a),((Qe&2)===0||e!==rt)&&(e===rt&&((Qe&2)===0&&(Qr|=a),ft===4&&br(e,He,an,!1)),An(e))}function wm(e,n,a){if((Qe&6)!==0)throw Error(l(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||na(e,n),f=s?fx(e,n):Hu(e,n,!0),m=s;do{if(f===0){Mi&&!s&&br(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!cx(a)){f=Hu(e,n,!1),m=!1;continue}if(f===2){if(m=n,e.errorRecoveryDisabledLanes&m)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){n=b;e:{var j=e;f=za;var L=j.current.memoizedState.isDehydrated;if(L&&(Li(j,b).flags|=256),b=Hu(j,b,!1),b!==2){if(Du&&!L){j.errorRecoveryDisabledLanes|=m,Qr|=m,f=4;break e}m=Kt,Kt=f,m!==null&&(Kt===null?Kt=m:Kt.push.apply(Kt,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){Li(e,0),br(e,n,0,!0);break}e:{switch(s=e,m=f,m){case 0:case 1:throw Error(l(345));case 4:if((n&4194048)!==n)break;case 6:br(s,n,an,!pr);break e;case 2:Kt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(f=Jl+300-Xe(),10<f)){if(br(s,n,an,!pr),cl(s,0,!0)!==0)break e;Zn=n,s.timeoutHandle=ep(Cm.bind(null,s,a,Kt,es,Mu,n,an,Qr,zi,pr,m,"Throttled",-0,0),f);break e}Cm(s,a,Kt,es,Mu,n,an,Qr,zi,pr,m,null,-0,0)}}break}while(!0);An(e)}function Cm(e,n,a,s,f,m,b,j,L,Z,le,ue,W,ee){if(e.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_n},gm(n,m,ue);var ve=(m&62914560)===m?Jl-Xe():(m&4194048)===m?xm-Xe():0;if(ve=Kx(ue,ve),ve!==null){Zn=m,e.cancelPendingCommit=ve(Dm.bind(null,e,n,m,a,s,f,b,j,L,le,ue,null,W,ee)),br(e,m,b,!Z);return}}Dm(e,n,m,a,s,f,b,j,L)}function cx(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var f=a[s],m=f.getSnapshot;f=f.value;try{if(!Wt(m(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function br(e,n,a,s){n&=~Ou,n&=~Qr,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var f=n;0<f;){var m=31-Oe(f),b=1<<m;s[m]=-1,f&=~b}a!==0&&Od(e,a,n)}function ts(){return(Qe&6)===0?(La(0),!1):!0}function Bu(){if(_e!==null){if(Je===0)var e=_e.return;else e=_e,Un=qr=null,eu(e),Ti=null,ba=0,e=_e;for(;e!==null;)tm(e.alternate,e),e=e.return;_e=null}}function Li(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Ax(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Zn=0,Bu(),rt=e,_e=a=Bn(e.current,null),He=n,Je=0,rn=null,pr=!1,Mi=na(e,n),Du=!1,zi=an=Ou=Qr=gr=ft=0,Kt=za=null,Mu=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var f=31-Oe(s),m=1<<f;n|=e[f],s&=~m}return Qn=n,kl(),a}function jm(e,n){Ie=null,I.H=Ta,n===Ri||n===Al?(n=qf(),Je=3):n===Go?(n=qf(),Je=4):Je=n===gu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,rn=n,_e===null&&(ft=1,Fl(e,fn(n,e.current)))}function Rm(){var e=tn.current;return e===null?!0:(He&4194048)===He?gn===null:(He&62914560)===He||(He&536870912)!==0?e===gn:!1}function Tm(){var e=I.H;return I.H=Ta,e===null?Ta:e}function Em(){var e=I.A;return I.A=ox,e}function ns(){ft=4,pr||(He&4194048)!==He&&tn.current!==null||(Mi=!0),(gr&134217727)===0&&(Qr&134217727)===0||rt===null||br(rt,He,an,!1)}function Hu(e,n,a){var s=Qe;Qe|=2;var f=Tm(),m=Em();(rt!==e||He!==n)&&(es=null,Li(e,n)),n=!1;var b=ft;e:do try{if(Je!==0&&_e!==null){var j=_e,L=rn;switch(Je){case 8:Bu(),b=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(n=!0);var Z=Je;if(Je=0,rn=null,Bi(e,j,L,Z),a&&Mi){b=0;break e}break;default:Z=Je,Je=0,rn=null,Bi(e,j,L,Z)}}dx(),b=ft;break}catch(le){jm(e,le)}while(!0);return n&&e.shellSuspendCounter++,Un=qr=null,Qe=s,I.H=f,I.A=m,_e===null&&(rt=null,He=0,kl()),b}function dx(){for(;_e!==null;)Nm(_e)}function fx(e,n){var a=Qe;Qe|=2;var s=Tm(),f=Em();rt!==e||He!==n?(es=null,Wl=Xe()+500,Li(e,n)):Mi=na(e,n);e:do try{if(Je!==0&&_e!==null){n=_e;var m=rn;t:switch(Je){case 1:Je=0,rn=null,Bi(e,n,m,1);break;case 2:case 9:if(Hf(m)){Je=0,rn=null,Am(n);break}n=function(){Je!==2&&Je!==9||rt!==e||(Je=7),An(e)},m.then(n,n);break e;case 3:Je=7;break e;case 4:Je=5;break e;case 7:Hf(m)?(Je=0,rn=null,Am(n)):(Je=0,rn=null,Bi(e,n,m,7));break;case 5:var b=null;switch(_e.tag){case 26:b=_e.memoizedState;case 5:case 27:var j=_e;if(b?pp(b):j.stateNode.complete){Je=0,rn=null;var L=j.sibling;if(L!==null)_e=L;else{var Z=j.return;Z!==null?(_e=Z,rs(Z)):_e=null}break t}}Je=0,rn=null,Bi(e,n,m,5);break;case 6:Je=0,rn=null,Bi(e,n,m,6);break;case 8:Bu(),ft=6;break e;default:throw Error(l(462))}}hx();break}catch(le){jm(e,le)}while(!0);return Un=qr=null,I.H=s,I.A=f,Qe=a,_e!==null?0:(rt=null,He=0,kl(),ft)}function hx(){for(;_e!==null&&!$e();)Nm(_e)}function Nm(e){var n=Wh(e.alternate,e,Qn);e.memoizedProps=e.pendingProps,n===null?rs(e):_e=n}function Am(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Yh(a,n,n.pendingProps,n.type,void 0,He);break;case 11:n=Yh(a,n,n.pendingProps,n.type.render,n.ref,He);break;case 5:eu(n);default:tm(a,n),n=_e=Ef(n,Qn),n=Wh(a,n,Qn)}e.memoizedProps=e.pendingProps,n===null?rs(e):_e=n}function Bi(e,n,a,s){Un=qr=null,eu(n),Ti=null,ba=0;var f=n.return;try{if(tx(e,f,n,a,He)){ft=1,Fl(e,fn(a,e.current)),_e=null;return}}catch(m){if(f!==null)throw _e=f,m;ft=1,Fl(e,fn(a,e.current)),_e=null;return}n.flags&32768?(qe||s===1?e=!0:Mi||(He&536870912)!==0?e=!1:(pr=e=!0,(s===2||s===9||s===3||s===6)&&(s=tn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Im(n,e)):rs(n)}function rs(e){var n=e;do{if((n.flags&32768)!==0){Im(n,pr);return}e=n.return;var a=ix(n.alternate,n,Qn);if(a!==null){_e=a;return}if(n=n.sibling,n!==null){_e=n;return}_e=n=e}while(n!==null);ft===0&&(ft=5)}function Im(e,n){do{var a=ax(e.alternate,e);if(a!==null){a.flags&=32767,_e=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){_e=e;return}_e=e=a}while(e!==null);ft=6,_e=null}function Dm(e,n,a,s,f,m,b,j,L){e.cancelPendingCommit=null;do is();while(Ct!==0);if((Qe&6)!==0)throw Error(l(327));if(n!==null){if(n===e.current)throw Error(l(177));if(m=n.lanes|n.childLanes,m|=To,Pv(e,a,m,b,j,L),e===rt&&(_e=rt=null,He=0),_i=n,vr=e,Zn=a,zu=m,_u=f,Sm=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,yx(xe,function(){return Lm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=I.T,I.T=null,f=H.p,H.p=2,b=Qe,Qe|=4;try{lx(e,n,a)}finally{Qe=b,H.p=f,I.T=s}}Ct=1,Om(),Mm(),zm()}}function Om(){if(Ct===1){Ct=0;var e=vr,n=_i,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var s=H.p;H.p=2;var f=Qe;Qe|=4;try{hm(n,e);var m=Zu,b=bf(e.containerInfo),j=m.focusedElem,L=m.selectionRange;if(b!==j&&j&&j.ownerDocument&&vf(j.ownerDocument.documentElement,j)){if(L!==null&&ko(j)){var Z=L.start,le=L.end;if(le===void 0&&(le=Z),"selectionStart"in j)j.selectionStart=Z,j.selectionEnd=Math.min(le,j.value.length);else{var ue=j.ownerDocument||document,W=ue&&ue.defaultView||window;if(W.getSelection){var ee=W.getSelection(),ve=j.textContent.length,Ce=Math.min(L.start,ve),nt=L.end===void 0?Ce:Math.min(L.end,ve);!ee.extend&&Ce>nt&&(b=nt,nt=Ce,Ce=b);var P=yf(j,Ce),q=yf(j,nt);if(P&&q&&(ee.rangeCount!==1||ee.anchorNode!==P.node||ee.anchorOffset!==P.offset||ee.focusNode!==q.node||ee.focusOffset!==q.offset)){var Q=ue.createRange();Q.setStart(P.node,P.offset),ee.removeAllRanges(),Ce>nt?(ee.addRange(Q),ee.extend(q.node,q.offset)):(Q.setEnd(q.node,q.offset),ee.addRange(Q))}}}}for(ue=[],ee=j;ee=ee.parentNode;)ee.nodeType===1&&ue.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<ue.length;j++){var se=ue[j];se.element.scrollLeft=se.left,se.element.scrollTop=se.top}}gs=!!Qu,Zu=Qu=null}finally{Qe=f,H.p=s,I.T=a}}e.current=n,Ct=2}}function Mm(){if(Ct===2){Ct=0;var e=vr,n=_i,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var s=H.p;H.p=2;var f=Qe;Qe|=4;try{om(e,n.alternate,n)}finally{Qe=f,H.p=s,I.T=a}}Ct=3}}function zm(){if(Ct===4||Ct===3){Ct=0,ut();var e=vr,n=_i,a=Zn,s=Sm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ct=5:(Ct=0,_i=vr=null,_m(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(yr=null),no(a),n=n.stateNode,we&&typeof we.onCommitFiberRoot=="function")try{we.onCommitFiberRoot(je,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=I.T,f=H.p,H.p=2,I.T=null;try{for(var m=e.onRecoverableError,b=0;b<s.length;b++){var j=s[b];m(j.value,{componentStack:j.stack})}}finally{I.T=n,H.p=f}}(Zn&3)!==0&&is(),An(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Lu?_a++:(_a=0,Lu=e):_a=0,La(0)}}function _m(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ya(n)))}function is(){return Om(),Mm(),zm(),Lm()}function Lm(){if(Ct!==5)return!1;var e=vr,n=zu;zu=0;var a=no(Zn),s=I.T,f=H.p;try{H.p=32>a?32:a,I.T=null,a=_u,_u=null;var m=vr,b=Zn;if(Ct=0,_i=vr=null,Zn=0,(Qe&6)!==0)throw Error(l(331));var j=Qe;if(Qe|=4,vm(m.current),pm(m,m.current,b,a),Qe=j,La(0,!1),we&&typeof we.onPostCommitFiberRoot=="function")try{we.onPostCommitFiberRoot(je,m)}catch{}return!0}finally{H.p=f,I.T=s,_m(e,n)}}function Bm(e,n,a){n=fn(a,n),n=pu(e.stateNode,n,2),e=dr(e,n,2),e!==null&&(ra(e,2),An(e))}function We(e,n,a){if(e.tag===3)Bm(e,e,a);else for(;n!==null;){if(n.tag===3){Bm(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(yr===null||!yr.has(s))){e=fn(a,e),a=Hh(2),s=dr(n,a,2),s!==null&&(Uh(a,s,n,e),ra(s,2),An(s));break}}n=n.return}}function Uu(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new ux;var f=new Set;s.set(n,f)}else f=s.get(n),f===void 0&&(f=new Set,s.set(n,f));f.has(a)||(Du=!0,f.add(a),e=mx.bind(null,e,n,a),n.then(e,e))}function mx(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,rt===e&&(He&a)===a&&(ft===4||ft===3&&(He&62914560)===He&&300>Xe()-Jl?(Qe&2)===0&&Li(e,0):Ou|=a,zi===He&&(zi=0)),An(e)}function Hm(e,n){n===0&&(n=Dd()),e=Br(e,n),e!==null&&(ra(e,n),An(e))}function px(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Hm(e,a)}function gx(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(n),Hm(e,a)}function yx(e,n){return Gt(e,n)}var as=null,Hi=null,qu=!1,ls=!1,Gu=!1,xr=0;function An(e){e!==Hi&&e.next===null&&(Hi===null?as=Hi=e:Hi=Hi.next=e),ls=!0,qu||(qu=!0,bx())}function La(e,n){if(!Gu&&ls){Gu=!0;do for(var a=!1,s=as;s!==null;){if(e!==0){var f=s.pendingLanes;if(f===0)var m=0;else{var b=s.suspendedLanes,j=s.pingedLanes;m=(1<<31-Oe(42|e)+1)-1,m&=f&~(b&~j),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,$m(s,m))}else m=He,m=cl(s,s===rt?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(m&3)===0||na(s,m)||(a=!0,$m(s,m));s=s.next}while(a);Gu=!1}}function vx(){Um()}function Um(){ls=qu=!1;var e=0;xr!==0&&Nx()&&(e=xr);for(var n=Xe(),a=null,s=as;s!==null;){var f=s.next,m=qm(s,n);m===0?(s.next=null,a===null?as=f:a.next=f,f===null&&(Hi=a)):(a=s,(e!==0||(m&3)!==0)&&(ls=!0)),s=f}Ct!==0&&Ct!==5||La(e),xr!==0&&(xr=0)}function qm(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,f=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var b=31-Oe(m),j=1<<b,L=f[b];L===-1?((j&a)===0||(j&s)!==0)&&(f[b]=Vv(j,n)):L<=n&&(e.expiredLanes|=j),m&=~j}if(n=rt,a=He,a=cl(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(Je===2||Je===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Te(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||na(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&Te(s),no(a)){case 2:case 8:a=de;break;case 32:a=xe;break;case 268435456:a=J;break;default:a=xe}return s=Gm.bind(null,e),a=Gt(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&Te(s),e.callbackPriority=2,e.callbackNode=null,2}function Gm(e,n){if(Ct!==0&&Ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(is()&&e.callbackNode!==a)return null;var s=He;return s=cl(e,e===rt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(wm(e,s,n),qm(e,Xe()),e.callbackNode!=null&&e.callbackNode===a?Gm.bind(null,e):null)}function $m(e,n){if(is())return null;wm(e,n,!0)}function bx(){Ix(function(){(Qe&6)!==0?Gt(te,vx):Um()})}function $u(){if(xr===0){var e=Ci;e===0&&(e=ct,ct<<=1,(ct&261888)===0&&(ct=256)),xr=e}return xr}function Fm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ml(""+e)}function Vm(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function xx(e,n,a,s,f){if(n==="submit"&&a&&a.stateNode===f){var m=Fm((f[$t]||null).action),b=s.submitter;b&&(n=(n=b[$t]||null)?Fm(n.formAction):b.getAttribute("formAction"),n!==null&&(m=n,b=null));var j=new vl("action","action",null,s,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(xr!==0){var L=b?Vm(f,b):new FormData(f);uu(a,{pending:!0,data:L,method:f.method,action:m},null,L)}}else typeof m=="function"&&(j.preventDefault(),L=b?Vm(f,b):new FormData(f),uu(a,{pending:!0,data:L,method:f.method,action:m},m,L))},currentTarget:f}]})}}for(var Fu=0;Fu<Ro.length;Fu++){var Vu=Ro[Fu],Sx=Vu.toLowerCase(),kx=Vu[0].toUpperCase()+Vu.slice(1);Sn(Sx,"on"+kx)}Sn(kf,"onAnimationEnd"),Sn(wf,"onAnimationIteration"),Sn(Cf,"onAnimationStart"),Sn("dblclick","onDoubleClick"),Sn("focusin","onFocus"),Sn("focusout","onBlur"),Sn(Bb,"onTransitionRun"),Sn(Hb,"onTransitionStart"),Sn(Ub,"onTransitionCancel"),Sn(jf,"onTransitionEnd"),ci("onMouseEnter",["mouseout","mouseover"]),ci("onMouseLeave",["mouseout","mouseover"]),ci("onPointerEnter",["pointerout","pointerover"]),ci("onPointerLeave",["pointerout","pointerover"]),Mr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Mr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Mr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Mr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Mr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Mr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ba="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(" "),wx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ba));function Pm(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],f=s.event;s=s.listeners;e:{var m=void 0;if(n)for(var b=s.length-1;0<=b;b--){var j=s[b],L=j.instance,Z=j.currentTarget;if(j=j.listener,L!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=Z;try{m(f)}catch(le){Sl(le)}f.currentTarget=null,m=L}else for(b=0;b<s.length;b++){if(j=s[b],L=j.instance,Z=j.currentTarget,j=j.listener,L!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=Z;try{m(f)}catch(le){Sl(le)}f.currentTarget=null,m=L}}}}function Le(e,n){var a=n[ro];a===void 0&&(a=n[ro]=new Set);var s=e+"__bubble";a.has(s)||(Ym(n,e,2,!1),a.add(s))}function Pu(e,n,a){var s=0;n&&(s|=4),Ym(a,e,s,n)}var ss="_reactListening"+Math.random().toString(36).slice(2);function Yu(e){if(!e[ss]){e[ss]=!0,Hd.forEach(function(a){a!=="selectionchange"&&(wx.has(a)||Pu(a,!1,e),Pu(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ss]||(n[ss]=!0,Pu("selectionchange",!1,n))}}function Ym(e,n,a,s){switch(kp(n)){case 2:var f=Zx;break;case 8:f=Jx;break;default:f=oc}a=f.bind(null,n,a,e),f=void 0,!ho||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),s?f!==void 0?e.addEventListener(n,a,{capture:!0,passive:f}):e.addEventListener(n,a,!0):f!==void 0?e.addEventListener(n,a,{passive:f}):e.addEventListener(n,a,!1)}function Ku(e,n,a,s,f){var m=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var j=s.stateNode.containerInfo;if(j===f)break;if(b===4)for(b=s.return;b!==null;){var L=b.tag;if((L===3||L===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;j!==null;){if(b=si(j),b===null)return;if(L=b.tag,L===5||L===6||L===26||L===27){s=m=b;continue e}j=j.parentNode}}s=s.return}Zd(function(){var Z=m,le=co(a),ue=[];e:{var W=Rf.get(e);if(W!==void 0){var ee=vl,ve=e;switch(e){case"keypress":if(gl(a)===0)break e;case"keydown":case"keyup":ee=gb;break;case"focusin":ve="focus",ee=yo;break;case"focusout":ve="blur",ee=yo;break;case"beforeblur":case"afterblur":ee=yo;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=ef;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=ib;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=bb;break;case kf:case wf:case Cf:ee=sb;break;case jf:ee=Sb;break;case"scroll":case"scrollend":ee=nb;break;case"wheel":ee=wb;break;case"copy":case"cut":case"paste":ee=ub;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=nf;break;case"toggle":case"beforetoggle":ee=jb}var Ce=(n&4)!==0,nt=!Ce&&(e==="scroll"||e==="scrollend"),P=Ce?W!==null?W+"Capture":null:W;Ce=[];for(var q=Z,Q;q!==null;){var se=q;if(Q=se.stateNode,se=se.tag,se!==5&&se!==26&&se!==27||Q===null||P===null||(se=la(q,P),se!=null&&Ce.push(Ha(q,se,Q))),nt)break;q=q.return}0<Ce.length&&(W=new ee(W,ve,null,a,le),ue.push({event:W,listeners:Ce}))}}if((n&7)===0){e:{if(W=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",W&&a!==uo&&(ve=a.relatedTarget||a.fromElement)&&(si(ve)||ve[li]))break e;if((ee||W)&&(W=le.window===le?le:(W=le.ownerDocument)?W.defaultView||W.parentWindow:window,ee?(ve=a.relatedTarget||a.toElement,ee=Z,ve=ve?si(ve):null,ve!==null&&(nt=d(ve),Ce=ve.tag,ve!==nt||Ce!==5&&Ce!==27&&Ce!==6)&&(ve=null)):(ee=null,ve=Z),ee!==ve)){if(Ce=ef,se="onMouseLeave",P="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=nf,se="onPointerLeave",P="onPointerEnter",q="pointer"),nt=ee==null?W:aa(ee),Q=ve==null?W:aa(ve),W=new Ce(se,q+"leave",ee,a,le),W.target=nt,W.relatedTarget=Q,se=null,si(le)===Z&&(Ce=new Ce(P,q+"enter",ve,a,le),Ce.target=Q,Ce.relatedTarget=nt,se=Ce),nt=se,ee&&ve)t:{for(Ce=Cx,P=ee,q=ve,Q=0,se=P;se;se=Ce(se))Q++;se=0;for(var Se=q;Se;Se=Ce(Se))se++;for(;0<Q-se;)P=Ce(P),Q--;for(;0<se-Q;)q=Ce(q),se--;for(;Q--;){if(P===q||q!==null&&P===q.alternate){Ce=P;break t}P=Ce(P),q=Ce(q)}Ce=null}else Ce=null;ee!==null&&Km(ue,W,ee,Ce,!1),ve!==null&&nt!==null&&Km(ue,nt,ve,Ce,!0)}}e:{if(W=Z?aa(Z):window,ee=W.nodeName&&W.nodeName.toLowerCase(),ee==="select"||ee==="input"&&W.type==="file")var Ye=df;else if(uf(W))if(ff)Ye=zb;else{Ye=Ob;var be=Db}else ee=W.nodeName,!ee||ee.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?Z&&oo(Z.elementType)&&(Ye=df):Ye=Mb;if(Ye&&(Ye=Ye(e,Z))){cf(ue,Ye,a,le);break e}be&&be(e,W,Z),e==="focusout"&&Z&&W.type==="number"&&Z.memoizedProps.value!=null&&so(W,"number",W.value)}switch(be=Z?aa(Z):window,e){case"focusin":(uf(be)||be.contentEditable==="true")&&(gi=be,wo=Z,ma=null);break;case"focusout":ma=wo=gi=null;break;case"mousedown":Co=!0;break;case"contextmenu":case"mouseup":case"dragend":Co=!1,xf(ue,a,le);break;case"selectionchange":if(Lb)break;case"keydown":case"keyup":xf(ue,a,le)}var De;if(bo)e:{switch(e){case"compositionstart":var Ue="onCompositionStart";break e;case"compositionend":Ue="onCompositionEnd";break e;case"compositionupdate":Ue="onCompositionUpdate";break e}Ue=void 0}else pi?sf(e,a)&&(Ue="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ue="onCompositionStart");Ue&&(rf&&a.locale!=="ko"&&(pi||Ue!=="onCompositionStart"?Ue==="onCompositionEnd"&&pi&&(De=Jd()):(ir=le,mo="value"in ir?ir.value:ir.textContent,pi=!0)),be=os(Z,Ue),0<be.length&&(Ue=new tf(Ue,e,null,a,le),ue.push({event:Ue,listeners:be}),De?Ue.data=De:(De=of(a),De!==null&&(Ue.data=De)))),(De=Tb?Eb(e,a):Nb(e,a))&&(Ue=os(Z,"onBeforeInput"),0<Ue.length&&(be=new tf("onBeforeInput","beforeinput",null,a,le),ue.push({event:be,listeners:Ue}),be.data=De)),xx(ue,e,Z,a,le)}Pm(ue,n)})}function Ha(e,n,a){return{instance:e,listener:n,currentTarget:a}}function os(e,n){for(var a=n+"Capture",s=[];e!==null;){var f=e,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=la(e,a),f!=null&&s.unshift(Ha(e,f,m)),f=la(e,n),f!=null&&s.push(Ha(e,f,m))),e.tag===3)return s;e=e.return}return[]}function Cx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Km(e,n,a,s,f){for(var m=n._reactName,b=[];a!==null&&a!==s;){var j=a,L=j.alternate,Z=j.stateNode;if(j=j.tag,L!==null&&L===s)break;j!==5&&j!==26&&j!==27||Z===null||(L=Z,f?(Z=la(a,m),Z!=null&&b.unshift(Ha(a,Z,L))):f||(Z=la(a,m),Z!=null&&b.push(Ha(a,Z,L)))),a=a.return}b.length!==0&&e.push({event:n,listeners:b})}var jx=/\r\n?/g,Rx=/\u0000|\uFFFD/g;function Xm(e){return(typeof e=="string"?e:""+e).replace(jx,`
|
|
9
|
+
`).replace(Rx,"")}function Qm(e,n){return n=Xm(n),Xm(e)===n}function tt(e,n,a,s,f,m){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||fi(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&fi(e,""+s);break;case"className":fl(e,"class",s);break;case"tabIndex":fl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":fl(e,a,s);break;case"style":Xd(e,s,m);break;case"data":if(n!=="object"){fl(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ml(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"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 m=="function"&&(a==="formAction"?(n!=="input"&&tt(e,n,"name",f.name,f,null),tt(e,n,"formEncType",f.formEncType,f,null),tt(e,n,"formMethod",f.formMethod,f,null),tt(e,n,"formTarget",f.formTarget,f,null)):(tt(e,n,"encType",f.encType,f,null),tt(e,n,"method",f.method,f,null),tt(e,n,"target",f.target,f,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ml(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=_n);break;case"onScroll":s!=null&&Le("scroll",e);break;case"onScrollEnd":s!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(f.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=ml(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):e.removeAttribute(a);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":Le("beforetoggle",e),Le("toggle",e),dl(e,"popover",s);break;case"xlinkActuate":zn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":zn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":zn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":zn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":zn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":zn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":zn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":zn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":zn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":dl(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=eb.get(a)||a,dl(e,a,s))}}function Xu(e,n,a,s,f,m){switch(a){case"style":Xd(e,s,m);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(f.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof s=="string"?fi(e,s):(typeof s=="number"||typeof s=="bigint")&&fi(e,""+s);break;case"onScroll":s!=null&&Le("scroll",e);break;case"onScrollEnd":s!=null&&Le("scrollend",e);break;case"onClick":s!=null&&(e.onclick=_n);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ud.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),m=e[$t]||null,m=m!=null?m[a]:null,typeof m=="function"&&e.removeEventListener(n,m,f),typeof s=="function")){typeof m!="function"&&m!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,f);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):dl(e,a,s)}}}function Mt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var s=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var b=a[m];if(b!=null)switch(m){case"src":s=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:tt(e,n,m,b,a,null)}}f&&tt(e,n,"srcSet",a.srcSet,a,null),s&&tt(e,n,"src",a.src,a,null);return;case"input":Le("invalid",e);var j=m=b=f=null,L=null,Z=null;for(s in a)if(a.hasOwnProperty(s)){var le=a[s];if(le!=null)switch(s){case"name":f=le;break;case"type":b=le;break;case"checked":L=le;break;case"defaultChecked":Z=le;break;case"value":m=le;break;case"defaultValue":j=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(l(137,n));break;default:tt(e,n,s,le,a,null)}}Vd(e,m,j,L,Z,b,f,!1);return;case"select":Le("invalid",e),s=b=m=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":m=j;break;case"defaultValue":b=j;break;case"multiple":s=j;default:tt(e,n,f,j,a,null)}n=m,a=b,e.multiple=!!s,n!=null?di(e,!!s,n,!1):a!=null&&di(e,!!s,a,!0);return;case"textarea":Le("invalid",e),m=f=s=null;for(b in a)if(a.hasOwnProperty(b)&&(j=a[b],j!=null))switch(b){case"value":s=j;break;case"defaultValue":f=j;break;case"children":m=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(l(91));break;default:tt(e,n,b,j,a,null)}Yd(e,s,f,m);return;case"option":for(L in a)a.hasOwnProperty(L)&&(s=a[L],s!=null)&&(L==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":tt(e,n,L,s,a,null));return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(s=0;s<Ba.length;s++)Le(Ba[s],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("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(Z in a)if(a.hasOwnProperty(Z)&&(s=a[Z],s!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:tt(e,n,Z,s,a,null)}return;default:if(oo(n)){for(le in a)a.hasOwnProperty(le)&&(s=a[le],s!==void 0&&Xu(e,n,le,s,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(s=a[j],s!=null&&tt(e,n,j,s,a,null))}function Tx(e,n,a,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,b=null,j=null,L=null,Z=null,le=null;for(ee in a){var ue=a[ee];if(a.hasOwnProperty(ee)&&ue!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":L=ue;default:s.hasOwnProperty(ee)||tt(e,n,ee,null,s,ue)}}for(var W in s){var ee=s[W];if(ue=a[W],s.hasOwnProperty(W)&&(ee!=null||ue!=null))switch(W){case"type":m=ee;break;case"name":f=ee;break;case"checked":Z=ee;break;case"defaultChecked":le=ee;break;case"value":b=ee;break;case"defaultValue":j=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(l(137,n));break;default:ee!==ue&&tt(e,n,W,ee,s,ue)}}lo(e,b,j,L,Z,le,m,f);return;case"select":ee=b=j=W=null;for(m in a)if(L=a[m],a.hasOwnProperty(m)&&L!=null)switch(m){case"value":break;case"multiple":ee=L;default:s.hasOwnProperty(m)||tt(e,n,m,null,s,L)}for(f in s)if(m=s[f],L=a[f],s.hasOwnProperty(f)&&(m!=null||L!=null))switch(f){case"value":W=m;break;case"defaultValue":j=m;break;case"multiple":b=m;default:m!==L&&tt(e,n,f,m,s,L)}n=j,a=b,s=ee,W!=null?di(e,!!a,W,!1):!!s!=!!a&&(n!=null?di(e,!!a,n,!0):di(e,!!a,a?[]:"",!1));return;case"textarea":ee=W=null;for(j in a)if(f=a[j],a.hasOwnProperty(j)&&f!=null&&!s.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:tt(e,n,j,null,s,f)}for(b in s)if(f=s[b],m=a[b],s.hasOwnProperty(b)&&(f!=null||m!=null))switch(b){case"value":W=f;break;case"defaultValue":ee=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==m&&tt(e,n,b,f,s,m)}Pd(e,W,ee);return;case"option":for(var ve in a)W=a[ve],a.hasOwnProperty(ve)&&W!=null&&!s.hasOwnProperty(ve)&&(ve==="selected"?e.selected=!1:tt(e,n,ve,null,s,W));for(L in s)W=s[L],ee=a[L],s.hasOwnProperty(L)&&W!==ee&&(W!=null||ee!=null)&&(L==="selected"?e.selected=W&&typeof W!="function"&&typeof W!="symbol":tt(e,n,L,W,s,ee));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 Ce in a)W=a[Ce],a.hasOwnProperty(Ce)&&W!=null&&!s.hasOwnProperty(Ce)&&tt(e,n,Ce,null,s,W);for(Z in s)if(W=s[Z],ee=a[Z],s.hasOwnProperty(Z)&&W!==ee&&(W!=null||ee!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(l(137,n));break;default:tt(e,n,Z,W,s,ee)}return;default:if(oo(n)){for(var nt in a)W=a[nt],a.hasOwnProperty(nt)&&W!==void 0&&!s.hasOwnProperty(nt)&&Xu(e,n,nt,void 0,s,W);for(le in s)W=s[le],ee=a[le],!s.hasOwnProperty(le)||W===ee||W===void 0&&ee===void 0||Xu(e,n,le,W,s,ee);return}}for(var P in a)W=a[P],a.hasOwnProperty(P)&&W!=null&&!s.hasOwnProperty(P)&&tt(e,n,P,null,s,W);for(ue in s)W=s[ue],ee=a[ue],!s.hasOwnProperty(ue)||W===ee||W==null&&ee==null||tt(e,n,ue,W,s,ee)}function Zm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ex(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var f=a[s],m=f.transferSize,b=f.initiatorType,j=f.duration;if(m&&j&&Zm(b)){for(b=0,j=f.responseEnd,s+=1;s<a.length;s++){var L=a[s],Z=L.startTime;if(Z>j)break;var le=L.transferSize,ue=L.initiatorType;le&&Zm(ue)&&(L=L.responseEnd,b+=le*(L<j?1:(j-Z)/(L-Z)))}if(--s,n+=8*(m+b)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Qu=null,Zu=null;function us(e){return e.nodeType===9?e:e.ownerDocument}function Jm(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 Wm(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Ju(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Wu=null;function Nx(){var e=window.event;return e&&e.type==="popstate"?e===Wu?!1:(Wu=e,!0):(Wu=null,!1)}var ep=typeof setTimeout=="function"?setTimeout:void 0,Ax=typeof clearTimeout=="function"?clearTimeout:void 0,tp=typeof Promise=="function"?Promise:void 0,Ix=typeof queueMicrotask=="function"?queueMicrotask:typeof tp<"u"?function(e){return tp.resolve(null).then(e).catch(Dx)}:ep;function Dx(e){setTimeout(function(){throw e})}function Sr(e){return e==="head"}function np(e,n){var a=n,s=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(f),$i(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")Ua(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ua(a);for(var m=a.firstChild;m;){var b=m.nextSibling,j=m.nodeName;m[ia]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=b}}else a==="body"&&Ua(e.ownerDocument.body);a=f}while(a);$i(n)}function rp(e,n){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function ec(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":ec(a),io(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Ox(e,n,a,s){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ia])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==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(m=e.getAttribute("src"),(m!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=yn(e.nextSibling),e===null)break}return null}function Mx(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=yn(e.nextSibling),e===null))return null;return e}function ip(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=yn(e.nextSibling),e===null))return null;return e}function tc(e){return e.data==="$?"||e.data==="$~"}function nc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function zx(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function yn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var rc=null;function ap(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return yn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function lp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function sp(e,n,a){switch(n=us(a),e){case"html":if(e=n.documentElement,!e)throw Error(l(452));return e;case"head":if(e=n.head,!e)throw Error(l(453));return e;case"body":if(e=n.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Ua(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);io(e)}var vn=new Map,op=new Set;function cs(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Jn=H.d;H.d={f:_x,r:Lx,D:Bx,C:Hx,L:Ux,m:qx,X:$x,S:Gx,M:Fx};function _x(){var e=Jn.f(),n=ts();return e||n}function Lx(e){var n=oi(e);n!==null&&n.tag===5&&n.type==="form"?jh(n):Jn.r(e)}var Ui=typeof document>"u"?null:document;function up(e,n,a){var s=Ui;if(s&&typeof n=="string"&&n){var f=cn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),op.has(f)||(op.add(f),e={rel:e,crossOrigin:a,href:n},s.querySelector(f)===null&&(n=s.createElement("link"),Mt(n,"link",e),Et(n),s.head.appendChild(n)))}}function Bx(e){Jn.D(e),up("dns-prefetch",e,null)}function Hx(e,n){Jn.C(e,n),up("preconnect",e,n)}function Ux(e,n,a){Jn.L(e,n,a);var s=Ui;if(s&&e&&n){var f='link[rel="preload"][as="'+cn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+cn(a.imageSizes)+'"]')):f+='[href="'+cn(e)+'"]';var m=f;switch(n){case"style":m=qi(e);break;case"script":m=Gi(e)}vn.has(m)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),vn.set(m,e),s.querySelector(f)!==null||n==="style"&&s.querySelector(qa(m))||n==="script"&&s.querySelector(Ga(m))||(n=s.createElement("link"),Mt(n,"link",e),Et(n),s.head.appendChild(n)))}}function qx(e,n){Jn.m(e,n);var a=Ui;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+cn(s)+'"][href="'+cn(e)+'"]',m=f;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Gi(e)}if(!vn.has(m)&&(e=y({rel:"modulepreload",href:e},n),vn.set(m,e),a.querySelector(f)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ga(m)))return}s=a.createElement("link"),Mt(s,"link",e),Et(s),a.head.appendChild(s)}}}function Gx(e,n,a){Jn.S(e,n,a);var s=Ui;if(s&&e){var f=ui(s).hoistableStyles,m=qi(e);n=n||"default";var b=f.get(m);if(!b){var j={loading:0,preload:null};if(b=s.querySelector(qa(m)))j.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=vn.get(m))&&ic(e,a);var L=b=s.createElement("link");Et(L),Mt(L,"link",e),L._p=new Promise(function(Z,le){L.onload=Z,L.onerror=le}),L.addEventListener("load",function(){j.loading|=1}),L.addEventListener("error",function(){j.loading|=2}),j.loading|=4,ds(b,n,s)}b={type:"stylesheet",instance:b,count:1,state:j},f.set(m,b)}}}function $x(e,n){Jn.X(e,n);var a=Ui;if(a&&e){var s=ui(a).hoistableScripts,f=Gi(e),m=s.get(f);m||(m=a.querySelector(Ga(f)),m||(e=y({src:e,async:!0},n),(n=vn.get(f))&&ac(e,n),m=a.createElement("script"),Et(m),Mt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},s.set(f,m))}}function Fx(e,n){Jn.M(e,n);var a=Ui;if(a&&e){var s=ui(a).hoistableScripts,f=Gi(e),m=s.get(f);m||(m=a.querySelector(Ga(f)),m||(e=y({src:e,async:!0,type:"module"},n),(n=vn.get(f))&&ac(e,n),m=a.createElement("script"),Et(m),Mt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},s.set(f,m))}}function cp(e,n,a,s){var f=(f=V.current)?cs(f):null;if(!f)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=qi(a.href),a=ui(f).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=qi(a.href);var m=ui(f).hoistableStyles,b=m.get(e);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,b),(m=f.querySelector(qa(e)))&&!m._p&&(b.instance=m,b.state.loading=5),vn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},vn.set(e,a),m||Vx(f,e,a,b.state))),n&&s===null)throw Error(l(528,""));return b}if(n&&s!==null)throw Error(l(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Gi(a),a=ui(f).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function qi(e){return'href="'+cn(e)+'"'}function qa(e){return'link[rel="stylesheet"]['+e+"]"}function dp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Vx(e,n,a,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),Mt(n,"link",a),Et(n),e.head.appendChild(n))}function Gi(e){return'[src="'+cn(e)+'"]'}function Ga(e){return"script[async]"+e}function fp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+cn(a.href)+'"]');if(s)return n.instance=s,Et(s),s;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Et(s),Mt(s,"style",f),ds(s,a.precedence,e),n.instance=s;case"stylesheet":f=qi(a.href);var m=e.querySelector(qa(f));if(m)return n.state.loading|=4,n.instance=m,Et(m),m;s=dp(a),(f=vn.get(f))&&ic(s,f),m=(e.ownerDocument||e).createElement("link"),Et(m);var b=m;return b._p=new Promise(function(j,L){b.onload=j,b.onerror=L}),Mt(m,"link",s),n.state.loading|=4,ds(m,a.precedence,e),n.instance=m;case"script":return m=Gi(a.src),(f=e.querySelector(Ga(m)))?(n.instance=f,Et(f),f):(s=a,(f=vn.get(m))&&(s=y({},a),ac(s,f)),e=e.ownerDocument||e,f=e.createElement("script"),Et(f),Mt(f,"link",s),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,ds(s,a.precedence,e));return n.instance}function ds(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=s.length?s[s.length-1]:null,m=f,b=0;b<s.length;b++){var j=s[b];if(j.dataset.precedence===n)m=j;else if(m!==f)break}m?m.parentNode.insertBefore(e,m.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function ic(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function ac(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var fs=null;function hp(e,n,a){if(fs===null){var s=new Map,f=fs=new Map;f.set(a,s)}else f=fs,s=f.get(a),s||(s=new Map,f.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var m=a[f];if(!(m[ia]||m[At]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(n)||"";b=e+b;var j=s.get(b);j?j.push(m):s.set(b,[m])}}return s}function mp(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Px(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(e=n.disabled,typeof n.precedence=="string"&&e==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function pp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Yx(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=qi(s.href),m=n.querySelector(qa(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=hs.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,Et(m);return}m=n.ownerDocument||n,s=dp(s),(f=vn.get(f))&&ic(s,f),m=m.createElement("link"),Et(m);var b=m;b._p=new Promise(function(j,L){b.onload=j,b.onerror=L}),Mt(m,"link",s),a.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=hs.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var lc=0;function Kx(e,n){return e.stylesheets&&e.count===0&&ps(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&ps(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&lc===0&&(lc=62500*Ex());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ps(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>lc?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(f)}}:null}function hs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ps(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ms=null;function ps(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ms=new Map,n.forEach(Xx,e),ms=null,hs.call(e))}function Xx(e,n){if(!(n.state.loading&4)){var a=ms.get(e);if(a)var s=a.get(null);else{a=new Map,ms.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var b=f[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),s=b)}s&&a.set(null,s)}f=n.instance,b=f.getAttribute("data-precedence"),m=a.get(b)||s,m===s&&a.set(null,f),a.set(b,f),this.count++,s=hs.bind(this),f.addEventListener("load",s),f.addEventListener("error",s),m?m.parentNode.insertBefore(f,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var $a={$$typeof:D,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function Qx(e,n,a,s,f,m,b,j,L){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=eo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=eo(0),this.hiddenUpdates=eo(null),this.identifierPrefix=s,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function gp(e,n,a,s,f,m,b,j,L,Z,le,ue){return e=new Qx(e,n,a,b,L,Z,le,ue,j),n=1,m===!0&&(n|=24),m=en(3,null,null,n),e.current=m,m.stateNode=e,n=Ho(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:s,isDehydrated:a,cache:n},$o(m),e}function yp(e){return e?(e=bi,e):bi}function vp(e,n,a,s,f,m){f=yp(f),s.context===null?s.context=f:s.pendingContext=f,s=cr(n),s.payload={element:a},m=m===void 0?null:m,m!==null&&(s.callback=m),a=dr(e,s,n),a!==null&&(Xt(a,e,n),Sa(a,e,n))}function bp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function sc(e,n){bp(e,n),(e=e.alternate)&&bp(e,n)}function xp(e){if(e.tag===13||e.tag===31){var n=Br(e,67108864);n!==null&&Xt(n,e,67108864),sc(e,67108864)}}function Sp(e){if(e.tag===13||e.tag===31){var n=ln();n=to(n);var a=Br(e,n);a!==null&&Xt(a,e,n),sc(e,n)}}var gs=!0;function Zx(e,n,a,s){var f=I.T;I.T=null;var m=H.p;try{H.p=2,oc(e,n,a,s)}finally{H.p=m,I.T=f}}function Jx(e,n,a,s){var f=I.T;I.T=null;var m=H.p;try{H.p=8,oc(e,n,a,s)}finally{H.p=m,I.T=f}}function oc(e,n,a,s){if(gs){var f=uc(s);if(f===null)Ku(e,n,s,ys,a),wp(e,s);else if(e1(f,e,n,a,s))s.stopPropagation();else if(wp(e,s),n&4&&-1<Wx.indexOf(e)){for(;f!==null;){var m=oi(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Or(m.pendingLanes);if(b!==0){var j=m;for(j.pendingLanes|=2,j.entangledLanes|=2;b;){var L=1<<31-Oe(b);j.entanglements[1]|=L,b&=~L}An(m),(Qe&6)===0&&(Wl=Xe()+500,La(0))}}break;case 31:case 13:j=Br(m,2),j!==null&&Xt(j,m,2),ts(),sc(m,2)}if(m=uc(s),m===null&&Ku(e,n,s,ys,a),m===f)break;f=m}f!==null&&s.stopPropagation()}else Ku(e,n,s,null,a)}}function uc(e){return e=co(e),cc(e)}var ys=null;function cc(e){if(ys=null,e=si(e),e!==null){var n=d(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=u(n),e!==null)return e;e=null}else if(a===31){if(e=h(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return ys=e,null}function kp(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(zt()){case te:return 2;case de:return 8;case xe:case Ee:return 32;case J:return 268435456;default:return 32}default:return 32}}var dc=!1,kr=null,wr=null,Cr=null,Fa=new Map,Va=new Map,jr=[],Wx="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 wp(e,n){switch(e){case"focusin":case"focusout":kr=null;break;case"dragenter":case"dragleave":wr=null;break;case"mouseover":case"mouseout":Cr=null;break;case"pointerover":case"pointerout":Fa.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Va.delete(n.pointerId)}}function Pa(e,n,a,s,f,m){return e===null||e.nativeEvent!==m?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:m,targetContainers:[f]},n!==null&&(n=oi(n),n!==null&&xp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function e1(e,n,a,s,f){switch(n){case"focusin":return kr=Pa(kr,e,n,a,s,f),!0;case"dragenter":return wr=Pa(wr,e,n,a,s,f),!0;case"mouseover":return Cr=Pa(Cr,e,n,a,s,f),!0;case"pointerover":var m=f.pointerId;return Fa.set(m,Pa(Fa.get(m)||null,e,n,a,s,f)),!0;case"gotpointercapture":return m=f.pointerId,Va.set(m,Pa(Va.get(m)||null,e,n,a,s,f)),!0}return!1}function Cp(e){var n=si(e.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){e.blockedOn=n,Ld(e.priority,function(){Sp(a)});return}}else if(n===31){if(n=h(a),n!==null){e.blockedOn=n,Ld(e.priority,function(){Sp(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vs(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=uc(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);uo=s,a.target.dispatchEvent(s),uo=null}else return n=oi(a),n!==null&&xp(n),e.blockedOn=a,!1;n.shift()}return!0}function jp(e,n,a){vs(e)&&a.delete(n)}function t1(){dc=!1,kr!==null&&vs(kr)&&(kr=null),wr!==null&&vs(wr)&&(wr=null),Cr!==null&&vs(Cr)&&(Cr=null),Fa.forEach(jp),Va.forEach(jp)}function bs(e,n){e.blockedOn===n&&(e.blockedOn=null,dc||(dc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,t1)))}var xs=null;function Rp(e){xs!==e&&(xs=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){xs===e&&(xs=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],f=e[n+2];if(typeof s!="function"){if(cc(s||a)===null)continue;break}var m=oi(a);m!==null&&(e.splice(n,3),n-=3,uu(m,{pending:!0,data:f,method:a.method,action:s},s,f))}}))}function $i(e){function n(L){return bs(L,e)}kr!==null&&bs(kr,e),wr!==null&&bs(wr,e),Cr!==null&&bs(Cr,e),Fa.forEach(n),Va.forEach(n);for(var a=0;a<jr.length;a++){var s=jr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<jr.length&&(a=jr[0],a.blockedOn===null);)Cp(a),a.blockedOn===null&&jr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var f=a[s],m=a[s+1],b=f[$t]||null;if(typeof m=="function")b||Rp(a);else if(b){var j=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[$t]||null)j=b.formAction;else if(cc(f)!==null)continue}else j=b.action;typeof j=="function"?a[s+1]=j:(a.splice(s,3),s-=3),Rp(a)}}}function Tp(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(b){return f=b})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function fc(e){this._internalRoot=e}Ss.prototype.render=fc.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(l(409));var a=n.current,s=ln();vp(a,s,e,n,null,null)},Ss.prototype.unmount=fc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;vp(e.current,2,null,e,null,null),ts(),n[li]=null}};function Ss(e){this._internalRoot=e}Ss.prototype.unstable_scheduleHydration=function(e){if(e){var n=_d();e={blockedOn:null,target:e,priority:n};for(var a=0;a<jr.length&&n!==0&&n<jr[a].priority;a++);jr.splice(a,0,e),a===0&&Cp(e)}};var Ep=r.version;if(Ep!=="19.2.8")throw Error(l(527,Ep,"19.2.8"));H.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var n1={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ks=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ks.isDisabled&&ks.supportsFiber)try{je=ks.inject(n1),we=ks}catch{}}return Ka.createRoot=function(e,n){if(!o(e))throw Error(l(299));var a=!1,s="",f=zh,m=_h,b=Lh;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError)),n=gp(e,1,!1,null,null,a,s,null,f,m,b,Tp),e[li]=n.current,Yu(e),new fc(n)},Ka.hydrateRoot=function(e,n,a){if(!o(e))throw Error(l(299));var s=!1,f="",m=zh,b=_h,j=Lh,L=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(L=a.formState)),n=gp(e,1,!0,n,a??null,s,f,L,m,b,j,Tp),n.context=yp(null),a=n.current,s=ln(),s=to(s),f=cr(s),f.callback=null,dr(a,f,s),a=s,n.current.lanes=a,ra(n,a),An(n),e[li]=n.current,Yu(e),new Ss(n)},Ka.version="19.2.8",Ka}var Bp;function d1(){if(Bp)return pc.exports;Bp=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),pc.exports=c1(),pc.exports}var f1=d1();function Zr(t){if(t==null)return null;if(typeof t=="string")return t.trim()||null;if(typeof t=="number"||typeof t=="boolean")return String(t);if(typeof t=="object"){const r=t;if(typeof r.text=="string"&&r.text.trim())return r.text.trim();if(typeof r.errorMessage=="string"&&r.errorMessage.trim())return r.errorMessage.trim();if(Array.isArray(r.content)){const i=r.content.map(l=>{if(typeof l=="string")return l;if(l&&typeof l=="object"){const o=l;if(typeof o.text=="string")return o.text}return""}).filter(Boolean);if(i.length)return i.join(`
|
|
10
|
+
`).slice(0,240)}if(typeof r.role=="string")return`${r.role} 消息`}return null}function h1(t){const r=Zr(t.at)??Zr(t.timestamp)??Zr(t.recordedAt)??"",i=Zr(t.errorMessage)??Zr(t.label)??Zr(t.type)??Zr(t.message)??"运行事件";return r?`${r} · ${i}`:i}function el(t){return String(t.nodeId??t.id??"").trim()}function bc(t){const r=el(t);return String(t.label??t.name??(r||"未命名节点"))}function Hp(t,r){if(t.length===0)return;const i=r?.trim();if(i){const d=t.find(u=>el(u)===i);if(d)return d}const l=t.find(d=>{const u=String(d.status??"").toLowerCase();return u.includes("fail")||u.includes("error")||u==="blocked"});return l||(t.find(d=>{const u=String(d.status??"").toLowerCase();return u==="running"||u==="in_progress"||u==="active"})??t[0])}function m1({dagRunId:t,nodeId:r,onClose:i,onOpenFull:l}){const o=k.useRef(null),[d,u]=k.useState(null),[h,g]=k.useState([]),[p,v]=k.useState(null),[y,S]=k.useState(!0);k.useEffect(()=>{o.current?.focus();const O=E=>{E.key==="Escape"&&i()};return document.addEventListener("keydown",O),document.title=`检视 · DAG ${t} · Loop Operator`,()=>document.removeEventListener("keydown",O)},[t,i]),k.useEffect(()=>{const O=new AbortController;return S(!0),v(null),g([]),(async()=>{try{const E=await fetch(`/api/dag-runs/${encodeURIComponent(t)}`,{signal:O.signal,credentials:"same-origin"});if(!E.ok)throw new Error(`DAG 查询失败(HTTP ${E.status})`);const D=await E.json();if(O.signal.aborted)return;u(D);const G=Array.isArray(D.nodes)?D.nodes:[],K=Hp(G,r),N=K?el(K):r?.trim();if(N){const $=await fetch(`/api/dag-runs/${encodeURIComponent(t)}/nodes/${encodeURIComponent(N)}/session-events`,{signal:O.signal,credentials:"same-origin"});if($.ok){const ne=await $.json();O.signal.aborted||g((ne.events??[]).slice(-20))}}}catch(E){O.signal.aborted||v(E instanceof Error?E.message:String(E))}finally{O.signal.aborted||S(!1)}})(),()=>O.abort()},[t,r]);const x=k.useMemo(()=>Array.isArray(d?.nodes)?d.nodes:[],[d]),w=Hp(x,r),A=w?el(w):"",M=String(d?.effectiveStatus??d?.status??(y?"加载中…":"未知"));return c.jsxs("aside",{className:"inspect-split-panel","aria-label":"DAG 紧凑检视",children:[c.jsxs("div",{className:"inspect-split-header",children:[c.jsxs("div",{children:[c.jsx("p",{className:"inspect-split-kicker",children:"Inspect"}),c.jsx("h2",{children:"检视 DAG"})]}),c.jsx("button",{ref:o,type:"button","aria-label":"关闭检视面板",onClick:i,children:"关闭"})]}),c.jsx("p",{className:"inspect-split-id",children:c.jsx("code",{children:t})}),p?c.jsx("p",{className:"error",children:p}):null,y&&!d?c.jsx("p",{className:"muted",children:"正在加载 DAG…"}):null,c.jsxs("dl",{className:"inspect-split-facts",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"状态"}),c.jsx("dd",{children:M})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"当前节点"}),c.jsx("dd",{children:w?bc(w):"暂无节点"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"节点状态"}),c.jsx("dd",{children:w?.status??"—"})]}),w?.errorPreview?c.jsxs("div",{children:[c.jsx("dt",{children:"错误摘要"}),c.jsx("dd",{children:w.errorPreview})]}):null]}),c.jsxs("section",{children:[c.jsxs("h3",{children:["节点(",x.length,")"]}),x.length?c.jsx("ul",{className:"inspect-split-nodes",children:x.slice(0,24).map(O=>{const E=el(O)||bc(O),D=E===A;return c.jsxs("li",{"data-active":D?"true":void 0,className:D?"is-active":void 0,children:[c.jsx("span",{children:bc(O)}),c.jsx("code",{children:O.status??"—"})]},E)})}):c.jsx("p",{className:"muted",children:y?"加载节点中…":"该运行暂无节点。"})]}),c.jsxs("section",{children:[c.jsxs("h3",{children:["最近事件",A?` · ${A}`:""]}),h.length?c.jsx("ul",{className:"inspect-split-events",children:h.map((O,E)=>c.jsx("li",{children:h1(O)},`${O.at??E}-${E}`))}):c.jsx("p",{className:"muted",children:y?"加载事件中…":"节点事件将在可用时显示。"})]}),c.jsx("button",{type:"button",className:"btn btn-secondary",onClick:l,children:"全屏观测"}),c.jsx("p",{className:"muted",children:"全屏后点顶栏「返回操作台」可回来。"})]})}function p1(t){const{board:r,busy:i}=t;return c.jsxs("details",{className:"night-advanced","data-testid":"night-advanced",open:r.advancedOpen,onToggle:l=>r.setAdvancedOpen(l.target.open),children:[c.jsx("summary",{children:"高级 / Inspect"}),c.jsxs("p",{className:"muted",children:["只读深链:"," ",c.jsx("a",{className:"external-link",href:"/inspect/#/night",children:"/inspect/#/night"})]}),c.jsx("div",{className:"cta-row",children:c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-morning-btn",onClick:()=>{r.onMorningReport()},children:"早晨 night 报告"})}),r.morningPreview?c.jsx("pre",{className:"cmd","data-testid":"night-morning-preview",children:r.morningPreview}):null]})}function ws(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function gt(t,r){const i=t[r];return typeof i=="string"&&i.trim()?i.trim():void 0}function Up(t,r){const i=t[r];if(!Array.isArray(i))return;const l=i.filter(o=>typeof o=="string");return l.length>0?l:void 0}function g1(t){const r=ws(t);if(!r)return null;const i=ws(r.result),l=[ws(r.reviewPacket),i?ws(i.reviewPacket):null,i,r].filter(Boolean);for(const o of l){const d=gt(o,"scheduleId")??gt(o,"id"),u=gt(o,"gateToken")??gt(o,"approveGate")??gt(o,"writeSetGateToken");if(!(!d||!u))return{scheduleId:d,gateToken:u,...gt(o,"featureId")?{featureId:gt(o,"featureId")}:{},...gt(o,"taskId")?{taskId:gt(o,"taskId")}:{},...Up(o,"writeSet")?{writeSet:Up(o,"writeSet")}:{},...gt(o,"worktreePath")?{worktreePath:gt(o,"worktreePath")}:{},...gt(o,"branch")?{branch:gt(o,"branch")}:{},...gt(o,"baseBranch")?{baseBranch:gt(o,"baseBranch")}:{},...gt(o,"baseCommit")?{baseCommit:gt(o,"baseCommit")}:{},...gt(o,"executeAtUtc")?{executeAtUtc:gt(o,"executeAtUtc")}:{},...gt(o,"taskCard")?{taskCard:gt(o,"taskCard")}:{}}}return null}function qp(t){return`docs/features/${t.trim().replace(/^\/+|\/+$/g,"")}`}function y1(t){const r=t.trim(),i=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2})/.exec(r);return i?`${i[1]} ${i[2]}`:null}function Gp(){const t=new Date;t.setHours(20,0,0,0);const r=i=>String(i).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function iy(t){if(!t)return"—";const r=Date.parse(t);if(Number.isNaN(r))return t;try{return new Intl.DateTimeFormat("zh-CN",{dateStyle:"short",timeStyle:"short",timeZone:"Asia/Shanghai"}).format(new Date(r))}catch{return t}}function v1(t){return t.mergeState==="pending-harvest"||/\bscheduler harvest\b/i.test(t.nextAction)}function b1(t){return t.status==="failed"||t.status==="human_required"||t.status==="cancelled"||/\bscheduler discard\b/i.test(t.nextAction)}function Is(t){return t==="failed"||t==="human_required"}function x1(t){return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function ay(t){return{submitted:"已提交",validating:"校验中",validated:"待预约确认",scheduled:"已预约",waiting:"等待触发",dispatching:"派发中",running:"执行中",succeeded:"成功",failed:"失败",human_required:"需人工",cancelled:"已取消",rejected:"已拒绝",cancel_requested:"取消中"}[t]??t}function S1(t){const{target:r,reason:i,onReasonChange:l,force:o,onForceChange:d,busy:u}=t;return c.jsxs("div",{className:"night-discard-card","data-testid":"night-discard-card",children:[c.jsx("h3",{children:"确认 Discard"}),c.jsxs("p",{className:"muted",children:[r.featureId,"/",r.taskId,"(",ay(r.status),")"]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"原因"}),c.jsx("input",{"data-testid":"night-discard-reason",value:i,disabled:u,placeholder:"human discard reason",onChange:h=>l(h.target.value)})]}),Is(r.status)?c.jsxs("label",{className:"field checkbox-field",children:[c.jsx("input",{type:"checkbox","data-testid":"night-discard-force",checked:o,disabled:u,onChange:h=>d(h.target.checked)}),c.jsx("span",{className:"muted",children:"强制 Discard(failed / human_required)"})]}):null,c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:u||Is(r.status)&&!o,"data-testid":"night-discard-confirm",onClick:t.onConfirm,children:"确认 Discard"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:u,onClick:t.onCancel,children:"返回"})]})]})}function k1(t){const{board:r}=t,{doctor:i,list:l,clockHint:o,doctorIssues:d,auxTicker:u}=r;return c.jsxs("div",{className:"night-health","data-testid":"night-health-bar",children:[c.jsxs("div",{className:"night-health-main",children:[c.jsx("span",{className:`night-health-pill${i?.ok===!1?" is-bad":""}`,children:i?.ok===!1?"Scheduler 异常":"Scheduler 健康"}),c.jsxs("span",{className:"muted",children:["计划 ",i?.scheduleCount??l?.summary.total??"—"," · 活动"," ",i?.activeCount??l?.summary.active??"—"]})]}),o?c.jsxs("p",{className:"muted night-health-hint","data-testid":"night-clock-hint",children:["时钟:",o.message,"(安装/启停请用 CLI:",c.jsx("code",{children:"agent-worker scheduler clock status --repo ."}),")"]}):c.jsxs("p",{className:"muted night-health-hint",children:["到点执行依赖本机 clock / tick,不在此面板安装。详见"," ",c.jsx("a",{className:"external-link",href:"/inspect/#/night",children:"/inspect/#/night"})]}),c.jsxs("div",{className:"night-aux-ticker","data-testid":"night-aux-ticker",children:[c.jsxs("p",{className:"night-aux-ticker-label",children:["开着 Console 时辅助 tick(每 ",u?.intervalSec??60,"s)"]}),c.jsx("p",{className:"muted night-health-hint","data-testid":"night-aux-ticker-disclaimer",children:u?.disclaimer??"仅在本 Console 进程开着时有效;过夜无人值守仍需 OS clock。"}),u?.lastOutcome?c.jsxs("p",{className:"muted","data-testid":"night-aux-ticker-last",children:["上次:",u.lastOutcome,u.running?"(进行中)":"",u.lastSummary?` · ${u.lastSummary}`:"",u.lastError?` · ${u.lastError}`:""]}):null]}),d.length>0?c.jsx("ul",{className:"night-doctor-list","data-testid":"night-doctor-findings",children:d.slice(0,4).map(h=>c.jsxs("li",{children:[c.jsx("strong",{children:h.severity})," ",h.message]},`${h.code}-${h.scheduleId??""}-${h.message}`))}):null]})}function w1(t){const{board:r,busy:i,onHarvest:l,onOpenDiscard:o}=t,{list:d}=r;return c.jsxs(c.Fragment,{children:[d?c.jsxs("div",{className:"night-kpi","data-testid":"night-kpi",children:[c.jsxs("span",{children:["合计 ",d.summary.total]}),c.jsxs("span",{children:["活动 ",d.summary.active]}),c.jsxs("span",{children:["待收成 ",d.summary.pendingHarvest]}),c.jsxs("span",{children:["需人工 ",d.summary.humanRequired]}),c.jsxs("span",{children:["失败 ",d.summary.failed]})]}):null,c.jsxs("div",{className:"night-board","data-testid":"night-board",children:[c.jsx("h3",{children:"计划列表"}),!d||d.schedules.length===0?c.jsxs("div",{className:"empty-state","data-testid":"night-board-empty",children:[c.jsx("p",{className:"empty-title",children:"暂无夜间计划"}),c.jsx("p",{className:"muted",children:"用下方向导预约第一个任务。"})]}):c.jsx("ul",{className:"night-schedule-list",children:d.schedules.map(u=>c.jsxs("li",{className:"night-schedule-row","data-testid":"night-schedule-row","data-status":u.status,children:[c.jsxs("div",{className:"night-schedule-head",children:[c.jsxs("strong",{children:[u.featureId,"/",u.taskId]}),c.jsx("span",{className:"night-status-chip",children:ay(u.status)})]}),c.jsxs("p",{className:"muted",children:["执行 ",iy(u.executeAtUtc),u.mergeState?` · merge ${u.mergeState}`:"",u.taskCard?` · ${u.taskCard}`:""]}),u.waitingReason?c.jsxs("p",{className:"muted",children:["等待原因:",u.waitingReason]}):null,c.jsxs("p",{className:"muted night-next-action",children:["下一步:",u.nextAction]}),c.jsxs("div",{className:"cta-row",children:[v1(u)?c.jsx("button",{type:"button",className:"btn btn-primary",disabled:i,"data-testid":"night-row-harvest",onClick:()=>l(u),children:"Harvest"}):null,b1(u)?c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-row-discard",onClick:()=>o(u),children:"Discard"}):null,c.jsx("a",{className:"external-link",href:`/inspect/#/night/${encodeURIComponent(u.scheduleId)}`,children:"Inspect"})]})]},u.scheduleId))})]})]})}function C1(t){const{wizard:r,busy:i}=t;return c.jsxs("div",{className:"night-wizard","data-testid":"night-wizard",children:[c.jsx("h3",{children:"预约夜间任务"}),r.phase==="pick"?c.jsxs(c.Fragment,{children:[r.selectableTasks.length===0?c.jsxs("div",{className:"empty-state","data-testid":"night-task-empty",children:[c.jsx("p",{className:"empty-title",children:"没有可选任务"}),c.jsx("p",{className:"muted",children:"请先在 Feature Packet / Task Pool 中创建任务,再回到此处刷新。"})]}):c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"Feature / Task"}),c.jsxs("select",{"data-testid":"night-task-select",value:r.selectedKey,disabled:i,onChange:l=>r.setSelectedKey(l.target.value),children:[c.jsx("option",{value:"",children:"选择任务…"}),r.selectableTasks.map(l=>{const o=`${l.featureId}::${l.taskId}`;return c.jsxs("option",{value:o,children:[l.featureId,"/",l.taskId,l.status?` · ${l.status}`:""]},o)})]})]}),r.derivedFeatureDir?c.jsxs("p",{className:"muted","data-testid":"night-feature-dir",children:["Feature 目录:",c.jsx("code",{children:r.derivedFeatureDir})]}):null,c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"本地执行时间"}),c.jsx("input",{type:"datetime-local","data-testid":"night-at",value:r.nightAt,disabled:i,onChange:l=>r.setNightAt(l.target.value)})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"任务卡片(可选)"}),c.jsx("input",{"data-testid":"night-task-card",value:r.taskCard,disabled:i,placeholder:"UCP-LOOP#11",onChange:l=>r.setTaskCard(l.target.value)})]}),c.jsx("div",{className:"cta-row",children:c.jsx("button",{type:"button",className:"btn btn-primary",disabled:i||!r.selectedKey||!r.nightAt,"data-testid":"night-prepare-btn",onClick:()=>{r.onPrepare()},children:"准备并审阅"})})]}):c.jsxs("div",{className:"night-review-card","data-testid":"night-review-card",children:[c.jsx("p",{className:"muted",children:"请确认 writeSet 与执行环境后预约。Token 已隐藏。"}),c.jsxs("dl",{className:"kv",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"Schedule"}),c.jsx("dd",{children:c.jsx("code",{children:r.review?.scheduleId})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"任务"}),c.jsxs("dd",{children:[r.review?.featureId,"/",r.review?.taskId]})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"执行时间 (UTC)"}),c.jsx("dd",{children:iy(r.review?.executeAtUtc)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Worktree"}),c.jsx("dd",{children:c.jsx("code",{children:r.review?.worktreePath??"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"分支"}),c.jsx("dd",{children:c.jsx("code",{children:r.review?.branch??"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Base"}),c.jsx("dd",{children:c.jsxs("code",{children:[r.review?.baseBranch??"—","@",(r.review?.baseCommit??"").slice(0,12)||"—"]})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"WriteSet"}),c.jsx("dd",{children:r.review?.writeSet&&r.review.writeSet.length>0?c.jsx("ul",{className:"night-writeset",children:r.review.writeSet.map(l=>c.jsx("li",{children:c.jsx("code",{children:l})},l))}):c.jsx("span",{className:"muted",children:"(未返回显式 writeSet)"})})]})]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:i||!r.review,"data-testid":"night-confirm-add-btn",onClick:()=>{r.onConfirmAdd()},children:"确认预约"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:i,"data-testid":"night-review-back-btn",onClick:r.onCancelWizard,children:"返回修改"})]})]})]})}function j1(t){const{setOpError:r}=t,[i,l]=k.useState(null),[o,d]=k.useState(null),[u,h]=k.useState([]),[g,p]=k.useState(null),[v,y]=k.useState(!1),[S,x]=k.useState(!1),[w,A]=k.useState(null),[M,O]=k.useState(null),E=k.useCallback(async()=>{y(!0),p(null);try{const[N,$,ne,ce]=await Promise.all([fetch("/api/night-jobs",{credentials:"same-origin"}),fetch("/api/night-jobs/doctor",{credentials:"same-origin"}),fetch("/api/tasks",{credentials:"same-origin"}),fetch("/api/operator/v1/night-aux-ticker",{credentials:"same-origin"})]);if(!N.ok)throw new Error(`加载计划列表失败(HTTP ${N.status})`);const _=await N.json();if(l(_),$.ok?d(await $.json()):d(null),ne.ok){const F=await ne.json();h(Array.isArray(F)?F:[])}else h([]);if(ce.ok){const F=await ce.json();F.ticker&&O(F.ticker)}}catch(N){p(N instanceof Error?N.message:String(N))}finally{y(!1)}},[]);k.useEffect(()=>{E()},[E]);const D=k.useCallback(async()=>{try{const N=await fetch("/api/night-jobs/morning",{credentials:"same-origin"});if(!N.ok){r(`早晨报告加载失败(HTTP ${N.status})`);return}const $=await N.json();A(JSON.stringify($,null,2).slice(0,4e3)),x(!0)}catch(N){r(N instanceof Error?N.message:String(N))}},[r]),G=(o?.findings??[]).filter(N=>N.severity==="error"||N.severity==="warning"),K=(o?.findings??[]).find(N=>/clock/i.test(N.code)||/clock/i.test(N.message));return{list:i,doctor:o,tasks:u,loadError:g,loadingBoard:v,advancedOpen:S,setAdvancedOpen:x,morningPreview:w,auxTicker:M,refreshBoard:E,onMorningReport:D,doctorIssues:G,clockHint:K}}function R1(t){const{board:r,runAction:i,isActionSuccess:l,setOpError:o}=t,{tasks:d,refreshBoard:u}=r,[h,g]=k.useState("pick"),[p,v]=k.useState(""),[y,S]=k.useState(Gp),[x,w]=k.useState(""),[A,M]=k.useState(null),[O,E]=k.useState(""),[D,G]=k.useState(null),[K,N]=k.useState(!1),$=k.useMemo(()=>{const H=d.filter(U=>typeof U.featureId=="string"&&U.featureId.trim()&&U.taskId);return H.sort((U,re)=>{const T=U.featureId??"",R=re.featureId??"";return T!==R?T.localeCompare(R):U.taskId.localeCompare(re.taskId)}),H},[d]),ne=k.useMemo(()=>p?$.find(H=>`${H.featureId}::${H.taskId}`===p)??null:null,[$,p]),ce=ne?.featureId?qp(ne.featureId):"",_=k.useCallback(async(H,U,re)=>{const T=await i("prepareMutationGate",{action:H,actionParams:U});if(!l(T))return;const R=T?.result??T,z=R.receiptId?R:R.result??R;if(!z.receiptId||!z.humanGateToken){o("prepareMutationGate 未返回可消费的 Human Gate receipt");return}return i(H,{...U,confirmationId:z.receiptId,humanGateToken:z.humanGateToken},{clientRequestId:x1(re)})},[l,i,o]),F=k.useCallback(async()=>{if(!ne?.featureId){o("请先点选 Feature / Task");return}const H=y1(y);if(!H){o("执行时间格式无效,请使用日期时间选择器");return}const U={featureDir:qp(ne.featureId),taskId:ne.taskId,at:H,tz:"Asia/Shanghai",...x.trim()?{taskCard:x.trim()}:{}},re=await _("workerAdmissionPrepare",U,"night-prepare");if(!l(re))return;const T=g1(re?.result??re);if(!T){o("准备成功但未解析到 scheduleId / gateToken。请刷新后重试,或查看 Inspect。");return}M(T),g("review")},[l,y,_,ne,o,x]),Y=k.useCallback(async()=>{if(!A)return;const H=await _("workerSchedulerAdd",{scheduleId:A.scheduleId,approveGate:A.gateToken},"night-add");l(H)&&(M(null),g("pick"),v(""),w(""),S(Gp()),await u())},[l,u,A,_]),oe=k.useCallback(()=>{g("pick"),M(null)},[]),X=k.useCallback(async H=>{const U=await _("workerSchedulerHarvest",{scheduleId:H.scheduleId},"night-harvest");l(U)&&await u()},[l,u,_]),B=k.useCallback(async()=>{if(!D)return;const H=O.trim()||"discard from console night workbench",U=Is(D.status),re=await _("workerSchedulerDiscard",{scheduleId:D.scheduleId,reason:H,...U||K?{force:!0}:{}},"night-discard");l(re)&&(G(null),E(""),N(!1),await u())},[O,D,K,l,u,_]),I=k.useCallback(H=>{G(H),N(Is(H.status)),E("")},[]);return{phase:h,selectedKey:p,setSelectedKey:v,nightAt:y,setNightAt:S,taskCard:x,setTaskCard:w,review:A,discardReason:O,setDiscardReason:E,discardTarget:D,setDiscardTarget:G,forceDiscard:K,setForceDiscard:N,selectableTasks:$,derivedFeatureDir:ce,onPrepare:F,onConfirmAdd:Y,onCancelWizard:oe,onHarvest:X,onDiscard:B,openDiscard:I}}function T1({busy:t,runAction:r,isActionSuccess:i,setOpError:l}){const o=j1({setOpError:l}),d=R1({board:o,runAction:r,isActionSuccess:i,setOpError:l});return c.jsxs("section",{className:"panel night-workbench","aria-labelledby":"night-title","data-testid":"night-jobs-panel",children:[c.jsx("h2",{id:"night-title",children:"夜间任务"}),c.jsx("p",{className:"panel-lead",children:"白天点选任务并预约;列表查看状态;早晨在行内收成或丢弃。写操作仍经 Human Gate,列表复用 Inspect 投影。"}),c.jsx(k1,{board:o,busy:t}),c.jsx("div",{className:"cta-row",children:c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:t||o.loadingBoard,"data-testid":"night-refresh-btn",onClick:()=>{o.refreshBoard()},children:"刷新看板"})}),o.loadError?c.jsx("p",{className:"error","data-testid":"night-load-error",children:o.loadError}):null,c.jsx(w1,{board:o,busy:t,onHarvest:u=>{d.onHarvest(u)},onOpenDiscard:d.openDiscard}),d.discardTarget?c.jsx(S1,{target:d.discardTarget,reason:d.discardReason,onReasonChange:d.setDiscardReason,force:d.forceDiscard,onForceChange:d.setForceDiscard,busy:t,onConfirm:()=>{d.onDiscard()},onCancel:()=>d.setDiscardTarget(null)}):null,c.jsx(C1,{wizard:d,busy:t}),c.jsx(p1,{board:o,busy:t})]})}var E1=ry();const N1=({color:t="currentColor",size:r=24,className:i,...l})=>Ar.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ar.createElement("path",{d:"M3 10H2V4.00293C2 3.44903 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.43788 22 4.00293V10H21V20.0015C21 20.553 20.5551 21 20.0066 21H3.9934C3.44476 21 3 20.5525 3 20.0015V10ZM19 10H5V19H19V10ZM4 5V8H20V5H4ZM9 12H15V14H9V12Z"})),A1=({color:t="currentColor",size:r=24,className:i,...l})=>Ar.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ar.createElement("path",{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 11H11V17H9V11ZM13 11H15V17H13V11ZM9 4V6H15V4H9Z"})),I1=({color:t="currentColor",size:r=24,className:i,...l})=>Ar.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ar.createElement("path",{d:"M6.41421 15.89L16.5563 5.74785L15.1421 4.33363L5 14.4758V15.89H6.41421ZM7.24264 17.89H3V13.6473L14.435 2.21231C14.8256 1.82179 15.4587 1.82179 15.8492 2.21231L18.6777 5.04074C19.0682 5.43126 19.0682 6.06443 18.6777 6.45495L7.24264 17.89ZM3 19.89H21V21.89H3V19.89Z"})),D1=({color:t="currentColor",size:r=24,className:i,...l})=>Ar.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Ar.createElement("path",{d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12H4C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C9.25022 4 6.82447 5.38734 5.38451 7.50024L8 7.5V9.5H2V3.5H4L3.99989 5.99918C5.82434 3.57075 8.72873 2 12 2ZM13 7L12.9998 11.585L16.2426 14.8284L14.8284 16.2426L10.9998 12.413L11 7H13Z"})),O1=["command","query","operation","tool","server","symbol","path","file_path","filePath","pattern","glob","url"],M1=120,z1=800;function Ds(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function _1(t){if(t!=null){if(typeof t=="string"){const r=t.trim();if(!r)return;try{return Ds(JSON.parse(r))}catch{return}}return Ds(t)}}function er(t,r){const i=t.replace(/\s+/g," ").trim();return i?i.length>r?`${i.slice(0,r)}…`:i:""}function jt(t,r){const i=t[r];if(typeof i=="string"&&i.trim())return i.trim();if(typeof i=="number"&&Number.isFinite(i))return String(i)}function L1(t,r,i){const l=(t??"").toLowerCase();if(l==="bash"||l==="shell"){const o=jt(r,"command");return o?er(o,i):void 0}if(l==="mcp"||l.startsWith("mcp_")){const o=jt(r,"server"),d=jt(r,"tool")??jt(r,"name"),u=jt(r,"query");return o&&d?er(`${o} · ${d}`,i):d?er(d,i):u?er(u,i):o?er(o,i):void 0}if(l==="lsp_navigation"||l.includes("lsp")){const o=[jt(r,"operation"),jt(r,"symbol"),jt(r,"path")??jt(r,"file_path")??jt(r,"filePath")].filter(Boolean),d=jt(r,"line")??jt(r,"position");if(o.length===0&&!d)return;const u=o.join(" · ");return er(d?`${u}${u?":":""}${d}`:u,i)}if(l==="symbol_search"||l.includes("symbol_search")){const o=jt(r,"query")??jt(r,"symbol");return o?er(o,i):void 0}if(l==="read"||l==="read_symbol"||l==="read_enclosing"||l.startsWith("read_")){const o=jt(r,"path")??jt(r,"file_path")??jt(r,"filePath"),d=jt(r,"symbol"),u=jt(r,"line");if(!o&&!d)return;const h=[o,d,u].filter(Boolean);return er(h.join(" · "),i)}}function B1(t,r){const i=r?.maxLen??M1,l=_1(t);if(!l){if(typeof t=="string"){const g=t.replace(/\s+/g," ").trim();return!g||g==="{}"?"":g.length>i?`${g.slice(0,i)}…`:g}return""}const o=L1(r?.toolName,l,i);if(o)return o;for(const g of O1){const p=l[g];if(typeof p=="string"&&p.trim())return er(p,i)}const d=Object.keys(l);if(d.length===0)return"";const u=l[d[0]],h=String(u??"").replace(/\s+/g," ").trim();return h?h.length>i?`${h.slice(0,i)}…`:h:""}function H1(t){const r=(t??"").toLowerCase();return r==="bash"||r==="shell"?{argsLabel:"命令",resultLabel:"输出"}:r==="mcp"||r.startsWith("mcp_")?{argsLabel:"参数",resultLabel:"结果"}:{argsLabel:"入参",resultLabel:"结果"}}function ly(t){if(t==null)return"";if(typeof t=="string"){const l=t.trim();if(!l)return"";if(l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]"))try{return ly(JSON.parse(l))}catch{return t}return t}if(typeof t=="number"||typeof t=="boolean")return String(t);const r=Ds(t);if(!r)try{return JSON.stringify(t,null,2)}catch{return String(t)}const i=r.content;if(Array.isArray(i)){const l=[];for(const o of i){const d=Ds(o);d&&(d.type==="text"&&typeof d.text=="string"||typeof d.text=="string")&&l.push(d.text)}if(l.length>0)return l.join(`
|
|
11
|
+
`)}if(typeof r.text=="string")return r.text;if(typeof r.output=="string")return r.output;if(typeof r.message=="string")return r.message;try{return JSON.stringify(t,null,2)}catch{return String(t)}}function U1(t){if(t==null)return"";try{return typeof t=="string"?t:JSON.stringify(t,null,2)}catch{return String(t)}}function q1(t,r){if(t===void 0)return{text:"",truncated:!1};const i=r?.maxLen??z1;return t.length<=i?{text:t,truncated:!1}:{text:`${t.slice(0,i)}…`,truncated:!0}}function G1(t,r){if(r===void 0||!Number.isFinite(t)||!Number.isFinite(r))return;const i=Math.round((r-t)/1e3);return i>0?i:void 0}function Zt(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function Pi(t){return`${t}-${Math.random().toString(36).slice(2,10)}`}function xc(t,r){return new Promise((i,l)=>{if(r?.aborted){l(new DOMException("Aborted","AbortError"));return}const o=setTimeout(()=>{r?.removeEventListener("abort",d),i()},t),d=()=>{clearTimeout(o),l(new DOMException("Aborted","AbortError"))};r?.addEventListener("abort",d)})}function sy(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Sc(t){const r=new Date(t),i=new Date;return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate()?"今天":r.toLocaleDateString([],{month:"long",day:"numeric"})}function $1(t,r){return t?t.taskId===r.taskId&&t.updatedAt===r.updatedAt&&t.lastEventId===r.lastEventId&&t.operations.length===r.operations.length:!1}const oy={status:"idle",snapshot:null,error:null,reloading:!1,reloadError:null,mutationBusy:!1,mutationToken:null};function od(t){if(!t||typeof t!="object")return{message:"runtime snapshot request failed"};const r=t,i=r.error;if(i&&typeof i=="object"){const l=i;return{...typeof l.code=="string"&&l.code?{code:l.code}:{},...typeof r.status=="number"?{status:r.status}:{},message:typeof l.message=="string"&&l.message?l.message:"runtime snapshot request failed"}}return{...typeof r.status=="number"?{status:r.status}:{},message:typeof r=="object"&&"message"in r&&typeof r.message=="string"&&r.message?r.message:"runtime snapshot request failed"}}function F1(t,r){switch(r.type){case"load-start":return{...t,sessionId:r.sessionId,status:"loading",error:null};case"load-success":return t.snapshot&&t.sessionId===r.sessionId&&r.snapshot.revision<t.snapshot.revision?t:{...t,sessionId:r.sessionId,status:"ready",snapshot:r.snapshot,error:null,reloadError:null,reloading:!1};case"load-failure":return{...t,sessionId:r.sessionId,status:"error",error:r.error,snapshot:null};case"reload-start":return t.reloading?t:{...t,reloading:!0,reloadError:null,...t.status==="error"?{error:null}:{}};case"reload-success":return{...t,status:"ready",snapshot:r.snapshot,reloading:!1,reloadError:null,error:null,sessionId:r.snapshot.sessionId||t.sessionId};case"reload-failure":return{...t,reloading:!1,reloadError:r.error};case"mutation-start":return{...t,mutationBusy:!0,mutationToken:r.token};case"mutation-adopt":return t.mutationToken!==r.token||t.sessionId!==void 0&&t.sessionId!==r.sessionId||t.snapshot&&r.snapshot.revision<t.snapshot.revision?t:{...t,sessionId:r.sessionId,status:"ready",snapshot:r.snapshot,error:null,reloadError:null,reloading:!1};case"mutation-settle":return t.mutationToken!==r.token?t:{...t,mutationBusy:!1,mutationToken:null};case"mutation-reset":return{...t,mutationBusy:!1,mutationToken:null};case"reset":return{...oy};default:return t}}function uy(t){const r=t.selection;return{...r.model?{model:{provider:r.model.provider,modelId:r.model.id}}:{},...r.thinkingSelection==="auto"?r.effectiveThinkingLevel?{thinkingLevel:r.effectiveThinkingLevel}:{}:{thinkingLevel:r.thinkingSelection}}}function V1(t,r,i,l){const o=i&&i.sessionId===l?uy(i):{},d=o.model??t?.model,u=o.thinkingLevel??t?.thinkingLevel;return{readOnly:r.readOnly,systemPrompt:r.systemPrompt,resources:r.resources,suffix:r.suffix,...d?{model:d}:{},...u?{thinkingLevel:u}:{}}}function P1(t=oy){let r=t;const i=new Set;return{getState:()=>r,dispatch:l=>{r=F1(r,l);for(const o of i)o();return r},subscribe:l=>(i.add(l),()=>i.delete(l))}}const ht=P1();let Nr;function cy(t){return`/api/operator/v1/chat/sessions/${encodeURIComponent(t)}`}function Y1(t){const r=Nr;if(Nr=t,!(r&&r.sessionId===t.sessionId&&r.origin===t.origin)){if((!r||r.sessionId!==t.sessionId)&&ht.dispatch({type:"mutation-reset"}),!t.sessionId){ht.dispatch({type:"reset"});return}ht.dispatch({type:"load-start",sessionId:t.sessionId}),dy(t.sessionId,t.origin)}}async function dy(t,r){try{const i=await fetch(`${r}${cy(t)}/runtime-snapshot`,{credentials:"include"}),l=await i.json().catch(()=>({}));if(Nr?.sessionId!==t)return;if(!i.ok){ht.dispatch({type:"load-failure",sessionId:t,error:{...od(l),status:i.status}});return}if(!l.snapshot){ht.dispatch({type:"load-failure",sessionId:t,error:{status:i.status,message:"runtime snapshot missing in response"}});return}ht.dispatch({type:"load-success",sessionId:t,snapshot:l.snapshot})}catch(i){if(Nr?.sessionId!==t)return;ht.dispatch({type:"load-failure",sessionId:t,error:{message:i instanceof Error?i.message:String(i)}})}}async function Xi(){const t=Nr;if(!t?.sessionId||ht.getState().reloading)return!1;const r=t.sessionId;ht.dispatch({type:"reload-start"});try{const i=await fetch(`${t.origin}${cy(r)}/reload`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Zt()},body:"{}"}),l=await i.json().catch(()=>({}));return Nr?.sessionId!==r?!1:i.ok?l.snapshot?(ht.dispatch({type:"reload-success",snapshot:l.snapshot}),!0):(ht.dispatch({type:"reload-failure",error:{status:i.status,message:"reload succeeded but snapshot missing"}}),!1):(ht.dispatch({type:"reload-failure",error:{...od(l),status:i.status}}),!1)}catch(i){return Nr?.sessionId!==r||ht.dispatch({type:"reload-failure",error:{message:i instanceof Error?i.message:String(i)}}),!1}}async function Qi(){const t=Nr;if(!t?.sessionId)return!1;const r=t.sessionId;return ht.dispatch({type:"load-start",sessionId:r}),dy(r,t.origin),!0}function K1(t,r,i){return i?(ht.dispatch({type:"mutation-adopt",token:t,sessionId:r,snapshot:i}),ht.getState().snapshot===i):!1}function X1(t,r,i){return i.sessionRef.current?.sessionId!==r||ht.getState().mutationToken!==t?!1:(ht.dispatch({type:"mutation-settle",token:t}),!0)}function Ji(){return k.useSyncExternalStore(ht.subscribe,ht.getState)}function fy(t){ht.dispatch(t)}function Q1(){return ht.getState()}function Z1(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/skills/${encodeURIComponent(i)}/auto-invocation`}async function J1(t){const r=t.fetchImpl??fetch;try{const i=await r(Z1(t.origin,t.sessionId,t.resourceId),{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":t.confirmationToken},body:JSON.stringify({autoInvocationEnabled:t.autoInvocationEnabled})}),l=await i.json().catch(()=>({}));if(!i.ok||l.ok===!1)return{ok:!1,error:{...od(l),status:i.status}};const o=l.preferenceSaved===!0,d=l.reloadApplied===!0;if(!o)return{ok:!1,error:{status:i.status,code:"PI_RESOURCE_PREFERENCES_WRITE_FAILED",message:"preference was not saved"}};if(!d){const u=l.error?.code??"PI_SESSION_BUSY",h=l.error?.message??"preference saved; current session is busy and was not reloaded";return{ok:!0,preferenceSaved:!0,reloadApplied:!1,...l.snapshot?{snapshot:l.snapshot}:{},partialBusy:{code:u,message:h}}}return{ok:!0,preferenceSaved:!0,reloadApplied:!0,...l.snapshot?{snapshot:l.snapshot}:{}}}catch(i){return{ok:!1,error:{message:i instanceof Error?i.message:String(i)}}}}function W1(t){return t.autoInvocationEnabled?{badge:"允许自动使用",help:"模型可自动选择该技能,也可通过 /skill:<name> 手动调用。"}:{badge:"已隐藏自动使用",help:`已从模型自动技能列表隐藏,仍可通过 /skill:${t.name} 手动调用。`}}const $c=()=>window.__CONSOLE_CONFIRMATION_TOKEN__??"";function eS({origin:t}){const[r,i]=k.useState(null),[l,o]=k.useState(null),[d,u]=k.useState(null),[h,g]=k.useState(!1),p=Ji(),v=p.snapshot,y=p.reloading,S=p.reloadError,x=v?.diagnostics??[],w=async E=>{i(E),u(null);{o(null);try{const D=await fetch(`${t}/api/operator/v1/pi/models-config`,{credentials:"include"}),G=await D.json();if(!D.ok)throw new Error(G.error?.message??"读取失败");o(G.data)}catch(D){u(D instanceof Error?D.message:String(D))}}},A=async E=>{g(!0),u(null);try{const D=await fetch(`${t}/api/operator/v1/pi/models-config`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":$c()},body:JSON.stringify(E)}),G=await D.json();if(!D.ok)throw new Error(G.error?.message??"模型配置保存失败");o(G.data)}catch(D){u(D instanceof Error?D.message:String(D))}finally{g(!1)}},M=async(E,D)=>{g(!0),u(null);try{const G=await fetch(`${t}/api/operator/v1/pi/models-config/test`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":$c()},body:JSON.stringify({provider:E,modelId:D})}),K=await G.json();if(!G.ok)throw new Error(K.error?.message??"模型测试失败");return K.data?.available===!0}catch(G){return u(G instanceof Error?G.message:String(G)),!1}finally{g(!1)}},O=r==="models"?"Models":r==="skills"?"Skills":"Packages";return c.jsxs("div",{className:"oc-governance",children:[c.jsxs("div",{className:"oc-governance-links",children:[c.jsx("button",{type:"button",onClick:()=>{w("models")},children:"Models"}),c.jsx("button",{type:"button",className:r==="skills"?"is-active":"",onClick:()=>i("skills"),children:"Skills"}),c.jsx("button",{type:"button",className:r==="packages"?"is-active":"",onClick:()=>i("packages"),children:"Packages"})]}),r&&c.jsx("div",{className:"oc-resource-backdrop",onMouseDown:E=>{E.target===E.currentTarget&&i(null)},children:c.jsxs("section",{className:"oc-resource-panel",role:"dialog","aria-modal":"true","aria-label":O,children:[c.jsxs("header",{className:"oc-resource-panel-head",children:[c.jsxs("div",{className:"oc-resource-panel-head-copy",children:[c.jsx("strong",{children:O}),c.jsx("span",{className:"oc-resource-panel-meta",children:r==="models"?"models.json 管理(读写,经 mutation gate)":r==="skills"?"自动使用开关 · 当前 Pi session 实际加载的 Skills":"只读 · 当前 Pi session 实际解析的 Packages"})]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>i(null),children:"关闭"})]}),c.jsxs("div",{className:"oc-resource-panel-body",children:[x.length>0&&c.jsxs("div",{className:"oc-resource-diagnostics",children:[x.map((E,D)=>c.jsx("div",{className:`oc-resource-diagnostic${E.type==="error"?" is-error":""}`,role:E.type==="error"?"alert":void 0,children:c.jsxs("span",{children:[E.type,E.code?` ${E.code}`:"",":",E.message,E.path?`(${E.path})`:"",E.retryable?" · 可重试":""]})},D)),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Qi()},children:"重试"})]}),d&&c.jsx("p",{className:"oc-resource-error",children:d}),r==="models"&&c.jsx(tS,{busy:h,data:l,onMutate:A,onTest:M}),r==="skills"&&c.jsx(nS,{origin:t,sessionId:v?.sessionId,status:p.status,loadError:p.error,skills:v?.skills,hasSession:!!v?.sessionId,hasDiagnostics:x.length>0}),r==="packages"&&c.jsx(aS,{status:p.status,loadError:p.error,packages:v?.packages,hasSession:!!v?.sessionId,hasDiagnostics:x.length>0})]}),c.jsxs("footer",{className:"oc-resource-panel-foot",children:[c.jsx("span",{className:"oc-resource-panel-meta",children:y?"正在重新加载会话…":S?`${S.code??"ERROR"}:${S.message}`:v?`revision ${v.revision} · ${v.loadedAt}`:"等待会话快照…"}),c.jsxs("div",{className:"oc-resource-panel-actions",children:[S&&c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{Xi()},children:"重试"}),p.status==="error"&&c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Qi()},children:"重新读取快照"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{Xi()},children:"重新加载会话"})]})]})]})})]})}function tS({busy:t,data:r,onMutate:i,onTest:l}){const[o,d]=k.useState(""),[u,h]=k.useState(""),[g,p]=k.useState(""),[v,y]=k.useState(null),S=async x=>{x.preventDefault(),!(!r||!o.trim()||!u.trim())&&(await i({expectedRevision:r.revision,action:"upsert-model",provider:o.trim(),model:{id:u.trim(),...g.trim()?{name:g.trim()}:{}}}),h(""),p(""))};return r?c.jsxs("div",{className:"oc-models-config",children:[c.jsx("p",{className:"oc-resource-panel-meta",children:"Console 不读取或写入 API key;credential 请通过 Pi CLI 配置。"}),r.providers.length===0?c.jsx("p",{className:"oc-resource-empty",children:"models.json 中暂无 Provider(真实空态;用 Pi CLI 配置)。"}):null,r.providers.map(x=>c.jsxs("article",{className:"oc-model-provider",children:[c.jsxs("div",{className:"oc-model-provider-head",children:[c.jsx("strong",{children:x.name}),c.jsx("span",{children:x.credential.configured?"credential configured":"credential 未配置"})]}),x.models.map(w=>c.jsxs("div",{className:"oc-model-row",children:[c.jsx("span",{children:w.name?`${w.name} (${w.id})`:w.id}),c.jsxs("div",{className:"oc-model-row-actions",children:[c.jsx("button",{type:"button",disabled:t,onClick:()=>{l(x.name,w.id).then(A=>y(`${x.name}/${w.id}: ${A?"可用":"不可用"}`))},children:"测试"}),c.jsx("button",{type:"button",disabled:t,onClick:()=>{window.confirm(`确认删除模型 ${x.name}/${w.id}?`)&&i({expectedRevision:r.revision,action:"remove-model",provider:x.name,model:{id:w.id}})},children:"删除"})]})]},w.id)),c.jsx("button",{type:"button",className:"oc-model-provider-remove",disabled:t,onClick:()=>{window.confirm(`确认删除 Provider ${x.name}?`)&&i({expectedRevision:r.revision,action:"remove-provider",provider:x.name})},children:"删除 Provider"})]},x.name)),v&&c.jsx("p",{className:"oc-model-test-result",children:v}),c.jsxs("form",{className:"oc-model-form",onSubmit:x=>{S(x)},children:[c.jsx("strong",{children:"新增或更新模型"}),c.jsx("input",{required:!0,placeholder:"Provider",value:o,onChange:x=>d(x.target.value)}),c.jsx("input",{required:!0,placeholder:"Model ID",value:u,onChange:x=>h(x.target.value)}),c.jsx("input",{placeholder:"显示名称(可选)",value:g,onChange:x=>p(x.target.value)}),c.jsx("button",{type:"submit",disabled:t,children:t?"保存中…":"保存模型"})]})]}):c.jsx("p",{className:"oc-resource-empty",children:"正在读取模型配置…"})}function hy(t){return t.status==="loading"?c.jsx("p",{className:"oc-resource-empty",children:"会话快照加载中…"}):t.status==="error"?c.jsxs("div",{className:"oc-resource-error",role:"alert",children:[c.jsxs("span",{children:[t.loadError?.code?`${t.loadError.code}:`:"",t.loadError?.message??"会话快照读取失败"]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Qi()},children:"重试"})]}):t.hasSession?c.jsx("p",{className:"oc-resource-empty",children:t.emptyText}):c.jsx("p",{className:"oc-resource-empty",children:"当前没有活动会话;打开会话后显示真实资源清单(真实空态)。"})}function nS(t){const r=t.skills??[],[i,l]=k.useState(null),[o,d]=k.useState(null),[u,h]=k.useState(null),[g,p]=k.useState({});if(t.status!=="ready"||!t.hasSession)return c.jsx(hy,{status:t.status,loadError:t.loadError,hasSession:t.hasSession,emptyText:"当前 session 未加载任何 Skills(真实空态)"});if(r.length===0&&!t.hasDiagnostics)return c.jsx("p",{className:"oc-resource-empty",children:"当前 session 未加载任何 Skills(真实空态,未伪造列表)。"});const v=new Map;for(const x of r){const w=x.scope||"unknown",A=v.get(w)??[];A.push(x),v.set(w,A)}const y=x=>Object.prototype.hasOwnProperty.call(g,x.resourceId)?g[x.resourceId]:x.autoInvocationEnabled,S=async(x,w)=>{if(!t.sessionId||!x.resourceId||i)return;y(x),d(null),h(null),l(x.resourceId),p(M=>({...M,[x.resourceId]:w}));const A=await J1({origin:t.origin,sessionId:t.sessionId,resourceId:x.resourceId,autoInvocationEnabled:w,confirmationToken:$c()});if(l(null),!A.ok){p(M=>{const O={...M};return delete O[x.resourceId],O}),d(`${A.error.code?`${A.error.code}:`:""}${A.error.message}`);return}if(A.reloadApplied&&A.snapshot){fy({type:"load-success",sessionId:t.sessionId,snapshot:A.snapshot}),p(M=>{const O={...M};return delete O[x.resourceId],O}),h(null);return}!A.reloadApplied&&A.partialBusy&&h(`设置已保存;当前会话正忙(${A.partialBusy.code}),请在本轮结束后点击「重新加载会话」。${A.partialBusy.message}`)};return c.jsxs("div",{className:"oc-resource-lists",children:[o?c.jsx("p",{className:"oc-resource-error",role:"alert",children:o}):null,u?c.jsx("p",{className:"oc-skill-partial-notice",role:"status",children:u}):null,[...v.entries()].map(([x,w])=>c.jsxs("section",{className:"oc-resource-group",children:[c.jsxs("header",{className:"oc-resource-group-head",children:[c.jsx("strong",{children:x}),c.jsxs("span",{children:[w.length," 项"]})]}),c.jsx("ul",{className:"oc-resource-list",children:w.map(A=>{const M=y(A),O=W1({name:A.name,autoInvocationEnabled:M}),E=i===A.resourceId;return c.jsxs("li",{className:`oc-resource-item${M?"":" is-auto-off"}`,children:[c.jsxs("div",{className:"oc-resource-item-head",children:[c.jsx("strong",{children:A.name}),c.jsx("span",{children:O.badge})]}),c.jsxs("label",{className:"oc-skill-auto-toggle",children:[c.jsx("input",{type:"checkbox",checked:M,disabled:E||!A.resourceId,"aria-label":`允许自动使用 ${A.name}`,onChange:D=>{S(A,D.target.checked)}}),c.jsx("span",{children:E?"保存中…":"允许自动使用"})]}),c.jsx("p",{className:"oc-skill-auto-help",children:O.help}),A.description?c.jsx("p",{children:A.description}):null,c.jsx("code",{children:A.path}),A.source?c.jsxs("span",{className:"oc-resource-panel-meta",children:["source: ",A.source]}):null,Array.isArray(A.diagnostics)&&A.diagnostics.length>0?c.jsx("span",{className:"oc-resource-diagnostic",children:A.diagnostics.join(";")}):null]},`${x}:${A.resourceId||A.path}`)})})]},x))]})}const rS={extension:"Extensions",skill:"Skills",prompt:"Prompts",theme:"Themes"};function iS(t){return Array.isArray(t.diagnostics)&&t.diagnostics.length>0?"error":t.enabled?t.version?"installed":"loaded":"disabled"}function aS(t){const r=t.packages??[];return t.status!=="ready"||!t.hasSession?c.jsx(hy,{status:t.status,loadError:t.loadError,hasSession:t.hasSession,emptyText:"当前 session 未配置 Packages(真实空态)"}):r.length===0&&!t.hasDiagnostics?c.jsx("p",{className:"oc-resource-empty",children:"当前 session 未配置 Packages(真实空态,未伪造列表)。"}):c.jsx("div",{className:"oc-resource-lists",children:r.map(i=>{const l=iS(i),o=new Map;for(const d of i.resolved??[]){const u=rS[d.type]??d.type,h=o.get(u)??[];h.push(d),o.set(u,h)}return c.jsxs("article",{className:"oc-resource-item oc-package",children:[c.jsxs("div",{className:"oc-resource-item-head",children:[c.jsx("strong",{children:i.spec}),c.jsx("span",{className:`oc-package-status is-${l}`,children:l})]}),c.jsxs("p",{className:"oc-resource-panel-meta",children:[i.scope," · ",i.enabled?"loaded":"disabled"]}),i.packageName?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"package"}),c.jsx("code",{children:i.packageName})]}):null,i.version?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"installed"}),c.jsxs("code",{children:["v",i.version]})]}):null,i.configuredVersion?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"configured"}),c.jsx("code",{children:i.configuredVersion})]}):null,i.installedPath?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"installed path"}),c.jsx("code",{children:i.installedPath})]}):null,i.cwd?c.jsxs("p",{className:"oc-package-meta",children:[c.jsx("span",{children:"cwd"}),c.jsx("code",{children:i.cwd})]}):null,o.size>0?c.jsx("div",{className:"oc-package-resources",children:[...o.entries()].map(([d,u])=>c.jsxs("section",{className:"oc-package-group",children:[c.jsxs("header",{className:"oc-resource-group-head",children:[c.jsx("strong",{children:d}),c.jsxs("span",{children:[u.length," 项"]})]}),c.jsx("ul",{className:"oc-resource-sub-list",children:u.map((h,g)=>c.jsxs("li",{children:[c.jsx("span",{children:h.name||h.path}),c.jsxs("span",{className:"oc-resource-panel-meta",children:[h.scope,h.source?` · ${h.source}`:""]}),c.jsx("code",{children:h.path})]},`${d}:${g}`))})]},d))}):c.jsx("p",{className:"oc-resource-panel-meta",children:"未解析出扩展/技能/提示词/主题(真实空态)"}),Array.isArray(i.diagnostics)&&i.diagnostics.length>0?c.jsx("div",{className:"oc-package-diagnostics",children:i.diagnostics.map((d,u)=>c.jsx("span",{children:d},u))}):null]},`${i.scope}:${i.spec}`)})})}const Os=10,my="loop-console.operator-chat.sidebar-split.v1",ni=45,Ps=28,Ys=70,$p=5,Fp=10;function Ki(t){return Number.isFinite(t)?Math.min(Ys,Math.max(Ps,Math.round(t))):ni}function lS(t){if(t==null||t==="")return null;const r=Number(t);if(!Number.isFinite(r))return null;const i=Math.round(r);return i<Ps||i>Ys?null:i}function sS(t=py()){if(!t)return ni;try{return lS(t.getItem(my))??ni}catch{return ni}}function Vp(t,r=py()){const i=Ki(t);if(!r)return i;try{r.setItem(my,String(i))}catch{}return i}function oS(t,r,i=!1){const l=Ki(t);switch(r){case"ArrowUp":return Ki(l-(i?Fp:$p));case"ArrowDown":return Ki(l+(i?Fp:$p));case"Home":return Ps;case"End":return Ys;case"Enter":return ni;default:return null}}function Pp(t,r,i){if(!Number.isFinite(i)||i<=0)return ni;const l=(t-r)/i;return Ki(l*100)}function py(){try{return typeof globalThis>"u"?null:globalThis.localStorage??null}catch{return null}}const Yp='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function ud(t){const{open:r,containerRef:i,triggerRef:l,onEscape:o}=t,d=k.useRef(null),u=k.useRef(!1);k.useEffect(()=>{if(r){if(!u.current){const h=document.activeElement;d.current=l?.current??(h instanceof HTMLElement?h:null);const g=i.current;g&&(g.querySelector(Yp)??g).focus?.(),u.current=!0}return()=>{if(!u.current)return;const h=l?.current??d.current;h&&document.contains(h)&&h.focus(),d.current=null,u.current=!1}}u.current=!1},[r,i,l]),k.useEffect(()=>{if(!r)return;const h=i.current;if(!h)return;const g=p=>{if(p.key==="Escape"){p.preventDefault(),o?.();return}if(p.key!=="Tab")return;const v=Array.from(h.querySelectorAll(Yp)).filter(w=>!w.hasAttribute("disabled")&&w.tabIndex!==-1);if(v.length===0){p.preventDefault(),h.focus?.();return}const y=v[0],S=v[v.length-1],x=document.activeElement;p.shiftKey?(x===y||!h.contains(x))&&(p.preventDefault(),S.focus()):(x===S||!h.contains(x))&&(p.preventDefault(),y.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r,i,o])}function uS(t){const{item:r,active:i,state:l}=t,o=r.title||r.displayTitle||"未命名对话",d=k.useRef(null),[u,h]=k.useState(null),g=k.useRef(null),p=()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},v=()=>{p(),h(null)},y=w=>{if(!(w.scrollWidth>w.clientWidth+1)){v();return}const M=w.getBoundingClientRect(),O=12,E=Math.min(360,window.innerWidth-O*2),D=M.left,G=Math.max(O,Math.min(D,window.innerWidth-O-E));h({x:G,y:M.top+M.height/2})},S=w=>{w&&(p(),g.current=window.setTimeout(()=>y(w),350))};k.useEffect(()=>{const w=()=>v(),A=M=>{M.key==="Escape"&&v()};return window.addEventListener("scroll",w,!0),window.addEventListener("keydown",A),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("keydown",A),p()}},[]);const x=`oc-session-tip-${r.sessionId}`;return c.jsxs("div",{className:`oc-session-item${i?" is-active":""}`,"data-session-id":r.sessionId,children:[c.jsxs("button",{type:"button",className:"oc-session-main",onClick:t.onActivate,onMouseEnter:w=>{const A=w.currentTarget.querySelector("strong");A instanceof HTMLElement&&S(A)},onMouseLeave:v,onFocus:w=>{const A=w.currentTarget.querySelector("strong");A instanceof HTMLElement&&S(A)},onBlur:v,"aria-describedby":u?x:void 0,children:[c.jsxs("strong",{ref:d,children:[o,r.activeTurnId?" · 运行中":""]}),c.jsx("span",{children:new Date(r.updatedAt).toLocaleString()})]}),c.jsxs("div",{className:"oc-session-actions",children:[c.jsx("button",{type:"button",className:"oc-session-menu",title:"重命名会话","aria-label":"重命名会话",onClick:w=>{w.stopPropagation();const A=window.prompt("会话名称",r.title??"");A!==null&&t.onRename(A)},children:c.jsx(I1,{size:16,"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"oc-session-menu",title:l==="active"?"归档会话":"恢复会话","aria-label":l==="active"?"归档会话":"恢复会话",onClick:w=>{w.stopPropagation(),t.onSetState(l==="active"?"archived":"active")},children:l==="active"?c.jsx(N1,{size:16,"aria-hidden":"true"}):c.jsx(D1,{size:16,"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"oc-session-menu oc-session-delete",title:"删除会话","aria-label":"删除会话",onClick:w=>{w.stopPropagation(),t.onDelete()},children:c.jsx(A1,{size:16,"aria-hidden":"true"})})]}),u?E1.createPortal(c.jsx("div",{id:x,role:"tooltip",className:"oc-session-title-tooltip",style:{position:"fixed",left:u.x,top:u.y,transform:"translateY(-50%)"},children:o}),document.body):null]})}function cS(t){return[...t].sort((r,i)=>r.kind!==i.kind?r.kind==="directory"?-1:1:r.name.localeCompare(i.name,void 0,{sensitivity:"base"}))}function dS({open:t}){return c.jsx("svg",{className:`oc-tree-chevron${t?" is-open":""}`,width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:c.jsx("path",{d:"M4.2 2.4 7.8 6 4.2 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function fS({open:t}){return t?c.jsxs("svg",{className:"oc-tree-glyph is-folder-open",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[c.jsx("path",{d:"M1.5 4.2h3.1l1.1 1.2H12a.8.8 0 0 1 .8.8v5a.8.8 0 0 1-.8.8H2a.8.8 0 0 1-.8-.8V5a.8.8 0 0 1 .8-.8Z",fill:"currentColor",opacity:"0.88"}),c.jsx("path",{d:"M1.8 5.8h10.4l-.7 5.2H2.5L1.8 5.8Z",fill:"currentColor",opacity:"0.55"})]}):c.jsx("svg",{className:"oc-tree-glyph is-folder",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("path",{d:"M1.5 3.8h3.2l1 1.1H12a.8.8 0 0 1 .8.8v5.5a.8.8 0 0 1-.8.8H2a.8.8 0 0 1-.8-.8V4.6a.8.8 0 0 1 .8-.8Z",fill:"currentColor",opacity:"0.78"})})}function hS(){return c.jsxs("svg",{className:"oc-tree-glyph is-file",width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:[c.jsx("path",{d:"M3.2 1.6h5.1L10.8 4v8.4a.8.8 0 0 1-.8.8H3.2a.8.8 0 0 1-.8-.8V2.4a.8.8 0 0 1 .8-.8Z",fill:"currentColor",opacity:"0.55"}),c.jsx("path",{d:"M8.3 1.7v2.5h2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round",opacity:"0.75"})]})}function mS(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3 3.5h10v2H3v-2Zm0 3.5h10v2H3V7Zm0 3.5h7V13H3v-2Z",fill:"currentColor"})})}function pS(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 3v10M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})}function gS(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 2.2 13 4.5v3.2c0 3.1-2.1 5.5-5 6.3-2.9-.8-5-3.2-5-6.3V4.5L8 2.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})})}function yS(t){const r=t.sessions.slice(0,Os),[i,l]=k.useState(()=>sS()),[o,d]=k.useState(!1),u=k.useRef(null),h=k.useRef(null),g=t.layoutMode==="comfortable"&&t.open,p=t.layoutMode==="compact",v=t.drawerOpen&&(t.layoutMode==="compact"||t.layoutMode==="narrow");ud({open:v,containerRef:h,triggerRef:t.drawerTriggerRef,onEscape:t.onCloseDrawer});const y=k.useCallback((E,D)=>{const G=Ki(E);l(G),D&&Vp(G)},[]),S=k.useCallback(E=>{const D=oS(i,E.key,E.shiftKey);D!=null&&(E.preventDefault(),y(D,!0))},[y,i]),x=k.useCallback(E=>{E.preventDefault(),E.currentTarget.setPointerCapture(E.pointerId),d(!0);const G=u.current;if(!G)return;const K=G.getBoundingClientRect();y(Pp(E.clientY,K.top,K.height),!1)},[y]),w=k.useCallback(E=>{if(!E.currentTarget.hasPointerCapture(E.pointerId))return;const D=u.current;if(!D)return;const G=D.getBoundingClientRect();y(Pp(E.clientY,G.top,G.height),!1)},[y]),A=k.useCallback(E=>{E.currentTarget.hasPointerCapture(E.pointerId)&&E.currentTarget.releasePointerCapture(E.pointerId),d(!1),Vp(i)},[i]),M=k.useCallback(()=>{y(ni,!0)},[y]),O=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"oc-sidebar-split",ref:u,style:{"--oc-session-share":`${i}%`,"--oc-repo-share":`${100-i}%`},"data-dragging":o?"true":"false",children:[c.jsxs("section",{className:"oc-sidebar-section oc-sessions",children:[c.jsxs("header",{children:[c.jsx("strong",{children:"会话"}),c.jsxs("div",{className:"oc-sidebar-header-actions",children:[c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t.onCreate,disabled:t.creatingSession,"aria-busy":t.creatingSession||void 0,children:t.creatingSession?"创建中…":"新建"}),t.layoutMode==="comfortable"?c.jsx("button",{type:"button",className:"oc-sidebar-toggle",onClick:t.onToggleOpen,"aria-expanded":!0,"aria-label":"收起侧栏",title:"收起侧栏",children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("path",{d:"M8.8 2.6 5.2 7l3.6 4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}):c.jsx("button",{type:"button",className:"oc-sidebar-toggle",onClick:t.onCloseDrawer,"aria-label":"关闭侧栏抽屉",title:"关闭",children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 3.5 10.5 10.5M10.5 3.5 3.5 10.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})})]})]}),c.jsxs("div",{className:"oc-session-scroll",children:[["active","archived"].map(E=>{const D=r.filter(G=>G.state===E);return D.length?c.jsxs("div",{className:"oc-session-group",children:[c.jsx("small",{children:E==="active"?"进行中":"已归档"}),D.map(G=>c.jsx(uS,{item:G,active:t.activeSessionId===G.sessionId,state:E,onActivate:()=>t.onActivate(G.sessionId),onRename:K=>t.onRename(G.sessionId,K),onSetState:K=>t.onSetState(G.sessionId,K),onDelete:()=>t.onDelete(G.sessionId)},G.sessionId))]},E):null}),r.length===0?c.jsx("p",{className:"oc-tree-empty",children:"暂无会话,点击上方新建。"}):null]})]}),c.jsx("div",{className:"oc-sidebar-separator",role:"separator","aria-orientation":"horizontal","aria-valuemin":Ps,"aria-valuemax":Ys,"aria-valuenow":i,"aria-label":"调整会话与仓库高度比例",tabIndex:0,onKeyDown:S,onPointerDown:x,onPointerMove:w,onPointerUp:A,onPointerCancel:A,onDoubleClick:M}),c.jsxs("section",{className:"oc-sidebar-section oc-explorer",children:[c.jsxs("header",{children:[c.jsx("strong",{children:"仓库"}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t.onRefreshTree,children:"刷新"})]}),c.jsx("p",{className:"oc-explorer-hint",children:"单击插入 @路径 · 双击预览"}),t.treeError&&c.jsx("p",{className:"oc-sidebar-error",children:t.treeError}),c.jsx("div",{className:"oc-tree-scroll",children:c.jsx(gy,{entries:t.tree[""]??[],tree:t.tree,expanded:t.expanded,depth:0,onToggle:t.onToggleDir,onInsert:t.onInsert,onPreview:t.onPreview})})]})]}),c.jsx(eS,{origin:t.origin})]});return c.jsxs(c.Fragment,{children:[p?c.jsxs("nav",{className:"oc-sidebar-rail","aria-label":"紧凑侧栏",children:[c.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"打开会话与仓库",title:"会话与仓库","aria-expanded":v,onClick:()=>v?t.onCloseDrawer():t.onOpenDrawer(),children:c.jsx(mS,{})}),c.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":t.creatingSession?"创建会话中":"新建会话",title:t.creatingSession?"创建中…":"新建会话",onClick:t.onCreate,disabled:t.creatingSession,"aria-busy":t.creatingSession||void 0,children:c.jsx(pS,{})}),c.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"治理入口",title:"治理",onClick:()=>v?t.onCloseDrawer():t.onOpenDrawer(),children:c.jsx(gS,{})})]}):null,t.layoutMode==="comfortable"?c.jsx("aside",{className:`oc-sidebar${g?"":" is-collapsed"}`,"aria-label":"会话与仓库",children:g?O:c.jsx("button",{type:"button",className:"oc-sidebar-toggle is-collapsed",onClick:t.onToggleOpen,"aria-expanded":!1,"aria-label":"展开侧栏",title:"展开侧栏",children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("path",{d:"M5.2 2.6 8.8 7 5.2 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})})}):null,v?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"oc-overlay-backdrop","aria-label":"关闭侧栏遮罩",onClick:t.onCloseDrawer}),c.jsx("aside",{ref:h,className:"oc-sidebar oc-sidebar-drawer","aria-label":"会话与仓库抽屉",role:"dialog","aria-modal":"true",tabIndex:-1,children:O})]}):null]})}function gy(t){const r=k.useMemo(()=>cS(t.entries),[t.entries]);return r.length?c.jsx("ul",{className:"oc-tree",role:t.depth===0?"tree":"group",children:r.map(i=>{const l=i.name.startsWith(".");if(i.kind==="directory"){const o=t.expanded.has(i.path);return c.jsxs("li",{className:`oc-tree-node is-dir${o?" is-open":""}${l?" is-dot":""}`,role:"treeitem","aria-expanded":o,children:[c.jsxs("button",{type:"button",className:"oc-tree-row oc-tree-dir",onClick:()=>t.onToggle(i.path),style:{paddingLeft:`${8+t.depth*12}px`},children:[c.jsx(dS,{open:o}),c.jsx(fS,{open:o}),c.jsx("span",{className:"oc-tree-label",children:i.name})]}),o?c.jsx("div",{className:"oc-tree-children",style:{"--oc-tree-guide":`${14+t.depth*12}px`},children:c.jsx(gy,{entries:t.tree[i.path]??[],tree:t.tree,expanded:t.expanded,depth:t.depth+1,onToggle:t.onToggle,onInsert:t.onInsert,onPreview:t.onPreview})}):null]},i.path)}return c.jsx("li",{className:`oc-tree-node is-file${l?" is-dot":""}`,role:"treeitem",children:c.jsx(vS,{entry:i,depth:t.depth,onInsert:t.onInsert,onPreview:t.onPreview})},i.path)})}):c.jsx("p",{className:"oc-tree-empty",children:"此目录为空或没有可安全浏览的文件。"})}function vS(t){const r=k.useRef(null);return k.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]),c.jsxs("button",{type:"button",className:"oc-tree-row oc-tree-file",style:{paddingLeft:`${8+t.depth*12}px`},title:"单击插入引用;双击预览",onClick:()=>{r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>{t.onInsert(t.entry.path),r.current=null},220)},onDoubleClick:()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null,t.onPreview(t.entry.path)},children:[c.jsx("span",{className:"oc-tree-chevron-spacer","aria-hidden":"true"}),c.jsx(hS,{}),c.jsx("span",{className:"oc-tree-label",children:t.entry.name})]})}function bS(t){const r=t.previews.find(i=>i.path===t.activePath);return!r&&!t.loading?null:c.jsxs(c.Fragment,{children:[r&&c.jsxs("section",{className:"oc-file-preview","aria-label":`文件预览 ${r.path}`,children:[c.jsxs("header",{children:[c.jsx("div",{className:"oc-file-tabs",role:"tablist","aria-label":"文件预览 Tabs",children:t.previews.map(i=>c.jsx("button",{type:"button",role:"tab","aria-selected":i.path===r.path,className:i.path===r.path?"is-active":"",onClick:()=>t.onActivate(i.path),children:i.path},i.path))}),c.jsxs("span",{children:[r.bytes," bytes",r.truncated?" · 已截断":""]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>t.onClose(r.path),children:"关闭预览"})]}),c.jsx("pre",{children:c.jsx("code",{children:r.content})})]}),t.loading&&c.jsx("div",{className:"oc-file-preview-loading",children:"正在读取文件…"})]})}const cd=[{command:"/task",label:"Task context",description:"查看当前任务、Draft 与 assessment",action:"focus-panel:task",source:"operator"},{command:"/contract",label:"Contract",description:"查看 contract diff 与 apply gate",action:"focus-panel:contract",source:"operator"},{command:"/dag",label:"DAG",description:"查看 DAG spine、确认与运行状态",action:"focus-panel:dag",source:"operator"},{command:"/interview",label:"Interview",description:"打开 Requirement Interview",action:"focus:interview",source:"operator"},{command:"/reload",label:"Reload session",description:"重新加载当前 Pi 会话的设置、扩展、技能、提示词、主题与上下文文件(不产生消息)",action:"reload",source:"operator"},{command:"/help",label:"Shortcuts",description:"显示可用 shortcut",action:"show-help",source:"operator"}],yy=[{command:"/compact",label:"压缩上下文",description:"压缩当前会话上下文,释放 token",action:"compact",source:"web"},{command:"/name",label:"重命名会话",description:"设置当前会话标题",action:"name",source:"web"},{command:"/session",label:"会话信息",description:"显示当前会话元信息",action:"session",source:"web"},{command:"/copy",label:"复制回复",description:"复制最后一条助手消息原文",action:"copy",source:"web"}],ei={operator:0,web:1,extension:2,skill:3,prompt:4};function Kp(t){const r=t.trim().split(/\s+/,1)[0]??"";return r?r.startsWith("/")?r.toLowerCase():`/${r.toLowerCase()}`:""}function Xp(t){const r=t.trim().split(/\s+/,1)[0]?.toLowerCase();if(!r?.startsWith("/"))return;const i=[...cd,...yy].find(l=>l.command===r);return i?{command:i.command,action:i.action}:{command:r,action:"unknown"}}function xS(t=[]){const r=new Map,i=l=>{const o=Kp(l.command);if(!o)return;const d=r.get(o);if(!d){r.set(o,{...l,command:o});return}ei[l.source]<ei[d.source]&&r.set(o,{...l,command:o})};for(const l of cd)i({command:l.command,label:l.label,description:l.description,source:l.source,action:l.action});for(const l of yy)i({command:l.command,label:l.label,description:l.description,source:l.source,action:l.action});for(const l of t){const o=Kp(l.command);o&&i({command:o,label:l.label||o,description:l.description||"",source:l.source,action:"pi-prompt"})}return[...r.values()].sort((l,o)=>{const d=ei[l.source]-ei[o.source];return d!==0?d:l.command.localeCompare(o.command)})}function SS(t,r){const i=(r.trim().split(/\s+/,1)[0]??"").toLowerCase();if((/\s/.test(r.trimStart().slice(1))||r.includes(" "))&&r.trimStart().includes(" "))return[];const l=i.startsWith("/")?i:i?`/${i}`:"/",o=l==="/"?"":l.slice(1),d=[];for(const u of t){const h=u.command.toLowerCase(),g=h.startsWith("/")?h.slice(1):h,p=u.description.toLowerCase();let v=100;if(!o)v=10+ei[u.source];else if(h===l||g===o)v=0;else if(h.startsWith(l)||g.startsWith(o))v=1;else if(g.includes(o)||h.includes(o))v=2;else if(p.includes(o))v=3;else continue;d.push({...u,score:v})}return d.sort((u,h)=>{if(u.score!==h.score)return u.score-h.score;const g=ei[u.source]-ei[h.source];return g!==0?g:u.command.localeCompare(h.command)})}const kS={operator:"Operator",web:"Pi Web",extension:"Extensions",prompt:"Prompts",skill:"Skills"},Qp={comfortableMin:620,compactMin:480};function wS(t){return!Number.isFinite(t)||t<0?"extra-compact":t>=Qp.comfortableMin?"comfortable":t>=Qp.compactMin?"compact":"extra-compact"}function CS(t){return`is-landing-${t}`}const jS=[{label:"新建任务",hint:"从需求描述导入并创建任务",prompt:"帮我新建一个任务:我描述需求,你引导我用 PRD/需求描述导入(bootstrapFromPrd),并给出建议的 taskKind(如后端研发 backend-feature / 后端测试 backend-test)。"},{label:"查看任务状态",hint:"列出任务与就绪/阻塞状态",prompt:"列出当前所有 task 及其状态,重点说明哪些是 Ready 可以推进、哪些 Blocked 及阻塞原因。"},{label:"诊断 DAG 运行",hint:"对失败运行跑 Doctor",prompt:"帮我诊断最近失败或异常的 DAG 运行:先列出最近的 DAG 运行,对有问题的运行执行 doctor,总结根因和可执行的恢复方案。"},{label:"恢复或重跑任务",hint:"默认从节点续跑,勿无故新开 task",prompt:"我要恢复失败或卡住的 DAG。请先 dagReport/doctor 看 primaryFailure.nodeId 与 primaryRecovery;默认用 dagRerunPlan→dagRerun 从失败/安全上游节点续跑(先 plan 再 Human Gate),不要新建 task-id。仅当 plan 不合格(writer/decision/fingerprint)或契约/源真变时才 standaloneTaskRerun;paused 走 approve/resume;Worker-owned 用 workerTaskRetry。确定后直接帮我发起。"}];function vy(t){const r=t.readiness==="setup-required",i=!!t.disabled||r,l=t.density??"comfortable",o=t.mode==="no-session"?"开始一段新的对话":"今天想推进什么?",d=t.mode==="no-session"?"用自然语言编排 loop-agent:查询状态、诊断问题、创建与恢复任务。可先点选下方建议,或新建空白对话。":"会话已就绪。点选建议快速开场,或在下方输入框直接描述目标。业务写入仍经受治理 DAG。";return c.jsxs("div",{className:`oc-empty ${CS(l)}`,role:"status","data-landing-density":l,children:[c.jsxs("div",{className:"oc-empty-hero",children:[c.jsx("img",{className:"oc-empty-icon oc-empty-brand",src:"/favicon.svg",alt:"","aria-hidden":"true",draggable:!1}),c.jsxs("div",{className:"oc-empty-copy",children:[c.jsx("h3",{children:o}),c.jsx("p",{children:d})]})]}),c.jsx("div",{className:"oc-suggestions","aria-label":"开场建议",children:jS.map(u=>c.jsxs("button",{type:"button",className:"oc-suggestion",onClick:()=>t.onSuggest(u.prompt),disabled:i,children:[c.jsx("strong",{children:u.label}),c.jsx("span",{children:l==="extra-compact"?u.hint.replace(/[,,].*$/,""):u.hint})]},u.label))}),c.jsxs("ul",{className:"oc-empty-tips",children:[c.jsxs("li",{children:[c.jsx("kbd",{children:"@"}),c.jsx("span",{children:"引用仓库文件"})]}),c.jsxs("li",{children:[c.jsx("kbd",{children:"/"}),c.jsx("span",{children:"快捷命令"})]}),c.jsxs("li",{children:[c.jsx("kbd",{children:"Enter"}),c.jsx("span",{children:"发送 · Shift+Enter 换行"})]})]}),t.mode==="no-session"&&t.onCreateSession?c.jsx("button",{type:"button",className:"btn btn-primary oc-empty-cta",onClick:t.onCreateSession,disabled:i,"aria-busy":t.disabled||void 0,children:r?"需先完成 Pi setup":t.disabled?"创建中…":"新建空白对话"}):null]})}function RS(t){const{artifact:r}=t;return c.jsxs("section",{className:"oc-artifact-card","aria-label":`${r.kind} artifact`,children:[c.jsxs("header",{children:[c.jsx("strong",{children:r.title??r.artifactId}),c.jsx("span",{children:r.kind})]}),r.summary&&c.jsx("p",{children:r.summary}),r.reportText&&c.jsx("pre",{children:r.reportText}),r.htmlPreview&&c.jsx("iframe",{title:`${r.title??r.artifactId} preview`,sandbox:"",srcDoc:r.htmlPreview}),r.inspectHref&&c.jsx("a",{href:r.inspectHref,children:"查看详情"})]})}function TS({card:t,origin:r,sessionId:i}){const[l,o]=k.useState(!1),[d,u]=k.useState(),h=async()=>{o(!0),u(void 0);try{const y=t.gateType==="dag-run"?t.state==="prepared"?"dag-confirm":"dag-run":t.gateType==="mutation"?"mutation-apply":"contract-apply",S=t.gateType==="dag-run"?{confirmationId:t.confirmationId,...t.state==="prepared"?{humanGateToken:t.humanGateToken}:{}}:{receiptId:t.receiptId,humanGateToken:t.humanGateToken},x=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/human-gate/${y}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Zt()},body:JSON.stringify(S)}),w=await x.json();if(!x.ok)throw new Error(w.error?.message??`HTTP ${x.status}`)}catch(y){u(y instanceof Error?y.message:String(y))}finally{o(!1)}},g=t.state==="prepared"||t.gateType==="dag-run"&&t.state==="confirmed",p=t.gateType==="contract-apply"?"Contract apply":t.gateType==="mutation"?"Mutation":"DAG run",v=t.gateType==="contract-apply"?"Apply":t.gateType==="mutation"?"Execute":t.state==="prepared"?"Confirm":"Run";return c.jsxs("section",{className:`oc-human-gate-card is-${t.state}`,"aria-label":`Human gate ${t.cardId}`,children:[c.jsxs("header",{children:[c.jsxs("div",{children:[c.jsx("small",{children:"HumanGateCard · 仅人类可确认"}),c.jsx("strong",{children:p})]}),c.jsx("span",{children:t.state})]}),t.contractDiffSummary&&c.jsx("p",{children:t.contractDiffSummary}),t.displayOnlyChallenges&&c.jsxs("div",{className:"oc-human-gate-challenges",children:[c.jsx("b",{children:"Challenge(仅展示,不是确认信号)"}),c.jsx("ul",{children:t.displayOnlyChallenges.map(y=>c.jsx("li",{children:y},y))})]}),t.dagSpine&&t.dagSpine.length>0&&c.jsxs("div",{children:[c.jsx("b",{children:"DAG spine"}),c.jsx("ol",{children:t.dagSpine.map(y=>c.jsx("li",{children:c.jsx("code",{children:y})},y))})]}),c.jsxs("footer",{children:[c.jsx("a",{href:t.inspectHref,children:"Inspect"}),c.jsx("button",{className:"btn btn-primary",type:"button",disabled:!g||l,onClick:()=>{h()},children:l?"提交中…":v})]}),d&&c.jsx("div",{className:"oc-human-gate-error",children:d})]})}const Cn="loop-console.operator-chat.active-session.v1",ES="loop-console.operator-chat.default-landing.v1";function Ms(t){const r=t?.trim().toLowerCase();if(r==="chat")return"chat";if(r==="tasks")return"tasks"}function by(t){const r=t?.trim().toLowerCase();if(r==="chat"||r==="tasks"||r==="recovery"||r==="night"||r==="models"||r==="settings")return r}function xy(t){const r=i=>t.get(i)?.trim()||void 0;return{...r("taskId")?{taskId:r("taskId")}:{},...r("dagRunId")?{dagRunId:r("dagRunId")}:{},...r("fromNodeId")?{fromNodeId:r("fromNodeId")}:{},...r("featureId")?{featureId:r("featureId")}:{}}}function Sy(t){const r=String(t??"").replace(/^#/,"");if(!r)return null;const i=r.indexOf("?"),l=i>=0?r.slice(0,i):r,o=i>=0?r.slice(i+1):"",d=(l||"/").split("?")[0]||"/";if(d==="/"||d==="")return null;const u=d.replace(/^\//,"").split("/")[0],h=by(u);return h?{workspace:h,...xy(new URLSearchParams(o))}:null}function NS(t){const r=new URLSearchParams(t.search),i=t.hash.startsWith("#")?t.hash.slice(1):t.hash,l=new URLSearchParams(i),o=by(r.get("workspace")??r.get("landing")??l.get("workspace"));return o?{workspace:o,...xy(r)}:null}function AS(t){if(!t)return;const r=Sy(t.hash);if(r)return r.workspace;const i=new URLSearchParams(t.search),l=Ms(i.get("landing")??i.get("workspace"));if(l)return l;const o=t.hash.startsWith("#")?t.hash.slice(1):t.hash;return Ms(new URLSearchParams(o).get("workspace"))}function ky(t){return AS(t.location)??Ms(t.storage?.getItem(ES))??Ms(t.env)??"tasks"}function wy(t,r={}){const i=new URLSearchParams;for(const[d,u]of Object.entries(r))u?.trim()&&i.set(d,u.trim());const l=i.toString(),o=`/${t}`;return l?`${o}?${l}`:o}function IS(t,r={}){return`#${wy(t,r)}`}function DS(t){return Sy(t.hash)??NS(t)}function OS(t){const{operation:r}=t,i=r.inspectHref.startsWith("/")?`${t.origin}${r.inspectHref}`:r.inspectHref,l=r.state==="failed"||r.state==="timed-out"||r.state==="needs-reconcile",o=(u,h)=>{t.onNavigateWorkspace?t.onNavigateWorkspace(u,h):window.location.assign(IS(u,h))},d=[r.taskId?["task",r.taskId]:void 0,r.dagRunId?["dag",r.dagRunId]:void 0,r.featureId?["feature",r.featureId]:void 0,r.workerRunId?["worker",r.workerRunId]:void 0].filter(u=>!!u);return c.jsxs("section",{className:`oc-operation-card is-${r.state}`,"aria-label":`Operation ${r.operationId}`,children:[c.jsxs("header",{className:"oc-operation-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"oc-operation-kicker",children:"Operation"}),c.jsx("strong",{children:r.action})]}),c.jsx("span",{className:`oc-operation-state is-${r.state}`,children:r.state})]}),c.jsx("div",{className:"oc-operation-id",children:c.jsx("code",{children:r.operationId})}),d.length>0&&c.jsx("div",{className:"oc-operation-identities",children:d.map(([u,h])=>c.jsxs("span",{children:[c.jsx("b",{children:u})," ",h]},`${u}:${h}`))}),r.controller&&c.jsxs("div",{className:"oc-operation-controller",children:["controller: ",r.controller]}),r.summaryPreview&&c.jsx("pre",{className:"oc-operation-preview",children:r.summaryPreview}),r.stderrPreview&&c.jsx("pre",{className:"oc-operation-preview is-error",children:r.stderrPreview}),r.stdoutPreview&&c.jsx("pre",{className:"oc-operation-preview",children:r.stdoutPreview}),c.jsxs("footer",{className:"oc-operation-actions",children:[c.jsx("a",{className:"btn btn-ghost",href:i,target:"_blank",rel:"noreferrer",children:"Inspect"}),r.taskId&&c.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>o("tasks",{taskId:r.taskId}),children:"打开 Task Ops"}),r.dagRunId&&c.jsx("a",{className:"btn btn-ghost",href:`${t.origin}/inspect/#/dag/${encodeURIComponent(r.dagRunId)}`,target:"_blank",rel:"noreferrer",children:"打开 Run / Inspect"}),l&&(r.dagRunId||r.taskId)&&c.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>o("recovery",{taskId:r.taskId,dagRunId:r.dagRunId}),children:"打开 Recovery"}),c.jsx("time",{dateTime:r.updatedAt,children:new Date(r.updatedAt).toLocaleString()})]})]})}function MS(t){const{interview:r,interviewAnswer:i,onAnswerChange:l,onAnswer:o}=t;return c.jsxs("section",{className:"oc-draft-card","aria-label":"Requirement Interview",children:[c.jsxs("header",{children:[c.jsx("strong",{children:"Requirement Interview"}),c.jsx("span",{children:r.state})]}),r.question&&c.jsxs("div",{className:"oc-interview-bubble",children:[c.jsx("strong",{children:r.question.text}),c.jsxs("p",{children:["建议:",r.question.recommendation]}),c.jsx("textarea",{value:i,onChange:d=>l(d.target.value),placeholder:"输入答案"}),c.jsxs("div",{children:[c.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>o("override"),disabled:!i.trim(),children:"提交答案"}),c.jsx("button",{className:"btn btn-ghost",type:"button",onClick:()=>o("accept-recommendation"),children:"接受建议"})]})]}),r.draft&&c.jsxs("details",{open:!0,children:[c.jsxs("summary",{children:["TaskContractDraftV1 · ",r.draftSha256?.slice(0,12)]}),c.jsx("pre",{children:JSON.stringify(r.draft,null,2)})]}),r.assessment&&c.jsxs("div",{className:`oc-assessment${r.assessment.fresh?" is-fresh":""}`,children:[c.jsxs("strong",{children:["完整性:",r.assessment.outcome]}),(r.assessment.missingFields??[]).length>0&&c.jsxs("p",{children:["缺失:",r.assessment.missingFields?.join("、")]})]}),r.taskKindRecommendation&&c.jsxs("div",{className:"oc-task-kind-card",children:[c.jsx("span",{children:"taskKind 建议"}),c.jsx("strong",{children:r.taskKindRecommendation}),c.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>t.onConfirmTaskKind(),children:"由我确认"}),c.jsx("small",{children:"模型不能代替人类确认。"})]}),r.confirmedTaskKind&&c.jsxs("div",{className:"oc-task-kind-card is-confirmed",children:["已由人类确认:",c.jsx("strong",{children:r.confirmedTaskKind})]})]})}function zS(t,r){const i={};return(t[t.length-1]===""?[...t,""]:t).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const _S=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BS={};function Zp(t,r){return(BS.jsx?LS:_S).test(t)}const HS=/[ \t\n\f\r]/g;function US(t){return typeof t=="object"?t.type==="text"?Jp(t.value):!1:Jp(t)}function Jp(t){return t.replace(HS,"")===""}class ll{constructor(r,i,l){this.normal=i,this.property=r,l&&(this.space=l)}}ll.prototype.normal={};ll.prototype.property={};ll.prototype.space=void 0;function Cy(t,r){const i={},l={};for(const o of t)Object.assign(i,o.property),Object.assign(l,o.normal);return new ll(i,l,r)}function Fc(t){return t.toLowerCase()}class Jt{constructor(r,i){this.attribute=i,this.property=r}}Jt.prototype.attribute="";Jt.prototype.booleanish=!1;Jt.prototype.boolean=!1;Jt.prototype.commaOrSpaceSeparated=!1;Jt.prototype.commaSeparated=!1;Jt.prototype.defined=!1;Jt.prototype.mustUseProperty=!1;Jt.prototype.number=!1;Jt.prototype.overloadedBoolean=!1;Jt.prototype.property="";Jt.prototype.spaceSeparated=!1;Jt.prototype.space=void 0;let qS=0;const Ne=ai(),kt=ai(),Vc=ai(),pe=ai(),it=ai(),ri=ai(),sn=ai();function ai(){return 2**++qS}const Pc=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:kt,commaOrSpaceSeparated:sn,commaSeparated:ri,number:pe,overloadedBoolean:Vc,spaceSeparated:it},Symbol.toStringTag,{value:"Module"})),kc=Object.keys(Pc);class dd extends Jt{constructor(r,i,l,o){let d=-1;if(super(r,i),Wp(this,"space",o),typeof l=="number")for(;++d<kc.length;){const u=kc[d];Wp(this,kc[d],(l&Pc[u])===Pc[u])}}}dd.prototype.defined=!0;function Wp(t,r,i){i&&(t[r]=i)}function Wi(t){const r={},i={};for(const[l,o]of Object.entries(t.properties)){const d=new dd(l,t.transform(t.attributes||{},l),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(l)&&(d.mustUseProperty=!0),r[l]=d,i[Fc(l)]=l,i[Fc(d.attribute)]=l}return new ll(r,i,t.space)}const jy=Wi({properties:{ariaActiveDescendant:null,ariaAtomic:kt,ariaAutoComplete:null,ariaBusy:kt,ariaChecked:kt,ariaColCount:pe,ariaColIndex:pe,ariaColSpan:pe,ariaControls:it,ariaCurrent:null,ariaDescribedBy:it,ariaDetails:null,ariaDisabled:kt,ariaDropEffect:it,ariaErrorMessage:null,ariaExpanded:kt,ariaFlowTo:it,ariaGrabbed:kt,ariaHasPopup:null,ariaHidden:kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:it,ariaLevel:pe,ariaLive:null,ariaModal:kt,ariaMultiLine:kt,ariaMultiSelectable:kt,ariaOrientation:null,ariaOwns:it,ariaPlaceholder:null,ariaPosInSet:pe,ariaPressed:kt,ariaReadOnly:kt,ariaRelevant:null,ariaRequired:kt,ariaRoleDescription:it,ariaRowCount:pe,ariaRowIndex:pe,ariaRowSpan:pe,ariaSelected:kt,ariaSetSize:pe,ariaSort:null,ariaValueMax:pe,ariaValueMin:pe,ariaValueNow:pe,ariaValueText:null,role:null},transform(t,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Ry(t,r){return r in t?t[r]:r}function Ty(t,r){return Ry(t,r.toLowerCase())}const GS=Wi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ri,acceptCharset:it,accessKey:it,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alpha:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:it,autoFocus:Ne,autoPlay:Ne,blocking:it,capture:null,charSet:null,checked:Ne,cite:null,className:it,closedBy:null,colorSpace:null,cols:pe,colSpan:pe,command:null,commandFor:null,content:null,contentEditable:kt,controls:Ne,controlsList:it,coords:pe|ri,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:Vc,draggable:kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:it,height:pe,hidden:Vc,high:pe,href:null,hrefLang:null,htmlFor:it,httpEquiv:it,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:it,itemRef:it,itemScope:Ne,itemType:it,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:pe,manifest:null,max:null,maxLength:pe,media:null,method:null,min:null,minLength:pe,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,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:Ne,optimum:pe,pattern:null,ping:it,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:it,required:Ne,reversed:Ne,rows:pe,rowSpan:pe,sandbox:it,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootCustomElementRegistry:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shadowRootSerializable:Ne,shape:null,size:pe,sizes:null,slot:null,span:pe,spellCheck:kt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:pe,step:null,style:null,tabIndex:pe,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:kt,width:pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:it,axis:null,background:null,bgColor:null,border:pe,borderColor:null,bottomMargin:pe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:pe,leftMargin:pe,link:null,longDesc:null,lowSrc:null,marginHeight:pe,marginWidth:pe,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:pe,rules:null,scheme:null,scrolling:kt,standby:null,summary:null,text:null,topMargin:pe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:pe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ne,disablePictureInPicture:Ne,disableRemotePlayback:Ne,exportParts:ri,part:it,prefix:null,property:null,results:pe,security:null,unselectable:null},space:"html",transform:Ty}),$S=Wi({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:sn,accentHeight:pe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:pe,amplitude:pe,arabicForm:null,ascent:pe,attributeName:null,attributeType:null,azimuth:pe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:pe,by:null,calcMode:null,capHeight:pe,className:it,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:pe,diffuseConstant:pe,direction:null,display:null,dur:null,divisor:pe,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:pe,enableBackground:null,end:null,event:null,exponent:pe,externalResourcesRequired:null,fill:null,fillOpacity:pe,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:ri,g2:ri,glyphName:ri,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:pe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:pe,horizOriginX:pe,horizOriginY:pe,id:null,ideographic:pe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:pe,k:pe,k1:pe,k2:pe,k3:pe,k4:pe,kernelMatrix:sn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:pe,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:pe,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:pe,overlineThickness:pe,paintOrder:null,panose1:null,path:null,pathLength:pe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:it,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:pe,pointsAtY:pe,pointsAtZ:pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sn,rev:sn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sn,requiredFeatures:sn,requiredFonts:sn,requiredFormats:sn,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:pe,specularExponent:pe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:pe,strikethroughThickness:pe,string:null,stroke:null,strokeDashArray:sn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:pe,strokeOpacity:pe,strokeWidth:null,style:null,surfaceScale:pe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sn,tabIndex:pe,tableValues:null,target:null,targetX:pe,targetY:pe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:pe,underlineThickness:pe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:pe,values:null,vAlphabetic:pe,vMathematical:pe,vectorEffect:null,vHanging:pe,vIdeographic:pe,version:null,vertAdvY:pe,vertOriginX:pe,vertOriginY:pe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:pe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ry}),Ey=Wi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,r){return"xlink:"+r.slice(5).toLowerCase()}}),Ny=Wi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ty}),Ay=Wi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,r){return"xml:"+r.slice(3).toLowerCase()}}),FS={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"},VS=/[A-Z]/g,eg=/-[a-z]/g,PS=/^data[-\w.:]+$/i;function YS(t,r){const i=Fc(r);let l=r,o=Jt;if(i in t.normal)return t.property[t.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&PS.test(r)){if(r.charAt(4)==="-"){const d=r.slice(5).replace(eg,XS);l="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=r.slice(4);if(!eg.test(d)){let u=d.replace(VS,KS);u.charAt(0)!=="-"&&(u="-"+u),r="data"+u}}o=dd}return new o(l,r)}function KS(t){return"-"+t.toLowerCase()}function XS(t){return t.charAt(1).toUpperCase()}const QS=Cy([jy,GS,Ey,Ny,Ay],"html"),fd=Cy([jy,$S,Ey,Ny,Ay],"svg");function ZS(t){return t.join(" ").trim()}var Fi={},wc,tg;function JS(){if(tg)return wc;tg=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,g=`
|
|
12
|
+
`,p="/",v="*",y="",S="comment",x="declaration";function w(M,O){if(typeof M!="string")throw new TypeError("First argument must be a string");if(!M)return[];O=O||{};var E=1,D=1;function G(X){var B=X.match(r);B&&(E+=B.length);var I=X.lastIndexOf(g);D=~I?X.length-I:D+X.length}function K(){var X={line:E,column:D};return function(B){return B.position=new N(X),ce(),B}}function N(X){this.start=X,this.end={line:E,column:D},this.source=O.source}N.prototype.content=M;function $(X){var B=new Error(O.source+":"+E+":"+D+": "+X);if(B.reason=X,B.filename=O.source,B.line=E,B.column=D,B.source=M,!O.silent)throw B}function ne(X){var B=X.exec(M);if(B){var I=B[0];return G(I),M=M.slice(I.length),B}}function ce(){ne(i)}function _(X){var B;for(X=X||[];B=F();)B!==!1&&X.push(B);return X}function F(){var X=K();if(!(p!=M.charAt(0)||v!=M.charAt(1))){for(var B=2;y!=M.charAt(B)&&(v!=M.charAt(B)||p!=M.charAt(B+1));)++B;if(B+=2,y===M.charAt(B-1))return $("End of comment missing");var I=M.slice(2,B-2);return D+=2,G(I),M=M.slice(B),D+=2,X({type:S,comment:I})}}function Y(){var X=K(),B=ne(l);if(B){if(F(),!ne(o))return $("property missing ':'");var I=ne(d),H=X({type:x,property:A(B[0].replace(t,y)),value:I?A(I[0].replace(t,y)):y});return ne(u),H}}function oe(){var X=[];_(X);for(var B;B=Y();)B!==!1&&(X.push(B),_(X));return X}return ce(),oe()}function A(M){return M?M.replace(h,y):y}return wc=w,wc}var ng;function WS(){if(ng)return Fi;ng=1;var t=Fi&&Fi.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.default=i;const r=t(JS());function i(l,o){let d=null;if(!l||typeof l!="string")return d;const u=(0,r.default)(l),h=typeof o=="function";return u.forEach(g=>{if(g.type!=="declaration")return;const{property:p,value:v}=g;h?o(p,v,g):v&&(d=d||{},d[p]=v)}),d}return Fi}var Xa={},rg;function e0(){if(rg)return Xa;rg=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,d=function(p){return!p||i.test(p)||t.test(p)},u=function(p,v){return v.toUpperCase()},h=function(p,v){return"".concat(v,"-")},g=function(p,v){return v===void 0&&(v={}),d(p)?p:(p=p.toLowerCase(),v.reactCompat?p=p.replace(o,h):p=p.replace(l,h),p.replace(r,u))};return Xa.camelCase=g,Xa}var Qa,ig;function t0(){if(ig)return Qa;ig=1;var t=Qa&&Qa.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=t(WS()),i=e0();function l(o,d){var u={};return!o||typeof o!="string"||(0,r.default)(o,function(h,g){h&&g&&(u[(0,i.camelCase)(h,d)]=g)}),u}return l.default=l,Qa=l,Qa}var n0=t0();const r0=ld(n0),Iy=Dy("end"),hd=Dy("start");function Dy(t){return r;function r(i){const l=i&&i.position&&i.position[t]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function i0(t){const r=hd(t),i=Iy(t);if(r&&i)return{start:r,end:i}}function tl(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ag(t.position):"start"in t||"end"in t?ag(t):"line"in t||"column"in t?Yc(t):""}function Yc(t){return lg(t&&t.line)+":"+lg(t&&t.column)}function ag(t){return Yc(t&&t.start)+"-"+Yc(t&&t.end)}function lg(t){return t&&typeof t=="number"?t:1}class Bt extends Error{constructor(r,i,l){super(),typeof i=="string"&&(l=i,i=void 0);let o="",d={},u=!1;if(i&&("line"in i&&"column"in i?d={place:i}:"start"in i&&"end"in i?d={place:i}:"type"in i?d={ancestors:[i],place:i.position}:d={...i}),typeof r=="string"?o=r:!d.cause&&r&&(u=!0,o=r.message,d.cause=r),!d.ruleId&&!d.source&&typeof l=="string"){const g=l.indexOf(":");g===-1?d.ruleId=l:(d.source=l.slice(0,g),d.ruleId=l.slice(g+1))}if(!d.place&&d.ancestors&&d.ancestors){const g=d.ancestors[d.ancestors.length-1];g&&(d.place=g.position)}const h=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=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=h?h.line:void 0,this.name=tl(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=u&&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}}Bt.prototype.file="";Bt.prototype.name="";Bt.prototype.reason="";Bt.prototype.message="";Bt.prototype.stack="";Bt.prototype.column=void 0;Bt.prototype.line=void 0;Bt.prototype.ancestors=void 0;Bt.prototype.cause=void 0;Bt.prototype.fatal=void 0;Bt.prototype.place=void 0;Bt.prototype.ruleId=void 0;Bt.prototype.source=void 0;const md={}.hasOwnProperty,a0=new Map,l0=/[A-Z]/g,s0=new Set(["table","tbody","thead","tfoot","tr"]),o0=new Set(["td","th"]),Oy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function u0(t,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let l;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=y0(i,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=g0(i,r.jsx,r.jsxs)}const o={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:l,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?fd:QS,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},d=My(o,t,void 0);return d&&typeof d!="string"?d:o.create(t,o.Fragment,{children:d||void 0},void 0)}function My(t,r,i){if(r.type==="element")return c0(t,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return d0(t,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return h0(t,r,i);if(r.type==="mdxjsEsm")return f0(t,r);if(r.type==="root")return m0(t,r,i);if(r.type==="text")return p0(t,r)}function c0(t,r,i){const l=t.schema;let o=l;r.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=fd,t.schema=o),t.ancestors.push(r);const d=_y(t,r.tagName,!1),u=v0(t,r);let h=gd(t,r);return s0.has(r.tagName)&&(h=h.filter(function(g){return typeof g=="string"?!US(g):!0})),zy(t,u,d,r),pd(u,h),t.ancestors.pop(),t.schema=l,t.create(r,d,u,i)}function d0(t,r){if(r.data&&r.data.estree&&t.evaluater){const l=r.data.estree.body[0];return l.type,t.evaluater.evaluateExpression(l.expression)}il(t,r.position)}function f0(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);il(t,r.position)}function h0(t,r,i){const l=t.schema;let o=l;r.name==="svg"&&l.space==="html"&&(o=fd,t.schema=o),t.ancestors.push(r);const d=r.name===null?t.Fragment:_y(t,r.name,!0),u=b0(t,r),h=gd(t,r);return zy(t,u,d,r),pd(u,h),t.ancestors.pop(),t.schema=l,t.create(r,d,u,i)}function m0(t,r,i){const l={};return pd(l,gd(t,r)),t.create(r,t.Fragment,l,i)}function p0(t,r){return r.value}function zy(t,r,i,l){typeof i!="string"&&i!==t.Fragment&&t.passNode&&(r.node=l)}function pd(t,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(t.children=i)}}function g0(t,r,i){return l;function l(o,d,u,h){const p=Array.isArray(u.children)?i:r;return h?p(d,u,h):p(d,u)}}function y0(t,r){return i;function i(l,o,d,u){const h=Array.isArray(d.children),g=hd(l);return r(o,d,u,h,{columnNumber:g?g.column-1:void 0,fileName:t,lineNumber:g?g.line:void 0},void 0)}}function v0(t,r){const i={};let l,o;for(o in r.properties)if(o!=="children"&&md.call(r.properties,o)){const d=x0(t,o,r.properties[o]);if(d){const[u,h]=d;t.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&o0.has(r.tagName)?l=h:i[u]=h}}if(l){const d=i.style||(i.style={});d[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return i}function b0(t,r){const i={};for(const l of r.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&t.evaluater){const d=l.data.estree.body[0];d.type;const u=d.expression;u.type;const h=u.properties[0];h.type,Object.assign(i,t.evaluater.evaluateExpression(h.argument))}else il(t,r.position);else{const o=l.name;let d;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&t.evaluater){const h=l.value.data.estree.body[0];h.type,d=t.evaluater.evaluateExpression(h.expression)}else il(t,r.position);else d=l.value===null?!0:l.value;i[o]=d}return i}function gd(t,r){const i=[];let l=-1;const o=t.passKeys?new Map:a0;for(;++l<r.children.length;){const d=r.children[l];let u;if(t.passKeys){const g=d.type==="element"?d.tagName:d.type==="mdxJsxFlowElement"||d.type==="mdxJsxTextElement"?d.name:void 0;if(g){const p=o.get(g)||0;u=g+"-"+p,o.set(g,p+1)}}const h=My(t,d,u);h!==void 0&&i.push(h)}return i}function x0(t,r,i){const l=YS(t.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=l.commaSeparated?zS(i):ZS(i)),l.property==="style"){let o=typeof i=="object"?i:S0(t,String(i));return t.stylePropertyNameCase==="css"&&(o=k0(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&l.space?FS[l.property]||l.property:l.attribute,i]}}function S0(t,r){try{return r0(r,{reactCompat:!0})}catch(i){if(t.ignoreInvalidStyle)return{};const l=i,o=new Bt("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=Oy+"#cannot-parse-style-attribute",o}}function _y(t,r,i){let l;if(!i)l={type:"Literal",value:r};else if(r.includes(".")){const o=r.split(".");let d=-1,u;for(;++d<o.length;){const h=Zp(o[d])?{type:"Identifier",name:o[d]}:{type:"Literal",value:o[d]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(d&&h.type==="Literal"),optional:!1}:h}l=u}else l=Zp(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(l.type==="Literal"){const o=l.value;return md.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(l);il(t)}function il(t,r){const i=new Bt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=Oy+"#cannot-handle-mdx-estrees-without-createevaluater",i}function k0(t){const r={};let i;for(i in t)md.call(t,i)&&(r[w0(i)]=t[i]);return r}function w0(t){let r=t.replace(l0,C0);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function C0(t){return"-"+t.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"]},j0={};function yd(t,r){const i=j0,l=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Ly(t,l,o)}function Ly(t,r,i){if(R0(t)){if("value"in t)return t.type==="html"&&!i?"":t.value;if(r&&"alt"in t&&t.alt)return t.alt;if("children"in t)return sg(t.children,r,i)}return Array.isArray(t)?sg(t,r,i):""}function sg(t,r,i){const l=[];let o=-1;for(;++o<t.length;)l[o]=Ly(t[o],r,i);return l.join("")}function R0(t){return!!(t&&typeof t=="object")}const og=document.createElement("i");function vd(t){const r="&"+t+";";og.innerHTML=r;const i=og.textContent;return i.charCodeAt(i.length-1)===59&&t!=="semi"||i===r?!1:i}function on(t,r,i,l){const o=t.length;let d=0,u;if(r<0?r=-r>o?0:o+r:r=r>o?o:r,i=i>0?i:0,l.length<1e4)u=Array.from(l),u.unshift(r,i),t.splice(...u);else for(i&&t.splice(r,i);d<l.length;)u=l.slice(d,d+1e4),u.unshift(r,0),t.splice(...u),d+=1e4,r+=1e4}function bn(t,r){return t.length>0?(on(t,t.length,0,r),t):r}const ug={}.hasOwnProperty;function By(t){const r={};let i=-1;for(;++i<t.length;)T0(r,t[i]);return r}function T0(t,r){let i;for(i in r){const o=(ug.call(t,i)?t[i]:void 0)||(t[i]={}),d=r[i];let u;if(d)for(u in d){ug.call(o,u)||(o[u]=[]);const h=d[u];E0(o[u],Array.isArray(h)?h:h?[h]:[])}}}function E0(t,r){let i=-1;const l=[];for(;++i<r.length;)(r[i].add==="after"?t:l).push(r[i]);on(t,0,0,l)}function Hy(t,r){const i=Number.parseInt(t,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function jn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ut=Ir(/[A-Za-z]/),Lt=Ir(/[\dA-Za-z]/),N0=Ir(/[#-'*+\--9=?A-Z^-~]/);function zs(t){return t!==null&&(t<32||t===127)}const Kc=Ir(/\d/),A0=Ir(/[\dA-Fa-f]/),I0=Ir(/[!-/:-@[-`{-~]/);function ke(t){return t!==null&&t<-2}function at(t){return t!==null&&(t<0||t===32)}function Be(t){return t===-2||t===-1||t===32}const Ks=Ir(new RegExp("\\p{P}|\\p{S}","u")),ii=Ir(/\s/);function Ir(t){return r;function r(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function ea(t){const r=[];let i=-1,l=0,o=0;for(;++i<t.length;){const d=t.charCodeAt(i);let u="";if(d===37&&Lt(t.charCodeAt(i+1))&&Lt(t.charCodeAt(i+2)))o=2;else if(d<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(d))||(u=String.fromCharCode(d));else if(d>55295&&d<57344){const h=t.charCodeAt(i+1);d<56320&&h>56319&&h<57344?(u=String.fromCharCode(d,h),o=1):u="�"}else u=String.fromCharCode(d);u&&(r.push(t.slice(l,i),encodeURIComponent(u)),l=i+o+1,u=""),o&&(i+=o,o=0)}return r.join("")+t.slice(l)}function Ve(t,r,i,l){const o=l?l-1:Number.POSITIVE_INFINITY;let d=0;return u;function u(g){return Be(g)?(t.enter(i),h(g)):r(g)}function h(g){return Be(g)&&d++<o?(t.consume(g),h):(t.exit(i),r(g))}}const D0={tokenize:O0};function O0(t){const r=t.attempt(this.parser.constructs.contentInitial,l,o);let i;return r;function l(h){if(h===null){t.consume(h);return}return t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),Ve(t,r,"linePrefix")}function o(h){return t.enter("paragraph"),d(h)}function d(h){const g=t.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=g),i=g,u(h)}function u(h){if(h===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(h);return}return ke(h)?(t.consume(h),t.exit("chunkText"),d):(t.consume(h),u)}}const M0={tokenize:z0},cg={tokenize:_0};function z0(t){const r=this,i=[];let l=0,o,d,u;return h;function h(D){if(l<i.length){const G=i[l];return r.containerState=G[1],t.attempt(G[0].continuation,g,p)(D)}return p(D)}function g(D){if(l++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&E();const G=r.events.length;let K=G,N;for(;K--;)if(r.events[K][0]==="exit"&&r.events[K][1].type==="chunkFlow"){N=r.events[K][1].end;break}O(l);let $=G;for(;$<r.events.length;)r.events[$][1].end={...N},$++;return on(r.events,K+1,0,r.events.slice(G)),r.events.length=$,p(D)}return h(D)}function p(D){if(l===i.length){if(!o)return S(D);if(o.currentConstruct&&o.currentConstruct.concrete)return w(D);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},t.check(cg,v,y)(D)}function v(D){return o&&E(),O(l),S(D)}function y(D){return r.parser.lazy[r.now().line]=l!==i.length,u=r.now().offset,w(D)}function S(D){return r.containerState={},t.attempt(cg,x,w)(D)}function x(D){return l++,i.push([r.currentConstruct,r.containerState]),S(D)}function w(D){if(D===null){o&&E(),O(0),t.consume(D);return}return o=o||r.parser.flow(r.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:d}),A(D)}function A(D){if(D===null){M(t.exit("chunkFlow"),!0),O(0),t.consume(D);return}return ke(D)?(t.consume(D),M(t.exit("chunkFlow")),l=0,r.interrupt=void 0,h):(t.consume(D),A)}function M(D,G){const K=r.sliceStream(D);if(G&&K.push(null),D.previous=d,d&&(d.next=D),d=D,o.defineSkip(D.start),o.write(K),r.parser.lazy[D.start.line]){let N=o.events.length;for(;N--;)if(o.events[N][1].start.offset<u&&(!o.events[N][1].end||o.events[N][1].end.offset>u))return;const $=r.events.length;let ne=$,ce,_;for(;ne--;)if(r.events[ne][0]==="exit"&&r.events[ne][1].type==="chunkFlow"){if(ce){_=r.events[ne][1].end;break}ce=!0}for(O(l),N=$;N<r.events.length;)r.events[N][1].end={..._},N++;on(r.events,ne+1,0,r.events.slice($)),r.events.length=N}}function O(D){let G=i.length;for(;G-- >D;){const K=i[G];r.containerState=K[1],K[0].exit.call(r,t)}i.length=D}function E(){o.write([null]),d=void 0,o=void 0,r.containerState._closeFlow=void 0}}function _0(t,r,i){return Ve(t,t.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Zi(t){if(t===null||at(t)||ii(t))return 1;if(Ks(t))return 2}function Xs(t,r,i){const l=[];let o=-1;for(;++o<t.length;){const d=t[o].resolveAll;d&&!l.includes(d)&&(r=d(r,i),l.push(d))}return r}const Xc={name:"attention",resolveAll:L0,tokenize:B0};function L0(t,r){let i=-1,l,o,d,u,h,g,p,v;for(;++i<t.length;)if(t[i][0]==="enter"&&t[i][1].type==="attentionSequence"&&t[i][1]._close){for(l=i;l--;)if(t[l][0]==="exit"&&t[l][1].type==="attentionSequence"&&t[l][1]._open&&r.sliceSerialize(t[l][1]).charCodeAt(0)===r.sliceSerialize(t[i][1]).charCodeAt(0)){if((t[l][1]._close||t[i][1]._open)&&(t[i][1].end.offset-t[i][1].start.offset)%3&&!((t[l][1].end.offset-t[l][1].start.offset+t[i][1].end.offset-t[i][1].start.offset)%3))continue;g=t[l][1].end.offset-t[l][1].start.offset>1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;const y={...t[l][1].end},S={...t[i][1].start};dg(y,-g),dg(S,g),u={type:g>1?"strongSequence":"emphasisSequence",start:y,end:{...t[l][1].end}},h={type:g>1?"strongSequence":"emphasisSequence",start:{...t[i][1].start},end:S},d={type:g>1?"strongText":"emphasisText",start:{...t[l][1].end},end:{...t[i][1].start}},o={type:g>1?"strong":"emphasis",start:{...u.start},end:{...h.end}},t[l][1].end={...u.start},t[i][1].start={...h.end},p=[],t[l][1].end.offset-t[l][1].start.offset&&(p=bn(p,[["enter",t[l][1],r],["exit",t[l][1],r]])),p=bn(p,[["enter",o,r],["enter",u,r],["exit",u,r],["enter",d,r]]),p=bn(p,Xs(r.parser.constructs.insideSpan.null,t.slice(l+1,i),r)),p=bn(p,[["exit",d,r],["enter",h,r],["exit",h,r],["exit",o,r]]),t[i][1].end.offset-t[i][1].start.offset?(v=2,p=bn(p,[["enter",t[i][1],r],["exit",t[i][1],r]])):v=0,on(t,l-1,i-l+3,p),i=l+p.length-v-2;break}}for(i=-1;++i<t.length;)t[i][1].type==="attentionSequence"&&(t[i][1].type="data");return t}function B0(t,r){const i=this.parser.constructs.attentionMarkers.null,l=this.previous,o=Zi(l);let d;return u;function u(g){return d=g,t.enter("attentionSequence"),h(g)}function h(g){if(g===d)return t.consume(g),h;const p=t.exit("attentionSequence"),v=Zi(g),y=!v||v===2&&o||i.includes(g),S=!o||o===2&&v||i.includes(l);return p._open=!!(d===42?y:y&&(o||!S)),p._close=!!(d===42?S:S&&(v||!y)),r(g)}}function dg(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}const H0={name:"autolink",tokenize:U0};function U0(t,r,i){let l=0;return o;function o(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),d}function d(x){return Ut(x)?(t.consume(x),u):x===64?i(x):p(x)}function u(x){return x===43||x===45||x===46||Lt(x)?(l=1,h(x)):p(x)}function h(x){return x===58?(t.consume(x),l=0,g):(x===43||x===45||x===46||Lt(x))&&l++<32?(t.consume(x),h):(l=0,p(x))}function g(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),r):x===null||x===32||x===60||zs(x)?i(x):(t.consume(x),g)}function p(x){return x===64?(t.consume(x),v):N0(x)?(t.consume(x),p):i(x)}function v(x){return Lt(x)?y(x):i(x)}function y(x){return x===46?(t.consume(x),l=0,v):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),r):S(x)}function S(x){if((x===45||Lt(x))&&l++<63){const w=x===45?S:y;return t.consume(x),w}return i(x)}}const sl={partial:!0,tokenize:q0};function q0(t,r,i){return l;function l(d){return Be(d)?Ve(t,o,"linePrefix")(d):o(d)}function o(d){return d===null||ke(d)?r(d):i(d)}}const Uy={continuation:{tokenize:$0},exit:F0,name:"blockQuote",tokenize:G0};function G0(t,r,i){const l=this;return o;function o(u){if(u===62){const h=l.containerState;return h.open||(t.enter("blockQuote",{_container:!0}),h.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(u),t.exit("blockQuoteMarker"),d}return i(u)}function d(u){return Be(u)?(t.enter("blockQuotePrefixWhitespace"),t.consume(u),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),r):(t.exit("blockQuotePrefix"),r(u))}}function $0(t,r,i){const l=this;return o;function o(u){return Be(u)?Ve(t,d,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):d(u)}function d(u){return t.attempt(Uy,r,i)(u)}}function F0(t){t.exit("blockQuote")}const qy={name:"characterEscape",tokenize:V0};function V0(t,r,i){return l;function l(d){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(d),t.exit("escapeMarker"),o}function o(d){return I0(d)?(t.enter("characterEscapeValue"),t.consume(d),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):i(d)}}const Gy={name:"characterReference",tokenize:P0};function P0(t,r,i){const l=this;let o=0,d,u;return h;function h(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),g}function g(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),p):(t.enter("characterReferenceValue"),d=31,u=Lt,v(y))}function p(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),d=6,u=A0,v):(t.enter("characterReferenceValue"),d=7,u=Kc,v(y))}function v(y){if(y===59&&o){const S=t.exit("characterReferenceValue");return u===Lt&&!vd(l.sliceSerialize(S))?i(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),r)}return u(y)&&o++<d?(t.consume(y),v):i(y)}}const fg={partial:!0,tokenize:K0},hg={concrete:!0,name:"codeFenced",tokenize:Y0};function Y0(t,r,i){const l=this,o={partial:!0,tokenize:K};let d=0,u=0,h;return g;function g(N){return p(N)}function p(N){const $=l.events[l.events.length-1];return d=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,h=N,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),v(N)}function v(N){return N===h?(u++,t.consume(N),v):u<3?i(N):(t.exit("codeFencedFenceSequence"),Be(N)?Ve(t,y,"whitespace")(N):y(N))}function y(N){return N===null||ke(N)?(t.exit("codeFencedFence"),l.interrupt?r(N):t.check(fg,A,G)(N)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),S(N))}function S(N){return N===null||ke(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(N)):Be(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ve(t,x,"whitespace")(N)):N===96&&N===h?i(N):(t.consume(N),S)}function x(N){return N===null||ke(N)?y(N):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),w(N))}function w(N){return N===null||ke(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(N)):N===96&&N===h?i(N):(t.consume(N),w)}function A(N){return t.attempt(o,G,M)(N)}function M(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),O}function O(N){return d>0&&Be(N)?Ve(t,E,"linePrefix",d+1)(N):E(N)}function E(N){return N===null||ke(N)?t.check(fg,A,G)(N):(t.enter("codeFlowValue"),D(N))}function D(N){return N===null||ke(N)?(t.exit("codeFlowValue"),E(N)):(t.consume(N),D)}function G(N){return t.exit("codeFenced"),r(N)}function K(N,$,ne){let ce=0;return _;function _(B){return N.enter("lineEnding"),N.consume(B),N.exit("lineEnding"),F}function F(B){return N.enter("codeFencedFence"),Be(B)?Ve(N,Y,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):Y(B)}function Y(B){return B===h?(N.enter("codeFencedFenceSequence"),oe(B)):ne(B)}function oe(B){return B===h?(ce++,N.consume(B),oe):ce>=u?(N.exit("codeFencedFenceSequence"),Be(B)?Ve(N,X,"whitespace")(B):X(B)):ne(B)}function X(B){return B===null||ke(B)?(N.exit("codeFencedFence"),$(B)):ne(B)}}}function K0(t,r,i){const l=this;return o;function o(u){return u===null?i(u):(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),d)}function d(u){return l.parser.lazy[l.now().line]?i(u):r(u)}}const jc={name:"codeIndented",tokenize:Q0},X0={partial:!0,tokenize:Z0};function Q0(t,r,i){const l=this;return o;function o(p){return t.enter("codeIndented"),Ve(t,d,"linePrefix",5)(p)}function d(p){const v=l.events[l.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?u(p):i(p)}function u(p){return p===null?g(p):ke(p)?t.attempt(X0,u,g)(p):(t.enter("codeFlowValue"),h(p))}function h(p){return p===null||ke(p)?(t.exit("codeFlowValue"),u(p)):(t.consume(p),h)}function g(p){return t.exit("codeIndented"),r(p)}}function Z0(t,r,i){const l=this;return o;function o(u){return l.parser.lazy[l.now().line]?i(u):ke(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),o):Ve(t,d,"linePrefix",5)(u)}function d(u){const h=l.events[l.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?r(u):ke(u)?o(u):i(u)}}const J0={name:"codeText",previous:ek,resolve:W0,tokenize:tk};function W0(t){let r=t.length-4,i=3,l,o;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[r][1].type==="lineEnding"||t[r][1].type==="space")){for(l=i;++l<r;)if(t[l][1].type==="codeTextData"){t[i][1].type="codeTextPadding",t[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(l=i-1,r++;++l<=r;)o===void 0?l!==r&&t[l][1].type!=="lineEnding"&&(o=l):(l===r||t[l][1].type==="lineEnding")&&(t[o][1].type="codeTextData",l!==o+2&&(t[o][1].end=t[l-1][1].end,t.splice(o+2,l-o-2),r-=l-o-2,l=o+2),o=void 0);return t}function ek(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function tk(t,r,i){let l=0,o,d;return u;function u(y){return t.enter("codeText"),t.enter("codeTextSequence"),h(y)}function h(y){return y===96?(t.consume(y),l++,h):(t.exit("codeTextSequence"),g(y))}function g(y){return y===null?i(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),g):y===96?(d=t.enter("codeTextSequence"),o=0,v(y)):ke(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),g):(t.enter("codeTextData"),p(y))}function p(y){return y===null||y===32||y===96||ke(y)?(t.exit("codeTextData"),g(y)):(t.consume(y),p)}function v(y){return y===96?(t.consume(y),o++,v):o===l?(t.exit("codeTextSequence"),t.exit("codeText"),r(y)):(d.type="codeTextData",p(y))}}class nk{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,i){const l=i??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(r,l):r>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(r,i,l){const o=i||0;this.setCursor(Math.trunc(r));const d=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&Za(this.left,l),d.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Za(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Za(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const i=this.left.splice(r,Number.POSITIVE_INFINITY);Za(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Za(this.left,i.reverse())}}}function Za(t,r){let i=0;if(r.length<1e4)t.push(...r);else for(;i<r.length;)t.push(...r.slice(i,i+1e4)),i+=1e4}function $y(t){const r={};let i=-1,l,o,d,u,h,g,p;const v=new nk(t);for(;++i<v.length;){for(;i in r;)i=r[i];if(l=v.get(i),i&&l[1].type==="chunkFlow"&&v.get(i-1)[1].type==="listItemPrefix"&&(g=l[1]._tokenizer.events,d=0,d<g.length&&g[d][1].type==="lineEndingBlank"&&(d+=2),d<g.length&&g[d][1].type==="content"))for(;++d<g.length&&g[d][1].type!=="content";)g[d][1].type==="chunkText"&&(g[d][1]._isInFirstContentOfListItem=!0,d++);if(l[0]==="enter")l[1].contentType&&(Object.assign(r,rk(v,i)),i=r[i],p=!0);else if(l[1]._container){for(d=i,o=void 0;d--;)if(u=v.get(d),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(o&&(v.get(o)[1].type="lineEndingBlank"),u[1].type="lineEnding",o=d);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;o&&(l[1].end={...v.get(o)[1].start},h=v.slice(o,i),h.unshift(l),v.splice(o,i-o+1,h))}}return on(t,0,Number.POSITIVE_INFINITY,v.slice(0)),!p}function rk(t,r){const i=t.get(r)[1],l=t.get(r)[2];let o=r-1;const d=[];let u=i._tokenizer;u||(u=l.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,g=[],p={};let v,y,S=-1,x=i,w=0,A=0;const M=[A];for(;x;){for(;t.get(++o)[1]!==x;);d.push(o),x._tokenizer||(v=l.sliceStream(x),x.next||v.push(null),y&&u.defineSkip(x.start),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(v),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),y=x,x=x.next}for(x=i;++S<h.length;)h[S][0]==="exit"&&h[S-1][0]==="enter"&&h[S][1].type===h[S-1][1].type&&h[S][1].start.line!==h[S][1].end.line&&(A=S+1,M.push(A),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(u.events=[],x?(x._tokenizer=void 0,x.previous=void 0):M.pop(),S=M.length;S--;){const O=h.slice(M[S],M[S+1]),E=d.pop();g.push([E,E+O.length-1]),t.splice(E,2,O)}for(g.reverse(),S=-1;++S<g.length;)p[w+g[S][0]]=w+g[S][1],w+=g[S][1]-g[S][0]-1;return p}const ik={resolve:lk,tokenize:sk},ak={partial:!0,tokenize:ok};function lk(t){return $y(t),t}function sk(t,r){let i;return l;function l(h){return t.enter("content"),i=t.enter("chunkContent",{contentType:"content"}),o(h)}function o(h){return h===null?d(h):ke(h)?t.check(ak,u,d)(h):(t.consume(h),o)}function d(h){return t.exit("chunkContent"),t.exit("content"),r(h)}function u(h){return t.consume(h),t.exit("chunkContent"),i.next=t.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,o}}function ok(t,r,i){const l=this;return o;function o(u){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),Ve(t,d,"linePrefix")}function d(u){if(u===null||ke(u))return i(u);const h=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?r(u):t.interrupt(l.parser.constructs.flow,i,r)(u)}}function Fy(t,r,i,l,o,d,u,h,g){const p=g||Number.POSITIVE_INFINITY;let v=0;return y;function y(O){return O===60?(t.enter(l),t.enter(o),t.enter(d),t.consume(O),t.exit(d),S):O===null||O===32||O===41||zs(O)?i(O):(t.enter(l),t.enter(u),t.enter(h),t.enter("chunkString",{contentType:"string"}),A(O))}function S(O){return O===62?(t.enter(d),t.consume(O),t.exit(d),t.exit(o),t.exit(l),r):(t.enter(h),t.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===62?(t.exit("chunkString"),t.exit(h),S(O)):O===null||O===60||ke(O)?i(O):(t.consume(O),O===92?w:x)}function w(O){return O===60||O===62||O===92?(t.consume(O),x):x(O)}function A(O){return!v&&(O===null||O===41||at(O))?(t.exit("chunkString"),t.exit(h),t.exit(u),t.exit(l),r(O)):v<p&&O===40?(t.consume(O),v++,A):O===41?(t.consume(O),v--,A):O===null||O===32||O===40||zs(O)?i(O):(t.consume(O),O===92?M:A)}function M(O){return O===40||O===41||O===92?(t.consume(O),A):A(O)}}function Vy(t,r,i,l,o,d){const u=this;let h=0,g;return p;function p(x){return t.enter(l),t.enter(o),t.consume(x),t.exit(o),t.enter(d),v}function v(x){return h>999||x===null||x===91||x===93&&!g||x===94&&!h&&"_hiddenFootnoteSupport"in u.parser.constructs?i(x):x===93?(t.exit(d),t.enter(o),t.consume(x),t.exit(o),t.exit(l),r):ke(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),v):(t.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===null||x===91||x===93||ke(x)||h++>999?(t.exit("chunkString"),v(x)):(t.consume(x),g||(g=!Be(x)),x===92?S:y)}function S(x){return x===91||x===92||x===93?(t.consume(x),h++,y):y(x)}}function Py(t,r,i,l,o,d){let u;return h;function h(S){return S===34||S===39||S===40?(t.enter(l),t.enter(o),t.consume(S),t.exit(o),u=S===40?41:S,g):i(S)}function g(S){return S===u?(t.enter(o),t.consume(S),t.exit(o),t.exit(l),r):(t.enter(d),p(S))}function p(S){return S===u?(t.exit(d),g(u)):S===null?i(S):ke(S)?(t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),Ve(t,p,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===u||S===null||ke(S)?(t.exit("chunkString"),p(S)):(t.consume(S),S===92?y:v)}function y(S){return S===u||S===92?(t.consume(S),v):v(S)}}function nl(t,r){let i;return l;function l(o){return ke(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i=!0,l):Be(o)?Ve(t,l,i?"linePrefix":"lineSuffix")(o):r(o)}}const uk={name:"definition",tokenize:dk},ck={partial:!0,tokenize:fk};function dk(t,r,i){const l=this;let o;return d;function d(x){return t.enter("definition"),u(x)}function u(x){return Vy.call(l,t,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function h(x){return o=jn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),g):i(x)}function g(x){return at(x)?nl(t,p)(x):p(x)}function p(x){return Fy(t,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function v(x){return t.attempt(ck,y,y)(x)}function y(x){return Be(x)?Ve(t,S,"whitespace")(x):S(x)}function S(x){return x===null||ke(x)?(t.exit("definition"),l.parser.defined.push(o),r(x)):i(x)}}function fk(t,r,i){return l;function l(h){return at(h)?nl(t,o)(h):i(h)}function o(h){return Py(t,d,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function d(h){return Be(h)?Ve(t,u,"whitespace")(h):u(h)}function u(h){return h===null||ke(h)?r(h):i(h)}}const hk={name:"hardBreakEscape",tokenize:mk};function mk(t,r,i){return l;function l(d){return t.enter("hardBreakEscape"),t.consume(d),o}function o(d){return ke(d)?(t.exit("hardBreakEscape"),r(d)):i(d)}}const pk={name:"headingAtx",resolve:gk,tokenize:yk};function gk(t,r){let i=t.length-2,l=3,o,d;return t[l][1].type==="whitespace"&&(l+=2),i-2>l&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(l===i-1||i-4>l&&t[i-2][1].type==="whitespace")&&(i-=l+1===i?2:4),i>l&&(o={type:"atxHeadingText",start:t[l][1].start,end:t[i][1].end},d={type:"chunkText",start:t[l][1].start,end:t[i][1].end,contentType:"text"},on(t,l,i-l+1,[["enter",o,r],["enter",d,r],["exit",d,r],["exit",o,r]])),t}function yk(t,r,i){let l=0;return o;function o(v){return t.enter("atxHeading"),d(v)}function d(v){return t.enter("atxHeadingSequence"),u(v)}function u(v){return v===35&&l++<6?(t.consume(v),u):v===null||at(v)?(t.exit("atxHeadingSequence"),h(v)):i(v)}function h(v){return v===35?(t.enter("atxHeadingSequence"),g(v)):v===null||ke(v)?(t.exit("atxHeading"),r(v)):Be(v)?Ve(t,h,"whitespace")(v):(t.enter("atxHeadingText"),p(v))}function g(v){return v===35?(t.consume(v),g):(t.exit("atxHeadingSequence"),h(v))}function p(v){return v===null||v===35||at(v)?(t.exit("atxHeadingText"),h(v)):(t.consume(v),p)}}const vk=["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"],mg=["pre","script","style","textarea"],bk={concrete:!0,name:"htmlFlow",resolveTo:kk,tokenize:wk},xk={partial:!0,tokenize:jk},Sk={partial:!0,tokenize:Ck};function kk(t){let r=t.length;for(;r--&&!(t[r][0]==="enter"&&t[r][1].type==="htmlFlow"););return r>1&&t[r-2][1].type==="linePrefix"&&(t[r][1].start=t[r-2][1].start,t[r+1][1].start=t[r-2][1].start,t.splice(r-2,2)),t}function wk(t,r,i){const l=this;let o,d,u,h,g;return p;function p(C){return v(C)}function v(C){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(C),y}function y(C){return C===33?(t.consume(C),S):C===47?(t.consume(C),d=!0,A):C===63?(t.consume(C),o=3,l.interrupt?r:T):Ut(C)?(t.consume(C),u=String.fromCharCode(C),M):i(C)}function S(C){return C===45?(t.consume(C),o=2,x):C===91?(t.consume(C),o=5,h=0,w):Ut(C)?(t.consume(C),o=4,l.interrupt?r:T):i(C)}function x(C){return C===45?(t.consume(C),l.interrupt?r:T):i(C)}function w(C){const ie="CDATA[";return C===ie.charCodeAt(h++)?(t.consume(C),h===ie.length?l.interrupt?r:Y:w):i(C)}function A(C){return Ut(C)?(t.consume(C),u=String.fromCharCode(C),M):i(C)}function M(C){if(C===null||C===47||C===62||at(C)){const ie=C===47,fe=u.toLowerCase();return!ie&&!d&&mg.includes(fe)?(o=1,l.interrupt?r(C):Y(C)):vk.includes(u.toLowerCase())?(o=6,ie?(t.consume(C),O):l.interrupt?r(C):Y(C)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?i(C):d?E(C):D(C))}return C===45||Lt(C)?(t.consume(C),u+=String.fromCharCode(C),M):i(C)}function O(C){return C===62?(t.consume(C),l.interrupt?r:Y):i(C)}function E(C){return Be(C)?(t.consume(C),E):_(C)}function D(C){return C===47?(t.consume(C),_):C===58||C===95||Ut(C)?(t.consume(C),G):Be(C)?(t.consume(C),D):_(C)}function G(C){return C===45||C===46||C===58||C===95||Lt(C)?(t.consume(C),G):K(C)}function K(C){return C===61?(t.consume(C),N):Be(C)?(t.consume(C),K):D(C)}function N(C){return C===null||C===60||C===61||C===62||C===96?i(C):C===34||C===39?(t.consume(C),g=C,$):Be(C)?(t.consume(C),N):ne(C)}function $(C){return C===g?(t.consume(C),g=null,ce):C===null||ke(C)?i(C):(t.consume(C),$)}function ne(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||at(C)?K(C):(t.consume(C),ne)}function ce(C){return C===47||C===62||Be(C)?D(C):i(C)}function _(C){return C===62?(t.consume(C),F):i(C)}function F(C){return C===null||ke(C)?Y(C):Be(C)?(t.consume(C),F):i(C)}function Y(C){return C===45&&o===2?(t.consume(C),I):C===60&&o===1?(t.consume(C),H):C===62&&o===4?(t.consume(C),R):C===63&&o===3?(t.consume(C),T):C===93&&o===5?(t.consume(C),re):ke(C)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(xk,z,oe)(C)):C===null||ke(C)?(t.exit("htmlFlowData"),oe(C)):(t.consume(C),Y)}function oe(C){return t.check(Sk,X,z)(C)}function X(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),B}function B(C){return C===null||ke(C)?oe(C):(t.enter("htmlFlowData"),Y(C))}function I(C){return C===45?(t.consume(C),T):Y(C)}function H(C){return C===47?(t.consume(C),u="",U):Y(C)}function U(C){if(C===62){const ie=u.toLowerCase();return mg.includes(ie)?(t.consume(C),R):Y(C)}return Ut(C)&&u.length<8?(t.consume(C),u+=String.fromCharCode(C),U):Y(C)}function re(C){return C===93?(t.consume(C),T):Y(C)}function T(C){return C===62?(t.consume(C),R):C===45&&o===2?(t.consume(C),T):Y(C)}function R(C){return C===null||ke(C)?(t.exit("htmlFlowData"),z(C)):(t.consume(C),R)}function z(C){return t.exit("htmlFlow"),r(C)}}function Ck(t,r,i){const l=this;return o;function o(u){return ke(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),d):i(u)}function d(u){return l.parser.lazy[l.now().line]?i(u):r(u)}}function jk(t,r,i){return l;function l(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(sl,r,i)}}const Rk={name:"htmlText",tokenize:Tk};function Tk(t,r,i){const l=this;let o,d,u;return h;function h(T){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(T),g}function g(T){return T===33?(t.consume(T),p):T===47?(t.consume(T),K):T===63?(t.consume(T),D):Ut(T)?(t.consume(T),ne):i(T)}function p(T){return T===45?(t.consume(T),v):T===91?(t.consume(T),d=0,w):Ut(T)?(t.consume(T),E):i(T)}function v(T){return T===45?(t.consume(T),x):i(T)}function y(T){return T===null?i(T):T===45?(t.consume(T),S):ke(T)?(u=y,H(T)):(t.consume(T),y)}function S(T){return T===45?(t.consume(T),x):y(T)}function x(T){return T===62?I(T):T===45?S(T):y(T)}function w(T){const R="CDATA[";return T===R.charCodeAt(d++)?(t.consume(T),d===R.length?A:w):i(T)}function A(T){return T===null?i(T):T===93?(t.consume(T),M):ke(T)?(u=A,H(T)):(t.consume(T),A)}function M(T){return T===93?(t.consume(T),O):A(T)}function O(T){return T===62?I(T):T===93?(t.consume(T),O):A(T)}function E(T){return T===null||T===62?I(T):ke(T)?(u=E,H(T)):(t.consume(T),E)}function D(T){return T===null?i(T):T===63?(t.consume(T),G):ke(T)?(u=D,H(T)):(t.consume(T),D)}function G(T){return T===62?I(T):D(T)}function K(T){return Ut(T)?(t.consume(T),N):i(T)}function N(T){return T===45||Lt(T)?(t.consume(T),N):$(T)}function $(T){return ke(T)?(u=$,H(T)):Be(T)?(t.consume(T),$):I(T)}function ne(T){return T===45||Lt(T)?(t.consume(T),ne):T===47||T===62||at(T)?ce(T):i(T)}function ce(T){return T===47?(t.consume(T),I):T===58||T===95||Ut(T)?(t.consume(T),_):ke(T)?(u=ce,H(T)):Be(T)?(t.consume(T),ce):I(T)}function _(T){return T===45||T===46||T===58||T===95||Lt(T)?(t.consume(T),_):F(T)}function F(T){return T===61?(t.consume(T),Y):ke(T)?(u=F,H(T)):Be(T)?(t.consume(T),F):ce(T)}function Y(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(t.consume(T),o=T,oe):ke(T)?(u=Y,H(T)):Be(T)?(t.consume(T),Y):(t.consume(T),X)}function oe(T){return T===o?(t.consume(T),o=void 0,B):T===null?i(T):ke(T)?(u=oe,H(T)):(t.consume(T),oe)}function X(T){return T===null||T===34||T===39||T===60||T===61||T===96?i(T):T===47||T===62||at(T)?ce(T):(t.consume(T),X)}function B(T){return T===47||T===62||at(T)?ce(T):i(T)}function I(T){return T===62?(t.consume(T),t.exit("htmlTextData"),t.exit("htmlText"),r):i(T)}function H(T){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),U}function U(T){return Be(T)?Ve(t,re,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):re(T)}function re(T){return t.enter("htmlTextData"),u(T)}}const bd={name:"labelEnd",resolveAll:Ik,resolveTo:Dk,tokenize:Ok},Ek={tokenize:Mk},Nk={tokenize:zk},Ak={tokenize:_k};function Ik(t){let r=-1;const i=[];for(;++r<t.length;){const l=t[r][1];if(i.push(t[r]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const o=l.type==="labelImage"?4:2;l.type="data",r+=o}}return t.length!==i.length&&on(t,0,t.length,i),t}function Dk(t,r){let i=t.length,l=0,o,d,u,h;for(;i--;)if(o=t[i][1],d){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[i][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(u){if(t[i][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(d=i,o.type!=="labelLink")){l=2;break}}else o.type==="labelEnd"&&(u=i);const g={type:t[d][1].type==="labelLink"?"link":"image",start:{...t[d][1].start},end:{...t[t.length-1][1].end}},p={type:"label",start:{...t[d][1].start},end:{...t[u][1].end}},v={type:"labelText",start:{...t[d+l+2][1].end},end:{...t[u-2][1].start}};return h=[["enter",g,r],["enter",p,r]],h=bn(h,t.slice(d+1,d+l+3)),h=bn(h,[["enter",v,r]]),h=bn(h,Xs(r.parser.constructs.insideSpan.null,t.slice(d+l+4,u-3),r)),h=bn(h,[["exit",v,r],t[u-2],t[u-1],["exit",p,r]]),h=bn(h,t.slice(u+1)),h=bn(h,[["exit",g,r]]),on(t,d,t.length,h),t}function Ok(t,r,i){const l=this;let o=l.events.length,d,u;for(;o--;)if((l.events[o][1].type==="labelImage"||l.events[o][1].type==="labelLink")&&!l.events[o][1]._balanced){d=l.events[o][1];break}return h;function h(S){return d?d._inactive?y(S):(u=l.parser.defined.includes(jn(l.sliceSerialize({start:d.end,end:l.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(S),t.exit("labelMarker"),t.exit("labelEnd"),g):i(S)}function g(S){return S===40?t.attempt(Ek,v,u?v:y)(S):S===91?t.attempt(Nk,v,u?p:y)(S):u?v(S):y(S)}function p(S){return t.attempt(Ak,v,y)(S)}function v(S){return r(S)}function y(S){return d._balanced=!0,i(S)}}function Mk(t,r,i){return l;function l(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),o}function o(y){return at(y)?nl(t,d)(y):d(y)}function d(y){return y===41?v(y):Fy(t,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function u(y){return at(y)?nl(t,g)(y):v(y)}function h(y){return i(y)}function g(y){return y===34||y===39||y===40?Py(t,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):v(y)}function p(y){return at(y)?nl(t,v)(y):v(y)}function v(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),r):i(y)}}function zk(t,r,i){const l=this;return o;function o(h){return Vy.call(l,t,d,u,"reference","referenceMarker","referenceString")(h)}function d(h){return l.parser.defined.includes(jn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?r(h):i(h)}function u(h){return i(h)}}function _k(t,r,i){return l;function l(d){return t.enter("reference"),t.enter("referenceMarker"),t.consume(d),t.exit("referenceMarker"),o}function o(d){return d===93?(t.enter("referenceMarker"),t.consume(d),t.exit("referenceMarker"),t.exit("reference"),r):i(d)}}const Lk={name:"labelStartImage",resolveAll:bd.resolveAll,tokenize:Bk};function Bk(t,r,i){const l=this;return o;function o(h){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(h),t.exit("labelImageMarker"),d}function d(h){return h===91?(t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelImage"),u):i(h)}function u(h){return h===94&&"_hiddenFootnoteSupport"in l.parser.constructs?i(h):r(h)}}const Hk={name:"labelStartLink",resolveAll:bd.resolveAll,tokenize:Uk};function Uk(t,r,i){const l=this;return o;function o(u){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelLink"),d}function d(u){return u===94&&"_hiddenFootnoteSupport"in l.parser.constructs?i(u):r(u)}}const Rc={name:"lineEnding",tokenize:qk};function qk(t,r){return i;function i(l){return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Ve(t,r,"linePrefix")}}const As={name:"thematicBreak",tokenize:Gk};function Gk(t,r,i){let l=0,o;return d;function d(p){return t.enter("thematicBreak"),u(p)}function u(p){return o=p,h(p)}function h(p){return p===o?(t.enter("thematicBreakSequence"),g(p)):l>=3&&(p===null||ke(p))?(t.exit("thematicBreak"),r(p)):i(p)}function g(p){return p===o?(t.consume(p),l++,g):(t.exit("thematicBreakSequence"),Be(p)?Ve(t,h,"whitespace")(p):h(p))}}const Qt={continuation:{tokenize:Pk},exit:Kk,name:"list",tokenize:Vk},$k={partial:!0,tokenize:Xk},Fk={partial:!0,tokenize:Yk};function Vk(t,r,i){const l=this,o=l.events[l.events.length-1];let d=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,u=0;return h;function h(x){const w=l.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||x===l.containerState.marker:Kc(x)){if(l.containerState.type||(l.containerState.type=w,t.enter(w,{_container:!0})),w==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(As,i,p)(x):p(x);if(!l.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),g(x)}return i(x)}function g(x){return Kc(x)&&++u<10?(t.consume(x),g):(!l.interrupt||u<2)&&(l.containerState.marker?x===l.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),p(x)):i(x)}function p(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||x,t.check(sl,l.interrupt?i:v,t.attempt($k,S,y))}function v(x){return l.containerState.initialBlankLine=!0,d++,S(x)}function y(x){return Be(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),S):i(x)}function S(x){return l.containerState.size=d+l.sliceSerialize(t.exit("listItemPrefix"),!0).length,r(x)}}function Pk(t,r,i){const l=this;return l.containerState._closeFlow=void 0,t.check(sl,o,d);function o(h){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Ve(t,r,"listItemIndent",l.containerState.size+1)(h)}function d(h){return l.containerState.furtherBlankLines||!Be(h)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(h)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,t.attempt(Fk,r,u)(h))}function u(h){return l.containerState._closeFlow=!0,l.interrupt=void 0,Ve(t,t.attempt(Qt,r,i),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Yk(t,r,i){const l=this;return Ve(t,o,"listItemIndent",l.containerState.size+1);function o(d){const u=l.events[l.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===l.containerState.size?r(d):i(d)}}function Kk(t){t.exit(this.containerState.type)}function Xk(t,r,i){const l=this;return Ve(t,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(d){const u=l.events[l.events.length-1];return!Be(d)&&u&&u[1].type==="listItemPrefixWhitespace"?r(d):i(d)}}const pg={name:"setextUnderline",resolveTo:Qk,tokenize:Zk};function Qk(t,r){let i=t.length,l,o,d;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){l=i;break}t[i][1].type==="paragraph"&&(o=i)}else t[i][1].type==="content"&&t.splice(i,1),!d&&t[i][1].type==="definition"&&(d=i);const u={type:"setextHeading",start:{...t[l][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",d?(t.splice(o,0,["enter",u,r]),t.splice(d+1,0,["exit",t[l][1],r]),t[l][1].end={...t[d][1].end}):t[l][1]=u,t.push(["exit",u,r]),t}function Zk(t,r,i){const l=this;let o;return d;function d(p){let v=l.events.length,y;for(;v--;)if(l.events[v][1].type!=="lineEnding"&&l.events[v][1].type!=="linePrefix"&&l.events[v][1].type!=="content"){y=l.events[v][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||y)?(t.enter("setextHeadingLine"),o=p,u(p)):i(p)}function u(p){return t.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===o?(t.consume(p),h):(t.exit("setextHeadingLineSequence"),Be(p)?Ve(t,g,"lineSuffix")(p):g(p))}function g(p){return p===null||ke(p)?(t.exit("setextHeadingLine"),r(p)):i(p)}}const Jk={tokenize:Wk};function Wk(t){const r=this,i=t.attempt(sl,l,t.attempt(this.parser.constructs.flowInitial,o,Ve(t,t.attempt(this.parser.constructs.flow,o,t.attempt(ik,o)),"linePrefix")));return i;function l(d){if(d===null){t.consume(d);return}return t.enter("lineEndingBlank"),t.consume(d),t.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function o(d){if(d===null){t.consume(d);return}return t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),r.currentConstruct=void 0,i}}const ew={resolveAll:Ky()},tw=Yy("string"),nw=Yy("text");function Yy(t){return{resolveAll:Ky(t==="text"?rw:void 0),tokenize:r};function r(i){const l=this,o=this.parser.constructs[t],d=i.attempt(o,u,h);return u;function u(v){return p(v)?d(v):h(v)}function h(v){if(v===null){i.consume(v);return}return i.enter("data"),i.consume(v),g}function g(v){return p(v)?(i.exit("data"),d(v)):(i.consume(v),g)}function p(v){if(v===null)return!0;const y=o[v];let S=-1;if(y)for(;++S<y.length;){const x=y[S];if(!x.previous||x.previous.call(l,l.previous))return!0}return!1}}}function Ky(t){return r;function r(i,l){let o=-1,d;for(;++o<=i.length;)d===void 0?i[o]&&i[o][1].type==="data"&&(d=o,o++):(!i[o]||i[o][1].type!=="data")&&(o!==d+2&&(i[d][1].end=i[o-1][1].end,i.splice(d+2,o-d-2),o=d+2),d=void 0);return t?t(i,l):i}}function rw(t,r){let i=0;for(;++i<=t.length;)if((i===t.length||t[i][1].type==="lineEnding")&&t[i-1][1].type==="data"){const l=t[i-1][1],o=r.sliceStream(l);let d=o.length,u=-1,h=0,g;for(;d--;){const p=o[d];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)h++,u--;if(u)break;u=-1}else if(p===-2)g=!0,h++;else if(p!==-1){d++;break}}if(r._contentTypeTextTrailing&&i===t.length&&(h=0),h){const p={type:i===t.length||g||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?u:l.start._bufferIndex+u,_index:l.start._index+d,line:l.end.line,column:l.end.column-h,offset:l.end.offset-h},end:{...l.end}};l.end={...p.start},l.start.offset===l.end.offset?Object.assign(l,p):(t.splice(i,0,["enter",p,r],["exit",p,r]),i+=2)}i++}return t}const iw={42:Qt,43:Qt,45:Qt,48:Qt,49:Qt,50:Qt,51:Qt,52:Qt,53:Qt,54:Qt,55:Qt,56:Qt,57:Qt,62:Uy},aw={91:uk},lw={[-2]:jc,[-1]:jc,32:jc},sw={35:pk,42:As,45:[pg,As],60:bk,61:pg,95:As,96:hg,126:hg},ow={38:Gy,92:qy},uw={[-5]:Rc,[-4]:Rc,[-3]:Rc,33:Lk,38:Gy,42:Xc,60:[H0,Rk],91:Hk,92:[hk,qy],93:bd,95:Xc,96:J0},cw={null:[Xc,ew]},dw={null:[42,95]},fw={null:[]},hw=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:dw,contentInitial:aw,disable:fw,document:iw,flow:sw,flowInitial:lw,insideSpan:cw,string:ow,text:uw},Symbol.toStringTag,{value:"Module"}));function mw(t,r,i){let l={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const o={},d=[];let u=[],h=[];const g={attempt:$(K),check:$(N),consume:E,enter:D,exit:G,interrupt:$(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:A,events:[],now:w,parser:t,previous:null,sliceSerialize:S,sliceStream:x,write:y};let v=r.tokenize.call(p,g);return r.resolveAll&&d.push(r),p;function y(F){return u=bn(u,F),M(),u[u.length-1]!==null?[]:(ne(r,0),p.events=Xs(d,p.events,p),p.events)}function S(F,Y){return gw(x(F),Y)}function x(F){return pw(u,F)}function w(){const{_bufferIndex:F,_index:Y,line:oe,column:X,offset:B}=l;return{_bufferIndex:F,_index:Y,line:oe,column:X,offset:B}}function A(F){o[F.line]=F.column,_()}function M(){let F;for(;l._index<u.length;){const Y=u[l._index];if(typeof Y=="string")for(F=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===F&&l._bufferIndex<Y.length;)O(Y.charCodeAt(l._bufferIndex));else O(Y)}}function O(F){v=v(F)}function E(F){ke(F)?(l.line++,l.column=1,l.offset+=F===-3?2:1,_()):F!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===u[l._index].length&&(l._bufferIndex=-1,l._index++)),p.previous=F}function D(F,Y){const oe=Y||{};return oe.type=F,oe.start=w(),p.events.push(["enter",oe,p]),h.push(oe),oe}function G(F){const Y=h.pop();return Y.end=w(),p.events.push(["exit",Y,p]),Y}function K(F,Y){ne(F,Y.from)}function N(F,Y){Y.restore()}function $(F,Y){return oe;function oe(X,B,I){let H,U,re,T;return Array.isArray(X)?z(X):"tokenize"in X?z([X]):R(X);function R(V){return ae;function ae(he){const me=he!==null&&V[he],ye=he!==null&&V.null,Re=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return z(Re)(he)}}function z(V){return H=V,U=0,V.length===0?I:C(V[U])}function C(V){return ae;function ae(he){return T=ce(),re=V,V.partial||(p.currentConstruct=V),V.name&&p.parser.constructs.disable.null.includes(V.name)?fe():V.tokenize.call(Y?Object.assign(Object.create(p),Y):p,g,ie,fe)(he)}}function ie(V){return F(re,T),B}function fe(V){return T.restore(),++U<H.length?C(H[U]):I}}}function ne(F,Y){F.resolveAll&&!d.includes(F)&&d.push(F),F.resolve&&on(p.events,Y,p.events.length-Y,F.resolve(p.events.slice(Y),p)),F.resolveTo&&(p.events=F.resolveTo(p.events,p))}function ce(){const F=w(),Y=p.previous,oe=p.currentConstruct,X=p.events.length,B=Array.from(h);return{from:X,restore:I};function I(){l=F,p.previous=Y,p.currentConstruct=oe,p.events.length=X,h=B,_()}}function _(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function pw(t,r){const i=r.start._index,l=r.start._bufferIndex,o=r.end._index,d=r.end._bufferIndex;let u;if(i===o)u=[t[i].slice(l,d)];else{if(u=t.slice(i,o),l>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(l):u.shift()}d>0&&u.push(t[o].slice(0,d))}return u}function gw(t,r){let i=-1;const l=[];let o;for(;++i<t.length;){const d=t[i];let u;if(typeof d=="string")u=d;else switch(d){case-5:{u="\r";break}case-4:{u=`
|
|
13
|
+
`;break}case-3:{u=`\r
|
|
14
|
+
`;break}case-2:{u=r?" ":" ";break}case-1:{if(!r&&o)continue;u=" ";break}default:u=String.fromCharCode(d)}o=d===-2,l.push(u)}return l.join("")}function yw(t){const l={constructs:By([hw,...(t||{}).extensions||[]]),content:o(D0),defined:[],document:o(M0),flow:o(Jk),lazy:{},string:o(tw),text:o(nw)};return l;function o(d){return u;function u(h){return mw(l,d,h)}}}function vw(t){for(;!$y(t););return t}const gg=/[\0\t\n\r]/g;function bw(){let t=1,r="",i=!0,l;return o;function o(d,u,h){const g=[];let p,v,y,S,x;for(d=r+(typeof d=="string"?d.toString():new TextDecoder(u||void 0).decode(d)),y=0,r="",i&&(d.charCodeAt(0)===65279&&y++,i=void 0);y<d.length;){if(gg.lastIndex=y,p=gg.exec(d),S=p&&p.index!==void 0?p.index:d.length,x=d.charCodeAt(S),!p){r=d.slice(y);break}if(x===10&&y===S&&l)g.push(-3),l=void 0;else switch(l&&(g.push(-5),l=void 0),y<S&&(g.push(d.slice(y,S)),t+=S-y),x){case 0:{g.push(65533),t++;break}case 9:{for(v=Math.ceil(t/4)*4,g.push(-2);t++<v;)g.push(-1);break}case 10:{g.push(-4),t=1;break}default:l=!0,t=1}y=S+1}return h&&(l&&g.push(-5),r&&g.push(r),g.push(null)),g}}const xw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Sw(t){return t.replace(xw,kw)}function kw(t,r,i){if(r)return r;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),d=o===120||o===88;return Hy(i.slice(d?2:1),d?16:10)}return vd(i)||t}const Xy={}.hasOwnProperty;function ww(t,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),Cw(i)(vw(yw(i).document().write(bw()(t,r,!0))))}function Cw(t){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(qt),autolinkProtocol:ce,autolinkEmail:ce,atxHeading:d(Ze),blockQuote:d(ye),characterEscape:ce,characterReference:ce,codeFenced:d(Re),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:d(Re,u),codeText:d(Ge,u),codeTextData:ce,data:ce,codeFlowValue:ce,definition:d(Pe),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:d(ze),hardBreakEscape:d(yt),hardBreakTrailing:d(yt),htmlFlow:d(wt,u),htmlFlowData:ce,htmlText:d(wt,u),htmlTextData:ce,image:d(Rn),label:u,link:d(qt),listItem:d(Te),listItemValue:S,listOrdered:d(Gt,y),listUnordered:d(Gt),paragraph:d($e),reference:C,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:d(Ze),strong:d(ut),thematicBreak:d(zt)},exit:{atxHeading:g(),atxHeadingSequence:K,autolink:g(),autolinkEmail:me,autolinkProtocol:he,blockQuote:g(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:V,characterReference:ae,codeFenced:g(M),codeFencedFence:A,codeFencedFenceInfo:x,codeFencedFenceMeta:w,codeFlowValue:_,codeIndented:g(O),codeText:g(B),codeTextData:_,data:_,definition:g(),definitionDestinationString:G,definitionLabelString:E,definitionTitleString:D,emphasis:g(),hardBreakEscape:g(Y),hardBreakTrailing:g(Y),htmlFlow:g(oe),htmlFlowData:_,htmlText:g(X),htmlTextData:_,image:g(H),label:re,labelText:U,lineEnding:F,link:g(I),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:ie,resourceDestinationString:T,resourceTitleString:R,resource:z,setextHeading:g(ne),setextHeadingLineSequence:$,setextHeadingText:N,strong:g(),thematicBreak:g()}};Qy(r,(t||{}).mdastExtensions||[]);const i={};return l;function l(te){let de={type:"root",children:[]};const xe={stack:[de],tokenStack:[],config:r,enter:h,exit:p,buffer:u,resume:v,data:i},Ee=[];let J=-1;for(;++J<te.length;)if(te[J][1].type==="listOrdered"||te[J][1].type==="listUnordered")if(te[J][0]==="enter")Ee.push(J);else{const ge=Ee.pop();J=o(te,ge,J)}for(J=-1;++J<te.length;){const ge=r[te[J][0]];Xy.call(ge,te[J][1].type)&&ge[te[J][1].type].call(Object.assign({sliceSerialize:te[J][2].sliceSerialize},xe),te[J][1])}if(xe.tokenStack.length>0){const ge=xe.tokenStack[xe.tokenStack.length-1];(ge[1]||yg).call(xe,void 0,ge[0])}for(de.position={start:Tr(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:Tr(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J<r.transforms.length;)de=r.transforms[J](de)||de;return de}function o(te,de,xe){let Ee=de-1,J=-1,ge=!1,Me,je,we,Fe;for(;++Ee<=xe;){const Oe=te[Ee];switch(Oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Oe[0]==="enter"?J++:J--,Fe=void 0;break}case"lineEndingBlank":{Oe[0]==="enter"&&(Me&&!Fe&&!J&&!we&&(we=Ee),Fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Fe=void 0}if(!J&&Oe[0]==="enter"&&Oe[1].type==="listItemPrefix"||J===-1&&Oe[0]==="exit"&&(Oe[1].type==="listUnordered"||Oe[1].type==="listOrdered")){if(Me){let Rt=Ee;for(je=void 0;Rt--;){const Tt=te[Rt];if(Tt[1].type==="lineEnding"||Tt[1].type==="lineEndingBlank"){if(Tt[0]==="exit")continue;je&&(te[je][1].type="lineEndingBlank",ge=!0),Tt[1].type="lineEnding",je=Rt}else if(!(Tt[1].type==="linePrefix"||Tt[1].type==="blockQuotePrefix"||Tt[1].type==="blockQuotePrefixWhitespace"||Tt[1].type==="blockQuoteMarker"||Tt[1].type==="listItemIndent"))break}we&&(!je||we<je)&&(Me._spread=!0),Me.end=Object.assign({},je?te[je][1].start:Oe[1].end),te.splice(je||Ee,0,["exit",Me,Oe[2]]),Ee++,xe++}if(Oe[1].type==="listItemPrefix"){const Rt={type:"listItem",_spread:!1,start:Object.assign({},Oe[1].start),end:void 0};Me=Rt,te.splice(Ee,0,["enter",Rt,Oe[2]]),Ee++,xe++,we=void 0,Fe=!0}}}return te[de][1]._spread=ge,xe}function d(te,de){return xe;function xe(Ee){h.call(this,te(Ee),Ee),de&&de.call(this,Ee)}}function u(){this.stack.push({type:"fragment",children:[]})}function h(te,de,xe){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([de,xe||void 0]),te.position={start:Tr(de.start),end:void 0}}function g(te){return de;function de(xe){te&&te.call(this,xe),p.call(this,xe)}}function p(te,de){const xe=this.stack.pop(),Ee=this.tokenStack.pop();if(Ee)Ee[0].type!==te.type&&(de?de.call(this,te,Ee[0]):(Ee[1]||yg).call(this,te,Ee[0]));else throw new Error("Cannot close `"+te.type+"` ("+tl({start:te.start,end:te.end})+"): it’s not open");xe.position.end=Tr(te.end)}function v(){return yd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function S(te){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0}}function x(){const te=this.resume(),de=this.stack[this.stack.length-1];de.lang=te}function w(){const te=this.resume(),de=this.stack[this.stack.length-1];de.meta=te}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function M(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function O(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te.replace(/(\r?\n|\r)$/g,"")}function E(te){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.label=de,xe.identifier=jn(this.sliceSerialize(te)).toLowerCase()}function D(){const te=this.resume(),de=this.stack[this.stack.length-1];de.title=te}function G(){const te=this.resume(),de=this.stack[this.stack.length-1];de.url=te}function K(te){const de=this.stack[this.stack.length-1];if(!de.depth){const xe=this.sliceSerialize(te).length;de.depth=xe}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function $(te){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function ne(){this.data.setextHeadingSlurpLineEnding=void 0}function ce(te){const xe=this.stack[this.stack.length-1].children;let Ee=xe[xe.length-1];(!Ee||Ee.type!=="text")&&(Ee=Xe(),Ee.position={start:Tr(te.start),end:void 0},xe.push(Ee)),this.stack.push(Ee)}function _(te){const de=this.stack.pop();de.value+=this.sliceSerialize(te),de.position.end=Tr(te.end)}function F(te){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const xe=de.children[de.children.length-1];xe.position.end=Tr(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(de.type)&&(ce.call(this,te),_.call(this,te))}function Y(){this.data.atHardBreak=!0}function oe(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function X(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function B(){const te=this.resume(),de=this.stack[this.stack.length-1];de.value=te}function I(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=de,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function H(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=de,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function U(te){const de=this.sliceSerialize(te),xe=this.stack[this.stack.length-2];xe.label=Sw(de),xe.identifier=jn(de).toLowerCase()}function re(){const te=this.stack[this.stack.length-1],de=this.resume(),xe=this.stack[this.stack.length-1];if(this.data.inReference=!0,xe.type==="link"){const Ee=te.children;xe.children=Ee}else xe.alt=de}function T(){const te=this.resume(),de=this.stack[this.stack.length-1];de.url=te}function R(){const te=this.resume(),de=this.stack[this.stack.length-1];de.title=te}function z(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function ie(te){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.label=de,xe.identifier=jn(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function fe(te){this.data.characterReferenceType=te.type}function V(te){const de=this.sliceSerialize(te),xe=this.data.characterReferenceType;let Ee;xe?(Ee=Hy(de,xe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ee=vd(de);const J=this.stack[this.stack.length-1];J.value+=Ee}function ae(te){const de=this.stack.pop();de.position.end=Tr(te.end)}function he(te){_.call(this,te);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(te)}function me(te){_.call(this,te);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(te)}function ye(){return{type:"blockquote",children:[]}}function Re(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function Pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ze(){return{type:"emphasis",children:[]}}function Ze(){return{type:"heading",depth:0,children:[]}}function yt(){return{type:"break"}}function wt(){return{type:"html",value:""}}function Rn(){return{type:"image",title:null,url:"",alt:null}}function qt(){return{type:"link",title:null,url:"",children:[]}}function Gt(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function Te(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function $e(){return{type:"paragraph",children:[]}}function ut(){return{type:"strong",children:[]}}function Xe(){return{type:"text",value:""}}function zt(){return{type:"thematicBreak"}}}function Tr(t){return{line:t.line,column:t.column,offset:t.offset}}function Qy(t,r){let i=-1;for(;++i<r.length;){const l=r[i];Array.isArray(l)?Qy(t,l):jw(t,l)}}function jw(t,r){let i;for(i in r)if(Xy.call(r,i))switch(i){case"canContainEols":{const l=r[i];l&&t[i].push(...l);break}case"transforms":{const l=r[i];l&&t[i].push(...l);break}case"enter":case"exit":{const l=r[i];l&&Object.assign(t[i],l);break}}}function yg(t,r){throw t?new Error("Cannot close `"+t.type+"` ("+tl({start:t.start,end:t.end})+"): a different token (`"+r.type+"`, "+tl({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+tl({start:r.start,end:r.end})+") is still open")}function Rw(t){const r=this;r.parser=i;function i(l){return ww(l,{...r.data("settings"),...t,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function Tw(t,r){const i={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(r),!0)};return t.patch(r,i),t.applyData(r,i)}function Ew(t,r){const i={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,i),[t.applyData(r,i),{type:"text",value:`
|
|
15
|
+
`}]}function Nw(t,r){const i=r.value?r.value+`
|
|
16
|
+
`:"",l={},o=r.lang?r.lang.split(/\s+/):[];o.length>0&&(l.className=["language-"+o[0]]);let d={type:"element",tagName:"code",properties:l,children:[{type:"text",value:i}]};return r.meta&&(d.data={meta:r.meta}),t.patch(r,d),d=t.applyData(r,d),d={type:"element",tagName:"pre",properties:{},children:[d]},t.patch(r,d),d}function Aw(t,r){const i={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Iw(t,r){const i={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Dw(t,r){const i=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",l=String(r.identifier).toUpperCase(),o=ea(l.toLowerCase()),d=t.footnoteOrder.indexOf(l);let u,h=t.footnoteCounts.get(l);h===void 0?(h=0,t.footnoteOrder.push(l),u=t.footnoteOrder.length):u=d+1,h+=1,t.footnoteCounts.set(l,h);const g={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+o,id:i+"fnref-"+o+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};t.patch(r,g);const p={type:"element",tagName:"sup",properties:{},children:[g]};return t.patch(r,p),t.applyData(r,p)}function Ow(t,r){const i={type:"element",tagName:"h"+r.depth,properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Mw(t,r){if(t.options.allowDangerousHtml){const i={type:"raw",value:r.value};return t.patch(r,i),t.applyData(r,i)}}function Zy(t,r){const i=r.referenceType;let l="]";if(i==="collapsed"?l+="[]":i==="full"&&(l+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+l}];const o=t.all(r),d=o[0];d&&d.type==="text"?d.value="["+d.value:o.unshift({type:"text",value:"["});const u=o[o.length-1];return u&&u.type==="text"?u.value+=l:o.push({type:"text",value:l}),o}function zw(t,r){const i=String(r.identifier).toUpperCase(),l=t.definitionById.get(i);if(!l)return Zy(t,r);const o={src:ea(l.url||""),alt:r.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const d={type:"element",tagName:"img",properties:o,children:[]};return t.patch(r,d),t.applyData(r,d)}function _w(t,r){const i={src:ea(r.url)};r.alt!==null&&r.alt!==void 0&&(i.alt=r.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"img",properties:i,children:[]};return t.patch(r,l),t.applyData(r,l)}function Lw(t,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};t.patch(r,i);const l={type:"element",tagName:"code",properties:{},children:[i]};return t.patch(r,l),t.applyData(r,l)}function Bw(t,r){const i=String(r.identifier).toUpperCase(),l=t.definitionById.get(i);if(!l)return Zy(t,r);const o={href:ea(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const d={type:"element",tagName:"a",properties:o,children:t.all(r)};return t.patch(r,d),t.applyData(r,d)}function Hw(t,r){const i={href:ea(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:t.all(r)};return t.patch(r,l),t.applyData(r,l)}function Uw(t,r,i){const l=t.all(r),o=i?qw(i):Jy(r),d={},u=[];if(typeof r.checked=="boolean"){const v=l[0];let y;v&&v.type==="element"&&v.tagName==="p"?y=v:(y={type:"element",tagName:"p",properties:{},children:[]},l.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),d.className=["task-list-item"]}let h=-1;for(;++h<l.length;){const v=l[h];(o||h!==0||v.type!=="element"||v.tagName!=="p")&&u.push({type:"text",value:`
|
|
17
|
+
`}),v.type==="element"&&v.tagName==="p"&&!o?u.push(...v.children):u.push(v)}const g=l[l.length-1];g&&(o||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
18
|
+
`});const p={type:"element",tagName:"li",properties:d,children:u};return t.patch(r,p),t.applyData(r,p)}function qw(t){let r=!1;if(t.type==="list"){r=t.spread||!1;const i=t.children;let l=-1;for(;!r&&++l<i.length;)r=Jy(i[l])}return r}function Jy(t){const r=t.spread;return r??t.children.length>1}function Gw(t,r){const i={},l=t.all(r);let o=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++o<l.length;){const u=l[o];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const d={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:t.wrap(l,!0)};return t.patch(r,d),t.applyData(r,d)}function $w(t,r){const i={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Fw(t,r){const i={type:"root",children:t.wrap(t.all(r))};return t.patch(r,i),t.applyData(r,i)}function Vw(t,r){const i={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Pw(t,r){const i=t.all(r),l=i.shift(),o=[];if(l){const u={type:"element",tagName:"thead",properties:{},children:t.wrap([l],!0)};t.patch(r.children[0],u),o.push(u)}if(i.length>0){const u={type:"element",tagName:"tbody",properties:{},children:t.wrap(i,!0)},h=hd(r.children[1]),g=Iy(r.children[r.children.length-1]);h&&g&&(u.position={start:h,end:g}),o.push(u)}const d={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(r,d),t.applyData(r,d)}function Yw(t,r,i){const l=i?i.children:void 0,d=(l?l.indexOf(r):1)===0?"th":"td",u=i&&i.type==="table"?i.align:void 0,h=u?u.length:r.children.length;let g=-1;const p=[];for(;++g<h;){const y=r.children[g],S={},x=u?u[g]:void 0;x&&(S.align=x);let w={type:"element",tagName:d,properties:S,children:[]};y&&(w.children=t.all(y),t.patch(y,w),w=t.applyData(y,w)),p.push(w)}const v={type:"element",tagName:"tr",properties:{},children:t.wrap(p,!0)};return t.patch(r,v),t.applyData(r,v)}function Kw(t,r){const i={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}const vg=9,bg=32;function Xw(t){const r=String(t),i=/\r?\n|\r/g;let l=i.exec(r),o=0;const d=[];for(;l;)d.push(xg(r.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=i.exec(r);return d.push(xg(r.slice(o),o>0,!1)),d.join("")}function xg(t,r,i){let l=0,o=t.length;if(r){let d=t.codePointAt(l);for(;d===vg||d===bg;)l++,d=t.codePointAt(l)}if(i){let d=t.codePointAt(o-1);for(;d===vg||d===bg;)o--,d=t.codePointAt(o-1)}return o>l?t.slice(l,o):""}function Qw(t,r){const i={type:"text",value:Xw(String(r.value))};return t.patch(r,i),t.applyData(r,i)}function Zw(t,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,i),t.applyData(r,i)}const Jw={blockquote:Tw,break:Ew,code:Nw,delete:Aw,emphasis:Iw,footnoteReference:Dw,heading:Ow,html:Mw,imageReference:zw,image:_w,inlineCode:Lw,linkReference:Bw,link:Hw,listItem:Uw,list:Gw,paragraph:$w,root:Fw,strong:Vw,table:Pw,tableCell:Kw,tableRow:Yw,text:Qw,thematicBreak:Zw,toml:Cs,yaml:Cs,definition:Cs,footnoteDefinition:Cs};function Cs(){}const Wy=-1,Qs=0,rl=1,_s=2,xd=3,Sd=4,kd=5,wd=6,ev=7,tv=8,nv=typeof self=="object"?self:globalThis,Sg=(t,r)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new nv[t](r)},Ww=(t,r)=>{const i=(o,d)=>(t.set(d,o),o),l=o=>{if(t.has(o))return t.get(o);const[d,u]=r[o];switch(d){case Qs:case Wy:return i(u,o);case rl:{const h=i([],o);for(const g of u)h.push(l(g));return h}case _s:{const h=i({},o);for(const[g,p]of u)h[l(g)]=l(p);return h}case xd:return i(new Date(u),o);case Sd:{const{source:h,flags:g}=u;return i(new RegExp(h,g),o)}case kd:{const h=i(new Map,o);for(const[g,p]of u)h.set(l(g),l(p));return h}case wd:{const h=i(new Set,o);for(const g of u)h.add(l(g));return h}case ev:{const{name:h,message:g}=u;return i(typeof nv[h]=="function"?Sg(h,g):new Error(g),o)}case tv:return i(BigInt(u),o);case"BigInt":return i(Object(BigInt(u)),o);case"ArrayBuffer":return i(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:h}=new Uint8Array(u);return i(new DataView(h),u)}}return i(Sg(d,u),o)};return l},kg=t=>Ww(new Map,t)(0),Wr="",{toString:eC}={},{keys:tC}=Object,Ja=t=>{const r=typeof t;if(r!=="object"||!t)return[Qs,r];const i=eC.call(t).slice(8,-1);switch(i){case"Array":return[rl,Wr];case"Object":return[_s,Wr];case"Date":return[xd,Wr];case"RegExp":return[Sd,Wr];case"Map":return[kd,Wr];case"Set":return[wd,Wr];case"DataView":return[rl,i]}return i.includes("Array")?[rl,i]:t instanceof Error?[ev,t.name||"Error"]:[_s,i]},js=([t,r])=>t===Qs&&(r==="function"||r==="symbol"),nC=(t,r,i,l)=>{const o=(u,h)=>{const g=l.push(u)-1;return i.set(h,g),g},d=u=>{if(i.has(u))return i.get(u);let[h,g]=Ja(u);switch(h){case Qs:{let v=u;switch(g){case"bigint":h=tv,v=u.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+g);v=null;break;case"undefined":return o([Wy],u)}return o([h,v],u)}case rl:{if(g){let S=u;return g==="DataView"?S=new Uint8Array(u.buffer):g==="ArrayBuffer"&&(S=new Uint8Array(u)),o([g,[...S]],u)}const v=[],y=o([h,v],u);for(const S of u)v.push(d(S));return y}case _s:{if(g)switch(g){case"BigInt":return o([g,u.toString()],u);case"Boolean":case"Number":case"String":return o([g,u.valueOf()],u)}if(r&&"toJSON"in u)return d(u.toJSON());const v=[],y=o([h,v],u);for(const S of tC(u))(t||!js(Ja(u[S])))&&v.push([d(S),d(u[S])]);return y}case xd:return o([h,isNaN(u.getTime())?Wr:u.toISOString()],u);case Sd:{const{source:v,flags:y}=u;return o([h,{source:v,flags:y}],u)}case kd:{const v=[],y=o([h,v],u);for(const[S,x]of u)(t||!(js(Ja(S))||js(Ja(x))))&&v.push([d(S),d(x)]);return y}case wd:{const v=[],y=o([h,v],u);for(const S of u)(t||!js(Ja(S)))&&v.push(d(S));return y}}const{message:p}=u;return o([h,{name:g,message:p}],u)};return d},wg=(t,{json:r,lossy:i}={})=>{const l=[];return nC(!(r||i),!!r,new Map,l)(t),l},Ls=typeof structuredClone=="function"?(t,r)=>r&&("json"in r||"lossy"in r)?kg(wg(t,r)):structuredClone(t):(t,r)=>kg(wg(t,r));function rC(t,r){const i=[{type:"text",value:"↩"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function iC(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}function aC(t){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=t.options.footnoteBackContent||rC,l=t.options.footnoteBackLabel||iC,o=t.options.footnoteLabel||"Footnotes",d=t.options.footnoteLabelTagName||"h2",u=t.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let g=-1;for(;++g<t.footnoteOrder.length;){const p=t.footnoteById.get(t.footnoteOrder[g]);if(!p)continue;const v=t.all(p),y=String(p.identifier).toUpperCase(),S=ea(y.toLowerCase());let x=0;const w=[],A=t.footnoteCounts.get(y);for(;A!==void 0&&++x<=A;){w.length>0&&w.push({type:"text",value:" "});let E=typeof i=="string"?i:i(g,x);typeof E=="string"&&(E={type:"text",value:E}),w.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+S+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(g,x),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const M=v[v.length-1];if(M&&M.type==="element"&&M.tagName==="p"){const E=M.children[M.children.length-1];E&&E.type==="text"?E.value+=" ":M.children.push({type:"text",value:" "}),M.children.push(...w)}else v.push(...w);const O={type:"element",tagName:"li",properties:{id:r+"fn-"+S},children:t.wrap(v,!0)};t.patch(p,O),h.push(O)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:d,properties:{...Ls(u),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
19
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(h,!0)},{type:"text",value:`
|
|
20
|
+
`}]}}const Zs=(function(t){if(t==null)return uC;if(typeof t=="function")return Js(t);if(typeof t=="object")return Array.isArray(t)?lC(t):sC(t);if(typeof t=="string")return oC(t);throw new Error("Expected function, string, or object as test")});function lC(t){const r=[];let i=-1;for(;++i<t.length;)r[i]=Zs(t[i]);return Js(l);function l(...o){let d=-1;for(;++d<r.length;)if(r[d].apply(this,o))return!0;return!1}}function sC(t){const r=t;return Js(i);function i(l){const o=l;let d;for(d in t)if(o[d]!==r[d])return!1;return!0}}function oC(t){return Js(r);function r(i){return i&&i.type===t}}function Js(t){return r;function r(i,l,o){return!!(cC(i)&&t.call(this,i,typeof l=="number"?l:void 0,o||void 0))}}function uC(){return!0}function cC(t){return t!==null&&typeof t=="object"&&"type"in t}const rv=[],dC=!0,Qc=!1,fC="skip";function iv(t,r,i,l){let o;typeof r=="function"&&typeof i!="function"?(l=i,i=r):o=r;const d=Zs(o),u=l?-1:1;h(t,void 0,[])();function h(g,p,v){const y=g&&typeof g=="object"?g:{};if(typeof y.type=="string"){const x=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(S,"name",{value:"node ("+(g.type+(x?"<"+x+">":""))+")"})}return S;function S(){let x=rv,w,A,M;if((!r||d(g,p,v[v.length-1]||void 0))&&(x=hC(i(g,v)),x[0]===Qc))return x;if("children"in g&&g.children){const O=g;if(O.children&&x[0]!==fC)for(A=(l?O.children.length:-1)+u,M=v.concat(O);A>-1&&A<O.children.length;){const E=O.children[A];if(w=h(E,A,M)(),w[0]===Qc)return w;A=typeof w[1]=="number"?w[1]:A+u}}return x}}}function hC(t){return Array.isArray(t)?t:typeof t=="number"?[dC,t]:t==null?rv:[t]}function Cd(t,r,i,l){let o,d,u;typeof r=="function"&&typeof i!="function"?(d=void 0,u=r,o=i):(d=r,u=i,o=l),iv(t,d,h,o);function h(g,p){const v=p[p.length-1],y=v?v.children.indexOf(g):void 0;return u(g,y,v)}}const Zc={}.hasOwnProperty,mC={};function pC(t,r){const i=r||mC,l=new Map,o=new Map,d=new Map,u={...Jw,...i.handlers},h={all:p,applyData:yC,definitionById:l,footnoteById:o,footnoteCounts:d,footnoteOrder:[],handlers:u,one:g,options:i,patch:gC,wrap:bC};return Cd(t,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const y=v.type==="definition"?l:o,S=String(v.identifier).toUpperCase();y.has(S)||y.set(S,v)}}),h;function g(v,y){const S=v.type,x=h.handlers[S];if(Zc.call(h.handlers,S)&&x)return x(h,v,y);if(h.options.passThrough&&h.options.passThrough.includes(S)){if("children"in v){const{children:A,...M}=v,O=Ls(M);return O.children=h.all(v),O}return Ls(v)}return(h.options.unknownHandler||vC)(h,v,y)}function p(v){const y=[];if("children"in v){const S=v.children;let x=-1;for(;++x<S.length;){const w=h.one(S[x],v);if(w){if(x&&S[x-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=Cg(w.value)),!Array.isArray(w)&&w.type==="element")){const A=w.children[0];A&&A.type==="text"&&(A.value=Cg(A.value))}Array.isArray(w)?y.push(...w):y.push(w)}}}return y}}function gC(t,r){t.position&&(r.position=i0(t))}function yC(t,r){let i=r;if(t&&t.data){const l=t.data.hName,o=t.data.hChildren,d=t.data.hProperties;if(typeof l=="string")if(i.type==="element")i.tagName=l;else{const u="children"in i?i.children:[i];i={type:"element",tagName:l,properties:{},children:u}}i.type==="element"&&d&&Object.assign(i.properties,Ls(d)),"children"in i&&i.children&&o!==null&&o!==void 0&&(i.children=o)}return i}function vC(t,r){const i=r.data||{},l="value"in r&&!(Zc.call(i,"hProperties")||Zc.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:t.all(r)};return t.patch(r,l),t.applyData(r,l)}function bC(t,r){const i=[];let l=-1;for(r&&i.push({type:"text",value:`
|
|
21
|
+
`});++l<t.length;)l&&i.push({type:"text",value:`
|
|
22
|
+
`}),i.push(t[l]);return r&&t.length>0&&i.push({type:"text",value:`
|
|
23
|
+
`}),i}function Cg(t){let r=0,i=t.charCodeAt(r);for(;i===9||i===32;)r++,i=t.charCodeAt(r);return t.slice(r)}function jg(t,r){const i=pC(t,r),l=i.one(t,void 0),o=aC(i),d=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&d.children.push({type:"text",value:`
|
|
24
|
+
`},o),d}function xC(t,r){return t&&"run"in t?async function(i,l){const o=jg(i,{file:l,...r});await t.run(o,l)}:function(i,l){return jg(i,{file:l,...t||r})}}function Rg(t){if(t)throw t}var Tc,Tg;function SC(){if(Tg)return Tc;Tg=1;var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(p){return typeof Array.isArray=="function"?Array.isArray(p):r.call(p)==="[object Array]"},d=function(p){if(!p||r.call(p)!=="[object Object]")return!1;var v=t.call(p,"constructor"),y=p.constructor&&p.constructor.prototype&&t.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!v&&!y)return!1;var S;for(S in p);return typeof S>"u"||t.call(p,S)},u=function(p,v){i&&v.name==="__proto__"?i(p,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):p[v.name]=v.newValue},h=function(p,v){if(v==="__proto__")if(t.call(p,v)){if(l)return l(p,v).value}else return;return p[v]};return Tc=function g(){var p,v,y,S,x,w,A=arguments[0],M=1,O=arguments.length,E=!1;for(typeof A=="boolean"&&(E=A,A=arguments[1]||{},M=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});M<O;++M)if(p=arguments[M],p!=null)for(v in p)y=h(A,v),S=h(p,v),A!==S&&(E&&S&&(d(S)||(x=o(S)))?(x?(x=!1,w=y&&o(y)?y:[]):w=y&&d(y)?y:{},u(A,{name:v,newValue:g(E,w,S)})):typeof S<"u"&&u(A,{name:v,newValue:S}));return A},Tc}var kC=SC();const Ec=ld(kC);function Jc(t){if(typeof t!="object"||t===null)return!1;const r=Object.getPrototypeOf(t);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function wC(){const t=[],r={run:i,use:l};return r;function i(...o){let d=-1;const u=o.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);h(null,...o);function h(g,...p){const v=t[++d];let y=-1;if(g){u(g);return}for(;++y<o.length;)(p[y]===null||p[y]===void 0)&&(p[y]=o[y]);o=p,v?CC(v,h)(...p):u(null,...p)}}function l(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return t.push(o),r}}function CC(t,r){let i;return l;function l(...u){const h=t.length>u.length;let g;h&&u.push(o);try{g=t.apply(this,u)}catch(p){const v=p;if(h&&i)throw v;return o(v)}h||(g&&g.then&&typeof g.then=="function"?g.then(d,o):g instanceof Error?o(g):d(g))}function o(u,...h){i||(i=!0,r(u,...h))}function d(u){o(null,u)}}const Dn={basename:jC,dirname:RC,extname:TC,join:EC,sep:"/"};function jC(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');ol(t);let i=0,l=-1,o=t.length,d;if(r===void 0||r.length===0||r.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(d){i=o+1;break}}else l<0&&(d=!0,l=o+1);return l<0?"":t.slice(i,l)}if(r===t)return"";let u=-1,h=r.length-1;for(;o--;)if(t.codePointAt(o)===47){if(d){i=o+1;break}}else u<0&&(d=!0,u=o+1),h>-1&&(t.codePointAt(o)===r.codePointAt(h--)?h<0&&(l=o):(h=-1,l=u));return i===l?l=u:l<0&&(l=t.length),t.slice(i,l)}function RC(t){if(ol(t),t.length===0)return".";let r=-1,i=t.length,l;for(;--i;)if(t.codePointAt(i)===47){if(l){r=i;break}}else l||(l=!0);return r<0?t.codePointAt(0)===47?"/":".":r===1&&t.codePointAt(0)===47?"//":t.slice(0,r)}function TC(t){ol(t);let r=t.length,i=-1,l=0,o=-1,d=0,u;for(;r--;){const h=t.codePointAt(r);if(h===47){if(u){l=r+1;break}continue}i<0&&(u=!0,i=r+1),h===46?o<0?o=r:d!==1&&(d=1):o>-1&&(d=-1)}return o<0||i<0||d===0||d===1&&o===i-1&&o===l+1?"":t.slice(o,i)}function EC(...t){let r=-1,i;for(;++r<t.length;)ol(t[r]),t[r]&&(i=i===void 0?t[r]:i+"/"+t[r]);return i===void 0?".":NC(i)}function NC(t){ol(t);const r=t.codePointAt(0)===47;let i=AC(t,!r);return i.length===0&&!r&&(i="."),i.length>0&&t.codePointAt(t.length-1)===47&&(i+="/"),r?"/"+i:i}function AC(t,r){let i="",l=0,o=-1,d=0,u=-1,h,g;for(;++u<=t.length;){if(u<t.length)h=t.codePointAt(u);else{if(h===47)break;h=47}if(h===47){if(!(o===u-1||d===1))if(o!==u-1&&d===2){if(i.length<2||l!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(g=i.lastIndexOf("/"),g!==i.length-1){g<0?(i="",l=0):(i=i.slice(0,g),l=i.length-1-i.lastIndexOf("/")),o=u,d=0;continue}}else if(i.length>0){i="",l=0,o=u,d=0;continue}}r&&(i=i.length>0?i+"/..":"..",l=2)}else i.length>0?i+="/"+t.slice(o+1,u):i=t.slice(o+1,u),l=u-o-1;o=u,d=0}else h===46&&d>-1?d++:d=-1}return i}function ol(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const IC={cwd:DC};function DC(){return"/"}function Wc(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function OC(t){if(typeof t=="string")t=new URL(t);else if(!Wc(t)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(t.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return MC(t)}function MC(t){if(t.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const r=t.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const l=r.codePointAt(i+2);if(l===70||l===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(r)}const Nc=["history","path","basename","stem","extname","dirname"];class av{constructor(r){let i;r?Wc(r)?i={path:r}:typeof r=="string"||zC(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":IC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<Nc.length;){const d=Nc[l];d in i&&i[d]!==void 0&&i[d]!==null&&(this[d]=d==="history"?[...i[d]]:i[d])}let o;for(o in i)Nc.includes(o)||(this[o]=i[o])}get basename(){return typeof this.path=="string"?Dn.basename(this.path):void 0}set basename(r){Ic(r,"basename"),Ac(r,"basename"),this.path=Dn.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Dn.dirname(this.path):void 0}set dirname(r){Eg(this.basename,"dirname"),this.path=Dn.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Dn.extname(this.path):void 0}set extname(r){if(Ac(r,"extname"),Eg(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Dn.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Wc(r)&&(r=OC(r)),Ic(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Dn.basename(this.path,this.extname):void 0}set stem(r){Ic(r,"stem"),Ac(r,"stem"),this.path=Dn.join(this.dirname||"",r+(this.extname||""))}fail(r,i,l){const o=this.message(r,i,l);throw o.fatal=!0,o}info(r,i,l){const o=this.message(r,i,l);return o.fatal=void 0,o}message(r,i,l){const o=new Bt(r,i,l);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Ac(t,r){if(t&&t.includes(Dn.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Dn.sep+"`")}function Ic(t,r){if(!t)throw new Error("`"+r+"` cannot be empty")}function Eg(t,r){if(!t)throw new Error("Setting `"+r+"` requires `path` to be set too")}function zC(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const _C=(function(t){const l=this.constructor.prototype,o=l[t],d=function(){return o.apply(d,arguments)};return Object.setPrototypeOf(d,l),d}),LC={}.hasOwnProperty;class jd extends _C{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=wC()}copy(){const r=new jd;let i=-1;for(;++i<this.attachers.length;){const l=this.attachers[i];r.use(...l)}return r.data(Ec(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Mc("data",this.frozen),this.namespace[r]=i,this):LC.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Mc("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const o=i.call(r,...l);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=Rs(r),l=this.parser||this.Parser;return Dc("parse",l),l(String(i),i)}process(r,i){const l=this;return this.freeze(),Dc("process",this.parser||this.Parser),Oc("process",this.compiler||this.Compiler),i?o(void 0,i):new Promise(o);function o(d,u){const h=Rs(r),g=l.parse(h);l.run(g,h,function(v,y,S){if(v||!y||!S)return p(v);const x=y,w=l.stringify(x,S);UC(w)?S.value=w:S.result=w,p(v,S)});function p(v,y){v||!y?u(v):d?d(y):i(void 0,y)}}}processSync(r){let i=!1,l;return this.freeze(),Dc("processSync",this.parser||this.Parser),Oc("processSync",this.compiler||this.Compiler),this.process(r,o),Ag("processSync","process",i),l;function o(d,u){i=!0,Rg(d),l=u}}run(r,i,l){Ng(r),this.freeze();const o=this.transformers;return!l&&typeof i=="function"&&(l=i,i=void 0),l?d(void 0,l):new Promise(d);function d(u,h){const g=Rs(i);o.run(r,g,p);function p(v,y,S){const x=y||r;v?h(v):u?u(x):l(void 0,x,S)}}}runSync(r,i){let l=!1,o;return this.run(r,i,d),Ag("runSync","run",l),o;function d(u,h){Rg(u),o=h,l=!0}}stringify(r,i){this.freeze();const l=Rs(i),o=this.compiler||this.Compiler;return Oc("stringify",o),Ng(r),o(r,l)}use(r,...i){const l=this.attachers,o=this.namespace;if(Mc("use",this.frozen),r!=null)if(typeof r=="function")g(r,i);else if(typeof r=="object")Array.isArray(r)?h(r):u(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function d(p){if(typeof p=="function")g(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[v,...y]=p;g(v,y)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))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");h(p.plugins),p.settings&&(o.settings=Ec(!0,o.settings,p.settings))}function h(p){let v=-1;if(p!=null)if(Array.isArray(p))for(;++v<p.length;){const y=p[v];d(y)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function g(p,v){let y=-1,S=-1;for(;++y<l.length;)if(l[y][0]===p){S=y;break}if(S===-1)l.push([p,...v]);else if(v.length>0){let[x,...w]=v;const A=l[S][1];Jc(A)&&Jc(x)&&(x=Ec(!0,A,x)),l[S]=[p,x,...w]}}}}const BC=new jd().freeze();function Dc(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Oc(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Mc(t,r){if(r)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ng(t){if(!Jc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ag(t,r,i){if(!i)throw new Error("`"+t+"` finished async. Use `"+r+"` instead")}function Rs(t){return HC(t)?t:new av(t)}function HC(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function UC(t){return typeof t=="string"||qC(t)}function qC(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const GC="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ig=[],Dg={allowDangerousHtml:!0},$C=/^(https?|ircs?|mailto|xmpp)$/i,FC=[{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:"className",id:"remove-classname"},{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 VC(t){const r=PC(t),i=YC(t);return KC(r.runSync(r.parse(i),i),t)}function PC(t){const r=t.rehypePlugins||Ig,i=t.remarkPlugins||Ig,l=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Dg}:Dg;return BC().use(Rw).use(i).use(xC,l).use(r)}function YC(t){const r=t.children||"",i=new av;return typeof r=="string"&&(i.value=r),i}function KC(t,r){const i=r.allowedElements,l=r.allowElement,o=r.components,d=r.disallowedElements,u=r.skipHtml,h=r.unwrapDisallowed,g=r.urlTransform||XC;for(const v of FC)Object.hasOwn(r,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+GC+v.id,void 0);return Cd(t,p),u0(t,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function p(v,y,S){if(v.type==="raw"&&S&&typeof y=="number")return u?S.children.splice(y,1):S.children[y]={type:"text",value:v.value},y;if(v.type==="element"){let x;for(x in Cc)if(Object.hasOwn(Cc,x)&&Object.hasOwn(v.properties,x)){const w=v.properties[x],A=Cc[x];(A===null||A.includes(v.tagName))&&(v.properties[x]=g(String(w||""),x,v))}}if(v.type==="element"){let x=i?!i.includes(v.tagName):d?d.includes(v.tagName):!1;if(!x&&l&&typeof y=="number"&&(x=!l(v,y,S)),x&&S&&typeof y=="number")return h&&v.children?S.children.splice(y,1,...v.children):S.children.splice(y,1),y}}}function XC(t){const r=t.indexOf(":"),i=t.indexOf("?"),l=t.indexOf("#"),o=t.indexOf("/");return r===-1||o!==-1&&r>o||i!==-1&&r>i||l!==-1&&r>l||$C.test(t.slice(0,r))?t:""}function Og(t,r){const i=String(t);if(typeof r!="string")throw new TypeError("Expected character");let l=0,o=i.indexOf(r);for(;o!==-1;)l++,o=i.indexOf(r,o+r.length);return l}function QC(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ZC(t,r,i){const o=Zs((i||{}).ignore||[]),d=JC(r);let u=-1;for(;++u<d.length;)iv(t,"text",h);function h(p,v){let y=-1,S;for(;++y<v.length;){const x=v[y],w=S?S.children:void 0;if(o(x,w?w.indexOf(x):void 0,S))return;S=x}if(S)return g(p,v)}function g(p,v){const y=v[v.length-1],S=d[u][0],x=d[u][1];let w=0;const M=y.children.indexOf(p);let O=!1,E=[];S.lastIndex=0;let D=S.exec(p.value);for(;D;){const G=D.index,K={index:D.index,input:D.input,stack:[...v,p]};let N=x(...D,K);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?S.lastIndex=G+1:(w!==G&&E.push({type:"text",value:p.value.slice(w,G)}),Array.isArray(N)?E.push(...N):N&&E.push(N),w=G+D[0].length,O=!0),!S.global)break;D=S.exec(p.value)}return O?(w<p.value.length&&E.push({type:"text",value:p.value.slice(w)}),y.children.splice(M,1,...E)):E=[p],M+E.length}}function JC(t){const r=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!t[0]||Array.isArray(t[0])?t:[t];let l=-1;for(;++l<i.length;){const o=i[l];r.push([WC(o[0]),ej(o[1])])}return r}function WC(t){return typeof t=="string"?new RegExp(QC(t),"g"):t}function ej(t){return typeof t=="function"?t:function(){return t}}const zc="phrasing",_c=["autolink","link","image","label"];function tj(){return{transforms:[oj],enter:{literalAutolink:rj,literalAutolinkEmail:Lc,literalAutolinkHttp:Lc,literalAutolinkWww:Lc},exit:{literalAutolink:sj,literalAutolinkEmail:lj,literalAutolinkHttp:ij,literalAutolinkWww:aj}}}function nj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:zc,notInConstruct:_c},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:zc,notInConstruct:_c},{character:":",before:"[ps]",after:"\\/",inConstruct:zc,notInConstruct:_c}]}}function rj(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Lc(t){this.config.enter.autolinkProtocol.call(this,t)}function ij(t){this.config.exit.autolinkProtocol.call(this,t)}function aj(t){this.config.exit.data.call(this,t);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(t)}function lj(t){this.config.exit.autolinkEmail.call(this,t)}function sj(t){this.exit(t)}function oj(t){ZC(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,uj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),cj]],{ignore:["link","linkReference"]})}function uj(t,r,i,l,o){let d="";if(!lv(o)||(/^w/i.test(r)&&(i=r+i,r="",d="http://"),!dj(i)))return!1;const u=fj(i+l);if(!u[0])return!1;const h={type:"link",title:null,url:d+r+u[0],children:[{type:"text",value:r+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function cj(t,r,i,l){return!lv(l,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function dj(t){const r=t.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function fj(t){const r=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!r)return[t,void 0];t=t.slice(0,r.index);let i=r[0],l=i.indexOf(")");const o=Og(t,"(");let d=Og(t,")");for(;l!==-1&&o>d;)t+=i.slice(0,l+1),i=i.slice(l+1),l=i.indexOf(")"),d++;return[t,i]}function lv(t,r){const i=t.input.charCodeAt(t.index-1);return(t.index===0||ii(i)||Ks(i))&&(!r||i!==47)}sv.peek=Sj;function hj(){this.buffer()}function mj(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function pj(){this.buffer()}function gj(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function yj(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=jn(this.sliceSerialize(t)).toLowerCase(),i.label=r}function vj(t){this.exit(t)}function bj(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=jn(this.sliceSerialize(t)).toLowerCase(),i.label=r}function xj(t){this.exit(t)}function Sj(){return"["}function sv(t,r,i,l){const o=i.createTracker(l);let d=o.move("[^");const u=i.enter("footnoteReference"),h=i.enter("reference");return d+=o.move(i.safe(i.associationId(t),{after:"]",before:d})),h(),u(),d+=o.move("]"),d}function kj(){return{enter:{gfmFootnoteCallString:hj,gfmFootnoteCall:mj,gfmFootnoteDefinitionLabelString:pj,gfmFootnoteDefinition:gj},exit:{gfmFootnoteCallString:yj,gfmFootnoteCall:vj,gfmFootnoteDefinitionLabelString:bj,gfmFootnoteDefinition:xj}}}function wj(t){let r=!1;return t&&t.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:sv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(l,o,d,u){const h=d.createTracker(u);let g=h.move("[^");const p=d.enter("footnoteDefinition"),v=d.enter("label");return g+=h.move(d.safe(d.associationId(l),{before:g,after:"]"})),v(),g+=h.move("]:"),l.children&&l.children.length>0&&(h.shift(4),g+=h.move((r?`
|
|
25
|
+
`:" ")+d.indentLines(d.containerFlow(l,h.current()),r?ov:Cj))),p(),g}}function Cj(t,r,i){return r===0?t:ov(t,r,i)}function ov(t,r,i){return(i?"":" ")+t}const jj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];uv.peek=Aj;function Rj(){return{canContainEols:["delete"],enter:{strikethrough:Ej},exit:{strikethrough:Nj}}}function Tj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:jj}],handlers:{delete:uv}}}function Ej(t){this.enter({type:"delete",children:[]},t)}function Nj(t){this.exit(t)}function uv(t,r,i,l){const o=i.createTracker(l),d=i.enter("strikethrough");let u=o.move("~~");return u+=i.containerPhrasing(t,{...o.current(),before:u,after:"~"}),u+=o.move("~~"),d(),u}function Aj(){return"~"}function Ij(t){return t.length}function Dj(t,r){const i=r||{},l=(i.align||[]).concat(),o=i.stringLength||Ij,d=[],u=[],h=[],g=[];let p=0,v=-1;for(;++v<t.length;){const A=[],M=[];let O=-1;for(t[v].length>p&&(p=t[v].length);++O<t[v].length;){const E=Oj(t[v][O]);if(i.alignDelimiters!==!1){const D=o(E);M[O]=D,(g[O]===void 0||D>g[O])&&(g[O]=D)}A.push(E)}u[v]=A,h[v]=M}let y=-1;if(typeof l=="object"&&"length"in l)for(;++y<p;)d[y]=Mg(l[y]);else{const A=Mg(l);for(;++y<p;)d[y]=A}y=-1;const S=[],x=[];for(;++y<p;){const A=d[y];let M="",O="";A===99?(M=":",O=":"):A===108?M=":":A===114&&(O=":");let E=i.alignDelimiters===!1?1:Math.max(1,g[y]-M.length-O.length);const D=M+"-".repeat(E)+O;i.alignDelimiters!==!1&&(E=M.length+E+O.length,E>g[y]&&(g[y]=E),x[y]=E),S[y]=D}u.splice(1,0,S),h.splice(1,0,x),v=-1;const w=[];for(;++v<u.length;){const A=u[v],M=h[v];y=-1;const O=[];for(;++y<p;){const E=A[y]||"";let D="",G="";if(i.alignDelimiters!==!1){const K=g[y]-(M[y]||0),N=d[y];N===114?D=" ".repeat(K):N===99?K%2?(D=" ".repeat(K/2+.5),G=" ".repeat(K/2-.5)):(D=" ".repeat(K/2),G=D):G=" ".repeat(K)}i.delimiterStart!==!1&&!y&&O.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&E==="")&&(i.delimiterStart!==!1||y)&&O.push(" "),i.alignDelimiters!==!1&&O.push(D),O.push(E),i.alignDelimiters!==!1&&O.push(G),i.padding!==!1&&O.push(" "),(i.delimiterEnd!==!1||y!==p-1)&&O.push("|")}w.push(i.delimiterEnd===!1?O.join("").replace(/ +$/,""):O.join(""))}return w.join(`
|
|
26
|
+
`)}function Oj(t){return t==null?"":String(t)}function Mg(t){const r=typeof t=="string"?t.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function Mj(t,r,i,l){const o=i.enter("blockquote"),d=i.createTracker(l);d.move("> "),d.shift(2);const u=i.indentLines(i.containerFlow(t,d.current()),zj);return o(),u}function zj(t,r,i){return">"+(i?"":" ")+t}function _j(t,r){return zg(t,r.inConstruct,!0)&&!zg(t,r.notInConstruct,!1)}function zg(t,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let l=-1;for(;++l<r.length;)if(t.includes(r[l]))return!0;return!1}function _g(t,r,i,l){let o=-1;for(;++o<i.unsafe.length;)if(i.unsafe[o].character===`
|
|
27
|
+
`&&_j(i.stack,i.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
|
|
28
|
+
`}function Lj(t,r){const i=String(t);let l=i.indexOf(r),o=l,d=0,u=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===o?++d>u&&(u=d):d=1,o=l+r.length,l=i.indexOf(r,o);return u}function Bj(t,r){return!!(r.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function Hj(t){const r=t.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function Uj(t,r,i,l){const o=Hj(i),d=t.value||"",u=o==="`"?"GraveAccent":"Tilde";if(Bj(t,i)){const y=i.enter("codeIndented"),S=i.indentLines(d,qj);return y(),S}const h=i.createTracker(l),g=o.repeat(Math.max(Lj(d,o)+1,3)),p=i.enter("codeFenced");let v=h.move(g);if(t.lang){const y=i.enter(`codeFencedLang${u}`);v+=h.move(i.safe(t.lang,{before:v,after:" ",encode:["`"],...h.current()})),y()}if(t.lang&&t.meta){const y=i.enter(`codeFencedMeta${u}`);v+=h.move(" "),v+=h.move(i.safe(t.meta,{before:v,after:`
|
|
29
|
+
`,encode:["`"],...h.current()})),y()}return v+=h.move(`
|
|
30
|
+
`),d&&(v+=h.move(d+`
|
|
31
|
+
`)),v+=h.move(g),p(),v}function qj(t,r,i){return(i?"":" ")+t}function Rd(t){const r=t.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function Gj(t,r,i,l){const o=Rd(i),d=o==='"'?"Quote":"Apostrophe",u=i.enter("definition");let h=i.enter("label");const g=i.createTracker(l);let p=g.move("[");return p+=g.move(i.safe(i.associationId(t),{before:p,after:"]",...g.current()})),p+=g.move("]: "),h(),!t.url||/[\0- \u007F]/.test(t.url)?(h=i.enter("destinationLiteral"),p+=g.move("<"),p+=g.move(i.safe(t.url,{before:p,after:">",...g.current()})),p+=g.move(">")):(h=i.enter("destinationRaw"),p+=g.move(i.safe(t.url,{before:p,after:t.title?" ":`
|
|
32
|
+
`,...g.current()}))),h(),t.title&&(h=i.enter(`title${d}`),p+=g.move(" "+o),p+=g.move(i.safe(t.title,{before:p,after:o,...g.current()})),p+=g.move(o),h()),u(),p}function $j(t){const r=t.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function al(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Bs(t,r,i){const l=Zi(t),o=Zi(r);return l===void 0?o===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}cv.peek=Fj;function cv(t,r,i,l){const o=$j(i),d=i.enter("emphasis"),u=i.createTracker(l),h=u.move(o);let g=u.move(i.containerPhrasing(t,{after:o,before:h,...u.current()}));const p=g.charCodeAt(0),v=Bs(l.before.charCodeAt(l.before.length-1),p,o);v.inside&&(g=al(p)+g.slice(1));const y=g.charCodeAt(g.length-1),S=Bs(l.after.charCodeAt(0),y,o);S.inside&&(g=g.slice(0,-1)+al(y));const x=u.move(o);return d(),i.attentionEncodeSurroundingInfo={after:S.outside,before:v.outside},h+g+x}function Fj(t,r,i){return i.options.emphasis||"*"}function Vj(t,r){let i=!1;return Cd(t,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return i=!0,Qc}),!!((!t.depth||t.depth<3)&&yd(t)&&(r.options.setext||i))}function Pj(t,r,i,l){const o=Math.max(Math.min(6,t.depth||1),1),d=i.createTracker(l);if(Vj(t,i)){const v=i.enter("headingSetext"),y=i.enter("phrasing"),S=i.containerPhrasing(t,{...d.current(),before:`
|
|
33
|
+
`,after:`
|
|
34
|
+
`});return y(),v(),S+`
|
|
35
|
+
`+(o===1?"=":"-").repeat(S.length-(Math.max(S.lastIndexOf("\r"),S.lastIndexOf(`
|
|
36
|
+
`))+1))}const u="#".repeat(o),h=i.enter("headingAtx"),g=i.enter("phrasing");d.move(u+" ");let p=i.containerPhrasing(t,{before:"# ",after:`
|
|
37
|
+
`,...d.current()});return/^[\t ]/.test(p)&&(p=al(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,i.options.closeAtx&&(p+=" "+u),g(),h(),p}dv.peek=Yj;function dv(t){return t.value||""}function Yj(){return"<"}fv.peek=Kj;function fv(t,r,i,l){const o=Rd(i),d=o==='"'?"Quote":"Apostrophe",u=i.enter("image");let h=i.enter("label");const g=i.createTracker(l);let p=g.move("![");return p+=g.move(i.safe(t.alt,{before:p,after:"]",...g.current()})),p+=g.move("]("),h(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(h=i.enter("destinationLiteral"),p+=g.move("<"),p+=g.move(i.safe(t.url,{before:p,after:">",...g.current()})),p+=g.move(">")):(h=i.enter("destinationRaw"),p+=g.move(i.safe(t.url,{before:p,after:t.title?" ":")",...g.current()}))),h(),t.title&&(h=i.enter(`title${d}`),p+=g.move(" "+o),p+=g.move(i.safe(t.title,{before:p,after:o,...g.current()})),p+=g.move(o),h()),p+=g.move(")"),u(),p}function Kj(){return"!"}hv.peek=Xj;function hv(t,r,i,l){const o=t.referenceType,d=i.enter("imageReference");let u=i.enter("label");const h=i.createTracker(l);let g=h.move("![");const p=i.safe(t.alt,{before:g,after:"]",...h.current()});g+=h.move(p+"]["),u();const v=i.stack;i.stack=[],u=i.enter("reference");const y=i.safe(i.associationId(t),{before:g,after:"]",...h.current()});return u(),i.stack=v,d(),o==="full"||!p||p!==y?g+=h.move(y+"]"):o==="shortcut"?g=g.slice(0,-1):g+=h.move("]"),g}function Xj(){return"!"}mv.peek=Qj;function mv(t,r,i){let l=t.value||"",o="`",d=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++d<i.unsafe.length;){const u=i.unsafe[d],h=i.compilePattern(u);let g;if(u.atBreak)for(;g=h.exec(l);){let p=g.index;l.charCodeAt(p)===10&&l.charCodeAt(p-1)===13&&p--,l=l.slice(0,p)+" "+l.slice(g.index+1)}}return o+l+o}function Qj(){return"`"}function pv(t,r){const i=yd(t);return!!(!r.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(i===t.url||"mailto:"+i===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}gv.peek=Zj;function gv(t,r,i,l){const o=Rd(i),d=o==='"'?"Quote":"Apostrophe",u=i.createTracker(l);let h,g;if(pv(t,i)){const v=i.stack;i.stack=[],h=i.enter("autolink");let y=u.move("<");return y+=u.move(i.containerPhrasing(t,{before:y,after:">",...u.current()})),y+=u.move(">"),h(),i.stack=v,y}h=i.enter("link"),g=i.enter("label");let p=u.move("[");return p+=u.move(i.containerPhrasing(t,{before:p,after:"](",...u.current()})),p+=u.move("]("),g(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(g=i.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(i.safe(t.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(g=i.enter("destinationRaw"),p+=u.move(i.safe(t.url,{before:p,after:t.title?" ":")",...u.current()}))),g(),t.title&&(g=i.enter(`title${d}`),p+=u.move(" "+o),p+=u.move(i.safe(t.title,{before:p,after:o,...u.current()})),p+=u.move(o),g()),p+=u.move(")"),h(),p}function Zj(t,r,i){return pv(t,i)?"<":"["}yv.peek=Jj;function yv(t,r,i,l){const o=t.referenceType,d=i.enter("linkReference");let u=i.enter("label");const h=i.createTracker(l);let g=h.move("[");const p=i.containerPhrasing(t,{before:g,after:"]",...h.current()});g+=h.move(p+"]["),u();const v=i.stack;i.stack=[],u=i.enter("reference");const y=i.safe(i.associationId(t),{before:g,after:"]",...h.current()});return u(),i.stack=v,d(),o==="full"||!p||p!==y?g+=h.move(y+"]"):o==="shortcut"?g=g.slice(0,-1):g+=h.move("]"),g}function Jj(){return"["}function Td(t){const r=t.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function Wj(t){const r=Td(t),i=t.options.bulletOther;if(!i)return r==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+i+"`) to be different");return i}function eR(t){const r=t.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function vv(t){const r=t.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function tR(t,r,i,l){const o=i.enter("list"),d=i.bulletCurrent;let u=t.ordered?eR(i):Td(i);const h=t.ordered?u==="."?")":".":Wj(i);let g=r&&i.bulletLastUsed?u===i.bulletLastUsed:!1;if(!t.ordered){const v=t.children?t.children[0]:void 0;if((u==="*"||u==="-")&&v&&(!v.children||!v.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(g=!0),vv(i)===u&&v){let y=-1;for(;++y<t.children.length;){const S=t.children[y];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){g=!0;break}}}}g&&(u=h),i.bulletCurrent=u;const p=i.containerFlow(t,l);return i.bulletLastUsed=u,i.bulletCurrent=d,o(),p}function nR(t){const r=t.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function rR(t,r,i,l){const o=nR(i);let d=i.bulletCurrent||Td(i);r&&r.type==="list"&&r.ordered&&(d=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(t))+d);let u=d.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||t.spread))&&(u=Math.ceil(u/4)*4);const h=i.createTracker(l);h.move(d+" ".repeat(u-d.length)),h.shift(u);const g=i.enter("listItem"),p=i.indentLines(i.containerFlow(t,h.current()),v);return g(),p;function v(y,S,x){return S?(x?"":" ".repeat(u))+y:(x?d:d+" ".repeat(u-d.length))+y}}function iR(t,r,i,l){const o=i.enter("paragraph"),d=i.enter("phrasing"),u=i.containerPhrasing(t,l);return d(),o(),u}const aR=Zs(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function lR(t,r,i,l){return(t.children.some(function(u){return aR(u)})?i.containerPhrasing:i.containerFlow).call(i,t,l)}function sR(t){const r=t.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}bv.peek=oR;function bv(t,r,i,l){const o=sR(i),d=i.enter("strong"),u=i.createTracker(l),h=u.move(o+o);let g=u.move(i.containerPhrasing(t,{after:o,before:h,...u.current()}));const p=g.charCodeAt(0),v=Bs(l.before.charCodeAt(l.before.length-1),p,o);v.inside&&(g=al(p)+g.slice(1));const y=g.charCodeAt(g.length-1),S=Bs(l.after.charCodeAt(0),y,o);S.inside&&(g=g.slice(0,-1)+al(y));const x=u.move(o+o);return d(),i.attentionEncodeSurroundingInfo={after:S.outside,before:v.outside},h+g+x}function oR(t,r,i){return i.options.strong||"*"}function uR(t,r,i,l){return i.safe(t.value,l)}function cR(t){const r=t.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function dR(t,r,i){const l=(vv(i)+(i.options.ruleSpaces?" ":"")).repeat(cR(i));return i.options.ruleSpaces?l.slice(0,-1):l}const xv={blockquote:Mj,break:_g,code:Uj,definition:Gj,emphasis:cv,hardBreak:_g,heading:Pj,html:dv,image:fv,imageReference:hv,inlineCode:mv,link:gv,linkReference:yv,list:tR,listItem:rR,paragraph:iR,root:lR,strong:bv,text:uR,thematicBreak:dR};function fR(){return{enter:{table:hR,tableData:Lg,tableHeader:Lg,tableRow:pR},exit:{codeText:gR,table:mR,tableData:Bc,tableHeader:Bc,tableRow:Bc}}}function hR(t){const r=t._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},t),this.data.inTable=!0}function mR(t){this.exit(t),this.data.inTable=void 0}function pR(t){this.enter({type:"tableRow",children:[]},t)}function Bc(t){this.exit(t)}function Lg(t){this.enter({type:"tableCell",children:[]},t)}function gR(t){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,yR));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(t)}function yR(t,r){return r==="|"?r:t}function vR(t){const r=t||{},i=r.tableCellPadding,l=r.tablePipeAlign,o=r.stringLength,d=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
38
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:S,table:u,tableCell:g,tableRow:h}};function u(x,w,A,M){return p(v(x,A,M),x.align)}function h(x,w,A,M){const O=y(x,A,M),E=p([O]);return E.slice(0,E.indexOf(`
|
|
39
|
+
`))}function g(x,w,A,M){const O=A.enter("tableCell"),E=A.enter("phrasing"),D=A.containerPhrasing(x,{...M,before:d,after:d});return E(),O(),D}function p(x,w){return Dj(x,{align:w,alignDelimiters:l,padding:i,stringLength:o})}function v(x,w,A){const M=x.children;let O=-1;const E=[],D=w.enter("table");for(;++O<M.length;)E[O]=y(M[O],w,A);return D(),E}function y(x,w,A){const M=x.children;let O=-1;const E=[],D=w.enter("tableRow");for(;++O<M.length;)E[O]=g(M[O],x,w,A);return D(),E}function S(x,w,A){let M=xv.inlineCode(x,w,A);return A.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function bR(){return{exit:{taskListCheckValueChecked:Bg,taskListCheckValueUnchecked:Bg,paragraph:SR}}}function xR(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:kR}}}function Bg(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function SR(t){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const l=i.children[0];if(l&&l.type==="text"){const o=r.children;let d=-1,u;for(;++d<o.length;){const h=o[d];if(h.type==="paragraph"){u=h;break}}u===i&&(l.value=l.value.slice(1),l.value.length===0?i.children.shift():i.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,i.position.start=Object.assign({},l.position.start)))}}this.exit(t)}function kR(t,r,i,l){const o=t.children[0],d=typeof t.checked=="boolean"&&o&&o.type==="paragraph",u="["+(t.checked?"x":" ")+"] ",h=i.createTracker(l);d&&h.move(u);let g=xv.listItem(t,r,i,{...l,...h.current()});return d&&(g=g.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),g;function p(v){return v+u}}function wR(){return[tj(),kj(),Rj(),fR(),bR()]}function CR(t){return{extensions:[nj(),wj(t),Tj(),vR(t),xR()]}}const jR={tokenize:IR,partial:!0},Sv={tokenize:DR,partial:!0},kv={tokenize:OR,partial:!0},wv={tokenize:MR,partial:!0},RR={tokenize:zR,partial:!0},Cv={name:"wwwAutolink",tokenize:NR,previous:Rv},jv={name:"protocolAutolink",tokenize:AR,previous:Tv},nr={name:"emailAutolink",tokenize:ER,previous:Ev},Mn={};function TR(){return{text:Mn}}let Jr=48;for(;Jr<123;)Mn[Jr]=nr,Jr++,Jr===58?Jr=65:Jr===91&&(Jr=97);Mn[43]=nr;Mn[45]=nr;Mn[46]=nr;Mn[95]=nr;Mn[72]=[nr,jv];Mn[104]=[nr,jv];Mn[87]=[nr,Cv];Mn[119]=[nr,Cv];function ER(t,r,i){const l=this;let o,d;return u;function u(y){return!ed(y)||!Ev.call(l,l.previous)||Ed(l.events)?i(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),h(y))}function h(y){return ed(y)?(t.consume(y),h):y===64?(t.consume(y),g):i(y)}function g(y){return y===46?t.check(RR,v,p)(y):y===45||y===95||Lt(y)?(d=!0,t.consume(y),g):v(y)}function p(y){return t.consume(y),o=!0,g}function v(y){return d&&o&&Ut(l.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),r(y)):i(y)}}function NR(t,r,i){const l=this;return o;function o(u){return u!==87&&u!==119||!Rv.call(l,l.previous)||Ed(l.events)?i(u):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(jR,t.attempt(Sv,t.attempt(kv,d),i),i)(u))}function d(u){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(u)}}function AR(t,r,i){const l=this;let o="",d=!1;return u;function u(y){return(y===72||y===104)&&Tv.call(l,l.previous)&&!Ed(l.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),t.consume(y),h):i(y)}function h(y){if(Ut(y)&&o.length<5)return o+=String.fromCodePoint(y),t.consume(y),h;if(y===58){const S=o.toLowerCase();if(S==="http"||S==="https")return t.consume(y),g}return i(y)}function g(y){return y===47?(t.consume(y),d?p:(d=!0,g)):i(y)}function p(y){return y===null||zs(y)||at(y)||ii(y)||Ks(y)?i(y):t.attempt(Sv,t.attempt(kv,v),i)(y)}function v(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(y)}}function IR(t,r,i){let l=0;return o;function o(u){return(u===87||u===119)&&l<3?(l++,t.consume(u),o):u===46&&l===3?(t.consume(u),d):i(u)}function d(u){return u===null?i(u):r(u)}}function DR(t,r,i){let l,o,d;return u;function u(p){return p===46||p===95?t.check(wv,g,h)(p):p===null||at(p)||ii(p)||p!==45&&Ks(p)?g(p):(d=!0,t.consume(p),u)}function h(p){return p===95?l=!0:(o=l,l=void 0),t.consume(p),u}function g(p){return o||l||!d?i(p):r(p)}}function OR(t,r){let i=0,l=0;return o;function o(u){return u===40?(i++,t.consume(u),o):u===41&&l<i?d(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?t.check(wv,r,d)(u):u===null||at(u)||ii(u)?r(u):(t.consume(u),o)}function d(u){return u===41&&l++,t.consume(u),o}}function MR(t,r,i){return l;function l(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(t.consume(h),l):h===38?(t.consume(h),d):h===93?(t.consume(h),o):h===60||h===null||at(h)||ii(h)?r(h):i(h)}function o(h){return h===null||h===40||h===91||at(h)||ii(h)?r(h):l(h)}function d(h){return Ut(h)?u(h):i(h)}function u(h){return h===59?(t.consume(h),l):Ut(h)?(t.consume(h),u):i(h)}}function zR(t,r,i){return l;function l(d){return t.consume(d),o}function o(d){return Lt(d)?i(d):r(d)}}function Rv(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||at(t)}function Tv(t){return!Ut(t)}function Ev(t){return!(t===47||ed(t))}function ed(t){return t===43||t===45||t===46||t===95||Lt(t)}function Ed(t){let r=t.length,i=!1;for(;r--;){const l=t[r][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){i=!0;break}if(l._gfmAutolinkLiteralWalkedInto){i=!1;break}}return t.length>0&&!i&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const _R={tokenize:FR,partial:!0};function LR(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qR,continuation:{tokenize:GR},exit:$R}},text:{91:{name:"gfmFootnoteCall",tokenize:UR},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:BR,resolveTo:HR}}}}function BR(t,r,i){const l=this;let o=l.events.length;const d=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u;for(;o--;){const g=l.events[o][1];if(g.type==="labelImage"){u=g;break}if(g.type==="gfmFootnoteCall"||g.type==="labelLink"||g.type==="label"||g.type==="image"||g.type==="link")break}return h;function h(g){if(!u||!u._balanced)return i(g);const p=jn(l.sliceSerialize({start:u.end,end:l.now()}));return p.codePointAt(0)!==94||!d.includes(p.slice(1))?i(g):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),r(g))}}function HR(t,r){let i=t.length;for(;i--;)if(t[i][1].type==="labelImage"&&t[i][0]==="enter"){t[i][1];break}t[i+1][1].type="data",t[i+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},t[i+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[i+3][1].end),end:Object.assign({},t[i+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const d={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},d.start),end:Object.assign({},d.end)},h=[t[i+1],t[i+2],["enter",l,r],t[i+3],t[i+4],["enter",o,r],["exit",o,r],["enter",d,r],["enter",u,r],["exit",u,r],["exit",d,r],t[t.length-2],t[t.length-1],["exit",l,r]];return t.splice(i,t.length-i+1,...h),t}function UR(t,r,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d=0,u;return h;function h(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),g}function g(y){return y!==94?i(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(y){if(d>999||y===93&&!u||y===null||y===91||at(y))return i(y);if(y===93){t.exit("chunkString");const S=t.exit("gfmFootnoteCallString");return o.includes(jn(l.sliceSerialize(S)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),r):i(y)}return at(y)||(u=!0),d++,t.consume(y),y===92?v:p}function v(y){return y===91||y===92||y===93?(t.consume(y),d++,p):p(y)}}function qR(t,r,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d,u=0,h;return g;function g(w){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(w){return w===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",v):i(w)}function v(w){if(u>999||w===93&&!h||w===null||w===91||at(w))return i(w);if(w===93){t.exit("chunkString");const A=t.exit("gfmFootnoteDefinitionLabelString");return d=jn(l.sliceSerialize(A)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(w),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),S}return at(w)||(h=!0),u++,t.consume(w),w===92?y:v}function y(w){return w===91||w===92||w===93?(t.consume(w),u++,v):v(w)}function S(w){return w===58?(t.enter("definitionMarker"),t.consume(w),t.exit("definitionMarker"),o.includes(d)||o.push(d),Ve(t,x,"gfmFootnoteDefinitionWhitespace")):i(w)}function x(w){return r(w)}}function GR(t,r,i){return t.check(sl,r,t.attempt(_R,r,i))}function $R(t){t.exit("gfmFootnoteDefinition")}function FR(t,r,i){const l=this;return Ve(t,o,"gfmFootnoteDefinitionIndent",5);function o(d){const u=l.events[l.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?r(d):i(d)}}function VR(t){let i=(t||{}).singleTilde;const l={name:"strikethrough",tokenize:d,resolveAll:o};return i==null&&(i=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function o(u,h){let g=-1;for(;++g<u.length;)if(u[g][0]==="enter"&&u[g][1].type==="strikethroughSequenceTemporary"&&u[g][1]._close){let p=g;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[g][1].end.offset-u[g][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[g][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[g][1].end)},y={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[g][1].start)},S=[["enter",v,h],["enter",u[p][1],h],["exit",u[p][1],h],["enter",y,h]],x=h.parser.constructs.insideSpan.null;x&&on(S,S.length,0,Xs(x,u.slice(p+1,g),h)),on(S,S.length,0,[["exit",y,h],["enter",u[g][1],h],["exit",u[g][1],h],["exit",v,h]]),on(u,p-1,g-p+3,S),g=p+S.length-2;break}}for(g=-1;++g<u.length;)u[g][1].type==="strikethroughSequenceTemporary"&&(u[g][1].type="data");return u}function d(u,h,g){const p=this.previous,v=this.events;let y=0;return S;function S(w){return p===126&&v[v.length-1][1].type!=="characterEscape"?g(w):(u.enter("strikethroughSequenceTemporary"),x(w))}function x(w){const A=Zi(p);if(w===126)return y>1?g(w):(u.consume(w),y++,x);if(y<2&&!i)return g(w);const M=u.exit("strikethroughSequenceTemporary"),O=Zi(w);return M._open=!O||O===2&&!!A,M._close=!A||A===2&&!!O,h(w)}}}class PR{constructor(){this.map=[]}add(r,i,l){YR(this,r,i,l)}consume(r){if(this.map.sort(function(d,u){return d[0]-u[0]}),this.map.length===0)return;let i=this.map.length;const l=[];for(;i>0;)i-=1,l.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];l.push(r.slice()),r.length=0;let o=l.pop();for(;o;){for(const d of o)r.push(d);o=l.pop()}this.map.length=0}}function YR(t,r,i,l){let o=0;if(!(i===0&&l.length===0)){for(;o<t.map.length;){if(t.map[o][0]===r){t.map[o][1]+=i,t.map[o][2].push(...l);return}o+=1}t.map.push([r,i,l])}}function KR(t,r){let i=!1;const l=[];for(;r<t.length;){const o=t[r];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(t[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[r-1][1].type==="tableDelimiterMarker"){const d=l.length-1;l[d]=l[d]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return l}function XR(){return{flow:{null:{name:"table",tokenize:QR,resolveAll:ZR}}}}function QR(t,r,i){const l=this;let o=0,d=0,u;return h;function h(_){let F=l.events.length-1;for(;F>-1;){const X=l.events[F][1].type;if(X==="lineEnding"||X==="linePrefix")F--;else break}const Y=F>-1?l.events[F][1].type:null,oe=Y==="tableHead"||Y==="tableRow"?N:g;return oe===N&&l.parser.lazy[l.now().line]?i(_):oe(_)}function g(_){return t.enter("tableHead"),t.enter("tableRow"),p(_)}function p(_){return _===124||(u=!0,d+=1),v(_)}function v(_){return _===null?i(_):ke(_)?d>1?(d=0,l.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),x):i(_):Be(_)?Ve(t,v,"whitespace")(_):(d+=1,u&&(u=!1,o+=1),_===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),u=!0,v):(t.enter("data"),y(_)))}function y(_){return _===null||_===124||at(_)?(t.exit("data"),v(_)):(t.consume(_),_===92?S:y)}function S(_){return _===92||_===124?(t.consume(_),y):y(_)}function x(_){return l.interrupt=!1,l.parser.lazy[l.now().line]?i(_):(t.enter("tableDelimiterRow"),u=!1,Be(_)?Ve(t,w,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):w(_))}function w(_){return _===45||_===58?M(_):_===124?(u=!0,t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),A):K(_)}function A(_){return Be(_)?Ve(t,M,"whitespace")(_):M(_)}function M(_){return _===58?(d+=1,u=!0,t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),O):_===45?(d+=1,O(_)):_===null||ke(_)?G(_):K(_)}function O(_){return _===45?(t.enter("tableDelimiterFiller"),E(_)):K(_)}function E(_){return _===45?(t.consume(_),E):_===58?(u=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),D):(t.exit("tableDelimiterFiller"),D(_))}function D(_){return Be(_)?Ve(t,G,"whitespace")(_):G(_)}function G(_){return _===124?w(_):_===null||ke(_)?!u||o!==d?K(_):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(_)):K(_)}function K(_){return i(_)}function N(_){return t.enter("tableRow"),$(_)}function $(_){return _===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),$):_===null||ke(_)?(t.exit("tableRow"),r(_)):Be(_)?Ve(t,$,"whitespace")(_):(t.enter("data"),ne(_))}function ne(_){return _===null||_===124||at(_)?(t.exit("data"),$(_)):(t.consume(_),_===92?ce:ne)}function ce(_){return _===92||_===124?(t.consume(_),ne):ne(_)}}function ZR(t,r){let i=-1,l=!0,o=0,d=[0,0,0,0],u=[0,0,0,0],h=!1,g=0,p,v,y;const S=new PR;for(;++i<t.length;){const x=t[i],w=x[1];x[0]==="enter"?w.type==="tableHead"?(h=!1,g!==0&&(Hg(S,r,g,p,v),v=void 0,g=0),p={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},S.add(i,0,[["enter",p,r]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(l=!0,y=void 0,d=[0,0,0,0],u=[0,i+1,0,0],h&&(h=!1,v={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},S.add(i,0,[["enter",v,r]])),o=w.type==="tableDelimiterRow"?2:v?3:1):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(l=!1,u[2]===0&&(d[1]!==0&&(u[0]=u[1],y=Ts(S,r,d,o,void 0,y),d=[0,0,0,0]),u[2]=i)):w.type==="tableCellDivider"&&(l?l=!1:(d[1]!==0&&(u[0]=u[1],y=Ts(S,r,d,o,void 0,y)),d=u,u=[d[1],i,0,0])):w.type==="tableHead"?(h=!0,g=i):w.type==="tableRow"||w.type==="tableDelimiterRow"?(g=i,d[1]!==0?(u[0]=u[1],y=Ts(S,r,d,o,i,y)):u[1]!==0&&(y=Ts(S,r,u,o,i,y)),o=0):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(u[3]=i)}for(g!==0&&Hg(S,r,g,p,v),S.consume(r.events),i=-1;++i<r.events.length;){const x=r.events[i];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=KR(r.events,i))}return t}function Ts(t,r,i,l,o,d){const u=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",h="tableContent";i[0]!==0&&(d.end=Object.assign({},Vi(r.events,i[0])),t.add(i[0],0,[["exit",d,r]]));const g=Vi(r.events,i[1]);if(d={type:u,start:Object.assign({},g),end:Object.assign({},g)},t.add(i[1],0,[["enter",d,r]]),i[2]!==0){const p=Vi(r.events,i[2]),v=Vi(r.events,i[3]),y={type:h,start:Object.assign({},p),end:Object.assign({},v)};if(t.add(i[2],0,[["enter",y,r]]),l!==2){const S=r.events[i[2]],x=r.events[i[3]];if(S[1].end=Object.assign({},x[1].end),S[1].type="chunkText",S[1].contentType="text",i[3]>i[2]+1){const w=i[2]+1,A=i[3]-i[2]-1;t.add(w,A,[])}}t.add(i[3]+1,0,[["exit",y,r]])}return o!==void 0&&(d.end=Object.assign({},Vi(r.events,o)),t.add(o,0,[["exit",d,r]]),d=void 0),d}function Hg(t,r,i,l,o){const d=[],u=Vi(r.events,i);o&&(o.end=Object.assign({},u),d.push(["exit",o,r])),l.end=Object.assign({},u),d.push(["exit",l,r]),t.add(i+1,0,d)}function Vi(t,r){const i=t[r],l=i[0]==="enter"?"start":"end";return i[1][l]}const JR={name:"tasklistCheck",tokenize:eT};function WR(){return{text:{91:JR}}}function eT(t,r,i){const l=this;return o;function o(g){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?i(g):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(g),t.exit("taskListCheckMarker"),d)}function d(g){return at(g)?(t.enter("taskListCheckValueUnchecked"),t.consume(g),t.exit("taskListCheckValueUnchecked"),u):g===88||g===120?(t.enter("taskListCheckValueChecked"),t.consume(g),t.exit("taskListCheckValueChecked"),u):i(g)}function u(g){return g===93?(t.enter("taskListCheckMarker"),t.consume(g),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),h):i(g)}function h(g){return ke(g)?r(g):Be(g)?t.check({tokenize:tT},r,i)(g):i(g)}}function tT(t,r,i){return Ve(t,l,"whitespace");function l(o){return o===null?i(o):r(o)}}function nT(t){return By([TR(),LR(),VR(t),XR(),WR()])}const rT={};function iT(t){const r=this,i=t||rT,l=r.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),d=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),u=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(nT(i)),d.push(wR()),u.push(CR(i))}const Nv=/^(javascript|vbscript|data):/i;function aT(t){if(!t)return!1;const r=t.trim();return!(!r||Nv.test(r))}function lT(t){if(!t)return!1;const r=t.trim();return!r||Nv.test(r)||r.startsWith("blob:")||r.startsWith("data:image/")||/^https?:\/\//i.test(r)?!1:!!(r.startsWith("/")||r.startsWith("./")||r.startsWith("../")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(r))}const sT=[[iT,{singleTilde:!1}]];function Ug({lang:t,text:r}){const[i,l]=k.useState(!1),o=()=>{navigator.clipboard?.writeText(r).then(()=>{l(!0),window.setTimeout(()=>l(!1),1600)},()=>{})};return c.jsxs("div",{className:"oc-codeblock",children:[c.jsxs("div",{className:"oc-codeblock-head",children:[c.jsx("span",{className:"oc-codeblock-lang",children:t||"text"}),c.jsx("button",{type:"button",className:"oc-codeblock-copy",onClick:o,children:i?"已复制":"复制"})]}),c.jsx("pre",{children:c.jsx("code",{children:r})})]})}const oT={pre({children:t}){return c.jsx(c.Fragment,{children:t})},code({className:t,children:r,...i}){const l=String(r??"").replace(/\n$/,""),o=/language-([\w-]+)/.exec(t??"");return o||t&&l.includes(`
|
|
40
|
+
`)?c.jsx(Ug,{lang:o?.[1]??"",text:l}):l.includes(`
|
|
41
|
+
`)?c.jsx(Ug,{lang:"",text:l}):c.jsx("code",{className:t,...i,children:r})},a({href:t,children:r,...i}){if(!aT(t))return c.jsx("span",{...i,children:r});const l=/^https?:\/\//i.test(t??"");return c.jsx("a",{href:t,...l?{target:"_blank",rel:"noopener noreferrer"}:{},...i,children:r})},img({src:t,alt:r}){return lT(t)?c.jsxs(c.Fragment,{children:[c.jsx("img",{src:t,alt:r??"",loading:"lazy",onError:i=>{const l=i.currentTarget;l.hidden=!0,l.nextElementSibling?.removeAttribute("hidden")}}),c.jsx("span",{className:"oc-md-img-fallback",hidden:!0,title:t??void 0,children:r?`[图片加载失败: ${r}]`:"[图片加载失败]"})]}):c.jsx("span",{className:"oc-md-img-fallback",title:t??void 0,children:r?`[图片: ${r}]`:"[图片已屏蔽]"})},table({children:t}){return c.jsx("div",{className:"oc-md-table-wrap",children:c.jsx("table",{children:t})})},input(t){return t.type==="checkbox"?c.jsx("input",{type:"checkbox",checked:!!t.checked,disabled:!0,readOnly:!0}):c.jsx("input",{...t,disabled:!0,readOnly:!0})}};class uT extends k.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){}componentDidUpdate(r){r.text!==this.props.text&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?c.jsx("div",{className:"oc-md",children:c.jsx("pre",{className:"oc-md-fallback",children:this.props.text})}):this.props.children}}function cT({text:t}){try{return c.jsx(uT,{text:t,children:c.jsx("div",{className:"oc-md",children:c.jsx(VC,{remarkPlugins:sT,components:oT,children:t})})})}catch{return c.jsx("div",{className:"oc-md",children:c.jsx("pre",{className:"oc-md-fallback",children:t})})}}function dT(){return c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function fT(){return c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("polyline",{points:"20 6 9 17 4 12"})})}function hT(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),c.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function mT(){return c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:c.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Av(){return c.jsx("svg",{className:"oc-tool-chevron",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("polyline",{points:"4 2.5 7.5 6 4 9.5"})})}function pT(){return c.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})})}function td(t){const[r,i]=k.useState(!1),l=()=>{navigator.clipboard?.writeText(t.text).then(()=>{i(!0),window.setTimeout(()=>i(!1),1600)},()=>{})};return c.jsx("button",{type:"button",className:`oc-message-copy${r?" is-copied":""}`,"aria-label":r?"已复制":"复制消息",title:r?"已复制":"复制",onClick:l,children:r?c.jsx(fT,{}):c.jsx(dT,{})})}function qg(t){const{message:r,streaming:i,activeAssistantId:l}=t,o=r.role==="user",d=o?"你":"π",u=o?"你":"助手",h=!o&&i&&l!==null&&r.id===l,g=h&&r.text.length===0,p=r.text.trim().length>0;return c.jsxs("div",{className:`oc-row ${o?"is-user":"is-assistant"}`,children:[c.jsxs("div",{className:"oc-meta",children:[c.jsx("span",{className:`oc-avatar ${o?"oc-avatar-user":"oc-avatar-assistant"}`,"aria-hidden":"true",children:d}),c.jsx("span",{className:"oc-role",children:u}),c.jsx("span",{className:"oc-time",children:sy(r.createdAt)}),p&&c.jsx(td,{text:r.text})]}),c.jsxs("div",{className:`oc-bubble ${o?"oc-bubble-user":"oc-bubble-assistant"}`,children:[p?o?c.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r.text}):c.jsx(cT,{text:r.text}):g?c.jsx("span",{className:"oc-cursor","aria-hidden":"true"}):null,h&&p&&c.jsx("span",{className:"oc-cursor","aria-hidden":"true"})]})]})}function gT(t){const r=[],i=[];let l,o=[];const d=u=>{for(const h of o)h.assistantMessageId||(h.assistantMessageId=u),h.turnId||(h.turnId=l);o=[]};for(const u of t){const h=Date.parse(u.at)||Date.now();if(u.role==="user"){l=`restored-${u.id}`,o=[],r.push({id:u.id,role:"user",text:u.text,createdAt:h});continue}if(u.role==="assistant"){l||(l=`restored-${u.id}`),r.push({id:u.id,role:"assistant",text:u.text,createdAt:h}),d(u.id);continue}if(u.role==="tool"){l||(l=`restored-tool-${u.id}`);const g={id:u.toolCallId||u.id,toolName:u.toolName||"tool",status:u.isError===!0?"error":"ok",resultText:u.text,result:u.text,createdAt:h,finishedAt:h,turnId:l};i.push(g),o.push(g)}}return{messages:r,toolCalls:i}}function yT(t){const r=t.messages.filter(h=>h.role==="user"||h.role==="assistant"),i=[];let l=null;const o=h=>{const g={key:h,assistants:[],tools:[],live:!1};return i.push(g),g};for(const h of r){if(h.role==="user"){l=o(`user-${h.id}`),l.user=h;continue}l||(l=o(`assistant-${h.id}`)),l.assistants.push(h)}i.length===0&&t.toolCalls.length>0&&i.push({key:"orphan-tools",assistants:[],tools:[],live:!1});const d=new Set,u=new Map;for(const h of i)for(const g of h.assistants)u.set(g.id,h);for(const h of t.toolCalls)if(h.assistantMessageId){const g=u.get(h.assistantMessageId);if(g){g.tools.push(h),d.add(h.id);continue}}for(const h of t.toolCalls)if(!d.has(h.id)&&h.turnId){const g=i.find(v=>v.tools.some(y=>y.turnId===h.turnId)||v.key===`turn-${h.turnId}`||v.user&&`restored-${v.user.id}`===h.turnId);if(g){g.tools.push(h),d.add(h.id);continue}const p=i.find(v=>h.turnId===`restored-${v.user?.id}`||v.assistants.some(y=>h.turnId===`restored-${y.id}`));if(p){p.tools.push(h),d.add(h.id);continue}}for(const h of t.toolCalls){if(d.has(h.id))continue;const g=i.find((p,v)=>{const y=p.user?.createdAt??p.assistants[0]?.createdAt??0,x=i[v+1]?.user?.createdAt??Number.POSITIVE_INFINITY;return h.createdAt>=y&&h.createdAt<x});g?(g.tools.push(h),d.add(h.id)):i.length>0&&(i[i.length-1].tools.push(h),d.add(h.id))}for(const h of i)h.tools.sort((g,p)=>g.createdAt-p.createdAt),h.live=t.streaming&&t.activeAssistantId!==null&&h.assistants.some(g=>g.id===t.activeAssistantId);return i}function vT(t){const r=t.length,i=t.filter(d=>d.status==="error").length,l=t.filter(d=>d.status==="running").length,o=[`执行过程 · ${r} 工具`];return i>0?o.push(`${i} 出错`):l>0&&o.push("运行中"),{count:r,errorCount:i,runningCount:l,label:o.join(" · ")}}function Iv(t){const{entry:r}=t,[i,l]=k.useState(r.status==="error"),[o,d]=k.useState(!1),u=r.status==="running"?"运行中":r.status==="error"?"出错":"完成",h=`is-${r.status}`,g=B1(r.args,{toolName:r.toolName}),p=G1(r.createdAt,r.finishedAt),v=H1(r.toolName),y=ly(r.resultText??r.result),S=q1(y,o?{maxLen:Number.MAX_SAFE_INTEGER}:void 0);return c.jsxs("div",{className:`oc-tool ${r.status==="error"?"is-error":""} ${r.status==="running"?"is-running":""}`,children:[c.jsxs("button",{type:"button",className:"oc-tool-head","aria-expanded":i,onClick:()=>l(x=>!x),children:[c.jsx(Av,{}),c.jsx("span",{className:"oc-tool-icon","aria-hidden":"true",children:c.jsx(pT,{})}),c.jsx("span",{className:"oc-tool-name",children:r.toolName}),g&&c.jsx("span",{className:"oc-tool-args",children:g}),p!==void 0&&c.jsxs("span",{className:"oc-tool-duration",children:[p,"s"]}),c.jsx("span",{className:`oc-tool-status ${h}`,children:u})]}),i&&c.jsxs("div",{className:"oc-tool-body",children:[r.args!==void 0&&c.jsxs("div",{className:"oc-tool-section",children:[c.jsx("div",{className:"oc-tool-label",children:v.argsLabel}),c.jsx("pre",{className:"oc-tool-code",children:U1(r.args)})]}),(r.resultText!==void 0||r.result!==void 0)&&c.jsxs("div",{className:"oc-tool-section",children:[c.jsx("div",{className:"oc-tool-label",children:r.status==="error"?"错误":v.resultLabel}),c.jsx("pre",{className:"oc-tool-code",children:S.text}),S.truncated&&!o&&c.jsx("button",{type:"button",className:"btn btn-ghost oc-tool-expand-result",onClick:()=>d(!0),children:"展开全部"})]}),r.status==="running"&&r.resultText===void 0&&r.result===void 0&&r.args===void 0&&c.jsx("div",{className:"oc-tool-section",children:c.jsx("div",{className:"oc-tool-waiting",children:"等待结果…"})})]})]})}function bT(t){const{tools:r,defaultOpen:i}=t,[l,o]=k.useState(i),d=vT(r);return k.useEffect(()=>{i&&o(!0)},[i]),c.jsxs("div",{className:"oc-process-inline",children:[c.jsxs("button",{type:"button",className:`oc-process-inline-summary${l?" is-open":""}${d.errorCount>0?" is-error":d.runningCount>0?" is-running":""}`,"aria-expanded":l,onClick:()=>o(u=>!u),children:[c.jsx(Av,{}),c.jsx("span",{children:d.label})]}),l?c.jsx("div",{className:"oc-process-inline-body",children:r.map(u=>c.jsx(Iv,{entry:u},u.id))}):null]})}function xT(t){const{scrollContainerRef:r,messagesEndRef:i,onScroll:l,hasThread:o,readiness:d,streaming:u,streamingAssistantId:h,messagesCount:g,visibleCount:p,onLoadMore:v,turnGroups:y,interview:S,humanGateCards:x,operationCards:w,artifactCards:A,origin:M,sessionId:O}=t;return c.jsxs("div",{ref:r,className:`oc-messages${o?" has-thread":" is-empty"}`,onScroll:l,children:[o?null:c.jsx(vy,{mode:"empty-session",readiness:d,disabled:u,onSuggest:t.onSuggest}),o&&g>p&&c.jsx("button",{type:"button",className:"btn btn-ghost oc-load-history",onClick:v,children:"加载更早消息"}),o&&y.map((E,D)=>{const G=E.user??E.assistants[0],K=D>0?y[D-1].user??y[D-1].assistants[0]:void 0,N=!!G&&(!K||Sc(K.createdAt)!==Sc(G.createdAt)),$=E.assistants[E.assistants.length-1];return c.jsxs("div",{className:"oc-turn-group",children:[N&&G&&c.jsx("div",{className:"oc-day-sep",children:Sc(G.createdAt)}),E.user&&c.jsx(qg,{message:E.user,streaming:u,activeAssistantId:h}),E.tools.length>0&&c.jsx(bT,{tools:E.tools,defaultOpen:E.live}),$&&c.jsx(qg,{message:$,streaming:u,activeAssistantId:h})]},E.key)}),S&&c.jsx(MS,{interview:S,interviewAnswer:t.interviewAnswer,onAnswerChange:t.onInterviewAnswerChange,onAnswer:t.onAnswerInterview,onConfirmTaskKind:t.onConfirmTaskKind}),x.map(E=>c.jsx(TS,{card:E,origin:M,sessionId:O},E.cardId)),w.map(E=>c.jsx(OS,{operation:E,origin:M,onNavigateWorkspace:t.onNavigateWorkspace},E.operationId)),A.map(E=>c.jsx(RS,{artifact:E},E.artifactId)),c.jsx("div",{ref:i})]})}function On(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:t.toLocaleString()}function ST(t){const r=[],i=t.inputTokens??0,l=t.outputTokens??0,o=t.cacheReadTokens??0,d=t.cacheWriteTokens??0,u=t.cost??0;if(i>0&&r.push(`${On(i)} in`),l>0&&r.push(`${On(l)} out`),o>0&&r.push(`${On(o)} cache R`),d>0&&r.push(`${On(d)} cache W`),u>0&&r.push(u>=.01?`$${u.toFixed(2)}`:"<$0.01"),r.length===0){const h=t.totalTokens??0;return h>0?`${On(h)} tokens`:"—"}return r.join(" · ")}const kT={auto:"auto(跟随 Pi 默认等级)",off:"off · 关闭",minimal:"minimal · 极简",low:"low · 低",medium:"medium · 中",high:"high · 高",xhigh:"xhigh · 极高",max:"max · 最高"};function wT(t,r){const i=r.trim().toLowerCase(),l=new Map;for(const o of t){if(i&&!o.provider.toLowerCase().includes(i)&&!o.id.toLowerCase().includes(i)&&!(o.name??"").toLowerCase().includes(i))continue;const d=l.get(o.provider)??[];d.push(o),l.set(o.provider,d)}return[...l.entries()].map(([o,d])=>({provider:o,models:d}))}function CT(t,r){const i=new Set,l=[],o=d=>{i.has(d)||(i.add(d),l.push({value:d,label:kT[d]??d,...d==="auto"&&r?{effective:r}:{}}))};o("auto");for(const d of t)o(d);return l}function Hs(t,r){return`${t}/${r}`}function nd(t){return{...t.modelProvider&&t.modelId?{model:{provider:t.modelProvider,modelId:t.modelId}}:{},...t.thinkingLevel?{thinkingLevel:t.thinkingLevel}:{}}}function Dv(t,r){return{...t,model:r.model??t.model,thinkingLevel:r.thinkingLevel??t.thinkingLevel}}function jT(t,r){const i=Dv(t,r);return i.model?.provider===t.model?.provider&&i.model?.modelId===t.model?.modelId&&i.thinkingLevel===t.thinkingLevel}function RT(){return c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:c.jsx("path",{d:"M2.6 4.2 6 7.6l3.4-3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function TT(t){const r=Ji(),[i,l]=k.useState(!1),[o,d]=k.useState(""),[u,h]=k.useState(0),g=k.useRef(null),p=k.useRef(null),v=r.snapshot,y=r.status==="loading",S=r.status==="error"?r.error:null,x=v?(v.models??[]).map(E=>({provider:E.provider,id:E.id,...E.name?{name:E.name}:{},...E.hasCredentials!==void 0?{hasCredentials:E.hasCredentials}:{}})):t.models,w=k.useMemo(()=>wT(x,o),[x,o]),A=k.useMemo(()=>w.flatMap(E=>E.models),[w]);k.useEffect(()=>{i&&(d(""),h(0),window.setTimeout(()=>p.current?.focus(),0))},[i]),k.useEffect(()=>{if(!i)return;const E=G=>{const K=g.current;K&&G.target instanceof Node&&!K.contains(G.target)&&l(!1)},D=G=>{G.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",D)}},[i]);const M=E=>{if(t.disabled)return;const D=A[E];D&&(l(!1),t.onSelect(D.provider,D.id))},O=E=>{if(E.key==="ArrowDown"){E.preventDefault(),h(D=>A.length?(D+1)%A.length:0);return}if(E.key==="ArrowUp"){E.preventDefault(),h(D=>A.length?(D-1+A.length)%A.length:0);return}if(E.key==="Enter"){E.preventDefault(),M(u);return}if(E.key==="Escape"){E.preventDefault(),l(!1);return}};return c.jsxs("div",{className:"oc-select-menu oc-model-menu",ref:g,children:[c.jsxs("button",{type:"button",className:"oc-select-trigger","aria-haspopup":"listbox","aria-expanded":i,title:"选择模型",disabled:t.disabled,onClick:()=>l(E=>!E),children:[c.jsx("span",{className:"oc-select-trigger-label",children:t.triggerLabel}),c.jsx(RT,{})]}),i&&c.jsxs("div",{className:"oc-select-panel oc-model-panel",role:"listbox","aria-label":"选择模型",children:[c.jsx("input",{ref:p,className:"oc-select-search",placeholder:"搜索模型或 Provider…",value:o,onChange:E=>{d(E.target.value),h(0)},onKeyDown:O}),y&&c.jsx("div",{className:"oc-select-status",children:"模型列表加载中…"}),S&&c.jsxs("div",{className:"oc-select-status is-error",children:[c.jsxs("span",{children:[S.code?`${S.code}:`:"",S.message]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Qi()},children:"重试"})]}),!y&&!S&&w.length===0&&c.jsx("div",{className:"oc-select-status",children:"当前没有可用模型(真实空态,未伪造列表)"}),w.map(E=>c.jsxs("div",{className:"oc-model-group",children:[c.jsx("div",{className:"oc-model-group-head",children:E.provider}),E.models.map(D=>{const G=Hs(D.provider,D.id),K=G===t.activeModelRef,N=A[u]===D;return c.jsxs("button",{type:"button",role:"option","aria-selected":K,disabled:t.disabled,className:`oc-select-option oc-model-option${N?" is-highlighted":""}${K?" is-active":""}`,onMouseDown:$=>$.preventDefault(),onClick:()=>{t.disabled||(l(!1),t.onSelect(D.provider,D.id))},children:[c.jsxs("span",{className:"oc-model-option-name",children:[D.name?`${D.name} · `:"",D.id]}),K&&c.jsx("span",{className:"oc-model-option-check",children:"✓"})]},G)})]},E.provider))]})]})}function ET(){return c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:c.jsx("path",{d:"M2.6 4.2 6 7.6l3.4-3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function NT(t){const r=Ji(),[i,l]=k.useState(!1),[o,d]=k.useState(0),u=k.useRef(null),h=t.effectiveLevel??r.snapshot?.selection?.effectiveThinkingLevel,g=r.snapshot?.thinkingLevels?.length?r.snapshot.thinkingLevels.map(S=>S.value):void 0,p=k.useMemo(()=>CT(g??t.levels,h),[g,t.levels,h]);k.useEffect(()=>{i&&d(0)},[i]),k.useEffect(()=>{if(!i)return;const S=w=>{const A=u.current;A&&w.target instanceof Node&&!A.contains(w.target)&&l(!1)},x=w=>{w.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",S),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",x)}},[i]);const v=S=>{if(t.disabled)return;const x=p[S];x&&(l(!1),t.onSelect(x.value))},y=S=>{if(S.key==="ArrowDown"){S.preventDefault(),d(x=>p.length?(x+1)%p.length:0);return}if(S.key==="ArrowUp"){S.preventDefault(),d(x=>p.length?(x-1+p.length)%p.length:0);return}if(S.key==="Enter"){S.preventDefault(),v(o);return}if(S.key==="Escape"){S.preventDefault(),l(!1);return}};return c.jsxs("div",{className:"oc-select-menu oc-thinking-menu",ref:u,children:[c.jsxs("button",{type:"button",className:"oc-select-trigger","aria-haspopup":"listbox","aria-expanded":i,title:"思考等级",disabled:t.disabled,onClick:()=>l(S=>!S),children:[c.jsx("span",{className:"oc-select-trigger-label",children:t.triggerLabel}),c.jsx(ET,{})]}),i&&c.jsx("div",{className:"oc-select-panel oc-thinking-panel",role:"listbox","aria-label":"思考等级",onKeyDown:y,children:p.map((S,x)=>{const w=S.value===t.activeValue,A=x===o;return c.jsxs("button",{type:"button",role:"option","aria-selected":w,disabled:t.disabled,className:`oc-select-option oc-thinking-option${A?" is-highlighted":""}${w?" is-active":""}`,onMouseDown:M=>M.preventDefault(),onClick:()=>{t.disabled||(l(!1),t.onSelect(S.value))},children:[c.jsx("span",{className:"oc-thinking-option-label",children:S.label}),S.value==="auto"&&S.effective?c.jsxs("span",{className:"oc-thinking-badge",children:["Pi 实际:",S.effective]}):null,w&&c.jsx("span",{className:"oc-model-option-check",children:"✓"})]},S.value)})})]})}function AT(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),c.jsx("circle",{cx:"8.5",cy:"10",r:"1.5"}),c.jsx("path",{d:"m21 16-5.5-5.5L9 17"})]})}function IT(t){const{composer:r,streaming:i,hasThread:l}=t,o=Ji(),d=o.reloading,u=o.reloadError,g=o.mutationBusy||d||i,p=k.useCallback(()=>{r.setInput(""),r.setShortcutOpen(!1),Xi()},[r.setInput,r.setShortcutOpen]),v=k.useCallback(M=>{const O=r.isComposingNow()||M.nativeEvent.isComposing,E=r.recentlyComposedNow();if(M.key==="Enter"&&!M.shiftKey&&!O&&!E){if(r.shortcutOpen&&r.filteredShortcuts.length>0){if((r.filteredShortcuts[r.shortcutIndex]??r.filteredShortcuts[0])?.command==="/reload"){M.preventDefault(),p();return}}else if(r.input.trim()==="/reload"){M.preventDefault(),p();return}}t.onKeyDown(M)},[r.isComposingNow,r.recentlyComposedNow,r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,r.input,p,t.onKeyDown]),y=k.useCallback((M,O)=>{if(O==="pi-prompt"||M==="/name"||M==="/compact"){r.setInput(`${M} `),r.setShortcutOpen(!1),r.textareaRef.current?.focus();return}if(M==="/reload"){p();return}t.onRunShortcut(M)},[p,t.onRunShortcut,r]),S=k.useCallback(()=>{if(r.input.trim()==="/reload"){p();return}t.onSend(r.input)},[r.input,p,t.onSend]);k.useEffect(()=>{if(!r.shortcutOpen||r.filteredShortcuts.length===0||!t.paletteKeyboardNavRef.current)return;const M=t.shortcutPaletteRef.current;if(!M)return;M.querySelector(`[data-shortcut-index="${r.shortcutIndex}"]`)?.scrollIntoView({block:"nearest",inline:"nearest"}),t.paletteKeyboardNavRef.current=!1},[r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,t.shortcutPaletteRef,t.paletteKeyboardNavRef]);const x=(()=>{const M=t.processSummary;return M?M.statusKind==="error"?`查看工具调用记录,共 ${M.count} 次,其中 ${M.statusLabel}`:M.statusKind==="running"?`查看工具调用记录,共 ${M.count} 次,${M.statusLabel||"正在运行"}`:`查看工具调用记录,共 ${M.count} 次,全部已完成`:"查看工具调用记录"})(),w=(()=>{const M=t.usage.inputTokens,O=t.usage.outputTokens,E=t.usage.cacheReadTokens,D=t.usage.cacheWriteTokens,G=t.usage.cost??0,K=[];if(M>0&&K.push(c.jsxs("span",{className:"oc-usage-part is-in",title:"输入 tokens",children:["↑ ",On(M)]},"in")),O>0&&K.push(c.jsxs("span",{className:"oc-usage-part is-out",title:"输出 tokens",children:["↓ ",On(O)]},"out")),E>0&&K.push(c.jsxs("span",{className:"oc-usage-part",children:[On(E)," cache R"]},"cache-read")),D>0&&K.push(c.jsxs("span",{className:"oc-usage-part",children:[On(D)," cache W"]},"cache-write")),G>0&&K.push(c.jsx("span",{className:"oc-usage-part",children:G>=.01?`$${G.toFixed(2)}`:"<$0.01"},"cost")),K.length===0){const N=t.usage.totalTokens;N>0&&K.push(c.jsxs("span",{className:"oc-usage-part",children:[On(N)," tokens"]},"total"))}return K})(),A=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"oc-runtime-controls-group",children:[c.jsx(TT,{models:t.models,activeModelRef:t.activeModelRef,triggerLabel:t.activeModelRef||"选择模型",disabled:g,onSelect:(M,O)=>t.onSwitchRuntime({provider:M,modelId:O})}),c.jsx(NT,{levels:t.thinkingLevels,activeValue:t.activeThinkingLevel||"auto",triggerLabel:t.activeThinkingLevel||"auto",disabled:g,onSelect:M=>t.onSwitchRuntime({thinkingLevel:M})}),c.jsxs("span",{className:"oc-usage",title:ST(t.usage),children:[c.jsx("span",{className:"oc-usage-state",children:i?"运行中":"空闲"}),t.unread>0?c.jsxs("span",{className:"oc-usage-unread",children:[t.unread," 未读"]}):null,w]}),t.processSummary&&c.jsxs("button",{type:"button",ref:t.processTriggerRef,className:`oc-process-summary is-${t.processSummary.statusKind}${t.processOpen?" is-open":""}`,"aria-expanded":t.processOpen,"aria-controls":"oc-process-panel","aria-label":x,title:x,onClick:t.onToggleProcess,children:[c.jsx("span",{className:"oc-process-summary-label",children:"调用记录"}),c.jsx("span",{className:"oc-process-summary-badge",children:t.processSummary.count}),t.processSummary.statusKind!=="ok"&&t.processSummary.statusLabel?c.jsx("span",{className:"oc-process-summary-status",children:t.processSummary.statusLabel}):null]})]}),c.jsxs("div",{className:"oc-runtime-controls-group is-right",children:[c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t.onCompact,disabled:i||!l,title:l?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文","aria-label":l?i?"生成中,暂不可压缩":"压缩上下文,释放 token":"先进行对话后再压缩上下文",children:"压缩"}),t.runtimeContext?c.jsx("button",{type:"button",ref:t.runtimeContextTriggerRef,className:`btn btn-ghost oc-runtime-context-toggle${t.runtimeContextOpen?" is-active":""}`,"aria-expanded":t.runtimeContextOpen,"aria-controls":"oc-runtime-context-panel",onClick:t.onToggleRuntimeContext,children:"注入上下文"}):null]})]});return c.jsx("div",{className:"oc-composer",children:c.jsxs("div",{className:"oc-composer-inner",children:[r.fileOptions.length>0&&c.jsx("div",{className:"oc-file-palette",role:"listbox","aria-label":"Repository files",children:r.fileOptions.map(M=>c.jsx("button",{type:"button",role:"option",onMouseDown:O=>O.preventDefault(),onClick:()=>r.insertFileReference(M),children:c.jsxs("code",{children:["@",M]})},M))}),r.pendingImages.length>0&&c.jsx("div",{className:"oc-attachment-list",children:r.pendingImages.map(M=>c.jsxs("span",{children:[M.name,c.jsx("button",{type:"button","aria-label":`移除 ${M.name}`,onClick:()=>r.removeImage(M),children:"×"})]},M.name))}),c.jsxs("div",{className:"oc-composer-toolbar",children:[c.jsxs("label",{className:"oc-attach-button oc-attach-icon",title:"添加图片","aria-label":"添加图片",children:[c.jsx(AT,{}),c.jsx("span",{className:"sr-only",children:"添加图片"}),c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:M=>{r.addImagesFromFiles(Array.from(M.target.files??[]).slice(0,4)),M.target.value=""}})]}),c.jsxs("span",{className:"oc-composer-hint",children:[c.jsx("span",{className:"oc-kbd",children:"Enter"})," 发送"]}),c.jsxs("span",{className:"oc-composer-hint",children:[c.jsx("span",{className:"oc-kbd",children:"Shift"}),"+",c.jsx("span",{className:"oc-kbd",children:"Enter"})," 换行"]}),d&&c.jsx("span",{className:"oc-reload-status",children:"正在重新加载会话…"})]}),r.shortcutOpen&&r.filteredShortcuts.length>0&&c.jsxs("div",{className:"oc-shortcut-palette",id:"oc-shortcut-palette",ref:t.shortcutPaletteRef,role:"listbox","aria-label":"命令","aria-busy":r.dynamicCommandsLoading||void 0,"data-layout-mode":t.layoutMode,children:[c.jsxs("div",{className:"oc-shortcut-palette-head",children:[c.jsxs("strong",{children:["命令 · ",r.filteredShortcuts.length]}),r.dynamicCommandsLoading?c.jsx("span",{className:"oc-shortcut-palette-meta",children:"正在加载扩展、提示词与技能…"}):null,r.dynamicCommandsError?c.jsxs("span",{className:"oc-shortcut-palette-meta is-error",children:[r.dynamicCommandsError,c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>r.retryDynamicCommands(),children:"重试"})]}):null]}),c.jsx("div",{className:"oc-shortcut-palette-body",children:t.paletteModel.map(M=>c.jsxs("div",{className:"oc-shortcut-group",children:[c.jsxs("small",{children:[M.label," · ",M.items.length]}),M.items.map(({entry:O,globalIndex:E})=>c.jsxs("button",{type:"button",role:"option",id:`oc-shortcut-option-${E}`,"aria-label":O.command,"aria-describedby":`oc-shortcut-option-desc-${E}`,"aria-selected":E===r.shortcutIndex,className:E===r.shortcutIndex?"is-active":"","data-shortcut-index":E,title:O.command,onMouseEnter:()=>r.setShortcutIndex(E),onMouseDown:D=>D.preventDefault(),onClick:D=>{D.currentTarget.scrollIntoView({block:"nearest"}),y(O.command,O.action)},children:[c.jsx("code",{children:O.command}),c.jsx("small",{id:`oc-shortcut-option-desc-${E}`,children:O.description})]},`${O.source}:${O.command}`))]},M.source))})]}),c.jsxs("div",{className:`oc-composer-shell${i?" is-busy":""}`,children:[c.jsx("textarea",{ref:r.textareaRef,className:"oc-textarea",value:r.input,rows:3,placeholder:i?"正在生成回复…(停止后可发送下一轮)":l?"输入消息… Enter 发送 · Shift+Enter 换行":"描述目标,或点选上方建议开始…",onChange:M=>r.handleInputChange(M.target.value),onKeyDown:v,onCompositionStart:r.onCompositionStart,onCompositionEnd:r.onCompositionEnd,disabled:i,"aria-expanded":r.shortcutOpen,"aria-controls":r.shortcutOpen?"oc-shortcut-palette":void 0,"aria-activedescendant":r.shortcutOpen&&r.filteredShortcuts.length>0?`oc-shortcut-option-${r.shortcutIndex}`:void 0}),i?c.jsx("button",{type:"button",className:"oc-stop",title:"停止生成","aria-label":"停止生成",onClick:t.onStop,children:c.jsx(mT,{})}):c.jsx("button",{type:"button",className:"oc-send",title:"发送","aria-label":"发送",onClick:S,disabled:!r.input.trim()&&r.pendingImages.length===0||d,children:c.jsx(hT,{})})]}),u&&c.jsxs("div",{className:"oc-reload-banner is-error",role:"alert",children:[c.jsxs("span",{children:[u.code?`${u.code}:`:"",u.message]}),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Xi()},children:"重试"})]}),c.jsx("div",{className:"oc-runtime-controls",children:A})]})})}function DT(t){const{toolCalls:r,onClose:i,overlay:l=!1}=t,o=k.useRef(null);return ud({open:l,containerRef:o,triggerRef:t.triggerRef,onEscape:i}),c.jsxs("aside",{ref:o,id:"oc-process-panel",className:`oc-process${l?" is-process-overlay":""}`,"aria-label":"工具调用记录",role:l?"dialog":void 0,"aria-modal":l?!0:void 0,tabIndex:-1,children:[c.jsxs("header",{className:"oc-process-head",children:[c.jsxs("div",{className:"oc-process-title",children:[c.jsx("span",{className:"oc-process-title-mark","aria-hidden":"true"}),"工具调用记录",c.jsxs("span",{className:"oc-process-count",children:[r.length," 次"]})]}),c.jsx("button",{type:"button",className:"btn btn-ghost oc-process-close","aria-label":"关闭工具调用记录",onClick:i,children:"关闭"})]}),c.jsx("div",{className:"oc-process-timeline",children:r.length===0?c.jsx("div",{className:"oc-process-empty",children:"本轮对话尚无工具调用。诊断细节会在这里按时间线展示。"}):r.map((d,u)=>c.jsxs("div",{className:`oc-process-item${u===0?" is-first":""}${u===r.length-1?" is-last":""}${d.status==="error"?" is-error":""}${d.status==="running"?" is-running":""}`,children:[c.jsx("div",{className:"oc-process-rail","aria-hidden":"true",children:c.jsx("span",{className:"oc-process-dot"})}),c.jsx("div",{className:"oc-process-time",children:sy(d.createdAt)}),c.jsx("div",{className:"oc-process-body",children:c.jsx(Iv,{entry:d})})]},d.id))})]})}const Gg=[{id:"overview",label:"概览"},{id:"system",label:"System prompt"},{id:"files",label:"Context files"},{id:"skills",label:"Skills"},{id:"extensions",label:"Extensions"},{id:"packages",label:"Packages"},{id:"tools",label:"Active tools"},{id:"raw",label:"原始 JSON"}];function Es(t){const r=Array.isArray(t.items)?t.items:void 0;return c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsx("strong",{children:t.title}),c.jsx("span",{className:"oc-runtime-context-meta",children:r?`${r.length} 项`:"未投影"})]}),r===void 0?c.jsx("p",{className:"oc-runtime-context-empty",children:"该 session 未提供资源投影"}):r.length===0?c.jsx("p",{className:"oc-runtime-context-empty",children:t.emptyText}):c.jsx("ul",{className:"oc-runtime-context-resources",children:r.map((i,l)=>c.jsx(OT,{item:i},`${i.name??i.path??l}:${l}`))})]})}function OT(t){const r=t.item,l=[r.scope?`scope ${r.scope}`:"",r.source??"",r.version?`v${r.version}`:"",r.cwd?`cwd ${r.cwd}`:""].filter(Boolean).join(" · "),o=r.path?`${r.path}${r.baseDir?`(base: ${r.baseDir})`:""}`:"";return c.jsxs("li",{children:[c.jsxs("div",{className:"oc-runtime-context-resource-head",children:[c.jsx("strong",{className:"oc-runtime-context-resource-name",title:r.path??r.name,children:r.name||r.path||"未命名资源"}),r.enabled===!1?c.jsx("span",{className:"oc-runtime-context-resource-flag",children:"未启用"}):null,l?c.jsx("span",{className:"oc-runtime-context-meta",title:l,children:l}):null]}),r.description?c.jsx("span",{className:"oc-runtime-context-resource-desc",children:r.description}):null,r.path?c.jsx("code",{className:"oc-runtime-context-resource-path",title:o,children:o}):null,r.error?c.jsxs("span",{className:"oc-runtime-context-diag is-error",children:[c.jsx("span",{className:"oc-runtime-context-diag-icon","aria-hidden":"true",children:"✕"}),r.error]}):null,Array.isArray(r.diagnostics)&&r.diagnostics.length>0?c.jsxs("span",{className:"oc-runtime-context-diag",children:[c.jsx("span",{className:"oc-runtime-context-diag-icon","aria-hidden":"true",children:"⚠"}),r.diagnostics.join(";")]}):null,Array.isArray(r.resolved)&&r.resolved.length>0?c.jsxs("details",{className:"oc-runtime-context-resolved",children:[c.jsxs("summary",{children:["已解析 ",r.resolved.length," 项"]}),c.jsx("ul",{className:"oc-runtime-context-resolved-list",children:r.resolved.map((d,u)=>{const h=`${d.type??"?"}:${d.name??d.path??"?"}`;return c.jsx("li",{children:c.jsx("code",{title:h,children:h})},u)})})]}):null]})}const MT=k.forwardRef(function({open:r,onToggle:i,onClose:l,context:o,panelOnly:d=!1,triggerOnly:u=!1,triggerRef:h},g){const p=Ji(),v=p.reloading,y=p.reloadError,[S,x]=k.useState("overview"),w=k.useRef(null);ud({open:r&&!u,containerRef:w,triggerRef:h,onEscape:l}),k.useEffect(()=>{r||x("overview")},[r]);const A=Array.isArray(o.resources.activeTools)?o.resources.activeTools:[],M=typeof o.resources.activeToolCount=="number"?o.resources.activeToolCount:A.length,O=o.systemPrompt.text??o.systemPrompt.summary??"",E=o.systemPrompt.charCount??O.length,D=o.suffix.present?o.suffix.text??o.suffix.summary??"":"",G=o.model?Hs(o.model.provider,o.model.modelId):"",K=o.resources,N=String(o.resources.mode??"closed"),$=N.includes("open")?"open":"closed",ne={files:K.contextFiles?.length??0,skills:K.skills?.length??0,extensions:K.extensions?.length??0,packages:K.packages?.length??0},ce=["files","skills","extensions","packages"].map(Y=>({id:Y,label:Gg.find(oe=>oe.id===Y)?.label??Y,count:ne[Y]??0})),_=c.jsx("button",{type:"button",ref:Y=>{typeof g=="function"?g(Y):g&&(g.current=Y)},className:`btn btn-ghost oc-runtime-context-toggle${r?" is-active":""}`,"aria-expanded":r,"aria-controls":"oc-runtime-context-panel",onClick:i,children:"注入上下文"});if(u)return _;const F=r?c.jsxs("div",{ref:w,id:"oc-runtime-context-panel",className:"oc-runtime-context-sidepanel",role:"dialog","aria-modal":"true","aria-label":"注入上下文",tabIndex:-1,children:[c.jsxs("header",{className:"oc-runtime-context-head",children:[c.jsxs("div",{className:"oc-runtime-context-head-copy",children:[c.jsx("strong",{children:"注入上下文"}),c.jsx("span",{className:"oc-runtime-context-meta",children:"只读 · 本轮实际注入的 system prompt / 资源(已脱敏)"})]}),c.jsx("button",{type:"button",className:"btn btn-ghost oc-runtime-context-close","aria-label":"关闭注入上下文",onClick:l,children:"关闭"})]}),c.jsxs("div",{className:"oc-runtime-context-layout",children:[c.jsx("nav",{className:"oc-runtime-context-nav","aria-label":"上下文分类",children:Gg.map(Y=>{const oe=ne[Y.id];return c.jsxs("button",{type:"button",className:`oc-runtime-context-nav-item${S===Y.id?" is-active":""}`,"aria-current":S===Y.id?"page":void 0,onClick:()=>x(Y.id),children:[c.jsx("span",{className:"oc-runtime-context-nav-label",title:Y.label,children:Y.label}),typeof oe=="number"?c.jsx("span",{className:"oc-runtime-context-nav-count",children:oe}):null]},Y.id)})}),c.jsxs("div",{className:"oc-runtime-context-body",children:[S==="overview"?c.jsxs("div",{className:"oc-runtime-context-overview",children:[o.model?c.jsxs("section",{className:"oc-runtime-context-model-card",children:[c.jsx("span",{className:"oc-runtime-context-model-label",children:"模型"}),c.jsx("code",{className:"oc-runtime-context-model-ref",title:G,children:G})]}):null,c.jsxs("div",{className:"oc-runtime-context-stat-grid",children:[c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"Prompt 字数"}),c.jsxs("strong",{className:"oc-runtime-context-stat-value",children:[E.toLocaleString()," 字"]})]}),c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"工具"}),c.jsx("strong",{className:"oc-runtime-context-stat-value",children:M})]}),c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"思考"}),c.jsx("strong",{className:"oc-runtime-context-stat-value",children:o.thinkingLevel??"—"})]}),c.jsxs("div",{className:"oc-runtime-context-stat",children:[c.jsx("span",{className:"oc-runtime-context-stat-label",children:"资源面"}),c.jsxs("strong",{className:`oc-runtime-context-stat-value oc-runtime-context-mode is-${$}`,title:N,children:[c.jsx("span",{className:"oc-runtime-context-mode-dot","aria-hidden":"true"}),N]})]})]}),c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsx("header",{className:"oc-runtime-context-section-head",children:c.jsx("strong",{children:"已加载资源"})}),c.jsx("div",{className:"oc-runtime-context-resource-links",children:ce.map(Y=>c.jsxs("button",{type:"button",className:"oc-runtime-context-resource-link",onClick:()=>x(Y.id),children:[c.jsx("span",{className:"oc-runtime-context-resource-label",children:Y.label}),c.jsx("span",{className:`oc-runtime-context-resource-count${Y.count===0?" is-zero":""}`,children:Y.count}),c.jsx("span",{className:"oc-runtime-context-resource-chevron","aria-hidden":"true",children:"›"})]},Y.id))})]})]}):null,S==="system"?c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsxs("div",{children:[c.jsx("strong",{children:"System prompt"}),c.jsxs("code",{className:"oc-runtime-context-hash",children:[o.systemPrompt.hash.slice(0,12),"…"]})]}),O?c.jsx(td,{text:O}):null]}),c.jsx("pre",{className:"oc-runtime-context-text",children:O||"(空)"})]}),c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsxs("div",{className:"oc-runtime-context-section-title",children:[c.jsx("strong",{children:"Session suffix"}),c.jsx("span",{className:"oc-runtime-context-meta",children:o.suffix.present?`${(o.suffix.charCount??0).toLocaleString()} 字`:"未注入"})]}),D?c.jsx(td,{text:D}):null]}),o.suffix.present?c.jsx("pre",{className:"oc-runtime-context-text",children:D||"已注入"}):c.jsx("p",{className:"oc-runtime-context-empty",children:"本会话无额外 suffix"})]})]}):null,S==="files"?c.jsx(Es,{title:"Context files",items:K.contextFiles?.map(Y=>({name:Y.path,description:`${Y.characters.toLocaleString()} 字符`})),emptyText:"该 session 未加载任何上下文文件"}):null,S==="skills"?c.jsx(Es,{title:"Skills",items:K.skills,emptyText:"该 session 未加载任何 Skills"}):null,S==="extensions"?c.jsx(Es,{title:"Extensions",items:K.extensions,emptyText:"该 session 未加载任何 Extensions"}):null,S==="packages"?c.jsx(Es,{title:"Packages",items:K.packages,emptyText:"该 session 未配置 Packages"}):null,S==="tools"?c.jsxs("section",{className:"oc-runtime-context-section",children:[c.jsxs("header",{className:"oc-runtime-context-section-head",children:[c.jsx("strong",{children:"Active tools"}),c.jsxs("span",{className:"oc-runtime-context-meta",children:[M," 项"]})]}),A.length===0?c.jsx("p",{className:"oc-runtime-context-empty",children:"无激活工具"}):c.jsx("ul",{className:"oc-runtime-context-tools",children:A.map(Y=>c.jsx("li",{children:c.jsx("code",{children:Y})},Y))}),Array.isArray(K.diagnostics)&&K.diagnostics.length>0?c.jsx("ul",{className:"oc-runtime-context-resources",children:K.diagnostics.map((Y,oe)=>c.jsxs("li",{children:[c.jsxs("span",{className:`oc-runtime-context-diag is-${Y.type??"warning"}`,children:[Y.type,": ",Y.message]}),Y.path?c.jsx("code",{children:Y.path}):null]},oe))}):null]}):null,S==="raw"?c.jsxs("details",{className:"oc-runtime-context-raw",open:!0,children:[c.jsx("summary",{children:"原始投影 JSON"}),c.jsx("pre",{children:JSON.stringify(o,null,2)})]}):null]},S)]}),c.jsxs("footer",{className:"oc-runtime-context-foot",children:[c.jsx("span",{className:"oc-runtime-context-meta",children:v?"正在重新加载会话…":"重新加载 Pi 会话设置、扩展、技能、提示词与上下文文件"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:v,onClick:()=>{Xi()},children:"重新加载会话"}),y&&c.jsxs("span",{className:"oc-runtime-context-diag is-error",role:"alert",children:[y.code?`${y.code}:`:"",y.message,c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Xi()},children:"重试"})]})]})]}):null;return d?F:c.jsxs("div",{className:"oc-runtime-context-menu",children:[_,F]})});function zT(){const t=k.useRef(null),r=k.useRef(!1),i=k.useRef(null),l=k.useRef(new Map),o=k.useRef(new Set),d=k.useRef(null),u=k.useRef(null),h=k.useRef(0),g=k.useRef(null),p=k.useRef(new Set),v=k.useRef(new Set),y=k.useRef(new Map),S=k.useRef(null),x=k.useRef(null),w=k.useRef(!1),A=k.useRef(0),M=k.useRef(null),O=k.useRef(!1),E=k.useRef(!1),D=k.useRef(null),G=k.useRef(new Set),K=k.useRef(new Set),N=k.useRef(new Set),$=k.useRef(!1),ne=k.useRef(0);return k.useMemo(()=>({sessionRef:t,streamingRef:r,abortRef:i,sessionAbortControllersRef:l,inlineStreamSessionIdsRef:o,assistantIdRef:d,lastEventIdRef:u,sessionGenerationRef:h,eventsStreamStateRef:g,settledTurnIdsRef:p,seenEventIdsRef:v,turnAssistantIdsRef:y,reconnectAbortRef:S,activeTurnIdRef:x,submitInFlightRef:w,submitGenerationRef:A,pendingSubmissionRef:M,stopInFlightRef:O,stopRequestedRef:E,stoppingTurnIdRef:D,abortPostedTurnIdsRef:G,releasedClientRequestIdsRef:K,usageResponseKeysRef:N,isComposingRef:$,compositionEndedAtRef:ne}),[t,r,i,l,o,d,u,h,g,p,v,y,S,x,w,A,M,O,E,D,G,K,N,$,ne])}const _T=["operation","contract","dag","report","html"];function LT(t){const r=t.artifact;if(!r||typeof r!="object")return;const i=r;if(!(i.schemaVersion!==1||typeof i.artifactId!="string"||!i.artifactId||typeof i.kind!="string"||!_T.includes(i.kind)||typeof i.previewHash!="string")){for(const l of["title","summary","htmlPreview","reportText","inspectHref"])if(i[l]!==void 0&&typeof i[l]!="string")return;return i}}function BT(t,r){const i=t.findIndex(l=>l.artifactId===r.artifactId);return i<0?[...t,r]:t.map((l,o)=>o===i?{...l,...r}:l)}function HT(t){if(!t||typeof t!="object")return;const r=t;if(!(r.schemaVersion!==1||typeof r.cardId!="string"||r.gateType!=="contract-apply"&&r.gateType!=="dag-run"||typeof r.taskId!="string"||typeof r.state!="string"||typeof r.expiresAt!="string"||typeof r.inspectHref!="string"||typeof r.previewHash!="string"))return r}function UT(t,r){const i=t.findIndex(o=>o.cardId===r.cardId);if(i<0)return[...t,r];const l=[...t];return l[i]=r,l}function qT(t,r){const i=t.findIndex(l=>l.operationId===r.operationId);return i<0?[...t,r]:t.map((l,o)=>o===i?{...l,...r}:l)}function GT(t){const r=t.operation;if(!r||typeof r!="object")return;const i=r;if(!(i.schemaVersion!==1||typeof i.operationId!="string"||typeof i.action!="string"||typeof i.state!="string"||typeof i.inspectHref!="string"||typeof i.createdAt!="string"||typeof i.updatedAt!="string"||typeof i.previewHash!="string"))return i}function $T(t){const{refs:r,onReconcile:i,setError:l,setInterview:o,setHumanGateCards:d,setArtifactCards:u,setStreaming:h,setStreamingAssistantId:g,setUnread:p,setOperationCards:v,setUsage:y,setMessages:S,setToolCalls:x}=t;return(w,A,M,O)=>{if(O?.generation!==void 0&&r.sessionGenerationRef.current!==O.generation)return;const E=O?.replay===!0;if(w==="stream_ready")return;if(w==="reconcile"){const N=typeof A.reason=="string"?A.reason:"cursor_expired";i?.({reason:N,...typeof A.minSeq=="number"?{minSeq:A.minSeq}:{},...typeof A.epoch=="string"?{epoch:A.epoch}:{},...typeof A.latestTurnId=="string"?{latestTurnId:A.latestTurnId}:{},...typeof A.latestEventId=="string"?{latestEventId:A.latestEventId}:A.latestEventId===null?{latestEventId:null}:{}});return}const D=A.data&&typeof A.data=="object"?A.data:A,G=typeof A.turnId=="string"?A.turnId:void 0;if(G&&(w==="agent_start"||w==="message_update")&&r.settledTurnIdsRef.current.has(G))return;let K=M;if(G){const N=r.turnAssistantIdsRef.current.get(G);N?K=N:r.turnAssistantIdsRef.current.set(G,M)}if(w==="interview-turn"){o(N=>({...N??{},interviewSessionId:typeof D.interviewSessionId=="string"?D.interviewSessionId:N?.interviewSessionId,taskId:typeof D.taskId=="string"?D.taskId:N?.taskId,state:typeof D.state=="string"?D.state:N?.state,question:D.question&&typeof D.question=="object"?D.question:void 0}));return}if(w==="draft"){o(N=>({...N??{},taskId:typeof D.taskId=="string"?D.taskId:N?.taskId,draft:D.draft&&typeof D.draft=="object"?D.draft:N?.draft,draftSha256:typeof D.draftSha256=="string"?D.draftSha256:N?.draftSha256,taskKindRecommendation:typeof D.taskKindRecommendation=="string"?D.taskKindRecommendation:N?.taskKindRecommendation}));return}if(w==="assessment"){o(N=>({...N??{},assessment:D}));return}if(w==="taskKind-confirmed"){o(N=>({...N??{},confirmedTaskKind:typeof D.taskKind=="string"?D.taskKind:N?.confirmedTaskKind,taskKindRecommendation:void 0}));return}if(w==="human-gate-card"){const N=HT(D);N&&d($=>UT($,N));return}if(w==="artifact-ref"){const N=LT(D);N&&u($=>BT($,N));return}if(w==="agent_start"){if(E&&G!==void 0&&G!==r.activeTurnIdRef.current)return;G&&(r.settledTurnIdsRef.current.delete(G),r.activeTurnIdRef.current=G),r.streamingRef.current=!0,h(!0),g(K);return}if(w==="agent_settled"||w==="agent_end"){if(G&&r.settledTurnIdsRef.current.add(G),w==="agent_end")return;G===r.activeTurnIdRef.current&&(r.activeTurnIdRef.current=null),r.streamingRef.current=!1,h(!1),g(null),w==="agent_settled"&&!E&&typeof document<"u"&&document.hidden&&p(N=>N+1),S(N=>N.filter($=>!($.id===K&&$.role==="assistant"&&!$.text.trim()))),x(N=>N.map($=>$.status==="running"&&$.assistantMessageId===K?{...$,status:"error",finishedAt:Date.now()}:$));return}if(w==="operation-ref"||w==="operation-status"){const N=GT(D);N&&v($=>qT($,N));return}if(w==="usage"){if(E)return;const N=D,$=typeof N.responseKey=="string"&&N.responseKey?N.responseKey:void 0;if($&&r.usageResponseKeysRef.current.has($))return;$&&r.usageResponseKeysRef.current.add($),y(ne=>{const ce=N.inputTokens??0,_=N.outputTokens??0,F=N.cacheReadTokens??0,Y=N.cacheWriteTokens??0,oe=N.totalTokens??ce+_+F+Y;return{inputTokens:ne.inputTokens+ce,outputTokens:ne.outputTokens+_,cacheReadTokens:ne.cacheReadTokens+F,cacheWriteTokens:ne.cacheWriteTokens+Y,totalTokens:ne.totalTokens+oe,cost:N.cost===void 0?ne.cost:(ne.cost??0)+N.cost}});return}if(w==="message_update"||w==="message_end"){if(E)return;const N=typeof D.text=="string"?D.text:"";S($=>$.some(ce=>ce.id===K)?$.map(ce=>ce.id===K?{...ce,text:N}:ce):[...$,{id:K,role:"assistant",text:N,createdAt:Date.now()}])}else if(w==="tool_call"){const N=typeof D.toolCallId=="string"?D.toolCallId:Pi("t"),$=typeof D.toolName=="string"?D.toolName:"tool",ne=typeof D.argsPreview=="string"?D.argsPreview:"{}",ce=Date.now();x(_=>_.some(F=>F.id===N)?_.map(F=>F.id===N?{...F,args:ne,status:"running",turnId:G??F.turnId,assistantMessageId:K}:F):[..._,{id:N,toolName:$,args:ne,status:"running",createdAt:ce,turnId:G,assistantMessageId:K}])}else if(w==="tool_result"){const N=typeof D.toolCallId=="string"?D.toolCallId:Pi("r"),$=typeof D.toolName=="string"?D.toolName:"tool",ne=D.isError===!0,ce=typeof D.resultPreview=="string"?D.resultPreview:"{}",_=Date.now();x(F=>F.find(oe=>oe.id===N)?F.map(oe=>oe.id===N?{...oe,result:ce,resultText:ce,status:ne?"error":"ok",finishedAt:_,turnId:G??oe.turnId,assistantMessageId:oe.assistantMessageId??K}:oe):[...F,{id:N,toolName:$,result:ce,resultText:ce,status:ne?"error":"ok",createdAt:_,finishedAt:_,turnId:G,assistantMessageId:K}])}else w==="error"&&l(typeof D.message=="string"?D.message:"chat error")}}const Hc={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,totalTokens:0};function FT(t){const{origin:r,refs:i,sessionId:l,setError:o,onReconcile:d}=t,[u,h]=k.useState([]),[g,p]=k.useState([]),[v,y]=k.useState([]),[S,x]=k.useState([]),[w,A]=k.useState(50),[M,O]=k.useState(0),[E,D]=k.useState([]),[G,K]=k.useState(null),[N,$]=k.useState(null),[ne,ce]=k.useState(!1),[_,F]=k.useState(Hc),[Y,oe]=k.useState(!1),[X,B]=k.useState(null),[I]=k.useState(!1),H=k.useMemo(()=>$T({refs:i,onReconcile:d,setError:o,setInterview:K,setHumanGateCards:D,setArtifactCards:x,setStreaming:oe,setStreamingAssistantId:B,setUnread:O,setOperationCards:y,setUsage:F,setMessages:h,setToolCalls:p}),[i,d,o]),U=k.useCallback((V,ae,he)=>{if(he?.targetSessionId&&i.sessionRef.current?.sessionId!==he.targetSessionId||he?.generation!==void 0&&i.sessionGenerationRef.current!==he.generation)return null;const me=V.split(`
|
|
42
|
+
`);let ye="message",Re="",Ge=null;for(const Ze of me)Ze.startsWith("event: ")?ye=Ze.slice(7).trim():Ze.startsWith("data: ")?Re+=Ze.slice(6):Ze.startsWith("id: ")&&(Ge=Ze.slice(4).trim());if(!Re)return Ge;let Pe;try{Pe=JSON.parse(Re)}catch{return Ge}const ze=Ge??(typeof Pe.eventId=="string"?Pe.eventId:null);if(ze){if(i.seenEventIdsRef.current.has(ze))return ze;i.seenEventIdsRef.current.add(ze)}return H(ye,Pe,ae,he),Ge??ze},[H,i]),re=k.useCallback(async(V,ae)=>{const he=ae?.background===!0;he||ce(!0);try{const me=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(V)}/context`,{credentials:"include"});if(!me.ok)return;const ye=await me.json();ye.context&&i.sessionRef.current?.sessionId===V&&$(Re=>$1(Re,ye.context)?Re:ye.context)}finally{he||ce(!1)}},[r,i]);k.useEffect(()=>{l&&re(l)},[l,re]),k.useEffect(()=>{if(!l)return;const V=window.setTimeout(()=>{re(l,{background:!0})},350);return()=>window.clearTimeout(V)},[l,v,E,G,re]);const T=k.useMemo(()=>u.filter(V=>V.role!=="system"||I).slice(-w),[u,I,w]);k.useEffect(()=>{const V=()=>{document.hidden||O(0)};return document.addEventListener("visibilitychange",V),()=>document.removeEventListener("visibilitychange",V)},[]);const R=k.useMemo(()=>{if(g.length===0)return null;const V=g.filter(Re=>Re.status==="running"),ae=g.filter(Re=>Re.status==="error"),he=V[V.length-1];let me="完成",ye="ok";return ae.length>0?(me=`${ae.length} 次出错`,ye="error"):V.length>0?(me=he?`${he.toolName} 运行中`:"运行中",ye="running"):me="",{count:g.length,statusLabel:me,statusKind:ye}},[g]),z=k.useMemo(()=>yT({messages:T,toolCalls:g,streaming:Y,activeAssistantId:X}),[T,g,Y,X]),C=k.useCallback(()=>{h([]),p([]),y([]),D([]),x([]),K(null),$(null),F(Hc),oe(!1),B(null),O(0),A(50),i.usageResponseKeysRef.current=new Set},[i]),ie=k.useCallback(V=>{h(V.messages),p(V.toolCalls),y([]),D([]),x([]),$(null),K(null),F(Hc),i.usageResponseKeysRef.current=new Set,oe(V.streaming),B(null),O(0),A(50)},[i]),fe=k.useCallback(async V=>{try{const ae=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(V)}`,{credentials:"include"});if(!ae.ok)return!1;const he=await ae.json();if(!he.session||i.sessionRef.current?.sessionId!==V)return!1;const me=he.session.activeTurnId??null;return i.activeTurnIdRef.current=me,i.streamingRef.current=!!me,i.lastEventIdRef.current=he.lastEventId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,h((he.session.messages??[]).filter(ye=>ye.role==="user"||ye.role==="assistant").map(ye=>({id:ye.id,role:ye.role,text:ye.text,createdAt:Date.parse(ye.at)||Date.now()}))),B(null),!0}catch{return!1}},[r,i,h,B]);return{messages:u,setMessages:h,toolCalls:g,setToolCalls:p,operationCards:v,artifactCards:S,historyLimit:w,setHistoryLimit:A,unread:M,humanGateCards:E,interview:G,setInterview:K,taskContext:N,contextLoading:ne,usage:_,streaming:Y,setStreaming:oe,streamingAssistantId:X,setStreamingAssistantId:B,visibleMessages:T,turnGroups:z,processSummary:R,applyChatSseEvent:H,applySseBlock:U,loadTaskContext:re,resetForNewSession:C,applyActivatedSession:ie,recoverSession:fe}}class VT{constructor(r){this.options=r,this.fetchFn=r.fetchFn??fetch,this.backoffMs=r.backoffMs??1e3,this.deadlineMs=r.deadlineMs??3e4}options;eligible=new Set;controllers=new Map;fetchFn;backoffMs;deadlineMs;markEligible(r){this.eligible.add(r)}startIfEligible(r){if(!this.eligible.delete(r)||this.controllers.has(r))return;const i=new AbortController;this.controllers.set(r,i),this.run(r,i)}cancel(r){this.eligible.delete(r),this.controllers.get(r)?.abort(),this.controllers.delete(r)}reconcile(r){const i=new Set(r);for(const l of this.controllers.keys())i.has(l)||this.cancel(l)}dispose(){for(const r of this.controllers.values())r.abort();this.controllers.clear(),this.eligible.clear()}async run(r,i){let l;const o=new Set;let d=!1;const u=window.setTimeout(()=>{d=!0,i.abort()},this.deadlineMs);try{for(;!i.signal.aborted;){try{const h={Accept:"text/event-stream"};l&&(h["Last-Event-ID"]=l);const g=await this.fetchFn(`${this.options.origin}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`,{headers:h,credentials:"include",signal:i.signal});if(g.status===404||!g.body)return;if(!g.ok)throw new Error(`HTTP ${g.status}`);const p=g.body.getReader(),v=new TextDecoder;let y="";for(;;){const{done:S,value:x}=await p.read();if(S||i.signal.aborted)break;y+=v.decode(x,{stream:!0});const w=y.split(`
|
|
43
|
+
|
|
44
|
+
`);y=w.pop()??"";for(const A of w){const M=A.split(`
|
|
45
|
+
`).find(E=>E.startsWith("id: "))?.slice(4);if(M&&(l=M),!M||o.has(M)||!A.includes("event: session_title"))continue;const O=A.split(`
|
|
46
|
+
`).find(E=>E.startsWith("data: "))?.slice(6);if(O)try{const E=JSON.parse(O),D=E.data?.title?.trim();if(!D)continue;if(o.add(M),!this.options.hasSession(r)||(this.options.onTitle(r,{title:D,automatic:!!E.data?.automatic}),E.data?.automatic))return}catch{}}}}catch{if(i.signal.aborted)return}i.signal.aborted||await PT(this.backoffMs,i.signal)}}finally{window.clearTimeout(u),this.controllers.get(r)===i&&this.controllers.delete(r),(d||!this.options.hasSession(r))&&this.options.refresh()}}}function PT(t,r){return new Promise(i=>{const l=window.setTimeout(d,t),o=()=>d();function d(){window.clearTimeout(l),r.removeEventListener("abort",o),i()}r.addEventListener("abort",o,{once:!0})})}async function YT(t){if(t.creatingRef?.current)throw new Error("CREATE_SESSION_IN_FLIGHT");t.creatingRef&&(t.creatingRef.current=!0),t.setCreatingSession?.(!0);try{const r=await(t.fetchFn??fetch)(`${t.origin}/api/operator/v1/chat/sessions`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Zt()},credentials:"include",body:JSON.stringify(t.options??{})});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error?.message??`HTTP ${r.status}`)}const i=await r.json();if(!i.session)throw new Error("创建会话响应缺少 durable session");const l=i.session,o={sessionId:l.sessionId,...nd(l)},d=[l,...t.sessionListRef.current.filter(u=>u.sessionId!==l.sessionId)].slice(0,Os);return t.sessionListRef.current=d,t.setSessionList(d),t.titleWatcher?.markEligible(l.sessionId),t.refreshSessionList(),o}finally{t.creatingRef&&(t.creatingRef.current=!1),t.setCreatingSession?.(!1)}}function KT(t){const{origin:r,refs:i,setSession:l,thread:o,composer:d,browser:u,setError:h,setProcessOpen:g,setAutoScroll:p}=t,{applyActivatedSession:v,resetForNewSession:y,setMessages:S}=o,{setInput:x,setPendingImages:w}=d,{setPreviews:A,setActivePreviewPath:M}=u,[O,E]=k.useState([]),D=k.useRef([]);D.current=O;const G=k.useRef(null),[K,N]=k.useState(!1),$=k.useRef(!1),ne=k.useRef(0),ce=k.useCallback(()=>{i.sessionGenerationRef.current+=1,i.abortRef.current?.abort(),i.reconnectAbortRef.current?.abort();for(const U of i.sessionAbortControllersRef.current.values())U.abort();i.sessionAbortControllersRef.current.clear(),i.reconnectAbortRef.current=null,i.eventsStreamStateRef.current=null,i.streamingRef.current=!1,i.abortRef.current=null,i.assistantIdRef.current=null,i.lastEventIdRef.current=null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.settledTurnIdsRef.current=new Set,i.activeTurnIdRef.current=null,y(),x(""),w([]),A([]),M(null),g(!1),p(!0)},[i,y,x,w,A,M,g,p]),_=k.useCallback(async()=>{try{const U=await fetch(`${r}/api/operator/v1/chat/sessions`,{credentials:"include"});if(!U.ok)return;const re=(await U.json()).sessions??[],T=re.slice(0,Os),R=re.slice(Os);if(E(T),R.length===0)return;await Promise.all(R.map(C=>fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(C.sessionId)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":Zt()}}).catch(()=>{})));const z=i.sessionRef.current?.sessionId;z&&R.some(C=>C.sessionId===z)&&(ne.current+=1,i.sessionRef.current=null,ce(),l(null),window.localStorage.removeItem(Cn))}catch{}},[r,i,ce,l]),F=k.useCallback(async U=>{if(window.confirm("确定删除该会话?删除后不可恢复。"))try{if(!(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(U)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":Zt()}})).ok){h("删除会话失败");return}G.current?.cancel(U),i.sessionRef.current?.sessionId===U&&(ne.current+=1,i.sessionRef.current=null,ce(),l(null),window.localStorage.removeItem(Cn)),await _()}catch(re){h(re instanceof Error?re.message:String(re))}},[r,i,l,ce,_,h]),Y=k.useCallback(async U=>{const re=++ne.current;try{const T=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(U)}`,{credentials:"include"}),R=await T.json();if(!T.ok||!R.session)throw new Error(R.error?.message??"会话不可用");if(re!==ne.current)return;const z={sessionId:R.session.sessionId,...nd(R.session)};ce(),i.sessionRef.current=z,i.streamingRef.current=!!R.session.activeTurnId,i.activeTurnIdRef.current=R.session.activeTurnId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.settledTurnIdsRef.current=new Set,i.lastEventIdRef.current=null,l(z),i.assistantIdRef.current=null,i.abortRef.current=i.sessionAbortControllersRef.current.get(U)??null,w([]),A([]),x(R.session.composerDraft??"");const C=gT(R.session.messages??[]);v({messages:C.messages,toolCalls:C.toolCalls,streaming:!!R.session.activeTurnId}),window.localStorage.setItem(Cn,U),M(null)}catch(T){if(re!==ne.current)return;h(T instanceof Error?T.message:String(T))}},[r,i,l,w,A,x,v,ce,M,h]);k.useEffect(()=>{_()},[_]),G.current||(G.current=new VT({origin:r,hasSession:U=>D.current.some(re=>re.sessionId===U),onTitle:(U,re)=>{E(T=>T.map(R=>R.sessionId!==U||re.automatic&&R.title?R:re.automatic?{...R,title:re.title}:{...R,displayTitle:re.title}))},refresh:_}));const oe=k.useCallback(U=>G.current?.startIfEligible(U),[]);k.useEffect(()=>{G.current?.reconcile(O.filter(U=>U.state!=="archived"&&!U.title).map(U=>U.sessionId))},[O]),k.useEffect(()=>()=>G.current?.dispose(),[]),k.useEffect(()=>{let U=!1;const re=window.localStorage.getItem(Cn);if(!re)return;const T=++ne.current;return(async()=>{try{const R=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(re)}`,{credentials:"include"});if(!R.ok){window.localStorage.removeItem(Cn);return}const z=await R.json();if(U||T!==ne.current||!z.session)return;const C={sessionId:z.session.sessionId,...nd(z.session)};i.sessionGenerationRef.current+=1,i.sessionRef.current=C,i.activeTurnIdRef.current=z.session.activeTurnId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.settledTurnIdsRef.current=new Set,i.lastEventIdRef.current=null,l(C),x(z.session.composerDraft??""),S((z.session.messages??[]).filter(ie=>ie.role==="user"||ie.role==="assistant").map(ie=>({id:ie.id,role:ie.role,text:ie.text,createdAt:Date.parse(ie.at)||Date.now()})))}catch{}})(),()=>{U=!0}},[r,i,l,x,S]);const X=k.useCallback(U=>YT({origin:r,sessionListRef:D,setSessionList:E,titleWatcher:G.current,refreshSessionList:_,options:U,setCreatingSession:N,creatingRef:$}),[r,_]),B=k.useCallback(async U=>{if($.current)return null;const re=++ne.current;h(null);try{const T=await X(U);return re!==ne.current?null:(ce(),i.sessionRef.current=T,window.localStorage.setItem(Cn,T.sessionId),l(T),T)}catch(T){if(re!==ne.current)return null;const R=T instanceof Error?T.message:String(T);return R!=="CREATE_SESSION_IN_FLIGHT"&&h(R),null}},[i,l,h,ce,X]),I=k.useCallback(async U=>{const re=i.sessionRef.current;if(!re||i.streamingRef.current)return;const T=typeof U=="string"?U.trim():"";try{const R={"x-loop-console-confirmation":Zt()};T&&(R["content-type"]="application/json");const z=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(re.sessionId)}/compact`,{method:"POST",credentials:"include",headers:R,...T?{body:JSON.stringify({instructions:T})}:{}}),C=await z.json().catch(()=>({}));if(!z.ok){h(C.error?.message??"上下文压缩失败");return}h(null)}catch(R){h(R instanceof Error?R.message:"上下文压缩失败")}},[r,i,h]);return{sessionList:O,creatingSession:K,activateSession:Y,refreshSessionList:_,deleteSession:F,createSession:B,updateSession:async(U,re)=>{if(!(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(U)}`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Zt()},body:JSON.stringify(re)})).ok){h("会话更新失败");return}await _(),re.state==="archived"&&G.current?.cancel(U),re.state==="archived"&&i.sessionRef.current?.sessionId===U&&(ne.current+=1,i.sessionRef.current=null,ce(),l(null),window.localStorage.removeItem(Cn))},watchSessionTitle:oe,compactSession:I}}function Yi(t){const r=(t??"").trim();return r?/controller identity changed|package fingerprint changed|entry binary sha256 changed/i.test(r)?"控制器版本已变更(Console 启动后代码被重新编译)。请重启 Console 后再试,一次会话中途不要升级/重建控制器。":/Pi session file missing or not openable|cannot reopen chat session .* no persisted Pi session file/i.test(r)?"该对话的 Pi 会话文件已丢失,无法恢复上下文。请新建对话继续(历史记录无法重开)。":/reopened Pi sessionId mismatch/i.test(r)?"重开对话失败:Pi 会话身份与记录不一致(常见于会话文件丢失后被误建)。请新建对话继续。":/base HEAD .+ != frozen baseCommit|exact-base|not a descendant of frozen baseCommit/i.test(r)?"主分支已相对夜间冻结的 baseCommit 前进,无法安全 fast-forward harvest。请人工核对后使用 Discard(必要时勾选强制),或改走日间合并流程。":/force-required|requires --force/i.test(r)?"该终态需要强制 Discard。请确认后勾选强制再试。":r:"操作失败"}function XT(t){let r;const i=new Promise(l=>{r=l});return{...t,outcomePromise:i,resolveOutcome:r}}function $g(t="network error while creating turn"){return{kind:"ambiguous",message:t}}function QT(t="无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"){return{kind:"ambiguous",message:t}}function Fg(t){const{body:r,clientRequestId:i}=t,l=r.error?.code,o=r.error?.message??(t.httpOk?"turn was not accepted":`HTTP ${t.status}`);if(l==="TURN_ACTIVE"&&r.activeTurn?.turnId)return{kind:"adopt-active",activeTurn:r.activeTurn,message:"上一轮仍在运行,已重新连接;当前消息已保留。"};if(r.accepted===!0||t.httpOk&&r.turnId){const d=r.turn?.turnId??r.turnId;return d?{kind:"accepted",turnId:d,idempotent:r.idempotent===!0,turn:r.turn??{turnId:d,clientRequestId:i,state:r.state}}:{kind:"ambiguous",message:o}}return r.accepted===!1||l?{kind:"rejected",code:l,message:o}:{kind:"ambiguous",message:o}}function ZT(t){const r=t.clientRequestId,i=t.state?.activeTurn,l=t.state?.latestTurn;return i?.clientRequestId===r&&i.turnId?{kind:"accepted",turnId:i.turnId,idempotent:!0,turn:i}:l?.clientRequestId===r&&l.turnId?{kind:"accepted",turnId:l.turnId,idempotent:!0,turn:l}:i?.turnId?{kind:"adopt-active",activeTurn:i,message:"上一轮仍在运行,已重新连接;当前消息已保留。"}:null}function JT(t){const r=t.clientRequestId,i=t.state?.activeTurn,l=t.state?.latestTurn,o=i?.state??t.state?.activeTurnState??void 0,d=l?.state??t.state?.latestTurnState??void 0;if(i?.clientRequestId===r&&i.turnId)return ti(o)?{action:"release-terminal",turnId:i.turnId,state:String(o)}:{action:"bind-active",turnId:i.turnId};if(l?.clientRequestId===r&&l.turnId){if(ti(d))return{action:"release-terminal",turnId:l.turnId,state:String(d)};if(!i?.turnId||i.clientRequestId===r)return{action:"bind-active",turnId:l.turnId}}return!Us(t.state)&&!(!!i?.turnId&&i?.clientRequestId!==r)?{action:"release-not-accepted"}:{action:"hold"}}function Us(t){if(t?.activeTurnId||t?.activeTurn?.turnId)return!0;const r=t?.runtime;return r?r.isStreaming===!0||r.isPromptRunning===!0||r.isCompacting===!0||r.isBashRunning===!0:!1}function ti(t){return t==="settled"||t==="aborted"||t==="failed"}function qs(t){return t.pending.sessionId===t.sessionId&&t.pending.sessionGeneration===t.sessionGeneration&&t.pending.submitGeneration===t.submitGeneration}function WT(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns`}function Vg(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/state`}function eE(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`}function tE(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns/${encodeURIComponent(i)}/abort`}function ta(t,r){const i=t.pendingSubmission;r&&i&&i.clientRequestId!==r||(t.submitInFlight=!1,(!r||i?.clientRequestId===r)&&(i?.clientRequestId?t.releasedClientRequestIds.add(i.clientRequestId):r&&t.releasedClientRequestIds.add(r),t.pendingSubmission=null),t.pendingSubmission||(t.stopRequested=!1))}function Ov(t){t.stopRequested=!0}function Gs(t){t.stopRequested=!1}function nE(t,r){return!(!r||t.abortPostedTurnIds.has(r))}function rE(t,r){r&&t.abortPostedTurnIds.add(r)}function $s(t,r){return!t.stopRequested||!nE(t,r)?null:(rE(t,r),t.stoppingTurnId=r,t.activeTurnId=r,r)}function Pg(t,r){const i=t.pendingSubmission;return i&&i.clientRequestId!==r.clientRequestId?!1:(r.turnId&&t.settledTurnIds.add(r.turnId),ta(t,r.clientRequestId),Gs(t),r.markIdle!==!1&&(t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null),!0)}function iE(t,r){return qs({pending:r.pending,sessionId:t.sessionId,sessionGeneration:t.sessionGeneration,submitGeneration:t.submitGeneration})?(r.pending.acceptedTurnId=r.turnId,t.activeTurnId=r.turnId,t.turnAssistantIds.set(r.turnId,r.assistantId),t.streaming=!0,t.submitInFlight=!1,r.pending.resolveOutcome({kind:"accepted",turnId:r.turnId}),r.ui?.setStreaming(!0),r.ui?.setStreamingAssistantId(r.assistantId),r.ui?.setPendingImages([]),r.ui?.watchSessionTitle?.(r.sessionId),!0):(r.pending.resolveOutcome({kind:"stale"}),!1)}function aE(t,r){r.pending.resolveOutcome({kind:"adopt-active",activeTurn:{turnId:r.activeTurnId},message:r.message}),ta(t,r.pending.clientRequestId),r.current&&(r.ui?.clearEmptyAssistant(r.assistantId),r.ui?.setInput(r.text),r.ui?.setPendingImages(r.images),t.activeTurnId=r.activeTurnId,t.assistantId=null,t.streaming=!0,r.ui?.setStreaming(!0),r.ui?.setStreamingAssistantId(null),r.notice.setError(null),r.notice.showNotice(r.message))}function lE(t,r){if(r.pending.resolveOutcome({kind:"rejected",message:r.message}),ta(t,r.pending.clientRequestId),!r.current)return;const i=r.ui?.formatError?r.ui.formatError(r.message):r.message;r.ui?.setError(i),t.streaming=!1,t.assistantId=null,r.ui?.setStreaming(!1),r.ui?.setStreamingAssistantId(null),r.ui?.clearEmptyAssistant(r.assistantId),r.ui?.setInput(r.text),r.ui?.setPendingImages(r.images)}function sE(t,r,i){const l=qs({pending:i.pending,sessionId:t.sessionId,sessionGeneration:t.sessionGeneration,submitGeneration:t.submitGeneration});if(r.kind==="accepted"){if(iE(t,{turnId:r.turnId,assistantId:i.assistantId,pending:i.pending,sessionId:i.sessionId,ui:i.acceptedUi})){const d=$s(t,r.turnId);d&&i.onAutoAbort?.(d)}return}if(r.kind==="adopt-active"){const o=l?$s(t,r.activeTurn.turnId):null;aE(t,{activeTurnId:r.activeTurn.turnId,message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:l,notice:i.notice,ui:i.adoptUi}),o&&i.onAutoAbort?.(o);return}if(r.kind==="rejected"){lE(t,{message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:l,ui:i.rejectedUi}),Gs(t);return}if(r.kind==="stale"){i.pending.resolveOutcome(r),ta(t,i.pending.clientRequestId),Gs(t);return}i.pending.resolveOutcome(r)}function oE(t,r,i,l){const o=t.pendingSubmission;if(!o)return"held";if(r.action==="bind-active"){const u=!!o.acceptedTurnId;u||(o.acceptedTurnId=r.turnId,t.activeTurnId=r.turnId,t.turnAssistantIds.set(r.turnId,o.assistantId),t.streaming=!0,t.submitInFlight=!1);const h=$s(t,r.turnId);return h&&l?.onAutoAbort?.(h),u?"held":"bound"}if(r.action==="release-terminal"||r.action==="release-not-accepted")return r.action==="release-terminal"&&t.settledTurnIds.add(r.turnId),ta(t,o.clientRequestId),Gs(t),Us(i)||(t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,l?.markIdle?.()),"released";const d=i?.activeTurn?.turnId??i?.activeTurnId??null;return d&&(t.activeTurnId=d),"held"}const uE="正在停止…",cE="正在停止…",dE="停止请求未完成,正在与服务端对账…",fE="停止请求失败,正在与服务端对账…";function Yg(t){t.showNotice(uE)}function Kg(t){if(t.networkError)return{action:"keep-busy-notice",message:fE};const r=t.body.turn?.state;return t.body.accepted===!0&&ti(r)?{action:"terminal-idle",turnId:t.turnId}:t.body.error?.code==="TURN_ABORT_PENDING"?{action:"abort-pending-notice"}:t.body.error?.code==="CHAT_TURN_OWNER_LOST"||t.body.error?.code==="OWNER_LOST"?{action:"owner-lost-reconcile"}:t.httpOk?{action:"noop"}:{action:"keep-busy-notice",message:dE}}function Uc(t,r,i,l){const o=l?.sessionStillCurrent!==!1;if(r.action==="terminal-idle"){if(!o)return;t.settledTurnIds.add(r.turnId),t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,l?.markIdle?.();return}if(r.action==="abort-pending-notice"){i.showNotice(cE);return}if(r.action==="owner-lost-reconcile"){if(!o)return;l?.runtimeBusy||(t.stoppingTurnId&&t.settledTurnIds.add(t.stoppingTurnId),t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null,l?.markIdle?.());return}if(r.action==="keep-busy-notice"){i.showNotice(r.message);return}}function Xg(t,r){Ov(t);const i=t.activeTurnId??t.pendingSubmission?.acceptedTurnId??null;if(i){const l=$s(t,i);return l?(r.notice&&Yg(r.notice),r.postAbort(l),{abortedTurnId:l,stopRequested:!0}):{abortedTurnId:null,stopRequested:!0}}return r.notice&&Yg(r.notice),{abortedTurnId:null,stopRequested:!0}}function Wn(t){return{submitInFlight:t.submitInFlightRef.current,pendingSubmission:t.pendingSubmissionRef.current,activeTurnId:t.activeTurnIdRef.current,streaming:t.streamingRef.current,assistantId:t.assistantIdRef.current,stoppingTurnId:t.stoppingTurnIdRef.current,settledTurnIds:t.settledTurnIdsRef.current,turnAssistantIds:t.turnAssistantIdsRef.current,sessionId:t.sessionRef.current?.sessionId??null,sessionGeneration:t.sessionGenerationRef.current,submitGeneration:t.submitGenerationRef.current,stopInFlight:t.stopInFlightRef.current,stopRequested:t.stopRequestedRef.current,abortPostedTurnIds:t.abortPostedTurnIdsRef.current,releasedClientRequestIds:t.releasedClientRequestIdsRef.current}}function In(t,r){t.submitInFlightRef.current=r.submitInFlight,t.pendingSubmissionRef.current=r.pendingSubmission,t.activeTurnIdRef.current=r.activeTurnId,t.streamingRef.current=r.streaming,t.assistantIdRef.current=r.assistantId,t.stoppingTurnIdRef.current=r.stoppingTurnId,t.submitGenerationRef.current=r.submitGeneration,t.stopInFlightRef.current=r.stopInFlight,t.stopRequestedRef.current=r.stopRequested}function hE(t){return t.split(`
|
|
47
|
+
`).find(r=>r.startsWith("event: "))?.slice(7).trim()??"message"}function mE(){return new Promise(t=>window.setTimeout(t,25))}function qc(t,r){r&&t(i=>i.filter(l=>!(l.id===r&&l.role==="assistant"&&!l.text.trim())))}function pE(t){const{origin:r,refs:i,session:l,thread:o,composer:d,setError:u,setAutoScroll:h,setNotice:g,recoveryVersion:p=0,watchSessionTitle:v}=t,{applySseBlock:y,setMessages:S,setStreaming:x,setStreamingAssistantId:w,streaming:A}=o,{setInput:M,setPendingImages:O}=d,E=k.useCallback(B=>{g&&g({id:Date.now(),message:B})},[g]),D=k.useCallback(B=>{const I=Wn(i);ta(I,B),In(i,I)},[i]),G=k.useCallback((B,I,H)=>{i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==I||(i.streamingRef.current=!1,i.activeTurnIdRef.current=null,i.assistantIdRef.current=null,i.stoppingTurnIdRef.current=null,x(!1),w(null),qc(S,H))},[i,x,w,S]),K=k.useCallback(async(B,I,H)=>{for(;!H.aborted;){const U=i.eventsStreamStateRef.current;if(!U||U.sessionId!==B||U.generation!==I)return;U.ready=!1;try{const re={Accept:"text/event-stream"},T=i.lastEventIdRef.current;T&&(re["Last-Event-ID"]=T);const R=await fetch(eE(r,B),{headers:re,credentials:"include",signal:H});if(!R.ok||!R.body){if(R.status===404)return;await xc(2e3,H);continue}const z=R.body.getReader(),C=new TextDecoder;let ie="",fe=!0;const V=Pi("a");for(;;){const{done:he,value:me}=await z.read();if(he)break;ie+=C.decode(me,{stream:!0});const ye=ie.split(`
|
|
48
|
+
|
|
49
|
+
`);ie=ye.pop()??"";for(const Re of ye){if(hE(Re)==="stream_ready"){const ze=i.eventsStreamStateRef.current;ze?.sessionId===B&&ze.generation===I&&(ze.ready=!0),fe=!1;continue}const Ge=i.assistantIdRef.current??V,Pe=y(Re,Ge,{replay:fe,targetSessionId:B,generation:I});Pe&&(i.lastEventIdRef.current=Pe)}}const ae=i.eventsStreamStateRef.current;ae?.sessionId===B&&ae.generation===I&&(ae.ready=!1),await xc(1e3,H)}catch{if(H.aborted)return;await xc(2e3,H)}}},[r,i,y]),N=k.useCallback((B,I)=>{const H=i.eventsStreamStateRef.current;if(H?.sessionId===B&&H.generation===I&&i.reconnectAbortRef.current)return;i.reconnectAbortRef.current?.abort();const U=new AbortController;i.reconnectAbortRef.current=U,i.eventsStreamStateRef.current={sessionId:B,generation:I,ready:!1},K(B,I,U.signal)},[i,K]),$=k.useCallback(async(B,I)=>{N(B,I);const H=Date.now()+5e3;for(;Date.now()<H;){const U=i.eventsStreamStateRef.current;if(U?.sessionId===B&&U.generation===I&&U.ready)return;if(i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==I)throw new Error("会话已切换");await mE()}throw new Error("事件连接未就绪,请检查 Console 连接后重试")},[i,N]),ne=k.useCallback(async B=>{try{const I=await fetch(Vg(r,B),{credentials:"include"}),H=await I.json().catch(()=>({}));return I.ok?H.state??null:null}catch{return null}},[r]),ce=k.useCallback(async B=>{try{const I=await fetch(WT(r,B.sessionId),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Zt()},credentials:"include",body:JSON.stringify({clientRequestId:B.clientRequestId,text:B.text.trim()||"请查看附件图片。",images:B.images.map(({type:U,mimeType:re,data:T})=>({type:U,mimeType:re,data:T}))})}),H=await I.json().catch(()=>({}));return{httpOk:I.ok,status:I.status,body:H}}catch{return{httpOk:!1,status:0,body:{},networkError:!0}}},[r]),_=k.useCallback(()=>({showNotice:E,setError:B=>u(B)}),[E,u]),F=k.useCallback(async(B,I,H)=>{i.stoppingTurnIdRef.current=H,i.streamingRef.current=!0,x(!0);try{const U=await fetch(tE(r,B,H),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Zt()},credentials:"include",body:"{}"}),re=await U.json().catch(()=>({}));if(i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==I||i.stoppingTurnIdRef.current!==H)return;const T=Kg({httpOk:U.ok,turnId:H,body:re}),R=Wn(i);if(R.stoppingTurnId=H,T.action==="owner-lost-reconcile"){const z=await ne(B),C=i.sessionRef.current?.sessionId===B&&i.sessionGenerationRef.current===I;Uc(R,T,_(),{sessionStillCurrent:C,runtimeBusy:Us(z??void 0),markIdle:()=>G(B,I,i.assistantIdRef.current)}),In(i,R);return}Uc(R,T,_(),{sessionStillCurrent:!0,markIdle:()=>G(B,I,i.assistantIdRef.current)}),In(i,R)}catch{const U=Wn(i);Uc(U,Kg({httpOk:!1,turnId:H,body:{},networkError:!0}),_()),In(i,U)}},[r,i,x,G,ne,_]),Y=k.useCallback((B,I)=>{const H=Wn(i);H.sessionId=i.sessionRef.current?.sessionId??null,H.sessionGeneration=i.sessionGenerationRef.current,H.submitGeneration=i.submitGenerationRef.current;const U=re=>{O(re)};sE(H,B,{assistantId:I.assistantId,text:I.text,images:I.images,pending:I.pending,sessionId:I.sessionId,notice:_(),acceptedUi:{setStreaming:x,setStreamingAssistantId:w,setPendingImages:U,watchSessionTitle:v},adoptUi:{clearEmptyAssistant:re=>qc(S,re),setInput:M,setPendingImages:U,setStreaming:x,setStreamingAssistantId:w},rejectedUi:{setError:u,setStreaming:x,setStreamingAssistantId:w,clearEmptyAssistant:re=>qc(S,re),setInput:M,setPendingImages:U,formatError:Yi},onAutoAbort:re=>{F(I.sessionId,I.generation,re)}}),In(i,H)},[i,_,x,w,O,v,S,M,u,F]),oe=k.useCallback(async(B,I)=>{const H=i.sessionRef.current,U=i.sessionGenerationRef.current;if(!H||!B.trim()&&I.length===0||i.streamingRef.current||i.submitInFlightRef.current||i.pendingSubmissionRef.current)return;i.submitInFlightRef.current=!0;const re=++i.submitGenerationRef.current,T=Pi("chat-submit"),R=Pi("u"),z=Pi("a"),C=B.trim(),ie=I.slice(),fe=XT({clientRequestId:T,submitGeneration:re,sessionId:H.sessionId,sessionGeneration:U,text:C,images:ie,assistantId:z,userMessageId:R});i.pendingSubmissionRef.current=fe;try{await $(H.sessionId,U)}catch(ye){i.sessionRef.current?.sessionId===H.sessionId&&i.sessionGenerationRef.current===U&&u(Yi(ye instanceof Error?ye.message:String(ye))),D(T);return}if(i.sessionRef.current?.sessionId!==H.sessionId||i.sessionGenerationRef.current!==U){D(T);return}const V={id:R,role:"user",text:C,createdAt:Date.now()};S(ye=>[...ye,V,{id:z,role:"assistant",text:"",createdAt:Date.now()}]),M(""),h(!0),u(null),i.streamingRef.current=!0,i.assistantIdRef.current=z,x(!0),w(z);const ae={sessionId:H.sessionId,generation:U,submitGeneration:re,assistantId:z,text:C,images:ie,pending:fe},he=await ce({sessionId:H.sessionId,clientRequestId:T,text:C,images:ie});if(!qs({pending:fe,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){fe.resolveOutcome({kind:"stale"}),D(T);return}let me=he.networkError?$g():Fg({httpOk:he.httpOk,status:he.status,body:he.body,clientRequestId:T});if(me.kind==="ambiguous"){const ye=await ne(H.sessionId),Re=ye?ZT({clientRequestId:T,state:ye}):null;if(Re)me=Re;else{const Ge=await ce({sessionId:H.sessionId,clientRequestId:T,text:C,images:ie});if(!qs({pending:fe,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){fe.resolveOutcome({kind:"stale"}),D(T);return}if(me=Ge.networkError?$g("无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"):Fg({httpOk:Ge.httpOk,status:Ge.status,body:Ge.body,clientRequestId:T}),me.kind==="ambiguous"){const Pe=me.message||"无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)";me=QT(Pe),E(Pe)}}}Y(me,ae)},[r,i,$,ce,ne,Y,D,E,S,M,h,u,x,w]),X=k.useCallback(async()=>{const B=i.sessionRef.current?.sessionId,I=i.sessionGenerationRef.current;if(!B)return;const H=Wn(i),U=Xg(H,{postAbort:()=>{},notice:_()});if(In(i,H),U.abortedTurnId){if(i.stopInFlightRef.current)return;i.stopInFlightRef.current=!0;try{await F(B,I,U.abortedTurnId)}finally{i.stopInFlightRef.current=!1}return}const re=i.pendingSubmissionRef.current;if(re&&!i.stopInFlightRef.current){i.stopInFlightRef.current=!0;try{const T=await re.outcomePromise;if(i.sessionRef.current?.sessionId!==B||i.sessionGenerationRef.current!==I)return;let R=null;if(T.kind==="accepted")R=T.turnId;else if(T.kind==="adopt-active")R=T.activeTurn.turnId;else{if(T.kind==="ambiguous")return;i.stopRequestedRef.current=!1;return}if(!R)return;const z=Wn(i);Ov(z);const C=Xg(z,{postAbort:()=>{},notice:_()});In(i,z),C.abortedTurnId&&await F(B,I,C.abortedTurnId)}finally{i.stopInFlightRef.current=!1}}},[i,_,F]);return k.useEffect(()=>{const B=!!i.pendingSubmissionRef.current||i.submitInFlightRef.current||i.stopRequestedRef.current||!!i.activeTurnIdRef.current;if(!l||!A&&!B)return;const I=l.sessionId,H=i.sessionGenerationRef.current;let U=!1;const re=async()=>{try{const C=await fetch(Vg(r,I),{credentials:"include"}),ie=await C.json().catch(()=>({}));if(U||!C.ok||i.sessionRef.current?.sessionId!==I||i.sessionGenerationRef.current!==H)return;const fe=ie.state,V=i.pendingSubmissionRef.current;if(V){const Ge=JT({clientRequestId:V.clientRequestId,state:fe}),Pe=Wn(i),ze=oE(Pe,Ge,fe,{markIdle:()=>G(I,H,i.assistantIdRef.current),onAutoAbort:Ze=>{F(I,H,Ze)}});if(In(i,Pe),ze==="bound"){x(!0);return}if(ze==="released"||!V.acceptedTurnId&&!Pe.pendingSubmission?.acceptedTurnId)return}const ae=fe?.activeTurn?.turnId??fe?.activeTurnId??null;i.activeTurnIdRef.current=ae;const he=Us(fe),me=i.pendingSubmissionRef.current;if(me){const Ge=fe?.latestTurn?.clientRequestId===me.clientRequestId&&ti(fe?.latestTurn?.state),Pe=fe?.activeTurn?.clientRequestId===me.clientRequestId&&ti(fe?.activeTurn?.state);if(Ge||Pe){const ze=Pe?fe?.activeTurn?.turnId??null:fe?.latestTurn?.turnId??me.acceptedTurnId??null,Ze=Wn(i);Pg(Ze,{clientRequestId:me.clientRequestId,turnId:ze,markIdle:!he}),In(i,Ze),he||G(I,H,i.assistantIdRef.current);return}}if(he)return;const ye=i.assistantIdRef.current;if(ae&&!(ti(fe?.activeTurn?.state)||ti(fe?.activeTurnState)))return;ae&&i.settledTurnIdsRef.current.add(ae);const Re=me?.clientRequestId;if(Re){const Ge=Wn(i);Pg(Ge,{clientRequestId:Re,turnId:ae,markIdle:!0}),In(i,Ge)}else D();G(I,H,ye)}catch{}},T=()=>{document.visibilityState==="visible"&&re()},R=()=>{re()},z=window.setInterval(()=>{re()},15e3);return document.addEventListener("visibilitychange",T),window.addEventListener("online",R),re(),()=>{U=!0,window.clearInterval(z),document.removeEventListener("visibilitychange",T),window.removeEventListener("online",R)}},[r,i,l,A,G,D,F]),k.useEffect(()=>{if(!l)return;const B=i.sessionGenerationRef.current;return N(l.sessionId,B),()=>{const I=i.eventsStreamStateRef.current;I?.sessionId===l.sessionId&&I.generation===B&&(i.reconnectAbortRef.current?.abort(),i.reconnectAbortRef.current=null,i.eventsStreamStateRef.current=null)}},[l,p,i,N]),{sendPrompt:oe,handleStop:X,openEventsStream:K}}function gE(t){const{origin:r,refs:i,thread:l,setError:o}=t,{interview:d,setInterview:u}=l,[h,g]=k.useState(""),p=k.useCallback(async()=>{const S=i.sessionRef.current;if(!S)return;const x=window.prompt("Task ID(例如 2026-07-26-my-task)")?.trim();if(!x)return;const w=await fetch(`${r}/api/operator/v1/chat/sessions/${S.sessionId}/interviews`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Zt()},credentials:"include",body:JSON.stringify({taskId:x})}),A=await w.json();if(!w.ok){o(A.error?.message??`HTTP ${w.status}`);return}u({interviewSessionId:A.interview?.sessionId,taskId:x,state:A.interview?.state,question:A.question,draft:A.draft?.draft,draftSha256:A.draft?.draftSha256,assessment:A.assessment})},[r,i,u,o]),v=k.useCallback(async S=>{const x=i.sessionRef.current;if(!x||!d?.interviewSessionId||!d.question)return;const w=await fetch(`${r}/api/operator/v1/chat/sessions/${x.sessionId}/interviews/${d.interviewSessionId}/answers`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Zt()},credentials:"include",body:JSON.stringify({questionId:d.question.id,response:S,...S==="override"?{text:h}:{}})}),A=await w.json();if(!w.ok){o(A.error?.message??`HTTP ${w.status}`);return}u(M=>({...M??{},state:A.interview?.state,question:A.question,draft:A.draft?.draft,draftSha256:A.draft?.draftSha256,assessment:A.assessment,taskKindRecommendation:A.taskKindRecommendation??M?.taskKindRecommendation})),g("")},[r,i,d,h,u,o]),y=k.useCallback(async()=>{const S=i.sessionRef.current;if(!S||!d?.interviewSessionId||!d.taskKindRecommendation)return;const x=await fetch(`${r}/api/operator/v1/chat/sessions/${S.sessionId}/interviews/${d.interviewSessionId}/task-kind/confirm`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Zt()},credentials:"include",body:JSON.stringify({taskKind:d.taskKindRecommendation})}),w=await x.json();if(!x.ok){o(w.error?.message??`HTTP ${x.status}`);return}u(A=>({...A??{},confirmedTaskKind:A?.taskKindRecommendation,taskKindRecommendation:void 0,draft:w.draft?.draft,draftSha256:w.draft?.draftSha256,assessment:w.assessment}))},[r,i,d,u,o]);return{interviewAnswer:h,setInterviewAnswer:g,startInterview:p,answerInterview:v,confirmTaskKind:y}}function yE(t){const{origin:r,refs:i,sessionId:l,setError:o}=t,[d,u]=k.useState({}),[h,g]=k.useState(new Set),[p,v]=k.useState(null),[y,S]=k.useState([]),[x,w]=k.useState(null),[A,M]=k.useState(!1),O=k.useCallback(async(K="")=>{try{v(null);const N=await fetch(`${r}/api/operator/v1/chat/repo/tree?path=${encodeURIComponent(K)}`,{credentials:"include"}),$=await N.json();if(!N.ok)throw new Error($.error?.message??"无法读取仓库目录");u(ne=>({...ne,[K]:$.data?.entries??[]}))}catch(N){v(N instanceof Error?N.message:String(N))}},[r]);k.useEffect(()=>{O()},[O]);const E=k.useCallback(async K=>{M(!0);try{const N=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(K)}`,{credentials:"include"}),$=await N.json();if(!N.ok||!$.data)throw new Error($.error?.message??"无法预览文件");S(ne=>{const ce=[...ne.filter(F=>F.path!==$.data.path),$.data],_=i.sessionRef.current?.sessionId;return _&&window.localStorage.setItem(`${Cn}.previews.${_}`,JSON.stringify(ce.map(F=>F.path))),ce}),w($.data.path)}catch(N){o(N instanceof Error?N.message:String(N))}finally{M(!1)}},[r,i,o]);k.useEffect(()=>{if(!l)return;let K=[];try{const N=JSON.parse(window.localStorage.getItem(`${Cn}.previews.${l}`)??"[]");Array.isArray(N)&&(K=N.filter($=>typeof $=="string").slice(0,10))}catch{}K.length&&Promise.all(K.map(async N=>{const $=await fetch(`${r}/api/operator/v1/chat/repo/file?path=${encodeURIComponent(N)}`,{credentials:"include"});if($.ok)return(await $.json()).data})).then(N=>{if(i.sessionRef.current?.sessionId!==l)return;const $=N.filter(ne=>!!ne);S($),w($.at(-1)?.path??null)})},[r,l,i]);const D=k.useCallback(K=>{g(N=>{const $=new Set(N);return $.has(K)?$.delete(K):$.add(K),$}),d[K]||O(K)},[d,O]),G=k.useCallback(K=>{S(N=>{const $=N.filter(ne=>ne.path!==K);return l&&window.localStorage.setItem(`${Cn}.previews.${l}`,JSON.stringify($.map(ne=>ne.path))),$}),w(N=>N===K?y.find($=>$.path!==K)?.path??null:N)},[y,l]);return{tree:d,expandedDirs:h,treeError:p,previews:y,activePreviewPath:x,setActivePreviewPath:w,previewLoading:A,setPreviews:S,loadTree:O,openPreview:E,closePreview:G,toggleDir:D}}const vE=["operator","web","extension","prompt","skill"];function bE(t){const r=[];for(const i of vE){const l=[];for(let o=0;o<t.length;o+=1)t[o].source===i&&l.push({entry:t[o],globalIndex:o});l.length!==0&&r.push({source:i,label:kS[i],items:l})}return r}function xE(t,r){return!Number.isFinite(r)||r<=0||!Number.isFinite(t)||t<0?0:t>=r?r-1:t}function SE(t){return t==="comfortable"?3:t==="compact"?2:1}function Qg(t,r,i,l){const o=r.findIndex(y=>y.items.some(S=>S.globalIndex===t));if(o<0)return t;const d=r[o],u=d.items.findIndex(y=>y.globalIndex===t);if(u<0)return t;const h=Math.floor(u/i),g=u%i;if(l==="left"||l==="right"){if(i<=1)return t;const S=u+(l==="left"?-1:1);return S<0||S>=d.items.length||Math.floor(S/i)!==h?t:d.items[S].globalIndex}const p=l==="up"?-1:1,v=u+p*i;if(v>=0&&v<d.items.length)return d.items[v].globalIndex;for(let y=o+p;y>=0&&y<r.length;y+=p){const S=r[y];if(S.items.length===0)continue;const x=Math.floor((S.items.length-1)/i)*i,w=l==="up"?x+g:g;return w>=S.items.length?t:S.items[w].globalIndex}return t}function kE(t,r,i){const l=(t.left+t.right)/2;let o=null;for(const d of r){if(d.globalIndex===t.globalIndex)continue;const u=i==="up"?t.top-d.bottom:d.top-t.bottom;if(u<0)continue;const h=(d.left+d.right)/2,g=Math.abs(h-l);(o===null||u<o.gap||u===o.gap&&g<o.dist||u===o.gap&&g===o.dist&&d.globalIndex<o.index)&&(o={gap:u,dist:g,index:d.globalIndex})}return o?.index??null}function wE(t){const{origin:r,sessionId:i,refs:l,setError:o}=t,[d,u]=k.useState(""),[h,g]=k.useState([]),[p,v]=k.useState([]),[y,S]=k.useState(!1),[x,w]=k.useState(0),[A,M]=k.useState([]),[O,E]=k.useState(!1),[D,G]=k.useState(null),[K,N]=k.useState(0),$=k.useRef(null),ne=k.useRef(i),ce=k.useRef(0),_=k.useCallback(z=>{u(z),S(z.startsWith("/")),w(0)},[]);k.useLayoutEffect(()=>{ne.current=i,ce.current+=1,M([]),G(null),E(!1)},[i]);const F=k.useCallback(async()=>{if(!i){M([]),G(null),E(!1);return}const z=i,C=ce.current;ne.current=z,E(!0),G(null);const ie=()=>ne.current===z&&ce.current===C;try{const fe=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(z)}/commands`,{credentials:"include"});if(!ie())return;if(!fe.ok){G("动态命令加载失败"),M([]);return}const V=await fe.json().catch(()=>null),ae=[];for(const me of V?.commands??[]){const ye=me.source;if(ye!=="extension"&&ye!=="prompt"&&ye!=="skill")continue;const Re=String(me.command??me.name??"").trim();Re&&ae.push({command:Re.startsWith("/")?Re:`/${Re}`,label:String(me.label??me.name??Re),description:String(me.description??""),source:ye})}if(!ie())return;M(ae);const he=typeof V?.warning=="string"?V.warning.trim():"";G(he?he.slice(0,160):null)}catch{if(!ie())return;G("动态命令加载失败"),M([])}finally{ie()&&E(!1)}},[r,i]);k.useEffect(()=>{i&&(!y&&K===0||F())},[i,y,K,F]);const Y=k.useCallback(()=>{N(z=>z+1),F()},[F]);k.useEffect(()=>{if(!i)return;const z=d.slice(0,$.current?.selectionStart??d.length).match(/(?:^|\s)@([^\s@]*)$/);if(!z){g([]);return}const C=window.setTimeout(()=>{fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/files?q=${encodeURIComponent(z[1]??"")}`).then(ie=>ie.ok?ie.json():null).then(ie=>g((ie?.files??[]).map(fe=>fe.path)))},150);return()=>window.clearTimeout(C)},[r,i,d]);const oe=k.useCallback(z=>{const C=$.current?.selectionStart??d.length,fe=d.slice(0,C).search(/@[^\s@]*$/);fe<0||(u(`${d.slice(0,fe)}@${z} ${d.slice(C)}`),g([]))},[d]),X=k.useCallback(z=>{for(const C of Array.from(z).slice(0,4)){if(!C.type.startsWith("image/")||C.size>5*1024*1024){o("图片仅支持 PNG/JPEG/GIF/WebP,单张不超过 5 MiB");continue}const ie=new FileReader;ie.onload=()=>{const fe=String(ie.result??""),V=fe.slice(fe.indexOf(",")+1);v(ae=>[...ae,{name:C.name,type:"image",mimeType:C.type,data:V}].slice(0,4))},ie.readAsDataURL(C)}},[o]),B=k.useCallback(z=>{v(C=>C.filter(ie=>ie!==z))},[]);k.useLayoutEffect(()=>{const z=$.current;z&&(z.style.height="auto",z.style.height=`${Math.min(z.scrollHeight,280)}px`)},[d]),k.useEffect(()=>{if(!i)return;const z=window.setTimeout(()=>{fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/draft`,{method:"PUT",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Zt()},body:JSON.stringify({text:d})})},400);return()=>window.clearTimeout(z)},[r,i,d]);const I=k.useMemo(()=>xS(A),[A]),H=k.useMemo(()=>d.startsWith("/")?SS(I,d):[],[d,I]);k.useEffect(()=>{w(z=>xE(z,H.length))},[H.length]);const U=k.useCallback(()=>{l.isComposingRef.current=!0},[l]),re=k.useCallback(()=>{l.isComposingRef.current=!1,l.compositionEndedAtRef.current=Date.now()},[l]),T=k.useCallback(()=>l.isComposingRef.current,[l]),R=k.useCallback(()=>Date.now()-l.compositionEndedAtRef.current<100,[l]);return k.useEffect(()=>{Y1({origin:r,sessionId:i,refs:l})},[r,i,l]),{input:d,setInput:u,handleInputChange:_,fileOptions:h,pendingImages:p,setPendingImages:v,addImagesFromFiles:X,removeImage:B,shortcutOpen:y,setShortcutOpen:S,shortcutIndex:x,setShortcutIndex:w,filteredShortcuts:H,dynamicCommandsLoading:O,dynamicCommandsError:D,retryDynamicCommands:Y,insertFileReference:oe,textareaRef:$,onCompositionStart:U,onCompositionEnd:re,isComposingNow:T,recentlyComposedNow:R}}const CE=[{toolId:"read",kind:"explore",description:"Pi 内置读取文件。"},{toolId:"write",kind:"explore",description:"Pi 内置写入文件(软约束:大改优先走 DAG)。"},{toolId:"edit",kind:"explore",description:"Pi 内置编辑文件(软约束:大改优先走 DAG)。"},{toolId:"bash",kind:"explore",description:"Pi 内置 shell 执行(软约束:优先受治路径)。"},{toolId:"grep",kind:"explore",description:"Pi 内置内容搜索。"},{toolId:"find",kind:"explore",description:"按名称查找文件路径。"},{toolId:"ls",kind:"explore",description:"列出目录内容。"},{toolId:"safe-read",kind:"explore",description:"安全读取仓库相对路径文件;拒绝敏感文件并自动脱敏 secret。"},{toolId:"safe-grep",kind:"explore",description:"安全搜索仓库内容;跳过敏感文件并自动脱敏搜索结果。"},{toolId:"git-status",kind:"explore",description:"固定参数执行 git status --porcelain(无 shell)。"},{toolId:"git-diff",kind:"explore",description:"固定参数查看 git diff;敏感路径不可查看且结果自动脱敏。"}];function jE(t){if(!t)return null;const r=(t.tools??[]).map(l=>({toolId:l.toolId,action:l.action,description:l.description,kind:l.kind??"read",cli:l.cli})),i=[...CE];return{explore:i,operator:r,total:i.length+r.length}}let RE=0;function TE(t){const{origin:r,session:i,setSession:l,refs:o,setError:d}=t,[u,h]=k.useState(null),[g,p]=k.useState([]),[v,y]=k.useState("idle"),[S,x]=k.useState(null),[w,A]=k.useState([]),[M,O]=k.useState(null),[E,D]=k.useState(null),[G,K]=k.useState(!1),[N,$]=k.useState(!1),[ne,ce]=k.useState(!1),_=k.useRef(null),F=k.useRef(null),Y=k.useRef(0);k.useEffect(()=>{Y.current=-1,K(!1)},[i?.sessionId,K]);const X=Ji().snapshot,B=k.useCallback(async()=>{try{const V=await fetch(`${r}/api/operator/v1/chat/capabilities`);if(!V.ok)return;const ae=await V.json();h(ae)}catch{}},[r]);k.useEffect(()=>{B()},[B]);const I=k.useCallback(async()=>{if(!i){p([]),y("idle");return}const V=i.sessionId;y("loading"),x(null);try{const ae=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(V)}/models`,{credentials:"include"}),he=await ae.json().catch(()=>null);if(o.sessionRef.current?.sessionId!==V)return;if(!ae.ok||!he){y("error"),x(he?.error?.message??`模型列表读取失败(HTTP ${ae.status})`);return}p(he.models??[]),A(he.thinkingLevels??[]),y("ready")}catch(ae){if(o.sessionRef.current?.sessionId!==V)return;y("error"),x(ae instanceof Error?ae.message:String(ae))}},[r,i,o]);k.useEffect(()=>{I()},[I]),k.useEffect(()=>{if(!i){O(null),D(null);return}const V=i.sessionId,ae=`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(V)}`;D(null),fetch(`${ae}/runtime-context`,{credentials:"include"}).then(async he=>{const me=await he.json().catch(()=>null);if(!me?.context||o.sessionRef.current?.sessionId!==V)return;const ye=me.context,Re=Q1().snapshot;O(Ge=>V1(Ge,ye,Re,V))}).catch(()=>{o.sessionRef.current?.sessionId===V&&D("注入上下文读取失败,请重试")})},[r,i?.sessionId,o]),k.useEffect(()=>{if(!X||!i||X.sessionId!==i.sessionId)return;const V=uy(X);l(ae=>{if(!ae||ae.sessionId!==X.sessionId||jT(ae,V))return ae;const he=Dv(ae,V);return o.sessionRef.current=he,he}),O(ae=>{if(!ae)return ae;const he={...ae,...V.model?{model:V.model}:{},...V.thinkingLevel?{thinkingLevel:V.thinkingLevel}:{}};return he.model?.provider===ae.model?.provider&&he.model?.modelId===ae.model?.modelId&&he.thinkingLevel===ae.thinkingLevel?ae:he})},[X,i?.sessionId,o,l,O]);const H=k.useCallback(async V=>{if(!i)return!1;const ae=i.sessionId,he=++RE;Y.current=he,fy({type:"mutation-start",token:he}),K(!0);try{const me=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i.sessionId)}/model`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Zt()},body:JSON.stringify(V)}),ye=await me.json().catch(()=>({}));return Y.current!==he?!1:me.ok?!ye.session||o.sessionRef.current?.sessionId!==ae?!1:K1(he,ae,ye.snapshot):(o.sessionRef.current?.sessionId===ae&&(d(ye.error?.message??`模型或思考等级切换失败(HTTP ${me.status})`),Qi()),!1)}catch(me){return Y.current!==he||o.sessionRef.current?.sessionId===ae&&d(me instanceof Error?me.message:String(me)),!1}finally{X1(he,ae,o)&&Y.current===he&&K(!1)}},[r,i,o,l,d]);k.useEffect(()=>{if(!N)return;const V=he=>{const me=_.current;me&&he.target instanceof Node&&!me.contains(he.target)&&$(!1)},ae=he=>{he.key==="Escape"&&$(!1)};return document.addEventListener("mousedown",V),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",ae)}},[N]),k.useEffect(()=>{if(!ne)return;const V=he=>{const me=F.current;me&&he.target instanceof Node&&!me.contains(he.target)&&ce(!1)},ae=he=>{he.key==="Escape"&&ce(!1)};return document.addEventListener("mousedown",V),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",ae)}},[ne]);const U=k.useMemo(()=>jE(u),[u]),re=X?(X.models??[]).map(V=>({provider:V.provider,id:V.id,...V.name?{name:V.name}:{},...V.hasCredentials!==void 0?{hasCredentials:V.hasCredentials}:{}})):g,T=X?.thinkingLevels?.length?X.thinkingLevels.map(V=>V.value):w,R=i?.model??M?.model,z=R?Hs(R.provider,R.modelId):"",C=X?.selection?.thinkingSelection??i?.thinkingLevel??"",ie=X?.selection?.effectiveThinkingLevel??i?.thinkingLevel??void 0,fe=!z||re.some(V=>Hs(V.provider,V.id)===z);return{capabilities:u,models:re,modelsStatus:v,modelsError:S,onRetryModels:()=>{I()},thinkingLevels:T,runtimeContext:M,runtimeContextError:E,onRetryRuntimeContext:()=>{D(null),Qi()},toolsOpen:N,setToolsOpen:$,runtimeContextOpen:ne,setRuntimeContextOpen:ce,toolsMenuRef:_,runtimeContextMenuRef:F,switchRuntime:H,switching:G,toolCatalog:U,activeModel:R,activeModelRef:z,activeThinkingLevel:C,effectiveThinkingLevel:ie,activeModelListed:fe}}const Zg={comfortableMin:1450,compactMin:1100};function EE(t){return!Number.isFinite(t)||t<0?"narrow":t>=Zg.comfortableMin?"comfortable":t>=Zg.compactMin?"compact":"narrow"}function NE(t){return t==="compact"||t==="narrow"}const AE={mode:"comfortable",width:1600,landingDensity:"comfortable",emptyHeight:720};function IE(t,r){const[i,l]=k.useState(AE);return k.useEffect(()=>{const o=t.current;if(!o||typeof ResizeObserver>"u")return;const d=()=>{const v=o.getBoundingClientRect().width,y=r?.current??null,S=y?y.getBoundingClientRect().height:720;l({mode:EE(v),width:v,landingDensity:wS(S),emptyHeight:S})};d();const u=new ResizeObserver(()=>d());u.observe(o);let h=null;const g=()=>{const v=r?.current??null;v&&v!==h&&(h&&u.unobserve(h),u.observe(v),h=v,d())};g();const p=window.setInterval(g,250);return()=>{window.clearInterval(p),u.disconnect()}},[t,r]),i}function DE(t="none"){return{active:t}}function Wa(t,r){return{active:r}}function Er(t={active:"none"}){return{active:"none"}}function OE(t){return{sidebarDrawerOpen:t.active==="sidebar-drawer",processOpen:t.active==="process",runtimeContextOpen:t.active==="runtime-context",toolsOpen:t.active==="tools"}}function ME(t){const{origin:r,surface:i="standalone"}=t,l=i==="workspace",o=zT(),[d,u]=k.useState(null),[h,g]=k.useState(null),[p,v]=k.useState(!0),[y,S]=k.useState(!0),[x,w]=k.useState(()=>DE()),[A,M]=k.useState(null),[O,E]=k.useState(0),D=k.useRef(null),G=k.useRef(null),K=k.useRef(null),N=k.useRef(null),$=k.useRef(null),ne=k.useRef(null),ce=k.useRef(null),_=k.useRef(null),F=k.useRef(()=>{}),Y=k.useRef(null),oe=k.useRef(!1),X=IE(N,$),B=X.mode,I=OE(x),H=I.processOpen,U=NE(B)&&H,re=I.runtimeContextOpen;k.useEffect(()=>{B==="comfortable"&&x.active==="sidebar-drawer"&&w(J=>J.active==="sidebar-drawer"?Er(J):J)},[B,x.active]);const T=k.useCallback(J=>{w(ge=>{const Me=ge.active==="process";return(typeof J=="function"?J(Me):J)?Wa(ge,"process"):ge.active==="process"?Er(ge):ge})},[]),R=wE({origin:r,sessionId:h?.sessionId,refs:o,setError:u}),z=k.useMemo(()=>bE(R.filteredShortcuts),[R.filteredShortcuts]),C=yE({origin:r,refs:o,sessionId:h?.sessionId,setError:u}),ie=k.useRef(()=>{}),fe=k.useCallback(J=>{ie.current(J)},[]),V=FT({origin:r,refs:o,sessionId:h?.sessionId,setError:u,onReconcile:fe});ie.current=J=>{const ge=o.sessionRef.current?.sessionId;ge&&(async()=>await V.recoverSession(ge)?(M({id:Date.now(),message:"已自动恢复:会话事件已重新同步,可继续对话。"}),E(je=>je+1)):M({id:Date.now(),message:"自动恢复未完成,将在重连时重试。"}))()};const ae=KT({origin:r,refs:o,setSession:g,thread:V,composer:{setInput:R.setInput,setPendingImages:R.setPendingImages},browser:{setPreviews:C.setPreviews,setActivePreviewPath:C.setActivePreviewPath},setError:u,setProcessOpen:T,setAutoScroll:S}),he=pE({origin:r,refs:o,session:h,thread:V,composer:{setInput:R.setInput,setPendingImages:R.setPendingImages},setError:u,setNotice:M,setAutoScroll:S,recoveryVersion:O,watchSessionTitle:ae.watchSessionTitle}),me=gE({origin:r,refs:o,thread:V,setError:u}),ye=TE({origin:r,session:h,setSession:g,refs:o,setError:u});k.useEffect(()=>{ye.runtimeContextOpen&&x.active!=="runtime-context"?w(J=>Wa(J,"runtime-context")):!ye.runtimeContextOpen&&x.active==="runtime-context"&&w(J=>Er(J))},[ye.runtimeContextOpen,x.active]),k.useEffect(()=>{x.active!=="runtime-context"&&ye.runtimeContextOpen&&ye.setRuntimeContextOpen(!1)},[x.active]);const{sendPrompt:Re,handleStop:Ge}=he,Pe=k.useRef(()=>{}),ze=k.useCallback(async J=>{const ge=Xp(J);if(ge&&ge.action!=="unknown"&&ge.action!=="pi-prompt"){Pe.current(J);return}await Re(J,R.pendingImages)},[Re,R.pendingImages]);F.current=J=>{ze(J)};const Ze=k.useCallback(()=>{R.textareaRef.current?.focus()},[R.textareaRef]),yt=k.useCallback(()=>{w(J=>J.active==="sidebar-drawer"?Er(J):J)},[]),wt=k.useCallback(()=>{ye.setRuntimeContextOpen(!1),w(J=>Wa(J,"sidebar-drawer"))},[ye.setRuntimeContextOpen]),Rn=k.useCallback(J=>{ae.activateSession(J),yt(),queueMicrotask(()=>{G.current?.focus?.(),Ze()})},[ae,yt,Ze]),qt=k.useCallback(J=>{R.setInput(ge=>`${ge}${ge&&!ge.endsWith(" ")?" ":""}@${J} `),yt(),queueMicrotask(()=>Ze())},[R,yt,Ze]),Gt=k.useCallback(J=>{C.openPreview(J),yt()},[C,yt]),Te=k.useCallback(()=>{const J=G.current;if(!J)return;const ge=J.scrollHeight-J.scrollTop-J.clientHeight<80;S(ge)},[]);k.useEffect(()=>{y&&D.current?.scrollIntoView({behavior:"smooth",block:"end"})},[V.messages,y,V.streaming]),k.useEffect(()=>{if(!A)return;const J=window.setTimeout(()=>M(null),6e3);return()=>window.clearTimeout(J)},[A]);const $e=k.useCallback(J=>{if(J.action==="pi-prompt"||J.command==="/name"||J.command==="/compact"){R.setInput(`${J.command} `),R.setShortcutOpen(!1),R.textareaRef.current?.focus();return}Pe.current(J.command)},[R]),ut=k.useCallback(J=>{const ge=Xp(J),Me=J.trim(),je=Me.split(/\s+/,1)[0]?.toLowerCase()??"";if(R.setInput(""),R.setShortcutOpen(!1),!!ge){if(ge.action==="focus:interview"){me.startInterview();return}if(ge.action==="show-help"){u(`可用 shortcuts:${cd.map(we=>we.command).join("、")};以及 /compact /name /session /copy`);return}if(ge.action.startsWith("focus-panel:")){K.current?.scrollIntoView({behavior:"smooth",block:"nearest"});return}if(ge.action==="compact"){const we=Me.slice(je.length).trim();ae.compactSession(we||void 0);return}if(ge.action==="name"){const we=Me.slice(je.length).trim(),Fe=h?.sessionId;if(!Fe){u("当前没有可重命名的会话");return}const Oe=ae.sessionList.find(Tt=>Tt.sessionId===Fe),Rt=we||window.prompt("会话名称",Oe?.title??Oe?.displayTitle??"")||"";Rt.trim()&&ae.updateSession(Fe,{title:Rt.trim()});return}if(ge.action==="session"){const we=h?.sessionId??"(none)",Fe=ae.sessionList.find(Rt=>Rt.sessionId===we),Oe=Fe?.title||Fe?.displayTitle||"未命名对话";M({id:Date.now(),message:`当前会话:${Oe}(${we})`});return}if(ge.action==="copy"){const Fe=[...V.visibleMessages??[]].reverse().find(Oe=>Oe.role==="assistant");if(!Fe?.text){u("没有可复制的助手消息");return}navigator.clipboard?.writeText(Fe.text).then(()=>M({id:Date.now(),message:"已复制最后一条助手消息"}),()=>u("复制失败"));return}if(ge.action==="unknown"){Re(Me,R.pendingImages);return}u(`未知 shortcut:${ge.command}`)}},[R.setInput,R.setShortcutOpen,R.pendingImages,me.startInterview,ae,h,V.visibleMessages,Re]);Pe.current=ut;const Xe=k.useCallback(J=>{const ge=o.isComposingRef.current||J.nativeEvent.isComposing,Me=Date.now()-o.compositionEndedAtRef.current<100;if(R.shortcutOpen&&R.filteredShortcuts.length>0&&!ge&&!Me){if(J.key==="ArrowLeft"||J.key==="ArrowRight"||J.key==="ArrowUp"||J.key==="ArrowDown"){J.preventDefault();const je=SE(B);let we=R.shortcutIndex;if(J.key==="ArrowLeft"||J.key==="ArrowRight")we=Qg(R.shortcutIndex,z,je,J.key==="ArrowLeft"?"left":"right");else{const Fe=Y.current;let Oe=null;if(Fe){const Rt=Array.from(Fe.querySelectorAll("[data-shortcut-index]")).map(xn=>{const ct=xn.getBoundingClientRect();return{globalIndex:Number(xn.dataset.shortcutIndex??-1),top:ct.top,bottom:ct.bottom,left:ct.left,right:ct.right}}).filter(xn=>Number.isFinite(xn.globalIndex)&&xn.globalIndex>=0),Tt=Rt.find(xn=>xn.globalIndex===R.shortcutIndex)??null;Tt&&(Oe=kE(Tt,Rt,J.key==="ArrowUp"?"up":"down"))}we=Oe??Qg(R.shortcutIndex,z,je,J.key==="ArrowUp"?"up":"down")}we!==R.shortcutIndex&&(oe.current=!0,R.setShortcutIndex(we));return}if(J.key==="Escape"){J.preventDefault(),R.setShortcutOpen(!1);return}if(J.key==="Enter"||J.key==="Tab"){J.preventDefault();const je=R.filteredShortcuts[R.shortcutIndex]??R.filteredShortcuts[0];$e(je);return}}if(J.key==="Enter"&&!J.shiftKey&&(ge||Me)){Me&&J.preventDefault();return}if(J.key==="Enter"&&!J.shiftKey){J.preventDefault(),ze(R.input);return}},[R.input,R.shortcutOpen,R.filteredShortcuts,R.shortcutIndex,R.setShortcutIndex,R.setShortcutOpen,o,ze,$e,B,z,Y,oe]),zt=V.visibleMessages.length>0||V.operationCards.length>0||V.humanGateCards.length>0||V.artifactCards.length>0||!!V.interview,te=t.readiness==="setup-required"?"⚠ Pi 未就绪(setup-required):Chat 需要先完成 Pi 认证 / 模型配置。":t.readiness==="degraded"?"⚠ Pi 降级(degraded):可继续对话,但部分能力不可用。":null,de=c.jsx(yS,{origin:r,open:p,layoutMode:B,drawerOpen:I.sidebarDrawerOpen,activeSessionId:h?.sessionId,sessions:ae.sessionList,tree:C.tree,expanded:C.expandedDirs,treeError:C.treeError,onToggleOpen:()=>v(J=>!J),onOpenDrawer:wt,onCloseDrawer:yt,onCreate:()=>{ae.createSession()},creatingSession:ae.creatingSession,onActivate:J=>{I.sidebarDrawerOpen?Rn(J):ae.activateSession(J)},onRename:(J,ge)=>{ae.updateSession(J,{title:ge})},onSetState:(J,ge)=>{ae.updateSession(J,{state:ge})},onDelete:J=>{ae.deleteSession(J)},onRefreshTree:()=>{C.loadTree()},onToggleDir:C.toggleDir,onInsert:J=>{I.sidebarDrawerOpen?qt(J):R.setInput(ge=>`${ge}${ge&&!ge.endsWith(" ")?" ":""}@${J} `)},onPreview:J=>{I.sidebarDrawerOpen?Gt(J):C.openPreview(J)},drawerTriggerRef:ne}),xe=["oc-workspace",H&&!U?"has-process":"",U?"has-process-overlay":""].filter(Boolean).join(" "),Ee=J=>c.jsx("div",{className:"oc-messages is-empty",ref:$,"data-landing-density":X.landingDensity,children:c.jsx(vy,{mode:J,readiness:t.readiness,density:X.landingDensity,onSuggest:async ge=>{ae.creatingSession||(J==="no-session"?await ae.createSession()&&await ze(ge):await ze(ge))},disabled:ae.creatingSession,onCreateSession:J==="no-session"?()=>{ae.createSession()}:void 0})});return c.jsxs("div",{className:"oc-shell",children:[l?null:c.jsxs("div",{className:"oc-banner",children:[c.jsxs("span",{className:"oc-banner-title",children:[c.jsx("span",{className:"oc-banner-dot","aria-hidden":"true"}),"对话"]}),c.jsxs("span",{className:"oc-banner-body",children:["用自然语言编排 loop-agent / agent-worker 的",c.jsx("strong",{children:"全部能力"}),"。这是 ",c.jsx("strong",{children:"Operator"})," 面:默认具备完整 Pi 工具(read/write/edit/bash/grep/find/ls)与 safe-* 探查、以及受策略约束的 operator action(ADR 0011)。",c.jsx("strong",{children:"软约束"}),":大改与高风险变更优先走受治 DAG 的 implement-pi / repair-pi 与 Human Gate,而非把 Chat 当作第二套 DAG kernel。"]})]}),te&&c.jsx("div",{className:"oc-alert oc-alert-warning",children:te}),d&&c.jsxs("div",{className:"oc-alert oc-alert-error",children:[c.jsx("strong",{children:"出错了:"}),d]}),A&&c.jsx("div",{className:"oc-alert oc-alert-warning",role:"status",children:A.message}),h?c.jsxs("div",{className:xe,ref:N,"data-layout-mode":B,children:[de,c.jsxs("div",{className:`oc-main${zt?"":" is-landing"}`,children:[B==="narrow"?c.jsx("div",{className:"oc-main-topbar",children:c.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:ne,"aria-label":"打开会话与仓库","aria-expanded":I.sidebarDrawerOpen,onClick:()=>I.sidebarDrawerOpen?yt():wt(),children:"会话与仓库"})}):null,c.jsx(bS,{previews:C.previews,activePath:C.activePreviewPath,loading:C.previewLoading,onActivate:C.setActivePreviewPath,onClose:C.closePreview}),zt?c.jsx(xT,{scrollContainerRef:G,messagesEndRef:D,onScroll:Te,hasThread:zt,readiness:t.readiness,streaming:V.streaming,streamingAssistantId:V.streamingAssistantId,messagesCount:V.messages.length,visibleCount:V.visibleMessages.length,onLoadMore:()=>V.setHistoryLimit(J=>J+50),turnGroups:V.turnGroups,interview:V.interview,interviewAnswer:me.interviewAnswer,onInterviewAnswerChange:me.setInterviewAnswer,onAnswerInterview:J=>{me.answerInterview(J)},onConfirmTaskKind:()=>{me.confirmTaskKind()},humanGateCards:V.humanGateCards,operationCards:V.operationCards,artifactCards:V.artifactCards,origin:r,sessionId:h.sessionId,onNavigateWorkspace:t.onNavigateWorkspace,onSuggest:J=>{ze(J)}}):Ee("empty-session"),c.jsx(IT,{composer:R,streaming:V.streaming,hasThread:zt,layoutMode:B,paletteModel:z,shortcutPaletteRef:Y,paletteKeyboardNavRef:oe,onSend:J=>{ze(J)},onStop:Ge,onKeyDown:Xe,onRunShortcut:ut,models:ye.models,activeModel:ye.activeModel,activeModelRef:ye.activeModelRef,activeModelListed:ye.activeModelListed,activeThinkingLevel:ye.activeThinkingLevel,thinkingLevels:ye.thinkingLevels,onSwitchRuntime:J=>{ye.switchRuntime(J)},usage:V.usage,unread:V.unread,onCompact:()=>{ae.compactSession()},processSummary:V.processSummary,processOpen:H,onToggleProcess:()=>{w(J=>J.active==="process"?Er(J):Wa(J,"process")),H||ye.setRuntimeContextOpen(!1)},processTriggerRef:ce,runtimeContext:ye.runtimeContext,runtimeContextOpen:re,onToggleRuntimeContext:()=>{re?(ye.setRuntimeContextOpen(!1),w(J=>J.active==="runtime-context"?Er(J):J)):(ye.setRuntimeContextOpen(!0),w(J=>Wa(J,"runtime-context")))},runtimeContextTriggerRef:_})]}),re&&ye.runtimeContext?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"oc-overlay-backdrop is-runtime-context","aria-label":"关闭注入上下文遮罩",onClick:()=>{ye.setRuntimeContextOpen(!1),w(J=>J.active==="runtime-context"?Er(J):J)}}),c.jsx(MT,{panelOnly:!0,open:re,onToggle:()=>{},onClose:()=>{ye.setRuntimeContextOpen(!1),w(J=>J.active==="runtime-context"?Er(J):J)},context:ye.runtimeContext,triggerRef:_})]}):null,H&&c.jsxs(c.Fragment,{children:[U?c.jsx("button",{type:"button",className:"oc-overlay-backdrop is-process","aria-label":"关闭工具调用记录遮罩",onClick:()=>T(!1)}):null,c.jsx(DT,{toolCalls:V.toolCalls,overlay:U,onClose:()=>T(!1),triggerRef:ce})]})]}):c.jsxs("div",{className:xe,ref:N,"data-layout-mode":B,children:[de,c.jsxs("div",{className:"oc-main is-landing",children:[B==="narrow"?c.jsx("div",{className:"oc-main-topbar",children:c.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:ne,"aria-label":"打开会话与仓库","aria-expanded":I.sidebarDrawerOpen,onClick:()=>I.sidebarDrawerOpen?yt():wt(),children:"会话与仓库"})}):null,Ee("no-session")]})]})]})}function zE(t){return t==="validate"||t==="apply"||t==="spine"?"contract":t}const Mv="X-Loop-Console-Confirmation",zv="agent-worker console doctor --repo .",rd=[{kind:"standard",label:"后端研发(默认 DAG)",hint:"生成标准 hybrid DAG(contract → implement → verify)"},{kind:"frontend-implementation",label:"前端研发",hint:"生成 frontend-implementation 专用节点链"},{kind:"backend-test",label:"后端测试",hint:"生成 backend-test-dag(分析 / 用例 / pytest)"},{kind:"frontend-test",label:"前端测试",hint:"生成 frontend-test-dag(RAG 用例 + Playwright CLI)"}],_v={"setup-required":"需要设置",ready:"已就绪",degraded:"降级可用",unknown:"未知"},_E={idle:"未探测",match:"匹配",mismatch:"仓库不匹配",unavailable:"不可用"},Lv={low:"低",medium:"中",high:"高"},Bv={"validation-failed":"校验失败","contract-drift":"契约漂移","runtime-mismatch":"运行时不匹配","pause-on-human":"等待人工","verification-failed":"验证失败","orphan-unknown":"孤立/未知","terminal-failed":"已终止(失败)","terminal-succeeded":"已终止(成功)","needs-reconcile":"需要对账"},LE={idle:"空闲","not-started":"未开始","not-run":"未运行","n/a (MVP)":"不适用(MVP)",accepted:"已接受",succeeded:"已成功",running:"运行中",ran:"已执行"};function Ns(t){return LE[t]??t}function Hv(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function Fs(t){return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}async function Nd(t,r={},i){const l={"Content-Type":"application/json",[Mv]:Hv()},o=await fetch("/api/operator/v1/operations",{method:"POST",credentials:"same-origin",headers:l,body:JSON.stringify({action:t,actionParams:r,...i?{clientRequestId:i}:{}})});let d={};try{d=await o.json()}catch{d={ok:!1,error:{code:"INVALID_INPUT",message:"操作响应不是合法 JSON"}}}return{status:o.status,body:d}}const BE=new Set(["runDag","dagRerun","dagReconcileRun","standaloneTaskRerun"]);function Gc(t){const r=(t.blockedReasons??[]).map(String),i=(t.blockingNodes??[]).map(o=>[o.nodeId,o.reasonCode].filter(Boolean).join(":")),l=[...r,...i].filter(Boolean);return l.length===0?"从节点重跑不具备安全资格(子图含 writer / unsafe shell / decision-gate 等)。可改用「完整重跑任务」,或另选只读安全子图的起始节点。":`从节点重跑不具备安全资格:${l.slice(0,6).join("; ")}${l.length>6?"…":""}。可改用「完整重跑任务」。`}async function Jg(t,r=9e4){const i=Date.now();for(;Date.now()-i<r;){const l=await fetch(`/api/operator/v1/operations/${encodeURIComponent(t)}`,{credentials:"same-origin"});if(!l.ok)return null;const o=await l.json(),d=o.operation??o,u=d.state??"";if(u==="succeeded"||u==="failed"||u==="needs-reconcile"||u==="timed-out")return d;await new Promise(h=>setTimeout(h,250))}return{state:"needs-reconcile",errorMessage:"等待操作结果超时"}}const HE={};function UE(){const[t,r]=k.useState(()=>ky({env:HE?.VITE_OPERATOR_CHAT_DEFAULT_LANDING,storage:window.localStorage,location:window.location})),[i,l]=k.useState(null),[o,d]=k.useState("setup-required"),[u,h]=k.useState(null),[g,p]=k.useState(null),[v,y]=k.useState(!1),[S,x]=k.useState(!1),[w,A]=k.useState(null),[M,O]=k.useState(null),[E,D]=k.useState(null),[G,K]=k.useState(null),[N,$]=k.useState({command:"idle",dag:"not-started",verification:"not-run",promote:"n/a (MVP)"}),[ne,ce]=k.useState("setup"),_=k.useCallback(B=>{ce(I=>zE(typeof B=="function"?B(I):B))},[]),F=o==="setup-required",Y=o==="degraded",oe=k.useCallback(B=>{B!==t&&(A(null),D(null),O(null)),r(B)},[t]),X=k.useCallback(async()=>{try{const I=await(await fetch("/api/health")).json();l(I);const H=I.piReadiness??"setup-required";d(H),p(null),_(H==="ready"||H==="degraded"?U=>U==="setup"?"import-prd":U:"setup")}catch(B){p(B instanceof Error?B.message:String(B))}try{const I=await(await fetch("/api/operator/v1/readiness")).json();h(I),I.state&&d(I.state)}catch{}},[_]);return{nav:t,setNav:r,selectNav:oe,health:i,readiness:o,setReadiness:d,readinessReport:u,healthError:g,loadHealth:X,busy:v,setBusy:y,observeBusy:S,setObserveBusy:x,opError:w,setOpError:A,opMessage:M,setOpMessage:O,opErrorCode:E,setOpErrorCode:D,lastOpState:G,setLastOpState:K,layers:N,setLayers:$,step:ne,setStep:_,setupBlocked:F,degraded:Y}}function qE(t){const{shell:r,applyInterviewPayload:i}=t,{setBusy:l,setOpError:o,setOpErrorCode:d,setOpMessage:u,setReadiness:h,setStep:g,setNav:p,setLastOpState:v,setLayers:y,step:S,nav:x}=r,[w,A]=k.useState(null),[M,O]=k.useState([]),[E,D]=k.useState(!0),G=k.useRef(null),[K,N]=k.useState(null),[$,ne]=k.useState(null),ce=k.useCallback(async(X,B={},I)=>{l(!0),o(null),d(null),u(null);try{const{status:H,body:U}=await Nd(X,B,I?.clientRequestId);if(H===412||U.error?.code==="PI_SETUP_REQUIRED")return o(Yi(U.error?.message??"Pi 未就绪或已降级:该操作暂不可用")),d(U.error?.code??"PI_SETUP_REQUIRED"),h("setup-required"),g("setup"),p("models"),U;if(H>=400||U.ok===!1)return o(Yi(U.error?.message??U.message??`操作失败(HTTP ${H})`)),d(U.error?.code??String(H)),v(U.state??`failed:${H}`),y(R=>({...R,command:U.error?.message??`failed:${U.error?.code??H}`})),U;if(U.operationId){const R=window.localStorage.getItem(Cn)?.trim();if(R&&fetch(`/api/operator/v1/chat/sessions/${encodeURIComponent(R)}/operation-links`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",[Mv]:Hv()},body:JSON.stringify({operationId:U.operationId})}).then(z=>{z.ok||console.warn("Operator Chat operation link failed",z.status)}).catch(z=>console.warn("Operator Chat operation link failed",z)),A(U.operationId),v(U.state??"accepted"),y(z=>({...z,command:U.state??"accepted",dag:X==="runDag"?"running":z.dag})),BE.has(X)){D(!0),u(`操作已接受,后台运行中:${U.operationId}(请看事件流;可同时打开 Observe)`);const z=U.operationId;Jg(z,30*6e4).then(C=>{if(C){if(v(C.state??null),C.state==="failed"||C.state==="needs-reconcile"||C.state==="timed-out"){o(Yi(C.errorMessage??C.stderrPreview??`操作失败:${C.state}`)),d(C.errorCode??C.state??null),y(ie=>({...ie,command:`failed:${C.errorCode??C.state}`}));return}C.state==="succeeded"&&(u(`${X} 已成功`),y(ie=>({...ie,command:"succeeded"})))}})}else{u(`操作已接受:${U.operationId}`);const z=await Jg(U.operationId);if(z){if(v(z.state??null),z.state==="failed"||z.state==="needs-reconcile"||z.state==="timed-out")return o(Yi(z.errorMessage??z.stderrPreview??`操作失败:${z.state}`)),d(z.errorCode??z.state??null),y(V=>({...V,command:`failed:${z.errorCode??z.state}`})),{ok:!1,operationId:U.operationId,state:z.state,error:{code:z.errorCode??z.state??"INTERNAL_ERROR",message:z.errorMessage??z.stderrPreview??`操作失败:${z.state}`}};u(z.errorMessage?`${X}:${z.errorMessage}`:`${X} 已成功`),y(V=>({...V,command:z.state??"succeeded"}));const C=z.result??{},ie={ok:!0,operationId:U.operationId,state:z.state??"succeeded",result:C};(X==="interviewStart"||X==="interviewTurn"||X==="interviewSkip")&&i(C);const fe=C.confirmation;return fe?.confirmationId&&(N(fe.confirmationId),ne(C)),I?.advanceTo&&g(I.advanceTo),ie}}}else u(`${X} 已完成`),v(U.state??"succeeded"),y(R=>({...R,command:"succeeded",verification:X==="contractValidate"||X==="spineCheck"?"ran":R.verification}));const re=U.result??{};(X==="interviewStart"||X==="interviewTurn"||X==="interviewSkip")&&i(re);const T=re.confirmation;return T?.confirmationId&&(N(T.confirmationId),ne(re)),I?.advanceTo&&g(I.advanceTo),U}catch(H){o(H instanceof Error?H.message:String(H));return}finally{l(!1)}},[i,l,o,d,u,h,g,p,v,y]),_=k.useCallback(X=>{if(!X)return"无响应";if(X.error?.message)return X.error.message;if(X.message)return X.message;const B=X.result;if(B&&typeof B=="object")try{return JSON.stringify(B).slice(0,1200)}catch{return"已返回结果"}return X.ok===!1?"失败":"成功"},[]),F=k.useCallback(X=>{if(!X||X.ok===!1||X.error)return!1;const B=X.result;if(!B)return!0;if(typeof B.valid=="boolean")return B.valid;const I=B.result;return I&&typeof I.valid=="boolean"?I.valid:!0},[]),Y=k.useCallback(async X=>{G.current?.abort();const B=new AbortController;G.current=B,O(I=>[...I,`开始跟随事件流 ${X}`]);try{const I=await fetch(`/api/operator/v1/operations/${encodeURIComponent(X)}/events`,{credentials:"same-origin",signal:B.signal});if(!I.ok||!I.body){O(T=>[...T,`事件流 HTTP ${I.status}`]);return}const H=I.body.getReader(),U=new TextDecoder;let re="";for(;E;){const{done:T,value:R}=await H.read();if(T)break;re+=U.decode(R,{stream:!0});const z=re.split(`
|
|
50
|
+
|
|
51
|
+
`);re=z.pop()??"";for(const C of z){const ie=C.split(`
|
|
52
|
+
`).find(V=>V.startsWith("data:"));if(!ie)continue;const fe=ie.slice(5).trim();O(V=>[...V.slice(-80),fe.slice(0,240)])}}}catch(I){I.name!=="AbortError"&&O(H=>[...H,`事件流错误:${I instanceof Error?I.message:String(I)}`])}},[E]);k.useEffect(()=>(w&&E&&(S==="run"||x==="recovery")&&Y(w),()=>G.current?.abort()),[w,E,S,x,Y]);const oe=k.useCallback(()=>{D(!1),G.current?.abort(),u("已停止跟随日志(未取消子进程)")},[u]);return{runAction:ce,summarizeEnvelope:_,isActionSuccess:F,operationId:w,setOperationId:A,sseLog:M,followSse:E,setFollowSse:D,stopFollowSse:oe,confirmationId:K,setConfirmationId:N,confirmationDetails:$,setConfirmationDetails:ne}}const id=8*1024*1024,GE=10*1024*1024,Vs=8,$E=".md,.markdown,.txt,text/markdown,text/plain",FE=[".md",".markdown",".txt"],Ad=/\.[^.]+$/;function VE(t){const r=Ad.exec(t.trim());return r?r[0].toLowerCase():""}function PE(t){const r=VE(t);return FE.includes(r)}function ad(t){if(!Number.isFinite(t)||t<0)return"0 B";if(t<1024)return`${t} B`;if(t<1024*1024){const i=t/1024;return`${i>=10?i.toFixed(0):i.toFixed(1)} KiB`}const r=t/(1024*1024);return`${r>=10?r.toFixed(1):r.toFixed(2)} MiB`}function tr(t,r){return{ok:!1,code:t,message:r}}function YE(t,r){const i=t?Array.from(t):[],l=r?.maxFiles??Vs,o=r?.existingCount??0;return i.length===0?tr("file-count","请选择至少一个 .md / .markdown / .txt 文件"):o+i.length>l?tr("file-count",`最多支持 ${l} 个文件(当前已有 ${o} 个)`):null}async function KE(t){const r=t.name?.trim()||"untitled.md";if(!PE(r))return tr("unsupported-extension","仅支持 .md、.markdown、.txt 文件");if(t.size>id)return tr("file-too-large",`文件不能超过 ${ad(id)}`);let i;try{i=await t.arrayBuffer()}catch{return tr("read-failed","文件读取失败,请重试或直接粘贴")}let l;try{l=new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{return tr("invalid-utf8","文件不是有效 UTF-8,请另存为 UTF-8")}if(l.trim().length===0)return tr("empty-content","文件内容不能为空或只有空白");const o=new TextEncoder().encode(l).byteLength;return{ok:!0,text:l,fileName:r,sourceBytes:t.size,textBytes:o}}async function XE(t){if(t.length===0)return tr("file-count","请选择至少一个 .md / .markdown / .txt 文件");if(t.length>Vs)return tr("file-count",`最多支持 ${Vs} 个文件`);const r=[];for(const i of t){const l=await KE(i);if(!l.ok)return l;r.push({fileName:l.fileName,text:l.text,sourceBytes:l.sourceBytes,textBytes:l.textBytes})}return{ok:!0,documents:r}}function QE(t,r){const i=t.split(/\r?\n/);for(const o of i){const d=/^(#{1,6})\s+(.+)$/.exec(o.trim());if(d?.[2])return d[2].trim()}for(const o of i){const d=o.trim();if(d&&!/^---+$/.test(d)&&!/^```/.test(d)&&!/^<!--/.test(d))return d.replace(/^>\s+/,"").slice(0,120)}return r.replace(Ad,"").trim()||"需求"}function ZE(t){return t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")||"requirement"}function JE(t,r){const i=t.replace(Ad,"").trim(),l=ZE(i);return l==="requirement"&&/[^\u0000-\u007f]/.test(i)?`part-${r+1}`:l==="requirement"?i?`part-${r+1}`:`part-${r+1}`:l}function WE(t){const r=new Set;return t.map((i,l)=>{let o=JE(i.fileName,l);if(r.has(o)){let d=2;for(;r.has(`${o}-${d}`);)d+=1;o=`${o}-${d}`}return r.add(o),{name:o,content:i.text,fileName:i.fileName}})}function eN(t,r){if(t.length===0)return"";if(t.length===1)return t[0].text;const i=Math.min(Math.max(0,r?.primaryIndex??0),t.length-1),l=t[i],o=QE(l.text,l.fileName),u=[`<!-- composed-from: ${t.map(h=>h.fileName).join(", ")} -->`,"",`# ${o}`,""];for(const h of t)u.push(`## 来源:${h.fileName}`,"",h.text.trim(),"");return`${u.join(`
|
|
53
|
+
`).trimEnd()}
|
|
54
|
+
`}function tN(t,r,i){const l={action:t,actionParams:r};return new TextEncoder().encode(JSON.stringify(l)).byteLength<=GE}function nN(){return"最终内容导致请求体超过服务端限制,请缩小文档或减少文件数量"}function rN(){const[t,r]=k.useState(""),[i,l]=k.useState([]),[o,d]=k.useState(0),[u,h]=k.useState(!1),[g,p]=k.useState(null),[v,y]=k.useState(!1),[S,x]=k.useState(!1),w=k.useRef(0),A=k.useRef(0),M=k.useCallback((F,Y)=>{const oe=F.length===0?0:Math.min(Math.max(0,Y),F.length-1);d(oe),r(eN(F,{primaryIndex:oe})),h(!1)},[]),O=k.useCallback(async F=>{const Y=YE(F,{existingCount:i.length});if(Y){p(Y.message);return}const oe=Array.from(F),X=++A.current;y(!0),p(null);try{const B=await XE(oe);if(X!==A.current)return;if(!B.ok){p(B.message);return}const I=[...i,...B.documents],H=i.length===0?0:o;l(I),i.length===0||!u?(M(I,H),p(null)):p("已追加文件,未改正文(正文已手动编辑);可点「按文件重新合成」覆盖。")}catch{if(X!==A.current)return;p("文件读取失败,请重试或直接粘贴")}finally{X===A.current&&y(!1)}},[M,u,i,o]),E=k.useCallback(F=>{r(F),i.length>0&&h(!0)},[i.length]),D=k.useCallback(F=>{d(F),u||M(i,F)},[M,u,i]),G=k.useCallback((F,Y)=>{const oe=F+Y,X=[...i],B=X[oe];X[oe]=X[F],X[F]=B;const I=o===F?oe:o===oe?F:o;l(X),d(I),u||M(X,I)},[M,u,i,o]),K=k.useCallback(F=>{const Y=i.filter((X,B)=>B!==F),oe=Y.length===0?0:Math.min(o>=F?Math.max(0,o-1):o,Math.max(0,Y.length-1));l(Y),d(oe),Y.length===0?h(!1):u||M(Y,oe)},[M,u,i,o]),N=k.useCallback(()=>{l([]),d(0),h(!1),p(null)},[]),$=k.useCallback(()=>{u&&!window.confirm("将用当前文件列表重新合成正文,覆盖你在编辑区的修改。继续?")||(M(i,o),p(null))},[M,u,i,o]),ne=k.useCallback((F,Y)=>{F.preventDefault(),F.stopPropagation(),!Y&&(w.current+=1,x(!0))},[]),ce=k.useCallback(F=>{F.preventDefault(),F.stopPropagation(),w.current=Math.max(0,w.current-1),w.current===0&&x(!1)},[]),_=k.useCallback((F,Y)=>{F.preventDefault(),F.stopPropagation(),w.current=0,x(!1),!Y&&O(F.dataTransfer.files)},[O]);return{prdText:t,setPrdText:r,onPrdTextChange:E,prdDocuments:i,prdPrimaryIndex:o,prdComposedDirty:u,prdFileError:g,setPrdFileError:p,prdFileReading:v,prdDragOver:S,loadPrdFromFiles:O,applyPrdComposition:M,setPrimaryDocument:D,moveDocument:G,removeDocument:K,clearDocuments:N,recomposeDocuments:$,onDragEnter:ne,onDragLeave:ce,onDrop:_}}const iN={report:{id:"report",label:"查看报告",action:"dagReport",lane:"dag",guide:"看失败分类与建议动作(交接报告摘要)",commandHint:"loop-agent dag report --run-id <run-id> --json"},doctor:{id:"doctor",label:"Doctor 诊断",action:"doctor",lane:"dag",guide:"只读诊断:检查 Console / Pi / 仓库就绪,不是重跑前置",commandHint:"agent-worker console doctor --repo ."},decision:{id:"decision",label:"人工决策",lane:"dag",guide:"暂停等人时:先看 doctor 输出再做决策(经 CLI)",commandHint:"loop-agent dag doctor --run-id <run-id> --markdown"},resume:{id:"resume",label:"恢复运行",lane:"dag",guide:"仅当运行可安全 resume 时使用(经 CLI)",commandHint:"loop-agent task advance <task-id> --json"},reconcile:{id:"reconcile",label:"对账 / reconcile",requiresReason:!0,action:"dagReconcileRun",lane:"dag",guide:"Orphan/中断时先对账归档(默认 supersede);runner 仍存活时勿盲 supersede",commandHint:"loop-agent dag reconcile-run --run-id <run-id> --action supersede --reason <structured-reason>"},regenerate:{id:"regenerate",label:"重新生成契约/计划",lane:"dag",guide:"契约/计划过期时:回任务页或经 CLI 重新 task advance(本页仅提示)",commandHint:"loop-agent task advance <task-id> --json"},observeLink:{id:"observeLink",label:"全屏观测",action:"observeLink",lane:"dag",guide:"打开完整 Inspect 画布;顶栏可返回操作台",commandHint:"agent-worker console --repo . --port 8790"},dagRerun:{id:"dagRerun",label:"从节点重跑",requiresReason:!0,action:"dagRerun",lane:"dag",guide:"终端失败默认首选:先 dagRerunPlan,plan 合格再 Human Gate 执行;provider 抖动/只读下游优先,勿无理由新开 task",commandHint:"loop-agent dag rerun --run-id <run-id> --from-node <node-id> --plan"},standaloneTaskRerun:{id:"standaloneTaskRerun",label:"完整重跑任务",requiresReason:!0,action:"standaloneTaskRerun",lane:"dag",guide:"整单重跑:仅当 from-node plan 不合格(writer/decision/fingerprint)或契约/源真变时;需确认原因",commandHint:"loop-agent dag rerun-task --run-id <run-id> --reason <text> --json"},workerTaskRetry:{id:"workerTaskRetry",label:"重新排队 Worker Task",requiresReason:!0,action:"workerTaskRetry",lane:"worker",guide:"仅 Worker 队列任务失败时使用,不要与 DAG 重跑混用",commandHint:"agent-worker task retry <task-id> --feature-id <feature-id> --repo . --reason <reason>"}},Wg={"validation-failed":["report","doctor","regenerate"],"contract-drift":["report","doctor","decision","reconcile","regenerate"],"runtime-mismatch":["report","doctor","reconcile","regenerate"],"pause-on-human":["decision","resume","report","doctor"],"verification-failed":["report","doctor","dagRerun","standaloneTaskRerun","resume","regenerate"],"orphan-unknown":["report","doctor"],"terminal-failed":["report","doctor","dagRerun","standaloneTaskRerun","workerTaskRetry","regenerate"],"terminal-succeeded":["report","observeLink"],"needs-reconcile":["report","doctor","reconcile","regenerate"]};function aN(t){return(Wg[t]??Wg["orphan-unknown"]).map(i=>iN[i])}function lN(t){const r=[],i=[];for(const l of t)l.lane==="worker"?i.push(l):r.push(l);return{dag:r,worker:i}}function sN(t){return typeof t.action=="string"&&t.action.trim().length>0}function Uv(t){return aN(t).filter(sN)}function oN(t){const r=new Set(Uv(t).map(l=>l.id)),i=(...l)=>{for(const o of l)if(r.has(o))return o;return null};switch(t){case"terminal-failed":case"verification-failed":return i("dagRerun","standaloneTaskRerun","doctor","report");case"pause-on-human":return i("doctor","report");case"needs-reconcile":return i("doctor","reconcile","report");case"runtime-mismatch":case"contract-drift":return i("doctor","report");case"validation-failed":return i("doctor","report");case"terminal-succeeded":return i("observeLink","report");default:return i("doctor","report")}}function uN(t){if(t.needsReconcile)return"needs-reconcile";const r=(t.errorCode??"").toLowerCase(),i=(t.operationState??"").toLowerCase(),l=(t.dagStatus??"").toLowerCase(),o=(t.failureCategory??"").toLowerCase();return r.includes("validation")||r.includes("invalid")||i.includes("validation")?"validation-failed":r.includes("contract")||r.includes("drift")||r.includes("binding")?"contract-drift":r.includes("runtime")||r.includes("mismatch")||r.includes("fingerprint")?"runtime-mismatch":r.includes("human")||i.includes("paused")||l.includes("paused")||i.includes("awaiting")?"pause-on-human":r.includes("verif")||i.includes("verif")?"verification-failed":o==="controller-interrupted"||r.includes("controller-interrupted")||r.includes("interrupted")||l==="interrupted"||l==="orphaned"||i.includes("controller-interrupted")||i.includes("interrupted")?"needs-reconcile":l==="running-suspected-stall"||l==="running-quiet"||l==="suspected-stall"||l.includes("suspected-stall")||i.includes("suspected-stall")?"orphan-unknown":i==="succeeded"||i==="completed"||i==="finished"||l==="succeeded"||l==="completed"||l==="finished"?"terminal-succeeded":i==="failed"||i.includes("fail")||l==="failed"||l==="partial_failed"||r.includes("fail")?"terminal-failed":r.includes("reconcil")||i.includes("reconcil")?"needs-reconcile":"orphan-unknown"}const Id=new Set(["failed","error","partial_failed"]),qv=new Set(["blocked","paused","awaiting_human"]);function Ws(t){return(t??"").trim().toLowerCase()}function cN(t){return Id.has(Ws(t))}function ey(t){const r=Ws(t.status);return Id.has(r)||r.includes("fail")?0:t.lifecycle==="paused"||r==="paused"?1:t.lifecycle==="active"?2:3}function dN(t){return[...t].sort((r,i)=>{const l=ey(r)-ey(i);return l!==0?l:i.mtimeMs-r.mtimeMs})}function fN(t){return dN(t)[0]?.dagRunId}function ty(t){const r=Ws(t.status);return Id.has(r)?0:qv.has(r)?1:2}function Gv(t){return[...t].sort((r,i)=>{const l=ty(r)-ty(i);return l!==0?l:r.nodeId.localeCompare(i.nodeId)})}function hN(t){const r=Gv(t);return r.find(l=>cN(l.status)||qv.has(Ws(l.status)))?.nodeId??r[0]?.nodeId}function mN(t){const r=t.status?.trim()||t.lifecycle;return`${t.dagRunId.length>36?`${t.dagRunId.slice(0,18)}…${t.dagRunId.slice(-8)}`:t.dagRunId} · ${r}`}function pN(t){const r=t.status?.trim()||"unknown",i=t.label?.trim();return i&&i!==t.nodeId?`${t.nodeId} · ${r} · ${i}`:`${t.nodeId} · ${r}`}function gN(t){const i=[`operator-recovery: ${t.actionLabel?.trim()||"恢复"}`],l=t.dagRunId?.trim();if(l){const h=t.runStatus?.trim();i.push(h?`run=${l} (${h})`:`run=${l}`)}const o=t.fromNodeId?.trim();if(o){const h=t.nodeStatus?.trim();i.push(h?`from-node=${o} (${h})`:`from-node=${o}`)}const d=t.factClassLabel?.trim();d&&i.push(`fact=${d}`);const u=t.nodeError?.trim()||t.errorMessage?.trim()||(t.errorCode?.trim()?`code=${t.errorCode.trim()}`:"");return u&&i.push(`detail=${u.replace(/\s+/g," ").slice(0,280)}`),i.join(`
|
|
55
|
+
`).slice(0,500)}function $v(t){const r=t.trim();return r?r==="operator-recovery"||r.startsWith("operator-recovery:")||r.startsWith("recovery:"):!0}function yN(t){const{shell:r,actions:i,taskId:l,dagRunId:o,fromNodeId:d,featureId:u,recoveryReason:h,recoveryReasonTouched:g,recoveryConfirm:p,recoveryPlanSummary:v,setRecoveryConfirm:y,setRecoveryPlanSummary:S,setRecoveryReport:x,setRecoveryReason:w,setRecoveryReasonTouched:A,buildCurrentRecoveryReason:M,openFullCanvas:O}=t,{setOpError:E,setOpErrorCode:D,setOpMessage:G,setBusy:K}=r,{runAction:N,isActionSuccess:$}=i,ne=k.useCallback(async _=>{if(_.requiresReason||(y(null),S(null)),_.action==="doctor"){x(null),N("doctor",{});return}if(_.action==="dagReport"||_.id==="report"){const F=o.trim();if(F){y(null),S(null);const Y=await N("dagReport",{runId:F}),oe=Y?.result??{},X=(oe.raw?.runs??oe.runs)?.[0];Y&&Y.ok!==!1&&!Y.error&&X&&(x({runId:X.runId??F,title:X.title,status:X.status,category:X.productLineFailureCategory,recommendation:X.recoveryRecommendation?.summary??X.recommendedFollowUp??void 0}),G(null));return}if(l.trim()){x(null),N("status",{taskId:l});return}E("查看报告需要先选择 DAG 运行 ID(或填写任务 ID)");return}if(_.action==="observeLink"){x(null),O();return}if(_.requiresReason){if(x(null),y(_),S(null),_.id!=="dagRerun"&&(E(null),D(null)),(!g||$v(h))&&(w(M(_.label)),A(!1)),_.id==="dagRerun"&&o.trim()&&d.trim()){K(!0);try{const{status:F,body:Y}=await Nd("dagRerunPlan",{runId:o.trim(),fromNode:d.trim()}),oe=Y.result??{};oe&&typeof oe=="object"&&("eligible"in oe||oe.planHash)&&S(oe),F<400&&Y.ok!==!1&&oe.eligible!==!1?G(null):oe.eligible===!1?E(Y.error?.message??Gc(oe)):G(Y.error?.message??"无法预检重跑计划;确认后仍将尝试提交(CLI 可能尚未就绪)")}finally{K(!1)}}return}E(null),D(null),G(`${_.label}:请经 CLI — ${_.commandHint??""}`)},[M,o,d,O,h,g,N,K,E,D,G,y,S,x,w,A,l]),ce=k.useCallback(async()=>{const _=p;if(!_)return;const F=h.trim();if(!F){E("恢复操作需要结构化原因");return}const Y=Fs(`recovery-${_.id}`);if(y(null),_.id==="dagRerun"){const oe=o.trim(),X=d.trim();if(!oe||!X){E("从节点重跑需要 DAG 运行 ID 与起始节点 ID");return}let B=v?.planHash?.trim(),I=v?.eligible;if(!B||I===void 0){const H=await N("dagRerunPlan",{runId:oe,fromNode:X}),U=H?.result??{};if((U.planHash||U.eligible!==void 0)&&S(U),B=U.planHash?.trim()||B,I=U.eligible,U.eligible===!1){E(H?.error?.message??Gc(U));return}if(H&&H.ok===!1&&!B){E(H.error?.message??"无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}}if(I===!1){E(Gc(v??{}));return}if(!B){E("无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}await N("dagRerun",{runId:oe,fromNode:X,planHash:B,reason:F},{clientRequestId:Y});return}if(_.id==="standaloneTaskRerun"){const oe=o.trim();if(!oe){E("完整重跑任务需要 DAG 运行 ID");return}const X={runId:oe,reason:F,...l.trim()?{taskId:l.trim()}:{}},B=await N("prepareMutationGate",{action:"standaloneTaskRerun",actionParams:X});if(!$(B))return;const I=B?.result??B;if(!I.receiptId||!I.humanGateToken){E("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await N("standaloneTaskRerun",{...X,confirmationId:I.receiptId,humanGateToken:I.humanGateToken},{clientRequestId:Y});return}if(_.id==="workerTaskRetry"){const oe=l.trim();if(!oe){E("重新排队 Worker Task 需要任务 ID");return}const X={taskId:oe,reason:F,...u.trim()?{featureId:u.trim()}:{}},B=await N("prepareMutationGate",{action:"workerTaskRetry",actionParams:X});if(!$(B))return;const I=B?.result??B;if(!I.receiptId||!I.humanGateToken){E("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await N("workerTaskRetry",{...X,confirmationId:I.receiptId,humanGateToken:I.humanGateToken},{clientRequestId:Y});return}if(_.id==="reconcile"){const oe=o.trim();if(!oe){E("对账恢复需要 DAG 运行 ID");return}const X={runId:oe,reason:F,reconcileAction:"supersede"},B=await N("prepareMutationGate",{action:"dagReconcileRun",actionParams:X});if(!$(B))return;const I=B?.result??B;if(!I.receiptId||!I.humanGateToken){E("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await N("dagReconcileRun",{...X,confirmationId:I.receiptId,humanGateToken:I.humanGateToken},{clientRequestId:Y});return}G(`${_.label}:请经 CLI — ${_.commandHint??""}`)},[o,u,d,p,v?.planHash,h,N,$,E,G,y,S,l]);return{handleRecoveryCta:ne,submitRecoveryConfirm:ce}}function vN(t){const{shell:r,actions:i,wizard:l}=t,{nav:o,opError:d,opErrorCode:u,lastOpState:h,setOpError:g,setObserveBusy:p}=r,{taskId:v}=l,[y,S]=k.useState(""),[x,w]=k.useState(""),[A,M]=k.useState(""),[O,E]=k.useState(""),[D,G]=k.useState(!1),[K,N]=k.useState(null),[$,ne]=k.useState(null),[ce,_]=k.useState([]),[F,Y]=k.useState([]),[oe,X]=k.useState(!1),[B,I]=k.useState(!1),[H,U]=k.useState(null),[re,T]=k.useState(null),[R,z]=k.useState(!1),[C,ie]=k.useState(!1),[fe,V]=k.useState(null),[ae,he]=k.useState("idle"),[me,ye]=k.useState(null),[Re,Ge]=k.useState(null),[Pe,ze]=k.useState(!1),Ze=k.useCallback(()=>y.trim()?`/inspect/#/dag/${encodeURIComponent(y.trim())}?from=recovery`:"/inspect/#/",[y]),yt=k.useCallback(()=>{window.location.assign(Ze())},[Ze]),wt=k.useCallback(async()=>{if(y.trim())return y.trim();const ge=v.trim();if(!ge)return g("打开 DAG 检视需要任务 ID 或 DAG 运行 ID"),null;p(!0),g(null);try{const{status:Me,body:je}=await Nd("observeLink",{taskId:ge}),we=je.result??{};if(Me>=400||je.ok===!1)return g(je.error?.message??"无法解析 DAG 画布地址"),he("unavailable"),ye(je.error?.message??null),null;const Fe=typeof we.dagRunId=="string"?we.dagRunId.trim():"";return Fe?(S(Fe),he("match"),ye(null),Ge(`/inspect/#/dag/${encodeURIComponent(Fe)}`),Fe):(g("尚未找到该任务的 DAG 运行,请稍后再打开检视"),he("unavailable"),ye(we.message??"未解析到 DAG run"),null)}catch(Me){return g(Me instanceof Error?Me.message:String(Me)),null}finally{p(!1)}},[y,v,g,p]),Rn=k.useCallback(async()=>{await wt()&&ze(!0)},[wt]),qt=k.useCallback(async()=>{const ge=await wt();ge&&window.location.assign(`/inspect/#/dag/${encodeURIComponent(ge)}?from=recovery`)},[wt]),Gt=k.useCallback(async()=>{X(!0);try{const ge=v.trim(),Me=new URLSearchParams;ge&&Me.set("taskId",ge),Me.set("limit","40");const je=await fetch(`/api/operator/v1/recovery/candidates?${Me.toString()}`,{credentials:"same-origin"});if(!je.ok){_([]);return}const we=await je.json();_(Array.isArray(we.runs)?we.runs:[])}catch{_([])}finally{X(!1)}},[v]),Te=k.useCallback(async ge=>{const Me=ge.trim();if(!Me){Y([]),U(null),T(null);return}I(!0);try{const je=await fetch(`/api/dag-runs/${encodeURIComponent(Me)}`,{credentials:"same-origin"});if(!je.ok){Y([]),U(null),T(null);return}const we=await je.json(),Fe=typeof we.effectiveStatus=="string"&&we.effectiveStatus||typeof we.status=="string"&&we.status||null;U(Fe);const Oe=Array.isArray(we.nodes)?we.nodes:[],Rt=Gv(Oe.map(ct=>{const Dr=(ct.nodeId??ct.id??"").trim();return Dr?{nodeId:Dr,status:ct.status,label:ct.label??ct.name,errorPreview:ct.errorPreview}:null}).filter(ct=>ct!==null));Y(Rt);const Tt=typeof we.failureCategory=="string"&&we.failureCategory||void 0,xn=Oe.find(ct=>typeof ct.failureCategory=="string"&&ct.failureCategory&&ct.failureCategory!=="success")?.failureCategory;T(Tt??xn??null)}catch{Y([]),U(null),T(null)}finally{I(!1)}},[]);k.useEffect(()=>{o==="recovery"&&Gt()},[o,v,Gt]),k.useEffect(()=>{if(o!=="recovery"||R||ce.length===0)return;const ge=y.trim(),Me=ge?ce.some(je=>je.dagRunId===ge):!1;if(!ge||!Me){const je=fN(ce);je&&je!==ge&&S(je)}},[o,ce,y,R]),k.useEffect(()=>{o==="recovery"&&Te(y)},[o,y,Te]),k.useEffect(()=>{if(o!=="recovery"||C||F.length===0)return;const ge=x.trim(),Me=ge?F.some(je=>je.nodeId===ge):!1;if(!ge||!Me){const je=hN(F);je&&je!==ge&&w(je)}},[o,F,x,C]);const $e=uN({operationState:H?null:h,errorCode:H?null:u,dagStatus:H,failureCategory:re}),ut=k.useMemo(()=>Uv($e),[$e]),Xe=k.useMemo(()=>lN(ut),[ut]),zt=k.useMemo(()=>oN($e),[$e]),te=k.useMemo(()=>F.find(ge=>ge.nodeId===x.trim()),[F,x]),de=k.useRef(null);k.useEffect(()=>{$&&de.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[$?.id]);const xe=k.useCallback(ge=>gN({actionLabel:ge,dagRunId:y.trim()||void 0,fromNodeId:x.trim()||void 0,runStatus:H,nodeStatus:te?.status,nodeError:te?.errorPreview,factClassLabel:Bv[$e],errorMessage:d,errorCode:u}),[y,x,d,u,$e,H,te?.errorPreview,te?.status]);k.useEffect(()=>{if(o!=="recovery"||D&&!$v(O))return;const ge=xe($?.label);ge&&ge!==O&&E(ge)},[o,y,x,H,te,$e,d,u,$?.label,D,O,xe]);const{handleRecoveryCta:Ee,submitRecoveryConfirm:J}=yN({shell:r,actions:i,taskId:v,dagRunId:y,fromNodeId:x,featureId:A,recoveryReason:O,recoveryReasonTouched:D,recoveryConfirm:$,recoveryPlanSummary:K,setRecoveryConfirm:ne,setRecoveryPlanSummary:N,setRecoveryReport:V,setRecoveryReason:E,setRecoveryReasonTouched:G,buildCurrentRecoveryReason:xe,openFullCanvas:qt});return{dagRunId:y,setDagRunId:S,fromNodeId:x,setFromNodeId:w,featureId:A,setFeatureId:M,recoveryReason:O,setRecoveryReason:E,recoveryReasonTouched:D,setRecoveryReasonTouched:G,recoveryPlanSummary:K,recoveryConfirm:$,setRecoveryConfirm:ne,setRecoveryPlanSummary:N,recoveryRuns:ce,recoveryNodes:F,recoveryRunsLoading:oe,recoveryNodesLoading:B,recoveryRunStatus:H,manualRunId:R,setManualRunId:z,manualNodeId:C,setManualNodeId:ie,recoveryReport:fe,setRecoveryReport:V,observeLinkStatus:ae,observeLinkMessage:me,observeUrl:Re,inspectSplitOpen:Pe,setInspectSplitOpen:ze,inspectPath:Ze,openFullInspect:yt,resolveDagRunForInspect:wt,openInspectSplit:Rn,openFullCanvas:qt,loadRecoveryRuns:Gt,loadRecoveryNodes:Te,recoveryFact:$e,recoveryCtas:ut,recoveryLanes:Xe,recommendedCtaId:zt,recoveryConfirmRef:de,buildCurrentRecoveryReason:xe,handleRecoveryCta:Ee,submitRecoveryConfirm:J}}function bN(t){const{shell:r,actions:i,prd:l}=t,{step:o,setStep:d,setOpMessage:u}=r,{runAction:h,isActionSuccess:g,summarizeEnvelope:p}=i,[v,y]=k.useState(""),[S,x]=k.useState(""),[w,A]=k.useState("standard"),[M,O]=k.useState(""),[E,D]=k.useState(""),[G,K]=k.useState(""),N=rd.find(Te=>Te.kind===w)??rd[0],[$,ne]=k.useState(null),[ce,_]=k.useState(null),[F,Y]=k.useState(""),[oe,X]=k.useState(null),[B,I]=k.useState(null),[H,U]=k.useState(null),[re,T]=k.useState(null),[R,z]=k.useState(null),[C,ie]=k.useState(!1),[fe,V]=k.useState(null),[ae,he]=k.useState(null),me=k.useRef(!1),ye=k.useCallback(()=>{U(null),T(null),z(null),ie(!1),V(null),he(null),me.current=!1},[]),Re=k.useCallback(()=>{ye(),d("contract")},[ye,d]),Ge=k.useCallback(Te=>{const $e=Te.session;$e?.sessionId&&ne($e.sessionId);const ut=Te.question;_(ut),X(Te.summary??null);const Xe=Te.assessmentId;typeof Xe=="string"&&Xe&&I(Xe),(Te.complete===!0||typeof Xe=="string"&&Xe)&&(Re(),u(Te.skipped===!0?"已跳过访谈:已按推荐补齐草稿并签发评估":"访谈已完成:草稿已绑定完整评估结果"))},[Re,u]),Pe=k.useCallback(async(Te=!1)=>{const $e=v.trim();if(!$e)return;const ut=`${$e}:${B??""}`;if(!(!Te&&ae===ut&&H!==null)&&!me.current){me.current=!0,U(null),T(null),z(null),V(null),ie(!1);try{const Xe=await h("contractValidate",{taskId:$e}),zt=g(Xe);if(U(zt),T(p(Xe)),!zt){he(ut),u("契约校验未通过:请先修正草稿后再应用");return}const te=await h("contractDiff",{taskId:$e});z(p(te)),he(ut),u(g(te)?"校验与差异已就绪:确认后可应用契约":"校验通过,但差异查询失败(仍可查看下方摘要)")}finally{me.current=!1}}},[B,ae,H,g,h,u,p,v]),ze=k.useCallback(async()=>{const Te=v.trim();if(!Te||!B)return;const $e=await h("contractApply",{taskId:Te,assessmentId:B},{clientRequestId:Fs("apply")});if(!g($e)){ie(!1);return}ie(!0);const ut=await h("spineCheck",{taskId:Te});if(g(ut)){V(!0),d("dag-confirm"),u("契约已应用并通过 Spine 审计,可生成并运行 DAG");return}V(!1),u("契约已应用,但 Spine 审计未通过:可重试 Spine")},[B,g,h,u,d,v]),Ze=k.useCallback(async()=>{const Te=v.trim();if(!Te)return;const $e=await h("spineCheck",{taskId:Te});if(g($e)){V(!0),d("dag-confirm"),u("Spine 审计已通过,可生成并运行 DAG");return}V(!1)},[g,h,u,d,v]),yt=k.useCallback(async()=>{const Te=i.confirmationId?.trim();if(!Te)return;const $e=i.confirmationDetails?.confirmation?.humanGateToken,ut=await h("confirmDagConfirmation",{confirmationId:Te,humanGateToken:$e});g(ut)&&(d("run"),await h("runDag",{confirmationId:Te},{clientRequestId:Fs("run")}))},[i.confirmationId,i.confirmationDetails,g,h,d]);k.useEffect(()=>{o==="contract"&&v.trim()&&Pe(!1)},[o,v,B,Pe]);const wt=k.useCallback(Te=>Te.split(/[\n,;,;]+/).map($e=>$e.trim()).filter(Boolean),[]),Rn=k.useCallback(async()=>{const Te=l.prdDocuments.length>0?WE(l.prdDocuments):void 0,$e=wt(M),ut=wt(E),Xe=wt(G),zt={content:l.prdText,taskKind:w,...Te?{documents:Te}:{},...$e.length>0?{allowedPaths:$e}:{},...ut.length>0?{forbiddenPaths:ut}:{},...Xe.length>0?{verifyCommands:Xe}:{}};if(!tN("bootstrapFromPrd",zt)){l.setPrdFileError(nN());return}const te=await h("bootstrapFromPrd",zt);if(!te||te.ok===!1)return;const de=te.result??{};de.taskId&&y(de.taskId),de.title&&x(de.title);const xe=de.parseStatus??"pending",Ee=de.draftPreview?.objective?.trim(),J=Array.isArray(de.gaps)?de.gaps.length:0,ge=de.semanticIntake?.applied?"semantic":de.semanticIntake?.code??"no-semantic";u([`已创建任务「${de.title??""}」(${de.taskId??""})`,`来源:${de.identitySource??"prd"}`,`解析:${xe}(${ge})`,Ee?`目标:${Ee.slice(0,120)}`:null,J>0?`缺口 ${J} 项待确认`:null].filter(Boolean).join(" · ")),d("interview")},[M,E,l,h,u,d,wt,w,G]),qt=[{id:"setup",label:"就绪检查"},{id:"import-prd",label:"导入需求"},{id:"interview",label:"需求访谈(可跳过)"},{id:"contract",label:"契约落地"},{id:"dag-confirm",label:"确认 DAG"},{id:"run",label:"运行"}],Gt=qt.findIndex(Te=>Te.id===o);return{taskId:v,setTaskId:y,taskTitle:S,taskKind:w,setTaskKind:A,engineering:{allowedPathsText:M,forbiddenPathsText:E,verifyCommandsText:G},setEngineering:Te=>{Te.allowedPathsText!==void 0&&O(Te.allowedPathsText),Te.forbiddenPathsText!==void 0&&D(Te.forbiddenPathsText),Te.verifyCommandsText!==void 0&&K(Te.verifyCommandsText)},workflowMeta:N,sessionId:$,question:ce,answerText:F,setAnswerText:Y,draftSummary:oe,assessmentId:B,contractValidateOk:H,contractValidateSummary:re,contractDiffSummary:R,contractApplied:C,spineOk:fe,applyInterviewPayload:Ge,runContractPreflight:Pe,applyContractThenSpine:ze,retrySpineOnly:Ze,confirmAndRunDag:yt,importPrdAndCreate:Rn,wizardSteps:qt,stepIndex:Gt}}const xN={chat:"对话",tasks:"任务",recovery:"恢复",night:"夜间",models:"模型与认证",settings:"设置"};async function SN(t){return await import(t)}function kN(t){const r=t.repoName?.trim();if(r)return r;const i=(t.repoRoot??"").split(/[\\/]/).filter(Boolean);return i.length?i[i.length-1]:"repository"}function wN(t){const{nav:r,readiness:i,setupBlocked:l,degraded:o,health:d,inspectHref:u}=t,h=l||o?"models":"settings",g=l?"Pi SDK / 认证 / 模型未就绪。不提供纯表单兜底。点击前往模型与认证。":o?"Pi 暂时降级:仍可恢复草稿与需求访谈。点击查看详情。":"Pi 已就绪。点击打开设置查看详情。";return{mode:"operate",activeTabHref:`#/${r}`,operateHref:"/#/",inspectHref:u,freshness:!1,readinessState:i,readinessHref:`#/${h}`,readinessTitle:g,repo:d?{name:kN(d),fingerprint:d.repoFingerprint??"",version:d.packageVersion??"",product:d.productName??d.product??"",inspectReady:d.inspect?.ready}:null}}function CN(t){const r=k.useRef(null),i=k.useRef(null),[l,o]=k.useState(!1),d=k.useMemo(()=>wN(t),[t.nav,t.readiness,t.setupBlocked,t.degraded,t.health,t.inspectHref]),u=k.useRef(d);return u.current=d,k.useEffect(()=>{let h=!1;return SN("/inspect/operator-chrome.js").then(g=>{h||!r.current||(i.current=g.mountOperatorChrome(r.current,u.current))}).catch(()=>{h||o(!0)}),()=>{h=!0,i.current?.destroy(),i.current=null}},[]),k.useEffect(()=>{i.current?.update(d)},[d]),c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:r,"data-testid":"operator-chrome"}),l?c.jsxs("nav",{className:"operator-chrome-fallback","aria-label":"操作工作区",children:[c.jsx("button",{type:"button",onClick:()=>window.location.assign("/#/"),children:"Loop Agent"}),c.jsx("button",{type:"button",onClick:()=>window.location.assign(`#/${t.nav}`),children:xN[t.nav]}),c.jsx("button",{type:"button",onClick:()=>window.location.assign(t.inspectHref),children:"观测"}),c.jsx("span",{role:"status",children:"共享导航加载失败,请刷新页面"})]}):null]})}function jN(t){return c.jsxs(c.Fragment,{children:[t.opError?c.jsxs("div",{className:"flash flash-error","data-testid":"op-error",children:[c.jsx("span",{className:"flash-label",children:"错误"}),c.jsx("p",{className:"flash-body",children:t.opError})]}):null,t.opMessage?c.jsxs("div",{className:"flash flash-info","data-testid":"op-message",children:[c.jsx("span",{className:"flash-label",children:"状态"}),c.jsx("p",{className:"flash-body",children:t.opMessage})]}):null]})}const RN=[{key:"sdkAvailable",detailKey:"sdkMessage",label:"Pi SDK",hint:"Node 侧 Pi SDK 可加载"},{key:"authReady",detailKey:"authMessage",label:"认证凭据",hint:"Pi auth / provider 密钥已配置"},{key:"modelsAvailable",detailKey:"modelsMessage",label:"可用模型",hint:"harness.json executors.pi(LOW/MED/HIGH)可在 Pi 凭据面解析"},{key:"interviewSessionOk",detailKey:"sessionMessage",label:"访谈会话",hint:"Interview 会话预检通过"}];function TN(t){if(!t)return null;const r=Date.parse(t);return Number.isNaN(r)?t:new Date(r).toLocaleString()}function EN(t){const r=t.readinessReport?.state??t.readiness,i=t.readinessReport?.probe,l=i?.details??{},o=t.readinessReport?.blockedActions??[],d=TN(t.readinessReport?.generatedAt),u=t.readinessReport??{state:t.readiness,health:t.health};return c.jsxs("section",{className:"panel models-page","aria-labelledby":"models-title",children:[c.jsxs("div",{className:"models-header",children:[c.jsx("h2",{id:"models-title",children:"模型与认证"}),c.jsx("span",{className:"models-status-pill","data-state":r,"data-testid":"models-readiness-pill",children:_v[r]??r})]}),c.jsxs("p",{className:"panel-lead",children:["复用 Pi ModelRuntime 凭据平面;密钥不会回传到页面。请用"," ",c.jsx("code",{children:"pi"})," 或 Pi 认证存储完成配置,然后刷新就绪探测。"]}),c.jsxs("section",{className:"models-probe-card","aria-labelledby":"models-probe-title","data-testid":"readiness-details",children:[c.jsx("h3",{id:"models-probe-title",className:"models-subtitle",children:"就绪检查"}),c.jsx("ul",{className:"models-probe-list",children:RN.map(h=>{const g=i?.[h.key],p=l[h.detailKey],v=g===void 0;return c.jsxs("li",{className:`models-probe-item${v?" is-pending":g?" is-ok":" is-bad"}`,children:[c.jsx("span",{className:"models-probe-badge","aria-label":v?"未探测":g?"通过":"未通过",children:v?"—":g?"✓":"✕"}),c.jsxs("div",{className:"models-probe-body",children:[c.jsx("strong",{children:h.label}),c.jsx("span",{className:"muted",children:h.hint}),p?c.jsx("p",{className:"models-probe-detail",children:p}):null]})]},h.key)})})]}),r==="setup-required"?c.jsxs("div",{className:"models-setup-card","data-testid":"models-setup-hint",children:[c.jsx("h3",{className:"models-subtitle",children:"如何完成配置"}),c.jsxs("ol",{className:"models-setup-steps",children:[c.jsxs("li",{children:["在终端配置 Pi 认证(例如 ",c.jsx("code",{children:"pi auth login"}),")或写入 provider API key。"]}),c.jsxs("li",{children:["确认 agent 目录下 ",c.jsx("code",{children:"models.json"})," / 认证文件可读。"]}),c.jsx("li",{children:"点击下方「刷新就绪探测」,或运行诊断命令查看详情。"})]}),c.jsx("pre",{className:"cmd",children:zv})]}):null,r==="degraded"?c.jsx("p",{className:"models-degraded-note","data-testid":"models-degraded-note",children:"Pi 暂时降级:仍可恢复草稿与需求访谈;部分写入/运行类操作会被拦截。"}):null,o.length>0?c.jsxs("div",{className:"models-blocked-card",children:[c.jsx("h3",{className:"models-subtitle",children:"当前受限操作"}),c.jsx("ul",{className:"models-blocked-list",children:o.map(h=>c.jsx("li",{children:c.jsx("code",{children:h})},h))})]}):null,c.jsxs("div",{className:"models-actions",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:t.busy,onClick:t.onRefreshReadiness,children:"刷新就绪探测"}),d?c.jsxs("span",{className:"muted models-generated-at",children:["上次探测:",d]}):null]}),c.jsxs("details",{className:"models-raw-details",children:[c.jsx("summary",{children:"查看原始探测数据(调试)"}),c.jsx("pre",{className:"cmd models-raw-json",children:JSON.stringify(u,null,2)})]})]})}function ny(t){const{lane:r,cta:i,planSummary:l,reason:o,busy:d,confirmRef:u}=t;return!i||i.lane!==r?null:c.jsxs("div",{ref:u,className:"recovery-confirm","data-testid":"recovery-confirm",children:[c.jsxs("h3",{children:["待确认:",i.label]}),c.jsx("p",{className:"muted",children:"请核对上方运行 / 节点与恢复原因,再点「确定」执行。"}),l?c.jsxs("div",{className:"recovery-plan-summary",children:[c.jsxs("p",{className:"muted",children:["计划 eligible=",String(l.eligible??"—")," · 风险=",Lv[l.risk??""]??l.risk??"—"]}),l.effectiveFromNodeId?c.jsxs("p",{className:"muted",children:["有效起点:",l.effectiveFromNodeId]}):null,l.estimatedExecution?c.jsxs("p",{className:"muted",children:["将执行 ",l.estimatedExecution.nodeCount??"?"," 个节点 / ",l.estimatedExecution.piCallCount??"?"," 次 Pi;预计避免"," ",l.estimatedExecution.avoidedNodeCount??"?"," 个节点"]}):null,l.planHash?c.jsxs("p",{className:"muted",children:["planHash: ",c.jsxs("code",{children:[l.planHash.slice(0,16),"…"]})]}):null]}):i.id==="dagRerun"?c.jsx("p",{className:"muted",children:"未加载计划摘要;点「确定」前将再次尝试资格检查。"}):null,c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:d||!o.trim(),"data-testid":"recovery-confirm-submit",onClick:t.onSubmit,children:"确定"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:d,"data-testid":"recovery-confirm-cancel",onClick:t.onCancel,children:"取消"})]})]})}function NN(t){const{shell:r,recovery:i,wizard:l}=t,{busy:o}=r,d={planSummary:i.recoveryPlanSummary,reason:i.recoveryReason,busy:o,confirmRef:i.recoveryConfirmRef,onSubmit:()=>{i.submitRecoveryConfirm()},onCancel:()=>{i.setRecoveryConfirm(null),i.setRecoveryPlanSummary(null)}};return c.jsxs("section",{className:"panel","aria-labelledby":"recovery-title",children:[c.jsx("h2",{id:"recovery-title",children:"恢复"}),c.jsxs("p",{className:"muted",children:["事实分类:",Bv[i.recoveryFact]," · 无 Cancel · 无「直接改代码」"]}),c.jsxs("ol",{className:"muted recovery-steps",children:[c.jsx("li",{children:"上方选 DAG 运行 / 节点,用「DAG 运行恢复」动作"}),c.jsx("li",{children:"Worker 队列失败才用下方「Worker Task 重排队」(二者不要混用)"}),c.jsx("li",{children:"带 * 的动作:核对预填原因 → 点下方「确定」"})]}),c.jsxs("p",{className:"muted",children:[l.taskId.trim()?`按任务 ${l.taskId.trim()} 拉取候选。`:"未填任务 ID 时列出最近 DAG 运行。","Doctor 诊断可选,不是重跑前置。"," ",c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o||i.recoveryRunsLoading,"data-testid":"recovery-refresh-candidates",onClick:()=>{i.loadRecoveryRuns()},children:i.recoveryRunsLoading?"刷新中…":"刷新候选"})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"DAG 运行 ID"}),!i.manualRunId&&i.recoveryRuns.length>0?c.jsxs("select",{"data-testid":"recovery-run-select",value:i.dagRunId,disabled:o||i.recoveryRunsLoading,onChange:u=>{i.setManualRunId(!1),i.setManualNodeId(!1),i.setFromNodeId(""),i.setDagRunId(u.target.value),i.recoveryReasonTouched||i.setRecoveryReasonTouched(!1)},children:[i.recoveryRuns.some(u=>u.dagRunId===i.dagRunId)?null:c.jsx("option",{value:i.dagRunId||"",children:i.dagRunId?`${i.dagRunId}(当前)`:"— 请选择 —"}),i.recoveryRuns.map(u=>c.jsx("option",{value:u.dagRunId,children:mN(u)},u.dagRunId))]}):c.jsx("input",{"data-testid":"recovery-run-input",value:i.dagRunId,disabled:o,onChange:u=>{i.setManualRunId(!0),i.setDagRunId(u.target.value.trim())},placeholder:"dag-run-id(子图/完整重跑)"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o,"data-testid":"recovery-run-manual-toggle",onClick:()=>{if(!i.manualRunId&&i.recoveryRuns.length>0){i.setManualRunId(!0);return}i.setManualRunId(!1),i.loadRecoveryRuns()},children:!i.manualRunId&&i.recoveryRuns.length>0?"手动输入运行 ID":"刷新并改用下拉"})]}),c.jsxs("label",{className:"field",children:[c.jsxs("span",{className:"muted",children:["起始节点 ID(从节点重跑)",i.recoveryNodesLoading?" · 加载节点…":""]}),!i.manualNodeId&&i.recoveryNodes.length>0?c.jsxs("select",{"data-testid":"recovery-node-select",value:i.fromNodeId,disabled:o||i.recoveryNodesLoading,onChange:u=>{i.setManualNodeId(!1),i.setFromNodeId(u.target.value)},children:[i.recoveryNodes.some(u=>u.nodeId===i.fromNodeId)?null:c.jsx("option",{value:i.fromNodeId||"",children:i.fromNodeId?`${i.fromNodeId}(当前)`:"— 请选择 —"}),i.recoveryNodes.map(u=>c.jsx("option",{value:u.nodeId,children:pN(u)},u.nodeId))]}):c.jsx("input",{"data-testid":"recovery-node-input",value:i.fromNodeId,disabled:o,onChange:u=>{i.setManualNodeId(!0),i.setFromNodeId(u.target.value.trim())},placeholder:"例如 review-verdict-recovery-pi"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o,"data-testid":"recovery-node-manual-toggle",onClick:()=>{if(!i.manualNodeId&&i.recoveryNodes.length>0){i.setManualNodeId(!0);return}i.setManualNodeId(!1),i.loadRecoveryNodes(i.dagRunId)},children:!i.manualNodeId&&i.recoveryNodes.length>0?"手动输入节点 ID":"刷新并改用下拉"})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"恢复原因(已按 run/节点失败事实自动预填,可编辑)"}),c.jsx("textarea",{"data-testid":"recovery-reason",value:i.recoveryReason,disabled:o,rows:4,onChange:u=>{i.setRecoveryReasonTouched(!0),i.setRecoveryReason(u.target.value)},placeholder:"将自动预填 operator-recovery / run / from-node / detail"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:o,"data-testid":"recovery-reason-refresh",onClick:()=>{i.setRecoveryReasonTouched(!1),i.setRecoveryReason(i.buildCurrentRecoveryReason(i.recoveryConfirm?.label))},children:"重新预填原因"})]}),c.jsxs("div",{className:"recovery-lane","data-testid":"recovery-lane-dag",children:[c.jsx("h3",{children:"DAG 运行恢复"}),c.jsx("p",{className:"muted",children:"针对 `.harness/dag-runs` 的 Agent DAG 运行。橙色为当前建议;带 * 需确认原因。"}),c.jsxs("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row-dag",children:[i.recoveryLanes.dag.map(u=>{const h=u.id===i.recommendedCtaId;return c.jsxs("button",{type:"button",className:h?"btn btn-primary":"btn btn-secondary",disabled:o,title:u.guide,"aria-pressed":i.recoveryConfirm?.id===u.id?!0:void 0,"data-testid":`recovery-cta-${u.id}`,"data-recommended":h?"true":void 0,onClick:()=>{i.handleRecoveryCta(u)},children:[u.label,u.requiresReason?" *":""]},u.id)}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:!i.dagRunId.trim(),"data-testid":"recovery-dag-preview",title:"在本页侧栏预览,可关闭返回",onClick:()=>{if(!i.dagRunId.trim()){r.setOpError("侧栏预览需要先选择 DAG 运行 ID");return}i.setInspectSplitOpen(!0)},children:"侧栏预览"})]}),i.recoveryReport?c.jsxs("div",{className:"recovery-report","data-testid":"recovery-report",children:[c.jsxs("div",{className:"recovery-report-header",children:[c.jsx("h3",{children:"交接报告摘要"}),c.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"recovery-report-close",onClick:()=>i.setRecoveryReport(null),children:"关闭"})]}),c.jsxs("dl",{className:"recovery-report-facts",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"运行"}),c.jsx("dd",{children:c.jsx("code",{children:i.recoveryReport.runId})})]}),i.recoveryReport.title?c.jsxs("div",{children:[c.jsx("dt",{children:"标题"}),c.jsx("dd",{children:i.recoveryReport.title})]}):null,c.jsxs("div",{children:[c.jsx("dt",{children:"状态"}),c.jsx("dd",{children:i.recoveryReport.status??"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"失败分类"}),c.jsx("dd",{children:i.recoveryReport.category??"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"建议"}),c.jsx("dd",{children:i.recoveryReport.recommendation??"暂无结构化建议"})]})]}),c.jsxs("p",{className:"muted",children:["完整 Markdown 可用 CLI:",c.jsxs("code",{children:["loop-agent dag report --run-id"," ",i.recoveryReport.runId," --markdown"]})]})]}):null,c.jsx(ny,{lane:"dag",cta:i.recoveryConfirm,...d})]}),c.jsxs("div",{className:"recovery-lane","data-testid":"recovery-lane-worker",children:[c.jsx("h3",{children:"Worker Task 重排队"}),c.jsx("p",{className:"muted",children:"针对 agent-worker Task Pool,不是 DAG run。需要 Task ID;Feature ID 可选。"}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"Task ID(Worker 重排队必填)"}),c.jsx("input",{"data-testid":"recovery-worker-task-id",value:l.taskId,disabled:o,onChange:u=>l.setTaskId(u.target.value.trim()),placeholder:"harness / worker task-id"})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"Feature ID(可选)"}),c.jsx("input",{"data-testid":"recovery-feature-id",value:i.featureId,disabled:o,onChange:u=>i.setFeatureId(u.target.value.trim()),placeholder:"feature-id"})]}),c.jsx("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row-worker",children:i.recoveryLanes.worker.length>0?i.recoveryLanes.worker.map(u=>c.jsxs("button",{type:"button",className:u.id===i.recommendedCtaId?"btn btn-primary":"btn btn-secondary",disabled:o,title:u.guide,"data-testid":`recovery-cta-${u.id}`,"data-recommended":u.id===i.recommendedCtaId?"true":void 0,onClick:()=>{i.handleRecoveryCta(u)},children:[u.label,u.requiresReason?" *":""]},u.id)):c.jsx("p",{className:"muted","data-testid":"recovery-worker-unavailable",children:"当前事实分类下不提供 Worker 重排队。"})}),c.jsx(ny,{lane:"worker",cta:i.recoveryConfirm,...d})]}),c.jsx("div",{className:"recovery-cta-row","data-testid":"recovery-cta-row",hidden:!0,children:i.recoveryCtas.map(u=>c.jsx("span",{children:u.id},u.id))}),i.observeLinkMessage?c.jsxs("p",{className:"muted",children:["[",_E[i.observeLinkStatus],"]"," ",i.observeLinkMessage]}):null,i.observeUrl?c.jsx("p",{className:"muted",children:c.jsx("a",{className:"external-link",href:i.observeUrl,children:i.observeUrl})}):null]})}function AN(t){const{health:r,readiness:i,healthError:l,layers:o,setupBlocked:d,degraded:u}=t;return c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"panel","aria-labelledby":"settings-title",children:[c.jsx("h2",{id:"settings-title",children:"设置"}),c.jsxs("dl",{className:"kv",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"产品"}),c.jsx("dd",{children:r?.productName??"Loop Operator Console"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"仓库根目录"}),c.jsx("dd",{children:c.jsx("code",{children:r?.repoRoot??"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"仓库指纹"}),c.jsx("dd",{children:c.jsx("code",{title:r?.repoFingerprint??void 0,children:r?.repoFingerprint?`${r.repoFingerprint.slice(0,12)}…`:"—"})})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Pi 就绪"}),c.jsxs("dd",{children:[c.jsxs("code",{children:[_v[i]??i,"(",i,")"]}),d?c.jsx("p",{className:"muted",children:"Pi SDK / 认证 / 模型未就绪。不提供纯表单兜底。请前往「模型与认证」。"}):u?c.jsx("p",{className:"muted",children:"Pi 暂时降级:仍可恢复草稿与需求访谈。"}):null]})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Inspect"}),c.jsxs("dd",{children:[c.jsx("code",{children:"/inspect/"}),"(同一 Console 进程)"]})]})]}),l?c.jsx("p",{className:"error",children:l}):null]}),c.jsxs("section",{className:"panel","aria-labelledby":"layers-title",children:[c.jsx("h2",{id:"layers-title",children:"完成语义分层"}),c.jsx("p",{className:"muted",children:"MVP 不执行收尾提交;不显示「任务已关闭/已交付」。"}),c.jsxs("dl",{className:"kv","data-testid":"completion-layers",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"命令"}),c.jsx("dd",{children:Ns(o.command)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"DAG 生命周期"}),c.jsx("dd",{children:Ns(o.dag)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"最终验证"}),c.jsx("dd",{children:Ns(o.verification)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"晋升"}),c.jsx("dd",{children:Ns(o.promote)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"任务关闭"}),c.jsx("dd",{children:"不可用(MVP)"})]})]})]})]})}function IN(t){const{busy:r,degraded:i,taskId:l,assessmentId:o,contractValidateOk:d,contractValidateSummary:u,contractDiffSummary:h,contractApplied:g,spineOk:p,onRerunPreflight:v,onApplyContract:y,onRetrySpine:S}=t;return c.jsxs("div",{"data-testid":"panel-contract",children:[c.jsx("h3",{children:"契约落地"}),c.jsx("p",{className:"muted",children:"进入本步后自动跑确定性校验与差异(非 AI 代判)。写入仓库仍需你人工确认一次;应用成功后会自动跑 Spine 审计。"}),c.jsxs("p",{className:"muted",children:["评估 ID: ",c.jsx("code",{children:o??"—"})]}),c.jsxs("div",{className:"contract-checks",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"校验"}),":"," ",d===null?r?"进行中…":"等待开始":d?"通过":"未通过"]}),u?c.jsx("pre",{className:"cmd","data-testid":"contract-validate-summary",children:u}):null,c.jsxs("p",{children:[c.jsx("strong",{children:"差异"}),h?"":":尚未拉取"]}),h?c.jsx("pre",{className:"cmd","data-testid":"contract-diff-summary",children:h}):null,g?c.jsxs("p",{children:[c.jsx("strong",{children:"Spine"}),":"," ",p===null?"待检查":p?"通过":"未通过"]}):null]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:r||!l.trim(),onClick:v,children:"重新校验"}),c.jsx("button",{type:"button",className:"btn btn-primary","data-testid":"contract-apply",disabled:r||i||!o||d!==!0||g,onClick:y,children:"确认并应用契约"}),g&&p===!1?c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:S,children:"重试 Spine"}):null]})]})}function DN(t){const{busy:r,taskId:i,confirmationId:l,confirmationDetails:o,runAction:d,onConfirmAndRun:u}=t;return c.jsxs("div",{"data-testid":"panel-dag-confirm",children:[c.jsx("h3",{children:"DAG 确认(§5.5)"}),c.jsxs("ul",{className:"checklist",children:[c.jsx("li",{children:"源绑定(source)"}),c.jsx("li",{children:"Writer 写集范围(writer-scope)"}),c.jsx("li",{children:"验证命令(verification)"}),c.jsx("li",{children:"人工门禁(human-gates)"})]}),o?c.jsx("pre",{className:"cmd",children:JSON.stringify(o,null,2).slice(0,4e3)}):null,c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:()=>{d("prepareDagConfirmation",{taskId:i,dagHandle:`${i}.dag.json`,profile:"auto"})},children:"生成 DAG 并准备确认"}),c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!l,onClick:u,children:"开始运行"})]}),l?c.jsxs("p",{className:"muted",children:["确认 ID: ",c.jsx("code",{children:l})]}):null]})}function ON(t){const{busy:r,taskKind:i,onTaskKindChange:l,workflowHint:o,prd:d,engineering:u,onEngineeringChange:h,onImport:g}=t,p=r||d.prdFileReading;return c.jsxs("div",{"data-testid":"panel-import-prd",children:[c.jsx("h3",{children:"导入需求"}),c.jsx("p",{className:"muted",children:"粘贴、选择或拖入一份或多份 PRD / 需求 Markdown。多文件会分别归档到 source/references,并合成一份可编辑正文。创建前可继续编辑。 系统会对 PRD 做确定性/语义结构化;工程边界(路径与验证)须人类确认,不会由模型编造。"}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"流程类型"}),c.jsx("select",{"data-testid":"workflow-kind-select",value:i,disabled:r||d.prdFileReading,onChange:v=>l(v.target.value),children:rd.map(v=>c.jsx("option",{value:v.kind,children:v.label},v.kind))})]}),c.jsxs("p",{className:"workflow-hint","data-testid":"workflow-kind-hint",children:[o," · taskKind=",c.jsx("code",{children:i})]}),c.jsxs("div",{className:`prd-drop-zone${d.prdDragOver?" is-dragover":""}`,"data-testid":"prd-drop-zone","data-dragover":d.prdDragOver?"true":"false",onDragEnter:v=>d.onDragEnter(v,p),onDragOver:v=>{v.preventDefault(),v.stopPropagation()},onDragLeave:d.onDragLeave,onDrop:v=>d.onDrop(v,p),children:[c.jsxs("div",{className:"prd-upload-toolbar",children:[c.jsxs("label",{className:`btn btn-ghost prd-upload-btn${p?" is-disabled":""}`,children:["选择需求文档",c.jsx("input",{type:"file",accept:$E,multiple:!0,hidden:!0,disabled:p,"data-testid":"prd-file-input",onChange:v=>{const y=v.currentTarget;d.loadPrdFromFiles(y.files).finally(()=>{y.value=""})}})]}),c.jsxs("span",{className:"muted prd-upload-hint",children:["支持多文件 .md / .markdown / .txt,单文件最大"," ",ad(id),",最多 ",Vs," 个"]}),d.prdDocuments.length>0?c.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"prd-recompose",disabled:p,onClick:d.recomposeDocuments,children:"按文件重新合成"}):null]}),d.prdDocuments.length>0?c.jsx("ul",{className:"prd-file-list","data-testid":"prd-file-list",children:d.prdDocuments.map((v,y)=>c.jsxs("li",{className:y===d.prdPrimaryIndex?"is-primary":void 0,"data-testid":`prd-file-item-${y}`,children:[c.jsxs("span",{className:"prd-file-item-name",children:[v.fileName,y===d.prdPrimaryIndex?c.jsx("span",{className:"prd-file-primary-tag",children:"主"}):null,c.jsxs("span",{className:"muted",children:[" ","· ",ad(v.sourceBytes)]})]}),c.jsxs("span",{className:"prd-file-item-actions",children:[c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p||y===d.prdPrimaryIndex,onClick:()=>d.setPrimaryDocument(y),children:"设为主"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p||y===0,onClick:()=>d.moveDocument(y,-1),children:"上移"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p||y===d.prdDocuments.length-1,onClick:()=>d.moveDocument(y,1),children:"下移"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:p,onClick:()=>d.removeDocument(y),children:"移除"})]})]},`${v.fileName}-${y}`))}):null,d.prdDocuments.length>0?c.jsxs("div",{className:"prd-file-meta",children:[c.jsxs("span",{children:["分卷=上传原件(将分别归档);正文=本会话采用稿",d.prdComposedDirty?"(已手动编辑)":""]}),c.jsx("button",{type:"button",className:"btn btn-ghost prd-file-clear","data-testid":"prd-file-clear",disabled:p,onClick:d.clearDocuments,children:"清除来源列表"})]}):null,d.prdDragOver?c.jsx("p",{className:"prd-drop-hint","data-testid":"prd-drop-hint",children:"释放以载入"}):null,c.jsxs("label",{className:"field prd-text-field",children:[c.jsx("span",{className:"muted",children:"PRD Markdown"}),c.jsx("textarea",{rows:10,value:d.prdText,disabled:p,"data-testid":"prd-textarea",onChange:v=>d.onPrdTextChange(v.target.value)})]})]}),d.prdFileError?c.jsx("p",{className:"prd-file-error",role:"alert","aria-live":"polite","data-testid":"prd-file-error",children:d.prdFileError}):null,c.jsxs("details",{className:"engineering-boundary","data-testid":"engineering-boundary",children:[c.jsx("summary",{children:"工程边界(可选,人类确认)"}),c.jsxs("p",{className:"muted",children:["逗号或换行分隔。留空则 intake 后进入访谈补齐;不会自动填",c.jsx("code",{children:"src/worker/console/**"})," 模板。"]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"allowedPaths"}),c.jsx("textarea",{rows:2,value:u.allowedPathsText,disabled:p,"data-testid":"prd-allowed-paths",placeholder:"src/**, test/**",onChange:v=>h({allowedPathsText:v.target.value})})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"forbiddenPaths"}),c.jsx("textarea",{rows:2,value:u.forbiddenPathsText,disabled:p,"data-testid":"prd-forbidden-paths",placeholder:".harness/**, node_modules/**",onChange:v=>h({forbiddenPathsText:v.target.value})})]}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"verifyCommands(label:command 或纯命令)"}),c.jsx("textarea",{rows:2,value:u.verifyCommandsText,disabled:p,"data-testid":"prd-verify-commands",placeholder:"typecheck:npm run typecheck",onChange:v=>h({verifyCommandsText:v.target.value})})]})]}),c.jsx("div",{className:"cta-row",children:c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||d.prdFileReading||!d.prdText.trim(),onClick:g,children:"导入并创建任务"})})]})}function MN(t){const{busy:r,taskId:i,taskTitle:l,taskKind:o,sessionId:d,question:u,answerText:h,onAnswerTextChange:g,draftSummary:p,assessmentId:v,runAction:y}=t;return c.jsxs("div",{"data-testid":"panel-interview",children:[c.jsx("h3",{children:"需求访谈(grill-me)"}),c.jsx("p",{className:"muted",children:"一次一问;也可跳过:系统会按推荐补齐草稿并签发评估,随后进入校验。 访谈中不可应用契约 / 运行 DAG / 对账。"}),p?c.jsx("pre",{className:"cmd","data-testid":"draft-summary",children:JSON.stringify(p,null,2)}):null,c.jsxs("div",{className:"cta-row",style:{marginBottom:"0.75rem"},children:[!d||!u?c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!i.trim(),onClick:()=>{y("interviewStart",{taskId:i,title:l,taskKind:o})},children:"开始 / 继续访谈"}):null,c.jsx("button",{type:"button",className:"btn btn-ghost","data-testid":"interview-skip",disabled:r||!i.trim(),onClick:()=>{y("interviewSkip",{taskId:i,title:l,taskKind:o})},children:"跳过访谈"})]}),d&&u?c.jsxs("div",{className:"interview-card",children:[c.jsxs("p",{className:"interview-q",children:[c.jsx("strong",{children:u.id})," · 风险=",Lv[u.risk??""]??u.risk??"—"]}),c.jsx("p",{children:u.text}),u.recommendation?c.jsxs("p",{className:"muted",children:["推荐:",u.recommendation]}):null,c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"你的回答(覆盖推荐)"}),c.jsx("textarea",{rows:3,value:h,disabled:r,onChange:S=>g(S.target.value)})]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r,onClick:()=>{y("interviewTurn",{sessionId:d,questionId:u.id,response:"accept-recommendation"}).then(()=>g(""))},children:"接受推荐"}),c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!h.trim(),onClick:()=>{y("interviewTurn",{sessionId:d,questionId:u.id,response:"override",text:h}).then(()=>g(""))},children:"提交自定义回答"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:r||u.risk==="high",onClick:()=>{y("interviewTurn",{sessionId:d,questionId:u.id,response:"defer",text:h||u.recommendation}).then(()=>g(""))},children:"暂缓(非高风险)"})]})]}):null,v?c.jsxs("p",{className:"muted",children:["评估 ID: ",c.jsx("code",{children:v})]}):null]})}function zN(t){const{busy:r,confirmationId:i,operationId:l,dagRunId:o,taskId:d,observeBusy:u,sseLog:h,runAction:g,onStopFollow:p,onShowInspectSplit:v,onOpenInspectSplit:y}=t;return c.jsxs("div",{"data-testid":"panel-run",children:[c.jsx("h3",{children:"运行详情"}),c.jsxs("div",{className:"meta-row",children:[c.jsxs("div",{children:["操作 ID: ",c.jsx("code",{children:l??"—"})]}),c.jsxs("div",{children:["确认 ID: ",c.jsx("code",{children:i??"—"})]})]}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:r||!i,onClick:()=>{g("runDag",{confirmationId:i},{clientRequestId:Fs("run")})},children:"重新运行"}),c.jsx("button",{type:"button",className:"btn btn-secondary",onClick:p,children:"停止跟随日志"}),c.jsx("button",{type:"button",className:"btn btn-secondary",disabled:!o.trim(),onClick:v,children:"打开检视"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:u||!o.trim()&&!d.trim(),title:"在本页侧栏预览,可关闭返回",onClick:y,children:"侧栏预览"})]}),c.jsx("pre",{className:"cmd","data-testid":"sse-log",children:h.join(`
|
|
56
|
+
`)||"(尚无事件)"})]})}function _N(t){const{shell:r,actions:i,wizard:l,prd:o,recovery:d}=t,{busy:u,step:h,setupBlocked:g,degraded:p}=r;return c.jsxs("section",{className:"panel task-ops","aria-labelledby":"task-ops-title",children:[c.jsx("h2",{id:"task-ops-title",children:"任务操作"}),c.jsx("p",{className:"panel-lead",children:"按 Happy Path 推进;契约落地一步内自动校验,人工确认写入。"}),c.jsx("ol",{className:"wizard-steps","data-testid":"wizard-steps",children:l.wizardSteps.map((v,y)=>c.jsxs("li",{"data-active":h===v.id,"data-done":y<l.stepIndex,children:[c.jsx("span",{className:"step-index",children:String(y+1).padStart(2,"0")}),c.jsx("span",{className:"step-label",children:v.label})]},v.id))}),c.jsxs("label",{className:"field",children:[c.jsx("span",{className:"muted",children:"任务 ID"}),c.jsx("input",{"data-testid":"task-id-input",value:l.taskId,disabled:u||g||h==="import-prd",placeholder:h==="import-prd"?"导入需求后自动生成":"task-id",onChange:v=>l.setTaskId(v.target.value.trim())})]}),l.taskTitle?c.jsxs("p",{className:"workflow-hint","data-testid":"task-title-chip",children:["任务名称:",l.taskTitle]}):null,h!=="import-prd"&&!g?c.jsxs("p",{className:"workflow-hint","data-testid":"workflow-kind-chip",children:["当前流程:",l.workflowMeta.label," ·"," ",c.jsx("code",{children:l.taskKind})]}):null,g||h==="setup"?c.jsxs("div",{className:"empty-state","data-testid":"setup-gate",children:[c.jsx("p",{className:"empty-title",children:"需要先完成设置"}),c.jsx("p",{className:"muted",children:"请先在「模型与认证」完成 Pi 就绪,再导入需求与访谈。"}),c.jsxs("div",{className:"cta-row",children:[c.jsx("button",{type:"button",className:"btn btn-primary",disabled:u,onClick:()=>{r.selectNav("models"),i.runAction("refreshReadiness",{}).then(()=>r.loadHealth())},children:"刷新就绪状态"}),c.jsx("button",{type:"button",className:"btn btn-primary",disabled:u,onClick:()=>{i.runAction("doctor",{})},children:"运行诊断"}),c.jsx("pre",{className:"cmd",children:zv})]})]}):c.jsxs("div",{className:"wizard-body","data-testid":"wizard-body",children:[h==="import-prd"&&c.jsx(ON,{busy:u,taskKind:l.taskKind,onTaskKindChange:l.setTaskKind,workflowHint:l.workflowMeta.hint,prd:o,engineering:l.engineering,onEngineeringChange:l.setEngineering,onImport:()=>{l.importPrdAndCreate()}}),h==="interview"&&c.jsx(MN,{busy:u,taskId:l.taskId,taskTitle:l.taskTitle,taskKind:l.taskKind,sessionId:l.sessionId,question:l.question,answerText:l.answerText,onAnswerTextChange:l.setAnswerText,draftSummary:l.draftSummary,assessmentId:l.assessmentId,runAction:i.runAction}),h==="contract"&&c.jsx(IN,{busy:u,degraded:p,taskId:l.taskId,assessmentId:l.assessmentId,contractValidateOk:l.contractValidateOk,contractValidateSummary:l.contractValidateSummary,contractDiffSummary:l.contractDiffSummary,contractApplied:l.contractApplied,spineOk:l.spineOk,onRerunPreflight:()=>{l.runContractPreflight(!0)},onApplyContract:()=>{l.applyContractThenSpine()},onRetrySpine:()=>{l.retrySpineOnly()}}),h==="dag-confirm"&&c.jsx(DN,{busy:u,taskId:l.taskId,confirmationId:i.confirmationId,confirmationDetails:i.confirmationDetails,runAction:i.runAction,onConfirmAndRun:()=>{l.confirmAndRunDag()}}),h==="run"&&c.jsx(zN,{busy:u,confirmationId:i.confirmationId,operationId:i.operationId,dagRunId:d.dagRunId,taskId:l.taskId,observeBusy:r.observeBusy,sseLog:i.sseLog,runAction:i.runAction,onStopFollow:i.stopFollowSse,onShowInspectSplit:()=>d.setInspectSplitOpen(!0),onOpenInspectSplit:()=>{d.openInspectSplit()}})]})]})}const LN={};function BN(){const t=UE(),r=k.useRef(()=>{}),i=k.useCallback(v=>r.current(v),[]),l=qE({shell:t,applyInterviewPayload:i}),o=rN(),d=bN({shell:t,actions:l,prd:o}),u=vN({shell:t,actions:l,wizard:d});k.useEffect(()=>{r.current=d.applyInterviewPayload}),k.useEffect(()=>{t.loadHealth()},[t.loadHealth]);const h=k.useCallback((v,y={})=>{t.selectNav(v),y.taskId&&d.setTaskId(y.taskId),y.dagRunId&&u.setDagRunId(y.dagRunId),y.fromNodeId&&u.setFromNodeId(y.fromNodeId),y.featureId&&u.setFeatureId(y.featureId);const S=wy(v,y);window.location.hash.replace(/^#/,"")!==S&&(window.location.hash=S)},[t.selectNav,d.setTaskId,u.setDagRunId,u.setFromNodeId,u.setFeatureId]),g=k.useCallback(()=>{const v=DS(window.location);if(v){h(v.workspace,v);return}const y=ky({env:LN?.VITE_OPERATOR_CHAT_DEFAULT_LANDING,storage:window.localStorage,location:window.location});h(y,{})},[h]);k.useEffect(()=>(g(),window.addEventListener("hashchange",g),()=>window.removeEventListener("hashchange",g)),[g]);const p=t.nav==="recovery"&&u.dagRunId.trim()?`/inspect/#/dag/${encodeURIComponent(u.dagRunId.trim())}?from=recovery`:"/inspect/#/";return c.jsx(c.Fragment,{children:c.jsxs("div",{className:`console-app${t.nav==="chat"?" is-chat-focus":""}`,children:[c.jsx(CN,{nav:t.nav,readiness:t.readiness,setupBlocked:t.setupBlocked,degraded:t.degraded,health:t.health,inspectHref:p}),c.jsxs("div",{className:`console-shell${t.nav==="chat"?" is-chat-focus":""}`,children:[c.jsx(jN,{opError:t.opError,opMessage:t.opMessage}),c.jsxs("main",{className:`console-main${t.nav==="chat"?" console-main--fill":""}`,children:[t.nav==="tasks"?c.jsx(_N,{shell:t,actions:l,wizard:d,prd:o,recovery:u}):null,t.nav==="recovery"?c.jsx(NN,{shell:t,recovery:u,wizard:d}):null,t.nav==="night"?c.jsx(T1,{busy:t.busy,runAction:l.runAction,isActionSuccess:l.isActionSuccess,setOpError:t.setOpError}):null,t.nav==="models"?c.jsx(EN,{busy:t.busy,readiness:t.readiness,readinessReport:t.readinessReport,health:t.health,onRefreshReadiness:()=>{l.runAction("refreshReadiness",{}).then(()=>t.loadHealth())}}):null,t.nav==="chat"?c.jsxs("section",{className:"panel panel--chat","aria-labelledby":"chat-title",children:[c.jsx("h2",{id:"chat-title",className:"sr-only",children:"对话"}),c.jsx(ME,{origin:"",readiness:t.readiness,surface:"workspace",onNavigateWorkspace:h})]}):null,t.nav==="settings"?c.jsx(AN,{health:t.health,readiness:t.readiness,healthError:t.healthError,layers:t.layers,setupBlocked:t.setupBlocked,degraded:t.degraded}):null]}),u.inspectSplitOpen&&u.dagRunId.trim()?c.jsx(m1,{dagRunId:u.dagRunId.trim(),nodeId:u.fromNodeId.trim()||void 0,onClose:()=>u.setInspectSplitOpen(!1),onOpenFull:u.openFullInspect}):null]})]})})}const Fv=document.getElementById("root");if(!Fv)throw new Error("Loop Operator Console: #root missing");f1.createRoot(Fv).render(c.jsx(k.StrictMode,{children:c.jsx(BN,{})}));
|