@jamiexiongr/panda-hub 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagnostics-page-D4xGds9x.js","assets/diagnostics-page-BmzeM8p1.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagnostics-page-B2ynzqBC.js","assets/diagnostics-page-BmzeM8p1.css"])))=>i.map(i=>d[i]);
2
2
  var f4=n=>{throw TypeError(n)};var r1=(n,t,a)=>t.has(n)||f4("Cannot "+a);var L=(n,t,a)=>(r1(n,t,"read from private field"),a?a.call(n):t.get(n)),Je=(n,t,a)=>t.has(n)?f4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,a),ze=(n,t,a,r)=>(r1(n,t,"write to private field"),r?r.call(n,a):t.set(n,a),a),bt=(n,t,a)=>(r1(n,t,"access private method"),a);var df=(n,t,a,r)=>({set _(c){ze(n,t,c,a)},get _(){return L(n,t,r)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function a(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(c){if(c.ep)return;c.ep=!0;const u=a(c);fetch(c.href,u)}})();const cv="modulepreload",uv=function(n){return"/"+n},h4={},Rp=function(t,a,r){let c=Promise.resolve();if(a&&a.length>0){let h=function(m){return Promise.all(m.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),y=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=h(a.map(m=>{if(m=uv(m),m in h4)return;h4[m]=!0;const b=m.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=b?"stylesheet":cv,b||(x.as="script"),x.crossOrigin="",x.href=m,y&&x.setAttribute("nonce",y),document.head.appendChild(x),b)return new Promise((w,N)=>{x.addEventListener("load",w),x.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(h){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return c.then(h=>{for(const p of h||[])p.status==="rejected"&&u(p.reason);return t().catch(u)})};function dv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var l1={exports:{}},Jc={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -47,7 +47,7 @@ var f4=n=>{throw TypeError(n)};var r1=(n,t,a)=>t.has(n)||f4("Cannot "+a);var L=(
47
47
  `+O[o].replace(" at new "," at ");return e.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",e.displayName)),fe}while(1<=o&&0<=d);break}}}finally{Ue=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?Ge(i):""}function Lt(e,s){switch(e.tag){case 26:case 27:case 5:return Ge(e.type);case 16:return Ge("Lazy");case 13:return e.child!==s&&s!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return gt(e.type,!1);case 11:return gt(e.type.render,!1);case 1:return gt(e.type,!0);case 31:return Ge("Activity");default:return""}}function St(e){try{var s="",i=null;do s+=Lt(e,i),i=e,e=e.return;while(e);return s}catch(o){return`
48
48
  Error generating stack: `+o.message+`
49
49
  `+o.stack}}var st=Object.prototype.hasOwnProperty,tn=n.unstable_scheduleCallback,$t=n.unstable_cancelCallback,de=n.unstable_shouldYield,Ae=n.unstable_requestPaint,Re=n.unstable_now,Oe=n.unstable_getCurrentPriorityLevel,Ke=n.unstable_ImmediatePriority,mt=n.unstable_UserBlockingPriority,kt=n.unstable_NormalPriority,rn=n.unstable_LowPriority,Pn=n.unstable_IdlePriority,On=n.log,nn=n.unstable_setDisableYieldValue,ln=null,oe=null;function qe(e){if(typeof On=="function"&&nn(e),oe&&typeof oe.setStrictMode=="function")try{oe.setStrictMode(ln,e)}catch{}}var De=Math.clz32?Math.clz32:$e,Ie=Math.log,We=Math.LN2;function $e(e){return e>>>=0,e===0?32:31-(Ie(e)/We|0)|0}var He=256,Ee=262144,Ut=4194304;function at(e){var s=e&42;if(s!==0)return s;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 pn(e,s,i){var o=e.pendingLanes;if(o===0)return 0;var d=0,f=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var k=o&134217727;return k!==0?(o=k&~f,o!==0?d=at(o):(v&=k,v!==0?d=at(v):i||(i=k&~e,i!==0&&(d=at(i))))):(k=o&~f,k!==0?d=at(k):v!==0?d=at(v):i||(i=o&~e,i!==0&&(d=at(i)))),d===0?0:s!==0&&s!==d&&(s&f)===0&&(f=d&-d,i=s&-s,f>=i||f===32&&(i&4194048)!==0)?s:d}function Un(e,s){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&s)===0}function xn(e,s){switch(e){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 ps(){var e=Ut;return Ut<<=1,(Ut&62914560)===0&&(Ut=4194304),e}function gs(e){for(var s=[],i=0;31>i;i++)s.push(e);return s}function is(e,s){e.pendingLanes|=s,s!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ci(e,s,i,o,d,f){var v=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var k=e.entanglements,O=e.expirationTimes,J=e.hiddenUpdates;for(i=v&~i;0<i;){var fe=31-De(i),ve=1<<fe;k[fe]=0,O[fe]=-1;var se=J[fe];if(se!==null)for(J[fe]=null,fe=0;fe<se.length;fe++){var re=se[fe];re!==null&&(re.lane&=-536870913)}i&=~ve}o!==0&&la(e,o,0),f!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=f&~(v&~s))}function la(e,s,i){e.pendingLanes|=s,e.suspendedLanes&=~s;var o=31-De(s);e.entangledLanes|=s,e.entanglements[o]=e.entanglements[o]|1073741824|i&261930}function Gs(e,s){var i=e.entangledLanes|=s;for(e=e.entanglements;i;){var o=31-De(i),d=1<<o;d&s|e[o]&s&&(e[o]|=s),i&=~d}}function rs(e,s){var i=s&-s;return i=(i&42)!==0?1:xa(i),(i&(e.suspendedLanes|s))!==0?0:i}function xa(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 Vs(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ls(){var e=U.p;return e!==0?e:(e=window.event,e===void 0?32:i4(e.type))}function j(e,s){var i=U.p;try{return U.p=e,s()}finally{U.p=i}}var z=Math.random().toString(36).slice(2),ge="__reactFiber$"+z,we="__reactProps$"+z,ke="__reactContainer$"+z,Ve="__reactEvents$"+z,ct="__reactListeners$"+z,Nt="__reactHandles$"+z,qn="__reactResources$"+z,es="__reactMarker$"+z;function Ht(e){delete e[ge],delete e[we],delete e[Ve],delete e[ct],delete e[Nt]}function wn(e){var s=e[ge];if(s)return s;for(var i=e.parentNode;i;){if(s=i[ke]||i[ge]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(e=Hg(e);e!==null;){if(i=e[ge])return i;e=Hg(e)}return s}e=i,i=e.parentNode}return null}function kn(e){if(e=e[ge]||e[ke]){var s=e.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return e}return null}function Ln(e){var s=e.tag;if(s===5||s===26||s===27||s===6)return e.stateNode;throw Error(r(33))}function un(e){var s=e[qn];return s||(s=e[qn]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function B(e){e[es]=!0}var on=new Set,gn={};function yn(e,s){sn(e,s),sn(e+"Capture",s)}function sn(e,s){for(gn[e]=s,e=0;e<s.length;e++)on.add(s[e])}var Ft=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]*$"),Fa={},Rr={};function Qu(e){return st.call(Rr,e)?!0:st.call(Fa,e)?!1:Ft.test(e)?Rr[e]=!0:(Fa[e]=!0,!1)}function Sa(e,s,i){if(Qu(s))if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(s);return}}e.setAttribute(s,""+i)}}function Rl(e,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttribute(s,""+i)}}function oa(e,s,i,o){if(o===null)e.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(s,i,""+o)}}function $n(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dn(e){var s=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Qa(e,s,i){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,s);if(!e.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,f=o.set;return Object.defineProperty(e,s,{configurable:!0,get:function(){return d.call(this)},set:function(v){i=""+v,f.call(this,v)}}),Object.defineProperty(e,s,{enumerable:o.enumerable}),{getValue:function(){return i},setValue:function(v){i=""+v},stopTracking:function(){e._valueTracker=null,delete e[s]}}}}function Ti(e){if(!e._valueTracker){var s=dn(e)?"checked":"value";e._valueTracker=Qa(e,s,""+e[s])}}function Ga(e){if(!e)return!1;var s=e._valueTracker;if(!s)return!0;var i=s.getValue(),o="";return e&&(o=dn(e)?e.checked?"true":"false":e.value),e=o,e!==i?(s.setValue(e),!0):!1}function ja(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 Xo=/[\n"\\]/g;function ts(e){return e.replace(Xo,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Jo(e,s,i,o,d,f,v,k){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),s!=null?v==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+$n(s)):e.value!==""+$n(s)&&(e.value=""+$n(s)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),s!=null?ys(e,v,$n(s)):i!=null?ys(e,v,$n(i)):o!=null&&e.removeAttribute("value"),d==null&&f!=null&&(e.defaultChecked=!!f),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.name=""+$n(k):e.removeAttribute("name")}function Va(e,s,i,o,d,f,v,k){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),s!=null||i!=null){if(!(f!=="submit"&&f!=="reset"||s!=null)){Ti(e);return}i=i!=null?""+$n(i):"",s=s!=null?""+$n(s):i,k||s===e.value||(e.value=s),e.defaultValue=s}o=o??d,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=k?e.checked:!!o,e.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),Ti(e)}function ys(e,s,i){s==="number"&&ja(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Rs(e,s,i,o){if(e=e.options,s){s={};for(var d=0;d<i.length;d++)s["$"+i[d]]=!0;for(i=0;i<e.length;i++)d=s.hasOwnProperty("$"+e[i].value),e[i].selected!==d&&(e[i].selected=d),d&&o&&(e[i].defaultSelected=!0)}else{for(i=""+$n(i),s=null,d=0;d<e.length;d++){if(e[d].value===i){e[d].selected=!0,o&&(e[d].defaultSelected=!0);return}s!==null||e[d].disabled||(s=e[d])}s!==null&&(s.selected=!0)}}function vs(e,s,i){if(s!=null&&(s=""+$n(s),s!==e.value&&(e.value=s),i==null)){e.defaultValue!==s&&(e.defaultValue=s);return}e.defaultValue=i!=null?""+$n(i):""}function Al(e,s,i,o){if(s==null){if(o!=null){if(i!=null)throw Error(r(92));if(ue(o)){if(1<o.length)throw Error(r(93));o=o[0]}i=o}i==null&&(i=""),s=i}i=$n(s),e.defaultValue=i,o=e.textContent,o===i&&o!==""&&o!==null&&(e.value=o),Ti(e)}function ca(e,s){if(s){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=s;return}}e.textContent=s}var Gu=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 wa(e,s,i){var o=s.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?o?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="":o?e.setProperty(s,i):typeof i!="number"||i===0||Gu.has(s)?s==="float"?e.cssFloat=i:e[s]=(""+i).trim():e[s]=i+"px"}function Ar(e,s,i){if(s!=null&&typeof s!="object")throw Error(r(62));if(e=e.style,i!=null){for(var o in i)!i.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var d in s)o=s[d],s.hasOwnProperty(d)&&i[d]!==o&&wa(e,d,o)}else for(var f in s)s.hasOwnProperty(f)&&wa(e,f,s[f])}function Dl(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 ka=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"]]),Ol=/^[\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 ua(e){return Ol.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ks(){}var As=null;function fn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var da=null,Nn=null;function Ys(e){var s=kn(e);if(s&&(e=s.stateNode)){var i=e[we]||null;e:switch(e=s.stateNode,s.type){case"input":if(Jo(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),s=i.name,i.type==="radio"&&s!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+ts(""+s)+'"][type="radio"]'),s=0;s<i.length;s++){var o=i[s];if(o!==e&&o.form===e.form){var d=o[we]||null;if(!d)throw Error(r(90));Jo(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<i.length;s++)o=i[s],o.form===e.form&&Ga(o)}break e;case"textarea":vs(e,i.value,i.defaultValue);break e;case"select":s=i.value,s!=null&&Rs(e,!!i.multiple,s,!1)}}}var Ds=!1;function Dr(e,s,i){if(Ds)return e(s,i);Ds=!0;try{var o=e(s);return o}finally{if(Ds=!1,(da!==null||Nn!==null)&&($d(),da&&(s=da,e=Nn,Nn=da=null,Ys(s),e)))for(s=0;s<e.length;s++)Ys(e[s])}}function Na(e,s){var i=e.stateNode;if(i===null)return null;var o=i[we]||null;if(o===null)return null;i=o[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,s,typeof i));return i}var Zt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ei=!1;if(Zt)try{var Mi={};Object.defineProperty(Mi,"passive",{get:function(){Ei=!0}}),window.addEventListener("test",Mi,Mi),window.removeEventListener("test",Mi,Mi)}catch{Ei=!1}var Os=null,Or=null,fa=null;function ec(){if(fa)return fa;var e,s=Or,i=s.length,o,d="value"in Os?Os.value:Os.textContent,f=d.length;for(e=0;e<i&&s[e]===d[e];e++);var v=i-e;for(o=1;o<=v&&s[i-o]===d[f-o];o++);return fa=d.slice(e,1<o?1-o:void 0)}function Ka(e){var s=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&s===13&&(e=13)):e=s,e===10&&(e=13),32<=e||e===13?e:0}function Lr(){return!0}function Ir(){return!1}function Hn(e){function s(i,o,d,f,v){this._reactName=i,this._targetInst=d,this.type=o,this.nativeEvent=f,this.target=v,this.currentTarget=null;for(var k in e)e.hasOwnProperty(k)&&(i=e[k],this[k]=i?i(f):f[k]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Lr:Ir,this.isPropagationStopped=Ir,this}return g(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Lr)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Lr)},persist:function(){},isPersistent:Lr}),s}var Ca={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zr=Hn(Ca),Br=g({},Ca,{view:0,detail:0}),Ya=Hn(Br),tc,nc,Pr,Ta=g({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zl,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!==Pr&&(Pr&&e.type==="mousemove"?(tc=e.screenX-Pr.screenX,nc=e.screenY-Pr.screenY):nc=tc=0,Pr=e),tc)},movementY:function(e){return"movementY"in e?e.movementY:nc}}),Vu=Hn(Ta),ch=g({},Ta,{dataTransfer:0}),Ll=Hn(ch),Ls=g({},Br,{relatedTarget:0}),Il=Hn(Ls),uh=g({},Ca,{animationName:0,elapsedTime:0,pseudoElement:0}),dh=Hn(uh),fh=g({},Ca,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),hh=Hn(fh),Is=g({},Ca,{data:0}),Ku=Hn(Is),Yu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mh={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"},ph={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gh(e){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(e):(e=ph[e])?!!s[e]:!1}function zl(){return gh}var yh=g({},Br,{key:function(e){if(e.key){var s=Yu[e.key]||e.key;if(s!=="Unidentified")return s}return e.type==="keypress"?(e=Ka(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?mh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zl,charCode:function(e){return e.type==="keypress"?Ka(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ka(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Kn=Hn(yh),sc=g({},Ta,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bl=Hn(sc),vh=g({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zl}),_h=Hn(vh),bh=g({},Ca,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pl=Hn(bh),_s=g({},Ta,{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}),Zs=Hn(_s),Za=g({},Ca,{newState:0,oldState:0}),Zu=Hn(Za),ac=[9,13,27,32],Ur=Zt&&"CompositionEvent"in window,Ea=null;Zt&&"documentMode"in document&&(Ea=document.documentMode);var ic=Zt&&"TextEvent"in window&&!Ea,Ma=Zt&&(!Ur||Ea&&8<Ea&&11>=Ea),Wu=" ",Ri=!1;function Xu(e,s){switch(e){case"keyup":return ac.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ai=!1;function Ju(e,s){switch(e){case"compositionend":return rc(s);case"keypress":return s.which!==32?null:(Ri=!0,Wu);case"textInput":return e=s.data,e===Wu&&Ri?null:e;default:return null}}function ed(e,s){if(Ai)return e==="compositionend"||!Ur&&Xu(e,s)?(e=ec(),fa=Or=Os=null,Ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ma&&s.locale!=="ko"?null:s.data;default:return null}}var Ra={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 lc(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s==="input"?!!Ra[e.type]:s==="textarea"}function oc(e,s,i,o){da?Nn?Nn.push(o):Nn=[o]:da=o,s=Yd(s,"onChange"),0<s.length&&(i=new zr("onChange","change",null,i,o),e.push({event:i,listeners:s}))}var Di=null,Oi=null;function xh(e){Eg(e,0)}function Ul(e){var s=Ln(e);if(Ga(s))return e}function td(e,s){if(e==="change")return s}var nd=!1;if(Zt){var ql;if(Zt){var cc="oninput"in document;if(!cc){var sd=document.createElement("div");sd.setAttribute("oninput","return;"),cc=typeof sd.oninput=="function"}ql=cc}else ql=!1;nd=ql&&(!document.documentMode||9<document.documentMode)}function ad(){Di&&(Di.detachEvent("onpropertychange",id),Oi=Di=null)}function id(e){if(e.propertyName==="value"&&Ul(Oi)){var s=[];oc(s,Oi,e,fn(e)),Dr(xh,s)}}function Sh(e,s,i){e==="focusin"?(ad(),Di=s,Oi=i,Di.attachEvent("onpropertychange",id)):e==="focusout"&&ad()}function jh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ul(Oi)}function wh(e,s){if(e==="click")return Ul(s)}function kh(e,s){if(e==="input"||e==="change")return Ul(s)}function Nh(e,s){return e===s&&(e!==0||1/e===1/s)||e!==e&&s!==s}var Cn=typeof Object.is=="function"?Object.is:Nh;function qr(e,s){if(Cn(e,s))return!0;if(typeof e!="object"||e===null||typeof s!="object"||s===null)return!1;var i=Object.keys(e),o=Object.keys(s);if(i.length!==o.length)return!1;for(o=0;o<i.length;o++){var d=i[o];if(!st.call(s,d)||!Cn(e[d],s[d]))return!1}return!0}function rd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ld(e,s){var i=rd(e);e=0;for(var o;i;){if(i.nodeType===3){if(o=e+i.textContent.length,e<=s&&o>=s)return{node:i,offset:s-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=rd(i)}}function od(e,s){return e&&s?e===s?!0:e&&e.nodeType===3?!1:s&&s.nodeType===3?od(e,s.parentNode):"contains"in e?e.contains(s):e.compareDocumentPosition?!!(e.compareDocumentPosition(s)&16):!1:!1}function cd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var s=ja(e.document);s instanceof e.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)e=s.contentWindow;else break;s=ja(e.document)}return s}function uc(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s&&(s==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||s==="textarea"||e.contentEditable==="true")}var Ch=Zt&&"documentMode"in document&&11>=document.documentMode,Li=null,dc=null,$r=null,$l=!1;function fc(e,s,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;$l||Li==null||Li!==ja(o)||(o=Li,"selectionStart"in o&&uc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),$r&&qr($r,o)||($r=o,o=Yd(dc,"onSelect"),0<o.length&&(s=new zr("onSelect","select",null,s,i),e.push({event:s,listeners:o}),s.target=Li)))}function Aa(e,s){var i={};return i[e.toLowerCase()]=s.toLowerCase(),i["Webkit"+e]="webkit"+s,i["Moz"+e]="moz"+s,i}var Ii={animationend:Aa("Animation","AnimationEnd"),animationiteration:Aa("Animation","AnimationIteration"),animationstart:Aa("Animation","AnimationStart"),transitionrun:Aa("Transition","TransitionRun"),transitionstart:Aa("Transition","TransitionStart"),transitioncancel:Aa("Transition","TransitionCancel"),transitionend:Aa("Transition","TransitionEnd")},Hl={},hc={};Zt&&(hc=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function Da(e){if(Hl[e])return Hl[e];if(!Ii[e])return e;var s=Ii[e],i;for(i in s)if(s.hasOwnProperty(i)&&i in hc)return Hl[e]=s[i];return e}var mc=Da("animationend"),pc=Da("animationiteration"),gc=Da("animationstart"),ud=Da("transitionrun"),Th=Da("transitionstart"),Eh=Da("transitioncancel"),dd=Da("transitionend"),yc=new Map,Fl="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(" ");Fl.push("scrollEnd");function zs(e,s){yc.set(e,s),yn(s,[e])}var Ql=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=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(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},bs=[],Wa=0,fd=0;function Hr(){for(var e=Wa,s=fd=Wa=0;s<e;){var i=bs[s];bs[s++]=null;var o=bs[s];bs[s++]=null;var d=bs[s];bs[s++]=null;var f=bs[s];if(bs[s++]=null,o!==null&&d!==null){var v=o.pending;v===null?d.next=d:(d.next=v.next,v.next=d),o.pending=d}f!==0&&vc(i,d,f)}}function Fr(e,s,i,o){bs[Wa++]=e,bs[Wa++]=s,bs[Wa++]=i,bs[Wa++]=o,fd|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Gl(e,s,i,o){return Fr(e,s,i,o),Qr(e)}function Oa(e,s){return Fr(e,null,null,s),Qr(e)}function vc(e,s,i){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i);for(var d=!1,f=e.return;f!==null;)f.childLanes|=i,o=f.alternate,o!==null&&(o.childLanes|=i),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(d=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,d&&s!==null&&(d=31-De(i),e=f.hiddenUpdates,o=e[d],o===null?e[d]=[s]:o.push(s),s.lane=i|536870912),f):null}function Qr(e){if(50<$c)throw $c=0,Mm=null,Error(r(185));for(var s=e.return;s!==null;)e=s,s=e.return;return e.tag===3?e.stateNode:null}var Xa={};function hd(e,s,i,o){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ns(e,s,i,o){return new hd(e,s,i,o)}function Vl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ws(e,s){var i=e.alternate;return i===null?(i=ns(e.tag,s,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=s,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,s=e.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function _c(e,s){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=s,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,s=i.dependencies,e.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),e}function Gr(e,s,i,o,d,f){var v=0;if(o=e,typeof e=="function")Vl(e)&&(v=1);else if(typeof e=="string")v=W5(e,i,V.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=ns(31,i,s,d),e.elementType=ee,e.lanes=f,e;case T:return La(i.children,d,f,s);case C:v=8,d|=24;break;case I:return e=ns(12,i,s,d|2),e.elementType=I,e.lanes=f,e;case Q:return e=ns(13,i,s,d),e.elementType=Q,e.lanes=f,e;case ce:return e=ns(19,i,s,d),e.elementType=ce,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:v=10;break e;case $:v=9;break e;case R:v=11;break e;case Z:v=14;break e;case ie:v=16,o=null;break e}v=29,i=Error(r(130,e===null?"null":typeof e,"")),o=null}return s=ns(v,i,s,d),s.elementType=e,s.type=o,s.lanes=f,s}function La(e,s,i,o){return e=ns(7,e,o,s),e.lanes=i,e}function Kl(e,s,i){return e=ns(6,e,null,s),e.lanes=i,e}function bc(e){var s=ns(18,null,null,0);return s.stateNode=e,s}function Yl(e,s,i){return s=ns(4,e.children!==null?e.children:[],e.key,s),s.lanes=i,s.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},s}var S=new WeakMap;function D(e,s){if(typeof e=="object"&&e!==null){var i=S.get(e);return i!==void 0?i:(s={value:e,source:s,stack:St(s)},S.set(e,s),s)}return{value:e,source:s,stack:St(s)}}var K=[],le=0,et=null,Ye=0,pt=[],ot=0,Fn=null,Bs=1,Ps="";function Xs(e,s){K[le++]=Ye,K[le++]=et,et=e,Ye=s}function xc(e,s,i){pt[ot++]=Bs,pt[ot++]=Ps,pt[ot++]=Fn,Fn=e;var o=Bs;e=Ps;var d=32-De(o)-1;o&=~(1<<d),i+=1;var f=32-De(s)+d;if(30<f){var v=d-d%5;f=(o&(1<<v)-1).toString(32),o>>=v,d-=v,Bs=1<<32-De(s)+d|i<<d|o,Ps=f+e}else Bs=1<<f|i<<d|o,Ps=e}function Zl(e){e.return!==null&&(Xs(e,1),xc(e,1,0))}function Wl(e){for(;e===et;)et=K[--le],K[le]=null,Ye=K[--le],K[le]=null;for(;e===Fn;)Fn=pt[--ot],pt[ot]=null,Ps=pt[--ot],pt[ot]=null,Bs=pt[--ot],pt[ot]=null}function Sc(e,s){pt[ot++]=Bs,pt[ot++]=Ps,pt[ot++]=Fn,Bs=s.id,Ps=s.overflow,Fn=e}var Tn=null,Wt=null,jt=!1,ha=null,os=!1,Xl=Error(r(519));function ma(e){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw cs(D(s,e)),Xl}function it(e){var s=e.stateNode,i=e.type,o=e.memoizedProps;switch(s[ge]=e,s[we]=o,i){case"dialog":Tt("cancel",s),Tt("close",s);break;case"iframe":case"object":case"embed":Tt("load",s);break;case"video":case"audio":for(i=0;i<Fc.length;i++)Tt(Fc[i],s);break;case"source":Tt("error",s);break;case"img":case"image":case"link":Tt("error",s),Tt("load",s);break;case"details":Tt("toggle",s);break;case"input":Tt("invalid",s),Va(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Tt("invalid",s);break;case"textarea":Tt("invalid",s),Al(s,o.value,o.defaultValue,o.children)}i=o.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||s.textContent===""+i||o.suppressHydrationWarning===!0||Dg(s.textContent,i)?(o.popover!=null&&(Tt("beforetoggle",s),Tt("toggle",s)),o.onScroll!=null&&Tt("scroll",s),o.onScrollEnd!=null&&Tt("scrollend",s),o.onClick!=null&&(s.onclick=Ks),s=!0):s=!1,s||ma(e,!0)}function Qt(e){for(Tn=e.return;Tn;)switch(Tn.tag){case 5:case 31:case 13:os=!1;return;case 27:case 3:os=!0;return;default:Tn=Tn.return}}function wt(e){if(e!==Tn)return!1;if(!jt)return Qt(e),jt=!0,!1;var s=e.tag,i;if((i=s!==3&&s!==27)&&((i=s===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Qm(e.type,e.memoizedProps)),i=!i),i&&Wt&&ma(e),Qt(e),s===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Wt=$g(e)}else if(s===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Wt=$g(e)}else s===27?(s=Wt,Zi(e.type)?(e=Zm,Zm=null,Wt=e):Wt=s):Wt=Tn?ea(e.stateNode.nextSibling):null;return!0}function Ot(){Wt=Tn=null,jt=!1}function Gt(){var e=ha;return e!==null&&(ws===null?ws=e:ws.push.apply(ws,e),ha=null),e}function cs(e){ha===null?ha=[e]:ha.push(e)}var Vr=A(null),pa=null,Ja=null;function zi(e,s,i){be(Vr,s._currentValue),s._currentValue=i}function ei(e){e._currentValue=Vr.current,ne(Vr)}function Mh(e,s,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&s)!==s?(e.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),e===i)break;e=e.return}}function Rh(e,s,i,o){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var f=d.dependencies;if(f!==null){var v=d.child;f=f.firstContext;e:for(;f!==null;){var k=f;f=d;for(var O=0;O<s.length;O++)if(k.context===s[O]){f.lanes|=i,k=f.alternate,k!==null&&(k.lanes|=i),Mh(f.return,i,e),o||(v=null);break e}f=k.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(r(341));v.lanes|=i,f=v.alternate,f!==null&&(f.lanes|=i),Mh(v,i,e),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===e){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function Jl(e,s,i,o){e=null;for(var d=s,f=!1;d!==null;){if(!f){if((d.flags&524288)!==0)f=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(r(387));if(v=v.memoizedProps,v!==null){var k=d.type;Cn(d.pendingProps.value,v.value)||(e!==null?e.push(k):e=[k])}}else if(d===Le.current){if(v=d.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Yc):e=[Yc])}d=d.return}e!==null&&Rh(s,e,i,o),s.flags|=262144}function md(e){for(e=e.firstContext;e!==null;){if(!Cn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Kr(e){pa=e,Ja=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yn(e){return v0(pa,e)}function pd(e,s){return pa===null&&Kr(e),v0(e,s)}function v0(e,s){var i=s._currentValue;if(s={context:s,memoizedValue:i,next:null},Ja===null){if(e===null)throw Error(r(308));Ja=s,e.dependencies={lanes:0,firstContext:s},e.flags|=524288}else Ja=Ja.next=s;return i}var Vy=typeof AbortController<"u"?AbortController:function(){var e=[],s=this.signal={aborted:!1,addEventListener:function(i,o){e.push(o)}};this.abort=function(){s.aborted=!0,e.forEach(function(i){return i()})}},Ky=n.unstable_scheduleCallback,Yy=n.unstable_NormalPriority,En={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ah(){return{controller:new Vy,data:new Map,refCount:0}}function jc(e){e.refCount--,e.refCount===0&&Ky(Yy,function(){e.controller.abort()})}var wc=null,Dh=0,eo=0,to=null;function Zy(e,s){if(wc===null){var i=wc=[];Dh=0,eo=Im(),to={status:"pending",value:void 0,then:function(o){i.push(o)}}}return Dh++,s.then(_0,_0),s}function _0(){if(--Dh===0&&wc!==null){to!==null&&(to.status="fulfilled");var e=wc;wc=null,eo=0,to=null;for(var s=0;s<e.length;s++)(0,e[s])()}}function Wy(e,s){var i=[],o={status:"pending",value:null,reason:null,then:function(d){i.push(d)}};return e.then(function(){o.status="fulfilled",o.value=s;for(var d=0;d<i.length;d++)(0,i[d])(s)},function(d){for(o.status="rejected",o.reason=d,d=0;d<i.length;d++)(0,i[d])(void 0)}),o}var b0=E.S;E.S=function(e,s){sg=Re(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Zy(e,s),b0!==null&&b0(e,s)};var Yr=A(null);function Oh(){var e=Yr.current;return e!==null?e:an.pooledCache}function gd(e,s){s===null?be(Yr,Yr.current):be(Yr,s.pool)}function x0(){var e=Oh();return e===null?null:{parent:En._currentValue,pool:e}}var no=Error(r(460)),Lh=Error(r(474)),yd=Error(r(542)),vd={then:function(){}};function S0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function j0(e,s,i){switch(i=e[i],i===void 0?e.push(s):i!==s&&(s.then(Ks,Ks),s=i),s.status){case"fulfilled":return s.value;case"rejected":throw e=s.reason,k0(e),e;default:if(typeof s.status=="string")s.then(Ks,Ks);else{if(e=an,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=s,e.status="pending",e.then(function(o){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=o}},function(o){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw e=s.reason,k0(e),e}throw Wr=s,no}}function Zr(e){try{var s=e._init;return s(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Wr=i,no):i}}var Wr=null;function w0(){if(Wr===null)throw Error(r(459));var e=Wr;return Wr=null,e}function k0(e){if(e===no||e===yd)throw Error(r(483))}var so=null,kc=0;function _d(e){var s=kc;return kc+=1,so===null&&(so=[]),j0(so,e,s)}function Nc(e,s){s=s.props.ref,e.ref=s!==void 0?s:null}function bd(e,s){throw s.$$typeof===x?Error(r(525)):(e=Object.prototype.toString.call(s),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":e)))}function N0(e){function s(G,P){if(e){var X=G.deletions;X===null?(G.deletions=[P],G.flags|=16):X.push(P)}}function i(G,P){if(!e)return null;for(;P!==null;)s(G,P),P=P.sibling;return null}function o(G){for(var P=new Map;G!==null;)G.key!==null?P.set(G.key,G):P.set(G.index,G),G=G.sibling;return P}function d(G,P){return G=Ws(G,P),G.index=0,G.sibling=null,G}function f(G,P,X){return G.index=X,e?(X=G.alternate,X!==null?(X=X.index,X<P?(G.flags|=67108866,P):X):(G.flags|=67108866,P)):(G.flags|=1048576,P)}function v(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function k(G,P,X,ye){return P===null||P.tag!==6?(P=Kl(X,G.mode,ye),P.return=G,P):(P=d(P,X),P.return=G,P)}function O(G,P,X,ye){var tt=X.type;return tt===T?fe(G,P,X.props.children,ye,X.key):P!==null&&(P.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===ie&&Zr(tt)===P.type)?(P=d(P,X.props),Nc(P,X),P.return=G,P):(P=Gr(X.type,X.key,X.props,null,G.mode,ye),Nc(P,X),P.return=G,P)}function J(G,P,X,ye){return P===null||P.tag!==4||P.stateNode.containerInfo!==X.containerInfo||P.stateNode.implementation!==X.implementation?(P=Yl(X,G.mode,ye),P.return=G,P):(P=d(P,X.children||[]),P.return=G,P)}function fe(G,P,X,ye,tt){return P===null||P.tag!==7?(P=La(X,G.mode,ye,tt),P.return=G,P):(P=d(P,X),P.return=G,P)}function ve(G,P,X){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=Kl(""+P,G.mode,X),P.return=G,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case w:return X=Gr(P.type,P.key,P.props,null,G.mode,X),Nc(X,P),X.return=G,X;case N:return P=Yl(P,G.mode,X),P.return=G,P;case ie:return P=Zr(P),ve(G,P,X)}if(ue(P)||_e(P))return P=La(P,G.mode,X,null),P.return=G,P;if(typeof P.then=="function")return ve(G,_d(P),X);if(P.$$typeof===H)return ve(G,pd(G,P),X);bd(G,P)}return null}function se(G,P,X,ye){var tt=P!==null?P.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return tt!==null?null:k(G,P,""+X,ye);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case w:return X.key===tt?O(G,P,X,ye):null;case N:return X.key===tt?J(G,P,X,ye):null;case ie:return X=Zr(X),se(G,P,X,ye)}if(ue(X)||_e(X))return tt!==null?null:fe(G,P,X,ye,null);if(typeof X.then=="function")return se(G,P,_d(X),ye);if(X.$$typeof===H)return se(G,P,pd(G,X),ye);bd(G,X)}return null}function re(G,P,X,ye,tt){if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return G=G.get(X)||null,k(P,G,""+ye,tt);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case w:return G=G.get(ye.key===null?X:ye.key)||null,O(P,G,ye,tt);case N:return G=G.get(ye.key===null?X:ye.key)||null,J(P,G,ye,tt);case ie:return ye=Zr(ye),re(G,P,X,ye,tt)}if(ue(ye)||_e(ye))return G=G.get(X)||null,fe(P,G,ye,tt,null);if(typeof ye.then=="function")return re(G,P,X,_d(ye),tt);if(ye.$$typeof===H)return re(G,P,X,pd(P,ye),tt);bd(P,ye)}return null}function Fe(G,P,X,ye){for(var tt=null,It=null,Ze=P,_t=P=0,Mt=null;Ze!==null&&_t<X.length;_t++){Ze.index>_t?(Mt=Ze,Ze=null):Mt=Ze.sibling;var zt=se(G,Ze,X[_t],ye);if(zt===null){Ze===null&&(Ze=Mt);break}e&&Ze&&zt.alternate===null&&s(G,Ze),P=f(zt,P,_t),It===null?tt=zt:It.sibling=zt,It=zt,Ze=Mt}if(_t===X.length)return i(G,Ze),jt&&Xs(G,_t),tt;if(Ze===null){for(;_t<X.length;_t++)Ze=ve(G,X[_t],ye),Ze!==null&&(P=f(Ze,P,_t),It===null?tt=Ze:It.sibling=Ze,It=Ze);return jt&&Xs(G,_t),tt}for(Ze=o(Ze);_t<X.length;_t++)Mt=re(Ze,G,_t,X[_t],ye),Mt!==null&&(e&&Mt.alternate!==null&&Ze.delete(Mt.key===null?_t:Mt.key),P=f(Mt,P,_t),It===null?tt=Mt:It.sibling=Mt,It=Mt);return e&&Ze.forEach(function(tr){return s(G,tr)}),jt&&Xs(G,_t),tt}function lt(G,P,X,ye){if(X==null)throw Error(r(151));for(var tt=null,It=null,Ze=P,_t=P=0,Mt=null,zt=X.next();Ze!==null&&!zt.done;_t++,zt=X.next()){Ze.index>_t?(Mt=Ze,Ze=null):Mt=Ze.sibling;var tr=se(G,Ze,zt.value,ye);if(tr===null){Ze===null&&(Ze=Mt);break}e&&Ze&&tr.alternate===null&&s(G,Ze),P=f(tr,P,_t),It===null?tt=tr:It.sibling=tr,It=tr,Ze=Mt}if(zt.done)return i(G,Ze),jt&&Xs(G,_t),tt;if(Ze===null){for(;!zt.done;_t++,zt=X.next())zt=ve(G,zt.value,ye),zt!==null&&(P=f(zt,P,_t),It===null?tt=zt:It.sibling=zt,It=zt);return jt&&Xs(G,_t),tt}for(Ze=o(Ze);!zt.done;_t++,zt=X.next())zt=re(Ze,G,_t,zt.value,ye),zt!==null&&(e&&zt.alternate!==null&&Ze.delete(zt.key===null?_t:zt.key),P=f(zt,P,_t),It===null?tt=zt:It.sibling=zt,It=zt);return e&&Ze.forEach(function(ov){return s(G,ov)}),jt&&Xs(G,_t),tt}function en(G,P,X,ye){if(typeof X=="object"&&X!==null&&X.type===T&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case w:e:{for(var tt=X.key;P!==null;){if(P.key===tt){if(tt=X.type,tt===T){if(P.tag===7){i(G,P.sibling),ye=d(P,X.props.children),ye.return=G,G=ye;break e}}else if(P.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===ie&&Zr(tt)===P.type){i(G,P.sibling),ye=d(P,X.props),Nc(ye,X),ye.return=G,G=ye;break e}i(G,P);break}else s(G,P);P=P.sibling}X.type===T?(ye=La(X.props.children,G.mode,ye,X.key),ye.return=G,G=ye):(ye=Gr(X.type,X.key,X.props,null,G.mode,ye),Nc(ye,X),ye.return=G,G=ye)}return v(G);case N:e:{for(tt=X.key;P!==null;){if(P.key===tt)if(P.tag===4&&P.stateNode.containerInfo===X.containerInfo&&P.stateNode.implementation===X.implementation){i(G,P.sibling),ye=d(P,X.children||[]),ye.return=G,G=ye;break e}else{i(G,P);break}else s(G,P);P=P.sibling}ye=Yl(X,G.mode,ye),ye.return=G,G=ye}return v(G);case ie:return X=Zr(X),en(G,P,X,ye)}if(ue(X))return Fe(G,P,X,ye);if(_e(X)){if(tt=_e(X),typeof tt!="function")throw Error(r(150));return X=tt.call(X),lt(G,P,X,ye)}if(typeof X.then=="function")return en(G,P,_d(X),ye);if(X.$$typeof===H)return en(G,P,pd(G,X),ye);bd(G,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,P!==null&&P.tag===6?(i(G,P.sibling),ye=d(P,X),ye.return=G,G=ye):(i(G,P),ye=Kl(X,G.mode,ye),ye.return=G,G=ye),v(G)):i(G,P)}return function(G,P,X,ye){try{kc=0;var tt=en(G,P,X,ye);return so=null,tt}catch(Ze){if(Ze===no||Ze===yd)throw Ze;var It=ns(29,Ze,null,G.mode);return It.lanes=ye,It.return=G,It}finally{}}}var Xr=N0(!0),C0=N0(!1),Bi=!1;function Ih(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zh(e,s){e=e.updateQueue,s.updateQueue===e&&(s.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Pi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ui(e,s,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Pt&2)!==0){var d=o.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),o.pending=s,s=Qr(e),vc(e,null,i),s}return Fr(e,o,s,i),Qr(e)}function Cc(e,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194048)!==0)){var o=s.lanes;o&=e.pendingLanes,i|=o,s.lanes=i,Gs(e,i)}}function Bh(e,s){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var d=null,f=null;if(i=i.firstBaseUpdate,i!==null){do{var v={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};f===null?d=f=v:f=f.next=v,i=i.next}while(i!==null);f===null?d=f=s:f=f.next=s}else d=f=s;i={baseState:o.baseState,firstBaseUpdate:d,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=s:e.next=s,i.lastBaseUpdate=s}var Ph=!1;function Tc(){if(Ph){var e=to;if(e!==null)throw e}}function Ec(e,s,i,o){Ph=!1;var d=e.updateQueue;Bi=!1;var f=d.firstBaseUpdate,v=d.lastBaseUpdate,k=d.shared.pending;if(k!==null){d.shared.pending=null;var O=k,J=O.next;O.next=null,v===null?f=J:v.next=J,v=O;var fe=e.alternate;fe!==null&&(fe=fe.updateQueue,k=fe.lastBaseUpdate,k!==v&&(k===null?fe.firstBaseUpdate=J:k.next=J,fe.lastBaseUpdate=O))}if(f!==null){var ve=d.baseState;v=0,fe=J=O=null,k=f;do{var se=k.lane&-536870913,re=se!==k.lane;if(re?(Et&se)===se:(o&se)===se){se!==0&&se===eo&&(Ph=!0),fe!==null&&(fe=fe.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Fe=e,lt=k;se=s;var en=i;switch(lt.tag){case 1:if(Fe=lt.payload,typeof Fe=="function"){ve=Fe.call(en,ve,se);break e}ve=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=lt.payload,se=typeof Fe=="function"?Fe.call(en,ve,se):Fe,se==null)break e;ve=g({},ve,se);break e;case 2:Bi=!0}}se=k.callback,se!==null&&(e.flags|=64,re&&(e.flags|=8192),re=d.callbacks,re===null?d.callbacks=[se]:re.push(se))}else re={lane:se,tag:k.tag,payload:k.payload,callback:k.callback,next:null},fe===null?(J=fe=re,O=ve):fe=fe.next=re,v|=se;if(k=k.next,k===null){if(k=d.shared.pending,k===null)break;re=k,k=re.next,re.next=null,d.lastBaseUpdate=re,d.shared.pending=null}}while(!0);fe===null&&(O=ve),d.baseState=O,d.firstBaseUpdate=J,d.lastBaseUpdate=fe,f===null&&(d.shared.lanes=0),Qi|=v,e.lanes=v,e.memoizedState=ve}}function T0(e,s){if(typeof e!="function")throw Error(r(191,e));e.call(s)}function E0(e,s){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)T0(i[e],s)}var ao=A(null),xd=A(0);function M0(e,s){e=ci,be(xd,e),be(ao,s),ci=e|s.baseLanes}function Uh(){be(xd,ci),be(ao,ao.current)}function qh(){ci=xd.current,ne(ao),ne(xd)}var Us=A(null),Js=null;function qi(e){var s=e.alternate;be(Sn,Sn.current&1),be(Us,e),Js===null&&(s===null||ao.current!==null||s.memoizedState!==null)&&(Js=e)}function $h(e){be(Sn,Sn.current),be(Us,e),Js===null&&(Js=e)}function R0(e){e.tag===22?(be(Sn,Sn.current),be(Us,e),Js===null&&(Js=e)):$i()}function $i(){be(Sn,Sn.current),be(Us,Us.current)}function qs(e){ne(Us),Js===e&&(Js=null),ne(Sn)}var Sn=A(0);function Sd(e){for(var s=e;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Km(i)||Ym(i)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ti=0,yt=null,Xt=null,Mn=null,jd=!1,io=!1,Jr=!1,wd=0,Mc=0,ro=null,Xy=0;function vn(){throw Error(r(321))}function Hh(e,s){if(s===null)return!1;for(var i=0;i<s.length&&i<e.length;i++)if(!Cn(e[i],s[i]))return!1;return!0}function Fh(e,s,i,o,d,f){return ti=f,yt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,E.H=e===null||e.memoizedState===null?m8:im,Jr=!1,f=i(o,d),Jr=!1,io&&(f=D0(s,i,o,d)),A0(e),f}function A0(e){E.H=Dc;var s=Xt!==null&&Xt.next!==null;if(ti=0,Mn=Xt=yt=null,jd=!1,Mc=0,ro=null,s)throw Error(r(300));e===null||Rn||(e=e.dependencies,e!==null&&md(e)&&(Rn=!0))}function D0(e,s,i,o){yt=e;var d=0;do{if(io&&(ro=null),Mc=0,io=!1,25<=d)throw Error(r(301));if(d+=1,Mn=Xt=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}E.H=p8,f=s(i,o)}while(io);return f}function Jy(){var e=E.H,s=e.useState()[0];return s=typeof s.then=="function"?Rc(s):s,e=e.useState()[0],(Xt!==null?Xt.memoizedState:null)!==e&&(yt.flags|=1024),s}function Qh(){var e=wd!==0;return wd=0,e}function Gh(e,s,i){s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~i}function Vh(e){if(jd){for(e=e.memoizedState;e!==null;){var s=e.queue;s!==null&&(s.pending=null),e=e.next}jd=!1}ti=0,Mn=Xt=yt=null,io=!1,Mc=wd=0,ro=null}function us(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mn===null?yt.memoizedState=Mn=e:Mn=Mn.next=e,Mn}function jn(){if(Xt===null){var e=yt.alternate;e=e!==null?e.memoizedState:null}else e=Xt.next;var s=Mn===null?yt.memoizedState:Mn.next;if(s!==null)Mn=s,Xt=e;else{if(e===null)throw yt.alternate===null?Error(r(467)):Error(r(310));Xt=e,e={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},Mn===null?yt.memoizedState=Mn=e:Mn=Mn.next=e}return Mn}function kd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rc(e){var s=Mc;return Mc+=1,ro===null&&(ro=[]),e=j0(ro,e,s),s=yt,(Mn===null?s.memoizedState:Mn.next)===null&&(s=s.alternate,E.H=s===null||s.memoizedState===null?m8:im),e}function Nd(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Rc(e);if(e.$$typeof===H)return Yn(e)}throw Error(r(438,String(e)))}function Kh(e){var s=null,i=yt.updateQueue;if(i!==null&&(s=i.memoCache),s==null){var o=yt.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),i===null&&(i=kd(),yt.updateQueue=i),i.memoCache=s,i=s.data[s.index],i===void 0)for(i=s.data[s.index]=Array(e),o=0;o<e;o++)i[o]=Y;return s.index++,i}function ni(e,s){return typeof s=="function"?s(e):s}function Cd(e){var s=jn();return Yh(s,Xt,e)}function Yh(e,s,i){var o=e.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var d=e.baseQueue,f=o.pending;if(f!==null){if(d!==null){var v=d.next;d.next=f.next,f.next=v}s.baseQueue=d=f,o.pending=null}if(f=e.baseState,d===null)e.memoizedState=f;else{s=d.next;var k=v=null,O=null,J=s,fe=!1;do{var ve=J.lane&-536870913;if(ve!==J.lane?(Et&ve)===ve:(ti&ve)===ve){var se=J.revertLane;if(se===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ve===eo&&(fe=!0);else if((ti&se)===se){J=J.next,se===eo&&(fe=!0);continue}else ve={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(k=O=ve,v=f):O=O.next=ve,yt.lanes|=se,Qi|=se;ve=J.action,Jr&&i(f,ve),f=J.hasEagerState?J.eagerState:i(f,ve)}else se={lane:ve,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(k=O=se,v=f):O=O.next=se,yt.lanes|=ve,Qi|=ve;J=J.next}while(J!==null&&J!==s);if(O===null?v=f:O.next=k,!Cn(f,e.memoizedState)&&(Rn=!0,fe&&(i=to,i!==null)))throw i;e.memoizedState=f,e.baseState=v,e.baseQueue=O,o.lastRenderedState=f}return d===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Zh(e){var s=jn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var o=i.dispatch,d=i.pending,f=s.memoizedState;if(d!==null){i.pending=null;var v=d=d.next;do f=e(f,v.action),v=v.next;while(v!==d);Cn(f,s.memoizedState)||(Rn=!0),s.memoizedState=f,s.baseQueue===null&&(s.baseState=f),i.lastRenderedState=f}return[f,o]}function O0(e,s,i){var o=yt,d=jn(),f=jt;if(f){if(i===void 0)throw Error(r(407));i=i()}else i=s();var v=!Cn((Xt||d).memoizedState,i);if(v&&(d.memoizedState=i,Rn=!0),d=d.queue,Jh(z0.bind(null,o,d,e),[e]),d.getSnapshot!==s||v||Mn!==null&&Mn.memoizedState.tag&1){if(o.flags|=2048,lo(9,{destroy:void 0},I0.bind(null,o,d,i,s),null),an===null)throw Error(r(349));f||(ti&127)!==0||L0(o,s,i)}return i}function L0(e,s,i){e.flags|=16384,e={getSnapshot:s,value:i},s=yt.updateQueue,s===null?(s=kd(),yt.updateQueue=s,s.stores=[e]):(i=s.stores,i===null?s.stores=[e]:i.push(e))}function I0(e,s,i,o){s.value=i,s.getSnapshot=o,B0(s)&&P0(e)}function z0(e,s,i){return i(function(){B0(s)&&P0(e)})}function B0(e){var s=e.getSnapshot;e=e.value;try{var i=s();return!Cn(e,i)}catch{return!0}}function P0(e){var s=Oa(e,2);s!==null&&ks(s,e,2)}function Wh(e){var s=us();if(typeof e=="function"){var i=e;if(e=i(),Jr){qe(!0);try{i()}finally{qe(!1)}}}return s.memoizedState=s.baseState=e,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ni,lastRenderedState:e},s}function U0(e,s,i,o){return e.baseState=i,Yh(e,Xt,typeof o=="function"?o:ni)}function e5(e,s,i,o,d){if(Md(e))throw Error(r(485));if(e=s.action,e!==null){var f={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){f.listeners.push(v)}};E.T!==null?i(!0):f.isTransition=!1,o(f),i=s.pending,i===null?(f.next=s.pending=f,q0(s,f)):(f.next=i.next,s.pending=i.next=f)}}function q0(e,s){var i=s.action,o=s.payload,d=e.state;if(s.isTransition){var f=E.T,v={};E.T=v;try{var k=i(d,o),O=E.S;O!==null&&O(v,k),$0(e,s,k)}catch(J){Xh(e,s,J)}finally{f!==null&&v.types!==null&&(f.types=v.types),E.T=f}}else try{f=i(d,o),$0(e,s,f)}catch(J){Xh(e,s,J)}}function $0(e,s,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(o){H0(e,s,o)},function(o){return Xh(e,s,o)}):H0(e,s,i)}function H0(e,s,i){s.status="fulfilled",s.value=i,F0(s),e.state=i,s=e.pending,s!==null&&(i=s.next,i===s?e.pending=null:(i=i.next,s.next=i,q0(e,i)))}function Xh(e,s,i){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=i,F0(s),s=s.next;while(s!==o)}e.action=null}function F0(e){e=e.listeners;for(var s=0;s<e.length;s++)(0,e[s])()}function Q0(e,s){return s}function G0(e,s){if(jt){var i=an.formState;if(i!==null){e:{var o=yt;if(jt){if(Wt){t:{for(var d=Wt,f=os;d.nodeType!==8;){if(!f){d=null;break t}if(d=ea(d.nextSibling),d===null){d=null;break t}}f=d.data,d=f==="F!"||f==="F"?d:null}if(d){Wt=ea(d.nextSibling),o=d.data==="F!";break e}}ma(o)}o=!1}o&&(s=i[0])}}return i=us(),i.memoizedState=i.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Q0,lastRenderedState:s},i.queue=o,i=d8.bind(null,yt,o),o.dispatch=i,o=Wh(!1),f=am.bind(null,yt,!1,o.queue),o=us(),d={state:s,dispatch:null,action:e,pending:null},o.queue=d,i=e5.bind(null,yt,d,f,i),d.dispatch=i,o.memoizedState=e,[s,i,!1]}function V0(e){var s=jn();return K0(s,Xt,e)}function K0(e,s,i){if(s=Yh(e,s,Q0)[0],e=Cd(ni)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=Rc(s)}catch(v){throw v===no?yd:v}else o=s;s=jn();var d=s.queue,f=d.dispatch;return i!==s.memoizedState&&(yt.flags|=2048,lo(9,{destroy:void 0},t5.bind(null,d,i),null)),[o,f,e]}function t5(e,s){e.action=s}function Y0(e){var s=jn(),i=Xt;if(i!==null)return K0(s,i,e);jn(),s=s.memoizedState,i=jn();var o=i.queue.dispatch;return i.memoizedState=e,[s,o,!1]}function lo(e,s,i,o){return e={tag:e,create:i,deps:o,inst:s,next:null},s=yt.updateQueue,s===null&&(s=kd(),yt.updateQueue=s),i=s.lastEffect,i===null?s.lastEffect=e.next=e:(o=i.next,i.next=e,e.next=o,s.lastEffect=e),e}function Z0(){return jn().memoizedState}function Td(e,s,i,o){var d=us();yt.flags|=e,d.memoizedState=lo(1|s,{destroy:void 0},i,o===void 0?null:o)}function Ed(e,s,i,o){var d=jn();o=o===void 0?null:o;var f=d.memoizedState.inst;Xt!==null&&o!==null&&Hh(o,Xt.memoizedState.deps)?d.memoizedState=lo(s,f,i,o):(yt.flags|=e,d.memoizedState=lo(1|s,f,i,o))}function W0(e,s){Td(8390656,8,e,s)}function Jh(e,s){Ed(2048,8,e,s)}function n5(e){yt.flags|=4;var s=yt.updateQueue;if(s===null)s=kd(),yt.updateQueue=s,s.events=[e];else{var i=s.events;i===null?s.events=[e]:i.push(e)}}function X0(e){var s=jn().memoizedState;return n5({ref:s,nextImpl:e}),function(){if((Pt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function J0(e,s){return Ed(4,2,e,s)}function e8(e,s){return Ed(4,4,e,s)}function t8(e,s){if(typeof s=="function"){e=e();var i=s(e);return function(){typeof i=="function"?i():s(null)}}if(s!=null)return e=e(),s.current=e,function(){s.current=null}}function n8(e,s,i){i=i!=null?i.concat([e]):null,Ed(4,4,t8.bind(null,s,e),i)}function em(){}function s8(e,s){var i=jn();s=s===void 0?null:s;var o=i.memoizedState;return s!==null&&Hh(s,o[1])?o[0]:(i.memoizedState=[e,s],e)}function a8(e,s){var i=jn();s=s===void 0?null:s;var o=i.memoizedState;if(s!==null&&Hh(s,o[1]))return o[0];if(o=e(),Jr){qe(!0);try{e()}finally{qe(!1)}}return i.memoizedState=[o,s],o}function tm(e,s,i){return i===void 0||(ti&1073741824)!==0&&(Et&261930)===0?e.memoizedState=s:(e.memoizedState=i,e=ig(),yt.lanes|=e,Qi|=e,i)}function i8(e,s,i,o){return Cn(i,s)?i:ao.current!==null?(e=tm(e,i,o),Cn(e,s)||(Rn=!0),e):(ti&42)===0||(ti&1073741824)!==0&&(Et&261930)===0?(Rn=!0,e.memoizedState=i):(e=ig(),yt.lanes|=e,Qi|=e,s)}function r8(e,s,i,o,d){var f=U.p;U.p=f!==0&&8>f?f:8;var v=E.T,k={};E.T=k,am(e,!1,s,i);try{var O=d(),J=E.S;if(J!==null&&J(k,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var fe=Wy(O,o);Ac(e,s,fe,Fs(e))}else Ac(e,s,o,Fs(e))}catch(ve){Ac(e,s,{then:function(){},status:"rejected",reason:ve},Fs())}finally{U.p=f,v!==null&&k.types!==null&&(v.types=k.types),E.T=v}}function s5(){}function nm(e,s,i,o){if(e.tag!==5)throw Error(r(476));var d=l8(e).queue;r8(e,d,s,te,i===null?s5:function(){return o8(e),i(o)})}function l8(e){var s=e.memoizedState;if(s!==null)return s;s={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ni,lastRenderedState:te},next:null};var i={};return s.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ni,lastRenderedState:i},next:null},e.memoizedState=s,e=e.alternate,e!==null&&(e.memoizedState=s),s}function o8(e){var s=l8(e);s.next===null&&(s=e.alternate.memoizedState),Ac(e,s.next.queue,{},Fs())}function sm(){return Yn(Yc)}function c8(){return jn().memoizedState}function u8(){return jn().memoizedState}function a5(e){for(var s=e.return;s!==null;){switch(s.tag){case 24:case 3:var i=Fs();e=Pi(i);var o=Ui(s,e,i);o!==null&&(ks(o,s,i),Cc(o,s,i)),s={cache:Ah()},e.payload=s;return}s=s.return}}function i5(e,s,i){var o=Fs();i={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Md(e)?f8(s,i):(i=Gl(e,s,i,o),i!==null&&(ks(i,e,o),h8(i,s,o)))}function d8(e,s,i){var o=Fs();Ac(e,s,i,o)}function Ac(e,s,i,o){var d={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Md(e))f8(s,d);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=s.lastRenderedReducer,f!==null))try{var v=s.lastRenderedState,k=f(v,i);if(d.hasEagerState=!0,d.eagerState=k,Cn(k,v))return Fr(e,s,d,0),an===null&&Hr(),!1}catch{}finally{}if(i=Gl(e,s,d,o),i!==null)return ks(i,e,o),h8(i,s,o),!0}return!1}function am(e,s,i,o){if(o={lane:2,revertLane:Im(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Md(e)){if(s)throw Error(r(479))}else s=Gl(e,i,o,2),s!==null&&ks(s,e,2)}function Md(e){var s=e.alternate;return e===yt||s!==null&&s===yt}function f8(e,s){io=jd=!0;var i=e.pending;i===null?s.next=s:(s.next=i.next,i.next=s),e.pending=s}function h8(e,s,i){if((i&4194048)!==0){var o=s.lanes;o&=e.pendingLanes,i|=o,s.lanes=i,Gs(e,i)}}var Dc={readContext:Yn,use:Nd,useCallback:vn,useContext:vn,useEffect:vn,useImperativeHandle:vn,useLayoutEffect:vn,useInsertionEffect:vn,useMemo:vn,useReducer:vn,useRef:vn,useState:vn,useDebugValue:vn,useDeferredValue:vn,useTransition:vn,useSyncExternalStore:vn,useId:vn,useHostTransitionStatus:vn,useFormState:vn,useActionState:vn,useOptimistic:vn,useMemoCache:vn,useCacheRefresh:vn};Dc.useEffectEvent=vn;var m8={readContext:Yn,use:Nd,useCallback:function(e,s){return us().memoizedState=[e,s===void 0?null:s],e},useContext:Yn,useEffect:W0,useImperativeHandle:function(e,s,i){i=i!=null?i.concat([e]):null,Td(4194308,4,t8.bind(null,s,e),i)},useLayoutEffect:function(e,s){return Td(4194308,4,e,s)},useInsertionEffect:function(e,s){Td(4,2,e,s)},useMemo:function(e,s){var i=us();s=s===void 0?null:s;var o=e();if(Jr){qe(!0);try{e()}finally{qe(!1)}}return i.memoizedState=[o,s],o},useReducer:function(e,s,i){var o=us();if(i!==void 0){var d=i(s);if(Jr){qe(!0);try{i(s)}finally{qe(!1)}}}else d=s;return o.memoizedState=o.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},o.queue=e,e=e.dispatch=i5.bind(null,yt,e),[o.memoizedState,e]},useRef:function(e){var s=us();return e={current:e},s.memoizedState=e},useState:function(e){e=Wh(e);var s=e.queue,i=d8.bind(null,yt,s);return s.dispatch=i,[e.memoizedState,i]},useDebugValue:em,useDeferredValue:function(e,s){var i=us();return tm(i,e,s)},useTransition:function(){var e=Wh(!1);return e=r8.bind(null,yt,e.queue,!0,!1),us().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,s,i){var o=yt,d=us();if(jt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=s(),an===null)throw Error(r(349));(Et&127)!==0||L0(o,s,i)}d.memoizedState=i;var f={value:i,getSnapshot:s};return d.queue=f,W0(z0.bind(null,o,f,e),[e]),o.flags|=2048,lo(9,{destroy:void 0},I0.bind(null,o,f,i,s),null),i},useId:function(){var e=us(),s=an.identifierPrefix;if(jt){var i=Ps,o=Bs;i=(o&~(1<<32-De(o)-1)).toString(32)+i,s="_"+s+"R_"+i,i=wd++,0<i&&(s+="H"+i.toString(32)),s+="_"}else i=Xy++,s="_"+s+"r_"+i.toString(32)+"_";return e.memoizedState=s},useHostTransitionStatus:sm,useFormState:G0,useActionState:G0,useOptimistic:function(e){var s=us();s.memoizedState=s.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=i,s=am.bind(null,yt,!0,i),i.dispatch=s,[e,s]},useMemoCache:Kh,useCacheRefresh:function(){return us().memoizedState=a5.bind(null,yt)},useEffectEvent:function(e){var s=us(),i={impl:e};return s.memoizedState=i,function(){if((Pt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},im={readContext:Yn,use:Nd,useCallback:s8,useContext:Yn,useEffect:Jh,useImperativeHandle:n8,useInsertionEffect:J0,useLayoutEffect:e8,useMemo:a8,useReducer:Cd,useRef:Z0,useState:function(){return Cd(ni)},useDebugValue:em,useDeferredValue:function(e,s){var i=jn();return i8(i,Xt.memoizedState,e,s)},useTransition:function(){var e=Cd(ni)[0],s=jn().memoizedState;return[typeof e=="boolean"?e:Rc(e),s]},useSyncExternalStore:O0,useId:c8,useHostTransitionStatus:sm,useFormState:V0,useActionState:V0,useOptimistic:function(e,s){var i=jn();return U0(i,Xt,e,s)},useMemoCache:Kh,useCacheRefresh:u8};im.useEffectEvent=X0;var p8={readContext:Yn,use:Nd,useCallback:s8,useContext:Yn,useEffect:Jh,useImperativeHandle:n8,useInsertionEffect:J0,useLayoutEffect:e8,useMemo:a8,useReducer:Zh,useRef:Z0,useState:function(){return Zh(ni)},useDebugValue:em,useDeferredValue:function(e,s){var i=jn();return Xt===null?tm(i,e,s):i8(i,Xt.memoizedState,e,s)},useTransition:function(){var e=Zh(ni)[0],s=jn().memoizedState;return[typeof e=="boolean"?e:Rc(e),s]},useSyncExternalStore:O0,useId:c8,useHostTransitionStatus:sm,useFormState:Y0,useActionState:Y0,useOptimistic:function(e,s){var i=jn();return Xt!==null?U0(i,Xt,e,s):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Kh,useCacheRefresh:u8};p8.useEffectEvent=X0;function rm(e,s,i,o){s=e.memoizedState,i=i(o,s),i=i==null?s:g({},s,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var lm={enqueueSetState:function(e,s,i){e=e._reactInternals;var o=Fs(),d=Pi(o);d.payload=s,i!=null&&(d.callback=i),s=Ui(e,d,o),s!==null&&(ks(s,e,o),Cc(s,e,o))},enqueueReplaceState:function(e,s,i){e=e._reactInternals;var o=Fs(),d=Pi(o);d.tag=1,d.payload=s,i!=null&&(d.callback=i),s=Ui(e,d,o),s!==null&&(ks(s,e,o),Cc(s,e,o))},enqueueForceUpdate:function(e,s){e=e._reactInternals;var i=Fs(),o=Pi(i);o.tag=2,s!=null&&(o.callback=s),s=Ui(e,o,i),s!==null&&(ks(s,e,i),Cc(s,e,i))}};function g8(e,s,i,o,d,f,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,f,v):s.prototype&&s.prototype.isPureReactComponent?!qr(i,o)||!qr(d,f):!0}function y8(e,s,i,o){e=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,o),s.state!==e&&lm.enqueueReplaceState(s,s.state,null)}function el(e,s){var i=s;if("ref"in s){i={};for(var o in s)o!=="ref"&&(i[o]=s[o])}if(e=e.defaultProps){i===s&&(i=g({},i));for(var d in e)i[d]===void 0&&(i[d]=e[d])}return i}function v8(e){Ql(e)}function _8(e){console.error(e)}function b8(e){Ql(e)}function Rd(e,s){try{var i=e.onUncaughtError;i(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function x8(e,s,i){try{var o=e.onCaughtError;o(i.value,{componentStack:i.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function om(e,s,i){return i=Pi(i),i.tag=3,i.payload={element:null},i.callback=function(){Rd(e,s)},i}function S8(e){return e=Pi(e),e.tag=3,e}function j8(e,s,i,o){var d=i.type.getDerivedStateFromError;if(typeof d=="function"){var f=o.value;e.payload=function(){return d(f)},e.callback=function(){x8(s,i,o)}}var v=i.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){x8(s,i,o),typeof d!="function"&&(Gi===null?Gi=new Set([this]):Gi.add(this));var k=o.stack;this.componentDidCatch(o.value,{componentStack:k!==null?k:""})})}function r5(e,s,i,o,d){if(i.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=i.alternate,s!==null&&Jl(s,i,d,!0),i=Us.current,i!==null){switch(i.tag){case 31:case 13:return Js===null?Hd():i.alternate===null&&_n===0&&(_n=3),i.flags&=-257,i.flags|=65536,i.lanes=d,o===vd?i.flags|=16384:(s=i.updateQueue,s===null?i.updateQueue=new Set([o]):s.add(o),Dm(e,o,d)),!1;case 22:return i.flags|=65536,o===vd?i.flags|=16384:(s=i.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},i.updateQueue=s):(i=s.retryQueue,i===null?s.retryQueue=new Set([o]):i.add(o)),Dm(e,o,d)),!1}throw Error(r(435,i.tag))}return Dm(e,o,d),Hd(),!1}if(jt)return s=Us.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,o!==Xl&&(e=Error(r(422),{cause:o}),cs(D(e,i)))):(o!==Xl&&(s=Error(r(423),{cause:o}),cs(D(s,i))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,o=D(o,i),d=om(e.stateNode,o,d),Bh(e,d),_n!==4&&(_n=2)),!1;var f=Error(r(520),{cause:o});if(f=D(f,i),qc===null?qc=[f]:qc.push(f),_n!==4&&(_n=2),s===null)return!0;o=D(o,i),i=s;do{switch(i.tag){case 3:return i.flags|=65536,e=d&-d,i.lanes|=e,e=om(i.stateNode,o,e),Bh(i,e),!1;case 1:if(s=i.type,f=i.stateNode,(i.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Gi===null||!Gi.has(f))))return i.flags|=65536,d&=-d,i.lanes|=d,d=S8(d),j8(d,e,i,o),Bh(i,d),!1}i=i.return}while(i!==null);return!1}var cm=Error(r(461)),Rn=!1;function Zn(e,s,i,o){s.child=e===null?C0(s,null,i,o):Xr(s,e.child,i,o)}function w8(e,s,i,o,d){i=i.render;var f=s.ref;if("ref"in o){var v={};for(var k in o)k!=="ref"&&(v[k]=o[k])}else v=o;return Kr(s),o=Fh(e,s,i,v,f,d),k=Qh(),e!==null&&!Rn?(Gh(e,s,d),si(e,s,d)):(jt&&k&&Zl(s),s.flags|=1,Zn(e,s,o,d),s.child)}function k8(e,s,i,o,d){if(e===null){var f=i.type;return typeof f=="function"&&!Vl(f)&&f.defaultProps===void 0&&i.compare===null?(s.tag=15,s.type=f,N8(e,s,f,o,d)):(e=Gr(i.type,null,o,s,s.mode,d),e.ref=s.ref,e.return=s,s.child=e)}if(f=e.child,!ym(e,d)){var v=f.memoizedProps;if(i=i.compare,i=i!==null?i:qr,i(v,o)&&e.ref===s.ref)return si(e,s,d)}return s.flags|=1,e=Ws(f,o),e.ref=s.ref,e.return=s,s.child=e}function N8(e,s,i,o,d){if(e!==null){var f=e.memoizedProps;if(qr(f,o)&&e.ref===s.ref)if(Rn=!1,s.pendingProps=o=f,ym(e,d))(e.flags&131072)!==0&&(Rn=!0);else return s.lanes=e.lanes,si(e,s,d)}return um(e,s,i,o,d)}function C8(e,s,i,o){var d=o.children,f=e!==null?e.memoizedState:null;if(e===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(f=f!==null?f.baseLanes|i:i,e!==null){for(o=s.child=e.child,d=0;o!==null;)d=d|o.lanes|o.childLanes,o=o.sibling;o=d&~f}else o=0,s.child=null;return T8(e,s,f,i,o)}if((i&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},e!==null&&gd(s,f!==null?f.cachePool:null),f!==null?M0(s,f):Uh(),R0(s);else return o=s.lanes=536870912,T8(e,s,f!==null?f.baseLanes|i:i,i,o)}else f!==null?(gd(s,f.cachePool),M0(s,f),$i(),s.memoizedState=null):(e!==null&&gd(s,null),Uh(),$i());return Zn(e,s,d,i),s.child}function Oc(e,s){return e!==null&&e.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function T8(e,s,i,o,d){var f=Oh();return f=f===null?null:{parent:En._currentValue,pool:f},s.memoizedState={baseLanes:i,cachePool:f},e!==null&&gd(s,null),Uh(),R0(s),e!==null&&Jl(e,s,o,!0),s.childLanes=d,null}function Ad(e,s){return s=Od({mode:s.mode,children:s.children},e.mode),s.ref=e.ref,e.child=s,s.return=e,s}function E8(e,s,i){return Xr(s,e.child,null,i),e=Ad(s,s.pendingProps),e.flags|=2,qs(s),s.memoizedState=null,e}function l5(e,s,i){var o=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,e===null){if(jt){if(o.mode==="hidden")return e=Ad(s,o),s.lanes=536870912,Oc(null,e);if($h(s),(e=Wt)?(e=qg(e,os),e=e!==null&&e.data==="&"?e:null,e!==null&&(s.memoizedState={dehydrated:e,treeContext:Fn!==null?{id:Bs,overflow:Ps}:null,retryLane:536870912,hydrationErrors:null},i=bc(e),i.return=s,s.child=i,Tn=s,Wt=null)):e=null,e===null)throw ma(s);return s.lanes=536870912,null}return Ad(s,o)}var f=e.memoizedState;if(f!==null){var v=f.dehydrated;if($h(s),d)if(s.flags&256)s.flags&=-257,s=E8(e,s,i);else if(s.memoizedState!==null)s.child=e.child,s.flags|=128,s=null;else throw Error(r(558));else if(Rn||Jl(e,s,i,!1),d=(i&e.childLanes)!==0,Rn||d){if(o=an,o!==null&&(v=rs(o,i),v!==0&&v!==f.retryLane))throw f.retryLane=v,Oa(e,v),ks(o,e,v),cm;Hd(),s=E8(e,s,i)}else e=f.treeContext,Wt=ea(v.nextSibling),Tn=s,jt=!0,ha=null,os=!1,e!==null&&Sc(s,e),s=Ad(s,o),s.flags|=4096;return s}return e=Ws(e.child,{mode:o.mode,children:o.children}),e.ref=s.ref,s.child=e,e.return=s,e}function Dd(e,s){var i=s.ref;if(i===null)e!==null&&e.ref!==null&&(s.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(s.flags|=4194816)}}function um(e,s,i,o,d){return Kr(s),i=Fh(e,s,i,o,void 0,d),o=Qh(),e!==null&&!Rn?(Gh(e,s,d),si(e,s,d)):(jt&&o&&Zl(s),s.flags|=1,Zn(e,s,i,d),s.child)}function M8(e,s,i,o,d,f){return Kr(s),s.updateQueue=null,i=D0(s,o,i,d),A0(e),o=Qh(),e!==null&&!Rn?(Gh(e,s,f),si(e,s,f)):(jt&&o&&Zl(s),s.flags|=1,Zn(e,s,i,f),s.child)}function R8(e,s,i,o,d){if(Kr(s),s.stateNode===null){var f=Xa,v=i.contextType;typeof v=="object"&&v!==null&&(f=Yn(v)),f=new i(o,f),s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=lm,s.stateNode=f,f._reactInternals=s,f=s.stateNode,f.props=o,f.state=s.memoizedState,f.refs={},Ih(s),v=i.contextType,f.context=typeof v=="object"&&v!==null?Yn(v):Xa,f.state=s.memoizedState,v=i.getDerivedStateFromProps,typeof v=="function"&&(rm(s,i,v,o),f.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(v=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),v!==f.state&&lm.enqueueReplaceState(f,f.state,null),Ec(s,o,f,d),Tc(),f.state=s.memoizedState),typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(e===null){f=s.stateNode;var k=s.memoizedProps,O=el(i,k);f.props=O;var J=f.context,fe=i.contextType;v=Xa,typeof fe=="object"&&fe!==null&&(v=Yn(fe));var ve=i.getDerivedStateFromProps;fe=typeof ve=="function"||typeof f.getSnapshotBeforeUpdate=="function",k=s.pendingProps!==k,fe||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(k||J!==v)&&y8(s,f,o,v),Bi=!1;var se=s.memoizedState;f.state=se,Ec(s,o,f,d),Tc(),J=s.memoizedState,k||se!==J||Bi?(typeof ve=="function"&&(rm(s,i,ve,o),J=s.memoizedState),(O=Bi||g8(s,i,O,o,se,J,v))?(fe||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(s.flags|=4194308)):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=J),f.props=o,f.state=J,f.context=v,o=O):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{f=s.stateNode,zh(e,s),v=s.memoizedProps,fe=el(i,v),f.props=fe,ve=s.pendingProps,se=f.context,J=i.contextType,O=Xa,typeof J=="object"&&J!==null&&(O=Yn(J)),k=i.getDerivedStateFromProps,(J=typeof k=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(v!==ve||se!==O)&&y8(s,f,o,O),Bi=!1,se=s.memoizedState,f.state=se,Ec(s,o,f,d),Tc();var re=s.memoizedState;v!==ve||se!==re||Bi||e!==null&&e.dependencies!==null&&md(e.dependencies)?(typeof k=="function"&&(rm(s,i,k,o),re=s.memoizedState),(fe=Bi||g8(s,i,fe,o,se,re,O)||e!==null&&e.dependencies!==null&&md(e.dependencies))?(J||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,re,O),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,re,O)),typeof f.componentDidUpdate=="function"&&(s.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=re),f.props=o,f.state=re,f.context=O,o=fe):(typeof f.componentDidUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&se===e.memoizedState||(s.flags|=1024),o=!1)}return f=o,Dd(e,s),o=(s.flags&128)!==0,f||o?(f=s.stateNode,i=o&&typeof i.getDerivedStateFromError!="function"?null:f.render(),s.flags|=1,e!==null&&o?(s.child=Xr(s,e.child,null,d),s.child=Xr(s,null,i,d)):Zn(e,s,i,d),s.memoizedState=f.state,e=s.child):e=si(e,s,d),e}function A8(e,s,i,o){return Ot(),s.flags|=256,Zn(e,s,i,o),s.child}var dm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fm(e){return{baseLanes:e,cachePool:x0()}}function hm(e,s,i){return e=e!==null?e.childLanes&~i:0,s&&(e|=Hs),e}function D8(e,s,i){var o=s.pendingProps,d=!1,f=(s.flags&128)!==0,v;if((v=f)||(v=e!==null&&e.memoizedState===null?!1:(Sn.current&2)!==0),v&&(d=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,e===null){if(jt){if(d?qi(s):$i(),(e=Wt)?(e=qg(e,os),e=e!==null&&e.data!=="&"?e:null,e!==null&&(s.memoizedState={dehydrated:e,treeContext:Fn!==null?{id:Bs,overflow:Ps}:null,retryLane:536870912,hydrationErrors:null},i=bc(e),i.return=s,s.child=i,Tn=s,Wt=null)):e=null,e===null)throw ma(s);return Ym(e)?s.lanes=32:s.lanes=536870912,null}var k=o.children;return o=o.fallback,d?($i(),d=s.mode,k=Od({mode:"hidden",children:k},d),o=La(o,d,i,null),k.return=s,o.return=s,k.sibling=o,s.child=k,o=s.child,o.memoizedState=fm(i),o.childLanes=hm(e,v,i),s.memoizedState=dm,Oc(null,o)):(qi(s),mm(s,k))}var O=e.memoizedState;if(O!==null&&(k=O.dehydrated,k!==null)){if(f)s.flags&256?(qi(s),s.flags&=-257,s=pm(e,s,i)):s.memoizedState!==null?($i(),s.child=e.child,s.flags|=128,s=null):($i(),k=o.fallback,d=s.mode,o=Od({mode:"visible",children:o.children},d),k=La(k,d,i,null),k.flags|=2,o.return=s,k.return=s,o.sibling=k,s.child=o,Xr(s,e.child,null,i),o=s.child,o.memoizedState=fm(i),o.childLanes=hm(e,v,i),s.memoizedState=dm,s=Oc(null,o));else if(qi(s),Ym(k)){if(v=k.nextSibling&&k.nextSibling.dataset,v)var J=v.dgst;v=J,o=Error(r(419)),o.stack="",o.digest=v,cs({value:o,source:null,stack:null}),s=pm(e,s,i)}else if(Rn||Jl(e,s,i,!1),v=(i&e.childLanes)!==0,Rn||v){if(v=an,v!==null&&(o=rs(v,i),o!==0&&o!==O.retryLane))throw O.retryLane=o,Oa(e,o),ks(v,e,o),cm;Km(k)||Hd(),s=pm(e,s,i)}else Km(k)?(s.flags|=192,s.child=e.child,s=null):(e=O.treeContext,Wt=ea(k.nextSibling),Tn=s,jt=!0,ha=null,os=!1,e!==null&&Sc(s,e),s=mm(s,o.children),s.flags|=4096);return s}return d?($i(),k=o.fallback,d=s.mode,O=e.child,J=O.sibling,o=Ws(O,{mode:"hidden",children:o.children}),o.subtreeFlags=O.subtreeFlags&65011712,J!==null?k=Ws(J,k):(k=La(k,d,i,null),k.flags|=2),k.return=s,o.return=s,o.sibling=k,s.child=o,Oc(null,o),o=s.child,k=e.child.memoizedState,k===null?k=fm(i):(d=k.cachePool,d!==null?(O=En._currentValue,d=d.parent!==O?{parent:O,pool:O}:d):d=x0(),k={baseLanes:k.baseLanes|i,cachePool:d}),o.memoizedState=k,o.childLanes=hm(e,v,i),s.memoizedState=dm,Oc(e.child,o)):(qi(s),i=e.child,e=i.sibling,i=Ws(i,{mode:"visible",children:o.children}),i.return=s,i.sibling=null,e!==null&&(v=s.deletions,v===null?(s.deletions=[e],s.flags|=16):v.push(e)),s.child=i,s.memoizedState=null,i)}function mm(e,s){return s=Od({mode:"visible",children:s},e.mode),s.return=e,e.child=s}function Od(e,s){return e=ns(22,e,null,s),e.lanes=0,e}function pm(e,s,i){return Xr(s,e.child,null,i),e=mm(s,s.pendingProps.children),e.flags|=2,s.memoizedState=null,e}function O8(e,s,i){e.lanes|=s;var o=e.alternate;o!==null&&(o.lanes|=s),Mh(e.return,s,i)}function gm(e,s,i,o,d,f){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:i,tailMode:d,treeForkCount:f}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=i,v.tailMode=d,v.treeForkCount=f)}function L8(e,s,i){var o=s.pendingProps,d=o.revealOrder,f=o.tail;o=o.children;var v=Sn.current,k=(v&2)!==0;if(k?(v=v&1|2,s.flags|=128):v&=1,be(Sn,v),Zn(e,s,o,i),o=jt?Ye:0,!k&&e!==null&&(e.flags&128)!==0)e:for(e=s.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&O8(e,i,s);else if(e.tag===19)O8(e,i,s);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===s)break e;for(;e.sibling===null;){if(e.return===null||e.return===s)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(i=s.child,d=null;i!==null;)e=i.alternate,e!==null&&Sd(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=s.child,s.child=null):(d=i.sibling,i.sibling=null),gm(s,!1,d,i,f,o);break;case"backwards":case"unstable_legacy-backwards":for(i=null,d=s.child,s.child=null;d!==null;){if(e=d.alternate,e!==null&&Sd(e)===null){s.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}gm(s,!0,i,null,f,o);break;case"together":gm(s,!1,null,null,void 0,o);break;default:s.memoizedState=null}return s.child}function si(e,s,i){if(e!==null&&(s.dependencies=e.dependencies),Qi|=s.lanes,(i&s.childLanes)===0)if(e!==null){if(Jl(e,s,i,!1),(i&s.childLanes)===0)return null}else return null;if(e!==null&&s.child!==e.child)throw Error(r(153));if(s.child!==null){for(e=s.child,i=Ws(e,e.pendingProps),s.child=i,i.return=s;e.sibling!==null;)e=e.sibling,i=i.sibling=Ws(e,e.pendingProps),i.return=s;i.sibling=null}return s.child}function ym(e,s){return(e.lanes&s)!==0?!0:(e=e.dependencies,!!(e!==null&&md(e)))}function o5(e,s,i){switch(s.tag){case 3:he(s,s.stateNode.containerInfo),zi(s,En,e.memoizedState.cache),Ot();break;case 27:case 5:Se(s);break;case 4:he(s,s.stateNode.containerInfo);break;case 10:zi(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,$h(s),null;break;case 13:var o=s.memoizedState;if(o!==null)return o.dehydrated!==null?(qi(s),s.flags|=128,null):(i&s.child.childLanes)!==0?D8(e,s,i):(qi(s),e=si(e,s,i),e!==null?e.sibling:null);qi(s);break;case 19:var d=(e.flags&128)!==0;if(o=(i&s.childLanes)!==0,o||(Jl(e,s,i,!1),o=(i&s.childLanes)!==0),d){if(o)return L8(e,s,i);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),be(Sn,Sn.current),o)break;return null;case 22:return s.lanes=0,C8(e,s,i,s.pendingProps);case 24:zi(s,En,e.memoizedState.cache)}return si(e,s,i)}function I8(e,s,i){if(e!==null)if(e.memoizedProps!==s.pendingProps)Rn=!0;else{if(!ym(e,i)&&(s.flags&128)===0)return Rn=!1,o5(e,s,i);Rn=(e.flags&131072)!==0}else Rn=!1,jt&&(s.flags&1048576)!==0&&xc(s,Ye,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(e=Zr(s.elementType),s.type=e,typeof e=="function")Vl(e)?(o=el(e,o),s.tag=1,s=R8(null,s,e,o,i)):(s.tag=0,s=um(null,s,e,o,i));else{if(e!=null){var d=e.$$typeof;if(d===R){s.tag=11,s=w8(null,s,e,o,i);break e}else if(d===Z){s.tag=14,s=k8(null,s,e,o,i);break e}}throw s=ae(e)||e,Error(r(306,s,""))}}return s;case 0:return um(e,s,s.type,s.pendingProps,i);case 1:return o=s.type,d=el(o,s.pendingProps),R8(e,s,o,d,i);case 3:e:{if(he(s,s.stateNode.containerInfo),e===null)throw Error(r(387));o=s.pendingProps;var f=s.memoizedState;d=f.element,zh(e,s),Ec(s,o,null,i);var v=s.memoizedState;if(o=v.cache,zi(s,En,o),o!==f.cache&&Rh(s,[En],i,!0),Tc(),o=v.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=f,s.memoizedState=f,s.flags&256){s=A8(e,s,o,i);break e}else if(o!==d){d=D(Error(r(424)),s),cs(d),s=A8(e,s,o,i);break e}else{switch(e=s.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Wt=ea(e.firstChild),Tn=s,jt=!0,ha=null,os=!0,i=C0(s,null,o,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Ot(),o===d){s=si(e,s,i);break e}Zn(e,s,o,i)}s=s.child}return s;case 26:return Dd(e,s),e===null?(i=Vg(s.type,null,s.pendingProps,null))?s.memoizedState=i:jt||(i=s.type,e=s.pendingProps,o=Zd(Ce.current).createElement(i),o[ge]=s,o[we]=e,Wn(o,i,e),B(o),s.stateNode=o):s.memoizedState=Vg(s.type,e.memoizedProps,s.pendingProps,e.memoizedState),null;case 27:return Se(s),e===null&&jt&&(o=s.stateNode=Fg(s.type,s.pendingProps,Ce.current),Tn=s,os=!0,d=Wt,Zi(s.type)?(Zm=d,Wt=ea(o.firstChild)):Wt=d),Zn(e,s,s.pendingProps.children,i),Dd(e,s),e===null&&(s.flags|=4194304),s.child;case 5:return e===null&&jt&&((d=o=Wt)&&(o=B5(o,s.type,s.pendingProps,os),o!==null?(s.stateNode=o,Tn=s,Wt=ea(o.firstChild),os=!1,d=!0):d=!1),d||ma(s)),Se(s),d=s.type,f=s.pendingProps,v=e!==null?e.memoizedProps:null,o=f.children,Qm(d,f)?o=null:v!==null&&Qm(d,v)&&(s.flags|=32),s.memoizedState!==null&&(d=Fh(e,s,Jy,null,null,i),Yc._currentValue=d),Dd(e,s),Zn(e,s,o,i),s.child;case 6:return e===null&&jt&&((e=i=Wt)&&(i=P5(i,s.pendingProps,os),i!==null?(s.stateNode=i,Tn=s,Wt=null,e=!0):e=!1),e||ma(s)),null;case 13:return D8(e,s,i);case 4:return he(s,s.stateNode.containerInfo),o=s.pendingProps,e===null?s.child=Xr(s,null,o,i):Zn(e,s,o,i),s.child;case 11:return w8(e,s,s.type,s.pendingProps,i);case 7:return Zn(e,s,s.pendingProps,i),s.child;case 8:return Zn(e,s,s.pendingProps.children,i),s.child;case 12:return Zn(e,s,s.pendingProps.children,i),s.child;case 10:return o=s.pendingProps,zi(s,s.type,o.value),Zn(e,s,o.children,i),s.child;case 9:return d=s.type._context,o=s.pendingProps.children,Kr(s),d=Yn(d),o=o(d),s.flags|=1,Zn(e,s,o,i),s.child;case 14:return k8(e,s,s.type,s.pendingProps,i);case 15:return N8(e,s,s.type,s.pendingProps,i);case 19:return L8(e,s,i);case 31:return l5(e,s,i);case 22:return C8(e,s,i,s.pendingProps);case 24:return Kr(s),o=Yn(En),e===null?(d=Oh(),d===null&&(d=an,f=Ah(),d.pooledCache=f,f.refCount++,f!==null&&(d.pooledCacheLanes|=i),d=f),s.memoizedState={parent:o,cache:d},Ih(s),zi(s,En,d)):((e.lanes&i)!==0&&(zh(e,s),Ec(s,null,null,i),Tc()),d=e.memoizedState,f=s.memoizedState,d.parent!==o?(d={parent:o,cache:o},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),zi(s,En,o)):(o=f.cache,zi(s,En,o),o!==d.cache&&Rh(s,[En],i,!0))),Zn(e,s,s.pendingProps.children,i),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function ai(e){e.flags|=4}function vm(e,s,i,o,d){if((s=(e.mode&32)!==0)&&(s=!1),s){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(cg())e.flags|=8192;else throw Wr=vd,Lh}else e.flags&=-16777217}function z8(e,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xg(s))if(cg())e.flags|=8192;else throw Wr=vd,Lh}function Ld(e,s){s!==null&&(e.flags|=4),e.flags&16384&&(s=e.tag!==22?ps():536870912,e.lanes|=s,fo|=s)}function Lc(e,s){if(!jt)switch(e.tailMode){case"hidden":s=e.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?s||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function cn(e){var s=e.alternate!==null&&e.alternate.child===e.child,i=0,o=0;if(s)for(var d=e.child;d!==null;)i|=d.lanes|d.childLanes,o|=d.subtreeFlags&65011712,o|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)i|=d.lanes|d.childLanes,o|=d.subtreeFlags,o|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=o,e.childLanes=i,s}function c5(e,s,i){var o=s.pendingProps;switch(Wl(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(s),null;case 1:return cn(s),null;case 3:return i=s.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ei(En),q(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(wt(s)?ai(s):e===null||e.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Gt())),cn(s),null;case 26:var d=s.type,f=s.memoizedState;return e===null?(ai(s),f!==null?(cn(s),z8(s,f)):(cn(s),vm(s,d,null,o,i))):f?f!==e.memoizedState?(ai(s),cn(s),z8(s,f)):(cn(s),s.flags&=-16777217):(e=e.memoizedProps,e!==o&&ai(s),cn(s),vm(s,d,e,o,i)),null;case 27:if(Ne(s),i=Ce.current,d=s.type,e!==null&&s.stateNode!=null)e.memoizedProps!==o&&ai(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return cn(s),null}e=V.current,wt(s)?it(s):(e=Fg(d,o,i),s.stateNode=e,ai(s))}return cn(s),null;case 5:if(Ne(s),d=s.type,e!==null&&s.stateNode!=null)e.memoizedProps!==o&&ai(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return cn(s),null}if(f=V.current,wt(s))it(s);else{var v=Zd(Ce.current);switch(f){case 1:f=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:f=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":f=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":f=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":f=v.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?v.createElement("select",{is:o.is}):v.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?v.createElement(d,{is:o.is}):v.createElement(d)}}f[ge]=s,f[we]=o;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)f.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=f;e:switch(Wn(f,d,o),d){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&ai(s)}}return cn(s),vm(s,s.type,e===null?null:e.memoizedProps,s.pendingProps,i),null;case 6:if(e&&s.stateNode!=null)e.memoizedProps!==o&&ai(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(r(166));if(e=Ce.current,wt(s)){if(e=s.stateNode,i=s.memoizedProps,o=null,d=Tn,d!==null)switch(d.tag){case 27:case 5:o=d.memoizedProps}e[ge]=s,e=!!(e.nodeValue===i||o!==null&&o.suppressHydrationWarning===!0||Dg(e.nodeValue,i)),e||ma(s,!0)}else e=Zd(e).createTextNode(o),e[ge]=s,s.stateNode=e}return cn(s),null;case 31:if(i=s.memoizedState,e===null||e.memoizedState!==null){if(o=wt(s),i!==null){if(e===null){if(!o)throw Error(r(318));if(e=s.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ge]=s}else Ot(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;cn(s),e=!1}else i=Gt(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return s.flags&256?(qs(s),s):(qs(s),null);if((s.flags&128)!==0)throw Error(r(558))}return cn(s),null;case 13:if(o=s.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=wt(s),o!==null&&o.dehydrated!==null){if(e===null){if(!d)throw Error(r(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[ge]=s}else Ot(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;cn(s),d=!1}else d=Gt(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(qs(s),s):(qs(s),null)}return qs(s),(s.flags&128)!==0?(s.lanes=i,s):(i=o!==null,e=e!==null&&e.memoizedState!==null,i&&(o=s.child,d=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(d=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==d&&(o.flags|=2048)),i!==e&&i&&(s.child.flags|=8192),Ld(s,s.updateQueue),cn(s),null);case 4:return q(),e===null&&Um(s.stateNode.containerInfo),cn(s),null;case 10:return ei(s.type),cn(s),null;case 19:if(ne(Sn),o=s.memoizedState,o===null)return cn(s),null;if(d=(s.flags&128)!==0,f=o.rendering,f===null)if(d)Lc(o,!1);else{if(_n!==0||e!==null&&(e.flags&128)!==0)for(e=s.child;e!==null;){if(f=Sd(e),f!==null){for(s.flags|=128,Lc(o,!1),e=f.updateQueue,s.updateQueue=e,Ld(s,e),s.subtreeFlags=0,e=i,i=s.child;i!==null;)_c(i,e),i=i.sibling;return be(Sn,Sn.current&1|2),jt&&Xs(s,o.treeForkCount),s.child}e=e.sibling}o.tail!==null&&Re()>Ud&&(s.flags|=128,d=!0,Lc(o,!1),s.lanes=4194304)}else{if(!d)if(e=Sd(f),e!==null){if(s.flags|=128,d=!0,e=e.updateQueue,s.updateQueue=e,Ld(s,e),Lc(o,!0),o.tail===null&&o.tailMode==="hidden"&&!f.alternate&&!jt)return cn(s),null}else 2*Re()-o.renderingStartTime>Ud&&i!==536870912&&(s.flags|=128,d=!0,Lc(o,!1),s.lanes=4194304);o.isBackwards?(f.sibling=s.child,s.child=f):(e=o.last,e!==null?e.sibling=f:s.child=f,o.last=f)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Re(),e.sibling=null,i=Sn.current,be(Sn,d?i&1|2:i&1),jt&&Xs(s,o.treeForkCount),e):(cn(s),null);case 22:case 23:return qs(s),qh(),o=s.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(i&536870912)!==0&&(s.flags&128)===0&&(cn(s),s.subtreeFlags&6&&(s.flags|=8192)):cn(s),i=s.updateQueue,i!==null&&Ld(s,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==i&&(s.flags|=2048),e!==null&&ne(Yr),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),s.memoizedState.cache!==i&&(s.flags|=2048),ei(En),cn(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function u5(e,s){switch(Wl(s),s.tag){case 1:return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 3:return ei(En),q(),e=s.flags,(e&65536)!==0&&(e&128)===0?(s.flags=e&-65537|128,s):null;case 26:case 27:case 5:return Ne(s),null;case 31:if(s.memoizedState!==null){if(qs(s),s.alternate===null)throw Error(r(340));Ot()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 13:if(qs(s),e=s.memoizedState,e!==null&&e.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Ot()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 19:return ne(Sn),null;case 4:return q(),null;case 10:return ei(s.type),null;case 22:case 23:return qs(s),qh(),e!==null&&ne(Yr),e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 24:return ei(En),null;case 25:return null;default:return null}}function B8(e,s){switch(Wl(s),s.tag){case 3:ei(En),q();break;case 26:case 27:case 5:Ne(s);break;case 4:q();break;case 31:s.memoizedState!==null&&qs(s);break;case 13:qs(s);break;case 19:ne(Sn);break;case 10:ei(s.type);break;case 22:case 23:qs(s),qh(),e!==null&&ne(Yr);break;case 24:ei(En)}}function Ic(e,s){try{var i=s.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var d=o.next;i=d;do{if((i.tag&e)===e){o=void 0;var f=i.create,v=i.inst;o=f(),v.destroy=o}i=i.next}while(i!==d)}}catch(k){Kt(s,s.return,k)}}function Hi(e,s,i){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var f=d.next;o=f;do{if((o.tag&e)===e){var v=o.inst,k=v.destroy;if(k!==void 0){v.destroy=void 0,d=s;var O=i,J=k;try{J()}catch(fe){Kt(d,O,fe)}}}o=o.next}while(o!==f)}}catch(fe){Kt(s,s.return,fe)}}function P8(e){var s=e.updateQueue;if(s!==null){var i=e.stateNode;try{E0(s,i)}catch(o){Kt(e,e.return,o)}}}function U8(e,s,i){i.props=el(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(o){Kt(e,s,o)}}function zc(e,s){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof i=="function"?e.refCleanup=i(o):i.current=o}}catch(d){Kt(e,s,d)}}function Ia(e,s){var i=e.ref,o=e.refCleanup;if(i!==null)if(typeof o=="function")try{o()}catch(d){Kt(e,s,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(d){Kt(e,s,d)}else i.current=null}function q8(e){var s=e.type,i=e.memoizedProps,o=e.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":i.autoFocus&&o.focus();break e;case"img":i.src?o.src=i.src:i.srcSet&&(o.srcset=i.srcSet)}}catch(d){Kt(e,e.return,d)}}function _m(e,s,i){try{var o=e.stateNode;A5(o,e.type,i,s),o[we]=s}catch(d){Kt(e,e.return,d)}}function $8(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zi(e.type)||e.tag===4}function bm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$8(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&&Zi(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 xm(e,s,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,s?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,s):(s=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,s.appendChild(e),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=Ks));else if(o!==4&&(o===27&&Zi(e.type)&&(i=e.stateNode,s=null),e=e.child,e!==null))for(xm(e,s,i),e=e.sibling;e!==null;)xm(e,s,i),e=e.sibling}function Id(e,s,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,s?i.insertBefore(e,s):i.appendChild(e);else if(o!==4&&(o===27&&Zi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Id(e,s,i),e=e.sibling;e!==null;)Id(e,s,i),e=e.sibling}function H8(e){var s=e.stateNode,i=e.memoizedProps;try{for(var o=e.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Wn(s,o,i),s[ge]=e,s[we]=i}catch(f){Kt(e,e.return,f)}}var ii=!1,An=!1,Sm=!1,F8=typeof WeakSet=="function"?WeakSet:Set,Qn=null;function d5(e,s){if(e=e.containerInfo,Hm=sf,e=cd(e),uc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var d=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{i.nodeType,f.nodeType}catch{i=null;break e}var v=0,k=-1,O=-1,J=0,fe=0,ve=e,se=null;t:for(;;){for(var re;ve!==i||d!==0&&ve.nodeType!==3||(k=v+d),ve!==f||o!==0&&ve.nodeType!==3||(O=v+o),ve.nodeType===3&&(v+=ve.nodeValue.length),(re=ve.firstChild)!==null;)se=ve,ve=re;for(;;){if(ve===e)break t;if(se===i&&++J===d&&(k=v),se===f&&++fe===o&&(O=v),(re=ve.nextSibling)!==null)break;ve=se,se=ve.parentNode}ve=re}i=k===-1||O===-1?null:{start:k,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Fm={focusedElem:e,selectionRange:i},sf=!1,Qn=s;Qn!==null;)if(s=Qn,e=s.child,(s.subtreeFlags&1028)!==0&&e!==null)e.return=s,Qn=e;else for(;Qn!==null;){switch(s=Qn,f=s.alternate,e=s.flags,s.tag){case 0:if((e&4)!==0&&(e=s.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)d=e[i],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,i=s,d=f.memoizedProps,f=f.memoizedState,o=i.stateNode;try{var Fe=el(i.type,d);e=o.getSnapshotBeforeUpdate(Fe,f),o.__reactInternalSnapshotBeforeUpdate=e}catch(lt){Kt(i,i.return,lt)}}break;case 3:if((e&1024)!==0){if(e=s.stateNode.containerInfo,i=e.nodeType,i===9)Vm(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Vm(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(r(163))}if(e=s.sibling,e!==null){e.return=s.return,Qn=e;break}Qn=s.return}}function Q8(e,s,i){var o=i.flags;switch(i.tag){case 0:case 11:case 15:li(e,i),o&4&&Ic(5,i);break;case 1:if(li(e,i),o&4)if(e=i.stateNode,s===null)try{e.componentDidMount()}catch(v){Kt(i,i.return,v)}else{var d=el(i.type,s.memoizedProps);s=s.memoizedState;try{e.componentDidUpdate(d,s,e.__reactInternalSnapshotBeforeUpdate)}catch(v){Kt(i,i.return,v)}}o&64&&P8(i),o&512&&zc(i,i.return);break;case 3:if(li(e,i),o&64&&(e=i.updateQueue,e!==null)){if(s=null,i.child!==null)switch(i.child.tag){case 27:case 5:s=i.child.stateNode;break;case 1:s=i.child.stateNode}try{E0(e,s)}catch(v){Kt(i,i.return,v)}}break;case 27:s===null&&o&4&&H8(i);case 26:case 5:li(e,i),s===null&&o&4&&q8(i),o&512&&zc(i,i.return);break;case 12:li(e,i);break;case 31:li(e,i),o&4&&K8(e,i);break;case 13:li(e,i),o&4&&Y8(e,i),o&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=b5.bind(null,i),U5(e,i))));break;case 22:if(o=i.memoizedState!==null||ii,!o){s=s!==null&&s.memoizedState!==null||An,d=ii;var f=An;ii=o,(An=s)&&!f?oi(e,i,(i.subtreeFlags&8772)!==0):li(e,i),ii=d,An=f}break;case 30:break;default:li(e,i)}}function G8(e){var s=e.alternate;s!==null&&(e.alternate=null,G8(s)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(s=e.stateNode,s!==null&&Ht(s)),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 hn=null,xs=!1;function ri(e,s,i){for(i=i.child;i!==null;)V8(e,s,i),i=i.sibling}function V8(e,s,i){if(oe&&typeof oe.onCommitFiberUnmount=="function")try{oe.onCommitFiberUnmount(ln,i)}catch{}switch(i.tag){case 26:An||Ia(i,s),ri(e,s,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:An||Ia(i,s);var o=hn,d=xs;Zi(i.type)&&(hn=i.stateNode,xs=!1),ri(e,s,i),Gc(i.stateNode),hn=o,xs=d;break;case 5:An||Ia(i,s);case 6:if(o=hn,d=xs,hn=null,ri(e,s,i),hn=o,xs=d,hn!==null)if(xs)try{(hn.nodeType===9?hn.body:hn.nodeName==="HTML"?hn.ownerDocument.body:hn).removeChild(i.stateNode)}catch(f){Kt(i,s,f)}else try{hn.removeChild(i.stateNode)}catch(f){Kt(i,s,f)}break;case 18:hn!==null&&(xs?(e=hn,Pg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),bo(e)):Pg(hn,i.stateNode));break;case 4:o=hn,d=xs,hn=i.stateNode.containerInfo,xs=!0,ri(e,s,i),hn=o,xs=d;break;case 0:case 11:case 14:case 15:Hi(2,i,s),An||Hi(4,i,s),ri(e,s,i);break;case 1:An||(Ia(i,s),o=i.stateNode,typeof o.componentWillUnmount=="function"&&U8(i,s,o)),ri(e,s,i);break;case 21:ri(e,s,i);break;case 22:An=(o=An)||i.memoizedState!==null,ri(e,s,i),An=o;break;default:ri(e,s,i)}}function K8(e,s){if(s.memoizedState===null&&(e=s.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{bo(e)}catch(i){Kt(s,s.return,i)}}}function Y8(e,s){if(s.memoizedState===null&&(e=s.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{bo(e)}catch(i){Kt(s,s.return,i)}}function f5(e){switch(e.tag){case 31:case 13:case 19:var s=e.stateNode;return s===null&&(s=e.stateNode=new F8),s;case 22:return e=e.stateNode,s=e._retryCache,s===null&&(s=e._retryCache=new F8),s;default:throw Error(r(435,e.tag))}}function zd(e,s){var i=f5(e);s.forEach(function(o){if(!i.has(o)){i.add(o);var d=x5.bind(null,e,o);o.then(d,d)}})}function Ss(e,s){var i=s.deletions;if(i!==null)for(var o=0;o<i.length;o++){var d=i[o],f=e,v=s,k=v;e:for(;k!==null;){switch(k.tag){case 27:if(Zi(k.type)){hn=k.stateNode,xs=!1;break e}break;case 5:hn=k.stateNode,xs=!1;break e;case 3:case 4:hn=k.stateNode.containerInfo,xs=!0;break e}k=k.return}if(hn===null)throw Error(r(160));V8(f,v,d),hn=null,xs=!1,f=d.alternate,f!==null&&(f.return=null),d.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Z8(s,e),s=s.sibling}var ga=null;function Z8(e,s){var i=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ss(s,e),js(e),o&4&&(Hi(3,e,e.return),Ic(3,e),Hi(5,e,e.return));break;case 1:Ss(s,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),o&64&&ii&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?o:i.concat(o))));break;case 26:var d=ga;if(Ss(s,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),o&4){var f=i!==null?i.memoizedState:null;if(o=e.memoizedState,i===null)if(o===null)if(e.stateNode===null){e:{o=e.type,i=e.memoizedProps,d=d.ownerDocument||d;t:switch(o){case"title":f=d.getElementsByTagName("title")[0],(!f||f[es]||f[ge]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=d.createElement(o),d.head.insertBefore(f,d.querySelector("head > title"))),Wn(f,o,i),f[ge]=e,B(f),o=f;break e;case"link":var v=Zg("link","href",d).get(o+(i.href||""));if(v){for(var k=0;k<v.length;k++)if(f=v[k],f.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&f.getAttribute("rel")===(i.rel==null?null:i.rel)&&f.getAttribute("title")===(i.title==null?null:i.title)&&f.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){v.splice(k,1);break t}}f=d.createElement(o),Wn(f,o,i),d.head.appendChild(f);break;case"meta":if(v=Zg("meta","content",d).get(o+(i.content||""))){for(k=0;k<v.length;k++)if(f=v[k],f.getAttribute("content")===(i.content==null?null:""+i.content)&&f.getAttribute("name")===(i.name==null?null:i.name)&&f.getAttribute("property")===(i.property==null?null:i.property)&&f.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&f.getAttribute("charset")===(i.charSet==null?null:i.charSet)){v.splice(k,1);break t}}f=d.createElement(o),Wn(f,o,i),d.head.appendChild(f);break;default:throw Error(r(468,o))}f[ge]=e,B(f),o=f}e.stateNode=o}else Wg(d,e.type,e.stateNode);else e.stateNode=Yg(d,o,e.memoizedProps);else f!==o?(f===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):f.count--,o===null?Wg(d,e.type,e.stateNode):Yg(d,o,e.memoizedProps)):o===null&&e.stateNode!==null&&_m(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ss(s,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),i!==null&&o&4&&_m(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ss(s,e),js(e),o&512&&(An||i===null||Ia(i,i.return)),e.flags&32){d=e.stateNode;try{ca(d,"")}catch(Fe){Kt(e,e.return,Fe)}}o&4&&e.stateNode!=null&&(d=e.memoizedProps,_m(e,d,i!==null?i.memoizedProps:d)),o&1024&&(Sm=!0);break;case 6:if(Ss(s,e),js(e),o&4){if(e.stateNode===null)throw Error(r(162));o=e.memoizedProps,i=e.stateNode;try{i.nodeValue=o}catch(Fe){Kt(e,e.return,Fe)}}break;case 3:if(Jd=null,d=ga,ga=Wd(s.containerInfo),Ss(s,e),ga=d,js(e),o&4&&i!==null&&i.memoizedState.isDehydrated)try{bo(s.containerInfo)}catch(Fe){Kt(e,e.return,Fe)}Sm&&(Sm=!1,W8(e));break;case 4:o=ga,ga=Wd(e.stateNode.containerInfo),Ss(s,e),js(e),ga=o;break;case 12:Ss(s,e),js(e);break;case 31:Ss(s,e),js(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,zd(e,o)));break;case 13:Ss(s,e),js(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Pd=Re()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,zd(e,o)));break;case 22:d=e.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,J=ii,fe=An;if(ii=J||d,An=fe||O,Ss(s,e),An=fe,ii=J,js(e),o&8192)e:for(s=e.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(i===null||O||ii||An||tl(e)),i=null,s=e;;){if(s.tag===5||s.tag===26){if(i===null){O=i=s;try{if(f=O.stateNode,d)v=f.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{k=O.stateNode;var ve=O.memoizedProps.style,se=ve!=null&&ve.hasOwnProperty("display")?ve.display:null;k.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Fe){Kt(O,O.return,Fe)}}}else if(s.tag===6){if(i===null){O=s;try{O.stateNode.nodeValue=d?"":O.memoizedProps}catch(Fe){Kt(O,O.return,Fe)}}}else if(s.tag===18){if(i===null){O=s;try{var re=O.stateNode;d?Ug(re,!0):Ug(O.stateNode,!1)}catch(Fe){Kt(O,O.return,Fe)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===e)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break e;for(;s.sibling===null;){if(s.return===null||s.return===e)break e;i===s&&(i=null),s=s.return}i===s&&(i=null),s.sibling.return=s.return,s=s.sibling}o&4&&(o=e.updateQueue,o!==null&&(i=o.retryQueue,i!==null&&(o.retryQueue=null,zd(e,i))));break;case 19:Ss(s,e),js(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,zd(e,o)));break;case 30:break;case 21:break;default:Ss(s,e),js(e)}}function js(e){var s=e.flags;if(s&2){try{for(var i,o=e.return;o!==null;){if($8(o)){i=o;break}o=o.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var d=i.stateNode,f=bm(e);Id(e,f,d);break;case 5:var v=i.stateNode;i.flags&32&&(ca(v,""),i.flags&=-33);var k=bm(e);Id(e,k,v);break;case 3:case 4:var O=i.stateNode.containerInfo,J=bm(e);xm(e,J,O);break;default:throw Error(r(161))}}catch(fe){Kt(e,e.return,fe)}e.flags&=-3}s&4096&&(e.flags&=-4097)}function W8(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var s=e;W8(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),e=e.sibling}}function li(e,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Q8(e,s.alternate,s),s=s.sibling}function tl(e){for(e=e.child;e!==null;){var s=e;switch(s.tag){case 0:case 11:case 14:case 15:Hi(4,s,s.return),tl(s);break;case 1:Ia(s,s.return);var i=s.stateNode;typeof i.componentWillUnmount=="function"&&U8(s,s.return,i),tl(s);break;case 27:Gc(s.stateNode);case 26:case 5:Ia(s,s.return),tl(s);break;case 22:s.memoizedState===null&&tl(s);break;case 30:tl(s);break;default:tl(s)}e=e.sibling}}function oi(e,s,i){for(i=i&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var o=s.alternate,d=e,f=s,v=f.flags;switch(f.tag){case 0:case 11:case 15:oi(d,f,i),Ic(4,f);break;case 1:if(oi(d,f,i),o=f,d=o.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(J){Kt(o,o.return,J)}if(o=f,d=o.updateQueue,d!==null){var k=o.stateNode;try{var O=d.shared.hiddenCallbacks;if(O!==null)for(d.shared.hiddenCallbacks=null,d=0;d<O.length;d++)T0(O[d],k)}catch(J){Kt(o,o.return,J)}}i&&v&64&&P8(f),zc(f,f.return);break;case 27:H8(f);case 26:case 5:oi(d,f,i),i&&o===null&&v&4&&q8(f),zc(f,f.return);break;case 12:oi(d,f,i);break;case 31:oi(d,f,i),i&&v&4&&K8(d,f);break;case 13:oi(d,f,i),i&&v&4&&Y8(d,f);break;case 22:f.memoizedState===null&&oi(d,f,i),zc(f,f.return);break;case 30:break;default:oi(d,f,i)}s=s.sibling}}function jm(e,s){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(e=s.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&jc(i))}function wm(e,s){e=null,s.alternate!==null&&(e=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==e&&(s.refCount++,e!=null&&jc(e))}function ya(e,s,i,o){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)X8(e,s,i,o),s=s.sibling}function X8(e,s,i,o){var d=s.flags;switch(s.tag){case 0:case 11:case 15:ya(e,s,i,o),d&2048&&Ic(9,s);break;case 1:ya(e,s,i,o);break;case 3:ya(e,s,i,o),d&2048&&(e=null,s.alternate!==null&&(e=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==e&&(s.refCount++,e!=null&&jc(e)));break;case 12:if(d&2048){ya(e,s,i,o),e=s.stateNode;try{var f=s.memoizedProps,v=f.id,k=f.onPostCommit;typeof k=="function"&&k(v,s.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Kt(s,s.return,O)}}else ya(e,s,i,o);break;case 31:ya(e,s,i,o);break;case 13:ya(e,s,i,o);break;case 23:break;case 22:f=s.stateNode,v=s.alternate,s.memoizedState!==null?f._visibility&2?ya(e,s,i,o):Bc(e,s):f._visibility&2?ya(e,s,i,o):(f._visibility|=2,oo(e,s,i,o,(s.subtreeFlags&10256)!==0||!1)),d&2048&&jm(v,s);break;case 24:ya(e,s,i,o),d&2048&&wm(s.alternate,s);break;default:ya(e,s,i,o)}}function oo(e,s,i,o,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var f=e,v=s,k=i,O=o,J=v.flags;switch(v.tag){case 0:case 11:case 15:oo(f,v,k,O,d),Ic(8,v);break;case 23:break;case 22:var fe=v.stateNode;v.memoizedState!==null?fe._visibility&2?oo(f,v,k,O,d):Bc(f,v):(fe._visibility|=2,oo(f,v,k,O,d)),d&&J&2048&&jm(v.alternate,v);break;case 24:oo(f,v,k,O,d),d&&J&2048&&wm(v.alternate,v);break;default:oo(f,v,k,O,d)}s=s.sibling}}function Bc(e,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var i=e,o=s,d=o.flags;switch(o.tag){case 22:Bc(i,o),d&2048&&jm(o.alternate,o);break;case 24:Bc(i,o),d&2048&&wm(o.alternate,o);break;default:Bc(i,o)}s=s.sibling}}var Pc=8192;function co(e,s,i){if(e.subtreeFlags&Pc)for(e=e.child;e!==null;)J8(e,s,i),e=e.sibling}function J8(e,s,i){switch(e.tag){case 26:co(e,s,i),e.flags&Pc&&e.memoizedState!==null&&X5(i,ga,e.memoizedState,e.memoizedProps);break;case 5:co(e,s,i);break;case 3:case 4:var o=ga;ga=Wd(e.stateNode.containerInfo),co(e,s,i),ga=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Pc,Pc=16777216,co(e,s,i),Pc=o):co(e,s,i));break;default:co(e,s,i)}}function eg(e){var s=e.alternate;if(s!==null&&(e=s.child,e!==null)){s.child=null;do s=e.sibling,e.sibling=null,e=s;while(e!==null)}}function Uc(e){var s=e.deletions;if((e.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var o=s[i];Qn=o,ng(o,e)}eg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)tg(e),e=e.sibling}function tg(e){switch(e.tag){case 0:case 11:case 15:Uc(e),e.flags&2048&&Hi(9,e,e.return);break;case 3:Uc(e);break;case 12:Uc(e);break;case 22:var s=e.stateNode;e.memoizedState!==null&&s._visibility&2&&(e.return===null||e.return.tag!==13)?(s._visibility&=-3,Bd(e)):Uc(e);break;default:Uc(e)}}function Bd(e){var s=e.deletions;if((e.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var o=s[i];Qn=o,ng(o,e)}eg(e)}for(e=e.child;e!==null;){switch(s=e,s.tag){case 0:case 11:case 15:Hi(8,s,s.return),Bd(s);break;case 22:i=s.stateNode,i._visibility&2&&(i._visibility&=-3,Bd(s));break;default:Bd(s)}e=e.sibling}}function ng(e,s){for(;Qn!==null;){var i=Qn;switch(i.tag){case 0:case 11:case 15:Hi(8,i,s);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var o=i.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:jc(i.memoizedState.cache)}if(o=i.child,o!==null)o.return=i,Qn=o;else e:for(i=e;Qn!==null;){o=Qn;var d=o.sibling,f=o.return;if(G8(o),o===i){Qn=null;break e}if(d!==null){d.return=f,Qn=d;break e}Qn=f}}}var h5={getCacheForType:function(e){var s=Yn(En),i=s.data.get(e);return i===void 0&&(i=e(),s.data.set(e,i)),i},cacheSignal:function(){return Yn(En).controller.signal}},m5=typeof WeakMap=="function"?WeakMap:Map,Pt=0,an=null,Ct=null,Et=0,Vt=0,$s=null,Fi=!1,uo=!1,km=!1,ci=0,_n=0,Qi=0,nl=0,Nm=0,Hs=0,fo=0,qc=null,ws=null,Cm=!1,Pd=0,sg=0,Ud=1/0,qd=null,Gi=null,In=0,Vi=null,ho=null,ui=0,Tm=0,Em=null,ag=null,$c=0,Mm=null;function Fs(){return(Pt&2)!==0&&Et!==0?Et&-Et:E.T!==null?Im():ls()}function ig(){if(Hs===0)if((Et&536870912)===0||jt){var e=Ee;Ee<<=1,(Ee&3932160)===0&&(Ee=262144),Hs=e}else Hs=536870912;return e=Us.current,e!==null&&(e.flags|=32),Hs}function ks(e,s,i){(e===an&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)&&(mo(e,0),Ki(e,Et,Hs,!1)),is(e,i),((Pt&2)===0||e!==an)&&(e===an&&((Pt&2)===0&&(nl|=i),_n===4&&Ki(e,Et,Hs,!1)),za(e))}function rg(e,s,i){if((Pt&6)!==0)throw Error(r(327));var o=!i&&(s&127)===0&&(s&e.expiredLanes)===0||Un(e,s),d=o?y5(e,s):Am(e,s,!0),f=o;do{if(d===0){uo&&!o&&Ki(e,s,0,!1);break}else{if(i=e.current.alternate,f&&!p5(i)){d=Am(e,s,!1),f=!1;continue}if(d===2){if(f=s,e.errorRecoveryDisabledLanes&f)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var k=e;d=qc;var O=k.current.memoizedState.isDehydrated;if(O&&(mo(k,v).flags|=256),v=Am(k,v,!1),v!==2){if(km&&!O){k.errorRecoveryDisabledLanes|=f,nl|=f,d=4;break e}f=ws,ws=d,f!==null&&(ws===null?ws=f:ws.push.apply(ws,f))}d=v}if(f=!1,d!==2)continue}}if(d===1){mo(e,0),Ki(e,s,0,!0);break}e:{switch(o=e,f=d,f){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:Ki(o,s,Hs,!Fi);break e;case 2:ws=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(d=Pd+300-Re(),10<d)){if(Ki(o,s,Hs,!Fi),pn(o,0,!0)!==0)break e;ui=s,o.timeoutHandle=zg(lg.bind(null,o,i,ws,qd,Cm,s,Hs,nl,fo,Fi,f,"Throttled",-0,0),d);break e}lg(o,i,ws,qd,Cm,s,Hs,nl,fo,Fi,f,null,-0,0)}}break}while(!0);za(e)}function lg(e,s,i,o,d,f,v,k,O,J,fe,ve,se,re){if(e.timeoutHandle=-1,ve=s.subtreeFlags,ve&8192||(ve&16785408)===16785408){ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ks},J8(s,f,ve);var Fe=(f&62914560)===f?Pd-Re():(f&4194048)===f?sg-Re():0;if(Fe=J5(ve,Fe),Fe!==null){ui=f,e.cancelPendingCommit=Fe(pg.bind(null,e,s,f,i,o,d,v,k,O,fe,ve,null,se,re)),Ki(e,f,v,!J);return}}pg(e,s,f,i,o,d,v,k,O)}function p5(e){for(var s=e;;){var i=s.tag;if((i===0||i===11||i===15)&&s.flags&16384&&(i=s.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var o=0;o<i.length;o++){var d=i[o],f=d.getSnapshot;d=d.value;try{if(!Cn(f(),d))return!1}catch{return!1}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Ki(e,s,i,o){s&=~Nm,s&=~nl,e.suspendedLanes|=s,e.pingedLanes&=~s,o&&(e.warmLanes|=s),o=e.expirationTimes;for(var d=s;0<d;){var f=31-De(d),v=1<<f;o[f]=-1,d&=~v}i!==0&&la(e,i,s)}function $d(){return(Pt&6)===0?(Hc(0),!1):!0}function Rm(){if(Ct!==null){if(Vt===0)var e=Ct.return;else e=Ct,Ja=pa=null,Vh(e),so=null,kc=0,e=Ct;for(;e!==null;)B8(e.alternate,e),e=e.return;Ct=null}}function mo(e,s){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,L5(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ui=0,Rm(),an=e,Ct=i=Ws(e.current,null),Et=s,Vt=0,$s=null,Fi=!1,uo=Un(e,s),km=!1,fo=Hs=Nm=nl=Qi=_n=0,ws=qc=null,Cm=!1,(s&8)!==0&&(s|=s&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=s;0<o;){var d=31-De(o),f=1<<d;s|=e[d],o&=~f}return ci=s,Hr(),i}function og(e,s){yt=null,E.H=Dc,s===no||s===yd?(s=w0(),Vt=3):s===Lh?(s=w0(),Vt=4):Vt=s===cm?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,$s=s,Ct===null&&(_n=1,Rd(e,D(s,e.current)))}function cg(){var e=Us.current;return e===null?!0:(Et&4194048)===Et?Js===null:(Et&62914560)===Et||(Et&536870912)!==0?e===Js:!1}function ug(){var e=E.H;return E.H=Dc,e===null?Dc:e}function dg(){var e=E.A;return E.A=h5,e}function Hd(){_n=4,Fi||(Et&4194048)!==Et&&Us.current!==null||(uo=!0),(Qi&134217727)===0&&(nl&134217727)===0||an===null||Ki(an,Et,Hs,!1)}function Am(e,s,i){var o=Pt;Pt|=2;var d=ug(),f=dg();(an!==e||Et!==s)&&(qd=null,mo(e,s)),s=!1;var v=_n;e:do try{if(Vt!==0&&Ct!==null){var k=Ct,O=$s;switch(Vt){case 8:Rm(),v=6;break e;case 3:case 2:case 9:case 6:Us.current===null&&(s=!0);var J=Vt;if(Vt=0,$s=null,po(e,k,O,J),i&&uo){v=0;break e}break;default:J=Vt,Vt=0,$s=null,po(e,k,O,J)}}g5(),v=_n;break}catch(fe){og(e,fe)}while(!0);return s&&e.shellSuspendCounter++,Ja=pa=null,Pt=o,E.H=d,E.A=f,Ct===null&&(an=null,Et=0,Hr()),v}function g5(){for(;Ct!==null;)fg(Ct)}function y5(e,s){var i=Pt;Pt|=2;var o=ug(),d=dg();an!==e||Et!==s?(qd=null,Ud=Re()+500,mo(e,s)):uo=Un(e,s);e:do try{if(Vt!==0&&Ct!==null){s=Ct;var f=$s;t:switch(Vt){case 1:Vt=0,$s=null,po(e,s,f,1);break;case 2:case 9:if(S0(f)){Vt=0,$s=null,hg(s);break}s=function(){Vt!==2&&Vt!==9||an!==e||(Vt=7),za(e)},f.then(s,s);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:S0(f)?(Vt=0,$s=null,hg(s)):(Vt=0,$s=null,po(e,s,f,7));break;case 5:var v=null;switch(Ct.tag){case 26:v=Ct.memoizedState;case 5:case 27:var k=Ct;if(v?Xg(v):k.stateNode.complete){Vt=0,$s=null;var O=k.sibling;if(O!==null)Ct=O;else{var J=k.return;J!==null?(Ct=J,Fd(J)):Ct=null}break t}}Vt=0,$s=null,po(e,s,f,5);break;case 6:Vt=0,$s=null,po(e,s,f,6);break;case 8:Rm(),_n=6;break e;default:throw Error(r(462))}}v5();break}catch(fe){og(e,fe)}while(!0);return Ja=pa=null,E.H=o,E.A=d,Pt=i,Ct!==null?0:(an=null,Et=0,Hr(),_n)}function v5(){for(;Ct!==null&&!de();)fg(Ct)}function fg(e){var s=I8(e.alternate,e,ci);e.memoizedProps=e.pendingProps,s===null?Fd(e):Ct=s}function hg(e){var s=e,i=s.alternate;switch(s.tag){case 15:case 0:s=M8(i,s,s.pendingProps,s.type,void 0,Et);break;case 11:s=M8(i,s,s.pendingProps,s.type.render,s.ref,Et);break;case 5:Vh(s);default:B8(i,s),s=Ct=_c(s,ci),s=I8(i,s,ci)}e.memoizedProps=e.pendingProps,s===null?Fd(e):Ct=s}function po(e,s,i,o){Ja=pa=null,Vh(s),so=null,kc=0;var d=s.return;try{if(r5(e,d,s,i,Et)){_n=1,Rd(e,D(i,e.current)),Ct=null;return}}catch(f){if(d!==null)throw Ct=d,f;_n=1,Rd(e,D(i,e.current)),Ct=null;return}s.flags&32768?(jt||o===1?e=!0:uo||(Et&536870912)!==0?e=!1:(Fi=e=!0,(o===2||o===9||o===3||o===6)&&(o=Us.current,o!==null&&o.tag===13&&(o.flags|=16384))),mg(s,e)):Fd(s)}function Fd(e){var s=e;do{if((s.flags&32768)!==0){mg(s,Fi);return}e=s.return;var i=c5(s.alternate,s,ci);if(i!==null){Ct=i;return}if(s=s.sibling,s!==null){Ct=s;return}Ct=s=e}while(s!==null);_n===0&&(_n=5)}function mg(e,s){do{var i=u5(e.alternate,e);if(i!==null){i.flags&=32767,Ct=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!s&&(e=e.sibling,e!==null)){Ct=e;return}Ct=e=i}while(e!==null);_n=6,Ct=null}function pg(e,s,i,o,d,f,v,k,O){e.cancelPendingCommit=null;do Qd();while(In!==0);if((Pt&6)!==0)throw Error(r(327));if(s!==null){if(s===e.current)throw Error(r(177));if(f=s.lanes|s.childLanes,f|=fd,Ci(e,i,f,v,k,O),e===an&&(Ct=an=null,Et=0),ho=s,Vi=e,ui=i,Tm=f,Em=d,ag=o,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,S5(kt,function(){return bg(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=E.T,E.T=null,d=U.p,U.p=2,v=Pt,Pt|=4;try{d5(e,s,i)}finally{Pt=v,U.p=d,E.T=o}}In=1,gg(),yg(),vg()}}function gg(){if(In===1){In=0;var e=Vi,s=ho,i=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||i){i=E.T,E.T=null;var o=U.p;U.p=2;var d=Pt;Pt|=4;try{Z8(s,e);var f=Fm,v=cd(e.containerInfo),k=f.focusedElem,O=f.selectionRange;if(v!==k&&k&&k.ownerDocument&&od(k.ownerDocument.documentElement,k)){if(O!==null&&uc(k)){var J=O.start,fe=O.end;if(fe===void 0&&(fe=J),"selectionStart"in k)k.selectionStart=J,k.selectionEnd=Math.min(fe,k.value.length);else{var ve=k.ownerDocument||document,se=ve&&ve.defaultView||window;if(se.getSelection){var re=se.getSelection(),Fe=k.textContent.length,lt=Math.min(O.start,Fe),en=O.end===void 0?lt:Math.min(O.end,Fe);!re.extend&&lt>en&&(v=en,en=lt,lt=v);var G=ld(k,lt),P=ld(k,en);if(G&&P&&(re.rangeCount!==1||re.anchorNode!==G.node||re.anchorOffset!==G.offset||re.focusNode!==P.node||re.focusOffset!==P.offset)){var X=ve.createRange();X.setStart(G.node,G.offset),re.removeAllRanges(),lt>en?(re.addRange(X),re.extend(P.node,P.offset)):(X.setEnd(P.node,P.offset),re.addRange(X))}}}}for(ve=[],re=k;re=re.parentNode;)re.nodeType===1&&ve.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<ve.length;k++){var ye=ve[k];ye.element.scrollLeft=ye.left,ye.element.scrollTop=ye.top}}sf=!!Hm,Fm=Hm=null}finally{Pt=d,U.p=o,E.T=i}}e.current=s,In=2}}function yg(){if(In===2){In=0;var e=Vi,s=ho,i=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||i){i=E.T,E.T=null;var o=U.p;U.p=2;var d=Pt;Pt|=4;try{Q8(e,s.alternate,s)}finally{Pt=d,U.p=o,E.T=i}}In=3}}function vg(){if(In===4||In===3){In=0,Ae();var e=Vi,s=ho,i=ui,o=ag;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?In=5:(In=0,ho=Vi=null,_g(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Gi=null),Vs(i),s=s.stateNode,oe&&typeof oe.onCommitFiberRoot=="function")try{oe.onCommitFiberRoot(ln,s,void 0,(s.current.flags&128)===128)}catch{}if(o!==null){s=E.T,d=U.p,U.p=2,E.T=null;try{for(var f=e.onRecoverableError,v=0;v<o.length;v++){var k=o[v];f(k.value,{componentStack:k.stack})}}finally{E.T=s,U.p=d}}(ui&3)!==0&&Qd(),za(e),d=e.pendingLanes,(i&261930)!==0&&(d&42)!==0?e===Mm?$c++:($c=0,Mm=e):$c=0,Hc(0)}}function _g(e,s){(e.pooledCacheLanes&=s)===0&&(s=e.pooledCache,s!=null&&(e.pooledCache=null,jc(s)))}function Qd(){return gg(),yg(),vg(),bg()}function bg(){if(In!==5)return!1;var e=Vi,s=Tm;Tm=0;var i=Vs(ui),o=E.T,d=U.p;try{U.p=32>i?32:i,E.T=null,i=Em,Em=null;var f=Vi,v=ui;if(In=0,ho=Vi=null,ui=0,(Pt&6)!==0)throw Error(r(331));var k=Pt;if(Pt|=4,tg(f.current),X8(f,f.current,v,i),Pt=k,Hc(0,!1),oe&&typeof oe.onPostCommitFiberRoot=="function")try{oe.onPostCommitFiberRoot(ln,f)}catch{}return!0}finally{U.p=d,E.T=o,_g(e,s)}}function xg(e,s,i){s=D(i,s),s=om(e.stateNode,s,2),e=Ui(e,s,2),e!==null&&(is(e,2),za(e))}function Kt(e,s,i){if(e.tag===3)xg(e,e,i);else for(;s!==null;){if(s.tag===3){xg(s,e,i);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Gi===null||!Gi.has(o))){e=D(i,e),i=S8(2),o=Ui(s,i,2),o!==null&&(j8(i,o,s,e),is(o,2),za(o));break}}s=s.return}}function Dm(e,s,i){var o=e.pingCache;if(o===null){o=e.pingCache=new m5;var d=new Set;o.set(s,d)}else d=o.get(s),d===void 0&&(d=new Set,o.set(s,d));d.has(i)||(km=!0,d.add(i),e=_5.bind(null,e,s,i),s.then(e,e))}function _5(e,s,i){var o=e.pingCache;o!==null&&o.delete(s),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,an===e&&(Et&i)===i&&(_n===4||_n===3&&(Et&62914560)===Et&&300>Re()-Pd?(Pt&2)===0&&mo(e,0):Nm|=i,fo===Et&&(fo=0)),za(e)}function Sg(e,s){s===0&&(s=ps()),e=Oa(e,s),e!==null&&(is(e,s),za(e))}function b5(e){var s=e.memoizedState,i=0;s!==null&&(i=s.retryLane),Sg(e,i)}function x5(e,s){var i=0;switch(e.tag){case 31:case 13:var o=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(s),Sg(e,i)}function S5(e,s){return tn(e,s)}var Gd=null,go=null,Om=!1,Vd=!1,Lm=!1,Yi=0;function za(e){e!==go&&e.next===null&&(go===null?Gd=go=e:go=go.next=e),Vd=!0,Om||(Om=!0,w5())}function Hc(e,s){if(!Lm&&Vd){Lm=!0;do for(var i=!1,o=Gd;o!==null;){if(e!==0){var d=o.pendingLanes;if(d===0)var f=0;else{var v=o.suspendedLanes,k=o.pingedLanes;f=(1<<31-De(42|e)+1)-1,f&=d&~(v&~k),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(i=!0,Ng(o,f))}else f=Et,f=pn(o,o===an?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||Un(o,f)||(i=!0,Ng(o,f));o=o.next}while(i);Lm=!1}}function j5(){jg()}function jg(){Vd=Om=!1;var e=0;Yi!==0&&O5()&&(e=Yi);for(var s=Re(),i=null,o=Gd;o!==null;){var d=o.next,f=wg(o,s);f===0?(o.next=null,i===null?Gd=d:i.next=d,d===null&&(go=i)):(i=o,(e!==0||(f&3)!==0)&&(Vd=!0)),o=d}In!==0&&In!==5||Hc(e),Yi!==0&&(Yi=0)}function wg(e,s){for(var i=e.suspendedLanes,o=e.pingedLanes,d=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var v=31-De(f),k=1<<v,O=d[v];O===-1?((k&i)===0||(k&o)!==0)&&(d[v]=xn(k,s)):O<=s&&(e.expiredLanes|=k),f&=~k}if(s=an,i=Et,i=pn(e,e===s?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,i===0||e===s&&(Vt===2||Vt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&$t(o),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||Un(e,i)){if(s=i&-i,s===e.callbackPriority)return s;switch(o!==null&&$t(o),Vs(i)){case 2:case 8:i=mt;break;case 32:i=kt;break;case 268435456:i=Pn;break;default:i=kt}return o=kg.bind(null,e),i=tn(i,o),e.callbackPriority=s,e.callbackNode=i,s}return o!==null&&o!==null&&$t(o),e.callbackPriority=2,e.callbackNode=null,2}function kg(e,s){if(In!==0&&In!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Qd()&&e.callbackNode!==i)return null;var o=Et;return o=pn(e,e===an?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(rg(e,o,s),wg(e,Re()),e.callbackNode!=null&&e.callbackNode===i?kg.bind(null,e):null)}function Ng(e,s){if(Qd())return null;rg(e,s,!0)}function w5(){I5(function(){(Pt&6)!==0?tn(Ke,j5):jg()})}function Im(){if(Yi===0){var e=eo;e===0&&(e=He,He<<=1,(He&261888)===0&&(He=256)),Yi=e}return Yi}function Cg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ua(""+e)}function Tg(e,s){var i=s.ownerDocument.createElement("input");return i.name=s.name,i.value=s.value,e.id&&i.setAttribute("form",e.id),s.parentNode.insertBefore(i,s),e=new FormData(e),i.parentNode.removeChild(i),e}function k5(e,s,i,o,d){if(s==="submit"&&i&&i.stateNode===d){var f=Cg((d[we]||null).action),v=o.submitter;v&&(s=(s=v[we]||null)?Cg(s.formAction):v.getAttribute("formAction"),s!==null&&(f=s,v=null));var k=new zr("action","action",null,o,d);e.push({event:k,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Yi!==0){var O=v?Tg(d,v):new FormData(d);nm(i,{pending:!0,data:O,method:d.method,action:f},null,O)}}else typeof f=="function"&&(k.preventDefault(),O=v?Tg(d,v):new FormData(d),nm(i,{pending:!0,data:O,method:d.method,action:f},f,O))},currentTarget:d}]})}}for(var zm=0;zm<Fl.length;zm++){var Bm=Fl[zm],N5=Bm.toLowerCase(),C5=Bm[0].toUpperCase()+Bm.slice(1);zs(N5,"on"+C5)}zs(mc,"onAnimationEnd"),zs(pc,"onAnimationIteration"),zs(gc,"onAnimationStart"),zs("dblclick","onDoubleClick"),zs("focusin","onFocus"),zs("focusout","onBlur"),zs(ud,"onTransitionRun"),zs(Th,"onTransitionStart"),zs(Eh,"onTransitionCancel"),zs(dd,"onTransitionEnd"),sn("onMouseEnter",["mouseout","mouseover"]),sn("onMouseLeave",["mouseout","mouseover"]),sn("onPointerEnter",["pointerout","pointerover"]),sn("onPointerLeave",["pointerout","pointerover"]),yn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yn("onBeforeInput",["compositionend","keypress","textInput","paste"]),yn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fc="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(" "),T5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fc));function Eg(e,s){s=(s&4)!==0;for(var i=0;i<e.length;i++){var o=e[i],d=o.event;o=o.listeners;e:{var f=void 0;if(s)for(var v=o.length-1;0<=v;v--){var k=o[v],O=k.instance,J=k.currentTarget;if(k=k.listener,O!==f&&d.isPropagationStopped())break e;f=k,d.currentTarget=J;try{f(d)}catch(fe){Ql(fe)}d.currentTarget=null,f=O}else for(v=0;v<o.length;v++){if(k=o[v],O=k.instance,J=k.currentTarget,k=k.listener,O!==f&&d.isPropagationStopped())break e;f=k,d.currentTarget=J;try{f(d)}catch(fe){Ql(fe)}d.currentTarget=null,f=O}}}}function Tt(e,s){var i=s[Ve];i===void 0&&(i=s[Ve]=new Set);var o=e+"__bubble";i.has(o)||(Mg(s,e,2,!1),i.add(o))}function Pm(e,s,i){var o=0;s&&(o|=4),Mg(i,e,o,s)}var Kd="_reactListening"+Math.random().toString(36).slice(2);function Um(e){if(!e[Kd]){e[Kd]=!0,on.forEach(function(i){i!=="selectionchange"&&(T5.has(i)||Pm(i,!1,e),Pm(i,!0,e))});var s=e.nodeType===9?e:e.ownerDocument;s===null||s[Kd]||(s[Kd]=!0,Pm("selectionchange",!1,s))}}function Mg(e,s,i,o){switch(i4(s)){case 2:var d=nv;break;case 8:d=sv;break;default:d=t1}i=d.bind(null,s,i,e),d=void 0,!Ei||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),o?d!==void 0?e.addEventListener(s,i,{capture:!0,passive:d}):e.addEventListener(s,i,!0):d!==void 0?e.addEventListener(s,i,{passive:d}):e.addEventListener(s,i,!1)}function qm(e,s,i,o,d){var f=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var v=o.tag;if(v===3||v===4){var k=o.stateNode.containerInfo;if(k===d)break;if(v===4)for(v=o.return;v!==null;){var O=v.tag;if((O===3||O===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;k!==null;){if(v=wn(k),v===null)return;if(O=v.tag,O===5||O===6||O===26||O===27){o=f=v;continue e}k=k.parentNode}}o=o.return}Dr(function(){var J=f,fe=fn(i),ve=[];e:{var se=yc.get(e);if(se!==void 0){var re=zr,Fe=e;switch(e){case"keypress":if(Ka(i)===0)break e;case"keydown":case"keyup":re=Kn;break;case"focusin":Fe="focus",re=Il;break;case"focusout":Fe="blur",re=Il;break;case"beforeblur":case"afterblur":re=Il;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=Vu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Ll;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=_h;break;case mc:case pc:case gc:re=dh;break;case dd:re=Pl;break;case"scroll":case"scrollend":re=Ya;break;case"wheel":re=Zs;break;case"copy":case"cut":case"paste":re=hh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=Bl;break;case"toggle":case"beforetoggle":re=Zu}var lt=(s&4)!==0,en=!lt&&(e==="scroll"||e==="scrollend"),G=lt?se!==null?se+"Capture":null:se;lt=[];for(var P=J,X;P!==null;){var ye=P;if(X=ye.stateNode,ye=ye.tag,ye!==5&&ye!==26&&ye!==27||X===null||G===null||(ye=Na(P,G),ye!=null&&lt.push(Qc(P,ye,X))),en)break;P=P.return}0<lt.length&&(se=new re(se,Fe,null,i,fe),ve.push({event:se,listeners:lt}))}}if((s&7)===0){e:{if(se=e==="mouseover"||e==="pointerover",re=e==="mouseout"||e==="pointerout",se&&i!==As&&(Fe=i.relatedTarget||i.fromElement)&&(wn(Fe)||Fe[ke]))break e;if((re||se)&&(se=fe.window===fe?fe:(se=fe.ownerDocument)?se.defaultView||se.parentWindow:window,re?(Fe=i.relatedTarget||i.toElement,re=J,Fe=Fe?wn(Fe):null,Fe!==null&&(en=u(Fe),lt=Fe.tag,Fe!==en||lt!==5&&lt!==27&&lt!==6)&&(Fe=null)):(re=null,Fe=J),re!==Fe)){if(lt=Vu,ye="onMouseLeave",G="onMouseEnter",P="mouse",(e==="pointerout"||e==="pointerover")&&(lt=Bl,ye="onPointerLeave",G="onPointerEnter",P="pointer"),en=re==null?se:Ln(re),X=Fe==null?se:Ln(Fe),se=new lt(ye,P+"leave",re,i,fe),se.target=en,se.relatedTarget=X,ye=null,wn(fe)===J&&(lt=new lt(G,P+"enter",Fe,i,fe),lt.target=X,lt.relatedTarget=en,ye=lt),en=ye,re&&Fe)t:{for(lt=E5,G=re,P=Fe,X=0,ye=G;ye;ye=lt(ye))X++;ye=0;for(var tt=P;tt;tt=lt(tt))ye++;for(;0<X-ye;)G=lt(G),X--;for(;0<ye-X;)P=lt(P),ye--;for(;X--;){if(G===P||P!==null&&G===P.alternate){lt=G;break t}G=lt(G),P=lt(P)}lt=null}else lt=null;re!==null&&Rg(ve,se,re,lt,!1),Fe!==null&&en!==null&&Rg(ve,en,Fe,lt,!0)}}e:{if(se=J?Ln(J):window,re=se.nodeName&&se.nodeName.toLowerCase(),re==="select"||re==="input"&&se.type==="file")var It=td;else if(lc(se))if(nd)It=kh;else{It=jh;var Ze=Sh}else re=se.nodeName,!re||re.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?J&&Dl(J.elementType)&&(It=td):It=wh;if(It&&(It=It(e,J))){oc(ve,It,i,fe);break e}Ze&&Ze(e,se,J),e==="focusout"&&J&&se.type==="number"&&J.memoizedProps.value!=null&&ys(se,"number",se.value)}switch(Ze=J?Ln(J):window,e){case"focusin":(lc(Ze)||Ze.contentEditable==="true")&&(Li=Ze,dc=J,$r=null);break;case"focusout":$r=dc=Li=null;break;case"mousedown":$l=!0;break;case"contextmenu":case"mouseup":case"dragend":$l=!1,fc(ve,i,fe);break;case"selectionchange":if(Ch)break;case"keydown":case"keyup":fc(ve,i,fe)}var _t;if(Ur)e:{switch(e){case"compositionstart":var Mt="onCompositionStart";break e;case"compositionend":Mt="onCompositionEnd";break e;case"compositionupdate":Mt="onCompositionUpdate";break e}Mt=void 0}else Ai?Xu(e,i)&&(Mt="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Mt="onCompositionStart");Mt&&(Ma&&i.locale!=="ko"&&(Ai||Mt!=="onCompositionStart"?Mt==="onCompositionEnd"&&Ai&&(_t=ec()):(Os=fe,Or="value"in Os?Os.value:Os.textContent,Ai=!0)),Ze=Yd(J,Mt),0<Ze.length&&(Mt=new Ku(Mt,e,null,i,fe),ve.push({event:Mt,listeners:Ze}),_t?Mt.data=_t:(_t=rc(i),_t!==null&&(Mt.data=_t)))),(_t=ic?Ju(e,i):ed(e,i))&&(Mt=Yd(J,"onBeforeInput"),0<Mt.length&&(Ze=new Ku("onBeforeInput","beforeinput",null,i,fe),ve.push({event:Ze,listeners:Mt}),Ze.data=_t)),k5(ve,e,J,i,fe)}Eg(ve,s)})}function Qc(e,s,i){return{instance:e,listener:s,currentTarget:i}}function Yd(e,s){for(var i=s+"Capture",o=[];e!==null;){var d=e,f=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||f===null||(d=Na(e,i),d!=null&&o.unshift(Qc(e,d,f)),d=Na(e,s),d!=null&&o.push(Qc(e,d,f))),e.tag===3)return o;e=e.return}return[]}function E5(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Rg(e,s,i,o,d){for(var f=s._reactName,v=[];i!==null&&i!==o;){var k=i,O=k.alternate,J=k.stateNode;if(k=k.tag,O!==null&&O===o)break;k!==5&&k!==26&&k!==27||J===null||(O=J,d?(J=Na(i,f),J!=null&&v.unshift(Qc(i,J,O))):d||(J=Na(i,f),J!=null&&v.push(Qc(i,J,O)))),i=i.return}v.length!==0&&e.push({event:s,listeners:v})}var M5=/\r\n?/g,R5=/\u0000|\uFFFD/g;function Ag(e){return(typeof e=="string"?e:""+e).replace(M5,`
50
- `).replace(R5,"")}function Dg(e,s){return s=Ag(s),Ag(e)===s}function Jt(e,s,i,o,d,f){switch(i){case"children":typeof o=="string"?s==="body"||s==="textarea"&&o===""||ca(e,o):(typeof o=="number"||typeof o=="bigint")&&s!=="body"&&ca(e,""+o);break;case"className":Rl(e,"class",o);break;case"tabIndex":Rl(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Rl(e,i,o);break;case"style":Ar(e,o,f);break;case"data":if(s!=="object"){Rl(e,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||i!=="href")){e.removeAttribute(i);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=ua(""+o),e.setAttribute(i,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(i,"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 f=="function"&&(i==="formAction"?(s!=="input"&&Jt(e,s,"name",d.name,d,null),Jt(e,s,"formEncType",d.formEncType,d,null),Jt(e,s,"formMethod",d.formMethod,d,null),Jt(e,s,"formTarget",d.formTarget,d,null)):(Jt(e,s,"encType",d.encType,d,null),Jt(e,s,"method",d.method,d,null),Jt(e,s,"target",d.target,d,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=ua(""+o),e.setAttribute(i,o);break;case"onClick":o!=null&&(e.onclick=Ks);break;case"onScroll":o!=null&&Tt("scroll",e);break;case"onScrollEnd":o!=null&&Tt("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}i=ua(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""+o):e.removeAttribute(i);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":o===!0?e.setAttribute(i,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,o):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(i,o):e.removeAttribute(i);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(i):e.setAttribute(i,o);break;case"popover":Tt("beforetoggle",e),Tt("toggle",e),Sa(e,"popover",o);break;case"xlinkActuate":oa(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":oa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":oa(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":oa(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":oa(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":oa(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":oa(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":oa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":oa(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Sa(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=ka.get(i)||i,Sa(e,i,o))}}function $m(e,s,i,o,d,f){switch(i){case"style":Ar(e,o,f);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof o=="string"?ca(e,o):(typeof o=="number"||typeof o=="bigint")&&ca(e,""+o);break;case"onScroll":o!=null&&Tt("scroll",e);break;case"onScrollEnd":o!=null&&Tt("scrollend",e);break;case"onClick":o!=null&&(e.onclick=Ks);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gn.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(d=i.endsWith("Capture"),s=i.slice(2,d?i.length-7:void 0),f=e[we]||null,f=f!=null?f[i]:null,typeof f=="function"&&e.removeEventListener(s,f,d),typeof o=="function")){typeof f!="function"&&f!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(s,o,d);break e}i in e?e[i]=o:o===!0?e.setAttribute(i,""):Sa(e,i,o)}}}function Wn(e,s,i){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",e),Tt("load",e);var o=!1,d=!1,f;for(f in i)if(i.hasOwnProperty(f)){var v=i[f];if(v!=null)switch(f){case"src":o=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Jt(e,s,f,v,i,null)}}d&&Jt(e,s,"srcSet",i.srcSet,i,null),o&&Jt(e,s,"src",i.src,i,null);return;case"input":Tt("invalid",e);var k=f=v=d=null,O=null,J=null;for(o in i)if(i.hasOwnProperty(o)){var fe=i[o];if(fe!=null)switch(o){case"name":d=fe;break;case"type":v=fe;break;case"checked":O=fe;break;case"defaultChecked":J=fe;break;case"value":f=fe;break;case"defaultValue":k=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,s));break;default:Jt(e,s,o,fe,i,null)}}Va(e,f,k,O,J,v,d,!1);return;case"select":Tt("invalid",e),o=v=f=null;for(d in i)if(i.hasOwnProperty(d)&&(k=i[d],k!=null))switch(d){case"value":f=k;break;case"defaultValue":v=k;break;case"multiple":o=k;default:Jt(e,s,d,k,i,null)}s=f,i=v,e.multiple=!!o,s!=null?Rs(e,!!o,s,!1):i!=null&&Rs(e,!!o,i,!0);return;case"textarea":Tt("invalid",e),f=d=o=null;for(v in i)if(i.hasOwnProperty(v)&&(k=i[v],k!=null))switch(v){case"value":o=k;break;case"defaultValue":d=k;break;case"children":f=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:Jt(e,s,v,k,i,null)}Al(e,o,d,f);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(o=i[O],o!=null))switch(O){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Jt(e,s,O,o,i,null)}return;case"dialog":Tt("beforetoggle",e),Tt("toggle",e),Tt("cancel",e),Tt("close",e);break;case"iframe":case"object":Tt("load",e);break;case"video":case"audio":for(o=0;o<Fc.length;o++)Tt(Fc[o],e);break;case"image":Tt("error",e),Tt("load",e);break;case"details":Tt("toggle",e);break;case"embed":case"source":case"link":Tt("error",e),Tt("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 i)if(i.hasOwnProperty(J)&&(o=i[J],o!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Jt(e,s,J,o,i,null)}return;default:if(Dl(s)){for(fe in i)i.hasOwnProperty(fe)&&(o=i[fe],o!==void 0&&$m(e,s,fe,o,i,void 0));return}}for(k in i)i.hasOwnProperty(k)&&(o=i[k],o!=null&&Jt(e,s,k,o,i,null))}function A5(e,s,i,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,f=null,v=null,k=null,O=null,J=null,fe=null;for(re in i){var ve=i[re];if(i.hasOwnProperty(re)&&ve!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":O=ve;default:o.hasOwnProperty(re)||Jt(e,s,re,null,o,ve)}}for(var se in o){var re=o[se];if(ve=i[se],o.hasOwnProperty(se)&&(re!=null||ve!=null))switch(se){case"type":f=re;break;case"name":d=re;break;case"checked":J=re;break;case"defaultChecked":fe=re;break;case"value":v=re;break;case"defaultValue":k=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,s));break;default:re!==ve&&Jt(e,s,se,re,o,ve)}}Jo(e,v,k,O,J,fe,f,d);return;case"select":re=v=k=se=null;for(f in i)if(O=i[f],i.hasOwnProperty(f)&&O!=null)switch(f){case"value":break;case"multiple":re=O;default:o.hasOwnProperty(f)||Jt(e,s,f,null,o,O)}for(d in o)if(f=o[d],O=i[d],o.hasOwnProperty(d)&&(f!=null||O!=null))switch(d){case"value":se=f;break;case"defaultValue":k=f;break;case"multiple":v=f;default:f!==O&&Jt(e,s,d,f,o,O)}s=k,i=v,o=re,se!=null?Rs(e,!!i,se,!1):!!o!=!!i&&(s!=null?Rs(e,!!i,s,!0):Rs(e,!!i,i?[]:"",!1));return;case"textarea":re=se=null;for(k in i)if(d=i[k],i.hasOwnProperty(k)&&d!=null&&!o.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:Jt(e,s,k,null,o,d)}for(v in o)if(d=o[v],f=i[v],o.hasOwnProperty(v)&&(d!=null||f!=null))switch(v){case"value":se=d;break;case"defaultValue":re=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==f&&Jt(e,s,v,d,o,f)}vs(e,se,re);return;case"option":for(var Fe in i)if(se=i[Fe],i.hasOwnProperty(Fe)&&se!=null&&!o.hasOwnProperty(Fe))switch(Fe){case"selected":e.selected=!1;break;default:Jt(e,s,Fe,null,o,se)}for(O in o)if(se=o[O],re=i[O],o.hasOwnProperty(O)&&se!==re&&(se!=null||re!=null))switch(O){case"selected":e.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Jt(e,s,O,se,o,re)}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 lt in i)se=i[lt],i.hasOwnProperty(lt)&&se!=null&&!o.hasOwnProperty(lt)&&Jt(e,s,lt,null,o,se);for(J in o)if(se=o[J],re=i[J],o.hasOwnProperty(J)&&se!==re&&(se!=null||re!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,s));break;default:Jt(e,s,J,se,o,re)}return;default:if(Dl(s)){for(var en in i)se=i[en],i.hasOwnProperty(en)&&se!==void 0&&!o.hasOwnProperty(en)&&$m(e,s,en,void 0,o,se);for(fe in o)se=o[fe],re=i[fe],!o.hasOwnProperty(fe)||se===re||se===void 0&&re===void 0||$m(e,s,fe,se,o,re);return}}for(var G in i)se=i[G],i.hasOwnProperty(G)&&se!=null&&!o.hasOwnProperty(G)&&Jt(e,s,G,null,o,se);for(ve in o)se=o[ve],re=i[ve],!o.hasOwnProperty(ve)||se===re||se==null&&re==null||Jt(e,s,ve,se,o,re)}function Og(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function D5(){if(typeof performance.getEntriesByType=="function"){for(var e=0,s=0,i=performance.getEntriesByType("resource"),o=0;o<i.length;o++){var d=i[o],f=d.transferSize,v=d.initiatorType,k=d.duration;if(f&&k&&Og(v)){for(v=0,k=d.responseEnd,o+=1;o<i.length;o++){var O=i[o],J=O.startTime;if(J>k)break;var fe=O.transferSize,ve=O.initiatorType;fe&&Og(ve)&&(O=O.responseEnd,v+=fe*(O<k?1:(k-J)/(O-J)))}if(--o,s+=8*(f+v)/(d.duration/1e3),e++,10<e)break}}if(0<e)return s/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Hm=null,Fm=null;function Zd(e){return e.nodeType===9?e:e.ownerDocument}function Lg(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 Ig(e,s){if(e===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&s==="foreignObject"?0:e}function Qm(e,s){return e==="textarea"||e==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Gm=null;function O5(){var e=window.event;return e&&e.type==="popstate"?e===Gm?!1:(Gm=e,!0):(Gm=null,!1)}var zg=typeof setTimeout=="function"?setTimeout:void 0,L5=typeof clearTimeout=="function"?clearTimeout:void 0,Bg=typeof Promise=="function"?Promise:void 0,I5=typeof queueMicrotask=="function"?queueMicrotask:typeof Bg<"u"?function(e){return Bg.resolve(null).then(e).catch(z5)}:zg;function z5(e){setTimeout(function(){throw e})}function Zi(e){return e==="head"}function Pg(e,s){var i=s,o=0;do{var d=i.nextSibling;if(e.removeChild(i),d&&d.nodeType===8)if(i=d.data,i==="/$"||i==="/&"){if(o===0){e.removeChild(d),bo(s);return}o--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")o++;else if(i==="html")Gc(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Gc(i);for(var f=i.firstChild;f;){var v=f.nextSibling,k=f.nodeName;f[es]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&f.rel.toLowerCase()==="stylesheet"||i.removeChild(f),f=v}}else i==="body"&&Gc(e.ownerDocument.body);i=d}while(i);bo(s)}function Ug(e,s){var i=e;e=0;do{var o=i.nextSibling;if(i.nodeType===1?s?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(s?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),o&&o.nodeType===8)if(i=o.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=o}while(i)}function Vm(e){var s=e.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var i=s;switch(s=s.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Vm(i),Ht(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function B5(e,s,i,o){for(;e.nodeType===1;){var d=i;if(e.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[es])switch(s){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(s==="input"&&e.type==="hidden"){var f=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ea(e.nextSibling),e===null)break}return null}function P5(e,s,i){if(s==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=ea(e.nextSibling),e===null))return null;return e}function qg(e,s){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=ea(e.nextSibling),e===null))return null;return e}function Km(e){return e.data==="$?"||e.data==="$~"}function Ym(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function U5(e,s){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=s;else if(e.data!=="$?"||i.readyState!=="loading")s();else{var o=function(){s(),i.removeEventListener("DOMContentLoaded",o)};i.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function ea(e){for(;e!=null;e=e.nextSibling){var s=e.nodeType;if(s===1||s===3)break;if(s===8){if(s=e.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return e}var Zm=null;function $g(e){e=e.nextSibling;for(var s=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(s===0)return ea(e.nextSibling);s--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||s++}e=e.nextSibling}return null}function Hg(e){e=e.previousSibling;for(var s=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(s===0)return e;s--}else i!=="/$"&&i!=="/&"||s++}e=e.previousSibling}return null}function Fg(e,s,i){switch(s=Zd(i),e){case"html":if(e=s.documentElement,!e)throw Error(r(452));return e;case"head":if(e=s.head,!e)throw Error(r(453));return e;case"body":if(e=s.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Gc(e){for(var s=e.attributes;s.length;)e.removeAttributeNode(s[0]);Ht(e)}var ta=new Map,Qg=new Set;function Wd(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var di=U.d;U.d={f:q5,r:$5,D:H5,C:F5,L:Q5,m:G5,X:K5,S:V5,M:Y5};function q5(){var e=di.f(),s=$d();return e||s}function $5(e){var s=kn(e);s!==null&&s.tag===5&&s.type==="form"?o8(s):di.r(e)}var yo=typeof document>"u"?null:document;function Gg(e,s,i){var o=yo;if(o&&typeof s=="string"&&s){var d=ts(s);d='link[rel="'+e+'"][href="'+d+'"]',typeof i=="string"&&(d+='[crossorigin="'+i+'"]'),Qg.has(d)||(Qg.add(d),e={rel:e,crossOrigin:i,href:s},o.querySelector(d)===null&&(s=o.createElement("link"),Wn(s,"link",e),B(s),o.head.appendChild(s)))}}function H5(e){di.D(e),Gg("dns-prefetch",e,null)}function F5(e,s){di.C(e,s),Gg("preconnect",e,s)}function Q5(e,s,i){di.L(e,s,i);var o=yo;if(o&&e&&s){var d='link[rel="preload"][as="'+ts(s)+'"]';s==="image"&&i&&i.imageSrcSet?(d+='[imagesrcset="'+ts(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(d+='[imagesizes="'+ts(i.imageSizes)+'"]')):d+='[href="'+ts(e)+'"]';var f=d;switch(s){case"style":f=vo(e);break;case"script":f=_o(e)}ta.has(f)||(e=g({rel:"preload",href:s==="image"&&i&&i.imageSrcSet?void 0:e,as:s},i),ta.set(f,e),o.querySelector(d)!==null||s==="style"&&o.querySelector(Vc(f))||s==="script"&&o.querySelector(Kc(f))||(s=o.createElement("link"),Wn(s,"link",e),B(s),o.head.appendChild(s)))}}function G5(e,s){di.m(e,s);var i=yo;if(i&&e){var o=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+ts(o)+'"][href="'+ts(e)+'"]',f=d;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=_o(e)}if(!ta.has(f)&&(e=g({rel:"modulepreload",href:e},s),ta.set(f,e),i.querySelector(d)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Kc(f)))return}o=i.createElement("link"),Wn(o,"link",e),B(o),i.head.appendChild(o)}}}function V5(e,s,i){di.S(e,s,i);var o=yo;if(o&&e){var d=un(o).hoistableStyles,f=vo(e);s=s||"default";var v=d.get(f);if(!v){var k={loading:0,preload:null};if(v=o.querySelector(Vc(f)))k.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":s},i),(i=ta.get(f))&&Wm(e,i);var O=v=o.createElement("link");B(O),Wn(O,"link",e),O._p=new Promise(function(J,fe){O.onload=J,O.onerror=fe}),O.addEventListener("load",function(){k.loading|=1}),O.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Xd(v,s,o)}v={type:"stylesheet",instance:v,count:1,state:k},d.set(f,v)}}}function K5(e,s){di.X(e,s);var i=yo;if(i&&e){var o=un(i).hoistableScripts,d=_o(e),f=o.get(d);f||(f=i.querySelector(Kc(d)),f||(e=g({src:e,async:!0},s),(s=ta.get(d))&&Xm(e,s),f=i.createElement("script"),B(f),Wn(f,"link",e),i.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(d,f))}}function Y5(e,s){di.M(e,s);var i=yo;if(i&&e){var o=un(i).hoistableScripts,d=_o(e),f=o.get(d);f||(f=i.querySelector(Kc(d)),f||(e=g({src:e,async:!0,type:"module"},s),(s=ta.get(d))&&Xm(e,s),f=i.createElement("script"),B(f),Wn(f,"link",e),i.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(d,f))}}function Vg(e,s,i,o){var d=(d=Ce.current)?Wd(d):null;if(!d)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(s=vo(i.href),i=un(d).hoistableStyles,o=i.get(s),o||(o={type:"style",instance:null,count:0,state:null},i.set(s,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=vo(i.href);var f=un(d).hoistableStyles,v=f.get(e);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,v),(f=d.querySelector(Vc(e)))&&!f._p&&(v.instance=f,v.state.loading=5),ta.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ta.set(e,i),f||Z5(d,e,i,v.state))),s&&o===null)throw Error(r(528,""));return v}if(s&&o!==null)throw Error(r(529,""));return null;case"script":return s=i.async,i=i.src,typeof i=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=_o(i),i=un(d).hoistableScripts,o=i.get(s),o||(o={type:"script",instance:null,count:0,state:null},i.set(s,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function vo(e){return'href="'+ts(e)+'"'}function Vc(e){return'link[rel="stylesheet"]['+e+"]"}function Kg(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function Z5(e,s,i,o){e.querySelector('link[rel="preload"][as="style"]['+s+"]")?o.loading=1:(s=e.createElement("link"),o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2}),Wn(s,"link",i),B(s),e.head.appendChild(s))}function _o(e){return'[src="'+ts(e)+'"]'}function Kc(e){return"script[async]"+e}function Yg(e,s,i){if(s.count++,s.instance===null)switch(s.type){case"style":var o=e.querySelector('style[data-href~="'+ts(i.href)+'"]');if(o)return s.instance=o,B(o),o;var d=g({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),B(o),Wn(o,"style",d),Xd(o,i.precedence,e),s.instance=o;case"stylesheet":d=vo(i.href);var f=e.querySelector(Vc(d));if(f)return s.state.loading|=4,s.instance=f,B(f),f;o=Kg(i),(d=ta.get(d))&&Wm(o,d),f=(e.ownerDocument||e).createElement("link"),B(f);var v=f;return v._p=new Promise(function(k,O){v.onload=k,v.onerror=O}),Wn(f,"link",o),s.state.loading|=4,Xd(f,i.precedence,e),s.instance=f;case"script":return f=_o(i.src),(d=e.querySelector(Kc(f)))?(s.instance=d,B(d),d):(o=i,(d=ta.get(f))&&(o=g({},i),Xm(o,d)),e=e.ownerDocument||e,d=e.createElement("script"),B(d),Wn(d,"link",o),e.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Xd(o,i.precedence,e));return s.instance}function Xd(e,s,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=o.length?o[o.length-1]:null,f=d,v=0;v<o.length;v++){var k=o[v];if(k.dataset.precedence===s)f=k;else if(f!==d)break}f?f.parentNode.insertBefore(e,f.nextSibling):(s=i.nodeType===9?i.head:i,s.insertBefore(e,s.firstChild))}function Wm(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.title==null&&(e.title=s.title)}function Xm(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.integrity==null&&(e.integrity=s.integrity)}var Jd=null;function Zg(e,s,i){if(Jd===null){var o=new Map,d=Jd=new Map;d.set(i,o)}else d=Jd,o=d.get(i),o||(o=new Map,d.set(i,o));if(o.has(e))return o;for(o.set(e,null),i=i.getElementsByTagName(e),d=0;d<i.length;d++){var f=i[d];if(!(f[es]||f[ge]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(s)||"";v=e+v;var k=o.get(v);k?k.push(f):o.set(v,[f])}}return o}function Wg(e,s,i){e=e.ownerDocument||e,e.head.insertBefore(i,s==="title"?e.querySelector("head > title"):null)}function W5(e,s,i){if(i===1||s.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return e=s.disabled,typeof s.precedence=="string"&&e==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Xg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function X5(e,s,i,o){if(i.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var d=vo(o.href),f=s.querySelector(Vc(d));if(f){s=f._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(e.count++,e=ef.bind(e),s.then(e,e)),i.state.loading|=4,i.instance=f,B(f);return}f=s.ownerDocument||s,o=Kg(o),(d=ta.get(d))&&Wm(o,d),f=f.createElement("link"),B(f);var v=f;v._p=new Promise(function(k,O){v.onload=k,v.onerror=O}),Wn(f,"link",o),i.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,s),(s=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=ef.bind(e),s.addEventListener("load",i),s.addEventListener("error",i))}}var Jm=0;function J5(e,s){return e.stylesheets&&e.count===0&&nf(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var o=setTimeout(function(){if(e.stylesheets&&nf(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+s);0<e.imgBytes&&Jm===0&&(Jm=62500*D5());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&nf(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Jm?50:800)+s);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(d)}}:null}function ef(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tf=null;function nf(e,s){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tf=new Map,s.forEach(ev,e),tf=null,ef.call(e))}function ev(e,s){if(!(s.state.loading&4)){var i=tf.get(e);if(i)var o=i.get(null);else{i=new Map,tf.set(e,i);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<d.length;f++){var v=d[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(i.set(v.dataset.precedence,v),o=v)}o&&i.set(null,o)}d=s.instance,v=d.getAttribute("data-precedence"),f=i.get(v)||o,f===o&&i.set(null,d),i.set(v,d),this.count++,o=ef.bind(this),d.addEventListener("load",o),d.addEventListener("error",o),f?f.parentNode.insertBefore(d,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),s.state.loading|=4}}var Yc={$$typeof:H,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function tv(e,s,i,o,d,f,v,k,O){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=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=o,this.onUncaughtError=d,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Jg(e,s,i,o,d,f,v,k,O,J,fe,ve){return e=new tv(e,s,i,v,O,J,fe,ve,k),s=1,f===!0&&(s|=24),f=ns(3,null,null,s),e.current=f,f.stateNode=e,s=Ah(),s.refCount++,e.pooledCache=s,s.refCount++,f.memoizedState={element:o,isDehydrated:i,cache:s},Ih(f),e}function e4(e){return e?(e=Xa,e):Xa}function t4(e,s,i,o,d,f){d=e4(d),o.context===null?o.context=d:o.pendingContext=d,o=Pi(s),o.payload={element:i},f=f===void 0?null:f,f!==null&&(o.callback=f),i=Ui(e,o,s),i!==null&&(ks(i,e,s),Cc(i,e,s))}function n4(e,s){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<s?i:s}}function e1(e,s){n4(e,s),(e=e.alternate)&&n4(e,s)}function s4(e){if(e.tag===13||e.tag===31){var s=Oa(e,67108864);s!==null&&ks(s,e,67108864),e1(e,67108864)}}function a4(e){if(e.tag===13||e.tag===31){var s=Fs();s=xa(s);var i=Oa(e,s);i!==null&&ks(i,e,s),e1(e,s)}}var sf=!0;function nv(e,s,i,o){var d=E.T;E.T=null;var f=U.p;try{U.p=2,t1(e,s,i,o)}finally{U.p=f,E.T=d}}function sv(e,s,i,o){var d=E.T;E.T=null;var f=U.p;try{U.p=8,t1(e,s,i,o)}finally{U.p=f,E.T=d}}function t1(e,s,i,o){if(sf){var d=n1(o);if(d===null)qm(e,s,o,af,i),r4(e,o);else if(iv(d,e,s,i,o))o.stopPropagation();else if(r4(e,o),s&4&&-1<av.indexOf(e)){for(;d!==null;){var f=kn(d);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=at(f.pendingLanes);if(v!==0){var k=f;for(k.pendingLanes|=2,k.entangledLanes|=2;v;){var O=1<<31-De(v);k.entanglements[1]|=O,v&=~O}za(f),(Pt&6)===0&&(Ud=Re()+500,Hc(0))}}break;case 31:case 13:k=Oa(f,2),k!==null&&ks(k,f,2),$d(),e1(f,2)}if(f=n1(o),f===null&&qm(e,s,o,af,i),f===d)break;d=f}d!==null&&o.stopPropagation()}else qm(e,s,o,null,i)}}function n1(e){return e=fn(e),s1(e)}var af=null;function s1(e){if(af=null,e=wn(e),e!==null){var s=u(e);if(s===null)e=null;else{var i=s.tag;if(i===13){if(e=h(s),e!==null)return e;e=null}else if(i===31){if(e=p(s),e!==null)return e;e=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;e=null}else s!==e&&(e=null)}}return af=e,null}function i4(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 Ke:return 2;case mt:return 8;case kt:case rn:return 32;case Pn:return 268435456;default:return 32}default:return 32}}var a1=!1,Wi=null,Xi=null,Ji=null,Zc=new Map,Wc=new Map,er=[],av="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 r4(e,s){switch(e){case"focusin":case"focusout":Wi=null;break;case"dragenter":case"dragleave":Xi=null;break;case"mouseover":case"mouseout":Ji=null;break;case"pointerover":case"pointerout":Zc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wc.delete(s.pointerId)}}function Xc(e,s,i,o,d,f){return e===null||e.nativeEvent!==f?(e={blockedOn:s,domEventName:i,eventSystemFlags:o,nativeEvent:f,targetContainers:[d]},s!==null&&(s=kn(s),s!==null&&s4(s)),e):(e.eventSystemFlags|=o,s=e.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),e)}function iv(e,s,i,o,d){switch(s){case"focusin":return Wi=Xc(Wi,e,s,i,o,d),!0;case"dragenter":return Xi=Xc(Xi,e,s,i,o,d),!0;case"mouseover":return Ji=Xc(Ji,e,s,i,o,d),!0;case"pointerover":var f=d.pointerId;return Zc.set(f,Xc(Zc.get(f)||null,e,s,i,o,d)),!0;case"gotpointercapture":return f=d.pointerId,Wc.set(f,Xc(Wc.get(f)||null,e,s,i,o,d)),!0}return!1}function l4(e){var s=wn(e.target);if(s!==null){var i=u(s);if(i!==null){if(s=i.tag,s===13){if(s=h(i),s!==null){e.blockedOn=s,j(e.priority,function(){a4(i)});return}}else if(s===31){if(s=p(i),s!==null){e.blockedOn=s,j(e.priority,function(){a4(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function rf(e){if(e.blockedOn!==null)return!1;for(var s=e.targetContainers;0<s.length;){var i=n1(e.nativeEvent);if(i===null){i=e.nativeEvent;var o=new i.constructor(i.type,i);As=o,i.target.dispatchEvent(o),As=null}else return s=kn(i),s!==null&&s4(s),e.blockedOn=i,!1;s.shift()}return!0}function o4(e,s,i){rf(e)&&i.delete(s)}function rv(){a1=!1,Wi!==null&&rf(Wi)&&(Wi=null),Xi!==null&&rf(Xi)&&(Xi=null),Ji!==null&&rf(Ji)&&(Ji=null),Zc.forEach(o4),Wc.forEach(o4)}function lf(e,s){e.blockedOn===s&&(e.blockedOn=null,a1||(a1=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,rv)))}var of=null;function c4(e){of!==e&&(of=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){of===e&&(of=null);for(var s=0;s<e.length;s+=3){var i=e[s],o=e[s+1],d=e[s+2];if(typeof o!="function"){if(s1(o||i)===null)continue;break}var f=kn(i);f!==null&&(e.splice(s,3),s-=3,nm(f,{pending:!0,data:d,method:i.method,action:o},o,d))}}))}function bo(e){function s(O){return lf(O,e)}Wi!==null&&lf(Wi,e),Xi!==null&&lf(Xi,e),Ji!==null&&lf(Ji,e),Zc.forEach(s),Wc.forEach(s);for(var i=0;i<er.length;i++){var o=er[i];o.blockedOn===e&&(o.blockedOn=null)}for(;0<er.length&&(i=er[0],i.blockedOn===null);)l4(i),i.blockedOn===null&&er.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(o=0;o<i.length;o+=3){var d=i[o],f=i[o+1],v=d[we]||null;if(typeof f=="function")v||c4(i);else if(v){var k=null;if(f&&f.hasAttribute("formAction")){if(d=f,v=f[we]||null)k=v.formAction;else if(s1(d)!==null)continue}else k=v.action;typeof k=="function"?i[o+1]=k:(i.splice(o,3),o-=3),c4(i)}}}function u4(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),o||setTimeout(i,20)}function i(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(i,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function i1(e){this._internalRoot=e}cf.prototype.render=i1.prototype.render=function(e){var s=this._internalRoot;if(s===null)throw Error(r(409));var i=s.current,o=Fs();t4(i,o,e,s,null,null)},cf.prototype.unmount=i1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var s=e.containerInfo;t4(e.current,2,null,e,null,null),$d(),s[ke]=null}};function cf(e){this._internalRoot=e}cf.prototype.unstable_scheduleHydration=function(e){if(e){var s=ls();e={blockedOn:null,target:e,priority:s};for(var i=0;i<er.length&&s!==0&&s<er[i].priority;i++);er.splice(i,0,e),i===0&&l4(e)}};var d4=t.version;if(d4!=="19.2.4")throw Error(r(527,d4,"19.2.4"));U.findDOMNode=function(e){var s=e._reactInternals;if(s===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=m(s),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var lv={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uf.isDisabled&&uf.supportsFiber)try{ln=uf.inject(lv),oe=uf}catch{}}return eu.createRoot=function(e,s){if(!c(e))throw Error(r(299));var i=!1,o="",d=v8,f=_8,v=b8;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(f=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=Jg(e,1,!1,null,null,i,o,null,d,f,v,u4),e[ke]=s.current,Um(e),new i1(s)},eu.hydrateRoot=function(e,s,i){if(!c(e))throw Error(r(299));var o=!1,d="",f=v8,v=_8,k=b8,O=null;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(f=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(k=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),s=Jg(e,1,!0,s,i??null,o,d,O,f,v,k,u4),s.context=e4(null),i=s.current,o=Fs(),o=xa(o),d=Pi(o),d.callback=null,Ui(i,d,o),i=o,s.current.lanes=i,is(s,i),za(s),e[ke]=s.current,Um(e),new cf(s)},eu.version="19.2.4",eu}var j4;function _v(){if(j4)return c1.exports;j4=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),c1.exports=vv(),c1.exports}var bv=_v(),Zo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xv={setTimeout:(n,t)=>setTimeout(n,t),clearTimeout:n=>clearTimeout(n),setInterval:(n,t)=>setInterval(n,t),clearInterval:n=>clearInterval(n)},ur,Mp,D2,Sv=(D2=class{constructor(){Je(this,ur,xv);Je(this,Mp,!1)}setTimeoutProvider(n){ze(this,ur,n)}setTimeout(n,t){return L(this,ur).setTimeout(n,t)}clearTimeout(n){L(this,ur).clearTimeout(n)}setInterval(n,t){return L(this,ur).setInterval(n,t)}clearInterval(n){L(this,ur).clearInterval(n)}},ur=new WeakMap,Mp=new WeakMap,D2),ll=new Sv;function jv(n){setTimeout(n,0)}var kl=typeof window>"u"||"Deno"in globalThis;function zn(){}function wv(n,t){return typeof n=="function"?n(t):n}function $1(n){return typeof n=="number"&&n>=0&&n!==1/0}function G2(n,t){return Math.max(n+(t||0)-Date.now(),0)}function Sr(n,t){return typeof n=="function"?n(t):n}function sa(n,t){return typeof n=="function"?n(t):n}function w4(n,t){const{type:a="all",exact:r,fetchStatus:c,predicate:u,queryKey:h,stale:p}=n;if(h){if(r){if(t.queryHash!==Ap(h,t.options))return!1}else if(!xu(t.queryKey,h))return!1}if(a!=="all"){const y=t.isActive();if(a==="active"&&!y||a==="inactive"&&y)return!1}return!(typeof p=="boolean"&&t.isStale()!==p||c&&c!==t.state.fetchStatus||u&&!u(t))}function k4(n,t){const{exact:a,status:r,predicate:c,mutationKey:u}=n;if(u){if(!t.options.mutationKey)return!1;if(a){if(Nl(t.options.mutationKey)!==Nl(u))return!1}else if(!xu(t.options.mutationKey,u))return!1}return!(r&&t.state.status!==r||c&&!c(t))}function Ap(n,t){return((t==null?void 0:t.queryKeyHashFn)||Nl)(n)}function Nl(n){return JSON.stringify(n,(t,a)=>H1(a)?Object.keys(a).sort().reduce((r,c)=>(r[c]=a[c],r),{}):a)}function xu(n,t){return n===t?!0:typeof n!=typeof t?!1:n&&t&&typeof n=="object"&&typeof t=="object"?Object.keys(t).every(a=>xu(n[a],t[a])):!1}var kv=Object.prototype.hasOwnProperty;function V2(n,t,a=0){if(n===t)return n;if(a>500)return t;const r=N4(n)&&N4(t);if(!r&&!(H1(n)&&H1(t)))return t;const u=(r?n:Object.keys(n)).length,h=r?t:Object.keys(t),p=h.length,y=r?new Array(p):{};let m=0;for(let b=0;b<p;b++){const g=r?b:h[b],x=n[g],w=t[g];if(x===w){y[g]=x,(r?b<u:kv.call(n,g))&&m++;continue}if(x===null||w===null||typeof x!="object"||typeof w!="object"){y[g]=w;continue}const N=V2(x,w,a+1);y[g]=N,N===x&&m++}return u===p&&m===u?n:y}function Ef(n,t){if(!t||Object.keys(n).length!==Object.keys(t).length)return!1;for(const a in n)if(n[a]!==t[a])return!1;return!0}function N4(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function H1(n){if(!C4(n))return!1;const t=n.constructor;if(t===void 0)return!0;const a=t.prototype;return!(!C4(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function C4(n){return Object.prototype.toString.call(n)==="[object Object]"}function Nv(n){return new Promise(t=>{ll.setTimeout(t,n)})}function F1(n,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(n,t):a.structuralSharing!==!1?V2(n,t):t}function Cv(n,t,a=0){const r=[...n,t];return a&&r.length>a?r.slice(1):r}function Tv(n,t,a=0){const r=[t,...n];return a&&r.length>a?r.slice(0,-1):r}var Dp=Symbol();function K2(n,t){return!n.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!n.queryFn||n.queryFn===Dp?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Op(n,t){return typeof n=="function"?n(...t):!!n}function Ev(n,t,a){let r=!1,c;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(c??(c=t()),r||(r=!0,c.aborted?a():c.addEventListener("abort",a,{once:!0})),c)}),n}var dl,dr,Mo,O2,Mv=(O2=class extends Zo{constructor(){super();Je(this,dl);Je(this,dr);Je(this,Mo);ze(this,Mo,t=>{if(!kl&&window.addEventListener){const a=()=>t();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){L(this,dr)||this.setEventListener(L(this,Mo))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,dr))==null||t.call(this),ze(this,dr,void 0))}setEventListener(t){var a;ze(this,Mo,t),(a=L(this,dr))==null||a.call(this),ze(this,dr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){L(this,dl)!==t&&(ze(this,dl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(a=>{a(t)})}isFocused(){var t;return typeof L(this,dl)=="boolean"?L(this,dl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},dl=new WeakMap,dr=new WeakMap,Mo=new WeakMap,O2),Lp=new Mv;function Q1(){let n,t;const a=new Promise((c,u)=>{n=c,t=u});a.status="pending",a.catch(()=>{});function r(c){Object.assign(a,c),delete a.resolve,delete a.reject}return a.resolve=c=>{r({status:"fulfilled",value:c}),n(c)},a.reject=c=>{r({status:"rejected",reason:c}),t(c)},a}function Rv(n){var a;let t;if((a=n.then(r=>(t=r,r),zn))==null||a.catch(zn),t!==void 0)return{data:t}}function Y2(n){return n}function Av(n){return{mutationKey:n.options.mutationKey,state:n.state,...n.options.scope&&{scope:n.options.scope},...n.meta&&{meta:n.meta}}}function Dv(n,t,a){const r=()=>{var u;const c=(u=n.promise)==null?void 0:u.then(t).catch(h=>a(h)?Promise.reject(new Error("redacted")):Promise.reject(h));return c==null||c.catch(zn),c};return{dehydratedAt:Date.now(),state:{...n.state,...n.state.data!==void 0&&{data:t(n.state.data)}},queryKey:n.queryKey,queryHash:n.queryHash,...n.state.status==="pending"&&{promise:r()},...n.meta&&{meta:n.meta}}}function Ov(n){return n.state.isPaused}function Lv(n){return n.state.status==="success"}function Iv(n){return!0}function zv(n,t={}){var y,m,b,g;const a=t.shouldDehydrateMutation??((y=n.getDefaultOptions().dehydrate)==null?void 0:y.shouldDehydrateMutation)??Ov,r=n.getMutationCache().getAll().flatMap(x=>a(x)?[Av(x)]:[]),c=t.shouldDehydrateQuery??((m=n.getDefaultOptions().dehydrate)==null?void 0:m.shouldDehydrateQuery)??Lv,u=t.shouldRedactErrors??((b=n.getDefaultOptions().dehydrate)==null?void 0:b.shouldRedactErrors)??Iv,h=t.serializeData??((g=n.getDefaultOptions().dehydrate)==null?void 0:g.serializeData)??Y2,p=n.getQueryCache().getAll().flatMap(x=>c(x)?[Dv(x,h,u)]:[]);return{mutations:r,queries:p}}function Bv(n,t,a){var y;if(typeof t!="object"||t===null)return;const r=n.getMutationCache(),c=n.getQueryCache(),u=((y=n.getDefaultOptions().hydrate)==null?void 0:y.deserializeData)??Y2,h=t.mutations||[],p=t.queries||[];h.forEach(({state:m,...b})=>{var g,x;r.build(n,{...(g=n.getDefaultOptions().hydrate)==null?void 0:g.mutations,...(x=a==null?void 0:a.defaultOptions)==null?void 0:x.mutations,...b},m)}),p.forEach(({queryKey:m,state:b,queryHash:g,meta:x,promise:w,dehydratedAt:N})=>{var Q,ce;const T=w?Rv(w):void 0,C=b.data===void 0?T==null?void 0:T.data:b.data,I=C===void 0?C:u(C);let $=c.get(g);const H=($==null?void 0:$.state.status)==="pending",R=($==null?void 0:$.state.fetchStatus)==="fetching";if($){const Z=T&&N!==void 0&&N>$.state.dataUpdatedAt;if(b.dataUpdatedAt>$.state.dataUpdatedAt||Z){const{fetchStatus:ie,...ee}=b;$.setState({...ee,data:I})}}else $=c.build(n,{...(Q=n.getDefaultOptions().hydrate)==null?void 0:Q.queries,...(ce=a==null?void 0:a.defaultOptions)==null?void 0:ce.queries,queryKey:m,queryHash:g,meta:x},{...b,data:I,fetchStatus:"idle",status:I!==void 0?"success":b.status});w&&!H&&!R&&(N===void 0||N>$.state.dataUpdatedAt)&&$.fetch(void 0,{initialPromise:Promise.resolve(w).then(u)}).catch(zn)})}var Pv=jv;function Uv(){let n=[],t=0,a=p=>{p()},r=p=>{p()},c=Pv;const u=p=>{t?n.push(p):c(()=>{a(p)})},h=()=>{const p=n;n=[],p.length&&c(()=>{r(()=>{p.forEach(y=>{a(y)})})})};return{batch:p=>{let y;t++;try{y=p()}finally{t--,t||h()}return y},batchCalls:p=>(...y)=>{u(()=>{p(...y)})},schedule:u,setNotifyFunction:p=>{a=p},setBatchNotifyFunction:p=>{r=p},setScheduler:p=>{c=p}}}var Bn=Uv(),Ro,fr,Ao,L2,qv=(L2=class extends Zo{constructor(){super();Je(this,Ro,!0);Je(this,fr);Je(this,Ao);ze(this,Ao,t=>{if(!kl&&window.addEventListener){const a=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){L(this,fr)||this.setEventListener(L(this,Ao))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,fr))==null||t.call(this),ze(this,fr,void 0))}setEventListener(t){var a;ze(this,Ao,t),(a=L(this,fr))==null||a.call(this),ze(this,fr,t(this.setOnline.bind(this)))}setOnline(t){L(this,Ro)!==t&&(ze(this,Ro,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return L(this,Ro)}},Ro=new WeakMap,fr=new WeakMap,Ao=new WeakMap,L2),Mf=new qv;function $v(n){return Math.min(1e3*2**n,3e4)}function Z2(n){return(n??"online")==="online"?Mf.isOnline():!0}var G1=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function W2(n){let t=!1,a=0,r;const c=Q1(),u=()=>c.status!=="pending",h=T=>{var C;if(!u()){const I=new G1(T);x(I),(C=n.onCancel)==null||C.call(n,I)}},p=()=>{t=!0},y=()=>{t=!1},m=()=>Lp.isFocused()&&(n.networkMode==="always"||Mf.isOnline())&&n.canRun(),b=()=>Z2(n.networkMode)&&n.canRun(),g=T=>{u()||(r==null||r(),c.resolve(T))},x=T=>{u()||(r==null||r(),c.reject(T))},w=()=>new Promise(T=>{var C;r=I=>{(u()||m())&&T(I)},(C=n.onPause)==null||C.call(n)}).then(()=>{var T;r=void 0,u()||(T=n.onContinue)==null||T.call(n)}),N=()=>{if(u())return;let T;const C=a===0?n.initialPromise:void 0;try{T=C??n.fn()}catch(I){T=Promise.reject(I)}Promise.resolve(T).then(g).catch(I=>{var ce;if(u())return;const $=n.retry??(kl?0:3),H=n.retryDelay??$v,R=typeof H=="function"?H(a,I):H,Q=$===!0||typeof $=="number"&&a<$||typeof $=="function"&&$(a,I);if(t||!Q){x(I);return}a++,(ce=n.onFail)==null||ce.call(n,a,I),Nv(R).then(()=>m()?void 0:w()).then(()=>{t?x(I):N()})})};return{promise:c,status:()=>c.status,cancel:h,continue:()=>(r==null||r(),c),cancelRetry:p,continueRetry:y,canStart:b,start:()=>(b()?N():w().then(N),c)}}var fl,I2,X2=(I2=class{constructor(){Je(this,fl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$1(this.gcTime)&&ze(this,fl,ll.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(kl?1/0:300*1e3))}clearGcTimeout(){L(this,fl)&&(ll.clearTimeout(L(this,fl)),ze(this,fl,void 0))}},fl=new WeakMap,I2),hl,Do,na,ml,Gn,Ou,pl,_a,hi,z2,Hv=(z2=class extends X2{constructor(t){super();Je(this,_a);Je(this,hl);Je(this,Do);Je(this,na);Je(this,ml);Je(this,Gn);Je(this,Ou);Je(this,pl);ze(this,pl,!1),ze(this,Ou,t.defaultOptions),this.setOptions(t.options),this.observers=[],ze(this,ml,t.client),ze(this,na,L(this,ml).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ze(this,hl,E4(this.options)),this.state=t.state??L(this,hl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,Gn))==null?void 0:t.promise}setOptions(t){if(this.options={...L(this,Ou),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=E4(this.options);a.data!==void 0&&(this.setState(T4(a.data,a.dataUpdatedAt)),ze(this,hl,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,na).remove(this)}setData(t,a){const r=F1(this.state.data,t,this.options);return bt(this,_a,hi).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(t,a){bt(this,_a,hi).call(this,{type:"setState",state:t,setStateOptions:a})}cancel(t){var r,c;const a=(r=L(this,Gn))==null?void 0:r.promise;return(c=L(this,Gn))==null||c.cancel(t),a?a.then(zn).catch(zn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,hl))}isActive(){return this.observers.some(t=>sa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Dp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Sr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!G2(this.state.dataUpdatedAt,t)}onFocus(){var a;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(a=L(this,Gn))==null||a.continue()}onOnline(){var a;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(a=L(this,Gn))==null||a.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,na).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(a=>a!==t),this.observers.length||(L(this,Gn)&&(L(this,pl)?L(this,Gn).cancel({revert:!0}):L(this,Gn).cancelRetry()),this.scheduleGc()),L(this,na).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||bt(this,_a,hi).call(this,{type:"invalidate"})}async fetch(t,a){var y,m,b,g,x,w,N,T,C,I,$,H;if(this.state.fetchStatus!=="idle"&&((y=L(this,Gn))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(L(this,Gn))return L(this,Gn).continueRetry(),L(this,Gn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(Q=>Q.options.queryFn);R&&this.setOptions(R.options)}const r=new AbortController,c=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(ze(this,pl,!0),r.signal)})},u=()=>{const R=K2(this.options,a),ce=(()=>{const Z={client:L(this,ml),queryKey:this.queryKey,meta:this.meta};return c(Z),Z})();return ze(this,pl,!1),this.options.persister?this.options.persister(R,ce,this):R(ce)},p=(()=>{const R={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:L(this,ml),state:this.state,fetchFn:u};return c(R),R})();(m=this.options.behavior)==null||m.onFetch(p,this),ze(this,Do,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=p.fetchOptions)==null?void 0:b.meta))&&bt(this,_a,hi).call(this,{type:"fetch",meta:(g=p.fetchOptions)==null?void 0:g.meta}),ze(this,Gn,W2({initialPromise:a==null?void 0:a.initialPromise,fn:p.fetchFn,onCancel:R=>{R instanceof G1&&R.revert&&this.setState({...L(this,Do),fetchStatus:"idle"}),r.abort()},onFail:(R,Q)=>{bt(this,_a,hi).call(this,{type:"failed",failureCount:R,error:Q})},onPause:()=>{bt(this,_a,hi).call(this,{type:"pause"})},onContinue:()=>{bt(this,_a,hi).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{const R=await L(this,Gn).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(w=(x=L(this,na).config).onSuccess)==null||w.call(x,R,this),(T=(N=L(this,na).config).onSettled)==null||T.call(N,R,this.state.error,this),R}catch(R){if(R instanceof G1){if(R.silent)return L(this,Gn).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw bt(this,_a,hi).call(this,{type:"error",error:R}),(I=(C=L(this,na).config).onError)==null||I.call(C,R,this),(H=($=L(this,na).config).onSettled)==null||H.call($,this.state.data,R,this),R}finally{this.scheduleGc()}}},hl=new WeakMap,Do=new WeakMap,na=new WeakMap,ml=new WeakMap,Gn=new WeakMap,Ou=new WeakMap,pl=new WeakMap,_a=new WeakSet,hi=function(t){const a=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...J2(r.data,this.options),fetchMeta:t.meta??null};case"success":const c={...r,...T4(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ze(this,Do,t.manual?c:void 0),c;case"error":const u=t.error;return{...r,error:u,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=a(this.state),Bn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),L(this,na).notify({query:this,type:"updated",action:t})})},z2);function J2(n,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z2(t.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function T4(n,t){return{data:n,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function E4(n){const t=typeof n.initialData=="function"?n.initialData():n.initialData,a=t!==void 0,r=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Cs,Rt,Lu,ds,gl,Oo,gi,hr,Iu,Lo,Io,yl,vl,mr,zo,qt,du,V1,K1,Y1,Z1,W1,X1,J1,e3,B2,Fv=(B2=class extends Zo{constructor(t,a){super();Je(this,qt);Je(this,Cs);Je(this,Rt);Je(this,Lu);Je(this,ds);Je(this,gl);Je(this,Oo);Je(this,gi);Je(this,hr);Je(this,Iu);Je(this,Lo);Je(this,Io);Je(this,yl);Je(this,vl);Je(this,mr);Je(this,zo,new Set);this.options=a,ze(this,Cs,t),ze(this,hr,null),ze(this,gi,Q1()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Rt).addObserver(this),M4(L(this,Rt),this.options)?bt(this,qt,du).call(this):this.updateResult(),bt(this,qt,Z1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ep(L(this,Rt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ep(L(this,Rt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,bt(this,qt,W1).call(this),bt(this,qt,X1).call(this),L(this,Rt).removeObserver(this)}setOptions(t){const a=this.options,r=L(this,Rt);if(this.options=L(this,Cs).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof sa(this.options.enabled,L(this,Rt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");bt(this,qt,J1).call(this),L(this,Rt).setOptions(this.options),a._defaulted&&!Ef(this.options,a)&&L(this,Cs).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Rt),observer:this});const c=this.hasListeners();c&&R4(L(this,Rt),r,this.options,a)&&bt(this,qt,du).call(this),this.updateResult(),c&&(L(this,Rt)!==r||sa(this.options.enabled,L(this,Rt))!==sa(a.enabled,L(this,Rt))||Sr(this.options.staleTime,L(this,Rt))!==Sr(a.staleTime,L(this,Rt)))&&bt(this,qt,V1).call(this);const u=bt(this,qt,K1).call(this);c&&(L(this,Rt)!==r||sa(this.options.enabled,L(this,Rt))!==sa(a.enabled,L(this,Rt))||u!==L(this,mr))&&bt(this,qt,Y1).call(this,u)}getOptimisticResult(t){const a=L(this,Cs).getQueryCache().build(L(this,Cs),t),r=this.createResult(a,t);return Gv(this,r)&&(ze(this,ds,r),ze(this,Oo,this.options),ze(this,gl,L(this,Rt).state)),r}getCurrentResult(){return L(this,ds)}trackResult(t,a){return new Proxy(t,{get:(r,c)=>(this.trackProp(c),a==null||a(c),c==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,gi).status==="pending"&&L(this,gi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,c))})}trackProp(t){L(this,zo).add(t)}getCurrentQuery(){return L(this,Rt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const a=L(this,Cs).defaultQueryOptions(t),r=L(this,Cs).getQueryCache().build(L(this,Cs),a);return r.fetch().then(()=>this.createResult(r,a))}fetch(t){return bt(this,qt,du).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,ds)))}createResult(t,a){var ee;const r=L(this,Rt),c=this.options,u=L(this,ds),h=L(this,gl),p=L(this,Oo),m=t!==r?t.state:L(this,Lu),{state:b}=t;let g={...b},x=!1,w;if(a._optimisticResults){const Y=this.hasListeners(),F=!Y&&M4(t,a),_e=Y&&R4(t,r,a,c);(F||_e)&&(g={...g,...J2(b.data,t.options)}),a._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:N,errorUpdatedAt:T,status:C}=g;w=g.data;let I=!1;if(a.placeholderData!==void 0&&w===void 0&&C==="pending"){let Y;u!=null&&u.isPlaceholderData&&a.placeholderData===(p==null?void 0:p.placeholderData)?(Y=u.data,I=!0):Y=typeof a.placeholderData=="function"?a.placeholderData((ee=L(this,Io))==null?void 0:ee.state.data,L(this,Io)):a.placeholderData,Y!==void 0&&(C="success",w=F1(u==null?void 0:u.data,Y,a),x=!0)}if(a.select&&w!==void 0&&!I)if(u&&w===(h==null?void 0:h.data)&&a.select===L(this,Iu))w=L(this,Lo);else try{ze(this,Iu,a.select),w=a.select(w),w=F1(u==null?void 0:u.data,w,a),ze(this,Lo,w),ze(this,hr,null)}catch(Y){ze(this,hr,Y)}L(this,hr)&&(N=L(this,hr),w=L(this,Lo),T=Date.now(),C="error");const $=g.fetchStatus==="fetching",H=C==="pending",R=C==="error",Q=H&&$,ce=w!==void 0,ie={status:C,fetchStatus:g.fetchStatus,isPending:H,isSuccess:C==="success",isError:R,isInitialLoading:Q,isLoading:Q,data:w,dataUpdatedAt:g.dataUpdatedAt,error:N,errorUpdatedAt:T,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:g.dataUpdateCount>0||g.errorUpdateCount>0,isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:$,isRefetching:$&&!H,isLoadingError:R&&!ce,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:R&&ce,isStale:Ip(t,a),refetch:this.refetch,promise:L(this,gi),isEnabled:sa(a.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Y=ie.data!==void 0,F=ie.status==="error"&&!Y,_e=ue=>{F?ue.reject(ie.error):Y&&ue.resolve(ie.data)},je=()=>{const ue=ze(this,gi,ie.promise=Q1());_e(ue)},ae=L(this,gi);switch(ae.status){case"pending":t.queryHash===r.queryHash&&_e(ae);break;case"fulfilled":(F||ie.data!==ae.value)&&je();break;case"rejected":(!F||ie.error!==ae.reason)&&je();break}}return ie}updateResult(){const t=L(this,ds),a=this.createResult(L(this,Rt),this.options);if(ze(this,gl,L(this,Rt).state),ze(this,Oo,this.options),L(this,gl).data!==void 0&&ze(this,Io,L(this,Rt)),Ef(a,t))return;ze(this,ds,a);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:c}=this.options,u=typeof c=="function"?c():c;if(u==="all"||!u&&!L(this,zo).size)return!0;const h=new Set(u??L(this,zo));return this.options.throwOnError&&h.add("error"),Object.keys(L(this,ds)).some(p=>{const y=p;return L(this,ds)[y]!==t[y]&&h.has(y)})};bt(this,qt,e3).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&bt(this,qt,Z1).call(this)}},Cs=new WeakMap,Rt=new WeakMap,Lu=new WeakMap,ds=new WeakMap,gl=new WeakMap,Oo=new WeakMap,gi=new WeakMap,hr=new WeakMap,Iu=new WeakMap,Lo=new WeakMap,Io=new WeakMap,yl=new WeakMap,vl=new WeakMap,mr=new WeakMap,zo=new WeakMap,qt=new WeakSet,du=function(t){bt(this,qt,J1).call(this);let a=L(this,Rt).fetch(this.options,t);return t!=null&&t.throwOnError||(a=a.catch(zn)),a},V1=function(){bt(this,qt,W1).call(this);const t=Sr(this.options.staleTime,L(this,Rt));if(kl||L(this,ds).isStale||!$1(t))return;const r=G2(L(this,ds).dataUpdatedAt,t)+1;ze(this,yl,ll.setTimeout(()=>{L(this,ds).isStale||this.updateResult()},r))},K1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Rt)):this.options.refetchInterval)??!1},Y1=function(t){bt(this,qt,X1).call(this),ze(this,mr,t),!(kl||sa(this.options.enabled,L(this,Rt))===!1||!$1(L(this,mr))||L(this,mr)===0)&&ze(this,vl,ll.setInterval(()=>{(this.options.refetchIntervalInBackground||Lp.isFocused())&&bt(this,qt,du).call(this)},L(this,mr)))},Z1=function(){bt(this,qt,V1).call(this),bt(this,qt,Y1).call(this,bt(this,qt,K1).call(this))},W1=function(){L(this,yl)&&(ll.clearTimeout(L(this,yl)),ze(this,yl,void 0))},X1=function(){L(this,vl)&&(ll.clearInterval(L(this,vl)),ze(this,vl,void 0))},J1=function(){const t=L(this,Cs).getQueryCache().build(L(this,Cs),this.options);if(t===L(this,Rt))return;const a=L(this,Rt);ze(this,Rt,t),ze(this,Lu,t.state),this.hasListeners()&&(a==null||a.removeObserver(this),t.addObserver(this))},e3=function(t){Bn.batch(()=>{t.listeners&&this.listeners.forEach(a=>{a(L(this,ds))}),L(this,Cs).getQueryCache().notify({query:L(this,Rt),type:"observerResultsUpdated"})})},B2);function Qv(n,t){return sa(t.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&t.retryOnMount===!1)}function M4(n,t){return Qv(n,t)||n.state.data!==void 0&&ep(n,t,t.refetchOnMount)}function ep(n,t,a){if(sa(t.enabled,n)!==!1&&Sr(t.staleTime,n)!=="static"){const r=typeof a=="function"?a(n):a;return r==="always"||r!==!1&&Ip(n,t)}return!1}function R4(n,t,a,r){return(n!==t||sa(r.enabled,n)===!1)&&(!a.suspense||n.state.status!=="error")&&Ip(n,a)}function Ip(n,t){return sa(t.enabled,n)!==!1&&n.isStaleByTime(Sr(t.staleTime,n))}function Gv(n,t){return!Ef(n.getCurrentResult(),t)}function A4(n){return{onFetch:(t,a)=>{var b,g,x,w,N;const r=t.options,c=(x=(g=(b=t.fetchOptions)==null?void 0:b.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,u=((w=t.state.data)==null?void 0:w.pages)||[],h=((N=t.state.data)==null?void 0:N.pageParams)||[];let p={pages:[],pageParams:[]},y=0;const m=async()=>{let T=!1;const C=H=>{Ev(H,()=>t.signal,()=>T=!0)},I=K2(t.options,t.fetchOptions),$=async(H,R,Q)=>{if(T)return Promise.reject();if(R==null&&H.pages.length)return Promise.resolve(H);const Z=(()=>{const F={client:t.client,queryKey:t.queryKey,pageParam:R,direction:Q?"backward":"forward",meta:t.options.meta};return C(F),F})(),ie=await I(Z),{maxPages:ee}=t.options,Y=Q?Tv:Cv;return{pages:Y(H.pages,ie,ee),pageParams:Y(H.pageParams,R,ee)}};if(c&&u.length){const H=c==="backward",R=H?Vv:D4,Q={pages:u,pageParams:h},ce=R(r,Q);p=await $(Q,ce,H)}else{const H=n??u.length;do{const R=y===0?h[0]??r.initialPageParam:D4(r,p);if(y>0&&R==null)break;p=await $(p,R),y++}while(y<H)}return p};t.options.persister?t.fetchFn=()=>{var T,C;return(C=(T=t.options).persister)==null?void 0:C.call(T,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a)}:t.fetchFn=m}}}function D4(n,{pages:t,pageParams:a}){const r=t.length-1;return t.length>0?n.getNextPageParam(t[r],t,a[r],a):void 0}function Vv(n,{pages:t,pageParams:a}){var r;return t.length>0?(r=n.getPreviousPageParam)==null?void 0:r.call(n,t[0],t,a[0],a):void 0}var zu,Pa,as,_l,Ua,ar,P2,Kv=(P2=class extends X2{constructor(t){super();Je(this,Ua);Je(this,zu);Je(this,Pa);Je(this,as);Je(this,_l);ze(this,zu,t.client),this.mutationId=t.mutationId,ze(this,as,t.mutationCache),ze(this,Pa,[]),this.state=t.state||t3(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,Pa).includes(t)||(L(this,Pa).push(t),this.clearGcTimeout(),L(this,as).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ze(this,Pa,L(this,Pa).filter(a=>a!==t)),this.scheduleGc(),L(this,as).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Pa).length||(this.state.status==="pending"?this.scheduleGc():L(this,as).remove(this))}continue(){var t;return((t=L(this,_l))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var h,p,y,m,b,g,x,w,N,T,C,I,$,H,R,Q,ce,Z;const a=()=>{bt(this,Ua,ar).call(this,{type:"continue"})},r={client:L(this,zu),meta:this.options.meta,mutationKey:this.options.mutationKey};ze(this,_l,W2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(ie,ee)=>{bt(this,Ua,ar).call(this,{type:"failed",failureCount:ie,error:ee})},onPause:()=>{bt(this,Ua,ar).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,as).canRun(this)}));const c=this.state.status==="pending",u=!L(this,_l).canStart();try{if(c)a();else{bt(this,Ua,ar).call(this,{type:"pending",variables:t,isPaused:u}),L(this,as).config.onMutate&&await L(this,as).config.onMutate(t,this,r);const ee=await((p=(h=this.options).onMutate)==null?void 0:p.call(h,t,r));ee!==this.state.context&&bt(this,Ua,ar).call(this,{type:"pending",context:ee,variables:t,isPaused:u})}const ie=await L(this,_l).start();return await((m=(y=L(this,as).config).onSuccess)==null?void 0:m.call(y,ie,t,this.state.context,this,r)),await((g=(b=this.options).onSuccess)==null?void 0:g.call(b,ie,t,this.state.context,r)),await((w=(x=L(this,as).config).onSettled)==null?void 0:w.call(x,ie,null,this.state.variables,this.state.context,this,r)),await((T=(N=this.options).onSettled)==null?void 0:T.call(N,ie,null,t,this.state.context,r)),bt(this,Ua,ar).call(this,{type:"success",data:ie}),ie}catch(ie){try{await((I=(C=L(this,as).config).onError)==null?void 0:I.call(C,ie,t,this.state.context,this,r))}catch(ee){Promise.reject(ee)}try{await((H=($=this.options).onError)==null?void 0:H.call($,ie,t,this.state.context,r))}catch(ee){Promise.reject(ee)}try{await((Q=(R=L(this,as).config).onSettled)==null?void 0:Q.call(R,void 0,ie,this.state.variables,this.state.context,this,r))}catch(ee){Promise.reject(ee)}try{await((Z=(ce=this.options).onSettled)==null?void 0:Z.call(ce,void 0,ie,t,this.state.context,r))}catch(ee){Promise.reject(ee)}throw bt(this,Ua,ar).call(this,{type:"error",error:ie}),ie}finally{L(this,as).runNext(this)}}},zu=new WeakMap,Pa=new WeakMap,as=new WeakMap,_l=new WeakMap,Ua=new WeakSet,ar=function(t){const a=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=a(this.state),Bn.batch(()=>{L(this,Pa).forEach(r=>{r.onMutationUpdate(t)}),L(this,as).notify({mutation:this,type:"updated",action:t})})},P2);function t3(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yi,ba,Bu,U2,Yv=(U2=class extends Zo{constructor(t={}){super();Je(this,yi);Je(this,ba);Je(this,Bu);this.config=t,ze(this,yi,new Set),ze(this,ba,new Map),ze(this,Bu,0)}build(t,a,r){const c=new Kv({client:t,mutationCache:this,mutationId:++df(this,Bu)._,options:t.defaultMutationOptions(a),state:r});return this.add(c),c}add(t){L(this,yi).add(t);const a=ff(t);if(typeof a=="string"){const r=L(this,ba).get(a);r?r.push(t):L(this,ba).set(a,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,yi).delete(t)){const a=ff(t);if(typeof a=="string"){const r=L(this,ba).get(a);if(r)if(r.length>1){const c=r.indexOf(t);c!==-1&&r.splice(c,1)}else r[0]===t&&L(this,ba).delete(a)}}this.notify({type:"removed",mutation:t})}canRun(t){const a=ff(t);if(typeof a=="string"){const r=L(this,ba).get(a),c=r==null?void 0:r.find(u=>u.state.status==="pending");return!c||c===t}else return!0}runNext(t){var r;const a=ff(t);if(typeof a=="string"){const c=(r=L(this,ba).get(a))==null?void 0:r.find(u=>u!==t&&u.state.isPaused);return(c==null?void 0:c.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bn.batch(()=>{L(this,yi).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,yi).clear(),L(this,ba).clear()})}getAll(){return Array.from(L(this,yi))}find(t){const a={exact:!0,...t};return this.getAll().find(r=>k4(a,r))}findAll(t={}){return this.getAll().filter(a=>k4(t,a))}notify(t){Bn.batch(()=>{this.listeners.forEach(a=>{a(t)})})}resumePausedMutations(){const t=this.getAll().filter(a=>a.state.isPaused);return Bn.batch(()=>Promise.all(t.map(a=>a.continue().catch(zn))))}},yi=new WeakMap,ba=new WeakMap,Bu=new WeakMap,U2);function ff(n){var t;return(t=n.options.scope)==null?void 0:t.id}var vi,pr,Ts,_i,ki,xf,tp,q2,Zv=(q2=class extends Zo{constructor(a,r){super();Je(this,ki);Je(this,vi);Je(this,pr);Je(this,Ts);Je(this,_i);ze(this,vi,a),this.setOptions(r),this.bindMethods(),bt(this,ki,xf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var c;const r=this.options;this.options=L(this,vi).defaultMutationOptions(a),Ef(this.options,r)||L(this,vi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,Ts),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Nl(r.mutationKey)!==Nl(this.options.mutationKey)?this.reset():((c=L(this,Ts))==null?void 0:c.state.status)==="pending"&&L(this,Ts).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=L(this,Ts))==null||a.removeObserver(this)}onMutationUpdate(a){bt(this,ki,xf).call(this),bt(this,ki,tp).call(this,a)}getCurrentResult(){return L(this,pr)}reset(){var a;(a=L(this,Ts))==null||a.removeObserver(this),ze(this,Ts,void 0),bt(this,ki,xf).call(this),bt(this,ki,tp).call(this)}mutate(a,r){var c;return ze(this,_i,r),(c=L(this,Ts))==null||c.removeObserver(this),ze(this,Ts,L(this,vi).getMutationCache().build(L(this,vi),this.options)),L(this,Ts).addObserver(this),L(this,Ts).execute(a)}},vi=new WeakMap,pr=new WeakMap,Ts=new WeakMap,_i=new WeakMap,ki=new WeakSet,xf=function(){var r;const a=((r=L(this,Ts))==null?void 0:r.state)??t3();ze(this,pr,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},tp=function(a){Bn.batch(()=>{var r,c,u,h,p,y,m,b;if(L(this,_i)&&this.hasListeners()){const g=L(this,pr).variables,x=L(this,pr).context,w={client:L(this,vi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(c=(r=L(this,_i)).onSuccess)==null||c.call(r,a.data,g,x,w)}catch(N){Promise.reject(N)}try{(h=(u=L(this,_i)).onSettled)==null||h.call(u,a.data,null,g,x,w)}catch(N){Promise.reject(N)}}else if((a==null?void 0:a.type)==="error"){try{(y=(p=L(this,_i)).onError)==null||y.call(p,a.error,g,x,w)}catch(N){Promise.reject(N)}try{(b=(m=L(this,_i)).onSettled)==null||b.call(m,void 0,a.error,g,x,w)}catch(N){Promise.reject(N)}}}this.listeners.forEach(g=>{g(L(this,pr))})})},q2),qa,$2,Wv=($2=class extends Zo{constructor(t={}){super();Je(this,qa);this.config=t,ze(this,qa,new Map)}build(t,a,r){const c=a.queryKey,u=a.queryHash??Ap(c,a);let h=this.get(u);return h||(h=new Hv({client:t,queryKey:c,queryHash:u,options:t.defaultQueryOptions(a),state:r,defaultOptions:t.getQueryDefaults(c)}),this.add(h)),h}add(t){L(this,qa).has(t.queryHash)||(L(this,qa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const a=L(this,qa).get(t.queryHash);a&&(t.destroy(),a===t&&L(this,qa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Bn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,qa).get(t)}getAll(){return[...L(this,qa).values()]}find(t){const a={exact:!0,...t};return this.getAll().find(r=>w4(a,r))}findAll(t={}){const a=this.getAll();return Object.keys(t).length>0?a.filter(r=>w4(t,r)):a}notify(t){Bn.batch(()=>{this.listeners.forEach(a=>{a(t)})})}onFocus(){Bn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Bn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},qa=new WeakMap,$2),bn,gr,yr,Bo,Po,vr,Uo,qo,H2,Xv=(H2=class{constructor(n={}){Je(this,bn);Je(this,gr);Je(this,yr);Je(this,Bo);Je(this,Po);Je(this,vr);Je(this,Uo);Je(this,qo);ze(this,bn,n.queryCache||new Wv),ze(this,gr,n.mutationCache||new Yv),ze(this,yr,n.defaultOptions||{}),ze(this,Bo,new Map),ze(this,Po,new Map),ze(this,vr,0)}mount(){df(this,vr)._++,L(this,vr)===1&&(ze(this,Uo,Lp.subscribe(async n=>{n&&(await this.resumePausedMutations(),L(this,bn).onFocus())})),ze(this,qo,Mf.subscribe(async n=>{n&&(await this.resumePausedMutations(),L(this,bn).onOnline())})))}unmount(){var n,t;df(this,vr)._--,L(this,vr)===0&&((n=L(this,Uo))==null||n.call(this),ze(this,Uo,void 0),(t=L(this,qo))==null||t.call(this),ze(this,qo,void 0))}isFetching(n){return L(this,bn).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return L(this,gr).findAll({...n,status:"pending"}).length}getQueryData(n){var a;const t=this.defaultQueryOptions({queryKey:n});return(a=L(this,bn).get(t.queryHash))==null?void 0:a.state.data}ensureQueryData(n){const t=this.defaultQueryOptions(n),a=L(this,bn).build(this,t),r=a.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&a.isStaleByTime(Sr(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(n){return L(this,bn).findAll(n).map(({queryKey:t,state:a})=>{const r=a.data;return[t,r]})}setQueryData(n,t,a){const r=this.defaultQueryOptions({queryKey:n}),c=L(this,bn).get(r.queryHash),u=c==null?void 0:c.state.data,h=wv(t,u);if(h!==void 0)return L(this,bn).build(this,r).setData(h,{...a,manual:!0})}setQueriesData(n,t,a){return Bn.batch(()=>L(this,bn).findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,t,a)]))}getQueryState(n){var a;const t=this.defaultQueryOptions({queryKey:n});return(a=L(this,bn).get(t.queryHash))==null?void 0:a.state}removeQueries(n){const t=L(this,bn);Bn.batch(()=>{t.findAll(n).forEach(a=>{t.remove(a)})})}resetQueries(n,t){const a=L(this,bn);return Bn.batch(()=>(a.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},t)))}cancelQueries(n,t={}){const a={revert:!0,...t},r=Bn.batch(()=>L(this,bn).findAll(n).map(c=>c.cancel(a)));return Promise.all(r).then(zn).catch(zn)}invalidateQueries(n,t={}){return Bn.batch(()=>(L(this,bn).findAll(n).forEach(a=>{a.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},t)))}refetchQueries(n,t={}){const a={...t,cancelRefetch:t.cancelRefetch??!0},r=Bn.batch(()=>L(this,bn).findAll(n).filter(c=>!c.isDisabled()&&!c.isStatic()).map(c=>{let u=c.fetch(void 0,a);return a.throwOnError||(u=u.catch(zn)),c.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(r).then(zn)}fetchQuery(n){const t=this.defaultQueryOptions(n);t.retry===void 0&&(t.retry=!1);const a=L(this,bn).build(this,t);return a.isStaleByTime(Sr(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(zn).catch(zn)}fetchInfiniteQuery(n){return n.behavior=A4(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(zn).catch(zn)}ensureInfiniteQueryData(n){return n.behavior=A4(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return Mf.isOnline()?L(this,gr).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,bn)}getMutationCache(){return L(this,gr)}getDefaultOptions(){return L(this,yr)}setDefaultOptions(n){ze(this,yr,n)}setQueryDefaults(n,t){L(this,Bo).set(Nl(n),{queryKey:n,defaultOptions:t})}getQueryDefaults(n){const t=[...L(this,Bo).values()],a={};return t.forEach(r=>{xu(n,r.queryKey)&&Object.assign(a,r.defaultOptions)}),a}setMutationDefaults(n,t){L(this,Po).set(Nl(n),{mutationKey:n,defaultOptions:t})}getMutationDefaults(n){const t=[...L(this,Po).values()],a={};return t.forEach(r=>{xu(n,r.mutationKey)&&Object.assign(a,r.defaultOptions)}),a}defaultQueryOptions(n){if(n._defaulted)return n;const t={...L(this,yr).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return t.queryHash||(t.queryHash=Ap(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Dp&&(t.enabled=!1),t}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...L(this,yr).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){L(this,bn).clear(),L(this,gr).clear()}},bn=new WeakMap,gr=new WeakMap,yr=new WeakMap,Bo=new WeakMap,Po=new WeakMap,vr=new WeakMap,Uo=new WeakMap,qo=new WeakMap,H2),n3=_.createContext(void 0),Tl=n=>{const t=_.useContext(n3);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Jv=({client:n,children:t})=>(_.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),l.jsx(n3.Provider,{value:n,children:t})),s3=_.createContext(!1),e_=()=>_.useContext(s3);s3.Provider;function t_(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var n_=_.createContext(t_()),s_=()=>_.useContext(n_),a_=(n,t,a)=>{const r=a!=null&&a.state.error&&typeof n.throwOnError=="function"?Op(n.throwOnError,[a.state.error,a]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||r)&&(t.isReset()||(n.retryOnMount=!1))},i_=n=>{_.useEffect(()=>{n.clearReset()},[n])},r_=({result:n,errorResetBoundary:t,throwOnError:a,query:r,suspense:c})=>n.isError&&!t.isReset()&&!n.isFetching&&r&&(c&&n.data===void 0||Op(a,[n.error,r])),l_=n=>{if(n.suspense){const a=c=>c==="static"?c:Math.max(c??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...c)=>a(r(...c)):a(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},o_=(n,t)=>n.isLoading&&n.isFetching&&!t,c_=(n,t)=>(n==null?void 0:n.suspense)&&t.isPending,O4=(n,t,a)=>t.fetchOptimistic(n).catch(()=>{a.clearReset()});function u_(n,t,a){var x,w,N,T;const r=e_(),c=s_(),u=Tl(),h=u.defaultQueryOptions(n);(w=(x=u.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||w.call(x,h);const p=u.getQueryCache().get(h.queryHash);h._optimisticResults=r?"isRestoring":"optimistic",l_(h),a_(h,c,p),i_(c);const y=!u.getQueryCache().get(h.queryHash),[m]=_.useState(()=>new t(u,h)),b=m.getOptimisticResult(h),g=!r&&n.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(C=>{const I=g?m.subscribe(Bn.batchCalls(C)):zn;return m.updateResult(),I},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),_.useEffect(()=>{m.setOptions(h)},[h,m]),c_(h,b))throw O4(h,m,c);if(r_({result:b,errorResetBoundary:c,throwOnError:h.throwOnError,query:p,suspense:h.suspense}))throw b.error;if((T=(N=u.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||T.call(N,h,b),h.experimental_prefetchInRender&&!kl&&o_(b,r)){const C=y?O4(h,m,c):p==null?void 0:p.promise;C==null||C.catch(zn).finally(()=>{m.updateResult()})}return h.notifyOnChangeProps?b:m.trackResult(b)}function Es(n,t){return u_(n,Fv)}function Vn(n,t){const a=Tl(),[r]=_.useState(()=>new Zv(a,n));_.useEffect(()=>{r.setOptions(n)},[r,n]);const c=_.useSyncExternalStore(_.useCallback(h=>r.subscribe(Bn.batchCalls(h)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),u=_.useCallback((h,p)=>{r.mutate(h,p).catch(zn)},[r]);if(c.error&&Op(r.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:u,mutateAsync:c.mutate}}var hf=typeof window<"u"?_.useLayoutEffect:_.useEffect;function h1(n){const t=_.useRef({value:n,prev:null}),a=t.current.value;return n!==a&&(t.current={value:n,prev:a}),t.current.prev}function d_(n,t,a={},r={}){_.useEffect(()=>{if(!n.current||r.disabled||typeof IntersectionObserver!="function")return;const c=new IntersectionObserver(([u])=>{t(u)},a);return c.observe(n.current),()=>{c.disconnect()}},[t,a,r.disabled,n])}function f_(n){const t=_.useRef(null);return _.useImperativeHandle(n,()=>t.current,[]),t}var h_=!1;function Su(n){return n[n.length-1]}function m_(n){return typeof n=="function"}function _r(n,t){return m_(n)?n(t):n}var p_=Object.prototype.hasOwnProperty,L4=Object.prototype.propertyIsEnumerable,g_=()=>Object.create(null),sl=(n,t)=>ol(n,t,g_);function ol(n,t,a=()=>({}),r=0){if(n===t)return n;if(r>500)return t;const c=t,u=B4(n)&&B4(c);if(!u&&!(Rf(n)&&Rf(c)))return c;const h=u?n:I4(n);if(!h)return c;const p=u?c:I4(c);if(!p)return c;const y=h.length,m=p.length,b=u?new Array(m):a();let g=0;for(let x=0;x<m;x++){const w=u?x:p[x],N=n[w],T=c[w];if(N===T){b[w]=N,(u?x<y:p_.call(n,w))&&g++;continue}if(N===null||T===null||typeof N!="object"||typeof T!="object"){b[w]=T;continue}const C=ol(N,T,a,r+1);b[w]=C,C===N&&g++}return y===m&&g===y?n:b}function I4(n){const t=Object.getOwnPropertyNames(n);for(const c of t)if(!L4.call(n,c))return!1;const a=Object.getOwnPropertySymbols(n);if(a.length===0)return t;const r=t;for(const c of a){if(!L4.call(n,c))return!1;r.push(c)}return r}function Rf(n){if(!z4(n))return!1;const t=n.constructor;if(typeof t>"u")return!0;const a=t.prototype;return!(!z4(a)||!a.hasOwnProperty("isPrototypeOf"))}function z4(n){return Object.prototype.toString.call(n)==="[object Object]"}function B4(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function bl(n,t,a){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let r=0,c=n.length;r<c;r++)if(!bl(n[r],t[r],a))return!1;return!0}if(Rf(n)&&Rf(t)){const r=(a==null?void 0:a.ignoreUndefined)??!0;if(a!=null&&a.partial){for(const h in t)if((!r||t[h]!==void 0)&&!bl(n[h],t[h],a))return!1;return!0}let c=0;if(!r)c=Object.keys(n).length;else for(const h in n)n[h]!==void 0&&c++;let u=0;for(const h in t)if((!r||t[h]!==void 0)&&(u++,u>c||!bl(n[h],t[h],a)))return!1;return c===u}return!1}function $o(n){let t,a;const r=new Promise((c,u)=>{t=c,a=u});return r.status="pending",r.resolve=c=>{r.status="resolved",r.value=c,t(c),n==null||n(c)},r.reject=c=>{r.status="rejected",a(c)},r}function ju(n){return!!(n&&typeof n=="object"&&typeof n.then=="function")}function y_(n){return n.replace(/[\x00-\x1f\x7f]/g,"")}function P4(n){let t;try{t=decodeURI(n)}catch{t=n.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch{return a}})}return y_(t)}var v_=["http:","https:","mailto:","tel:"];function Af(n,t){if(!n)return!1;try{const a=new URL(n);return!t.has(a.protocol)}catch{return!1}}function tu(n){if(!n)return{path:n,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(n)&&!n.startsWith("//"))return{path:n,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let a=0,r="",c;for(;(c=t.exec(n))!==null;)r+=P4(n.slice(a,c.index))+c[0],a=t.lastIndex;r=r+P4(a?n.slice(a):n);let u=!1;return r.startsWith("//")&&(u=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:u}}function __(n){return/\s|[^\u0000-\u007F]/.test(n)?n.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):n}function Df(n){const t=new Map;let a,r;const c=u=>{u.next&&(u.prev?(u.prev.next=u.next,u.next.prev=u.prev,u.next=void 0,r&&(r.next=u,u.prev=r)):(u.next.prev=void 0,a=u.next,u.next=void 0,r&&(u.prev=r,r.next=u)),r=u)};return{get(u){const h=t.get(u);if(h)return c(h),h.value},set(u,h){if(t.size>=n&&a){const y=a;t.delete(y.key),y.next&&(a=y.next,y.next.prev=void 0),y===r&&(r=void 0)}const p=t.get(u);if(p)p.value=h,c(p);else{const y={key:u,value:h,prev:r};r&&(r.next=y),r=y,a||(a=y),t.set(u,y)}},clear(){t.clear(),a=void 0,r=void 0}}}var b_="Invariant failed";function Cr(n,t){if(!n)throw new Error(b_)}var cl=4,a3=5;function x_(n){const t=n.indexOf("{");if(t===-1)return null;const a=n.indexOf("}",t);return a===-1||t+1>=n.length?null:[t,a]}function zp(n,t,a=new Uint16Array(6)){const r=n.indexOf("/",t),c=r===-1?n.length:r,u=n.substring(t,c);if(!u||!u.includes("$"))return a[0]=0,a[1]=t,a[2]=t,a[3]=c,a[4]=c,a[5]=c,a;if(u==="$"){const p=n.length;return a[0]=2,a[1]=t,a[2]=t,a[3]=p,a[4]=p,a[5]=p,a}if(u.charCodeAt(0)===36)return a[0]=1,a[1]=t,a[2]=t+1,a[3]=c,a[4]=c,a[5]=c,a;const h=x_(u);if(h){const[p,y]=h,m=u.charCodeAt(p+1);if(m===45){if(p+2<u.length&&u.charCodeAt(p+2)===36){const b=p+3,g=y;if(b<g)return a[0]=3,a[1]=t+p,a[2]=t+b,a[3]=t+g,a[4]=t+y+1,a[5]=c,a}}else if(m===36){const b=p+1,g=p+2;return g===y?(a[0]=2,a[1]=t+p,a[2]=t+b,a[3]=t+g,a[4]=t+y+1,a[5]=n.length,a):(a[0]=1,a[1]=t+p,a[2]=t+g,a[3]=t+y,a[4]=t+y+1,a[5]=c,a)}}return a[0]=0,a[1]=t,a[2]=t,a[3]=c,a[4]=c,a[5]=c,a}function Xf(n,t,a,r,c,u,h){var y,m,b,g,x,w,N,T,C,I,$,H,R;h==null||h(a);let p=r;{const Q=a.fullPath??a.from,ce=Q.length,Z=((y=a.options)==null?void 0:y.caseSensitive)??n,ie=!!((b=(m=a.options)==null?void 0:m.params)!=null&&b.parse&&((x=(g=a.options)==null?void 0:g.skipRouteOnParseError)!=null&&x.params));for(;p<ce;){const Y=zp(Q,p,t);let F;const _e=p,je=Y[5];switch(p=je+1,u++,Y[0]){case 0:{const ae=Q.substring(Y[2],Y[3]);if(Z){const ue=(w=c.static)==null?void 0:w.get(ae);if(ue)F=ue;else{c.static??(c.static=new Map);const E=ul(a.fullPath??a.from);E.parent=c,E.depth=u,F=E,c.static.set(ae,E)}}else{const ue=ae.toLowerCase(),E=(N=c.staticInsensitive)==null?void 0:N.get(ue);if(E)F=E;else{c.staticInsensitive??(c.staticInsensitive=new Map);const U=ul(a.fullPath??a.from);U.parent=c,U.depth=u,F=U,c.staticInsensitive.set(ue,U)}}break}case 1:{const ae=Q.substring(_e,Y[1]),ue=Q.substring(Y[4],je),E=Z&&!!(ae||ue),U=ae?E?ae:ae.toLowerCase():void 0,te=ue?E?ue:ue.toLowerCase():void 0,W=!ie&&((T=c.dynamic)==null?void 0:T.find(xe=>!xe.skipOnParamError&&xe.caseSensitive===E&&xe.prefix===U&&xe.suffix===te));if(W)F=W;else{const xe=p1(1,a.fullPath??a.from,E,U,te);F=xe,xe.depth=u,xe.parent=c,c.dynamic??(c.dynamic=[]),c.dynamic.push(xe)}break}case 3:{const ae=Q.substring(_e,Y[1]),ue=Q.substring(Y[4],je),E=Z&&!!(ae||ue),U=ae?E?ae:ae.toLowerCase():void 0,te=ue?E?ue:ue.toLowerCase():void 0,W=!ie&&((C=c.optional)==null?void 0:C.find(xe=>!xe.skipOnParamError&&xe.caseSensitive===E&&xe.prefix===U&&xe.suffix===te));if(W)F=W;else{const xe=p1(3,a.fullPath??a.from,E,U,te);F=xe,xe.parent=c,xe.depth=u,c.optional??(c.optional=[]),c.optional.push(xe)}break}case 2:{const ae=Q.substring(_e,Y[1]),ue=Q.substring(Y[4],je),E=Z&&!!(ae||ue),U=ae?E?ae:ae.toLowerCase():void 0,te=ue?E?ue:ue.toLowerCase():void 0,W=p1(2,a.fullPath??a.from,E,U,te);F=W,W.parent=c,W.depth=u,c.wildcard??(c.wildcard=[]),c.wildcard.push(W)}}c=F}if(ie&&a.children&&!a.isRoot&&a.id&&a.id.charCodeAt(a.id.lastIndexOf("/")+1)===95){const Y=ul(a.fullPath??a.from);Y.kind=a3,Y.parent=c,u++,Y.depth=u,c.pathless??(c.pathless=[]),c.pathless.push(Y),c=Y}const ee=(a.path||!a.children)&&!a.isRoot;if(ee&&Q.endsWith("/")){const Y=ul(a.fullPath??a.from);Y.kind=cl,Y.parent=c,u++,Y.depth=u,c.index=Y,c=Y}c.parse=(($=(I=a.options)==null?void 0:I.params)==null?void 0:$.parse)??null,c.skipOnParamError=ie,c.parsingPriority=((R=(H=a.options)==null?void 0:H.skipRouteOnParseError)==null?void 0:R.priority)??0,ee&&!c.route&&(c.route=a,c.fullPath=a.fullPath??a.from)}if(a.children)for(const Q of a.children)Xf(n,t,Q,p,c,u,h)}function m1(n,t){if(n.skipOnParamError&&!t.skipOnParamError)return-1;if(!n.skipOnParamError&&t.skipOnParamError)return 1;if(n.skipOnParamError&&t.skipOnParamError&&(n.parsingPriority||t.parsingPriority))return t.parsingPriority-n.parsingPriority;if(n.prefix&&t.prefix&&n.prefix!==t.prefix){if(n.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(n.prefix))return 1}if(n.suffix&&t.suffix&&n.suffix!==t.suffix){if(n.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(n.suffix))return 1}return n.prefix&&!t.prefix?-1:!n.prefix&&t.prefix?1:n.suffix&&!t.suffix?-1:!n.suffix&&t.suffix?1:n.caseSensitive&&!t.caseSensitive?-1:!n.caseSensitive&&t.caseSensitive?1:0}function rr(n){var t,a,r;if(n.pathless)for(const c of n.pathless)rr(c);if(n.static)for(const c of n.static.values())rr(c);if(n.staticInsensitive)for(const c of n.staticInsensitive.values())rr(c);if((t=n.dynamic)!=null&&t.length){n.dynamic.sort(m1);for(const c of n.dynamic)rr(c)}if((a=n.optional)!=null&&a.length){n.optional.sort(m1);for(const c of n.optional)rr(c)}if((r=n.wildcard)!=null&&r.length){n.wildcard.sort(m1);for(const c of n.wildcard)rr(c)}}function ul(n){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:n,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function p1(n,t,a,r,c){return{kind:n,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:a,prefix:r,suffix:c}}function S_(n,t){const a=ul("/"),r=new Uint16Array(6);for(const c of n)Xf(!1,r,c,1,a,0);rr(a),t.masksTree=a,t.flatCache=Df(1e3)}function j_(n,t){n||(n="/");const a=t.flatCache.get(n);if(a)return a;const r=Bp(n,t.masksTree);return t.flatCache.set(n,r),r}function w_(n,t,a,r,c){n||(n="/"),r||(r="/");const u=t?`case\0${n}`:n;let h=c.singleCache.get(u);return h||(h=ul("/"),Xf(t,new Uint16Array(6),{from:n},1,h,0),c.singleCache.set(u,h)),Bp(r,h,a)}function k_(n,t,a=!1){const r=a?n:`nofuzz\0${n}`,c=t.matchCache.get(r);if(c!==void 0)return c;n||(n="/");let u;try{u=Bp(n,t.segmentTree,a)}catch(h){if(h instanceof URIError)u=null;else throw h}return u&&(u.branch=T_(u.route)),t.matchCache.set(r,u),u}function N_(n){return n==="/"?n:n.replace(/\/{1,}$/,"")}function C_(n,t=!1,a){const r=ul(n.fullPath),c=new Uint16Array(6),u={},h={};let p=0;return Xf(t,c,n,1,r,0,y=>{if(a==null||a(y,p),Cr(!(y.id in u),`Duplicate routes found with id: ${String(y.id)}`),u[y.id]=y,p!==0&&y.path){const m=N_(y.fullPath);(!h[m]||y.fullPath.endsWith("/"))&&(h[m]=y)}p++}),rr(r),{processedTree:{segmentTree:r,singleCache:Df(1e3),matchCache:Df(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:h}}function Bp(n,t,a=!1){const r=n.split("/"),c=M_(n,r,t,a);if(!c)return null;const[u]=i3(n,r,c);return{route:c.node.route,rawParams:u,parsedParams:c.parsedParams}}function i3(n,t,a){var b,g,x,w,N,T,C,I,$,H;const r=E_(a.node);let c=null;const u=Object.create(null);let h=((b=a.extract)==null?void 0:b.part)??0,p=((g=a.extract)==null?void 0:g.node)??0,y=((x=a.extract)==null?void 0:x.path)??0,m=((w=a.extract)==null?void 0:w.segment)??0;for(;p<r.length;h++,p++,y++,m++){const R=r[p];if(R.kind===cl)break;if(R.kind===a3){m--,h--,y--;continue}const Q=t[h],ce=y;if(Q&&(y+=Q.length),R.kind===1){c??(c=a.node.fullPath.split("/"));const Z=c[m],ie=((N=R.prefix)==null?void 0:N.length)??0;if(Z.charCodeAt(ie)===123){const ee=((T=R.suffix)==null?void 0:T.length)??0,Y=Z.substring(ie+2,Z.length-ee-1),F=Q.substring(ie,Q.length-ee);u[Y]=decodeURIComponent(F)}else{const ee=Z.substring(1);u[ee]=decodeURIComponent(Q)}}else if(R.kind===3){if(a.skipped&1<<p){h--,y=ce-1;continue}c??(c=a.node.fullPath.split("/"));const Z=c[m],ie=((C=R.prefix)==null?void 0:C.length)??0,ee=((I=R.suffix)==null?void 0:I.length)??0,Y=Z.substring(ie+3,Z.length-ee-1),F=R.suffix||R.prefix?Q.substring(ie,Q.length-ee):Q;F&&(u[Y]=decodeURIComponent(F))}else if(R.kind===2){const Z=R,ie=n.substring(ce+((($=Z.prefix)==null?void 0:$.length)??0),n.length-(((H=Z.suffix)==null?void 0:H.length)??0)),ee=decodeURIComponent(ie);u["*"]=ee,u._splat=ee;break}}return a.rawParams&&Object.assign(u,a.rawParams),[u,{part:h,node:p,path:y,segment:m}]}function T_(n){const t=[n];for(;n.parentRoute;)n=n.parentRoute,t.push(n);return t.reverse(),t}function E_(n){const t=Array(n.depth+1);do t[n.depth]=n,n=n.parent;while(n);return t}function M_(n,t,a,r){if(n==="/"&&a.index)return{node:a.index,skipped:0};const c=!Su(t),u=c&&n!=="/",h=t.length-(c?1:0),p=[{node:a,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let y=null,m=null,b=null;for(;p.length;){const g=p.pop(),{node:x,index:w,skipped:N,depth:T,statics:C,dynamics:I,optionals:$}=g;let{extract:H,rawParams:R,parsedParams:Q}=g;if(x.skipOnParamError){if(!g1(n,t,g))continue;R=g.rawParams,H=g.extract,Q=g.parsedParams}r&&x.route&&x.kind!==cl&&nu(m,g)&&(m=g);const ce=w===h;if(ce&&(x.route&&!u&&nu(b,g)&&(b=g),!x.optional&&!x.wildcard&&!x.index&&!x.pathless))continue;const Z=ce?void 0:t[w];let ie;if(ce&&x.index){const ee={node:x.index,index:w,skipped:N,depth:T+1,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q};let Y=!0;if(x.index.skipOnParamError&&(g1(n,t,ee)||(Y=!1)),Y){if(C===h&&!I&&!$&&!N)return ee;nu(b,ee)&&(b=ee)}}if(x.wildcard&&nu(y,g))for(const ee of x.wildcard){const{prefix:Y,suffix:F}=ee;if(Y&&(ce||!(ee.caseSensitive?Z:ie??(ie=Z.toLowerCase())).startsWith(Y)))continue;if(F){if(ce)continue;const je=t.slice(w).join("/").slice(-F.length);if((ee.caseSensitive?je:je.toLowerCase())!==F)continue}const _e={node:ee,index:h,skipped:N,depth:T,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q};if(!(ee.skipOnParamError&&!g1(n,t,_e))){y=_e;break}}if(x.optional){const ee=N|1<<T,Y=T+1;for(let F=x.optional.length-1;F>=0;F--){const _e=x.optional[F];p.push({node:_e,index:w,skipped:ee,depth:Y,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(!ce)for(let F=x.optional.length-1;F>=0;F--){const _e=x.optional[F],{prefix:je,suffix:ae}=_e;if(je||ae){const ue=_e.caseSensitive?Z:ie??(ie=Z.toLowerCase());if(je&&!ue.startsWith(je)||ae&&!ue.endsWith(ae))continue}p.push({node:_e,index:w+1,skipped:N,depth:Y,statics:C,dynamics:I,optionals:$+1,extract:H,rawParams:R,parsedParams:Q})}}if(!ce&&x.dynamic&&Z)for(let ee=x.dynamic.length-1;ee>=0;ee--){const Y=x.dynamic[ee],{prefix:F,suffix:_e}=Y;if(F||_e){const je=Y.caseSensitive?Z:ie??(ie=Z.toLowerCase());if(F&&!je.startsWith(F)||_e&&!je.endsWith(_e))continue}p.push({node:Y,index:w+1,skipped:N,depth:T+1,statics:C,dynamics:I+1,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(!ce&&x.staticInsensitive){const ee=x.staticInsensitive.get(ie??(ie=Z.toLowerCase()));ee&&p.push({node:ee,index:w+1,skipped:N,depth:T+1,statics:C+1,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(!ce&&x.static){const ee=x.static.get(Z);ee&&p.push({node:ee,index:w+1,skipped:N,depth:T+1,statics:C+1,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(x.pathless){const ee=T+1;for(let Y=x.pathless.length-1;Y>=0;Y--){const F=x.pathless[Y];p.push({node:F,index:w,skipped:N,depth:ee,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}}}if(b&&y)return nu(y,b)?b:y;if(b)return b;if(y)return y;if(r&&m){let g=m.index;for(let w=0;w<m.index;w++)g+=t[w].length;const x=g===n.length?"/":n.slice(g);return m.rawParams??(m.rawParams=Object.create(null)),m.rawParams["**"]=decodeURIComponent(x),m}return null}function g1(n,t,a){try{const[r,c]=i3(n,t,a);a.rawParams=r,a.extract=c;const u=a.node.parse(r);return a.parsedParams=Object.assign(Object.create(null),a.parsedParams,u),!0}catch{return null}}function nu(n,t){return n?t.statics>n.statics||t.statics===n.statics&&(t.dynamics>n.dynamics||t.dynamics===n.dynamics&&(t.optionals>n.optionals||t.optionals===n.optionals&&((t.node.kind===cl)>(n.node.kind===cl)||t.node.kind===cl==(n.node.kind===cl)&&t.depth>n.depth))):!0}function Sf(n){return Pp(n.filter(t=>t!==void 0).join("/"))}function Pp(n){return n.replace(/\/{2,}/g,"/")}function r3(n){return n==="/"?n:n.replace(/^\/{1,}/,"")}function jr(n){const t=n.length;return t>1&&n[t-1]==="/"?n.replace(/\/{1,}$/,""):n}function l3(n){return jr(r3(n))}function Of(n,t){return n!=null&&n.endsWith("/")&&n!=="/"&&n!==`${t}/`?n.slice(0,-1):n}function R_(n,t,a){return Of(n,a)===Of(t,a)}function A_({base:n,to:t,trailingSlash:a="never",cache:r}){const c=t.startsWith("/"),u=!c&&t===".";let h;if(r){h=c?t:u?n:n+"\0"+t;const g=r.get(h);if(g)return g}let p;if(u)p=n.split("/");else if(c)p=t.split("/");else{for(p=n.split("/");p.length>1&&Su(p)==="";)p.pop();const g=t.split("/");for(let x=0,w=g.length;x<w;x++){const N=g[x];N===""?x?x===w-1&&p.push(N):p=[N]:N===".."?p.pop():N==="."||p.push(N)}}p.length>1&&(Su(p)===""?a==="never"&&p.pop():a==="always"&&p.push(""));let y,m="";for(let g=0;g<p.length;g++){g>0&&(m+="/");const x=p[g];if(!x)continue;y=zp(x,0,y);const w=y[0];if(w===0){m+=x;continue}const N=y[5],T=x.substring(0,y[1]),C=x.substring(y[4],N),I=x.substring(y[2],y[3]);w===1?m+=T||C?`${T}{$${I}}${C}`:`$${I}`:w===2?m+=T||C?`${T}{$}${C}`:"$":m+=`${T}{-$${I}}${C}`}m=Pp(m);const b=m||"/";return h&&r&&r.set(h,b),b}function D_(n){const t=new Map(n.map(c=>[encodeURIComponent(c),c])),a=Array.from(t.keys()).map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(a,"g");return c=>c.replace(r,u=>t.get(u)??u)}function y1(n,t,a){const r=t[n];return typeof r!="string"?r:n==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(c=>q4(c,a)).join("/"):q4(r,a)}function U4({path:n,params:t,decoder:a,...r}){let c=!1;const u=Object.create(null);if(!n||n==="/")return{interpolatedPath:"/",usedParams:u,isMissingParams:c};if(!n.includes("$"))return{interpolatedPath:n,usedParams:u,isMissingParams:c};const h=n.length;let p=0,y,m="";for(;p<h;){const b=p;y=zp(n,b,y);const g=y[5];if(p=g+1,b===g)continue;const x=y[0];if(x===0){m+="/"+n.substring(b,g);continue}if(x===2){const w=t._splat;u._splat=w,u["*"]=w;const N=n.substring(b,y[1]),T=n.substring(y[4],g);if(!w){c=!0,(N||T)&&(m+="/"+N+T);continue}const C=y1("_splat",t,a);m+="/"+N+C+T;continue}if(x===1){const w=n.substring(y[2],y[3]);!c&&!(w in t)&&(c=!0),u[w]=t[w];const N=n.substring(b,y[1]),T=n.substring(y[4],g),C=y1(w,t,a)??"undefined";m+="/"+N+C+T;continue}if(x===3){const w=n.substring(y[2],y[3]),N=t[w];if(N==null)continue;u[w]=N;const T=n.substring(b,y[1]),C=n.substring(y[4],g),I=y1(w,t,a)??"";m+="/"+T+I+C;continue}}return n.endsWith("/")&&(m+="/"),{usedParams:u,interpolatedPath:m||"/",isMissingParams:c}}function q4(n,t){const a=encodeURIComponent(n);return(t==null?void 0:t(a))??a}function hs(n){return!!(n!=null&&n.isNotFound)}function O_(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var np="tsr-scroll-restoration-v1_3",L_=(n,t)=>{let a;return(...r)=>{a||(a=setTimeout(()=>{n(...r),a=null},t))}};function I_(){const n=O_();if(!n)return null;const t=n.getItem(np);let a=t?JSON.parse(t):{};return{state:a,set:r=>{a=_r(r,a)||a;try{n.setItem(np,JSON.stringify(a))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var mf=I_(),z_=n=>n.state.__TSR_key||n.href;function B_(n){const t=[];let a;for(;a=n.parentNode;)t.push(`${n.tagName}:nth-child(${Array.prototype.indexOf.call(a.children,n)+1})`),n=a;return`${t.reverse().join(" > ")}`.toLowerCase()}var Lf=!1;function P_({storageKey:n,key:t,behavior:a,shouldScrollRestoration:r,scrollToTopSelectors:c,location:u}){var m,b;let h;try{h=JSON.parse(sessionStorage.getItem(n)||"{}")}catch(g){console.error(g);return}const p=t||((m=window.history.state)==null?void 0:m.__TSR_key),y=h[p];Lf=!0;e:{if(r&&y&&Object.keys(y).length>0){for(const w in y){const N=y[w];if(w==="window")window.scrollTo({top:N.scrollY,left:N.scrollX,behavior:a});else if(w){const T=document.querySelector(w);T&&(T.scrollLeft=N.scrollX,T.scrollTop=N.scrollY)}}break e}const g=(u??window.location).hash.split("#",2)[1];if(g){const w=((b=window.history.state)==null?void 0:b.__hashScrollIntoViewOptions)??!0;if(w){const N=document.getElementById(g);N&&N.scrollIntoView(w)}break e}const x={top:0,left:0,behavior:a};if(window.scrollTo(x),c)for(const w of c){if(w==="window")continue;const N=typeof w=="function"?w():document.querySelector(w);N&&N.scrollTo(x)}}Lf=!1}function U_(n,t){if(!mf||((n.options.scrollRestoration??!1)&&(n.isScrollRestoring=!0),n.isScrollRestorationSetup||!mf))return;n.isScrollRestorationSetup=!0,Lf=!1;const a=n.options.getScrollRestorationKey||z_;window.history.scrollRestoration="manual";const r=c=>{if(Lf||!n.isScrollRestoring)return;let u="";if(c.target===document||c.target===window)u="window";else{const p=c.target.getAttribute("data-scroll-restoration-id");p?u=`[data-scroll-restoration-id="${p}"]`:u=B_(c.target)}const h=a(n.state.location);mf.set(p=>{const y=p[h]||(p[h]={}),m=y[u]||(y[u]={});if(u==="window")m.scrollX=window.scrollX||0,m.scrollY=window.scrollY||0;else if(u){const b=document.querySelector(u);b&&(m.scrollX=b.scrollLeft||0,m.scrollY=b.scrollTop||0)}return p})};typeof document<"u"&&document.addEventListener("scroll",L_(r,100),!0),n.subscribe("onRendered",c=>{const u=a(c.toLocation);if(!n.resetNextScroll){n.resetNextScroll=!0;return}typeof n.options.scrollRestoration=="function"&&!n.options.scrollRestoration({location:n.latestLocation})||(P_({storageKey:np,key:u,behavior:n.options.scrollRestorationBehavior,shouldScrollRestoration:n.isScrollRestoring,scrollToTopSelectors:n.options.scrollToTopSelectors,location:n.history.location}),n.isScrollRestoring&&mf.set(h=>(h[u]||(h[u]={}),h)))})}function q_(n){if(typeof document<"u"&&document.querySelector){const t=n.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&n.state.location.hash!==""){const a=document.getElementById(n.state.location.hash);a&&a.scrollIntoView(t)}}}function $_(n,t=String){const a=new URLSearchParams;for(const r in n){const c=n[r];c!==void 0&&a.set(r,t(c))}return a.toString()}function v1(n){return n?n==="false"?!1:n==="true"?!0:+n*0===0&&+n+""===n?+n:n:""}function H_(n){const t=new URLSearchParams(n),a=Object.create(null);for(const[r,c]of t.entries()){const u=a[r];u==null?a[r]=v1(c):Array.isArray(u)?u.push(v1(c)):a[r]=[u,v1(c)]}return a}var F_=G_(JSON.parse),Q_=V_(JSON.stringify,JSON.parse);function G_(n){return t=>{t[0]==="?"&&(t=t.substring(1));const a=H_(t);for(const r in a){const c=a[r];if(typeof c=="string")try{a[r]=n(c)}catch{}}return a}}function V_(n,t){const a=typeof t=="function";function r(c){if(typeof c=="object"&&c!==null)try{return n(c)}catch{}else if(a&&typeof c=="string")try{return t(c),n(c)}catch{}return c}return c=>{const u=$_(c,r);return u?`?${u}`:""}}var xl="__root__";function K_(n){if(n.statusCode=n.statusCode||n.code||307,!n._builtLocation&&!n.reloadDocument&&typeof n.href=="string")try{new URL(n.href),n.reloadDocument=!0}catch{}const t=new Headers(n.headers);n.href&&t.get("Location")===null&&t.set("Location",n.href);const a=new Response(null,{status:n.statusCode,headers:t});if(a.options=n,n.throw)throw a;return a}function Ms(n){return n instanceof Response&&!!n.options}function Y_(n){return{input:({url:t})=>{for(const a of n)t=sp(a,t);return t},output:({url:t})=>{for(let a=n.length-1;a>=0;a--)t=o3(n[a],t);return t}}}function Z_(n){const t=l3(n.basepath),a=`/${t}`,r=`${a}/`,c=n.caseSensitive?a:a.toLowerCase(),u=n.caseSensitive?r:r.toLowerCase();return{input:({url:h})=>{const p=n.caseSensitive?h.pathname:h.pathname.toLowerCase();return p===c?h.pathname="/":p.startsWith(u)&&(h.pathname=h.pathname.slice(a.length)),h},output:({url:h})=>(h.pathname=Sf(["/",t,h.pathname]),h)}}function sp(n,t){var r;const a=(r=n==null?void 0:n.input)==null?void 0:r.call(n,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}function o3(n,t){var r;const a=(r=n==null?void 0:n.output)==null?void 0:r.call(n,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}var mn=(n=>(n[n.None=0]="None",n[n.Mutable=1]="Mutable",n[n.Watching=2]="Watching",n[n.RecursedCheck=4]="RecursedCheck",n[n.Recursed=8]="Recursed",n[n.Dirty=16]="Dirty",n[n.Pending=32]="Pending",n))(mn||{});function c3({update:n,notify:t,unwatched:a}){return{link:r,unlink:c,propagate:u,checkDirty:h,shallowPropagate:p};function r(m,b,g){const x=b.depsTail;if(x!==void 0&&x.dep===m)return;const w=x!==void 0?x.nextDep:b.deps;if(w!==void 0&&w.dep===m){w.version=g,b.depsTail=w;return}const N=m.subsTail;if(N!==void 0&&N.version===g&&N.sub===b)return;const T=b.depsTail=m.subsTail={version:g,dep:m,sub:b,prevDep:x,nextDep:w,prevSub:N,nextSub:void 0};w!==void 0&&(w.prevDep=T),x!==void 0?x.nextDep=T:b.deps=T,N!==void 0?N.nextSub=T:m.subs=T}function c(m,b=m.sub){const g=m.dep,x=m.prevDep,w=m.nextDep,N=m.nextSub,T=m.prevSub;return w!==void 0?w.prevDep=x:b.depsTail=x,x!==void 0?x.nextDep=w:b.deps=w,N!==void 0?N.prevSub=T:g.subsTail=T,T!==void 0?T.nextSub=N:(g.subs=N)===void 0&&a(g),w}function u(m){let b=m.nextSub,g;e:do{const x=m.sub;let w=x.flags;if(w&60?w&12?w&4?!(w&48)&&y(m,x)?(x.flags=w|40,w&=1):w=0:x.flags=w&-9|32:w=0:x.flags=w|32,w&2&&t(x),w&1){const N=x.subs;if(N!==void 0){const T=(m=N).nextSub;T!==void 0&&(g={value:b,prev:g},b=T);continue}}if((m=b)!==void 0){b=m.nextSub;continue}for(;g!==void 0;)if(m=g.value,g=g.prev,m!==void 0){b=m.nextSub;continue e}break}while(!0)}function h(m,b){let g,x=0,w=!1;e:do{const N=m.dep,T=N.flags;if(b.flags&16)w=!0;else if((T&17)===17){if(n(N)){const C=N.subs;C.nextSub!==void 0&&p(C),w=!0}}else if((T&33)===33){(m.nextSub!==void 0||m.prevSub!==void 0)&&(g={value:m,prev:g}),m=N.deps,b=N,++x;continue}if(!w){const C=m.nextDep;if(C!==void 0){m=C;continue}}for(;x--;){const C=b.subs,I=C.nextSub!==void 0;if(I?(m=g.value,g=g.prev):m=C,w){if(n(b)){I&&p(C),b=m.sub;continue}w=!1}else b.flags&=-33;b=m.sub;const $=m.nextDep;if($!==void 0){m=$;continue e}}return w}while(!0)}function p(m){do{const b=m.sub,g=b.flags;(g&48)===32&&(b.flags=g|16,(g&6)===2&&t(b))}while((m=m.nextSub)!==void 0)}function y(m,b){let g=b.depsTail;for(;g!==void 0;){if(g===m)return!0;g=g.prevDep}return!1}}let Up=0,al=0,yu=0;const bi=[],{link:yN,unlink:u3,propagate:vN,checkDirty:W_,shallowPropagate:_N}=c3({update(n){return n.depsTail!==void 0?t9(n):n9(n)},notify(n){var r;let t=yu,a=t;do if(bi[t++]=n,n.flags&=-3,n=(r=n.subs)==null?void 0:r.sub,n===void 0||!(n.flags&2))break;while(!0);for(yu=t;a<--t;){const c=bi[a];bi[a++]=bi[t],bi[t]=c}},unwatched(n){n.flags&1?n.depsTail!==void 0&&(n.depsTail=void 0,n.flags=17,Jf(n)):i9.call(n)}});function X_(){return Up}function J_(){++Up}function e9(){--Up||a9()}function t9(n){n.depsTail=void 0,n.flags=5;try{const t=n.value;return t!==(n.value=n.getter(t))}finally{n.flags&=-5,Jf(n)}}function n9(n){return n.flags=1,n.currentValue!==(n.currentValue=n.pendingValue)}function s9(n){const t=n.flags;if(t&16||t&32&&W_(n.deps,n)){n.depsTail=void 0,n.flags=6;try{n.fn()}finally{n.flags&=-5,Jf(n)}}else n.flags=2}function a9(){try{for(;al<yu;){const n=bi[al];bi[al++]=void 0,s9(n)}}finally{for(;al<yu;){const n=bi[al];bi[al++]=void 0,n.flags|=10}al=0,yu=0}}function i9(){this.depsTail=void 0,this.flags=0,Jf(this);const n=this.subs;n!==void 0&&u3(n)}function Jf(n){const t=n.depsTail;let a=t!==void 0?t.nextDep:n.deps;for(;a!==void 0;)a=u3(a,n)}function qp(n,t,a){var u,h,p;const r=typeof n=="object",c=r?n:void 0;return{next:(u=r?n.next:n)==null?void 0:u.bind(c),error:(h=r?n.error:t)==null?void 0:h.bind(c),complete:(p=r?n.complete:a)==null?void 0:p.bind(c)}}const ap=[];let jf=0;const{link:$4,unlink:r9,propagate:l9,checkDirty:d3,shallowPropagate:H4}=c3({update(n){return n._update()},notify(n){ap[ip++]=n,n.flags&=~mn.Watching},unwatched(n){n.depsTail!==void 0&&(n.depsTail=void 0,n.flags=mn.Mutable|mn.Dirty,If(n))}});let pf=0,ip=0,Ba;function If(n){const t=n.depsTail;let a=t!==void 0?t.nextDep:n.deps;for(;a!==void 0;)a=r9(a,n)}function f3(){if(!(X_()>0)){for(;pf<ip;){const n=ap[pf];ap[pf++]=void 0,n.notify()}pf=0,ip=0}}function h3(n,t){const a=typeof n=="function",r=n,c={_snapshot:a?void 0:n,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:a?mn.None:mn.Mutable,get(){return Ba!==void 0&&$4(c,Ba,jf),c._snapshot},subscribe(u){const h=qp(u),p={current:!1},y=o9(()=>{var m;c.get(),p.current?(m=h.next)==null||m.call(h,c._snapshot):p.current=!0});return{unsubscribe:()=>{y.stop()}}},_update(u){const h=Ba,p=Object.is;if(a)Ba=c,++jf,c.depsTail=void 0;else if(u===void 0)return!1;a&&(c.flags=mn.Mutable|mn.RecursedCheck);try{const y=c._snapshot,m=typeof u=="function"?u(y):u===void 0&&a?r(y):u;return y===void 0||!p(y,m)?(c._snapshot=m,!0):!1}finally{Ba=h,a&&(c.flags&=~mn.RecursedCheck),If(c)}}};return a?(c.flags=mn.Mutable|mn.Dirty,c.get=function(){const u=c.flags;if(u&mn.Dirty||u&mn.Pending&&d3(c.deps,c)){if(c._update()){const h=c.subs;h!==void 0&&H4(h)}}else u&mn.Pending&&(c.flags=u&~mn.Pending);return Ba!==void 0&&$4(c,Ba,jf),c._snapshot}):c.set=function(u){if(c._update(u)){const h=c.subs;h!==void 0&&(l9(h),H4(h),f3())}},c}function o9(n){const t=()=>{const r=Ba;Ba=a,++jf,a.depsTail=void 0,a.flags=mn.Watching|mn.RecursedCheck;try{return n()}finally{Ba=r,a.flags&=~mn.RecursedCheck,If(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:mn.Watching|mn.RecursedCheck,notify(){const r=this.flags;r&mn.Dirty||r&mn.Pending&&d3(this.deps,this)?t():this.flags=mn.Watching},stop(){this.flags=mn.None,this.depsTail=void 0,If(this)}};return t(),a}class c9{constructor(t){this.atom=h3(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(qp(t))}}class u9{constructor(t){this.atom=h3(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(qp(t))}}function d9(n){return typeof n=="function"?new u9(n):new c9(n)}function f9(n){try{J_(),n()}finally{e9(),f3()}}function vu(n){let t;return f9(()=>{t=n()}),t}var rp=n=>{var t;if(!n.rendered)return n.rendered=!0,(t=n.onReady)==null?void 0:t.call(n)},eh=(n,t)=>!!(n.preload&&!n.router.state.matches.some(a=>a.id===t)),Sl=(n,t,a=!0)=>{const r={...n.router.options.context??{}},c=a?t:t-1;for(let u=0;u<=c;u++){const h=n.matches[u];if(!h)continue;const p=n.router.getMatch(h.id);p&&Object.assign(r,p.__routeContext,p.__beforeLoadContext)}return r},F4=(n,t)=>{if(!n.matches.length)return;const a=t.routeId,r=n.matches.findIndex(h=>h.routeId===n.router.routeTree.id),c=r>=0?r:0;let u=a?n.matches.findIndex(h=>h.routeId===a):n.firstBadMatchIndex??n.matches.length-1;u<0&&(u=c);for(let h=u;h>=0;h--){const p=n.matches[h];if(n.router.looseRoutesById[p.routeId].options.notFoundComponent)return h}return a?u:c},br=(n,t,a)=>{var r,c,u;if(!(!Ms(a)&&!hs(a)))throw Ms(a)&&a.redirectHandled&&!a.options.reloadDocument||(t&&((r=t._nonReactive.beforeLoadPromise)==null||r.resolve(),(c=t._nonReactive.loaderPromise)==null||c.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=a,n.updateMatch(t.id,h=>({...h,status:Ms(a)?"redirected":h.status==="pending"?"success":h.status,context:Sl(n,t.index),isFetching:!1,error:a})),hs(a)&&!a.routeId&&(a.routeId=t.routeId),(u=t._nonReactive.loadPromise)==null||u.resolve()),Ms(a)&&(n.rendered=!0,a.options._fromLocation=n.location,a.redirectHandled=!0,a=n.router.resolveRedirect(a))),a},m3=(n,t)=>{const a=n.router.getMatch(t);return!!(!a||a._nonReactive.dehydrated)},Q4=(n,t,a)=>{const r=Sl(n,a);n.updateMatch(t,c=>({...c,context:r}))},su=(n,t,a,r)=>{var p,y;const{id:c,routeId:u}=n.matches[t],h=n.router.looseRoutesById[u];if(a instanceof Promise)throw a;a.routerCode=r,n.firstBadMatchIndex??(n.firstBadMatchIndex=t),br(n,n.router.getMatch(c),a);try{(y=(p=h.options).onError)==null||y.call(p,a)}catch(m){a=m,br(n,n.router.getMatch(c),a)}n.updateMatch(c,m=>{var b,g;return(b=m._nonReactive.beforeLoadPromise)==null||b.resolve(),m._nonReactive.beforeLoadPromise=void 0,(g=m._nonReactive.loadPromise)==null||g.resolve(),{...m,error:a,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!n.preload&&!Ms(a)&&!hs(a)&&(n.serialError??(n.serialError=a))},p3=(n,t,a,r)=>{var u;if(r._nonReactive.pendingTimeout!==void 0)return;const c=a.options.pendingMs??n.router.options.defaultPendingMs;if(n.onReady&&!eh(n,t)&&(a.options.loader||a.options.beforeLoad||y3(a))&&typeof c=="number"&&c!==1/0&&(a.options.pendingComponent??((u=n.router.options)==null?void 0:u.defaultPendingComponent))){const h=setTimeout(()=>{rp(n)},c);r._nonReactive.pendingTimeout=h}},h9=(n,t,a)=>{const r=n.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;p3(n,t,a,r);const c=()=>{const u=n.router.getMatch(t);u.preload&&(u.status==="redirected"||u.status==="notFound")&&br(n,u,u.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(c):c()},m9=(n,t,a,r)=>{const c=n.router.getMatch(t);let u=c._nonReactive.loadPromise;c._nonReactive.loadPromise=$o(()=>{u==null||u.resolve(),u=void 0});const{paramsError:h,searchError:p}=c;h&&su(n,a,h,"PARSE_PARAMS"),p&&su(n,a,p,"VALIDATE_SEARCH"),p3(n,t,r,c);const y=new AbortController;let m=!1;const b=()=>{m||(m=!0,n.updateMatch(t,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:y})))},g=()=>{var R;(R=c._nonReactive.beforeLoadPromise)==null||R.resolve(),c._nonReactive.beforeLoadPromise=void 0,n.updateMatch(t,Q=>({...Q,isFetching:!1}))};if(!r.options.beforeLoad){vu(()=>{b(),g()});return}c._nonReactive.beforeLoadPromise=$o();const x={...Sl(n,a,!1),...c.__routeContext},{search:w,params:N,cause:T}=c,C=eh(n,t),I={search:w,abortController:y,params:N,preload:C,context:x,location:n.location,navigate:R=>n.router.navigate({...R,_fromLocation:n.location}),buildLocation:n.router.buildLocation,cause:C?"preload":T,matches:n.matches,routeId:r.id,...n.router.options.additionalContext},$=R=>{if(R===void 0){vu(()=>{b(),g()});return}(Ms(R)||hs(R))&&(b(),su(n,a,R,"BEFORE_LOAD")),vu(()=>{b(),n.updateMatch(t,Q=>({...Q,__beforeLoadContext:R})),g()})};let H;try{if(H=r.options.beforeLoad(I),ju(H))return b(),H.catch(R=>{su(n,a,R,"BEFORE_LOAD")}).then($)}catch(R){b(),su(n,a,R,"BEFORE_LOAD")}$(H)},p9=(n,t)=>{const{id:a,routeId:r}=n.matches[t],c=n.router.looseRoutesById[r],u=()=>p(),h=()=>m9(n,a,t,c),p=()=>{if(m3(n,a))return;const y=h9(n,a,c);return ju(y)?y.then(h):h()};return u()},g9=(n,t,a)=>{var u,h,p,y,m,b;const r=n.router.getMatch(t);if(!r||!a.options.head&&!a.options.scripts&&!a.options.headers)return;const c={ssr:n.router.options.ssr,matches:n.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([(h=(u=a.options).head)==null?void 0:h.call(u,c),(y=(p=a.options).scripts)==null?void 0:y.call(p,c),(b=(m=a.options).headers)==null?void 0:b.call(m,c)]).then(([g,x,w])=>({meta:g==null?void 0:g.meta,links:g==null?void 0:g.links,headScripts:g==null?void 0:g.scripts,headers:w,scripts:x,styles:g==null?void 0:g.styles}))},g3=(n,t,a,r,c)=>{const u=t[r-1],{params:h,loaderDeps:p,abortController:y,cause:m}=n.router.getMatch(a),b=Sl(n,r),g=eh(n,a);return{params:h,deps:p,preload:!!g,parentMatchPromise:u,abortController:y,context:b,location:n.location,navigate:x=>n.router.navigate({...x,_fromLocation:n.location}),cause:g?"preload":m,route:c,...n.router.options.additionalContext}},G4=async(n,t,a,r,c)=>{var u,h,p,y,m;try{const b=n.router.getMatch(a);try{(!(h_??n.router.isServer)||b.ssr===!0)&&wu(c);const g=c.options.loader,x=typeof g=="function"?g:g==null?void 0:g.handler,w=x==null?void 0:x(g3(n,t,a,r,c)),N=!!x&&ju(w);if((N||c._lazyPromise||c._componentsPromise||c.options.head||c.options.scripts||c.options.headers||b._nonReactive.minPendingPromise)&&n.updateMatch(a,C=>({...C,isFetching:"loader"})),x){const C=N?await w:w;br(n,n.router.getMatch(a),C),C!==void 0&&n.updateMatch(a,I=>({...I,loaderData:C}))}c._lazyPromise&&await c._lazyPromise;const T=b._nonReactive.minPendingPromise;T&&await T,c._componentsPromise&&await c._componentsPromise,n.updateMatch(a,C=>({...C,error:void 0,context:Sl(n,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(g){let x=g;if((x==null?void 0:x.name)==="AbortError"){if(b.abortController.signal.aborted){(u=b._nonReactive.loaderPromise)==null||u.resolve(),b._nonReactive.loaderPromise=void 0;return}n.updateMatch(a,N=>({...N,status:N.status==="pending"?"success":N.status,isFetching:!1,context:Sl(n,r)}));return}const w=b._nonReactive.minPendingPromise;w&&await w,hs(g)&&await((p=(h=c.options.notFoundComponent)==null?void 0:h.preload)==null?void 0:p.call(h)),br(n,n.router.getMatch(a),g);try{(m=(y=c.options).onError)==null||m.call(y,g)}catch(N){x=N,br(n,n.router.getMatch(a),N)}!Ms(x)&&!hs(x)&&await wu(c,["errorComponent"]),n.updateMatch(a,N=>({...N,error:x,context:Sl(n,r),status:"error",isFetching:!1}))}}catch(b){const g=n.router.getMatch(a);g&&(g._nonReactive.loaderPromise=void 0),br(n,g,b)}},y9=async(n,t,a)=>{var w,N,T,C;async function r(I,$,H,R,Q){const ce=Date.now()-$.updatedAt,Z=I?Q.options.preloadStaleTime??n.router.options.defaultPreloadStaleTime??3e4:Q.options.staleTime??n.router.options.defaultStaleTime??0,ie=Q.options.shouldReload,ee=typeof ie=="function"?ie(g3(n,t,c,a,Q)):ie,{status:Y,invalid:F}=R,_e=ce>Z&&(!!n.forceStaleReload||R.cause==="enter"||H!==void 0&&H!==R.id);h=Y==="success"&&(F||(ee??_e)),I&&Q.options.preload===!1||(h&&!n.sync&&b?(p=!0,(async()=>{var je,ae;try{await G4(n,t,c,a,Q);const ue=n.router.getMatch(c);(je=ue._nonReactive.loaderPromise)==null||je.resolve(),(ae=ue._nonReactive.loadPromise)==null||ae.resolve(),ue._nonReactive.loaderPromise=void 0,ue._nonReactive.loadPromise=void 0}catch(ue){Ms(ue)&&await n.router.navigate(ue.options)}})()):Y!=="success"||h?await G4(n,t,c,a,Q):Q4(n,c,a))}const{id:c,routeId:u}=n.matches[a];let h=!1,p=!1;const y=n.router.looseRoutesById[u],m=y.options.loader,b=((typeof m=="function"||m==null?void 0:m.staleReloadMode)??n.router.options.defaultStaleReloadMode)!=="blocking";if(m3(n,c)){if(!n.router.getMatch(c))return n.matches[a];Q4(n,c,a)}else{const I=n.router.getMatch(c),$=((w=n.router.state.matches[a])==null?void 0:w.routeId)===u?n.router.state.matches[a].id:(N=n.router.state.matches.find(R=>R.routeId===u))==null?void 0:N.id,H=eh(n,c);if(I._nonReactive.loaderPromise){if(I.status==="success"&&!n.sync&&!I.preload&&b)return I;await I._nonReactive.loaderPromise;const R=n.router.getMatch(c),Q=R._nonReactive.error||R.error;Q&&br(n,R,Q),R.status==="pending"&&await r(H,I,$,R,y)}else{const R=H&&!n.router.state.matches.some(ce=>ce.id===c),Q=n.router.getMatch(c);Q._nonReactive.loaderPromise=$o(),R!==Q.preload&&n.updateMatch(c,ce=>({...ce,preload:R})),await r(H,I,$,Q,y)}}const g=n.router.getMatch(c);p||((T=g._nonReactive.loaderPromise)==null||T.resolve(),(C=g._nonReactive.loadPromise)==null||C.resolve(),g._nonReactive.loadPromise=void 0),clearTimeout(g._nonReactive.pendingTimeout),g._nonReactive.pendingTimeout=void 0,p||(g._nonReactive.loaderPromise=void 0),g._nonReactive.dehydrated=void 0;const x=p?g.isFetching:!1;return x!==g.isFetching||g.invalid!==!1?(n.updateMatch(c,I=>({...I,isFetching:x,invalid:!1})),n.router.getMatch(c)):g};async function V4(n){var x,w;const t=n,a=[];t.router.state.matches.some(N=>N._forcePending)&&rp(t);let r;for(let N=0;N<t.matches.length;N++){try{const T=p9(t,N);ju(T)&&await T}catch(T){if(Ms(T))throw T;if(hs(T))r=T;else if(!t.preload)throw T;break}if(t.serialError)break}const c=t.firstBadMatchIndex??t.matches.length,u=r&&!t.preload?F4(t,r):void 0,h=r&&t.preload?0:u!==void 0?Math.min(u+1,c):c;let p,y;for(let N=0;N<h;N++)a.push(y9(t,a,N));try{await Promise.all(a)}catch{const N=await Promise.allSettled(a);for(const T of N){if(T.status!=="rejected")continue;const C=T.reason;if(Ms(C))throw C;hs(C)?p??(p=C):y??(y=C)}if(y!==void 0)throw y}const m=p??(r&&!t.preload?r:void 0);let b=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!m&&r&&t.preload)return t.matches;if(m){const N=F4(t,m);Cr(N!==void 0);const T=t.matches[N],C=t.router.looseRoutesById[T.routeId],I=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!C.options.notFoundComponent&&I&&(C.options.notFoundComponent=I),m.routeId=T.routeId;const $=T.routeId===t.router.routeTree.id;t.updateMatch(T.id,H=>({...H,...$?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:m},isFetching:!1})),b=N,await wu(C,["notFoundComponent"])}else if(!t.preload){const N=t.matches[0];N.globalNotFound||(w=t.router.getMatch(N.id))!=null&&w.globalNotFound&&t.updateMatch(N.id,T=>({...T,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const N=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await wu(N,["errorComponent"])}for(let N=0;N<=b;N++){const{id:T,routeId:C}=t.matches[N],I=t.router.looseRoutesById[C];try{const $=g9(t,T,I);if($){const H=await $;t.updateMatch(T,R=>({...R,...H}))}}catch($){console.error(`Error executing head for route ${C}:`,$)}}const g=rp(t);if(ju(g)&&await g,m)throw m;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function K4(n,t){const a=t.map(r=>{var c,u;return(u=(c=n.options[r])==null?void 0:c.preload)==null?void 0:u.call(c)}).filter(Boolean);if(a.length!==0)return Promise.all(a)}function wu(n,t=wf){!n._lazyLoaded&&n._lazyPromise===void 0&&(n.lazyFn?n._lazyPromise=n.lazyFn().then(r=>{const{id:c,...u}=r.options;Object.assign(n.options,u),n._lazyLoaded=!0,n._lazyPromise=void 0}):n._lazyLoaded=!0);const a=()=>n._componentsLoaded?void 0:t===wf?(()=>{if(n._componentsPromise===void 0){const r=K4(n,wf);r?n._componentsPromise=r.then(()=>{n._componentsLoaded=!0,n._componentsPromise=void 0}):n._componentsLoaded=!0}return n._componentsPromise})():K4(n,t);return n._lazyPromise?n._lazyPromise.then(a):a()}function y3(n){var t;for(const a of wf)if((t=n.options[a])!=null&&t.preload)return!0;return!1}var wf=["component","errorComponent","pendingComponent","notFoundComponent"],wr="__TSR_index",Y4="popstate",Z4="beforeunload";function v9(n){let t=n.getLocation();const a=new Set,r=h=>{t=n.getLocation(),a.forEach(p=>p({location:t,action:h}))},c=h=>{n.notifyOnIndexChange??!0?r(h):t=n.getLocation()},u=async({task:h,navigateOpts:p,...y})=>{var g,x;if((p==null?void 0:p.ignoreBlocker)??!1){h();return}const m=((g=n.getBlockers)==null?void 0:g.call(n))??[],b=y.type==="PUSH"||y.type==="REPLACE";if(typeof document<"u"&&m.length&&b)for(const w of m){const N=zf(y.path,y.state);if(await w.blockerFn({currentLocation:t,nextLocation:N,action:y.type})){(x=n.onBlocked)==null||x.call(n);return}}h()};return{get location(){return t},get length(){return n.getLength()},subscribers:a,subscribe:h=>(a.add(h),()=>{a.delete(h)}),push:(h,p,y)=>{const m=t.state[wr];p=W4(m+1,p),u({task:()=>{n.pushState(h,p),r({type:"PUSH"})},navigateOpts:y,type:"PUSH",path:h,state:p})},replace:(h,p,y)=>{const m=t.state[wr];p=W4(m,p),u({task:()=>{n.replaceState(h,p),r({type:"REPLACE"})},navigateOpts:y,type:"REPLACE",path:h,state:p})},go:(h,p)=>{u({task:()=>{n.go(h),c({type:"GO",index:h})},navigateOpts:p,type:"GO"})},back:h=>{u({task:()=>{n.back((h==null?void 0:h.ignoreBlocker)??!1),c({type:"BACK"})},navigateOpts:h,type:"BACK"})},forward:h=>{u({task:()=>{n.forward((h==null?void 0:h.ignoreBlocker)??!1),c({type:"FORWARD"})},navigateOpts:h,type:"FORWARD"})},canGoBack:()=>t.state[wr]!==0,createHref:h=>n.createHref(h),block:h=>{var y;if(!n.setBlockers)return()=>{};const p=((y=n.getBlockers)==null?void 0:y.call(n))??[];return n.setBlockers([...p,h]),()=>{var b,g;const m=((b=n.getBlockers)==null?void 0:b.call(n))??[];(g=n.setBlockers)==null||g.call(n,m.filter(x=>x!==h))}},flush:()=>{var h;return(h=n.flush)==null?void 0:h.call(n)},destroy:()=>{var h;return(h=n.destroy)==null?void 0:h.call(n)},notify:r}}function W4(n,t){t||(t={});const a=$p();return{...t,key:a,__TSR_key:a,[wr]:n}}function _9(n){var ie,ee;const t=typeof document<"u"?window:void 0,a=t.history.pushState,r=t.history.replaceState;let c=[];const u=()=>c,h=Y=>c=Y,p=(Y=>Y),y=(()=>zf(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((ie=t.history.state)!=null&&ie.__TSR_key)&&!((ee=t.history.state)!=null&&ee.key)){const Y=$p();t.history.replaceState({[wr]:0,key:Y,__TSR_key:Y},"")}let m=y(),b,g=!1,x=!1,w=!1,N=!1;const T=()=>m;let C,I;const $=()=>{C&&(Z._ignoreSubscribers=!0,(C.isPush?t.history.pushState:t.history.replaceState)(C.state,"",C.href),Z._ignoreSubscribers=!1,C=void 0,I=void 0,b=void 0)},H=(Y,F,_e)=>{const je=p(F);I||(b=m),m=zf(F,_e),C={href:je,state:_e,isPush:(C==null?void 0:C.isPush)||Y==="push"},I||(I=Promise.resolve().then(()=>$()))},R=Y=>{m=y(),Z.notify({type:Y})},Q=async()=>{if(x){x=!1;return}const Y=y(),F=Y.state[wr]-m.state[wr],_e=F===1,je=F===-1,ae=!_e&&!je||g;g=!1;const ue=ae?"GO":je?"BACK":"FORWARD",E=ae?{type:"GO",index:F}:{type:je?"BACK":"FORWARD"};if(w)w=!1;else{const U=u();if(typeof document<"u"&&U.length){for(const te of U)if(await te.blockerFn({currentLocation:m,nextLocation:Y,action:ue})){x=!0,t.history.go(1),Z.notify(E);return}}}m=y(),Z.notify(E)},ce=Y=>{if(N){N=!1;return}let F=!1;const _e=u();if(typeof document<"u"&&_e.length)for(const je of _e){const ae=je.enableBeforeUnload??!0;if(ae===!0){F=!0;break}if(typeof ae=="function"&&ae()===!0){F=!0;break}}if(F)return Y.preventDefault(),Y.returnValue=""},Z=v9({getLocation:T,getLength:()=>t.history.length,pushState:(Y,F)=>H("push",Y,F),replaceState:(Y,F)=>H("replace",Y,F),back:Y=>(Y&&(w=!0),N=!0,t.history.back()),forward:Y=>{Y&&(w=!0),N=!0,t.history.forward()},go:Y=>{g=!0,t.history.go(Y)},createHref:Y=>p(Y),flush:$,destroy:()=>{t.history.pushState=a,t.history.replaceState=r,t.removeEventListener(Z4,ce,{capture:!0}),t.removeEventListener(Y4,Q)},onBlocked:()=>{b&&m!==b&&(m=b)},getBlockers:u,setBlockers:h,notifyOnIndexChange:!1});return t.addEventListener(Z4,ce,{capture:!0}),t.addEventListener(Y4,Q),t.history.pushState=function(...Y){const F=a.apply(t.history,Y);return Z._ignoreSubscribers||R("PUSH"),F},t.history.replaceState=function(...Y){const F=r.apply(t.history,Y);return Z._ignoreSubscribers||R("REPLACE"),F},Z}function b9(n){let t=n.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function zf(n,t){const a=b9(n),r=a.indexOf("#"),c=a.indexOf("?"),u=$p();return{href:a,pathname:a.substring(0,r>0?c>0?Math.min(r,c):r:c>0?c:a.length),hash:r>-1?a.substring(r):"",search:c>-1?a.slice(c,r===-1?void 0:r):"",state:t||{[wr]:0,key:u,__TSR_key:u}}}function $p(){return(Math.random()+1).toString(36).substring(7)}function jl(n){const t=n.resolvedLocation,a=n.location;return{fromLocation:t,toLocation:a,pathChanged:(t==null?void 0:t.pathname)!==a.pathname,hrefChanged:(t==null?void 0:t.href)!==a.href,hashChanged:(t==null?void 0:t.hash)!==a.hash}}function x9(n){const t=n.filter(a=>a.status!=="redirected");return t.length===n.length?n:t}var S9=class{constructor(n){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=t=>t(),this.update=t=>{var m;const a=this.options,r=this.basepath??(a==null?void 0:a.basepath)??"/",c=this.basepath===void 0,u=a==null?void 0:a.rewrite;if(this.options={...a,...t},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=D_(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=_9()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let b;this.resolvePathCache=Df(1e3),b=this.buildRouteTree(),this.setRoutes(b)}!this.__store&&this.latestLocation&&(this.__store=d9(w9(this.latestLocation)),U_(this));let h=!1;const p=this.options.basepath??"/",y=this.options.rewrite;if(c||r!==p||u!==y){this.basepath=p;const b=[],g=l3(p);g&&g!=="/"&&b.push(Z_({basepath:p})),y&&b.push(y),this.rewrite=b.length===0?void 0:b.length===1?b[0]:Y_(b),this.history&&this.updateLatestLocation(),h=!0}h&&this.__store&&this.__store.setState(b=>({...b,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof((m=window.CSS)==null?void 0:m.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=C_(this.routeTree,this.options.caseSensitive,(a,r)=>{a.init({originalIndex:r})});return this.options.routeMasks&&S_(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,a)=>{const r={eventType:t,fn:a};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=t=>{this.subscribers.forEach(a=>{a.eventType===t.type&&a.fn(t)})},this.parseLocation=(t,a)=>{const r=({pathname:p,search:y,hash:m,href:b,state:g})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(p)){const C=this.options.parseSearch(y),I=this.options.stringifySearch(C);return{href:p+I+m,publicHref:b,pathname:tu(p).path,external:!1,searchStr:I,search:sl(a==null?void 0:a.search,C),hash:tu(m.slice(1)).path,state:ol(a==null?void 0:a.state,g)}}const x=new URL(b,this.origin),w=sp(this.rewrite,x),N=this.options.parseSearch(w.search),T=this.options.stringifySearch(N);return w.search=T,{href:w.href.replace(w.origin,""),publicHref:b,pathname:tu(w.pathname).path,external:!!this.rewrite&&w.origin!==this.origin,searchStr:T,search:sl(a==null?void 0:a.search,N),hash:tu(w.hash.slice(1)).path,state:ol(a==null?void 0:a.state,g)}},c=r(t),{__tempLocation:u,__tempKey:h}=c.state;if(u&&(!h||h===this.tempLocationKey)){const p=r(u);return p.state.key=c.state.key,p.state.__TSR_key=c.state.__TSR_key,delete p.state.__tempLocation,{...p,maskedLocation:c}}return c},this.resolvePathWithBase=(t,a)=>A_({base:t,to:Pp(a),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,a,r)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:a},r):this.matchRoutesInternal(t,a),this.getMatchedRoutes=t=>k9({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const a=this.getMatch(t);a&&(a.abortController.abort(),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(r=>r.status==="pending"),a=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...a]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=t=>{const a=(c={})=>{var ee,Y;const u=c._fromLocation||this.pendingBuiltLocation||this.latestLocation,h=this.matchRoutesLightweight(u);c.from;const p=c.unsafeRelative==="path"?u.pathname:c.from??h.fullPath,y=this.resolvePathWithBase(p,"."),m=h.search,b=Object.assign(Object.create(null),h.params),g=c.to?this.resolvePathWithBase(y,`${c.to}`):this.resolvePathWithBase(y,"."),x=c.params===!1||c.params===null?Object.create(null):(c.params??!0)===!0?b:Object.assign(b,_r(c.params,b)),w=this.getMatchedRoutes(g);let N=w.matchedRoutes;if((!w.foundRoute||w.foundRoute.path!=="/"&&w.routeParams["**"])&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]),Object.keys(x).length>0)for(const F of N){const _e=((ee=F.options.params)==null?void 0:ee.stringify)??F.options.stringifyParams;if(_e)try{Object.assign(x,_e(x))}catch{}}const T=t.leaveParams?g:tu(U4({path:g,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=m;if(t._includeValidateSearch&&((Y=this.options.search)!=null&&Y.strict)){const F={};N.forEach(_e=>{if(_e.options.validateSearch)try{Object.assign(F,kf(_e.options.validateSearch,{...F,...C}))}catch{}}),C=F}C=N9({search:C,dest:c,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),C=sl(m,C);const I=this.options.stringifySearch(C),$=c.hash===!0?u.hash:c.hash?_r(c.hash,u.hash):void 0,H=$?`#${$}`:"";let R=c.state===!0?u.state:c.state?_r(c.state,u.state):{};R=ol(u.state,R);const Q=`${T}${I}${H}`;let ce,Z,ie=!1;if(this.rewrite){const F=new URL(Q,this.origin),_e=o3(this.rewrite,F);ce=F.href.replace(F.origin,""),_e.origin!==this.origin?(Z=_e.href,ie=!0):Z=_e.pathname+_e.search+_e.hash}else ce=__(Q),Z=ce;return{publicHref:Z,href:ce,pathname:T,search:C,searchStr:I,state:R,hash:$??"",external:ie,unmaskOnReload:c.unmaskOnReload}},r=(c={},u)=>{const h=a(c);let p=u?a(u):void 0;if(!p){const y=Object.create(null);if(this.options.routeMasks){const m=j_(h.pathname,this.processedTree);if(m){Object.assign(y,m.rawParams);const{from:b,params:g,...x}=m.route,w=g===!1||g===null?Object.create(null):(g??!0)===!0?y:Object.assign(y,_r(g,y));u={from:t.from,...x,params:w},p=a(u)}}}return p&&(h.maskedLocation=p),h};return t.mask?r(t,{from:t.from,...t.mask}):r(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:a,...r})=>{const c=()=>{const p=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];p.forEach(m=>{r.state[m]=this.latestLocation.state[m]});const y=bl(r.state,this.latestLocation.state);return p.forEach(m=>{delete r.state[m]}),y},u=jr(this.latestLocation.href)===jr(r.href);let h=this.commitLocationPromise;if(this.commitLocationPromise=$o(()=>{h==null||h.resolve(),h=void 0}),u&&c())this.load();else{let{maskedLocation:p,hashScrollIntoView:y,...m}=r;p&&(m={...p,state:{...p.state,__tempKey:void 0,__tempLocation:{...m,search:m.searchStr,state:{...m.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(m.unmaskOnReload??this.options.unmaskOnReload??!1)&&(m.state.__tempKey=this.tempLocationKey)),m.state.__hashScrollIntoViewOptions=y??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[r.replace?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:a})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:a,hashScrollIntoView:r,viewTransition:c,ignoreBlocker:u,href:h,...p}={})=>{if(h){const b=this.history.location.state.__TSR_index,g=zf(h,{__TSR_index:t?b:b+1}),x=new URL(g.pathname,this.origin);p.to=sp(this.rewrite,x).pathname,p.search=this.options.parseSearch(g.search),p.hash=g.hash.slice(1)}const y=this.buildLocation({...p,_includeValidateSearch:!0});this.pendingBuiltLocation=y;const m=this.commitLocation({...y,viewTransition:c,replace:t,resetScroll:a,hashScrollIntoView:r,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===y&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=async({to:t,reloadDocument:a,href:r,publicHref:c,...u})=>{var p,y;let h=!1;if(r)try{new URL(`${r}`),h=!0}catch{}if(h&&!a&&(a=!0),a){if(t!==void 0||!r){const b=this.buildLocation({to:t,...u});r=r??b.publicHref,c=c??b.publicHref}const m=!h&&c?c:r;if(Af(m,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const b=((y=(p=this.history).getBlockers)==null?void 0:y.call(p))??[];for(const g of b)if(g!=null&&g.blockerFn&&await g.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(m):window.location.href=m,Promise.resolve()}return this.buildAndCommitLocation({...u,href:r,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(a=>({...a,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:a.cachedMatches.filter(r=>!t.some(c=>c.id===r.id))}))},this.load=async t=>{let a,r,c;const u=this.state.resolvedLocation??this.state.location;for(c=new Promise(p=>{this.startTransition(async()=>{var y;try{this.beforeLoad();const m=this.latestLocation,b=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...jl({resolvedLocation:b,location:m})}),this.emit({type:"onBeforeLoad",...jl({resolvedLocation:b,location:m})}),await V4({router:this,sync:t==null?void 0:t.sync,forceStaleReload:u.href===m.href,matches:this.state.pendingMatches,location:m,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let g=[],x=[],w=[],N=[];vu(()=>{this.__store.setState(T=>{const C=T.matches,I=T.pendingMatches||T.matches;return g=C.filter($=>!I.some(H=>H.id===$.id)),x=C.filter($=>!I.some(H=>H.routeId===$.routeId)),w=I.filter($=>!C.some(H=>H.routeId===$.routeId)),N=I.filter($=>C.some(H=>H.routeId===$.routeId)),{...T,isLoading:!1,loadedAt:Date.now(),matches:I,pendingMatches:void 0,cachedMatches:[...T.cachedMatches,...g.filter($=>$.status!=="error"&&$.status!=="notFound"&&$.status!=="redirected")]}}),this.clearExpiredCache()}),[[x,"onLeave"],[w,"onEnter"],[N,"onStay"]].forEach(([T,C])=>{T.forEach(I=>{var $,H;(H=($=this.looseRoutesById[I.routeId].options)[C])==null||H.call($,I)})})})})}})}catch(m){Ms(m)?(a=m,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):hs(m)&&(r=m),this.__store.setState(b=>({...b,statusCode:a?a.status:r?404:b.matches.some(g=>g.status==="error")?500:200,redirect:a}))}this.latestLoadPromise===c&&((y=this.commitLocationPromise)==null||y.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),p()})}),this.latestLoadPromise=c,await c;this.latestLoadPromise&&c!==this.latestLoadPromise;)await this.latestLoadPromise;let h;this.hasNotFoundMatch()?h=404:this.__store.state.matches.some(p=>p.status==="error")&&(h=500),h!==void 0&&this.__store.setState(p=>({...p,statusCode:h}))},this.startViewTransition=t=>{const a=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,a&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof a=="object"&&this.isViewTransitionTypesSupported){const c=this.latestLocation,u=this.state.resolvedLocation,h=typeof a.types=="function"?a.types(jl({resolvedLocation:u,location:c})):a.types;if(h===!1){t();return}r={update:t,types:h}}else r=t;document.startViewTransition(r)}else t()},this.updateMatch=(t,a)=>{this.startTransition(()=>{var c;const r=(c=this.state.pendingMatches)!=null&&c.some(u=>u.id===t)?"pendingMatches":this.state.matches.some(u=>u.id===t)?"matches":this.state.cachedMatches.some(u=>u.id===t)?"cachedMatches":"";r&&(r==="cachedMatches"?this.__store.setState(u=>({...u,cachedMatches:x9(u.cachedMatches.map(h=>h.id===t?a(h):h))})):this.__store.setState(u=>{var h;return{...u,[r]:(h=u[r])==null?void 0:h.map(p=>p.id===t?a(p):p)}}))})},this.getMatch=t=>{var r;const a=c=>c.id===t;return this.state.cachedMatches.find(a)??((r=this.state.pendingMatches)==null?void 0:r.find(a))??this.state.matches.find(a)},this.invalidate=t=>{const a=r=>{var c;return((c=t==null?void 0:t.filter)==null?void 0:c.call(t,r))??!0?{...r,invalid:!0,...t!=null&&t.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r};return this.__store.setState(r=>{var c;return{...r,matches:r.matches.map(a),cachedMatches:r.cachedMatches.map(a),pendingMatches:(c=r.pendingMatches)==null?void 0:c.map(a)}}),this.shouldViewTransition=!1,this.load({sync:t==null?void 0:t.sync})},this.getParsedLocationHref=t=>t.publicHref||"/",this.resolveRedirect=t=>{const a=t.headers.get("Location");if(!t.options.href||t.options._builtLocation){const r=t.options._builtLocation??this.buildLocation(t.options),c=this.getParsedLocationHref(r);t.options.href=c,t.headers.set("Location",c)}else if(a)try{const r=new URL(a);if(this.origin&&r.origin===this.origin){const c=r.pathname+r.search+r.hash;t.options.href=c,t.headers.set("Location",c)}}catch{}if(t.options.href&&!t.options._builtLocation&&Af(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const a=t==null?void 0:t.filter;a!==void 0?this.__store.setState(r=>({...r,cachedMatches:r.cachedMatches.filter(c=>!a(c))})):this.__store.setState(r=>({...r,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=a=>{const r=this.looseRoutesById[a.routeId];if(!r.options.loader)return!0;const c=(a.preload?r.options.preloadGcTime??this.options.defaultPreloadGcTime:r.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:Date.now()-a.updatedAt>=c};this.clearCache({filter:t})},this.loadRouteChunk=wu,this.preloadRoute=async t=>{const a=t._builtLocation??this.buildLocation(t);let r=this.matchRoutes(a,{throwOnError:!0,preload:!0,dest:t});const c=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(h=>h.id)),u=new Set([...c,...this.state.cachedMatches.map(h=>h.id)]);vu(()=>{r.forEach(h=>{u.has(h.id)||this.__store.setState(p=>({...p,cachedMatches:[...p.cachedMatches,h]}))})});try{return r=await V4({router:this,matches:r,location:a,preload:!0,updateMatch:(h,p)=>{c.has(h)?r=r.map(y=>y.id===h?p(y):y):this.updateMatch(h,p)}}),r}catch(h){if(Ms(h))return h.options.reloadDocument?void 0:await this.preloadRoute({...h.options,_fromLocation:a});hs(h)||console.error(h);return}},this.matchRoute=(t,a)=>{const r={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},c=this.buildLocation(r);if(a!=null&&a.pending&&this.state.status!=="pending")return!1;const u=((a==null?void 0:a.pending)===void 0?!this.state.isLoading:a.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,h=w_(c.pathname,(a==null?void 0:a.caseSensitive)??!1,(a==null?void 0:a.fuzzy)??!1,u.pathname,this.processedTree);return!h||t.params&&!bl(h.rawParams,t.params,{partial:!0})?!1:(a==null?void 0:a.includeSearch)??!0?bl(u.search,c.search,{partial:!0})?h.rawParams:!1:h.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...n,caseSensitive:n.caseSensitive??!1,notFoundMode:n.notFoundMode??"fuzzy",stringifySearch:n.stringifySearch??Q_,parseSearch:n.parseSearch??F_,protocolAllowlist:n.protocolAllowlist??v_}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:n,routesByPath:t,processedTree:a}){this.routesById=n,this.routesByPath=t,this.processedTree=a;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(n){return n!=null&&n.id?n.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(n,t){var g,x;const a=this.getMatchedRoutes(n.pathname),{foundRoute:r,routeParams:c,parsedParams:u}=a;let{matchedRoutes:h}=a,p=!1;(r?r.path!=="/"&&c["**"]:jr(n.pathname))&&(this.options.notFoundRoute?h=[...h,this.options.notFoundRoute]:p=!0);const y=p?T9(this.options.notFoundMode,h):void 0,m=new Array(h.length),b=new Map(this.state.matches.map(w=>[w.routeId,w]));for(let w=0;w<h.length;w++){const N=h[w],T=m[w-1];let C,I,$;{const ue=(T==null?void 0:T.search)??n.search,E=(T==null?void 0:T._strictSearch)??void 0;try{const U=kf(N.options.validateSearch,{...ue})??void 0;C={...ue,...U},I={...E,...U},$=void 0}catch(U){let te=U;if(U instanceof Bf||(te=new Bf(U.message,{cause:U})),t!=null&&t.throwOnError)throw te;C=ue,I={},$=te}}const H=((x=(g=N.options).loaderDeps)==null?void 0:x.call(g,{search:C}))??"",R=H?JSON.stringify(H):"",{interpolatedPath:Q,usedParams:ce}=U4({path:N.fullPath,params:c,decoder:this.pathParamsDecoder,server:this.isServer}),Z=N.id+Q+R,ie=this.getMatch(Z),ee=b.get(N.id),Y=(ie==null?void 0:ie._strictParams)??ce;let F;if(!ie)try{X4(N,ce,u,Y)}catch(ue){if(hs(ue)||Ms(ue)?F=ue:F=new j9(ue.message,{cause:ue}),t!=null&&t.throwOnError)throw F}Object.assign(c,Y);const _e=ee?"stay":"enter";let je;if(ie)je={...ie,cause:_e,params:(ee==null?void 0:ee.params)??c,_strictParams:Y,search:sl(ee?ee.search:ie.search,C),_strictSearch:I};else{const ue=N.options.loader||N.options.beforeLoad||N.lazyFn||y3(N)?"pending":"success";je={id:Z,ssr:N.options.ssr,index:w,routeId:N.id,params:(ee==null?void 0:ee.params)??c,_strictParams:Y,pathname:Q,updatedAt:Date.now(),search:ee?sl(ee.search,C):C,_strictSearch:I,searchError:void 0,status:ue,isFetching:!1,error:void 0,paramsError:F,__routeContext:void 0,_nonReactive:{loadPromise:$o()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:_e,loaderDeps:ee?ol(ee.loaderDeps,H):H,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:N.options.staticData||{},fullPath:N.fullPath}}t!=null&&t.preload||(je.globalNotFound=y===N.id),je.searchError=$;const ae=this.getParentContext(T);je.context={...ae,...je.__routeContext,...je.__beforeLoadContext},m[w]=je}for(let w=0;w<m.length;w++){const N=m[w],T=this.looseRoutesById[N.routeId],C=this.getMatch(N.id),I=b.get(N.routeId);if(N.params=I?sl(I.params,c):c,!C){const $=m[w-1],H=this.getParentContext($);if(T.options.context){const R={deps:N.loaderDeps,params:N.params,context:H??{},location:n,navigate:Q=>this.navigate({...Q,_fromLocation:n}),buildLocation:this.buildLocation,cause:N.cause,abortController:N.abortController,preload:!!N.preload,matches:m,routeId:T.id};N.__routeContext=T.options.context(R)??void 0}N.context={...H,...N.__routeContext,...N.__beforeLoadContext}}}return m}matchRoutesLightweight(n){const{matchedRoutes:t,routeParams:a,parsedParams:r}=this.getMatchedRoutes(n.pathname),c=Su(t),u={...n.search};for(const m of t)try{Object.assign(u,kf(m.options.validateSearch,u))}catch{}const h=Su(this.state.matches),p=h&&h.routeId===c.id&&n.pathname===this.state.location.pathname;let y;if(p)y=h.params;else{const m=Object.assign(Object.create(null),a);for(const b of t)try{X4(b,a,r??{},m)}catch{}y=m}return{matchedRoutes:t,fullPath:c.fullPath,search:u,params:y}}},Bf=class extends Error{},j9=class extends Error{};function w9(n){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:n,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function kf(n,t){if(n==null)return{};if("~standard"in n){const a=n["~standard"].validate(t);if(a instanceof Promise)throw new Bf("Async validation not supported");if(a.issues)throw new Bf(JSON.stringify(a.issues,void 0,2),{cause:a});return a.value}return"parse"in n?n.parse(t):typeof n=="function"?n(t):{}}function k9({pathname:n,routesById:t,processedTree:a}){const r=Object.create(null),c=jr(n);let u,h;const p=k_(c,a,!0);return p&&(u=p.route,Object.assign(r,p.rawParams),h=Object.assign(Object.create(null),p.parsedParams)),{matchedRoutes:(p==null?void 0:p.branch)||[t.__root__],routeParams:r,foundRoute:u,parsedParams:h}}function N9({search:n,dest:t,destRoutes:a,_includeValidateSearch:r}){return C9(a)(n,t,r??!1)}function C9(n){var c;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const u of n){if("search"in u.options)(c=u.options.search)!=null&&c.middlewares&&t.middlewares.push(...u.options.search.middlewares);else if(u.options.preSearchFilters||u.options.postSearchFilters){const h=({search:p,next:y})=>{let m=p;"preSearchFilters"in u.options&&u.options.preSearchFilters&&(m=u.options.preSearchFilters.reduce((g,x)=>x(g),p));const b=y(m);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((g,x)=>x(g),b):b};t.middlewares.push(h)}if(u.options.validateSearch){const h=({search:p,next:y})=>{const m=y(p);if(!t._includeValidateSearch)return m;try{return{...m,...kf(u.options.validateSearch,m)??void 0}}catch{return m}};t.middlewares.push(h)}}const a=({search:u})=>{const h=t.dest;return h.search?h.search===!0?u:_r(h.search,u):{}};t.middlewares.push(a);const r=(u,h,p)=>{if(u>=p.length)return h;const y=p[u];return y({search:h,next:b=>r(u+1,b,p)})};return function(h,p,y){return t.dest=p,t._includeValidateSearch=y,r(0,h,t.middlewares)}}function T9(n,t){if(n!=="root")for(let a=t.length-1;a>=0;a--){const r=t[a];if(r.children)return r.id}return xl}function X4(n,t,a,r){var u;const c=((u=n.options.params)==null?void 0:u.parse)??n.options.parseParams;if(c)if(n.options.skipRouteOnParseError)for(const h in t)h in a&&(r[h]=a[h]);else{const h=c(r);Object.assign(r,h)}}var E9="Error preloading route! ☝️",v3=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(n){if(this.init=t=>{var y,m;this.originalIndex=t.originalIndex;const a=this.options,r=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(m=(y=this.options).getParentRoute)==null?void 0:m.call(y),r?this._path=xl:this.parentRoute||Cr(!1);let c=r?xl:a==null?void 0:a.path;c&&c!=="/"&&(c=r3(c));const u=(a==null?void 0:a.id)||c;let h=r?xl:Sf([this.parentRoute.id==="__root__"?"":this.parentRoute.id,u]);c==="__root__"&&(c="/"),h!=="__root__"&&(h=Sf(["/",h]));const p=h==="__root__"?"/":Sf([this.parentRoute.fullPath,c]);this._path=c,this._id=h,this._fullPath=p,this._to=jr(p)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>K_({from:this.fullPath,...t}),this.options=n||{},this.isRoot=!(n!=null&&n.getParentRoute),n!=null&&n.id&&(n!=null&&n.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},M9=class extends v3{constructor(n){super(n)}};function Hp(n){const t=n.errorComponent??Fp;return l.jsx(R9,{getResetKey:n.getResetKey,onCatch:n.onCatch,children:({error:a,reset:r})=>a?_.createElement(t,{error:a,reset:r}):n.children})}var R9=class extends _.Component{constructor(...n){super(...n),this.state={error:null}}static getDerivedStateFromProps(n){return{resetKey:n.getResetKey()}}static getDerivedStateFromError(n){return{error:n}}reset(){this.setState({error:null})}componentDidUpdate(n,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(n,t){this.props.onCatch&&this.props.onCatch(n,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function Fp({error:n}){const[t,a]=_.useState(!1);return l.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[l.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),l.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>a(r=>!r),children:t?"Hide Error":"Show Error"})]}),l.jsx("div",{style:{height:".25rem"}}),t?l.jsx("div",{children:l.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:n.message?l.jsx("code",{children:n.message}):null})}):null]})}function A9({children:n,fallback:t=null}){return _3()?l.jsx(Si.Fragment,{children:n}):l.jsx(Si.Fragment,{children:t})}function _3(){return Si.useSyncExternalStore(D9,()=>!0,()=>!1)}function D9(){return()=>{}}var b3=_.createContext(null);function ia(n){const t=_.useContext(b3);return n==null||n.warn,t}var _1={exports:{}},b1={},x1={exports:{}},S1={};/**
50
+ `).replace(R5,"")}function Dg(e,s){return s=Ag(s),Ag(e)===s}function Jt(e,s,i,o,d,f){switch(i){case"children":typeof o=="string"?s==="body"||s==="textarea"&&o===""||ca(e,o):(typeof o=="number"||typeof o=="bigint")&&s!=="body"&&ca(e,""+o);break;case"className":Rl(e,"class",o);break;case"tabIndex":Rl(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Rl(e,i,o);break;case"style":Ar(e,o,f);break;case"data":if(s!=="object"){Rl(e,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||i!=="href")){e.removeAttribute(i);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=ua(""+o),e.setAttribute(i,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(i,"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 f=="function"&&(i==="formAction"?(s!=="input"&&Jt(e,s,"name",d.name,d,null),Jt(e,s,"formEncType",d.formEncType,d,null),Jt(e,s,"formMethod",d.formMethod,d,null),Jt(e,s,"formTarget",d.formTarget,d,null)):(Jt(e,s,"encType",d.encType,d,null),Jt(e,s,"method",d.method,d,null),Jt(e,s,"target",d.target,d,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(i);break}o=ua(""+o),e.setAttribute(i,o);break;case"onClick":o!=null&&(e.onclick=Ks);break;case"onScroll":o!=null&&Tt("scroll",e);break;case"onScrollEnd":o!=null&&Tt("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}i=ua(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""+o):e.removeAttribute(i);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":o===!0?e.setAttribute(i,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(i,o):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(i,o):e.removeAttribute(i);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(i):e.setAttribute(i,o);break;case"popover":Tt("beforetoggle",e),Tt("toggle",e),Sa(e,"popover",o);break;case"xlinkActuate":oa(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":oa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":oa(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":oa(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":oa(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":oa(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":oa(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":oa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":oa(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Sa(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=ka.get(i)||i,Sa(e,i,o))}}function $m(e,s,i,o,d,f){switch(i){case"style":Ar(e,o,f);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(i=o.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof o=="string"?ca(e,o):(typeof o=="number"||typeof o=="bigint")&&ca(e,""+o);break;case"onScroll":o!=null&&Tt("scroll",e);break;case"onScrollEnd":o!=null&&Tt("scrollend",e);break;case"onClick":o!=null&&(e.onclick=Ks);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gn.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(d=i.endsWith("Capture"),s=i.slice(2,d?i.length-7:void 0),f=e[we]||null,f=f!=null?f[i]:null,typeof f=="function"&&e.removeEventListener(s,f,d),typeof o=="function")){typeof f!="function"&&f!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(s,o,d);break e}i in e?e[i]=o:o===!0?e.setAttribute(i,""):Sa(e,i,o)}}}function Wn(e,s,i){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",e),Tt("load",e);var o=!1,d=!1,f;for(f in i)if(i.hasOwnProperty(f)){var v=i[f];if(v!=null)switch(f){case"src":o=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Jt(e,s,f,v,i,null)}}d&&Jt(e,s,"srcSet",i.srcSet,i,null),o&&Jt(e,s,"src",i.src,i,null);return;case"input":Tt("invalid",e);var k=f=v=d=null,O=null,J=null;for(o in i)if(i.hasOwnProperty(o)){var fe=i[o];if(fe!=null)switch(o){case"name":d=fe;break;case"type":v=fe;break;case"checked":O=fe;break;case"defaultChecked":J=fe;break;case"value":f=fe;break;case"defaultValue":k=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,s));break;default:Jt(e,s,o,fe,i,null)}}Va(e,f,k,O,J,v,d,!1);return;case"select":Tt("invalid",e),o=v=f=null;for(d in i)if(i.hasOwnProperty(d)&&(k=i[d],k!=null))switch(d){case"value":f=k;break;case"defaultValue":v=k;break;case"multiple":o=k;default:Jt(e,s,d,k,i,null)}s=f,i=v,e.multiple=!!o,s!=null?Rs(e,!!o,s,!1):i!=null&&Rs(e,!!o,i,!0);return;case"textarea":Tt("invalid",e),f=d=o=null;for(v in i)if(i.hasOwnProperty(v)&&(k=i[v],k!=null))switch(v){case"value":o=k;break;case"defaultValue":d=k;break;case"children":f=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:Jt(e,s,v,k,i,null)}Al(e,o,d,f);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(o=i[O],o!=null))switch(O){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Jt(e,s,O,o,i,null)}return;case"dialog":Tt("beforetoggle",e),Tt("toggle",e),Tt("cancel",e),Tt("close",e);break;case"iframe":case"object":Tt("load",e);break;case"video":case"audio":for(o=0;o<Fc.length;o++)Tt(Fc[o],e);break;case"image":Tt("error",e),Tt("load",e);break;case"details":Tt("toggle",e);break;case"embed":case"source":case"link":Tt("error",e),Tt("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 i)if(i.hasOwnProperty(J)&&(o=i[J],o!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Jt(e,s,J,o,i,null)}return;default:if(Dl(s)){for(fe in i)i.hasOwnProperty(fe)&&(o=i[fe],o!==void 0&&$m(e,s,fe,o,i,void 0));return}}for(k in i)i.hasOwnProperty(k)&&(o=i[k],o!=null&&Jt(e,s,k,o,i,null))}function A5(e,s,i,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,f=null,v=null,k=null,O=null,J=null,fe=null;for(re in i){var ve=i[re];if(i.hasOwnProperty(re)&&ve!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":O=ve;default:o.hasOwnProperty(re)||Jt(e,s,re,null,o,ve)}}for(var se in o){var re=o[se];if(ve=i[se],o.hasOwnProperty(se)&&(re!=null||ve!=null))switch(se){case"type":f=re;break;case"name":d=re;break;case"checked":J=re;break;case"defaultChecked":fe=re;break;case"value":v=re;break;case"defaultValue":k=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,s));break;default:re!==ve&&Jt(e,s,se,re,o,ve)}}Jo(e,v,k,O,J,fe,f,d);return;case"select":re=v=k=se=null;for(f in i)if(O=i[f],i.hasOwnProperty(f)&&O!=null)switch(f){case"value":break;case"multiple":re=O;default:o.hasOwnProperty(f)||Jt(e,s,f,null,o,O)}for(d in o)if(f=o[d],O=i[d],o.hasOwnProperty(d)&&(f!=null||O!=null))switch(d){case"value":se=f;break;case"defaultValue":k=f;break;case"multiple":v=f;default:f!==O&&Jt(e,s,d,f,o,O)}s=k,i=v,o=re,se!=null?Rs(e,!!i,se,!1):!!o!=!!i&&(s!=null?Rs(e,!!i,s,!0):Rs(e,!!i,i?[]:"",!1));return;case"textarea":re=se=null;for(k in i)if(d=i[k],i.hasOwnProperty(k)&&d!=null&&!o.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:Jt(e,s,k,null,o,d)}for(v in o)if(d=o[v],f=i[v],o.hasOwnProperty(v)&&(d!=null||f!=null))switch(v){case"value":se=d;break;case"defaultValue":re=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==f&&Jt(e,s,v,d,o,f)}vs(e,se,re);return;case"option":for(var Fe in i)if(se=i[Fe],i.hasOwnProperty(Fe)&&se!=null&&!o.hasOwnProperty(Fe))switch(Fe){case"selected":e.selected=!1;break;default:Jt(e,s,Fe,null,o,se)}for(O in o)if(se=o[O],re=i[O],o.hasOwnProperty(O)&&se!==re&&(se!=null||re!=null))switch(O){case"selected":e.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Jt(e,s,O,se,o,re)}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 lt in i)se=i[lt],i.hasOwnProperty(lt)&&se!=null&&!o.hasOwnProperty(lt)&&Jt(e,s,lt,null,o,se);for(J in o)if(se=o[J],re=i[J],o.hasOwnProperty(J)&&se!==re&&(se!=null||re!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,s));break;default:Jt(e,s,J,se,o,re)}return;default:if(Dl(s)){for(var en in i)se=i[en],i.hasOwnProperty(en)&&se!==void 0&&!o.hasOwnProperty(en)&&$m(e,s,en,void 0,o,se);for(fe in o)se=o[fe],re=i[fe],!o.hasOwnProperty(fe)||se===re||se===void 0&&re===void 0||$m(e,s,fe,se,o,re);return}}for(var G in i)se=i[G],i.hasOwnProperty(G)&&se!=null&&!o.hasOwnProperty(G)&&Jt(e,s,G,null,o,se);for(ve in o)se=o[ve],re=i[ve],!o.hasOwnProperty(ve)||se===re||se==null&&re==null||Jt(e,s,ve,se,o,re)}function Og(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function D5(){if(typeof performance.getEntriesByType=="function"){for(var e=0,s=0,i=performance.getEntriesByType("resource"),o=0;o<i.length;o++){var d=i[o],f=d.transferSize,v=d.initiatorType,k=d.duration;if(f&&k&&Og(v)){for(v=0,k=d.responseEnd,o+=1;o<i.length;o++){var O=i[o],J=O.startTime;if(J>k)break;var fe=O.transferSize,ve=O.initiatorType;fe&&Og(ve)&&(O=O.responseEnd,v+=fe*(O<k?1:(k-J)/(O-J)))}if(--o,s+=8*(f+v)/(d.duration/1e3),e++,10<e)break}}if(0<e)return s/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Hm=null,Fm=null;function Zd(e){return e.nodeType===9?e:e.ownerDocument}function Lg(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 Ig(e,s){if(e===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&s==="foreignObject"?0:e}function Qm(e,s){return e==="textarea"||e==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Gm=null;function O5(){var e=window.event;return e&&e.type==="popstate"?e===Gm?!1:(Gm=e,!0):(Gm=null,!1)}var zg=typeof setTimeout=="function"?setTimeout:void 0,L5=typeof clearTimeout=="function"?clearTimeout:void 0,Bg=typeof Promise=="function"?Promise:void 0,I5=typeof queueMicrotask=="function"?queueMicrotask:typeof Bg<"u"?function(e){return Bg.resolve(null).then(e).catch(z5)}:zg;function z5(e){setTimeout(function(){throw e})}function Zi(e){return e==="head"}function Pg(e,s){var i=s,o=0;do{var d=i.nextSibling;if(e.removeChild(i),d&&d.nodeType===8)if(i=d.data,i==="/$"||i==="/&"){if(o===0){e.removeChild(d),bo(s);return}o--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")o++;else if(i==="html")Gc(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Gc(i);for(var f=i.firstChild;f;){var v=f.nextSibling,k=f.nodeName;f[es]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&f.rel.toLowerCase()==="stylesheet"||i.removeChild(f),f=v}}else i==="body"&&Gc(e.ownerDocument.body);i=d}while(i);bo(s)}function Ug(e,s){var i=e;e=0;do{var o=i.nextSibling;if(i.nodeType===1?s?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(s?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),o&&o.nodeType===8)if(i=o.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=o}while(i)}function Vm(e){var s=e.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var i=s;switch(s=s.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Vm(i),Ht(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function B5(e,s,i,o){for(;e.nodeType===1;){var d=i;if(e.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[es])switch(s){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(s==="input"&&e.type==="hidden"){var f=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ea(e.nextSibling),e===null)break}return null}function P5(e,s,i){if(s==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=ea(e.nextSibling),e===null))return null;return e}function qg(e,s){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=ea(e.nextSibling),e===null))return null;return e}function Km(e){return e.data==="$?"||e.data==="$~"}function Ym(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function U5(e,s){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=s;else if(e.data!=="$?"||i.readyState!=="loading")s();else{var o=function(){s(),i.removeEventListener("DOMContentLoaded",o)};i.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function ea(e){for(;e!=null;e=e.nextSibling){var s=e.nodeType;if(s===1||s===3)break;if(s===8){if(s=e.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return e}var Zm=null;function $g(e){e=e.nextSibling;for(var s=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(s===0)return ea(e.nextSibling);s--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||s++}e=e.nextSibling}return null}function Hg(e){e=e.previousSibling;for(var s=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(s===0)return e;s--}else i!=="/$"&&i!=="/&"||s++}e=e.previousSibling}return null}function Fg(e,s,i){switch(s=Zd(i),e){case"html":if(e=s.documentElement,!e)throw Error(r(452));return e;case"head":if(e=s.head,!e)throw Error(r(453));return e;case"body":if(e=s.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Gc(e){for(var s=e.attributes;s.length;)e.removeAttributeNode(s[0]);Ht(e)}var ta=new Map,Qg=new Set;function Wd(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var di=U.d;U.d={f:q5,r:$5,D:H5,C:F5,L:Q5,m:G5,X:K5,S:V5,M:Y5};function q5(){var e=di.f(),s=$d();return e||s}function $5(e){var s=kn(e);s!==null&&s.tag===5&&s.type==="form"?o8(s):di.r(e)}var yo=typeof document>"u"?null:document;function Gg(e,s,i){var o=yo;if(o&&typeof s=="string"&&s){var d=ts(s);d='link[rel="'+e+'"][href="'+d+'"]',typeof i=="string"&&(d+='[crossorigin="'+i+'"]'),Qg.has(d)||(Qg.add(d),e={rel:e,crossOrigin:i,href:s},o.querySelector(d)===null&&(s=o.createElement("link"),Wn(s,"link",e),B(s),o.head.appendChild(s)))}}function H5(e){di.D(e),Gg("dns-prefetch",e,null)}function F5(e,s){di.C(e,s),Gg("preconnect",e,s)}function Q5(e,s,i){di.L(e,s,i);var o=yo;if(o&&e&&s){var d='link[rel="preload"][as="'+ts(s)+'"]';s==="image"&&i&&i.imageSrcSet?(d+='[imagesrcset="'+ts(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(d+='[imagesizes="'+ts(i.imageSizes)+'"]')):d+='[href="'+ts(e)+'"]';var f=d;switch(s){case"style":f=vo(e);break;case"script":f=_o(e)}ta.has(f)||(e=g({rel:"preload",href:s==="image"&&i&&i.imageSrcSet?void 0:e,as:s},i),ta.set(f,e),o.querySelector(d)!==null||s==="style"&&o.querySelector(Vc(f))||s==="script"&&o.querySelector(Kc(f))||(s=o.createElement("link"),Wn(s,"link",e),B(s),o.head.appendChild(s)))}}function G5(e,s){di.m(e,s);var i=yo;if(i&&e){var o=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+ts(o)+'"][href="'+ts(e)+'"]',f=d;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=_o(e)}if(!ta.has(f)&&(e=g({rel:"modulepreload",href:e},s),ta.set(f,e),i.querySelector(d)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Kc(f)))return}o=i.createElement("link"),Wn(o,"link",e),B(o),i.head.appendChild(o)}}}function V5(e,s,i){di.S(e,s,i);var o=yo;if(o&&e){var d=un(o).hoistableStyles,f=vo(e);s=s||"default";var v=d.get(f);if(!v){var k={loading:0,preload:null};if(v=o.querySelector(Vc(f)))k.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":s},i),(i=ta.get(f))&&Wm(e,i);var O=v=o.createElement("link");B(O),Wn(O,"link",e),O._p=new Promise(function(J,fe){O.onload=J,O.onerror=fe}),O.addEventListener("load",function(){k.loading|=1}),O.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Xd(v,s,o)}v={type:"stylesheet",instance:v,count:1,state:k},d.set(f,v)}}}function K5(e,s){di.X(e,s);var i=yo;if(i&&e){var o=un(i).hoistableScripts,d=_o(e),f=o.get(d);f||(f=i.querySelector(Kc(d)),f||(e=g({src:e,async:!0},s),(s=ta.get(d))&&Xm(e,s),f=i.createElement("script"),B(f),Wn(f,"link",e),i.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(d,f))}}function Y5(e,s){di.M(e,s);var i=yo;if(i&&e){var o=un(i).hoistableScripts,d=_o(e),f=o.get(d);f||(f=i.querySelector(Kc(d)),f||(e=g({src:e,async:!0,type:"module"},s),(s=ta.get(d))&&Xm(e,s),f=i.createElement("script"),B(f),Wn(f,"link",e),i.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(d,f))}}function Vg(e,s,i,o){var d=(d=Ce.current)?Wd(d):null;if(!d)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(s=vo(i.href),i=un(d).hoistableStyles,o=i.get(s),o||(o={type:"style",instance:null,count:0,state:null},i.set(s,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=vo(i.href);var f=un(d).hoistableStyles,v=f.get(e);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,v),(f=d.querySelector(Vc(e)))&&!f._p&&(v.instance=f,v.state.loading=5),ta.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ta.set(e,i),f||Z5(d,e,i,v.state))),s&&o===null)throw Error(r(528,""));return v}if(s&&o!==null)throw Error(r(529,""));return null;case"script":return s=i.async,i=i.src,typeof i=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=_o(i),i=un(d).hoistableScripts,o=i.get(s),o||(o={type:"script",instance:null,count:0,state:null},i.set(s,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function vo(e){return'href="'+ts(e)+'"'}function Vc(e){return'link[rel="stylesheet"]['+e+"]"}function Kg(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function Z5(e,s,i,o){e.querySelector('link[rel="preload"][as="style"]['+s+"]")?o.loading=1:(s=e.createElement("link"),o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2}),Wn(s,"link",i),B(s),e.head.appendChild(s))}function _o(e){return'[src="'+ts(e)+'"]'}function Kc(e){return"script[async]"+e}function Yg(e,s,i){if(s.count++,s.instance===null)switch(s.type){case"style":var o=e.querySelector('style[data-href~="'+ts(i.href)+'"]');if(o)return s.instance=o,B(o),o;var d=g({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),B(o),Wn(o,"style",d),Xd(o,i.precedence,e),s.instance=o;case"stylesheet":d=vo(i.href);var f=e.querySelector(Vc(d));if(f)return s.state.loading|=4,s.instance=f,B(f),f;o=Kg(i),(d=ta.get(d))&&Wm(o,d),f=(e.ownerDocument||e).createElement("link"),B(f);var v=f;return v._p=new Promise(function(k,O){v.onload=k,v.onerror=O}),Wn(f,"link",o),s.state.loading|=4,Xd(f,i.precedence,e),s.instance=f;case"script":return f=_o(i.src),(d=e.querySelector(Kc(f)))?(s.instance=d,B(d),d):(o=i,(d=ta.get(f))&&(o=g({},i),Xm(o,d)),e=e.ownerDocument||e,d=e.createElement("script"),B(d),Wn(d,"link",o),e.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Xd(o,i.precedence,e));return s.instance}function Xd(e,s,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=o.length?o[o.length-1]:null,f=d,v=0;v<o.length;v++){var k=o[v];if(k.dataset.precedence===s)f=k;else if(f!==d)break}f?f.parentNode.insertBefore(e,f.nextSibling):(s=i.nodeType===9?i.head:i,s.insertBefore(e,s.firstChild))}function Wm(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.title==null&&(e.title=s.title)}function Xm(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.integrity==null&&(e.integrity=s.integrity)}var Jd=null;function Zg(e,s,i){if(Jd===null){var o=new Map,d=Jd=new Map;d.set(i,o)}else d=Jd,o=d.get(i),o||(o=new Map,d.set(i,o));if(o.has(e))return o;for(o.set(e,null),i=i.getElementsByTagName(e),d=0;d<i.length;d++){var f=i[d];if(!(f[es]||f[ge]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(s)||"";v=e+v;var k=o.get(v);k?k.push(f):o.set(v,[f])}}return o}function Wg(e,s,i){e=e.ownerDocument||e,e.head.insertBefore(i,s==="title"?e.querySelector("head > title"):null)}function W5(e,s,i){if(i===1||s.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return e=s.disabled,typeof s.precedence=="string"&&e==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Xg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function X5(e,s,i,o){if(i.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var d=vo(o.href),f=s.querySelector(Vc(d));if(f){s=f._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(e.count++,e=ef.bind(e),s.then(e,e)),i.state.loading|=4,i.instance=f,B(f);return}f=s.ownerDocument||s,o=Kg(o),(d=ta.get(d))&&Wm(o,d),f=f.createElement("link"),B(f);var v=f;v._p=new Promise(function(k,O){v.onload=k,v.onerror=O}),Wn(f,"link",o),i.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,s),(s=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=ef.bind(e),s.addEventListener("load",i),s.addEventListener("error",i))}}var Jm=0;function J5(e,s){return e.stylesheets&&e.count===0&&nf(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var o=setTimeout(function(){if(e.stylesheets&&nf(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+s);0<e.imgBytes&&Jm===0&&(Jm=62500*D5());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&nf(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Jm?50:800)+s);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(d)}}:null}function ef(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tf=null;function nf(e,s){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tf=new Map,s.forEach(ev,e),tf=null,ef.call(e))}function ev(e,s){if(!(s.state.loading&4)){var i=tf.get(e);if(i)var o=i.get(null);else{i=new Map,tf.set(e,i);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<d.length;f++){var v=d[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(i.set(v.dataset.precedence,v),o=v)}o&&i.set(null,o)}d=s.instance,v=d.getAttribute("data-precedence"),f=i.get(v)||o,f===o&&i.set(null,d),i.set(v,d),this.count++,o=ef.bind(this),d.addEventListener("load",o),d.addEventListener("error",o),f?f.parentNode.insertBefore(d,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),s.state.loading|=4}}var Yc={$$typeof:H,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function tv(e,s,i,o,d,f,v,k,O){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=gs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gs(0),this.hiddenUpdates=gs(null),this.identifierPrefix=o,this.onUncaughtError=d,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Jg(e,s,i,o,d,f,v,k,O,J,fe,ve){return e=new tv(e,s,i,v,O,J,fe,ve,k),s=1,f===!0&&(s|=24),f=ns(3,null,null,s),e.current=f,f.stateNode=e,s=Ah(),s.refCount++,e.pooledCache=s,s.refCount++,f.memoizedState={element:o,isDehydrated:i,cache:s},Ih(f),e}function e4(e){return e?(e=Xa,e):Xa}function t4(e,s,i,o,d,f){d=e4(d),o.context===null?o.context=d:o.pendingContext=d,o=Pi(s),o.payload={element:i},f=f===void 0?null:f,f!==null&&(o.callback=f),i=Ui(e,o,s),i!==null&&(ks(i,e,s),Cc(i,e,s))}function n4(e,s){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<s?i:s}}function e1(e,s){n4(e,s),(e=e.alternate)&&n4(e,s)}function s4(e){if(e.tag===13||e.tag===31){var s=Oa(e,67108864);s!==null&&ks(s,e,67108864),e1(e,67108864)}}function a4(e){if(e.tag===13||e.tag===31){var s=Fs();s=xa(s);var i=Oa(e,s);i!==null&&ks(i,e,s),e1(e,s)}}var sf=!0;function nv(e,s,i,o){var d=E.T;E.T=null;var f=U.p;try{U.p=2,t1(e,s,i,o)}finally{U.p=f,E.T=d}}function sv(e,s,i,o){var d=E.T;E.T=null;var f=U.p;try{U.p=8,t1(e,s,i,o)}finally{U.p=f,E.T=d}}function t1(e,s,i,o){if(sf){var d=n1(o);if(d===null)qm(e,s,o,af,i),r4(e,o);else if(iv(d,e,s,i,o))o.stopPropagation();else if(r4(e,o),s&4&&-1<av.indexOf(e)){for(;d!==null;){var f=kn(d);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=at(f.pendingLanes);if(v!==0){var k=f;for(k.pendingLanes|=2,k.entangledLanes|=2;v;){var O=1<<31-De(v);k.entanglements[1]|=O,v&=~O}za(f),(Pt&6)===0&&(Ud=Re()+500,Hc(0))}}break;case 31:case 13:k=Oa(f,2),k!==null&&ks(k,f,2),$d(),e1(f,2)}if(f=n1(o),f===null&&qm(e,s,o,af,i),f===d)break;d=f}d!==null&&o.stopPropagation()}else qm(e,s,o,null,i)}}function n1(e){return e=fn(e),s1(e)}var af=null;function s1(e){if(af=null,e=wn(e),e!==null){var s=u(e);if(s===null)e=null;else{var i=s.tag;if(i===13){if(e=h(s),e!==null)return e;e=null}else if(i===31){if(e=p(s),e!==null)return e;e=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;e=null}else s!==e&&(e=null)}}return af=e,null}function i4(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 Ke:return 2;case mt:return 8;case kt:case rn:return 32;case Pn:return 268435456;default:return 32}default:return 32}}var a1=!1,Wi=null,Xi=null,Ji=null,Zc=new Map,Wc=new Map,er=[],av="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 r4(e,s){switch(e){case"focusin":case"focusout":Wi=null;break;case"dragenter":case"dragleave":Xi=null;break;case"mouseover":case"mouseout":Ji=null;break;case"pointerover":case"pointerout":Zc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wc.delete(s.pointerId)}}function Xc(e,s,i,o,d,f){return e===null||e.nativeEvent!==f?(e={blockedOn:s,domEventName:i,eventSystemFlags:o,nativeEvent:f,targetContainers:[d]},s!==null&&(s=kn(s),s!==null&&s4(s)),e):(e.eventSystemFlags|=o,s=e.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),e)}function iv(e,s,i,o,d){switch(s){case"focusin":return Wi=Xc(Wi,e,s,i,o,d),!0;case"dragenter":return Xi=Xc(Xi,e,s,i,o,d),!0;case"mouseover":return Ji=Xc(Ji,e,s,i,o,d),!0;case"pointerover":var f=d.pointerId;return Zc.set(f,Xc(Zc.get(f)||null,e,s,i,o,d)),!0;case"gotpointercapture":return f=d.pointerId,Wc.set(f,Xc(Wc.get(f)||null,e,s,i,o,d)),!0}return!1}function l4(e){var s=wn(e.target);if(s!==null){var i=u(s);if(i!==null){if(s=i.tag,s===13){if(s=h(i),s!==null){e.blockedOn=s,j(e.priority,function(){a4(i)});return}}else if(s===31){if(s=p(i),s!==null){e.blockedOn=s,j(e.priority,function(){a4(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function rf(e){if(e.blockedOn!==null)return!1;for(var s=e.targetContainers;0<s.length;){var i=n1(e.nativeEvent);if(i===null){i=e.nativeEvent;var o=new i.constructor(i.type,i);As=o,i.target.dispatchEvent(o),As=null}else return s=kn(i),s!==null&&s4(s),e.blockedOn=i,!1;s.shift()}return!0}function o4(e,s,i){rf(e)&&i.delete(s)}function rv(){a1=!1,Wi!==null&&rf(Wi)&&(Wi=null),Xi!==null&&rf(Xi)&&(Xi=null),Ji!==null&&rf(Ji)&&(Ji=null),Zc.forEach(o4),Wc.forEach(o4)}function lf(e,s){e.blockedOn===s&&(e.blockedOn=null,a1||(a1=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,rv)))}var of=null;function c4(e){of!==e&&(of=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){of===e&&(of=null);for(var s=0;s<e.length;s+=3){var i=e[s],o=e[s+1],d=e[s+2];if(typeof o!="function"){if(s1(o||i)===null)continue;break}var f=kn(i);f!==null&&(e.splice(s,3),s-=3,nm(f,{pending:!0,data:d,method:i.method,action:o},o,d))}}))}function bo(e){function s(O){return lf(O,e)}Wi!==null&&lf(Wi,e),Xi!==null&&lf(Xi,e),Ji!==null&&lf(Ji,e),Zc.forEach(s),Wc.forEach(s);for(var i=0;i<er.length;i++){var o=er[i];o.blockedOn===e&&(o.blockedOn=null)}for(;0<er.length&&(i=er[0],i.blockedOn===null);)l4(i),i.blockedOn===null&&er.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(o=0;o<i.length;o+=3){var d=i[o],f=i[o+1],v=d[we]||null;if(typeof f=="function")v||c4(i);else if(v){var k=null;if(f&&f.hasAttribute("formAction")){if(d=f,v=f[we]||null)k=v.formAction;else if(s1(d)!==null)continue}else k=v.action;typeof k=="function"?i[o+1]=k:(i.splice(o,3),o-=3),c4(i)}}}function u4(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),o||setTimeout(i,20)}function i(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(i,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function i1(e){this._internalRoot=e}cf.prototype.render=i1.prototype.render=function(e){var s=this._internalRoot;if(s===null)throw Error(r(409));var i=s.current,o=Fs();t4(i,o,e,s,null,null)},cf.prototype.unmount=i1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var s=e.containerInfo;t4(e.current,2,null,e,null,null),$d(),s[ke]=null}};function cf(e){this._internalRoot=e}cf.prototype.unstable_scheduleHydration=function(e){if(e){var s=ls();e={blockedOn:null,target:e,priority:s};for(var i=0;i<er.length&&s!==0&&s<er[i].priority;i++);er.splice(i,0,e),i===0&&l4(e)}};var d4=t.version;if(d4!=="19.2.4")throw Error(r(527,d4,"19.2.4"));U.findDOMNode=function(e){var s=e._reactInternals;if(s===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=m(s),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var lv={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uf.isDisabled&&uf.supportsFiber)try{ln=uf.inject(lv),oe=uf}catch{}}return eu.createRoot=function(e,s){if(!c(e))throw Error(r(299));var i=!1,o="",d=v8,f=_8,v=b8;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(f=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=Jg(e,1,!1,null,null,i,o,null,d,f,v,u4),e[ke]=s.current,Um(e),new i1(s)},eu.hydrateRoot=function(e,s,i){if(!c(e))throw Error(r(299));var o=!1,d="",f=v8,v=_8,k=b8,O=null;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(f=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(k=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),s=Jg(e,1,!0,s,i??null,o,d,O,f,v,k,u4),s.context=e4(null),i=s.current,o=Fs(),o=xa(o),d=Pi(o),d.callback=null,Ui(i,d,o),i=o,s.current.lanes=i,is(s,i),za(s),e[ke]=s.current,Um(e),new cf(s)},eu.version="19.2.4",eu}var j4;function _v(){if(j4)return c1.exports;j4=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),c1.exports=vv(),c1.exports}var bv=_v(),Zo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xv={setTimeout:(n,t)=>setTimeout(n,t),clearTimeout:n=>clearTimeout(n),setInterval:(n,t)=>setInterval(n,t),clearInterval:n=>clearInterval(n)},ur,Mp,D2,Sv=(D2=class{constructor(){Je(this,ur,xv);Je(this,Mp,!1)}setTimeoutProvider(n){ze(this,ur,n)}setTimeout(n,t){return L(this,ur).setTimeout(n,t)}clearTimeout(n){L(this,ur).clearTimeout(n)}setInterval(n,t){return L(this,ur).setInterval(n,t)}clearInterval(n){L(this,ur).clearInterval(n)}},ur=new WeakMap,Mp=new WeakMap,D2),ll=new Sv;function jv(n){setTimeout(n,0)}var kl=typeof window>"u"||"Deno"in globalThis;function zn(){}function wv(n,t){return typeof n=="function"?n(t):n}function $1(n){return typeof n=="number"&&n>=0&&n!==1/0}function G2(n,t){return Math.max(n+(t||0)-Date.now(),0)}function Sr(n,t){return typeof n=="function"?n(t):n}function sa(n,t){return typeof n=="function"?n(t):n}function w4(n,t){const{type:a="all",exact:r,fetchStatus:c,predicate:u,queryKey:h,stale:p}=n;if(h){if(r){if(t.queryHash!==Ap(h,t.options))return!1}else if(!xu(t.queryKey,h))return!1}if(a!=="all"){const y=t.isActive();if(a==="active"&&!y||a==="inactive"&&y)return!1}return!(typeof p=="boolean"&&t.isStale()!==p||c&&c!==t.state.fetchStatus||u&&!u(t))}function k4(n,t){const{exact:a,status:r,predicate:c,mutationKey:u}=n;if(u){if(!t.options.mutationKey)return!1;if(a){if(Nl(t.options.mutationKey)!==Nl(u))return!1}else if(!xu(t.options.mutationKey,u))return!1}return!(r&&t.state.status!==r||c&&!c(t))}function Ap(n,t){return((t==null?void 0:t.queryKeyHashFn)||Nl)(n)}function Nl(n){return JSON.stringify(n,(t,a)=>H1(a)?Object.keys(a).sort().reduce((r,c)=>(r[c]=a[c],r),{}):a)}function xu(n,t){return n===t?!0:typeof n!=typeof t?!1:n&&t&&typeof n=="object"&&typeof t=="object"?Object.keys(t).every(a=>xu(n[a],t[a])):!1}var kv=Object.prototype.hasOwnProperty;function V2(n,t,a=0){if(n===t)return n;if(a>500)return t;const r=N4(n)&&N4(t);if(!r&&!(H1(n)&&H1(t)))return t;const u=(r?n:Object.keys(n)).length,h=r?t:Object.keys(t),p=h.length,y=r?new Array(p):{};let m=0;for(let b=0;b<p;b++){const g=r?b:h[b],x=n[g],w=t[g];if(x===w){y[g]=x,(r?b<u:kv.call(n,g))&&m++;continue}if(x===null||w===null||typeof x!="object"||typeof w!="object"){y[g]=w;continue}const N=V2(x,w,a+1);y[g]=N,N===x&&m++}return u===p&&m===u?n:y}function Ef(n,t){if(!t||Object.keys(n).length!==Object.keys(t).length)return!1;for(const a in n)if(n[a]!==t[a])return!1;return!0}function N4(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function H1(n){if(!C4(n))return!1;const t=n.constructor;if(t===void 0)return!0;const a=t.prototype;return!(!C4(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function C4(n){return Object.prototype.toString.call(n)==="[object Object]"}function Nv(n){return new Promise(t=>{ll.setTimeout(t,n)})}function F1(n,t,a){return typeof a.structuralSharing=="function"?a.structuralSharing(n,t):a.structuralSharing!==!1?V2(n,t):t}function Cv(n,t,a=0){const r=[...n,t];return a&&r.length>a?r.slice(1):r}function Tv(n,t,a=0){const r=[t,...n];return a&&r.length>a?r.slice(0,-1):r}var Dp=Symbol();function K2(n,t){return!n.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!n.queryFn||n.queryFn===Dp?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Op(n,t){return typeof n=="function"?n(...t):!!n}function Ev(n,t,a){let r=!1,c;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(c??(c=t()),r||(r=!0,c.aborted?a():c.addEventListener("abort",a,{once:!0})),c)}),n}var dl,dr,Mo,O2,Mv=(O2=class extends Zo{constructor(){super();Je(this,dl);Je(this,dr);Je(this,Mo);ze(this,Mo,t=>{if(!kl&&window.addEventListener){const a=()=>t();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){L(this,dr)||this.setEventListener(L(this,Mo))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,dr))==null||t.call(this),ze(this,dr,void 0))}setEventListener(t){var a;ze(this,Mo,t),(a=L(this,dr))==null||a.call(this),ze(this,dr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){L(this,dl)!==t&&(ze(this,dl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(a=>{a(t)})}isFocused(){var t;return typeof L(this,dl)=="boolean"?L(this,dl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},dl=new WeakMap,dr=new WeakMap,Mo=new WeakMap,O2),Lp=new Mv;function Q1(){let n,t;const a=new Promise((c,u)=>{n=c,t=u});a.status="pending",a.catch(()=>{});function r(c){Object.assign(a,c),delete a.resolve,delete a.reject}return a.resolve=c=>{r({status:"fulfilled",value:c}),n(c)},a.reject=c=>{r({status:"rejected",reason:c}),t(c)},a}function Rv(n){var a;let t;if((a=n.then(r=>(t=r,r),zn))==null||a.catch(zn),t!==void 0)return{data:t}}function Y2(n){return n}function Av(n){return{mutationKey:n.options.mutationKey,state:n.state,...n.options.scope&&{scope:n.options.scope},...n.meta&&{meta:n.meta}}}function Dv(n,t,a){const r=()=>{var u;const c=(u=n.promise)==null?void 0:u.then(t).catch(h=>a(h)?Promise.reject(new Error("redacted")):Promise.reject(h));return c==null||c.catch(zn),c};return{dehydratedAt:Date.now(),state:{...n.state,...n.state.data!==void 0&&{data:t(n.state.data)}},queryKey:n.queryKey,queryHash:n.queryHash,...n.state.status==="pending"&&{promise:r()},...n.meta&&{meta:n.meta}}}function Ov(n){return n.state.isPaused}function Lv(n){return n.state.status==="success"}function Iv(n){return!0}function zv(n,t={}){var y,m,b,g;const a=t.shouldDehydrateMutation??((y=n.getDefaultOptions().dehydrate)==null?void 0:y.shouldDehydrateMutation)??Ov,r=n.getMutationCache().getAll().flatMap(x=>a(x)?[Av(x)]:[]),c=t.shouldDehydrateQuery??((m=n.getDefaultOptions().dehydrate)==null?void 0:m.shouldDehydrateQuery)??Lv,u=t.shouldRedactErrors??((b=n.getDefaultOptions().dehydrate)==null?void 0:b.shouldRedactErrors)??Iv,h=t.serializeData??((g=n.getDefaultOptions().dehydrate)==null?void 0:g.serializeData)??Y2,p=n.getQueryCache().getAll().flatMap(x=>c(x)?[Dv(x,h,u)]:[]);return{mutations:r,queries:p}}function Bv(n,t,a){var y;if(typeof t!="object"||t===null)return;const r=n.getMutationCache(),c=n.getQueryCache(),u=((y=n.getDefaultOptions().hydrate)==null?void 0:y.deserializeData)??Y2,h=t.mutations||[],p=t.queries||[];h.forEach(({state:m,...b})=>{var g,x;r.build(n,{...(g=n.getDefaultOptions().hydrate)==null?void 0:g.mutations,...(x=a==null?void 0:a.defaultOptions)==null?void 0:x.mutations,...b},m)}),p.forEach(({queryKey:m,state:b,queryHash:g,meta:x,promise:w,dehydratedAt:N})=>{var Q,ce;const T=w?Rv(w):void 0,C=b.data===void 0?T==null?void 0:T.data:b.data,I=C===void 0?C:u(C);let $=c.get(g);const H=($==null?void 0:$.state.status)==="pending",R=($==null?void 0:$.state.fetchStatus)==="fetching";if($){const Z=T&&N!==void 0&&N>$.state.dataUpdatedAt;if(b.dataUpdatedAt>$.state.dataUpdatedAt||Z){const{fetchStatus:ie,...ee}=b;$.setState({...ee,data:I})}}else $=c.build(n,{...(Q=n.getDefaultOptions().hydrate)==null?void 0:Q.queries,...(ce=a==null?void 0:a.defaultOptions)==null?void 0:ce.queries,queryKey:m,queryHash:g,meta:x},{...b,data:I,fetchStatus:"idle",status:I!==void 0?"success":b.status});w&&!H&&!R&&(N===void 0||N>$.state.dataUpdatedAt)&&$.fetch(void 0,{initialPromise:Promise.resolve(w).then(u)}).catch(zn)})}var Pv=jv;function Uv(){let n=[],t=0,a=p=>{p()},r=p=>{p()},c=Pv;const u=p=>{t?n.push(p):c(()=>{a(p)})},h=()=>{const p=n;n=[],p.length&&c(()=>{r(()=>{p.forEach(y=>{a(y)})})})};return{batch:p=>{let y;t++;try{y=p()}finally{t--,t||h()}return y},batchCalls:p=>(...y)=>{u(()=>{p(...y)})},schedule:u,setNotifyFunction:p=>{a=p},setBatchNotifyFunction:p=>{r=p},setScheduler:p=>{c=p}}}var Bn=Uv(),Ro,fr,Ao,L2,qv=(L2=class extends Zo{constructor(){super();Je(this,Ro,!0);Je(this,fr);Je(this,Ao);ze(this,Ao,t=>{if(!kl&&window.addEventListener){const a=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){L(this,fr)||this.setEventListener(L(this,Ao))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,fr))==null||t.call(this),ze(this,fr,void 0))}setEventListener(t){var a;ze(this,Ao,t),(a=L(this,fr))==null||a.call(this),ze(this,fr,t(this.setOnline.bind(this)))}setOnline(t){L(this,Ro)!==t&&(ze(this,Ro,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return L(this,Ro)}},Ro=new WeakMap,fr=new WeakMap,Ao=new WeakMap,L2),Mf=new qv;function $v(n){return Math.min(1e3*2**n,3e4)}function Z2(n){return(n??"online")==="online"?Mf.isOnline():!0}var G1=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function W2(n){let t=!1,a=0,r;const c=Q1(),u=()=>c.status!=="pending",h=T=>{var C;if(!u()){const I=new G1(T);x(I),(C=n.onCancel)==null||C.call(n,I)}},p=()=>{t=!0},y=()=>{t=!1},m=()=>Lp.isFocused()&&(n.networkMode==="always"||Mf.isOnline())&&n.canRun(),b=()=>Z2(n.networkMode)&&n.canRun(),g=T=>{u()||(r==null||r(),c.resolve(T))},x=T=>{u()||(r==null||r(),c.reject(T))},w=()=>new Promise(T=>{var C;r=I=>{(u()||m())&&T(I)},(C=n.onPause)==null||C.call(n)}).then(()=>{var T;r=void 0,u()||(T=n.onContinue)==null||T.call(n)}),N=()=>{if(u())return;let T;const C=a===0?n.initialPromise:void 0;try{T=C??n.fn()}catch(I){T=Promise.reject(I)}Promise.resolve(T).then(g).catch(I=>{var ce;if(u())return;const $=n.retry??(kl?0:3),H=n.retryDelay??$v,R=typeof H=="function"?H(a,I):H,Q=$===!0||typeof $=="number"&&a<$||typeof $=="function"&&$(a,I);if(t||!Q){x(I);return}a++,(ce=n.onFail)==null||ce.call(n,a,I),Nv(R).then(()=>m()?void 0:w()).then(()=>{t?x(I):N()})})};return{promise:c,status:()=>c.status,cancel:h,continue:()=>(r==null||r(),c),cancelRetry:p,continueRetry:y,canStart:b,start:()=>(b()?N():w().then(N),c)}}var fl,I2,X2=(I2=class{constructor(){Je(this,fl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$1(this.gcTime)&&ze(this,fl,ll.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(kl?1/0:300*1e3))}clearGcTimeout(){L(this,fl)&&(ll.clearTimeout(L(this,fl)),ze(this,fl,void 0))}},fl=new WeakMap,I2),hl,Do,na,ml,Gn,Ou,pl,_a,hi,z2,Hv=(z2=class extends X2{constructor(t){super();Je(this,_a);Je(this,hl);Je(this,Do);Je(this,na);Je(this,ml);Je(this,Gn);Je(this,Ou);Je(this,pl);ze(this,pl,!1),ze(this,Ou,t.defaultOptions),this.setOptions(t.options),this.observers=[],ze(this,ml,t.client),ze(this,na,L(this,ml).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ze(this,hl,E4(this.options)),this.state=t.state??L(this,hl),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,Gn))==null?void 0:t.promise}setOptions(t){if(this.options={...L(this,Ou),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=E4(this.options);a.data!==void 0&&(this.setState(T4(a.data,a.dataUpdatedAt)),ze(this,hl,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,na).remove(this)}setData(t,a){const r=F1(this.state.data,t,this.options);return bt(this,_a,hi).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(t,a){bt(this,_a,hi).call(this,{type:"setState",state:t,setStateOptions:a})}cancel(t){var r,c;const a=(r=L(this,Gn))==null?void 0:r.promise;return(c=L(this,Gn))==null||c.cancel(t),a?a.then(zn).catch(zn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,hl))}isActive(){return this.observers.some(t=>sa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Dp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Sr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!G2(this.state.dataUpdatedAt,t)}onFocus(){var a;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(a=L(this,Gn))==null||a.continue()}onOnline(){var a;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(a=L(this,Gn))==null||a.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,na).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(a=>a!==t),this.observers.length||(L(this,Gn)&&(L(this,pl)?L(this,Gn).cancel({revert:!0}):L(this,Gn).cancelRetry()),this.scheduleGc()),L(this,na).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||bt(this,_a,hi).call(this,{type:"invalidate"})}async fetch(t,a){var y,m,b,g,x,w,N,T,C,I,$,H;if(this.state.fetchStatus!=="idle"&&((y=L(this,Gn))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(L(this,Gn))return L(this,Gn).continueRetry(),L(this,Gn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(Q=>Q.options.queryFn);R&&this.setOptions(R.options)}const r=new AbortController,c=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(ze(this,pl,!0),r.signal)})},u=()=>{const R=K2(this.options,a),ce=(()=>{const Z={client:L(this,ml),queryKey:this.queryKey,meta:this.meta};return c(Z),Z})();return ze(this,pl,!1),this.options.persister?this.options.persister(R,ce,this):R(ce)},p=(()=>{const R={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:L(this,ml),state:this.state,fetchFn:u};return c(R),R})();(m=this.options.behavior)==null||m.onFetch(p,this),ze(this,Do,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=p.fetchOptions)==null?void 0:b.meta))&&bt(this,_a,hi).call(this,{type:"fetch",meta:(g=p.fetchOptions)==null?void 0:g.meta}),ze(this,Gn,W2({initialPromise:a==null?void 0:a.initialPromise,fn:p.fetchFn,onCancel:R=>{R instanceof G1&&R.revert&&this.setState({...L(this,Do),fetchStatus:"idle"}),r.abort()},onFail:(R,Q)=>{bt(this,_a,hi).call(this,{type:"failed",failureCount:R,error:Q})},onPause:()=>{bt(this,_a,hi).call(this,{type:"pause"})},onContinue:()=>{bt(this,_a,hi).call(this,{type:"continue"})},retry:p.options.retry,retryDelay:p.options.retryDelay,networkMode:p.options.networkMode,canRun:()=>!0}));try{const R=await L(this,Gn).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(w=(x=L(this,na).config).onSuccess)==null||w.call(x,R,this),(T=(N=L(this,na).config).onSettled)==null||T.call(N,R,this.state.error,this),R}catch(R){if(R instanceof G1){if(R.silent)return L(this,Gn).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw bt(this,_a,hi).call(this,{type:"error",error:R}),(I=(C=L(this,na).config).onError)==null||I.call(C,R,this),(H=($=L(this,na).config).onSettled)==null||H.call($,this.state.data,R,this),R}finally{this.scheduleGc()}}},hl=new WeakMap,Do=new WeakMap,na=new WeakMap,ml=new WeakMap,Gn=new WeakMap,Ou=new WeakMap,pl=new WeakMap,_a=new WeakSet,hi=function(t){const a=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...J2(r.data,this.options),fetchMeta:t.meta??null};case"success":const c={...r,...T4(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ze(this,Do,t.manual?c:void 0),c;case"error":const u=t.error;return{...r,error:u,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=a(this.state),Bn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),L(this,na).notify({query:this,type:"updated",action:t})})},z2);function J2(n,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z2(t.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function T4(n,t){return{data:n,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function E4(n){const t=typeof n.initialData=="function"?n.initialData():n.initialData,a=t!==void 0,r=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Cs,Rt,Lu,ds,gl,Oo,gi,hr,Iu,Lo,Io,yl,vl,mr,zo,qt,du,V1,K1,Y1,Z1,W1,X1,J1,e3,B2,Fv=(B2=class extends Zo{constructor(t,a){super();Je(this,qt);Je(this,Cs);Je(this,Rt);Je(this,Lu);Je(this,ds);Je(this,gl);Je(this,Oo);Je(this,gi);Je(this,hr);Je(this,Iu);Je(this,Lo);Je(this,Io);Je(this,yl);Je(this,vl);Je(this,mr);Je(this,zo,new Set);this.options=a,ze(this,Cs,t),ze(this,hr,null),ze(this,gi,Q1()),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Rt).addObserver(this),M4(L(this,Rt),this.options)?bt(this,qt,du).call(this):this.updateResult(),bt(this,qt,Z1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ep(L(this,Rt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ep(L(this,Rt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,bt(this,qt,W1).call(this),bt(this,qt,X1).call(this),L(this,Rt).removeObserver(this)}setOptions(t){const a=this.options,r=L(this,Rt);if(this.options=L(this,Cs).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof sa(this.options.enabled,L(this,Rt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");bt(this,qt,J1).call(this),L(this,Rt).setOptions(this.options),a._defaulted&&!Ef(this.options,a)&&L(this,Cs).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Rt),observer:this});const c=this.hasListeners();c&&R4(L(this,Rt),r,this.options,a)&&bt(this,qt,du).call(this),this.updateResult(),c&&(L(this,Rt)!==r||sa(this.options.enabled,L(this,Rt))!==sa(a.enabled,L(this,Rt))||Sr(this.options.staleTime,L(this,Rt))!==Sr(a.staleTime,L(this,Rt)))&&bt(this,qt,V1).call(this);const u=bt(this,qt,K1).call(this);c&&(L(this,Rt)!==r||sa(this.options.enabled,L(this,Rt))!==sa(a.enabled,L(this,Rt))||u!==L(this,mr))&&bt(this,qt,Y1).call(this,u)}getOptimisticResult(t){const a=L(this,Cs).getQueryCache().build(L(this,Cs),t),r=this.createResult(a,t);return Gv(this,r)&&(ze(this,ds,r),ze(this,Oo,this.options),ze(this,gl,L(this,Rt).state)),r}getCurrentResult(){return L(this,ds)}trackResult(t,a){return new Proxy(t,{get:(r,c)=>(this.trackProp(c),a==null||a(c),c==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,gi).status==="pending"&&L(this,gi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,c))})}trackProp(t){L(this,zo).add(t)}getCurrentQuery(){return L(this,Rt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const a=L(this,Cs).defaultQueryOptions(t),r=L(this,Cs).getQueryCache().build(L(this,Cs),a);return r.fetch().then(()=>this.createResult(r,a))}fetch(t){return bt(this,qt,du).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,ds)))}createResult(t,a){var ee;const r=L(this,Rt),c=this.options,u=L(this,ds),h=L(this,gl),p=L(this,Oo),m=t!==r?t.state:L(this,Lu),{state:b}=t;let g={...b},x=!1,w;if(a._optimisticResults){const Y=this.hasListeners(),F=!Y&&M4(t,a),_e=Y&&R4(t,r,a,c);(F||_e)&&(g={...g,...J2(b.data,t.options)}),a._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:N,errorUpdatedAt:T,status:C}=g;w=g.data;let I=!1;if(a.placeholderData!==void 0&&w===void 0&&C==="pending"){let Y;u!=null&&u.isPlaceholderData&&a.placeholderData===(p==null?void 0:p.placeholderData)?(Y=u.data,I=!0):Y=typeof a.placeholderData=="function"?a.placeholderData((ee=L(this,Io))==null?void 0:ee.state.data,L(this,Io)):a.placeholderData,Y!==void 0&&(C="success",w=F1(u==null?void 0:u.data,Y,a),x=!0)}if(a.select&&w!==void 0&&!I)if(u&&w===(h==null?void 0:h.data)&&a.select===L(this,Iu))w=L(this,Lo);else try{ze(this,Iu,a.select),w=a.select(w),w=F1(u==null?void 0:u.data,w,a),ze(this,Lo,w),ze(this,hr,null)}catch(Y){ze(this,hr,Y)}L(this,hr)&&(N=L(this,hr),w=L(this,Lo),T=Date.now(),C="error");const $=g.fetchStatus==="fetching",H=C==="pending",R=C==="error",Q=H&&$,ce=w!==void 0,ie={status:C,fetchStatus:g.fetchStatus,isPending:H,isSuccess:C==="success",isError:R,isInitialLoading:Q,isLoading:Q,data:w,dataUpdatedAt:g.dataUpdatedAt,error:N,errorUpdatedAt:T,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:g.dataUpdateCount>0||g.errorUpdateCount>0,isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:$,isRefetching:$&&!H,isLoadingError:R&&!ce,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:R&&ce,isStale:Ip(t,a),refetch:this.refetch,promise:L(this,gi),isEnabled:sa(a.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Y=ie.data!==void 0,F=ie.status==="error"&&!Y,_e=ue=>{F?ue.reject(ie.error):Y&&ue.resolve(ie.data)},je=()=>{const ue=ze(this,gi,ie.promise=Q1());_e(ue)},ae=L(this,gi);switch(ae.status){case"pending":t.queryHash===r.queryHash&&_e(ae);break;case"fulfilled":(F||ie.data!==ae.value)&&je();break;case"rejected":(!F||ie.error!==ae.reason)&&je();break}}return ie}updateResult(){const t=L(this,ds),a=this.createResult(L(this,Rt),this.options);if(ze(this,gl,L(this,Rt).state),ze(this,Oo,this.options),L(this,gl).data!==void 0&&ze(this,Io,L(this,Rt)),Ef(a,t))return;ze(this,ds,a);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:c}=this.options,u=typeof c=="function"?c():c;if(u==="all"||!u&&!L(this,zo).size)return!0;const h=new Set(u??L(this,zo));return this.options.throwOnError&&h.add("error"),Object.keys(L(this,ds)).some(p=>{const y=p;return L(this,ds)[y]!==t[y]&&h.has(y)})};bt(this,qt,e3).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&bt(this,qt,Z1).call(this)}},Cs=new WeakMap,Rt=new WeakMap,Lu=new WeakMap,ds=new WeakMap,gl=new WeakMap,Oo=new WeakMap,gi=new WeakMap,hr=new WeakMap,Iu=new WeakMap,Lo=new WeakMap,Io=new WeakMap,yl=new WeakMap,vl=new WeakMap,mr=new WeakMap,zo=new WeakMap,qt=new WeakSet,du=function(t){bt(this,qt,J1).call(this);let a=L(this,Rt).fetch(this.options,t);return t!=null&&t.throwOnError||(a=a.catch(zn)),a},V1=function(){bt(this,qt,W1).call(this);const t=Sr(this.options.staleTime,L(this,Rt));if(kl||L(this,ds).isStale||!$1(t))return;const r=G2(L(this,ds).dataUpdatedAt,t)+1;ze(this,yl,ll.setTimeout(()=>{L(this,ds).isStale||this.updateResult()},r))},K1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Rt)):this.options.refetchInterval)??!1},Y1=function(t){bt(this,qt,X1).call(this),ze(this,mr,t),!(kl||sa(this.options.enabled,L(this,Rt))===!1||!$1(L(this,mr))||L(this,mr)===0)&&ze(this,vl,ll.setInterval(()=>{(this.options.refetchIntervalInBackground||Lp.isFocused())&&bt(this,qt,du).call(this)},L(this,mr)))},Z1=function(){bt(this,qt,V1).call(this),bt(this,qt,Y1).call(this,bt(this,qt,K1).call(this))},W1=function(){L(this,yl)&&(ll.clearTimeout(L(this,yl)),ze(this,yl,void 0))},X1=function(){L(this,vl)&&(ll.clearInterval(L(this,vl)),ze(this,vl,void 0))},J1=function(){const t=L(this,Cs).getQueryCache().build(L(this,Cs),this.options);if(t===L(this,Rt))return;const a=L(this,Rt);ze(this,Rt,t),ze(this,Lu,t.state),this.hasListeners()&&(a==null||a.removeObserver(this),t.addObserver(this))},e3=function(t){Bn.batch(()=>{t.listeners&&this.listeners.forEach(a=>{a(L(this,ds))}),L(this,Cs).getQueryCache().notify({query:L(this,Rt),type:"observerResultsUpdated"})})},B2);function Qv(n,t){return sa(t.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&t.retryOnMount===!1)}function M4(n,t){return Qv(n,t)||n.state.data!==void 0&&ep(n,t,t.refetchOnMount)}function ep(n,t,a){if(sa(t.enabled,n)!==!1&&Sr(t.staleTime,n)!=="static"){const r=typeof a=="function"?a(n):a;return r==="always"||r!==!1&&Ip(n,t)}return!1}function R4(n,t,a,r){return(n!==t||sa(r.enabled,n)===!1)&&(!a.suspense||n.state.status!=="error")&&Ip(n,a)}function Ip(n,t){return sa(t.enabled,n)!==!1&&n.isStaleByTime(Sr(t.staleTime,n))}function Gv(n,t){return!Ef(n.getCurrentResult(),t)}function A4(n){return{onFetch:(t,a)=>{var b,g,x,w,N;const r=t.options,c=(x=(g=(b=t.fetchOptions)==null?void 0:b.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,u=((w=t.state.data)==null?void 0:w.pages)||[],h=((N=t.state.data)==null?void 0:N.pageParams)||[];let p={pages:[],pageParams:[]},y=0;const m=async()=>{let T=!1;const C=H=>{Ev(H,()=>t.signal,()=>T=!0)},I=K2(t.options,t.fetchOptions),$=async(H,R,Q)=>{if(T)return Promise.reject();if(R==null&&H.pages.length)return Promise.resolve(H);const Z=(()=>{const F={client:t.client,queryKey:t.queryKey,pageParam:R,direction:Q?"backward":"forward",meta:t.options.meta};return C(F),F})(),ie=await I(Z),{maxPages:ee}=t.options,Y=Q?Tv:Cv;return{pages:Y(H.pages,ie,ee),pageParams:Y(H.pageParams,R,ee)}};if(c&&u.length){const H=c==="backward",R=H?Vv:D4,Q={pages:u,pageParams:h},ce=R(r,Q);p=await $(Q,ce,H)}else{const H=n??u.length;do{const R=y===0?h[0]??r.initialPageParam:D4(r,p);if(y>0&&R==null)break;p=await $(p,R),y++}while(y<H)}return p};t.options.persister?t.fetchFn=()=>{var T,C;return(C=(T=t.options).persister)==null?void 0:C.call(T,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a)}:t.fetchFn=m}}}function D4(n,{pages:t,pageParams:a}){const r=t.length-1;return t.length>0?n.getNextPageParam(t[r],t,a[r],a):void 0}function Vv(n,{pages:t,pageParams:a}){var r;return t.length>0?(r=n.getPreviousPageParam)==null?void 0:r.call(n,t[0],t,a[0],a):void 0}var zu,Pa,as,_l,Ua,ar,P2,Kv=(P2=class extends X2{constructor(t){super();Je(this,Ua);Je(this,zu);Je(this,Pa);Je(this,as);Je(this,_l);ze(this,zu,t.client),this.mutationId=t.mutationId,ze(this,as,t.mutationCache),ze(this,Pa,[]),this.state=t.state||t3(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,Pa).includes(t)||(L(this,Pa).push(t),this.clearGcTimeout(),L(this,as).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ze(this,Pa,L(this,Pa).filter(a=>a!==t)),this.scheduleGc(),L(this,as).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Pa).length||(this.state.status==="pending"?this.scheduleGc():L(this,as).remove(this))}continue(){var t;return((t=L(this,_l))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var h,p,y,m,b,g,x,w,N,T,C,I,$,H,R,Q,ce,Z;const a=()=>{bt(this,Ua,ar).call(this,{type:"continue"})},r={client:L(this,zu),meta:this.options.meta,mutationKey:this.options.mutationKey};ze(this,_l,W2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(ie,ee)=>{bt(this,Ua,ar).call(this,{type:"failed",failureCount:ie,error:ee})},onPause:()=>{bt(this,Ua,ar).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,as).canRun(this)}));const c=this.state.status==="pending",u=!L(this,_l).canStart();try{if(c)a();else{bt(this,Ua,ar).call(this,{type:"pending",variables:t,isPaused:u}),L(this,as).config.onMutate&&await L(this,as).config.onMutate(t,this,r);const ee=await((p=(h=this.options).onMutate)==null?void 0:p.call(h,t,r));ee!==this.state.context&&bt(this,Ua,ar).call(this,{type:"pending",context:ee,variables:t,isPaused:u})}const ie=await L(this,_l).start();return await((m=(y=L(this,as).config).onSuccess)==null?void 0:m.call(y,ie,t,this.state.context,this,r)),await((g=(b=this.options).onSuccess)==null?void 0:g.call(b,ie,t,this.state.context,r)),await((w=(x=L(this,as).config).onSettled)==null?void 0:w.call(x,ie,null,this.state.variables,this.state.context,this,r)),await((T=(N=this.options).onSettled)==null?void 0:T.call(N,ie,null,t,this.state.context,r)),bt(this,Ua,ar).call(this,{type:"success",data:ie}),ie}catch(ie){try{await((I=(C=L(this,as).config).onError)==null?void 0:I.call(C,ie,t,this.state.context,this,r))}catch(ee){Promise.reject(ee)}try{await((H=($=this.options).onError)==null?void 0:H.call($,ie,t,this.state.context,r))}catch(ee){Promise.reject(ee)}try{await((Q=(R=L(this,as).config).onSettled)==null?void 0:Q.call(R,void 0,ie,this.state.variables,this.state.context,this,r))}catch(ee){Promise.reject(ee)}try{await((Z=(ce=this.options).onSettled)==null?void 0:Z.call(ce,void 0,ie,t,this.state.context,r))}catch(ee){Promise.reject(ee)}throw bt(this,Ua,ar).call(this,{type:"error",error:ie}),ie}finally{L(this,as).runNext(this)}}},zu=new WeakMap,Pa=new WeakMap,as=new WeakMap,_l=new WeakMap,Ua=new WeakSet,ar=function(t){const a=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=a(this.state),Bn.batch(()=>{L(this,Pa).forEach(r=>{r.onMutationUpdate(t)}),L(this,as).notify({mutation:this,type:"updated",action:t})})},P2);function t3(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yi,ba,Bu,U2,Yv=(U2=class extends Zo{constructor(t={}){super();Je(this,yi);Je(this,ba);Je(this,Bu);this.config=t,ze(this,yi,new Set),ze(this,ba,new Map),ze(this,Bu,0)}build(t,a,r){const c=new Kv({client:t,mutationCache:this,mutationId:++df(this,Bu)._,options:t.defaultMutationOptions(a),state:r});return this.add(c),c}add(t){L(this,yi).add(t);const a=ff(t);if(typeof a=="string"){const r=L(this,ba).get(a);r?r.push(t):L(this,ba).set(a,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,yi).delete(t)){const a=ff(t);if(typeof a=="string"){const r=L(this,ba).get(a);if(r)if(r.length>1){const c=r.indexOf(t);c!==-1&&r.splice(c,1)}else r[0]===t&&L(this,ba).delete(a)}}this.notify({type:"removed",mutation:t})}canRun(t){const a=ff(t);if(typeof a=="string"){const r=L(this,ba).get(a),c=r==null?void 0:r.find(u=>u.state.status==="pending");return!c||c===t}else return!0}runNext(t){var r;const a=ff(t);if(typeof a=="string"){const c=(r=L(this,ba).get(a))==null?void 0:r.find(u=>u!==t&&u.state.isPaused);return(c==null?void 0:c.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bn.batch(()=>{L(this,yi).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,yi).clear(),L(this,ba).clear()})}getAll(){return Array.from(L(this,yi))}find(t){const a={exact:!0,...t};return this.getAll().find(r=>k4(a,r))}findAll(t={}){return this.getAll().filter(a=>k4(t,a))}notify(t){Bn.batch(()=>{this.listeners.forEach(a=>{a(t)})})}resumePausedMutations(){const t=this.getAll().filter(a=>a.state.isPaused);return Bn.batch(()=>Promise.all(t.map(a=>a.continue().catch(zn))))}},yi=new WeakMap,ba=new WeakMap,Bu=new WeakMap,U2);function ff(n){var t;return(t=n.options.scope)==null?void 0:t.id}var vi,pr,Ts,_i,ki,xf,tp,q2,Zv=(q2=class extends Zo{constructor(a,r){super();Je(this,ki);Je(this,vi);Je(this,pr);Je(this,Ts);Je(this,_i);ze(this,vi,a),this.setOptions(r),this.bindMethods(),bt(this,ki,xf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var c;const r=this.options;this.options=L(this,vi).defaultMutationOptions(a),Ef(this.options,r)||L(this,vi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,Ts),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Nl(r.mutationKey)!==Nl(this.options.mutationKey)?this.reset():((c=L(this,Ts))==null?void 0:c.state.status)==="pending"&&L(this,Ts).setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=L(this,Ts))==null||a.removeObserver(this)}onMutationUpdate(a){bt(this,ki,xf).call(this),bt(this,ki,tp).call(this,a)}getCurrentResult(){return L(this,pr)}reset(){var a;(a=L(this,Ts))==null||a.removeObserver(this),ze(this,Ts,void 0),bt(this,ki,xf).call(this),bt(this,ki,tp).call(this)}mutate(a,r){var c;return ze(this,_i,r),(c=L(this,Ts))==null||c.removeObserver(this),ze(this,Ts,L(this,vi).getMutationCache().build(L(this,vi),this.options)),L(this,Ts).addObserver(this),L(this,Ts).execute(a)}},vi=new WeakMap,pr=new WeakMap,Ts=new WeakMap,_i=new WeakMap,ki=new WeakSet,xf=function(){var r;const a=((r=L(this,Ts))==null?void 0:r.state)??t3();ze(this,pr,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},tp=function(a){Bn.batch(()=>{var r,c,u,h,p,y,m,b;if(L(this,_i)&&this.hasListeners()){const g=L(this,pr).variables,x=L(this,pr).context,w={client:L(this,vi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((a==null?void 0:a.type)==="success"){try{(c=(r=L(this,_i)).onSuccess)==null||c.call(r,a.data,g,x,w)}catch(N){Promise.reject(N)}try{(h=(u=L(this,_i)).onSettled)==null||h.call(u,a.data,null,g,x,w)}catch(N){Promise.reject(N)}}else if((a==null?void 0:a.type)==="error"){try{(y=(p=L(this,_i)).onError)==null||y.call(p,a.error,g,x,w)}catch(N){Promise.reject(N)}try{(b=(m=L(this,_i)).onSettled)==null||b.call(m,void 0,a.error,g,x,w)}catch(N){Promise.reject(N)}}}this.listeners.forEach(g=>{g(L(this,pr))})})},q2),qa,$2,Wv=($2=class extends Zo{constructor(t={}){super();Je(this,qa);this.config=t,ze(this,qa,new Map)}build(t,a,r){const c=a.queryKey,u=a.queryHash??Ap(c,a);let h=this.get(u);return h||(h=new Hv({client:t,queryKey:c,queryHash:u,options:t.defaultQueryOptions(a),state:r,defaultOptions:t.getQueryDefaults(c)}),this.add(h)),h}add(t){L(this,qa).has(t.queryHash)||(L(this,qa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const a=L(this,qa).get(t.queryHash);a&&(t.destroy(),a===t&&L(this,qa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Bn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,qa).get(t)}getAll(){return[...L(this,qa).values()]}find(t){const a={exact:!0,...t};return this.getAll().find(r=>w4(a,r))}findAll(t={}){const a=this.getAll();return Object.keys(t).length>0?a.filter(r=>w4(t,r)):a}notify(t){Bn.batch(()=>{this.listeners.forEach(a=>{a(t)})})}onFocus(){Bn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Bn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},qa=new WeakMap,$2),bn,gr,yr,Bo,Po,vr,Uo,qo,H2,Xv=(H2=class{constructor(n={}){Je(this,bn);Je(this,gr);Je(this,yr);Je(this,Bo);Je(this,Po);Je(this,vr);Je(this,Uo);Je(this,qo);ze(this,bn,n.queryCache||new Wv),ze(this,gr,n.mutationCache||new Yv),ze(this,yr,n.defaultOptions||{}),ze(this,Bo,new Map),ze(this,Po,new Map),ze(this,vr,0)}mount(){df(this,vr)._++,L(this,vr)===1&&(ze(this,Uo,Lp.subscribe(async n=>{n&&(await this.resumePausedMutations(),L(this,bn).onFocus())})),ze(this,qo,Mf.subscribe(async n=>{n&&(await this.resumePausedMutations(),L(this,bn).onOnline())})))}unmount(){var n,t;df(this,vr)._--,L(this,vr)===0&&((n=L(this,Uo))==null||n.call(this),ze(this,Uo,void 0),(t=L(this,qo))==null||t.call(this),ze(this,qo,void 0))}isFetching(n){return L(this,bn).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return L(this,gr).findAll({...n,status:"pending"}).length}getQueryData(n){var a;const t=this.defaultQueryOptions({queryKey:n});return(a=L(this,bn).get(t.queryHash))==null?void 0:a.state.data}ensureQueryData(n){const t=this.defaultQueryOptions(n),a=L(this,bn).build(this,t),r=a.state.data;return r===void 0?this.fetchQuery(n):(n.revalidateIfStale&&a.isStaleByTime(Sr(t.staleTime,a))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(n){return L(this,bn).findAll(n).map(({queryKey:t,state:a})=>{const r=a.data;return[t,r]})}setQueryData(n,t,a){const r=this.defaultQueryOptions({queryKey:n}),c=L(this,bn).get(r.queryHash),u=c==null?void 0:c.state.data,h=wv(t,u);if(h!==void 0)return L(this,bn).build(this,r).setData(h,{...a,manual:!0})}setQueriesData(n,t,a){return Bn.batch(()=>L(this,bn).findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,t,a)]))}getQueryState(n){var a;const t=this.defaultQueryOptions({queryKey:n});return(a=L(this,bn).get(t.queryHash))==null?void 0:a.state}removeQueries(n){const t=L(this,bn);Bn.batch(()=>{t.findAll(n).forEach(a=>{t.remove(a)})})}resetQueries(n,t){const a=L(this,bn);return Bn.batch(()=>(a.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...n},t)))}cancelQueries(n,t={}){const a={revert:!0,...t},r=Bn.batch(()=>L(this,bn).findAll(n).map(c=>c.cancel(a)));return Promise.all(r).then(zn).catch(zn)}invalidateQueries(n,t={}){return Bn.batch(()=>(L(this,bn).findAll(n).forEach(a=>{a.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},t)))}refetchQueries(n,t={}){const a={...t,cancelRefetch:t.cancelRefetch??!0},r=Bn.batch(()=>L(this,bn).findAll(n).filter(c=>!c.isDisabled()&&!c.isStatic()).map(c=>{let u=c.fetch(void 0,a);return a.throwOnError||(u=u.catch(zn)),c.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(r).then(zn)}fetchQuery(n){const t=this.defaultQueryOptions(n);t.retry===void 0&&(t.retry=!1);const a=L(this,bn).build(this,t);return a.isStaleByTime(Sr(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(zn).catch(zn)}fetchInfiniteQuery(n){return n.behavior=A4(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(zn).catch(zn)}ensureInfiniteQueryData(n){return n.behavior=A4(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return Mf.isOnline()?L(this,gr).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,bn)}getMutationCache(){return L(this,gr)}getDefaultOptions(){return L(this,yr)}setDefaultOptions(n){ze(this,yr,n)}setQueryDefaults(n,t){L(this,Bo).set(Nl(n),{queryKey:n,defaultOptions:t})}getQueryDefaults(n){const t=[...L(this,Bo).values()],a={};return t.forEach(r=>{xu(n,r.queryKey)&&Object.assign(a,r.defaultOptions)}),a}setMutationDefaults(n,t){L(this,Po).set(Nl(n),{mutationKey:n,defaultOptions:t})}getMutationDefaults(n){const t=[...L(this,Po).values()],a={};return t.forEach(r=>{xu(n,r.mutationKey)&&Object.assign(a,r.defaultOptions)}),a}defaultQueryOptions(n){if(n._defaulted)return n;const t={...L(this,yr).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return t.queryHash||(t.queryHash=Ap(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Dp&&(t.enabled=!1),t}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...L(this,yr).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){L(this,bn).clear(),L(this,gr).clear()}},bn=new WeakMap,gr=new WeakMap,yr=new WeakMap,Bo=new WeakMap,Po=new WeakMap,vr=new WeakMap,Uo=new WeakMap,qo=new WeakMap,H2),n3=_.createContext(void 0),Tl=n=>{const t=_.useContext(n3);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Jv=({client:n,children:t})=>(_.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),l.jsx(n3.Provider,{value:n,children:t})),s3=_.createContext(!1),e_=()=>_.useContext(s3);s3.Provider;function t_(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var n_=_.createContext(t_()),s_=()=>_.useContext(n_),a_=(n,t,a)=>{const r=a!=null&&a.state.error&&typeof n.throwOnError=="function"?Op(n.throwOnError,[a.state.error,a]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||r)&&(t.isReset()||(n.retryOnMount=!1))},i_=n=>{_.useEffect(()=>{n.clearReset()},[n])},r_=({result:n,errorResetBoundary:t,throwOnError:a,query:r,suspense:c})=>n.isError&&!t.isReset()&&!n.isFetching&&r&&(c&&n.data===void 0||Op(a,[n.error,r])),l_=n=>{if(n.suspense){const a=c=>c==="static"?c:Math.max(c??1e3,1e3),r=n.staleTime;n.staleTime=typeof r=="function"?(...c)=>a(r(...c)):a(r),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},o_=(n,t)=>n.isLoading&&n.isFetching&&!t,c_=(n,t)=>(n==null?void 0:n.suspense)&&t.isPending,O4=(n,t,a)=>t.fetchOptimistic(n).catch(()=>{a.clearReset()});function u_(n,t,a){var x,w,N,T;const r=e_(),c=s_(),u=Tl(),h=u.defaultQueryOptions(n);(w=(x=u.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||w.call(x,h);const p=u.getQueryCache().get(h.queryHash);h._optimisticResults=r?"isRestoring":"optimistic",l_(h),a_(h,c,p),i_(c);const y=!u.getQueryCache().get(h.queryHash),[m]=_.useState(()=>new t(u,h)),b=m.getOptimisticResult(h),g=!r&&n.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(C=>{const I=g?m.subscribe(Bn.batchCalls(C)):zn;return m.updateResult(),I},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),_.useEffect(()=>{m.setOptions(h)},[h,m]),c_(h,b))throw O4(h,m,c);if(r_({result:b,errorResetBoundary:c,throwOnError:h.throwOnError,query:p,suspense:h.suspense}))throw b.error;if((T=(N=u.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||T.call(N,h,b),h.experimental_prefetchInRender&&!kl&&o_(b,r)){const C=y?O4(h,m,c):p==null?void 0:p.promise;C==null||C.catch(zn).finally(()=>{m.updateResult()})}return h.notifyOnChangeProps?b:m.trackResult(b)}function Es(n,t){return u_(n,Fv)}function Vn(n,t){const a=Tl(),[r]=_.useState(()=>new Zv(a,n));_.useEffect(()=>{r.setOptions(n)},[r,n]);const c=_.useSyncExternalStore(_.useCallback(h=>r.subscribe(Bn.batchCalls(h)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),u=_.useCallback((h,p)=>{r.mutate(h,p).catch(zn)},[r]);if(c.error&&Op(r.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:u,mutateAsync:c.mutate}}var hf=typeof window<"u"?_.useLayoutEffect:_.useEffect;function h1(n){const t=_.useRef({value:n,prev:null}),a=t.current.value;return n!==a&&(t.current={value:n,prev:a}),t.current.prev}function d_(n,t,a={},r={}){_.useEffect(()=>{if(!n.current||r.disabled||typeof IntersectionObserver!="function")return;const c=new IntersectionObserver(([u])=>{t(u)},a);return c.observe(n.current),()=>{c.disconnect()}},[t,a,r.disabled,n])}function f_(n){const t=_.useRef(null);return _.useImperativeHandle(n,()=>t.current,[]),t}var h_=!1;function Su(n){return n[n.length-1]}function m_(n){return typeof n=="function"}function _r(n,t){return m_(n)?n(t):n}var p_=Object.prototype.hasOwnProperty,L4=Object.prototype.propertyIsEnumerable,g_=()=>Object.create(null),sl=(n,t)=>ol(n,t,g_);function ol(n,t,a=()=>({}),r=0){if(n===t)return n;if(r>500)return t;const c=t,u=B4(n)&&B4(c);if(!u&&!(Rf(n)&&Rf(c)))return c;const h=u?n:I4(n);if(!h)return c;const p=u?c:I4(c);if(!p)return c;const y=h.length,m=p.length,b=u?new Array(m):a();let g=0;for(let x=0;x<m;x++){const w=u?x:p[x],N=n[w],T=c[w];if(N===T){b[w]=N,(u?x<y:p_.call(n,w))&&g++;continue}if(N===null||T===null||typeof N!="object"||typeof T!="object"){b[w]=T;continue}const C=ol(N,T,a,r+1);b[w]=C,C===N&&g++}return y===m&&g===y?n:b}function I4(n){const t=Object.getOwnPropertyNames(n);for(const c of t)if(!L4.call(n,c))return!1;const a=Object.getOwnPropertySymbols(n);if(a.length===0)return t;const r=t;for(const c of a){if(!L4.call(n,c))return!1;r.push(c)}return r}function Rf(n){if(!z4(n))return!1;const t=n.constructor;if(typeof t>"u")return!0;const a=t.prototype;return!(!z4(a)||!a.hasOwnProperty("isPrototypeOf"))}function z4(n){return Object.prototype.toString.call(n)==="[object Object]"}function B4(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function bl(n,t,a){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let r=0,c=n.length;r<c;r++)if(!bl(n[r],t[r],a))return!1;return!0}if(Rf(n)&&Rf(t)){const r=(a==null?void 0:a.ignoreUndefined)??!0;if(a!=null&&a.partial){for(const h in t)if((!r||t[h]!==void 0)&&!bl(n[h],t[h],a))return!1;return!0}let c=0;if(!r)c=Object.keys(n).length;else for(const h in n)n[h]!==void 0&&c++;let u=0;for(const h in t)if((!r||t[h]!==void 0)&&(u++,u>c||!bl(n[h],t[h],a)))return!1;return c===u}return!1}function $o(n){let t,a;const r=new Promise((c,u)=>{t=c,a=u});return r.status="pending",r.resolve=c=>{r.status="resolved",r.value=c,t(c),n==null||n(c)},r.reject=c=>{r.status="rejected",a(c)},r}function ju(n){return!!(n&&typeof n=="object"&&typeof n.then=="function")}function y_(n){return n.replace(/[\x00-\x1f\x7f]/g,"")}function P4(n){let t;try{t=decodeURI(n)}catch{t=n.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch{return a}})}return y_(t)}var v_=["http:","https:","mailto:","tel:"];function Af(n,t){if(!n)return!1;try{const a=new URL(n);return!t.has(a.protocol)}catch{return!1}}function tu(n){if(!n)return{path:n,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(n)&&!n.startsWith("//"))return{path:n,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let a=0,r="",c;for(;(c=t.exec(n))!==null;)r+=P4(n.slice(a,c.index))+c[0],a=t.lastIndex;r=r+P4(a?n.slice(a):n);let u=!1;return r.startsWith("//")&&(u=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:u}}function __(n){return/\s|[^\u0000-\u007F]/.test(n)?n.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):n}function Df(n){const t=new Map;let a,r;const c=u=>{u.next&&(u.prev?(u.prev.next=u.next,u.next.prev=u.prev,u.next=void 0,r&&(r.next=u,u.prev=r)):(u.next.prev=void 0,a=u.next,u.next=void 0,r&&(u.prev=r,r.next=u)),r=u)};return{get(u){const h=t.get(u);if(h)return c(h),h.value},set(u,h){if(t.size>=n&&a){const y=a;t.delete(y.key),y.next&&(a=y.next,y.next.prev=void 0),y===r&&(r=void 0)}const p=t.get(u);if(p)p.value=h,c(p);else{const y={key:u,value:h,prev:r};r&&(r.next=y),r=y,a||(a=y),t.set(u,y)}},clear(){t.clear(),a=void 0,r=void 0}}}var b_="Invariant failed";function Cr(n,t){if(!n)throw new Error(b_)}var cl=4,a3=5;function x_(n){const t=n.indexOf("{");if(t===-1)return null;const a=n.indexOf("}",t);return a===-1||t+1>=n.length?null:[t,a]}function zp(n,t,a=new Uint16Array(6)){const r=n.indexOf("/",t),c=r===-1?n.length:r,u=n.substring(t,c);if(!u||!u.includes("$"))return a[0]=0,a[1]=t,a[2]=t,a[3]=c,a[4]=c,a[5]=c,a;if(u==="$"){const p=n.length;return a[0]=2,a[1]=t,a[2]=t,a[3]=p,a[4]=p,a[5]=p,a}if(u.charCodeAt(0)===36)return a[0]=1,a[1]=t,a[2]=t+1,a[3]=c,a[4]=c,a[5]=c,a;const h=x_(u);if(h){const[p,y]=h,m=u.charCodeAt(p+1);if(m===45){if(p+2<u.length&&u.charCodeAt(p+2)===36){const b=p+3,g=y;if(b<g)return a[0]=3,a[1]=t+p,a[2]=t+b,a[3]=t+g,a[4]=t+y+1,a[5]=c,a}}else if(m===36){const b=p+1,g=p+2;return g===y?(a[0]=2,a[1]=t+p,a[2]=t+b,a[3]=t+g,a[4]=t+y+1,a[5]=n.length,a):(a[0]=1,a[1]=t+p,a[2]=t+g,a[3]=t+y,a[4]=t+y+1,a[5]=c,a)}}return a[0]=0,a[1]=t,a[2]=t,a[3]=c,a[4]=c,a[5]=c,a}function Xf(n,t,a,r,c,u,h){var y,m,b,g,x,w,N,T,C,I,$,H,R;h==null||h(a);let p=r;{const Q=a.fullPath??a.from,ce=Q.length,Z=((y=a.options)==null?void 0:y.caseSensitive)??n,ie=!!((b=(m=a.options)==null?void 0:m.params)!=null&&b.parse&&((x=(g=a.options)==null?void 0:g.skipRouteOnParseError)!=null&&x.params));for(;p<ce;){const Y=zp(Q,p,t);let F;const _e=p,je=Y[5];switch(p=je+1,u++,Y[0]){case 0:{const ae=Q.substring(Y[2],Y[3]);if(Z){const ue=(w=c.static)==null?void 0:w.get(ae);if(ue)F=ue;else{c.static??(c.static=new Map);const E=ul(a.fullPath??a.from);E.parent=c,E.depth=u,F=E,c.static.set(ae,E)}}else{const ue=ae.toLowerCase(),E=(N=c.staticInsensitive)==null?void 0:N.get(ue);if(E)F=E;else{c.staticInsensitive??(c.staticInsensitive=new Map);const U=ul(a.fullPath??a.from);U.parent=c,U.depth=u,F=U,c.staticInsensitive.set(ue,U)}}break}case 1:{const ae=Q.substring(_e,Y[1]),ue=Q.substring(Y[4],je),E=Z&&!!(ae||ue),U=ae?E?ae:ae.toLowerCase():void 0,te=ue?E?ue:ue.toLowerCase():void 0,W=!ie&&((T=c.dynamic)==null?void 0:T.find(xe=>!xe.skipOnParamError&&xe.caseSensitive===E&&xe.prefix===U&&xe.suffix===te));if(W)F=W;else{const xe=p1(1,a.fullPath??a.from,E,U,te);F=xe,xe.depth=u,xe.parent=c,c.dynamic??(c.dynamic=[]),c.dynamic.push(xe)}break}case 3:{const ae=Q.substring(_e,Y[1]),ue=Q.substring(Y[4],je),E=Z&&!!(ae||ue),U=ae?E?ae:ae.toLowerCase():void 0,te=ue?E?ue:ue.toLowerCase():void 0,W=!ie&&((C=c.optional)==null?void 0:C.find(xe=>!xe.skipOnParamError&&xe.caseSensitive===E&&xe.prefix===U&&xe.suffix===te));if(W)F=W;else{const xe=p1(3,a.fullPath??a.from,E,U,te);F=xe,xe.parent=c,xe.depth=u,c.optional??(c.optional=[]),c.optional.push(xe)}break}case 2:{const ae=Q.substring(_e,Y[1]),ue=Q.substring(Y[4],je),E=Z&&!!(ae||ue),U=ae?E?ae:ae.toLowerCase():void 0,te=ue?E?ue:ue.toLowerCase():void 0,W=p1(2,a.fullPath??a.from,E,U,te);F=W,W.parent=c,W.depth=u,c.wildcard??(c.wildcard=[]),c.wildcard.push(W)}}c=F}if(ie&&a.children&&!a.isRoot&&a.id&&a.id.charCodeAt(a.id.lastIndexOf("/")+1)===95){const Y=ul(a.fullPath??a.from);Y.kind=a3,Y.parent=c,u++,Y.depth=u,c.pathless??(c.pathless=[]),c.pathless.push(Y),c=Y}const ee=(a.path||!a.children)&&!a.isRoot;if(ee&&Q.endsWith("/")){const Y=ul(a.fullPath??a.from);Y.kind=cl,Y.parent=c,u++,Y.depth=u,c.index=Y,c=Y}c.parse=(($=(I=a.options)==null?void 0:I.params)==null?void 0:$.parse)??null,c.skipOnParamError=ie,c.parsingPriority=((R=(H=a.options)==null?void 0:H.skipRouteOnParseError)==null?void 0:R.priority)??0,ee&&!c.route&&(c.route=a,c.fullPath=a.fullPath??a.from)}if(a.children)for(const Q of a.children)Xf(n,t,Q,p,c,u,h)}function m1(n,t){if(n.skipOnParamError&&!t.skipOnParamError)return-1;if(!n.skipOnParamError&&t.skipOnParamError)return 1;if(n.skipOnParamError&&t.skipOnParamError&&(n.parsingPriority||t.parsingPriority))return t.parsingPriority-n.parsingPriority;if(n.prefix&&t.prefix&&n.prefix!==t.prefix){if(n.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(n.prefix))return 1}if(n.suffix&&t.suffix&&n.suffix!==t.suffix){if(n.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(n.suffix))return 1}return n.prefix&&!t.prefix?-1:!n.prefix&&t.prefix?1:n.suffix&&!t.suffix?-1:!n.suffix&&t.suffix?1:n.caseSensitive&&!t.caseSensitive?-1:!n.caseSensitive&&t.caseSensitive?1:0}function rr(n){var t,a,r;if(n.pathless)for(const c of n.pathless)rr(c);if(n.static)for(const c of n.static.values())rr(c);if(n.staticInsensitive)for(const c of n.staticInsensitive.values())rr(c);if((t=n.dynamic)!=null&&t.length){n.dynamic.sort(m1);for(const c of n.dynamic)rr(c)}if((a=n.optional)!=null&&a.length){n.optional.sort(m1);for(const c of n.optional)rr(c)}if((r=n.wildcard)!=null&&r.length){n.wildcard.sort(m1);for(const c of n.wildcard)rr(c)}}function ul(n){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:n,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function p1(n,t,a,r,c){return{kind:n,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:a,prefix:r,suffix:c}}function S_(n,t){const a=ul("/"),r=new Uint16Array(6);for(const c of n)Xf(!1,r,c,1,a,0);rr(a),t.masksTree=a,t.flatCache=Df(1e3)}function j_(n,t){n||(n="/");const a=t.flatCache.get(n);if(a)return a;const r=Bp(n,t.masksTree);return t.flatCache.set(n,r),r}function w_(n,t,a,r,c){n||(n="/"),r||(r="/");const u=t?`case\0${n}`:n;let h=c.singleCache.get(u);return h||(h=ul("/"),Xf(t,new Uint16Array(6),{from:n},1,h,0),c.singleCache.set(u,h)),Bp(r,h,a)}function k_(n,t,a=!1){const r=a?n:`nofuzz\0${n}`,c=t.matchCache.get(r);if(c!==void 0)return c;n||(n="/");let u;try{u=Bp(n,t.segmentTree,a)}catch(h){if(h instanceof URIError)u=null;else throw h}return u&&(u.branch=T_(u.route)),t.matchCache.set(r,u),u}function N_(n){return n==="/"?n:n.replace(/\/{1,}$/,"")}function C_(n,t=!1,a){const r=ul(n.fullPath),c=new Uint16Array(6),u={},h={};let p=0;return Xf(t,c,n,1,r,0,y=>{if(a==null||a(y,p),Cr(!(y.id in u),`Duplicate routes found with id: ${String(y.id)}`),u[y.id]=y,p!==0&&y.path){const m=N_(y.fullPath);(!h[m]||y.fullPath.endsWith("/"))&&(h[m]=y)}p++}),rr(r),{processedTree:{segmentTree:r,singleCache:Df(1e3),matchCache:Df(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:h}}function Bp(n,t,a=!1){const r=n.split("/"),c=M_(n,r,t,a);if(!c)return null;const[u]=i3(n,r,c);return{route:c.node.route,rawParams:u,parsedParams:c.parsedParams}}function i3(n,t,a){var b,g,x,w,N,T,C,I,$,H;const r=E_(a.node);let c=null;const u=Object.create(null);let h=((b=a.extract)==null?void 0:b.part)??0,p=((g=a.extract)==null?void 0:g.node)??0,y=((x=a.extract)==null?void 0:x.path)??0,m=((w=a.extract)==null?void 0:w.segment)??0;for(;p<r.length;h++,p++,y++,m++){const R=r[p];if(R.kind===cl)break;if(R.kind===a3){m--,h--,y--;continue}const Q=t[h],ce=y;if(Q&&(y+=Q.length),R.kind===1){c??(c=a.node.fullPath.split("/"));const Z=c[m],ie=((N=R.prefix)==null?void 0:N.length)??0;if(Z.charCodeAt(ie)===123){const ee=((T=R.suffix)==null?void 0:T.length)??0,Y=Z.substring(ie+2,Z.length-ee-1),F=Q.substring(ie,Q.length-ee);u[Y]=decodeURIComponent(F)}else{const ee=Z.substring(1);u[ee]=decodeURIComponent(Q)}}else if(R.kind===3){if(a.skipped&1<<p){h--,y=ce-1;continue}c??(c=a.node.fullPath.split("/"));const Z=c[m],ie=((C=R.prefix)==null?void 0:C.length)??0,ee=((I=R.suffix)==null?void 0:I.length)??0,Y=Z.substring(ie+3,Z.length-ee-1),F=R.suffix||R.prefix?Q.substring(ie,Q.length-ee):Q;F&&(u[Y]=decodeURIComponent(F))}else if(R.kind===2){const Z=R,ie=n.substring(ce+((($=Z.prefix)==null?void 0:$.length)??0),n.length-(((H=Z.suffix)==null?void 0:H.length)??0)),ee=decodeURIComponent(ie);u["*"]=ee,u._splat=ee;break}}return a.rawParams&&Object.assign(u,a.rawParams),[u,{part:h,node:p,path:y,segment:m}]}function T_(n){const t=[n];for(;n.parentRoute;)n=n.parentRoute,t.push(n);return t.reverse(),t}function E_(n){const t=Array(n.depth+1);do t[n.depth]=n,n=n.parent;while(n);return t}function M_(n,t,a,r){if(n==="/"&&a.index)return{node:a.index,skipped:0};const c=!Su(t),u=c&&n!=="/",h=t.length-(c?1:0),p=[{node:a,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let y=null,m=null,b=null;for(;p.length;){const g=p.pop(),{node:x,index:w,skipped:N,depth:T,statics:C,dynamics:I,optionals:$}=g;let{extract:H,rawParams:R,parsedParams:Q}=g;if(x.skipOnParamError){if(!g1(n,t,g))continue;R=g.rawParams,H=g.extract,Q=g.parsedParams}r&&x.route&&x.kind!==cl&&nu(m,g)&&(m=g);const ce=w===h;if(ce&&(x.route&&!u&&nu(b,g)&&(b=g),!x.optional&&!x.wildcard&&!x.index&&!x.pathless))continue;const Z=ce?void 0:t[w];let ie;if(ce&&x.index){const ee={node:x.index,index:w,skipped:N,depth:T+1,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q};let Y=!0;if(x.index.skipOnParamError&&(g1(n,t,ee)||(Y=!1)),Y){if(C===h&&!I&&!$&&!N)return ee;nu(b,ee)&&(b=ee)}}if(x.wildcard&&nu(y,g))for(const ee of x.wildcard){const{prefix:Y,suffix:F}=ee;if(Y&&(ce||!(ee.caseSensitive?Z:ie??(ie=Z.toLowerCase())).startsWith(Y)))continue;if(F){if(ce)continue;const je=t.slice(w).join("/").slice(-F.length);if((ee.caseSensitive?je:je.toLowerCase())!==F)continue}const _e={node:ee,index:h,skipped:N,depth:T,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q};if(!(ee.skipOnParamError&&!g1(n,t,_e))){y=_e;break}}if(x.optional){const ee=N|1<<T,Y=T+1;for(let F=x.optional.length-1;F>=0;F--){const _e=x.optional[F];p.push({node:_e,index:w,skipped:ee,depth:Y,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(!ce)for(let F=x.optional.length-1;F>=0;F--){const _e=x.optional[F],{prefix:je,suffix:ae}=_e;if(je||ae){const ue=_e.caseSensitive?Z:ie??(ie=Z.toLowerCase());if(je&&!ue.startsWith(je)||ae&&!ue.endsWith(ae))continue}p.push({node:_e,index:w+1,skipped:N,depth:Y,statics:C,dynamics:I,optionals:$+1,extract:H,rawParams:R,parsedParams:Q})}}if(!ce&&x.dynamic&&Z)for(let ee=x.dynamic.length-1;ee>=0;ee--){const Y=x.dynamic[ee],{prefix:F,suffix:_e}=Y;if(F||_e){const je=Y.caseSensitive?Z:ie??(ie=Z.toLowerCase());if(F&&!je.startsWith(F)||_e&&!je.endsWith(_e))continue}p.push({node:Y,index:w+1,skipped:N,depth:T+1,statics:C,dynamics:I+1,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(!ce&&x.staticInsensitive){const ee=x.staticInsensitive.get(ie??(ie=Z.toLowerCase()));ee&&p.push({node:ee,index:w+1,skipped:N,depth:T+1,statics:C+1,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(!ce&&x.static){const ee=x.static.get(Z);ee&&p.push({node:ee,index:w+1,skipped:N,depth:T+1,statics:C+1,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}if(x.pathless){const ee=T+1;for(let Y=x.pathless.length-1;Y>=0;Y--){const F=x.pathless[Y];p.push({node:F,index:w,skipped:N,depth:ee,statics:C,dynamics:I,optionals:$,extract:H,rawParams:R,parsedParams:Q})}}}if(b&&y)return nu(y,b)?b:y;if(b)return b;if(y)return y;if(r&&m){let g=m.index;for(let w=0;w<m.index;w++)g+=t[w].length;const x=g===n.length?"/":n.slice(g);return m.rawParams??(m.rawParams=Object.create(null)),m.rawParams["**"]=decodeURIComponent(x),m}return null}function g1(n,t,a){try{const[r,c]=i3(n,t,a);a.rawParams=r,a.extract=c;const u=a.node.parse(r);return a.parsedParams=Object.assign(Object.create(null),a.parsedParams,u),!0}catch{return null}}function nu(n,t){return n?t.statics>n.statics||t.statics===n.statics&&(t.dynamics>n.dynamics||t.dynamics===n.dynamics&&(t.optionals>n.optionals||t.optionals===n.optionals&&((t.node.kind===cl)>(n.node.kind===cl)||t.node.kind===cl==(n.node.kind===cl)&&t.depth>n.depth))):!0}function Sf(n){return Pp(n.filter(t=>t!==void 0).join("/"))}function Pp(n){return n.replace(/\/{2,}/g,"/")}function r3(n){return n==="/"?n:n.replace(/^\/{1,}/,"")}function jr(n){const t=n.length;return t>1&&n[t-1]==="/"?n.replace(/\/{1,}$/,""):n}function l3(n){return jr(r3(n))}function Of(n,t){return n!=null&&n.endsWith("/")&&n!=="/"&&n!==`${t}/`?n.slice(0,-1):n}function R_(n,t,a){return Of(n,a)===Of(t,a)}function A_({base:n,to:t,trailingSlash:a="never",cache:r}){const c=t.startsWith("/"),u=!c&&t===".";let h;if(r){h=c?t:u?n:n+"\0"+t;const g=r.get(h);if(g)return g}let p;if(u)p=n.split("/");else if(c)p=t.split("/");else{for(p=n.split("/");p.length>1&&Su(p)==="";)p.pop();const g=t.split("/");for(let x=0,w=g.length;x<w;x++){const N=g[x];N===""?x?x===w-1&&p.push(N):p=[N]:N===".."?p.pop():N==="."||p.push(N)}}p.length>1&&(Su(p)===""?a==="never"&&p.pop():a==="always"&&p.push(""));let y,m="";for(let g=0;g<p.length;g++){g>0&&(m+="/");const x=p[g];if(!x)continue;y=zp(x,0,y);const w=y[0];if(w===0){m+=x;continue}const N=y[5],T=x.substring(0,y[1]),C=x.substring(y[4],N),I=x.substring(y[2],y[3]);w===1?m+=T||C?`${T}{$${I}}${C}`:`$${I}`:w===2?m+=T||C?`${T}{$}${C}`:"$":m+=`${T}{-$${I}}${C}`}m=Pp(m);const b=m||"/";return h&&r&&r.set(h,b),b}function D_(n){const t=new Map(n.map(c=>[encodeURIComponent(c),c])),a=Array.from(t.keys()).map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(a,"g");return c=>c.replace(r,u=>t.get(u)??u)}function y1(n,t,a){const r=t[n];return typeof r!="string"?r:n==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(c=>q4(c,a)).join("/"):q4(r,a)}function U4({path:n,params:t,decoder:a,...r}){let c=!1;const u=Object.create(null);if(!n||n==="/")return{interpolatedPath:"/",usedParams:u,isMissingParams:c};if(!n.includes("$"))return{interpolatedPath:n,usedParams:u,isMissingParams:c};const h=n.length;let p=0,y,m="";for(;p<h;){const b=p;y=zp(n,b,y);const g=y[5];if(p=g+1,b===g)continue;const x=y[0];if(x===0){m+="/"+n.substring(b,g);continue}if(x===2){const w=t._splat;u._splat=w,u["*"]=w;const N=n.substring(b,y[1]),T=n.substring(y[4],g);if(!w){c=!0,(N||T)&&(m+="/"+N+T);continue}const C=y1("_splat",t,a);m+="/"+N+C+T;continue}if(x===1){const w=n.substring(y[2],y[3]);!c&&!(w in t)&&(c=!0),u[w]=t[w];const N=n.substring(b,y[1]),T=n.substring(y[4],g),C=y1(w,t,a)??"undefined";m+="/"+N+C+T;continue}if(x===3){const w=n.substring(y[2],y[3]),N=t[w];if(N==null)continue;u[w]=N;const T=n.substring(b,y[1]),C=n.substring(y[4],g),I=y1(w,t,a)??"";m+="/"+T+I+C;continue}}return n.endsWith("/")&&(m+="/"),{usedParams:u,interpolatedPath:m||"/",isMissingParams:c}}function q4(n,t){const a=encodeURIComponent(n);return(t==null?void 0:t(a))??a}function hs(n){return!!(n!=null&&n.isNotFound)}function O_(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var np="tsr-scroll-restoration-v1_3",L_=(n,t)=>{let a;return(...r)=>{a||(a=setTimeout(()=>{n(...r),a=null},t))}};function I_(){const n=O_();if(!n)return null;const t=n.getItem(np);let a=t?JSON.parse(t):{};return{state:a,set:r=>{a=_r(r,a)||a;try{n.setItem(np,JSON.stringify(a))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var mf=I_(),z_=n=>n.state.__TSR_key||n.href;function B_(n){const t=[];let a;for(;a=n.parentNode;)t.push(`${n.tagName}:nth-child(${Array.prototype.indexOf.call(a.children,n)+1})`),n=a;return`${t.reverse().join(" > ")}`.toLowerCase()}var Lf=!1;function P_({storageKey:n,key:t,behavior:a,shouldScrollRestoration:r,scrollToTopSelectors:c,location:u}){var m,b;let h;try{h=JSON.parse(sessionStorage.getItem(n)||"{}")}catch(g){console.error(g);return}const p=t||((m=window.history.state)==null?void 0:m.__TSR_key),y=h[p];Lf=!0;e:{if(r&&y&&Object.keys(y).length>0){for(const w in y){const N=y[w];if(w==="window")window.scrollTo({top:N.scrollY,left:N.scrollX,behavior:a});else if(w){const T=document.querySelector(w);T&&(T.scrollLeft=N.scrollX,T.scrollTop=N.scrollY)}}break e}const g=(u??window.location).hash.split("#",2)[1];if(g){const w=((b=window.history.state)==null?void 0:b.__hashScrollIntoViewOptions)??!0;if(w){const N=document.getElementById(g);N&&N.scrollIntoView(w)}break e}const x={top:0,left:0,behavior:a};if(window.scrollTo(x),c)for(const w of c){if(w==="window")continue;const N=typeof w=="function"?w():document.querySelector(w);N&&N.scrollTo(x)}}Lf=!1}function U_(n,t){if(!mf||((n.options.scrollRestoration??!1)&&(n.isScrollRestoring=!0),n.isScrollRestorationSetup||!mf))return;n.isScrollRestorationSetup=!0,Lf=!1;const a=n.options.getScrollRestorationKey||z_;window.history.scrollRestoration="manual";const r=c=>{if(Lf||!n.isScrollRestoring)return;let u="";if(c.target===document||c.target===window)u="window";else{const p=c.target.getAttribute("data-scroll-restoration-id");p?u=`[data-scroll-restoration-id="${p}"]`:u=B_(c.target)}const h=a(n.state.location);mf.set(p=>{const y=p[h]||(p[h]={}),m=y[u]||(y[u]={});if(u==="window")m.scrollX=window.scrollX||0,m.scrollY=window.scrollY||0;else if(u){const b=document.querySelector(u);b&&(m.scrollX=b.scrollLeft||0,m.scrollY=b.scrollTop||0)}return p})};typeof document<"u"&&document.addEventListener("scroll",L_(r,100),!0),n.subscribe("onRendered",c=>{const u=a(c.toLocation);if(!n.resetNextScroll){n.resetNextScroll=!0;return}typeof n.options.scrollRestoration=="function"&&!n.options.scrollRestoration({location:n.latestLocation})||(P_({storageKey:np,key:u,behavior:n.options.scrollRestorationBehavior,shouldScrollRestoration:n.isScrollRestoring,scrollToTopSelectors:n.options.scrollToTopSelectors,location:n.history.location}),n.isScrollRestoring&&mf.set(h=>(h[u]||(h[u]={}),h)))})}function q_(n){if(typeof document<"u"&&document.querySelector){const t=n.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&n.state.location.hash!==""){const a=document.getElementById(n.state.location.hash);a&&a.scrollIntoView(t)}}}function $_(n,t=String){const a=new URLSearchParams;for(const r in n){const c=n[r];c!==void 0&&a.set(r,t(c))}return a.toString()}function v1(n){return n?n==="false"?!1:n==="true"?!0:+n*0===0&&+n+""===n?+n:n:""}function H_(n){const t=new URLSearchParams(n),a=Object.create(null);for(const[r,c]of t.entries()){const u=a[r];u==null?a[r]=v1(c):Array.isArray(u)?u.push(v1(c)):a[r]=[u,v1(c)]}return a}var F_=G_(JSON.parse),Q_=V_(JSON.stringify,JSON.parse);function G_(n){return t=>{t[0]==="?"&&(t=t.substring(1));const a=H_(t);for(const r in a){const c=a[r];if(typeof c=="string")try{a[r]=n(c)}catch{}}return a}}function V_(n,t){const a=typeof t=="function";function r(c){if(typeof c=="object"&&c!==null)try{return n(c)}catch{}else if(a&&typeof c=="string")try{return t(c),n(c)}catch{}return c}return c=>{const u=$_(c,r);return u?`?${u}`:""}}var xl="__root__";function K_(n){if(n.statusCode=n.statusCode||n.code||307,!n._builtLocation&&!n.reloadDocument&&typeof n.href=="string")try{new URL(n.href),n.reloadDocument=!0}catch{}const t=new Headers(n.headers);n.href&&t.get("Location")===null&&t.set("Location",n.href);const a=new Response(null,{status:n.statusCode,headers:t});if(a.options=n,n.throw)throw a;return a}function Ms(n){return n instanceof Response&&!!n.options}function Y_(n){return{input:({url:t})=>{for(const a of n)t=sp(a,t);return t},output:({url:t})=>{for(let a=n.length-1;a>=0;a--)t=o3(n[a],t);return t}}}function Z_(n){const t=l3(n.basepath),a=`/${t}`,r=`${a}/`,c=n.caseSensitive?a:a.toLowerCase(),u=n.caseSensitive?r:r.toLowerCase();return{input:({url:h})=>{const p=n.caseSensitive?h.pathname:h.pathname.toLowerCase();return p===c?h.pathname="/":p.startsWith(u)&&(h.pathname=h.pathname.slice(a.length)),h},output:({url:h})=>(h.pathname=Sf(["/",t,h.pathname]),h)}}function sp(n,t){var r;const a=(r=n==null?void 0:n.input)==null?void 0:r.call(n,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}function o3(n,t){var r;const a=(r=n==null?void 0:n.output)==null?void 0:r.call(n,{url:t});if(a){if(typeof a=="string")return new URL(a);if(a instanceof URL)return a}return t}var mn=(n=>(n[n.None=0]="None",n[n.Mutable=1]="Mutable",n[n.Watching=2]="Watching",n[n.RecursedCheck=4]="RecursedCheck",n[n.Recursed=8]="Recursed",n[n.Dirty=16]="Dirty",n[n.Pending=32]="Pending",n))(mn||{});function c3({update:n,notify:t,unwatched:a}){return{link:r,unlink:c,propagate:u,checkDirty:h,shallowPropagate:p};function r(m,b,g){const x=b.depsTail;if(x!==void 0&&x.dep===m)return;const w=x!==void 0?x.nextDep:b.deps;if(w!==void 0&&w.dep===m){w.version=g,b.depsTail=w;return}const N=m.subsTail;if(N!==void 0&&N.version===g&&N.sub===b)return;const T=b.depsTail=m.subsTail={version:g,dep:m,sub:b,prevDep:x,nextDep:w,prevSub:N,nextSub:void 0};w!==void 0&&(w.prevDep=T),x!==void 0?x.nextDep=T:b.deps=T,N!==void 0?N.nextSub=T:m.subs=T}function c(m,b=m.sub){const g=m.dep,x=m.prevDep,w=m.nextDep,N=m.nextSub,T=m.prevSub;return w!==void 0?w.prevDep=x:b.depsTail=x,x!==void 0?x.nextDep=w:b.deps=w,N!==void 0?N.prevSub=T:g.subsTail=T,T!==void 0?T.nextSub=N:(g.subs=N)===void 0&&a(g),w}function u(m){let b=m.nextSub,g;e:do{const x=m.sub;let w=x.flags;if(w&60?w&12?w&4?!(w&48)&&y(m,x)?(x.flags=w|40,w&=1):w=0:x.flags=w&-9|32:w=0:x.flags=w|32,w&2&&t(x),w&1){const N=x.subs;if(N!==void 0){const T=(m=N).nextSub;T!==void 0&&(g={value:b,prev:g},b=T);continue}}if((m=b)!==void 0){b=m.nextSub;continue}for(;g!==void 0;)if(m=g.value,g=g.prev,m!==void 0){b=m.nextSub;continue e}break}while(!0)}function h(m,b){let g,x=0,w=!1;e:do{const N=m.dep,T=N.flags;if(b.flags&16)w=!0;else if((T&17)===17){if(n(N)){const C=N.subs;C.nextSub!==void 0&&p(C),w=!0}}else if((T&33)===33){(m.nextSub!==void 0||m.prevSub!==void 0)&&(g={value:m,prev:g}),m=N.deps,b=N,++x;continue}if(!w){const C=m.nextDep;if(C!==void 0){m=C;continue}}for(;x--;){const C=b.subs,I=C.nextSub!==void 0;if(I?(m=g.value,g=g.prev):m=C,w){if(n(b)){I&&p(C),b=m.sub;continue}w=!1}else b.flags&=-33;b=m.sub;const $=m.nextDep;if($!==void 0){m=$;continue e}}return w}while(!0)}function p(m){do{const b=m.sub,g=b.flags;(g&48)===32&&(b.flags=g|16,(g&6)===2&&t(b))}while((m=m.nextSub)!==void 0)}function y(m,b){let g=b.depsTail;for(;g!==void 0;){if(g===m)return!0;g=g.prevDep}return!1}}let Up=0,al=0,yu=0;const bi=[],{link:bN,unlink:u3,propagate:xN,checkDirty:W_,shallowPropagate:SN}=c3({update(n){return n.depsTail!==void 0?t9(n):n9(n)},notify(n){var r;let t=yu,a=t;do if(bi[t++]=n,n.flags&=-3,n=(r=n.subs)==null?void 0:r.sub,n===void 0||!(n.flags&2))break;while(!0);for(yu=t;a<--t;){const c=bi[a];bi[a++]=bi[t],bi[t]=c}},unwatched(n){n.flags&1?n.depsTail!==void 0&&(n.depsTail=void 0,n.flags=17,Jf(n)):i9.call(n)}});function X_(){return Up}function J_(){++Up}function e9(){--Up||a9()}function t9(n){n.depsTail=void 0,n.flags=5;try{const t=n.value;return t!==(n.value=n.getter(t))}finally{n.flags&=-5,Jf(n)}}function n9(n){return n.flags=1,n.currentValue!==(n.currentValue=n.pendingValue)}function s9(n){const t=n.flags;if(t&16||t&32&&W_(n.deps,n)){n.depsTail=void 0,n.flags=6;try{n.fn()}finally{n.flags&=-5,Jf(n)}}else n.flags=2}function a9(){try{for(;al<yu;){const n=bi[al];bi[al++]=void 0,s9(n)}}finally{for(;al<yu;){const n=bi[al];bi[al++]=void 0,n.flags|=10}al=0,yu=0}}function i9(){this.depsTail=void 0,this.flags=0,Jf(this);const n=this.subs;n!==void 0&&u3(n)}function Jf(n){const t=n.depsTail;let a=t!==void 0?t.nextDep:n.deps;for(;a!==void 0;)a=u3(a,n)}function qp(n,t,a){var u,h,p;const r=typeof n=="object",c=r?n:void 0;return{next:(u=r?n.next:n)==null?void 0:u.bind(c),error:(h=r?n.error:t)==null?void 0:h.bind(c),complete:(p=r?n.complete:a)==null?void 0:p.bind(c)}}const ap=[];let jf=0;const{link:$4,unlink:r9,propagate:l9,checkDirty:d3,shallowPropagate:H4}=c3({update(n){return n._update()},notify(n){ap[ip++]=n,n.flags&=~mn.Watching},unwatched(n){n.depsTail!==void 0&&(n.depsTail=void 0,n.flags=mn.Mutable|mn.Dirty,If(n))}});let pf=0,ip=0,Ba;function If(n){const t=n.depsTail;let a=t!==void 0?t.nextDep:n.deps;for(;a!==void 0;)a=r9(a,n)}function f3(){if(!(X_()>0)){for(;pf<ip;){const n=ap[pf];ap[pf++]=void 0,n.notify()}pf=0,ip=0}}function h3(n,t){const a=typeof n=="function",r=n,c={_snapshot:a?void 0:n,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:a?mn.None:mn.Mutable,get(){return Ba!==void 0&&$4(c,Ba,jf),c._snapshot},subscribe(u){const h=qp(u),p={current:!1},y=o9(()=>{var m;c.get(),p.current?(m=h.next)==null||m.call(h,c._snapshot):p.current=!0});return{unsubscribe:()=>{y.stop()}}},_update(u){const h=Ba,p=Object.is;if(a)Ba=c,++jf,c.depsTail=void 0;else if(u===void 0)return!1;a&&(c.flags=mn.Mutable|mn.RecursedCheck);try{const y=c._snapshot,m=typeof u=="function"?u(y):u===void 0&&a?r(y):u;return y===void 0||!p(y,m)?(c._snapshot=m,!0):!1}finally{Ba=h,a&&(c.flags&=~mn.RecursedCheck),If(c)}}};return a?(c.flags=mn.Mutable|mn.Dirty,c.get=function(){const u=c.flags;if(u&mn.Dirty||u&mn.Pending&&d3(c.deps,c)){if(c._update()){const h=c.subs;h!==void 0&&H4(h)}}else u&mn.Pending&&(c.flags=u&~mn.Pending);return Ba!==void 0&&$4(c,Ba,jf),c._snapshot}):c.set=function(u){if(c._update(u)){const h=c.subs;h!==void 0&&(l9(h),H4(h),f3())}},c}function o9(n){const t=()=>{const r=Ba;Ba=a,++jf,a.depsTail=void 0,a.flags=mn.Watching|mn.RecursedCheck;try{return n()}finally{Ba=r,a.flags&=~mn.RecursedCheck,If(a)}},a={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:mn.Watching|mn.RecursedCheck,notify(){const r=this.flags;r&mn.Dirty||r&mn.Pending&&d3(this.deps,this)?t():this.flags=mn.Watching},stop(){this.flags=mn.None,this.depsTail=void 0,If(this)}};return t(),a}class c9{constructor(t){this.atom=h3(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(qp(t))}}class u9{constructor(t){this.atom=h3(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(qp(t))}}function d9(n){return typeof n=="function"?new u9(n):new c9(n)}function f9(n){try{J_(),n()}finally{e9(),f3()}}function vu(n){let t;return f9(()=>{t=n()}),t}var rp=n=>{var t;if(!n.rendered)return n.rendered=!0,(t=n.onReady)==null?void 0:t.call(n)},eh=(n,t)=>!!(n.preload&&!n.router.state.matches.some(a=>a.id===t)),Sl=(n,t,a=!0)=>{const r={...n.router.options.context??{}},c=a?t:t-1;for(let u=0;u<=c;u++){const h=n.matches[u];if(!h)continue;const p=n.router.getMatch(h.id);p&&Object.assign(r,p.__routeContext,p.__beforeLoadContext)}return r},F4=(n,t)=>{if(!n.matches.length)return;const a=t.routeId,r=n.matches.findIndex(h=>h.routeId===n.router.routeTree.id),c=r>=0?r:0;let u=a?n.matches.findIndex(h=>h.routeId===a):n.firstBadMatchIndex??n.matches.length-1;u<0&&(u=c);for(let h=u;h>=0;h--){const p=n.matches[h];if(n.router.looseRoutesById[p.routeId].options.notFoundComponent)return h}return a?u:c},br=(n,t,a)=>{var r,c,u;if(!(!Ms(a)&&!hs(a)))throw Ms(a)&&a.redirectHandled&&!a.options.reloadDocument||(t&&((r=t._nonReactive.beforeLoadPromise)==null||r.resolve(),(c=t._nonReactive.loaderPromise)==null||c.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=a,n.updateMatch(t.id,h=>({...h,status:Ms(a)?"redirected":h.status==="pending"?"success":h.status,context:Sl(n,t.index),isFetching:!1,error:a})),hs(a)&&!a.routeId&&(a.routeId=t.routeId),(u=t._nonReactive.loadPromise)==null||u.resolve()),Ms(a)&&(n.rendered=!0,a.options._fromLocation=n.location,a.redirectHandled=!0,a=n.router.resolveRedirect(a))),a},m3=(n,t)=>{const a=n.router.getMatch(t);return!!(!a||a._nonReactive.dehydrated)},Q4=(n,t,a)=>{const r=Sl(n,a);n.updateMatch(t,c=>({...c,context:r}))},su=(n,t,a,r)=>{var p,y;const{id:c,routeId:u}=n.matches[t],h=n.router.looseRoutesById[u];if(a instanceof Promise)throw a;a.routerCode=r,n.firstBadMatchIndex??(n.firstBadMatchIndex=t),br(n,n.router.getMatch(c),a);try{(y=(p=h.options).onError)==null||y.call(p,a)}catch(m){a=m,br(n,n.router.getMatch(c),a)}n.updateMatch(c,m=>{var b,g;return(b=m._nonReactive.beforeLoadPromise)==null||b.resolve(),m._nonReactive.beforeLoadPromise=void 0,(g=m._nonReactive.loadPromise)==null||g.resolve(),{...m,error:a,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!n.preload&&!Ms(a)&&!hs(a)&&(n.serialError??(n.serialError=a))},p3=(n,t,a,r)=>{var u;if(r._nonReactive.pendingTimeout!==void 0)return;const c=a.options.pendingMs??n.router.options.defaultPendingMs;if(n.onReady&&!eh(n,t)&&(a.options.loader||a.options.beforeLoad||y3(a))&&typeof c=="number"&&c!==1/0&&(a.options.pendingComponent??((u=n.router.options)==null?void 0:u.defaultPendingComponent))){const h=setTimeout(()=>{rp(n)},c);r._nonReactive.pendingTimeout=h}},h9=(n,t,a)=>{const r=n.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;p3(n,t,a,r);const c=()=>{const u=n.router.getMatch(t);u.preload&&(u.status==="redirected"||u.status==="notFound")&&br(n,u,u.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(c):c()},m9=(n,t,a,r)=>{const c=n.router.getMatch(t);let u=c._nonReactive.loadPromise;c._nonReactive.loadPromise=$o(()=>{u==null||u.resolve(),u=void 0});const{paramsError:h,searchError:p}=c;h&&su(n,a,h,"PARSE_PARAMS"),p&&su(n,a,p,"VALIDATE_SEARCH"),p3(n,t,r,c);const y=new AbortController;let m=!1;const b=()=>{m||(m=!0,n.updateMatch(t,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:y})))},g=()=>{var R;(R=c._nonReactive.beforeLoadPromise)==null||R.resolve(),c._nonReactive.beforeLoadPromise=void 0,n.updateMatch(t,Q=>({...Q,isFetching:!1}))};if(!r.options.beforeLoad){vu(()=>{b(),g()});return}c._nonReactive.beforeLoadPromise=$o();const x={...Sl(n,a,!1),...c.__routeContext},{search:w,params:N,cause:T}=c,C=eh(n,t),I={search:w,abortController:y,params:N,preload:C,context:x,location:n.location,navigate:R=>n.router.navigate({...R,_fromLocation:n.location}),buildLocation:n.router.buildLocation,cause:C?"preload":T,matches:n.matches,routeId:r.id,...n.router.options.additionalContext},$=R=>{if(R===void 0){vu(()=>{b(),g()});return}(Ms(R)||hs(R))&&(b(),su(n,a,R,"BEFORE_LOAD")),vu(()=>{b(),n.updateMatch(t,Q=>({...Q,__beforeLoadContext:R})),g()})};let H;try{if(H=r.options.beforeLoad(I),ju(H))return b(),H.catch(R=>{su(n,a,R,"BEFORE_LOAD")}).then($)}catch(R){b(),su(n,a,R,"BEFORE_LOAD")}$(H)},p9=(n,t)=>{const{id:a,routeId:r}=n.matches[t],c=n.router.looseRoutesById[r],u=()=>p(),h=()=>m9(n,a,t,c),p=()=>{if(m3(n,a))return;const y=h9(n,a,c);return ju(y)?y.then(h):h()};return u()},g9=(n,t,a)=>{var u,h,p,y,m,b;const r=n.router.getMatch(t);if(!r||!a.options.head&&!a.options.scripts&&!a.options.headers)return;const c={ssr:n.router.options.ssr,matches:n.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([(h=(u=a.options).head)==null?void 0:h.call(u,c),(y=(p=a.options).scripts)==null?void 0:y.call(p,c),(b=(m=a.options).headers)==null?void 0:b.call(m,c)]).then(([g,x,w])=>({meta:g==null?void 0:g.meta,links:g==null?void 0:g.links,headScripts:g==null?void 0:g.scripts,headers:w,scripts:x,styles:g==null?void 0:g.styles}))},g3=(n,t,a,r,c)=>{const u=t[r-1],{params:h,loaderDeps:p,abortController:y,cause:m}=n.router.getMatch(a),b=Sl(n,r),g=eh(n,a);return{params:h,deps:p,preload:!!g,parentMatchPromise:u,abortController:y,context:b,location:n.location,navigate:x=>n.router.navigate({...x,_fromLocation:n.location}),cause:g?"preload":m,route:c,...n.router.options.additionalContext}},G4=async(n,t,a,r,c)=>{var u,h,p,y,m;try{const b=n.router.getMatch(a);try{(!(h_??n.router.isServer)||b.ssr===!0)&&wu(c);const g=c.options.loader,x=typeof g=="function"?g:g==null?void 0:g.handler,w=x==null?void 0:x(g3(n,t,a,r,c)),N=!!x&&ju(w);if((N||c._lazyPromise||c._componentsPromise||c.options.head||c.options.scripts||c.options.headers||b._nonReactive.minPendingPromise)&&n.updateMatch(a,C=>({...C,isFetching:"loader"})),x){const C=N?await w:w;br(n,n.router.getMatch(a),C),C!==void 0&&n.updateMatch(a,I=>({...I,loaderData:C}))}c._lazyPromise&&await c._lazyPromise;const T=b._nonReactive.minPendingPromise;T&&await T,c._componentsPromise&&await c._componentsPromise,n.updateMatch(a,C=>({...C,error:void 0,context:Sl(n,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(g){let x=g;if((x==null?void 0:x.name)==="AbortError"){if(b.abortController.signal.aborted){(u=b._nonReactive.loaderPromise)==null||u.resolve(),b._nonReactive.loaderPromise=void 0;return}n.updateMatch(a,N=>({...N,status:N.status==="pending"?"success":N.status,isFetching:!1,context:Sl(n,r)}));return}const w=b._nonReactive.minPendingPromise;w&&await w,hs(g)&&await((p=(h=c.options.notFoundComponent)==null?void 0:h.preload)==null?void 0:p.call(h)),br(n,n.router.getMatch(a),g);try{(m=(y=c.options).onError)==null||m.call(y,g)}catch(N){x=N,br(n,n.router.getMatch(a),N)}!Ms(x)&&!hs(x)&&await wu(c,["errorComponent"]),n.updateMatch(a,N=>({...N,error:x,context:Sl(n,r),status:"error",isFetching:!1}))}}catch(b){const g=n.router.getMatch(a);g&&(g._nonReactive.loaderPromise=void 0),br(n,g,b)}},y9=async(n,t,a)=>{var w,N,T,C;async function r(I,$,H,R,Q){const ce=Date.now()-$.updatedAt,Z=I?Q.options.preloadStaleTime??n.router.options.defaultPreloadStaleTime??3e4:Q.options.staleTime??n.router.options.defaultStaleTime??0,ie=Q.options.shouldReload,ee=typeof ie=="function"?ie(g3(n,t,c,a,Q)):ie,{status:Y,invalid:F}=R,_e=ce>Z&&(!!n.forceStaleReload||R.cause==="enter"||H!==void 0&&H!==R.id);h=Y==="success"&&(F||(ee??_e)),I&&Q.options.preload===!1||(h&&!n.sync&&b?(p=!0,(async()=>{var je,ae;try{await G4(n,t,c,a,Q);const ue=n.router.getMatch(c);(je=ue._nonReactive.loaderPromise)==null||je.resolve(),(ae=ue._nonReactive.loadPromise)==null||ae.resolve(),ue._nonReactive.loaderPromise=void 0,ue._nonReactive.loadPromise=void 0}catch(ue){Ms(ue)&&await n.router.navigate(ue.options)}})()):Y!=="success"||h?await G4(n,t,c,a,Q):Q4(n,c,a))}const{id:c,routeId:u}=n.matches[a];let h=!1,p=!1;const y=n.router.looseRoutesById[u],m=y.options.loader,b=((typeof m=="function"||m==null?void 0:m.staleReloadMode)??n.router.options.defaultStaleReloadMode)!=="blocking";if(m3(n,c)){if(!n.router.getMatch(c))return n.matches[a];Q4(n,c,a)}else{const I=n.router.getMatch(c),$=((w=n.router.state.matches[a])==null?void 0:w.routeId)===u?n.router.state.matches[a].id:(N=n.router.state.matches.find(R=>R.routeId===u))==null?void 0:N.id,H=eh(n,c);if(I._nonReactive.loaderPromise){if(I.status==="success"&&!n.sync&&!I.preload&&b)return I;await I._nonReactive.loaderPromise;const R=n.router.getMatch(c),Q=R._nonReactive.error||R.error;Q&&br(n,R,Q),R.status==="pending"&&await r(H,I,$,R,y)}else{const R=H&&!n.router.state.matches.some(ce=>ce.id===c),Q=n.router.getMatch(c);Q._nonReactive.loaderPromise=$o(),R!==Q.preload&&n.updateMatch(c,ce=>({...ce,preload:R})),await r(H,I,$,Q,y)}}const g=n.router.getMatch(c);p||((T=g._nonReactive.loaderPromise)==null||T.resolve(),(C=g._nonReactive.loadPromise)==null||C.resolve(),g._nonReactive.loadPromise=void 0),clearTimeout(g._nonReactive.pendingTimeout),g._nonReactive.pendingTimeout=void 0,p||(g._nonReactive.loaderPromise=void 0),g._nonReactive.dehydrated=void 0;const x=p?g.isFetching:!1;return x!==g.isFetching||g.invalid!==!1?(n.updateMatch(c,I=>({...I,isFetching:x,invalid:!1})),n.router.getMatch(c)):g};async function V4(n){var x,w;const t=n,a=[];t.router.state.matches.some(N=>N._forcePending)&&rp(t);let r;for(let N=0;N<t.matches.length;N++){try{const T=p9(t,N);ju(T)&&await T}catch(T){if(Ms(T))throw T;if(hs(T))r=T;else if(!t.preload)throw T;break}if(t.serialError)break}const c=t.firstBadMatchIndex??t.matches.length,u=r&&!t.preload?F4(t,r):void 0,h=r&&t.preload?0:u!==void 0?Math.min(u+1,c):c;let p,y;for(let N=0;N<h;N++)a.push(y9(t,a,N));try{await Promise.all(a)}catch{const N=await Promise.allSettled(a);for(const T of N){if(T.status!=="rejected")continue;const C=T.reason;if(Ms(C))throw C;hs(C)?p??(p=C):y??(y=C)}if(y!==void 0)throw y}const m=p??(r&&!t.preload?r:void 0);let b=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!m&&r&&t.preload)return t.matches;if(m){const N=F4(t,m);Cr(N!==void 0);const T=t.matches[N],C=t.router.looseRoutesById[T.routeId],I=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!C.options.notFoundComponent&&I&&(C.options.notFoundComponent=I),m.routeId=T.routeId;const $=T.routeId===t.router.routeTree.id;t.updateMatch(T.id,H=>({...H,...$?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:m},isFetching:!1})),b=N,await wu(C,["notFoundComponent"])}else if(!t.preload){const N=t.matches[0];N.globalNotFound||(w=t.router.getMatch(N.id))!=null&&w.globalNotFound&&t.updateMatch(N.id,T=>({...T,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const N=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await wu(N,["errorComponent"])}for(let N=0;N<=b;N++){const{id:T,routeId:C}=t.matches[N],I=t.router.looseRoutesById[C];try{const $=g9(t,T,I);if($){const H=await $;t.updateMatch(T,R=>({...R,...H}))}}catch($){console.error(`Error executing head for route ${C}:`,$)}}const g=rp(t);if(ju(g)&&await g,m)throw m;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function K4(n,t){const a=t.map(r=>{var c,u;return(u=(c=n.options[r])==null?void 0:c.preload)==null?void 0:u.call(c)}).filter(Boolean);if(a.length!==0)return Promise.all(a)}function wu(n,t=wf){!n._lazyLoaded&&n._lazyPromise===void 0&&(n.lazyFn?n._lazyPromise=n.lazyFn().then(r=>{const{id:c,...u}=r.options;Object.assign(n.options,u),n._lazyLoaded=!0,n._lazyPromise=void 0}):n._lazyLoaded=!0);const a=()=>n._componentsLoaded?void 0:t===wf?(()=>{if(n._componentsPromise===void 0){const r=K4(n,wf);r?n._componentsPromise=r.then(()=>{n._componentsLoaded=!0,n._componentsPromise=void 0}):n._componentsLoaded=!0}return n._componentsPromise})():K4(n,t);return n._lazyPromise?n._lazyPromise.then(a):a()}function y3(n){var t;for(const a of wf)if((t=n.options[a])!=null&&t.preload)return!0;return!1}var wf=["component","errorComponent","pendingComponent","notFoundComponent"],wr="__TSR_index",Y4="popstate",Z4="beforeunload";function v9(n){let t=n.getLocation();const a=new Set,r=h=>{t=n.getLocation(),a.forEach(p=>p({location:t,action:h}))},c=h=>{n.notifyOnIndexChange??!0?r(h):t=n.getLocation()},u=async({task:h,navigateOpts:p,...y})=>{var g,x;if((p==null?void 0:p.ignoreBlocker)??!1){h();return}const m=((g=n.getBlockers)==null?void 0:g.call(n))??[],b=y.type==="PUSH"||y.type==="REPLACE";if(typeof document<"u"&&m.length&&b)for(const w of m){const N=zf(y.path,y.state);if(await w.blockerFn({currentLocation:t,nextLocation:N,action:y.type})){(x=n.onBlocked)==null||x.call(n);return}}h()};return{get location(){return t},get length(){return n.getLength()},subscribers:a,subscribe:h=>(a.add(h),()=>{a.delete(h)}),push:(h,p,y)=>{const m=t.state[wr];p=W4(m+1,p),u({task:()=>{n.pushState(h,p),r({type:"PUSH"})},navigateOpts:y,type:"PUSH",path:h,state:p})},replace:(h,p,y)=>{const m=t.state[wr];p=W4(m,p),u({task:()=>{n.replaceState(h,p),r({type:"REPLACE"})},navigateOpts:y,type:"REPLACE",path:h,state:p})},go:(h,p)=>{u({task:()=>{n.go(h),c({type:"GO",index:h})},navigateOpts:p,type:"GO"})},back:h=>{u({task:()=>{n.back((h==null?void 0:h.ignoreBlocker)??!1),c({type:"BACK"})},navigateOpts:h,type:"BACK"})},forward:h=>{u({task:()=>{n.forward((h==null?void 0:h.ignoreBlocker)??!1),c({type:"FORWARD"})},navigateOpts:h,type:"FORWARD"})},canGoBack:()=>t.state[wr]!==0,createHref:h=>n.createHref(h),block:h=>{var y;if(!n.setBlockers)return()=>{};const p=((y=n.getBlockers)==null?void 0:y.call(n))??[];return n.setBlockers([...p,h]),()=>{var b,g;const m=((b=n.getBlockers)==null?void 0:b.call(n))??[];(g=n.setBlockers)==null||g.call(n,m.filter(x=>x!==h))}},flush:()=>{var h;return(h=n.flush)==null?void 0:h.call(n)},destroy:()=>{var h;return(h=n.destroy)==null?void 0:h.call(n)},notify:r}}function W4(n,t){t||(t={});const a=$p();return{...t,key:a,__TSR_key:a,[wr]:n}}function _9(n){var ie,ee;const t=typeof document<"u"?window:void 0,a=t.history.pushState,r=t.history.replaceState;let c=[];const u=()=>c,h=Y=>c=Y,p=(Y=>Y),y=(()=>zf(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((ie=t.history.state)!=null&&ie.__TSR_key)&&!((ee=t.history.state)!=null&&ee.key)){const Y=$p();t.history.replaceState({[wr]:0,key:Y,__TSR_key:Y},"")}let m=y(),b,g=!1,x=!1,w=!1,N=!1;const T=()=>m;let C,I;const $=()=>{C&&(Z._ignoreSubscribers=!0,(C.isPush?t.history.pushState:t.history.replaceState)(C.state,"",C.href),Z._ignoreSubscribers=!1,C=void 0,I=void 0,b=void 0)},H=(Y,F,_e)=>{const je=p(F);I||(b=m),m=zf(F,_e),C={href:je,state:_e,isPush:(C==null?void 0:C.isPush)||Y==="push"},I||(I=Promise.resolve().then(()=>$()))},R=Y=>{m=y(),Z.notify({type:Y})},Q=async()=>{if(x){x=!1;return}const Y=y(),F=Y.state[wr]-m.state[wr],_e=F===1,je=F===-1,ae=!_e&&!je||g;g=!1;const ue=ae?"GO":je?"BACK":"FORWARD",E=ae?{type:"GO",index:F}:{type:je?"BACK":"FORWARD"};if(w)w=!1;else{const U=u();if(typeof document<"u"&&U.length){for(const te of U)if(await te.blockerFn({currentLocation:m,nextLocation:Y,action:ue})){x=!0,t.history.go(1),Z.notify(E);return}}}m=y(),Z.notify(E)},ce=Y=>{if(N){N=!1;return}let F=!1;const _e=u();if(typeof document<"u"&&_e.length)for(const je of _e){const ae=je.enableBeforeUnload??!0;if(ae===!0){F=!0;break}if(typeof ae=="function"&&ae()===!0){F=!0;break}}if(F)return Y.preventDefault(),Y.returnValue=""},Z=v9({getLocation:T,getLength:()=>t.history.length,pushState:(Y,F)=>H("push",Y,F),replaceState:(Y,F)=>H("replace",Y,F),back:Y=>(Y&&(w=!0),N=!0,t.history.back()),forward:Y=>{Y&&(w=!0),N=!0,t.history.forward()},go:Y=>{g=!0,t.history.go(Y)},createHref:Y=>p(Y),flush:$,destroy:()=>{t.history.pushState=a,t.history.replaceState=r,t.removeEventListener(Z4,ce,{capture:!0}),t.removeEventListener(Y4,Q)},onBlocked:()=>{b&&m!==b&&(m=b)},getBlockers:u,setBlockers:h,notifyOnIndexChange:!1});return t.addEventListener(Z4,ce,{capture:!0}),t.addEventListener(Y4,Q),t.history.pushState=function(...Y){const F=a.apply(t.history,Y);return Z._ignoreSubscribers||R("PUSH"),F},t.history.replaceState=function(...Y){const F=r.apply(t.history,Y);return Z._ignoreSubscribers||R("REPLACE"),F},Z}function b9(n){let t=n.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function zf(n,t){const a=b9(n),r=a.indexOf("#"),c=a.indexOf("?"),u=$p();return{href:a,pathname:a.substring(0,r>0?c>0?Math.min(r,c):r:c>0?c:a.length),hash:r>-1?a.substring(r):"",search:c>-1?a.slice(c,r===-1?void 0:r):"",state:t||{[wr]:0,key:u,__TSR_key:u}}}function $p(){return(Math.random()+1).toString(36).substring(7)}function jl(n){const t=n.resolvedLocation,a=n.location;return{fromLocation:t,toLocation:a,pathChanged:(t==null?void 0:t.pathname)!==a.pathname,hrefChanged:(t==null?void 0:t.href)!==a.href,hashChanged:(t==null?void 0:t.hash)!==a.hash}}function x9(n){const t=n.filter(a=>a.status!=="redirected");return t.length===n.length?n:t}var S9=class{constructor(n){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=t=>t(),this.update=t=>{var m;const a=this.options,r=this.basepath??(a==null?void 0:a.basepath)??"/",c=this.basepath===void 0,u=a==null?void 0:a.rewrite;if(this.options={...a,...t},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=D_(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=_9()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let b;this.resolvePathCache=Df(1e3),b=this.buildRouteTree(),this.setRoutes(b)}!this.__store&&this.latestLocation&&(this.__store=d9(w9(this.latestLocation)),U_(this));let h=!1;const p=this.options.basepath??"/",y=this.options.rewrite;if(c||r!==p||u!==y){this.basepath=p;const b=[],g=l3(p);g&&g!=="/"&&b.push(Z_({basepath:p})),y&&b.push(y),this.rewrite=b.length===0?void 0:b.length===1?b[0]:Y_(b),this.history&&this.updateLatestLocation(),h=!0}h&&this.__store&&this.__store.setState(b=>({...b,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof((m=window.CSS)==null?void 0:m.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=C_(this.routeTree,this.options.caseSensitive,(a,r)=>{a.init({originalIndex:r})});return this.options.routeMasks&&S_(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,a)=>{const r={eventType:t,fn:a};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=t=>{this.subscribers.forEach(a=>{a.eventType===t.type&&a.fn(t)})},this.parseLocation=(t,a)=>{const r=({pathname:p,search:y,hash:m,href:b,state:g})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(p)){const C=this.options.parseSearch(y),I=this.options.stringifySearch(C);return{href:p+I+m,publicHref:b,pathname:tu(p).path,external:!1,searchStr:I,search:sl(a==null?void 0:a.search,C),hash:tu(m.slice(1)).path,state:ol(a==null?void 0:a.state,g)}}const x=new URL(b,this.origin),w=sp(this.rewrite,x),N=this.options.parseSearch(w.search),T=this.options.stringifySearch(N);return w.search=T,{href:w.href.replace(w.origin,""),publicHref:b,pathname:tu(w.pathname).path,external:!!this.rewrite&&w.origin!==this.origin,searchStr:T,search:sl(a==null?void 0:a.search,N),hash:tu(w.hash.slice(1)).path,state:ol(a==null?void 0:a.state,g)}},c=r(t),{__tempLocation:u,__tempKey:h}=c.state;if(u&&(!h||h===this.tempLocationKey)){const p=r(u);return p.state.key=c.state.key,p.state.__TSR_key=c.state.__TSR_key,delete p.state.__tempLocation,{...p,maskedLocation:c}}return c},this.resolvePathWithBase=(t,a)=>A_({base:t,to:Pp(a),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,a,r)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:a},r):this.matchRoutesInternal(t,a),this.getMatchedRoutes=t=>k9({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const a=this.getMatch(t);a&&(a.abortController.abort(),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(r=>r.status==="pending"),a=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...a]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=t=>{const a=(c={})=>{var ee,Y;const u=c._fromLocation||this.pendingBuiltLocation||this.latestLocation,h=this.matchRoutesLightweight(u);c.from;const p=c.unsafeRelative==="path"?u.pathname:c.from??h.fullPath,y=this.resolvePathWithBase(p,"."),m=h.search,b=Object.assign(Object.create(null),h.params),g=c.to?this.resolvePathWithBase(y,`${c.to}`):this.resolvePathWithBase(y,"."),x=c.params===!1||c.params===null?Object.create(null):(c.params??!0)===!0?b:Object.assign(b,_r(c.params,b)),w=this.getMatchedRoutes(g);let N=w.matchedRoutes;if((!w.foundRoute||w.foundRoute.path!=="/"&&w.routeParams["**"])&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]),Object.keys(x).length>0)for(const F of N){const _e=((ee=F.options.params)==null?void 0:ee.stringify)??F.options.stringifyParams;if(_e)try{Object.assign(x,_e(x))}catch{}}const T=t.leaveParams?g:tu(U4({path:g,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=m;if(t._includeValidateSearch&&((Y=this.options.search)!=null&&Y.strict)){const F={};N.forEach(_e=>{if(_e.options.validateSearch)try{Object.assign(F,kf(_e.options.validateSearch,{...F,...C}))}catch{}}),C=F}C=N9({search:C,dest:c,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),C=sl(m,C);const I=this.options.stringifySearch(C),$=c.hash===!0?u.hash:c.hash?_r(c.hash,u.hash):void 0,H=$?`#${$}`:"";let R=c.state===!0?u.state:c.state?_r(c.state,u.state):{};R=ol(u.state,R);const Q=`${T}${I}${H}`;let ce,Z,ie=!1;if(this.rewrite){const F=new URL(Q,this.origin),_e=o3(this.rewrite,F);ce=F.href.replace(F.origin,""),_e.origin!==this.origin?(Z=_e.href,ie=!0):Z=_e.pathname+_e.search+_e.hash}else ce=__(Q),Z=ce;return{publicHref:Z,href:ce,pathname:T,search:C,searchStr:I,state:R,hash:$??"",external:ie,unmaskOnReload:c.unmaskOnReload}},r=(c={},u)=>{const h=a(c);let p=u?a(u):void 0;if(!p){const y=Object.create(null);if(this.options.routeMasks){const m=j_(h.pathname,this.processedTree);if(m){Object.assign(y,m.rawParams);const{from:b,params:g,...x}=m.route,w=g===!1||g===null?Object.create(null):(g??!0)===!0?y:Object.assign(y,_r(g,y));u={from:t.from,...x,params:w},p=a(u)}}}return p&&(h.maskedLocation=p),h};return t.mask?r(t,{from:t.from,...t.mask}):r(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:a,...r})=>{const c=()=>{const p=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];p.forEach(m=>{r.state[m]=this.latestLocation.state[m]});const y=bl(r.state,this.latestLocation.state);return p.forEach(m=>{delete r.state[m]}),y},u=jr(this.latestLocation.href)===jr(r.href);let h=this.commitLocationPromise;if(this.commitLocationPromise=$o(()=>{h==null||h.resolve(),h=void 0}),u&&c())this.load();else{let{maskedLocation:p,hashScrollIntoView:y,...m}=r;p&&(m={...p,state:{...p.state,__tempKey:void 0,__tempLocation:{...m,search:m.searchStr,state:{...m.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(m.unmaskOnReload??this.options.unmaskOnReload??!1)&&(m.state.__tempKey=this.tempLocationKey)),m.state.__hashScrollIntoViewOptions=y??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[r.replace?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:a})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:a,hashScrollIntoView:r,viewTransition:c,ignoreBlocker:u,href:h,...p}={})=>{if(h){const b=this.history.location.state.__TSR_index,g=zf(h,{__TSR_index:t?b:b+1}),x=new URL(g.pathname,this.origin);p.to=sp(this.rewrite,x).pathname,p.search=this.options.parseSearch(g.search),p.hash=g.hash.slice(1)}const y=this.buildLocation({...p,_includeValidateSearch:!0});this.pendingBuiltLocation=y;const m=this.commitLocation({...y,viewTransition:c,replace:t,resetScroll:a,hashScrollIntoView:r,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===y&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=async({to:t,reloadDocument:a,href:r,publicHref:c,...u})=>{var p,y;let h=!1;if(r)try{new URL(`${r}`),h=!0}catch{}if(h&&!a&&(a=!0),a){if(t!==void 0||!r){const b=this.buildLocation({to:t,...u});r=r??b.publicHref,c=c??b.publicHref}const m=!h&&c?c:r;if(Af(m,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const b=((y=(p=this.history).getBlockers)==null?void 0:y.call(p))??[];for(const g of b)if(g!=null&&g.blockerFn&&await g.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(m):window.location.href=m,Promise.resolve()}return this.buildAndCommitLocation({...u,href:r,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(a=>({...a,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:a.cachedMatches.filter(r=>!t.some(c=>c.id===r.id))}))},this.load=async t=>{let a,r,c;const u=this.state.resolvedLocation??this.state.location;for(c=new Promise(p=>{this.startTransition(async()=>{var y;try{this.beforeLoad();const m=this.latestLocation,b=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...jl({resolvedLocation:b,location:m})}),this.emit({type:"onBeforeLoad",...jl({resolvedLocation:b,location:m})}),await V4({router:this,sync:t==null?void 0:t.sync,forceStaleReload:u.href===m.href,matches:this.state.pendingMatches,location:m,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let g=[],x=[],w=[],N=[];vu(()=>{this.__store.setState(T=>{const C=T.matches,I=T.pendingMatches||T.matches;return g=C.filter($=>!I.some(H=>H.id===$.id)),x=C.filter($=>!I.some(H=>H.routeId===$.routeId)),w=I.filter($=>!C.some(H=>H.routeId===$.routeId)),N=I.filter($=>C.some(H=>H.routeId===$.routeId)),{...T,isLoading:!1,loadedAt:Date.now(),matches:I,pendingMatches:void 0,cachedMatches:[...T.cachedMatches,...g.filter($=>$.status!=="error"&&$.status!=="notFound"&&$.status!=="redirected")]}}),this.clearExpiredCache()}),[[x,"onLeave"],[w,"onEnter"],[N,"onStay"]].forEach(([T,C])=>{T.forEach(I=>{var $,H;(H=($=this.looseRoutesById[I.routeId].options)[C])==null||H.call($,I)})})})})}})}catch(m){Ms(m)?(a=m,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):hs(m)&&(r=m),this.__store.setState(b=>({...b,statusCode:a?a.status:r?404:b.matches.some(g=>g.status==="error")?500:200,redirect:a}))}this.latestLoadPromise===c&&((y=this.commitLocationPromise)==null||y.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),p()})}),this.latestLoadPromise=c,await c;this.latestLoadPromise&&c!==this.latestLoadPromise;)await this.latestLoadPromise;let h;this.hasNotFoundMatch()?h=404:this.__store.state.matches.some(p=>p.status==="error")&&(h=500),h!==void 0&&this.__store.setState(p=>({...p,statusCode:h}))},this.startViewTransition=t=>{const a=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,a&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof a=="object"&&this.isViewTransitionTypesSupported){const c=this.latestLocation,u=this.state.resolvedLocation,h=typeof a.types=="function"?a.types(jl({resolvedLocation:u,location:c})):a.types;if(h===!1){t();return}r={update:t,types:h}}else r=t;document.startViewTransition(r)}else t()},this.updateMatch=(t,a)=>{this.startTransition(()=>{var c;const r=(c=this.state.pendingMatches)!=null&&c.some(u=>u.id===t)?"pendingMatches":this.state.matches.some(u=>u.id===t)?"matches":this.state.cachedMatches.some(u=>u.id===t)?"cachedMatches":"";r&&(r==="cachedMatches"?this.__store.setState(u=>({...u,cachedMatches:x9(u.cachedMatches.map(h=>h.id===t?a(h):h))})):this.__store.setState(u=>{var h;return{...u,[r]:(h=u[r])==null?void 0:h.map(p=>p.id===t?a(p):p)}}))})},this.getMatch=t=>{var r;const a=c=>c.id===t;return this.state.cachedMatches.find(a)??((r=this.state.pendingMatches)==null?void 0:r.find(a))??this.state.matches.find(a)},this.invalidate=t=>{const a=r=>{var c;return((c=t==null?void 0:t.filter)==null?void 0:c.call(t,r))??!0?{...r,invalid:!0,...t!=null&&t.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r};return this.__store.setState(r=>{var c;return{...r,matches:r.matches.map(a),cachedMatches:r.cachedMatches.map(a),pendingMatches:(c=r.pendingMatches)==null?void 0:c.map(a)}}),this.shouldViewTransition=!1,this.load({sync:t==null?void 0:t.sync})},this.getParsedLocationHref=t=>t.publicHref||"/",this.resolveRedirect=t=>{const a=t.headers.get("Location");if(!t.options.href||t.options._builtLocation){const r=t.options._builtLocation??this.buildLocation(t.options),c=this.getParsedLocationHref(r);t.options.href=c,t.headers.set("Location",c)}else if(a)try{const r=new URL(a);if(this.origin&&r.origin===this.origin){const c=r.pathname+r.search+r.hash;t.options.href=c,t.headers.set("Location",c)}}catch{}if(t.options.href&&!t.options._builtLocation&&Af(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const a=t==null?void 0:t.filter;a!==void 0?this.__store.setState(r=>({...r,cachedMatches:r.cachedMatches.filter(c=>!a(c))})):this.__store.setState(r=>({...r,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=a=>{const r=this.looseRoutesById[a.routeId];if(!r.options.loader)return!0;const c=(a.preload?r.options.preloadGcTime??this.options.defaultPreloadGcTime:r.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:Date.now()-a.updatedAt>=c};this.clearCache({filter:t})},this.loadRouteChunk=wu,this.preloadRoute=async t=>{const a=t._builtLocation??this.buildLocation(t);let r=this.matchRoutes(a,{throwOnError:!0,preload:!0,dest:t});const c=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(h=>h.id)),u=new Set([...c,...this.state.cachedMatches.map(h=>h.id)]);vu(()=>{r.forEach(h=>{u.has(h.id)||this.__store.setState(p=>({...p,cachedMatches:[...p.cachedMatches,h]}))})});try{return r=await V4({router:this,matches:r,location:a,preload:!0,updateMatch:(h,p)=>{c.has(h)?r=r.map(y=>y.id===h?p(y):y):this.updateMatch(h,p)}}),r}catch(h){if(Ms(h))return h.options.reloadDocument?void 0:await this.preloadRoute({...h.options,_fromLocation:a});hs(h)||console.error(h);return}},this.matchRoute=(t,a)=>{const r={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},c=this.buildLocation(r);if(a!=null&&a.pending&&this.state.status!=="pending")return!1;const u=((a==null?void 0:a.pending)===void 0?!this.state.isLoading:a.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,h=w_(c.pathname,(a==null?void 0:a.caseSensitive)??!1,(a==null?void 0:a.fuzzy)??!1,u.pathname,this.processedTree);return!h||t.params&&!bl(h.rawParams,t.params,{partial:!0})?!1:(a==null?void 0:a.includeSearch)??!0?bl(u.search,c.search,{partial:!0})?h.rawParams:!1:h.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...n,caseSensitive:n.caseSensitive??!1,notFoundMode:n.notFoundMode??"fuzzy",stringifySearch:n.stringifySearch??Q_,parseSearch:n.parseSearch??F_,protocolAllowlist:n.protocolAllowlist??v_}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:n,routesByPath:t,processedTree:a}){this.routesById=n,this.routesByPath=t,this.processedTree=a;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(n){return n!=null&&n.id?n.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(n,t){var g,x;const a=this.getMatchedRoutes(n.pathname),{foundRoute:r,routeParams:c,parsedParams:u}=a;let{matchedRoutes:h}=a,p=!1;(r?r.path!=="/"&&c["**"]:jr(n.pathname))&&(this.options.notFoundRoute?h=[...h,this.options.notFoundRoute]:p=!0);const y=p?T9(this.options.notFoundMode,h):void 0,m=new Array(h.length),b=new Map(this.state.matches.map(w=>[w.routeId,w]));for(let w=0;w<h.length;w++){const N=h[w],T=m[w-1];let C,I,$;{const ue=(T==null?void 0:T.search)??n.search,E=(T==null?void 0:T._strictSearch)??void 0;try{const U=kf(N.options.validateSearch,{...ue})??void 0;C={...ue,...U},I={...E,...U},$=void 0}catch(U){let te=U;if(U instanceof Bf||(te=new Bf(U.message,{cause:U})),t!=null&&t.throwOnError)throw te;C=ue,I={},$=te}}const H=((x=(g=N.options).loaderDeps)==null?void 0:x.call(g,{search:C}))??"",R=H?JSON.stringify(H):"",{interpolatedPath:Q,usedParams:ce}=U4({path:N.fullPath,params:c,decoder:this.pathParamsDecoder,server:this.isServer}),Z=N.id+Q+R,ie=this.getMatch(Z),ee=b.get(N.id),Y=(ie==null?void 0:ie._strictParams)??ce;let F;if(!ie)try{X4(N,ce,u,Y)}catch(ue){if(hs(ue)||Ms(ue)?F=ue:F=new j9(ue.message,{cause:ue}),t!=null&&t.throwOnError)throw F}Object.assign(c,Y);const _e=ee?"stay":"enter";let je;if(ie)je={...ie,cause:_e,params:(ee==null?void 0:ee.params)??c,_strictParams:Y,search:sl(ee?ee.search:ie.search,C),_strictSearch:I};else{const ue=N.options.loader||N.options.beforeLoad||N.lazyFn||y3(N)?"pending":"success";je={id:Z,ssr:N.options.ssr,index:w,routeId:N.id,params:(ee==null?void 0:ee.params)??c,_strictParams:Y,pathname:Q,updatedAt:Date.now(),search:ee?sl(ee.search,C):C,_strictSearch:I,searchError:void 0,status:ue,isFetching:!1,error:void 0,paramsError:F,__routeContext:void 0,_nonReactive:{loadPromise:$o()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:_e,loaderDeps:ee?ol(ee.loaderDeps,H):H,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:N.options.staticData||{},fullPath:N.fullPath}}t!=null&&t.preload||(je.globalNotFound=y===N.id),je.searchError=$;const ae=this.getParentContext(T);je.context={...ae,...je.__routeContext,...je.__beforeLoadContext},m[w]=je}for(let w=0;w<m.length;w++){const N=m[w],T=this.looseRoutesById[N.routeId],C=this.getMatch(N.id),I=b.get(N.routeId);if(N.params=I?sl(I.params,c):c,!C){const $=m[w-1],H=this.getParentContext($);if(T.options.context){const R={deps:N.loaderDeps,params:N.params,context:H??{},location:n,navigate:Q=>this.navigate({...Q,_fromLocation:n}),buildLocation:this.buildLocation,cause:N.cause,abortController:N.abortController,preload:!!N.preload,matches:m,routeId:T.id};N.__routeContext=T.options.context(R)??void 0}N.context={...H,...N.__routeContext,...N.__beforeLoadContext}}}return m}matchRoutesLightweight(n){const{matchedRoutes:t,routeParams:a,parsedParams:r}=this.getMatchedRoutes(n.pathname),c=Su(t),u={...n.search};for(const m of t)try{Object.assign(u,kf(m.options.validateSearch,u))}catch{}const h=Su(this.state.matches),p=h&&h.routeId===c.id&&n.pathname===this.state.location.pathname;let y;if(p)y=h.params;else{const m=Object.assign(Object.create(null),a);for(const b of t)try{X4(b,a,r??{},m)}catch{}y=m}return{matchedRoutes:t,fullPath:c.fullPath,search:u,params:y}}},Bf=class extends Error{},j9=class extends Error{};function w9(n){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:n,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function kf(n,t){if(n==null)return{};if("~standard"in n){const a=n["~standard"].validate(t);if(a instanceof Promise)throw new Bf("Async validation not supported");if(a.issues)throw new Bf(JSON.stringify(a.issues,void 0,2),{cause:a});return a.value}return"parse"in n?n.parse(t):typeof n=="function"?n(t):{}}function k9({pathname:n,routesById:t,processedTree:a}){const r=Object.create(null),c=jr(n);let u,h;const p=k_(c,a,!0);return p&&(u=p.route,Object.assign(r,p.rawParams),h=Object.assign(Object.create(null),p.parsedParams)),{matchedRoutes:(p==null?void 0:p.branch)||[t.__root__],routeParams:r,foundRoute:u,parsedParams:h}}function N9({search:n,dest:t,destRoutes:a,_includeValidateSearch:r}){return C9(a)(n,t,r??!1)}function C9(n){var c;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const u of n){if("search"in u.options)(c=u.options.search)!=null&&c.middlewares&&t.middlewares.push(...u.options.search.middlewares);else if(u.options.preSearchFilters||u.options.postSearchFilters){const h=({search:p,next:y})=>{let m=p;"preSearchFilters"in u.options&&u.options.preSearchFilters&&(m=u.options.preSearchFilters.reduce((g,x)=>x(g),p));const b=y(m);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((g,x)=>x(g),b):b};t.middlewares.push(h)}if(u.options.validateSearch){const h=({search:p,next:y})=>{const m=y(p);if(!t._includeValidateSearch)return m;try{return{...m,...kf(u.options.validateSearch,m)??void 0}}catch{return m}};t.middlewares.push(h)}}const a=({search:u})=>{const h=t.dest;return h.search?h.search===!0?u:_r(h.search,u):{}};t.middlewares.push(a);const r=(u,h,p)=>{if(u>=p.length)return h;const y=p[u];return y({search:h,next:b=>r(u+1,b,p)})};return function(h,p,y){return t.dest=p,t._includeValidateSearch=y,r(0,h,t.middlewares)}}function T9(n,t){if(n!=="root")for(let a=t.length-1;a>=0;a--){const r=t[a];if(r.children)return r.id}return xl}function X4(n,t,a,r){var u;const c=((u=n.options.params)==null?void 0:u.parse)??n.options.parseParams;if(c)if(n.options.skipRouteOnParseError)for(const h in t)h in a&&(r[h]=a[h]);else{const h=c(r);Object.assign(r,h)}}var E9="Error preloading route! ☝️",v3=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(n){if(this.init=t=>{var y,m;this.originalIndex=t.originalIndex;const a=this.options,r=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(m=(y=this.options).getParentRoute)==null?void 0:m.call(y),r?this._path=xl:this.parentRoute||Cr(!1);let c=r?xl:a==null?void 0:a.path;c&&c!=="/"&&(c=r3(c));const u=(a==null?void 0:a.id)||c;let h=r?xl:Sf([this.parentRoute.id==="__root__"?"":this.parentRoute.id,u]);c==="__root__"&&(c="/"),h!=="__root__"&&(h=Sf(["/",h]));const p=h==="__root__"?"/":Sf([this.parentRoute.fullPath,c]);this._path=c,this._id=h,this._fullPath=p,this._to=jr(p)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>K_({from:this.fullPath,...t}),this.options=n||{},this.isRoot=!(n!=null&&n.getParentRoute),n!=null&&n.id&&(n!=null&&n.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},M9=class extends v3{constructor(n){super(n)}};function Hp(n){const t=n.errorComponent??Fp;return l.jsx(R9,{getResetKey:n.getResetKey,onCatch:n.onCatch,children:({error:a,reset:r})=>a?_.createElement(t,{error:a,reset:r}):n.children})}var R9=class extends _.Component{constructor(...n){super(...n),this.state={error:null}}static getDerivedStateFromProps(n){return{resetKey:n.getResetKey()}}static getDerivedStateFromError(n){return{error:n}}reset(){this.setState({error:null})}componentDidUpdate(n,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(n,t){this.props.onCatch&&this.props.onCatch(n,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function Fp({error:n}){const[t,a]=_.useState(!1);return l.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[l.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),l.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>a(r=>!r),children:t?"Hide Error":"Show Error"})]}),l.jsx("div",{style:{height:".25rem"}}),t?l.jsx("div",{children:l.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:n.message?l.jsx("code",{children:n.message}):null})}):null]})}function A9({children:n,fallback:t=null}){return _3()?l.jsx(Si.Fragment,{children:n}):l.jsx(Si.Fragment,{children:t})}function _3(){return Si.useSyncExternalStore(D9,()=>!0,()=>!1)}function D9(){return()=>{}}var b3=_.createContext(null);function ia(n){const t=_.useContext(b3);return n==null||n.warn,t}var _1={exports:{}},b1={},x1={exports:{}},S1={};/**
51
51
  * @license React
52
52
  * use-sync-external-store-shim.production.js
53
53
  *
@@ -63,7 +63,7 @@ Error generating stack: `+o.message+`
63
63
  *
64
64
  * This source code is licensed under the MIT license found in the
65
65
  * LICENSE file in the root directory of this source tree.
66
- */var t6;function I9(){if(t6)return b1;t6=1;var n=Pu(),t=L9();function a(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}var r=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,u=n.useRef,h=n.useEffect,p=n.useMemo,y=n.useDebugValue;return b1.useSyncExternalStoreWithSelector=function(m,b,g,x,w){var N=u(null);if(N.current===null){var T={hasValue:!1,value:null};N.current=T}else T=N.current;N=p(function(){function I(ce){if(!$){if($=!0,H=ce,ce=x(ce),w!==void 0&&T.hasValue){var Z=T.value;if(w(Z,ce))return R=Z}return R=ce}if(Z=R,r(H,ce))return Z;var ie=x(ce);return w!==void 0&&w(Z,ie)?(H=ce,Z):(H=ce,R=ie)}var $=!1,H,R,Q=g===void 0?null:g;return[function(){return I(b())},Q===null?void 0:function(){return I(Q())}]},[b,g,x,w]);var C=c(m,N[0],N[1]);return h(function(){T.hasValue=!0,T.value=C},[C]),y(C),C},b1}var n6;function z9(){return n6||(n6=1,_1.exports=I9()),_1.exports}var B9=z9();function P9(n,t){return n===t}function U9(n,t,a=P9){const r=_.useCallback(h=>{if(!n)return()=>{};const{unsubscribe:p}=n.subscribe(h);return p},[n]),c=_.useCallback(()=>n==null?void 0:n.get(),[n]);return B9.useSyncExternalStoreWithSelector(r,c,c,t,a)}function aa(n){const t=ia({warn:(n==null?void 0:n.router)===void 0}),a=(n==null?void 0:n.router)||t,r=_.useRef(void 0);return U9(a.__store,c=>{if(n!=null&&n.select){if(n.structuralSharing??a.options.defaultStructuralSharing){const u=ol(r.current,n.select(c));return r.current=u,u}return n.select(c)}return c})}var th=_.createContext(void 0),q9=_.createContext(void 0);function Er(n){const t=_.useContext(n.from?q9:th);return aa({select:a=>{const r=a.matches.find(c=>n.from?n.from===c.routeId:c.id===t);if(Cr(!((n.shouldThrow??!0)&&!r),`Could not find ${n.from?`an active match from "${n.from}"`:"a nearest match!"}`),r!==void 0)return n.select?n.select(r):r},structuralSharing:n.structuralSharing})}function Qp(n){return Er({from:n.from,strict:n.strict,structuralSharing:n.structuralSharing,select:t=>n.select?n.select(t.loaderData):t.loaderData})}function Gp(n){const{select:t,...a}=n;return Er({...a,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Uu(n){return Er({from:n.from,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,strict:n.strict,select:t=>{const a=n.strict===!1?t.params:t._strictParams;return n.select?n.select(a):a}})}function Vp(n){return Er({from:n.from,strict:n.strict,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,select:t=>n.select?n.select(t.search):t.search})}function Mr(n){const t=ia();return _.useCallback(a=>t.navigate({...a,from:a.from??(n==null?void 0:n.from)}),[n==null?void 0:n.from,t])}function Kp(n){return Er({...n,select:t=>n.select?n.select(t.context):t.context})}var or=Q2();function $9(n,t){const a=ia(),r=f_(t),{activeProps:c,inactiveProps:u,activeOptions:h,to:p,preload:y,preloadDelay:m,hashScrollIntoView:b,replace:g,startTransition:x,resetScroll:w,viewTransition:N,children:T,target:C,disabled:I,style:$,className:H,onClick:R,onBlur:Q,onFocus:ce,onMouseEnter:Z,onMouseLeave:ie,onTouchStart:ee,ignoreBlocker:Y,params:F,search:_e,hash:je,state:ae,mask:ue,reloadDocument:E,unsafeRelative:U,from:te,_fromLocation:W,...xe}=n,A=_3(),ne=aa({select:Oe=>{const Ke=Oe.matches[Oe.matches.length-1];return{search:Ke==null?void 0:Ke.search,hash:Oe.location.hash,path:Ke==null?void 0:Ke.pathname}},structuralSharing:!0}),be=n.from,V=_.useMemo(()=>({...n,from:be}),[a,ne,be,n._fromLocation,n.hash,n.to,n.search,n.params,n.state,n.mask,n.unsafeRelative]),pe=_.useMemo(()=>a.buildLocation({...V}),[a,V]),Ce=pe.maskedLocation?pe.maskedLocation.publicHref:pe.publicHref,Le=pe.maskedLocation?pe.maskedLocation.external:pe.external,he=_.useMemo(()=>K9(Ce,Le,a.history,I),[I,Le,Ce,a.history]),q=_.useMemo(()=>{if(he!=null&&he.external)return Af(he.href,a.protocolAllowlist)?void 0:he.href;if(!Y9(p)&&!(typeof p!="string"||p.indexOf(":")===-1))try{return new URL(p),Af(p,a.protocolAllowlist)?void 0:p}catch{}},[p,he,a.protocolAllowlist]),Se=aa({select:Oe=>{if(q)return!1;if(h!=null&&h.exact){if(!R_(Oe.location.pathname,pe.pathname,a.basepath))return!1}else{const Ke=Of(Oe.location.pathname,a.basepath),mt=Of(pe.pathname,a.basepath);if(!(Ke.startsWith(mt)&&(Ke.length===mt.length||Ke[mt.length]==="/")))return!1}return((h==null?void 0:h.includeSearch)??!0)&&!bl(Oe.location.search,pe.search,{partial:!(h!=null&&h.exact),ignoreUndefined:!(h!=null&&h.explicitUndefined)})?!1:h!=null&&h.includeHash?A&&Oe.location.hash===pe.hash:!0}}),Ne=Se?_r(c,{})??H9:j1,me=Se?j1:_r(u,{})??j1,Te=[H,Ne.className,me.className].filter(Boolean).join(" "),Ge=($||Ne.style||me.style)&&{...$,...Ne.style,...me.style},[Ue,gt]=_.useState(!1),Lt=_.useRef(!1),St=n.reloadDocument||q?!1:y??a.options.defaultPreload,st=m??a.options.defaultPreloadDelay??0,tn=_.useCallback(()=>{a.preloadRoute({...V,_builtLocation:pe}).catch(Oe=>{console.warn(Oe),console.warn(E9)})},[a,V,pe]);d_(r,_.useCallback(Oe=>{Oe!=null&&Oe.isIntersecting&&tn()},[tn]),V9,{disabled:!!I||St!=="viewport"}),_.useEffect(()=>{Lt.current||!I&&St==="render"&&(tn(),Lt.current=!0)},[I,tn,St]);const $t=Oe=>{const Ke=Oe.currentTarget.getAttribute("target"),mt=C!==void 0?C:Ke;if(!I&&!Z9(Oe)&&!Oe.defaultPrevented&&(!mt||mt==="_self")&&Oe.button===0){Oe.preventDefault(),or.flushSync(()=>{gt(!0)});const kt=a.subscribe("onResolved",()=>{kt(),gt(!1)});a.navigate({...V,replace:g,resetScroll:w,hashScrollIntoView:b,startTransition:x,viewTransition:N,ignoreBlocker:Y})}};if(q)return{...xe,ref:r,href:q,...T&&{children:T},...C&&{target:C},...I&&{disabled:I},...$&&{style:$},...H&&{className:H},...R&&{onClick:R},...Q&&{onBlur:Q},...ce&&{onFocus:ce},...Z&&{onMouseEnter:Z},...ie&&{onMouseLeave:ie},...ee&&{onTouchStart:ee}};const de=Oe=>{if(I||St!=="intent")return;if(!st){tn();return}const Ke=Oe.currentTarget;if(au.has(Ke))return;const mt=setTimeout(()=>{au.delete(Ke),tn()},st);au.set(Ke,mt)},Ae=Oe=>{I||St!=="intent"||tn()},Re=Oe=>{if(I||!St||!st)return;const Ke=Oe.currentTarget,mt=au.get(Ke);mt&&(clearTimeout(mt),au.delete(Ke))};return{...xe,...Ne,...me,href:he==null?void 0:he.href,ref:r,onClick:xo([R,$t]),onBlur:xo([Q,Re]),onFocus:xo([ce,de]),onMouseEnter:xo([Z,de]),onMouseLeave:xo([ie,Re]),onTouchStart:xo([ee,Ae]),disabled:!!I,target:C,...Ge&&{style:Ge},...Te&&{className:Te},...I&&F9,...Se&&Q9,...A&&Ue&&G9}}var j1={},H9={className:"active"},F9={role:"link","aria-disabled":!0},Q9={"data-status":"active","aria-current":"page"},G9={"data-transitioning":"transitioning"},au=new WeakMap,V9={rootMargin:"100px"},xo=n=>t=>{for(const a of n)if(a){if(t.defaultPrevented)return;a(t)}};function K9(n,t,a,r){if(!r)return t?{href:n,external:!0}:{href:a.createHref(n)||"/",external:!1}}function Y9(n){if(typeof n!="string")return!1;const t=n.charCodeAt(0);return t===47?n.charCodeAt(1)!==47:t===46}var _u=_.forwardRef((n,t)=>{const{_asChild:a,...r}=n,{type:c,...u}=$9(r,t),h=typeof r.children=="function"?r.children({isActive:u["data-status"]==="active"}):r.children;if(!a){const{disabled:p,...y}=u;return _.createElement("a",y,h)}return _.createElement(a,u,h)});function Z9(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}var W9=class extends v3{constructor(n){super(n),this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Kp({...t,from:this.id}),this.useSearch=t=>Vp({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Uu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Gp({...t,from:this.id}),this.useLoaderData=t=>Qp({...t,from:this.id}),this.useNavigate=()=>Mr({from:this.fullPath}),this.Link=Si.forwardRef((t,a)=>l.jsx(_u,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function El(n){return new W9(n)}var X9=class extends M9{constructor(n){super(n),this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Kp({...t,from:this.id}),this.useSearch=t=>Vp({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Uu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Gp({...t,from:this.id}),this.useLoaderData=t=>Qp({...t,from:this.id}),this.useNavigate=()=>Mr({from:this.fullPath}),this.Link=Si.forwardRef((t,a)=>l.jsx(_u,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function J9(n){return new X9(n)}function s6(n){return typeof n=="object"?new a6(n,{silent:!0}).createRoute(n):new a6(n,{silent:!0}).createRoute}var a6=class{constructor(n,t){this.path=n,this.createRoute=a=>{const r=El(a);return r.isRoot=!1,r},this.silent=t==null?void 0:t.silent}},i6=class{constructor(n){this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Kp({...t,from:this.options.id}),this.useSearch=t=>Vp({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>Uu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>Gp({...t,from:this.options.id}),this.useLoaderData=t=>Qp({...t,from:this.options.id}),this.useNavigate=()=>Mr({from:ia().routesById[this.options.id].fullPath}),this.options=n,this.$$typeof=Symbol.for("react.memo")}};function r6(n){return typeof n=="object"?new i6(n):t=>new i6({id:n,...t})}function eb(n){const t=aa({select:a=>`not-found-${a.location.pathname}-${a.status}`});return l.jsx(Hp,{getResetKey:()=>t,onCatch:(a,r)=>{var c;if(hs(a))(c=n.onCatch)==null||c.call(n,a,r);else throw a},errorComponent:({error:a})=>{var r;if(hs(a))return(r=n.fallback)==null?void 0:r.call(n,a);throw a},children:n.children})}function tb(){return l.jsx("p",{children:"Not Found"})}function No(n){return l.jsx(l.Fragment,{children:n.children})}function x3(n,t,a){return t.options.notFoundComponent?l.jsx(t.options.notFoundComponent,{...a}):n.options.defaultNotFoundComponent?l.jsx(n.options.defaultNotFoundComponent,{...a}):l.jsx(tb,{})}function nb(){return ia().isScrollRestoring,null}var S3=_.memo(function({matchId:t}){var N,T;const a=ia(),r=aa({select:C=>{var H;const I=C.matches.findIndex(R=>R.id===t),$=C.matches[I];return Cr($),{routeId:$.routeId,ssr:$.ssr,_displayPending:$._displayPending,resetKey:C.loadedAt,parentRouteId:(H=C.matches[I-1])==null?void 0:H.routeId}},structuralSharing:!0}),c=a.routesById[r.routeId],u=c.options.pendingComponent??a.options.defaultPendingComponent,h=u?l.jsx(u,{}):null,p=c.options.errorComponent??a.options.defaultErrorComponent,y=c.options.onCatch??a.options.defaultOnCatch,m=c.isRoot?c.options.notFoundComponent??((N=a.options.notFoundRoute)==null?void 0:N.options.component):c.options.notFoundComponent,b=r.ssr===!1||r.ssr==="data-only",g=(!c.isRoot||c.options.wrapInSuspense||b)&&(c.options.wrapInSuspense??u??(((T=c.options.errorComponent)==null?void 0:T.preload)||b))?_.Suspense:No,x=p?Hp:No,w=m?eb:No;return l.jsxs(c.isRoot?c.options.shellComponent??No:No,{children:[l.jsx(th.Provider,{value:t,children:l.jsx(g,{fallback:h,children:l.jsx(x,{getResetKey:()=>r.resetKey,errorComponent:p||Fp,onCatch:(C,I)=>{if(hs(C))throw C;y==null||y(C,I)},children:l.jsx(w,{fallback:C=>{if(!m||C.routeId&&C.routeId!==r.routeId||!C.routeId&&!c.isRoot)throw C;return _.createElement(m,C)},children:b||r._displayPending?l.jsx(A9,{fallback:h,children:l.jsx(l6,{matchId:t})}):l.jsx(l6,{matchId:t})})})})}),r.parentRouteId===xl&&a.options.scrollRestoration?l.jsxs(l.Fragment,{children:[l.jsx(sb,{}),l.jsx(nb,{})]}):null]})});function sb(){const n=ia(),t=_.useRef(void 0);return l.jsx("script",{suppressHydrationWarning:!0,ref:a=>{a&&(t.current===void 0||t.current.href!==n.latestLocation.href)&&(n.emit({type:"onRendered",...jl(n.state)}),t.current=n.latestLocation)}},n.latestLocation.state.__TSR_key)}var l6=_.memo(function({matchId:t}){var y,m,b,g;const a=ia(),{match:r,key:c,routeId:u}=aa({select:x=>{var C;const w=x.matches.find(I=>I.id===t),N=w.routeId,T=(C=a.routesById[N].options.remountDeps??a.options.defaultRemountDeps)==null?void 0:C({routeId:N,loaderDeps:w.loaderDeps,params:w._strictParams,search:w._strictSearch});return{key:T?JSON.stringify(T):void 0,routeId:N,match:{id:w.id,status:w.status,error:w.error,_forcePending:w._forcePending,_displayPending:w._displayPending}}},structuralSharing:!0}),h=a.routesById[u],p=_.useMemo(()=>{const x=h.options.component??a.options.defaultComponent;return x?l.jsx(x,{},c):l.jsx(j3,{})},[c,h.options.component,a.options.defaultComponent]);if(r._displayPending)throw(y=a.getMatch(r.id))==null?void 0:y._nonReactive.displayPendingPromise;if(r._forcePending)throw(m=a.getMatch(r.id))==null?void 0:m._nonReactive.minPendingPromise;if(r.status==="pending"){const x=h.options.pendingMinMs??a.options.defaultPendingMinMs;if(x){const w=a.getMatch(r.id);if(w&&!w._nonReactive.minPendingPromise){const N=$o();w._nonReactive.minPendingPromise=N,setTimeout(()=>{N.resolve(),w._nonReactive.minPendingPromise=void 0},x)}}throw(b=a.getMatch(r.id))==null?void 0:b._nonReactive.loadPromise}if(r.status==="notFound")return Cr(hs(r.error)),x3(a,h,r.error);if(r.status==="redirected")throw Cr(Ms(r.error)),(g=a.getMatch(r.id))==null?void 0:g._nonReactive.loadPromise;if(r.status==="error")throw r.error;return p}),j3=_.memo(function(){const t=ia(),a=_.useContext(th),r=aa({select:m=>{var b;return(b=m.matches.find(g=>g.id===a))==null?void 0:b.routeId}}),c=t.routesById[r],u=aa({select:m=>{const b=m.matches.find(g=>g.id===a);return Cr(b),b.globalNotFound}}),h=aa({select:m=>{var g;const b=m.matches;return(g=b[b.findIndex(x=>x.id===a)+1])==null?void 0:g.id}}),p=t.options.defaultPendingComponent?l.jsx(t.options.defaultPendingComponent,{}):null;if(u)return x3(t,c,void 0);if(!h)return null;const y=l.jsx(S3,{matchId:h});return r===xl?l.jsx(_.Suspense,{fallback:p,children:y}):y});function ab(){const n=ia(),t=_.useRef({router:n,mounted:!1}),[a,r]=_.useState(!1),{hasPendingMatches:c,isLoading:u}=aa({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(x=>x.status==="pending")}),structuralSharing:!0}),h=h1(u),p=u||a||c,y=h1(p),m=u||c,b=h1(m);return n.startTransition=g=>{r(!0),_.startTransition(()=>{g(),r(!1)})},_.useEffect(()=>{const g=n.history.subscribe(n.load),x=n.buildLocation({to:n.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return jr(n.latestLocation.publicHref)!==jr(x.publicHref)&&n.commitLocation({...x,replace:!0}),()=>{g()}},[n,n.history]),hf(()=>{if(typeof window<"u"&&n.ssr||t.current.router===n&&t.current.mounted)return;t.current={router:n,mounted:!0},(async()=>{try{await n.load()}catch(x){console.error(x)}})()},[n]),hf(()=>{h&&!u&&n.emit({type:"onLoad",...jl(n.state)})},[h,n,u]),hf(()=>{b&&!m&&n.emit({type:"onBeforeRouteMount",...jl(n.state)})},[m,b,n]),hf(()=>{if(y&&!p){const g=jl(n.state);n.emit({type:"onResolved",...g}),n.__store.setState(x=>({...x,status:"idle",resolvedLocation:x.location})),g.hrefChanged&&q_(n)}},[p,y,n]),null}function ib(){const n=ia(),t=n.routesById[xl].options.pendingComponent??n.options.defaultPendingComponent,a=t?l.jsx(t,{}):null,r=l.jsxs(typeof document<"u"&&n.ssr?No:_.Suspense,{fallback:a,children:[l.jsx(ab,{}),l.jsx(rb,{})]});return n.options.InnerWrap?l.jsx(n.options.InnerWrap,{children:r}):r}function rb(){const n=ia(),t=aa({select:c=>{var u;return(u=c.matches[0])==null?void 0:u.id}}),a=aa({select:c=>c.loadedAt}),r=t?l.jsx(S3,{matchId:t}):null;return l.jsx(th.Provider,{value:t,children:n.options.disableGlobalCatchBoundary?r:l.jsx(Hp,{getResetKey:()=>a,errorComponent:Fp,onCatch:void 0,children:r})})}var lb=n=>new ob(n),ob=class extends S9{constructor(n){super(n)}};typeof globalThis<"u"?(globalThis.createFileRoute=s6,globalThis.createLazyFileRoute=r6):typeof window<"u"&&(window.createFileRoute=s6,window.createLazyFileRoute=r6);function cb({router:n,children:t,...a}){Object.keys(a).length>0&&n.update({...n.options,...a,context:{...n.options.context,...a.context}});const r=l.jsx(b3.Provider,{value:n,children:t});return n.options.Wrap?l.jsx(n.options.Wrap,{children:r}):r}function ub({router:n,...t}){return l.jsx(cb,{router:n,...t,children:l.jsx(ib,{})})}var Bt;(function(n){n.assertEqual=c=>{};function t(c){}n.assertIs=t;function a(c){throw new Error}n.assertNever=a,n.arrayToEnum=c=>{const u={};for(const h of c)u[h]=h;return u},n.getValidEnumValues=c=>{const u=n.objectKeys(c).filter(p=>typeof c[c[p]]!="number"),h={};for(const p of u)h[p]=c[p];return n.objectValues(h)},n.objectValues=c=>n.objectKeys(c).map(function(u){return c[u]}),n.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{const u=[];for(const h in c)Object.prototype.hasOwnProperty.call(c,h)&&u.push(h);return u},n.find=(c,u)=>{for(const h of c)if(u(h))return h},n.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function r(c,u=" | "){return c.map(h=>typeof h=="string"?`'${h}'`:h).join(u)}n.joinValues=r,n.jsonStringifyReplacer=(c,u)=>typeof u=="bigint"?u.toString():u})(Bt||(Bt={}));var o6;(function(n){n.mergeShapes=(t,a)=>({...t,...a})})(o6||(o6={}));const Qe=Bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),lr=n=>{switch(typeof n){case"undefined":return Qe.undefined;case"string":return Qe.string;case"number":return Number.isNaN(n)?Qe.nan:Qe.number;case"boolean":return Qe.boolean;case"function":return Qe.function;case"bigint":return Qe.bigint;case"symbol":return Qe.symbol;case"object":return Array.isArray(n)?Qe.array:n===null?Qe.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Qe.promise:typeof Map<"u"&&n instanceof Map?Qe.map:typeof Set<"u"&&n instanceof Set?Qe.set:typeof Date<"u"&&n instanceof Date?Qe.date:Qe.object;default:return Qe.unknown}},Me=Bt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ni extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=t}format(t){const a=t||function(u){return u.message},r={_errors:[]},c=u=>{for(const h of u.issues)if(h.code==="invalid_union")h.unionErrors.map(c);else if(h.code==="invalid_return_type")c(h.returnTypeError);else if(h.code==="invalid_arguments")c(h.argumentsError);else if(h.path.length===0)r._errors.push(a(h));else{let p=r,y=0;for(;y<h.path.length;){const m=h.path[y];y===h.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(a(h))):p[m]=p[m]||{_errors:[]},p=p[m],y++}}};return c(this),r}static assert(t){if(!(t instanceof Ni))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a={},r=[];for(const c of this.issues)if(c.path.length>0){const u=c.path[0];a[u]=a[u]||[],a[u].push(t(c))}else r.push(t(c));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}Ni.create=n=>new Ni(n);const lp=(n,t)=>{let a;switch(n.code){case Me.invalid_type:n.received===Qe.undefined?a="Required":a=`Expected ${n.expected}, received ${n.received}`;break;case Me.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(n.expected,Bt.jsonStringifyReplacer)}`;break;case Me.unrecognized_keys:a=`Unrecognized key(s) in object: ${Bt.joinValues(n.keys,", ")}`;break;case Me.invalid_union:a="Invalid input";break;case Me.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Bt.joinValues(n.options)}`;break;case Me.invalid_enum_value:a=`Invalid enum value. Expected ${Bt.joinValues(n.options)}, received '${n.received}'`;break;case Me.invalid_arguments:a="Invalid function arguments";break;case Me.invalid_return_type:a="Invalid function return type";break;case Me.invalid_date:a="Invalid date";break;case Me.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(a=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?a=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?a=`Invalid input: must end with "${n.validation.endsWith}"`:Bt.assertNever(n.validation):n.validation!=="regex"?a=`Invalid ${n.validation}`:a="Invalid";break;case Me.too_small:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?a=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:a="Invalid input";break;case Me.too_big:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?a=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:a="Invalid input";break;case Me.custom:a="Invalid input";break;case Me.invalid_intersection_types:a="Intersection results could not be merged";break;case Me.not_multiple_of:a=`Number must be a multiple of ${n.multipleOf}`;break;case Me.not_finite:a="Number must be finite";break;default:a=t.defaultError,Bt.assertNever(n)}return{message:a}};let db=lp;function fb(){return db}const hb=n=>{const{data:t,path:a,errorMaps:r,issueData:c}=n,u=[...a,...c.path||[]],h={...c,path:u};if(c.message!==void 0)return{...c,path:u,message:c.message};let p="";const y=r.filter(m=>!!m).slice().reverse();for(const m of y)p=m(h,{data:t,defaultError:p}).message;return{...c,path:u,message:p}};function Pe(n,t){const a=fb(),r=hb({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,a,a===lp?void 0:lp].filter(c=>!!c)});n.common.issues.push(r)}class ms{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,a){const r=[];for(const c of a){if(c.status==="aborted")return ft;c.status==="dirty"&&t.dirty(),r.push(c.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,a){const r=[];for(const c of a){const u=await c.key,h=await c.value;r.push({key:u,value:h})}return ms.mergeObjectSync(t,r)}static mergeObjectSync(t,a){const r={};for(const c of a){const{key:u,value:h}=c;if(u.status==="aborted"||h.status==="aborted")return ft;u.status==="dirty"&&t.dirty(),h.status==="dirty"&&t.dirty(),u.value!=="__proto__"&&(typeof h.value<"u"||c.alwaysSet)&&(r[u.value]=h.value)}return{status:t.value,value:r}}}const ft=Object.freeze({status:"aborted"}),fu=n=>({status:"dirty",value:n}),ra=n=>({status:"valid",value:n}),c6=n=>n.status==="aborted",u6=n=>n.status==="dirty",Ho=n=>n.status==="valid",Pf=n=>typeof Promise<"u"&&n instanceof Promise;var Xe;(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Xe||(Xe={}));class Ha{constructor(t,a,r,c){this._cachedPath=[],this.parent=t,this.data=a,this._path=r,this._key=c}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const d6=(n,t)=>{if(Ho(t))return{success:!0,data:t.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new Ni(n.common.issues);return this._error=a,this._error}}};function xt(n){if(!n)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:c}=n;if(t&&(a||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:c}:{errorMap:(h,p)=>{const{message:y}=n;return h.code==="invalid_enum_value"?{message:y??p.defaultError}:typeof p.data>"u"?{message:y??r??p.defaultError}:h.code!=="invalid_type"?{message:p.defaultError}:{message:y??a??p.defaultError}},description:c}}class At{get description(){return this._def.description}_getType(t){return lr(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ms,ctx:{common:t.parent.common,data:t.data,parsedType:lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(Pf(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(t){const a=this._parse(t);return Promise.resolve(a)}parse(t,a){const r=this.safeParse(t,a);if(r.success)return r.data;throw r.error}safeParse(t,a){const r={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lr(t)},c=this._parseSync({data:t,path:r.path,parent:r});return d6(r,c)}"~validate"(t){var r,c;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lr(t)};if(!this["~standard"].async)try{const u=this._parseSync({data:t,path:[],parent:a});return Ho(u)?{value:u.value}:{issues:a.common.issues}}catch(u){(c=(r=u==null?void 0:u.message)==null?void 0:r.toLowerCase())!=null&&c.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(u=>Ho(u)?{value:u.value}:{issues:a.common.issues})}async parseAsync(t,a){const r=await this.safeParseAsync(t,a);if(r.success)return r.data;throw r.error}async safeParseAsync(t,a){const r={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lr(t)},c=this._parse({data:t,path:r.path,parent:r}),u=await(Pf(c)?c:Promise.resolve(c));return d6(r,u)}refine(t,a){const r=c=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(c):a;return this._refinement((c,u)=>{const h=t(c),p=()=>u.addIssue({code:Me.custom,...r(c)});return typeof Promise<"u"&&h instanceof Promise?h.then(y=>y?!0:(p(),!1)):h?!0:(p(),!1)})}refinement(t,a){return this._refinement((r,c)=>t(r)?!0:(c.addIssue(typeof a=="function"?a(r,c):a),!1))}_refinement(t){return new Go({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return kr.create(this,this._def)}nullable(){return Vo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $a.create(this)}promise(){return Ff.create(this,this._def)}or(t){return qf.create([this,t],this._def)}and(t){return $f.create(this,t,this._def)}transform(t){return new Go({...xt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new fp({...xt(this._def),innerType:this,defaultValue:a,typeName:ut.ZodDefault})}brand(){return new Ib({typeName:ut.ZodBranded,type:this,...xt(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new hp({...xt(this._def),innerType:this,catchValue:a,typeName:ut.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return Yp.create(this,t)}readonly(){return mp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mb=/^c[^\s-]{8,}$/i,pb=/^[0-9a-z]+$/,gb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,vb=/^[a-z0-9_-]{21}$/i,_b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Sb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let w1;const jb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,kb=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Nb=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Eb=new RegExp(`^${w3}$`);function k3(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);const a=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${a}`}function Mb(n){return new RegExp(`^${k3(n)}$`)}function Rb(n){let t=`${w3}T${k3(n)}`;const a=[];return a.push(n.local?"Z?":"Z"),n.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function Ab(n,t){return!!((t==="v4"||!t)&&jb.test(n)||(t==="v6"||!t)&&kb.test(n))}function Db(n,t){if(!_b.test(n))return!1;try{const[a]=n.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),c=JSON.parse(atob(r));return!(typeof c!="object"||c===null||"typ"in c&&(c==null?void 0:c.typ)!=="JWT"||!c.alg||t&&c.alg!==t)}catch{return!1}}function Ob(n,t){return!!((t==="v4"||!t)&&wb.test(n)||(t==="v6"||!t)&&Nb.test(n))}class ji extends At{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Qe.string){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.string,received:u.parsedType}),ft}const r=new ms;let c;for(const u of this._def.checks)if(u.kind==="min")t.data.length<u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),r.dirty());else if(u.kind==="max")t.data.length>u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),r.dirty());else if(u.kind==="length"){const h=t.data.length>u.value,p=t.data.length<u.value;(h||p)&&(c=this._getOrReturnCtx(t,c),h?Pe(c,{code:Me.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):p&&Pe(c,{code:Me.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),r.dirty())}else if(u.kind==="email")xb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"email",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="emoji")w1||(w1=new RegExp(Sb,"u")),w1.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"emoji",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="uuid")yb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"uuid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="nanoid")vb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"nanoid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="cuid")mb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cuid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="cuid2")pb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cuid2",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="ulid")gb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"ulid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="url")try{new URL(t.data)}catch{c=this._getOrReturnCtx(t,c),Pe(c,{validation:"url",code:Me.invalid_string,message:u.message}),r.dirty()}else u.kind==="regex"?(u.regex.lastIndex=0,u.regex.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"regex",code:Me.invalid_string,message:u.message}),r.dirty())):u.kind==="trim"?t.data=t.data.trim():u.kind==="includes"?t.data.includes(u.value,u.position)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),r.dirty()):u.kind==="toLowerCase"?t.data=t.data.toLowerCase():u.kind==="toUpperCase"?t.data=t.data.toUpperCase():u.kind==="startsWith"?t.data.startsWith(u.value)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{startsWith:u.value},message:u.message}),r.dirty()):u.kind==="endsWith"?t.data.endsWith(u.value)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{endsWith:u.value},message:u.message}),r.dirty()):u.kind==="datetime"?Rb(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"datetime",message:u.message}),r.dirty()):u.kind==="date"?Eb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"date",message:u.message}),r.dirty()):u.kind==="time"?Mb(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"time",message:u.message}),r.dirty()):u.kind==="duration"?bb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"duration",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="ip"?Ab(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"ip",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="jwt"?Db(t.data,u.alg)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"jwt",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="cidr"?Ob(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cidr",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="base64"?Cb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"base64",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="base64url"?Tb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"base64url",code:Me.invalid_string,message:u.message}),r.dirty()):Bt.assertNever(u);return{status:r.value,value:t.data}}_regex(t,a,r){return this.refinement(c=>t.test(c),{validation:a,code:Me.invalid_string,...Xe.errToObj(r)})}_addCheck(t){return new ji({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Xe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Xe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Xe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Xe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Xe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Xe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Xe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Xe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Xe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Xe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Xe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Xe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Xe.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Xe.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Xe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Xe.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...Xe.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...Xe.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...Xe.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...Xe.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...Xe.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...Xe.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...Xe.errToObj(a)})}nonempty(t){return this.min(1,Xe.errToObj(t))}trim(){return new ji({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ji({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ji({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxLength(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}ji.create=n=>new ji({checks:[],typeName:ut.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...xt(n)});function Lb(n,t){const a=(n.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,c=a>r?a:r,u=Number.parseInt(n.toFixed(c).replace(".","")),h=Number.parseInt(t.toFixed(c).replace(".",""));return u%h/10**c}class Fo extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Qe.number){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.number,received:u.parsedType}),ft}let r;const c=new ms;for(const u of this._def.checks)u.kind==="int"?Bt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.invalid_type,expected:"integer",received:"float",message:u.message}),c.dirty()):u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_small,minimum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),c.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),c.dirty()):u.kind==="multipleOf"?Lb(t.data,u.value)!==0&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):u.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_finite,message:u.message}),c.dirty()):Bt.assertNever(u);return{status:c.value,value:t.data}}gte(t,a){return this.setLimit("min",t,!0,Xe.toString(a))}gt(t,a){return this.setLimit("min",t,!1,Xe.toString(a))}lte(t,a){return this.setLimit("max",t,!0,Xe.toString(a))}lt(t,a){return this.setLimit("max",t,!1,Xe.toString(a))}setLimit(t,a,r,c){return new Fo({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:Xe.toString(c)}]})}_addCheck(t){return new Fo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Xe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Xe.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:Xe.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:Xe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Xe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Xe.toString(t)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Bt.isInteger(t.value))}get isFinite(){let t=null,a=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(a===null||r.value>a)&&(a=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(a)&&Number.isFinite(t)}}Fo.create=n=>new Fo({checks:[],typeName:ut.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...xt(n)});class ku extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Qe.bigint)return this._getInvalidInput(t);let r;const c=new ms;for(const u of this._def.checks)u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),c.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),c.dirty()):u.kind==="multipleOf"?t.data%u.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):Bt.assertNever(u);return{status:c.value,value:t.data}}_getInvalidInput(t){const a=this._getOrReturnCtx(t);return Pe(a,{code:Me.invalid_type,expected:Qe.bigint,received:a.parsedType}),ft}gte(t,a){return this.setLimit("min",t,!0,Xe.toString(a))}gt(t,a){return this.setLimit("min",t,!1,Xe.toString(a))}lte(t,a){return this.setLimit("max",t,!0,Xe.toString(a))}lt(t,a){return this.setLimit("max",t,!1,Xe.toString(a))}setLimit(t,a,r,c){return new ku({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:Xe.toString(c)}]})}_addCheck(t){return new ku({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Xe.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:Xe.toString(a)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}ku.create=n=>new ku({checks:[],typeName:ut.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...xt(n)});class op extends At{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Qe.boolean){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.boolean,received:r.parsedType}),ft}return ra(t.data)}}op.create=n=>new op({typeName:ut.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...xt(n)});class Uf extends At{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Qe.date){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.date,received:u.parsedType}),ft}if(Number.isNaN(t.data.getTime())){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_date}),ft}const r=new ms;let c;for(const u of this._def.checks)u.kind==="min"?t.data.getTime()<u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),r.dirty()):u.kind==="max"?t.data.getTime()>u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),r.dirty()):Bt.assertNever(u);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Uf({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:Xe.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:Xe.toString(a)})}get minDate(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t!=null?new Date(t):null}}Uf.create=n=>new Uf({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:ut.ZodDate,...xt(n)});class f6 extends At{_parse(t){if(this._getType(t)!==Qe.symbol){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.symbol,received:r.parsedType}),ft}return ra(t.data)}}f6.create=n=>new f6({typeName:ut.ZodSymbol,...xt(n)});class h6 extends At{_parse(t){if(this._getType(t)!==Qe.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.undefined,received:r.parsedType}),ft}return ra(t.data)}}h6.create=n=>new h6({typeName:ut.ZodUndefined,...xt(n)});class m6 extends At{_parse(t){if(this._getType(t)!==Qe.null){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.null,received:r.parsedType}),ft}return ra(t.data)}}m6.create=n=>new m6({typeName:ut.ZodNull,...xt(n)});class cp extends At{constructor(){super(...arguments),this._any=!0}_parse(t){return ra(t.data)}}cp.create=n=>new cp({typeName:ut.ZodAny,...xt(n)});class p6 extends At{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ra(t.data)}}p6.create=n=>new p6({typeName:ut.ZodUnknown,...xt(n)});class Tr extends At{_parse(t){const a=this._getOrReturnCtx(t);return Pe(a,{code:Me.invalid_type,expected:Qe.never,received:a.parsedType}),ft}}Tr.create=n=>new Tr({typeName:ut.ZodNever,...xt(n)});class g6 extends At{_parse(t){if(this._getType(t)!==Qe.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.void,received:r.parsedType}),ft}return ra(t.data)}}g6.create=n=>new g6({typeName:ut.ZodVoid,...xt(n)});class $a extends At{_parse(t){const{ctx:a,status:r}=this._processInputParams(t),c=this._def;if(a.parsedType!==Qe.array)return Pe(a,{code:Me.invalid_type,expected:Qe.array,received:a.parsedType}),ft;if(c.exactLength!==null){const h=a.data.length>c.exactLength.value,p=a.data.length<c.exactLength.value;(h||p)&&(Pe(a,{code:h?Me.too_big:Me.too_small,minimum:p?c.exactLength.value:void 0,maximum:h?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),r.dirty())}if(c.minLength!==null&&a.data.length<c.minLength.value&&(Pe(a,{code:Me.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),r.dirty()),c.maxLength!==null&&a.data.length>c.maxLength.value&&(Pe(a,{code:Me.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),r.dirty()),a.common.async)return Promise.all([...a.data].map((h,p)=>c.type._parseAsync(new Ha(a,h,a.path,p)))).then(h=>ms.mergeArray(r,h));const u=[...a.data].map((h,p)=>c.type._parseSync(new Ha(a,h,a.path,p)));return ms.mergeArray(r,u)}get element(){return this._def.type}min(t,a){return new $a({...this._def,minLength:{value:t,message:Xe.toString(a)}})}max(t,a){return new $a({...this._def,maxLength:{value:t,message:Xe.toString(a)}})}length(t,a){return new $a({...this._def,exactLength:{value:t,message:Xe.toString(a)}})}nonempty(t){return this.min(1,t)}}$a.create=(n,t)=>new $a({type:n,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...xt(t)});function Co(n){if(n instanceof Dn){const t={};for(const a in n.shape){const r=n.shape[a];t[a]=kr.create(Co(r))}return new Dn({...n._def,shape:()=>t})}else return n instanceof $a?new $a({...n._def,type:Co(n.element)}):n instanceof kr?kr.create(Co(n.unwrap())):n instanceof Vo?Vo.create(Co(n.unwrap())):n instanceof Cl?Cl.create(n.items.map(t=>Co(t))):n}class Dn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),a=Bt.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(t){if(this._getType(t)!==Qe.object){const m=this._getOrReturnCtx(t);return Pe(m,{code:Me.invalid_type,expected:Qe.object,received:m.parsedType}),ft}const{status:r,ctx:c}=this._processInputParams(t),{shape:u,keys:h}=this._getCached(),p=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(const m in c.data)h.includes(m)||p.push(m);const y=[];for(const m of h){const b=u[m],g=c.data[m];y.push({key:{status:"valid",value:m},value:b._parse(new Ha(c,g,c.path,m)),alwaysSet:m in c.data})}if(this._def.catchall instanceof Tr){const m=this._def.unknownKeys;if(m==="passthrough")for(const b of p)y.push({key:{status:"valid",value:b},value:{status:"valid",value:c.data[b]}});else if(m==="strict")p.length>0&&(Pe(c,{code:Me.unrecognized_keys,keys:p}),r.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const b of p){const g=c.data[b];y.push({key:{status:"valid",value:b},value:m._parse(new Ha(c,g,c.path,b)),alwaysSet:b in c.data})}}return c.common.async?Promise.resolve().then(async()=>{const m=[];for(const b of y){const g=await b.key,x=await b.value;m.push({key:g,value:x,alwaysSet:b.alwaysSet})}return m}).then(m=>ms.mergeObjectSync(r,m)):ms.mergeObjectSync(r,y)}get shape(){return this._def.shape()}strict(t){return Xe.errToObj,new Dn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(a,r)=>{var u,h;const c=((h=(u=this._def).errorMap)==null?void 0:h.call(u,a,r).message)??r.defaultError;return a.code==="unrecognized_keys"?{message:Xe.errToObj(t).message??c}:{message:c}}}:{}})}strip(){return new Dn({...this._def,unknownKeys:"strip"})}passthrough(){return new Dn({...this._def,unknownKeys:"passthrough"})}extend(t){return new Dn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Dn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ut.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new Dn({...this._def,catchall:t})}pick(t){const a={};for(const r of Bt.objectKeys(t))t[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new Dn({...this._def,shape:()=>a})}omit(t){const a={};for(const r of Bt.objectKeys(this.shape))t[r]||(a[r]=this.shape[r]);return new Dn({...this._def,shape:()=>a})}deepPartial(){return Co(this)}partial(t){const a={};for(const r of Bt.objectKeys(this.shape)){const c=this.shape[r];t&&!t[r]?a[r]=c:a[r]=c.optional()}return new Dn({...this._def,shape:()=>a})}required(t){const a={};for(const r of Bt.objectKeys(this.shape))if(t&&!t[r])a[r]=this.shape[r];else{let u=this.shape[r];for(;u instanceof kr;)u=u._def.innerType;a[r]=u}return new Dn({...this._def,shape:()=>a})}keyof(){return N3(Bt.objectKeys(this.shape))}}Dn.create=(n,t)=>new Dn({shape:()=>n,unknownKeys:"strip",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});Dn.strictCreate=(n,t)=>new Dn({shape:()=>n,unknownKeys:"strict",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});Dn.lazycreate=(n,t)=>new Dn({shape:n,unknownKeys:"strip",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});class qf extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r=this._def.options;function c(u){for(const p of u)if(p.result.status==="valid")return p.result;for(const p of u)if(p.result.status==="dirty")return a.common.issues.push(...p.ctx.common.issues),p.result;const h=u.map(p=>new Ni(p.ctx.common.issues));return Pe(a,{code:Me.invalid_union,unionErrors:h}),ft}if(a.common.async)return Promise.all(r.map(async u=>{const h={...a,common:{...a.common,issues:[]},parent:null};return{result:await u._parseAsync({data:a.data,path:a.path,parent:h}),ctx:h}})).then(c);{let u;const h=[];for(const y of r){const m={...a,common:{...a.common,issues:[]},parent:null},b=y._parseSync({data:a.data,path:a.path,parent:m});if(b.status==="valid")return b;b.status==="dirty"&&!u&&(u={result:b,ctx:m}),m.common.issues.length&&h.push(m.common.issues)}if(u)return a.common.issues.push(...u.ctx.common.issues),u.result;const p=h.map(y=>new Ni(y));return Pe(a,{code:Me.invalid_union,unionErrors:p}),ft}}get options(){return this._def.options}}qf.create=(n,t)=>new qf({options:n,typeName:ut.ZodUnion,...xt(t)});function up(n,t){const a=lr(n),r=lr(t);if(n===t)return{valid:!0,data:n};if(a===Qe.object&&r===Qe.object){const c=Bt.objectKeys(t),u=Bt.objectKeys(n).filter(p=>c.indexOf(p)!==-1),h={...n,...t};for(const p of u){const y=up(n[p],t[p]);if(!y.valid)return{valid:!1};h[p]=y.data}return{valid:!0,data:h}}else if(a===Qe.array&&r===Qe.array){if(n.length!==t.length)return{valid:!1};const c=[];for(let u=0;u<n.length;u++){const h=n[u],p=t[u],y=up(h,p);if(!y.valid)return{valid:!1};c.push(y.data)}return{valid:!0,data:c}}else return a===Qe.date&&r===Qe.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}class $f extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t),c=(u,h)=>{if(c6(u)||c6(h))return ft;const p=up(u.value,h.value);return p.valid?((u6(u)||u6(h))&&a.dirty(),{status:a.value,value:p.data}):(Pe(r,{code:Me.invalid_intersection_types}),ft)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([u,h])=>c(u,h)):c(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}$f.create=(n,t,a)=>new $f({left:n,right:t,typeName:ut.ZodIntersection,...xt(a)});class Cl extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.array)return Pe(r,{code:Me.invalid_type,expected:Qe.array,received:r.parsedType}),ft;if(r.data.length<this._def.items.length)return Pe(r,{code:Me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ft;!this._def.rest&&r.data.length>this._def.items.length&&(Pe(r,{code:Me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const u=[...r.data].map((h,p)=>{const y=this._def.items[p]||this._def.rest;return y?y._parse(new Ha(r,h,r.path,p)):null}).filter(h=>!!h);return r.common.async?Promise.all(u).then(h=>ms.mergeArray(a,h)):ms.mergeArray(a,u)}get items(){return this._def.items}rest(t){return new Cl({...this._def,rest:t})}}Cl.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cl({items:n,typeName:ut.ZodTuple,rest:null,...xt(t)})};class Hf extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.object)return Pe(r,{code:Me.invalid_type,expected:Qe.object,received:r.parsedType}),ft;const c=[],u=this._def.keyType,h=this._def.valueType;for(const p in r.data)c.push({key:u._parse(new Ha(r,p,r.path,p)),value:h._parse(new Ha(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?ms.mergeObjectAsync(a,c):ms.mergeObjectSync(a,c)}get element(){return this._def.valueType}static create(t,a,r){return a instanceof At?new Hf({keyType:t,valueType:a,typeName:ut.ZodRecord,...xt(r)}):new Hf({keyType:ji.create(),valueType:t,typeName:ut.ZodRecord,...xt(a)})}}class y6 extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.map)return Pe(r,{code:Me.invalid_type,expected:Qe.map,received:r.parsedType}),ft;const c=this._def.keyType,u=this._def.valueType,h=[...r.data.entries()].map(([p,y],m)=>({key:c._parse(new Ha(r,p,r.path,[m,"key"])),value:u._parse(new Ha(r,y,r.path,[m,"value"]))}));if(r.common.async){const p=new Map;return Promise.resolve().then(async()=>{for(const y of h){const m=await y.key,b=await y.value;if(m.status==="aborted"||b.status==="aborted")return ft;(m.status==="dirty"||b.status==="dirty")&&a.dirty(),p.set(m.value,b.value)}return{status:a.value,value:p}})}else{const p=new Map;for(const y of h){const m=y.key,b=y.value;if(m.status==="aborted"||b.status==="aborted")return ft;(m.status==="dirty"||b.status==="dirty")&&a.dirty(),p.set(m.value,b.value)}return{status:a.value,value:p}}}}y6.create=(n,t,a)=>new y6({valueType:t,keyType:n,typeName:ut.ZodMap,...xt(a)});class Nu extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.set)return Pe(r,{code:Me.invalid_type,expected:Qe.set,received:r.parsedType}),ft;const c=this._def;c.minSize!==null&&r.data.size<c.minSize.value&&(Pe(r,{code:Me.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),a.dirty()),c.maxSize!==null&&r.data.size>c.maxSize.value&&(Pe(r,{code:Me.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),a.dirty());const u=this._def.valueType;function h(y){const m=new Set;for(const b of y){if(b.status==="aborted")return ft;b.status==="dirty"&&a.dirty(),m.add(b.value)}return{status:a.value,value:m}}const p=[...r.data.values()].map((y,m)=>u._parse(new Ha(r,y,r.path,m)));return r.common.async?Promise.all(p).then(y=>h(y)):h(p)}min(t,a){return new Nu({...this._def,minSize:{value:t,message:Xe.toString(a)}})}max(t,a){return new Nu({...this._def,maxSize:{value:t,message:Xe.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}Nu.create=(n,t)=>new Nu({valueType:n,minSize:null,maxSize:null,typeName:ut.ZodSet,...xt(t)});class v6 extends At{get schema(){return this._def.getter()}_parse(t){const{ctx:a}=this._processInputParams(t);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}v6.create=(n,t)=>new v6({getter:n,typeName:ut.ZodLazy,...xt(t)});class dp extends At{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return Pe(a,{received:a.data,code:Me.invalid_literal,expected:this._def.value}),ft}return{status:"valid",value:t.data}}get value(){return this._def.value}}dp.create=(n,t)=>new dp({value:n,typeName:ut.ZodLiteral,...xt(t)});function N3(n,t){return new Qo({values:n,typeName:ut.ZodEnum,...xt(t)})}class Qo extends At{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),r=this._def.values;return Pe(a,{expected:Bt.joinValues(r),received:a.parsedType,code:Me.invalid_type}),ft}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const a=this._getOrReturnCtx(t),r=this._def.values;return Pe(a,{received:a.data,code:Me.invalid_enum_value,options:r}),ft}return ra(t.data)}get options(){return this._def.values}get enum(){const t={};for(const a of this._def.values)t[a]=a;return t}get Values(){const t={};for(const a of this._def.values)t[a]=a;return t}get Enum(){const t={};for(const a of this._def.values)t[a]=a;return t}extract(t,a=this._def){return Qo.create(t,{...this._def,...a})}exclude(t,a=this._def){return Qo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...a})}}Qo.create=N3;class _6 extends At{_parse(t){const a=Bt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Qe.string&&r.parsedType!==Qe.number){const c=Bt.objectValues(a);return Pe(r,{expected:Bt.joinValues(c),received:r.parsedType,code:Me.invalid_type}),ft}if(this._cache||(this._cache=new Set(Bt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const c=Bt.objectValues(a);return Pe(r,{received:r.data,code:Me.invalid_enum_value,options:c}),ft}return ra(t.data)}get enum(){return this._def.values}}_6.create=(n,t)=>new _6({values:n,typeName:ut.ZodNativeEnum,...xt(t)});class Ff extends At{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==Qe.promise&&a.common.async===!1)return Pe(a,{code:Me.invalid_type,expected:Qe.promise,received:a.parsedType}),ft;const r=a.parsedType===Qe.promise?a.data:Promise.resolve(a.data);return ra(r.then(c=>this._def.type.parseAsync(c,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ff.create=(n,t)=>new Ff({type:n,typeName:ut.ZodPromise,...xt(t)});class Go extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:r}=this._processInputParams(t),c=this._def.effect||null,u={addIssue:h=>{Pe(r,h),h.fatal?a.abort():a.dirty()},get path(){return r.path}};if(u.addIssue=u.addIssue.bind(u),c.type==="preprocess"){const h=c.transform(r.data,u);if(r.common.async)return Promise.resolve(h).then(async p=>{if(a.value==="aborted")return ft;const y=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return y.status==="aborted"?ft:y.status==="dirty"||a.value==="dirty"?fu(y.value):y});{if(a.value==="aborted")return ft;const p=this._def.schema._parseSync({data:h,path:r.path,parent:r});return p.status==="aborted"?ft:p.status==="dirty"||a.value==="dirty"?fu(p.value):p}}if(c.type==="refinement"){const h=p=>{const y=c.refinement(p,u);if(r.common.async)return Promise.resolve(y);if(y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){const p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?ft:(p.status==="dirty"&&a.dirty(),h(p.value),{status:a.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?ft:(p.status==="dirty"&&a.dirty(),h(p.value).then(()=>({status:a.value,value:p.value}))))}if(c.type==="transform")if(r.common.async===!1){const h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ho(h))return ft;const p=c.transform(h.value,u);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>Ho(h)?Promise.resolve(c.transform(h.value,u)).then(p=>({status:a.value,value:p})):ft);Bt.assertNever(c)}}Go.create=(n,t,a)=>new Go({schema:n,typeName:ut.ZodEffects,effect:t,...xt(a)});Go.createWithPreprocess=(n,t,a)=>new Go({schema:t,effect:{type:"preprocess",transform:n},typeName:ut.ZodEffects,...xt(a)});class kr extends At{_parse(t){return this._getType(t)===Qe.undefined?ra(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}kr.create=(n,t)=>new kr({innerType:n,typeName:ut.ZodOptional,...xt(t)});class Vo extends At{_parse(t){return this._getType(t)===Qe.null?ra(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Vo.create=(n,t)=>new Vo({innerType:n,typeName:ut.ZodNullable,...xt(t)});class fp extends At{_parse(t){const{ctx:a}=this._processInputParams(t);let r=a.data;return a.parsedType===Qe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}fp.create=(n,t)=>new fp({innerType:n,typeName:ut.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class hp extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r={...a,common:{...a.common,issues:[]}},c=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pf(c)?c.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}hp.create=(n,t)=>new hp({innerType:n,typeName:ut.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class b6 extends At{_parse(t){if(this._getType(t)!==Qe.nan){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.nan,received:r.parsedType}),ft}return{status:"valid",value:t.data}}}b6.create=n=>new b6({typeName:ut.ZodNaN,...xt(n)});class Ib extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r=a.data;return this._def.type._parse({data:r,path:a.path,parent:a})}unwrap(){return this._def.type}}class Yp extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const u=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?ft:u.status==="dirty"?(a.dirty(),fu(u.value)):this._def.out._parseAsync({data:u.value,path:r.path,parent:r})})();{const c=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?ft:c.status==="dirty"?(a.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:r.path,parent:r})}}static create(t,a){return new Yp({in:t,out:a,typeName:ut.ZodPipeline})}}class mp extends At{_parse(t){const a=this._def.innerType._parse(t),r=c=>(Ho(c)&&(c.value=Object.freeze(c.value)),c);return Pf(a)?a.then(c=>r(c)):r(a)}unwrap(){return this._def.innerType}}mp.create=(n,t)=>new mp({innerType:n,typeName:ut.ZodReadonly,...xt(t)});var ut;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(ut||(ut={}));const M=ji.create,nt=Fo.create,Yt=op.create,zb=cp.create;Tr.create;const vt=$a.create,Be=Dn.create;qf.create;$f.create;Cl.create;const Qf=Hf.create,Zp=dp.create,Dt=Qo.create;Ff.create;kr.create;Vo.create;const C3=Dt(["codex","claude"]),Bb=Dt(["managed","attached-live","history-only"]),Pb=Dt(["active","idle","attention","offline"]),Ub=Dt(["idle","running","completed"]),T3=Dt(["image","file"]),qb=Dt(["user","repo","system","admin"]),$b=Be({can_stream_live:Yt(),can_send_input:Yt(),can_interrupt:Yt(),can_approve:Yt(),can_reject:Yt(),can_show_git:Yt(),can_show_terminal:Yt()}),Hb=Be({used_tokens:nt(),total_tokens:nt(),remaining_tokens:nt(),percent_used:nt(),cached_input_tokens:nt(),output_tokens:nt(),reasoning_output_tokens:nt(),updated_at:M()}),Fb=Dt(["pending","in_progress","completed"]),Qb=Be({id:M(),step:M(),status:Fb}),Gb=Be({session_id:M(),turn_id:M().nullable(),source:Dt(["rollout","app-server"]),updated_at:M(),explanation:M().nullable().default(null),steps:vt(Qb),completed_count:nt().int().nonnegative(),total_count:nt().int().nonnegative(),is_active:Yt()}),Vb=Be({parent_session_id:M(),root_session_id:M().nullable().default(null),nickname:M().nullable().default(null),role:M().nullable().default(null),depth:nt().int().nonnegative()}),Kb=Dt(["user_input","command_execution_approval","file_change_approval","permissions_approval","mcp_elicitation"]),Yb=Dt(["pending","submitting","resolved"]),E3=Be({id:M(),label:M(),description:M().nullable().default(null),emphasis:Dt(["default","primary","danger"]).default("default")}),Zb=Be({id:M(),header:M().nullable().default(null),question:M(),options:vt(E3).default([]),allow_other:Yt().default(!1),is_secret:Yt().default(!1)}),Wb=Be({id:M(),session_id:M(),turn_id:M().nullable().default(null),item_id:M().nullable().default(null),kind:Kb,status:Yb,title:M(),description:M().nullable().default(null),created_at:M(),updated_at:M(),options:vt(E3).default([]),questions:vt(Zb).default([]),allow_freeform:Yt().default(!1),freeform_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null)}),Xb=Be({id:M(),kind:T3,name:M().nullable().default(null),mime_type:M().nullable().default(null),size_bytes:nt().int().nonnegative().nullable().default(null),content_url:M().nullable().default(null)}),x6=Be({id:M(),kind:T3,name:M(),mime_type:M().nullable().default(null),size_bytes:nt().int().nonnegative().nullable().default(null),data_url:M()}),Jb=Be({name:M(),description:M(),path:M(),scope:qb,enabled:Yt()}),e7=Dt(["supported","unsupported"]),t7=Be({name:M(),description:M(),availability:e7.default("supported")}),S6=Be({cli_version:M().nullable().default(null),loaded_at:M(),cache_ttl_ms:nt().int().nonnegative(),commands:vt(t7)});Be({id:M(),label:M(),description:M(),isDefault:Yt(),defaultReasoningEffort:M().nullable().default(null),supportedReasoningEfforts:vt(M()).default([])});const n7=Dt(["running","awaiting_input","completed","failed"]),s7=Dt(["none","choice","text"]),a7=Be({id:M(),label:M(),description:M().nullable().default(null)}),i7=Be({type:Zp("set_session_model"),model:M(),reasoning_effort:M().nullable().default(null)}).nullable().default(null),r7=Be({panel_id:M(),session_id:M(),command_name:M(),command_text:M(),title:M(),description:M().nullable().default(null),status:n7,body:M(),submitted_at:M(),updated_at:M(),input_type:s7,options:vt(a7).default([]),input_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null),effect:i7}),j6=Be({panel:r7}),M3=Be({id:M(),name:M(),host:M(),tailscale_ip:M().nullable().default(null),tailscale_dns_name:M().nullable().default(null),direct_base_url:M(),ws_base_url:M(),status:Dt(["online","offline"]),provider_availability:vt(C3),project_count:nt(),session_count:nt(),transport:Dt(["direct-agent","hub-routed"]),version:M().nullable().default(null),registered_at:M().nullable().default(null),last_seen_at:M().nullable().default(null)}),R3=Be({id:M(),agent_id:M(),name:M(),display_name:M().nullable(),pinned:Yt(),path:M(),branch:M(),worktree:M(),runtime_profiles:vt(M()),preview_url:M().nullable()}),A3=Be({id:M(),agent_id:M(),project_id:M(),provider:C3,archived:Yt(),title:M(),mode:Bb,health:Pb,branch:M(),worktree:M(),summary:M(),last_event_at:M(),pinned:Yt(),run_state:Ub,run_state_changed_at:M().nullable(),context_usage:Hb.nullable().default(null),subagent:Vb.nullable().default(null),capability:$b}),D3=Be({id:M(),kind:Dt(["user","assistant","thinking","tool","system"]),title:M(),body:M(),timestamp:M(),accent:Dt(["primary","secondary","muted"]),attachments:vt(Xb).default([])}),l7=Dt(["app-server","rollout-fallback"]),o7=Dt(["running","completed"]),c7=Dt(["add","delete","update"]),u7=Be({path:M(),kind:c7,move_path:M().nullable(),additions:nt(),deletions:nt(),diff:M(),item_id:M().nullable()}),d7=Be({id:M(),session_id:M(),turn_id:M(),source:l7,status:o7,started_at:M(),completed_at:M().nullable(),updated_at:M(),aggregated_diff:M(),files:vt(u7)}),f7=Be({path:M(),status:Dt(["modified","added","deleted","renamed"]),additions:nt(),deletions:nt()}),O3=Dt(["modified","added","deleted","renamed","untracked"]),h7=Be({path:M(),previous_path:M().nullable().default(null),status:O3,additions:nt().int().nonnegative(),deletions:nt().int().nonnegative()}),m7=Be({session_id:M(),project_id:M(),path:M(),previous_path:M().nullable().default(null),additions:nt().int().nonnegative(),deletions:nt().int().nonnegative(),diff:M()}),L3=Be({session_id:M(),project_id:M(),branch:M(),branches:vt(M()),upstream_branch:M().nullable().default(null),ahead_count:nt().int().nonnegative(),behind_count:nt().int().nonnegative(),files:vt(h7),updated_at:M()}),p7=Be({path:M(),previous_path:M().nullable().default(null),status:O3}),g7=Be({oid:M(),short_oid:M(),subject:M(),author_name:M(),authored_at:M(),committed_at:M(),parent_oids:vt(M()).default([]),refs:vt(M()).default([]),files:vt(p7)}),y7=Be({session_id:M(),project_id:M(),commit_oid:M(),path:M(),previous_path:M().nullable().default(null),additions:nt().int().nonnegative(),deletions:nt().int().nonnegative(),diff:M()}),v7=Be({session_id:M(),project_id:M(),branch:M(),upstream_branch:M().nullable().default(null),head_oid:M().nullable().default(null),upstream_head_oid:M().nullable().default(null),commits:vt(g7),updated_at:M()});Dt(["discard-file","discard-all","commit-all","switch-branch","push"]);const _7=Be({ok:Zp(!0),workspace:L3}),I3=Dt(["auto","powershell","cmd","bash"]),b7=Dt(["user","codex"]),x7=Be({id:M(),name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:I3.default("auto"),node_version:M().nullable().default(null),port:nt().int().positive().nullable().default(null),source:b7.default("user"),created_at:M(),updated_at:M()}),S7=Be({name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:I3.default("auto"),node_version:M().nullable().default(null),port:nt().int().positive().nullable().default(null)}),Wp=Be({session_id:M(),project_id:M(),config_path:M(),commands:vt(x7),updated_at:M()}),j7=Dt(["user","codex"]),w7=Be({id:M(),name:M(),description:M().nullable().default(null),url:M(),source:j7.default("user"),created_at:M(),updated_at:M()}),k7=Be({name:M(),description:M().nullable().default(null),url:M()}),Xp=Be({session_id:M(),project_id:M(),config_path:M(),websites:vt(w7),updated_at:M()}),N7=Dt(["queued","running","completed","failed","stopped"]),C7=Dt(["stdout","stderr","system"]),T7=Be({cursor:nt().int().nonnegative(),stream:C7,text:M(),timestamp:M()}),Jp=Be({id:M(),session_id:M(),project_id:M(),command_id:M().nullable().default(null),title:M(),command:M(),cwd:M(),status:N7,exit_code:nt().int().nullable().default(null),created_at:M(),started_at:M().nullable().default(null),completed_at:M().nullable().default(null),updated_at:M(),last_output_at:M().nullable().default(null),output_cursor:nt().int().nonnegative(),preview:M().nullable().default(null)}),z3=Be({session_id:M(),project_id:M(),active_terminal_id:M().nullable().default(null),terminals:vt(Jp),updated_at:M()}),E7=Be({session_id:M(),project_id:M(),terminal:Jp,chunks:vt(T7),next_cursor:nt().int().nonnegative(),truncated:Yt().default(!1)}),M7=Be({manager:Dt(["none","nvm-windows"]).default("none"),versions:vt(M()).default([]),error:M().nullable().default(null)}),R7=Be({command_catalog:Wp,website_catalog:Xp,node_runtime:M7,terminal_snapshot:z3}),A7=Be({catalog:Wp}),D7=Be({catalog:Xp}),O7=Be({commands:vt(S7),reason:M().nullable().default(null)}),L7=Be({generation:O7,catalog:Wp}),I7=Be({websites:vt(k7),reason:M().nullable().default(null)}),z7=Be({generation:I7,catalog:Xp}),B7=Be({snapshot:z3,terminal:Jp.nullable().default(null)}),P7=Be({id:M(),name:M(),command:M(),port:nt().nullable(),status:Dt(["running","stopped","degraded"]),log_excerpt:M()}),U7=Be({id:M(),label:M(),url:M(),status:Dt(["ready","starting","stopped"])}),q7=Be({path:M(),name:M(),has_children:Yt()}),$7=Be({id:M(),title:M(),description:M(),status:Dt(["pending","approved","rejected"])}),H7=Be({generated_at:M(),agents:vt(M3),projects:vt(R3),sessions:vt(A3),active_session_id:M(),timeline:vt(D3),changed_files:vt(f7),runtime_processes:vt(P7),previews:vt(U7),approvals:vt($7)});Be({agent:M3,projects:vt(R3),sessions:vt(A3),active_session_id:M().default(""),generated_at:M()});const w6=Be({ok:Zp(!0),agent_id:M(),heartbeat_interval_ms:nt().int().positive(),heartbeat_timeout_ms:nt().int().positive(),registered_at:M(),received_at:M()}),F7=Be({type:Dt(["agent.online","snapshot.changed","session.updated","timeline.delta","timeline.reset","interaction.delta","interaction.reset","plan.delta","plan.reset","changeset.delta","changeset.reset","terminal.snapshot","terminal.delta","turn.delta","turn.completed","approval.requested"]),timestamp:M(),payload:Qf(zb())}),Q7=Be({width:nt().nonnegative(),height:nt().nonnegative(),device_pixel_ratio:nt().nonnegative(),visual_width:nt().nonnegative().nullable().default(null),visual_height:nt().nonnegative().nullable().default(null),screen_width:nt().nonnegative().nullable().default(null),screen_height:nt().nonnegative().nullable().default(null)}),G7=Be({user_agent:M(),language:M().nullable().default(null),languages:vt(M()).default([]),platform:M().nullable().default(null),vendor:M().nullable().default(null),online:Yt().nullable().default(null),cookie_enabled:Yt().nullable().default(null),secure_context:Yt(),standalone_display_mode:Yt(),hardware_concurrency:nt().int().nonnegative().nullable().default(null),device_memory_gb:nt().nonnegative().nullable().default(null),max_touch_points:nt().int().nonnegative().nullable().default(null)}),V7=Be({href:M(),pathname:M(),referrer:M().nullable().default(null),visibility_state:M().nullable().default(null)}),K7=Be({scope:M(),active_script_url:M().nullable().default(null),waiting_script_url:M().nullable().default(null),installing_script_url:M().nullable().default(null)}),Y7=Be({supported:Yt(),controller:Yt(),registrations:vt(K7).default([])}),Z7=Be({supported:Yt(),keys:vt(M()).default([])}),W7=Be({href:M().nullable().default(null),rel:M().nullable().default(null)}),X7=Be({href:M().nullable().default(null),owner_node:M().nullable().default(null),media:M().nullable().default(null),disabled:Yt(),css_rule_count:nt().int().nonnegative().nullable().default(null)}),J7=Be({url:M(),kind:Dt(["stylesheet","script","manifest","icon","other"]),ok:Yt(),status:nt().int().nonnegative().nullable().default(null),content_type:M().nullable().default(null),cache_control:M().nullable().default(null),error:M().nullable().default(null)}),ex=Be({name:M(),initiator_type:M().nullable().default(null),duration_ms:nt().nonnegative().nullable().default(null),transfer_size:nt().nonnegative().nullable().default(null),decoded_body_size:nt().nonnegative().nullable().default(null)}),tx=Be({x:nt(),y:nt(),width:nt().nonnegative(),height:nt().nonnegative()}),nx=Be({selector:M(),found:Yt(),text_preview:M().nullable().default(null),rect:tx.nullable().default(null),computed:Qf(M()).default({})});Be({captured_at:M(),page:V7,environment:G7,viewport:Q7,feature_support:Qf(Yt()).default({}),service_worker:Y7,cache:Z7,manifest:W7,stylesheets:vt(X7).default([]),resource_probes:vt(J7).default([]),performance_entries:vt(ex).default([]),theme_variables:Qf(M()).default({}),element_snapshots:vt(nx).default([]),notes:vt(M()).default([])});const sx=/^(?:image|img|photo|picture|screenshot|图片|照片|截图)(?:[-_ ]?\d+)?\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/i,Xn=n=>(n==null?void 0:n.trim())??"",k6="\0",N6=n=>{const t=Xn(n);return t?sx.test(t)?1:2+Math.min(t.length,64)/100:0},ax=(n,t)=>{const a=N6(n),r=N6(t);if(r>a)return Xn(t)||null;if(a>r)return Xn(n)||null;const c=Xn(n),u=Xn(t);return u.length>c.length?u||null:c||null},ix=n=>{const t=Xn(n.content_url);return t?[n.kind,"content",t].join(k6):[n.kind,"meta",Xn(n.mime_type).toLowerCase(),typeof n.size_bytes=="number"&&Number.isFinite(n.size_bytes)?String(Math.max(0,Math.round(n.size_bytes))):"",Xn(n.name).toLowerCase()].join(k6)},rx=(n,t)=>{const a=Xn(n.name),r=Xn(t.name),c=Xn(n.mime_type),u=Xn(t.mime_type);return{id:n.id||t.id,kind:n.kind==="image"||t.kind==="image"?"image":n.kind,name:ax(a,r),mime_type:c||u||null,size_bytes:n.size_bytes??t.size_bytes??null,content_url:Xn(n.content_url)||Xn(t.content_url)||null}},B3=n=>{if(!n||n.length===0)return[];const t=[],a=new Map;for(const r of n){const c=ix(r),u=a.get(c);if(u===void 0){a.set(c,t.length),t.push({...r,name:Xn(r.name)||null,mime_type:Xn(r.mime_type)||null,size_bytes:typeof r.size_bytes=="number"&&Number.isFinite(r.size_bytes)?Math.max(0,Math.round(r.size_bytes)):null,content_url:Xn(r.content_url)||null});continue}t[u]=rx(t[u],r)}return t},P3=(n,t)=>B3([...n??[],...t??[]]),Ns=n=>new Date(n).toISOString(),lx=()=>({generated_at:new Date().toISOString(),active_session_id:"session-managed-1",agents:[{id:"agent-shanghai-main",name:"studio-main",host:"100.88.10.14",tailscale_ip:"100.88.10.14",tailscale_dns_name:"studio-main.tail-scale.ts.net",direct_base_url:"http://100.88.10.14:4242",ws_base_url:"ws://100.88.10.14:4242/ws",status:"online",provider_availability:["codex"],project_count:2,session_count:2,transport:"direct-agent",version:"0.1.0",registered_at:Ns("2026-03-18T10:30:00+08:00"),last_seen_at:Ns("2026-03-18T10:58:00+08:00")},{id:"agent-macbook",name:"macbook-air",host:"100.89.20.77",tailscale_ip:"100.89.20.77",tailscale_dns_name:"macbook-air.tail-scale.ts.net",direct_base_url:"http://100.89.20.77:4242",ws_base_url:"ws://100.89.20.77:4242/ws",status:"online",provider_availability:["codex"],project_count:1,session_count:1,transport:"hub-routed",version:"0.1.0",registered_at:Ns("2026-03-18T10:20:00+08:00"),last_seen_at:Ns("2026-03-18T10:55:00+08:00")}],projects:[{id:"project-panda",agent_id:"agent-shanghai-main",name:"panda",display_name:null,pinned:!1,path:"D:/ai/panda",branch:"main",worktree:"default",runtime_profiles:["dev","storybook","test"],preview_url:"https://panda.tailnet.ts.net"},{id:"project-remodex-lab",agent_id:"agent-shanghai-main",name:"remodex",display_name:null,pinned:!1,path:"D:/ai/remodex",branch:"phase1-ui",worktree:"mobile-lab",runtime_profiles:["dev"],preview_url:null},{id:"project-notes",agent_id:"agent-macbook",name:"notes",display_name:null,pinned:!1,path:"D:/Users/dev/notes",branch:"research",worktree:"default",runtime_profiles:["dev"],preview_url:null}],sessions:[{id:"session-managed-1",agent_id:"agent-shanghai-main",project_id:"project-panda",provider:"codex",archived:!1,title:"Stage 1 buildout",mode:"managed",health:"active",branch:"main",worktree:"default",summary:"Monorepo scaffold, PWA shell, agent bootstrap API",last_event_at:Ns("2026-03-18T10:58:00+08:00"),pinned:!1,run_state:"running",run_state_changed_at:Ns("2026-03-18T10:57:20+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!0,can_interrupt:!0,can_approve:!0,can_reject:!0,can_show_git:!0,can_show_terminal:!0}},{id:"session-live-2",agent_id:"agent-shanghai-main",project_id:"project-remodex-lab",provider:"codex",archived:!1,title:"Remote attach",mode:"attached-live",health:"idle",branch:"phase1-ui",worktree:"mobile-lab",summary:"",last_event_at:Ns("2026-03-18T10:48:00+08:00"),pinned:!1,run_state:"completed",run_state_changed_at:Ns("2026-03-18T10:48:00+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!0}},{id:"session-history-3",agent_id:"agent-macbook",project_id:"project-notes",provider:"codex",archived:!1,title:"Research notes",mode:"history-only",health:"offline",branch:"research",worktree:"default",summary:"",last_event_at:Ns("2026-03-17T19:12:00+08:00"),pinned:!1,run_state:"idle",run_state_changed_at:null,context_usage:null,subagent:null,capability:{can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!1}}],timeline:[{id:"entry-1",kind:"system",title:"Session ready",body:"Managed session attached.",timestamp:Ns("2026-03-18T10:40:00+08:00"),accent:"muted",attachments:[]},{id:"entry-2",kind:"user",title:"Prompt",body:"Start stage one.",timestamp:Ns("2026-03-18T10:44:00+08:00"),accent:"primary",attachments:[]},{id:"entry-3",kind:"thinking",title:"Plan",body:"Aligning routes and session state.",timestamp:Ns("2026-03-18T10:45:30+08:00"),accent:"secondary",attachments:[]},{id:"entry-4",kind:"tool",title:"Tool activity",body:"Scanned docs/, checked runtime versions, and created the initial workspace directories.",timestamp:Ns("2026-03-18T10:48:00+08:00"),accent:"secondary",attachments:[]},{id:"entry-5",kind:"assistant",title:"Focus",body:"Wiring the shell.",timestamp:Ns("2026-03-18T10:58:00+08:00"),accent:"primary",attachments:[]}],changed_files:[{path:"apps/web/src/components/dashboard.tsx",status:"added",additions:248,deletions:0},{path:"packages/protocol/src/index.ts",status:"modified",additions:94,deletions:12},{path:"apps/agent/src/index.ts",status:"modified",additions:77,deletions:3}],runtime_processes:[{id:"runtime-dev",name:"dev",command:"pnpm --filter @panda/web dev --host 0.0.0.0 --port 4173",port:4173,status:"running",log_excerpt:"Vite server ready on 0.0.0.0:4173 and previewed over the tailnet."},{id:"runtime-agent",name:"agent",command:"pnpm --filter @panda/agent dev",port:4242,status:"running",log_excerpt:"Fastify listening on http://0.0.0.0:4242 with WebSocket events enabled."}],previews:[{id:"preview-main",label:"PWA preview",url:"https://panda.tailnet.ts.net",status:"ready"},{id:"preview-storybook",label:"Design lab",url:"https://storybook.tailnet.ts.net",status:"starting"}],approvals:[{id:"approval-1",title:"Write workspace files",description:"Create monorepo config, React app shell, and Fastify agent entrypoints.",status:"approved"},{id:"approval-2",title:"Attach external Codex session",description:"External session controls remain experimental until app-server transport is available.",status:"pending"}]}),ox=()=>lx(),cx=()=>ox(),U3=n=>{const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/ws",t.toString()};class ux{constructor(t,a=U3(t)){this.baseUrl=t,this.wsBaseUrl=a}async readJson(t,a){const r=await fetch(t);if(!r.ok)throw new Error(`Request failed with ${r.status}`);return a.parse(await r.json())}async postJson(t,a,r){const c=await fetch(new URL(t,this.baseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),u=await c.json().catch(()=>null);if(!c.ok)throw new Error((u==null?void 0:u.error)??`Request failed with ${c.status}`);return r?r.parse(u):u}async getPhaseOneSnapshot(t){const{fallbackToMock:a=!0,fallbackSnapshot:r=cx}=t??{};try{const c=await fetch(new URL("/api/bootstrap",this.baseUrl));if(!c.ok)throw new Error(`Bootstrap request failed with ${c.status}`);const u=await c.json();return H7.parse(u)}catch(c){if(!a)throw c;return r()}}async getSessionTimeline(t){return await this.readJson(new URL(`/api/sessions/${t}/timeline`,this.baseUrl),{parse:r=>Array.isArray(r)?r.map(c=>D3.parse(c)):[]})}async getSessionChangeSets(t){return this.readJson(new URL(`/api/sessions/${t}/change-sets`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>d7.parse(r)):[]})}async getSessionGitWorkspace(t){return this.readJson(new URL(`/api/sessions/${t}/git-workspace`,this.baseUrl),L3)}async getSessionGitWorkspaceFileDiff(t,a){const r=new URL(`/api/sessions/${t}/git-workspace/file-diff`,this.baseUrl);return r.searchParams.set("path",a.path),a.previousPath&&r.searchParams.set("previousPath",a.previousPath),this.readJson(r,m7)}async getSessionGitHistory(t){return this.readJson(new URL(`/api/sessions/${t}/git/history`,this.baseUrl),v7)}async getSessionGitHistoryFileDiff(t,a){const r=new URL(`/api/sessions/${t}/git/history/file-diff`,this.baseUrl);return r.searchParams.set("commitOid",a.commitOid),r.searchParams.set("path",a.path),a.previousPath&&r.searchParams.set("previousPath",a.previousPath),this.readJson(r,y7)}async getSessionRunWorkbench(t){return this.readJson(new URL(`/api/sessions/${t}/run-workbench`,this.baseUrl),R7)}async saveSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands`,{action:t.action,commandId:t.commandId??null,command:t.command??null},A7)}async generateSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands/generate`,{prompt:t.prompt,model:t.model},L7)}async saveSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites`,{action:t.action,websiteId:t.websiteId??null,website:t.website??null},D7)}async generateSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites/generate`,{prompt:t.prompt,model:t.model},z7)}async executeSessionTerminalAction(t){return this.postJson(`/api/sessions/${t.sessionId}/terminals`,{action:t.action,commandId:t.commandId??null,terminalId:t.terminalId??null},B7)}async getSessionTerminalOutput(t){const a=new URL(`/api/sessions/${t.sessionId}/terminals/${t.terminalId}/output`,this.baseUrl);return typeof t.cursor=="number"&&Number.isFinite(t.cursor)&&a.searchParams.set("cursor",String(Math.max(0,Math.floor(t.cursor)))),this.readJson(a,E7)}async getSessionPlan(t){return this.readJson(new URL(`/api/sessions/${t}/plan`,this.baseUrl),{parse:a=>a==null?null:Gb.parse(a)})}async getSessionInteractions(t){return this.readJson(new URL(`/api/sessions/${t}/interactions`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>Wb.parse(r)):[]})}async getProjectSkills(t){return this.readJson(new URL(`/api/projects/${t}/skills`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>Jb.parse(r)):[]})}async getCodexCommands(){return this.readJson(new URL("/api/codex/commands",this.baseUrl),S6)}async refreshCodexCommands(){return this.postJson("/api/codex/commands/refresh",{},S6)}async listDirectories(t){const a=new URL("/api/directories",this.baseUrl);return t.agentId&&a.searchParams.set("agentId",t.agentId),t.path&&a.searchParams.set("path",t.path),this.readJson(a,{parse:r=>Array.isArray(r)?r.map(c=>q7.parse(c)):[]})}async createProject(t){return this.postJson("/api/projects",t)}async createSession(t){var a;return this.postJson("/api/sessions",{...t,attachments:(a=t.attachments)==null?void 0:a.map(r=>x6.parse(r)),serviceTier:t.serviceTier,planMode:t.planMode})}async updateSession(t){return this.postJson(`/api/sessions/${t.sessionId}/actions`,{action:t.action,name:t.name})}async updateThread(t){return this.postJson(`/api/threads/${t.projectId}/actions`,{action:t.action,name:t.name,orderedProjectIds:t.orderedProjectIds})}async sendSessionInput(t){var a;return this.postJson(`/api/sessions/${t.sessionId}/input`,{input:t.input,attachments:(a=t.attachments)==null?void 0:a.map(r=>x6.parse(r)),model:t.model,reasoningEffort:t.reasoningEffort,serviceTier:t.serviceTier,planMode:t.planMode})}async executeSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/execute`,{input:t.input},j6)}async respondToSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/respond`,{panelId:t.panelId,optionId:t.optionId??null,text:t.text??null},j6)}async respondToSessionInteraction(t){return this.postJson(`/api/sessions/${t.sessionId}/interactions/${t.requestId}/respond`,{optionId:t.optionId??null,text:t.text??null,answers:t.answers??null})}async interruptSession(t){return this.postJson(`/api/sessions/${t}/interrupt`,{})}async registerAgent(t){return this.postJson("/api/agents/register",t,w6)}async heartbeatAgent(t){return this.postJson("/api/agents/heartbeat",t,w6)}async executeSessionGitAction(t){return this.postJson(`/api/sessions/${t.sessionId}/git/actions`,{action:t.action,path:t.path,branch:t.branch,message:t.message},_7)}connectEvents(t,a){let u=null,h="",p=!1,y=0,m=null,b=!1;const g=()=>{m!==null&&(globalThis.clearTimeout(m),m=null)},x=(T,C)=>{var I;(I=a==null?void 0:a.onStatus)==null||I.call(a,{state:T,attempt:y,maxAttempts:5,error:C})},w=T=>{if(!p&&!b){if(y+=1,y>5){y=5,x("failed",T);return}b=!0,x("reconnecting",T),g(),m=globalThis.setTimeout(()=>{b=!1,N()},1200)}},N=()=>{g(),b=!1,u=new WebSocket(this.wsBaseUrl),u.addEventListener("open",()=>{var C;b=!1,y=0,x("connected");const T=(C=a==null?void 0:a.sessionId)==null?void 0:C.trim();T&&(h=T,u==null||u.send(JSON.stringify({type:"session.subscribe",sessionId:T})))}),u.addEventListener("message",T=>{const C=F7.safeParse(JSON.parse(T.data));C.success&&t(C.data)}),u.addEventListener("error",()=>{if(p)return;const T=`无法连接到 ${this.wsBaseUrl}`;(u==null?void 0:u.readyState)!==WebSocket.OPEN&&w(T)}),u.addEventListener("close",T=>{var I;if(p)return;const C=((I=T.reason)==null?void 0:I.trim())||`WebSocket 已断开(code ${T.code||"unknown"})`;w(C)})};return N(),()=>{p=!0,b=!1,g(),h&&(u==null?void 0:u.readyState)===WebSocket.OPEN&&u.send(JSON.stringify({type:"session.unsubscribe",sessionId:h})),u==null||u.close()}}}const pp=(n,t)=>new ux(n,(t==null?void 0:t.wsBaseUrl)??U3(n)),q3=n=>{if(typeof window>"u")return`http://localhost:${n}`;const t=window.location.protocol==="https:"?"https:":"http:",a=window.location.hostname||"localhost";return`${t}//${a}:${n}`},$3=q3(4242),nh=q3(4343),H3={direct:pp($3),hub:pp(nh)},dx={direct:"Agent 直连",hub:"Hub 聚合"},fx=1e4,hx=1e4,mx=1e4,px=1e4;let k1=null,C6=0,iu=null,N1=null,T6=0,ru=null;const E6=new Map,C1=new Map,T1=new Map,wi=n=>(n==null?void 0:n.trim())??"",e0=async n=>{const t=n.trim();if(!t)return!1;const a=T1.get(t),r=Date.now();if(a&&r-a.checkedAt<px)return a.reachable;const c=new AbortController,u=globalThis.setTimeout(()=>c.abort(),1200);try{const p=(await fetch(`${t}/health`,{signal:c.signal})).ok;return T1.set(t,{reachable:p,checkedAt:Date.now()}),p}catch{return T1.set(t,{reachable:!1,checkedAt:Date.now()}),!1}finally{clearTimeout(u)}},M6=n=>({mode:n,label:dx[n],baseUrl:n==="hub"?nh:$3,client:H3[n]}),F3=n=>n.direct_base_url.trim(),gx=n=>n.ws_base_url.trim(),R6=n=>{const t=F3(n)||n.tailscale_dns_name||n.tailscale_ip||n.host;return`无法直连节点 ${n.name}(${t})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`},yx=n=>{const t=F3(n),a=gx(n);return{mode:"direct",label:`Agent 直连 · ${n.name}`,baseUrl:t,client:pp(t,{wsBaseUrl:a||void 0})}},vx=(n,t)=>{const a=wi(t.agentId);if(a)return n.agents.find(u=>u.id===a)??null;const r=wi(t.sessionId);if(r){const u=n.sessions.find(h=>h.id===r);return u?n.agents.find(h=>h.id===u.agent_id)??null:null}const c=wi(t.projectId);if(c){const u=n.projects.find(h=>h.id===c);return u?n.agents.find(h=>h.id===u.agent_id)??null:null}return null},_x=n=>{const t=wi(n.sessionId),a=wi(n.projectId),r=wi(n.agentId);return t?`session:${t}`:a?`project:${a}`:r?`agent:${r}`:""},bx=async()=>{const n=Date.now();if(N1&&n-T6<mx)return N1;if(ru)return ru;ru=(async()=>{if(!await e0(nh))return null;const t=await H3.hub.getPhaseOneSnapshot({fallbackToMock:!1});return N1=t,T6=Date.now(),t})().catch(()=>null);try{return await ru}finally{ru=null}},xx=async()=>{const n=Date.now();if(k1&&n-C6<fx)return k1;if(iu)return iu;iu=(async()=>{const t=await e0(nh)?M6("hub"):M6("direct");return k1=t,C6=Date.now(),t})();try{return await iu}finally{iu=null}},Sx=async n=>{const t=_x(n),a=Date.now(),r=t?E6.get(t):null;if(r&&a-r.cachedAt<hx)return r.target;const c=t?C1.get(t):null;if(c)return c;const u=(async()=>{const h=await bx(),p=h?vx(h,n):null;if(!h||!p)throw new Error("Hub 未返回目标节点信息,无法建立直连。");const y=yx(p);if(!y.baseUrl)throw new Error(R6(p));if(await e0(y.baseUrl))return y;throw new Error(R6(p))})();t&&C1.set(t,u);try{const h=await u;return t&&E6.set(t,{target:h,cachedAt:Date.now()}),h}finally{t&&C1.delete(t)}},Jn=async n=>!(wi(n==null?void 0:n.sessionId)||wi(n==null?void 0:n.projectId)||wi(n==null?void 0:n.agentId))?xx():Sx(n??{}),Q3="panda:notification-settings",G3="panda:notified-completions",E1={completionNotificationsEnabled:!1},V3=n=>({completionNotificationsEnabled:(n==null?void 0:n.completionNotificationsEnabled)===!0}),K3=()=>{if(typeof window>"u")return{};try{const n=window.localStorage.getItem(G3);if(!n)return{};const t=JSON.parse(n);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(a=>typeof a[0]=="string"&&typeof a[1]=="string"))}catch{return{}}},jx=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(G3,JSON.stringify(n))}catch{}},gp=()=>{if(typeof window>"u")return E1;try{const n=window.localStorage.getItem(Q3);return n?V3(JSON.parse(n)):E1}catch{return E1}},A6=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Q3,JSON.stringify(V3(n)))}catch{}},t0=()=>typeof window>"u"?!1:window.isSecureContext&&"Notification"in window&&"serviceWorker"in navigator,yp=()=>t0()?Notification.permission:"unsupported",wx=async()=>t0()?Notification.requestPermission():"unsupported",M1=()=>{if(typeof window>"u")return!1;const n=navigator;return window.matchMedia("(display-mode: standalone)").matches||n.standalone===!0},D6=()=>typeof navigator>"u"?!1:/Android/i.test(navigator.userAgent),kx=(n,t)=>K3()[n]===t,O6=(n,t)=>{const a=K3();a[n]!==t&&jx({...a,[n]:t})},Nx=async n=>{if(typeof window>"u"||!t0())return!1;const t={body:n.body,tag:`session-completed:${n.sessionId}:${n.completedAt}`,icon:"/pwa-512.png",badge:"/pwa-192.png",data:{sessionId:n.sessionId,url:n.url,completedAt:n.completedAt}};try{return await(await navigator.serviceWorker.ready).showNotification(n.title,t),!0}catch{try{const a=new Notification(n.title,t);return a.onclick=()=>{window.focus(),window.location.assign(n.url)},!0}catch{return!1}}},Gf="panda:last-agent-id",Vf="panda:last-session-id",Cu="panda:pending-session-id",Tu="panda:pending-project-id",Eu="panda:pending-directory-picker",Cx=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(Gf)}catch{return null}},xr=n=>{if(!(typeof window>"u"))try{if(n){window.localStorage.setItem(Gf,n);return}window.localStorage.removeItem(Gf)}catch{}},Mu=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(Vf)}catch{return null}},fs=n=>{if(!(typeof window>"u"))try{if(n){window.localStorage.setItem(Vf,n);return}window.localStorage.removeItem(Vf)}catch{}},Ru=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Cu,n);return}window.sessionStorage.removeItem(Cu)}catch{}},Tx=()=>{if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(Cu);return n&&window.sessionStorage.removeItem(Cu),n}catch{return null}},Eo=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Tu,n);return}window.sessionStorage.removeItem(Tu)}catch{}},Ex=()=>{if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(Tu);return n&&window.sessionStorage.removeItem(Tu),n}catch{return null}},lu=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Eu,"1");return}window.sessionStorage.removeItem(Eu)}catch{}},Mx=()=>{if(typeof window>"u")return!1;try{const n=window.sessionStorage.getItem(Eu);return n&&window.sessionStorage.removeItem(Eu),n==="1"}catch{return!1}},Rx=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Gf),window.localStorage.removeItem(Vf),window.sessionStorage.removeItem(Cu),window.sessionStorage.removeItem(Tu),window.sessionStorage.removeItem(Eu)}catch{}},Ax=n=>typeof document>"u"?!1:document.visibilityState==="visible"&&Mu()===n,Dx=n=>{if(!n)return null;const t=typeof n.sessionId=="string"?n.sessionId:null,a=n.sessionPatch&&typeof n.sessionPatch=="object"?n.sessionPatch:null;if(!t||!a)return null;const r=typeof a.run_state=="string"?a.run_state:null,c=typeof a.run_state_changed_at=="string"?a.run_state_changed_at:null;return r!=="completed"||!c?null:{sessionId:t,completedAt:c}},Ox=({snapshot:n})=>{const t=_.useRef(n);return _.useEffect(()=>{t.current=n},[n]),_.useEffect(()=>{let a=!1,r;return Jn().then(c=>{a||(r=c.client.connectEvents(u=>{var w,N;if(u.type!=="session.updated")return;const h=Dx(u.payload);if(!h||!gp().completionNotificationsEnabled||yp()!=="granted"||kx(h.sessionId,h.completedAt))return;if(Ax(h.sessionId)){O6(h.sessionId,h.completedAt);return}const y=((w=t.current)==null?void 0:w.sessions.find(T=>T.id===h.sessionId))??null,b=`${((N=y==null?void 0:y.title)==null?void 0:N.trim())||"当前会话"} 已完成`,g="最终回复已经生成,点开即可继续查看。",x=`/session/${h.sessionId}`;Nx({sessionId:h.sessionId,completedAt:h.completedAt,title:b,body:g,url:x}).then(T=>{T&&O6(h.sessionId,h.completedAt)})}))}),()=>{a=!0,r==null||r()}},[]),null},Lx=JSON.parse('[{"id":"absolutely","light":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2d2d2b","opaqueWindows":true,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#f9f9f7"},"variant":"light"},"dark":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f9f9f7","opaqueWindows":false,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#2d2d2b"},"variant":"dark"}},{"id":"ayu","dark":{"codeThemeId":"ayu","theme":{"accent":"#e6b450","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#bfbdb6","opaqueWindows":false,"semanticColors":{"diffAdded":"#7fd962","diffRemoved":"#ea6c73","skill":"#cda1fa"},"surface":"#0b0e14"},"variant":"dark"}},{"id":"catppuccin","light":{"codeThemeId":"catppuccin","theme":{"accent":"#8839ef","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#4c4f69","opaqueWindows":true,"semanticColors":{"diffAdded":"#40a02b","diffRemoved":"#d20f39","skill":"#8839ef"},"surface":"#eff1f5"},"variant":"light"},"dark":{"codeThemeId":"catppuccin","theme":{"accent":"#cba6f7","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#cdd6f4","opaqueWindows":false,"semanticColors":{"diffAdded":"#a6e3a1","diffRemoved":"#f38ba8","skill":"#cba6f7"},"surface":"#1e1e2e"},"variant":"dark"}},{"id":"codex","light":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#0d0d0d","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#751ed9"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#fcfcfc","opaqueWindows":false,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#b06dff"},"surface":"#111111"},"variant":"dark"}},{"id":"dracula","dark":{"codeThemeId":"dracula","theme":{"accent":"#ff79c6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f8f8f2","opaqueWindows":false,"semanticColors":{"diffAdded":"#50fa7b","diffRemoved":"#ff5555","skill":"#ff79c6"},"surface":"#282a36"},"variant":"dark"}},{"id":"everforest","light":{"codeThemeId":"everforest","theme":{"accent":"#93b259","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#5c6a72","opaqueWindows":true,"semanticColors":{"diffAdded":"#8da101","diffRemoved":"#f85552","skill":"#df69ba"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"everforest","theme":{"accent":"#a7c080","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d3c6aa","opaqueWindows":false,"semanticColors":{"diffAdded":"#a7c080","diffRemoved":"#e67e80","skill":"#d699b6"},"surface":"#2d353b"},"variant":"dark"}},{"id":"github","light":{"codeThemeId":"github","theme":{"accent":"#0969da","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#1f2328","opaqueWindows":true,"semanticColors":{"diffAdded":"#1a7f37","diffRemoved":"#cf222e","skill":"#8250df"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"github","theme":{"accent":"#1f6feb","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6edf3","opaqueWindows":false,"semanticColors":{"diffAdded":"#3fb950","diffRemoved":"#f85149","skill":"#bc8cff"},"surface":"#0d1117"},"variant":"dark"}},{"id":"gruvbox","light":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#3c3836","opaqueWindows":true,"semanticColors":{"diffAdded":"#3c3836","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#fbf1c7"},"variant":"light"},"dark":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#ebdbb2","opaqueWindows":false,"semanticColors":{"diffAdded":"#ebdbb2","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#282828"},"variant":"dark"}},{"id":"linear","light":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":45,"fonts":{"code":null,"ui":"Inter"},"ink":"#2a3140","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#ba2623","skill":"#8160d8"},"surface":"#f7f8fa"},"variant":"light"},"dark":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":60,"fonts":{"code":null,"ui":"Inter"},"ink":"#e6e9ef","opaqueWindows":true,"semanticColors":{"diffAdded":"#7ad9c0","diffRemoved":"#fa423e","skill":"#c2a1ff"},"surface":"#17181d"},"variant":"dark"}},{"id":"lobster","dark":{"codeThemeId":"lobster","theme":{"accent":"#ff5c5c","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#e4e4e7","opaqueWindows":true,"semanticColors":{"diffAdded":"#22c55e","diffRemoved":"#ff5c5c","skill":"#3b82f6"},"surface":"#111827"},"variant":"dark"}},{"id":"material","dark":{"codeThemeId":"material","theme":{"accent":"#80cbc4","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#eeffff","opaqueWindows":true,"semanticColors":{"diffAdded":"#c3e88d","diffRemoved":"#f07178","skill":"#c792ea"},"surface":"#212121"},"variant":"dark"}},{"id":"matrix","dark":{"codeThemeId":"matrix","theme":{"accent":"#1eff5a","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#b8ffca","opaqueWindows":true,"semanticColors":{"diffAdded":"#1eff5a","diffRemoved":"#fa423e","skill":"#1eff5a"},"surface":"#040805"},"variant":"dark"}},{"id":"monokai","dark":{"codeThemeId":"monokai","theme":{"accent":"#99947c","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#f8f8f2","opaqueWindows":true,"semanticColors":{"diffAdded":"#86b42b","diffRemoved":"#c4265e","skill":"#8c6bc8"},"surface":"#272822"},"variant":"dark"}},{"id":"night-owl","dark":{"codeThemeId":"night-owl","theme":{"accent":"#44596b","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d6deeb","opaqueWindows":true,"semanticColors":{"diffAdded":"#c5e478","diffRemoved":"#ef5350","skill":"#c792ea"},"surface":"#011627"},"variant":"dark"}},{"id":"nord","dark":{"codeThemeId":"nord","theme":{"accent":"#88c0d0","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d8dee9","opaqueWindows":true,"semanticColors":{"diffAdded":"#a3be8c","diffRemoved":"#bf616a","skill":"#b48ead"},"surface":"#2e3440"},"variant":"dark"}},{"id":"notion","light":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#37352f","opaqueWindows":true,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#a31515","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d9d9d8","opaqueWindows":true,"semanticColors":{"diffAdded":"#4ec9b0","diffRemoved":"#fa423e","skill":"#3183d8"},"surface":"#191919"},"variant":"dark"}},{"id":"one","light":{"codeThemeId":"one","theme":{"accent":"#526fff","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#383a42","opaqueWindows":true,"semanticColors":{"diffAdded":"#3bba54","diffRemoved":"#e45649","skill":"#526fff"},"surface":"#fafafa"},"variant":"light"},"dark":{"codeThemeId":"one","theme":{"accent":"#4d78cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#abb2bf","opaqueWindows":true,"semanticColors":{"diffAdded":"#8cc265","diffRemoved":"#e05561","skill":"#c162de"},"surface":"#282c34"},"variant":"dark"}},{"id":"oscurange","dark":{"codeThemeId":"oscurange","theme":{"accent":"#f9b98c","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6e6e6","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#479ffa"},"surface":"#0b0b0f"},"variant":"dark"}},{"id":"proof","light":{"codeThemeId":"proof","theme":{"accent":"#3d755d","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2f312d","opaqueWindows":false,"semanticColors":{"diffAdded":"#3d755d","diffRemoved":"#ba2623","skill":"#5f6ac2"},"surface":"#f5f3ed"},"variant":"light"}},{"id":"rose-pine","light":{"codeThemeId":"rose-pine","theme":{"accent":"#d7827e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#575279","opaqueWindows":false,"semanticColors":{"diffAdded":"#56949f","diffRemoved":"#797593","skill":"#907aa9"},"surface":"#faf4ed"},"variant":"light"},"dark":{"codeThemeId":"rose-pine","theme":{"accent":"#ea9a97","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e0def4","opaqueWindows":true,"semanticColors":{"diffAdded":"#9ccfd8","diffRemoved":"#908caa","skill":"#c4a7e7"},"surface":"#232136"},"variant":"dark"}},{"id":"sentry","dark":{"codeThemeId":"sentry","theme":{"accent":"#7055f6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6dff9","opaqueWindows":true,"semanticColors":{"diffAdded":"#8ee6d7","diffRemoved":"#fa423e","skill":"#7055f6"},"surface":"#2d2935"},"variant":"dark"}},{"id":"solarized","light":{"codeThemeId":"solarized","theme":{"accent":"#b58900","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#657b83","opaqueWindows":false,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"solarized","theme":{"accent":"#d30102","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#839496","opaqueWindows":true,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#002b36"},"variant":"dark"}},{"id":"temple","dark":{"codeThemeId":"temple","theme":{"accent":"#e4f222","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#c7e6da","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#e4f222"},"surface":"#02120c"},"variant":"dark"}},{"id":"tokyo-night","dark":{"codeThemeId":"tokyo-night","theme":{"accent":"#3d59a1","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#a9b1d6","opaqueWindows":true,"semanticColors":{"diffAdded":"#449dab","diffRemoved":"#914c54","skill":"#9d7cd8"},"surface":"#1a1b26"},"variant":"dark"}},{"id":"vscode-plus","light":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#000000","opaqueWindows":false,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#ee0000","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d4d4d4","opaqueWindows":true,"semanticColors":{"diffAdded":"#369432","diffRemoved":"#f44747","skill":"#000080"},"surface":"#1e1e1e"},"variant":"dark"}}]'),Ix={themes:Lx},Y3="panda:theme-settings",zx=13,Bx=12,Z3="codex",n0="codex",Px='-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif',Ux='ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, monospace',qx=/\b(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|emoji|math|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)\b/i,L6=(n,t)=>{const a=n==null?void 0:n.trim();return a?qx.test(a)?a:`${a}, ${t}`:t},$x={absolutely:"Absolutely",ayu:"Ayu",catppuccin:"Catppuccin",codex:"Codex",dracula:"Dracula",everforest:"Everforest",github:"GitHub",gruvbox:"Gruvbox",linear:"Linear",lobster:"Lobster",material:"Material",matrix:"Matrix",monokai:"Monokai","night-owl":"Night Owl",nord:"Nord",notion:"Notion",one:"One",oscurange:"Oscurange",proof:"Proof","rose-pine":"Rose Pine",sentry:"Sentry",solarized:"Solarized",temple:"Temple","tokyo-night":"Tokyo Night","vscode-plus":"VSCode Plus"},Wo=(n,t,a)=>Math.min(a,Math.max(t,n)),rl=(n,t)=>{const r=n.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!r)return t;const[,c]=r;return`#${(c.length===3?c.split("").map(h=>`${h}${h}`).join(""):c).toUpperCase()}`},pi=n=>{const t=rl(n,"#000000").slice(1);return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}},Hx=(n,t,a)=>`#${[n,t,a].map(r=>Wo(Math.round(r),0,255).toString(16).padStart(2,"0")).join("").toUpperCase()}`,rt=(n,t,a)=>{const r=pi(n),c=pi(t),u=Wo(a,0,1);return Hx(r.r+(c.r-r.r)*u,r.g+(c.g-r.g)*u,r.b+(c.b-r.b)*u)},Fx=n=>{const{r:t,g:a,b:r}=pi(n),c=u=>{const h=u/255;return h<=.03928?h/12.92:((h+.055)/1.055)**2.4};return c(t)*.2126+c(a)*.7152+c(r)*.0722},Qx=n=>Fx(n)>.5?"#0D1117":"#FFFFFF",fi=(n,t)=>{const a=Math.round(Wo(t,0,1)*100);return a>=100?n:`color-mix(in srgb, ${n} ${a}%, transparent)`},W3=Ix.themes,X3=(n,t)=>{var r,c;const a=t==="light"?n.light:n.dark;return a?{id:n.id,label:$x[n.id]??n.id,codeThemeId:a.codeThemeId,variant:t,accent:rl(a.theme.accent,"#0169CC"),background:rl(a.theme.surface,"#FFFFFF"),foreground:rl(a.theme.ink,"#0D0D0D"),contrast:Wo(Number(a.theme.contrast),0,100),opaqueWindows:!!a.theme.opaqueWindows,semanticColors:{diffAdded:rl(a.theme.semanticColors.diffAdded,"#00A240"),diffRemoved:rl(a.theme.semanticColors.diffRemoved,"#E02E2A"),skill:rl(a.theme.semanticColors.skill,"#751ED9")},fonts:{ui:((r=a.theme.fonts.ui)==null?void 0:r.trim())||null,code:((c=a.theme.fonts.code)==null?void 0:c.trim())||null}}:null},vp=W3.map(n=>X3(n,"light")).filter(n=>!!n),Au=W3.map(n=>X3(n,"dark")).filter(n=>!!n);Au.find(n=>n.id===n0)??Au[0];const wl={mode:"system",lightThemeId:Z3,darkThemeId:n0,uiFontSize:zx,codeFontSize:Bx},J3=n=>Wo(Number(n),11,18),ey=n=>Wo(Number(n),10,18),s0=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",sh=n=>vp.find(t=>t.id===n)??vp[0],ah=n=>Au.find(t=>t.id===n)??Au[0],I6=(n,t=wl,a="light")=>a==="dark"?{...t,darkThemeId:ah(n).id}:{...t,lightThemeId:sh(n).id},cr=n=>({mode:(n==null?void 0:n.mode)==="light"||(n==null?void 0:n.mode)==="dark"||(n==null?void 0:n.mode)==="system"?n.mode:wl.mode,lightThemeId:sh((n==null?void 0:n.lightThemeId)??Z3).id,darkThemeId:ah((n==null?void 0:n.darkThemeId)??n0).id,uiFontSize:J3((n==null?void 0:n.uiFontSize)??wl.uiFontSize),codeFontSize:ey((n==null?void 0:n.codeFontSize)??wl.codeFontSize)}),ty=()=>{if(typeof window>"u")return wl;try{const n=window.localStorage.getItem(Y3);return n?cr(JSON.parse(n)):wl}catch{return wl}},ou=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Y3,JSON.stringify(cr(n)))}catch{}},Gx=(n,t)=>n==="system"?t:n,mi=(n,t=s0())=>{const a=cr(n),r=Gx(a.mode,t),c=sh(a.lightThemeId),u=ah(a.darkThemeId),h=r==="dark"?u:c;return{...a,appearance:r,lightTheme:c,darkTheme:u,activeTheme:h,uiFontFamily:L6(h.fonts.ui,Px),codeFontFamily:L6(h.fonts.code,Ux)}},Vx=n=>{if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{n(t.matches?"dark":"light")};return a(),t.addEventListener("change",a),()=>{t.removeEventListener("change",a)}},Kx=(n,t)=>{const a=mi(n,t),r=a.activeTheme,c=t==="dark",u=(r.contrast-(c?60:45))/100,h=r.semanticColors.diffAdded,p=r.semanticColors.diffRemoved,y=r.semanticColors.skill,m=pi(h),b=pi(p),g=pi(y),x=pi(r.accent),w=pi(r.background),N=pi(r.foreground),T=r.background,C=c?rt(r.background,"#FFFFFF",.05+u*.08):rt(r.background,"#FFFFFF",.42+u*.16),I=c?rt(r.background,"#FFFFFF",.07+u*.08):rt(r.background,"#FFFFFF",.78+u*.1),$=c?rt(r.background,"#FFFFFF",.1+u*.08):rt(r.background,"#FFFFFF",.56+u*.14),H=c?rt(r.background,"#FFFFFF",.14+u*.08):rt(r.background,r.foreground,.1+u*.12),R=c?rt(r.background,"#000000",.08-u*.06):rt(r.background,r.foreground,.03+u*.08),Q=c?rt(r.background,"#FFFFFF",.08+u*.06):rt(r.background,r.foreground,.06+u*.08),ce=c?rt(r.background,"#FFFFFF",.14+u*.08):rt(r.background,r.foreground,.14+u*.1),Z=c?rt(r.background,"#FFFFFF",.22+u*.08):rt(r.background,r.foreground,.22+u*.1),ie=c?rt(r.background,"#FFFFFF",.08+u*.04):rt(r.background,r.foreground,.1+u*.08),ee=r.foreground,Y=c?rt(r.foreground,r.background,.28-u*.1):rt(r.foreground,r.background,.5-u*.14),F=c?rt(r.foreground,r.background,.46-u*.1):rt(r.foreground,r.background,.64-u*.14),_e=rt(r.foreground,r.background,c?.58:.74),je=r.accent,ae=c?rt(r.accent,"#FFFFFF",.18):rt(r.accent,"#FFFFFF",.24),ue=c?rt(r.accent,r.background,.78):rt(r.accent,r.background,.88),E=c?rt(r.accent,r.background,.84):rt(r.accent,r.background,.92),U=Qx(je),te=c?rt(r.background,"#FFFFFF",.1):rt(r.background,r.foreground,.08),W=c?rt(r.background,"#000000",.06):rt(r.background,r.foreground,.035),xe=c?rt(r.background,"#FFFFFF",.05):rt(r.background,r.foreground,.06),A=c?rt(r.background,"#FFFFFF",.03):rt(r.background,r.foreground,.085),ne=c?rt(r.background,"#FFFFFF",.065):rt(r.background,r.foreground,.05),be=rt(r.foreground,r.background,c?.42:.68),V=c?rt(r.background,"#FFFFFF",.08):rt(r.foreground,r.background,.18),pe=c?rt(r.background,"#FFFFFF",.08):rt(r.background,r.foreground,.06),Ce=c?rt(r.background,"#FFFFFF",.12):rt(r.background,r.foreground,.1),Le=c?rt(r.background,"#FFFFFF",.14+u*.05):rt(r.background,r.foreground,.12+u*.08),he=r.opaqueWindows?1:c?.92:.95,q=r.opaqueWindows?1:c?.94:.965,Se=r.opaqueWindows?1:.94;return{"--theme-id":r.id,"--theme-code-theme-id":r.codeThemeId,"--theme-window-opaque":r.opaqueWindows?"1":"0","--theme-accent":je,"--theme-accent-rgb":`${x.r} ${x.g} ${x.b}`,"--theme-background":r.background,"--theme-background-rgb":`${w.r} ${w.g} ${w.b}`,"--theme-foreground":r.foreground,"--theme-foreground-rgb":`${N.r} ${N.g} ${N.b}`,"--theme-shadow-rgb":c?"0 0 0":"39 28 17","--theme-ui-font":a.uiFontFamily,"--theme-code-font":a.codeFontFamily,"--theme-ui-font-size":`${a.uiFontSize}px`,"--theme-code-font-size":`${a.codeFontSize}px`,"--color-surface-base":T,"--color-surface-elevated":C,"--color-surface-panel":I,"--color-surface-raised":$,"--color-surface-panel-strong":H,"--color-surface-sidebar":fi(R,q),"--color-surface-sidebar-elevated":fi(Q,q),"--color-surface-border":ce,"--color-surface-border-strong":Z,"--color-surface-border-soft":ie,"--color-surface-overlay":fi(H,he),"--color-surface-floating":fi(I,he),"--color-surface-tooltip":fi(V,Se),"--color-surface-code":W,"--color-surface-code-muted":xe,"--color-surface-code-gutter":A,"--color-surface-code-meta":ne,"--color-surface-inline-code":te,"--color-surface-hover":pe,"--color-surface-pressed":Ce,"--color-surface-danger-soft":fi(p,c?.14:.08),"--color-surface-success-soft":fi(h,c?.14:.08),"--color-text-primary":ee,"--color-text-secondary":Y,"--color-text-muted":F,"--color-text-tertiary":_e,"--color-text-on-accent":U,"--color-text-link":je,"--color-text-link-hover":ae,"--color-text-danger":p,"--color-text-success":h,"--color-accent-primary":je,"--color-accent-primary-soft":ue,"--color-accent-secondary":ae,"--color-accent-secondary-soft":E,"--color-accent-contrast":U,"--color-accent-primary-rgb":`${x.r} ${x.g} ${x.b}`,"--color-success":h,"--color-warning":rt(r.accent,h,.35),"--color-danger":p,"--color-status-online":je,"--color-status-offline":c?"#76808A":"#A5ACA4","--color-skill":y,"--color-skill-rgb":`${g.r} ${g.g} ${g.b}`,"--color-code-keyword":y,"--color-code-title":je,"--color-code-string":rt(h,r.foreground,c?.26:.18),"--color-code-number":rt(y,je,.36),"--color-code-comment":rt(r.foreground,r.background,c?.52:.72),"--color-code-meta-text":be,"--color-code-add":h,"--color-code-add-rgb":`${m.r} ${m.g} ${m.b}`,"--color-code-add-bg":fi(h,c?.16:.11),"--color-code-remove":p,"--color-code-remove-rgb":`${b.r} ${b.g} ${b.b}`,"--color-code-remove-bg":fi(p,c?.18:.11),"--color-divider":Le,"--color-overlay-scrim":r.opaqueWindows?c?"rgba(8, 10, 12, 0.66)":"rgba(23, 20, 17, 0.14)":c?"rgba(8, 10, 12, 0.54)":"rgba(23, 20, 17, 0.09)","--shadow-soft":c?"0 24px 54px rgba(0, 0, 0, 0.34)":"0 24px 54px rgba(24, 18, 12, 0.08)","--shadow-panel":c?"0 10px 26px rgba(0, 0, 0, 0.24)":"0 10px 26px rgba(37, 23, 10, 0.06)","--shadow-sm":c?"0 2px 12px rgba(0, 0, 0, 0.18)":"0 2px 12px rgba(37, 23, 10, 0.05)","--shadow-overlay":c?"0 20px 44px rgba(0, 0, 0, 0.36)":"0 18px 40px rgba(42, 26, 12, 0.1)","--font-display":a.uiFontFamily,"--font-sans":a.uiFontFamily,"--font-mono":a.codeFontFamily,"--font-size-ui-base":`${a.uiFontSize}px`,"--font-size-code-base":`${a.codeFontSize}px`}},ny=(n,t=s0())=>{if(typeof document>"u")return;const a=mi(n,t),r=Kx(a,a.appearance),c=document.documentElement;c.dataset.theme=a.appearance,c.dataset.uiTheme=a.appearance,c.dataset.themeId=a.activeTheme.id,c.dataset.codeThemeId=a.activeTheme.codeThemeId,c.dataset.windowStyle=a.activeTheme.opaqueWindows?"opaque":"soft",c.style.colorScheme=a.appearance;for(const[u,h]of Object.entries(r))c.style.setProperty(u,h)},Yx=["bootstrap","hub"],dt=["bootstrap","workspace"];function qu(n){return Es({queryKey:(n==null?void 0:n.queryKey)??Yx,queryFn:async()=>(await Jn(n==null?void 0:n.scope)).client.getPhaseOneSnapshot({fallbackToMock:!1}),refetchInterval:3e5,refetchOnWindowFocus:!1,retry:1})}const z6=n=>{let t;const a=new Set,r=(m,b)=>{const g=typeof m=="function"?m(t):m;if(!Object.is(g,t)){const x=t;t=b??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(w=>w(t,x))}},c=()=>t,p={setState:r,getState:c,getInitialState:()=>y,subscribe:m=>(a.add(m),()=>a.delete(m))},y=t=n(r,c,p);return p},Zx=(n=>n?z6(n):z6),Wx=n=>n;function Xx(n,t=Wx){const a=Si.useSyncExternalStore(n.subscribe,Si.useCallback(()=>t(n.getState()),[n,t]),Si.useCallback(()=>t(n.getInitialState()),[n,t]));return Si.useDebugValue(a),a}const B6=n=>{const t=Zx(n),a=r=>Xx(t,r);return Object.assign(a,t),a},Jx=(n=>n?B6(n):B6),P6=ty(),U6=s0(),va=Jx(n=>({panelTab:"git",composerText:"",activeSessionId:null,bottomNavVisible:!0,themeSettings:P6,systemAppearance:U6,resolvedTheme:mi(P6,U6),setPanelTab:t=>n({panelTab:t}),setComposerText:t=>n({composerText:t}),setActiveSessionId:t=>n({activeSessionId:t}),setBottomNavVisible:t=>n({bottomNavVisible:t}),setThemeMode:t=>n(a=>{const r=cr({...a.themeSettings,mode:t});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setLightThemeId:t=>n(a=>{const r=cr(I6(sh(t).id,a.themeSettings,"light"));return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setDarkThemeId:t=>n(a=>{const r=cr({...I6(ah(t).id,a.themeSettings,"dark")});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setUiFontSize:t=>n(a=>{const r=cr({...a.themeSettings,uiFontSize:t});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setCodeFontSize:t=>n(a=>{const r=cr({...a.themeSettings,codeFontSize:t});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setSystemAppearance:t=>n(a=>({systemAppearance:t,resolvedTheme:mi(a.themeSettings,t)}))})),eS=()=>{const{data:n}=qu(),t=va(c=>c.themeSettings),a=va(c=>c.systemAppearance),r=va(c=>c.setSystemAppearance);return _.useEffect(()=>{ny(t,a)},[a,t]),_.useEffect(()=>Vx(r),[r]),l.jsxs("div",{className:"app-shell",children:[l.jsx(Ox,{snapshot:n}),l.jsx("div",{className:"app-shell__content",children:l.jsx(j3,{})})]})},tS=n=>n.tailscale_dns_name||n.tailscale_ip||n.host||n.direct_base_url,nS=({message:n})=>l.jsx("p",{className:"empty-copy",children:n}),sS=()=>{const n=Mr(),{data:t}=qu(),a=(t==null?void 0:t.agents)??[];return l.jsxs("div",{className:"nodes-screen",children:[l.jsxs("div",{className:"nodes-screen__header",children:[l.jsx("h1",{children:"节点列表"}),l.jsx("p",{children:"查看所有在线节点和局域网地址"})]}),l.jsx("div",{className:"nodes-screen__content node-list",children:a.length===0?l.jsx(nS,{message:"暂无节点"}):a.map(r=>{const c=Mu(),u=(t==null?void 0:t.sessions.find(h=>h.id===c&&h.agent_id===r.id))??null;return l.jsxs("button",{type:"button",className:"node-card",onClick:()=>{xr(r.id),fs((u==null?void 0:u.id)??null),Ru((u==null?void 0:u.id)??null),n({to:"/"})},children:[l.jsxs("div",{className:"node-card__header",children:[l.jsx("strong",{children:r.name}),l.jsx("span",{className:`node-status-dot ${r.status}`})]}),l.jsx("div",{className:"node-card__ip",children:tS(r)})]},r.id)})})]})},$u=n=>[...n].sort((t,a)=>{const r=Number(a.pinned)-Number(t.pinned);return r!==0?r:+new Date(a.last_event_at)-+new Date(t.last_event_at)}),a0=(n,t)=>!!(n!=null&&n.sessions.some(a=>a.id===t)),Kf=(n,t,a)=>!n||!a0(n,t)?n:{...n,sessions:$u(n.sessions.map(r=>r.id===t?{...r,...a}:r))},_p=(n,t,a)=>{if(!n)return n;const r=n.sessions.find(h=>h.id===t);if(!r)return n;const c=new Date(a).getTime(),u=new Date(r.last_event_at).getTime();return!Number.isFinite(c)||Number.isFinite(u)&&c<=u?n:Kf(n,t,{last_event_at:a})},Nf=(n,t,a)=>{if(!n)return n;const{last_event_at:r,...c}=a;let u=Kf(n,t,c);return typeof r=="string"&&r.trim()&&(u=_p(u,t,r)),u},sy=(n,t,a)=>{if(!n||t.length===0)return n;const r=new Set(t);return{...n,sessions:$u(n.sessions.map(c=>r.has(c.id)?{...c,...a}:c))}},ay=(n,t)=>{var u;if(!n||t.length===0)return n;const a=new Set(t),r=n.sessions.filter(h=>!a.has(h.id)),c=a.has(n.active_session_id)?((u=r[0])==null?void 0:u.id)??"":n.active_session_id;return{...n,active_session_id:c,sessions:$u(r)}},Yf=(n,t,a)=>!n||!n.projects.some(r=>r.id===t)?n:{...n,projects:n.projects.map(r=>r.id===t?{...r,...a}:r)},iy=(n,t)=>{if(!n||t.length===0||n.projects.length<=1)return n;const a=new Map(n.projects.map(u=>[u.id,u])),r=new Set,c=[];for(const u of t){const h=a.get(u);!h||r.has(u)||(r.add(u),c.push(h))}for(const u of n.projects)r.has(u.id)||c.push(u);return c.every((u,h)=>{var p;return u.id===((p=n.projects[h])==null?void 0:p.id)})?n:{...n,projects:c}},ry=(n,t)=>{var c;if(!n)return n;const a=n.sessions.filter(u=>u.project_id!==t),r=a.some(u=>u.id===n.active_session_id)?n.active_session_id:((c=a[0])==null?void 0:c.id)??"";return{...n,active_session_id:r,projects:n.projects.filter(u=>u.id!==t),sessions:$u(a)}},q6=(n,t)=>n&&{...n,generated_at:new Date().toISOString(),projects:[t,...n.projects.filter(a=>a.id!==t.id)]},aS=(n,t)=>{if(!n)return n;const a=[t,...n.sessions.filter(r=>r.id!==t.id)];return{...n,generated_at:new Date().toISOString(),active_session_id:t.id,sessions:$u(a)}};/**
66
+ */var t6;function I9(){if(t6)return b1;t6=1;var n=Pu(),t=L9();function a(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}var r=typeof Object.is=="function"?Object.is:a,c=t.useSyncExternalStore,u=n.useRef,h=n.useEffect,p=n.useMemo,y=n.useDebugValue;return b1.useSyncExternalStoreWithSelector=function(m,b,g,x,w){var N=u(null);if(N.current===null){var T={hasValue:!1,value:null};N.current=T}else T=N.current;N=p(function(){function I(ce){if(!$){if($=!0,H=ce,ce=x(ce),w!==void 0&&T.hasValue){var Z=T.value;if(w(Z,ce))return R=Z}return R=ce}if(Z=R,r(H,ce))return Z;var ie=x(ce);return w!==void 0&&w(Z,ie)?(H=ce,Z):(H=ce,R=ie)}var $=!1,H,R,Q=g===void 0?null:g;return[function(){return I(b())},Q===null?void 0:function(){return I(Q())}]},[b,g,x,w]);var C=c(m,N[0],N[1]);return h(function(){T.hasValue=!0,T.value=C},[C]),y(C),C},b1}var n6;function z9(){return n6||(n6=1,_1.exports=I9()),_1.exports}var B9=z9();function P9(n,t){return n===t}function U9(n,t,a=P9){const r=_.useCallback(h=>{if(!n)return()=>{};const{unsubscribe:p}=n.subscribe(h);return p},[n]),c=_.useCallback(()=>n==null?void 0:n.get(),[n]);return B9.useSyncExternalStoreWithSelector(r,c,c,t,a)}function aa(n){const t=ia({warn:(n==null?void 0:n.router)===void 0}),a=(n==null?void 0:n.router)||t,r=_.useRef(void 0);return U9(a.__store,c=>{if(n!=null&&n.select){if(n.structuralSharing??a.options.defaultStructuralSharing){const u=ol(r.current,n.select(c));return r.current=u,u}return n.select(c)}return c})}var th=_.createContext(void 0),q9=_.createContext(void 0);function Er(n){const t=_.useContext(n.from?q9:th);return aa({select:a=>{const r=a.matches.find(c=>n.from?n.from===c.routeId:c.id===t);if(Cr(!((n.shouldThrow??!0)&&!r),`Could not find ${n.from?`an active match from "${n.from}"`:"a nearest match!"}`),r!==void 0)return n.select?n.select(r):r},structuralSharing:n.structuralSharing})}function Qp(n){return Er({from:n.from,strict:n.strict,structuralSharing:n.structuralSharing,select:t=>n.select?n.select(t.loaderData):t.loaderData})}function Gp(n){const{select:t,...a}=n;return Er({...a,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Uu(n){return Er({from:n.from,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,strict:n.strict,select:t=>{const a=n.strict===!1?t.params:t._strictParams;return n.select?n.select(a):a}})}function Vp(n){return Er({from:n.from,strict:n.strict,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,select:t=>n.select?n.select(t.search):t.search})}function Mr(n){const t=ia();return _.useCallback(a=>t.navigate({...a,from:a.from??(n==null?void 0:n.from)}),[n==null?void 0:n.from,t])}function Kp(n){return Er({...n,select:t=>n.select?n.select(t.context):t.context})}var or=Q2();function $9(n,t){const a=ia(),r=f_(t),{activeProps:c,inactiveProps:u,activeOptions:h,to:p,preload:y,preloadDelay:m,hashScrollIntoView:b,replace:g,startTransition:x,resetScroll:w,viewTransition:N,children:T,target:C,disabled:I,style:$,className:H,onClick:R,onBlur:Q,onFocus:ce,onMouseEnter:Z,onMouseLeave:ie,onTouchStart:ee,ignoreBlocker:Y,params:F,search:_e,hash:je,state:ae,mask:ue,reloadDocument:E,unsafeRelative:U,from:te,_fromLocation:W,...xe}=n,A=_3(),ne=aa({select:Oe=>{const Ke=Oe.matches[Oe.matches.length-1];return{search:Ke==null?void 0:Ke.search,hash:Oe.location.hash,path:Ke==null?void 0:Ke.pathname}},structuralSharing:!0}),be=n.from,V=_.useMemo(()=>({...n,from:be}),[a,ne,be,n._fromLocation,n.hash,n.to,n.search,n.params,n.state,n.mask,n.unsafeRelative]),pe=_.useMemo(()=>a.buildLocation({...V}),[a,V]),Ce=pe.maskedLocation?pe.maskedLocation.publicHref:pe.publicHref,Le=pe.maskedLocation?pe.maskedLocation.external:pe.external,he=_.useMemo(()=>K9(Ce,Le,a.history,I),[I,Le,Ce,a.history]),q=_.useMemo(()=>{if(he!=null&&he.external)return Af(he.href,a.protocolAllowlist)?void 0:he.href;if(!Y9(p)&&!(typeof p!="string"||p.indexOf(":")===-1))try{return new URL(p),Af(p,a.protocolAllowlist)?void 0:p}catch{}},[p,he,a.protocolAllowlist]),Se=aa({select:Oe=>{if(q)return!1;if(h!=null&&h.exact){if(!R_(Oe.location.pathname,pe.pathname,a.basepath))return!1}else{const Ke=Of(Oe.location.pathname,a.basepath),mt=Of(pe.pathname,a.basepath);if(!(Ke.startsWith(mt)&&(Ke.length===mt.length||Ke[mt.length]==="/")))return!1}return((h==null?void 0:h.includeSearch)??!0)&&!bl(Oe.location.search,pe.search,{partial:!(h!=null&&h.exact),ignoreUndefined:!(h!=null&&h.explicitUndefined)})?!1:h!=null&&h.includeHash?A&&Oe.location.hash===pe.hash:!0}}),Ne=Se?_r(c,{})??H9:j1,me=Se?j1:_r(u,{})??j1,Te=[H,Ne.className,me.className].filter(Boolean).join(" "),Ge=($||Ne.style||me.style)&&{...$,...Ne.style,...me.style},[Ue,gt]=_.useState(!1),Lt=_.useRef(!1),St=n.reloadDocument||q?!1:y??a.options.defaultPreload,st=m??a.options.defaultPreloadDelay??0,tn=_.useCallback(()=>{a.preloadRoute({...V,_builtLocation:pe}).catch(Oe=>{console.warn(Oe),console.warn(E9)})},[a,V,pe]);d_(r,_.useCallback(Oe=>{Oe!=null&&Oe.isIntersecting&&tn()},[tn]),V9,{disabled:!!I||St!=="viewport"}),_.useEffect(()=>{Lt.current||!I&&St==="render"&&(tn(),Lt.current=!0)},[I,tn,St]);const $t=Oe=>{const Ke=Oe.currentTarget.getAttribute("target"),mt=C!==void 0?C:Ke;if(!I&&!Z9(Oe)&&!Oe.defaultPrevented&&(!mt||mt==="_self")&&Oe.button===0){Oe.preventDefault(),or.flushSync(()=>{gt(!0)});const kt=a.subscribe("onResolved",()=>{kt(),gt(!1)});a.navigate({...V,replace:g,resetScroll:w,hashScrollIntoView:b,startTransition:x,viewTransition:N,ignoreBlocker:Y})}};if(q)return{...xe,ref:r,href:q,...T&&{children:T},...C&&{target:C},...I&&{disabled:I},...$&&{style:$},...H&&{className:H},...R&&{onClick:R},...Q&&{onBlur:Q},...ce&&{onFocus:ce},...Z&&{onMouseEnter:Z},...ie&&{onMouseLeave:ie},...ee&&{onTouchStart:ee}};const de=Oe=>{if(I||St!=="intent")return;if(!st){tn();return}const Ke=Oe.currentTarget;if(au.has(Ke))return;const mt=setTimeout(()=>{au.delete(Ke),tn()},st);au.set(Ke,mt)},Ae=Oe=>{I||St!=="intent"||tn()},Re=Oe=>{if(I||!St||!st)return;const Ke=Oe.currentTarget,mt=au.get(Ke);mt&&(clearTimeout(mt),au.delete(Ke))};return{...xe,...Ne,...me,href:he==null?void 0:he.href,ref:r,onClick:xo([R,$t]),onBlur:xo([Q,Re]),onFocus:xo([ce,de]),onMouseEnter:xo([Z,de]),onMouseLeave:xo([ie,Re]),onTouchStart:xo([ee,Ae]),disabled:!!I,target:C,...Ge&&{style:Ge},...Te&&{className:Te},...I&&F9,...Se&&Q9,...A&&Ue&&G9}}var j1={},H9={className:"active"},F9={role:"link","aria-disabled":!0},Q9={"data-status":"active","aria-current":"page"},G9={"data-transitioning":"transitioning"},au=new WeakMap,V9={rootMargin:"100px"},xo=n=>t=>{for(const a of n)if(a){if(t.defaultPrevented)return;a(t)}};function K9(n,t,a,r){if(!r)return t?{href:n,external:!0}:{href:a.createHref(n)||"/",external:!1}}function Y9(n){if(typeof n!="string")return!1;const t=n.charCodeAt(0);return t===47?n.charCodeAt(1)!==47:t===46}var _u=_.forwardRef((n,t)=>{const{_asChild:a,...r}=n,{type:c,...u}=$9(r,t),h=typeof r.children=="function"?r.children({isActive:u["data-status"]==="active"}):r.children;if(!a){const{disabled:p,...y}=u;return _.createElement("a",y,h)}return _.createElement(a,u,h)});function Z9(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}var W9=class extends v3{constructor(n){super(n),this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Kp({...t,from:this.id}),this.useSearch=t=>Vp({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Uu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Gp({...t,from:this.id}),this.useLoaderData=t=>Qp({...t,from:this.id}),this.useNavigate=()=>Mr({from:this.fullPath}),this.Link=Si.forwardRef((t,a)=>l.jsx(_u,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function El(n){return new W9(n)}var X9=class extends M9{constructor(n){super(n),this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Kp({...t,from:this.id}),this.useSearch=t=>Vp({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>Uu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Gp({...t,from:this.id}),this.useLoaderData=t=>Qp({...t,from:this.id}),this.useNavigate=()=>Mr({from:this.fullPath}),this.Link=Si.forwardRef((t,a)=>l.jsx(_u,{ref:a,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function J9(n){return new X9(n)}function s6(n){return typeof n=="object"?new a6(n,{silent:!0}).createRoute(n):new a6(n,{silent:!0}).createRoute}var a6=class{constructor(n,t){this.path=n,this.createRoute=a=>{const r=El(a);return r.isRoot=!1,r},this.silent=t==null?void 0:t.silent}},i6=class{constructor(n){this.useMatch=t=>Er({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Kp({...t,from:this.options.id}),this.useSearch=t=>Vp({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>Uu({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>Gp({...t,from:this.options.id}),this.useLoaderData=t=>Qp({...t,from:this.options.id}),this.useNavigate=()=>Mr({from:ia().routesById[this.options.id].fullPath}),this.options=n,this.$$typeof=Symbol.for("react.memo")}};function r6(n){return typeof n=="object"?new i6(n):t=>new i6({id:n,...t})}function eb(n){const t=aa({select:a=>`not-found-${a.location.pathname}-${a.status}`});return l.jsx(Hp,{getResetKey:()=>t,onCatch:(a,r)=>{var c;if(hs(a))(c=n.onCatch)==null||c.call(n,a,r);else throw a},errorComponent:({error:a})=>{var r;if(hs(a))return(r=n.fallback)==null?void 0:r.call(n,a);throw a},children:n.children})}function tb(){return l.jsx("p",{children:"Not Found"})}function No(n){return l.jsx(l.Fragment,{children:n.children})}function x3(n,t,a){return t.options.notFoundComponent?l.jsx(t.options.notFoundComponent,{...a}):n.options.defaultNotFoundComponent?l.jsx(n.options.defaultNotFoundComponent,{...a}):l.jsx(tb,{})}function nb(){return ia().isScrollRestoring,null}var S3=_.memo(function({matchId:t}){var N,T;const a=ia(),r=aa({select:C=>{var H;const I=C.matches.findIndex(R=>R.id===t),$=C.matches[I];return Cr($),{routeId:$.routeId,ssr:$.ssr,_displayPending:$._displayPending,resetKey:C.loadedAt,parentRouteId:(H=C.matches[I-1])==null?void 0:H.routeId}},structuralSharing:!0}),c=a.routesById[r.routeId],u=c.options.pendingComponent??a.options.defaultPendingComponent,h=u?l.jsx(u,{}):null,p=c.options.errorComponent??a.options.defaultErrorComponent,y=c.options.onCatch??a.options.defaultOnCatch,m=c.isRoot?c.options.notFoundComponent??((N=a.options.notFoundRoute)==null?void 0:N.options.component):c.options.notFoundComponent,b=r.ssr===!1||r.ssr==="data-only",g=(!c.isRoot||c.options.wrapInSuspense||b)&&(c.options.wrapInSuspense??u??(((T=c.options.errorComponent)==null?void 0:T.preload)||b))?_.Suspense:No,x=p?Hp:No,w=m?eb:No;return l.jsxs(c.isRoot?c.options.shellComponent??No:No,{children:[l.jsx(th.Provider,{value:t,children:l.jsx(g,{fallback:h,children:l.jsx(x,{getResetKey:()=>r.resetKey,errorComponent:p||Fp,onCatch:(C,I)=>{if(hs(C))throw C;y==null||y(C,I)},children:l.jsx(w,{fallback:C=>{if(!m||C.routeId&&C.routeId!==r.routeId||!C.routeId&&!c.isRoot)throw C;return _.createElement(m,C)},children:b||r._displayPending?l.jsx(A9,{fallback:h,children:l.jsx(l6,{matchId:t})}):l.jsx(l6,{matchId:t})})})})}),r.parentRouteId===xl&&a.options.scrollRestoration?l.jsxs(l.Fragment,{children:[l.jsx(sb,{}),l.jsx(nb,{})]}):null]})});function sb(){const n=ia(),t=_.useRef(void 0);return l.jsx("script",{suppressHydrationWarning:!0,ref:a=>{a&&(t.current===void 0||t.current.href!==n.latestLocation.href)&&(n.emit({type:"onRendered",...jl(n.state)}),t.current=n.latestLocation)}},n.latestLocation.state.__TSR_key)}var l6=_.memo(function({matchId:t}){var y,m,b,g;const a=ia(),{match:r,key:c,routeId:u}=aa({select:x=>{var C;const w=x.matches.find(I=>I.id===t),N=w.routeId,T=(C=a.routesById[N].options.remountDeps??a.options.defaultRemountDeps)==null?void 0:C({routeId:N,loaderDeps:w.loaderDeps,params:w._strictParams,search:w._strictSearch});return{key:T?JSON.stringify(T):void 0,routeId:N,match:{id:w.id,status:w.status,error:w.error,_forcePending:w._forcePending,_displayPending:w._displayPending}}},structuralSharing:!0}),h=a.routesById[u],p=_.useMemo(()=>{const x=h.options.component??a.options.defaultComponent;return x?l.jsx(x,{},c):l.jsx(j3,{})},[c,h.options.component,a.options.defaultComponent]);if(r._displayPending)throw(y=a.getMatch(r.id))==null?void 0:y._nonReactive.displayPendingPromise;if(r._forcePending)throw(m=a.getMatch(r.id))==null?void 0:m._nonReactive.minPendingPromise;if(r.status==="pending"){const x=h.options.pendingMinMs??a.options.defaultPendingMinMs;if(x){const w=a.getMatch(r.id);if(w&&!w._nonReactive.minPendingPromise){const N=$o();w._nonReactive.minPendingPromise=N,setTimeout(()=>{N.resolve(),w._nonReactive.minPendingPromise=void 0},x)}}throw(b=a.getMatch(r.id))==null?void 0:b._nonReactive.loadPromise}if(r.status==="notFound")return Cr(hs(r.error)),x3(a,h,r.error);if(r.status==="redirected")throw Cr(Ms(r.error)),(g=a.getMatch(r.id))==null?void 0:g._nonReactive.loadPromise;if(r.status==="error")throw r.error;return p}),j3=_.memo(function(){const t=ia(),a=_.useContext(th),r=aa({select:m=>{var b;return(b=m.matches.find(g=>g.id===a))==null?void 0:b.routeId}}),c=t.routesById[r],u=aa({select:m=>{const b=m.matches.find(g=>g.id===a);return Cr(b),b.globalNotFound}}),h=aa({select:m=>{var g;const b=m.matches;return(g=b[b.findIndex(x=>x.id===a)+1])==null?void 0:g.id}}),p=t.options.defaultPendingComponent?l.jsx(t.options.defaultPendingComponent,{}):null;if(u)return x3(t,c,void 0);if(!h)return null;const y=l.jsx(S3,{matchId:h});return r===xl?l.jsx(_.Suspense,{fallback:p,children:y}):y});function ab(){const n=ia(),t=_.useRef({router:n,mounted:!1}),[a,r]=_.useState(!1),{hasPendingMatches:c,isLoading:u}=aa({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(x=>x.status==="pending")}),structuralSharing:!0}),h=h1(u),p=u||a||c,y=h1(p),m=u||c,b=h1(m);return n.startTransition=g=>{r(!0),_.startTransition(()=>{g(),r(!1)})},_.useEffect(()=>{const g=n.history.subscribe(n.load),x=n.buildLocation({to:n.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return jr(n.latestLocation.publicHref)!==jr(x.publicHref)&&n.commitLocation({...x,replace:!0}),()=>{g()}},[n,n.history]),hf(()=>{if(typeof window<"u"&&n.ssr||t.current.router===n&&t.current.mounted)return;t.current={router:n,mounted:!0},(async()=>{try{await n.load()}catch(x){console.error(x)}})()},[n]),hf(()=>{h&&!u&&n.emit({type:"onLoad",...jl(n.state)})},[h,n,u]),hf(()=>{b&&!m&&n.emit({type:"onBeforeRouteMount",...jl(n.state)})},[m,b,n]),hf(()=>{if(y&&!p){const g=jl(n.state);n.emit({type:"onResolved",...g}),n.__store.setState(x=>({...x,status:"idle",resolvedLocation:x.location})),g.hrefChanged&&q_(n)}},[p,y,n]),null}function ib(){const n=ia(),t=n.routesById[xl].options.pendingComponent??n.options.defaultPendingComponent,a=t?l.jsx(t,{}):null,r=l.jsxs(typeof document<"u"&&n.ssr?No:_.Suspense,{fallback:a,children:[l.jsx(ab,{}),l.jsx(rb,{})]});return n.options.InnerWrap?l.jsx(n.options.InnerWrap,{children:r}):r}function rb(){const n=ia(),t=aa({select:c=>{var u;return(u=c.matches[0])==null?void 0:u.id}}),a=aa({select:c=>c.loadedAt}),r=t?l.jsx(S3,{matchId:t}):null;return l.jsx(th.Provider,{value:t,children:n.options.disableGlobalCatchBoundary?r:l.jsx(Hp,{getResetKey:()=>a,errorComponent:Fp,onCatch:void 0,children:r})})}var lb=n=>new ob(n),ob=class extends S9{constructor(n){super(n)}};typeof globalThis<"u"?(globalThis.createFileRoute=s6,globalThis.createLazyFileRoute=r6):typeof window<"u"&&(window.createFileRoute=s6,window.createLazyFileRoute=r6);function cb({router:n,children:t,...a}){Object.keys(a).length>0&&n.update({...n.options,...a,context:{...n.options.context,...a.context}});const r=l.jsx(b3.Provider,{value:n,children:t});return n.options.Wrap?l.jsx(n.options.Wrap,{children:r}):r}function ub({router:n,...t}){return l.jsx(cb,{router:n,...t,children:l.jsx(ib,{})})}var Bt;(function(n){n.assertEqual=c=>{};function t(c){}n.assertIs=t;function a(c){throw new Error}n.assertNever=a,n.arrayToEnum=c=>{const u={};for(const h of c)u[h]=h;return u},n.getValidEnumValues=c=>{const u=n.objectKeys(c).filter(p=>typeof c[c[p]]!="number"),h={};for(const p of u)h[p]=c[p];return n.objectValues(h)},n.objectValues=c=>n.objectKeys(c).map(function(u){return c[u]}),n.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{const u=[];for(const h in c)Object.prototype.hasOwnProperty.call(c,h)&&u.push(h);return u},n.find=(c,u)=>{for(const h of c)if(u(h))return h},n.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function r(c,u=" | "){return c.map(h=>typeof h=="string"?`'${h}'`:h).join(u)}n.joinValues=r,n.jsonStringifyReplacer=(c,u)=>typeof u=="bigint"?u.toString():u})(Bt||(Bt={}));var o6;(function(n){n.mergeShapes=(t,a)=>({...t,...a})})(o6||(o6={}));const Qe=Bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),lr=n=>{switch(typeof n){case"undefined":return Qe.undefined;case"string":return Qe.string;case"number":return Number.isNaN(n)?Qe.nan:Qe.number;case"boolean":return Qe.boolean;case"function":return Qe.function;case"bigint":return Qe.bigint;case"symbol":return Qe.symbol;case"object":return Array.isArray(n)?Qe.array:n===null?Qe.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Qe.promise:typeof Map<"u"&&n instanceof Map?Qe.map:typeof Set<"u"&&n instanceof Set?Qe.set:typeof Date<"u"&&n instanceof Date?Qe.date:Qe.object;default:return Qe.unknown}},Me=Bt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ni extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=t}format(t){const a=t||function(u){return u.message},r={_errors:[]},c=u=>{for(const h of u.issues)if(h.code==="invalid_union")h.unionErrors.map(c);else if(h.code==="invalid_return_type")c(h.returnTypeError);else if(h.code==="invalid_arguments")c(h.argumentsError);else if(h.path.length===0)r._errors.push(a(h));else{let p=r,y=0;for(;y<h.path.length;){const m=h.path[y];y===h.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(a(h))):p[m]=p[m]||{_errors:[]},p=p[m],y++}}};return c(this),r}static assert(t){if(!(t instanceof Ni))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a={},r=[];for(const c of this.issues)if(c.path.length>0){const u=c.path[0];a[u]=a[u]||[],a[u].push(t(c))}else r.push(t(c));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}Ni.create=n=>new Ni(n);const lp=(n,t)=>{let a;switch(n.code){case Me.invalid_type:n.received===Qe.undefined?a="Required":a=`Expected ${n.expected}, received ${n.received}`;break;case Me.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(n.expected,Bt.jsonStringifyReplacer)}`;break;case Me.unrecognized_keys:a=`Unrecognized key(s) in object: ${Bt.joinValues(n.keys,", ")}`;break;case Me.invalid_union:a="Invalid input";break;case Me.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Bt.joinValues(n.options)}`;break;case Me.invalid_enum_value:a=`Invalid enum value. Expected ${Bt.joinValues(n.options)}, received '${n.received}'`;break;case Me.invalid_arguments:a="Invalid function arguments";break;case Me.invalid_return_type:a="Invalid function return type";break;case Me.invalid_date:a="Invalid date";break;case Me.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(a=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?a=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?a=`Invalid input: must end with "${n.validation.endsWith}"`:Bt.assertNever(n.validation):n.validation!=="regex"?a=`Invalid ${n.validation}`:a="Invalid";break;case Me.too_small:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?a=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:a="Invalid input";break;case Me.too_big:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?a=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:a="Invalid input";break;case Me.custom:a="Invalid input";break;case Me.invalid_intersection_types:a="Intersection results could not be merged";break;case Me.not_multiple_of:a=`Number must be a multiple of ${n.multipleOf}`;break;case Me.not_finite:a="Number must be finite";break;default:a=t.defaultError,Bt.assertNever(n)}return{message:a}};let db=lp;function fb(){return db}const hb=n=>{const{data:t,path:a,errorMaps:r,issueData:c}=n,u=[...a,...c.path||[]],h={...c,path:u};if(c.message!==void 0)return{...c,path:u,message:c.message};let p="";const y=r.filter(m=>!!m).slice().reverse();for(const m of y)p=m(h,{data:t,defaultError:p}).message;return{...c,path:u,message:p}};function Pe(n,t){const a=fb(),r=hb({issueData:t,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,a,a===lp?void 0:lp].filter(c=>!!c)});n.common.issues.push(r)}class ms{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,a){const r=[];for(const c of a){if(c.status==="aborted")return ft;c.status==="dirty"&&t.dirty(),r.push(c.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,a){const r=[];for(const c of a){const u=await c.key,h=await c.value;r.push({key:u,value:h})}return ms.mergeObjectSync(t,r)}static mergeObjectSync(t,a){const r={};for(const c of a){const{key:u,value:h}=c;if(u.status==="aborted"||h.status==="aborted")return ft;u.status==="dirty"&&t.dirty(),h.status==="dirty"&&t.dirty(),u.value!=="__proto__"&&(typeof h.value<"u"||c.alwaysSet)&&(r[u.value]=h.value)}return{status:t.value,value:r}}}const ft=Object.freeze({status:"aborted"}),fu=n=>({status:"dirty",value:n}),ra=n=>({status:"valid",value:n}),c6=n=>n.status==="aborted",u6=n=>n.status==="dirty",Ho=n=>n.status==="valid",Pf=n=>typeof Promise<"u"&&n instanceof Promise;var Xe;(function(n){n.errToObj=t=>typeof t=="string"?{message:t}:t||{},n.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Xe||(Xe={}));class Ha{constructor(t,a,r,c){this._cachedPath=[],this.parent=t,this.data=a,this._path=r,this._key=c}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const d6=(n,t)=>{if(Ho(t))return{success:!0,data:t.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new Ni(n.common.issues);return this._error=a,this._error}}};function xt(n){if(!n)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:c}=n;if(t&&(a||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:c}:{errorMap:(h,p)=>{const{message:y}=n;return h.code==="invalid_enum_value"?{message:y??p.defaultError}:typeof p.data>"u"?{message:y??r??p.defaultError}:h.code!=="invalid_type"?{message:p.defaultError}:{message:y??a??p.defaultError}},description:c}}class At{get description(){return this._def.description}_getType(t){return lr(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ms,ctx:{common:t.parent.common,data:t.data,parsedType:lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(Pf(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(t){const a=this._parse(t);return Promise.resolve(a)}parse(t,a){const r=this.safeParse(t,a);if(r.success)return r.data;throw r.error}safeParse(t,a){const r={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lr(t)},c=this._parseSync({data:t,path:r.path,parent:r});return d6(r,c)}"~validate"(t){var r,c;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lr(t)};if(!this["~standard"].async)try{const u=this._parseSync({data:t,path:[],parent:a});return Ho(u)?{value:u.value}:{issues:a.common.issues}}catch(u){(c=(r=u==null?void 0:u.message)==null?void 0:r.toLowerCase())!=null&&c.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(u=>Ho(u)?{value:u.value}:{issues:a.common.issues})}async parseAsync(t,a){const r=await this.safeParseAsync(t,a);if(r.success)return r.data;throw r.error}async safeParseAsync(t,a){const r={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:lr(t)},c=this._parse({data:t,path:r.path,parent:r}),u=await(Pf(c)?c:Promise.resolve(c));return d6(r,u)}refine(t,a){const r=c=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(c):a;return this._refinement((c,u)=>{const h=t(c),p=()=>u.addIssue({code:Me.custom,...r(c)});return typeof Promise<"u"&&h instanceof Promise?h.then(y=>y?!0:(p(),!1)):h?!0:(p(),!1)})}refinement(t,a){return this._refinement((r,c)=>t(r)?!0:(c.addIssue(typeof a=="function"?a(r,c):a),!1))}_refinement(t){return new Go({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return kr.create(this,this._def)}nullable(){return Vo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $a.create(this)}promise(){return Ff.create(this,this._def)}or(t){return qf.create([this,t],this._def)}and(t){return $f.create(this,t,this._def)}transform(t){return new Go({...xt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new fp({...xt(this._def),innerType:this,defaultValue:a,typeName:ut.ZodDefault})}brand(){return new Ib({typeName:ut.ZodBranded,type:this,...xt(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new hp({...xt(this._def),innerType:this,catchValue:a,typeName:ut.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return Yp.create(this,t)}readonly(){return mp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mb=/^c[^\s-]{8,}$/i,pb=/^[0-9a-z]+$/,gb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,vb=/^[a-z0-9_-]{21}$/i,_b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Sb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let w1;const jb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,kb=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Nb=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Eb=new RegExp(`^${w3}$`);function k3(n){let t="[0-5]\\d";n.precision?t=`${t}\\.\\d{${n.precision}}`:n.precision==null&&(t=`${t}(\\.\\d+)?`);const a=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${a}`}function Mb(n){return new RegExp(`^${k3(n)}$`)}function Rb(n){let t=`${w3}T${k3(n)}`;const a=[];return a.push(n.local?"Z?":"Z"),n.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function Ab(n,t){return!!((t==="v4"||!t)&&jb.test(n)||(t==="v6"||!t)&&kb.test(n))}function Db(n,t){if(!_b.test(n))return!1;try{const[a]=n.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),c=JSON.parse(atob(r));return!(typeof c!="object"||c===null||"typ"in c&&(c==null?void 0:c.typ)!=="JWT"||!c.alg||t&&c.alg!==t)}catch{return!1}}function Ob(n,t){return!!((t==="v4"||!t)&&wb.test(n)||(t==="v6"||!t)&&Nb.test(n))}class ji extends At{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Qe.string){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.string,received:u.parsedType}),ft}const r=new ms;let c;for(const u of this._def.checks)if(u.kind==="min")t.data.length<u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),r.dirty());else if(u.kind==="max")t.data.length>u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),r.dirty());else if(u.kind==="length"){const h=t.data.length>u.value,p=t.data.length<u.value;(h||p)&&(c=this._getOrReturnCtx(t,c),h?Pe(c,{code:Me.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):p&&Pe(c,{code:Me.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),r.dirty())}else if(u.kind==="email")xb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"email",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="emoji")w1||(w1=new RegExp(Sb,"u")),w1.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"emoji",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="uuid")yb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"uuid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="nanoid")vb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"nanoid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="cuid")mb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cuid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="cuid2")pb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cuid2",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="ulid")gb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"ulid",code:Me.invalid_string,message:u.message}),r.dirty());else if(u.kind==="url")try{new URL(t.data)}catch{c=this._getOrReturnCtx(t,c),Pe(c,{validation:"url",code:Me.invalid_string,message:u.message}),r.dirty()}else u.kind==="regex"?(u.regex.lastIndex=0,u.regex.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"regex",code:Me.invalid_string,message:u.message}),r.dirty())):u.kind==="trim"?t.data=t.data.trim():u.kind==="includes"?t.data.includes(u.value,u.position)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),r.dirty()):u.kind==="toLowerCase"?t.data=t.data.toLowerCase():u.kind==="toUpperCase"?t.data=t.data.toUpperCase():u.kind==="startsWith"?t.data.startsWith(u.value)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{startsWith:u.value},message:u.message}),r.dirty()):u.kind==="endsWith"?t.data.endsWith(u.value)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:{endsWith:u.value},message:u.message}),r.dirty()):u.kind==="datetime"?Rb(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"datetime",message:u.message}),r.dirty()):u.kind==="date"?Eb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"date",message:u.message}),r.dirty()):u.kind==="time"?Mb(u).test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.invalid_string,validation:"time",message:u.message}),r.dirty()):u.kind==="duration"?bb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"duration",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="ip"?Ab(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"ip",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="jwt"?Db(t.data,u.alg)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"jwt",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="cidr"?Ob(t.data,u.version)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"cidr",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="base64"?Cb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"base64",code:Me.invalid_string,message:u.message}),r.dirty()):u.kind==="base64url"?Tb.test(t.data)||(c=this._getOrReturnCtx(t,c),Pe(c,{validation:"base64url",code:Me.invalid_string,message:u.message}),r.dirty()):Bt.assertNever(u);return{status:r.value,value:t.data}}_regex(t,a,r){return this.refinement(c=>t.test(c),{validation:a,code:Me.invalid_string,...Xe.errToObj(r)})}_addCheck(t){return new ji({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Xe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Xe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Xe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Xe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Xe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Xe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Xe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Xe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Xe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Xe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Xe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Xe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Xe.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Xe.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Xe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Xe.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...Xe.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...Xe.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...Xe.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...Xe.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...Xe.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...Xe.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...Xe.errToObj(a)})}nonempty(t){return this.min(1,Xe.errToObj(t))}trim(){return new ji({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ji({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ji({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxLength(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}ji.create=n=>new ji({checks:[],typeName:ut.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...xt(n)});function Lb(n,t){const a=(n.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,c=a>r?a:r,u=Number.parseInt(n.toFixed(c).replace(".","")),h=Number.parseInt(t.toFixed(c).replace(".",""));return u%h/10**c}class Fo extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Qe.number){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.number,received:u.parsedType}),ft}let r;const c=new ms;for(const u of this._def.checks)u.kind==="int"?Bt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.invalid_type,expected:"integer",received:"float",message:u.message}),c.dirty()):u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_small,minimum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),c.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),c.dirty()):u.kind==="multipleOf"?Lb(t.data,u.value)!==0&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):u.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_finite,message:u.message}),c.dirty()):Bt.assertNever(u);return{status:c.value,value:t.data}}gte(t,a){return this.setLimit("min",t,!0,Xe.toString(a))}gt(t,a){return this.setLimit("min",t,!1,Xe.toString(a))}lte(t,a){return this.setLimit("max",t,!0,Xe.toString(a))}lt(t,a){return this.setLimit("max",t,!1,Xe.toString(a))}setLimit(t,a,r,c){return new Fo({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:Xe.toString(c)}]})}_addCheck(t){return new Fo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Xe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Xe.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:Xe.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:Xe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Xe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Xe.toString(t)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Bt.isInteger(t.value))}get isFinite(){let t=null,a=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(a===null||r.value>a)&&(a=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(a)&&Number.isFinite(t)}}Fo.create=n=>new Fo({checks:[],typeName:ut.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...xt(n)});class ku extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Qe.bigint)return this._getInvalidInput(t);let r;const c=new ms;for(const u of this._def.checks)u.kind==="min"?(u.inclusive?t.data<u.value:t.data<=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),c.dirty()):u.kind==="max"?(u.inclusive?t.data>u.value:t.data>=u.value)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),c.dirty()):u.kind==="multipleOf"?t.data%u.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Pe(r,{code:Me.not_multiple_of,multipleOf:u.value,message:u.message}),c.dirty()):Bt.assertNever(u);return{status:c.value,value:t.data}}_getInvalidInput(t){const a=this._getOrReturnCtx(t);return Pe(a,{code:Me.invalid_type,expected:Qe.bigint,received:a.parsedType}),ft}gte(t,a){return this.setLimit("min",t,!0,Xe.toString(a))}gt(t,a){return this.setLimit("min",t,!1,Xe.toString(a))}lte(t,a){return this.setLimit("max",t,!0,Xe.toString(a))}lt(t,a){return this.setLimit("max",t,!1,Xe.toString(a))}setLimit(t,a,r,c){return new ku({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:Xe.toString(c)}]})}_addCheck(t){return new ku({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Xe.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:Xe.toString(a)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}ku.create=n=>new ku({checks:[],typeName:ut.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...xt(n)});class op extends At{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Qe.boolean){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.boolean,received:r.parsedType}),ft}return ra(t.data)}}op.create=n=>new op({typeName:ut.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...xt(n)});class Uf extends At{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Qe.date){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_type,expected:Qe.date,received:u.parsedType}),ft}if(Number.isNaN(t.data.getTime())){const u=this._getOrReturnCtx(t);return Pe(u,{code:Me.invalid_date}),ft}const r=new ms;let c;for(const u of this._def.checks)u.kind==="min"?t.data.getTime()<u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),r.dirty()):u.kind==="max"?t.data.getTime()>u.value&&(c=this._getOrReturnCtx(t,c),Pe(c,{code:Me.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),r.dirty()):Bt.assertNever(u);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Uf({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:Xe.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:Xe.toString(a)})}get minDate(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t!=null?new Date(t):null}}Uf.create=n=>new Uf({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:ut.ZodDate,...xt(n)});class f6 extends At{_parse(t){if(this._getType(t)!==Qe.symbol){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.symbol,received:r.parsedType}),ft}return ra(t.data)}}f6.create=n=>new f6({typeName:ut.ZodSymbol,...xt(n)});class h6 extends At{_parse(t){if(this._getType(t)!==Qe.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.undefined,received:r.parsedType}),ft}return ra(t.data)}}h6.create=n=>new h6({typeName:ut.ZodUndefined,...xt(n)});class m6 extends At{_parse(t){if(this._getType(t)!==Qe.null){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.null,received:r.parsedType}),ft}return ra(t.data)}}m6.create=n=>new m6({typeName:ut.ZodNull,...xt(n)});class cp extends At{constructor(){super(...arguments),this._any=!0}_parse(t){return ra(t.data)}}cp.create=n=>new cp({typeName:ut.ZodAny,...xt(n)});class p6 extends At{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ra(t.data)}}p6.create=n=>new p6({typeName:ut.ZodUnknown,...xt(n)});class Tr extends At{_parse(t){const a=this._getOrReturnCtx(t);return Pe(a,{code:Me.invalid_type,expected:Qe.never,received:a.parsedType}),ft}}Tr.create=n=>new Tr({typeName:ut.ZodNever,...xt(n)});class g6 extends At{_parse(t){if(this._getType(t)!==Qe.undefined){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.void,received:r.parsedType}),ft}return ra(t.data)}}g6.create=n=>new g6({typeName:ut.ZodVoid,...xt(n)});class $a extends At{_parse(t){const{ctx:a,status:r}=this._processInputParams(t),c=this._def;if(a.parsedType!==Qe.array)return Pe(a,{code:Me.invalid_type,expected:Qe.array,received:a.parsedType}),ft;if(c.exactLength!==null){const h=a.data.length>c.exactLength.value,p=a.data.length<c.exactLength.value;(h||p)&&(Pe(a,{code:h?Me.too_big:Me.too_small,minimum:p?c.exactLength.value:void 0,maximum:h?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),r.dirty())}if(c.minLength!==null&&a.data.length<c.minLength.value&&(Pe(a,{code:Me.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),r.dirty()),c.maxLength!==null&&a.data.length>c.maxLength.value&&(Pe(a,{code:Me.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),r.dirty()),a.common.async)return Promise.all([...a.data].map((h,p)=>c.type._parseAsync(new Ha(a,h,a.path,p)))).then(h=>ms.mergeArray(r,h));const u=[...a.data].map((h,p)=>c.type._parseSync(new Ha(a,h,a.path,p)));return ms.mergeArray(r,u)}get element(){return this._def.type}min(t,a){return new $a({...this._def,minLength:{value:t,message:Xe.toString(a)}})}max(t,a){return new $a({...this._def,maxLength:{value:t,message:Xe.toString(a)}})}length(t,a){return new $a({...this._def,exactLength:{value:t,message:Xe.toString(a)}})}nonempty(t){return this.min(1,t)}}$a.create=(n,t)=>new $a({type:n,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...xt(t)});function Co(n){if(n instanceof Dn){const t={};for(const a in n.shape){const r=n.shape[a];t[a]=kr.create(Co(r))}return new Dn({...n._def,shape:()=>t})}else return n instanceof $a?new $a({...n._def,type:Co(n.element)}):n instanceof kr?kr.create(Co(n.unwrap())):n instanceof Vo?Vo.create(Co(n.unwrap())):n instanceof Cl?Cl.create(n.items.map(t=>Co(t))):n}class Dn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),a=Bt.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(t){if(this._getType(t)!==Qe.object){const m=this._getOrReturnCtx(t);return Pe(m,{code:Me.invalid_type,expected:Qe.object,received:m.parsedType}),ft}const{status:r,ctx:c}=this._processInputParams(t),{shape:u,keys:h}=this._getCached(),p=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(const m in c.data)h.includes(m)||p.push(m);const y=[];for(const m of h){const b=u[m],g=c.data[m];y.push({key:{status:"valid",value:m},value:b._parse(new Ha(c,g,c.path,m)),alwaysSet:m in c.data})}if(this._def.catchall instanceof Tr){const m=this._def.unknownKeys;if(m==="passthrough")for(const b of p)y.push({key:{status:"valid",value:b},value:{status:"valid",value:c.data[b]}});else if(m==="strict")p.length>0&&(Pe(c,{code:Me.unrecognized_keys,keys:p}),r.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const b of p){const g=c.data[b];y.push({key:{status:"valid",value:b},value:m._parse(new Ha(c,g,c.path,b)),alwaysSet:b in c.data})}}return c.common.async?Promise.resolve().then(async()=>{const m=[];for(const b of y){const g=await b.key,x=await b.value;m.push({key:g,value:x,alwaysSet:b.alwaysSet})}return m}).then(m=>ms.mergeObjectSync(r,m)):ms.mergeObjectSync(r,y)}get shape(){return this._def.shape()}strict(t){return Xe.errToObj,new Dn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(a,r)=>{var u,h;const c=((h=(u=this._def).errorMap)==null?void 0:h.call(u,a,r).message)??r.defaultError;return a.code==="unrecognized_keys"?{message:Xe.errToObj(t).message??c}:{message:c}}}:{}})}strip(){return new Dn({...this._def,unknownKeys:"strip"})}passthrough(){return new Dn({...this._def,unknownKeys:"passthrough"})}extend(t){return new Dn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Dn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ut.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new Dn({...this._def,catchall:t})}pick(t){const a={};for(const r of Bt.objectKeys(t))t[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new Dn({...this._def,shape:()=>a})}omit(t){const a={};for(const r of Bt.objectKeys(this.shape))t[r]||(a[r]=this.shape[r]);return new Dn({...this._def,shape:()=>a})}deepPartial(){return Co(this)}partial(t){const a={};for(const r of Bt.objectKeys(this.shape)){const c=this.shape[r];t&&!t[r]?a[r]=c:a[r]=c.optional()}return new Dn({...this._def,shape:()=>a})}required(t){const a={};for(const r of Bt.objectKeys(this.shape))if(t&&!t[r])a[r]=this.shape[r];else{let u=this.shape[r];for(;u instanceof kr;)u=u._def.innerType;a[r]=u}return new Dn({...this._def,shape:()=>a})}keyof(){return N3(Bt.objectKeys(this.shape))}}Dn.create=(n,t)=>new Dn({shape:()=>n,unknownKeys:"strip",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});Dn.strictCreate=(n,t)=>new Dn({shape:()=>n,unknownKeys:"strict",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});Dn.lazycreate=(n,t)=>new Dn({shape:n,unknownKeys:"strip",catchall:Tr.create(),typeName:ut.ZodObject,...xt(t)});class qf extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r=this._def.options;function c(u){for(const p of u)if(p.result.status==="valid")return p.result;for(const p of u)if(p.result.status==="dirty")return a.common.issues.push(...p.ctx.common.issues),p.result;const h=u.map(p=>new Ni(p.ctx.common.issues));return Pe(a,{code:Me.invalid_union,unionErrors:h}),ft}if(a.common.async)return Promise.all(r.map(async u=>{const h={...a,common:{...a.common,issues:[]},parent:null};return{result:await u._parseAsync({data:a.data,path:a.path,parent:h}),ctx:h}})).then(c);{let u;const h=[];for(const y of r){const m={...a,common:{...a.common,issues:[]},parent:null},b=y._parseSync({data:a.data,path:a.path,parent:m});if(b.status==="valid")return b;b.status==="dirty"&&!u&&(u={result:b,ctx:m}),m.common.issues.length&&h.push(m.common.issues)}if(u)return a.common.issues.push(...u.ctx.common.issues),u.result;const p=h.map(y=>new Ni(y));return Pe(a,{code:Me.invalid_union,unionErrors:p}),ft}}get options(){return this._def.options}}qf.create=(n,t)=>new qf({options:n,typeName:ut.ZodUnion,...xt(t)});function up(n,t){const a=lr(n),r=lr(t);if(n===t)return{valid:!0,data:n};if(a===Qe.object&&r===Qe.object){const c=Bt.objectKeys(t),u=Bt.objectKeys(n).filter(p=>c.indexOf(p)!==-1),h={...n,...t};for(const p of u){const y=up(n[p],t[p]);if(!y.valid)return{valid:!1};h[p]=y.data}return{valid:!0,data:h}}else if(a===Qe.array&&r===Qe.array){if(n.length!==t.length)return{valid:!1};const c=[];for(let u=0;u<n.length;u++){const h=n[u],p=t[u],y=up(h,p);if(!y.valid)return{valid:!1};c.push(y.data)}return{valid:!0,data:c}}else return a===Qe.date&&r===Qe.date&&+n==+t?{valid:!0,data:n}:{valid:!1}}class $f extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t),c=(u,h)=>{if(c6(u)||c6(h))return ft;const p=up(u.value,h.value);return p.valid?((u6(u)||u6(h))&&a.dirty(),{status:a.value,value:p.data}):(Pe(r,{code:Me.invalid_intersection_types}),ft)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([u,h])=>c(u,h)):c(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}$f.create=(n,t,a)=>new $f({left:n,right:t,typeName:ut.ZodIntersection,...xt(a)});class Cl extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.array)return Pe(r,{code:Me.invalid_type,expected:Qe.array,received:r.parsedType}),ft;if(r.data.length<this._def.items.length)return Pe(r,{code:Me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ft;!this._def.rest&&r.data.length>this._def.items.length&&(Pe(r,{code:Me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const u=[...r.data].map((h,p)=>{const y=this._def.items[p]||this._def.rest;return y?y._parse(new Ha(r,h,r.path,p)):null}).filter(h=>!!h);return r.common.async?Promise.all(u).then(h=>ms.mergeArray(a,h)):ms.mergeArray(a,u)}get items(){return this._def.items}rest(t){return new Cl({...this._def,rest:t})}}Cl.create=(n,t)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cl({items:n,typeName:ut.ZodTuple,rest:null,...xt(t)})};class Hf extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.object)return Pe(r,{code:Me.invalid_type,expected:Qe.object,received:r.parsedType}),ft;const c=[],u=this._def.keyType,h=this._def.valueType;for(const p in r.data)c.push({key:u._parse(new Ha(r,p,r.path,p)),value:h._parse(new Ha(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?ms.mergeObjectAsync(a,c):ms.mergeObjectSync(a,c)}get element(){return this._def.valueType}static create(t,a,r){return a instanceof At?new Hf({keyType:t,valueType:a,typeName:ut.ZodRecord,...xt(r)}):new Hf({keyType:ji.create(),valueType:t,typeName:ut.ZodRecord,...xt(a)})}}class y6 extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.map)return Pe(r,{code:Me.invalid_type,expected:Qe.map,received:r.parsedType}),ft;const c=this._def.keyType,u=this._def.valueType,h=[...r.data.entries()].map(([p,y],m)=>({key:c._parse(new Ha(r,p,r.path,[m,"key"])),value:u._parse(new Ha(r,y,r.path,[m,"value"]))}));if(r.common.async){const p=new Map;return Promise.resolve().then(async()=>{for(const y of h){const m=await y.key,b=await y.value;if(m.status==="aborted"||b.status==="aborted")return ft;(m.status==="dirty"||b.status==="dirty")&&a.dirty(),p.set(m.value,b.value)}return{status:a.value,value:p}})}else{const p=new Map;for(const y of h){const m=y.key,b=y.value;if(m.status==="aborted"||b.status==="aborted")return ft;(m.status==="dirty"||b.status==="dirty")&&a.dirty(),p.set(m.value,b.value)}return{status:a.value,value:p}}}}y6.create=(n,t,a)=>new y6({valueType:t,keyType:n,typeName:ut.ZodMap,...xt(a)});class Nu extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==Qe.set)return Pe(r,{code:Me.invalid_type,expected:Qe.set,received:r.parsedType}),ft;const c=this._def;c.minSize!==null&&r.data.size<c.minSize.value&&(Pe(r,{code:Me.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),a.dirty()),c.maxSize!==null&&r.data.size>c.maxSize.value&&(Pe(r,{code:Me.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),a.dirty());const u=this._def.valueType;function h(y){const m=new Set;for(const b of y){if(b.status==="aborted")return ft;b.status==="dirty"&&a.dirty(),m.add(b.value)}return{status:a.value,value:m}}const p=[...r.data.values()].map((y,m)=>u._parse(new Ha(r,y,r.path,m)));return r.common.async?Promise.all(p).then(y=>h(y)):h(p)}min(t,a){return new Nu({...this._def,minSize:{value:t,message:Xe.toString(a)}})}max(t,a){return new Nu({...this._def,maxSize:{value:t,message:Xe.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}Nu.create=(n,t)=>new Nu({valueType:n,minSize:null,maxSize:null,typeName:ut.ZodSet,...xt(t)});class v6 extends At{get schema(){return this._def.getter()}_parse(t){const{ctx:a}=this._processInputParams(t);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}v6.create=(n,t)=>new v6({getter:n,typeName:ut.ZodLazy,...xt(t)});class dp extends At{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return Pe(a,{received:a.data,code:Me.invalid_literal,expected:this._def.value}),ft}return{status:"valid",value:t.data}}get value(){return this._def.value}}dp.create=(n,t)=>new dp({value:n,typeName:ut.ZodLiteral,...xt(t)});function N3(n,t){return new Qo({values:n,typeName:ut.ZodEnum,...xt(t)})}class Qo extends At{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),r=this._def.values;return Pe(a,{expected:Bt.joinValues(r),received:a.parsedType,code:Me.invalid_type}),ft}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const a=this._getOrReturnCtx(t),r=this._def.values;return Pe(a,{received:a.data,code:Me.invalid_enum_value,options:r}),ft}return ra(t.data)}get options(){return this._def.values}get enum(){const t={};for(const a of this._def.values)t[a]=a;return t}get Values(){const t={};for(const a of this._def.values)t[a]=a;return t}get Enum(){const t={};for(const a of this._def.values)t[a]=a;return t}extract(t,a=this._def){return Qo.create(t,{...this._def,...a})}exclude(t,a=this._def){return Qo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...a})}}Qo.create=N3;class _6 extends At{_parse(t){const a=Bt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Qe.string&&r.parsedType!==Qe.number){const c=Bt.objectValues(a);return Pe(r,{expected:Bt.joinValues(c),received:r.parsedType,code:Me.invalid_type}),ft}if(this._cache||(this._cache=new Set(Bt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const c=Bt.objectValues(a);return Pe(r,{received:r.data,code:Me.invalid_enum_value,options:c}),ft}return ra(t.data)}get enum(){return this._def.values}}_6.create=(n,t)=>new _6({values:n,typeName:ut.ZodNativeEnum,...xt(t)});class Ff extends At{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==Qe.promise&&a.common.async===!1)return Pe(a,{code:Me.invalid_type,expected:Qe.promise,received:a.parsedType}),ft;const r=a.parsedType===Qe.promise?a.data:Promise.resolve(a.data);return ra(r.then(c=>this._def.type.parseAsync(c,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ff.create=(n,t)=>new Ff({type:n,typeName:ut.ZodPromise,...xt(t)});class Go extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:r}=this._processInputParams(t),c=this._def.effect||null,u={addIssue:h=>{Pe(r,h),h.fatal?a.abort():a.dirty()},get path(){return r.path}};if(u.addIssue=u.addIssue.bind(u),c.type==="preprocess"){const h=c.transform(r.data,u);if(r.common.async)return Promise.resolve(h).then(async p=>{if(a.value==="aborted")return ft;const y=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return y.status==="aborted"?ft:y.status==="dirty"||a.value==="dirty"?fu(y.value):y});{if(a.value==="aborted")return ft;const p=this._def.schema._parseSync({data:h,path:r.path,parent:r});return p.status==="aborted"?ft:p.status==="dirty"||a.value==="dirty"?fu(p.value):p}}if(c.type==="refinement"){const h=p=>{const y=c.refinement(p,u);if(r.common.async)return Promise.resolve(y);if(y instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){const p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?ft:(p.status==="dirty"&&a.dirty(),h(p.value),{status:a.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?ft:(p.status==="dirty"&&a.dirty(),h(p.value).then(()=>({status:a.value,value:p.value}))))}if(c.type==="transform")if(r.common.async===!1){const h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ho(h))return ft;const p=c.transform(h.value,u);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>Ho(h)?Promise.resolve(c.transform(h.value,u)).then(p=>({status:a.value,value:p})):ft);Bt.assertNever(c)}}Go.create=(n,t,a)=>new Go({schema:n,typeName:ut.ZodEffects,effect:t,...xt(a)});Go.createWithPreprocess=(n,t,a)=>new Go({schema:t,effect:{type:"preprocess",transform:n},typeName:ut.ZodEffects,...xt(a)});class kr extends At{_parse(t){return this._getType(t)===Qe.undefined?ra(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}kr.create=(n,t)=>new kr({innerType:n,typeName:ut.ZodOptional,...xt(t)});class Vo extends At{_parse(t){return this._getType(t)===Qe.null?ra(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Vo.create=(n,t)=>new Vo({innerType:n,typeName:ut.ZodNullable,...xt(t)});class fp extends At{_parse(t){const{ctx:a}=this._processInputParams(t);let r=a.data;return a.parsedType===Qe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}fp.create=(n,t)=>new fp({innerType:n,typeName:ut.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class hp extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r={...a,common:{...a.common,issues:[]}},c=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pf(c)?c.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Ni(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}hp.create=(n,t)=>new hp({innerType:n,typeName:ut.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class b6 extends At{_parse(t){if(this._getType(t)!==Qe.nan){const r=this._getOrReturnCtx(t);return Pe(r,{code:Me.invalid_type,expected:Qe.nan,received:r.parsedType}),ft}return{status:"valid",value:t.data}}}b6.create=n=>new b6({typeName:ut.ZodNaN,...xt(n)});class Ib extends At{_parse(t){const{ctx:a}=this._processInputParams(t),r=a.data;return this._def.type._parse({data:r,path:a.path,parent:a})}unwrap(){return this._def.type}}class Yp extends At{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const u=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?ft:u.status==="dirty"?(a.dirty(),fu(u.value)):this._def.out._parseAsync({data:u.value,path:r.path,parent:r})})();{const c=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?ft:c.status==="dirty"?(a.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:r.path,parent:r})}}static create(t,a){return new Yp({in:t,out:a,typeName:ut.ZodPipeline})}}class mp extends At{_parse(t){const a=this._def.innerType._parse(t),r=c=>(Ho(c)&&(c.value=Object.freeze(c.value)),c);return Pf(a)?a.then(c=>r(c)):r(a)}unwrap(){return this._def.innerType}}mp.create=(n,t)=>new mp({innerType:n,typeName:ut.ZodReadonly,...xt(t)});var ut;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(ut||(ut={}));const M=ji.create,nt=Fo.create,Yt=op.create,zb=cp.create;Tr.create;const vt=$a.create,Be=Dn.create;qf.create;$f.create;Cl.create;const Qf=Hf.create,Zp=dp.create,Dt=Qo.create;Ff.create;kr.create;Vo.create;const C3=Dt(["codex","claude"]),Bb=Dt(["managed","attached-live","history-only"]),Pb=Dt(["active","idle","attention","offline"]),Ub=Dt(["idle","running","completed"]),T3=Dt(["image","file"]),qb=Dt(["user","repo","system","admin"]),$b=Be({can_stream_live:Yt(),can_send_input:Yt(),can_interrupt:Yt(),can_approve:Yt(),can_reject:Yt(),can_show_git:Yt(),can_show_terminal:Yt()}),Hb=Be({used_tokens:nt(),total_tokens:nt(),remaining_tokens:nt(),percent_used:nt(),cached_input_tokens:nt(),output_tokens:nt(),reasoning_output_tokens:nt(),updated_at:M()}),Fb=Dt(["pending","in_progress","completed"]),Qb=Be({id:M(),step:M(),status:Fb}),Gb=Be({session_id:M(),turn_id:M().nullable(),source:Dt(["rollout","app-server"]),updated_at:M(),explanation:M().nullable().default(null),steps:vt(Qb),completed_count:nt().int().nonnegative(),total_count:nt().int().nonnegative(),is_active:Yt()}),Vb=Be({parent_session_id:M(),root_session_id:M().nullable().default(null),nickname:M().nullable().default(null),role:M().nullable().default(null),depth:nt().int().nonnegative()}),Kb=Dt(["user_input","command_execution_approval","file_change_approval","permissions_approval","mcp_elicitation"]),Yb=Dt(["pending","submitting","resolved"]),E3=Be({id:M(),label:M(),description:M().nullable().default(null),emphasis:Dt(["default","primary","danger"]).default("default")}),Zb=Be({id:M(),header:M().nullable().default(null),question:M(),options:vt(E3).default([]),allow_other:Yt().default(!1),is_secret:Yt().default(!1)}),Wb=Be({id:M(),session_id:M(),turn_id:M().nullable().default(null),item_id:M().nullable().default(null),kind:Kb,status:Yb,title:M(),description:M().nullable().default(null),created_at:M(),updated_at:M(),options:vt(E3).default([]),questions:vt(Zb).default([]),allow_freeform:Yt().default(!1),freeform_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null)}),Xb=Be({id:M(),kind:T3,name:M().nullable().default(null),mime_type:M().nullable().default(null),size_bytes:nt().int().nonnegative().nullable().default(null),content_url:M().nullable().default(null)}),x6=Be({id:M(),kind:T3,name:M(),mime_type:M().nullable().default(null),size_bytes:nt().int().nonnegative().nullable().default(null),data_url:M()}),Jb=Be({name:M(),description:M(),path:M(),scope:qb,enabled:Yt()}),e7=Dt(["supported","unsupported"]),t7=Be({name:M(),description:M(),availability:e7.default("supported")}),S6=Be({cli_version:M().nullable().default(null),loaded_at:M(),cache_ttl_ms:nt().int().nonnegative(),commands:vt(t7)});Be({id:M(),label:M(),description:M(),isDefault:Yt(),defaultReasoningEffort:M().nullable().default(null),supportedReasoningEfforts:vt(M()).default([])});const n7=Dt(["running","awaiting_input","completed","failed"]),s7=Dt(["none","choice","text"]),a7=Be({id:M(),label:M(),description:M().nullable().default(null)}),i7=Be({type:Zp("set_session_model"),model:M(),reasoning_effort:M().nullable().default(null)}).nullable().default(null),r7=Be({panel_id:M(),session_id:M(),command_name:M(),command_text:M(),title:M(),description:M().nullable().default(null),status:n7,body:M(),submitted_at:M(),updated_at:M(),input_type:s7,options:vt(a7).default([]),input_placeholder:M().nullable().default(null),submit_label:M().nullable().default(null),effect:i7}),j6=Be({panel:r7}),M3=Be({id:M(),name:M(),host:M(),tailscale_ip:M().nullable().default(null),tailscale_dns_name:M().nullable().default(null),direct_base_url:M(),ws_base_url:M(),status:Dt(["online","offline"]),provider_availability:vt(C3),project_count:nt(),session_count:nt(),transport:Dt(["direct-agent","hub-routed"]),version:M().nullable().default(null),registered_at:M().nullable().default(null),last_seen_at:M().nullable().default(null)}),R3=Be({id:M(),agent_id:M(),name:M(),display_name:M().nullable(),pinned:Yt(),path:M(),branch:M(),worktree:M(),runtime_profiles:vt(M()),preview_url:M().nullable()}),A3=Be({id:M(),agent_id:M(),project_id:M(),provider:C3,archived:Yt(),title:M(),mode:Bb,health:Pb,branch:M(),worktree:M(),summary:M(),last_event_at:M(),pinned:Yt(),run_state:Ub,run_state_changed_at:M().nullable(),context_usage:Hb.nullable().default(null),subagent:Vb.nullable().default(null),capability:$b}),D3=Be({id:M(),kind:Dt(["user","assistant","thinking","tool","system"]),title:M(),body:M(),timestamp:M(),accent:Dt(["primary","secondary","muted"]),attachments:vt(Xb).default([])}),l7=Dt(["app-server","rollout-fallback"]),o7=Dt(["running","completed"]),c7=Dt(["add","delete","update"]),u7=Be({path:M(),kind:c7,move_path:M().nullable(),additions:nt(),deletions:nt(),diff:M(),item_id:M().nullable()}),d7=Be({id:M(),session_id:M(),turn_id:M(),source:l7,status:o7,started_at:M(),completed_at:M().nullable(),updated_at:M(),aggregated_diff:M(),files:vt(u7)}),f7=Be({path:M(),status:Dt(["modified","added","deleted","renamed"]),additions:nt(),deletions:nt()}),O3=Dt(["modified","added","deleted","renamed","untracked"]),h7=Be({path:M(),previous_path:M().nullable().default(null),status:O3,additions:nt().int().nonnegative(),deletions:nt().int().nonnegative()}),m7=Be({session_id:M(),project_id:M(),path:M(),previous_path:M().nullable().default(null),additions:nt().int().nonnegative(),deletions:nt().int().nonnegative(),diff:M()}),L3=Be({session_id:M(),project_id:M(),branch:M(),branches:vt(M()),upstream_branch:M().nullable().default(null),ahead_count:nt().int().nonnegative(),behind_count:nt().int().nonnegative(),files:vt(h7),updated_at:M()}),p7=Be({path:M(),previous_path:M().nullable().default(null),status:O3}),g7=Be({oid:M(),short_oid:M(),subject:M(),author_name:M(),authored_at:M(),committed_at:M(),parent_oids:vt(M()).default([]),refs:vt(M()).default([]),files:vt(p7)}),y7=Be({session_id:M(),project_id:M(),commit_oid:M(),path:M(),previous_path:M().nullable().default(null),additions:nt().int().nonnegative(),deletions:nt().int().nonnegative(),diff:M()}),v7=Be({session_id:M(),project_id:M(),branch:M(),upstream_branch:M().nullable().default(null),head_oid:M().nullable().default(null),upstream_head_oid:M().nullable().default(null),commits:vt(g7),updated_at:M()});Dt(["discard-file","discard-all","commit-all","switch-branch","push"]);const _7=Be({ok:Zp(!0),workspace:L3}),I3=Dt(["auto","powershell","cmd","bash"]),b7=Dt(["user","codex"]),x7=Be({id:M(),name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:I3.default("auto"),node_version:M().nullable().default(null),port:nt().int().positive().nullable().default(null),source:b7.default("user"),created_at:M(),updated_at:M()}),S7=Be({name:M(),description:M().nullable().default(null),command:M(),kill_command:M().nullable().default(null),cwd:M().nullable().default(null),shell:I3.default("auto"),node_version:M().nullable().default(null),port:nt().int().positive().nullable().default(null)}),Wp=Be({session_id:M(),project_id:M(),config_path:M(),commands:vt(x7),updated_at:M()}),j7=Dt(["user","codex"]),w7=Be({id:M(),name:M(),description:M().nullable().default(null),url:M(),source:j7.default("user"),created_at:M(),updated_at:M()}),k7=Be({name:M(),description:M().nullable().default(null),url:M()}),Xp=Be({session_id:M(),project_id:M(),config_path:M(),websites:vt(w7),updated_at:M()}),N7=Dt(["queued","running","completed","failed","stopped"]),C7=Dt(["stdout","stderr","system"]),T7=Be({cursor:nt().int().nonnegative(),stream:C7,text:M(),timestamp:M()}),Jp=Be({id:M(),session_id:M(),project_id:M(),command_id:M().nullable().default(null),title:M(),command:M(),cwd:M(),status:N7,exit_code:nt().int().nullable().default(null),created_at:M(),started_at:M().nullable().default(null),completed_at:M().nullable().default(null),updated_at:M(),last_output_at:M().nullable().default(null),output_cursor:nt().int().nonnegative(),preview:M().nullable().default(null)}),z3=Be({session_id:M(),project_id:M(),active_terminal_id:M().nullable().default(null),terminals:vt(Jp),updated_at:M()}),E7=Be({session_id:M(),project_id:M(),terminal:Jp,chunks:vt(T7),next_cursor:nt().int().nonnegative(),truncated:Yt().default(!1)}),M7=Be({manager:Dt(["none","nvm-windows"]).default("none"),versions:vt(M()).default([]),error:M().nullable().default(null)}),R7=Be({command_catalog:Wp,website_catalog:Xp,node_runtime:M7,terminal_snapshot:z3}),A7=Be({catalog:Wp}),D7=Be({catalog:Xp}),O7=Be({commands:vt(S7),reason:M().nullable().default(null)}),L7=Be({generation:O7,catalog:Wp}),I7=Be({websites:vt(k7),reason:M().nullable().default(null)}),z7=Be({generation:I7,catalog:Xp}),B7=Be({snapshot:z3,terminal:Jp.nullable().default(null)}),P7=Be({id:M(),name:M(),command:M(),port:nt().nullable(),status:Dt(["running","stopped","degraded"]),log_excerpt:M()}),U7=Be({id:M(),label:M(),url:M(),status:Dt(["ready","starting","stopped"])}),q7=Be({path:M(),name:M(),has_children:Yt()}),$7=Be({id:M(),title:M(),description:M(),status:Dt(["pending","approved","rejected"])}),H7=Be({generated_at:M(),agents:vt(M3),projects:vt(R3),sessions:vt(A3),active_session_id:M(),timeline:vt(D3),changed_files:vt(f7),runtime_processes:vt(P7),previews:vt(U7),approvals:vt($7)});Be({agent:M3,projects:vt(R3),sessions:vt(A3),active_session_id:M().default(""),generated_at:M()});const w6=Be({ok:Zp(!0),agent_id:M(),heartbeat_interval_ms:nt().int().positive(),heartbeat_timeout_ms:nt().int().positive(),registered_at:M(),received_at:M()}),F7=Be({type:Dt(["agent.online","snapshot.changed","session.updated","timeline.delta","timeline.reset","interaction.delta","interaction.reset","plan.delta","plan.reset","changeset.delta","changeset.reset","terminal.snapshot","terminal.delta","turn.delta","turn.completed","approval.requested"]),timestamp:M(),payload:Qf(zb())}),Q7=Be({width:nt().nonnegative(),height:nt().nonnegative(),device_pixel_ratio:nt().nonnegative(),visual_width:nt().nonnegative().nullable().default(null),visual_height:nt().nonnegative().nullable().default(null),screen_width:nt().nonnegative().nullable().default(null),screen_height:nt().nonnegative().nullable().default(null)}),G7=Be({user_agent:M(),language:M().nullable().default(null),languages:vt(M()).default([]),platform:M().nullable().default(null),vendor:M().nullable().default(null),online:Yt().nullable().default(null),cookie_enabled:Yt().nullable().default(null),secure_context:Yt(),standalone_display_mode:Yt(),hardware_concurrency:nt().int().nonnegative().nullable().default(null),device_memory_gb:nt().nonnegative().nullable().default(null),max_touch_points:nt().int().nonnegative().nullable().default(null)}),V7=Be({href:M(),pathname:M(),referrer:M().nullable().default(null),visibility_state:M().nullable().default(null)}),K7=Be({scope:M(),active_script_url:M().nullable().default(null),waiting_script_url:M().nullable().default(null),installing_script_url:M().nullable().default(null)}),Y7=Be({supported:Yt(),controller:Yt(),registrations:vt(K7).default([])}),Z7=Be({supported:Yt(),keys:vt(M()).default([])}),W7=Be({href:M().nullable().default(null),rel:M().nullable().default(null)}),X7=Be({href:M().nullable().default(null),owner_node:M().nullable().default(null),media:M().nullable().default(null),disabled:Yt(),css_rule_count:nt().int().nonnegative().nullable().default(null)}),J7=Be({url:M(),kind:Dt(["stylesheet","script","manifest","icon","other"]),ok:Yt(),status:nt().int().nonnegative().nullable().default(null),content_type:M().nullable().default(null),cache_control:M().nullable().default(null),error:M().nullable().default(null)}),ex=Be({name:M(),initiator_type:M().nullable().default(null),duration_ms:nt().nonnegative().nullable().default(null),transfer_size:nt().nonnegative().nullable().default(null),decoded_body_size:nt().nonnegative().nullable().default(null)}),tx=Be({x:nt(),y:nt(),width:nt().nonnegative(),height:nt().nonnegative()}),nx=Be({selector:M(),found:Yt(),text_preview:M().nullable().default(null),rect:tx.nullable().default(null),computed:Qf(M()).default({})});Be({captured_at:M(),page:V7,environment:G7,viewport:Q7,feature_support:Qf(Yt()).default({}),service_worker:Y7,cache:Z7,manifest:W7,stylesheets:vt(X7).default([]),resource_probes:vt(J7).default([]),performance_entries:vt(ex).default([]),theme_variables:Qf(M()).default({}),element_snapshots:vt(nx).default([]),notes:vt(M()).default([])});const sx=/^(?:image|img|photo|picture|screenshot|图片|照片|截图)(?:[-_ ]?\d+)?\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/i,Xn=n=>(n==null?void 0:n.trim())??"",k6="\0",N6=n=>{const t=Xn(n);return t?sx.test(t)?1:2+Math.min(t.length,64)/100:0},ax=(n,t)=>{const a=N6(n),r=N6(t);if(r>a)return Xn(t)||null;if(a>r)return Xn(n)||null;const c=Xn(n),u=Xn(t);return u.length>c.length?u||null:c||null},ix=n=>{const t=Xn(n.content_url);return t?[n.kind,"content",t].join(k6):[n.kind,"meta",Xn(n.mime_type).toLowerCase(),typeof n.size_bytes=="number"&&Number.isFinite(n.size_bytes)?String(Math.max(0,Math.round(n.size_bytes))):"",Xn(n.name).toLowerCase()].join(k6)},rx=(n,t)=>{const a=Xn(n.name),r=Xn(t.name),c=Xn(n.mime_type),u=Xn(t.mime_type);return{id:n.id||t.id,kind:n.kind==="image"||t.kind==="image"?"image":n.kind,name:ax(a,r),mime_type:c||u||null,size_bytes:n.size_bytes??t.size_bytes??null,content_url:Xn(n.content_url)||Xn(t.content_url)||null}},B3=n=>{if(!n||n.length===0)return[];const t=[],a=new Map;for(const r of n){const c=ix(r),u=a.get(c);if(u===void 0){a.set(c,t.length),t.push({...r,name:Xn(r.name)||null,mime_type:Xn(r.mime_type)||null,size_bytes:typeof r.size_bytes=="number"&&Number.isFinite(r.size_bytes)?Math.max(0,Math.round(r.size_bytes)):null,content_url:Xn(r.content_url)||null});continue}t[u]=rx(t[u],r)}return t},P3=(n,t)=>B3([...n??[],...t??[]]),Ns=n=>new Date(n).toISOString(),lx=()=>({generated_at:new Date().toISOString(),active_session_id:"session-managed-1",agents:[{id:"agent-shanghai-main",name:"studio-main",host:"100.88.10.14",tailscale_ip:"100.88.10.14",tailscale_dns_name:"studio-main.tail-scale.ts.net",direct_base_url:"http://100.88.10.14:4242",ws_base_url:"ws://100.88.10.14:4242/ws",status:"online",provider_availability:["codex"],project_count:2,session_count:2,transport:"direct-agent",version:"0.1.0",registered_at:Ns("2026-03-18T10:30:00+08:00"),last_seen_at:Ns("2026-03-18T10:58:00+08:00")},{id:"agent-macbook",name:"macbook-air",host:"100.89.20.77",tailscale_ip:"100.89.20.77",tailscale_dns_name:"macbook-air.tail-scale.ts.net",direct_base_url:"http://100.89.20.77:4242",ws_base_url:"ws://100.89.20.77:4242/ws",status:"online",provider_availability:["codex"],project_count:1,session_count:1,transport:"hub-routed",version:"0.1.0",registered_at:Ns("2026-03-18T10:20:00+08:00"),last_seen_at:Ns("2026-03-18T10:55:00+08:00")}],projects:[{id:"project-panda",agent_id:"agent-shanghai-main",name:"panda",display_name:null,pinned:!1,path:"D:/ai/panda",branch:"main",worktree:"default",runtime_profiles:["dev","storybook","test"],preview_url:"https://panda.tailnet.ts.net"},{id:"project-remodex-lab",agent_id:"agent-shanghai-main",name:"remodex",display_name:null,pinned:!1,path:"D:/ai/remodex",branch:"phase1-ui",worktree:"mobile-lab",runtime_profiles:["dev"],preview_url:null},{id:"project-notes",agent_id:"agent-macbook",name:"notes",display_name:null,pinned:!1,path:"D:/Users/dev/notes",branch:"research",worktree:"default",runtime_profiles:["dev"],preview_url:null}],sessions:[{id:"session-managed-1",agent_id:"agent-shanghai-main",project_id:"project-panda",provider:"codex",archived:!1,title:"Stage 1 buildout",mode:"managed",health:"active",branch:"main",worktree:"default",summary:"Monorepo scaffold, PWA shell, agent bootstrap API",last_event_at:Ns("2026-03-18T10:58:00+08:00"),pinned:!1,run_state:"running",run_state_changed_at:Ns("2026-03-18T10:57:20+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!0,can_interrupt:!0,can_approve:!0,can_reject:!0,can_show_git:!0,can_show_terminal:!0}},{id:"session-live-2",agent_id:"agent-shanghai-main",project_id:"project-remodex-lab",provider:"codex",archived:!1,title:"Remote attach",mode:"attached-live",health:"idle",branch:"phase1-ui",worktree:"mobile-lab",summary:"",last_event_at:Ns("2026-03-18T10:48:00+08:00"),pinned:!1,run_state:"completed",run_state_changed_at:Ns("2026-03-18T10:48:00+08:00"),context_usage:null,subagent:null,capability:{can_stream_live:!0,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!0}},{id:"session-history-3",agent_id:"agent-macbook",project_id:"project-notes",provider:"codex",archived:!1,title:"Research notes",mode:"history-only",health:"offline",branch:"research",worktree:"default",summary:"",last_event_at:Ns("2026-03-17T19:12:00+08:00"),pinned:!1,run_state:"idle",run_state_changed_at:null,context_usage:null,subagent:null,capability:{can_stream_live:!1,can_send_input:!1,can_interrupt:!1,can_approve:!1,can_reject:!1,can_show_git:!0,can_show_terminal:!1}}],timeline:[{id:"entry-1",kind:"system",title:"Session ready",body:"Managed session attached.",timestamp:Ns("2026-03-18T10:40:00+08:00"),accent:"muted",attachments:[]},{id:"entry-2",kind:"user",title:"Prompt",body:"Start stage one.",timestamp:Ns("2026-03-18T10:44:00+08:00"),accent:"primary",attachments:[]},{id:"entry-3",kind:"thinking",title:"Plan",body:"Aligning routes and session state.",timestamp:Ns("2026-03-18T10:45:30+08:00"),accent:"secondary",attachments:[]},{id:"entry-4",kind:"tool",title:"Tool activity",body:"Scanned docs/, checked runtime versions, and created the initial workspace directories.",timestamp:Ns("2026-03-18T10:48:00+08:00"),accent:"secondary",attachments:[]},{id:"entry-5",kind:"assistant",title:"Focus",body:"Wiring the shell.",timestamp:Ns("2026-03-18T10:58:00+08:00"),accent:"primary",attachments:[]}],changed_files:[{path:"apps/web/src/components/dashboard.tsx",status:"added",additions:248,deletions:0},{path:"packages/protocol/src/index.ts",status:"modified",additions:94,deletions:12},{path:"apps/agent/src/index.ts",status:"modified",additions:77,deletions:3}],runtime_processes:[{id:"runtime-dev",name:"dev",command:"pnpm --filter @panda/web dev --host 0.0.0.0 --port 4173",port:4173,status:"running",log_excerpt:"Vite server ready on 0.0.0.0:4173 and previewed over the tailnet."},{id:"runtime-agent",name:"agent",command:"pnpm --filter @panda/agent dev",port:4242,status:"running",log_excerpt:"Fastify listening on http://0.0.0.0:4242 with WebSocket events enabled."}],previews:[{id:"preview-main",label:"PWA preview",url:"https://panda.tailnet.ts.net",status:"ready"},{id:"preview-storybook",label:"Design lab",url:"https://storybook.tailnet.ts.net",status:"starting"}],approvals:[{id:"approval-1",title:"Write workspace files",description:"Create monorepo config, React app shell, and Fastify agent entrypoints.",status:"approved"},{id:"approval-2",title:"Attach external Codex session",description:"External session controls remain experimental until app-server transport is available.",status:"pending"}]}),ox=()=>lx(),cx=()=>ox(),U3=n=>{const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/ws",t.toString()};class ux{constructor(t,a=U3(t)){this.baseUrl=t,this.wsBaseUrl=a}async readJson(t,a){const r=await fetch(t);if(!r.ok)throw new Error(`Request failed with ${r.status}`);return a.parse(await r.json())}async postJson(t,a,r){const c=await fetch(new URL(t,this.baseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),u=await c.json().catch(()=>null);if(!c.ok)throw new Error((u==null?void 0:u.error)??`Request failed with ${c.status}`);return r?r.parse(u):u}async getPhaseOneSnapshot(t){const{fallbackToMock:a=!0,fallbackSnapshot:r=cx}=t??{};try{const c=await fetch(new URL("/api/bootstrap",this.baseUrl));if(!c.ok)throw new Error(`Bootstrap request failed with ${c.status}`);const u=await c.json();return H7.parse(u)}catch(c){if(!a)throw c;return r()}}async getSessionTimeline(t){return await this.readJson(new URL(`/api/sessions/${t}/timeline`,this.baseUrl),{parse:r=>Array.isArray(r)?r.map(c=>D3.parse(c)):[]})}async getSessionChangeSets(t){return this.readJson(new URL(`/api/sessions/${t}/change-sets`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>d7.parse(r)):[]})}async getSessionGitWorkspace(t){return this.readJson(new URL(`/api/sessions/${t}/git-workspace`,this.baseUrl),L3)}async getSessionGitWorkspaceFileDiff(t,a){const r=new URL(`/api/sessions/${t}/git-workspace/file-diff`,this.baseUrl);return r.searchParams.set("path",a.path),a.previousPath&&r.searchParams.set("previousPath",a.previousPath),this.readJson(r,m7)}async getSessionGitHistory(t){return this.readJson(new URL(`/api/sessions/${t}/git/history`,this.baseUrl),v7)}async getSessionGitHistoryFileDiff(t,a){const r=new URL(`/api/sessions/${t}/git/history/file-diff`,this.baseUrl);return r.searchParams.set("commitOid",a.commitOid),r.searchParams.set("path",a.path),a.previousPath&&r.searchParams.set("previousPath",a.previousPath),this.readJson(r,y7)}async getSessionRunWorkbench(t){return this.readJson(new URL(`/api/sessions/${t}/run-workbench`,this.baseUrl),R7)}async saveSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands`,{action:t.action,commandId:t.commandId??null,command:t.command??null},A7)}async generateSessionRunCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/run-commands/generate`,{prompt:t.prompt,model:t.model},L7)}async saveSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites`,{action:t.action,websiteId:t.websiteId??null,website:t.website??null},D7)}async generateSessionRunWebsite(t){return this.postJson(`/api/sessions/${t.sessionId}/run-websites/generate`,{prompt:t.prompt,model:t.model},z7)}async executeSessionTerminalAction(t){return this.postJson(`/api/sessions/${t.sessionId}/terminals`,{action:t.action,commandId:t.commandId??null,terminalId:t.terminalId??null},B7)}async getSessionTerminalOutput(t){const a=new URL(`/api/sessions/${t.sessionId}/terminals/${t.terminalId}/output`,this.baseUrl);return typeof t.cursor=="number"&&Number.isFinite(t.cursor)&&a.searchParams.set("cursor",String(Math.max(0,Math.floor(t.cursor)))),this.readJson(a,E7)}async getSessionPlan(t){return this.readJson(new URL(`/api/sessions/${t}/plan`,this.baseUrl),{parse:a=>a==null?null:Gb.parse(a)})}async getSessionInteractions(t){return this.readJson(new URL(`/api/sessions/${t}/interactions`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>Wb.parse(r)):[]})}async getProjectSkills(t){return this.readJson(new URL(`/api/projects/${t}/skills`,this.baseUrl),{parse:a=>Array.isArray(a)?a.map(r=>Jb.parse(r)):[]})}async getCodexCommands(){return this.readJson(new URL("/api/codex/commands",this.baseUrl),S6)}async refreshCodexCommands(){return this.postJson("/api/codex/commands/refresh",{},S6)}async listDirectories(t){const a=new URL("/api/directories",this.baseUrl);return t.agentId&&a.searchParams.set("agentId",t.agentId),t.path&&a.searchParams.set("path",t.path),this.readJson(a,{parse:r=>Array.isArray(r)?r.map(c=>q7.parse(c)):[]})}async createProject(t){return this.postJson("/api/projects",t)}async createSession(t){var a;return this.postJson("/api/sessions",{...t,attachments:(a=t.attachments)==null?void 0:a.map(r=>x6.parse(r)),serviceTier:t.serviceTier,planMode:t.planMode})}async updateSession(t){return this.postJson(`/api/sessions/${t.sessionId}/actions`,{action:t.action,name:t.name})}async updateThread(t){return this.postJson(`/api/threads/${t.projectId}/actions`,{action:t.action,name:t.name,orderedProjectIds:t.orderedProjectIds})}async sendSessionInput(t){var a;return this.postJson(`/api/sessions/${t.sessionId}/input`,{input:t.input,attachments:(a=t.attachments)==null?void 0:a.map(r=>x6.parse(r)),model:t.model,reasoningEffort:t.reasoningEffort,serviceTier:t.serviceTier,planMode:t.planMode})}async executeSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/execute`,{input:t.input},j6)}async respondToSessionCommand(t){return this.postJson(`/api/sessions/${t.sessionId}/commands/respond`,{panelId:t.panelId,optionId:t.optionId??null,text:t.text??null},j6)}async respondToSessionInteraction(t){return this.postJson(`/api/sessions/${t.sessionId}/interactions/${t.requestId}/respond`,{optionId:t.optionId??null,text:t.text??null,answers:t.answers??null})}async interruptSession(t){return this.postJson(`/api/sessions/${t}/interrupt`,{})}async registerAgent(t){return this.postJson("/api/agents/register",t,w6)}async heartbeatAgent(t){return this.postJson("/api/agents/heartbeat",t,w6)}async executeSessionGitAction(t){return this.postJson(`/api/sessions/${t.sessionId}/git/actions`,{action:t.action,path:t.path,branch:t.branch,message:t.message},_7)}connectEvents(t,a){let u=null,h="",p=!1,y=0,m=null,b=!1;const g=()=>{m!==null&&(globalThis.clearTimeout(m),m=null)},x=(T,C)=>{var I;(I=a==null?void 0:a.onStatus)==null||I.call(a,{state:T,attempt:y,maxAttempts:5,error:C})},w=T=>{if(!p&&!b){if(y+=1,y>5){y=5,x("failed",T);return}b=!0,x("reconnecting",T),g(),m=globalThis.setTimeout(()=>{b=!1,N()},1200)}},N=()=>{g(),b=!1,u=new WebSocket(this.wsBaseUrl),u.addEventListener("open",()=>{var C;b=!1,y=0,x("connected");const T=(C=a==null?void 0:a.sessionId)==null?void 0:C.trim();T&&(h=T,u==null||u.send(JSON.stringify({type:"session.subscribe",sessionId:T})))}),u.addEventListener("message",T=>{const C=F7.safeParse(JSON.parse(T.data));C.success&&t(C.data)}),u.addEventListener("error",()=>{if(p)return;const T=`无法连接到 ${this.wsBaseUrl}`;(u==null?void 0:u.readyState)!==WebSocket.OPEN&&w(T)}),u.addEventListener("close",T=>{var I;if(p)return;const C=((I=T.reason)==null?void 0:I.trim())||`WebSocket 已断开(code ${T.code||"unknown"})`;w(C)})};return N(),()=>{p=!0,b=!1,g(),h&&(u==null?void 0:u.readyState)===WebSocket.OPEN&&u.send(JSON.stringify({type:"session.unsubscribe",sessionId:h})),u==null||u.close()}}}const pp=(n,t)=>new ux(n,(t==null?void 0:t.wsBaseUrl)??U3(n)),dx=new Set(["4173","4174"]),fx=()=>typeof window>"u"?null:window.location.origin||null,q3=n=>{if(typeof window>"u")return`http://localhost:${n}`;const t=window.location.protocol==="https:"?"https:":"http:",a=window.location.hostname||"localhost";return`${t}//${a}:${n}`},hx=()=>{const n=fx();if(!n)return"http://localhost:4343";const t=window.location.port.trim();return dx.has(t)?q3(4343):n},$3=q3(4242),nh=hx(),H3={direct:pp($3),hub:pp(nh)},mx={direct:"Agent 直连",hub:"Hub 聚合"},px=1e4,gx=1e4,yx=1e4,vx=1e4;let k1=null,C6=0,iu=null,N1=null,T6=0,ru=null;const E6=new Map,C1=new Map,T1=new Map,wi=n=>(n==null?void 0:n.trim())??"",e0=async n=>{const t=n.trim();if(!t)return!1;const a=T1.get(t),r=Date.now();if(a&&r-a.checkedAt<vx)return a.reachable;const c=new AbortController,u=globalThis.setTimeout(()=>c.abort(),1200);try{const p=(await fetch(`${t}/health`,{signal:c.signal})).ok;return T1.set(t,{reachable:p,checkedAt:Date.now()}),p}catch{return T1.set(t,{reachable:!1,checkedAt:Date.now()}),!1}finally{clearTimeout(u)}},M6=n=>({mode:n,label:mx[n],baseUrl:n==="hub"?nh:$3,client:H3[n]}),F3=n=>n.direct_base_url.trim(),_x=n=>n.ws_base_url.trim(),R6=n=>{const t=F3(n)||n.tailscale_dns_name||n.tailscale_ip||n.host;return`无法直连节点 ${n.name}(${t})。请确认当前浏览器已加入 Tailscale 网络,且目标 agent 在线。`},bx=n=>{const t=F3(n),a=_x(n);return{mode:"direct",label:`Agent 直连 · ${n.name}`,baseUrl:t,client:pp(t,{wsBaseUrl:a||void 0})}},xx=(n,t)=>{const a=wi(t.agentId);if(a)return n.agents.find(u=>u.id===a)??null;const r=wi(t.sessionId);if(r){const u=n.sessions.find(h=>h.id===r);return u?n.agents.find(h=>h.id===u.agent_id)??null:null}const c=wi(t.projectId);if(c){const u=n.projects.find(h=>h.id===c);return u?n.agents.find(h=>h.id===u.agent_id)??null:null}return null},Sx=n=>{const t=wi(n.sessionId),a=wi(n.projectId),r=wi(n.agentId);return t?`session:${t}`:a?`project:${a}`:r?`agent:${r}`:""},jx=async()=>{const n=Date.now();if(N1&&n-T6<yx)return N1;if(ru)return ru;ru=(async()=>{if(!await e0(nh))return null;const t=await H3.hub.getPhaseOneSnapshot({fallbackToMock:!1});return N1=t,T6=Date.now(),t})().catch(()=>null);try{return await ru}finally{ru=null}},wx=async()=>{const n=Date.now();if(k1&&n-C6<px)return k1;if(iu)return iu;iu=(async()=>{const t=await e0(nh)?M6("hub"):M6("direct");return k1=t,C6=Date.now(),t})();try{return await iu}finally{iu=null}},kx=async n=>{const t=Sx(n),a=Date.now(),r=t?E6.get(t):null;if(r&&a-r.cachedAt<gx)return r.target;const c=t?C1.get(t):null;if(c)return c;const u=(async()=>{const h=await jx(),p=h?xx(h,n):null;if(!h||!p)throw new Error("Hub 未返回目标节点信息,无法建立直连。");const y=bx(p);if(!y.baseUrl)throw new Error(R6(p));if(await e0(y.baseUrl))return y;throw new Error(R6(p))})();t&&C1.set(t,u);try{const h=await u;return t&&E6.set(t,{target:h,cachedAt:Date.now()}),h}finally{t&&C1.delete(t)}},Jn=async n=>!(wi(n==null?void 0:n.sessionId)||wi(n==null?void 0:n.projectId)||wi(n==null?void 0:n.agentId))?wx():kx(n??{}),Q3="panda:notification-settings",G3="panda:notified-completions",E1={completionNotificationsEnabled:!1},V3=n=>({completionNotificationsEnabled:(n==null?void 0:n.completionNotificationsEnabled)===!0}),K3=()=>{if(typeof window>"u")return{};try{const n=window.localStorage.getItem(G3);if(!n)return{};const t=JSON.parse(n);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(a=>typeof a[0]=="string"&&typeof a[1]=="string"))}catch{return{}}},Nx=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(G3,JSON.stringify(n))}catch{}},gp=()=>{if(typeof window>"u")return E1;try{const n=window.localStorage.getItem(Q3);return n?V3(JSON.parse(n)):E1}catch{return E1}},A6=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Q3,JSON.stringify(V3(n)))}catch{}},t0=()=>typeof window>"u"?!1:window.isSecureContext&&"Notification"in window&&"serviceWorker"in navigator,yp=()=>t0()?Notification.permission:"unsupported",Cx=async()=>t0()?Notification.requestPermission():"unsupported",M1=()=>{if(typeof window>"u")return!1;const n=navigator;return window.matchMedia("(display-mode: standalone)").matches||n.standalone===!0},D6=()=>typeof navigator>"u"?!1:/Android/i.test(navigator.userAgent),Tx=(n,t)=>K3()[n]===t,O6=(n,t)=>{const a=K3();a[n]!==t&&Nx({...a,[n]:t})},Ex=async n=>{if(typeof window>"u"||!t0())return!1;const t={body:n.body,tag:`session-completed:${n.sessionId}:${n.completedAt}`,icon:"/pwa-512.png",badge:"/pwa-192.png",data:{sessionId:n.sessionId,url:n.url,completedAt:n.completedAt}};try{return await(await navigator.serviceWorker.ready).showNotification(n.title,t),!0}catch{try{const a=new Notification(n.title,t);return a.onclick=()=>{window.focus(),window.location.assign(n.url)},!0}catch{return!1}}},Gf="panda:last-agent-id",Vf="panda:last-session-id",Cu="panda:pending-session-id",Tu="panda:pending-project-id",Eu="panda:pending-directory-picker",Mx=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(Gf)}catch{return null}},xr=n=>{if(!(typeof window>"u"))try{if(n){window.localStorage.setItem(Gf,n);return}window.localStorage.removeItem(Gf)}catch{}},Mu=()=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(Vf)}catch{return null}},fs=n=>{if(!(typeof window>"u"))try{if(n){window.localStorage.setItem(Vf,n);return}window.localStorage.removeItem(Vf)}catch{}},Ru=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Cu,n);return}window.sessionStorage.removeItem(Cu)}catch{}},Rx=()=>{if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(Cu);return n&&window.sessionStorage.removeItem(Cu),n}catch{return null}},Eo=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Tu,n);return}window.sessionStorage.removeItem(Tu)}catch{}},Ax=()=>{if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(Tu);return n&&window.sessionStorage.removeItem(Tu),n}catch{return null}},lu=n=>{if(!(typeof window>"u"))try{if(n){window.sessionStorage.setItem(Eu,"1");return}window.sessionStorage.removeItem(Eu)}catch{}},Dx=()=>{if(typeof window>"u")return!1;try{const n=window.sessionStorage.getItem(Eu);return n&&window.sessionStorage.removeItem(Eu),n==="1"}catch{return!1}},Ox=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Gf),window.localStorage.removeItem(Vf),window.sessionStorage.removeItem(Cu),window.sessionStorage.removeItem(Tu),window.sessionStorage.removeItem(Eu)}catch{}},Lx=n=>typeof document>"u"?!1:document.visibilityState==="visible"&&Mu()===n,Ix=n=>{if(!n)return null;const t=typeof n.sessionId=="string"?n.sessionId:null,a=n.sessionPatch&&typeof n.sessionPatch=="object"?n.sessionPatch:null;if(!t||!a)return null;const r=typeof a.run_state=="string"?a.run_state:null,c=typeof a.run_state_changed_at=="string"?a.run_state_changed_at:null;return r!=="completed"||!c?null:{sessionId:t,completedAt:c}},zx=({snapshot:n})=>{const t=_.useRef(n);return _.useEffect(()=>{t.current=n},[n]),_.useEffect(()=>{let a=!1,r;return Jn().then(c=>{a||(r=c.client.connectEvents(u=>{var w,N;if(u.type!=="session.updated")return;const h=Ix(u.payload);if(!h||!gp().completionNotificationsEnabled||yp()!=="granted"||Tx(h.sessionId,h.completedAt))return;if(Lx(h.sessionId)){O6(h.sessionId,h.completedAt);return}const y=((w=t.current)==null?void 0:w.sessions.find(T=>T.id===h.sessionId))??null,b=`${((N=y==null?void 0:y.title)==null?void 0:N.trim())||"当前会话"} 已完成`,g="最终回复已经生成,点开即可继续查看。",x=`/session/${h.sessionId}`;Ex({sessionId:h.sessionId,completedAt:h.completedAt,title:b,body:g,url:x}).then(T=>{T&&O6(h.sessionId,h.completedAt)})}))}),()=>{a=!0,r==null||r()}},[]),null},Bx=JSON.parse('[{"id":"absolutely","light":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2d2d2b","opaqueWindows":true,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#f9f9f7"},"variant":"light"},"dark":{"codeThemeId":"absolutely","theme":{"accent":"#cc7d5e","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f9f9f7","opaqueWindows":false,"semanticColors":{"diffAdded":"#00c853","diffRemoved":"#ff5f38","skill":"#cc7d5e"},"surface":"#2d2d2b"},"variant":"dark"}},{"id":"ayu","dark":{"codeThemeId":"ayu","theme":{"accent":"#e6b450","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#bfbdb6","opaqueWindows":false,"semanticColors":{"diffAdded":"#7fd962","diffRemoved":"#ea6c73","skill":"#cda1fa"},"surface":"#0b0e14"},"variant":"dark"}},{"id":"catppuccin","light":{"codeThemeId":"catppuccin","theme":{"accent":"#8839ef","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#4c4f69","opaqueWindows":true,"semanticColors":{"diffAdded":"#40a02b","diffRemoved":"#d20f39","skill":"#8839ef"},"surface":"#eff1f5"},"variant":"light"},"dark":{"codeThemeId":"catppuccin","theme":{"accent":"#cba6f7","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#cdd6f4","opaqueWindows":false,"semanticColors":{"diffAdded":"#a6e3a1","diffRemoved":"#f38ba8","skill":"#cba6f7"},"surface":"#1e1e2e"},"variant":"dark"}},{"id":"codex","light":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#0d0d0d","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#751ed9"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"codex","theme":{"accent":"#0169cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#fcfcfc","opaqueWindows":false,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#e02e2a","skill":"#b06dff"},"surface":"#111111"},"variant":"dark"}},{"id":"dracula","dark":{"codeThemeId":"dracula","theme":{"accent":"#ff79c6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#f8f8f2","opaqueWindows":false,"semanticColors":{"diffAdded":"#50fa7b","diffRemoved":"#ff5555","skill":"#ff79c6"},"surface":"#282a36"},"variant":"dark"}},{"id":"everforest","light":{"codeThemeId":"everforest","theme":{"accent":"#93b259","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#5c6a72","opaqueWindows":true,"semanticColors":{"diffAdded":"#8da101","diffRemoved":"#f85552","skill":"#df69ba"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"everforest","theme":{"accent":"#a7c080","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d3c6aa","opaqueWindows":false,"semanticColors":{"diffAdded":"#a7c080","diffRemoved":"#e67e80","skill":"#d699b6"},"surface":"#2d353b"},"variant":"dark"}},{"id":"github","light":{"codeThemeId":"github","theme":{"accent":"#0969da","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#1f2328","opaqueWindows":true,"semanticColors":{"diffAdded":"#1a7f37","diffRemoved":"#cf222e","skill":"#8250df"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"github","theme":{"accent":"#1f6feb","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6edf3","opaqueWindows":false,"semanticColors":{"diffAdded":"#3fb950","diffRemoved":"#f85149","skill":"#bc8cff"},"surface":"#0d1117"},"variant":"dark"}},{"id":"gruvbox","light":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#3c3836","opaqueWindows":true,"semanticColors":{"diffAdded":"#3c3836","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#fbf1c7"},"variant":"light"},"dark":{"codeThemeId":"gruvbox","theme":{"accent":"#458588","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#ebdbb2","opaqueWindows":false,"semanticColors":{"diffAdded":"#ebdbb2","diffRemoved":"#cc241d","skill":"#b16286"},"surface":"#282828"},"variant":"dark"}},{"id":"linear","light":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":45,"fonts":{"code":null,"ui":"Inter"},"ink":"#2a3140","opaqueWindows":true,"semanticColors":{"diffAdded":"#00a240","diffRemoved":"#ba2623","skill":"#8160d8"},"surface":"#f7f8fa"},"variant":"light"},"dark":{"codeThemeId":"linear","theme":{"accent":"#5e6ad2","contrast":60,"fonts":{"code":null,"ui":"Inter"},"ink":"#e6e9ef","opaqueWindows":true,"semanticColors":{"diffAdded":"#7ad9c0","diffRemoved":"#fa423e","skill":"#c2a1ff"},"surface":"#17181d"},"variant":"dark"}},{"id":"lobster","dark":{"codeThemeId":"lobster","theme":{"accent":"#ff5c5c","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#e4e4e7","opaqueWindows":true,"semanticColors":{"diffAdded":"#22c55e","diffRemoved":"#ff5c5c","skill":"#3b82f6"},"surface":"#111827"},"variant":"dark"}},{"id":"material","dark":{"codeThemeId":"material","theme":{"accent":"#80cbc4","contrast":60,"fonts":{"code":null,"ui":"Satoshi"},"ink":"#eeffff","opaqueWindows":true,"semanticColors":{"diffAdded":"#c3e88d","diffRemoved":"#f07178","skill":"#c792ea"},"surface":"#212121"},"variant":"dark"}},{"id":"matrix","dark":{"codeThemeId":"matrix","theme":{"accent":"#1eff5a","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#b8ffca","opaqueWindows":true,"semanticColors":{"diffAdded":"#1eff5a","diffRemoved":"#fa423e","skill":"#1eff5a"},"surface":"#040805"},"variant":"dark"}},{"id":"monokai","dark":{"codeThemeId":"monokai","theme":{"accent":"#99947c","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#f8f8f2","opaqueWindows":true,"semanticColors":{"diffAdded":"#86b42b","diffRemoved":"#c4265e","skill":"#8c6bc8"},"surface":"#272822"},"variant":"dark"}},{"id":"night-owl","dark":{"codeThemeId":"night-owl","theme":{"accent":"#44596b","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d6deeb","opaqueWindows":true,"semanticColors":{"diffAdded":"#c5e478","diffRemoved":"#ef5350","skill":"#c792ea"},"surface":"#011627"},"variant":"dark"}},{"id":"nord","dark":{"codeThemeId":"nord","theme":{"accent":"#88c0d0","contrast":60,"fonts":{"code":null,"ui":"ui-monospace, \\"SFMono-Regular\\", \\"SF Mono\\", Menlo, Consolas, \\"Liberation Mono\\", monospace"},"ink":"#d8dee9","opaqueWindows":true,"semanticColors":{"diffAdded":"#a3be8c","diffRemoved":"#bf616a","skill":"#b48ead"},"surface":"#2e3440"},"variant":"dark"}},{"id":"notion","light":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#37352f","opaqueWindows":true,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#a31515","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"notion","theme":{"accent":"#3183d8","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d9d9d8","opaqueWindows":true,"semanticColors":{"diffAdded":"#4ec9b0","diffRemoved":"#fa423e","skill":"#3183d8"},"surface":"#191919"},"variant":"dark"}},{"id":"one","light":{"codeThemeId":"one","theme":{"accent":"#526fff","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#383a42","opaqueWindows":true,"semanticColors":{"diffAdded":"#3bba54","diffRemoved":"#e45649","skill":"#526fff"},"surface":"#fafafa"},"variant":"light"},"dark":{"codeThemeId":"one","theme":{"accent":"#4d78cc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#abb2bf","opaqueWindows":true,"semanticColors":{"diffAdded":"#8cc265","diffRemoved":"#e05561","skill":"#c162de"},"surface":"#282c34"},"variant":"dark"}},{"id":"oscurange","dark":{"codeThemeId":"oscurange","theme":{"accent":"#f9b98c","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6e6e6","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#479ffa"},"surface":"#0b0b0f"},"variant":"dark"}},{"id":"proof","light":{"codeThemeId":"proof","theme":{"accent":"#3d755d","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#2f312d","opaqueWindows":false,"semanticColors":{"diffAdded":"#3d755d","diffRemoved":"#ba2623","skill":"#5f6ac2"},"surface":"#f5f3ed"},"variant":"light"}},{"id":"rose-pine","light":{"codeThemeId":"rose-pine","theme":{"accent":"#d7827e","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#575279","opaqueWindows":false,"semanticColors":{"diffAdded":"#56949f","diffRemoved":"#797593","skill":"#907aa9"},"surface":"#faf4ed"},"variant":"light"},"dark":{"codeThemeId":"rose-pine","theme":{"accent":"#ea9a97","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e0def4","opaqueWindows":true,"semanticColors":{"diffAdded":"#9ccfd8","diffRemoved":"#908caa","skill":"#c4a7e7"},"surface":"#232136"},"variant":"dark"}},{"id":"sentry","dark":{"codeThemeId":"sentry","theme":{"accent":"#7055f6","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#e6dff9","opaqueWindows":true,"semanticColors":{"diffAdded":"#8ee6d7","diffRemoved":"#fa423e","skill":"#7055f6"},"surface":"#2d2935"},"variant":"dark"}},{"id":"solarized","light":{"codeThemeId":"solarized","theme":{"accent":"#b58900","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#657b83","opaqueWindows":false,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#fdf6e3"},"variant":"light"},"dark":{"codeThemeId":"solarized","theme":{"accent":"#d30102","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#839496","opaqueWindows":true,"semanticColors":{"diffAdded":"#859900","diffRemoved":"#dc322f","skill":"#d33682"},"surface":"#002b36"},"variant":"dark"}},{"id":"temple","dark":{"codeThemeId":"temple","theme":{"accent":"#e4f222","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#c7e6da","opaqueWindows":true,"semanticColors":{"diffAdded":"#40c977","diffRemoved":"#fa423e","skill":"#e4f222"},"surface":"#02120c"},"variant":"dark"}},{"id":"tokyo-night","dark":{"codeThemeId":"tokyo-night","theme":{"accent":"#3d59a1","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#a9b1d6","opaqueWindows":true,"semanticColors":{"diffAdded":"#449dab","diffRemoved":"#914c54","skill":"#9d7cd8"},"surface":"#1a1b26"},"variant":"dark"}},{"id":"vscode-plus","light":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":45,"fonts":{"code":null,"ui":null},"ink":"#000000","opaqueWindows":false,"semanticColors":{"diffAdded":"#008000","diffRemoved":"#ee0000","skill":"#0000ff"},"surface":"#ffffff"},"variant":"light"},"dark":{"codeThemeId":"vscode-plus","theme":{"accent":"#007acc","contrast":60,"fonts":{"code":null,"ui":null},"ink":"#d4d4d4","opaqueWindows":true,"semanticColors":{"diffAdded":"#369432","diffRemoved":"#f44747","skill":"#000080"},"surface":"#1e1e1e"},"variant":"dark"}}]'),Px={themes:Bx},Y3="panda:theme-settings",Ux=13,qx=12,Z3="codex",n0="codex",$x='-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif',Hx='ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, monospace',Fx=/\b(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|emoji|math|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)\b/i,L6=(n,t)=>{const a=n==null?void 0:n.trim();return a?Fx.test(a)?a:`${a}, ${t}`:t},Qx={absolutely:"Absolutely",ayu:"Ayu",catppuccin:"Catppuccin",codex:"Codex",dracula:"Dracula",everforest:"Everforest",github:"GitHub",gruvbox:"Gruvbox",linear:"Linear",lobster:"Lobster",material:"Material",matrix:"Matrix",monokai:"Monokai","night-owl":"Night Owl",nord:"Nord",notion:"Notion",one:"One",oscurange:"Oscurange",proof:"Proof","rose-pine":"Rose Pine",sentry:"Sentry",solarized:"Solarized",temple:"Temple","tokyo-night":"Tokyo Night","vscode-plus":"VSCode Plus"},Wo=(n,t,a)=>Math.min(a,Math.max(t,n)),rl=(n,t)=>{const r=n.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!r)return t;const[,c]=r;return`#${(c.length===3?c.split("").map(h=>`${h}${h}`).join(""):c).toUpperCase()}`},pi=n=>{const t=rl(n,"#000000").slice(1);return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}},Gx=(n,t,a)=>`#${[n,t,a].map(r=>Wo(Math.round(r),0,255).toString(16).padStart(2,"0")).join("").toUpperCase()}`,rt=(n,t,a)=>{const r=pi(n),c=pi(t),u=Wo(a,0,1);return Gx(r.r+(c.r-r.r)*u,r.g+(c.g-r.g)*u,r.b+(c.b-r.b)*u)},Vx=n=>{const{r:t,g:a,b:r}=pi(n),c=u=>{const h=u/255;return h<=.03928?h/12.92:((h+.055)/1.055)**2.4};return c(t)*.2126+c(a)*.7152+c(r)*.0722},Kx=n=>Vx(n)>.5?"#0D1117":"#FFFFFF",fi=(n,t)=>{const a=Math.round(Wo(t,0,1)*100);return a>=100?n:`color-mix(in srgb, ${n} ${a}%, transparent)`},W3=Px.themes,X3=(n,t)=>{var r,c;const a=t==="light"?n.light:n.dark;return a?{id:n.id,label:Qx[n.id]??n.id,codeThemeId:a.codeThemeId,variant:t,accent:rl(a.theme.accent,"#0169CC"),background:rl(a.theme.surface,"#FFFFFF"),foreground:rl(a.theme.ink,"#0D0D0D"),contrast:Wo(Number(a.theme.contrast),0,100),opaqueWindows:!!a.theme.opaqueWindows,semanticColors:{diffAdded:rl(a.theme.semanticColors.diffAdded,"#00A240"),diffRemoved:rl(a.theme.semanticColors.diffRemoved,"#E02E2A"),skill:rl(a.theme.semanticColors.skill,"#751ED9")},fonts:{ui:((r=a.theme.fonts.ui)==null?void 0:r.trim())||null,code:((c=a.theme.fonts.code)==null?void 0:c.trim())||null}}:null},vp=W3.map(n=>X3(n,"light")).filter(n=>!!n),Au=W3.map(n=>X3(n,"dark")).filter(n=>!!n);Au.find(n=>n.id===n0)??Au[0];const wl={mode:"system",lightThemeId:Z3,darkThemeId:n0,uiFontSize:Ux,codeFontSize:qx},J3=n=>Wo(Number(n),11,18),ey=n=>Wo(Number(n),10,18),s0=()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",sh=n=>vp.find(t=>t.id===n)??vp[0],ah=n=>Au.find(t=>t.id===n)??Au[0],I6=(n,t=wl,a="light")=>a==="dark"?{...t,darkThemeId:ah(n).id}:{...t,lightThemeId:sh(n).id},cr=n=>({mode:(n==null?void 0:n.mode)==="light"||(n==null?void 0:n.mode)==="dark"||(n==null?void 0:n.mode)==="system"?n.mode:wl.mode,lightThemeId:sh((n==null?void 0:n.lightThemeId)??Z3).id,darkThemeId:ah((n==null?void 0:n.darkThemeId)??n0).id,uiFontSize:J3((n==null?void 0:n.uiFontSize)??wl.uiFontSize),codeFontSize:ey((n==null?void 0:n.codeFontSize)??wl.codeFontSize)}),ty=()=>{if(typeof window>"u")return wl;try{const n=window.localStorage.getItem(Y3);return n?cr(JSON.parse(n)):wl}catch{return wl}},ou=n=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Y3,JSON.stringify(cr(n)))}catch{}},Yx=(n,t)=>n==="system"?t:n,mi=(n,t=s0())=>{const a=cr(n),r=Yx(a.mode,t),c=sh(a.lightThemeId),u=ah(a.darkThemeId),h=r==="dark"?u:c;return{...a,appearance:r,lightTheme:c,darkTheme:u,activeTheme:h,uiFontFamily:L6(h.fonts.ui,$x),codeFontFamily:L6(h.fonts.code,Hx)}},Zx=n=>{if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{n(t.matches?"dark":"light")};return a(),t.addEventListener("change",a),()=>{t.removeEventListener("change",a)}},Wx=(n,t)=>{const a=mi(n,t),r=a.activeTheme,c=t==="dark",u=(r.contrast-(c?60:45))/100,h=r.semanticColors.diffAdded,p=r.semanticColors.diffRemoved,y=r.semanticColors.skill,m=pi(h),b=pi(p),g=pi(y),x=pi(r.accent),w=pi(r.background),N=pi(r.foreground),T=r.background,C=c?rt(r.background,"#FFFFFF",.05+u*.08):rt(r.background,"#FFFFFF",.42+u*.16),I=c?rt(r.background,"#FFFFFF",.07+u*.08):rt(r.background,"#FFFFFF",.78+u*.1),$=c?rt(r.background,"#FFFFFF",.1+u*.08):rt(r.background,"#FFFFFF",.56+u*.14),H=c?rt(r.background,"#FFFFFF",.14+u*.08):rt(r.background,r.foreground,.1+u*.12),R=c?rt(r.background,"#000000",.08-u*.06):rt(r.background,r.foreground,.03+u*.08),Q=c?rt(r.background,"#FFFFFF",.08+u*.06):rt(r.background,r.foreground,.06+u*.08),ce=c?rt(r.background,"#FFFFFF",.14+u*.08):rt(r.background,r.foreground,.14+u*.1),Z=c?rt(r.background,"#FFFFFF",.22+u*.08):rt(r.background,r.foreground,.22+u*.1),ie=c?rt(r.background,"#FFFFFF",.08+u*.04):rt(r.background,r.foreground,.1+u*.08),ee=r.foreground,Y=c?rt(r.foreground,r.background,.28-u*.1):rt(r.foreground,r.background,.5-u*.14),F=c?rt(r.foreground,r.background,.46-u*.1):rt(r.foreground,r.background,.64-u*.14),_e=rt(r.foreground,r.background,c?.58:.74),je=r.accent,ae=c?rt(r.accent,"#FFFFFF",.18):rt(r.accent,"#FFFFFF",.24),ue=c?rt(r.accent,r.background,.78):rt(r.accent,r.background,.88),E=c?rt(r.accent,r.background,.84):rt(r.accent,r.background,.92),U=Kx(je),te=c?rt(r.background,"#FFFFFF",.1):rt(r.background,r.foreground,.08),W=c?rt(r.background,"#000000",.06):rt(r.background,r.foreground,.035),xe=c?rt(r.background,"#FFFFFF",.05):rt(r.background,r.foreground,.06),A=c?rt(r.background,"#FFFFFF",.03):rt(r.background,r.foreground,.085),ne=c?rt(r.background,"#FFFFFF",.065):rt(r.background,r.foreground,.05),be=rt(r.foreground,r.background,c?.42:.68),V=c?rt(r.background,"#FFFFFF",.08):rt(r.foreground,r.background,.18),pe=c?rt(r.background,"#FFFFFF",.08):rt(r.background,r.foreground,.06),Ce=c?rt(r.background,"#FFFFFF",.12):rt(r.background,r.foreground,.1),Le=c?rt(r.background,"#FFFFFF",.14+u*.05):rt(r.background,r.foreground,.12+u*.08),he=r.opaqueWindows?1:c?.92:.95,q=r.opaqueWindows?1:c?.94:.965,Se=r.opaqueWindows?1:.94;return{"--theme-id":r.id,"--theme-code-theme-id":r.codeThemeId,"--theme-window-opaque":r.opaqueWindows?"1":"0","--theme-accent":je,"--theme-accent-rgb":`${x.r} ${x.g} ${x.b}`,"--theme-background":r.background,"--theme-background-rgb":`${w.r} ${w.g} ${w.b}`,"--theme-foreground":r.foreground,"--theme-foreground-rgb":`${N.r} ${N.g} ${N.b}`,"--theme-shadow-rgb":c?"0 0 0":"39 28 17","--theme-ui-font":a.uiFontFamily,"--theme-code-font":a.codeFontFamily,"--theme-ui-font-size":`${a.uiFontSize}px`,"--theme-code-font-size":`${a.codeFontSize}px`,"--color-surface-base":T,"--color-surface-elevated":C,"--color-surface-panel":I,"--color-surface-raised":$,"--color-surface-panel-strong":H,"--color-surface-sidebar":fi(R,q),"--color-surface-sidebar-elevated":fi(Q,q),"--color-surface-border":ce,"--color-surface-border-strong":Z,"--color-surface-border-soft":ie,"--color-surface-overlay":fi(H,he),"--color-surface-floating":fi(I,he),"--color-surface-tooltip":fi(V,Se),"--color-surface-code":W,"--color-surface-code-muted":xe,"--color-surface-code-gutter":A,"--color-surface-code-meta":ne,"--color-surface-inline-code":te,"--color-surface-hover":pe,"--color-surface-pressed":Ce,"--color-surface-danger-soft":fi(p,c?.14:.08),"--color-surface-success-soft":fi(h,c?.14:.08),"--color-text-primary":ee,"--color-text-secondary":Y,"--color-text-muted":F,"--color-text-tertiary":_e,"--color-text-on-accent":U,"--color-text-link":je,"--color-text-link-hover":ae,"--color-text-danger":p,"--color-text-success":h,"--color-accent-primary":je,"--color-accent-primary-soft":ue,"--color-accent-secondary":ae,"--color-accent-secondary-soft":E,"--color-accent-contrast":U,"--color-accent-primary-rgb":`${x.r} ${x.g} ${x.b}`,"--color-success":h,"--color-warning":rt(r.accent,h,.35),"--color-danger":p,"--color-status-online":je,"--color-status-offline":c?"#76808A":"#A5ACA4","--color-skill":y,"--color-skill-rgb":`${g.r} ${g.g} ${g.b}`,"--color-code-keyword":y,"--color-code-title":je,"--color-code-string":rt(h,r.foreground,c?.26:.18),"--color-code-number":rt(y,je,.36),"--color-code-comment":rt(r.foreground,r.background,c?.52:.72),"--color-code-meta-text":be,"--color-code-add":h,"--color-code-add-rgb":`${m.r} ${m.g} ${m.b}`,"--color-code-add-bg":fi(h,c?.16:.11),"--color-code-remove":p,"--color-code-remove-rgb":`${b.r} ${b.g} ${b.b}`,"--color-code-remove-bg":fi(p,c?.18:.11),"--color-divider":Le,"--color-overlay-scrim":r.opaqueWindows?c?"rgba(8, 10, 12, 0.66)":"rgba(23, 20, 17, 0.14)":c?"rgba(8, 10, 12, 0.54)":"rgba(23, 20, 17, 0.09)","--shadow-soft":c?"0 24px 54px rgba(0, 0, 0, 0.34)":"0 24px 54px rgba(24, 18, 12, 0.08)","--shadow-panel":c?"0 10px 26px rgba(0, 0, 0, 0.24)":"0 10px 26px rgba(37, 23, 10, 0.06)","--shadow-sm":c?"0 2px 12px rgba(0, 0, 0, 0.18)":"0 2px 12px rgba(37, 23, 10, 0.05)","--shadow-overlay":c?"0 20px 44px rgba(0, 0, 0, 0.36)":"0 18px 40px rgba(42, 26, 12, 0.1)","--font-display":a.uiFontFamily,"--font-sans":a.uiFontFamily,"--font-mono":a.codeFontFamily,"--font-size-ui-base":`${a.uiFontSize}px`,"--font-size-code-base":`${a.codeFontSize}px`}},ny=(n,t=s0())=>{if(typeof document>"u")return;const a=mi(n,t),r=Wx(a,a.appearance),c=document.documentElement;c.dataset.theme=a.appearance,c.dataset.uiTheme=a.appearance,c.dataset.themeId=a.activeTheme.id,c.dataset.codeThemeId=a.activeTheme.codeThemeId,c.dataset.windowStyle=a.activeTheme.opaqueWindows?"opaque":"soft",c.style.colorScheme=a.appearance;for(const[u,h]of Object.entries(r))c.style.setProperty(u,h)},Xx=["bootstrap","hub"],dt=["bootstrap","workspace"];function qu(n){return Es({queryKey:(n==null?void 0:n.queryKey)??Xx,queryFn:async()=>(await Jn(n==null?void 0:n.scope)).client.getPhaseOneSnapshot({fallbackToMock:!1}),refetchInterval:3e5,refetchOnWindowFocus:!1,retry:1})}const z6=n=>{let t;const a=new Set,r=(m,b)=>{const g=typeof m=="function"?m(t):m;if(!Object.is(g,t)){const x=t;t=b??(typeof g!="object"||g===null)?g:Object.assign({},t,g),a.forEach(w=>w(t,x))}},c=()=>t,p={setState:r,getState:c,getInitialState:()=>y,subscribe:m=>(a.add(m),()=>a.delete(m))},y=t=n(r,c,p);return p},Jx=(n=>n?z6(n):z6),eS=n=>n;function tS(n,t=eS){const a=Si.useSyncExternalStore(n.subscribe,Si.useCallback(()=>t(n.getState()),[n,t]),Si.useCallback(()=>t(n.getInitialState()),[n,t]));return Si.useDebugValue(a),a}const B6=n=>{const t=Jx(n),a=r=>tS(t,r);return Object.assign(a,t),a},nS=(n=>n?B6(n):B6),P6=ty(),U6=s0(),va=nS(n=>({panelTab:"git",composerText:"",activeSessionId:null,bottomNavVisible:!0,themeSettings:P6,systemAppearance:U6,resolvedTheme:mi(P6,U6),setPanelTab:t=>n({panelTab:t}),setComposerText:t=>n({composerText:t}),setActiveSessionId:t=>n({activeSessionId:t}),setBottomNavVisible:t=>n({bottomNavVisible:t}),setThemeMode:t=>n(a=>{const r=cr({...a.themeSettings,mode:t});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setLightThemeId:t=>n(a=>{const r=cr(I6(sh(t).id,a.themeSettings,"light"));return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setDarkThemeId:t=>n(a=>{const r=cr({...I6(ah(t).id,a.themeSettings,"dark")});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setUiFontSize:t=>n(a=>{const r=cr({...a.themeSettings,uiFontSize:t});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setCodeFontSize:t=>n(a=>{const r=cr({...a.themeSettings,codeFontSize:t});return ou(r),{themeSettings:r,resolvedTheme:mi(r,a.systemAppearance)}}),setSystemAppearance:t=>n(a=>({systemAppearance:t,resolvedTheme:mi(a.themeSettings,t)}))})),sS=()=>{const{data:n}=qu(),t=va(c=>c.themeSettings),a=va(c=>c.systemAppearance),r=va(c=>c.setSystemAppearance);return _.useEffect(()=>{ny(t,a)},[a,t]),_.useEffect(()=>Zx(r),[r]),l.jsxs("div",{className:"app-shell",children:[l.jsx(zx,{snapshot:n}),l.jsx("div",{className:"app-shell__content",children:l.jsx(j3,{})})]})},aS=n=>n.tailscale_dns_name||n.tailscale_ip||n.host||n.direct_base_url,iS=({message:n})=>l.jsx("p",{className:"empty-copy",children:n}),rS=()=>{const n=Mr(),{data:t}=qu(),a=(t==null?void 0:t.agents)??[];return l.jsxs("div",{className:"nodes-screen",children:[l.jsxs("div",{className:"nodes-screen__header",children:[l.jsx("h1",{children:"节点列表"}),l.jsx("p",{children:"查看所有在线节点和局域网地址"})]}),l.jsx("div",{className:"nodes-screen__content node-list",children:a.length===0?l.jsx(iS,{message:"暂无节点"}):a.map(r=>{const c=Mu(),u=(t==null?void 0:t.sessions.find(h=>h.id===c&&h.agent_id===r.id))??null;return l.jsxs("button",{type:"button",className:"node-card",onClick:()=>{xr(r.id),fs((u==null?void 0:u.id)??null),Ru((u==null?void 0:u.id)??null),n({to:"/"})},children:[l.jsxs("div",{className:"node-card__header",children:[l.jsx("strong",{children:r.name}),l.jsx("span",{className:`node-status-dot ${r.status}`})]}),l.jsx("div",{className:"node-card__ip",children:aS(r)})]},r.id)})})]})},$u=n=>[...n].sort((t,a)=>{const r=Number(a.pinned)-Number(t.pinned);return r!==0?r:+new Date(a.last_event_at)-+new Date(t.last_event_at)}),a0=(n,t)=>!!(n!=null&&n.sessions.some(a=>a.id===t)),Kf=(n,t,a)=>!n||!a0(n,t)?n:{...n,sessions:$u(n.sessions.map(r=>r.id===t?{...r,...a}:r))},_p=(n,t,a)=>{if(!n)return n;const r=n.sessions.find(h=>h.id===t);if(!r)return n;const c=new Date(a).getTime(),u=new Date(r.last_event_at).getTime();return!Number.isFinite(c)||Number.isFinite(u)&&c<=u?n:Kf(n,t,{last_event_at:a})},Nf=(n,t,a)=>{if(!n)return n;const{last_event_at:r,...c}=a;let u=Kf(n,t,c);return typeof r=="string"&&r.trim()&&(u=_p(u,t,r)),u},sy=(n,t,a)=>{if(!n||t.length===0)return n;const r=new Set(t);return{...n,sessions:$u(n.sessions.map(c=>r.has(c.id)?{...c,...a}:c))}},ay=(n,t)=>{var u;if(!n||t.length===0)return n;const a=new Set(t),r=n.sessions.filter(h=>!a.has(h.id)),c=a.has(n.active_session_id)?((u=r[0])==null?void 0:u.id)??"":n.active_session_id;return{...n,active_session_id:c,sessions:$u(r)}},Yf=(n,t,a)=>!n||!n.projects.some(r=>r.id===t)?n:{...n,projects:n.projects.map(r=>r.id===t?{...r,...a}:r)},iy=(n,t)=>{if(!n||t.length===0||n.projects.length<=1)return n;const a=new Map(n.projects.map(u=>[u.id,u])),r=new Set,c=[];for(const u of t){const h=a.get(u);!h||r.has(u)||(r.add(u),c.push(h))}for(const u of n.projects)r.has(u.id)||c.push(u);return c.every((u,h)=>{var p;return u.id===((p=n.projects[h])==null?void 0:p.id)})?n:{...n,projects:c}},ry=(n,t)=>{var c;if(!n)return n;const a=n.sessions.filter(u=>u.project_id!==t),r=a.some(u=>u.id===n.active_session_id)?n.active_session_id:((c=a[0])==null?void 0:c.id)??"";return{...n,active_session_id:r,projects:n.projects.filter(u=>u.id!==t),sessions:$u(a)}},q6=(n,t)=>n&&{...n,generated_at:new Date().toISOString(),projects:[t,...n.projects.filter(a=>a.id!==t.id)]},lS=(n,t)=>{if(!n)return n;const a=[t,...n.sessions.filter(r=>r.id!==t.id)];return{...n,generated_at:new Date().toISOString(),active_session_id:t.id,sessions:$u(a)}};/**
67
67
  * @license lucide-react v0.577.0 - ISC
68
68
  *
69
69
  * This source code is licensed under the ISC license.
@@ -73,58 +73,58 @@ Error generating stack: `+o.message+`
73
73
  *
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
- */const iS=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
76
+ */const oS=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
77
77
  * @license lucide-react v0.577.0 - ISC
78
78
  *
79
79
  * This source code is licensed under the ISC license.
80
80
  * See the LICENSE file in the root directory of this source tree.
81
- */const rS=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,r)=>r?r.toUpperCase():a.toLowerCase());/**
81
+ */const cS=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,r)=>r?r.toUpperCase():a.toLowerCase());/**
82
82
  * @license lucide-react v0.577.0 - ISC
83
83
  *
84
84
  * This source code is licensed under the ISC license.
85
85
  * See the LICENSE file in the root directory of this source tree.
86
- */const $6=n=>{const t=rS(n);return t.charAt(0).toUpperCase()+t.slice(1)};/**
86
+ */const $6=n=>{const t=cS(n);return t.charAt(0).toUpperCase()+t.slice(1)};/**
87
87
  * @license lucide-react v0.577.0 - ISC
88
88
  *
89
89
  * This source code is licensed under the ISC license.
90
90
  * See the LICENSE file in the root directory of this source tree.
91
- */var lS={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
91
+ */var uS={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
92
92
  * @license lucide-react v0.577.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
95
95
  * See the LICENSE file in the root directory of this source tree.
96
- */const oS=n=>{for(const t in n)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
96
+ */const dS=n=>{for(const t in n)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
97
97
  * @license lucide-react v0.577.0 - ISC
98
98
  *
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
- */const cS=_.forwardRef(({color:n="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:c="",children:u,iconNode:h,...p},y)=>_.createElement("svg",{ref:y,...lS,width:t,height:t,stroke:n,strokeWidth:r?Number(a)*24/Number(t):a,className:ly("lucide",c),...!u&&!oS(p)&&{"aria-hidden":"true"},...p},[...h.map(([m,b])=>_.createElement(m,b)),...Array.isArray(u)?u:[u]]));/**
101
+ */const fS=_.forwardRef(({color:n="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:c="",children:u,iconNode:h,...p},y)=>_.createElement("svg",{ref:y,...uS,width:t,height:t,stroke:n,strokeWidth:r?Number(a)*24/Number(t):a,className:ly("lucide",c),...!u&&!dS(p)&&{"aria-hidden":"true"},...p},[...h.map(([m,b])=>_.createElement(m,b)),...Array.isArray(u)?u:[u]]));/**
102
102
  * @license lucide-react v0.577.0 - ISC
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const oy=(n,t)=>{const a=_.forwardRef(({className:r,...c},u)=>_.createElement(cS,{ref:u,iconNode:t,className:ly(`lucide-${iS($6(n))}`,`lucide-${n}`,r),...c}));return a.displayName=$6(n),a};/**
106
+ */const oy=(n,t)=>{const a=_.forwardRef(({className:r,...c},u)=>_.createElement(fS,{ref:u,iconNode:t,className:ly(`lucide-${oS($6(n))}`,`lucide-${n}`,r),...c}));return a.displayName=$6(n),a};/**
107
107
  * @license lucide-react v0.577.0 - ISC
108
108
  *
109
109
  * This source code is licensed under the ISC license.
110
110
  * See the LICENSE file in the root directory of this source tree.
111
- */const uS=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],dS=oy("pin",uS);/**
111
+ */const hS=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],mS=oy("pin",hS);/**
112
112
  * @license lucide-react v0.577.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const fS=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],hS=oy("trash-2",fS),mS=180*1e3,cy=8640*60*1e3,To=6,uy="panda:completed-session-seen-at",R1=6,pS=220,H6=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),gS=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),yS=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"4",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"15",y:"4",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"3",y:"14",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"15",y:"14",width:"6",height:"6",rx:"1.5"})]}),vS=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v6A2.5 2.5 0 0 1 16.5 15H11l-4.5 4v-4H7.5A2.5 2.5 0 0 1 5 12.5z"})}),_S=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"}),l.jsx("path",{d:"M16.5 10.5v5"}),l.jsx("path",{d:"M14 13h5"})]}),F6=({open:n})=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:n?"is-open":"",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),bS=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),xS=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m15 6-6 6 6 6"})}),SS=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M10.33 4.32c.6-1.76 2.74-1.76 3.34 0a1.78 1.78 0 0 0 2.66 1l.18-.1c1.6-.92 3.4.88 2.48 2.48l-.1.18a1.78 1.78 0 0 0 1 2.66c1.76.6 1.76 2.74 0 3.34a1.78 1.78 0 0 0-1 2.66l.1.18c.92 1.6-.88 3.4-2.48 2.48l-.18-.1a1.78 1.78 0 0 0-2.66 1c-.6 1.76-2.74 1.76-3.34 0a1.78 1.78 0 0 0-2.66-1l-.18.1c-1.6.92-3.4-.88-2.48-2.48l.1-.18a1.78 1.78 0 0 0-1-2.66c-1.76-.6-1.76-2.74 0-3.34a1.78 1.78 0 0 0 1-2.66l-.1-.18c-.92-1.6.88-3.4 2.48-2.48l.18.1a1.78 1.78 0 0 0 2.66-1Z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.15"})]}),jS=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),wS=n=>{const t=Date.now(),a=new Date(n).getTime(),r=Math.max(0,t-a),c=60*1e3,u=60*c,h=24*u;return r<u?`${Math.max(1,Math.floor(r/c))}分钟`:r<h?`${Math.max(1,Math.floor(r/u))}小时`:`${Math.max(1,Math.floor(r/h))}天`},A1=n=>n.run_state==="completed"&&n.run_state_changed_at&&Date.now()-new Date(n.run_state_changed_at).getTime()>mS?"idle":n.run_state??"idle",kS=(n,t)=>n.archived||n.id===t||Date.now()-new Date(n.last_event_at).getTime()<=cy,NS=(n,t)=>Number(t.pinned)-Number(n.pinned)||+new Date(t.last_event_at)-+new Date(n.last_event_at),CS=(n,t)=>n.id===t||Date.now()-new Date(n.last_event_at).getTime()<=cy,TS=(n,t)=>{if(n.length<=To)return n;if(!t)return n.slice(0,To);const a=n.findIndex(r=>r.id===t);return a===-1||a<To?n.slice(0,To):[...n.slice(0,To-1),n[a]]},ES=()=>{if(typeof window>"u")return{};try{const n=window.localStorage.getItem(uy);if(!n)return{};const t=JSON.parse(n);return t&&typeof t=="object"?t:{}}catch{return{}}},D1=(n,t)=>n.length===t.length&&n.every((a,r)=>a===t[r]),MS=(n,t)=>{if(!t||t.length===0||n.length<=1)return n;const a=new Map(n.map(u=>[u.id,u])),r=new Set,c=[];for(const u of t){const h=a.get(u);!h||r.has(u)||(r.add(u),c.push(h))}for(const u of n)r.has(u.id)||c.push(u);return c},RS=(n,t,a)=>{if(t<0||t>=n.length||a<0||a>=n.length||t===a)return n;const r=[...n],[c]=r.splice(t,1);return c?(r.splice(a,0,c),r):n},AS=(n,t,a)=>{if(t.length===0)return n;const r=new Set(t);let c=0;return n.map(u=>{if(!r.has(u))return u;const h=a[c]??u;return c+=1,h})},dy=_.memo(function({open:t,progress:a=t?1:0,isDragging:r=!1,desktopPinned:c=!1,isDesktopResizing:u=!1,onClose:h,onDesktopResizeStart:p,currentAgent:y,projects:m,sessions:b,activeSessionId:g,onCreateSession:x,onCreateDirectoryThread:w,onSelectSession:N,onSessionAction:T,onThreadAction:C,pendingSessionActionId:I,pendingThreadActionId:$}){const H=Mr(),R=a>.001,Q=!!y,ce=(y==null?void 0:y.status)==="online",Z=_.useRef({threads:null,archived:null}),ie=_.useRef({}),ee=_.useRef(null),Y=_.useRef(null),F=_.useRef(null),_e=_.useRef(null),je=_.useRef({}),ae=_.useRef(null),[ue,E]=_.useState({}),[U,te]=_.useState(null),[W,xe]=_.useState(null),A=_.useMemo(()=>b.map(j=>{const z=ue[j.id];return z?{...j,...z.pinned===void 0?null:{pinned:z.pinned}}:j}).filter(j=>{var z;return!((z=ue[j.id])!=null&&z.hidden)}),[ue,b]),ne=(W==null?void 0:W.nextGlobalProjectIds)??U,be=_.useMemo(()=>MS(m,ne),[m,ne]),V=_.useMemo(()=>A.filter(j=>!j.subagent&&kS(j,g)),[g,A]),pe=V.find(j=>j.id===g),Ce=pe==null?void 0:pe.project_id,[Le,he]=_.useState(Ce?[Ce]:[]),[q,Se]=_.useState("threads"),[Ne,me]=_.useState(null),[Te,Ge]=_.useState(null),[Ue,gt]=_.useState(null),[Lt,St]=_.useState(null),[st,tn]=_.useState([]),[$t,de]=_.useState(null),[Ae,Re]=_.useState(""),[Oe,Ke]=_.useState(()=>ES()),mt=_.useMemo(()=>V.filter(j=>!j.archived),[V]),kt=_.useMemo(()=>mt.filter(j=>j.pinned).sort((j,z)=>+new Date(z.last_event_at)-+new Date(j.last_event_at)),[mt]),rn=_.useMemo(()=>mt.filter(j=>!j.pinned),[mt]),Pn=_.useMemo(()=>V.filter(j=>j.archived),[V]),On=j=>be.map(z=>{var Ve;const we=j.filter(ct=>ct.project_id===z.id).sort((ct,Nt)=>NS(ct,Nt)).filter(ct=>CS(ct,g)),ke=((Ve=we[0])==null?void 0:Ve.last_event_at)??new Date(0).toISOString();return{project:z,threadSessions:we,collapsedThreadSessions:TS(we,g),hiddenSessionCount:Math.max(0,we.length-To),latestEventAt:ke}}).filter(({threadSessions:z})=>z.length>0),nn=_.useMemo(()=>On(rn),[g,be,rn]),ln=_.useMemo(()=>On(Pn),[g,Pn,be]);_.useEffect(()=>{E(j=>{let z=!1;const ge={...j};for(const[we,ke]of Object.entries(j)){const Ve=b.find(Nt=>Nt.id===we);if(!Ve){ke.hidden&&(delete ge[we],z=!0);continue}(ke.pinned===void 0||Ve.pinned===ke.pinned)&&!ke.hidden&&(delete ge[we],z=!0)}return z?ge:j})},[b]),_.useEffect(()=>{te(j=>{if(!j)return j;const z=m.map(we=>we.id),ge=[...j.filter(we=>z.includes(we)),...z.filter(we=>!j.includes(we))];return D1(ge,z)?null:ge})},[m]),_.useEffect(()=>{Ce&&he(j=>j.includes(Ce)?j:[...j,Ce])},[Ce]),_.useEffect(()=>{Se(pe!=null&&pe.archived?"archived":"threads")},[pe==null?void 0:pe.archived,g]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(uy,JSON.stringify(Oe))}catch{}},[Oe]),_.useEffect(()=>{t||c||(gt(null),St(null),de(null),Ge(null))},[c,t]),_.useEffect(()=>{if(!c||!Ue)return;const j=z=>{const ge=z.target;if(!(ge instanceof Element)){gt(null);return}ge.closest(".thread-group__menu-anchor")||ge.closest(".thread-group__menu")||gt(null)};return window.addEventListener("pointerdown",j),()=>{window.removeEventListener("pointerdown",j)}},[c,Ue]),_.useEffect(()=>{if(!g)return;const j=V.find(ge=>ge.id===g);if(!j||A1(j)!=="completed"||!j.run_state_changed_at)return;const z=j.run_state_changed_at;Ke(ge=>ge[j.id]===z?ge:{...ge,[j.id]:z})},[g,V]),_.useEffect(()=>()=>{ee.current!==null&&globalThis.clearTimeout(ee.current),ae.current!==null&&window.cancelAnimationFrame(ae.current)},[]),_.useEffect(()=>{F.current=W},[W]),_.useLayoutEffect(()=>{if(typeof window>"u")return;const j={},z=[];for(const[ge,we]of Object.entries(ie.current)){if(!we)continue;const ke=we.offsetTop;if(j[ge]=ke,(W==null?void 0:W.projectId)===ge)continue;const Ve=je.current[ge];if(Ve===void 0)continue;const ct=Ve-ke;Math.abs(ct)<.5||(we.style.transition="none",we.style.transform=`translateY(${ct}px)`,z.push(we))}ae.current!==null&&window.cancelAnimationFrame(ae.current),z.length>0&&(ae.current=window.requestAnimationFrame(()=>{for(const ge of z)ge.style.transition="",ge.style.transform=""})),je.current=j},[nn,ln,Le,st,W==null?void 0:W.projectId,ne]);const oe=()=>{ee.current!==null&&(globalThis.clearTimeout(ee.current),ee.current=null)},qe=j=>j==="threads"?nn:ln,De=(j,z,ge,we,ke)=>{const Ve=Z.current[z],ct=ie.current[j];if(!Ve||!ct)return!1;const Nt=qe(z).map(sn=>sn.project.id),qn=Nt.indexOf(j);if(qn===-1)return!1;const es=be.map(sn=>sn.id),Ht=Ve.getBoundingClientRect(),wn=ct.getBoundingClientRect(),kn=ct.offsetHeight,Ln=ct.offsetWidth,un=ke-wn.top,B=Ve.scrollTop,on=Math.max(B,Ve.scrollTop+Ve.clientHeight-kn),gn=Math.max(B,Math.min(on,Ve.scrollTop+ke-Ht.top-un)),yn={pane:z,projectId:j,pointerId:ge,pointerType:we,originIndex:qn,visibleProjectIds:Nt,nextVisibleProjectIds:Nt,nextGlobalProjectIds:es,previewTop:gn,itemHeight:kn,itemWidth:Ln,pointerOffsetY:un};return F.current=yn,xe(yn),_e.current=j,!0},Ie=j=>{xe(z=>{if(!z)return z;F.current=z;const ge=Z.current[z.pane];if(!ge||!ie.current[z.projectId])return z;const we=ge.getBoundingClientRect(),ke=ge.scrollTop,Ve=Math.max(ke,ge.scrollTop+ge.clientHeight-z.itemHeight),ct=Math.max(ke,Math.min(Ve,ge.scrollTop+j-we.top-z.pointerOffsetY)),Nt=ct+z.itemHeight/2,qn=z.nextVisibleProjectIds,es=qn.indexOf(z.projectId);if(es===-1)return z;const Ht=qn.filter(gn=>gn!==z.projectId);let wn=0;const kn=Ht[0],Ln=kn?ie.current[kn]:null;if(Ln&&ct<=Ln.offsetTop+Ln.offsetHeight*.42)wn=0;else for(let gn=0;gn<Ht.length;gn+=1){const yn=Ht[gn],sn=yn?ie.current[yn]:null;if(!sn){wn=gn+1;continue}const Ft=sn.offsetTop+sn.offsetHeight/2;if(Nt<=Ft){wn=gn;break}wn=gn+1}const un=RS(qn,es,wn),B=AS(z.nextGlobalProjectIds,z.visibleProjectIds,un);if(ct===z.previewTop&&D1(un,z.nextVisibleProjectIds))return z;const on={...z,previewTop:ct,nextVisibleProjectIds:un,nextGlobalProjectIds:B};return F.current=on,on})},We=j=>{oe(),Y.current=null;const z=j??F.current;if(F.current=null,xe(null),!z||!!D1(z.visibleProjectIds,z.nextVisibleProjectIds)||!C)return;const we=U??be.map(Ve=>Ve.id),ke=z.nextGlobalProjectIds;te(ke),Promise.resolve(C(z.projectId,"reorder",{orderedProjectIds:ke})).catch(()=>{te(we)})},$e=()=>{oe(),Y.current=null,F.current=null,xe(null)};_.useEffect(()=>{if(typeof window>"u"||!F.current)return;const j=we=>{const ke=F.current;!ke||ke.pointerId!==we.pointerId||Ie(we.clientY)},z=we=>{const ke=F.current;!ke||ke.pointerId!==we.pointerId||We(ke)},ge=we=>{const ke=F.current;!ke||ke.pointerId!==we.pointerId||$e()};return window.addEventListener("pointermove",j),window.addEventListener("pointerup",z),window.addEventListener("pointercancel",ge),()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",ge)}},[W==null?void 0:W.pointerId]);const He=j=>{he(z=>z.includes(j)?z.filter(ge=>ge!==j):[...z,j])},Ee=j=>{if(_e.current===j){_e.current=null;return}He(j)},Ut=(j,z,ge)=>{if(j.pointerType==="mouse"&&j.button!==0)return;oe();const we=j.currentTarget;Y.current={pane:ge,projectId:z,pointerId:j.pointerId,pointerType:j.pointerType,startX:j.clientX,startY:j.clientY,currentX:j.clientX,currentY:j.clientY},j.pointerType!=="touch"&&we.setPointerCapture(j.pointerId),j.pointerType==="touch"&&(ee.current=globalThis.setTimeout(()=>{const ke=Y.current;if(!ke||ke.projectId!==z||ke.pointerId!==j.pointerId)return;we.hasPointerCapture(j.pointerId)||we.setPointerCapture(j.pointerId),De(z,ge,j.pointerId,j.pointerType,ke.currentY)&&Ie(ke.currentY)},pS))},at=(j,z,ge)=>{const we=Y.current;if(!we||we.projectId!==z||we.pointerId!==j.pointerId||we.pane!==ge)return;if(we.currentX=j.clientX,we.currentY=j.clientY,(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){j.preventDefault(),Ie(j.clientY);return}const ke=j.clientX-we.startX,Ve=j.clientY-we.startY;if(we.pointerType==="touch"){(Math.abs(ke)>R1||Math.abs(Ve)>R1)&&oe();return}Math.abs(Ve)<R1||Math.abs(Ve)<Math.abs(ke)||!De(z,ge,j.pointerId,j.pointerType,j.clientY)||(j.preventDefault(),Ie(j.clientY))},pn=(j,z)=>{if(j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId),(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){j.preventDefault(),We();return}oe(),Y.current=null},Un=(j,z)=>{if(j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId),(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){$e();return}oe(),Y.current=null},xn=j=>{tn(z=>z.includes(j)?z.filter(ge=>ge!==j):[...z,j])},ps=j=>{if(A1(j)!=="completed"||!j.run_state_changed_at)return;const z=j.run_state_changed_at;Ke(ge=>ge[j.id]===z?ge:{...ge,[j.id]:z})},is=`translateX(-${(q==="threads"?0:1)*50}%)`,Ci=$t&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{de(null),Re("")},"aria-label":"关闭重命名面板"}),l.jsx("div",{className:"sheet-wrap__center",children:l.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[l.jsx("div",{className:"sheet-panel__title",children:"编辑线程名称"}),l.jsx("input",{className:"sheet-panel__input",value:Ae,onChange:j=>Re(j.target.value),placeholder:"输入线程名称",autoFocus:!0}),l.jsxs("div",{className:"sheet-panel__actions",children:[l.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{de(null),Re("")},children:"取消"}),l.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Ae.trim()||$===$t,onClick:()=>{Gs()},children:"保存"})]})]})})]}),document.body):null,la=j=>{gt(null),St(null),de(j.id),Re(j.display_name??j.name)},Gs=async()=>{!$t||!Ae.trim()||!C||(await C($t,"rename",{name:Ae.trim()}),de(null),Re(""))},rs=(j,z,ge)=>{if(!T)return;const we=ue[j.id];z==="pin"||z==="unpin"?E(Ve=>({...Ve,[j.id]:{...Ve[j.id],pinned:z==="pin"}})):z==="delete"&&E(Ve=>({...Ve,[j.id]:{...Ve[j.id],hidden:!0}}));const ke=T(j.id,z,ge);ke&&typeof ke.then=="function"&&ke.catch(()=>{E(Ve=>{const ct={...Ve};return we?ct[j.id]=we:delete ct[j.id],ct})})},xa=j=>{const z=A1(j),ge=z==="completed"&&j.id!==g&&!!j.run_state_changed_at&&Oe[j.id]!==j.run_state_changed_at,we=c&&Ne===j.id,ke=!!T&&we,Ve=Te===j.id,ct=c&&(ke||Ve);return l.jsxs("div",{className:`thread-session ${j.id===g?"is-active":""}`,onMouseEnter:()=>me(j.id),onMouseLeave:()=>{me(Nt=>Nt===j.id?null:Nt),Ge(Nt=>Nt===j.id?null:Nt)},children:[l.jsx("button",{type:"button",className:`thread-session__icon-button ${ke?"is-visible":""} ${j.pinned?"is-active":""}`,disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),rs(j,j.pinned?"unpin":"pin")},"aria-label":j.pinned?"取消置顶会话":"置顶会话",title:j.pinned?"取消置顶":"置顶",children:l.jsx(dS,{strokeWidth:j.pinned?2.1:1.95})}),l.jsxs("div",{className:"thread-session__row",children:[N?l.jsxs("button",{type:"button",className:"thread-session__link thread-session__link--button",title:j.title,onClick:()=>{ps(j),N(j.id),h()},children:[l.jsx("span",{className:`thread-session__status is-${ge?"completed":z} ${ge?"is-unread":""} ${ct?"is-hidden":""}`,"aria-hidden":"true"}),l.jsx("div",{className:"thread-session__title",children:j.title})]}):l.jsxs(_u,{to:"/session/$sessionId",params:{sessionId:j.id},title:j.title,onClick:()=>{ps(j),h()},className:"thread-session__link",children:[l.jsx("span",{className:`thread-session__status is-${ge?"completed":z} ${ge?"is-unread":""} ${ct?"is-hidden":""}`,"aria-hidden":"true"}),l.jsx("div",{className:"thread-session__title",children:j.title})]}),l.jsx("div",{className:"thread-session__meta",children:c&&we&&T?Ve?l.jsx("button",{type:"button",className:"thread-session__delete-confirm",disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),rs(j,"delete")},children:"确认"}):l.jsx("button",{type:"button",className:"thread-session__delete",disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),Ge(j.id)},"aria-label":`删除 ${j.title}`,children:l.jsx(hS,{strokeWidth:1.95})}):l.jsx("span",{className:"thread-session__time",children:wS(j.last_event_at)})})]})]},j.id)},Vs=({project:j,threadSessions:z,collapsedThreadSessions:ge,hiddenSessionCount:we},ke)=>{const Ve=Le.includes(j.id),ct=st.includes(j.id),Nt=j.display_name??j.name,qn=!!C&&c&&Ue===j.id,es=!!C&&Lt===j.id,Ht=z.every(B=>B.archived),wn=ct?z:ge,kn=we>0,Ln=(W==null?void 0:W.projectId)===j.id&&W.pane===ke,un=es&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>St(null),"aria-label":"关闭线程菜单"}),l.jsxs("div",{className:"sheet-panel",children:[l.jsx("div",{className:"sheet-panel__title",children:Nt}),l.jsx("button",{type:"button",className:"sheet-panel__item",onClick:()=>la(j),children:"编辑名称"}),l.jsx("button",{type:"button",className:"sheet-panel__item",disabled:$===j.id,onClick:()=>{C==null||C(j.id,Ht?"unarchive":"archive"),St(null)},children:Ht?"取消归档":"归档线程"}),l.jsx("button",{type:"button",className:"sheet-panel__item is-danger",disabled:$===j.id,onClick:()=>{C==null||C(j.id,"remove"),St(null)},children:"移除"})]})]}),document.body):null;return l.jsxs(_.Fragment,{children:[l.jsx("div",{ref:B=>{ie.current[j.id]=B},className:`thread-group-shell ${Ln?"is-drag-placeholder":""}`,children:l.jsxs("section",{className:"thread-group",children:[l.jsxs("div",{className:"thread-group__header",children:[l.jsxs("button",{type:"button",className:"thread-group__title",onClick:()=>Ee(j.id),onPointerDown:B=>Ut(B,j.id,ke),onPointerMove:B=>at(B,j.id,ke),onPointerUp:B=>pn(B,j.id),onPointerCancel:B=>Un(B,j.id),"aria-expanded":Ve,title:Nt,children:[l.jsx("span",{className:"thread-group__chevron",children:l.jsx(F6,{open:Ve})}),l.jsx("span",{className:"thread-group__icon",children:l.jsx(H6,{})}),l.jsx("span",{className:"thread-group__title-text",children:Nt})]}),l.jsxs("div",{className:"thread-group__actions",children:[C?l.jsxs("div",{className:"thread-group__menu-anchor",children:[l.jsx("button",{type:"button",className:`thread-group__more ${qn||es?"is-open":""}`,onClick:B=>{if(B.stopPropagation(),c){gt(on=>on===j.id?null:j.id);return}St(j.id)},"aria-label":`${Nt} 更多选项`,children:l.jsx(jS,{})}),qn?l.jsxs("div",{className:"thread-group__menu",children:[l.jsx("button",{type:"button",className:"thread-group__menu-item",onClick:()=>la(j),children:"编辑名称"}),l.jsx("button",{type:"button",className:"thread-group__menu-item",disabled:$===j.id,onClick:()=>{C==null||C(j.id,Ht?"unarchive":"archive"),gt(null)},children:Ht?"取消归档":"归档线程"}),l.jsx("button",{type:"button",className:"thread-group__menu-item is-danger",disabled:$===j.id,onClick:()=>{C==null||C(j.id,"remove"),gt(null)},children:"移除"})]}):null]}):null,l.jsx("button",{type:"button",className:"thread-group__add",onClick:B=>{B.stopPropagation(),x(j.id,j.name)},"aria-label":`在 ${j.name} 下新增会话`,children:l.jsx(gS,{})})]})]}),Ve?z.length===0?l.jsx("div",{className:"thread-group__empty",children:"这个线程还没有会话"}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"thread-group__sessions",children:wn.map(B=>xa(B))}),kn?l.jsx("button",{type:"button",className:"thread-group__session-toggle",onClick:()=>xn(j.id),"aria-expanded":ct,children:ct?"折叠显示":"展开显示"}):null]}):null]},j.id)}),un]},j.id)},ls=j=>{if(!W||W.pane!==j)return null;const z=qe(j).find(ke=>ke.project.id===W.projectId);if(!z)return null;const ge={top:W.previewTop,width:`${W.itemWidth}px`},we=z.project.display_name??z.project.name;return l.jsx("div",{className:"thread-group-drag-preview",style:ge,"aria-hidden":"true",children:l.jsxs("div",{className:"thread-group-drag-preview__header",children:[l.jsx("span",{className:"thread-group-drag-preview__chevron",children:l.jsx(F6,{open:!0})}),l.jsx("span",{className:"thread-group-drag-preview__icon",children:l.jsx(H6,{})}),l.jsx("span",{className:"thread-group-drag-preview__title",children:we})]})})};return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`sidebar-scrim ${R?"is-visible":""}`,style:{opacity:c?0:a,pointerEvents:c?"none":R?"auto":"none",transition:r?"none":void 0},onClick:h,"aria-label":"关闭侧边栏"}),l.jsxs("aside",{className:`conversation-sidebar ${t?"is-open":""} ${c?"is-desktop-pinned":""} ${u?"is-resizing":""}`,style:{transform:c?"translateX(0)":`translateX(calc(-100% + ${Math.max(0,Math.min(a,1))*100}%))`,transition:r?"none":void 0},children:[c&&p?l.jsx("div",{className:"conversation-sidebar__resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"调整侧边栏宽度",onPointerDown:j=>{j.pointerType!=="touch"&&(j.preventDefault(),j.stopPropagation(),p(j.clientX))}}):null,l.jsxs("div",{className:"conversation-sidebar__header",children:[l.jsxs("div",{className:`conversation-sidebar__brand ${Q?`is-${ce?"online":"offline"}`:"is-empty"}`,"aria-label":Q?ce?"节点在线":"节点断开":"未选择节点",title:Q?ce?"节点在线":"节点断开":"未选择节点",children:[Q?l.jsx("span",{className:"conversation-sidebar__status-dot","aria-hidden":"true"}):null,l.jsx("span",{className:"conversation-sidebar__brand-name",children:(y==null?void 0:y.name)??"未选择节点"})]}),c?null:l.jsx("button",{type:"button",className:"conversation-sidebar__close",onClick:h,"aria-label":"关闭",children:"×"})]}),l.jsxs("div",{className:"conversation-sidebar__actions",children:[l.jsxs(_u,{to:"/nodes",className:"sidebar-action",onClick:h,children:[l.jsx("span",{className:"sidebar-action__icon",children:l.jsx(yS,{})}),l.jsx("span",{children:"节点列表"})]}),l.jsxs("button",{type:"button",className:"sidebar-action sidebar-action--primary",onClick:()=>{h();const j=m.find(z=>z.id===Ce)??m[0];j?x(j.id,j.name):H({to:"/nodes"})},children:[l.jsx("span",{className:"sidebar-action__icon",children:l.jsx(vS,{})}),l.jsx("span",{children:"新会话"})]})]}),l.jsx("div",{className:"conversation-sidebar__threads",children:l.jsxs("div",{className:"sidebar-pane-track",style:{transform:is},children:[l.jsxs("div",{ref:j=>{Z.current.threads=j},className:`sidebar-pane ${q==="threads"?"is-active":"is-inactive"}`,children:[kt.length>0?l.jsxs("div",{className:"sidebar-pinned",children:[l.jsx("div",{className:"conversation-sidebar__node",children:"置顶会话"}),l.jsx("div",{className:"sidebar-pinned__list",children:kt.map(j=>xa(j))})]}):null,l.jsxs("div",{className:"conversation-sidebar__node-row",children:[l.jsx("div",{className:"conversation-sidebar__node",children:"线程"}),w?l.jsx("button",{type:"button",className:"conversation-sidebar__node-action",onClick:w,"aria-label":"新增目录线程",title:"新增目录线程",children:l.jsx(_S,{})}):null]}),nn.map(j=>Vs(j,"threads")),ls("threads"),l.jsxs("button",{type:"button",className:"thread-archive__toggle",onClick:()=>Se("archived"),children:[l.jsx("span",{children:"已归档"}),l.jsx("span",{className:"thread-archive__icon",children:l.jsx(bS,{})})]})]}),l.jsxs("div",{ref:j=>{Z.current.archived=j},className:`sidebar-pane sidebar-pane--archived ${q==="archived"?"is-active":"is-inactive"}`,children:[l.jsx("div",{className:"conversation-sidebar__node",children:"已归档的线程"}),ln.length>0?l.jsx("div",{className:"thread-archive__list",children:ln.map(j=>Vs(j,"archived"))}):l.jsx("div",{className:"thread-archive__empty",children:"暂时没有已归档的线程"}),ls("archived"),l.jsxs("button",{type:"button",className:"thread-archive__back",onClick:()=>Se("threads"),"aria-label":"返回线程列表",children:[l.jsx("span",{className:"thread-archive__back-icon",children:l.jsx(xS,{})}),l.jsx("span",{children:"返回"})]})]})]})}),l.jsx("div",{className:"conversation-sidebar__footer",children:l.jsxs(_u,{to:"/settings",className:"sidebar-settings",onClick:h,"aria-label":"打开设置页",children:[l.jsx("span",{className:"sidebar-settings__icon",children:l.jsx(SS,{})}),l.jsx("span",{children:"设置"})]})})]}),Ci]})}),i0="optimistic-user:",DS="overlay-user:",OS=[i0,DS],LS=5e3,ir=n=>["timeline-optimistic",n],ih=n=>n.kind==="user"&&OS.some(t=>n.id.startsWith(t)),r0=n=>n.kind==="user"&&!ih(n),l0=n=>n.kind==="user"&&n.id.startsWith(i0),IS=n=>n.kind==="user"&&!l0(n),Q6=n=>n.body.replace(/\r\n/g,`
117
- `).trim(),G6=n=>new Date(n).getTime(),rh=(n,t)=>{if(Q6(n)!==Q6(t))return!1;const a=G6(n.timestamp),r=G6(t.timestamp);return!Number.isFinite(a)||!Number.isFinite(r)?!0:r>=a-LS},zS=(n,t)=>{const a=t.filter(r0);if(a.length===0)return new Set;const r=new Set,c=new Set;for(const u of n??[]){if(!ih(u))continue;const h=a.findIndex((p,y)=>!r.has(y)&&rh(u,p));h<0||(r.add(h),c.add(u.id))}return c},BS=(n,t)=>{const a=t.map((u,h)=>({entry:u,index:h})).filter(({entry:u})=>r0(u));if(a.length===0)return new Map;const r=new Set,c=new Map;for(const u of n??[]){if(!ih(u))continue;const h=a.find(({entry:p,index:y})=>!r.has(y)&&rh(u,p));h&&(r.add(h.index),(u.attachments??[]).length!==0&&c.set(h.index,P3(h.entry.attachments,u.attachments)))}return c},PS=(n,t)=>{const a=t.filter(IS);if(a.length===0)return new Set;const r=new Set,c=new Set;for(const u of n??[]){if(!l0(u))continue;const h=a.findIndex((p,y)=>!r.has(y)&&rh(u,p));h<0||(r.add(h),c.add(u.id))}return c},US=n=>{const t=[...n??[]],a=t.map((u,h)=>({entry:u,index:h})).filter(({entry:u})=>r0(u));if(a.length===0)return t;const r=new Set,c=new Set;for(const u of t){if(!ih(u))continue;const h=a.find(({entry:p,index:y})=>!r.has(y)&&rh(u,p));h&&(r.add(h.index),c.add(u.id))}return c.size===0?t:t.filter(u=>!c.has(u.id))},fy=(n,t)=>[...n??[],t],hy=(n,t)=>{const a=BS(n,t),r=zS(n,t),c=[...n??[]].filter(h=>!r.has(h.id)),u=new Set(c.map(h=>h.id));for(const[h,p]of t.entries())u.has(p.id)||(u.add(p.id),c.push(a.has(h)?{...p,attachments:a.get(h)??p.attachments}:p));return c},bp=(n,t)=>[...hy(n,t)].sort((a,r)=>{const c=new Date(a.timestamp).getTime(),u=new Date(r.timestamp).getTime();return!Number.isFinite(c)||!Number.isFinite(u)?0:c-u}),Cf=(n,t)=>(n??[]).filter(a=>l0(a)&&!PS([a],t).has(a.id)),qS=(n,t)=>{const a=US(n),r=Cf(t,a);return bp(r,a)},$S=(n,t)=>(n??[]).filter(a=>a.id!==t),my="panda:session-model",py="panda:command-execution-model",o0="panda:session-model-options",xp="panda:session-model-options-updated",gy="panda:session-reasoning",yy="panda:session-fast-mode",vy="panda:session-plan-mode",Ko=[{id:"gpt-5.4",label:"gpt-5.4",value:"gpt-5.4"},{id:"gpt-5.3-codex",label:"gpt-5.3-codex",value:"gpt-5.3-codex"},{id:"gpt-5.3",label:"gpt-5.3",value:"gpt-5.3"},{id:"gpt-5.4-mini",label:"gpt-5.4-mini",value:"gpt-5.4-mini"},{id:"gpt-5.2",label:"gpt-5.2",value:"gpt-5.2"}],Du=[{label:"低",value:"low"},{label:"中",value:"medium"},{label:"高",value:"high"},{label:"极高",value:"xhigh"}];var F2;const _y=((F2=Ko[0])==null?void 0:F2.value)??"gpt-5.4",V6="gpt-5.4-mini",HS=Du[2].value,xi=n=>typeof n=="string"?n.trim():"",FS=(n,t)=>{if(!n||typeof n!="object")return null;const a=n,r=xi(a.value),c=xi(a.label)||r,u=xi(a.id)||r||`custom-model-${t+1}`;if(!c||!r)return null;const h=xi(a.description);return{id:u,label:c,value:r,description:h||null}},QS=n=>{const t=new Set,a=new Set;return n.flatMap(r=>{const c=r.value.toLowerCase();if(a.has(c))return[];a.add(c);let u=r.id,h=2;for(;t.has(u);)u=`${r.id}-${h}`,h+=1;return t.add(u),[{...r,id:u}]})},by=n=>{if(!Array.isArray(n))return Ko;const t=QS(n.flatMap((a,r)=>{const c=FS(a,r);return c?[c]:[]}));return t.length>0?t:Ko},Hu=n=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(n)}catch{return null}},GS=()=>{typeof window>"u"||window.dispatchEvent(new Event(xp))},Fu=(n,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n,t)}catch{}},xy=(n,t=!1)=>{const a=Hu(n);return a==="true"?!0:a==="false"?!1:t},Sy=(n,t)=>{Fu(n,t?"true":"false")},lh=(n,t)=>{const a=t==null?void 0:t.trim();return a?`${n}:${a}`:null},cu=n=>{const t=xi(n==null?void 0:n.value)||"",a=xi(n==null?void 0:n.label)||t;return{id:xi(n==null?void 0:n.id)||xi(n==null?void 0:n.value)||`custom-model-${Date.now()}`,label:a,value:t,description:xi(n==null?void 0:n.description)||null}},VS=()=>oh().map(({id:n,...t})=>t),oh=()=>{const n=Hu(o0);if(!n)return Ko;try{return by(JSON.parse(n))}catch{return Ko}},KS=n=>{const t=by(n);Fu(o0,JSON.stringify(t)),GS()},YS=n=>Du.some(t=>t.value===n),c0=()=>{var a;const n=Hu(my),t=oh();return t.some(r=>r.value===n)?n:((a=t[0])==null?void 0:a.value)??_y},Tf=()=>{const n=Hu(py),t=oh();if(t.some(r=>r.value===n))return n;const a=t.find(r=>r.value===V6)??t[0];return(a==null?void 0:a.value)??V6},jy=()=>{const n=Hu(gy);return YS(n)?n:HS},bu=n=>{Fu(my,n)},O1=n=>{Fu(py,n)},wy=n=>{Fu(gy,n)},K6=n=>{const t=lh(yy,n);return t?xy(t):!1},Y6=n=>{const t=lh(vy,n);return t?xy(t):!1},ky=(n,t)=>{const a=lh(yy,n);a&&Sy(a,t)},Ny=(n,t)=>{const a=lh(vy,n);a&&Sy(a,t)},ZS=(n,t)=>{ky(n,t.isFastModeEnabled),Ny(n,t.isPlanModeEnabled)},Zf=(n,t=VS())=>{var a,r;return((a=t.find(c=>c.value===n))==null?void 0:a.label)??(typeof n=="string"&&n.trim()?n.trim():((r=t[0])==null?void 0:r.label)??_y)},WS=n=>{var t;return((t=Du.find(a=>a.value===n))==null?void 0:t.label)??Du[2].label},Cy="image/",XS=()=>`attachment-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,JS=n=>new Promise((t,a)=>{const r=new FileReader;r.onerror=()=>a(r.error??new Error("无法读取文件")),r.onload=()=>{if(typeof r.result=="string"&&r.result){t(r.result);return}a(new Error("无法读取文件"))},r.readAsDataURL(n)}),Ty=async n=>({id:XS(),kind:n.type.startsWith(Cy)?"image":"file",name:n.name,mime_type:n.type||null,size_bytes:Number.isFinite(n.size)?Math.max(0,Math.round(n.size)):null,data_url:await JS(n)}),Z6=n=>{var t;return n.kind==="image"||!!((t=n.mime_type)!=null&&t.startsWith(Cy))},Ey=n=>B3((n??[]).map((t,a)=>({id:t.id||`attachment-${a}`,kind:t.kind,name:t.name,mime_type:t.mime_type??null,size_bytes:t.size_bytes??null,content_url:t.data_url}))),Sp=n=>typeof n!="number"||!Number.isFinite(n)||n<=0?null:n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`,ej=/\[[^\]]+\]\([^)]+\)|`[^`\n]+`|\*\*.+?\*\*|\*[^*\n][^*\n]*\*|\$[A-Za-z0-9._-]+|\/[A-Za-z][A-Za-z0-9._-]*/g,tj=/^[A-Za-z0-9._-]$/,nj=/^[A-Za-z0-9._-]$/,jp=n=>/\s/.test(n),W6=n=>tj.test(n),sj=n=>nj.test(n),Qs=n=>n.trim().toLowerCase(),aj=n=>Qs(n).split(/[^a-z0-9]+/i).filter(Boolean),X6=n=>n==="repo"?0:n==="user"?1:2,ij=n=>n==="repo"?"项目":n==="user"?"个人":"系统",My=n=>{const t=[];let a=0;for(const r of n.matchAll(ej)){const c=r[0],u=r.index??0;if(c.startsWith("$")){const h=u>0?n[u-1]??"":"";if(u>0&&!jp(h))continue}if(c.startsWith("/")){const h=u>0?n[u-1]??"":"";if(u>0&&!jp(h))continue}if(u>a&&t.push({kind:"text",value:n.slice(a,u)}),c.startsWith("`")&&c.endsWith("`"))t.push({kind:"code",value:c.slice(1,-1)});else if(c.startsWith("**")&&c.endsWith("**"))t.push({kind:"strong",value:c.slice(2,-2)});else if(c.startsWith("*")&&c.endsWith("*"))t.push({kind:"emphasis",value:c.slice(1,-1)});else if(c.startsWith("[")){const h=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c);h?t.push({kind:"path-link",label:h[1]??"",path:h[2]??""}):t.push({kind:"text",value:c})}else c.startsWith("/")?t.push({kind:"command",raw:c,name:c.slice(1)}):t.push({kind:"skill",raw:c,name:c.slice(1)});a=u+c.length}return a<n.length&&t.push({kind:"text",value:n.slice(a)}),t},Ry=(n,t,a=t)=>{if(t!==a)return null;let r=t;for(;r>0&&W6(n[r-1]??"");)r-=1;const c=r-1;if(c<0||n[c]!=="$")return null;const u=c>0?n[c-1]??"":"";if(c>0&&!jp(u))return null;let h=t;for(;h<n.length&&W6(n[h]??"");)h+=1;return{start:c,end:h,query:n.slice(c+1,t)}},rj=(n,t,a,r)=>{const c=Ry(n,t,a);if(!c)return null;const p=(n[c.end]??"").length===0?`$${r} `:`$${r}`,y=`${n.slice(0,c.start)}${p}${n.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},u0=n=>n.startsWith("/"),Ay=(n,t,a=t)=>{if(!u0(n)||t!==a)return null;const r=n.search(/\s/),c=r<0?n.length:r;if(t>c)return null;let u=1;for(;u<n.length&&sj(n[u]??"");)u+=1;return t>u?null:{start:0,end:u,query:n.slice(1,t)}},lj=(n,t,a,r)=>{const c=Ay(n,t,a);if(!c)return null;const p=(n[c.end]??"").length===0?`/${r} `:`/${r}`,y=`${n.slice(0,c.start)}${p}${n.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},oj=(n,t)=>{const a=Qs(t),r=n.filter(u=>{if(!u.enabled)return!1;if(!a)return!0;const h=Qs(u.name),p=Qs(u.description);return h.includes(a)||p.includes(a)}),c=u=>{if(!a)return 0;const h=Qs(u.name),p=Qs(u.description),y=aj(u.name);return h===a?0:y.some(m=>m===a)?1:h.startsWith(a)?2:y.some(m=>m.startsWith(a))?3:h.includes(a)?4:p.startsWith(a)?5:6};return[...r].sort((u,h)=>{const p=c(u),y=c(h);if(p!==y)return p-y;const m=X6(u.scope)-X6(h.scope);if(m!==0)return m;const b=Qs(u.name),g=Qs(h.name);return b.localeCompare(g)})},cj=(n,t)=>{const a=Qs(t);return[...n.filter(c=>{if(!a)return!0;const u=Qs(c.name),h=Qs(c.description);return u.includes(a)||h.includes(a)})].sort((c,u)=>{const h=Qs(c.name),p=Qs(u.name),y=h===a?0:h.startsWith(a)?1:2,m=p===a?0:p.startsWith(a)?1:2;return y!==m?y-m:c.availability!==u.availability?c.availability==="supported"?-1:1:h.localeCompare(p)})},uj=n=>{if(typeof window>"u")return()=>{};const t=r=>{(r.key===null||r.key===o0)&&n()},a=()=>{n()};return window.addEventListener("storage",t),window.addEventListener(xp,a),()=>{window.removeEventListener("storage",t),window.removeEventListener(xp,a)}},dj=()=>oh(),fj=()=>Ko,d0=()=>_.useSyncExternalStore(uj,dj,fj),f0=n=>n.replace(/[\\/]+$/,""),Wf=n=>f0(n).replace(/\\/g,"/").toLowerCase(),hj=n=>{const t=f0(n.trim());if(!t)return"新线程";const a=t.split(/[\\/]+/).filter(Boolean),r=a[a.length-1];return r?r.endsWith(":")?t:r:t},mj=n=>{if(!n)return null;const t=n.trim();if(!t||t==="/"||/^[A-Za-z]:[\\/]?$/.test(t))return null;const a=f0(t),r=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));if(r<0)return null;const c=a.slice(0,r);return c?/^[A-Za-z]:$/.test(c)?`${c}\\`:c:a.startsWith("/")?"/":null},pj=async n=>(await Jn({agentId:n.agentId})).client.listDirectories(n),gj=async n=>{const t=n.bootstrapQueryKey??["bootstrap"],a=n.projects.find(u=>u.agent_id===n.agentId&&Wf(u.path)===Wf(n.path));if(a)return n.queryClient.setQueryData(t,u=>q6(u,a)),a;const c=await(await Jn({agentId:n.agentId})).client.createProject({agentId:n.agentId,name:hj(n.path),path:n.path});return n.queryClient.setQueryData(t,u=>q6(u,c.project)),n.queryClient.invalidateQueries({queryKey:t}),c.project},J6=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),yj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),vj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),e2=n=>!!(n&&/^[A-Za-z]:[\\/]?$/.test(n.trim())),_j=({agentId:n,projects:t,initialPath:a=null,title:r="选择目录",subtitle:c="线程名会使用目录最后一级名称",confirmLabel:u="选择此目录",cancelLabel:h="返回上级",onProjectCreated:p})=>{const y=Tl(),[m,b]=_.useState(a),[g,x]=_.useState(a),[w,N]=_.useState([]),[T,C]=_.useState(!0),[I,$]=_.useState(null);_.useEffect(()=>{b(a),x(a)},[a]),_.useEffect(()=>{let F=!1;return C(!0),$(null),pj({agentId:n,path:m}).then(_e=>{F||N(_e)}).catch(_e=>{F||($(_e instanceof Error?_e.message:"目录列表加载失败"),N([]))}).finally(()=>{F||C(!1)}),()=>{F=!0}},[n,m]);const H=Vn({mutationFn:async F=>gj({agentId:n,path:F,projects:t,queryClient:y,bootstrapQueryKey:dt}),onSuccess:F=>{p(F)}}),R=_.useMemo(()=>{const F=new Map;for(const _e of t)F.set(Wf(_e.path),_e);return F},[t]),Q=_.useMemo(()=>g?R.get(Wf(g))??null:null,[R,g]),ce=u!=="选择此目录"?u:Q?"在线程中继续":"创建新线程",Z=mj(m),ie=Z!==null||e2(m),ee=()=>{if(Z!==null){b(Z),x(Z);return}e2(m)&&(b(null),x(null))},Y=F=>{b(F),x(F)};return l.jsx("section",{className:"directory-picker",children:l.jsxs("div",{className:"directory-picker__panel",children:[l.jsx("header",{className:"directory-picker__header",children:l.jsxs("div",{className:"directory-picker__heading",children:[l.jsx("h2",{children:r}),c?l.jsx("p",{children:c}):null]})}),l.jsxs("div",{className:"directory-picker__field",children:[l.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),l.jsxs("button",{type:"button",className:`directory-picker__path ${g===m?"is-selected":""}`,onClick:()=>{m&&x(m)},disabled:!m,"aria-pressed":g===m,children:[l.jsx("span",{className:"directory-picker__path-icon",children:l.jsx(J6,{})}),l.jsx("span",{className:"directory-picker__path-value",children:m??"根目录"})]})]}),l.jsxs("div",{className:"directory-picker__field",children:[l.jsx("span",{className:"directory-picker__field-label",children:"目录"}),l.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:T?l.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):I?l.jsx("div",{className:"directory-picker__state is-error",children:I}):w.length===0?l.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):w.map(F=>{const _e=g===F.path;return l.jsx("div",{className:`directory-picker__row ${_e?"is-selected":""}`,children:l.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:je=>{const ae=je.target;if(F.has_children&&ae.closest('[data-enter-directory="true"]')){Y(F.path);return}x(F.path)},onDoubleClick:()=>{F.has_children&&Y(F.path)},"aria-selected":_e,children:[l.jsx("span",{className:"directory-picker__row-icon",children:l.jsx(J6,{})}),l.jsx("span",{className:"directory-picker__row-name",children:F.name}),F.has_children?l.jsx("span",{className:"directory-picker__row-enter","data-enter-directory":"true","aria-hidden":"true",children:l.jsx(yj,{})}):_e?l.jsx("span",{className:"directory-picker__row-check",children:l.jsx(vj,{})}):null]})},F.path)})})]}),H.error?l.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:H.error instanceof Error?H.error.message:"创建线程失败"}):null,l.jsx("footer",{className:"directory-picker__footer",children:l.jsxs("div",{className:"directory-picker__footer-actions",children:[ie?l.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:ee,children:l.jsx("span",{children:h})}):null,l.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!g||H.isPending,onClick:()=>{g&&H.mutate(g)},children:H.isPending?"创建中…":ce})]})})]})})},bj=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 281.999849615234 85.965369875" width="281.999849615234" height="85.965369875" role="img" aria-label="Panda wordmark">
116
+ */const pS=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],gS=oy("trash-2",pS),yS=180*1e3,cy=8640*60*1e3,To=6,uy="panda:completed-session-seen-at",R1=6,vS=220,H6=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),_S=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),bS=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"4",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"15",y:"4",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"3",y:"14",width:"6",height:"6",rx:"1.5"}),l.jsx("rect",{x:"15",y:"14",width:"6",height:"6",rx:"1.5"})]}),xS=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v6A2.5 2.5 0 0 1 16.5 15H11l-4.5 4v-4H7.5A2.5 2.5 0 0 1 5 12.5z"})}),SS=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"}),l.jsx("path",{d:"M16.5 10.5v5"}),l.jsx("path",{d:"M14 13h5"})]}),F6=({open:n})=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:n?"is-open":"",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),jS=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),wS=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m15 6-6 6 6 6"})}),kS=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M10.33 4.32c.6-1.76 2.74-1.76 3.34 0a1.78 1.78 0 0 0 2.66 1l.18-.1c1.6-.92 3.4.88 2.48 2.48l-.1.18a1.78 1.78 0 0 0 1 2.66c1.76.6 1.76 2.74 0 3.34a1.78 1.78 0 0 0-1 2.66l.1.18c.92 1.6-.88 3.4-2.48 2.48l-.18-.1a1.78 1.78 0 0 0-2.66 1c-.6 1.76-2.74 1.76-3.34 0a1.78 1.78 0 0 0-2.66-1l-.18.1c-1.6.92-3.4-.88-2.48-2.48l.1-.18a1.78 1.78 0 0 0-1-2.66c-1.76-.6-1.76-2.74 0-3.34a1.78 1.78 0 0 0 1-2.66l-.1-.18c-.92-1.6.88-3.4 2.48-2.48l.18.1a1.78 1.78 0 0 0 2.66-1Z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.15"})]}),NS=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),CS=n=>{const t=Date.now(),a=new Date(n).getTime(),r=Math.max(0,t-a),c=60*1e3,u=60*c,h=24*u;return r<u?`${Math.max(1,Math.floor(r/c))}分钟`:r<h?`${Math.max(1,Math.floor(r/u))}小时`:`${Math.max(1,Math.floor(r/h))}天`},A1=n=>n.run_state==="completed"&&n.run_state_changed_at&&Date.now()-new Date(n.run_state_changed_at).getTime()>yS?"idle":n.run_state??"idle",TS=(n,t)=>n.archived||n.id===t||Date.now()-new Date(n.last_event_at).getTime()<=cy,ES=(n,t)=>Number(t.pinned)-Number(n.pinned)||+new Date(t.last_event_at)-+new Date(n.last_event_at),MS=(n,t)=>n.id===t||Date.now()-new Date(n.last_event_at).getTime()<=cy,RS=(n,t)=>{if(n.length<=To)return n;if(!t)return n.slice(0,To);const a=n.findIndex(r=>r.id===t);return a===-1||a<To?n.slice(0,To):[...n.slice(0,To-1),n[a]]},AS=()=>{if(typeof window>"u")return{};try{const n=window.localStorage.getItem(uy);if(!n)return{};const t=JSON.parse(n);return t&&typeof t=="object"?t:{}}catch{return{}}},D1=(n,t)=>n.length===t.length&&n.every((a,r)=>a===t[r]),DS=(n,t)=>{if(!t||t.length===0||n.length<=1)return n;const a=new Map(n.map(u=>[u.id,u])),r=new Set,c=[];for(const u of t){const h=a.get(u);!h||r.has(u)||(r.add(u),c.push(h))}for(const u of n)r.has(u.id)||c.push(u);return c},OS=(n,t,a)=>{if(t<0||t>=n.length||a<0||a>=n.length||t===a)return n;const r=[...n],[c]=r.splice(t,1);return c?(r.splice(a,0,c),r):n},LS=(n,t,a)=>{if(t.length===0)return n;const r=new Set(t);let c=0;return n.map(u=>{if(!r.has(u))return u;const h=a[c]??u;return c+=1,h})},dy=_.memo(function({open:t,progress:a=t?1:0,isDragging:r=!1,desktopPinned:c=!1,isDesktopResizing:u=!1,onClose:h,onDesktopResizeStart:p,currentAgent:y,projects:m,sessions:b,activeSessionId:g,onCreateSession:x,onCreateDirectoryThread:w,onSelectSession:N,onSessionAction:T,onThreadAction:C,pendingSessionActionId:I,pendingThreadActionId:$}){const H=Mr(),R=a>.001,Q=!!y,ce=(y==null?void 0:y.status)==="online",Z=_.useRef({threads:null,archived:null}),ie=_.useRef({}),ee=_.useRef(null),Y=_.useRef(null),F=_.useRef(null),_e=_.useRef(null),je=_.useRef({}),ae=_.useRef(null),[ue,E]=_.useState({}),[U,te]=_.useState(null),[W,xe]=_.useState(null),A=_.useMemo(()=>b.map(j=>{const z=ue[j.id];return z?{...j,...z.pinned===void 0?null:{pinned:z.pinned}}:j}).filter(j=>{var z;return!((z=ue[j.id])!=null&&z.hidden)}),[ue,b]),ne=(W==null?void 0:W.nextGlobalProjectIds)??U,be=_.useMemo(()=>DS(m,ne),[m,ne]),V=_.useMemo(()=>A.filter(j=>!j.subagent&&TS(j,g)),[g,A]),pe=V.find(j=>j.id===g),Ce=pe==null?void 0:pe.project_id,[Le,he]=_.useState(Ce?[Ce]:[]),[q,Se]=_.useState("threads"),[Ne,me]=_.useState(null),[Te,Ge]=_.useState(null),[Ue,gt]=_.useState(null),[Lt,St]=_.useState(null),[st,tn]=_.useState([]),[$t,de]=_.useState(null),[Ae,Re]=_.useState(""),[Oe,Ke]=_.useState(()=>AS()),mt=_.useMemo(()=>V.filter(j=>!j.archived),[V]),kt=_.useMemo(()=>mt.filter(j=>j.pinned).sort((j,z)=>+new Date(z.last_event_at)-+new Date(j.last_event_at)),[mt]),rn=_.useMemo(()=>mt.filter(j=>!j.pinned),[mt]),Pn=_.useMemo(()=>V.filter(j=>j.archived),[V]),On=j=>be.map(z=>{var Ve;const we=j.filter(ct=>ct.project_id===z.id).sort((ct,Nt)=>ES(ct,Nt)).filter(ct=>MS(ct,g)),ke=((Ve=we[0])==null?void 0:Ve.last_event_at)??new Date(0).toISOString();return{project:z,threadSessions:we,collapsedThreadSessions:RS(we,g),hiddenSessionCount:Math.max(0,we.length-To),latestEventAt:ke}}).filter(({threadSessions:z})=>z.length>0),nn=_.useMemo(()=>On(rn),[g,be,rn]),ln=_.useMemo(()=>On(Pn),[g,Pn,be]);_.useEffect(()=>{E(j=>{let z=!1;const ge={...j};for(const[we,ke]of Object.entries(j)){const Ve=b.find(Nt=>Nt.id===we);if(!Ve){ke.hidden&&(delete ge[we],z=!0);continue}(ke.pinned===void 0||Ve.pinned===ke.pinned)&&!ke.hidden&&(delete ge[we],z=!0)}return z?ge:j})},[b]),_.useEffect(()=>{te(j=>{if(!j)return j;const z=m.map(we=>we.id),ge=[...j.filter(we=>z.includes(we)),...z.filter(we=>!j.includes(we))];return D1(ge,z)?null:ge})},[m]),_.useEffect(()=>{Ce&&he(j=>j.includes(Ce)?j:[...j,Ce])},[Ce]),_.useEffect(()=>{Se(pe!=null&&pe.archived?"archived":"threads")},[pe==null?void 0:pe.archived,g]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(uy,JSON.stringify(Oe))}catch{}},[Oe]),_.useEffect(()=>{t||c||(gt(null),St(null),de(null),Ge(null))},[c,t]),_.useEffect(()=>{if(!c||!Ue)return;const j=z=>{const ge=z.target;if(!(ge instanceof Element)){gt(null);return}ge.closest(".thread-group__menu-anchor")||ge.closest(".thread-group__menu")||gt(null)};return window.addEventListener("pointerdown",j),()=>{window.removeEventListener("pointerdown",j)}},[c,Ue]),_.useEffect(()=>{if(!g)return;const j=V.find(ge=>ge.id===g);if(!j||A1(j)!=="completed"||!j.run_state_changed_at)return;const z=j.run_state_changed_at;Ke(ge=>ge[j.id]===z?ge:{...ge,[j.id]:z})},[g,V]),_.useEffect(()=>()=>{ee.current!==null&&globalThis.clearTimeout(ee.current),ae.current!==null&&window.cancelAnimationFrame(ae.current)},[]),_.useEffect(()=>{F.current=W},[W]),_.useLayoutEffect(()=>{if(typeof window>"u")return;const j={},z=[];for(const[ge,we]of Object.entries(ie.current)){if(!we)continue;const ke=we.offsetTop;if(j[ge]=ke,(W==null?void 0:W.projectId)===ge)continue;const Ve=je.current[ge];if(Ve===void 0)continue;const ct=Ve-ke;Math.abs(ct)<.5||(we.style.transition="none",we.style.transform=`translateY(${ct}px)`,z.push(we))}ae.current!==null&&window.cancelAnimationFrame(ae.current),z.length>0&&(ae.current=window.requestAnimationFrame(()=>{for(const ge of z)ge.style.transition="",ge.style.transform=""})),je.current=j},[nn,ln,Le,st,W==null?void 0:W.projectId,ne]);const oe=()=>{ee.current!==null&&(globalThis.clearTimeout(ee.current),ee.current=null)},qe=j=>j==="threads"?nn:ln,De=(j,z,ge,we,ke)=>{const Ve=Z.current[z],ct=ie.current[j];if(!Ve||!ct)return!1;const Nt=qe(z).map(sn=>sn.project.id),qn=Nt.indexOf(j);if(qn===-1)return!1;const es=be.map(sn=>sn.id),Ht=Ve.getBoundingClientRect(),wn=ct.getBoundingClientRect(),kn=ct.offsetHeight,Ln=ct.offsetWidth,un=ke-wn.top,B=Ve.scrollTop,on=Math.max(B,Ve.scrollTop+Ve.clientHeight-kn),gn=Math.max(B,Math.min(on,Ve.scrollTop+ke-Ht.top-un)),yn={pane:z,projectId:j,pointerId:ge,pointerType:we,originIndex:qn,visibleProjectIds:Nt,nextVisibleProjectIds:Nt,nextGlobalProjectIds:es,previewTop:gn,itemHeight:kn,itemWidth:Ln,pointerOffsetY:un};return F.current=yn,xe(yn),_e.current=j,!0},Ie=j=>{xe(z=>{if(!z)return z;F.current=z;const ge=Z.current[z.pane];if(!ge||!ie.current[z.projectId])return z;const we=ge.getBoundingClientRect(),ke=ge.scrollTop,Ve=Math.max(ke,ge.scrollTop+ge.clientHeight-z.itemHeight),ct=Math.max(ke,Math.min(Ve,ge.scrollTop+j-we.top-z.pointerOffsetY)),Nt=ct+z.itemHeight/2,qn=z.nextVisibleProjectIds,es=qn.indexOf(z.projectId);if(es===-1)return z;const Ht=qn.filter(gn=>gn!==z.projectId);let wn=0;const kn=Ht[0],Ln=kn?ie.current[kn]:null;if(Ln&&ct<=Ln.offsetTop+Ln.offsetHeight*.42)wn=0;else for(let gn=0;gn<Ht.length;gn+=1){const yn=Ht[gn],sn=yn?ie.current[yn]:null;if(!sn){wn=gn+1;continue}const Ft=sn.offsetTop+sn.offsetHeight/2;if(Nt<=Ft){wn=gn;break}wn=gn+1}const un=OS(qn,es,wn),B=LS(z.nextGlobalProjectIds,z.visibleProjectIds,un);if(ct===z.previewTop&&D1(un,z.nextVisibleProjectIds))return z;const on={...z,previewTop:ct,nextVisibleProjectIds:un,nextGlobalProjectIds:B};return F.current=on,on})},We=j=>{oe(),Y.current=null;const z=j??F.current;if(F.current=null,xe(null),!z||!!D1(z.visibleProjectIds,z.nextVisibleProjectIds)||!C)return;const we=U??be.map(Ve=>Ve.id),ke=z.nextGlobalProjectIds;te(ke),Promise.resolve(C(z.projectId,"reorder",{orderedProjectIds:ke})).catch(()=>{te(we)})},$e=()=>{oe(),Y.current=null,F.current=null,xe(null)};_.useEffect(()=>{if(typeof window>"u"||!F.current)return;const j=we=>{const ke=F.current;!ke||ke.pointerId!==we.pointerId||Ie(we.clientY)},z=we=>{const ke=F.current;!ke||ke.pointerId!==we.pointerId||We(ke)},ge=we=>{const ke=F.current;!ke||ke.pointerId!==we.pointerId||$e()};return window.addEventListener("pointermove",j),window.addEventListener("pointerup",z),window.addEventListener("pointercancel",ge),()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",ge)}},[W==null?void 0:W.pointerId]);const He=j=>{he(z=>z.includes(j)?z.filter(ge=>ge!==j):[...z,j])},Ee=j=>{if(_e.current===j){_e.current=null;return}He(j)},Ut=(j,z,ge)=>{if(j.pointerType==="mouse"&&j.button!==0)return;oe();const we=j.currentTarget;Y.current={pane:ge,projectId:z,pointerId:j.pointerId,pointerType:j.pointerType,startX:j.clientX,startY:j.clientY,currentX:j.clientX,currentY:j.clientY},j.pointerType!=="touch"&&we.setPointerCapture(j.pointerId),j.pointerType==="touch"&&(ee.current=globalThis.setTimeout(()=>{const ke=Y.current;if(!ke||ke.projectId!==z||ke.pointerId!==j.pointerId)return;we.hasPointerCapture(j.pointerId)||we.setPointerCapture(j.pointerId),De(z,ge,j.pointerId,j.pointerType,ke.currentY)&&Ie(ke.currentY)},vS))},at=(j,z,ge)=>{const we=Y.current;if(!we||we.projectId!==z||we.pointerId!==j.pointerId||we.pane!==ge)return;if(we.currentX=j.clientX,we.currentY=j.clientY,(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){j.preventDefault(),Ie(j.clientY);return}const ke=j.clientX-we.startX,Ve=j.clientY-we.startY;if(we.pointerType==="touch"){(Math.abs(ke)>R1||Math.abs(Ve)>R1)&&oe();return}Math.abs(Ve)<R1||Math.abs(Ve)<Math.abs(ke)||!De(z,ge,j.pointerId,j.pointerType,j.clientY)||(j.preventDefault(),Ie(j.clientY))},pn=(j,z)=>{if(j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId),(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){j.preventDefault(),We();return}oe(),Y.current=null},Un=(j,z)=>{if(j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId),(W==null?void 0:W.projectId)===z&&W.pointerId===j.pointerId){$e();return}oe(),Y.current=null},xn=j=>{tn(z=>z.includes(j)?z.filter(ge=>ge!==j):[...z,j])},ps=j=>{if(A1(j)!=="completed"||!j.run_state_changed_at)return;const z=j.run_state_changed_at;Ke(ge=>ge[j.id]===z?ge:{...ge,[j.id]:z})},is=`translateX(-${(q==="threads"?0:1)*50}%)`,Ci=$t&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{de(null),Re("")},"aria-label":"关闭重命名面板"}),l.jsx("div",{className:"sheet-wrap__center",children:l.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[l.jsx("div",{className:"sheet-panel__title",children:"编辑线程名称"}),l.jsx("input",{className:"sheet-panel__input",value:Ae,onChange:j=>Re(j.target.value),placeholder:"输入线程名称",autoFocus:!0}),l.jsxs("div",{className:"sheet-panel__actions",children:[l.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{de(null),Re("")},children:"取消"}),l.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!Ae.trim()||$===$t,onClick:()=>{Gs()},children:"保存"})]})]})})]}),document.body):null,la=j=>{gt(null),St(null),de(j.id),Re(j.display_name??j.name)},Gs=async()=>{!$t||!Ae.trim()||!C||(await C($t,"rename",{name:Ae.trim()}),de(null),Re(""))},rs=(j,z,ge)=>{if(!T)return;const we=ue[j.id];z==="pin"||z==="unpin"?E(Ve=>({...Ve,[j.id]:{...Ve[j.id],pinned:z==="pin"}})):z==="delete"&&E(Ve=>({...Ve,[j.id]:{...Ve[j.id],hidden:!0}}));const ke=T(j.id,z,ge);ke&&typeof ke.then=="function"&&ke.catch(()=>{E(Ve=>{const ct={...Ve};return we?ct[j.id]=we:delete ct[j.id],ct})})},xa=j=>{const z=A1(j),ge=z==="completed"&&j.id!==g&&!!j.run_state_changed_at&&Oe[j.id]!==j.run_state_changed_at,we=c&&Ne===j.id,ke=!!T&&we,Ve=Te===j.id,ct=c&&(ke||Ve);return l.jsxs("div",{className:`thread-session ${j.id===g?"is-active":""}`,onMouseEnter:()=>me(j.id),onMouseLeave:()=>{me(Nt=>Nt===j.id?null:Nt),Ge(Nt=>Nt===j.id?null:Nt)},children:[l.jsx("button",{type:"button",className:`thread-session__icon-button ${ke?"is-visible":""} ${j.pinned?"is-active":""}`,disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),rs(j,j.pinned?"unpin":"pin")},"aria-label":j.pinned?"取消置顶会话":"置顶会话",title:j.pinned?"取消置顶":"置顶",children:l.jsx(mS,{strokeWidth:j.pinned?2.1:1.95})}),l.jsxs("div",{className:"thread-session__row",children:[N?l.jsxs("button",{type:"button",className:"thread-session__link thread-session__link--button",title:j.title,onClick:()=>{ps(j),N(j.id),h()},children:[l.jsx("span",{className:`thread-session__status is-${ge?"completed":z} ${ge?"is-unread":""} ${ct?"is-hidden":""}`,"aria-hidden":"true"}),l.jsx("div",{className:"thread-session__title",children:j.title})]}):l.jsxs(_u,{to:"/session/$sessionId",params:{sessionId:j.id},title:j.title,onClick:()=>{ps(j),h()},className:"thread-session__link",children:[l.jsx("span",{className:`thread-session__status is-${ge?"completed":z} ${ge?"is-unread":""} ${ct?"is-hidden":""}`,"aria-hidden":"true"}),l.jsx("div",{className:"thread-session__title",children:j.title})]}),l.jsx("div",{className:"thread-session__meta",children:c&&we&&T?Ve?l.jsx("button",{type:"button",className:"thread-session__delete-confirm",disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),rs(j,"delete")},children:"确认"}):l.jsx("button",{type:"button",className:"thread-session__delete",disabled:I===j.id,onClick:Nt=>{Nt.stopPropagation(),Ge(j.id)},"aria-label":`删除 ${j.title}`,children:l.jsx(gS,{strokeWidth:1.95})}):l.jsx("span",{className:"thread-session__time",children:CS(j.last_event_at)})})]})]},j.id)},Vs=({project:j,threadSessions:z,collapsedThreadSessions:ge,hiddenSessionCount:we},ke)=>{const Ve=Le.includes(j.id),ct=st.includes(j.id),Nt=j.display_name??j.name,qn=!!C&&c&&Ue===j.id,es=!!C&&Lt===j.id,Ht=z.every(B=>B.archived),wn=ct?z:ge,kn=we>0,Ln=(W==null?void 0:W.projectId)===j.id&&W.pane===ke,un=es&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>St(null),"aria-label":"关闭线程菜单"}),l.jsxs("div",{className:"sheet-panel",children:[l.jsx("div",{className:"sheet-panel__title",children:Nt}),l.jsx("button",{type:"button",className:"sheet-panel__item",onClick:()=>la(j),children:"编辑名称"}),l.jsx("button",{type:"button",className:"sheet-panel__item",disabled:$===j.id,onClick:()=>{C==null||C(j.id,Ht?"unarchive":"archive"),St(null)},children:Ht?"取消归档":"归档线程"}),l.jsx("button",{type:"button",className:"sheet-panel__item is-danger",disabled:$===j.id,onClick:()=>{C==null||C(j.id,"remove"),St(null)},children:"移除"})]})]}),document.body):null;return l.jsxs(_.Fragment,{children:[l.jsx("div",{ref:B=>{ie.current[j.id]=B},className:`thread-group-shell ${Ln?"is-drag-placeholder":""}`,children:l.jsxs("section",{className:"thread-group",children:[l.jsxs("div",{className:"thread-group__header",children:[l.jsxs("button",{type:"button",className:"thread-group__title",onClick:()=>Ee(j.id),onPointerDown:B=>Ut(B,j.id,ke),onPointerMove:B=>at(B,j.id,ke),onPointerUp:B=>pn(B,j.id),onPointerCancel:B=>Un(B,j.id),"aria-expanded":Ve,title:Nt,children:[l.jsx("span",{className:"thread-group__chevron",children:l.jsx(F6,{open:Ve})}),l.jsx("span",{className:"thread-group__icon",children:l.jsx(H6,{})}),l.jsx("span",{className:"thread-group__title-text",children:Nt})]}),l.jsxs("div",{className:"thread-group__actions",children:[C?l.jsxs("div",{className:"thread-group__menu-anchor",children:[l.jsx("button",{type:"button",className:`thread-group__more ${qn||es?"is-open":""}`,onClick:B=>{if(B.stopPropagation(),c){gt(on=>on===j.id?null:j.id);return}St(j.id)},"aria-label":`${Nt} 更多选项`,children:l.jsx(NS,{})}),qn?l.jsxs("div",{className:"thread-group__menu",children:[l.jsx("button",{type:"button",className:"thread-group__menu-item",onClick:()=>la(j),children:"编辑名称"}),l.jsx("button",{type:"button",className:"thread-group__menu-item",disabled:$===j.id,onClick:()=>{C==null||C(j.id,Ht?"unarchive":"archive"),gt(null)},children:Ht?"取消归档":"归档线程"}),l.jsx("button",{type:"button",className:"thread-group__menu-item is-danger",disabled:$===j.id,onClick:()=>{C==null||C(j.id,"remove"),gt(null)},children:"移除"})]}):null]}):null,l.jsx("button",{type:"button",className:"thread-group__add",onClick:B=>{B.stopPropagation(),x(j.id,j.name)},"aria-label":`在 ${j.name} 下新增会话`,children:l.jsx(_S,{})})]})]}),Ve?z.length===0?l.jsx("div",{className:"thread-group__empty",children:"这个线程还没有会话"}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"thread-group__sessions",children:wn.map(B=>xa(B))}),kn?l.jsx("button",{type:"button",className:"thread-group__session-toggle",onClick:()=>xn(j.id),"aria-expanded":ct,children:ct?"折叠显示":"展开显示"}):null]}):null]},j.id)}),un]},j.id)},ls=j=>{if(!W||W.pane!==j)return null;const z=qe(j).find(ke=>ke.project.id===W.projectId);if(!z)return null;const ge={top:W.previewTop,width:`${W.itemWidth}px`},we=z.project.display_name??z.project.name;return l.jsx("div",{className:"thread-group-drag-preview",style:ge,"aria-hidden":"true",children:l.jsxs("div",{className:"thread-group-drag-preview__header",children:[l.jsx("span",{className:"thread-group-drag-preview__chevron",children:l.jsx(F6,{open:!0})}),l.jsx("span",{className:"thread-group-drag-preview__icon",children:l.jsx(H6,{})}),l.jsx("span",{className:"thread-group-drag-preview__title",children:we})]})})};return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`sidebar-scrim ${R?"is-visible":""}`,style:{opacity:c?0:a,pointerEvents:c?"none":R?"auto":"none",transition:r?"none":void 0},onClick:h,"aria-label":"关闭侧边栏"}),l.jsxs("aside",{className:`conversation-sidebar ${t?"is-open":""} ${c?"is-desktop-pinned":""} ${u?"is-resizing":""}`,style:{transform:c?"translateX(0)":`translateX(calc(-100% + ${Math.max(0,Math.min(a,1))*100}%))`,transition:r?"none":void 0},children:[c&&p?l.jsx("div",{className:"conversation-sidebar__resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"调整侧边栏宽度",onPointerDown:j=>{j.pointerType!=="touch"&&(j.preventDefault(),j.stopPropagation(),p(j.clientX))}}):null,l.jsxs("div",{className:"conversation-sidebar__header",children:[l.jsxs("div",{className:`conversation-sidebar__brand ${Q?`is-${ce?"online":"offline"}`:"is-empty"}`,"aria-label":Q?ce?"节点在线":"节点断开":"未选择节点",title:Q?ce?"节点在线":"节点断开":"未选择节点",children:[Q?l.jsx("span",{className:"conversation-sidebar__status-dot","aria-hidden":"true"}):null,l.jsx("span",{className:"conversation-sidebar__brand-name",children:(y==null?void 0:y.name)??"未选择节点"})]}),c?null:l.jsx("button",{type:"button",className:"conversation-sidebar__close",onClick:h,"aria-label":"关闭",children:"×"})]}),l.jsxs("div",{className:"conversation-sidebar__actions",children:[l.jsxs(_u,{to:"/nodes",className:"sidebar-action",onClick:h,children:[l.jsx("span",{className:"sidebar-action__icon",children:l.jsx(bS,{})}),l.jsx("span",{children:"节点列表"})]}),l.jsxs("button",{type:"button",className:"sidebar-action sidebar-action--primary",onClick:()=>{h();const j=m.find(z=>z.id===Ce)??m[0];j?x(j.id,j.name):H({to:"/nodes"})},children:[l.jsx("span",{className:"sidebar-action__icon",children:l.jsx(xS,{})}),l.jsx("span",{children:"新会话"})]})]}),l.jsx("div",{className:"conversation-sidebar__threads",children:l.jsxs("div",{className:"sidebar-pane-track",style:{transform:is},children:[l.jsxs("div",{ref:j=>{Z.current.threads=j},className:`sidebar-pane ${q==="threads"?"is-active":"is-inactive"}`,children:[kt.length>0?l.jsxs("div",{className:"sidebar-pinned",children:[l.jsx("div",{className:"conversation-sidebar__node",children:"置顶会话"}),l.jsx("div",{className:"sidebar-pinned__list",children:kt.map(j=>xa(j))})]}):null,l.jsxs("div",{className:"conversation-sidebar__node-row",children:[l.jsx("div",{className:"conversation-sidebar__node",children:"线程"}),w?l.jsx("button",{type:"button",className:"conversation-sidebar__node-action",onClick:w,"aria-label":"新增目录线程",title:"新增目录线程",children:l.jsx(SS,{})}):null]}),nn.map(j=>Vs(j,"threads")),ls("threads"),l.jsxs("button",{type:"button",className:"thread-archive__toggle",onClick:()=>Se("archived"),children:[l.jsx("span",{children:"已归档"}),l.jsx("span",{className:"thread-archive__icon",children:l.jsx(jS,{})})]})]}),l.jsxs("div",{ref:j=>{Z.current.archived=j},className:`sidebar-pane sidebar-pane--archived ${q==="archived"?"is-active":"is-inactive"}`,children:[l.jsx("div",{className:"conversation-sidebar__node",children:"已归档的线程"}),ln.length>0?l.jsx("div",{className:"thread-archive__list",children:ln.map(j=>Vs(j,"archived"))}):l.jsx("div",{className:"thread-archive__empty",children:"暂时没有已归档的线程"}),ls("archived"),l.jsxs("button",{type:"button",className:"thread-archive__back",onClick:()=>Se("threads"),"aria-label":"返回线程列表",children:[l.jsx("span",{className:"thread-archive__back-icon",children:l.jsx(wS,{})}),l.jsx("span",{children:"返回"})]})]})]})}),l.jsx("div",{className:"conversation-sidebar__footer",children:l.jsxs(_u,{to:"/settings",className:"sidebar-settings",onClick:h,"aria-label":"打开设置页",children:[l.jsx("span",{className:"sidebar-settings__icon",children:l.jsx(kS,{})}),l.jsx("span",{children:"设置"})]})})]}),Ci]})}),i0="optimistic-user:",IS="overlay-user:",zS=[i0,IS],BS=5e3,ir=n=>["timeline-optimistic",n],ih=n=>n.kind==="user"&&zS.some(t=>n.id.startsWith(t)),r0=n=>n.kind==="user"&&!ih(n),l0=n=>n.kind==="user"&&n.id.startsWith(i0),PS=n=>n.kind==="user"&&!l0(n),Q6=n=>n.body.replace(/\r\n/g,`
117
+ `).trim(),G6=n=>new Date(n).getTime(),rh=(n,t)=>{if(Q6(n)!==Q6(t))return!1;const a=G6(n.timestamp),r=G6(t.timestamp);return!Number.isFinite(a)||!Number.isFinite(r)?!0:r>=a-BS},US=(n,t)=>{const a=t.filter(r0);if(a.length===0)return new Set;const r=new Set,c=new Set;for(const u of n??[]){if(!ih(u))continue;const h=a.findIndex((p,y)=>!r.has(y)&&rh(u,p));h<0||(r.add(h),c.add(u.id))}return c},qS=(n,t)=>{const a=t.map((u,h)=>({entry:u,index:h})).filter(({entry:u})=>r0(u));if(a.length===0)return new Map;const r=new Set,c=new Map;for(const u of n??[]){if(!ih(u))continue;const h=a.find(({entry:p,index:y})=>!r.has(y)&&rh(u,p));h&&(r.add(h.index),(u.attachments??[]).length!==0&&c.set(h.index,P3(h.entry.attachments,u.attachments)))}return c},$S=(n,t)=>{const a=t.filter(PS);if(a.length===0)return new Set;const r=new Set,c=new Set;for(const u of n??[]){if(!l0(u))continue;const h=a.findIndex((p,y)=>!r.has(y)&&rh(u,p));h<0||(r.add(h),c.add(u.id))}return c},HS=n=>{const t=[...n??[]],a=t.map((u,h)=>({entry:u,index:h})).filter(({entry:u})=>r0(u));if(a.length===0)return t;const r=new Set,c=new Set;for(const u of t){if(!ih(u))continue;const h=a.find(({entry:p,index:y})=>!r.has(y)&&rh(u,p));h&&(r.add(h.index),c.add(u.id))}return c.size===0?t:t.filter(u=>!c.has(u.id))},fy=(n,t)=>[...n??[],t],hy=(n,t)=>{const a=qS(n,t),r=US(n,t),c=[...n??[]].filter(h=>!r.has(h.id)),u=new Set(c.map(h=>h.id));for(const[h,p]of t.entries())u.has(p.id)||(u.add(p.id),c.push(a.has(h)?{...p,attachments:a.get(h)??p.attachments}:p));return c},bp=(n,t)=>[...hy(n,t)].sort((a,r)=>{const c=new Date(a.timestamp).getTime(),u=new Date(r.timestamp).getTime();return!Number.isFinite(c)||!Number.isFinite(u)?0:c-u}),Cf=(n,t)=>(n??[]).filter(a=>l0(a)&&!$S([a],t).has(a.id)),FS=(n,t)=>{const a=HS(n),r=Cf(t,a);return bp(r,a)},QS=(n,t)=>(n??[]).filter(a=>a.id!==t),my="panda:session-model",py="panda:command-execution-model",o0="panda:session-model-options",xp="panda:session-model-options-updated",gy="panda:session-reasoning",yy="panda:session-fast-mode",vy="panda:session-plan-mode",Ko=[{id:"gpt-5.4",label:"gpt-5.4",value:"gpt-5.4"},{id:"gpt-5.3-codex",label:"gpt-5.3-codex",value:"gpt-5.3-codex"},{id:"gpt-5.3",label:"gpt-5.3",value:"gpt-5.3"},{id:"gpt-5.4-mini",label:"gpt-5.4-mini",value:"gpt-5.4-mini"},{id:"gpt-5.2",label:"gpt-5.2",value:"gpt-5.2"}],Du=[{label:"低",value:"low"},{label:"中",value:"medium"},{label:"高",value:"high"},{label:"极高",value:"xhigh"}];var F2;const _y=((F2=Ko[0])==null?void 0:F2.value)??"gpt-5.4",V6="gpt-5.4-mini",GS=Du[2].value,xi=n=>typeof n=="string"?n.trim():"",VS=(n,t)=>{if(!n||typeof n!="object")return null;const a=n,r=xi(a.value),c=xi(a.label)||r,u=xi(a.id)||r||`custom-model-${t+1}`;if(!c||!r)return null;const h=xi(a.description);return{id:u,label:c,value:r,description:h||null}},KS=n=>{const t=new Set,a=new Set;return n.flatMap(r=>{const c=r.value.toLowerCase();if(a.has(c))return[];a.add(c);let u=r.id,h=2;for(;t.has(u);)u=`${r.id}-${h}`,h+=1;return t.add(u),[{...r,id:u}]})},by=n=>{if(!Array.isArray(n))return Ko;const t=KS(n.flatMap((a,r)=>{const c=VS(a,r);return c?[c]:[]}));return t.length>0?t:Ko},Hu=n=>{if(typeof window>"u")return null;try{return window.localStorage.getItem(n)}catch{return null}},YS=()=>{typeof window>"u"||window.dispatchEvent(new Event(xp))},Fu=(n,t)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n,t)}catch{}},xy=(n,t=!1)=>{const a=Hu(n);return a==="true"?!0:a==="false"?!1:t},Sy=(n,t)=>{Fu(n,t?"true":"false")},lh=(n,t)=>{const a=t==null?void 0:t.trim();return a?`${n}:${a}`:null},cu=n=>{const t=xi(n==null?void 0:n.value)||"",a=xi(n==null?void 0:n.label)||t;return{id:xi(n==null?void 0:n.id)||xi(n==null?void 0:n.value)||`custom-model-${Date.now()}`,label:a,value:t,description:xi(n==null?void 0:n.description)||null}},ZS=()=>oh().map(({id:n,...t})=>t),oh=()=>{const n=Hu(o0);if(!n)return Ko;try{return by(JSON.parse(n))}catch{return Ko}},WS=n=>{const t=by(n);Fu(o0,JSON.stringify(t)),YS()},XS=n=>Du.some(t=>t.value===n),c0=()=>{var a;const n=Hu(my),t=oh();return t.some(r=>r.value===n)?n:((a=t[0])==null?void 0:a.value)??_y},Tf=()=>{const n=Hu(py),t=oh();if(t.some(r=>r.value===n))return n;const a=t.find(r=>r.value===V6)??t[0];return(a==null?void 0:a.value)??V6},jy=()=>{const n=Hu(gy);return XS(n)?n:GS},bu=n=>{Fu(my,n)},O1=n=>{Fu(py,n)},wy=n=>{Fu(gy,n)},K6=n=>{const t=lh(yy,n);return t?xy(t):!1},Y6=n=>{const t=lh(vy,n);return t?xy(t):!1},ky=(n,t)=>{const a=lh(yy,n);a&&Sy(a,t)},Ny=(n,t)=>{const a=lh(vy,n);a&&Sy(a,t)},JS=(n,t)=>{ky(n,t.isFastModeEnabled),Ny(n,t.isPlanModeEnabled)},Zf=(n,t=ZS())=>{var a,r;return((a=t.find(c=>c.value===n))==null?void 0:a.label)??(typeof n=="string"&&n.trim()?n.trim():((r=t[0])==null?void 0:r.label)??_y)},ej=n=>{var t;return((t=Du.find(a=>a.value===n))==null?void 0:t.label)??Du[2].label},Cy="image/",tj=()=>`attachment-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,nj=n=>new Promise((t,a)=>{const r=new FileReader;r.onerror=()=>a(r.error??new Error("无法读取文件")),r.onload=()=>{if(typeof r.result=="string"&&r.result){t(r.result);return}a(new Error("无法读取文件"))},r.readAsDataURL(n)}),Ty=async n=>({id:tj(),kind:n.type.startsWith(Cy)?"image":"file",name:n.name,mime_type:n.type||null,size_bytes:Number.isFinite(n.size)?Math.max(0,Math.round(n.size)):null,data_url:await nj(n)}),Z6=n=>{var t;return n.kind==="image"||!!((t=n.mime_type)!=null&&t.startsWith(Cy))},Ey=n=>B3((n??[]).map((t,a)=>({id:t.id||`attachment-${a}`,kind:t.kind,name:t.name,mime_type:t.mime_type??null,size_bytes:t.size_bytes??null,content_url:t.data_url}))),Sp=n=>typeof n!="number"||!Number.isFinite(n)||n<=0?null:n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`,sj=/\[[^\]]+\]\([^)]+\)|`[^`\n]+`|\*\*.+?\*\*|\*[^*\n][^*\n]*\*|\$[A-Za-z0-9._-]+|\/[A-Za-z][A-Za-z0-9._-]*/g,aj=/^[A-Za-z0-9._-]$/,ij=/^[A-Za-z0-9._-]$/,jp=n=>/\s/.test(n),W6=n=>aj.test(n),rj=n=>ij.test(n),Qs=n=>n.trim().toLowerCase(),lj=n=>Qs(n).split(/[^a-z0-9]+/i).filter(Boolean),X6=n=>n==="repo"?0:n==="user"?1:2,oj=n=>n==="repo"?"项目":n==="user"?"个人":"系统",My=n=>{const t=[];let a=0;for(const r of n.matchAll(sj)){const c=r[0],u=r.index??0;if(c.startsWith("$")){const h=u>0?n[u-1]??"":"";if(u>0&&!jp(h))continue}if(c.startsWith("/")){const h=u>0?n[u-1]??"":"";if(u>0&&!jp(h))continue}if(u>a&&t.push({kind:"text",value:n.slice(a,u)}),c.startsWith("`")&&c.endsWith("`"))t.push({kind:"code",value:c.slice(1,-1)});else if(c.startsWith("**")&&c.endsWith("**"))t.push({kind:"strong",value:c.slice(2,-2)});else if(c.startsWith("*")&&c.endsWith("*"))t.push({kind:"emphasis",value:c.slice(1,-1)});else if(c.startsWith("[")){const h=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c);h?t.push({kind:"path-link",label:h[1]??"",path:h[2]??""}):t.push({kind:"text",value:c})}else c.startsWith("/")?t.push({kind:"command",raw:c,name:c.slice(1)}):t.push({kind:"skill",raw:c,name:c.slice(1)});a=u+c.length}return a<n.length&&t.push({kind:"text",value:n.slice(a)}),t},Ry=(n,t,a=t)=>{if(t!==a)return null;let r=t;for(;r>0&&W6(n[r-1]??"");)r-=1;const c=r-1;if(c<0||n[c]!=="$")return null;const u=c>0?n[c-1]??"":"";if(c>0&&!jp(u))return null;let h=t;for(;h<n.length&&W6(n[h]??"");)h+=1;return{start:c,end:h,query:n.slice(c+1,t)}},cj=(n,t,a,r)=>{const c=Ry(n,t,a);if(!c)return null;const p=(n[c.end]??"").length===0?`$${r} `:`$${r}`,y=`${n.slice(0,c.start)}${p}${n.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},u0=n=>n.startsWith("/"),Ay=(n,t,a=t)=>{if(!u0(n)||t!==a)return null;const r=n.search(/\s/),c=r<0?n.length:r;if(t>c)return null;let u=1;for(;u<n.length&&rj(n[u]??"");)u+=1;return t>u?null:{start:0,end:u,query:n.slice(1,t)}},uj=(n,t,a,r)=>{const c=Ay(n,t,a);if(!c)return null;const p=(n[c.end]??"").length===0?`/${r} `:`/${r}`,y=`${n.slice(0,c.start)}${p}${n.slice(c.end)}`,m=c.start+p.length;return{value:y,selectionStart:m,selectionEnd:m}},dj=(n,t)=>{const a=Qs(t),r=n.filter(u=>{if(!u.enabled)return!1;if(!a)return!0;const h=Qs(u.name),p=Qs(u.description);return h.includes(a)||p.includes(a)}),c=u=>{if(!a)return 0;const h=Qs(u.name),p=Qs(u.description),y=lj(u.name);return h===a?0:y.some(m=>m===a)?1:h.startsWith(a)?2:y.some(m=>m.startsWith(a))?3:h.includes(a)?4:p.startsWith(a)?5:6};return[...r].sort((u,h)=>{const p=c(u),y=c(h);if(p!==y)return p-y;const m=X6(u.scope)-X6(h.scope);if(m!==0)return m;const b=Qs(u.name),g=Qs(h.name);return b.localeCompare(g)})},fj=(n,t)=>{const a=Qs(t);return[...n.filter(c=>{if(!a)return!0;const u=Qs(c.name),h=Qs(c.description);return u.includes(a)||h.includes(a)})].sort((c,u)=>{const h=Qs(c.name),p=Qs(u.name),y=h===a?0:h.startsWith(a)?1:2,m=p===a?0:p.startsWith(a)?1:2;return y!==m?y-m:c.availability!==u.availability?c.availability==="supported"?-1:1:h.localeCompare(p)})},hj=n=>{if(typeof window>"u")return()=>{};const t=r=>{(r.key===null||r.key===o0)&&n()},a=()=>{n()};return window.addEventListener("storage",t),window.addEventListener(xp,a),()=>{window.removeEventListener("storage",t),window.removeEventListener(xp,a)}},mj=()=>oh(),pj=()=>Ko,d0=()=>_.useSyncExternalStore(hj,mj,pj),f0=n=>n.replace(/[\\/]+$/,""),Wf=n=>f0(n).replace(/\\/g,"/").toLowerCase(),gj=n=>{const t=f0(n.trim());if(!t)return"新线程";const a=t.split(/[\\/]+/).filter(Boolean),r=a[a.length-1];return r?r.endsWith(":")?t:r:t},yj=n=>{if(!n)return null;const t=n.trim();if(!t||t==="/"||/^[A-Za-z]:[\\/]?$/.test(t))return null;const a=f0(t),r=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));if(r<0)return null;const c=a.slice(0,r);return c?/^[A-Za-z]:$/.test(c)?`${c}\\`:c:a.startsWith("/")?"/":null},vj=async n=>(await Jn({agentId:n.agentId})).client.listDirectories(n),_j=async n=>{const t=n.bootstrapQueryKey??["bootstrap"],a=n.projects.find(u=>u.agent_id===n.agentId&&Wf(u.path)===Wf(n.path));if(a)return n.queryClient.setQueryData(t,u=>q6(u,a)),a;const c=await(await Jn({agentId:n.agentId})).client.createProject({agentId:n.agentId,name:gj(n.path),path:n.path});return n.queryClient.setQueryData(t,u=>q6(u,c.project)),n.queryClient.invalidateQueries({queryKey:t}),c.project},J6=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H10l2 2h6.5A2.5 2.5 0 0 1 21 9.5v8A2.5 2.5 0 0 1 18.5 20h-13A2.5 2.5 0 0 1 3 17.5z"})}),bj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),xj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m5 12 4.5 4.5L19 7"})}),e2=n=>!!(n&&/^[A-Za-z]:[\\/]?$/.test(n.trim())),Sj=({agentId:n,projects:t,initialPath:a=null,title:r="选择目录",subtitle:c="线程名会使用目录最后一级名称",confirmLabel:u="选择此目录",cancelLabel:h="返回上级",onProjectCreated:p})=>{const y=Tl(),[m,b]=_.useState(a),[g,x]=_.useState(a),[w,N]=_.useState([]),[T,C]=_.useState(!0),[I,$]=_.useState(null);_.useEffect(()=>{b(a),x(a)},[a]),_.useEffect(()=>{let F=!1;return C(!0),$(null),vj({agentId:n,path:m}).then(_e=>{F||N(_e)}).catch(_e=>{F||($(_e instanceof Error?_e.message:"目录列表加载失败"),N([]))}).finally(()=>{F||C(!1)}),()=>{F=!0}},[n,m]);const H=Vn({mutationFn:async F=>_j({agentId:n,path:F,projects:t,queryClient:y,bootstrapQueryKey:dt}),onSuccess:F=>{p(F)}}),R=_.useMemo(()=>{const F=new Map;for(const _e of t)F.set(Wf(_e.path),_e);return F},[t]),Q=_.useMemo(()=>g?R.get(Wf(g))??null:null,[R,g]),ce=u!=="选择此目录"?u:Q?"在线程中继续":"创建新线程",Z=yj(m),ie=Z!==null||e2(m),ee=()=>{if(Z!==null){b(Z),x(Z);return}e2(m)&&(b(null),x(null))},Y=F=>{b(F),x(F)};return l.jsx("section",{className:"directory-picker",children:l.jsxs("div",{className:"directory-picker__panel",children:[l.jsx("header",{className:"directory-picker__header",children:l.jsxs("div",{className:"directory-picker__heading",children:[l.jsx("h2",{children:r}),c?l.jsx("p",{children:c}):null]})}),l.jsxs("div",{className:"directory-picker__field",children:[l.jsx("span",{className:"directory-picker__field-label",children:"当前路径"}),l.jsxs("button",{type:"button",className:`directory-picker__path ${g===m?"is-selected":""}`,onClick:()=>{m&&x(m)},disabled:!m,"aria-pressed":g===m,children:[l.jsx("span",{className:"directory-picker__path-icon",children:l.jsx(J6,{})}),l.jsx("span",{className:"directory-picker__path-value",children:m??"根目录"})]})]}),l.jsxs("div",{className:"directory-picker__field",children:[l.jsx("span",{className:"directory-picker__field-label",children:"目录"}),l.jsx("div",{className:"directory-picker__list",role:"listbox","aria-label":"目录列表",children:T?l.jsx("div",{className:"directory-picker__state",children:"正在读取目录…"}):I?l.jsx("div",{className:"directory-picker__state is-error",children:I}):w.length===0?l.jsx("div",{className:"directory-picker__state",children:"当前目录下没有可用子目录"}):w.map(F=>{const _e=g===F.path;return l.jsx("div",{className:`directory-picker__row ${_e?"is-selected":""}`,children:l.jsxs("button",{type:"button",className:"directory-picker__row-main",onClick:je=>{const ae=je.target;if(F.has_children&&ae.closest('[data-enter-directory="true"]')){Y(F.path);return}x(F.path)},onDoubleClick:()=>{F.has_children&&Y(F.path)},"aria-selected":_e,children:[l.jsx("span",{className:"directory-picker__row-icon",children:l.jsx(J6,{})}),l.jsx("span",{className:"directory-picker__row-name",children:F.name}),F.has_children?l.jsx("span",{className:"directory-picker__row-enter","data-enter-directory":"true","aria-hidden":"true",children:l.jsx(bj,{})}):_e?l.jsx("span",{className:"directory-picker__row-check",children:l.jsx(xj,{})}):null]})},F.path)})})]}),H.error?l.jsx("div",{className:"directory-picker__feedback is-error",role:"status","aria-live":"polite",children:H.error instanceof Error?H.error.message:"创建线程失败"}):null,l.jsx("footer",{className:"directory-picker__footer",children:l.jsxs("div",{className:"directory-picker__footer-actions",children:[ie?l.jsx("button",{type:"button",className:"directory-picker__secondary",onClick:ee,children:l.jsx("span",{children:h})}):null,l.jsx("button",{type:"button",className:"directory-picker__primary",disabled:!g||H.isPending,onClick:()=>{g&&H.mutate(g)},children:H.isPending?"创建中…":ce})]})})]})})},jj=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 281.999849615234 85.965369875" width="281.999849615234" height="85.965369875" role="img" aria-label="Panda wordmark">
118
118
  <path fill="#d97757" fill-rule="nonzero" d="M539.0830078125,114.554069519043C537.650695800781,114.554061889648 536.2041015625,114.826202392578 534.7431640625,115.370460510254 533.2822265625,115.914741516113 531.892883300781,116.616561889648 530.5751953125,117.475936889648 529.257507324219,118.335311889648 528.054382324219,119.280624389648 526.9658203125,120.311874389648 525.877258300781,121.343124389648 524.9892578125,122.345733642578 524.3017578125,123.319686889648 522.9267578125,125.153022766113 521.480163574219,127.244171142578 519.9619140625,129.593124389648 518.443664550781,131.942077636719 516.925476074219,134.405624389648 515.4072265625,136.983749389648 513.888977050781,139.561874389648 512.4423828125,142.197296142578 511.0673828125,144.889999389648 509.6923828125,147.582702636719 508.474945068359,150.203796386719 507.4150390625,152.753280639648 506.355133056641,155.302764892578 505.510101318359,157.737655639648 504.8798828125,160.057968139648 504.249664306641,162.378280639648 503.9345703125,164.455108642578 503.9345703125,166.288436889648 503.9345703125,168.981140136719 504.4501953125,171.143905639648 505.4814453125,172.776718139648 506.5126953125,174.409530639648 508.460601806641,175.225936889648 511.3251953125,175.225936889648 512.299133300781,175.225936889648 513.7314453125,174.610046386719 515.6220703125,173.378280639648 517.5126953125,172.146514892578 519.5322265625,170.585311889648 521.6806640625,168.694686889648 523.8291015625,166.804061889648 525.9345703125,164.755889892578 527.9970703125,162.550155639648 530.0595703125,160.344421386719 531.749694824219,158.238952636719 533.0673828125,156.233749389648 534.499694824219,154.113952636719 535.9462890625,151.793640136719 537.4072265625,149.272811889648 538.8681640625,146.751983642578 540.2001953125,144.173858642578 541.4033203125,141.538436889648 542.6064453125,138.903015136719 543.580383300781,136.310577392578 544.3251953125,133.761093139648 545.070007324219,131.211608886719 545.4423828125,128.848327636719 545.4423828125,126.671249389648 545.4423828125,122.374374389648 544.7978515625,119.280624389648 543.5087890625,117.389999389648 542.2197265625,115.499374389648 540.744445800781,114.554061889648 539.0830078125,114.554069519043z M416.966674804688,110.343124389648C413.930206298828,110.343124389648 409.805206298828,113.522811889648 404.591674804688,119.882186889648 401.956268310547,123.147811889648 399.535675048828,126.270210266113 397.329956054688,129.249374389648 395.124237060547,132.228546142578 393.104705810547,135.179061889648 391.271362304688,138.100936889648 389.266143798828,141.251983642578 387.561737060547,144.145202636719 386.158081054688,146.780624389648 384.754425048828,149.416046142578 383.565643310547,151.764999389648 382.591674804688,153.827499389648 379.211456298828,161.103546142578 377.521362304688,166.832702636719 377.521362304688,171.014999389648 377.521362304688,176.343124389648 379.326049804688,179.007186889648 382.935424804688,179.007186889648 386.143768310547,179.007186889648 390.555206298828,177.145202636719 396.169799804688,173.421249389648 401.956268310547,169.468124389648 406.425018310547,165.916046142578 409.576049804688,162.764999389648 412.841674804688,159.327499389648 415.563018798828,156.434265136719 417.740112304688,154.085311889648 419.917205810547,151.736358642578 421.635955810547,149.845733642578 422.896362304688,148.413436889648 424.156768798828,146.981140136719 425.316925048828,145.376983642578 426.376831054688,143.600936889648 427.436706542969,141.824890136719 428.453643798828,139.876983642578 429.427612304688,137.757186889648 427.938018798828,137.413436889648 426.806518554688,136.668640136719 426.033081054688,135.522811889648 425.259643554688,134.376983642578 424.872924804688,133.087921142578 424.872924804688,131.655624389648 424.872924804688,130.509796142578 425.044799804688,128.819686889648 425.388549804688,126.585311889648 425.732299804688,124.350936889648 425.904174804688,122.632186889648 425.904174804688,121.429061889648 425.904174804688,120.397811889648 425.632019042969,119.237655639648 425.087768554688,117.948593139648 424.543487548828,116.659530639648 423.841674804688,115.456405639648 422.982299804688,114.339218139648 422.122924804688,113.222030639648 421.163299560547,112.276718139648 420.103393554688,111.503280639648 419.043487548828,110.729843139648 417.997924804688,110.343124389648 416.966674804688,110.343124389648z M181.0703125,108.538436889648C178.95051574707,108.767608642578 176.6875,109.469429016113 174.28125,110.643905639648 171.875,111.818389892578 169.32551574707,113.623077392578 166.6328125,116.057968139648 163.940093994141,118.492866516113 161.104156494141,121.629585266113 158.125,125.468124389648 155.14582824707,129.306671142578 152.05207824707,133.975936889648 148.84375,139.475936889648 147.869781494141,141.137390136719 146.795562744141,142.956405639648 145.62109375,144.932968139648 144.44660949707,146.909530639648 143.32942199707,149.086608886719 142.26953125,151.464218139648 141.20964050293,153.841827392578 140.32160949707,156.376983642578 139.60546875,159.069686889648 138.88932800293,161.762390136719 138.53125,164.598327636719 138.53125,167.577499389648 138.53125,169.353546142578 139.17578125,170.699890136719 140.46484375,171.616561889648 141.75390625,172.533233642578 143.0859375,172.991561889648 144.4609375,172.991561889648 145.893218994141,172.991561889648 147.75520324707,172.203796386719 150.046875,170.628280639648 152.338531494141,169.052764892578 154.81640625,166.961608886719 157.48046875,164.354843139648 160.14453125,161.748077392578 162.865875244141,158.768905639648 165.64453125,155.417343139648 168.42317199707,152.065780639648 171.00129699707,148.613952636719 173.37890625,145.061874389648 175.756500244141,141.509796142578 177.819000244141,138.014999389648 179.56640625,134.577499389648 181.31379699707,131.139999389648 182.502593994141,128.017608642578 183.1328125,125.210311889648 183.3046875,124.350936889648 183.50520324707,123.334014892578 183.734375,122.159530639648 183.963531494141,120.985054016113 184.178375244141,119.810577392578 184.37890625,118.636093139648 184.57942199707,117.461616516113 184.75129699707,116.373077392578 184.89453125,115.370460510254 185.037750244141,114.367866516113 185.109375,113.637397766113 185.109375,113.179061889648 185.109375,113.064483642578 185.0234375,112.749374389648 184.8515625,112.233749389648 184.6796875,111.718124389648 184.421875,111.188179016113 184.078125,110.643905639648 183.734375,110.099639892578 183.319000244141,109.612655639648 182.83203125,109.182968139648 182.34504699707,108.753280639648 181.815093994141,108.538436889648 181.2421875,108.538436889648L181.0703125,108.538436889648z M453.576049804688,56.2884368896484C455.294799804688,56.2884368896484 456.984893798828,56.6608428955078 458.646362304688,57.4056243896484 460.422393798828,58.0931243896484 461.310424804688,59.0670928955078 461.310424804688,60.3274993896484 461.310424804688,61.0149993896484 461.181518554688,62.1321868896484 460.923706054688,63.6790618896484 460.665893554688,65.2259368896484 460.307800292969,67.2311477661133 459.849487304688,69.6946868896484 459.391143798828,72.1582336425781 458.775268554688,75.2090148925781 458.001831054688,78.8470306396484 457.228393554688,82.4850540161133 456.383331298828,86.8248977661133 455.466674804688,91.8665618896484 455.409362792969,92.4394836425781 455.237487792969,93.5853118896484 454.951049804688,95.3040618896484 454.664581298828,97.0228118896484 454.349487304688,98.8418273925781 454.005737304688,100.761093139648 453.661987304688,102.680366516113 453.346862792969,104.456405639648 453.060424804688,106.089218139648 452.773956298828,107.722030639648 452.602081298828,108.738960266113 452.544799804688,109.139999389648 451.799987792969,113.780624389648 451.198425292969,118.134796142578 450.740112304688,122.202499389648 450.281768798828,126.270210266113 450.052612304688,130.395202636719 450.052612304688,134.577499389648 450.052612304688,137.900421142578 450.138549804688,141.824890136719 450.310424804688,146.350936889648 450.482299804688,150.934265136719 450.911987304688,155.374374389648 451.599487304688,159.671249389648 452.286987304688,163.968124389648 453.289581298828,166.116561889648 454.607299804688,166.116561889648 459.305206298828,166.116561889648 464.977081298828,163.968124389648 471.622924804688,159.671249389648 478.211456298828,155.317077636719 484.570831298828,150.332702636719 490.701049804688,144.718124389648 493.766143798828,141.910827636719 496.659362792969,139.167999267578 499.380737304688,136.489608764648L504.336578369141,131.408462524414 505.0302734375,130.205429077148C506.390960693359,128.092803955078 507.859069824219,126.041038513184 509.4345703125,124.050155639648 512.585632324219,120.068389892578 515.7939453125,116.573593139648 519.0595703125,113.565780639648 522.3251953125,110.557968139648 525.433288574219,108.180366516113 528.3837890625,106.432968139648 531.334289550781,104.685577392578 533.726257324219,103.811874389648 535.5595703125,103.811874389648 536.0751953125,103.811874389648 536.662414550781,103.926460266113 537.3212890625,104.155616760254 537.980163574219,104.384796142578 538.667663574219,104.628280639648 539.3837890625,104.886093139648 540.099914550781,105.143905639648 540.787414550781,105.373077392578 541.4462890625,105.573593139648 542.105163574219,105.774116516113 542.663757324219,105.874374389648 543.1220703125,105.874374389648 543.580383300781,105.874374389648 544.038757324219,105.774116516113 544.4970703125,105.573593139648 544.955383300781,105.373077392578 545.413757324219,105.143905639648 545.8720703125,104.886093139648 546.330383300781,104.628280639648 546.788757324219,104.384796142578 547.2470703125,104.155616760254 547.705383300781,103.926460266113 548.163757324219,103.811874389648 548.6220703125,103.811874389648 549.3095703125,103.811874389648 550.054382324219,104.041046142578 550.8564453125,104.499374389648 551.658508300781,104.957710266113 552.431945800781,105.544952392578 553.1767578125,106.261093139648 553.921569824219,106.977241516113 554.580383300781,107.793647766113 555.1533203125,108.710311889648 555.726257324219,109.626983642578 556.127258300781,110.514999389648 556.3564453125,111.374374389648 556.585632324219,112.405624389648 556.886413574219,113.164741516113 557.2587890625,113.651718139648 557.631164550781,114.138702392578 558.003601074219,114.582710266113 558.3759765625,114.983749389648 558.748352050781,115.384796142578 559.0634765625,115.857452392578 559.3212890625,116.401718139648 559.5791015625,116.945991516113 559.7080078125,117.791046142578 559.7080078125,118.936874389648 559.7080078125,119.509796142578 559.507507324219,120.712921142578 559.1064453125,122.546249389648 558.705383300781,124.379585266113 558.261413574219,126.513702392578 557.7744140625,128.948593139648 557.287414550781,131.383483886719 556.843444824219,133.918640136719 556.4423828125,136.554061889648 556.041320800781,139.189483642578 555.8408203125,141.595733642578 555.8408203125,143.772811889648 555.8408203125,149.903015136719 556.1845703125,154.916046142578 556.8720703125,158.811874389648 557.5595703125,162.707702636719 558.5048828125,165.787139892578 559.7080078125,168.050155639648 560.9111328125,170.313171386719 562.3291015625,171.874374389648 563.9619140625,172.733749389648 565.5947265625,173.593124389648 567.327819824219,174.022811889648 569.1611328125,174.022811889648 573.515319824219,174.022811889648 577.081726074219,173.278015136719 579.8603515625,171.788436889648 582.638977050781,170.298858642578 585.116882324219,168.093124389648 587.2939453125,165.171249389648 587.924133300781,164.369171142578 588.468444824219,163.653015136719 588.9267578125,163.022811889648 589.385070800781,162.392608642578 589.843383789063,162.077499389648 590.3017578125,162.077499389648 591.103820800781,162.077499389648 591.834289550781,162.392608642578 592.4931640625,163.022811889648 593.151977539063,163.653015136719 593.4814453125,164.311874389648 593.4814453125,164.999374389648 593.4814453125,165.916046142578 593.295227050781,166.961608886719 592.9228515625,168.136093139648 592.550476074219,169.310577392578 591.963195800781,170.499374389648 591.1611328125,171.702499389648 590.1298828125,173.478546142578 588.769165039063,175.297546386719 587.0791015625,177.159530639648 585.388977050781,179.021514892578 583.498352050781,180.711608886719 581.4072265625,182.229843139648 579.316101074219,183.748077392578 577.038757324219,184.994171142578 574.5751953125,185.968124389648 572.111633300781,186.942077636719 569.562194824219,187.429061889648 566.9267578125,187.429061889648 563.4892578125,187.429061889648 560.5244140625,186.655624389648 558.0322265625,185.108749389648 555.5400390625,183.561874389648 553.3916015625,181.456405639648 551.5869140625,178.792343139648 549.7822265625,176.128280639648 548.292663574219,173.020202636719 547.1181640625,169.468124389648 545.943664550781,165.916046142578 544.984069824219,162.163436889648 544.2392578125,158.210311889648 541.718444824219,161.876983642578 538.724914550781,165.514999389648 535.2587890625,169.124374389648 531.792663574219,172.733749389648 528.2119140625,175.985046386719 524.5166015625,178.878280639648 520.8212890625,181.771514892578 517.183288574219,184.120468139648 513.6025390625,185.925155639648 510.021820068359,187.729843139648 506.8564453125,188.632186889648 504.1064453125,188.632186889648 502.273101806641,188.632186889648 500.511383056641,188.173858642578 498.8212890625,187.257186889648 497.131195068359,186.340515136719 495.6416015625,185.108749389648 494.3525390625,183.561874389648 493.0634765625,182.014999389648 492.046539306641,180.238952636719 491.3017578125,178.233749389648 490.556976318359,176.228546142578 490.1845703125,174.108749389648 490.1845703125,171.874374389648 490.1845703125,169.639999389648 490.370758056641,167.291046142578 490.7431640625,164.827499389648 491.115570068359,162.363952636719 491.745758056641,159.714218139648 492.6337890625,156.878280639648L493.119232177734,155.466354370117 492.849487304688,155.761093139648C490.385925292969,158.253280639648 487.779174804688,160.788436889648 485.029174804688,163.366561889648 482.279174804688,165.944686889648 479.615112304688,168.264999389648 477.036987304688,170.327499389648 474.458862304688,172.389999389648 471.938018798828,174.251983642578 469.474487304688,175.913436889648 464.604675292969,179.236358642578 460.708862304688,180.897811889648 457.786987304688,180.897811889648 456.641143798828,180.897811889648 455.180206298828,180.496765136719 453.404174804688,179.694686889648 449.794799804688,178.033233642578 446.930206298828,174.996765136719 444.810424804688,170.585311889648 442.747924804688,166.173858642578 441.286987304688,161.561874389648 440.427612304688,156.749374389648 439.568237304688,151.936874389648 438.852081298828,146.551452636719 438.279174804688,140.593124389648 431.117706298828,153.942077636719 421.836456298828,165.801452636719 410.435424804688,176.171249389648 398.977081298828,186.598327636719 387.117706298828,191.811874389648 374.857299804688,191.811874389648 371.477081298828,191.811874389648 368.898956298828,190.007186889648 367.122924804688,186.397811889648 365.346893310547,182.845733642578 364.458862304688,179.150421142578 364.458862304688,175.311874389648 364.458862304688,170.155624389648 364.888549804688,166.317077636719 365.747924804688,163.796249389648L366.740081787109,161.069854736328 361.366027832031,165.944686889648C358.67333984375,168.179061889648 356.037902832031,170.155624389648 353.459777832031,171.874374389648 351.397277832031,173.249374389648 349.43505859375,174.538436889648 347.573059082031,175.741561889648 345.711090087891,176.944686889648 343.834777832031,177.975936889648 341.944152832031,178.835311889648 340.053527832031,179.694686889648 338.076965332031,180.382186889648 336.014465332031,180.897811889648 333.951965332031,181.413436889648 331.68896484375,181.671249389648 329.225402832031,181.671249389648 324.47021484375,181.671249389648 320.60302734375,180.468124389648 317.623840332031,178.061874389648 316.13427734375,176.858749389648 314.830871582031,175.297546386719 313.713684082031,173.378280639648 312.596496582031,171.459014892578 311.62255859375,169.324890136719 310.791809082031,166.975936889648 309.961090087891,164.626983642578 309.244934082031,162.134796142578 308.643371582031,159.499374389648 308.041809082031,156.863952636719 307.54052734375,154.257186889648 307.139465332031,151.679061889648 306.623840332031,148.470733642578 306.136871337891,145.591827392578 305.678527832031,143.042343139648 305.22021484375,140.492858886719 304.690246582031,138.344421386719 304.088684082031,136.597030639648 303.487121582031,134.849639892578 302.756652832031,133.503280639648 301.897277832031,132.557968139648 301.037902832031,131.612655639648 299.920715332031,131.139999389648 298.545715332031,131.139999389648 297.457183837891,131.139999389648 296.425933837891,131.254577636719 295.451965332031,131.483749389648 294.47802734375,131.712921142578 293.461090087891,132.171249389648 292.401184082031,132.858749389648 291.34130859375,133.546249389648 290.18115234375,134.520202636719 288.920715332031,135.780624389648 287.660308837891,137.041046142578 286.18505859375,138.702499389648 284.494934082031,140.764999389648 282.804840087891,142.827499389648 280.871246337891,145.348327636719 278.694152832031,148.327499389648 276.51708984375,151.306671142578 273.967590332031,154.858749389648 271.045715332031,158.983749389648 269.613433837891,160.988952636719 267.92333984375,163.194686889648 265.975402832031,165.600936889648 264.027496337891,168.007186889648 262.03662109375,170.298858642578 260.002746582031,172.475936889648 257.968902587891,174.653015136719 255.97802734375,176.572296142578 254.03010559082,178.233749389648 252.082183837891,179.895202636719 250.363433837891,180.955108642578 248.87385559082,181.413436889648 243.832183837891,180.324890136719 241.31135559082,174.051452636719 241.31135559082,162.593124389648 241.31135559082,159.556671142578 241.65510559082,154.944686889648 242.34260559082,148.757186889648 242.68635559082,145.949890136719 243.08740234375,143.013702392578 243.54573059082,139.948593139648L243.633743286133,139.477767944336 241.3662109375,142.344100952148C239.48274230957,144.571319580078 237.55989074707,146.694686889648 235.59765625,148.714218139648 231.67317199707,152.753280639648 227.705718994141,156.577499389648 223.6953125,160.186874389648 219.51301574707,163.968124389648 215.34504699707,166.918640136719 211.19140625,169.038436889648 207.037750244141,171.158233642578 203.299468994141,172.218124389648 199.9765625,172.218124389648 198.54426574707,172.218124389648 197.12629699707,171.874374389648 195.72265625,171.186874389648 194.319000244141,170.499374389648 193.00129699707,169.597030639648 191.76953125,168.479843139648 190.537750244141,167.362655639648 189.44921875,166.059265136719 188.50390625,164.569686889648 187.55859375,163.080108642578 186.828125,161.533233642578 186.3125,159.929061889648 186.026031494141,159.069686889648 185.768218994141,158.081405639648 185.5390625,156.964218139648 185.30989074707,155.847030639648 185.080718994141,154.815780639648 184.8515625,153.870468139648 184.62239074707,152.925155639648 184.36457824707,152.123077392578 184.078125,151.464218139648 183.791656494141,150.805358886719 183.4765625,150.475936889648 183.1328125,150.475936889648 182.90364074707,150.475936889648 182.416656494141,150.848327636719 181.671875,151.593124389648 180.92707824707,152.337921142578 180.053375244141,153.297546386719 179.05078125,154.472030639648 178.04817199707,155.646514892578 176.97395324707,156.964218139648 175.828125,158.425155639648 174.682281494141,159.886093139648 173.55078125,161.304061889648 172.43359375,162.679061889648 171.31640625,164.054061889648 170.31379699707,165.314483642578 169.42578125,166.460311889648 168.537750244141,167.606140136719 167.8359375,168.465515136719 167.3203125,169.038436889648 165.54426574707,171.043640136719 163.43879699707,173.091827392578 161.00390625,175.182968139648 158.569000244141,177.274108886719 156.13410949707,179.179061889648 153.69921875,180.897811889648 151.264312744141,182.616561889648 149.02995300293,184.020202636719 146.99609375,185.108749389648 144.96223449707,186.197296142578 143.45832824707,186.741561889648 142.484375,186.741561889648 140.30729675293,186.741561889648 138.20182800293,186.383483886719 136.16796875,185.667343139648 134.13410949707,184.951202392578 132.34375,183.905624389648 130.796875,182.530624389648 129.25,181.155624389648 128.00390625,179.465515136719 127.05859375,177.460311889648 126.11328125,175.455108642578 125.640625,173.163436889648 125.640625,170.585311889648 125.640625,166.345733642578 126.485679626465,161.504577636719 128.17578125,156.061874389648 129.020843505859,153.340515136719 130.001953125,150.597686767578 131.119140625,147.833358764648L132.791915893555,144.115005493164 132.34375,144.417343139648C129.36457824707,146.336608886719 126.05598449707,148.370468139648 122.41796875,150.518905639648 118.779945373535,152.667343139648 114.92707824707,154.844421386719 110.859375,157.050155639648 106.791664123535,159.255889892578 102.72395324707,161.418640136719 98.65625,163.538436889648 94.5885391235352,165.658233642578 90.6354141235352,167.663436889648 86.796875,169.554061889648 82.9583282470703,171.444686889648 79.4635391235352,173.106140136719 76.3125,174.538436889648 74.0208282470703,175.569686889648 71.84375,176.729843139648 69.78125,178.018905639648 67.71875,179.307968139648 65.69921875,180.511093139648 63.7226600646973,181.628280639648 61.74609375,182.745468139648 59.7552070617676,183.676452636719 57.7499961853027,184.421249389648 55.7447891235352,185.166046142578 53.625,185.538436889648 51.390625,185.538436889648 50.0729141235352,185.538436889648 48.7981758117676,185.380889892578 47.5664100646973,185.065780639648 46.3346328735352,184.750671386719 45.2317695617676,184.249374389648 44.2578163146973,183.561874389648 43.2838516235352,182.874374389648 42.49609375,182.000671386719 41.8945274353027,180.940780639648 41.29296875,179.880889892578 40.9921875,178.606140136719 40.9921875,177.116561889648 40.9921875,176.314483642578 41.2643203735352,175.569686889648 41.80859375,174.882186889648 42.3528633117676,174.194686889648 43.0546875,173.578796386719 43.9140625,173.034530639648 44.7734375,172.490264892578 45.71875,171.988952636719 46.75,171.530624389648 47.78125,171.072296142578 48.7838516235352,170.671249389648 49.7578086853027,170.327499389648 50.7890586853027,169.926452636719 52.0065078735352,169.511093139648 53.41015625,169.081405639648 54.8138008117676,168.651718139648 56.2317695617676,168.222030639648 57.6640625,167.792343139648 59.0963516235352,167.362655639648 60.4856719970703,166.918640136719 61.83203125,166.460311889648 63.1783828735352,166.001983642578 64.3385391235352,165.543640136719 65.3125,165.085311889648 67.1458282470703,164.111358642578 68.8645782470703,162.879577636719 70.46875,161.389999389648 72.0729141235352,159.900421142578 73.5625,158.267608642578 74.9375,156.491561889648 76.3125,154.715515136719 77.6015625,152.867858886719 78.8046875,150.948593139648 80.0078125,149.029327392578 81.125,147.181671142578 82.1562576293945,145.405624389648 82.84375,144.202499389648 83.5026016235352,142.856140136719 84.1328125,141.366561889648 84.7630157470703,139.876983642578 85.3216094970703,138.387390136719 85.80859375,136.897811889648 86.2955703735352,135.408233642578 86.66796875,133.990264892578 86.92578125,132.643905639648 87.18359375,131.297546386719 87.3125,130.166046142578 87.3125,129.249374389648 87.3125,125.296249389648 86.453125,122.145210266113 84.734375,119.796249389648 83.015625,117.447296142578 80.8671875,116.272811889648 78.2890548706055,116.272811889648 76.6848907470703,116.272811889648 74.8372344970703,116.802764892578 72.74609375,117.862655639648 70.6549453735352,118.922554016113 68.5637969970703,120.197296142578 66.47265625,121.686874389648 64.3815078735352,123.176460266113 62.43359375,124.737655639648 60.62890625,126.370468139648 58.82421875,128.003280639648 57.3776016235352,129.392608642578 56.2890586853027,130.538436889648 53.6536407470703,133.345733642578 51.1757774353027,136.396514892578 48.85546875,139.690780639648 46.53515625,142.985046386719 44.34375,146.365264892578 42.2812461853027,149.831405639648 40.21875,153.297546386719 38.2708320617676,156.778015136719 36.4375,160.272811889648 34.6041641235352,163.767608642578 32.9140625,167.119171142578 31.3671855926514,170.327499389648 30.6796875,173.020202636719 30.0065097808838,175.999374389648 29.3476543426514,179.264999389648 28.6888008117676,182.530624389648 28.1874980926514,186.111358642578 27.8437538146973,190.007186889648 27.2135410308838,197.741561889648 26.7408847808838,204.645202636719 26.4257793426514,210.718124389648 26.1106758117676,216.791046142578 25.4661445617676,222.348327636719 24.4921913146973,227.389999389648 24.1484375,229.223327636719 23.3177070617676,230.841827392578 22.0000057220459,232.245468139648 20.6822910308838,233.649108886719 18.9635410308838,234.350936889648 16.84375,234.350936889648 16.2135410308838,234.350936889648 15.46875,234.193389892578 14.6093778610229,233.878280639648 13.75,233.563171386719 12.93359375,233.119171142578 12.1601552963257,232.546249389648 11.38671875,231.973327636719 10.7278642654419,231.328796386719 10.1835947036743,230.612655639648 9.63932228088379,229.896514892578 9.3671875,229.108749389648 9.3671875,228.249374389648 9.3671875,226.358749389648 9.49609375,224.024108886719 9.75390529632568,221.245468139648 10.01171875,218.466827392578 10.3125,215.673858642578 10.6562471389771,212.866561889648 11,210.059265136719 11.3294267654419,207.509796142578 11.6445322036743,205.218124389648 11.9596347808838,202.926452636719 12.1744785308838,201.322296142578 12.2890615463257,200.405624389648 13.0911455154419,194.504577636719 13.8072910308838,188.130889892578 14.4375,181.284530639648 15.0677080154419,174.438171386719 15.5833330154419,166.975936889648 15.9843711853027,158.897811889648 16.0416660308838,157.179061889648 16.11328125,154.901718139648 16.1992206573486,152.065780639648 16.28515625,149.229843139648 16.37109375,146.365264892578 16.4570331573486,143.472030639648 16.54296875,140.578796386719 16.62890625,137.886093139648 16.71484375,135.393905639648 16.80078125,132.901718139648 16.9010410308838,131.139999389648 17.0156269073486,130.108749389648 17.8177070617676,119.166046142578 20.6822929382324,113.694686889648 25.6093730926514,113.694686889648 26.5833320617676,113.694686889648 27.5143203735352,113.938179016113 28.4023399353027,114.425163269043 29.2903633117676,114.912139892578 30.078125,115.542343139648 30.7656288146973,116.315780639648 31.453125,117.089218139648 31.9973945617676,117.962921142578 32.3984336853027,118.936874389648 32.7994766235352,119.910835266113 33,120.856147766113 33,121.772804260254 33,123.778022766113 32.78515625,125.940780639648 32.3554725646973,128.261093139648 31.9257793426514,130.581405639648 31.4531230926514,132.959014892578 30.9374961853027,135.393905639648 30.4218730926514,137.828796386719 29.9492168426514,140.220733642578 29.51953125,142.569686889648 29.0898418426514,144.918640136719 28.8749980926514,147.067077636719 28.8750019073486,149.014999389648 28.8749980926514,150.676452636719 29.0468730926514,151.507186889648 29.390625,151.507186889648 33.4010391235352,144.288436889648 37.3255195617676,137.943389892578 41.1640663146973,132.472030639648 45.0026016235352,127.000679016113 48.8411445617676,122.460311889648 52.6796836853027,118.850936889648 55.1432266235352,116.559272766113 57.578125,114.453804016113 59.9843788146973,112.534530639648 62.390625,110.615264892578 64.8111953735352,108.953804016113 67.24609375,107.550155639648 69.6809844970703,106.146514892578 72.2018203735352,105.057968139648 74.80859375,104.284538269043 77.4153594970703,103.511093139648 80.1796875,103.095733642578 83.1015625,103.038436889648 85.1067657470703,102.981147766113 87.18359375,103.468124389648 89.33203125,104.499374389648 91.48046875,105.530624389648 93.4140625,107.077499389648 95.1328125,109.139999389648 96.8515548706055,111.202499389648 98.2695236206055,113.709014892578 99.38671875,116.659530639648 100.503898620605,119.610054016113 101.033843994141,122.947296142578 100.976554870605,126.671249389648 101.033843994141,129.535827636719 100.589836120605,132.400421142578 99.6445236206055,135.264999389648 98.6992111206055,138.129577636719 97.4387969970703,140.951202392578 95.86328125,143.729843139648 94.2877578735352,146.508483886719 92.46875,149.186874389648 90.40625,151.764999389648 88.34375,154.343124389648 86.1953125,156.720733642578 83.9609375,158.897811889648 88.6588516235352,157.121765136719 93.4856719970703,154.944686889648 98.4413986206055,152.366561889648 103.397132873535,149.788436889648 108.35285949707,147.009796142578 113.30859375,144.030624389648 118.264320373535,141.051452636719 123.13410949707,137.957702636719 127.91796875,134.749374389648 132.701812744141,131.541046142578 137.27082824707,128.418640136719 141.625,125.382186889648 142.283843994141,124.923858642578 142.87825012207,124.501327514648 143.408203125,124.114616394043L144.405715942383,123.362648010254 144.4609375,123.276718139648C148.0703125,118.091827392578 151.822906494141,113.637397766113 155.71875,109.913436889648 160.244781494141,105.616561889648 164.98567199707,102.451202392578 169.94140625,100.417350769043 174.897125244141,98.3834915161133 179.98176574707,97.3665618896484 185.1953125,97.3665618896484 186.16926574707,97.3665618896484 187.014312744141,97.5670852661133 187.73046875,97.9681243896484 188.44660949707,98.3691711425781 189.0625,98.8847961425781 189.578125,99.5149993896484 190.09375,100.145210266113 190.55207824707,100.847030639648 190.953125,101.620460510254 191.354156494141,102.393905639648 191.75520324707,103.181671142578 192.15625,103.983749389648 192.385406494141,104.499374389648 192.87239074707,105.072296142578 193.6171875,105.702499389648 194.361968994141,106.332710266113 195.135406494141,106.977241516113 195.9375,107.636093139648 196.73957824707,108.294952392578 197.44140625,108.939483642578 198.04296875,109.569686889648 198.64453125,110.199897766113 198.9453125,110.801460266113 198.9453125,111.374374389648 198.9453125,112.577499389648 198.701812744141,113.909530639648 198.21484375,115.370460510254 197.72785949707,116.831405639648 197.197906494141,118.521514892578 196.625,120.440773010254 196.05207824707,122.360054016113 195.522125244141,124.537139892578 195.03515625,126.972023010254 194.54817199707,129.406921386719 194.3046875,132.199890136719 194.3046875,135.350936889648 194.3046875,137.413436889648 194.490875244141,139.762390136719 194.86328125,142.397811889648 195.23567199707,145.033233642578 195.80859375,147.539733886719 196.58203125,149.917343139648 197.35546875,152.294952392578 198.34375,154.285827636719 199.546875,155.889999389648 200.75,157.494171142578 202.15364074707,158.296249389648 203.7578125,158.296249389648 205.705718994141,158.296249389648 207.65364074707,157.737655639648 209.6015625,156.620468139648 211.549468994141,155.503280639648 213.783843994141,153.942077636719 216.3046875,151.936874389648 221.91926574707,147.468124389648 227.24739074707,142.569686889648 232.2890625,137.241561889648 237.330718994141,131.913436889648 242.486968994141,126.613960266113 247.7578125,121.343124389648L247.835861206055,121.282699584961 250.76448059082,113.780624389648C251.33740234375,112.634796142578 251.93896484375,111.732452392578 252.56916809082,111.073593139648 253.199371337891,110.414741516113 253.843902587891,109.927764892578 254.50276184082,109.612655639648 255.16162109375,109.297554016113 255.84912109375,109.097030639648 256.565246582031,109.011093139648 257.281402587891,108.925155639648 258.011871337891,108.882186889648 258.756652832031,108.882186889648 259.67333984375,108.882186889648 260.48974609375,109.512397766113 261.205871582031,110.772811889648 261.922027587891,112.033233642578 262.280090332031,113.780624389648 262.280090332031,116.014999389648 262.280090332031,117.389999389648 262.16552734375,118.679061889648 261.936340332031,119.882186889648 261.707183837891,121.085311889648 261.39208984375,122.317085266113 260.991027832031,123.577499389648 260.589996337891,124.837921142578 260.160308837891,126.198593139648 259.701965332031,127.659530639648 259.24365234375,129.120468139648 258.785308837891,130.796249389648 258.326965332031,132.686874389648 257.983215332031,134.233749389648 257.596496582031,135.952499389648 257.166809082031,137.843124389648 256.737121582031,139.733749389648 256.336090087891,141.653015136719 255.96369934082,143.600936889648 255.59130859375,145.548858642578 255.27619934082,147.453796386719 255.01838684082,149.315780639648 254.76057434082,151.177764892578 254.63166809082,152.853546142578 254.63166809082,154.343124389648 254.63166809082,155.374374389648 254.80354309082,156.434265136719 255.14729309082,157.522811889648 256.75146484375,157.350936889648 259.386871337891,154.944686889648 263.053527832031,150.304061889648 264.944152832031,147.955108642578 267.02099609375,145.376983642578 269.283996582031,142.569686889648 271.547027587891,139.762390136719 273.996246337891,136.668640136719 276.631652832031,133.288436889648 278.57958984375,130.767608642578 280.51318359375,128.418640136719 282.432434082031,126.241561889648 284.351715087891,124.064483642578 286.342590332031,122.159530639648 288.405090332031,120.526718139648 290.467590332031,118.893905639648 292.658996582031,117.604843139648 294.979309082031,116.659530639648 297.299621582031,115.714218139648 299.863433837891,115.241561889648 302.670715332031,115.241561889648 305.64990234375,115.241561889648 308.127746582031,115.886093139648 310.104309082031,117.175155639648 312.080871582031,118.464218139648 313.670715332031,120.240264892578 314.873840332031,122.503280639648 316.076965332031,124.766304016113 317.007965087891,127.473335266113 317.666809082031,130.624374389648 318.32568359375,133.775421142578 318.855621337891,137.241561889648 319.256652832031,141.022811889648 319.600402832031,144.231140136719 319.929840087891,147.410827636719 320.244934082031,150.561874389648 320.56005859375,153.712921142578 321.175933837891,156.534530639648 322.092590332031,159.026718139648 323.00927734375,161.518905639648 324.326965332031,163.538436889648 326.045715332031,165.085311889648 327.764465332031,166.632186889648 330.22802734375,167.405624389648 333.436340332031,167.405624389648 335.89990234375,167.405624389648 338.47802734375,166.832702636719 341.170715332031,165.686874389648 343.863433837891,164.541046142578 346.699371337891,162.951202392578 349.678527832031,160.917343139648 352.65771484375,158.883483886719 355.737121582031,156.491561889648 358.916809082031,153.741561889648 362.096496582031,150.991561889648 365.37646484375,147.983749389648 368.756652832031,144.718124389648 370.074371337891,143.457702636719 371.52099609375,141.867858886719 373.096496582031,139.948593139648 374.672027587891,138.029327392578 376.218902587891,136.181671142578 377.737121582031,134.405624389648 378.496246337891,133.517608642578 379.230285644531,132.694030761719 379.939300537109,131.934921264648L381.199279785156,130.655120849609 385.427612304688,124.264999389648C388.349487304688,120.254585266113 391.672393798828,116.244171142578 395.396362304688,112.233749389648 399.177612304688,108.223335266113 402.729705810547,105.358749389648 406.052612304688,103.639999389648 410.177612304688,101.405624389648 416.107299804688,100.288436889648 423.841674804688,100.288429260254 426.534362792969,100.288436889648 428.826049804688,101.778022766113 430.716674804688,104.757186889648 432.607299804688,107.736358642578 434.039581298828,111.202499389648 435.013549804688,115.155624389648 435.987487792969,119.337921142578 436.474487304688,122.603546142578 436.474487304688,124.952499389648 437.333862304688,122.145210266113 438.107299804688,119.294952392578 438.794799804688,116.401718139648 439.482299804688,113.508491516113 440.083862304688,110.514999389648 440.599487304688,107.421249389648 441.115112304688,104.327499389648 441.587768554688,101.076202392578 442.017456054688,97.6673431396484 442.447143554688,94.2584915161133 442.833862304688,90.6061477661133 443.177612304688,86.7103118896484 443.292175292969,85.679069519043 443.406768798828,84.3613586425781 443.521362304688,82.7571868896484 443.635925292969,81.1530227661133 443.779174804688,79.2623977661133 443.951049804688,77.0853118896484 444.294799804688,72.6165618896484 444.638549804688,68.8496398925781 444.982299804688,65.7845306396484 445.326049804688,62.7194366455078 445.784362792969,60.7285461425781 446.357299804688,59.8118743896484 447.732299804688,57.4629211425781 450.138549804688,56.2884368896484 453.576049804688,56.2884368896484z" transform="translate(-4.522309515625 -27.1750441384583) scale(0.482782)" />\r
119
119
  </svg>\r
120
120
  \r
121
121
  \r
122
122
  \r
123
- `,xj=()=>l.jsx("span",{"aria-hidden":"true",className:"new-thread-hero__logo",dangerouslySetInnerHTML:{__html:bj}}),Sj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m15 18-6-6 6-6"})}),jj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 18 6-6-6-6"})}),t2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),l.jsx("path",{d:"M12 10.4v4.2"}),l.jsx("path",{d:"M12 7.9h.01"})]}),wj=(n,t)=>{var a;return((a=n[t])==null?void 0:a.trim())??""},n2=()=>typeof window<"u"&&!window.matchMedia("(max-width: 768px)").matches,kj=_.memo(function({requests:t,hasStripBelow:a,pendingRequestId:r,onRespond:c}){const u=t[0]??null,[h,p]=_.useState(null),[y,m]=_.useState(""),[b,g]=_.useState({}),[x,w]=_.useState(0),[N,T]=_.useState(null),[C,I]=_.useState(null);_.useEffect(()=>{p(null),m(""),g({}),w(0),T(null),I(null)},[u==null?void 0:u.id]);const $=u?r===u.id:!1,H=(u==null?void 0:u.kind)==="user_input",R=H&&u.questions.length>0?u.questions[Math.max(0,Math.min(x,u.questions.length-1))]??null:null,Q=R?wj(b,R.id):"",ce=R?R.options.some(ae=>ae.label===Q):!1,Z=!!(R&&Q&&(!ce||N===R.id));_.useEffect(()=>{if(!R){T(null);return}if(ce){T(null);return}Q&&T(R.id)},[ce,R,Q]);const ie=_.useMemo(()=>!u||$?!1:u.kind==="user_input"?R?!!Q:!1:h?!0:u.allow_freeform?!!y.trim():!1,[R,Q,u,y,$,h]);if(!u)return null;const ee=u.questions.reduce((ae,ue)=>ae+ue.options.length,u.options.length),Y=ae=>{$||c({requestId:u.id,optionId:(ae==null?void 0:ae.optionId)??h,text:(ae==null?void 0:ae.text)??y,answers:(ae==null?void 0:ae.answers)??b})},F=()=>{if(!(!u||u.kind!=="user_input"||!R)){if(x<u.questions.length-1){w(ae=>Math.min(ae+1,u.questions.length-1));return}Y()}},_e=()=>{if(!u||u.kind!=="user_input"||!R)return;const ae={...b,[R.id]:"忽略"};if(g(ae),T(null),x<u.questions.length-1){w(ue=>Math.min(ue+1,u.questions.length-1));return}Y({answers:ae})},je=ae=>{if(!(!u||u.kind!=="user_input"||!R||$)){if(Q===ae){F();return}g(ue=>({...ue,[R.id]:ae})),T(null)}};return l.jsx("section",{className:`session-interaction-strip ${a?"has-strip-below":""} ${H?"is-user-input-flow":""}`,children:u.kind==="user_input"&&R?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"session-interaction-flow__header",children:[l.jsx("div",{className:"session-interaction-flow__prompt",children:R.question}),l.jsxs("div",{className:"session-interaction-flow__progress",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":"上一题",disabled:x===0||$,onClick:()=>w(ae=>Math.max(0,ae-1)),children:l.jsx(Sj,{})}),l.jsxs("span",{className:"session-interaction-flow__counter",children:[x+1," / ",u.questions.length]}),l.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":x===u.questions.length-1?"提交回复":"下一题",disabled:$||!ie,onClick:F,children:l.jsx(jj,{})})]})]}),l.jsx("div",{className:"session-interaction-flow__body",children:l.jsxs("div",{className:"session-interaction-flow__list",children:[R.options.map((ae,ue)=>l.jsxs("div",{className:`session-interaction-flow__item is-${ae.emphasis} ${Q===ae.label?"is-active":""}`,role:"button",tabIndex:$?-1:0,"aria-pressed":Q===ae.label,onClick:()=>je(ae.label),onKeyDown:E=>{E.key==="Enter"&&n2()&&(E.preventDefault(),je(ae.label))},children:[l.jsxs("span",{className:"session-interaction-flow__item-index",children:[ue+1,"."]}),l.jsxs("span",{className:"session-interaction-flow__item-choice",children:[l.jsx("span",{className:"session-interaction-flow__item-label",children:ae.label}),ae.description?l.jsxs("span",{className:"session-interaction-flow__tooltip-wrap",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__tooltip-trigger","aria-label":`查看 ${ae.label} 的说明`,"aria-expanded":C===ae.id,onMouseEnter:()=>I(ae.id),onMouseLeave:()=>I(E=>E===ae.id?null:E),onBlur:()=>I(E=>E===ae.id?null:E),onClick:E=>{E.stopPropagation(),I(U=>U===ae.id?null:ae.id)},children:l.jsx(t2,{})}),l.jsx("div",{className:`session-interaction-flow__tooltip ${C===ae.id?"is-visible":""}`,role:"tooltip",children:ae.description})]}):null]})]},ae.id)),l.jsx("div",{className:`session-interaction-flow__item is-custom ${Z?"is-active":""}`,children:l.jsxs("div",{className:"session-interaction-flow__custom-input-wrap",children:[l.jsx("input",{type:"text",className:"session-interaction-flow__custom-input",value:ce?"":Q,disabled:$,placeholder:R.is_secret?"输入敏感信息":"否,请告知如何调整",onFocus:()=>{T(R.id),ce&&g(ae=>({...ae,[R.id]:""}))},onKeyDown:ae=>{ae.key==="Enter"&&ie&&!$&&n2()&&(ae.preventDefault(),F())},onChange:ae=>{T(R.id),g(ue=>({...ue,[R.id]:ae.target.value}))}}),l.jsxs("div",{className:"session-interaction-flow__inline-actions",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__ghost",disabled:$,onClick:_e,children:"忽略"}),l.jsx("button",{type:"button",className:"session-interaction-flow__primary",disabled:!ie,onClick:F,children:$?"提交中...":x===u.questions.length-1?u.submit_label??"提交回复":"继续"})]})]})})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"session-interaction-strip__header",children:[l.jsx("span",{className:"session-interaction-strip__icon","aria-hidden":"true",children:l.jsx(t2,{})}),l.jsxs("div",{className:"session-interaction-strip__copy",children:[l.jsxs("div",{className:"session-interaction-strip__title",children:[u.title,t.length>1?l.jsxs("span",{className:"session-interaction-strip__count",children:["还有 ",t.length-1," 个待处理"]}):null]}),u.description?l.jsx("div",{className:"session-interaction-strip__description",children:u.description}):null]})]}),u.options.length>0?l.jsx("div",{className:"session-interaction-strip__options",children:u.options.map(ae=>l.jsxs("button",{type:"button",className:`session-interaction-option is-${ae.emphasis} ${h===ae.id?"is-active":""}`,disabled:$,onClick:()=>{p(ae.id),!u.allow_freeform&&ee<=3&&Y({optionId:ae.id})},children:[l.jsx("span",{className:"session-interaction-option__label",children:ae.label}),ae.description?l.jsx("span",{className:"session-interaction-option__description",children:ae.description}):null]},ae.id))}):null,u.allow_freeform?l.jsxs("label",{className:"session-interaction-strip__freeform",children:[l.jsx("span",{className:"session-interaction-strip__freeform-label",children:"自定义回复"}),l.jsx("textarea",{value:y,disabled:$,placeholder:u.freeform_placeholder??"输入回复内容",onChange:ae=>m(ae.target.value)})]}):null,u.allow_freeform||u.options.length>3?l.jsx("div",{className:"session-interaction-strip__footer",children:l.jsx("button",{type:"button",className:"session-interaction-strip__submit",disabled:!ie,onClick:()=>Y(),children:$?"提交中...":u.submit_label??"继续"})}):null]})})}),Nj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),Cj=({panel:n,isPending:t,onDismiss:a,onSelectOption:r,onSubmitText:c})=>{const[u,h]=_.useState("");return _.useEffect(()=>{h("")},[n.panel_id,n.status]),l.jsxs("section",{className:`session-command-panel is-${n.status}`,children:[l.jsxs("div",{className:"session-command-panel__header",children:[l.jsxs("div",{className:"session-command-panel__command",children:["/",n.command_name]}),l.jsx("button",{type:"button",className:"session-command-panel__close","aria-label":"关闭命令面板",onClick:a,children:l.jsx(Nj,{})})]}),l.jsx("div",{className:"session-command-panel__title",children:n.title}),n.description?l.jsx("div",{className:"session-command-panel__description",children:n.description}):null,l.jsx("pre",{className:"session-command-panel__body",children:n.body}),n.input_type==="choice"&&n.options.length>0?l.jsx("div",{className:"session-command-panel__options",children:n.options.map(p=>l.jsxs("button",{type:"button",className:"session-command-panel__option",disabled:t,onClick:()=>r(p.id),children:[l.jsx("span",{className:"session-command-panel__option-label",children:p.label}),p.description?l.jsx("span",{className:"session-command-panel__option-description",children:p.description}):null]},p.id))}):null,n.input_type==="text"?l.jsxs("form",{className:"session-command-panel__form",onSubmit:p=>{p.preventDefault(),!(!u.trim()||t)&&c(u.trim())},children:[l.jsx("input",{className:"session-command-panel__input",value:u,disabled:t,placeholder:n.input_placeholder??"继续输入",onChange:p=>h(p.target.value)}),l.jsx("button",{type:"submit",className:"session-command-panel__submit",disabled:t||!u.trim(),children:n.submit_label??"提交"})]}):null]})},Tj=_.memo(function({planSnapshot:t,hasStripAbove:a,hasStripBelow:r}){const[c,u]=_.useState(!0);return t.steps.length?l.jsxs("section",{className:`session-plan-strip ${c?"is-collapsed":""} ${a?"has-strip-above":""} ${r?"has-strip-below":""}`,children:[l.jsxs("button",{type:"button",className:"session-plan-strip__toggle",onClick:()=>u(h=>!h),"aria-expanded":!c,children:[l.jsxs("div",{className:"session-plan-strip__summary",children:[l.jsx("span",{className:"session-plan-strip__summary-mark","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"4.5",y:"5",width:"15",height:"14",rx:"2.5"}),l.jsx("path",{d:"M8 9h8"}),l.jsx("path",{d:"M8 13h5.5"}),l.jsx("path",{d:"m15.5 14.5 1.5 1.5 2.5-3"})]})}),l.jsx("span",{className:"session-plan-strip__summary-text",children:l.jsxs("span",{children:["共 ",t.total_count," 个任务,已完成 ",t.completed_count," 个"]})})]}),l.jsx("span",{className:"session-plan-strip__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),c?null:l.jsx(l.Fragment,{children:l.jsx("div",{className:"session-plan-strip__steps",children:t.steps.map((h,p)=>l.jsxs("div",{className:`session-plan-step is-${h.status}`,children:[l.jsx("span",{className:"session-plan-step__dot","aria-hidden":"true",children:h.status==="in_progress"?l.jsx("span",{className:"session-plan-step__spinner"}):null}),l.jsxs("span",{className:"session-plan-step__index",children:[p+1,"."]}),l.jsx("span",{className:"session-plan-step__label",children:h.step})]},h.id))})})]}):null}),Ej=n=>{const t=(n==null?void 0:n.enabled)??!0;return Es({queryKey:["codex-commands"],enabled:t,queryFn:async()=>(await Jn()).client.getCodexCommands(),staleTime:0,gcTime:30*6e4,refetchOnWindowFocus:!1,retry:1})},Mj=(n,t)=>{const a=((t==null?void 0:t.enabled)??!0)&&!!n;return Es({queryKey:["project-skills",n],enabled:a,queryFn:async()=>n?(await Jn({projectId:n})).client.getProjectSkills(n):[],staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,retry:1})},s2=24,Rj=n=>{const t=My(n);return t.length===0?l.jsx("span",{children:" "}):t.map((a,r)=>{const c=`skill-aware-token-${r}`;return a.kind==="skill"?l.jsx("span",{className:"skill-aware-textarea__token is-skill",children:a.raw},c):a.kind==="command"?l.jsx("span",{className:"skill-aware-textarea__token is-command",children:a.raw},c):a.kind==="code"?l.jsx("span",{className:"skill-aware-textarea__token is-code",children:a.value},c):a.kind==="path-link"?l.jsx("span",{className:"skill-aware-textarea__token is-link",children:a.label},c):l.jsx("span",{children:a.value},c)})},a2=({value:n,onChange:t,onKeyDown:a,placeholder:r,disabled:c=!1,className:u,projectId:h,autoFocus:p=!1})=>{var U;const y=u.includes("composer-fullscreen-sheet__input"),m=_.useRef(null),b=_.useRef(null),[g,x]=_.useState({start:0,end:0}),[w,N]=_.useState(!1),[T,C]=_.useState(!1),[I,$]=_.useState(0),H=_.useMemo(()=>Ry(n,g.start,g.end),[g.end,g.start,n]),R=_.useMemo(()=>Ay(n,g.start,g.end),[g.end,g.start,n]),Q=w&&!c&&!!H&&!T,ce=w&&!c&&!!R&&!T,Z=ce?"command":Q?"skill":null,ie=Mj(h,{enabled:Q}),ee=Ej({enabled:ce}),Y=_.useMemo(()=>oj(ie.data??[],(H==null?void 0:H.query)??"").slice(0,s2),[H==null?void 0:H.query,ie.data]),F=_.useMemo(()=>{var te;return cj(((te=ee.data)==null?void 0:te.commands)??[],(R==null?void 0:R.query)??"").slice(0,s2)},[R==null?void 0:R.query,(U=ee.data)==null?void 0:U.commands]);_.useEffect(()=>{$(0)},[H==null?void 0:H.query,H==null?void 0:H.start,R==null?void 0:R.query,n,h]),_.useEffect(()=>{C(!1)},[H==null?void 0:H.query,H==null?void 0:H.start,H==null?void 0:H.end,R==null?void 0:R.query,R==null?void 0:R.start,R==null?void 0:R.end]);const _e=()=>{!m.current||!b.current||(b.current.scrollTop=m.current.scrollTop,b.current.scrollLeft=m.current.scrollLeft)},je=()=>{m.current&&x({start:m.current.selectionStart??0,end:m.current.selectionEnd??0})},ae=te=>{if(!m.current)return;const W=rj(n,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,te.name);W&&(t(W.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(W.selectionStart,W.selectionEnd),x({start:W.selectionStart,end:W.selectionEnd}))}))},ue=te=>{if(!m.current)return;const W=lj(n,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,te.name);W&&(t(W.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(W.selectionStart,W.selectionEnd),x({start:W.selectionStart,end:W.selectionEnd}))}))},E=te=>{const W=Z==="skill"&&Y.length>0||Z==="command"&&F.length>0;if(Z&&W){if(te.key==="ArrowDown"){te.preventDefault();const xe=Z==="command"?F.length:Y.length;$(A=>(A+1)%xe);return}if(te.key==="ArrowUp"){te.preventDefault();const xe=Z==="command"?F.length:Y.length;$(A=>A-1<0?xe-1:A-1);return}if((te.key==="Enter"||te.key==="Tab")&&!te.shiftKey&&!te.altKey&&!te.ctrlKey&&!te.metaKey){if(te.preventDefault(),Z==="command"){const A=F[I]??F[0];if(!A)return;ue(A);return}const xe=Y[I]??Y[0];if(!xe)return;ae(xe);return}}if(Z&&te.key==="Escape"){te.preventDefault(),C(!0);return}a==null||a(te)};return l.jsxs("div",{className:`skill-aware-textarea ${Z?"is-picker-open":""} ${y?"is-fullscreen":""}`,children:[ce?l.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"命令建议",children:ee.isLoading?l.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载命令…"}):ee.isError?l.jsx("div",{className:"skill-mention-picker__empty",children:"命令列表加载失败"}):F.length===0?l.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配命令"}):F.map((te,W)=>{const xe=W===I;return l.jsx("button",{type:"button",className:`skill-mention-picker__item ${xe?"is-active":""}`,role:"option","aria-selected":xe,onMouseDown:A=>{A.preventDefault(),ue(te)},onMouseEnter:()=>$(W),children:l.jsxs("span",{className:"skill-mention-picker__main",children:[l.jsxs("span",{className:"skill-mention-picker__name",children:["/",te.name]}),l.jsx("span",{className:"skill-mention-picker__description",children:te.description})]})},te.name)})}):Q?l.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"技能建议",children:ie.isLoading?l.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载技能…"}):ie.isError?l.jsx("div",{className:"skill-mention-picker__empty",children:"技能列表加载失败"}):Y.length===0?l.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配技能"}):Y.map((te,W)=>{const xe=W===I;return l.jsx("button",{type:"button",className:`skill-mention-picker__item ${xe?"is-active":""}`,role:"option","aria-selected":xe,onMouseDown:A=>{A.preventDefault(),ae(te)},onMouseEnter:()=>$(W),children:l.jsxs("span",{className:"skill-mention-picker__main",children:[l.jsxs("span",{className:"skill-mention-picker__name",children:["$",te.name]}),l.jsx("span",{className:"skill-mention-picker__description",children:te.description}),l.jsx("span",{className:"skill-mention-picker__scope",children:ij(te.scope)})]})},`${te.scope}:${te.name}:${te.path}`)})}):null,l.jsxs("div",{className:"skill-aware-textarea__surface",children:[l.jsx("div",{ref:b,className:`${u} skill-aware-textarea__overlay`,"aria-hidden":"true",children:n?Rj(n):l.jsx("span",{children:" "})}),l.jsx("textarea",{ref:m,className:`${u} skill-aware-textarea__input`,value:n,disabled:c,placeholder:r,autoFocus:p,onChange:te=>{t(te.target.value),C(!1),x({start:te.target.selectionStart??0,end:te.target.selectionEnd??0})},onKeyDown:E,onClick:je,onSelect:je,onKeyUp:je,onFocus:()=>{N(!0),C(!1),je()},onBlur:()=>{N(!1)},onScroll:_e})]})]})},L1=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),Aj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"m7 14 5 5 5-5"})]}),Dj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M8 3H4v4"}),l.jsx("path",{d:"M16 3h4v4"}),l.jsx("path",{d:"M8 21H4v-4"}),l.jsx("path",{d:"M16 21h4v-4"}),l.jsx("path",{d:"M9 9 4 4"}),l.jsx("path",{d:"m15 9 5-5"}),l.jsx("path",{d:"m9 15-5 5"}),l.jsx("path",{d:"m15 15 5 5"})]}),Oj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),i2=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M13 2 5.5 13h5L9 22l9.5-13h-5L13 2Z"})}),r2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 6h10"}),l.jsx("path",{d:"M9 12h10"}),l.jsx("path",{d:"M9 18h10"}),l.jsx("path",{d:"m4 6 1.5 1.5L7.5 5"}),l.jsx("path",{d:"m4 12 1.5 1.5L7.5 11"}),l.jsx("path",{d:"m4 18 1.5 1.5L7.5 17"})]}),Lj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 16V5"}),l.jsx("path",{d:"m8 9 4-4 4 4"}),l.jsx("path",{d:"M20 16.5v1A2.5 2.5 0 0 1 17.5 20h-11A2.5 2.5 0 0 1 4 17.5v-1"})]}),Dy=_.memo(function({isDesktopSidebar:t,sidebarShift:a,isSidebarDragging:r,composerError:c,onDismissComposerError:u,interactionRequests:h,pendingInteractionRequestId:p,onRespondInteraction:y,parentSession:m,backgroundAgentSessions:b,isBackgroundAgentsOpen:g,planSnapshot:x,onToggleBackgroundAgents:w,onOpenSession:N,getBackgroundAgentStatusLabel:T,getBackgroundAgentAccent:C,formatBackgroundAgentsLabel:I,hasBackgroundAgentStrip:$,commandPanel:H,isCommandPanelPending:R,onDismissCommandPanel:Q,onCommandPanelOptionSelect:ce,onCommandPanelTextSubmit:Z,projectId:ie=null,draft:ee,pendingAttachments:Y,canSendInput:F,isInputLocked:_e=!1,inputPlaceholder:je,readOnlyPlaceholder:ae,onDraftChange:ue,onUploadFiles:E,onRemoveAttachment:U,onSubmit:te,showStopIcon:W,isSendPending:xe,onInterrupt:A,isFastModeEnabled:ne,isPlanModeEnabled:be,onToggleFastMode:V,onTogglePlanMode:pe,showModeBadges:Ce=!1,selectedModel:Le,modelOptions:he=[],selectedReasoning:q,onSelectModel:Se,onSelectReasoning:Ne,contextUsage:me,isContextUsageOpen:Te,onToggleContextUsage:Ge,contextUsageRingStyle:Ue,usedPercent:gt,remainingPercent:Lt,usedTokensLabel:St,totalTokensLabel:st,showJumpToBottom:tn,onJumpToBottom:$t}){const de=_.useId(),[Ae,Re]=_.useState(!1),[Oe,Ke]=_.useState(null),mt=_.useRef(null),kt=_.useRef(null),rn=h[0]??null,Pn=(rn==null?void 0:rn.kind)==="user_input",On=h.length>0,nn=!!x&&!Pn,ln=!Pn&&$,oe=nn||ln,qe=On||nn||ln,De={transform:`translateX(${a}px)`,transition:r?"none":void 0},Ie=(!!ee.trim()||Y.length>0)&&F&&!_e&&!xe&&!W,We=F&&!_e,$e=()=>{Ie&&(Ke(null),te())},He=Ee=>{Ee.key!=="Enter"||Ee.shiftKey||Ee.altKey||Ee.ctrlKey||Ee.metaKey||Ee.nativeEvent.isComposing||typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches||(Ee.preventDefault(),$e())};return _.useEffect(()=>{if(!Ae)return;const Ee=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Ee}},[Ae]),_.useEffect(()=>{if(!Ae||typeof window>"u")return;const Ee=window.matchMedia("(min-width: 769px)"),Ut=()=>{Ee.matches&&Re(!1)};return Ut(),typeof Ee.addEventListener=="function"?(Ee.addEventListener("change",Ut),()=>{Ee.removeEventListener("change",Ut)}):(Ee.addListener(Ut),()=>{Ee.removeListener(Ut)})},[Ae]),_.useEffect(()=>{if(!Oe)return;const Ee=at=>{const pn=at.target;mt.current&&pn instanceof Node&&mt.current.contains(pn)||Ke(null)},Ut=at=>{at.key==="Escape"&&Ke(null)};return window.addEventListener("pointerdown",Ee),window.addEventListener("keydown",Ut),()=>{window.removeEventListener("pointerdown",Ee),window.removeEventListener("keydown",Ut)}},[Oe]),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`composer-wrap ${t?"has-desktop-sidebar":""}`,style:De,children:[c?l.jsxs("div",{className:"composer-alert",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"composer-alert__text",children:c}),l.jsx("button",{type:"button",className:"composer-alert__close",onClick:u,"aria-label":"关闭错误提示",children:l.jsx(L1,{})})]}):null,On?l.jsx(kj,{requests:h,hasStripBelow:oe,pendingRequestId:p,onRespond:y}):null,nn&&x?l.jsx(Tj,{planSnapshot:x,hasStripAbove:On,hasStripBelow:ln}):null,ln&&m?l.jsxs("button",{type:"button",className:`background-agents-exit ${On||nn?"has-strip-above":""}`,onClick:()=>{N(m.id)},children:[l.jsx("span",{className:"background-agents-exit__icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M6 12h12"}),l.jsx("path",{d:"m13 7 5 5-5 5"})]})}),l.jsx("span",{children:"返回主会话"})]}):ln&&b.length>0?l.jsxs("section",{className:`background-agents-card ${g?"is-open":""} ${On||nn?"has-strip-above":""}`,children:[l.jsxs("button",{type:"button",className:"background-agents-card__toggle",onClick:w,"aria-expanded":g,children:[l.jsx("span",{className:"background-agents-card__icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"7",y:"4",width:"10",height:"7",rx:"2.5"}),l.jsx("path",{d:"M12 11v3"}),l.jsx("circle",{cx:"10",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("path",{d:"M4.5 18a4.5 4.5 0 0 1 4.5-4.5h6A4.5 4.5 0 0 1 19.5 18"})]})}),l.jsxs("span",{className:"background-agents-card__summary",children:[l.jsx("span",{className:"background-agents-card__title",children:I(b.length)}),g?l.jsx("span",{className:"background-agents-card__hint",children:"(@ to tag agents)"}):null]}),l.jsx("span",{className:"background-agents-card__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),g?l.jsx("div",{className:"background-agents-card__list",children:b.map(Ee=>{var Ut,at;return l.jsxs("button",{type:"button",className:`background-agent-row ${Ee.run_state==="running"?"is-running":"is-idle"}`,style:{"--agent-accent":C(Ee)},onClick:()=>{N(Ee.id)},children:[l.jsx("span",{className:"background-agent-row__accent","aria-hidden":"true"}),l.jsxs("span",{className:"background-agent-row__meta",children:[l.jsxs("span",{className:"background-agent-row__title",children:[l.jsx("span",{className:"background-agent-row__name",children:((Ut=Ee.subagent)==null?void 0:Ut.nickname)??Ee.title}),l.jsxs("span",{className:"background-agent-row__role",children:["(",((at=Ee.subagent)==null?void 0:at.role)??"agent",")"]})]}),l.jsx("span",{className:"background-agent-row__status",children:T(Ee)})]}),l.jsx("span",{className:"background-agent-row__open",children:"Open"})]},Ee.id)})}):null]}):null,H?l.jsx(Cj,{panel:H,isPending:R,onDismiss:Q,onSelectOption:ce,onSubmitText:Z}):null,Pn?null:l.jsxs("form",{className:`chat-composer ${qe?"is-attached-to-agent-strip":""}`,onSubmit:Ee=>{Ee.preventDefault(),$e()},children:[l.jsxs("div",{className:"chat-composer__editor",children:[Y.length>0?l.jsx("div",{className:"chat-composer__attachments",children:Y.map(Ee=>{const Ut=Sp(Ee.size_bytes);return l.jsxs("div",{className:"chat-composer__attachment-chip",children:[l.jsxs("div",{className:"chat-composer__attachment-copy",children:[l.jsx("span",{className:"chat-composer__attachment-name",children:Ee.name}),l.jsxs("span",{className:"chat-composer__attachment-meta",children:[Ee.kind==="image"?"图片":"文件",Ut?` · ${Ut}`:""]})]}),l.jsx("button",{type:"button",className:"chat-composer__attachment-remove","aria-label":`移除 ${Ee.name}`,onClick:()=>U(Ee.id),children:l.jsx(L1,{})})]},Ee.id)})}):null,l.jsx(a2,{className:"chat-composer__input",value:ee,disabled:!We,projectId:ie,placeholder:We?je??"要求后续变更":ae??"当前会话为只读模式",onChange:ue,onKeyDown:He}),l.jsx("button",{type:"button",className:"composer-fullscreen-toggle","aria-label":"全屏编辑",onClick:()=>Re(!0),children:l.jsx(Dj,{})}),l.jsx("input",{id:de,ref:kt,type:"file",className:"chat-composer__file-input",multiple:!0,onChange:Ee=>{Ee.target.files&&Ee.target.files.length>0&&E(Ee.target.files),Ee.target.value=""}})]}),l.jsxs("div",{className:"chat-composer__toolbar",children:[l.jsxs("div",{ref:mt,className:"chat-composer__controls",children:[l.jsxs("div",{className:`composer-utility-menu ${Oe==="utility"?"is-open":""}`,children:[l.jsx("button",{type:"button",className:"composer-utility-menu__trigger","aria-label":"打开额外功能","aria-expanded":Oe==="utility",onClick:()=>Ke(Ee=>Ee==="utility"?null:"utility"),children:l.jsx(Oj,{})}),Oe==="utility"?l.jsxs("div",{className:"composer-utility-menu__popover",role:"menu",children:[l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitem",onClick:()=>{var Ee;Ke(null),(Ee=kt.current)==null||Ee.click()},children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(Lj,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"上传文件"})]}),l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":ne,onClick:V,children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(i2,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"Fast 模式"}),l.jsx("span",{className:`composer-utility-menu__switch ${ne?"is-on":""}`,"aria-hidden":"true",children:l.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":be,onClick:pe,children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(r2,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"计划模式"}),l.jsx("span",{className:`composer-utility-menu__switch ${be?"is-on":""}`,"aria-hidden":"true",children:l.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]})]}):null]}),l.jsxs("div",{className:`composer-choice ${Oe==="model"?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择模型","aria-expanded":Oe==="model",onClick:()=>Ke(Ee=>Ee==="model"?null:"model"),children:[l.jsx("span",{className:"composer-icon",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 3 4 7v10l8 4 8-4V7z"}),l.jsx("path",{d:"m4 7 8 4 8-4"}),l.jsx("path",{d:"M12 11v10"})]})}),l.jsx("span",{className:"composer-control__value",children:Zf(Le,he)})]}),Oe==="model"?l.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择模型",children:he.map(Ee=>l.jsxs("button",{type:"button",className:`composer-choice-menu__item ${Le===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":Le===Ee.value,onClick:()=>{Se(Ee.value),Ke(null)},children:[l.jsx("span",{className:"composer-choice-menu__text",children:l.jsx("span",{className:"composer-choice-menu__label",children:Ee.label})}),Le===Ee.value?l.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),l.jsxs("div",{className:`composer-choice ${Oe==="reasoning"?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择推理强度","aria-expanded":Oe==="reasoning",onClick:()=>Ke(Ee=>Ee==="reasoning"?null:"reasoning"),children:[l.jsx("span",{className:"composer-icon",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M9.5 3a6.5 6.5 0 0 0-3.7 11.84c.53.38.92.95 1.1 1.57l.1.34c.13.44.54.75 1 .75h7c.46 0 .87-.31 1-.75l.1-.34c.18-.62.57-1.2 1.1-1.57A6.5 6.5 0 0 0 14.5 3z"}),l.jsx("path",{d:"M10 21h4"}),l.jsx("path",{d:"M9 18h6"})]})}),l.jsx("span",{className:"composer-control__value",children:WS(q)})]}),Oe==="reasoning"?l.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择推理强度",children:Du.map(Ee=>l.jsxs("button",{type:"button",className:`composer-choice-menu__item ${q===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":q===Ee.value,onClick:()=>{Ne(Ee.value),Ke(null)},children:[l.jsx("span",{className:"composer-choice-menu__label",children:Ee.label}),q===Ee.value?l.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),Ce&&(ne||be)?l.jsxs("div",{className:"composer-mode-badges","aria-label":"当前已启用的会话模式",children:[ne?l.jsxs("button",{type:"button",className:"composer-mode-badge is-fast",onClick:()=>{Ke(null),V()},"aria-label":"关闭 Fast 模式",children:[l.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:l.jsx(i2,{})}),l.jsx("span",{className:"composer-mode-badge__label",children:"Fast"})]}):null,be?l.jsxs("button",{type:"button",className:"composer-mode-badge is-plan",onClick:()=>{Ke(null),pe()},"aria-label":"关闭计划模式",children:[l.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:l.jsx(r2,{})}),l.jsx("span",{className:"composer-mode-badge__label",children:"计划"})]}):null]}):null]}),l.jsxs("div",{className:"chat-composer__actions",children:[me?l.jsxs("div",{className:`composer-context ${Te?"is-open":""}`,children:[l.jsx("button",{type:"button",className:"composer-context__trigger","aria-label":"查看背景信息窗口使用情况",onClick:Ee=>{Ee.stopPropagation(),Ge()},children:l.jsx("span",{className:"composer-context__ring",style:Ue,children:l.jsx("span",{className:"composer-context__ring-core"})})}),Te?l.jsxs("div",{className:"composer-context__popover",role:"tooltip",children:[l.jsx("div",{className:"composer-context__title",children:"背景信息窗口:"}),l.jsxs("div",{children:[gt,"% 已用(剩余 ",Lt,"%)"]}),l.jsxs("div",{children:["已用 ",St,",共 ",st]})]}):null]}):null,l.jsx("button",{type:W?"button":"submit",className:"composer-send",disabled:W?!F:!Ie,"aria-label":W?"中断":"发送",onClick:()=>{W&&A()},children:W?l.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:l.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2.5"})}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M12 17V7m0 0-4 4m4-4 4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})]})]}),Ae?l.jsx("div",{className:"composer-fullscreen-sheet",role:"dialog","aria-modal":"true","aria-label":"全屏编辑",children:l.jsxs("div",{className:"composer-fullscreen-sheet__panel",children:[l.jsxs("div",{className:"composer-fullscreen-sheet__header",children:[l.jsx("div",{className:"composer-fullscreen-sheet__title",children:"全屏编辑"}),l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__close","aria-label":"退出全屏编辑",onClick:()=>Re(!1),children:l.jsx(L1,{})})]}),l.jsx(a2,{className:"composer-fullscreen-sheet__input",value:ee,disabled:!We,projectId:ie,placeholder:We?je??"要求后续变更":ae??"当前会话为只读模式",onChange:ue,onKeyDown:He,autoFocus:!0}),l.jsxs("div",{className:"composer-fullscreen-sheet__footer",children:[l.jsxs("div",{className:"composer-fullscreen-sheet__meta",children:[l.jsx("span",{children:Le}),l.jsx("span",{children:q}),Y.length>0?l.jsxs("span",{children:[Y.length," 个附件"]}):null]}),l.jsxs("div",{className:"composer-fullscreen-sheet__actions",children:[l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button",onClick:()=>Re(!1),children:"关闭"}),W?l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!F,onClick:A,children:"中断"}):l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!Ie,onClick:()=>{$e(),Re(!1)},children:"发送"})]})]})]})}):null,tn?l.jsx("button",{type:"button",className:`conversation-jump-bottom ${t?"has-desktop-sidebar":""}`,style:De,onClick:$t,"aria-label":"滚动到最下面",children:l.jsx(Aj,{})}):null]})}),l2=10,Ij=n=>{const t=n.replace(/\s+/g," ").trim();return t.length<=l2?t:t.slice(0,l2).trimEnd()},zj=(n,t)=>{var r,c;const a=Ij(n);return a||((c=(r=t[0])==null?void 0:r.name)==null?void 0:c.trim())||"附件"},Bj=n=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(n.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},Pj=({currentAgent:n,projects:t,sessions:a,initialProjectId:r=null,entryView:c,isDesktopSidebar:u,sidebarOffset:h,isSidebarDragging:p,onOpenSidebar:y,onProjectSelected:m,onSessionCreated:b})=>{const g=Tl(),[x,w]=_.useState(""),[N,T]=_.useState(r),[C,I]=_.useState(null),[$,H]=_.useState(null),[R,Q]=_.useState(()=>c0()),[ce,Z]=_.useState(()=>jy()),[ie,ee]=_.useState([]),[Y,F]=_.useState(!1),[_e,je]=_.useState(!1),[ae,ue]=_.useState(c),E=d0(),U=_.useMemo(()=>E.map(({id:V,...pe})=>pe),[E]),te=_.useMemo(()=>t.find(V=>V.id===N)??t[0]??null,[t,N]);_.useEffect(()=>{bu(R)},[R]),_.useEffect(()=>{wy(ce)},[ce]),_.useEffect(()=>{U.length!==0&&(U.some(V=>V.value===R)||Q(U[0].value))},[U,R]),_.useEffect(()=>{ue(c)},[c]),_.useEffect(()=>{H(null)},[N]),_.useEffect(()=>{var pe,Ce;if(N&&t.some(Le=>Le.id===N))return;const V=(r&&t.some(Le=>Le.id===r)?r:null)??((pe=a.find(Le=>!Le.archived))==null?void 0:pe.project_id)??((Ce=t[0])==null?void 0:Ce.id)??null;T(V)},[r,t,N,a]),_.useEffect(()=>{t.length===0&&ue("directory-picker")},[t.length]);const W=Vn({mutationFn:async V=>{if(!te||!V.input.trim()&&V.attachments.length===0)throw new Error("请先选择线程,再输入第一条消息");return(await(await Jn({projectId:V.projectId,agentId:n.id})).client.createSession({agentId:n.id,projectId:V.projectId,title:V.title,input:V.input,attachments:V.attachments,model:V.model,reasoningEffort:V.reasoningEffort,serviceTier:V.serviceTier,planMode:V.planMode})).session},onMutate:()=>I(null),onSuccess:async(V,pe)=>{const Ce={id:`optimistic-user:${V.id}:create`,kind:"user",title:"你",body:pe.input,timestamp:V.last_event_at,accent:"primary",attachments:Ey(pe.attachments)};xr(n.id),fs(V.id),ZS(V.id,{isFastModeEnabled:pe.serviceTier==="fast",isPlanModeEnabled:pe.planMode}),Ru(null),Eo(null),g.setQueryData(dt,Le=>aS(Le,V)),g.setQueryData(ir(V.id),Le=>fy(Le,Ce)),F(!1),je(!1),b(V.id),g.invalidateQueries({queryKey:["plan",V.id]}),g.invalidateQueries({queryKey:["change-sets",V.id]})},onError:V=>{I(V instanceof Error?V.message:"创建会话失败")}}),xe=(te==null?void 0:te.path)??null,A=ae==="directory-picker",ne={transform:`translateX(${h}px)`,transition:p?"none":void 0},be=()=>{const V=x.trim();if(!(!V&&ie.length===0||W.isPending||!te)){if(u0(V)){if(ie.length>0){I("命令暂不支持附件,请先移除附件后再执行。");return}const pe=Bj(V);if(pe==="model"){if(w(""),U.length>0){H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe,command_text:V,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"choice",options:U.map(Ce=>({id:Ce.value,label:Ce.label,description:Ce.description??null})),input_placeholder:null,submit_label:null,effect:null});return}H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe,command_text:V,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}if(pe==="status"){w(""),H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe,command_text:V,title:"新会话当前设置",description:"这里展示的是创建下一条会话时会使用的本地设置。",status:"completed",body:[`线程:${te.display_name??te.name}`,`模型:${R}`,`推理强度:${ce}`,`Fast 模式:${Y?"开启":"关闭"}`,`计划模式:${_e?"开启":"关闭"}`].join(`
124
- `),submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}w(""),H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe||"unknown",command_text:V,title:`/${pe||"unknown"} 暂不可用`,description:"新建线程阶段目前只接入了少量本地命令。",status:"completed",body:"请先进入已有会话后再执行这个命令,或者先使用 /model 调整新会话默认模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}W.mutate({projectId:te.id,input:V,title:zj(V,ie),attachments:ie,model:R,reasoningEffort:ce,serviceTier:Y?"fast":void 0,planMode:_e})}};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`conversation-main conversation-main--new-thread ${u?"has-desktop-sidebar":""}`,style:ne,children:[l.jsxs("div",{className:"conversation-topbar",children:[u?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:y,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsx("div",{className:"conversation-topbar__title-row",children:l.jsx("h1",{"aria-label":"未命名会话",children:" "})})})]}),l.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:l.jsx("div",{className:"conversation-thread conversation-thread--empty",children:A?l.jsx(_j,{agentId:n.id,projects:t,title:"选择目录",subtitle:"",onProjectCreated:V=>{T(V.id),m(V.id),ue("composer")}}):l.jsx("section",{className:"new-thread-hero",children:l.jsxs("div",{className:"new-thread-hero__stack",children:[l.jsx(xj,{}),l.jsxs("label",{className:"new-thread-hero__selector",children:[l.jsx("span",{className:"new-thread-hero__selector-label",children:"在线程中发起会话"}),l.jsx("select",{className:"new-thread-hero__select",value:N??"",onChange:V=>{const pe=V.target.value||null;T(pe),pe&&m(pe)},children:t.map(V=>l.jsx("option",{value:V.id,children:V.display_name??V.name},V.id))})]}),xe?l.jsx("div",{className:"new-thread-hero__path",children:xe}):l.jsx("div",{className:"new-thread-hero__hint",children:"选择一个线程后,直接输入第一条消息即可开始。"}),u?null:l.jsx("button",{type:"button",className:"new-thread-hero__directory-trigger",onClick:()=>ue("directory-picker"),children:"新增目录线程"})]})})})})]}),A?null:l.jsx(Dy,{isDesktopSidebar:u,sidebarShift:h,isSidebarDragging:p,composerError:C,onDismissComposerError:()=>I(null),interactionRequests:[],pendingInteractionRequestId:null,onRespondInteraction:()=>{},parentSession:null,backgroundAgentSessions:[],isBackgroundAgentsOpen:!1,planSnapshot:null,onToggleBackgroundAgents:()=>{},onOpenSession:()=>{},getBackgroundAgentStatusLabel:()=>"",getBackgroundAgentAccent:()=>"var(--color-accent-primary)",formatBackgroundAgentsLabel:V=>`${V} background agents`,hasBackgroundAgentStrip:!1,commandPanel:$,isCommandPanelPending:!1,onDismissCommandPanel:()=>H(null),onCommandPanelOptionSelect:V=>{Q(V),H(pe=>pe&&{...pe,status:"completed",body:`新会话默认模型已切换为 ${Zf(V,U)}。现在可以继续输入真正的首条消息。`,updated_at:new Date().toISOString(),input_type:"none",options:[]})},onCommandPanelTextSubmit:()=>{},projectId:(te==null?void 0:te.id)??null,draft:x,pendingAttachments:ie,canSendInput:!!te,inputPlaceholder:te?`向 ${te.display_name??te.name} 发起第一条任务…`:"先选择线程,再输入第一条任务",readOnlyPlaceholder:"先选择线程,再输入第一条任务",onDraftChange:w,onUploadFiles:V=>{const pe=[...V];pe.length!==0&&(I(null),Promise.all(pe.map(Ce=>Ty(Ce))).then(Ce=>{ee(Le=>[...Le,...Ce])}).catch(Ce=>{I(Ce instanceof Error?Ce.message:"无法读取附件")}))},onRemoveAttachment:V=>{ee(pe=>pe.filter(Ce=>Ce.id!==V))},onSubmit:be,showStopIcon:!1,isSendPending:W.isPending,onInterrupt:()=>{},isFastModeEnabled:Y,isPlanModeEnabled:_e,onToggleFastMode:()=>F(V=>!V),onTogglePlanMode:()=>je(V=>!V),showModeBadges:!0,selectedModel:R,modelOptions:U,selectedReasoning:ce,onSelectModel:Q,onSelectReasoning:V=>Z(V),contextUsage:null,isContextUsageOpen:!1,onToggleContextUsage:()=>{},usedPercent:0,remainingPercent:0,usedTokensLabel:"0",totalTokensLabel:"0",showJumpToBottom:!1,onJumpToBottom:()=>{}})]})},o2=_.lazy(async()=>({default:(await Rp(()=>import("./session-diff-preview-Dg7a3ySE.js"),[])).SessionDiffPreview})),I1=["var(--session-git-graph-1)","var(--session-git-graph-2)","var(--session-git-graph-3)","var(--session-git-graph-4)","var(--session-git-graph-5)","var(--session-git-graph-6)"],Oy=14,Ly=10,nr=24,So=48,z1=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),Uj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M20 11a8 8 0 1 0 2.2 5.5"}),l.jsx("path",{d:"M20 4v7h-7"})]}),qj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M3 12a9 9 0 1 0 2.64-6.36"}),l.jsx("path",{d:"M3 4v5h5"}),l.jsx("path",{d:"M12 7v5l3 2"})]}),c2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 14 4 9l5-5"}),l.jsx("path",{d:"M4 9h8a8 8 0 1 1 0 16h-1"})]}),u2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7.5 12.5 10.5 15.5 16.5 8.5"}),l.jsx("circle",{cx:"12",cy:"12",r:"8.5"})]}),$j=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 16V5"}),l.jsx("path",{d:"m7.5 9.5 4.5-4.5 4.5 4.5"}),l.jsx("path",{d:"M5 19h14"})]}),Hj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6 18 18"}),l.jsx("path",{d:"M18 6 6 18"})]}),Fj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7 4v10"}),l.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),l.jsx("path",{d:"M17 6a4 4 0 0 0-4 4H7"}),l.jsx("circle",{cx:"7",cy:"4",r:"2"}),l.jsx("circle",{cx:"17",cy:"6",r:"2"}),l.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),Qj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"4",y:"5",width:"16",height:"11",rx:"2"}),l.jsx("path",{d:"M8 19h8"}),l.jsx("path",{d:"M10 16v3"}),l.jsx("path",{d:"M14 16v3"})]}),Gj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M7.5 18a4.5 4.5 0 1 1 .9-8.91A5.5 5.5 0 0 1 19 11a3.5 3.5 0 0 1-.5 7Z"})}),Vj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7 4v10"}),l.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),l.jsx("path",{d:"M7 10a4 4 0 0 1 4-4h6"}),l.jsx("circle",{cx:"7",cy:"4",r:"2"}),l.jsx("circle",{cx:"17",cy:"6",r:"2"}),l.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),sr=({label:n,icon:t,onClick:a,disabled:r=!1,variant:c="default",pending:u=!1,className:h})=>l.jsx("button",{type:"button",className:`session-git-panel__icon-button is-${c} ${u?"is-pending":""} ${h??""}`.trim(),onClick:a,disabled:r,"aria-label":n,title:n,children:l.jsx("span",{className:"session-git-panel__icon-button-glyph","aria-hidden":"true",children:t})}),d2=n=>{switch(n){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"U";default:return"M"}},Kj=n=>n.status==="renamed"&&n.previous_path?`该变更仅包含重命名:${n.previous_path} -> ${n.path}`:n.status==="deleted"?"该文件已删除,没有可展示的补丁内容。":n.status==="untracked"?"该文件还没有可展示的补丁内容。":"此变更没有可展示的补丁内容。",Yj=(n,t)=>t&&t.diff.trim()?"此变更没有可展示的补丁内容。":n.status==="renamed"&&n.previous_path?`该提交仅包含重命名:${n.previous_path} -> ${n.path}`:n.status==="deleted"?"该文件在这次提交中已删除,没有可展示的补丁内容。":"该文件在这次提交中没有可展示的补丁内容。",uu=n=>I1[n%I1.length]??I1[0],il=n=>Ly+n*Oy,gf=(n,t)=>`${n}\0${t}`,h0=n=>Array.isArray(n.parent_oids)?n.parent_oids.filter(Boolean):[],Zj=n=>Array.isArray(n.refs)?n.refs.filter(Boolean):[],Wj=n=>{var u;const t={};let a=[],r=0;const c=()=>{const h=r;return r+=1,h};for(const h of n){let p=a.findIndex(w=>w.oid===h.oid);p<0&&(a=[...a,{oid:h.oid,colorIndex:c()}],p=a.length-1);const y=a.map(w=>({...w})),m=((u=y[p])==null?void 0:u.colorIndex)??c(),b=[...new Set(h0(h))],g=y.map(w=>({...w}));b.length>0?g[p]={oid:b[0],colorIndex:m}:g.splice(p,1);const x=[];if(b.length>0){const w=g.findIndex(N=>N.oid===b[0]);x.push(w>=0?w:p)}b.slice(1).forEach((w,N)=>{let T=g.findIndex(C=>C.oid===w);T<0&&(T=Math.min(g.length,p+1+N),g.splice(T,0,{oid:w,colorIndex:c()})),x.push(T)}),t[h.oid]={beforeLanes:y,afterLanes:g,laneIndex:p,nodeColorIndex:m,parentLaneIndexes:x},a=g.filter((w,N,T)=>T.findIndex(C=>C.oid===w.oid)===N)}return t},Xj=({commit:n,row:t,isLocalHead:a,isRemoteHead:r,isFirstRow:c,maxLaneCount:u})=>{const h=h0(n).length,p=Math.max(u,t.beforeLanes.length,t.afterLanes.length,1),y=Math.max(40,Ly*2+(p-1)*Oy),m=il(t.laneIndex),b=h>1?4.7:3.9,g=Math.max(0,nr-b-1.1),x={"--session-git-graph-width":`${Math.max(48,Math.ceil(y*(56/So)))}px`};return l.jsx("span",{className:"session-git-history__graph",style:x,children:l.jsxs("svg",{className:`session-git-history__graph-svg ${h>1?"is-merge":""}`,viewBox:`0 0 ${y} ${So}`,preserveAspectRatio:"xMinYMid meet","aria-hidden":"true",children:[t.beforeLanes.map((w,N)=>l.jsx("path",{d:`M ${il(N)} ${c?g:0} L ${il(N)} ${g}`,stroke:uu(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none",opacity:c?0:1},`before:${w.oid}:${N}`)),t.afterLanes.map((w,N)=>{const T=t.beforeLanes.findIndex(H=>H.oid===w.oid),C=T>=0?il(T):il(N),I=il(N),$=C===I?`M ${I} ${nr} L ${I} ${So}`:`M ${C} ${nr} C ${C} 27 ${I} 31 ${I} ${So}`;return l.jsx("path",{d:$,stroke:uu(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none"},`after:${w.oid}:${N}`)}),t.parentLaneIndexes.map((w,N)=>{var $;const T=il(w),C=uu((($=t.afterLanes[w])==null?void 0:$.colorIndex)??t.nodeColorIndex),I=T===m?`M ${m} ${nr} L ${T} ${So}`:`M ${m} ${nr} C ${m} 27 ${T} 31 ${T} ${So}`;return l.jsx("path",{d:I,stroke:C,strokeWidth:N>0||h>1?"2.2":"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:N>0||h>1?.96:.88},`parent:${n.oid}:${N}`)}),l.jsx("circle",{cx:m,cy:nr,r:b,fill:"var(--color-surface-panel)",stroke:uu(t.nodeColorIndex),strokeWidth:h>1?"1.8":"1.55"}),l.jsx("circle",{cx:m,cy:nr,r:a||r?1.6:1.05,fill:uu(t.nodeColorIndex)}),a&&r?l.jsx("circle",{cx:m,cy:nr,r:"6.4",fill:"none",stroke:"color-mix(in oklab, var(--color-accent-primary) 22%, transparent)",strokeWidth:"1",strokeDasharray:"1.5 3"}):null]})})},Jj=({workspace:n,history:t,isLoading:a,isHistoryLoading:r,error:c,historyError:u,onRefresh:h,onRefreshHistory:p,onRequestHistory:y,onDiscardFile:m,onDiscardAll:b,onCommitAll:g,onSwitchBranch:x,onPush:w,onLoadWorkspaceFileDiff:N,onLoadHistoryFileDiff:T,pendingAction:C,compact:I=!1})=>{const[$,H]=_.useState("changes"),[R,Q]=_.useState({}),[ce,Z]=_.useState({}),[ie,ee]=_.useState({}),[Y,F]=_.useState({}),[_e,je]=_.useState({}),[ae,ue]=_.useState({}),[E,U]=_.useState({}),[te,W]=_.useState({}),[xe,A]=_.useState({}),[ne,be]=_.useState(!1),[V,pe]=_.useState(null),[Ce,Le]=_.useState(""),[he,q]=_.useState(null),Se=_.useRef(null);_.useEffect(()=>{Q(qe=>{if(!(n!=null&&n.files.length))return{};const De=new Set(n.files.map($e=>$e.path));let Ie=!1;const We={};for(const[$e,He]of Object.entries(qe)){if(!De.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:qe});const oe=new Set((n==null?void 0:n.files.map(qe=>qe.path))??[]);Z(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe}),ee(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe}),F(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe})},[n==null?void 0:n.files]),_.useEffect(()=>{const oe=new Set((t==null?void 0:t.commits.map(De=>De.oid))??[]),qe=new Set((t==null?void 0:t.commits.flatMap(De=>De.files.map(Ie=>gf(De.oid,Ie.path))))??[]);je(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!oe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),ue(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!oe.has($e)){Ie=!0;continue}if(He&&!qe.has(gf($e,He))){Ie=!0,We[$e]=null;continue}We[$e]=He}return Ie?We:De}),U(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),W(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),A(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De})},[t==null?void 0:t.commits]),_.useEffect(()=>{if(!ne)return;const oe=qe=>{var De;(De=Se.current)!=null&&De.contains(qe.target)||be(!1)};return window.addEventListener("pointerdown",oe),()=>{window.removeEventListener("pointerdown",oe)}},[ne]),_.useEffect(()=>{n&&(V==="commit"&&(C==null?void 0:C.action)!=="commit-all"&&n.files.length===0&&(pe(null),Le("")),he&&n.branch===he&&(q(null),pe(null),Le(""),be(!1)))},[V,C==null?void 0:C.action,he,n]),_.useEffect(()=>{n!=null&&n.branches.length||be(!1)},[n==null?void 0:n.branches]),_.useEffect(()=>{Z({}),ee({}),F({})},[n==null?void 0:n.updated_at]);const Ne=(n==null?void 0:n.files)??[],me=(t==null?void 0:t.commits)??[],Te=Ne.length>0,Ge=me.length>0,Ue=(C==null?void 0:C.action)==="discard-all",gt=(C==null?void 0:C.action)==="commit-all",Lt=(C==null?void 0:C.action)==="switch-branch",St=(C==null?void 0:C.action)==="push",st=$==="changes",tn=V==="switch-branch"&&he?`提交后切换到 ${he}`:"提交全部改动",$t=_.useMemo(()=>{if(!n)return null;const oe=[];return n.upstream_branch&&oe.push(n.upstream_branch),n.ahead_count>0&&oe.push(`ahead ${n.ahead_count}`),n.behind_count>0&&oe.push(`behind ${n.behind_count}`),oe.join(" · ")},[n]),de=_.useMemo(()=>{if(!t)return null;const oe=[t.branch];return t.upstream_branch&&oe.push(t.upstream_branch),oe.join(" · ")},[t]),Ae=_.useMemo(()=>$==="history"?Wj(me):{},[$,me]),Re=_.useMemo(()=>$!=="history"?1:Math.max(1,...Object.values(Ae).map(oe=>Math.max(oe.beforeLanes.length,oe.afterLanes.length,oe.laneIndex+1))),[$,Ae]),Oe=(oe,qe)=>{ce[oe]||ie[oe]||(ee(De=>({...De,[oe]:!0})),F(De=>{const Ie={...De};return delete Ie[oe],Ie}),N(oe,qe).then(De=>{Z(Ie=>({...Ie,[oe]:De}))}).catch(De=>{F(Ie=>({...Ie,[oe]:De instanceof Error?De.message:"无法读取该文件的差异。"}))}).finally(()=>{ee(De=>{const Ie={...De};return delete Ie[oe],Ie})}))};_.useEffect(()=>{if(!($!=="changes"||Ne.length===0))for(const oe of Ne)R[oe.path]&&Oe(oe.path,oe.previous_path)},[$,R,Ne,N,ce,ie]);const Ke=()=>{pe(null),Le(""),q(null)},mt=()=>{q(null),pe(oe=>oe==="commit"?(Le(""),null):"commit")},kt=()=>{const oe=Ce.trim();if(oe){if(V==="switch-branch"&&he){Promise.resolve(x(he,oe)).catch(()=>{});return}g(oe)}},rn=oe=>{if(!(!n||oe===n.branch||C)){if(be(!1),n.files.length>0){q(oe),pe("switch-branch");return}Promise.resolve(x(oe)).catch(()=>{})}},Pn=()=>{if(st){h();return}p()},On=()=>{H(oe=>{const qe=oe==="changes"?"history":"changes";return qe==="history"&&y(),qe})},nn=(oe,qe)=>{const De=gf(oe.oid,qe.path),Ie=ae[oe.oid]===qe.path;ue(We=>({...We,[oe.oid]:Ie?null:qe.path})),!(Ie||E[De]||te[De])&&(W(We=>({...We,[De]:!0})),A(We=>{const $e={...We};return delete $e[De],$e}),T(oe.oid,qe.path,qe.previous_path).then(We=>{U($e=>({...$e,[De]:We}))}).catch(We=>{A($e=>({...$e,[De]:We instanceof Error?We.message:"无法读取该文件的提交差异。"}))}).finally(()=>{W(We=>{const $e={...We};return delete $e[De],$e})}))},ln=oe=>{const qe=new Date(oe);return Number.isNaN(qe.getTime())?oe:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(qe)};return l.jsxs("section",{className:`session-git-panel ${I?"is-compact":""}`,children:[l.jsxs("div",{className:"session-git-panel__header",children:[l.jsxs("div",{className:"session-git-panel__heading",ref:Se,children:[l.jsxs("button",{type:"button",className:"session-git-panel__branch-button",onClick:()=>be(oe=>!oe),disabled:!n||!!C,"aria-haspopup":"menu","aria-expanded":ne,title:n?`切换分支:${n.branch}`:"分支加载中",children:[l.jsx("span",{className:"session-git-panel__branch-icon","aria-hidden":"true",children:l.jsx(Fj,{})}),l.jsx("span",{className:"session-git-panel__branch",children:(n==null?void 0:n.branch)??"加载中"}),l.jsx("span",{className:`session-git-panel__branch-chevron ${ne?"is-open":""}`,"aria-hidden":"true",children:l.jsx(z1,{})})]}),ne&&n?l.jsx("div",{className:"session-git-panel__branch-menu",role:"menu","aria-label":"分支列表",children:n.branches.map(oe=>{const qe=oe===n.branch,De=(C==null?void 0:C.action)==="switch-branch"&&C.branch===oe;return l.jsxs("button",{type:"button",className:`session-git-panel__branch-option ${qe?"is-current":""}`,onClick:()=>rn(oe),disabled:qe||!!C,role:"menuitemradio","aria-checked":qe,title:qe?`${oe}(当前)`:`切换到 ${oe}`,children:[l.jsx("span",{className:"session-git-panel__branch-option-name",children:oe}),qe?l.jsx("span",{className:"session-git-panel__branch-option-meta",children:"当前"}):null,De?l.jsx("span",{className:"session-git-panel__branch-option-meta",children:"切换中"}):null]},oe)})}):null]}),l.jsxs("div",{className:"session-git-panel__toolbar",children:[l.jsx(sr,{label:st?"切换到提交历史":"返回修改列表",icon:l.jsx(qj,{}),onClick:On,disabled:!!C,variant:st?"default":"primary",className:st?void 0:"is-active"}),l.jsx(sr,{label:st?a?"正在刷新":"刷新":r?"正在刷新历史":"刷新历史",icon:l.jsx(Uj,{}),onClick:Pn,disabled:st?a||!!C:r,pending:st?a:r}),st&&Te?l.jsxs(l.Fragment,{children:[l.jsx(sr,{label:Ue?"正在撤回全部修改":"撤回全部修改",icon:l.jsx(c2,{}),onClick:b,disabled:!!C,variant:"danger",pending:Ue}),l.jsx(sr,{label:gt?"正在提交全部修改":V==="commit"?"收起提交编辑器":"提交全部修改",icon:l.jsx(u2,{}),onClick:mt,disabled:!!C,variant:"primary",pending:gt})]}):null,st&&!Te?l.jsx(sr,{label:St?"正在推送当前分支":"推送当前分支",icon:l.jsx($j,{}),onClick:w,disabled:!!C,variant:"primary",pending:St}):null]})]}),st&&n?l.jsxs("div",{className:"session-git-panel__summary",children:[l.jsx("span",{className:"session-git-panel__summary-text",children:Te?`${Ne.length} 个文件待处理`:"当前工作区没有待提交改动"}),$t?l.jsx("span",{className:"session-git-panel__summary-meta",children:$t}):null]}):null,!st&&t?l.jsxs("div",{className:"session-git-panel__summary",children:[l.jsx("span",{className:"session-git-panel__summary-text",children:Ge?`${me.length} 条最近提交`:"当前分支还没有提交历史"}),de?l.jsx("span",{className:"session-git-panel__summary-meta",children:de}):null]}):null,st&&V&&Te?l.jsxs("div",{className:"session-git-panel__composer",children:[l.jsx("div",{className:"session-git-panel__composer-title",children:tn}),l.jsxs("div",{className:"session-git-panel__composer-row",children:[l.jsx("input",{value:Ce,onChange:oe=>Le(oe.target.value),placeholder:"输入 commit message",className:"session-git-panel__input",disabled:!!C}),l.jsx(sr,{label:V==="switch-branch"?"提交并切换分支":"确认提交",icon:l.jsx(u2,{}),onClick:kt,disabled:!Ce.trim()||!!C,variant:"primary",pending:gt||Lt}),l.jsx(sr,{label:"取消提交",icon:l.jsx(Hj,{}),onClick:Ke,disabled:!!C})]})]}):null,st&&c?l.jsx("div",{className:"session-git-panel__notice is-error",children:c}):null,!st&&u?l.jsx("div",{className:"session-git-panel__notice is-error",children:u}):null,st&&a&&!n?l.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前工作区改动…"}):null,!st&&r&&!t?l.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前分支提交历史…"}):null,st&&!a&&n&&!Te?l.jsx("div",{className:"session-git-panel__empty",children:"当前分支没有待提交改动。你现在可以直接推送当前分支。"}):null,!st&&!r&&t&&!Ge?l.jsx("div",{className:"session-git-panel__empty",children:"当前分支还没有提交历史。"}):null,st&&Te?l.jsx("div",{className:"session-git-panel__list",children:Ne.map(oe=>{const qe=!!R[oe.path],De=(C==null?void 0:C.action)==="discard-file"&&C.path===oe.path,Ie=ce[oe.path],We=!!ie[oe.path],$e=Y[oe.path]??null;return l.jsxs("article",{className:`session-git-file ${qe?"is-expanded":""}`,children:[l.jsxs("div",{className:"session-git-file__head",children:[l.jsxs("button",{type:"button",className:"session-git-file__toggle",onClick:()=>{const He=!qe;Q(Ee=>({...Ee,[oe.path]:He})),He&&Oe(oe.path,oe.previous_path)},"aria-expanded":qe,children:[l.jsxs("span",{className:"session-git-file__main",children:[l.jsx("span",{className:"session-git-file__path",children:oe.path}),oe.previous_path?l.jsxs("span",{className:"session-git-file__rename",children:["来自 ",oe.previous_path]}):null]}),l.jsxs("span",{className:"session-git-file__meta",children:[l.jsx("span",{className:`session-git-file__status is-${oe.status}`,children:d2(oe.status)}),l.jsxs("span",{className:"session-git-file__counts",children:[l.jsxs("span",{className:"is-add",children:["+",oe.additions]}),l.jsxs("span",{className:"is-remove",children:["-",oe.deletions]})]}),l.jsx("span",{className:"session-git-file__chevron","aria-hidden":"true",children:l.jsx(z1,{})})]})]}),l.jsx(sr,{label:De?`正在撤回 ${oe.path}`:`撤回 ${oe.path}`,icon:l.jsx(c2,{}),onClick:()=>m(oe.path),disabled:!!C,variant:"danger",pending:De,className:"session-git-file__action"})]}),qe?l.jsx("div",{className:"session-git-file__detail",children:$e?l.jsx("div",{className:"session-git-panel__notice is-error",children:$e}):We?l.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的差异…"}):l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:l.jsx(o2,{diffText:(Ie==null?void 0:Ie.diff)??"",filePath:oe.path,emptyMessage:Kj(oe)})})}):null]},oe.path)})}):null,!st&&Ge?l.jsx("div",{className:"session-git-history",children:me.map((oe,qe)=>{const De=!!_e[oe.oid],Ie=h0(oe),We=ae[oe.oid]??null,$e=Ae[oe.oid],He=(t==null?void 0:t.head_oid)===oe.oid,Ee=(t==null?void 0:t.upstream_head_oid)===oe.oid,Ut=Zj(oe).filter(at=>!at||at===(t==null?void 0:t.branch)||at===(t==null?void 0:t.upstream_branch)||at===`HEAD -> ${t==null?void 0:t.branch}`?!1:at!=="HEAD");return l.jsxs("article",{className:`session-git-history__item ${De?"is-expanded":""} ${Ie.length>1?"is-merge":""} ${He?"is-local-head":""} ${Ee?"is-remote-head":""}`.trim(),children:[l.jsxs("button",{type:"button",className:"session-git-history__toggle",onClick:()=>je(at=>({...at,[oe.oid]:!at[oe.oid]})),"aria-expanded":De,children:[$e?l.jsx(Xj,{commit:oe,row:$e,isLocalHead:He,isRemoteHead:Ee,isFirstRow:qe===0,maxLaneCount:Re}):null,l.jsxs("span",{className:"session-git-history__content",children:[l.jsx("span",{className:"session-git-history__subject",children:oe.subject}),l.jsxs("span",{className:"session-git-history__meta",children:[l.jsx("span",{children:oe.short_oid}),l.jsx("span",{children:oe.author_name}),l.jsx("span",{children:ln(oe.committed_at)})]})]}),l.jsxs("span",{className:"session-git-history__refs",children:[He?l.jsx("span",{className:"session-git-history__ref is-local",title:"本地当前 HEAD",children:l.jsx(Qj,{})}):null,Ee?l.jsx("span",{className:"session-git-history__ref is-remote",title:t!=null&&t.upstream_branch?`云端位置:${t.upstream_branch}`:"云端位置",children:l.jsx(Gj,{})}):null,Ie.length>1?l.jsx("span",{className:"session-git-history__ref is-merge",title:"合并提交",children:l.jsx(Vj,{})}):null,Ut.slice(0,2).map(at=>l.jsx("span",{className:"session-git-history__ref is-label",title:at,children:at},`${oe.oid}:${at}`))]}),l.jsx("span",{className:"session-git-history__chevron","aria-hidden":"true",children:l.jsx(z1,{})})]}),De?l.jsx("div",{className:"session-git-history__files",children:l.jsx("div",{className:"session-git-history__files-list",children:oe.files.map(at=>{const pn=We===at.path,Un=gf(oe.oid,at.path),xn=E[Un],ps=!!te[Un],gs=xe[Un]??null;return l.jsxs("div",{className:`session-git-history-file-row ${pn?"is-selected":""}`,children:[l.jsxs("button",{type:"button",className:`session-git-history-file ${pn?"is-selected":""}`,onClick:()=>nn(oe,at),"aria-pressed":pn,children:[l.jsx("span",{className:`session-git-file__status is-${at.status}`,children:d2(at.status)}),l.jsx("span",{className:"session-git-history-file__path",children:at.path}),at.previous_path?l.jsxs("span",{className:"session-git-history-file__rename",children:["来自 ",at.previous_path]}):null,l.jsx("span",{className:"session-git-history-file__meta",children:xn?l.jsxs("span",{className:"session-git-history-file__counts",children:[l.jsxs("span",{className:"is-add",children:["+",xn.additions]}),l.jsxs("span",{className:"is-remove",children:["-",xn.deletions]})]}):ps?l.jsx("span",{className:"session-git-history-file__loading",children:"读取中…"}):l.jsx("span",{className:"session-git-history-file__hint",children:"点击查看"})})]}),pn?l.jsxs("div",{className:"session-git-history__diff is-inline",children:[l.jsxs("div",{className:"session-git-history__diff-header",children:[l.jsx("span",{className:"session-git-history__diff-path",children:at.path}),at.previous_path?l.jsxs("span",{className:"session-git-history__diff-rename",children:["来自 ",at.previous_path]}):null]}),gs?l.jsx("div",{className:"session-git-panel__notice is-error",children:gs}):ps?l.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的提交差异…"}):l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:l.jsx(o2,{diffText:(xn==null?void 0:xn.diff)??"",filePath:at.path,emptyMessage:Yj(at,xn??null)})})]}):null]},`${oe.oid}:${at.path}`)})})}):null]},oe.oid)})}):null]})},f2={name:"",description:null,command:"",kill_command:null,cwd:null,shell:"auto",node_version:null,port:null},h2=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m8 6 9 6-9 6z"})}),m2=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("rect",{x:"6.5",y:"6.5",width:"11",height:"11",rx:"1.8"})}),ew=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),l.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),tw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),nw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),sw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),p2={auto:"自动",powershell:"PowerShell",cmd:"CMD",bash:"Bash"},aw=({commands:n,nodeRuntime:t,error:a,pendingRunCommandId:r,pendingKillCommandId:c,pendingDeleteCommandId:u,isSaving:h,isGenerating:p,isStartingAll:y,isStoppingAll:m,generationReason:b,executionModelLabel:g,onRun:x,onRunAll:w,onRunAllKill:N,onRunKill:T,onSave:C,onDelete:I,onGenerate:$})=>{var ue;const[H,R]=_.useState("list"),[Q,ce]=_.useState(null),[Z,ie]=_.useState(f2),ee=_.useMemo(()=>n.find(E=>E.id===Q)??null,[n,Q]),Y=_.useMemo(()=>{const E=[...(t==null?void 0:t.versions)??[]];return Z.node_version&&!E.includes(Z.node_version)&&E.unshift(Z.node_version),E},[Z.node_version,t==null?void 0:t.versions]),F=_.useMemo(()=>n.filter(E=>!!E.kill_command).length,[n]),_e=()=>{ie(f2),ce(null),R("edit")},je=E=>{ie({name:E.name,description:E.description,command:E.command,kill_command:E.kill_command,cwd:E.cwd,shell:E.shell,node_version:E.node_version,port:E.port}),ce(E.id),R("edit")},ae=()=>{C({commandId:ee==null?void 0:ee.id,draft:Z}),h||(R("list"),ce(null))};return l.jsxs("div",{className:"session-run-panel",children:[l.jsxs("div",{className:"session-run-panel__header",children:[l.jsxs("div",{className:"session-run-panel__header-copy",children:[l.jsxs("div",{className:"session-run-panel__title-row",children:[l.jsx("h2",{className:"session-run-panel__title",children:"项目命令"}),l.jsxs("span",{className:"session-run-panel__count",children:[n.length," 条"]})]}),l.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",g]})]}),l.jsxs("div",{className:"session-run-panel__header-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":y?"正在一键启动项目命令":"一键启动项目命令",title:y?"正在一键启动项目命令":"一键启动项目命令",disabled:n.length===0||y||m,onClick:w,children:l.jsx(h2,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":m?"正在一键停止项目命令":"一键停止项目命令",title:m?"正在一键停止项目命令":"一键停止项目命令",disabled:F===0||y||m,onClick:N,children:l.jsx(m2,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":p?"正在一键生成项目命令":"一键生成项目命令",title:p?"正在一键生成项目命令":"一键生成项目命令",disabled:p||y||m,onClick:$,children:l.jsx(ew,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目命令",title:"新增项目命令",onClick:_e,children:l.jsx(sw,{})})]})]}),a?l.jsx("div",{className:"session-run-panel__notice is-error",children:a}):null,b?l.jsx("div",{className:"session-run-panel__hint",children:b}):null,H==="edit"?l.jsxs("div",{className:"session-run-panel__card",children:[l.jsx("h3",{className:"session-run-panel__section-title",children:ee?"编辑命令":"新增命令"}),l.jsxs("div",{className:"session-run-panel__form-grid",children:[l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"名称"}),l.jsx("input",{value:Z.name,onChange:E=>ie(U=>({...U,name:E.target.value})),className:"session-run-panel__input",placeholder:"例如:启动前端"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"说明"}),l.jsx("input",{value:Z.description??"",onChange:E=>ie(U=>({...U,description:E.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"命令"}),l.jsx("textarea",{value:Z.command,onChange:E=>ie(U=>({...U,command:E.target.value})),className:"session-run-panel__textarea",placeholder:"pnpm dev",rows:4})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"停止命令"}),l.jsx("textarea",{value:Z.kill_command??"",onChange:E=>ie(U=>({...U,kill_command:E.target.value||null})),className:"session-run-panel__textarea",placeholder:"留空表示不需要单独停止",rows:3})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"工作目录"}),l.jsx("input",{value:Z.cwd??"",onChange:E=>ie(U=>({...U,cwd:E.target.value||null})),className:"session-run-panel__input",placeholder:"留空表示项目根目录"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"端口"}),l.jsx("input",{value:Z.port??"",onChange:E=>{const U=Number.parseInt(E.target.value,10);ie(te=>({...te,port:Number.isFinite(U)&&U>0?U:null}))},className:"session-run-panel__input",placeholder:"例如:5173",inputMode:"numeric"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"Shell"}),l.jsx("select",{value:Z.shell,onChange:E=>ie(U=>({...U,shell:E.target.value})),className:"session-run-panel__select",children:Object.entries(p2).map(([E,U])=>l.jsx("option",{value:E,children:U},E))})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"Node 环境"}),l.jsxs("select",{value:Z.node_version??"",onChange:E=>ie(U=>({...U,node_version:E.target.value||null})),className:"session-run-panel__select",children:[l.jsx("option",{value:"",children:"默认环境"}),Y.map(E=>l.jsxs("option",{value:E,children:["Node ",E,t!=null&&t.versions.includes(E)?"":"(未检测到)"]},E))]})]})]}),l.jsx("div",{className:"session-run-panel__hint",children:t!=null&&t.versions.length?"Node 版本只会临时注入当前命令,不会修改系统全局环境。":((ue=t==null?void 0:t.error)==null?void 0:ue.trim())||"未检测到可用的 nvm Node 版本,将按默认环境运行。"}),l.jsxs("div",{className:"session-run-panel__form-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>R("list"),children:"取消"}),l.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!Z.name.trim()||!Z.command.trim()||h,onClick:ae,children:h?"保存中...":ee?"保存修改":"保存命令"})]})]}):null,l.jsx("div",{className:"session-run-panel__list",children:n.length>0?n.map(E=>l.jsxs("article",{className:"session-run-panel__command-card",children:[l.jsxs("div",{className:"session-run-panel__command-head",children:[l.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>je(E),children:[l.jsxs("div",{className:"session-run-panel__command-heading",children:[l.jsx("span",{className:"session-run-panel__command-name",children:E.name}),E.description?l.jsx("span",{className:"session-run-panel__command-description",children:E.description}):null]}),l.jsx("div",{className:"session-run-panel__command-line",children:E.command})]}),l.jsxs("div",{className:"session-run-panel__command-actions",children:[E.kill_command?l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":`执行 ${E.name} 的停止命令`,title:`执行 ${E.name} 的停止命令`,disabled:c===E.id,onClick:()=>T(E.id),children:l.jsx(m2,{})}):null,l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${E.name}`,title:`编辑 ${E.name}`,onClick:()=>je(E),children:l.jsx(tw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${E.name}`,title:`删除 ${E.name}`,disabled:u===E.id,onClick:()=>I(E.id),children:l.jsx(nw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":`运行 ${E.name}`,title:`运行 ${E.name}`,disabled:r===E.id,onClick:()=>x(E.id),children:l.jsx(h2,{})})]})]}),l.jsx("div",{className:"session-run-panel__command-footer",children:l.jsxs("div",{className:"session-run-panel__command-meta",children:[l.jsx("span",{className:"session-run-panel__command-pill",children:p2[E.shell]}),E.node_version?l.jsxs("span",{className:"session-run-panel__command-pill is-node",children:["Node ",E.node_version]}):null,E.port?l.jsxs("span",{className:"session-run-panel__command-pill",children:[":",E.port]}):null,E.kill_command?l.jsx("span",{className:"session-run-panel__command-pill is-kill",children:"可停止"}):null,l.jsx("span",{className:"session-run-panel__command-pill",children:E.cwd?E.cwd:"项目根目录"})]})})]},E.id)):l.jsxs("div",{className:"session-run-panel__empty",children:[l.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目命令"}),l.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},g2={name:"",description:null,url:""},iw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),l.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),rw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),l.jsx("path",{d:"M3.8 12h16.4"}),l.jsx("path",{d:"M12 3.7c2.3 2.4 3.6 5.3 3.6 8.3S14.3 17.9 12 20.3c-2.3-2.4-3.6-5.3-3.6-8.3S9.7 6.1 12 3.7Z"})]}),lw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),ow=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),cw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),uw=({websites:n,error:t,pendingDeleteWebsiteId:a,isSaving:r,isGenerating:c,generationReason:u,executionModelLabel:h,onOpen:p,onSave:y,onDelete:m,onGenerate:b})=>{const[g,x]=_.useState("list"),[w,N]=_.useState(null),[T,C]=_.useState(g2),I=_.useMemo(()=>n.find(Q=>Q.id===w)??null,[w,n]),$=()=>{C(g2),N(null),x("edit")},H=Q=>{C({name:Q.name,description:Q.description,url:Q.url}),N(Q.id),x("edit")},R=()=>{y({websiteId:I==null?void 0:I.id,draft:T}),r||(x("list"),N(null))};return l.jsxs("div",{className:"session-run-panel",children:[l.jsxs("div",{className:"session-run-panel__header",children:[l.jsxs("div",{className:"session-run-panel__header-copy",children:[l.jsxs("div",{className:"session-run-panel__title-row",children:[l.jsx("h2",{className:"session-run-panel__title",children:"项目网页"}),l.jsxs("span",{className:"session-run-panel__count",children:[n.length," 条"]})]}),l.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",h]})]}),l.jsxs("div",{className:"session-run-panel__header-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":c?"正在一键生成项目网页":"一键生成项目网页",title:c?"正在一键生成项目网页":"一键生成项目网页",disabled:c,onClick:b,children:l.jsx(iw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目网页",title:"新增项目网页",onClick:$,children:l.jsx(cw,{})})]})]}),t?l.jsx("div",{className:"session-run-panel__notice is-error",children:t}):null,u?l.jsx("div",{className:"session-run-panel__hint",children:u}):null,g==="edit"?l.jsxs("div",{className:"session-run-panel__card",children:[l.jsx("h3",{className:"session-run-panel__section-title",children:I?"编辑网页":"新增网页"}),l.jsxs("div",{className:"session-run-panel__form-grid",children:[l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"名称"}),l.jsx("input",{value:T.name,onChange:Q=>C(ce=>({...ce,name:Q.target.value})),className:"session-run-panel__input",placeholder:"例如:前端首页"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"说明"}),l.jsx("input",{value:T.description??"",onChange:Q=>C(ce=>({...ce,description:Q.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"地址"}),l.jsx("input",{value:T.url,onChange:Q=>C(ce=>({...ce,url:Q.target.value})),className:"session-run-panel__input",placeholder:"http://localhost:5173"})]})]}),l.jsxs("div",{className:"session-run-panel__form-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>x("list"),children:"取消"}),l.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!T.name.trim()||!T.url.trim()||r,onClick:R,children:r?"保存中...":I?"保存修改":"保存网页"})]})]}):null,l.jsx("div",{className:"session-run-panel__list",children:n.length>0?n.map(Q=>l.jsxs("article",{className:"session-run-panel__command-card",children:[l.jsxs("div",{className:"session-run-panel__command-head",children:[l.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>H(Q),children:[l.jsxs("div",{className:"session-run-panel__command-heading",children:[l.jsx("span",{className:"session-run-panel__command-name",children:Q.name}),Q.description?l.jsx("span",{className:"session-run-panel__command-description",children:Q.description}):null]}),l.jsx("div",{className:"session-run-panel__command-line",children:Q.url})]}),l.jsxs("div",{className:"session-run-panel__command-actions",children:[l.jsx("a",{className:"session-run-panel__icon-button is-primary","aria-label":`打开 ${Q.name}`,title:`打开 ${Q.name}`,href:Q.url,target:"_blank",rel:"noreferrer",onClick:()=>p(Q),children:l.jsx(rw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${Q.name}`,title:`编辑 ${Q.name}`,onClick:()=>H(Q),children:l.jsx(lw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${Q.name}`,title:`删除 ${Q.name}`,disabled:a===Q.id,onClick:()=>m(Q.id),children:l.jsx(ow,{})})]})]}),l.jsx("div",{className:"session-run-panel__command-footer",children:l.jsx("div",{className:"session-run-panel__command-meta",children:l.jsx("span",{className:"session-run-panel__command-pill",children:"网页"})})})]},Q.id)):l.jsxs("div",{className:"session-run-panel__empty",children:[l.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目网页"}),l.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},dw=/\u001b\[([0-9;]*)m/g,fw={stdout:"",stderr:"stderr",system:"system"},y2={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"bright-black",91:"bright-red",92:"bright-green",93:"bright-yellow",94:"bright-blue",95:"bright-magenta",96:"bright-cyan",97:"bright-white"},wp={fg:null,bg:null,bold:!1,dim:!1,underline:!1},hw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6 18 18"}),l.jsx("path",{d:"M18 6 6 18"})]}),mw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M8 4H4v4"}),l.jsx("path",{d:"M16 4h4v4"}),l.jsx("path",{d:"M8 20H4v-4"}),l.jsx("path",{d:"M16 20h4v-4"}),l.jsx("path",{d:"M9 9 4 4"}),l.jsx("path",{d:"m15 9 5-5"}),l.jsx("path",{d:"m9 15-5 5"}),l.jsx("path",{d:"m15 15 5 5"})]}),pw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 4H4v5"}),l.jsx("path",{d:"M15 4h5v5"}),l.jsx("path",{d:"M9 20H4v-5"}),l.jsx("path",{d:"M15 20h5v-5"}),l.jsx("path",{d:"m4 9 5-5"}),l.jsx("path",{d:"m20 9-5-5"}),l.jsx("path",{d:"m4 15 5 5"}),l.jsx("path",{d:"m20 15-5 5"})]}),gw=n=>{if(!n)return"刚刚";const t=new Date(n);return Number.isNaN(t.getTime())?"刚刚":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit"}).format(t)},v2=(n,t)=>{const a=[n];return t.bold&&a.push("is-bold"),t.dim&&a.push("is-dim"),t.underline&&a.push("is-underline"),t.fg&&a.push(`is-fg-${t.fg}`),t.bg&&a.push(`is-bg-${t.bg}`),a.join(" ")},yw=(n,t)=>{if(t===0)return{...wp};if(t===1)return{...n,bold:!0,dim:!1};if(t===2)return{...n,dim:!0,bold:!1};if(t===4)return{...n,underline:!0};if(t===22)return{...n,bold:!1,dim:!1};if(t===24)return{...n,underline:!1};if(t===39)return{...n,fg:null};if(t===49)return{...n,bg:null};const a=y2[t];if(a)return{...n,fg:a};const r=y2[t-10];return r&&t>=40?{...n,bg:r}:n},vw=(n,t)=>{const a=[];let r=0,c={...wp};for(const u of n.matchAll(dw)){const h=u.index??0;h>r&&a.push({text:n.slice(r,h),className:v2(t,c)});const p=(u[1]??"").split(";").map(y=>Number.parseInt(y||"0",10)).filter(y=>Number.isFinite(y));p.length===0?c={...wp}:c=p.reduce(yw,c),r=h+u[0].length}return r<n.length&&a.push({text:n.slice(r),className:v2(t,c)}),a.length===0&&a.push({text:n,className:t}),a},Iy=_.memo(({chunks:n})=>{const t=_.useMemo(()=>n.map(a=>{const r=fw[a.stream],c=["session-terminal-output__segment",`is-${a.stream}`].join(" ");return{cursor:a.cursor,label:r,segments:vw(a.text,c)}}),[n]);return l.jsx(l.Fragment,{children:t.map(a=>l.jsxs("span",{className:"session-terminal-output__chunk",children:[a.label?l.jsx("span",{className:"session-terminal-output__label",children:a.label}):null,a.segments.map((r,c)=>l.jsx("span",{className:r.className,children:r.text},`${a.cursor}:${c}`))]},a.cursor))})});Iy.displayName="TerminalOutput";const _w=({terminals:n,activeTerminalId:t,outputs:a,error:r,compact:c=!1,canToggleFullscreen:u=!1,isFullscreen:h=!1,onSelectTerminal:p,onCloseTerminal:y,onToggleFullscreen:m})=>{const b=_.useRef(null),g=n.find(w=>w.id===t)??n[0]??null,x=g?a[g.id]:null;return _.useEffect(()=>{const w=b.current;w&&(w.scrollTop=w.scrollHeight)},[x==null?void 0:x.chunks,g==null?void 0:g.id]),n.length===0?l.jsx("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:l.jsxs("div",{className:"session-terminal-panel__empty",children:[l.jsx("div",{className:"session-terminal-panel__empty-title",children:"还没有运行中的命令"}),l.jsx("p",{className:"session-terminal-panel__empty-copy",children:"从右上角的运行按钮启动一个项目命令后,这里会实时显示终端输出。"})]})}):l.jsxs("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:[l.jsxs("div",{className:"session-terminal-panel__tabs",children:[l.jsx("div",{className:"session-terminal-panel__tab-list",role:"tablist","aria-label":"终端列表",children:n.map(w=>{const N=w.id===(g==null?void 0:g.id);return l.jsxs("div",{className:`session-terminal-panel__tab ${N?"is-active":""}`,children:[l.jsxs("button",{type:"button",className:"session-terminal-panel__tab-button",role:"tab","aria-selected":N,onClick:()=>p(w.id),children:[l.jsx("span",{className:`session-terminal-panel__tab-dot is-${w.status}`,"aria-hidden":"true"}),l.jsx("span",{className:"session-terminal-panel__tab-title",children:w.title}),l.jsx("span",{className:"session-terminal-panel__tab-time",children:gw(w.last_output_at??w.updated_at)})]}),l.jsx("button",{type:"button",className:"session-terminal-panel__tab-close","aria-label":`关闭 ${w.title}`,onClick:T=>{T.stopPropagation(),y(w.id)},children:l.jsx(hw,{})})]},w.id)})}),u&&m?l.jsx("button",{type:"button",className:"session-terminal-panel__fullscreen-button",onClick:m,"aria-label":h?"退出终端全屏":"终端全屏",title:h?"退出终端全屏":"终端全屏",children:h?l.jsx(pw,{}):l.jsx(mw,{})}):null]}),g?l.jsxs(l.Fragment,{children:[r?l.jsx("div",{className:"session-terminal-panel__notice is-error",children:r}):null,x!=null&&x.error?l.jsx("div",{className:"session-terminal-panel__notice is-error",children:x.error}):null,x!=null&&x.truncated?l.jsx("div",{className:"session-terminal-panel__notice",children:"终端输出过长,已自动显示服务端仍保留的最近内容。"}):null,l.jsx("div",{ref:b,className:"session-terminal-panel__output-wrap",children:l.jsx("pre",{className:"session-terminal-output",children:x&&x.chunks.length>0?l.jsx(Iy,{chunks:x.chunks}):x!=null&&x.isLoading?l.jsx("span",{className:"session-terminal-output__placeholder",children:"正在读取终端输出..."}):l.jsx("span",{className:"session-terminal-output__placeholder",children:"这个终端暂时还没有输出。"})})})]}):null]})},bw=_.memo(function({conversationMainRef:t,conversationScrollRef:a,isDesktopSidebar:r,sidebarShift:c,isSidebarDragging:u,title:h,titleActions:p,topbarActions:y,onOpenSidebar:m,threadContent:b,connectionStatus:g,isConnectionDetailOpen:x,onToggleConnectionDetail:w,showThinkingStatus:N}){const T={transform:`translateX(${c}px)`,transition:u?"none":void 0};return l.jsxs("div",{ref:t,className:`conversation-main ${r?"has-desktop-sidebar":""}`,style:T,children:[l.jsxs("div",{className:"conversation-topbar",children:[r?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:m,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsxs("div",{className:"conversation-topbar__title-row",children:[l.jsx("h1",{children:h}),p]})}),y]}),l.jsx("div",{ref:a,className:"conversation-scroll",children:l.jsxs("div",{className:"conversation-thread",children:[b,g.state!=="connected"?l.jsx("section",{className:"conversation-entry is-connection-status",children:l.jsxs("div",{className:"connection-status",children:[l.jsx("button",{type:"button",className:"connection-status__pill",onClick:C=>{C.stopPropagation(),w()},children:l.jsx("span",{children:g.state==="failed"?"连接异常":`Reconnecting... ${g.attempt}/${g.maxAttempts}`})}),x&&g.error?l.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:g.error}):null]})}):null,N?l.jsx("section",{className:"conversation-entry is-thinking-status",children:l.jsx("div",{className:"thinking-status-pill",children:l.jsx("span",{children:"正在思考"})})}):null]})})]})}),_2="panda:last-session-id",xw=.4,Sw=104,jw=1800*1e3,ww=15e3,kw=120*1e3,b2=2e3,x2=1100,zy="panda:desktop-sidebar-width",hu="panda:desktop-sidebar-width-version",mu="2026-03-24-narrow",Nw=300,By=232,jo=By,Cw=460,Tw=72,Ew=4200,B1="local-model-panel:",Mw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),Rw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"10",height:"10",rx:"2"}),l.jsx("path",{d:"M7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1"})]}),Aw=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m7.5 12.5 3 3 6-7"})}),Dw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),Ow=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m9 18-6-6 6-6"}),l.jsx("path",{d:"m15 6 6 6-6 6"})]}),Lw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"6",r:"2.2"}),l.jsx("circle",{cx:"18",cy:"6",r:"2.2"}),l.jsx("circle",{cx:"12",cy:"18",r:"2.2"}),l.jsx("path",{d:"M8 7.6 10.5 16"}),l.jsx("path",{d:"M16 7.6 13.5 16"}),l.jsx("path",{d:"M8.2 6h7.6"})]}),Iw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),l.jsx("path",{d:"m7.5 9 2.8 3-2.8 3"}),l.jsx("path",{d:"M12.8 15H16.5"})]}),zw=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M7 5.5 18 12 7 18.5Z"})}),Bw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.4"}),l.jsx("path",{d:"M3.8 12h16.4"}),l.jsx("path",{d:"M12 3.7c2.3 2.3 3.6 5.2 3.6 8.3s-1.3 6-3.6 8.3c-2.3-2.3-3.6-5.2-3.6-8.3s1.3-6 3.6-8.3Z"})]}),S2=(n,t)=>{const a=new Map;for(const r of n)a.set(r.cursor,r);for(const r of t)a.set(r.cursor,r);return[...a.values()].sort((r,c)=>r.cursor-c.cursor)},Pw=800,m0=(n,t,a)=>{const r=n.get(t);if(r!==void 0)return n.delete(t),n.set(t,r),r;const c=a();if(n.set(t,c),n.size>Pw){const u=n.keys().next().value;u&&n.delete(u)}return c},Uw=new Map,qw=new Map,$w=new Map,kp=()=>Rp(()=>import("./session-diff-preview-Dg7a3ySE.js"),[]),Hw=_.lazy(async()=>({default:(await kp()).SessionDiffPreview})),Fw=/<proposed_plan>([\s\S]*?)<\/proposed_plan>/g,Qw=n=>m0(Uw,n,()=>My(n)),Np=n=>n.replace(/\\/g,"/"),Gw=n=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(n.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},Vw=n=>n.kind==="system"&&n.title==="context_compacted",j2=n=>n>=1e3?`${Math.round(n/1e3)}k`:String(Math.round(n)),Kw=n=>m0(qw,n,()=>{const t=n.replace(/\r\n/g,`
123
+ `,wj=()=>l.jsx("span",{"aria-hidden":"true",className:"new-thread-hero__logo",dangerouslySetInnerHTML:{__html:jj}}),kj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m15 18-6-6 6-6"})}),Nj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 18 6-6-6-6"})}),t2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),l.jsx("path",{d:"M12 10.4v4.2"}),l.jsx("path",{d:"M12 7.9h.01"})]}),Cj=(n,t)=>{var a;return((a=n[t])==null?void 0:a.trim())??""},n2=()=>typeof window<"u"&&!window.matchMedia("(max-width: 768px)").matches,Tj=_.memo(function({requests:t,hasStripBelow:a,pendingRequestId:r,onRespond:c}){const u=t[0]??null,[h,p]=_.useState(null),[y,m]=_.useState(""),[b,g]=_.useState({}),[x,w]=_.useState(0),[N,T]=_.useState(null),[C,I]=_.useState(null);_.useEffect(()=>{p(null),m(""),g({}),w(0),T(null),I(null)},[u==null?void 0:u.id]);const $=u?r===u.id:!1,H=(u==null?void 0:u.kind)==="user_input",R=H&&u.questions.length>0?u.questions[Math.max(0,Math.min(x,u.questions.length-1))]??null:null,Q=R?Cj(b,R.id):"",ce=R?R.options.some(ae=>ae.label===Q):!1,Z=!!(R&&Q&&(!ce||N===R.id));_.useEffect(()=>{if(!R){T(null);return}if(ce){T(null);return}Q&&T(R.id)},[ce,R,Q]);const ie=_.useMemo(()=>!u||$?!1:u.kind==="user_input"?R?!!Q:!1:h?!0:u.allow_freeform?!!y.trim():!1,[R,Q,u,y,$,h]);if(!u)return null;const ee=u.questions.reduce((ae,ue)=>ae+ue.options.length,u.options.length),Y=ae=>{$||c({requestId:u.id,optionId:(ae==null?void 0:ae.optionId)??h,text:(ae==null?void 0:ae.text)??y,answers:(ae==null?void 0:ae.answers)??b})},F=()=>{if(!(!u||u.kind!=="user_input"||!R)){if(x<u.questions.length-1){w(ae=>Math.min(ae+1,u.questions.length-1));return}Y()}},_e=()=>{if(!u||u.kind!=="user_input"||!R)return;const ae={...b,[R.id]:"忽略"};if(g(ae),T(null),x<u.questions.length-1){w(ue=>Math.min(ue+1,u.questions.length-1));return}Y({answers:ae})},je=ae=>{if(!(!u||u.kind!=="user_input"||!R||$)){if(Q===ae){F();return}g(ue=>({...ue,[R.id]:ae})),T(null)}};return l.jsx("section",{className:`session-interaction-strip ${a?"has-strip-below":""} ${H?"is-user-input-flow":""}`,children:u.kind==="user_input"&&R?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"session-interaction-flow__header",children:[l.jsx("div",{className:"session-interaction-flow__prompt",children:R.question}),l.jsxs("div",{className:"session-interaction-flow__progress",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":"上一题",disabled:x===0||$,onClick:()=>w(ae=>Math.max(0,ae-1)),children:l.jsx(kj,{})}),l.jsxs("span",{className:"session-interaction-flow__counter",children:[x+1," / ",u.questions.length]}),l.jsx("button",{type:"button",className:"session-interaction-flow__nav","aria-label":x===u.questions.length-1?"提交回复":"下一题",disabled:$||!ie,onClick:F,children:l.jsx(Nj,{})})]})]}),l.jsx("div",{className:"session-interaction-flow__body",children:l.jsxs("div",{className:"session-interaction-flow__list",children:[R.options.map((ae,ue)=>l.jsxs("div",{className:`session-interaction-flow__item is-${ae.emphasis} ${Q===ae.label?"is-active":""}`,role:"button",tabIndex:$?-1:0,"aria-pressed":Q===ae.label,onClick:()=>je(ae.label),onKeyDown:E=>{E.key==="Enter"&&n2()&&(E.preventDefault(),je(ae.label))},children:[l.jsxs("span",{className:"session-interaction-flow__item-index",children:[ue+1,"."]}),l.jsxs("span",{className:"session-interaction-flow__item-choice",children:[l.jsx("span",{className:"session-interaction-flow__item-label",children:ae.label}),ae.description?l.jsxs("span",{className:"session-interaction-flow__tooltip-wrap",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__tooltip-trigger","aria-label":`查看 ${ae.label} 的说明`,"aria-expanded":C===ae.id,onMouseEnter:()=>I(ae.id),onMouseLeave:()=>I(E=>E===ae.id?null:E),onBlur:()=>I(E=>E===ae.id?null:E),onClick:E=>{E.stopPropagation(),I(U=>U===ae.id?null:ae.id)},children:l.jsx(t2,{})}),l.jsx("div",{className:`session-interaction-flow__tooltip ${C===ae.id?"is-visible":""}`,role:"tooltip",children:ae.description})]}):null]})]},ae.id)),l.jsx("div",{className:`session-interaction-flow__item is-custom ${Z?"is-active":""}`,children:l.jsxs("div",{className:"session-interaction-flow__custom-input-wrap",children:[l.jsx("input",{type:"text",className:"session-interaction-flow__custom-input",value:ce?"":Q,disabled:$,placeholder:R.is_secret?"输入敏感信息":"否,请告知如何调整",onFocus:()=>{T(R.id),ce&&g(ae=>({...ae,[R.id]:""}))},onKeyDown:ae=>{ae.key==="Enter"&&ie&&!$&&n2()&&(ae.preventDefault(),F())},onChange:ae=>{T(R.id),g(ue=>({...ue,[R.id]:ae.target.value}))}}),l.jsxs("div",{className:"session-interaction-flow__inline-actions",children:[l.jsx("button",{type:"button",className:"session-interaction-flow__ghost",disabled:$,onClick:_e,children:"忽略"}),l.jsx("button",{type:"button",className:"session-interaction-flow__primary",disabled:!ie,onClick:F,children:$?"提交中...":x===u.questions.length-1?u.submit_label??"提交回复":"继续"})]})]})})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"session-interaction-strip__header",children:[l.jsx("span",{className:"session-interaction-strip__icon","aria-hidden":"true",children:l.jsx(t2,{})}),l.jsxs("div",{className:"session-interaction-strip__copy",children:[l.jsxs("div",{className:"session-interaction-strip__title",children:[u.title,t.length>1?l.jsxs("span",{className:"session-interaction-strip__count",children:["还有 ",t.length-1," 个待处理"]}):null]}),u.description?l.jsx("div",{className:"session-interaction-strip__description",children:u.description}):null]})]}),u.options.length>0?l.jsx("div",{className:"session-interaction-strip__options",children:u.options.map(ae=>l.jsxs("button",{type:"button",className:`session-interaction-option is-${ae.emphasis} ${h===ae.id?"is-active":""}`,disabled:$,onClick:()=>{p(ae.id),!u.allow_freeform&&ee<=3&&Y({optionId:ae.id})},children:[l.jsx("span",{className:"session-interaction-option__label",children:ae.label}),ae.description?l.jsx("span",{className:"session-interaction-option__description",children:ae.description}):null]},ae.id))}):null,u.allow_freeform?l.jsxs("label",{className:"session-interaction-strip__freeform",children:[l.jsx("span",{className:"session-interaction-strip__freeform-label",children:"自定义回复"}),l.jsx("textarea",{value:y,disabled:$,placeholder:u.freeform_placeholder??"输入回复内容",onChange:ae=>m(ae.target.value)})]}):null,u.allow_freeform||u.options.length>3?l.jsx("div",{className:"session-interaction-strip__footer",children:l.jsx("button",{type:"button",className:"session-interaction-strip__submit",disabled:!ie,onClick:()=>Y(),children:$?"提交中...":u.submit_label??"继续"})}):null]})})}),Ej=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),Mj=({panel:n,isPending:t,onDismiss:a,onSelectOption:r,onSubmitText:c})=>{const[u,h]=_.useState("");return _.useEffect(()=>{h("")},[n.panel_id,n.status]),l.jsxs("section",{className:`session-command-panel is-${n.status}`,children:[l.jsxs("div",{className:"session-command-panel__header",children:[l.jsxs("div",{className:"session-command-panel__command",children:["/",n.command_name]}),l.jsx("button",{type:"button",className:"session-command-panel__close","aria-label":"关闭命令面板",onClick:a,children:l.jsx(Ej,{})})]}),l.jsx("div",{className:"session-command-panel__title",children:n.title}),n.description?l.jsx("div",{className:"session-command-panel__description",children:n.description}):null,l.jsx("pre",{className:"session-command-panel__body",children:n.body}),n.input_type==="choice"&&n.options.length>0?l.jsx("div",{className:"session-command-panel__options",children:n.options.map(p=>l.jsxs("button",{type:"button",className:"session-command-panel__option",disabled:t,onClick:()=>r(p.id),children:[l.jsx("span",{className:"session-command-panel__option-label",children:p.label}),p.description?l.jsx("span",{className:"session-command-panel__option-description",children:p.description}):null]},p.id))}):null,n.input_type==="text"?l.jsxs("form",{className:"session-command-panel__form",onSubmit:p=>{p.preventDefault(),!(!u.trim()||t)&&c(u.trim())},children:[l.jsx("input",{className:"session-command-panel__input",value:u,disabled:t,placeholder:n.input_placeholder??"继续输入",onChange:p=>h(p.target.value)}),l.jsx("button",{type:"submit",className:"session-command-panel__submit",disabled:t||!u.trim(),children:n.submit_label??"提交"})]}):null]})},Rj=_.memo(function({planSnapshot:t,hasStripAbove:a,hasStripBelow:r}){const[c,u]=_.useState(!0);return t.steps.length?l.jsxs("section",{className:`session-plan-strip ${c?"is-collapsed":""} ${a?"has-strip-above":""} ${r?"has-strip-below":""}`,children:[l.jsxs("button",{type:"button",className:"session-plan-strip__toggle",onClick:()=>u(h=>!h),"aria-expanded":!c,children:[l.jsxs("div",{className:"session-plan-strip__summary",children:[l.jsx("span",{className:"session-plan-strip__summary-mark","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"4.5",y:"5",width:"15",height:"14",rx:"2.5"}),l.jsx("path",{d:"M8 9h8"}),l.jsx("path",{d:"M8 13h5.5"}),l.jsx("path",{d:"m15.5 14.5 1.5 1.5 2.5-3"})]})}),l.jsx("span",{className:"session-plan-strip__summary-text",children:l.jsxs("span",{children:["共 ",t.total_count," 个任务,已完成 ",t.completed_count," 个"]})})]}),l.jsx("span",{className:"session-plan-strip__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),c?null:l.jsx(l.Fragment,{children:l.jsx("div",{className:"session-plan-strip__steps",children:t.steps.map((h,p)=>l.jsxs("div",{className:`session-plan-step is-${h.status}`,children:[l.jsx("span",{className:"session-plan-step__dot","aria-hidden":"true",children:h.status==="in_progress"?l.jsx("span",{className:"session-plan-step__spinner"}):null}),l.jsxs("span",{className:"session-plan-step__index",children:[p+1,"."]}),l.jsx("span",{className:"session-plan-step__label",children:h.step})]},h.id))})})]}):null}),Aj=n=>{const t=(n==null?void 0:n.enabled)??!0;return Es({queryKey:["codex-commands"],enabled:t,queryFn:async()=>(await Jn()).client.getCodexCommands(),staleTime:0,gcTime:30*6e4,refetchOnWindowFocus:!1,retry:1})},Dj=(n,t)=>{const a=((t==null?void 0:t.enabled)??!0)&&!!n;return Es({queryKey:["project-skills",n],enabled:a,queryFn:async()=>n?(await Jn({projectId:n})).client.getProjectSkills(n):[],staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,retry:1})},s2=24,Oj=n=>{const t=My(n);return t.length===0?l.jsx("span",{children:" "}):t.map((a,r)=>{const c=`skill-aware-token-${r}`;return a.kind==="skill"?l.jsx("span",{className:"skill-aware-textarea__token is-skill",children:a.raw},c):a.kind==="command"?l.jsx("span",{className:"skill-aware-textarea__token is-command",children:a.raw},c):a.kind==="code"?l.jsx("span",{className:"skill-aware-textarea__token is-code",children:a.value},c):a.kind==="path-link"?l.jsx("span",{className:"skill-aware-textarea__token is-link",children:a.label},c):l.jsx("span",{children:a.value},c)})},a2=({value:n,onChange:t,onKeyDown:a,placeholder:r,disabled:c=!1,className:u,projectId:h,autoFocus:p=!1})=>{var U;const y=u.includes("composer-fullscreen-sheet__input"),m=_.useRef(null),b=_.useRef(null),[g,x]=_.useState({start:0,end:0}),[w,N]=_.useState(!1),[T,C]=_.useState(!1),[I,$]=_.useState(0),H=_.useMemo(()=>Ry(n,g.start,g.end),[g.end,g.start,n]),R=_.useMemo(()=>Ay(n,g.start,g.end),[g.end,g.start,n]),Q=w&&!c&&!!H&&!T,ce=w&&!c&&!!R&&!T,Z=ce?"command":Q?"skill":null,ie=Dj(h,{enabled:Q}),ee=Aj({enabled:ce}),Y=_.useMemo(()=>dj(ie.data??[],(H==null?void 0:H.query)??"").slice(0,s2),[H==null?void 0:H.query,ie.data]),F=_.useMemo(()=>{var te;return fj(((te=ee.data)==null?void 0:te.commands)??[],(R==null?void 0:R.query)??"").slice(0,s2)},[R==null?void 0:R.query,(U=ee.data)==null?void 0:U.commands]);_.useEffect(()=>{$(0)},[H==null?void 0:H.query,H==null?void 0:H.start,R==null?void 0:R.query,n,h]),_.useEffect(()=>{C(!1)},[H==null?void 0:H.query,H==null?void 0:H.start,H==null?void 0:H.end,R==null?void 0:R.query,R==null?void 0:R.start,R==null?void 0:R.end]);const _e=()=>{!m.current||!b.current||(b.current.scrollTop=m.current.scrollTop,b.current.scrollLeft=m.current.scrollLeft)},je=()=>{m.current&&x({start:m.current.selectionStart??0,end:m.current.selectionEnd??0})},ae=te=>{if(!m.current)return;const W=cj(n,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,te.name);W&&(t(W.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(W.selectionStart,W.selectionEnd),x({start:W.selectionStart,end:W.selectionEnd}))}))},ue=te=>{if(!m.current)return;const W=uj(n,m.current.selectionStart??g.start,m.current.selectionEnd??g.end,te.name);W&&(t(W.value),typeof window<"u"&&window.requestAnimationFrame(()=>{m.current&&(m.current.focus(),m.current.setSelectionRange(W.selectionStart,W.selectionEnd),x({start:W.selectionStart,end:W.selectionEnd}))}))},E=te=>{const W=Z==="skill"&&Y.length>0||Z==="command"&&F.length>0;if(Z&&W){if(te.key==="ArrowDown"){te.preventDefault();const xe=Z==="command"?F.length:Y.length;$(A=>(A+1)%xe);return}if(te.key==="ArrowUp"){te.preventDefault();const xe=Z==="command"?F.length:Y.length;$(A=>A-1<0?xe-1:A-1);return}if((te.key==="Enter"||te.key==="Tab")&&!te.shiftKey&&!te.altKey&&!te.ctrlKey&&!te.metaKey){if(te.preventDefault(),Z==="command"){const A=F[I]??F[0];if(!A)return;ue(A);return}const xe=Y[I]??Y[0];if(!xe)return;ae(xe);return}}if(Z&&te.key==="Escape"){te.preventDefault(),C(!0);return}a==null||a(te)};return l.jsxs("div",{className:`skill-aware-textarea ${Z?"is-picker-open":""} ${y?"is-fullscreen":""}`,children:[ce?l.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"命令建议",children:ee.isLoading?l.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载命令…"}):ee.isError?l.jsx("div",{className:"skill-mention-picker__empty",children:"命令列表加载失败"}):F.length===0?l.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配命令"}):F.map((te,W)=>{const xe=W===I;return l.jsx("button",{type:"button",className:`skill-mention-picker__item ${xe?"is-active":""}`,role:"option","aria-selected":xe,onMouseDown:A=>{A.preventDefault(),ue(te)},onMouseEnter:()=>$(W),children:l.jsxs("span",{className:"skill-mention-picker__main",children:[l.jsxs("span",{className:"skill-mention-picker__name",children:["/",te.name]}),l.jsx("span",{className:"skill-mention-picker__description",children:te.description})]})},te.name)})}):Q?l.jsx("div",{className:"skill-mention-picker",role:"listbox","aria-label":"技能建议",children:ie.isLoading?l.jsx("div",{className:"skill-mention-picker__empty",children:"正在加载技能…"}):ie.isError?l.jsx("div",{className:"skill-mention-picker__empty",children:"技能列表加载失败"}):Y.length===0?l.jsx("div",{className:"skill-mention-picker__empty",children:"未找到匹配技能"}):Y.map((te,W)=>{const xe=W===I;return l.jsx("button",{type:"button",className:`skill-mention-picker__item ${xe?"is-active":""}`,role:"option","aria-selected":xe,onMouseDown:A=>{A.preventDefault(),ae(te)},onMouseEnter:()=>$(W),children:l.jsxs("span",{className:"skill-mention-picker__main",children:[l.jsxs("span",{className:"skill-mention-picker__name",children:["$",te.name]}),l.jsx("span",{className:"skill-mention-picker__description",children:te.description}),l.jsx("span",{className:"skill-mention-picker__scope",children:oj(te.scope)})]})},`${te.scope}:${te.name}:${te.path}`)})}):null,l.jsxs("div",{className:"skill-aware-textarea__surface",children:[l.jsx("div",{ref:b,className:`${u} skill-aware-textarea__overlay`,"aria-hidden":"true",children:n?Oj(n):l.jsx("span",{children:" "})}),l.jsx("textarea",{ref:m,className:`${u} skill-aware-textarea__input`,value:n,disabled:c,placeholder:r,autoFocus:p,onChange:te=>{t(te.target.value),C(!1),x({start:te.target.selectionStart??0,end:te.target.selectionEnd??0})},onKeyDown:E,onClick:je,onSelect:je,onKeyUp:je,onFocus:()=>{N(!0),C(!1),je()},onBlur:()=>{N(!1)},onScroll:_e})]})]})},L1=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),Lj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"m7 14 5 5 5-5"})]}),Ij=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M8 3H4v4"}),l.jsx("path",{d:"M16 3h4v4"}),l.jsx("path",{d:"M8 21H4v-4"}),l.jsx("path",{d:"M16 21h4v-4"}),l.jsx("path",{d:"M9 9 4 4"}),l.jsx("path",{d:"m15 9 5-5"}),l.jsx("path",{d:"m9 15-5 5"}),l.jsx("path",{d:"m15 15 5 5"})]}),zj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),i2=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M13 2 5.5 13h5L9 22l9.5-13h-5L13 2Z"})}),r2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 6h10"}),l.jsx("path",{d:"M9 12h10"}),l.jsx("path",{d:"M9 18h10"}),l.jsx("path",{d:"m4 6 1.5 1.5L7.5 5"}),l.jsx("path",{d:"m4 12 1.5 1.5L7.5 11"}),l.jsx("path",{d:"m4 18 1.5 1.5L7.5 17"})]}),Bj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 16V5"}),l.jsx("path",{d:"m8 9 4-4 4 4"}),l.jsx("path",{d:"M20 16.5v1A2.5 2.5 0 0 1 17.5 20h-11A2.5 2.5 0 0 1 4 17.5v-1"})]}),Dy=_.memo(function({isDesktopSidebar:t,sidebarShift:a,isSidebarDragging:r,composerError:c,onDismissComposerError:u,interactionRequests:h,pendingInteractionRequestId:p,onRespondInteraction:y,parentSession:m,backgroundAgentSessions:b,isBackgroundAgentsOpen:g,planSnapshot:x,onToggleBackgroundAgents:w,onOpenSession:N,getBackgroundAgentStatusLabel:T,getBackgroundAgentAccent:C,formatBackgroundAgentsLabel:I,hasBackgroundAgentStrip:$,commandPanel:H,isCommandPanelPending:R,onDismissCommandPanel:Q,onCommandPanelOptionSelect:ce,onCommandPanelTextSubmit:Z,projectId:ie=null,draft:ee,pendingAttachments:Y,canSendInput:F,isInputLocked:_e=!1,inputPlaceholder:je,readOnlyPlaceholder:ae,onDraftChange:ue,onUploadFiles:E,onRemoveAttachment:U,onSubmit:te,showStopIcon:W,isSendPending:xe,onInterrupt:A,isFastModeEnabled:ne,isPlanModeEnabled:be,onToggleFastMode:V,onTogglePlanMode:pe,showModeBadges:Ce=!1,selectedModel:Le,modelOptions:he=[],selectedReasoning:q,onSelectModel:Se,onSelectReasoning:Ne,contextUsage:me,isContextUsageOpen:Te,onToggleContextUsage:Ge,contextUsageRingStyle:Ue,usedPercent:gt,remainingPercent:Lt,usedTokensLabel:St,totalTokensLabel:st,showJumpToBottom:tn,onJumpToBottom:$t}){const de=_.useId(),[Ae,Re]=_.useState(!1),[Oe,Ke]=_.useState(null),mt=_.useRef(null),kt=_.useRef(null),rn=h[0]??null,Pn=(rn==null?void 0:rn.kind)==="user_input",On=h.length>0,nn=!!x&&!Pn,ln=!Pn&&$,oe=nn||ln,qe=On||nn||ln,De={transform:`translateX(${a}px)`,transition:r?"none":void 0},Ie=(!!ee.trim()||Y.length>0)&&F&&!_e&&!xe&&!W,We=F&&!_e,$e=()=>{Ie&&(Ke(null),te())},He=Ee=>{Ee.key!=="Enter"||Ee.shiftKey||Ee.altKey||Ee.ctrlKey||Ee.metaKey||Ee.nativeEvent.isComposing||typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches||(Ee.preventDefault(),$e())};return _.useEffect(()=>{if(!Ae)return;const Ee=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Ee}},[Ae]),_.useEffect(()=>{if(!Ae||typeof window>"u")return;const Ee=window.matchMedia("(min-width: 769px)"),Ut=()=>{Ee.matches&&Re(!1)};return Ut(),typeof Ee.addEventListener=="function"?(Ee.addEventListener("change",Ut),()=>{Ee.removeEventListener("change",Ut)}):(Ee.addListener(Ut),()=>{Ee.removeListener(Ut)})},[Ae]),_.useEffect(()=>{if(!Oe)return;const Ee=at=>{const pn=at.target;mt.current&&pn instanceof Node&&mt.current.contains(pn)||Ke(null)},Ut=at=>{at.key==="Escape"&&Ke(null)};return window.addEventListener("pointerdown",Ee),window.addEventListener("keydown",Ut),()=>{window.removeEventListener("pointerdown",Ee),window.removeEventListener("keydown",Ut)}},[Oe]),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`composer-wrap ${t?"has-desktop-sidebar":""}`,style:De,children:[c?l.jsxs("div",{className:"composer-alert",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"composer-alert__text",children:c}),l.jsx("button",{type:"button",className:"composer-alert__close",onClick:u,"aria-label":"关闭错误提示",children:l.jsx(L1,{})})]}):null,On?l.jsx(Tj,{requests:h,hasStripBelow:oe,pendingRequestId:p,onRespond:y}):null,nn&&x?l.jsx(Rj,{planSnapshot:x,hasStripAbove:On,hasStripBelow:ln}):null,ln&&m?l.jsxs("button",{type:"button",className:`background-agents-exit ${On||nn?"has-strip-above":""}`,onClick:()=>{N(m.id)},children:[l.jsx("span",{className:"background-agents-exit__icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M6 12h12"}),l.jsx("path",{d:"m13 7 5 5-5 5"})]})}),l.jsx("span",{children:"返回主会话"})]}):ln&&b.length>0?l.jsxs("section",{className:`background-agents-card ${g?"is-open":""} ${On||nn?"has-strip-above":""}`,children:[l.jsxs("button",{type:"button",className:"background-agents-card__toggle",onClick:w,"aria-expanded":g,children:[l.jsx("span",{className:"background-agents-card__icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"7",y:"4",width:"10",height:"7",rx:"2.5"}),l.jsx("path",{d:"M12 11v3"}),l.jsx("circle",{cx:"10",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("path",{d:"M4.5 18a4.5 4.5 0 0 1 4.5-4.5h6A4.5 4.5 0 0 1 19.5 18"})]})}),l.jsxs("span",{className:"background-agents-card__summary",children:[l.jsx("span",{className:"background-agents-card__title",children:I(b.length)}),g?l.jsx("span",{className:"background-agents-card__hint",children:"(@ to tag agents)"}):null]}),l.jsx("span",{className:"background-agents-card__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m8 10 4 4 4-4"})})})]}),g?l.jsx("div",{className:"background-agents-card__list",children:b.map(Ee=>{var Ut,at;return l.jsxs("button",{type:"button",className:`background-agent-row ${Ee.run_state==="running"?"is-running":"is-idle"}`,style:{"--agent-accent":C(Ee)},onClick:()=>{N(Ee.id)},children:[l.jsx("span",{className:"background-agent-row__accent","aria-hidden":"true"}),l.jsxs("span",{className:"background-agent-row__meta",children:[l.jsxs("span",{className:"background-agent-row__title",children:[l.jsx("span",{className:"background-agent-row__name",children:((Ut=Ee.subagent)==null?void 0:Ut.nickname)??Ee.title}),l.jsxs("span",{className:"background-agent-row__role",children:["(",((at=Ee.subagent)==null?void 0:at.role)??"agent",")"]})]}),l.jsx("span",{className:"background-agent-row__status",children:T(Ee)})]}),l.jsx("span",{className:"background-agent-row__open",children:"Open"})]},Ee.id)})}):null]}):null,H?l.jsx(Mj,{panel:H,isPending:R,onDismiss:Q,onSelectOption:ce,onSubmitText:Z}):null,Pn?null:l.jsxs("form",{className:`chat-composer ${qe?"is-attached-to-agent-strip":""}`,onSubmit:Ee=>{Ee.preventDefault(),$e()},children:[l.jsxs("div",{className:"chat-composer__editor",children:[Y.length>0?l.jsx("div",{className:"chat-composer__attachments",children:Y.map(Ee=>{const Ut=Sp(Ee.size_bytes);return l.jsxs("div",{className:"chat-composer__attachment-chip",children:[l.jsxs("div",{className:"chat-composer__attachment-copy",children:[l.jsx("span",{className:"chat-composer__attachment-name",children:Ee.name}),l.jsxs("span",{className:"chat-composer__attachment-meta",children:[Ee.kind==="image"?"图片":"文件",Ut?` · ${Ut}`:""]})]}),l.jsx("button",{type:"button",className:"chat-composer__attachment-remove","aria-label":`移除 ${Ee.name}`,onClick:()=>U(Ee.id),children:l.jsx(L1,{})})]},Ee.id)})}):null,l.jsx(a2,{className:"chat-composer__input",value:ee,disabled:!We,projectId:ie,placeholder:We?je??"要求后续变更":ae??"当前会话为只读模式",onChange:ue,onKeyDown:He}),l.jsx("button",{type:"button",className:"composer-fullscreen-toggle","aria-label":"全屏编辑",onClick:()=>Re(!0),children:l.jsx(Ij,{})}),l.jsx("input",{id:de,ref:kt,type:"file",className:"chat-composer__file-input",multiple:!0,onChange:Ee=>{Ee.target.files&&Ee.target.files.length>0&&E(Ee.target.files),Ee.target.value=""}})]}),l.jsxs("div",{className:"chat-composer__toolbar",children:[l.jsxs("div",{ref:mt,className:"chat-composer__controls",children:[l.jsxs("div",{className:`composer-utility-menu ${Oe==="utility"?"is-open":""}`,children:[l.jsx("button",{type:"button",className:"composer-utility-menu__trigger","aria-label":"打开额外功能","aria-expanded":Oe==="utility",onClick:()=>Ke(Ee=>Ee==="utility"?null:"utility"),children:l.jsx(zj,{})}),Oe==="utility"?l.jsxs("div",{className:"composer-utility-menu__popover",role:"menu",children:[l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitem",onClick:()=>{var Ee;Ke(null),(Ee=kt.current)==null||Ee.click()},children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(Bj,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"上传文件"})]}),l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":ne,onClick:V,children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(i2,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"Fast 模式"}),l.jsx("span",{className:`composer-utility-menu__switch ${ne?"is-on":""}`,"aria-hidden":"true",children:l.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]}),l.jsxs("button",{type:"button",className:"composer-utility-menu__item",role:"menuitemcheckbox","aria-checked":be,onClick:pe,children:[l.jsx("span",{className:"composer-utility-menu__item-icon","aria-hidden":"true",children:l.jsx(r2,{})}),l.jsx("span",{className:"composer-utility-menu__item-label",children:"计划模式"}),l.jsx("span",{className:`composer-utility-menu__switch ${be?"is-on":""}`,"aria-hidden":"true",children:l.jsx("span",{className:"composer-utility-menu__switch-thumb"})})]})]}):null]}),l.jsxs("div",{className:`composer-choice ${Oe==="model"?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择模型","aria-expanded":Oe==="model",onClick:()=>Ke(Ee=>Ee==="model"?null:"model"),children:[l.jsx("span",{className:"composer-icon",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M12 3 4 7v10l8 4 8-4V7z"}),l.jsx("path",{d:"m4 7 8 4 8-4"}),l.jsx("path",{d:"M12 11v10"})]})}),l.jsx("span",{className:"composer-control__value",children:Zf(Le,he)})]}),Oe==="model"?l.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择模型",children:he.map(Ee=>l.jsxs("button",{type:"button",className:`composer-choice-menu__item ${Le===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":Le===Ee.value,onClick:()=>{Se(Ee.value),Ke(null)},children:[l.jsx("span",{className:"composer-choice-menu__text",children:l.jsx("span",{className:"composer-choice-menu__label",children:Ee.label})}),Le===Ee.value?l.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),l.jsxs("div",{className:`composer-choice ${Oe==="reasoning"?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"composer-control","aria-label":"选择推理强度","aria-expanded":Oe==="reasoning",onClick:()=>Ke(Ee=>Ee==="reasoning"?null:"reasoning"),children:[l.jsx("span",{className:"composer-icon",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M9.5 3a6.5 6.5 0 0 0-3.7 11.84c.53.38.92.95 1.1 1.57l.1.34c.13.44.54.75 1 .75h7c.46 0 .87-.31 1-.75l.1-.34c.18-.62.57-1.2 1.1-1.57A6.5 6.5 0 0 0 14.5 3z"}),l.jsx("path",{d:"M10 21h4"}),l.jsx("path",{d:"M9 18h6"})]})}),l.jsx("span",{className:"composer-control__value",children:ej(q)})]}),Oe==="reasoning"?l.jsx("div",{className:"composer-choice-menu",role:"menu","aria-label":"选择推理强度",children:Du.map(Ee=>l.jsxs("button",{type:"button",className:`composer-choice-menu__item ${q===Ee.value?"is-active":""}`,role:"menuitemradio","aria-checked":q===Ee.value,onClick:()=>{Ne(Ee.value),Ke(null)},children:[l.jsx("span",{className:"composer-choice-menu__label",children:Ee.label}),q===Ee.value?l.jsx("span",{className:"composer-choice-menu__check",children:"✓"}):null]},Ee.value))}):null]}),Ce&&(ne||be)?l.jsxs("div",{className:"composer-mode-badges","aria-label":"当前已启用的会话模式",children:[ne?l.jsxs("button",{type:"button",className:"composer-mode-badge is-fast",onClick:()=>{Ke(null),V()},"aria-label":"关闭 Fast 模式",children:[l.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:l.jsx(i2,{})}),l.jsx("span",{className:"composer-mode-badge__label",children:"Fast"})]}):null,be?l.jsxs("button",{type:"button",className:"composer-mode-badge is-plan",onClick:()=>{Ke(null),pe()},"aria-label":"关闭计划模式",children:[l.jsx("span",{className:"composer-mode-badge__icon","aria-hidden":"true",children:l.jsx(r2,{})}),l.jsx("span",{className:"composer-mode-badge__label",children:"计划"})]}):null]}):null]}),l.jsxs("div",{className:"chat-composer__actions",children:[me?l.jsxs("div",{className:`composer-context ${Te?"is-open":""}`,children:[l.jsx("button",{type:"button",className:"composer-context__trigger","aria-label":"查看背景信息窗口使用情况",onClick:Ee=>{Ee.stopPropagation(),Ge()},children:l.jsx("span",{className:"composer-context__ring",style:Ue,children:l.jsx("span",{className:"composer-context__ring-core"})})}),Te?l.jsxs("div",{className:"composer-context__popover",role:"tooltip",children:[l.jsx("div",{className:"composer-context__title",children:"背景信息窗口:"}),l.jsxs("div",{children:[gt,"% 已用(剩余 ",Lt,"%)"]}),l.jsxs("div",{children:["已用 ",St,",共 ",st]})]}):null]}):null,l.jsx("button",{type:W?"button":"submit",className:"composer-send",disabled:W?!F:!Ie,"aria-label":W?"中断":"发送",onClick:()=>{W&&A()},children:W?l.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:l.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2.5"})}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M12 17V7m0 0-4 4m4-4 4 4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})]})]}),Ae?l.jsx("div",{className:"composer-fullscreen-sheet",role:"dialog","aria-modal":"true","aria-label":"全屏编辑",children:l.jsxs("div",{className:"composer-fullscreen-sheet__panel",children:[l.jsxs("div",{className:"composer-fullscreen-sheet__header",children:[l.jsx("div",{className:"composer-fullscreen-sheet__title",children:"全屏编辑"}),l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__close","aria-label":"退出全屏编辑",onClick:()=>Re(!1),children:l.jsx(L1,{})})]}),l.jsx(a2,{className:"composer-fullscreen-sheet__input",value:ee,disabled:!We,projectId:ie,placeholder:We?je??"要求后续变更":ae??"当前会话为只读模式",onChange:ue,onKeyDown:He,autoFocus:!0}),l.jsxs("div",{className:"composer-fullscreen-sheet__footer",children:[l.jsxs("div",{className:"composer-fullscreen-sheet__meta",children:[l.jsx("span",{children:Le}),l.jsx("span",{children:q}),Y.length>0?l.jsxs("span",{children:[Y.length," 个附件"]}):null]}),l.jsxs("div",{className:"composer-fullscreen-sheet__actions",children:[l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button",onClick:()=>Re(!1),children:"关闭"}),W?l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!F,onClick:A,children:"中断"}):l.jsx("button",{type:"button",className:"composer-fullscreen-sheet__button is-primary",disabled:!Ie,onClick:()=>{$e(),Re(!1)},children:"发送"})]})]})]})}):null,tn?l.jsx("button",{type:"button",className:`conversation-jump-bottom ${t?"has-desktop-sidebar":""}`,style:De,onClick:$t,"aria-label":"滚动到最下面",children:l.jsx(Lj,{})}):null]})}),l2=10,Pj=n=>{const t=n.replace(/\s+/g," ").trim();return t.length<=l2?t:t.slice(0,l2).trimEnd()},Uj=(n,t)=>{var r,c;const a=Pj(n);return a||((c=(r=t[0])==null?void 0:r.name)==null?void 0:c.trim())||"附件"},qj=n=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(n.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},$j=({currentAgent:n,projects:t,sessions:a,initialProjectId:r=null,entryView:c,isDesktopSidebar:u,sidebarOffset:h,isSidebarDragging:p,onOpenSidebar:y,onProjectSelected:m,onSessionCreated:b})=>{const g=Tl(),[x,w]=_.useState(""),[N,T]=_.useState(r),[C,I]=_.useState(null),[$,H]=_.useState(null),[R,Q]=_.useState(()=>c0()),[ce,Z]=_.useState(()=>jy()),[ie,ee]=_.useState([]),[Y,F]=_.useState(!1),[_e,je]=_.useState(!1),[ae,ue]=_.useState(c),E=d0(),U=_.useMemo(()=>E.map(({id:V,...pe})=>pe),[E]),te=_.useMemo(()=>t.find(V=>V.id===N)??t[0]??null,[t,N]);_.useEffect(()=>{bu(R)},[R]),_.useEffect(()=>{wy(ce)},[ce]),_.useEffect(()=>{U.length!==0&&(U.some(V=>V.value===R)||Q(U[0].value))},[U,R]),_.useEffect(()=>{ue(c)},[c]),_.useEffect(()=>{H(null)},[N]),_.useEffect(()=>{var pe,Ce;if(N&&t.some(Le=>Le.id===N))return;const V=(r&&t.some(Le=>Le.id===r)?r:null)??((pe=a.find(Le=>!Le.archived))==null?void 0:pe.project_id)??((Ce=t[0])==null?void 0:Ce.id)??null;T(V)},[r,t,N,a]),_.useEffect(()=>{t.length===0&&ue("directory-picker")},[t.length]);const W=Vn({mutationFn:async V=>{if(!te||!V.input.trim()&&V.attachments.length===0)throw new Error("请先选择线程,再输入第一条消息");return(await(await Jn({projectId:V.projectId,agentId:n.id})).client.createSession({agentId:n.id,projectId:V.projectId,title:V.title,input:V.input,attachments:V.attachments,model:V.model,reasoningEffort:V.reasoningEffort,serviceTier:V.serviceTier,planMode:V.planMode})).session},onMutate:()=>I(null),onSuccess:async(V,pe)=>{const Ce={id:`optimistic-user:${V.id}:create`,kind:"user",title:"你",body:pe.input,timestamp:V.last_event_at,accent:"primary",attachments:Ey(pe.attachments)};xr(n.id),fs(V.id),JS(V.id,{isFastModeEnabled:pe.serviceTier==="fast",isPlanModeEnabled:pe.planMode}),Ru(null),Eo(null),g.setQueryData(dt,Le=>lS(Le,V)),g.setQueryData(ir(V.id),Le=>fy(Le,Ce)),F(!1),je(!1),b(V.id),g.invalidateQueries({queryKey:["plan",V.id]}),g.invalidateQueries({queryKey:["change-sets",V.id]})},onError:V=>{I(V instanceof Error?V.message:"创建会话失败")}}),xe=(te==null?void 0:te.path)??null,A=ae==="directory-picker",ne={transform:`translateX(${h}px)`,transition:p?"none":void 0},be=()=>{const V=x.trim();if(!(!V&&ie.length===0||W.isPending||!te)){if(u0(V)){if(ie.length>0){I("命令暂不支持附件,请先移除附件后再执行。");return}const pe=qj(V);if(pe==="model"){if(w(""),U.length>0){H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe,command_text:V,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"choice",options:U.map(Ce=>({id:Ce.value,label:Ce.label,description:Ce.description??null})),input_placeholder:null,submit_label:null,effect:null});return}H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe,command_text:V,title:"为新会话选择模型",description:"选择后会更新新会话的默认模型,再继续输入真正的首条消息。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}if(pe==="status"){w(""),H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe,command_text:V,title:"新会话当前设置",description:"这里展示的是创建下一条会话时会使用的本地设置。",status:"completed",body:[`线程:${te.display_name??te.name}`,`模型:${R}`,`推理强度:${ce}`,`Fast 模式:${Y?"开启":"关闭"}`,`计划模式:${_e?"开启":"关闭"}`].join(`
124
+ `),submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}w(""),H({panel_id:`new-thread-command-${Date.now()}`,session_id:`new-thread:${te.id}`,command_name:pe||"unknown",command_text:V,title:`/${pe||"unknown"} 暂不可用`,description:"新建线程阶段目前只接入了少量本地命令。",status:"completed",body:"请先进入已有会话后再执行这个命令,或者先使用 /model 调整新会话默认模型。",submitted_at:new Date().toISOString(),updated_at:new Date().toISOString(),input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}W.mutate({projectId:te.id,input:V,title:Uj(V,ie),attachments:ie,model:R,reasoningEffort:ce,serviceTier:Y?"fast":void 0,planMode:_e})}};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`conversation-main conversation-main--new-thread ${u?"has-desktop-sidebar":""}`,style:ne,children:[l.jsxs("div",{className:"conversation-topbar",children:[u?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:y,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsx("div",{className:"conversation-topbar__title-row",children:l.jsx("h1",{"aria-label":"未命名会话",children:" "})})})]}),l.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:l.jsx("div",{className:"conversation-thread conversation-thread--empty",children:A?l.jsx(Sj,{agentId:n.id,projects:t,title:"选择目录",subtitle:"",onProjectCreated:V=>{T(V.id),m(V.id),ue("composer")}}):l.jsx("section",{className:"new-thread-hero",children:l.jsxs("div",{className:"new-thread-hero__stack",children:[l.jsx(wj,{}),l.jsxs("label",{className:"new-thread-hero__selector",children:[l.jsx("span",{className:"new-thread-hero__selector-label",children:"在线程中发起会话"}),l.jsx("select",{className:"new-thread-hero__select",value:N??"",onChange:V=>{const pe=V.target.value||null;T(pe),pe&&m(pe)},children:t.map(V=>l.jsx("option",{value:V.id,children:V.display_name??V.name},V.id))})]}),xe?l.jsx("div",{className:"new-thread-hero__path",children:xe}):l.jsx("div",{className:"new-thread-hero__hint",children:"选择一个线程后,直接输入第一条消息即可开始。"}),u?null:l.jsx("button",{type:"button",className:"new-thread-hero__directory-trigger",onClick:()=>ue("directory-picker"),children:"新增目录线程"})]})})})})]}),A?null:l.jsx(Dy,{isDesktopSidebar:u,sidebarShift:h,isSidebarDragging:p,composerError:C,onDismissComposerError:()=>I(null),interactionRequests:[],pendingInteractionRequestId:null,onRespondInteraction:()=>{},parentSession:null,backgroundAgentSessions:[],isBackgroundAgentsOpen:!1,planSnapshot:null,onToggleBackgroundAgents:()=>{},onOpenSession:()=>{},getBackgroundAgentStatusLabel:()=>"",getBackgroundAgentAccent:()=>"var(--color-accent-primary)",formatBackgroundAgentsLabel:V=>`${V} background agents`,hasBackgroundAgentStrip:!1,commandPanel:$,isCommandPanelPending:!1,onDismissCommandPanel:()=>H(null),onCommandPanelOptionSelect:V=>{Q(V),H(pe=>pe&&{...pe,status:"completed",body:`新会话默认模型已切换为 ${Zf(V,U)}。现在可以继续输入真正的首条消息。`,updated_at:new Date().toISOString(),input_type:"none",options:[]})},onCommandPanelTextSubmit:()=>{},projectId:(te==null?void 0:te.id)??null,draft:x,pendingAttachments:ie,canSendInput:!!te,inputPlaceholder:te?`向 ${te.display_name??te.name} 发起第一条任务…`:"先选择线程,再输入第一条任务",readOnlyPlaceholder:"先选择线程,再输入第一条任务",onDraftChange:w,onUploadFiles:V=>{const pe=[...V];pe.length!==0&&(I(null),Promise.all(pe.map(Ce=>Ty(Ce))).then(Ce=>{ee(Le=>[...Le,...Ce])}).catch(Ce=>{I(Ce instanceof Error?Ce.message:"无法读取附件")}))},onRemoveAttachment:V=>{ee(pe=>pe.filter(Ce=>Ce.id!==V))},onSubmit:be,showStopIcon:!1,isSendPending:W.isPending,onInterrupt:()=>{},isFastModeEnabled:Y,isPlanModeEnabled:_e,onToggleFastMode:()=>F(V=>!V),onTogglePlanMode:()=>je(V=>!V),showModeBadges:!0,selectedModel:R,modelOptions:U,selectedReasoning:ce,onSelectModel:Q,onSelectReasoning:V=>Z(V),contextUsage:null,isContextUsageOpen:!1,onToggleContextUsage:()=>{},usedPercent:0,remainingPercent:0,usedTokensLabel:"0",totalTokensLabel:"0",showJumpToBottom:!1,onJumpToBottom:()=>{}})]})},o2=_.lazy(async()=>({default:(await Rp(()=>import("./session-diff-preview-CsQrlvqF.js"),[])).SessionDiffPreview})),I1=["var(--session-git-graph-1)","var(--session-git-graph-2)","var(--session-git-graph-3)","var(--session-git-graph-4)","var(--session-git-graph-5)","var(--session-git-graph-6)"],Oy=14,Ly=10,nr=24,So=48,z1=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m9 6 6 6-6 6"})}),Hj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M20 11a8 8 0 1 0 2.2 5.5"}),l.jsx("path",{d:"M20 4v7h-7"})]}),Fj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M3 12a9 9 0 1 0 2.64-6.36"}),l.jsx("path",{d:"M3 4v5h5"}),l.jsx("path",{d:"M12 7v5l3 2"})]}),c2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 14 4 9l5-5"}),l.jsx("path",{d:"M4 9h8a8 8 0 1 1 0 16h-1"})]}),u2=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7.5 12.5 10.5 15.5 16.5 8.5"}),l.jsx("circle",{cx:"12",cy:"12",r:"8.5"})]}),Qj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 16V5"}),l.jsx("path",{d:"m7.5 9.5 4.5-4.5 4.5 4.5"}),l.jsx("path",{d:"M5 19h14"})]}),Gj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6 18 18"}),l.jsx("path",{d:"M18 6 6 18"})]}),Vj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7 4v10"}),l.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),l.jsx("path",{d:"M17 6a4 4 0 0 0-4 4H7"}),l.jsx("circle",{cx:"7",cy:"4",r:"2"}),l.jsx("circle",{cx:"17",cy:"6",r:"2"}),l.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),Kj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"4",y:"5",width:"16",height:"11",rx:"2"}),l.jsx("path",{d:"M8 19h8"}),l.jsx("path",{d:"M10 16v3"}),l.jsx("path",{d:"M14 16v3"})]}),Yj=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M7.5 18a4.5 4.5 0 1 1 .9-8.91A5.5 5.5 0 0 1 19 11a3.5 3.5 0 0 1-.5 7Z"})}),Zj=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M7 4v10"}),l.jsx("path",{d:"M7 14a4 4 0 0 0 4 4h6"}),l.jsx("path",{d:"M7 10a4 4 0 0 1 4-4h6"}),l.jsx("circle",{cx:"7",cy:"4",r:"2"}),l.jsx("circle",{cx:"17",cy:"6",r:"2"}),l.jsx("circle",{cx:"17",cy:"18",r:"2"})]}),sr=({label:n,icon:t,onClick:a,disabled:r=!1,variant:c="default",pending:u=!1,className:h})=>l.jsx("button",{type:"button",className:`session-git-panel__icon-button is-${c} ${u?"is-pending":""} ${h??""}`.trim(),onClick:a,disabled:r,"aria-label":n,title:n,children:l.jsx("span",{className:"session-git-panel__icon-button-glyph","aria-hidden":"true",children:t})}),d2=n=>{switch(n){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"U";default:return"M"}},Wj=n=>n.status==="renamed"&&n.previous_path?`该变更仅包含重命名:${n.previous_path} -> ${n.path}`:n.status==="deleted"?"该文件已删除,没有可展示的补丁内容。":n.status==="untracked"?"该文件还没有可展示的补丁内容。":"此变更没有可展示的补丁内容。",Xj=(n,t)=>t&&t.diff.trim()?"此变更没有可展示的补丁内容。":n.status==="renamed"&&n.previous_path?`该提交仅包含重命名:${n.previous_path} -> ${n.path}`:n.status==="deleted"?"该文件在这次提交中已删除,没有可展示的补丁内容。":"该文件在这次提交中没有可展示的补丁内容。",uu=n=>I1[n%I1.length]??I1[0],il=n=>Ly+n*Oy,gf=(n,t)=>`${n}\0${t}`,h0=n=>Array.isArray(n.parent_oids)?n.parent_oids.filter(Boolean):[],Jj=n=>Array.isArray(n.refs)?n.refs.filter(Boolean):[],ew=n=>{var u;const t={};let a=[],r=0;const c=()=>{const h=r;return r+=1,h};for(const h of n){let p=a.findIndex(w=>w.oid===h.oid);p<0&&(a=[...a,{oid:h.oid,colorIndex:c()}],p=a.length-1);const y=a.map(w=>({...w})),m=((u=y[p])==null?void 0:u.colorIndex)??c(),b=[...new Set(h0(h))],g=y.map(w=>({...w}));b.length>0?g[p]={oid:b[0],colorIndex:m}:g.splice(p,1);const x=[];if(b.length>0){const w=g.findIndex(N=>N.oid===b[0]);x.push(w>=0?w:p)}b.slice(1).forEach((w,N)=>{let T=g.findIndex(C=>C.oid===w);T<0&&(T=Math.min(g.length,p+1+N),g.splice(T,0,{oid:w,colorIndex:c()})),x.push(T)}),t[h.oid]={beforeLanes:y,afterLanes:g,laneIndex:p,nodeColorIndex:m,parentLaneIndexes:x},a=g.filter((w,N,T)=>T.findIndex(C=>C.oid===w.oid)===N)}return t},tw=({commit:n,row:t,isLocalHead:a,isRemoteHead:r,isFirstRow:c,maxLaneCount:u})=>{const h=h0(n).length,p=Math.max(u,t.beforeLanes.length,t.afterLanes.length,1),y=Math.max(40,Ly*2+(p-1)*Oy),m=il(t.laneIndex),b=h>1?4.7:3.9,g=Math.max(0,nr-b-1.1),x={"--session-git-graph-width":`${Math.max(48,Math.ceil(y*(56/So)))}px`};return l.jsx("span",{className:"session-git-history__graph",style:x,children:l.jsxs("svg",{className:`session-git-history__graph-svg ${h>1?"is-merge":""}`,viewBox:`0 0 ${y} ${So}`,preserveAspectRatio:"xMinYMid meet","aria-hidden":"true",children:[t.beforeLanes.map((w,N)=>l.jsx("path",{d:`M ${il(N)} ${c?g:0} L ${il(N)} ${g}`,stroke:uu(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none",opacity:c?0:1},`before:${w.oid}:${N}`)),t.afterLanes.map((w,N)=>{const T=t.beforeLanes.findIndex(H=>H.oid===w.oid),C=T>=0?il(T):il(N),I=il(N),$=C===I?`M ${I} ${nr} L ${I} ${So}`:`M ${C} ${nr} C ${C} 27 ${I} 31 ${I} ${So}`;return l.jsx("path",{d:$,stroke:uu(w.colorIndex),strokeWidth:"2",strokeLinecap:"round",fill:"none"},`after:${w.oid}:${N}`)}),t.parentLaneIndexes.map((w,N)=>{var $;const T=il(w),C=uu((($=t.afterLanes[w])==null?void 0:$.colorIndex)??t.nodeColorIndex),I=T===m?`M ${m} ${nr} L ${T} ${So}`:`M ${m} ${nr} C ${m} 27 ${T} 31 ${T} ${So}`;return l.jsx("path",{d:I,stroke:C,strokeWidth:N>0||h>1?"2.2":"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:N>0||h>1?.96:.88},`parent:${n.oid}:${N}`)}),l.jsx("circle",{cx:m,cy:nr,r:b,fill:"var(--color-surface-panel)",stroke:uu(t.nodeColorIndex),strokeWidth:h>1?"1.8":"1.55"}),l.jsx("circle",{cx:m,cy:nr,r:a||r?1.6:1.05,fill:uu(t.nodeColorIndex)}),a&&r?l.jsx("circle",{cx:m,cy:nr,r:"6.4",fill:"none",stroke:"color-mix(in oklab, var(--color-accent-primary) 22%, transparent)",strokeWidth:"1",strokeDasharray:"1.5 3"}):null]})})},nw=({workspace:n,history:t,isLoading:a,isHistoryLoading:r,error:c,historyError:u,onRefresh:h,onRefreshHistory:p,onRequestHistory:y,onDiscardFile:m,onDiscardAll:b,onCommitAll:g,onSwitchBranch:x,onPush:w,onLoadWorkspaceFileDiff:N,onLoadHistoryFileDiff:T,pendingAction:C,compact:I=!1})=>{const[$,H]=_.useState("changes"),[R,Q]=_.useState({}),[ce,Z]=_.useState({}),[ie,ee]=_.useState({}),[Y,F]=_.useState({}),[_e,je]=_.useState({}),[ae,ue]=_.useState({}),[E,U]=_.useState({}),[te,W]=_.useState({}),[xe,A]=_.useState({}),[ne,be]=_.useState(!1),[V,pe]=_.useState(null),[Ce,Le]=_.useState(""),[he,q]=_.useState(null),Se=_.useRef(null);_.useEffect(()=>{Q(qe=>{if(!(n!=null&&n.files.length))return{};const De=new Set(n.files.map($e=>$e.path));let Ie=!1;const We={};for(const[$e,He]of Object.entries(qe)){if(!De.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:qe});const oe=new Set((n==null?void 0:n.files.map(qe=>qe.path))??[]);Z(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe}),ee(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe}),F(qe=>{let De=!1;const Ie={};for(const[We,$e]of Object.entries(qe)){if(!oe.has(We)){De=!0;continue}Ie[We]=$e}return De?Ie:qe})},[n==null?void 0:n.files]),_.useEffect(()=>{const oe=new Set((t==null?void 0:t.commits.map(De=>De.oid))??[]),qe=new Set((t==null?void 0:t.commits.flatMap(De=>De.files.map(Ie=>gf(De.oid,Ie.path))))??[]);je(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!oe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),ue(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!oe.has($e)){Ie=!0;continue}if(He&&!qe.has(gf($e,He))){Ie=!0,We[$e]=null;continue}We[$e]=He}return Ie?We:De}),U(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),W(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De}),A(De=>{let Ie=!1;const We={};for(const[$e,He]of Object.entries(De)){if(!qe.has($e)){Ie=!0;continue}We[$e]=He}return Ie?We:De})},[t==null?void 0:t.commits]),_.useEffect(()=>{if(!ne)return;const oe=qe=>{var De;(De=Se.current)!=null&&De.contains(qe.target)||be(!1)};return window.addEventListener("pointerdown",oe),()=>{window.removeEventListener("pointerdown",oe)}},[ne]),_.useEffect(()=>{n&&(V==="commit"&&(C==null?void 0:C.action)!=="commit-all"&&n.files.length===0&&(pe(null),Le("")),he&&n.branch===he&&(q(null),pe(null),Le(""),be(!1)))},[V,C==null?void 0:C.action,he,n]),_.useEffect(()=>{n!=null&&n.branches.length||be(!1)},[n==null?void 0:n.branches]),_.useEffect(()=>{Z({}),ee({}),F({})},[n==null?void 0:n.updated_at]);const Ne=(n==null?void 0:n.files)??[],me=(t==null?void 0:t.commits)??[],Te=Ne.length>0,Ge=me.length>0,Ue=(C==null?void 0:C.action)==="discard-all",gt=(C==null?void 0:C.action)==="commit-all",Lt=(C==null?void 0:C.action)==="switch-branch",St=(C==null?void 0:C.action)==="push",st=$==="changes",tn=V==="switch-branch"&&he?`提交后切换到 ${he}`:"提交全部改动",$t=_.useMemo(()=>{if(!n)return null;const oe=[];return n.upstream_branch&&oe.push(n.upstream_branch),n.ahead_count>0&&oe.push(`ahead ${n.ahead_count}`),n.behind_count>0&&oe.push(`behind ${n.behind_count}`),oe.join(" · ")},[n]),de=_.useMemo(()=>{if(!t)return null;const oe=[t.branch];return t.upstream_branch&&oe.push(t.upstream_branch),oe.join(" · ")},[t]),Ae=_.useMemo(()=>$==="history"?ew(me):{},[$,me]),Re=_.useMemo(()=>$!=="history"?1:Math.max(1,...Object.values(Ae).map(oe=>Math.max(oe.beforeLanes.length,oe.afterLanes.length,oe.laneIndex+1))),[$,Ae]),Oe=(oe,qe)=>{ce[oe]||ie[oe]||(ee(De=>({...De,[oe]:!0})),F(De=>{const Ie={...De};return delete Ie[oe],Ie}),N(oe,qe).then(De=>{Z(Ie=>({...Ie,[oe]:De}))}).catch(De=>{F(Ie=>({...Ie,[oe]:De instanceof Error?De.message:"无法读取该文件的差异。"}))}).finally(()=>{ee(De=>{const Ie={...De};return delete Ie[oe],Ie})}))};_.useEffect(()=>{if(!($!=="changes"||Ne.length===0))for(const oe of Ne)R[oe.path]&&Oe(oe.path,oe.previous_path)},[$,R,Ne,N,ce,ie]);const Ke=()=>{pe(null),Le(""),q(null)},mt=()=>{q(null),pe(oe=>oe==="commit"?(Le(""),null):"commit")},kt=()=>{const oe=Ce.trim();if(oe){if(V==="switch-branch"&&he){Promise.resolve(x(he,oe)).catch(()=>{});return}g(oe)}},rn=oe=>{if(!(!n||oe===n.branch||C)){if(be(!1),n.files.length>0){q(oe),pe("switch-branch");return}Promise.resolve(x(oe)).catch(()=>{})}},Pn=()=>{if(st){h();return}p()},On=()=>{H(oe=>{const qe=oe==="changes"?"history":"changes";return qe==="history"&&y(),qe})},nn=(oe,qe)=>{const De=gf(oe.oid,qe.path),Ie=ae[oe.oid]===qe.path;ue(We=>({...We,[oe.oid]:Ie?null:qe.path})),!(Ie||E[De]||te[De])&&(W(We=>({...We,[De]:!0})),A(We=>{const $e={...We};return delete $e[De],$e}),T(oe.oid,qe.path,qe.previous_path).then(We=>{U($e=>({...$e,[De]:We}))}).catch(We=>{A($e=>({...$e,[De]:We instanceof Error?We.message:"无法读取该文件的提交差异。"}))}).finally(()=>{W(We=>{const $e={...We};return delete $e[De],$e})}))},ln=oe=>{const qe=new Date(oe);return Number.isNaN(qe.getTime())?oe:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(qe)};return l.jsxs("section",{className:`session-git-panel ${I?"is-compact":""}`,children:[l.jsxs("div",{className:"session-git-panel__header",children:[l.jsxs("div",{className:"session-git-panel__heading",ref:Se,children:[l.jsxs("button",{type:"button",className:"session-git-panel__branch-button",onClick:()=>be(oe=>!oe),disabled:!n||!!C,"aria-haspopup":"menu","aria-expanded":ne,title:n?`切换分支:${n.branch}`:"分支加载中",children:[l.jsx("span",{className:"session-git-panel__branch-icon","aria-hidden":"true",children:l.jsx(Vj,{})}),l.jsx("span",{className:"session-git-panel__branch",children:(n==null?void 0:n.branch)??"加载中"}),l.jsx("span",{className:`session-git-panel__branch-chevron ${ne?"is-open":""}`,"aria-hidden":"true",children:l.jsx(z1,{})})]}),ne&&n?l.jsx("div",{className:"session-git-panel__branch-menu",role:"menu","aria-label":"分支列表",children:n.branches.map(oe=>{const qe=oe===n.branch,De=(C==null?void 0:C.action)==="switch-branch"&&C.branch===oe;return l.jsxs("button",{type:"button",className:`session-git-panel__branch-option ${qe?"is-current":""}`,onClick:()=>rn(oe),disabled:qe||!!C,role:"menuitemradio","aria-checked":qe,title:qe?`${oe}(当前)`:`切换到 ${oe}`,children:[l.jsx("span",{className:"session-git-panel__branch-option-name",children:oe}),qe?l.jsx("span",{className:"session-git-panel__branch-option-meta",children:"当前"}):null,De?l.jsx("span",{className:"session-git-panel__branch-option-meta",children:"切换中"}):null]},oe)})}):null]}),l.jsxs("div",{className:"session-git-panel__toolbar",children:[l.jsx(sr,{label:st?"切换到提交历史":"返回修改列表",icon:l.jsx(Fj,{}),onClick:On,disabled:!!C,variant:st?"default":"primary",className:st?void 0:"is-active"}),l.jsx(sr,{label:st?a?"正在刷新":"刷新":r?"正在刷新历史":"刷新历史",icon:l.jsx(Hj,{}),onClick:Pn,disabled:st?a||!!C:r,pending:st?a:r}),st&&Te?l.jsxs(l.Fragment,{children:[l.jsx(sr,{label:Ue?"正在撤回全部修改":"撤回全部修改",icon:l.jsx(c2,{}),onClick:b,disabled:!!C,variant:"danger",pending:Ue}),l.jsx(sr,{label:gt?"正在提交全部修改":V==="commit"?"收起提交编辑器":"提交全部修改",icon:l.jsx(u2,{}),onClick:mt,disabled:!!C,variant:"primary",pending:gt})]}):null,st&&!Te?l.jsx(sr,{label:St?"正在推送当前分支":"推送当前分支",icon:l.jsx(Qj,{}),onClick:w,disabled:!!C,variant:"primary",pending:St}):null]})]}),st&&n?l.jsxs("div",{className:"session-git-panel__summary",children:[l.jsx("span",{className:"session-git-panel__summary-text",children:Te?`${Ne.length} 个文件待处理`:"当前工作区没有待提交改动"}),$t?l.jsx("span",{className:"session-git-panel__summary-meta",children:$t}):null]}):null,!st&&t?l.jsxs("div",{className:"session-git-panel__summary",children:[l.jsx("span",{className:"session-git-panel__summary-text",children:Ge?`${me.length} 条最近提交`:"当前分支还没有提交历史"}),de?l.jsx("span",{className:"session-git-panel__summary-meta",children:de}):null]}):null,st&&V&&Te?l.jsxs("div",{className:"session-git-panel__composer",children:[l.jsx("div",{className:"session-git-panel__composer-title",children:tn}),l.jsxs("div",{className:"session-git-panel__composer-row",children:[l.jsx("input",{value:Ce,onChange:oe=>Le(oe.target.value),placeholder:"输入 commit message",className:"session-git-panel__input",disabled:!!C}),l.jsx(sr,{label:V==="switch-branch"?"提交并切换分支":"确认提交",icon:l.jsx(u2,{}),onClick:kt,disabled:!Ce.trim()||!!C,variant:"primary",pending:gt||Lt}),l.jsx(sr,{label:"取消提交",icon:l.jsx(Gj,{}),onClick:Ke,disabled:!!C})]})]}):null,st&&c?l.jsx("div",{className:"session-git-panel__notice is-error",children:c}):null,!st&&u?l.jsx("div",{className:"session-git-panel__notice is-error",children:u}):null,st&&a&&!n?l.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前工作区改动…"}):null,!st&&r&&!t?l.jsx("div",{className:"session-git-panel__empty",children:"正在读取当前分支提交历史…"}):null,st&&!a&&n&&!Te?l.jsx("div",{className:"session-git-panel__empty",children:"当前分支没有待提交改动。你现在可以直接推送当前分支。"}):null,!st&&!r&&t&&!Ge?l.jsx("div",{className:"session-git-panel__empty",children:"当前分支还没有提交历史。"}):null,st&&Te?l.jsx("div",{className:"session-git-panel__list",children:Ne.map(oe=>{const qe=!!R[oe.path],De=(C==null?void 0:C.action)==="discard-file"&&C.path===oe.path,Ie=ce[oe.path],We=!!ie[oe.path],$e=Y[oe.path]??null;return l.jsxs("article",{className:`session-git-file ${qe?"is-expanded":""}`,children:[l.jsxs("div",{className:"session-git-file__head",children:[l.jsxs("button",{type:"button",className:"session-git-file__toggle",onClick:()=>{const He=!qe;Q(Ee=>({...Ee,[oe.path]:He})),He&&Oe(oe.path,oe.previous_path)},"aria-expanded":qe,children:[l.jsxs("span",{className:"session-git-file__main",children:[l.jsx("span",{className:"session-git-file__path",children:oe.path}),oe.previous_path?l.jsxs("span",{className:"session-git-file__rename",children:["来自 ",oe.previous_path]}):null]}),l.jsxs("span",{className:"session-git-file__meta",children:[l.jsx("span",{className:`session-git-file__status is-${oe.status}`,children:d2(oe.status)}),l.jsxs("span",{className:"session-git-file__counts",children:[l.jsxs("span",{className:"is-add",children:["+",oe.additions]}),l.jsxs("span",{className:"is-remove",children:["-",oe.deletions]})]}),l.jsx("span",{className:"session-git-file__chevron","aria-hidden":"true",children:l.jsx(z1,{})})]})]}),l.jsx(sr,{label:De?`正在撤回 ${oe.path}`:`撤回 ${oe.path}`,icon:l.jsx(c2,{}),onClick:()=>m(oe.path),disabled:!!C,variant:"danger",pending:De,className:"session-git-file__action"})]}),qe?l.jsx("div",{className:"session-git-file__detail",children:$e?l.jsx("div",{className:"session-git-panel__notice is-error",children:$e}):We?l.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的差异…"}):l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:l.jsx(o2,{diffText:(Ie==null?void 0:Ie.diff)??"",filePath:oe.path,emptyMessage:Wj(oe)})})}):null]},oe.path)})}):null,!st&&Ge?l.jsx("div",{className:"session-git-history",children:me.map((oe,qe)=>{const De=!!_e[oe.oid],Ie=h0(oe),We=ae[oe.oid]??null,$e=Ae[oe.oid],He=(t==null?void 0:t.head_oid)===oe.oid,Ee=(t==null?void 0:t.upstream_head_oid)===oe.oid,Ut=Jj(oe).filter(at=>!at||at===(t==null?void 0:t.branch)||at===(t==null?void 0:t.upstream_branch)||at===`HEAD -> ${t==null?void 0:t.branch}`?!1:at!=="HEAD");return l.jsxs("article",{className:`session-git-history__item ${De?"is-expanded":""} ${Ie.length>1?"is-merge":""} ${He?"is-local-head":""} ${Ee?"is-remote-head":""}`.trim(),children:[l.jsxs("button",{type:"button",className:"session-git-history__toggle",onClick:()=>je(at=>({...at,[oe.oid]:!at[oe.oid]})),"aria-expanded":De,children:[$e?l.jsx(tw,{commit:oe,row:$e,isLocalHead:He,isRemoteHead:Ee,isFirstRow:qe===0,maxLaneCount:Re}):null,l.jsxs("span",{className:"session-git-history__content",children:[l.jsx("span",{className:"session-git-history__subject",children:oe.subject}),l.jsxs("span",{className:"session-git-history__meta",children:[l.jsx("span",{children:oe.short_oid}),l.jsx("span",{children:oe.author_name}),l.jsx("span",{children:ln(oe.committed_at)})]})]}),l.jsxs("span",{className:"session-git-history__refs",children:[He?l.jsx("span",{className:"session-git-history__ref is-local",title:"本地当前 HEAD",children:l.jsx(Kj,{})}):null,Ee?l.jsx("span",{className:"session-git-history__ref is-remote",title:t!=null&&t.upstream_branch?`云端位置:${t.upstream_branch}`:"云端位置",children:l.jsx(Yj,{})}):null,Ie.length>1?l.jsx("span",{className:"session-git-history__ref is-merge",title:"合并提交",children:l.jsx(Zj,{})}):null,Ut.slice(0,2).map(at=>l.jsx("span",{className:"session-git-history__ref is-label",title:at,children:at},`${oe.oid}:${at}`))]}),l.jsx("span",{className:"session-git-history__chevron","aria-hidden":"true",children:l.jsx(z1,{})})]}),De?l.jsx("div",{className:"session-git-history__files",children:l.jsx("div",{className:"session-git-history__files-list",children:oe.files.map(at=>{const pn=We===at.path,Un=gf(oe.oid,at.path),xn=E[Un],ps=!!te[Un],gs=xe[Un]??null;return l.jsxs("div",{className:`session-git-history-file-row ${pn?"is-selected":""}`,children:[l.jsxs("button",{type:"button",className:`session-git-history-file ${pn?"is-selected":""}`,onClick:()=>nn(oe,at),"aria-pressed":pn,children:[l.jsx("span",{className:`session-git-file__status is-${at.status}`,children:d2(at.status)}),l.jsx("span",{className:"session-git-history-file__path",children:at.path}),at.previous_path?l.jsxs("span",{className:"session-git-history-file__rename",children:["来自 ",at.previous_path]}):null,l.jsx("span",{className:"session-git-history-file__meta",children:xn?l.jsxs("span",{className:"session-git-history-file__counts",children:[l.jsxs("span",{className:"is-add",children:["+",xn.additions]}),l.jsxs("span",{className:"is-remove",children:["-",xn.deletions]})]}):ps?l.jsx("span",{className:"session-git-history-file__loading",children:"读取中…"}):l.jsx("span",{className:"session-git-history-file__hint",children:"点击查看"})})]}),pn?l.jsxs("div",{className:"session-git-history__diff is-inline",children:[l.jsxs("div",{className:"session-git-history__diff-header",children:[l.jsx("span",{className:"session-git-history__diff-path",children:at.path}),at.previous_path?l.jsxs("span",{className:"session-git-history__diff-rename",children:["来自 ",at.previous_path]}):null]}),gs?l.jsx("div",{className:"session-git-panel__notice is-error",children:gs}):ps?l.jsx("div",{className:"patch-file-card__empty",children:"正在读取该文件的提交差异…"}):l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),children:l.jsx(o2,{diffText:(xn==null?void 0:xn.diff)??"",filePath:at.path,emptyMessage:Xj(at,xn??null)})})]}):null]},`${oe.oid}:${at.path}`)})})}):null]},oe.oid)})}):null]})},f2={name:"",description:null,command:"",kill_command:null,cwd:null,shell:"auto",node_version:null,port:null},h2=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m8 6 9 6-9 6z"})}),m2=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("rect",{x:"6.5",y:"6.5",width:"11",height:"11",rx:"1.8"})}),sw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),l.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),aw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),iw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),rw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),p2={auto:"自动",powershell:"PowerShell",cmd:"CMD",bash:"Bash"},lw=({commands:n,nodeRuntime:t,error:a,pendingRunCommandId:r,pendingKillCommandId:c,pendingDeleteCommandId:u,isSaving:h,isGenerating:p,isStartingAll:y,isStoppingAll:m,generationReason:b,executionModelLabel:g,onRun:x,onRunAll:w,onRunAllKill:N,onRunKill:T,onSave:C,onDelete:I,onGenerate:$})=>{var ue;const[H,R]=_.useState("list"),[Q,ce]=_.useState(null),[Z,ie]=_.useState(f2),ee=_.useMemo(()=>n.find(E=>E.id===Q)??null,[n,Q]),Y=_.useMemo(()=>{const E=[...(t==null?void 0:t.versions)??[]];return Z.node_version&&!E.includes(Z.node_version)&&E.unshift(Z.node_version),E},[Z.node_version,t==null?void 0:t.versions]),F=_.useMemo(()=>n.filter(E=>!!E.kill_command).length,[n]),_e=()=>{ie(f2),ce(null),R("edit")},je=E=>{ie({name:E.name,description:E.description,command:E.command,kill_command:E.kill_command,cwd:E.cwd,shell:E.shell,node_version:E.node_version,port:E.port}),ce(E.id),R("edit")},ae=()=>{C({commandId:ee==null?void 0:ee.id,draft:Z}),h||(R("list"),ce(null))};return l.jsxs("div",{className:"session-run-panel",children:[l.jsxs("div",{className:"session-run-panel__header",children:[l.jsxs("div",{className:"session-run-panel__header-copy",children:[l.jsxs("div",{className:"session-run-panel__title-row",children:[l.jsx("h2",{className:"session-run-panel__title",children:"项目命令"}),l.jsxs("span",{className:"session-run-panel__count",children:[n.length," 条"]})]}),l.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",g]})]}),l.jsxs("div",{className:"session-run-panel__header-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":y?"正在一键启动项目命令":"一键启动项目命令",title:y?"正在一键启动项目命令":"一键启动项目命令",disabled:n.length===0||y||m,onClick:w,children:l.jsx(h2,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":m?"正在一键停止项目命令":"一键停止项目命令",title:m?"正在一键停止项目命令":"一键停止项目命令",disabled:F===0||y||m,onClick:N,children:l.jsx(m2,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":p?"正在一键生成项目命令":"一键生成项目命令",title:p?"正在一键生成项目命令":"一键生成项目命令",disabled:p||y||m,onClick:$,children:l.jsx(sw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目命令",title:"新增项目命令",onClick:_e,children:l.jsx(rw,{})})]})]}),a?l.jsx("div",{className:"session-run-panel__notice is-error",children:a}):null,b?l.jsx("div",{className:"session-run-panel__hint",children:b}):null,H==="edit"?l.jsxs("div",{className:"session-run-panel__card",children:[l.jsx("h3",{className:"session-run-panel__section-title",children:ee?"编辑命令":"新增命令"}),l.jsxs("div",{className:"session-run-panel__form-grid",children:[l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"名称"}),l.jsx("input",{value:Z.name,onChange:E=>ie(U=>({...U,name:E.target.value})),className:"session-run-panel__input",placeholder:"例如:启动前端"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"说明"}),l.jsx("input",{value:Z.description??"",onChange:E=>ie(U=>({...U,description:E.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"命令"}),l.jsx("textarea",{value:Z.command,onChange:E=>ie(U=>({...U,command:E.target.value})),className:"session-run-panel__textarea",placeholder:"pnpm dev",rows:4})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"停止命令"}),l.jsx("textarea",{value:Z.kill_command??"",onChange:E=>ie(U=>({...U,kill_command:E.target.value||null})),className:"session-run-panel__textarea",placeholder:"留空表示不需要单独停止",rows:3})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"工作目录"}),l.jsx("input",{value:Z.cwd??"",onChange:E=>ie(U=>({...U,cwd:E.target.value||null})),className:"session-run-panel__input",placeholder:"留空表示项目根目录"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"端口"}),l.jsx("input",{value:Z.port??"",onChange:E=>{const U=Number.parseInt(E.target.value,10);ie(te=>({...te,port:Number.isFinite(U)&&U>0?U:null}))},className:"session-run-panel__input",placeholder:"例如:5173",inputMode:"numeric"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"Shell"}),l.jsx("select",{value:Z.shell,onChange:E=>ie(U=>({...U,shell:E.target.value})),className:"session-run-panel__select",children:Object.entries(p2).map(([E,U])=>l.jsx("option",{value:E,children:U},E))})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"Node 环境"}),l.jsxs("select",{value:Z.node_version??"",onChange:E=>ie(U=>({...U,node_version:E.target.value||null})),className:"session-run-panel__select",children:[l.jsx("option",{value:"",children:"默认环境"}),Y.map(E=>l.jsxs("option",{value:E,children:["Node ",E,t!=null&&t.versions.includes(E)?"":"(未检测到)"]},E))]})]})]}),l.jsx("div",{className:"session-run-panel__hint",children:t!=null&&t.versions.length?"Node 版本只会临时注入当前命令,不会修改系统全局环境。":((ue=t==null?void 0:t.error)==null?void 0:ue.trim())||"未检测到可用的 nvm Node 版本,将按默认环境运行。"}),l.jsxs("div",{className:"session-run-panel__form-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>R("list"),children:"取消"}),l.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!Z.name.trim()||!Z.command.trim()||h,onClick:ae,children:h?"保存中...":ee?"保存修改":"保存命令"})]})]}):null,l.jsx("div",{className:"session-run-panel__list",children:n.length>0?n.map(E=>l.jsxs("article",{className:"session-run-panel__command-card",children:[l.jsxs("div",{className:"session-run-panel__command-head",children:[l.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>je(E),children:[l.jsxs("div",{className:"session-run-panel__command-heading",children:[l.jsx("span",{className:"session-run-panel__command-name",children:E.name}),E.description?l.jsx("span",{className:"session-run-panel__command-description",children:E.description}):null]}),l.jsx("div",{className:"session-run-panel__command-line",children:E.command})]}),l.jsxs("div",{className:"session-run-panel__command-actions",children:[E.kill_command?l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-warning","aria-label":`执行 ${E.name} 的停止命令`,title:`执行 ${E.name} 的停止命令`,disabled:c===E.id,onClick:()=>T(E.id),children:l.jsx(m2,{})}):null,l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${E.name}`,title:`编辑 ${E.name}`,onClick:()=>je(E),children:l.jsx(aw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${E.name}`,title:`删除 ${E.name}`,disabled:u===E.id,onClick:()=>I(E.id),children:l.jsx(iw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-primary","aria-label":`运行 ${E.name}`,title:`运行 ${E.name}`,disabled:r===E.id,onClick:()=>x(E.id),children:l.jsx(h2,{})})]})]}),l.jsx("div",{className:"session-run-panel__command-footer",children:l.jsxs("div",{className:"session-run-panel__command-meta",children:[l.jsx("span",{className:"session-run-panel__command-pill",children:p2[E.shell]}),E.node_version?l.jsxs("span",{className:"session-run-panel__command-pill is-node",children:["Node ",E.node_version]}):null,E.port?l.jsxs("span",{className:"session-run-panel__command-pill",children:[":",E.port]}):null,E.kill_command?l.jsx("span",{className:"session-run-panel__command-pill is-kill",children:"可停止"}):null,l.jsx("span",{className:"session-run-panel__command-pill",children:E.cwd?E.cwd:"项目根目录"})]})})]},E.id)):l.jsxs("div",{className:"session-run-panel__empty",children:[l.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目命令"}),l.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},g2={name:"",description:null,url:""},ow=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m12 3 1.4 4.6L18 9l-4.6 1.4L12 15l-1.4-4.6L6 9l4.6-1.4Z"}),l.jsx("path",{d:"M18 15.2 18.8 18 21.6 18.8 18.8 19.6 18 22.4 17.2 19.6 14.4 18.8 17.2 18Z"})]}),cw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),l.jsx("path",{d:"M3.8 12h16.4"}),l.jsx("path",{d:"M12 3.7c2.3 2.4 3.6 5.3 3.6 8.3S14.3 17.9 12 20.3c-2.3-2.4-3.6-5.3-3.6-8.3S9.7 6.1 12 3.7Z"})]}),uw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),dw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),fw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 5v14"}),l.jsx("path",{d:"M5 12h14"})]}),hw=({websites:n,error:t,pendingDeleteWebsiteId:a,isSaving:r,isGenerating:c,generationReason:u,executionModelLabel:h,onOpen:p,onSave:y,onDelete:m,onGenerate:b})=>{const[g,x]=_.useState("list"),[w,N]=_.useState(null),[T,C]=_.useState(g2),I=_.useMemo(()=>n.find(Q=>Q.id===w)??null,[w,n]),$=()=>{C(g2),N(null),x("edit")},H=Q=>{C({name:Q.name,description:Q.description,url:Q.url}),N(Q.id),x("edit")},R=()=>{y({websiteId:I==null?void 0:I.id,draft:T}),r||(x("list"),N(null))};return l.jsxs("div",{className:"session-run-panel",children:[l.jsxs("div",{className:"session-run-panel__header",children:[l.jsxs("div",{className:"session-run-panel__header-copy",children:[l.jsxs("div",{className:"session-run-panel__title-row",children:[l.jsx("h2",{className:"session-run-panel__title",children:"项目网页"}),l.jsxs("span",{className:"session-run-panel__count",children:[n.length," 条"]})]}),l.jsxs("div",{className:"session-run-panel__hint",children:["一键生成使用模型:",h]})]}),l.jsxs("div",{className:"session-run-panel__header-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":c?"正在一键生成项目网页":"一键生成项目网页",title:c?"正在一键生成项目网页":"一键生成项目网页",disabled:c,onClick:b,children:l.jsx(ow,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":"新增项目网页",title:"新增项目网页",onClick:$,children:l.jsx(fw,{})})]})]}),t?l.jsx("div",{className:"session-run-panel__notice is-error",children:t}):null,u?l.jsx("div",{className:"session-run-panel__hint",children:u}):null,g==="edit"?l.jsxs("div",{className:"session-run-panel__card",children:[l.jsx("h3",{className:"session-run-panel__section-title",children:I?"编辑网页":"新增网页"}),l.jsxs("div",{className:"session-run-panel__form-grid",children:[l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"名称"}),l.jsx("input",{value:T.name,onChange:Q=>C(ce=>({...ce,name:Q.target.value})),className:"session-run-panel__input",placeholder:"例如:前端首页"})]}),l.jsxs("label",{className:"session-run-panel__field",children:[l.jsx("span",{children:"说明"}),l.jsx("input",{value:T.description??"",onChange:Q=>C(ce=>({...ce,description:Q.target.value||null})),className:"session-run-panel__input",placeholder:"给自己留一个短说明"})]}),l.jsxs("label",{className:"session-run-panel__field is-full",children:[l.jsx("span",{children:"地址"}),l.jsx("input",{value:T.url,onChange:Q=>C(ce=>({...ce,url:Q.target.value})),className:"session-run-panel__input",placeholder:"http://localhost:5173"})]})]}),l.jsxs("div",{className:"session-run-panel__form-actions",children:[l.jsx("button",{type:"button",className:"session-run-panel__ghost-button",onClick:()=>x("list"),children:"取消"}),l.jsx("button",{type:"button",className:"session-run-panel__primary-button",disabled:!T.name.trim()||!T.url.trim()||r,onClick:R,children:r?"保存中...":I?"保存修改":"保存网页"})]})]}):null,l.jsx("div",{className:"session-run-panel__list",children:n.length>0?n.map(Q=>l.jsxs("article",{className:"session-run-panel__command-card",children:[l.jsxs("div",{className:"session-run-panel__command-head",children:[l.jsxs("button",{type:"button",className:"session-run-panel__command-main",onClick:()=>H(Q),children:[l.jsxs("div",{className:"session-run-panel__command-heading",children:[l.jsx("span",{className:"session-run-panel__command-name",children:Q.name}),Q.description?l.jsx("span",{className:"session-run-panel__command-description",children:Q.description}):null]}),l.jsx("div",{className:"session-run-panel__command-line",children:Q.url})]}),l.jsxs("div",{className:"session-run-panel__command-actions",children:[l.jsx("a",{className:"session-run-panel__icon-button is-primary","aria-label":`打开 ${Q.name}`,title:`打开 ${Q.name}`,href:Q.url,target:"_blank",rel:"noreferrer",onClick:()=>p(Q),children:l.jsx(cw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button","aria-label":`编辑 ${Q.name}`,title:`编辑 ${Q.name}`,onClick:()=>H(Q),children:l.jsx(uw,{})}),l.jsx("button",{type:"button",className:"session-run-panel__icon-button is-danger","aria-label":`删除 ${Q.name}`,title:`删除 ${Q.name}`,disabled:a===Q.id,onClick:()=>m(Q.id),children:l.jsx(dw,{})})]})]}),l.jsx("div",{className:"session-run-panel__command-footer",children:l.jsx("div",{className:"session-run-panel__command-meta",children:l.jsx("span",{className:"session-run-panel__command-pill",children:"网页"})})})]},Q.id)):l.jsxs("div",{className:"session-run-panel__empty",children:[l.jsx("div",{className:"session-run-panel__empty-title",children:"还没有项目网页"}),l.jsx("div",{className:"session-run-panel__empty-copy",children:"可以手动新增,或直接点击一键生成。"})]})})]})},mw=/\u001b\[([0-9;]*)m/g,pw={stdout:"",stderr:"stderr",system:"system"},y2={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"bright-black",91:"bright-red",92:"bright-green",93:"bright-yellow",94:"bright-blue",95:"bright-magenta",96:"bright-cyan",97:"bright-white"},wp={fg:null,bg:null,bold:!1,dim:!1,underline:!1},gw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6 18 18"}),l.jsx("path",{d:"M18 6 6 18"})]}),yw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M8 4H4v4"}),l.jsx("path",{d:"M16 4h4v4"}),l.jsx("path",{d:"M8 20H4v-4"}),l.jsx("path",{d:"M16 20h4v-4"}),l.jsx("path",{d:"M9 9 4 4"}),l.jsx("path",{d:"m15 9 5-5"}),l.jsx("path",{d:"m9 15-5 5"}),l.jsx("path",{d:"m15 15 5 5"})]}),vw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 4H4v5"}),l.jsx("path",{d:"M15 4h5v5"}),l.jsx("path",{d:"M9 20H4v-5"}),l.jsx("path",{d:"M15 20h5v-5"}),l.jsx("path",{d:"m4 9 5-5"}),l.jsx("path",{d:"m20 9-5-5"}),l.jsx("path",{d:"m4 15 5 5"}),l.jsx("path",{d:"m20 15-5 5"})]}),_w=n=>{if(!n)return"刚刚";const t=new Date(n);return Number.isNaN(t.getTime())?"刚刚":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit"}).format(t)},v2=(n,t)=>{const a=[n];return t.bold&&a.push("is-bold"),t.dim&&a.push("is-dim"),t.underline&&a.push("is-underline"),t.fg&&a.push(`is-fg-${t.fg}`),t.bg&&a.push(`is-bg-${t.bg}`),a.join(" ")},bw=(n,t)=>{if(t===0)return{...wp};if(t===1)return{...n,bold:!0,dim:!1};if(t===2)return{...n,dim:!0,bold:!1};if(t===4)return{...n,underline:!0};if(t===22)return{...n,bold:!1,dim:!1};if(t===24)return{...n,underline:!1};if(t===39)return{...n,fg:null};if(t===49)return{...n,bg:null};const a=y2[t];if(a)return{...n,fg:a};const r=y2[t-10];return r&&t>=40?{...n,bg:r}:n},xw=(n,t)=>{const a=[];let r=0,c={...wp};for(const u of n.matchAll(mw)){const h=u.index??0;h>r&&a.push({text:n.slice(r,h),className:v2(t,c)});const p=(u[1]??"").split(";").map(y=>Number.parseInt(y||"0",10)).filter(y=>Number.isFinite(y));p.length===0?c={...wp}:c=p.reduce(bw,c),r=h+u[0].length}return r<n.length&&a.push({text:n.slice(r),className:v2(t,c)}),a.length===0&&a.push({text:n,className:t}),a},Iy=_.memo(({chunks:n})=>{const t=_.useMemo(()=>n.map(a=>{const r=pw[a.stream],c=["session-terminal-output__segment",`is-${a.stream}`].join(" ");return{cursor:a.cursor,label:r,segments:xw(a.text,c)}}),[n]);return l.jsx(l.Fragment,{children:t.map(a=>l.jsxs("span",{className:"session-terminal-output__chunk",children:[a.label?l.jsx("span",{className:"session-terminal-output__label",children:a.label}):null,a.segments.map((r,c)=>l.jsx("span",{className:r.className,children:r.text},`${a.cursor}:${c}`))]},a.cursor))})});Iy.displayName="TerminalOutput";const Sw=({terminals:n,activeTerminalId:t,outputs:a,error:r,compact:c=!1,canToggleFullscreen:u=!1,isFullscreen:h=!1,onSelectTerminal:p,onCloseTerminal:y,onToggleFullscreen:m})=>{const b=_.useRef(null),g=n.find(w=>w.id===t)??n[0]??null,x=g?a[g.id]:null;return _.useEffect(()=>{const w=b.current;w&&(w.scrollTop=w.scrollHeight)},[x==null?void 0:x.chunks,g==null?void 0:g.id]),n.length===0?l.jsx("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:l.jsxs("div",{className:"session-terminal-panel__empty",children:[l.jsx("div",{className:"session-terminal-panel__empty-title",children:"还没有运行中的命令"}),l.jsx("p",{className:"session-terminal-panel__empty-copy",children:"从右上角的运行按钮启动一个项目命令后,这里会实时显示终端输出。"})]})}):l.jsxs("section",{className:`session-terminal-panel ${c?"is-compact":""}`,children:[l.jsxs("div",{className:"session-terminal-panel__tabs",children:[l.jsx("div",{className:"session-terminal-panel__tab-list",role:"tablist","aria-label":"终端列表",children:n.map(w=>{const N=w.id===(g==null?void 0:g.id);return l.jsxs("div",{className:`session-terminal-panel__tab ${N?"is-active":""}`,children:[l.jsxs("button",{type:"button",className:"session-terminal-panel__tab-button",role:"tab","aria-selected":N,onClick:()=>p(w.id),children:[l.jsx("span",{className:`session-terminal-panel__tab-dot is-${w.status}`,"aria-hidden":"true"}),l.jsx("span",{className:"session-terminal-panel__tab-title",children:w.title}),l.jsx("span",{className:"session-terminal-panel__tab-time",children:_w(w.last_output_at??w.updated_at)})]}),l.jsx("button",{type:"button",className:"session-terminal-panel__tab-close","aria-label":`关闭 ${w.title}`,onClick:T=>{T.stopPropagation(),y(w.id)},children:l.jsx(gw,{})})]},w.id)})}),u&&m?l.jsx("button",{type:"button",className:"session-terminal-panel__fullscreen-button",onClick:m,"aria-label":h?"退出终端全屏":"终端全屏",title:h?"退出终端全屏":"终端全屏",children:h?l.jsx(vw,{}):l.jsx(yw,{})}):null]}),g?l.jsxs(l.Fragment,{children:[r?l.jsx("div",{className:"session-terminal-panel__notice is-error",children:r}):null,x!=null&&x.error?l.jsx("div",{className:"session-terminal-panel__notice is-error",children:x.error}):null,x!=null&&x.truncated?l.jsx("div",{className:"session-terminal-panel__notice",children:"终端输出过长,已自动显示服务端仍保留的最近内容。"}):null,l.jsx("div",{ref:b,className:"session-terminal-panel__output-wrap",children:l.jsx("pre",{className:"session-terminal-output",children:x&&x.chunks.length>0?l.jsx(Iy,{chunks:x.chunks}):x!=null&&x.isLoading?l.jsx("span",{className:"session-terminal-output__placeholder",children:"正在读取终端输出..."}):l.jsx("span",{className:"session-terminal-output__placeholder",children:"这个终端暂时还没有输出。"})})})]}):null]})},jw=_.memo(function({conversationMainRef:t,conversationScrollRef:a,isDesktopSidebar:r,sidebarShift:c,isSidebarDragging:u,title:h,titleActions:p,topbarActions:y,onOpenSidebar:m,threadContent:b,connectionStatus:g,isConnectionDetailOpen:x,onToggleConnectionDetail:w,showThinkingStatus:N}){const T={transform:`translateX(${c}px)`,transition:u?"none":void 0};return l.jsxs("div",{ref:t,className:`conversation-main ${r?"has-desktop-sidebar":""}`,style:T,children:[l.jsxs("div",{className:"conversation-topbar",children:[r?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:m,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsxs("div",{className:"conversation-topbar__title-row",children:[l.jsx("h1",{children:h}),p]})}),y]}),l.jsx("div",{ref:a,className:"conversation-scroll",children:l.jsxs("div",{className:"conversation-thread",children:[b,g.state!=="connected"?l.jsx("section",{className:"conversation-entry is-connection-status",children:l.jsxs("div",{className:"connection-status",children:[l.jsx("button",{type:"button",className:"connection-status__pill",onClick:C=>{C.stopPropagation(),w()},children:l.jsx("span",{children:g.state==="failed"?"连接异常":`Reconnecting... ${g.attempt}/${g.maxAttempts}`})}),x&&g.error?l.jsx("div",{className:"connection-status__tooltip",role:"tooltip",children:g.error}):null]})}):null,N?l.jsx("section",{className:"conversation-entry is-thinking-status",children:l.jsx("div",{className:"thinking-status-pill",children:l.jsx("span",{children:"正在思考"})})}):null]})})]})}),_2="panda:last-session-id",ww=.4,kw=104,Nw=1800*1e3,Cw=15e3,Tw=120*1e3,b2=2e3,x2=1100,zy="panda:desktop-sidebar-width",hu="panda:desktop-sidebar-width-version",mu="2026-03-24-narrow",Ew=300,By=232,jo=By,Mw=460,Rw=72,Aw=4200,B1="local-model-panel:",Dw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"18",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),Ow=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"10",height:"10",rx:"2"}),l.jsx("path",{d:"M7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1"})]}),Lw=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m7.5 12.5 3 3 6-7"})}),Iw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6 6l12 12"}),l.jsx("path",{d:"M18 6 6 18"})]}),zw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m9 18-6-6 6-6"}),l.jsx("path",{d:"m15 6 6 6-6 6"})]}),Bw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"6",cy:"6",r:"2.2"}),l.jsx("circle",{cx:"18",cy:"6",r:"2.2"}),l.jsx("circle",{cx:"12",cy:"18",r:"2.2"}),l.jsx("path",{d:"M8 7.6 10.5 16"}),l.jsx("path",{d:"M16 7.6 13.5 16"}),l.jsx("path",{d:"M8.2 6h7.6"})]}),Pw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),l.jsx("path",{d:"m7.5 9 2.8 3-2.8 3"}),l.jsx("path",{d:"M12.8 15H16.5"})]}),Uw=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M7 5.5 18 12 7 18.5Z"})}),qw=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"8.4"}),l.jsx("path",{d:"M3.8 12h16.4"}),l.jsx("path",{d:"M12 3.7c2.3 2.3 3.6 5.2 3.6 8.3s-1.3 6-3.6 8.3c-2.3-2.3-3.6-5.2-3.6-8.3s1.3-6 3.6-8.3Z"})]}),S2=(n,t)=>{const a=new Map;for(const r of n)a.set(r.cursor,r);for(const r of t)a.set(r.cursor,r);return[...a.values()].sort((r,c)=>r.cursor-c.cursor)},$w=800,m0=(n,t,a)=>{const r=n.get(t);if(r!==void 0)return n.delete(t),n.set(t,r),r;const c=a();if(n.set(t,c),n.size>$w){const u=n.keys().next().value;u&&n.delete(u)}return c},Hw=new Map,Fw=new Map,Qw=new Map,kp=()=>Rp(()=>import("./session-diff-preview-CsQrlvqF.js"),[]),Gw=_.lazy(async()=>({default:(await kp()).SessionDiffPreview})),Vw=/<proposed_plan>([\s\S]*?)<\/proposed_plan>/g,Kw=n=>m0(Hw,n,()=>My(n)),Np=n=>n.replace(/\\/g,"/"),Yw=n=>{var a;const t=/^\/([A-Za-z][A-Za-z0-9._-]*)/.exec(n.trim());return((a=t==null?void 0:t[1])==null?void 0:a.toLowerCase())??""},Zw=n=>n.kind==="system"&&n.title==="context_compacted",j2=n=>n>=1e3?`${Math.round(n/1e3)}k`:String(Math.round(n)),Ww=n=>m0(Fw,n,()=>{const t=n.replace(/\r\n/g,`
125
125
  `).split(`
126
- `),a=[];let r=[],c=null;const u=()=>{r.length!==0&&(a.push({kind:"paragraph",lines:[...r]}),r=[])},h=()=>{if(!c||c.items.length===0){c=null;return}a.push({kind:"list",ordered:c.ordered,items:[...c.items]}),c=null};for(const p of t){const y=/^\s{0,3}(#{1,6})\s+(.+?)\s*$/.exec(p),m=/^\s*([-*])\s+(.+)$/.exec(p),b=/^\s*(\d+)\.\s+(.+)$/.exec(p);if(y){u(),h(),a.push({kind:"heading",level:y[1].length,text:y[2].replace(/\s+#+\s*$/,"").trim()});continue}if(m||b){u();const g=!!b,x=((b==null?void 0:b[2])??(m==null?void 0:m[2])??"").trim();(!c||c.ordered!==g)&&(h(),c={ordered:g,items:[]}),c.items.push(x);continue}if(!p.trim()){u(),h();continue}h(),r.push(p)}return u(),h(),a}),Yw=n=>m0($w,n,()=>{const t=[];let a=0;n.replace(Fw,(c,u,h)=>{const p=n.slice(a,h);return p.trim()&&t.push({kind:"markdown",content:p.trim()}),typeof u=="string"&&u.trim()?t.push({kind:"proposed-plan",content:u.trim()}):c.trim()&&t.push({kind:"markdown",content:c.trim()}),a=h+c.length,c});const r=n.slice(a);return r.trim()&&t.push({kind:"markdown",content:r.trim()}),t.length===0&&n.trim()&&t.push({kind:"markdown",content:n.trim()}),t}),Zw=n=>{const t=n.files.filter(a=>!!a.item_id);return t.length>0?t:n.files.filter(a=>!a.item_id)},Ww=(n,t)=>{const a=n.files.filter(c=>!c.item_id);if(a.length>0)return a.map(c=>({path:c.path,pathLabel:Nr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}));const r=new Map;for(const c of n.files)r.set(c.path,c);return[...r.values()].map(c=>({path:c.path,pathLabel:Nr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}))},Xw=n=>`${n} background agent${n===1?"":"s"}`,Jw=n=>n.startsWith("Reconnecting...")?"retrying":"error",ek=n=>n.startsWith("Reconnecting...")?"Codex 重连中":"Codex 运行异常",w2=n=>{const t=n.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}},P1=(n,t)=>{const a=n==null?void 0:n[t];return typeof a=="string"&&a.trim()?a.trim():null},tk=n=>{const t=Np(n).replace(/\/+$/,""),a=t.split("/");return a[a.length-1]||t},k2=n=>`${n.kind}\0${n.title}\0${n.body}\0${n.accent}`,nk=(n,t)=>{if(!t||t.length===0||n.length===0)return n;let a=0;for(;a<n.length&&a<t.length&&k2(n[a])===k2(t[a]);)a+=1;return a<=0||a>=n.length?n:n.slice(a)},sk=n=>{const t=n.trim();if(!t.startsWith("<subagent_notification>"))return null;const a=t.indexOf("{");if(a<0)return null;const r=t.lastIndexOf("}");if(r<=a)return null;try{const c=JSON.parse(t.slice(a,r+1)),u=g=>typeof g=="string"?g.trim():"";if(typeof c.status=="string"){const g=c.status.trim();if(g==="shutdown")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理已关闭",state:"shutdown"};if(g==="completed")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理已完成",state:"completed"};if(g==="errored")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理异常结束",state:"errored"};if(g==="working")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理处理中",state:"working"}}const h=c.status&&typeof c.status=="object"?c.status:null,p=u(h==null?void 0:h.completed),y=u(h==null?void 0:h.errored),m=u(h==null?void 0:h.working),b=u(h==null?void 0:h.shutdown);if(p)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:p,state:"completed"};if(y)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:y,state:"errored"};if(m)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:m,state:"working"};if(b)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:b||"子代理已关闭",state:"shutdown"}}catch{return null}return null},U1=["#2f72d8","#d06a3b","#2d9b7f","#8c62d9","#bf5b7f","#b78b2d"],Py=n=>{const t=(n??"").trim();if(!t)return U1[0];let a=0;for(let r=0;r<t.length;r+=1)a=a*31+t.charCodeAt(r)>>>0;return U1[a%U1.length]},ak=n=>{var t;return Py(((t=n.subagent)==null?void 0:t.nickname)??n.title??n.id)},Uy=n=>{let t=-1,a=-1;return n.forEach((r,c)=>{if(!(r.kind!=="system"||r.title!=="status")){if(r.body==="开始处理请求"){t=c;return}r.body==="处理完成"&&(a=c)}}),t>a?t:-1},ik=n=>{var a;const t=Uy(n);return t<0?null:((a=n[t])==null?void 0:a.timestamp)??null},rk=n=>{const t=Uy(n);if(t<0)return new Set;const a=[],r=new Set;for(const c of n.slice(t)){if(c.kind!=="tool")continue;if(c.title!=="tool-output"){if(a.push({name:c.title}),c.title==="close_agent"){const h=w2(c.body),p=P1(h,"id");p&&r.delete(p)}continue}const u=a.shift()??null;if((u==null?void 0:u.name)==="spawn_agent"){const h=w2(c.body),p=P1(h,"agent_id")??P1(h,"id");p&&r.add(p)}}return r},lk=n=>n.run_state==="running"?"is working":n.run_state==="completed"?"completed":"is awaiting instruction",ok=(n,t)=>{const a=+new Date(t);return Number.isFinite(a)?n.some(r=>{if(r.source!=="app-server")return!1;const c=+new Date(r.updated_at);return Number.isFinite(c)&&Math.abs(c-a)<=1e4}):!1},ck=(n,t)=>{if(!n)return"已处理";const a=Math.max(0,new Date(t).getTime()-new Date(n).getTime()),r=Math.max(0,Math.round(a/1e3)),c=Math.floor(r/60),u=r%60;return c<=0?`已处理 ${u}s`:`已处理 ${c}m ${u}s`},Nr=(n,t)=>{const a=Np(n),r=t?Np(t).replace(/\/+$/,""):"";return r&&a.toLowerCase().startsWith(`${r.toLowerCase()}/`)?a.slice(r.length+1):a},uk=(n,t)=>{const a=n.split(/\r?\n/),r=[];let c=null,u=[];const h=()=>{c&&(r.push({...c,diffText:u.join(`
127
- `).trim()}),c=null,u=[])};for(const p of a){const y=p.replace(/\r$/,""),m=y.trimStart();if(y.startsWith("*** Add File: ")){h();const b=y.slice(14).trim();c={path:b,displayPath:Nr(b,t),operation:"add",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Update File: ")){h();const b=y.slice(17).trim();c={path:b,displayPath:Nr(b,t),operation:"update",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Delete File: ")){h();const b=y.slice(17).trim();c={path:b,displayPath:Nr(b,t),operation:"delete",additions:0,deletions:0,diffText:""};continue}if(c){if(y.startsWith("*** End Patch")){h();continue}if(y.startsWith("*** ")){h();continue}y.startsWith("+")?c.additions+=1:y.startsWith("-")&&(c.deletions+=1),(m.startsWith("@@")||y.startsWith("+")||y.startsWith("-")||y.startsWith(" "))&&u.push(m.startsWith("@@")?m:y)}}return h(),r.length===0?null:{files:r,additions:r.reduce((p,y)=>p+y.additions,0),deletions:r.reduce((p,y)=>p+y.deletions,0)}},dk=n=>{if(n.length===0)return null;const t=new Map;for(const r of n)for(const c of r.files){const u=t.get(c.path);if(!u){t.set(c.path,{...c});continue}u.additions+=c.additions,u.deletions+=c.deletions,u.diffText=[u.diffText,c.diffText].filter(Boolean).join(`
128
- `),u.operation=c.operation}const a=[...t.values()];return{files:a,additions:a.reduce((r,c)=>r+c.additions,0),deletions:a.reduce((r,c)=>r+c.deletions,0)}},yf=(n,t=Sw)=>{const a=n.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,t-1).trimEnd()}…`},p0=n=>{try{return JSON.parse(n)}catch{return null}},fk=n=>{const t=p0(n.body);if(t){const a=["command","cmd","path","pattern","q","input"];for(const r of a){const c=t[r];if(typeof c=="string"&&c.trim())return yf(c)}}return n.title&&n.title!=="tool-output"?n.body.trim().startsWith("{")||n.body.trim().startsWith("[")?yf(n.title.replace(/-/g," ")):yf(n.body||n.title):yf(n.body||"工具执行")},hk=n=>{if(n.title==="apply_patch")return n.body.trim();const t=p0(n.body);return t&&typeof t.command=="string"&&t.command.trim()?t.command.trim():n.body.trim()||n.title},mk=n=>n.map(t=>{const a=p0(t.body);return a&&typeof a.output=="string"?a.output.trim():t.body.trim()}).filter(Boolean).join(`
126
+ `),a=[];let r=[],c=null;const u=()=>{r.length!==0&&(a.push({kind:"paragraph",lines:[...r]}),r=[])},h=()=>{if(!c||c.items.length===0){c=null;return}a.push({kind:"list",ordered:c.ordered,items:[...c.items]}),c=null};for(const p of t){const y=/^\s{0,3}(#{1,6})\s+(.+?)\s*$/.exec(p),m=/^\s*([-*])\s+(.+)$/.exec(p),b=/^\s*(\d+)\.\s+(.+)$/.exec(p);if(y){u(),h(),a.push({kind:"heading",level:y[1].length,text:y[2].replace(/\s+#+\s*$/,"").trim()});continue}if(m||b){u();const g=!!b,x=((b==null?void 0:b[2])??(m==null?void 0:m[2])??"").trim();(!c||c.ordered!==g)&&(h(),c={ordered:g,items:[]}),c.items.push(x);continue}if(!p.trim()){u(),h();continue}h(),r.push(p)}return u(),h(),a}),Xw=n=>m0(Qw,n,()=>{const t=[];let a=0;n.replace(Vw,(c,u,h)=>{const p=n.slice(a,h);return p.trim()&&t.push({kind:"markdown",content:p.trim()}),typeof u=="string"&&u.trim()?t.push({kind:"proposed-plan",content:u.trim()}):c.trim()&&t.push({kind:"markdown",content:c.trim()}),a=h+c.length,c});const r=n.slice(a);return r.trim()&&t.push({kind:"markdown",content:r.trim()}),t.length===0&&n.trim()&&t.push({kind:"markdown",content:n.trim()}),t}),Jw=n=>{const t=n.files.filter(a=>!!a.item_id);return t.length>0?t:n.files.filter(a=>!a.item_id)},ek=(n,t)=>{const a=n.files.filter(c=>!c.item_id);if(a.length>0)return a.map(c=>({path:c.path,pathLabel:Nr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}));const r=new Map;for(const c of n.files)r.set(c.path,c);return[...r.values()].map(c=>({path:c.path,pathLabel:Nr(c.path,t),additions:c.additions,deletions:c.deletions,diff:c.diff,emptyMessage:"此变更没有可展示的补丁内容"}))},tk=n=>`${n} background agent${n===1?"":"s"}`,nk=n=>n.startsWith("Reconnecting...")?"retrying":"error",sk=n=>n.startsWith("Reconnecting...")?"Codex 重连中":"Codex 运行异常",w2=n=>{const t=n.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}},P1=(n,t)=>{const a=n==null?void 0:n[t];return typeof a=="string"&&a.trim()?a.trim():null},ak=n=>{const t=Np(n).replace(/\/+$/,""),a=t.split("/");return a[a.length-1]||t},k2=n=>`${n.kind}\0${n.title}\0${n.body}\0${n.accent}`,ik=(n,t)=>{if(!t||t.length===0||n.length===0)return n;let a=0;for(;a<n.length&&a<t.length&&k2(n[a])===k2(t[a]);)a+=1;return a<=0||a>=n.length?n:n.slice(a)},rk=n=>{const t=n.trim();if(!t.startsWith("<subagent_notification>"))return null;const a=t.indexOf("{");if(a<0)return null;const r=t.lastIndexOf("}");if(r<=a)return null;try{const c=JSON.parse(t.slice(a,r+1)),u=g=>typeof g=="string"?g.trim():"";if(typeof c.status=="string"){const g=c.status.trim();if(g==="shutdown")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理已关闭",state:"shutdown"};if(g==="completed")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理已完成",state:"completed"};if(g==="errored")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理异常结束",state:"errored"};if(g==="working")return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:"子代理处理中",state:"working"}}const h=c.status&&typeof c.status=="object"?c.status:null,p=u(h==null?void 0:h.completed),y=u(h==null?void 0:h.errored),m=u(h==null?void 0:h.working),b=u(h==null?void 0:h.shutdown);if(p)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:p,state:"completed"};if(y)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:y,state:"errored"};if(m)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:m,state:"working"};if(b)return{agentId:typeof c.agent_id=="string"?c.agent_id:null,body:b||"子代理已关闭",state:"shutdown"}}catch{return null}return null},U1=["#2f72d8","#d06a3b","#2d9b7f","#8c62d9","#bf5b7f","#b78b2d"],Py=n=>{const t=(n??"").trim();if(!t)return U1[0];let a=0;for(let r=0;r<t.length;r+=1)a=a*31+t.charCodeAt(r)>>>0;return U1[a%U1.length]},lk=n=>{var t;return Py(((t=n.subagent)==null?void 0:t.nickname)??n.title??n.id)},Uy=n=>{let t=-1,a=-1;return n.forEach((r,c)=>{if(!(r.kind!=="system"||r.title!=="status")){if(r.body==="开始处理请求"){t=c;return}r.body==="处理完成"&&(a=c)}}),t>a?t:-1},ok=n=>{var a;const t=Uy(n);return t<0?null:((a=n[t])==null?void 0:a.timestamp)??null},ck=n=>{const t=Uy(n);if(t<0)return new Set;const a=[],r=new Set;for(const c of n.slice(t)){if(c.kind!=="tool")continue;if(c.title!=="tool-output"){if(a.push({name:c.title}),c.title==="close_agent"){const h=w2(c.body),p=P1(h,"id");p&&r.delete(p)}continue}const u=a.shift()??null;if((u==null?void 0:u.name)==="spawn_agent"){const h=w2(c.body),p=P1(h,"agent_id")??P1(h,"id");p&&r.add(p)}}return r},uk=n=>n.run_state==="running"?"is working":n.run_state==="completed"?"completed":"is awaiting instruction",dk=(n,t)=>{const a=+new Date(t);return Number.isFinite(a)?n.some(r=>{if(r.source!=="app-server")return!1;const c=+new Date(r.updated_at);return Number.isFinite(c)&&Math.abs(c-a)<=1e4}):!1},fk=(n,t)=>{if(!n)return"已处理";const a=Math.max(0,new Date(t).getTime()-new Date(n).getTime()),r=Math.max(0,Math.round(a/1e3)),c=Math.floor(r/60),u=r%60;return c<=0?`已处理 ${u}s`:`已处理 ${c}m ${u}s`},Nr=(n,t)=>{const a=Np(n),r=t?Np(t).replace(/\/+$/,""):"";return r&&a.toLowerCase().startsWith(`${r.toLowerCase()}/`)?a.slice(r.length+1):a},hk=(n,t)=>{const a=n.split(/\r?\n/),r=[];let c=null,u=[];const h=()=>{c&&(r.push({...c,diffText:u.join(`
127
+ `).trim()}),c=null,u=[])};for(const p of a){const y=p.replace(/\r$/,""),m=y.trimStart();if(y.startsWith("*** Add File: ")){h();const b=y.slice(14).trim();c={path:b,displayPath:Nr(b,t),operation:"add",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Update File: ")){h();const b=y.slice(17).trim();c={path:b,displayPath:Nr(b,t),operation:"update",additions:0,deletions:0,diffText:""};continue}if(y.startsWith("*** Delete File: ")){h();const b=y.slice(17).trim();c={path:b,displayPath:Nr(b,t),operation:"delete",additions:0,deletions:0,diffText:""};continue}if(c){if(y.startsWith("*** End Patch")){h();continue}if(y.startsWith("*** ")){h();continue}y.startsWith("+")?c.additions+=1:y.startsWith("-")&&(c.deletions+=1),(m.startsWith("@@")||y.startsWith("+")||y.startsWith("-")||y.startsWith(" "))&&u.push(m.startsWith("@@")?m:y)}}return h(),r.length===0?null:{files:r,additions:r.reduce((p,y)=>p+y.additions,0),deletions:r.reduce((p,y)=>p+y.deletions,0)}},mk=n=>{if(n.length===0)return null;const t=new Map;for(const r of n)for(const c of r.files){const u=t.get(c.path);if(!u){t.set(c.path,{...c});continue}u.additions+=c.additions,u.deletions+=c.deletions,u.diffText=[u.diffText,c.diffText].filter(Boolean).join(`
128
+ `),u.operation=c.operation}const a=[...t.values()];return{files:a,additions:a.reduce((r,c)=>r+c.additions,0),deletions:a.reduce((r,c)=>r+c.deletions,0)}},yf=(n,t=kw)=>{const a=n.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,t-1).trimEnd()}…`},p0=n=>{try{return JSON.parse(n)}catch{return null}},pk=n=>{const t=p0(n.body);if(t){const a=["command","cmd","path","pattern","q","input"];for(const r of a){const c=t[r];if(typeof c=="string"&&c.trim())return yf(c)}}return n.title&&n.title!=="tool-output"?n.body.trim().startsWith("{")||n.body.trim().startsWith("[")?yf(n.title.replace(/-/g," ")):yf(n.body||n.title):yf(n.body||"工具执行")},gk=n=>{if(n.title==="apply_patch")return n.body.trim();const t=p0(n.body);return t&&typeof t.command=="string"&&t.command.trim()?t.command.trim():n.body.trim()||n.title},yk=n=>n.map(t=>{const a=p0(t.body);return a&&typeof a.output=="string"?a.output.trim():t.body.trim()}).filter(Boolean).join(`
129
129
 
130
- `),pk=n=>n.kind==="entry"&&n.entry.kind==="user",gk=n=>n.kind==="entry"&&n.entry.kind==="assistant",yk=n=>n.kind==="tool-group"?!0:n.entry.kind==="assistant"||n.entry.kind==="thinking"||n.entry.kind==="tool",vk=n=>{if(n.length<=1)return n;const t=[];for(const a of n){const r=t[t.length-1];if(r&&r.kind==="entry"&&a.kind==="entry"&&r.entry.kind==="assistant"&&a.entry.kind==="assistant"&&r.entry.body.trim()===a.entry.body.trim()){t[t.length-1]=a;continue}t.push(a)}return t},_k=(n,t)=>{const a=vk(n.items),{completion:r}=n,c=a.findLastIndex(h=>gk(h));if(c===-1||!r||!t)return{id:n.id,startedAt:n.startedAt,visibleStartItems:c===-1?a:a.slice(0,c),hiddenItems:[],visibleEndItems:c===-1?[]:a.slice(c),completion:r};let u=0;for(;u<a.length&&pk(a[u]);)u+=1;return{id:n.id,startedAt:n.startedAt,visibleStartItems:a.slice(0,u),hiddenItems:[...a.slice(u,c),...a.slice(c+1)],visibleEndItems:[a[c]],completion:r}},bk=(n,t)=>{const a=[];let r=[],c=null;const u=()=>{for(const p of r)a.push({kind:"item",id:p.kind==="entry"?p.entry.id:p.group.id,item:p});r=[]},h=()=>{c&&((c.items.length>0||c.completion)&&a.push({kind:"turn",turn:_k(c,t)}),c=null)};for(const p of n){if(p.kind==="turn-start"){h(),c={id:p.id,startedAt:p.startedAt,items:r,completion:null},r=[];continue}if(p.kind==="turn-complete"){if(c){c.completion=p;continue}c={id:p.id,startedAt:null,items:r,completion:p},r=[];continue}if(c){if(c.completion&&!yk(p)){h(),r.push(p);continue}c.items.push(p);continue}r.push(p)}return h(),u(),a},xk=n=>n.run_state!=="running"&&Date.now()-new Date(n.last_event_at).getTime()>=jw,Sk=(n,t)=>{var m,b;const a=t==null?void 0:t.projectPath,r=(t==null?void 0:t.compactCompletedTurns)??!1,c=[];let u=null,h=!1,p=null,y=[];for(let g=0;g<n.length;g+=1){const x=n[g];if(x.kind==="system"&&x.body==="开始处理请求"){c.push({kind:"turn-start",id:x.id,startedAt:x.timestamp}),p=x.timestamp,y=[];continue}if(x.kind==="system"&&x.body==="处理完成"){c.push({kind:"turn-complete",id:x.id,durationLabel:ck(p,x.timestamp),patchSummary:dk(y),completedAt:x.timestamp}),p=null,y=[];continue}if(x.kind==="tool"&&x.title!=="tool-output"){const w=[];let N=g+1;for(;N<n.length&&((m=n[N])==null?void 0:m.kind)==="tool"&&((b=n[N])==null?void 0:b.title)==="tool-output";)w.push(n[N]),N+=1;u=x.id;const T=x.title==="apply_patch"?uk(x.body,a):null;T&&y.push(T),w.length===0&&(h=!0),c.push({kind:"tool-group",group:{id:x.id,commandEntry:x,outputEntries:w,patchSummary:T}}),g=N-1;continue}if(x.kind==="tool"&&x.title==="tool-output"){c.push({kind:"tool-group",group:{id:x.id,commandEntry:x,outputEntries:[],patchSummary:null}}),u=x.id;continue}c.push({kind:"entry",entry:x})}return{blocks:bk(c,r),lastToolGroupId:u,hasRunningToolGroup:h}},jk=n=>n.kind==="entry"?n.entry.timestamp:n.group.commandEntry.timestamp,wk=(n,t)=>{var h,p;const a=[...n.visibleStartItems,...n.hiddenItems,...n.visibleEndItems].map(jk).filter(y=>!!y),r=a.length>0?a[a.length-1]:null,c=n.startedAt??a[0]??((h=n.completion)==null?void 0:h.completedAt)??null,u=((p=n.completion)==null?void 0:p.completedAt)??r??c;return{startMs:c?+new Date(c):null,endMs:u?+new Date(u):null,nextStartMs:t!=null&&t.startedAt?+new Date(t.startedAt):null}},kk=(n,t)=>{const a=[...t].sort((h,p)=>+new Date(h.started_at)-+new Date(p.started_at)),r=new Set,c=n.filter(h=>h.kind==="turn"),u=new Map(c.map((h,p)=>[h.turn.id,p]));return n.map(h=>{var N;if(h.kind!=="turn")return h;const p=u.get(h.turn.id)??-1,y=p>=0?((N=c[p+1])==null?void 0:N.turn)??null:null,m=wk(h.turn,y),b=m.startMs??(m.endMs!==null?m.endMs-1200:null),g=m.nextStartMs??(m.endMs!==null?m.endMs+1200:Number.POSITIVE_INFINITY),x=a.find(T=>{if(r.has(T.id))return!1;const C=+new Date(T.started_at),I=T.completed_at?+new Date(T.completed_at):null;return b!==null&&C<b-1200?!1:C<=g+1200||I!==null&&I<=g+1200})??null;return x&&r.add(x.id),{kind:"turn",turn:h.turn,changeSet:x}})},Nk=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),Cp=n=>Math.max(By,Math.min(Cw,n)),Ck=()=>{if(typeof window>"u")return jo;try{const n=window.localStorage.getItem(zy),t=window.localStorage.getItem(hu);if(!n)return window.localStorage.setItem(hu,mu),jo;const a=Number(n);if(!Number.isFinite(a))return window.localStorage.setItem(hu,mu),jo;const c=t!==mu||a===Nw||a>jo?jo:a;return window.localStorage.setItem(hu,mu),Cp(c)}catch{return jo}};function vf({active:n,render:t,fallback:a=null}){const[r,c]=_.useState(!n);return _.useEffect(()=>{if(!n){c(!1);return}c(!1);const u=window.requestAnimationFrame(()=>{c(!0)});return()=>{window.cancelAnimationFrame(u)}},[n]),n?r?l.jsx(l.Fragment,{children:t()}):l.jsx(l.Fragment,{children:a}):null}const Tk=_.memo(function({sessions:t,sessionRunState:a,projectPath:r,renderedBlocks:c,lastToolGroupId:u,sessionChangeSets:h,isSubagentTimelinePending:p,hasTimeline:y,proposedPlanReplyDrafts:m,pendingProposedPlanReplyEntryId:b,canRespondToProposedPlan:g,onProposedPlanReplyDraftChange:x,onSubmitProposedPlanReply:w,onPreviewImage:N}){const[T,C]=_.useState({}),[I,$]=_.useState({}),[H,R]=_.useState({}),[Q,ce]=_.useState(null),[Z,ie]=_.useState(null),ee=_.useRef(null);_.useEffect(()=>{const he=q=>{const Se=q.target;Se instanceof Element&&Se.closest(".conversation-inline-link")||ce(null)};return window.addEventListener("pointerdown",he),()=>{window.removeEventListener("pointerdown",he)}},[]),_.useEffect(()=>()=>{ee.current!==null&&window.clearTimeout(ee.current)},[]);const Y=he=>{C(q=>({...q,[he]:!q[he]}))},F=he=>{$(q=>({...q,[he]:!q[he]}))},_e=he=>{R(q=>({...q,[he]:!q[he]}))},je=async(he,q)=>{var me;const Se=q.trim();if(!Se)return;const Ne=()=>{const Te=document.createElement("textarea");Te.value=Se,Te.setAttribute("readonly","true"),Te.style.position="fixed",Te.style.opacity="0",Te.style.pointerEvents="none",document.body.appendChild(Te),Te.select(),document.execCommand("copy"),document.body.removeChild(Te)};try{(me=navigator.clipboard)!=null&&me.writeText?await navigator.clipboard.writeText(Se):Ne(),ie(he),ee.current!==null&&window.clearTimeout(ee.current),ee.current=window.setTimeout(()=>{ie(Te=>Te===he?null:Te),ee.current=null},1400)}catch{}};function ae(he,q,Se){return l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}),children:l.jsx(Hw,{diffText:he,filePath:q,emptyMessage:Se})})}function ue(he,q,Se){const Ne=Q===Se;return l.jsxs("span",{className:`conversation-inline-link ${Ne?"is-active":""}`,children:[l.jsx("button",{type:"button",className:"conversation-inline-link__button",onClick:me=>{me.stopPropagation(),ce(Te=>Te===Se?null:Se)},children:he}),Ne?l.jsx("span",{className:"conversation-inline-link__tooltip",role:"tooltip",children:q}):null]},Se)}function E(he,q,Se=Nr(he,r)){return ue(tk(Se),Se,q)}function U(he,q){return Qw(he).map((Ne,me)=>{const Te=`${q}-${me}`;return Ne.kind==="text"?l.jsx("span",{children:Ne.value},Te):Ne.kind==="code"?l.jsx("code",{className:"conversation-inline-code",children:Ne.value},Te):Ne.kind==="strong"?l.jsx("strong",{children:U(Ne.value,`${Te}-strong`)},Te):Ne.kind==="emphasis"?l.jsx("em",{children:U(Ne.value,`${Te}-emphasis`)},Te):Ne.kind==="skill"?l.jsx("span",{className:"conversation-skill-token",children:Ne.raw},Te):Ne.kind==="command"?l.jsx("span",{className:"conversation-command-token",children:Ne.raw},Te):ue(Ne.label,Ne.path,Te)})}function te(he,q){return Kw(he).map((Ne,me)=>{const Te=`${q}-block-${me}`;if(Ne.kind==="heading"){const Ge=Math.min(Ne.level,3),Ue=Ge===1?"h1":Ge===2?"h2":"h3";return l.jsx(Ue,{className:`conversation-markdown-heading is-level-${Ge}`,children:U(Ne.text,`${Te}-heading`)},Te)}if(Ne.kind==="list"){const Ge=Ne.ordered?"ol":"ul";return l.jsx(Ge,{className:"conversation-markdown-list",children:Ne.items.map((Ue,gt)=>l.jsx("li",{children:U(Ue,`${Te}-item-${gt}`)},`${Te}-item-${gt}`))},Te)}return l.jsx("p",{className:"conversation-markdown-paragraph",children:Ne.lines.map((Ge,Ue)=>l.jsxs("span",{children:[Ue>0?l.jsx("br",{}):null,U(Ge,`${Te}-line-${Ue}`)]},`${Te}-line-${Ue}`))},Te)})}function W(he,q,Se){const Ne=`${he.id}:proposed-plan:${Se}`,me=m[Ne]??"",Te=b===Ne,Ge=!g||Te;return l.jsxs("div",{className:"proposed-plan-card",children:[l.jsx("div",{className:"proposed-plan-card__content",children:te(q,`${Ne}:content`)}),l.jsxs("div",{className:"proposed-plan-card__footer",children:[l.jsx("div",{className:"proposed-plan-card__title",children:"实施此计划?"}),l.jsxs("div",{className:"proposed-plan-card__actions",children:[l.jsx("button",{type:"button",className:"proposed-plan-card__confirm",disabled:Ge,onClick:()=>{w(Ne,"是,实施此计划")},children:Te?"回复中…":"是,实施此计划"}),l.jsxs("div",{className:"proposed-plan-card__custom",children:[l.jsx("input",{type:"text",className:"proposed-plan-card__input",value:me,disabled:Ge,placeholder:"否,请告知如何调整",onChange:Ue=>{x(Ne,Ue.target.value)},onKeyDown:Ue=>{Ue.key!=="Enter"||!me.trim()||Ge||(Ue.preventDefault(),w(Ne,me))}}),l.jsx("button",{type:"button",className:"proposed-plan-card__submit",disabled:Ge||!me.trim(),onClick:()=>{w(Ne,me)},children:Te?"回复中…":"回复"})]})]})]})]},Ne)}function xe(he){const q=Yw(he.body);return q.some(Ne=>Ne.kind==="proposed-plan")?q.map((Ne,me)=>{const Te=`${he.id}-content-${me}`;return Ne.kind==="markdown"?l.jsx("div",{className:"conversation-entry__rich-block",children:te(Ne.content,Te)},Te):W(he,Ne.content,me)}):te(he.body,he.id)}function A(he){const q=P3([],he.attachments);if(q.length===0)return null;const Se=q.filter(Z6),Ne=q.filter(me=>!Z6(me));return l.jsxs("div",{className:"conversation-entry__attachments",children:[Se.length>0?l.jsx("div",{className:"conversation-entry__attachment-grid",children:Se.map(me=>{const Te=Sp(me.size_bytes),Ge=me.name??"图片",Ue=`图片${Te?` · ${Te}`:""}`,gt=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"conversation-entry__attachment-media",children:me.content_url?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:me.content_url,alt:Ge,loading:"lazy"}),l.jsx("span",{className:"conversation-entry__attachment-badge",children:"预览"})]}):l.jsx("div",{className:"conversation-entry__attachment-fallback",children:"无法预览"})}),l.jsxs("div",{className:"conversation-entry__attachment-caption",children:[l.jsx("span",{className:"conversation-entry__attachment-title",children:Ge}),l.jsx("span",{className:"conversation-entry__attachment-meta",children:Ue})]})]});return me.content_url?l.jsx("button",{type:"button",className:"conversation-entry__attachment-card is-image",onClick:()=>N({src:me.content_url,label:Ge,meta:Ue}),"aria-label":`预览 ${Ge}`,children:gt},`${he.id}:${me.id}`):l.jsx("div",{className:"conversation-entry__attachment-card is-image",children:gt},`${he.id}:${me.id}`)})}):null,Ne.length>0?l.jsx("div",{className:"conversation-entry__file-list",children:Ne.map(me=>{const Te=Sp(me.size_bytes),Ge=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-entry__file-icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),l.jsx("path",{d:"M14 3v5h5"}),l.jsx("path",{d:"M9 13h6"}),l.jsx("path",{d:"M9 17h4"})]})}),l.jsxs("span",{className:"conversation-entry__file-copy",children:[l.jsx("span",{className:"conversation-entry__file-title",children:me.name??"附件"}),l.jsxs("span",{className:"conversation-entry__file-meta",children:["文件",Te?` · ${Te}`:""]})]})]});return me.content_url?l.jsx("a",{className:"conversation-entry__file-card",href:me.content_url,download:me.name??void 0,target:"_blank",rel:"noreferrer",children:Ge},`${he.id}:${me.id}`):l.jsx("div",{className:"conversation-entry__file-card",children:Ge},`${he.id}:${me.id}`)})}):null]})}function ne(he,q){return l.jsx("div",{className:"turn-patch-summary__files",children:q.map(Se=>{const Ne=`${he}:${Se.path}`,me=!!H[Ne];return l.jsxs("div",{className:`turn-patch-file ${me?"is-expanded":""}`,children:[l.jsxs("button",{type:"button",className:"turn-patch-file__toggle",onClick:()=>_e(Ne),"aria-expanded":me,children:[l.jsx("div",{className:"turn-patch-file__path",children:Se.pathLabel}),l.jsxs("div",{className:"turn-patch-file__meta",children:[l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",Se.additions]}),l.jsxs("span",{className:"is-remove",children:["-",Se.deletions]})]}),l.jsx("span",{className:"turn-patch-file__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]})]}),me?l.jsx("div",{className:"turn-patch-file__detail",children:l.jsx(vf,{active:me,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),render:()=>ae(Se.diff,Se.path,Se.emptyMessage)})}):null]},Ne)})})}function be(he){return Zw(he).map(q=>{const Se=`live:${he.id}:${q.item_id??"summary"}:${q.path}`,Ne=!!H[Se],me=he.status==="running";return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry ${me?"is-running":"is-complete"} ${Ne?"is-expanded":""} is-patch`,children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>_e(Se),"aria-expanded":Ne,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:"已编辑"}),l.jsx("span",{className:"tool-entry__command",children:E(q.path,`${Se}:live-link`,Nr(q.path,r))}),l.jsxs("span",{className:"tool-entry__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Ne?l.jsx("div",{className:"tool-entry__details",children:l.jsx(vf,{active:Ne,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>l.jsx("div",{className:"tool-entry__patch-list",children:l.jsxs("div",{className:"patch-file-card",children:[l.jsxs("div",{className:"patch-file-card__header",children:[l.jsx("div",{className:"patch-file-card__path",children:Nr(q.path,r)}),l.jsxs("div",{className:"patch-file-card__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]}),l.jsx("div",{className:"patch-file-card__diff",children:ae(q.diff,q.path,"此变更还没有可展示的补丁内容")})]})})})}):null]})},Se)})}function V(he){const q=Ww(he,r),Se=q.reduce((me,Te)=>me+Te.additions,0),Ne=q.reduce((me,Te)=>me+Te.deletions,0);return l.jsxs("div",{className:"turn-patch-summary",children:[l.jsx("div",{className:"turn-patch-summary__header",children:l.jsxs("div",{className:"turn-patch-summary__title",children:[l.jsxs("span",{children:[q.length," 个文件已更改"]}),l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",Se]}),l.jsxs("span",{className:"is-remove",children:["-",Ne]})]})]})}),ne(`summary:${he.id}`,q)]})}function pe(he,q){return l.jsxs("div",{className:"turn-patch-summary",children:[l.jsx("div",{className:"turn-patch-summary__header",children:l.jsxs("div",{className:"turn-patch-summary__title",children:[l.jsxs("span",{children:[q.files.length," 个文件已更改"]}),l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]})}),ne(he,q.files.map(Se=>({path:Se.path,pathLabel:Se.displayPath,additions:Se.additions,deletions:Se.deletions,diff:Se.diffText,emptyMessage:"此变更没有可展示的补丁内容"})))]})}function Ce(he,q){var Lt,St;const Se=q.agentId?t.find(st=>st.id===q.agentId)??null:null,Ne=Py(((Lt=Se==null?void 0:Se.subagent)==null?void 0:Lt.nickname)??(Se==null?void 0:Se.title)??q.agentId),me=`subagent:${he.id}`,Te=!!T[me],Ge=q.state==="working",Ue=q.state==="completed"?"子代理返回":q.state==="shutdown"?"子代理已关闭":q.state==="errored"?"子代理异常":"子代理处理中",gt=((St=Se==null?void 0:Se.subagent)==null?void 0:St.nickname)??(Se==null?void 0:Se.title)??"子代理";return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry is-subagent ${Ge?"is-running":"is-complete"} ${Te?"is-expanded":""}`,style:{"--subagent-accent":Ne},children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Y(me),"aria-expanded":Te,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:Ue}),l.jsx("span",{className:"tool-entry__command tool-entry__command--agent",children:gt})]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?l.jsx("div",{className:"tool-entry__details",children:l.jsx(vf,{active:Te,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:gt}),l.jsx("div",{className:"tool-entry__markdown",children:te(q.body,`${he.id}-subagent`)})]})})}):null]})},he.id)}function Le(he){var Ne;if(he.kind==="tool-group"){const{group:me}=he;if(me.commandEntry.title==="apply_patch"&&ok(h,me.commandEntry.timestamp))return null;const Te=!!T[me.id],Ge=a==="running"&&u===me.id&&me.outputEntries.length===0,Ue=me.commandEntry.title==="apply_patch"&&!!me.patchSummary,gt=Ue?me.patchSummary.files.length===1?me.patchSummary.files[0].displayPath:`${me.patchSummary.files.length} 个文件`:fk(me.commandEntry),Lt=hk(me.commandEntry),St=mk(me.outputEntries);return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry ${Ge?"is-running":"is-complete"} ${Te?"is-expanded":""} ${Ue?"is-patch":""}`,children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Y(me.id),"aria-expanded":Te,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:Ue?"已编辑":Ge?"正在执行":"已执行"}),l.jsx("span",{className:"tool-entry__command",children:Ue&&((Ne=me.patchSummary)==null?void 0:Ne.files.length)===1?E(me.patchSummary.files[0].path,`${me.id}:patch-link`,me.patchSummary.files[0].displayPath):gt}),Ue&&me.patchSummary?l.jsxs("span",{className:"tool-entry__counts",children:[l.jsxs("span",{className:"is-add",children:["+",me.patchSummary.additions]}),l.jsxs("span",{className:"is-remove",children:["-",me.patchSummary.deletions]})]}):null]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?l.jsx("div",{className:"tool-entry__details",children:l.jsx(vf,{active:Te,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>Ue&&me.patchSummary?l.jsx("div",{className:"tool-entry__patch-list",children:me.patchSummary.files.map(st=>l.jsxs("div",{className:"patch-file-card",children:[l.jsxs("div",{className:"patch-file-card__header",children:[l.jsx("div",{className:"patch-file-card__path",children:st.displayPath}),l.jsxs("div",{className:"patch-file-card__counts",children:[l.jsxs("span",{className:"is-add",children:["+",st.additions]}),l.jsxs("span",{className:"is-remove",children:["-",st.deletions]})]})]}),l.jsx("div",{className:"patch-file-card__diff",children:ae(st.diffText,st.path,"此变更没有可展示的补丁内容")})]},`${me.id}-${st.path}`))}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:"命令"}),l.jsx("pre",{className:"tool-entry__pre",children:Lt})]}),St?l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:"输出"}),l.jsx("pre",{className:"tool-entry__pre",children:St})]}):null]})})}):null]})},me.id)}const q=he.entry,Se=q.kind==="user"?sk(q.body):null;if(Se)return Ce(q,Se);if(q.kind==="thinking")return a!=="running"?null:l.jsx("section",{className:"conversation-entry is-thinking-status",children:l.jsx("div",{className:"thinking-status-pill",children:l.jsx("span",{children:"正在思考"})})},q.id);if(Vw(q))return l.jsx("section",{className:"conversation-context-compact",children:l.jsx("div",{className:"context-compact-divider",children:l.jsx("span",{children:"背景信息已自动压缩"})})},q.id);if(q.kind==="system"&&q.title==="system_prompt")return null;if(q.kind==="system"&&q.title==="runtime-status"){const me=Jw(q.body);return l.jsx("section",{className:"conversation-entry is-runtime-status",children:l.jsxs("div",{className:`runtime-status-entry is-${me}`,children:[l.jsx("div",{className:"runtime-status-entry__label",children:ek(q.body)}),l.jsx("pre",{className:"runtime-status-entry__body",children:q.body})]})},q.id)}return l.jsx("section",{className:`conversation-entry ${q.kind==="user"?"is-user":"is-system"} is-${q.kind}`,children:q.kind==="user"?l.jsxs("div",{className:"conversation-entry__stack",children:[l.jsxs("div",{className:"conversation-entry__body",children:[q.body.trim()?te(q.body,q.id):null,q.attachments.length>0?A(q):null]}),q.body.trim()?l.jsxs("button",{type:"button",className:`conversation-entry__copy ${Z===q.id?"is-copied":""}`,onClick:()=>{je(q.id,q.body)},"aria-label":Z===q.id?"已复制消息":"复制消息",children:[l.jsx("span",{className:"conversation-entry__copy-icon","aria-hidden":"true",children:Z===q.id?l.jsx(Aw,{}):l.jsx(Rw,{})}),l.jsx("span",{className:"sr-only",children:Z===q.id?"已复制":"复制"})]}):null]}):l.jsxs("div",{className:"conversation-entry__body",children:[q.body.trim()?q.kind==="assistant"?xe(q):te(q.body,q.id):null,q.attachments.length>0?A(q):null]})},q.id)}return p?l.jsx("div",{className:"empty-panel",children:"正在载入子代理会话…"}):y?c.map(he=>{var Ge;if(he.kind==="item")return Le(he.item);const{turn:q}=he,Se=he.changeSet,Ne=((Ge=q.completion)==null?void 0:Ge.patchSummary)??null,me=!!I[q.id],Te=q.hiddenItems.length>0&&!me;return l.jsxs("section",{className:"conversation-turn",children:[q.visibleStartItems.map(Ue=>Le(Ue)),q.hiddenItems.length>0?l.jsxs("div",{className:"conversation-turn__history",children:[l.jsxs("button",{type:"button",className:`turn-history-toggle ${me?"is-expanded":""}`,onClick:()=>F(q.id),"aria-expanded":me,children:[l.jsx("span",{className:"turn-history-toggle__label",children:me?`收起前${q.hiddenItems.length}条消息`:`上${q.hiddenItems.length}条消息`}),l.jsx("span",{className:"turn-history-toggle__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?null:q.hiddenItems.map(Ue=>Le(Ue))]}):null,q.completion&&q.visibleEndItems.length>0?l.jsx("section",{className:"conversation-turn-complete",children:l.jsx("div",{className:"turn-complete-divider",children:l.jsx("span",{children:q.completion.durationLabel})})}):null,q.visibleEndItems.map(Ue=>Le(Ue)),Se&&Se.source==="app-server"&&Se.files.length>0?be(Se):null,q.completion&&q.visibleEndItems.length===0?l.jsx("section",{className:"conversation-turn-complete",children:l.jsx("div",{className:"turn-complete-divider",children:l.jsx("span",{children:q.completion.durationLabel})})}):null,Se&&Se.status==="completed"&&Se.files.length>0?V(Se):Ne?pe(`turn-summary:${q.id}`,Ne):null]},q.id)}):l.jsx("div",{className:"empty-panel",children:"这个会话还没有历史记录。"})}),Ek=({sessionId:n,embedded:t=!1,isDesktopSidebar:a,sidebarOffset:r=0,isSidebarDragging:c=!1,onOpenSidebar:u,onSelectSession:h,onExitToNodes:p}={})=>{var Gl,Oa,vc,Qr,Xa,hd,ns,Vl,Ws,_c,Gr,La,Kl,bc,Yl;const{sessionId:y}=Uu({strict:!1}),m=n??y??"",b=Mr(),g=Tl(),{data:x}=qu({queryKey:dt,scope:{sessionId:m}}),w=_.useRef(null),N=_.useRef(null),T=_.useRef(null),C=_.useRef(null),I=_.useRef(null),[$,H]=_.useState(!1),[R,Q]=_.useState(()=>typeof window<"u"&&window.innerWidth>=x2),[ce,Z]=_.useState(()=>Ck()),[ie,ee]=_.useState(!1),[Y,F]=_.useState(""),[_e,je]=_.useState([]),[ae,ue]=_.useState(null),[E,U]=_.useState(null),[te,W]=_.useState(null),[xe,A]=_.useState(()=>c0()),[ne,be]=_.useState(()=>jy()),[V,pe]=_.useState(()=>K6(m)),[Ce,Le]=_.useState(()=>Y6(m)),he=d0(),q=_.useMemo(()=>he.map(({id:S,...D})=>D),[he]),[Se,Ne]=_.useState({}),[me,Te]=_.useState(null),[Ge,Ue]=_.useState(!1),[gt,Lt]=_.useState(!1),[St,st]=_.useState(""),[tn,$t]=_.useState(!1),[de,Ae]=_.useState(!1),[Re,Oe]=_.useState(null),[Ke,mt]=_.useState(null),[kt,rn]=_.useState(!1),[Pn,On]=_.useState(!1),[nn,ln]=_.useState("code"),[oe,qe]=_.useState(!1),[De,Ie]=_.useState(null),[We,$e]=_.useState(null),[He,Ee]=_.useState(!1),[Ut,at]=_.useState(!1),[pn,Un]=_.useState(!1),[xn,ps]=_.useState(!1),[gs,is]=_.useState(null),[Ci,la]=_.useState(null),[Gs,rs]=_.useState({}),[xa,Vs]=_.useState(!1),[ls,j]=_.useState({state:"connected",attempt:0,maxAttempts:5}),z=_.useRef({});_.useEffect(()=>{bu(xe)},[xe]),_.useEffect(()=>{wy(ne)},[ne]),_.useEffect(()=>{q.length!==0&&(q.some(S=>S.value===xe)||A(q[0].value))},[q,xe]),_.useEffect(()=>{pe(K6(m)),Le(Y6(m)),W(null),ln("code"),qe(!1),Ie(null),$e(null),Ee(!1),at(!1),Un(!1),ps(!1),is(null),la(null),rs({})},[m]),_.useEffect(()=>{z.current=Gs},[Gs]),_.useEffect(()=>{ky(m,V)},[V,m]),_.useEffect(()=>{Ny(m,Ce)},[Ce,m]),_.useEffect(()=>{Ne({}),Te(null)},[m]),_.useEffect(()=>{if(!ae)return;const S=K=>{K.key==="Escape"&&ue(null)},D=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",S),()=>{document.body.style.overflow=D,window.removeEventListener("keydown",S)}},[ae]);const[ge,we]=_.useState(!1),ke=_.useRef(null),Ve=_.useRef(null),ct=_.useRef(null),Nt=_.useRef({}),qn=_.useRef({}),es=_.useRef(null),Ht=_.useRef(null),wn=_.useRef(null),kn=_.useRef(ce),Ln=_.useRef(null),un=_.useRef(null),B=x==null?void 0:x.sessions.find(S=>S.id===m),on=(x==null?void 0:x.agents.find(S=>S.id===(B==null?void 0:B.agent_id)))??(x==null?void 0:x.agents[0]),gn=x==null?void 0:x.projects.find(S=>S.id===(B==null?void 0:B.project_id)),yn=(B==null?void 0:B.capability.can_show_git)??!1,sn=(B==null?void 0:B.capability.can_show_terminal)??!1,Ft=_.useCallback(()=>Jn({sessionId:m,projectId:(B==null?void 0:B.project_id)??null,agentId:(B==null?void 0:B.agent_id)??null}),[B==null?void 0:B.agent_id,B==null?void 0:B.project_id,m]),Fa=_.useCallback(async S=>{if(t){h==null||h(S);return}window.localStorage.setItem(_2,S),await b({to:"/session/$sessionId",params:{sessionId:S}})},[t,b,h]),Rr=_.useCallback(async()=>{if(t){p==null||p();return}await b({to:"/nodes"})},[t,b,p]),Qu=S=>S instanceof Element&&!!S.closest('button, textarea, input, a, [role="dialog"]'),Sa=()=>{const S=T.current;if(!S)return;const D=()=>{S.scrollTo({top:S.scrollHeight,behavior:"auto"})};D(),window.requestAnimationFrame(()=>{D(),window.requestAnimationFrame(D)})},Rl=()=>{const S=T.current;if(!S){Vs(!1);return}const D=S.scrollHeight-S.scrollTop-S.clientHeight;Vs(D>Tw)},oa=_.useMemo(()=>((x==null?void 0:x.projects)??[]).filter(S=>S.agent_id===(on==null?void 0:on.id)),[on==null?void 0:on.id,x==null?void 0:x.projects]),$n=_.useMemo(()=>((x==null?void 0:x.sessions)??[]).filter(S=>S.agent_id===(on==null?void 0:on.id)).sort((S,D)=>Number(D.pinned)-Number(S.pinned)||+new Date(D.last_event_at)-+new Date(S.last_event_at)),[on==null?void 0:on.id,x==null?void 0:x.sessions]),dn=_.useMemo(()=>{var S;return(S=B==null?void 0:B.subagent)!=null&&S.parent_session_id?$n.find(D=>{var K;return D.id===((K=B.subagent)==null?void 0:K.parent_session_id)})??null:null},[(Gl=B==null?void 0:B.subagent)==null?void 0:Gl.parent_session_id,$n]),Qa=Es({queryKey:["timeline",m],enabled:!!m,queryFn:async()=>{const D=await(await Ft()).client.getSessionTimeline(m);return g.setQueryData(ir(m),K=>Cf(K,D)),bp(g.getQueryData(["timeline",m]),D)},initialData:m===(x==null?void 0:x.active_session_id)?x.timeline:void 0,refetchInterval:!1}),Ti=Es({queryKey:ir(m),enabled:!1,queryFn:async()=>[],initialData:[]}),Ga=Es({queryKey:["timeline",dn==null?void 0:dn.id,"prefix-source"],enabled:!!(dn!=null&&dn.id),queryFn:async()=>(await Jn({sessionId:dn.id,projectId:dn.project_id,agentId:dn.agent_id})).client.getSessionTimeline(dn.id),refetchInterval:!1}),ja=_.useMemo(()=>B!=null&&B.subagent?new Set:rk(Qa.data??[]),[B==null?void 0:B.subagent,Qa.data]),Xo=_.useMemo(()=>ik(Qa.data??[]),[Qa.data]),ts=_.useMemo(()=>B!=null&&B.subagent?[]:$n.filter(S=>{var D;return S.id!==m&&((D=S.subagent)==null?void 0:D.parent_session_id)===m&&!S.archived}).filter(S=>{if(S.run_state==="running")return!0;if(!((B==null?void 0:B.run_state)==="running"||tn))return!1;if(ja.has(S.id))return!0;if(!Xo)return!1;const D=new Date(Xo).getTime(),K=new Date(S.last_event_at).getTime();return Number.isFinite(D)&&Number.isFinite(K)&&K>=D-kw}).sort((S,D)=>+new Date(D.last_event_at)-+new Date(S.last_event_at)),[Xo,tn,ja,B==null?void 0:B.run_state,B==null?void 0:B.subagent,m,$n]),Jo=Es({queryKey:["change-sets",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionChangeSets(m),refetchInterval:!1}),Va=Es({queryKey:["session-git-workspace",m],enabled:!!(m&&yn&&nn==="git"),queryFn:async()=>(await Ft()).client.getSessionGitWorkspace(m),refetchInterval:!1}),ys=Es({queryKey:["session-git-history",m],enabled:!1,queryFn:async()=>(await Ft()).client.getSessionGitHistory(m),refetchInterval:!1}),Rs=Es({queryKey:["session-run-workbench",m],enabled:!!(m&&sn),queryFn:async()=>(await Ft()).client.getSessionRunWorkbench(m),refetchInterval:!1}),vs=Es({queryKey:["plan",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionPlan(m),refetchInterval:!1}),Al=Es({queryKey:["interactions",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionInteractions(m),refetchInterval:!1,initialData:[]}),ca=_.useCallback(async(S,D)=>{if(m){rs(K=>{var le,et,Ye;return{...K,[S]:{chunks:((le=K[S])==null?void 0:le.chunks)??[],nextCursor:((et=K[S])==null?void 0:et.nextCursor)??0,truncated:((Ye=K[S])==null?void 0:Ye.truncated)??!1,isLoading:!0,error:null}}});try{const K=await Ft(),le=z.current[S],et=await K.client.getSessionTerminalOutput({sessionId:m,terminalId:S,cursor:D!=null&&D.force||le!=null&&le.truncated||le==null?void 0:le.nextCursor});rs(Ye=>{const pt=Ye[S],ot=D!=null&&D.force||et.truncated||!pt?et.chunks:S2(pt.chunks,et.chunks);return{...Ye,[S]:{chunks:ot,nextCursor:et.next_cursor,truncated:et.truncated,isLoading:!1,error:null}}})}catch(K){rs(le=>{var et,Ye,pt;return{...le,[S]:{chunks:((et=le[S])==null?void 0:et.chunks)??[],nextCursor:((Ye=le[S])==null?void 0:Ye.nextCursor)??0,truncated:((pt=le[S])==null?void 0:pt.truncated)??!1,isLoading:!1,error:K instanceof Error?K.message:"无法读取终端输出。"}}})}}},[m]);_.useEffect(()=>{var le,et;const S=(le=Rs.data)==null?void 0:le.terminal_snapshot.active_terminal_id,D=(et=Rs.data)==null?void 0:et.terminal_snapshot.terminals.find(Ye=>Ye.id===S);if(!S||!D)return;const K=Gs[S];(!K||K.truncated||K.nextCursor<D.output_cursor)&&ca(S)},[ca,Rs.data,Gs]);const Gu=!!(B!=null&&B.subagent&&(dn!=null&&dn.id)&&Ga.isPending&&!Ga.data),wa=_.useMemo(()=>B!=null&&B.subagent?dn!=null&&dn.id&&Ga.isPending&&!Ga.data?[]:nk(Qa.data??[],Ga.data):Qa.data??[],[dn==null?void 0:dn.id,Ga.data,B==null?void 0:B.subagent,Qa.data]),Ar=_.useMemo(()=>qS(wa,Ti.data),[wa,Ti.data]);_.useEffect(()=>{m&&window.localStorage.setItem(_2,m)},[m]),_.useEffect(()=>{const S=ct.current;S&&((Ti.data??[]).some(D=>D.id===S.optimisticEntryId)||(ct.current=null))},[Ti.data]),_.useEffect(()=>{On(!1)},[m]),_.useEffect(()=>{st((B==null?void 0:B.title)??""),Lt(!1)},[B==null?void 0:B.title,m]),_.useEffect(()=>{Ae(!1)},[m]),_.useEffect(()=>()=>{ke.current&&window.clearTimeout(ke.current),Ve.current&&window.clearTimeout(Ve.current),un.current&&window.cancelAnimationFrame(un.current)},[]),_.useEffect(()=>{if(Ve.current&&(window.clearTimeout(Ve.current),Ve.current=null),!!E)return Ve.current=window.setTimeout(()=>{U(null),Ve.current=null},Ew),()=>{Ve.current&&(window.clearTimeout(Ve.current),Ve.current=null)}},[E]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(zy,String(Cp(ce))),window.localStorage.setItem(hu,mu)}catch{}},[ce]),_.useEffect(()=>{kn.current=ce},[ce]),_.useEffect(()=>{if(typeof window>"u")return;const S=()=>{const D=window.innerWidth>=x2;Q(D),D&&H(!1)};return S(),window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[]),_.useEffect(()=>{if(!ie)return;const S=K=>{const le=wn.current;if(!le)return;const et=K.clientX-le.startX,Ye=Cp(le.startWidth+et);Ln.current=Ye,un.current===null&&(un.current=window.requestAnimationFrame(()=>{un.current=null;const pt=Ln.current,ot=w.current;pt===null||!ot||ot.style.setProperty("--desktop-sidebar-width",`${pt}px`)}))},D=()=>{un.current!==null&&(window.cancelAnimationFrame(un.current),un.current=null);const K=Ln.current??kn.current;Ln.current=null,wn.current=null,ee(!1),kn.current=K,Z(K)};return window.addEventListener("pointermove",S),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)}},[ie]),_.useEffect(()=>{const S=D=>{const K=D.target;rn(!1),we(!1),!(K instanceof Element&&(K.closest(".conversation-topbar__actions")||K.closest(".conversation-topbar__title-actions")||K.closest(".picker-sheet")||K.closest(".picker-sheet-wrap")))&&(Ue(!1),Ee(!1),at(!1))};return window.addEventListener("pointerdown",S),()=>{window.removeEventListener("pointerdown",S)}},[]),_.useEffect(()=>{const S=w.current;if(!S||R)return;const D=Ye=>{if(Ye.touches.length!==1||Qu(Ye.target))return;const pt=Ye.touches[0];lc(pt.clientX,pt.clientY)},K=Ye=>{if(Ye.touches.length!==1||!Ht.current)return;const pt=Ye.touches[0];oc(pt.clientX,pt.clientY)&&Ye.preventDefault()},le=Ye=>{if(!Ht.current)return;const pt=Ye.changedTouches[0];if(!pt){Ht.current=null,Ra(null);return}Di(pt.clientX,pt.clientY)},et=()=>{Ht.current=null,Ra(null)};return S.addEventListener("touchstart",D,{passive:!0,capture:!0}),S.addEventListener("touchmove",K,{passive:!1,capture:!0}),S.addEventListener("touchend",le,{capture:!0}),S.addEventListener("touchcancel",et,{capture:!0}),()=>{S.removeEventListener("touchstart",D,{capture:!0}),S.removeEventListener("touchmove",K,{capture:!0}),S.removeEventListener("touchend",le,{capture:!0}),S.removeEventListener("touchcancel",et,{capture:!0})}},[R,$]),_.useEffect(()=>{if(!m)return;Sa();const S=window.setTimeout(Sa,120);return()=>{window.clearTimeout(S)}},[wa.length,m]),_.useEffect(()=>{const S=T.current;if(!S)return;const D=()=>{Rl()};return D(),S.addEventListener("scroll",D,{passive:!0}),window.addEventListener("resize",D),()=>{S.removeEventListener("scroll",D),window.removeEventListener("resize",D)}},[wa.length,m]),_.useEffect(()=>{let S=!1,D;return Ft().then(K=>{S||(D=K.client.connectEvents(le=>{var pt,ot,Fn,Bs,Ps,Xs,xc,Zl,Wl,Sc,Tn,Wt,jt,ha,os,Xl,ma;const et=typeof((pt=le.payload)==null?void 0:pt.sessionId)=="string"?le.payload.sessionId:null,Ye=et===m;if(le.type==="agent.online"||le.type==="snapshot.changed"){g.invalidateQueries({queryKey:dt});return}if(le.type==="timeline.reset"&&Ye){const it=Array.isArray((ot=le.payload)==null?void 0:ot.entries)?le.payload.entries:[];g.setQueryData(ir(m),wt=>Cf(wt,it)),g.setQueryData(["timeline",m],wt=>bp(wt,it));const Qt=(Fn=it[it.length-1])==null?void 0:Fn.timestamp;Qt&&g.setQueryData(dt,wt=>_p(wt,m,Qt)),Sa();return}if(le.type==="interaction.reset"&&Ye){const it=Array.isArray((Bs=le.payload)==null?void 0:Bs.requests)?le.payload.requests:[];g.setQueryData(["interactions",m],it),Oe(Qt=>Qt&&it.some(wt=>wt.id===Qt)?Qt:null);return}if(le.type==="plan.reset"&&Ye){const it=(Ps=le.payload)!=null&&Ps.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],it);return}if(le.type==="timeline.delta"&&Ye){const it=Array.isArray((Xs=le.payload)==null?void 0:Xs.entries)?le.payload.entries:[];g.setQueryData(ir(m),wt=>Cf(wt,it)),g.setQueryData(["timeline",m],wt=>hy(wt,it));const Qt=(xc=it[it.length-1])==null?void 0:xc.timestamp;Qt&&g.setQueryData(dt,wt=>_p(wt,m,Qt)),Sa();return}if(le.type==="interaction.delta"&&Ye){const it=Array.isArray((Zl=le.payload)==null?void 0:Zl.requests)?le.payload.requests:[],Qt=Array.isArray((Wl=le.payload)==null?void 0:Wl.resolvedRequestIds)?le.payload.resolvedRequestIds.filter(wt=>typeof wt=="string"&&wt.trim().length>0):[];g.setQueryData(["interactions",m],wt=>{const Ot=new Map((wt??[]).map(Gt=>[Gt.id,Gt]));for(const Gt of it)Ot.set(Gt.id,Gt);for(const Gt of Qt)Ot.delete(Gt);return[...Ot.values()].sort((Gt,cs)=>+new Date(cs.updated_at)-+new Date(Gt.updated_at))}),Qt.length>0&&Oe(wt=>wt&&Qt.includes(wt)?null:wt);return}if(le.type==="plan.delta"&&Ye){const it=(Sc=le.payload)!=null&&Sc.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],it);return}if(le.type==="changeset.reset"&&Ye){const it=Array.isArray((Tn=le.payload)==null?void 0:Tn.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],it);return}if(le.type==="changeset.delta"&&Ye){const it=Array.isArray((Wt=le.payload)==null?void 0:Wt.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],Qt=>{const wt=new Map((Qt??[]).map(Ot=>[Ot.id,Ot]));for(const Ot of it)wt.set(Ot.id,Ot);return[...wt.values()].sort((Ot,Gt)=>+new Date(Ot.started_at)-+new Date(Gt.started_at))});return}if(le.type==="terminal.snapshot"&&Ye){const it=(jt=le.payload)!=null&&jt.snapshot&&typeof le.payload.snapshot=="object"?le.payload.snapshot:null;if(!it)return;g.setQueryData(["session-run-workbench",m],Qt=>Qt&&{...Qt,terminal_snapshot:it}),rs(Qt=>{const wt=new Set(it.terminals.map(Gt=>Gt.id)),Ot={};for(const[Gt,cs]of Object.entries(Qt))wt.has(Gt)&&(Ot[Gt]=cs);return Ot});return}if(le.type==="terminal.delta"&&Ye){const it=(ha=le.payload)!=null&&ha.terminal&&typeof le.payload.terminal=="object"?le.payload.terminal:null,Qt=Array.isArray((os=le.payload)==null?void 0:os.chunks)?le.payload.chunks:[],wt=typeof((Xl=le.payload)==null?void 0:Xl.activeTerminalId)=="string"?le.payload.activeTerminalId:null;if(!it)return;g.setQueryData(["session-run-workbench",m],Ot=>{if(!Ot)return Ot;const Gt=Ot.terminal_snapshot.terminals.filter(pa=>pa.id!==it.id),cs=Ot.terminal_snapshot.terminals.findIndex(pa=>pa.id===it.id),Vr=[...Gt];return cs<=0?Vr.unshift(it):Vr.splice(cs,0,it),{...Ot,terminal_snapshot:{...Ot.terminal_snapshot,active_terminal_id:wt,updated_at:it.updated_at,terminals:Vr}}}),rs(Ot=>{var cs;if(Qt.length===0)return Ot;const Gt=Ot[it.id];return{...Ot,[it.id]:{chunks:S2((Gt==null?void 0:Gt.chunks)??[],Qt),nextCursor:typeof((cs=le.payload)==null?void 0:cs.nextCursor)=="number"?le.payload.nextCursor:it.output_cursor,truncated:(Gt==null?void 0:Gt.truncated)??!1,isLoading:!1,error:null}}});return}if(le.type==="session.updated"&&et){const it=(ma=le.payload)!=null&&ma.sessionPatch&&typeof le.payload.sessionPatch=="object"?le.payload.sessionPatch:null,Qt=g.getQueryData(dt);it&&a0(Qt,et)?g.setQueryData(dt,wt=>Nf(wt,et,it)):g.invalidateQueries({queryKey:dt}),Ye&&((it==null?void 0:it.run_state)==="running"||(it==null?void 0:it.run_state)==="completed"||(it==null?void 0:it.run_state)==="idle")&&($t(it.run_state==="running"),it.run_state!=="running"&&Ae(!1));return}le.type==="turn.completed"&&Ye&&($t(!1),Ae(!1),g.setQueryData(["plan",m],null))},{sessionId:m,onStatus:le=>{j(le),le.state==="connected"&&we(!1)}}))}),()=>{S=!0,D==null||D()}},[g,Ft,m]),_.useEffect(()=>{if(!m||(B==null?void 0:B.run_state)!=="running"||B.context_usage)return;let S=!1;const D=window.setTimeout(()=>{S||g.invalidateQueries({queryKey:dt})},1200);return()=>{S=!0,window.clearTimeout(D)}},[g,m,B==null?void 0:B.context_usage,B==null?void 0:B.run_state]),_.useEffect(()=>{Ue(!1)},[R,m]);const Dl=_.useCallback(S=>{var D;W(S),((D=S.effect)==null?void 0:D.type)==="set_session_model"&&(A(S.effect.model),S.effect.reasoning_effort&&be(S.effect.reasoning_effort))},[]),ka=Vn({mutationFn:async S=>(await Ft()).client.sendSessionInput(S),onMutate:async S=>{await g.cancelQueries({queryKey:["timeline",S.sessionId]}),U(null),Ae(!1),$t(!0),Te(S.proposedPlanEntryId??null);const D=S.clearComposer!==!1;D&&(F(""),je([])),ke.current&&window.clearTimeout(ke.current);const K=new Date().toISOString(),le=`${i0}${S.sessionId}:${Date.now()}`;ct.current=D?{optimisticEntryId:le,draft:S.input,attachments:S.attachments}:null,g.setQueryData(ir(S.sessionId),et=>fy(et,{id:le,kind:"user",title:"你",body:S.input,timestamp:K,accent:"primary",attachments:Ey(S.attachments)})),g.setQueryData(dt,et=>{var Ye;return Nf(et,S.sessionId,{run_state:"running",run_state_changed_at:K,last_event_at:K,summary:S.input||((Ye=S.attachments[0])==null?void 0:Ye.name)||"附件"})})},onSuccess:async(S,D)=>{Te(null),D.proposedPlanEntryId&&Ne(K=>{const le={...K};return delete le[D.proposedPlanEntryId],le}),await g.invalidateQueries({queryKey:dt}),await g.invalidateQueries({queryKey:["plan",D.sessionId]}),await g.invalidateQueries({queryKey:["change-sets",D.sessionId]}),ke.current=null},onError:(S,D)=>{Te(null),$t(!1);const K=ct.current;K&&(g.setQueryData(ir(D.sessionId),le=>$S(le,K.optimisticEntryId)),F(le=>le||K.draft),je(le=>le.length>0?le:K.attachments),ct.current=null),U(S instanceof Error?S.message:"无法发送消息")}}),Ol=Vn({mutationFn:async S=>(await Ft()).client.executeSessionCommand(S),onMutate:S=>{U(null),F(""),je([]);const D=S.input.slice(1).trim().split(/\s+/)[0]??"",K=new Date().toISOString();W({panel_id:`command-panel-pending-${Date.now()}`,session_id:S.sessionId,command_name:D,command_text:S.input,title:`正在执行 /${D}`,description:null,status:"running",body:"命令执行中…",submitted_at:K,updated_at:K,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null})},onSuccess:async S=>{Dl(S.panel),await g.invalidateQueries({queryKey:dt})},onError:(S,D)=>{W(null),F(K=>K||D.input),U(S instanceof Error?S.message:"无法执行命令")}}),ua=Vn({mutationFn:async S=>(await Ft()).client.respondToSessionCommand(S),onMutate:()=>{U(null)},onSuccess:async S=>{Dl(S.panel),await g.invalidateQueries({queryKey:dt})},onError:S=>{U(S instanceof Error?S.message:"无法继续执行命令")}}),Ks=Vn({mutationFn:async S=>(await Ft()).client.respondToSessionInteraction(S),onMutate:async S=>{U(null),Oe(S.requestId),g.setQueryData(["interactions",S.sessionId],D=>(D??[]).map(K=>K.id===S.requestId?{...K,status:"submitting",updated_at:new Date().toISOString()}:K))},onSuccess:async(S,D)=>{await g.invalidateQueries({queryKey:["interactions",D.sessionId]})},onError:(S,D)=>{g.setQueryData(["interactions",D.sessionId],K=>(K??[]).map(le=>le.id===D.requestId?{...le,status:"pending"}:le)),Oe(null),U(S instanceof Error?S.message:"无法提交确认回复")}}),As=Vn({mutationFn:async S=>(await Ft()).client.interruptSession(S),onMutate:async S=>{U(null),Ae(!0),$t(!1),ke.current&&(window.clearTimeout(ke.current),ke.current=null);const D=new Date().toISOString(),K=g.getQueryData(dt);return g.setQueryData(dt,le=>Nf(le,S,{run_state:"completed",run_state_changed_at:D,last_event_at:D})),g.setQueryData(["plan",S],null),{previousSnapshot:K,targetSessionId:S}},onSuccess:(S,D)=>{Ae(!1),g.invalidateQueries({queryKey:dt}),g.invalidateQueries({queryKey:["timeline",D]}),g.invalidateQueries({queryKey:["change-sets",D]})},onError:(S,D,K)=>{Ae(!1),$t(!0),K!=null&&K.previousSnapshot&&g.setQueryData(dt,K.previousSnapshot),g.invalidateQueries({queryKey:["plan",D]}),U(S instanceof Error?S.message:"无法中断会话")}});_.useEffect(()=>{!m||!B||de||As.isPending||$t(B.run_state==="running")},[As.isPending,de,B,B==null?void 0:B.run_state,m]);const fn=Vn({mutationFn:async S=>(await Jn({sessionId:S.sessionId})).client.updateSession(S)}),da=Vn({mutationFn:async S=>(await Jn({projectId:S.projectId})).client.updateThread(S)}),Nn=Vn({mutationFn:async S=>(await Ft()).client.executeSessionGitAction({sessionId:m,action:S.action,path:S.path,branch:S.branch,message:S.message}),onMutate:async()=>{Ie(null)},onSuccess:(S,D)=>{g.setQueryData(["session-git-workspace",m],S.workspace),(D.action==="commit-all"||D.action==="switch-branch")&&g.invalidateQueries({queryKey:["session-git-history",m]})},onError:S=>{Ie(S instanceof Error?S.message:"无法执行 git 操作")}}),Ys=Vn({mutationFn:async S=>(await Ft()).client.saveSessionRunCommand({sessionId:m,action:S.action,commandId:S.commandId,command:S.command}),onMutate:()=>{$e(null)},onSuccess:({catalog:S})=>{g.setQueryData(["session-run-workbench",m],D=>D&&{...D,command_catalog:S})},onError:S=>{$e(S instanceof Error?S.message:"无法保存项目命令。")}}),Ds=Vn({mutationFn:async S=>(await Ft()).client.saveSessionRunWebsite({sessionId:m,action:S.action,websiteId:S.websiteId,website:S.website}),onMutate:()=>{$e(null)},onSuccess:({catalog:S})=>{g.setQueryData(["session-run-workbench",m],D=>D&&{...D,website_catalog:S})},onError:S=>{$e(S instanceof Error?S.message:"无法保存项目网页。")}}),Dr=Vn({mutationFn:async()=>(await Ft()).client.generateSessionRunCommand({sessionId:m,prompt:"",model:Tf()}),onMutate:()=>{$e(null),is(null)},onSuccess:({generation:S,catalog:D})=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,command_catalog:D}),is(S.reason)},onError:S=>{$e(S instanceof Error?S.message:"无法一键生成项目命令。")}}),Na=Vn({mutationFn:async()=>(await Ft()).client.generateSessionRunWebsite({sessionId:m,prompt:"",model:Tf()}),onMutate:()=>{$e(null),la(null)},onSuccess:({generation:S,catalog:D})=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,website_catalog:D}),la(S.reason)},onError:S=>{$e(S instanceof Error?S.message:"无法一键生成项目网页。")}}),Zt=Vn({mutationFn:async S=>(await Ft()).client.executeSessionTerminalAction({sessionId:m,action:S.action,commandId:S.commandId,terminalId:S.terminalId}),onMutate:()=>{$e(null)},onSuccess:async(S,D)=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,terminal_snapshot:S.snapshot}),(D.action==="run-command"||D.action==="run-kill-command")&&S.terminal&&(Ee(!1),ln("terminal"),await ca(S.terminal.id,{force:!0})),D.action==="focus"&&D.terminalId&&await ca(D.terminalId),D.action==="close"&&D.terminalId&&rs(K=>{const le={...K};return delete le[D.terminalId],le})},onError:S=>{$e(S instanceof Error?S.message:"无法执行终端操作。")}}),Ei=Jo.data??[],Mi=B?xk(B):!1,Os=_.useMemo(()=>Sk(Ar,{projectPath:gn==null?void 0:gn.path,compactCompletedTurns:Mi}),[Mi,gn==null?void 0:gn.path,Ar]),Or=_.useMemo(()=>kk(Os.blocks,Ei),[Os.blocks,Ei]),fa=[...Or].reverse().find(S=>S.kind==="turn"&&!S.turn.completion)??null;if(_.useEffect(()=>{var le;if(typeof window>"u")return;const S=window,D=(le=S.requestIdleCallback)==null?void 0:le.call(S,()=>{kp()},{timeout:1500}),K=D===void 0?window.setTimeout(()=>{kp()},320):null;return()=>{var et;D!==void 0&&((et=S.cancelIdleCallback)==null||et.call(S,D)),K!==null&&window.clearTimeout(K)}},[]),!x||!B||!gn)return l.jsx("div",{className:"conversation-page",children:l.jsx("div",{className:"conversation-main conversation-main--empty",children:l.jsx("div",{className:"empty-panel",children:"没有找到这个会话。"})})});const ec=B.capability.can_send_input&&!de,Ka=(Al.data??[]).filter(S=>S.status==="pending"||S.status==="submitting"),Lr=(B.run_state==="running"||tn)&&!de||As.isPending,Ir=ec&&Ka.length===0&&!Lr&&!ka.isPending,Hn=(on==null?void 0:on.id)??B.agent_id,Ca=_.useCallback((S,D)=>{Ne(K=>{if(!D.trim()){if(!(S in K))return K;const le={...K};return delete le[S],le}return{...K,[S]:D}})},[]),zr=_.useCallback((S,D)=>{const K=D.trim();!K||!Ir||ka.mutate({sessionId:B.id,input:K,attachments:[],model:xe,reasoningEffort:ne,serviceTier:V?"fast":void 0,planMode:Ce,clearComposer:!1,proposedPlanEntryId:S})},[Ir,V,Ce,xe,ne,ka,B.id]),Br=_.useMemo(()=>l.jsx(Tk,{sessions:x.sessions,sessionRunState:B.run_state,projectPath:gn.path,renderedBlocks:Or,lastToolGroupId:Os.lastToolGroupId,sessionChangeSets:Ei,isSubagentTimelinePending:Gu,hasTimeline:Ar.length>0,proposedPlanReplyDrafts:Se,pendingProposedPlanReplyEntryId:me,canRespondToProposedPlan:Ir,onProposedPlanReplyDraftChange:Ca,onSubmitProposedPlanReply:zr,onPreviewImage:ue},B.id),[Ir,Ca,zr,Gu,me,gn.path,Se,Or,Os.lastToolGroupId,B.id,B.run_state,Ei,x.sessions,Ar.length]),Ya=_.useCallback(async(S,D,K)=>{var et;U(null),Ue(!1);const le=g.getQueryData(dt);D==="pin"||D==="unpin"?or.flushSync(()=>{g.setQueryData(dt,Ye=>Kf(Ye,S,{pinned:D==="pin"}))}):D==="rename"&&(K!=null&&K.trim())&&g.setQueryData(dt,Ye=>Kf(Ye,S,{title:K.trim()}));try{const Ye=await fn.mutateAsync({sessionId:S,action:D,name:K}),pt=(et=Ye.affectedSessionIds)!=null&&et.length?Ye.affectedSessionIds:[S];if(D==="delete"){g.setQueryData(dt,ot=>ay(ot,pt));for(const ot of pt)g.removeQueries({queryKey:["timeline",ot],exact:!0}),g.removeQueries({queryKey:ir(ot),exact:!0}),g.removeQueries({queryKey:["change-sets",ot],exact:!0})}else g.setQueryData(dt,ot=>sy(ot,pt,{...D==="rename"&&(K!=null&&K.trim())?{title:K.trim()}:{pinned:D==="pin"}}));if(S===B.id&&D==="delete"){const ot=Ye.nextSessionId;ot?await Fa(ot):await Rr()}}catch(Ye){g.setQueryData(dt,le),U(Ye instanceof Error?Ye.message:"无法更新会话")}},[Rr,Fa,g,B.id,fn]),tc=_.useCallback(async(S,D,K)=>{var Ye,pt;U(null),Ue(!1);const le=g.getQueryData(dt),et=(Ye=K==null?void 0:K.name)==null?void 0:Ye.trim();D==="pin"||D==="unpin"?or.flushSync(()=>{g.setQueryData(dt,ot=>Yf(ot,S,{pinned:D==="pin"}))}):D==="rename"&&et?g.setQueryData(dt,ot=>Yf(ot,S,{display_name:et})):D==="reorder"&&((pt=K==null?void 0:K.orderedProjectIds)!=null&&pt.length)?g.setQueryData(dt,ot=>iy(ot,K.orderedProjectIds??[])):D==="remove"||D==="archive"?g.setQueryData(dt,ot=>ry(ot,S)):D==="unarchive"&&g.setQueryData(dt,ot=>ot&&{...ot,sessions:ot.sessions.map(Fn=>Fn.project_id===S?{...Fn,archived:!1}:Fn)});try{const ot=await da.mutateAsync({projectId:S,action:D,name:K==null?void 0:K.name,orderedProjectIds:K==null?void 0:K.orderedProjectIds});if(D==="remove"||D==="archive"||D==="unarchive"){const Fn=ot.nextSessionId;Fn?await Fa(Fn):await Rr()}}catch(ot){g.setQueryData(dt,le),U(ot instanceof Error?ot.message:"无法更新线程")}},[Rr,Fa,g,da]),nc=_.useCallback(async S=>{Hn&&(xr(Hn),fs(null),Ru(null),Eo(S),await b({to:"/"}))},[Hn,b]),Pr=((Oa=vs.data)==null?void 0:Oa.steps.some(S=>S.status==="pending"||S.status==="in_progress"))??!1,Ta=B.run_state==="running"||tn,Vu=!!((vc=vs.data)!=null&&vc.updated_at&&Date.now()-new Date(vs.data.updated_at).getTime()<=ww),ch=vs.data&&(Pr||Ta&&Vu)?vs.data:null,Ll=Math.max(0,ja.size-ts.length),Ls=B.context_usage,Il=Ls?Math.round(Ls.percent_used):0,uh=Math.max(0,100-Il),dh=Ls?{"--usage-progress":`${Math.max(0,Math.min(100,Ls.percent_used))}%`}:void 0,fh=ls.state==="connected"&&Ta&&!de&&!As.isPending&&!(fa!=null&&fa.turn.completion),hh=!!dn||ts.length>0;_.useEffect(()=>{m&&(qn.current[m]={planAt:0,backgroundAgentsAt:0})},[m]),_.useEffect(()=>{if(!m)return;const S=qn.current[m]??(qn.current[m]={planAt:0,backgroundAgentsAt:0});vs.data&&(S.planAt=0),Ll<=0&&(S.backgroundAgentsAt=0)},[Ll,vs.data,m]),_.useEffect(()=>{if(!Re)return;(Al.data??[]).some(D=>D.id===Re&&D.status==="submitting")||Oe(null)},[Al.data,Re]),_.useEffect(()=>{var S;!m||!B||B.run_state==="running"||ka.isPending||As.isPending||fa||(S=vs.data)!=null&&S.is_active||(ke.current&&(window.clearTimeout(ke.current),ke.current=null),$t(!1))},[fa,As.isPending,(Qr=vs.data)==null?void 0:Qr.is_active,ka.isPending,B,B==null?void 0:B.run_state,m]),_.useEffect(()=>{var le;if(!m||!B||ls.state!=="connected"||B.run_state!=="running")return;const S=((le=wa[wa.length-1])==null?void 0:le.timestamp)??B.last_event_at;if(!S||Date.now()-new Date(S).getTime()<2500||Nt.current[m]===S)return;Nt.current[m]=S;const K=window.setTimeout(()=>{g.invalidateQueries({queryKey:dt})},900);return()=>{window.clearTimeout(K)}},[ls.state,wa,g,B,B==null?void 0:B.last_event_at,B==null?void 0:B.run_state,m]),_.useEffect(()=>{if(!m||!B||ls.state!=="connected"||!Ta)return;const S=qn.current[m]??(qn.current[m]={planAt:0,backgroundAgentsAt:0}),D=Ta&&!vs.data,K=!B.subagent&&ja.size>0&&Ll>0;if(!D&&!K)return;const le=window.setTimeout(()=>{const et=Date.now();D&&et-S.planAt>=b2&&(S.planAt=et,g.invalidateQueries({queryKey:["plan",m]})),K&&et-S.backgroundAgentsAt>=b2&&(S.backgroundAgentsAt=et,g.invalidateQueries({queryKey:dt}))},160);return()=>{window.clearTimeout(le)}},[fa,ls.state,Ta,Ll,ja.size,vs.data,g,B,B==null?void 0:B.subagent,m]);const Is=R?0:Nk(),Ku=R||$,Yu=R?0:Ke??($?Is:0),mh=gt&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{Lt(!1),st(B.title)},"aria-label":"关闭重命名会话面板"}),l.jsx("div",{className:"sheet-wrap__center",children:l.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[l.jsx("div",{className:"sheet-panel__title",children:"重命名会话"}),l.jsx("input",{className:"sheet-panel__input",value:St,onChange:S=>st(S.target.value),placeholder:"输入会话名称",autoFocus:!0}),l.jsxs("div",{className:"sheet-panel__actions",children:[l.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{Lt(!1),st(B.title)},children:"取消"}),l.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!St.trim()||fn.isPending&&((Xa=fn.variables)==null?void 0:Xa.sessionId)===B.id,onClick:()=>{Ya(B.id,"rename",St.trim()),Lt(!1)},children:"保存"})]})]})})]}),document.body):null,ph=!(t?a:R)&&Ge&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"picker-sheet-wrap",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"picker-sheet__scrim",onClick:()=>Ue(!1),"aria-label":"关闭会话操作菜单"}),l.jsxs("div",{className:"picker-sheet",children:[l.jsx("div",{className:"picker-sheet__header",children:l.jsx("strong",{children:B.title})}),l.jsxs("div",{className:"picker-sheet__list",children:[l.jsx("button",{type:"button",className:"picker-sheet__item",disabled:fn.isPending&&((hd=fn.variables)==null?void 0:hd.sessionId)===B.id,onClick:()=>void Ya(B.id,B.pinned?"unpin":"pin"),children:l.jsx("span",{children:B.pinned?"取消置顶会话":"置顶会话"})}),l.jsx("button",{type:"button",className:"picker-sheet__item",disabled:fn.isPending&&((ns=fn.variables)==null?void 0:ns.sessionId)===B.id,onClick:()=>{Ue(!1),Lt(!0)},children:l.jsx("span",{children:"重命名会话"})}),l.jsx("button",{type:"button",className:"picker-sheet__item is-danger",disabled:fn.isPending&&((Vl=fn.variables)==null?void 0:Vl.sessionId)===B.id,onClick:()=>void Ya(B.id,"delete"),children:l.jsx("span",{children:"删除会话"})})]})]})]}),document.body):null,gh=R?1:Is>0?Yu/Is:0,zl=!R&&Ke!==null,yh=R?{"--desktop-sidebar-width":`${ce}px`}:void 0,Kn=t?!!a:R,sc=t?r:Yu,Bl=t?c:zl,vh=Nn.isPending?Nn.variables??null:null,_h=De??(Va.error instanceof Error?Va.error.message:null),bh=ys.error instanceof Error?ys.error.message:null,Pl=We??(Rs.error instanceof Error?Rs.error.message:null),_s=Rs.data??null,Zs=(_s==null?void 0:_s.terminal_snapshot)??null,Za=(_s==null?void 0:_s.command_catalog.commands)??[],Zu=(_s==null?void 0:_s.website_catalog.websites)??[],ac=Zf(Tf(),q),Ur=(Zs==null?void 0:Zs.terminals.find(S=>S.id===Zs.active_terminal_id))??(Zs==null?void 0:Zs.terminals[0])??null,Ea=sn&&nn==="terminal",ic=yn&&nn==="git",Ma=Kn&&Ea&&oe,Wu=ic&&Kn,Ri=(Ea||ic)&&Kn&&!Ma,Xu=(Ea||ic)&&!Kn,rc=Zt.isPending&&((Ws=Zt.variables)==null?void 0:Ws.action)==="run-command"?Zt.variables.commandId??null:null,Ai=Zt.isPending&&((_c=Zt.variables)==null?void 0:_c.action)==="run-kill-command"?Zt.variables.commandId??null:null,Ju=Ys.isPending&&((Gr=Ys.variables)==null?void 0:Gr.action)==="delete"?Ys.variables.commandId??null:null,ed=Ds.isPending&&((La=Ds.variables)==null?void 0:La.action)==="delete"?Ds.variables.websiteId??null:null;_.useEffect(()=>{!Kn&&oe&&qe(!1)},[oe,Kn]);const Ra=S=>{es.current=S,mt(S)},lc=(S,D,K)=>(Ht.current={mode:$?"close":"open",startX:S,startY:D,axis:"pending",pointerId:K},!0),oc=(S,D)=>{const K=Ht.current;if(!K)return!1;const le=S-K.startX,et=D-K.startY;if(K.axis==="pending"){if(Math.abs(le)<8&&Math.abs(et)<8)return!1;if(K.axis=Math.abs(le)>Math.abs(et)?"x":"y",K.axis==="y")return Ht.current=null,Ra(null),!1}const Ye=K.mode==="open"?Math.max(0,Math.min(Is,le)):Math.max(0,Math.min(Is,Is+le));return Ra(Ye),!0},Di=(S,D)=>{const K=Ht.current;if(!K)return;const le=S-K.startX,et=D-K.startY;if(K.axis==="pending"&&Math.abs(et)>48){Ht.current=null,Ra(null);return}const pt=(K.axis==="x"?es.current??(K.mode==="open"?Math.max(0,Math.min(Is,le)):Math.max(0,Math.min(Is,Is+le))):$?Is:0)>=Is*xw;H(pt),Ht.current=null,Ra(null)},Oi=_.useCallback(()=>{if(t){u==null||u();return}H(!0)},[t,u]),xh=_.useCallback(()=>{we(S=>!S)},[]),Ul=_.useCallback(()=>{U(null)},[]),td=_.useCallback(()=>{On(S=>!S)},[]),nd=_.useCallback(S=>{Fa(S)},[Fa]),ql=_.useCallback(S=>{const D=new Date().toISOString();if(q.length===0){W({panel_id:`${B1}${Date.now()}`,session_id:B.id,command_name:"model",command_text:S,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:D,updated_at:D,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}W({panel_id:`${B1}${Date.now()}`,session_id:B.id,command_name:"model",command_text:S,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:D,updated_at:D,input_type:"choice",options:q.map(K=>({id:K.value,label:K.label,description:K.description??null})),input_placeholder:null,submit_label:null,effect:null})},[q,B.id]),cc=_.useCallback(()=>{if(u0(Y)){if(_e.length>0){U("命令暂不支持附件,请先移除附件后再执行。");return}if(Gw(Y)==="model"){U(null),F(""),ql(Y);return}Ol.mutate({sessionId:B.id,input:Y});return}ka.mutate({sessionId:B.id,input:Y.trim(),attachments:_e,model:xe,reasoningEffort:ne,serviceTier:V?"fast":void 0,planMode:Ce})},[Y,V,Ce,Ol,ql,_e,xe,ne,ka,B.id]),sd=_.useCallback(()=>{W(null)},[]),ad=_.useCallback(S=>{if(te){if(te.panel_id.startsWith(B1)){A(S),W(D=>D&&{...D,status:"completed",body:`后续消息将优先使用 ${Zf(S,q)}。`,updated_at:new Date().toISOString(),input_type:"none",options:[]});return}ua.mutate({sessionId:B.id,panelId:te.panel_id,optionId:S})}},[te,ua,q,B.id]),id=_.useCallback(S=>{te&&ua.mutate({sessionId:B.id,panelId:te.panel_id,text:S})},[te,ua,B.id]),Sh=_.useCallback(S=>{Ks.mutate({sessionId:B.id,requestId:S.requestId,optionId:S.optionId??null,text:S.text??null,answers:S.answers})},[Ks,B.id]),jh=_.useCallback(S=>{const D=[...S];D.length!==0&&(U(null),Promise.all(D.map(K=>Ty(K))).then(K=>{je(le=>[...le,...K])}).catch(K=>{U(K instanceof Error?K.message:"无法读取附件")}))},[]),wh=_.useCallback(S=>{je(D=>D.filter(K=>K.id!==S))},[]),kh=_.useCallback(()=>{As.isPending||de||As.mutate(B.id)},[As,de,B.id]),Nh=_.useCallback(()=>{rn(S=>!S)},[]),Cn=_.useCallback(S=>{S==="git"&&!yn||S==="terminal"&&!sn||(Ie(null),$e(null),Ee(!1),at(!1),qe(!1),ln(S))},[yn,sn]);_.useEffect(()=>{if(!Ri)return;const S=D=>{var le,et;const K=D.target;K instanceof Node&&((le=C.current)!=null&&le.contains(K)||(et=I.current)!=null&&et.contains(K)||Cn("code"))};return window.addEventListener("pointerdown",S),()=>{window.removeEventListener("pointerdown",S)}},[Cn,Ri]);const qr=_.useCallback(()=>{Ie(null),Va.refetch()},[Va]),rd=_.useCallback(()=>{ys.refetch()},[ys]),ld=_.useCallback(()=>{ys.data||ys.isFetching||ys.refetch()},[ys]),od=_.useCallback(S=>{Nn.mutate({action:"discard-file",path:S})},[Nn]),cd=_.useCallback(()=>{Nn.mutate({action:"discard-all"})},[Nn]),uc=_.useCallback(S=>{Nn.mutate({action:"commit-all",message:S})},[Nn]),Ch=_.useCallback(async(S,D)=>{Ie(null);const K=(D==null?void 0:D.trim())??"";K&&await Nn.mutateAsync({action:"commit-all",message:K}),await Nn.mutateAsync({action:"switch-branch",branch:S})},[Nn]),Li=_.useCallback(()=>{Nn.mutate({action:"push"})},[Nn]),dc=_.useCallback(async(S,D,K)=>(await Ft()).client.getSessionGitHistoryFileDiff(B.id,{commitOid:S,path:D,previousPath:K}),[Ft,B.id]),$r=_.useCallback(async(S,D)=>(await Ft()).client.getSessionGitWorkspaceFileDiff(B.id,{path:S,previousPath:D}),[Ft,B.id]),$l=_.useCallback(S=>{Zt.mutate({action:"run-command",commandId:S})},[Zt]),fc=_.useCallback(async()=>{if(!(Za.length===0||pn||xn)){Un(!0);try{for(const S of Za)await Zt.mutateAsync({action:"run-command",commandId:S.id})}finally{Un(!1)}}},[pn,xn,Za,Zt]),Aa=_.useCallback(async()=>{if(pn||xn)return;const S=Za.filter(D=>!!D.kill_command);if(S.length!==0){ps(!0);try{for(const D of S)await Zt.mutateAsync({action:"run-kill-command",commandId:D.id})}finally{ps(!1)}}},[pn,xn,Za,Zt]),Ii=_.useCallback(S=>{Zt.mutate({action:"run-kill-command",commandId:S})},[Zt]),Hl=_.useCallback(S=>{Ys.mutate({action:S.commandId?"update":"create",commandId:S.commandId,command:S.draft})},[Ys]),hc=_.useCallback(S=>{Ys.mutate({action:"delete",commandId:S})},[Ys]),Da=_.useCallback(()=>{Dr.mutate()},[Dr]),mc=_.useCallback(S=>{Ds.mutate({action:S.websiteId?"update":"create",websiteId:S.websiteId,website:S.draft})},[Ds]),pc=_.useCallback(S=>{Ds.mutate({action:"delete",websiteId:S})},[Ds]),gc=_.useCallback(()=>{Na.mutate()},[Na]),ud=_.useCallback(()=>{at(!1)},[]),Th=_.useCallback(S=>{Zt.mutate({action:"focus",terminalId:S}),ln("terminal")},[Zt]),Eh=_.useCallback(S=>{Zt.mutate({action:"close",terminalId:S})},[Zt]),dd=_.useCallback(()=>{!Kn||!sn||(ln("terminal"),qe(S=>!S))},[sn,Kn]),yc=_.useMemo(()=>{var S,D,K;return l.jsxs("div",{className:"conversation-topbar__title-actions",children:[l.jsx("button",{type:"button",className:"conversation-topbar__more",onClick:()=>Ue(le=>!le),"aria-label":"更多会话选项",children:l.jsx(Mw,{})}),Ge&&Kn?l.jsxs("div",{className:"topbar-menu",role:"menu",children:[l.jsx("button",{type:"button",className:"topbar-menu__item",disabled:fn.isPending&&((S=fn.variables)==null?void 0:S.sessionId)===B.id,onClick:()=>void Ya(B.id,B.pinned?"unpin":"pin"),children:B.pinned?"取消置顶会话":"置顶会话"}),l.jsx("button",{type:"button",className:"topbar-menu__item",disabled:fn.isPending&&((D=fn.variables)==null?void 0:D.sessionId)===B.id,onClick:()=>{Ue(!1),Lt(!0)},children:"重命名会话"}),l.jsx("button",{type:"button",className:"topbar-menu__item is-danger",disabled:fn.isPending&&((K=fn.variables)==null?void 0:K.sessionId)===B.id,onClick:()=>void Ya(B.id,"delete"),children:"删除会话"})]}):null]})},[Ya,Ge,Kn,B.id,B.pinned,fn.isPending,(Kl=fn.variables)==null?void 0:Kl.sessionId]),Fl=_.useMemo(()=>sn||yn?l.jsxs("div",{className:"conversation-topbar__actions",children:[sn?l.jsxs("div",{className:"conversation-topbar__run-group",children:[l.jsx("button",{type:"button",className:`conversation-topbar__run-button ${He?"is-active":""}`,onClick:()=>{at(!1),Ee(S=>!S)},"aria-expanded":He,"aria-haspopup":"dialog","aria-label":"打开项目命令列表",children:l.jsx(zw,{})}),He?l.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目命令列表",children:l.jsx(aw,{commands:Za,nodeRuntime:(_s==null?void 0:_s.node_runtime)??null,error:Pl,pendingRunCommandId:rc,pendingKillCommandId:Ai,pendingDeleteCommandId:Ju,isSaving:Ys.isPending,isGenerating:Dr.isPending,isStartingAll:pn,isStoppingAll:xn,generationReason:gs,executionModelLabel:ac,onRun:$l,onRunAll:fc,onRunAllKill:Aa,onRunKill:Ii,onSave:Hl,onDelete:hc,onGenerate:Da})}):null]}):null,sn?l.jsxs("div",{className:"conversation-topbar__run-group",children:[l.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Ut?"is-active":""}`,onClick:()=>{Ee(!1),at(S=>!S)},"aria-expanded":Ut,"aria-haspopup":"dialog","aria-label":"打开项目网页列表",children:l.jsx(Bw,{})}),Ut?l.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目网页列表",children:l.jsx(uw,{websites:Zu,error:Pl,pendingDeleteWebsiteId:ed,isSaving:Ds.isPending,isGenerating:Na.isPending,generationReason:Ci,executionModelLabel:ac,onOpen:ud,onSave:mc,onDelete:pc,onGenerate:gc})}):null]}):null,sn||yn?l.jsxs("div",{ref:I,className:"conversation-topbar__view-toggle","aria-label":"切换工作台面板",children:[l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="code"?"is-active":""}`,onClick:()=>Cn("code"),"aria-pressed":nn==="code","aria-label":"切换到代码会话视图",children:l.jsx(Ow,{})}),sn?l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="terminal"?"is-active":""}`,onClick:()=>Cn("terminal"),"aria-pressed":nn==="terminal","aria-label":"切换到终端视图",children:l.jsx(Iw,{})}):null,yn?l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="git"?"is-active":""}`,onClick:()=>Cn("git"),"aria-pressed":nn==="git","aria-label":"切换到 git 视图",children:l.jsx(Lw,{})}):null]}):null]}):null,[nn,yn,sn,gs,Ci,pn,xn,ac,Dr.isPending,Na.isPending,hc,Da,pc,gc,ud,$l,fc,Aa,Hl,mc,Cn,He,Ut,Ju,ed,rc,Za,Zu,Pl,Ys.isPending,Ds.isPending]),zs=l.jsx(Jj,{workspace:Va.data??null,history:ys.data??null,isLoading:Va.isPending,isHistoryLoading:ys.isFetching,error:_h,historyError:bh,onRefresh:qr,onRefreshHistory:rd,onRequestHistory:ld,onDiscardFile:od,onDiscardAll:cd,onCommitAll:uc,onSwitchBranch:Ch,onPush:Li,onLoadWorkspaceFileDiff:$r,onLoadHistoryFileDiff:dc,pendingAction:vh,compact:Wu}),Ql=l.jsx(_w,{terminals:(Zs==null?void 0:Zs.terminals)??[],activeTerminalId:(Ur==null?void 0:Ur.id)??null,outputs:Gs,error:Pl,compact:Ri||Ma,canToggleFullscreen:Kn,isFullscreen:Ma,onSelectTerminal:Th,onCloseTerminal:Eh,onToggleFullscreen:dd}),bs=l.jsx(Dy,{isDesktopSidebar:Kn,sidebarShift:sc,isSidebarDragging:Bl,composerError:E,onDismissComposerError:Ul,interactionRequests:Ka,pendingInteractionRequestId:Re,onRespondInteraction:Sh,parentSession:dn,backgroundAgentSessions:ts,isBackgroundAgentsOpen:Pn,planSnapshot:ch,onToggleBackgroundAgents:td,onOpenSession:nd,getBackgroundAgentStatusLabel:lk,getBackgroundAgentAccent:ak,formatBackgroundAgentsLabel:Xw,hasBackgroundAgentStrip:hh,commandPanel:te,isCommandPanelPending:Ol.isPending||ua.isPending,onDismissCommandPanel:sd,onCommandPanelOptionSelect:ad,onCommandPanelTextSubmit:id,projectId:B.project_id,draft:Y,pendingAttachments:_e,canSendInput:ec,isInputLocked:Ka.length>0,readOnlyPlaceholder:Ka.length>0?"请先处理上方确认请求":void 0,onDraftChange:F,onUploadFiles:jh,onRemoveAttachment:wh,onSubmit:cc,showStopIcon:Lr,isSendPending:ka.isPending||Ol.isPending||ua.isPending,onInterrupt:kh,isFastModeEnabled:V,isPlanModeEnabled:Ce,onToggleFastMode:()=>pe(S=>!S),onTogglePlanMode:()=>Le(S=>!S),showModeBadges:!0,selectedModel:xe,modelOptions:q,selectedReasoning:ne,onSelectModel:A,onSelectReasoning:S=>be(S),contextUsage:Ls,isContextUsageOpen:kt,onToggleContextUsage:Nh,contextUsageRingStyle:dh,usedPercent:Il,remainingPercent:uh,usedTokensLabel:j2((Ls==null?void 0:Ls.used_tokens)??0),totalTokensLabel:j2((Ls==null?void 0:Ls.total_tokens)??0),showJumpToBottom:xa,onJumpToBottom:Sa}),Wa=Ea?Ql:zs,Hr=Xu||Ma?l.jsxs("div",{ref:N,className:`conversation-main ${Kn?"has-desktop-sidebar":""} ${Ma?"is-terminal-fullscreen":""}`,style:{transform:`translateX(${sc}px)`,transition:Bl?"none":void 0},children:[l.jsxs("div",{className:"conversation-topbar",children:[Kn?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:Oi,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsxs("div",{className:"conversation-topbar__title-row",children:[l.jsx("h1",{children:B.title}),yc]})}),Fl]}),l.jsx("div",{ref:T,className:"conversation-scroll",children:l.jsx("div",{className:`session-workbench-surface ${Ma?"is-terminal-fullscreen":""}`,children:Wa})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`session-detail-workspace ${Ri?"has-workbench-panel":""}`,children:[l.jsx(bw,{conversationMainRef:N,conversationScrollRef:T,isDesktopSidebar:Kn,sidebarShift:sc,isSidebarDragging:Bl,title:B.title,titleActions:yc,topbarActions:Fl,onOpenSidebar:Oi,threadContent:Br,connectionStatus:ls,isConnectionDetailOpen:ge,onToggleConnectionDetail:xh,showThinkingStatus:fh}),Ri?l.jsx("aside",{ref:C,className:"session-workbench-rail",children:Wa}):null]}),Ma?null:bs]}),Fr=l.jsxs(l.Fragment,{children:[mh,ph,ae&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"attachment-lightbox",role:"dialog","aria-modal":"true","aria-label":`预览 ${ae.label}`,children:[l.jsx("button",{type:"button",className:"attachment-lightbox__scrim",onClick:()=>ue(null),"aria-label":"关闭图片预览"}),l.jsxs("div",{className:"attachment-lightbox__panel",children:[l.jsx("button",{type:"button",className:"attachment-lightbox__close",onClick:()=>ue(null),"aria-label":"关闭图片预览",children:l.jsx(Dw,{})}),l.jsx("div",{className:"attachment-lightbox__frame",children:l.jsx("img",{src:ae.src,alt:ae.label,className:"attachment-lightbox__image"})}),l.jsxs("div",{className:"attachment-lightbox__meta",children:[l.jsx("div",{className:"attachment-lightbox__title",children:ae.label}),l.jsx("div",{className:"attachment-lightbox__hint",children:ae.meta})]})]})]}),document.body):null]});return t?l.jsxs(l.Fragment,{children:[Hr,Fr]}):l.jsxs("div",{ref:w,className:`conversation-page ${R?"has-desktop-sidebar":""}`,style:yh,onPointerDown:S=>{R||S.pointerType==="mouse"&&S.button!==0||Qu(S.target)||(lc(S.clientX,S.clientY,S.pointerId),S.currentTarget.setPointerCapture(S.pointerId))},onPointerMove:S=>{if(R)return;const D=Ht.current;!D||D.pointerId!==S.pointerId||!oc(S.clientX,S.clientY)||S.preventDefault()},onPointerUp:S=>{if(R)return;const D=Ht.current;!D||D.pointerId!==S.pointerId||Di(S.clientX,S.clientY)},onPointerCancel:S=>{if(R)return;const D=Ht.current;!D||D.pointerId!==S.pointerId||(Ht.current=null,Ra(null))},children:[l.jsx(dy,{open:Ku,progress:gh,isDragging:zl,desktopPinned:R,isDesktopResizing:ie,onClose:()=>{R||(H(!1),Ra(null))},onDesktopResizeStart:S=>{Ln.current=kn.current,wn.current={startX:S,startWidth:kn.current},ee(!0)},currentAgent:on,projects:oa,sessions:$n,activeSessionId:B.id,onCreateSession:S=>{nc(S)},onSessionAction:Ya,onThreadAction:tc,pendingSessionActionId:fn.isPending?((bc=fn.variables)==null?void 0:bc.sessionId)??null:null,pendingThreadActionId:da.isPending?((Yl=da.variables)==null?void 0:Yl.projectId)??null:null}),Hr,Fr]})},Mk=({mode:n,agentName:t,agentStatus:a,onOpenNodes:r,onCreateThread:c})=>{if(n==="node")return l.jsxs("section",{className:"session-empty-state is-node-mode",children:[l.jsx("div",{className:"session-empty-state__eyebrow",children:"Panda Workspace"}),l.jsx("div",{className:"session-empty-state__actions",children:l.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:r,children:"选择节点"})})]});const u=a==="online";return l.jsxs("section",{className:"session-empty-state is-session-mode",children:[l.jsxs("div",{className:"session-empty-state__status-row",children:[l.jsx("span",{className:`session-empty-state__status-dot is-${u?"online":"offline"}`,"aria-hidden":"true"}),l.jsxs("div",{className:"session-empty-state__eyebrow",children:["节点 · ",t??"当前节点"]})]}),l.jsxs("div",{className:"session-empty-state__actions",children:[c?l.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:c,children:"新建会话"}):null,l.jsx("button",{type:"button",className:"session-empty-state__button",onClick:r,children:"切换节点"})]})]})},N2=1100,qy="panda:desktop-sidebar-width",pu="panda:desktop-sidebar-width-version",gu="2026-03-24-narrow",Rk=300,$y=232,wo=$y,Ak=460,Dk=.4,Ok=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),Tp=n=>Math.max($y,Math.min(Ak,n)),Lk=()=>{if(typeof window>"u")return wo;try{const n=window.localStorage.getItem(qy),t=window.localStorage.getItem(pu);if(!n)return window.localStorage.setItem(pu,gu),wo;const a=Number(n);if(!Number.isFinite(a))return window.localStorage.setItem(pu,gu),wo;const c=t!==gu||a===Rk||a>wo?wo:a;return window.localStorage.setItem(pu,gu),Tp(c)}catch{return wo}},g0=()=>{var tn,$t;const{sessionId:n,agentId:t}=Uu({strict:!1}),a=Mr(),r=Tl(),c=_.useRef(null),u=_.useRef(null),[h,p]=_.useState(()=>Cx()),[y,m]=_.useState(()=>Tx()??Mu()),[b,g]=_.useState(()=>Ex()),[x,w]=_.useState(()=>Mx()?"directory-picker":"composer"),[N,T]=_.useState(!1),[C,I]=_.useState(()=>typeof window<"u"&&window.innerWidth>=N2),[$,H]=_.useState(()=>Lk()),[R,Q]=_.useState(!1),[ce,Z]=_.useState(null),ie=_.useRef(null),ee=_.useRef(null),Y=_.useRef(null),F=_.useRef($),_e=_.useRef(null),je=_.useRef(null),ae=n?{sessionId:n,agentId:t??h}:{agentId:t??h},{data:ue}=qu({queryKey:dt,scope:ae}),E=(ue==null?void 0:ue.sessions.find(de=>de.id===n))??null;_.useEffect(()=>{if(ue){if(t&&ue.agents.some(de=>de.id===t)&&(p(t),xr(t),n||m(null)),E!=null&&E.agent_id&&u.current!==E.id){u.current=E.id,p(E.agent_id),m(E.id),g(null),xr(E.agent_id),fs(E.id);return}n||(u.current=null),p(de=>de&&ue.agents.some(Ae=>Ae.id===de)?de:null),m(de=>de&&ue.sessions.some(Ae=>Ae.id===de)?de:null)}},[t,E==null?void 0:E.agent_id,E==null?void 0:E.id,n,ue]),_.useEffect(()=>{t||n||h||(Rx(),a({to:"/nodes",replace:!0}))},[a,t,n,h]),_.useEffect(()=>{if(!ue||t||n||!h||y)return;const de=Mu(),Ae=ue.sessions.find(Re=>Re.id===de&&Re.agent_id===h)??null;Ae&&(m(Ae.id),fs(Ae.id))},[t,n,h,y,ue]);const U=(h?ue==null?void 0:ue.agents.find(de=>de.id===h):null)??null,te=_.useMemo(()=>U?((ue==null?void 0:ue.projects)??[]).filter(de=>de.agent_id===U.id):[],[U,ue==null?void 0:ue.projects]),W=_.useMemo(()=>U?((ue==null?void 0:ue.sessions)??[]).filter(de=>de.agent_id===U.id).sort((de,Ae)=>Number(Ae.pinned)-Number(de.pinned)||+new Date(Ae.last_event_at)-+new Date(de.last_event_at)):[],[U,ue==null?void 0:ue.sessions]),xe=y&&U?W.find(de=>de.id===y)??null:null;_.useEffect(()=>{if(xe)return;let de=!1,Ae;return Jn({sessionId:n,agentId:t??h??(U==null?void 0:U.id)??null}).then(Re=>{de||(Ae=Re.client.connectEvents(Oe=>{var mt,kt;const Ke=typeof((mt=Oe.payload)==null?void 0:mt.sessionId)=="string"?Oe.payload.sessionId:null;if(Oe.type==="agent.online"||Oe.type==="snapshot.changed"){r.invalidateQueries({queryKey:dt});return}if(Oe.type==="session.updated"&&Ke){const rn=(kt=Oe.payload)!=null&&kt.sessionPatch&&typeof Oe.payload.sessionPatch=="object"?Oe.payload.sessionPatch:null,Pn=r.getQueryData(dt);if(rn&&a0(Pn,Ke)){r.setQueryData(dt,On=>Nf(On,Ke,rn));return}r.invalidateQueries({queryKey:dt})}}))}),()=>{de=!0,Ae==null||Ae()}},[xe,U==null?void 0:U.id,r,t,n,h]),_.useEffect(()=>{F.current=$},[$]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(qy,String(Tp($))),window.localStorage.setItem(pu,gu)}catch{}},[$]),_.useEffect(()=>{if(typeof window>"u")return;const de=()=>{const Ae=window.innerWidth>=N2;I(Ae),Ae&&(T(!1),Z(null))};return de(),window.addEventListener("resize",de),()=>{window.removeEventListener("resize",de)}},[]),_.useEffect(()=>{if(!R)return;const de=Re=>{const Oe=Y.current;if(!Oe)return;const Ke=Re.clientX-Oe.startX,mt=Tp(Oe.startWidth+Ke);_e.current=mt,je.current===null&&(je.current=window.requestAnimationFrame(()=>{je.current=null;const kt=_e.current;kt!==null&&H(kt)}))},Ae=()=>{je.current!==null&&(window.cancelAnimationFrame(je.current),je.current=null);const Re=_e.current??F.current;_e.current=null,Y.current=null,Q(!1),F.current=Re,H(Re)};return window.addEventListener("pointermove",de),window.addEventListener("pointerup",Ae),()=>{window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",Ae)}},[R]),_.useEffect(()=>()=>{je.current!==null&&window.cancelAnimationFrame(je.current)},[]);const A=Vn({mutationFn:async de=>(await Jn({sessionId:de.sessionId})).client.updateSession(de)}),ne=Vn({mutationFn:async de=>(await Jn({projectId:de.projectId})).client.updateThread(de)}),be=async(de,Ae,Re)=>{var mt;const Oe=await A.mutateAsync({sessionId:de,action:Ae,name:Re}),Ke=(mt=Oe.affectedSessionIds)!=null&&mt.length?Oe.affectedSessionIds:[de];if(Ae==="delete"?r.setQueryData(dt,kt=>ay(kt,Ke)):r.setQueryData(dt,kt=>sy(kt,Ke,{...Ae==="rename"&&(Re!=null&&Re.trim())?{title:Re.trim()}:{pinned:Ae==="pin"}})),Ae==="delete"&&y===de){const kt=Oe.nextSessionId;kt?(fs(kt),m(kt)):(fs(null),m(null))}},V=async(de,Ae,Re)=>{var mt,kt;const Oe=await ne.mutateAsync({projectId:de,action:Ae,name:Re==null?void 0:Re.name,orderedProjectIds:Re==null?void 0:Re.orderedProjectIds}),Ke=(mt=Re==null?void 0:Re.name)==null?void 0:mt.trim();Ae==="pin"||Ae==="unpin"?r.setQueryData(dt,rn=>Yf(rn,de,{pinned:Ae==="pin"})):Ae==="rename"&&Ke?r.setQueryData(dt,rn=>Yf(rn,de,{display_name:Ke})):Ae==="reorder"&&((kt=Re==null?void 0:Re.orderedProjectIds)!=null&&kt.length)?r.setQueryData(dt,rn=>iy(rn,Re.orderedProjectIds??[])):Ae==="remove"||Ae==="archive"?r.setQueryData(dt,rn=>ry(rn,de)):Ae==="unarchive"&&r.invalidateQueries({queryKey:dt}),xe&&xe.project_id===de&&(Ae==="remove"||Ae==="archive"||Ae==="unarchive")&&(Oe.nextSessionId?(fs(Oe.nextSessionId),m(Oe.nextSessionId)):(fs(null),m(null)))},pe=async de=>{U&&(xr(U.id),fs(null),Ru(null),lu(!1),Eo(de),g(de),w("composer"),m(null),await a({to:"/"}))},Ce=async()=>{U&&(C||(T(!1),Ge(null)),xr(U.id),fs(null),Ru(null),Eo(null),lu(!0),g(null),w("directory-picker"),m(null),await a({to:"/"}))},Le=async de=>{await pe(de)},he=C?0:Ok(),q=C||N,Se=C?0:ce??(N?he:0),Ne=C?1:he>0?Se/he:0,me=!C&&ce!==null,Te=C?{"--desktop-sidebar-width":`${$}px`}:void 0,Ge=de=>{ie.current=de,Z(de)},Ue=de=>de instanceof Element&&!!de.closest('button, textarea, input, a, [role="dialog"]'),gt=(de,Ae,Re)=>(ee.current={mode:N?"close":"open",startX:de,startY:Ae,axis:"pending",pointerId:Re},!0),Lt=(de,Ae)=>{const Re=ee.current;if(!Re)return!1;const Oe=de-Re.startX,Ke=Ae-Re.startY;if(Re.axis==="pending"){if(Math.abs(Oe)<8&&Math.abs(Ke)<8)return!1;if(Re.axis=Math.abs(Oe)>Math.abs(Ke)?"x":"y",Re.axis==="y")return ee.current=null,Ge(null),!1}const mt=Re.mode==="open"?Math.max(0,Math.min(he,Oe)):Math.max(0,Math.min(he,he+Oe));return Ge(mt),!0},St=(de,Ae)=>{const Re=ee.current;if(!Re)return;const Oe=de-Re.startX,Ke=Ae-Re.startY;if(Re.axis==="pending"&&Math.abs(Ke)>48){ee.current=null,Ge(null);return}const kt=(Re.axis==="x"?ie.current??(Re.mode==="open"?Math.max(0,Math.min(he,Oe)):Math.max(0,Math.min(he,he+Oe))):N?he:0)>=he*Dk;T(kt),ee.current=null,Ge(null)},st=()=>l.jsx(l.Fragment,{children:l.jsxs("div",{className:`conversation-main ${C?"has-desktop-sidebar":""}`,style:{transform:`translateX(${Se}px)`,transition:me?"none":void 0},children:[l.jsx("div",{className:"conversation-topbar",children:C?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:()=>T(!0),"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]})}),l.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:l.jsx("div",{className:"conversation-thread conversation-thread--empty",children:l.jsx(Mk,{mode:"node",agentName:U==null?void 0:U.name,agentStatus:(U==null?void 0:U.status)??null,onOpenNodes:()=>{a({to:"/nodes"})}})})})]})});return l.jsxs("div",{ref:c,className:`conversation-page ${C?"has-desktop-sidebar":""}`,style:Te,onPointerDown:de=>{C||de.pointerType==="mouse"&&de.button!==0||Ue(de.target)||(gt(de.clientX,de.clientY,de.pointerId),de.currentTarget.setPointerCapture(de.pointerId))},onPointerMove:de=>{if(C)return;const Ae=ee.current;!Ae||Ae.pointerId!==de.pointerId||!Lt(de.clientX,de.clientY)||de.preventDefault()},onPointerUp:de=>{if(C)return;const Ae=ee.current;!Ae||Ae.pointerId!==de.pointerId||St(de.clientX,de.clientY)},onPointerCancel:de=>{if(C)return;const Ae=ee.current;!Ae||Ae.pointerId!==de.pointerId||(ee.current=null,Ge(null))},children:[l.jsx(dy,{open:q,progress:Ne,isDragging:me,desktopPinned:C,isDesktopResizing:R,onClose:()=>{C||(T(!1),Ge(null))},onDesktopResizeStart:de=>{_e.current=F.current,Y.current={startX:de,startWidth:F.current},Q(!0)},currentAgent:U??void 0,projects:te,sessions:W,activeSessionId:xe==null?void 0:xe.id,onCreateSession:de=>{Le(de)},onCreateDirectoryThread:()=>{Ce()},onSelectSession:de=>{g(null),w("composer"),lu(!1),Eo(null),m(de),fs(de)},onSessionAction:be,onThreadAction:V,pendingSessionActionId:A.isPending?((tn=A.variables)==null?void 0:tn.sessionId)??null:null,pendingThreadActionId:ne.isPending?(($t=ne.variables)==null?void 0:$t.projectId)??null:null}),U?xe?l.jsx(Ek,{sessionId:xe.id,embedded:!0,isDesktopSidebar:C,sidebarOffset:Se,isSidebarDragging:me,onOpenSidebar:()=>T(!0),onSelectSession:de=>{m(de),fs(de)},onExitToNodes:()=>{m(null),a({to:"/nodes"})}}):l.jsx(Pj,{currentAgent:U,projects:te,sessions:W,initialProjectId:b,entryView:x,isDesktopSidebar:C,sidebarOffset:Se,isSidebarDragging:me,onOpenSidebar:()=>T(!0),onProjectSelected:de=>{g(de),w("composer"),lu(!1)},onSessionCreated:de=>{g(null),w("composer"),lu(!1),Eo(null),m(de),fs(de)}}):st()]})},Hy=1,Ik=10080*60*1e3,Fy="panda-web-cache",Yo="app-state",Qy="react-query",C2="panda:storage-persist-result",zk=new Set(["bootstrap","timeline","timeline-optimistic","change-sets","plan","interactions","codex-commands","project-skills","settings-connection"]),y0=()=>typeof window<"u"&&typeof window.indexedDB<"u",Bk=n=>typeof n[0]=="string"&&zk.has(n[0]),Gy=async()=>y0()?await new Promise((n,t)=>{const a=window.indexedDB.open(Fy,1);a.onupgradeneeded=()=>{const r=a.result;r.objectStoreNames.contains(Yo)||r.createObjectStore(Yo)},a.onsuccess=()=>n(a.result),a.onerror=()=>t(a.error??new Error("Unable to open Panda cache database."))}):null,Pk=async()=>{const n=await Gy();if(!n)return null;try{return await new Promise((t,a)=>{const u=n.transaction(Yo,"readonly").objectStore(Yo).get(Qy);u.onsuccess=()=>t(u.result??null),u.onerror=()=>a(u.error??new Error("Unable to read Panda cache record."))})}finally{n.close()}},Uk=async n=>{const t=await Gy();if(t)try{await new Promise((a,r)=>{const c=t.transaction(Yo,"readwrite");c.objectStore(Yo).put(n,Qy),c.oncomplete=()=>a(),c.onerror=()=>r(c.error??new Error("Unable to write Panda cache record.")),c.onabort=()=>r(c.error??new Error("Writing Panda cache record was aborted."))})}finally{t.close()}},Ep=async()=>{y0()&&await new Promise(n=>{const t=window.indexedDB.deleteDatabase(Fy);t.onsuccess=()=>n(),t.onerror=()=>n(),t.onblocked=()=>n()})},qk=async n=>{if(y0())try{const t=await Pk();if(!t)return;const a=Date.now()-t.persistedAt>Ik;if(t.version!==Hy||a){await Ep();return}Bv(n,t.clientState)}catch{await Ep().catch(()=>{})}},$k=async()=>{if(!(typeof navigator>"u"||typeof window>"u"||!("storage"in navigator)||typeof navigator.storage.persist!="function"))try{if(window.localStorage.getItem(C2))return;const t=await navigator.storage.persist();window.localStorage.setItem(C2,t?"granted":"denied")}catch{}},Hk=n=>{if(typeof window>"u")return()=>{};$k();let t=null,a=null,r=!1,c=!1;const u=async()=>{if(!c){if(a){r=!0;return}a=(async()=>{const b=zv(n,{shouldDehydrateQuery:g=>Bk(g.queryKey)});await Uk({version:Hy,persistedAt:Date.now(),clientState:b})})();try{await a}catch{}finally{a=null,r&&(r=!1,u())}}},h=(b=!1)=>{if(!c){if(t!==null&&(window.clearTimeout(t),t=null),b){u();return}t=window.setTimeout(()=>{t=null,u()},1200)}},p=n.getQueryCache().subscribe(()=>{h(!1)}),y=()=>{document.visibilityState==="hidden"&&h(!0)},m=()=>{h(!0)};return document.addEventListener("visibilitychange",y),window.addEventListener("pagehide",m),()=>{c=!0,p(),document.removeEventListener("visibilitychange",y),window.removeEventListener("pagehide",m),t!==null&&(window.clearTimeout(t),t=null)}},Fk=async()=>{if(await Ep().catch(()=>{}),"serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(a=>a.unregister()))}if("caches"in window){const t=await window.caches.keys();await Promise.all(t.map(a=>window.caches.delete(a)))}const n=window.indexedDB;if(typeof n.databases=="function"){const t=await n.databases();await Promise.all(t.map(a=>a.name).filter(a=>!!a).map(a=>new Promise(r=>{const c=n.deleteDatabase(a);c.onsuccess=()=>r(),c.onerror=()=>r(),c.onblocked=()=>r()})))}window.localStorage.clear(),window.sessionStorage.clear()},T2=980,_f=[{id:"theme",title:"主题",description:"调整界面的颜色风格。",icon:"theme"},{id:"models",title:"模型维护",description:"维护可选模型、默认模型和展示顺序。",icon:"models"},{id:"cache",title:"缓存",description:"解决页面没更新的问题。",icon:"cache"},{id:"notifications",title:"移动提醒",description:"安装到桌面,并在对话完成后接收系统通知。",icon:"notifications"},{id:"connection",title:"连接状态",description:"查看现在连到哪台设备。",icon:"connection"}],Qk=[{value:"light",label:"浅色",icon:"sun"},{value:"dark",label:"深色",icon:"moon"},{value:"system",label:"系统",icon:"system"}],Gk=(n,t,a,r)=>["const pandaTheme = {",` codeThemeId: "${n}",`,` accent: "${t.toLowerCase()}",`,` contrast: ${a},`,` opaqueWindows: ${r},`,"}"],Vk=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m15 6-6 6 6 6"})}),Kk=({open:n})=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:n?"m6 9 6 6 6-6":"m9 6 6 6-6 6"})}),Yk=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M9 6h.01M9 12h.01M9 18h.01M15 6h.01M15 12h.01M15 18h.01"})}),Zk=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),Wk=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),Xk=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),Jk=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m12 6-5 5M12 6l5 5M12 6v12"})}),eN=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m12 18-5-5M12 18l5-5M12 18V6"})}),E2=({icon:n})=>n==="cache"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M5 8.5C5 6.57 8.13 5 12 5s7 1.57 7 3.5S15.87 12 12 12 5 10.43 5 8.5Z"}),l.jsx("path",{d:"M5 8.5v7c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5v-7"}),l.jsx("path",{d:"M5 12c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5"})]}):n==="models"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M5 7.5h14M5 12h14M5 16.5h14"}),l.jsx("path",{d:"M8 5.5h.01M8 10h.01M8 14.5h.01"})]}):n==="connection"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9.5 14.5a3.5 3.5 0 0 1 0-5l1.5-1.5a3.5 3.5 0 0 1 5 5L15 14"}),l.jsx("path",{d:"M14.5 9.5a3.5 3.5 0 0 1 0 5L13 16a3.5 3.5 0 0 1-5-5L9 10"})]}):n==="notifications"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6.5 9.5a5.5 5.5 0 0 1 11 0c0 5.25 1.9 6.83 1.9 6.83H4.6S6.5 14.75 6.5 9.5Z"}),l.jsx("path",{d:"M10 18.25a2.1 2.1 0 0 0 4 0"})]}):l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 4.75v2.1M12 17.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.85"})]}),tN=({icon:n,active:t})=>{const a=t?2:1.8;return n==="sun"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4.1"}),l.jsx("path",{d:"M12 2.75v2.1M12 19.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"})]}):n==="moon"?l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M20.2 14.1A8.5 8.5 0 1 1 9.9 3.8a6.9 6.9 0 0 0 10.3 10.3Z"})}):l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"3.5",y:"5",width:"17",height:"12",rx:"2.4"}),l.jsx("path",{d:"M8 19h8"})]})},nN=({title:n,caption:t,accent:a,background:r,foreground:c,lines:u})=>l.jsxs("div",{className:"theme-preview-panel",style:{"--preview-accent":a,"--preview-background":r,"--preview-foreground":c},children:[l.jsxs("div",{className:"theme-preview-panel__meta",children:[l.jsx("span",{children:n}),l.jsx("span",{children:t})]}),l.jsx("pre",{className:"theme-preview-panel__code","aria-label":`${n} 主题预览`,children:u.map(h=>l.jsx("code",{children:h},h))})]}),ko=({label:n,value:t})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsxs("div",{className:"theme-token",children:[l.jsx("span",{className:"theme-token__swatch",style:{"--token-color":t}}),l.jsx("span",{children:t})]})]}),bf=({label:n,value:t})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsx("div",{className:"theme-token",children:t})]}),M2=({label:n,value:t,mono:a})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsx("div",{className:`theme-token theme-token--font ${a?"is-mono":""}`,children:t})]}),R2=({label:n,value:t,onChange:a,min:r,max:c})=>l.jsxs("div",{className:"settings-row settings-row--size",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsxs("div",{className:"theme-stepper",children:[l.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t-1),"aria-label":`${n} 减小 1px`,children:"-"}),l.jsxs("label",{className:"theme-stepper__input-wrap",children:[l.jsx("input",{className:"theme-stepper__input",type:"number",min:r,max:c,step:1,value:t,onChange:u=>a(Number(u.target.value))}),l.jsx("span",{children:"px"})]}),l.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t+1),"aria-label":`${n} 增大 1px`,children:"+"})]})]}),A2=(n,t,a,r)=>{if(t===a)return n;const c=n.findIndex(b=>b.id===t),u=n.findIndex(b=>b.id===a);if(c<0||u<0)return n;const h=[...n],[p]=h.splice(c,1);if(!p)return n;const y=h.findIndex(b=>b.id===a),m=r==="before"?y:y+1;return h.splice(m,0,p),h},sN=()=>{var ls;const n=Mr(),t=Tl(),{data:a}=qu(),[r,c]=_.useState(!1),[u,h]=_.useState(null),[p,y]=_.useState(null),[m,b]=_.useState("theme"),[g,x]=_.useState(null),[w,N]=_.useState(()=>typeof window<"u"&&window.innerWidth>=T2),[T,C]=_.useState(()=>gp()),[I,$]=_.useState(()=>yp()),[H,R]=_.useState(null),[Q,ce]=_.useState(!1),[Z,ie]=_.useState(()=>M1()),[ee,Y]=_.useState(()=>D6()),F=va(j=>j.themeSettings),_e=va(j=>j.resolvedTheme),je=va(j=>j.systemAppearance),ae=va(j=>j.setThemeMode),ue=va(j=>j.setLightThemeId),E=va(j=>j.setDarkThemeId),U=va(j=>j.setUiFontSize),te=va(j=>j.setCodeFontSize),W=d0(),[xe,A]=_.useState(()=>c0()),[ne,be]=_.useState(()=>Tf()),[V,pe]=_.useState(null),[Ce,Le]=_.useState(()=>cu()),[he,q]=_.useState(null),[Se,Ne]=_.useState(null),[me,Te]=_.useState(null),Ge=typeof window>"u"?null:Mu(),Ue=(a==null?void 0:a.sessions.find(j=>j.id===Ge))??(a==null?void 0:a.sessions.find(j=>j.id===a.active_session_id))??(a==null?void 0:a.sessions.find(j=>!j.archived))??(a==null?void 0:a.sessions[0]),gt=(a==null?void 0:a.agents.find(j=>j.id===(Ue==null?void 0:Ue.agent_id)))??(a==null?void 0:a.agents[0]),Lt=Es({queryKey:["settings-connection"],queryFn:async()=>{const j=await Jn(),z=await fetch(`${j.baseUrl}/health`);return{modeLabel:j.mode==="hub"?"通过 Panda Hub":"直接连接",backendLabel:j.label,backendUrl:j.baseUrl,healthOk:z.ok}}}),St=Es({queryKey:["codex-commands"],queryFn:async()=>(await Jn()).client.getCodexCommands(),staleTime:0,refetchOnWindowFocus:!1}),st=Vn({mutationFn:async()=>(await Jn()).client.refreshCodexCommands(),onMutate:()=>{h(null)},onSuccess:async j=>{t.setQueryData(["codex-commands"],j),await t.invalidateQueries({queryKey:["codex-commands"]}),h(`命令目录已刷新,共 ${j.commands.length} 条,CLI 版本 ${j.cli_version??"未知"}。`)},onError:j=>{h(j instanceof Error?j.message:"刷新命令目录失败。")}});_.useEffect(()=>{if(typeof window>"u")return;const j=()=>{const z=window.innerWidth>=T2;N(z)};return j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]),_.useEffect(()=>{h(null)},[(ls=Lt.data)==null?void 0:ls.backendUrl]),_.useEffect(()=>{w&&x(m)},[m,w]),_.useEffect(()=>{q(null)},[m]),_.useEffect(()=>{if(typeof window>"u")return;const j=we=>{we.preventDefault(),R(we)},z=()=>{R(null),ie(!0),y("应用已安装到桌面。")},ge=()=>{$(yp()),C(gp()),ie(M1()),Y(D6())};return window.addEventListener("beforeinstallprompt",j),window.addEventListener("appinstalled",z),document.addEventListener("visibilitychange",ge),()=>{window.removeEventListener("beforeinstallprompt",j),window.removeEventListener("appinstalled",z),document.removeEventListener("visibilitychange",ge)}},[]),_.useEffect(()=>{if(W.length===0||W.some(z=>z.value===xe))return;const j=W[0].value;bu(j),A(j)},[W,xe]),_.useEffect(()=>{var z;if(W.length===0||W.some(ge=>ge.value===ne))return;const j=((z=W.find(ge=>ge.value==="gpt-5.4-mini"))==null?void 0:z.value)??W[0].value;O1(j),be(j)},[ne,W]);const tn=()=>{if(Ue!=null&&Ue.id){xr(Ue.agent_id),fs(Ue.id),n({to:"/"});return}n({to:"/nodes"})},$t=async()=>{h(null),c(!0);try{await Fk(),h("缓存已清理,正在重新载入…"),window.setTimeout(()=>{window.location.replace(`/settings?cache-reset=${Date.now()}`)},180)}catch{c(!1),h("清理失败,请在浏览器设置中手动清理站点数据。")}},de=async()=>{if(I!=="granted"){const z=await wx();if($(z),z==="granted"){const ge={completionNotificationsEnabled:!0};A6(ge),C(ge),y("系统通知已开启,后续对话完成会提醒你。");return}if(z==="denied"){y("系统通知已被拒绝,请到浏览器或系统设置里重新开启。");return}y("还没有拿到通知权限,可以稍后再试一次。");return}const j={completionNotificationsEnabled:!T.completionNotificationsEnabled};A6(j),C(j),y(j.completionNotificationsEnabled?"完成提醒已开启。":"完成提醒已关闭。")},Ae=async()=>{if(!H){y(ee?"请在浏览器菜单里选择“安装应用”或“添加到主屏幕”。":"当前浏览器没有提供安装弹窗,请使用浏览器的“添加到主屏幕”。");return}ce(!0),y(null);try{await H.prompt(),(await H.userChoice).outcome==="accepted"?y("安装请求已提交,请回到桌面查看。"):y("你取消了这次安装。")}finally{R(null),ce(!1),ie(M1())}},Re=j=>{var z,ge,we;if(KS(j),!j.some(ke=>ke.value===xe)){const ke=((z=j[0])==null?void 0:z.value)??"";ke&&(bu(ke),A(ke))}if(!j.some(ke=>ke.value===ne)){const ke=((ge=j.find(Ve=>Ve.value==="gpt-5.4-mini"))==null?void 0:ge.value)??((we=j[0])==null?void 0:we.value)??"";ke&&(O1(ke),be(ke))}},Oe=()=>{pe("new"),Le(cu()),q(null)},Ke=j=>{pe(j.id),Le({...j}),q(null)},mt=()=>{pe(null),Le(cu()),q(null)},kt=()=>{var Ve;const j=Ce.label.trim(),z=Ce.value.trim();if(!j||!z){q("请填写显示名和模型 ID。");return}if(W.find(ct=>ct.value.toLowerCase()===z.toLowerCase()&&ct.id!==V)){q(`模型 ID ${z} 已存在。`);return}const we={...Ce,label:j,value:z,description:((Ve=Ce.description)==null?void 0:Ve.trim())||null},ke=V==="new"?[...W,we]:W.map(ct=>ct.id===V?we:ct);Re(ke),pe(null),Le(cu()),q(V==="new"?"模型已添加。":"模型已更新。")},rn=j=>{const z=W.filter(ge=>ge.id!==j);if(z.length===0){q("至少保留一个模型。");return}Re(z),V===j&&(pe(null),Le(cu())),q("模型已删除。")},Pn=j=>{bu(j),A(j),q(`默认模型已切换为 ${j}。`)},On=j=>{O1(j),be(j),q(`命令执行模型已切换为 ${j}。`)},nn=(j,z)=>{const ge=W.findIndex(Ve=>Ve.id===j);if(ge<0)return;const we=z==="up"?ge-1:ge+1;if(we<0||we>=W.length)return;const ke=W[we];ke&&Re(A2(W,j,ke.id,z==="up"?"before":"after"))},ln=(j,z)=>{Ne(z),Te(null),j.dataTransfer.effectAllowed="move",j.dataTransfer.setData("text/plain",z)},oe=(j,z)=>{if(!Se||Se===z)return;j.preventDefault();const ge=j.currentTarget.getBoundingClientRect(),we=j.clientY<ge.top+ge.height/2?"before":"after";Te(ke=>(ke==null?void 0:ke.modelId)===z&&ke.position===we?ke:{modelId:z,position:we})},qe=j=>{!Se||!me||me.modelId!==j||(Re(A2(W,Se,j,me.position)),Ne(null),Te(null))},De=()=>{Ne(null),Te(null)},Ie=_e.appearance,We=Ie==="light"?vp:Au,$e=Ie==="light"?F.lightThemeId:F.darkThemeId,He=We.find(j=>j.id===$e)??We[0],Ee=_e.activeTheme,Ut=Gk(He.codeThemeId,He.accent,He.contrast,He.opaqueWindows),at=F.mode==="system"?`当前跟随系统:${je==="dark"?"深色":"浅色"}`:`当前固定为${_e.appearance==="dark"?"深色":"浅色"}模式`,pn="当前正在显示",Un=He.opaqueWindows?"不透明窗口":"半透明窗口",xn=_f.find(j=>j.id===m)??_f[0],ps=`${He.label} · ${Un} · 对比度 ${He.contrast}`,gs=W.find(j=>j.value===xe)??W[0]??null,is=W.find(j=>j.value===ne)??W.find(j=>j.value==="gpt-5.4-mini")??W[0]??null,Ci=()=>l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsxs("div",{children:[l.jsx("h3",{className:"settings-panel__title",children:"外观"}),l.jsx("p",{className:"settings-panel__subtitle",children:"先选浅色或深色,再挑一个你喜欢的风格。"})]})}),l.jsx("div",{className:"settings-control-grid",children:l.jsxs("div",{className:"settings-control-block settings-control-block--full",children:[l.jsx("span",{className:"settings-control-block__label",children:"显示方式"}),l.jsx("div",{className:"theme-mode-switch",role:"tablist","aria-label":"主题模式",children:Qk.map(j=>{const z=j.value===F.mode;return l.jsxs("button",{type:"button",className:`theme-mode-switch__button ${z?"is-active":""}`,onClick:()=>ae(j.value),role:"tab","aria-selected":z,children:[l.jsx(tN,{icon:j.icon,active:z}),l.jsx("span",{children:j.label})]},j.value)})}),l.jsx("p",{className:"settings-control-block__hint",children:at})]})})]}),l.jsxs("div",{className:"settings-theme-layout",children:[l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:Ie==="light"?"浅色风格":"深色风格"})})}),l.jsxs("div",{className:"settings-theme-selector",children:[l.jsx("label",{className:"settings-select settings-select--wide",children:l.jsx("select",{value:He.id,onChange:j=>{if(Ie==="light"){ue(j.target.value);return}E(j.target.value)},"aria-label":Ie==="light"?"选择浅色主题":"选择深色主题",children:We.map(j=>l.jsx("option",{value:j.id,children:j.label},`${j.variant}-${j.id}`))})}),l.jsxs("div",{className:"settings-theme-selector__summary",children:[l.jsxs("div",{className:"settings-theme-selector__swatches","aria-hidden":"true",children:[l.jsx("span",{style:{"--theme-card-color":He.background}}),l.jsx("span",{style:{"--theme-card-color":He.foreground}}),l.jsx("span",{style:{"--theme-card-color":He.accent}}),l.jsx("span",{style:{"--theme-card-color":He.semanticColors.diffAdded}}),l.jsx("span",{style:{"--theme-card-color":He.semanticColors.diffRemoved}})]}),l.jsxs("div",{className:"settings-theme-selector__copy",children:[l.jsx("strong",{children:He.label}),l.jsx("span",{children:ps})]}),He.id===Ee.id&&He.variant===_e.appearance?l.jsx("span",{className:"settings-theme-selector__badge",children:"当前"}):l.jsx("span",{className:"settings-theme-selector__badge is-muted",children:"已选"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsxs("div",{className:"settings-panel__header",children:[l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"风格细节"})}),l.jsx("div",{className:"theme-status-badge",children:pn})]}),l.jsx(nN,{title:Ie==="light"?"浅色预览":"深色预览",caption:He.label,accent:He.accent,background:He.background,foreground:He.foreground,lines:Ut}),l.jsxs("div",{className:"settings-list",children:[l.jsx(bf,{label:"代码风格",value:He.codeThemeId}),l.jsx(bf,{label:"当前模式",value:He.variant}),l.jsx(bf,{label:"对比度",value:String(He.contrast)}),l.jsx(bf,{label:"面板质感",value:Un}),l.jsx(ko,{label:"强调色",value:He.accent}),l.jsx(ko,{label:"背景色",value:He.background}),l.jsx(ko,{label:"文字色",value:He.foreground}),l.jsx(ko,{label:"新增颜色",value:He.semanticColors.diffAdded}),l.jsx(ko,{label:"删除颜色",value:He.semanticColors.diffRemoved}),l.jsx(ko,{label:"特殊强调",value:He.semanticColors.skill}),l.jsx(M2,{label:"界面字体",value:He.fonts.ui??"null"}),l.jsx(M2,{label:"代码字体",value:He.fonts.code??"null",mono:!0})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"字号"})})}),l.jsxs("div",{className:"settings-list",children:[l.jsx(R2,{label:"界面字号",value:F.uiFontSize,onChange:j=>U(J3(j)),min:11,max:18}),l.jsx(R2,{label:"代码字号",value:F.codeFontSize,onChange:j=>te(ey(j)),min:10,max:18})]})]})]}),la=()=>{var j;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsxs("div",{className:"settings-panel__header",children:[l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"模型列表"})}),l.jsxs("button",{type:"button",className:"settings-inline-action",onClick:Oe,children:[l.jsx(Zk,{}),"新增模型"]})]}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"首位模型"}),l.jsx("strong",{children:((j=W[0])==null?void 0:j.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"当前默认"}),l.jsx("strong",{children:(gs==null?void 0:gs.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"命令执行模型"}),l.jsx("strong",{children:(is==null?void 0:is.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"可选数量"}),l.jsxs("strong",{children:[W.length," 个"]})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"模型角色"})})}),l.jsxs("div",{className:"settings-model-editor__grid",children:[l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"默认模型"}),l.jsx("select",{value:xe,onChange:z=>Pn(z.target.value),children:W.map(z=>l.jsx("option",{value:z.value,children:z.label},z.id))})]}),l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"命令执行模型"}),l.jsx("select",{value:ne,onChange:z=>On(z.target.value),children:W.map(z=>l.jsx("option",{value:z.value,children:z.label},z.id))})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"维护模型"})})}),he?l.jsx("div",{className:"settings-inline-status",role:"alert",children:he}):null,l.jsx("div",{className:"settings-model-list",role:"list","aria-label":"模型列表",children:W.map((z,ge)=>{const we=Se===z.id,ke=(me==null?void 0:me.modelId)===z.id&&me.position==="before",Ve=(me==null?void 0:me.modelId)===z.id&&me.position==="after",ct=z.value===xe;return l.jsxs("article",{className:`settings-model-card ${we?"is-dragging":""} ${ke?"is-drop-before":""} ${Ve?"is-drop-after":""}`,draggable:!0,onDragStart:Nt=>ln(Nt,z.id),onDragOver:Nt=>oe(Nt,z.id),onDrop:Nt=>{Nt.preventDefault(),qe(z.id)},onDragEnd:De,role:"listitem",children:[l.jsxs("div",{className:"settings-model-card__main",children:[l.jsx("span",{className:"settings-model-card__grip","aria-hidden":"true",children:l.jsx(Yk,{})}),l.jsxs("div",{className:"settings-model-card__copy",children:[l.jsxs("div",{className:"settings-model-card__title-row",children:[l.jsx("strong",{children:z.label}),ct?l.jsx("span",{className:"settings-model-card__badge",children:"默认"}):null]}),l.jsx("code",{className:"settings-model-card__value",children:z.value})]})]}),l.jsxs("div",{className:"settings-model-card__actions",children:[l.jsx("button",{type:"button",className:`settings-mini-button ${ct?"is-active":""}`,onClick:()=>Pn(z.value),children:"设为默认"}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>nn(z.id,"up"),disabled:ge===0,"aria-label":`上移 ${z.label}`,children:l.jsx(Jk,{})}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>nn(z.id,"down"),disabled:ge===W.length-1,"aria-label":`下移 ${z.label}`,children:l.jsx(eN,{})}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Ke(z),"aria-label":`编辑 ${z.label}`,children:l.jsx(Wk,{})}),l.jsx("button",{type:"button",className:"settings-icon-button is-danger",onClick:()=>rn(z.id),disabled:W.length<=1,"aria-label":`删除 ${z.label}`,children:l.jsx(Xk,{})})]})]},z.id)})}),V?l.jsxs("div",{className:"settings-model-editor",children:[l.jsx("div",{className:"settings-model-editor__header",children:l.jsx("strong",{children:V==="new"?"新增模型":"编辑模型"})}),l.jsxs("div",{className:"settings-model-editor__grid",children:[l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"显示名"}),l.jsx("input",{type:"text",value:Ce.label,onChange:z=>Le(ge=>({...ge,label:z.target.value})),placeholder:"例如:gpt-5.4"})]}),l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"模型 ID"}),l.jsx("input",{type:"text",value:Ce.value,onChange:z=>Le(ge=>({...ge,value:z.target.value})),placeholder:"例如:gpt-5.4"})]})]}),l.jsxs("div",{className:"settings-model-editor__actions",children:[l.jsx("button",{type:"button",className:"settings-ghost-button",onClick:mt,children:"取消"}),l.jsx("button",{type:"button",className:"settings-inline-action",onClick:kt,children:"保存"})]})]}):null]})]})},Gs=()=>{var j,z;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"页面缓存"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"适合什么时候用"}),l.jsx("strong",{children:"页面资源或本地缓存异常"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"常见表现"}),l.jsx("strong",{children:"样式没更新、列表卡旧、页面反复异常"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"清理缓存"})})}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void $t(),disabled:r,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"清理并刷新"}),l.jsx("span",{children:"删除页面资源缓存和本地会话缓存,强制重新加载最新页面。"})]}),l.jsx("span",{className:"settings-action__state",children:r?"处理中…":"→"})]}),u?l.jsx("p",{className:"settings-block__status",children:u}):null]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"移动端诊断"})})}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void n({to:"/diagnostics"}),children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"打开安卓诊断页"}),l.jsx("span",{children:"在手机上检查样式能力、资源加载、Service Worker 和缓存状态,并可上传到后端日志。"})]}),l.jsx("span",{className:"settings-action__state",children:"→"})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"命令目录缓存"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"当前 CLI"}),l.jsx("span",{children:((j=St.data)==null?void 0:j.cli_version)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"最近刷新"}),l.jsx("span",{children:((z=St.data)==null?void 0:z.loaded_at)??"尚未生成"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"命令数量"}),l.jsx("span",{children:St.data?`${St.data.commands.length} 条`:"检测中…"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void st.mutateAsync(),disabled:st.isPending,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"刷新命令目录"}),l.jsx("span",{children:"重新从当前 Codex CLI 对应版本拉取命令并覆盖本地缓存文件。"})]}),l.jsx("span",{className:"settings-action__state",children:st.isPending?"刷新中…":"→"})]})]})]})},rs=()=>{var j,z,ge,we,ke;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"当前设备"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"设备名称"}),l.jsx("strong",{children:(gt==null?void 0:gt.name)??"未选择节点"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"连接方式"}),l.jsx("strong",{children:((j=Lt.data)==null?void 0:j.modeLabel)??"检测中…"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"状态"}),l.jsx("strong",{className:(z=Lt.data)!=null&&z.healthOk?"is-ok":"is-muted",children:Lt.isLoading?"检测中…":(ge=Lt.data)!=null&&ge.healthOk?"在线":"无法连接"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"更多信息"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"服务名称"}),l.jsx("span",{children:((we=Lt.data)==null?void 0:we.backendLabel)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"服务地址"}),l.jsx("span",{children:((ke=Lt.data)==null?void 0:ke.backendUrl)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"设备标识"}),l.jsx("span",{children:(gt==null?void 0:gt.id)??"未选择节点"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"最近会话"}),l.jsx("span",{children:(Ue==null?void 0:Ue.title)??"未选择会话"})]})]})]})},xa=()=>{const j=Z?"已安装":"未安装",z=I==="granted"?"已允许":I==="denied"?"已拒绝":I==="default"?"待授权":"不支持",ge=I==="granted"&&T.completionNotificationsEnabled?"已开启":"未开启";return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"安卓优先提醒"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"桌面安装"}),l.jsx("strong",{children:j})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"系统通知权限"}),l.jsx("strong",{children:z})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"完成提醒"}),l.jsx("strong",{children:ge})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"安装到桌面"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"推荐平台"}),l.jsx("span",{children:ee?"Android 当前设备":"Android 效果最佳"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"当前形态"}),l.jsx("span",{children:Z?"已是桌面应用":"浏览器标签页"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Ae(),disabled:Z||Q,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:Z?"已经安装":"安装到桌面"}),l.jsx("span",{children:Z?"现在可以直接从桌面图标进入 Panda。":"安装后更像应用,系统通知和锁屏提醒也更稳定。"})]}),l.jsx("span",{className:"settings-action__state",children:Z?"✓":Q?"处理中…":"→"})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"对话完成提醒"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"提醒方式"}),l.jsx("span",{children:"系统通知"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"锁屏可见"}),l.jsx("span",{children:Z?"已具备条件":"建议先安装到桌面"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"触发时机"}),l.jsx("span",{children:"收到对话完成事件后提醒"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void de(),disabled:I==="unsupported",children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:I==="granted"&&T.completionNotificationsEnabled?"关闭完成提醒":"开启完成提醒"}),l.jsx("span",{children:I==="unsupported"?"当前环境不支持系统通知,需要 HTTPS、Service Worker 和受支持浏览器。":"当会话生成最终回复后,以系统通知方式提醒你。"})]}),l.jsx("span",{className:"settings-action__state",children:I==="unsupported"?"不可用":I==="granted"&&T.completionNotificationsEnabled?"✓":"→"})]}),p?l.jsx("p",{className:"settings-block__status",children:p}):null]})]})},Vs=j=>j==="models"?la():j==="cache"?Gs():j==="notifications"?xa():j==="connection"?rs():Ci();return l.jsx("div",{className:"conversation-page settings-screen settings-screen--workspace",children:l.jsx("div",{className:"conversation-main settings-screen__main settings-screen__workspace-main",children:l.jsx("div",{className:"settings-screen__body",children:l.jsxs("div",{className:"settings-shell",children:[l.jsxs("header",{className:"settings-page-header",children:[l.jsx("button",{type:"button",className:"settings-card__back",onClick:tn,"aria-label":"返回会话",children:l.jsx(Vk,{})}),l.jsx("div",{className:"settings-page-header__copy",children:l.jsx("h1",{className:"settings-page-header__title",children:"设置"})})]}),w?l.jsxs("div",{className:"settings-workspace",children:[l.jsxs("aside",{className:"settings-sidebar",children:[l.jsx("div",{className:"settings-sidebar__title",children:"设置"}),l.jsx("nav",{className:"settings-sidebar__nav","aria-label":"设置导航",children:_f.map(j=>{const z=j.id===m;return l.jsxs("button",{type:"button",className:`settings-sidebar__item ${z?"is-active":""}`,onClick:()=>b(j.id),children:[l.jsx(E2,{icon:j.icon}),l.jsx("span",{children:j.title})]},j.id)})})]}),l.jsxs("main",{className:"settings-stage",children:[l.jsx("header",{className:"settings-stage__header",children:l.jsxs("div",{children:[l.jsx("h2",{className:"settings-stage__title",children:xn.title}),l.jsx("p",{className:"settings-stage__description",children:xn.description})]})}),Vs(m)]})]}):l.jsx("div",{className:"settings-mobile-sections",children:_f.map(j=>{const z=g===j.id;return l.jsxs("section",{className:`settings-mobile-card ${z?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"settings-mobile-card__header",onClick:()=>{b(j.id),x(ge=>ge===j.id?null:j.id)},"aria-expanded":z,children:[l.jsxs("span",{className:"settings-mobile-card__title-wrap",children:[l.jsx("span",{className:"settings-mobile-card__icon",children:l.jsx(E2,{icon:j.icon})}),l.jsx("span",{className:"settings-mobile-card__copy",children:l.jsx("span",{className:"settings-mobile-card__title",children:j.title})})]}),l.jsx("span",{className:`settings-mobile-card__chevron ${z?"is-open":""}`,children:l.jsx(Kk,{open:z})})]}),z?l.jsx("div",{className:"settings-mobile-card__body",children:Vs(j.id)}):null]},j.id)})})]})})})})},q1=new Xv,aN=async()=>{},iN=_.lazy(async()=>({default:(await Rp(()=>import("./diagnostics-page-D4xGds9x.js"),__vite__mapDeps([0,1]))).DiagnosticsPage})),rN=()=>l.jsx(_.Suspense,{fallback:l.jsx("main",{className:"diagnostics-page",children:l.jsx("div",{className:"diagnostics-shell",children:l.jsx("section",{className:"diagnostics-card",children:l.jsx("p",{children:"正在载入诊断页…"})})})}),children:l.jsx(iN,{})}),Ml=J9({component:eS}),lN=El({getParentRoute:()=>Ml,path:"/",component:g0}),oN=El({getParentRoute:()=>Ml,path:"/nodes",component:sS}),cN=El({getParentRoute:()=>Ml,path:"/session/$sessionId",component:g0}),uN=El({getParentRoute:()=>Ml,path:"/new-thread/$agentId",component:g0}),dN=El({getParentRoute:()=>Ml,path:"/settings",component:sN}),fN=El({getParentRoute:()=>Ml,path:"/diagnostics",component:rN}),hN=Ml.addChildren([lN,oN,cN,uN,dN,fN]),mN=lb({routeTree:hN,defaultPreload:"intent"});typeof document<"u"&&ny(ty());aN().catch(()=>{}).then(async()=>{await qk(q1),Hk(q1)}).finally(()=>{bv.createRoot(document.getElementById("root")).render(l.jsx(Jv,{client:q1,children:l.jsx(ub,{router:mN})}))});export{dv as g,l as j,_ as r,Mr as u};
130
+ `),vk=n=>n.kind==="entry"&&n.entry.kind==="user",_k=n=>n.kind==="entry"&&n.entry.kind==="assistant",bk=n=>n.kind==="tool-group"?!0:n.entry.kind==="assistant"||n.entry.kind==="thinking"||n.entry.kind==="tool",xk=n=>{if(n.length<=1)return n;const t=[];for(const a of n){const r=t[t.length-1];if(r&&r.kind==="entry"&&a.kind==="entry"&&r.entry.kind==="assistant"&&a.entry.kind==="assistant"&&r.entry.body.trim()===a.entry.body.trim()){t[t.length-1]=a;continue}t.push(a)}return t},Sk=(n,t)=>{const a=xk(n.items),{completion:r}=n,c=a.findLastIndex(h=>_k(h));if(c===-1||!r||!t)return{id:n.id,startedAt:n.startedAt,visibleStartItems:c===-1?a:a.slice(0,c),hiddenItems:[],visibleEndItems:c===-1?[]:a.slice(c),completion:r};let u=0;for(;u<a.length&&vk(a[u]);)u+=1;return{id:n.id,startedAt:n.startedAt,visibleStartItems:a.slice(0,u),hiddenItems:[...a.slice(u,c),...a.slice(c+1)],visibleEndItems:[a[c]],completion:r}},jk=(n,t)=>{const a=[];let r=[],c=null;const u=()=>{for(const p of r)a.push({kind:"item",id:p.kind==="entry"?p.entry.id:p.group.id,item:p});r=[]},h=()=>{c&&((c.items.length>0||c.completion)&&a.push({kind:"turn",turn:Sk(c,t)}),c=null)};for(const p of n){if(p.kind==="turn-start"){h(),c={id:p.id,startedAt:p.startedAt,items:r,completion:null},r=[];continue}if(p.kind==="turn-complete"){if(c){c.completion=p;continue}c={id:p.id,startedAt:null,items:r,completion:p},r=[];continue}if(c){if(c.completion&&!bk(p)){h(),r.push(p);continue}c.items.push(p);continue}r.push(p)}return h(),u(),a},wk=n=>n.run_state!=="running"&&Date.now()-new Date(n.last_event_at).getTime()>=Nw,kk=(n,t)=>{var m,b;const a=t==null?void 0:t.projectPath,r=(t==null?void 0:t.compactCompletedTurns)??!1,c=[];let u=null,h=!1,p=null,y=[];for(let g=0;g<n.length;g+=1){const x=n[g];if(x.kind==="system"&&x.body==="开始处理请求"){c.push({kind:"turn-start",id:x.id,startedAt:x.timestamp}),p=x.timestamp,y=[];continue}if(x.kind==="system"&&x.body==="处理完成"){c.push({kind:"turn-complete",id:x.id,durationLabel:fk(p,x.timestamp),patchSummary:mk(y),completedAt:x.timestamp}),p=null,y=[];continue}if(x.kind==="tool"&&x.title!=="tool-output"){const w=[];let N=g+1;for(;N<n.length&&((m=n[N])==null?void 0:m.kind)==="tool"&&((b=n[N])==null?void 0:b.title)==="tool-output";)w.push(n[N]),N+=1;u=x.id;const T=x.title==="apply_patch"?hk(x.body,a):null;T&&y.push(T),w.length===0&&(h=!0),c.push({kind:"tool-group",group:{id:x.id,commandEntry:x,outputEntries:w,patchSummary:T}}),g=N-1;continue}if(x.kind==="tool"&&x.title==="tool-output"){c.push({kind:"tool-group",group:{id:x.id,commandEntry:x,outputEntries:[],patchSummary:null}}),u=x.id;continue}c.push({kind:"entry",entry:x})}return{blocks:jk(c,r),lastToolGroupId:u,hasRunningToolGroup:h}},Nk=n=>n.kind==="entry"?n.entry.timestamp:n.group.commandEntry.timestamp,Ck=(n,t)=>{var h,p;const a=[...n.visibleStartItems,...n.hiddenItems,...n.visibleEndItems].map(Nk).filter(y=>!!y),r=a.length>0?a[a.length-1]:null,c=n.startedAt??a[0]??((h=n.completion)==null?void 0:h.completedAt)??null,u=((p=n.completion)==null?void 0:p.completedAt)??r??c;return{startMs:c?+new Date(c):null,endMs:u?+new Date(u):null,nextStartMs:t!=null&&t.startedAt?+new Date(t.startedAt):null}},Tk=(n,t)=>{const a=[...t].sort((h,p)=>+new Date(h.started_at)-+new Date(p.started_at)),r=new Set,c=n.filter(h=>h.kind==="turn"),u=new Map(c.map((h,p)=>[h.turn.id,p]));return n.map(h=>{var N;if(h.kind!=="turn")return h;const p=u.get(h.turn.id)??-1,y=p>=0?((N=c[p+1])==null?void 0:N.turn)??null:null,m=Ck(h.turn,y),b=m.startMs??(m.endMs!==null?m.endMs-1200:null),g=m.nextStartMs??(m.endMs!==null?m.endMs+1200:Number.POSITIVE_INFINITY),x=a.find(T=>{if(r.has(T.id))return!1;const C=+new Date(T.started_at),I=T.completed_at?+new Date(T.completed_at):null;return b!==null&&C<b-1200?!1:C<=g+1200||I!==null&&I<=g+1200})??null;return x&&r.add(x.id),{kind:"turn",turn:h.turn,changeSet:x}})},Ek=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),Cp=n=>Math.max(By,Math.min(Mw,n)),Mk=()=>{if(typeof window>"u")return jo;try{const n=window.localStorage.getItem(zy),t=window.localStorage.getItem(hu);if(!n)return window.localStorage.setItem(hu,mu),jo;const a=Number(n);if(!Number.isFinite(a))return window.localStorage.setItem(hu,mu),jo;const c=t!==mu||a===Ew||a>jo?jo:a;return window.localStorage.setItem(hu,mu),Cp(c)}catch{return jo}};function vf({active:n,render:t,fallback:a=null}){const[r,c]=_.useState(!n);return _.useEffect(()=>{if(!n){c(!1);return}c(!1);const u=window.requestAnimationFrame(()=>{c(!0)});return()=>{window.cancelAnimationFrame(u)}},[n]),n?r?l.jsx(l.Fragment,{children:t()}):l.jsx(l.Fragment,{children:a}):null}const Rk=_.memo(function({sessions:t,sessionRunState:a,projectPath:r,renderedBlocks:c,lastToolGroupId:u,sessionChangeSets:h,isSubagentTimelinePending:p,hasTimeline:y,proposedPlanReplyDrafts:m,pendingProposedPlanReplyEntryId:b,canRespondToProposedPlan:g,onProposedPlanReplyDraftChange:x,onSubmitProposedPlanReply:w,onPreviewImage:N}){const[T,C]=_.useState({}),[I,$]=_.useState({}),[H,R]=_.useState({}),[Q,ce]=_.useState(null),[Z,ie]=_.useState(null),ee=_.useRef(null);_.useEffect(()=>{const he=q=>{const Se=q.target;Se instanceof Element&&Se.closest(".conversation-inline-link")||ce(null)};return window.addEventListener("pointerdown",he),()=>{window.removeEventListener("pointerdown",he)}},[]),_.useEffect(()=>()=>{ee.current!==null&&window.clearTimeout(ee.current)},[]);const Y=he=>{C(q=>({...q,[he]:!q[he]}))},F=he=>{$(q=>({...q,[he]:!q[he]}))},_e=he=>{R(q=>({...q,[he]:!q[he]}))},je=async(he,q)=>{var me;const Se=q.trim();if(!Se)return;const Ne=()=>{const Te=document.createElement("textarea");Te.value=Se,Te.setAttribute("readonly","true"),Te.style.position="fixed",Te.style.opacity="0",Te.style.pointerEvents="none",document.body.appendChild(Te),Te.select(),document.execCommand("copy"),document.body.removeChild(Te)};try{(me=navigator.clipboard)!=null&&me.writeText?await navigator.clipboard.writeText(Se):Ne(),ie(he),ee.current!==null&&window.clearTimeout(ee.current),ee.current=window.setTimeout(()=>{ie(Te=>Te===he?null:Te),ee.current=null},1400)}catch{}};function ae(he,q,Se){return l.jsx(_.Suspense,{fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在载入差异详情…"}),children:l.jsx(Gw,{diffText:he,filePath:q,emptyMessage:Se})})}function ue(he,q,Se){const Ne=Q===Se;return l.jsxs("span",{className:`conversation-inline-link ${Ne?"is-active":""}`,children:[l.jsx("button",{type:"button",className:"conversation-inline-link__button",onClick:me=>{me.stopPropagation(),ce(Te=>Te===Se?null:Se)},children:he}),Ne?l.jsx("span",{className:"conversation-inline-link__tooltip",role:"tooltip",children:q}):null]},Se)}function E(he,q,Se=Nr(he,r)){return ue(ak(Se),Se,q)}function U(he,q){return Kw(he).map((Ne,me)=>{const Te=`${q}-${me}`;return Ne.kind==="text"?l.jsx("span",{children:Ne.value},Te):Ne.kind==="code"?l.jsx("code",{className:"conversation-inline-code",children:Ne.value},Te):Ne.kind==="strong"?l.jsx("strong",{children:U(Ne.value,`${Te}-strong`)},Te):Ne.kind==="emphasis"?l.jsx("em",{children:U(Ne.value,`${Te}-emphasis`)},Te):Ne.kind==="skill"?l.jsx("span",{className:"conversation-skill-token",children:Ne.raw},Te):Ne.kind==="command"?l.jsx("span",{className:"conversation-command-token",children:Ne.raw},Te):ue(Ne.label,Ne.path,Te)})}function te(he,q){return Ww(he).map((Ne,me)=>{const Te=`${q}-block-${me}`;if(Ne.kind==="heading"){const Ge=Math.min(Ne.level,3),Ue=Ge===1?"h1":Ge===2?"h2":"h3";return l.jsx(Ue,{className:`conversation-markdown-heading is-level-${Ge}`,children:U(Ne.text,`${Te}-heading`)},Te)}if(Ne.kind==="list"){const Ge=Ne.ordered?"ol":"ul";return l.jsx(Ge,{className:"conversation-markdown-list",children:Ne.items.map((Ue,gt)=>l.jsx("li",{children:U(Ue,`${Te}-item-${gt}`)},`${Te}-item-${gt}`))},Te)}return l.jsx("p",{className:"conversation-markdown-paragraph",children:Ne.lines.map((Ge,Ue)=>l.jsxs("span",{children:[Ue>0?l.jsx("br",{}):null,U(Ge,`${Te}-line-${Ue}`)]},`${Te}-line-${Ue}`))},Te)})}function W(he,q,Se){const Ne=`${he.id}:proposed-plan:${Se}`,me=m[Ne]??"",Te=b===Ne,Ge=!g||Te;return l.jsxs("div",{className:"proposed-plan-card",children:[l.jsx("div",{className:"proposed-plan-card__content",children:te(q,`${Ne}:content`)}),l.jsxs("div",{className:"proposed-plan-card__footer",children:[l.jsx("div",{className:"proposed-plan-card__title",children:"实施此计划?"}),l.jsxs("div",{className:"proposed-plan-card__actions",children:[l.jsx("button",{type:"button",className:"proposed-plan-card__confirm",disabled:Ge,onClick:()=>{w(Ne,"是,实施此计划")},children:Te?"回复中…":"是,实施此计划"}),l.jsxs("div",{className:"proposed-plan-card__custom",children:[l.jsx("input",{type:"text",className:"proposed-plan-card__input",value:me,disabled:Ge,placeholder:"否,请告知如何调整",onChange:Ue=>{x(Ne,Ue.target.value)},onKeyDown:Ue=>{Ue.key!=="Enter"||!me.trim()||Ge||(Ue.preventDefault(),w(Ne,me))}}),l.jsx("button",{type:"button",className:"proposed-plan-card__submit",disabled:Ge||!me.trim(),onClick:()=>{w(Ne,me)},children:Te?"回复中…":"回复"})]})]})]})]},Ne)}function xe(he){const q=Xw(he.body);return q.some(Ne=>Ne.kind==="proposed-plan")?q.map((Ne,me)=>{const Te=`${he.id}-content-${me}`;return Ne.kind==="markdown"?l.jsx("div",{className:"conversation-entry__rich-block",children:te(Ne.content,Te)},Te):W(he,Ne.content,me)}):te(he.body,he.id)}function A(he){const q=P3([],he.attachments);if(q.length===0)return null;const Se=q.filter(Z6),Ne=q.filter(me=>!Z6(me));return l.jsxs("div",{className:"conversation-entry__attachments",children:[Se.length>0?l.jsx("div",{className:"conversation-entry__attachment-grid",children:Se.map(me=>{const Te=Sp(me.size_bytes),Ge=me.name??"图片",Ue=`图片${Te?` · ${Te}`:""}`,gt=l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"conversation-entry__attachment-media",children:me.content_url?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:me.content_url,alt:Ge,loading:"lazy"}),l.jsx("span",{className:"conversation-entry__attachment-badge",children:"预览"})]}):l.jsx("div",{className:"conversation-entry__attachment-fallback",children:"无法预览"})}),l.jsxs("div",{className:"conversation-entry__attachment-caption",children:[l.jsx("span",{className:"conversation-entry__attachment-title",children:Ge}),l.jsx("span",{className:"conversation-entry__attachment-meta",children:Ue})]})]});return me.content_url?l.jsx("button",{type:"button",className:"conversation-entry__attachment-card is-image",onClick:()=>N({src:me.content_url,label:Ge,meta:Ue}),"aria-label":`预览 ${Ge}`,children:gt},`${he.id}:${me.id}`):l.jsx("div",{className:"conversation-entry__attachment-card is-image",children:gt},`${he.id}:${me.id}`)})}):null,Ne.length>0?l.jsx("div",{className:"conversation-entry__file-list",children:Ne.map(me=>{const Te=Sp(me.size_bytes),Ge=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-entry__file-icon","aria-hidden":"true",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),l.jsx("path",{d:"M14 3v5h5"}),l.jsx("path",{d:"M9 13h6"}),l.jsx("path",{d:"M9 17h4"})]})}),l.jsxs("span",{className:"conversation-entry__file-copy",children:[l.jsx("span",{className:"conversation-entry__file-title",children:me.name??"附件"}),l.jsxs("span",{className:"conversation-entry__file-meta",children:["文件",Te?` · ${Te}`:""]})]})]});return me.content_url?l.jsx("a",{className:"conversation-entry__file-card",href:me.content_url,download:me.name??void 0,target:"_blank",rel:"noreferrer",children:Ge},`${he.id}:${me.id}`):l.jsx("div",{className:"conversation-entry__file-card",children:Ge},`${he.id}:${me.id}`)})}):null]})}function ne(he,q){return l.jsx("div",{className:"turn-patch-summary__files",children:q.map(Se=>{const Ne=`${he}:${Se.path}`,me=!!H[Ne];return l.jsxs("div",{className:`turn-patch-file ${me?"is-expanded":""}`,children:[l.jsxs("button",{type:"button",className:"turn-patch-file__toggle",onClick:()=>_e(Ne),"aria-expanded":me,children:[l.jsx("div",{className:"turn-patch-file__path",children:Se.pathLabel}),l.jsxs("div",{className:"turn-patch-file__meta",children:[l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",Se.additions]}),l.jsxs("span",{className:"is-remove",children:["-",Se.deletions]})]}),l.jsx("span",{className:"turn-patch-file__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]})]}),me?l.jsx("div",{className:"turn-patch-file__detail",children:l.jsx(vf,{active:me,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开差异…"}),render:()=>ae(Se.diff,Se.path,Se.emptyMessage)})}):null]},Ne)})})}function be(he){return Jw(he).map(q=>{const Se=`live:${he.id}:${q.item_id??"summary"}:${q.path}`,Ne=!!H[Se],me=he.status==="running";return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry ${me?"is-running":"is-complete"} ${Ne?"is-expanded":""} is-patch`,children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>_e(Se),"aria-expanded":Ne,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:"已编辑"}),l.jsx("span",{className:"tool-entry__command",children:E(q.path,`${Se}:live-link`,Nr(q.path,r))}),l.jsxs("span",{className:"tool-entry__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Ne?l.jsx("div",{className:"tool-entry__details",children:l.jsx(vf,{active:Ne,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>l.jsx("div",{className:"tool-entry__patch-list",children:l.jsxs("div",{className:"patch-file-card",children:[l.jsxs("div",{className:"patch-file-card__header",children:[l.jsx("div",{className:"patch-file-card__path",children:Nr(q.path,r)}),l.jsxs("div",{className:"patch-file-card__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]}),l.jsx("div",{className:"patch-file-card__diff",children:ae(q.diff,q.path,"此变更还没有可展示的补丁内容")})]})})})}):null]})},Se)})}function V(he){const q=ek(he,r),Se=q.reduce((me,Te)=>me+Te.additions,0),Ne=q.reduce((me,Te)=>me+Te.deletions,0);return l.jsxs("div",{className:"turn-patch-summary",children:[l.jsx("div",{className:"turn-patch-summary__header",children:l.jsxs("div",{className:"turn-patch-summary__title",children:[l.jsxs("span",{children:[q.length," 个文件已更改"]}),l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",Se]}),l.jsxs("span",{className:"is-remove",children:["-",Ne]})]})]})}),ne(`summary:${he.id}`,q)]})}function pe(he,q){return l.jsxs("div",{className:"turn-patch-summary",children:[l.jsx("div",{className:"turn-patch-summary__header",children:l.jsxs("div",{className:"turn-patch-summary__title",children:[l.jsxs("span",{children:[q.files.length," 个文件已更改"]}),l.jsxs("span",{className:"turn-patch-summary__counts",children:[l.jsxs("span",{className:"is-add",children:["+",q.additions]}),l.jsxs("span",{className:"is-remove",children:["-",q.deletions]})]})]})}),ne(he,q.files.map(Se=>({path:Se.path,pathLabel:Se.displayPath,additions:Se.additions,deletions:Se.deletions,diff:Se.diffText,emptyMessage:"此变更没有可展示的补丁内容"})))]})}function Ce(he,q){var Lt,St;const Se=q.agentId?t.find(st=>st.id===q.agentId)??null:null,Ne=Py(((Lt=Se==null?void 0:Se.subagent)==null?void 0:Lt.nickname)??(Se==null?void 0:Se.title)??q.agentId),me=`subagent:${he.id}`,Te=!!T[me],Ge=q.state==="working",Ue=q.state==="completed"?"子代理返回":q.state==="shutdown"?"子代理已关闭":q.state==="errored"?"子代理异常":"子代理处理中",gt=((St=Se==null?void 0:Se.subagent)==null?void 0:St.nickname)??(Se==null?void 0:Se.title)??"子代理";return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry is-subagent ${Ge?"is-running":"is-complete"} ${Te?"is-expanded":""}`,style:{"--subagent-accent":Ne},children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Y(me),"aria-expanded":Te,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:Ue}),l.jsx("span",{className:"tool-entry__command tool-entry__command--agent",children:gt})]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?l.jsx("div",{className:"tool-entry__details",children:l.jsx(vf,{active:Te,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:gt}),l.jsx("div",{className:"tool-entry__markdown",children:te(q.body,`${he.id}-subagent`)})]})})}):null]})},he.id)}function Le(he){var Ne;if(he.kind==="tool-group"){const{group:me}=he;if(me.commandEntry.title==="apply_patch"&&dk(h,me.commandEntry.timestamp))return null;const Te=!!T[me.id],Ge=a==="running"&&u===me.id&&me.outputEntries.length===0,Ue=me.commandEntry.title==="apply_patch"&&!!me.patchSummary,gt=Ue?me.patchSummary.files.length===1?me.patchSummary.files[0].displayPath:`${me.patchSummary.files.length} 个文件`:pk(me.commandEntry),Lt=gk(me.commandEntry),St=yk(me.outputEntries);return l.jsx("section",{className:"conversation-entry is-tool-group",children:l.jsxs("div",{className:`tool-entry ${Ge?"is-running":"is-complete"} ${Te?"is-expanded":""} ${Ue?"is-patch":""}`,children:[l.jsxs("button",{type:"button",className:"tool-entry__toggle",onClick:()=>Y(me.id),"aria-expanded":Te,children:[l.jsxs("div",{className:"tool-entry__summary",children:[l.jsx("span",{className:"tool-entry__status",children:Ue?"已编辑":Ge?"正在执行":"已执行"}),l.jsx("span",{className:"tool-entry__command",children:Ue&&((Ne=me.patchSummary)==null?void 0:Ne.files.length)===1?E(me.patchSummary.files[0].path,`${me.id}:patch-link`,me.patchSummary.files[0].displayPath):gt}),Ue&&me.patchSummary?l.jsxs("span",{className:"tool-entry__counts",children:[l.jsxs("span",{className:"is-add",children:["+",me.patchSummary.additions]}),l.jsxs("span",{className:"is-remove",children:["-",me.patchSummary.deletions]})]}):null]}),l.jsx("span",{className:"tool-entry__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?l.jsx("div",{className:"tool-entry__details",children:l.jsx(vf,{active:Te,fallback:l.jsx("div",{className:"patch-file-card__empty",children:"正在展开详情…"}),render:()=>Ue&&me.patchSummary?l.jsx("div",{className:"tool-entry__patch-list",children:me.patchSummary.files.map(st=>l.jsxs("div",{className:"patch-file-card",children:[l.jsxs("div",{className:"patch-file-card__header",children:[l.jsx("div",{className:"patch-file-card__path",children:st.displayPath}),l.jsxs("div",{className:"patch-file-card__counts",children:[l.jsxs("span",{className:"is-add",children:["+",st.additions]}),l.jsxs("span",{className:"is-remove",children:["-",st.deletions]})]})]}),l.jsx("div",{className:"patch-file-card__diff",children:ae(st.diffText,st.path,"此变更没有可展示的补丁内容")})]},`${me.id}-${st.path}`))}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:"命令"}),l.jsx("pre",{className:"tool-entry__pre",children:Lt})]}),St?l.jsxs("div",{className:"tool-entry__section",children:[l.jsx("div",{className:"tool-entry__label",children:"输出"}),l.jsx("pre",{className:"tool-entry__pre",children:St})]}):null]})})}):null]})},me.id)}const q=he.entry,Se=q.kind==="user"?rk(q.body):null;if(Se)return Ce(q,Se);if(q.kind==="thinking")return a!=="running"?null:l.jsx("section",{className:"conversation-entry is-thinking-status",children:l.jsx("div",{className:"thinking-status-pill",children:l.jsx("span",{children:"正在思考"})})},q.id);if(Zw(q))return l.jsx("section",{className:"conversation-context-compact",children:l.jsx("div",{className:"context-compact-divider",children:l.jsx("span",{children:"背景信息已自动压缩"})})},q.id);if(q.kind==="system"&&q.title==="system_prompt")return null;if(q.kind==="system"&&q.title==="runtime-status"){const me=nk(q.body);return l.jsx("section",{className:"conversation-entry is-runtime-status",children:l.jsxs("div",{className:`runtime-status-entry is-${me}`,children:[l.jsx("div",{className:"runtime-status-entry__label",children:sk(q.body)}),l.jsx("pre",{className:"runtime-status-entry__body",children:q.body})]})},q.id)}return l.jsx("section",{className:`conversation-entry ${q.kind==="user"?"is-user":"is-system"} is-${q.kind}`,children:q.kind==="user"?l.jsxs("div",{className:"conversation-entry__stack",children:[l.jsxs("div",{className:"conversation-entry__body",children:[q.body.trim()?te(q.body,q.id):null,q.attachments.length>0?A(q):null]}),q.body.trim()?l.jsxs("button",{type:"button",className:`conversation-entry__copy ${Z===q.id?"is-copied":""}`,onClick:()=>{je(q.id,q.body)},"aria-label":Z===q.id?"已复制消息":"复制消息",children:[l.jsx("span",{className:"conversation-entry__copy-icon","aria-hidden":"true",children:Z===q.id?l.jsx(Lw,{}):l.jsx(Ow,{})}),l.jsx("span",{className:"sr-only",children:Z===q.id?"已复制":"复制"})]}):null]}):l.jsxs("div",{className:"conversation-entry__body",children:[q.body.trim()?q.kind==="assistant"?xe(q):te(q.body,q.id):null,q.attachments.length>0?A(q):null]})},q.id)}return p?l.jsx("div",{className:"empty-panel",children:"正在载入子代理会话…"}):y?c.map(he=>{var Ge;if(he.kind==="item")return Le(he.item);const{turn:q}=he,Se=he.changeSet,Ne=((Ge=q.completion)==null?void 0:Ge.patchSummary)??null,me=!!I[q.id],Te=q.hiddenItems.length>0&&!me;return l.jsxs("section",{className:"conversation-turn",children:[q.visibleStartItems.map(Ue=>Le(Ue)),q.hiddenItems.length>0?l.jsxs("div",{className:"conversation-turn__history",children:[l.jsxs("button",{type:"button",className:`turn-history-toggle ${me?"is-expanded":""}`,onClick:()=>F(q.id),"aria-expanded":me,children:[l.jsx("span",{className:"turn-history-toggle__label",children:me?`收起前${q.hiddenItems.length}条消息`:`上${q.hiddenItems.length}条消息`}),l.jsx("span",{className:"turn-history-toggle__chevron","aria-hidden":"true",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"m9 6 6 6-6 6"})})})]}),Te?null:q.hiddenItems.map(Ue=>Le(Ue))]}):null,q.completion&&q.visibleEndItems.length>0?l.jsx("section",{className:"conversation-turn-complete",children:l.jsx("div",{className:"turn-complete-divider",children:l.jsx("span",{children:q.completion.durationLabel})})}):null,q.visibleEndItems.map(Ue=>Le(Ue)),Se&&Se.source==="app-server"&&Se.files.length>0?be(Se):null,q.completion&&q.visibleEndItems.length===0?l.jsx("section",{className:"conversation-turn-complete",children:l.jsx("div",{className:"turn-complete-divider",children:l.jsx("span",{children:q.completion.durationLabel})})}):null,Se&&Se.status==="completed"&&Se.files.length>0?V(Se):Ne?pe(`turn-summary:${q.id}`,Ne):null]},q.id)}):l.jsx("div",{className:"empty-panel",children:"这个会话还没有历史记录。"})}),Ak=({sessionId:n,embedded:t=!1,isDesktopSidebar:a,sidebarOffset:r=0,isSidebarDragging:c=!1,onOpenSidebar:u,onSelectSession:h,onExitToNodes:p}={})=>{var Gl,Oa,vc,Qr,Xa,hd,ns,Vl,Ws,_c,Gr,La,Kl,bc,Yl;const{sessionId:y}=Uu({strict:!1}),m=n??y??"",b=Mr(),g=Tl(),{data:x}=qu({queryKey:dt,scope:{sessionId:m}}),w=_.useRef(null),N=_.useRef(null),T=_.useRef(null),C=_.useRef(null),I=_.useRef(null),[$,H]=_.useState(!1),[R,Q]=_.useState(()=>typeof window<"u"&&window.innerWidth>=x2),[ce,Z]=_.useState(()=>Mk()),[ie,ee]=_.useState(!1),[Y,F]=_.useState(""),[_e,je]=_.useState([]),[ae,ue]=_.useState(null),[E,U]=_.useState(null),[te,W]=_.useState(null),[xe,A]=_.useState(()=>c0()),[ne,be]=_.useState(()=>jy()),[V,pe]=_.useState(()=>K6(m)),[Ce,Le]=_.useState(()=>Y6(m)),he=d0(),q=_.useMemo(()=>he.map(({id:S,...D})=>D),[he]),[Se,Ne]=_.useState({}),[me,Te]=_.useState(null),[Ge,Ue]=_.useState(!1),[gt,Lt]=_.useState(!1),[St,st]=_.useState(""),[tn,$t]=_.useState(!1),[de,Ae]=_.useState(!1),[Re,Oe]=_.useState(null),[Ke,mt]=_.useState(null),[kt,rn]=_.useState(!1),[Pn,On]=_.useState(!1),[nn,ln]=_.useState("code"),[oe,qe]=_.useState(!1),[De,Ie]=_.useState(null),[We,$e]=_.useState(null),[He,Ee]=_.useState(!1),[Ut,at]=_.useState(!1),[pn,Un]=_.useState(!1),[xn,ps]=_.useState(!1),[gs,is]=_.useState(null),[Ci,la]=_.useState(null),[Gs,rs]=_.useState({}),[xa,Vs]=_.useState(!1),[ls,j]=_.useState({state:"connected",attempt:0,maxAttempts:5}),z=_.useRef({});_.useEffect(()=>{bu(xe)},[xe]),_.useEffect(()=>{wy(ne)},[ne]),_.useEffect(()=>{q.length!==0&&(q.some(S=>S.value===xe)||A(q[0].value))},[q,xe]),_.useEffect(()=>{pe(K6(m)),Le(Y6(m)),W(null),ln("code"),qe(!1),Ie(null),$e(null),Ee(!1),at(!1),Un(!1),ps(!1),is(null),la(null),rs({})},[m]),_.useEffect(()=>{z.current=Gs},[Gs]),_.useEffect(()=>{ky(m,V)},[V,m]),_.useEffect(()=>{Ny(m,Ce)},[Ce,m]),_.useEffect(()=>{Ne({}),Te(null)},[m]),_.useEffect(()=>{if(!ae)return;const S=K=>{K.key==="Escape"&&ue(null)},D=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",S),()=>{document.body.style.overflow=D,window.removeEventListener("keydown",S)}},[ae]);const[ge,we]=_.useState(!1),ke=_.useRef(null),Ve=_.useRef(null),ct=_.useRef(null),Nt=_.useRef({}),qn=_.useRef({}),es=_.useRef(null),Ht=_.useRef(null),wn=_.useRef(null),kn=_.useRef(ce),Ln=_.useRef(null),un=_.useRef(null),B=x==null?void 0:x.sessions.find(S=>S.id===m),on=(x==null?void 0:x.agents.find(S=>S.id===(B==null?void 0:B.agent_id)))??(x==null?void 0:x.agents[0]),gn=x==null?void 0:x.projects.find(S=>S.id===(B==null?void 0:B.project_id)),yn=(B==null?void 0:B.capability.can_show_git)??!1,sn=(B==null?void 0:B.capability.can_show_terminal)??!1,Ft=_.useCallback(()=>Jn({sessionId:m,projectId:(B==null?void 0:B.project_id)??null,agentId:(B==null?void 0:B.agent_id)??null}),[B==null?void 0:B.agent_id,B==null?void 0:B.project_id,m]),Fa=_.useCallback(async S=>{if(t){h==null||h(S);return}window.localStorage.setItem(_2,S),await b({to:"/session/$sessionId",params:{sessionId:S}})},[t,b,h]),Rr=_.useCallback(async()=>{if(t){p==null||p();return}await b({to:"/nodes"})},[t,b,p]),Qu=S=>S instanceof Element&&!!S.closest('button, textarea, input, a, [role="dialog"]'),Sa=()=>{const S=T.current;if(!S)return;const D=()=>{S.scrollTo({top:S.scrollHeight,behavior:"auto"})};D(),window.requestAnimationFrame(()=>{D(),window.requestAnimationFrame(D)})},Rl=()=>{const S=T.current;if(!S){Vs(!1);return}const D=S.scrollHeight-S.scrollTop-S.clientHeight;Vs(D>Rw)},oa=_.useMemo(()=>((x==null?void 0:x.projects)??[]).filter(S=>S.agent_id===(on==null?void 0:on.id)),[on==null?void 0:on.id,x==null?void 0:x.projects]),$n=_.useMemo(()=>((x==null?void 0:x.sessions)??[]).filter(S=>S.agent_id===(on==null?void 0:on.id)).sort((S,D)=>Number(D.pinned)-Number(S.pinned)||+new Date(D.last_event_at)-+new Date(S.last_event_at)),[on==null?void 0:on.id,x==null?void 0:x.sessions]),dn=_.useMemo(()=>{var S;return(S=B==null?void 0:B.subagent)!=null&&S.parent_session_id?$n.find(D=>{var K;return D.id===((K=B.subagent)==null?void 0:K.parent_session_id)})??null:null},[(Gl=B==null?void 0:B.subagent)==null?void 0:Gl.parent_session_id,$n]),Qa=Es({queryKey:["timeline",m],enabled:!!m,queryFn:async()=>{const D=await(await Ft()).client.getSessionTimeline(m);return g.setQueryData(ir(m),K=>Cf(K,D)),bp(g.getQueryData(["timeline",m]),D)},initialData:m===(x==null?void 0:x.active_session_id)?x.timeline:void 0,refetchInterval:!1}),Ti=Es({queryKey:ir(m),enabled:!1,queryFn:async()=>[],initialData:[]}),Ga=Es({queryKey:["timeline",dn==null?void 0:dn.id,"prefix-source"],enabled:!!(dn!=null&&dn.id),queryFn:async()=>(await Jn({sessionId:dn.id,projectId:dn.project_id,agentId:dn.agent_id})).client.getSessionTimeline(dn.id),refetchInterval:!1}),ja=_.useMemo(()=>B!=null&&B.subagent?new Set:ck(Qa.data??[]),[B==null?void 0:B.subagent,Qa.data]),Xo=_.useMemo(()=>ok(Qa.data??[]),[Qa.data]),ts=_.useMemo(()=>B!=null&&B.subagent?[]:$n.filter(S=>{var D;return S.id!==m&&((D=S.subagent)==null?void 0:D.parent_session_id)===m&&!S.archived}).filter(S=>{if(S.run_state==="running")return!0;if(!((B==null?void 0:B.run_state)==="running"||tn))return!1;if(ja.has(S.id))return!0;if(!Xo)return!1;const D=new Date(Xo).getTime(),K=new Date(S.last_event_at).getTime();return Number.isFinite(D)&&Number.isFinite(K)&&K>=D-Tw}).sort((S,D)=>+new Date(D.last_event_at)-+new Date(S.last_event_at)),[Xo,tn,ja,B==null?void 0:B.run_state,B==null?void 0:B.subagent,m,$n]),Jo=Es({queryKey:["change-sets",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionChangeSets(m),refetchInterval:!1}),Va=Es({queryKey:["session-git-workspace",m],enabled:!!(m&&yn&&nn==="git"),queryFn:async()=>(await Ft()).client.getSessionGitWorkspace(m),refetchInterval:!1}),ys=Es({queryKey:["session-git-history",m],enabled:!1,queryFn:async()=>(await Ft()).client.getSessionGitHistory(m),refetchInterval:!1}),Rs=Es({queryKey:["session-run-workbench",m],enabled:!!(m&&sn),queryFn:async()=>(await Ft()).client.getSessionRunWorkbench(m),refetchInterval:!1}),vs=Es({queryKey:["plan",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionPlan(m),refetchInterval:!1}),Al=Es({queryKey:["interactions",m],enabled:!!m,queryFn:async()=>(await Ft()).client.getSessionInteractions(m),refetchInterval:!1,initialData:[]}),ca=_.useCallback(async(S,D)=>{if(m){rs(K=>{var le,et,Ye;return{...K,[S]:{chunks:((le=K[S])==null?void 0:le.chunks)??[],nextCursor:((et=K[S])==null?void 0:et.nextCursor)??0,truncated:((Ye=K[S])==null?void 0:Ye.truncated)??!1,isLoading:!0,error:null}}});try{const K=await Ft(),le=z.current[S],et=await K.client.getSessionTerminalOutput({sessionId:m,terminalId:S,cursor:D!=null&&D.force||le!=null&&le.truncated||le==null?void 0:le.nextCursor});rs(Ye=>{const pt=Ye[S],ot=D!=null&&D.force||et.truncated||!pt?et.chunks:S2(pt.chunks,et.chunks);return{...Ye,[S]:{chunks:ot,nextCursor:et.next_cursor,truncated:et.truncated,isLoading:!1,error:null}}})}catch(K){rs(le=>{var et,Ye,pt;return{...le,[S]:{chunks:((et=le[S])==null?void 0:et.chunks)??[],nextCursor:((Ye=le[S])==null?void 0:Ye.nextCursor)??0,truncated:((pt=le[S])==null?void 0:pt.truncated)??!1,isLoading:!1,error:K instanceof Error?K.message:"无法读取终端输出。"}}})}}},[m]);_.useEffect(()=>{var le,et;const S=(le=Rs.data)==null?void 0:le.terminal_snapshot.active_terminal_id,D=(et=Rs.data)==null?void 0:et.terminal_snapshot.terminals.find(Ye=>Ye.id===S);if(!S||!D)return;const K=Gs[S];(!K||K.truncated||K.nextCursor<D.output_cursor)&&ca(S)},[ca,Rs.data,Gs]);const Gu=!!(B!=null&&B.subagent&&(dn!=null&&dn.id)&&Ga.isPending&&!Ga.data),wa=_.useMemo(()=>B!=null&&B.subagent?dn!=null&&dn.id&&Ga.isPending&&!Ga.data?[]:ik(Qa.data??[],Ga.data):Qa.data??[],[dn==null?void 0:dn.id,Ga.data,B==null?void 0:B.subagent,Qa.data]),Ar=_.useMemo(()=>FS(wa,Ti.data),[wa,Ti.data]);_.useEffect(()=>{m&&window.localStorage.setItem(_2,m)},[m]),_.useEffect(()=>{const S=ct.current;S&&((Ti.data??[]).some(D=>D.id===S.optimisticEntryId)||(ct.current=null))},[Ti.data]),_.useEffect(()=>{On(!1)},[m]),_.useEffect(()=>{st((B==null?void 0:B.title)??""),Lt(!1)},[B==null?void 0:B.title,m]),_.useEffect(()=>{Ae(!1)},[m]),_.useEffect(()=>()=>{ke.current&&window.clearTimeout(ke.current),Ve.current&&window.clearTimeout(Ve.current),un.current&&window.cancelAnimationFrame(un.current)},[]),_.useEffect(()=>{if(Ve.current&&(window.clearTimeout(Ve.current),Ve.current=null),!!E)return Ve.current=window.setTimeout(()=>{U(null),Ve.current=null},Aw),()=>{Ve.current&&(window.clearTimeout(Ve.current),Ve.current=null)}},[E]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(zy,String(Cp(ce))),window.localStorage.setItem(hu,mu)}catch{}},[ce]),_.useEffect(()=>{kn.current=ce},[ce]),_.useEffect(()=>{if(typeof window>"u")return;const S=()=>{const D=window.innerWidth>=x2;Q(D),D&&H(!1)};return S(),window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[]),_.useEffect(()=>{if(!ie)return;const S=K=>{const le=wn.current;if(!le)return;const et=K.clientX-le.startX,Ye=Cp(le.startWidth+et);Ln.current=Ye,un.current===null&&(un.current=window.requestAnimationFrame(()=>{un.current=null;const pt=Ln.current,ot=w.current;pt===null||!ot||ot.style.setProperty("--desktop-sidebar-width",`${pt}px`)}))},D=()=>{un.current!==null&&(window.cancelAnimationFrame(un.current),un.current=null);const K=Ln.current??kn.current;Ln.current=null,wn.current=null,ee(!1),kn.current=K,Z(K)};return window.addEventListener("pointermove",S),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)}},[ie]),_.useEffect(()=>{const S=D=>{const K=D.target;rn(!1),we(!1),!(K instanceof Element&&(K.closest(".conversation-topbar__actions")||K.closest(".conversation-topbar__title-actions")||K.closest(".picker-sheet")||K.closest(".picker-sheet-wrap")))&&(Ue(!1),Ee(!1),at(!1))};return window.addEventListener("pointerdown",S),()=>{window.removeEventListener("pointerdown",S)}},[]),_.useEffect(()=>{const S=w.current;if(!S||R)return;const D=Ye=>{if(Ye.touches.length!==1||Qu(Ye.target))return;const pt=Ye.touches[0];lc(pt.clientX,pt.clientY)},K=Ye=>{if(Ye.touches.length!==1||!Ht.current)return;const pt=Ye.touches[0];oc(pt.clientX,pt.clientY)&&Ye.preventDefault()},le=Ye=>{if(!Ht.current)return;const pt=Ye.changedTouches[0];if(!pt){Ht.current=null,Ra(null);return}Di(pt.clientX,pt.clientY)},et=()=>{Ht.current=null,Ra(null)};return S.addEventListener("touchstart",D,{passive:!0,capture:!0}),S.addEventListener("touchmove",K,{passive:!1,capture:!0}),S.addEventListener("touchend",le,{capture:!0}),S.addEventListener("touchcancel",et,{capture:!0}),()=>{S.removeEventListener("touchstart",D,{capture:!0}),S.removeEventListener("touchmove",K,{capture:!0}),S.removeEventListener("touchend",le,{capture:!0}),S.removeEventListener("touchcancel",et,{capture:!0})}},[R,$]),_.useEffect(()=>{if(!m)return;Sa();const S=window.setTimeout(Sa,120);return()=>{window.clearTimeout(S)}},[wa.length,m]),_.useEffect(()=>{const S=T.current;if(!S)return;const D=()=>{Rl()};return D(),S.addEventListener("scroll",D,{passive:!0}),window.addEventListener("resize",D),()=>{S.removeEventListener("scroll",D),window.removeEventListener("resize",D)}},[wa.length,m]),_.useEffect(()=>{let S=!1,D;return Ft().then(K=>{S||(D=K.client.connectEvents(le=>{var pt,ot,Fn,Bs,Ps,Xs,xc,Zl,Wl,Sc,Tn,Wt,jt,ha,os,Xl,ma;const et=typeof((pt=le.payload)==null?void 0:pt.sessionId)=="string"?le.payload.sessionId:null,Ye=et===m;if(le.type==="agent.online"||le.type==="snapshot.changed"){g.invalidateQueries({queryKey:dt});return}if(le.type==="timeline.reset"&&Ye){const it=Array.isArray((ot=le.payload)==null?void 0:ot.entries)?le.payload.entries:[];g.setQueryData(ir(m),wt=>Cf(wt,it)),g.setQueryData(["timeline",m],wt=>bp(wt,it));const Qt=(Fn=it[it.length-1])==null?void 0:Fn.timestamp;Qt&&g.setQueryData(dt,wt=>_p(wt,m,Qt)),Sa();return}if(le.type==="interaction.reset"&&Ye){const it=Array.isArray((Bs=le.payload)==null?void 0:Bs.requests)?le.payload.requests:[];g.setQueryData(["interactions",m],it),Oe(Qt=>Qt&&it.some(wt=>wt.id===Qt)?Qt:null);return}if(le.type==="plan.reset"&&Ye){const it=(Ps=le.payload)!=null&&Ps.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],it);return}if(le.type==="timeline.delta"&&Ye){const it=Array.isArray((Xs=le.payload)==null?void 0:Xs.entries)?le.payload.entries:[];g.setQueryData(ir(m),wt=>Cf(wt,it)),g.setQueryData(["timeline",m],wt=>hy(wt,it));const Qt=(xc=it[it.length-1])==null?void 0:xc.timestamp;Qt&&g.setQueryData(dt,wt=>_p(wt,m,Qt)),Sa();return}if(le.type==="interaction.delta"&&Ye){const it=Array.isArray((Zl=le.payload)==null?void 0:Zl.requests)?le.payload.requests:[],Qt=Array.isArray((Wl=le.payload)==null?void 0:Wl.resolvedRequestIds)?le.payload.resolvedRequestIds.filter(wt=>typeof wt=="string"&&wt.trim().length>0):[];g.setQueryData(["interactions",m],wt=>{const Ot=new Map((wt??[]).map(Gt=>[Gt.id,Gt]));for(const Gt of it)Ot.set(Gt.id,Gt);for(const Gt of Qt)Ot.delete(Gt);return[...Ot.values()].sort((Gt,cs)=>+new Date(cs.updated_at)-+new Date(Gt.updated_at))}),Qt.length>0&&Oe(wt=>wt&&Qt.includes(wt)?null:wt);return}if(le.type==="plan.delta"&&Ye){const it=(Sc=le.payload)!=null&&Sc.planSnapshot&&typeof le.payload.planSnapshot=="object"?le.payload.planSnapshot:null;g.setQueryData(["plan",m],it);return}if(le.type==="changeset.reset"&&Ye){const it=Array.isArray((Tn=le.payload)==null?void 0:Tn.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],it);return}if(le.type==="changeset.delta"&&Ye){const it=Array.isArray((Wt=le.payload)==null?void 0:Wt.changeSets)?le.payload.changeSets:[];g.setQueryData(["change-sets",m],Qt=>{const wt=new Map((Qt??[]).map(Ot=>[Ot.id,Ot]));for(const Ot of it)wt.set(Ot.id,Ot);return[...wt.values()].sort((Ot,Gt)=>+new Date(Ot.started_at)-+new Date(Gt.started_at))});return}if(le.type==="terminal.snapshot"&&Ye){const it=(jt=le.payload)!=null&&jt.snapshot&&typeof le.payload.snapshot=="object"?le.payload.snapshot:null;if(!it)return;g.setQueryData(["session-run-workbench",m],Qt=>Qt&&{...Qt,terminal_snapshot:it}),rs(Qt=>{const wt=new Set(it.terminals.map(Gt=>Gt.id)),Ot={};for(const[Gt,cs]of Object.entries(Qt))wt.has(Gt)&&(Ot[Gt]=cs);return Ot});return}if(le.type==="terminal.delta"&&Ye){const it=(ha=le.payload)!=null&&ha.terminal&&typeof le.payload.terminal=="object"?le.payload.terminal:null,Qt=Array.isArray((os=le.payload)==null?void 0:os.chunks)?le.payload.chunks:[],wt=typeof((Xl=le.payload)==null?void 0:Xl.activeTerminalId)=="string"?le.payload.activeTerminalId:null;if(!it)return;g.setQueryData(["session-run-workbench",m],Ot=>{if(!Ot)return Ot;const Gt=Ot.terminal_snapshot.terminals.filter(pa=>pa.id!==it.id),cs=Ot.terminal_snapshot.terminals.findIndex(pa=>pa.id===it.id),Vr=[...Gt];return cs<=0?Vr.unshift(it):Vr.splice(cs,0,it),{...Ot,terminal_snapshot:{...Ot.terminal_snapshot,active_terminal_id:wt,updated_at:it.updated_at,terminals:Vr}}}),rs(Ot=>{var cs;if(Qt.length===0)return Ot;const Gt=Ot[it.id];return{...Ot,[it.id]:{chunks:S2((Gt==null?void 0:Gt.chunks)??[],Qt),nextCursor:typeof((cs=le.payload)==null?void 0:cs.nextCursor)=="number"?le.payload.nextCursor:it.output_cursor,truncated:(Gt==null?void 0:Gt.truncated)??!1,isLoading:!1,error:null}}});return}if(le.type==="session.updated"&&et){const it=(ma=le.payload)!=null&&ma.sessionPatch&&typeof le.payload.sessionPatch=="object"?le.payload.sessionPatch:null,Qt=g.getQueryData(dt);it&&a0(Qt,et)?g.setQueryData(dt,wt=>Nf(wt,et,it)):g.invalidateQueries({queryKey:dt}),Ye&&((it==null?void 0:it.run_state)==="running"||(it==null?void 0:it.run_state)==="completed"||(it==null?void 0:it.run_state)==="idle")&&($t(it.run_state==="running"),it.run_state!=="running"&&Ae(!1));return}le.type==="turn.completed"&&Ye&&($t(!1),Ae(!1),g.setQueryData(["plan",m],null))},{sessionId:m,onStatus:le=>{j(le),le.state==="connected"&&we(!1)}}))}),()=>{S=!0,D==null||D()}},[g,Ft,m]),_.useEffect(()=>{if(!m||(B==null?void 0:B.run_state)!=="running"||B.context_usage)return;let S=!1;const D=window.setTimeout(()=>{S||g.invalidateQueries({queryKey:dt})},1200);return()=>{S=!0,window.clearTimeout(D)}},[g,m,B==null?void 0:B.context_usage,B==null?void 0:B.run_state]),_.useEffect(()=>{Ue(!1)},[R,m]);const Dl=_.useCallback(S=>{var D;W(S),((D=S.effect)==null?void 0:D.type)==="set_session_model"&&(A(S.effect.model),S.effect.reasoning_effort&&be(S.effect.reasoning_effort))},[]),ka=Vn({mutationFn:async S=>(await Ft()).client.sendSessionInput(S),onMutate:async S=>{await g.cancelQueries({queryKey:["timeline",S.sessionId]}),U(null),Ae(!1),$t(!0),Te(S.proposedPlanEntryId??null);const D=S.clearComposer!==!1;D&&(F(""),je([])),ke.current&&window.clearTimeout(ke.current);const K=new Date().toISOString(),le=`${i0}${S.sessionId}:${Date.now()}`;ct.current=D?{optimisticEntryId:le,draft:S.input,attachments:S.attachments}:null,g.setQueryData(ir(S.sessionId),et=>fy(et,{id:le,kind:"user",title:"你",body:S.input,timestamp:K,accent:"primary",attachments:Ey(S.attachments)})),g.setQueryData(dt,et=>{var Ye;return Nf(et,S.sessionId,{run_state:"running",run_state_changed_at:K,last_event_at:K,summary:S.input||((Ye=S.attachments[0])==null?void 0:Ye.name)||"附件"})})},onSuccess:async(S,D)=>{Te(null),D.proposedPlanEntryId&&Ne(K=>{const le={...K};return delete le[D.proposedPlanEntryId],le}),await g.invalidateQueries({queryKey:dt}),await g.invalidateQueries({queryKey:["plan",D.sessionId]}),await g.invalidateQueries({queryKey:["change-sets",D.sessionId]}),ke.current=null},onError:(S,D)=>{Te(null),$t(!1);const K=ct.current;K&&(g.setQueryData(ir(D.sessionId),le=>QS(le,K.optimisticEntryId)),F(le=>le||K.draft),je(le=>le.length>0?le:K.attachments),ct.current=null),U(S instanceof Error?S.message:"无法发送消息")}}),Ol=Vn({mutationFn:async S=>(await Ft()).client.executeSessionCommand(S),onMutate:S=>{U(null),F(""),je([]);const D=S.input.slice(1).trim().split(/\s+/)[0]??"",K=new Date().toISOString();W({panel_id:`command-panel-pending-${Date.now()}`,session_id:S.sessionId,command_name:D,command_text:S.input,title:`正在执行 /${D}`,description:null,status:"running",body:"命令执行中…",submitted_at:K,updated_at:K,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null})},onSuccess:async S=>{Dl(S.panel),await g.invalidateQueries({queryKey:dt})},onError:(S,D)=>{W(null),F(K=>K||D.input),U(S instanceof Error?S.message:"无法执行命令")}}),ua=Vn({mutationFn:async S=>(await Ft()).client.respondToSessionCommand(S),onMutate:()=>{U(null)},onSuccess:async S=>{Dl(S.panel),await g.invalidateQueries({queryKey:dt})},onError:S=>{U(S instanceof Error?S.message:"无法继续执行命令")}}),Ks=Vn({mutationFn:async S=>(await Ft()).client.respondToSessionInteraction(S),onMutate:async S=>{U(null),Oe(S.requestId),g.setQueryData(["interactions",S.sessionId],D=>(D??[]).map(K=>K.id===S.requestId?{...K,status:"submitting",updated_at:new Date().toISOString()}:K))},onSuccess:async(S,D)=>{await g.invalidateQueries({queryKey:["interactions",D.sessionId]})},onError:(S,D)=>{g.setQueryData(["interactions",D.sessionId],K=>(K??[]).map(le=>le.id===D.requestId?{...le,status:"pending"}:le)),Oe(null),U(S instanceof Error?S.message:"无法提交确认回复")}}),As=Vn({mutationFn:async S=>(await Ft()).client.interruptSession(S),onMutate:async S=>{U(null),Ae(!0),$t(!1),ke.current&&(window.clearTimeout(ke.current),ke.current=null);const D=new Date().toISOString(),K=g.getQueryData(dt);return g.setQueryData(dt,le=>Nf(le,S,{run_state:"completed",run_state_changed_at:D,last_event_at:D})),g.setQueryData(["plan",S],null),{previousSnapshot:K,targetSessionId:S}},onSuccess:(S,D)=>{Ae(!1),g.invalidateQueries({queryKey:dt}),g.invalidateQueries({queryKey:["timeline",D]}),g.invalidateQueries({queryKey:["change-sets",D]})},onError:(S,D,K)=>{Ae(!1),$t(!0),K!=null&&K.previousSnapshot&&g.setQueryData(dt,K.previousSnapshot),g.invalidateQueries({queryKey:["plan",D]}),U(S instanceof Error?S.message:"无法中断会话")}});_.useEffect(()=>{!m||!B||de||As.isPending||$t(B.run_state==="running")},[As.isPending,de,B,B==null?void 0:B.run_state,m]);const fn=Vn({mutationFn:async S=>(await Jn({sessionId:S.sessionId})).client.updateSession(S)}),da=Vn({mutationFn:async S=>(await Jn({projectId:S.projectId})).client.updateThread(S)}),Nn=Vn({mutationFn:async S=>(await Ft()).client.executeSessionGitAction({sessionId:m,action:S.action,path:S.path,branch:S.branch,message:S.message}),onMutate:async()=>{Ie(null)},onSuccess:(S,D)=>{g.setQueryData(["session-git-workspace",m],S.workspace),(D.action==="commit-all"||D.action==="switch-branch")&&g.invalidateQueries({queryKey:["session-git-history",m]})},onError:S=>{Ie(S instanceof Error?S.message:"无法执行 git 操作")}}),Ys=Vn({mutationFn:async S=>(await Ft()).client.saveSessionRunCommand({sessionId:m,action:S.action,commandId:S.commandId,command:S.command}),onMutate:()=>{$e(null)},onSuccess:({catalog:S})=>{g.setQueryData(["session-run-workbench",m],D=>D&&{...D,command_catalog:S})},onError:S=>{$e(S instanceof Error?S.message:"无法保存项目命令。")}}),Ds=Vn({mutationFn:async S=>(await Ft()).client.saveSessionRunWebsite({sessionId:m,action:S.action,websiteId:S.websiteId,website:S.website}),onMutate:()=>{$e(null)},onSuccess:({catalog:S})=>{g.setQueryData(["session-run-workbench",m],D=>D&&{...D,website_catalog:S})},onError:S=>{$e(S instanceof Error?S.message:"无法保存项目网页。")}}),Dr=Vn({mutationFn:async()=>(await Ft()).client.generateSessionRunCommand({sessionId:m,prompt:"",model:Tf()}),onMutate:()=>{$e(null),is(null)},onSuccess:({generation:S,catalog:D})=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,command_catalog:D}),is(S.reason)},onError:S=>{$e(S instanceof Error?S.message:"无法一键生成项目命令。")}}),Na=Vn({mutationFn:async()=>(await Ft()).client.generateSessionRunWebsite({sessionId:m,prompt:"",model:Tf()}),onMutate:()=>{$e(null),la(null)},onSuccess:({generation:S,catalog:D})=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,website_catalog:D}),la(S.reason)},onError:S=>{$e(S instanceof Error?S.message:"无法一键生成项目网页。")}}),Zt=Vn({mutationFn:async S=>(await Ft()).client.executeSessionTerminalAction({sessionId:m,action:S.action,commandId:S.commandId,terminalId:S.terminalId}),onMutate:()=>{$e(null)},onSuccess:async(S,D)=>{g.setQueryData(["session-run-workbench",m],K=>K&&{...K,terminal_snapshot:S.snapshot}),(D.action==="run-command"||D.action==="run-kill-command")&&S.terminal&&(Ee(!1),ln("terminal"),await ca(S.terminal.id,{force:!0})),D.action==="focus"&&D.terminalId&&await ca(D.terminalId),D.action==="close"&&D.terminalId&&rs(K=>{const le={...K};return delete le[D.terminalId],le})},onError:S=>{$e(S instanceof Error?S.message:"无法执行终端操作。")}}),Ei=Jo.data??[],Mi=B?wk(B):!1,Os=_.useMemo(()=>kk(Ar,{projectPath:gn==null?void 0:gn.path,compactCompletedTurns:Mi}),[Mi,gn==null?void 0:gn.path,Ar]),Or=_.useMemo(()=>Tk(Os.blocks,Ei),[Os.blocks,Ei]),fa=[...Or].reverse().find(S=>S.kind==="turn"&&!S.turn.completion)??null;if(_.useEffect(()=>{var le;if(typeof window>"u")return;const S=window,D=(le=S.requestIdleCallback)==null?void 0:le.call(S,()=>{kp()},{timeout:1500}),K=D===void 0?window.setTimeout(()=>{kp()},320):null;return()=>{var et;D!==void 0&&((et=S.cancelIdleCallback)==null||et.call(S,D)),K!==null&&window.clearTimeout(K)}},[]),!x||!B||!gn)return l.jsx("div",{className:"conversation-page",children:l.jsx("div",{className:"conversation-main conversation-main--empty",children:l.jsx("div",{className:"empty-panel",children:"没有找到这个会话。"})})});const ec=B.capability.can_send_input&&!de,Ka=(Al.data??[]).filter(S=>S.status==="pending"||S.status==="submitting"),Lr=(B.run_state==="running"||tn)&&!de||As.isPending,Ir=ec&&Ka.length===0&&!Lr&&!ka.isPending,Hn=(on==null?void 0:on.id)??B.agent_id,Ca=_.useCallback((S,D)=>{Ne(K=>{if(!D.trim()){if(!(S in K))return K;const le={...K};return delete le[S],le}return{...K,[S]:D}})},[]),zr=_.useCallback((S,D)=>{const K=D.trim();!K||!Ir||ka.mutate({sessionId:B.id,input:K,attachments:[],model:xe,reasoningEffort:ne,serviceTier:V?"fast":void 0,planMode:Ce,clearComposer:!1,proposedPlanEntryId:S})},[Ir,V,Ce,xe,ne,ka,B.id]),Br=_.useMemo(()=>l.jsx(Rk,{sessions:x.sessions,sessionRunState:B.run_state,projectPath:gn.path,renderedBlocks:Or,lastToolGroupId:Os.lastToolGroupId,sessionChangeSets:Ei,isSubagentTimelinePending:Gu,hasTimeline:Ar.length>0,proposedPlanReplyDrafts:Se,pendingProposedPlanReplyEntryId:me,canRespondToProposedPlan:Ir,onProposedPlanReplyDraftChange:Ca,onSubmitProposedPlanReply:zr,onPreviewImage:ue},B.id),[Ir,Ca,zr,Gu,me,gn.path,Se,Or,Os.lastToolGroupId,B.id,B.run_state,Ei,x.sessions,Ar.length]),Ya=_.useCallback(async(S,D,K)=>{var et;U(null),Ue(!1);const le=g.getQueryData(dt);D==="pin"||D==="unpin"?or.flushSync(()=>{g.setQueryData(dt,Ye=>Kf(Ye,S,{pinned:D==="pin"}))}):D==="rename"&&(K!=null&&K.trim())&&g.setQueryData(dt,Ye=>Kf(Ye,S,{title:K.trim()}));try{const Ye=await fn.mutateAsync({sessionId:S,action:D,name:K}),pt=(et=Ye.affectedSessionIds)!=null&&et.length?Ye.affectedSessionIds:[S];if(D==="delete"){g.setQueryData(dt,ot=>ay(ot,pt));for(const ot of pt)g.removeQueries({queryKey:["timeline",ot],exact:!0}),g.removeQueries({queryKey:ir(ot),exact:!0}),g.removeQueries({queryKey:["change-sets",ot],exact:!0})}else g.setQueryData(dt,ot=>sy(ot,pt,{...D==="rename"&&(K!=null&&K.trim())?{title:K.trim()}:{pinned:D==="pin"}}));if(S===B.id&&D==="delete"){const ot=Ye.nextSessionId;ot?await Fa(ot):await Rr()}}catch(Ye){g.setQueryData(dt,le),U(Ye instanceof Error?Ye.message:"无法更新会话")}},[Rr,Fa,g,B.id,fn]),tc=_.useCallback(async(S,D,K)=>{var Ye,pt;U(null),Ue(!1);const le=g.getQueryData(dt),et=(Ye=K==null?void 0:K.name)==null?void 0:Ye.trim();D==="pin"||D==="unpin"?or.flushSync(()=>{g.setQueryData(dt,ot=>Yf(ot,S,{pinned:D==="pin"}))}):D==="rename"&&et?g.setQueryData(dt,ot=>Yf(ot,S,{display_name:et})):D==="reorder"&&((pt=K==null?void 0:K.orderedProjectIds)!=null&&pt.length)?g.setQueryData(dt,ot=>iy(ot,K.orderedProjectIds??[])):D==="remove"||D==="archive"?g.setQueryData(dt,ot=>ry(ot,S)):D==="unarchive"&&g.setQueryData(dt,ot=>ot&&{...ot,sessions:ot.sessions.map(Fn=>Fn.project_id===S?{...Fn,archived:!1}:Fn)});try{const ot=await da.mutateAsync({projectId:S,action:D,name:K==null?void 0:K.name,orderedProjectIds:K==null?void 0:K.orderedProjectIds});if(D==="remove"||D==="archive"||D==="unarchive"){const Fn=ot.nextSessionId;Fn?await Fa(Fn):await Rr()}}catch(ot){g.setQueryData(dt,le),U(ot instanceof Error?ot.message:"无法更新线程")}},[Rr,Fa,g,da]),nc=_.useCallback(async S=>{Hn&&(xr(Hn),fs(null),Ru(null),Eo(S),await b({to:"/"}))},[Hn,b]),Pr=((Oa=vs.data)==null?void 0:Oa.steps.some(S=>S.status==="pending"||S.status==="in_progress"))??!1,Ta=B.run_state==="running"||tn,Vu=!!((vc=vs.data)!=null&&vc.updated_at&&Date.now()-new Date(vs.data.updated_at).getTime()<=Cw),ch=vs.data&&(Pr||Ta&&Vu)?vs.data:null,Ll=Math.max(0,ja.size-ts.length),Ls=B.context_usage,Il=Ls?Math.round(Ls.percent_used):0,uh=Math.max(0,100-Il),dh=Ls?{"--usage-progress":`${Math.max(0,Math.min(100,Ls.percent_used))}%`}:void 0,fh=ls.state==="connected"&&Ta&&!de&&!As.isPending&&!(fa!=null&&fa.turn.completion),hh=!!dn||ts.length>0;_.useEffect(()=>{m&&(qn.current[m]={planAt:0,backgroundAgentsAt:0})},[m]),_.useEffect(()=>{if(!m)return;const S=qn.current[m]??(qn.current[m]={planAt:0,backgroundAgentsAt:0});vs.data&&(S.planAt=0),Ll<=0&&(S.backgroundAgentsAt=0)},[Ll,vs.data,m]),_.useEffect(()=>{if(!Re)return;(Al.data??[]).some(D=>D.id===Re&&D.status==="submitting")||Oe(null)},[Al.data,Re]),_.useEffect(()=>{var S;!m||!B||B.run_state==="running"||ka.isPending||As.isPending||fa||(S=vs.data)!=null&&S.is_active||(ke.current&&(window.clearTimeout(ke.current),ke.current=null),$t(!1))},[fa,As.isPending,(Qr=vs.data)==null?void 0:Qr.is_active,ka.isPending,B,B==null?void 0:B.run_state,m]),_.useEffect(()=>{var le;if(!m||!B||ls.state!=="connected"||B.run_state!=="running")return;const S=((le=wa[wa.length-1])==null?void 0:le.timestamp)??B.last_event_at;if(!S||Date.now()-new Date(S).getTime()<2500||Nt.current[m]===S)return;Nt.current[m]=S;const K=window.setTimeout(()=>{g.invalidateQueries({queryKey:dt})},900);return()=>{window.clearTimeout(K)}},[ls.state,wa,g,B,B==null?void 0:B.last_event_at,B==null?void 0:B.run_state,m]),_.useEffect(()=>{if(!m||!B||ls.state!=="connected"||!Ta)return;const S=qn.current[m]??(qn.current[m]={planAt:0,backgroundAgentsAt:0}),D=Ta&&!vs.data,K=!B.subagent&&ja.size>0&&Ll>0;if(!D&&!K)return;const le=window.setTimeout(()=>{const et=Date.now();D&&et-S.planAt>=b2&&(S.planAt=et,g.invalidateQueries({queryKey:["plan",m]})),K&&et-S.backgroundAgentsAt>=b2&&(S.backgroundAgentsAt=et,g.invalidateQueries({queryKey:dt}))},160);return()=>{window.clearTimeout(le)}},[fa,ls.state,Ta,Ll,ja.size,vs.data,g,B,B==null?void 0:B.subagent,m]);const Is=R?0:Ek(),Ku=R||$,Yu=R?0:Ke??($?Is:0),mh=gt&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"sheet-wrap sheet-wrap--centered",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"sheet-wrap__scrim",onClick:()=>{Lt(!1),st(B.title)},"aria-label":"关闭重命名会话面板"}),l.jsx("div",{className:"sheet-wrap__center",children:l.jsxs("div",{className:"sheet-panel sheet-panel--form sheet-panel--centered",children:[l.jsx("div",{className:"sheet-panel__title",children:"重命名会话"}),l.jsx("input",{className:"sheet-panel__input",value:St,onChange:S=>st(S.target.value),placeholder:"输入会话名称",autoFocus:!0}),l.jsxs("div",{className:"sheet-panel__actions",children:[l.jsx("button",{type:"button",className:"sheet-panel__button",onClick:()=>{Lt(!1),st(B.title)},children:"取消"}),l.jsx("button",{type:"button",className:"sheet-panel__button is-primary",disabled:!St.trim()||fn.isPending&&((Xa=fn.variables)==null?void 0:Xa.sessionId)===B.id,onClick:()=>{Ya(B.id,"rename",St.trim()),Lt(!1)},children:"保存"})]})]})})]}),document.body):null,ph=!(t?a:R)&&Ge&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"picker-sheet-wrap",role:"dialog","aria-modal":"true",children:[l.jsx("button",{type:"button",className:"picker-sheet__scrim",onClick:()=>Ue(!1),"aria-label":"关闭会话操作菜单"}),l.jsxs("div",{className:"picker-sheet",children:[l.jsx("div",{className:"picker-sheet__header",children:l.jsx("strong",{children:B.title})}),l.jsxs("div",{className:"picker-sheet__list",children:[l.jsx("button",{type:"button",className:"picker-sheet__item",disabled:fn.isPending&&((hd=fn.variables)==null?void 0:hd.sessionId)===B.id,onClick:()=>void Ya(B.id,B.pinned?"unpin":"pin"),children:l.jsx("span",{children:B.pinned?"取消置顶会话":"置顶会话"})}),l.jsx("button",{type:"button",className:"picker-sheet__item",disabled:fn.isPending&&((ns=fn.variables)==null?void 0:ns.sessionId)===B.id,onClick:()=>{Ue(!1),Lt(!0)},children:l.jsx("span",{children:"重命名会话"})}),l.jsx("button",{type:"button",className:"picker-sheet__item is-danger",disabled:fn.isPending&&((Vl=fn.variables)==null?void 0:Vl.sessionId)===B.id,onClick:()=>void Ya(B.id,"delete"),children:l.jsx("span",{children:"删除会话"})})]})]})]}),document.body):null,gh=R?1:Is>0?Yu/Is:0,zl=!R&&Ke!==null,yh=R?{"--desktop-sidebar-width":`${ce}px`}:void 0,Kn=t?!!a:R,sc=t?r:Yu,Bl=t?c:zl,vh=Nn.isPending?Nn.variables??null:null,_h=De??(Va.error instanceof Error?Va.error.message:null),bh=ys.error instanceof Error?ys.error.message:null,Pl=We??(Rs.error instanceof Error?Rs.error.message:null),_s=Rs.data??null,Zs=(_s==null?void 0:_s.terminal_snapshot)??null,Za=(_s==null?void 0:_s.command_catalog.commands)??[],Zu=(_s==null?void 0:_s.website_catalog.websites)??[],ac=Zf(Tf(),q),Ur=(Zs==null?void 0:Zs.terminals.find(S=>S.id===Zs.active_terminal_id))??(Zs==null?void 0:Zs.terminals[0])??null,Ea=sn&&nn==="terminal",ic=yn&&nn==="git",Ma=Kn&&Ea&&oe,Wu=ic&&Kn,Ri=(Ea||ic)&&Kn&&!Ma,Xu=(Ea||ic)&&!Kn,rc=Zt.isPending&&((Ws=Zt.variables)==null?void 0:Ws.action)==="run-command"?Zt.variables.commandId??null:null,Ai=Zt.isPending&&((_c=Zt.variables)==null?void 0:_c.action)==="run-kill-command"?Zt.variables.commandId??null:null,Ju=Ys.isPending&&((Gr=Ys.variables)==null?void 0:Gr.action)==="delete"?Ys.variables.commandId??null:null,ed=Ds.isPending&&((La=Ds.variables)==null?void 0:La.action)==="delete"?Ds.variables.websiteId??null:null;_.useEffect(()=>{!Kn&&oe&&qe(!1)},[oe,Kn]);const Ra=S=>{es.current=S,mt(S)},lc=(S,D,K)=>(Ht.current={mode:$?"close":"open",startX:S,startY:D,axis:"pending",pointerId:K},!0),oc=(S,D)=>{const K=Ht.current;if(!K)return!1;const le=S-K.startX,et=D-K.startY;if(K.axis==="pending"){if(Math.abs(le)<8&&Math.abs(et)<8)return!1;if(K.axis=Math.abs(le)>Math.abs(et)?"x":"y",K.axis==="y")return Ht.current=null,Ra(null),!1}const Ye=K.mode==="open"?Math.max(0,Math.min(Is,le)):Math.max(0,Math.min(Is,Is+le));return Ra(Ye),!0},Di=(S,D)=>{const K=Ht.current;if(!K)return;const le=S-K.startX,et=D-K.startY;if(K.axis==="pending"&&Math.abs(et)>48){Ht.current=null,Ra(null);return}const pt=(K.axis==="x"?es.current??(K.mode==="open"?Math.max(0,Math.min(Is,le)):Math.max(0,Math.min(Is,Is+le))):$?Is:0)>=Is*ww;H(pt),Ht.current=null,Ra(null)},Oi=_.useCallback(()=>{if(t){u==null||u();return}H(!0)},[t,u]),xh=_.useCallback(()=>{we(S=>!S)},[]),Ul=_.useCallback(()=>{U(null)},[]),td=_.useCallback(()=>{On(S=>!S)},[]),nd=_.useCallback(S=>{Fa(S)},[Fa]),ql=_.useCallback(S=>{const D=new Date().toISOString();if(q.length===0){W({panel_id:`${B1}${Date.now()}`,session_id:B.id,command_name:"model",command_text:S,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"completed",body:"当前没有可选模型,请先去设置页维护模型列表。",submitted_at:D,updated_at:D,input_type:"none",options:[],input_placeholder:null,submit_label:null,effect:null});return}W({panel_id:`${B1}${Date.now()}`,session_id:B.id,command_name:"model",command_text:S,title:"选择模型",description:"选择后会更新当前会话后续发送时使用的模型。",status:"awaiting_input",body:"在下面选择一个模型。",submitted_at:D,updated_at:D,input_type:"choice",options:q.map(K=>({id:K.value,label:K.label,description:K.description??null})),input_placeholder:null,submit_label:null,effect:null})},[q,B.id]),cc=_.useCallback(()=>{if(u0(Y)){if(_e.length>0){U("命令暂不支持附件,请先移除附件后再执行。");return}if(Yw(Y)==="model"){U(null),F(""),ql(Y);return}Ol.mutate({sessionId:B.id,input:Y});return}ka.mutate({sessionId:B.id,input:Y.trim(),attachments:_e,model:xe,reasoningEffort:ne,serviceTier:V?"fast":void 0,planMode:Ce})},[Y,V,Ce,Ol,ql,_e,xe,ne,ka,B.id]),sd=_.useCallback(()=>{W(null)},[]),ad=_.useCallback(S=>{if(te){if(te.panel_id.startsWith(B1)){A(S),W(D=>D&&{...D,status:"completed",body:`后续消息将优先使用 ${Zf(S,q)}。`,updated_at:new Date().toISOString(),input_type:"none",options:[]});return}ua.mutate({sessionId:B.id,panelId:te.panel_id,optionId:S})}},[te,ua,q,B.id]),id=_.useCallback(S=>{te&&ua.mutate({sessionId:B.id,panelId:te.panel_id,text:S})},[te,ua,B.id]),Sh=_.useCallback(S=>{Ks.mutate({sessionId:B.id,requestId:S.requestId,optionId:S.optionId??null,text:S.text??null,answers:S.answers})},[Ks,B.id]),jh=_.useCallback(S=>{const D=[...S];D.length!==0&&(U(null),Promise.all(D.map(K=>Ty(K))).then(K=>{je(le=>[...le,...K])}).catch(K=>{U(K instanceof Error?K.message:"无法读取附件")}))},[]),wh=_.useCallback(S=>{je(D=>D.filter(K=>K.id!==S))},[]),kh=_.useCallback(()=>{As.isPending||de||As.mutate(B.id)},[As,de,B.id]),Nh=_.useCallback(()=>{rn(S=>!S)},[]),Cn=_.useCallback(S=>{S==="git"&&!yn||S==="terminal"&&!sn||(Ie(null),$e(null),Ee(!1),at(!1),qe(!1),ln(S))},[yn,sn]);_.useEffect(()=>{if(!Ri)return;const S=D=>{var le,et;const K=D.target;K instanceof Node&&((le=C.current)!=null&&le.contains(K)||(et=I.current)!=null&&et.contains(K)||Cn("code"))};return window.addEventListener("pointerdown",S),()=>{window.removeEventListener("pointerdown",S)}},[Cn,Ri]);const qr=_.useCallback(()=>{Ie(null),Va.refetch()},[Va]),rd=_.useCallback(()=>{ys.refetch()},[ys]),ld=_.useCallback(()=>{ys.data||ys.isFetching||ys.refetch()},[ys]),od=_.useCallback(S=>{Nn.mutate({action:"discard-file",path:S})},[Nn]),cd=_.useCallback(()=>{Nn.mutate({action:"discard-all"})},[Nn]),uc=_.useCallback(S=>{Nn.mutate({action:"commit-all",message:S})},[Nn]),Ch=_.useCallback(async(S,D)=>{Ie(null);const K=(D==null?void 0:D.trim())??"";K&&await Nn.mutateAsync({action:"commit-all",message:K}),await Nn.mutateAsync({action:"switch-branch",branch:S})},[Nn]),Li=_.useCallback(()=>{Nn.mutate({action:"push"})},[Nn]),dc=_.useCallback(async(S,D,K)=>(await Ft()).client.getSessionGitHistoryFileDiff(B.id,{commitOid:S,path:D,previousPath:K}),[Ft,B.id]),$r=_.useCallback(async(S,D)=>(await Ft()).client.getSessionGitWorkspaceFileDiff(B.id,{path:S,previousPath:D}),[Ft,B.id]),$l=_.useCallback(S=>{Zt.mutate({action:"run-command",commandId:S})},[Zt]),fc=_.useCallback(async()=>{if(!(Za.length===0||pn||xn)){Un(!0);try{for(const S of Za)await Zt.mutateAsync({action:"run-command",commandId:S.id})}finally{Un(!1)}}},[pn,xn,Za,Zt]),Aa=_.useCallback(async()=>{if(pn||xn)return;const S=Za.filter(D=>!!D.kill_command);if(S.length!==0){ps(!0);try{for(const D of S)await Zt.mutateAsync({action:"run-kill-command",commandId:D.id})}finally{ps(!1)}}},[pn,xn,Za,Zt]),Ii=_.useCallback(S=>{Zt.mutate({action:"run-kill-command",commandId:S})},[Zt]),Hl=_.useCallback(S=>{Ys.mutate({action:S.commandId?"update":"create",commandId:S.commandId,command:S.draft})},[Ys]),hc=_.useCallback(S=>{Ys.mutate({action:"delete",commandId:S})},[Ys]),Da=_.useCallback(()=>{Dr.mutate()},[Dr]),mc=_.useCallback(S=>{Ds.mutate({action:S.websiteId?"update":"create",websiteId:S.websiteId,website:S.draft})},[Ds]),pc=_.useCallback(S=>{Ds.mutate({action:"delete",websiteId:S})},[Ds]),gc=_.useCallback(()=>{Na.mutate()},[Na]),ud=_.useCallback(()=>{at(!1)},[]),Th=_.useCallback(S=>{Zt.mutate({action:"focus",terminalId:S}),ln("terminal")},[Zt]),Eh=_.useCallback(S=>{Zt.mutate({action:"close",terminalId:S})},[Zt]),dd=_.useCallback(()=>{!Kn||!sn||(ln("terminal"),qe(S=>!S))},[sn,Kn]),yc=_.useMemo(()=>{var S,D,K;return l.jsxs("div",{className:"conversation-topbar__title-actions",children:[l.jsx("button",{type:"button",className:"conversation-topbar__more",onClick:()=>Ue(le=>!le),"aria-label":"更多会话选项",children:l.jsx(Dw,{})}),Ge&&Kn?l.jsxs("div",{className:"topbar-menu",role:"menu",children:[l.jsx("button",{type:"button",className:"topbar-menu__item",disabled:fn.isPending&&((S=fn.variables)==null?void 0:S.sessionId)===B.id,onClick:()=>void Ya(B.id,B.pinned?"unpin":"pin"),children:B.pinned?"取消置顶会话":"置顶会话"}),l.jsx("button",{type:"button",className:"topbar-menu__item",disabled:fn.isPending&&((D=fn.variables)==null?void 0:D.sessionId)===B.id,onClick:()=>{Ue(!1),Lt(!0)},children:"重命名会话"}),l.jsx("button",{type:"button",className:"topbar-menu__item is-danger",disabled:fn.isPending&&((K=fn.variables)==null?void 0:K.sessionId)===B.id,onClick:()=>void Ya(B.id,"delete"),children:"删除会话"})]}):null]})},[Ya,Ge,Kn,B.id,B.pinned,fn.isPending,(Kl=fn.variables)==null?void 0:Kl.sessionId]),Fl=_.useMemo(()=>sn||yn?l.jsxs("div",{className:"conversation-topbar__actions",children:[sn?l.jsxs("div",{className:"conversation-topbar__run-group",children:[l.jsx("button",{type:"button",className:`conversation-topbar__run-button ${He?"is-active":""}`,onClick:()=>{at(!1),Ee(S=>!S)},"aria-expanded":He,"aria-haspopup":"dialog","aria-label":"打开项目命令列表",children:l.jsx(Uw,{})}),He?l.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目命令列表",children:l.jsx(lw,{commands:Za,nodeRuntime:(_s==null?void 0:_s.node_runtime)??null,error:Pl,pendingRunCommandId:rc,pendingKillCommandId:Ai,pendingDeleteCommandId:Ju,isSaving:Ys.isPending,isGenerating:Dr.isPending,isStartingAll:pn,isStoppingAll:xn,generationReason:gs,executionModelLabel:ac,onRun:$l,onRunAll:fc,onRunAllKill:Aa,onRunKill:Ii,onSave:Hl,onDelete:hc,onGenerate:Da})}):null]}):null,sn?l.jsxs("div",{className:"conversation-topbar__run-group",children:[l.jsx("button",{type:"button",className:`conversation-topbar__run-button ${Ut?"is-active":""}`,onClick:()=>{Ee(!1),at(S=>!S)},"aria-expanded":Ut,"aria-haspopup":"dialog","aria-label":"打开项目网页列表",children:l.jsx(qw,{})}),Ut?l.jsx("div",{className:"conversation-run-popover",role:"dialog","aria-label":"项目网页列表",children:l.jsx(hw,{websites:Zu,error:Pl,pendingDeleteWebsiteId:ed,isSaving:Ds.isPending,isGenerating:Na.isPending,generationReason:Ci,executionModelLabel:ac,onOpen:ud,onSave:mc,onDelete:pc,onGenerate:gc})}):null]}):null,sn||yn?l.jsxs("div",{ref:I,className:"conversation-topbar__view-toggle","aria-label":"切换工作台面板",children:[l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="code"?"is-active":""}`,onClick:()=>Cn("code"),"aria-pressed":nn==="code","aria-label":"切换到代码会话视图",children:l.jsx(zw,{})}),sn?l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="terminal"?"is-active":""}`,onClick:()=>Cn("terminal"),"aria-pressed":nn==="terminal","aria-label":"切换到终端视图",children:l.jsx(Pw,{})}):null,yn?l.jsx("button",{type:"button",className:`conversation-topbar__view-button ${nn==="git"?"is-active":""}`,onClick:()=>Cn("git"),"aria-pressed":nn==="git","aria-label":"切换到 git 视图",children:l.jsx(Bw,{})}):null]}):null]}):null,[nn,yn,sn,gs,Ci,pn,xn,ac,Dr.isPending,Na.isPending,hc,Da,pc,gc,ud,$l,fc,Aa,Hl,mc,Cn,He,Ut,Ju,ed,rc,Za,Zu,Pl,Ys.isPending,Ds.isPending]),zs=l.jsx(nw,{workspace:Va.data??null,history:ys.data??null,isLoading:Va.isPending,isHistoryLoading:ys.isFetching,error:_h,historyError:bh,onRefresh:qr,onRefreshHistory:rd,onRequestHistory:ld,onDiscardFile:od,onDiscardAll:cd,onCommitAll:uc,onSwitchBranch:Ch,onPush:Li,onLoadWorkspaceFileDiff:$r,onLoadHistoryFileDiff:dc,pendingAction:vh,compact:Wu}),Ql=l.jsx(Sw,{terminals:(Zs==null?void 0:Zs.terminals)??[],activeTerminalId:(Ur==null?void 0:Ur.id)??null,outputs:Gs,error:Pl,compact:Ri||Ma,canToggleFullscreen:Kn,isFullscreen:Ma,onSelectTerminal:Th,onCloseTerminal:Eh,onToggleFullscreen:dd}),bs=l.jsx(Dy,{isDesktopSidebar:Kn,sidebarShift:sc,isSidebarDragging:Bl,composerError:E,onDismissComposerError:Ul,interactionRequests:Ka,pendingInteractionRequestId:Re,onRespondInteraction:Sh,parentSession:dn,backgroundAgentSessions:ts,isBackgroundAgentsOpen:Pn,planSnapshot:ch,onToggleBackgroundAgents:td,onOpenSession:nd,getBackgroundAgentStatusLabel:uk,getBackgroundAgentAccent:lk,formatBackgroundAgentsLabel:tk,hasBackgroundAgentStrip:hh,commandPanel:te,isCommandPanelPending:Ol.isPending||ua.isPending,onDismissCommandPanel:sd,onCommandPanelOptionSelect:ad,onCommandPanelTextSubmit:id,projectId:B.project_id,draft:Y,pendingAttachments:_e,canSendInput:ec,isInputLocked:Ka.length>0,readOnlyPlaceholder:Ka.length>0?"请先处理上方确认请求":void 0,onDraftChange:F,onUploadFiles:jh,onRemoveAttachment:wh,onSubmit:cc,showStopIcon:Lr,isSendPending:ka.isPending||Ol.isPending||ua.isPending,onInterrupt:kh,isFastModeEnabled:V,isPlanModeEnabled:Ce,onToggleFastMode:()=>pe(S=>!S),onTogglePlanMode:()=>Le(S=>!S),showModeBadges:!0,selectedModel:xe,modelOptions:q,selectedReasoning:ne,onSelectModel:A,onSelectReasoning:S=>be(S),contextUsage:Ls,isContextUsageOpen:kt,onToggleContextUsage:Nh,contextUsageRingStyle:dh,usedPercent:Il,remainingPercent:uh,usedTokensLabel:j2((Ls==null?void 0:Ls.used_tokens)??0),totalTokensLabel:j2((Ls==null?void 0:Ls.total_tokens)??0),showJumpToBottom:xa,onJumpToBottom:Sa}),Wa=Ea?Ql:zs,Hr=Xu||Ma?l.jsxs("div",{ref:N,className:`conversation-main ${Kn?"has-desktop-sidebar":""} ${Ma?"is-terminal-fullscreen":""}`,style:{transform:`translateX(${sc}px)`,transition:Bl?"none":void 0},children:[l.jsxs("div",{className:"conversation-topbar",children:[Kn?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:Oi,"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]}),l.jsx("div",{className:"conversation-topbar__meta",children:l.jsxs("div",{className:"conversation-topbar__title-row",children:[l.jsx("h1",{children:B.title}),yc]})}),Fl]}),l.jsx("div",{ref:T,className:"conversation-scroll",children:l.jsx("div",{className:`session-workbench-surface ${Ma?"is-terminal-fullscreen":""}`,children:Wa})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`session-detail-workspace ${Ri?"has-workbench-panel":""}`,children:[l.jsx(jw,{conversationMainRef:N,conversationScrollRef:T,isDesktopSidebar:Kn,sidebarShift:sc,isSidebarDragging:Bl,title:B.title,titleActions:yc,topbarActions:Fl,onOpenSidebar:Oi,threadContent:Br,connectionStatus:ls,isConnectionDetailOpen:ge,onToggleConnectionDetail:xh,showThinkingStatus:fh}),Ri?l.jsx("aside",{ref:C,className:"session-workbench-rail",children:Wa}):null]}),Ma?null:bs]}),Fr=l.jsxs(l.Fragment,{children:[mh,ph,ae&&typeof document<"u"?or.createPortal(l.jsxs("div",{className:"attachment-lightbox",role:"dialog","aria-modal":"true","aria-label":`预览 ${ae.label}`,children:[l.jsx("button",{type:"button",className:"attachment-lightbox__scrim",onClick:()=>ue(null),"aria-label":"关闭图片预览"}),l.jsxs("div",{className:"attachment-lightbox__panel",children:[l.jsx("button",{type:"button",className:"attachment-lightbox__close",onClick:()=>ue(null),"aria-label":"关闭图片预览",children:l.jsx(Iw,{})}),l.jsx("div",{className:"attachment-lightbox__frame",children:l.jsx("img",{src:ae.src,alt:ae.label,className:"attachment-lightbox__image"})}),l.jsxs("div",{className:"attachment-lightbox__meta",children:[l.jsx("div",{className:"attachment-lightbox__title",children:ae.label}),l.jsx("div",{className:"attachment-lightbox__hint",children:ae.meta})]})]})]}),document.body):null]});return t?l.jsxs(l.Fragment,{children:[Hr,Fr]}):l.jsxs("div",{ref:w,className:`conversation-page ${R?"has-desktop-sidebar":""}`,style:yh,onPointerDown:S=>{R||S.pointerType==="mouse"&&S.button!==0||Qu(S.target)||(lc(S.clientX,S.clientY,S.pointerId),S.currentTarget.setPointerCapture(S.pointerId))},onPointerMove:S=>{if(R)return;const D=Ht.current;!D||D.pointerId!==S.pointerId||!oc(S.clientX,S.clientY)||S.preventDefault()},onPointerUp:S=>{if(R)return;const D=Ht.current;!D||D.pointerId!==S.pointerId||Di(S.clientX,S.clientY)},onPointerCancel:S=>{if(R)return;const D=Ht.current;!D||D.pointerId!==S.pointerId||(Ht.current=null,Ra(null))},children:[l.jsx(dy,{open:Ku,progress:gh,isDragging:zl,desktopPinned:R,isDesktopResizing:ie,onClose:()=>{R||(H(!1),Ra(null))},onDesktopResizeStart:S=>{Ln.current=kn.current,wn.current={startX:S,startWidth:kn.current},ee(!0)},currentAgent:on,projects:oa,sessions:$n,activeSessionId:B.id,onCreateSession:S=>{nc(S)},onSessionAction:Ya,onThreadAction:tc,pendingSessionActionId:fn.isPending?((bc=fn.variables)==null?void 0:bc.sessionId)??null:null,pendingThreadActionId:da.isPending?((Yl=da.variables)==null?void 0:Yl.projectId)??null:null}),Hr,Fr]})},Dk=({mode:n,agentName:t,agentStatus:a,onOpenNodes:r,onCreateThread:c})=>{if(n==="node")return l.jsxs("section",{className:"session-empty-state is-node-mode",children:[l.jsx("div",{className:"session-empty-state__eyebrow",children:"Panda Workspace"}),l.jsx("div",{className:"session-empty-state__actions",children:l.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:r,children:"选择节点"})})]});const u=a==="online";return l.jsxs("section",{className:"session-empty-state is-session-mode",children:[l.jsxs("div",{className:"session-empty-state__status-row",children:[l.jsx("span",{className:`session-empty-state__status-dot is-${u?"online":"offline"}`,"aria-hidden":"true"}),l.jsxs("div",{className:"session-empty-state__eyebrow",children:["节点 · ",t??"当前节点"]})]}),l.jsxs("div",{className:"session-empty-state__actions",children:[c?l.jsx("button",{type:"button",className:"session-empty-state__button is-primary",onClick:c,children:"新建会话"}):null,l.jsx("button",{type:"button",className:"session-empty-state__button",onClick:r,children:"切换节点"})]})]})},N2=1100,qy="panda:desktop-sidebar-width",pu="panda:desktop-sidebar-width-version",gu="2026-03-24-narrow",Ok=300,$y=232,wo=$y,Lk=460,Ik=.4,zk=()=>typeof window>"u"?248:Math.max(0,Math.min(248,window.innerWidth-84)),Tp=n=>Math.max($y,Math.min(Lk,n)),Bk=()=>{if(typeof window>"u")return wo;try{const n=window.localStorage.getItem(qy),t=window.localStorage.getItem(pu);if(!n)return window.localStorage.setItem(pu,gu),wo;const a=Number(n);if(!Number.isFinite(a))return window.localStorage.setItem(pu,gu),wo;const c=t!==gu||a===Ok||a>wo?wo:a;return window.localStorage.setItem(pu,gu),Tp(c)}catch{return wo}},g0=()=>{var tn,$t;const{sessionId:n,agentId:t}=Uu({strict:!1}),a=Mr(),r=Tl(),c=_.useRef(null),u=_.useRef(null),[h,p]=_.useState(()=>Mx()),[y,m]=_.useState(()=>Rx()??Mu()),[b,g]=_.useState(()=>Ax()),[x,w]=_.useState(()=>Dx()?"directory-picker":"composer"),[N,T]=_.useState(!1),[C,I]=_.useState(()=>typeof window<"u"&&window.innerWidth>=N2),[$,H]=_.useState(()=>Bk()),[R,Q]=_.useState(!1),[ce,Z]=_.useState(null),ie=_.useRef(null),ee=_.useRef(null),Y=_.useRef(null),F=_.useRef($),_e=_.useRef(null),je=_.useRef(null),ae=n?{sessionId:n,agentId:t??h}:{agentId:t??h},{data:ue}=qu({queryKey:dt,scope:ae}),E=(ue==null?void 0:ue.sessions.find(de=>de.id===n))??null;_.useEffect(()=>{if(ue){if(t&&ue.agents.some(de=>de.id===t)&&(p(t),xr(t),n||m(null)),E!=null&&E.agent_id&&u.current!==E.id){u.current=E.id,p(E.agent_id),m(E.id),g(null),xr(E.agent_id),fs(E.id);return}n||(u.current=null),p(de=>de&&ue.agents.some(Ae=>Ae.id===de)?de:null),m(de=>de&&ue.sessions.some(Ae=>Ae.id===de)?de:null)}},[t,E==null?void 0:E.agent_id,E==null?void 0:E.id,n,ue]),_.useEffect(()=>{t||n||h||(Ox(),a({to:"/nodes",replace:!0}))},[a,t,n,h]),_.useEffect(()=>{if(!ue||t||n||!h||y)return;const de=Mu(),Ae=ue.sessions.find(Re=>Re.id===de&&Re.agent_id===h)??null;Ae&&(m(Ae.id),fs(Ae.id))},[t,n,h,y,ue]);const U=(h?ue==null?void 0:ue.agents.find(de=>de.id===h):null)??null,te=_.useMemo(()=>U?((ue==null?void 0:ue.projects)??[]).filter(de=>de.agent_id===U.id):[],[U,ue==null?void 0:ue.projects]),W=_.useMemo(()=>U?((ue==null?void 0:ue.sessions)??[]).filter(de=>de.agent_id===U.id).sort((de,Ae)=>Number(Ae.pinned)-Number(de.pinned)||+new Date(Ae.last_event_at)-+new Date(de.last_event_at)):[],[U,ue==null?void 0:ue.sessions]),xe=y&&U?W.find(de=>de.id===y)??null:null;_.useEffect(()=>{if(xe)return;let de=!1,Ae;return Jn({sessionId:n,agentId:t??h??(U==null?void 0:U.id)??null}).then(Re=>{de||(Ae=Re.client.connectEvents(Oe=>{var mt,kt;const Ke=typeof((mt=Oe.payload)==null?void 0:mt.sessionId)=="string"?Oe.payload.sessionId:null;if(Oe.type==="agent.online"||Oe.type==="snapshot.changed"){r.invalidateQueries({queryKey:dt});return}if(Oe.type==="session.updated"&&Ke){const rn=(kt=Oe.payload)!=null&&kt.sessionPatch&&typeof Oe.payload.sessionPatch=="object"?Oe.payload.sessionPatch:null,Pn=r.getQueryData(dt);if(rn&&a0(Pn,Ke)){r.setQueryData(dt,On=>Nf(On,Ke,rn));return}r.invalidateQueries({queryKey:dt})}}))}),()=>{de=!0,Ae==null||Ae()}},[xe,U==null?void 0:U.id,r,t,n,h]),_.useEffect(()=>{F.current=$},[$]),_.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(qy,String(Tp($))),window.localStorage.setItem(pu,gu)}catch{}},[$]),_.useEffect(()=>{if(typeof window>"u")return;const de=()=>{const Ae=window.innerWidth>=N2;I(Ae),Ae&&(T(!1),Z(null))};return de(),window.addEventListener("resize",de),()=>{window.removeEventListener("resize",de)}},[]),_.useEffect(()=>{if(!R)return;const de=Re=>{const Oe=Y.current;if(!Oe)return;const Ke=Re.clientX-Oe.startX,mt=Tp(Oe.startWidth+Ke);_e.current=mt,je.current===null&&(je.current=window.requestAnimationFrame(()=>{je.current=null;const kt=_e.current;kt!==null&&H(kt)}))},Ae=()=>{je.current!==null&&(window.cancelAnimationFrame(je.current),je.current=null);const Re=_e.current??F.current;_e.current=null,Y.current=null,Q(!1),F.current=Re,H(Re)};return window.addEventListener("pointermove",de),window.addEventListener("pointerup",Ae),()=>{window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",Ae)}},[R]),_.useEffect(()=>()=>{je.current!==null&&window.cancelAnimationFrame(je.current)},[]);const A=Vn({mutationFn:async de=>(await Jn({sessionId:de.sessionId})).client.updateSession(de)}),ne=Vn({mutationFn:async de=>(await Jn({projectId:de.projectId})).client.updateThread(de)}),be=async(de,Ae,Re)=>{var mt;const Oe=await A.mutateAsync({sessionId:de,action:Ae,name:Re}),Ke=(mt=Oe.affectedSessionIds)!=null&&mt.length?Oe.affectedSessionIds:[de];if(Ae==="delete"?r.setQueryData(dt,kt=>ay(kt,Ke)):r.setQueryData(dt,kt=>sy(kt,Ke,{...Ae==="rename"&&(Re!=null&&Re.trim())?{title:Re.trim()}:{pinned:Ae==="pin"}})),Ae==="delete"&&y===de){const kt=Oe.nextSessionId;kt?(fs(kt),m(kt)):(fs(null),m(null))}},V=async(de,Ae,Re)=>{var mt,kt;const Oe=await ne.mutateAsync({projectId:de,action:Ae,name:Re==null?void 0:Re.name,orderedProjectIds:Re==null?void 0:Re.orderedProjectIds}),Ke=(mt=Re==null?void 0:Re.name)==null?void 0:mt.trim();Ae==="pin"||Ae==="unpin"?r.setQueryData(dt,rn=>Yf(rn,de,{pinned:Ae==="pin"})):Ae==="rename"&&Ke?r.setQueryData(dt,rn=>Yf(rn,de,{display_name:Ke})):Ae==="reorder"&&((kt=Re==null?void 0:Re.orderedProjectIds)!=null&&kt.length)?r.setQueryData(dt,rn=>iy(rn,Re.orderedProjectIds??[])):Ae==="remove"||Ae==="archive"?r.setQueryData(dt,rn=>ry(rn,de)):Ae==="unarchive"&&r.invalidateQueries({queryKey:dt}),xe&&xe.project_id===de&&(Ae==="remove"||Ae==="archive"||Ae==="unarchive")&&(Oe.nextSessionId?(fs(Oe.nextSessionId),m(Oe.nextSessionId)):(fs(null),m(null)))},pe=async de=>{U&&(xr(U.id),fs(null),Ru(null),lu(!1),Eo(de),g(de),w("composer"),m(null),await a({to:"/"}))},Ce=async()=>{U&&(C||(T(!1),Ge(null)),xr(U.id),fs(null),Ru(null),Eo(null),lu(!0),g(null),w("directory-picker"),m(null),await a({to:"/"}))},Le=async de=>{await pe(de)},he=C?0:zk(),q=C||N,Se=C?0:ce??(N?he:0),Ne=C?1:he>0?Se/he:0,me=!C&&ce!==null,Te=C?{"--desktop-sidebar-width":`${$}px`}:void 0,Ge=de=>{ie.current=de,Z(de)},Ue=de=>de instanceof Element&&!!de.closest('button, textarea, input, a, [role="dialog"]'),gt=(de,Ae,Re)=>(ee.current={mode:N?"close":"open",startX:de,startY:Ae,axis:"pending",pointerId:Re},!0),Lt=(de,Ae)=>{const Re=ee.current;if(!Re)return!1;const Oe=de-Re.startX,Ke=Ae-Re.startY;if(Re.axis==="pending"){if(Math.abs(Oe)<8&&Math.abs(Ke)<8)return!1;if(Re.axis=Math.abs(Oe)>Math.abs(Ke)?"x":"y",Re.axis==="y")return ee.current=null,Ge(null),!1}const mt=Re.mode==="open"?Math.max(0,Math.min(he,Oe)):Math.max(0,Math.min(he,he+Oe));return Ge(mt),!0},St=(de,Ae)=>{const Re=ee.current;if(!Re)return;const Oe=de-Re.startX,Ke=Ae-Re.startY;if(Re.axis==="pending"&&Math.abs(Ke)>48){ee.current=null,Ge(null);return}const kt=(Re.axis==="x"?ie.current??(Re.mode==="open"?Math.max(0,Math.min(he,Oe)):Math.max(0,Math.min(he,he+Oe))):N?he:0)>=he*Ik;T(kt),ee.current=null,Ge(null)},st=()=>l.jsx(l.Fragment,{children:l.jsxs("div",{className:`conversation-main ${C?"has-desktop-sidebar":""}`,style:{transform:`translateX(${Se}px)`,transition:me?"none":void 0},children:[l.jsx("div",{className:"conversation-topbar",children:C?null:l.jsxs("button",{type:"button",className:"conversation-menu",onClick:()=>T(!0),"aria-label":"打开侧边栏",children:[l.jsx("span",{}),l.jsx("span",{className:"short"})]})}),l.jsx("div",{className:"conversation-scroll conversation-scroll--empty",children:l.jsx("div",{className:"conversation-thread conversation-thread--empty",children:l.jsx(Dk,{mode:"node",agentName:U==null?void 0:U.name,agentStatus:(U==null?void 0:U.status)??null,onOpenNodes:()=>{a({to:"/nodes"})}})})})]})});return l.jsxs("div",{ref:c,className:`conversation-page ${C?"has-desktop-sidebar":""}`,style:Te,onPointerDown:de=>{C||de.pointerType==="mouse"&&de.button!==0||Ue(de.target)||(gt(de.clientX,de.clientY,de.pointerId),de.currentTarget.setPointerCapture(de.pointerId))},onPointerMove:de=>{if(C)return;const Ae=ee.current;!Ae||Ae.pointerId!==de.pointerId||!Lt(de.clientX,de.clientY)||de.preventDefault()},onPointerUp:de=>{if(C)return;const Ae=ee.current;!Ae||Ae.pointerId!==de.pointerId||St(de.clientX,de.clientY)},onPointerCancel:de=>{if(C)return;const Ae=ee.current;!Ae||Ae.pointerId!==de.pointerId||(ee.current=null,Ge(null))},children:[l.jsx(dy,{open:q,progress:Ne,isDragging:me,desktopPinned:C,isDesktopResizing:R,onClose:()=>{C||(T(!1),Ge(null))},onDesktopResizeStart:de=>{_e.current=F.current,Y.current={startX:de,startWidth:F.current},Q(!0)},currentAgent:U??void 0,projects:te,sessions:W,activeSessionId:xe==null?void 0:xe.id,onCreateSession:de=>{Le(de)},onCreateDirectoryThread:()=>{Ce()},onSelectSession:de=>{g(null),w("composer"),lu(!1),Eo(null),m(de),fs(de)},onSessionAction:be,onThreadAction:V,pendingSessionActionId:A.isPending?((tn=A.variables)==null?void 0:tn.sessionId)??null:null,pendingThreadActionId:ne.isPending?(($t=ne.variables)==null?void 0:$t.projectId)??null:null}),U?xe?l.jsx(Ak,{sessionId:xe.id,embedded:!0,isDesktopSidebar:C,sidebarOffset:Se,isSidebarDragging:me,onOpenSidebar:()=>T(!0),onSelectSession:de=>{m(de),fs(de)},onExitToNodes:()=>{m(null),a({to:"/nodes"})}}):l.jsx($j,{currentAgent:U,projects:te,sessions:W,initialProjectId:b,entryView:x,isDesktopSidebar:C,sidebarOffset:Se,isSidebarDragging:me,onOpenSidebar:()=>T(!0),onProjectSelected:de=>{g(de),w("composer"),lu(!1)},onSessionCreated:de=>{g(null),w("composer"),lu(!1),Eo(null),m(de),fs(de)}}):st()]})},Hy=1,Pk=10080*60*1e3,Fy="panda-web-cache",Yo="app-state",Qy="react-query",C2="panda:storage-persist-result",Uk=new Set(["bootstrap","timeline","timeline-optimistic","change-sets","plan","interactions","codex-commands","project-skills","settings-connection"]),y0=()=>typeof window<"u"&&typeof window.indexedDB<"u",qk=n=>typeof n[0]=="string"&&Uk.has(n[0]),Gy=async()=>y0()?await new Promise((n,t)=>{const a=window.indexedDB.open(Fy,1);a.onupgradeneeded=()=>{const r=a.result;r.objectStoreNames.contains(Yo)||r.createObjectStore(Yo)},a.onsuccess=()=>n(a.result),a.onerror=()=>t(a.error??new Error("Unable to open Panda cache database."))}):null,$k=async()=>{const n=await Gy();if(!n)return null;try{return await new Promise((t,a)=>{const u=n.transaction(Yo,"readonly").objectStore(Yo).get(Qy);u.onsuccess=()=>t(u.result??null),u.onerror=()=>a(u.error??new Error("Unable to read Panda cache record."))})}finally{n.close()}},Hk=async n=>{const t=await Gy();if(t)try{await new Promise((a,r)=>{const c=t.transaction(Yo,"readwrite");c.objectStore(Yo).put(n,Qy),c.oncomplete=()=>a(),c.onerror=()=>r(c.error??new Error("Unable to write Panda cache record.")),c.onabort=()=>r(c.error??new Error("Writing Panda cache record was aborted."))})}finally{t.close()}},Ep=async()=>{y0()&&await new Promise(n=>{const t=window.indexedDB.deleteDatabase(Fy);t.onsuccess=()=>n(),t.onerror=()=>n(),t.onblocked=()=>n()})},Fk=async n=>{if(y0())try{const t=await $k();if(!t)return;const a=Date.now()-t.persistedAt>Pk;if(t.version!==Hy||a){await Ep();return}Bv(n,t.clientState)}catch{await Ep().catch(()=>{})}},Qk=async()=>{if(!(typeof navigator>"u"||typeof window>"u"||!("storage"in navigator)||typeof navigator.storage.persist!="function"))try{if(window.localStorage.getItem(C2))return;const t=await navigator.storage.persist();window.localStorage.setItem(C2,t?"granted":"denied")}catch{}},Gk=n=>{if(typeof window>"u")return()=>{};Qk();let t=null,a=null,r=!1,c=!1;const u=async()=>{if(!c){if(a){r=!0;return}a=(async()=>{const b=zv(n,{shouldDehydrateQuery:g=>qk(g.queryKey)});await Hk({version:Hy,persistedAt:Date.now(),clientState:b})})();try{await a}catch{}finally{a=null,r&&(r=!1,u())}}},h=(b=!1)=>{if(!c){if(t!==null&&(window.clearTimeout(t),t=null),b){u();return}t=window.setTimeout(()=>{t=null,u()},1200)}},p=n.getQueryCache().subscribe(()=>{h(!1)}),y=()=>{document.visibilityState==="hidden"&&h(!0)},m=()=>{h(!0)};return document.addEventListener("visibilitychange",y),window.addEventListener("pagehide",m),()=>{c=!0,p(),document.removeEventListener("visibilitychange",y),window.removeEventListener("pagehide",m),t!==null&&(window.clearTimeout(t),t=null)}},Vk=async()=>{if(await Ep().catch(()=>{}),"serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(a=>a.unregister()))}if("caches"in window){const t=await window.caches.keys();await Promise.all(t.map(a=>window.caches.delete(a)))}const n=window.indexedDB;if(typeof n.databases=="function"){const t=await n.databases();await Promise.all(t.map(a=>a.name).filter(a=>!!a).map(a=>new Promise(r=>{const c=n.deleteDatabase(a);c.onsuccess=()=>r(),c.onerror=()=>r(),c.onblocked=()=>r()})))}window.localStorage.clear(),window.sessionStorage.clear()},T2=980,_f=[{id:"theme",title:"主题",description:"调整界面的颜色风格。",icon:"theme"},{id:"models",title:"模型维护",description:"维护可选模型、默认模型和展示顺序。",icon:"models"},{id:"cache",title:"缓存",description:"解决页面没更新的问题。",icon:"cache"},{id:"notifications",title:"移动提醒",description:"安装到桌面,并在对话完成后接收系统通知。",icon:"notifications"},{id:"connection",title:"连接状态",description:"查看现在连到哪台设备。",icon:"connection"}],Kk=[{value:"light",label:"浅色",icon:"sun"},{value:"dark",label:"深色",icon:"moon"},{value:"system",label:"系统",icon:"system"}],Yk=(n,t,a,r)=>["const pandaTheme = {",` codeThemeId: "${n}",`,` accent: "${t.toLowerCase()}",`,` contrast: ${a},`,` opaqueWindows: ${r},`,"}"],Zk=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m15 6-6 6 6 6"})}),Wk=({open:n})=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:n?"m6 9 6 6 6-6":"m9 6 6 6-6 6"})}),Xk=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M9 6h.01M9 12h.01M9 18h.01M15 6h.01M15 12h.01M15 18h.01"})}),Jk=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),eN=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"m4 20 4.2-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.6-.6a1.8 1.8 0 0 0-2.6 0L5 15.8 4 20Z"}),l.jsx("path",{d:"m13.5 6.5 4 4"})]}),tN=()=>l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M4.5 7h15"}),l.jsx("path",{d:"M9.5 4.5h5"}),l.jsx("path",{d:"M7 7l.6 11a1.8 1.8 0 0 0 1.8 1.7h5.2a1.8 1.8 0 0 0 1.8-1.7L17 7"}),l.jsx("path",{d:"M10 10.5v5.2"}),l.jsx("path",{d:"M14 10.5v5.2"})]}),nN=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m12 6-5 5M12 6l5 5M12 6v12"})}),sN=()=>l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m12 18-5-5M12 18l5-5M12 18V6"})}),E2=({icon:n})=>n==="cache"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M5 8.5C5 6.57 8.13 5 12 5s7 1.57 7 3.5S15.87 12 12 12 5 10.43 5 8.5Z"}),l.jsx("path",{d:"M5 8.5v7c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5v-7"}),l.jsx("path",{d:"M5 12c0 1.93 3.13 3.5 7 3.5s7-1.57 7-3.5"})]}):n==="models"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M5 7.5h14M5 12h14M5 16.5h14"}),l.jsx("path",{d:"M8 5.5h.01M8 10h.01M8 14.5h.01"})]}):n==="connection"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9.5 14.5a3.5 3.5 0 0 1 0-5l1.5-1.5a3.5 3.5 0 0 1 5 5L15 14"}),l.jsx("path",{d:"M14.5 9.5a3.5 3.5 0 0 1 0 5L13 16a3.5 3.5 0 0 1-5-5L9 10"})]}):n==="notifications"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M6.5 9.5a5.5 5.5 0 0 1 11 0c0 5.25 1.9 6.83 1.9 6.83H4.6S6.5 14.75 6.5 9.5Z"}),l.jsx("path",{d:"M10 18.25a2.1 2.1 0 0 0 4 0"})]}):l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M12 4.75v2.1M12 17.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.85"})]}),aN=({icon:n,active:t})=>{const a=t?2:1.8;return n==="sun"?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4.1"}),l.jsx("path",{d:"M12 2.75v2.1M12 19.15v2.1M4.78 4.78l1.49 1.49M17.73 17.73l1.49 1.49M2.75 12h2.1M19.15 12h2.1M4.78 19.22l1.49-1.49M17.73 6.27l1.49-1.49"})]}):n==="moon"?l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M20.2 14.1A8.5 8.5 0 1 1 9.9 3.8a6.9 6.9 0 0 0 10.3 10.3Z"})}):l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"3.5",y:"5",width:"17",height:"12",rx:"2.4"}),l.jsx("path",{d:"M8 19h8"})]})},iN=({title:n,caption:t,accent:a,background:r,foreground:c,lines:u})=>l.jsxs("div",{className:"theme-preview-panel",style:{"--preview-accent":a,"--preview-background":r,"--preview-foreground":c},children:[l.jsxs("div",{className:"theme-preview-panel__meta",children:[l.jsx("span",{children:n}),l.jsx("span",{children:t})]}),l.jsx("pre",{className:"theme-preview-panel__code","aria-label":`${n} 主题预览`,children:u.map(h=>l.jsx("code",{children:h},h))})]}),ko=({label:n,value:t})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsxs("div",{className:"theme-token",children:[l.jsx("span",{className:"theme-token__swatch",style:{"--token-color":t}}),l.jsx("span",{children:t})]})]}),bf=({label:n,value:t})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsx("div",{className:"theme-token",children:t})]}),M2=({label:n,value:t,mono:a})=>l.jsxs("div",{className:"settings-row settings-row--token",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsx("div",{className:`theme-token theme-token--font ${a?"is-mono":""}`,children:t})]}),R2=({label:n,value:t,onChange:a,min:r,max:c})=>l.jsxs("div",{className:"settings-row settings-row--size",children:[l.jsx("div",{className:"settings-row__copy",children:l.jsx("span",{className:"settings-row__label",children:n})}),l.jsxs("div",{className:"theme-stepper",children:[l.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t-1),"aria-label":`${n} 减小 1px`,children:"-"}),l.jsxs("label",{className:"theme-stepper__input-wrap",children:[l.jsx("input",{className:"theme-stepper__input",type:"number",min:r,max:c,step:1,value:t,onChange:u=>a(Number(u.target.value))}),l.jsx("span",{children:"px"})]}),l.jsx("button",{type:"button",className:"theme-stepper__button",onClick:()=>a(t+1),"aria-label":`${n} 增大 1px`,children:"+"})]})]}),A2=(n,t,a,r)=>{if(t===a)return n;const c=n.findIndex(b=>b.id===t),u=n.findIndex(b=>b.id===a);if(c<0||u<0)return n;const h=[...n],[p]=h.splice(c,1);if(!p)return n;const y=h.findIndex(b=>b.id===a),m=r==="before"?y:y+1;return h.splice(m,0,p),h},rN=()=>{var ls;const n=Mr(),t=Tl(),{data:a}=qu(),[r,c]=_.useState(!1),[u,h]=_.useState(null),[p,y]=_.useState(null),[m,b]=_.useState("theme"),[g,x]=_.useState(null),[w,N]=_.useState(()=>typeof window<"u"&&window.innerWidth>=T2),[T,C]=_.useState(()=>gp()),[I,$]=_.useState(()=>yp()),[H,R]=_.useState(null),[Q,ce]=_.useState(!1),[Z,ie]=_.useState(()=>M1()),[ee,Y]=_.useState(()=>D6()),F=va(j=>j.themeSettings),_e=va(j=>j.resolvedTheme),je=va(j=>j.systemAppearance),ae=va(j=>j.setThemeMode),ue=va(j=>j.setLightThemeId),E=va(j=>j.setDarkThemeId),U=va(j=>j.setUiFontSize),te=va(j=>j.setCodeFontSize),W=d0(),[xe,A]=_.useState(()=>c0()),[ne,be]=_.useState(()=>Tf()),[V,pe]=_.useState(null),[Ce,Le]=_.useState(()=>cu()),[he,q]=_.useState(null),[Se,Ne]=_.useState(null),[me,Te]=_.useState(null),Ge=typeof window>"u"?null:Mu(),Ue=(a==null?void 0:a.sessions.find(j=>j.id===Ge))??(a==null?void 0:a.sessions.find(j=>j.id===a.active_session_id))??(a==null?void 0:a.sessions.find(j=>!j.archived))??(a==null?void 0:a.sessions[0]),gt=(a==null?void 0:a.agents.find(j=>j.id===(Ue==null?void 0:Ue.agent_id)))??(a==null?void 0:a.agents[0]),Lt=Es({queryKey:["settings-connection"],queryFn:async()=>{const j=await Jn(),z=await fetch(`${j.baseUrl}/health`);return{modeLabel:j.mode==="hub"?"通过 Panda Hub":"直接连接",backendLabel:j.label,backendUrl:j.baseUrl,healthOk:z.ok}}}),St=Es({queryKey:["codex-commands"],queryFn:async()=>(await Jn()).client.getCodexCommands(),staleTime:0,refetchOnWindowFocus:!1}),st=Vn({mutationFn:async()=>(await Jn()).client.refreshCodexCommands(),onMutate:()=>{h(null)},onSuccess:async j=>{t.setQueryData(["codex-commands"],j),await t.invalidateQueries({queryKey:["codex-commands"]}),h(`命令目录已刷新,共 ${j.commands.length} 条,CLI 版本 ${j.cli_version??"未知"}。`)},onError:j=>{h(j instanceof Error?j.message:"刷新命令目录失败。")}});_.useEffect(()=>{if(typeof window>"u")return;const j=()=>{const z=window.innerWidth>=T2;N(z)};return j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]),_.useEffect(()=>{h(null)},[(ls=Lt.data)==null?void 0:ls.backendUrl]),_.useEffect(()=>{w&&x(m)},[m,w]),_.useEffect(()=>{q(null)},[m]),_.useEffect(()=>{if(typeof window>"u")return;const j=we=>{we.preventDefault(),R(we)},z=()=>{R(null),ie(!0),y("应用已安装到桌面。")},ge=()=>{$(yp()),C(gp()),ie(M1()),Y(D6())};return window.addEventListener("beforeinstallprompt",j),window.addEventListener("appinstalled",z),document.addEventListener("visibilitychange",ge),()=>{window.removeEventListener("beforeinstallprompt",j),window.removeEventListener("appinstalled",z),document.removeEventListener("visibilitychange",ge)}},[]),_.useEffect(()=>{if(W.length===0||W.some(z=>z.value===xe))return;const j=W[0].value;bu(j),A(j)},[W,xe]),_.useEffect(()=>{var z;if(W.length===0||W.some(ge=>ge.value===ne))return;const j=((z=W.find(ge=>ge.value==="gpt-5.4-mini"))==null?void 0:z.value)??W[0].value;O1(j),be(j)},[ne,W]);const tn=()=>{if(Ue!=null&&Ue.id){xr(Ue.agent_id),fs(Ue.id),n({to:"/"});return}n({to:"/nodes"})},$t=async()=>{h(null),c(!0);try{await Vk(),h("缓存已清理,正在重新载入…"),window.setTimeout(()=>{window.location.replace(`/settings?cache-reset=${Date.now()}`)},180)}catch{c(!1),h("清理失败,请在浏览器设置中手动清理站点数据。")}},de=async()=>{if(I!=="granted"){const z=await Cx();if($(z),z==="granted"){const ge={completionNotificationsEnabled:!0};A6(ge),C(ge),y("系统通知已开启,后续对话完成会提醒你。");return}if(z==="denied"){y("系统通知已被拒绝,请到浏览器或系统设置里重新开启。");return}y("还没有拿到通知权限,可以稍后再试一次。");return}const j={completionNotificationsEnabled:!T.completionNotificationsEnabled};A6(j),C(j),y(j.completionNotificationsEnabled?"完成提醒已开启。":"完成提醒已关闭。")},Ae=async()=>{if(!H){y(ee?"请在浏览器菜单里选择“安装应用”或“添加到主屏幕”。":"当前浏览器没有提供安装弹窗,请使用浏览器的“添加到主屏幕”。");return}ce(!0),y(null);try{await H.prompt(),(await H.userChoice).outcome==="accepted"?y("安装请求已提交,请回到桌面查看。"):y("你取消了这次安装。")}finally{R(null),ce(!1),ie(M1())}},Re=j=>{var z,ge,we;if(WS(j),!j.some(ke=>ke.value===xe)){const ke=((z=j[0])==null?void 0:z.value)??"";ke&&(bu(ke),A(ke))}if(!j.some(ke=>ke.value===ne)){const ke=((ge=j.find(Ve=>Ve.value==="gpt-5.4-mini"))==null?void 0:ge.value)??((we=j[0])==null?void 0:we.value)??"";ke&&(O1(ke),be(ke))}},Oe=()=>{pe("new"),Le(cu()),q(null)},Ke=j=>{pe(j.id),Le({...j}),q(null)},mt=()=>{pe(null),Le(cu()),q(null)},kt=()=>{var Ve;const j=Ce.label.trim(),z=Ce.value.trim();if(!j||!z){q("请填写显示名和模型 ID。");return}if(W.find(ct=>ct.value.toLowerCase()===z.toLowerCase()&&ct.id!==V)){q(`模型 ID ${z} 已存在。`);return}const we={...Ce,label:j,value:z,description:((Ve=Ce.description)==null?void 0:Ve.trim())||null},ke=V==="new"?[...W,we]:W.map(ct=>ct.id===V?we:ct);Re(ke),pe(null),Le(cu()),q(V==="new"?"模型已添加。":"模型已更新。")},rn=j=>{const z=W.filter(ge=>ge.id!==j);if(z.length===0){q("至少保留一个模型。");return}Re(z),V===j&&(pe(null),Le(cu())),q("模型已删除。")},Pn=j=>{bu(j),A(j),q(`默认模型已切换为 ${j}。`)},On=j=>{O1(j),be(j),q(`命令执行模型已切换为 ${j}。`)},nn=(j,z)=>{const ge=W.findIndex(Ve=>Ve.id===j);if(ge<0)return;const we=z==="up"?ge-1:ge+1;if(we<0||we>=W.length)return;const ke=W[we];ke&&Re(A2(W,j,ke.id,z==="up"?"before":"after"))},ln=(j,z)=>{Ne(z),Te(null),j.dataTransfer.effectAllowed="move",j.dataTransfer.setData("text/plain",z)},oe=(j,z)=>{if(!Se||Se===z)return;j.preventDefault();const ge=j.currentTarget.getBoundingClientRect(),we=j.clientY<ge.top+ge.height/2?"before":"after";Te(ke=>(ke==null?void 0:ke.modelId)===z&&ke.position===we?ke:{modelId:z,position:we})},qe=j=>{!Se||!me||me.modelId!==j||(Re(A2(W,Se,j,me.position)),Ne(null),Te(null))},De=()=>{Ne(null),Te(null)},Ie=_e.appearance,We=Ie==="light"?vp:Au,$e=Ie==="light"?F.lightThemeId:F.darkThemeId,He=We.find(j=>j.id===$e)??We[0],Ee=_e.activeTheme,Ut=Yk(He.codeThemeId,He.accent,He.contrast,He.opaqueWindows),at=F.mode==="system"?`当前跟随系统:${je==="dark"?"深色":"浅色"}`:`当前固定为${_e.appearance==="dark"?"深色":"浅色"}模式`,pn="当前正在显示",Un=He.opaqueWindows?"不透明窗口":"半透明窗口",xn=_f.find(j=>j.id===m)??_f[0],ps=`${He.label} · ${Un} · 对比度 ${He.contrast}`,gs=W.find(j=>j.value===xe)??W[0]??null,is=W.find(j=>j.value===ne)??W.find(j=>j.value==="gpt-5.4-mini")??W[0]??null,Ci=()=>l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsxs("div",{children:[l.jsx("h3",{className:"settings-panel__title",children:"外观"}),l.jsx("p",{className:"settings-panel__subtitle",children:"先选浅色或深色,再挑一个你喜欢的风格。"})]})}),l.jsx("div",{className:"settings-control-grid",children:l.jsxs("div",{className:"settings-control-block settings-control-block--full",children:[l.jsx("span",{className:"settings-control-block__label",children:"显示方式"}),l.jsx("div",{className:"theme-mode-switch",role:"tablist","aria-label":"主题模式",children:Kk.map(j=>{const z=j.value===F.mode;return l.jsxs("button",{type:"button",className:`theme-mode-switch__button ${z?"is-active":""}`,onClick:()=>ae(j.value),role:"tab","aria-selected":z,children:[l.jsx(aN,{icon:j.icon,active:z}),l.jsx("span",{children:j.label})]},j.value)})}),l.jsx("p",{className:"settings-control-block__hint",children:at})]})})]}),l.jsxs("div",{className:"settings-theme-layout",children:[l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:Ie==="light"?"浅色风格":"深色风格"})})}),l.jsxs("div",{className:"settings-theme-selector",children:[l.jsx("label",{className:"settings-select settings-select--wide",children:l.jsx("select",{value:He.id,onChange:j=>{if(Ie==="light"){ue(j.target.value);return}E(j.target.value)},"aria-label":Ie==="light"?"选择浅色主题":"选择深色主题",children:We.map(j=>l.jsx("option",{value:j.id,children:j.label},`${j.variant}-${j.id}`))})}),l.jsxs("div",{className:"settings-theme-selector__summary",children:[l.jsxs("div",{className:"settings-theme-selector__swatches","aria-hidden":"true",children:[l.jsx("span",{style:{"--theme-card-color":He.background}}),l.jsx("span",{style:{"--theme-card-color":He.foreground}}),l.jsx("span",{style:{"--theme-card-color":He.accent}}),l.jsx("span",{style:{"--theme-card-color":He.semanticColors.diffAdded}}),l.jsx("span",{style:{"--theme-card-color":He.semanticColors.diffRemoved}})]}),l.jsxs("div",{className:"settings-theme-selector__copy",children:[l.jsx("strong",{children:He.label}),l.jsx("span",{children:ps})]}),He.id===Ee.id&&He.variant===_e.appearance?l.jsx("span",{className:"settings-theme-selector__badge",children:"当前"}):l.jsx("span",{className:"settings-theme-selector__badge is-muted",children:"已选"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsxs("div",{className:"settings-panel__header",children:[l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"风格细节"})}),l.jsx("div",{className:"theme-status-badge",children:pn})]}),l.jsx(iN,{title:Ie==="light"?"浅色预览":"深色预览",caption:He.label,accent:He.accent,background:He.background,foreground:He.foreground,lines:Ut}),l.jsxs("div",{className:"settings-list",children:[l.jsx(bf,{label:"代码风格",value:He.codeThemeId}),l.jsx(bf,{label:"当前模式",value:He.variant}),l.jsx(bf,{label:"对比度",value:String(He.contrast)}),l.jsx(bf,{label:"面板质感",value:Un}),l.jsx(ko,{label:"强调色",value:He.accent}),l.jsx(ko,{label:"背景色",value:He.background}),l.jsx(ko,{label:"文字色",value:He.foreground}),l.jsx(ko,{label:"新增颜色",value:He.semanticColors.diffAdded}),l.jsx(ko,{label:"删除颜色",value:He.semanticColors.diffRemoved}),l.jsx(ko,{label:"特殊强调",value:He.semanticColors.skill}),l.jsx(M2,{label:"界面字体",value:He.fonts.ui??"null"}),l.jsx(M2,{label:"代码字体",value:He.fonts.code??"null",mono:!0})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"字号"})})}),l.jsxs("div",{className:"settings-list",children:[l.jsx(R2,{label:"界面字号",value:F.uiFontSize,onChange:j=>U(J3(j)),min:11,max:18}),l.jsx(R2,{label:"代码字号",value:F.codeFontSize,onChange:j=>te(ey(j)),min:10,max:18})]})]})]}),la=()=>{var j;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsxs("div",{className:"settings-panel__header",children:[l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"模型列表"})}),l.jsxs("button",{type:"button",className:"settings-inline-action",onClick:Oe,children:[l.jsx(Jk,{}),"新增模型"]})]}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"首位模型"}),l.jsx("strong",{children:((j=W[0])==null?void 0:j.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"当前默认"}),l.jsx("strong",{children:(gs==null?void 0:gs.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"命令执行模型"}),l.jsx("strong",{children:(is==null?void 0:is.label)??"未配置"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"可选数量"}),l.jsxs("strong",{children:[W.length," 个"]})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"模型角色"})})}),l.jsxs("div",{className:"settings-model-editor__grid",children:[l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"默认模型"}),l.jsx("select",{value:xe,onChange:z=>Pn(z.target.value),children:W.map(z=>l.jsx("option",{value:z.value,children:z.label},z.id))})]}),l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"命令执行模型"}),l.jsx("select",{value:ne,onChange:z=>On(z.target.value),children:W.map(z=>l.jsx("option",{value:z.value,children:z.label},z.id))})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"维护模型"})})}),he?l.jsx("div",{className:"settings-inline-status",role:"alert",children:he}):null,l.jsx("div",{className:"settings-model-list",role:"list","aria-label":"模型列表",children:W.map((z,ge)=>{const we=Se===z.id,ke=(me==null?void 0:me.modelId)===z.id&&me.position==="before",Ve=(me==null?void 0:me.modelId)===z.id&&me.position==="after",ct=z.value===xe;return l.jsxs("article",{className:`settings-model-card ${we?"is-dragging":""} ${ke?"is-drop-before":""} ${Ve?"is-drop-after":""}`,draggable:!0,onDragStart:Nt=>ln(Nt,z.id),onDragOver:Nt=>oe(Nt,z.id),onDrop:Nt=>{Nt.preventDefault(),qe(z.id)},onDragEnd:De,role:"listitem",children:[l.jsxs("div",{className:"settings-model-card__main",children:[l.jsx("span",{className:"settings-model-card__grip","aria-hidden":"true",children:l.jsx(Xk,{})}),l.jsxs("div",{className:"settings-model-card__copy",children:[l.jsxs("div",{className:"settings-model-card__title-row",children:[l.jsx("strong",{children:z.label}),ct?l.jsx("span",{className:"settings-model-card__badge",children:"默认"}):null]}),l.jsx("code",{className:"settings-model-card__value",children:z.value})]})]}),l.jsxs("div",{className:"settings-model-card__actions",children:[l.jsx("button",{type:"button",className:`settings-mini-button ${ct?"is-active":""}`,onClick:()=>Pn(z.value),children:"设为默认"}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>nn(z.id,"up"),disabled:ge===0,"aria-label":`上移 ${z.label}`,children:l.jsx(nN,{})}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>nn(z.id,"down"),disabled:ge===W.length-1,"aria-label":`下移 ${z.label}`,children:l.jsx(sN,{})}),l.jsx("button",{type:"button",className:"settings-icon-button",onClick:()=>Ke(z),"aria-label":`编辑 ${z.label}`,children:l.jsx(eN,{})}),l.jsx("button",{type:"button",className:"settings-icon-button is-danger",onClick:()=>rn(z.id),disabled:W.length<=1,"aria-label":`删除 ${z.label}`,children:l.jsx(tN,{})})]})]},z.id)})}),V?l.jsxs("div",{className:"settings-model-editor",children:[l.jsx("div",{className:"settings-model-editor__header",children:l.jsx("strong",{children:V==="new"?"新增模型":"编辑模型"})}),l.jsxs("div",{className:"settings-model-editor__grid",children:[l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"显示名"}),l.jsx("input",{type:"text",value:Ce.label,onChange:z=>Le(ge=>({...ge,label:z.target.value})),placeholder:"例如:gpt-5.4"})]}),l.jsxs("label",{className:"settings-field",children:[l.jsx("span",{children:"模型 ID"}),l.jsx("input",{type:"text",value:Ce.value,onChange:z=>Le(ge=>({...ge,value:z.target.value})),placeholder:"例如:gpt-5.4"})]})]}),l.jsxs("div",{className:"settings-model-editor__actions",children:[l.jsx("button",{type:"button",className:"settings-ghost-button",onClick:mt,children:"取消"}),l.jsx("button",{type:"button",className:"settings-inline-action",onClick:kt,children:"保存"})]})]}):null]})]})},Gs=()=>{var j,z;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"页面缓存"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"适合什么时候用"}),l.jsx("strong",{children:"页面资源或本地缓存异常"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"常见表现"}),l.jsx("strong",{children:"样式没更新、列表卡旧、页面反复异常"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"清理缓存"})})}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void $t(),disabled:r,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"清理并刷新"}),l.jsx("span",{children:"删除页面资源缓存和本地会话缓存,强制重新加载最新页面。"})]}),l.jsx("span",{className:"settings-action__state",children:r?"处理中…":"→"})]}),u?l.jsx("p",{className:"settings-block__status",children:u}):null]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"移动端诊断"})})}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void n({to:"/diagnostics"}),children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"打开安卓诊断页"}),l.jsx("span",{children:"在手机上检查样式能力、资源加载、Service Worker 和缓存状态,并可上传到后端日志。"})]}),l.jsx("span",{className:"settings-action__state",children:"→"})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"命令目录缓存"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"当前 CLI"}),l.jsx("span",{children:((j=St.data)==null?void 0:j.cli_version)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"最近刷新"}),l.jsx("span",{children:((z=St.data)==null?void 0:z.loaded_at)??"尚未生成"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"命令数量"}),l.jsx("span",{children:St.data?`${St.data.commands.length} 条`:"检测中…"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void st.mutateAsync(),disabled:st.isPending,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:"刷新命令目录"}),l.jsx("span",{children:"重新从当前 Codex CLI 对应版本拉取命令并覆盖本地缓存文件。"})]}),l.jsx("span",{className:"settings-action__state",children:st.isPending?"刷新中…":"→"})]})]})]})},rs=()=>{var j,z,ge,we,ke;return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"当前设备"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"设备名称"}),l.jsx("strong",{children:(gt==null?void 0:gt.name)??"未选择节点"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"连接方式"}),l.jsx("strong",{children:((j=Lt.data)==null?void 0:j.modeLabel)??"检测中…"})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"状态"}),l.jsx("strong",{className:(z=Lt.data)!=null&&z.healthOk?"is-ok":"is-muted",children:Lt.isLoading?"检测中…":(ge=Lt.data)!=null&&ge.healthOk?"在线":"无法连接"})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"更多信息"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"服务名称"}),l.jsx("span",{children:((we=Lt.data)==null?void 0:we.backendLabel)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"服务地址"}),l.jsx("span",{children:((ke=Lt.data)==null?void 0:ke.backendUrl)??"检测中…"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"设备标识"}),l.jsx("span",{children:(gt==null?void 0:gt.id)??"未选择节点"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"最近会话"}),l.jsx("span",{children:(Ue==null?void 0:Ue.title)??"未选择会话"})]})]})]})},xa=()=>{const j=Z?"已安装":"未安装",z=I==="granted"?"已允许":I==="denied"?"已拒绝":I==="default"?"待授权":"不支持",ge=I==="granted"&&T.completionNotificationsEnabled?"已开启":"未开启";return l.jsxs("div",{className:"settings-content-stack",children:[l.jsxs("section",{className:"settings-panel settings-panel--hero",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"安卓优先提醒"})})}),l.jsxs("div",{className:"settings-summary-strip",children:[l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"桌面安装"}),l.jsx("strong",{children:j})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"系统通知权限"}),l.jsx("strong",{children:z})]}),l.jsxs("div",{className:"settings-summary-strip__item",children:[l.jsx("span",{children:"完成提醒"}),l.jsx("strong",{children:ge})]})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"安装到桌面"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"推荐平台"}),l.jsx("span",{children:ee?"Android 当前设备":"Android 效果最佳"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"当前形态"}),l.jsx("span",{children:Z?"已是桌面应用":"浏览器标签页"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void Ae(),disabled:Z||Q,children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:Z?"已经安装":"安装到桌面"}),l.jsx("span",{children:Z?"现在可以直接从桌面图标进入 Panda。":"安装后更像应用,系统通知和锁屏提醒也更稳定。"})]}),l.jsx("span",{className:"settings-action__state",children:Z?"✓":Q?"处理中…":"→"})]})]}),l.jsxs("section",{className:"settings-panel",children:[l.jsx("div",{className:"settings-panel__header",children:l.jsx("div",{children:l.jsx("h3",{className:"settings-panel__title",children:"对话完成提醒"})})}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"提醒方式"}),l.jsx("span",{children:"系统通知"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"锁屏可见"}),l.jsx("span",{children:Z?"已具备条件":"建议先安装到桌面"})]}),l.jsxs("div",{className:"settings-meta",children:[l.jsx("span",{children:"触发时机"}),l.jsx("span",{children:"收到对话完成事件后提醒"})]}),l.jsxs("button",{type:"button",className:"settings-action",onClick:()=>void de(),disabled:I==="unsupported",children:[l.jsxs("div",{className:"settings-action__copy",children:[l.jsx("strong",{children:I==="granted"&&T.completionNotificationsEnabled?"关闭完成提醒":"开启完成提醒"}),l.jsx("span",{children:I==="unsupported"?"当前环境不支持系统通知,需要 HTTPS、Service Worker 和受支持浏览器。":"当会话生成最终回复后,以系统通知方式提醒你。"})]}),l.jsx("span",{className:"settings-action__state",children:I==="unsupported"?"不可用":I==="granted"&&T.completionNotificationsEnabled?"✓":"→"})]}),p?l.jsx("p",{className:"settings-block__status",children:p}):null]})]})},Vs=j=>j==="models"?la():j==="cache"?Gs():j==="notifications"?xa():j==="connection"?rs():Ci();return l.jsx("div",{className:"conversation-page settings-screen settings-screen--workspace",children:l.jsx("div",{className:"conversation-main settings-screen__main settings-screen__workspace-main",children:l.jsx("div",{className:"settings-screen__body",children:l.jsxs("div",{className:"settings-shell",children:[l.jsxs("header",{className:"settings-page-header",children:[l.jsx("button",{type:"button",className:"settings-card__back",onClick:tn,"aria-label":"返回会话",children:l.jsx(Zk,{})}),l.jsx("div",{className:"settings-page-header__copy",children:l.jsx("h1",{className:"settings-page-header__title",children:"设置"})})]}),w?l.jsxs("div",{className:"settings-workspace",children:[l.jsxs("aside",{className:"settings-sidebar",children:[l.jsx("div",{className:"settings-sidebar__title",children:"设置"}),l.jsx("nav",{className:"settings-sidebar__nav","aria-label":"设置导航",children:_f.map(j=>{const z=j.id===m;return l.jsxs("button",{type:"button",className:`settings-sidebar__item ${z?"is-active":""}`,onClick:()=>b(j.id),children:[l.jsx(E2,{icon:j.icon}),l.jsx("span",{children:j.title})]},j.id)})})]}),l.jsxs("main",{className:"settings-stage",children:[l.jsx("header",{className:"settings-stage__header",children:l.jsxs("div",{children:[l.jsx("h2",{className:"settings-stage__title",children:xn.title}),l.jsx("p",{className:"settings-stage__description",children:xn.description})]})}),Vs(m)]})]}):l.jsx("div",{className:"settings-mobile-sections",children:_f.map(j=>{const z=g===j.id;return l.jsxs("section",{className:`settings-mobile-card ${z?"is-open":""}`,children:[l.jsxs("button",{type:"button",className:"settings-mobile-card__header",onClick:()=>{b(j.id),x(ge=>ge===j.id?null:j.id)},"aria-expanded":z,children:[l.jsxs("span",{className:"settings-mobile-card__title-wrap",children:[l.jsx("span",{className:"settings-mobile-card__icon",children:l.jsx(E2,{icon:j.icon})}),l.jsx("span",{className:"settings-mobile-card__copy",children:l.jsx("span",{className:"settings-mobile-card__title",children:j.title})})]}),l.jsx("span",{className:`settings-mobile-card__chevron ${z?"is-open":""}`,children:l.jsx(Wk,{open:z})})]}),z?l.jsx("div",{className:"settings-mobile-card__body",children:Vs(j.id)}):null]},j.id)})})]})})})})},q1=new Xv,lN=async()=>{},oN=_.lazy(async()=>({default:(await Rp(()=>import("./diagnostics-page-B2ynzqBC.js"),__vite__mapDeps([0,1]))).DiagnosticsPage})),cN=()=>l.jsx(_.Suspense,{fallback:l.jsx("main",{className:"diagnostics-page",children:l.jsx("div",{className:"diagnostics-shell",children:l.jsx("section",{className:"diagnostics-card",children:l.jsx("p",{children:"正在载入诊断页…"})})})}),children:l.jsx(oN,{})}),Ml=J9({component:sS}),uN=El({getParentRoute:()=>Ml,path:"/",component:g0}),dN=El({getParentRoute:()=>Ml,path:"/nodes",component:rS}),fN=El({getParentRoute:()=>Ml,path:"/session/$sessionId",component:g0}),hN=El({getParentRoute:()=>Ml,path:"/new-thread/$agentId",component:g0}),mN=El({getParentRoute:()=>Ml,path:"/settings",component:rN}),pN=El({getParentRoute:()=>Ml,path:"/diagnostics",component:cN}),gN=Ml.addChildren([uN,dN,fN,hN,mN,pN]),yN=lb({routeTree:gN,defaultPreload:"intent"});typeof document<"u"&&ny(ty());lN().catch(()=>{}).then(async()=>{await Fk(q1),Gk(q1)}).finally(()=>{bv.createRoot(document.getElementById("root")).render(l.jsx(Jv,{client:q1,children:l.jsx(ub,{router:yN})}))});export{dv as g,l as j,_ as r,Mr as u};