@tea-agent/loop-agent 0.35.0-beta.1 → 0.35.0-beta.2

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.
@@ -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 n1(){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 r1(){return Ap||(Ap=1,hc.exports=n1()),hc.exports}var c=r1(),mc={exports:{}},Ee={};var Ip;function i1(){if(Ip)return Ee;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 C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,B={};function E(R,_,w){this.props=R,this.context=_,this.refs=B,this.updater=w||C}E.prototype.isReactComponent={},E.prototype.setState=function(R,_){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,_,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function A(){}A.prototype=E.prototype;function I(R,_,w){this.props=R,this.context=_,this.refs=B,this.updater=w||C}var G=I.prototype=new A;G.constructor=I,D(G,E.prototype),G.isPureReactComponent=!0;var K=Array.isArray;function N(){}var $={H:null,A:null,T:null,S:null},re=Object.prototype.hasOwnProperty;function ce(R,_,w){var te=w.ref;return{$$typeof:t,type:R,key:_,ref:te!==void 0?te:null,props:w}}function M(R,_){return ce(R.type,_,R.props)}function V(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Y(R){var _={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(w){return _[w]})}var le=/\/+/g;function X(R,_){return typeof R=="object"&&R!==null&&R.key!=null?Y(""+R.key):_.toString(36)}function L(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(_){R.status==="pending"&&(R.status="fulfilled",R.value=_)},function(_){R.status==="pending"&&(R.status="rejected",R.reason=_)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function O(R,_,w,te,fe){var W=typeof R;(W==="undefined"||W==="boolean")&&(R=null);var ie=!1;if(R===null)ie=!0;else switch(W){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(R.$$typeof){case t:case r:ie=!0;break;case v:return ie=R._init,O(ie(R._payload),_,w,te,fe)}}if(ie)return fe=fe(R),ie=te===""?"."+X(R,0):te,K(fe)?(w="",ie!=null&&(w=ie.replace(le,"$&/")+"/"),O(fe,_,w,"",function(ge){return ge})):fe!=null&&(V(fe)&&(fe=M(fe,w+(fe.key==null||R&&R.key===fe.key?"":(""+fe.key).replace(le,"$&/")+"/")+ie)),_.push(fe)),1;ie=0;var he=te===""?".":te+":";if(K(R))for(var pe=0;pe<R.length;pe++)te=R[pe],W=he+X(te,pe),ie+=O(te,_,w,W,fe);else if(pe=x(R),typeof pe=="function")for(R=pe.call(R),pe=0;!(te=R.next()).done;)te=te.value,W=he+X(te,pe++),ie+=O(te,_,w,W,fe);else if(W==="object"){if(typeof R.then=="function")return O(L(R),_,w,te,fe);throw _=String(R),Error("Objects are not valid as a React child (found: "+(_==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":_)+"). If you meant to render a collection of children, use an array instead.")}return ie}function H(R,_,w){if(R==null)return R;var te=[],fe=0;return O(R,te,"","",function(W){return _.call(w,W,fe++)}),te}function U(R){if(R._status===-1){var _=R._result;_=_(),_.then(function(w){(R._status===0||R._status===-1)&&(R._status=1,R._result=w)},function(w){(R._status===0||R._status===-1)&&(R._status=2,R._result=w)}),R._status===-1&&(R._status=0,R._result=_)}if(R._status===1)return R._result.default;throw R._result}var Q=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var _=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(_))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},T={map:H,forEach:function(R,_,w){H(R,function(){_.apply(this,arguments)},w)},count:function(R){var _=0;return H(R,function(){_++}),_},toArray:function(R){return H(R,function(_){return _})||[]},only:function(R){if(!V(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ee.Activity=y,Ee.Children=T,Ee.Component=E,Ee.Fragment=i,Ee.Profiler=o,Ee.PureComponent=I,Ee.StrictMode=l,Ee.Suspense=g,Ee.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Ee.__COMPILER_RUNTIME={__proto__:null,c:function(R){return $.H.useMemoCache(R)}},Ee.cache=function(R){return function(){return R.apply(null,arguments)}},Ee.cacheSignal=function(){return null},Ee.cloneElement=function(R,_,w){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var te=D({},R.props),fe=R.key;if(_!=null)for(W in _.key!==void 0&&(fe=""+_.key),_)!re.call(_,W)||W==="key"||W==="__self"||W==="__source"||W==="ref"&&_.ref===void 0||(te[W]=_[W]);var W=arguments.length-2;if(W===1)te.children=w;else if(1<W){for(var ie=Array(W),he=0;he<W;he++)ie[he]=arguments[he+2];te.children=ie}return ce(R.type,fe,te)},Ee.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},Ee.createElement=function(R,_,w){var te,fe={},W=null;if(_!=null)for(te in _.key!==void 0&&(W=""+_.key),_)re.call(_,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(fe[te]=_[te]);var ie=arguments.length-2;if(ie===1)fe.children=w;else if(1<ie){for(var he=Array(ie),pe=0;pe<ie;pe++)he[pe]=arguments[pe+2];fe.children=he}if(R&&R.defaultProps)for(te in ie=R.defaultProps,ie)fe[te]===void 0&&(fe[te]=ie[te]);return ce(R,W,fe)},Ee.createRef=function(){return{current:null}},Ee.forwardRef=function(R){return{$$typeof:h,render:R}},Ee.isValidElement=V,Ee.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:U}},Ee.memo=function(R,_){return{$$typeof:p,type:R,compare:_===void 0?null:_}},Ee.startTransition=function(R){var _=$.T,w={};$.T=w;try{var te=R(),fe=$.S;fe!==null&&fe(w,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(N,Q)}catch(W){Q(W)}finally{_!==null&&w.types!==null&&(_.types=w.types),$.T=_}},Ee.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ee.use=function(R){return $.H.use(R)},Ee.useActionState=function(R,_,w){return $.H.useActionState(R,_,w)},Ee.useCallback=function(R,_){return $.H.useCallback(R,_)},Ee.useContext=function(R){return $.H.useContext(R)},Ee.useDebugValue=function(){},Ee.useDeferredValue=function(R,_){return $.H.useDeferredValue(R,_)},Ee.useEffect=function(R,_){return $.H.useEffect(R,_)},Ee.useEffectEvent=function(R){return $.H.useEffectEvent(R)},Ee.useId=function(){return $.H.useId()},Ee.useImperativeHandle=function(R,_,w){return $.H.useImperativeHandle(R,_,w)},Ee.useInsertionEffect=function(R,_){return $.H.useInsertionEffect(R,_)},Ee.useLayoutEffect=function(R,_){return $.H.useLayoutEffect(R,_)},Ee.useMemo=function(R,_){return $.H.useMemo(R,_)},Ee.useOptimistic=function(R,_){return $.H.useOptimistic(R,_)},Ee.useReducer=function(R,_,w){return $.H.useReducer(R,_,w)},Ee.useRef=function(R){return $.H.useRef(R)},Ee.useState=function(R){return $.H.useState(R)},Ee.useSyncExternalStore=function(R,_,w){return $.H.useSyncExternalStore(R,_,w)},Ee.useTransition=function(){return $.H.useTransition()},Ee.version="19.2.8",Ee}var Dp;function sd(){return Dp||(Dp=1,mc.exports=i1()),mc.exports}var k=sd();const Nr=ld(k);var pc={exports:{}},Pa={},gc={exports:{}},yc={};var Op;function a1(){return Op||(Op=1,(function(t){function r(O,H){var U=O.length;O.push(H);e:for(;0<U;){var Q=U-1>>>1,T=O[Q];if(0<o(T,H))O[Q]=H,O[U]=T,U=Q;else break e}}function i(O){return O.length===0?null:O[0]}function l(O){if(O.length===0)return null;var H=O[0],U=O.pop();if(U!==H){O[0]=U;e:for(var Q=0,T=O.length,R=T>>>1;Q<R;){var _=2*(Q+1)-1,w=O[_],te=_+1,fe=O[te];if(0>o(w,U))te<T&&0>o(fe,w)?(O[Q]=fe,O[te]=U,Q=te):(O[Q]=w,O[_]=U,Q=_);else if(te<T&&0>o(fe,U))O[Q]=fe,O[te]=U,Q=te;else break e}}return H}function o(O,H){var U=O.sortIndex-H.sortIndex;return U!==0?U:O.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,C=!1,D=!1,B=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function G(O){for(var H=i(p);H!==null;){if(H.callback===null)l(p);else if(H.startTime<=O)l(p),H.sortIndex=H.expirationTime,r(g,H);else break;H=i(p)}}function K(O){if(D=!1,G(O),!C)if(i(g)!==null)C=!0,N||(N=!0,Y());else{var H=i(p);H!==null&&L(K,H.startTime-O)}}var N=!1,$=-1,re=5,ce=-1;function M(){return B?!0:!(t.unstable_now()-ce<re)}function V(){if(B=!1,N){var O=t.unstable_now();ce=O;var H=!0;try{e:{C=!1,D&&(D=!1,A($),$=-1),x=!0;var U=S;try{t:{for(G(O),y=i(g);y!==null&&!(y.expirationTime>O&&M());){var Q=y.callback;if(typeof Q=="function"){y.callback=null,S=y.priorityLevel;var T=Q(y.expirationTime<=O);if(O=t.unstable_now(),typeof T=="function"){y.callback=T,G(O),H=!0;break t}y===i(g)&&l(g),G(O)}else l(g);y=i(g)}if(y!==null)H=!0;else{var R=i(p);R!==null&&L(K,R.startTime-O),H=!1}}break e}finally{y=null,S=U,x=!1}H=void 0}}finally{H?Y():N=!1}}}var Y;if(typeof I=="function")Y=function(){I(V)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,X=le.port2;le.port1.onmessage=V,Y=function(){X.postMessage(null)}}else Y=function(){E(V,0)};function L(O,H){$=E(function(){O(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(O){O.callback=null},t.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):re=0<O?Math.floor(1e3/O):5},t.unstable_getCurrentPriorityLevel=function(){return S},t.unstable_next=function(O){switch(S){case 1:case 2:case 3:var H=3;break;default:H=S}var U=S;S=H;try{return O()}finally{S=U}},t.unstable_requestPaint=function(){B=!0},t.unstable_runWithPriority=function(O,H){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var U=S;S=O;try{return H()}finally{S=U}},t.unstable_scheduleCallback=function(O,H,U){var Q=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?Q+U:Q):U=Q,O){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,O={id:v++,callback:H,priorityLevel:O,startTime:U,expirationTime:T,sortIndex:-1},U>Q?(O.sortIndex=U,r(p,O),i(g)===null&&O===i(p)&&(D?(A($),$=-1):D=!0,L(K,U-Q))):(O.sortIndex=T,r(g,O),C||x||(C=!0,N||(N=!0,Y()))),O},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(O){var H=S;return function(){var U=S;S=H;try{return O.apply(this,arguments)}finally{S=U}}}})(yc)),yc}var Mp;function l1(){return Mp||(Mp=1,gc.exports=a1()),gc.exports}var vc={exports:{}},Mt={};var zp;function s1(){if(zp)return Mt;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 Mt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Mt.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)},Mt.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()}},Mt.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))},Mt.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},Mt.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})}},Mt.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)},Mt.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})}},Mt.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)},Mt.requestFormReset=function(g){l.d.r(g)},Mt.unstable_batchedUpdates=function(g,p){return g(p)},Mt.useFormState=function(g,p,v){return u.H.useFormState(g,p,v)},Mt.useFormStatus=function(){return u.H.useHostTransitionStatus()},Mt.version="19.2.8",Mt}var _p;function ty(){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=s1(),vc.exports}var Lp;function o1(){if(Lp)return Pa;Lp=1;var t=l1(),r=sd(),i=ty();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"),C=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),I=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"),re=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function Y(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case E:return"Profiler";case B:return"StrictMode";case K:return"Suspense";case N:return"SuspenseList";case ce:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case I:return e.displayName||"Context";case A: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 re:n=e._payload,e=e._init;try{return X(e(n))}catch{}}return null}var L=Array.isArray,O=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},Q=[],T=-1;function R(e){return{current:e}}function _(e){0>T||(e.current=Q[T],Q[T]=null,T--)}function w(e,n){T++,Q[T]=e.current,e.current=n}var te=R(null),fe=R(null),W=R(null),ie=R(null);function he(e,n){switch(w(W,n),w(fe,e),w(te,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}}_(te),w(te,e)}function pe(){_(te),_(fe),_(W)}function ge(e){e.memoizedState!==null&&w(ie,e);var n=te.current,a=Wm(n,e.type);n!==a&&(w(fe,e),w(te,a))}function Ie(e){fe.current===e&&(_(te),_(fe)),ie.current===e&&(_(ie),Ga._currentValue=U)}var Ne,$e;function Pe(e){if(Ne===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Ne=n&&n[1]||"",$e=-1<a.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Ne+e+$e}var at=!1;function sn(e,n){if(!e||at)return"";at=!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(ne){var ee=ne}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(ne){ee=ne}e.call(ue.prototype)}}else{try{throw Error()}catch(ne){ee=ne}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ne){if(ne&&ee&&typeof ne.stack=="string")return[ne.stack,ee.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 z=b.split(`
4
+ `),J=j.split(`
5
+ `);for(f=s=0;s<z.length&&!z[s].includes("DetermineComponentFrameRoot");)s++;for(;f<J.length&&!J[f].includes("DetermineComponentFrameRoot");)f++;if(s===z.length||f===J.length)for(s=z.length-1,f=J.length-1;1<=s&&0<=f&&z[s]!==J[f];)f--;for(;1<=s&&0<=f;s--,f--)if(z[s]!==J[f]){if(s!==1||f!==1)do if(s--,f--,0>f||z[s]!==J[f]){var ae=`
6
+ `+z[s].replace(" at new "," at ");return e.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",e.displayName)),ae}while(1<=s&&0<=f);break}}}finally{at=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Pe(a):""}function Tt(e,n){switch(e.tag){case 26:case 27:case 5:return Pe(e.type);case 16:return Pe("Lazy");case 13:return e.child!==n&&n!==null?Pe("Suspense Fallback"):Pe("Suspense");case 19:return Pe("SuspenseList");case 0:case 15:return sn(e.type,!1);case 11:return sn(e.type.render,!1);case 1:return sn(e.type,!0);case 31:return Pe("Activity");default:return""}}function on(e){try{var n="",a=null;do n+=Tt(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
7
+ Error generating stack: `+s.message+`
8
+ `+s.stack}}var Ht=Object.prototype.hasOwnProperty,Rt=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,qe=t.unstable_shouldYield,ut=t.unstable_requestPaint,Fe=t.unstable_now,oe=t.unstable_getCurrentPriorityLevel,P=t.unstable_ImmediatePriority,de=t.unstable_UserBlockingPriority,ve=t.unstable_NormalPriority,Ce=t.unstable_LowPriority,Te=t.unstable_IdlePriority,Se=t.log,Ke=t.unstable_setDisableYieldValue,Oe=null,He=null;function ht(e){if(typeof Se=="function"&&Ke(e),He&&typeof He.setStrictMode=="function")try{He.setStrictMode(Oe,e)}catch{}}var Qe=Math.clz32?Math.clz32:Ws,jn=Math.log,Qt=Math.LN2;function Ws(e){return e>>>=0,e===0?32:31-(jn(e)/Qt|0)|0}var Et=256,Ir=262144,ol=4194304;function Dr(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 ul(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=Dr(s):(b&=j,b!==0?f=Dr(b):a||(a=j&~e,a!==0&&(f=Dr(a))))):(j=s&~m,j!==0?f=Dr(j):b!==0?f=Dr(b):a||(a=s&~e,a!==0&&(f=Dr(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 ta(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function $v(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=ol;return ol<<=1,(ol&62914560)===0&&(ol=4194304),e}function eo(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function na(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Fv(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,z=e.expirationTimes,J=e.hiddenUpdates;for(a=b&~a;0<a;){var ae=31-Qe(a),ue=1<<ae;j[ae]=0,z[ae]=-1;var ee=J[ae];if(ee!==null)for(J[ae]=null,ae=0;ae<ee.length;ae++){var ne=ee[ae];ne!==null&&(ne.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-Qe(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-Qe(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 nr=Math.random().toString(36).slice(2),Nt="__reactFiber$"+nr,Ut="__reactProps$"+nr,ai="__reactContainer$"+nr,ro="__reactEvents$"+nr,Vv="__reactListeners$"+nr,Yv="__reactHandles$"+nr,Bd="__reactResources$"+nr,ra="__reactMarker$"+nr;function io(e){delete e[Nt],delete e[Ut],delete e[ro],delete e[Vv],delete e[Yv]}function li(e){var n=e[Nt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[ai]||a[Nt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=lp(e);e!==null;){if(a=e[Nt])return a;e=lp(e)}return n}e=a,a=e.parentNode}return null}function si(e){if(e=e[Nt]||e[ai]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function ia(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(l(33))}function oi(e){var n=e[Bd];return n||(n=e[Bd]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ct(e){e[ra]=!0}var Hd=new Set,Ud={};function Or(e,n){ui(e,n),ui(e+"Capture",n)}function ui(e,n){for(Ud[e]=n,e=0;e<n.length;e++)Hd.add(n[e])}var Pv=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 Kv(e){return Ht.call(Gd,e)?!0:Ht.call(qd,e)?!1:Pv.test(e)?Gd[e]=!0:(qd[e]=!0,!1)}function cl(e,n,a){if(Kv(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 dl(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 Mn(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 Xv(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=Xv(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 fl(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 Qv=/[\n"\\]/g;function cn(e){return e.replace(Qv,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"&&fl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ci(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 Yd(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 Pd(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(l(92));if(L(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 di(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Zv=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||Zv.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 Jv=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"]]),Wv=/^[\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 hl(e){return Wv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function zn(){}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 fi=null,hi=null;function Qd(e){var n=si(e);if(n&&(e=n.stateNode)){var a=e[Ut]||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[Ut]||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":Yd(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ci(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,(fi!==null||hi!==null)&&(es(),fi&&(n=fi,e=hi,hi=fi=null,Qd(n),e)))for(n=0;n<e.length;n++)Qd(e[n])}}function aa(e,n){var a=e.stateNode;if(a===null)return null;var s=a[Ut]||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 _n=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ho=!1;if(_n)try{var la={};Object.defineProperty(la,"passive",{get:function(){ho=!0}}),window.addEventListener("test",la,la),window.removeEventListener("test",la,la)}catch{ho=!1}var rr=null,mo=null,ml=null;function Jd(){if(ml)return ml;var e,n=mo,a=n.length,s,f="value"in rr?rr.value:rr.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 ml=f.slice(e,1<s?1-s:void 0)}function pl(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 gl(){return!0}function Wd(){return!1}function qt(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)?gl: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=gl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=gl)},persist:function(){},isPersistent:gl}),n}var Mr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yl=qt(Mr),sa=y({},Mr,{view:0,detail:0}),eb=qt(sa),po,go,oa,vl=y({},sa,{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!==oa&&(oa&&e.type==="mousemove"?(po=e.screenX-oa.screenX,go=e.screenY-oa.screenY):go=po=0,oa=e),po)},movementY:function(e){return"movementY"in e?e.movementY:go}}),ef=qt(vl),tb=y({},vl,{dataTransfer:0}),nb=qt(tb),rb=y({},sa,{relatedTarget:0}),yo=qt(rb),ib=y({},Mr,{animationName:0,elapsedTime:0,pseudoElement:0}),ab=qt(ib),lb=y({},Mr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sb=qt(lb),ob=y({},Mr,{data:0}),tf=qt(ob),ub={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cb={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"},db={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=db[e])?!!n[e]:!1}function vo(){return fb}var hb=y({},sa,{key:function(e){if(e.key){var n=ub[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=pl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?cb[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"?pl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),mb=qt(hb),pb=y({},vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nf=qt(pb),gb=y({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vo}),yb=qt(gb),vb=y({},Mr,{propertyName:0,elapsedTime:0,pseudoElement:0}),bb=qt(vb),xb=y({},vl,{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}),Sb=qt(xb),kb=y({},Mr,{newState:0,oldState:0}),wb=qt(kb),Cb=[9,13,27,32],bo=_n&&"CompositionEvent"in window,ua=null;_n&&"documentMode"in document&&(ua=document.documentMode);var jb=_n&&"TextEvent"in window&&!ua,rf=_n&&(!bo||ua&&8<ua&&11>=ua),af=" ",lf=!1;function sf(e,n){switch(e){case"keyup":return Cb.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 mi=!1;function Tb(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 Rb(e,n){if(mi)return e==="compositionend"||!bo&&sf(e,n)?(e=Jd(),ml=mo=rr=null,mi=!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 Eb={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"?!!Eb[e.type]:n==="textarea"}function cf(e,n,a,s){fi?hi?hi.push(s):hi=[s]:fi=s,n=ss(n,"onChange"),0<n.length&&(a=new yl("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var ca=null,da=null;function Nb(e){Ym(e,0)}function bl(e){var n=ia(e);if(Fd(n))return e}function df(e,n){if(e==="change")return n}var ff=!1;if(_n){var xo;if(_n){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(){ca&&(ca.detachEvent("onpropertychange",pf),da=ca=null)}function pf(e){if(e.propertyName==="value"&&bl(da)){var n=[];cf(n,da,e,co(e)),Zd(Nb,n)}}function Ab(e,n,a){e==="focusin"?(mf(),ca=n,da=a,ca.attachEvent("onpropertychange",pf)):e==="focusout"&&mf()}function Ib(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bl(da)}function Db(e,n){if(e==="click")return bl(n)}function Ob(e,n){if(e==="input"||e==="change")return bl(n)}function Mb(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Zt=typeof Object.is=="function"?Object.is:Mb;function fa(e,n){if(Zt(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(!Ht.call(n,f)||!Zt(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=fl(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=fl(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 zb=_n&&"documentMode"in document&&11>=document.documentMode,pi=null,wo=null,ha=null,Co=!1;function xf(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Co||pi==null||pi!==fl(s)||(s=pi,"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}),ha&&fa(ha,s)||(ha=s,s=ss(wo,"onSelect"),0<s.length&&(n=new yl("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=pi)))}function zr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var gi={animationend:zr("Animation","AnimationEnd"),animationiteration:zr("Animation","AnimationIteration"),animationstart:zr("Animation","AnimationStart"),transitionrun:zr("Transition","TransitionRun"),transitionstart:zr("Transition","TransitionStart"),transitioncancel:zr("Transition","TransitionCancel"),transitionend:zr("Transition","TransitionEnd")},jo={},Sf={};_n&&(Sf=document.createElement("div").style,"AnimationEvent"in window||(delete gi.animationend.animation,delete gi.animationiteration.animation,delete gi.animationstart.animation),"TransitionEvent"in window||delete gi.transitionend.transition);function _r(e){if(jo[e])return jo[e];if(!gi[e])return e;var n=gi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Sf)return jo[e]=n[a];return e}var kf=_r("animationend"),wf=_r("animationiteration"),Cf=_r("animationstart"),_b=_r("transitionrun"),Lb=_r("transitionstart"),Bb=_r("transitioncancel"),jf=_r("transitionend"),Tf=new Map,To="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(" ");To.push("scrollEnd");function xn(e,n){Tf.set(e,n),Or(n,[e])}var xl=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=[],yi=0,Ro=0;function Sl(){for(var e=yi,n=Ro=yi=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&&Rf(a,f,m)}}function kl(e,n,a,s){dn[yi++]=e,dn[yi++]=n,dn[yi++]=a,dn[yi++]=s,Ro|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Eo(e,n,a,s){return kl(e,n,a,s),wl(e)}function Lr(e,n){return kl(e,null,null,n),wl(e)}function Rf(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-Qe(a),e=m.hiddenUpdates,s=e[f],s===null?e[f]=[n]:s.push(n),n.lane=a|536870912),m):null}function wl(e){if(50<za)throw za=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 vi={};function Hb(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 Jt(e,n,a,s){return new Hb(e,n,a,s)}function No(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ln(e,n){var a=e.alternate;return a===null?(a=Jt(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 Cl(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=Fx(e,a,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ce:return e=Jt(31,a,n,f),e.elementType=ce,e.lanes=m,e;case D:return Br(a.children,f,m,n);case B:b=8,f|=24;break;case E:return e=Jt(12,a,n,f|2),e.elementType=E,e.lanes=m,e;case K:return e=Jt(13,a,n,f),e.elementType=K,e.lanes=m,e;case N:return e=Jt(19,a,n,f),e.elementType=N,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case I:b=10;break e;case A:b=9;break e;case G:b=11;break e;case $:b=14;break e;case re:b=16,s=null;break e}b=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return n=Jt(b,a,n,f),n.elementType=e,n.type=s,n.lanes=m,n}function Br(e,n,a,s){return e=Jt(7,e,s,n),e.lanes=a,e}function Ao(e,n,a){return e=Jt(6,e,null,n),e.lanes=a,e}function Nf(e){var n=Jt(18,null,null,0);return n.stateNode=e,n}function Io(e,n,a){return n=Jt(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:on(n)},Af.set(e,n),n)}return{value:e,source:n,stack:on(n)}}var bi=[],xi=0,jl=null,ma=0,hn=[],mn=0,ir=null,Tn=1,Rn="";function Bn(e,n){bi[xi++]=ma,bi[xi++]=jl,jl=e,ma=n}function If(e,n,a){hn[mn++]=Tn,hn[mn++]=Rn,hn[mn++]=ir,ir=e;var s=Tn;e=Rn;var f=32-Qe(s)-1;s&=~(1<<f),a+=1;var m=32-Qe(n)+f;if(30<m){var b=f-f%5;m=(s&(1<<b)-1).toString(32),s>>=b,f-=b,Tn=1<<32-Qe(n)+f|a<<f|s,Rn=m+e}else Tn=1<<m|a<<f|s,Rn=e}function Do(e){e.return!==null&&(Bn(e,1),If(e,1,0))}function Oo(e){for(;e===jl;)jl=bi[--xi],bi[xi]=null,ma=bi[--xi],bi[xi]=null;for(;e===ir;)ir=hn[--mn],hn[mn]=null,Rn=hn[--mn],hn[mn]=null,Tn=hn[--mn],hn[mn]=null}function Df(e,n){hn[mn++]=Tn,hn[mn++]=Rn,hn[mn++]=ir,Tn=n.id,Rn=n.overflow,ir=e}var At=null,lt=null,Ue=!1,ar=null,pn=!1,Mo=Error(l(519));function lr(e){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pa(fn(n,e)),Mo}function Of(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[Nt]=e,n[Ut]=s,a){case"dialog":ze("cancel",n),ze("close",n);break;case"iframe":case"object":case"embed":ze("load",n);break;case"video":case"audio":for(a=0;a<La.length;a++)ze(La[a],n);break;case"source":ze("error",n);break;case"img":case"image":case"link":ze("error",n),ze("load",n);break;case"details":ze("toggle",n);break;case"input":ze("invalid",n),Vd(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":ze("invalid",n);break;case"textarea":ze("invalid",n),Pd(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&&(ze("beforetoggle",n),ze("toggle",n)),s.onScroll!=null&&ze("scroll",n),s.onScrollEnd!=null&&ze("scrollend",n),s.onClick!=null&&(n.onclick=zn),n=!0):n=!1,n||lr(e,!0)}function Mf(e){for(At=e.return;At;)switch(At.tag){case 5:case 31:case 13:pn=!1;return;case 27:case 3:pn=!0;return;default:At=At.return}}function Si(e){if(e!==At)return!1;if(!Ue)return Mf(e),Ue=!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&&lt&&lr(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,xr(e.type)?(e=rc,rc=null,lt=e):lt=n):lt=At?yn(e.stateNode.nextSibling):null;return!0}function Hr(){lt=At=null,Ue=!1}function zo(){var e=ar;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),ar=null),e}function pa(e){ar===null?ar=[e]:ar.push(e)}var _o=R(null),Ur=null,Hn=null;function sr(e,n,a){w(_o,n._currentValue),n._currentValue=a}function Un(e){e._currentValue=_o.current,_(_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 z=0;z<n.length;z++)if(j.context===n[z]){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 ki(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;Zt(f.pendingProps.value,b.value)||(e!==null?e.push(j):e=[j])}}else if(f===ie.current){if(b=f.alternate,b===null)throw Error(l(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Ga):e=[Ga])}f=f.return}e!==null&&Bo(n,e,a,s),n.flags|=262144}function Tl(e){for(e=e.firstContext;e!==null;){if(!Zt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qr(e){Ur=e,Hn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function It(e){return zf(Ur,e)}function Rl(e,n){return Ur===null&&qr(e),zf(e,n)}function zf(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Hn===null){if(e===null)throw Error(l(308));Hn=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Hn=Hn.next=n;return a}var Ub=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()})}},qb=t.unstable_scheduleCallback,Gb=t.unstable_NormalPriority,yt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ho(){return{controller:new Ub,data:new Map,refCount:0}}function ga(e){e.refCount--,e.refCount===0&&qb(Gb,function(){e.controller.abort()})}var ya=null,Uo=0,wi=0,Ci=null;function $b(e,n){if(ya===null){var a=ya=[];Uo=0,wi=$u(),Ci={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Uo++,n.then(_f,_f),n}function _f(){if(--Uo===0&&ya!==null){Ci!==null&&(Ci.status="fulfilled");var e=ya;ya=null,wi=0,Ci=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Fb(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=O.S;O.S=function(e,n){xm=Fe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&$b(e,n),Lf!==null&&Lf(e,n)};var Gr=R(null);function qo(){var e=Gr.current;return e!==null?e:nt.pooledCache}function El(e,n){n===null?w(Gr,Gr.current):w(Gr,n.pool)}function Bf(){var e=qo();return e===null?null:{parent:yt._currentValue,pool:e}}var ji=Error(l(460)),Go=Error(l(474)),Nl=Error(l(542)),Al={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(zn,zn),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(zn,zn);else{if(e=nt,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 Fr=n,ji}}function $r(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Fr=a,ji):a}}var Fr=null;function qf(){if(Fr===null)throw Error(l(459));var e=Fr;return Fr=null,e}function Gf(e){if(e===ji||e===Nl)throw Error(l(483))}var Ti=null,va=0;function Il(e){var n=va;return va+=1,Ti===null&&(Ti=[]),Uf(Ti,e,n)}function ba(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Dl(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(F,q){if(e){var Z=F.deletions;Z===null?(F.deletions=[q],F.flags|=16):Z.push(q)}}function a(F,q){if(!e)return null;for(;q!==null;)n(F,q),q=q.sibling;return null}function s(F){for(var q=new Map;F!==null;)F.key!==null?q.set(F.key,F):q.set(F.index,F),F=F.sibling;return q}function f(F,q){return F=Ln(F,q),F.index=0,F.sibling=null,F}function m(F,q,Z){return F.index=Z,e?(Z=F.alternate,Z!==null?(Z=Z.index,Z<q?(F.flags|=67108866,q):Z):(F.flags|=67108866,q)):(F.flags|=1048576,q)}function b(F){return e&&F.alternate===null&&(F.flags|=67108866),F}function j(F,q,Z,se){return q===null||q.tag!==6?(q=Ao(Z,F.mode,se),q.return=F,q):(q=f(q,Z),q.return=F,q)}function z(F,q,Z,se){var xe=Z.type;return xe===D?ae(F,q,Z.props.children,se,Z.key):q!==null&&(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===re&&$r(xe)===q.type)?(q=f(q,Z.props),ba(q,Z),q.return=F,q):(q=Cl(Z.type,Z.key,Z.props,null,F.mode,se),ba(q,Z),q.return=F,q)}function J(F,q,Z,se){return q===null||q.tag!==4||q.stateNode.containerInfo!==Z.containerInfo||q.stateNode.implementation!==Z.implementation?(q=Io(Z,F.mode,se),q.return=F,q):(q=f(q,Z.children||[]),q.return=F,q)}function ae(F,q,Z,se,xe){return q===null||q.tag!==7?(q=Br(Z,F.mode,se,xe),q.return=F,q):(q=f(q,Z),q.return=F,q)}function ue(F,q,Z){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Ao(""+q,F.mode,Z),q.return=F,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return Z=Cl(q.type,q.key,q.props,null,F.mode,Z),ba(Z,q),Z.return=F,Z;case C:return q=Io(q,F.mode,Z),q.return=F,q;case re:return q=$r(q),ue(F,q,Z)}if(L(q)||Y(q))return q=Br(q,F.mode,Z,null),q.return=F,q;if(typeof q.then=="function")return ue(F,Il(q),Z);if(q.$$typeof===I)return ue(F,Rl(F,q),Z);Dl(F,q)}return null}function ee(F,q,Z,se){var xe=q!==null?q.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return xe!==null?null:j(F,q,""+Z,se);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:return Z.key===xe?z(F,q,Z,se):null;case C:return Z.key===xe?J(F,q,Z,se):null;case re:return Z=$r(Z),ee(F,q,Z,se)}if(L(Z)||Y(Z))return xe!==null?null:ae(F,q,Z,se,null);if(typeof Z.then=="function")return ee(F,q,Il(Z),se);if(Z.$$typeof===I)return ee(F,q,Rl(F,Z),se);Dl(F,Z)}return null}function ne(F,q,Z,se,xe){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return F=F.get(Z)||null,j(q,F,""+se,xe);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case x:return F=F.get(se.key===null?Z:se.key)||null,z(q,F,se,xe);case C:return F=F.get(se.key===null?Z:se.key)||null,J(q,F,se,xe);case re:return se=$r(se),ne(F,q,Z,se,xe)}if(L(se)||Y(se))return F=F.get(Z)||null,ae(q,F,se,xe,null);if(typeof se.then=="function")return ne(F,q,Z,Il(se),xe);if(se.$$typeof===I)return ne(F,q,Z,Rl(q,se),xe);Dl(q,se)}return null}function ye(F,q,Z,se){for(var xe=null,Ve=null,be=q,De=q=0,Be=null;be!==null&&De<Z.length;De++){be.index>De?(Be=be,be=null):Be=be.sibling;var Ye=ee(F,be,Z[De],se);if(Ye===null){be===null&&(be=Be);break}e&&be&&Ye.alternate===null&&n(F,be),q=m(Ye,q,De),Ve===null?xe=Ye:Ve.sibling=Ye,Ve=Ye,be=Be}if(De===Z.length)return a(F,be),Ue&&Bn(F,De),xe;if(be===null){for(;De<Z.length;De++)be=ue(F,Z[De],se),be!==null&&(q=m(be,q,De),Ve===null?xe=be:Ve.sibling=be,Ve=be);return Ue&&Bn(F,De),xe}for(be=s(be);De<Z.length;De++)Be=ne(be,F,De,Z[De],se),Be!==null&&(e&&Be.alternate!==null&&be.delete(Be.key===null?De:Be.key),q=m(Be,q,De),Ve===null?xe=Be:Ve.sibling=Be,Ve=Be);return e&&be.forEach(function(jr){return n(F,jr)}),Ue&&Bn(F,De),xe}function we(F,q,Z,se){if(Z==null)throw Error(l(151));for(var xe=null,Ve=null,be=q,De=q=0,Be=null,Ye=Z.next();be!==null&&!Ye.done;De++,Ye=Z.next()){be.index>De?(Be=be,be=null):Be=be.sibling;var jr=ee(F,be,Ye.value,se);if(jr===null){be===null&&(be=Be);break}e&&be&&jr.alternate===null&&n(F,be),q=m(jr,q,De),Ve===null?xe=jr:Ve.sibling=jr,Ve=jr,be=Be}if(Ye.done)return a(F,be),Ue&&Bn(F,De),xe;if(be===null){for(;!Ye.done;De++,Ye=Z.next())Ye=ue(F,Ye.value,se),Ye!==null&&(q=m(Ye,q,De),Ve===null?xe=Ye:Ve.sibling=Ye,Ve=Ye);return Ue&&Bn(F,De),xe}for(be=s(be);!Ye.done;De++,Ye=Z.next())Ye=ne(be,F,De,Ye.value,se),Ye!==null&&(e&&Ye.alternate!==null&&be.delete(Ye.key===null?De:Ye.key),q=m(Ye,q,De),Ve===null?xe=Ye:Ve.sibling=Ye,Ve=Ye);return e&&be.forEach(function(t1){return n(F,t1)}),Ue&&Bn(F,De),xe}function tt(F,q,Z,se){if(typeof Z=="object"&&Z!==null&&Z.type===D&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:e:{for(var xe=Z.key;q!==null;){if(q.key===xe){if(xe=Z.type,xe===D){if(q.tag===7){a(F,q.sibling),se=f(q,Z.props.children),se.return=F,F=se;break e}}else if(q.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===re&&$r(xe)===q.type){a(F,q.sibling),se=f(q,Z.props),ba(se,Z),se.return=F,F=se;break e}a(F,q);break}else n(F,q);q=q.sibling}Z.type===D?(se=Br(Z.props.children,F.mode,se,Z.key),se.return=F,F=se):(se=Cl(Z.type,Z.key,Z.props,null,F.mode,se),ba(se,Z),se.return=F,F=se)}return b(F);case C:e:{for(xe=Z.key;q!==null;){if(q.key===xe)if(q.tag===4&&q.stateNode.containerInfo===Z.containerInfo&&q.stateNode.implementation===Z.implementation){a(F,q.sibling),se=f(q,Z.children||[]),se.return=F,F=se;break e}else{a(F,q);break}else n(F,q);q=q.sibling}se=Io(Z,F.mode,se),se.return=F,F=se}return b(F);case re:return Z=$r(Z),tt(F,q,Z,se)}if(L(Z))return ye(F,q,Z,se);if(Y(Z)){if(xe=Y(Z),typeof xe!="function")throw Error(l(150));return Z=xe.call(Z),we(F,q,Z,se)}if(typeof Z.then=="function")return tt(F,q,Il(Z),se);if(Z.$$typeof===I)return tt(F,q,Rl(F,Z),se);Dl(F,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,q!==null&&q.tag===6?(a(F,q.sibling),se=f(q,Z),se.return=F,F=se):(a(F,q),se=Ao(Z,F.mode,se),se.return=F,F=se),b(F)):a(F,q)}return function(F,q,Z,se){try{va=0;var xe=tt(F,q,Z,se);return Ti=null,xe}catch(be){if(be===ji||be===Nl)throw be;var Ve=Jt(29,be,null,F.mode);return Ve.lanes=se,Ve.return=F,Ve}}}var Vr=$f(!0),Ff=$f(!1),or=!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 ur(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function cr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Xe&2)!==0){var f=s.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),s.pending=n,n=wl(e),Rf(e,null,a),n}return kl(e,s,n,a),wl(e)}function xa(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 Yo=!1;function Sa(){if(Yo){var e=Ci;if(e!==null)throw e}}function ka(e,n,a,s){Yo=!1;var f=e.updateQueue;or=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var z=j,J=z.next;z.next=null,b===null?m=J:b.next=J,b=z;var ae=e.alternate;ae!==null&&(ae=ae.updateQueue,j=ae.lastBaseUpdate,j!==b&&(j===null?ae.firstBaseUpdate=J:j.next=J,ae.lastBaseUpdate=z))}if(m!==null){var ue=f.baseState;b=0,ae=J=z=null,j=m;do{var ee=j.lane&-536870913,ne=ee!==j.lane;if(ne?(Le&ee)===ee:(s&ee)===ee){ee!==0&&ee===wi&&(Yo=!0),ae!==null&&(ae=ae.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ye=e,we=j;ee=n;var tt=a;switch(we.tag){case 1:if(ye=we.payload,typeof ye=="function"){ue=ye.call(tt,ue,ee);break e}ue=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=we.payload,ee=typeof ye=="function"?ye.call(tt,ue,ee):ye,ee==null)break e;ue=y({},ue,ee);break e;case 2:or=!0}}ee=j.callback,ee!==null&&(e.flags|=64,ne&&(e.flags|=8192),ne=f.callbacks,ne===null?f.callbacks=[ee]:ne.push(ee))}else ne={lane:ee,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ae===null?(J=ae=ne,z=ue):ae=ae.next=ne,b|=ee;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;ne=j,j=ne.next,ne.next=null,f.lastBaseUpdate=ne,f.shared.pending=null}}while(!0);ae===null&&(z=ue),f.baseState=z,f.firstBaseUpdate=J,f.lastBaseUpdate=ae,m===null&&(f.shared.lanes=0),pr|=b,e.lanes=b,e.memoizedState=ue}}function Vf(e,n){if(typeof e!="function")throw Error(l(191,e));e.call(n)}function Yf(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Vf(a[e],n)}var Ri=R(null),Ol=R(0);function Pf(e,n){e=Xn,w(Ol,e),w(Ri,n),Xn=e|n.baseLanes}function Po(){w(Ol,Xn),w(Ri,Ri.current)}function Ko(){Xn=Ol.current,_(Ri),_(Ol)}var Wt=R(null),gn=null;function dr(e){var n=e.alternate;w(mt,mt.current&1),w(Wt,e),gn===null&&(n===null||Ri.current!==null||n.memoizedState!==null)&&(gn=e)}function Xo(e){w(mt,mt.current),w(Wt,e),gn===null&&(gn=e)}function Kf(e){e.tag===22?(w(mt,mt.current),w(Wt,e),gn===null&&(gn=e)):fr()}function fr(){w(mt,mt.current),w(Wt,Wt.current)}function en(e){_(Wt),gn===e&&(gn=null),_(mt)}var mt=R(0);function Ml(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 qn=0,Ae=null,We=null,vt=null,zl=!1,Ei=!1,Yr=!1,_l=0,wa=0,Ni=null,Vb=0;function ct(){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(!Zt(e[a],n[a]))return!1;return!0}function Zo(e,n,a,s,f,m){return qn=m,Ae=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,O.H=e===null||e.memoizedState===null?Ih:fu,Yr=!1,m=a(s,f),Yr=!1,Ei&&(m=Qf(n,a,s,f)),Xf(e),m}function Xf(e){O.H=Ta;var n=We!==null&&We.next!==null;if(qn=0,vt=We=Ae=null,zl=!1,wa=0,Ni=null,n)throw Error(l(300));e===null||bt||(e=e.dependencies,e!==null&&Tl(e)&&(bt=!0))}function Qf(e,n,a,s){Ae=e;var f=0;do{if(Ei&&(Ni=null),wa=0,Ei=!1,25<=f)throw Error(l(301));if(f+=1,vt=We=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}O.H=Dh,m=n(a,s)}while(Ei);return m}function Yb(){var e=O.H,n=e.useState()[0];return n=typeof n.then=="function"?Ca(n):n,e=e.useState()[0],(We!==null?We.memoizedState:null)!==e&&(Ae.flags|=1024),n}function Jo(){var e=_l!==0;return _l=0,e}function Wo(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function eu(e){if(zl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}zl=!1}qn=0,vt=We=Ae=null,Ei=!1,wa=_l=0,Ni=null}function Lt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?Ae.memoizedState=vt=e:vt=vt.next=e,vt}function pt(){if(We===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=We.next;var n=vt===null?Ae.memoizedState:vt.next;if(n!==null)vt=n,We=e;else{if(e===null)throw Ae.alternate===null?Error(l(467)):Error(l(310));We=e,e={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},vt===null?Ae.memoizedState=vt=e:vt=vt.next=e}return vt}function Ll(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ca(e){var n=wa;return wa+=1,Ni===null&&(Ni=[]),e=Uf(Ni,e,n),n=Ae,(vt===null?n.memoizedState:vt.next)===null&&(n=n.alternate,O.H=n===null||n.memoizedState===null?Ih:fu),e}function Bl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ca(e);if(e.$$typeof===I)return It(e)}throw Error(l(438,String(e)))}function tu(e){var n=null,a=Ae.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=Ae.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=Ll(),Ae.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]=M;return n.index++,a}function Gn(e,n){return typeof n=="function"?n(e):n}function Hl(e){var n=pt();return nu(n,We,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,z=null,J=n,ae=!1;do{var ue=J.lane&-536870913;if(ue!==J.lane?(Le&ue)===ue:(qn&ue)===ue){var ee=J.revertLane;if(ee===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ue===wi&&(ae=!0);else if((qn&ee)===ee){J=J.next,ee===wi&&(ae=!0);continue}else ue={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},z===null?(j=z=ue,b=m):z=z.next=ue,Ae.lanes|=ee,pr|=ee;ue=J.action,Yr&&a(m,ue),m=J.hasEagerState?J.eagerState:a(m,ue)}else ee={lane:ue,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},z===null?(j=z=ee,b=m):z=z.next=ee,Ae.lanes|=ue,pr|=ue;J=J.next}while(J!==null&&J!==n);if(z===null?b=m:z.next=j,!Zt(m,e.memoizedState)&&(bt=!0,ae&&(a=Ci,a!==null)))throw a;e.memoizedState=m,e.baseState=b,e.baseQueue=z,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);Zt(m,n.memoizedState)||(bt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,s]}function Zf(e,n,a){var s=Ae,f=pt(),m=Ue;if(m){if(a===void 0)throw Error(l(407));a=a()}else a=n();var b=!Zt((We||f).memoizedState,a);if(b&&(f.memoizedState=a,bt=!0),f=f.queue,lu(eh.bind(null,s,f,e),[e]),f.getSnapshot!==n||b||vt!==null&&vt.memoizedState.tag&1){if(s.flags|=2048,Ai(9,{destroy:void 0},Wf.bind(null,s,f,a,n),null),nt===null)throw Error(l(349));m||(qn&127)!==0||Jf(s,n,a)}return a}function Jf(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ae.updateQueue,n===null?(n=Ll(),Ae.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!Zt(e,a)}catch{return!0}}function nh(e){var n=Lr(e,2);n!==null&&Yt(n,e,2)}function iu(e){var n=Lt();if(typeof e=="function"){var a=e;if(e=a(),Yr){ht(!0);try{a()}finally{ht(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:e},n}function rh(e,n,a,s){return e.baseState=a,nu(e,We,typeof s=="function"?s:Gn)}function Pb(e,n,a,s,f){if(Gl(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)}};O.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=O.T,b={};O.T=b;try{var j=a(f,s),z=O.S;z!==null&&z(b,j),ah(e,n,j)}catch(J){au(e,n,J)}finally{m!==null&&b.types!==null&&(m.types=b.types),O.T=m}}else try{m=a(f,s),ah(e,n,m)}catch(J){au(e,n,J)}}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(Ue){var a=nt.formState;if(a!==null){e:{var s=Ae;if(Ue){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}}lr(s)}s=!1}s&&(n=a[0])}}return a=Lt(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oh,lastRenderedState:n},a.queue=s,a=Eh.bind(null,Ae,s),s.dispatch=a,s=iu(!1),m=du.bind(null,Ae,!1,s.queue),s=Lt(),f={state:n,dispatch:null,action:e,pending:null},s.queue=f,a=Pb.bind(null,Ae,f,m,a),f.dispatch=a,s.memoizedState=e,[n,a,!1]}function ch(e){var n=pt();return dh(n,We,e)}function dh(e,n,a){if(n=nu(e,n,oh)[0],e=Hl(Gn)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Ca(n)}catch(b){throw b===ji?Nl:b}else s=n;n=pt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(Ae.flags|=2048,Ai(9,{destroy:void 0},Kb.bind(null,f,a),null)),[s,m,e]}function Kb(e,n){e.action=n}function fh(e){var n=pt(),a=We;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 Ai(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=Ae.updateQueue,n===null&&(n=Ll(),Ae.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 Ul(e,n,a,s){var f=Lt();Ae.flags|=e,f.memoizedState=Ai(1|n,{destroy:void 0},a,s===void 0?null:s)}function ql(e,n,a,s){var f=pt();s=s===void 0?null:s;var m=f.memoizedState.inst;We!==null&&s!==null&&Qo(s,We.memoizedState.deps)?f.memoizedState=Ai(n,m,a,s):(Ae.flags|=e,f.memoizedState=Ai(1|n,m,a,s))}function mh(e,n){Ul(8390656,8,e,n)}function lu(e,n){ql(2048,8,e,n)}function Xb(e){Ae.flags|=4;var n=Ae.updateQueue;if(n===null)n=Ll(),Ae.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 Xb({ref:n,nextImpl:e}),function(){if((Xe&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function gh(e,n){return ql(4,2,e,n)}function yh(e,n){return ql(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,ql(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){ht(!0);try{e()}finally{ht(!1)}}return a.memoizedState=[s,n],s}function ou(e,n,a){return a===void 0||(qn&1073741824)!==0&&(Le&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=km(),Ae.lanes|=e,pr|=e,a)}function kh(e,n,a,s){return Zt(a,n)?a:Ri.current!==null?(e=ou(e,a,s),Zt(e,n)||(bt=!0),e):(qn&42)===0||(qn&1073741824)!==0&&(Le&261930)===0?(bt=!0,e.memoizedState=a):(e=km(),Ae.lanes|=e,pr|=e,n)}function wh(e,n,a,s,f){var m=H.p;H.p=m!==0&&8>m?m:8;var b=O.T,j={};O.T=j,du(e,!1,n,a);try{var z=f(),J=O.S;if(J!==null&&J(j,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var ae=Fb(z,s);ja(e,n,ae,rn(e))}else ja(e,n,s,rn(e))}catch(ue){ja(e,n,{then:function(){},status:"rejected",reason:ue},rn())}finally{H.p=m,b!==null&&j.types!==null&&(b.types=j.types),O.T=b}}function Qb(){}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?Qb: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:Gn,lastRenderedState:U},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,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),ja(e,n.next.queue,{},rn())}function cu(){return It(Ga)}function Th(){return pt().memoizedState}function Rh(){return pt().memoizedState}function Zb(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=rn();e=ur(a);var s=cr(n,e,a);s!==null&&(Yt(s,n,a),xa(s,n,a)),n={cache:Ho()},e.payload=n;return}n=n.return}}function Jb(e,n,a){var s=rn();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Gl(e)?Nh(n,a):(a=Eo(e,n,a,s),a!==null&&(Yt(a,e,s),Ah(a,n,s)))}function Eh(e,n,a){var s=rn();ja(e,n,a,s)}function ja(e,n,a,s){var f={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Gl(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,Zt(j,b))return kl(e,n,f,0),nt===null&&Sl(),!1}catch{}if(a=Eo(e,n,f,s),a!==null)return Yt(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},Gl(e)){if(n)throw Error(l(479))}else n=Eo(e,a,s,2),n!==null&&Yt(n,e,2)}function Gl(e){var n=e.alternate;return e===Ae||n!==null&&n===Ae}function Nh(e,n){Ei=zl=!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:It,use:Bl,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useLayoutEffect:ct,useInsertionEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useSyncExternalStore:ct,useId:ct,useHostTransitionStatus:ct,useFormState:ct,useActionState:ct,useOptimistic:ct,useMemoCache:ct,useCacheRefresh:ct};Ta.useEffectEvent=ct;var Ih={readContext:It,use:Bl,useCallback:function(e,n){return Lt().memoizedState=[e,n===void 0?null:n],e},useContext:It,useEffect:mh,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Ul(4194308,4,vh.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Ul(4194308,4,e,n)},useInsertionEffect:function(e,n){Ul(4,2,e,n)},useMemo:function(e,n){var a=Lt();n=n===void 0?null:n;var s=e();if(Yr){ht(!0);try{e()}finally{ht(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=Lt();if(a!==void 0){var f=a(n);if(Yr){ht(!0);try{a(n)}finally{ht(!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=Jb.bind(null,Ae,e),[s.memoizedState,e]},useRef:function(e){var n=Lt();return e={current:e},n.memoizedState=e},useState:function(e){e=iu(e);var n=e.queue,a=Eh.bind(null,Ae,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:su,useDeferredValue:function(e,n){var a=Lt();return ou(a,e,n)},useTransition:function(){var e=iu(!1);return e=wh.bind(null,Ae,e.queue,!0,!1),Lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=Ae,f=Lt();if(Ue){if(a===void 0)throw Error(l(407));a=a()}else{if(a=n(),nt===null)throw Error(l(349));(Le&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,Ai(9,{destroy:void 0},Wf.bind(null,s,m,a,n),null),a},useId:function(){var e=Lt(),n=nt.identifierPrefix;if(Ue){var a=Rn,s=Tn;a=(s&~(1<<32-Qe(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=_l++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Vb++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:cu,useFormState:uh,useActionState:uh,useOptimistic:function(e){var n=Lt();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,Ae,!0,a),a.dispatch=n,[e,n]},useMemoCache:tu,useCacheRefresh:function(){return Lt().memoizedState=Zb.bind(null,Ae)},useEffectEvent:function(e){var n=Lt(),a={impl:e};return n.memoizedState=a,function(){if((Xe&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},fu={readContext:It,use:Bl,useCallback:xh,useContext:It,useEffect:lu,useImperativeHandle:bh,useInsertionEffect:gh,useLayoutEffect:yh,useMemo:Sh,useReducer:Hl,useRef:hh,useState:function(){return Hl(Gn)},useDebugValue:su,useDeferredValue:function(e,n){var a=pt();return kh(a,We.memoizedState,e,n)},useTransition:function(){var e=Hl(Gn)[0],n=pt().memoizedState;return[typeof e=="boolean"?e:Ca(e),n]},useSyncExternalStore:Zf,useId:Th,useHostTransitionStatus:cu,useFormState:ch,useActionState:ch,useOptimistic:function(e,n){var a=pt();return rh(a,We,e,n)},useMemoCache:tu,useCacheRefresh:Rh};fu.useEffectEvent=ph;var Dh={readContext:It,use:Bl,useCallback:xh,useContext:It,useEffect:lu,useImperativeHandle:bh,useInsertionEffect:gh,useLayoutEffect:yh,useMemo:Sh,useReducer:ru,useRef:hh,useState:function(){return ru(Gn)},useDebugValue:su,useDeferredValue:function(e,n){var a=pt();return We===null?ou(a,e,n):kh(a,We.memoizedState,e,n)},useTransition:function(){var e=ru(Gn)[0],n=pt().memoizedState;return[typeof e=="boolean"?e:Ca(e),n]},useSyncExternalStore:Zf,useId:Th,useHostTransitionStatus:cu,useFormState:fh,useActionState:fh,useOptimistic:function(e,n){var a=pt();return We!==null?rh(a,We,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:tu,useCacheRefresh:Rh};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=rn(),f=ur(s);f.payload=n,a!=null&&(f.callback=a),n=cr(e,f,s),n!==null&&(Yt(n,e,s),xa(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=rn(),f=ur(s);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=cr(e,f,s),n!==null&&(Yt(n,e,s),xa(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=rn(),s=ur(a);s.tag=2,n!=null&&(s.callback=n),n=cr(e,s,a),n!==null&&(Yt(n,e,a),xa(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?!fa(a,s)||!fa(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 Pr(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){xl(e)}function _h(e){console.error(e)}function Lh(e){xl(e)}function $l(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=ur(a),a.tag=3,a.payload={element:null},a.callback=function(){$l(e,n)},a}function Hh(e){return e=ur(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"&&(gr===null?gr=new Set([this]):gr.add(this));var j=s.stack;this.componentDidCatch(s.value,{componentStack:j!==null?j:""})})}function Wb(e,n,a,s,f){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&ki(n,a,f,!0),a=Wt.current,a!==null){switch(a.tag){case 31:case 13:return gn===null?ts():a.alternate===null&&dt===0&&(dt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,s===Al?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===Al?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),ts(),!1}if(Ue)return n=Wt.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,s!==Mo&&(e=Error(l(422),{cause:s}),pa(fn(e,a)))):(s!==Mo&&(n=Error(l(423),{cause:s}),pa(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),dt!==4&&(dt=2)),!1;var m=Error(l(520),{cause:s});if(m=fn(m,a),Ma===null?Ma=[m]:Ma.push(m),dt!==4&&(dt=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"&&(gr===null||!gr.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)),bt=!1;function Dt(e,n,a,s){n.child=e===null?Ff(n,null,a,s):Vr(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 qr(n),s=Zo(e,n,a,b,m,f),j=Jo(),e!==null&&!bt?(Wo(e,n,f),$n(e,n,f)):(Ue&&j&&Do(n),n.flags|=1,Dt(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=Cl(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:fa,a(b,s)&&e.ref===n.ref)return $n(e,n,f)}return n.flags|=1,e=Ln(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(fa(m,s)&&e.ref===n.ref)if(bt=!1,n.pendingProps=s=m,Cu(e,f))(e.flags&131072)!==0&&(bt=!0);else return n.lanes=e.lanes,$n(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&&El(n,m!==null?m.cachePool:null),m!==null?Pf(n,m):Po(),Kf(n);else return s=n.lanes=536870912,Vh(e,n,m!==null?m.baseLanes|a:a,a,s)}else m!==null?(El(n,m.cachePool),Pf(n,m),fr(),n.memoizedState=null):(e!==null&&El(n,null),Po(),fr());return Dt(e,n,f,a),n.child}function Ra(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:yt._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&El(n,null),Po(),Kf(n),e!==null&&ki(e,n,s,!0),n.childLanes=f,null}function Fl(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 Yh(e,n,a){return Vr(n,e.child,null,a),e=Fl(n,n.pendingProps),e.flags|=2,en(n),n.memoizedState=null,e}function ex(e,n,a){var s=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ue){if(s.mode==="hidden")return e=Fl(n,s),n.lanes=536870912,Ra(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:ir!==null?{id:Tn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},a=Nf(e),a.return=n,n.child=a,At=n,lt=null)):e=null,e===null)throw lr(n);return n.lanes=536870912,null}return Fl(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=Yh(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(l(558));else if(bt||ki(e,n,a,!1),f=(a&e.childLanes)!==0,bt||f){if(s=nt,s!==null&&(b=zd(s,a),b!==0&&b!==m.retryLane))throw m.retryLane=b,Lr(e,b),Yt(s,e,b),gu;ts(),n=Yh(e,n,a)}else e=m.treeContext,lt=yn(b.nextSibling),At=n,Ue=!0,ar=null,pn=!1,e!==null&&Df(n,e),n=Fl(n,s),n.flags|=4096;return n}return e=Ln(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Vl(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 qr(n),a=Zo(e,n,a,s,void 0,f),s=Jo(),e!==null&&!bt?(Wo(e,n,f),$n(e,n,f)):(Ue&&s&&Do(n),n.flags|=1,Dt(e,n,a,f),n.child)}function Ph(e,n,a,s,f,m){return qr(n),n.updateQueue=null,a=Qf(n,s,a,f),Xf(e),s=Jo(),e!==null&&!bt?(Wo(e,n,m),$n(e,n,m)):(Ue&&s&&Do(n),n.flags|=1,Dt(e,n,a,m),n.child)}function Kh(e,n,a,s,f){if(qr(n),n.stateNode===null){var m=vi,b=a.contextType;typeof b=="object"&&b!==null&&(m=It(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?It(b):vi,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),ka(n,s,m,f),Sa(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){m=n.stateNode;var j=n.memoizedProps,z=Pr(a,j);m.props=z;var J=m.context,ae=a.contextType;b=vi,typeof ae=="object"&&ae!==null&&(b=It(ae));var ue=a.getDerivedStateFromProps;ae=typeof ue=="function"||typeof m.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,ae||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(j||J!==b)&&Mh(n,m,s,b),or=!1;var ee=n.memoizedState;m.state=ee,ka(n,s,m,f),Sa(),J=n.memoizedState,j||ee!==J||or?(typeof ue=="function"&&(hu(n,a,ue,s),J=n.memoizedState),(z=or||Oh(n,a,z,s,ee,J,b))?(ae||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=J),m.props=s,m.state=J,m.context=b,s=z):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{m=n.stateNode,Fo(e,n),b=n.memoizedProps,ae=Pr(a,b),m.props=ae,ue=n.pendingProps,ee=m.context,J=a.contextType,z=vi,typeof J=="object"&&J!==null&&(z=It(J)),j=a.getDerivedStateFromProps,(J=typeof j=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==ue||ee!==z)&&Mh(n,m,s,z),or=!1,ee=n.memoizedState,m.state=ee,ka(n,s,m,f),Sa();var ne=n.memoizedState;b!==ue||ee!==ne||or||e!==null&&e.dependencies!==null&&Tl(e.dependencies)?(typeof j=="function"&&(hu(n,a,j,s),ne=n.memoizedState),(ae=or||Oh(n,a,ae,s,ee,ne,z)||e!==null&&e.dependencies!==null&&Tl(e.dependencies))?(J||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(s,ne,z),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(s,ne,z)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=ne),m.props=s,m.state=ne,m.context=z,s=ae):(typeof m.componentDidUpdate!="function"||b===e.memoizedProps&&ee===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&ee===e.memoizedState||(n.flags|=1024),s=!1)}return m=s,Vl(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=Vr(n,e.child,null,f),n.child=Vr(n,null,a,f)):Dt(e,n,a,f),n.memoizedState=m.state,e=n.child):e=$n(e,n,f),e}function Xh(e,n,a,s){return Hr(),n.flags|=256,Dt(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|=nn),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(Ue){if(f?dr(n):fr(),(e=lt)?(e=ip(e,pn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ir!==null?{id:Tn,overflow:Rn}:null,retryLane:536870912,hydrationErrors:null},a=Nf(e),a.return=n,n.child=a,At=n,lt=null)):e=null,e===null)throw lr(n);return nc(e)?n.lanes=32:n.lanes=536870912,null}var j=s.children;return s=s.fallback,f?(fr(),f=n.mode,j=Yl({mode:"hidden",children:j},f),s=Br(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,Ra(null,s)):(dr(n),Su(n,j))}var z=e.memoizedState;if(z!==null&&(j=z.dehydrated,j!==null)){if(m)n.flags&256?(dr(n),n.flags&=-257,n=ku(e,n,a)):n.memoizedState!==null?(fr(),n.child=e.child,n.flags|=128,n=null):(fr(),j=s.fallback,f=n.mode,s=Yl({mode:"visible",children:s.children},f),j=Br(j,f,a,null),j.flags|=2,s.return=n,j.return=n,s.sibling=j,n.child=s,Vr(n,e.child,null,a),s=n.child,s.memoizedState=bu(a),s.childLanes=xu(e,b,a),n.memoizedState=vu,n=Ra(null,s));else if(dr(n),nc(j)){if(b=j.nextSibling&&j.nextSibling.dataset,b)var J=b.dgst;b=J,s=Error(l(419)),s.stack="",s.digest=b,pa({value:s,source:null,stack:null}),n=ku(e,n,a)}else if(bt||ki(e,n,a,!1),b=(a&e.childLanes)!==0,bt||b){if(b=nt,b!==null&&(s=zd(b,a),s!==0&&s!==z.retryLane))throw z.retryLane=s,Lr(e,s),Yt(b,e,s),gu;tc(j)||ts(),n=ku(e,n,a)}else tc(j)?(n.flags|=192,n.child=e.child,n=null):(e=z.treeContext,lt=yn(j.nextSibling),At=n,Ue=!0,ar=null,pn=!1,e!==null&&Df(n,e),n=Su(n,s.children),n.flags|=4096);return n}return f?(fr(),j=s.fallback,f=n.mode,z=e.child,J=z.sibling,s=Ln(z,{mode:"hidden",children:s.children}),s.subtreeFlags=z.subtreeFlags&65011712,J!==null?j=Ln(J,j):(j=Br(j,f,a,null),j.flags|=2),j.return=n,s.return=n,s.sibling=j,n.child=s,Ra(null,s),s=n.child,j=e.child.memoizedState,j===null?j=bu(a):(f=j.cachePool,f!==null?(z=yt._currentValue,f=f.parent!==z?{parent:z,pool:z}:f):f=Bf(),j={baseLanes:j.baseLanes|a,cachePool:f}),s.memoizedState=j,s.childLanes=xu(e,b,a),n.memoizedState=vu,Ra(e.child,s)):(dr(n),a=e.child,e=a.sibling,a=Ln(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=Jt(22,e,null,n),e.lanes=0,e}function ku(e,n,a){return Vr(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,w(mt,b),Dt(e,n,s,a),s=Ue?ma: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&&Ml(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&&Ml(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 $n(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),pr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(ki(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=Ln(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ln(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 tx(e,n,a){switch(n.tag){case 3:he(n,n.stateNode.containerInfo),sr(n,yt,e.memoizedState.cache),Hr();break;case 27:case 5:ge(n);break;case 4:he(n,n.stateNode.containerInfo);break;case 10:sr(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?(dr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Qh(e,n,a):(dr(n),e=$n(e,n,a),e!==null?e.sibling:null);dr(n);break;case 19:var f=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(ki(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),w(mt,mt.current),s)break;return null;case 22:return n.lanes=0,Fh(e,n,a,n.pendingProps);case 24:sr(n,yt,e.memoizedState.cache)}return $n(e,n,a)}function Wh(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)bt=!0;else{if(!Cu(e,a)&&(n.flags&128)===0)return bt=!1,tx(e,n,a);bt=(e.flags&131072)!==0}else bt=!1,Ue&&(n.flags&1048576)!==0&&If(n,ma,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=$r(n.elementType),n.type=e,typeof e=="function")No(e)?(s=Pr(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=Pr(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),ka(n,s,null,a);var b=n.memoizedState;if(s=b.cache,sr(n,yt,s),s!==m.cache&&Bo(n,[yt],a,!0),Sa(),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),pa(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),At=n,Ue=!0,ar=null,pn=!0,a=Ff(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Hr(),s===f){n=$n(e,n,a);break e}Dt(e,n,s,a)}n=n.child}return n;case 26:return Vl(e,n),e===null?(a=cp(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ue||(a=n.type,e=n.pendingProps,s=os(W.current).createElement(a),s[Nt]=n,s[Ut]=e,Ot(s,a,e),Ct(s),n.stateNode=s):n.memoizedState=cp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ge(n),e===null&&Ue&&(s=n.stateNode=sp(n.type,n.pendingProps,W.current),At=n,pn=!0,f=lt,xr(n.type)?(rc=f,lt=yn(s.firstChild)):lt=f),Dt(e,n,n.pendingProps.children,a),Vl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ue&&((f=s=lt)&&(s=Ix(s,n.type,n.pendingProps,pn),s!==null?(n.stateNode=s,At=n,lt=yn(s.firstChild),pn=!1,f=!0):f=!1),f||lr(n)),ge(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,Yb,null,null,a),Ga._currentValue=f),Vl(e,n),Dt(e,n,s,a),n.child;case 6:return e===null&&Ue&&((e=a=lt)&&(a=Dx(a,n.pendingProps,pn),a!==null?(n.stateNode=a,At=n,lt=null,e=!0):e=!1),e||lr(n)),null;case 13:return Qh(e,n,a);case 4:return he(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=Vr(n,null,s,a):Dt(e,n,s,a),n.child;case 11:return qh(e,n,n.type,n.pendingProps,a);case 7:return Dt(e,n,n.pendingProps,a),n.child;case 8:return Dt(e,n,n.pendingProps.children,a),n.child;case 12:return Dt(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,sr(n,n.type,s.value),Dt(e,n,s.children,a),n.child;case 9:return f=n.type._context,s=n.pendingProps.children,qr(n),f=It(f),s=s(f),n.flags|=1,Dt(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 ex(e,n,a);case 22:return Fh(e,n,a,n.pendingProps);case 24:return qr(n),s=It(yt),e===null?(f=qo(),f===null&&(f=nt,m=Ho(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:s,cache:f},$o(n),sr(n,yt,f)):((e.lanes&a)!==0&&(Fo(e,n),ka(n,null,null,a),Sa()),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),sr(n,yt,s)):(s=m.cache,sr(n,yt,s),s!==f.cache&&Bo(n,[yt],a,!0))),Dt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(l(156,n.tag))}function Fn(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(Tm())e.flags|=8192;else throw Fr=Al,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(Tm())e.flags|=8192;else throw Fr=Al,Go}function Pl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Dd():536870912,e.lanes|=n,Mi|=n)}function Ea(e,n){if(!Ue)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 nx(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),Un(yt),pe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Si(n)?Fn(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?(Fn(n),m!==null?(st(n),em(n,m)):(st(n),ju(n,f,null,s,a))):m?m!==e.memoizedState?(Fn(n),st(n),em(n,m)):(st(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Fn(n),st(n),ju(n,f,e,s,a)),null;case 27:if(Ie(n),a=W.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Fn(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return st(n),null}e=te.current,Si(n)?Of(n):(e=sp(f,s,a),n.stateNode=e,Fn(n))}return st(n),null;case 5:if(Ie(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Fn(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return st(n),null}if(m=te.current,Si(n))Of(n);else{var b=os(W.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[Nt]=n,m[Ut]=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(Ot(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&&Fn(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&&Fn(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(l(166));if(e=W.current,Si(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,f=At,f!==null)switch(f.tag){case 27:case 5:s=f.memoizedProps}e[Nt]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Qm(e.nodeValue,a)),e||lr(n,!0)}else e=os(e).createTextNode(s),e[Nt]=n,n.stateNode=e}return st(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=Si(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[Nt]=n}else Hr(),(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?(en(n),n):(en(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=Si(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[Nt]=n}else Hr(),(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?(en(n),n):(en(n),null)}return en(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),Pl(n,n.updateQueue),st(n),null);case 4:return pe(),e===null&&Pu(n.stateNode.containerInfo),st(n),null;case 10:return Un(n.type),st(n),null;case 19:if(_(mt),s=n.memoizedState,s===null)return st(n),null;if(f=(n.flags&128)!==0,m=s.rendering,m===null)if(f)Ea(s,!1);else{if(dt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=Ml(e),m!==null){for(n.flags|=128,Ea(s,!1),e=m.updateQueue,n.updateQueue=e,Pl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Ef(a,e),a=a.sibling;return w(mt,mt.current&1|2),Ue&&Bn(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&Fe()>Jl&&(n.flags|=128,f=!0,Ea(s,!1),n.lanes=4194304)}else{if(!f)if(e=Ml(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Pl(n,e),Ea(s,!0),s.tail===null&&s.tailMode==="hidden"&&!m.alternate&&!Ue)return st(n),null}else 2*Fe()-s.renderingStartTime>Jl&&a!==536870912&&(n.flags|=128,f=!0,Ea(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=Fe(),e.sibling=null,a=mt.current,w(mt,f?a&1|2:a&1),Ue&&Bn(n,s.treeForkCount),e):(st(n),null);case 22:case 23:return en(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&&Pl(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&&_(Gr),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Un(yt),st(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function rx(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 Un(yt),pe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Ie(n),null;case 31:if(n.memoizedState!==null){if(en(n),n.alternate===null)throw Error(l(340));Hr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(en(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));Hr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return _(mt),null;case 4:return pe(),null;case 10:return Un(n.type),null;case 22:case 23:return en(n),Ko(),e!==null&&_(Gr),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Un(yt),null;case 25:return null;default:return null}}function tm(e,n){switch(Oo(n),n.tag){case 3:Un(yt),pe();break;case 26:case 27:case 5:Ie(n);break;case 4:pe();break;case 31:n.memoizedState!==null&&en(n);break;case 13:en(n);break;case 19:_(mt);break;case 10:Un(n.type);break;case 22:case 23:en(n),Ko(),e!==null&&_(Gr);break;case 24:Un(yt)}}function Na(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){Je(n,n.return,j)}}function hr(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 z=a,J=j;try{J()}catch(ae){Je(f,z,ae)}}}s=s.next}while(s!==m)}}catch(ae){Je(n,n.return,ae)}}function nm(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Yf(n,a)}catch(s){Je(e,e.return,s)}}}function rm(e,n,a){a.props=Pr(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){Je(e,n,s)}}function Aa(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){Je(e,n,f)}}function En(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(f){Je(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){Je(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){Je(e,e.return,f)}}function Tu(e,n,a){try{var s=e.stateNode;jx(s,e.type,a,n),s[Ut]=n}catch(f){Je(e,e.return,f)}}function am(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&xr(e.type)||e.tag===4}function Ru(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&&xr(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=zn));else if(s!==4&&(s===27&&xr(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 Kl(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&&xr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Kl(e,n,a),e=e.sibling;e!==null;)Kl(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]);Ot(n,s,a),n[Nt]=e,n[Ut]=a}catch(m){Je(e,e.return,m)}}var Vn=!1,xt=!1,Nu=!1,sm=typeof WeakSet=="function"?WeakSet:Set,jt=null;function ix(e,n){if(e=e.containerInfo,Qu=ps,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,z=-1,J=0,ae=0,ue=e,ee=null;t:for(;;){for(var ne;ue!==a||f!==0&&ue.nodeType!==3||(j=b+f),ue!==m||s!==0&&ue.nodeType!==3||(z=b+s),ue.nodeType===3&&(b+=ue.nodeValue.length),(ne=ue.firstChild)!==null;)ee=ue,ue=ne;for(;;){if(ue===e)break t;if(ee===a&&++J===f&&(j=b),ee===m&&++ae===s&&(z=b),(ne=ue.nextSibling)!==null)break;ue=ee,ee=ue.parentNode}ue=ne}a=j===-1||z===-1?null:{start:j,end:z}}else a=null}a=a||{start:0,end:0}}else a=null;for(Zu={focusedElem:e,selectionRange:a},ps=!1,jt=n;jt!==null;)if(n=jt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,jt=e;else for(;jt!==null;){switch(n=jt,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 ye=Pr(a.type,f);e=s.getSnapshotBeforeUpdate(ye,m),s.__reactInternalSnapshotBeforeUpdate=e}catch(we){Je(a,a.return,we)}}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,jt=e;break}jt=n.return}}function om(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Pn(e,a),s&4&&Na(5,a);break;case 1:if(Pn(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(b){Je(a,a.return,b)}else{var f=Pr(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Je(a,a.return,b)}}s&64&&nm(a),s&512&&Aa(a,a.return);break;case 3:if(Pn(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{Yf(e,n)}catch(b){Je(a,a.return,b)}}break;case 27:n===null&&s&4&&lm(a);case 26:case 5:Pn(e,a),n===null&&s&4&&im(a),s&512&&Aa(a,a.return);break;case 12:Pn(e,a);break;case 31:Pn(e,a),s&4&&dm(e,a);break;case 13:Pn(e,a),s&4&&fm(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=hx.bind(null,a),Ox(e,a))));break;case 22:if(s=a.memoizedState!==null||Vn,!s){n=n!==null&&n.memoizedState!==null||xt,f=Vn;var m=xt;Vn=s,(xt=n)&&!m?Kn(e,a,(a.subtreeFlags&8772)!==0):Pn(e,a),Vn=f,xt=m}break;case 30:break;default:Pn(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,Gt=!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(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(Oe,a)}catch{}switch(a.tag){case 26:xt||En(a,n),Yn(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:xt||En(a,n);var s=ot,f=Gt;xr(a.type)&&(ot=a.stateNode,Gt=!1),Yn(e,n,a),Ha(a.stateNode),ot=s,Gt=f;break;case 5:xt||En(a,n);case 6:if(s=ot,f=Gt,ot=null,Yn(e,n,a),ot=s,Gt=f,ot!==null)if(Gt)try{(ot.nodeType===9?ot.body:ot.nodeName==="HTML"?ot.ownerDocument.body:ot).removeChild(a.stateNode)}catch(m){Je(a,n,m)}else try{ot.removeChild(a.stateNode)}catch(m){Je(a,n,m)}break;case 18:ot!==null&&(Gt?(e=ot,np(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Gi(e)):np(ot,a.stateNode));break;case 4:s=ot,f=Gt,ot=a.stateNode.containerInfo,Gt=!0,Yn(e,n,a),ot=s,Gt=f;break;case 0:case 11:case 14:case 15:hr(2,a,n),xt||hr(4,a,n),Yn(e,n,a);break;case 1:xt||(En(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:xt=(s=xt)||a.memoizedState!==null,Yn(e,n,a),xt=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{Gi(e)}catch(a){Je(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{Gi(e)}catch(a){Je(n,n.return,a)}}function ax(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 Xl(e,n){var a=ax(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var f=mx.bind(null,e,s);s.then(f,f)}})}function $t(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(xr(j.type)){ot=j.stateNode,Gt=!1;break e}break;case 5:ot=j.stateNode,Gt=!1;break e;case 3:case 4:ot=j.stateNode.containerInfo,Gt=!0;break e}j=j.return}if(ot===null)throw Error(l(160));cm(m,b,f),ot=null,Gt=!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 Sn=null;function hm(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:$t(n,e),Ft(e),s&4&&(hr(3,e,e.return),Na(3,e),hr(5,e,e.return));break;case 1:$t(n,e),Ft(e),s&512&&(xt||a===null||En(a,a.return)),s&64&&Vn&&(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=Sn;if($t(n,e),Ft(e),s&512&&(xt||a===null||En(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[ra]||m[Nt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(s),f.head.insertBefore(m,f.querySelector("head > title"))),Ot(m,s,a),m[Nt]=e,Ct(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),Ot(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),Ot(m,s,a),f.head.appendChild(m);break;default:throw Error(l(468,s))}m[Nt]=e,Ct(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&&Tu(e,e.memoizedProps,a.memoizedProps)}break;case 27:$t(n,e),Ft(e),s&512&&(xt||a===null||En(a,a.return)),a!==null&&s&4&&Tu(e,e.memoizedProps,a.memoizedProps);break;case 5:if($t(n,e),Ft(e),s&512&&(xt||a===null||En(a,a.return)),e.flags&32){f=e.stateNode;try{di(f,"")}catch(ye){Je(e,e.return,ye)}}s&4&&e.stateNode!=null&&(f=e.memoizedProps,Tu(e,f,a!==null?a.memoizedProps:f)),s&1024&&(Nu=!0);break;case 6:if($t(n,e),Ft(e),s&4){if(e.stateNode===null)throw Error(l(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(ye){Je(e,e.return,ye)}}break;case 3:if(ds=null,f=Sn,Sn=us(n.containerInfo),$t(n,e),Sn=f,Ft(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{Gi(n.containerInfo)}catch(ye){Je(e,e.return,ye)}Nu&&(Nu=!1,mm(e));break;case 4:s=Sn,Sn=us(e.stateNode.containerInfo),$t(n,e),Ft(e),Sn=s;break;case 12:$t(n,e),Ft(e);break;case 31:$t(n,e),Ft(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 13:$t(n,e),Ft(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Zl=Fe()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 22:f=e.memoizedState!==null;var z=a!==null&&a.memoizedState!==null,J=Vn,ae=xt;if(Vn=J||f,xt=ae||z,$t(n,e),xt=ae,Vn=J,Ft(e),s&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||z||Vn||xt||Kr(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){z=a=n;try{if(m=z.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{j=z.stateNode;var ue=z.memoizedProps.style,ee=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;j.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(ye){Je(z,z.return,ye)}}}else if(n.tag===6){if(a===null){z=n;try{z.stateNode.nodeValue=f?"":z.memoizedProps}catch(ye){Je(z,z.return,ye)}}}else if(n.tag===18){if(a===null){z=n;try{var ne=z.stateNode;f?rp(ne,!0):rp(z.stateNode,!1)}catch(ye){Je(z,z.return,ye)}}}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,Xl(e,a))));break;case 19:$t(n,e),Ft(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 30:break;case 21:break;default:$t(n,e),Ft(e)}}function Ft(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=Ru(e);Kl(e,m,f);break;case 5:var b=a.stateNode;a.flags&32&&(di(b,""),a.flags&=-33);var j=Ru(e);Kl(e,j,b);break;case 3:case 4:var z=a.stateNode.containerInfo,J=Ru(e);Eu(e,J,z);break;default:throw Error(l(161))}}catch(ae){Je(e,e.return,ae)}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 Pn(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)om(e,n.alternate,n),n=n.sibling}function Kr(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:hr(4,n,n.return),Kr(n);break;case 1:En(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&rm(n,n.return,a),Kr(n);break;case 27:Ha(n.stateNode);case 26:case 5:En(n,n.return),Kr(n);break;case 22:n.memoizedState===null&&Kr(n);break;case 30:Kr(n);break;default:Kr(n)}e=e.sibling}}function Kn(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:Kn(f,m,a),Na(4,m);break;case 1:if(Kn(f,m,a),s=m,f=s.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(J){Je(s,s.return,J)}if(s=m,f=s.updateQueue,f!==null){var j=s.stateNode;try{var z=f.shared.hiddenCallbacks;if(z!==null)for(f.shared.hiddenCallbacks=null,f=0;f<z.length;f++)Vf(z[f],j)}catch(J){Je(s,s.return,J)}}a&&b&64&&nm(m),Aa(m,m.return);break;case 27:lm(m);case 26:case 5:Kn(f,m,a),a&&s===null&&b&4&&im(m),Aa(m,m.return);break;case 12:Kn(f,m,a);break;case 31:Kn(f,m,a),a&&b&4&&dm(f,m);break;case 13:Kn(f,m,a),a&&b&4&&fm(f,m);break;case 22:m.memoizedState===null&&Kn(f,m,a),Aa(m,m.return);break;case 30:break;default:Kn(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&&ga(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&&ga(e))}function kn(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:kn(e,n,a,s),f&2048&&Na(9,n);break;case 1:kn(e,n,a,s);break;case 3:kn(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&&ga(e)));break;case 12:if(f&2048){kn(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(z){Je(n,n.return,z)}}else kn(e,n,a,s);break;case 31:kn(e,n,a,s);break;case 13:kn(e,n,a,s);break;case 23:break;case 22:m=n.stateNode,b=n.alternate,n.memoizedState!==null?m._visibility&2?kn(e,n,a,s):Ia(e,n):m._visibility&2?kn(e,n,a,s):(m._visibility|=2,Ii(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Au(b,n);break;case 24:kn(e,n,a,s),f&2048&&Iu(n.alternate,n);break;default:kn(e,n,a,s)}}function Ii(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,z=s,J=b.flags;switch(b.tag){case 0:case 11:case 15:Ii(m,b,j,z,f),Na(8,b);break;case 23:break;case 22:var ae=b.stateNode;b.memoizedState!==null?ae._visibility&2?Ii(m,b,j,z,f):Ia(m,b):(ae._visibility|=2,Ii(m,b,j,z,f)),f&&J&2048&&Au(b.alternate,b);break;case 24:Ii(m,b,j,z,f),f&&J&2048&&Iu(b.alternate,b);break;default:Ii(m,b,j,z,f)}n=n.sibling}}function Ia(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:Ia(a,s),f&2048&&Au(s.alternate,s);break;case 24:Ia(a,s),f&2048&&Iu(s.alternate,s);break;default:Ia(a,s)}n=n.sibling}}var Da=8192;function Di(e,n,a){if(e.subtreeFlags&Da)for(e=e.child;e!==null;)gm(e,n,a),e=e.sibling}function gm(e,n,a){switch(e.tag){case 26:Di(e,n,a),e.flags&Da&&e.memoizedState!==null&&Vx(a,Sn,e.memoizedState,e.memoizedProps);break;case 5:Di(e,n,a);break;case 3:case 4:var s=Sn;Sn=us(e.stateNode.containerInfo),Di(e,n,a),Sn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Da,Da=16777216,Di(e,n,a),Da=s):Di(e,n,a));break;default:Di(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 Oa(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];jt=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:Oa(e),e.flags&2048&&hr(9,e,e.return);break;case 3:Oa(e);break;case 12:Oa(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Ql(e)):Oa(e);break;default:Oa(e)}}function Ql(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];jt=s,bm(s,e)}ym(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:hr(8,n,n.return),Ql(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Ql(n));break;default:Ql(n)}e=e.sibling}}function bm(e,n){for(;jt!==null;){var a=jt;switch(a.tag){case 0:case 11:case 15:hr(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:ga(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,jt=s;else e:for(a=e;jt!==null;){s=jt;var f=s.sibling,m=s.return;if(um(s),s===a){jt=null;break e}if(f!==null){f.return=m,jt=f;break e}jt=m}}}var lx={getCacheForType:function(e){var n=It(yt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return It(yt).controller.signal}},sx=typeof WeakMap=="function"?WeakMap:Map,Xe=0,nt=null,Me=null,Le=0,Ze=0,tn=null,mr=!1,Oi=!1,Du=!1,Xn=0,dt=0,pr=0,Xr=0,Ou=0,nn=0,Mi=0,Ma=null,Vt=null,Mu=!1,Zl=0,xm=0,Jl=1/0,Wl=null,gr=null,kt=0,yr=null,zi=null,Qn=0,zu=0,_u=null,Sm=null,za=0,Lu=null;function rn(){return(Xe&2)!==0&&Le!==0?Le&-Le:O.T!==null?$u():_d()}function km(){if(nn===0)if((Le&536870912)===0||Ue){var e=Ir;Ir<<=1,(Ir&3932160)===0&&(Ir=262144),nn=e}else nn=536870912;return e=Wt.current,e!==null&&(e.flags|=32),nn}function Yt(e,n,a){(e===nt&&(Ze===2||Ze===9)||e.cancelPendingCommit!==null)&&(_i(e,0),vr(e,Le,nn,!1)),na(e,a),((Xe&2)===0||e!==nt)&&(e===nt&&((Xe&2)===0&&(Xr|=a),dt===4&&vr(e,Le,nn,!1)),Nn(e))}function wm(e,n,a){if((Xe&6)!==0)throw Error(l(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ta(e,n),f=s?cx(e,n):Hu(e,n,!0),m=s;do{if(f===0){Oi&&!s&&vr(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!ox(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=Ma;var z=j.current.memoizedState.isDehydrated;if(z&&(_i(j,b).flags|=256),b=Hu(j,b,!1),b!==2){if(Du&&!z){j.errorRecoveryDisabledLanes|=m,Xr|=m,f=4;break e}m=Vt,Vt=f,m!==null&&(Vt===null?Vt=m:Vt.push.apply(Vt,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){_i(e,0),vr(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:vr(s,n,nn,!mr);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(f=Zl+300-Fe(),10<f)){if(vr(s,n,nn,!mr),ul(s,0,!0)!==0)break e;Qn=n,s.timeoutHandle=ep(Cm.bind(null,s,a,Vt,Wl,Mu,n,nn,Xr,Mi,mr,m,"Throttled",-0,0),f);break e}Cm(s,a,Vt,Wl,Mu,n,nn,Xr,Mi,mr,m,null,-0,0)}}break}while(!0);Nn(e)}function Cm(e,n,a,s,f,m,b,j,z,J,ae,ue,ee,ne){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:zn},gm(n,m,ue);var ye=(m&62914560)===m?Zl-Fe():(m&4194048)===m?xm-Fe():0;if(ye=Yx(ue,ye),ye!==null){Qn=m,e.cancelPendingCommit=ye(Dm.bind(null,e,n,m,a,s,f,b,j,z,ae,ue,null,ee,ne)),vr(e,m,b,!J);return}}Dm(e,n,m,a,s,f,b,j,z)}function ox(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(!Zt(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 vr(e,n,a,s){n&=~Ou,n&=~Xr,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var f=n;0<f;){var m=31-Qe(f),b=1<<m;s[m]=-1,f&=~b}a!==0&&Od(e,a,n)}function es(){return(Xe&6)===0?(_a(0),!1):!0}function Bu(){if(Me!==null){if(Ze===0)var e=Me.return;else e=Me,Hn=Ur=null,eu(e),Ti=null,va=0,e=Me;for(;e!==null;)tm(e.alternate,e),e=e.return;Me=null}}function _i(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Ex(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Qn=0,Bu(),nt=e,Me=a=Ln(e.current,null),Le=n,Ze=0,tn=null,mr=!1,Oi=ta(e,n),Du=!1,Mi=nn=Ou=Xr=pr=dt=0,Vt=Ma=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-Qe(s),m=1<<f;n|=e[f],s&=~m}return Xn=n,Sl(),a}function jm(e,n){Ae=null,O.H=Ta,n===ji||n===Nl?(n=qf(),Ze=3):n===Go?(n=qf(),Ze=4):Ze=n===gu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,tn=n,Me===null&&(dt=1,$l(e,fn(n,e.current)))}function Tm(){var e=Wt.current;return e===null?!0:(Le&4194048)===Le?gn===null:(Le&62914560)===Le||(Le&536870912)!==0?e===gn:!1}function Rm(){var e=O.H;return O.H=Ta,e===null?Ta:e}function Em(){var e=O.A;return O.A=lx,e}function ts(){dt=4,mr||(Le&4194048)!==Le&&Wt.current!==null||(Oi=!0),(pr&134217727)===0&&(Xr&134217727)===0||nt===null||vr(nt,Le,nn,!1)}function Hu(e,n,a){var s=Xe;Xe|=2;var f=Rm(),m=Em();(nt!==e||Le!==n)&&(Wl=null,_i(e,n)),n=!1;var b=dt;e:do try{if(Ze!==0&&Me!==null){var j=Me,z=tn;switch(Ze){case 8:Bu(),b=6;break e;case 3:case 2:case 9:case 6:Wt.current===null&&(n=!0);var J=Ze;if(Ze=0,tn=null,Li(e,j,z,J),a&&Oi){b=0;break e}break;default:J=Ze,Ze=0,tn=null,Li(e,j,z,J)}}ux(),b=dt;break}catch(ae){jm(e,ae)}while(!0);return n&&e.shellSuspendCounter++,Hn=Ur=null,Xe=s,O.H=f,O.A=m,Me===null&&(nt=null,Le=0,Sl()),b}function ux(){for(;Me!==null;)Nm(Me)}function cx(e,n){var a=Xe;Xe|=2;var s=Rm(),f=Em();nt!==e||Le!==n?(Wl=null,Jl=Fe()+500,_i(e,n)):Oi=ta(e,n);e:do try{if(Ze!==0&&Me!==null){n=Me;var m=tn;t:switch(Ze){case 1:Ze=0,tn=null,Li(e,n,m,1);break;case 2:case 9:if(Hf(m)){Ze=0,tn=null,Am(n);break}n=function(){Ze!==2&&Ze!==9||nt!==e||(Ze=7),Nn(e)},m.then(n,n);break e;case 3:Ze=7;break e;case 4:Ze=5;break e;case 7:Hf(m)?(Ze=0,tn=null,Am(n)):(Ze=0,tn=null,Li(e,n,m,7));break;case 5:var b=null;switch(Me.tag){case 26:b=Me.memoizedState;case 5:case 27:var j=Me;if(b?pp(b):j.stateNode.complete){Ze=0,tn=null;var z=j.sibling;if(z!==null)Me=z;else{var J=j.return;J!==null?(Me=J,ns(J)):Me=null}break t}}Ze=0,tn=null,Li(e,n,m,5);break;case 6:Ze=0,tn=null,Li(e,n,m,6);break;case 8:Bu(),dt=6;break e;default:throw Error(l(462))}}dx();break}catch(ae){jm(e,ae)}while(!0);return Hn=Ur=null,O.H=s,O.A=f,Xe=a,Me!==null?0:(nt=null,Le=0,Sl(),dt)}function dx(){for(;Me!==null&&!qe();)Nm(Me)}function Nm(e){var n=Wh(e.alternate,e,Xn);e.memoizedProps=e.pendingProps,n===null?ns(e):Me=n}function Am(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Ph(a,n,n.pendingProps,n.type,void 0,Le);break;case 11:n=Ph(a,n,n.pendingProps,n.type.render,n.ref,Le);break;case 5:eu(n);default:tm(a,n),n=Me=Ef(n,Xn),n=Wh(a,n,Xn)}e.memoizedProps=e.pendingProps,n===null?ns(e):Me=n}function Li(e,n,a,s){Hn=Ur=null,eu(n),Ti=null,va=0;var f=n.return;try{if(Wb(e,f,n,a,Le)){dt=1,$l(e,fn(a,e.current)),Me=null;return}}catch(m){if(f!==null)throw Me=f,m;dt=1,$l(e,fn(a,e.current)),Me=null;return}n.flags&32768?(Ue||s===1?e=!0:Oi||(Le&536870912)!==0?e=!1:(mr=e=!0,(s===2||s===9||s===3||s===6)&&(s=Wt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Im(n,e)):ns(n)}function ns(e){var n=e;do{if((n.flags&32768)!==0){Im(n,mr);return}e=n.return;var a=nx(n.alternate,n,Xn);if(a!==null){Me=a;return}if(n=n.sibling,n!==null){Me=n;return}Me=n=e}while(n!==null);dt===0&&(dt=5)}function Im(e,n){do{var a=rx(e.alternate,e);if(a!==null){a.flags&=32767,Me=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Me=e;return}Me=e=a}while(e!==null);dt=6,Me=null}function Dm(e,n,a,s,f,m,b,j,z){e.cancelPendingCommit=null;do rs();while(kt!==0);if((Xe&6)!==0)throw Error(l(327));if(n!==null){if(n===e.current)throw Error(l(177));if(m=n.lanes|n.childLanes,m|=Ro,Fv(e,a,m,b,j,z),e===nt&&(Me=nt=null,Le=0),zi=n,yr=e,Qn=a,zu=m,_u=f,Sm=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,px(ve,function(){return Lm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=O.T,O.T=null,f=H.p,H.p=2,b=Xe,Xe|=4;try{ix(e,n,a)}finally{Xe=b,H.p=f,O.T=s}}kt=1,Om(),Mm(),zm()}}function Om(){if(kt===1){kt=0;var e=yr,n=zi,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=O.T,O.T=null;var s=H.p;H.p=2;var f=Xe;Xe|=4;try{hm(n,e);var m=Zu,b=bf(e.containerInfo),j=m.focusedElem,z=m.selectionRange;if(b!==j&&j&&j.ownerDocument&&vf(j.ownerDocument.documentElement,j)){if(z!==null&&ko(j)){var J=z.start,ae=z.end;if(ae===void 0&&(ae=J),"selectionStart"in j)j.selectionStart=J,j.selectionEnd=Math.min(ae,j.value.length);else{var ue=j.ownerDocument||document,ee=ue&&ue.defaultView||window;if(ee.getSelection){var ne=ee.getSelection(),ye=j.textContent.length,we=Math.min(z.start,ye),tt=z.end===void 0?we:Math.min(z.end,ye);!ne.extend&&we>tt&&(b=tt,tt=we,we=b);var F=yf(j,we),q=yf(j,tt);if(F&&q&&(ne.rangeCount!==1||ne.anchorNode!==F.node||ne.anchorOffset!==F.offset||ne.focusNode!==q.node||ne.focusOffset!==q.offset)){var Z=ue.createRange();Z.setStart(F.node,F.offset),ne.removeAllRanges(),we>tt?(ne.addRange(Z),ne.extend(q.node,q.offset)):(Z.setEnd(q.node,q.offset),ne.addRange(Z))}}}}for(ue=[],ne=j;ne=ne.parentNode;)ne.nodeType===1&&ue.push({element:ne,left:ne.scrollLeft,top:ne.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}}ps=!!Qu,Zu=Qu=null}finally{Xe=f,H.p=s,O.T=a}}e.current=n,kt=2}}function Mm(){if(kt===2){kt=0;var e=yr,n=zi,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=O.T,O.T=null;var s=H.p;H.p=2;var f=Xe;Xe|=4;try{om(e,n.alternate,n)}finally{Xe=f,H.p=s,O.T=a}}kt=3}}function zm(){if(kt===4||kt===3){kt=0,ut();var e=yr,n=zi,a=Qn,s=Sm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?kt=5:(kt=0,zi=yr=null,_m(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(gr=null),no(a),n=n.stateNode,He&&typeof He.onCommitFiberRoot=="function")try{He.onCommitFiberRoot(Oe,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=O.T,f=H.p,H.p=2,O.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{O.T=n,H.p=f}}(Qn&3)!==0&&rs(),Nn(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Lu?za++:(za=0,Lu=e):za=0,_a(0)}}function _m(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ga(n)))}function rs(){return Om(),Mm(),zm(),Lm()}function Lm(){if(kt!==5)return!1;var e=yr,n=zu;zu=0;var a=no(Qn),s=O.T,f=H.p;try{H.p=32>a?32:a,O.T=null,a=_u,_u=null;var m=yr,b=Qn;if(kt=0,zi=yr=null,Qn=0,(Xe&6)!==0)throw Error(l(331));var j=Xe;if(Xe|=4,vm(m.current),pm(m,m.current,b,a),Xe=j,_a(0,!1),He&&typeof He.onPostCommitFiberRoot=="function")try{He.onPostCommitFiberRoot(Oe,m)}catch{}return!0}finally{H.p=f,O.T=s,_m(e,n)}}function Bm(e,n,a){n=fn(a,n),n=pu(e.stateNode,n,2),e=cr(e,n,2),e!==null&&(na(e,2),Nn(e))}function Je(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"&&(gr===null||!gr.has(s))){e=fn(a,e),a=Hh(2),s=cr(n,a,2),s!==null&&(Uh(a,s,n,e),na(s,2),Nn(s));break}}n=n.return}}function Uu(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new sx;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=fx.bind(null,e,n,a),n.then(e,e))}function fx(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,nt===e&&(Le&a)===a&&(dt===4||dt===3&&(Le&62914560)===Le&&300>Fe()-Zl?(Xe&2)===0&&_i(e,0):Ou|=a,Mi===Le&&(Mi=0)),Nn(e)}function Hm(e,n){n===0&&(n=Dd()),e=Lr(e,n),e!==null&&(na(e,n),Nn(e))}function hx(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Hm(e,a)}function mx(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 px(e,n){return Rt(e,n)}var is=null,Bi=null,qu=!1,as=!1,Gu=!1,br=0;function Nn(e){e!==Bi&&e.next===null&&(Bi===null?is=Bi=e:Bi=Bi.next=e),as=!0,qu||(qu=!0,yx())}function _a(e,n){if(!Gu&&as){Gu=!0;do for(var a=!1,s=is;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-Qe(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=Le,m=ul(s,s===nt?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(m&3)===0||ta(s,m)||(a=!0,$m(s,m));s=s.next}while(a);Gu=!1}}function gx(){Um()}function Um(){as=qu=!1;var e=0;br!==0&&Rx()&&(e=br);for(var n=Fe(),a=null,s=is;s!==null;){var f=s.next,m=qm(s,n);m===0?(s.next=null,a===null?is=f:a.next=f,f===null&&(Bi=a)):(a=s,(e!==0||(m&3)!==0)&&(as=!0)),s=f}kt!==0&&kt!==5||_a(e),br!==0&&(br=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-Qe(m),j=1<<b,z=f[b];z===-1?((j&a)===0||(j&s)!==0)&&(f[b]=$v(j,n)):z<=n&&(e.expiredLanes|=j),m&=~j}if(n=nt,a=Le,a=ul(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(Ze===2||Ze===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&je(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ta(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&je(s),no(a)){case 2:case 8:a=de;break;case 32:a=ve;break;case 268435456:a=Te;break;default:a=ve}return s=Gm.bind(null,e),a=Rt(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&je(s),e.callbackPriority=2,e.callbackNode=null,2}function Gm(e,n){if(kt!==0&&kt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(rs()&&e.callbackNode!==a)return null;var s=Le;return s=ul(e,e===nt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(wm(e,s,n),qm(e,Fe()),e.callbackNode!=null&&e.callbackNode===a?Gm.bind(null,e):null)}function $m(e,n){if(rs())return null;wm(e,n,!0)}function yx(){Nx(function(){(Xe&6)!==0?Rt(P,gx):Um()})}function $u(){if(br===0){var e=wi;e===0&&(e=Et,Et<<=1,(Et&261888)===0&&(Et=256)),br=e}return br}function Fm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:hl(""+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 vx(e,n,a,s,f){if(n==="submit"&&a&&a.stateNode===f){var m=Fm((f[Ut]||null).action),b=s.submitter;b&&(n=(n=b[Ut]||null)?Fm(n.formAction):b.getAttribute("formAction"),n!==null&&(m=n,b=null));var j=new yl("action","action",null,s,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(br!==0){var z=b?Vm(f,b):new FormData(f);uu(a,{pending:!0,data:z,method:f.method,action:m},null,z)}}else typeof m=="function"&&(j.preventDefault(),z=b?Vm(f,b):new FormData(f),uu(a,{pending:!0,data:z,method:f.method,action:m},m,z))},currentTarget:f}]})}}for(var Fu=0;Fu<To.length;Fu++){var Vu=To[Fu],bx=Vu.toLowerCase(),xx=Vu[0].toUpperCase()+Vu.slice(1);xn(bx,"on"+xx)}xn(kf,"onAnimationEnd"),xn(wf,"onAnimationIteration"),xn(Cf,"onAnimationStart"),xn("dblclick","onDoubleClick"),xn("focusin","onFocus"),xn("focusout","onBlur"),xn(_b,"onTransitionRun"),xn(Lb,"onTransitionStart"),xn(Bb,"onTransitionCancel"),xn(jf,"onTransitionEnd"),ui("onMouseEnter",["mouseout","mouseover"]),ui("onMouseLeave",["mouseout","mouseover"]),ui("onPointerEnter",["pointerout","pointerover"]),ui("onPointerLeave",["pointerout","pointerover"]),Or("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Or("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Or("onBeforeInput",["compositionend","keypress","textInput","paste"]),Or("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Or("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Or("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var La="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(" "),Sx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(La));function Ym(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],z=j.instance,J=j.currentTarget;if(j=j.listener,z!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=J;try{m(f)}catch(ae){xl(ae)}f.currentTarget=null,m=z}else for(b=0;b<s.length;b++){if(j=s[b],z=j.instance,J=j.currentTarget,j=j.listener,z!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=J;try{m(f)}catch(ae){xl(ae)}f.currentTarget=null,m=z}}}}function ze(e,n){var a=n[ro];a===void 0&&(a=n[ro]=new Set);var s=e+"__bubble";a.has(s)||(Pm(n,e,2,!1),a.add(s))}function Yu(e,n,a){var s=0;n&&(s|=4),Pm(a,e,s,n)}var ls="_reactListening"+Math.random().toString(36).slice(2);function Pu(e){if(!e[ls]){e[ls]=!0,Hd.forEach(function(a){a!=="selectionchange"&&(Sx.has(a)||Yu(a,!1,e),Yu(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ls]||(n[ls]=!0,Yu("selectionchange",!1,n))}}function Pm(e,n,a,s){switch(kp(n)){case 2:var f=Xx;break;case 8:f=Qx;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 z=b.tag;if((z===3||z===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;j!==null;){if(b=li(j),b===null)return;if(z=b.tag,z===5||z===6||z===26||z===27){s=m=b;continue e}j=j.parentNode}}s=s.return}Zd(function(){var J=m,ae=co(a),ue=[];e:{var ee=Tf.get(e);if(ee!==void 0){var ne=yl,ye=e;switch(e){case"keypress":if(pl(a)===0)break e;case"keydown":case"keyup":ne=mb;break;case"focusin":ye="focus",ne=yo;break;case"focusout":ye="blur",ne=yo;break;case"beforeblur":case"afterblur":ne=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":ne=ef;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=nb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=yb;break;case kf:case wf:case Cf:ne=ab;break;case jf:ne=bb;break;case"scroll":case"scrollend":ne=eb;break;case"wheel":ne=Sb;break;case"copy":case"cut":case"paste":ne=sb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=nf;break;case"toggle":case"beforetoggle":ne=wb}var we=(n&4)!==0,tt=!we&&(e==="scroll"||e==="scrollend"),F=we?ee!==null?ee+"Capture":null:ee;we=[];for(var q=J,Z;q!==null;){var se=q;if(Z=se.stateNode,se=se.tag,se!==5&&se!==26&&se!==27||Z===null||F===null||(se=aa(q,F),se!=null&&we.push(Ba(q,se,Z))),tt)break;q=q.return}0<we.length&&(ee=new ne(ee,ye,null,a,ae),ue.push({event:ee,listeners:we}))}}if((n&7)===0){e:{if(ee=e==="mouseover"||e==="pointerover",ne=e==="mouseout"||e==="pointerout",ee&&a!==uo&&(ye=a.relatedTarget||a.fromElement)&&(li(ye)||ye[ai]))break e;if((ne||ee)&&(ee=ae.window===ae?ae:(ee=ae.ownerDocument)?ee.defaultView||ee.parentWindow:window,ne?(ye=a.relatedTarget||a.toElement,ne=J,ye=ye?li(ye):null,ye!==null&&(tt=d(ye),we=ye.tag,ye!==tt||we!==5&&we!==27&&we!==6)&&(ye=null)):(ne=null,ye=J),ne!==ye)){if(we=ef,se="onMouseLeave",F="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(we=nf,se="onPointerLeave",F="onPointerEnter",q="pointer"),tt=ne==null?ee:ia(ne),Z=ye==null?ee:ia(ye),ee=new we(se,q+"leave",ne,a,ae),ee.target=tt,ee.relatedTarget=Z,se=null,li(ae)===J&&(we=new we(F,q+"enter",ye,a,ae),we.target=Z,we.relatedTarget=tt,se=we),tt=se,ne&&ye)t:{for(we=kx,F=ne,q=ye,Z=0,se=F;se;se=we(se))Z++;se=0;for(var xe=q;xe;xe=we(xe))se++;for(;0<Z-se;)F=we(F),Z--;for(;0<se-Z;)q=we(q),se--;for(;Z--;){if(F===q||q!==null&&F===q.alternate){we=F;break t}F=we(F),q=we(q)}we=null}else we=null;ne!==null&&Km(ue,ee,ne,we,!1),ye!==null&&tt!==null&&Km(ue,tt,ye,we,!0)}}e:{if(ee=J?ia(J):window,ne=ee.nodeName&&ee.nodeName.toLowerCase(),ne==="select"||ne==="input"&&ee.type==="file")var Ve=df;else if(uf(ee))if(ff)Ve=Ob;else{Ve=Ib;var be=Ab}else ne=ee.nodeName,!ne||ne.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?J&&oo(J.elementType)&&(Ve=df):Ve=Db;if(Ve&&(Ve=Ve(e,J))){cf(ue,Ve,a,ae);break e}be&&be(e,ee,J),e==="focusout"&&J&&ee.type==="number"&&J.memoizedProps.value!=null&&so(ee,"number",ee.value)}switch(be=J?ia(J):window,e){case"focusin":(uf(be)||be.contentEditable==="true")&&(pi=be,wo=J,ha=null);break;case"focusout":ha=wo=pi=null;break;case"mousedown":Co=!0;break;case"contextmenu":case"mouseup":case"dragend":Co=!1,xf(ue,a,ae);break;case"selectionchange":if(zb)break;case"keydown":case"keyup":xf(ue,a,ae)}var De;if(bo)e:{switch(e){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else mi?sf(e,a)&&(Be="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Be="onCompositionStart");Be&&(rf&&a.locale!=="ko"&&(mi||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&mi&&(De=Jd()):(rr=ae,mo="value"in rr?rr.value:rr.textContent,mi=!0)),be=ss(J,Be),0<be.length&&(Be=new tf(Be,e,null,a,ae),ue.push({event:Be,listeners:be}),De?Be.data=De:(De=of(a),De!==null&&(Be.data=De)))),(De=jb?Tb(e,a):Rb(e,a))&&(Be=ss(J,"onBeforeInput"),0<Be.length&&(be=new tf("onBeforeInput","beforeinput",null,a,ae),ue.push({event:be,listeners:Be}),be.data=De)),vx(ue,e,J,a,ae)}Ym(ue,n)})}function Ba(e,n,a){return{instance:e,listener:n,currentTarget:a}}function ss(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=aa(e,a),f!=null&&s.unshift(Ba(e,f,m)),f=aa(e,n),f!=null&&s.push(Ba(e,f,m))),e.tag===3)return s;e=e.return}return[]}function kx(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,z=j.alternate,J=j.stateNode;if(j=j.tag,z!==null&&z===s)break;j!==5&&j!==26&&j!==27||J===null||(z=J,f?(J=aa(a,m),J!=null&&b.unshift(Ba(a,J,z))):f||(J=aa(a,m),J!=null&&b.push(Ba(a,J,z)))),a=a.return}b.length!==0&&e.push({event:n,listeners:b})}var wx=/\r\n?/g,Cx=/\u0000|\uFFFD/g;function Xm(e){return(typeof e=="string"?e:""+e).replace(wx,`
9
+ `).replace(Cx,"")}function Qm(e,n){return n=Xm(n),Xm(e)===n}function et(e,n,a,s,f,m){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||di(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&di(e,""+s);break;case"className":dl(e,"class",s);break;case"tabIndex":dl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":dl(e,a,s);break;case"style":Xd(e,s,m);break;case"data":if(n!=="object"){dl(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=hl(""+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"&&et(e,n,"name",f.name,f,null),et(e,n,"formEncType",f.formEncType,f,null),et(e,n,"formMethod",f.formMethod,f,null),et(e,n,"formTarget",f.formTarget,f,null)):(et(e,n,"encType",f.encType,f,null),et(e,n,"method",f.method,f,null),et(e,n,"target",f.target,f,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=hl(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=zn);break;case"onScroll":s!=null&&ze("scroll",e);break;case"onScrollEnd":s!=null&&ze("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=hl(""+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":ze("beforetoggle",e),ze("toggle",e),cl(e,"popover",s);break;case"xlinkActuate":Mn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Mn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Mn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Mn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Mn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Mn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Mn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Mn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Mn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":cl(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=Jv.get(a)||a,cl(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"?di(e,s):(typeof s=="number"||typeof s=="bigint")&&di(e,""+s);break;case"onScroll":s!=null&&ze("scroll",e);break;case"onScrollEnd":s!=null&&ze("scrollend",e);break;case"onClick":s!=null&&(e.onclick=zn);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[Ut]||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,""):cl(e,a,s)}}}function Ot(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ze("error",e),ze("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:et(e,n,m,b,a,null)}}f&&et(e,n,"srcSet",a.srcSet,a,null),s&&et(e,n,"src",a.src,a,null);return;case"input":ze("invalid",e);var j=m=b=f=null,z=null,J=null;for(s in a)if(a.hasOwnProperty(s)){var ae=a[s];if(ae!=null)switch(s){case"name":f=ae;break;case"type":b=ae;break;case"checked":z=ae;break;case"defaultChecked":J=ae;break;case"value":m=ae;break;case"defaultValue":j=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(l(137,n));break;default:et(e,n,s,ae,a,null)}}Vd(e,m,j,z,J,b,f,!1);return;case"select":ze("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:et(e,n,f,j,a,null)}n=m,a=b,e.multiple=!!s,n!=null?ci(e,!!s,n,!1):a!=null&&ci(e,!!s,a,!0);return;case"textarea":ze("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:et(e,n,b,j,a,null)}Pd(e,s,f,m);return;case"option":for(z in a)a.hasOwnProperty(z)&&(s=a[z],s!=null)&&(z==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":et(e,n,z,s,a,null));return;case"dialog":ze("beforetoggle",e),ze("toggle",e),ze("cancel",e),ze("close",e);break;case"iframe":case"object":ze("load",e);break;case"video":case"audio":for(s=0;s<La.length;s++)ze(La[s],e);break;case"image":ze("error",e),ze("load",e);break;case"details":ze("toggle",e);break;case"embed":case"source":case"link":ze("error",e),ze("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(J in a)if(a.hasOwnProperty(J)&&(s=a[J],s!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:et(e,n,J,s,a,null)}return;default:if(oo(n)){for(ae in a)a.hasOwnProperty(ae)&&(s=a[ae],s!==void 0&&Xu(e,n,ae,s,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(s=a[j],s!=null&&et(e,n,j,s,a,null))}function jx(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,z=null,J=null,ae=null;for(ne in a){var ue=a[ne];if(a.hasOwnProperty(ne)&&ue!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":z=ue;default:s.hasOwnProperty(ne)||et(e,n,ne,null,s,ue)}}for(var ee in s){var ne=s[ee];if(ue=a[ee],s.hasOwnProperty(ee)&&(ne!=null||ue!=null))switch(ee){case"type":m=ne;break;case"name":f=ne;break;case"checked":J=ne;break;case"defaultChecked":ae=ne;break;case"value":b=ne;break;case"defaultValue":j=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(l(137,n));break;default:ne!==ue&&et(e,n,ee,ne,s,ue)}}lo(e,b,j,z,J,ae,m,f);return;case"select":ne=b=j=ee=null;for(m in a)if(z=a[m],a.hasOwnProperty(m)&&z!=null)switch(m){case"value":break;case"multiple":ne=z;default:s.hasOwnProperty(m)||et(e,n,m,null,s,z)}for(f in s)if(m=s[f],z=a[f],s.hasOwnProperty(f)&&(m!=null||z!=null))switch(f){case"value":ee=m;break;case"defaultValue":j=m;break;case"multiple":b=m;default:m!==z&&et(e,n,f,m,s,z)}n=j,a=b,s=ne,ee!=null?ci(e,!!a,ee,!1):!!s!=!!a&&(n!=null?ci(e,!!a,n,!0):ci(e,!!a,a?[]:"",!1));return;case"textarea":ne=ee=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:et(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":ee=f;break;case"defaultValue":ne=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==m&&et(e,n,b,f,s,m)}Yd(e,ee,ne);return;case"option":for(var ye in a)ee=a[ye],a.hasOwnProperty(ye)&&ee!=null&&!s.hasOwnProperty(ye)&&(ye==="selected"?e.selected=!1:et(e,n,ye,null,s,ee));for(z in s)ee=s[z],ne=a[z],s.hasOwnProperty(z)&&ee!==ne&&(ee!=null||ne!=null)&&(z==="selected"?e.selected=ee&&typeof ee!="function"&&typeof ee!="symbol":et(e,n,z,ee,s,ne));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var we in a)ee=a[we],a.hasOwnProperty(we)&&ee!=null&&!s.hasOwnProperty(we)&&et(e,n,we,null,s,ee);for(J in s)if(ee=s[J],ne=a[J],s.hasOwnProperty(J)&&ee!==ne&&(ee!=null||ne!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(l(137,n));break;default:et(e,n,J,ee,s,ne)}return;default:if(oo(n)){for(var tt in a)ee=a[tt],a.hasOwnProperty(tt)&&ee!==void 0&&!s.hasOwnProperty(tt)&&Xu(e,n,tt,void 0,s,ee);for(ae in s)ee=s[ae],ne=a[ae],!s.hasOwnProperty(ae)||ee===ne||ee===void 0&&ne===void 0||Xu(e,n,ae,ee,s,ne);return}}for(var F in a)ee=a[F],a.hasOwnProperty(F)&&ee!=null&&!s.hasOwnProperty(F)&&et(e,n,F,null,s,ee);for(ue in s)ee=s[ue],ne=a[ue],!s.hasOwnProperty(ue)||ee===ne||ee==null&&ne==null||et(e,n,ue,ee,s,ne)}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 Tx(){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 z=a[s],J=z.startTime;if(J>j)break;var ae=z.transferSize,ue=z.initiatorType;ae&&Zm(ue)&&(z=z.responseEnd,b+=ae*(z<j?1:(j-J)/(z-J)))}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 os(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 Rx(){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,Ex=typeof clearTimeout=="function"?clearTimeout:void 0,tp=typeof Promise=="function"?Promise:void 0,Nx=typeof queueMicrotask=="function"?queueMicrotask:typeof tp<"u"?function(e){return tp.resolve(null).then(e).catch(Ax)}:ep;function Ax(e){setTimeout(function(){throw e})}function xr(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),Gi(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")Ha(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ha(a);for(var m=a.firstChild;m;){var b=m.nextSibling,j=m.nodeName;m[ra]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=b}}else a==="body"&&Ha(e.ownerDocument.body);a=f}while(a);Gi(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 Ix(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[ra])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 Dx(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 Ox(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=os(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 Ha(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);io(e)}var vn=new Map,op=new Set;function us(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Zn=H.d;H.d={f:Mx,r:zx,D:_x,C:Lx,L:Bx,m:Hx,X:qx,S:Ux,M:Gx};function Mx(){var e=Zn.f(),n=es();return e||n}function zx(e){var n=si(e);n!==null&&n.tag===5&&n.type==="form"?jh(n):Zn.r(e)}var Hi=typeof document>"u"?null:document;function up(e,n,a){var s=Hi;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"),Ot(n,"link",e),Ct(n),s.head.appendChild(n)))}}function _x(e){Zn.D(e),up("dns-prefetch",e,null)}function Lx(e,n){Zn.C(e,n),up("preconnect",e,n)}function Bx(e,n,a){Zn.L(e,n,a);var s=Hi;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=Ui(e);break;case"script":m=qi(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(Ua(m))||n==="script"&&s.querySelector(qa(m))||(n=s.createElement("link"),Ot(n,"link",e),Ct(n),s.head.appendChild(n)))}}function Hx(e,n){Zn.m(e,n);var a=Hi;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=qi(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(qa(m)))return}s=a.createElement("link"),Ot(s,"link",e),Ct(s),a.head.appendChild(s)}}}function Ux(e,n,a){Zn.S(e,n,a);var s=Hi;if(s&&e){var f=oi(s).hoistableStyles,m=Ui(e);n=n||"default";var b=f.get(m);if(!b){var j={loading:0,preload:null};if(b=s.querySelector(Ua(m)))j.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=vn.get(m))&&ic(e,a);var z=b=s.createElement("link");Ct(z),Ot(z,"link",e),z._p=new Promise(function(J,ae){z.onload=J,z.onerror=ae}),z.addEventListener("load",function(){j.loading|=1}),z.addEventListener("error",function(){j.loading|=2}),j.loading|=4,cs(b,n,s)}b={type:"stylesheet",instance:b,count:1,state:j},f.set(m,b)}}}function qx(e,n){Zn.X(e,n);var a=Hi;if(a&&e){var s=oi(a).hoistableScripts,f=qi(e),m=s.get(f);m||(m=a.querySelector(qa(f)),m||(e=y({src:e,async:!0},n),(n=vn.get(f))&&ac(e,n),m=a.createElement("script"),Ct(m),Ot(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},s.set(f,m))}}function Gx(e,n){Zn.M(e,n);var a=Hi;if(a&&e){var s=oi(a).hoistableScripts,f=qi(e),m=s.get(f);m||(m=a.querySelector(qa(f)),m||(e=y({src:e,async:!0,type:"module"},n),(n=vn.get(f))&&ac(e,n),m=a.createElement("script"),Ct(m),Ot(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=W.current)?us(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=Ui(a.href),a=oi(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=Ui(a.href);var m=oi(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(Ua(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||$x(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=qi(a),a=oi(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 Ui(e){return'href="'+cn(e)+'"'}function Ua(e){return'link[rel="stylesheet"]['+e+"]"}function dp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function $x(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}),Ot(n,"link",a),Ct(n),e.head.appendChild(n))}function qi(e){return'[src="'+cn(e)+'"]'}function qa(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,Ct(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"),Ct(s),Ot(s,"style",f),cs(s,a.precedence,e),n.instance=s;case"stylesheet":f=Ui(a.href);var m=e.querySelector(Ua(f));if(m)return n.state.loading|=4,n.instance=m,Ct(m),m;s=dp(a),(f=vn.get(f))&&ic(s,f),m=(e.ownerDocument||e).createElement("link"),Ct(m);var b=m;return b._p=new Promise(function(j,z){b.onload=j,b.onerror=z}),Ot(m,"link",s),n.state.loading|=4,cs(m,a.precedence,e),n.instance=m;case"script":return m=qi(a.src),(f=e.querySelector(qa(m)))?(n.instance=f,Ct(f),f):(s=a,(f=vn.get(m))&&(s=y({},a),ac(s,f)),e=e.ownerDocument||e,f=e.createElement("script"),Ct(f),Ot(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,cs(s,a.precedence,e));return n.instance}function cs(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 ds=null;function hp(e,n,a){if(ds===null){var s=new Map,f=ds=new Map;f.set(a,s)}else f=ds,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[ra]||m[Nt]||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 Fx(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 Vx(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=Ui(s.href),m=n.querySelector(Ua(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=fs.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,Ct(m);return}m=n.ownerDocument||n,s=dp(s),(f=vn.get(f))&&ic(s,f),m=m.createElement("link"),Ct(m);var b=m;b._p=new Promise(function(j,z){b.onload=j,b.onerror=z}),Ot(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=fs.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var lc=0;function Yx(e,n){return e.stylesheets&&e.count===0&&ms(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&ms(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&lc===0&&(lc=62500*Tx());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ms(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 fs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ms(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hs=null;function ms(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hs=new Map,n.forEach(Px,e),hs=null,fs.call(e))}function Px(e,n){if(!(n.state.loading&4)){var a=hs.get(e);if(a)var s=a.get(null);else{a=new Map,hs.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=fs.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 Ga={$$typeof:I,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function Kx(e,n,a,s,f,m,b,j,z){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=z,this.incompleteTransitions=new Map}function gp(e,n,a,s,f,m,b,j,z,J,ae,ue){return e=new Kx(e,n,a,b,z,J,ae,ue,j),n=1,m===!0&&(n|=24),m=Jt(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=vi,e):vi}function vp(e,n,a,s,f,m){f=yp(f),s.context===null?s.context=f:s.pendingContext=f,s=ur(n),s.payload={element:a},m=m===void 0?null:m,m!==null&&(s.callback=m),a=cr(e,s,n),a!==null&&(Yt(a,e,n),xa(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=Lr(e,67108864);n!==null&&Yt(n,e,67108864),sc(e,67108864)}}function Sp(e){if(e.tag===13||e.tag===31){var n=rn();n=to(n);var a=Lr(e,n);a!==null&&Yt(a,e,n),sc(e,n)}}var ps=!0;function Xx(e,n,a,s){var f=O.T;O.T=null;var m=H.p;try{H.p=2,oc(e,n,a,s)}finally{H.p=m,O.T=f}}function Qx(e,n,a,s){var f=O.T;O.T=null;var m=H.p;try{H.p=8,oc(e,n,a,s)}finally{H.p=m,O.T=f}}function oc(e,n,a,s){if(ps){var f=uc(s);if(f===null)Ku(e,n,s,gs,a),wp(e,s);else if(Jx(f,e,n,a,s))s.stopPropagation();else if(wp(e,s),n&4&&-1<Zx.indexOf(e)){for(;f!==null;){var m=si(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Dr(m.pendingLanes);if(b!==0){var j=m;for(j.pendingLanes|=2,j.entangledLanes|=2;b;){var z=1<<31-Qe(b);j.entanglements[1]|=z,b&=~z}Nn(m),(Xe&6)===0&&(Jl=Fe()+500,_a(0))}}break;case 31:case 13:j=Lr(m,2),j!==null&&Yt(j,m,2),es(),sc(m,2)}if(m=uc(s),m===null&&Ku(e,n,s,gs,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 gs=null;function cc(e){if(gs=null,e=li(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 gs=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(oe()){case P:return 2;case de:return 8;case ve:case Ce:return 32;case Te:return 268435456;default:return 32}default:return 32}}var dc=!1,Sr=null,kr=null,wr=null,$a=new Map,Fa=new Map,Cr=[],Zx="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":Sr=null;break;case"dragenter":case"dragleave":kr=null;break;case"mouseover":case"mouseout":wr=null;break;case"pointerover":case"pointerout":$a.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fa.delete(n.pointerId)}}function Va(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=si(n),n!==null&&xp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function Jx(e,n,a,s,f){switch(n){case"focusin":return Sr=Va(Sr,e,n,a,s,f),!0;case"dragenter":return kr=Va(kr,e,n,a,s,f),!0;case"mouseover":return wr=Va(wr,e,n,a,s,f),!0;case"pointerover":var m=f.pointerId;return $a.set(m,Va($a.get(m)||null,e,n,a,s,f)),!0;case"gotpointercapture":return m=f.pointerId,Fa.set(m,Va(Fa.get(m)||null,e,n,a,s,f)),!0}return!1}function Cp(e){var n=li(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 ys(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=si(a),n!==null&&xp(n),e.blockedOn=a,!1;n.shift()}return!0}function jp(e,n,a){ys(e)&&a.delete(n)}function Wx(){dc=!1,Sr!==null&&ys(Sr)&&(Sr=null),kr!==null&&ys(kr)&&(kr=null),wr!==null&&ys(wr)&&(wr=null),$a.forEach(jp),Fa.forEach(jp)}function vs(e,n){e.blockedOn===n&&(e.blockedOn=null,dc||(dc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Wx)))}var bs=null;function Tp(e){bs!==e&&(bs=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){bs===e&&(bs=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=si(a);m!==null&&(e.splice(n,3),n-=3,uu(m,{pending:!0,data:f,method:a.method,action:s},s,f))}}))}function Gi(e){function n(z){return vs(z,e)}Sr!==null&&vs(Sr,e),kr!==null&&vs(kr,e),wr!==null&&vs(wr,e),$a.forEach(n),Fa.forEach(n);for(var a=0;a<Cr.length;a++){var s=Cr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Cr.length&&(a=Cr[0],a.blockedOn===null);)Cp(a),a.blockedOn===null&&Cr.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[Ut]||null;if(typeof m=="function")b||Tp(a);else if(b){var j=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[Ut]||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),Tp(a)}}}function Rp(){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}xs.prototype.render=fc.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(l(409));var a=n.current,s=rn();vp(a,s,e,n,null,null)},xs.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),es(),n[ai]=null}};function xs(e){this._internalRoot=e}xs.prototype.unstable_scheduleHydration=function(e){if(e){var n=_d();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Cr.length&&n!==0&&n<Cr[a].priority;a++);Cr.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 e1={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ss=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ss.isDisabled&&Ss.supportsFiber)try{Oe=Ss.inject(e1),He=Ss}catch{}}return Pa.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,Rp),e[ai]=n.current,Pu(e),new fc(n)},Pa.hydrateRoot=function(e,n,a){if(!o(e))throw Error(l(299));var s=!1,f="",m=zh,b=_h,j=Lh,z=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&&(z=a.formState)),n=gp(e,1,!0,n,a??null,s,f,z,m,b,j,Rp),n.context=yp(null),a=n.current,s=rn(),s=to(s),f=ur(s),f.callback=null,cr(a,f,s),a=s,n.current.lanes=a,na(n,a),Nn(n),e[ai]=n.current,Pu(e),new xs(n)},Pa.version="19.2.8",Pa}var Bp;function u1(){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=o1(),pc.exports}var c1=u1();function Qr(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 d1(t){const r=Qr(t.at)??Qr(t.timestamp)??Qr(t.recordedAt)??"",i=Qr(t.errorMessage)??Qr(t.label)??Qr(t.type)??Qr(t.message)??"运行事件";return r?`${r} · ${i}`:i}function Wa(t){return String(t.nodeId??t.id??"").trim()}function bc(t){const r=Wa(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=>Wa(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 f1({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 E=A=>{A.key==="Escape"&&i()};return document.addEventListener("keydown",E),document.title=`检视 · DAG ${t} · Loop Operator`,()=>document.removeEventListener("keydown",E)},[t,i]),k.useEffect(()=>{const E=new AbortController;return S(!0),v(null),g([]),(async()=>{try{const A=await fetch(`/api/dag-runs/${encodeURIComponent(t)}`,{signal:E.signal,credentials:"same-origin"});if(!A.ok)throw new Error(`DAG 查询失败(HTTP ${A.status})`);const I=await A.json();if(E.signal.aborted)return;u(I);const G=Array.isArray(I.nodes)?I.nodes:[],K=Hp(G,r),N=K?Wa(K):r?.trim();if(N){const $=await fetch(`/api/dag-runs/${encodeURIComponent(t)}/nodes/${encodeURIComponent(N)}/session-events`,{signal:E.signal,credentials:"same-origin"});if($.ok){const re=await $.json();E.signal.aborted||g((re.events??[]).slice(-20))}}}catch(A){E.signal.aborted||v(A instanceof Error?A.message:String(A))}finally{E.signal.aborted||S(!1)}})(),()=>E.abort()},[t,r]);const x=k.useMemo(()=>Array.isArray(d?.nodes)?d.nodes:[],[d]),C=Hp(x,r),D=C?Wa(C):"",B=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:B})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"当前节点"}),c.jsx("dd",{children:C?bc(C):"暂无节点"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"节点状态"}),c.jsx("dd",{children:C?.status??"—"})]}),C?.errorPreview?c.jsxs("div",{children:[c.jsx("dt",{children:"错误摘要"}),c.jsx("dd",{children:C.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(E=>{const A=Wa(E)||bc(E),I=A===D;return c.jsxs("li",{"data-active":I?"true":void 0,className:I?"is-active":void 0,children:[c.jsx("span",{children:bc(E)}),c.jsx("code",{children:E.status??"—"})]},A)})}):c.jsx("p",{className:"muted",children:y?"加载节点中…":"该运行暂无节点。"})]}),c.jsxs("section",{children:[c.jsxs("h3",{children:["最近事件",D?` · ${D}`:""]}),h.length?c.jsx("ul",{className:"inspect-split-events",children:h.map((E,A)=>c.jsx("li",{children:d1(E)},`${E.at??A}-${A}`))}):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 h1(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 ks(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 m1(t){const r=ks(t);if(!r)return null;const i=ks(r.result),l=[ks(r.reviewPacket),i?ks(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 p1(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 ny(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 g1(t){return t.mergeState==="pending-harvest"||/\bscheduler harvest\b/i.test(t.nextAction)}function y1(t){return t.status==="failed"||t.status==="human_required"||t.status==="cancelled"||/\bscheduler discard\b/i.test(t.nextAction)}function As(t){return t==="failed"||t==="human_required"}function v1(t){return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function ry(t){return{submitted:"已提交",validating:"校验中",validated:"待预约确认",scheduled:"已预约",waiting:"等待触发",dispatching:"派发中",running:"执行中",succeeded:"成功",failed:"失败",human_required:"需人工",cancelled:"已取消",rejected:"已拒绝",cancel_requested:"取消中"}[t]??t}function b1(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,"(",ry(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)})]}),As(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||As(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 x1(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 S1(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:ry(u.status)})]}),c.jsxs("p",{className:"muted",children:["执行 ",ny(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:[g1(u)?c.jsx("button",{type:"button",className:"btn btn-primary",disabled:i,"data-testid":"night-row-harvest",onClick:()=>l(u),children:"Harvest"}):null,y1(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 k1(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:ny(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 w1(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),[C,D]=k.useState(null),[B,E]=k.useState(null),A=k.useCallback(async()=>{y(!0),p(null);try{const[N,$,re,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 M=await N.json();if(l(M),$.ok?d(await $.json()):d(null),re.ok){const V=await re.json();h(Array.isArray(V)?V:[])}else h([]);if(ce.ok){const V=await ce.json();V.ticker&&E(V.ticker)}}catch(N){p(N instanceof Error?N.message:String(N))}finally{y(!1)}},[]);k.useEffect(()=>{A()},[A]);const I=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();D(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:C,auxTicker:B,refreshBoard:A,onMorningReport:I,doctorIssues:G,clockHint:K}}function C1(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,C]=k.useState(""),[D,B]=k.useState(null),[E,A]=k.useState(""),[I,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,Q)=>{const T=U.featureId??"",R=Q.featureId??"";return T!==R?T.localeCompare(R):U.taskId.localeCompare(Q.taskId)}),H},[d]),re=k.useMemo(()=>p?$.find(H=>`${H.featureId}::${H.taskId}`===p)??null:null,[$,p]),ce=re?.featureId?qp(re.featureId):"",M=k.useCallback(async(H,U,Q)=>{const T=await i("prepareMutationGate",{action:H,actionParams:U});if(!l(T))return;const R=T?.result??T,_=R.receiptId?R:R.result??R;if(!_.receiptId||!_.humanGateToken){o("prepareMutationGate 未返回可消费的 Human Gate receipt");return}return i(H,{...U,confirmationId:_.receiptId,humanGateToken:_.humanGateToken},{clientRequestId:v1(Q)})},[l,i,o]),V=k.useCallback(async()=>{if(!re?.featureId){o("请先点选 Feature / Task");return}const H=p1(y);if(!H){o("执行时间格式无效,请使用日期时间选择器");return}const U={featureDir:qp(re.featureId),taskId:re.taskId,at:H,tz:"Asia/Shanghai",...x.trim()?{taskCard:x.trim()}:{}},Q=await M("workerAdmissionPrepare",U,"night-prepare");if(!l(Q))return;const T=m1(Q?.result??Q);if(!T){o("准备成功但未解析到 scheduleId / gateToken。请刷新后重试,或查看 Inspect。");return}B(T),g("review")},[l,y,M,re,o,x]),Y=k.useCallback(async()=>{if(!D)return;const H=await M("workerSchedulerAdd",{scheduleId:D.scheduleId,approveGate:D.gateToken},"night-add");l(H)&&(B(null),g("pick"),v(""),C(""),S(Gp()),await u())},[l,u,D,M]),le=k.useCallback(()=>{g("pick"),B(null)},[]),X=k.useCallback(async H=>{const U=await M("workerSchedulerHarvest",{scheduleId:H.scheduleId},"night-harvest");l(U)&&await u()},[l,u,M]),L=k.useCallback(async()=>{if(!I)return;const H=E.trim()||"discard from console night workbench",U=As(I.status),Q=await M("workerSchedulerDiscard",{scheduleId:I.scheduleId,reason:H,...U||K?{force:!0}:{}},"night-discard");l(Q)&&(G(null),A(""),N(!1),await u())},[E,I,K,l,u,M]),O=k.useCallback(H=>{G(H),N(As(H.status)),A("")},[]);return{phase:h,selectedKey:p,setSelectedKey:v,nightAt:y,setNightAt:S,taskCard:x,setTaskCard:C,review:D,discardReason:E,setDiscardReason:A,discardTarget:I,setDiscardTarget:G,forceDiscard:K,setForceDiscard:N,selectableTasks:$,derivedFeatureDir:ce,onPrepare:V,onConfirmAdd:Y,onCancelWizard:le,onHarvest:X,onDiscard:L,openDiscard:O}}function j1({busy:t,runAction:r,isActionSuccess:i,setOpError:l}){const o=w1({setOpError:l}),d=C1({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(x1,{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(S1,{board:o,busy:t,onHarvest:u=>{d.onHarvest(u)},onOpenDiscard:d.openDiscard}),d.discardTarget?c.jsx(b1,{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(k1,{wizard:d,busy:t}),c.jsx(h1,{board:o,busy:t})]})}var T1=ty();const R1=({color:t="currentColor",size:r=24,className:i,...l})=>Nr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Nr.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"})),E1=({color:t="currentColor",size:r=24,className:i,...l})=>Nr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Nr.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"})),N1=({color:t="currentColor",size:r=24,className:i,...l})=>Nr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Nr.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"})),A1=({color:t="currentColor",size:r=24,className:i,...l})=>Nr.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:t,...l,className:"remixicon "+(i||"")},Nr.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"})),I1=["command","query","operation","tool","server","symbol","path","file_path","filePath","pattern","glob","url"],D1=120,O1=800;function Is(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function M1(t){if(t!=null){if(typeof t=="string"){const r=t.trim();if(!r)return;try{return Is(JSON.parse(r))}catch{return}}return Is(t)}}function Wn(t,r){const i=t.replace(/\s+/g," ").trim();return i?i.length>r?`${i.slice(0,r)}…`:i:""}function wt(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 z1(t,r,i){const l=(t??"").toLowerCase();if(l==="bash"||l==="shell"){const o=wt(r,"command");return o?Wn(o,i):void 0}if(l==="mcp"||l.startsWith("mcp_")){const o=wt(r,"server"),d=wt(r,"tool")??wt(r,"name"),u=wt(r,"query");return o&&d?Wn(`${o} · ${d}`,i):d?Wn(d,i):u?Wn(u,i):o?Wn(o,i):void 0}if(l==="lsp_navigation"||l.includes("lsp")){const o=[wt(r,"operation"),wt(r,"symbol"),wt(r,"path")??wt(r,"file_path")??wt(r,"filePath")].filter(Boolean),d=wt(r,"line")??wt(r,"position");if(o.length===0&&!d)return;const u=o.join(" · ");return Wn(d?`${u}${u?":":""}${d}`:u,i)}if(l==="symbol_search"||l.includes("symbol_search")){const o=wt(r,"query")??wt(r,"symbol");return o?Wn(o,i):void 0}if(l==="read"||l==="read_symbol"||l==="read_enclosing"||l.startsWith("read_")){const o=wt(r,"path")??wt(r,"file_path")??wt(r,"filePath"),d=wt(r,"symbol"),u=wt(r,"line");if(!o&&!d)return;const h=[o,d,u].filter(Boolean);return Wn(h.join(" · "),i)}}function _1(t,r){const i=r?.maxLen??D1,l=M1(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=z1(r?.toolName,l,i);if(o)return o;for(const g of I1){const p=l[g];if(typeof p=="string"&&p.trim())return Wn(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 L1(t){const r=(t??"").toLowerCase();return r==="bash"||r==="shell"?{argsLabel:"命令",resultLabel:"输出"}:r==="mcp"||r.startsWith("mcp_")?{argsLabel:"参数",resultLabel:"结果"}:{argsLabel:"入参",resultLabel:"结果"}}function iy(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 iy(JSON.parse(l))}catch{return t}return t}if(typeof t=="number"||typeof t=="boolean")return String(t);const r=Is(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=Is(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 B1(t){if(t==null)return"";try{return typeof t=="string"?t:JSON.stringify(t,null,2)}catch{return String(t)}}function H1(t,r){if(t===void 0)return{text:"",truncated:!1};const i=r?.maxLen??O1;return t.length<=i?{text:t,truncated:!1}:{text:`${t.slice(0,i)}…`,truncated:!0}}function U1(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 Kt(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function Vi(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 ay(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 q1(t,r){return t?t.taskId===r.taskId&&t.updatedAt===r.updatedAt&&t.lastEventId===r.lastEventId&&t.operations.length===r.operations.length:!1}const ly={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 G1(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{...ly};default:return t}}function sy(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 $1(t,r,i,l){const o=i&&i.sessionId===l?sy(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 F1(t=ly){let r=t;const i=new Set;return{getState:()=>r,dispatch:l=>{r=G1(r,l);for(const o of i)o();return r},subscribe:l=>(i.add(l),()=>i.delete(l))}}const ft=F1();let Er;function oy(t){return`/api/operator/v1/chat/sessions/${encodeURIComponent(t)}`}function V1(t){const r=Er;if(Er=t,!(r&&r.sessionId===t.sessionId&&r.origin===t.origin)){if((!r||r.sessionId!==t.sessionId)&&ft.dispatch({type:"mutation-reset"}),!t.sessionId){ft.dispatch({type:"reset"});return}ft.dispatch({type:"load-start",sessionId:t.sessionId}),uy(t.sessionId,t.origin)}}async function uy(t,r){try{const i=await fetch(`${r}${oy(t)}/runtime-snapshot`,{credentials:"include"}),l=await i.json().catch(()=>({}));if(Er?.sessionId!==t)return;if(!i.ok){ft.dispatch({type:"load-failure",sessionId:t,error:{...od(l),status:i.status}});return}if(!l.snapshot){ft.dispatch({type:"load-failure",sessionId:t,error:{status:i.status,message:"runtime snapshot missing in response"}});return}ft.dispatch({type:"load-success",sessionId:t,snapshot:l.snapshot})}catch(i){if(Er?.sessionId!==t)return;ft.dispatch({type:"load-failure",sessionId:t,error:{message:i instanceof Error?i.message:String(i)}})}}async function Ki(){const t=Er;if(!t?.sessionId||ft.getState().reloading)return!1;const r=t.sessionId;ft.dispatch({type:"reload-start"});try{const i=await fetch(`${t.origin}${oy(r)}/reload`,{method:"POST",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Kt()},body:"{}"}),l=await i.json().catch(()=>({}));return Er?.sessionId!==r?!1:i.ok?l.snapshot?(ft.dispatch({type:"reload-success",snapshot:l.snapshot}),!0):(ft.dispatch({type:"reload-failure",error:{status:i.status,message:"reload succeeded but snapshot missing"}}),!1):(ft.dispatch({type:"reload-failure",error:{...od(l),status:i.status}}),!1)}catch(i){return Er?.sessionId!==r||ft.dispatch({type:"reload-failure",error:{message:i instanceof Error?i.message:String(i)}}),!1}}async function Xi(){const t=Er;if(!t?.sessionId)return!1;const r=t.sessionId;return ft.dispatch({type:"load-start",sessionId:r}),uy(r,t.origin),!0}function Y1(t,r,i){return i?(ft.dispatch({type:"mutation-adopt",token:t,sessionId:r,snapshot:i}),ft.getState().snapshot===i):!1}function P1(t,r,i){return i.sessionRef.current?.sessionId!==r||ft.getState().mutationToken!==t?!1:(ft.dispatch({type:"mutation-settle",token:t}),!0)}function Zi(){return k.useSyncExternalStore(ft.subscribe,ft.getState)}function cy(t){ft.dispatch(t)}function K1(){return ft.getState()}function X1(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/skills/${encodeURIComponent(i)}/auto-invocation`}async function Q1(t){const r=t.fetchImpl??fetch;try{const i=await r(X1(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 Z1(t){return t.autoInvocationEnabled?{badge:"允许自动使用",help:"模型可自动选择该技能,也可通过 /skill:<name> 手动调用。"}:{badge:"已隐藏自动使用",help:`已从模型自动技能列表隐藏,仍可通过 /skill:${t.name} 手动调用。`}}const $c=()=>window.__CONSOLE_CONFIRMATION_TOKEN__??"";function J1({origin:t}){const[r,i]=k.useState(null),[l,o]=k.useState(null),[d,u]=k.useState(null),[h,g]=k.useState(!1),p=Zi(),v=p.snapshot,y=p.reloading,S=p.reloadError,x=v?.diagnostics??[],C=async A=>{i(A),u(null);{o(null);try{const I=await fetch(`${t}/api/operator/v1/pi/models-config`,{credentials:"include"}),G=await I.json();if(!I.ok)throw new Error(G.error?.message??"读取失败");o(G.data)}catch(I){u(I instanceof Error?I.message:String(I))}}},D=async A=>{g(!0),u(null);try{const I=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(A)}),G=await I.json();if(!I.ok)throw new Error(G.error?.message??"模型配置保存失败");o(G.data)}catch(I){u(I instanceof Error?I.message:String(I))}finally{g(!1)}},B=async(A,I)=>{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:A,modelId:I})}),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)}},E=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:()=>{C("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:A=>{A.target===A.currentTarget&&i(null)},children:c.jsxs("section",{className:"oc-resource-panel",role:"dialog","aria-modal":"true","aria-label":E,children:[c.jsxs("header",{className:"oc-resource-panel-head",children:[c.jsxs("div",{className:"oc-resource-panel-head-copy",children:[c.jsx("strong",{children:E}),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((A,I)=>c.jsx("div",{className:`oc-resource-diagnostic${A.type==="error"?" is-error":""}`,role:A.type==="error"?"alert":void 0,children:c.jsxs("span",{children:[A.type,A.code?` ${A.code}`:"",":",A.message,A.path?`(${A.path})`:"",A.retryable?" · 可重试":""]})},I)),c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Xi()},children:"重试"})]}),d&&c.jsx("p",{className:"oc-resource-error",children:d}),r==="models"&&c.jsx(W1,{busy:h,data:l,onMutate:D,onTest:B}),r==="skills"&&c.jsx(eS,{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(rS,{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:()=>{Ki()},children:"重试"}),p.status==="error"&&c.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{Xi()},children:"重新读取快照"}),c.jsx("button",{type:"button",className:"btn btn-ghost",disabled:y,onClick:()=>{Ki()},children:"重新加载会话"})]})]})]})})]})}function W1({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(C=>c.jsxs("div",{className:"oc-model-row",children:[c.jsx("span",{children:C.name?`${C.name} (${C.id})`:C.id}),c.jsxs("div",{className:"oc-model-row-actions",children:[c.jsx("button",{type:"button",disabled:t,onClick:()=>{l(x.name,C.id).then(D=>y(`${x.name}/${C.id}: ${D?"可用":"不可用"}`))},children:"测试"}),c.jsx("button",{type:"button",disabled:t,onClick:()=>{window.confirm(`确认删除模型 ${x.name}/${C.id}?`)&&i({expectedRevision:r.revision,action:"remove-model",provider:x.name,model:{id:C.id}})},children:"删除"})]})]},C.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 dy(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:()=>{Xi()},children:"重试"})]}):t.hasSession?c.jsx("p",{className:"oc-resource-empty",children:t.emptyText}):c.jsx("p",{className:"oc-resource-empty",children:"当前没有活动会话;打开会话后显示真实资源清单(真实空态)。"})}function eS(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(dy,{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 C=x.scope||"unknown",D=v.get(C)??[];D.push(x),v.set(C,D)}const y=x=>Object.prototype.hasOwnProperty.call(g,x.resourceId)?g[x.resourceId]:x.autoInvocationEnabled,S=async(x,C)=>{if(!t.sessionId||!x.resourceId||i)return;y(x),d(null),h(null),l(x.resourceId),p(B=>({...B,[x.resourceId]:C}));const D=await Q1({origin:t.origin,sessionId:t.sessionId,resourceId:x.resourceId,autoInvocationEnabled:C,confirmationToken:$c()});if(l(null),!D.ok){p(B=>{const E={...B};return delete E[x.resourceId],E}),d(`${D.error.code?`${D.error.code}:`:""}${D.error.message}`);return}if(D.reloadApplied&&D.snapshot){cy({type:"load-success",sessionId:t.sessionId,snapshot:D.snapshot}),p(B=>{const E={...B};return delete E[x.resourceId],E}),h(null);return}!D.reloadApplied&&D.partialBusy&&h(`设置已保存;当前会话正忙(${D.partialBusy.code}),请在本轮结束后点击「重新加载会话」。${D.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,C])=>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:[C.length," 项"]})]}),c.jsx("ul",{className:"oc-resource-list",children:C.map(D=>{const B=y(D),E=Z1({name:D.name,autoInvocationEnabled:B}),A=i===D.resourceId;return c.jsxs("li",{className:`oc-resource-item${B?"":" is-auto-off"}`,children:[c.jsxs("div",{className:"oc-resource-item-head",children:[c.jsx("strong",{children:D.name}),c.jsx("span",{children:E.badge})]}),c.jsxs("label",{className:"oc-skill-auto-toggle",children:[c.jsx("input",{type:"checkbox",checked:B,disabled:A||!D.resourceId,"aria-label":`允许自动使用 ${D.name}`,onChange:I=>{S(D,I.target.checked)}}),c.jsx("span",{children:A?"保存中…":"允许自动使用"})]}),c.jsx("p",{className:"oc-skill-auto-help",children:E.help}),D.description?c.jsx("p",{children:D.description}):null,c.jsx("code",{children:D.path}),D.source?c.jsxs("span",{className:"oc-resource-panel-meta",children:["source: ",D.source]}):null,Array.isArray(D.diagnostics)&&D.diagnostics.length>0?c.jsx("span",{className:"oc-resource-diagnostic",children:D.diagnostics.join(";")}):null]},`${x}:${D.resourceId||D.path}`)})})]},x))]})}const tS={extension:"Extensions",skill:"Skills",prompt:"Prompts",theme:"Themes"};function nS(t){return Array.isArray(t.diagnostics)&&t.diagnostics.length>0?"error":t.enabled?t.version?"installed":"loaded":"disabled"}function rS(t){const r=t.packages??[];return t.status!=="ready"||!t.hasSession?c.jsx(dy,{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=nS(i),o=new Map;for(const d of i.resolved??[]){const u=tS[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 Ds=10,fy="loop-console.operator-chat.sidebar-split.v1",ti=45,Vs=28,Ys=70,$p=5,Fp=10;function Pi(t){return Number.isFinite(t)?Math.min(Ys,Math.max(Vs,Math.round(t))):ti}function iS(t){if(t==null||t==="")return null;const r=Number(t);if(!Number.isFinite(r))return null;const i=Math.round(r);return i<Vs||i>Ys?null:i}function aS(t=hy()){if(!t)return ti;try{return iS(t.getItem(fy))??ti}catch{return ti}}function Vp(t,r=hy()){const i=Pi(t);if(!r)return i;try{r.setItem(fy,String(i))}catch{}return i}function lS(t,r,i=!1){const l=Pi(t);switch(r){case"ArrowUp":return Pi(l-(i?Fp:$p));case"ArrowDown":return Pi(l+(i?Fp:$p));case"Home":return Vs;case"End":return Ys;case"Enter":return ti;default:return null}}function Yp(t,r,i){if(!Number.isFinite(i)||i<=0)return ti;const l=(t-r)/i;return Pi(l*100)}function hy(){try{return typeof globalThis>"u"?null:globalThis.localStorage??null}catch{return null}}const Pp='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(Pp)??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(Pp)).filter(C=>!C.hasAttribute("disabled")&&C.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 sS(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=C=>{if(!(C.scrollWidth>C.clientWidth+1)){v();return}const B=C.getBoundingClientRect();h({x:Math.min(B.right+8,window.innerWidth-16),y:B.top+B.height/2})},S=C=>{C&&(p(),g.current=window.setTimeout(()=>y(C),350))};k.useEffect(()=>{const C=()=>v(),D=B=>{B.key==="Escape"&&v()};return window.addEventListener("scroll",C,!0),window.addEventListener("keydown",D),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("keydown",D),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:C=>{const D=C.currentTarget.querySelector("strong");D instanceof HTMLElement&&S(D)},onMouseLeave:v,onFocus:C=>{const D=C.currentTarget.querySelector("strong");D instanceof HTMLElement&&S(D)},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:C=>{C.stopPropagation();const D=window.prompt("会话名称",r.title??"");D!==null&&t.onRename(D)},children:c.jsx(N1,{size:16,"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"oc-session-menu",title:l==="active"?"归档会话":"恢复会话","aria-label":l==="active"?"归档会话":"恢复会话",onClick:C=>{C.stopPropagation(),t.onSetState(l==="active"?"archived":"active")},children:l==="active"?c.jsx(R1,{size:16,"aria-hidden":"true"}):c.jsx(A1,{size:16,"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"oc-session-menu oc-session-delete",title:"删除会话","aria-label":"删除会话",onClick:C=>{C.stopPropagation(),t.onDelete()},children:c.jsx(E1,{size:16,"aria-hidden":"true"})})]}),u?T1.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 oS(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 uS({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 cS({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 dS(){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 fS(){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 hS(){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 mS(){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 pS(t){const r=t.sessions.slice(0,Ds),[i,l]=k.useState(()=>aS()),[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((A,I)=>{const G=Pi(A);l(G),I&&Vp(G)},[]),S=k.useCallback(A=>{const I=lS(i,A.key,A.shiftKey);I!=null&&(A.preventDefault(),y(I,!0))},[y,i]),x=k.useCallback(A=>{A.preventDefault(),A.currentTarget.setPointerCapture(A.pointerId),d(!0);const G=u.current;if(!G)return;const K=G.getBoundingClientRect();y(Yp(A.clientY,K.top,K.height),!1)},[y]),C=k.useCallback(A=>{if(!A.currentTarget.hasPointerCapture(A.pointerId))return;const I=u.current;if(!I)return;const G=I.getBoundingClientRect();y(Yp(A.clientY,G.top,G.height),!1)},[y]),D=k.useCallback(A=>{A.currentTarget.hasPointerCapture(A.pointerId)&&A.currentTarget.releasePointerCapture(A.pointerId),d(!1),Vp(i)},[i]),B=k.useCallback(()=>{y(ti,!0)},[y]),E=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(A=>{const I=r.filter(G=>G.state===A);return I.length?c.jsxs("div",{className:"oc-session-group",children:[c.jsx("small",{children:A==="active"?"进行中":"已归档"}),I.map(G=>c.jsx(sS,{item:G,active:t.activeSessionId===G.sessionId,state:A,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))]},A):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":Vs,"aria-valuemax":Ys,"aria-valuenow":i,"aria-label":"调整会话与仓库高度比例",tabIndex:0,onKeyDown:S,onPointerDown:x,onPointerMove:C,onPointerUp:D,onPointerCancel:D,onDoubleClick:B}),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(my,{entries:t.tree[""]??[],tree:t.tree,expanded:t.expanded,depth:0,onToggle:t.onToggleDir,onInsert:t.onInsert,onPreview:t.onPreview})})]})]}),c.jsx(J1,{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(fS,{})}),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(hS,{})}),c.jsx("button",{type:"button",className:"oc-sidebar-rail-btn","aria-label":"治理入口",title:"治理",onClick:()=>v?t.onCloseDrawer():t.onOpenDrawer(),children:c.jsx(mS,{})})]}):null,t.layoutMode==="comfortable"?c.jsx("aside",{className:`oc-sidebar${g?"":" is-collapsed"}`,"aria-label":"会话与仓库",children:g?E: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:E})]}):null]})}function my(t){const r=k.useMemo(()=>oS(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(uS,{open:o}),c.jsx(cS,{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(my,{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(gS,{entry:i,depth:t.depth,onInsert:t.onInsert,onPreview:t.onPreview})},i.path)})}):c.jsx("p",{className:"oc-tree-empty",children:"此目录为空或没有可安全浏览的文件。"})}function gS(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(dS,{}),c.jsx("span",{className:"oc-tree-label",children:t.entry.name})]})}function yS(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"}],py=[{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"}],Wr={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 vS(t){const r=t.trim().split(/\s+/,1)[0]?.toLowerCase();if(!r?.startsWith("/"))return;const i=[...cd,...py].find(l=>l.command===r);return i?{command:i.command,action:i.action}:{command:r,action:"unknown"}}function bS(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}Wr[l.source]<Wr[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 py)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=Wr[l.source]-Wr[o.source];return d!==0?d:l.command.localeCompare(o.command)})}function xS(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+Wr[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=Wr[u.source]-Wr[h.source];return g!==0?g:u.command.localeCompare(h.command)})}const SS={operator:"Operator",web:"Pi Web",extension:"Extensions",prompt:"Prompts",skill:"Skills"},Xp={comfortableMin:620,compactMin:480};function kS(t){return!Number.isFinite(t)||t<0?"extra-compact":t>=Xp.comfortableMin?"comfortable":t>=Xp.compactMin?"compact":"extra-compact"}function wS(t){return`is-landing-${t}`}const CS=[{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 gy(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 ${wS(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:CS.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 jS(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":Kt()},body:JSON.stringify(S)}),C=await x.json();if(!x.ok)throw new Error(C.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 wn="loop-console.operator-chat.active-session.v1",RS="loop-console.operator-chat.default-landing.v1";function Os(t){const r=t?.trim().toLowerCase();if(r==="chat")return"chat";if(r==="tasks")return"tasks"}function yy(t){const r=t?.trim().toLowerCase();if(r==="chat"||r==="tasks"||r==="recovery"||r==="night"||r==="models"||r==="settings")return r}function vy(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 by(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=yy(u);return h?{workspace:h,...vy(new URLSearchParams(o))}:null}function ES(t){const r=new URLSearchParams(t.search),i=t.hash.startsWith("#")?t.hash.slice(1):t.hash,l=new URLSearchParams(i),o=yy(r.get("workspace")??r.get("landing")??l.get("workspace"));return o?{workspace:o,...vy(r)}:null}function NS(t){if(!t)return;const r=by(t.hash);if(r)return r.workspace;const i=new URLSearchParams(t.search),l=Os(i.get("landing")??i.get("workspace"));if(l)return l;const o=t.hash.startsWith("#")?t.hash.slice(1):t.hash;return Os(new URLSearchParams(o).get("workspace"))}function xy(t){return NS(t.location)??Os(t.storage?.getItem(RS))??Os(t.env)??"tasks"}function Sy(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 AS(t,r={}){return`#${Sy(t,r)}`}function IS(t){return by(t.hash)??ES(t)}function DS(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(AS(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 OS(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 MS(t,r){const i={};return(t[t.length-1]===""?[...t,""]:t).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const zS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_S=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LS={};function Qp(t,r){return(LS.jsx?_S:zS).test(t)}const BS=/[ \t\n\f\r]/g;function HS(t){return typeof t=="object"?t.type==="text"?Zp(t.value):!1:Zp(t)}function Zp(t){return t.replace(BS,"")===""}class al{constructor(r,i,l){this.normal=i,this.property=r,l&&(this.space=l)}}al.prototype.normal={};al.prototype.property={};al.prototype.space=void 0;function ky(t,r){const i={},l={};for(const o of t)Object.assign(i,o.property),Object.assign(l,o.normal);return new al(i,l,r)}function Fc(t){return t.toLowerCase()}class Xt{constructor(r,i){this.attribute=i,this.property=r}}Xt.prototype.attribute="";Xt.prototype.booleanish=!1;Xt.prototype.boolean=!1;Xt.prototype.commaOrSpaceSeparated=!1;Xt.prototype.commaSeparated=!1;Xt.prototype.defined=!1;Xt.prototype.mustUseProperty=!1;Xt.prototype.number=!1;Xt.prototype.overloadedBoolean=!1;Xt.prototype.property="";Xt.prototype.spaceSeparated=!1;Xt.prototype.space=void 0;let US=0;const Re=ii(),St=ii(),Vc=ii(),me=ii(),rt=ii(),ni=ii(),an=ii();function ii(){return 2**++US}const Yc=Object.freeze(Object.defineProperty({__proto__:null,boolean:Re,booleanish:St,commaOrSpaceSeparated:an,commaSeparated:ni,number:me,overloadedBoolean:Vc,spaceSeparated:rt},Symbol.toStringTag,{value:"Module"})),kc=Object.keys(Yc);class dd extends Xt{constructor(r,i,l,o){let d=-1;if(super(r,i),Jp(this,"space",o),typeof l=="number")for(;++d<kc.length;){const u=kc[d];Jp(this,kc[d],(l&Yc[u])===Yc[u])}}}dd.prototype.defined=!0;function Jp(t,r,i){i&&(t[r]=i)}function Ji(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 al(r,i,t.space)}const wy=Ji({properties:{ariaActiveDescendant:null,ariaAtomic:St,ariaAutoComplete:null,ariaBusy:St,ariaChecked:St,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:rt,ariaCurrent:null,ariaDescribedBy:rt,ariaDetails:null,ariaDisabled:St,ariaDropEffect:rt,ariaErrorMessage:null,ariaExpanded:St,ariaFlowTo:rt,ariaGrabbed:St,ariaHasPopup:null,ariaHidden:St,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:rt,ariaLevel:me,ariaLive:null,ariaModal:St,ariaMultiLine:St,ariaMultiSelectable:St,ariaOrientation:null,ariaOwns:rt,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:St,ariaReadOnly:St,ariaRelevant:null,ariaRequired:St,ariaRoleDescription:rt,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:St,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(t,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Cy(t,r){return r in t?t[r]:r}function jy(t,r){return Cy(t,r.toLowerCase())}const qS=Ji({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ni,acceptCharset:rt,accessKey:rt,action:null,allow:null,allowFullScreen:Re,allowPaymentRequest:Re,allowUserMedia:Re,alpha:Re,alt:null,as:null,async:Re,autoCapitalize:null,autoComplete:rt,autoFocus:Re,autoPlay:Re,blocking:rt,capture:null,charSet:null,checked:Re,cite:null,className:rt,closedBy:null,colorSpace:null,cols:me,colSpan:me,command:null,commandFor:null,content:null,contentEditable:St,controls:Re,controlsList:rt,coords:me|ni,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Re,defer:Re,dir:null,dirName:null,disabled:Re,download:Vc,draggable:St,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Re,formTarget:null,headers:rt,height:me,hidden:Vc,high:me,href:null,hrefLang:null,htmlFor:rt,httpEquiv:rt,id:null,imageSizes:null,imageSrcSet:null,inert:Re,inputMode:null,integrity:null,is:null,isMap:Re,itemId:null,itemProp:rt,itemRef:rt,itemScope:Re,itemType:rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Re,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Re,muted:Re,name:null,nonce:null,noModule:Re,noValidate:Re,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:Re,optimum:me,pattern:null,ping:rt,placeholder:null,playsInline:Re,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Re,referrerPolicy:null,rel:rt,required:Re,reversed:Re,rows:me,rowSpan:me,sandbox:rt,scope:null,scoped:Re,seamless:Re,selected:Re,shadowRootClonable:Re,shadowRootCustomElementRegistry:Re,shadowRootDelegatesFocus:Re,shadowRootMode:null,shadowRootSerializable:Re,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:St,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Re,useMap:null,value:St,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:rt,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Re,declare:Re,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Re,noHref:Re,noShade:Re,noWrap:Re,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:St,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Re,disablePictureInPicture:Re,disableRemotePlayback:Re,exportParts:ni,part:rt,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:jy}),GS=Ji({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:an,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Re,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,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:ni,g2:ni,glyphName:ni,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:an,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,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:me,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:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:an,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:an,rev:an,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:an,requiredFeatures:an,requiredFonts:an,requiredFormats:an,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:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:an,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:an,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:an,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Cy}),Ty=Ji({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()}}),Ry=Ji({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:jy}),Ey=Ji({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,r){return"xml:"+r.slice(3).toLowerCase()}}),$S={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"},FS=/[A-Z]/g,Wp=/-[a-z]/g,VS=/^data[-\w.:]+$/i;function YS(t,r){const i=Fc(r);let l=r,o=Xt;if(i in t.normal)return t.property[t.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&VS.test(r)){if(r.charAt(4)==="-"){const d=r.slice(5).replace(Wp,KS);l="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=r.slice(4);if(!Wp.test(d)){let u=d.replace(FS,PS);u.charAt(0)!=="-"&&(u="-"+u),r="data"+u}}o=dd}return new o(l,r)}function PS(t){return"-"+t.toLowerCase()}function KS(t){return t.charAt(1).toUpperCase()}const XS=ky([wy,qS,Ty,Ry,Ey],"html"),fd=ky([wy,GS,Ty,Ry,Ey],"svg");function QS(t){return t.join(" ").trim()}var $i={},wc,eg;function ZS(){if(eg)return wc;eg=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 C(B,E){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];E=E||{};var A=1,I=1;function G(X){var L=X.match(r);L&&(A+=L.length);var O=X.lastIndexOf(g);I=~O?X.length-O:I+X.length}function K(){var X={line:A,column:I};return function(L){return L.position=new N(X),ce(),L}}function N(X){this.start=X,this.end={line:A,column:I},this.source=E.source}N.prototype.content=B;function $(X){var L=new Error(E.source+":"+A+":"+I+": "+X);if(L.reason=X,L.filename=E.source,L.line=A,L.column=I,L.source=B,!E.silent)throw L}function re(X){var L=X.exec(B);if(L){var O=L[0];return G(O),B=B.slice(O.length),L}}function ce(){re(i)}function M(X){var L;for(X=X||[];L=V();)L!==!1&&X.push(L);return X}function V(){var X=K();if(!(p!=B.charAt(0)||v!=B.charAt(1))){for(var L=2;y!=B.charAt(L)&&(v!=B.charAt(L)||p!=B.charAt(L+1));)++L;if(L+=2,y===B.charAt(L-1))return $("End of comment missing");var O=B.slice(2,L-2);return I+=2,G(O),B=B.slice(L),I+=2,X({type:S,comment:O})}}function Y(){var X=K(),L=re(l);if(L){if(V(),!re(o))return $("property missing ':'");var O=re(d),H=X({type:x,property:D(L[0].replace(t,y)),value:O?D(O[0].replace(t,y)):y});return re(u),H}}function le(){var X=[];M(X);for(var L;L=Y();)L!==!1&&(X.push(L),M(X));return X}return ce(),le()}function D(B){return B?B.replace(h,y):y}return wc=C,wc}var tg;function JS(){if(tg)return $i;tg=1;var t=$i&&$i.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty($i,"__esModule",{value:!0}),$i.default=i;const r=t(ZS());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 $i}var Ka={},ng;function WS(){if(ng)return Ka;ng=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.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 Ka.camelCase=g,Ka}var Xa,rg;function e0(){if(rg)return Xa;rg=1;var t=Xa&&Xa.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=t(JS()),i=WS();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,Xa=l,Xa}var t0=e0();const n0=ld(t0),Ny=Ay("end"),hd=Ay("start");function Ay(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 r0(t){const r=hd(t),i=Ny(t);if(r&&i)return{start:r,end:i}}function el(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ig(t.position):"start"in t||"end"in t?ig(t):"line"in t||"column"in t?Pc(t):""}function Pc(t){return ag(t&&t.line)+":"+ag(t&&t.column)}function ig(t){return Pc(t&&t.start)+"-"+Pc(t&&t.end)}function ag(t){return t&&typeof t=="number"?t:1}class _t 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=el(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}}_t.prototype.file="";_t.prototype.name="";_t.prototype.reason="";_t.prototype.message="";_t.prototype.stack="";_t.prototype.column=void 0;_t.prototype.line=void 0;_t.prototype.ancestors=void 0;_t.prototype.cause=void 0;_t.prototype.fatal=void 0;_t.prototype.place=void 0;_t.prototype.ruleId=void 0;_t.prototype.source=void 0;const md={}.hasOwnProperty,i0=new Map,a0=/[A-Z]/g,l0=new Set(["table","tbody","thead","tfoot","tr"]),s0=new Set(["td","th"]),Iy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function o0(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=g0(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=p0(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:XS,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},d=Dy(o,t,void 0);return d&&typeof d!="string"?d:o.create(t,o.Fragment,{children:d||void 0},void 0)}function Dy(t,r,i){if(r.type==="element")return u0(t,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return c0(t,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return f0(t,r,i);if(r.type==="mdxjsEsm")return d0(t,r);if(r.type==="root")return h0(t,r,i);if(r.type==="text")return m0(t,r)}function u0(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=My(t,r.tagName,!1),u=y0(t,r);let h=gd(t,r);return l0.has(r.tagName)&&(h=h.filter(function(g){return typeof g=="string"?!HS(g):!0})),Oy(t,u,d,r),pd(u,h),t.ancestors.pop(),t.schema=l,t.create(r,d,u,i)}function c0(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)}rl(t,r.position)}function d0(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);rl(t,r.position)}function f0(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:My(t,r.name,!0),u=v0(t,r),h=gd(t,r);return Oy(t,u,d,r),pd(u,h),t.ancestors.pop(),t.schema=l,t.create(r,d,u,i)}function h0(t,r,i){const l={};return pd(l,gd(t,r)),t.create(r,t.Fragment,l,i)}function m0(t,r){return r.value}function Oy(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 p0(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 g0(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 y0(t,r){const i={};let l,o;for(o in r.properties)if(o!=="children"&&md.call(r.properties,o)){const d=b0(t,o,r.properties[o]);if(d){const[u,h]=d;t.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&s0.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 v0(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 rl(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 rl(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:i0;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=Dy(t,d,u);h!==void 0&&i.push(h)}return i}function b0(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?MS(i):QS(i)),l.property==="style"){let o=typeof i=="object"?i:x0(t,String(i));return t.stylePropertyNameCase==="css"&&(o=S0(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&l.space?$S[l.property]||l.property:l.attribute,i]}}function x0(t,r){try{return n0(r,{reactCompat:!0})}catch(i){if(t.ignoreInvalidStyle)return{};const l=i,o=new _t("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=Iy+"#cannot-parse-style-attribute",o}}function My(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=Qp(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=Qp(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);rl(t)}function rl(t,r){const i=new _t("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=Iy+"#cannot-handle-mdx-estrees-without-createevaluater",i}function S0(t){const r={};let i;for(i in t)md.call(t,i)&&(r[k0(i)]=t[i]);return r}function k0(t){let r=t.replace(a0,w0);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function w0(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"]},C0={};function yd(t,r){const i=C0,l=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return zy(t,l,o)}function zy(t,r,i){if(j0(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 lg(t.children,r,i)}return Array.isArray(t)?lg(t,r,i):""}function lg(t,r,i){const l=[];let o=-1;for(;++o<t.length;)l[o]=zy(t[o],r,i);return l.join("")}function j0(t){return!!(t&&typeof t=="object")}const sg=document.createElement("i");function vd(t){const r="&"+t+";";sg.innerHTML=r;const i=sg.textContent;return i.charCodeAt(i.length-1)===59&&t!=="semi"||i===r?!1:i}function ln(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?(ln(t,t.length,0,r),t):r}const og={}.hasOwnProperty;function _y(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=(og.call(t,i)?t[i]:void 0)||(t[i]={}),d=r[i];let u;if(d)for(u in d){og.call(o,u)||(o[u]=[]);const h=d[u];R0(o[u],Array.isArray(h)?h:h?[h]:[])}}}function R0(t,r){let i=-1;const l=[];for(;++i<r.length;)(r[i].add==="after"?t:l).push(r[i]);ln(t,0,0,l)}function Ly(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 Cn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Bt=Ar(/[A-Za-z]/),zt=Ar(/[\dA-Za-z]/),E0=Ar(/[#-'*+\--9=?A-Z^-~]/);function Ms(t){return t!==null&&(t<32||t===127)}const Kc=Ar(/\d/),N0=Ar(/[\dA-Fa-f]/),A0=Ar(/[!-/:-@[-`{-~]/);function ke(t){return t!==null&&t<-2}function it(t){return t!==null&&(t<0||t===32)}function _e(t){return t===-2||t===-1||t===32}const Ps=Ar(new RegExp("\\p{P}|\\p{S}","u")),ri=Ar(/\s/);function Ar(t){return r;function r(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function Wi(t){const r=[];let i=-1,l=0,o=0;for(;++i<t.length;){const d=t.charCodeAt(i);let u="";if(d===37&&zt(t.charCodeAt(i+1))&&zt(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 Ge(t,r,i,l){const o=l?l-1:Number.POSITIVE_INFINITY;let d=0;return u;function u(g){return _e(g)?(t.enter(i),h(g)):r(g)}function h(g){return _e(g)&&d++<o?(t.consume(g),h):(t.exit(i),r(g))}}const I0={tokenize:D0};function D0(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"),Ge(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 O0={tokenize:M0},ug={tokenize:z0};function M0(t){const r=this,i=[];let l=0,o,d,u;return h;function h(I){if(l<i.length){const G=i[l];return r.containerState=G[1],t.attempt(G[0].continuation,g,p)(I)}return p(I)}function g(I){if(l++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&A();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}E(l);let $=G;for(;$<r.events.length;)r.events[$][1].end={...N},$++;return ln(r.events,K+1,0,r.events.slice(G)),r.events.length=$,p(I)}return h(I)}function p(I){if(l===i.length){if(!o)return S(I);if(o.currentConstruct&&o.currentConstruct.concrete)return C(I);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},t.check(ug,v,y)(I)}function v(I){return o&&A(),E(l),S(I)}function y(I){return r.parser.lazy[r.now().line]=l!==i.length,u=r.now().offset,C(I)}function S(I){return r.containerState={},t.attempt(ug,x,C)(I)}function x(I){return l++,i.push([r.currentConstruct,r.containerState]),S(I)}function C(I){if(I===null){o&&A(),E(0),t.consume(I);return}return o=o||r.parser.flow(r.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:d}),D(I)}function D(I){if(I===null){B(t.exit("chunkFlow"),!0),E(0),t.consume(I);return}return ke(I)?(t.consume(I),B(t.exit("chunkFlow")),l=0,r.interrupt=void 0,h):(t.consume(I),D)}function B(I,G){const K=r.sliceStream(I);if(G&&K.push(null),I.previous=d,d&&(d.next=I),d=I,o.defineSkip(I.start),o.write(K),r.parser.lazy[I.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 re=$,ce,M;for(;re--;)if(r.events[re][0]==="exit"&&r.events[re][1].type==="chunkFlow"){if(ce){M=r.events[re][1].end;break}ce=!0}for(E(l),N=$;N<r.events.length;)r.events[N][1].end={...M},N++;ln(r.events,re+1,0,r.events.slice($)),r.events.length=N}}function E(I){let G=i.length;for(;G-- >I;){const K=i[G];r.containerState=K[1],K[0].exit.call(r,t)}i.length=I}function A(){o.write([null]),d=void 0,o=void 0,r.containerState._closeFlow=void 0}}function z0(t,r,i){return Ge(t,t.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qi(t){if(t===null||it(t)||ri(t))return 1;if(Ps(t))return 2}function Ks(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:_0,tokenize:L0};function _0(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};cg(y,-g),cg(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,Ks(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,ln(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 L0(t,r){const i=this.parser.constructs.attentionMarkers.null,l=this.previous,o=Qi(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=Qi(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 cg(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}const B0={name:"autolink",tokenize:H0};function H0(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 Bt(x)?(t.consume(x),u):x===64?i(x):p(x)}function u(x){return x===43||x===45||x===46||zt(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||zt(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||Ms(x)?i(x):(t.consume(x),g)}function p(x){return x===64?(t.consume(x),v):E0(x)?(t.consume(x),p):i(x)}function v(x){return zt(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||zt(x))&&l++<63){const C=x===45?S:y;return t.consume(x),C}return i(x)}}const ll={partial:!0,tokenize:U0};function U0(t,r,i){return l;function l(d){return _e(d)?Ge(t,o,"linePrefix")(d):o(d)}function o(d){return d===null||ke(d)?r(d):i(d)}}const By={continuation:{tokenize:G0},exit:$0,name:"blockQuote",tokenize:q0};function q0(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 _e(u)?(t.enter("blockQuotePrefixWhitespace"),t.consume(u),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),r):(t.exit("blockQuotePrefix"),r(u))}}function G0(t,r,i){const l=this;return o;function o(u){return _e(u)?Ge(t,d,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):d(u)}function d(u){return t.attempt(By,r,i)(u)}}function $0(t){t.exit("blockQuote")}const Hy={name:"characterEscape",tokenize:F0};function F0(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 A0(d)?(t.enter("characterEscapeValue"),t.consume(d),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):i(d)}}const Uy={name:"characterReference",tokenize:V0};function V0(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=zt,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=N0,v):(t.enter("characterReferenceValue"),d=7,u=Kc,v(y))}function v(y){if(y===59&&o){const S=t.exit("characterReferenceValue");return u===zt&&!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 dg={partial:!0,tokenize:P0},fg={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"),_e(N)?Ge(t,y,"whitespace")(N):y(N))}function y(N){return N===null||ke(N)?(t.exit("codeFencedFence"),l.interrupt?r(N):t.check(dg,D,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)):_e(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ge(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"}),C(N))}function C(N){return N===null||ke(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(N)):N===96&&N===h?i(N):(t.consume(N),C)}function D(N){return t.attempt(o,G,B)(N)}function B(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),E}function E(N){return d>0&&_e(N)?Ge(t,A,"linePrefix",d+1)(N):A(N)}function A(N){return N===null||ke(N)?t.check(dg,D,G)(N):(t.enter("codeFlowValue"),I(N))}function I(N){return N===null||ke(N)?(t.exit("codeFlowValue"),A(N)):(t.consume(N),I)}function G(N){return t.exit("codeFenced"),r(N)}function K(N,$,re){let ce=0;return M;function M(L){return N.enter("lineEnding"),N.consume(L),N.exit("lineEnding"),V}function V(L){return N.enter("codeFencedFence"),_e(L)?Ge(N,Y,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):Y(L)}function Y(L){return L===h?(N.enter("codeFencedFenceSequence"),le(L)):re(L)}function le(L){return L===h?(ce++,N.consume(L),le):ce>=u?(N.exit("codeFencedFenceSequence"),_e(L)?Ge(N,X,"whitespace")(L):X(L)):re(L)}function X(L){return L===null||ke(L)?(N.exit("codeFencedFence"),$(L)):re(L)}}}function P0(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:X0},K0={partial:!0,tokenize:Q0};function X0(t,r,i){const l=this;return o;function o(p){return t.enter("codeIndented"),Ge(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(K0,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 Q0(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):Ge(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 Z0={name:"codeText",previous:W0,resolve:J0,tokenize:ek};function J0(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 W0(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ek(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 tk{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&&Qa(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),Qa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Qa(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);Qa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Qa(this.left,i.reverse())}}}function Qa(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 qy(t){const r={};let i=-1,l,o,d,u,h,g,p;const v=new tk(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,nk(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 ln(t,0,Number.POSITIVE_INFINITY,v.slice(0)),!p}function nk(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,C=0,D=0;const B=[D];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&&(D=S+1,B.push(D),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(u.events=[],x?(x._tokenizer=void 0,x.previous=void 0):B.pop(),S=B.length;S--;){const E=h.slice(B[S],B[S+1]),A=d.pop();g.push([A,A+E.length-1]),t.splice(A,2,E)}for(g.reverse(),S=-1;++S<g.length;)p[C+g[S][0]]=C+g[S][1],C+=g[S][1]-g[S][0]-1;return p}const rk={resolve:ak,tokenize:lk},ik={partial:!0,tokenize:sk};function ak(t){return qy(t),t}function lk(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(ik,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 sk(t,r,i){const l=this;return o;function o(u){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),Ge(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 Gy(t,r,i,l,o,d,u,h,g){const p=g||Number.POSITIVE_INFINITY;let v=0;return y;function y(E){return E===60?(t.enter(l),t.enter(o),t.enter(d),t.consume(E),t.exit(d),S):E===null||E===32||E===41||Ms(E)?i(E):(t.enter(l),t.enter(u),t.enter(h),t.enter("chunkString",{contentType:"string"}),D(E))}function S(E){return E===62?(t.enter(d),t.consume(E),t.exit(d),t.exit(o),t.exit(l),r):(t.enter(h),t.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===62?(t.exit("chunkString"),t.exit(h),S(E)):E===null||E===60||ke(E)?i(E):(t.consume(E),E===92?C:x)}function C(E){return E===60||E===62||E===92?(t.consume(E),x):x(E)}function D(E){return!v&&(E===null||E===41||it(E))?(t.exit("chunkString"),t.exit(h),t.exit(u),t.exit(l),r(E)):v<p&&E===40?(t.consume(E),v++,D):E===41?(t.consume(E),v--,D):E===null||E===32||E===40||Ms(E)?i(E):(t.consume(E),E===92?B:D)}function B(E){return E===40||E===41||E===92?(t.consume(E),D):D(E)}}function $y(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=!_e(x)),x===92?S:y)}function S(x){return x===91||x===92||x===93?(t.consume(x),h++,y):y(x)}}function Fy(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"),Ge(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 tl(t,r){let i;return l;function l(o){return ke(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i=!0,l):_e(o)?Ge(t,l,i?"linePrefix":"lineSuffix")(o):r(o)}}const ok={name:"definition",tokenize:ck},uk={partial:!0,tokenize:dk};function ck(t,r,i){const l=this;let o;return d;function d(x){return t.enter("definition"),u(x)}function u(x){return $y.call(l,t,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function h(x){return o=Cn(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 it(x)?tl(t,p)(x):p(x)}function p(x){return Gy(t,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function v(x){return t.attempt(uk,y,y)(x)}function y(x){return _e(x)?Ge(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 dk(t,r,i){return l;function l(h){return it(h)?tl(t,o)(h):i(h)}function o(h){return Fy(t,d,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function d(h){return _e(h)?Ge(t,u,"whitespace")(h):u(h)}function u(h){return h===null||ke(h)?r(h):i(h)}}const fk={name:"hardBreakEscape",tokenize:hk};function hk(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 mk={name:"headingAtx",resolve:pk,tokenize:gk};function pk(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"},ln(t,l,i-l+1,[["enter",o,r],["enter",d,r],["exit",d,r],["exit",o,r]])),t}function gk(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||it(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)):_e(v)?Ge(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||it(v)?(t.exit("atxHeadingText"),h(v)):(t.consume(v),p)}}const yk=["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"],hg=["pre","script","style","textarea"],vk={concrete:!0,name:"htmlFlow",resolveTo:Sk,tokenize:kk},bk={partial:!0,tokenize:Ck},xk={partial:!0,tokenize:wk};function Sk(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 kk(t,r,i){const l=this;let o,d,u,h,g;return p;function p(w){return v(w)}function v(w){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(w),y}function y(w){return w===33?(t.consume(w),S):w===47?(t.consume(w),d=!0,D):w===63?(t.consume(w),o=3,l.interrupt?r:T):Bt(w)?(t.consume(w),u=String.fromCharCode(w),B):i(w)}function S(w){return w===45?(t.consume(w),o=2,x):w===91?(t.consume(w),o=5,h=0,C):Bt(w)?(t.consume(w),o=4,l.interrupt?r:T):i(w)}function x(w){return w===45?(t.consume(w),l.interrupt?r:T):i(w)}function C(w){const te="CDATA[";return w===te.charCodeAt(h++)?(t.consume(w),h===te.length?l.interrupt?r:Y:C):i(w)}function D(w){return Bt(w)?(t.consume(w),u=String.fromCharCode(w),B):i(w)}function B(w){if(w===null||w===47||w===62||it(w)){const te=w===47,fe=u.toLowerCase();return!te&&!d&&hg.includes(fe)?(o=1,l.interrupt?r(w):Y(w)):yk.includes(u.toLowerCase())?(o=6,te?(t.consume(w),E):l.interrupt?r(w):Y(w)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?i(w):d?A(w):I(w))}return w===45||zt(w)?(t.consume(w),u+=String.fromCharCode(w),B):i(w)}function E(w){return w===62?(t.consume(w),l.interrupt?r:Y):i(w)}function A(w){return _e(w)?(t.consume(w),A):M(w)}function I(w){return w===47?(t.consume(w),M):w===58||w===95||Bt(w)?(t.consume(w),G):_e(w)?(t.consume(w),I):M(w)}function G(w){return w===45||w===46||w===58||w===95||zt(w)?(t.consume(w),G):K(w)}function K(w){return w===61?(t.consume(w),N):_e(w)?(t.consume(w),K):I(w)}function N(w){return w===null||w===60||w===61||w===62||w===96?i(w):w===34||w===39?(t.consume(w),g=w,$):_e(w)?(t.consume(w),N):re(w)}function $(w){return w===g?(t.consume(w),g=null,ce):w===null||ke(w)?i(w):(t.consume(w),$)}function re(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||it(w)?K(w):(t.consume(w),re)}function ce(w){return w===47||w===62||_e(w)?I(w):i(w)}function M(w){return w===62?(t.consume(w),V):i(w)}function V(w){return w===null||ke(w)?Y(w):_e(w)?(t.consume(w),V):i(w)}function Y(w){return w===45&&o===2?(t.consume(w),O):w===60&&o===1?(t.consume(w),H):w===62&&o===4?(t.consume(w),R):w===63&&o===3?(t.consume(w),T):w===93&&o===5?(t.consume(w),Q):ke(w)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(bk,_,le)(w)):w===null||ke(w)?(t.exit("htmlFlowData"),le(w)):(t.consume(w),Y)}function le(w){return t.check(xk,X,_)(w)}function X(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),L}function L(w){return w===null||ke(w)?le(w):(t.enter("htmlFlowData"),Y(w))}function O(w){return w===45?(t.consume(w),T):Y(w)}function H(w){return w===47?(t.consume(w),u="",U):Y(w)}function U(w){if(w===62){const te=u.toLowerCase();return hg.includes(te)?(t.consume(w),R):Y(w)}return Bt(w)&&u.length<8?(t.consume(w),u+=String.fromCharCode(w),U):Y(w)}function Q(w){return w===93?(t.consume(w),T):Y(w)}function T(w){return w===62?(t.consume(w),R):w===45&&o===2?(t.consume(w),T):Y(w)}function R(w){return w===null||ke(w)?(t.exit("htmlFlowData"),_(w)):(t.consume(w),R)}function _(w){return t.exit("htmlFlow"),r(w)}}function wk(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 Ck(t,r,i){return l;function l(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(ll,r,i)}}const jk={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),I):Bt(T)?(t.consume(T),re):i(T)}function p(T){return T===45?(t.consume(T),v):T===91?(t.consume(T),d=0,C):Bt(T)?(t.consume(T),A):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?O(T):T===45?S(T):y(T)}function C(T){const R="CDATA[";return T===R.charCodeAt(d++)?(t.consume(T),d===R.length?D:C):i(T)}function D(T){return T===null?i(T):T===93?(t.consume(T),B):ke(T)?(u=D,H(T)):(t.consume(T),D)}function B(T){return T===93?(t.consume(T),E):D(T)}function E(T){return T===62?O(T):T===93?(t.consume(T),E):D(T)}function A(T){return T===null||T===62?O(T):ke(T)?(u=A,H(T)):(t.consume(T),A)}function I(T){return T===null?i(T):T===63?(t.consume(T),G):ke(T)?(u=I,H(T)):(t.consume(T),I)}function G(T){return T===62?O(T):I(T)}function K(T){return Bt(T)?(t.consume(T),N):i(T)}function N(T){return T===45||zt(T)?(t.consume(T),N):$(T)}function $(T){return ke(T)?(u=$,H(T)):_e(T)?(t.consume(T),$):O(T)}function re(T){return T===45||zt(T)?(t.consume(T),re):T===47||T===62||it(T)?ce(T):i(T)}function ce(T){return T===47?(t.consume(T),O):T===58||T===95||Bt(T)?(t.consume(T),M):ke(T)?(u=ce,H(T)):_e(T)?(t.consume(T),ce):O(T)}function M(T){return T===45||T===46||T===58||T===95||zt(T)?(t.consume(T),M):V(T)}function V(T){return T===61?(t.consume(T),Y):ke(T)?(u=V,H(T)):_e(T)?(t.consume(T),V):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,le):ke(T)?(u=Y,H(T)):_e(T)?(t.consume(T),Y):(t.consume(T),X)}function le(T){return T===o?(t.consume(T),o=void 0,L):T===null?i(T):ke(T)?(u=le,H(T)):(t.consume(T),le)}function X(T){return T===null||T===34||T===39||T===60||T===61||T===96?i(T):T===47||T===62||it(T)?ce(T):(t.consume(T),X)}function L(T){return T===47||T===62||it(T)?ce(T):i(T)}function O(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 _e(T)?Ge(t,Q,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):Q(T)}function Q(T){return t.enter("htmlTextData"),u(T)}}const bd={name:"labelEnd",resolveAll:Ak,resolveTo:Ik,tokenize:Dk},Rk={tokenize:Ok},Ek={tokenize:Mk},Nk={tokenize:zk};function Ak(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&&ln(t,0,t.length,i),t}function Ik(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,Ks(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]]),ln(t,d,t.length,h),t}function Dk(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(Cn(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(Rk,v,u?v:y)(S):S===91?t.attempt(Ek,v,u?p:y)(S):u?v(S):y(S)}function p(S){return t.attempt(Nk,v,y)(S)}function v(S){return r(S)}function y(S){return d._balanced=!0,i(S)}}function Ok(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 it(y)?tl(t,d)(y):d(y)}function d(y){return y===41?v(y):Gy(t,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function u(y){return it(y)?tl(t,g)(y):v(y)}function h(y){return i(y)}function g(y){return y===34||y===39||y===40?Fy(t,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):v(y)}function p(y){return it(y)?tl(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 Mk(t,r,i){const l=this;return o;function o(h){return $y.call(l,t,d,u,"reference","referenceMarker","referenceString")(h)}function d(h){return l.parser.defined.includes(Cn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?r(h):i(h)}function u(h){return i(h)}}function zk(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 _k={name:"labelStartImage",resolveAll:bd.resolveAll,tokenize:Lk};function Lk(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 Bk={name:"labelStartLink",resolveAll:bd.resolveAll,tokenize:Hk};function Hk(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 Tc={name:"lineEnding",tokenize:Uk};function Uk(t,r){return i;function i(l){return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Ge(t,r,"linePrefix")}}const Ns={name:"thematicBreak",tokenize:qk};function qk(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"),_e(p)?Ge(t,h,"whitespace")(p):h(p))}}const Pt={continuation:{tokenize:Vk},exit:Pk,name:"list",tokenize:Fk},Gk={partial:!0,tokenize:Kk},$k={partial:!0,tokenize:Yk};function Fk(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 C=l.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!l.containerState.marker||x===l.containerState.marker:Kc(x)){if(l.containerState.type||(l.containerState.type=C,t.enter(C,{_container:!0})),C==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(Ns,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(ll,l.interrupt?i:v,t.attempt(Gk,S,y))}function v(x){return l.containerState.initialBlankLine=!0,d++,S(x)}function y(x){return _e(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 Vk(t,r,i){const l=this;return l.containerState._closeFlow=void 0,t.check(ll,o,d);function o(h){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Ge(t,r,"listItemIndent",l.containerState.size+1)(h)}function d(h){return l.containerState.furtherBlankLines||!_e(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($k,r,u)(h))}function u(h){return l.containerState._closeFlow=!0,l.interrupt=void 0,Ge(t,t.attempt(Pt,r,i),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Yk(t,r,i){const l=this;return Ge(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 Pk(t){t.exit(this.containerState.type)}function Kk(t,r,i){const l=this;return Ge(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!_e(d)&&u&&u[1].type==="listItemPrefixWhitespace"?r(d):i(d)}}const mg={name:"setextUnderline",resolveTo:Xk,tokenize:Qk};function Xk(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 Qk(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"),_e(p)?Ge(t,g,"lineSuffix")(p):g(p))}function g(p){return p===null||ke(p)?(t.exit("setextHeadingLine"),r(p)):i(p)}}const Zk={tokenize:Jk};function Jk(t){const r=this,i=t.attempt(ll,l,t.attempt(this.parser.constructs.flowInitial,o,Ge(t,t.attempt(this.parser.constructs.flow,o,t.attempt(rk,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 Wk={resolveAll:Yy()},ew=Vy("string"),tw=Vy("text");function Vy(t){return{resolveAll:Yy(t==="text"?nw: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 Yy(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 nw(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 rw={42:Pt,43:Pt,45:Pt,48:Pt,49:Pt,50:Pt,51:Pt,52:Pt,53:Pt,54:Pt,55:Pt,56:Pt,57:Pt,62:By},iw={91:ok},aw={[-2]:jc,[-1]:jc,32:jc},lw={35:mk,42:Ns,45:[mg,Ns],60:vk,61:mg,95:Ns,96:fg,126:fg},sw={38:Uy,92:Hy},ow={[-5]:Tc,[-4]:Tc,[-3]:Tc,33:_k,38:Uy,42:Xc,60:[B0,jk],91:Bk,92:[fk,Hy],93:bd,95:Xc,96:Z0},uw={null:[Xc,Wk]},cw={null:[42,95]},dw={null:[]},fw=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:cw,contentInitial:iw,disable:dw,document:rw,flow:lw,flowInitial:aw,insideSpan:uw,string:sw,text:ow},Symbol.toStringTag,{value:"Module"}));function hw(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:A,enter:I,exit:G,interrupt:$(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:D,events:[],now:C,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(V){return u=bn(u,V),B(),u[u.length-1]!==null?[]:(re(r,0),p.events=Ks(d,p.events,p),p.events)}function S(V,Y){return pw(x(V),Y)}function x(V){return mw(u,V)}function C(){const{_bufferIndex:V,_index:Y,line:le,column:X,offset:L}=l;return{_bufferIndex:V,_index:Y,line:le,column:X,offset:L}}function D(V){o[V.line]=V.column,M()}function B(){let V;for(;l._index<u.length;){const Y=u[l._index];if(typeof Y=="string")for(V=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===V&&l._bufferIndex<Y.length;)E(Y.charCodeAt(l._bufferIndex));else E(Y)}}function E(V){v=v(V)}function A(V){ke(V)?(l.line++,l.column=1,l.offset+=V===-3?2:1,M()):V!==-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=V}function I(V,Y){const le=Y||{};return le.type=V,le.start=C(),p.events.push(["enter",le,p]),h.push(le),le}function G(V){const Y=h.pop();return Y.end=C(),p.events.push(["exit",Y,p]),Y}function K(V,Y){re(V,Y.from)}function N(V,Y){Y.restore()}function $(V,Y){return le;function le(X,L,O){let H,U,Q,T;return Array.isArray(X)?_(X):"tokenize"in X?_([X]):R(X);function R(W){return ie;function ie(he){const pe=he!==null&&W[he],ge=he!==null&&W.null,Ie=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return _(Ie)(he)}}function _(W){return H=W,U=0,W.length===0?O:w(W[U])}function w(W){return ie;function ie(he){return T=ce(),Q=W,W.partial||(p.currentConstruct=W),W.name&&p.parser.constructs.disable.null.includes(W.name)?fe():W.tokenize.call(Y?Object.assign(Object.create(p),Y):p,g,te,fe)(he)}}function te(W){return V(Q,T),L}function fe(W){return T.restore(),++U<H.length?w(H[U]):O}}}function re(V,Y){V.resolveAll&&!d.includes(V)&&d.push(V),V.resolve&&ln(p.events,Y,p.events.length-Y,V.resolve(p.events.slice(Y),p)),V.resolveTo&&(p.events=V.resolveTo(p.events,p))}function ce(){const V=C(),Y=p.previous,le=p.currentConstruct,X=p.events.length,L=Array.from(h);return{from:X,restore:O};function O(){l=V,p.previous=Y,p.currentConstruct=le,p.events.length=X,h=L,M()}}function M(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function mw(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 pw(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 gw(t){const l={constructs:_y([fw,...(t||{}).extensions||[]]),content:o(I0),defined:[],document:o(O0),flow:o(Zk),lazy:{},string:o(ew),text:o(tw)};return l;function o(d){return u;function u(h){return hw(l,d,h)}}}function yw(t){for(;!qy(t););return t}const pg=/[\0\t\n\r]/g;function vw(){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(pg.lastIndex=y,p=pg.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 bw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xw(t){return t.replace(bw,Sw)}function Sw(t,r,i){if(r)return r;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),d=o===120||o===88;return Ly(i.slice(d?2:1),d?16:10)}return vd(i)||t}const Py={}.hasOwnProperty;function kw(t,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),ww(i)(yw(gw(i).document().write(vw()(t,r,!0))))}function ww(t){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(Ht),autolinkProtocol:ce,autolinkEmail:ce,atxHeading:d(at),blockQuote:d(ge),characterEscape:ce,characterReference:ce,codeFenced:d(Ie),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:d(Ie,u),codeText:d(Ne,u),codeTextData:ce,data:ce,codeFlowValue:ce,definition:d($e),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:d(Pe),hardBreakEscape:d(sn),hardBreakTrailing:d(sn),htmlFlow:d(Tt,u),htmlFlowData:ce,htmlText:d(Tt,u),htmlTextData:ce,image:d(on),label:u,link:d(Ht),listItem:d(je),listItemValue:S,listOrdered:d(Rt,y),listUnordered:d(Rt),paragraph:d(qe),reference:w,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:d(at),strong:d(ut),thematicBreak:d(oe)},exit:{atxHeading:g(),atxHeadingSequence:K,autolink:g(),autolinkEmail:pe,autolinkProtocol:he,blockQuote:g(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:W,characterReference:ie,codeFenced:g(B),codeFencedFence:D,codeFencedFenceInfo:x,codeFencedFenceMeta:C,codeFlowValue:M,codeIndented:g(E),codeText:g(L),codeTextData:M,data:M,definition:g(),definitionDestinationString:G,definitionLabelString:A,definitionTitleString:I,emphasis:g(),hardBreakEscape:g(Y),hardBreakTrailing:g(Y),htmlFlow:g(le),htmlFlowData:M,htmlText:g(X),htmlTextData:M,image:g(H),label:Q,labelText:U,lineEnding:V,link:g(O),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:te,resourceDestinationString:T,resourceTitleString:R,resource:_,setextHeading:g(re),setextHeadingLineSequence:$,setextHeadingText:N,strong:g(),thematicBreak:g()}};Ky(r,(t||{}).mdastExtensions||[]);const i={};return l;function l(P){let de={type:"root",children:[]};const ve={stack:[de],tokenStack:[],config:r,enter:h,exit:p,buffer:u,resume:v,data:i},Ce=[];let Te=-1;for(;++Te<P.length;)if(P[Te][1].type==="listOrdered"||P[Te][1].type==="listUnordered")if(P[Te][0]==="enter")Ce.push(Te);else{const Se=Ce.pop();Te=o(P,Se,Te)}for(Te=-1;++Te<P.length;){const Se=r[P[Te][0]];Py.call(Se,P[Te][1].type)&&Se[P[Te][1].type].call(Object.assign({sliceSerialize:P[Te][2].sliceSerialize},ve),P[Te][1])}if(ve.tokenStack.length>0){const Se=ve.tokenStack[ve.tokenStack.length-1];(Se[1]||gg).call(ve,void 0,Se[0])}for(de.position={start:Tr(P.length>0?P[0][1].start:{line:1,column:1,offset:0}),end:Tr(P.length>0?P[P.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;++Te<r.transforms.length;)de=r.transforms[Te](de)||de;return de}function o(P,de,ve){let Ce=de-1,Te=-1,Se=!1,Ke,Oe,He,ht;for(;++Ce<=ve;){const Qe=P[Ce];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?Te++:Te--,ht=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Ke&&!ht&&!Te&&!He&&(He=Ce),ht=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ht=void 0}if(!Te&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||Te===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Ke){let jn=Ce;for(Oe=void 0;jn--;){const Qt=P[jn];if(Qt[1].type==="lineEnding"||Qt[1].type==="lineEndingBlank"){if(Qt[0]==="exit")continue;Oe&&(P[Oe][1].type="lineEndingBlank",Se=!0),Qt[1].type="lineEnding",Oe=jn}else if(!(Qt[1].type==="linePrefix"||Qt[1].type==="blockQuotePrefix"||Qt[1].type==="blockQuotePrefixWhitespace"||Qt[1].type==="blockQuoteMarker"||Qt[1].type==="listItemIndent"))break}He&&(!Oe||He<Oe)&&(Ke._spread=!0),Ke.end=Object.assign({},Oe?P[Oe][1].start:Qe[1].end),P.splice(Oe||Ce,0,["exit",Ke,Qe[2]]),Ce++,ve++}if(Qe[1].type==="listItemPrefix"){const jn={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Ke=jn,P.splice(Ce,0,["enter",jn,Qe[2]]),Ce++,ve++,He=void 0,ht=!0}}}return P[de][1]._spread=Se,ve}function d(P,de){return ve;function ve(Ce){h.call(this,P(Ce),Ce),de&&de.call(this,Ce)}}function u(){this.stack.push({type:"fragment",children:[]})}function h(P,de,ve){this.stack[this.stack.length-1].children.push(P),this.stack.push(P),this.tokenStack.push([de,ve||void 0]),P.position={start:Tr(de.start),end:void 0}}function g(P){return de;function de(ve){P&&P.call(this,ve),p.call(this,ve)}}function p(P,de){const ve=this.stack.pop(),Ce=this.tokenStack.pop();if(Ce)Ce[0].type!==P.type&&(de?de.call(this,P,Ce[0]):(Ce[1]||gg).call(this,P,Ce[0]));else throw new Error("Cannot close `"+P.type+"` ("+el({start:P.start,end:P.end})+"): it’s not open");ve.position.end=Tr(P.end)}function v(){return yd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function S(P){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(P),10),this.data.expectingFirstListItemValue=void 0}}function x(){const P=this.resume(),de=this.stack[this.stack.length-1];de.lang=P}function C(){const P=this.resume(),de=this.stack[this.stack.length-1];de.meta=P}function D(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const P=this.resume(),de=this.stack[this.stack.length-1];de.value=P.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const P=this.resume(),de=this.stack[this.stack.length-1];de.value=P.replace(/(\r?\n|\r)$/g,"")}function A(P){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.label=de,ve.identifier=Cn(this.sliceSerialize(P)).toLowerCase()}function I(){const P=this.resume(),de=this.stack[this.stack.length-1];de.title=P}function G(){const P=this.resume(),de=this.stack[this.stack.length-1];de.url=P}function K(P){const de=this.stack[this.stack.length-1];if(!de.depth){const ve=this.sliceSerialize(P).length;de.depth=ve}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function $(P){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(P).codePointAt(0)===61?1:2}function re(){this.data.setextHeadingSlurpLineEnding=void 0}function ce(P){const ve=this.stack[this.stack.length-1].children;let Ce=ve[ve.length-1];(!Ce||Ce.type!=="text")&&(Ce=Fe(),Ce.position={start:Tr(P.start),end:void 0},ve.push(Ce)),this.stack.push(Ce)}function M(P){const de=this.stack.pop();de.value+=this.sliceSerialize(P),de.position.end=Tr(P.end)}function V(P){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=de.children[de.children.length-1];ve.position.end=Tr(P.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(de.type)&&(ce.call(this,P),M.call(this,P))}function Y(){this.data.atHardBreak=!0}function le(){const P=this.resume(),de=this.stack[this.stack.length-1];de.value=P}function X(){const P=this.resume(),de=this.stack[this.stack.length-1];de.value=P}function L(){const P=this.resume(),de=this.stack[this.stack.length-1];de.value=P}function O(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=de,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function H(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=de,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function U(P){const de=this.sliceSerialize(P),ve=this.stack[this.stack.length-2];ve.label=xw(de),ve.identifier=Cn(de).toLowerCase()}function Q(){const P=this.stack[this.stack.length-1],de=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Ce=P.children;ve.children=Ce}else ve.alt=de}function T(){const P=this.resume(),de=this.stack[this.stack.length-1];de.url=P}function R(){const P=this.resume(),de=this.stack[this.stack.length-1];de.title=P}function _(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function te(P){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.label=de,ve.identifier=Cn(this.sliceSerialize(P)).toLowerCase(),this.data.referenceType="full"}function fe(P){this.data.characterReferenceType=P.type}function W(P){const de=this.sliceSerialize(P),ve=this.data.characterReferenceType;let Ce;ve?(Ce=Ly(de,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ce=vd(de);const Te=this.stack[this.stack.length-1];Te.value+=Ce}function ie(P){const de=this.stack.pop();de.position.end=Tr(P.end)}function he(P){M.call(this,P);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(P)}function pe(P){M.call(this,P);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(P)}function ge(){return{type:"blockquote",children:[]}}function Ie(){return{type:"code",lang:null,meta:null,value:""}}function Ne(){return{type:"inlineCode",value:""}}function $e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Pe(){return{type:"emphasis",children:[]}}function at(){return{type:"heading",depth:0,children:[]}}function sn(){return{type:"break"}}function Tt(){return{type:"html",value:""}}function on(){return{type:"image",title:null,url:"",alt:null}}function Ht(){return{type:"link",title:null,url:"",children:[]}}function Rt(P){return{type:"list",ordered:P.type==="listOrdered",start:null,spread:P._spread,children:[]}}function je(P){return{type:"listItem",spread:P._spread,checked:null,children:[]}}function qe(){return{type:"paragraph",children:[]}}function ut(){return{type:"strong",children:[]}}function Fe(){return{type:"text",value:""}}function oe(){return{type:"thematicBreak"}}}function Tr(t){return{line:t.line,column:t.column,offset:t.offset}}function Ky(t,r){let i=-1;for(;++i<r.length;){const l=r[i];Array.isArray(l)?Ky(t,l):Cw(t,l)}}function Cw(t,r){let i;for(i in r)if(Py.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 gg(t,r){throw t?new Error("Cannot close `"+t.type+"` ("+el({start:t.start,end:t.end})+"): a different token (`"+r.type+"`, "+el({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+el({start:r.start,end:r.end})+") is still open")}function jw(t){const r=this;r.parser=i;function i(l){return kw(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 Rw(t,r){const i={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,i),[t.applyData(r,i),{type:"text",value:`
15
+ `}]}function Ew(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 Nw(t,r){const i={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Aw(t,r){const i={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Iw(t,r){const i=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",l=String(r.identifier).toUpperCase(),o=Wi(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 Dw(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 Ow(t,r){if(t.options.allowDangerousHtml){const i={type:"raw",value:r.value};return t.patch(r,i),t.applyData(r,i)}}function Xy(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 Mw(t,r){const i=String(r.identifier).toUpperCase(),l=t.definitionById.get(i);if(!l)return Xy(t,r);const o={src:Wi(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 zw(t,r){const i={src:Wi(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 _w(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 Lw(t,r){const i=String(r.identifier).toUpperCase(),l=t.definitionById.get(i);if(!l)return Xy(t,r);const o={href:Wi(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 Bw(t,r){const i={href:Wi(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 Hw(t,r,i){const l=t.all(r),o=i?Uw(i):Qy(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 Uw(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=Qy(i[l])}return r}function Qy(t){const r=t.spread;return r??t.children.length>1}function qw(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 Gw(t,r){const i={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function $w(t,r){const i={type:"root",children:t.wrap(t.all(r))};return t.patch(r,i),t.applyData(r,i)}function Fw(t,r){const i={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}function Vw(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=Ny(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 C={type:"element",tagName:d,properties:S,children:[]};y&&(C.children=t.all(y),t.patch(y,C),C=t.applyData(y,C)),p.push(C)}const v={type:"element",tagName:"tr",properties:{},children:t.wrap(p,!0)};return t.patch(r,v),t.applyData(r,v)}function Pw(t,r){const i={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)}const yg=9,vg=32;function Kw(t){const r=String(t),i=/\r?\n|\r/g;let l=i.exec(r),o=0;const d=[];for(;l;)d.push(bg(r.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=i.exec(r);return d.push(bg(r.slice(o),o>0,!1)),d.join("")}function bg(t,r,i){let l=0,o=t.length;if(r){let d=t.codePointAt(l);for(;d===yg||d===vg;)l++,d=t.codePointAt(l)}if(i){let d=t.codePointAt(o-1);for(;d===yg||d===vg;)o--,d=t.codePointAt(o-1)}return o>l?t.slice(l,o):""}function Xw(t,r){const i={type:"text",value:Kw(String(r.value))};return t.patch(r,i),t.applyData(r,i)}function Qw(t,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,i),t.applyData(r,i)}const Zw={blockquote:Tw,break:Rw,code:Ew,delete:Nw,emphasis:Aw,footnoteReference:Iw,heading:Dw,html:Ow,imageReference:Mw,image:zw,inlineCode:_w,linkReference:Lw,link:Bw,listItem:Hw,list:qw,paragraph:Gw,root:$w,strong:Fw,table:Vw,tableCell:Pw,tableRow:Yw,text:Xw,thematicBreak:Qw,toml:ws,yaml:ws,definition:ws,footnoteDefinition:ws};function ws(){}const Zy=-1,Xs=0,nl=1,zs=2,xd=3,Sd=4,kd=5,wd=6,Jy=7,Wy=8,ev=typeof self=="object"?self:globalThis,xg=(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 ev[t](r)},Jw=(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 Xs:case Zy:return i(u,o);case nl:{const h=i([],o);for(const g of u)h.push(l(g));return h}case zs:{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 Jy:{const{name:h,message:g}=u;return i(typeof ev[h]=="function"?xg(h,g):new Error(g),o)}case Wy: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(xg(d,u),o)};return l},Sg=t=>Jw(new Map,t)(0),Jr="",{toString:Ww}={},{keys:eC}=Object,Za=t=>{const r=typeof t;if(r!=="object"||!t)return[Xs,r];const i=Ww.call(t).slice(8,-1);switch(i){case"Array":return[nl,Jr];case"Object":return[zs,Jr];case"Date":return[xd,Jr];case"RegExp":return[Sd,Jr];case"Map":return[kd,Jr];case"Set":return[wd,Jr];case"DataView":return[nl,i]}return i.includes("Array")?[nl,i]:t instanceof Error?[Jy,t.name||"Error"]:[zs,i]},Cs=([t,r])=>t===Xs&&(r==="function"||r==="symbol"),tC=(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]=Za(u);switch(h){case Xs:{let v=u;switch(g){case"bigint":h=Wy,v=u.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+g);v=null;break;case"undefined":return o([Zy],u)}return o([h,v],u)}case nl:{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 zs:{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 eC(u))(t||!Cs(Za(u[S])))&&v.push([d(S),d(u[S])]);return y}case xd:return o([h,isNaN(u.getTime())?Jr: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||!(Cs(Za(S))||Cs(Za(x))))&&v.push([d(S),d(x)]);return y}case wd:{const v=[],y=o([h,v],u);for(const S of u)(t||!Cs(Za(S)))&&v.push(d(S));return y}}const{message:p}=u;return o([h,{name:g,message:p}],u)};return d},kg=(t,{json:r,lossy:i}={})=>{const l=[];return tC(!(r||i),!!r,new Map,l)(t),l},_s=typeof structuredClone=="function"?(t,r)=>r&&("json"in r||"lossy"in r)?Sg(kg(t,r)):structuredClone(t):(t,r)=>Sg(kg(t,r));function nC(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 rC(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}function iC(t){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=t.options.footnoteBackContent||nC,l=t.options.footnoteBackLabel||rC,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=Wi(y.toLowerCase());let x=0;const C=[],D=t.footnoteCounts.get(y);for(;D!==void 0&&++x<=D;){C.length>0&&C.push({type:"text",value:" "});let A=typeof i=="string"?i:i(g,x);typeof A=="string"&&(A={type:"text",value:A}),C.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(A)?A:[A]})}const B=v[v.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const A=B.children[B.children.length-1];A&&A.type==="text"?A.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...C)}else v.push(...C);const E={type:"element",tagName:"li",properties:{id:r+"fn-"+S},children:t.wrap(v,!0)};t.patch(p,E),h.push(E)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:d,properties:{..._s(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 Qs=(function(t){if(t==null)return oC;if(typeof t=="function")return Zs(t);if(typeof t=="object")return Array.isArray(t)?aC(t):lC(t);if(typeof t=="string")return sC(t);throw new Error("Expected function, string, or object as test")});function aC(t){const r=[];let i=-1;for(;++i<t.length;)r[i]=Qs(t[i]);return Zs(l);function l(...o){let d=-1;for(;++d<r.length;)if(r[d].apply(this,o))return!0;return!1}}function lC(t){const r=t;return Zs(i);function i(l){const o=l;let d;for(d in t)if(o[d]!==r[d])return!1;return!0}}function sC(t){return Zs(r);function r(i){return i&&i.type===t}}function Zs(t){return r;function r(i,l,o){return!!(uC(i)&&t.call(this,i,typeof l=="number"?l:void 0,o||void 0))}}function oC(){return!0}function uC(t){return t!==null&&typeof t=="object"&&"type"in t}const tv=[],cC=!0,Qc=!1,dC="skip";function nv(t,r,i,l){let o;typeof r=="function"&&typeof i!="function"?(l=i,i=r):o=r;const d=Qs(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=tv,C,D,B;if((!r||d(g,p,v[v.length-1]||void 0))&&(x=fC(i(g,v)),x[0]===Qc))return x;if("children"in g&&g.children){const E=g;if(E.children&&x[0]!==dC)for(D=(l?E.children.length:-1)+u,B=v.concat(E);D>-1&&D<E.children.length;){const A=E.children[D];if(C=h(A,D,B)(),C[0]===Qc)return C;D=typeof C[1]=="number"?C[1]:D+u}}return x}}}function fC(t){return Array.isArray(t)?t:typeof t=="number"?[cC,t]:t==null?tv:[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),nv(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,hC={};function mC(t,r){const i=r||hC,l=new Map,o=new Map,d=new Map,u={...Zw,...i.handlers},h={all:p,applyData:gC,definitionById:l,footnoteById:o,footnoteCounts:d,footnoteOrder:[],handlers:u,one:g,options:i,patch:pC,wrap:vC};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:D,...B}=v,E=_s(B);return E.children=h.all(v),E}return _s(v)}return(h.options.unknownHandler||yC)(h,v,y)}function p(v){const y=[];if("children"in v){const S=v.children;let x=-1;for(;++x<S.length;){const C=h.one(S[x],v);if(C){if(x&&S[x-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=wg(C.value)),!Array.isArray(C)&&C.type==="element")){const D=C.children[0];D&&D.type==="text"&&(D.value=wg(D.value))}Array.isArray(C)?y.push(...C):y.push(C)}}}return y}}function pC(t,r){t.position&&(r.position=r0(t))}function gC(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,_s(d)),"children"in i&&i.children&&o!==null&&o!==void 0&&(i.children=o)}return i}function yC(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 vC(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 wg(t){let r=0,i=t.charCodeAt(r);for(;i===9||i===32;)r++,i=t.charCodeAt(r);return t.slice(r)}function Cg(t,r){const i=mC(t,r),l=i.one(t,void 0),o=iC(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 bC(t,r){return t&&"run"in t?async function(i,l){const o=Cg(i,{file:l,...r});await t.run(o,l)}:function(i,l){return Cg(i,{file:l,...t||r})}}function jg(t){if(t)throw t}var Rc,Tg;function xC(){if(Tg)return Rc;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 Rc=function g(){var p,v,y,S,x,C,D=arguments[0],B=1,E=arguments.length,A=!1;for(typeof D=="boolean"&&(A=D,D=arguments[1]||{},B=2),(D==null||typeof D!="object"&&typeof D!="function")&&(D={});B<E;++B)if(p=arguments[B],p!=null)for(v in p)y=h(D,v),S=h(p,v),D!==S&&(A&&S&&(d(S)||(x=o(S)))?(x?(x=!1,C=y&&o(y)?y:[]):C=y&&d(y)?y:{},u(D,{name:v,newValue:g(A,C,S)})):typeof S<"u"&&u(D,{name:v,newValue:S}));return D},Rc}var SC=xC();const Ec=ld(SC);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 kC(){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?wC(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 wC(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 In={basename:CC,dirname:jC,extname:TC,join:RC,sep:"/"};function CC(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');sl(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 jC(t){if(sl(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){sl(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 RC(...t){let r=-1,i;for(;++r<t.length;)sl(t[r]),t[r]&&(i=i===void 0?t[r]:i+"/"+t[r]);return i===void 0?".":EC(i)}function EC(t){sl(t);const r=t.codePointAt(0)===47;let i=NC(t,!r);return i.length===0&&!r&&(i="."),i.length>0&&t.codePointAt(t.length-1)===47&&(i+="/"),r?"/"+i:i}function NC(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 sl(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const AC={cwd:IC};function IC(){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 DC(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 OC(t)}function OC(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 rv{constructor(r){let i;r?Wc(r)?i={path:r}:typeof r=="string"||MC(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":AC.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"?In.basename(this.path):void 0}set basename(r){Ic(r,"basename"),Ac(r,"basename"),this.path=In.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?In.dirname(this.path):void 0}set dirname(r){Rg(this.basename,"dirname"),this.path=In.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?In.extname(this.path):void 0}set extname(r){if(Ac(r,"extname"),Rg(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=In.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Wc(r)&&(r=DC(r)),Ic(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?In.basename(this.path,this.extname):void 0}set stem(r){Ic(r,"stem"),Ac(r,"stem"),this.path=In.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 _t(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(In.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+In.sep+"`")}function Ic(t,r){if(!t)throw new Error("`"+r+"` cannot be empty")}function Rg(t,r){if(!t)throw new Error("Setting `"+r+"` requires `path` to be set too")}function MC(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const zC=(function(t){const l=this.constructor.prototype,o=l[t],d=function(){return o.apply(d,arguments)};return Object.setPrototypeOf(d,l),d}),_C={}.hasOwnProperty;class jd extends zC{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=kC()}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):_C.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=js(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=js(r),g=l.parse(h);l.run(g,h,function(v,y,S){if(v||!y||!S)return p(v);const x=y,C=l.stringify(x,S);HC(C)?S.value=C:S.result=C,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),Ng("processSync","process",i),l;function o(d,u){i=!0,jg(d),l=u}}run(r,i,l){Eg(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=js(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),Ng("runSync","run",l),o;function d(u,h){jg(u),o=h,l=!0}}stringify(r,i){this.freeze();const l=js(i),o=this.compiler||this.Compiler;return Oc("stringify",o),Eg(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,...C]=v;const D=l[S][1];Jc(D)&&Jc(x)&&(x=Ec(!0,D,x)),l[S]=[p,x,...C]}}}}const LC=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 Eg(t){if(!Jc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ng(t,r,i){if(!i)throw new Error("`"+t+"` finished async. Use `"+r+"` instead")}function js(t){return BC(t)?t:new rv(t)}function BC(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function HC(t){return typeof t=="string"||UC(t)}function UC(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const qC="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ag=[],Ig={allowDangerousHtml:!0},GC=/^(https?|ircs?|mailto|xmpp)$/i,$C=[{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 FC(t){const r=VC(t),i=YC(t);return PC(r.runSync(r.parse(i),i),t)}function VC(t){const r=t.rehypePlugins||Ag,i=t.remarkPlugins||Ag,l=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Ig}:Ig;return LC().use(jw).use(i).use(bC,l).use(r)}function YC(t){const r=t.children||"",i=new rv;return typeof r=="string"&&(i.value=r),i}function PC(t,r){const i=r.allowedElements,l=r.allowElement,o=r.components,d=r.disallowedElements,u=r.skipHtml,h=r.unwrapDisallowed,g=r.urlTransform||KC;for(const v of $C)Object.hasOwn(r,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+qC+v.id,void 0);return Cd(t,p),o0(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 C=v.properties[x],D=Cc[x];(D===null||D.includes(v.tagName))&&(v.properties[x]=g(String(C||""),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 KC(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||GC.test(t.slice(0,r))?t:""}function Dg(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 XC(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function QC(t,r,i){const o=Qs((i||{}).ignore||[]),d=ZC(r);let u=-1;for(;++u<d.length;)nv(t,"text",h);function h(p,v){let y=-1,S;for(;++y<v.length;){const x=v[y],C=S?S.children:void 0;if(o(x,C?C.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 C=0;const B=y.children.indexOf(p);let E=!1,A=[];S.lastIndex=0;let I=S.exec(p.value);for(;I;){const G=I.index,K={index:I.index,input:I.input,stack:[...v,p]};let N=x(...I,K);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?S.lastIndex=G+1:(C!==G&&A.push({type:"text",value:p.value.slice(C,G)}),Array.isArray(N)?A.push(...N):N&&A.push(N),C=G+I[0].length,E=!0),!S.global)break;I=S.exec(p.value)}return E?(C<p.value.length&&A.push({type:"text",value:p.value.slice(C)}),y.children.splice(B,1,...A)):A=[p],B+A.length}}function ZC(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([JC(o[0]),WC(o[1])])}return r}function JC(t){return typeof t=="string"?new RegExp(XC(t),"g"):t}function WC(t){return typeof t=="function"?t:function(){return t}}const zc="phrasing",_c=["autolink","link","image","label"];function ej(){return{transforms:[sj],enter:{literalAutolink:nj,literalAutolinkEmail:Lc,literalAutolinkHttp:Lc,literalAutolinkWww:Lc},exit:{literalAutolink:lj,literalAutolinkEmail:aj,literalAutolinkHttp:rj,literalAutolinkWww:ij}}}function tj(){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 nj(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Lc(t){this.config.enter.autolinkProtocol.call(this,t)}function rj(t){this.config.exit.autolinkProtocol.call(this,t)}function ij(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 aj(t){this.config.exit.autolinkEmail.call(this,t)}function lj(t){this.exit(t)}function sj(t){QC(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,oj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),uj]],{ignore:["link","linkReference"]})}function oj(t,r,i,l,o){let d="";if(!iv(o)||(/^w/i.test(r)&&(i=r+i,r="",d="http://"),!cj(i)))return!1;const u=dj(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 uj(t,r,i,l){return!iv(l,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function cj(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 dj(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=Dg(t,"(");let d=Dg(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 iv(t,r){const i=t.input.charCodeAt(t.index-1);return(t.index===0||ri(i)||Ps(i))&&(!r||i!==47)}av.peek=xj;function fj(){this.buffer()}function hj(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function mj(){this.buffer()}function pj(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function gj(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Cn(this.sliceSerialize(t)).toLowerCase(),i.label=r}function yj(t){this.exit(t)}function vj(t){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Cn(this.sliceSerialize(t)).toLowerCase(),i.label=r}function bj(t){this.exit(t)}function xj(){return"["}function av(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 Sj(){return{enter:{gfmFootnoteCallString:fj,gfmFootnoteCall:hj,gfmFootnoteDefinitionLabelString:mj,gfmFootnoteDefinition:pj},exit:{gfmFootnoteCallString:gj,gfmFootnoteCall:yj,gfmFootnoteDefinitionLabelString:vj,gfmFootnoteDefinition:bj}}}function kj(t){let r=!1;return t&&t.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:av},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?lv:wj))),p(),g}}function wj(t,r,i){return r===0?t:lv(t,r,i)}function lv(t,r,i){return(i?"":" ")+t}const Cj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];sv.peek=Nj;function jj(){return{canContainEols:["delete"],enter:{strikethrough:Rj},exit:{strikethrough:Ej}}}function Tj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Cj}],handlers:{delete:sv}}}function Rj(t){this.enter({type:"delete",children:[]},t)}function Ej(t){this.exit(t)}function sv(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 Nj(){return"~"}function Aj(t){return t.length}function Ij(t,r){const i=r||{},l=(i.align||[]).concat(),o=i.stringLength||Aj,d=[],u=[],h=[],g=[];let p=0,v=-1;for(;++v<t.length;){const D=[],B=[];let E=-1;for(t[v].length>p&&(p=t[v].length);++E<t[v].length;){const A=Dj(t[v][E]);if(i.alignDelimiters!==!1){const I=o(A);B[E]=I,(g[E]===void 0||I>g[E])&&(g[E]=I)}D.push(A)}u[v]=D,h[v]=B}let y=-1;if(typeof l=="object"&&"length"in l)for(;++y<p;)d[y]=Og(l[y]);else{const D=Og(l);for(;++y<p;)d[y]=D}y=-1;const S=[],x=[];for(;++y<p;){const D=d[y];let B="",E="";D===99?(B=":",E=":"):D===108?B=":":D===114&&(E=":");let A=i.alignDelimiters===!1?1:Math.max(1,g[y]-B.length-E.length);const I=B+"-".repeat(A)+E;i.alignDelimiters!==!1&&(A=B.length+A+E.length,A>g[y]&&(g[y]=A),x[y]=A),S[y]=I}u.splice(1,0,S),h.splice(1,0,x),v=-1;const C=[];for(;++v<u.length;){const D=u[v],B=h[v];y=-1;const E=[];for(;++y<p;){const A=D[y]||"";let I="",G="";if(i.alignDelimiters!==!1){const K=g[y]-(B[y]||0),N=d[y];N===114?I=" ".repeat(K):N===99?K%2?(I=" ".repeat(K/2+.5),G=" ".repeat(K/2-.5)):(I=" ".repeat(K/2),G=I):G=" ".repeat(K)}i.delimiterStart!==!1&&!y&&E.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&A==="")&&(i.delimiterStart!==!1||y)&&E.push(" "),i.alignDelimiters!==!1&&E.push(I),E.push(A),i.alignDelimiters!==!1&&E.push(G),i.padding!==!1&&E.push(" "),(i.delimiterEnd!==!1||y!==p-1)&&E.push("|")}C.push(i.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return C.join(`
26
+ `)}function Dj(t){return t==null?"":String(t)}function Og(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 Oj(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()),Mj);return o(),u}function Mj(t,r,i){return">"+(i?"":" ")+t}function zj(t,r){return Mg(t,r.inConstruct,!0)&&!Mg(t,r.notInConstruct,!1)}function Mg(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 zg(t,r,i,l){let o=-1;for(;++o<i.unsafe.length;)if(i.unsafe[o].character===`
27
+ `&&zj(i.stack,i.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
28
+ `}function _j(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 Lj(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 Bj(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 Hj(t,r,i,l){const o=Bj(i),d=t.value||"",u=o==="`"?"GraveAccent":"Tilde";if(Lj(t,i)){const y=i.enter("codeIndented"),S=i.indentLines(d,Uj);return y(),S}const h=i.createTracker(l),g=o.repeat(Math.max(_j(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 Uj(t,r,i){return(i?"":" ")+t}function Td(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 qj(t,r,i,l){const o=Td(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 Gj(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 il(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ls(t,r,i){const l=Qi(t),o=Qi(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}}ov.peek=$j;function ov(t,r,i,l){const o=Gj(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=Ls(l.before.charCodeAt(l.before.length-1),p,o);v.inside&&(g=il(p)+g.slice(1));const y=g.charCodeAt(g.length-1),S=Ls(l.after.charCodeAt(0),y,o);S.inside&&(g=g.slice(0,-1)+il(y));const x=u.move(o);return d(),i.attentionEncodeSurroundingInfo={after:S.outside,before:v.outside},h+g+x}function $j(t,r,i){return i.options.emphasis||"*"}function Fj(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 Vj(t,r,i,l){const o=Math.max(Math.min(6,t.depth||1),1),d=i.createTracker(l);if(Fj(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=il(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,i.options.closeAtx&&(p+=" "+u),g(),h(),p}uv.peek=Yj;function uv(t){return t.value||""}function Yj(){return"<"}cv.peek=Pj;function cv(t,r,i,l){const o=Td(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 Pj(){return"!"}dv.peek=Kj;function dv(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 Kj(){return"!"}fv.peek=Xj;function fv(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 Xj(){return"`"}function hv(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))}mv.peek=Qj;function mv(t,r,i,l){const o=Td(i),d=o==='"'?"Quote":"Apostrophe",u=i.createTracker(l);let h,g;if(hv(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 Qj(t,r,i){return hv(t,i)?"<":"["}pv.peek=Zj;function pv(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 Zj(){return"["}function Rd(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 Jj(t){const r=Rd(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 Wj(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 gv(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 eT(t,r,i,l){const o=i.enter("list"),d=i.bulletCurrent;let u=t.ordered?Wj(i):Rd(i);const h=t.ordered?u==="."?")":".":Jj(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),gv(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 tT(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 nT(t,r,i,l){const o=tT(i);let d=i.bulletCurrent||Rd(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 rT(t,r,i,l){const o=i.enter("paragraph"),d=i.enter("phrasing"),u=i.containerPhrasing(t,l);return d(),o(),u}const iT=Qs(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aT(t,r,i,l){return(t.children.some(function(u){return iT(u)})?i.containerPhrasing:i.containerFlow).call(i,t,l)}function lT(t){const r=t.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}yv.peek=sT;function yv(t,r,i,l){const o=lT(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=Ls(l.before.charCodeAt(l.before.length-1),p,o);v.inside&&(g=il(p)+g.slice(1));const y=g.charCodeAt(g.length-1),S=Ls(l.after.charCodeAt(0),y,o);S.inside&&(g=g.slice(0,-1)+il(y));const x=u.move(o+o);return d(),i.attentionEncodeSurroundingInfo={after:S.outside,before:v.outside},h+g+x}function sT(t,r,i){return i.options.strong||"*"}function oT(t,r,i,l){return i.safe(t.value,l)}function uT(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 cT(t,r,i){const l=(gv(i)+(i.options.ruleSpaces?" ":"")).repeat(uT(i));return i.options.ruleSpaces?l.slice(0,-1):l}const vv={blockquote:Oj,break:zg,code:Hj,definition:qj,emphasis:ov,hardBreak:zg,heading:Vj,html:uv,image:cv,imageReference:dv,inlineCode:fv,link:mv,linkReference:pv,list:eT,listItem:nT,paragraph:rT,root:aT,strong:yv,text:oT,thematicBreak:cT};function dT(){return{enter:{table:fT,tableData:_g,tableHeader:_g,tableRow:mT},exit:{codeText:pT,table:hT,tableData:Bc,tableHeader:Bc,tableRow:Bc}}}function fT(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 hT(t){this.exit(t),this.data.inTable=void 0}function mT(t){this.enter({type:"tableRow",children:[]},t)}function Bc(t){this.exit(t)}function _g(t){this.enter({type:"tableCell",children:[]},t)}function pT(t){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,gT));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(t)}function gT(t,r){return r==="|"?r:t}function yT(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,C,D,B){return p(v(x,D,B),x.align)}function h(x,C,D,B){const E=y(x,D,B),A=p([E]);return A.slice(0,A.indexOf(`
39
+ `))}function g(x,C,D,B){const E=D.enter("tableCell"),A=D.enter("phrasing"),I=D.containerPhrasing(x,{...B,before:d,after:d});return A(),E(),I}function p(x,C){return Ij(x,{align:C,alignDelimiters:l,padding:i,stringLength:o})}function v(x,C,D){const B=x.children;let E=-1;const A=[],I=C.enter("table");for(;++E<B.length;)A[E]=y(B[E],C,D);return I(),A}function y(x,C,D){const B=x.children;let E=-1;const A=[],I=C.enter("tableRow");for(;++E<B.length;)A[E]=g(B[E],x,C,D);return I(),A}function S(x,C,D){let B=vv.inlineCode(x,C,D);return D.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function vT(){return{exit:{taskListCheckValueChecked:Lg,taskListCheckValueUnchecked:Lg,paragraph:xT}}}function bT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ST}}}function Lg(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function xT(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 ST(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=vv.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 kT(){return[ej(),Sj(),jj(),dT(),vT()]}function wT(t){return{extensions:[tj(),kj(t),Tj(),yT(t),bT()]}}const CT={tokenize:AT,partial:!0},bv={tokenize:IT,partial:!0},xv={tokenize:DT,partial:!0},Sv={tokenize:OT,partial:!0},jT={tokenize:MT,partial:!0},kv={name:"wwwAutolink",tokenize:ET,previous:Cv},wv={name:"protocolAutolink",tokenize:NT,previous:jv},tr={name:"emailAutolink",tokenize:RT,previous:Tv},On={};function TT(){return{text:On}}let Zr=48;for(;Zr<123;)On[Zr]=tr,Zr++,Zr===58?Zr=65:Zr===91&&(Zr=97);On[43]=tr;On[45]=tr;On[46]=tr;On[95]=tr;On[72]=[tr,wv];On[104]=[tr,wv];On[87]=[tr,kv];On[119]=[tr,kv];function RT(t,r,i){const l=this;let o,d;return u;function u(y){return!ed(y)||!Tv.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(jT,v,p)(y):y===45||y===95||zt(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&&Bt(l.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),r(y)):i(y)}}function ET(t,r,i){const l=this;return o;function o(u){return u!==87&&u!==119||!Cv.call(l,l.previous)||Ed(l.events)?i(u):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(CT,t.attempt(bv,t.attempt(xv,d),i),i)(u))}function d(u){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(u)}}function NT(t,r,i){const l=this;let o="",d=!1;return u;function u(y){return(y===72||y===104)&&jv.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(Bt(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||Ms(y)||it(y)||ri(y)||Ps(y)?i(y):t.attempt(bv,t.attempt(xv,v),i)(y)}function v(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(y)}}function AT(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 IT(t,r,i){let l,o,d;return u;function u(p){return p===46||p===95?t.check(Sv,g,h)(p):p===null||it(p)||ri(p)||p!==45&&Ps(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 DT(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(Sv,r,d)(u):u===null||it(u)||ri(u)?r(u):(t.consume(u),o)}function d(u){return u===41&&l++,t.consume(u),o}}function OT(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||it(h)||ri(h)?r(h):i(h)}function o(h){return h===null||h===40||h===91||it(h)||ri(h)?r(h):l(h)}function d(h){return Bt(h)?u(h):i(h)}function u(h){return h===59?(t.consume(h),l):Bt(h)?(t.consume(h),u):i(h)}}function MT(t,r,i){return l;function l(d){return t.consume(d),o}function o(d){return zt(d)?i(d):r(d)}}function Cv(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||it(t)}function jv(t){return!Bt(t)}function Tv(t){return!(t===47||ed(t))}function ed(t){return t===43||t===45||t===46||t===95||zt(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 zT={tokenize:$T,partial:!0};function _T(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:UT,continuation:{tokenize:qT},exit:GT}},text:{91:{name:"gfmFootnoteCall",tokenize:HT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:LT,resolveTo:BT}}}}function LT(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=Cn(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 BT(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 HT(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||it(y))return i(y);if(y===93){t.exit("chunkString");const S=t.exit("gfmFootnoteCallString");return o.includes(Cn(l.sliceSerialize(S)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),r):i(y)}return it(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 UT(t,r,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d,u=0,h;return g;function g(C){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(C){return C===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",v):i(C)}function v(C){if(u>999||C===93&&!h||C===null||C===91||it(C))return i(C);if(C===93){t.exit("chunkString");const D=t.exit("gfmFootnoteDefinitionLabelString");return d=Cn(l.sliceSerialize(D)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),S}return it(C)||(h=!0),u++,t.consume(C),C===92?y:v}function y(C){return C===91||C===92||C===93?(t.consume(C),u++,v):v(C)}function S(C){return C===58?(t.enter("definitionMarker"),t.consume(C),t.exit("definitionMarker"),o.includes(d)||o.push(d),Ge(t,x,"gfmFootnoteDefinitionWhitespace")):i(C)}function x(C){return r(C)}}function qT(t,r,i){return t.check(ll,r,t.attempt(zT,r,i))}function GT(t){t.exit("gfmFootnoteDefinition")}function $T(t,r,i){const l=this;return Ge(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 FT(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&&ln(S,S.length,0,Ks(x,u.slice(p+1,g),h)),ln(S,S.length,0,[["exit",y,h],["enter",u[g][1],h],["exit",u[g][1],h],["exit",v,h]]),ln(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(C){return p===126&&v[v.length-1][1].type!=="characterEscape"?g(C):(u.enter("strikethroughSequenceTemporary"),x(C))}function x(C){const D=Qi(p);if(C===126)return y>1?g(C):(u.consume(C),y++,x);if(y<2&&!i)return g(C);const B=u.exit("strikethroughSequenceTemporary"),E=Qi(C);return B._open=!E||E===2&&!!D,B._close=!D||D===2&&!!E,h(C)}}}class VT{constructor(){this.map=[]}add(r,i,l){YT(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 YT(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 PT(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 KT(){return{flow:{null:{name:"table",tokenize:XT,resolveAll:QT}}}}function XT(t,r,i){const l=this;let o=0,d=0,u;return h;function h(M){let V=l.events.length-1;for(;V>-1;){const X=l.events[V][1].type;if(X==="lineEnding"||X==="linePrefix")V--;else break}const Y=V>-1?l.events[V][1].type:null,le=Y==="tableHead"||Y==="tableRow"?N:g;return le===N&&l.parser.lazy[l.now().line]?i(M):le(M)}function g(M){return t.enter("tableHead"),t.enter("tableRow"),p(M)}function p(M){return M===124||(u=!0,d+=1),v(M)}function v(M){return M===null?i(M):ke(M)?d>1?(d=0,l.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),x):i(M):_e(M)?Ge(t,v,"whitespace")(M):(d+=1,u&&(u=!1,o+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),u=!0,v):(t.enter("data"),y(M)))}function y(M){return M===null||M===124||it(M)?(t.exit("data"),v(M)):(t.consume(M),M===92?S:y)}function S(M){return M===92||M===124?(t.consume(M),y):y(M)}function x(M){return l.interrupt=!1,l.parser.lazy[l.now().line]?i(M):(t.enter("tableDelimiterRow"),u=!1,_e(M)?Ge(t,C,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):C(M))}function C(M){return M===45||M===58?B(M):M===124?(u=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),D):K(M)}function D(M){return _e(M)?Ge(t,B,"whitespace")(M):B(M)}function B(M){return M===58?(d+=1,u=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),E):M===45?(d+=1,E(M)):M===null||ke(M)?G(M):K(M)}function E(M){return M===45?(t.enter("tableDelimiterFiller"),A(M)):K(M)}function A(M){return M===45?(t.consume(M),A):M===58?(u=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),I):(t.exit("tableDelimiterFiller"),I(M))}function I(M){return _e(M)?Ge(t,G,"whitespace")(M):G(M)}function G(M){return M===124?C(M):M===null||ke(M)?!u||o!==d?K(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(M)):K(M)}function K(M){return i(M)}function N(M){return t.enter("tableRow"),$(M)}function $(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),$):M===null||ke(M)?(t.exit("tableRow"),r(M)):_e(M)?Ge(t,$,"whitespace")(M):(t.enter("data"),re(M))}function re(M){return M===null||M===124||it(M)?(t.exit("data"),$(M)):(t.consume(M),M===92?ce:re)}function ce(M){return M===92||M===124?(t.consume(M),re):re(M)}}function QT(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 VT;for(;++i<t.length;){const x=t[i],C=x[1];x[0]==="enter"?C.type==="tableHead"?(h=!1,g!==0&&(Bg(S,r,g,p,v),v=void 0,g=0),p={type:"table",start:Object.assign({},C.start),end:Object.assign({},C.end)},S.add(i,0,[["enter",p,r]])):C.type==="tableRow"||C.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({},C.start),end:Object.assign({},C.end)},S.add(i,0,[["enter",v,r]])),o=C.type==="tableDelimiterRow"?2:v?3:1):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.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)):C.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])):C.type==="tableHead"?(h=!0,g=i):C.type==="tableRow"||C.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&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")&&(u[3]=i)}for(g!==0&&Bg(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=PT(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({},Fi(r.events,i[0])),t.add(i[0],0,[["exit",d,r]]));const g=Fi(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=Fi(r.events,i[2]),v=Fi(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 C=i[2]+1,D=i[3]-i[2]-1;t.add(C,D,[])}}t.add(i[3]+1,0,[["exit",y,r]])}return o!==void 0&&(d.end=Object.assign({},Fi(r.events,o)),t.add(o,0,[["exit",d,r]]),d=void 0),d}function Bg(t,r,i,l,o){const d=[],u=Fi(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 Fi(t,r){const i=t[r],l=i[0]==="enter"?"start":"end";return i[1][l]}const ZT={name:"tasklistCheck",tokenize:WT};function JT(){return{text:{91:ZT}}}function WT(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 it(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):_e(g)?t.check({tokenize:eR},r,i)(g):i(g)}}function eR(t,r,i){return Ge(t,l,"whitespace");function l(o){return o===null?i(o):r(o)}}function tR(t){return _y([TT(),_T(),FT(t),KT(),JT()])}const nR={};function rR(t){const r=this,i=t||nR,l=r.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),d=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),u=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(tR(i)),d.push(kT()),u.push(wT(i))}const Rv=/^(javascript|vbscript|data):/i;function iR(t){if(!t)return!1;const r=t.trim();return!(!r||Rv.test(r))}function aR(t){if(!t)return!1;const r=t.trim();return!r||Rv.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 lR=[[rR,{singleTilde:!1}]];function Hg({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 sR={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(Hg,{lang:o?.[1]??"",text:l}):l.includes(`
41
+ `)?c.jsx(Hg,{lang:"",text:l}):c.jsx("code",{className:t,...i,children:r})},a({href:t,children:r,...i}){if(!iR(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 aR(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})}};function oR({text:t}){try{return c.jsx("div",{className:"oc-md",children:c.jsx(FC,{remarkPlugins:lR,components:sR,children:t})})}catch{return c.jsx("div",{className:"oc-md",children:c.jsx("pre",{className:"oc-md-fallback",children:t})})}}function uR(){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 cR(){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 dR(){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 fR(){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 Ev(){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 hR(){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(cR,{}):c.jsx(uR,{})})}function Ug(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:ay(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(oR,{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 mR(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 pR(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 gR(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 Nv(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=_1(r.args,{toolName:r.toolName}),p=U1(r.createdAt,r.finishedAt),v=L1(r.toolName),y=iy(r.resultText??r.result),S=H1(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(Ev,{}),c.jsx("span",{className:"oc-tool-icon","aria-hidden":"true",children:c.jsx(hR,{})}),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:B1(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 yR(t){const{tools:r,defaultOpen:i}=t,[l,o]=k.useState(i),d=gR(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(Ev,{}),c.jsx("span",{children:d.label})]}),l?c.jsx("div",{className:"oc-process-inline-body",children:r.map(u=>c.jsx(Nv,{entry:u},u.id))}):null]})}function vR(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:C,artifactCards:D,origin:B,sessionId:E}=t;return c.jsxs("div",{ref:r,className:`oc-messages${o?" has-thread":" is-empty"}`,onScroll:l,children:[o?null:c.jsx(gy,{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((A,I)=>{const G=A.user??A.assistants[0],K=I>0?y[I-1].user??y[I-1].assistants[0]:void 0,N=!!G&&(!K||Sc(K.createdAt)!==Sc(G.createdAt)),$=A.assistants[A.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)}),A.user&&c.jsx(Ug,{message:A.user,streaming:u,activeAssistantId:h}),A.tools.length>0&&c.jsx(yR,{tools:A.tools,defaultOpen:A.live}),$&&c.jsx(Ug,{message:$,streaming:u,activeAssistantId:h})]},A.key)}),S&&c.jsx(OS,{interview:S,interviewAnswer:t.interviewAnswer,onAnswerChange:t.onInterviewAnswerChange,onAnswer:t.onAnswerInterview,onConfirmTaskKind:t.onConfirmTaskKind}),x.map(A=>c.jsx(TS,{card:A,origin:B,sessionId:E},A.cardId)),C.map(A=>c.jsx(DS,{operation:A,origin:B,onNavigateWorkspace:t.onNavigateWorkspace},A.operationId)),D.map(A=>c.jsx(jS,{artifact:A},A.artifactId)),c.jsx("div",{ref:i})]})}function Dn(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:t.toLocaleString()}function bR(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(`${Dn(i)} in`),l>0&&r.push(`${Dn(l)} out`),o>0&&r.push(`${Dn(o)} cache R`),d>0&&r.push(`${Dn(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?`${Dn(h)} tokens`:"—"}return r.join(" · ")}const xR={auto:"auto(跟随 Pi 默认等级)",off:"off · 关闭",minimal:"minimal · 极简",low:"low · 低",medium:"medium · 中",high:"high · 高",xhigh:"xhigh · 极高",max:"max · 最高"};function SR(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 kR(t,r){const i=new Set,l=[],o=d=>{i.has(d)||(i.add(d),l.push({value:d,label:xR[d]??d,...d==="auto"&&r?{effective:r}:{}}))};o("auto");for(const d of t)o(d);return l}function Bs(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 Av(t,r){return{...t,model:r.model??t.model,thinkingLevel:r.thinkingLevel??t.thinkingLevel}}function wR(t,r){const i=Av(t,r);return i.model?.provider===t.model?.provider&&i.model?.modelId===t.model?.modelId&&i.thinkingLevel===t.thinkingLevel}function CR(){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 jR(t){const r=Zi(),[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(A=>({provider:A.provider,id:A.id,...A.name?{name:A.name}:{},...A.hasCredentials!==void 0?{hasCredentials:A.hasCredentials}:{}})):t.models,C=k.useMemo(()=>SR(x,o),[x,o]),D=k.useMemo(()=>C.flatMap(A=>A.models),[C]);k.useEffect(()=>{i&&(d(""),h(0),window.setTimeout(()=>p.current?.focus(),0))},[i]),k.useEffect(()=>{if(!i)return;const A=G=>{const K=g.current;K&&G.target instanceof Node&&!K.contains(G.target)&&l(!1)},I=G=>{G.key==="Escape"&&l(!1)};return document.addEventListener("mousedown",A),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",I)}},[i]);const B=A=>{if(t.disabled)return;const I=D[A];I&&(l(!1),t.onSelect(I.provider,I.id))},E=A=>{if(A.key==="ArrowDown"){A.preventDefault(),h(I=>D.length?(I+1)%D.length:0);return}if(A.key==="ArrowUp"){A.preventDefault(),h(I=>D.length?(I-1+D.length)%D.length:0);return}if(A.key==="Enter"){A.preventDefault(),B(u);return}if(A.key==="Escape"){A.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(A=>!A),children:[c.jsx("span",{className:"oc-select-trigger-label",children:t.triggerLabel}),c.jsx(CR,{})]}),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:A=>{d(A.target.value),h(0)},onKeyDown:E}),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:()=>{Xi()},children:"重试"})]}),!y&&!S&&C.length===0&&c.jsx("div",{className:"oc-select-status",children:"当前没有可用模型(真实空态,未伪造列表)"}),C.map(A=>c.jsxs("div",{className:"oc-model-group",children:[c.jsx("div",{className:"oc-model-group-head",children:A.provider}),A.models.map(I=>{const G=Bs(I.provider,I.id),K=G===t.activeModelRef,N=D[u]===I;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(I.provider,I.id))},children:[c.jsxs("span",{className:"oc-model-option-name",children:[I.name?`${I.name} · `:"",I.id]}),K&&c.jsx("span",{className:"oc-model-option-check",children:"✓"})]},G)})]},A.provider))]})]})}function TR(){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 RR(t){const r=Zi(),[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(()=>kR(g??t.levels,h),[g,t.levels,h]);k.useEffect(()=>{i&&d(0)},[i]),k.useEffect(()=>{if(!i)return;const S=C=>{const D=u.current;D&&C.target instanceof Node&&!D.contains(C.target)&&l(!1)},x=C=>{C.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(TR,{})]}),i&&c.jsx("div",{className:"oc-select-panel oc-thinking-panel",role:"listbox","aria-label":"思考等级",onKeyDown:y,children:p.map((S,x)=>{const C=S.value===t.activeValue,D=x===o;return c.jsxs("button",{type:"button",role:"option","aria-selected":C,disabled:t.disabled,className:`oc-select-option oc-thinking-option${D?" is-highlighted":""}${C?" is-active":""}`,onMouseDown:B=>B.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,C&&c.jsx("span",{className:"oc-model-option-check",children:"✓"})]},S.value)})})]})}function ER(){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 NR(t){const{composer:r,streaming:i,hasThread:l}=t,o=Zi(),d=o.reloading,u=o.reloadError,g=o.mutationBusy||d||i,p=k.useCallback(()=>{r.setInput(""),r.setShortcutOpen(!1),Ki()},[r.setInput,r.setShortcutOpen]),v=k.useCallback(E=>{const A=r.isComposingNow()||E.nativeEvent.isComposing,I=r.recentlyComposedNow();if(E.key==="Enter"&&!E.shiftKey&&!A&&!I){if(r.shortcutOpen&&r.filteredShortcuts.length>0){if((r.filteredShortcuts[r.shortcutIndex]??r.filteredShortcuts[0])?.command==="/reload"){E.preventDefault(),p();return}}else if(r.input.trim()==="/reload"){E.preventDefault(),p();return}}t.onKeyDown(E)},[r.isComposingNow,r.recentlyComposedNow,r.shortcutOpen,r.filteredShortcuts,r.shortcutIndex,r.input,p,t.onKeyDown]),y=k.useCallback((E,A)=>{if(A==="pi-prompt"||E==="/name"||E==="/compact"){r.setInput(`${E} `),r.setShortcutOpen(!1),r.textareaRef.current?.focus();return}if(E==="/reload"){p();return}t.onRunShortcut(E)},[p,t.onRunShortcut,r]),S=k.useCallback(()=>{if(r.input.trim()==="/reload"){p();return}t.onSend(r.input)},[r.input,p,t.onSend]),x=(()=>{const E=t.processSummary;return E?E.statusKind==="error"?`查看工具调用记录,共 ${E.count} 次,其中 ${E.statusLabel}`:E.statusKind==="running"?`查看工具调用记录,共 ${E.count} 次,${E.statusLabel||"正在运行"}`:`查看工具调用记录,共 ${E.count} 次,全部已完成`:"查看工具调用记录"})(),C=(()=>{const E=t.usage.inputTokens,A=t.usage.outputTokens,I=t.usage.cacheReadTokens,G=t.usage.cacheWriteTokens,K=t.usage.cost??0,N=[];if(E>0&&N.push(c.jsxs("span",{className:"oc-usage-part is-in",title:"输入 tokens",children:["↑ ",Dn(E)]},"in")),A>0&&N.push(c.jsxs("span",{className:"oc-usage-part is-out",title:"输出 tokens",children:["↓ ",Dn(A)]},"out")),I>0&&N.push(c.jsxs("span",{className:"oc-usage-part",children:[Dn(I)," cache R"]},"cache-read")),G>0&&N.push(c.jsxs("span",{className:"oc-usage-part",children:[Dn(G)," cache W"]},"cache-write")),K>0&&N.push(c.jsx("span",{className:"oc-usage-part",children:K>=.01?`$${K.toFixed(2)}`:"<$0.01"},"cost")),N.length===0){const $=t.usage.totalTokens;$>0&&N.push(c.jsxs("span",{className:"oc-usage-part",children:[Dn($)," tokens"]},"total"))}return N})(),D=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"oc-runtime-controls-group",children:[c.jsx(jR,{models:t.models,activeModelRef:t.activeModelRef,triggerLabel:t.activeModelRef||"选择模型",disabled:g,onSelect:(E,A)=>t.onSwitchRuntime({provider:E,modelId:A})}),c.jsx(RR,{levels:t.thinkingLevels,activeValue:t.activeThinkingLevel||"auto",triggerLabel:t.activeThinkingLevel||"auto",disabled:g,onSelect:E=>t.onSwitchRuntime({thinkingLevel:E})}),c.jsxs("span",{className:"oc-usage",title:bR(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,C]}),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]})]}),B=(()=>{const E=new Map;for(const A of r.filteredShortcuts){const I=A.source??"operator",G=E.get(I)??[];G.push(A),E.set(I,G)}return E})();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(E=>c.jsx("button",{type:"button",role:"option",onMouseDown:A=>A.preventDefault(),onClick:()=>r.insertFileReference(E),children:c.jsxs("code",{children:["@",E]})},E))}),r.pendingImages.length>0&&c.jsx("div",{className:"oc-attachment-list",children:r.pendingImages.map(E=>c.jsxs("span",{children:[E.name,c.jsx("button",{type:"button","aria-label":`移除 ${E.name}`,onClick:()=>r.removeImage(E),children:"×"})]},E.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(ER,{}),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:E=>{r.addImagesFromFiles(Array.from(E.target.files??[]).slice(0,4)),E.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",role:"listbox","aria-label":"命令","aria-busy":r.dynamicCommandsLoading||void 0,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]}),[...B.entries()].map(([E,A])=>c.jsxs("div",{className:"oc-shortcut-group",children:[c.jsxs("small",{children:[SS[E]??E," ","· ",A.length]}),A.map(I=>{const G=r.filteredShortcuts.indexOf(I);return c.jsxs("button",{type:"button",role:"option","aria-selected":G===r.shortcutIndex,className:G===r.shortcutIndex?"is-active":"",title:I.command,onMouseDown:K=>K.preventDefault(),onClick:K=>{K.currentTarget.scrollIntoView({block:"nearest"}),y(I.command,I.action)},children:[c.jsx("code",{children:I.command}),c.jsxs("span",{children:[c.jsx("strong",{children:I.label}),c.jsx("small",{children:I.description})]})]},`${I.source}:${I.command}`)})]},E))]}),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:E=>r.handleInputChange(E.target.value),onKeyDown:v,onCompositionStart:r.onCompositionStart,onCompositionEnd:r.onCompositionEnd,disabled:i,"aria-expanded":r.shortcutOpen,"aria-controls":(r.shortcutOpen,void 0)}),i?c.jsx("button",{type:"button",className:"oc-stop",title:"停止生成","aria-label":"停止生成",onClick:t.onStop,children:c.jsx(fR,{})}):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(dR,{})})]}),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:()=>{Ki()},children:"重试"})]}),c.jsx("div",{className:"oc-runtime-controls",children:D})]})})}function AR(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:ay(d.createdAt)}),c.jsx("div",{className:"oc-process-body",children:c.jsx(Nv,{entry:d})})]},d.id))})]})}const qg=[{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 Rs(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(IR,{item:i},`${i.name??i.path??l}:${l}`))})]})}function IR(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 DR=k.forwardRef(function({open:r,onToggle:i,onClose:l,context:o,panelOnly:d=!1,triggerOnly:u=!1,triggerRef:h},g){const p=Zi(),v=p.reloading,y=p.reloadError,[S,x]=k.useState("overview"),C=k.useRef(null);ud({open:r&&!u,containerRef:C,triggerRef:h,onEscape:l}),k.useEffect(()=>{r||x("overview")},[r]);const D=Array.isArray(o.resources.activeTools)?o.resources.activeTools:[],B=typeof o.resources.activeToolCount=="number"?o.resources.activeToolCount:D.length,E=o.systemPrompt.text??o.systemPrompt.summary??"",A=o.systemPrompt.charCount??E.length,I=o.suffix.present?o.suffix.text??o.suffix.summary??"":"",G=o.model?Bs(o.model.provider,o.model.modelId):"",K=o.resources,N=String(o.resources.mode??"closed"),$=N.includes("open")?"open":"closed",re={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:qg.find(le=>le.id===Y)?.label??Y,count:re[Y]??0})),M=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 M;const V=r?c.jsxs("div",{ref:C,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:qg.map(Y=>{const le=re[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 le=="number"?c.jsx("span",{className:"oc-runtime-context-nav-count",children:le}):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:[A.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:B})]}),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),"…"]})]}),E?c.jsx(td,{text:E}):null]}),c.jsx("pre",{className:"oc-runtime-context-text",children:E||"(空)"})]}),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()} 字`:"未注入"})]}),I?c.jsx(td,{text:I}):null]}),o.suffix.present?c.jsx("pre",{className:"oc-runtime-context-text",children:I||"已注入"}):c.jsx("p",{className:"oc-runtime-context-empty",children:"本会话无额外 suffix"})]})]}):null,S==="files"?c.jsx(Rs,{title:"Context files",items:K.contextFiles?.map(Y=>({name:Y.path,description:`${Y.characters.toLocaleString()} 字符`})),emptyText:"该 session 未加载任何上下文文件"}):null,S==="skills"?c.jsx(Rs,{title:"Skills",items:K.skills,emptyText:"该 session 未加载任何 Skills"}):null,S==="extensions"?c.jsx(Rs,{title:"Extensions",items:K.extensions,emptyText:"该 session 未加载任何 Extensions"}):null,S==="packages"?c.jsx(Rs,{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:[B," 项"]})]}),D.length===0?c.jsx("p",{className:"oc-runtime-context-empty",children:"无激活工具"}):c.jsx("ul",{className:"oc-runtime-context-tools",children:D.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,le)=>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]},le))}):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:()=>{Ki()},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:()=>{Ki()},children:"重试"})]})]})]}):null;return d?V:c.jsxs("div",{className:"oc-runtime-context-menu",children:[M,V]})});function OR(){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),C=k.useRef(!1),D=k.useRef(0),B=k.useRef(null),E=k.useRef(!1),A=k.useRef(!1),I=k.useRef(null),G=k.useRef(new Set),K=k.useRef(new Set),N=k.useRef(new Set),$=k.useRef(!1),re=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:C,submitGenerationRef:D,pendingSubmissionRef:B,stopInFlightRef:E,stopRequestedRef:A,stoppingTurnIdRef:I,abortPostedTurnIdsRef:G,releasedClientRequestIdsRef:K,usageResponseKeysRef:N,isComposingRef:$,compositionEndedAtRef:re}),[t,r,i,l,o,d,u,h,g,p,v,y,S,x,C,D,B,E,A,I,G,K,N,$,re])}const MR=["operation","contract","dag","report","html"];function zR(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"||!MR.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 _R(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 LR(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 BR(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 HR(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 UR(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 qR(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(C,D,B,E)=>{if(E?.generation!==void 0&&r.sessionGenerationRef.current!==E.generation)return;const A=E?.replay===!0;if(C==="stream_ready")return;if(C==="reconcile"){const N=typeof D.reason=="string"?D.reason:"cursor_expired";i?.({reason:N,...typeof D.minSeq=="number"?{minSeq:D.minSeq}:{},...typeof D.epoch=="string"?{epoch:D.epoch}:{},...typeof D.latestTurnId=="string"?{latestTurnId:D.latestTurnId}:{},...typeof D.latestEventId=="string"?{latestEventId:D.latestEventId}:D.latestEventId===null?{latestEventId:null}:{}});return}const I=D.data&&typeof D.data=="object"?D.data:D,G=typeof D.turnId=="string"?D.turnId:void 0;if(G&&(C==="agent_start"||C==="message_update")&&r.settledTurnIdsRef.current.has(G))return;let K=B;if(G){const N=r.turnAssistantIdsRef.current.get(G);N?K=N:r.turnAssistantIdsRef.current.set(G,B)}if(C==="interview-turn"){o(N=>({...N??{},interviewSessionId:typeof I.interviewSessionId=="string"?I.interviewSessionId:N?.interviewSessionId,taskId:typeof I.taskId=="string"?I.taskId:N?.taskId,state:typeof I.state=="string"?I.state:N?.state,question:I.question&&typeof I.question=="object"?I.question:void 0}));return}if(C==="draft"){o(N=>({...N??{},taskId:typeof I.taskId=="string"?I.taskId:N?.taskId,draft:I.draft&&typeof I.draft=="object"?I.draft:N?.draft,draftSha256:typeof I.draftSha256=="string"?I.draftSha256:N?.draftSha256,taskKindRecommendation:typeof I.taskKindRecommendation=="string"?I.taskKindRecommendation:N?.taskKindRecommendation}));return}if(C==="assessment"){o(N=>({...N??{},assessment:I}));return}if(C==="taskKind-confirmed"){o(N=>({...N??{},confirmedTaskKind:typeof I.taskKind=="string"?I.taskKind:N?.confirmedTaskKind,taskKindRecommendation:void 0}));return}if(C==="human-gate-card"){const N=LR(I);N&&d($=>BR($,N));return}if(C==="artifact-ref"){const N=zR(I);N&&u($=>_R($,N));return}if(C==="agent_start"){if(A&&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(C==="agent_settled"||C==="agent_end"){if(G&&r.settledTurnIdsRef.current.add(G),C==="agent_end")return;G===r.activeTurnIdRef.current&&(r.activeTurnIdRef.current=null),r.streamingRef.current=!1,h(!1),g(null),C==="agent_settled"&&!A&&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(C==="operation-ref"||C==="operation-status"){const N=UR(I);N&&v($=>HR($,N));return}if(C==="usage"){if(A)return;const N=I,$=typeof N.responseKey=="string"&&N.responseKey?N.responseKey:void 0;if($&&r.usageResponseKeysRef.current.has($))return;$&&r.usageResponseKeysRef.current.add($),y(re=>{const ce=N.inputTokens??0,M=N.outputTokens??0,V=N.cacheReadTokens??0,Y=N.cacheWriteTokens??0,le=N.totalTokens??ce+M+V+Y;return{inputTokens:re.inputTokens+ce,outputTokens:re.outputTokens+M,cacheReadTokens:re.cacheReadTokens+V,cacheWriteTokens:re.cacheWriteTokens+Y,totalTokens:re.totalTokens+le,cost:N.cost===void 0?re.cost:(re.cost??0)+N.cost}});return}if(C==="message_update"||C==="message_end"){if(A)return;const N=typeof I.text=="string"?I.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(C==="tool_call"){const N=typeof I.toolCallId=="string"?I.toolCallId:Vi("t"),$=typeof I.toolName=="string"?I.toolName:"tool",re=typeof I.argsPreview=="string"?I.argsPreview:"{}",ce=Date.now();x(M=>M.some(V=>V.id===N)?M.map(V=>V.id===N?{...V,args:re,status:"running",turnId:G??V.turnId,assistantMessageId:K}:V):[...M,{id:N,toolName:$,args:re,status:"running",createdAt:ce,turnId:G,assistantMessageId:K}])}else if(C==="tool_result"){const N=typeof I.toolCallId=="string"?I.toolCallId:Vi("r"),$=typeof I.toolName=="string"?I.toolName:"tool",re=I.isError===!0,ce=typeof I.resultPreview=="string"?I.resultPreview:"{}",M=Date.now();x(V=>V.find(le=>le.id===N)?V.map(le=>le.id===N?{...le,result:ce,resultText:ce,status:re?"error":"ok",finishedAt:M,turnId:G??le.turnId,assistantMessageId:le.assistantMessageId??K}:le):[...V,{id:N,toolName:$,result:ce,resultText:ce,status:re?"error":"ok",createdAt:M,finishedAt:M,turnId:G,assistantMessageId:K}])}else C==="error"&&l(typeof I.message=="string"?I.message:"chat error")}}const Hc={inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,totalTokens:0};function GR(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([]),[C,D]=k.useState(50),[B,E]=k.useState(0),[A,I]=k.useState([]),[G,K]=k.useState(null),[N,$]=k.useState(null),[re,ce]=k.useState(!1),[M,V]=k.useState(Hc),[Y,le]=k.useState(!1),[X,L]=k.useState(null),[O]=k.useState(!1),H=k.useMemo(()=>qR({refs:i,onReconcile:d,setError:o,setInterview:K,setHumanGateCards:I,setArtifactCards:x,setStreaming:le,setStreamingAssistantId:L,setUnread:E,setOperationCards:y,setUsage:V,setMessages:h,setToolCalls:p}),[i,d,o]),U=k.useCallback((W,ie,he)=>{if(he?.targetSessionId&&i.sessionRef.current?.sessionId!==he.targetSessionId||he?.generation!==void 0&&i.sessionGenerationRef.current!==he.generation)return null;const pe=W.split(`
42
+ `);let ge="message",Ie="",Ne=null;for(const at of pe)at.startsWith("event: ")?ge=at.slice(7).trim():at.startsWith("data: ")?Ie+=at.slice(6):at.startsWith("id: ")&&(Ne=at.slice(4).trim());if(!Ie)return Ne;let $e;try{$e=JSON.parse(Ie)}catch{return Ne}const Pe=Ne??(typeof $e.eventId=="string"?$e.eventId:null);if(Pe){if(i.seenEventIdsRef.current.has(Pe))return Pe;i.seenEventIdsRef.current.add(Pe)}return H(ge,$e,ie,he),Ne??Pe},[H,i]),Q=k.useCallback(async(W,ie)=>{const he=ie?.background===!0;he||ce(!0);try{const pe=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(W)}/context`,{credentials:"include"});if(!pe.ok)return;const ge=await pe.json();ge.context&&i.sessionRef.current?.sessionId===W&&$(Ie=>q1(Ie,ge.context)?Ie:ge.context)}finally{he||ce(!1)}},[r,i]);k.useEffect(()=>{l&&Q(l)},[l,Q]),k.useEffect(()=>{if(!l)return;const W=window.setTimeout(()=>{Q(l,{background:!0})},350);return()=>window.clearTimeout(W)},[l,v,A,G,Q]);const T=k.useMemo(()=>u.filter(W=>W.role!=="system"||O).slice(-C),[u,O,C]);k.useEffect(()=>{const W=()=>{document.hidden||E(0)};return document.addEventListener("visibilitychange",W),()=>document.removeEventListener("visibilitychange",W)},[]);const R=k.useMemo(()=>{if(g.length===0)return null;const W=g.filter(Ie=>Ie.status==="running"),ie=g.filter(Ie=>Ie.status==="error"),he=W[W.length-1];let pe="完成",ge="ok";return ie.length>0?(pe=`${ie.length} 次出错`,ge="error"):W.length>0?(pe=he?`${he.toolName} 运行中`:"运行中",ge="running"):pe="",{count:g.length,statusLabel:pe,statusKind:ge}},[g]),_=k.useMemo(()=>pR({messages:T,toolCalls:g,streaming:Y,activeAssistantId:X}),[T,g,Y,X]),w=k.useCallback(()=>{h([]),p([]),y([]),I([]),x([]),K(null),$(null),V(Hc),le(!1),L(null),E(0),D(50),i.usageResponseKeysRef.current=new Set},[i]),te=k.useCallback(W=>{h(W.messages),p(W.toolCalls),y([]),I([]),x([]),$(null),K(null),V(Hc),i.usageResponseKeysRef.current=new Set,le(W.streaming),L(null),E(0),D(50)},[i]),fe=k.useCallback(async W=>{try{const ie=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(W)}`,{credentials:"include"});if(!ie.ok)return!1;const he=await ie.json();if(!he.session||i.sessionRef.current?.sessionId!==W)return!1;const pe=he.session.activeTurnId??null;return i.activeTurnIdRef.current=pe,i.streamingRef.current=!!pe,i.lastEventIdRef.current=he.lastEventId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,h((he.session.messages??[]).filter(ge=>ge.role==="user"||ge.role==="assistant").map(ge=>({id:ge.id,role:ge.role,text:ge.text,createdAt:Date.parse(ge.at)||Date.now()}))),L(null),!0}catch{return!1}},[r,i,h,L]);return{messages:u,setMessages:h,toolCalls:g,setToolCalls:p,operationCards:v,artifactCards:S,historyLimit:C,setHistoryLimit:D,unread:B,humanGateCards:A,interview:G,setInterview:K,taskContext:N,contextLoading:re,usage:M,streaming:Y,setStreaming:le,streamingAssistantId:X,setStreamingAssistantId:L,visibleMessages:T,turnGroups:_,processSummary:R,applyChatSseEvent:H,applySseBlock:U,loadTaskContext:Q,resetForNewSession:w,applyActivatedSession:te,recoverSession:fe}}class $R{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 C=y.split(`
43
+
44
+ `);y=C.pop()??"";for(const D of C){const B=D.split(`
45
+ `).find(A=>A.startsWith("id: "))?.slice(4);if(B&&(l=B),!B||o.has(B)||!D.includes("event: session_title"))continue;const E=D.split(`
46
+ `).find(A=>A.startsWith("data: "))?.slice(6);if(E)try{const A=JSON.parse(E),I=A.data?.title?.trim();if(!I)continue;if(o.add(B),!this.options.hasSession(r)||(this.options.onTitle(r,{title:I,automatic:!!A.data?.automatic}),A.data?.automatic))return}catch{}}}}catch{if(i.signal.aborted)return}i.signal.aborted||await FR(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 FR(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 VR(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":Kt()},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,Ds);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 YR(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:C}=d,{setPreviews:D,setActivePreviewPath:B}=u,[E,A]=k.useState([]),I=k.useRef([]);I.current=E;const G=k.useRef(null),[K,N]=k.useState(!1),$=k.useRef(!1),re=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(""),C([]),D([]),B(null),g(!1),p(!0)},[i,y,x,C,D,B,g,p]),M=k.useCallback(async()=>{try{const U=await fetch(`${r}/api/operator/v1/chat/sessions`,{credentials:"include"});if(!U.ok)return;const Q=(await U.json()).sessions??[],T=Q.slice(0,Ds),R=Q.slice(Ds);if(A(T),R.length===0)return;await Promise.all(R.map(w=>fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(w.sessionId)}`,{method:"DELETE",credentials:"include",headers:{"x-loop-console-confirmation":Kt()}}).catch(()=>{})));const _=i.sessionRef.current?.sessionId;_&&R.some(w=>w.sessionId===_)&&(re.current+=1,i.sessionRef.current=null,ce(),l(null),window.localStorage.removeItem(wn))}catch{}},[r,i,ce,l]),V=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":Kt()}})).ok){h("删除会话失败");return}G.current?.cancel(U),i.sessionRef.current?.sessionId===U&&(re.current+=1,i.sessionRef.current=null,ce(),l(null),window.localStorage.removeItem(wn)),await M()}catch(Q){h(Q instanceof Error?Q.message:String(Q))}},[r,i,l,ce,M,h]),Y=k.useCallback(async U=>{const Q=++re.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(Q!==re.current)return;const _={sessionId:R.session.sessionId,...nd(R.session)};ce(),i.sessionRef.current=_,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(_),i.assistantIdRef.current=null,i.abortRef.current=i.sessionAbortControllersRef.current.get(U)??null,C([]),D([]),x(R.session.composerDraft??"");const w=mR(R.session.messages??[]);v({messages:w.messages,toolCalls:w.toolCalls,streaming:!!R.session.activeTurnId}),window.localStorage.setItem(wn,U),B(null)}catch(T){if(Q!==re.current)return;h(T instanceof Error?T.message:String(T))}},[r,i,l,C,D,x,v,ce,B,h]);k.useEffect(()=>{M()},[M]),G.current||(G.current=new $R({origin:r,hasSession:U=>I.current.some(Q=>Q.sessionId===U),onTitle:(U,Q)=>{A(T=>T.map(R=>R.sessionId!==U||Q.automatic&&R.title?R:Q.automatic?{...R,title:Q.title}:{...R,displayTitle:Q.title}))},refresh:M}));const le=k.useCallback(U=>G.current?.startIfEligible(U),[]);k.useEffect(()=>{G.current?.reconcile(E.filter(U=>U.state!=="archived"&&!U.title).map(U=>U.sessionId))},[E]),k.useEffect(()=>()=>G.current?.dispose(),[]),k.useEffect(()=>{let U=!1;const Q=window.localStorage.getItem(wn);if(!Q)return;const T=++re.current;return(async()=>{try{const R=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(Q)}`,{credentials:"include"});if(!R.ok){window.localStorage.removeItem(wn);return}const _=await R.json();if(U||T!==re.current||!_.session)return;const w={sessionId:_.session.sessionId,...nd(_.session)};i.sessionGenerationRef.current+=1,i.sessionRef.current=w,i.activeTurnIdRef.current=_.session.activeTurnId??null,i.seenEventIdsRef.current=new Set,i.turnAssistantIdsRef.current=new Map,i.settledTurnIdsRef.current=new Set,i.lastEventIdRef.current=null,l(w),x(_.session.composerDraft??""),S((_.session.messages??[]).filter(te=>te.role==="user"||te.role==="assistant").map(te=>({id:te.id,role:te.role,text:te.text,createdAt:Date.parse(te.at)||Date.now()})))}catch{}})(),()=>{U=!0}},[r,i,l,x,S]);const X=k.useCallback(U=>VR({origin:r,sessionListRef:I,setSessionList:A,titleWatcher:G.current,refreshSessionList:M,options:U,setCreatingSession:N,creatingRef:$}),[r,M]),L=k.useCallback(async U=>{if($.current)return null;const Q=++re.current;h(null);try{const T=await X(U);return Q!==re.current?null:(ce(),i.sessionRef.current=T,window.localStorage.setItem(wn,T.sessionId),l(T),T)}catch(T){if(Q!==re.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]),O=k.useCallback(async()=>{const U=i.sessionRef.current;if(!(!U||i.streamingRef.current))try{const Q=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(U.sessionId)}/compact`,{method:"POST",credentials:"include",headers:{"x-loop-console-confirmation":Kt()}}),T=await Q.json().catch(()=>({}));if(!Q.ok){h(T.error?.message??"上下文压缩失败");return}h(null)}catch(Q){h(Q instanceof Error?Q.message:"上下文压缩失败")}},[r,i,h]);return{sessionList:E,creatingSession:K,activateSession:Y,refreshSessionList:M,deleteSession:V,createSession:L,updateSession:async(U,Q)=>{if(!(await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(U)}`,{method:"PATCH",credentials:"include",headers:{"content-type":"application/json","x-loop-console-confirmation":Kt()},body:JSON.stringify(Q)})).ok){h("会话更新失败");return}await M(),Q.state==="archived"&&G.current?.cancel(U),Q.state==="archived"&&i.sessionRef.current?.sessionId===U&&(re.current+=1,i.sessionRef.current=null,ce(),l(null),window.localStorage.removeItem(wn))},watchSessionTitle:le,compactSession:O}}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 PR(t){let r;const i=new Promise(l=>{r=l});return{...t,outcomePromise:i,resolveOutcome:r}}function Gg(t="network error while creating turn"){return{kind:"ambiguous",message:t}}function KR(t="无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"){return{kind:"ambiguous",message:t}}function $g(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 XR(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 QR(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 ei(o)?{action:"release-terminal",turnId:i.turnId,state:String(o)}:{action:"bind-active",turnId:i.turnId};if(l?.clientRequestId===r&&l.turnId){if(ei(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!Hs(t.state)&&!(!!i?.turnId&&i?.clientRequestId!==r)?{action:"release-not-accepted"}:{action:"hold"}}function Hs(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 ei(t){return t==="settled"||t==="aborted"||t==="failed"}function Us(t){return t.pending.sessionId===t.sessionId&&t.pending.sessionGeneration===t.sessionGeneration&&t.pending.submitGeneration===t.submitGeneration}function ZR(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns`}function Fg(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/state`}function JR(t,r){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/events`}function WR(t,r,i){return`${t}/api/operator/v1/chat/sessions/${encodeURIComponent(r)}/turns/${encodeURIComponent(i)}/abort`}function ea(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 Iv(t){t.stopRequested=!0}function qs(t){t.stopRequested=!1}function eE(t,r){return!(!r||t.abortPostedTurnIds.has(r))}function tE(t,r){r&&t.abortPostedTurnIds.add(r)}function Gs(t,r){return!t.stopRequested||!eE(t,r)?null:(tE(t,r),t.stoppingTurnId=r,t.activeTurnId=r,r)}function Vg(t,r){const i=t.pendingSubmission;return i&&i.clientRequestId!==r.clientRequestId?!1:(r.turnId&&t.settledTurnIds.add(r.turnId),ea(t,r.clientRequestId),qs(t),r.markIdle!==!1&&(t.streaming=!1,t.activeTurnId=null,t.assistantId=null,t.stoppingTurnId=null),!0)}function nE(t,r){return Us({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 rE(t,r){r.pending.resolveOutcome({kind:"adopt-active",activeTurn:{turnId:r.activeTurnId},message:r.message}),ea(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 iE(t,r){if(r.pending.resolveOutcome({kind:"rejected",message:r.message}),ea(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 aE(t,r,i){const l=Us({pending:i.pending,sessionId:t.sessionId,sessionGeneration:t.sessionGeneration,submitGeneration:t.submitGeneration});if(r.kind==="accepted"){if(nE(t,{turnId:r.turnId,assistantId:i.assistantId,pending:i.pending,sessionId:i.sessionId,ui:i.acceptedUi})){const d=Gs(t,r.turnId);d&&i.onAutoAbort?.(d)}return}if(r.kind==="adopt-active"){const o=l?Gs(t,r.activeTurn.turnId):null;rE(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"){iE(t,{message:r.message,assistantId:i.assistantId,text:i.text,images:i.images,pending:i.pending,current:l,ui:i.rejectedUi}),qs(t);return}if(r.kind==="stale"){i.pending.resolveOutcome(r),ea(t,i.pending.clientRequestId),qs(t);return}i.pending.resolveOutcome(r)}function lE(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=Gs(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),ea(t,o.clientRequestId),qs(t),Hs(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 sE="正在停止…",oE="正在停止…",uE="停止请求未完成,正在与服务端对账…",cE="停止请求失败,正在与服务端对账…";function Yg(t){t.showNotice(sE)}function Pg(t){if(t.networkError)return{action:"keep-busy-notice",message:cE};const r=t.body.turn?.state;return t.body.accepted===!0&&ei(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:uE}}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(oE);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 Kg(t,r){Iv(t);const i=t.activeTurnId??t.pendingSubmission?.acceptedTurnId??null;if(i){const l=Gs(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 Jn(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 An(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 dE(t){return t.split(`
47
+ `).find(r=>r.startsWith("event: "))?.slice(7).trim()??"message"}function fE(){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 hE(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:C,streaming:D}=o,{setInput:B,setPendingImages:E}=d,A=k.useCallback(L=>{g&&g({id:Date.now(),message:L})},[g]),I=k.useCallback(L=>{const O=Jn(i);ea(O,L),An(i,O)},[i]),G=k.useCallback((L,O,H)=>{i.sessionRef.current?.sessionId!==L||i.sessionGenerationRef.current!==O||(i.streamingRef.current=!1,i.activeTurnIdRef.current=null,i.assistantIdRef.current=null,i.stoppingTurnIdRef.current=null,x(!1),C(null),qc(S,H))},[i,x,C,S]),K=k.useCallback(async(L,O,H)=>{for(;!H.aborted;){const U=i.eventsStreamStateRef.current;if(!U||U.sessionId!==L||U.generation!==O)return;U.ready=!1;try{const Q={Accept:"text/event-stream"},T=i.lastEventIdRef.current;T&&(Q["Last-Event-ID"]=T);const R=await fetch(JR(r,L),{headers:Q,credentials:"include",signal:H});if(!R.ok||!R.body){if(R.status===404)return;await xc(2e3,H);continue}const _=R.body.getReader(),w=new TextDecoder;let te="",fe=!0;const W=Vi("a");for(;;){const{done:he,value:pe}=await _.read();if(he)break;te+=w.decode(pe,{stream:!0});const ge=te.split(`
48
+
49
+ `);te=ge.pop()??"";for(const Ie of ge){if(dE(Ie)==="stream_ready"){const Pe=i.eventsStreamStateRef.current;Pe?.sessionId===L&&Pe.generation===O&&(Pe.ready=!0),fe=!1;continue}const Ne=i.assistantIdRef.current??W,$e=y(Ie,Ne,{replay:fe,targetSessionId:L,generation:O});$e&&(i.lastEventIdRef.current=$e)}}const ie=i.eventsStreamStateRef.current;ie?.sessionId===L&&ie.generation===O&&(ie.ready=!1),await xc(1e3,H)}catch{if(H.aborted)return;await xc(2e3,H)}}},[r,i,y]),N=k.useCallback((L,O)=>{const H=i.eventsStreamStateRef.current;if(H?.sessionId===L&&H.generation===O&&i.reconnectAbortRef.current)return;i.reconnectAbortRef.current?.abort();const U=new AbortController;i.reconnectAbortRef.current=U,i.eventsStreamStateRef.current={sessionId:L,generation:O,ready:!1},K(L,O,U.signal)},[i,K]),$=k.useCallback(async(L,O)=>{N(L,O);const H=Date.now()+5e3;for(;Date.now()<H;){const U=i.eventsStreamStateRef.current;if(U?.sessionId===L&&U.generation===O&&U.ready)return;if(i.sessionRef.current?.sessionId!==L||i.sessionGenerationRef.current!==O)throw new Error("会话已切换");await fE()}throw new Error("事件连接未就绪,请检查 Console 连接后重试")},[i,N]),re=k.useCallback(async L=>{try{const O=await fetch(Fg(r,L),{credentials:"include"}),H=await O.json().catch(()=>({}));return O.ok?H.state??null:null}catch{return null}},[r]),ce=k.useCallback(async L=>{try{const O=await fetch(ZR(r,L.sessionId),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Kt()},credentials:"include",body:JSON.stringify({clientRequestId:L.clientRequestId,text:L.text.trim()||"请查看附件图片。",images:L.images.map(({type:U,mimeType:Q,data:T})=>({type:U,mimeType:Q,data:T}))})}),H=await O.json().catch(()=>({}));return{httpOk:O.ok,status:O.status,body:H}}catch{return{httpOk:!1,status:0,body:{},networkError:!0}}},[r]),M=k.useCallback(()=>({showNotice:A,setError:L=>u(L)}),[A,u]),V=k.useCallback(async(L,O,H)=>{i.stoppingTurnIdRef.current=H,i.streamingRef.current=!0,x(!0);try{const U=await fetch(WR(r,L,H),{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Kt()},credentials:"include",body:"{}"}),Q=await U.json().catch(()=>({}));if(i.sessionRef.current?.sessionId!==L||i.sessionGenerationRef.current!==O||i.stoppingTurnIdRef.current!==H)return;const T=Pg({httpOk:U.ok,turnId:H,body:Q}),R=Jn(i);if(R.stoppingTurnId=H,T.action==="owner-lost-reconcile"){const _=await re(L),w=i.sessionRef.current?.sessionId===L&&i.sessionGenerationRef.current===O;Uc(R,T,M(),{sessionStillCurrent:w,runtimeBusy:Hs(_??void 0),markIdle:()=>G(L,O,i.assistantIdRef.current)}),An(i,R);return}Uc(R,T,M(),{sessionStillCurrent:!0,markIdle:()=>G(L,O,i.assistantIdRef.current)}),An(i,R)}catch{const U=Jn(i);Uc(U,Pg({httpOk:!1,turnId:H,body:{},networkError:!0}),M()),An(i,U)}},[r,i,x,G,re,M]),Y=k.useCallback((L,O)=>{const H=Jn(i);H.sessionId=i.sessionRef.current?.sessionId??null,H.sessionGeneration=i.sessionGenerationRef.current,H.submitGeneration=i.submitGenerationRef.current;const U=Q=>{E(Q)};aE(H,L,{assistantId:O.assistantId,text:O.text,images:O.images,pending:O.pending,sessionId:O.sessionId,notice:M(),acceptedUi:{setStreaming:x,setStreamingAssistantId:C,setPendingImages:U,watchSessionTitle:v},adoptUi:{clearEmptyAssistant:Q=>qc(S,Q),setInput:B,setPendingImages:U,setStreaming:x,setStreamingAssistantId:C},rejectedUi:{setError:u,setStreaming:x,setStreamingAssistantId:C,clearEmptyAssistant:Q=>qc(S,Q),setInput:B,setPendingImages:U,formatError:Yi},onAutoAbort:Q=>{V(O.sessionId,O.generation,Q)}}),An(i,H)},[i,M,x,C,E,v,S,B,u,V]),le=k.useCallback(async(L,O)=>{const H=i.sessionRef.current,U=i.sessionGenerationRef.current;if(!H||!L.trim()&&O.length===0||i.streamingRef.current||i.submitInFlightRef.current||i.pendingSubmissionRef.current)return;i.submitInFlightRef.current=!0;const Q=++i.submitGenerationRef.current,T=Vi("chat-submit"),R=Vi("u"),_=Vi("a"),w=L.trim(),te=O.slice(),fe=PR({clientRequestId:T,submitGeneration:Q,sessionId:H.sessionId,sessionGeneration:U,text:w,images:te,assistantId:_,userMessageId:R});i.pendingSubmissionRef.current=fe;try{await $(H.sessionId,U)}catch(ge){i.sessionRef.current?.sessionId===H.sessionId&&i.sessionGenerationRef.current===U&&u(Yi(ge instanceof Error?ge.message:String(ge))),I(T);return}if(i.sessionRef.current?.sessionId!==H.sessionId||i.sessionGenerationRef.current!==U){I(T);return}const W={id:R,role:"user",text:w,createdAt:Date.now()};S(ge=>[...ge,W,{id:_,role:"assistant",text:"",createdAt:Date.now()}]),B(""),h(!0),u(null),i.streamingRef.current=!0,i.assistantIdRef.current=_,x(!0),C(_);const ie={sessionId:H.sessionId,generation:U,submitGeneration:Q,assistantId:_,text:w,images:te,pending:fe},he=await ce({sessionId:H.sessionId,clientRequestId:T,text:w,images:te});if(!Us({pending:fe,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){fe.resolveOutcome({kind:"stale"}),I(T);return}let pe=he.networkError?Gg():$g({httpOk:he.httpOk,status:he.status,body:he.body,clientRequestId:T});if(pe.kind==="ambiguous"){const ge=await re(H.sessionId),Ie=ge?XR({clientRequestId:T,state:ge}):null;if(Ie)pe=Ie;else{const Ne=await ce({sessionId:H.sessionId,clientRequestId:T,text:w,images:te});if(!Us({pending:fe,sessionId:i.sessionRef.current?.sessionId,sessionGeneration:i.sessionGenerationRef.current,submitGeneration:i.submitGenerationRef.current})){fe.resolveOutcome({kind:"stale"}),I(T);return}if(pe=Ne.networkError?Gg("无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)"):$g({httpOk:Ne.httpOk,status:Ne.status,body:Ne.body,clientRequestId:T}),pe.kind==="ambiguous"){const $e=pe.message||"无法确认 Turn 是否已创建,正在与服务端对账(不会重复提交新的请求 ID)";pe=KR($e),A($e)}}}Y(pe,ie)},[r,i,$,ce,re,Y,I,A,S,B,h,u,x,C]),X=k.useCallback(async()=>{const L=i.sessionRef.current?.sessionId,O=i.sessionGenerationRef.current;if(!L)return;const H=Jn(i),U=Kg(H,{postAbort:()=>{},notice:M()});if(An(i,H),U.abortedTurnId){if(i.stopInFlightRef.current)return;i.stopInFlightRef.current=!0;try{await V(L,O,U.abortedTurnId)}finally{i.stopInFlightRef.current=!1}return}const Q=i.pendingSubmissionRef.current;if(Q&&!i.stopInFlightRef.current){i.stopInFlightRef.current=!0;try{const T=await Q.outcomePromise;if(i.sessionRef.current?.sessionId!==L||i.sessionGenerationRef.current!==O)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 _=Jn(i);Iv(_);const w=Kg(_,{postAbort:()=>{},notice:M()});An(i,_),w.abortedTurnId&&await V(L,O,w.abortedTurnId)}finally{i.stopInFlightRef.current=!1}}},[i,M,V]);return k.useEffect(()=>{const L=!!i.pendingSubmissionRef.current||i.submitInFlightRef.current||i.stopRequestedRef.current||!!i.activeTurnIdRef.current;if(!l||!D&&!L)return;const O=l.sessionId,H=i.sessionGenerationRef.current;let U=!1;const Q=async()=>{try{const w=await fetch(Fg(r,O),{credentials:"include"}),te=await w.json().catch(()=>({}));if(U||!w.ok||i.sessionRef.current?.sessionId!==O||i.sessionGenerationRef.current!==H)return;const fe=te.state,W=i.pendingSubmissionRef.current;if(W){const Ne=QR({clientRequestId:W.clientRequestId,state:fe}),$e=Jn(i),Pe=lE($e,Ne,fe,{markIdle:()=>G(O,H,i.assistantIdRef.current),onAutoAbort:at=>{V(O,H,at)}});if(An(i,$e),Pe==="bound"){x(!0);return}if(Pe==="released"||!W.acceptedTurnId&&!$e.pendingSubmission?.acceptedTurnId)return}const ie=fe?.activeTurn?.turnId??fe?.activeTurnId??null;i.activeTurnIdRef.current=ie;const he=Hs(fe),pe=i.pendingSubmissionRef.current;if(pe){const Ne=fe?.latestTurn?.clientRequestId===pe.clientRequestId&&ei(fe?.latestTurn?.state),$e=fe?.activeTurn?.clientRequestId===pe.clientRequestId&&ei(fe?.activeTurn?.state);if(Ne||$e){const Pe=$e?fe?.activeTurn?.turnId??null:fe?.latestTurn?.turnId??pe.acceptedTurnId??null,at=Jn(i);Vg(at,{clientRequestId:pe.clientRequestId,turnId:Pe,markIdle:!he}),An(i,at),he||G(O,H,i.assistantIdRef.current);return}}if(he)return;const ge=i.assistantIdRef.current;if(ie&&!(ei(fe?.activeTurn?.state)||ei(fe?.activeTurnState)))return;ie&&i.settledTurnIdsRef.current.add(ie);const Ie=pe?.clientRequestId;if(Ie){const Ne=Jn(i);Vg(Ne,{clientRequestId:Ie,turnId:ie,markIdle:!0}),An(i,Ne)}else I();G(O,H,ge)}catch{}},T=()=>{document.visibilityState==="visible"&&Q()},R=()=>{Q()},_=window.setInterval(()=>{Q()},15e3);return document.addEventListener("visibilitychange",T),window.addEventListener("online",R),Q(),()=>{U=!0,window.clearInterval(_),document.removeEventListener("visibilitychange",T),window.removeEventListener("online",R)}},[r,i,l,D,G,I,V]),k.useEffect(()=>{if(!l)return;const L=i.sessionGenerationRef.current;return N(l.sessionId,L),()=>{const O=i.eventsStreamStateRef.current;O?.sessionId===l.sessionId&&O.generation===L&&(i.reconnectAbortRef.current?.abort(),i.reconnectAbortRef.current=null,i.eventsStreamStateRef.current=null)}},[l,p,i,N]),{sendPrompt:le,handleStop:X,openEventsStream:K}}function mE(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 C=await fetch(`${r}/api/operator/v1/chat/sessions/${S.sessionId}/interviews`,{method:"POST",headers:{"Content-Type":"application/json","x-loop-console-confirmation":Kt()},credentials:"include",body:JSON.stringify({taskId:x})}),D=await C.json();if(!C.ok){o(D.error?.message??`HTTP ${C.status}`);return}u({interviewSessionId:D.interview?.sessionId,taskId:x,state:D.interview?.state,question:D.question,draft:D.draft?.draft,draftSha256:D.draft?.draftSha256,assessment:D.assessment})},[r,i,u,o]),v=k.useCallback(async S=>{const x=i.sessionRef.current;if(!x||!d?.interviewSessionId||!d.question)return;const C=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":Kt()},credentials:"include",body:JSON.stringify({questionId:d.question.id,response:S,...S==="override"?{text:h}:{}})}),D=await C.json();if(!C.ok){o(D.error?.message??`HTTP ${C.status}`);return}u(B=>({...B??{},state:D.interview?.state,question:D.question,draft:D.draft?.draft,draftSha256:D.draft?.draftSha256,assessment:D.assessment,taskKindRecommendation:D.taskKindRecommendation??B?.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":Kt()},credentials:"include",body:JSON.stringify({taskKind:d.taskKindRecommendation})}),C=await x.json();if(!x.ok){o(C.error?.message??`HTTP ${x.status}`);return}u(D=>({...D??{},confirmedTaskKind:D?.taskKindRecommendation,taskKindRecommendation:void 0,draft:C.draft?.draft,draftSha256:C.draft?.draftSha256,assessment:C.assessment}))},[r,i,d,u,o]);return{interviewAnswer:h,setInterviewAnswer:g,startInterview:p,answerInterview:v,confirmTaskKind:y}}function pE(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,C]=k.useState(null),[D,B]=k.useState(!1),E=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(re=>({...re,[K]:$.data?.entries??[]}))}catch(N){v(N instanceof Error?N.message:String(N))}},[r]);k.useEffect(()=>{E()},[E]);const A=k.useCallback(async K=>{B(!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(re=>{const ce=[...re.filter(V=>V.path!==$.data.path),$.data],M=i.sessionRef.current?.sessionId;return M&&window.localStorage.setItem(`${wn}.previews.${M}`,JSON.stringify(ce.map(V=>V.path))),ce}),C($.data.path)}catch(N){o(N instanceof Error?N.message:String(N))}finally{B(!1)}},[r,i,o]);k.useEffect(()=>{if(!l)return;let K=[];try{const N=JSON.parse(window.localStorage.getItem(`${wn}.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(re=>!!re);S($),C($.at(-1)?.path??null)})},[r,l,i]);const I=k.useCallback(K=>{g(N=>{const $=new Set(N);return $.has(K)?$.delete(K):$.add(K),$}),d[K]||E(K)},[d,E]),G=k.useCallback(K=>{S(N=>{const $=N.filter(re=>re.path!==K);return l&&window.localStorage.setItem(`${wn}.previews.${l}`,JSON.stringify($.map(re=>re.path))),$}),C(N=>N===K?y.find($=>$.path!==K)?.path??null:N)},[y,l]);return{tree:d,expandedDirs:h,treeError:p,previews:y,activePreviewPath:x,setActivePreviewPath:C,previewLoading:D,setPreviews:S,loadTree:E,openPreview:A,closePreview:G,toggleDir:I}}function gE(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,C]=k.useState(0),[D,B]=k.useState([]),[E,A]=k.useState(!1),[I,G]=k.useState(null),[K,N]=k.useState(0),$=k.useRef(null),re=k.useRef(void 0),ce=k.useCallback(R=>{u(R),S(R.startsWith("/")),C(0)},[]),M=k.useCallback(async()=>{if(!i){B([]),G(null),A(!1);return}const R=i;re.current=R,A(!0),G(null);try{const _=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(R)}/commands`,{credentials:"include"});if(re.current!==R)return;if(!_.ok){G("动态命令加载失败"),B([]);return}const w=await _.json().catch(()=>null),te=[];for(const fe of w?.commands??[]){const W=fe.source;if(W!=="extension"&&W!=="prompt"&&W!=="skill")continue;const ie=String(fe.command??fe.name??"").trim();ie&&te.push({command:ie.startsWith("/")?ie:`/${ie}`,label:String(fe.label??fe.name??ie),description:String(fe.description??""),source:W})}if(re.current!==R)return;B(te)}catch{if(re.current!==R)return;G("动态命令加载失败"),B([])}finally{re.current===R&&A(!1)}},[r,i]);k.useEffect(()=>{B([]),G(null),i&&(!y&&K===0||M())},[i,y,K,M]);const V=k.useCallback(()=>{N(R=>R+1),M()},[M]);k.useEffect(()=>{if(!i)return;const R=d.slice(0,$.current?.selectionStart??d.length).match(/(?:^|\s)@([^\s@]*)$/);if(!R){g([]);return}const _=window.setTimeout(()=>{fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(i)}/files?q=${encodeURIComponent(R[1]??"")}`).then(w=>w.ok?w.json():null).then(w=>g((w?.files??[]).map(te=>te.path)))},150);return()=>window.clearTimeout(_)},[r,i,d]);const Y=k.useCallback(R=>{const _=$.current?.selectionStart??d.length,te=d.slice(0,_).search(/@[^\s@]*$/);te<0||(u(`${d.slice(0,te)}@${R} ${d.slice(_)}`),g([]))},[d]),le=k.useCallback(R=>{for(const _ of Array.from(R).slice(0,4)){if(!_.type.startsWith("image/")||_.size>5*1024*1024){o("图片仅支持 PNG/JPEG/GIF/WebP,单张不超过 5 MiB");continue}const w=new FileReader;w.onload=()=>{const te=String(w.result??""),fe=te.slice(te.indexOf(",")+1);v(W=>[...W,{name:_.name,type:"image",mimeType:_.type,data:fe}].slice(0,4))},w.readAsDataURL(_)}},[o]),X=k.useCallback(R=>{v(_=>_.filter(w=>w!==R))},[]);k.useLayoutEffect(()=>{const R=$.current;R&&(R.style.height="auto",R.style.height=`${Math.min(R.scrollHeight,280)}px`)},[d]),k.useEffect(()=>{if(!i)return;const R=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":Kt()},body:JSON.stringify({text:d})})},400);return()=>window.clearTimeout(R)},[r,i,d]);const L=k.useMemo(()=>bS(D),[D]),O=k.useMemo(()=>d.startsWith("/")?xS(L,d):[],[d,L]),H=k.useCallback(()=>{l.isComposingRef.current=!0},[l]),U=k.useCallback(()=>{l.isComposingRef.current=!1,l.compositionEndedAtRef.current=Date.now()},[l]),Q=k.useCallback(()=>l.isComposingRef.current,[l]),T=k.useCallback(()=>Date.now()-l.compositionEndedAtRef.current<100,[l]);return k.useEffect(()=>{V1({origin:r,sessionId:i,refs:l})},[r,i,l]),{input:d,setInput:u,handleInputChange:ce,fileOptions:h,pendingImages:p,setPendingImages:v,addImagesFromFiles:le,removeImage:X,shortcutOpen:y,setShortcutOpen:S,shortcutIndex:x,setShortcutIndex:C,filteredShortcuts:O,dynamicCommandsLoading:E,dynamicCommandsError:I,retryDynamicCommands:V,insertFileReference:Y,textareaRef:$,onCompositionStart:H,onCompositionEnd:U,isComposingNow:Q,recentlyComposedNow:T}}const yE=[{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 vE(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=[...yE];return{explore:i,operator:r,total:i.length+r.length}}let bE=0;function xE(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),[C,D]=k.useState([]),[B,E]=k.useState(null),[A,I]=k.useState(null),[G,K]=k.useState(!1),[N,$]=k.useState(!1),[re,ce]=k.useState(!1),M=k.useRef(null),V=k.useRef(null),Y=k.useRef(0);k.useEffect(()=>{Y.current=-1,K(!1)},[i?.sessionId,K]);const X=Zi().snapshot,L=k.useCallback(async()=>{try{const W=await fetch(`${r}/api/operator/v1/chat/capabilities`);if(!W.ok)return;const ie=await W.json();h(ie)}catch{}},[r]);k.useEffect(()=>{L()},[L]);const O=k.useCallback(async()=>{if(!i){p([]),y("idle");return}const W=i.sessionId;y("loading"),x(null);try{const ie=await fetch(`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(W)}/models`,{credentials:"include"}),he=await ie.json().catch(()=>null);if(o.sessionRef.current?.sessionId!==W)return;if(!ie.ok||!he){y("error"),x(he?.error?.message??`模型列表读取失败(HTTP ${ie.status})`);return}p(he.models??[]),D(he.thinkingLevels??[]),y("ready")}catch(ie){if(o.sessionRef.current?.sessionId!==W)return;y("error"),x(ie instanceof Error?ie.message:String(ie))}},[r,i,o]);k.useEffect(()=>{O()},[O]),k.useEffect(()=>{if(!i){E(null),I(null);return}const W=i.sessionId,ie=`${r}/api/operator/v1/chat/sessions/${encodeURIComponent(W)}`;I(null),fetch(`${ie}/runtime-context`,{credentials:"include"}).then(async he=>{const pe=await he.json().catch(()=>null);if(!pe?.context||o.sessionRef.current?.sessionId!==W)return;const ge=pe.context,Ie=K1().snapshot;E(Ne=>$1(Ne,ge,Ie,W))}).catch(()=>{o.sessionRef.current?.sessionId===W&&I("注入上下文读取失败,请重试")})},[r,i?.sessionId,o]),k.useEffect(()=>{if(!X||!i||X.sessionId!==i.sessionId)return;const W=sy(X);l(ie=>{if(!ie||ie.sessionId!==X.sessionId||wR(ie,W))return ie;const he=Av(ie,W);return o.sessionRef.current=he,he}),E(ie=>{if(!ie)return ie;const he={...ie,...W.model?{model:W.model}:{},...W.thinkingLevel?{thinkingLevel:W.thinkingLevel}:{}};return he.model?.provider===ie.model?.provider&&he.model?.modelId===ie.model?.modelId&&he.thinkingLevel===ie.thinkingLevel?ie:he})},[X,i?.sessionId,o,l,E]);const H=k.useCallback(async W=>{if(!i)return!1;const ie=i.sessionId,he=++bE;Y.current=he,cy({type:"mutation-start",token:he}),K(!0);try{const pe=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":Kt()},body:JSON.stringify(W)}),ge=await pe.json().catch(()=>({}));return Y.current!==he?!1:pe.ok?!ge.session||o.sessionRef.current?.sessionId!==ie?!1:Y1(he,ie,ge.snapshot):(o.sessionRef.current?.sessionId===ie&&(d(ge.error?.message??`模型或思考等级切换失败(HTTP ${pe.status})`),Xi()),!1)}catch(pe){return Y.current!==he||o.sessionRef.current?.sessionId===ie&&d(pe instanceof Error?pe.message:String(pe)),!1}finally{P1(he,ie,o)&&Y.current===he&&K(!1)}},[r,i,o,l,d]);k.useEffect(()=>{if(!N)return;const W=he=>{const pe=M.current;pe&&he.target instanceof Node&&!pe.contains(he.target)&&$(!1)},ie=he=>{he.key==="Escape"&&$(!1)};return document.addEventListener("mousedown",W),document.addEventListener("keydown",ie),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",ie)}},[N]),k.useEffect(()=>{if(!re)return;const W=he=>{const pe=V.current;pe&&he.target instanceof Node&&!pe.contains(he.target)&&ce(!1)},ie=he=>{he.key==="Escape"&&ce(!1)};return document.addEventListener("mousedown",W),document.addEventListener("keydown",ie),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("keydown",ie)}},[re]);const U=k.useMemo(()=>vE(u),[u]),Q=X?(X.models??[]).map(W=>({provider:W.provider,id:W.id,...W.name?{name:W.name}:{},...W.hasCredentials!==void 0?{hasCredentials:W.hasCredentials}:{}})):g,T=X?.thinkingLevels?.length?X.thinkingLevels.map(W=>W.value):C,R=i?.model??B?.model,_=R?Bs(R.provider,R.modelId):"",w=X?.selection?.thinkingSelection??i?.thinkingLevel??"",te=X?.selection?.effectiveThinkingLevel??i?.thinkingLevel??void 0,fe=!_||Q.some(W=>Bs(W.provider,W.id)===_);return{capabilities:u,models:Q,modelsStatus:v,modelsError:S,onRetryModels:()=>{O()},thinkingLevels:T,runtimeContext:B,runtimeContextError:A,onRetryRuntimeContext:()=>{I(null),Xi()},toolsOpen:N,setToolsOpen:$,runtimeContextOpen:re,setRuntimeContextOpen:ce,toolsMenuRef:M,runtimeContextMenuRef:V,switchRuntime:H,switching:G,toolCatalog:U,activeModel:R,activeModelRef:_,activeThinkingLevel:w,effectiveThinkingLevel:te,activeModelListed:fe}}const Xg={comfortableMin:1450,compactMin:1100};function SE(t){return!Number.isFinite(t)||t<0?"narrow":t>=Xg.comfortableMin?"comfortable":t>=Xg.compactMin?"compact":"narrow"}function kE(t){return t==="compact"||t==="narrow"}const wE={mode:"comfortable",width:1600,landingDensity:"comfortable",emptyHeight:720};function CE(t,r){const[i,l]=k.useState(wE);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:SE(v),width:v,landingDensity:kS(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 jE(t="none"){return{active:t}}function Ja(t,r){return{active:r}}function Rr(t={active:"none"}){return{active:"none"}}function TE(t){return{sidebarDrawerOpen:t.active==="sidebar-drawer",processOpen:t.active==="process",runtimeContextOpen:t.active==="runtime-context",toolsOpen:t.active==="tools"}}function RE(t){const{origin:r,surface:i="standalone"}=t,l=i==="workspace",o=OR(),[d,u]=k.useState(null),[h,g]=k.useState(null),[p,v]=k.useState(!0),[y,S]=k.useState(!0),[x,C]=k.useState(()=>jE()),[D,B]=k.useState(null),[E,A]=k.useState(0),I=k.useRef(null),G=k.useRef(null),K=k.useRef(null),N=k.useRef(null),$=k.useRef(null),re=k.useRef(null),ce=k.useRef(null),M=k.useRef(null),V=k.useRef(()=>{}),Y=CE(N,$),le=Y.mode,X=TE(x),L=X.processOpen,O=kE(le)&&L,H=X.runtimeContextOpen;k.useEffect(()=>{le==="comfortable"&&x.active==="sidebar-drawer"&&C(oe=>oe.active==="sidebar-drawer"?Rr(oe):oe)},[le,x.active]);const U=k.useCallback(oe=>{C(P=>{const de=P.active==="process";return(typeof oe=="function"?oe(de):oe)?Ja(P,"process"):P.active==="process"?Rr(P):P})},[]),Q=gE({origin:r,sessionId:h?.sessionId,refs:o,setError:u}),T=pE({origin:r,refs:o,sessionId:h?.sessionId,setError:u}),R=k.useRef(()=>{}),_=k.useCallback(oe=>{R.current(oe)},[]),w=GR({origin:r,refs:o,sessionId:h?.sessionId,setError:u,onReconcile:_});R.current=oe=>{const P=o.sessionRef.current?.sessionId;P&&(async()=>await w.recoverSession(P)?(B({id:Date.now(),message:"已自动恢复:会话事件已重新同步,可继续对话。"}),A(ve=>ve+1)):B({id:Date.now(),message:"自动恢复未完成,将在重连时重试。"}))()};const te=YR({origin:r,refs:o,setSession:g,thread:w,composer:{setInput:Q.setInput,setPendingImages:Q.setPendingImages},browser:{setPreviews:T.setPreviews,setActivePreviewPath:T.setActivePreviewPath},setError:u,setProcessOpen:U,setAutoScroll:S}),fe=hE({origin:r,refs:o,session:h,thread:w,composer:{setInput:Q.setInput,setPendingImages:Q.setPendingImages},setError:u,setNotice:B,setAutoScroll:S,recoveryVersion:E,watchSessionTitle:te.watchSessionTitle}),W=mE({origin:r,refs:o,thread:w,setError:u}),ie=xE({origin:r,session:h,setSession:g,refs:o,setError:u});k.useEffect(()=>{ie.runtimeContextOpen&&x.active!=="runtime-context"?C(oe=>Ja(oe,"runtime-context")):!ie.runtimeContextOpen&&x.active==="runtime-context"&&C(oe=>Rr(oe))},[ie.runtimeContextOpen,x.active]),k.useEffect(()=>{x.active!=="runtime-context"&&ie.runtimeContextOpen&&ie.setRuntimeContextOpen(!1)},[x.active]);const{sendPrompt:he,handleStop:pe}=fe,ge=k.useCallback(async oe=>{await he(oe,Q.pendingImages)},[he,Q.pendingImages]);V.current=oe=>{ge(oe)};const Ie=k.useCallback(()=>{Q.textareaRef.current?.focus()},[Q.textareaRef]),Ne=k.useCallback(()=>{C(oe=>oe.active==="sidebar-drawer"?Rr(oe):oe)},[]),$e=k.useCallback(()=>{ie.setRuntimeContextOpen(!1),C(oe=>Ja(oe,"sidebar-drawer"))},[ie.setRuntimeContextOpen]),Pe=k.useCallback(oe=>{te.activateSession(oe),Ne(),queueMicrotask(()=>{G.current?.focus?.(),Ie()})},[te,Ne,Ie]),at=k.useCallback(oe=>{Q.setInput(P=>`${P}${P&&!P.endsWith(" ")?" ":""}@${oe} `),Ne(),queueMicrotask(()=>Ie())},[Q,Ne,Ie]),sn=k.useCallback(oe=>{T.openPreview(oe),Ne()},[T,Ne]),Tt=k.useCallback(()=>{const oe=G.current;if(!oe)return;const P=oe.scrollHeight-oe.scrollTop-oe.clientHeight<80;S(P)},[]);k.useEffect(()=>{y&&I.current?.scrollIntoView({behavior:"smooth",block:"end"})},[w.messages,y,w.streaming]),k.useEffect(()=>{if(!D)return;const oe=window.setTimeout(()=>B(null),6e3);return()=>window.clearTimeout(oe)},[D]);const on=k.useCallback(oe=>{const P=vS(oe),de=oe.trim(),ve=de.split(/\s+/,1)[0]?.toLowerCase()??"";if(Q.setInput(""),Q.setShortcutOpen(!1),!!P){if(P.action==="focus:interview"){W.startInterview();return}if(P.action==="show-help"){u(`可用 shortcuts:${cd.map(Ce=>Ce.command).join("、")};以及 /compact /name /session /copy`);return}if(P.action.startsWith("focus-panel:")){K.current?.scrollIntoView({behavior:"smooth",block:"nearest"});return}if(P.action==="compact"){te.compactSession();return}if(P.action==="name"){const Ce=de.slice(ve.length).trim(),Te=h?.sessionId;if(!Te){u("当前没有可重命名的会话");return}const Se=te.sessionList.find(Oe=>Oe.sessionId===Te),Ke=Ce||window.prompt("会话名称",Se?.title??Se?.displayTitle??"")||"";Ke.trim()&&te.updateSession(Te,{title:Ke.trim()});return}if(P.action==="session"){const Ce=h?.sessionId??"(none)",Te=te.sessionList.find(Ke=>Ke.sessionId===Ce),Se=Te?.title||Te?.displayTitle||"未命名对话";B({id:Date.now(),message:`当前会话:${Se}(${Ce})`});return}if(P.action==="copy"){const Te=[...w.visibleMessages??[]].reverse().find(Se=>Se.role==="assistant");if(!Te?.text){u("没有可复制的助手消息");return}navigator.clipboard?.writeText(Te.text).then(()=>B({id:Date.now(),message:"已复制最后一条助手消息"}),()=>u("复制失败"));return}if(P.action==="unknown"){V.current(de);return}u(`未知 shortcut:${P.command}`)}},[Q.setInput,Q.setShortcutOpen,W.startInterview,te,h,w.visibleMessages]),Ht=k.useCallback(oe=>{if(Q.shortcutOpen&&Q.filteredShortcuts.length>0&&!oe.nativeEvent.isComposing){if(oe.key==="ArrowDown"||oe.key==="ArrowUp"){oe.preventDefault(),Q.setShortcutIndex(ve=>(ve+(oe.key==="ArrowDown"?1:Q.filteredShortcuts.length-1))%Q.filteredShortcuts.length);return}if(oe.key==="Escape"){oe.preventDefault(),Q.setShortcutOpen(!1);return}if(oe.key==="Enter"){oe.preventDefault(),on(Q.filteredShortcuts[Q.shortcutIndex]?.command??Q.filteredShortcuts[0].command);return}}const P=Date.now()-o.compositionEndedAtRef.current<100,de=o.isComposingRef.current||oe.nativeEvent.isComposing;if(oe.key==="Enter"&&!oe.shiftKey&&(de||P)){P&&oe.preventDefault();return}if(oe.key==="Enter"&&!oe.shiftKey){oe.preventDefault(),ge(Q.input);return}},[Q.input,Q.shortcutOpen,Q.filteredShortcuts,Q.shortcutIndex,Q.setShortcutIndex,Q.setShortcutOpen,o,ge,on]),Rt=w.visibleMessages.length>0||w.operationCards.length>0||w.humanGateCards.length>0||w.artifactCards.length>0||!!w.interview,je=t.readiness==="setup-required"?"⚠ Pi 未就绪(setup-required):Chat 需要先完成 Pi 认证 / 模型配置。":t.readiness==="degraded"?"⚠ Pi 降级(degraded):可继续对话,但部分能力不可用。":null,qe=c.jsx(pS,{origin:r,open:p,layoutMode:le,drawerOpen:X.sidebarDrawerOpen,activeSessionId:h?.sessionId,sessions:te.sessionList,tree:T.tree,expanded:T.expandedDirs,treeError:T.treeError,onToggleOpen:()=>v(oe=>!oe),onOpenDrawer:$e,onCloseDrawer:Ne,onCreate:()=>{te.createSession()},creatingSession:te.creatingSession,onActivate:oe=>{X.sidebarDrawerOpen?Pe(oe):te.activateSession(oe)},onRename:(oe,P)=>{te.updateSession(oe,{title:P})},onSetState:(oe,P)=>{te.updateSession(oe,{state:P})},onDelete:oe=>{te.deleteSession(oe)},onRefreshTree:()=>{T.loadTree()},onToggleDir:T.toggleDir,onInsert:oe=>{X.sidebarDrawerOpen?at(oe):Q.setInput(P=>`${P}${P&&!P.endsWith(" ")?" ":""}@${oe} `)},onPreview:oe=>{X.sidebarDrawerOpen?sn(oe):T.openPreview(oe)},drawerTriggerRef:re}),ut=["oc-workspace",L&&!O?"has-process":"",O?"has-process-overlay":""].filter(Boolean).join(" "),Fe=oe=>c.jsx("div",{className:"oc-messages is-empty",ref:$,"data-landing-density":Y.landingDensity,children:c.jsx(gy,{mode:oe,readiness:t.readiness,density:Y.landingDensity,onSuggest:async P=>{te.creatingSession||(oe==="no-session"?await te.createSession()&&await ge(P):await ge(P))},disabled:te.creatingSession,onCreateSession:oe==="no-session"?()=>{te.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。"]})]}),je&&c.jsx("div",{className:"oc-alert oc-alert-warning",children:je}),d&&c.jsxs("div",{className:"oc-alert oc-alert-error",children:[c.jsx("strong",{children:"出错了:"}),d]}),D&&c.jsx("div",{className:"oc-alert oc-alert-warning",role:"status",children:D.message}),h?c.jsxs("div",{className:ut,ref:N,"data-layout-mode":le,children:[qe,c.jsxs("div",{className:`oc-main${Rt?"":" is-landing"}`,children:[le==="narrow"?c.jsx("div",{className:"oc-main-topbar",children:c.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:re,"aria-label":"打开会话与仓库","aria-expanded":X.sidebarDrawerOpen,onClick:()=>X.sidebarDrawerOpen?Ne():$e(),children:"会话与仓库"})}):null,c.jsx(yS,{previews:T.previews,activePath:T.activePreviewPath,loading:T.previewLoading,onActivate:T.setActivePreviewPath,onClose:T.closePreview}),Rt?c.jsx(vR,{scrollContainerRef:G,messagesEndRef:I,onScroll:Tt,hasThread:Rt,readiness:t.readiness,streaming:w.streaming,streamingAssistantId:w.streamingAssistantId,messagesCount:w.messages.length,visibleCount:w.visibleMessages.length,onLoadMore:()=>w.setHistoryLimit(oe=>oe+50),turnGroups:w.turnGroups,interview:w.interview,interviewAnswer:W.interviewAnswer,onInterviewAnswerChange:W.setInterviewAnswer,onAnswerInterview:oe=>{W.answerInterview(oe)},onConfirmTaskKind:()=>{W.confirmTaskKind()},humanGateCards:w.humanGateCards,operationCards:w.operationCards,artifactCards:w.artifactCards,origin:r,sessionId:h.sessionId,onNavigateWorkspace:t.onNavigateWorkspace,onSuggest:oe=>{ge(oe)}}):Fe("empty-session"),c.jsx(NR,{composer:Q,streaming:w.streaming,hasThread:Rt,onSend:oe=>{ge(oe)},onStop:pe,onKeyDown:Ht,onRunShortcut:on,models:ie.models,activeModel:ie.activeModel,activeModelRef:ie.activeModelRef,activeModelListed:ie.activeModelListed,activeThinkingLevel:ie.activeThinkingLevel,thinkingLevels:ie.thinkingLevels,onSwitchRuntime:oe=>{ie.switchRuntime(oe)},usage:w.usage,unread:w.unread,onCompact:()=>{te.compactSession()},processSummary:w.processSummary,processOpen:L,onToggleProcess:()=>{C(oe=>oe.active==="process"?Rr(oe):Ja(oe,"process")),L||ie.setRuntimeContextOpen(!1)},processTriggerRef:ce,runtimeContext:ie.runtimeContext,runtimeContextOpen:H,onToggleRuntimeContext:()=>{H?(ie.setRuntimeContextOpen(!1),C(oe=>oe.active==="runtime-context"?Rr(oe):oe)):(ie.setRuntimeContextOpen(!0),C(oe=>Ja(oe,"runtime-context")))},runtimeContextTriggerRef:M})]}),H&&ie.runtimeContext?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"oc-overlay-backdrop is-runtime-context","aria-label":"关闭注入上下文遮罩",onClick:()=>{ie.setRuntimeContextOpen(!1),C(oe=>oe.active==="runtime-context"?Rr(oe):oe)}}),c.jsx(DR,{panelOnly:!0,open:H,onToggle:()=>{},onClose:()=>{ie.setRuntimeContextOpen(!1),C(oe=>oe.active==="runtime-context"?Rr(oe):oe)},context:ie.runtimeContext,triggerRef:M})]}):null,L&&c.jsxs(c.Fragment,{children:[O?c.jsx("button",{type:"button",className:"oc-overlay-backdrop is-process","aria-label":"关闭工具调用记录遮罩",onClick:()=>U(!1)}):null,c.jsx(AR,{toolCalls:w.toolCalls,overlay:O,onClose:()=>U(!1),triggerRef:ce})]})]}):c.jsxs("div",{className:ut,ref:N,"data-layout-mode":le,children:[qe,c.jsxs("div",{className:"oc-main is-landing",children:[le==="narrow"?c.jsx("div",{className:"oc-main-topbar",children:c.jsx("button",{type:"button",className:"oc-main-topbar-btn",ref:re,"aria-label":"打开会话与仓库","aria-expanded":X.sidebarDrawerOpen,onClick:()=>X.sidebarDrawerOpen?Ne():$e(),children:"会话与仓库"})}):null,Fe("no-session")]})]})]})}function EE(t){return t==="validate"||t==="apply"||t==="spine"?"contract":t}const Dv="X-Loop-Console-Confirmation",Ov="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)"}],Mv={"setup-required":"需要设置",ready:"已就绪",degraded:"降级可用",unknown:"未知"},NE={idle:"未探测",match:"匹配",mismatch:"仓库不匹配",unavailable:"不可用"},zv={low:"低",medium:"中",high:"高"},_v={"validation-failed":"校验失败","contract-drift":"契约漂移","runtime-mismatch":"运行时不匹配","pause-on-human":"等待人工","verification-failed":"验证失败","orphan-unknown":"孤立/未知","terminal-failed":"已终止(失败)","terminal-succeeded":"已终止(成功)","needs-reconcile":"需要对账"},AE={idle:"空闲","not-started":"未开始","not-run":"未运行","n/a (MVP)":"不适用(MVP)",accepted:"已接受",succeeded:"已成功",running:"运行中",ran:"已执行"};function Es(t){return AE[t]??t}function Lv(){return window.__CONSOLE_CONFIRMATION_TOKEN__??""}function $s(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",[Dv]:Lv()},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 IE=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 Qg(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 DE={};function OE(){const[t,r]=k.useState(()=>xy({env:DE?.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),[C,D]=k.useState(null),[B,E]=k.useState(null),[A,I]=k.useState(null),[G,K]=k.useState(null),[N,$]=k.useState({command:"idle",dag:"not-started",verification:"not-run",promote:"n/a (MVP)"}),[re,ce]=k.useState("setup"),M=k.useCallback(L=>{ce(O=>EE(typeof L=="function"?L(O):L))},[]),V=o==="setup-required",Y=o==="degraded",le=k.useCallback(L=>{L!==t&&(D(null),I(null),E(null)),r(L)},[t]),X=k.useCallback(async()=>{try{const O=await(await fetch("/api/health")).json();l(O);const H=O.piReadiness??"setup-required";d(H),p(null),M(H==="ready"||H==="degraded"?U=>U==="setup"?"import-prd":U:"setup")}catch(L){p(L instanceof Error?L.message:String(L))}try{const O=await(await fetch("/api/operator/v1/readiness")).json();h(O),O.state&&d(O.state)}catch{}},[M]);return{nav:t,setNav:r,selectNav:le,health:i,readiness:o,setReadiness:d,readinessReport:u,healthError:g,loadHealth:X,busy:v,setBusy:y,observeBusy:S,setObserveBusy:x,opError:C,setOpError:D,opMessage:B,setOpMessage:E,opErrorCode:A,setOpErrorCode:I,lastOpState:G,setLastOpState:K,layers:N,setLayers:$,step:re,setStep:M,setupBlocked:V,degraded:Y}}function ME(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,[C,D]=k.useState(null),[B,E]=k.useState([]),[A,I]=k.useState(!0),G=k.useRef(null),[K,N]=k.useState(null),[$,re]=k.useState(null),ce=k.useCallback(async(X,L={},O)=>{l(!0),o(null),d(null),u(null);try{const{status:H,body:U}=await Nd(X,L,O?.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(wn)?.trim();if(R&&fetch(`/api/operator/v1/chat/sessions/${encodeURIComponent(R)}/operation-links`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",[Dv]:Lv()},body:JSON.stringify({operationId:U.operationId})}).then(_=>{_.ok||console.warn("Operator Chat operation link failed",_.status)}).catch(_=>console.warn("Operator Chat operation link failed",_)),D(U.operationId),v(U.state??"accepted"),y(_=>({..._,command:U.state??"accepted",dag:X==="runDag"?"running":_.dag})),IE.has(X)){I(!0),u(`操作已接受,后台运行中:${U.operationId}(请看事件流;可同时打开 Observe)`);const _=U.operationId;Qg(_,30*6e4).then(w=>{if(w){if(v(w.state??null),w.state==="failed"||w.state==="needs-reconcile"||w.state==="timed-out"){o(Yi(w.errorMessage??w.stderrPreview??`操作失败:${w.state}`)),d(w.errorCode??w.state??null),y(te=>({...te,command:`failed:${w.errorCode??w.state}`}));return}w.state==="succeeded"&&(u(`${X} 已成功`),y(te=>({...te,command:"succeeded"})))}})}else{u(`操作已接受:${U.operationId}`);const _=await Qg(U.operationId);if(_){if(v(_.state??null),_.state==="failed"||_.state==="needs-reconcile"||_.state==="timed-out")return o(Yi(_.errorMessage??_.stderrPreview??`操作失败:${_.state}`)),d(_.errorCode??_.state??null),y(W=>({...W,command:`failed:${_.errorCode??_.state}`})),{ok:!1,operationId:U.operationId,state:_.state,error:{code:_.errorCode??_.state??"INTERNAL_ERROR",message:_.errorMessage??_.stderrPreview??`操作失败:${_.state}`}};u(_.errorMessage?`${X}:${_.errorMessage}`:`${X} 已成功`),y(W=>({...W,command:_.state??"succeeded"}));const w=_.result??{},te={ok:!0,operationId:U.operationId,state:_.state??"succeeded",result:w};(X==="interviewStart"||X==="interviewTurn"||X==="interviewSkip")&&i(w);const fe=w.confirmation;return fe?.confirmationId&&(N(fe.confirmationId),re(w)),O?.advanceTo&&g(O.advanceTo),te}}}else u(`${X} 已完成`),v(U.state??"succeeded"),y(R=>({...R,command:"succeeded",verification:X==="contractValidate"||X==="spineCheck"?"ran":R.verification}));const Q=U.result??{};(X==="interviewStart"||X==="interviewTurn"||X==="interviewSkip")&&i(Q);const T=Q.confirmation;return T?.confirmationId&&(N(T.confirmationId),re(Q)),O?.advanceTo&&g(O.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]),M=k.useCallback(X=>{if(!X)return"无响应";if(X.error?.message)return X.error.message;if(X.message)return X.message;const L=X.result;if(L&&typeof L=="object")try{return JSON.stringify(L).slice(0,1200)}catch{return"已返回结果"}return X.ok===!1?"失败":"成功"},[]),V=k.useCallback(X=>{if(!X||X.ok===!1||X.error)return!1;const L=X.result;if(!L)return!0;if(typeof L.valid=="boolean")return L.valid;const O=L.result;return O&&typeof O.valid=="boolean"?O.valid:!0},[]),Y=k.useCallback(async X=>{G.current?.abort();const L=new AbortController;G.current=L,E(O=>[...O,`开始跟随事件流 ${X}`]);try{const O=await fetch(`/api/operator/v1/operations/${encodeURIComponent(X)}/events`,{credentials:"same-origin",signal:L.signal});if(!O.ok||!O.body){E(T=>[...T,`事件流 HTTP ${O.status}`]);return}const H=O.body.getReader(),U=new TextDecoder;let Q="";for(;A;){const{done:T,value:R}=await H.read();if(T)break;Q+=U.decode(R,{stream:!0});const _=Q.split(`
50
+
51
+ `);Q=_.pop()??"";for(const w of _){const te=w.split(`
52
+ `).find(W=>W.startsWith("data:"));if(!te)continue;const fe=te.slice(5).trim();E(W=>[...W.slice(-80),fe.slice(0,240)])}}}catch(O){O.name!=="AbortError"&&E(H=>[...H,`事件流错误:${O instanceof Error?O.message:String(O)}`])}},[A]);k.useEffect(()=>(C&&A&&(S==="run"||x==="recovery")&&Y(C),()=>G.current?.abort()),[C,A,S,x,Y]);const le=k.useCallback(()=>{I(!1),G.current?.abort(),u("已停止跟随日志(未取消子进程)")},[u]);return{runAction:ce,summarizeEnvelope:M,isActionSuccess:V,operationId:C,setOperationId:D,sseLog:B,followSse:A,setFollowSse:I,stopFollowSse:le,confirmationId:K,setConfirmationId:N,confirmationDetails:$,setConfirmationDetails:re}}const id=8*1024*1024,zE=10*1024*1024,Fs=8,_E=".md,.markdown,.txt,text/markdown,text/plain",LE=[".md",".markdown",".txt"],Ad=/\.[^.]+$/;function BE(t){const r=Ad.exec(t.trim());return r?r[0].toLowerCase():""}function HE(t){const r=BE(t);return LE.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 er(t,r){return{ok:!1,code:t,message:r}}function UE(t,r){const i=t?Array.from(t):[],l=r?.maxFiles??Fs,o=r?.existingCount??0;return i.length===0?er("file-count","请选择至少一个 .md / .markdown / .txt 文件"):o+i.length>l?er("file-count",`最多支持 ${l} 个文件(当前已有 ${o} 个)`):null}async function qE(t){const r=t.name?.trim()||"untitled.md";if(!HE(r))return er("unsupported-extension","仅支持 .md、.markdown、.txt 文件");if(t.size>id)return er("file-too-large",`文件不能超过 ${ad(id)}`);let i;try{i=await t.arrayBuffer()}catch{return er("read-failed","文件读取失败,请重试或直接粘贴")}let l;try{l=new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{return er("invalid-utf8","文件不是有效 UTF-8,请另存为 UTF-8")}if(l.trim().length===0)return er("empty-content","文件内容不能为空或只有空白");const o=new TextEncoder().encode(l).byteLength;return{ok:!0,text:l,fileName:r,sourceBytes:t.size,textBytes:o}}async function GE(t){if(t.length===0)return er("file-count","请选择至少一个 .md / .markdown / .txt 文件");if(t.length>Fs)return er("file-count",`最多支持 ${Fs} 个文件`);const r=[];for(const i of t){const l=await qE(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 $E(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 FE(t){return t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")||"requirement"}function VE(t,r){const i=t.replace(Ad,"").trim(),l=FE(i);return l==="requirement"&&/[^\u0000-\u007f]/.test(i)?`part-${r+1}`:l==="requirement"?i?`part-${r+1}`:`part-${r+1}`:l}function YE(t){const r=new Set;return t.map((i,l)=>{let o=VE(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 PE(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=$E(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 KE(t,r,i){const l={action:t,actionParams:r};return new TextEncoder().encode(JSON.stringify(l)).byteLength<=zE}function XE(){return"最终内容导致请求体超过服务端限制,请缩小文档或减少文件数量"}function QE(){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),C=k.useRef(0),D=k.useRef(0),B=k.useCallback((V,Y)=>{const le=V.length===0?0:Math.min(Math.max(0,Y),V.length-1);d(le),r(PE(V,{primaryIndex:le})),h(!1)},[]),E=k.useCallback(async V=>{const Y=UE(V,{existingCount:i.length});if(Y){p(Y.message);return}const le=Array.from(V),X=++D.current;y(!0),p(null);try{const L=await GE(le);if(X!==D.current)return;if(!L.ok){p(L.message);return}const O=[...i,...L.documents],H=i.length===0?0:o;l(O),i.length===0||!u?(B(O,H),p(null)):p("已追加文件,未改正文(正文已手动编辑);可点「按文件重新合成」覆盖。")}catch{if(X!==D.current)return;p("文件读取失败,请重试或直接粘贴")}finally{X===D.current&&y(!1)}},[B,u,i,o]),A=k.useCallback(V=>{r(V),i.length>0&&h(!0)},[i.length]),I=k.useCallback(V=>{d(V),u||B(i,V)},[B,u,i]),G=k.useCallback((V,Y)=>{const le=V+Y,X=[...i],L=X[le];X[le]=X[V],X[V]=L;const O=o===V?le:o===le?V:o;l(X),d(O),u||B(X,O)},[B,u,i,o]),K=k.useCallback(V=>{const Y=i.filter((X,L)=>L!==V),le=Y.length===0?0:Math.min(o>=V?Math.max(0,o-1):o,Math.max(0,Y.length-1));l(Y),d(le),Y.length===0?h(!1):u||B(Y,le)},[B,u,i,o]),N=k.useCallback(()=>{l([]),d(0),h(!1),p(null)},[]),$=k.useCallback(()=>{u&&!window.confirm("将用当前文件列表重新合成正文,覆盖你在编辑区的修改。继续?")||(B(i,o),p(null))},[B,u,i,o]),re=k.useCallback((V,Y)=>{V.preventDefault(),V.stopPropagation(),!Y&&(C.current+=1,x(!0))},[]),ce=k.useCallback(V=>{V.preventDefault(),V.stopPropagation(),C.current=Math.max(0,C.current-1),C.current===0&&x(!1)},[]),M=k.useCallback((V,Y)=>{V.preventDefault(),V.stopPropagation(),C.current=0,x(!1),!Y&&E(V.dataTransfer.files)},[E]);return{prdText:t,setPrdText:r,onPrdTextChange:A,prdDocuments:i,prdPrimaryIndex:o,prdComposedDirty:u,prdFileError:g,setPrdFileError:p,prdFileReading:v,prdDragOver:S,loadPrdFromFiles:E,applyPrdComposition:B,setPrimaryDocument:I,moveDocument:G,removeDocument:K,clearDocuments:N,recomposeDocuments:$,onDragEnter:re,onDragLeave:ce,onDrop:M}}const ZE={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>"}},Zg={"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 JE(t){return(Zg[t]??Zg["orphan-unknown"]).map(i=>ZE[i])}function WE(t){const r=[],i=[];for(const l of t)l.lane==="worker"?i.push(l):r.push(l);return{dag:r,worker:i}}function eN(t){return typeof t.action=="string"&&t.action.trim().length>0}function Bv(t){return JE(t).filter(eN)}function tN(t){const r=new Set(Bv(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 nN(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"]),Hv=new Set(["blocked","paused","awaiting_human"]);function Js(t){return(t??"").trim().toLowerCase()}function rN(t){return Id.has(Js(t))}function Jg(t){const r=Js(t.status);return Id.has(r)||r.includes("fail")?0:t.lifecycle==="paused"||r==="paused"?1:t.lifecycle==="active"?2:3}function iN(t){return[...t].sort((r,i)=>{const l=Jg(r)-Jg(i);return l!==0?l:i.mtimeMs-r.mtimeMs})}function aN(t){return iN(t)[0]?.dagRunId}function Wg(t){const r=Js(t.status);return Id.has(r)?0:Hv.has(r)?1:2}function Uv(t){return[...t].sort((r,i)=>{const l=Wg(r)-Wg(i);return l!==0?l:r.nodeId.localeCompare(i.nodeId)})}function lN(t){const r=Uv(t);return r.find(l=>rN(l.status)||Hv.has(Js(l.status)))?.nodeId??r[0]?.nodeId}function sN(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 oN(t){const r=t.status?.trim()||"unknown",i=t.label?.trim();return i&&i!==t.nodeId?`${t.nodeId} · ${r} · ${i}`:`${t.nodeId} · ${r}`}function uN(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 qv(t){const r=t.trim();return r?r==="operator-recovery"||r.startsWith("operator-recovery:")||r.startsWith("recovery:"):!0}function cN(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:C,setRecoveryReasonTouched:D,buildCurrentRecoveryReason:B,openFullCanvas:E}=t,{setOpError:A,setOpErrorCode:I,setOpMessage:G,setBusy:K}=r,{runAction:N,isActionSuccess:$}=i,re=k.useCallback(async M=>{if(M.requiresReason||(y(null),S(null)),M.action==="doctor"){x(null),N("doctor",{});return}if(M.action==="dagReport"||M.id==="report"){const V=o.trim();if(V){y(null),S(null);const Y=await N("dagReport",{runId:V}),le=Y?.result??{},X=(le.raw?.runs??le.runs)?.[0];Y&&Y.ok!==!1&&!Y.error&&X&&(x({runId:X.runId??V,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}A("查看报告需要先选择 DAG 运行 ID(或填写任务 ID)");return}if(M.action==="observeLink"){x(null),E();return}if(M.requiresReason){if(x(null),y(M),S(null),M.id!=="dagRerun"&&(A(null),I(null)),(!g||qv(h))&&(C(B(M.label)),D(!1)),M.id==="dagRerun"&&o.trim()&&d.trim()){K(!0);try{const{status:V,body:Y}=await Nd("dagRerunPlan",{runId:o.trim(),fromNode:d.trim()}),le=Y.result??{};le&&typeof le=="object"&&("eligible"in le||le.planHash)&&S(le),V<400&&Y.ok!==!1&&le.eligible!==!1?G(null):le.eligible===!1?A(Y.error?.message??Gc(le)):G(Y.error?.message??"无法预检重跑计划;确认后仍将尝试提交(CLI 可能尚未就绪)")}finally{K(!1)}}return}A(null),I(null),G(`${M.label}:请经 CLI — ${M.commandHint??""}`)},[B,o,d,E,h,g,N,K,A,I,G,y,S,x,C,D,l]),ce=k.useCallback(async()=>{const M=p;if(!M)return;const V=h.trim();if(!V){A("恢复操作需要结构化原因");return}const Y=$s(`recovery-${M.id}`);if(y(null),M.id==="dagRerun"){const le=o.trim(),X=d.trim();if(!le||!X){A("从节点重跑需要 DAG 运行 ID 与起始节点 ID");return}let L=v?.planHash?.trim(),O=v?.eligible;if(!L||O===void 0){const H=await N("dagRerunPlan",{runId:le,fromNode:X}),U=H?.result??{};if((U.planHash||U.eligible!==void 0)&&S(U),L=U.planHash?.trim()||L,O=U.eligible,U.eligible===!1){A(H?.error?.message??Gc(U));return}if(H&&H.ok===!1&&!L){A(H.error?.message??"无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}}if(O===!1){A(Gc(v??{}));return}if(!L){A("无法获取 planHash;请确认 loop-agent dag rerun --plan 可用");return}await N("dagRerun",{runId:le,fromNode:X,planHash:L,reason:V},{clientRequestId:Y});return}if(M.id==="standaloneTaskRerun"){const le=o.trim();if(!le){A("完整重跑任务需要 DAG 运行 ID");return}const X={runId:le,reason:V,...l.trim()?{taskId:l.trim()}:{}},L=await N("prepareMutationGate",{action:"standaloneTaskRerun",actionParams:X});if(!$(L))return;const O=L?.result??L;if(!O.receiptId||!O.humanGateToken){A("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await N("standaloneTaskRerun",{...X,confirmationId:O.receiptId,humanGateToken:O.humanGateToken},{clientRequestId:Y});return}if(M.id==="workerTaskRetry"){const le=l.trim();if(!le){A("重新排队 Worker Task 需要任务 ID");return}const X={taskId:le,reason:V,...u.trim()?{featureId:u.trim()}:{}},L=await N("prepareMutationGate",{action:"workerTaskRetry",actionParams:X});if(!$(L))return;const O=L?.result??L;if(!O.receiptId||!O.humanGateToken){A("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await N("workerTaskRetry",{...X,confirmationId:O.receiptId,humanGateToken:O.humanGateToken},{clientRequestId:Y});return}if(M.id==="reconcile"){const le=o.trim();if(!le){A("对账恢复需要 DAG 运行 ID");return}const X={runId:le,reason:V,reconcileAction:"supersede"},L=await N("prepareMutationGate",{action:"dagReconcileRun",actionParams:X});if(!$(L))return;const O=L?.result??L;if(!O.receiptId||!O.humanGateToken){A("prepareMutationGate 未返回可消费的 Human Gate receipt");return}await N("dagReconcileRun",{...X,confirmationId:O.receiptId,humanGateToken:O.humanGateToken},{clientRequestId:Y});return}G(`${M.label}:请经 CLI — ${M.commandHint??""}`)},[o,u,d,p,v?.planHash,h,N,$,A,G,y,S,l]);return{handleRecoveryCta:re,submitRecoveryConfirm:ce}}function dN(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,C]=k.useState(""),[D,B]=k.useState(""),[E,A]=k.useState(""),[I,G]=k.useState(!1),[K,N]=k.useState(null),[$,re]=k.useState(null),[ce,M]=k.useState([]),[V,Y]=k.useState([]),[le,X]=k.useState(!1),[L,O]=k.useState(!1),[H,U]=k.useState(null),[Q,T]=k.useState(null),[R,_]=k.useState(!1),[w,te]=k.useState(!1),[fe,W]=k.useState(null),[ie,he]=k.useState("idle"),[pe,ge]=k.useState(null),[Ie,Ne]=k.useState(null),[$e,Pe]=k.useState(!1),at=k.useCallback(()=>y.trim()?`/inspect/#/dag/${encodeURIComponent(y.trim())}?from=recovery`:"/inspect/#/",[y]),sn=k.useCallback(()=>{window.location.assign(at())},[at]),Tt=k.useCallback(async()=>{if(y.trim())return y.trim();const Se=v.trim();if(!Se)return g("打开 DAG 检视需要任务 ID 或 DAG 运行 ID"),null;p(!0),g(null);try{const{status:Ke,body:Oe}=await Nd("observeLink",{taskId:Se}),He=Oe.result??{};if(Ke>=400||Oe.ok===!1)return g(Oe.error?.message??"无法解析 DAG 画布地址"),he("unavailable"),ge(Oe.error?.message??null),null;const ht=typeof He.dagRunId=="string"?He.dagRunId.trim():"";return ht?(S(ht),he("match"),ge(null),Ne(`/inspect/#/dag/${encodeURIComponent(ht)}`),ht):(g("尚未找到该任务的 DAG 运行,请稍后再打开检视"),he("unavailable"),ge(He.message??"未解析到 DAG run"),null)}catch(Ke){return g(Ke instanceof Error?Ke.message:String(Ke)),null}finally{p(!1)}},[y,v,g,p]),on=k.useCallback(async()=>{await Tt()&&Pe(!0)},[Tt]),Ht=k.useCallback(async()=>{const Se=await Tt();Se&&window.location.assign(`/inspect/#/dag/${encodeURIComponent(Se)}?from=recovery`)},[Tt]),Rt=k.useCallback(async()=>{X(!0);try{const Se=v.trim(),Ke=new URLSearchParams;Se&&Ke.set("taskId",Se),Ke.set("limit","40");const Oe=await fetch(`/api/operator/v1/recovery/candidates?${Ke.toString()}`,{credentials:"same-origin"});if(!Oe.ok){M([]);return}const He=await Oe.json();M(Array.isArray(He.runs)?He.runs:[])}catch{M([])}finally{X(!1)}},[v]),je=k.useCallback(async Se=>{const Ke=Se.trim();if(!Ke){Y([]),U(null),T(null);return}O(!0);try{const Oe=await fetch(`/api/dag-runs/${encodeURIComponent(Ke)}`,{credentials:"same-origin"});if(!Oe.ok){Y([]),U(null),T(null);return}const He=await Oe.json(),ht=typeof He.effectiveStatus=="string"&&He.effectiveStatus||typeof He.status=="string"&&He.status||null;U(ht);const Qe=Array.isArray(He.nodes)?He.nodes:[],jn=Uv(Qe.map(Et=>{const Ir=(Et.nodeId??Et.id??"").trim();return Ir?{nodeId:Ir,status:Et.status,label:Et.label??Et.name,errorPreview:Et.errorPreview}:null}).filter(Et=>Et!==null));Y(jn);const Qt=typeof He.failureCategory=="string"&&He.failureCategory||void 0,Ws=Qe.find(Et=>typeof Et.failureCategory=="string"&&Et.failureCategory&&Et.failureCategory!=="success")?.failureCategory;T(Qt??Ws??null)}catch{Y([]),U(null),T(null)}finally{O(!1)}},[]);k.useEffect(()=>{o==="recovery"&&Rt()},[o,v,Rt]),k.useEffect(()=>{if(o!=="recovery"||R||ce.length===0)return;const Se=y.trim(),Ke=Se?ce.some(Oe=>Oe.dagRunId===Se):!1;if(!Se||!Ke){const Oe=aN(ce);Oe&&Oe!==Se&&S(Oe)}},[o,ce,y,R]),k.useEffect(()=>{o==="recovery"&&je(y)},[o,y,je]),k.useEffect(()=>{if(o!=="recovery"||w||V.length===0)return;const Se=x.trim(),Ke=Se?V.some(Oe=>Oe.nodeId===Se):!1;if(!Se||!Ke){const Oe=lN(V);Oe&&Oe!==Se&&C(Oe)}},[o,V,x,w]);const qe=nN({operationState:H?null:h,errorCode:H?null:u,dagStatus:H,failureCategory:Q}),ut=k.useMemo(()=>Bv(qe),[qe]),Fe=k.useMemo(()=>WE(ut),[ut]),oe=k.useMemo(()=>tN(qe),[qe]),P=k.useMemo(()=>V.find(Se=>Se.nodeId===x.trim()),[V,x]),de=k.useRef(null);k.useEffect(()=>{$&&de.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[$?.id]);const ve=k.useCallback(Se=>uN({actionLabel:Se,dagRunId:y.trim()||void 0,fromNodeId:x.trim()||void 0,runStatus:H,nodeStatus:P?.status,nodeError:P?.errorPreview,factClassLabel:_v[qe],errorMessage:d,errorCode:u}),[y,x,d,u,qe,H,P?.errorPreview,P?.status]);k.useEffect(()=>{if(o!=="recovery"||I&&!qv(E))return;const Se=ve($?.label);Se&&Se!==E&&A(Se)},[o,y,x,H,P,qe,d,u,$?.label,I,E,ve]);const{handleRecoveryCta:Ce,submitRecoveryConfirm:Te}=cN({shell:r,actions:i,taskId:v,dagRunId:y,fromNodeId:x,featureId:D,recoveryReason:E,recoveryReasonTouched:I,recoveryConfirm:$,recoveryPlanSummary:K,setRecoveryConfirm:re,setRecoveryPlanSummary:N,setRecoveryReport:W,setRecoveryReason:A,setRecoveryReasonTouched:G,buildCurrentRecoveryReason:ve,openFullCanvas:Ht});return{dagRunId:y,setDagRunId:S,fromNodeId:x,setFromNodeId:C,featureId:D,setFeatureId:B,recoveryReason:E,setRecoveryReason:A,recoveryReasonTouched:I,setRecoveryReasonTouched:G,recoveryPlanSummary:K,recoveryConfirm:$,setRecoveryConfirm:re,setRecoveryPlanSummary:N,recoveryRuns:ce,recoveryNodes:V,recoveryRunsLoading:le,recoveryNodesLoading:L,recoveryRunStatus:H,manualRunId:R,setManualRunId:_,manualNodeId:w,setManualNodeId:te,recoveryReport:fe,setRecoveryReport:W,observeLinkStatus:ie,observeLinkMessage:pe,observeUrl:Ie,inspectSplitOpen:$e,setInspectSplitOpen:Pe,inspectPath:at,openFullInspect:sn,resolveDagRunForInspect:Tt,openInspectSplit:on,openFullCanvas:Ht,loadRecoveryRuns:Rt,loadRecoveryNodes:je,recoveryFact:qe,recoveryCtas:ut,recoveryLanes:Fe,recommendedCtaId:oe,recoveryConfirmRef:de,buildCurrentRecoveryReason:ve,handleRecoveryCta:Ce,submitRecoveryConfirm:Te}}function fN(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(""),[C,D]=k.useState("standard"),[B,E]=k.useState(""),[A,I]=k.useState(""),[G,K]=k.useState(""),N=rd.find(je=>je.kind===C)??rd[0],[$,re]=k.useState(null),[ce,M]=k.useState(null),[V,Y]=k.useState(""),[le,X]=k.useState(null),[L,O]=k.useState(null),[H,U]=k.useState(null),[Q,T]=k.useState(null),[R,_]=k.useState(null),[w,te]=k.useState(!1),[fe,W]=k.useState(null),[ie,he]=k.useState(null),pe=k.useRef(!1),ge=k.useCallback(()=>{U(null),T(null),_(null),te(!1),W(null),he(null),pe.current=!1},[]),Ie=k.useCallback(()=>{ge(),d("contract")},[ge,d]),Ne=k.useCallback(je=>{const qe=je.session;qe?.sessionId&&re(qe.sessionId);const ut=je.question;M(ut),X(je.summary??null);const Fe=je.assessmentId;typeof Fe=="string"&&Fe&&O(Fe),(je.complete===!0||typeof Fe=="string"&&Fe)&&(Ie(),u(je.skipped===!0?"已跳过访谈:已按推荐补齐草稿并签发评估":"访谈已完成:草稿已绑定完整评估结果"))},[Ie,u]),$e=k.useCallback(async(je=!1)=>{const qe=v.trim();if(!qe)return;const ut=`${qe}:${L??""}`;if(!(!je&&ie===ut&&H!==null)&&!pe.current){pe.current=!0,U(null),T(null),_(null),W(null),te(!1);try{const Fe=await h("contractValidate",{taskId:qe}),oe=g(Fe);if(U(oe),T(p(Fe)),!oe){he(ut),u("契约校验未通过:请先修正草稿后再应用");return}const P=await h("contractDiff",{taskId:qe});_(p(P)),he(ut),u(g(P)?"校验与差异已就绪:确认后可应用契约":"校验通过,但差异查询失败(仍可查看下方摘要)")}finally{pe.current=!1}}},[L,ie,H,g,h,u,p,v]),Pe=k.useCallback(async()=>{const je=v.trim();if(!je||!L)return;const qe=await h("contractApply",{taskId:je,assessmentId:L},{clientRequestId:$s("apply")});if(!g(qe)){te(!1);return}te(!0);const ut=await h("spineCheck",{taskId:je});if(g(ut)){W(!0),d("dag-confirm"),u("契约已应用并通过 Spine 审计,可生成并运行 DAG");return}W(!1),u("契约已应用,但 Spine 审计未通过:可重试 Spine")},[L,g,h,u,d,v]),at=k.useCallback(async()=>{const je=v.trim();if(!je)return;const qe=await h("spineCheck",{taskId:je});if(g(qe)){W(!0),d("dag-confirm"),u("Spine 审计已通过,可生成并运行 DAG");return}W(!1)},[g,h,u,d,v]),sn=k.useCallback(async()=>{const je=i.confirmationId?.trim();if(!je)return;const qe=i.confirmationDetails?.confirmation?.humanGateToken,ut=await h("confirmDagConfirmation",{confirmationId:je,humanGateToken:qe});g(ut)&&(d("run"),await h("runDag",{confirmationId:je},{clientRequestId:$s("run")}))},[i.confirmationId,i.confirmationDetails,g,h,d]);k.useEffect(()=>{o==="contract"&&v.trim()&&$e(!1)},[o,v,L,$e]);const Tt=k.useCallback(je=>je.split(/[\n,;,;]+/).map(qe=>qe.trim()).filter(Boolean),[]),on=k.useCallback(async()=>{const je=l.prdDocuments.length>0?YE(l.prdDocuments):void 0,qe=Tt(B),ut=Tt(A),Fe=Tt(G),oe={content:l.prdText,taskKind:C,...je?{documents:je}:{},...qe.length>0?{allowedPaths:qe}:{},...ut.length>0?{forbiddenPaths:ut}:{},...Fe.length>0?{verifyCommands:Fe}:{}};if(!KE("bootstrapFromPrd",oe)){l.setPrdFileError(XE());return}const P=await h("bootstrapFromPrd",oe);if(!P||P.ok===!1)return;const de=P.result??{};de.taskId&&y(de.taskId),de.title&&x(de.title);const ve=de.parseStatus??"pending",Ce=de.draftPreview?.objective?.trim(),Te=Array.isArray(de.gaps)?de.gaps.length:0,Se=de.semanticIntake?.applied?"semantic":de.semanticIntake?.code??"no-semantic";u([`已创建任务「${de.title??""}」(${de.taskId??""})`,`来源:${de.identitySource??"prd"}`,`解析:${ve}(${Se})`,Ce?`目标:${Ce.slice(0,120)}`:null,Te>0?`缺口 ${Te} 项待确认`:null].filter(Boolean).join(" · ")),d("interview")},[B,A,l,h,u,d,Tt,C,G]),Ht=[{id:"setup",label:"就绪检查"},{id:"import-prd",label:"导入需求"},{id:"interview",label:"需求访谈(可跳过)"},{id:"contract",label:"契约落地"},{id:"dag-confirm",label:"确认 DAG"},{id:"run",label:"运行"}],Rt=Ht.findIndex(je=>je.id===o);return{taskId:v,setTaskId:y,taskTitle:S,taskKind:C,setTaskKind:D,engineering:{allowedPathsText:B,forbiddenPathsText:A,verifyCommandsText:G},setEngineering:je=>{je.allowedPathsText!==void 0&&E(je.allowedPathsText),je.forbiddenPathsText!==void 0&&I(je.forbiddenPathsText),je.verifyCommandsText!==void 0&&K(je.verifyCommandsText)},workflowMeta:N,sessionId:$,question:ce,answerText:V,setAnswerText:Y,draftSummary:le,assessmentId:L,contractValidateOk:H,contractValidateSummary:Q,contractDiffSummary:R,contractApplied:w,spineOk:fe,applyInterviewPayload:Ne,runContractPreflight:$e,applyContractThenSpine:Pe,retrySpineOnly:at,confirmAndRunDag:sn,importPrdAndCreate:on,wizardSteps:Ht,stepIndex:Rt}}const hN={chat:"对话",tasks:"任务",recovery:"恢复",night:"夜间",models:"模型与认证",settings:"设置"};async function mN(t){return await import(t)}function pN(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 gN(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:pN(d),fingerprint:d.repoFingerprint??"",version:d.packageVersion??"",product:d.productName??d.product??"",inspectReady:d.inspect?.ready}:null}}function yN(t){const r=k.useRef(null),i=k.useRef(null),[l,o]=k.useState(!1),d=k.useMemo(()=>gN(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 mN("/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:hN[t.nav]}),c.jsx("button",{type:"button",onClick:()=>window.location.assign(t.inspectHref),children:"观测"}),c.jsx("span",{role:"status",children:"共享导航加载失败,请刷新页面"})]}):null]})}function vN(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 bN=[{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 xN(t){if(!t)return null;const r=Date.parse(t);return Number.isNaN(r)?t:new Date(r).toLocaleString()}function SN(t){const r=t.readinessReport?.state??t.readiness,i=t.readinessReport?.probe,l=i?.details??{},o=t.readinessReport?.blockedActions??[],d=xN(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:Mv[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:bN.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:Ov})]}):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 ey(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??"—")," · 风险=",zv[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 kN(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:["事实分类:",_v[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:sN(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:oN(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(ey,{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(ey,{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:["[",NE[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 wN(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:[Mv[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:Es(o.command)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"DAG 生命周期"}),c.jsx("dd",{children:Es(o.dag)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"最终验证"}),c.jsx("dd",{children:Es(o.verification)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"晋升"}),c.jsx("dd",{children:Es(o.promote)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"任务关闭"}),c.jsx("dd",{children:"不可用(MVP)"})]})]})]})]})}function CN(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 jN(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 TN(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),",最多 ",Fs," 个"]}),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 RN(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})," · 风险=",zv[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 EN(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:$s("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 NN(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:Ov})]})]}):c.jsxs("div",{className:"wizard-body","data-testid":"wizard-body",children:[h==="import-prd"&&c.jsx(TN,{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(RN,{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(CN,{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(jN,{busy:u,taskId:l.taskId,confirmationId:i.confirmationId,confirmationDetails:i.confirmationDetails,runAction:i.runAction,onConfirmAndRun:()=>{l.confirmAndRunDag()}}),h==="run"&&c.jsx(EN,{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 AN={};function IN(){const t=OE(),r=k.useRef(()=>{}),i=k.useCallback(v=>r.current(v),[]),l=ME({shell:t,applyInterviewPayload:i}),o=QE(),d=fN({shell:t,actions:l,prd:o}),u=dN({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=Sy(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=IS(window.location);if(v){h(v.workspace,v);return}const y=xy({env:AN?.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(yN,{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(vN,{opError:t.opError,opMessage:t.opMessage}),c.jsxs("main",{className:`console-main${t.nav==="chat"?" console-main--fill":""}`,children:[t.nav==="tasks"?c.jsx(NN,{shell:t,actions:l,wizard:d,prd:o,recovery:u}):null,t.nav==="recovery"?c.jsx(kN,{shell:t,recovery:u,wizard:d}):null,t.nav==="night"?c.jsx(j1,{busy:t.busy,runAction:l.runAction,isActionSuccess:l.isActionSuccess,setOpError:t.setOpError}):null,t.nav==="models"?c.jsx(SN,{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(RE,{origin:"",readiness:t.readiness,surface:"workspace",onNavigateWorkspace:h})]}):null,t.nav==="settings"?c.jsx(wN,{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(f1,{dagRunId:u.dagRunId.trim(),nodeId:u.fromNodeId.trim()||void 0,onClose:()=>u.setInspectSplitOpen(!1),onOpenFull:u.openFullInspect}):null]})]})})}const Gv=document.getElementById("root");if(!Gv)throw new Error("Loop Operator Console: #root missing");c1.createRoot(Gv).render(c.jsx(k.StrictMode,{children:c.jsx(IN,{})}));