@idl3/claude-control 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/codex.js +105 -4
- package/lib/pane-registry.js +23 -10
- package/lib/sessions.js +22 -6
- package/package.json +1 -1
- package/server.js +7 -4
- package/web/dist/assets/{core-CpT6tRRG.js → core-C29-1O9j.js} +1 -1
- package/web/dist/assets/index-CT-y6LU4.css +1 -0
- package/web/dist/assets/index-DzIDTXLS.js +103 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-CjOcrKRX.css +0 -1
- package/web/dist/assets/index-CxhR0MPg.js +0 -103
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var bC=Object.defineProperty;var _C=(e,t,n)=>t in e?bC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var N=(e,t,n)=>_C(e,typeof t!="symbol"?t+"":t,n);function SC(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var tu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Va(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vx={exports:{}},ec={},Hx={exports:{}},_e={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ha=Symbol.for("react.element"),kC=Symbol.for("react.portal"),CC=Symbol.for("react.fragment"),EC=Symbol.for("react.strict_mode"),TC=Symbol.for("react.profiler"),IC=Symbol.for("react.provider"),RC=Symbol.for("react.context"),PC=Symbol.for("react.forward_ref"),jC=Symbol.for("react.suspense"),AC=Symbol.for("react.memo"),NC=Symbol.for("react.lazy"),Vm=Symbol.iterator;function MC(e){return e===null||typeof e!="object"?null:(e=Vm&&e[Vm]||e["@@iterator"],typeof e=="function"?e:null)}var Wx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qx=Object.assign,Kx={};function ho(e,t,n){this.props=e,this.context=t,this.refs=Kx,this.updater=n||Wx}ho.prototype.isReactComponent={};ho.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ho.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gx(){}Gx.prototype=ho.prototype;function Ih(e,t,n){this.props=e,this.context=t,this.refs=Kx,this.updater=n||Wx}var Rh=Ih.prototype=new Gx;Rh.constructor=Ih;qx(Rh,ho.prototype);Rh.isPureReactComponent=!0;var Hm=Array.isArray,Yx=Object.prototype.hasOwnProperty,Ph={current:null},Qx={key:!0,ref:!0,__self:!0,__source:!0};function Xx(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Yx.call(t,r)&&!Qx.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];s.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:Ha,type:e,key:i,ref:o,props:s,_owner:Ph.current}}function DC(e,t){return{$$typeof:Ha,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function jh(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ha}function LC(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Wm=/\/+/g;function Oc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?LC(""+e.key):t.toString(36)}function Dl(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ha:case kC:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Oc(o,0):r,Hm(s)?(n="",e!=null&&(n=e.replace(Wm,"$&/")+"/"),Dl(s,t,n,"",function(u){return u})):s!=null&&(jh(s)&&(s=DC(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Wm,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",Hm(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+Oc(i,a);o+=Dl(i,t,n,l,s)}else if(l=MC(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+Oc(i,a++),o+=Dl(i,t,n,l,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function rl(e,t,n){if(e==null)return e;var r=[],s=0;return Dl(e,r,"","",function(i){return t.call(n,i,s++)}),r}function OC(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ht={current:null},Ll={transition:null},zC={ReactCurrentDispatcher:Ht,ReactCurrentBatchConfig:Ll,ReactCurrentOwner:Ph};function Jx(){throw Error("act(...) is not supported in production builds of React.")}_e.Children={map:rl,forEach:function(e,t,n){rl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return rl(e,function(){t++}),t},toArray:function(e){return rl(e,function(t){return t})||[]},only:function(e){if(!jh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};_e.Component=ho;_e.Fragment=CC;_e.Profiler=TC;_e.PureComponent=Ih;_e.StrictMode=EC;_e.Suspense=jC;_e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=zC;_e.act=Jx;_e.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=qx({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Ph.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Yx.call(t,l)&&!Qx.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Ha,type:e.type,key:s,ref:i,props:r,_owner:o}};_e.createContext=function(e){return e={$$typeof:RC,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:IC,_context:e},e.Consumer=e};_e.createElement=Xx;_e.createFactory=function(e){var t=Xx.bind(null,e);return t.type=e,t};_e.createRef=function(){return{current:null}};_e.forwardRef=function(e){return{$$typeof:PC,render:e}};_e.isValidElement=jh;_e.lazy=function(e){return{$$typeof:NC,_payload:{_status:-1,_result:e},_init:OC}};_e.memo=function(e,t){return{$$typeof:AC,type:e,compare:t===void 0?null:t}};_e.startTransition=function(e){var t=Ll.transition;Ll.transition={};try{e()}finally{Ll.transition=t}};_e.unstable_act=Jx;_e.useCallback=function(e,t){return Ht.current.useCallback(e,t)};_e.useContext=function(e){return Ht.current.useContext(e)};_e.useDebugValue=function(){};_e.useDeferredValue=function(e){return Ht.current.useDeferredValue(e)};_e.useEffect=function(e,t){return Ht.current.useEffect(e,t)};_e.useId=function(){return Ht.current.useId()};_e.useImperativeHandle=function(e,t,n){return Ht.current.useImperativeHandle(e,t,n)};_e.useInsertionEffect=function(e,t){return Ht.current.useInsertionEffect(e,t)};_e.useLayoutEffect=function(e,t){return Ht.current.useLayoutEffect(e,t)};_e.useMemo=function(e,t){return Ht.current.useMemo(e,t)};_e.useReducer=function(e,t,n){return Ht.current.useReducer(e,t,n)};_e.useRef=function(e){return Ht.current.useRef(e)};_e.useState=function(e){return Ht.current.useState(e)};_e.useSyncExternalStore=function(e,t,n){return Ht.current.useSyncExternalStore(e,t,n)};_e.useTransition=function(){return Ht.current.useTransition()};_e.version="18.3.1";Hx.exports=_e;var m=Hx.exports;const Zt=Va(m),FC=SC({__proto__:null,default:Zt},[m]);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var BC=m,$C=Symbol.for("react.element"),UC=Symbol.for("react.fragment"),VC=Object.prototype.hasOwnProperty,HC=BC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,WC={key:!0,ref:!0,__self:!0,__source:!0};function Zx(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)VC.call(t,r)&&!WC.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:$C,type:e,key:i,ref:o,props:s,_owner:HC.current}}ec.Fragment=UC;ec.jsx=Zx;ec.jsxs=Zx;Vx.exports=ec;var d=Vx.exports,ew={exports:{}},Rn={},tw={exports:{}},nw={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t($,F){var E=$.length;$.push(F);e:for(;0<E;){var X=E-1>>>1,Z=$[X];if(0<s(Z,F))$[X]=F,$[E]=Z,E=X;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var F=$[0],E=$.pop();if(E!==F){$[0]=E;e:for(var X=0,Z=$.length,I=Z>>>1;X<I;){var O=2*(X+1)-1,te=$[O],de=O+1,it=$[de];if(0>s(te,E))de<Z&&0>s(it,te)?($[X]=it,$[de]=E,X=de):($[X]=te,$[O]=E,X=O);else if(de<Z&&0>s(it,E))$[X]=it,$[de]=E,X=de;else break e}}return F}function s($,F){var E=$.sortIndex-F.sortIndex;return E!==0?E:$.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,h=3,p=!1,g=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w($){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=$)r(u),F.sortIndex=F.expirationTime,t(l,F);else break;F=n(u)}}function k($){if(y=!1,w($),!g)if(n(l)!==null)g=!0,J(_);else{var F=n(u);F!==null&&ne(k,F.startTime-$)}}function _($,F){g=!1,y&&(y=!1,x(P),P=-1),p=!0;var E=h;try{for(w(F),f=n(l);f!==null&&(!(f.expirationTime>F)||$&&!M());){var X=f.callback;if(typeof X=="function"){f.callback=null,h=f.priorityLevel;var Z=X(f.expirationTime<=F);F=e.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),w(F)}else r(l);f=n(l)}if(f!==null)var I=!0;else{var O=n(u);O!==null&&ne(k,O.startTime-F),I=!1}return I}finally{f=null,h=E,p=!1}}var S=!1,T=null,P=-1,R=5,C=-1;function M(){return!(e.unstable_now()-C<R)}function D(){if(T!==null){var $=e.unstable_now();C=$;var F=!0;try{F=T(!0,$)}finally{F?U():(S=!1,T=null)}}else S=!1}var U;if(typeof v=="function")U=function(){v(D)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,W=V.port2;V.port1.onmessage=D,U=function(){W.postMessage(null)}}else U=function(){b(D,0)};function J($){T=$,S||(S=!0,U())}function ne($,F){P=b(function(){$(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,J(_))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var F=3;break;default:F=h}var E=h;h=F;try{return $()}finally{h=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,F){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var E=h;h=$;try{return F()}finally{h=E}},e.unstable_scheduleCallback=function($,F,E){var X=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?X+E:X):E=X,$){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=E+Z,$={id:c++,callback:F,priorityLevel:$,startTime:E,expirationTime:Z,sortIndex:-1},E>X?($.sortIndex=E,t(u,$),n(l)===null&&$===n(u)&&(y?(x(P),P=-1):y=!0,ne(k,E-X))):($.sortIndex=Z,t(l,$),g||p||(g=!0,J(_))),$},e.unstable_shouldYield=M,e.unstable_wrapCallback=function($){var F=h;return function(){var E=h;h=F;try{return $.apply(this,arguments)}finally{h=E}}}})(nw);tw.exports=nw;var qC=tw.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var KC=m,Cn=qC;function H(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var rw=new Set,da={};function ai(e,t){Yi(e,t),Yi(e+"Capture",t)}function Yi(e,t){for(da[e]=t,e=0;e<t.length;e++)rw.add(t[e])}var Br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vd=Object.prototype.hasOwnProperty,GC=/^[: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]*$/,qm={},Km={};function YC(e){return Vd.call(Km,e)?!0:Vd.call(qm,e)?!1:GC.test(e)?Km[e]=!0:(qm[e]=!0,!1)}function QC(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function XC(e,t,n,r){if(t===null||typeof t>"u"||QC(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Wt(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Ct={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ct[e]=new Wt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ct[t]=new Wt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ct[e]=new Wt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ct[e]=new Wt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ct[e]=new Wt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ct[e]=new Wt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ct[e]=new Wt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ct[e]=new Wt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ct[e]=new Wt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ah=/[\-:]([a-z])/g;function Nh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ah,Nh);Ct[t]=new Wt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ah,Nh);Ct[t]=new Wt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ah,Nh);Ct[t]=new Wt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ct[e]=new Wt(e,1,!1,e.toLowerCase(),null,!1,!1)});Ct.xlinkHref=new Wt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ct[e]=new Wt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mh(e,t,n,r){var s=Ct.hasOwnProperty(t)?Ct[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(XC(t,n,s,r)&&(n=null),r||s===null?YC(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var qr=KC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,sl=Symbol.for("react.element"),ki=Symbol.for("react.portal"),Ci=Symbol.for("react.fragment"),Dh=Symbol.for("react.strict_mode"),Hd=Symbol.for("react.profiler"),sw=Symbol.for("react.provider"),iw=Symbol.for("react.context"),Lh=Symbol.for("react.forward_ref"),Wd=Symbol.for("react.suspense"),qd=Symbol.for("react.suspense_list"),Oh=Symbol.for("react.memo"),Jr=Symbol.for("react.lazy"),ow=Symbol.for("react.offscreen"),Gm=Symbol.iterator;function Eo(e){return e===null||typeof e!="object"?null:(e=Gm&&e[Gm]||e["@@iterator"],typeof e=="function"?e:null)}var tt=Object.assign,zc;function zo(e){if(zc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);zc=t&&t[1]||""}return`
|
|
34
|
+
`+zc+e}var Fc=!1;function Bc(e,t){if(!e||Fc)return"";Fc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
|
|
35
|
+
`),i=r.stack.split(`
|
|
36
|
+
`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
|
|
37
|
+
`+s[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Fc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?zo(e):""}function JC(e){switch(e.tag){case 5:return zo(e.type);case 16:return zo("Lazy");case 13:return zo("Suspense");case 19:return zo("SuspenseList");case 0:case 2:case 15:return e=Bc(e.type,!1),e;case 11:return e=Bc(e.type.render,!1),e;case 1:return e=Bc(e.type,!0),e;default:return""}}function Kd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ci:return"Fragment";case ki:return"Portal";case Hd:return"Profiler";case Dh:return"StrictMode";case Wd:return"Suspense";case qd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case iw:return(e.displayName||"Context")+".Consumer";case sw:return(e._context.displayName||"Context")+".Provider";case Lh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Oh:return t=e.displayName||null,t!==null?t:Kd(e.type)||"Memo";case Jr:t=e._payload,e=e._init;try{return Kd(e(t))}catch{}}return null}function ZC(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Kd(t);case 8:return t===Dh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ws(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function aw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eE(e){var t=aw(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function il(e){e._valueTracker||(e._valueTracker=eE(e))}function lw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=aw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function nu(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}}function Gd(e,t){var n=t.checked;return tt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ym(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ws(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function uw(e,t){t=t.checked,t!=null&&Mh(e,"checked",t,!1)}function Yd(e,t){uw(e,t);var n=ws(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Qd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qd(e,t.type,ws(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Qm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Qd(e,t,n){(t!=="number"||nu(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Fo=Array.isArray;function zi(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ws(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Xd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(H(91));return tt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Xm(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(H(92));if(Fo(n)){if(1<n.length)throw Error(H(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ws(n)}}function cw(e,t){var n=ws(t.value),r=ws(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Jm(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function dw(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Jd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?dw(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ol,fw=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ol=ol||document.createElement("div"),ol.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ol.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function fa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ho={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tE=["Webkit","ms","Moz","O"];Object.keys(Ho).forEach(function(e){tE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ho[t]=Ho[e]})});function hw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ho.hasOwnProperty(e)&&Ho[e]?(""+t).trim():t+"px"}function pw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=hw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nE=tt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Zd(e,t){if(t){if(nE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(H(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(H(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(H(61))}if(t.style!=null&&typeof t.style!="object")throw Error(H(62))}}function ef(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 tf=null;function zh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nf=null,Fi=null,Bi=null;function Zm(e){if(e=Ka(e)){if(typeof nf!="function")throw Error(H(280));var t=e.stateNode;t&&(t=ic(t),nf(e.stateNode,e.type,t))}}function mw(e){Fi?Bi?Bi.push(e):Bi=[e]:Fi=e}function gw(){if(Fi){var e=Fi,t=Bi;if(Bi=Fi=null,Zm(e),t)for(e=0;e<t.length;e++)Zm(t[e])}}function yw(e,t){return e(t)}function vw(){}var $c=!1;function xw(e,t,n){if($c)return e(t,n);$c=!0;try{return yw(e,t,n)}finally{$c=!1,(Fi!==null||Bi!==null)&&(vw(),gw())}}function ha(e,t){var n=e.stateNode;if(n===null)return null;var r=ic(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(H(231,t,typeof n));return n}var rf=!1;if(Br)try{var To={};Object.defineProperty(To,"passive",{get:function(){rf=!0}}),window.addEventListener("test",To,To),window.removeEventListener("test",To,To)}catch{rf=!1}function rE(e,t,n,r,s,i,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(c){this.onError(c)}}var Wo=!1,ru=null,su=!1,sf=null,sE={onError:function(e){Wo=!0,ru=e}};function iE(e,t,n,r,s,i,o,a,l){Wo=!1,ru=null,rE.apply(sE,arguments)}function oE(e,t,n,r,s,i,o,a,l){if(iE.apply(this,arguments),Wo){if(Wo){var u=ru;Wo=!1,ru=null}else throw Error(H(198));su||(su=!0,sf=u)}}function li(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ww(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function eg(e){if(li(e)!==e)throw Error(H(188))}function aE(e){var t=e.alternate;if(!t){if(t=li(e),t===null)throw Error(H(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return eg(s),e;if(i===r)return eg(s),t;i=i.sibling}throw Error(H(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(H(189))}}if(n.alternate!==r)throw Error(H(190))}if(n.tag!==3)throw Error(H(188));return n.stateNode.current===n?e:t}function bw(e){return e=aE(e),e!==null?_w(e):null}function _w(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=_w(e);if(t!==null)return t;e=e.sibling}return null}var Sw=Cn.unstable_scheduleCallback,tg=Cn.unstable_cancelCallback,lE=Cn.unstable_shouldYield,uE=Cn.unstable_requestPaint,ut=Cn.unstable_now,cE=Cn.unstable_getCurrentPriorityLevel,Fh=Cn.unstable_ImmediatePriority,kw=Cn.unstable_UserBlockingPriority,iu=Cn.unstable_NormalPriority,dE=Cn.unstable_LowPriority,Cw=Cn.unstable_IdlePriority,tc=null,xr=null;function fE(e){if(xr&&typeof xr.onCommitFiberRoot=="function")try{xr.onCommitFiberRoot(tc,e,void 0,(e.current.flags&128)===128)}catch{}}var nr=Math.clz32?Math.clz32:mE,hE=Math.log,pE=Math.LN2;function mE(e){return e>>>=0,e===0?32:31-(hE(e)/pE|0)|0}var al=64,ll=4194304;function Bo(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ou(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Bo(a):(i&=o,i!==0&&(r=Bo(i)))}else o=n&~s,o!==0?r=Bo(o):i!==0&&(r=Bo(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-nr(t),s=1<<n,r|=e[n],t&=~s;return r}function gE(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function yE(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-nr(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=gE(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function of(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ew(){var e=al;return al<<=1,!(al&4194240)&&(al=64),e}function Uc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Wa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-nr(t),e[t]=n}function vE(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-nr(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Bh(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-nr(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Pe=0;function Tw(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Iw,$h,Rw,Pw,jw,af=!1,ul=[],us=null,cs=null,ds=null,pa=new Map,ma=new Map,ts=[],xE="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 submit".split(" ");function ng(e,t){switch(e){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":cs=null;break;case"mouseover":case"mouseout":ds=null;break;case"pointerover":case"pointerout":pa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ma.delete(t.pointerId)}}function Io(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Ka(t),t!==null&&$h(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function wE(e,t,n,r,s){switch(t){case"focusin":return us=Io(us,e,t,n,r,s),!0;case"dragenter":return cs=Io(cs,e,t,n,r,s),!0;case"mouseover":return ds=Io(ds,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return pa.set(i,Io(pa.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,ma.set(i,Io(ma.get(i)||null,e,t,n,r,s)),!0}return!1}function Aw(e){var t=$s(e.target);if(t!==null){var n=li(t);if(n!==null){if(t=n.tag,t===13){if(t=ww(n),t!==null){e.blockedOn=t,jw(e.priority,function(){Rw(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ol(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=lf(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tf=r,n.target.dispatchEvent(r),tf=null}else return t=Ka(n),t!==null&&$h(t),e.blockedOn=n,!1;t.shift()}return!0}function rg(e,t,n){Ol(e)&&n.delete(t)}function bE(){af=!1,us!==null&&Ol(us)&&(us=null),cs!==null&&Ol(cs)&&(cs=null),ds!==null&&Ol(ds)&&(ds=null),pa.forEach(rg),ma.forEach(rg)}function Ro(e,t){e.blockedOn===t&&(e.blockedOn=null,af||(af=!0,Cn.unstable_scheduleCallback(Cn.unstable_NormalPriority,bE)))}function ga(e){function t(s){return Ro(s,e)}if(0<ul.length){Ro(ul[0],e);for(var n=1;n<ul.length;n++){var r=ul[n];r.blockedOn===e&&(r.blockedOn=null)}}for(us!==null&&Ro(us,e),cs!==null&&Ro(cs,e),ds!==null&&Ro(ds,e),pa.forEach(t),ma.forEach(t),n=0;n<ts.length;n++)r=ts[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<ts.length&&(n=ts[0],n.blockedOn===null);)Aw(n),n.blockedOn===null&&ts.shift()}var $i=qr.ReactCurrentBatchConfig,au=!0;function _E(e,t,n,r){var s=Pe,i=$i.transition;$i.transition=null;try{Pe=1,Uh(e,t,n,r)}finally{Pe=s,$i.transition=i}}function SE(e,t,n,r){var s=Pe,i=$i.transition;$i.transition=null;try{Pe=4,Uh(e,t,n,r)}finally{Pe=s,$i.transition=i}}function Uh(e,t,n,r){if(au){var s=lf(e,t,n,r);if(s===null)Jc(e,t,r,lu,n),ng(e,r);else if(wE(s,e,t,n,r))r.stopPropagation();else if(ng(e,r),t&4&&-1<xE.indexOf(e)){for(;s!==null;){var i=Ka(s);if(i!==null&&Iw(i),i=lf(e,t,n,r),i===null&&Jc(e,t,r,lu,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Jc(e,t,r,null,n)}}var lu=null;function lf(e,t,n,r){if(lu=null,e=zh(r),e=$s(e),e!==null)if(t=li(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ww(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return lu=e,null}function Nw(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(cE()){case Fh:return 1;case kw:return 4;case iu:case dE:return 16;case Cw:return 536870912;default:return 16}default:return 16}}var ss=null,Vh=null,zl=null;function Mw(){if(zl)return zl;var e,t=Vh,n=t.length,r,s="value"in ss?ss.value:ss.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return zl=s.slice(e,1<r?1-r:void 0)}function Fl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function cl(){return!0}function sg(){return!1}function Pn(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?cl:sg,this.isPropagationStopped=sg,this}return tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=cl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=cl)},persist:function(){},isPersistent:cl}),t}var po={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hh=Pn(po),qa=tt({},po,{view:0,detail:0}),kE=Pn(qa),Vc,Hc,Po,nc=tt({},qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wh,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!==Po&&(Po&&e.type==="mousemove"?(Vc=e.screenX-Po.screenX,Hc=e.screenY-Po.screenY):Hc=Vc=0,Po=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:Hc}}),ig=Pn(nc),CE=tt({},nc,{dataTransfer:0}),EE=Pn(CE),TE=tt({},qa,{relatedTarget:0}),Wc=Pn(TE),IE=tt({},po,{animationName:0,elapsedTime:0,pseudoElement:0}),RE=Pn(IE),PE=tt({},po,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jE=Pn(PE),AE=tt({},po,{data:0}),og=Pn(AE),NE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ME={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"},DE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LE(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=DE[e])?!!t[e]:!1}function Wh(){return LE}var OE=tt({},qa,{key:function(e){if(e.key){var t=NE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ME[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wh,charCode:function(e){return e.type==="keypress"?Fl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zE=Pn(OE),FE=tt({},nc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ag=Pn(FE),BE=tt({},qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wh}),$E=Pn(BE),UE=tt({},po,{propertyName:0,elapsedTime:0,pseudoElement:0}),VE=Pn(UE),HE=tt({},nc,{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}),WE=Pn(HE),qE=[9,13,27,32],qh=Br&&"CompositionEvent"in window,qo=null;Br&&"documentMode"in document&&(qo=document.documentMode);var KE=Br&&"TextEvent"in window&&!qo,Dw=Br&&(!qh||qo&&8<qo&&11>=qo),lg=" ",ug=!1;function Lw(e,t){switch(e){case"keyup":return qE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ow(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ei=!1;function GE(e,t){switch(e){case"compositionend":return Ow(t);case"keypress":return t.which!==32?null:(ug=!0,lg);case"textInput":return e=t.data,e===lg&&ug?null:e;default:return null}}function YE(e,t){if(Ei)return e==="compositionend"||!qh&&Lw(e,t)?(e=Mw(),zl=Vh=ss=null,Ei=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Dw&&t.locale!=="ko"?null:t.data;default:return null}}var QE={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 cg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!QE[e.type]:t==="textarea"}function zw(e,t,n,r){mw(r),t=uu(t,"onChange"),0<t.length&&(n=new Hh("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ko=null,ya=null;function XE(e){Yw(e,0)}function rc(e){var t=Ri(e);if(lw(t))return e}function JE(e,t){if(e==="change")return t}var Fw=!1;if(Br){var qc;if(Br){var Kc="oninput"in document;if(!Kc){var dg=document.createElement("div");dg.setAttribute("oninput","return;"),Kc=typeof dg.oninput=="function"}qc=Kc}else qc=!1;Fw=qc&&(!document.documentMode||9<document.documentMode)}function fg(){Ko&&(Ko.detachEvent("onpropertychange",Bw),ya=Ko=null)}function Bw(e){if(e.propertyName==="value"&&rc(ya)){var t=[];zw(t,ya,e,zh(e)),xw(XE,t)}}function ZE(e,t,n){e==="focusin"?(fg(),Ko=t,ya=n,Ko.attachEvent("onpropertychange",Bw)):e==="focusout"&&fg()}function eT(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return rc(ya)}function tT(e,t){if(e==="click")return rc(t)}function nT(e,t){if(e==="input"||e==="change")return rc(t)}function rT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ir=typeof Object.is=="function"?Object.is:rT;function va(e,t){if(ir(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Vd.call(t,s)||!ir(e[s],t[s]))return!1}return!0}function hg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pg(e,t){var n=hg(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=hg(n)}}function $w(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$w(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Uw(){for(var e=window,t=nu();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=nu(e.document)}return t}function Kh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function sT(e){var t=Uw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&$w(n.ownerDocument.documentElement,n)){if(r!==null&&Kh(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=pg(n,i);var o=pg(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var iT=Br&&"documentMode"in document&&11>=document.documentMode,Ti=null,uf=null,Go=null,cf=!1;function mg(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cf||Ti==null||Ti!==nu(r)||(r=Ti,"selectionStart"in r&&Kh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Go&&va(Go,r)||(Go=r,r=uu(uf,"onSelect"),0<r.length&&(t=new Hh("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ti)))}function dl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ii={animationend:dl("Animation","AnimationEnd"),animationiteration:dl("Animation","AnimationIteration"),animationstart:dl("Animation","AnimationStart"),transitionend:dl("Transition","TransitionEnd")},Gc={},Vw={};Br&&(Vw=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 sc(e){if(Gc[e])return Gc[e];if(!Ii[e])return e;var t=Ii[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vw)return Gc[e]=t[n];return e}var Hw=sc("animationend"),Ww=sc("animationiteration"),qw=sc("animationstart"),Kw=sc("transitionend"),Gw=new Map,gg="abort auxClick 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(" ");function Ts(e,t){Gw.set(e,t),ai(t,[e])}for(var Yc=0;Yc<gg.length;Yc++){var Qc=gg[Yc],oT=Qc.toLowerCase(),aT=Qc[0].toUpperCase()+Qc.slice(1);Ts(oT,"on"+aT)}Ts(Hw,"onAnimationEnd");Ts(Ww,"onAnimationIteration");Ts(qw,"onAnimationStart");Ts("dblclick","onDoubleClick");Ts("focusin","onFocus");Ts("focusout","onBlur");Ts(Kw,"onTransitionEnd");Yi("onMouseEnter",["mouseout","mouseover"]);Yi("onMouseLeave",["mouseout","mouseover"]);Yi("onPointerEnter",["pointerout","pointerover"]);Yi("onPointerLeave",["pointerout","pointerover"]);ai("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ai("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ai("onBeforeInput",["compositionend","keypress","textInput","paste"]);ai("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ai("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ai("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $o="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(" "),lT=new Set("cancel close invalid load scroll toggle".split(" ").concat($o));function yg(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,oE(r,t,void 0,e),e.currentTarget=null}function Yw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;yg(s,a,u),i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;yg(s,a,u),i=l}}}if(su)throw e=sf,su=!1,sf=null,e}function Ue(e,t){var n=t[mf];n===void 0&&(n=t[mf]=new Set);var r=e+"__bubble";n.has(r)||(Qw(t,e,2,!1),n.add(r))}function Xc(e,t,n){var r=0;t&&(r|=4),Qw(n,e,r,t)}var fl="_reactListening"+Math.random().toString(36).slice(2);function xa(e){if(!e[fl]){e[fl]=!0,rw.forEach(function(n){n!=="selectionchange"&&(lT.has(n)||Xc(n,!1,e),Xc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[fl]||(t[fl]=!0,Xc("selectionchange",!1,t))}}function Qw(e,t,n,r){switch(Nw(t)){case 1:var s=_E;break;case 4:s=SE;break;default:s=Uh}n=s.bind(null,t,n,e),s=void 0,!rf||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Jc(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;o=o.return}for(;a!==null;){if(o=$s(a),o===null)return;if(l=o.tag,l===5||l===6){r=i=o;continue e}a=a.parentNode}}r=r.return}xw(function(){var u=i,c=zh(n),f=[];e:{var h=Gw.get(e);if(h!==void 0){var p=Hh,g=e;switch(e){case"keypress":if(Fl(n)===0)break e;case"keydown":case"keyup":p=zE;break;case"focusin":g="focus",p=Wc;break;case"focusout":g="blur",p=Wc;break;case"beforeblur":case"afterblur":p=Wc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=ig;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=EE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=$E;break;case Hw:case Ww:case qw:p=RE;break;case Kw:p=VE;break;case"scroll":p=kE;break;case"wheel":p=WE;break;case"copy":case"cut":case"paste":p=jE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=ag}var y=(t&4)!==0,b=!y&&e==="scroll",x=y?h!==null?h+"Capture":null:h;y=[];for(var v=u,w;v!==null;){w=v;var k=w.stateNode;if(w.tag===5&&k!==null&&(w=k,x!==null&&(k=ha(v,x),k!=null&&y.push(wa(v,k,w)))),b)break;v=v.return}0<y.length&&(h=new p(h,g,null,n,c),f.push({event:h,listeners:y}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==tf&&(g=n.relatedTarget||n.fromElement)&&($s(g)||g[$r]))break e;if((p||h)&&(h=c.window===c?c:(h=c.ownerDocument)?h.defaultView||h.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?$s(g):null,g!==null&&(b=li(g),g!==b||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(y=ig,k="onMouseLeave",x="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(y=ag,k="onPointerLeave",x="onPointerEnter",v="pointer"),b=p==null?h:Ri(p),w=g==null?h:Ri(g),h=new y(k,v+"leave",p,n,c),h.target=b,h.relatedTarget=w,k=null,$s(c)===u&&(y=new y(x,v+"enter",g,n,c),y.target=w,y.relatedTarget=b,k=y),b=k,p&&g)t:{for(y=p,x=g,v=0,w=y;w;w=wi(w))v++;for(w=0,k=x;k;k=wi(k))w++;for(;0<v-w;)y=wi(y),v--;for(;0<w-v;)x=wi(x),w--;for(;v--;){if(y===x||x!==null&&y===x.alternate)break t;y=wi(y),x=wi(x)}y=null}else y=null;p!==null&&vg(f,h,p,y,!1),g!==null&&b!==null&&vg(f,b,g,y,!0)}}e:{if(h=u?Ri(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var _=JE;else if(cg(h))if(Fw)_=nT;else{_=eT;var S=ZE}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(_=tT);if(_&&(_=_(e,u))){zw(f,_,n,c);break e}S&&S(e,h,u),e==="focusout"&&(S=h._wrapperState)&&S.controlled&&h.type==="number"&&Qd(h,"number",h.value)}switch(S=u?Ri(u):window,e){case"focusin":(cg(S)||S.contentEditable==="true")&&(Ti=S,uf=u,Go=null);break;case"focusout":Go=uf=Ti=null;break;case"mousedown":cf=!0;break;case"contextmenu":case"mouseup":case"dragend":cf=!1,mg(f,n,c);break;case"selectionchange":if(iT)break;case"keydown":case"keyup":mg(f,n,c)}var T;if(qh)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Ei?Lw(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(Dw&&n.locale!=="ko"&&(Ei||P!=="onCompositionStart"?P==="onCompositionEnd"&&Ei&&(T=Mw()):(ss=c,Vh="value"in ss?ss.value:ss.textContent,Ei=!0)),S=uu(u,P),0<S.length&&(P=new og(P,e,null,n,c),f.push({event:P,listeners:S}),T?P.data=T:(T=Ow(n),T!==null&&(P.data=T)))),(T=KE?GE(e,n):YE(e,n))&&(u=uu(u,"onBeforeInput"),0<u.length&&(c=new og("onBeforeInput","beforeinput",null,n,c),f.push({event:c,listeners:u}),c.data=T))}Yw(f,t)})}function wa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function uu(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=ha(e,n),i!=null&&r.unshift(wa(e,i,s)),i=ha(e,t),i!=null&&r.push(wa(e,i,s))),e=e.return}return r}function wi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function vg(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,s?(l=ha(n,i),l!=null&&o.unshift(wa(n,l,a))):s||(l=ha(n,i),l!=null&&o.push(wa(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var uT=/\r\n?/g,cT=/\u0000|\uFFFD/g;function xg(e){return(typeof e=="string"?e:""+e).replace(uT,`
|
|
38
|
+
`).replace(cT,"")}function hl(e,t,n){if(t=xg(t),xg(e)!==t&&n)throw Error(H(425))}function cu(){}var df=null,ff=null;function hf(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var pf=typeof setTimeout=="function"?setTimeout:void 0,dT=typeof clearTimeout=="function"?clearTimeout:void 0,wg=typeof Promise=="function"?Promise:void 0,fT=typeof queueMicrotask=="function"?queueMicrotask:typeof wg<"u"?function(e){return wg.resolve(null).then(e).catch(hT)}:pf;function hT(e){setTimeout(function(){throw e})}function Zc(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),ga(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ga(t)}function fs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function bg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var mo=Math.random().toString(36).slice(2),mr="__reactFiber$"+mo,ba="__reactProps$"+mo,$r="__reactContainer$"+mo,mf="__reactEvents$"+mo,pT="__reactListeners$"+mo,mT="__reactHandles$"+mo;function $s(e){var t=e[mr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[$r]||n[mr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bg(e);e!==null;){if(n=e[mr])return n;e=bg(e)}return t}e=n,n=e.parentNode}return null}function Ka(e){return e=e[mr]||e[$r],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ri(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(H(33))}function ic(e){return e[ba]||null}var gf=[],Pi=-1;function Is(e){return{current:e}}function Ve(e){0>Pi||(e.current=gf[Pi],gf[Pi]=null,Pi--)}function ze(e,t){Pi++,gf[Pi]=e.current,e.current=t}var bs={},Dt=Is(bs),tn=Is(!1),Zs=bs;function Qi(e,t){var n=e.type.contextTypes;if(!n)return bs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function nn(e){return e=e.childContextTypes,e!=null}function du(){Ve(tn),Ve(Dt)}function _g(e,t,n){if(Dt.current!==bs)throw Error(H(168));ze(Dt,t),ze(tn,n)}function Xw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(H(108,ZC(e)||"Unknown",s));return tt({},n,r)}function fu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||bs,Zs=Dt.current,ze(Dt,e),ze(tn,tn.current),!0}function Sg(e,t,n){var r=e.stateNode;if(!r)throw Error(H(169));n?(e=Xw(e,t,Zs),r.__reactInternalMemoizedMergedChildContext=e,Ve(tn),Ve(Dt),ze(Dt,e)):Ve(tn),ze(tn,n)}var Nr=null,oc=!1,ed=!1;function Jw(e){Nr===null?Nr=[e]:Nr.push(e)}function gT(e){oc=!0,Jw(e)}function Rs(){if(!ed&&Nr!==null){ed=!0;var e=0,t=Pe;try{var n=Nr;for(Pe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Nr=null,oc=!1}catch(s){throw Nr!==null&&(Nr=Nr.slice(e+1)),Sw(Fh,Rs),s}finally{Pe=t,ed=!1}}return null}var ji=[],Ai=0,hu=null,pu=0,Dn=[],Ln=0,ei=null,Lr=1,Or="";function Os(e,t){ji[Ai++]=pu,ji[Ai++]=hu,hu=e,pu=t}function Zw(e,t,n){Dn[Ln++]=Lr,Dn[Ln++]=Or,Dn[Ln++]=ei,ei=e;var r=Lr;e=Or;var s=32-nr(r)-1;r&=~(1<<s),n+=1;var i=32-nr(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Lr=1<<32-nr(t)+s|n<<s|r,Or=i+e}else Lr=1<<i|n<<s|r,Or=e}function Gh(e){e.return!==null&&(Os(e,1),Zw(e,1,0))}function Yh(e){for(;e===hu;)hu=ji[--Ai],ji[Ai]=null,pu=ji[--Ai],ji[Ai]=null;for(;e===ei;)ei=Dn[--Ln],Dn[Ln]=null,Or=Dn[--Ln],Dn[Ln]=null,Lr=Dn[--Ln],Dn[Ln]=null}var _n=null,xn=null,We=!1,er=null;function eb(e,t){var n=zn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function kg(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,_n=e,xn=fs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,_n=e,xn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ei!==null?{id:Lr,overflow:Or}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=zn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,_n=e,xn=null,!0):!1;default:return!1}}function yf(e){return(e.mode&1)!==0&&(e.flags&128)===0}function vf(e){if(We){var t=xn;if(t){var n=t;if(!kg(e,t)){if(yf(e))throw Error(H(418));t=fs(n.nextSibling);var r=_n;t&&kg(e,t)?eb(r,n):(e.flags=e.flags&-4097|2,We=!1,_n=e)}}else{if(yf(e))throw Error(H(418));e.flags=e.flags&-4097|2,We=!1,_n=e}}}function Cg(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;_n=e}function pl(e){if(e!==_n)return!1;if(!We)return Cg(e),We=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!hf(e.type,e.memoizedProps)),t&&(t=xn)){if(yf(e))throw tb(),Error(H(418));for(;t;)eb(e,t),t=fs(t.nextSibling)}if(Cg(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(H(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){xn=fs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}xn=null}}else xn=_n?fs(e.stateNode.nextSibling):null;return!0}function tb(){for(var e=xn;e;)e=fs(e.nextSibling)}function Xi(){xn=_n=null,We=!1}function Qh(e){er===null?er=[e]:er.push(e)}var yT=qr.ReactCurrentBatchConfig;function jo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(H(309));var r=n.stateNode}if(!r)throw Error(H(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(H(284));if(!n._owner)throw Error(H(290,e))}return e}function ml(e,t){throw e=Object.prototype.toString.call(t),Error(H(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Eg(e){var t=e._init;return t(e._payload)}function nb(e){function t(x,v){if(e){var w=x.deletions;w===null?(x.deletions=[v],x.flags|=16):w.push(v)}}function n(x,v){if(!e)return null;for(;v!==null;)t(x,v),v=v.sibling;return null}function r(x,v){for(x=new Map;v!==null;)v.key!==null?x.set(v.key,v):x.set(v.index,v),v=v.sibling;return x}function s(x,v){return x=gs(x,v),x.index=0,x.sibling=null,x}function i(x,v,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<v?(x.flags|=2,v):w):(x.flags|=2,v)):(x.flags|=1048576,v)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function a(x,v,w,k){return v===null||v.tag!==6?(v=ad(w,x.mode,k),v.return=x,v):(v=s(v,w),v.return=x,v)}function l(x,v,w,k){var _=w.type;return _===Ci?c(x,v,w.props.children,k,w.key):v!==null&&(v.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Jr&&Eg(_)===v.type)?(k=s(v,w.props),k.ref=jo(x,v,w),k.return=x,k):(k=ql(w.type,w.key,w.props,null,x.mode,k),k.ref=jo(x,v,w),k.return=x,k)}function u(x,v,w,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=ld(w,x.mode,k),v.return=x,v):(v=s(v,w.children||[]),v.return=x,v)}function c(x,v,w,k,_){return v===null||v.tag!==7?(v=qs(w,x.mode,k,_),v.return=x,v):(v=s(v,w),v.return=x,v)}function f(x,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=ad(""+v,x.mode,w),v.return=x,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case sl:return w=ql(v.type,v.key,v.props,null,x.mode,w),w.ref=jo(x,null,v),w.return=x,w;case ki:return v=ld(v,x.mode,w),v.return=x,v;case Jr:var k=v._init;return f(x,k(v._payload),w)}if(Fo(v)||Eo(v))return v=qs(v,x.mode,w,null),v.return=x,v;ml(x,v)}return null}function h(x,v,w,k){var _=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return _!==null?null:a(x,v,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case sl:return w.key===_?l(x,v,w,k):null;case ki:return w.key===_?u(x,v,w,k):null;case Jr:return _=w._init,h(x,v,_(w._payload),k)}if(Fo(w)||Eo(w))return _!==null?null:c(x,v,w,k,null);ml(x,w)}return null}function p(x,v,w,k,_){if(typeof k=="string"&&k!==""||typeof k=="number")return x=x.get(w)||null,a(v,x,""+k,_);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case sl:return x=x.get(k.key===null?w:k.key)||null,l(v,x,k,_);case ki:return x=x.get(k.key===null?w:k.key)||null,u(v,x,k,_);case Jr:var S=k._init;return p(x,v,w,S(k._payload),_)}if(Fo(k)||Eo(k))return x=x.get(w)||null,c(v,x,k,_,null);ml(v,k)}return null}function g(x,v,w,k){for(var _=null,S=null,T=v,P=v=0,R=null;T!==null&&P<w.length;P++){T.index>P?(R=T,T=null):R=T.sibling;var C=h(x,T,w[P],k);if(C===null){T===null&&(T=R);break}e&&T&&C.alternate===null&&t(x,T),v=i(C,v,P),S===null?_=C:S.sibling=C,S=C,T=R}if(P===w.length)return n(x,T),We&&Os(x,P),_;if(T===null){for(;P<w.length;P++)T=f(x,w[P],k),T!==null&&(v=i(T,v,P),S===null?_=T:S.sibling=T,S=T);return We&&Os(x,P),_}for(T=r(x,T);P<w.length;P++)R=p(T,x,P,w[P],k),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?P:R.key),v=i(R,v,P),S===null?_=R:S.sibling=R,S=R);return e&&T.forEach(function(M){return t(x,M)}),We&&Os(x,P),_}function y(x,v,w,k){var _=Eo(w);if(typeof _!="function")throw Error(H(150));if(w=_.call(w),w==null)throw Error(H(151));for(var S=_=null,T=v,P=v=0,R=null,C=w.next();T!==null&&!C.done;P++,C=w.next()){T.index>P?(R=T,T=null):R=T.sibling;var M=h(x,T,C.value,k);if(M===null){T===null&&(T=R);break}e&&T&&M.alternate===null&&t(x,T),v=i(M,v,P),S===null?_=M:S.sibling=M,S=M,T=R}if(C.done)return n(x,T),We&&Os(x,P),_;if(T===null){for(;!C.done;P++,C=w.next())C=f(x,C.value,k),C!==null&&(v=i(C,v,P),S===null?_=C:S.sibling=C,S=C);return We&&Os(x,P),_}for(T=r(x,T);!C.done;P++,C=w.next())C=p(T,x,P,C.value,k),C!==null&&(e&&C.alternate!==null&&T.delete(C.key===null?P:C.key),v=i(C,v,P),S===null?_=C:S.sibling=C,S=C);return e&&T.forEach(function(D){return t(x,D)}),We&&Os(x,P),_}function b(x,v,w,k){if(typeof w=="object"&&w!==null&&w.type===Ci&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case sl:e:{for(var _=w.key,S=v;S!==null;){if(S.key===_){if(_=w.type,_===Ci){if(S.tag===7){n(x,S.sibling),v=s(S,w.props.children),v.return=x,x=v;break e}}else if(S.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Jr&&Eg(_)===S.type){n(x,S.sibling),v=s(S,w.props),v.ref=jo(x,S,w),v.return=x,x=v;break e}n(x,S);break}else t(x,S);S=S.sibling}w.type===Ci?(v=qs(w.props.children,x.mode,k,w.key),v.return=x,x=v):(k=ql(w.type,w.key,w.props,null,x.mode,k),k.ref=jo(x,v,w),k.return=x,x=k)}return o(x);case ki:e:{for(S=w.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(x,v.sibling),v=s(v,w.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=ld(w,x.mode,k),v.return=x,x=v}return o(x);case Jr:return S=w._init,b(x,v,S(w._payload),k)}if(Fo(w))return g(x,v,w,k);if(Eo(w))return y(x,v,w,k);ml(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(x,v.sibling),v=s(v,w),v.return=x,x=v):(n(x,v),v=ad(w,x.mode,k),v.return=x,x=v),o(x)):n(x,v)}return b}var Ji=nb(!0),rb=nb(!1),mu=Is(null),gu=null,Ni=null,Xh=null;function Jh(){Xh=Ni=gu=null}function Zh(e){var t=mu.current;Ve(mu),e._currentValue=t}function xf(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ui(e,t){gu=e,Xh=Ni=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(en=!0),e.firstContext=null)}function Vn(e){var t=e._currentValue;if(Xh!==e)if(e={context:e,memoizedValue:t,next:null},Ni===null){if(gu===null)throw Error(H(308));Ni=e,gu.dependencies={lanes:0,firstContext:e}}else Ni=Ni.next=e;return t}var Us=null;function ep(e){Us===null?Us=[e]:Us.push(e)}function sb(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,ep(t)):(n.next=s.next,s.next=n),t.interleaved=n,Ur(e,r)}function Ur(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Zr=!1;function tp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ib(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Fr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hs(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ie&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ur(e,n)}return s=r.interleaved,s===null?(t.next=t,ep(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ur(e,n)}function Bl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bh(e,n)}}function Tg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yu(e,t,n,r){var s=e.updateQueue;Zr=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(i!==null){var f=s.baseState;o=0,c=u=l=null,a=i;do{var h=a.lane,p=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,y=a;switch(h=t,p=n,y.tag){case 1:if(g=y.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=tt({},f,h);break e;case 2:Zr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=p,l=f):c=c.next=p,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(c===null&&(l=f),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=c,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);ni|=o,e.lanes=o,e.memoizedState=f}}function Ig(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(H(191,s));s.call(r)}}}var Ga={},wr=Is(Ga),_a=Is(Ga),Sa=Is(Ga);function Vs(e){if(e===Ga)throw Error(H(174));return e}function np(e,t){switch(ze(Sa,t),ze(_a,e),ze(wr,Ga),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Jd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Jd(t,e)}Ve(wr),ze(wr,t)}function Zi(){Ve(wr),Ve(_a),Ve(Sa)}function ob(e){Vs(Sa.current);var t=Vs(wr.current),n=Jd(t,e.type);t!==n&&(ze(_a,e),ze(wr,n))}function rp(e){_a.current===e&&(Ve(wr),Ve(_a))}var Qe=Is(0);function vu(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var td=[];function sp(){for(var e=0;e<td.length;e++)td[e]._workInProgressVersionPrimary=null;td.length=0}var $l=qr.ReactCurrentDispatcher,nd=qr.ReactCurrentBatchConfig,ti=0,et=null,pt=null,yt=null,xu=!1,Yo=!1,ka=0,vT=0;function It(){throw Error(H(321))}function ip(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ir(e[n],t[n]))return!1;return!0}function op(e,t,n,r,s,i){if(ti=i,et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$l.current=e===null||e.memoizedState===null?_T:ST,e=n(r,s),Yo){i=0;do{if(Yo=!1,ka=0,25<=i)throw Error(H(301));i+=1,yt=pt=null,t.updateQueue=null,$l.current=kT,e=n(r,s)}while(Yo)}if($l.current=wu,t=pt!==null&&pt.next!==null,ti=0,yt=pt=et=null,xu=!1,t)throw Error(H(300));return e}function ap(){var e=ka!==0;return ka=0,e}function fr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?et.memoizedState=yt=e:yt=yt.next=e,yt}function Hn(){if(pt===null){var e=et.alternate;e=e!==null?e.memoizedState:null}else e=pt.next;var t=yt===null?et.memoizedState:yt.next;if(t!==null)yt=t,pt=e;else{if(e===null)throw Error(H(310));pt=e,e={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},yt===null?et.memoizedState=yt=e:yt=yt.next=e}return yt}function Ca(e,t){return typeof t=="function"?t(e):t}function rd(e){var t=Hn(),n=t.queue;if(n===null)throw Error(H(311));n.lastRenderedReducer=e;var r=pt,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,l=null,u=i;do{var c=u.lane;if((ti&c)===c)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=f,o=r):l=l.next=f,et.lanes|=c,ni|=c}u=u.next}while(u!==null&&u!==i);l===null?o=r:l.next=a,ir(r,t.memoizedState)||(en=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,et.lanes|=i,ni|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function sd(e){var t=Hn(),n=t.queue;if(n===null)throw Error(H(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);ir(i,t.memoizedState)||(en=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function ab(){}function lb(e,t){var n=et,r=Hn(),s=t(),i=!ir(r.memoizedState,s);if(i&&(r.memoizedState=s,en=!0),r=r.queue,lp(db.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||yt!==null&&yt.memoizedState.tag&1){if(n.flags|=2048,Ea(9,cb.bind(null,n,r,s,t),void 0,null),vt===null)throw Error(H(349));ti&30||ub(n,t,s)}return s}function ub(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function cb(e,t,n,r){t.value=n,t.getSnapshot=r,fb(t)&&hb(e)}function db(e,t,n){return n(function(){fb(t)&&hb(e)})}function fb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ir(e,n)}catch{return!0}}function hb(e){var t=Ur(e,1);t!==null&&rr(t,e,1,-1)}function Rg(e){var t=fr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ca,lastRenderedState:e},t.queue=e,e=e.dispatch=bT.bind(null,et,e),[t.memoizedState,e]}function Ea(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function pb(){return Hn().memoizedState}function Ul(e,t,n,r){var s=fr();et.flags|=e,s.memoizedState=Ea(1|t,n,void 0,r===void 0?null:r)}function ac(e,t,n,r){var s=Hn();r=r===void 0?null:r;var i=void 0;if(pt!==null){var o=pt.memoizedState;if(i=o.destroy,r!==null&&ip(r,o.deps)){s.memoizedState=Ea(t,n,i,r);return}}et.flags|=e,s.memoizedState=Ea(1|t,n,i,r)}function Pg(e,t){return Ul(8390656,8,e,t)}function lp(e,t){return ac(2048,8,e,t)}function mb(e,t){return ac(4,2,e,t)}function gb(e,t){return ac(4,4,e,t)}function yb(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function vb(e,t,n){return n=n!=null?n.concat([e]):null,ac(4,4,yb.bind(null,t,e),n)}function up(){}function xb(e,t){var n=Hn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ip(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function wb(e,t){var n=Hn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ip(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function bb(e,t,n){return ti&21?(ir(n,t)||(n=Ew(),et.lanes|=n,ni|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,en=!0),e.memoizedState=n)}function xT(e,t){var n=Pe;Pe=n!==0&&4>n?n:4,e(!0);var r=nd.transition;nd.transition={};try{e(!1),t()}finally{Pe=n,nd.transition=r}}function _b(){return Hn().memoizedState}function wT(e,t,n){var r=ms(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Sb(e))kb(t,n);else if(n=sb(e,t,n,r),n!==null){var s=Vt();rr(n,e,r,s),Cb(n,t,r)}}function bT(e,t,n){var r=ms(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Sb(e))kb(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,ir(a,o)){var l=t.interleaved;l===null?(s.next=s,ep(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=sb(e,t,s,r),n!==null&&(s=Vt(),rr(n,e,r,s),Cb(n,t,r))}}function Sb(e){var t=e.alternate;return e===et||t!==null&&t===et}function kb(e,t){Yo=xu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Cb(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bh(e,n)}}var wu={readContext:Vn,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},_T={readContext:Vn,useCallback:function(e,t){return fr().memoizedState=[e,t===void 0?null:t],e},useContext:Vn,useEffect:Pg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ul(4194308,4,yb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ul(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ul(4,2,e,t)},useMemo:function(e,t){var n=fr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=fr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=wT.bind(null,et,e),[r.memoizedState,e]},useRef:function(e){var t=fr();return e={current:e},t.memoizedState=e},useState:Rg,useDebugValue:up,useDeferredValue:function(e){return fr().memoizedState=e},useTransition:function(){var e=Rg(!1),t=e[0];return e=xT.bind(null,e[1]),fr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=et,s=fr();if(We){if(n===void 0)throw Error(H(407));n=n()}else{if(n=t(),vt===null)throw Error(H(349));ti&30||ub(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Pg(db.bind(null,r,i,e),[e]),r.flags|=2048,Ea(9,cb.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=fr(),t=vt.identifierPrefix;if(We){var n=Or,r=Lr;n=(r&~(1<<32-nr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ka++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=vT++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ST={readContext:Vn,useCallback:xb,useContext:Vn,useEffect:lp,useImperativeHandle:vb,useInsertionEffect:mb,useLayoutEffect:gb,useMemo:wb,useReducer:rd,useRef:pb,useState:function(){return rd(Ca)},useDebugValue:up,useDeferredValue:function(e){var t=Hn();return bb(t,pt.memoizedState,e)},useTransition:function(){var e=rd(Ca)[0],t=Hn().memoizedState;return[e,t]},useMutableSource:ab,useSyncExternalStore:lb,useId:_b,unstable_isNewReconciler:!1},kT={readContext:Vn,useCallback:xb,useContext:Vn,useEffect:lp,useImperativeHandle:vb,useInsertionEffect:mb,useLayoutEffect:gb,useMemo:wb,useReducer:sd,useRef:pb,useState:function(){return sd(Ca)},useDebugValue:up,useDeferredValue:function(e){var t=Hn();return pt===null?t.memoizedState=e:bb(t,pt.memoizedState,e)},useTransition:function(){var e=sd(Ca)[0],t=Hn().memoizedState;return[e,t]},useMutableSource:ab,useSyncExternalStore:lb,useId:_b,unstable_isNewReconciler:!1};function Jn(e,t){if(e&&e.defaultProps){t=tt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function wf(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:tt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var lc={isMounted:function(e){return(e=e._reactInternals)?li(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Vt(),s=ms(e),i=Fr(r,s);i.payload=t,n!=null&&(i.callback=n),t=hs(e,i,s),t!==null&&(rr(t,e,s,r),Bl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Vt(),s=ms(e),i=Fr(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=hs(e,i,s),t!==null&&(rr(t,e,s,r),Bl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Vt(),r=ms(e),s=Fr(n,r);s.tag=2,t!=null&&(s.callback=t),t=hs(e,s,r),t!==null&&(rr(t,e,r,n),Bl(t,e,r))}};function jg(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!va(n,r)||!va(s,i):!0}function Eb(e,t,n){var r=!1,s=bs,i=t.contextType;return typeof i=="object"&&i!==null?i=Vn(i):(s=nn(t)?Zs:Dt.current,r=t.contextTypes,i=(r=r!=null)?Qi(e,s):bs),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=lc,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Ag(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&lc.enqueueReplaceState(t,t.state,null)}function bf(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},tp(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Vn(i):(i=nn(t)?Zs:Dt.current,s.context=Qi(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(wf(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&lc.enqueueReplaceState(s,s.state,null),yu(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function eo(e,t){try{var n="",r=t;do n+=JC(r),r=r.return;while(r);var s=n}catch(i){s=`
|
|
39
|
+
Error generating stack: `+i.message+`
|
|
40
|
+
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function id(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function _f(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var CT=typeof WeakMap=="function"?WeakMap:Map;function Tb(e,t,n){n=Fr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){_u||(_u=!0,Af=r),_f(e,t)},n}function Ib(e,t,n){n=Fr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){_f(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){_f(e,t),typeof r!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Ng(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new CT;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=FT.bind(null,e,t,n),t.then(e,e))}function Mg(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Dg(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Fr(-1,1),t.tag=2,hs(n,t,1))),n.lanes|=1),e)}var ET=qr.ReactCurrentOwner,en=!1;function $t(e,t,n,r){t.child=e===null?rb(t,null,n,r):Ji(t,e.child,n,r)}function Lg(e,t,n,r,s){n=n.render;var i=t.ref;return Ui(t,s),r=op(e,t,n,r,i,s),n=ap(),e!==null&&!en?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vr(e,t,s)):(We&&n&&Gh(t),t.flags|=1,$t(e,t,r,s),t.child)}function Og(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!yp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Rb(e,t,i,r,s)):(e=ql(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:va,n(o,r)&&e.ref===t.ref)return Vr(e,t,s)}return t.flags|=1,e=gs(i,r),e.ref=t.ref,e.return=t,t.child=e}function Rb(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(va(i,r)&&e.ref===t.ref)if(en=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(en=!0);else return t.lanes=e.lanes,Vr(e,t,s)}return Sf(e,t,n,r,s)}function Pb(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(Di,gn),gn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ze(Di,gn),gn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ze(Di,gn),gn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ze(Di,gn),gn|=r;return $t(e,t,s,n),t.child}function jb(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Sf(e,t,n,r,s){var i=nn(n)?Zs:Dt.current;return i=Qi(t,i),Ui(t,s),n=op(e,t,n,r,i,s),r=ap(),e!==null&&!en?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vr(e,t,s)):(We&&r&&Gh(t),t.flags|=1,$t(e,t,n,s),t.child)}function zg(e,t,n,r,s){if(nn(n)){var i=!0;fu(t)}else i=!1;if(Ui(t,s),t.stateNode===null)Vl(e,t),Eb(t,n,r),bf(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Vn(u):(u=nn(n)?Zs:Dt.current,u=Qi(t,u));var c=n.getDerivedStateFromProps,f=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Ag(t,o,r,u),Zr=!1;var h=t.memoizedState;o.state=h,yu(t,r,o,s),l=t.memoizedState,a!==r||h!==l||tn.current||Zr?(typeof c=="function"&&(wf(t,n,c,r),l=t.memoizedState),(a=Zr||jg(t,n,a,r,h,l,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,ib(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Jn(t.type,a),o.props=u,f=t.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Vn(l):(l=nn(n)?Zs:Dt.current,l=Qi(t,l));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||h!==l)&&Ag(t,o,r,l),Zr=!1,h=t.memoizedState,o.state=h,yu(t,r,o,s);var g=t.memoizedState;a!==f||h!==g||tn.current||Zr?(typeof p=="function"&&(wf(t,n,p,r),g=t.memoizedState),(u=Zr||jg(t,n,u,r,h,g,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return kf(e,t,n,r,i,s)}function kf(e,t,n,r,s,i){jb(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Sg(t,n,!1),Vr(e,t,i);r=t.stateNode,ET.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ji(t,e.child,null,i),t.child=Ji(t,null,a,i)):$t(e,t,a,i),t.memoizedState=r.state,s&&Sg(t,n,!0),t.child}function Ab(e){var t=e.stateNode;t.pendingContext?_g(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_g(e,t.context,!1),np(e,t.containerInfo)}function Fg(e,t,n,r,s){return Xi(),Qh(s),t.flags|=256,$t(e,t,n,r),t.child}var Cf={dehydrated:null,treeContext:null,retryLane:0};function Ef(e){return{baseLanes:e,cachePool:null,transitions:null}}function Nb(e,t,n){var r=t.pendingProps,s=Qe.current,i=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),ze(Qe,s&1),e===null)return vf(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=dc(o,r,0,null),e=qs(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ef(n),t.memoizedState=Cf,e):cp(t,o));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return TT(e,t,o,r,a,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,a=s.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=gs(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=gs(a,i):(i=qs(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?Ef(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Cf,r}return i=e.child,e=i.sibling,r=gs(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function cp(e,t){return t=dc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function gl(e,t,n,r){return r!==null&&Qh(r),Ji(t,e.child,null,n),e=cp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function TT(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=id(Error(H(422))),gl(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=dc({mode:"visible",children:r.children},s,0,null),i=qs(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ji(t,e.child,null,o),t.child.memoizedState=Ef(o),t.memoizedState=Cf,i);if(!(t.mode&1))return gl(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(H(419)),r=id(i,r,void 0),gl(e,t,o,r)}if(a=(o&e.childLanes)!==0,en||a){if(r=vt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Ur(e,s),rr(r,e,s,-1))}return gp(),r=id(Error(H(421))),gl(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=BT.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,xn=fs(s.nextSibling),_n=t,We=!0,er=null,e!==null&&(Dn[Ln++]=Lr,Dn[Ln++]=Or,Dn[Ln++]=ei,Lr=e.id,Or=e.overflow,ei=t),t=cp(t,r.children),t.flags|=4096,t)}function Bg(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xf(e.return,t,n)}function od(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function Mb(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if($t(e,t,r.children,n),r=Qe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Bg(e,n,t);else if(e.tag===19)Bg(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ze(Qe,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&vu(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),od(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&vu(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}od(t,!0,n,null,i);break;case"together":od(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Vl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Vr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ni|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(H(153));if(t.child!==null){for(e=t.child,n=gs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=gs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function IT(e,t,n){switch(t.tag){case 3:Ab(t),Xi();break;case 5:ob(t);break;case 1:nn(t.type)&&fu(t);break;case 4:np(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;ze(mu,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ze(Qe,Qe.current&1),t.flags|=128,null):n&t.child.childLanes?Nb(e,t,n):(ze(Qe,Qe.current&1),e=Vr(e,t,n),e!==null?e.sibling:null);ze(Qe,Qe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Mb(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ze(Qe,Qe.current),r)break;return null;case 22:case 23:return t.lanes=0,Pb(e,t,n)}return Vr(e,t,n)}var Db,Tf,Lb,Ob;Db=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Tf=function(){};Lb=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Vs(wr.current);var i=null;switch(n){case"input":s=Gd(e,s),r=Gd(e,r),i=[];break;case"select":s=tt({},s,{value:void 0}),r=tt({},r,{value:void 0}),i=[];break;case"textarea":s=Xd(e,s),r=Xd(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=cu)}Zd(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(da.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=s?.[u],r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(da.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Ue("scroll",e),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Ob=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ao(e,t){if(!We)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function RT(e,t,n){var r=t.pendingProps;switch(Yh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(t),null;case 1:return nn(t.type)&&du(),Rt(t),null;case 3:return r=t.stateNode,Zi(),Ve(tn),Ve(Dt),sp(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(pl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,er!==null&&(Df(er),er=null))),Tf(e,t),Rt(t),null;case 5:rp(t);var s=Vs(Sa.current);if(n=t.type,e!==null&&t.stateNode!=null)Lb(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(H(166));return Rt(t),null}if(e=Vs(wr.current),pl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[mr]=t,r[ba]=i,e=(t.mode&1)!==0,n){case"dialog":Ue("cancel",r),Ue("close",r);break;case"iframe":case"object":case"embed":Ue("load",r);break;case"video":case"audio":for(s=0;s<$o.length;s++)Ue($o[s],r);break;case"source":Ue("error",r);break;case"img":case"image":case"link":Ue("error",r),Ue("load",r);break;case"details":Ue("toggle",r);break;case"input":Ym(r,i),Ue("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ue("invalid",r);break;case"textarea":Xm(r,i),Ue("invalid",r)}Zd(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&hl(r.textContent,a,e),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&hl(r.textContent,a,e),s=["children",""+a]):da.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Ue("scroll",r)}switch(n){case"input":il(r),Qm(r,i,!0);break;case"textarea":il(r),Jm(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=cu)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=dw(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[mr]=t,e[ba]=r,Db(e,t,!1,!1),t.stateNode=e;e:{switch(o=ef(n,r),n){case"dialog":Ue("cancel",e),Ue("close",e),s=r;break;case"iframe":case"object":case"embed":Ue("load",e),s=r;break;case"video":case"audio":for(s=0;s<$o.length;s++)Ue($o[s],e);s=r;break;case"source":Ue("error",e),s=r;break;case"img":case"image":case"link":Ue("error",e),Ue("load",e),s=r;break;case"details":Ue("toggle",e),s=r;break;case"input":Ym(e,r),s=Gd(e,r),Ue("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=tt({},r,{value:void 0}),Ue("invalid",e);break;case"textarea":Xm(e,r),s=Xd(e,r),Ue("invalid",e);break;default:s=r}Zd(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?pw(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&fw(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&fa(e,l):typeof l=="number"&&fa(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(da.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Ue("scroll",e):l!=null&&Mh(e,i,l,o))}switch(n){case"input":il(e),Qm(e,r,!1);break;case"textarea":il(e),Jm(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ws(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?zi(e,!!r.multiple,i,!1):r.defaultValue!=null&&zi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=cu)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Rt(t),null;case 6:if(e&&t.stateNode!=null)Ob(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(H(166));if(n=Vs(Sa.current),Vs(wr.current),pl(t)){if(r=t.stateNode,n=t.memoizedProps,r[mr]=t,(i=r.nodeValue!==n)&&(e=_n,e!==null))switch(e.tag){case 3:hl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&hl(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[mr]=t,t.stateNode=r}return Rt(t),null;case 13:if(Ve(Qe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(We&&xn!==null&&t.mode&1&&!(t.flags&128))tb(),Xi(),t.flags|=98560,i=!1;else if(i=pl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(H(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(H(317));i[mr]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rt(t),i=!1}else er!==null&&(Df(er),er=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Qe.current&1?mt===0&&(mt=3):gp())),t.updateQueue!==null&&(t.flags|=4),Rt(t),null);case 4:return Zi(),Tf(e,t),e===null&&xa(t.stateNode.containerInfo),Rt(t),null;case 10:return Zh(t.type._context),Rt(t),null;case 17:return nn(t.type)&&du(),Rt(t),null;case 19:if(Ve(Qe),i=t.memoizedState,i===null)return Rt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)Ao(i,!1);else{if(mt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=vu(e),o!==null){for(t.flags|=128,Ao(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ze(Qe,Qe.current&1|2),t.child}e=e.sibling}i.tail!==null&&ut()>to&&(t.flags|=128,r=!0,Ao(i,!1),t.lanes=4194304)}else{if(!r)if(e=vu(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ao(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!We)return Rt(t),null}else 2*ut()-i.renderingStartTime>to&&n!==1073741824&&(t.flags|=128,r=!0,Ao(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ut(),t.sibling=null,n=Qe.current,ze(Qe,r?n&1|2:n&1),t):(Rt(t),null);case 22:case 23:return mp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?gn&1073741824&&(Rt(t),t.subtreeFlags&6&&(t.flags|=8192)):Rt(t),null;case 24:return null;case 25:return null}throw Error(H(156,t.tag))}function PT(e,t){switch(Yh(t),t.tag){case 1:return nn(t.type)&&du(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zi(),Ve(tn),Ve(Dt),sp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return rp(t),null;case 13:if(Ve(Qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(H(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ve(Qe),null;case 4:return Zi(),null;case 10:return Zh(t.type._context),null;case 22:case 23:return mp(),null;case 24:return null;default:return null}}var yl=!1,Pt=!1,jT=typeof WeakSet=="function"?WeakSet:Set,ee=null;function Mi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nt(e,t,r)}else n.current=null}function If(e,t,n){try{n()}catch(r){nt(e,t,r)}}var $g=!1;function AT(e,t){if(df=au,e=Uw(),Kh(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(a=o),h===i&&++c===r&&(l=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ff={focusedElem:e,selectionRange:n},au=!1,ee=t;ee!==null;)if(t=ee,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ee=e;else for(;ee!==null;){t=ee;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var y=g.memoizedProps,b=g.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?y:Jn(t.type,y),b);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(H(163))}}catch(k){nt(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,ee=e;break}ee=t.return}return g=$g,$g=!1,g}function Qo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&If(t,n,i)}s=s.next}while(s!==r)}}function uc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Rf(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function zb(e){var t=e.alternate;t!==null&&(e.alternate=null,zb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mr],delete t[ba],delete t[mf],delete t[pT],delete t[mT])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Fb(e){return e.tag===5||e.tag===3||e.tag===4}function Ug(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fb(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.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 Pf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=cu));else if(r!==4&&(e=e.child,e!==null))for(Pf(e,t,n),e=e.sibling;e!==null;)Pf(e,t,n),e=e.sibling}function jf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(jf(e,t,n),e=e.sibling;e!==null;)jf(e,t,n),e=e.sibling}var wt=null,Zn=!1;function Qr(e,t,n){for(n=n.child;n!==null;)Bb(e,t,n),n=n.sibling}function Bb(e,t,n){if(xr&&typeof xr.onCommitFiberUnmount=="function")try{xr.onCommitFiberUnmount(tc,n)}catch{}switch(n.tag){case 5:Pt||Mi(n,t);case 6:var r=wt,s=Zn;wt=null,Qr(e,t,n),wt=r,Zn=s,wt!==null&&(Zn?(e=wt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wt.removeChild(n.stateNode));break;case 18:wt!==null&&(Zn?(e=wt,n=n.stateNode,e.nodeType===8?Zc(e.parentNode,n):e.nodeType===1&&Zc(e,n),ga(e)):Zc(wt,n.stateNode));break;case 4:r=wt,s=Zn,wt=n.stateNode.containerInfo,Zn=!0,Qr(e,t,n),wt=r,Zn=s;break;case 0:case 11:case 14:case 15:if(!Pt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&If(n,t,o),s=s.next}while(s!==r)}Qr(e,t,n);break;case 1:if(!Pt&&(Mi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){nt(n,t,a)}Qr(e,t,n);break;case 21:Qr(e,t,n);break;case 22:n.mode&1?(Pt=(r=Pt)||n.memoizedState!==null,Qr(e,t,n),Pt=r):Qr(e,t,n);break;default:Qr(e,t,n)}}function Vg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new jT),t.forEach(function(r){var s=$T.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Xn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:wt=a.stateNode,Zn=!1;break e;case 3:wt=a.stateNode.containerInfo,Zn=!0;break e;case 4:wt=a.stateNode.containerInfo,Zn=!0;break e}a=a.return}if(wt===null)throw Error(H(160));Bb(i,o,s),wt=null,Zn=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(u){nt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)$b(t,e),t=t.sibling}function $b(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Xn(t,e),cr(e),r&4){try{Qo(3,e,e.return),uc(3,e)}catch(y){nt(e,e.return,y)}try{Qo(5,e,e.return)}catch(y){nt(e,e.return,y)}}break;case 1:Xn(t,e),cr(e),r&512&&n!==null&&Mi(n,n.return);break;case 5:if(Xn(t,e),cr(e),r&512&&n!==null&&Mi(n,n.return),e.flags&32){var s=e.stateNode;try{fa(s,"")}catch(y){nt(e,e.return,y)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&uw(s,i),ef(a,o);var u=ef(a,i);for(o=0;o<l.length;o+=2){var c=l[o],f=l[o+1];c==="style"?pw(s,f):c==="dangerouslySetInnerHTML"?fw(s,f):c==="children"?fa(s,f):Mh(s,c,f,u)}switch(a){case"input":Yd(s,i);break;case"textarea":cw(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?zi(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?zi(s,!!i.multiple,i.defaultValue,!0):zi(s,!!i.multiple,i.multiple?[]:"",!1))}s[ba]=i}catch(y){nt(e,e.return,y)}}break;case 6:if(Xn(t,e),cr(e),r&4){if(e.stateNode===null)throw Error(H(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(y){nt(e,e.return,y)}}break;case 3:if(Xn(t,e),cr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ga(t.containerInfo)}catch(y){nt(e,e.return,y)}break;case 4:Xn(t,e),cr(e);break;case 13:Xn(t,e),cr(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(hp=ut())),r&4&&Vg(e);break;case 22:if(c=n!==null&&n.memoizedState!==null,e.mode&1?(Pt=(u=Pt)||c,Xn(t,e),Pt=u):Xn(t,e),cr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!c&&e.mode&1)for(ee=e,c=e.child;c!==null;){for(f=ee=c;ee!==null;){switch(h=ee,p=h.child,h.tag){case 0:case 11:case 14:case 15:Qo(4,h,h.return);break;case 1:Mi(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(y){nt(r,n,y)}}break;case 5:Mi(h,h.return);break;case 22:if(h.memoizedState!==null){Wg(f);continue}}p!==null?(p.return=h,ee=p):Wg(f)}c=c.sibling}e:for(c=null,f=e;;){if(f.tag===5){if(c===null){c=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=f.stateNode,l=f.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=hw("display",o))}catch(y){nt(e,e.return,y)}}}else if(f.tag===6){if(c===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){nt(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;c===f&&(c=null),f=f.return}c===f&&(c=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Xn(t,e),cr(e),r&4&&Vg(e);break;case 21:break;default:Xn(t,e),cr(e)}}function cr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Fb(n)){var r=n;break e}n=n.return}throw Error(H(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(fa(s,""),r.flags&=-33);var i=Ug(e);jf(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Ug(e);Pf(e,a,o);break;default:throw Error(H(161))}}catch(l){nt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function NT(e,t,n){ee=e,Ub(e)}function Ub(e,t,n){for(var r=(e.mode&1)!==0;ee!==null;){var s=ee,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||yl;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||Pt;a=yl;var u=Pt;if(yl=o,(Pt=l)&&!u)for(ee=s;ee!==null;)o=ee,l=o.child,o.tag===22&&o.memoizedState!==null?qg(s):l!==null?(l.return=o,ee=l):qg(s);for(;i!==null;)ee=i,Ub(i),i=i.sibling;ee=s,yl=a,Pt=u}Hg(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,ee=i):Hg(e)}}function Hg(e){for(;ee!==null;){var t=ee;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Pt||uc(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Pt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Jn(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Ig(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Ig(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var f=c.dehydrated;f!==null&&ga(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(H(163))}Pt||t.flags&512&&Rf(t)}catch(h){nt(t,t.return,h)}}if(t===e){ee=null;break}if(n=t.sibling,n!==null){n.return=t.return,ee=n;break}ee=t.return}}function Wg(e){for(;ee!==null;){var t=ee;if(t===e){ee=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ee=n;break}ee=t.return}}function qg(e){for(;ee!==null;){var t=ee;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{uc(4,t)}catch(l){nt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(l){nt(t,s,l)}}var i=t.return;try{Rf(t)}catch(l){nt(t,i,l)}break;case 5:var o=t.return;try{Rf(t)}catch(l){nt(t,o,l)}}}catch(l){nt(t,t.return,l)}if(t===e){ee=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ee=a;break}ee=t.return}}var MT=Math.ceil,bu=qr.ReactCurrentDispatcher,dp=qr.ReactCurrentOwner,$n=qr.ReactCurrentBatchConfig,Ie=0,vt=null,ht=null,St=0,gn=0,Di=Is(0),mt=0,Ta=null,ni=0,cc=0,fp=0,Xo=null,Qt=null,hp=0,to=1/0,jr=null,_u=!1,Af=null,ps=null,vl=!1,is=null,Su=0,Jo=0,Nf=null,Hl=-1,Wl=0;function Vt(){return Ie&6?ut():Hl!==-1?Hl:Hl=ut()}function ms(e){return e.mode&1?Ie&2&&St!==0?St&-St:yT.transition!==null?(Wl===0&&(Wl=Ew()),Wl):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:Nw(e.type)),e):1}function rr(e,t,n,r){if(50<Jo)throw Jo=0,Nf=null,Error(H(185));Wa(e,n,r),(!(Ie&2)||e!==vt)&&(e===vt&&(!(Ie&2)&&(cc|=n),mt===4&&ns(e,St)),rn(e,r),n===1&&Ie===0&&!(t.mode&1)&&(to=ut()+500,oc&&Rs()))}function rn(e,t){var n=e.callbackNode;yE(e,t);var r=ou(e,e===vt?St:0);if(r===0)n!==null&&tg(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&tg(n),t===1)e.tag===0?gT(Kg.bind(null,e)):Jw(Kg.bind(null,e)),fT(function(){!(Ie&6)&&Rs()}),n=null;else{switch(Tw(r)){case 1:n=Fh;break;case 4:n=kw;break;case 16:n=iu;break;case 536870912:n=Cw;break;default:n=iu}n=Qb(n,Vb.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Vb(e,t){if(Hl=-1,Wl=0,Ie&6)throw Error(H(327));var n=e.callbackNode;if(Vi()&&e.callbackNode!==n)return null;var r=ou(e,e===vt?St:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ku(e,r);else{t=r;var s=Ie;Ie|=2;var i=Wb();(vt!==e||St!==t)&&(jr=null,to=ut()+500,Ws(e,t));do try{OT();break}catch(a){Hb(e,a)}while(!0);Jh(),bu.current=i,Ie=s,ht!==null?t=0:(vt=null,St=0,t=mt)}if(t!==0){if(t===2&&(s=of(e),s!==0&&(r=s,t=Mf(e,s))),t===1)throw n=Ta,Ws(e,0),ns(e,r),rn(e,ut()),n;if(t===6)ns(e,r);else{if(s=e.current.alternate,!(r&30)&&!DT(s)&&(t=ku(e,r),t===2&&(i=of(e),i!==0&&(r=i,t=Mf(e,i))),t===1))throw n=Ta,Ws(e,0),ns(e,r),rn(e,ut()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(H(345));case 2:zs(e,Qt,jr);break;case 3:if(ns(e,r),(r&130023424)===r&&(t=hp+500-ut(),10<t)){if(ou(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Vt(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=pf(zs.bind(null,e,Qt,jr),t);break}zs(e,Qt,jr);break;case 4:if(ns(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-nr(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=ut()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*MT(r/1960))-r,10<r){e.timeoutHandle=pf(zs.bind(null,e,Qt,jr),r);break}zs(e,Qt,jr);break;case 5:zs(e,Qt,jr);break;default:throw Error(H(329))}}}return rn(e,ut()),e.callbackNode===n?Vb.bind(null,e):null}function Mf(e,t){var n=Xo;return e.current.memoizedState.isDehydrated&&(Ws(e,t).flags|=256),e=ku(e,t),e!==2&&(t=Qt,Qt=n,t!==null&&Df(t)),e}function Df(e){Qt===null?Qt=e:Qt.push.apply(Qt,e)}function DT(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!ir(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ns(e,t){for(t&=~fp,t&=~cc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-nr(t),r=1<<n;e[n]=-1,t&=~r}}function Kg(e){if(Ie&6)throw Error(H(327));Vi();var t=ou(e,0);if(!(t&1))return rn(e,ut()),null;var n=ku(e,t);if(e.tag!==0&&n===2){var r=of(e);r!==0&&(t=r,n=Mf(e,r))}if(n===1)throw n=Ta,Ws(e,0),ns(e,t),rn(e,ut()),n;if(n===6)throw Error(H(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,zs(e,Qt,jr),rn(e,ut()),null}function pp(e,t){var n=Ie;Ie|=1;try{return e(t)}finally{Ie=n,Ie===0&&(to=ut()+500,oc&&Rs())}}function ri(e){is!==null&&is.tag===0&&!(Ie&6)&&Vi();var t=Ie;Ie|=1;var n=$n.transition,r=Pe;try{if($n.transition=null,Pe=1,e)return e()}finally{Pe=r,$n.transition=n,Ie=t,!(Ie&6)&&Rs()}}function mp(){gn=Di.current,Ve(Di)}function Ws(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,dT(n)),ht!==null)for(n=ht.return;n!==null;){var r=n;switch(Yh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&du();break;case 3:Zi(),Ve(tn),Ve(Dt),sp();break;case 5:rp(r);break;case 4:Zi();break;case 13:Ve(Qe);break;case 19:Ve(Qe);break;case 10:Zh(r.type._context);break;case 22:case 23:mp()}n=n.return}if(vt=e,ht=e=gs(e.current,null),St=gn=t,mt=0,Ta=null,fp=cc=ni=0,Qt=Xo=null,Us!==null){for(t=0;t<Us.length;t++)if(n=Us[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Us=null}return e}function Hb(e,t){do{var n=ht;try{if(Jh(),$l.current=wu,xu){for(var r=et.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}xu=!1}if(ti=0,yt=pt=et=null,Yo=!1,ka=0,dp.current=null,n===null||n.return===null){mt=1,Ta=t,ht=null;break}e:{var i=e,o=n.return,a=n,l=t;if(t=St,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,c=a,f=c.tag;if(!(c.mode&1)&&(f===0||f===11||f===15)){var h=c.alternate;h?(c.updateQueue=h.updateQueue,c.memoizedState=h.memoizedState,c.lanes=h.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=Mg(o);if(p!==null){p.flags&=-257,Dg(p,o,a,i,t),p.mode&1&&Ng(i,u,t),t=p,l=u;var g=t.updateQueue;if(g===null){var y=new Set;y.add(l),t.updateQueue=y}else g.add(l);break e}else{if(!(t&1)){Ng(i,u,t),gp();break e}l=Error(H(426))}}else if(We&&a.mode&1){var b=Mg(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),Dg(b,o,a,i,t),Qh(eo(l,a));break e}}i=l=eo(l,a),mt!==4&&(mt=2),Xo===null?Xo=[i]:Xo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=Tb(i,l,t);Tg(i,x);break e;case 1:a=l;var v=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ps===null||!ps.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var k=Ib(i,a,t);Tg(i,k);break e}}i=i.return}while(i!==null)}Kb(n)}catch(_){t=_,ht===n&&n!==null&&(ht=n=n.return);continue}break}while(!0)}function Wb(){var e=bu.current;return bu.current=wu,e===null?wu:e}function gp(){(mt===0||mt===3||mt===2)&&(mt=4),vt===null||!(ni&268435455)&&!(cc&268435455)||ns(vt,St)}function ku(e,t){var n=Ie;Ie|=2;var r=Wb();(vt!==e||St!==t)&&(jr=null,Ws(e,t));do try{LT();break}catch(s){Hb(e,s)}while(!0);if(Jh(),Ie=n,bu.current=r,ht!==null)throw Error(H(261));return vt=null,St=0,mt}function LT(){for(;ht!==null;)qb(ht)}function OT(){for(;ht!==null&&!lE();)qb(ht)}function qb(e){var t=Yb(e.alternate,e,gn);e.memoizedProps=e.pendingProps,t===null?Kb(e):ht=t,dp.current=null}function Kb(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=PT(n,t),n!==null){n.flags&=32767,ht=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{mt=6,ht=null;return}}else if(n=RT(n,t,gn),n!==null){ht=n;return}if(t=t.sibling,t!==null){ht=t;return}ht=t=e}while(t!==null);mt===0&&(mt=5)}function zs(e,t,n){var r=Pe,s=$n.transition;try{$n.transition=null,Pe=1,zT(e,t,n,r)}finally{$n.transition=s,Pe=r}return null}function zT(e,t,n,r){do Vi();while(is!==null);if(Ie&6)throw Error(H(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(H(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(vE(e,i),e===vt&&(ht=vt=null,St=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||vl||(vl=!0,Qb(iu,function(){return Vi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=$n.transition,$n.transition=null;var o=Pe;Pe=1;var a=Ie;Ie|=4,dp.current=null,AT(e,n),$b(n,e),sT(ff),au=!!df,ff=df=null,e.current=n,NT(n),uE(),Ie=a,Pe=o,$n.transition=i}else e.current=n;if(vl&&(vl=!1,is=e,Su=s),i=e.pendingLanes,i===0&&(ps=null),fE(n.stateNode),rn(e,ut()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(_u)throw _u=!1,e=Af,Af=null,e;return Su&1&&e.tag!==0&&Vi(),i=e.pendingLanes,i&1?e===Nf?Jo++:(Jo=0,Nf=e):Jo=0,Rs(),null}function Vi(){if(is!==null){var e=Tw(Su),t=$n.transition,n=Pe;try{if($n.transition=null,Pe=16>e?16:e,is===null)var r=!1;else{if(e=is,is=null,Su=0,Ie&6)throw Error(H(331));var s=Ie;for(Ie|=4,ee=e.current;ee!==null;){var i=ee,o=i.child;if(ee.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(ee=u;ee!==null;){var c=ee;switch(c.tag){case 0:case 11:case 15:Qo(8,c,i)}var f=c.child;if(f!==null)f.return=c,ee=f;else for(;ee!==null;){c=ee;var h=c.sibling,p=c.return;if(zb(c),c===u){ee=null;break}if(h!==null){h.return=p,ee=h;break}ee=p}}}var g=i.alternate;if(g!==null){var y=g.child;if(y!==null){g.child=null;do{var b=y.sibling;y.sibling=null,y=b}while(y!==null)}}ee=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ee=o;else e:for(;ee!==null;){if(i=ee,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Qo(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,ee=x;break e}ee=i.return}}var v=e.current;for(ee=v;ee!==null;){o=ee;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,ee=w;else e:for(o=v;ee!==null;){if(a=ee,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:uc(9,a)}}catch(_){nt(a,a.return,_)}if(a===o){ee=null;break e}var k=a.sibling;if(k!==null){k.return=a.return,ee=k;break e}ee=a.return}}if(Ie=s,Rs(),xr&&typeof xr.onPostCommitFiberRoot=="function")try{xr.onPostCommitFiberRoot(tc,e)}catch{}r=!0}return r}finally{Pe=n,$n.transition=t}}return!1}function Gg(e,t,n){t=eo(n,t),t=Tb(e,t,1),e=hs(e,t,1),t=Vt(),e!==null&&(Wa(e,1,t),rn(e,t))}function nt(e,t,n){if(e.tag===3)Gg(e,e,n);else for(;t!==null;){if(t.tag===3){Gg(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ps===null||!ps.has(r))){e=eo(n,e),e=Ib(t,e,1),t=hs(t,e,1),e=Vt(),t!==null&&(Wa(t,1,e),rn(t,e));break}}t=t.return}}function FT(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Vt(),e.pingedLanes|=e.suspendedLanes&n,vt===e&&(St&n)===n&&(mt===4||mt===3&&(St&130023424)===St&&500>ut()-hp?Ws(e,0):fp|=n),rn(e,t)}function Gb(e,t){t===0&&(e.mode&1?(t=ll,ll<<=1,!(ll&130023424)&&(ll=4194304)):t=1);var n=Vt();e=Ur(e,t),e!==null&&(Wa(e,t,n),rn(e,n))}function BT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gb(e,n)}function $T(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(H(314))}r!==null&&r.delete(t),Gb(e,n)}var Yb;Yb=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||tn.current)en=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return en=!1,IT(e,t,n);en=!!(e.flags&131072)}else en=!1,We&&t.flags&1048576&&Zw(t,pu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Vl(e,t),e=t.pendingProps;var s=Qi(t,Dt.current);Ui(t,n),s=op(null,t,r,e,s,n);var i=ap();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,nn(r)?(i=!0,fu(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,tp(t),s.updater=lc,t.stateNode=s,s._reactInternals=t,bf(t,r,e,n),t=kf(null,t,r,!0,i,n)):(t.tag=0,We&&i&&Gh(t),$t(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Vl(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=VT(r),e=Jn(r,e),s){case 0:t=Sf(null,t,r,e,n);break e;case 1:t=zg(null,t,r,e,n);break e;case 11:t=Lg(null,t,r,e,n);break e;case 14:t=Og(null,t,r,Jn(r.type,e),n);break e}throw Error(H(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jn(r,s),Sf(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jn(r,s),zg(e,t,r,s,n);case 3:e:{if(Ab(t),e===null)throw Error(H(387));r=t.pendingProps,i=t.memoizedState,s=i.element,ib(e,t),yu(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=eo(Error(H(423)),t),t=Fg(e,t,r,n,s);break e}else if(r!==s){s=eo(Error(H(424)),t),t=Fg(e,t,r,n,s);break e}else for(xn=fs(t.stateNode.containerInfo.firstChild),_n=t,We=!0,er=null,n=rb(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Xi(),r===s){t=Vr(e,t,n);break e}$t(e,t,r,n)}t=t.child}return t;case 5:return ob(t),e===null&&vf(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,hf(r,s)?o=null:i!==null&&hf(r,i)&&(t.flags|=32),jb(e,t),$t(e,t,o,n),t.child;case 6:return e===null&&vf(t),null;case 13:return Nb(e,t,n);case 4:return np(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ji(t,null,r,n):$t(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jn(r,s),Lg(e,t,r,s,n);case 7:return $t(e,t,t.pendingProps,n),t.child;case 8:return $t(e,t,t.pendingProps.children,n),t.child;case 12:return $t(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,ze(mu,r._currentValue),r._currentValue=o,i!==null)if(ir(i.value,o)){if(i.children===s.children&&!tn.current){t=Vr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Fr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),xf(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(H(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),xf(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}$t(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ui(t,n),s=Vn(s),r=r(s),t.flags|=1,$t(e,t,r,n),t.child;case 14:return r=t.type,s=Jn(r,t.pendingProps),s=Jn(r.type,s),Og(e,t,r,s,n);case 15:return Rb(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Jn(r,s),Vl(e,t),t.tag=1,nn(r)?(e=!0,fu(t)):e=!1,Ui(t,n),Eb(t,r,s),bf(t,r,s,n),kf(null,t,r,!0,e,n);case 19:return Mb(e,t,n);case 22:return Pb(e,t,n)}throw Error(H(156,t.tag))};function Qb(e,t){return Sw(e,t)}function UT(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zn(e,t,n,r){return new UT(e,t,n,r)}function yp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function VT(e){if(typeof e=="function")return yp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Lh)return 11;if(e===Oh)return 14}return 2}function gs(e,t){var n=e.alternate;return n===null?(n=zn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ql(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")yp(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ci:return qs(n.children,s,i,t);case Dh:o=8,s|=8;break;case Hd:return e=zn(12,n,t,s|2),e.elementType=Hd,e.lanes=i,e;case Wd:return e=zn(13,n,t,s),e.elementType=Wd,e.lanes=i,e;case qd:return e=zn(19,n,t,s),e.elementType=qd,e.lanes=i,e;case ow:return dc(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case sw:o=10;break e;case iw:o=9;break e;case Lh:o=11;break e;case Oh:o=14;break e;case Jr:o=16,r=null;break e}throw Error(H(130,e==null?e:typeof e,""))}return t=zn(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function qs(e,t,n,r){return e=zn(7,e,r,t),e.lanes=n,e}function dc(e,t,n,r){return e=zn(22,e,r,t),e.elementType=ow,e.lanes=n,e.stateNode={isHidden:!1},e}function ad(e,t,n){return e=zn(6,e,null,t),e.lanes=n,e}function ld(e,t,n){return t=zn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function HT(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uc(0),this.expirationTimes=Uc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uc(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function vp(e,t,n,r,s,i,o,a,l){return e=new HT(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tp(i),e}function WT(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ki,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Xb(e){if(!e)return bs;e=e._reactInternals;e:{if(li(e)!==e||e.tag!==1)throw Error(H(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(nn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(H(171))}if(e.tag===1){var n=e.type;if(nn(n))return Xw(e,n,t)}return t}function Jb(e,t,n,r,s,i,o,a,l){return e=vp(n,r,!0,e,s,i,o,a,l),e.context=Xb(null),n=e.current,r=Vt(),s=ms(n),i=Fr(r,s),i.callback=t??null,hs(n,i,s),e.current.lanes=s,Wa(e,s,r),rn(e,r),e}function fc(e,t,n,r){var s=t.current,i=Vt(),o=ms(s);return n=Xb(n),t.context===null?t.context=n:t.pendingContext=n,t=Fr(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=hs(s,t,o),e!==null&&(rr(e,s,o,i),Bl(e,s,o)),o}function Cu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Yg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xp(e,t){Yg(e,t),(e=e.alternate)&&Yg(e,t)}function qT(){return null}var Zb=typeof reportError=="function"?reportError:function(e){console.error(e)};function wp(e){this._internalRoot=e}hc.prototype.render=wp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(H(409));fc(e,t,null,null)};hc.prototype.unmount=wp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ri(function(){fc(null,e,null,null)}),t[$r]=null}};function hc(e){this._internalRoot=e}hc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Pw();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ts.length&&t!==0&&t<ts[n].priority;n++);ts.splice(n,0,e),n===0&&Aw(e)}};function bp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function pc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Qg(){}function KT(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Cu(o);i.call(u)}}var o=Jb(t,r,e,0,null,!1,!1,"",Qg);return e._reactRootContainer=o,e[$r]=o.current,xa(e.nodeType===8?e.parentNode:e),ri(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var u=Cu(l);a.call(u)}}var l=vp(e,0,!1,null,null,!1,!1,"",Qg);return e._reactRootContainer=l,e[$r]=l.current,xa(e.nodeType===8?e.parentNode:e),ri(function(){fc(t,l,n,r)}),l}function mc(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var l=Cu(o);a.call(l)}}fc(t,o,e,s)}else o=KT(n,t,e,s,r);return Cu(o)}Iw=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Bo(t.pendingLanes);n!==0&&(Bh(t,n|1),rn(t,ut()),!(Ie&6)&&(to=ut()+500,Rs()))}break;case 13:ri(function(){var r=Ur(e,1);if(r!==null){var s=Vt();rr(r,e,1,s)}}),xp(e,1)}};$h=function(e){if(e.tag===13){var t=Ur(e,134217728);if(t!==null){var n=Vt();rr(t,e,134217728,n)}xp(e,134217728)}};Rw=function(e){if(e.tag===13){var t=ms(e),n=Ur(e,t);if(n!==null){var r=Vt();rr(n,e,t,r)}xp(e,t)}};Pw=function(){return Pe};jw=function(e,t){var n=Pe;try{return Pe=e,t()}finally{Pe=n}};nf=function(e,t,n){switch(t){case"input":if(Yd(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=ic(r);if(!s)throw Error(H(90));lw(r),Yd(r,s)}}}break;case"textarea":cw(e,n);break;case"select":t=n.value,t!=null&&zi(e,!!n.multiple,t,!1)}};yw=pp;vw=ri;var GT={usingClientEntryPoint:!1,Events:[Ka,Ri,ic,mw,gw,pp]},No={findFiberByHostInstance:$s,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},YT={bundleType:No.bundleType,version:No.version,rendererPackageName:No.rendererPackageName,rendererConfig:No.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:qr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bw(e),e===null?null:e.stateNode},findFiberByHostInstance:No.findFiberByHostInstance||qT,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xl.isDisabled&&xl.supportsFiber)try{tc=xl.inject(YT),xr=xl}catch{}}Rn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GT;Rn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bp(t))throw Error(H(200));return WT(e,t,null,n)};Rn.createRoot=function(e,t){if(!bp(e))throw Error(H(299));var n=!1,r="",s=Zb;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=vp(e,1,!1,null,null,n,!1,r,s),e[$r]=t.current,xa(e.nodeType===8?e.parentNode:e),new wp(t)};Rn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(H(188)):(e=Object.keys(e).join(","),Error(H(268,e)));return e=bw(t),e=e===null?null:e.stateNode,e};Rn.flushSync=function(e){return ri(e)};Rn.hydrate=function(e,t,n){if(!pc(t))throw Error(H(200));return mc(null,e,t,!0,n)};Rn.hydrateRoot=function(e,t,n){if(!bp(e))throw Error(H(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=Zb;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=Jb(t,null,e,1,n??null,s,!1,i,o),e[$r]=t.current,xa(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new hc(t)};Rn.render=function(e,t,n){if(!pc(t))throw Error(H(200));return mc(null,e,t,!1,n)};Rn.unmountComponentAtNode=function(e){if(!pc(e))throw Error(H(40));return e._reactRootContainer?(ri(function(){mc(null,null,e,!1,function(){e._reactRootContainer=null,e[$r]=null})}),!0):!1};Rn.unstable_batchedUpdates=pp;Rn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!pc(n))throw Error(H(200));if(e==null||e._reactInternals===void 0)throw Error(H(38));return mc(e,t,n,!1,r)};Rn.version="18.3.1-next-f1338f8080-20240426";function e_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e_)}catch(e){console.error(e)}}e_(),ew.exports=Rn;var t_=ew.exports,n_,Xg=t_;n_=Xg.createRoot,Xg.hydrateRoot;function QT(e,t){const n=e[r_];if(!n)throw new Error("ResourceElement.type is not a valid Resource");return n(t)}const r_=Symbol("fnSymbol");function Se(e){const t=n=>({type:t,props:n});return t[r_]=e,t}function Sr(e,t){return{...t,key:e}}let Zo=null;function XT(e,t){e.currentIndex=0;const n=Zo;Zo=e;try{if(t(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw new Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{Zo=n}}function _s(){if(!Zo)throw new Error("No resource fiber available");return Zo}function JT(e){return null}const s_=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),Eu=e=>{for(const t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},ea=(e,t)=>{const n=e.version>t;if(e.version=t,n){for(const r of e.dirtyCells)r.dirty=!1,r.queue.clear(),r.workInProgress=r.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw new Error("Version is less than committed version");for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(r=>r()),Eu(e)}}},Jg=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))},i_=(e,t)=>{const n=_s(),r=n.currentIndex++;if(!n.isFirstRender&&r>=n.cells.length)throw new Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.");let s=n.cells[r];if(s||(s=t(),n.cells[r]=s),s.type!==e)throw new Error("Hook order changed between renders");return s},ZT=e=>{_s().renderContext.effectTasks.push(e)},eI=(e,t)=>{if(e.renderContext)throw new Error("Resource updated during render");if(e.isNeverMounted)throw new Error("Resource updated before mount");e.root.dispatchUpdate(()=>{const n=t();return n?(n(),e.root.changelog.push(n),!0):!1})};function o_(e,t,n,r){const s=i_("reducer",()=>{const a=_s(),l=r?r(n):n;return{type:"reducer",queue:new Set,dirty:!1,workInProgress:l,current:l,reducer:e,dispatch:u=>{const c={action:u,hasEagerState:!1,eagerState:void 0};eI(a,()=>a.root.dirtyCells.length===0&&!c.hasEagerState&&(c.eagerState=e(s.workInProgress,u),c.hasEagerState=!0,Object.is(s.current,c.eagerState))?null:()=>{Jg(a,s),s.queue.add(c)})}}}),i=_s(),o=e===s.reducer;s.reducer=e;for(const a of s.queue)(!a.hasEagerState||!o)&&(a.eagerState=e(s.workInProgress,a.action),a.hasEagerState=!0),s.workInProgress=a.eagerState;if(s.queue.clear(),t){const a=t(s.workInProgress);Object.is(a,s.workInProgress)||(Jg(i,s),s.workInProgress=a)}return[s.workInProgress,s.dispatch]}function tI(e,t,n){return o_(e,void 0,t,n)}function nI(e,t,n,r){return o_(e,t,n,r)}const rI=(e,t)=>typeof t=="function"?t(e):t,sI=e=>typeof e=="function"?e():e;function En(e){return tI(rI,e,sI)}const a_=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0},iI=()=>({type:"effect",cleanup:void 0,deps:null});function ct(e,t){const n=i_("effect",iI);if(!(t&&n.deps&&a_(n.deps,t))){if(n.deps!==null&&!!t!=!!n.deps)throw new Error("tapEffect called with and without dependencies across re-renders");ZT(()=>{const r=[];try{n.cleanup?.()}catch(s){r.push(s)}finally{n.cleanup=void 0}try{const s=e();if(s!==void 0&&typeof s!="function")throw new Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof s}`);n.cleanup=s}catch(s){r.push(s)}if(n.deps=t,r.length>0){if(r.length===1)throw r[0];for(const s of r)console.error(s);throw new AggregateError(r,"Errors during commit")}})}}function br(e){const[t]=En(()=>({current:e}));return t}function Ks(e,t){const[n]=En(e);return n}const oI=()=>{throw new Error("Memo reducer should not be called")},me=(e,t)=>{_s();const[n]=nI(oI,r=>r&&a_(r.deps,t)?r:{value:e(),deps:t},null);return n.value},Ia=(e,t)=>me(()=>e,t);function _r(e){const t=br(e);ct(()=>{t.current=e});const n=_s();return Ia((...r)=>t.current(...r),[n])}function aI(e){const t=[];for(const n of e.effectTasks)try{n()}catch(r){t.push(r)}if(t.length>0){if(t.length===1)throw t[0];for(const n of t)console.error(n);throw new AggregateError(t,"Errors during commit")}}function lI(e){const t=[];for(const n of e.cells)if(n?.type==="effect"&&(n.deps=null,n.cleanup))try{n.cleanup?.()}catch(r){t.push(r)}finally{n.cleanup=void 0}if(t.length>0){if(t.length===1)throw t[0];for(const n of t)console.error(n);throw new AggregateError(t,"Errors during cleanup")}}function Ra(e,t,n=void 0,r=JT()){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function Hi(e){if(!e.isMounted)throw new Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,lI(e)}function ys(e,t){const n={effectTasks:[],props:t,output:void 0};return XT(e,()=>{e.renderContext=n;try{n.output=QT(e.type,t)}finally{e.renderContext=void 0}}),n}function no(e,t){e.isMounted=!0,e.isNeverMounted=!1,aI(t)}function bt(e,t){const n=_s(),r=br(0),s=me(()=>(e.key,Ra(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),i=t?me(()=>ys(s,e.props),[s,...t,r.current]):ys(s,e.props);return ct(()=>()=>Hi(s),[s]),ct(()=>{no(s,i)},[s,i]),i.output}function gc(e,t){const n=br(0),r=n.current,s=Ks(_s),i=Ks(()=>()=>{n.current++,s.markDirty?.()}),o=Ks(()=>new Map),a=t?Ia(e,t):e,l=me(()=>{const u=a(),c=new Set,f=[];let h=0;for(let p=0;p<u.length;p++){const g=u[p],y=g.key;if(y===void 0)throw new Error(`tapResources did not provide a key for array at index ${p}`);if(c.has(y))throw new Error(`Duplicate key ${y} in tapResources`);c.add(y);let b=o.get(y);if(b)if(b.fiber.type!==g.type){const x=Ra(g.type,s.root,i),v=ys(x,g.props);b.next=[x,v],f.push(v.output)}else b.next=ys(b.fiber,g.props),f.push(b.next.output);else{const x=Ra(g.type,s.root,i),v=ys(x,g.props);b={fiber:x,next:v},h++,o.set(y,b),f.push(v.output)}}if(o.size>f.length-h)for(const p of o.keys())c.has(p)||(o.get(p).next="delete");return f},[a,r]);return ct(()=>()=>{for(const u of o.keys()){const c=o.get(u).fiber;Hi(c)}},[]),ct(()=>{for(const[u,c]of o.entries())c.next==="delete"?(c.fiber.isMounted&&Hi(c.fiber),o.delete(u)):Array.isArray(c.next)?(Hi(c.fiber),c.fiber=c.next[0],no(c.fiber,c.next[1])):no(c.fiber,c.next)},[l]),l}const uI=50;let yr={schedulers:new Set([]),isScheduled:!1};var cI=class{constructor(e){N(this,"_task");N(this,"_isDirty",!1);this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,yr.schedulers.add(this),dI()}runTask(){this._isDirty=!1,this._task()}};const dI=()=>{yr.isScheduled||(yr.isScheduled=!0,fI())},Lf=()=>{try{const e=[];let t=0;for(const n of yr.schedulers)if(yr.schedulers.delete(n),!!n.isDirty){if(t++,t>uI)throw new Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.");try{n.runTask()}catch(r){e.push(r)}}if(e.length>0){if(e.length===1)throw e[0];for(const n of e)console.error(n);throw new AggregateError(e,"Errors occurred during flushSync")}}finally{yr.schedulers.clear(),yr.isScheduled=!1}},fI=(()=>{if(typeof MessageChannel<"u"){const e=new MessageChannel;return e.port1.onmessage=Lf,()=>e.port2.postMessage(null)}return()=>setTimeout(Lf,0)})(),Zg=e=>{const t=yr;yr={schedulers:new Set([]),isScheduled:!0};try{const n=e();return Lf(),n}finally{yr=t}},hI=e=>{const t=Ks(()=>new cI(()=>u(null))),n=Ks(()=>[]),r=me(()=>(e.key,Ra(e.type,s_(c=>{!t.isDirty&&!c()||(n.push(c),t.markDirty())}))),[e.type,e.key]);ea(r.root,r.root.committedVersion);const s=ys(r,e.props),i=br(!1),o=br(e.props),a=br(s.output),l=Ks(()=>new Set),u=_r(c=>{if(c===null&&(ea(r.root,2),ea(r.root,1),n.forEach(f=>{f()}),c=ys(r,o.current)),t.isDirty)throw new Error("Scheduler is dirty, this should never happen");Eu(r.root),n.length=0,i.current&&no(r,c),!(t.isDirty||a.current===c.output)&&(a.current=c.output,l.forEach(f=>f()))});return ct(()=>(i.current=!0,()=>{i.current=!1,Hi(r)}),[r]),ct(()=>{o.current=s.props,Eu(r.root),no(r,s),!(t.isDirty||a.current===s.output)&&(a.current=s.output,l.forEach(c=>c()))}),me(()=>({getValue:()=>a.current,subscribe:c=>(l.add(c),()=>l.delete(c))}),[])},ta=Symbol("tap.Context"),l_=e=>({[ta]:e}),u_=(e,t,n)=>{const r=e[ta];e[ta]=t;try{return n()}finally{e[ta]=r}},c_=e=>e[ta],pI=Se(()=>{const[e,t]=En(()=>({renderers:{},fallbacks:[]}));return{getState:()=>e,setDataUI:Ia((n,r)=>(t(s=>({...s,renderers:{...s.renderers,[n]:[...s.renderers[n]??[],r]}})),()=>{t(s=>({...s,renderers:{...s.renderers,[n]:s.renderers[n]?.filter(i=>i!==r)??[]}}))}),[]),setFallbackDataUI:Ia(n=>(t(r=>({...r,fallbacks:[...r.fallbacks,n]})),()=>{t(r=>({...r,fallbacks:r.fallbacks.filter(s=>s!==n)}))}),[])}}),mI=e=>{const t=Array.from(e).map(r=>r.getModelContext()).sort((r,s)=>(s.priority??0)-(r.priority??0)),n={};return t.reduce((r,s)=>{const i=s.priority??0;if(s.system&&(r.system?r.system+=`
|
|
41
|
+
|
|
42
|
+
${s.system}`:r.system=s.system),s.tools)for(const[o,a]of Object.entries(s.tools)){const l=r.tools?.[o];if(l&&l!==a){const u=n[o];if(u===i)throw new Error(`You tried to define a tool with the name ${o}, but it already exists.`);const c=u>i?l:a,f=u>i?a:l;r.tools[o]={...f,...c},n[o]=Math.max(u,i);continue}r.tools||(r.tools={}),r.tools[o]=a,n[o]??(n[o]=i)}return s.config&&(r.config={...r.config,...s.config}),s.callSettings&&(r.callSettings={...r.callSettings,...s.callSettings}),r},{})};var _p=class{constructor(){N(this,"_providers",new Set);N(this,"_subscribers",new Set)}getModelContext(){return mI(this._providers)}registerModelContextProvider(e){this._providers.add(e);const t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}notifySubscribers(){for(const e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}};const Of=[],gI={modelName:void 0,toolNames:Of},yI=(e,t)=>e===t||e.length===t.length&&e.every((n,r)=>n===t[r]),wl=(e,t)=>{const n=e.getModelContext(),r=n.config?.modelName,s=n.tools?Object.keys(n.tools).sort():Of,i=s.length?s:Of;return r===t.modelName&&yI(i,t.toolNames)?t:{modelName:r,toolNames:i}},d_=Se(()=>{const e=me(()=>new _p,[]),[t,n]=En(()=>wl(e,gI));return ct(()=>(n(r=>wl(e,r)),e.subscribe(()=>{n(r=>wl(e,r))})),[e]),{getState:()=>wl(e,t),getModelContext:()=>e.getModelContext(),subscribe:r=>e.subscribe(r),register:r=>e.registerModelContextProvider(r)}}),vI=e=>e.display!==void 0?e.display==="standalone":e.type==="human",xI=(e,t)=>{if(!(t.status?.type==="running"||t.status?.type==="requires-action")){const r=e.complete;return typeof r!="function"?r??null:r({args:t.args,result:t.result})}const n=e.running;return typeof n!="function"?n??null:n({args:t.args})},wI=e=>function(n){return xI(e,n)},zf=Symbol("assistant-ui.store.clientIndex"),bI=e=>e[zf],f_=l_([]),Sp=()=>c_(f_),_I=(e,t)=>{const n=Sp();return u_(f_,me(()=>[...n,e],[n,e]),t)},SI=new Set(["$$typeof","nodeType","then"]),yc=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!="symbol"){if(e==="toJSON")return()=>t;if(!SI.has(e))return!1}};var kp=class{getOwnPropertyDescriptor(e,t){const n=this.get(e,t);if(n!==void 0)return{value:n,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}};const h_=e=>{const t=Se(e);return n=>{const r=t(n);return n.key===void 0?r:Sr(n.key,r)}},Tu=Symbol("assistant-ui.store.getValue"),kI=e=>{const t=e[Tu];if(!t)throw new Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");return t.getState?.()},ey=new Map;function CI(e){let t=ey.get(e);return t||(t=function(...n){if(!this||typeof this!="object")throw new Error(`Method "${String(e)}" called without proper context. This may indicate the function was called incorrectly.`);const r=this[Tu];if(!r)throw new Error(`Method "${String(e)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);const s=r[e];if(!s)throw new Error(`Method "${String(e)}" is not implemented.`);if(typeof s!="function")throw new Error(`"${String(e)}" is not a function.`);return s(...n)},ey.set(e,t)),t}var EI=class extends kp{constructor(t,n){super();N(this,"outputRef");N(this,"index");N(this,"boundFns");N(this,"cachedReceiver");this.outputRef=t,this.index=n}get(t,n,r){if(n===Tu)return this.outputRef.current;if(n===zf)return this.index;const s=yc(n,"ClientProxy");if(s!==!1)return s;const i=this.outputRef.current[n];if(typeof i=="function"){this.cachedReceiver!==r&&(this.boundFns=new Map,this.cachedReceiver=r);let o=this.boundFns.get(n);return o||(o=CI(n).bind(r),this.boundFns.set(n,o)),o}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(t,n){return n===Tu||n===zf?!0:n in this.outputRef.current}};const p_=h_(e=>{const t=br(null),n=Sp().length,r=me(()=>new Proxy({},new EI(t,n)),[n]),s=_I(r,()=>bt(e));return t.current||(t.current=s),ct(()=>{t.current=s}),{methods:r,state:s.getState?.(),key:e.key}}),vc=e=>bt(p_(e)),na=Symbol("assistant-ui.store.proxiedAssistantState"),ud=e=>e==="on"||e==="subscribe"||typeof e=="symbol",m_=e=>{class t extends kp{get(r,s){const i=yc(s,"AssistantState");if(i!==!1)return i;const o=s;if(!ud(o))return kI(e[o]())}ownKeys(){return Object.keys(e).filter(r=>!ud(r))}has(r,s){return!ud(s)&&s in e}}return new Proxy({},new t)},TI=e=>e[na],ty=()=>()=>{},g_=e=>{const t=()=>{throw new Error(e)};return t.source=null,t.query=null,t};var II=class extends kp{get(e,t){if(t==="subscribe"||t==="on")return ty;if(t===na)return RI;const n=yc(t,"DefaultAssistantClient");return n!==!1?n:g_("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",na]}has(e,t){return t==="subscribe"||t==="on"||t===na}};const xc=new Proxy({},new II),RI=m_(xc),PI=()=>new Proxy({},{get(e,t){const n=yc(t,"AssistantClient");return n!==!1?n:g_(`The current scope does not have a "${String(t)}" property.`)}}),y_=m.createContext(xc),jI=()=>m.useContext(y_),Kr=({value:e,children:t})=>d.jsx(y_.Provider,{value:e,children:t}),Un=Se(e=>null),Ff=Symbol("assistant-ui.transform-scopes");function v_(e,t){const n=e;if(n[Ff])throw new Error("transformScopes is already attached to this resource");n[Ff]=t}function AI(e){return e[Ff]}const x_=e=>typeof e=="string"?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},w_=l_(null),NI=(e,t)=>u_(w_,e,t),b_=()=>{const e=c_(w_);if(!e)throw new Error("AssistantTapContext is not available");return e},__=()=>b_().clientRef,Cp=()=>{const{emit:e}=b_(),t=Sp();return _r((n,r)=>{e(n,r,t)})};function MI(e,t){const n={...e},r=new Set;let s=!0;for(;s;){s=!1;for(const a of Object.values(n)){if(a.type===Un||r.has(a.type))continue;r.add(a.type);const l=AI(a.type);if(l){l(n,t),s=!0;break}}}const i={},o={};for(const[a,l]of Object.entries(n))l.type===Un?o[a]=l:i[a]=l;return{rootClients:i,derivedClients:o}}const ny=e=>me(()=>e,[...Object.entries(e).flat()]),DI=(e,t)=>{const{rootClients:n,derivedClients:r}=MI(e,t);return{rootClients:ny(n),derivedClients:ny(r)}},LI=Se(()=>Ks(()=>{const e=new Map,t=new Set,n=new Set;return{on(r,s){const i=s;if(r==="*")return t.add(i),()=>t.delete(i);let o=e.get(r);return o||(o=new Set,e.set(r,o)),o.add(i),()=>{o.delete(i),o.size===0&&e.delete(r)}},emit(r,s,i){const o=e.get(r);!o&&t.size===0||queueMicrotask(()=>{const a=[];if(o)for(const l of o)try{l(s,i)}catch(u){a.push(u)}if(t.size>0){const l={event:r,payload:s};for(const u of t)try{u(l,i)}catch(c){a.push(c)}}if(a.length>0){if(a.length===1)throw a[0];for(const l of a)console.error(l);throw new AggregateError(a,"Errors occurred during event emission")}})},subscribe(r){return n.add(r),()=>n.delete(r)},notifySubscribers(){for(const r of n)try{r()}catch(s){console.error("NotificationManager: subscriber callback error",s)}}}})),OI=()=>null;function S_(e){const t=m.useMemo(()=>s_(a=>r(a)),[]),[n,r]=m.useReducer((a,l)=>(ea(t,a),a+(l()?1:0)),0);ea(t,n);const s=OI(),i=m.useMemo(()=>(e.key,Ra(e.type,t,void 0,s)),[e.type,e.key,t,s]),o=ys(i,e.props);return m.useLayoutEffect(()=>()=>Hi(i),[i]),m.useLayoutEffect(()=>{Eu(t),no(i,o)}),o.output}const k_=e=>me(()=>e,e),zI=Se(({element:e,emit:t,clientRef:n})=>{const{methods:r,state:s}=NI({clientRef:n,emit:t},()=>vc(e));return me(()=>({state:s,methods:r}),[r,s])}),FI=Se(({element:e,notifications:t,clientRef:n,name:r})=>{const s=hI(zI({element:e,emit:t.emit,clientRef:n}));return ct(()=>s.subscribe(t.notifySubscribers),[s,t]),me(()=>{const i=()=>s.getValue().methods;return Object.defineProperties(i,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),i},[s,r])}),BI=Se(()=>me(()=>({clients:[],subscribe:void 0,on:void 0}),[])),$I=Se(({clients:e,clientRef:t})=>{const n=bt(LI());ct(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);const r=k_(gc(()=>Object.keys(e).map(s=>Sr(s,FI({element:e[s],notifications:n,clientRef:t,name:s}))),[e,n,t]));return me(()=>({clients:r,subscribe:n.subscribe,on:function(s,i){if(!this)throw new Error("const { on } = useAui() is not supported. Use aui.on() instead.");const{scope:o,event:a}=x_(s);if(o!=="*"&&this[o].source===null)throw new Error(`Scope "${o}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);const l=n.on(a,(c,f)=>{if(o==="*"){i(c);return}const h=this[o]();h===f[bI(h)]&&i(c)});if(o!=="*"&&t.parent[o].source===null)return l;const u=t.parent.on(s,i);return()=>{l(),u()}}}),[r,n,t])}),UI=Se(({element:e,clientRef:t,name:n})=>{const r=br(e.props);return r.current=e.props,me(()=>{const s=()=>r.current.get(t.current);return Object.defineProperties(s,{source:{value:r.current.source},query:{value:r.current.query},name:{value:n,configurable:!0}}),s},[t,n])}),VI=(e,t)=>{let n;try{const r={};for(const s of Object.keys(t.query).sort())r[s]=t.query[s];n=JSON.stringify(r)}catch{n=String(t.query)}return`${e}::${t.source}::${n}`},HI=Se(({clients:e,clientRef:t})=>k_(gc(()=>Object.keys(e).map(n=>{const r=n,s=e[r];return Sr(VI(r,s.props),UI({element:s,clientRef:t,name:r}))}),[e,t]))),WI=Se(({parent:e,clients:t})=>{const{rootClients:n,derivedClients:r}=DI(t,e),s=br({parent:e,current:null}).current;ct(()=>{s.current=a});const i=bt(Object.keys(n).length>0?$I({clients:n,clientRef:s}):BI()),o=bt(HI({clients:r,clientRef:s})),a=me(()=>{const l=e===xc?PI():e,u=Object.create(l);Object.assign(u,{subscribe:i.subscribe??e.subscribe,on:i.on??e.on,[na]:m_(u)});for(const c of i.clients)u[c.name]=c;for(const c of o)u[c.name]=c;return u},[e,i,o]);return s.current===null&&(s.current=a),a});function pe(e,{parent:t}={parent:jI()}){if(e)return S_(WI({parent:t??xc,clients:e}));if(t===null)throw new Error("received null parent, this usage is not allowed");return t}const Y=e=>{const t=pe(),n=TI(t),r=m.useSyncExternalStore(t.subscribe,()=>e(n),()=>e(n));if(r===n)throw new Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return m.useDebugValue(r),r},qI=e=>{const t=pe(),n=m.useRef(!1),r=n.current?null:e(t);return Y(()=>n.current?e(t):r),()=>(n.current=!0,e(t))},KI=Object.freeze({});function go({getItemState:e,children:t}){return GI(t(qI(e)))}const GI=e=>{const t=typeof e=="object"&&e!=null&&"type"in e?e:null,n=t?.type,r=t?.key;return m.useMemo(()=>t,[n,r,typeof t?.props=="object"&&t.props!=null&&Object.entries(t.props).length===0?KI:t?.props])??e},YI=Zt.createContext(!0);function ry(){throw new Error("A function wrapped in useEffectEvent can't be called during rendering.")}const QI="use"in Zt?()=>{try{return Zt.use(YI)}catch{return!1}}:()=>!1;function XI(e){const t=Zt.useRef(ry);return Zt.useInsertionEffect(()=>{t.current=e},[e]),(...n)=>{QI()&&ry();const r=t.current;return r(...n)}}const Iu=(e,t)=>{const n=pe(),r=XI(t),{scope:s,event:i}=x_(e);m.useEffect(()=>n.on({scope:s,event:i},r),[n,s,i])},JI=h_(e=>{if(e.key===void 0)throw new Error("tapClientResource: Element has no key");return bt(p_(e))});function ro(e,t){const n=gc(()=>e().map(i=>JI(i)),t),r=me(()=>Object.keys(n),[n]),s=me(()=>n.reduce((i,o,a)=>(i[o.key]=a,i),{}),[n]);return{state:me(()=>n.map(i=>i.state),[n]),get:i=>{if("index"in i){if(i.index<0||i.index>=r.length)throw new Error(`tapClientLookup: Index ${i.index} out of bounds (length: ${r.length})`);return n[i.index].methods}const o=s[i.key];if(o===void 0)throw new Error(`tapClientLookup: Key "${i.key}" not found`);return n[o].methods}}}const C_=Se(({toolkit:e,mcpApp:t})=>{const n=gc(()=>t?[Sr("mcpApp",t)]:[],[t])[0],[r,s]=En(()=>({})),i=me(()=>({toolUIs:r,mcpApp:n,tools:Object.fromEntries(Object.entries(r).map(([l,u])=>[l,u.map(c=>c.render)]))}),[r,n]),o=__(),a=Ia((l,u,c)=>{const f={render:u,standalone:c?.standalone??!1};return s(h=>({...h,[l]:[...h[l]??[],f]})),()=>{s(h=>{const p=h[l]?.filter(b=>b!==f)??[];if(p.length>0)return{...h,[l]:p};const{[l]:g,...y}=h;return y})}},[]);return ct(()=>{if(!e)return;const l=[];for(const[c,f]of Object.entries(e)){const h="render"in f?f.render:void 0,p="renderText"in f?f.renderText:void 0,g=h??(p?wI(p):void 0);g&&l.push(a(c,g,{standalone:vI(f)}))}const u=Object.entries(e).reduce((c,[f,h])=>{if(h.type==="mcp")return c;const{display:p,render:g,renderText:y,...b}=h;return c[f]=b,c},{});return l.push(o.current.modelContext().register({getModelContext:()=>({tools:u})})),()=>{l.forEach(c=>c())}},[e,a,o]),{getState:()=>i,setToolUI:a}});v_(C_,(e,t)=>{!e.modelContext&&t.modelContext.source===null&&(e.modelContext=d_())});const ui=e=>{const[,t]=En(e.getState);return ct(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},E_=Se(({runtime:e})=>{const t=ui(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),ZI=Se(({runtime:e,index:t})=>bt(E_({runtime:me(()=>e.getAttachmentByIndex(t),[e,t])}))),T_=Se(({threadIdRef:e,messageIdRef:t,runtime:n})=>{const r=ui(n),s=Cp();ct(()=>{const a=[];for(const l of["send","attachmentAdd"]){const u=n.unstable_on(l,()=>{s(`composer.${l}`,{threadId:e.current,...t&&{messageId:t.current}})});a.push(u)}return a.push(n.unstable_on("attachmentAddError",l=>{s("composer.attachmentAddError",{threadId:e.current,...t&&{messageId:t.current},...l.attachmentId&&{attachmentId:l.attachmentId},reason:l.reason,message:l.message})})),()=>{for(const l of a)l()}},[n,s,e,t]);const i=ro(()=>r.attachments.map((a,l)=>Sr(a.id,ZI({runtime:n,index:l}))),[r.attachments,n]),o=me(()=>({text:r.text,role:r.role,attachments:i.state,runConfig:r.runConfig,isEditing:r.isEditing,canCancel:r.canCancel,canSend:r.canSend,attachmentAccept:r.attachmentAccept,isEmpty:r.isEmpty,type:r.type??"thread",dictation:r.dictation,quote:r.quote,queue:[]}),[r,i.state]);return{getState:()=>o,setText:n.setText,setRole:n.setRole,setRunConfig:n.setRunConfig,addAttachment:n.addAttachment,reset:n.reset,clearAttachments:n.clearAttachments,send:n.send,cancel:n.cancel,beginEdit:n.beginEdit??(()=>{throw new Error("beginEdit is not supported in this runtime")}),startDictation:n.startDictation,stopDictation:n.stopDictation,setQuote:n.setQuote,attachment:a=>"id"in a?i.get({key:a.id}):i.get(a),queueItem:()=>{throw new Error("Queue is not supported in this runtime")},__internal_getRuntime:()=>n}}),eR=Se(({runtime:e})=>{const t=ui(e);return{getState:()=>t,addToolResult:n=>e.addToolResult(n),resumeToolCall:n=>e.resumeToolCall(n),respondToToolApproval:n=>e.respondToToolApproval(n),__internal_getRuntime:()=>e}}),tR=Se(({runtime:e,index:t})=>bt(E_({runtime:me(()=>e.getAttachmentByIndex(t),[e,t])}))),nR=Se(({runtime:e,index:t})=>bt(eR({runtime:me(()=>e.getMessagePartByIndex(t),[e,t])}))),rR=Se(({runtime:e,threadIdRef:t})=>{const n=ui(e),[r,s]=En(!1),[i,o]=En(!1),a=me(()=>({get current(){return e.getState().id}}),[e]),l=vc(T_({runtime:e.composer,threadIdRef:t,messageIdRef:a})),u=ro(()=>n.content.map((h,p)=>Sr("toolCallId"in h&&h.toolCallId!=null?`toolCallId-${h.toolCallId}`:`index-${p}`,nR({runtime:e,index:p}))),[n.content,e]),c=ro(()=>(n.attachments??[]).map((h,p)=>Sr(h.id,tR({runtime:e,index:p}))),[n.attachments,e]),f=me(()=>({...n,parts:u.state,composer:l.state,isCopied:r,isHovering:i}),[n,u.state,l.state,r,i]);return{getState:()=>f,composer:()=>l.methods,reload:h=>e.reload(h),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:h=>e.submitFeedback(h),switchToBranch:h=>e.switchToBranch(h),getCopyText:()=>e.unstable_getCopyText(),part:h=>"index"in h?u.get({index:h.index}):u.get({key:`toolCallId-${h.toolCallId}`}),attachment:h=>"id"in h?c.get({key:h.id}):c.get(h),setIsCopied:s,setIsHovering:o,__internal_getRuntime:()=>e}}),sR=Se(({runtime:e,id:t,threadIdRef:n})=>bt(rR({runtime:me(()=>e.getMessageById(t),[e,t]),threadIdRef:n}))),iR=Se(({runtime:e})=>{const t=ui(e),n=Cp();ct(()=>{const a=[];for(const l of["runStart","runEnd","initialize","modelContextUpdate"]){const u=e.unstable_on(l,()=>{const c=e.getState()?.threadId||"unknown";n(`thread.${l}`,{threadId:c})});a.push(u)}return()=>{for(const l of a)l()}},[e,n]);const r=me(()=>({get current(){return e.getState().threadId}}),[e]),s=vc(T_({runtime:e.composer,threadIdRef:r})),i=ro(()=>t.messages.map(a=>Sr(a.id,sR({runtime:e,id:a.id,threadIdRef:r}))),[t.messages,e,r]),o=me(()=>({isEmpty:i.state.length===0&&!t.isLoading,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:t.isRunning,capabilities:t.capabilities,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,voice:t.voice,composer:s.state,messages:i.state}),[t,i,s.state]);return{getState:()=>o,composer:()=>s.methods,append:e.append,startRun:e.startRun,resumeRun:e.resumeRun,cancelRun:e.cancelRun,getModelContext:e.getModelContext,export:e.export,import:e.import,reset:e.reset,stopSpeaking:e.stopSpeaking,connectVoice:e.connectVoice,disconnectVoice:e.disconnectVoice,getVoiceVolume:e.getVoiceVolume,subscribeVoiceVolume:e.subscribeVoiceVolume,muteVoice:e.muteVoice,unmuteVoice:e.unmuteVoice,message:a=>"id"in a?i.get({key:a.id}):i.get(a),__internal_getRuntime:()=>e}}),oR=Se(({runtime:e})=>{const t=ui(e),n=Cp();return ct(()=>{const r=[];for(const s of["switchedTo","switchedAway"]){const i=e.unstable_on(s,()=>{n(`threadListItem.${s}`,{threadId:e.getState().id})});r.push(i)}return()=>{for(const s of r)s()}},[e,n]),{getState:()=>t,switchTo:e.switchTo,rename:e.rename,updateCustom:e.updateCustom,archive:e.archive,unarchive:e.unarchive,delete:e.delete,generateTitle:e.generateTitle,initialize:e.initialize,detach:e.detach,__internal_getRuntime:()=>e}}),aR=Se(({runtime:e,id:t})=>bt(oR({runtime:me(()=>e.getItemById(t),[e,t])}))),lR=Se(({runtime:e,__internal_assistantRuntime:t})=>{const n=ui(e),r=vc(iR({runtime:e.main})),s=ro(()=>Object.keys(n.threadItems).map(o=>Sr(o,aR({runtime:e,id:o}))),[n.threadItems,e]),i=me(()=>({mainThreadId:n.mainThreadId,newThreadId:n.newThreadId??null,isLoading:n.isLoading,isLoadingMore:n.isLoadingMore,hasMore:n.hasMore,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadItems:s.state,main:r.state}),[n,s.state,r.state]);return{getState:()=>i,thread:()=>r.methods,item:o=>{if(o==="main")return s.get({key:i.mainThreadId});if("id"in o)return s.get({key:o.id});const{index:a,archived:l=!1}=o,u=l?i.archivedThreadIds[a]:i.threadIds[a];return s.get({key:u})},switchToThread:async(o,a)=>{await e.switchToThread(o,a)},switchToNewThread:async()=>{await e.switchToNewThread()},getLoadThreadsPromise:()=>e.getLoadThreadsPromise(),reload:()=>e.reload(),loadMore:()=>e.loadMore(),__internal_getAssistantRuntime:()=>t}}),uR=Se(e=>({getState:()=>e})),cR=Se(e=>{const[t]=En(()=>({suggestions:(e??[]).map(r=>typeof r=="string"?{title:r,label:"",prompt:r}:{title:r.title,label:r.label,prompt:r.prompt})})),n=ro(()=>t.suggestions.map((r,s)=>Sr(s,uR(r))),[t.suggestions]);return{getState:()=>t,suggestion:({index:r})=>n.get({index:r})}}),dR=Se(e=>{const t=__();return ct(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),bt(lR({runtime:e.threads,__internal_assistantRuntime:e}))}),fR=(e,t)=>{e.thread??(e.thread=Un({source:"threads",query:{type:"main"},get:n=>n.threads().thread("main")})),e.threadListItem??(e.threadListItem=Un({source:"threads",query:{type:"main"},get:n=>n.threads().item("main")})),e.composer??(e.composer=Un({source:"thread",query:{},get:n=>n.threads().thread("main").composer()})),!e.modelContext&&t.modelContext.source===null&&(e.modelContext=d_()),!e.suggestions&&t.suggestions.source===null&&(e.suggestions=cR())},I_=Se(e=>bt(dR(e)));v_(I_,(e,t)=>{fR(e,t),!e.tools&&t.tools.source===null&&(e.tools=C_({})),!e.dataRenderers&&t.dataRenderers.source===null&&(e.dataRenderers=pI())});const hR=e=>e._core?.RenderComponent,pR=m.memo(({runtime:e,aui:t=null,children:n})=>{const r=pe({threads:I_(e)},{parent:t}),s=hR(e);return d.jsxs(Kr,{value:r,children:[s&&d.jsx(s,{}),n]})}),sy=e=>{let t;const n=new Set,r=(u,c)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,h))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,s,a);return a},mR=e=>e?sy(e):sy,gR=e=>e;function yR(e,t=gR){const n=Zt.useSyncExternalStore(e.subscribe,Zt.useCallback(()=>t(e.getState()),[e,t]),Zt.useCallback(()=>t(e.getInitialState()),[e,t]));return Zt.useDebugValue(n),n}const iy=e=>{const t=mR(e),n=r=>yR(t,r);return Object.assign(n,t),n},R_=e=>e?iy(e):iy,Ep=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});if(!e||!t)throw new Error("Failed to create promise");return{promise:n,resolve:e,reject:t}},vR=()=>{const e=[];let t=!1,n,r;const s=i=>{i.promise||(i.promise=i.reader.read().then(({done:o,value:a})=>{i.promise=void 0,o?(e.splice(e.indexOf(i),1),t&&e.length===0&&n.close()):n.enqueue(a),r?.resolve(),r=void 0}).catch(o=>{console.error(o),e.forEach(a=>{a.reader.cancel()}),e.length=0,n.error(o),r?.reject(o),r=void 0}))};return{readable:new ReadableStream({start(i){n=i},pull(){return r=Ep(),e.forEach(i=>{s(i)}),r.promise},cancel(){e.forEach(i=>{i.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&n.close()},addStream(i){if(t)throw new Error("Cannot add streams after the run callback has settled.");const o={reader:i.getReader()};e.push(o),s(o)},enqueue(i){this.addStream(new ReadableStream({start(o){o.enqueue(i),o.close()}}))}}};var oy=class{constructor(e){N(this,"_controller");N(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}};const P_=e=>new ReadableStream({start(t){return e.start?.(new oy(t))},pull(t){return e.pull?.(new oy(t))},cancel(t){return e.cancel?.(t)}}),ay=()=>{let e;return[P_({start(t){e=t}}),e]};var ly=class{constructor(e){N(this,"_controller");N(this,"_isClosed",!1);N(this,"_mergeTask");N(this,"_argsTextController");this._controller=e;const t=P_({start:r=>{this._argsTextController=r}});let n=!1;this._mergeTask=t.pipeTo(new WritableStream({write:r=>{switch(r.type){case"text-delta":n=!0,this._controller.enqueue(r);break;case"part-finish":n||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${r.type}`)}}}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1,...e.modelContent!==void 0?{modelContent:e.modelContent}:{},...e.messages!==void 0?{messages:e.messages}:{}})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}};const xR=e=>new ReadableStream({start(t){return e.start?.(new ly(t))},pull(t){return e.pull?.(new ly(t))},cancel(t){return e.cancel?.(t)}}),wR=()=>{let e;return[xR({start(t){e=t}}),e]};var j_=class{constructor(){N(this,"value",-1)}up(){return++this.value}},bR=class extends TransformStream{constructor(e){super({transform(t,n){n.enqueue({...t,path:[e,...t.path]})}})}};(class extends TransformStream{constructor(e){super({transform(t,n){const{path:[r,...s]}=t;if(e!==r)throw new Error(`Path mismatch: expected ${e}, got ${r}`);n.enqueue({...t,path:s})}})}});var _R=class extends TransformStream{constructor(e){const t=new j_,n=new Map;super({transform(r,s){r.type==="part-start"&&r.path.length===0&&n.set(t.up(),e.up());const[i,...o]=r.path;if(i===void 0){s.enqueue(r);return}const a=n.get(i);if(a===void 0)throw new Error("Path not found");s.enqueue({...r,path:[a,...o]})}})}},SR=class extends TransformStream{constructor(e){super();const t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},A_=class extends TransformStream{constructor(){const e=[];super({transform(t,n){if(t.type==="part-start"){if(t.path.length!==0){n.error(new Error("Nested parts are not supported"));return}e.push(t.part),n.enqueue(t);return}if(t.type==="text-delta"||t.type==="result"||t.type==="part-finish"||t.type==="tool-call-args-text-finish"){if(t.path.length!==1){n.error(new Error(`${t.type} chunks must have a path of length 1`));return}const r=t.path[0];if(r<0||r>=e.length){n.error(new Error(`Invalid path index: ${r}`));return}const s=e[r];n.enqueue({...t,meta:s});return}n.enqueue(t)}})}};let N_=(e,t=21)=>(n=t)=>{let r="",s=n|0;for(;s--;)r+=e[Math.random()*e.length|0];return r};const kR=N_("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var CR=class M_{constructor(t){N(this,"_state");N(this,"_parentId");this._state=t||{merger:vR(),contentCounter:new j_}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(t){this._state.closeSubscriber=t}_addPart(t,n){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:t,path:[]}),this._state.merger.addStream(n.pipeThrough(new bR(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new _R(this._state.contentCounter)))}appendText(t){(this._state.append?.kind!=="text"||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:"text",parentId:this._parentId,controller:this.addTextPart()}),this._state.append.controller.append(t)}appendReasoning(t){(this._state.append?.kind!=="reasoning"||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:"reasoning",parentId:this._parentId,controller:this.addReasoningPart()}),this._state.append.controller.append(t)}addTextPart(){const[t,n]=ay();return this._addPart(this._withParentIdOption({type:"text"}),t),n}addReasoningPart(){const[t,n]=ay();return this._addPart(this._withParentIdOption({type:"reasoning"}),t),n}addToolCallPart(t){const n=typeof t=="string"?{toolName:t}:t,r=n.toolName,s=n.toolCallId??kR(),[i,o]=wR();return this._addPart({type:"tool-call",toolName:r,toolCallId:s,...this._parentId&&{parentId:this._parentId}},i),n.argsText!==void 0&&(o.argsText.append(n.argsText),o.argsText.close()),n.args!==void 0&&(o.argsText.append(JSON.stringify(n.args)),o.argsText.close()),n.response!==void 0&&o.setResponse(n.response),o}_finishedPartStream(){return new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}})}_withParentIdOption(t){return this._parentId?{...t,parentId:this._parentId}:t}appendSource(t){this._addPart(this._withParentIdOption(t),this._finishedPartStream())}appendFile(t){this._addPart(this._withParentIdOption(t),this._finishedPartStream())}appendData(t){this._addPart(this._withParentIdOption(t),this._finishedPartStream())}enqueue(t){this._state.merger.enqueue(t),t.type==="part-start"&&t.path.length===0&&this._state.contentCounter.up()}withParentId(t){const n=new M_(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function ER(e){const t=new CR;return(async()=>{try{await e(t)}catch(r){throw t.__internal_isClosed||t.enqueue({type:"error",path:[],error:String(r)}),r}finally{t.__internal_isClosed||t.close()}})(),t.__internal_getReadable()}function TR(){const{resolve:e,promise:t}=Ep();let n;return[ER(r=>(n=r,n.__internal_subscribeToClose(e),t)),n]}function IR(e){const t=["ROOT"];let n=-1,r=null;const s=[];let i;function o(){i!==void 0&&(s.push(JSON.parse(`"${i}"`)),i=void 0)}function a(f,h,p){switch(f){case'"':n=h,t.pop(),t.push(p),t.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":n=h,r=h,t.pop(),t.push(p),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(p),t.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=h,t.pop(),t.push(p),t.push("INSIDE_NUMBER"),o();break;case"{":n=h,t.pop(),t.push(p),t.push("INSIDE_OBJECT_START"),o();break;case"[":n=h,t.pop(),t.push(p),t.push("INSIDE_ARRAY_START"),o();break}}function l(f,h){switch(f){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=h,t.pop(),i=s.pop();break}}function u(f,h){switch(f){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),i=(Number(i)+1).toString();break;case"]":n=h,t.pop(),i=s.pop();break}}for(let f=0;f<e.length;f++){const h=e[f];switch(t[t.length-1]){case"ROOT":a(h,f,"FINISH");break;case"INSIDE_OBJECT_START":switch(h){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),i="";break;case"}":n=f,t.pop(),i=s.pop();break}break;case"INSIDE_OBJECT_AFTER_COMMA":switch(h){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),i="";break}break;case"INSIDE_OBJECT_KEY":switch(h){case'"':t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":t.push("INSIDE_STRING_ESCAPE"),i+=h;break;default:i+=h;break}break;case"INSIDE_OBJECT_AFTER_KEY":switch(h){case":":t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}break;case"INSIDE_OBJECT_BEFORE_VALUE":a(h,f,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(h,f);break;case"INSIDE_STRING":switch(h){case'"':t.pop(),n=f,i=s.pop();break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=f}break;case"INSIDE_ARRAY_START":switch(h){case"]":n=f,t.pop(),i=s.pop();break;default:n=f,i="0",a(h,f,"INSIDE_ARRAY_AFTER_VALUE");break}break;case"INSIDE_ARRAY_AFTER_VALUE":switch(h){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),i=(Number(i)+1).toString();break;case"]":n=f,t.pop(),i=s.pop();break;default:n=f;break}break;case"INSIDE_ARRAY_AFTER_COMMA":a(h,f,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),t[t.length-1]==="INSIDE_STRING"?n=f:t[t.length-1]==="INSIDE_OBJECT_KEY"&&(i+=h);break;case"INSIDE_NUMBER":switch(h){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=f;break;case"e":case"E":case"-":case".":break;case",":t.pop(),i=s.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,f);break;case"}":t.pop(),i=s.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,f);break;case"]":t.pop(),i=s.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f);break;default:t.pop(),i=s.pop();break}break;case"INSIDE_LITERAL":{const p=e.substring(r,f+1);!"false".startsWith(p)&&!"true".startsWith(p)&&!"null".startsWith(p)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(h,f):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f)):n=f;break}}}let c=e.slice(0,n+1);for(let f=t.length-1;f>=0;f--)switch(t[f]){case"INSIDE_STRING":c+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":c+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":c+="]";break;case"INSIDE_LITERAL":{const h=e.substring(r,e.length);"true".startsWith(h)?c+="true".slice(h.length):"false".startsWith(h)?c+="false".slice(h.length):"null".startsWith(h)&&(c+="null".slice(h.length))}}return[c,s]}var yo={exports:{}};const RR=typeof Buffer<"u",uy=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,cy=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function D_(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),RR&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));const r=JSON.parse(e,t);if(r===null||typeof r!="object")return r;const s=n&&n.protoAction||"error",i=n&&n.constructorAction||"error";if(s==="ignore"&&i==="ignore")return r;if(s!=="ignore"&&i!=="ignore"){if(uy.test(e)===!1&&cy.test(e)===!1)return r}else if(s!=="ignore"&&i==="ignore"){if(uy.test(e)===!1)return r}else if(cy.test(e)===!1)return r;return L_(r,{protoAction:s,constructorAction:i,safe:n&&n.safe})}function L_(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let s=[e];for(;s.length;){const i=s;s=[];for(const o of i){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"__proto__")){if(r===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.__proto__}if(n!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"constructor")&&o.constructor!==null&&typeof o.constructor=="object"&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype")){if(r===!0)return null;if(n==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.constructor}for(const a in o){const l=o[a];l&&typeof l=="object"&&s.push(l)}}}return e}function Tp(e,t,n){const{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return D_(e,t,n)}finally{Error.stackTraceLimit=r}}function PR(e,t){const{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return D_(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}yo.exports=Tp;yo.exports.default=Tp;yo.exports.parse=Tp;yo.exports.safeParse=PR;yo.exports.scan=L_;var jR=yo.exports;const Bf=Va(jR),Kl=Symbol("aui.parse-partial-json-object.meta"),AR=e=>e?.[Kl],$f=e=>{if(e.length===0)return{[Kl]:{state:"partial",partialPath:[]}};try{const t=Bf.parse(e);if(typeof t!="object"||t===null)throw new Error("argsText is expected to be an object");return t[Kl]={state:"complete",partialPath:[]},t}catch{try{const[t,n]=IR(e),r=Bf.parse(t);if(typeof r!="object"||r===null)throw new Error("argsText is expected to be an object");return r[Kl]={state:"partial",partialPath:n},r}catch{return}}},O_=(e,t,n)=>{if(typeof e!="object"||e===null)return t.state;if(t.state==="complete")return"complete";if(n.length===0)return t.state;const[r,...s]=n;if(!Object.hasOwn(e,r))return"partial";const[i,...o]=t.partialPath;if(r!==i)return"complete";const a=e[r];return O_(a,{state:"partial",partialPath:o},s)},so=(e,t)=>{const n=AR(e);if(!n)throw new Error("unable to determine object state");return O_(e,n,t.map(String))};async function*NR(){const e=this.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{e.releaseLock()}}function cd(e){var t;return e[t=Symbol.asyncIterator]??(e[t]=NR),e}const dy=Symbol.for("aui.tool-response");var zr=class Uf{constructor(t){N(this,"artifact");N(this,"result");N(this,"isError");N(this,"modelContent");N(this,"messages");t.artifact!==void 0&&(this.artifact=t.artifact),this.result=t.result,this.isError=t.isError??!1,t.modelContent!==void 0&&(this.modelContent=t.modelContent),t.messages!==void 0&&(this.messages=t.messages)}get[dy](){return!0}static[Symbol.hasInstance](t){return typeof t=="object"&&t!==null&&dy in t}static toResponse(t){return t instanceof Uf?t:new Uf({result:t===void 0?"<no result>":t})}};function MR(e,t,n){try{const r=e();if(typeof r=="object"&&r!==null&&"then"in r)return r.then(t,n);t(r)}catch(r){n(r)}}function io(e,t){let n=e;for(const r of t){if(n==null)return;n=n[r]}return n}var DR=class{constructor(e,t,n){N(this,"resolve");N(this,"reject");N(this,"disposed",!1);N(this,"fieldPath");this.resolve=e,this.reject=t,this.fieldPath=n}update(e){if(!this.disposed)try{if(so(e,this.fieldPath)==="complete"){const t=io(e,this.fieldPath);t!==void 0&&(this.resolve(t),this.dispose())}}catch(t){this.reject(t),this.dispose()}}end(e){if(!this.disposed)try{const t=io(e,this.fieldPath);this.resolve(t)}catch(t){this.reject(t)}finally{this.dispose()}}dispose(){this.disposed=!0}},LR=class{constructor(e,t){N(this,"controller");N(this,"disposed",!1);N(this,"fieldPath");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=io(e,this.fieldPath);t!==void 0&&this.controller.enqueue(t),so(e,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(t){this.controller.error(t),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},OR=class{constructor(e,t){N(this,"controller");N(this,"disposed",!1);N(this,"fieldPath");N(this,"lastValue");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=io(e,this.fieldPath);if(t!==void 0&&typeof t=="string"){const n=t.substring(this.lastValue?.length||0);this.lastValue=t,this.controller.enqueue(n)}so(e,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(t){this.controller.error(t),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},zR=class{constructor(e,t){N(this,"controller");N(this,"disposed",!1);N(this,"fieldPath");N(this,"processedIndexes",new Set);this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=io(e,this.fieldPath);if(!Array.isArray(t))return;for(let n=0;n<t.length;n++)this.processedIndexes.has(n)||so(e,[...this.fieldPath,n])==="complete"&&(this.controller.enqueue(t[n]),this.processedIndexes.add(n));so(e,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(t){this.controller.error(t),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},FR=class{constructor(e){N(this,"argTextDeltas");N(this,"handles",new Set);N(this,"args",$f(""));N(this,"finished",!1);this.argTextDeltas=e,this.processStream()}async processStream(){try{let e="";const t=this.argTextDeltas.getReader();for(;;){const{value:n,done:r}=await t.read();if(r)break;e+=n;const s=$f(e);if(s!==void 0){this.args=s;for(const i of this.handles)i.update(s)}}}catch(e){console.error("Error processing argument stream:",e)}finally{this.finished=!0;for(const e of this.handles)e.end(this.args);this.handles.clear()}}get(...e){return new Promise((t,n)=>{const r=new DR(t,n,e);if(this.args&&so(this.args,e)==="complete"){const s=io(this.args,e);if(s!==void 0){t(s);return}}if(this.finished){r.end(this.args);return}this.handles.add(r),r.update(this.args)})}streamValues(...e){const t=e;let n;return cd(new ReadableStream({start:r=>{n=new LR(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}streamText(...e){const t=e;let n;return cd(new ReadableStream({start:r=>{n=new OR(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}forEach(...e){const t=e;let n;return cd(new ReadableStream({start:r=>{n=new zR(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}},BR=class{constructor(e){N(this,"promise");this.promise=e}get(){return this.promise}},$R=class{constructor(){N(this,"args");N(this,"response");N(this,"writable");N(this,"resolve");N(this,"argsText","");N(this,"result",{get:async()=>(await this.response.get()).result});const e=new TransformStream;this.writable=e.writable,this.args=new FR(e.readable);const{promise:t,resolve:n}=Ep();this.resolve=n,this.response=new BR(t)}async appendArgsTextDelta(e){const t=this.writable.getWriter();try{await t.write(e)}catch(n){console.warn(n)}finally{t.releaseLock()}this.argsText+=e}async finishArgsText(){const e=this.writable.getWriter();try{await e.close()}catch(t){console.warn(t)}finally{e.releaseLock()}}setResponse(e){this.resolve(e)}},UR=class extends SR{constructor(e){const t=new Map,n=new Map;super(r=>{const s=new TransformStream({async transform(i,o){switch((i.type!=="part-finish"||i.meta.type!=="tool-call")&&o.enqueue(i),i.type){case"part-start":if(i.part.type==="tool-call"){const a=new $R;n.set(i.part.toolCallId,a),e.streamCall({reader:a,toolCallId:i.part.toolCallId,toolName:i.part.toolName})}break;case"text-delta":if(i.meta.type==="tool-call"){const a=i.meta.toolCallId,l=n.get(a);if(!l)throw new Error("No controller found for tool call");await l.appendArgsTextDelta(i.textDelta)}break;case"result":{if(i.meta.type!=="tool-call")break;const{toolCallId:a}=i.meta,l=n.get(a);if(!l)throw new Error("No controller found for tool call");l.setResponse(new zr({result:i.result,artifact:i.artifact,isError:i.isError,modelContent:i.modelContent}));break}case"tool-call-args-text-finish":{if(i.meta.type!=="tool-call")break;const{toolCallId:a,toolName:l}=i.meta,u=n.get(a);if(!u)throw new Error("No controller found for tool call");await u.finishArgsText();let c=!1;const f=MR(()=>{let h;try{h=Bf.parse(u.argsText)}catch(g){throw new Error(`Function parameter parsing failed. ${JSON.stringify(g.message)}`)}const p=e.execute({toolCallId:a,toolName:l,args:h});return p!==void 0&&(c=!0,e.onExecutionStart?.(a,l)),p},h=>{if(c&&e.onExecutionEnd?.(a,l),h===void 0)return;const p=new zr({artifact:h.artifact,result:h.result,isError:h.isError,messages:h.messages,modelContent:h.modelContent});u.setResponse(p),o.enqueue({type:"result",path:i.path,...p})},h=>{c&&e.onExecutionEnd?.(a,l);const p=new zr({result:String(h),isError:!0});u.setResponse(p),o.enqueue({type:"result",path:i.path,...p})});f&&t.set(a,f);break}case"part-finish":{if(i.meta.type!=="tool-call")break;const{toolCallId:a}=i.meta,l=t.get(a);l?l.then(()=>{t.delete(a),n.delete(a),o.enqueue(i)}):o.enqueue(i)}}},async flush(){await Promise.all(t.values())}});return r.pipeThrough(new A_).pipeThrough(s)})}};const VR=e=>typeof e=="object"&&e!==null&&"~standard"in e&&e["~standard"].version===1;function HR(e,t,n,r){const s=e?.[n.toolName];return s?.execute?(async o=>{if(t.aborted)return new zr({result:"Tool execution was cancelled.",isError:!0});let a=o;if(VR(s.parameters)){let c=s.parameters["~standard"].validate(n.args);c instanceof Promise&&(c=await c),c.issues&&(a=s.experimental_onSchemaValidationError??(()=>{throw new Error(`Function parameter validation failed. ${JSON.stringify(c.issues)}`)}))}const l=new Promise(c=>{const f=()=>{queueMicrotask(()=>{queueMicrotask(()=>{c(new zr({result:"Tool execution was cancelled.",isError:!0}))})})};t.aborted?f():t.addEventListener("abort",f,{once:!0})}),u=(async()=>{const c=await a(n.args,{toolCallId:n.toolCallId,abortSignal:t,human:h=>r(n.toolCallId,h)}),f=zr.toResponse(c);if(s.toModelOutput&&!f.isError&&f.modelContent===void 0)try{const h=await s.toModelOutput({toolCallId:n.toolCallId,input:n.args,output:f.result});return new zr({result:f.result,artifact:f.artifact,isError:f.isError,messages:f.messages,modelContent:h})}catch(h){console.warn(`[assistant-stream] tool "${n.toolName}" toModelOutput threw; falling back to default projection.`,h)}return f})();return Promise.race([u,l])})(s.execute):void 0}function WR(e,t,n,r,s){e?.[r.toolName]?.streamCall?.(n,{toolCallId:r.toolCallId,abortSignal:t,human:i=>s(r.toolCallId,i)})}function qR(e,t,n,r){const s=typeof e=="function"?e:()=>e,i=typeof t=="function"?t:()=>t;return new UR({execute:o=>HR(s(),i(),o,n),streamCall:({reader:o,...a})=>WR(s(),i(),o,a,n),onExecutionStart:r?.onExecutionStart,onExecutionEnd:r?.onExecutionEnd})}const z_=({index:e,children:t})=>d.jsx(Kr,{value:pe({attachment:Un({source:"message",query:{type:"index",index:e},get:n=>n.message().attachment({index:e})})}),children:t}),F_=({index:e,children:t})=>d.jsx(Kr,{value:pe({attachment:Un({source:"composer",query:{type:"index",index:e},get:n=>n.composer().attachment({index:e})})}),children:t}),B_=({index:e,children:t})=>d.jsx(Kr,{value:pe({message:Un({source:"thread",query:{type:"index",index:e},get:n=>n.thread().message({index:e})}),composer:Un({source:"message",query:{},get:n=>n.thread().message({index:e}).composer()})}),children:t}),Ip=({index:e,children:t})=>d.jsx(Kr,{value:pe({part:Un({source:"message",query:{type:"index",index:e},get:n=>n.message().part({index:e})})}),children:t}),KR=Se(({text:e,isRunning:t})=>{const n=me(()=>({type:"text",text:e,status:t?{type:"running"}:{type:"complete"}}),[e,t]);return{getState:()=>n,addToolResult:()=>{throw new Error("Not supported")},resumeToolCall:()=>{throw new Error("Not supported")},respondToToolApproval:()=>{throw new Error("Not supported")}}}),Rp=({text:e,isRunning:t=!1,children:n})=>d.jsx(Kr,{value:pe({part:KR({text:e,isRunning:t})}),children:n}),GR=Object.freeze({type:"complete"}),YR=Se(({parts:e,getMessagePart:t})=>{const[n,r]=En(!0),s=me(()=>e[e.length-1]?.status??GR,[e]),i=me(()=>({parts:e,collapsed:n,status:s}),[e,n,s]);return{getState:()=>i,setCollapsed:r,part:t}}),QR=({startIndex:e,endIndex:t,children:n})=>{const r=Y(i=>i.message.parts).slice(e,t+1),s=pe();return d.jsx(Kr,{value:pe({chainOfThought:YR({parts:r,getMessagePart:({index:i})=>{if(i<0||i>=r.length)throw new Error(`ChainOfThought part index ${i} is out of bounds (0..${r.length-1})`);return s.message().part({index:e+i})}})}),children:n})},$_=({index:e,children:t})=>d.jsx(Kr,{value:pe({suggestion:Un({source:"suggestions",query:{index:e},get:n=>n.suggestions().suggestion({index:e})})}),children:t}),XR=({index:e,children:t})=>d.jsx(Kr,{value:pe({queueItem:Un({source:"composer",query:{index:e},get:n=>n.composer().queueItem({index:e})})}),children:t}),si=Symbol("innerMessage"),dd=Symbol("innerMessages"),JR=[],ZR=(e,t)=>{si in e||(e[si]=t)},eP=e=>{const t="messages"in e?e.messages:e,n=t[dd]||t[si];return n?Array.isArray(n)?n:(t[dd]=[n],t[dd]):JR},or=Symbol("skip-update");function tP(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0)return!1;for(const n of Object.keys(e)){const r=e[n],s=t[n];if(!Object.is(r,s))return!1}return!0}var nP=class{constructor(){N(this,"_subscribers",new Set)}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{const t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){const e=[];for(const t of this._subscribers)try{t()}catch(n){e.push(n)}if(e.length>0){if(e.length===1)throw e[0];for(const t of e)console.error(t);throw new AggregateError(e)}}},wc=class{constructor(){N(this,"_subscriptions",new Set);N(this,"_connection")}get isConnected(){return!!this._connection}notifySubscribers(e){for(const t of this._subscriptions)t(e)}_updateConnection(){if(this._subscriptions.size>0){if(this._connection)return;this._connection=this._connect()}else this._connection?.(),this._connection=void 0}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}},tr=class extends wc{constructor(t){super();N(this,"binding");N(this,"_previousState");N(this,"getState",()=>(this.isConnected||this._syncState(),this._previousState));this.binding=t;const n=t.getState();if(n===or)throw new Error("Entry not available in the store");this._previousState=n}get path(){return this.binding.path}_syncState(){const t=this.binding.getState();return t===or||tP(t,this._previousState)?!1:(this._previousState=t,!0)}_connect(){const t=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(t)}},Pp=class extends wc{constructor(t){super();N(this,"binding");N(this,"_previousStateDirty",!0);N(this,"_previousState");N(this,"getState",()=>{if(!this.isConnected||this._previousStateDirty){const t=this.binding.getState();t!==or&&(this._previousState=t),this._previousStateDirty=!1}if(this._previousState===void 0)throw new Error("Entry not available in the store");return this._previousState});this.binding=t}get path(){return this.binding.path}_connect(){const t=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(t)}},Ru=class extends wc{constructor(t){super();N(this,"binding");this.binding=t}get path(){return this.binding.path}getState(){return this.binding.getState()}outerSubscribe(t){return this.binding.subscribe(t)}_connect(){const t=()=>{this.notifySubscribers()};let n=this.binding.getState(),r=n?.subscribe(t);const s=()=>{const o=this.binding.getState();o!==n&&(n=o,r?.(),r=o?.subscribe(t),t())},i=this.outerSubscribe(s);return()=>{i?.(),r?.()}}},U_=class extends wc{constructor(t){super();N(this,"config");this.config=t}getState(){return this.config.binding.getState()}outerSubscribe(t){return this.config.binding.subscribe(t)}_connect(){const t=o=>{this.notifySubscribers(o)};let n=this.config.binding.getState(),r=n?.unstable_on(this.config.event,t);const s=()=>{const o=this.config.binding.getState();o!==n&&(n=o,r?.(),r=o?.unstable_on(this.config.event,t))},i=this.outerSubscribe(s);return()=>{i?.(),r?.()}}},V_=class{constructor(e){N(this,"_core");this._core=e,this.__internal_bindMethods()}get path(){return this._core.path}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}},H_=class extends V_{constructor(t,n){super(t);N(this,"_composerApi");this._composerApi=n}remove(){const t=this._composerApi.getState();if(!t)throw new Error("Composer is not available");return t.removeAttachment(this.getState().id)}},rP=class extends H_{get source(){return"thread-composer"}},sP=class extends H_{get source(){return"edit-composer"}},iP=class extends V_{get source(){return"message"}remove(){throw new Error("Message attachments cannot be removed")}};const W_=Object.freeze([]),q_=Object.freeze({}),oP=e=>Object.freeze({type:"thread",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??W_,text:e?.text??"",role:e?.role??"user",runConfig:e?.runConfig??q_,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,value:e?.text??""}),aP=e=>Object.freeze({type:"edit",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,text:e?.text??"",role:e?.role??"user",attachments:e?.attachments??W_,runConfig:e?.runConfig??q_,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,parentId:e?.parentId??null,sourceId:e?.sourceId??null,value:e?.text??""});var K_=class{constructor(e){N(this,"_core");N(this,"_eventSubscriptionSubjects",new Map);this._core=e}get path(){return this._core.path}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setText(e)}setRunConfig(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");return t.addAttachment(e)}reset(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");return e.reset()}clearAttachments(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");return e.clearAttachments()}send(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.send(e)}cancel(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.cancel()}setRole(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setRole(e)}startDictation(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.startDictation()}stopDictation(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.stopDictation()}setQuote(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new U_({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},lP=class extends K_{constructor(t){const n=new Pp({path:t.path,getState:()=>oP(t.getState()),subscribe:r=>t.subscribe(r)});super({path:t.path,getState:()=>t.getState(),subscribe:r=>n.subscribe(r)});N(this,"_getState");this._getState=n.getState.bind(n),this.__internal_bindMethods()}get path(){return this._core.path}get type(){return"thread"}getState(){return this._getState()}getAttachmentByIndex(t){return new rP(new tr({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:t},ref:`${this.path.ref}.attachments[${t}]`},getState:()=>{const n=this.getState().attachments[t];return n?{...n,source:"thread-composer"}:or},subscribe:n=>this._core.subscribe(n)}),this._core)}},uP=class extends K_{constructor(t,n){const r=new Pp({path:t.path,getState:()=>aP(t.getState()),subscribe:s=>t.subscribe(s)});super({path:t.path,getState:()=>t.getState(),subscribe:s=>r.subscribe(s)});N(this,"_beginEdit");N(this,"_getState");this._beginEdit=n,this._getState=r.getState.bind(r),this.__internal_bindMethods()}get path(){return this._core.path}get type(){return"edit"}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(t){return new sP(new tr({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:t},ref:`${this.path.ref}.attachments[${t}]`},getState:()=>{const n=this.getState().attachments[t];return n?{...n,source:"edit-composer"}:or},subscribe:n=>this._core.subscribe(n)}),this._core)}};const Pa=e=>e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
43
|
+
|
|
44
|
+
`);var fy=class{constructor(e,t,n){N(this,"contentBinding");N(this,"messageApi");N(this,"threadApi");this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}get path(){return this.contentBinding.path}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.respondToToolApproval=this.respondToToolApproval.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){const t=this.contentBinding.getState();if(!t)throw new Error("Message part is not available");if(t.type!=="tool-call")throw new Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw new Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw new Error("Thread API is not available");const n=this.messageApi.getState();if(!n)throw new Error("Message is not available");const r=t.toolName,s=t.toolCallId,i=zr.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:s,result:i.result,artifact:i.artifact,isError:i.isError})}resumeToolCall(e){const t=this.contentBinding.getState();if(!t)throw new Error("Message part is not available");if(t.type!=="tool-call")throw new Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw new Error("Thread API is not available");const n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}respondToToolApproval(e){const t=this.contentBinding.getState();if(!t)throw new Error("Message part is not available");if(t.type!=="tool-call")throw new Error("Tried to respond to tool approval on non-tool message part");if(!t.approval||t.approval.approved!==void 0)throw new Error("Tool call has no pending approval");if(!this.threadApi)throw new Error("Thread API is not available");this.threadApi.getState().respondToToolApproval({approvalId:t.approval.id,approved:e.approved,...e.reason!=null&&{reason:e.reason}})}subscribe(e){return this.contentBinding.subscribe(e)}};const bl=Object.freeze({type:"complete"}),cP=(e,t,n)=>{if(e.role!=="assistant")return bl;if(n.type==="tool-call")return n.result?bl:e.status;const r=t===Math.max(0,e.content.length-1);return e.status.type==="requires-action"?bl:r?e.status:bl},hy=(e,t)=>{const n=e.content[t];if(!n)return or;const r=cP(e,t,n);return Object.freeze({...n,[si]:n[si],status:r})};var dP=class{constructor(e,t){N(this,"_core");N(this,"_threadBinding");N(this,"composer");N(this,"_getEditComposerRuntimeCore",()=>this._threadBinding.getState().getEditComposer(this._core.getState().id));this._core=e,this._threadBinding=t,this.composer=new uP(new Ru({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:n=>this._threadBinding.subscribe(n)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}get path(){return this._core.path}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}getState(){return this._core.getState()}reload(e={}){const t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,r=t??n,{runConfig:s=r.runConfig}=e,i=this._core.getState();if(i.role!=="assistant")throw new Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:s})}speak(){const e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){const e=this._core.getState();if(this._threadBinding.getState().speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw new Error("Message is not being spoken")}submitFeedback({type:e}){const t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){const n=this._core.getState();if(t&&e)throw new Error("May not specify both branchId and position");if(!t&&!e)throw new Error("Must specify either branchId or position");const r=this._threadBinding.getState().getBranches(n.id);let s=t;if(e==="previous"?s=r[n.branchNumber-2]:e==="next"&&(s=r[n.branchNumber]),!s)throw new Error("Branch not found");this._threadBinding.getState().switchToBranch(s)}unstable_getCopyText(){return Pa(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw new Error("Message part index must be >= 0");return new fy(new tr({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>hy(this.getState(),e),subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new fy(new tr({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{const t=this._core.getState(),n=t.content.findIndex(r=>r.type==="tool-call"&&r.toolCallId===e);return n===-1?or:hy(t,n)},subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new iP(new tr({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{const t=this.getState().attachments?.[e];return t?{...t,source:"message"}:or},subscribe:t=>this._core.subscribe(t)}))}};const fP=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),hP=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),pP=(e,t)=>typeof t=="string"?{createdAt:new Date,parentId:e.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:t}],attachments:[],metadata:{custom:{}}}:{createdAt:t.createdAt??new Date,parentId:t.parentId??e.at(-1)?.id??null,sourceId:t.sourceId??null,role:t.role??"user",content:t.content,attachments:t.attachments??[],metadata:t.metadata??{custom:{}},runConfig:t.runConfig??{},startRun:t.startRun},mP=(e,t)=>{const n=e.messages.at(-1);return Object.freeze({threadId:t.id,metadata:t,capabilities:e.capabilities,isDisabled:e.isDisabled,isLoading:e.isLoading,isRunning:e.isRunning??(n?.role!=="assistant"?!1:n.status.type==="running"),messages:e.messages,state:e.state,suggestions:e.suggestions,extras:e.extras,speech:e.speech,voice:e.voice})};var G_=class{constructor(e,t){N(this,"_threadBinding");N(this,"composer");N(this,"_eventSubscriptionSubjects",new Map);const n=new tr({path:e.path,getState:()=>mP(e.getState(),t.getState()),subscribe:r=>{const s=e.subscribe(r),i=t.subscribe(r);return()=>{s(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:r=>e.outerSubscribe(r),subscribe:r=>e.subscribe(r)},this.composer=new lP(new Ru({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:r=>this._threadBinding.subscribe(r)})),this.__internal_bindMethods()}get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.connectVoice=this.connectVoice.bind(this),this.disconnectVoice=this.disconnectVoice.bind(this),this.muteVoice=this.muteVoice.bind(this),this.unmuteVoice=this.unmuteVoice.bind(this),this.getVoiceVolume=this.getVoiceVolume.bind(this),this.subscribeVoiceVolume=this.subscribeVoiceVolume.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getState=this.getState.bind(this)}getState(){return this._threadBinding.getStateState()}append(e){this._threadBinding.getState().append(pP(this._threadBinding.getState().messages,e))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}startRun(e){return this._threadBinding.getState().startRun(hP(e))}resumeRun(e){return this._threadBinding.getState().resumeRun(fP(e))}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}connectVoice(){this._threadBinding.getState().connectVoice()}disconnectVoice(){this._threadBinding.getState().disconnectVoice()}getVoiceVolume(){return this._threadBinding.getState().getVoiceVolume()}subscribeVoiceVolume(e){return this._threadBinding.getState().subscribeVoiceVolume(e)}muteVoice(){this._threadBinding.getState().muteVoice()}unmuteVoice(){this._threadBinding.getState().unmuteVoice()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw new Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{const t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new dP(new tr({path:e,getState:()=>{const{message:n,parentId:r,index:s}=t()??{},{messages:i,speech:o}=this._threadBinding.getState();if(!n||r===void 0||s===void 0)return or;const a=this._threadBinding.getState().getBranches(n.id);return{...n,[si]:n[si],index:s,isLast:i.at(-1)?.id===n.id,parentId:r,branchNumber:a.indexOf(n.id)+1,branchCount:a.length,speech:o?.messageId===n.id?o:void 0}},subscribe:n=>this._threadBinding.subscribe(n)}),this._threadBinding)}unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new U_({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}};const gP=m.createContext(null),yP=()=>m.useContext(gP);var _l=class{constructor(e,t){N(this,"_core");N(this,"_threadListBinding");this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}get path(){return this._core.path}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.updateCustom=this.updateCustom.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(e){const t=this._core.getState();return this._threadListBinding.switchToThread(t.id,e)}rename(e){const t=this._core.getState();return this._threadListBinding.rename(t.id,e)}updateCustom(e){const t=this._core.getState();if(!this._threadListBinding.updateCustom)throw new Error("Thread list runtime does not support updating custom metadata");return this._threadListBinding.updateCustom(t.id,e)}archive(){const e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){const e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){const e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){const e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){const e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{const s=this._core.getState(),i=s.isMain,o=s.id;n===i&&r===o||(n=i,r=o,!(e==="switchedTo"&&!i)&&(e==="switchedAway"&&i||t({})))})}subscribe(e){return this._core.subscribe(e)}detach(){const e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}};const py=Promise.resolve(),vP=e=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,isLoadingMore:e.isLoadingMore??!1,hasMore:e.hasMore??!1,threadItems:e.threadItems}),Sl=(e,t)=>{if(t===void 0)return or;const n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,custom:n.custom,isMain:n.id===e.mainThreadId}:or};var xP=class{constructor(e,t=G_){N(this,"_core");N(this,"_runtimeFactory");N(this,"_getState");N(this,"_mainThreadListItemRuntime");N(this,"main");this._core=e,this._runtimeFactory=t;const n=new Pp({path:{},getState:()=>vP(e),subscribe:r=>e.subscribe(r)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new _l(new tr({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>Sl(this._core,this._core.mainThreadId),subscribe:r=>this._core.subscribe(r)}),this._core),this.main=new t(new Ru({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:r=>e.subscribe(r)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getLoadThreadsPromise=this.getLoadThreadsPromise.bind(this),this.reload=this.reload.bind(this),this.loadMore=this.loadMore.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e,t){return this._core.switchToThread(e,t)}switchToNewThread(){return this._core.switchToNewThread()}getLoadThreadsPromise(){return this._core.getLoadThreadsPromise()}reload(){return this._core.reload?.()??py}loadMore(){return this._core.loadMore?.()??py}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new Ru({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:t=>this._core.subscribe(t)}),this.mainItem)}getItemByIndex(e){return new _l(new tr({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>Sl(this._core,this._core.threadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getArchivedItemByIndex(e){return new _l(new tr({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>Sl(this._core,this._core.archivedThreadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getItemById(e){return new _l(new tr({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>Sl(this._core,e),subscribe:t=>this._core.subscribe(t)}),this._core)}},Y_=class{constructor(e){N(this,"_core");N(this,"threads");N(this,"_thread");this._core=e,this.threads=new xP(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.registerModelContextProvider=this.registerModelContextProvider.bind(this)}get thread(){return this._thread}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}},Q_=class{constructor(){N(this,"_contextProvider",new _p)}registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}};const Ns=Object.freeze([]),Wi="DEFAULT_THREAD_ID",wP=Object.freeze([Wi]),bP=Object.freeze({id:Wi,remoteId:void 0,externalId:void 0,status:"regular"}),_P=Promise.resolve(),my=Object.freeze({[Wi]:bP});var SP=class{constructor(e={},t){N(this,"threadFactory");N(this,"_mainThreadId",Wi);N(this,"_threads",wP);N(this,"_archivedThreads",Ns);N(this,"_threadData",my);N(this,"adapter",{});N(this,"_mainThread");N(this,"_subscriptions",new Set);this.threadFactory=t,this.__internal_setAdapter(e,!0)}get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return _P}get mainThreadId(){return this._mainThreadId}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw new Error("Method not implemented.")}getItemById(e){return this._threadData[e]}__internal_setAdapter(e,t=!1){const n=this.adapter;this.adapter=e;const r=e.threadId??Wi,s=e.threads??Ns,i=e.archivedThreads??Ns,o=n.threadId??Wi,a=n.threads??Ns,l=n.archivedThreads??Ns;!t&&o===r&&a===s&&l===i||((a!==s||l!==i||o!==r)&&(this._threadData={...my,...Object.fromEntries(e.threads?.map(u=>[u.id,{...u,remoteId:u.remoteId,externalId:u.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(u=>[u.id,{...u,remoteId:u.remoteId,externalId:u.externalId,status:"archived"}])??[])}),a!==s&&(this._threads=this.adapter.threads?.map(u=>u.id)??Ns),l!==i&&(this._archivedThreads=this.adapter.archivedThreads?.map(u=>u.id)??Ns),(t||o!==r)&&(this._mainThreadId=r,this._mainThread=this.threadFactory()),this._threadData[this._mainThreadId]||(this._threadData={...this._threadData,[this._mainThreadId]:{id:this._mainThreadId,remoteId:void 0,externalId:void 0,status:"regular"}}),this._notifySubscribers())}async switchToThread(e,t){if(this._mainThreadId===e)return;const n=this.adapter.onSwitchToThread;if(!n)throw new Error("External store adapter does not support switching to thread");await n(e)}async switchToNewThread(){const e=this.adapter.onSwitchToNewThread;if(!e)throw new Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){const n=this.adapter.onRename;if(!n)throw new Error("External store adapter does not support renaming");await n(e,t)}async updateCustom(e,t){const n=this.adapter.onUpdateCustom;if(!n)throw new Error("External store adapter does not support updating custom metadata");await n(e,t)}async detach(){}async archive(e){const t=this.adapter.onArchive;if(!t)throw new Error("External store adapter does not support archiving");await t(e)}async unarchive(e){const t=this.adapter.onUnarchive;if(!t)throw new Error("External store adapter does not support unarchiving");await t(e)}async delete(e){const t=this.adapter.onDelete;if(!t)throw new Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw new Error("Method not implemented.")}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(const e of this._subscriptions)e()}};const Ss=N_("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),vo=Symbol("autoStatus"),kP=Object.freeze(Object.assign({type:"running"},{[vo]:!0})),CP=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[vo]:!0})),EP=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[vo]:!0})),TP=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[vo]:!0})),IP=e=>e[vo]===!0,Pu=(e,t,n,r,s)=>e&&s?Object.assign({type:"incomplete",reason:"error",error:s},{[vo]:!0}):e&&t?kP:n?TP:r?EP:CP,fd=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},ja=(e,t,n)=>{const{role:r,id:s,createdAt:i,attachments:o,status:a,metadata:l}=e,u={id:s??t,createdAt:i??new Date},c=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content,f=({image:h,...p})=>h.match(/^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,(.*)$/)?{...p,image:h}:/^(https:\/\/|blob:)/.test(h)?{...p,image:h}:(console.warn("Invalid image data format detected"),null);if(r!=="user"&&o?.length)throw new Error("attachments are only supported for user messages");if(r!=="assistant"&&a)throw new Error("status is only supported for assistant messages");if(r!=="assistant"&&l?.steps)throw new Error("metadata.steps is only supported for assistant messages");switch(r){case"assistant":return{...u,role:r,content:c.map(h=>{const p=h.type;switch(p){case"text":case"reasoning":return h.text.trim().length===0?null:h;case"file":case"source":return h;case"image":return f(h);case"data":return h;case"generative-ui":return h;case"tool-call":{const{parentId:g,messages:y,...b}=h,x={...b,toolCallId:h.toolCallId??`tool-${Ss()}`,...g!==void 0&&{parentId:g},...y!==void 0&&{messages:y}};return h.args?{...x,args:h.args,argsText:h.argsText??JSON.stringify(h.args)}:{...x,args:$f(h.argsText??"")??{},argsText:h.argsText??""}}default:{const g=fd(p,h.data);if(g)return g;throw new Error(`Unsupported assistant message part type: ${p}`)}}}).filter(h=>!!h),status:a??n,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback},...l?.isOptimistic&&{isOptimistic:!0}}};case"user":return{...u,role:r,content:c.map(h=>{const p=h.type;switch(p){case"text":case"image":case"audio":case"file":case"data":return h;default:{const g=fd(p,h.data);if(g)return g;throw new Error(`Unsupported user message part type: ${p}`)}}}),attachments:(o??[]).map(h=>({...h,content:h.content.map(p=>fd(p.type,p.data)??p)})),metadata:{custom:l?.custom??{}}};case"system":if(c.length!==1||c[0].type!=="text")throw new Error("System messages must have exactly one text message part.");return{...u,role:r,content:c,metadata:{custom:l?.custom??{}}};default:throw new Error(`Unknown message role: ${r}`)}},X_={fromArray:e=>{const t=e.map(n=>ja(n,Ss(),Pu(!1,!1,!1,!1,void 0)));return{messages:t.map((n,r)=>({parentId:r>0?t[r-1].id:null,message:n}))}},fromBranchableArray:(e,t)=>{const n=Pu(!1,!1,!1,!1,void 0);return{...t?.headId!==void 0?{headId:t.headId}:void 0,messages:e.map(({message:r,parentId:s})=>{if(!r.id)throw new Error("ExportedMessageRepository.fromBranchableArray: Each message must have an 'id' field set.");return{parentId:s,message:ja(r,r.id,n)}})}}},Gl=e=>e.next?Gl(e.next):"current"in e?e:null;var RP=class{constructor(e){N(this,"func");N(this,"_value",null);this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},jp=class{constructor(){N(this,"messages",new Map);N(this,"head",null);N(this,"root",{children:[],next:null});N(this,"_messages",new RP(()=>{const e=new Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e}))}updateLevels(e,t){e.level=t;for(const n of e.children){const r=this.messages.get(n);r&&this.updateLevels(r,t+1)}}performOp(e,t,n){const r=t.prev??this.root,s=e??this.root;if(!(n==="relink"&&r===s)){if(n!=="link"&&(r.children=r.children.filter(i=>i!==t.current.id),r.next===t)){const i=r.children.at(-1),o=i?this.messages.get(i):null;if(o===void 0)throw new Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");r.next=o}if(n!=="cut"){for(let o=e;o;o=o.prev)if(o.current.id===t.current.id)throw new Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");s.children=[...s.children,t.current.id],(Gl(t)===this.head||s.next===null)&&(s.next=t),t.prev=e;const i=e?e.level+1:0;this.updateLevels(t,i)}}}get headId(){return this.head?.current.id??null}getMessages(e){if(e===void 0||e===this.head?.current.id)return this._messages.value;const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");const n=new Array(t.level+1);for(let r=t;r;r=r.prev)n[r.level]=r.current;return n}addOrUpdateMessage(e,t){const n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(r===void 0)throw new Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(n){n.current=t,this.performOp(r,n,"relink"),this._messages.dirty();return}const s={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,s),this.performOp(r,s,"link"),this.head===r&&(this.head=s),this._messages.dirty()}getMessage(e){const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}deleteMessage(e,t){const n=this.messages.get(e);if(!n)throw new Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");const r=t===void 0?n.prev:t===null?null:this.messages.get(t);if(r===void 0)throw new Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(const s of n.children){const i=this.messages.get(s);if(!i)throw new Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,i,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=Gl(r??this.root)),this._messages.dirty()}getBranches(e){const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");const{children:n}=t.prev??this.root;return n}evictOffBranchOptimisticMessages(e,t){if(!e)return;const n=new Set;for(let s=t;s;s=s.prev)n.add(s.current.id);const r=[];for(let s=e;s&&!n.has(s.current.id);s=s.prev)s.current.metadata?.isOptimistic&&r.push(s.current.id);for(const s of r)this.messages.has(s)&&this.deleteMessage(s)}switchToBranch(e){const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");const n=this.head,r=t.prev??this.root;r.next=t,this.head=Gl(t),this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}resetHead(e){if(e===null){this.clear();return}const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");const n=this.head;if(t.children.length>0){const r=s=>{for(const i of s.children){const o=this.messages.get(i);o&&(r(o),this.messages.delete(i))}};r(t),t.children=[],t.next=null}this.head=t;for(let r=t;r;r=r.prev)r.prev?r.prev.next=r:this.root.next=r;this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){const e=[];for(const[,n]of this.messages)n.current.metadata?.isOptimistic||e.push({message:n.current,parentId:n.prev?.current.id??null});let t=this.head;for(;t?.current.metadata?.isOptimistic;)t=t.prev;return{headId:t?.current.id??null,messages:e}}import({headId:e,messages:t}){for(const{message:n,parentId:r}of t)this.addOrUpdateMessage(r,n);this.resetHead(e??t.at(-1)?.message.id??null)}};function gy(e,t){if(t==="*")return!0;const n=t.split(",").map(i=>i.trim().toLowerCase()),r=`.${e.name.split(".").pop().toLowerCase()}`,s=e.type.toLowerCase();for(const i of n){if(i.startsWith(".")&&i===r||i.includes("/")&&i===s)return!0;if(i.endsWith("/*")){const o=i.split("/")[0];if(s.startsWith(`${o}/`))return!0}}return!1}function PP(e,t){return e.length!==t.length?!1:e.every((n,r)=>n.id===t[r].id)}function jP(e){const t=Ss();return e.type==="image"?{id:t,type:"image",name:e.filename??"image",content:[e],status:{type:"complete"}}:e.type==="file"?{id:t,type:"document",name:e.filename??"document",contentType:e.mimeType,content:[e],status:{type:"complete"}}:e.type==="audio"?{id:t,type:"audio",name:`audio.${e.audio.format}`,contentType:`audio/${e.audio.format}`,content:[e],status:{type:"complete"}}:{id:t,type:"data",name:e.name,content:[e],status:{type:"complete"}}}function AP(e){const t=[];for(const n of e)n.type!=="text"&&t.push(jP(n));return t}const hd=e=>e.status.type==="complete";var J_=class extends nP{constructor(){super(...arguments);N(this,"isEditing",!0);N(this,"_attachments",[]);N(this,"_text","");N(this,"_role","user");N(this,"_runConfig",{});N(this,"_quote");N(this,"_dictation");N(this,"_dictationSession");N(this,"_dictationUnsubscribes",[]);N(this,"_dictationBaseText","");N(this,"_currentInterimText","");N(this,"_dictationSessionIdCounter",0);N(this,"_activeDictationSessionId");N(this,"_isCleaningDictation",!1);N(this,"_eventSubscribers",new Map)}get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}get attachments(){return this._attachments}setAttachments(t){this._attachments=t,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}get text(){return this._text}get role(){return this._role}get runConfig(){return this._runConfig}get quote(){return this._quote}setQuote(t){this._quote!==t&&(this._quote=t,this._notifySubscribers())}setText(t){if(this._text!==t){if(this._text=t,this._dictation){this._dictationBaseText=t,this._currentInterimText="";const{status:n,inputDisabled:r}=this._dictation;this._dictation=r?{status:n,inputDisabled:r}:{status:n}}this._notifySubscribers()}}setRole(t){this._role!==t&&(this._role=t,this._notifySubscribers())}setRunConfig(t){this._runConfig!==t&&(this._runConfig=t,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){const t=this.getAttachmentAdapter();if(t){const n=this._attachments.filter(r=>!hd(r));await Promise.all(n.map(r=>t.remove(r)))}}async reset(){if(this._attachments.length===0&&this._text===""&&this._role==="user"&&Object.keys(this._runConfig).length===0&&this._quote===void 0)return;this._role="user",this._runConfig={},this._quote=void 0;const t=this._onClearAttachments();this._emptyTextAndAttachments(),await t}async clearAttachments(){const t=this._onClearAttachments();this.setAttachments([]),await t}async send(t){if(!this.canSend)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());const n=this.getAttachmentAdapter(),r=this.attachments.length>0?Promise.all(this.attachments.map(async a=>{if(hd(a))return a;if(!n)throw new Error("Attachments are not supported");return await n.send(a)})):[],s=this.text,i=this._quote;this._quote=void 0,this._emptyTextAndAttachments();const o={createdAt:new Date,role:this.role,content:s?[{type:"text",text:s}]:[],attachments:await r,runConfig:this.runConfig,metadata:{custom:{...i?{quote:i}:{}}}};this.handleSend(o,t),this._notifyEventSubscribers("send",{})}cancel(){this.handleCancel()}async addAttachment(t){if(!(t instanceof File)){const i=this.getAttachmentAdapter();if(i&&!gy({name:t.name,type:t.contentType??""},i.accept)){const a=`File type ${t.contentType||"unknown"} is not accepted. Accepted types: ${i.accept}`,l=new Error(a);throw this._safeEmitAttachmentAddError("not-accepted",a,void 0,l),l}const o={id:t.id??Ss(),type:t.type??"document",name:t.name,contentType:t.contentType,content:t.content,status:{type:"complete"}};this._attachments=[...this._attachments,o],this._notifySubscribers(),this._notifyEventSubscribers("attachmentAdd",{});return}const n=i=>{const o=this._attachments.findIndex(a=>a.id===i.id);o!==-1?this._attachments=[...this._attachments.slice(0,o),i,...this._attachments.slice(o+1)]:this._attachments=[...this._attachments,i],this._notifySubscribers()},r=this.getAttachmentAdapter();if(!r){const i="Attachments are not supported",o=new Error(i);throw this._safeEmitAttachmentAddError("no-adapter",i,void 0,o),o}if(!gy({name:t.name,type:t.type},r.accept)){const i=`File type ${t.type||"unknown"} is not accepted. Accepted types: ${r.accept}`,o=new Error(i);throw this._safeEmitAttachmentAddError("not-accepted",i,void 0,o),o}let s;try{const i=r.add({file:t});if(Symbol.asyncIterator in i)for await(const o of i)s=o,n(o);else s=await i,n(s)}catch(i){throw s&&n({...s,status:{type:"incomplete",reason:"error"}}),this._safeEmitAttachmentAddError("adapter-error",i instanceof Error?i.message:String(i),s?.id,i instanceof Error?i:void 0),i}s?.status.type==="incomplete"&&s.status.reason==="error"?this._safeEmitAttachmentAddError("adapter-error","Attachment upload did not complete successfully.",s?.id):this._notifyEventSubscribers("attachmentAdd",{})}_safeEmitAttachmentAddError(t,n,r,s){try{this._notifyEventSubscribers("attachmentAddError",{reason:t,message:n,...r!==void 0&&{attachmentId:r},...s!==void 0&&{error:s}})}catch(i){console.error("[assistant-ui] attachmentAddError subscriber threw:",i)}}async removeAttachment(t){const n=this._attachments.findIndex(s=>s.id===t);if(n===-1)throw new Error("Attachment not found");const r=this._attachments[n];if(!hd(r)){const s=this.getAttachmentAdapter();if(!s)throw new Error("Attachments are not supported");await s.remove(r)}this._attachments=this._attachments.filter(s=>s.id!==t),this._notifySubscribers()}get dictation(){return this._dictation}_isActiveSession(t,n){return this._activeDictationSessionId===t&&this._dictationSession===n}startDictation(){const t=this.getDictationAdapter();if(!t)throw new Error("Dictation adapter not configured");if(this._dictationSession){for(const u of this._dictationUnsubscribes)u();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}const n=t.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";const r=t.listen();this._dictationSession=r;const s=++this._dictationSessionIdCounter;this._activeDictationSessionId=s,this._dictation={status:r.status,inputDisabled:n},this._notifySubscribers();const i=r.onSpeech(u=>{if(!this._isActiveSession(s,r))return;const c=u.isFinal!==!1,f=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&u.transcript?" ":"";if(c){if(this._dictationBaseText=this._dictationBaseText+f+u.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){const{transcript:h,...p}=this._dictation;this._dictation=p}this._notifySubscribers()}else this._currentInterimText=f+u.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:u.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);const o=r.onSpeechStart(()=>{this._isActiveSession(s,r)&&(this._dictation={status:{type:"running"},inputDisabled:n,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(o);const a=r.onSpeechEnd(()=>{this._cleanupDictation({sessionId:s})});this._dictationUnsubscribes.push(a);const l=setInterval(()=>{this._isActiveSession(s,r)&&r.status.type==="ended"&&this._cleanupDictation({sessionId:s})},100);this._dictationUnsubscribes.push(()=>clearInterval(l))}stopDictation(){if(!this._dictationSession)return;const t=this._dictationSession,n=this._activeDictationSessionId;t.stop().finally(()=>{this._cleanupDictation({sessionId:n})})}_cleanupDictation(t){if(!(t?.sessionId!==void 0&&t.sessionId!==this._activeDictationSessionId||this._isCleaningDictation)){this._isCleaningDictation=!0;try{for(const n of this._dictationUnsubscribes)n();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_notifyEventSubscribers(t,n){const r=this._eventSubscribers.get(t);if(r)for(const s of r)s(n)}unstable_on(t,n){const r=n;let s=this._eventSubscribers.get(t);return s||(s=new Set,this._eventSubscribers.set(t,s)),s.add(r),()=>{this._eventSubscribers.get(t)?.delete(r)}}},Z_=class extends J_{constructor(t){super();N(this,"runtime");N(this,"_canCancel",!1);this.runtime=t,this.connect()}get canCancel(){return this._canCancel}get canSend(){return!this.isEmpty&&!this.runtime.isSendDisabled}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}connect(){let t=this.runtime.isSendDisabled;return this.runtime.subscribe(()=>{let n=!1;this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,n=!0),t!==this.runtime.isSendDisabled&&(t=this.runtime.isSendDisabled,n=!0),n&&this._notifySubscribers()})}async handleSend(t,n){this.runtime.append({...t,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null,startRun:n?.startRun})}async handleCancel(){this.runtime.cancelRun()}},NP=class extends J_{constructor(t,n,{parentId:r,message:s}){super();N(this,"runtime");N(this,"endEditCallback");N(this,"_previousText");N(this,"_previousAttachments");N(this,"_nonTextPassthrough");N(this,"_parentId");N(this,"_sourceId");this.runtime=t,this.endEditCallback=n,this._parentId=r,this._sourceId=s.id,this._previousText=Pa(s),this.setText(this._previousText),this.setRole(s.role),s.role==="user"?(this._previousAttachments=[...s.attachments??[],...AP(s.content)],this._nonTextPassthrough=[]):(this._previousAttachments=s.attachments??[],this._nonTextPassthrough=s.content.filter(i=>i.type!=="text")),this.setAttachments(this._previousAttachments),this.setRunConfig({...t.composer.runConfig})}get canCancel(){return!0}get canSend(){return!this.isEmpty}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}get parentId(){return this._parentId}get sourceId(){return this._sourceId}async handleSend(t,n){const r=Pa(t),s=!PP(t.attachments??[],this._previousAttachments);if(r!==this._previousText||s||n?.startRun){const i=this._nonTextPassthrough.length>0?[...t.content,...this._nonTextPassthrough]:t.content;this.runtime.append({...t,content:i,parentId:this._parentId,sourceId:this._sourceId,startRun:n?.startRun})}this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}},MP=class{constructor(e){N(this,"_contextProvider");N(this,"_subscriptions",new Set);N(this,"_isInitialized",!1);N(this,"repository",new jp);N(this,"_voiceMessages",[]);N(this,"_voiceGeneration",0);N(this,"_cachedMergedMessages",null);N(this,"_cachedVoiceGeneration",-1);N(this,"_cachedMergedBase",null);N(this,"composer",new Z_(this));N(this,"_editComposers",new Map);N(this,"_stopSpeaking");N(this,"speech");N(this,"_voiceSession");N(this,"_voiceUnsubs",[]);N(this,"voice");N(this,"_voiceVolume",0);N(this,"_voiceVolumeSubscribers",new Set);N(this,"getVoiceVolume",()=>this._voiceVolume);N(this,"subscribeVoiceVolume",e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e)));N(this,"_currentAssistantMsg",null);N(this,"_eventSubscribers",new Map);this._contextProvider=e}_markVoiceMessagesDirty(){this._voiceGeneration++,this._cachedMergedMessages=null}_getBaseMessages(){return this.repository.getMessages()}get messages(){if(this._voiceMessages.length===0)return this._getBaseMessages();const e=this._getBaseMessages();return(this._cachedVoiceGeneration!==this._voiceGeneration||this._cachedMergedBase!==e)&&(this._cachedMergedMessages=[...e,...this._voiceMessages],this._cachedVoiceGeneration=this._voiceGeneration,this._cachedMergedBase=e),this._cachedMergedMessages}get state(){let e;for(const t of this.messages)t.role==="assistant"&&(e=t);return e?.metadata.unstable_state??null}getModelContext(){return this._contextProvider.getModelContext()}getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw new Error("Edit already in progress");this._editComposers.set(e,new NP(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{const t=this.repository.getMessages(),n=this._voiceMessages.findIndex(r=>r.id===e);return n!==-1?{parentId:n>0?this._voiceMessages[n-1].id:t.at(-1)?.id??null,message:this._voiceMessages[n],index:t.length+n}:void 0}}getBranches(e){return this._voiceMessages.some(t=>t.id===e)?[]:this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(const e of this._subscriptions)e()}_notifyEventSubscribers(e,t){const n=this._eventSubscribers.get(e);if(n)for(const r of n)r(t)}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){const n=this.adapters?.feedback;if(!n)throw new Error("Feedback adapter not configured");const{message:r,parentId:s}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),r.role==="assistant"){const i={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(s,i)}this._notifySubscribers()}speak(e){const t=this.adapters?.speech;if(!t)throw new Error("Speech adapter not configured");const{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();const r=t.speak(Pa(n)),s=r.subscribe(()=>{r.status.type==="ended"?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),s(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw new Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}connectVoice(){const e=this.adapters?.voice;if(!e)throw new Error("Voice adapter not configured");this.disconnectVoice();const t=e.connect({});this._voiceSession=t;const n=[];let r="listening";this.voice={status:t.status,isMuted:t.isMuted,mode:r},this._voiceVolume=0,this._notifySubscribers(),n.push(t.onStatusChange(s=>{s.type==="ended"?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0):this.voice={status:s,isMuted:t.isMuted,mode:r},this._notifySubscribers()})),n.push(t.onModeChange(s=>{r=s,this.voice&&(this.voice={...this.voice,mode:s},this._notifySubscribers())})),n.push(t.onVolumeChange(s=>{this._voiceVolume=s;for(const i of this._voiceVolumeSubscribers)i()})),n.push(t.onTranscript(s=>{this._handleVoiceTranscript(s)})),this._voiceUnsubs=n}_handleVoiceTranscript(e){if(this.ensureInitialized(),e.role==="user")this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&(this._voiceMessages.push({id:Ss(),role:"user",content:[{type:"text",text:e.text}],metadata:{custom:{}},createdAt:new Date,status:{type:"complete",reason:"unknown"},attachments:[]}),this._markVoiceMessagesDirty(),this._notifySubscribers());else{if(!this._currentAssistantMsg)this._currentAssistantMsg={id:Ss(),role:"assistant",content:[{type:"text",text:e.text}],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],custom:{}},status:{type:"running"},createdAt:new Date},this._voiceMessages.push(this._currentAssistantMsg);else{const t=this._voiceMessages.indexOf(this._currentAssistantMsg);if(t===-1)return;const n={...this._currentAssistantMsg,content:[{type:"text",text:e.text}],...e.isFinal?{status:{type:"complete",reason:"stop"}}:{}};this._voiceMessages[t]=n,this._currentAssistantMsg=n}e.isFinal&&(this._currentAssistantMsg=null),this._markVoiceMessagesDirty(),this._notifySubscribers()}}_finishVoiceAssistantMessage(){const e=this._voiceMessages.at(-1);if(e?.role==="assistant"&&e.status.type==="running"){const t=this._voiceMessages.length-1;this._voiceMessages[t]={...e,status:{type:"complete",reason:"stop"}},this._markVoiceMessagesDirty(),this._notifySubscribers()}}disconnectVoice(){this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null;for(const e of this._voiceUnsubs)e();this._voiceUnsubs=[],this._voiceSession?.disconnect(),this._voiceSession=void 0,this.voice=void 0,this._voiceVolume=0;for(const e of this._voiceVolumeSubscribers)e();this._voiceMessages=[],this._markVoiceMessagesDirty(),this._notifySubscribers()}muteVoice(){if(!this._voiceSession)throw new Error("No active voice session");this._voiceSession.mute(),this.voice={...this.voice,isMuted:!0},this._notifySubscribers()}unmuteVoice(){if(!this._voiceSession)throw new Error("No active voice session");this._voiceSession.unmute(),this.voice={...this.voice,isMuted:!1},this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize",{}))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(X_.fromArray(e??[]))}unstable_on(e,t){const n=t;if(e==="modelContextUpdate")return this._contextProvider.subscribe?.(()=>n({}))??(()=>{});let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(n),e==="initialize"&&this._isInitialized&&queueMicrotask(()=>{r.has(n)&&n({})}),()=>{this._eventSubscribers.get(e)?.delete(n)}}},yy=class{constructor(){N(this,"cache",new WeakMap)}convertMessages(e,t){return e.map((n,r)=>{const s=t(this.cache.get(n),n,r);return this.cache.set(n,s),s})}};function Vf(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function ju(e,t=0){return t>100?!1:e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?!Number.isNaN(e)&&Number.isFinite(e):Array.isArray(e)?e.every(n=>ju(n,t+1)):Vf(e)?Object.entries(e).every(([n,r])=>typeof n=="string"&&ju(r,t+1)):!1}const DP=100,Hf=(e,t,n)=>{if(e===t)return!0;if(n>DP||e==null||t==null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>Hf(i,t[o],n+1));if(Array.isArray(t)||!Vf(e)||!Vf(t))return!1;const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(i=>Object.hasOwn(t,i)&&Hf(e[i],t[i],n+1))},LP=(e,t)=>!ju(e)||!ju(t)?!1:Hf(e,t,0),kl=e=>{try{return JSON.parse(e),!0}catch{return!1}},vy=e=>{try{return JSON.parse(e)}catch{return}},xy=(e,t)=>{const n=vy(e),r=vy(t);return n===void 0||r===void 0?!1:LP(n,r)};var OP=class{constructor(e,t){N(this,"_getTools");N(this,"_callbacks");N(this,"_entries",new Map);N(this,"_skipExecuteStreamIds",new Set);N(this,"_humanInput",new Map);N(this,"_executing",new Set);N(this,"_settledResolvers",[]);N(this,"_statuses",new Map);N(this,"_ac",new AbortController);N(this,"_pendingRestore",!0);N(this,"_lastSnapshot",null);N(this,"_isRunning",!1);N(this,"_controller");N(this,"_pipelineDead",!1);N(this,"_pipelineRestartUsed",!1);this._getTools=e,this._callbacks=t,this._initPipeline()}_initPipeline(){const[e,t]=TR();this._controller=t;const n=qR(()=>this._getWrappedTools(),()=>this._ac.signal,(r,s)=>this._onHumanInput(r,s),{onExecutionStart:r=>this._onExecutionStart(r),onExecutionEnd:r=>this._onExecutionEnd(r)});e.pipeThrough(n).pipeThrough(new A_).pipeTo(new WritableStream({write:r=>{try{if(r.type!=="result")return;this._handleResultChunk(r)}catch(s){console.error("[ToolInvocationTracker] result chunk handling failed",s)}}})).catch(r=>{console.error("[ToolInvocationTracker] stream pipeline failed; will attempt single restart on next setState",r),this._pipelineDead=!0})}setState(e){try{if(this._pipelineDead){if(this._pipelineRestartUsed)return;this._pipelineRestartUsed=!0,this._pipelineDead=!1,this._demoteEntriesToRestored(),this._executing.clear(),this._ac=new AbortController,this._initPipeline()}if(this._lastSnapshot&&this._lastSnapshot.messages===e.messages&&this._lastSnapshot.isRunning===e.isRunning&&this._lastSnapshot.isLoading===e.isLoading)return;e.isLoading===!0&&(this._pendingRestore=!0);const t=this._isRunning;this._isRunning=e.isRunning;try{this._processMessages(e.messages)}catch(n){throw this._isRunning=t,n}this._lastSnapshot=e,this._pendingRestore=!1}catch(t){console.error("[ToolInvocationTracker] setState failed; snapshot dropped",t)}}reset(){try{this._pendingRestore=!0,this._entries.clear(),this._lastSnapshot=null,this.abort().finally(()=>{this._executing.clear()})}catch(e){console.error("[ToolInvocationTracker] reset failed",e)}}abort(){try{return this._humanInput.forEach(({reject:e})=>{try{e(new Error("Tool execution aborted"))}catch{}}),this._humanInput.clear(),this._ac.abort(),this._ac=new AbortController,this._executing.size===0?Promise.resolve():new Promise(e=>{this._settledResolvers.push(e)})}catch(e){return console.error("[ToolInvocationTracker] abort failed",e),Promise.resolve()}}resume(e,t){try{const n=this._humanInput.get(e);return n?(this._humanInput.delete(e),this._setStatus(e,{type:"executing"}),n.resolve(t),!0):!1}catch(n){return console.error("[ToolInvocationTracker] resume failed",n),!1}}getStatuses(){return this._statuses}_getWrappedTools(){const e=this._getTools();if(e)return Object.fromEntries(Object.entries(e).map(([t,n])=>{const r=n.execute;return r===void 0?[t,n]:[t,{...n,execute:(...[s,i])=>this._skipExecuteStreamIds.has(i.toolCallId)?new Promise(()=>{}):r(s,i)}]}))}_onHumanInput(e,t){return new Promise((n,r)=>{const s=this._humanInput.get(e);if(s)try{s.reject(new Error("Human input request was superseded by a new request"))}catch{}this._humanInput.set(e,{resolve:n,reject:r}),this._setStatus(e,{type:"interrupt",payload:{type:"human",payload:t}})})}_onExecutionStart(e){this._skipExecuteStreamIds.has(e)||(this._executing.add(e),this._setStatus(e,{type:"executing"}))}_onExecutionEnd(e){this._executing.delete(e)&&(this._deleteStatus(e),this._executing.size===0&&this._settledResolvers.splice(0).forEach(t=>{try{t()}catch{}}))}_handleResultChunk(e){const t=e.meta.toolCallId,n=this._entries.get(t);!n&&this._skipExecuteStreamIds.has(t)||n?.hasResult||this._invokeOnResult({type:"add-tool-result",toolCallId:t,toolName:e.meta.toolName,result:e.result,isError:e.isError,...e.artifact!==void 0&&{artifact:e.artifact},...e.modelContent!==void 0&&{modelContent:e.modelContent}})}_invokeOnResult(e){try{this._callbacks.onResult(e)}catch(t){console.error("[ToolInvocationTracker] onResult callback threw; result dropped",t)}}_invokeOnStatusesChange(){try{this._callbacks.onStatusesChange(this._statuses)}catch(e){console.error("[ToolInvocationTracker] onStatusesChange callback threw; status change not propagated",e)}}_setStatus(e,t){const n=new Map(this._statuses);n.set(e,t),this._statuses=n,this._invokeOnStatusesChange()}_deleteStatus(e){if(!this._statuses.has(e))return;const t=new Map(this._statuses);t.delete(e),this._statuses=t,this._invokeOnStatusesChange()}_hasExecutableTool(e){const t=this._getTools()?.[e];return t?.execute!==void 0||t?.streamCall!==void 0}_shouldCloseArgsStream({toolName:e,argsText:t,hasResult:n}){return n?!0:(this._hasExecutableTool(e)||!this._isRunning)&&kl(t)}_startActiveEntry(e,t,n){const r=this._controller.addToolCallPart({toolName:t,toolCallId:e});n&&this._skipExecuteStreamIds.add(e);const s={toolName:t,controller:r,argsText:"",hasResult:!1,argsComplete:!1};return this._entries.set(e,s),s}_demoteEntriesToRestored(){for(const[e,t]of this._entries)t.controller&&this._entries.set(e,{toolName:t.toolName,argsText:t.argsText,hasResult:t.hasResult})}_processArgsText(e,t){if(!e.controller)return;const n=t.result!==void 0;if(t.argsText!==e.argsText){let r=!0;if(e.argsComplete)xy(e.argsText,t.argsText)&&(e.argsText=t.argsText),r=!1;else if(!t.argsText.startsWith(e.argsText))if(kl(e.argsText)&&kl(t.argsText)&&xy(e.argsText,t.argsText)){const s=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});s&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=s,r=!1}else r=!1;if(r&&e.controller){const s=t.argsText.slice(e.argsText.length);e.controller.argsText.append(s);const i=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});i&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=i}}!e.argsComplete&&e.controller&&this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n})&&(e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=!0)}_processMessages(e){const t=this._pendingRestore;for(const n of e)if(!(!n||!Array.isArray(n.content)))for(const r of n.content){if(!r||r.type!=="tool-call")continue;const s=this._entries.get(r.toolCallId);if(t){s?.controller||this._entries.set(r.toolCallId,{toolName:r.toolName,argsText:r.argsText,hasResult:r.result!==void 0}),r.messages&&this._processMessages(r.messages);continue}let i=s;if(i&&!i.controller){if(!(r.argsText!==i.argsText||r.result!==void 0!==i.hasResult)){r.messages&&this._processMessages(r.messages);continue}this._entries.delete(r.toolCallId),i=void 0}if(i||(i=this._startActiveEntry(r.toolCallId,r.toolName,r.result!==void 0)),this._processArgsText(i,r),r.result!==void 0&&!i.hasResult){const{controller:o}=i;if(!o)continue;i.hasResult=!0,i.argsComplete=!0,o.setResponse(new zr({result:r.result,artifact:r.artifact,isError:r.isError,...r.modelContent!==void 0?{modelContent:r.modelContent}:{}})),o.close()}r.messages&&this._processMessages(r.messages)}}};const zP=Object.freeze([]),wy=(e,t)=>{const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0},FP=(e,t)=>e&&t[t.length-1]?.role!=="assistant";var BP=class extends MP{constructor(t,n){super(t);N(this,"_capabilities",{switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1});N(this,"_messages");N(this,"isDisabled");N(this,"isSendDisabled");N(this,"suggestions",[]);N(this,"extras");N(this,"_converter",new yy);N(this,"_store");N(this,"_toolInvocations",null);N(this,"_toolCallToMessageId",new Map);N(this,"_messagesForToolCallIndex",null);N(this,"updateMessages",t=>{this._store.convertMessage!==void 0?this._store.setMessages?.(t.flatMap(eP)):this._store.setMessages?.(t)});this.__internal_setAdapter(n)}get capabilities(){return this._capabilities}get isLoading(){return this._store.isLoading??!1}get isRunning(){return this._store.isRunning}_getBaseMessages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}beginEdit(t){if(!this._store.onEdit)throw new Error("Runtime does not support editing.");super.beginEdit(t)}__internal_setAdapter(t){if(this._store===t)return;const n=t.isRunning??!1;this.isDisabled=t.isDisabled??!1,this.isSendDisabled=t.isSendDisabled??!1;const r=this._store;this._store=t,this.extras!==t.extras&&(this.extras=t.extras);const s=t.suggestions??zP;wy(this.suggestions,s)||(this.suggestions=s);const i={switchToBranch:this._store.setMessages!==void 0,switchBranchDuringRun:!1,edit:this._store.onEdit!==void 0,reload:this._store.onReload!==void 0,cancel:this._store.onCancel!==void 0,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,voice:this._store.adapters?.voice!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback,queue:!1};wy(this._capabilities,i)||(this._capabilities=i);let o;if(t.messageRepository){if(r&&r.isRunning===t.isRunning&&r.messageRepository===t.messageRepository){this._notifySubscribers();return}this.repository.clear(),this.repository.import(t.messageRepository),o=this.repository.getMessages()}else if(t.messages){if(r){if(r.convertMessage!==t.convertMessage)this._converter=new yy;else if(r.isRunning===t.isRunning&&r.messages===t.messages){this._notifySubscribers();return}}o=t.convertMessage?this._converter.convertMessages(t.messages,(l,u,c)=>{if(!t.convertMessage)return u;const f=Pu(c===(t.messages?.length??0)-1,n,!1,!1,void 0);if(l&&(l.role!=="assistant"||!IP(l.status)||l.status===f))return l;const h=ja(t.convertMessage(u,c),c.toString(),f);return ZR(h,u),h}):t.messages;for(let l=0;l<o.length;l++){const u=o[l],c=o[l-1];this.repository.addOrUpdateMessage(c?.id??null,u)}}else throw new Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");o.length>0&&this.ensureInitialized(),(r?.isRunning??!1)!==(t.isRunning??!1)&&(t.isRunning?this._notifyEventSubscribers("runStart",{}):this._notifyEventSubscribers("runEnd",{}));let a=null;FP(n,o)&&(a=Ss(),this.repository.addOrUpdateMessage(o.at(-1)?.id??null,ja({role:"assistant",content:[],metadata:{isOptimistic:!0}},a,{type:"running"}))),this.repository.resetHead(a??o.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._driveToolInvocations(),this._notifySubscribers()}_driveToolInvocations(){if(!this._store.unstable_enableToolInvocations){this._toolInvocations&&(this._toolInvocations.reset(),this._toolInvocations=null,this._store.setToolStatuses?.({}));return}this._toolInvocations||(this._toolInvocations=new OP(()=>this.getModelContext().tools,{onResult:t=>{try{const n=this._findMessageIdForToolCall(t.toolCallId);if(n===void 0)return;this._store.onAddToolResult?.({messageId:n,toolCallId:t.toolCallId,toolName:t.toolName,result:t.result,isError:t.isError,...t.artifact!==void 0&&{artifact:t.artifact},...t.modelContent!==void 0&&{modelContent:t.modelContent}})}catch(n){console.error("[ExternalStoreThreadRuntimeCore] onAddToolResult dispatch failed",n)}},onStatusesChange:t=>{this._store.setToolStatuses?.(Object.fromEntries(t))}})),this._toolInvocations.setState({messages:this._messages,isRunning:this._store.isRunning??!1,...this._store.isLoading!==void 0&&{isLoading:this._store.isLoading}})}_findMessageIdForToolCall(t){if(this._messagesForToolCallIndex!==this._messages){this._toolCallToMessageId.clear();const n=r=>{for(const s of r)if(Array.isArray(s.content))for(const i of s.content)!i||i.type!=="tool-call"||(this._toolCallToMessageId.set(i.toolCallId,s.id),i.messages&&n(i.messages))};n(this._messages),this._messagesForToolCallIndex=this._messages}return this._toolCallToMessageId.get(t)}switchToBranch(t){if(!this._store.setMessages)throw new Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(t),this.updateMessages(this.repository.getMessages()))}async append(t){if((t.startRun??t.role==="user")&&await this._toolInvocations?.abort(),t.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw new Error("Runtime does not support editing messages.");await this._store.onEdit(t)}else await this._store.onNew(t)}async startRun(t){if(!this._store.onReload)throw new Error("Runtime does not support reloading messages.");await this._toolInvocations?.abort(),await this._store.onReload(t.parentId,t)}async resumeRun(t){if(!this._store.onResume)throw new Error("Runtime does not support resuming runs.");await this._store.onResume(t)}exportExternalState(){if(!this._store.onExportExternalState)throw new Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(t){if(!this._store.onLoadExternalState)throw new Error("Runtime does not support importing external states.");this._toolInvocations&&(this._toolInvocations.reset(),this._store.setToolStatuses?.({})),this._store.onLoadExternalState(t)}cancelRun(){if(!this._store.onCancel)throw new Error("Runtime does not support cancelling runs.");this._toolInvocations?.abort(),this._store.onCancel();const t=this.repository.getMessages().at(-1);t&&t.metadata.isOptimistic&&t.content.length===0&&this.repository.deleteMessage(t.id);let n=this.repository.getMessages();const r=n[n.length-1];r?.role==="user"&&r.id===n.at(-1)?.id?(this.repository.deleteMessage(r.id),this.composer.text.trim()||this.composer.setText(Pa(r)),n=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(n)},0)}addToolResult(t){if(!this._store.onAddToolResult)throw new Error("Runtime does not support tool results.");this._store.onAddToolResult?.(t)}resumeToolCall(t){if(!(this._toolInvocations?.resume(t.toolCallId,t.payload)??!1)){if(this._store.onResumeToolCall){this._store.onResumeToolCall(t);return}throw new Error(`Tool call ${t.toolCallId} is not waiting for resume.`)}}respondToToolApproval(t){if(!this._store.onRespondToToolApproval)throw new Error("Runtime does not support tool approvals.");this._store.onRespondToToolApproval(t)}reset(t){const n=new jp;n.import(X_.fromArray(t??[])),this.updateMessages(n.getMessages())}import(t){super.import(t),this._store.onImport&&this._store.onImport(this.repository.getMessages())}};const by=e=>e.adapters?.threadList??{};var $P=class extends Q_{constructor(t){super();N(this,"threads");this.threads=new SP(by(t),()=>new BP(this._contextProvider,t))}setAdapter(t){this.threads.__internal_setAdapter(by(t)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(t)}};const Ya=e=>{const[t]=m.useState(()=>new $P(e));m.useEffect(()=>{t.setAdapter(e)});const{modelContext:n}=yP()??{};return m.useEffect(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),m.useMemo(()=>new Y_(t),[t])},e0=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,UP=()=>null,VP=(e,t,n)=>{switch(t){case"user":return n?e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message:e.UserMessage??e.Message;case"assistant":return n?e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message:e.AssistantMessage??e.Message;case"system":return n?e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message:e.SystemMessage??e.Message??UP;default:throw new Error(`Unknown message role: ${t}`)}},t0=({components:e})=>d.jsx(VP(e,Y(t=>t.message.role),Y(t=>t.message.composer.isEditing)),{}),n0=m.memo(({index:e,components:t})=>d.jsx(B_,{index:e,children:d.jsx(t0,{components:t})}),(e,t)=>e.index===t.index&&e0(e.components,t.components));n0.displayName="ThreadPrimitive.MessageByIndex";const _y=({children:e})=>{const t=Y(n=>n.thread.messages.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>d.jsx(B_,{index:r,children:d.jsx(go,{getItemState:s=>s.thread().message({index:r}).getState(),children:s=>e({get message(){return s()}})})},r)),[t,e])},r0=({components:e,children:t})=>e?d.jsx(_y,{children:()=>d.jsx(t0,{components:e})}):d.jsx(_y,{children:t});r0.displayName="ThreadPrimitive.Messages";const HP=m.memo(r0,(e,t)=>e.children||t.children?e.children===t.children:e0(e.components,t.components)),s0=e=>{const t=e.message.metadata;if(!(!t||typeof t!="object"))return t.custom?.quote};var WP=class extends Error{constructor(t,n=`Component "${t}" is not in the generative-ui allowlist.`){super(n);N(this,"componentName");this.name="GenerativeUIRenderError",this.componentName=t}};const qP=e=>typeof e=="object"&&e!==null,i0=(e,t,n,r)=>{if(e==null)return null;if(typeof e=="string")return e;if(!qP(e)||!("component"in e))return null;const{component:s,props:i,children:o,key:a}=e,l=t[s];if(!l){if(n)return d.jsx(n,{component:s,props:i},a??r);throw new WP(s)}const u=o?.length?o.map((c,f)=>i0(c,t,n,`${r}/${f}`)):void 0;return m.createElement(l,{...i??{},key:a??r},...u??[])},KP=e=>{if(!e||e.root===void 0||e.root===null)return[];const t=e.root;return Array.isArray(t)?t:[t]},Ap=({spec:e,components:t,Fallback:n})=>d.jsx(d.Fragment,{children:m.useMemo(()=>KP(e),[e]).map((r,s)=>i0(r,t,n,`${s}`))});Ap.displayName="GenerativeUIRender";const o0=({components:e,spec:t,Fallback:n})=>{const r=Y(i=>{const o=i.part;return o?.type==="generative-ui"?o.spec:void 0}),s=t??r;return s?d.jsx(Ap,{spec:s,components:e,Fallback:n}):null};o0.displayName="MessagePrimitive.GenerativeUI";const GP="ui://",YP=e=>!!e?.startsWith(GP),Sy=e=>Symbol.iterator in e,ky=e=>"entries"in e,Cy=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[s,i]of n)if(!r.has(s)||!Object.is(i,r.get(s)))return!1;return!0},QP=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let s=n.next(),i=r.next();for(;!s.done&&!i.done;){if(!Object.is(s.value,i.value))return!1;s=n.next(),i=r.next()}return!!s.done&&!!i.done};function XP(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Sy(e)&&Sy(t)?ky(e)&&ky(t)?Cy(e,t):QP(e,t):Cy({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function a0(e){const t=Zt.useRef(void 0);return n=>{const r=e(n);return XP(t.current,r)?t.current:t.current=r}}const pd=e=>{let t=-1;return{startGroup:n=>{t===-1&&(t=n)},endGroup:(n,r)=>{t!==-1&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{t!==-1&&r.push({type:e,startIndex:t,endIndex:n})}}},JP=(e,t)=>{const n=[];if(t){const r=pd("chainOfThoughtGroup");for(let s=0;s<e.length;s++){const i=e[s];i==="tool-call"||i==="reasoning"?r.startGroup(s):(r.endGroup(s-1,n),n.push({type:"single",index:s}))}r.finalize(e.length-1,n)}else{const r=pd("toolGroup"),s=pd("reasoningGroup");for(let i=0;i<e.length;i++){const o=e[i];o==="tool-call"?(s.endGroup(i-1,n),r.startGroup(i)):o==="reasoning"?(r.endGroup(i-1,n),s.startGroup(i)):(r.endGroup(i-1,n),s.endGroup(i-1,n),n.push({type:"single",index:i}))}r.finalize(e.length-1,n),s.finalize(e.length-1,n)}return n},ZP=e=>{const t=Y(a0(n=>n.message.parts.map(r=>r.type)));return m.useMemo(()=>t.length===0?[]:JP(t,e),[t,e])},ej=({Fallback:e,...t})=>{const n=Y(r=>r.tools.toolUIs[t.toolName]?.[0]?.render??e);return n?d.jsx(n,{...t}):null},Np=(e,t,n)=>{const r=e.renderers[t]?.[0];return r||(e.fallbacks[0]??n)},tj=({Fallback:e,...t})=>{const n=Y(r=>Np(r.dataRenderers,t.name,e));return n?d.jsx(n,{...t}):null},jt={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},nj=({components:{Text:e=jt.Text,Reasoning:t=jt.Reasoning,Image:n=jt.Image,Source:r=jt.Source,File:s=jt.File,Unstable_Audio:i=jt.Unstable_Audio,tools:o={},data:a,generativeUI:l}={}})=>{const u=pe(),c=Y(h=>h.part),f=c.type;if(f==="tool-call"){const h=u.part().addToolResult,p=u.part().resumeToolCall,g=u.part().respondToToolApproval;if("Override"in o)return d.jsx(o.Override,{...c,addResult:h,resume:p,respondToApproval:g});const y=o.by_name?.[c.toolName]??o.Fallback;return d.jsx(ej,{...c,Fallback:y,addResult:h,resume:p,respondToApproval:g})}if(c.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(f){case"text":return d.jsx(e,{...c});case"reasoning":return d.jsx(t,{...c});case"source":return d.jsx(r,{...c});case"image":return d.jsx(n,{...c});case"file":return d.jsx(s,{...c});case"audio":return d.jsx(i,{...c});case"data":{const h=a?.by_name?.[c.name]??a?.Fallback;return d.jsx(tj,{...c,Fallback:h})}case"generative-ui":return l?.components?d.jsx(Ap,{spec:c.spec,components:l.components,Fallback:l.Fallback}):null;default:return console.warn(`Unknown message part type: ${f}`),null}},ra=m.memo(({index:e,components:t})=>d.jsx(Ip,{index:e,children:d.jsx(nj,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.generativeUI===t.components?.generativeUI&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);ra.displayName="MessagePrimitive.PartByIndex";const rj=({status:e,component:t})=>d.jsx(Rp,{text:"",isRunning:e.type==="running",children:d.jsx(t,{type:"text",text:"",status:e})}),sj=Object.freeze({type:"complete"}),ij=Object.freeze({type:"running"}),oj=({components:e})=>{const t=Y(n=>n.message.status??sj);return e?.Empty?d.jsx(e.Empty,{status:t}):t.type!=="running"?null:d.jsx(rj,{status:t,component:e?.Text??jt.Text})},l0=m.memo(oj,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),aj=({components:e,enabled:t})=>Y(n=>{if(!t||n.message.parts.length===0)return!1;const r=n.message.parts[n.message.parts.length-1];return r?.type!=="text"&&r?.type!=="reasoning"})?d.jsx(l0,{components:e}):null,lj=m.memo(aj,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),uj=({Quote:e})=>{const t=Y(s0);return t?d.jsx(e,{text:t.text,messageId:t.messageId}):null},cj=m.memo(uj);function u0(e,t){const n=e.toolUIs[t.toolName]?.[0]?.render??null;return n||(YP(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}const c0=()=>{const e=pe(),t=Y(r=>r.part),n=Y(r=>r.part.type==="tool-call"?u0(r.tools,r.part):null);return!n||t.type!=="tool-call"?null:d.jsx(n,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall,respondToApproval:e.part().respondToToolApproval})},d0=()=>{const e=Y(n=>n.part),t=Y(n=>n.part.type==="data"?Np(n.dataRenderers,n.part.name,void 0)??null:null);return!t||e.type!=="data"?null:d.jsx(t,{...e})},dj=()=>{const e=Y(t=>t.part.type);return e==="tool-call"?d.jsx(c0,{}):e==="data"?d.jsx(d0,{}):null},fj=Object.freeze({type:"text",text:"",status:ij}),f0=({index:e,children:t})=>{const n=pe(),r=Y(s=>s.dataRenderers);return d.jsx(Ip,{index:e,children:d.jsx(go,{getItemState:s=>s.message().part({index:e}).getState(),children:s=>t({get part(){const i=s();if(i.type==="tool-call"){const o=u0(n.tools().getState(),i)!==null,a=n.message().part({index:e});return{...i,toolUI:o?d.jsx(c0,{}):null,addResult:a.addToolResult,resume:a.resumeToolCall,respondToApproval:a.respondToToolApproval}}if(i.type==="data"){const o=Np(r,i.name,void 0)!==void 0;return{...i,dataRendererUI:o?d.jsx(d0,{}):null}}return i}})})})},hj=({children:e})=>{const t=Y(s=>s.message.parts.length),n=Y(s=>(s.message.status?.type??"complete")==="running"),r=t===0&&n;return t===0?r?d.jsx(Rp,{text:"",isRunning:!0,children:e({part:fj})}):null:d.jsx(d.Fragment,{children:Array.from({length:t},(s,i)=>d.jsx(f0,{index:i,children:o=>e(o)??d.jsx(dj,{})},i))})},Wf=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?d.jsx(hj,{children:n}):d.jsx(pj,{components:e,unstable_showEmptyOnNonTextEnd:t});Wf.displayName="MessagePrimitive.Parts";const pj=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{const n=Y(i=>i.message.parts.length),r=ZP(!!e?.ChainOfThought),s=m.useMemo(()=>n===0?d.jsx(l0,{components:e}):r.map(i=>{if(i.type==="single")return d.jsx(ra,{index:i.index,components:e},i.index);if(i.type==="chainOfThoughtGroup"){const o=e?.ChainOfThought;return o?d.jsx(QR,{startIndex:i.startIndex,endIndex:i.endIndex,children:d.jsx(o,{})},`chainOfThought-${i.startIndex}`):null}else return i.type==="toolGroup"?d.jsx(e?.ToolGroup??jt.ToolGroup,{startIndex:i.startIndex,endIndex:i.endIndex,children:Array.from({length:i.endIndex-i.startIndex+1},(o,a)=>{const l=i.startIndex+a;return d.jsx(ra,{index:l,components:e},`part-${l}`)})},`tool-${i.startIndex}`):d.jsx(e?.ReasoningGroup??jt.ReasoningGroup,{startIndex:i.startIndex,endIndex:i.endIndex,children:Array.from({length:i.endIndex-i.startIndex+1},(o,a)=>{const l=i.startIndex+a;return d.jsx(ra,{index:l,components:e},`part-${l}`)})},`reasoning-${i.startIndex}`)}),[r,e,n]);return d.jsxs(d.Fragment,{children:[e?.Quote&&d.jsx(cj,{Quote:e.Quote}),s,d.jsx(lj,{components:e,enabled:t})]})},mj=Symbol.for("@assistant-ui/groupBy.memoKey"),Ey=e=>{const t=e.nextChildIdx++;return e.nodeKey===""?String(t):`${e.nodeKey}.${t}`},gj=e=>{const t={key:"",nodeKey:"",indices:[],children:[],nextChildIdx:0},n=[t],r=()=>{const s=n.pop();n[n.length-1].children.push({type:"group",key:s.key,nodeKey:s.nodeKey,indices:s.indices,children:s.children})};for(let s=0;s<e.length;s++){const i=e[s];let o=0;for(;o<n.length-1&&o<i.length&&n[o+1].key===i[o];)o++;for(;n.length-1>o;)r();for(;n.length-1<i.length;){const l=n[n.length-1];n.push({key:i[n.length-1],nodeKey:Ey(l),indices:[],children:[],nextChildIdx:0})}const a=n[n.length-1];a.children.push({type:"part",index:s,nodeKey:Ey(a)});for(let l=1;l<n.length;l++)n[l].indices.push(s)}for(;n.length>1;)r();return t.children},yj=Object.freeze({type:"complete"}),vj=(e,t,n)=>{if(!n)return!1;switch(e){case"never":return!1;case"always":return!0;case"empty":return t.length===0;case"no-text":{const r=t[t.length-1];return r!==void 0&&r.type!=="text"&&r.type!=="reasoning"}}},h0=()=>{throw new Error("MessagePrimitive.GroupedParts: rendered `children` under a leaf part. `children` is only meaningful for `group-…` cases — add a matching case for the part type or return `null` to skip it.")},p0=(e,t,n)=>{if(e.type==="part")return d.jsx(f0,{index:e.index,children:({part:s})=>n({part:s,children:d.jsx(h0,{})})},`part-${e.index}`);const r=t[e.indices.at(-1)]?.status??yj;return d.jsx(m.Fragment,{children:n({part:{type:e.key,status:r,indices:e.indices},children:d.jsx(d.Fragment,{children:e.children.map(s=>p0(s,t,n))})})},e.nodeKey)},m0=({groupBy:e,indicator:t="no-text",children:n})=>{const r=Y(a0(o=>o.message.parts)),s=Y(o=>o.tools.toolUIs),i=Y(o=>t==="never"?!1:o.message.status?.type==="running");return d.jsxs(d.Fragment,{children:[m.useMemo(()=>{const o={toolUIs:s};return gj(r.map(a=>e(a,o)??[]))},[r,e[mj]??e,s]).map(o=>p0(o,r,n)),vj(t,r,i)&&n({part:{type:"indicator"},children:d.jsx(h0,{})})]})};m0.displayName="MessagePrimitive.GroupedParts";const xj=({children:e})=>{const t=Y(s0);return t?d.jsx(d.Fragment,{children:e(t)}):null},g0=m.memo(xj);g0.displayName="MessagePrimitive.Quote";const y0=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},wj=({components:e})=>{const t=Y(r=>r.attachment);if(!t)return null;const n=y0(e,t);return n?d.jsx(n,{}):null},v0=m.memo(({index:e,components:t})=>d.jsx(z_,{index:e,children:d.jsx(wj,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);v0.displayName="MessagePrimitive.AttachmentByIndex";const Ty=({children:e})=>{const t=Y(n=>n.message.role!=="user"?0:(n.message.attachments??[]).length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(z_,{index:r,children:d.jsx(go,{getItemState:s=>s.message().attachment({index:r}).getState(),children:s=>e({get attachment(){return s()}})})},r)),[t,e])},x0=({components:e,children:t})=>e?d.jsx(Ty,{children:({attachment:n})=>{const r=y0(e,n);return r?d.jsx(r,{}):null}}):d.jsx(Ty,{children:t});x0.displayName="MessagePrimitive.Attachments";const w0=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},bj=({components:e})=>{const t=Y(r=>r.attachment);if(!t)return null;const n=w0(e,t);return n?d.jsx(n,{}):null},b0=m.memo(({index:e,components:t})=>d.jsx(F_,{index:e,children:d.jsx(bj,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);b0.displayName="ComposerPrimitive.AttachmentByIndex";const Iy=({children:e})=>{const t=Y(n=>n.composer.attachments.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(F_,{index:r,children:d.jsx(go,{getItemState:s=>s.composer().attachment({index:r}).getState(),children:s=>e({get attachment(){return s()}})})},r)),[t,e])},_0=({components:e,children:t})=>e?d.jsx(Iy,{children:({attachment:n})=>{const r=w0(e,n);return r?d.jsx(r,{}):null}}):d.jsx(Iy,{children:t});_0.displayName="ComposerPrimitive.Attachments";const _j=({children:e})=>{const t=Y(n=>n.composer.queue.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(XR,{index:r,children:d.jsx(go,{getItemState:s=>s.composer().queueItem({index:r}).getState(),children:s=>e({get queueItem(){return s()}})})},r)),[t,e])},S0=m.memo(_j);S0.displayName="ComposerPrimitive.Queue";const Mp=({children:e})=>Y(t=>t.part.status.type==="running")?e:null;Mp.displayName="MessagePartPrimitive.InProgress";const k0=({components:e})=>{const t=e.Suggestion;return d.jsx(t,{})},C0=m.memo(({index:e,components:t})=>d.jsx($_,{index:e,children:d.jsx(k0,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);C0.displayName="ThreadPrimitive.SuggestionByIndex";const Ry=({children:e})=>{const t=Y(n=>n.suggestions.suggestions.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>d.jsx($_,{index:r,children:d.jsx(go,{getItemState:s=>s.suggestions().suggestion({index:r}).getState(),children:s=>e({get suggestion(){return s()}})})},r)),[t,e])},E0=({components:e,children:t})=>e?d.jsx(Ry,{children:()=>d.jsx(k0,{components:e})}):d.jsx(Ry,{children:t});E0.displayName="ThreadPrimitive.Suggestions";const Sj=m.memo(E0,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion),kj=e=>Y(t=>{if(e.editing===!0&&!t.composer.isEditing||e.editing===!1&&t.composer.isEditing)return!1;const n=t.composer.dictation!=null;return!(e.dictation===!0&&!n||e.dictation===!1&&n)}),T0=({children:e,...t})=>kj(t)?e:null;T0.displayName="ComposerPrimitive.If";const Cj=()=>{const e=pe(),t=Y(n=>!n.composer.canSend||n.thread.isRunning&&!n.thread.capabilities.queue);return{send:m.useCallback(n=>{e.composer().send(n)},[e]),disabled:t}},Ej=()=>{const e=pe(),t=Y(n=>!n.composer.canCancel);return{cancel:m.useCallback(()=>{e.composer().cancel()},[e]),disabled:t}},Tj=()=>{const e=pe(),t=Y(n=>n.composer.dictation!=null||!n.thread.capabilities.dictation||!n.composer.isEditing);return{startDictation:m.useCallback(()=>{e.composer().startDictation()},[e]),disabled:t}},Ij=()=>{const e=pe(),t=Y(n=>!n.composer.isEditing);return{addAttachment:m.useCallback(n=>e.composer().addAttachment(n),[e]),disabled:t}},Rj=({copiedDuration:e=3e3,copyToClipboard:t}={})=>{const n=pe(),r=Y(a=>!((a.message.role!=="assistant"||a.message.status?.type!=="running")&&a.message.parts.some(l=>l.type==="text"&&l.text.length>0))),s=Y(a=>a.message.isCopied),i=Y(a=>a.composer.isEditing),o=Y(a=>a.composer.text);return{copy:m.useCallback(()=>{const a=i?o:n.message().getCopyText();if(!a)return;const l=t??(()=>{});Promise.resolve(l(a)).then(()=>{n.message().setIsCopied(!0),setTimeout(()=>n.message().setIsCopied(!1),e)},()=>{})},[n,i,o,e,t]),disabled:r,isCopied:s}},Pj=()=>{const e=pe(),t=Y(n=>n.composer.isEditing);return{edit:m.useCallback(()=>{e.composer().beginEdit()},[e]),disabled:t}},jj=()=>{const e=pe(),t=Y(n=>n.thread.isRunning||n.thread.isDisabled||n.message.role!=="assistant");return{reload:m.useCallback(()=>{e.message().reload()},[e]),disabled:t}},Aj=()=>{const e=pe(),t=Y(n=>n.message.metadata.submittedFeedback?.type==="positive");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t}},Nj=()=>{const e=pe(),t=Y(n=>n.message.metadata.submittedFeedback?.type==="negative");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t}},Mj=()=>{const e=pe(),t=Y(n=>!((n.message.role!=="assistant"||n.message.status?.type!=="running")&&n.message.parts.some(r=>r.type==="text"&&r.text.length>0)));return{speak:m.useCallback(async()=>{e.message().speak()},[e]),disabled:t}},Dj=()=>{const e=pe(),t=Y(n=>n.message.speech==null);return{stopSpeaking:m.useCallback(()=>{e.message().stopSpeaking()},[e]),disabled:t}},Lj=({prompt:e,send:t,clearComposer:n=!0})=>{const r=pe(),s=Y(o=>o.thread.isDisabled),i=t??!1;return{trigger:m.useCallback(()=>{const o=r.thread().getState().isRunning;if(i&&!o)r.thread().append({content:[{type:"text",text:e}],runConfig:r.composer().getState().runConfig}),n&&r.composer().setText("");else if(n)r.composer().setText(e);else{const a=r.composer().getState().text;r.composer().setText(a.trim()?`${a} ${e}`:e)}},[r,i,n,e]),disabled:s}},Oj=()=>Y(e=>e.message.status?.type==="incomplete"&&e.message.status.reason==="error"?e.message.status.error??"An error occurred":void 0),zj=e=>{const{cloud:t,initialMessages:n,maxSteps:r,adapters:s,unstable_humanToolNames:i,...o}=e;return{localRuntimeOptions:{cloud:t,initialMessages:n,maxSteps:r,adapters:s,unstable_humanToolNames:i},otherOptions:o}},Fj=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,I0={serialize(e){const t=e.id!==e.label?`{name=${e.id}}`:"";return`:${e.type}[${e.label}]${t}`},parse(e){const t=[];let n=0;for(const r of e.matchAll(Fj)){r.index>n&&t.push({kind:"text",text:e.slice(n,r.index)});const s=r[2];t.push({kind:"mention",type:r[1],label:s,id:r[3]??s}),n=r.index+r[0].length}return n<e.length&&t.push({kind:"text",text:e.slice(n)}),t}};function Bj(e,t){function n(r){const s=m.useContext(e);if(!r?.optional&&!s)throw new Error(`This component must be used within ${t}.`);return s}return n}function R0(e,t){function n(s){const i=e(s);return i?i[t]:null}function r(s){let i=!1,o;typeof s=="function"?o=s:s&&typeof s=="object"&&(i=!!s.optional,o=s.selector);const a=n({optional:i});return a?o?a(o):a():null}return{[t]:r,[`${t}Store`]:n}}const P0=m.createContext(null),{useThreadViewport:ci,useThreadViewportStore:di}=R0(Bj(P0,"ThreadPrimitive.Viewport"),"useThreadViewport"),Py=e=>{const t=new Map,n=()=>{let r=0;for(const s of t.values())r+=s;e(r)};return{register:()=>{const r=Symbol();return t.set(r,0),{setHeight:s=>{t.get(r)!==s&&(t.set(r,s),n())},unregister:()=>{t.delete(r),n()}}}}},$j=(e={})=>{const t=new Set,n=Py(o=>{i.setState({height:{...i.getState().height,viewport:o}})}),r=Py(o=>{i.setState({height:{...i.getState().height,inset:o}})}),s=(o,a)=>(i.setState({element:{...i.getState().element,[o]:a}}),()=>{i.getState().element[o]===a&&i.setState({element:{...i.getState().element,[o]:null}})}),i=R_(()=>({isAtBottom:!0,scrollToBottom:({behavior:o="auto"}={})=>{for(const a of t)a({behavior:o})},onScrollToBottom:o=>(t.add(o),()=>{t.delete(o)}),turnAnchor:e.turnAnchor??"bottom",topAnchorMessageClamp:{tallerThan:e.topAnchorMessageClamp?.tallerThan??"10em",visibleHeight:e.topAnchorMessageClamp?.visibleHeight??"6em"},height:{viewport:0,inset:0},element:{viewport:null,anchor:null,target:null},targetConfig:null,topAnchorTurn:null,registerViewport:n.register,registerContentInset:r.register,registerViewportElement:o=>s("viewport",o),registerAnchorElement:o=>s("anchor",o),registerAnchorTargetElement:(o,a)=>(i.setState({element:{...i.getState().element,target:o},targetConfig:o&&a?a:null}),()=>{i.getState().element.target===o&&i.setState({element:{...i.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:o=>{i.setState({topAnchorTurn:o})}}));return i},Au=e=>e,Uj=e=>{const t=di({optional:!0}),[n]=m.useState(()=>$j(e));return m.useEffect(()=>t?.getState().onScrollToBottom(()=>{n.getState().scrollToBottom()}),[t,n]),m.useEffect(()=>{if(t)return n.subscribe(r=>{t.getState().isAtBottom!==r.isAtBottom&&Au(t).setState({isAtBottom:r.isAtBottom})})},[n,t]),n},Dp=({children:e,options:t={}})=>{const n=Uj(t),[r]=m.useState(()=>({useThreadViewport:n}));return d.jsx(P0.Provider,{value:r,children:e})},Vj=()=>{const e=pe();return m.useEffect(()=>{},[e]),null},Hj=({children:e,aui:t,runtime:n})=>d.jsxs(pR,{runtime:n,aui:t??null,children:[d.jsx(Vj,{}),d.jsx(Dp,{children:e})]}),Qa=m.memo(Hj),Wj=e=>{const t=e;t.__isBound||(t.__internal_bindMethods?.(),t.__isBound=!0)};function qj(e,t=Kj){Wj(e);const n=m.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return m.useDebugValue(n),n}const Kj=e=>e;function Gj(e){function t(n){let r=!1,s;typeof n=="function"?s=n:n&&(r=!!n.optional,s=n.selector);const i=e({optional:r});return i?qj(i,s):null}return t}function j0(e){const t=pe(),n=Y(()=>t.composer.source?t.composer().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("ComposerRuntime is not available");return n}function Yj(e){const t=pe(),n=Y(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("MessageRuntime is not available");return n}const Nu=Gj(Yj);function jy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Qj(...e){return t=>{let n=!1;const r=e.map(s=>{const i=jy(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():jy(e[s],null)}}}}function fi(...e){return m.useCallback(Qj(...e),e)}var Ay=Object.defineProperty,xo=(e,t)=>{let n={};for(var r in e)Ay(n,r,{get:e[r],enumerable:!0});return Ay(n,Symbol.toStringTag,{value:"Module"}),n};function A0(e){const t=m.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Ny(s)&&typeof Cl=="function"&&(s=Cl(s._payload)),m.Children.forEach(s,h=>{if(tA(h)){a=!0;const p=h;let g="child"in p.props?p.props.child:p.props.children;Ny(g)&&typeof Cl=="function"&&(g=Cl(g._payload)),o=Jj(p,g),l.push(o?.props?.children)}else l.push(h)}),o?o=m.cloneElement(o,void 0,l):!a&&m.Children.count(s)===1&&m.isValidElement(s)&&(o=s);const u=o?eA(o):void 0,c=fi(r,u);if(!o){if(s||s===0)throw new Error(a?iA(e):sA(e));return s}const f=Zj(i,o.props??{});return o.type!==m.Fragment&&(f.ref=r?c:u),m.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var Mu=A0("Slot"),Xj=Symbol.for("radix.slottable"),Jj=(e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null};function Zj(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function eA(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function tA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xj}var nA=Symbol.for("react.lazy");function Ny(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===nA&&"_payload"in e&&rA(e._payload)}function rA(e){return typeof e=="object"&&e!==null&&"then"in e}var sA=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,iA=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Cl=FC[" use ".trim().toString()],oA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aA=oA.reduce((e,t)=>{const n=A0(`Primitive.${t}`),r=m.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});const lA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"];function uA(e){const t=m.forwardRef(({render:n,asChild:r,children:s,...i},o)=>{const a=e;if(n&&m.isValidElement(n)){const l=s!==void 0?s:n.props.children;return d.jsx(a,{...i,asChild:!0,ref:o,children:m.cloneElement(n,void 0,l)})}return d.jsx(a,{...i,asChild:r,ref:o,children:s})});return t.displayName=typeof e=="string"?e:e.displayName??e.name??"Component",t}function cA(e){const t=aA[e],n=uA(t);return n.displayName=`Primitive.${e}`,n}const Fe=lA.reduce((e,t)=>(e[t]=cA(t),e),{}),dA=({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:r})=>Y(s=>{if(e&&s.thread.isRunning)return"hidden";const i=t==="always"||t==="not-last"&&!s.message.isLast,o=r||s.message.isHovering;return i?o?n==="always"||n==="single-branch"&&s.message.branchCount<=1?"floating":"normal":"hidden":"normal"}),fA=m.createContext(null),N0=m.forwardRef(({hideWhenRunning:e,autohide:t,autohideFloat:n,...r},s)=>{const[i,o]=m.useState(0),a=m.useCallback(()=>{let c=!1;return o(f=>f+1),()=>{c||(c=!0,o(f=>Math.max(0,f-1)))}},[]),l=m.useMemo(()=>({acquireInteractionLock:a}),[a]),u=dA({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:i>0});return u==="hidden"?null:d.jsx(fA.Provider,{value:l,children:d.jsx(Fe.div,{...u==="floating"?{"data-floating":"true"}:null,...r,ref:s})})});N0.displayName="ActionBarPrimitive.Root";function Je(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}const hA=({copiedDuration:e=3e3}={})=>{const{copy:t,disabled:n}=Rj({copiedDuration:e,copyToClipboard:r=>typeof navigator>"u"||!navigator.clipboard?Promise.reject(new Error("Clipboard API is unavailable")):navigator.clipboard.writeText(r)});return n?null:t},M0=m.forwardRef(({copiedDuration:e,onClick:t,disabled:n,...r},s)=>{const i=Y(a=>a.message.isCopied),o=hA({copiedDuration:e});return d.jsx(Fe.button,{type:"button",...i?{"data-copied":"true"}:{},...r,ref:s,disabled:n||!o,onClick:Je(t,()=>{o?.()})})});M0.displayName="ActionBarPrimitive.Copy";const ar=(e,t,n=[])=>{const r=m.forwardRef((s,i)=>{const o={},a={};Object.keys(s).forEach(u=>{n.includes(u)?o[u]=s[u]:a[u]=s[u]});const l=t(o)??void 0;return d.jsx(Fe.button,{...a,type:"button",ref:i,disabled:a.disabled||!l,onClick:Je(a.onClick,l)})});return r.displayName=e,r},pA=()=>{const{disabled:e,reload:t}=jj();return e?null:t},mA=ar("ActionBarPrimitive.Reload",pA),gA=()=>{const{disabled:e,edit:t}=Pj();return e?null:t},yA=ar("ActionBarPrimitive.Edit",gA),vA=()=>{const{disabled:e,speak:t}=Mj();return e?null:t},xA=ar("ActionBarPrimitive.Speak",vA);function ii(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function D0(e,t=globalThis?.document){const n=ii(e);m.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}const wA=()=>{const{disabled:e,stopSpeaking:t}=Dj();return e?null:t},L0=m.forwardRef((e,t)=>{const n=wA();return D0(r=>{n&&(r.preventDefault(),n())}),d.jsx(Fe.button,{type:"button",disabled:!n,...e,ref:t,onClick:Je(e.onClick,()=>{n?.()})})});L0.displayName="ActionBarPrimitive.StopSpeaking";const bA=()=>{const{submit:e}=Aj();return e},O0=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const s=Y(o=>o.message.metadata.submittedFeedback?.type==="positive"),i=bA();return d.jsx(Fe.button,{type:"button",...s?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!i,onClick:Je(e,()=>{i?.()})})});O0.displayName="ActionBarPrimitive.FeedbackPositive";const _A=()=>{const{submit:e}=Nj();return e},z0=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const s=Y(o=>o.message.metadata.submittedFeedback?.type==="negative"),i=_A();return d.jsx(Fe.button,{type:"button",...s?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!i,onClick:Je(e,()=>{i?.()})})});z0.displayName="ActionBarPrimitive.FeedbackNegative";const SA=({filename:e,onExport:t}={})=>{const n=pe(),r=Y(i=>(i.message.role!=="assistant"||i.message.status?.type!=="running")&&i.message.parts.some(o=>o.type==="text"&&o.text.length>0)),s=m.useCallback(async()=>{const i=n.message().getCopyText();if(!i)return;if(t){await t(i);return}const o=new Blob([i],{type:"text/markdown"}),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=e??`message-${Date.now()}.md`,l.click(),URL.revokeObjectURL(a)},[n,e,t]);return r?s:null},F0=m.forwardRef(({filename:e,onExport:t,onClick:n,disabled:r,...s},i)=>{const o=SA({filename:e,onExport:t});return d.jsx(Fe.button,{type:"button",...s,ref:i,disabled:r||!o,onClick:Je(n,()=>{o?.()})})});F0.displayName="ActionBarPrimitive.ExportMarkdown";var My=xo({Copy:()=>M0,Edit:()=>yA,ExportMarkdown:()=>F0,FeedbackNegative:()=>z0,FeedbackPositive:()=>O0,Reload:()=>mA,Root:()=>N0,Speak:()=>xA,StopSpeaking:()=>L0});const B0=m.forwardRef((e,t)=>d.jsx(Fe.div,{...e,ref:t}));B0.displayName="AttachmentPrimitive.Root";const $0=m.forwardRef((e,t)=>{const n=Y(r=>{const s=r.attachment.name.split(".");return s.length>1?s.pop():""});return d.jsxs(Fe.div,{...e,ref:t,children:[".",n]})});$0.displayName="AttachmentPrimitive.unstable_Thumb";const U0=()=>d.jsx(d.Fragment,{children:Y(e=>e.attachment.name)});U0.displayName="AttachmentPrimitive.Name";const kA=()=>{const e=pe();return m.useCallback(()=>{e.attachment().remove()},[e])},CA=ar("AttachmentPrimitive.Remove",kA);var Dy=xo({Name:()=>U0,Remove:()=>CA,Root:()=>B0,unstable_Thumb:()=>$0});const EA=e=>Y(t=>{const{role:n,attachments:r,parts:s,branchCount:i,isLast:o,speech:a,isCopied:l,isHovering:u}=t.message;return!(e.hasBranches===!0&&i<2||e.user&&n!=="user"||e.assistant&&n!=="assistant"||e.system&&n!=="system"||e.lastOrHover===!0&&!u&&!o||e.last!==void 0&&e.last!==o||e.copied===!0&&!l||e.copied===!1&&l||e.speaking===!0&&a==null||e.speaking===!1&&a!=null||e.hasAttachments===!0&&(n!=="user"||!r?.length)||e.hasAttachments===!1&&n==="user"&&r?.length||e.hasContent===!0&&s.length===0||e.hasContent===!1&&s.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)}),V0=({children:e,...t})=>EA(t)?e:null;V0.displayName="MessagePrimitive.If";const H0=m.createContext(null),bc=()=>m.useContext(H0),TA=({children:e})=>{const t=m.useRef(new Map),n=m.useRef([]),r=m.useCallback(()=>{const a=Array.from(t.current.entries());a.sort((l,u)=>u[1]-l[1]),n.current=a.map(([l])=>l)},[]),s=m.useCallback((a,l)=>{const u=l?.priority??0;return t.current.set(a,u),r(),()=>{t.current.delete(a),r()}},[r]),i=m.useCallback(()=>n.current,[]),o=m.useMemo(()=>({register:s,getPlugins:i}),[s,i]);return d.jsx(H0.Provider,{value:o,children:e})},Lp=m.createContext(null),W0=m.createContext(null),Op=()=>{const e=m.useContext(Lp);if(!e)throw new Error("useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot");return e},zp=()=>m.useContext(Lp),IA=()=>{const e=m.useContext(W0);if(!e)throw new Error("useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot");return e},RA=()=>{const e=Op();return m.useSyncExternalStore(e.subscribe,e.getTriggers,e.getTriggers)},PA=new Map,q0=()=>()=>{},Ly=()=>PA,jA=()=>{const e=zp();return m.useSyncExternalStore(e?e.subscribe:q0,e?e.getTriggers:Ly,e?e.getTriggers:Ly)},Oy=()=>null,AA=()=>{const e=zp();return m.useSyncExternalStore(e?e.subscribeAria:q0,e?e.getActiveAria:Oy,e?e.getActiveAria:Oy)};function zy(){const e=m.useRef(new Set);return{notify:m.useCallback(()=>{for(const t of e.current)t()},[]),subscribe:m.useCallback(t=>(e.current.add(t),()=>{e.current.delete(t)}),[])}}const Fy=({children:e})=>{const t=m.useRef(new Map),n=m.useRef(new Set),{notify:r,subscribe:s}=zy(),i=m.useCallback(b=>{const{char:x}=b;if(t.current.has(x))return()=>{};const v=new Map(t.current);v.set(x,b),t.current=v,r();for(const w of n.current)w.added(b);return()=>{const w=new Map(t.current);w.delete(x),t.current=w,r();for(const k of n.current)k.removed(x)}},[r]),o=m.useCallback(()=>t.current,[]),a=m.useCallback(b=>(n.current.add(b),()=>{n.current.delete(b)}),[]),l=m.useRef(null),u=m.useRef(null),{notify:c,subscribe:f}=zy(),h=m.useCallback((b,x)=>{if(x===null){if(u.current!==b)return;l.current=null,u.current=null,c();return}const v=l.current;u.current===b&&v!==null&&v.popoverId===x.popoverId&&v.highlightedItemId===x.highlightedItemId||(l.current=x,u.current=b,c())},[c]),p=m.useCallback(()=>l.current,[]),g=m.useMemo(()=>({register:i,getTriggers:o,subscribe:s,subscribeLifecycle:a,getActiveAria:p,subscribeAria:f}),[i,o,s,a,p,f]),y=m.useMemo(()=>({setActiveAria:h}),[h]);return d.jsx(Lp.Provider,{value:g,children:d.jsx(W0.Provider,{value:y,children:e})})},K0=({children:e})=>bc()?d.jsx(Fy,{children:e}):d.jsx(TA,{children:d.jsx(Fy,{children:e})});K0.displayName="ComposerPrimitive.TriggerPopoverRoot";const By=/\s/u;function NA(e,t,n){const r=e.slice(0,n);for(let s=r.length-1;s>=0;s--){const i=r[s];if(By.test(i))return null;if(r.startsWith(t,s)){if(s>0&&!By.test(r[s-1]))continue;return{query:r.slice(s+t.length),offset:s}}}return null}const MA=Se(({text:e,triggerChar:t})=>{const[n,r]=En(e.length),s=me(()=>NA(e,t,Math.min(n,e.length)),[n,e,t]);return{trigger:s,query:s?.query??"",setCursorPosition:r}});function DA(e){return"type"in e}const LA=Se(({navigableList:e,isSearchMode:t,activeCategoryId:n,query:r,popoverId:s,open:i,selectItem:o,selectCategory:a,goBack:l,close:u})=>{const[c,f]=En(0);ct(()=>{f(0)},[e]),ct(()=>{f(0)},[t,n]);const h=_r(y=>{y<0||y>=e.length||y!==c&&f(y)}),p=_r(y=>{if(!i)return!1;switch(y.key){case"ArrowDown":return y.preventDefault(),f(b=>{const x=e.length;return x===0?0:b<x-1?b+1:0}),!0;case"ArrowUp":return y.preventDefault(),f(b=>{const x=e.length;return x===0?0:b>0?b-1:x-1}),!0;case"Enter":case"Tab":{if(y.shiftKey)return!1;y.preventDefault();const b=e[c];return b&&(DA(b)?o(b):a(b.id)),!0}case"Escape":return y.preventDefault(),u(),!0;case"Backspace":return n&&r===""?(y.preventDefault(),l(),!0):!1;default:return!1}}),g=e[c];return{highlightedIndex:c,highlightedItemId:i&&g?`${s}-option-${g.id}`:void 0,highlightIndex:h,handleKeyDown:p}});function $y(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}const OA=Se(({adapter:e,query:t,open:n})=>{const[r,s]=En(null);ct(()=>{n||s(null)},[n]);const i=me(()=>!n||!e?[]:e.categories(),[n,e]),o=n?r:null,a=me(()=>!o||!e?[]:e.categoryItems(o),[o,e]),l=me(()=>{if(!n||!e||o||!t&&i.length>0)return null;if(e.search)return e.search(t);const h=[],p=t.toLowerCase();for(const g of i)for(const y of e.categoryItems(g.id))$y(y,p)&&h.push(y);return h},[n,e,t,o,i]),u=l!==null,c=me(()=>{if(u)return[];if(!t)return i;const h=t.toLowerCase();return i.filter(p=>p.label.toLowerCase().includes(h))},[i,t,u]),f=me(()=>{if(u)return l??[];if(!t)return a;const h=t.toLowerCase();return a.filter(p=>$y(p,h))},[a,t,u,l]);return{categories:c,items:f,isSearchMode:u,activeCategoryId:o,navigableList:me(()=>u?l??[]:o?f:c,[u,l,o,f,c]),selectCategory:_r(h=>{s(h)}),goBack:_r(()=>{s(null)})}}),zA=Se(({behavior:e,trigger:t,aui:n,triggerChar:r,setCursorPosition:s,onSelected:i})=>{const o=br(null),a=_r(l=>(o.current=l,()=>{o.current===l&&(o.current=null)}));return{selectItem:_r(l=>{if(!t||!e)return;if(o.current?.(l)){i();return}const u=n.composer().getState().text,c=u.slice(0,t.offset),f=u.slice(t.offset+r.length+t.query.length),h=()=>{const p=e.formatter.serialize(l);n.composer().setText(c+p+(f.startsWith(" ")?f:` ${f}`))};e.kind==="directive"?(h(),e.onInserted?.(l)):(e.removeOnExecute?n.composer().setText(c+(f.startsWith(" ")?f.slice(1):f)):h(),e.onExecute(l)),i()}),close:_r(()=>{i(),t&&s(t.offset)}),registerSelectItemOverride:a}}),FA=Se(({adapter:e,text:t,triggerChar:n,behavior:r,aui:s,popoverId:i})=>{const o=bt(MA({text:t,triggerChar:n})),a=o.trigger!==null&&e!==void 0&&r!==void 0,l=bt(OA({adapter:e,query:o.query,open:a})),u=_r(()=>{l.goBack()}),c=bt(zA({behavior:r,trigger:o.trigger,aui:s,triggerChar:n,setCursorPosition:o.setCursorPosition,onSelected:u})),f=bt(LA({navigableList:l.navigableList,isSearchMode:l.isSearchMode,activeCategoryId:l.activeCategoryId,query:o.query,popoverId:i,open:a,selectItem:c.selectItem,selectCategory:l.selectCategory,goBack:l.goBack,close:c.close}));return{open:a,query:o.query,activeCategoryId:l.activeCategoryId,categories:l.categories,items:l.items,highlightedIndex:f.highlightedIndex,isSearchMode:l.isSearchMode,popoverId:i,highlightedItemId:f.highlightedItemId,selectCategory:l.selectCategory,goBack:l.goBack,selectItem:c.selectItem,close:c.close,highlightIndex:f.highlightIndex,handleKeyDown:f.handleKeyDown,setCursorPosition:o.setCursorPosition,registerSelectItemOverride:c.registerSelectItemOverride}}),Fp=m.createContext(null),wo=()=>{const e=m.useContext(Fp);if(!e)throw new Error("useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover");return e},BA=()=>m.useContext(Fp),G0=m.createContext(null),Y0=()=>{const e=m.useContext(G0);if(!e)throw new Error("TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover");return e},Q0=m.forwardRef(({char:e,adapter:t,"aria-label":n,children:r,...s},i)=>{const o=pe(),a=Y(_=>_.composer.text),l=m.useId(),u=m.useRef(null),[c,f]=m.useState(null),h=m.useRef(0),p=m.useCallback(_=>(h.current+=1,u.current=_,f(_),()=>{h.current=Math.max(0,h.current-1),u.current===_&&(u.current=null,f(null))}),[e]),g=m.useMemo(()=>({register:p}),[p]),y=S_(FA({adapter:t,text:a,triggerChar:e,behavior:c??void 0,aui:o,popoverId:l})),b=m.useRef(y);b.current=y;const x=Op();m.useEffect(()=>x.register({char:e,...c?{behavior:c}:{},resource:b.current}),[x,e,c]);const v=bc();m.useEffect(()=>{if(v)return v.register(b.current)},[v]);const w=c!==null&&y.open,k=IA();return m.useEffect(()=>{if(w)return()=>{k.setActiveAria(e,null)}},[k,e,w]),m.useEffect(()=>{w&&k.setActiveAria(e,{popoverId:l,highlightedItemId:y.highlightedItemId})},[k,e,l,w,y.highlightedItemId]),d.jsx(G0.Provider,{value:g,children:d.jsx(Fp.Provider,{value:y,children:w?d.jsx(Fe.div,{role:"listbox",id:l,"aria-label":n??"Suggestions","aria-activedescendant":y.highlightedItemId,"data-state":"open",...s,ref:i,children:r}):r})})});Q0.displayName="ComposerPrimitive.TriggerPopover";const X0=()=>{const{disabled:e,send:t}=Cj(),n=m.useCallback(()=>t(),[t]);return e?null:n},$A=ar("ComposerPrimitive.Send",X0),J0=m.forwardRef(({onSubmit:e,...t},n)=>{const r=X0(),s=i=>{i.preventDefault(),r&&r()};return d.jsx(Fe.form,{...t,ref:n,onSubmit:Je(e,s)})});J0.displayName="ComposerPrimitive.Root";const Z0=e=>{const t=ii(e),n=ci(r=>r.onScrollToBottom);m.useEffect(()=>n(t),[n,t])},UA=()=>!1,VA=()=>{},HA=e=>m.useSyncExternalStore(m.useCallback(t=>{if(typeof window>"u"||e===null)return VA;const n=window.matchMedia(e);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},[e]),m.useCallback(()=>typeof window>"u"||e===null?!1:window.matchMedia(e).matches,[e]),UA);function qf(){return qf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qf.apply(null,arguments)}function WA(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var qA=m.useLayoutEffect,KA=function(t){var n=Zt.useRef(t);return qA(function(){n.current=t}),n},Uy=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},GA=function(t,n){var r=Zt.useRef();return Zt.useCallback(function(s){t.current=s,r.current&&Uy(r.current,null),r.current=n,n&&Uy(n,s)},[n])},Vy={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},YA=function(t){Object.keys(Vy).forEach(function(n){t.style.setProperty(n,Vy[n],"important")})},Hy=YA,Bt=null,Wy=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function QA(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Bt||(Bt=document.createElement("textarea"),Bt.setAttribute("tabindex","-1"),Bt.setAttribute("aria-hidden","true"),Hy(Bt)),Bt.parentNode===null&&document.body.appendChild(Bt);var s=e.paddingSize,i=e.borderSize,o=e.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(h){var p=h;Bt.style[p]=o[p]}),Hy(Bt),Bt.value=t;var l=Wy(Bt,e);Bt.value=t,l=Wy(Bt,e),Bt.value="x";var u=Bt.scrollHeight-s,c=u*n;a==="border-box"&&(c=c+s+i),l=Math.max(c,l);var f=u*r;return a==="border-box"&&(f=f+s+i),l=Math.min(f,l),[l,u]}var qy=function(){},XA=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},JA=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],ZA=!!document.documentElement.currentStyle,eN=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=XA(JA,n),s=r.boxSizing;if(s==="")return null;ZA&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),o=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:o}},tN=eN;function Bp(e,t,n){var r=KA(n);m.useLayoutEffect(function(){var s=function(o){return r.current(o)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var nN=function(t,n){Bp(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},rN=function(t){Bp(window,"resize",t)},sN=function(t){Bp(document.fonts,"loadingdone",t)},iN=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],oN=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,i=t.minRows,o=t.onChange,a=o===void 0?qy:o,l=t.onHeightChange,u=l===void 0?qy:l,c=WA(t,iN),f=c.value!==void 0,h=m.useRef(null),p=GA(h,n),g=m.useRef(0),y=m.useRef(),b=function(){var w=h.current,k=r&&y.current?y.current:tN(w);if(k){y.current=k;var _=QA(k,w.value||w.placeholder||"x",i,s),S=_[0],T=_[1];g.current!==S&&(g.current=S,w.style.setProperty("height",S+"px","important"),u(S,{rowHeight:T}))}},x=function(w){f||b(),a(w)};return m.useLayoutEffect(b),nN(h,function(){if(!f){var v=h.current.value;requestAnimationFrame(function(){var w=h.current;w&&v!==w.value&&b()})}}),rN(b),sN(b),m.createElement("textarea",qf({},c,{onChange:x,ref:p}))},aN=m.forwardRef(oN);const lN="(pointer: coarse) and (not (any-pointer: fine))",eS=m.forwardRef(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:s,onKeyDown:i,onPaste:o,onSelect:a,submitOnEnter:l,submitMode:u,cancelOnEscape:c=!0,unstable_focusOnRunStart:f=!0,unstable_focusOnScrollToBottom:h=!0,unstable_focusOnThreadSwitched:p=!0,unstable_insertNewlineOnTouchEnter:g=!1,addAttachmentOnPaste:y=!0,...b},x)=>{const v=pe(),w=bc(),k=AA(),_=u??(l===!1?"none":"enter"),S=HA(g?lN:null),T=g&&S&&_==="enter"?"none":_,P=Y(F=>F.composer.isEditing?F.composer.text:""),R=Y(F=>F.thread.isDisabled||F.composer.dictation?.inputDisabled)||r,C=m.useRef(null),M=fi(x,C),D=m.useRef(!1);D0(F=>{if(!C.current?.contains(F.target))return;if(w){for(const X of w.getPlugins())if(X.handleKeyDown(F))return}if(!c)return;const E=v.composer();E.getState().canCancel&&(E.cancel(),F.preventDefault())});const U=F=>{if(!R&&!F.nativeEvent.isComposing){if(w){for(const E of w.getPlugins())if(E.handleKeyDown(F))return}if(F.key==="Enter"){const E=v.thread().getState(),X=E.capabilities.queue;if(F.shiftKey&&(F.ctrlKey||F.metaKey)&&X&&_!=="none"&&v.composer().getState().canSend){F.preventDefault(),v.composer().send({steer:!0});return}if(F.shiftKey||E.isRunning&&!X)return;let Z=!1;T==="ctrlEnter"?Z=F.ctrlKey||F.metaKey:T==="enter"&&(Z=!0),Z&&(F.preventDefault(),C.current?.closest("form")?.requestSubmit())}}},V=async F=>{if(!y)return;const E=v.thread().getState().capabilities,X=Array.from(F.clipboardData?.files||[]);if(E.attachments&&X.length>0)try{F.preventDefault(),await Promise.all(X.map(Z=>v.composer().addAttachment(Z)))}catch(Z){console.error("Error adding attachment:",Z)}},W=e&&!R,J=m.useCallback(()=>{const F=C.current;!F||!W||(F.focus({preventScroll:!0}),F.setSelectionRange(F.value.length,F.value.length))},[W]);m.useEffect(()=>J(),[J]),Z0(()=>{v.composer().getState().type==="thread"&&h&&J()}),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!f))return v.on("thread.runStart",J)},[f,J,v]),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!p))return v.on("threadListItem.switchedTo",J)},[p,J,v]);const ne=k?{"aria-controls":k.popoverId,"aria-expanded":!0,"aria-haspopup":"listbox","aria-activedescendant":k.highlightedItemId}:{},$={name:"input",value:P,...b,...ne,ref:M,disabled:R,onChange:Je(s,F=>{if(!v.composer().getState().isEditing)return;const E=F.nativeEvent.isComposing===!0;D.current&&!E&&(D.current=!1);const X=E||D.current;if(Zg(()=>{v.composer().setText(F.target.value)}),X)return;const Z=F.target.selectionStart??F.target.value.length;if(w)for(const I of w.getPlugins())I.setCursorPosition(Z)}),onKeyDown:Je(i,U),onCompositionStart:Je(b.onCompositionStart,()=>{D.current=!0}),onCompositionEnd:Je(b.onCompositionEnd,F=>{if(D.current=!1,!v.composer().getState().isEditing)return;const E=F.target;Zg(()=>{v.composer().setText(E.value)});const X=E.selectionStart??E.value.length;if(w)for(const Z of w.getPlugins())Z.setCursorPosition(X)}),onSelect:Je(a,F=>{if(D.current)return;const E=F.target,X=E.selectionStart??E.value.length;if(w)for(const Z of w.getPlugins())Z.setCursorPosition(X)}),onPaste:Je(o,V)};if(n&&m.isValidElement(n)){const F=b.children!==void 0?b.children:n.props.children;return d.jsx(Mu,{...$,children:m.cloneElement(n,void 0,F)})}return d.jsx(t?Mu:aN,{...$})});eS.displayName="ComposerPrimitive.Input";const uN=()=>{const{disabled:e,cancel:t}=Ej();return e?null:t},cN=ar("ComposerPrimitive.Cancel",uN),dN=({multiple:e=!0}={})=>{const{disabled:t,addAttachment:n}=Ij(),r=pe(),s=m.useCallback(()=>{const i=document.createElement("input");i.type="file",i.multiple=e,i.hidden=!0;const o=r.composer().getState().attachmentAccept;o!=="*"&&(i.accept=o),document.body.appendChild(i),i.onchange=a=>{const l=a.target.files;if(l){for(const u of l)n(u);document.body.removeChild(i)}},i.oncancel=()=>{(!i.files||i.files.length===0)&&document.body.removeChild(i)},i.click()},[r,e,n]);return t?null:s},fN=ar("ComposerPrimitive.AddAttachment",dN,["multiple"]),tS=m.forwardRef(({disabled:e,asChild:t=!1,render:n,children:r,...s},i)=>{const[o,a]=m.useState(!1),l=pe(),u=m.useCallback(g=>{e||(g.preventDefault(),a(!0))},[e]),c=m.useCallback(g=>{e||(g.preventDefault(),o||a(!0))},[e,o]),f=m.useCallback(g=>{if(e)return;g.preventDefault();const y=g.relatedTarget;y&&g.currentTarget.contains(y)||a(!1)},[e]),h=m.useCallback(async g=>{if(e)return;g.preventDefault(),a(!1);const y=Array.from(g.dataTransfer.files);await Promise.all(y.map(async b=>{try{await l.composer().addAttachment(b)}catch(x){console.error("Failed to add attachment:",x)}}))},[e,l]),p={...o?{"data-dragging":"true"}:null,...s,onDragEnterCapture:Je(s.onDragEnterCapture,u),onDragOverCapture:Je(s.onDragOverCapture,c),onDragLeaveCapture:Je(s.onDragLeaveCapture,f),onDropCapture:Je(s.onDropCapture,h),ref:i};if(n&&m.isValidElement(n)){const g=r!==void 0?r:n.props.children;return d.jsx(Mu,{...p,children:m.cloneElement(n,void 0,g)})}return d.jsx(t?Mu:"div",{...p,children:r})});tS.displayName="ComposerPrimitive.AttachmentDropzone";const hN=()=>{const{disabled:e,startDictation:t}=Tj();return e?null:t},pN=ar("ComposerPrimitive.Dictate",hN),mN=()=>{const e=pe(),t=Y(r=>r.composer.dictation!=null),n=m.useCallback(()=>{e.composer().stopDictation()},[e]);return t?n:null},gN=ar("ComposerPrimitive.StopDictation",mN),nS=m.forwardRef(({children:e,...t},n)=>{const r=Y(s=>s.composer.dictation?.transcript);return r?d.jsx(Fe.span,{...t,ref:n,children:e??r}):null});nS.displayName="ComposerPrimitive.DictationTranscript";const rS=m.forwardRef((e,t)=>Y(n=>n.composer.quote)?d.jsx(Fe.div,{...e,ref:t}):null);rS.displayName="ComposerPrimitive.Quote";const sS=m.forwardRef(({children:e,...t},n)=>{const r=Y(s=>s.composer.quote?.text);return r?d.jsx(Fe.span,{...t,ref:n,children:e??r}):null});sS.displayName="ComposerPrimitive.QuoteText";const iS=m.forwardRef(({onClick:e,...t},n)=>{const r=pe(),s=m.useCallback(()=>{r.composer().setQuote(void 0)},[r]);return d.jsx(Fe.button,{type:"button",...t,ref:n,onClick:Je(e,s)})});iS.displayName="ComposerPrimitive.QuoteDismiss";const oS=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{categories:s,activeCategoryId:i,isSearchMode:o,open:a}=wo();return!a||i||o?null:d.jsx(Fe.div,{role:"group","aria-label":t??"Categories",...n,ref:r,children:e(s)})});oS.displayName="ComposerPrimitive.TriggerPopoverCategories";const aS=m.forwardRef(({categoryId:e,onClick:t,onMouseMove:n,...r},s)=>{const{selectCategory:i,highlightIndex:o,categories:a,highlightedIndex:l,activeCategoryId:u,isSearchMode:c,popoverId:f}=wo(),h=m.useCallback(()=>{i(e)},[i,e]),p=a.findIndex(b=>b.id===e),g=!u&&!c&&p===l,y=m.useCallback(()=>{o(p)},[o,p]);return d.jsx(Fe.button,{type:"button",role:"option",id:`${f}-option-${e}`,"aria-selected":g,"data-highlighted":g?"":void 0,...r,ref:s,onClick:Je(t,h),onMouseMove:Je(n,y)})});aS.displayName="ComposerPrimitive.TriggerPopoverCategoryItem";const lS=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{items:s,activeCategoryId:i,isSearchMode:o,open:a}=wo();return!a||!i&&!o?null:d.jsx(Fe.div,{role:"group","aria-label":t??"Items",...n,ref:r,children:e(s)})});lS.displayName="ComposerPrimitive.TriggerPopoverItems";const uS=m.forwardRef(({item:e,index:t,onClick:n,onMouseMove:r,...s},i)=>{const{selectItem:o,highlightIndex:a,items:l,highlightedIndex:u,activeCategoryId:c,isSearchMode:f,popoverId:h}=wo(),p=m.useCallback(()=>{o(e)},[o,e]),g=t??l.findIndex(x=>x.id===e.id),y=(f||c!==null)&&g===u,b=m.useCallback(()=>{a(g)},[a,g]);return d.jsx(Fe.button,{type:"button",role:"option",id:`${h}-option-${e.id}`,"aria-selected":y,"data-highlighted":y?"":void 0,...s,ref:i,onClick:Je(n,p),onMouseMove:Je(r,b)})});uS.displayName="ComposerPrimitive.TriggerPopoverItem";const cS=m.forwardRef(({onClick:e,...t},n)=>{const{activeCategoryId:r,isSearchMode:s,goBack:i,open:o}=wo();return!o||!r||s?null:d.jsx(Fe.button,{type:"button",...t,ref:n,onClick:Je(e,i)})});cS.displayName="ComposerPrimitive.TriggerPopoverBack";const dS=({formatter:e,onExecute:t,removeOnExecute:n})=>{const{register:r}=Y0(),s=m.useRef(t);return s.current=t,m.useEffect(()=>r({kind:"action",formatter:e??I0,onExecute:i=>s.current(i),...n!==void 0?{removeOnExecute:n}:{}}),[r,e,n]),null};dS.displayName="ComposerPrimitive.TriggerPopoverAction";const fS=({formatter:e,onInserted:t})=>{const{register:n}=Y0(),r=m.useRef(t);return r.current=t,m.useEffect(()=>n({kind:"directive",formatter:e??I0,onInserted:s=>r.current?.(s)}),[n,e]),null};fS.displayName="ComposerPrimitive.TriggerPopoverDirective";const yN=Object.assign(Q0,{Directive:fS,Action:dS});var El=xo({AddAttachment:()=>fN,AttachmentByIndex:()=>b0,AttachmentDropzone:()=>tS,Attachments:()=>_0,Cancel:()=>cN,Dictate:()=>pN,DictationTranscript:()=>nS,If:()=>T0,Input:()=>eS,Queue:()=>S0,Quote:()=>rS,QuoteDismiss:()=>iS,QuoteText:()=>sS,Root:()=>J0,Send:()=>$A,StopDictation:()=>gN,Unstable_TriggerPopover:()=>yN,Unstable_TriggerPopoverBack:()=>cS,Unstable_TriggerPopoverCategories:()=>oS,Unstable_TriggerPopoverCategoryItem:()=>aS,Unstable_TriggerPopoverItem:()=>uS,Unstable_TriggerPopoverItems:()=>lS,Unstable_TriggerPopoverRoot:()=>K0,unstable_useTriggerPopoverRootContext:()=>Op,unstable_useTriggerPopoverRootContextOptional:()=>zp,unstable_useTriggerPopoverScopeContext:()=>wo,unstable_useTriggerPopoverScopeContextOptional:()=>BA,unstable_useTriggerPopoverTriggers:()=>RA,unstable_useTriggerPopoverTriggersOptional:()=>jA});const hS=()=>Y(e=>{if(e.part.type!=="text"&&e.part.type!=="reasoning")throw new Error("MessagePartText can only be used inside text or reasoning message parts.");return e.part}),vN=()=>Y(e=>{if(e.part.type!=="image")throw new Error("MessagePartImage can only be used inside image message parts.");return e.part}),pS=m.createContext(null),xN=e=>({useSmoothStatus:R_(()=>e)}),wN=({children:e})=>{const t=mS({optional:!0}),n=pe(),[r]=m.useState(()=>xN(n.part().getState().status));return t?e:d.jsx(pS.Provider,{value:r,children:e})},bN=e=>{const t=m.forwardRef((n,r)=>d.jsx(wN,{children:d.jsx(e,{...n,ref:r})}));return t.displayName=e.displayName,t};function mS(e){const t=m.useContext(pS);if(!e?.optional&&!t)throw new Error("This component must be used within a SmoothContextProvider.");return t}const{useSmoothStatus:_N,useSmoothStatusStore:SN}=R0(mS,"useSmoothStatus");var kN=class{constructor(e,t){N(this,"currentText");N(this,"setText");N(this,"animationFrameId",null);N(this,"lastUpdateTime",Date.now());N(this,"targetText","");N(this,"animate",()=>{const e=Date.now();let t=e-this.lastUpdateTime;const n=this.targetText.length-this.currentText.length,r=Math.min(5,250/n);let s=0;for(;t>=r&&s<n;)s++,t-=r;s!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,s!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+s),this.lastUpdateTime=e-t,this.setText(this.currentText))});this.currentText=e,this.setText=t}start(){this.animationFrameId===null&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}};const md=Object.freeze({type:"running"}),gS=(e,t=!1)=>{const{text:n}=e,[r,s]=m.useState(e.status.type==="running"?"":n),i=pe(),o=Y(()=>i.part()),[a,l]=m.useState(o);(o!==a||!n.startsWith(r))&&(l(o),s(e.status.type==="running"?"":n));const u=SN({optional:!0}),c=ii(p=>{if(s(p),u){const g=r!==p||e.status.type==="running"?md:e.status;Au(u).setState(g,!0)}});m.useEffect(()=>{if(u){const p=t&&(r!==n||e.status.type==="running")?md:e.status;Au(u).setState(p,!0)}},[u,t,n,r,e.status]);const[f]=m.useState(new kN(r,c)),h=m.useRef(o);return m.useEffect(()=>{if(!t){f.stop();return}const p=h.current!==o;if(h.current=o,p||!n.startsWith(f.targetText)){e.status.type==="running"?(f.currentText="",f.targetText=n,f.start()):(f.currentText=n,f.targetText=n,f.stop());return}f.targetText=n,f.start()},[f,t,n,e.status.type,o]),m.useEffect(()=>()=>{f.stop()},[f]),m.useMemo(()=>t?{type:"text",text:r,status:n===r?e.status:md}:e,[t,r,e,n])},$p=m.forwardRef(({smooth:e=!0,component:t="span",...n},r)=>{const{text:s,status:i}=gS(hS(),e);return d.jsx(t,{"data-status":i.type,...n,ref:r,children:s})});$p.displayName="MessagePartPrimitive.Text";const Up=m.forwardRef((e,t)=>{const{image:n}=vN();return d.jsx(Fe.img,{src:n,...e,ref:t})});Up.displayName="MessagePartPrimitive.Image";const hi=e=>{const t=m.useRef(void 0);return m.useCallback(n=>{t.current&&(t.current(),t.current=void 0),n&&(t.current=e(n))},[e])},Ky=(e,t)=>{const n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return Number.POSITIVE_INFINITY;const r=Number(n[1]),s=n[2];return s==="px"?r:s==="em"?r*(parseFloat(getComputedStyle(t).fontSize)||16):s==="rem"?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):Number.POSITIVE_INFINITY},CN=e=>e.dataset.messageId,EN=()=>{const e=document.createElement("div");return e.dataset.auiTopAnchorReserve="",e.style.height="0px",e.style.flexShrink="0",e.style.pointerEvents="none",e.setAttribute("aria-hidden","true"),e},Gy=(e,t)=>{const n=`${t}px`;return e.style.height!==n?(e.style.height=n,!0):!1},TN=e=>{const t=window.devicePixelRatio||1;return Math.round(e*t)/t},yS=()=>{const e=pe(),t=Y(()=>e.message());return hi(m.useCallback(n=>{const r=()=>{t.setIsHovering(!0)},s=()=>{t.setIsHovering(!1)};return n.addEventListener("mouseenter",r),n.addEventListener("mouseleave",s),n.matches(":hover")&&queueMicrotask(()=>t.setIsHovering(!0)),()=>{n.removeEventListener("mouseenter",r),n.removeEventListener("mouseleave",s),t.setIsHovering(!1)}},[t]))},IN=()=>{const e=ci(t=>t.topAnchorTurn?.anchorId);return Y(t=>t.message.role==="user"&&t.message.index>0&&t.message.index===t.thread.messages.length-2&&t.thread.messages.at(-1)?.role==="assistant"&&(t.message.id===e||t.thread.isRunning))},RN=()=>{const e=ci(t=>t.topAnchorTurn?.targetId);return Y(t=>t.message.isLast&&t.message.role==="assistant"&&t.message.index>=1&&t.thread.messages.at(t.message.index-1)?.role==="user"&&(t.message.id===e||t.thread.isRunning))},PN=(e,t)=>hi(m.useCallback(n=>{if(e)return t.getState().registerAnchorElement(n)},[e,t])),jN=({active:e,threadViewportStore:t})=>hi(m.useCallback(n=>{if(!e)return;const r=t.getState(),s=r.topAnchorMessageClamp;return r.registerAnchorTargetElement(n,{tallerThan:Ky(s.tallerThan,n),visibleHeight:Ky(s.visibleHeight,n)})},[e,t])),AN=({forwardedRef:e,...t})=>{const n=fi(e,yS()),r=Y(s=>s.message.id);return d.jsx(Fe.div,{...t,ref:n,"data-message-id":r})},NN=({forwardedRef:e,threadViewportStore:t,...n})=>{const r=yS(),s=IN(),i=RN(),o=fi(e,r,PN(s,t),jN({active:i,threadViewportStore:t})),a=Y(l=>l.message.id);return d.jsx(Fe.div,{...n,ref:o,"data-message-id":a,"data-aui-top-anchor-user":s?"":void 0,"data-aui-top-anchor-target":i?"":void 0})},vS=m.forwardRef((e,t)=>{const n=di();return n.getState().turnAnchor==="top"?d.jsx(NN,{...e,forwardedRef:t,threadViewportStore:n}):d.jsx(AN,{...e,forwardedRef:t})});vS.displayName="MessagePrimitive.Root";const gd={...jt,Text:()=>d.jsxs("p",{style:{whiteSpace:"pre-line"},children:[d.jsx($p,{}),d.jsx(Mp,{children:d.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>d.jsx(Up,{})},Kf=e=>{if("children"in e)return d.jsx(Wf,{children:e.children});const{components:t,...n}=e;return d.jsx(Wf,{components:t?{Text:t.Text??gd.Text,Image:t.Image??gd.Image,Reasoning:t.Reasoning??jt.Reasoning,Source:t.Source??jt.Source,File:t.File??jt.File,Unstable_Audio:t.Unstable_Audio??jt.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??jt.ToolGroup,ReasoningGroup:t.ReasoningGroup??jt.ReasoningGroup},Empty:t.Empty,Quote:t.Quote,generativeUI:t.generativeUI}:gd,...n})};Kf.displayName="MessagePrimitive.Parts";const xS=({children:e})=>Oj()!==void 0?e:null;xS.displayName="MessagePrimitive.Error";const MN=e=>{const t=new Map;for(let r=0;r<e.length;r++){const s=e[r]?.parentId??`__ungrouped_${r}`,i=t.get(s)??[];i.push(r),t.set(s,i)}const n=[];for(const[r,s]of t){const i=r.startsWith("__ungrouped_")?void 0:r;n.push({groupKey:i,indices:s})}return n},DN=e=>{const t=Y(n=>n.message.parts);return m.useMemo(()=>t.length===0?[]:e(t),[t,e])},LN=({Fallback:e,...t})=>{const n=Y(r=>{const s=r.tools.tools[t.toolName]??e;return Array.isArray(s)?s[0]??e:s});return n?d.jsx(n,{...t}):null},ON=({Fallback:e,...t})=>{const n=Y(r=>{const s=r.dataRenderers.renderers[t.name]??e;return Array.isArray(s)?s[0]??e:s});return n?d.jsx(n,{...t}):null},es={Text:()=>d.jsxs("p",{style:{whiteSpace:"pre-line"},children:[d.jsx($p,{}),d.jsx(Mp,{children:d.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>d.jsx(Up,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},zN=({components:{Text:e=es.Text,Reasoning:t=es.Reasoning,Image:n=es.Image,Source:r=es.Source,File:s=es.File,Unstable_Audio:i=es.Unstable_Audio,tools:o={},data:a}={}})=>{const l=pe(),u=Y(f=>f.part),c=u.type;if(c==="tool-call"){const f=l.part().addToolResult,h=l.part().resumeToolCall,p=l.part().respondToToolApproval;if("Override"in o)return d.jsx(o.Override,{...u,addResult:f,resume:h,respondToApproval:p});const g=o.by_name?.[u.toolName]??o.Fallback;return d.jsx(LN,{...u,Fallback:g,addResult:f,resume:h,respondToApproval:p})}if(u.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(c){case"text":return d.jsx(e,{...u});case"reasoning":return d.jsx(t,{...u});case"source":return d.jsx(r,{...u});case"image":return d.jsx(n,{...u});case"file":return d.jsx(s,{...u});case"audio":return d.jsx(i,{...u});case"data":{const f=a?.by_name?.[u.name]??a?.Fallback;return d.jsx(ON,{...u,Fallback:f})}default:return console.warn(`Unknown message part type: ${c}`),null}},FN=({partIndex:e,components:t})=>d.jsx(Ip,{index:e,children:d.jsx(zN,{components:t})}),BN=m.memo(FN,(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),$N=({status:e,component:t})=>d.jsx(Rp,{text:"",isRunning:e.type==="running",children:d.jsx(t,{type:"text",text:"",status:e})}),UN=Object.freeze({type:"complete"}),VN=({components:e})=>{const t=Y(n=>n.message.status??UN);return e?.Empty?d.jsx(e.Empty,{status:t}):d.jsx($N,{status:t,component:e?.Text??es.Text})},HN=m.memo(VN,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),Vp=({groupingFunction:e,components:t})=>{const n=Y(s=>s.message.parts.length),r=DN(e);return d.jsx(d.Fragment,{children:m.useMemo(()=>n===0?d.jsx(HN,{components:t}):r.map((s,i)=>d.jsx(t?.Group??es.Group,{groupKey:s.groupKey,indices:s.indices,children:s.indices.map(o=>d.jsx(BN,{partIndex:o,components:t},o))},`group-${i}-${s.groupKey??"ungrouped"}`)),[r,t,n])})};Vp.displayName="MessagePrimitive.Unstable_PartsGrouped";const wS=({components:e,...t})=>d.jsx(Vp,{...t,components:e,groupingFunction:MN});wS.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId";var Du=xo({AttachmentByIndex:()=>v0,Attachments:()=>x0,Content:()=>Kf,Error:()=>xS,GenerativeUI:()=>o0,GroupedParts:()=>m0,If:()=>V0,PartByIndex:()=>ra,Parts:()=>Kf,Quote:()=>g0,Root:()=>vS,Unstable_PartsGrouped:()=>Vp,Unstable_PartsGroupedByParentId:()=>wS});const WN=e=>{const t=ii(e);return hi(m.useCallback(n=>{const r=new ResizeObserver(()=>{t()}),s=new MutationObserver(i=>{i.some(o=>o.type!=="attributes"||o.attributeName!=="style")&&t()});return r.observe(n),s.observe(n,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{r.disconnect(),s.disconnect()}},[t]))},qN=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{const s=m.useRef(null),i=Y(k=>k.thread.messages.length>0),o=m.useRef(!1),a=m.useRef(null),l=di();e===void 0&&(e=l.getState().turnAnchor!=="top");const u=m.useRef(0),c=m.useRef(0),f=m.useRef(0),h=m.useRef(0),p=m.useRef(null),g=m.useCallback(k=>{const _=s.current;_&&(p.current=k,_.scrollTo({top:_.scrollHeight,behavior:k}))},[]),y=m.useCallback(k=>{p.current=k,a.current!==null&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{a.current=null,g(k)})},[g]);m.useLayoutEffect(()=>()=>{a.current!==null&&cancelAnimationFrame(a.current)},[]);const b=m.useCallback(()=>{const k=l.getState();return k.turnAnchor==="top"&&k.element.viewport===s.current&&k.element.anchor!==null},[l]),x=()=>{const k=s.current;if(!k)return;const _=l.getState().isAtBottom,S=Math.abs(k.scrollHeight-k.scrollTop-k.clientHeight)<=1||k.scrollHeight<=k.clientHeight;!S&&u.current<k.scrollTop||(S?k.scrollHeight>k.clientHeight+1&&(p.current=null):u.current>k.scrollTop&&c.current===k.scrollHeight&&(p.current=null),(S||p.current===null)&&S!==_&&Au(l).setState({isAtBottom:S})),u.current=k.scrollTop,c.current=k.scrollHeight},v=WN(()=>{const k=s.current;if(!k)return;const{scrollHeight:_,clientHeight:S}=k;if(_===f.current&&S===h.current)return;f.current=_,h.current=S;const T=p.current;T&&b()?p.current=null:T?g(T):e&&l.getState().isAtBottom&&g("instant"),x()}),w=hi(k=>(k.addEventListener("scroll",x),()=>{k.removeEventListener("scroll",x)}));return m.useLayoutEffect(()=>{if(n){if(!i){o.current=!1;return}o.current||(o.current=!0,p.current===null&&y("instant"))}},[i,y,n]),Z0(({behavior:k})=>{g(k)}),Iu("thread.runStart",()=>{t&&l.getState().turnAnchor!=="top"&&y("auto")}),Iu("threadListItem.switchedTo",()=>{r&&y("instant")}),fi(v,w,s)},bS=m.forwardRef((e,t)=>d.jsx(Fe.div,{...e,ref:t}));bS.displayName="ThreadPrimitive.Root";const _S=({children:e})=>Y(t=>t.thread.isEmpty)?e:null;_S.displayName="ThreadPrimitive.Empty";const KN=e=>Y(t=>!(e.empty===!0&&!t.thread.isEmpty||e.empty===!1&&t.thread.isEmpty||e.running===!0&&!t.thread.isRunning||e.running===!1&&t.thread.isRunning||e.disabled===!0&&!t.thread.isDisabled||e.disabled===!1&&t.thread.isDisabled)),SS=({children:e,...t})=>KN(t)?e:null;SS.displayName="ThreadPrimitive.If";const kS=(e,t)=>hi(m.useCallback(n=>{if(!e)return;const r=e(),s=()=>{const o=t?t(n):n.offsetHeight;r.setHeight(o)},i=new ResizeObserver(s);return i.observe(n),s(),()=>{i.disconnect(),r.unregister()}},[e,t])),Yy=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},GN=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:Yy(e)-Yy(t)},CS=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{const s=GN(t,e),i=t.offsetHeight;return s+Math.max(0,i-(i<=n?i:r))},YN=({scrollHeight:e,...t})=>{const{viewport:n}=t,r=CS(t)+n.clientHeight;return Math.max(0,r-e)},QN=({viewport:e,reserve:t,...n})=>YN({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),XN=e=>{const t=new ResizeObserver(e),n=new MutationObserver(e);let r=null,s=null,i=null;const o=()=>{t.disconnect(),n.disconnect(),r=null,s=null,i=null};return{target:(a,l,u)=>{r===a&&s===l&&i===u||(o(),t.observe(a),t.observe(l),t.observe(u),n.observe(u,{childList:!0,subtree:!0,characterData:!0}),r=a,s=l,i=u)},disconnect:o}},JN=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},ZN=e=>{let t=null,n;function r(){const a=e.getState(),{viewport:l,anchor:u,target:c}=a.element,f=a.targetConfig;if(a.turnAnchor!=="top"||!l||!u||!c||!f){i.disconnect(),t&&(Gy(t,0),t.remove());return}if(t??(t=EN()),(t.parentElement!==c.parentElement||t.previousElementSibling!==c)&&c.after(t),i.target(l,u,c),Gy(t,QN({viewport:l,anchor:u,reserve:t,...f}))){s.schedule();return}const h=CN(u);if(h!==void 0&&n===h)return;const p=TN(CS({viewport:l,anchor:u,...f}));Math.abs(l.scrollTop-p)>1&&l.scrollTo({top:p,behavior:"smooth"}),h!==void 0&&(n=h)}const s=JN(r),i=XN(s.schedule);s.schedule();const o=e.subscribe(s.schedule);return()=>{s.cancel(),o(),i.disconnect(),t?.remove()}},eM=e=>{const t=di();m.useLayoutEffect(()=>{if(e)return ZN(t)},[e,t])},ES=({isRunning:e,messages:t})=>{if(!e)return null;const n=t.at(-1),r=t.at(-2);return r?.role!=="user"||n?.role!=="assistant"?null:{anchorId:r.id,targetId:n.id}},tM=e=>ES(e)?.anchorId,nM=e=>ES(e)?.targetId,rM=()=>kS(ci(e=>e.registerViewport),m.useCallback(e=>e.clientHeight,[])),sM=()=>hi(ci(e=>e.registerViewportElement)),iM=e=>{const t=di(),n=Y(o=>{if(e)return tM(o.thread)}),r=Y(o=>{if(e)return nM(o.thread)}),s=m.useMemo(()=>!n||!r?null:{anchorId:n,targetId:r},[n,r]);m.useLayoutEffect(()=>{if(!s)return;const o=t.getState(),a=o.topAnchorTurn;a?.anchorId===s.anchorId&&a.targetId===s.targetId||o.setTopAnchorTurn(s)},[s,t]);const i=m.useCallback(()=>{t.getState().setTopAnchorTurn(null)},[t]);Iu("thread.initialize",i),Iu("threadListItem.switchedTo",i)},TS=m.forwardRef(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r,children:s,...i},o)=>{const a=qN({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r}),l=rM(),u=sM(),c=di().getState().turnAnchor==="top";iM(c),eM(c);const f=fi(o,a,l,u);return d.jsx(Fe.div,{...i,ref:f,children:s})});TS.displayName="ThreadPrimitive.ViewportScrollable";const IS=m.forwardRef(({turnAnchor:e,topAnchorMessageClamp:t,...n},r)=>d.jsx(Dp,{options:{turnAnchor:e,topAnchorMessageClamp:t},children:d.jsx(TS,{...n,ref:r})}));IS.displayName="ThreadPrimitive.Viewport";const RS=m.forwardRef((e,t)=>{const n=fi(t,kS(ci(r=>r.registerContentInset),m.useCallback(r=>{const s=parseFloat(getComputedStyle(r).marginTop)||0;return r.offsetHeight+s},[])));return d.jsx(Fe.div,{...e,ref:n})});RS.displayName="ThreadPrimitive.ViewportFooter";const oM=({behavior:e}={})=>{const t=ci(s=>s.isAtBottom),n=di(),r=m.useCallback(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},aM=ar("ThreadPrimitive.ScrollToBottom",oM,["behavior"]),lM=({prompt:e,send:t,clearComposer:n,autoSend:r,method:s})=>{const{disabled:i,trigger:o}=Lj({prompt:e,send:t??r??!1,clearComposer:n});return i?null:o},uM=ar("ThreadPrimitive.Suggestion",lM,["prompt","send","clearComposer","autoSend","method"]);var _t=xo({Empty:()=>_S,If:()=>SS,MessageByIndex:()=>n0,Messages:()=>HP,Root:()=>bS,ScrollToBottom:()=>aM,Suggestion:()=>uM,SuggestionByIndex:()=>C0,Suggestions:()=>Sj,Viewport:()=>IS,ViewportFooter:()=>RS,ViewportProvider:()=>Dp}),cM=xo({AssistantRuntimeImpl:()=>Y_,BaseAssistantRuntimeCore:()=>Q_,CompositeContextProvider:()=>_p,DefaultThreadComposerRuntimeCore:()=>Z_,MessageRepository:()=>jp,ThreadRuntimeImpl:()=>G_,fromThreadMessageLike:()=>ja,generateId:()=>Ss,getAutoStatus:()=>Pu,splitLocalRuntimeOptions:()=>zj,useComposerInputPluginRegistryOptional:()=>bc,useSmooth:()=>gS,useSmoothStatus:()=>_N,withSmoothContextProvider:()=>bN});const Hp="claude-control.token";let Lu=null,Ou=!1;function dM(){try{return window.localStorage.getItem(Hp)}catch{return null}}const fM="claude-control";function _c(){return Ou||(Lu=dM(),Ou=!0),Lu}function PS(e){Lu=e,Ou=!0;try{window.localStorage.setItem(Hp,e)}catch{}}function jS(){Lu=null,Ou=!0;try{window.localStorage.removeItem(Hp)}catch{}}function hM(){if(typeof window>"u"||!window.location)return;let e;try{e=new URLSearchParams(window.location.search)}catch{return}const t=e.get("token");if(!t)return;PS(t),e.delete("token");const n=e.toString(),r=window.location.pathname+(n?`?${n}`:"")+window.location.hash;try{window.history.replaceState(null,"",r)}catch{}}hM();const Gf=new Set;function pM(e){return Gf.add(e),()=>Gf.delete(e)}function AS(){jS();for(const e of Gf)e()}function mM(e){const t=_c(),n={...e??{}};return t&&(n.Authorization=`Bearer ${t}`),n}async function st(e,t){const n=await fetch(e,{...t,headers:mM(t?.headers)});return n.status===401&&AS(),n}function gM(e){const t=`/term/${encodeURIComponent(e)}/`,n=_c();return n?`${t}?token=${encodeURIComponent(n)}`:t}function yM(){const e=window.location;return`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}/`}async function NS(){try{const e=await st("/api/version");return e.ok?await e.json():null}catch{return null}}async function vM(){try{const e=await st("/api/update",{method:"POST"}),t=await e.json().catch(()=>({}));return e.ok&&!!t.ok}catch{return!0}}async function xM(){try{const e=await st("/api/push/vapid");return e.ok?(await e.json()).publicKey??null:null}catch{return null}}async function wM(e){try{return(await st("/api/push/subscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).ok}catch{return!1}}async function bM(e){try{return(await st("/api/push/unsubscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:e})})).ok}catch{return!1}}async function _M(e){const t=await st("/api/icon",{method:"POST",body:e}),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok)throw new Error(n.error||`HTTP ${t.status}`)}async function SM(){const e=await st("/api/icon",{method:"DELETE"}),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw new Error(t.error||`HTTP ${e.status}`)}async function kM(){const e=await st("/api/models");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function CM(e,t){const n=await st("/api/optimize",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:e})}),r=await n.json().catch(()=>({}));if(!n.ok||typeof r.optimized!="string")throw new Error(r.error||`HTTP ${n.status}`);return{optimized:r.optimized,rationale:r.rationale??[],changes:r.changes??[],mode:r.mode==="rules"?"rules":"llm"}}async function EM(e,t="webm",n){const r=await st(`/api/transcribe?ext=${encodeURIComponent(t)}`,{method:"POST",body:e,signal:n}),s=await r.json().catch(()=>({}));if(!r.ok||!s.ok)throw new Error(s.error||`HTTP ${r.status}`);return s.text??""}async function Wp(){const e=await st("/api/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function TM(e){const t=await st("/api/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error("error"in n&&n.error||`HTTP ${t.status}`);return n}async function MS(e){const t=await st("/api/session/new",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e??{})}),n=await t.json().catch(()=>({}));if(!t.ok||!("ok"in n)||!n.ok){const r="error"in n&&n.error||`HTTP ${t.status}`;throw new Error(r)}return n}async function IM(){const e=await st("/api/spawn-agents"),t=await e.json().catch(()=>({}));if(!e.ok||!("agents"in t)){const n="error"in t&&t.error||`HTTP ${e.status}`;throw new Error(n)}return t.agents}async function RM(e,t){const n=await st("/api/session/rename",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,name:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!("ok"in r)||!r.ok){const s="error"in r&&r.error||`HTTP ${n.status}`;throw new Error(s)}}function PM(e){return`/api/uploads/${encodeURIComponent(e)}`}async function jM(){const e=await st("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).processes??[]}async function AM(e,t){const n=await st("/api/kill",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e,signal:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw new Error(r.error||`HTTP ${n.status}`)}async function DS(e){const t=e?`/api/skills?id=${encodeURIComponent(e)}`:"/api/skills",n=await st(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).skills??[]}async function NM(e){const t=e?`/api/agents?id=${encodeURIComponent(e)}`:"/api/agents",n=await st(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).agents??[]}async function MM(e){const t=`/api/upload?name=${encodeURIComponent(e.name)}`,n=await st(t,{method:"POST",body:e});let r=null;try{r=await n.json()}catch{}const s=r??{};if(!n.ok||!s.ok||!s.path)throw new Error(s.error||`HTTP ${n.status}`);return{ok:!0,path:s.path,name:s.name??e.name}}const DM=1008,Qy=1e3,LM=3e4;class OM{constructor(){N(this,"ws",null);N(this,"reconnectTimer",null);N(this,"reconnectDelay",Qy);N(this,"selectedId",null);N(this,"closed",!1);N(this,"msgHandlers",new Set);N(this,"stateHandlers",new Set)}connect(){if(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.emitState("connecting");const t=_c(),n=t?[fM,t]:void 0,r=new WebSocket(yM(),n);this.ws=r,r.addEventListener("open",()=>{this.reconnectDelay=Qy,this.emitState("connected"),this.selectedId&&this.send({type:"subscribe",id:this.selectedId})}),r.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}for(const o of this.msgHandlers)o(i)}),r.addEventListener("close",s=>{if(this.ws=null,this.emitState("disconnected"),s.code===DM){AS();return}this.closed||this.scheduleReconnect()}),r.addEventListener("error",()=>{})}scheduleReconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>this.connect(),this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,LM)}send(t){return this.ws&&this.ws.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify(t)),!0):!1}isOpen(){return this.ws?.readyState===WebSocket.OPEN}select(t){this.selectedId!==t&&(this.selectedId&&this.send({type:"unsubscribe",id:this.selectedId}),this.selectedId=t,t&&this.send({type:"subscribe",id:t}))}resubscribe(){const t=this.selectedId;t&&(this.send({type:"unsubscribe",id:t}),this.send({type:"subscribe",id:t}))}onMessage(t){return this.msgHandlers.add(t),()=>this.msgHandlers.delete(t)}onState(t){return this.stateHandlers.add(t),()=>this.stateHandlers.delete(t)}emitState(t){for(const n of this.stateHandlers)n(t)}close(){this.closed=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.ws?.close(),this.ws=null}}const Xy=2e3;function zM(e,t){if(!e||e.length===0)return Jy(t);if(t.length===0)return e;const n=new Set;for(const s of e)n.add(s.uuid);const r=t.filter(s=>!n.has(s.uuid));return r.length===0?e:Jy([...e,...r])}function Jy(e){return e.length>Xy?e.slice(e.length-Xy):e}const FM=10*6e4;function BM(){const e=m.useRef(null);e.current||(e.current=new OM);const t=e.current,[n,r]=m.useState([]),[s,i]=m.useState(null),[o,a]=m.useState("connecting"),[l,u]=m.useState({snapshot:null,warning:null}),[c,f]=m.useState([]),[h,p]=m.useState(null),[g,y]=m.useState(null),[b,x]=m.useState({}),[v,w]=m.useState({}),[k,_]=m.useState({}),[S,T]=m.useState({}),P=m.useRef(null);P.current=s;const R=m.useRef([]);R.current=n,m.useEffect(()=>{const oe=t.onState(a),le=t.onMessage(se=>{switch(se.type){case"sessions":r(we=>{const He=new Map(we.map(Ge=>[Ge.id,Ge]));return(se.sessions??[]).map(Ge=>{const Et=He.get(Ge.id);return Et?{...Ge,model:Ge.model??Et.model,ctxPct:Ge.ctxPct??Et.ctxPct}:Ge})});break;case"messages":x(we=>({...we,[se.id]:zM(we[se.id],se.messages??[])})),w(we=>({...we,[se.id]:se.pending??null}));break;case"append":x(we=>({...we,[se.id]:[...we[se.id]??[],...se.messages??[]]}));break;case"pending":w(we=>({...we,[se.id]:se.pending})),r(we=>we.map(He=>He.id===se.id?{...He,pending:!!se.pending}:He));break;case"resources":{const we=se.snapshot??null;if(u({snapshot:we,warning:se.warning??null}),we){const He=Date.now(),Ge={t:He,cpu:we.self?.cpuPct??0,mem:we.system?.memUsedPct??0};f(Et=>[...Et,Ge].filter(qn=>He-qn.t<=FM))}break}case"capture":se.id===P.current&&p(se.text??"");break;case"shell-output":(!se.id||se.id===P.current)&&y(se.text??"");break;case"prompt":T(we=>({...we,[se.id]:se.prompt}));break;case"subagents":_(we=>({...we,[se.id]:Object.fromEntries((se.subagents??[]).map(He=>[He.agentId,He]))}));break;case"subagent":_(we=>({...we,[se.id]:{...we[se.id]??{},[se.subagent.agentId]:se.subagent}}));break;case"ack":window.dispatchEvent(new CustomEvent("cockpit:ack",{detail:se}));break}});return t.connect(),()=>{oe(),le()}},[t]),m.useEffect(()=>()=>t.close(),[t]);const C=m.useCallback(oe=>{oe!==P.current&&(i(oe),p(null),t.select(oe))},[t]),M=m.useCallback(oe=>{const le=P.current;return!le||!oe.trim()?!1:t.send({type:"reply",id:le,text:oe})},[t]),D=m.useCallback((oe,le)=>{const se=P.current;return se?t.send({type:"answer",id:se,toolUseId:oe,selections:le}):!1},[t]),U=m.useCallback((oe,le)=>{const se=P.current;return se?t.send({type:"capture",id:se,lines:oe,escapes:le}):!1},[t]),V=m.useCallback(()=>p(null),[]),W=m.useCallback(oe=>{const le=P.current;return le?t.send({type:"pane-text",id:le,text:oe}):!1},[t]),J=m.useCallback(oe=>{const le=P.current;return le?t.send({type:"pane-key",id:le,key:oe}):!1},[t]),ne=m.useCallback(oe=>{const le=P.current;return le?t.send({type:"shell-input",id:le,line:oe}):!1},[t]),$=m.useCallback(oe=>{const le=P.current;return le?t.send({type:"shell-text",id:le,text:oe}):!1},[t]),F=m.useCallback(oe=>{const le=P.current;return le?t.send({type:"shell-key",id:le,key:oe}):!1},[t]),E=m.useCallback(oe=>{const le=P.current;return le?t.send({type:"shell-capture",id:le,lines:oe}):!1},[t]),X=m.useCallback(()=>y(null),[]),Z=m.useCallback(()=>t.resubscribe(),[t]),I=m.useCallback(oe=>{const le=P.current;return le?t.send({type:"promptkey",id:le,key:oe}):!1},[t]),O=m.useCallback((oe,le)=>t.send({type:"promptselect",id:oe,labels:le}),[t]),te=m.useMemo(()=>s!=null&&s in b,[s,b]),de=m.useMemo(()=>s?b[s]??[]:[],[s,b]),it=m.useMemo(()=>s?v[s]??null:null,[s,v]),Ke=m.useMemo(()=>s?S[s]??null:null,[s,S]),je=m.useMemo(()=>{const oe=s?k[s]:null;return oe?Object.values(oe).sort((le,se)=>(se.createdAt??-1/0)-(le.createdAt??-1/0)):[]},[s,k]),xe=m.useMemo(()=>{const oe={};for(const[le,se]of Object.entries(k)){const we=Object.values(se).filter(He=>He.status==="running").length;we>0&&(oe[le]=we)}return oe},[k]);return{sessions:n,selectedId:s,messages:de,messagesLoaded:te,pending:it,prompt:Ke,subagents:je,runningSubagentCountById:xe,conn:o,resources:l,resourceHistory:c,capture:h,shellOutput:g,select:C,resubscribe:Z,sendReply:M,sendPromptKey:I,sendPromptSelect:O,sendAnswer:D,requestCapture:U,clearCapture:V,sendPaneText:W,sendPaneKey:J,sendShellInput:ne,sendShellText:$,sendShellKey:F,requestShellCapture:E,clearShellOutput:X}}const yd="cc:push:intent";function $M(){return typeof window>"u"||!("serviceWorker"in navigator)||!("PushManager"in window)||!("Notification"in window)?!1:window.isSecureContext===!0}function UM(){if(typeof navigator>"u")return!1;const e=navigator.userAgent||"",t=/iPad|iPhone|iPod/.test(e),n=navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>1;return t||n}function Zy(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new ArrayBuffer(r.length),i=new Uint8Array(s);for(let o=0;o<r.length;o+=1)i[o]=r.charCodeAt(o);return s}function VM(){const e=$M(),t=UM(),[n,r]=m.useState(e?"off":"unsupported"),s=m.useCallback(async()=>{const a=await navigator.serviceWorker.register("/sw.js");if(await navigator.serviceWorker.ready,await Notification.requestPermission()!=="granted")return r("denied"),!1;const u=await xM();if(!u)return r("off"),!1;let c=await a.pushManager.getSubscription();if(c)try{const h=Zy(u),p=c.options?.applicationServerKey;let g=!1;if(p instanceof ArrayBuffer){const y=new Uint8Array(p),b=new Uint8Array(h);if(y.length!==b.length)g=!0;else for(let x=0;x<y.length;x++)if(y[x]!==b[x]){g=!0;break}}g&&(await c.unsubscribe(),c=null)}catch{}return c||(c=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Zy(u)})),await wM(c.toJSON())},[]),i=m.useCallback(async()=>{if(e){r("working");try{await s()?(localStorage.setItem(yd,"1"),r("on")):r(l=>l==="denied"?"denied":"off")}catch{r("off")}}},[e,s]),o=m.useCallback(async()=>{r("working"),localStorage.removeItem(yd);try{const l=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();l&&(await bM(l.endpoint),await l.unsubscribe())}catch{}r("off")},[]);return m.useEffect(()=>{if(!e||localStorage.getItem(yd)!=="1")return;if(Notification.permission!=="granted"){r(Notification.permission==="denied"?"denied":"off");return}let a=!1;return(async()=>{try{const l=await s();a||r(l?"on":"off")}catch{a||r("off")}})(),()=>{a=!0}},[e,s]),{status:n,supported:e,iosHint:t,enable:i,disable:o}}const Yf=70,HM=110,WM=.5,qM=".thread-viewport, .rail-scroll, .live-pane-body";function KM(e,t=()=>window.location.reload()){const[n,r]=m.useState(0),[s,i]=m.useState(!1),o=m.useRef(0),a=m.useRef(!1),l=m.useRef(0),u=m.useRef(null),c=f=>{o.current=f,r(f)};return m.useEffect(()=>{const f=e.current;if(!f)return;const h=y=>{if(y.touches.length!==1){a.current=!1;return}const x=y.target?.closest(qM)??null;x&&x.scrollTop<=0?(u.current=x,l.current=y.touches[0].clientY,a.current=!0):a.current=!1},p=y=>{if(!a.current)return;const b=y.touches[0].clientY-l.current,x=u.current;if(b<=0||x&&x.scrollTop>0){o.current!==0&&c(0),x&&x.scrollTop>0&&(a.current=!1);return}const v=Math.min(HM,b*WM);c(v),y.cancelable&&y.preventDefault()},g=()=>{a.current&&(a.current=!1,o.current>=Yf?(c(Yf),i(!0),setTimeout(t,150)):c(0))};return f.addEventListener("touchstart",h,{passive:!0}),f.addEventListener("touchmove",p,{passive:!1}),f.addEventListener("touchend",g,{passive:!0}),f.addEventListener("touchcancel",g,{passive:!0}),()=>{f.removeEventListener("touchstart",h),f.removeEventListener("touchmove",p),f.removeEventListener("touchend",g),f.removeEventListener("touchcancel",g)}},[e,t]),{pull:n,refreshing:s}}const GM=Yf,zu="__cockpitSummary";function YM(e){if(e&&typeof e=="object"&&zu in e){const t=e[zu];return typeof t=="string"?t:""}return""}function LS(e){if(!e||typeof e!="object")return e;const t={};for(const[n,r]of Object.entries(e))n!==zu&&(t[n]=r);return t}function QM(e){if(e&&typeof e=="object"&&"text"in e){const t=e;return{text:String(t.text??""),isError:!!t.isError}}return null}function OS(e){const t=new Map;for(const s of e)for(const i of s.blocks??[])i.kind==="tool_result"&&t.set(i.forId,{text:i.text??"",isError:!!i.isError});const n=[],r=new Set;return e.forEach((s,i)=>{const o=ZM(s.blocks??[],t,s.role==="user");if(o.length===0)return;const a=s.role==="user"?"user":"assistant";let l=s.uuid||`m-${i}`;r.has(l)&&(l=`${l}#${i}`),r.add(l),n.push({role:a,id:l,createdAt:s.ts?new Date(s.ts):void 0,content:o,metadata:{custom:{cockpitRole:s.role}}})}),XM(n)}function XM(e){const t=r=>r.role==="assistant"&&(r.metadata?.custom?.cockpitRole??"assistant")==="assistant",n=[];for(const r of e){const s=n[n.length-1];s&&t(s)&&t(r)?n[n.length-1]={...s,content:[...s.content,...r.content]}:n.push(r)}return n}function JM(e){const t=e.trimStart();if(!t.startsWith("<"))return null;const n=/<summary>([\s\S]*?)<\/summary>/.exec(t)?.[1]?.trim();return t.startsWith("<task-notification")?`⚙ background task ${n?`— ${n}`:"update"}`:t.startsWith("<system-reminder")?"⚙ system reminder":t.startsWith("<command-name")||t.startsWith("<command-message")?"⌘ slash command":t.startsWith("<local-command-stdout")?"⌘ command output":t.startsWith("<user-prompt-submit-hook")||t.startsWith("<session-")?"⚙ session hook":null}function ZM(e,t,n=!1){const r=[];for(const s of e)switch(s.kind){case"text":{if(s.text&&s.text.length>0){const i=n?JM(s.text):null;r.push({type:"text",text:i??s.text})}break}case"thinking":{s.text&&s.text.trim().length>0&&r.push({type:"reasoning",text:s.text});break}case"tool_use":{const i=t.get(s.id),o=s.input&&typeof s.input=="object"?s.input:s.input!=null?{value:s.input}:{};r.push({type:"tool-call",toolCallId:s.id,toolName:s.name||"tool",args:{...o,[zu]:s.inputSummary??""},argsText:s.inputSummary??"",result:i??void 0,isError:i?.isError});break}}return r}const e2="image/*,application/pdf,text/*,.md,.json,.csv,.log",Qf=" cockpit-path:";function t2(e){return Qf+e}const Yl=new Map;function n2(e){return Yl.get(e)??null}function r2(e){for(const t of e.content??[])if(t.type==="text"&&t.text.startsWith(Qf))return t.text.slice(Qf.length);return n2(e.id)}function s2(e){return`${e.name}-${e.size}-${e.lastModified}`}function i2(e){return{accept:e2,async add({file:t}){const n=s2(t),r=t.type.startsWith("image/"),s=t.type==="application/pdf",i={id:n,type:r?"image":s?"document":"file",name:t.name,contentType:t.type||"application/octet-stream",file:t};e(`Uploading ${t.name}…`);try{const o=await MM(t);return Yl.set(n,o.path),e(`Attached ${o.name}`,"ok"),{...i,status:{type:"requires-action",reason:"composer-send"}}}catch(o){const a=o instanceof Error?o.message:String(o);return e(`Attach failed: ${a}`,"error"),{...i,status:{type:"incomplete",reason:"error"}}}},async send(t){const n=Yl.get(t.id);if(!n)throw new Error(`attachment ${t.name} was not uploaded`);return{...t,status:{type:"complete"},content:[{type:"text",text:t2(n)}]}},async remove(t){Yl.delete(t.id)}}}function Ar(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
|
|
45
|
+
* GSAP 3.15.0
|
|
46
|
+
* https://gsap.com
|
|
47
|
+
*
|
|
48
|
+
* @license Copyright 2008-2026, GreenSock. All rights reserved.
|
|
49
|
+
* Subject to the terms at https://gsap.com/standard-license
|
|
50
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
51
|
+
*/var Sn={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Aa={duration:.5,overwrite:!1,delay:0},qp,kt,qe,Fn=1e8,Me=1/Fn,Xf=Math.PI*2,o2=Xf/4,a2=0,FS=Math.sqrt,l2=Math.cos,u2=Math.sin,xt=function(t){return typeof t=="string"},rt=function(t){return typeof t=="function"},Hr=function(t){return typeof t=="number"},Kp=function(t){return typeof t>"u"},kr=function(t){return typeof t=="object"},sn=function(t){return t!==!1},Gp=function(){return typeof window<"u"},Tl=function(t){return rt(t)||xt(t)},BS=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Mt=Array.isArray,c2=/random\([^)]+\)/g,d2=/,\s*/g,ev=/(?:-?\.?\d|\.)+/gi,$S=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Li=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,vd=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,US=/[+-]=-?[.\d]+/,f2=/[^,'"\[\]\s]+/gi,h2=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Xe,pr,Jf,Yp,Tn={},Fu={},VS,HS=function(t){return(Fu=oo(t,Tn))&&un},Qp=function(t,n){return console.warn("Invalid property",t,"set to",n,"Missing plugin? gsap.registerPlugin()")},Na=function(t,n){return!n&&console.warn(t)},WS=function(t,n){return t&&(Tn[t]=n)&&Fu&&(Fu[t]=n)||Tn},Ma=function(){return 0},p2={suppressEvents:!0,isStart:!0,kill:!1},Ql={suppressEvents:!0,kill:!1},m2={suppressEvents:!0},Xp={},vs=[],Zf={},qS,yn={},xd={},tv=30,Xl=[],Jp="",Zp=function(t){var n=t[0],r,s;if(kr(n)||rt(n)||(t=[t]),!(r=(n._gsap||{}).harness)){for(s=Xl.length;s--&&!Xl[s].targetTest(n););r=Xl[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new pk(t[s],r)))||t.splice(s,1);return t},Gs=function(t){return t._gsap||Zp(Bn(t))[0]._gsap},KS=function(t,n,r){return(r=t[n])&&rt(r)?t[n]():Kp(r)&&t.getAttribute&&t.getAttribute(n)||r},on=function(t,n){return(t=t.split(",")).forEach(n)||t},lt=function(t){return Math.round(t*1e5)/1e5||0},Ye=function(t){return Math.round(t*1e7)/1e7||0},qi=function(t,n){var r=n.charAt(0),s=parseFloat(n.substr(2));return t=parseFloat(t),r==="+"?t+s:r==="-"?t-s:r==="*"?t*s:t/s},g2=function(t,n){for(var r=n.length,s=0;t.indexOf(n[s])<0&&++s<r;);return s<r},Bu=function(){var t=vs.length,n=vs.slice(0),r,s;for(Zf={},vs.length=0,r=0;r<t;r++)s=n[r],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},em=function(t){return!!(t._initted||t._startAt||t.add)},GS=function(t,n,r,s){vs.length&&!kt&&Bu(),t.render(n,r,!!(kt&&n<0&&em(t))),vs.length&&!kt&&Bu()},YS=function(t){var n=parseFloat(t);return(n||n===0)&&(t+"").match(f2).length<2?n:xt(t)?t.trim():t},QS=function(t){return t},In=function(t,n){for(var r in n)r in t||(t[r]=n[r]);return t},y2=function(t){return function(n,r){for(var s in r)s in n||s==="duration"&&t||s==="ease"||(n[s]=r[s])}},oo=function(t,n){for(var r in n)t[r]=n[r];return t},nv=function e(t,n){for(var r in n)r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&(t[r]=kr(n[r])?e(t[r]||(t[r]={}),n[r]):n[r]);return t},$u=function(t,n){var r={},s;for(s in t)s in n||(r[s]=t[s]);return r},sa=function(t){var n=t.parent||Xe,r=t.keyframes?y2(Mt(t.keyframes)):In;if(sn(t.inherit))for(;n;)r(t,n.vars.defaults),n=n.parent||n._dp;return t},v2=function(t,n){for(var r=t.length,s=r===n.length;s&&r--&&t[r]===n[r];);return r<0},XS=function(t,n,r,s,i){var o=t[s],a;if(i)for(a=n[i];o&&o[i]>a;)o=o._prev;return o?(n._next=o._next,o._next=n):(n._next=t[r],t[r]=n),n._next?n._next._prev=n:t[s]=n,n._prev=o,n.parent=n._dp=t,n},Sc=function(t,n,r,s){r===void 0&&(r="_first"),s===void 0&&(s="_last");var i=n._prev,o=n._next;i?i._next=o:t[r]===n&&(t[r]=o),o?o._prev=i:t[s]===n&&(t[s]=i),n._next=n._prev=n.parent=null},ks=function(t,n){t.parent&&(!n||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Ys=function(t,n){if(t&&(!n||n._end>t._dur||n._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t},x2=function(t){for(var n=t.parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return t},eh=function(t,n,r,s){return t._startAt&&(kt?t._startAt.revert(Ql):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(n,!0,s))},w2=function e(t){return!t||t._ts&&e(t.parent)},rv=function(t){return t._repeat?ao(t._tTime,t=t.duration()+t._rDelay)*t:0},ao=function(t,n){var r=Math.floor(t=Ye(t/n));return t&&r===t?r-1:r},Uu=function(t,n){return(t-n._start)*n._ts+(n._ts>=0?0:n._dirty?n.totalDuration():n._tDur)},kc=function(t){return t._end=Ye(t._start+(t._tDur/Math.abs(t._ts||t._rts||Me)||0))},Cc=function(t,n){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=Ye(r._time-(t._ts>0?n/t._ts:((t._dirty?t.totalDuration():t._tDur)-n)/-t._ts)),kc(t),r._dirty||Ys(r,t)),t},JS=function(t,n){var r;if((n._time||!n._dur&&n._initted||n._start<t._time&&(n._dur||!n.add))&&(r=Uu(t.rawTime(),n),(!n._dur||Xa(0,n.totalDuration(),r)-n._tTime>Me)&&n.render(r,!0)),Ys(t,n)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(r=t;r._dp;)r.rawTime()>=0&&r.totalTime(r._tTime),r=r._dp;t._zTime=-Me}},gr=function(t,n,r,s){return n.parent&&ks(n),n._start=Ye((Hr(r)?r:r||t!==Xe?Mn(t,r,n):t._time)+n._delay),n._end=Ye(n._start+(n.totalDuration()/Math.abs(n.timeScale())||0)),XS(t,n,"_first","_last",t._sort?"_start":0),th(n)||(t._recent=n),s||JS(t,n),t._ts<0&&Cc(t,t._tTime),t},ZS=function(t,n){return(Tn.ScrollTrigger||Qp("scrollTrigger",n))&&Tn.ScrollTrigger.create(n,t)},ek=function(t,n,r,s,i){if(nm(t,n,i),!t._initted)return 1;if(!r&&t._pt&&!kt&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&qS!==vn.frame)return vs.push(t),t._lazy=[i,s],1},b2=function e(t){var n=t.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||e(n))},th=function(t){var n=t.data;return n==="isFromStart"||n==="isStart"},_2=function(t,n,r,s){var i=t.ratio,o=n<0||!n&&(!t._start&&b2(t)&&!(!t._initted&&th(t))||(t._ts<0||t._dp._ts<0)&&!th(t))?0:1,a=t._rDelay,l=0,u,c,f;if(a&&t._repeat&&(l=Xa(0,t._tDur,n),c=ao(l,a),t._yoyo&&c&1&&(o=1-o),c!==ao(t._tTime,a)&&(i=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==i||kt||s||t._zTime===Me||!n&&t._zTime){if(!t._initted&&ek(t,n,s,r,l))return;for(f=t._zTime,t._zTime=n||(r?Me:0),r||(r=n&&!f),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=l,u=t._pt;u;)u.r(o,u.d),u=u._next;n<0&&eh(t,n,r,!0),t._onUpdate&&!r&&wn(t,"onUpdate"),l&&t._repeat&&!r&&t.parent&&wn(t,"onRepeat"),(n>=t._tDur||n<0)&&t.ratio===o&&(o&&ks(t,1),!r&&!kt&&(wn(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=n)},S2=function(t,n,r){var s;if(r>n)for(s=t._first;s&&s._start<=r;){if(s.data==="isPause"&&s._start>n)return s;s=s._next}else for(s=t._last;s&&s._start>=r;){if(s.data==="isPause"&&s._start<n)return s;s=s._prev}},lo=function(t,n,r,s){var i=t._repeat,o=Ye(n)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=i?i<0?1e10:Ye(o*(i+1)+t._rDelay*i):o,a>0&&!s&&Cc(t,t._tTime=t._tDur*a),t.parent&&kc(t),r||Ys(t.parent,t),t},sv=function(t){return t instanceof Xt?Ys(t):lo(t,t._dur)},k2={_start:0,endTime:Ma,totalDuration:Ma},Mn=function e(t,n,r){var s=t.labels,i=t._recent||k2,o=t.duration()>=Fn?i.endTime(!1):t._dur,a,l,u;return xt(n)&&(isNaN(n)||n in s)?(l=n.charAt(0),u=n.substr(-1)==="%",a=n.indexOf("="),l==="<"||l===">"?(a>=0&&(n=n.replace(/=/,"")),(l==="<"?i._start:i.endTime(i._repeat>=0))+(parseFloat(n.substr(1))||0)*(u?(a<0?i:r).totalDuration()/100:1)):a<0?(n in s||(s[n]=o),s[n]):(l=parseFloat(n.charAt(a-1)+n.substr(a+1)),u&&r&&(l=l/100*(Mt(r)?r[0]:r).totalDuration()),a>1?e(t,n.substr(0,a-1),r)+l:o+l)):n==null?o:+n},ia=function(t,n,r){var s=Hr(n[1]),i=(s?2:1)+(t<2?0:1),o=n[i],a,l;if(s&&(o.duration=n[1]),o.parent=r,t){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=sn(l.vars.inherit)&&l.parent;o.immediateRender=sn(a.immediateRender),t<2?o.runBackwards=1:o.startAt=n[i-1]}return new ft(n[0],o,n[i+1])},Ps=function(t,n){return t||t===0?n(t):n},Xa=function(t,n,r){return r<t?t:r>n?n:r},At=function(t,n){return!xt(t)||!(n=h2.exec(t))?"":n[1]},C2=function(t,n,r){return Ps(r,function(s){return Xa(t,n,s)})},nh=[].slice,tk=function(t,n){return t&&kr(t)&&"length"in t&&(!n&&!t.length||t.length-1 in t&&kr(t[0]))&&!t.nodeType&&t!==pr},E2=function(t,n,r){return r===void 0&&(r=[]),t.forEach(function(s){var i;return xt(s)&&!n||tk(s,1)?(i=r).push.apply(i,Bn(s)):r.push(s)})||r},Bn=function(t,n,r){return qe&&!n&&qe.selector?qe.selector(t):xt(t)&&!r&&(Jf||!uo())?nh.call((n||Yp).querySelectorAll(t),0):Mt(t)?E2(t,r):tk(t)?nh.call(t,0):t?[t]:[]},rh=function(t){return t=Bn(t)[0]||Na("Invalid scope")||{},function(n){var r=t.current||t.nativeElement||t;return Bn(n,r.querySelectorAll?r:r===t?Na("Invalid scope")||Yp.createElement("div"):t)}},nk=function(t){return t.sort(function(){return .5-Math.random()})},rk=function(t){if(rt(t))return t;var n=kr(t)?t:{each:t},r=Qs(n.ease),s=n.from||0,i=parseFloat(n.base)||0,o={},a=s>0&&s<1,l=isNaN(s)||a,u=n.axis,c=s,f=s;return xt(s)?c=f={center:.5,edges:.5,end:1}[s]||0:!a&&l&&(c=s[0],f=s[1]),function(h,p,g){var y=(g||n).length,b=o[y],x,v,w,k,_,S,T,P,R;if(!b){if(R=n.grid==="auto"?0:(n.grid||[1,Fn])[1],!R){for(T=-Fn;T<(T=g[R++].getBoundingClientRect().left)&&R<y;);R<y&&R--}for(b=o[y]=[],x=l?Math.min(R,y)*c-.5:s%R,v=R===Fn?0:l?y*f/R-.5:s/R|0,T=0,P=Fn,S=0;S<y;S++)w=S%R-x,k=v-(S/R|0),b[S]=_=u?Math.abs(u==="y"?k:w):FS(w*w+k*k),_>T&&(T=_),_<P&&(P=_);s==="random"&&nk(b),b.max=T-P,b.min=P,b.v=y=(parseFloat(n.amount)||parseFloat(n.each)*(R>y?y-1:u?u==="y"?y/R:R:Math.max(R,y/R))||0)*(s==="edges"?-1:1),b.b=y<0?i-y:i,b.u=At(n.amount||n.each)||0,r=r&&y<0?F2(r):r}return y=(b[h]-b.min)/b.max||0,Ye(b.b+(r?r(y):y)*b.v)+b.u}},sh=function(t){var n=Math.pow(10,((t+"").split(".")[1]||"").length);return function(r){var s=Ye(Math.round(parseFloat(r)/t)*t*n);return(s-s%1)/n+(Hr(r)?0:At(r))}},sk=function(t,n){var r=Mt(t),s,i;return!r&&kr(t)&&(s=r=t.radius||Fn,t.values?(t=Bn(t.values),(i=!Hr(t[0]))&&(s*=s)):t=sh(t.increment)),Ps(n,r?rt(t)?function(o){return i=t(o),Math.abs(i-o)<=s?i:o}:function(o){for(var a=parseFloat(i?o.x:o),l=parseFloat(i?o.y:0),u=Fn,c=0,f=t.length,h,p;f--;)i?(h=t[f].x-a,p=t[f].y-l,h=h*h+p*p):h=Math.abs(t[f]-a),h<u&&(u=h,c=f);return c=!s||u<=s?t[c]:o,i||c===o||Hr(o)?c:c+At(o)}:sh(t))},ik=function(t,n,r,s){return Ps(Mt(t)?!n:r===!0?!!(r=0):!s,function(){return Mt(t)?t[~~(Math.random()*t.length)]:(r=r||1e-5)&&(s=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((t-r/2+Math.random()*(n-t+r*.99))/r)*r*s)/s})},T2=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduce(function(i,o){return o(i)},s)}},I2=function(t,n){return function(r){return t(parseFloat(r))+(n||At(r))}},R2=function(t,n,r){return ak(t,n,0,1,r)},ok=function(t,n,r){return Ps(r,function(s){return t[~~n(s)]})},P2=function e(t,n,r){var s=n-t;return Mt(t)?ok(t,e(0,t.length),n):Ps(r,function(i){return(s+(i-t)%s)%s+t})},j2=function e(t,n,r){var s=n-t,i=s*2;return Mt(t)?ok(t,e(0,t.length-1),n):Ps(r,function(o){return o=(i+(o-t)%i)%i||0,t+(o>s?i-o:o)})},Da=function(t){return t.replace(c2,function(n){var r=n.indexOf("[")+1,s=n.substring(r||7,r?n.indexOf("]"):n.length-1).split(d2);return ik(r?s:+s[0],r?0:+s[1],+s[2]||1e-5)})},ak=function(t,n,r,s,i){var o=n-t,a=s-r;return Ps(i,function(l){return r+((l-t)/o*a||0)})},A2=function e(t,n,r,s){var i=isNaN(t+n)?0:function(p){return(1-p)*t+p*n};if(!i){var o=xt(t),a={},l,u,c,f,h;if(r===!0&&(s=1)&&(r=null),o)t={p:t},n={p:n};else if(Mt(t)&&!Mt(n)){for(c=[],f=t.length,h=f-2,u=1;u<f;u++)c.push(e(t[u-1],t[u]));f--,i=function(g){g*=f;var y=Math.min(h,~~g);return c[y](g-y)},r=n}else s||(t=oo(Mt(t)?[]:{},t));if(!c){for(l in n)tm.call(a,t,l,"get",n[l]);i=function(g){return im(g,a)||(o?t.p:t)}}}return Ps(r,i)},iv=function(t,n,r){var s=t.labels,i=Fn,o,a,l;for(o in s)a=s[o]-n,a<0==!!r&&a&&i>(a=Math.abs(a))&&(l=o,i=a);return l},wn=function(t,n,r){var s=t.vars,i=s[n],o=qe,a=t._ctx,l,u,c;if(i)return l=s[n+"Params"],u=s.callbackScope||t,r&&vs.length&&Bu(),a&&(qe=a),c=l?i.apply(u,l):i.call(u),qe=o,c},Uo=function(t){return ks(t),t.scrollTrigger&&t.scrollTrigger.kill(!!kt),t.progress()<1&&wn(t,"onInterrupt"),t},Oi,lk=[],uk=function(t){if(t)if(t=!t.name&&t.default||t,Gp()||t.headless){var n=t.name,r=rt(t),s=n&&!r&&t.init?function(){this._props=[]}:t,i={init:Ma,render:im,add:tm,kill:Y2,modifier:G2,rawVars:0},o={targetTest:0,get:0,getSetter:sm,aliases:{},register:0};if(uo(),t!==s){if(yn[n])return;In(s,In($u(t,i),o)),oo(s.prototype,oo(i,$u(t,o))),yn[s.prop=n]=s,t.targetTest&&(Xl.push(s),Xp[n]=1),n=(n==="css"?"CSS":n.charAt(0).toUpperCase()+n.substr(1))+"Plugin"}WS(n,s),t.register&&t.register(un,s,an)}else lk.push(t)},Ae=255,Vo={aqua:[0,Ae,Ae],lime:[0,Ae,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ae],navy:[0,0,128],white:[Ae,Ae,Ae],olive:[128,128,0],yellow:[Ae,Ae,0],orange:[Ae,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ae,0,0],pink:[Ae,192,203],cyan:[0,Ae,Ae],transparent:[Ae,Ae,Ae,0]},wd=function(t,n,r){return t+=t<0?1:t>1?-1:0,(t*6<1?n+(r-n)*t*6:t<.5?r:t*3<2?n+(r-n)*(2/3-t)*6:n)*Ae+.5|0},ck=function(t,n,r){var s=t?Hr(t)?[t>>16,t>>8&Ae,t&Ae]:0:Vo.black,i,o,a,l,u,c,f,h,p,g;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),Vo[t])s=Vo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(i=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+i+i+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&Ae,s&Ae,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Ae,t&Ae]}else if(t.substr(0,3)==="hsl"){if(s=g=t.match(ev),!n)l=+s[0]%360/360,u=+s[1]/100,c=+s[2]/100,o=c<=.5?c*(u+1):c+u-c*u,i=c*2-o,s.length>3&&(s[3]*=1),s[0]=wd(l+1/3,i,o),s[1]=wd(l,i,o),s[2]=wd(l-1/3,i,o);else if(~t.indexOf("="))return s=t.match($S),r&&s.length<4&&(s[3]=1),s}else s=t.match(ev)||Vo.transparent;s=s.map(Number)}return n&&!g&&(i=s[0]/Ae,o=s[1]/Ae,a=s[2]/Ae,f=Math.max(i,o,a),h=Math.min(i,o,a),c=(f+h)/2,f===h?l=u=0:(p=f-h,u=c>.5?p/(2-f-h):p/(f+h),l=f===i?(o-a)/p+(o<a?6:0):f===o?(a-i)/p+2:(i-o)/p+4,l*=60),s[0]=~~(l+.5),s[1]=~~(u*100+.5),s[2]=~~(c*100+.5)),r&&s.length<4&&(s[3]=1),s},dk=function(t){var n=[],r=[],s=-1;return t.split(xs).forEach(function(i){var o=i.match(Li)||[];n.push.apply(n,o),r.push(s+=o.length+1)}),n.c=r,n},ov=function(t,n,r){var s="",i=(t+s).match(xs),o=n?"hsla(":"rgba(",a=0,l,u,c,f;if(!i)return t;if(i=i.map(function(h){return(h=ck(h,n,1))&&o+(n?h[0]+","+h[1]+"%,"+h[2]+"%,"+h[3]:h.join(","))+")"}),r&&(c=dk(t),l=r.c,l.join(s)!==c.c.join(s)))for(u=t.replace(xs,"1").split(Li),f=u.length-1;a<f;a++)s+=u[a]+(~l.indexOf(a)?i.shift()||o+"0,0,0,0)":(c.length?c:i.length?i:r).shift());if(!u)for(u=t.split(xs),f=u.length-1;a<f;a++)s+=u[a]+i[a];return s+u[f]},xs=function(){var e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in Vo)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),N2=/hsl[a]?\(/,fk=function(t){var n=t.join(" "),r;if(xs.lastIndex=0,xs.test(n))return r=N2.test(n),t[1]=ov(t[1],r),t[0]=ov(t[0],r,dk(t[1])),!0},La,vn=function(){var e=Date.now,t=500,n=33,r=e(),s=r,i=1e3/240,o=i,a=[],l,u,c,f,h,p,g=function y(b){var x=e()-s,v=b===!0,w,k,_,S;if((x>t||x<0)&&(r+=x-n),s+=x,_=s-r,w=_-o,(w>0||v)&&(S=++f.frame,h=_-f.time*1e3,f.time=_=_/1e3,o+=w+(w>=i?4:i-w),k=1),v||(l=u(y)),k)for(p=0;p<a.length;p++)a[p](_,h,S,b)};return f={time:0,frame:0,tick:function(){g(!0)},deltaRatio:function(b){return h/(1e3/(b||60))},wake:function(){VS&&(!Jf&&Gp()&&(pr=Jf=window,Yp=pr.document||{},Tn.gsap=un,(pr.gsapVersions||(pr.gsapVersions=[])).push(un.version),HS(Fu||pr.GreenSockGlobals||!pr.gsap&&pr||{}),lk.forEach(uk)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,l&&f.sleep(),u=c||function(b){return setTimeout(b,o-f.time*1e3+1|0)},La=1,g(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(l),La=0,u=Ma},lagSmoothing:function(b,x){t=b||1/0,n=Math.min(x||33,t)},fps:function(b){i=1e3/(b||240),o=f.time*1e3+i},add:function(b,x,v){var w=x?function(k,_,S,T){b(k,_,S,T),f.remove(w)}:b;return f.remove(b),a[v?"unshift":"push"](w),uo(),w},remove:function(b,x){~(x=a.indexOf(b))&&a.splice(x,1)&&p>=x&&p--},_listeners:a},f}(),uo=function(){return!La&&vn.wake()},ke={},M2=/^[\d.\-M][\d.\-,\s]/,D2=/["']/g,L2=function(t){for(var n={},r=t.substr(1,t.length-3).split(":"),s=r[0],i=1,o=r.length,a,l,u;i<o;i++)l=r[i],a=i!==o-1?l.lastIndexOf(","):l.length,u=l.substr(0,a),n[s]=isNaN(u)?u.replace(D2,"").trim():+u,s=l.substr(a+1).trim();return n},O2=function(t){var n=t.indexOf("(")+1,r=t.indexOf(")"),s=t.indexOf("(",n);return t.substring(n,~s&&s<r?t.indexOf(")",r+1):r)},z2=function(t){var n=(t+"").split("("),r=ke[n[0]];return r&&n.length>1&&r.config?r.config.apply(null,~t.indexOf("{")?[L2(n[1])]:O2(t).split(",").map(YS)):ke._CE&&M2.test(t)?ke._CE("",t):r},F2=function(t){return function(n){return 1-t(1-n)}},Qs=function(t,n){return t&&(rt(t)?t:ke[t]||z2(t))||n},pi=function(t,n,r,s){r===void 0&&(r=function(l){return 1-n(1-l)}),s===void 0&&(s=function(l){return l<.5?n(l*2)/2:1-n((1-l)*2)/2});var i={easeIn:n,easeOut:r,easeInOut:s},o;return on(t,function(a){ke[a]=Tn[a]=i,ke[o=a.toLowerCase()]=r;for(var l in i)ke[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=ke[a+"."+l]=i[l]}),i},hk=function(t){return function(n){return n<.5?(1-t(1-n*2))/2:.5+t((n-.5)*2)/2}},bd=function e(t,n,r){var s=n>=1?n:1,i=(r||(t?.3:.45))/(n<1?n:1),o=i/Xf*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*u2((c-o)*i)+1},l=t==="out"?a:t==="in"?function(u){return 1-a(1-u)}:hk(a);return i=Xf/i,l.config=function(u,c){return e(t,u,c)},l},_d=function e(t,n){n===void 0&&(n=1.70158);var r=function(o){return o?--o*o*((n+1)*o+n)+1:0},s=t==="out"?r:t==="in"?function(i){return 1-r(1-i)}:hk(r);return s.config=function(i){return e(t,i)},s};on("Linear,Quad,Cubic,Quart,Quint,Strong",function(e,t){var n=t<5?t+1:t;pi(e+",Power"+(n-1),t?function(r){return Math.pow(r,n)}:function(r){return r},function(r){return 1-Math.pow(1-r,n)},function(r){return r<.5?Math.pow(r*2,n)/2:1-Math.pow((1-r)*2,n)/2})});ke.Linear.easeNone=ke.none=ke.Linear.easeIn;pi("Elastic",bd("in"),bd("out"),bd());(function(e,t){var n=1/t,r=2*n,s=2.5*n,i=function(a){return a<n?e*a*a:a<r?e*Math.pow(a-1.5/t,2)+.75:a<s?e*(a-=2.25/t)*a+.9375:e*Math.pow(a-2.625/t,2)+.984375};pi("Bounce",function(o){return 1-i(1-o)},i)})(7.5625,2.75);pi("Expo",function(e){return Math.pow(2,10*(e-1))*e+e*e*e*e*e*e*(1-e)});pi("Circ",function(e){return-(FS(1-e*e)-1)});pi("Sine",function(e){return e===1?1:-l2(e*o2)+1});pi("Back",_d("in"),_d("out"),_d());ke.SteppedEase=ke.steps=Tn.SteppedEase={config:function(t,n){t===void 0&&(t=1);var r=1/t,s=t+(n?0:1),i=n?1:0,o=1-Me;return function(a){return((s*Xa(0,o,a)|0)+i)*r}}};Aa.ease=ke["quad.out"];on("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(e){return Jp+=e+","+e+"Params,"});var pk=function(t,n){this.id=a2++,t._gsap=this,this.target=t,this.harness=n,this.get=n?n.get:KS,this.set=n?n.getSetter:sm},Oa=function(){function e(n){this.vars=n,this._delay=+n.delay||0,(this._repeat=n.repeat===1/0?-2:n.repeat||0)&&(this._rDelay=n.repeatDelay||0,this._yoyo=!!n.yoyo||!!n.yoyoEase),this._ts=1,lo(this,+n.duration,1,1),this.data=n.data,qe&&(this._ctx=qe,qe.data.push(this)),La||vn.wake()}var t=e.prototype;return t.delay=function(r){return r||r===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+r-this._delay),this._delay=r,this):this._delay},t.duration=function(r){return arguments.length?this.totalDuration(this._repeat>0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},t.totalDuration=function(r){return arguments.length?(this._dirty=0,lo(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(r,s){if(uo(),!arguments.length)return this._tTime;var i=this._dp;if(i&&i.smoothChildTiming&&this._ts){for(Cc(this,r),!i._dp||i.parent||JS(i,this);i&&i.parent;)i.parent._time!==i._start+(i._ts>=0?i._tTime/i._ts:(i.totalDuration()-i._tTime)/-i._ts)&&i.totalTime(i._tTime,!0),i=i.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r<this._tDur||this._ts<0&&r>0||!this._tDur&&!r)&&gr(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Me||!this._initted&&this._dur&&r||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),GS(this,r,s)),this},t.time=function(r,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+rv(this))%(this._dur+this._rDelay)||(r?this._dur:0),s):this._time},t.totalProgress=function(r,s){return arguments.length?this.totalTime(this.totalDuration()*r,s):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},t.progress=function(r,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+rv(this),s):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(r,s){var i=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*i,s):this._repeat?ao(this._tTime,i)+1:1},t.timeScale=function(r,s){if(!arguments.length)return this._rts===-Me?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?Uu(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-Me?0:this._rts,this.totalTime(Xa(-Math.abs(this._delay),this.totalDuration(),i),s!==!1),kc(this),x2(this)},t.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(uo(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Me&&(this._tTime-=Me)))),this):this._ps},t.startTime=function(r){if(arguments.length){this._start=Ye(r);var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&gr(s,this,this._start-this._delay),this}return this._start},t.endTime=function(r){return this._start+(sn(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(r){var s=this.parent||this._dp;return s?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Uu(s.rawTime(r),this):this._tTime:this._tTime},t.revert=function(r){r===void 0&&(r=m2);var s=kt;return kt=r,em(this)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),kt=s,this},t.globalTime=function(r){for(var s=this,i=arguments.length?r:s.rawTime();s;)i=s._start+i/(Math.abs(s._ts)||1),s=s._dp;return!this.parent&&this._sat?this._sat.globalTime(r):i},t.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,sv(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(r){if(arguments.length){var s=this._time;return this._rDelay=r,sv(this),s?this.time(s):this}return this._rDelay},t.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},t.seek=function(r,s){return this.totalTime(Mn(this,r),sn(s))},t.restart=function(r,s){return this.play().totalTime(r?-this._delay:0,sn(s)),this._dur||(this._zTime=-Me),this},t.play=function(r,s){return r!=null&&this.seek(r,s),this.reversed(!1).paused(!1)},t.reverse=function(r,s){return r!=null&&this.seek(r||this.totalDuration(),s),this.reversed(!0).paused(!1)},t.pause=function(r,s){return r!=null&&this.seek(r,s),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-Me:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Me,this},t.isActive=function(){var r=this.parent||this._dp,s=this._start,i;return!!(!r||this._ts&&this._initted&&r.isActive()&&(i=r.rawTime(!0))>=s&&i<this.endTime(!0)-Me)},t.eventCallback=function(r,s,i){var o=this.vars;return arguments.length>1?(s?(o[r]=s,i&&(o[r+"Params"]=i),r==="onUpdate"&&(this._onUpdate=s)):delete o[r],this):o[r]},t.then=function(r){var s=this,i=s._prom;return new Promise(function(o){var a=rt(r)?r:QS,l=function(){var c=s.then;s.then=null,i&&i(),rt(a)&&(a=a(s))&&(a.then||a===s)&&(s.then=c),o(a),s.then=c};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?l():s._prom=l})},t.kill=function(){Uo(this)},e}();In(Oa.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Me,_prom:0,_ps:!1,_rts:1});var Xt=function(e){zS(t,e);function t(r,s){var i;return r===void 0&&(r={}),i=e.call(this,r)||this,i.labels={},i.smoothChildTiming=!!r.smoothChildTiming,i.autoRemoveChildren=!!r.autoRemoveChildren,i._sort=sn(r.sortChildren),Xe&&gr(r.parent||Xe,Ar(i),s),r.reversed&&i.reverse(),r.paused&&i.paused(!0),r.scrollTrigger&&ZS(Ar(i),r.scrollTrigger),i}var n=t.prototype;return n.to=function(s,i,o){return ia(0,arguments,this),this},n.from=function(s,i,o){return ia(1,arguments,this),this},n.fromTo=function(s,i,o,a){return ia(2,arguments,this),this},n.set=function(s,i,o){return i.duration=0,i.parent=this,sa(i).repeatDelay||(i.repeat=0),i.immediateRender=!!i.immediateRender,new ft(s,i,Mn(this,o),1),this},n.call=function(s,i,o){return gr(this,ft.delayedCall(0,s,i),o)},n.staggerTo=function(s,i,o,a,l,u,c){return o.duration=i,o.stagger=o.stagger||a,o.onComplete=u,o.onCompleteParams=c,o.parent=this,new ft(s,o,Mn(this,l)),this},n.staggerFrom=function(s,i,o,a,l,u,c){return o.runBackwards=1,sa(o).immediateRender=sn(o.immediateRender),this.staggerTo(s,i,o,a,l,u,c)},n.staggerFromTo=function(s,i,o,a,l,u,c,f){return a.startAt=o,sa(a).immediateRender=sn(a.immediateRender),this.staggerTo(s,i,a,l,u,c,f)},n.render=function(s,i,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,u=this._dur,c=s<=0?0:Ye(s),f=this._zTime<0!=s<0&&(this._initted||!u),h,p,g,y,b,x,v,w,k,_,S,T;if(this!==Xe&&c>l&&s>=0&&(c=l),c!==this._tTime||o||f){if(a!==this._time&&u&&(c+=this._time-a,s+=this._time-a),h=c,k=this._start,w=this._ts,x=!w,f&&(u||(a=this._zTime),(s||!i)&&(this._zTime=s)),this._repeat){if(S=this._yoyo,b=u+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(b*100+s,i,o);if(h=Ye(c%b),c===l?(y=this._repeat,h=u):(_=Ye(c/b),y=~~_,y&&y===_&&(h=u,y--),h>u&&(h=u)),_=ao(this._tTime,b),!a&&this._tTime&&_!==y&&this._tTime-_*b-this._dur<=0&&(_=y),S&&y&1&&(h=u-h,T=1),y!==_&&!this._lock){var P=S&&_&1,R=P===(S&&y&1);if(y<_&&(P=!P),a=P?0:c%u?u:c,this._lock=1,this.render(a||(T?0:Ye(y*b)),i,!u)._lock=0,this._tTime=c,!i&&this.parent&&wn(this,"onRepeat"),this.vars.repeatRefresh&&!T&&(this.invalidate()._lock=1,_=y),a&&a!==this._time||x!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(u=this._dur,l=this._tDur,R&&(this._lock=2,a=P?u:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!T&&this.invalidate()),this._lock=0,!this._ts&&!x)return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(v=S2(this,Ye(a),Ye(h)),v&&(c-=h-(h=v._start))),this._tTime=c,this._time=h,this._act=!!w,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&c&&u&&!i&&!_&&(wn(this,"onStart"),this._tTime!==c))return this;if(h>=a&&s>=0)for(p=this._first;p;){if(g=p._next,(p._act||h>=p._start)&&p._ts&&v!==p){if(p.parent!==this)return this.render(s,i,o);if(p.render(p._ts>0?(h-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(h-p._start)*p._ts,i,o),h!==this._time||!this._ts&&!x){v=0,g&&(c+=this._zTime=-Me);break}}p=g}else{p=this._last;for(var C=s<0?s:h;p;){if(g=p._prev,(p._act||C<=p._end)&&p._ts&&v!==p){if(p.parent!==this)return this.render(s,i,o);if(p.render(p._ts>0?(C-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(C-p._start)*p._ts,i,o||kt&&em(p)),h!==this._time||!this._ts&&!x){v=0,g&&(c+=this._zTime=C?-Me:Me);break}}p=g}}if(v&&!i&&(this.pause(),v.render(h>=a?0:-Me)._zTime=h>=a?1:-1,this._ts))return this._start=k,kc(this),this.render(s,i,o);this._onUpdate&&!i&&wn(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(k===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((s||!u)&&(c===l&&this._ts>0||!c&&this._ts<0)&&ks(this,1),!i&&!(s<0&&!a)&&(c||a||!l)&&(wn(this,c===l&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<l&&this.timeScale()>0)&&this._prom())))}return this},n.add=function(s,i){var o=this;if(Hr(i)||(i=Mn(this,i,s)),!(s instanceof Oa)){if(Mt(s))return s.forEach(function(a){return o.add(a,i)}),this;if(xt(s))return this.addLabel(s,i);if(rt(s))s=ft.delayedCall(0,s);else return this}return this!==s?gr(this,s,i):this},n.getChildren=function(s,i,o,a){s===void 0&&(s=!0),i===void 0&&(i=!0),o===void 0&&(o=!0),a===void 0&&(a=-Fn);for(var l=[],u=this._first;u;)u._start>=a&&(u instanceof ft?i&&l.push(u):(o&&l.push(u),s&&l.push.apply(l,u.getChildren(!0,i,o)))),u=u._next;return l},n.getById=function(s){for(var i=this.getChildren(1,1,1),o=i.length;o--;)if(i[o].vars.id===s)return i[o]},n.remove=function(s){return xt(s)?this.removeLabel(s):rt(s)?this.killTweensOf(s):(s.parent===this&&Sc(this,s),s===this._recent&&(this._recent=this._last),Ys(this))},n.totalTime=function(s,i){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Ye(vn.time-(this._ts>0?s/this._ts:(this.totalDuration()-s)/-this._ts))),e.prototype.totalTime.call(this,s,i),this._forcing=0,this):this._tTime},n.addLabel=function(s,i){return this.labels[s]=Mn(this,i),this},n.removeLabel=function(s){return delete this.labels[s],this},n.addPause=function(s,i,o){var a=ft.delayedCall(0,i||Ma,o);return a.data="isPause",this._hasPause=1,gr(this,a,Mn(this,s))},n.removePause=function(s){var i=this._first;for(s=Mn(this,s);i;)i._start===s&&i.data==="isPause"&&ks(i),i=i._next},n.killTweensOf=function(s,i,o){for(var a=this.getTweensOf(s,o),l=a.length;l--;)os!==a[l]&&a[l].kill(s,i);return this},n.getTweensOf=function(s,i){for(var o=[],a=Bn(s),l=this._first,u=Hr(i),c;l;)l instanceof ft?g2(l._targets,a)&&(u?(!os||l._initted&&l._ts)&&l.globalTime(0)<=i&&l.globalTime(l.totalDuration())>i:!i||l.isActive())&&o.push(l):(c=l.getTweensOf(a,i)).length&&o.push.apply(o,c),l=l._next;return o},n.tweenTo=function(s,i){i=i||{};var o=this,a=Mn(o,s),l=i,u=l.startAt,c=l.onStart,f=l.onStartParams,h=l.immediateRender,p,g=ft.to(o,In({ease:i.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:i.duration||Math.abs((a-(u&&"time"in u?u.time:o._time))/o.timeScale())||Me,onStart:function(){if(o.pause(),!p){var b=i.duration||Math.abs((a-(u&&"time"in u?u.time:o._time))/o.timeScale());g._dur!==b&&lo(g,b,0,1).render(g._time,!0,!0),p=1}c&&c.apply(g,f||[])}},i));return h?g.render(0):g},n.tweenFromTo=function(s,i,o){return this.tweenTo(i,In({startAt:{time:Mn(this,s)}},o))},n.recent=function(){return this._recent},n.nextLabel=function(s){return s===void 0&&(s=this._time),iv(this,Mn(this,s))},n.previousLabel=function(s){return s===void 0&&(s=this._time),iv(this,Mn(this,s),1)},n.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Me)},n.shiftChildren=function(s,i,o){o===void 0&&(o=0);var a=this._first,l=this.labels,u;for(s=Ye(s);a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(i)for(u in l)l[u]>=o&&(l[u]+=s);return Ys(this)},n.invalidate=function(s){var i=this._first;for(this._lock=0;i;)i.invalidate(s),i=i._next;return e.prototype.invalidate.call(this,s)},n.clear=function(s){s===void 0&&(s=!0);for(var i=this._first,o;i;)o=i._next,this.remove(i),i=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),Ys(this)},n.totalDuration=function(s){var i=0,o=this,a=o._last,l=Fn,u,c,f;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(f=o.parent;a;)u=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,gr(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(i-=c,(!f&&!o._dp||f&&f.smoothChildTiming)&&(o._start+=Ye(c/o._ts),o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),l=0),a._end>i&&a._ts&&(i=a._end),a=u;lo(o,o===Xe&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Xe._ts&&(GS(Xe,Uu(s,Xe)),qS=vn.frame),vn.frame>=tv){tv+=Sn.autoSleep||120;var i=Xe._first;if((!i||!i._ts)&&Sn.autoSleep&&vn._listeners.length<2){for(;i&&!i._ts;)i=i._next;i||vn.sleep()}}},t}(Oa);In(Xt.prototype,{_lock:0,_hasPause:0,_forcing:0});var B2=function(t,n,r,s,i,o,a){var l=new an(this._pt,t,n,0,1,wk,null,i),u=0,c=0,f,h,p,g,y,b,x,v;for(l.b=r,l.e=s,r+="",s+="",(x=~s.indexOf("random("))&&(s=Da(s)),o&&(v=[r,s],o(v,t,n),r=v[0],s=v[1]),h=r.match(vd)||[];f=vd.exec(s);)g=f[0],y=s.substring(u,f.index),p?p=(p+1)%5:y.substr(-5)==="rgba("&&(p=1),g!==h[c++]&&(b=parseFloat(h[c-1])||0,l._pt={_next:l._pt,p:y||c===1?y:",",s:b,c:g.charAt(1)==="="?qi(b,g)-b:parseFloat(g)-b,m:p&&p<4?Math.round:0},u=vd.lastIndex);return l.c=u<s.length?s.substring(u,s.length):"",l.fp=a,(US.test(s)||x)&&(l.e=0),this._pt=l,l},tm=function(t,n,r,s,i,o,a,l,u,c){rt(s)&&(s=s(i||0,t,o));var f=t[n],h=r!=="get"?r:rt(f)?u?t[n.indexOf("set")||!rt(t["get"+n.substr(3)])?n:"get"+n.substr(3)](u):t[n]():f,p=rt(f)?u?W2:vk:rm,g;if(xt(s)&&(~s.indexOf("random(")&&(s=Da(s)),s.charAt(1)==="="&&(g=qi(h,s)+(At(h)||0),(g||g===0)&&(s=g))),!c||h!==s||ih)return!isNaN(h*s)&&s!==""?(g=new an(this._pt,t,n,+h||0,s-(h||0),typeof f=="boolean"?K2:xk,0,p),u&&(g.fp=u),a&&g.modifier(a,this,t),this._pt=g):(!f&&!(n in t)&&Qp(n,s),B2.call(this,t,n,h,s,p,l||Sn.stringFilter,u))},$2=function(t,n,r,s,i){if(rt(t)&&(t=oa(t,i,n,r,s)),!kr(t)||t.style&&t.nodeType||Mt(t)||BS(t))return xt(t)?oa(t,i,n,r,s):t;var o={},a;for(a in t)o[a]=oa(t[a],i,n,r,s);return o},mk=function(t,n,r,s,i,o){var a,l,u,c;if(yn[t]&&(a=new yn[t]).init(i,a.rawVars?n[t]:$2(n[t],s,i,o,r),r,s,o)!==!1&&(r._pt=l=new an(r._pt,i,t,0,1,a.render,a,0,a.priority),r!==Oi))for(u=r._ptLookup[r._targets.indexOf(i)],c=a._props.length;c--;)u[a._props[c]]=l;return a},os,ih,nm=function e(t,n,r){var s=t.vars,i=s.ease,o=s.startAt,a=s.immediateRender,l=s.lazy,u=s.onUpdate,c=s.runBackwards,f=s.yoyoEase,h=s.keyframes,p=s.autoRevert,g=t._dur,y=t._startAt,b=t._targets,x=t.parent,v=x&&x.data==="nested"?x.vars.targets:b,w=t._overwrite==="auto"&&!qp,k=t.timeline,_=s.easeReverse||f,S,T,P,R,C,M,D,U,V,W,J,ne,$;if(k&&(!h||!i)&&(i="none"),t._ease=Qs(i,Aa.ease),t._rEase=_&&(Qs(_)||t._ease),t._from=!k&&!!s.runBackwards,t._from&&(t.ratio=1),!k||h&&!s.stagger){if(U=b[0]?Gs(b[0]).harness:0,ne=U&&s[U.prop],S=$u(s,Xp),y&&(y._zTime<0&&y.progress(1),n<0&&c&&a&&!p?y.render(-1,!0):y.revert(c&&g?Ql:p2),y._lazy=0),o){if(ks(t._startAt=ft.set(b,In({data:"isStart",overwrite:!1,parent:x,immediateRender:!0,lazy:!y&&sn(l),startAt:null,delay:0,onUpdate:u&&function(){return wn(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,n<0&&(kt||!a&&!p)&&t._startAt.revert(Ql),a&&g&&n<=0&&r<=0){n&&(t._zTime=n);return}}else if(c&&g&&!y){if(n&&(a=!1),P=In({overwrite:!1,data:"isFromStart",lazy:a&&!y&&sn(l),immediateRender:a,stagger:0,parent:x},S),ne&&(P[U.prop]=ne),ks(t._startAt=ft.set(b,P)),t._startAt._dp=0,t._startAt._sat=t,n<0&&(kt?t._startAt.revert(Ql):t._startAt.render(-1,!0)),t._zTime=n,!a)e(t._startAt,Me,Me);else if(!n)return}for(t._pt=t._ptCache=0,l=g&&sn(l)||l&&!g,T=0;T<b.length;T++){if(C=b[T],D=C._gsap||Zp(b)[T]._gsap,t._ptLookup[T]=W={},Zf[D.id]&&vs.length&&Bu(),J=v===b?T:v.indexOf(C),U&&(V=new U).init(C,ne||S,t,J,v)!==!1&&(t._pt=R=new an(t._pt,C,V.name,0,1,V.render,V,0,V.priority),V._props.forEach(function(F){W[F]=R}),V.priority&&(M=1)),!U||ne)for(P in S)yn[P]&&(V=mk(P,S,t,J,C,v))?V.priority&&(M=1):W[P]=R=tm.call(t,C,P,"get",S[P],J,v,0,s.stringFilter);t._op&&t._op[T]&&t.kill(C,t._op[T]),w&&t._pt&&(os=t,Xe.killTweensOf(C,W,t.globalTime(n)),$=!t.parent,os=0),t._pt&&l&&(Zf[D.id]=1)}M&&bk(t),t._onInit&&t._onInit(t)}t._onUpdate=u,t._initted=(!t._op||t._pt)&&!$,h&&n<=0&&k.render(Fn,!0,!0)},U2=function(t,n,r,s,i,o,a,l){var u=(t._pt&&t._ptCache||(t._ptCache={}))[n],c,f,h,p;if(!u)for(u=t._ptCache[n]=[],h=t._ptLookup,p=t._targets.length;p--;){if(c=h[p][n],c&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==n&&c.fp!==n;)c=c._next;if(!c)return ih=1,t.vars[n]="+=0",nm(t,a),ih=0,l?Na(n+" not eligible for reset. Try splitting into individual properties"):1;u.push(c)}for(p=u.length;p--;)f=u[p],c=f._pt||f,c.s=(s||s===0)&&!i?s:c.s+(s||0)+o*c.c,c.c=r-c.s,f.e&&(f.e=lt(r)+At(f.e)),f.b&&(f.b=c.s+At(f.b))},V2=function(t,n){var r=t[0]?Gs(t[0]).harness:0,s=r&&r.aliases,i,o,a,l;if(!s)return n;i=oo({},n);for(o in s)if(o in i)for(l=s[o].split(","),a=l.length;a--;)i[l[a]]=i[o];return i},H2=function(t,n,r,s){var i=n.ease||s||"power1.inOut",o,a;if(Mt(n))a=r[t]||(r[t]=[]),n.forEach(function(l,u){return a.push({t:u/(n.length-1)*100,v:l,e:i})});else for(o in n)a=r[o]||(r[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:n[o],e:i})},oa=function(t,n,r,s,i){return rt(t)?t.call(n,r,s,i):xt(t)&&~t.indexOf("random(")?Da(t):t},gk=Jp+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",yk={};on(gk+",id,stagger,delay,duration,paused,scrollTrigger",function(e){return yk[e]=1});var ft=function(e){zS(t,e);function t(r,s,i,o){var a;typeof s=="number"&&(i.duration=s,s=i,i=null),a=e.call(this,o?s:sa(s))||this;var l=a.vars,u=l.duration,c=l.delay,f=l.immediateRender,h=l.stagger,p=l.overwrite,g=l.keyframes,y=l.defaults,b=l.scrollTrigger,x=s.parent||Xe,v=(Mt(r)||BS(r)?Hr(r[0]):"length"in s)?[r]:Bn(r),w,k,_,S,T,P,R,C;if(a._targets=v.length?Zp(v):Na("GSAP target "+r+" not found. https://gsap.com",!Sn.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=p,g||h||Tl(u)||Tl(c)){s=a.vars;var M=s.easeReverse||s.yoyoEase;if(w=a.timeline=new Xt({data:"nested",defaults:y||{},targets:x&&x.data==="nested"?x.vars.targets:v}),w.kill(),w.parent=w._dp=Ar(a),w._start=0,h||Tl(u)||Tl(c)){if(S=v.length,R=h&&rk(h),kr(h))for(T in h)~gk.indexOf(T)&&(C||(C={}),C[T]=h[T]);for(k=0;k<S;k++)_=$u(s,yk),_.stagger=0,M&&(_.easeReverse=M),C&&oo(_,C),P=v[k],_.duration=+oa(u,Ar(a),k,P,v),_.delay=(+oa(c,Ar(a),k,P,v)||0)-a._delay,!h&&S===1&&_.delay&&(a._delay=c=_.delay,a._start+=c,_.delay=0),w.to(P,_,R?R(k,P,v):0),w._ease=ke.none;w.duration()?u=c=0:a.timeline=0}else if(g){sa(In(w.vars.defaults,{ease:"none"})),w._ease=Qs(g.ease||s.ease||"none");var D=0,U,V,W;if(Mt(g))g.forEach(function(J){return w.to(v,J,">")}),w.duration();else{_={};for(T in g)T==="ease"||T==="easeEach"||H2(T,g[T],_,g.easeEach);for(T in _)for(U=_[T].sort(function(J,ne){return J.t-ne.t}),D=0,k=0;k<U.length;k++)V=U[k],W={ease:V.e,duration:(V.t-(k?U[k-1].t:0))/100*u},W[T]=V.v,w.to(v,W,D),D+=W.duration;w.duration()<u&&w.to({},{duration:u-w.duration()})}}u||a.duration(u=w.duration())}else a.timeline=0;return p===!0&&!qp&&(os=Ar(a),Xe.killTweensOf(v),os=0),gr(x,Ar(a),i),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(f||!u&&!g&&a._start===Ye(x._time)&&sn(f)&&w2(Ar(a))&&x.data!=="nested")&&(a._tTime=-Me,a.render(Math.max(0,-c)||0)),b&&ZS(Ar(a),b),a}var n=t.prototype;return n.render=function(s,i,o){var a=this._time,l=this._tDur,u=this._dur,c=s<0,f=s>l-Me&&!c?l:s<Me?0:s,h,p,g,y,b,x,v,w;if(!u)_2(this,s,i,o);else if(f!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c||this._lazy){if(h=f,w=this.timeline,this._repeat){if(y=u+this._rDelay,this._repeat<-1&&c)return this.totalTime(y*100+s,i,o);if(h=Ye(f%y),f===l?(g=this._repeat,h=u):(b=Ye(f/y),g=~~b,g&&g===b?(h=u,g--):h>u&&(h=u)),x=this._yoyo&&g&1,x&&(h=u-h),b=ao(this._tTime,y),h===a&&!o&&this._initted&&g===b)return this._tTime=f,this;g!==b&&this.vars.repeatRefresh&&!x&&!this._lock&&h!==y&&this._initted&&(this._lock=o=1,this.render(Ye(y*g),!0).invalidate()._lock=0)}if(!this._initted){if(ek(this,c?s:h,o,i,f))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&g!==b))return this;if(u!==this._dur)return this.render(s,i,o)}if(this._rEase){var k=h<a;if(k!==this._inv){var _=k?a:u-a;this._inv=k,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=a,this._invRecip=_?(k?-1:1)/_:0,this._invScale=k?-this.ratio:1-this.ratio,this._invEase=k?this._rEase:this._ease}this.ratio=v=this._invRatio+this._invScale*this._invEase((h-this._invTime)*this._invRecip)}else this.ratio=v=this._ease(h/u);if(this._from&&(this.ratio=v=1-v),this._tTime=f,this._time=h,!this._act&&this._ts&&(this._act=1,this._lazy=0),!a&&f&&!i&&!b&&(wn(this,"onStart"),this._tTime!==f))return this;for(p=this._pt;p;)p.r(v,p.d),p=p._next;w&&w.render(s<0?s:w._dur*w._ease(h/this._dur),i,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!i&&(c&&eh(this,s,i,o),wn(this,"onUpdate")),this._repeat&&g!==b&&this.vars.onRepeat&&!i&&this.parent&&wn(this,"onRepeat"),(f===this._tDur||!f)&&this._tTime===f&&(c&&!this._onUpdate&&eh(this,s,!0,!0),(s||!u)&&(f===this._tDur&&this._ts>0||!f&&this._ts<0)&&ks(this,1),!i&&!(c&&!a)&&(f||a||x)&&(wn(this,f===l?"onComplete":"onReverseComplete",!0),this._prom&&!(f<l&&this.timeScale()>0)&&this._prom()))}return this},n.targets=function(){return this._targets},n.invalidate=function(s){return(!s||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(s),e.prototype.invalidate.call(this,s)},n.resetTo=function(s,i,o,a,l){La||vn.wake(),this._ts||this.play();var u=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||nm(this,u),c=this._ease(u/this._dur),U2(this,s,i,o,a,c,u,l)?this.resetTo(s,i,o,a,1):(Cc(this,0),this.parent||XS(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(s,i){if(i===void 0&&(i="all"),!s&&(!i||i==="all"))return this._lazy=this._pt=0,this.parent?Uo(this):this.scrollTrigger&&this.scrollTrigger.kill(!!kt),this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,i,os&&os.vars.overwrite!==!0)._first||Uo(this),this.parent&&o!==this.timeline.totalDuration()&&lo(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=s?Bn(s):a,u=this._ptLookup,c=this._pt,f,h,p,g,y,b,x;if((!i||i==="all")&&v2(a,l))return i==="all"&&(this._pt=0),Uo(this);for(f=this._op=this._op||[],i!=="all"&&(xt(i)&&(y={},on(i,function(v){return y[v]=1}),i=y),i=V2(a,i)),x=a.length;x--;)if(~l.indexOf(a[x])){h=u[x],i==="all"?(f[x]=i,g=h,p={}):(p=f[x]=f[x]||{},g=i);for(y in g)b=h&&h[y],b&&((!("kill"in b.d)||b.d.kill(y)===!0)&&Sc(this,b,"_pt"),delete h[y]),p!=="all"&&(p[y]=1)}return this._initted&&!this._pt&&c&&Uo(this),this},t.to=function(s,i){return new t(s,i,arguments[2])},t.from=function(s,i){return ia(1,arguments)},t.delayedCall=function(s,i,o,a){return new t(i,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:i,onReverseComplete:i,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,i,o){return ia(2,arguments)},t.set=function(s,i){return i.duration=0,i.repeatDelay||(i.repeat=0),new t(s,i)},t.killTweensOf=function(s,i,o){return Xe.killTweensOf(s,i,o)},t}(Oa);In(ft.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});on("staggerTo,staggerFrom,staggerFromTo",function(e){ft[e]=function(){var t=new Xt,n=nh.call(arguments,0);return n.splice(e==="staggerFromTo"?5:4,0,0),t[e].apply(t,n)}});var rm=function(t,n,r){return t[n]=r},vk=function(t,n,r){return t[n](r)},W2=function(t,n,r,s){return t[n](s.fp,r)},q2=function(t,n,r){return t.setAttribute(n,r)},sm=function(t,n){return rt(t[n])?vk:Kp(t[n])&&t.setAttribute?q2:rm},xk=function(t,n){return n.set(n.t,n.p,Math.round((n.s+n.c*t)*1e6)/1e6,n)},K2=function(t,n){return n.set(n.t,n.p,!!(n.s+n.c*t),n)},wk=function(t,n){var r=n._pt,s="";if(!t&&n.b)s=n.b;else if(t===1&&n.e)s=n.e;else{for(;r;)s=r.p+(r.m?r.m(r.s+r.c*t):Math.round((r.s+r.c*t)*1e4)/1e4)+s,r=r._next;s+=n.c}n.set(n.t,n.p,s,n)},im=function(t,n){for(var r=n._pt;r;)r.r(t,r.d),r=r._next},G2=function(t,n,r,s){for(var i=this._pt,o;i;)o=i._next,i.p===s&&i.modifier(t,n,r),i=o},Y2=function(t){for(var n=this._pt,r,s;n;)s=n._next,n.p===t&&!n.op||n.op===t?Sc(this,n,"_pt"):n.dep||(r=1),n=s;return!r},Q2=function(t,n,r,s){s.mSet(t,n,s.m.call(s.tween,r,s.mt),s)},bk=function(t){for(var n=t._pt,r,s,i,o;n;){for(r=n._next,s=i;s&&s.pr>n.pr;)s=s._next;(n._prev=s?s._prev:o)?n._prev._next=n:i=n,(n._next=s)?s._prev=n:o=n,n=r}t._pt=i},an=function(){function e(n,r,s,i,o,a,l,u,c){this.t=r,this.s=i,this.c=o,this.p=s,this.r=a||xk,this.d=l||this,this.set=u||rm,this.pr=c||0,this._next=n,n&&(n._prev=this)}var t=e.prototype;return t.modifier=function(r,s,i){this.mSet=this.mSet||this.set,this.set=Q2,this.m=r,this.mt=i,this.tween=s},e}();on(Jp+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger,easeReverse",function(e){return Xp[e]=1});Tn.TweenMax=Tn.TweenLite=ft;Tn.TimelineLite=Tn.TimelineMax=Xt;Xe=new Xt({sortChildren:!1,defaults:Aa,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Sn.stringFilter=fk;var Xs=[],Jl={},X2=[],av=0,J2=0,Sd=function(t){return(Jl[t]||X2).map(function(n){return n()})},oh=function(){var t=Date.now(),n=[];t-av>2&&(Sd("matchMediaInit"),Xs.forEach(function(r){var s=r.queries,i=r.conditions,o,a,l,u;for(a in s)o=pr.matchMedia(s[a]).matches,o&&(l=1),o!==i[a]&&(i[a]=o,u=1);u&&(r.revert(),l&&n.push(r))}),Sd("matchMediaRevert"),n.forEach(function(r){return r.onMatch(r,function(s){return r.add(null,s)})}),av=t,Sd("matchMedia"))},_k=function(){function e(n,r){this.selector=r&&rh(r),this.data=[],this._r=[],this.isReverted=!1,this.id=J2++,n&&this.add(n)}var t=e.prototype;return t.add=function(r,s,i){rt(r)&&(i=s,s=r,r=rt);var o=this,a=function(){var u=qe,c=o.selector,f;return u&&u!==o&&u.data.push(o),i&&(o.selector=rh(i)),qe=o,f=s.apply(o,arguments),rt(f)&&o._r.push(f),qe=u,o.selector=c,o.isReverted=!1,f};return o.last=a,r===rt?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},t.ignore=function(r){var s=qe;qe=null,r(this),qe=s},t.getTweens=function(){var r=[];return this.data.forEach(function(s){return s instanceof e?r.push.apply(r,s.getTweens()):s instanceof ft&&!(s.parent&&s.parent.data==="nested")&&r.push(s)}),r},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(r,s){var i=this;if(r?function(){for(var a=i.getTweens(),l=i.data.length,u;l--;)u=i.data[l],u.data==="isFlip"&&(u.revert(),u.getChildren(!0,!0,!1).forEach(function(c){return a.splice(a.indexOf(c),1)}));for(a.map(function(c){return{g:c._dur||c._delay||c._sat&&!c._sat.vars.immediateRender?c.globalTime(0):-1/0,t:c}}).sort(function(c,f){return f.g-c.g||-1/0}).forEach(function(c){return c.t.revert(r)}),l=i.data.length;l--;)u=i.data[l],u instanceof Xt?u.data!=="nested"&&(u.scrollTrigger&&u.scrollTrigger.revert(),u.kill()):!(u instanceof ft)&&u.revert&&u.revert(r);i._r.forEach(function(c){return c(r,i)}),i.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=Xs.length;o--;)Xs[o].id===this.id&&Xs.splice(o,1)},t.revert=function(r){this.kill(r||{})},e}(),Z2=function(){function e(n){this.contexts=[],this.scope=n,qe&&qe.data.push(this)}var t=e.prototype;return t.add=function(r,s,i){kr(r)||(r={matches:r});var o=new _k(0,i||this.scope),a=o.conditions={},l,u,c;qe&&!o.selector&&(o.selector=qe.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=r;for(u in r)u==="all"?c=1:(l=pr.matchMedia(r[u]),l&&(Xs.indexOf(o)<0&&Xs.push(o),(a[u]=l.matches)&&(c=1),l.addListener?l.addListener(oh):l.addEventListener("change",oh)));return c&&s(o,function(f){return o.add(null,f)}),this},t.revert=function(r){this.kill(r||{})},t.kill=function(r){this.contexts.forEach(function(s){return s.kill(r,!0)})},e}(),Vu={registerPlugin:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(s){return uk(s)})},timeline:function(t){return new Xt(t)},getTweensOf:function(t,n){return Xe.getTweensOf(t,n)},getProperty:function(t,n,r,s){xt(t)&&(t=Bn(t)[0]);var i=Gs(t||{}).get,o=r?QS:YS;return r==="native"&&(r=""),t&&(n?o((yn[n]&&yn[n].get||i)(t,n,r,s)):function(a,l,u){return o((yn[a]&&yn[a].get||i)(t,a,l,u))})},quickSetter:function(t,n,r){if(t=Bn(t),t.length>1){var s=t.map(function(c){return un.quickSetter(c,n,r)}),i=s.length;return function(c){for(var f=i;f--;)s[f](c)}}t=t[0]||{};var o=yn[n],a=Gs(t),l=a.harness&&(a.harness.aliases||{})[n]||n,u=o?function(c){var f=new o;Oi._pt=0,f.init(t,r?c+r:c,Oi,0,[t]),f.render(1,f),Oi._pt&&im(1,Oi)}:a.set(t,l);return o?u:function(c){return u(t,l,r?c+r:c,a,1)}},quickTo:function(t,n,r){var s,i=un.to(t,In((s={},s[n]="+=0.1",s.paused=!0,s.stagger=0,s),r||{})),o=function(l,u,c){return i.resetTo(n,l,u,c)};return o.tween=i,o},isTweening:function(t){return Xe.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Qs(t.ease,Aa.ease)),nv(Aa,t||{})},config:function(t){return nv(Sn,t||{})},registerEffect:function(t){var n=t.name,r=t.effect,s=t.plugins,i=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!yn[a]&&!Tn[a]&&Na(n+" effect requires "+a+" plugin.")}),xd[n]=function(a,l,u){return r(Bn(a),In(l||{},i),u)},o&&(Xt.prototype[n]=function(a,l,u){return this.add(xd[n](a,kr(l)?l:(u=l)&&{},this),u)})},registerEase:function(t,n){ke[t]=Qs(n)},parseEase:function(t,n){return arguments.length?Qs(t,n):ke},getById:function(t){return Xe.getById(t)},exportRoot:function(t,n){t===void 0&&(t={});var r=new Xt(t),s,i;for(r.smoothChildTiming=sn(t.smoothChildTiming),Xe.remove(r),r._dp=0,r._time=r._tTime=Xe._time,s=Xe._first;s;)i=s._next,(n||!(!s._dur&&s instanceof ft&&s.vars.onComplete===s._targets[0]))&&gr(r,s,s._start-s._delay),s=i;return gr(Xe,r,0),r},context:function(t,n){return t?new _k(t,n):qe},matchMedia:function(t){return new Z2(t)},matchMediaRefresh:function(){return Xs.forEach(function(t){var n=t.conditions,r,s;for(s in n)n[s]&&(n[s]=!1,r=1);r&&t.revert()})||oh()},addEventListener:function(t,n){var r=Jl[t]||(Jl[t]=[]);~r.indexOf(n)||r.push(n)},removeEventListener:function(t,n){var r=Jl[t],s=r&&r.indexOf(n);s>=0&&r.splice(s,1)},utils:{wrap:P2,wrapYoyo:j2,distribute:rk,random:ik,snap:sk,normalize:R2,getUnit:At,clamp:C2,splitColor:ck,toArray:Bn,selector:rh,mapRange:ak,pipe:T2,unitize:I2,interpolate:A2,shuffle:nk},install:HS,effects:xd,ticker:vn,updateRoot:Xt.updateRoot,plugins:yn,globalTimeline:Xe,core:{PropTween:an,globals:WS,Tween:ft,Timeline:Xt,Animation:Oa,getCache:Gs,_removeLinkedListItem:Sc,reverting:function(){return kt},context:function(t){return t&&qe&&(qe.data.push(t),t._ctx=qe),qe},suppressOverwrites:function(t){return qp=t}}};on("to,from,fromTo,delayedCall,set,killTweensOf",function(e){return Vu[e]=ft[e]});vn.add(Xt.updateRoot);Oi=Vu.to({},{duration:0});var eD=function(t,n){for(var r=t._pt;r&&r.p!==n&&r.op!==n&&r.fp!==n;)r=r._next;return r},tD=function(t,n){var r=t._targets,s,i,o;for(s in n)for(i=r.length;i--;)o=t._ptLookup[i][s],o&&(o=o.d)&&(o._pt&&(o=eD(o,s)),o&&o.modifier&&o.modifier(n[s],t,r[i],s))},kd=function(t,n){return{name:t,headless:1,rawVars:1,init:function(s,i,o){o._onInit=function(a){var l,u;if(xt(i)&&(l={},on(i,function(c){return l[c]=1}),i=l),n){l={};for(u in i)l[u]=n(i[u]);i=l}tD(a,i)}}}},un=Vu.registerPlugin({name:"attr",init:function(t,n,r,s,i){var o,a,l;this.tween=r;for(o in n)l=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(l||0)+"",n[o],s,i,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(t,n){for(var r=n._pt;r;)kt?r.set(r.t,r.p,r.b,r):r.r(t,r.d),r=r._next}},{name:"endArray",headless:1,init:function(t,n){for(var r=n.length;r--;)this.add(t,r,t[r]||0,n[r],0,0,0,0,0,1)}},kd("roundProps",sh),kd("modifiers"),kd("snap",sk))||Vu;ft.version=Xt.version=un.version="3.15.0";VS=1;Gp()&&uo();ke.Power0;ke.Power1;ke.Power2;ke.Power3;ke.Power4;ke.Linear;ke.Quad;ke.Cubic;ke.Quart;ke.Quint;ke.Strong;ke.Elastic;ke.Back;ke.SteppedEase;ke.Bounce;ke.Sine;ke.Expo;ke.Circ;/*!
|
|
52
|
+
* CSSPlugin 3.15.0
|
|
53
|
+
* https://gsap.com
|
|
54
|
+
*
|
|
55
|
+
* Copyright 2008-2026, GreenSock. All rights reserved.
|
|
56
|
+
* Subject to the terms at https://gsap.com/standard-license
|
|
57
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
58
|
+
*/var lv,as,Ki,om,Hs,uv,am,nD=function(){return typeof window<"u"},Wr={},Fs=180/Math.PI,Gi=Math.PI/180,bi=Math.atan2,cv=1e8,lm=/([A-Z])/g,rD=/(left|right|width|margin|padding|x)/i,sD=/[\s,\(]\S/,vr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},ah=function(t,n){return n.set(n.t,n.p,Math.round((n.s+n.c*t)*1e4)/1e4+n.u,n)},iD=function(t,n){return n.set(n.t,n.p,t===1?n.e:Math.round((n.s+n.c*t)*1e4)/1e4+n.u,n)},oD=function(t,n){return n.set(n.t,n.p,t?Math.round((n.s+n.c*t)*1e4)/1e4+n.u:n.b,n)},aD=function(t,n){return n.set(n.t,n.p,t===1?n.e:t?Math.round((n.s+n.c*t)*1e4)/1e4+n.u:n.b,n)},lD=function(t,n){var r=n.s+n.c*t;n.set(n.t,n.p,~~(r+(r<0?-.5:.5))+n.u,n)},Sk=function(t,n){return n.set(n.t,n.p,t?n.e:n.b,n)},kk=function(t,n){return n.set(n.t,n.p,t!==1?n.b:n.e,n)},uD=function(t,n,r){return t.style[n]=r},cD=function(t,n,r){return t.style.setProperty(n,r)},dD=function(t,n,r){return t._gsap[n]=r},fD=function(t,n,r){return t._gsap.scaleX=t._gsap.scaleY=r},hD=function(t,n,r,s,i){var o=t._gsap;o.scaleX=o.scaleY=r,o.renderTransform(i,o)},pD=function(t,n,r,s,i){var o=t._gsap;o[n]=r,o.renderTransform(i,o)},Ze="transform",ln=Ze+"Origin",mD=function e(t,n){var r=this,s=this.target,i=s.style,o=s._gsap;if(t in Wr&&i){if(this.tfm=this.tfm||{},t!=="transform")t=vr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return r.tfm[a]=Mr(s,a)}):this.tfm[t]=o.x?o[t]:Mr(s,t),t===ln&&(this.tfm.zOrigin=o.zOrigin);else return vr.transform.split(",").forEach(function(a){return e.call(r,a,n)});if(this.props.indexOf(Ze)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(ln,n,"")),t=Ze}(i||n)&&this.props.push(t,n,i[t])},Ck=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},gD=function(){var t=this.props,n=this.target,r=n.style,s=n._gsap,i,o;for(i=0;i<t.length;i+=3)t[i+1]?t[i+1]===2?n[t[i]](t[i+2]):n[t[i]]=t[i+2]:t[i+2]?r[t[i]]=t[i+2]:r.removeProperty(t[i].substr(0,2)==="--"?t[i]:t[i].replace(lm,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),i=am(),(!i||!i.isStart)&&!r[Ze]&&(Ck(r),s.zOrigin&&r[ln]&&(r[ln]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},Ek=function(t,n){var r={target:t,props:[],revert:gD,save:mD};return t._gsap||un.core.getCache(t),n&&t.style&&t.nodeType&&n.split(",").forEach(function(s){return r.save(s)}),r},Tk,lh=function(t,n){var r=as.createElementNS?as.createElementNS((n||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):as.createElement(t);return r&&r.style?r:as.createElement(t)},bn=function e(t,n,r){var s=getComputedStyle(t);return s[n]||s.getPropertyValue(n.replace(lm,"-$1").toLowerCase())||s.getPropertyValue(n)||!r&&e(t,co(n)||n,1)||""},dv="O,Moz,ms,Ms,Webkit".split(","),co=function(t,n,r){var s=n||Hs,i=s.style,o=5;if(t in i&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(dv[o]+t in i););return o<0?null:(o===3?"ms":o>=0?dv[o]:"")+t},uh=function(){nD()&&window.document&&(lv=window,as=lv.document,Ki=as.documentElement,Hs=lh("div")||{style:{}},lh("div"),Ze=co(Ze),ln=Ze+"Origin",Hs.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Tk=!!co("perspective"),am=un.core.reverting,om=1)},fv=function(t){var n=t.ownerSVGElement,r=lh("svg",n&&n.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=t.cloneNode(!0),i;s.style.display="block",r.appendChild(s),Ki.appendChild(r);try{i=s.getBBox()}catch{}return r.removeChild(s),Ki.removeChild(r),i},hv=function(t,n){for(var r=n.length;r--;)if(t.hasAttribute(n[r]))return t.getAttribute(n[r])},Ik=function(t){var n,r;try{n=t.getBBox()}catch{n=fv(t),r=1}return n&&(n.width||n.height)||r||(n=fv(t)),n&&!n.width&&!n.x&&!n.y?{x:+hv(t,["x","cx","x1"])||0,y:+hv(t,["y","cy","y1"])||0,width:0,height:0}:n},Rk=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Ik(t))},Cs=function(t,n){if(n){var r=t.style,s;n in Wr&&n!==ln&&(n=Ze),r.removeProperty?(s=n.substr(0,2),(s==="ms"||n.substr(0,6)==="webkit")&&(n="-"+n),r.removeProperty(s==="--"?n:n.replace(lm,"-$1").toLowerCase())):r.removeAttribute(n)}},ls=function(t,n,r,s,i,o){var a=new an(t._pt,n,r,0,1,o?kk:Sk);return t._pt=a,a.b=s,a.e=i,t._props.push(r),a},pv={deg:1,rad:1,turn:1},yD={grid:1,flex:1},Es=function e(t,n,r,s){var i=parseFloat(r)||0,o=(r+"").trim().substr((i+"").length)||"px",a=Hs.style,l=rD.test(n),u=t.tagName.toLowerCase()==="svg",c=(u?"client":"offset")+(l?"Width":"Height"),f=100,h=s==="px",p=s==="%",g,y,b,x;if(s===o||!i||pv[s]||pv[o])return i;if(o!=="px"&&!h&&(i=e(t,n,r,"px")),x=t.getCTM&&Rk(t),(p||o==="%")&&(Wr[n]||~n.indexOf("adius")))return g=x?t.getBBox()[l?"width":"height"]:t[c],lt(p?i/g*f:i/100*g);if(a[l?"width":"height"]=f+(h?o:s),y=s!=="rem"&&~n.indexOf("adius")||s==="em"&&t.appendChild&&!u?t:t.parentNode,x&&(y=(t.ownerSVGElement||{}).parentNode),(!y||y===as||!y.appendChild)&&(y=as.body),b=y._gsap,b&&p&&b.width&&l&&b.time===vn.time&&!b.uncache)return lt(i/b.width*f);if(p&&(n==="height"||n==="width")){var v=t.style[n];t.style[n]=f+s,g=t[c],v?t.style[n]=v:Cs(t,n)}else(p||o==="%")&&!yD[bn(y,"display")]&&(a.position=bn(t,"position")),y===t&&(a.position="static"),y.appendChild(Hs),g=Hs[c],y.removeChild(Hs),a.position="absolute";return l&&p&&(b=Gs(y),b.time=vn.time,b.width=y[c]),lt(h?g*i/f:g&&i?f/g*i:0)},Mr=function(t,n,r,s){var i;return om||uh(),n in vr&&n!=="transform"&&(n=vr[n],~n.indexOf(",")&&(n=n.split(",")[0])),Wr[n]&&n!=="transform"?(i=Fa(t,s),i=n!=="transformOrigin"?i[n]:i.svg?i.origin:Wu(bn(t,ln))+" "+i.zOrigin+"px"):(i=t.style[n],(!i||i==="auto"||s||~(i+"").indexOf("calc("))&&(i=Hu[n]&&Hu[n](t,n,r)||bn(t,n)||KS(t,n)||(n==="opacity"?1:0))),r&&!~(i+"").trim().indexOf(" ")?Es(t,n,i,r)+r:i},vD=function(t,n,r,s){if(!r||r==="none"){var i=co(n,t,1),o=i&&bn(t,i,1);o&&o!==r?(n=i,r=o):n==="borderColor"&&(r=bn(t,"borderTopColor"))}var a=new an(this._pt,t.style,n,0,1,wk),l=0,u=0,c,f,h,p,g,y,b,x,v,w,k,_;if(a.b=r,a.e=s,r+="",s+="",s.substring(0,6)==="var(--"&&(s=bn(t,s.substring(4,s.indexOf(")")))),s==="auto"&&(y=t.style[n],t.style[n]=s,s=bn(t,n)||s,y?t.style[n]=y:Cs(t,n)),c=[r,s],fk(c),r=c[0],s=c[1],h=r.match(Li)||[],_=s.match(Li)||[],_.length){for(;f=Li.exec(s);)b=f[0],v=s.substring(l,f.index),g?g=(g+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(g=1),b!==(y=h[u++]||"")&&(p=parseFloat(y)||0,k=y.substr((p+"").length),b.charAt(1)==="="&&(b=qi(p,b)+k),x=parseFloat(b),w=b.substr((x+"").length),l=Li.lastIndex-w.length,w||(w=w||Sn.units[n]||k,l===s.length&&(s+=w,a.e+=w)),k!==w&&(p=Es(t,n,y,w)||0),a._pt={_next:a._pt,p:v||u===1?v:",",s:p,c:x-p,m:g&&g<4||n==="zIndex"?Math.round:0});a.c=l<s.length?s.substring(l,s.length):""}else a.r=n==="display"&&s==="none"?kk:Sk;return US.test(s)&&(a.e=0),this._pt=a,a},mv={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},xD=function(t){var n=t.split(" "),r=n[0],s=n[1]||"50%";return(r==="top"||r==="bottom"||s==="left"||s==="right")&&(t=r,r=s,s=t),n[0]=mv[r]||r,n[1]=mv[s]||s,n.join(" ")},wD=function(t,n){if(n.tween&&n.tween._time===n.tween._dur){var r=n.t,s=r.style,i=n.u,o=r._gsap,a,l,u;if(i==="all"||i===!0)s.cssText="",l=1;else for(i=i.split(","),u=i.length;--u>-1;)a=i[u],Wr[a]&&(l=1,a=a==="transformOrigin"?ln:Ze),Cs(r,a);l&&(Cs(r,Ze),o&&(o.svg&&r.removeAttribute("transform"),s.scale=s.rotate=s.translate="none",Fa(r,1),o.uncache=1,Ck(s)))}},Hu={clearProps:function(t,n,r,s,i){if(i.data!=="isFromStart"){var o=t._pt=new an(t._pt,n,r,0,0,wD);return o.u=s,o.pr=-10,o.tween=i,t._props.push(r),1}}},za=[1,0,0,1,0,0],Pk={},jk=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},gv=function(t){var n=bn(t,Ze);return jk(n)?za:n.substr(7).match($S).map(lt)},um=function(t,n){var r=t._gsap||Gs(t),s=t.style,i=gv(t),o,a,l,u;return r.svg&&t.getAttribute("transform")?(l=t.transform.baseVal.consolidate().matrix,i=[l.a,l.b,l.c,l.d,l.e,l.f],i.join(",")==="1,0,0,1,0,0"?za:i):(i===za&&!t.offsetParent&&t!==Ki&&!r.svg&&(l=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent&&!t.getBoundingClientRect().width)&&(u=1,a=t.nextElementSibling,Ki.appendChild(t)),i=gv(t),l?s.display=l:Cs(t,"display"),u&&(a?o.insertBefore(t,a):o?o.appendChild(t):Ki.removeChild(t))),n&&i.length>6?[i[0],i[1],i[4],i[5],i[12],i[13]]:i)},ch=function(t,n,r,s,i,o){var a=t._gsap,l=i||um(t,!0),u=a.xOrigin||0,c=a.yOrigin||0,f=a.xOffset||0,h=a.yOffset||0,p=l[0],g=l[1],y=l[2],b=l[3],x=l[4],v=l[5],w=n.split(" "),k=parseFloat(w[0])||0,_=parseFloat(w[1])||0,S,T,P,R;r?l!==za&&(T=p*b-g*y)&&(P=k*(b/T)+_*(-y/T)+(y*v-b*x)/T,R=k*(-g/T)+_*(p/T)-(p*v-g*x)/T,k=P,_=R):(S=Ik(t),k=S.x+(~w[0].indexOf("%")?k/100*S.width:k),_=S.y+(~(w[1]||w[0]).indexOf("%")?_/100*S.height:_)),s||s!==!1&&a.smooth?(x=k-u,v=_-c,a.xOffset=f+(x*p+v*y)-x,a.yOffset=h+(x*g+v*b)-v):a.xOffset=a.yOffset=0,a.xOrigin=k,a.yOrigin=_,a.smooth=!!s,a.origin=n,a.originIsAbsolute=!!r,t.style[ln]="0px 0px",o&&(ls(o,a,"xOrigin",u,k),ls(o,a,"yOrigin",c,_),ls(o,a,"xOffset",f,a.xOffset),ls(o,a,"yOffset",h,a.yOffset)),t.setAttribute("data-svg-origin",k+" "+_)},Fa=function(t,n){var r=t._gsap||new pk(t);if("x"in r&&!n&&!r.uncache)return r;var s=t.style,i=r.scaleX<0,o="px",a="deg",l=getComputedStyle(t),u=bn(t,ln)||"0",c,f,h,p,g,y,b,x,v,w,k,_,S,T,P,R,C,M,D,U,V,W,J,ne,$,F,E,X,Z,I,O,te;return c=f=h=y=b=x=v=w=k=0,p=g=1,r.svg=!!(t.getCTM&&Rk(t)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(s[Ze]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Ze]!=="none"?l[Ze]:"")),s.scale=s.rotate=s.translate="none"),T=um(t,r.svg),r.svg&&(r.uncache?($=t.getBBox(),u=r.xOrigin-$.x+"px "+(r.yOrigin-$.y)+"px",ne=""):ne=!n&&t.getAttribute("data-svg-origin"),ch(t,ne||u,!!ne||r.originIsAbsolute,r.smooth!==!1,T)),_=r.xOrigin||0,S=r.yOrigin||0,T!==za&&(M=T[0],D=T[1],U=T[2],V=T[3],c=W=T[4],f=J=T[5],T.length===6?(p=Math.sqrt(M*M+D*D),g=Math.sqrt(V*V+U*U),y=M||D?bi(D,M)*Fs:0,v=U||V?bi(U,V)*Fs+y:0,v&&(g*=Math.abs(Math.cos(v*Gi))),r.svg&&(c-=_-(_*M+S*U),f-=S-(_*D+S*V))):(te=T[6],I=T[7],E=T[8],X=T[9],Z=T[10],O=T[11],c=T[12],f=T[13],h=T[14],P=bi(te,Z),b=P*Fs,P&&(R=Math.cos(-P),C=Math.sin(-P),ne=W*R+E*C,$=J*R+X*C,F=te*R+Z*C,E=W*-C+E*R,X=J*-C+X*R,Z=te*-C+Z*R,O=I*-C+O*R,W=ne,J=$,te=F),P=bi(-U,Z),x=P*Fs,P&&(R=Math.cos(-P),C=Math.sin(-P),ne=M*R-E*C,$=D*R-X*C,F=U*R-Z*C,O=V*C+O*R,M=ne,D=$,U=F),P=bi(D,M),y=P*Fs,P&&(R=Math.cos(P),C=Math.sin(P),ne=M*R+D*C,$=W*R+J*C,D=D*R-M*C,J=J*R-W*C,M=ne,W=$),b&&Math.abs(b)+Math.abs(y)>359.9&&(b=y=0,x=180-x),p=lt(Math.sqrt(M*M+D*D+U*U)),g=lt(Math.sqrt(J*J+te*te)),P=bi(W,J),v=Math.abs(P)>2e-4?P*Fs:0,k=O?1/(O<0?-O:O):0),r.svg&&(ne=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!jk(bn(t,Ze)),ne&&t.setAttribute("transform",ne))),Math.abs(v)>90&&Math.abs(v)<270&&(i?(p*=-1,v+=y<=0?180:-180,y+=y<=0?180:-180):(g*=-1,v+=v<=0?180:-180)),n=n||r.uncache,r.x=c-((r.xPercent=c&&(!n&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+o,r.y=f-((r.yPercent=f&&(!n&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-f)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+o,r.z=h+o,r.scaleX=lt(p),r.scaleY=lt(g),r.rotation=lt(y)+a,r.rotationX=lt(b)+a,r.rotationY=lt(x)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=k+o,(r.zOrigin=parseFloat(u.split(" ")[2])||!n&&r.zOrigin||0)&&(s[ln]=Wu(u)),r.xOffset=r.yOffset=0,r.force3D=Sn.force3D,r.renderTransform=r.svg?_D:Tk?Ak:bD,r.uncache=0,r},Wu=function(t){return(t=t.split(" "))[0]+" "+t[1]},Cd=function(t,n,r){var s=At(n);return lt(parseFloat(n)+parseFloat(Es(t,"x",r+"px",s)))+s},bD=function(t,n){n.z="0px",n.rotationY=n.rotationX="0deg",n.force3D=0,Ak(t,n)},Ms="0deg",Mo="0px",Ds=") ",Ak=function(t,n){var r=n||this,s=r.xPercent,i=r.yPercent,o=r.x,a=r.y,l=r.z,u=r.rotation,c=r.rotationY,f=r.rotationX,h=r.skewX,p=r.skewY,g=r.scaleX,y=r.scaleY,b=r.transformPerspective,x=r.force3D,v=r.target,w=r.zOrigin,k="",_=x==="auto"&&t&&t!==1||x===!0;if(w&&(f!==Ms||c!==Ms)){var S=parseFloat(c)*Gi,T=Math.sin(S),P=Math.cos(S),R;S=parseFloat(f)*Gi,R=Math.cos(S),o=Cd(v,o,T*R*-w),a=Cd(v,a,-Math.sin(S)*-w),l=Cd(v,l,P*R*-w+w)}b!==Mo&&(k+="perspective("+b+Ds),(s||i)&&(k+="translate("+s+"%, "+i+"%) "),(_||o!==Mo||a!==Mo||l!==Mo)&&(k+=l!==Mo||_?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+Ds),u!==Ms&&(k+="rotate("+u+Ds),c!==Ms&&(k+="rotateY("+c+Ds),f!==Ms&&(k+="rotateX("+f+Ds),(h!==Ms||p!==Ms)&&(k+="skew("+h+", "+p+Ds),(g!==1||y!==1)&&(k+="scale("+g+", "+y+Ds),v.style[Ze]=k||"translate(0, 0)"},_D=function(t,n){var r=n||this,s=r.xPercent,i=r.yPercent,o=r.x,a=r.y,l=r.rotation,u=r.skewX,c=r.skewY,f=r.scaleX,h=r.scaleY,p=r.target,g=r.xOrigin,y=r.yOrigin,b=r.xOffset,x=r.yOffset,v=r.forceCSS,w=parseFloat(o),k=parseFloat(a),_,S,T,P,R;l=parseFloat(l),u=parseFloat(u),c=parseFloat(c),c&&(c=parseFloat(c),u+=c,l+=c),l||u?(l*=Gi,u*=Gi,_=Math.cos(l)*f,S=Math.sin(l)*f,T=Math.sin(l-u)*-h,P=Math.cos(l-u)*h,u&&(c*=Gi,R=Math.tan(u-c),R=Math.sqrt(1+R*R),T*=R,P*=R,c&&(R=Math.tan(c),R=Math.sqrt(1+R*R),_*=R,S*=R)),_=lt(_),S=lt(S),T=lt(T),P=lt(P)):(_=f,P=h,S=T=0),(w&&!~(o+"").indexOf("px")||k&&!~(a+"").indexOf("px"))&&(w=Es(p,"x",o,"px"),k=Es(p,"y",a,"px")),(g||y||b||x)&&(w=lt(w+g-(g*_+y*T)+b),k=lt(k+y-(g*S+y*P)+x)),(s||i)&&(R=p.getBBox(),w=lt(w+s/100*R.width),k=lt(k+i/100*R.height)),R="matrix("+_+","+S+","+T+","+P+","+w+","+k+")",p.setAttribute("transform",R),v&&(p.style[Ze]=R)},SD=function(t,n,r,s,i){var o=360,a=xt(i),l=parseFloat(i)*(a&&~i.indexOf("rad")?Fs:1),u=l-s,c=s+u+"deg",f,h;return a&&(f=i.split("_")[1],f==="short"&&(u%=o,u!==u%(o/2)&&(u+=u<0?o:-o)),f==="cw"&&u<0?u=(u+o*cv)%o-~~(u/o)*o:f==="ccw"&&u>0&&(u=(u-o*cv)%o-~~(u/o)*o)),t._pt=h=new an(t._pt,n,r,s,u,iD),h.e=c,h.u="deg",t._props.push(r),h},yv=function(t,n){for(var r in n)t[r]=n[r];return t},kD=function(t,n,r){var s=yv({},r._gsap),i="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,u,c,f,h,p,g;s.svg?(u=r.getAttribute("transform"),r.setAttribute("transform",""),o[Ze]=n,a=Fa(r,1),Cs(r,Ze),r.setAttribute("transform",u)):(u=getComputedStyle(r)[Ze],o[Ze]=n,a=Fa(r,1),o[Ze]=u);for(l in Wr)u=s[l],c=a[l],u!==c&&i.indexOf(l)<0&&(p=At(u),g=At(c),f=p!==g?Es(r,l,u,g):parseFloat(u),h=parseFloat(c),t._pt=new an(t._pt,a,l,f,h-f,ah),t._pt.u=g||0,t._props.push(l));yv(a,s)};on("padding,margin,Width,Radius",function(e,t){var n="Top",r="Right",s="Bottom",i="Left",o=(t<3?[n,r,s,i]:[n+i,n+r,s+r,s+i]).map(function(a){return t<2?e+a:"border"+a+e});Hu[t>1?"border"+e:e]=function(a,l,u,c,f){var h,p;if(arguments.length<4)return h=o.map(function(g){return Mr(a,g,u)}),p=h.join(" "),p.split(h[0]).length===5?h[0]:p;h=(c+"").split(" "),p={},o.forEach(function(g,y){return p[g]=h[y]=h[y]||h[(y-1)/2|0]}),a.init(l,p,f)}});var Nk={name:"css",register:uh,targetTest:function(t){return t.style&&t.nodeType},init:function(t,n,r,s,i){var o=this._props,a=t.style,l=r.vars.startAt,u,c,f,h,p,g,y,b,x,v,w,k,_,S,T,P,R;om||uh(),this.styles=this.styles||Ek(t),P=this.styles.props,this.tween=r;for(y in n)if(y!=="autoRound"&&(c=n[y],!(yn[y]&&mk(y,n,r,s,t,i)))){if(p=typeof c,g=Hu[y],p==="function"&&(c=c.call(r,s,t,i),p=typeof c),p==="string"&&~c.indexOf("random(")&&(c=Da(c)),g)g(this,t,y,c,r)&&(T=1);else if(y.substr(0,2)==="--")u=(getComputedStyle(t).getPropertyValue(y)+"").trim(),c+="",xs.lastIndex=0,xs.test(u)||(b=At(u),x=At(c),x?b!==x&&(u=Es(t,y,u,x)+x):b&&(c+=b)),this.add(a,"setProperty",u,c,s,i,0,0,y),o.push(y),P.push(y,0,a[y]);else if(p!=="undefined"){if(l&&y in l?(u=typeof l[y]=="function"?l[y].call(r,s,t,i):l[y],xt(u)&&~u.indexOf("random(")&&(u=Da(u)),At(u+"")||u==="auto"||(u+=Sn.units[y]||At(Mr(t,y))||""),(u+"").charAt(1)==="="&&(u=Mr(t,y))):u=Mr(t,y),h=parseFloat(u),v=p==="string"&&c.charAt(1)==="="&&c.substr(0,2),v&&(c=c.substr(2)),f=parseFloat(c),y in vr&&(y==="autoAlpha"&&(h===1&&Mr(t,"visibility")==="hidden"&&f&&(h=0),P.push("visibility",0,a.visibility),ls(this,a,"visibility",h?"inherit":"hidden",f?"inherit":"hidden",!f)),y!=="scale"&&y!=="transform"&&(y=vr[y],~y.indexOf(",")&&(y=y.split(",")[0]))),w=y in Wr,w){if(this.styles.save(y),R=c,p==="string"&&c.substring(0,6)==="var(--"){if(c=bn(t,c.substring(4,c.indexOf(")"))),c.substring(0,5)==="calc("){var C=t.style.perspective;t.style.perspective=c,c=bn(t,"perspective"),C?t.style.perspective=C:Cs(t,"perspective")}f=parseFloat(c)}if(k||(_=t._gsap,_.renderTransform&&!n.parseTransform||Fa(t,n.parseTransform),S=n.smoothOrigin!==!1&&_.smooth,k=this._pt=new an(this._pt,a,Ze,0,1,_.renderTransform,_,0,-1),k.dep=1),y==="scale")this._pt=new an(this._pt,_,"scaleY",_.scaleY,(v?qi(_.scaleY,v+f):f)-_.scaleY||0,ah),this._pt.u=0,o.push("scaleY",y),y+="X";else if(y==="transformOrigin"){P.push(ln,0,a[ln]),c=xD(c),_.svg?ch(t,c,0,S,0,this):(x=parseFloat(c.split(" ")[2])||0,x!==_.zOrigin&&ls(this,_,"zOrigin",_.zOrigin,x),ls(this,a,y,Wu(u),Wu(c)));continue}else if(y==="svgOrigin"){ch(t,c,1,S,0,this);continue}else if(y in Pk){SD(this,_,y,h,v?qi(h,v+c):c);continue}else if(y==="smoothOrigin"){ls(this,_,"smooth",_.smooth,c);continue}else if(y==="force3D"){_[y]=c;continue}else if(y==="transform"){kD(this,c,t);continue}}else y in a||(y=co(y)||y);if(w||(f||f===0)&&(h||h===0)&&!sD.test(c)&&y in a)b=(u+"").substr((h+"").length),f||(f=0),x=At(c)||(y in Sn.units?Sn.units[y]:b),b!==x&&(h=Es(t,y,u,x)),this._pt=new an(this._pt,w?_:a,y,h,(v?qi(h,v+f):f)-h,!w&&(x==="px"||y==="zIndex")&&n.autoRound!==!1?lD:ah),this._pt.u=x||0,w&&R!==c?(this._pt.b=u,this._pt.e=R,this._pt.r=aD):b!==x&&x!=="%"&&(this._pt.b=u,this._pt.r=oD);else if(y in a)vD.call(this,t,y,u,v?v+c:c);else if(y in t)this.add(t,y,u||t[y],v?v+c:c,s,i);else if(y!=="parseTransform"){Qp(y,c);continue}w||(y in a?P.push(y,0,a[y]):typeof t[y]=="function"?P.push(y,2,t[y]()):P.push(y,1,u||t[y])),o.push(y)}}T&&bk(this)},render:function(t,n){if(n.tween._time||!am())for(var r=n._pt;r;)r.r(t,r.d),r=r._next;else n.styles.revert()},get:Mr,aliases:vr,getSetter:function(t,n,r){var s=vr[n];return s&&s.indexOf(",")<0&&(n=s),n in Wr&&n!==ln&&(t._gsap.x||Mr(t,"x"))?r&&uv===r?n==="scale"?fD:dD:(uv=r||{})&&(n==="scale"?hD:pD):t.style&&!Kp(t.style[n])?uD:~n.indexOf("-")?cD:sm(t,n)},core:{_removeProperty:Cs,_getMatrix:um}};un.utils.checkPrefix=co;un.core.getStyleSaver=Ek;(function(e,t,n,r){var s=on(e+","+t+","+n,function(i){Wr[i]=1});on(t,function(i){Sn.units[i]="deg",Pk[i]=1}),vr[s[13]]=e+","+t,on(r,function(i){var o=i.split(":");vr[o[1]]=s[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");on("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(e){Sn.units[e]="px"});un.registerPlugin(Nk);var ce=un.registerPlugin(Nk)||un;ce.core.Tween;const Dr={fast:.18,base:.28,enterEase:"power3.out",exitEase:"power2.in"};function Jt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Mk='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function vv(e){return Array.from(e.querySelectorAll(Mk)).filter(t=>{let n=t;for(;n&&n!==e.parentElement;){const r=window.getComputedStyle(n);if(r.display==="none"||r.visibility==="hidden")return!1;n=n.parentElement}return!0})}function mi(e){const t=m.useRef(null),n=m.useRef(!1),r=m.useRef(e);r.current=e;const s=m.useRef(null),i=m.useCallback(()=>{const a=s.current;a instanceof HTMLElement&&a.isConnected&&(a.tabIndex>=0||a.matches(Mk))&&a.focus(),s.current=null},[]);m.useEffect(()=>{const a=t.current;if(!a)return;const l=a.querySelector(":scope > *");if(s.current=document.activeElement,l){const f=vv(l)[0];f?f.focus():(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus())}function u(f){if(f.key!=="Tab"||!l)return;const h=vv(l);if(h.length===0){f.preventDefault();return}const p=h[0],g=h[h.length-1];f.shiftKey?(document.activeElement===p||!l.contains(document.activeElement))&&(f.preventDefault(),g.focus()):(document.activeElement===g||!l.contains(document.activeElement))&&(f.preventDefault(),p.focus())}if(document.addEventListener("keydown",u),Jt())return ce.set(a,{opacity:1}),l&&ce.set(l,{clearProps:"transform,opacity"}),()=>{document.removeEventListener("keydown",u)};const c=ce.timeline();return c.fromTo(a,{opacity:0},{opacity:1,duration:Dr.fast,ease:"none"}),l&&c.fromTo(l,{y:14,scale:.97,opacity:0},{y:0,scale:1,opacity:1,duration:Dr.base,ease:Dr.enterEase},"<"),()=>{c.kill(),document.removeEventListener("keydown",u)}},[]);const o=m.useCallback(()=>{if(n.current)return;n.current=!0;const a=t.current;if(!a||Jt()){i(),r.current();return}const l=a.querySelector(":scope > *"),u=ce.timeline({onComplete:()=>{i(),r.current()}});l&&u.to(l,{y:10,scale:.97,opacity:0,duration:Dr.fast,ease:Dr.exitEase}),u.to(a,{opacity:0,duration:Dr.fast,ease:"none"},"<")},[i]);return{rootRef:t,requestClose:o}}function cm({size:e=18}){return d.jsxs("svg",{width:e,height:Math.round(e*1.2),viewBox:"0 0 10 12","aria-hidden":"true",focusable:"false",style:{display:"block",flexShrink:0},children:[d.jsx("rect",{x:"1",y:"2",width:"8",height:"7",fill:"#c97c5a"}),d.jsx("rect",{x:"0",y:"3",width:"1",height:"2",fill:"#c97c5a"}),d.jsx("rect",{x:"9",y:"3",width:"1",height:"2",fill:"#c97c5a"}),d.jsx("rect",{x:"2",y:"4",width:"2",height:"2",fill:"var(--bg)"}),d.jsx("rect",{x:"6",y:"4",width:"2",height:"2",fill:"var(--bg)"}),d.jsx("rect",{x:"2",y:"9",width:"2",height:"2",fill:"#c97c5a"}),d.jsx("rect",{x:"6",y:"9",width:"2",height:"2",fill:"#c97c5a"})]})}function Wn({size:e=16,children:t,...n}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:t})}function CD(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12 20h9"}),d.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Dk(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"m7 11 2-2-2-2"}),d.jsx("path",{d:"M11 13h4"}),d.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"})]})}function ED(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12 8V4H8"}),d.jsx("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),d.jsx("path",{d:"M2 14h2"}),d.jsx("path",{d:"M20 14h2"}),d.jsx("path",{d:"M15 13v2"}),d.jsx("path",{d:"M9 13v2"})]})}function TD(e){return d.jsxs(Wn,{...e,children:[d.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),d.jsx("path",{d:"M9 3v18"})]})}function ID(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),d.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function RD(e){return d.jsx(Wn,{...e,children:d.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})}function dh(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M18 6 6 18"}),d.jsx("path",{d:"m6 6 12 12"})]})}function PD(e){return d.jsx(Wn,{...e,children:d.jsx("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54L22 3z"})})}function jD(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12 5v14"}),d.jsx("path",{d:"m19 12-7 7-7-7"})]})}function AD(e){return d.jsxs(Wn,{...e,children:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("path",{d:"m21 21-4.35-4.35"})]})}function ND(e){return d.jsx(Wn,{...e,children:d.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2",ry:"2",fill:"currentColor",stroke:"none"})})}function Lk({level:e=1,charging:t=!1,...n}){const r=Math.max(0,Math.min(1,e))*12;return d.jsxs(Wn,{...n,children:[d.jsx("rect",{width:"16",height:"10",x:"2",y:"7",rx:"2"}),d.jsx("line",{x1:"22",x2:"22",y1:"11",y2:"13"}),r>0?d.jsx("rect",{x:"4",y:"9",width:r,height:"6",rx:"1",fill:"currentColor",stroke:"none"}):null,t?d.jsx("path",{d:"M11 9.5 9 12h2l-2 2.5",stroke:"var(--bg, #000)",strokeWidth:1.4}):null]})}function Ok({size:e=18}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",focusable:"false",style:{display:"block",flexShrink:0},children:d.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function fh(e){if(e.thinking)return!0;const t=e.lastActivityMs;return typeof t=="number"&&Number.isFinite(t)&&Date.now()-t<15e3}function MD(e){if(!e)return"";const t=e.replace(/\/$/,"").split("/");return t[t.length-1]||e}function DD(e){if(e==null)return"?";if(e===300)return"5h";if(e===10080)return"7d";const t=e/60;return Number.isInteger(t)&&t>=1?`${t}h`:`${e}m`}function LD(e){const t=new Map;for(const n of e){const r=n.sessionName??"?",s=n.windowIndex??0;t.has(r)||t.set(r,new Map);const i=t.get(r);i.has(s)||i.set(s,[]),i.get(s).push(n)}return[...t.entries()].sort(([n],[r])=>n.localeCompare(r,void 0,{numeric:!0})).map(([n,r])=>({sessionName:n,windows:[...r.entries()].sort(([s],[i])=>s-i).map(([s,i])=>({windowIndex:s,windowName:i[0]?.tmuxName||`window ${s}`,panes:[...i].sort((o,a)=>(o.paneIndex??0)-(a.paneIndex??0))}))}))}function OD({s:e,selected:t,onSelect:n,hotkey:r,workingOverrideId:s,hasRunningSubagents:i}){const o=e.kind==="terminal",a=e.kind==="codex",l=o?e.ccShell?`shell · ${e.cmd||"sh"}`:e.cmd||e.tmuxName||"shell":e.title||e.name||e.id,u=o?null:e.pending?"ask":i?"cloning":fh(e)||e.id===s?"working":"sleeping",c=m.useRef(null),f=m.useRef(e.pending);return m.useEffect(()=>{e.pending&&!f.current&&c.current&&!Jt()&&ce.fromTo(c.current,{boxShadow:"0 0 0 2px var(--accent)"},{boxShadow:"0 0 0 0 rgba(0,0,0,0)",duration:1.1,ease:"power2.out"}),f.current=e.pending},[e.pending]),d.jsxs("li",{ref:c,role:"option","aria-selected":t,tabIndex:0,className:"session-item","data-active":e.active?"true":"false","data-selected":t?"true":"false","data-kind":e.kind??"claude","data-pending":e.pending?"true":void 0,"data-hotkey":r,"data-hotkey-dir":r?"right":void 0,onClick:()=>n(e.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n(e.id))},children:[d.jsxs("div",{className:"session-top",children:[d.jsxs("span",{className:"pane-icon","data-kind":o?"terminal":a?"codex":"claude","data-active":e.active?"true":"false","data-state":u??void 0,"aria-label":o?"terminal pane":a?"Codex pane":"Claude pane",title:o?e.active?"active pane":"inactive pane":u==="ask"?"waiting on a question":u==="cloning"?"running sub-agents…":u==="working"?"working…":"idle",children:[o?d.jsx(Dk,{size:15}):a?d.jsx(Ok,{size:12}):d.jsx(cm,{size:14}),u==="ask"?d.jsx("span",{className:"pane-icon-badge pane-icon-ask","aria-hidden":"true",children:"?"}):u==="cloning"?d.jsx("span",{className:"pane-icon-badge pane-icon-clone","aria-hidden":"true"}):u==="sleeping"?d.jsx("span",{className:"pane-icon-badge pane-icon-zzz","aria-hidden":"true",children:"z"}):null]}),d.jsx("span",{className:"session-name",children:l}),!o&&u==="working"?d.jsx("span",{className:"thinking-dot","aria-label":"working",title:"Working…"}):null,e.pending?d.jsx("span",{className:"ask-badge","aria-label":"pending question",children:"ASK"}):null,o&&e.cwd?d.jsx("span",{className:"meta-cwd meta-cwd-inline",children:MD(e.cwd)}):null]}),!o&&(e.model||e.ctxPct!=null||a&&e.usagePct!=null)?d.jsxs("div",{className:"session-meta",children:[e.model?d.jsx("span",{className:"meta-model",children:e.model}):null,e.ctxPct!=null?d.jsxs("span",{className:"meta-ctx",children:["ctx:",Math.round(e.ctxPct),"%"]}):null,a&&e.usagePct!=null?d.jsxs("span",{className:"meta-usage",children:[DD(e.usageWindowMin),":",Math.round(e.usagePct),"%"]}):null]}):null]})}function zD({sessions:e,selectedId:t,onSelect:n,filter:r,collapsed:s,onToggleCollapse:i,hotkeyById:o,workingOverrideId:a,runningSubagentCountById:l}){const u=m.useMemo(()=>{const c=e.filter(f=>r==="all"?!0:r==="terminal"?f.kind==="terminal":r==="codex"?f.kind==="codex":f.kind!=="terminal"&&f.kind!=="codex");return LD(c)},[e,r]);return u.length===0?d.jsx("div",{className:"session-list",role:"listbox","aria-label":"Sessions",children:d.jsx("div",{className:"session-empty",children:r==="all"?"no tmux panes":`no ${r} sessions`})}):d.jsx("div",{className:"session-list",role:"listbox","aria-label":"Sessions",children:u.map(c=>{const f=s.has(c.sessionName),h=c.windows.reduce((p,g)=>p+g.panes.length,0);return d.jsxs("section",{className:"session-group","data-collapsed":f?"true":void 0,children:[d.jsxs("button",{type:"button",className:"session-group-head","aria-expanded":!f,onClick:()=>i(c.sessionName),children:[d.jsx("span",{className:"session-group-chevron","aria-hidden":"true",children:f?"▸":"▾"}),d.jsx("span",{className:"session-group-name",children:c.sessionName}),f?d.jsx("span",{className:"session-group-count",children:h}):null]}),f?null:c.windows.map(p=>d.jsxs("div",{className:"session-window",children:[d.jsxs("div",{className:"session-window-head",children:[d.jsx("span",{className:"window-idx",children:p.windowIndex}),d.jsx("span",{className:"window-name",children:p.windowName})]}),d.jsx("ul",{className:"session-pane-list",children:p.panes.map(g=>d.jsx(OD,{s:g,selected:g.id===t,onSelect:n,hotkey:o.get(g.id),workingOverrideId:a,hasRunningSubagents:l!=null&&(l[g.id]??0)>0},g.id))})]},p.windowIndex))]},c.sessionName)})})}const FD={on:"Notifications on",off:"Enable notifications",denied:"Notifications blocked",unsupported:"Notifications unsupported",working:"Working…"};function BD({push:e}){const{status:t,supported:n,enable:r,disable:s}=e,i=t==="on",o=!n||t==="unsupported"||t==="working"||t==="denied",a=FD[t]??"Notifications",l=()=>{o||(i?s():r())};return d.jsx("button",{type:"button",className:"notify-bell","data-state":t,"aria-pressed":i,"aria-label":a,title:a,disabled:o,onClick:l,children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:[d.jsx("path",{d:"M12 22a2.5 2.5 0 0 0 2.45-2h-4.9A2.5 2.5 0 0 0 12 22Zm7-5-1.6-1.6V10a5.4 5.4 0 0 0-4-5.2V4a1.4 1.4 0 0 0-2.8 0v.8A5.4 5.4 0 0 0 6.6 10v5.4L5 17v1h14Z",fill:i?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),t==="denied"||t==="unsupported"?d.jsx("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}):null]})})}function xv(e,t=""){return e!=null?`${Math.round(e)}${t}`:"—"}function $D({resources:e,conn:t,push:n}){const r=e.snapshot,s=r?.self??{},i=r?.system??{},o=!!r?.overLimit||!!e.warning,a=i.loadavg?.[0],l=r?.power;return d.jsxs("div",{className:"hud","data-warn":o?"true":"false",role:"status",children:[d.jsxs("span",{className:"hud-brand",children:[d.jsx(cm,{size:18}),"claude control"]}),d.jsx("span",{className:`conn-dot conn-${t}`,title:t,"aria-label":t}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"cpu"}),d.jsx("span",{className:"hud-v",children:s.cpuPct!=null?`${s.cpuPct.toFixed(0)}%`:"—"})]}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"rss"}),d.jsx("span",{className:"hud-v",children:xv(s.rssMB,"m")})]}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"load"}),d.jsx("span",{className:"hud-v",children:a!=null?a.toFixed(2):"—"})]}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"mem"}),d.jsx("span",{className:"hud-v",children:xv(i.memUsedPct,"%")})]}),l&&l.hasBattery?d.jsxs("span",{className:"hud-group hud-battery","data-low":l.low?"true":void 0,"data-charging":l.charging?"true":void 0,title:`battery ${l.percent??"—"}%${l.charging?" · charging":""}${l.low?" · low":""}`,children:[d.jsx(Lk,{size:20,level:(l.percent??0)/100,charging:!!l.charging}),d.jsx("span",{className:"hud-v",children:l.percent!=null?`${l.percent}%`:"—"})]}):null,o?d.jsx("span",{className:"hud-warn-text",children:e.warning||"over limit"}):null,d.jsx("span",{className:"hud-spacer"}),d.jsx(BD,{push:n})]})}const UD={direction:"down",stagger:45,duration:300,exitOffset:50,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)",bounce:.6,colorFade:280,skipUnchanged:!0,interrupt:!0},VD=" ",dm=e=>e===" "?VD:e,aa=new WeakMap;function zk(e){const t=aa.get(e);t&&(t.timers.forEach(n=>window.clearTimeout(n)),aa.delete(e),qu(e,t.target))}function Fk(e){const t=document.createElement("span");return t.className="char-face",t.textContent=dm(e),t}function Bk(e){const t=document.createElement("span");t.className="char-slot",t.dataset.char=e;const n=document.createElement("span");return n.className="char-sizer",n.textContent=dm(e),t.append(n,Fk(e)),t}function qu(e,t){e.classList.add("slot-text"),e.replaceChildren(...Array.from(t,Bk))}function $k(e,t,n={}){const{direction:r,stagger:s,duration:i,exitOffset:o,easing:a,bounce:l,color:u,colorFade:c,skipUnchanged:f,interrupt:h}={...UD,...n},p=aa.get(e);if(p&&!h){t!==p.target&&(p.pending={text:t,options:n});return}if(zk(e),!e.querySelector(".char-slot")){qu(e,t);return}const g=Array.from(e.querySelectorAll(".char-slot")),y=g.map(D=>D.dataset.char??"").join("");if(!h&&y===t)return;const b=Math.max(y.length,t.length),x=g.find(D=>(D.dataset.char??"")!=="")??g[0],v=getComputedStyle(e),w=Math.ceil(x?.getBoundingClientRect().height||x?.offsetHeight||e.getBoundingClientRect().height||parseFloat(v.lineHeight)||0)||Math.ceil(parseFloat(v.fontSize)*1.3)||18,k=u?v.color:"";for(let D=g.length;D<b;D++){const U=Bk("");e.appendChild(U),g.push(U)}const _=[],S={timers:_,target:t};aa.set(e,S);const T=r==="down"?w:-w,P=r==="down"?-w:w,R=(D,U)=>{const V=Math.sin((D+1)*12.9898+U*78.233)*43758.5453;return(V-Math.floor(V))*2-1};let C=0;for(let D=0;D<b;D++){const U=y[D]||"",V=t[D]||"";if(U===V&&(f||U===""))continue;const W=g[D],J=W.querySelector(".char-sizer"),ne=W.querySelector(".char-face"),$=W.getBoundingClientRect().width;J.textContent=dm(V);const F=J.getBoundingClientRect().width,E=Math.abs(F-$)>.5;E&&(W.style.width=`${$}px`),(U===""||V==="")&&W.classList.add("is-resizing");const X=typeof u=="function"?u(D,b):u,Z=V==="",I=Math.round(i*(Z?.75:1)*(1+l*.45*R(D,1))),O=Z?t.length*.5+(D-t.length)*.25:D,te=Math.round(O*s*(1+l*.25*R(D,2))),de=(l*5*R(D,3)).toFixed(2),it=`transform ${I}ms ${a}`,Ke=u?`${it}, color ${c}ms linear ${I}ms`:it,je=Fk(V);if(je.style.transformOrigin="50% 50%",je.style.transform=`translateY(${P}px) rotate(${de}deg)`,X&&(je.style.color=X),W.appendChild(je),W.offsetWidth,E){let xe=te,oe=I;Z?(xe=te+Math.round(I*.55),oe=Math.max(140,Math.round(I*.6))):U===""&&(oe=Math.max(140,Math.round(I*.45))),_.push(window.setTimeout(()=>{W.style.transition=`width ${oe}ms cubic-bezier(0.2, 0, 0, 1)`,W.style.width=`${F}px`},xe)),C=Math.max(C,xe+oe)}C=Math.max(C,te+o+I+(u?c:0)),ne&&_.push(window.setTimeout(()=>{ne.style.transition=it,ne.style.transform=`translateY(${T}px) rotate(${-Number(de)}deg)`},te)),_.push(window.setTimeout(()=>{je.style.transition=Ke,je.style.transform="translateY(0) rotate(0deg)",u&&(je.style.color=k);const xe=oe=>{oe.propertyName==="transform"&&(je.removeEventListener("transitionend",xe),W.dataset.char=V,W.style.removeProperty("transition"),W.style.removeProperty("width"),W.classList.remove("is-resizing"),W.querySelectorAll(".char-face").forEach(le=>{le!==je&&le.remove()}))};je.addEventListener("transitionend",xe)},te+o))}const M=C+80;_.push(window.setTimeout(()=>{const D=S.pending;aa.delete(e),qu(e,t),D&&$k(e,D.text,D.options)},M))}function HD(e,t=""){zk(e),e.classList.remove("slot-text"),e.textContent=t}const Uk=m.forwardRef(({text:e,options:t,"aria-label":n,...r},s)=>{const i=m.useRef(null),o=m.useRef(!1),a=m.useRef(!0),l=m.useRef(t);return m.useImperativeHandle(s,()=>i.current,[]),m.useEffect(()=>{l.current=t},[t]),m.useEffect(()=>{const u=i.current;if(u)return qu(u,e),o.current=!0,()=>{HD(u),o.current=!1,a.current=!0}},[]),m.useEffect(()=>{const u=i.current;if(!(!u||!o.current)){if(a.current){a.current=!1;return}$k(u,e,l.current)}},[e]),m.createElement("span",{...r,"aria-label":n??e,ref:i})});Uk.displayName="SlotText";const WD=(e,t)=>typeof e=="string"?e===t:JSON.stringify(e)===JSON.stringify(t),qD=(e,t)=>{if(!e||!t)return!1;const n=r=>{const{position:s,data:i,...o}=r||{};return o};return JSON.stringify(n(e.properties))===JSON.stringify(n(t.properties))&&WD(e.children,t.children)},Vk=(e,t)=>qD(e.node,t.node),fm=m.createContext(null),KD=()=>m.useContext(fm)!==null,GD=({children:e,...t})=>d.jsx(fm.Provider,{value:t,children:e}),YD=m.memo(GD,Vk),QD=({node:e,...t})=>d.jsx("pre",{...t}),XD=({node:e,...t})=>d.jsx("code",{...t}),hm=({node:e,components:{Pre:t,Code:n},code:r})=>d.jsx(t,{children:d.jsx(n,{node:e,children:r})}),JD=()=>null,ZD=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:s},language:i,code:o})=>{const a=m.useMemo(()=>({Pre:t,Code:n}),[t,n]);return d.jsxs(d.Fragment,{children:[d.jsx(s,{node:e,language:i,code:o}),d.jsx(i?r:hm,{node:e,components:a,language:i??"unknown",code:o})]})};var Hk={exports:{}};/*!
|
|
59
|
+
Copyright (c) 2018 Jed Watson.
|
|
60
|
+
Licensed under the MIT License (MIT), see
|
|
61
|
+
http://jedwatson.github.io/classnames
|
|
62
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(i=s(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var o="";for(var a in i)t.call(i,a)&&i[a]&&(o=s(o,a));return o}function s(i,o){return o?i?i+" "+o:i+o:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Hk);var eL=Hk.exports;const Wk=Va(eL),wv=({className:e,...t})=>({className:n,...r})=>({className:Wk(e,n),...t,...r}),tL=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:s},componentsByLanguage:i={},children:o,...a})=>{const l=wv(m.useContext(fm)),u=ii(p=>d.jsx(t,{...l(p)})),c=wv(a),f=ii(p=>d.jsx(n,{...c(p)})),h=/language-(\w+)/.exec(a.className||"")?.[1]??"";return typeof o!="string"?d.jsx(hm,{node:e,components:{Pre:u,Code:f},code:o}):d.jsx(ZD,{node:e,components:{Pre:u,Code:f,SyntaxHighlighter:i[h]?.SyntaxHighlighter??r,CodeHeader:i[h]?.CodeHeader??s},language:h||"unknown",code:o})},nL=({node:e,components:t,componentsByLanguage:n,...r})=>KD()?d.jsx(tL,{node:e,components:t,componentsByLanguage:n,...r}):d.jsx(t.Code,{...r}),rL=m.memo(nL,(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&Vk(e,t));function sL(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const iL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aL={};function bv(e,t){return(aL.jsx?oL:iL).test(e)}const lL=/[ \t\n\f\r]/g;function uL(e){return typeof e=="object"?e.type==="text"?_v(e.value):!1:_v(e)}function _v(e){return e.replace(lL,"")===""}class Ja{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ja.prototype.normal={};Ja.prototype.property={};Ja.prototype.space=void 0;function qk(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ja(n,r,t)}function hh(e){return e.toLowerCase()}class cn{constructor(t,n){this.attribute=n,this.property=t}}cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;let cL=0;const he=gi(),dt=gi(),ph=gi(),q=gi(),Ne=gi(),Js=gi(),mn=gi();function gi(){return 2**++cL}const mh=Object.freeze(Object.defineProperty({__proto__:null,boolean:he,booleanish:dt,commaOrSpaceSeparated:mn,commaSeparated:Js,number:q,overloadedBoolean:ph,spaceSeparated:Ne},Symbol.toStringTag,{value:"Module"})),Ed=Object.keys(mh);class pm extends cn{constructor(t,n,r,s){let i=-1;if(super(t,n),Sv(this,"space",s),typeof r=="number")for(;++i<Ed.length;){const o=Ed[i];Sv(this,Ed[i],(r&mh[o])===mh[o])}}}pm.prototype.defined=!0;function Sv(e,t,n){n&&(e[t]=n)}function bo(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new pm(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[hh(r)]=r,n[hh(i.attribute)]=r}return new Ja(t,n,e.space)}const Kk=bo({properties:{ariaActiveDescendant:null,ariaAtomic:dt,ariaAutoComplete:null,ariaBusy:dt,ariaChecked:dt,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:Ne,ariaCurrent:null,ariaDescribedBy:Ne,ariaDetails:null,ariaDisabled:dt,ariaDropEffect:Ne,ariaErrorMessage:null,ariaExpanded:dt,ariaFlowTo:Ne,ariaGrabbed:dt,ariaHasPopup:null,ariaHidden:dt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ne,ariaLevel:q,ariaLive:null,ariaModal:dt,ariaMultiLine:dt,ariaMultiSelectable:dt,ariaOrientation:null,ariaOwns:Ne,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:dt,ariaReadOnly:dt,ariaRelevant:null,ariaRequired:dt,ariaRoleDescription:Ne,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:dt,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Gk(e,t){return t in e?e[t]:t}function Yk(e,t){return Gk(e,t.toLowerCase())}const dL=bo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Js,acceptCharset:Ne,accessKey:Ne,action:null,allow:null,allowFullScreen:he,allowPaymentRequest:he,allowUserMedia:he,alpha:he,alt:null,as:null,async:he,autoCapitalize:null,autoComplete:Ne,autoFocus:he,autoPlay:he,blocking:Ne,capture:null,charSet:null,checked:he,cite:null,className:Ne,closedBy:null,colorSpace:null,cols:q,colSpan:q,command:null,commandFor:null,content:null,contentEditable:dt,controls:he,controlsList:Ne,coords:q|Js,crossOrigin:null,data:null,dateTime:null,decoding:null,default:he,defer:he,dir:null,dirName:null,disabled:he,download:ph,draggable:dt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:he,formTarget:null,headers:Ne,height:q,hidden:ph,high:q,href:null,hrefLang:null,htmlFor:Ne,httpEquiv:Ne,id:null,imageSizes:null,imageSrcSet:null,inert:he,inputMode:null,integrity:null,is:null,isMap:he,itemId:null,itemProp:Ne,itemRef:Ne,itemScope:he,itemType:Ne,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:he,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:he,muted:he,name:null,nonce:null,noModule:he,noValidate:he,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:he,optimum:q,pattern:null,ping:Ne,placeholder:null,playsInline:he,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:he,referrerPolicy:null,rel:Ne,required:he,reversed:he,rows:q,rowSpan:q,sandbox:Ne,scope:null,scoped:he,seamless:he,selected:he,shadowRootClonable:he,shadowRootCustomElementRegistry:he,shadowRootDelegatesFocus:he,shadowRootMode:null,shadowRootSerializable:he,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:dt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:he,useMap:null,value:dt,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ne,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:he,declare:he,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:he,noHref:he,noShade:he,noWrap:he,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:dt,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:he,disablePictureInPicture:he,disableRemotePlayback:he,exportParts:Js,part:Ne,prefix:null,property:null,results:q,security:null,unselectable:null},space:"html",transform:Yk}),fL=bo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:mn,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:Ne,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:he,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Js,g2:Js,glyphName:Js,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:mn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ne,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mn,rev:mn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mn,requiredFeatures:mn,requiredFonts:mn,requiredFormats:mn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:mn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mn,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gk}),Qk=bo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Xk=bo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Yk}),Jk=bo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),hL={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},pL=/[A-Z]/g,kv=/-[a-z]/g,mL=/^data[-\w.:]+$/i;function gL(e,t){const n=hh(t);let r=t,s=cn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mL.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(kv,vL);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!kv.test(i)){let o=i.replace(pL,yL);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=pm}return new s(r,t)}function yL(e){return"-"+e.toLowerCase()}function vL(e){return e.charAt(1).toUpperCase()}const xL=qk([Kk,dL,Qk,Xk,Jk],"html"),mm=qk([Kk,fL,Qk,Xk,Jk],"svg");function wL(e){return e.join(" ").trim()}var gm={},Cv=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,bL=/\n/g,_L=/^\s*/,SL=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,kL=/^:\s*/,CL=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,EL=/^[;\s]*/,TL=/^\s+|\s+$/g,IL=`
|
|
63
|
+
`,Ev="/",Tv="*",Bs="",RL="comment",PL="declaration";function jL(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var y=g.match(bL);y&&(n+=y.length);var b=g.lastIndexOf(IL);r=~b?g.length-b:r+g.length}function i(){var g={line:n,column:r};return function(y){return y.position=new o(g),u(),y}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var y=new Error(t.source+":"+n+":"+r+": "+g);if(y.reason=g,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(g){var y=g.exec(e);if(y){var b=y[0];return s(b),e=e.slice(b.length),y}}function u(){l(_L)}function c(g){var y;for(g=g||[];y=f();)y!==!1&&g.push(y);return g}function f(){var g=i();if(!(Ev!=e.charAt(0)||Tv!=e.charAt(1))){for(var y=2;Bs!=e.charAt(y)&&(Tv!=e.charAt(y)||Ev!=e.charAt(y+1));)++y;if(y+=2,Bs===e.charAt(y-1))return a("End of comment missing");var b=e.slice(2,y-2);return r+=2,s(b),e=e.slice(y),r+=2,g({type:RL,comment:b})}}function h(){var g=i(),y=l(SL);if(y){if(f(),!l(kL))return a("property missing ':'");var b=l(CL),x=g({type:PL,property:Iv(y[0].replace(Cv,Bs)),value:b?Iv(b[0].replace(Cv,Bs)):Bs});return l(EL),x}}function p(){var g=[];c(g);for(var y;y=h();)y!==!1&&(g.push(y),c(g));return g}return u(),p()}function Iv(e){return e?e.replace(TL,Bs):Bs}var AL=jL,NL=tu&&tu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gm,"__esModule",{value:!0});gm.default=DL;const ML=NL(AL);function DL(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,ML.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;s?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var Ec={};Object.defineProperty(Ec,"__esModule",{value:!0});Ec.camelCase=void 0;var LL=/^--[a-zA-Z0-9_-]+$/,OL=/-([a-z])/g,zL=/^[^-]+$/,FL=/^-(webkit|moz|ms|o|khtml)-/,BL=/^-(ms)-/,$L=function(e){return!e||zL.test(e)||LL.test(e)},UL=function(e,t){return t.toUpperCase()},Rv=function(e,t){return"".concat(t,"-")},VL=function(e,t){return t===void 0&&(t={}),$L(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(BL,Rv):e=e.replace(FL,Rv),e.replace(OL,UL))};Ec.camelCase=VL;var HL=tu&&tu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},WL=HL(gm),qL=Ec;function gh(e,t){var n={};return!e||typeof e!="string"||(0,WL.default)(e,function(r,s){r&&s&&(n[(0,qL.camelCase)(r,t)]=s)}),n}gh.default=gh;var KL=gh;const GL=Va(KL),Zk=e1("end"),ym=e1("start");function e1(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function YL(e){const t=ym(e),n=Zk(e);if(t&&n)return{start:t,end:n}}function la(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pv(e.position):"start"in e||"end"in e?Pv(e):"line"in e||"column"in e?yh(e):""}function yh(e){return jv(e&&e.line)+":"+jv(e&&e.column)}function Pv(e){return yh(e&&e.start)+"-"+yh(e&&e.end)}function jv(e){return e&&typeof e=="number"?e:1}class Lt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=la(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Lt.prototype.file="";Lt.prototype.name="";Lt.prototype.reason="";Lt.prototype.message="";Lt.prototype.stack="";Lt.prototype.column=void 0;Lt.prototype.line=void 0;Lt.prototype.ancestors=void 0;Lt.prototype.cause=void 0;Lt.prototype.fatal=void 0;Lt.prototype.place=void 0;Lt.prototype.ruleId=void 0;Lt.prototype.source=void 0;const vm={}.hasOwnProperty,QL=new Map,XL=/[A-Z]/g,JL=new Set(["table","tbody","thead","tfoot","tr"]),ZL=new Set(["td","th"]),t1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function eO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=lO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=aO(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?mm:xL,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=n1(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function n1(e,t,n){if(t.type==="element")return tO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return nO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return sO(e,t,n);if(t.type==="mdxjsEsm")return rO(e,t);if(t.type==="root")return iO(e,t,n);if(t.type==="text")return oO(e,t)}function tO(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=mm,e.schema=s),e.ancestors.push(t);const i=s1(e,t.tagName,!1),o=uO(e,t);let a=wm(e,t);return JL.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!uL(l):!0})),r1(e,o,i,t),xm(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function nO(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ba(e,t.position)}function rO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ba(e,t.position)}function sO(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=mm,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:s1(e,t.name,!0),o=cO(e,t),a=wm(e,t);return r1(e,o,i,t),xm(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function iO(e,t,n){const r={};return xm(r,wm(e,t)),e.create(t,e.Fragment,r,n)}function oO(e,t){return t.value}function r1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function xm(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function aO(e,t,n){return r;function r(s,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function lO(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=ym(r);return t(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function uO(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&vm.call(t.properties,s)){const i=dO(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&ZL.has(t.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function cO(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ba(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else Ba(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function wm(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:QL;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=s.get(l)||0;o=l+"-"+u,s.set(l,u+1)}}const a=n1(e,i,o);a!==void 0&&n.push(a)}return n}function dO(e,t,n){const r=gL(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?sL(n):wL(n)),r.property==="style"){let s=typeof n=="object"?n:fO(e,String(n));return e.stylePropertyNameCase==="css"&&(s=hO(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?hL[r.property]||r.property:r.attribute,n]}}function fO(e,t){try{return GL(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Lt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=t1+"#cannot-parse-style-attribute",s}}function s1(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const a=bv(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=bv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return vm.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ba(e)}function Ba(e,t){const n=new Lt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=t1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function hO(e){const t={};let n;for(n in e)vm.call(e,n)&&(t[pO(n)]=e[n]);return t}function pO(e){let t=e.replace(XL,mO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function mO(e){return"-"+e.toLowerCase()}const Td={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},gO={};function bm(e,t){const n=gO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return i1(e,r,s)}function i1(e,t,n){if(yO(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Av(e.children,t,n)}return Array.isArray(e)?Av(e,t,n):""}function Av(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=i1(e[s],t,n);return r.join("")}function yO(e){return!!(e&&typeof e=="object")}const Nv=document.createElement("i");function _m(e){const t="&"+e+";";Nv.innerHTML=t;const n=Nv.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function kn(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function On(e,t){return e.length>0?(kn(e,e.length,0,t),e):t}const Mv={}.hasOwnProperty;function o1(e){const t={};let n=-1;for(;++n<e.length;)vO(t,e[n]);return t}function vO(e,t){let n;for(n in t){const s=(Mv.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Mv.call(s,o)||(s[o]=[]);const a=i[o];xO(s[o],Array.isArray(a)?a:a?[a]:[])}}}function xO(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);kn(e,0,0,r)}function a1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function sr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ut=js(/[A-Za-z]/),Nt=js(/[\dA-Za-z]/),wO=js(/[#-'*+\--9=?A-Z^-~]/);function Ku(e){return e!==null&&(e<32||e===127)}const vh=js(/\d/),bO=js(/[\dA-Fa-f]/),_O=js(/[!-/:-@[-`{-~]/);function ae(e){return e!==null&&e<-2}function De(e){return e!==null&&(e<0||e===32)}function be(e){return e===-2||e===-1||e===32}const Tc=js(/\p{P}|\p{S}/u),oi=js(/\s/);function js(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function _o(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Nt(e.charCodeAt(n+1))&&Nt(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Ee(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return be(l)?(e.enter(n),a(l)):t(l)}function a(l){return be(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const SO={tokenize:kO};function kO(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ee(e,t,"linePrefix")}function s(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ae(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const CO={tokenize:EO},Dv={tokenize:TO};function EO(e){const t=this,n=[];let r=0,s,i,o;return a;function a(w){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const k=t.events.length;let _=k,S;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){S=t.events[_][1].end;break}x(r);let T=k;for(;T<t.events.length;)t.events[T][1].end={...S},T++;return kn(t.events,_+1,0,t.events.slice(k)),t.events.length=T,u(w)}return a(w)}function u(w){if(r===n.length){if(!s)return h(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Dv,c,f)(w)}function c(w){return s&&v(),x(r),h(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function h(w){return t.containerState={},e.attempt(Dv,p,g)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),h(w)}function g(w){if(w===null){s&&v(),x(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(w)}function y(w){if(w===null){b(e.exit("chunkFlow"),!0),x(0),e.consume(w);return}return ae(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),y)}function b(w,k){const _=t.sliceStream(w);if(k&&_.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(_),t.parser.lazy[w.start.line]){let S=s.events.length;for(;S--;)if(s.events[S][1].start.offset<o&&(!s.events[S][1].end||s.events[S][1].end.offset>o))return;const T=t.events.length;let P=T,R,C;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(R){C=t.events[P][1].end;break}R=!0}for(x(r),S=T;S<t.events.length;)t.events[S][1].end={...C},S++;kn(t.events,P+1,0,t.events.slice(T)),t.events.length=S}}function x(w){let k=n.length;for(;k-- >w;){const _=n[k];t.containerState=_[1],_[0].exit.call(t,e)}n.length=w}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function TO(e,t,n){return Ee(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fo(e){if(e===null||De(e)||oi(e))return 1;if(Tc(e))return 2}function Ic(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const xh={name:"attention",resolveAll:IO,tokenize:RO};function IO(e,t){let n=-1,r,s,i,o,a,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};Lv(f,-l),Lv(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=On(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=On(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=On(u,Ic(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=On(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=On(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,kn(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function RO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=fo(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const u=e.exit("attentionSequence"),c=fo(l),f=!c||c===2&&s||n.includes(l),h=!s||s===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(s||!h)),u._close=!!(i===42?h:h&&(c||!f)),t(l)}}function Lv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PO={name:"autolink",tokenize:jO};function jO(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Ut(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||Nt(p)?(r=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Nt(p))&&r++<32?(e.consume(p),a):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Ku(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):wO(p)?(e.consume(p),u):n(p)}function c(p){return Nt(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||Nt(p))&&r++<63){const g=p===45?h:f;return e.consume(p),g}return n(p)}}const Za={partial:!0,tokenize:AO};function AO(e,t,n){return r;function r(i){return be(i)?Ee(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||ae(i)?t(i):n(i)}}const l1={continuation:{tokenize:MO},exit:DO,name:"blockQuote",tokenize:NO};function NO(e,t,n){const r=this;return s;function s(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return be(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function MO(e,t,n){const r=this;return s;function s(o){return be(o)?Ee(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(l1,t,n)(o)}}function DO(e){e.exit("blockQuote")}const u1={name:"characterEscape",tokenize:LO};function LO(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return _O(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const c1={name:"characterReference",tokenize:OO};function OO(e,t,n){const r=this;let s=0,i,o;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Nt,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=bO,c):(e.enter("characterReferenceValue"),i=7,o=vh,c(f))}function c(f){if(f===59&&s){const h=e.exit("characterReferenceValue");return o===Nt&&!_m(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&s++<i?(e.consume(f),c):n(f)}}const Ov={partial:!0,tokenize:FO},zv={concrete:!0,name:"codeFenced",tokenize:zO};function zO(e,t,n){const r=this,s={partial:!0,tokenize:_};let i=0,o=0,a;return l;function l(S){return u(S)}function u(S){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(S)}function c(S){return S===a?(o++,e.consume(S),c):o<3?n(S):(e.exit("codeFencedFenceSequence"),be(S)?Ee(e,f,"whitespace")(S):f(S))}function f(S){return S===null||ae(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(Ov,y,k)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||ae(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(S)):be(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ee(e,p,"whitespace")(S)):S===96&&S===a?n(S):(e.consume(S),h)}function p(S){return S===null||ae(S)?f(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||ae(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(S)):S===96&&S===a?n(S):(e.consume(S),g)}function y(S){return e.attempt(s,k,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),x}function x(S){return i>0&&be(S)?Ee(e,v,"linePrefix",i+1)(S):v(S)}function v(S){return S===null||ae(S)?e.check(Ov,y,k)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||ae(S)?(e.exit("codeFlowValue"),v(S)):(e.consume(S),w)}function k(S){return e.exit("codeFenced"),t(S)}function _(S,T,P){let R=0;return C;function C(W){return S.enter("lineEnding"),S.consume(W),S.exit("lineEnding"),M}function M(W){return S.enter("codeFencedFence"),be(W)?Ee(S,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):D(W)}function D(W){return W===a?(S.enter("codeFencedFenceSequence"),U(W)):P(W)}function U(W){return W===a?(R++,S.consume(W),U):R>=o?(S.exit("codeFencedFenceSequence"),be(W)?Ee(S,V,"whitespace")(W):V(W)):P(W)}function V(W){return W===null||ae(W)?(S.exit("codeFencedFence"),T(W)):P(W)}}}function FO(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Id={name:"codeIndented",tokenize:$O},BO={partial:!0,tokenize:UO};function $O(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Ee(e,i,"linePrefix",5)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):ae(u)?e.attempt(BO,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||ae(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function UO(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):ae(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Ee(e,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):ae(o)?s(o):n(o)}}const VO={name:"codeText",previous:WO,resolve:HO,tokenize:qO};function HO(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function WO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function qO(e,t,n){let r=0,s,i;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),s=0,c(f)):ae(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ae(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),s++,c):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class KO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Do(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Do(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Do(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Do(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Do(this.left,n.reverse())}}}function Do(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function d1(e){const t={};let n=-1,r,s,i,o,a,l,u;const c=new KO(e);for(;++n<c.length;){for(;n in t;)n=t[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,GO(c,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=c.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(c.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...c.get(s)[1].start},a=c.slice(s,n),a.unshift(r),c.splice(s,n-s+1,a))}}return kn(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function GO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let c,f,h=-1,p=n,g=0,y=0;const b=[y];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),f&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(y=h+1,b.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const x=a.slice(b[h],b[h+1]),v=i.pop();l.push([v,v+x.length-1]),e.splice(v,2,x)}for(l.reverse(),h=-1;++h<l.length;)u[g+l[h][0]]=g+l[h][1],g+=l[h][1]-l[h][0]-1;return u}const YO={resolve:XO,tokenize:JO},QO={partial:!0,tokenize:ZO};function XO(e){return d1(e),e}function JO(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):ae(a)?e.check(QO,o,i)(a):(e.consume(a),s)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function ZO(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ee(e,i,"linePrefix")}function i(o){if(o===null||ae(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function f1(e,t,n,r,s,i,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(x){return x===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(x),e.exit(i),h):x===null||x===32||x===41||Ku(x)?n(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(x))}function h(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),h(x)):x===null||x===60||ae(x)?n(x):(e.consume(x),x===92?g:p)}function g(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function y(x){return!c&&(x===null||x===41||De(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(x)):c<u&&x===40?(e.consume(x),c++,y):x===41?(e.consume(x),c--,y):x===null||x===32||x===40||Ku(x)?n(x):(e.consume(x),x===92?b:y)}function b(x){return x===40||x===41||x===92?(e.consume(x),y):y(x)}}function h1(e,t,n,r,s,i){const o=this;let a=0,l;return u;function u(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),c}function c(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):ae(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||ae(p)||a++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!be(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function p1(e,t,n,r,s,i){let o;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,l):n(h)}function l(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===o?(e.exit(i),l(o)):h===null?n(h):ae(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ee(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===o||h===null||ae(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:c)}function f(h){return h===o||h===92?(e.consume(h),c):c(h)}}function ua(e,t){let n;return r;function r(s){return ae(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):be(s)?Ee(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const ez={name:"definition",tokenize:nz},tz={partial:!0,tokenize:rz};function nz(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return h1.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=sr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return De(p)?ua(e,u)(p):u(p)}function u(p){return f1(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(tz,f,f)(p)}function f(p){return be(p)?Ee(e,h,"whitespace")(p):h(p)}function h(p){return p===null||ae(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function rz(e,t,n){return r;function r(a){return De(a)?ua(e,s)(a):n(a)}function s(a){return p1(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return be(a)?Ee(e,o,"whitespace")(a):o(a)}function o(a){return a===null||ae(a)?t(a):n(a)}}const sz={name:"hardBreakEscape",tokenize:iz};function iz(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return ae(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const oz={name:"headingAtx",resolve:az,tokenize:lz};function az(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},kn(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function lz(e,t,n){let r=0;return s;function s(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||De(c)?(e.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ae(c)?(e.exit("atxHeading"),t(c)):be(c)?Ee(e,a,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||De(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),u)}}const uz=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Fv=["pre","script","style","textarea"],cz={concrete:!0,name:"htmlFlow",resolveTo:hz,tokenize:pz},dz={partial:!0,tokenize:gz},fz={partial:!0,tokenize:mz};function hz(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function pz(e,t,n){const r=this;let s,i,o,a,l;return u;function u(I){return c(I)}function c(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),f}function f(I){return I===33?(e.consume(I),h):I===47?(e.consume(I),i=!0,y):I===63?(e.consume(I),s=3,r.interrupt?t:E):Ut(I)?(e.consume(I),o=String.fromCharCode(I),b):n(I)}function h(I){return I===45?(e.consume(I),s=2,p):I===91?(e.consume(I),s=5,a=0,g):Ut(I)?(e.consume(I),s=4,r.interrupt?t:E):n(I)}function p(I){return I===45?(e.consume(I),r.interrupt?t:E):n(I)}function g(I){const O="CDATA[";return I===O.charCodeAt(a++)?(e.consume(I),a===O.length?r.interrupt?t:D:g):n(I)}function y(I){return Ut(I)?(e.consume(I),o=String.fromCharCode(I),b):n(I)}function b(I){if(I===null||I===47||I===62||De(I)){const O=I===47,te=o.toLowerCase();return!O&&!i&&Fv.includes(te)?(s=1,r.interrupt?t(I):D(I)):uz.includes(o.toLowerCase())?(s=6,O?(e.consume(I),x):r.interrupt?t(I):D(I)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):i?v(I):w(I))}return I===45||Nt(I)?(e.consume(I),o+=String.fromCharCode(I),b):n(I)}function x(I){return I===62?(e.consume(I),r.interrupt?t:D):n(I)}function v(I){return be(I)?(e.consume(I),v):C(I)}function w(I){return I===47?(e.consume(I),C):I===58||I===95||Ut(I)?(e.consume(I),k):be(I)?(e.consume(I),w):C(I)}function k(I){return I===45||I===46||I===58||I===95||Nt(I)?(e.consume(I),k):_(I)}function _(I){return I===61?(e.consume(I),S):be(I)?(e.consume(I),_):w(I)}function S(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),l=I,T):be(I)?(e.consume(I),S):P(I)}function T(I){return I===l?(e.consume(I),l=null,R):I===null||ae(I)?n(I):(e.consume(I),T)}function P(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||De(I)?_(I):(e.consume(I),P)}function R(I){return I===47||I===62||be(I)?w(I):n(I)}function C(I){return I===62?(e.consume(I),M):n(I)}function M(I){return I===null||ae(I)?D(I):be(I)?(e.consume(I),M):n(I)}function D(I){return I===45&&s===2?(e.consume(I),J):I===60&&s===1?(e.consume(I),ne):I===62&&s===4?(e.consume(I),X):I===63&&s===3?(e.consume(I),E):I===93&&s===5?(e.consume(I),F):ae(I)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(dz,Z,U)(I)):I===null||ae(I)?(e.exit("htmlFlowData"),U(I)):(e.consume(I),D)}function U(I){return e.check(fz,V,Z)(I)}function V(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),W}function W(I){return I===null||ae(I)?U(I):(e.enter("htmlFlowData"),D(I))}function J(I){return I===45?(e.consume(I),E):D(I)}function ne(I){return I===47?(e.consume(I),o="",$):D(I)}function $(I){if(I===62){const O=o.toLowerCase();return Fv.includes(O)?(e.consume(I),X):D(I)}return Ut(I)&&o.length<8?(e.consume(I),o+=String.fromCharCode(I),$):D(I)}function F(I){return I===93?(e.consume(I),E):D(I)}function E(I){return I===62?(e.consume(I),X):I===45&&s===2?(e.consume(I),E):D(I)}function X(I){return I===null||ae(I)?(e.exit("htmlFlowData"),Z(I)):(e.consume(I),X)}function Z(I){return e.exit("htmlFlow"),t(I)}}function mz(e,t,n){const r=this;return s;function s(o){return ae(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function gz(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Za,t,n)}}const yz={name:"htmlText",tokenize:vz};function vz(e,t,n){const r=this;let s,i,o;return a;function a(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),_):E===63?(e.consume(E),w):Ut(E)?(e.consume(E),P):n(E)}function u(E){return E===45?(e.consume(E),c):E===91?(e.consume(E),i=0,g):Ut(E)?(e.consume(E),v):n(E)}function c(E){return E===45?(e.consume(E),p):n(E)}function f(E){return E===null?n(E):E===45?(e.consume(E),h):ae(E)?(o=f,ne(E)):(e.consume(E),f)}function h(E){return E===45?(e.consume(E),p):f(E)}function p(E){return E===62?J(E):E===45?h(E):f(E)}function g(E){const X="CDATA[";return E===X.charCodeAt(i++)?(e.consume(E),i===X.length?y:g):n(E)}function y(E){return E===null?n(E):E===93?(e.consume(E),b):ae(E)?(o=y,ne(E)):(e.consume(E),y)}function b(E){return E===93?(e.consume(E),x):y(E)}function x(E){return E===62?J(E):E===93?(e.consume(E),x):y(E)}function v(E){return E===null||E===62?J(E):ae(E)?(o=v,ne(E)):(e.consume(E),v)}function w(E){return E===null?n(E):E===63?(e.consume(E),k):ae(E)?(o=w,ne(E)):(e.consume(E),w)}function k(E){return E===62?J(E):w(E)}function _(E){return Ut(E)?(e.consume(E),S):n(E)}function S(E){return E===45||Nt(E)?(e.consume(E),S):T(E)}function T(E){return ae(E)?(o=T,ne(E)):be(E)?(e.consume(E),T):J(E)}function P(E){return E===45||Nt(E)?(e.consume(E),P):E===47||E===62||De(E)?R(E):n(E)}function R(E){return E===47?(e.consume(E),J):E===58||E===95||Ut(E)?(e.consume(E),C):ae(E)?(o=R,ne(E)):be(E)?(e.consume(E),R):J(E)}function C(E){return E===45||E===46||E===58||E===95||Nt(E)?(e.consume(E),C):M(E)}function M(E){return E===61?(e.consume(E),D):ae(E)?(o=M,ne(E)):be(E)?(e.consume(E),M):R(E)}function D(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,U):ae(E)?(o=D,ne(E)):be(E)?(e.consume(E),D):(e.consume(E),V)}function U(E){return E===s?(e.consume(E),s=void 0,W):E===null?n(E):ae(E)?(o=U,ne(E)):(e.consume(E),U)}function V(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||De(E)?R(E):(e.consume(E),V)}function W(E){return E===47||E===62||De(E)?R(E):n(E)}function J(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function ne(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),$}function $(E){return be(E)?Ee(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):F(E)}function F(E){return e.enter("htmlTextData"),o(E)}}const Sm={name:"labelEnd",resolveAll:_z,resolveTo:Sz,tokenize:kz},xz={tokenize:Cz},wz={tokenize:Ez},bz={tokenize:Tz};function _z(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&kn(e,0,e.length,n),e}function Sz(e,t){let n=e.length,r=0,s,i,o,a;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=On(a,e.slice(i+1,i+r+3)),a=On(a,[["enter",c,t]]),a=On(a,Ic(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=On(a,[["exit",c,t],e[o-2],e[o-1],["exit",u,t]]),a=On(a,e.slice(o+1)),a=On(a,[["exit",l,t]]),kn(e,i,e.length,a),e}function kz(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(h){return i?i._inactive?f(h):(o=r.parser.defined.includes(sr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(xz,c,o?c:f)(h):h===91?e.attempt(wz,c,o?u:f)(h):o?c(h):f(h)}function u(h){return e.attempt(bz,c,f)(h)}function c(h){return t(h)}function f(h){return i._balanced=!0,n(h)}}function Cz(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return De(f)?ua(e,i)(f):i(f)}function i(f){return f===41?c(f):f1(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return De(f)?ua(e,l)(f):c(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?p1(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return De(f)?ua(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Ez(e,t,n){const r=this;return s;function s(a){return h1.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(sr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Tz(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Iz={name:"labelStartImage",resolveAll:Sm.resolveAll,tokenize:Rz};function Rz(e,t,n){const r=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Pz={name:"labelStartLink",resolveAll:Sm.resolveAll,tokenize:jz};function jz(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Rd={name:"lineEnding",tokenize:Az};function Az(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ee(e,t,"linePrefix")}}const Zl={name:"thematicBreak",tokenize:Nz};function Nz(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,a(u)}function a(u){return u===s?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ae(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),be(u)?Ee(e,a,"whitespace")(u):a(u))}}const Yt={continuation:{tokenize:Oz},exit:Fz,name:"list",tokenize:Lz},Mz={partial:!0,tokenize:Bz},Dz={partial:!0,tokenize:zz};function Lz(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:vh(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Zl,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return vh(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Za,r.interrupt?n:c,e.attempt(Mz,h,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return be(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Oz(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Za,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ee(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!be(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Dz,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ee(e,e.attempt(Yt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function zz(e,t,n){const r=this;return Ee(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function Fz(e){e.exit(this.containerState.type)}function Bz(e,t,n){const r=this;return Ee(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!be(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Bv={name:"setextUnderline",resolveTo:$z,tokenize:Uz};function $z(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Uz(e,t,n){const r=this;let s;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===s?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),be(u)?Ee(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ae(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Vz={tokenize:Hz};function Hz(e){const t=this,n=e.attempt(Za,r,e.attempt(this.parser.constructs.flowInitial,s,Ee(e,e.attempt(this.parser.constructs.flow,s,e.attempt(YO,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Wz={resolveAll:g1()},qz=m1("string"),Kz=m1("text");function m1(e){return{resolveAll:g1(e==="text"?Gz:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,a);return o;function o(c){return u(c)?i(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=s[c];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function g1(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function Gz(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Yz={42:Yt,43:Yt,45:Yt,48:Yt,49:Yt,50:Yt,51:Yt,52:Yt,53:Yt,54:Yt,55:Yt,56:Yt,57:Yt,62:l1},Qz={91:ez},Xz={[-2]:Id,[-1]:Id,32:Id},Jz={35:oz,42:Zl,45:[Bv,Zl],60:cz,61:Bv,95:Zl,96:zv,126:zv},Zz={38:c1,92:u1},eF={[-5]:Rd,[-4]:Rd,[-3]:Rd,33:Iz,38:c1,42:xh,60:[PO,yz],91:Pz,92:[sz,u1],93:Sm,95:xh,96:VO},tF={null:[xh,Wz]},nF={null:[42,95]},rF={null:[]},sF=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:nF,contentInitial:Qz,disable:rF,document:Yz,flow:Jz,flowInitial:Xz,insideSpan:tF,string:Zz,text:eF},Symbol.toStringTag,{value:"Module"}));function iF(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],a=[];const l={attempt:T(_),check:T(S),consume:v,enter:w,exit:k,interrupt:T(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(M){return o=On(o,M),b(),o[o.length-1]!==null?[]:(P(t,0),u.events=Ic(i,u.events,u),u.events)}function h(M,D){return aF(p(M),D)}function p(M){return oF(o,M)}function g(){const{_bufferIndex:M,_index:D,line:U,column:V,offset:W}=r;return{_bufferIndex:M,_index:D,line:U,column:V,offset:W}}function y(M){s[M.line]=M.column,C()}function b(){let M;for(;r._index<o.length;){const D=o[r._index];if(typeof D=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<D.length;)x(D.charCodeAt(r._bufferIndex));else x(D)}}function x(M){c=c(M)}function v(M){ae(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,C()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function w(M,D){const U=D||{};return U.type=M,U.start=g(),u.events.push(["enter",U,u]),a.push(U),U}function k(M){const D=a.pop();return D.end=g(),u.events.push(["exit",D,u]),D}function _(M,D){P(M,D.from)}function S(M,D){D.restore()}function T(M,D){return U;function U(V,W,J){let ne,$,F,E;return Array.isArray(V)?Z(V):"tokenize"in V?Z([V]):X(V);function X(de){return it;function it(Ke){const je=Ke!==null&&de[Ke],xe=Ke!==null&&de.null,oe=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray(xe)?xe:xe?[xe]:[]];return Z(oe)(Ke)}}function Z(de){return ne=de,$=0,de.length===0?J:I(de[$])}function I(de){return it;function it(Ke){return E=R(),F=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?te():de.tokenize.call(D?Object.assign(Object.create(u),D):u,l,O,te)(Ke)}}function O(de){return M(F,E),W}function te(de){return E.restore(),++$<ne.length?I(ne[$]):J}}}function P(M,D){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&kn(u.events,D,u.events.length-D,M.resolve(u.events.slice(D),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function R(){const M=g(),D=u.previous,U=u.currentConstruct,V=u.events.length,W=Array.from(a);return{from:V,restore:J};function J(){r=M,u.previous=D,u.currentConstruct=U,u.events.length=V,a=W,C()}}function C(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function oF(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function aF(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
64
|
+
`;break}case-3:{o=`\r
|
|
65
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function lF(e){const r={constructs:o1([sF,...(e||{}).extensions||[]]),content:s(SO),defined:[],document:s(CO),flow:s(Vz),lazy:{},string:s(qz),text:s(Kz)};return r;function s(i){return o;function o(a){return iF(r,i,a)}}}function uF(e){for(;!d1(e););return e}const $v=/[\0\t\n\r]/g;function cF(){let e=1,t="",n=!0,r;return s;function s(i,o,a){const l=[];let u,c,f,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if($v.lastIndex=f,u=$v.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(f);break}if(p===10&&f===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<h&&(l.push(i.slice(f,h)),e+=h-f),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const dF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function fF(e){return e.replace(dF,hF)}function hF(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return a1(n.slice(i?2:1),i?16:10)}return _m(n)||e}const y1={}.hasOwnProperty;function pF(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),mF(n)(uF(lF(n).document().write(cF()(e,t,!0))))}function mF(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Tr),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(He),blockQuote:i(xe),characterEscape:R,characterReference:R,codeFenced:i(oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(oe,o),codeText:i(le,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(we),hardBreakEscape:i(Ge),hardBreakTrailing:i(Ge),htmlFlow:i(Et,o),htmlFlowData:R,htmlText:i(Et,o),htmlTextData:R,image:i(qn),label:o,link:i(Tr),listItem:i(So),listItemValue:h,listOrdered:i(ue,f),listUnordered:i(ue),paragraph:i(yi),reference:I,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(He),strong:i(lr),thematicBreak:i(jn)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:je,autolinkProtocol:Ke,blockQuote:l(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:de,characterReference:it,codeFenced:l(b),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:C,codeIndented:l(x),codeText:l(W),codeTextData:C,data:C,definition:l(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(D),hardBreakTrailing:l(D),htmlFlow:l(U),htmlFlowData:C,htmlText:l(V),htmlTextData:C,image:l(ne),label:F,labelText:$,lineEnding:M,link:l(J),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:O,resourceDestinationString:E,resourceTitleString:X,resource:Z,setextHeading:l(P),setextHeadingLineSequence:T,setextHeadingText:S,strong:l(),thematicBreak:l()}};v1(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(z){let Q={type:"root",children:[]};const ie={stack:[Q],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:c,data:n},fe=[];let Ce=-1;for(;++Ce<z.length;)if(z[Ce][1].type==="listOrdered"||z[Ce][1].type==="listUnordered")if(z[Ce][0]==="enter")fe.push(Ce);else{const ot=fe.pop();Ce=s(z,ot,Ce)}for(Ce=-1;++Ce<z.length;){const ot=t[z[Ce][0]];y1.call(ot,z[Ce][1].type)&&ot[z[Ce][1].type].call(Object.assign({sliceSerialize:z[Ce][2].sliceSerialize},ie),z[Ce][1])}if(ie.tokenStack.length>0){const ot=ie.tokenStack[ie.tokenStack.length-1];(ot[1]||Uv).call(ie,void 0,ot[0])}for(Q.position={start:Xr(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:Xr(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<t.transforms.length;)Q=t.transforms[Ce](Q)||Q;return Q}function s(z,Q,ie){let fe=Q-1,Ce=-1,ot=!1,dn,Ot,Tt,Ir;for(;++fe<=ie;){const at=z[fe];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?Ce++:Ce--,Ir=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(dn&&!Ir&&!Ce&&!Tt&&(Tt=fe),Ir=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ir=void 0}if(!Ce&&at[0]==="enter"&&at[1].type==="listItemPrefix"||Ce===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(dn){let j=fe;for(Ot=void 0;j--;){const B=z[j];if(B[1].type==="lineEnding"||B[1].type==="lineEndingBlank"){if(B[0]==="exit")continue;Ot&&(z[Ot][1].type="lineEndingBlank",ot=!0),B[1].type="lineEnding",Ot=j}else if(!(B[1].type==="linePrefix"||B[1].type==="blockQuotePrefix"||B[1].type==="blockQuotePrefixWhitespace"||B[1].type==="blockQuoteMarker"||B[1].type==="listItemIndent"))break}Tt&&(!Ot||Tt<Ot)&&(dn._spread=!0),dn.end=Object.assign({},Ot?z[Ot][1].start:at[1].end),z.splice(Ot||fe,0,["exit",dn,at[2]]),fe++,ie++}if(at[1].type==="listItemPrefix"){const j={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};dn=j,z.splice(fe,0,["enter",j,at[2]]),fe++,ie++,Tt=void 0,Ir=!0}}}return z[Q][1]._spread=ot,ie}function i(z,Q){return ie;function ie(fe){a.call(this,z(fe),fe),Q&&Q.call(this,fe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(z,Q,ie){this.stack[this.stack.length-1].children.push(z),this.stack.push(z),this.tokenStack.push([Q,ie||void 0]),z.position={start:Xr(Q.start),end:void 0}}function l(z){return Q;function Q(ie){z&&z.call(this,ie),u.call(this,ie)}}function u(z,Q){const ie=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==z.type&&(Q?Q.call(this,z,fe[0]):(fe[1]||Uv).call(this,z,fe[0]));else throw new Error("Cannot close `"+z.type+"` ("+la({start:z.start,end:z.end})+"): it’s not open");ie.position.end=Xr(z.end)}function c(){return bm(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(z){if(this.data.expectingFirstListItemValue){const Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(z),10),this.data.expectingFirstListItemValue=void 0}}function p(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=z}function g(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=z}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.value=z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.value=z.replace(/(\r?\n|\r)$/g,"")}function v(z){const Q=this.resume(),ie=this.stack[this.stack.length-1];ie.label=Q,ie.identifier=sr(this.sliceSerialize(z)).toLowerCase()}function w(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.title=z}function k(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.url=z}function _(z){const Q=this.stack[this.stack.length-1];if(!Q.depth){const ie=this.sliceSerialize(z).length;Q.depth=ie}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function T(z){const Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(z).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function R(z){const ie=this.stack[this.stack.length-1].children;let fe=ie[ie.length-1];(!fe||fe.type!=="text")&&(fe=Kn(),fe.position={start:Xr(z.start),end:void 0},ie.push(fe)),this.stack.push(fe)}function C(z){const Q=this.stack.pop();Q.value+=this.sliceSerialize(z),Q.position.end=Xr(z.end)}function M(z){const Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ie=Q.children[Q.children.length-1];ie.position.end=Xr(z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Q.type)&&(R.call(this,z),C.call(this,z))}function D(){this.data.atHardBreak=!0}function U(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.value=z}function V(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.value=z}function W(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.value=z}function J(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=Q,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function ne(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=Q,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function $(z){const Q=this.sliceSerialize(z),ie=this.stack[this.stack.length-2];ie.label=fF(Q),ie.identifier=sr(Q).toLowerCase()}function F(){const z=this.stack[this.stack.length-1],Q=this.resume(),ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,ie.type==="link"){const fe=z.children;ie.children=fe}else ie.alt=Q}function E(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.url=z}function X(){const z=this.resume(),Q=this.stack[this.stack.length-1];Q.title=z}function Z(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function O(z){const Q=this.resume(),ie=this.stack[this.stack.length-1];ie.label=Q,ie.identifier=sr(this.sliceSerialize(z)).toLowerCase(),this.data.referenceType="full"}function te(z){this.data.characterReferenceType=z.type}function de(z){const Q=this.sliceSerialize(z),ie=this.data.characterReferenceType;let fe;ie?(fe=a1(Q,ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=_m(Q);const Ce=this.stack[this.stack.length-1];Ce.value+=fe}function it(z){const Q=this.stack.pop();Q.position.end=Xr(z.end)}function Ke(z){C.call(this,z);const Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(z)}function je(z){C.call(this,z);const Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(z)}function xe(){return{type:"blockquote",children:[]}}function oe(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function we(){return{type:"emphasis",children:[]}}function He(){return{type:"heading",depth:0,children:[]}}function Ge(){return{type:"break"}}function Et(){return{type:"html",value:""}}function qn(){return{type:"image",title:null,url:"",alt:null}}function Tr(){return{type:"link",title:null,url:"",children:[]}}function ue(z){return{type:"list",ordered:z.type==="listOrdered",start:null,spread:z._spread,children:[]}}function So(z){return{type:"listItem",spread:z._spread,checked:null,children:[]}}function yi(){return{type:"paragraph",children:[]}}function lr(){return{type:"strong",children:[]}}function Kn(){return{type:"text",value:""}}function jn(){return{type:"thematicBreak"}}}function Xr(e){return{line:e.line,column:e.column,offset:e.offset}}function v1(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?v1(e,r):gF(e,r)}}function gF(e,t){let n;for(n in t)if(y1.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Uv(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+la({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+la({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+la({start:t.start,end:t.end})+") is still open")}function yF(e){const t=this;t.parser=n;function n(r){return pF(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function vF(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function xF(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
66
|
+
`}]}function wF(e,t){const n=t.value?t.value+`
|
|
67
|
+
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function bF(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _F(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function SF(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=_o(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function kF(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CF(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function x1(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function EF(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return x1(e,t);const s={src:_o(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function TF(e,t){const n={src:_o(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function IF(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function RF(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return x1(e,t);const s={href:_o(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function PF(e,t){const n={href:_o(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function jF(e,t,n){const r=e.all(t),s=n?AF(n):w1(t),i={},o=[];if(typeof t.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const c=r[a];(s||a!==0||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
68
|
+
`}),c.type==="element"&&c.tagName==="p"&&!s?o.push(...c.children):o.push(c)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
69
|
+
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function AF(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=w1(n[r])}return t}function w1(e){const t=e.spread;return t??e.children.length>1}function NF(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function MF(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DF(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function LF(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OF(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=ym(t.children[1]),l=Zk(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function zF(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const u=[];for(;++l<a;){const f=t.children[l],h={},p=o?o[l]:void 0;p&&(h.align=p);let g={type:"element",tagName:i,properties:h,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,c),e.applyData(t,c)}function FF(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Vv=9,Hv=32;function BF(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(Wv(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(Wv(t.slice(s),s>0,!1)),i.join("")}function Wv(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===Vv||i===Hv;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===Vv||i===Hv;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function $F(e,t){const n={type:"text",value:BF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function UF(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const VF={blockquote:vF,break:xF,code:wF,delete:bF,emphasis:_F,footnoteReference:SF,heading:kF,html:CF,imageReference:EF,image:TF,inlineCode:IF,linkReference:RF,link:PF,listItem:jF,list:NF,paragraph:MF,root:DF,strong:LF,table:OF,tableCell:FF,tableRow:zF,text:$F,thematicBreak:UF,toml:Il,yaml:Il,definition:Il,footnoteDefinition:Il};function Il(){}const b1=-1,Rc=0,ca=1,Gu=2,km=3,Cm=4,Em=5,Tm=6,_1=7,S1=8,HF=typeof self=="object"?self:globalThis,qv=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new HF[e](t)},WF=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Rc:case b1:return n(o,s);case ca:{const a=n([],s);for(const l of o)a.push(r(l));return a}case Gu:{const a=n({},s);for(const[l,u]of o)a[r(l)]=r(u);return a}case km:return n(new Date(o),s);case Cm:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case Em:{const a=n(new Map,s);for(const[l,u]of o)a.set(r(l),r(u));return a}case Tm:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case _1:{const{name:a,message:l}=o;return n(qv(a,l),s)}case S1:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(qv(i,o),s)};return r},Kv=e=>WF(new Map,e)(0),_i="",{toString:qF}={},{keys:KF}=Object,Lo=e=>{const t=typeof e;if(t!=="object"||!e)return[Rc,t];const n=qF.call(e).slice(8,-1);switch(n){case"Array":return[ca,_i];case"Object":return[Gu,_i];case"Date":return[km,_i];case"RegExp":return[Cm,_i];case"Map":return[Em,_i];case"Set":return[Tm,_i];case"DataView":return[ca,n]}return n.includes("Array")?[ca,n]:n.includes("Error")?[_1,n]:[Gu,n]},Rl=([e,t])=>e===Rc&&(t==="function"||t==="symbol"),GF=(e,t,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=Lo(o);switch(a){case Rc:{let c=o;switch(l){case"bigint":a=S1,c=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return s([b1],o)}return s([a,c],o)}case ca:{if(l){let h=o;return l==="DataView"?h=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(o)),s([l,[...h]],o)}const c=[],f=s([a,c],o);for(const h of o)c.push(i(h));return f}case Gu:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const c=[],f=s([a,c],o);for(const h of KF(o))(e||!Rl(Lo(o[h])))&&c.push([i(h),i(o[h])]);return f}case km:return s([a,o.toISOString()],o);case Cm:{const{source:c,flags:f}=o;return s([a,{source:c,flags:f}],o)}case Em:{const c=[],f=s([a,c],o);for(const[h,p]of o)(e||!(Rl(Lo(h))||Rl(Lo(p))))&&c.push([i(h),i(p)]);return f}case Tm:{const c=[],f=s([a,c],o);for(const h of o)(e||!Rl(Lo(h)))&&c.push(i(h));return f}}const{message:u}=o;return s([a,{name:l,message:u}],o)};return i},Gv=(e,{json:t,lossy:n}={})=>{const r=[];return GF(!(t||n),!!t,new Map,r)(e),r},Yu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Kv(Gv(e,t)):structuredClone(e):(e,t)=>Kv(Gv(e,t));function YF(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function QF(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function XF(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||YF,r=e.options.footnoteBackLabel||QF,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const c=e.all(u),f=String(u.identifier).toUpperCase(),h=_o(f.toLowerCase());let p=0;const g=[],y=e.footnoteCounts.get(f);for(;y!==void 0&&++p<=y;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const b=c[c.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else c.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(c,!0)};e.patch(u,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Yu(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
70
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
71
|
+
`}]}}const Pc=function(e){if(e==null)return tB;if(typeof e=="function")return jc(e);if(typeof e=="object")return Array.isArray(e)?JF(e):ZF(e);if(typeof e=="string")return eB(e);throw new Error("Expected function, string, or object as test")};function JF(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pc(e[n]);return jc(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function ZF(e){const t=e;return jc(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function eB(e){return jc(t);function t(n){return n&&n.type===e}}function jc(e){return t;function t(n,r,s){return!!(nB(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function tB(){return!0}function nB(e){return e!==null&&typeof e=="object"&&"type"in e}const k1=[],rB=!0,wh=!1,sB="skip";function C1(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Pc(s),o=r?-1:1;a(e,void 0,[])();function a(l,u,c){const f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=k1,g,y,b;if((!t||i(l,u,c[c.length-1]||void 0))&&(p=iB(n(l,c)),p[0]===wh))return p;if("children"in l&&l.children){const x=l;if(x.children&&p[0]!==sB)for(y=(r?x.children.length:-1)+o,b=c.concat(x);y>-1&&y<x.children.length;){const v=x.children[y];if(g=a(v,y,b)(),g[0]===wh)return g;y=typeof g[1]=="number"?g[1]:y+o}}return p}}}function iB(e){return Array.isArray(e)?e:typeof e=="number"?[rB,e]:e==null?k1:[e]}function Im(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),C1(e,i,a,s);function a(l,u){const c=u[u.length-1],f=c?c.children.indexOf(l):void 0;return o(l,f,c)}}const bh={}.hasOwnProperty,oB={};function aB(e,t){const n=t||oB,r=new Map,s=new Map,i=new Map,o={...VF,...n.handlers},a={all:u,applyData:uB,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:lB,wrap:dB};return Im(e,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const f=c.type==="definition"?r:s,h=String(c.identifier).toUpperCase();f.has(h)||f.set(h,c)}}),a;function l(c,f){const h=c.type,p=a.handlers[h];if(bh.call(a.handlers,h)&&p)return p(a,c,f);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in c){const{children:y,...b}=c,x=Yu(b);return x.children=a.all(c),x}return Yu(c)}return(a.options.unknownHandler||cB)(a,c,f)}function u(c){const f=[];if("children"in c){const h=c.children;let p=-1;for(;++p<h.length;){const g=a.one(h[p],c);if(g){if(p&&h[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Yv(g.value)),!Array.isArray(g)&&g.type==="element")){const y=g.children[0];y&&y.type==="text"&&(y.value=Yv(y.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function lB(e,t){e.position&&(t.position=YL(e))}function uB(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Yu(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function cB(e,t){const n=t.data||{},r="value"in t&&!(bh.call(n,"hProperties")||bh.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function dB(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
72
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
73
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
74
|
+
`}),n}function Yv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Qv(e,t){const n=aB(e,t),r=n.one(e,void 0),s=XF(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
75
|
+
`},s),i}function fB(e,t){return e&&"run"in e?async function(n,r){const s=Qv(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Qv(n,{file:r,...e||t})}}function Xv(e){if(e)throw e}var eu=Object.prototype.hasOwnProperty,E1=Object.prototype.toString,Jv=Object.defineProperty,Zv=Object.getOwnPropertyDescriptor,ex=function(t){return typeof Array.isArray=="function"?Array.isArray(t):E1.call(t)==="[object Array]"},tx=function(t){if(!t||E1.call(t)!=="[object Object]")return!1;var n=eu.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&eu.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||eu.call(t,s)},nx=function(t,n){Jv&&n.name==="__proto__"?Jv(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},rx=function(t,n){if(n==="__proto__")if(eu.call(t,n)){if(Zv)return Zv(t,n).value}else return;return t[n]},hB=function e(){var t,n,r,s,i,o,a=arguments[0],l=1,u=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=rx(a,n),s=rx(t,n),a!==s&&(c&&s&&(tx(s)||(i=ex(s)))?(i?(i=!1,o=r&&ex(r)?r:[]):o=r&&tx(r)?r:{},nx(a,{name:n,newValue:e(c,o,s)})):typeof s<"u"&&nx(a,{name:n,newValue:s}));return a};const Pd=Va(hB);function _h(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function pB(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...u){const c=e[++i];let f=-1;if(l){o(l);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,c?mB(c,a)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function mB(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(s);try{l=e.apply(this,o)}catch(u){const c=u;if(a&&n)throw c;return s(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,t(o,...a))}function i(o){s(null,o)}}const hr={basename:gB,dirname:yB,extname:vB,join:xB,sep:"/"};function gB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');el(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function yB(e){if(el(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function vB(e){el(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function xB(...e){let t=-1,n;for(;++t<e.length;)el(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":wB(n)}function wB(e){el(e);const t=e.codePointAt(0)===47;let n=bB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function bB(e,t){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function el(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _B={cwd:SB};function SB(){return"/"}function Sh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kB(e){if(typeof e=="string")e=new URL(e);else if(!Sh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return CB(e)}function CB(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const jd=["history","path","basename","stem","extname","dirname"];class T1{constructor(t){let n;t?Sh(t)?n={path:t}:typeof t=="string"||EB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":_B.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<jd.length;){const i=jd[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)jd.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?hr.basename(this.path):void 0}set basename(t){Nd(t,"basename"),Ad(t,"basename"),this.path=hr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?hr.dirname(this.path):void 0}set dirname(t){sx(this.basename,"dirname"),this.path=hr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?hr.extname(this.path):void 0}set extname(t){if(Ad(t,"extname"),sx(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=hr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Sh(t)&&(t=kB(t)),Nd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?hr.basename(this.path,this.extname):void 0}set stem(t){Nd(t,"stem"),Ad(t,"stem"),this.path=hr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Lt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ad(e,t){if(e&&e.includes(hr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+hr.sep+"`")}function Nd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sx(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function EB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const TB=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},IB={}.hasOwnProperty;class Rm extends TB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=pB()}copy(){const t=new Rm;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Pd(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ld("data",this.frozen),this.namespace[t]=n,this):IB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ld("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Pl(t),r=this.parser||this.Parser;return Md("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Md("process",this.parser||this.Parser),Dd("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=Pl(t),l=r.parse(a);r.run(l,a,function(c,f,h){if(c||!f||!h)return u(c);const p=f,g=r.stringify(p,h);jB(g)?h.value=g:h.result=g,u(c,h)});function u(c,f){c||!f?o(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Md("processSync",this.parser||this.Parser),Dd("processSync",this.compiler||this.Compiler),this.process(t,s),ox("processSync","process",n),r;function s(i,o){n=!0,Xv(i),r=o}}run(t,n,r){ix(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=Pl(n);s.run(t,l,u);function u(c,f,h){const p=f||t;c?a(c):o?o(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),ox("runSync","run",r),s;function i(o,a){Xv(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=Pl(n),s=this.compiler||this.Compiler;return Dd("stringify",s),ix(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Ld("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(s.settings=Pd(!0,s.settings,u.settings))}function a(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const y=r[h][1];_h(y)&&_h(p)&&(p=Pd(!0,y,p)),r[h]=[u,p,...g]}}}}const RB=new Rm().freeze();function Md(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Dd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ld(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ix(e){if(!_h(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ox(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pl(e){return PB(e)?e:new T1(e)}function PB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function jB(e){return typeof e=="string"||AB(e)}function AB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ax=[],lx={allowDangerousHtml:!0},MB=/^(https?|ircs?|mailto|xmpp)$/i,DB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function LB(e){const t=OB(e),n=zB(e);return FB(t.runSync(t.parse(n),n),e)}function OB(e){const t=e.rehypePlugins||ax,n=e.remarkPlugins||ax,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...lx}:lx;return RB().use(yF).use(n).use(fB,r).use(t)}function zB(e){const t=e.children||"",n=new T1;return typeof t=="string"&&(n.value=t),n}function FB(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||BB;for(const c of DB)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+NB+c.id,void 0);return Im(e,u),eO(e,{Fragment:d.Fragment,components:s,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(c,f,h){if(c.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let p;for(p in Td)if(Object.hasOwn(Td,p)&&Object.hasOwn(c.properties,p)){const g=c.properties[p],y=Td[p];(y===null||y.includes(c.tagName))&&(c.properties[p]=l(String(g||""),p,c))}}if(c.type==="element"){let p=n?!n.includes(c.tagName):i?i.includes(c.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(c,f,h)),p&&h&&typeof f=="number")return a&&c.children?h.children.splice(f,1,...c.children):h.children.splice(f,1),f}}}function BB(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||MB.test(e.slice(0,t))?e:""}const{useSmooth:$B,useSmoothStatus:UB,withSmoothContextProvider:VB}=cM,HB=({components:e,componentsByLanguage:t,smooth:n=!0,preprocess:r,...s})=>{const i=hS(),{text:o}=$B(m.useMemo(()=>r?{...i,text:r(i.text)}:i,[i,r]),n),{pre:a=QD,code:l=XD,SyntaxHighlighter:u=hm,CodeHeader:c=JD}=e??{},f=m.useMemo(()=>({Pre:a,Code:l,SyntaxHighlighter:u,CodeHeader:c}),[a,l,u,c]),h=ii(p=>d.jsx(rL,{components:f,componentsByLanguage:t,...p}));return d.jsx(LB,{components:m.useMemo(()=>{const{pre:p,code:g,SyntaxHighlighter:y,CodeHeader:b,...x}=e??{};return{...x,pre:YD,code:h}},[h,e]),...s,children:o})},I1=m.forwardRef(({className:e,containerProps:t,containerComponent:n="div",...r},s)=>d.jsx(n,{"data-status":UB().type,...t,className:Wk(e,t?.className),ref:s,children:d.jsx(HB,{...r})}));I1.displayName="MarkdownTextPrimitive";const WB=VB(I1);function ux(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function qB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function KB(e,t,n){const s=Pc((n||{}).ignore||[]),i=GB(t);let o=-1;for(;++o<i.length;)C1(e,"text",a);function a(u,c){let f=-1,h;for(;++f<c.length;){const p=c[f],g=h?h.children:void 0;if(s(p,g?g.indexOf(p):void 0,h))return;h=p}if(h)return l(u,c)}function l(u,c){const f=c[c.length-1],h=i[o][0],p=i[o][1];let g=0;const b=f.children.indexOf(u);let x=!1,v=[];h.lastIndex=0;let w=h.exec(u.value);for(;w;){const k=w.index,_={index:w.index,input:w.input,stack:[...c,u]};let S=p(...w,_);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=k+1:(g!==k&&v.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(S)?v.push(...S):S&&v.push(S),g=k+w[0].length,x=!0),!h.global)break;w=h.exec(u.value)}return x?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),f.children.splice(b,1,...v)):v=[u],b+v.length}}function GB(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([YB(s[0]),QB(s[1])])}return t}function YB(e){return typeof e=="string"?new RegExp(qB(e),"g"):e}function QB(e){return typeof e=="function"?e:function(){return e}}const Od="phrasing",zd=["autolink","link","image","label"];function XB(){return{transforms:[s4],enter:{literalAutolink:ZB,literalAutolinkEmail:Fd,literalAutolinkHttp:Fd,literalAutolinkWww:Fd},exit:{literalAutolink:r4,literalAutolinkEmail:n4,literalAutolinkHttp:e4,literalAutolinkWww:t4}}}function JB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Od,notInConstruct:zd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Od,notInConstruct:zd},{character:":",before:"[ps]",after:"\\/",inConstruct:Od,notInConstruct:zd}]}}function ZB(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fd(e){this.config.enter.autolinkProtocol.call(this,e)}function e4(e){this.config.exit.autolinkProtocol.call(this,e)}function t4(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function n4(e){this.config.exit.autolinkEmail.call(this,e)}function r4(e){this.exit(e)}function s4(e){KB(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,i4],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,o4]],{ignore:["link","linkReference"]})}function i4(e,t,n,r,s){let i="";if(!R1(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!a4(n)))return!1;const o=l4(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function o4(e,t,n,r){return!R1(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function a4(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function l4(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=ux(e,"(");let i=ux(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function R1(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||oi(n)||Tc(n))&&(!t||n!==47)}P1.peek=y4;function u4(){this.buffer()}function c4(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function d4(){this.buffer()}function f4(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function h4(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=sr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function p4(e){this.exit(e)}function m4(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=sr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function g4(e){this.exit(e)}function y4(){return"["}function P1(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function v4(){return{enter:{gfmFootnoteCallString:u4,gfmFootnoteCall:c4,gfmFootnoteDefinitionLabelString:d4,gfmFootnoteDefinition:f4},exit:{gfmFootnoteCallString:h4,gfmFootnoteCall:p4,gfmFootnoteDefinitionLabelString:m4,gfmFootnoteDefinition:g4}}}function x4(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:P1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const u=i.enter("footnoteDefinition"),c=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),c(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
|
|
76
|
+
`:" ")+i.indentLines(i.containerFlow(r,a.current()),t?j1:w4))),u(),l}}function w4(e,t,n){return t===0?e:j1(e,t,n)}function j1(e,t,n){return(n?"":" ")+e}const b4=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];A1.peek=E4;function _4(){return{canContainEols:["delete"],enter:{strikethrough:k4},exit:{strikethrough:C4}}}function S4(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:b4}],handlers:{delete:A1}}}function k4(e){this.enter({type:"delete",children:[]},e)}function C4(e){this.exit(e)}function A1(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function E4(){return"~"}function T4(e){return e.length}function I4(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||T4,i=[],o=[],a=[],l=[];let u=0,c=-1;for(;++c<e.length;){const y=[],b=[];let x=-1;for(e[c].length>u&&(u=e[c].length);++x<e[c].length;){const v=R4(e[c][x]);if(n.alignDelimiters!==!1){const w=s(v);b[x]=w,(l[x]===void 0||w>l[x])&&(l[x]=w)}y.push(v)}o[c]=y,a[c]=b}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)i[f]=cx(r[f]);else{const y=cx(r);for(;++f<u;)i[f]=y}f=-1;const h=[],p=[];for(;++f<u;){const y=i[f];let b="",x="";y===99?(b=":",x=":"):y===108?b=":":y===114&&(x=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[f]-b.length-x.length);const w=b+"-".repeat(v)+x;n.alignDelimiters!==!1&&(v=b.length+v+x.length,v>l[f]&&(l[f]=v),p[f]=v),h[f]=w}o.splice(1,0,h),a.splice(1,0,p),c=-1;const g=[];for(;++c<o.length;){const y=o[c],b=a[c];f=-1;const x=[];for(;++f<u;){const v=y[f]||"";let w="",k="";if(n.alignDelimiters!==!1){const _=l[f]-(b[f]||0),S=i[f];S===114?w=" ".repeat(_):S===99?_%2?(w=" ".repeat(_/2+.5),k=" ".repeat(_/2-.5)):(w=" ".repeat(_/2),k=w):k=" ".repeat(_)}n.delimiterStart!==!1&&!f&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&x.push(" "),n.alignDelimiters!==!1&&x.push(w),x.push(v),n.alignDelimiters!==!1&&x.push(k),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&x.push("|")}g.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
|
|
77
|
+
`)}function R4(e){return e==null?"":String(e)}function cx(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function P4(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),j4);return s(),o}function j4(e,t,n){return">"+(n?"":" ")+e}function A4(e,t){return dx(e,t.inConstruct,!0)&&!dx(e,t.notInConstruct,!1)}function dx(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function fx(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
78
|
+
`&&A4(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
79
|
+
`}function N4(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function M4(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function D4(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function L4(e,t,n,r){const s=D4(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(M4(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,O4);return f(),h}const a=n.createTracker(r),l=s.repeat(Math.max(N4(i,s)+1,3)),u=n.enter("codeFenced");let c=a.move(l);if(e.lang){const f=n.enter(`codeFencedLang${o}`);c+=a.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...a.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);c+=a.move(" "),c+=a.move(n.safe(e.meta,{before:c,after:`
|
|
80
|
+
`,encode:["`"],...a.current()})),f()}return c+=a.move(`
|
|
81
|
+
`),i&&(c+=a.move(i+`
|
|
82
|
+
`)),c+=a.move(l),u(),c}function O4(e,t,n){return(n?"":" ")+e}function Pm(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function z4(e,t,n,r){const s=Pm(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
83
|
+
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),a()),o(),u}function F4(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function $a(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Qu(e,t,n){const r=fo(e),s=fo(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}N1.peek=B4;function N1(e,t,n,r){const s=F4(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const u=l.charCodeAt(0),c=Qu(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=$a(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=Qu(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+$a(f));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function B4(e,t,n){return n.options.emphasis||"*"}function $4(e,t){let n=!1;return Im(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,wh}),!!((!e.depth||e.depth<3)&&bm(e)&&(t.options.setext||n))}function U4(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if($4(e,n)){const c=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:`
|
|
84
|
+
`,after:`
|
|
85
|
+
`});return f(),c(),h+`
|
|
86
|
+
`+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
|
87
|
+
`))+1))}const o="#".repeat(s),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
88
|
+
`,...i.current()});return/^[\t ]/.test(u)&&(u=$a(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}M1.peek=V4;function M1(e){return e.value||""}function V4(){return"<"}D1.peek=H4;function D1(e,t,n,r){const s=Pm(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),a()),u+=l.move(")"),o(),u}function H4(){return"!"}L1.peek=W4;function L1(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=c,i(),s==="full"||!u||u!==f?l+=a.move(f+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function W4(){return"!"}O1.peek=q4;function O1(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return s+r+s}function q4(){return"`"}function z1(e,t){const n=bm(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}F1.peek=K4;function F1(e,t,n,r){const s=Pm(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(z1(e,n)){const c=n.stack;n.stack=[],a=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),a(),n.stack=c,f}a=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),l()),u+=o.move(")"),a(),u}function K4(e,t,n){return z1(e,n)?"<":"["}B1.peek=G4;function B1(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=c,i(),s==="full"||!u||u!==f?l+=a.move(f+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function G4(){return"["}function jm(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Y4(e){const t=jm(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Q4(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function $1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function X4(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?Q4(n):jm(n);const a=e.ordered?o==="."?")":".":Y4(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const c=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),$1(n)===o&&c){let f=-1;for(;++f<e.children.length;){const h=e.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function J4(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Z4(e,t,n,r){const s=J4(n);let i=n.bulletCurrent||jm(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),c);return l(),u;function c(f,h,p){return h?(p?"":" ".repeat(o))+f:(p?i:i+" ".repeat(o-i.length))+f}}function e3(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const t3=Pc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function n3(e,t,n,r){return(e.children.some(function(o){return t3(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function r3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}U1.peek=s3;function U1(e,t,n,r){const s=r3(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const u=l.charCodeAt(0),c=Qu(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=$a(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=Qu(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+$a(f));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function s3(e,t,n){return n.options.strong||"*"}function i3(e,t,n,r){return n.safe(e.value,r)}function o3(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function a3(e,t,n){const r=($1(n)+(n.options.ruleSpaces?" ":"")).repeat(o3(n));return n.options.ruleSpaces?r.slice(0,-1):r}const V1={blockquote:P4,break:fx,code:L4,definition:z4,emphasis:N1,hardBreak:fx,heading:U4,html:M1,image:D1,imageReference:L1,inlineCode:O1,link:F1,linkReference:B1,list:X4,listItem:Z4,paragraph:e3,root:n3,strong:U1,text:i3,thematicBreak:a3};function l3(){return{enter:{table:u3,tableData:hx,tableHeader:hx,tableRow:d3},exit:{codeText:f3,table:c3,tableData:Bd,tableHeader:Bd,tableRow:Bd}}}function u3(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function c3(e){this.exit(e),this.data.inTable=void 0}function d3(e){this.enter({type:"tableRow",children:[]},e)}function Bd(e){this.exit(e)}function hx(e){this.enter({type:"tableCell",children:[]},e)}function f3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,h3));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function h3(e,t){return t==="|"?t:e}function p3(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
89
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:l,tableRow:a}};function o(p,g,y,b){return u(c(p,y,b),p.align)}function a(p,g,y,b){const x=f(p,y,b),v=u([x]);return v.slice(0,v.indexOf(`
|
|
90
|
+
`))}function l(p,g,y,b){const x=y.enter("tableCell"),v=y.enter("phrasing"),w=y.containerPhrasing(p,{...b,before:i,after:i});return v(),x(),w}function u(p,g){return I4(p,{align:g,alignDelimiters:r,padding:n,stringLength:s})}function c(p,g,y){const b=p.children;let x=-1;const v=[],w=g.enter("table");for(;++x<b.length;)v[x]=f(b[x],g,y);return w(),v}function f(p,g,y){const b=p.children;let x=-1;const v=[],w=g.enter("tableRow");for(;++x<b.length;)v[x]=l(b[x],p,g,y);return w(),v}function h(p,g,y){let b=V1.inlineCode(p,g,y);return y.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function m3(){return{exit:{taskListCheckValueChecked:px,taskListCheckValueUnchecked:px,paragraph:y3}}}function g3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:v3}}}function px(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function y3(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const a=s[i];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function v3(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=V1.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+o}}function x3(){return[XB(),v4(),_4(),l3(),m3()]}function w3(e){return{extensions:[JB(),x4(e),S4(),p3(e),g3()]}}const b3={tokenize:T3,partial:!0},H1={tokenize:I3,partial:!0},W1={tokenize:R3,partial:!0},q1={tokenize:P3,partial:!0},_3={tokenize:j3,partial:!0},K1={name:"wwwAutolink",tokenize:C3,previous:Y1},G1={name:"protocolAutolink",tokenize:E3,previous:Q1},Gr={name:"emailAutolink",tokenize:k3,previous:X1},Er={};function S3(){return{text:Er}}let Ls=48;for(;Ls<123;)Er[Ls]=Gr,Ls++,Ls===58?Ls=65:Ls===91&&(Ls=97);Er[43]=Gr;Er[45]=Gr;Er[46]=Gr;Er[95]=Gr;Er[72]=[Gr,G1];Er[104]=[Gr,G1];Er[87]=[Gr,K1];Er[119]=[Gr,K1];function k3(e,t,n){const r=this;let s,i;return o;function o(f){return!kh(f)||!X1.call(r,r.previous)||Am(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(f))}function a(f){return kh(f)?(e.consume(f),a):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(_3,c,u)(f):f===45||f===95||Nt(f)?(i=!0,e.consume(f),l):c(f)}function u(f){return e.consume(f),s=!0,l}function c(f){return i&&s&&Ut(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function C3(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!Y1.call(r,r.previous)||Am(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(b3,e.attempt(H1,e.attempt(W1,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function E3(e,t,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&Q1.call(r,r.previous)&&!Am(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),a):n(f)}function a(f){if(Ut(f)&&s.length<5)return s+=String.fromCodePoint(f),e.consume(f),a;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),i?u:(i=!0,l)):n(f)}function u(f){return f===null||Ku(f)||De(f)||oi(f)||Tc(f)?n(f):e.attempt(H1,e.attempt(W1,c),n)(f)}function c(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function T3(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function I3(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(q1,l,a)(u):u===null||De(u)||oi(u)||u!==45&&Tc(u)?l(u):(i=!0,e.consume(u),o)}function a(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function l(u){return s||r||!i?n(u):t(u)}}function R3(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(q1,t,i)(o):o===null||De(o)||oi(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function P3(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),i):a===93?(e.consume(a),s):a===60||a===null||De(a)||oi(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||De(a)||oi(a)?t(a):r(a)}function i(a){return Ut(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ut(a)?(e.consume(a),o):n(a)}}function j3(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return Nt(i)?n(i):t(i)}}function Y1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||De(e)}function Q1(e){return!Ut(e)}function X1(e){return!(e===47||kh(e))}function kh(e){return e===43||e===45||e===46||e===95||Nt(e)}function Am(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const A3={tokenize:B3,partial:!0};function N3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:O3,continuation:{tokenize:z3},exit:F3}},text:{91:{name:"gfmFootnoteCall",tokenize:L3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:M3,resolveTo:D3}}}}function M3(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const u=sr(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function D3(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function L3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!o||f===null||f===91||De(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(sr(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return De(f)||(o=!0),i++,e.consume(f),f===92?c:u}function c(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function O3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(g)}function c(g){if(o>999||g===93&&!a||g===null||g===91||De(g))return n(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=sr(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return De(g)||(a=!0),o++,e.consume(g),g===92?f:c}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,c):c(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),s.includes(i)||s.push(i),Ee(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function z3(e,t,n){return e.check(Za,t,e.attempt(A3,t,n))}function F3(e){e.exit("gfmFootnoteDefinition")}function B3(e,t,n){const r=this;return Ee(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function $3(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},f={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},h=[["enter",c,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",f,a]],p=a.parser.constructs.insideSpan.null;p&&kn(h,h.length,0,Ic(p,o.slice(u+1,l),a)),kn(h,h.length,0,[["exit",f,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",c,a]]),kn(o,u-1,l-u+3,h),l=u+h.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const u=this.previous,c=this.events;let f=0;return h;function h(g){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const y=fo(u);if(g===126)return f>1?l(g):(o.consume(g),f++,p);if(f<2&&!n)return l(g);const b=o.exit("strikethroughSequenceTemporary"),x=fo(g);return b._open=!x||x===2&&!!y,b._close=!y||y===2&&!!x,a(g)}}}class U3{constructor(){this.map=[]}add(t,n,r){V3(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function V3(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function H3(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function W3(){return{flow:{null:{name:"table",tokenize:q3,resolveAll:K3}}}}function q3(e,t,n){const r=this;let s=0,i=0,o;return a;function a(C){let M=r.events.length-1;for(;M>-1;){const V=r.events[M][1].type;if(V==="lineEnding"||V==="linePrefix")M--;else break}const D=M>-1?r.events[M][1].type:null,U=D==="tableHead"||D==="tableRow"?S:l;return U===S&&r.parser.lazy[r.now().line]?n(C):U(C)}function l(C){return e.enter("tableHead"),e.enter("tableRow"),u(C)}function u(C){return C===124||(o=!0,i+=1),c(C)}function c(C){return C===null?n(C):ae(C)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),p):n(C):be(C)?Ee(e,c,"whitespace")(C):(i+=1,o&&(o=!1,s+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),o=!0,c):(e.enter("data"),f(C)))}function f(C){return C===null||C===124||De(C)?(e.exit("data"),c(C)):(e.consume(C),C===92?h:f)}function h(C){return C===92||C===124?(e.consume(C),f):f(C)}function p(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),o=!1,be(C)?Ee(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):g(C))}function g(C){return C===45||C===58?b(C):C===124?(o=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),y):_(C)}function y(C){return be(C)?Ee(e,b,"whitespace")(C):b(C)}function b(C){return C===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),x):C===45?(i+=1,x(C)):C===null||ae(C)?k(C):_(C)}function x(C){return C===45?(e.enter("tableDelimiterFiller"),v(C)):_(C)}function v(C){return C===45?(e.consume(C),v):C===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(C))}function w(C){return be(C)?Ee(e,k,"whitespace")(C):k(C)}function k(C){return C===124?g(C):C===null||ae(C)?!o||s!==i?_(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):_(C)}function _(C){return n(C)}function S(C){return e.enter("tableRow"),T(C)}function T(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),T):C===null||ae(C)?(e.exit("tableRow"),t(C)):be(C)?Ee(e,T,"whitespace")(C):(e.enter("data"),P(C))}function P(C){return C===null||C===124||De(C)?(e.exit("data"),T(C)):(e.consume(C),C===92?R:P)}function R(C){return C===92||C===124?(e.consume(C),P):P(C)}}function K3(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,c,f;const h=new U3;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(mx(h,t,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,c={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",c,t]])),s=g.type==="tableDelimiterRow"?2:c?3:1):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],f=jl(h,t,i,s,void 0,f),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],f=jl(h,t,i,s,void 0,f)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],f=jl(h,t,i,s,n,f)):o[1]!==0&&(f=jl(h,t,o,s,n,f)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&mx(h,t,l,u,c),h.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=H3(t.events,n))}return e}function jl(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Si(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Si(t.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=Si(t.events,n[2]),c=Si(t.events,n[3]),f={type:a,start:Object.assign({},u),end:Object.assign({},c)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const h=t.events[n[2]],p=t.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,y=n[3]-n[2]-1;e.add(g,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},Si(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function mx(e,t,n,r,s){const i=[],o=Si(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function Si(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const G3={name:"tasklistCheck",tokenize:Q3};function Y3(){return{text:{91:G3}}}function Q3(e,t,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return De(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return ae(l)?t(l):be(l)?e.check({tokenize:X3},t,n)(l):n(l)}}function X3(e,t,n){return Ee(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function J3(e){return o1([S3(),N3(),$3(e),W3(),Y3()])}const Z3={};function e5(e){const t=this,n=e||Z3,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(J3(n)),i.push(x3()),o.push(w3(n))}const t5="modulepreload",n5=function(e,t){return new URL(e,t).href},gx={},dr=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");s=Promise.allSettled(n.map(u=>{if(u=n5(u,r),u in gx)return;gx[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(!!r)for(let g=o.length-1;g>=0;g--){const y=o[g];if(y.href===u&&(!c||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":t5,c||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),c)return new Promise((g,y)=>{p.addEventListener("load",g),p.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},r5={ts:"typescript",typescript:"typescript",tsx:"typescript",js:"javascript",javascript:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",sh:"bash",bash:"bash",shell:"bash",zsh:"bash",py:"python",python:"python",diff:"diff",patch:"diff",md:"markdown",markdown:"markdown",html:"xml",xml:"xml",css:"css"};function Nm(e){return e?r5[e.trim().toLowerCase()]??null:null}let $d=null;async function s5(){return $d||($d=(async()=>{const{default:e}=await dr(async()=>{const{default:c}=await import("./core-C29-1O9j.js");return{default:c}},[],import.meta.url),[t,n,r,s,i,o,a,l,u]=await Promise.all([dr(()=>import("./typescript-C2FFdlUC.js"),[],import.meta.url),dr(()=>import("./javascript-BKRaQes9.js"),[],import.meta.url),dr(()=>import("./json-DIYVocXf.js"),[],import.meta.url),dr(()=>import("./bash-I8pq0VWm.js"),[],import.meta.url),dr(()=>import("./python-sE43i1Pi.js"),[],import.meta.url),dr(()=>import("./diff-DiTmLxSS.js"),[],import.meta.url),dr(()=>import("./markdown-BrP960CR.js"),[],import.meta.url),dr(()=>import("./xml-BXBhIUeX.js"),[],import.meta.url),dr(()=>import("./css-DazXZka4.js"),[],import.meta.url)]);return e.registerLanguage("typescript",t.default),e.registerLanguage("javascript",n.default),e.registerLanguage("json",r.default),e.registerLanguage("bash",s.default),e.registerLanguage("python",i.default),e.registerLanguage("diff",o.default),e.registerLanguage("markdown",a.default),e.registerLanguage("xml",l.default),e.registerLanguage("css",u.default),e})()),$d}async function J1(e,t){const n=Nm(e);if(!n)return null;try{const r=await s5(),{value:s}=r.highlight(t,{language:n,ignoreIllegals:!0});return s}catch{return null}}function i5(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n),t=t>>>0;return t.toString(36)}function o5(e,t){return"code-"+i5((e??"")+`
|
|
91
|
+
`+t)}const yx=8,Z1=m.createContext(null);function Mm(){const e=m.useContext(Z1);if(!e)throw new Error("useArtifactPanel must be used inside <ArtifactPanelProvider>");return e}function a5(e,t){const n=e.artifacts.findIndex(s=>s.id===t.id);if(n>=0)return{artifacts:[e.artifacts[n],...e.artifacts.filter((i,o)=>o!==n)],activeId:t.id};const r=[t,...e.artifacts];return{artifacts:r.length>yx?r.slice(0,yx):r,activeId:t.id}}function l5(e,t){const n=e.artifacts.findIndex(i=>i.id===t);if(n<0)return e;const r=e.artifacts.filter((i,o)=>o!==n);let s=e.activeId;if(e.activeId===t)if(r.length===0)s=null;else{const i=Math.min(n,r.length-1);s=r[i].id}return{artifacts:r,activeId:s}}function u5({children:e}){const[t,n]=m.useState({artifacts:[],activeId:null}),r=m.useCallback(a=>{n(l=>a5(l,a))},[]),s=m.useCallback(a=>{n(l=>({...l,activeId:a}))},[]),i=m.useCallback(a=>{n(l=>l5(l,a))},[]),o=m.useMemo(()=>({artifacts:t.artifacts,activeId:t.activeId,open:r,setActive:s,close:i}),[t,r,s,i]);return d.jsx(Z1.Provider,{value:o,children:e})}const c5=({language:e,code:t})=>{const{open:n}=Mm();if(!e)return null;const r=typeof t=="string"&&t.length>0,s=()=>{if(!r||typeof t!="string")return;const i=e||"code";n({id:o5(e,t),kind:"code",title:i,language:e,content:t})};return d.jsxs("div",{className:"aui-md-code-lang",children:[d.jsx("span",{className:"aui-md-code-lang-name",children:e}),r?d.jsx("button",{type:"button",className:"aui-md-code-open-btn",onClick:s,title:"Open in side panel","aria-label":`Open ${e} code in side panel`,children:"↗"}):null]})},d5=({components:e,language:t,code:n})=>{const{Pre:r,Code:s}=e,i=Nm(t)!==null,[o,a]=m.useState(null);return m.useEffect(()=>{if(!i){a(null);return}let l=!0;return a(null),J1(t,n).then(u=>{l&&a(u)}).catch(()=>{l&&a(null)}),()=>{l=!1}},[i,t,n]),i&&o!=null?d.jsx(r,{children:d.jsx(s,{className:"hljs",dangerouslySetInnerHTML:{__html:o}})}):d.jsx(r,{children:d.jsx(s,{className:i?"hljs":void 0,children:n})})},f5=({node:e,...t})=>d.jsx("div",{className:"md-table-wrap",children:d.jsx("table",{...t})}),h5=()=>d.jsx(WB,{className:"aui-md",remarkPlugins:[e5],components:{CodeHeader:c5,SyntaxHighlighter:d5,table:f5}}),p5=m.memo(h5);function m5(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=!1,s=null;return st(PM(e)).then(i=>i.ok?i.blob():null).then(i=>{!i||r||(s=URL.createObjectURL(i),n(s))}).catch(()=>{}),()=>{r=!0,s&&URL.revokeObjectURL(s),n(null)}},[e]),t}const g5=new Set([".jpg",".jpeg",".png",".gif",".webp",".avif",".heic",".heif",".svg"]),vx=/(?:^|\s)(\/[^\s]*\/\.claude-control\/uploads\/([^\s]+))/g;function y5(e){const t=[],n=new Set;let r;for(vx.lastIndex=0;(r=vx.exec(e))!==null;){const s=r[1].trim();if(n.has(s))continue;n.add(s);const i=r[2],o=i.slice(i.lastIndexOf(".")).toLowerCase();t.push({fullPath:s,basename:i,isImage:g5.has(o)})}return t}function eC({src:e,alt:t,onClose:n}){const r=m.useRef(null);m.useEffect(()=>{r.current?.focus()},[]);const s=m.useCallback(i=>{i.key==="Escape"&&(i.preventDefault(),n())},[n]);return d.jsx("div",{className:"lightbox-backdrop",role:"dialog","aria-modal":"true","aria-label":`Preview: ${t}`,ref:r,tabIndex:-1,onClick:n,onKeyDown:s,children:d.jsx("img",{className:"lightbox-img",src:e,alt:t,onClick:i=>i.stopPropagation()})})}function v5({ref_:e}){const[t,n]=m.useState(!1),r=m5(e.basename);return e.isImage?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"transcript-thumb-btn","aria-label":`Preview ${e.basename}`,title:e.basename,onClick:()=>n(!0),children:r?d.jsx("img",{className:"transcript-thumb",src:r,alt:e.basename,loading:"lazy"}):d.jsx("span",{className:"transcript-thumb transcript-thumb-loading","aria-hidden":"true"})}),t&&r?d.jsx(eC,{src:r,alt:e.basename,onClose:()=>n(!1)}):null]}):d.jsxs("a",{className:"transcript-file-chip",href:r??void 0,download:e.basename,"aria-label":`Download ${e.basename}`,title:e.basename,"aria-disabled":r?void 0:!0,children:[d.jsx("span",{className:"chip-icon","aria-hidden":"true",children:"📎"}),d.jsx("span",{className:"chip-name",children:e.basename})]})}function x5({text:e}){const t=y5(e);return t.length===0?null:d.jsx("div",{className:"transcript-attachments","aria-label":"Attachments",children:t.map(n=>d.jsx(v5,{ref_:n},n.fullPath))})}function w5(e){return e.trimStart().startsWith("Base directory for this skill:")}function b5(e){const n=e.trim().replace(/\/SKILL\.md$/i,"").split("/").filter(Boolean);return n[n.length-1]??"skill"}function _5(e){const t=e.split(`
|
|
92
|
+
`);if(t[0]?.trim()!=="---")return{entries:[],rest:e};const n=[];let r=-1;for(let i=1;i<t.length;i++){if(t[i].trim()==="---"){r=i;break}const o=t[i].indexOf(":");if(o!==-1){const a=t[i].slice(0,o).trim(),l=t[i].slice(o+1).trim();a&&n.push({key:a,value:l})}}if(r===-1)return{entries:[],rest:e};const s=t.slice(r+1).join(`
|
|
93
|
+
`);return{entries:n,rest:s}}function S5(e){const t=e.trimStart().split(`
|
|
94
|
+
`),s=(t[0]??"").match(/Base directory for this skill:\s*(.+)/)?.[1]??"",i=b5(s),o=t.slice(1).join(`
|
|
95
|
+
`).trimStart(),{entries:a,rest:l}=_5(o),u=a.find(f=>f.key==="name")?.value??null,c=a.find(f=>f.key==="description")?.value??null;return{name:u??i,description:c,frontmatter:a,body:l.trimStart()}}const k5={UserMessage:tl,AssistantMessage:Cr,SystemMessage:Cr};function C5({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"skill-body",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(_t.Root,{className:"skill-body-thread",children:d.jsx(_t.Viewport,{className:"skill-body-viewport",children:d.jsx(_t.Messages,{components:k5})})})})}function E5({parsed:e,onClose:t}){return m.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),d.jsx("div",{className:"modal-backdrop",onClick:n=>{n.target===n.currentTarget&&t()},children:d.jsxs("div",{className:"modal modal-skill",role:"dialog","aria-modal":"true","aria-label":`Skill: ${e.name}`,children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("span",{className:"modal-title modal-title-skill",children:["🧩 Skill: ",e.name]}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close skill detail",onClick:t,children:"✕"})]}),d.jsxs("div",{className:"modal-body skill-modal-body",children:[e.frontmatter.length>0&&d.jsx("dl",{className:"skill-fm",children:e.frontmatter.map(({key:n,value:r})=>d.jsxs("div",{className:"skill-fm-row",children:[d.jsx("dt",{className:"skill-fm-key",children:n}),d.jsx("dd",{className:"skill-fm-val",children:r})]},n))}),e.body.length>0&&d.jsx("div",{className:"skill-body-wrap",children:d.jsx(C5,{markdown:e.body})})]})]})})}function T5({text:e}){const[t,n]=m.useState(!1),r=m.useMemo(()=>S5(e),[e]);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"skill-chip",onClick:()=>n(!0),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),n(!0))},title:r.description??`Skill: ${r.name}`,children:[d.jsx("span",{className:"skill-chip-icon","aria-hidden":"true",children:"🧩"}),d.jsx("span",{className:"skill-chip-name",children:r.name}),d.jsx("span",{className:"skill-chip-tag",children:"skill"})]}),t&&d.jsx(E5,{parsed:r,onClose:()=>n(!1)})]})}const tC=m.createContext("claude");function I5(){return m.useContext(tC)}const R5=/^\s*working…?\s*$/i,P5=e=>{const t=I5();return typeof e.text=="string"&&R5.test(e.text)?d.jsxs("span",{className:"working-indicator",role:"status","aria-live":"polite",children:[d.jsx("span",{className:"working-claude","aria-hidden":"true",children:t==="codex"?d.jsx(Ok,{size:14}):d.jsx(cm,{size:14})}),d.jsx("span",{className:"shimmer-text",children:"Working…"})]}):typeof e.text=="string"&&w5(e.text)?d.jsx(T5,{text:e.text}):d.jsxs(d.Fragment,{children:[d.jsx(p5,{...e}),typeof e.text=="string"?d.jsx(x5,{text:e.text}):null]})},xx=90;function j5(e){const t=e.split(`
|
|
96
|
+
`);for(let n=t.length-1;n>=0;n--){const r=t[n].trim();if(r)return r.length>xx?r.slice(0,xx-1)+"…":r}return""}function A5(e){const t=LS(e);if(t==null||typeof t=="object"&&Object.keys(t).length===0)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}const N5=({toolCallId:e,toolName:t,args:n,result:r})=>{const{open:s}=Mm(),[i,o]=m.useState(!1),a=YM(n),l=A5(n),u=QM(r),c=l.length>0||u!=null,f=LS(n),h=f&&typeof f=="object"&&"file_path"in f?String(f.file_path):void 0,p=h&&h.includes(".")?h.split(".").pop():void 0,g=u?.text??l,y=g.length>0,b=()=>{y&&s({id:e,kind:"tool",title:t+(a?` — ${a}`:""),language:p,content:g,filePath:h})},x=y?d.jsx("button",{type:"button",className:"tool-name tool-name-btn",onClick:b,title:"Open in side panel",children:t}):d.jsx("span",{className:"tool-name",children:t}),v=d.jsxs("span",{className:"tool-head",children:[c?d.jsx("button",{type:"button",className:"tool-arrow-btn","aria-expanded":i,"aria-label":i?"Collapse":"Expand",onClick:()=>o(w=>!w),children:d.jsx("span",{className:"tool-arrow","data-peek":i?"true":"false","aria-hidden":"true",children:"▸"})}):d.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),x,a?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input",children:a})]}):null]});return d.jsxs("div",{className:"block-tool",children:[d.jsx("div",{className:"block-tool-use",children:v}),c&&i?d.jsxs("div",{className:"block-tool-body",children:[l?d.jsx("pre",{className:"block-tool-args",children:l}):null,u!=null?d.jsx("div",{className:"block-tool-result","data-error":u.isError?"true":"false",children:u.text}):null]}):null]})},nC=m.createContext(null);function M5(){return m.useContext(nC)}function D5(){return d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function L5(){return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M5 12l5 5L19 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function rC(){return d.jsx(My.Root,{className:"msg-actions",children:d.jsxs(My.Copy,{className:"act-btn","aria-label":"Copy message",children:[d.jsxs("span",{className:"act-copy-idle",children:[d.jsx(D5,{})," copy"]}),d.jsxs("span",{className:"act-copy-done",children:[d.jsx(L5,{})," copied"]})]})})}const O5=new Set(["AskUserQuestion","ExitPlanMode"]);function z5(e){const t=[],n=[];function r(){if(n.length===0)return;if(n.filter(i=>e[i].type==="reasoning"||e[i].type==="tool-call").length>=2)t.push({groupKey:"group-thought",indices:[...n]});else for(const i of n)t.push({groupKey:void 0,indices:[i]});n.length=0}for(let s=0;s<e.length;s+=1){const i=e[s];i.type==="text"||i.type==="tool-call"&&i.toolName!==void 0&&O5.has(i.toolName)?(r(),t.push({groupKey:void 0,indices:[s]})):n.push(s)}return r(),t}function F5({text:e}){return!e||!e.trim()?null:d.jsx("div",{className:"cot-reasoning thinking-text",children:e})}const sC={Text:P5,Reasoning:F5,tools:{Fallback:N5}};function B5({indices:e,children:t}){const n=Nu(y=>y.id),r=M5(),s=!!r&&n===r,[i,o]=m.useState(!1),a=s||i,l=Nu(y=>y.content);let u=0,c=0,f="";for(const y of e){const b=l[y];b&&(b.type==="reasoning"?(u+=1,b.text?.trim()&&(f=b.text)):b.type==="tool-call"&&(c+=1))}const h=u+c,p=u>0?"chain of thought":`${c} tool call${c===1?"":"s"}`,g=j5(f);return d.jsxs("details",{className:"block-cot","data-thinking":s?"true":void 0,open:a,onToggle:y=>o(y.currentTarget.open),children:[d.jsxs("summary",{children:[d.jsx("span",{className:"cot-label",children:s?"thinking":p}),u>0?d.jsxs("span",{className:"cot-steps",children:["· ",h," step",h===1?"":"s"]}):null,g?d.jsx("span",{className:"cot-last",children:s?d.jsx(Uk,{text:g}):g}):null]}),a?d.jsx("div",{className:"cot-body",children:t}):null]})}function $5(){return d.jsx(Du.Unstable_PartsGrouped,{groupingFunction:z5,components:{...sC,Group:({groupKey:e,indices:t,children:n})=>e?d.jsx(B5,{indices:t,children:n}):d.jsx(d.Fragment,{children:n})}})}function tl(){return d.jsxs(Du.Root,{className:"msg-row","data-role":"user",children:[d.jsx("div",{className:"msg-body",children:d.jsx(Du.Parts,{components:sC})}),d.jsx(rC,{})]})}function Cr(){const e=Nu(n=>n.metadata?.custom?.cockpitRole)??"assistant",t=Nu(n=>n.metadata?.custom?.working);return d.jsxs(Du.Root,{className:"msg-row","data-role":e,children:[d.jsx("div",{className:"msg-body",children:d.jsx($5,{})}),!t&&d.jsx(rC,{})]})}function rs({children:e}){return d.jsx("kbd",{className:"kbd",children:e})}const wx=1.8;function U5(e){if(e.backend==="mlx"){const t=(e.model||"").replace(/^mlx-community\//,"").replace(/-Instruct-4bit$/i,"").replace(/-4bit$/i,"");return t?`MLX · ${t}`:"MLX"}return e.backend==="claude"?"claude -p":e.backend==="rules"?"rules":e.mode==="llm"?"llm":"rules"}function V5(e,t){const n=e.split(`
|
|
97
|
+
`),r=t.split(`
|
|
98
|
+
`),s=new Set(n),i=new Set(r),o=[];let a=0,l=0;for(;a<n.length||l<r.length;){const u=n[a],c=r[l];a>=n.length?(o.push({kind:"add",text:c}),l++):l>=r.length?(o.push({kind:"del",text:u}),a++):u===c?(o.push({kind:"same",text:u}),a++,l++):!i.has(u)&&s.has(c)?(o.push({kind:"del",text:u}),o.push({kind:"add",text:c}),a++,l++):i.has(u)?s.has(c)?(o.push({kind:"same",text:u}),a++,l++):(o.push({kind:"add",text:c}),l++):(o.push({kind:"del",text:u}),a++)}return o}function H5({original:e,result:t,onSend:n,onAccept:r,onClose:s}){const{rootRef:i,requestClose:o}=mi(s),[a,l]=m.useState(t.optimized),u=m.useRef(null),[c,f]=m.useState(!0),h=m.useRef(a);h.current=a;const p=m.useRef(n);p.current=n;const g=()=>f(!1);m.useEffect(()=>{u.current?.focus({preventScroll:!0})},[]),m.useEffect(()=>{if(!c)return;const x=setTimeout(()=>p.current(h.current),wx*1e3);return()=>clearTimeout(x)},[c]),m.useEffect(()=>{const x=v=>{v.key==="Escape"?(v.preventDefault(),o()):v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),p.current(h.current))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[o]);const y=V5(e,t.optimized),b=y.some(x=>x.kind!=="same");return d.jsx("div",{className:"modal-backdrop",ref:i,onClick:x=>{x.target===x.currentTarget&&o()},children:d.jsxs("div",{className:"modal modal-optimize",role:"dialog","aria-modal":!0,"aria-label":"Review enhanced prompt",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-head-group",children:[d.jsx("span",{className:"modal-title modal-title-optimize",children:"Enhanced prompt"}),d.jsx("span",{className:"optimize-mode-badge","data-mode":t.mode,children:U5(t)})]}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:o,children:"✕"})]}),d.jsxs("div",{className:"modal-body",onScroll:g,onWheel:g,onTouchMove:g,children:[d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"Suggestion"}),d.jsx("textarea",{ref:u,className:"optimize-suggestion",value:a,onChange:x=>{l(x.target.value),g()},rows:6,spellCheck:!1,autoComplete:"off"})]}),b?d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"Changes vs original"}),d.jsx("div",{className:"optimize-diff",children:y.map((x,v)=>d.jsxs("div",{className:x.kind==="add"?"diff-add":x.kind==="del"?"diff-del":"diff-same",children:[x.kind==="add"?"+ ":x.kind==="del"?"- ":" ",x.text||" "]},v))})]}):null,t.rationale.length>0?d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"Rationale"}),d.jsx("ul",{className:"optimize-list",children:t.rationale.map((x,v)=>d.jsx("li",{children:x},v))})]}):null,t.changes.length>0?d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"What changed"}),d.jsx("ul",{className:"optimize-list",children:t.changes.map((x,v)=>d.jsx("li",{children:x},v))})]}):null]}),d.jsxs("div",{className:"modal-foot",children:[d.jsx("button",{type:"button",className:"btn-secondary",onClick:o,children:"Discard"}),d.jsx("span",{className:"modal-foot-spacer"}),d.jsx("button",{type:"button",className:"btn-secondary",onClick:()=>r(a),onMouseEnter:g,children:"To Composer"}),d.jsx("button",{type:"button",className:`btn-primary btn-send${c?" btn-send-armed":""}`,style:c?{"--auto-send-secs":`${wx}s`}:void 0,onClick:()=>n(a),children:d.jsxs("span",{className:"btn-send-label",children:["Send ",d.jsx(rs,{children:"⌘/Ctrl+↵"})]})})]})]})})}const bx="(max-width:760px)";function Dm(){const[e,t]=m.useState(()=>typeof window>"u"?!1:window.matchMedia(bx).matches);return m.useEffect(()=>{if(typeof window>"u")return;const n=window.matchMedia(bx),r=s=>t(s.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}function W5({onPick:e,onClose:t,sessionId:n}){const{rootRef:r,requestClose:s}=mi(t),i=Dm(),[o,a]=m.useState([]),[l,u]=m.useState(!0),[c,f]=m.useState(""),h=m.useRef(null);m.useEffect(()=>{let b=!0;return u(!0),DS(n).then(x=>{b&&(a(x),u(!1))}).catch(()=>{b&&u(!1)}),()=>{b=!1}},[]),m.useEffect(()=>{requestAnimationFrame(()=>h.current?.focus())},[]),m.useEffect(()=>{const b=x=>{x.key==="Escape"&&(x.preventDefault(),s())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[s]);const p=c.trim().toLowerCase(),g=p?o.filter(b=>b.name.toLowerCase().includes(p)||b.description.toLowerCase().includes(p)):o,y=d.jsxs("div",{className:"skill-browser","data-mode":i?"sheet":"modal",role:"dialog","aria-modal":"true","aria-label":"Skill browser",children:[d.jsxs("div",{className:"skill-browser-head",children:[d.jsx("span",{className:"skill-browser-title",children:"Skills"}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close skill browser",onClick:s,children:"✕"})]}),d.jsx("div",{className:"skill-browser-search",children:d.jsx("input",{ref:h,type:"search",className:"skill-search-input",placeholder:"Search skills…",value:c,onChange:b=>f(b.currentTarget.value),"aria-label":"Search skills",autoComplete:"off",spellCheck:!1})}),d.jsx("div",{className:"skill-browser-list",role:"list",children:l?d.jsx("div",{className:"skill-browser-empty",children:"Loading…"}):g.length===0?d.jsx("div",{className:"skill-browser-empty",children:p?"No skills match your search.":"No skills found."}):g.map(b=>d.jsxs("button",{type:"button",className:"skill-card",role:"listitem",onClick:()=>e(b.name),title:`Prefill /${b.name}`,children:[d.jsxs("span",{className:"tool-head",children:[d.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),d.jsx("span",{className:"tool-name skill-card-name",children:b.name}),b.description?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input skill-card-desc",children:b.description})]}):null]}),b.source!=="user"?d.jsx("span",{className:"skill-source-tag",children:b.source}):null]},b.name))})]});return i?d.jsx("div",{className:"skill-browser-sheet-wrap",children:y}):d.jsx("div",{className:"modal-backdrop",ref:r,onClick:b=>{b.target===b.currentTarget&&s()},children:y})}function q5(){if(typeof window>"u")return null;const e=window;return e.AudioContext??e.webkitAudioContext??null}function K5(){const e=typeof window<"u"?window.MediaRecorder:void 0,t=[{mime:"audio/webm;codecs=opus",ext:"webm"},{mime:"audio/webm",ext:"webm"},{mime:"audio/mp4",ext:"mp4"},{mime:"audio/aac",ext:"aac"},{mime:"audio/ogg;codecs=opus",ext:"ogg"}];if(e&&typeof e.isTypeSupported=="function"){for(const n of t)if(e.isTypeSupported(n.mime))return n}return{mime:"",ext:"webm"}}function G5({onCommit:e,onClose:t,active:n}){const[r,s]=m.useState("starting"),[i,o]=m.useState(null),a=m.useRef(null),l=m.useRef(null),u=m.useRef(null),c=m.useRef(null),f=m.useRef([]),h=m.useRef({mime:"",ext:"webm"}),p=m.useRef(null),g=m.useRef(null),y=m.useRef(!1),b=m.useRef(!1),x=m.useRef(!0),v=m.useRef(null),w=m.useCallback(()=>{y.current=!1,g.current!=null&&cancelAnimationFrame(g.current),g.current=null},[]),k=m.useCallback(()=>{const R=p.current,C=u.current;if(!R||!C)return;const M=R.getContext("2d");if(!M)return;const D=new Uint8Array(C.fftSize),U=getComputedStyle(R).getPropertyValue("--accent").trim()||"#7aa2f7";y.current=!0;const V=()=>{if(!y.current)return;R.width!==R.clientWidth&&(R.width=R.clientWidth),C.getByteTimeDomainData(D);const W=R.width,J=R.height;M.clearRect(0,0,W,J),M.lineWidth=2,M.strokeStyle=U,M.beginPath();const ne=W/D.length;for(let $=0;$<D.length;$+=1){const E=D[$]/128*J/2,X=$*ne;$===0?M.moveTo(X,E):M.lineTo(X,E)}M.stroke(),g.current=requestAnimationFrame(V)};g.current=requestAnimationFrame(V)},[]),_=m.useCallback(()=>{w(),a.current?.getTracks().forEach(R=>R.stop()),a.current=null,l.current?.close().catch(()=>{}),l.current=null,u.current=null},[w]);m.useEffect(()=>(x.current=!0,()=>{x.current=!1,v.current?.abort(),v.current=null}),[]),m.useEffect(()=>{if(!n){b.current=!1,f.current=[],s("starting"),o(null);return}let R=!1;return b.current=!1,f.current=[],(async()=>{try{if(!navigator.mediaDevices?.getUserMedia)throw new Error("no-getusermedia");const C=await navigator.mediaDevices.getUserMedia({audio:!0});if(R){C.getTracks().forEach(V=>V.stop());return}a.current=C;const M=q5();if(M){const V=new M;l.current=V,V.state==="suspended"&&await V.resume();const W=V.createMediaStreamSource(C),J=V.createAnalyser();J.fftSize=512,W.connect(J),u.current=J}if(!("MediaRecorder"in window))throw new Error("no-mediarecorder");const D=K5();h.current=D;const U=D.mime?new MediaRecorder(C,{mimeType:D.mime}):new MediaRecorder(C);U.ondataavailable=V=>{V.data&&V.data.size>0&&f.current.push(V.data)},c.current=U,U.start(),s("recording"),k()}catch(C){const M=C instanceof Error?C.message:"",D=C instanceof Error?C.name:"";let U;M==="no-mediarecorder"?U="Audio recording isn't supported in this browser.":!window.isSecureContext||!navigator.mediaDevices?.getUserMedia?U="Microphone needs a secure (HTTPS) connection. You're on "+location.origin+" — serve over HTTPS (e.g. `tailscale serve --bg 4317`) so the browser allows the mic.":D==="NotAllowedError"||D==="SecurityError"?U='Microphone blocked. On iPhone/iPad: reset it in Settings → Apps → Safari → Microphone (or the "aA" → Website Settings menu), then reload. Add this app to your Home Screen so the permission persists across reloads.':D==="NotFoundError"||D==="NotReadableError"?U="No microphone available (or it's in use by another app).":U="Microphone permission denied or unavailable.",o(U),s("error")}})(),()=>{R=!0,v.current?.abort(),v.current=null,w();try{c.current?.stop()}catch{}c.current=null,a.current?.getTracks().forEach(C=>C.stop()),a.current=null,l.current?.close().catch(()=>{}),l.current=null,u.current=null}},[n]);const S=m.useCallback(()=>{if(r==="recording"){try{c.current?.pause()}catch{}w(),s("paused")}else if(r==="paused"){try{c.current?.resume()}catch{}s("recording"),k()}},[r,w,k]),T=m.useCallback(()=>{if(b.current)return;b.current=!0;const R=c.current;if(!R){_(),e("");return}s("transcribing"),R.onstop=async()=>{const{mime:C,ext:M}=h.current,D=new Blob(f.current,{type:C||"audio/webm"});if(_(),D.size===0){e("");return}const U=new AbortController;v.current=U;try{const V=await EM(D,M,U.signal);x.current&&!U.signal.aborted&&e(V)}catch(V){if(V?.name==="AbortError")return;x.current&&!U.signal.aborted&&(o(V instanceof Error?V.message:"Transcription failed."),s("error"))}};try{R.stop()}catch{_(),e("")}},[_,e]),P=m.useCallback(()=>{b.current=!0,v.current?.abort(),v.current=null;const R=c.current;R&&(R.onstop=null);try{R?.stop()}catch{}c.current=null,_(),t()},[_,t]);return{status:r,errorMsg:i,canvasRef:p,pauseResume:S,stop:T,cancel:P}}const Ch=["#414868","#f7768e","#9ece6a","#e0af68","#7aa2f7","#bb9af7","#7dcfff","#a9b1d6"],Eh=["#565f89","#ff7a93","#b9f27c","#ff9e64","#9bb5ff","#c7a9ff","#a4daff","#c0caf5"];function Y5(e){if(e<8)return Ch[e];if(e<16)return Eh[e-8];if(e>=232){const o=8+(e-232)*10;return`rgb(${o},${o},${o})`}const t=e-16,n=Math.floor(t/36),r=Math.floor(t%36/6),s=t%6,i=o=>o===0?0:o*40+55;return`rgb(${i(n)},${i(r)},${i(s)})`}function Q5(e,t){for(let n=0;n<t.length;n+=1){const r=t[n];if(r===0)e.fg=void 0,e.bg=void 0,e.bold=!1,e.dim=!1,e.italic=!1,e.underline=!1;else if(r===1)e.bold=!0;else if(r===2)e.dim=!0;else if(r===3)e.italic=!0;else if(r===4)e.underline=!0;else if(r===22)e.bold=!1,e.dim=!1;else if(r===23)e.italic=!1;else if(r===24)e.underline=!1;else if(r>=30&&r<=37)e.fg=Ch[r-30];else if(r===39)e.fg=void 0;else if(r>=90&&r<=97)e.fg=Eh[r-90];else if(r>=40&&r<=47)e.bg=Ch[r-40];else if(r===49)e.bg=void 0;else if(r>=100&&r<=107)e.bg=Eh[r-100];else if(r===38||r===48){const s=r===38?"fg":"bg";t[n+1]===5?(e[s]=Y5(t[n+2]??0),n+=2):t[n+1]===2&&(e[s]=`rgb(${t[n+2]??0},${t[n+3]??0},${t[n+4]??0})`,n+=4)}}}const Ud=/\x1b\[([0-9;]*)m/g,X5=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,J5=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b[@-Z\\-_]/g,Z5=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function e$(e){const t=String(e).split(`
|
|
99
|
+
`);for(;t.length&&t[t.length-1].replace(Z5,"").trim()==="";)t.pop();return t.join(`
|
|
100
|
+
`)}function t$(e){return e.replace(J5,"")}function n$(e){const t=String(e).replace(X5,""),n=[],r={};let s=0,i;Ud.lastIndex=0;const o=a=>{const l=t$(a);l&&n.push({text:l,...r})};for(;(i=Ud.exec(t))!==null;){i.index>s&&o(t.slice(s,i.index));const a=(i[1]===""?"0":i[1]).split(";").map(l=>Number(l)||0);Q5(r,a),s=Ud.lastIndex}return s<t.length&&o(t.slice(s)),n}const _x=/(https?:\/\/[^\s'"`<>()\][]+)/g;function r$(e){const t=[];let n=0,r;for(_x.lastIndex=0;(r=_x.exec(e))!==null;){let s=r[0],i="";const o=s.match(/[.,;:!?]+$/);o&&(i=o[0],s=s.slice(0,-i.length)),r.index>n&&t.push({text:e.slice(n,r.index)}),t.push({text:s,href:s}),i&&t.push({text:i}),n=r.index+r[0].length}return n<e.length&&t.push({text:e.slice(n)}),t.length?t:[{text:e}]}const Sx=400,s$=800,i$=[{label:"↑",key:"Up",title:"Up"},{label:"↓",key:"Down",title:"Down"},{label:"←",key:"Left",title:"Left"},{label:"→",key:"Right",title:"Right"},"gap",{label:"Tab",key:"Tab",title:"Tab"},{label:"Esc",key:"Escape",title:"Escape"},"gap",{label:"^C",key:"C-c",title:"Interrupt (Ctrl-C)"},{label:"^D",key:"C-d",title:"EOF (Ctrl-D)"},{label:"^R",key:"C-r",title:"Reverse search (Ctrl-R)"},{label:"^Z",key:"C-z",title:"Suspend (Ctrl-Z)"},{label:"^L",key:"C-l",title:"Clear (Ctrl-L)"},"gap",{label:"Home",key:"Home",title:"Home"},{label:"End",key:"End",title:"End"},{label:"PgUp",key:"PPage",title:"Page Up"},{label:"PgDn",key:"NPage",title:"Page Down"}];function iC({output:e,requestCapture:t,clearOutput:n,sendKey:r,mods:s,onToggleMod:i}){const o=m.useRef(null),a=m.useRef(!0);m.useEffect(()=>{t(Sx);const c=setInterval(()=>t(Sx),s$);return()=>{clearInterval(c),n()}},[t,n]),m.useLayoutEffect(()=>{const c=o.current;c&&a.current&&(c.scrollTop=c.scrollHeight)},[e]);const l=()=>{const c=o.current;c&&(a.current=c.scrollHeight-c.scrollTop-c.clientHeight<24)},u=m.useMemo(()=>e==null?null:n$(e$(e)).map((c,f)=>{const h={color:c.fg,background:c.bg,fontWeight:c.bold?700:void 0,fontStyle:c.italic?"italic":void 0,textDecoration:c.underline?"underline":void 0,opacity:c.dim?.7:void 0};return d.jsx("span",{style:h,children:r$(c.text).map((p,g)=>p.href?d.jsx("a",{href:p.href,target:"_blank",rel:"noopener noreferrer",children:p.text},g):p.text)},f)}),[e]);return d.jsxs("div",{className:"terminal-view",children:[d.jsxs("div",{className:"terminal-view-head",children:[d.jsx("span",{className:"terminal-view-title",children:"terminal · cc-shell"}),d.jsx("button",{type:"button",className:"terminal-view-btn",onClick:()=>r("C-c"),title:"Interrupt (Ctrl-C)",children:"Stop"})]}),d.jsx("pre",{className:"terminal-view-body",ref:o,onScroll:l,children:u??d.jsxs("span",{className:"terminal-loading",children:[d.jsx("span",{className:"terminal-loading-spinner","aria-hidden":"true"}),"starting shell…"]})}),d.jsxs("div",{className:"terminal-key-bar",role:"toolbar","aria-label":"Terminal keys",children:[d.jsx("button",{type:"button",className:"terminal-key terminal-key-mod","aria-pressed":s.ctrl,"data-on":s.ctrl?"true":void 0,title:"Sticky Ctrl — applies to the next key",onMouseDown:c=>c.preventDefault(),onClick:()=>i("ctrl"),children:"Ctrl"}),d.jsx("button",{type:"button",className:"terminal-key terminal-key-mod","aria-pressed":s.alt,"data-on":s.alt?"true":void 0,title:"Sticky Opt/Meta — applies to the next key",onMouseDown:c=>c.preventDefault(),onClick:()=>i("alt"),children:"Opt"}),d.jsx("span",{className:"terminal-key-gap","aria-hidden":"true"}),i$.map((c,f)=>c==="gap"?d.jsx("span",{className:"terminal-key-gap","aria-hidden":"true"},`gap-${f}`):d.jsx("button",{type:"button",className:"terminal-key",title:c.title,"aria-label":c.title,onMouseDown:h=>h.preventDefault(),onClick:()=>r(c.key),children:c.label},c.key))]})]})}const o$={output:null,run:()=>!1,text:()=>!1,key:()=>!1,poll:()=>!1,clear:()=>{}},oC=m.createContext(o$),a$=()=>m.useContext(oC);function aC(e,t){if(e===t)return{removed:0,added:""};let n=0;const r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n+=1;let s=0;const i=Math.min(e.length-n,t.length-n);for(;s<i&&e[e.length-1-s]===t[t.length-1-s];)s+=1;return{removed:e.length-n-s,added:t.slice(n,t.length-s)}}const Ua=e=>/^[a-z]$/i.test(e);function Xu(e,t){return Ua(t)?e.ctrl?`C-${t.toLowerCase()}`:e.alt?`M-${t.toLowerCase()}`:null:null}const l$={Enter:"Enter",Escape:"Escape"};function lC(e,t=!1){return e==="Tab"?t?"BTab":"Tab":l$[e]??null}const u$={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Home:"Home",End:"End",PageUp:"PPage",PageDown:"NPage"};function uC(e,t){const n=u$[e];return n?`${t.ctrl?"C-":""}${t.alt?"M-":""}${t.shift?"S-":""}`+n:null}function c$(e,t){if(t<1)return null;let n=t-1;for(;n>=0&&/[A-Za-z0-9:_-]/.test(e[n]);)n-=1;const r=n;if(r<0)return null;const s=e[r];return s!=="/"&&s!=="@"||r>0&&!/\s/.test(e[r-1])?null:{trigger:s,query:e.slice(r+1,t),start:r,end:t}}const Ju=new Map,Al=new Map;function d$(e){const t=e??"",n=Ju.get(t);if(n)return Promise.resolve(n);const r=Al.get(t);if(r)return r;const s=DS(e).then(i=>(Ju.set(t,i),Al.delete(t),i)).catch(()=>(Al.delete(t),[]));return Al.set(t,s),s}const Zu=new Map,Nl=new Map;function f$(e){const t=e??"",n=Zu.get(t);if(n)return Promise.resolve(n);const r=Nl.get(t);if(r)return r;const s=NM(e).then(i=>(Zu.set(t,i),Nl.delete(t),i)).catch(()=>(Nl.delete(t),[]));return Nl.set(t,s),s}const h$=/^\/([A-Za-z0-9:_-]+)\s/,p$=4;function m$({file:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!1);return m.useEffect(()=>{const i=URL.createObjectURL(e);return n(i),()=>URL.revokeObjectURL(i)},[e]),t?d.jsxs(d.Fragment,{children:[d.jsx("img",{className:"chip-thumb",src:t,alt:"",role:"button",tabIndex:0,title:"Open preview",onClick:()=>s(!0),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s(!0))}}),r?d.jsx(eC,{src:t,alt:e.name,onClose:()=>s(!1)}):null]}):d.jsx("div",{className:"chip-thumb chip-thumb-empty"})}function g$({attachment:e}){const t=e.type==="image",n=e.status.type==="running";return d.jsxs(Dy.Root,{className:"attach-chip","data-pending":n,children:[t&&e.file?d.jsx(m$,{file:e.file}):d.jsx("span",{className:"chip-icon","aria-hidden":"true",children:e.type==="document"?"📄":"📎"}),d.jsx("span",{className:"chip-name",title:e.name,children:e.name}),n?d.jsx("span",{className:"chip-spinner","aria-hidden":"true"}):null,d.jsx(Dy.Remove,{className:"chip-remove","aria-label":`Remove ${e.name}`,children:"×"})]})}const kx={optimizing:!1,review:null};function cC({disabled:e,sessionId:t,subAgentMode:n=!0,onSubAgentModeChange:r,onTerminalModeChange:s,working:i=!1,onStop:o}){const a=j0(),l=a$(),[u,c]=m.useState(!0),[f,h]=m.useState(!1),[p,g]=m.useState(!1),[y,b]=m.useState(!1),x=m.useRef(null),v=m.useCallback(()=>{b(!0),g(!0),s?.(!0)},[s]);m.useEffect(()=>{g(!1),b(!1),s?.(!1)},[t]),m.useEffect(()=>{const j=x.current;if(j)if(p){if(j.style.display="",Jt()){ce.set(j,{opacity:1,scale:1,y:0});return}ce.fromTo(j,{opacity:0,scale:.95,y:8},{opacity:1,scale:1,y:0,duration:.26,ease:"power3.out",transformOrigin:"bottom center"})}else Jt()?j.style.display="none":ce.to(j,{opacity:0,scale:.95,y:8,duration:.18,ease:"power2.in",transformOrigin:"bottom center",onComplete:()=>{j.style.display="none"}})},[p,y]);const[w,k]=m.useState({}),_=t??"",{optimizing:S,review:T}=w[_]??kx,P=m.useCallback((j,B)=>{k(re=>({...re,[j]:{...re[j]??kx,...B}}))},[]),R=m.useCallback(()=>{requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()})},[]),C=m.useRef(null);m.useEffect(()=>{const j=C.current;if(j){if(S&&!Jt()){const B=ce.to(j,{scale:1.08,duration:.5,ease:"sine.inOut",repeat:-1,yoyo:!0});return()=>{B.kill(),ce.set(j,{scale:1})}}ce.set(j,{scale:1})}},[S]);const[M,D]=m.useState(()=>Ju.get(t??"")??[]),[U,V]=m.useState(()=>Zu.get(t??"")??[]),[W,J]=m.useState(""),[ne,$]=m.useState(0),[F,E]=m.useState(0),[X,Z]=m.useState(!1);m.useEffect(()=>{let j=!0;const B=Ju.get(t??"");return B?D(B):d$(t).then(re=>{j&&D(re)}).catch(()=>{j&&D([])}),()=>{j=!1}},[t]),m.useEffect(()=>{let j=!0;const B=Zu.get(t??"");return B?V(B):f$(t).then(re=>{j&&V(re)}).catch(()=>{j&&V([])}),()=>{j=!1}},[t]),m.useEffect(()=>{const j=()=>{const B=a.getState().text??"";J(B),c(!B.trim());const re=document.querySelector(".composer-input");re&&$(re.selectionStart??B.length)};return j(),a.subscribe(j)},[a]);const I=m.useCallback(j=>{j&&$(j.selectionStart??0)},[]),O=m.useMemo(()=>c$(W,ne),[W,ne]),te=O?O.query:null;m.useEffect(()=>{E(0),Z(!1)},[te]);const de=m.useMemo(()=>{if(te==null||X)return[];const j=te.toLowerCase();return(O?.trigger==="@"?U:M).filter(re=>re.name.toLowerCase().includes(j)).sort((re,ge)=>{const Te=re.name.toLowerCase().startsWith(j)?0:1,Le=ge.name.toLowerCase().startsWith(j)?0:1;return Te!==Le?Te-Le:re.name.localeCompare(ge.name)}).slice(0,p$)},[te,X,O?.trigger,M,U]),it=!p&&de.length>0,Ke=m.useMemo(()=>{const j=h$.exec(W);return j&&M.some(B=>B.name===j[1])?j[1]:null},[W,M]),je=m.useCallback(j=>{const B=O,re=(B?.trigger==="@"?"@":"/")+j+" ";if(B){const ge=a.getState().text??"",Te=ge.slice(0,B.start)+re+ge.slice(B.end);a.setText(Te);const Le=B.start+re.length;requestAnimationFrame(()=>{const Re=document.querySelector(".composer-input");Re&&(Re.focus(),Re.setSelectionRange(Le,Le),$(Le))})}else a.setText(re),requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()});Z(!0)},[a,O]),[xe,oe]=m.useState(!1),le=m.useRef(null),se=m.useRef(null),we=m.useRef(null),He=m.useRef(!1),Ge=m.useRef(!1),Et=m.useCallback(()=>{e||oe(!0)},[e]),qn=m.useCallback(()=>{const j=le.current;j&&(j.style.height=j.offsetHeight+"px"),oe(!1)},[]),Tr=96,ue={fade:.11,height:.12,btnStagger:.02,topStagger:.017,gap:.045,enterEase:Dr.enterEase,exitEase:Dr.exitEase};m.useLayoutEffect(()=>{const j=le.current;if(j&&!(!xe&&!Ge.current))if(xe&&(Ge.current=!0),se.current?.kill(),se.current=null,xe){const B=we.current,re=j.querySelector(".composer-toolbar:not(.voice-toolbar)"),ge=j.querySelector(".composer-input-wrap");if(Jt()){B&&(B.style.display="flex"),ge&&ce.set(ge,{display:"none"});return}const Te=j.offsetHeight;j.style.height=`${Te}px`,B&&(B.style.display="flex"),B&&B.querySelectorAll("*").forEach(Gt=>{Gt.style.position&&(Gt.style.position=""),Gt.style.visibility&&(Gt.style.visibility="")}),ge&&(ge.style.position="absolute",ge.style.visibility="hidden"),re&&(re.style.position="absolute",re.style.visibility="hidden"),j.style.height="";const Le=j.offsetHeight,Re=Math.max(Le,Tr);j.style.height=`${Te}px`,ge&&(ge.style.position="",ge.style.visibility=""),re&&(re.style.position="",re.style.visibility=""),j.offsetHeight;const ye=j.querySelector(".voice-status"),fn=j.querySelector(".voice-wave-inline"),Yr=j.querySelector(".voice-hint, .voice-error"),zt=j.querySelector(".voice-toolbar"),ve=zt?Array.from(zt.querySelectorAll('button, [role="button"]')):[];ge&&ce.set(ge,{clearProps:"display,position,visibility",opacity:1,y:0});const gt=[ye,fn,Yr].filter(Boolean);gt.length&&ce.set(gt,{opacity:0,y:-16}),zt&&ce.set(zt,{clearProps:"opacity,y"}),ve.length&&ce.set(ve,{opacity:0,y:12});const qt=re?Array.from(re.querySelectorAll('button, label, [role="button"]')):[],An=()=>{const Gt=j.querySelector(".voice-btn-cancel"),Nn=j.querySelector(".voice-btn-stop"),ko=j.querySelector(".voice-btn-pause"),ur=[Gt,Nn,ko].filter(Rr=>Rr!==null);ur.forEach(Rr=>{const As=parseFloat(Rr.style.opacity);(Rr.style.opacity===""||isNaN(As)||As>0)&&ce.set(Rr,{opacity:0,y:12})});const vi=ce.timeline({onComplete:()=>{He.current=!0}});if(gt.length&&vi.to(gt,{opacity:1,y:0,duration:ue.fade,ease:ue.enterEase,stagger:ue.topStagger},0),ur.length){const Rr=gt.length?ue.fade+ue.topStagger*(gt.length-1):0,As=gt.length?Rr*.5:0;vi.to(ur,{opacity:1,y:0,duration:ue.fade,ease:ue.enterEase,stagger:ue.btnStagger},As)}else zt&&vi.to(zt,{opacity:1,y:0,duration:ue.fade,ease:ue.enterEase},gt.length?ue.topStagger*gt.length:0);se.current=vi},hn=()=>{j.style.overflow="hidden",j.offsetHeight;const Gt=ce.timeline({onComplete:()=>{j.style.height="",j.style.overflow="",ge&&ce.set(ge,{display:"none"}),re&&ce.set(re,{clearProps:"opacity,y"}),ce.delayedCall(ue.gap,An)}});Gt.to(j,{height:Re,duration:ue.height,ease:ue.exitEase},0),se.current=Gt},Kt=ce.timeline({onComplete:hn});qt.length?Kt.to(qt,{opacity:0,y:4,duration:ue.fade,ease:ue.exitEase,stagger:ue.btnStagger},0):re&&Kt.to(re,{opacity:0,y:4,duration:ue.fade,ease:ue.exitEase},0),ge&&Kt.to(ge,{opacity:0,y:6,duration:ue.fade,ease:ue.exitEase},0),se.current=Kt}else{He.current=!1;const B=we.current,re=j.querySelector(".voice-toolbar"),ge=j.querySelector(".voice-status"),Te=j.querySelector(".voice-wave-inline"),Le=j.querySelector(".voice-hint, .voice-error"),Re=j.querySelector(".composer-toolbar:not(.voice-toolbar)"),ye=j.querySelector(".composer-input-wrap");if(Jt()){B&&(B.style.display="none"),ye&&ce.set(ye,{clearProps:"all"}),Re&&ce.set(Re,{clearProps:"all"}),requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()});return}const fn=j.offsetHeight;j.style.height="",ye&&(ye.style.display="",ye.style.opacity="0"),B&&(B.style.position="absolute",B.style.visibility="hidden");const Yr=j.offsetHeight,zt=Math.max(Yr,Tr);B&&(B.style.position="",B.style.visibility=""),ye&&(ye.style.display="none",ye.style.opacity=""),j.style.height=`${fn}px`,j.style.overflow="hidden",ye&&ce.set(ye,{display:"",opacity:0,y:6}),Re&&ce.set(Re,{opacity:0,y:4});const ve=Re?Array.from(Re.querySelectorAll('button, label, [role="button"]')):[];ve.length&&ce.set(ve,{opacity:0,y:4}),j.offsetHeight;const gt=[ge,Te,Le].filter(Boolean),qt=re?Array.from(re.querySelectorAll('button, [role="button"]')):[],An=()=>{B&&(B.style.display="none"),j.style.height=`${fn}px`,j.style.overflow="";const Nn=ce.timeline({onComplete:()=>{j.style.height="",ye&&ce.set(ye,{clearProps:"all"}),Re&&ce.set(Re,{clearProps:"all"}),ve.length&&ce.set(ve,{clearProps:"all"}),document.querySelector(".composer-input")?.focus()}});if(Nn.to(j,{height:zt,duration:ue.fade,ease:ue.enterEase},0),ye&&Nn.to(ye,{opacity:1,y:0,duration:ue.fade,ease:ue.enterEase},0),ve.length){const ko=ye?ue.fade*.4:0;Nn.to(ve,{opacity:1,y:0,duration:ue.fade,ease:ue.enterEase,stagger:ue.btnStagger},ko)}else Re&&Nn.to(Re,{opacity:1,y:0,duration:ue.fade,ease:ue.enterEase},0);se.current=Nn},hn=ce.timeline({onComplete:()=>{ce.delayedCall(ue.gap,An)}});qt.length?hn.to(qt,{opacity:0,y:8,duration:ue.fade,ease:ue.exitEase,stagger:ue.btnStagger},0):re&&hn.to(re,{opacity:0,y:8,duration:ue.fade,ease:ue.exitEase},0);const Kt=qt.length?ue.fade+ue.btnStagger*(qt.length-1):0,Gt=qt.length?Kt*.5:0;gt.length?hn.to(gt,{opacity:0,y:-8,duration:ue.fade,ease:ue.exitEase,stagger:ue.topStagger},Gt):B&&hn.to(B,{opacity:0,y:-8,duration:ue.fade,ease:ue.exitEase},0),se.current=hn}},[xe]),m.useEffect(()=>()=>{se.current?.kill()},[]),m.useEffect(()=>{const j=B=>{B.key.toLowerCase()!=="s"||!(B.metaKey||B.ctrlKey)||B.shiftKey||B.altKey||e||document.querySelector('[aria-modal="true"]')||(B.preventDefault(),xe?qn():Et())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e,xe,Et,qn]),m.useEffect(()=>{const j=B=>{B.key.toLowerCase()!=="d"||!(B.metaKey||B.ctrlKey)||B.shiftKey||B.altKey||e||document.querySelector('[aria-modal="true"]')||p||(B.preventDefault(),r?.(!n))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e,p,n,r]);const So=m.useCallback(j=>{qn();const B=j.trim();if(!B)return;const re=a.getState().text??"",ge=re&&!/\s$/.test(re)?" ":"";a.setText(re+ge+B+" ")},[a,qn]);m.useEffect(()=>{h(!1),oe(!1),se.current?.kill(),se.current=null,Ge.current=!1,He.current=!1;const j=le.current;if(j){j.style.height="",j.style.overflow="";const B=j.querySelector(".composer-input-wrap"),re=j.querySelector(".composer-toolbar:not(.voice-toolbar)");B&&ce.set(B,{clearProps:"all"}),re&&ce.set(re,{clearProps:"all"});const ge=re?Array.from(re.querySelectorAll('button, label, [role="button"]')):[];ge.length&&ce.set(ge,{clearProps:"all"});const Te=we.current;Te&&(Te.style.display="none")}},[t]);const yi=m.useCallback(j=>{a.setText(`/${j} `),h(!1),requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()})},[a]),lr=m.useCallback(async()=>{if(e||S)return;const j=a.getState().text??"";if(!j.trim())return;const B=_;P(B,{optimizing:!0});try{const re=await CM(j);P(B,{optimizing:!1,review:{...re,original:j}})}catch{P(B,{optimizing:!1})}},[a,e,S,_,P]),Kn=m.useRef(null);m.useEffect(()=>{const j=B=>{if(!(B.key!=="Enter"||!(B.metaKey||B.ctrlKey)||B.altKey)&&!(e||p)&&!document.querySelector('[aria-modal="true"]')){if(xe){B.preventDefault(),Kn.current?.();return}B.preventDefault(),B.shiftKey?(a.send(),R()):lr()}};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e,p,xe,a,lr,R]);const[jn,z]=m.useState({ctrl:!1,alt:!1}),Q=m.useRef(jn);Q.current=jn;const ie=m.useRef(l);ie.current=l;const fe=m.useRef(""),Ce=m.useCallback(j=>{z(B=>({...B,[j]:!B[j]}))},[]);m.useEffect(()=>{if(!p){fe.current="";return}a.setText(""),fe.current="",z({ctrl:!1,alt:!1});const j=()=>{const B=a.getState().text??"",re=fe.current;if(B===re)return;const{removed:ge,added:Te}=aC(re,B),Le=Q.current;if((Le.ctrl||Le.alt)&&ge===0&&Te.length===1&&Ua(Te)){const ye=Xu(Le,Te);ye&&ie.current.key(ye),z({ctrl:!1,alt:!1}),a.setText(re);return}const Re=Te.indexOf(`
|
|
101
|
+
`);if(Re!==-1){for(let ye=0;ye<ge;ye+=1)ie.current.key("BSpace");Te.slice(0,Re)&&ie.current.text(Te.slice(0,Re)),ie.current.key("Enter"),fe.current="",a.setText("");return}for(let ye=0;ye<ge;ye+=1)ie.current.key("BSpace");Te&&ie.current.text(Te),fe.current=B};return a.subscribe(j)},[p,a]);const ot=m.useRef(null),dn=m.useMemo(()=>new Set(M.map(j=>j.name)),[M]),Ot=m.useMemo(()=>new Set(U.map(j=>j.name)),[U]);function Tt(j,B,re){const ge=/(^|\s)([/@])([A-Za-z0-9:_-]+)(\s)/g,Te=[];let Le=0,Re=!1,ye=0,fn;for(;(fn=ge.exec(j))!==null;){const Yr=fn[2],zt=fn[3];if(!(Yr==="/"&&B.has(zt)||Yr==="@"&&re.has(zt)))continue;Re=!0;const gt=fn.index,qt=fn[1],An=fn[4],hn=gt+qt.length,Kt=hn+1+zt.length;gt>Le&&Te.push(j.slice(Le,gt)),qt&&Te.push(qt),Te.push(d.jsx("span",{className:"composer-pill","aria-hidden":"true",children:j.slice(hn,Kt)},ye++)),Te.push(j.slice(Kt,Kt+An.length)),Le=Kt+An.length}return Le<j.length&&Te.push(j.slice(Le)),{nodes:Te,hasPills:Re}}const{nodes:Ir,hasPills:at}=m.useMemo(()=>Tt(W,dn,Ot),[W,dn,Ot]);return m.useLayoutEffect(()=>{const j=document.querySelector(".composer-input"),B=ot.current;!j||!B||(B.scrollTop=j.scrollTop,B.scrollLeft=j.scrollLeft)},[W]),d.jsxs(El.Root,{className:"composer",children:[it?d.jsx("div",{className:"skill-ac",role:"listbox","aria-label":"Skill suggestions",children:de.map((j,B)=>d.jsx("button",{type:"button",role:"option","aria-selected":B===F,"data-on":B===F?"true":void 0,className:"skill-ac-item",onMouseDown:re=>{re.preventDefault(),je(j.name)},onMouseEnter:()=>E(B),children:d.jsxs("span",{className:"tool-head",children:[d.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),d.jsx("span",{className:"tool-name skill-card-name",children:j.name}),j.description?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input skill-card-desc",children:j.description})]}):null]})},j.name))}):null,y?d.jsx("div",{ref:x,className:"term-warm",children:d.jsx(iC,{output:l.output,requestCapture:l.poll,clearOutput:l.clear,sendKey:l.key,mods:jn,onToggleMod:Ce})}):null,d.jsxs("div",{ref:le,className:"composer-card","data-terminal":p?"true":void 0,"data-voice":xe?"true":void 0,children:[Ke?d.jsx("div",{className:"composer-skill-chip-row",children:d.jsxs("span",{className:"skill-chip composer-skill-chip",title:`Invoking /${Ke}`,children:[d.jsx("span",{className:"skill-chip-icon","aria-hidden":"true",children:"⌁"}),d.jsxs("span",{className:"skill-chip-name",children:["/",Ke]})]})}):null,d.jsx(y$,{active:xe,bodyRef:we,onCommit:So,onClose:qn,stopRef:Kn,phase2DoneRef:He}),d.jsxs("div",{className:"composer-input-wrap","data-has-pills":at?"true":void 0,children:[d.jsx(El.Input,{className:"composer-input",placeholder:e&&!p?"Select a session…":" ",submitOnEnter:!1,onKeyUp:j=>I(j.currentTarget),onClick:j=>I(j.currentTarget),onSelect:j=>I(j.currentTarget),onScroll:j=>{const B=ot.current;B&&(B.scrollTop=j.currentTarget.scrollTop,B.scrollLeft=j.currentTarget.scrollLeft)},onKeyDown:j=>{if(p){if(j.metaKey)return;if(j.key==="Escape"){j.preventDefault(),g(!1),s?.(!1),R();return}const B=jn,re=j.ctrlKey||B.ctrl,ge=j.altKey||B.alt;if((re||ge)&&j.key.length===1&&Ua(j.key)){j.preventDefault();const Re=Xu({ctrl:re,alt:ge},j.key);Re&&l.key(Re),(B.ctrl||B.alt)&&z({ctrl:!1,alt:!1});return}const Te=uC(j.key,{ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey});if(Te){j.preventDefault(),l.key(Te);return}if(j.key==="Backspace"){j.preventDefault(),l.key("BSpace");const Re=a.getState().text??"";if(Re){const ye=Re.slice(0,-1);a.setText(ye),fe.current=ye}return}if(j.key==="Delete"){j.preventDefault(),l.key("DC");return}const Le=lC(j.key,j.shiftKey);Le&&(j.preventDefault(),l.key(Le),Le==="Enter"&&(fe.current="",a.setText("")));return}if(u&&j.key==="!"){j.preventDefault(),v();return}if(it){if(j.key==="ArrowDown"){j.preventDefault(),E(B=>(B+1)%de.length);return}if(j.key==="ArrowUp"){j.preventDefault(),E(B=>(B-1+de.length)%de.length);return}if(j.key==="Enter"&&!j.metaKey&&!j.ctrlKey){j.preventDefault(),je(de[F].name);return}if(j.key==="Tab"){j.preventDefault(),je(de[F].name);return}if(j.key==="Escape"){j.preventDefault(),Z(!0);return}}if(j.key==="Enter"&&(j.metaKey||j.ctrlKey)){if(j.preventDefault(),e||S)return;j.shiftKey?(a.send(),R()):lr()}j.key.toLowerCase()==="o"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),lr())},rows:1,disabled:e&&!p,autoComplete:"off",autoCorrect:p?"off":void 0,autoCapitalize:p?"none":void 0,spellCheck:p?!1:void 0}),d.jsx("div",{className:"composer-overlay","aria-hidden":"true",ref:ot,children:Ir}),p?d.jsxs("div",{className:"composer-hint","aria-hidden":"true",children:[d.jsx("span",{className:"composer-hint-lead",children:"Keys go to the shell…"}),d.jsxs("span",{className:"composer-hint-keys",children:[d.jsx(rs,{children:"Tab"})," completes",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(rs,{children:"↑"})," history"]})]}):e?null:d.jsxs("div",{className:"composer-hint","aria-hidden":"true",children:[d.jsx("span",{className:"composer-hint-lead",children:"Reply…"}),d.jsxs("span",{className:"composer-hint-keys",children:[d.jsx(rs,{children:"⌘/Ctrl+↵"})," optimise",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(rs,{children:"⌘/Ctrl+⇧+↵"})," send raw",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(rs,{children:"↵"})," newline"]})]})]}),xe?null:d.jsx("div",{className:"composer-attachments",children:d.jsx(El.Attachments,{children:({attachment:j})=>d.jsx(g$,{attachment:j})})}),d.jsxs("div",{className:"composer-toolbar",children:[!p&&!xe?d.jsxs(d.Fragment,{children:[d.jsx(El.AddAttachment,{className:"composer-attach","aria-label":"Attach a file",title:"Attach a file",multiple:!0,disabled:e,children:d.jsx(v$,{})}),d.jsx("button",{type:"button",className:"composer-mic","aria-label":"Voice input",title:"Voice input",disabled:e,"data-hotkey":"⌘S",onClick:Et,children:d.jsx(dC,{})})]}):null,xe?null:d.jsx("button",{type:"button",className:"composer-skills-btn composer-term-toggle","aria-label":"Terminal mode",title:"Terminal mode — run shell commands","aria-pressed":p,"data-on":p?"true":void 0,onClick:()=>{p?(g(!1),s?.(!1)):v()},children:d.jsx(x$,{})}),d.jsx("span",{className:"composer-toolbar-spacer"}),!p&&!xe?d.jsx("button",{type:"button",className:"composer-enhance composer-bypass","aria-label":"Send without optimising",title:"Send raw — skip the optimiser (⌘/Ctrl+⇧+↵)",disabled:e||S||u,onClick:()=>{a.send(),R()},children:d.jsx(Cx,{})}):null,!p&&!xe?d.jsxs("label",{className:`composer-subagent-toggle${n?" composer-subagent-toggle--on":""}`,"aria-label":"Dispatch task in sub-agent","data-hotkey":"⌘D",title:n?"Sub-agent on — click to disable (⌘D)":"Sub-agent off — click to enable (⌘D)",children:[d.jsx("input",{type:"checkbox",className:"composer-subagent-checkbox",checked:!!n,disabled:e,onChange:j=>r?.(j.target.checked),"aria-label":"Dispatch task in sub-agent"}),d.jsx("span",{className:"composer-subagent-label",children:"Dispatch task in sub-agent"})]}):null,p&&!xe?d.jsx("button",{type:"button",className:"composer-send","data-terminal":"true","aria-label":"Send Enter",title:"Enter",onMouseDown:j=>j.preventDefault(),onClick:()=>l.key("Enter"),children:d.jsx(Cx,{})}):xe?null:d.jsxs(d.Fragment,{children:[i?d.jsx("button",{type:"button",className:"composer-send","data-stop":"true","aria-label":"Stop (Esc)",title:"Stop the agent (Esc)",onClick:()=>o?.(),children:d.jsx(ND,{size:14})}):null,!i||!u?d.jsx("button",{type:"button",ref:C,className:"composer-send","data-queue":i?"true":void 0,"aria-label":"Optimise and send",title:"Optimise & send (⌘/Ctrl+↵)",disabled:e||S||u,"data-hotkey":"⌘↵",onClick:()=>void lr(),children:S?d.jsx("span",{className:"composer-enhance-spinner","aria-hidden":"true"}):d.jsx(w$,{})}):null]})]})]}),T?d.jsx(H5,{original:T.original,result:T,onSend:j=>{P(_,{review:null}),a.setText(j),requestAnimationFrame(()=>{e||a.send(),R()})},onAccept:j=>{a.setText(j),P(_,{review:null}),R()},onClose:()=>{P(_,{review:null}),R()}}):null,f?d.jsx(W5,{onPick:yi,onClose:()=>h(!1),sessionId:t}):null]})}function y$({active:e,bodyRef:t,onCommit:n,onClose:r,stopRef:s,phase2DoneRef:i}){const{status:o,errorMsg:a,canvasRef:l,pauseResume:u,stop:c,cancel:f}=G5({active:e,onCommit:n,onClose:r});m.useEffect(()=>(s.current=c,()=>{s.current=null}),[c,s]);const h=m.useRef(null),p=o==="recording"||o==="paused";m.useLayoutEffect(()=>{const y=h.current;y&&!Jt()&&ce.set(y,{opacity:0,y:12})},[]),m.useLayoutEffect(()=>{if(!p)return;const y=h.current;if(y&&i.current){if(Jt()){ce.set(y,{opacity:1,y:0});return}ce.fromTo(y,{opacity:0,y:8},{opacity:1,y:0,duration:.11,ease:Dr.enterEase})}},[p,i]);const g=o==="error"?"Microphone unavailable":o==="transcribing"?"Transcribing…":o==="paused"?"Paused":o==="starting"?"Starting…":"Listening…";return d.jsxs("div",{ref:t,className:"voice-inline-body","aria-live":"polite",children:[d.jsxs("div",{className:"voice-status",children:[d.jsx("span",{className:"voice-dot","data-on":o==="recording"?"true":void 0}),g]}),d.jsx("canvas",{ref:l,className:"voice-wave voice-wave-inline",height:64,"data-paused":o!=="recording"?"true":void 0}),o==="error"?d.jsx("div",{className:"voice-error",children:a||"Could not start recording."}):o!=="transcribing"?d.jsx("div",{className:"voice-hint",children:"Speak, then Stop & Transcribe (or ⌘/Ctrl+↵) to insert."}):null,d.jsxs("div",{className:"composer-toolbar voice-toolbar",children:[d.jsx("button",{type:"button",className:"btn-secondary voice-btn-cancel",onClick:f,disabled:o==="transcribing","aria-label":"Cancel voice recording",children:"Cancel"}),d.jsx("span",{className:"composer-toolbar-spacer"}),p?d.jsx("button",{ref:h,type:"button",className:"btn-secondary voice-btn-pause",onClick:u,"aria-label":o==="recording"?"Pause recording":"Resume recording",children:o==="recording"?"Pause":"Resume"}):null,d.jsx("button",{type:"button",className:"composer-send voice-btn-stop",onClick:c,disabled:o==="error"||o==="transcribing"||o==="starting","aria-label":"Stop recording and transcribe",title:"Stop & Transcribe (⌘/Ctrl+↵)",children:o==="transcribing"?d.jsx("span",{className:"composer-enhance-spinner","aria-hidden":"true"}):d.jsx(dC,{})})]})]})}function v$(){return d.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Cx(){return d.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M12 19V5M6 11l6-6 6 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function x$(){return d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M5 8l4 4-4 4M12 16h7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function dC(){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:"currentColor"}),d.jsx("path",{d:"M6 11a6 6 0 0 0 12 0M12 17v3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function w$(){return d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("path",{d:"M12 2 L13.5 9.5 L21 11 L13.5 12.5 L12 20 L10.5 12.5 L3 11 L10.5 9.5 Z",fill:"currentColor",opacity:"0.9"}),d.jsx("path",{d:"M19 2 L19.8 4.2 L22 5 L19.8 5.8 L19 8 L18.2 5.8 L16 5 L18.2 4.2 Z",fill:"currentColor",opacity:"0.6"})]})}const Ex=120;function b$(e){const t=e?.messages??[];for(let r=t.length-1;r>=0;r--){const s=(t[r]?.blocks??[]).filter(i=>i.kind==="text"||i.kind==="thinking").map(i=>i.text).join(" ").replace(/\s+/g," ").trim();if(s)return Tx(s)}const n=(e?.description??"").replace(/\s+/g," ").trim();return n?Tx(n):""}function Tx(e){return e.length>Ex?e.slice(0,Ex-1)+"…":e}function fC({subagents:e,onOpenAgent:t,viewingAgentId:n}){const r=e.filter(a=>a.status==="running");if(r.length===0)return null;const i=(n?r.find(a=>a.agentId===n)??null:null)??r[0],o=b$(i);return d.jsxs("div",{className:"subagent-strip",role:"list","aria-label":`${r.length} sub-agent${r.length===1?"":"s"} running`,children:[d.jsx("div",{className:"subagent-pills",children:r.map(a=>d.jsxs("button",{type:"button",role:"listitem",className:"subagent-pill","data-active":a.agentId===n?"true":void 0,onClick:()=>t(a.agentId),title:`View ${a.agentType||"sub-agent"}'s transcript`,children:[d.jsx("span",{className:"sa-dot","data-status":"running","aria-hidden":"true"}),d.jsx("span",{className:"subagent-pill-name",children:a.agentType||"sub-agent"})]},a.agentId))}),o?d.jsx("p",{className:"subagent-strip-caption","aria-live":"polite",children:o}):null]})}const _$={UserMessage:tl,AssistantMessage:Cr,SystemMessage:Cr};function Lm({messages:e}){const t=m.useMemo(()=>OS(e),[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(_t.Root,{className:"sa-thread-root",children:d.jsxs(_t.Viewport,{className:"sa-thread-viewport",autoScroll:!0,children:[d.jsx(_t.Empty,{children:d.jsx("div",{className:"thread-empty",children:"no output yet…"})}),d.jsx(_t.Messages,{components:_$})]})})})}const S$={UserMessage:tl,AssistantMessage:Cr,SystemMessage:Cr},k$=[{label:"Plan with /plan-hard",insert:"/plan-hard "},{label:"Browse skills (/)",insert:"/"},{label:"Mention an agent (@)",insert:"@"},{label:"Dictate (⌘S)"},{label:"Run a shell command (>_)"}],C$=8e3;function E$({loading:e}){const[t,n]=m.useState(!0);return m.useEffect(()=>{if(!e){n(!0);return}const r=setTimeout(()=>n(!1),C$);return()=>clearTimeout(r)},[e]),!e||!t?null:d.jsx("div",{className:"thread-loading","aria-label":"Loading transcript","aria-live":"polite",children:d.jsx("span",{className:"thread-loading-spinner","aria-hidden":"true"})})}function T$(){const e=j0(),t=n=>{if(!n.insert)return;e.setText(n.insert),document.querySelector(".composer .composer-input")?.focus()};return d.jsx("div",{className:"thread-welcome-chips",role:"list",children:k$.map(n=>d.jsx("button",{type:"button",role:"listitem",className:"thread-welcome-chip","data-clickable":n.insert?"true":void 0,onClick:()=>t(n),children:n.label},n.label))})}function I$({hasSelection:e,loading:t=!1,sessionId:n,hiddenCount:r,onLoadEarlier:s,subAgentMode:i,onSubAgentModeChange:o,onTerminalModeChange:a,subagents:l,onOpenAgent:u,viewingAgent:c=null,onCloseAgent:f,working:h,onStop:p}){return d.jsxs(_t.Root,{className:"thread-root",children:[c?d.jsxs("div",{className:"agent-inline-view",children:[d.jsxs("div",{className:"agent-inline-head",children:[d.jsx("button",{type:"button",className:"agent-inline-back","aria-label":"Back to session",onClick:f,children:"‹ back"}),d.jsxs("span",{className:"agent-inline-title",children:[d.jsx("span",{className:"sa-dot","data-status":c.status,"aria-hidden":"true"}),d.jsx("span",{className:"agent-inline-name",children:c.agentType||"sub-agent"}),d.jsx("span",{className:"agent-inline-status",children:c.status==="running"?"· running":"· done"})]})]}),d.jsx(Lm,{messages:c.messages})]}):d.jsxs(d.Fragment,{children:[d.jsxs(_t.Viewport,{className:"thread-viewport",children:[e?d.jsx(_t.Empty,{children:t?d.jsx(E$,{loading:t}):d.jsxs("div",{className:"thread-welcome",children:[d.jsx("h1",{className:"thread-welcome-heading",children:"What are we shipping today?"}),d.jsx("p",{className:"thread-welcome-subtitle",children:"Talk to Claude — type a prompt, or use a skill / agent."}),d.jsx(T$,{})]})}):d.jsx("div",{className:"thread-empty",children:"select a session"}),e&&r>0?d.jsxs("button",{type:"button",className:"load-earlier",onClick:s,children:["Load earlier messages (",r," hidden)"]}):null,d.jsx(_t.Messages,{components:S$})]}),d.jsx("button",{type:"button",className:"scroll-to-bottom","aria-label":"Scroll to latest",title:"Scroll to latest (⌘.)","data-hotkey":"⌘.","data-hotkey-dir":"up",onClick:()=>{const g=document.querySelector(".thread-viewport");g&&g.scrollTo({top:g.scrollHeight,behavior:"smooth"})},children:d.jsx(jD,{size:18})})]}),d.jsx(fC,{subagents:l,onOpenAgent:u,viewingAgentId:c?.agentId??null}),d.jsx(cC,{disabled:!e,sessionId:n,subAgentMode:i,onSubAgentModeChange:o,onTerminalModeChange:a,working:h,onStop:p})]})}const R$=256*1024,Oo=40,Ix=90,P$=25,j$=15,A$=95;function N$(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const M$={UserMessage:tl,AssistantMessage:Cr,SystemMessage:Cr};function D$({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"skill-legend-body",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(_t.Root,{className:"skill-body-thread",children:d.jsx(_t.Viewport,{className:"skill-body-viewport",children:d.jsx(_t.Messages,{components:M$})})})})}function L$({val:e}){const t=e.split(/,\s*/).map(n=>n.trim()).filter(Boolean);return t.length<=1?d.jsx("span",{className:"skill-fm-val",children:e}):d.jsx("span",{className:"skill-fm-val skill-fm-chips",children:t.map(n=>d.jsx("span",{className:"skill-fm-chip",children:n},n))})}function O$({artifact:e}){const t=e.skillFrontMatter??{},n=Object.entries(t);return d.jsxs("div",{className:"skill-legend",children:[e.skillSource?d.jsx("div",{className:"skill-legend-source-row",children:d.jsx("span",{className:"skill-legend-source-badge","data-source":e.skillSource,title:e.skillSource==="project"?"Project-local skill":e.skillSource==="plugin"?"Plugin skill":"User skill",children:e.skillSource})}):null,n.length>0&&d.jsx("dl",{className:"skill-fm",children:n.map(([r,s])=>d.jsxs("div",{className:"skill-fm-row",children:[d.jsx("dt",{className:"skill-fm-key",children:r}),d.jsx(L$,{val:s})]},r))}),e.content.length>0?d.jsx("div",{className:"skill-body-wrap",children:d.jsx(D$,{markdown:e.content})}):null]})}function Rx({language:e,content:t,artifactId:n}){const[r,s]=m.useState(null),i=t.length>R$,o=Nm(e),a=!i&&o!==null;return m.useEffect(()=>{if(!a){s(null);return}let l=!0;return s(null),J1(e,t).then(u=>{l&&s(u)}).catch(()=>{l&&s(null)}),()=>{l=!1}},[n,t,a,e]),i?d.jsxs("div",{className:"artifact-body-wrap",children:[d.jsx("p",{className:"artifact-large-note",children:"(large file — shown as plain text)"}),d.jsx("pre",{className:"artifact-pre",children:d.jsx("code",{children:t})})]}):a&&r!==null?d.jsx("div",{className:"artifact-body-wrap",children:d.jsx("pre",{className:"artifact-pre",children:d.jsx("code",{className:"hljs",dangerouslySetInnerHTML:{__html:r}})})}):d.jsx("div",{className:"artifact-body-wrap",children:d.jsx("pre",{className:"artifact-pre",children:d.jsx("code",{className:a?"hljs":void 0,dangerouslySetInnerHTML:{__html:N$(t)}})})})}function z$(){const{artifacts:e,activeId:t,setActive:n,close:r}=Mm(),s=Dm(),i=m.useRef(null),o=m.useRef(null),a=m.useId(),[l,u]=m.useState(Oo),c=m.useRef(null),[f,h]=m.useState(!1),p=e.find(_=>_.id===t)??null,g=p!==null;m.useEffect(()=>{g&&u(Oo)},[g]);const y=m.useRef(!1);m.useEffect(()=>{const _=y.current;if(y.current=g,!_&&g&&requestAnimationFrame(()=>{const S=o.current?.querySelector('[role="tab"][aria-selected="true"]');S?S.focus():i.current?.focus()}),_&&!g){const S=document.querySelector(".thread-root");S&&(S.hasAttribute("tabindex")||S.setAttribute("tabindex","-1"),S.focus())}},[g]);const b=m.useCallback(_=>{_.key==="Escape"&&t&&(_.preventDefault(),r(t))},[t,r]),x=m.useCallback(_=>{if(_.key!=="ArrowLeft"&&_.key!=="ArrowRight")return;const S=Array.from(o.current?.querySelectorAll('[role="tab"]')??[]),T=document.activeElement,P=S.indexOf(T);if(P<0)return;const R=_.key==="ArrowRight"?S[(P+1)%S.length]:S[(P-1+S.length)%S.length];R?.focus();const C=R?.dataset.artifactId;C&&n(C)},[n]),v=m.useCallback(_=>{c.current={startY:_.clientY,startH:l},_.currentTarget.setPointerCapture(_.pointerId),h(!0)},[l]),w=m.useCallback(_=>{if(!c.current)return;const{startY:S,startH:T}=c.current,P=(S-_.clientY)/window.innerHeight*100,R=Math.min(A$,Math.max(j$,T+P));u(R)},[]),k=m.useCallback(_=>{c.current&&(_.currentTarget.releasePointerCapture(_.pointerId),c.current=null,h(!1),u(S=>{if(S<P$)return t&&r(t),Oo;const T=Math.abs(S-Oo),P=Math.abs(S-Ix);return T<=P?Oo:Ix}))},[t,r]);return g?s?d.jsxs("div",{className:"artifact-panel","data-mode":"sheet",style:{height:`${l}dvh`},"data-dragging":f?"true":"false",role:"region","aria-label":"Artifact panel",ref:i,tabIndex:-1,onKeyDown:b,children:[d.jsx("div",{className:"artifact-drag-handle",role:"separator","aria-label":"Resize panel",onPointerDown:v,onPointerMove:w,onPointerUp:k,children:d.jsx("div",{className:"artifact-drag-pip","aria-hidden":"true"})}),d.jsxs("div",{className:"artifact-panel-head",children:[d.jsx("div",{role:"tablist","aria-label":"Open artifacts",ref:o,className:"artifact-tablist",onKeyDown:x,children:e.map(_=>{const S=_.id===t,T=`artifact-tab-${_.id}`;return d.jsxs("div",{role:"presentation",className:"artifact-tab-wrap",children:[d.jsx("button",{role:"tab",id:T,className:"artifact-tab","aria-selected":S,tabIndex:S?0:-1,"data-artifact-id":_.id,onClick:()=>n(_.id),children:_.title}),d.jsx("button",{className:"artifact-tab-close","aria-label":`Close ${_.title}`,tabIndex:-1,onClick:P=>{P.stopPropagation(),r(_.id)},children:"✕"})]},_.id)})}),d.jsx("button",{className:"artifact-close-all","aria-label":"Close artifact panel",onClick:()=>t&&r(t),children:"×"})]}),p&&d.jsx("div",{role:"tabpanel",id:`${a}-body`,"aria-labelledby":`artifact-tab-${p.id}`,className:"artifact-panel-body",children:d.jsx(Rx,{language:p.language,content:p.content,artifactId:p.id})})]}):d.jsxs("div",{className:"artifact-panel",role:"region","aria-label":"Artifact panel",ref:i,tabIndex:-1,onKeyDown:b,children:[d.jsxs("div",{className:"artifact-panel-head",children:[d.jsx("div",{role:"tablist","aria-label":"Open artifacts",ref:o,className:"artifact-tablist",onKeyDown:x,children:e.map(_=>{const S=_.id===t,T=`artifact-tab-${_.id}`;return d.jsxs("div",{role:"presentation",className:"artifact-tab-wrap",children:[d.jsx("button",{role:"tab",id:T,className:"artifact-tab","aria-selected":S,tabIndex:S?0:-1,"data-artifact-id":_.id,onClick:()=>n(_.id),children:_.title}),d.jsx("button",{className:"artifact-tab-close","aria-label":`Close ${_.title}`,tabIndex:-1,onClick:P=>{P.stopPropagation(),r(_.id)},children:"✕"})]},_.id)})}),d.jsx("button",{className:"artifact-close-all","aria-label":"Close artifact panel",onClick:()=>t&&r(t),children:"×"})]}),p&&d.jsx("div",{role:"tabpanel",id:`${a}-body`,"aria-labelledby":`artifact-tab-${p.id}`,className:"artifact-panel-body",children:p.kind==="skill"?d.jsx(O$,{artifact:p}):d.jsx(Rx,{language:p.language,content:p.content,artifactId:p.id})})]}):null}const Px=200,F$=2e3;function B$({sessionId:e,capture:t,requestCapture:n,clearCapture:r}){const s=m.useRef(null),i=m.useRef(!0);m.useEffect(()=>{n(Px);const a=setInterval(()=>n(Px),F$);return()=>{clearInterval(a),r()}},[e,n,r]),m.useLayoutEffect(()=>{const a=s.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[t]);const o=()=>{const a=s.current;a&&(i.current=a.scrollHeight-a.scrollTop-a.clientHeight<24)};return d.jsxs("div",{className:"live-pane",children:[d.jsx("div",{className:"live-pane-head",children:"live pane (no transcript)"}),d.jsx("pre",{className:"live-pane-body",ref:s,onScroll:o,children:t??"capturing live pane…"})]})}function $$(e){const[t,n]=m.useState(""),[r,s]=m.useState({ctrl:!1,alt:!1}),i=m.useRef(""),o=m.useRef(r);o.current=r;const a=m.useRef(e);a.current=e;const l=m.useCallback(h=>{s(p=>({...p,[h]:!p[h]}))},[]),u=m.useCallback(h=>{const p=i.current;if(h===p)return;const{removed:g,added:y}=aC(p,h),b=o.current,x=a.current;if((b.ctrl||b.alt)&&g===0&&y.length===1&&Ua(y)){const w=Xu(b,y);w&&x.sendKey(w),s({ctrl:!1,alt:!1}),n(p);return}const v=y.indexOf(`
|
|
102
|
+
`);if(v!==-1){for(let w=0;w<g;w+=1)x.sendKey("BSpace");y.slice(0,v)&&x.sendText(y.slice(0,v)),x.sendKey("Enter"),i.current="",n("");return}for(let w=0;w<g;w+=1)x.sendKey("BSpace");y&&x.sendText(y),i.current=h,n(h)},[]),c=m.useCallback(h=>u(h.target.value),[u]),f=m.useCallback(h=>{if(h.metaKey)return;const p=o.current,g=a.current,y=h.ctrlKey||p.ctrl,b=h.altKey||p.alt;if((y||b)&&h.key.length===1&&Ua(h.key)){h.preventDefault();const w=Xu({ctrl:y,alt:b},h.key);w&&g.sendKey(w),(p.ctrl||p.alt)&&s({ctrl:!1,alt:!1});return}const x=uC(h.key,{ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey});if(x){h.preventDefault(),g.sendKey(x);return}if(h.key==="Backspace"){h.preventDefault(),g.sendKey("BSpace");const w=i.current.slice(0,-1);i.current=w,n(w);return}if(h.key==="Delete"){h.preventDefault(),g.sendKey("DC");return}const v=lC(h.key,h.shiftKey);v&&(h.preventDefault(),g.sendKey(v),v==="Enter"&&(i.current="",n("")))},[]);return m.useMemo(()=>({value:t,onChange:c,onKeyDown:f,sticky:r,toggleMod:l}),[t,c,f,r,l])}function U$({sessionId:e,capture:t,requestCapture:n,clearCapture:r,sendText:s,sendKey:i}){const o=m.useMemo(()=>c=>n(c,!0),[n]),a=m.useMemo(()=>({sendText:c=>void s(c),sendKey:c=>void i(c)}),[s,i]),l=$$(a),u=m.useRef(null);return m.useEffect(()=>{const c=u.current;!c||Jt()||ce.fromTo(c,{opacity:0,scale:.97},{opacity:1,scale:1,duration:.24,ease:"power3.out",transformOrigin:"center top"})},[]),d.jsxs("div",{className:"thread-root terminal-pane-root",ref:u,children:[d.jsx(iC,{output:t,requestCapture:o,clearOutput:r,sendKey:i,mods:l.sticky,onToggleMod:l.toggleMod},e),d.jsx("div",{className:"terminal-pane-input",children:d.jsx("textarea",{className:"composer-input","aria-label":"Terminal input",placeholder:"Keys go to the pane…",rows:1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,value:l.value,onChange:l.onChange,onKeyDown:l.onKeyDown})})]})}function jx(e){return e.questions.map(()=>new Set)}function V$(e){return e.options.some(t=>typeof t.preview=="string"&&t.preview.length>0)}function H$({pending:e,capture:t,onAnswer:n,onCapture:r,onClose:s}){const{rootRef:i,requestClose:o}=mi(s),[a,l]=m.useState(()=>jx(e)),[u,c]=m.useState(()=>e.questions.map(()=>0)),f=m.useRef(null),h=m.useRef(null);m.useEffect(()=>{l(jx(e)),c(e.questions.map(()=>0))},[e]),m.useEffect(()=>(h.current=document.activeElement,(f.current?.querySelector('button:not([disabled]), [tabindex="0"]')??f.current)?.focus(),()=>{h.current?.focus?.()}),[]);const p=m.useMemo(()=>a.length>0&&a.every(v=>v.size>0),[a]),g=(v,w,k)=>{l(_=>{const S=_.map(P=>new Set(P)),T=S[v];return k?T.has(w)?T.delete(w):T.add(w):S[v]=new Set([w]),S})},y=(v,w,k)=>{c(_=>{const S=[..._];return S[v]=Math.max(0,Math.min(k-1,(_[v]??0)+w)),S})},b=v=>{if(v.key==="Escape"){v.preventDefault(),o();return}if(v.key!=="Tab")return;const w=f.current?.querySelectorAll('button:not([disabled]), [tabindex="0"]');if(!w||w.length===0)return;const k=w[0],_=w[w.length-1];v.shiftKey&&document.activeElement===k?(v.preventDefault(),_.focus()):!v.shiftKey&&document.activeElement===_&&(v.preventDefault(),k.focus())},x=()=>{p&&n(e.toolUseId,a.map(v=>[...v]))};return d.jsx("div",{className:"modal-backdrop",ref:i,onClick:v=>{v.target===v.currentTarget&&o()},children:d.jsxs("div",{ref:f,className:"modal",role:"dialog","aria-modal":"true","aria-label":"Question from Claude",tabIndex:-1,onKeyDown:b,children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",children:"Claude is asking"}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:o,children:"✕"})]}),d.jsxs("div",{className:"modal-body",children:[e.questions.map((v,w)=>{const k=V$(v),_=u[w]??0,S=v.options[_];return d.jsxs("div",{className:"question",children:[v.header?d.jsx("div",{className:"q-header",children:v.header}):null,d.jsx("div",{className:"q-text",children:v.question}),v.multiSelect?d.jsx("div",{className:"q-hint",children:"select one or more"}):null,k?d.jsxs("div",{className:"ask-split",children:[d.jsx("div",{className:"ask-split-list",role:"listbox","aria-multiselectable":!!v.multiSelect,"aria-label":v.question,children:v.options.map((T,P)=>{const R=a[w]?.has(T.label),C=P===_;return d.jsxs("div",{className:"ask-split-row","data-focused":C?"true":"false","data-selected":R?"true":"false",role:"option","aria-selected":R,tabIndex:C?0:-1,onMouseEnter:()=>c(M=>{const D=[...M];return D[w]=P,D}),onClick:()=>{c(M=>{const D=[...M];return D[w]=P,D}),g(w,T.label,!!v.multiSelect)},onKeyDown:M=>{M.key==="ArrowDown"?(M.preventDefault(),y(w,1,v.options.length)):M.key==="ArrowUp"?(M.preventDefault(),y(w,-1,v.options.length)):(M.key===" "||M.key==="Enter")&&(M.preventDefault(),g(w,T.label,!!v.multiSelect))},children:[d.jsx("span",{className:"ask-split-indicator",children:v.multiSelect?d.jsx("span",{className:"ask-check","aria-hidden":"true",children:R?"▣":"▢"}):d.jsx("span",{className:"ask-radio","aria-hidden":"true",children:R?"◉":"○"})}),d.jsxs("span",{className:"ask-split-text",children:[d.jsx("span",{className:"option-label",children:T.label}),T.description?d.jsx("span",{className:"option-desc",children:T.description}):null]})]},T.label)})}),d.jsx("div",{className:"ask-preview","aria-live":"polite","aria-label":"Option preview",children:S?.preview?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"ask-preview-label",children:S.label}),d.jsx("pre",{className:"ask-preview-content",children:S.preview})]}):d.jsx("div",{className:"ask-preview-empty",children:"no preview"})})]}):d.jsx("div",{className:"q-options",children:v.options.map(T=>{const P=a[w]?.has(T.label);return d.jsxs("button",{type:"button",className:"option-btn","data-on":P?"true":"false","aria-pressed":P,onClick:()=>g(w,T.label,!!v.multiSelect),children:[d.jsx("span",{className:"option-label",children:T.label}),T.description?d.jsx("span",{className:"option-desc",children:T.description}):null]},T.label)})})]},w)}),t!=null?d.jsx("pre",{className:"capture-output",children:t}):null]}),d.jsxs("div",{className:"modal-foot",children:[d.jsx("button",{type:"button",className:"btn-secondary",onClick:r,children:"Show Terminal"}),d.jsx("span",{className:"modal-foot-spacer"}),d.jsx("button",{type:"button",className:"btn-secondary",onClick:o,children:"Cancel"}),d.jsx("button",{type:"button",className:"btn-primary",disabled:!p,onClick:x,children:"Send Answer"})]})]})})}function W$({toast:e}){const[t,n]=m.useState(!1);return m.useEffect(()=>{if(!e)return;n(!0);const r=setTimeout(()=>n(!1),2200);return()=>clearTimeout(r)},[e]),e?d.jsx("div",{className:`toast ${t?"show":""} ${e.kind?`toast-${e.kind}`:""}`,role:"status","aria-live":"polite",children:e.text}):null}const Ax="claude-control-update-dismissed";function q$(e){if(e.latest&&e.latest!==e.current)return`Update available — v${e.latest} (you’re on v${e.current}).`;const t=e.behind||1;return`Update available — ${t} new commit${t===1?"":"s"} (v${e.current}).`}function K$(){const[e,t]=m.useState(null),[n,r]=m.useState(!1);return m.useEffect(()=>{let s=!0;return NS().then(i=>{if(!s||!i?.updateAvailable)return;const o=i.latest??`behind-${i.behind??0}`;localStorage.getItem(Ax)!==o&&t({current:i.current,latest:i.latest,behind:i.behind??0})}),()=>{s=!1}},[]),e?n?d.jsx("div",{className:"update-banner",role:"status",children:d.jsx("span",{children:"Updating… the page will reconnect shortly."})}):d.jsxs("div",{className:"update-banner",role:"status",children:[d.jsx("span",{children:q$(e)}),d.jsxs("span",{className:"update-actions",children:[d.jsx("button",{type:"button",className:"update-now",onClick:()=>{r(!0),vM()},children:"Update now"}),d.jsx("button",{type:"button",className:"update-dismiss","aria-label":"Dismiss update notice",onClick:()=>{localStorage.setItem(Ax,e.latest??`behind-${e.behind}`),t(null)},children:"×"})]})]}):null}function G$({onClose:e,onToast:t}){const{rootRef:n,requestClose:r}=mi(e),[s,i]=m.useState(""),[o,a]=m.useState(""),[l,u]=m.useState(""),[c,f]=m.useState(""),[h,p]=m.useState(""),[g,y]=m.useState(""),[b,x]=m.useState("mlx"),[v,w]=m.useState(""),[k,_]=m.useState(0),[S,T]=m.useState(0),[P,R]=m.useState(null),[C,M]=m.useState(!0),[D,U]=m.useState(!1),[V,W]=m.useState(null),[J,ne]=m.useState(()=>Date.now()),[$,F]=m.useState(!1),E=m.useRef(null);m.useEffect(()=>{let O=!0;return NS().then(te=>O&&te&&W(te)).catch(()=>{}),kM().then(te=>O&&R(te)).catch(()=>{}),()=>{O=!1}},[]),m.useEffect(()=>{let O=!0;return Wp().then(te=>{O&&(i(te.launchCommand),a(te.claudeBin??""),u(te.codexLaunchCommand??"codex"),f(te.codexBin??""),p(te.defaultCwd),y(te.optimizeModel??""),x(te.optimizeBackend??"mlx"),w(te.mlxModel??""),_(te.transcriptFontSize??0),T(te.externalFontSize??0))}).catch(te=>t(`Load config failed: ${te.message}`,"error")).finally(()=>{O&&M(!1)}),()=>{O=!1}},[t]),m.useEffect(()=>{const O=te=>{te.key==="Escape"&&r()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[r]);const X=async O=>{const te=O.target.files?.[0];if(O.target.value="",!!te){if(te.type!=="image/png"){t("Icon must be a PNG image","error");return}F(!0);try{await _M(te),ne(Date.now()),t("App icon updated — re-add to Home Screen to see it","ok")}catch(de){t(`Icon upload failed: ${de.message}`,"error")}finally{F(!1)}}},Z=async()=>{F(!0);try{await SM(),ne(Date.now()),t("App icon reset to default","ok")}catch(O){t(`Icon reset failed: ${O.message}`,"error")}finally{F(!1)}},I=async()=>{U(!0);try{const O=await TM({launchCommand:s,claudeBin:o,codexLaunchCommand:l,codexBin:c,defaultCwd:h,optimizeModel:g,optimizeBackend:b,mlxModel:v,transcriptFontSize:k,externalFontSize:S});i(O.launchCommand),a(O.claudeBin??""),u(O.codexLaunchCommand??"codex"),f(O.codexBin??""),p(O.defaultCwd),y(O.optimizeModel??""),x(O.optimizeBackend??"mlx"),w(O.mlxModel??""),_(O.transcriptFontSize??0),T(O.externalFontSize??0);const te=P?.mlxModels.find(de=>de.id===O.mlxModel);O.optimizeBackend==="mlx"&&te&&te.installed===!1?t(`Downloading ${te.label} (${te.sizeGB} GB)… enhancer uses claude until ready`,"ok"):t("Config saved","ok"),r()}catch(O){t(`Save failed: ${O.message}`,"error")}finally{U(!1)}};return d.jsx("div",{className:"config-overlay",ref:n,role:"presentation",onClick:O=>{O.target===O.currentTarget&&r()},children:d.jsxs("div",{className:"config-modal",role:"dialog","aria-modal":"true","aria-label":"Settings",children:[d.jsxs("div",{className:"config-head",children:[d.jsx("span",{className:"config-title",children:"Settings"}),d.jsx("button",{type:"button",className:"config-close","aria-label":"Close settings",onClick:r,children:"×"})]}),d.jsxs("div",{className:"config-body",children:[d.jsx("div",{className:"config-section-label",children:"CLI"}),d.jsxs("div",{className:"config-agent-group",children:[d.jsx("span",{className:"config-agent-group-title",children:"Claude Code"}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Command to run"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"claude",value:s,disabled:C,onChange:O=>i(O.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsxs("span",{className:"config-hint",children:["What gets typed to launch the agent — may be a shell alias (e.g."," ",d.jsx("code",{children:"yolo"}),")."]})]}),d.jsxs("label",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"CLI path (optional)"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"auto-detected",value:o,disabled:C,onChange:O=>a(O.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsx("span",{className:"config-hint",children:"Optional absolute path to the binary for availability checks; blank = resolve from PATH."})]})]}),d.jsxs("div",{className:"config-agent-group",children:[d.jsx("span",{className:"config-agent-group-title",children:"Codex"}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Command to run"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"codex",value:l,disabled:C,onChange:O=>u(O.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsxs("span",{className:"config-hint",children:["What gets typed to launch the agent — may be a shell alias (e.g."," ",d.jsx("code",{children:"yodex"}),")."]})]}),d.jsxs("label",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"CLI path (optional)"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"auto-detected",value:c,disabled:C,onChange:O=>f(O.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsx("span",{className:"config-hint",children:"Optional absolute path to the binary for availability checks; blank = resolve from PATH."})]})]}),d.jsx("div",{className:"config-section-label",children:"Session"}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Default cwd"}),d.jsx("input",{className:"config-input",type:"text",value:h,disabled:C,onChange:O=>p(O.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsx("span",{className:"config-hint",children:"Existing dir new sessions start in."})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Enhancer backend"}),d.jsxs("select",{className:"config-input",value:b,disabled:C,onChange:O=>x(O.target.value),children:[d.jsx("option",{value:"mlx",children:"Local MLX (→ rules)"}),d.jsx("option",{value:"rules",children:"Rules only (offline)"})]}),d.jsxs("span",{className:"config-hint",children:["Powers ✨. ",d.jsx("code",{children:"mlx"})," = on-device, no key. (",d.jsx("code",{children:"claude -p"}),"is disabled — it spawned transcripts that corrupted session matching.)"]})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Claude model"}),d.jsxs("select",{className:"config-input",value:g,disabled:C,onChange:O=>y(O.target.value),children:[g&&!P?.claudeModels.some(O=>O.id===g)?d.jsxs("option",{value:g,children:[g,P?" (custom)":""]}):null,(P?.claudeModels??[]).map(O=>d.jsxs("option",{value:O.id,children:[O.label,O.id===P?.recommendedClaudeModel?" · recommended":""]},O.id))]}),d.jsxs("span",{className:"config-hint",children:["For the ",d.jsx("code",{children:"claude -p"})," backend/fallback."]})]}),d.jsxs("label",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"MLX model"}),d.jsxs("select",{className:"config-input",value:v,disabled:C||b!=="mlx",onChange:O=>w(O.target.value),children:[v&&!P?.mlxModels.some(O=>O.id===v)?d.jsxs("option",{value:v,children:[v,P?" (custom)":""]}):null,(P?.mlxModels??[]).map(O=>d.jsxs("option",{value:O.id,children:[O.label," · ",O.sizeGB," GB",O.installed?" · downloaded":" · ⬇ download",O.id===P?.recommendedMlxModel?" · recommended":"",P&&O.minRamGB>P.machine.ramGB?` (needs ≥${O.minRamGB} GB)`:""]},O.id))]}),d.jsx("span",{className:"config-hint",children:P?`Your ${P.machine.appleSilicon?"Apple Silicon ":""}Mac has ${P.machine.ramGB} GB — recommended: ${P.mlxModels.find(O=>O.id===P.recommendedMlxModel)?.label??P.recommendedMlxModel}. Auto-downloads on first use.`:"On-device model for the ✨ enhancer. Auto-downloads on first use."})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Transcript font size"}),d.jsxs("select",{className:"config-input",value:k,disabled:C,onChange:O=>_(Number(O.target.value)),children:[d.jsx("option",{value:0,children:"Default (auto)"}),[12,13,14,15,16,17,18].map(O=>d.jsxs("option",{value:O,children:[O,"px"]},O))]}),d.jsx("span",{className:"config-hint",children:"Base transcript size (iPad + desktop). Default uses the built-in CSS token."})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"External display font size"}),d.jsxs("select",{className:"config-input",value:S,disabled:C,onChange:O=>T(Number(O.target.value)),children:[d.jsx("option",{value:0,children:"Default (auto)"}),[12,13,14,15,16,17,18,19,20,21,22].map(O=>d.jsxs("option",{value:O,children:[O,"px"]},O))]}),d.jsx("span",{className:"config-hint",children:"Applies only when iPad drives an external monitor. Overrides base size on that display."})]}),d.jsxs("div",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"App icon"}),d.jsxs("div",{className:"config-icon-row",children:[d.jsx("img",{className:"config-icon-preview",src:`/api/icon?size=192&t=${J}`,alt:"Current home-screen icon",width:44,height:44}),d.jsxs("div",{className:"config-icon-actions",children:[d.jsx("button",{type:"button",className:"config-cancel",disabled:$,onClick:()=>E.current?.click(),children:$?"Working…":"Upload PNG"}),d.jsx("button",{type:"button",className:"config-cancel",disabled:$,onClick:Z,children:"Reset"})]}),d.jsx("input",{ref:E,type:"file",accept:"image/png",hidden:!0,onChange:X})]}),d.jsx("span",{className:"config-hint",children:"Defaults to the Claude Control logo. Re-add to Home Screen after changing."})]})]}),d.jsxs("div",{className:"config-foot",children:[d.jsx("div",{className:"config-version",children:V?d.jsxs(d.Fragment,{children:[d.jsxs("span",{children:["claude-control v",V.current]}),V.updateAvailable&&V.latest?d.jsxs("span",{className:"config-version-update",children:["· update available: v",V.latest]}):null]}):null}),d.jsxs("div",{className:"config-actions",children:[d.jsx("button",{type:"button",className:"config-cancel",onClick:r,disabled:D,children:"Cancel"}),d.jsx("button",{type:"button",className:"config-save",onClick:I,disabled:C||D,children:D?"Saving…":"Save"})]})]})]})})}const Nx={all:"Showing all panes — tap to show only Claude",claude:"Showing Claude sessions — tap to show only Codex",codex:"Showing Codex sessions — tap to show only terminals",terminal:"Showing terminals — tap to show all"};function Mx(e=Date.now()){return`session-${e.toString(36).slice(-6)}`}function Y$(e){return e==="claude"?"CC":e==="codex"?"CX":e==="terminal"?">_":null}function Q$({onToast:e,filter:t,onCycleFilter:n}){const[r,s]=m.useState(!1),[i,o]=m.useState("claude"),[a,l]=m.useState(""),[u,c]=m.useState(""),[f,h]=m.useState(!1),[p,g]=m.useState(Mx),[y,b]=m.useState([]),[x,v]=m.useState("~"),w=m.useRef(null);m.useEffect(()=>{r&&(g(Mx()),l(""),c(""),o("claude"),b([]),IM().then(b).catch(()=>{}),Wp().then(R=>v(R.defaultCwd||"~")).catch(()=>{}),setTimeout(()=>w.current?.focus(),0))},[r]);const k=m.useCallback(()=>{s(!1),l(""),c("")},[]),_=m.useCallback(async()=>{if(f)return;h(!0);const R=i==="codex"?void 0:a.trim()||p,C=u.trim()||void 0;e("Creating session…");try{const M=await MS({name:R,cwd:C,agent:i});e(`Session created → ${M.name}`,"ok"),k()}catch(M){e(`New session failed: ${M.message}`,"error")}finally{h(!1)}},[f,i,a,u,p,e,k]);function S(R){return y.find(C=>C.id===R)}if(!r){const R=Y$(t);return d.jsxs("div",{className:"rail-head",children:[d.jsx("button",{type:"button",className:"rail-new",onClick:()=>s(!0),children:"+ New session"}),d.jsxs("button",{type:"button",className:"rail-filter","data-filter":t,"aria-label":Nx[t],title:Nx[t],onClick:n,children:[d.jsx(PD,{size:15}),R?d.jsx("span",{className:"rail-filter-tag",children:R}):null]})]})}const T=S("claude"),P=S("codex");return d.jsxs("form",{className:"rail-new-form","aria-label":"Create session",onSubmit:R=>{R.preventDefault(),_()},children:[d.jsx("div",{className:"rail-new-agent-seg",role:"group","aria-label":"Agent type",children:["claude","codex"].map(R=>{const C=R==="claude"?T:P,M=C&&!C.available,D=i===R;return d.jsxs("button",{type:"button",className:"rail-new-agent-seg-btn","data-active":D?"true":"false","data-unavailable":M?"true":"false",disabled:f||!!M,title:M?C?.reason:void 0,"aria-pressed":D,onClick:()=>o(R),children:[d.jsx("span",{className:"rail-new-agent-seg-label",children:R==="claude"?"Claude":"Codex"}),M?d.jsx("span",{className:"rail-new-agent-seg-hint","aria-hidden":"true",children:"unavailable"}):null]},R)})}),i==="claude"?d.jsx("input",{ref:w,className:"rail-new-name",type:"text",value:a,placeholder:p,disabled:f,onChange:R=>l(R.target.value),onKeyDown:R=>{R.key==="Escape"&&(R.preventDefault(),k())},"aria-label":"Session name",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}):d.jsx("div",{className:"rail-new-name-note","aria-live":"polite",children:"Codex has no session name"}),d.jsx("input",{className:"rail-new-cwd",type:"text",value:u,placeholder:`(default) ${x}`,disabled:f,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Escape"&&(R.preventDefault(),k())},"aria-label":"Working directory",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsxs("div",{className:"rail-new-actions",children:[d.jsx("button",{type:"button",className:"rail-new-cancel",onClick:k,disabled:f,children:"Cancel"}),d.jsx("button",{type:"submit",className:"rail-new-create",disabled:f,children:f?"Creating…":"Create"})]})]})}const X$="frame";function J$(e){return e==="Escape"}function Z$({sessionId:e,label:t,visible:n,onClose:r}){const s=gM(e),i=m.useRef(null);m.useEffect(()=>{if(!n)return;const h=p=>{J$(p.key)&&r()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[r,n]);const o=()=>{n&&X$==="frame"&&i.current?.focus()},a=m.useRef(!1);m.useEffect(()=>{if(n)o();else if(a.current){try{i.current?.blur()}catch{}const h=document.querySelector(".detail-body")??document.body;h.setAttribute("tabindex","-1"),h.focus({preventScroll:!0})}a.current=n},[n]);const l=m.useRef(r);l.current=r;const u=m.useRef(h=>{(h.metaKey||h.ctrlKey)&&(h.key==="j"||h.key==="J")&&(h.preventDefault(),h.stopPropagation(),l.current())}),c=()=>{const h=i.current?.contentWindow;if(h)try{h.removeEventListener("keydown",u.current,!0),h.addEventListener("keydown",u.current,!0)}catch{}},f=()=>{o(),c()};return m.useEffect(()=>{c()},[]),d.jsxs("div",{className:"term-overlay","data-visible":n?"true":"false",role:"dialog","aria-modal":n?"true":"false","aria-hidden":n?void 0:"true","aria-label":`Raw terminal — ${t}`,children:[d.jsxs("header",{className:"term-head",children:[d.jsxs("span",{className:"term-title",children:[d.jsx("span",{"aria-hidden":"true",children:"⛶"})," ",t]}),d.jsxs("span",{className:"term-actions",children:[d.jsx("a",{className:"term-newtab",href:s,target:"_blank",rel:"noopener noreferrer",title:"Open in a new tab",children:"↗ New tab"}),d.jsx("button",{type:"button",className:"term-close","aria-label":"Close terminal",onClick:r,children:"✕"})]})]}),d.jsx("iframe",{ref:i,className:"term-frame",src:s,title:`Raw terminal for ${t}`,onLoad:f})]})}function e6({children:e}){const[t,n]=m.useState("probing"),[r,s]=m.useState(null),[i,o]=m.useState(""),a=m.useCallback(async()=>{try{return(await st("/api/health")).ok?(n("authed"),s(null),!0):!1}catch{return s("Cannot reach the server. Check the connection and retry."),!1}},[]);m.useEffect(()=>{let u=!1;return(async()=>{const c=await a();u||c||n("needs-token")})(),()=>{u=!0}},[a]),m.useEffect(()=>pM(()=>{n("needs-token"),o(""),s("Session expired — enter your access token again.")}),[]);const l=m.useCallback(async u=>{u.preventDefault();const c=i.trim();if(!c){s("Enter an access token.");return}n("submitting"),s(null),PS(c),await a()||(jS(),n("needs-token"),s("Invalid token."))},[i,a]);return t==="authed"?d.jsx(d.Fragment,{children:e}):t==="probing"?d.jsx("div",{className:"gate-root",role:"status","aria-live":"polite",children:d.jsxs("div",{className:"gate-card gate-card--probing",children:[d.jsx("span",{className:"gate-spinner","aria-hidden":"true"}),d.jsx("span",{className:"gate-probing-text",children:"Connecting…"})]})}):(_c(),d.jsx("div",{className:"gate-root",children:d.jsxs("form",{className:"gate-card",onSubmit:l,"aria-label":"Sign in",children:[d.jsxs("div",{className:"gate-brand",children:[d.jsx("span",{className:"gate-glyph","aria-hidden":"true",children:"◧"}),d.jsx("span",{className:"gate-title",children:"claude control"})]}),d.jsx("label",{className:"gate-label",htmlFor:"gate-token",children:"Access token"}),d.jsx("input",{id:"gate-token",className:"gate-input",type:"password",autoComplete:"current-password",autoFocus:!0,spellCheck:!1,value:i,onChange:u=>{o(u.target.value),r&&s(null)},"aria-invalid":r?!0:void 0,"aria-describedby":r?"gate-error":void 0,placeholder:"••••••••••••"}),r?d.jsx("p",{id:"gate-error",className:"gate-error",role:"alert",children:r}):null,d.jsx("button",{type:"submit",className:"gate-submit",disabled:t==="submitting",children:t==="submitting"?"Connecting…":"Connect"}),d.jsxs("p",{className:"gate-hint",children:["Find your token in ",d.jsx("code",{children:"~/.claude-control/token"})," on the server, or wherever ",d.jsx("code",{children:"CLAUDE_CONTROL_TOKEN"})," is set. It's also printed when the server starts."]})]})}))}const t6={UserMessage:tl,AssistantMessage:Cr,SystemMessage:Cr};function n6({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"plan",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(_t.Root,{className:"plan-review",children:d.jsx(_t.Viewport,{className:"plan-review-viewport",children:d.jsx(_t.Messages,{components:t6})})})})}function r6({prompt:e,onKey:t,onSelect:n,onClose:r,planMarkdown:s,agentName:i="Claude"}){const{rootRef:o,requestClose:a}=mi(r),l=!!e.multiSelect,u=m.useMemo(()=>l?null:e.options.find(M=>M.selected)?.key??e.options[0]?.key??null,[e,l]),[c,f]=m.useState(u),[h,p]=m.useState(null),g=m.useMemo(()=>new Set(e.options.filter(C=>C.checked).map(C=>C.label)),[JSON.stringify(e)]),[y,b]=m.useState(g),[x,v]=m.useState(!1),w=JSON.stringify(e);m.useEffect(()=>{l?(b(g),v(!1)):(f(u),p(null))},[w,u,l]);const k=C=>{h||(p(C),t(C))},_=()=>{c&&k(c)},S=C=>{b(M=>{const D=new Set(M);return D.has(C)?D.delete(C):D.add(C),D})},T=()=>{x||y.size===0||(v(!0),n?.([...y]))};m.useEffect(()=>{const C=M=>{if(l){if(x)return;if(M.key==="Escape"){M.preventDefault(),a();return}if(M.key==="Enter"){M.preventDefault(),T();return}const D=e.options.find(U=>U.key===M.key);D&&(M.preventDefault(),S(D.label))}else{if(h)return;if(M.key==="Escape"){M.preventDefault(),a();return}if(M.key==="Enter"){M.preventDefault(),c&&k(c);return}e.options.some(D=>D.key===M.key)&&(M.preventDefault(),f(M.key))}};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[a,h,c,w,l,x,y]);const P=l?x:h!==null,R=!!s;return d.jsx("div",{className:"modal-backdrop",ref:o,onClick:C=>{C.target===C.currentTarget&&!P&&a()},children:d.jsxs("div",{className:R?"modal modal-plan":"modal",role:"dialog","aria-modal":"true","aria-label":R?"Review plan":"Terminal prompt",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",children:R?"Review plan":`${i} needs a choice`}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Hide",onClick:a,children:"✕"})]}),d.jsxs("div",{className:"modal-body",children:[R?d.jsx(n6,{markdown:s}):null,d.jsxs("div",{className:"question",children:[R?null:d.jsx("div",{className:"q-text",children:e.question}),l?d.jsx("div",{className:"q-hint",children:"select one or more"}):null,l?d.jsx("div",{className:"q-options","aria-label":"Options",children:e.options.map(C=>{const M=y.has(C.label);return d.jsx("button",{type:"button",className:"option-btn","aria-pressed":M,"data-on":M?"true":"false",disabled:P,onClick:()=>S(C.label),children:d.jsxs("span",{className:"option-label",children:[C.key,". ",C.label]})},C.key)})}):d.jsx("div",{className:"q-options",role:"radiogroup","aria-label":"Options",children:e.options.map(C=>d.jsxs("button",{type:"button",className:"option-btn",role:"radio","aria-checked":c===C.key,"data-on":c===C.key?"true":"false","data-sending":h===C.key?"true":void 0,disabled:P,onClick:()=>f(C.key),children:[d.jsxs("span",{className:"option-label",children:[C.key,". ",C.label]}),h===C.key?d.jsxs("span",{className:"option-sending","aria-live":"polite",children:[d.jsx("span",{className:"working-spinner","aria-hidden":"true"})," sending…"]}):null]},C.key))})]})]}),d.jsxs("div",{className:"modal-foot",children:[d.jsxs("button",{type:"button",className:"btn-secondary",disabled:P,onClick:()=>l?a():k("Escape"),children:["Cancel ",d.jsx(rs,{children:"Esc"})]}),d.jsx("span",{className:"modal-foot-spacer"}),P?d.jsx("span",{className:"prompt-status",children:"submitting your answer…"}):null,d.jsxs("button",{type:"button",className:"btn-primary",disabled:P||(l?y.size===0:!c),onClick:l?T:_,children:["Confirm ",d.jsx(rs,{children:"↵"})]})]})]})})}const s6={active:"Active",completed:"Completed",all:"All"};function hC(e){return e.model?e.model:e.def?.model?e.def.model:null}function Om({agentType:e,model:t}){return d.jsxs("span",{className:"agent-chip",children:[d.jsx("span",{className:"agent-chip-name",children:e||"sub-agent"}),t?d.jsx("span",{className:"agent-chip-model",children:t}):null]})}function i6({def:e,agentType:t}){if(!e)return d.jsx("div",{className:"agent-def",children:d.jsx("span",{className:"agent-def-no-def",children:t||"sub-agent"})});const n=new Set(["name","description","tools","model"]),r=Object.keys(e).filter(s=>!n.has(s));return d.jsxs("div",{className:"agent-def",children:[e.description?d.jsx("div",{className:"agent-def-row agent-def-desc",children:e.description}):null,e.tools?d.jsxs("div",{className:"agent-def-row",children:[d.jsx("span",{className:"agent-def-label",children:"tools"}),d.jsx("span",{className:"agent-def-val agent-def-tools",children:e.tools})]}):null,e.model?d.jsxs("div",{className:"agent-def-row",children:[d.jsx("span",{className:"agent-def-label",children:"model"}),d.jsx("span",{className:"agent-def-val",children:e.model})]}):null,r.map(s=>d.jsxs("div",{className:"agent-def-row",children:[d.jsx("span",{className:"agent-def-label",children:s}),d.jsx("span",{className:"agent-def-val",children:e[s]})]},s))]})}function o6({nested:e}){return!e||e.length===0?null:d.jsxs("div",{className:"agent-nested",children:[d.jsxs("span",{className:"agent-nested-label",children:["nested (",e.length,")"]}),d.jsx("div",{className:"agent-nested-list",children:e.map(t=>d.jsx(Om,{agentType:t.agentType,model:t.model},t.agentId))})]})}function a6({agent:e}){const t=hC(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"sa-dot","data-status":e.status,"aria-hidden":"true"}),d.jsx(Om,{agentType:e.agentType,model:t}),e.description?d.jsx("span",{className:"sa-desc",children:e.description}):null,d.jsx("span",{className:"sa-status",children:e.status==="running"?"· running":"· done"})]})}function l6({subagents:e,open:t,onClose:n,focusAgentId:r}){const[s,i]=m.useState("active"),[o,a]=m.useState(null);m.useEffect(()=>{t&&r&&a(r)},[t,r]);const l=e.filter(p=>p.status==="running").length,u={active:l,completed:e.length-l,all:e.length},c=o?e.find(p=>p.agentId===o)??null:null,f=m.useMemo(()=>e.filter(p=>s==="all"?!0:s==="active"?p.status==="running":p.status==="done"),[e,s]),h=m.useRef(null);if(m.useEffect(()=>{!t||!h.current||Jt()||ce.fromTo(h.current,{x:28,opacity:0},{x:0,opacity:1,duration:.28,ease:"power3.out"})},[t,!!c]),!t)return null;if(c){const p=hC(c);return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sa-backdrop","aria-hidden":"true",onClick:n}),d.jsxs("div",{className:"sa-panel",ref:h,role:"complementary","aria-label":"Sub-agent transcript",children:[d.jsxs("header",{className:"sa-panel-head",children:[d.jsx("button",{type:"button",className:"sa-back","aria-label":"Back to list",onClick:()=>a(null),children:"‹"}),d.jsxs("span",{className:"sa-panel-title sa-detail-title",children:[d.jsx("span",{className:"sa-dot","data-status":c.status,"aria-hidden":"true"}),d.jsx(Om,{agentType:c.agentType,model:p}),d.jsx("span",{className:"sa-status",children:c.status==="running"?"· running":"· done"})]}),d.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close",onClick:n,children:"×"})]}),d.jsx(i6,{def:c.def,agentType:c.agentType}),d.jsx(o6,{nested:c.nested}),d.jsx(Lm,{messages:c.messages})]})]})}return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sa-backdrop","aria-hidden":"true",onClick:n}),d.jsxs("div",{className:"sa-panel",ref:h,role:"complementary","aria-label":"Sub-agents",children:[d.jsxs("header",{className:"sa-panel-head",children:[d.jsxs("span",{className:"sa-panel-title",children:["Sub-agents ",d.jsx("span",{className:"sa-count",children:e.length}),l?d.jsxs("span",{className:"sa-count-running",children:[l," running"]}):null]}),d.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close sub-agents panel",onClick:n,children:"×"})]}),d.jsx("div",{className:"sa-tabs",role:"tablist",children:["active","completed","all"].map(p=>d.jsxs("button",{type:"button",role:"tab","aria-selected":s===p,className:"sa-tab","data-on":s===p?"true":void 0,onClick:()=>i(p),children:[s6[p],d.jsx("span",{className:"sa-tab-count",children:u[p]})]},p))}),d.jsx("div",{className:"sa-panel-body",children:f.length===0?d.jsxs("div",{className:"sa-empty",children:["No ",s==="all"?"":`${s} `,"sub-agents."]}):f.map(p=>d.jsxs("button",{type:"button",className:"sa-item-row",onClick:()=>a(p.agentId),children:[d.jsx(a6,{agent:p}),d.jsx("span",{className:"sa-chevron","aria-hidden":"true",children:"›"})]},p.agentId))})]})]})}const u6=3e3,Dx=10*6e4;function Lx({points:e,field:t,now:n,floor:r,color:s}){const a=n-Dx,l=e.filter(g=>g.t>=a),u=g=>(g-a)/Dx*300,c=Math.max(r,...l.map(g=>g[t]),1),f=g=>46-g/c*46,h=l.map(g=>`${u(g.t).toFixed(1)},${f(g[t]).toFixed(1)}`).join(" "),p=[2,4,6,8].map(g=>u(n-g*6e4));return d.jsxs("svg",{className:"proc-chart",viewBox:"0 0 300 46",preserveAspectRatio:"none","aria-hidden":"true",children:[p.map((g,y)=>d.jsx("line",{x1:g,y1:0,x2:g,y2:46,className:"proc-chart-grid"},y)),l.length>=2?d.jsxs(d.Fragment,{children:[d.jsx("polyline",{points:`${u(l[0].t).toFixed(1)},46 ${h} ${u(l[l.length-1].t).toFixed(1)},46`,fill:s,fillOpacity:"0.12",stroke:"none"}),d.jsx("polyline",{points:h,fill:"none",stroke:s,strokeWidth:"1.5",vectorEffect:"non-scaling-stroke"})]}):null]})}function c6({power:e,history:t,onClose:n,onToast:r}){const{rootRef:s,requestClose:i}=mi(n),[o,a]=m.useState(null),[l,u]=m.useState(null),[c,f]=m.useState(null),h=Date.now(),p=t.length?t[t.length-1]:null,g=p?.cpu??null,y=p?.mem??null,b=m.useCallback(()=>{jM().then(a).catch(v=>r(`ps failed: ${v.message}`,"error"))},[r]);m.useEffect(()=>{b();const v=setInterval(b,u6);return()=>clearInterval(v)},[b]),m.useEffect(()=>{const v=w=>{w.key==="Escape"&&i()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[i]);const x=m.useCallback(async(v,w)=>{f(v);try{await AM(v,w?"SIGKILL":"SIGTERM"),r(`Sent ${w?"SIGKILL":"SIGTERM"} → ${v}`,"ok"),u(null),b()}catch(k){r(`kill ${v} failed: ${k.message}`,"error")}finally{f(null)}},[r,b]);return d.jsx("div",{className:"modal-backdrop",ref:s,onClick:v=>{v.target===v.currentTarget&&i()},children:d.jsxs("div",{className:"modal modal-process",role:"dialog","aria-modal":!0,"aria-label":"Processes & system",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-head-group",children:[d.jsx("span",{className:"modal-title",children:"Processes & system"}),e&&e.hasBattery?d.jsxs("span",{className:"proc-power","data-low":e.low?"true":void 0,children:[d.jsx(Lk,{size:20,level:(e.percent??0)/100,charging:!!e.charging}),e.percent!=null?`${e.percent}%`:"—",e.charging?" · charging":"",e.low?" · low":""]}):null]}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:i,children:d.jsx(dh,{size:16})})]}),d.jsxs("div",{className:"modal-body proc-body",children:[d.jsxs("div",{className:"proc-graphs",children:[d.jsxs("div",{className:"proc-graph",children:[d.jsxs("div",{className:"proc-graph-head",children:[d.jsx("span",{className:"proc-graph-label",children:"CPU"}),d.jsx("span",{className:"proc-graph-val",children:g!=null?`${g.toFixed(0)}%`:"—"})]}),d.jsx(Lx,{points:t,field:"cpu",now:h,floor:100,color:"var(--accent)"})]}),d.jsxs("div",{className:"proc-graph",children:[d.jsxs("div",{className:"proc-graph-head",children:[d.jsx("span",{className:"proc-graph-label",children:"MEM"}),d.jsx("span",{className:"proc-graph-val",children:y!=null?`${y.toFixed(0)}%`:"—"})]}),d.jsx(Lx,{points:t,field:"mem",now:h,floor:100,color:"var(--accent-2)"})]}),d.jsxs("div",{className:"proc-graph-axis",children:[d.jsx("span",{children:"10m ago"}),d.jsx("span",{children:"5m"}),d.jsx("span",{children:"now"})]})]}),d.jsxs("div",{className:"proc-row proc-head",children:[d.jsx("span",{className:"proc-pid",children:"PID"}),d.jsx("span",{className:"proc-cpu",children:"CPU%"}),d.jsx("span",{className:"proc-mem",children:"MEM"}),d.jsx("span",{className:"proc-cmd",children:"COMMAND"}),d.jsx("span",{className:"proc-act"})]}),o==null?d.jsx("div",{className:"proc-empty",children:"loading…"}):o.length===0?d.jsx("div",{className:"proc-empty",children:"no processes"}):o.map(v=>d.jsxs("div",{className:"proc-row",children:[d.jsx("span",{className:"proc-pid",children:v.pid}),d.jsx("span",{className:"proc-cpu","data-hot":v.cpu>=50?"true":void 0,children:v.cpu.toFixed(0)}),d.jsxs("span",{className:"proc-mem",children:[v.rssMB,"m"]}),d.jsx("span",{className:"proc-cmd",title:v.command,children:v.command}),d.jsx("span",{className:"proc-act",children:l===v.pid?d.jsxs("span",{className:"proc-confirm",children:[d.jsx("button",{type:"button",className:"proc-kill-yes",disabled:c===v.pid,title:"SIGTERM (shift-click for SIGKILL)",onClick:w=>x(v.pid,w.shiftKey),children:c===v.pid?"…":"Kill"}),d.jsx("button",{type:"button",className:"proc-kill-no",onClick:()=>u(null),children:"Cancel"})]}):d.jsx("button",{type:"button",className:"proc-kill","aria-label":`Kill process ${v.pid}`,title:"Kill process",onClick:()=>u(v.pid),children:d.jsx(dh,{size:14})})})]},v.pid))]})]})})}function Ox(e,t){let n=0;for(let r=0;r<e.length&&n<t.length;r++)e[r]===t[n]&&n++;return n===t.length}function d6(e,t){if(!t)return 1;const n=t.toLowerCase().trim(),r=e.label.toLowerCase(),s=[e.hint??"",e.keywords??"",e.group??""].join(" ").toLowerCase();if(r===n)return 1e3;if(r.startsWith(n))return 700-r.length;const i=r.indexOf(n);if(i>=0)return(i===0||!/[a-z0-9]/.test(r[i-1])?550:400)-r.length;const o=s.indexOf(n);return o>=0?220-o:Ox(r,n)?120:Ox(s,n)?60:0}function f6(e,t){const n=[],r=new Map;e.forEach((o,a)=>{const l=d6(o,t);if(l<=0)return;const u=o.group;r.has(u)||(r.set(u,[]),n.push(u)),r.get(u).push({cmd:o,score:l,i:a})});const s=n.map(o=>{const a=r.get(o).sort((l,u)=>u.score-l.score||l.i-u.i).map(l=>l.cmd);return{group:o,items:a}}),i=s.flatMap(o=>o.items);return{sections:s,flat:i}}function h6({commands:e,onClose:t}){const{rootRef:n,requestClose:r}=mi(t),[s,i]=m.useState(""),[o,a]=m.useState(0),l=m.useRef(null),u=m.useRef(null);m.useEffect(()=>{l.current?.focus({preventScroll:!0})},[]);const{sections:c,flat:f}=m.useMemo(()=>f6(e,s),[e,s]),h=m.useMemo(()=>{const y=new Map;return f.forEach((b,x)=>y.set(b.id,x)),y},[f]);m.useEffect(()=>{a(y=>f.length===0?0:Math.min(y,f.length-1))},[f.length]);const p=m.useCallback(y=>{i(y.target.value),a(0)},[]),g=m.useCallback(y=>{y&&(y.run(),r())},[r]);return m.useEffect(()=>{const y=b=>{const x=f.length;if(b.key==="Escape"){b.preventDefault(),r();return}if((b.metaKey||b.ctrlKey)&&/^[1-9]$/.test(b.key)){b.preventDefault(),g(f[Number(b.key)-1]);return}x!==0&&(b.key==="ArrowDown"||b.key==="Tab"&&!b.shiftKey?(b.preventDefault(),a(v=>(v+1)%x)):b.key==="ArrowUp"||b.key==="Tab"&&b.shiftKey?(b.preventDefault(),a(v=>(v-1+x)%x)):b.key==="Enter"&&(b.preventDefault(),g(f[o])))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[f,o,g,r]),m.useEffect(()=>{const y=u.current;if(!y)return;y.querySelector(`[data-index="${o}"]`)?.scrollIntoView({block:"nearest"})},[o]),d.jsx("div",{className:"cmdk-backdrop",ref:n,onClick:y=>{y.target===y.currentTarget&&r()},children:d.jsxs("div",{className:"cmdk-panel",role:"dialog","aria-modal":!0,"aria-label":"Command palette",children:[d.jsxs("div",{className:"cmdk-search-row",children:[d.jsx("span",{className:"cmdk-search-icon","aria-hidden":!0,children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[d.jsx("circle",{cx:"6.5",cy:"6.5",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),d.jsx("line",{x1:"10.5",y1:"10.5",x2:"14",y2:"14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),d.jsx("input",{ref:l,className:"cmdk-input",type:"text",placeholder:"Search commands…",value:s,onChange:p,autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,autoComplete:"off"}),s&&d.jsx("button",{className:"cmdk-clear",onClick:()=>{i(""),a(0),l.current?.focus()},tabIndex:-1,"aria-label":"Clear search",children:"×"})]}),d.jsx("ul",{className:"cmdk-list",ref:u,role:"listbox","aria-label":"Commands",children:f.length===0?d.jsx("li",{className:"cmdk-empty",role:"option","aria-selected":!1,children:"No matches"}):c.map(y=>d.jsxs("li",{className:"cmdk-section",children:[y.group!==void 0&&d.jsx("div",{className:"cmdk-group-header",role:"presentation",children:y.group}),d.jsx("ul",{className:"cmdk-section-list",role:"presentation",children:y.items.map(b=>{const x=h.get(b.id)??0,v=x===o,w=b.hotkey??(x<9?`⌘${x+1}`:null);return d.jsxs("li",{className:`cmdk-row${v?" cmdk-row--active":""}`,role:"option","aria-selected":v,"data-index":x,onClick:()=>g(b),onMouseMove:()=>a(x),children:[d.jsx("span",{className:"cmdk-row-label",children:b.label}),b.hint&&d.jsx("span",{className:"cmdk-row-hint",children:b.hint}),w&&d.jsx("span",{className:"cmdk-row-key",children:w})]},b.id)})})]},y.group??"__ungrouped__"))})]})})}function pC(e=0){const[t,n]=m.useState(!1);return m.useEffect(()=>{if(typeof window>"u")return;let r=null,s=!1;const i=()=>{r!=null&&(clearTimeout(r),r=null),s&&(s=!1,n(!1))},o=u=>{u.key!=="Meta"&&u.key!=="Control"||s||r!=null||(r=setTimeout(()=>{r=null,s=!0,n(!0)},e))},a=u=>{(u.key==="Meta"||u.key==="Control")&&i()},l=()=>{document.hidden&&i()};return window.addEventListener("keydown",o),window.addEventListener("keyup",a),window.addEventListener("blur",i),document.addEventListener("visibilitychange",l),()=>{i(),window.removeEventListener("keydown",o),window.removeEventListener("keyup",a),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",l)}},[e]),t}function p6(e){return e.length*8.5+18}function zx(){const e=document.querySelectorAll("[data-hotkey]"),t=[];e.forEach((i,o)=>{const a=i.getBoundingClientRect();if(a.width===0||a.height===0)return;const l=i.getAttribute("data-hotkey")??"",u=i.getAttribute("data-hotkey-dir"),c=28,f=6,h=p6(l);if(u==="right"){const b=a.top+a.height/2-c/2,x=a.right-8-h/2;t.push({key:`hint-${o}`,label:l,top:b,left:x,width:h,placedAbove:!1});return}const p=u==="down"?!1:u==="up"?!0:a.top>=c+f+4,g=p?a.top-c-f:a.bottom+f,y=a.left+a.width/2;t.push({key:`hint-${o}`,label:l,top:g,left:y,width:h,placedAbove:p})});const n=4,r=new Map;for(const i of t){const o=Math.round(i.top/8);r.has(o)||r.set(o,[]),r.get(o).push(i)}for(const i of r.values()){i.sort((o,a)=>o.left-a.left);for(let o=1;o<i.length;o++){const a=i[o-1].left+i[o-1].width/2;i[o].left-i[o].width/2<a+n&&(i[o].left=a+n+i[o].width/2)}}const s=6;for(const i of t)i.left=Math.max(i.width/2+s,Math.min(window.innerWidth-i.width/2-s,i.left));return t}function m6(){const e=pC(500),[t,n]=m.useState([]),r=m.useRef(null);return m.useEffect(()=>{if(!e){n([]),r.current!==null&&(cancelAnimationFrame(r.current),r.current=null);return}n(zx());function s(){n(zx())}return window.addEventListener("scroll",s,{capture:!0,passive:!0}),window.addEventListener("resize",s,{passive:!0}),()=>{window.removeEventListener("scroll",s,{capture:!0}),window.removeEventListener("resize",s)}},[e]),!e||t.length===0?null:t_.createPortal(d.jsx(d.Fragment,{children:t.map(s=>d.jsx("div",{className:"hotkey-hint","data-above":s.placedAbove?"true":"false",style:{position:"fixed",top:s.top,left:s.left,pointerEvents:"none"},"aria-hidden":"true",children:s.label},s.key))}),document.body)}const mC=typeof CSS<"u"&&"highlights"in CSS,gC="transcript-search",Th="transcript-search-active";function Ml(){mC&&(CSS.highlights.delete(gC),CSS.highlights.delete(Th))}function g6(e,t){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s;for(;s=r.nextNode();)t&&t.contains(s)||s.data.trim()&&n.push(s);return n}function y6(e,t){if(!t)return[];const n=t.toLowerCase(),r=[];for(const s of e){const o=s.data.toLowerCase();let a=0;for(;a<=o.length-n.length;){const l=o.indexOf(n,a);if(l===-1)break;const u=document.createRange();u.setStart(s,l),u.setEnd(s,l+n.length),r.push({range:u,el:s.parentElement??document.body}),a=l+n.length}}return r}function Fx(e,t){if(!mC)return;const n=e.map(r=>r.range);CSS.highlights.set(gC,new Highlight(...n)),e.length>0&&t>=0&&t<e.length?CSS.highlights.set(Th,new Highlight(e[t].range)):CSS.highlights.delete(Th)}function Bx(e){if(e.range.getBoundingClientRect){const t=e.range.getBoundingClientRect();if(t.width>0||t.height>0){e.el.scrollIntoView({block:"center"});return}}e.el.scrollIntoView({block:"center"})}function v6({open:e,onClose:t}){const[n,r]=m.useState(""),[s,i]=m.useState([]),[o,a]=m.useState(0),l=m.useRef(null),u=m.useRef(null),c=m.useRef(null),f=m.useRef(null),h=m.useRef(null),p=m.useCallback(_=>{const S=document.querySelector(".thread-viewport");if(!S){Ml(),i([]),a(0);return}const T=_.trim();if(!T){Ml(),i([]),a(0);return}const P=g6(S,u.current),R=y6(P,T);i(R),a(C=>{const M=R.length>0?Math.min(C,R.length-1):0;return Fx(R,M),R.length>0&&Bx(R[M]),M})},[]),g=m.useCallback(_=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>p(_),120)},[p]);m.useEffect(()=>{if(!e)return;const _=document.querySelector(".thread-viewport");if(_)return f.current=new MutationObserver(()=>{h.current||(h.current=setTimeout(()=>{h.current=null;const S=l.current?.value??"";p(S)},200))}),f.current.observe(_,{childList:!0,subtree:!0,characterData:!0}),()=>{f.current?.disconnect(),f.current=null,h.current&&(clearTimeout(h.current),h.current=null)}},[e,p]),m.useEffect(()=>{e?(setTimeout(()=>l.current?.focus(),0),n.trim()&&g(n)):(Ml(),i([]),a(0),c.current&&clearTimeout(c.current))},[e]),m.useEffect(()=>()=>{Ml(),c.current&&clearTimeout(c.current)},[]);const y=m.useCallback(_=>{if(!s.length)return;const S=(_%s.length+s.length)%s.length;a(S),Fx(s,S),Bx(s[S])},[s]),b=m.useCallback(()=>y(o+1),[y,o]),x=m.useCallback(()=>y(o-1),[y,o]),v=m.useCallback(_=>{_.key==="Escape"?(_.preventDefault(),t()):_.key==="Enter"&&(_.preventDefault(),_.shiftKey?x():b())},[t,b,x]);if(!e)return null;const w=s.length,k=w>0?o+1:0;return d.jsxs("div",{className:"transcript-search",ref:u,role:"search","aria-label":"Search transcript",children:[d.jsx("input",{ref:l,className:"transcript-search-input",type:"search",placeholder:"Search…",value:n,"aria-label":"Search query",onChange:_=>{r(_.target.value),g(_.target.value)},onKeyDown:v,autoComplete:"off",spellCheck:!1}),d.jsx("span",{className:"transcript-search-count","aria-live":"polite","aria-atomic":"true",children:w===0?n.trim()?"0":"":`${k}/${w}`}),d.jsx("button",{type:"button",className:"transcript-search-nav",title:"Previous match (Shift+Enter)","aria-label":"Previous match",onClick:x,disabled:w===0,children:"↑"}),d.jsx("button",{type:"button",className:"transcript-search-nav",title:"Next match (Enter)","aria-label":"Next match",onClick:b,disabled:w===0,children:"↓"}),d.jsx("button",{type:"button",className:"transcript-search-close",title:"Close search (Esc)","aria-label":"Close search",onClick:t,children:d.jsx(dh,{size:14})})]})}function x6(e){return e?e===!0?"Using a sub-agent":`Using the ${e} sub-agent`:""}function w6(e,t){const n=x6(t);return!n||!e?e:`${n}. ${e}`}function b6(e){return(e.blocks??[]).filter(t=>t.kind==="text").map(t=>t.text).join(" ")}const _6=18e5,yC="cc_drafts";function S6(){try{return JSON.parse(localStorage.getItem(yC)||"{}")||{}}catch{return{}}}function k6(e){try{localStorage.setItem(yC,JSON.stringify(e))}catch{}}const vC="cc_subagent";function $x(){try{return JSON.parse(localStorage.getItem(vC)||"{}")||{}}catch{return{}}}function C6(e){try{localStorage.setItem(vC,JSON.stringify(e))}catch{}}const Ux=150,E6=150;function T6(e){return typeof e.content=="string"?e.content:e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
103
|
+
`)}function I6(){const e=BM(),t=VM(),[n,r]=m.useState(null),s=m.useRef(0),i=m.useCallback((A,L="")=>{r({id:++s.current,text:A,kind:L})},[]);m.useEffect(()=>{const A=()=>{const L=/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,K=L&&(window.screen.width>1200||window.innerWidth>1200);document.body.classList.toggle("is-ipad",L),document.body.classList.toggle("is-external-display",K)};return A(),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[]),m.useEffect(()=>{let A=0,L=0,K=!0;const G=()=>{if(!K)return;const Be=document.body.classList.contains("is-external-display")&&L>0?L:A>0?A:0;Be>0?document.documentElement.style.setProperty("--txt-transcript",`${Be}px`):document.documentElement.style.removeProperty("--txt-transcript")};return Wp().then(Oe=>{K&&(A=Oe.transcriptFontSize??0,L=Oe.externalFontSize??0,G())}).catch(()=>{}),window.addEventListener("resize",G),()=>{K=!1,window.removeEventListener("resize",G)}},[]),m.useEffect(()=>{const A=L=>{const K=L.detail;K.ok?K.op==="answer"&&i("Answer sent →","ok"):i(`${K.op} failed: ${K.error??"error"}`,"error")};return window.addEventListener("cockpit:ack",A),()=>window.removeEventListener("cockpit:ack",A)},[i]);const o=m.useMemo(()=>i2(i),[i]),a=m.useMemo(()=>({output:e.shellOutput,run:e.sendShellInput,text:e.sendShellText,key:e.sendShellKey,poll:e.requestShellCapture,clear:e.clearShellOutput}),[e.shellOutput,e.sendShellInput,e.sendShellText,e.sendShellKey,e.requestShellCapture,e.clearShellOutput]),[l,u]=m.useState([]),c=m.useRef(0),f=m.useRef(!1),h=m.useCallback(A=>{f.current=A},[]),[p,g]=m.useState(null),y=m.useCallback(async A=>{const L=T6(A).trim(),K=(A.attachments??[]).map(Ft=>r2(Ft)).filter(Ft=>!!Ft),G=e.selectedId,Oe=G!=null?C.current[G]??!0:!1,$e=!f.current&&L?w6(L,Oe):L,pn=[$e,...K].filter(Boolean).join(" ");if(!pn)return;const Gn=e.sendReply(pn);if(i(Gn?"Sent →":"Not connected — reconnecting…",Gn?"ok":"error"),Gn&&G){const Ft=$e||(K.length?`📎 ${K.length} attachment(s)`:pn);u(Yn=>[...Yn,{key:++c.current,sessionId:G,text:pn,label:Ft,at:Date.now()}])}},[e,i]),b=m.useRef({});m.useEffect(()=>{const A=e.selectedId;if(!A)return;const L=e.messages,K=b.current[A],G=K==null?L.length:Math.min(K,L.length);if(L.length>G){const Oe=[];for(let Be=G;Be<L.length;Be++){if(L[Be].role!=="user")continue;const $e=b6(L[Be]).trim();$e&&Oe.push($e)}if(Oe.length){const Be=$e=>$e.replace(/\s+/g," ").trim();u($e=>{const pn=[...$e];for(const Gn of Oe){const Ft=Be(Gn),Yn=pn.map((Qn,Pr)=>({e:Qn,i:Pr})).filter(({e:Qn})=>Qn.sessionId===A);if(Yn.length===0)continue;const xi=Yn.find(({e:Qn})=>{const Pr=Be(Qn.text),nl=Be(Qn.label);return Pr===Ft||nl===Ft||Ft.startsWith(nl)||Pr.startsWith(Ft)})??Yn[0];pn.splice(xi.i,1)}return pn})}}b.current[A]=L.length},[e.selectedId,e.messages]),m.useEffect(()=>{if(l.length===0)return;const A=setInterval(()=>{const L=Date.now()-_6;u(K=>K.some(G=>G.at<L)?K.filter(G=>G.at>=L):K)},5e3);return()=>clearInterval(A)},[l.length]),m.useEffect(()=>{if(!p)return;if(e.selectedId!==p.sessionId||e.messages.length>p.baseCount){g(null);return}const A=setTimeout(()=>g(null),9e4);return()=>clearTimeout(A)},[p,e.selectedId,e.messages.length]);const[x,v]=m.useState(Ux);m.useEffect(()=>{v(Ux)},[e.selectedId]);const w=m.useMemo(()=>OS(e.messages),[e.messages]),k=Math.max(0,w.length-x),_=m.useMemo(()=>l.filter(A=>A.sessionId===e.selectedId),[l,e.selectedId]),S=m.useMemo(()=>{if(!e.prompt)return null;const A=e.messages;for(let L=A.length-1;L>=0;L--)for(const K of A[L].blocks??[])if(K.kind==="tool_use"&&K.name==="ExitPlanMode"){const G=K.input?.plan;if(typeof G=="string"&&G.trim())return G}return null},[e.prompt,e.messages]),T=m.useMemo(()=>{const A=k>0?w.slice(k):w.slice();for(const G of _){const Oe={role:"user",id:`queued-${G.key}`,createdAt:new Date(G.at),content:[{type:"text",text:G.label}],metadata:{custom:{cockpitRole:"user",optimistic:!0}}};let Be=A.length;for(let $e=0;$e<A.length;$e++){const pn=A[$e].createdAt;if(pn instanceof Date&&pn.getTime()>G.at){Be=$e;break}}A.splice(Be,0,Oe)}const L=e.sessions.find(G=>G.id===e.selectedId);return(!!L&&fh(L)||p!==null&&p.sessionId===e.selectedId)&&A.push({role:"assistant",id:"optimistic-working",content:[{type:"text",text:"Working…"}],metadata:{custom:{cockpitRole:"assistant",working:!0}}}),A},[w,k,e.selectedId,e.sessions,_,p]),P=m.useCallback(()=>{v(A=>A+E6)},[]),R=Ya({messages:T,isDisabled:!e.selectedId,convertMessage:A=>A,onNew:y,adapters:{attachments:o}}),C=m.useRef($x()),[M,D]=m.useState(()=>$x()),U=m.useCallback((A,L)=>{D(K=>{const G={...K,[A]:L};return C.current=G,C6(G),G})},[]),V=m.useRef(S6()),W=m.useRef(e.selectedId);m.useEffect(()=>{const A=R.thread.composer,L=()=>{const K=W.current;if(!K)return;const G=A.getState().text??"";G?V.current[K]=G:delete V.current[K],k6(V.current)};return A.subscribe(L)},[R]),m.useEffect(()=>{const A=R.thread.composer,L=e.selectedId,K=L?V.current[L]??"":"";W.current=L;try{A.reset(),K&&A.setText(K)}catch{}},[e.selectedId,R]);const[J,ne]=m.useState(null),[$,F]=m.useState(!1),[E,X]=m.useState(!1),[Z,I]=m.useState(!1),O=4,[te,de]=m.useState([]),[it,Ke]=m.useState(!1),je=m.useCallback(A=>{de(L=>{const K=[...L.filter(G=>G!==A),A];return K.length>O?K.slice(K.length-O):K})},[]);m.useEffect(()=>{Ke(!1);const A=e.selectedId;if(!A)return;const L=setTimeout(()=>{de(K=>K.includes(A)?[...K.filter(G=>G!==A),A]:K.length<O?[...K,A]:K)},500);return()=>clearTimeout(L)},[e.selectedId]);const xe=m.useCallback(()=>{const A=e.selectedId;A&&(je(A),Ke(!0))},[e.selectedId,je]),oe=m.useCallback(()=>{const A=e.selectedId;A&&Ke(L=>(L||je(A),!L))},[e.selectedId,je]),[le,se]=m.useState(!1),[we,He]=m.useState(null),[Ge,Et]=m.useState(null),[qn,Tr]=m.useState(!1),[ue,So]=m.useState(null);m.useEffect(()=>{se(!1),Et(null)},[e.selectedId]);const yi=m.useCallback(A=>{Et(L=>L===A?null:A)},[]),lr=m.useCallback(()=>Et(null),[]),[Kn,jn]=m.useState(null),z=m.useRef(null),Q=Kn!==null;m.useEffect(()=>{Q&&z.current?.select()},[Q]);const ie=m.useCallback(async()=>{const A=e.selectedId,L=(Kn??"").trim();if(jn(null),!A||!L)return;const K=e.sessions.find(G=>G.id===A)?.name;if(L!==K)try{await RM(A,L),i("Renamed →","ok")}catch(G){i(`rename failed: ${G instanceof Error?G.message:"error"}`,"error")}},[e.selectedId,e.sessions,Kn,i]),[fe,Ce]=m.useState(!0),ot=Dm(),dn=m.useRef(null),Ot=m.useRef(null),[Tt,Ir]=m.useState(()=>{try{return localStorage.getItem("cc:railCollapsed")==="1"}catch{return!1}}),at=m.useCallback(()=>{Ir(A=>{const L=!A;try{localStorage.setItem("cc:railCollapsed",L?"1":"0")}catch{}return L})},[]),[j,B]=m.useState(()=>{try{const A=localStorage.getItem("cc:sessionFilter");return A==="claude"||A==="codex"||A==="terminal"?A:"all"}catch{return"all"}}),re=m.useCallback(()=>{B(A=>{const L=A==="all"?"claude":A==="claude"?"codex":A==="codex"?"terminal":"all";try{localStorage.setItem("cc:sessionFilter",L)}catch{}return L})},[]),[ge,Te]=m.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem("cc:collapsedSessions")||"[]"))}catch{return new Set}}),Le=m.useCallback(A=>{Te(L=>{const K=new Set(L);K.has(A)?K.delete(A):K.add(A);try{localStorage.setItem("cc:collapsedSessions",JSON.stringify([...K]))}catch{}return K})},[]),Re=m.useRef(!1);m.useEffect(()=>{const A=dn.current;if(!A)return;if(ot){ce.set(A,{clearProps:"width,flexBasis,opacity"});return}const L=Tt?{width:0,flexBasis:0,opacity:0}:{width:300,flexBasis:300,opacity:1};if(Jt()||!Re.current){ce.set(A,L),Re.current=!0;return}ce.to(A,{...L,duration:.3,ease:"power3.out"})},[Tt,ot]),m.useEffect(()=>{const A=Ot.current;if(!A||!e.selectedId||Jt())return;const L=A.querySelector(".thread-viewport")??A.querySelector(".live-pane")??A.querySelector(".terminal-pane-root");L&&ce.fromTo(L,{opacity:.35,y:6},{opacity:1,y:0,duration:.22,ease:"power3.out"})},[e.selectedId]),m.useEffect(()=>{if(!e.selectedId)return;let A=null,L=null,K=null,G=null,Oe=0,Be=0,$e=0,pn=0,Gn=!0,Ft=!1,Yn=!0,xi=0;const Qn=()=>!!A&&A.scrollHeight-A.scrollTop-A.clientHeight<80,Pr=()=>{L&&(L.dataset.show=A&&!Qn()?"true":"")},nl=()=>{Be||(Be=requestAnimationFrame(()=>{Be=0,A&&(Gn||Yn)&&!Ft&&(A.scrollTop=A.scrollHeight)}))},zm=()=>{Yn&&(Yn=!1,clearTimeout(xi),Gn=Qn(),Pr())},Fm=()=>{!Ft&&!Yn&&(Gn=Qn()),Pr()},Mc=()=>{Ft=!0,zm(),clearTimeout($e)},Co=()=>{clearTimeout($e),$e=window.setTimeout(()=>{Ft=!1,Gn=Qn(),Pr()},160)},Bm=()=>{Mc(),Co()},$m=()=>{if(A=document.querySelector(".thread-viewport"),L=document.querySelector(".scroll-to-bottom"),!A){pn++<40&&(Oe=requestAnimationFrame($m));return}Gn=!0,Yn=!0,A.scrollTop=A.scrollHeight,Pr(),clearTimeout(xi),xi=window.setTimeout(zm,600),A.addEventListener("scroll",Fm,{passive:!0}),A.addEventListener("touchstart",Mc,{passive:!0}),A.addEventListener("touchend",Co,{passive:!0}),A.addEventListener("touchcancel",Co,{passive:!0}),A.addEventListener("wheel",Bm,{passive:!0}),K=new MutationObserver(nl),K.observe(A,{childList:!0,subtree:!0,characterData:!0});const Dc=A.closest(".thread-root"),Lc=Dc?.querySelector(".composer")??null;if(Dc&&Lc&&"ResizeObserver"in window){const Um=()=>Dc.style.setProperty("--composer-h",`${Lc.offsetHeight}px`);Um(),G=new ResizeObserver(Um),G.observe(Lc)}};return Oe=requestAnimationFrame($m),()=>{cancelAnimationFrame(Oe),cancelAnimationFrame(Be),clearTimeout($e),clearTimeout(xi),A&&(A.removeEventListener("scroll",Fm),A.removeEventListener("touchstart",Mc),A.removeEventListener("touchend",Co),A.removeEventListener("touchcancel",Co),A.removeEventListener("wheel",Bm)),K&&K.disconnect(),G&&G.disconnect()}},[e.selectedId]);const ye=m.useCallback(A=>{e.select(A),Ce(!1),window.location.hash=encodeURIComponent(A)},[e]);m.useEffect(()=>{if(!("serviceWorker"in navigator))return;const A=L=>{const K=L.data;K?.type==="open-session"&&K.id&&ye(K.id)};return navigator.serviceWorker.addEventListener("message",A),()=>navigator.serviceWorker.removeEventListener("message",A)},[ye]);const fn=typeof window<"u"&&(window.matchMedia?.("(display-mode: standalone)").matches||navigator.standalone===!0),Yr=t.iosHint&&!fn&&t.status!=="on",zt=m.useRef(!1);m.useEffect(()=>{const A=()=>{const L=decodeURIComponent(window.location.hash.replace(/^#/,""));L&&L!==e.selectedId&&e.sessions.some(K=>K.id===L)&&(e.select(L),Ce(!1))};if(!zt.current&&e.sessions.length>0){zt.current=!0;const L=decodeURIComponent(window.location.hash.replace(/^#/,""));L&&L!==e.selectedId&&e.sessions.some(K=>K.id===L)&&(e.select(L),ot||Ce(!1))}return window.addEventListener("hashchange",A),()=>window.removeEventListener("hashchange",A)},[e,e.sessions,e.selectedId,ot]);const ve=e.sessions.find(A=>A.id===e.selectedId),gt=2e4,qt=_.length>0&&_.some(A=>Date.now()-A.at<gt),An=!!ve&&fh(ve)||qt,hn=m.useCallback(()=>{e.sendPromptKey("Escape"),i("Canceled →")},[e,i]),Kt=e.selectedId!=null?M[e.selectedId]??!0:!0,Gt=m.useCallback(A=>{e.selectedId&&U(e.selectedId,A)},[e.selectedId,U]);m.useEffect(()=>{const A=L=>{(L.metaKey||L.ctrlKey)&&(L.key==="k"||L.key==="K")&&(L.preventDefault(),X(K=>!K))};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[]),m.useEffect(()=>{const A=L=>{if(!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey)return;const K=L.key.toLowerCase();K==="b"?(L.preventDefault(),at()):K==="e"&&ve?(L.preventDefault(),jn(ve.name??ve.id)):K==="j"&&ve?(L.preventDefault(),oe()):K==="u"&&e.subagents.length>0&&(L.preventDefault(),He(null),se(G=>!G))};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[ve,e.subagents.length,at,oe]);const Nn=m.useMemo(()=>j==="terminal"?[]:e.sessions.filter(A=>A.kind!=="terminal"&&!ge.has(A.sessionName??"?")).sort((A,L)=>(A.sessionName??"").localeCompare(L.sessionName??"",void 0,{numeric:!0})||(A.windowIndex??0)-(L.windowIndex??0)||(A.paneIndex??0)-(L.paneIndex??0)),[e.sessions,j,ge]),ko=m.useMemo(()=>{const A=new Map;return Nn.slice(0,9).forEach((L,K)=>A.set(L.id,`⌘${K+1}`)),A},[Nn]);m.useEffect(()=>{const A=L=>{if(E||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||!/^[1-9]$/.test(L.key))return;const K=Nn[Number(L.key)-1];if(K){L.preventDefault(),L.stopPropagation();const G=document.activeElement;G&&G.tagName==="IFRAME"&&G.blur();const Oe=document.querySelector(".detail-body")??document.body;Oe.setAttribute("tabindex","-1"),Oe.focus({preventScroll:!0}),Ke(!1),ye(K.id);const Be=requestAnimationFrame(()=>{const $e=document.querySelector(".detail-body")??document.body;$e.setAttribute("tabindex","-1"),$e.focus({preventScroll:!0})});return()=>cancelAnimationFrame(Be)}};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[Nn,E,ye,Ke]),m.useEffect(()=>{const A=L=>{if(L.key!=="Enter"||!(L.metaKey||L.ctrlKey)||L.shiftKey)return;const K=document.activeElement;if(K&&(K.tagName==="TEXTAREA"||K.tagName==="INPUT"||K.isContentEditable)||document.querySelector('[aria-modal="true"]'))return;const G=document.querySelector(".composer .composer-input");G&&(L.preventDefault(),G.focus())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[]),m.useEffect(()=>{const A=L=>{L.key==="Escape"&&(document.querySelector('[aria-modal="true"]')||document.querySelector(".skill-ac")||f.current||An&&(L.preventDefault(),e.sendPromptKey("Escape"),i("Canceled →")))};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[An,e,i]),m.useEffect(()=>{const A=L=>{if(!(L.key==="."||L.code==="Period")||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||document.querySelector('[aria-modal="true"]'))return;const G=document.querySelector(".thread-viewport");G&&(L.preventDefault(),G.scrollTo({top:G.scrollHeight,behavior:"smooth"}))};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[]);const ur=e.subagents.filter(A=>A.status==="running").length;m.useEffect(()=>{const A=L=>{L.key!=="/"||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||(L.preventDefault(),L.stopPropagation(),I(K=>!K))};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[]);const vi=m.useMemo(()=>{const A=G=>G?G.replace(/\/$/,"").split("/").pop()||G:"",L=[],K=[...e.sessions].sort((G,Oe)=>{const Be=G.kind==="terminal"?1:0,$e=Oe.kind==="terminal"?1:0;return Be!==$e?Be-$e:(G.sessionName??"").localeCompare(Oe.sessionName??"",void 0,{numeric:!0})||(G.windowIndex??0)-(Oe.windowIndex??0)||(G.paneIndex??0)-(Oe.paneIndex??0)});for(const G of K){const Oe=G.kind==="terminal";L.push({id:`switch:${G.id}`,label:G.name||G.title||G.tmuxName||G.id,hint:[Oe?"terminal":A(G.cwd),G.pending?"ASK":""].filter(Boolean).join(" · "),keywords:`${G.sessionName??""} ${G.cwd??""} ${G.id}`,group:Oe?"Terminals":"Sessions",run:()=>ye(G.id)})}return L.push({id:"act:tmux-window",label:"View raw tmux window",hint:ve?ve.name||ve.id:"select a session first",group:"Actions",keywords:"terminal ttyd pane window",run:()=>xe()},{id:"act:new-session",label:"New session",group:"Actions",keywords:"create start claude",run:()=>{i("Creating session…"),MS({}).then(G=>i(`Session created → ${G.name}`,"ok")).catch(G=>i(`New session failed: ${G.message}`,"error"))}},{id:"act:processes",label:"Processes & system",group:"Actions",keywords:"ps aux kill cpu memory battery power",run:()=>Tr(!0)},{id:"act:settings",label:"Settings",group:"Actions",keywords:"config preferences model mlx",run:()=>F(!0)},{id:"act:toggle-sidebar",label:Tt?"Show sidebar":"Hide sidebar (focus mode)",group:"Actions",keywords:"rail collapse focus",run:()=>at()},{id:"act:reload",label:"Reload app",group:"Actions",keywords:"refresh",run:()=>window.location.reload()}),L},[e.sessions,e.selectedId,ve,Tt,ye,at,i,xe]),Rr=ve?.thinking&&w.length>0?w[w.length-1].id??null:null,As=m.useRef(null),{pull:Ac,refreshing:Nc}=KM(As),wC=pC(500);return d.jsx(Qa,{runtime:R,children:d.jsx(u5,{children:d.jsxs("div",{ref:As,className:"app","data-detail":e.selectedId&&!fe?"open":"closed","data-rail-collapsed":!ot&&Tt?"true":void 0,"data-cmd-held":wC?"true":void 0,children:[Ac>0||Nc?d.jsx("div",{className:"ptr-indicator",style:{transform:`translate(-50%, ${Math.round(Ac)}px)`},"data-ready":!Nc&&Ac>=GM?"true":void 0,"data-refreshing":Nc?"true":void 0,"aria-hidden":"true",children:d.jsx("span",{className:"ptr-spinner"})}):null,d.jsx("div",{className:"app-top-fade","aria-hidden":"true"}),d.jsx($D,{resources:e.resources,conn:e.conn,push:t}),d.jsx(K$,{}),Yr?d.jsx("div",{className:"ios-push-hint",role:"note",children:"On iPhone/iPad, add this site to your Home Screen to receive push notifications."}):null,d.jsxs("div",{className:"app-body",children:[d.jsxs("aside",{className:"rail",ref:dn,children:[d.jsx(Q$,{onToast:i,filter:j,onCycleFilter:re}),d.jsx("div",{className:"rail-scroll",children:d.jsx(zD,{sessions:e.sessions,selectedId:e.selectedId,onSelect:ye,filter:j,collapsed:ge,onToggleCollapse:Le,hotkeyById:ko,workingOverrideId:An?e.selectedId:null,runningSubagentCountById:e.runningSubagentCountById})}),d.jsxs("div",{className:"rail-foot",children:[d.jsx("button",{type:"button",className:"rail-foot-btn rail-foot-icon reload-foot","aria-label":"Reload app",title:"Reload app",onClick:()=>window.location.reload(),children:d.jsx("span",{className:"reload-glyph","aria-hidden":"true",children:"↻"})}),d.jsxs("button",{type:"button",className:"rail-foot-btn","aria-label":"Settings",title:"Settings",onClick:()=>F(!0),children:[d.jsx(ID,{size:16}),d.jsx("span",{children:"Settings"})]}),d.jsx("button",{type:"button",className:"rail-foot-btn rail-foot-icon","aria-label":"Processes & system",title:"Processes & system",onClick:()=>Tr(!0),children:d.jsx(RD,{size:16})})]})]}),d.jsxs("main",{className:"detail",children:[d.jsxs("header",{className:"detail-head",children:[d.jsx("button",{type:"button",className:"back-btn","aria-label":"Back to sessions",onClick:()=>Ce(!0),children:"‹"}),d.jsx("div",{className:"detail-title",children:Kn!==null?d.jsx("input",{ref:z,className:"detail-rename-input",type:"text",value:Kn,"aria-label":"Session name",onChange:A=>jn(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),ie()):A.key==="Escape"&&(A.preventDefault(),jn(null))},onBlur:()=>void ie()}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"detail-name",children:ve?.name||e.selectedId||"claude control"}),ve?.cwd?d.jsx("span",{className:"detail-cwd",title:ve.cwd,children:ve.cwd.replace(/\/$/,"").split("/").pop()||ve.cwd}):null]})}),d.jsxs("div",{className:"detail-actions",children:[ve&&Kn===null?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"detail-action","aria-label":"Rename session",title:"Rename session (⌘E)","data-hotkey":"⌘E","data-hotkey-dir":"down",onClick:()=>jn(ve.name??ve.id),children:d.jsx(CD,{})}),d.jsx("button",{type:"button",className:"detail-action","aria-label":"Open raw terminal",title:"Raw terminal (⌘J)","data-hotkey":"⌘J","data-hotkey-dir":"down",onClick:xe,children:d.jsx(Dk,{})}),d.jsx("button",{type:"button",className:"detail-action","aria-pressed":Z,"data-on":Z?"true":void 0,"aria-label":"Search transcript",title:"Search transcript (⌘/)","data-hotkey":"⌘/","data-hotkey-dir":"down",onClick:()=>I(A=>!A),children:d.jsx(AD,{})}),e.subagents.length>0?d.jsxs("button",{type:"button",className:"detail-action detail-action--count","aria-pressed":le,"data-on":le?"true":void 0,"data-running":ur>0?"true":void 0,"aria-label":ur>0?`${ur} sub-agent${ur===1?"":"s"} running`:"Sub-agents",title:"Sub-agents (⌘U)","data-hotkey":"⌘U","data-hotkey-dir":"down",onClick:()=>{He(null),se(A=>!A)},children:[d.jsx(ED,{}),ur>0?d.jsx("span",{className:"detail-action-count",children:ur}):null]}):null]}):null,d.jsx("button",{type:"button",className:"detail-action focus-toggle","aria-pressed":Tt,"aria-label":Tt?"Show sidebar":"Focus mode (hide sidebar)",title:Tt?"Show sidebar (⌘B)":"Focus mode (hide sidebar) (⌘B)","data-hotkey":"⌘B","data-hotkey-dir":"down",onClick:at,children:d.jsx(TD,{})})]})]}),d.jsx("div",{className:"detail-body",ref:Ot,children:d.jsx(oC.Provider,{value:a,children:ve&&ve.kind==="terminal"?d.jsx(U$,{sessionId:ve.id,capture:e.capture,requestCapture:e.requestCapture,clearCapture:e.clearCapture,sendText:e.sendPaneText,sendKey:e.sendPaneKey}):ve&&!ve.transcriptPath?d.jsxs("div",{className:"thread-root",children:[(()=>{const A=Ge?e.subagents.find(L=>L.agentId===Ge)??null:null;return A?d.jsxs("div",{className:"agent-inline-view",children:[d.jsxs("div",{className:"agent-inline-head",children:[d.jsx("button",{type:"button",className:"agent-inline-back","aria-label":"Back to live pane",onClick:lr,children:"‹ back"}),d.jsxs("span",{className:"agent-inline-title",children:[d.jsx("span",{className:"sa-dot","data-status":A.status,"aria-hidden":"true"}),d.jsx("span",{className:"agent-inline-name",children:A.agentType||"sub-agent"}),d.jsx("span",{className:"agent-inline-status",children:A.status==="running"?"· running":"· done"})]})]}),d.jsx(Lm,{messages:A.messages})]}):d.jsxs(d.Fragment,{children:[d.jsx(B$,{sessionId:ve.id,capture:e.capture,requestCapture:e.requestCapture,clearCapture:e.clearCapture}),_.length>0?d.jsx("div",{className:"live-pending","aria-label":"Queued sends",children:_.map(L=>d.jsxs("div",{className:"live-pending-bubble",children:[d.jsx("span",{className:"live-pending-dot","aria-hidden":"true"}),L.label]},L.key))}):null]})})(),d.jsx(fC,{subagents:e.subagents,onOpenAgent:yi,viewingAgentId:Ge}),d.jsx(cC,{disabled:!1,sessionId:e.selectedId,subAgentMode:Kt,onSubAgentModeChange:Gt,onTerminalModeChange:h,working:An,onStop:hn})]}):d.jsxs("div",{className:"detail-split",children:[d.jsx(tC.Provider,{value:ve?.kind??"claude",children:d.jsx(nC.Provider,{value:Rr,children:d.jsx(I$,{hasSelection:!!e.selectedId,loading:!e.messagesLoaded,sessionId:e.selectedId,hiddenCount:k,onLoadEarlier:P,subAgentMode:Kt,onSubAgentModeChange:Gt,onTerminalModeChange:h,subagents:e.subagents,onOpenAgent:yi,viewingAgent:Ge?e.subagents.find(A=>A.agentId===Ge)??null:null,onCloseAgent:lr,working:An,onStop:hn})})}),d.jsx(z$,{}),d.jsx(v6,{open:Z,onClose:()=>I(!1)})]})})})]})]}),e.pending&&e.pending.toolUseId!==J?d.jsx(H$,{pending:e.pending,capture:e.capture,onAnswer:(A,L)=>{e.sendAnswer(A,L),ne(A),e.clearCapture(),e.selectedId&&g({sessionId:e.selectedId,baseCount:e.messages.length})},onCapture:e.requestCapture,onClose:()=>{ne(e.pending?.toolUseId??null),e.clearCapture()}},e.pending.toolUseId):null,$?d.jsx(G$,{onClose:()=>F(!1),onToast:i}):null,te.map(A=>d.jsx(Z$,{sessionId:A,visible:A===e.selectedId&&it,label:e.sessions.find(L=>L.id===A)?.name??A,onClose:()=>Ke(!1)},A)),d.jsx(l6,{subagents:e.subagents,open:le&&e.subagents.length>0,onClose:()=>se(!1),focusAgentId:we}),qn?d.jsx(c6,{power:e.resources.snapshot?.power??null,history:e.resourceHistory,onClose:()=>Tr(!1),onToast:i}):null,E?d.jsx(h6,{commands:vi,onClose:()=>X(!1)}):null,e.prompt&&!e.pending&&JSON.stringify(e.prompt)!==ue?d.jsx(r6,{prompt:e.prompt,agentName:ve?.kind==="codex"?"Codex":"Claude",planMarkdown:S,onKey:A=>e.sendPromptKey(A),onSelect:A=>e.selectedId?e.sendPromptSelect(e.selectedId,A):!1,onClose:()=>So(JSON.stringify(e.prompt))}):null,d.jsx(m6,{}),d.jsx(W$,{toast:n})]})})})}function R6(){return d.jsx(e6,{children:d.jsx(I6,{})})}const xC=document.getElementById("root");if(!xC)throw new Error("#root not found");n_(xC).render(d.jsx(m.StrictMode,{children:d.jsx(R6,{})}));export{Va as g};
|