@idl3/claude-control 0.4.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+ var xC=Object.defineProperty;var wC=(e,t,n)=>t in e?xC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var A=(e,t,n)=>wC(e,typeof t!="symbol"?t+"":t,n);function _C(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 Hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ia(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ox={exports:{}},Vu={},zx={exports:{}},ge={};/**
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 Ra=Symbol.for("react.element"),bC=Symbol.for("react.portal"),kC=Symbol.for("react.fragment"),SC=Symbol.for("react.strict_mode"),CC=Symbol.for("react.profiler"),EC=Symbol.for("react.provider"),TC=Symbol.for("react.context"),IC=Symbol.for("react.forward_ref"),RC=Symbol.for("react.suspense"),PC=Symbol.for("react.memo"),jC=Symbol.for("react.lazy"),Om=Symbol.iterator;function AC(e){return e===null||typeof e!="object"?null:(e=Om&&e[Om]||e["@@iterator"],typeof e=="function"?e:null)}var Fx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bx=Object.assign,$x={};function Ji(e,t,n){this.props=e,this.context=t,this.refs=$x,this.updater=n||Fx}Ji.prototype.isReactComponent={};Ji.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")};Ji.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ux(){}Ux.prototype=Ji.prototype;function yh(e,t,n){this.props=e,this.context=t,this.refs=$x,this.updater=n||Fx}var vh=yh.prototype=new Ux;vh.constructor=yh;Bx(vh,Ji.prototype);vh.isPureReactComponent=!0;var zm=Array.isArray,Vx=Object.prototype.hasOwnProperty,xh={current:null},Hx={key:!0,ref:!0,__self:!0,__source:!0};function Wx(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)Vx.call(t,r)&&!Hx.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:Ra,type:e,key:i,ref:o,props:s,_owner:xh.current}}function NC(e,t){return{$$typeof:Ra,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function wh(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ra}function MC(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Fm=/\/+/g;function Ec(e,t){return typeof e=="object"&&e!==null&&e.key!=null?MC(""+e.key):t.toString(36)}function Sl(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 Ra:case bC:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Ec(o,0):r,zm(s)?(n="",e!=null&&(n=e.replace(Fm,"$&/")+"/"),Sl(s,t,n,"",function(u){return u})):s!=null&&(wh(s)&&(s=NC(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Fm,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",zm(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+Ec(i,a);o+=Sl(i,t,n,l,s)}else if(l=AC(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+Ec(i,a++),o+=Sl(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 Ka(e,t,n){if(e==null)return e;var r=[],s=0;return Sl(e,r,"","",function(i){return t.call(n,i,s++)}),r}function DC(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 Lt={current:null},Cl={transition:null},LC={ReactCurrentDispatcher:Lt,ReactCurrentBatchConfig:Cl,ReactCurrentOwner:xh};function Kx(){throw Error("act(...) is not supported in production builds of React.")}ge.Children={map:Ka,forEach:function(e,t,n){Ka(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ka(e,function(){t++}),t},toArray:function(e){return Ka(e,function(t){return t})||[]},only:function(e){if(!wh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ge.Component=Ji;ge.Fragment=kC;ge.Profiler=CC;ge.PureComponent=yh;ge.StrictMode=SC;ge.Suspense=RC;ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=LC;ge.act=Kx;ge.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=Bx({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=xh.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Vx.call(t,l)&&!Hx.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:Ra,type:e.type,key:s,ref:i,props:r,_owner:o}};ge.createContext=function(e){return e={$$typeof:TC,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:EC,_context:e},e.Consumer=e};ge.createElement=Wx;ge.createFactory=function(e){var t=Wx.bind(null,e);return t.type=e,t};ge.createRef=function(){return{current:null}};ge.forwardRef=function(e){return{$$typeof:IC,render:e}};ge.isValidElement=wh;ge.lazy=function(e){return{$$typeof:jC,_payload:{_status:-1,_result:e},_init:DC}};ge.memo=function(e,t){return{$$typeof:PC,type:e,compare:t===void 0?null:t}};ge.startTransition=function(e){var t=Cl.transition;Cl.transition={};try{e()}finally{Cl.transition=t}};ge.unstable_act=Kx;ge.useCallback=function(e,t){return Lt.current.useCallback(e,t)};ge.useContext=function(e){return Lt.current.useContext(e)};ge.useDebugValue=function(){};ge.useDeferredValue=function(e){return Lt.current.useDeferredValue(e)};ge.useEffect=function(e,t){return Lt.current.useEffect(e,t)};ge.useId=function(){return Lt.current.useId()};ge.useImperativeHandle=function(e,t,n){return Lt.current.useImperativeHandle(e,t,n)};ge.useInsertionEffect=function(e,t){return Lt.current.useInsertionEffect(e,t)};ge.useLayoutEffect=function(e,t){return Lt.current.useLayoutEffect(e,t)};ge.useMemo=function(e,t){return Lt.current.useMemo(e,t)};ge.useReducer=function(e,t,n){return Lt.current.useReducer(e,t,n)};ge.useRef=function(e){return Lt.current.useRef(e)};ge.useState=function(e){return Lt.current.useState(e)};ge.useSyncExternalStore=function(e,t,n){return Lt.current.useSyncExternalStore(e,t,n)};ge.useTransition=function(){return Lt.current.useTransition()};ge.version="18.3.1";zx.exports=ge;var m=zx.exports;const $t=Ia(m),OC=_C({__proto__:null,default:$t},[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 zC=m,FC=Symbol.for("react.element"),BC=Symbol.for("react.fragment"),$C=Object.prototype.hasOwnProperty,UC=zC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,VC={key:!0,ref:!0,__self:!0,__source:!0};function qx(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)$C.call(t,r)&&!VC.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:FC,type:e,key:i,ref:o,props:s,_owner:UC.current}}Vu.Fragment=BC;Vu.jsx=qx;Vu.jsxs=qx;Ox.exports=Vu;var d=Ox.exports,Gx={exports:{}},pn={},Yx={exports:{}},Qx={};/**
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,z){var b=F.length;F.push(z);e:for(;0<b;){var W=b-1>>>1,X=F[W];if(0<s(X,z))F[W]=z,F[b]=X,b=W;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var z=F[0],b=F.pop();if(b!==z){F[0]=b;e:for(var W=0,X=F.length,R=X>>>1;W<R;){var le=2*(W+1)-1,we=F[le],de=le+1,Je=F[de];if(0>s(we,b))de<X&&0>s(Je,we)?(F[W]=Je,F[de]=b,W=de):(F[W]=we,F[le]=b,W=le);else if(de<X&&0>s(Je,b))F[W]=Je,F[de]=b,W=de;else break e}}return z}function s(F,z){var b=F.sortIndex-z.sortIndex;return b!==0?b:F.id-z.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,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=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(F){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=F)r(u),z.sortIndex=z.expirationTime,t(l,z);else break;z=n(u)}}function C(F){if(y=!1,w(F),!g)if(n(l)!==null)g=!0,te(k);else{var z=n(u);z!==null&&Z(C,z.startTime-F)}}function k(F,z){g=!1,y&&(y=!1,v(I),I=-1),p=!0;var b=h;try{for(w(z),f=n(l);f!==null&&(!(f.expirationTime>z)||F&&!D());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var X=W(f.expirationTime<=z);z=e.unstable_now(),typeof X=="function"?f.callback=X:f===n(l)&&r(l),w(z)}else r(l);f=n(l)}if(f!==null)var R=!0;else{var le=n(u);le!==null&&Z(C,le.startTime-z),R=!1}return R}finally{f=null,h=b,p=!1}}var S=!1,T=null,I=-1,P=5,E=-1;function D(){return!(e.unstable_now()-E<P)}function M(){if(T!==null){var F=e.unstable_now();E=F;var z=!0;try{z=T(!0,F)}finally{z?B():(S=!1,T=null)}}else S=!1}var B;if(typeof x=="function")B=function(){x(M)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,U=Q.port2;Q.port1.onmessage=M,B=function(){U.postMessage(null)}}else B=function(){_(M,0)};function te(F){T=F,S||(S=!0,B())}function Z(F,z){I=_(function(){F(e.unstable_now())},z)}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(F){F.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,te(k))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(F){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var b=h;h=z;try{return F()}finally{h=b}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,z){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var b=h;h=F;try{return z()}finally{h=b}},e.unstable_scheduleCallback=function(F,z,b){var W=e.unstable_now();switch(typeof b=="object"&&b!==null?(b=b.delay,b=typeof b=="number"&&0<b?W+b:W):b=W,F){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=b+X,F={id:c++,callback:z,priorityLevel:F,startTime:b,expirationTime:X,sortIndex:-1},b>W?(F.sortIndex=b,t(u,F),n(l)===null&&F===n(u)&&(y?(v(I),I=-1):y=!0,Z(C,b-W))):(F.sortIndex=X,t(l,F),g||p||(g=!0,te(k))),F},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(F){var z=h;return function(){var b=h;h=z;try{return F.apply(this,arguments)}finally{h=b}}}})(Qx);Yx.exports=Qx;var HC=Yx.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 WC=m,cn=HC;function V(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 Xx=new Set,Qo={};function Hs(e,t){Di(e,t),Di(e+"Capture",t)}function Di(e,t){for(Qo[e]=t,e=0;e<t.length;e++)Xx.add(t[e])}var br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ad=Object.prototype.hasOwnProperty,KC=/^[: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]*$/,Bm={},$m={};function qC(e){return Ad.call($m,e)?!0:Ad.call(Bm,e)?!1:KC.test(e)?$m[e]=!0:(Bm[e]=!0,!1)}function GC(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 YC(e,t,n,r){if(t===null||typeof t>"u"||GC(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 Ot(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 _t={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_t[e]=new Ot(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_t[t]=new Ot(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){_t[e]=new Ot(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){_t[e]=new Ot(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){_t[e]=new Ot(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){_t[e]=new Ot(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){_t[e]=new Ot(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){_t[e]=new Ot(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){_t[e]=new Ot(e,5,!1,e.toLowerCase(),null,!1,!1)});var _h=/[\-:]([a-z])/g;function bh(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(_h,bh);_t[t]=new Ot(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(_h,bh);_t[t]=new Ot(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(_h,bh);_t[t]=new Ot(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){_t[e]=new Ot(e,1,!1,e.toLowerCase(),null,!1,!1)});_t.xlinkHref=new Ot("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){_t[e]=new Ot(e,1,!1,e.toLowerCase(),null,!0,!0)});function kh(e,t,n,r){var s=_t.hasOwnProperty(t)?_t[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(YC(t,n,s,r)&&(n=null),r||s===null?qC(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 Ir=WC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,qa=Symbol.for("react.element"),ci=Symbol.for("react.portal"),di=Symbol.for("react.fragment"),Sh=Symbol.for("react.strict_mode"),Nd=Symbol.for("react.profiler"),Jx=Symbol.for("react.provider"),Zx=Symbol.for("react.context"),Ch=Symbol.for("react.forward_ref"),Md=Symbol.for("react.suspense"),Dd=Symbol.for("react.suspense_list"),Eh=Symbol.for("react.memo"),Mr=Symbol.for("react.lazy"),ew=Symbol.for("react.offscreen"),Um=Symbol.iterator;function co(e){return e===null||typeof e!="object"?null:(e=Um&&e[Um]||e["@@iterator"],typeof e=="function"?e:null)}var Ye=Object.assign,Tc;function ko(e){if(Tc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Tc=t&&t[1]||""}return`
34
+ `+Tc+e}var Ic=!1;function Rc(e,t){if(!e||Ic)return"";Ic=!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{Ic=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ko(e):""}function QC(e){switch(e.tag){case 5:return ko(e.type);case 16:return ko("Lazy");case 13:return ko("Suspense");case 19:return ko("SuspenseList");case 0:case 2:case 15:return e=Rc(e.type,!1),e;case 11:return e=Rc(e.type.render,!1),e;case 1:return e=Rc(e.type,!0),e;default:return""}}function Ld(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 di:return"Fragment";case ci:return"Portal";case Nd:return"Profiler";case Sh:return"StrictMode";case Md:return"Suspense";case Dd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Zx:return(e.displayName||"Context")+".Consumer";case Jx:return(e._context.displayName||"Context")+".Provider";case Ch:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Eh:return t=e.displayName||null,t!==null?t:Ld(e.type)||"Memo";case Mr:t=e._payload,e=e._init;try{return Ld(e(t))}catch{}}return null}function XC(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 Ld(t);case 8:return t===Sh?"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 ns(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function JC(e){var t=tw(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 Ga(e){e._valueTracker||(e._valueTracker=JC(e))}function nw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=tw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Wl(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 Od(e,t){var n=t.checked;return Ye({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Vm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ns(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 rw(e,t){t=t.checked,t!=null&&kh(e,"checked",t,!1)}function zd(e,t){rw(e,t);var n=ns(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")?Fd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Fd(e,t.type,ns(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Hm(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 Fd(e,t,n){(t!=="number"||Wl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var So=Array.isArray;function Si(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=""+ns(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 Bd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(V(91));return Ye({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Wm(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(V(92));if(So(n)){if(1<n.length)throw Error(V(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ns(n)}}function sw(e,t){var n=ns(t.value),r=ns(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 Km(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function iw(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 $d(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?iw(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ya,ow=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(Ya=Ya||document.createElement("div"),Ya.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ya.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ro={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},ZC=["Webkit","ms","Moz","O"];Object.keys(Ro).forEach(function(e){ZC.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ro[t]=Ro[e]})});function aw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ro.hasOwnProperty(e)&&Ro[e]?(""+t).trim():t+"px"}function lw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=aw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var eE=Ye({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 Ud(e,t){if(t){if(eE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(V(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(V(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(V(61))}if(t.style!=null&&typeof t.style!="object")throw Error(V(62))}}function Vd(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 Hd=null;function Th(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wd=null,Ci=null,Ei=null;function qm(e){if(e=Aa(e)){if(typeof Wd!="function")throw Error(V(280));var t=e.stateNode;t&&(t=Gu(t),Wd(e.stateNode,e.type,t))}}function uw(e){Ci?Ei?Ei.push(e):Ei=[e]:Ci=e}function cw(){if(Ci){var e=Ci,t=Ei;if(Ei=Ci=null,qm(e),t)for(e=0;e<t.length;e++)qm(t[e])}}function dw(e,t){return e(t)}function fw(){}var Pc=!1;function hw(e,t,n){if(Pc)return e(t,n);Pc=!0;try{return dw(e,t,n)}finally{Pc=!1,(Ci!==null||Ei!==null)&&(fw(),cw())}}function Jo(e,t){var n=e.stateNode;if(n===null)return null;var r=Gu(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(V(231,t,typeof n));return n}var Kd=!1;if(br)try{var fo={};Object.defineProperty(fo,"passive",{get:function(){Kd=!0}}),window.addEventListener("test",fo,fo),window.removeEventListener("test",fo,fo)}catch{Kd=!1}function tE(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 Po=!1,Kl=null,ql=!1,qd=null,nE={onError:function(e){Po=!0,Kl=e}};function rE(e,t,n,r,s,i,o,a,l){Po=!1,Kl=null,tE.apply(nE,arguments)}function sE(e,t,n,r,s,i,o,a,l){if(rE.apply(this,arguments),Po){if(Po){var u=Kl;Po=!1,Kl=null}else throw Error(V(198));ql||(ql=!0,qd=u)}}function Ws(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 pw(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 Gm(e){if(Ws(e)!==e)throw Error(V(188))}function iE(e){var t=e.alternate;if(!t){if(t=Ws(e),t===null)throw Error(V(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 Gm(s),e;if(i===r)return Gm(s),t;i=i.sibling}throw Error(V(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(V(189))}}if(n.alternate!==r)throw Error(V(190))}if(n.tag!==3)throw Error(V(188));return n.stateNode.current===n?e:t}function mw(e){return e=iE(e),e!==null?gw(e):null}function gw(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=gw(e);if(t!==null)return t;e=e.sibling}return null}var yw=cn.unstable_scheduleCallback,Ym=cn.unstable_cancelCallback,oE=cn.unstable_shouldYield,aE=cn.unstable_requestPaint,et=cn.unstable_now,lE=cn.unstable_getCurrentPriorityLevel,Ih=cn.unstable_ImmediatePriority,vw=cn.unstable_UserBlockingPriority,Gl=cn.unstable_NormalPriority,uE=cn.unstable_LowPriority,xw=cn.unstable_IdlePriority,Hu=null,sr=null;function cE(e){if(sr&&typeof sr.onCommitFiberRoot=="function")try{sr.onCommitFiberRoot(Hu,e,void 0,(e.current.flags&128)===128)}catch{}}var $n=Math.clz32?Math.clz32:hE,dE=Math.log,fE=Math.LN2;function hE(e){return e>>>=0,e===0?32:31-(dE(e)/fE|0)|0}var Qa=64,Xa=4194304;function Co(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 Yl(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=Co(a):(i&=o,i!==0&&(r=Co(i)))}else o=n&~s,o!==0?r=Co(o):i!==0&&(r=Co(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-$n(t),s=1<<n,r|=e[n],t&=~s;return r}function pE(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 mE(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-$n(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=pE(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function Gd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ww(){var e=Qa;return Qa<<=1,!(Qa&4194240)&&(Qa=64),e}function jc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Pa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-$n(t),e[t]=n}function gE(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-$n(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Rh(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-$n(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Se=0;function _w(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var bw,Ph,kw,Sw,Cw,Yd=!1,Ja=[],Wr=null,Kr=null,qr=null,Zo=new Map,ea=new Map,Or=[],yE="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 Qm(e,t){switch(e){case"focusin":case"focusout":Wr=null;break;case"dragenter":case"dragleave":Kr=null;break;case"mouseover":case"mouseout":qr=null;break;case"pointerover":case"pointerout":Zo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ea.delete(t.pointerId)}}function ho(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=Aa(t),t!==null&&Ph(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function vE(e,t,n,r,s){switch(t){case"focusin":return Wr=ho(Wr,e,t,n,r,s),!0;case"dragenter":return Kr=ho(Kr,e,t,n,r,s),!0;case"mouseover":return qr=ho(qr,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Zo.set(i,ho(Zo.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,ea.set(i,ho(ea.get(i)||null,e,t,n,r,s)),!0}return!1}function Ew(e){var t=Ss(e.target);if(t!==null){var n=Ws(t);if(n!==null){if(t=n.tag,t===13){if(t=pw(n),t!==null){e.blockedOn=t,Cw(e.priority,function(){kw(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 El(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Hd=r,n.target.dispatchEvent(r),Hd=null}else return t=Aa(n),t!==null&&Ph(t),e.blockedOn=n,!1;t.shift()}return!0}function Xm(e,t,n){El(e)&&n.delete(t)}function xE(){Yd=!1,Wr!==null&&El(Wr)&&(Wr=null),Kr!==null&&El(Kr)&&(Kr=null),qr!==null&&El(qr)&&(qr=null),Zo.forEach(Xm),ea.forEach(Xm)}function po(e,t){e.blockedOn===t&&(e.blockedOn=null,Yd||(Yd=!0,cn.unstable_scheduleCallback(cn.unstable_NormalPriority,xE)))}function ta(e){function t(s){return po(s,e)}if(0<Ja.length){po(Ja[0],e);for(var n=1;n<Ja.length;n++){var r=Ja[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wr!==null&&po(Wr,e),Kr!==null&&po(Kr,e),qr!==null&&po(qr,e),Zo.forEach(t),ea.forEach(t),n=0;n<Or.length;n++)r=Or[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Or.length&&(n=Or[0],n.blockedOn===null);)Ew(n),n.blockedOn===null&&Or.shift()}var Ti=Ir.ReactCurrentBatchConfig,Ql=!0;function wE(e,t,n,r){var s=Se,i=Ti.transition;Ti.transition=null;try{Se=1,jh(e,t,n,r)}finally{Se=s,Ti.transition=i}}function _E(e,t,n,r){var s=Se,i=Ti.transition;Ti.transition=null;try{Se=4,jh(e,t,n,r)}finally{Se=s,Ti.transition=i}}function jh(e,t,n,r){if(Ql){var s=Qd(e,t,n,r);if(s===null)$c(e,t,r,Xl,n),Qm(e,r);else if(vE(s,e,t,n,r))r.stopPropagation();else if(Qm(e,r),t&4&&-1<yE.indexOf(e)){for(;s!==null;){var i=Aa(s);if(i!==null&&bw(i),i=Qd(e,t,n,r),i===null&&$c(e,t,r,Xl,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else $c(e,t,r,null,n)}}var Xl=null;function Qd(e,t,n,r){if(Xl=null,e=Th(r),e=Ss(e),e!==null)if(t=Ws(e),t===null)e=null;else if(n=t.tag,n===13){if(e=pw(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 Xl=e,null}function Tw(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(lE()){case Ih:return 1;case vw:return 4;case Gl:case uE:return 16;case xw:return 536870912;default:return 16}default:return 16}}var Br=null,Ah=null,Tl=null;function Iw(){if(Tl)return Tl;var e,t=Ah,n=t.length,r,s="value"in Br?Br.value:Br.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 Tl=s.slice(e,1<r?1-r:void 0)}function Il(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 Za(){return!0}function Jm(){return!1}function mn(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)?Za:Jm,this.isPropagationStopped=Jm,this}return Ye(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=Za)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Za)},persist:function(){},isPersistent:Za}),t}var Zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nh=mn(Zi),ja=Ye({},Zi,{view:0,detail:0}),bE=mn(ja),Ac,Nc,mo,Wu=Ye({},ja,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mh,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!==mo&&(mo&&e.type==="mousemove"?(Ac=e.screenX-mo.screenX,Nc=e.screenY-mo.screenY):Nc=Ac=0,mo=e),Ac)},movementY:function(e){return"movementY"in e?e.movementY:Nc}}),Zm=mn(Wu),kE=Ye({},Wu,{dataTransfer:0}),SE=mn(kE),CE=Ye({},ja,{relatedTarget:0}),Mc=mn(CE),EE=Ye({},Zi,{animationName:0,elapsedTime:0,pseudoElement:0}),TE=mn(EE),IE=Ye({},Zi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),RE=mn(IE),PE=Ye({},Zi,{data:0}),eg=mn(PE),jE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AE={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"},NE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ME(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=NE[e])?!!t[e]:!1}function Mh(){return ME}var DE=Ye({},ja,{key:function(e){if(e.key){var t=jE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Il(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?AE[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mh,charCode:function(e){return e.type==="keypress"?Il(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Il(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LE=mn(DE),OE=Ye({},Wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tg=mn(OE),zE=Ye({},ja,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mh}),FE=mn(zE),BE=Ye({},Zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),$E=mn(BE),UE=Ye({},Wu,{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}),VE=mn(UE),HE=[9,13,27,32],Dh=br&&"CompositionEvent"in window,jo=null;br&&"documentMode"in document&&(jo=document.documentMode);var WE=br&&"TextEvent"in window&&!jo,Rw=br&&(!Dh||jo&&8<jo&&11>=jo),ng=" ",rg=!1;function Pw(e,t){switch(e){case"keyup":return HE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fi=!1;function KE(e,t){switch(e){case"compositionend":return jw(t);case"keypress":return t.which!==32?null:(rg=!0,ng);case"textInput":return e=t.data,e===ng&&rg?null:e;default:return null}}function qE(e,t){if(fi)return e==="compositionend"||!Dh&&Pw(e,t)?(e=Iw(),Tl=Ah=Br=null,fi=!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 Rw&&t.locale!=="ko"?null:t.data;default:return null}}var GE={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 sg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!GE[e.type]:t==="textarea"}function Aw(e,t,n,r){uw(r),t=Jl(t,"onChange"),0<t.length&&(n=new Nh("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ao=null,na=null;function YE(e){Vw(e,0)}function Ku(e){var t=mi(e);if(nw(t))return e}function QE(e,t){if(e==="change")return t}var Nw=!1;if(br){var Dc;if(br){var Lc="oninput"in document;if(!Lc){var ig=document.createElement("div");ig.setAttribute("oninput","return;"),Lc=typeof ig.oninput=="function"}Dc=Lc}else Dc=!1;Nw=Dc&&(!document.documentMode||9<document.documentMode)}function og(){Ao&&(Ao.detachEvent("onpropertychange",Mw),na=Ao=null)}function Mw(e){if(e.propertyName==="value"&&Ku(na)){var t=[];Aw(t,na,e,Th(e)),hw(YE,t)}}function XE(e,t,n){e==="focusin"?(og(),Ao=t,na=n,Ao.attachEvent("onpropertychange",Mw)):e==="focusout"&&og()}function JE(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ku(na)}function ZE(e,t){if(e==="click")return Ku(t)}function eT(e,t){if(e==="input"||e==="change")return Ku(t)}function tT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Hn=typeof Object.is=="function"?Object.is:tT;function ra(e,t){if(Hn(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(!Ad.call(t,s)||!Hn(e[s],t[s]))return!1}return!0}function ag(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function lg(e,t){var n=ag(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=ag(n)}}function Dw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lw(){for(var e=window,t=Wl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wl(e.document)}return t}function Lh(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 nT(e){var t=Lw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Dw(n.ownerDocument.documentElement,n)){if(r!==null&&Lh(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=lg(n,i);var o=lg(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 rT=br&&"documentMode"in document&&11>=document.documentMode,hi=null,Xd=null,No=null,Jd=!1;function ug(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jd||hi==null||hi!==Wl(r)||(r=hi,"selectionStart"in r&&Lh(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}),No&&ra(No,r)||(No=r,r=Jl(Xd,"onSelect"),0<r.length&&(t=new Nh("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=hi)))}function el(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pi={animationend:el("Animation","AnimationEnd"),animationiteration:el("Animation","AnimationIteration"),animationstart:el("Animation","AnimationStart"),transitionend:el("Transition","TransitionEnd")},Oc={},Ow={};br&&(Ow=document.createElement("div").style,"AnimationEvent"in window||(delete pi.animationend.animation,delete pi.animationiteration.animation,delete pi.animationstart.animation),"TransitionEvent"in window||delete pi.transitionend.transition);function qu(e){if(Oc[e])return Oc[e];if(!pi[e])return e;var t=pi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ow)return Oc[e]=t[n];return e}var zw=qu("animationend"),Fw=qu("animationiteration"),Bw=qu("animationstart"),$w=qu("transitionend"),Uw=new Map,cg="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 us(e,t){Uw.set(e,t),Hs(t,[e])}for(var zc=0;zc<cg.length;zc++){var Fc=cg[zc],sT=Fc.toLowerCase(),iT=Fc[0].toUpperCase()+Fc.slice(1);us(sT,"on"+iT)}us(zw,"onAnimationEnd");us(Fw,"onAnimationIteration");us(Bw,"onAnimationStart");us("dblclick","onDoubleClick");us("focusin","onFocus");us("focusout","onBlur");us($w,"onTransitionEnd");Di("onMouseEnter",["mouseout","mouseover"]);Di("onMouseLeave",["mouseout","mouseover"]);Di("onPointerEnter",["pointerout","pointerover"]);Di("onPointerLeave",["pointerout","pointerover"]);Hs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Hs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Hs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Hs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Hs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Hs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eo="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(" "),oT=new Set("cancel close invalid load scroll toggle".split(" ").concat(Eo));function dg(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,sE(r,t,void 0,e),e.currentTarget=null}function Vw(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;dg(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;dg(s,a,u),i=l}}}if(ql)throw e=qd,ql=!1,qd=null,e}function ze(e,t){var n=t[rf];n===void 0&&(n=t[rf]=new Set);var r=e+"__bubble";n.has(r)||(Hw(t,e,2,!1),n.add(r))}function Bc(e,t,n){var r=0;t&&(r|=4),Hw(n,e,r,t)}var tl="_reactListening"+Math.random().toString(36).slice(2);function sa(e){if(!e[tl]){e[tl]=!0,Xx.forEach(function(n){n!=="selectionchange"&&(oT.has(n)||Bc(n,!1,e),Bc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[tl]||(t[tl]=!0,Bc("selectionchange",!1,t))}}function Hw(e,t,n,r){switch(Tw(t)){case 1:var s=wE;break;case 4:s=_E;break;default:s=jh}n=s.bind(null,t,n,e),s=void 0,!Kd||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 $c(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=Ss(a),o===null)return;if(l=o.tag,l===5||l===6){r=i=o;continue e}a=a.parentNode}}r=r.return}hw(function(){var u=i,c=Th(n),f=[];e:{var h=Uw.get(e);if(h!==void 0){var p=Nh,g=e;switch(e){case"keypress":if(Il(n)===0)break e;case"keydown":case"keyup":p=LE;break;case"focusin":g="focus",p=Mc;break;case"focusout":g="blur",p=Mc;break;case"beforeblur":case"afterblur":p=Mc;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=Zm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=SE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=FE;break;case zw:case Fw:case Bw:p=TE;break;case $w:p=$E;break;case"scroll":p=bE;break;case"wheel":p=VE;break;case"copy":case"cut":case"paste":p=RE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=tg}var y=(t&4)!==0,_=!y&&e==="scroll",v=y?h!==null?h+"Capture":null:h;y=[];for(var x=u,w;x!==null;){w=x;var C=w.stateNode;if(w.tag===5&&C!==null&&(w=C,v!==null&&(C=Jo(x,v),C!=null&&y.push(ia(x,C,w)))),_)break;x=x.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!==Hd&&(g=n.relatedTarget||n.fromElement)&&(Ss(g)||g[kr]))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?Ss(g):null,g!==null&&(_=Ws(g),g!==_||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(y=Zm,C="onMouseLeave",v="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(y=tg,C="onPointerLeave",v="onPointerEnter",x="pointer"),_=p==null?h:mi(p),w=g==null?h:mi(g),h=new y(C,x+"leave",p,n,c),h.target=_,h.relatedTarget=w,C=null,Ss(c)===u&&(y=new y(v,x+"enter",g,n,c),y.target=w,y.relatedTarget=_,C=y),_=C,p&&g)t:{for(y=p,v=g,x=0,w=y;w;w=ii(w))x++;for(w=0,C=v;C;C=ii(C))w++;for(;0<x-w;)y=ii(y),x--;for(;0<w-x;)v=ii(v),w--;for(;x--;){if(y===v||v!==null&&y===v.alternate)break t;y=ii(y),v=ii(v)}y=null}else y=null;p!==null&&fg(f,h,p,y,!1),g!==null&&_!==null&&fg(f,_,g,y,!0)}}e:{if(h=u?mi(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var k=QE;else if(sg(h))if(Nw)k=eT;else{k=JE;var S=XE}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(k=ZE);if(k&&(k=k(e,u))){Aw(f,k,n,c);break e}S&&S(e,h,u),e==="focusout"&&(S=h._wrapperState)&&S.controlled&&h.type==="number"&&Fd(h,"number",h.value)}switch(S=u?mi(u):window,e){case"focusin":(sg(S)||S.contentEditable==="true")&&(hi=S,Xd=u,No=null);break;case"focusout":No=Xd=hi=null;break;case"mousedown":Jd=!0;break;case"contextmenu":case"mouseup":case"dragend":Jd=!1,ug(f,n,c);break;case"selectionchange":if(rT)break;case"keydown":case"keyup":ug(f,n,c)}var T;if(Dh)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else fi?Pw(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(Rw&&n.locale!=="ko"&&(fi||I!=="onCompositionStart"?I==="onCompositionEnd"&&fi&&(T=Iw()):(Br=c,Ah="value"in Br?Br.value:Br.textContent,fi=!0)),S=Jl(u,I),0<S.length&&(I=new eg(I,e,null,n,c),f.push({event:I,listeners:S}),T?I.data=T:(T=jw(n),T!==null&&(I.data=T)))),(T=WE?KE(e,n):qE(e,n))&&(u=Jl(u,"onBeforeInput"),0<u.length&&(c=new eg("onBeforeInput","beforeinput",null,n,c),f.push({event:c,listeners:u}),c.data=T))}Vw(f,t)})}function ia(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jl(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Jo(e,n),i!=null&&r.unshift(ia(e,i,s)),i=Jo(e,t),i!=null&&r.push(ia(e,i,s))),e=e.return}return r}function ii(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function fg(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=Jo(n,i),l!=null&&o.unshift(ia(n,l,a))):s||(l=Jo(n,i),l!=null&&o.push(ia(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var aT=/\r\n?/g,lT=/\u0000|\uFFFD/g;function hg(e){return(typeof e=="string"?e:""+e).replace(aT,`
38
+ `).replace(lT,"")}function nl(e,t,n){if(t=hg(t),hg(e)!==t&&n)throw Error(V(425))}function Zl(){}var Zd=null,ef=null;function tf(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 nf=typeof setTimeout=="function"?setTimeout:void 0,uT=typeof clearTimeout=="function"?clearTimeout:void 0,pg=typeof Promise=="function"?Promise:void 0,cT=typeof queueMicrotask=="function"?queueMicrotask:typeof pg<"u"?function(e){return pg.resolve(null).then(e).catch(dT)}:nf;function dT(e){setTimeout(function(){throw e})}function Uc(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),ta(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ta(t)}function Gr(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 mg(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 eo=Math.random().toString(36).slice(2),er="__reactFiber$"+eo,oa="__reactProps$"+eo,kr="__reactContainer$"+eo,rf="__reactEvents$"+eo,fT="__reactListeners$"+eo,hT="__reactHandles$"+eo;function Ss(e){var t=e[er];if(t)return t;for(var n=e.parentNode;n;){if(t=n[kr]||n[er]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mg(e);e!==null;){if(n=e[er])return n;e=mg(e)}return t}e=n,n=e.parentNode}return null}function Aa(e){return e=e[er]||e[kr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function mi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(V(33))}function Gu(e){return e[oa]||null}var sf=[],gi=-1;function cs(e){return{current:e}}function Fe(e){0>gi||(e.current=sf[gi],sf[gi]=null,gi--)}function Ne(e,t){gi++,sf[gi]=e.current,e.current=t}var rs={},Rt=cs(rs),Vt=cs(!1),Ls=rs;function Li(e,t){var n=e.type.contextTypes;if(!n)return rs;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 Ht(e){return e=e.childContextTypes,e!=null}function eu(){Fe(Vt),Fe(Rt)}function gg(e,t,n){if(Rt.current!==rs)throw Error(V(168));Ne(Rt,t),Ne(Vt,n)}function Ww(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(V(108,XC(e)||"Unknown",s));return Ye({},n,r)}function tu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rs,Ls=Rt.current,Ne(Rt,e),Ne(Vt,Vt.current),!0}function yg(e,t,n){var r=e.stateNode;if(!r)throw Error(V(169));n?(e=Ww(e,t,Ls),r.__reactInternalMemoizedMergedChildContext=e,Fe(Vt),Fe(Rt),Ne(Rt,e)):Fe(Vt),Ne(Vt,n)}var gr=null,Yu=!1,Vc=!1;function Kw(e){gr===null?gr=[e]:gr.push(e)}function pT(e){Yu=!0,Kw(e)}function ds(){if(!Vc&&gr!==null){Vc=!0;var e=0,t=Se;try{var n=gr;for(Se=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}gr=null,Yu=!1}catch(s){throw gr!==null&&(gr=gr.slice(e+1)),yw(Ih,ds),s}finally{Se=t,Vc=!1}}return null}var yi=[],vi=0,nu=null,ru=0,xn=[],wn=0,Os=null,vr=1,xr="";function ws(e,t){yi[vi++]=ru,yi[vi++]=nu,nu=e,ru=t}function qw(e,t,n){xn[wn++]=vr,xn[wn++]=xr,xn[wn++]=Os,Os=e;var r=vr;e=xr;var s=32-$n(r)-1;r&=~(1<<s),n+=1;var i=32-$n(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,vr=1<<32-$n(t)+s|n<<s|r,xr=i+e}else vr=1<<i|n<<s|r,xr=e}function Oh(e){e.return!==null&&(ws(e,1),qw(e,1,0))}function zh(e){for(;e===nu;)nu=yi[--vi],yi[vi]=null,ru=yi[--vi],yi[vi]=null;for(;e===Os;)Os=xn[--wn],xn[wn]=null,xr=xn[--wn],xn[wn]=null,vr=xn[--wn],xn[wn]=null}var an=null,rn=null,Be=!1,Fn=null;function Gw(e,t){var n=bn(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 vg(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,an=e,rn=Gr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,an=e,rn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Os!==null?{id:vr,overflow:xr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=bn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,an=e,rn=null,!0):!1;default:return!1}}function of(e){return(e.mode&1)!==0&&(e.flags&128)===0}function af(e){if(Be){var t=rn;if(t){var n=t;if(!vg(e,t)){if(of(e))throw Error(V(418));t=Gr(n.nextSibling);var r=an;t&&vg(e,t)?Gw(r,n):(e.flags=e.flags&-4097|2,Be=!1,an=e)}}else{if(of(e))throw Error(V(418));e.flags=e.flags&-4097|2,Be=!1,an=e}}}function xg(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;an=e}function rl(e){if(e!==an)return!1;if(!Be)return xg(e),Be=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!tf(e.type,e.memoizedProps)),t&&(t=rn)){if(of(e))throw Yw(),Error(V(418));for(;t;)Gw(e,t),t=Gr(t.nextSibling)}if(xg(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(V(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){rn=Gr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}rn=null}}else rn=an?Gr(e.stateNode.nextSibling):null;return!0}function Yw(){for(var e=rn;e;)e=Gr(e.nextSibling)}function Oi(){rn=an=null,Be=!1}function Fh(e){Fn===null?Fn=[e]:Fn.push(e)}var mT=Ir.ReactCurrentBatchConfig;function go(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(V(309));var r=n.stateNode}if(!r)throw Error(V(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(V(284));if(!n._owner)throw Error(V(290,e))}return e}function sl(e,t){throw e=Object.prototype.toString.call(t),Error(V(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function wg(e){var t=e._init;return t(e._payload)}function Qw(e){function t(v,x){if(e){var w=v.deletions;w===null?(v.deletions=[x],v.flags|=16):w.push(x)}}function n(v,x){if(!e)return null;for(;x!==null;)t(v,x),x=x.sibling;return null}function r(v,x){for(v=new Map;x!==null;)x.key!==null?v.set(x.key,x):v.set(x.index,x),x=x.sibling;return v}function s(v,x){return v=Jr(v,x),v.index=0,v.sibling=null,v}function i(v,x,w){return v.index=w,e?(w=v.alternate,w!==null?(w=w.index,w<x?(v.flags|=2,x):w):(v.flags|=2,x)):(v.flags|=1048576,x)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function a(v,x,w,C){return x===null||x.tag!==6?(x=Qc(w,v.mode,C),x.return=v,x):(x=s(x,w),x.return=v,x)}function l(v,x,w,C){var k=w.type;return k===di?c(v,x,w.props.children,C,w.key):x!==null&&(x.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Mr&&wg(k)===x.type)?(C=s(x,w.props),C.ref=go(v,x,w),C.return=v,C):(C=Dl(w.type,w.key,w.props,null,v.mode,C),C.ref=go(v,x,w),C.return=v,C)}function u(v,x,w,C){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=Xc(w,v.mode,C),x.return=v,x):(x=s(x,w.children||[]),x.return=v,x)}function c(v,x,w,C,k){return x===null||x.tag!==7?(x=Rs(w,v.mode,C,k),x.return=v,x):(x=s(x,w),x.return=v,x)}function f(v,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=Qc(""+x,v.mode,w),x.return=v,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case qa:return w=Dl(x.type,x.key,x.props,null,v.mode,w),w.ref=go(v,null,x),w.return=v,w;case ci:return x=Xc(x,v.mode,w),x.return=v,x;case Mr:var C=x._init;return f(v,C(x._payload),w)}if(So(x)||co(x))return x=Rs(x,v.mode,w,null),x.return=v,x;sl(v,x)}return null}function h(v,x,w,C){var k=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return k!==null?null:a(v,x,""+w,C);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case qa:return w.key===k?l(v,x,w,C):null;case ci:return w.key===k?u(v,x,w,C):null;case Mr:return k=w._init,h(v,x,k(w._payload),C)}if(So(w)||co(w))return k!==null?null:c(v,x,w,C,null);sl(v,w)}return null}function p(v,x,w,C,k){if(typeof C=="string"&&C!==""||typeof C=="number")return v=v.get(w)||null,a(x,v,""+C,k);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case qa:return v=v.get(C.key===null?w:C.key)||null,l(x,v,C,k);case ci:return v=v.get(C.key===null?w:C.key)||null,u(x,v,C,k);case Mr:var S=C._init;return p(v,x,w,S(C._payload),k)}if(So(C)||co(C))return v=v.get(w)||null,c(x,v,C,k,null);sl(x,C)}return null}function g(v,x,w,C){for(var k=null,S=null,T=x,I=x=0,P=null;T!==null&&I<w.length;I++){T.index>I?(P=T,T=null):P=T.sibling;var E=h(v,T,w[I],C);if(E===null){T===null&&(T=P);break}e&&T&&E.alternate===null&&t(v,T),x=i(E,x,I),S===null?k=E:S.sibling=E,S=E,T=P}if(I===w.length)return n(v,T),Be&&ws(v,I),k;if(T===null){for(;I<w.length;I++)T=f(v,w[I],C),T!==null&&(x=i(T,x,I),S===null?k=T:S.sibling=T,S=T);return Be&&ws(v,I),k}for(T=r(v,T);I<w.length;I++)P=p(T,v,I,w[I],C),P!==null&&(e&&P.alternate!==null&&T.delete(P.key===null?I:P.key),x=i(P,x,I),S===null?k=P:S.sibling=P,S=P);return e&&T.forEach(function(D){return t(v,D)}),Be&&ws(v,I),k}function y(v,x,w,C){var k=co(w);if(typeof k!="function")throw Error(V(150));if(w=k.call(w),w==null)throw Error(V(151));for(var S=k=null,T=x,I=x=0,P=null,E=w.next();T!==null&&!E.done;I++,E=w.next()){T.index>I?(P=T,T=null):P=T.sibling;var D=h(v,T,E.value,C);if(D===null){T===null&&(T=P);break}e&&T&&D.alternate===null&&t(v,T),x=i(D,x,I),S===null?k=D:S.sibling=D,S=D,T=P}if(E.done)return n(v,T),Be&&ws(v,I),k;if(T===null){for(;!E.done;I++,E=w.next())E=f(v,E.value,C),E!==null&&(x=i(E,x,I),S===null?k=E:S.sibling=E,S=E);return Be&&ws(v,I),k}for(T=r(v,T);!E.done;I++,E=w.next())E=p(T,v,I,E.value,C),E!==null&&(e&&E.alternate!==null&&T.delete(E.key===null?I:E.key),x=i(E,x,I),S===null?k=E:S.sibling=E,S=E);return e&&T.forEach(function(M){return t(v,M)}),Be&&ws(v,I),k}function _(v,x,w,C){if(typeof w=="object"&&w!==null&&w.type===di&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case qa:e:{for(var k=w.key,S=x;S!==null;){if(S.key===k){if(k=w.type,k===di){if(S.tag===7){n(v,S.sibling),x=s(S,w.props.children),x.return=v,v=x;break e}}else if(S.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Mr&&wg(k)===S.type){n(v,S.sibling),x=s(S,w.props),x.ref=go(v,S,w),x.return=v,v=x;break e}n(v,S);break}else t(v,S);S=S.sibling}w.type===di?(x=Rs(w.props.children,v.mode,C,w.key),x.return=v,v=x):(C=Dl(w.type,w.key,w.props,null,v.mode,C),C.ref=go(v,x,w),C.return=v,v=C)}return o(v);case ci:e:{for(S=w.key;x!==null;){if(x.key===S)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(v,x.sibling),x=s(x,w.children||[]),x.return=v,v=x;break e}else{n(v,x);break}else t(v,x);x=x.sibling}x=Xc(w,v.mode,C),x.return=v,v=x}return o(v);case Mr:return S=w._init,_(v,x,S(w._payload),C)}if(So(w))return g(v,x,w,C);if(co(w))return y(v,x,w,C);sl(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(v,x.sibling),x=s(x,w),x.return=v,v=x):(n(v,x),x=Qc(w,v.mode,C),x.return=v,v=x),o(v)):n(v,x)}return _}var zi=Qw(!0),Xw=Qw(!1),su=cs(null),iu=null,xi=null,Bh=null;function $h(){Bh=xi=iu=null}function Uh(e){var t=su.current;Fe(su),e._currentValue=t}function lf(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 Ii(e,t){iu=e,Bh=xi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ut=!0),e.firstContext=null)}function Tn(e){var t=e._currentValue;if(Bh!==e)if(e={context:e,memoizedValue:t,next:null},xi===null){if(iu===null)throw Error(V(308));xi=e,iu.dependencies={lanes:0,firstContext:e}}else xi=xi.next=e;return t}var Cs=null;function Vh(e){Cs===null?Cs=[e]:Cs.push(e)}function Jw(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Vh(t)):(n.next=s.next,s.next=n),t.interleaved=n,Sr(e,r)}function Sr(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 Dr=!1;function Hh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zw(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 _r(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Yr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,be&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Sr(e,n)}return s=r.interleaved,s===null?(t.next=t,Vh(r)):(t.next=s.next,s.next=t),r.interleaved=t,Sr(e,n)}function Rl(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,Rh(e,n)}}function _g(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 ou(e,t,n,r){var s=e.updateQueue;Dr=!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=Ye({},f,h);break e;case 2:Dr=!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);Fs|=o,e.lanes=o,e.memoizedState=f}}function bg(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(V(191,s));s.call(r)}}}var Na={},ir=cs(Na),aa=cs(Na),la=cs(Na);function Es(e){if(e===Na)throw Error(V(174));return e}function Wh(e,t){switch(Ne(la,t),Ne(aa,e),Ne(ir,Na),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:$d(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=$d(t,e)}Fe(ir),Ne(ir,t)}function Fi(){Fe(ir),Fe(aa),Fe(la)}function e_(e){Es(la.current);var t=Es(ir.current),n=$d(t,e.type);t!==n&&(Ne(aa,e),Ne(ir,n))}function Kh(e){aa.current===e&&(Fe(ir),Fe(aa))}var He=cs(0);function au(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 Hc=[];function qh(){for(var e=0;e<Hc.length;e++)Hc[e]._workInProgressVersionPrimary=null;Hc.length=0}var Pl=Ir.ReactCurrentDispatcher,Wc=Ir.ReactCurrentBatchConfig,zs=0,Ge=null,at=null,dt=null,lu=!1,Mo=!1,ua=0,gT=0;function bt(){throw Error(V(321))}function Gh(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Hn(e[n],t[n]))return!1;return!0}function Yh(e,t,n,r,s,i){if(zs=i,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Pl.current=e===null||e.memoizedState===null?wT:_T,e=n(r,s),Mo){i=0;do{if(Mo=!1,ua=0,25<=i)throw Error(V(301));i+=1,dt=at=null,t.updateQueue=null,Pl.current=bT,e=n(r,s)}while(Mo)}if(Pl.current=uu,t=at!==null&&at.next!==null,zs=0,dt=at=Ge=null,lu=!1,t)throw Error(V(300));return e}function Qh(){var e=ua!==0;return ua=0,e}function Xn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ge.memoizedState=dt=e:dt=dt.next=e,dt}function In(){if(at===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=at.next;var t=dt===null?Ge.memoizedState:dt.next;if(t!==null)dt=t,at=e;else{if(e===null)throw Error(V(310));at=e,e={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},dt===null?Ge.memoizedState=dt=e:dt=dt.next=e}return dt}function ca(e,t){return typeof t=="function"?t(e):t}function Kc(e){var t=In(),n=t.queue;if(n===null)throw Error(V(311));n.lastRenderedReducer=e;var r=at,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((zs&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,Ge.lanes|=c,Fs|=c}u=u.next}while(u!==null&&u!==i);l===null?o=r:l.next=a,Hn(r,t.memoizedState)||(Ut=!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,Ge.lanes|=i,Fs|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function qc(e){var t=In(),n=t.queue;if(n===null)throw Error(V(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);Hn(i,t.memoizedState)||(Ut=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function t_(){}function n_(e,t){var n=Ge,r=In(),s=t(),i=!Hn(r.memoizedState,s);if(i&&(r.memoizedState=s,Ut=!0),r=r.queue,Xh(i_.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||dt!==null&&dt.memoizedState.tag&1){if(n.flags|=2048,da(9,s_.bind(null,n,r,s,t),void 0,null),ht===null)throw Error(V(349));zs&30||r_(n,t,s)}return s}function r_(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ge.updateQueue,t===null?(t={lastEffect:null,stores:null},Ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function s_(e,t,n,r){t.value=n,t.getSnapshot=r,o_(t)&&a_(e)}function i_(e,t,n){return n(function(){o_(t)&&a_(e)})}function o_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Hn(e,n)}catch{return!0}}function a_(e){var t=Sr(e,1);t!==null&&Un(t,e,1,-1)}function kg(e){var t=Xn();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=xT.bind(null,Ge,e),[t.memoizedState,e]}function da(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ge.updateQueue,t===null?(t={lastEffect:null,stores:null},Ge.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 l_(){return In().memoizedState}function jl(e,t,n,r){var s=Xn();Ge.flags|=e,s.memoizedState=da(1|t,n,void 0,r===void 0?null:r)}function Qu(e,t,n,r){var s=In();r=r===void 0?null:r;var i=void 0;if(at!==null){var o=at.memoizedState;if(i=o.destroy,r!==null&&Gh(r,o.deps)){s.memoizedState=da(t,n,i,r);return}}Ge.flags|=e,s.memoizedState=da(1|t,n,i,r)}function Sg(e,t){return jl(8390656,8,e,t)}function Xh(e,t){return Qu(2048,8,e,t)}function u_(e,t){return Qu(4,2,e,t)}function c_(e,t){return Qu(4,4,e,t)}function d_(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 f_(e,t,n){return n=n!=null?n.concat([e]):null,Qu(4,4,d_.bind(null,t,e),n)}function Jh(){}function h_(e,t){var n=In();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Gh(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function p_(e,t){var n=In();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Gh(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function m_(e,t,n){return zs&21?(Hn(n,t)||(n=ww(),Ge.lanes|=n,Fs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ut=!0),e.memoizedState=n)}function yT(e,t){var n=Se;Se=n!==0&&4>n?n:4,e(!0);var r=Wc.transition;Wc.transition={};try{e(!1),t()}finally{Se=n,Wc.transition=r}}function g_(){return In().memoizedState}function vT(e,t,n){var r=Xr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},y_(e))v_(t,n);else if(n=Jw(e,t,n,r),n!==null){var s=Dt();Un(n,e,r,s),x_(n,t,r)}}function xT(e,t,n){var r=Xr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(y_(e))v_(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,Hn(a,o)){var l=t.interleaved;l===null?(s.next=s,Vh(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=Jw(e,t,s,r),n!==null&&(s=Dt(),Un(n,e,r,s),x_(n,t,r))}}function y_(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function v_(e,t){Mo=lu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function x_(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rh(e,n)}}var uu={readContext:Tn,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useInsertionEffect:bt,useLayoutEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useMutableSource:bt,useSyncExternalStore:bt,useId:bt,unstable_isNewReconciler:!1},wT={readContext:Tn,useCallback:function(e,t){return Xn().memoizedState=[e,t===void 0?null:t],e},useContext:Tn,useEffect:Sg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,jl(4194308,4,d_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return jl(4194308,4,e,t)},useInsertionEffect:function(e,t){return jl(4,2,e,t)},useMemo:function(e,t){var n=Xn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Xn();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=vT.bind(null,Ge,e),[r.memoizedState,e]},useRef:function(e){var t=Xn();return e={current:e},t.memoizedState=e},useState:kg,useDebugValue:Jh,useDeferredValue:function(e){return Xn().memoizedState=e},useTransition:function(){var e=kg(!1),t=e[0];return e=yT.bind(null,e[1]),Xn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ge,s=Xn();if(Be){if(n===void 0)throw Error(V(407));n=n()}else{if(n=t(),ht===null)throw Error(V(349));zs&30||r_(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Sg(i_.bind(null,r,i,e),[e]),r.flags|=2048,da(9,s_.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Xn(),t=ht.identifierPrefix;if(Be){var n=xr,r=vr;n=(r&~(1<<32-$n(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ua++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=gT++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},_T={readContext:Tn,useCallback:h_,useContext:Tn,useEffect:Xh,useImperativeHandle:f_,useInsertionEffect:u_,useLayoutEffect:c_,useMemo:p_,useReducer:Kc,useRef:l_,useState:function(){return Kc(ca)},useDebugValue:Jh,useDeferredValue:function(e){var t=In();return m_(t,at.memoizedState,e)},useTransition:function(){var e=Kc(ca)[0],t=In().memoizedState;return[e,t]},useMutableSource:t_,useSyncExternalStore:n_,useId:g_,unstable_isNewReconciler:!1},bT={readContext:Tn,useCallback:h_,useContext:Tn,useEffect:Xh,useImperativeHandle:f_,useInsertionEffect:u_,useLayoutEffect:c_,useMemo:p_,useReducer:qc,useRef:l_,useState:function(){return qc(ca)},useDebugValue:Jh,useDeferredValue:function(e){var t=In();return at===null?t.memoizedState=e:m_(t,at.memoizedState,e)},useTransition:function(){var e=qc(ca)[0],t=In().memoizedState;return[e,t]},useMutableSource:t_,useSyncExternalStore:n_,useId:g_,unstable_isNewReconciler:!1};function On(e,t){if(e&&e.defaultProps){t=Ye({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function uf(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ye({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xu={isMounted:function(e){return(e=e._reactInternals)?Ws(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Dt(),s=Xr(e),i=_r(r,s);i.payload=t,n!=null&&(i.callback=n),t=Yr(e,i,s),t!==null&&(Un(t,e,s,r),Rl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Dt(),s=Xr(e),i=_r(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Yr(e,i,s),t!==null&&(Un(t,e,s,r),Rl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Dt(),r=Xr(e),s=_r(n,r);s.tag=2,t!=null&&(s.callback=t),t=Yr(e,s,r),t!==null&&(Un(t,e,r,n),Rl(t,e,r))}};function Cg(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?!ra(n,r)||!ra(s,i):!0}function w_(e,t,n){var r=!1,s=rs,i=t.contextType;return typeof i=="object"&&i!==null?i=Tn(i):(s=Ht(t)?Ls:Rt.current,r=t.contextTypes,i=(r=r!=null)?Li(e,s):rs),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Xu,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Eg(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&&Xu.enqueueReplaceState(t,t.state,null)}function cf(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Hh(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Tn(i):(i=Ht(t)?Ls:Rt.current,s.context=Li(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(uf(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&&Xu.enqueueReplaceState(s,s.state,null),ou(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Bi(e,t){try{var n="",r=t;do n+=QC(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 Gc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function df(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var kT=typeof WeakMap=="function"?WeakMap:Map;function __(e,t,n){n=_r(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){du||(du=!0,_f=r),df(e,t)},n}function b_(e,t,n){n=_r(-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(){df(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){df(e,t),typeof r!="function"&&(Qr===null?Qr=new Set([this]):Qr.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Tg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new kT;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=OT.bind(null,e,t,n),t.then(e,e))}function Ig(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 Rg(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=_r(-1,1),t.tag=2,Yr(n,t,1))),n.lanes|=1),e)}var ST=Ir.ReactCurrentOwner,Ut=!1;function Nt(e,t,n,r){t.child=e===null?Xw(t,null,n,r):zi(t,e.child,n,r)}function Pg(e,t,n,r,s){n=n.render;var i=t.ref;return Ii(t,s),r=Yh(e,t,n,r,i,s),n=Qh(),e!==null&&!Ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Cr(e,t,s)):(Be&&n&&Oh(t),t.flags|=1,Nt(e,t,r,s),t.child)}function jg(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!op(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,k_(e,t,i,r,s)):(e=Dl(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:ra,n(o,r)&&e.ref===t.ref)return Cr(e,t,s)}return t.flags|=1,e=Jr(i,r),e.ref=t.ref,e.return=t,t.child=e}function k_(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(ra(i,r)&&e.ref===t.ref)if(Ut=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Ut=!0);else return t.lanes=e.lanes,Cr(e,t,s)}return ff(e,t,n,r,s)}function S_(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},Ne(_i,en),en|=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,Ne(_i,en),en|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ne(_i,en),en|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ne(_i,en),en|=r;return Nt(e,t,s,n),t.child}function C_(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ff(e,t,n,r,s){var i=Ht(n)?Ls:Rt.current;return i=Li(t,i),Ii(t,s),n=Yh(e,t,n,r,i,s),r=Qh(),e!==null&&!Ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Cr(e,t,s)):(Be&&r&&Oh(t),t.flags|=1,Nt(e,t,n,s),t.child)}function Ag(e,t,n,r,s){if(Ht(n)){var i=!0;tu(t)}else i=!1;if(Ii(t,s),t.stateNode===null)Al(e,t),w_(t,n,r),cf(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=Tn(u):(u=Ht(n)?Ls:Rt.current,u=Li(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)&&Eg(t,o,r,u),Dr=!1;var h=t.memoizedState;o.state=h,ou(t,r,o,s),l=t.memoizedState,a!==r||h!==l||Vt.current||Dr?(typeof c=="function"&&(uf(t,n,c,r),l=t.memoizedState),(a=Dr||Cg(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,Zw(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:On(t.type,a),o.props=u,f=t.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Tn(l):(l=Ht(n)?Ls:Rt.current,l=Li(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)&&Eg(t,o,r,l),Dr=!1,h=t.memoizedState,o.state=h,ou(t,r,o,s);var g=t.memoizedState;a!==f||h!==g||Vt.current||Dr?(typeof p=="function"&&(uf(t,n,p,r),g=t.memoizedState),(u=Dr||Cg(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 hf(e,t,n,r,i,s)}function hf(e,t,n,r,s,i){C_(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&yg(t,n,!1),Cr(e,t,i);r=t.stateNode,ST.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=zi(t,e.child,null,i),t.child=zi(t,null,a,i)):Nt(e,t,a,i),t.memoizedState=r.state,s&&yg(t,n,!0),t.child}function E_(e){var t=e.stateNode;t.pendingContext?gg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&gg(e,t.context,!1),Wh(e,t.containerInfo)}function Ng(e,t,n,r,s){return Oi(),Fh(s),t.flags|=256,Nt(e,t,n,r),t.child}var pf={dehydrated:null,treeContext:null,retryLane:0};function mf(e){return{baseLanes:e,cachePool:null,transitions:null}}function T_(e,t,n){var r=t.pendingProps,s=He.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),Ne(He,s&1),e===null)return af(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=ec(o,r,0,null),e=Rs(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=mf(n),t.memoizedState=pf,e):Zh(t,o));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return CT(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=Jr(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=Jr(a,i):(i=Rs(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?mf(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=pf,r}return i=e.child,e=i.sibling,r=Jr(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 Zh(e,t){return t=ec({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function il(e,t,n,r){return r!==null&&Fh(r),zi(t,e.child,null,n),e=Zh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function CT(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Gc(Error(V(422))),il(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=ec({mode:"visible",children:r.children},s,0,null),i=Rs(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&zi(t,e.child,null,o),t.child.memoizedState=mf(o),t.memoizedState=pf,i);if(!(t.mode&1))return il(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(V(419)),r=Gc(i,r,void 0),il(e,t,o,r)}if(a=(o&e.childLanes)!==0,Ut||a){if(r=ht,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,Sr(e,s),Un(r,e,s,-1))}return ip(),r=Gc(Error(V(421))),il(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=zT.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,rn=Gr(s.nextSibling),an=t,Be=!0,Fn=null,e!==null&&(xn[wn++]=vr,xn[wn++]=xr,xn[wn++]=Os,vr=e.id,xr=e.overflow,Os=t),t=Zh(t,r.children),t.flags|=4096,t)}function Mg(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),lf(e.return,t,n)}function Yc(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 I_(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Nt(e,t,r.children,n),r=He.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&&Mg(e,n,t);else if(e.tag===19)Mg(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(Ne(He,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&&au(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Yc(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&&au(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Yc(t,!0,n,null,i);break;case"together":Yc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Al(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Cr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Fs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(V(153));if(t.child!==null){for(e=t.child,n=Jr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Jr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ET(e,t,n){switch(t.tag){case 3:E_(t),Oi();break;case 5:e_(t);break;case 1:Ht(t.type)&&tu(t);break;case 4:Wh(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Ne(su,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ne(He,He.current&1),t.flags|=128,null):n&t.child.childLanes?T_(e,t,n):(Ne(He,He.current&1),e=Cr(e,t,n),e!==null?e.sibling:null);Ne(He,He.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return I_(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ne(He,He.current),r)break;return null;case 22:case 23:return t.lanes=0,S_(e,t,n)}return Cr(e,t,n)}var R_,gf,P_,j_;R_=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}};gf=function(){};P_=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Es(ir.current);var i=null;switch(n){case"input":s=Od(e,s),r=Od(e,r),i=[];break;case"select":s=Ye({},s,{value:void 0}),r=Ye({},r,{value:void 0}),i=[];break;case"textarea":s=Bd(e,s),r=Bd(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Zl)}Ud(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"&&(Qo.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"&&(Qo.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&ze("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)}};j_=function(e,t,n,r){n!==r&&(t.flags|=4)};function yo(e,t){if(!Be)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 kt(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 TT(e,t,n){var r=t.pendingProps;switch(zh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(t),null;case 1:return Ht(t.type)&&eu(),kt(t),null;case 3:return r=t.stateNode,Fi(),Fe(Vt),Fe(Rt),qh(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(rl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fn!==null&&(Sf(Fn),Fn=null))),gf(e,t),kt(t),null;case 5:Kh(t);var s=Es(la.current);if(n=t.type,e!==null&&t.stateNode!=null)P_(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(V(166));return kt(t),null}if(e=Es(ir.current),rl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[er]=t,r[oa]=i,e=(t.mode&1)!==0,n){case"dialog":ze("cancel",r),ze("close",r);break;case"iframe":case"object":case"embed":ze("load",r);break;case"video":case"audio":for(s=0;s<Eo.length;s++)ze(Eo[s],r);break;case"source":ze("error",r);break;case"img":case"image":case"link":ze("error",r),ze("load",r);break;case"details":ze("toggle",r);break;case"input":Vm(r,i),ze("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ze("invalid",r);break;case"textarea":Wm(r,i),ze("invalid",r)}Ud(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&&nl(r.textContent,a,e),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&nl(r.textContent,a,e),s=["children",""+a]):Qo.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ze("scroll",r)}switch(n){case"input":Ga(r),Hm(r,i,!0);break;case"textarea":Ga(r),Km(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Zl)}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=iw(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[er]=t,e[oa]=r,R_(e,t,!1,!1),t.stateNode=e;e:{switch(o=Vd(n,r),n){case"dialog":ze("cancel",e),ze("close",e),s=r;break;case"iframe":case"object":case"embed":ze("load",e),s=r;break;case"video":case"audio":for(s=0;s<Eo.length;s++)ze(Eo[s],e);s=r;break;case"source":ze("error",e),s=r;break;case"img":case"image":case"link":ze("error",e),ze("load",e),s=r;break;case"details":ze("toggle",e),s=r;break;case"input":Vm(e,r),s=Od(e,r),ze("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Ye({},r,{value:void 0}),ze("invalid",e);break;case"textarea":Wm(e,r),s=Bd(e,r),ze("invalid",e);break;default:s=r}Ud(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?lw(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&ow(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Xo(e,l):typeof l=="number"&&Xo(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Qo.hasOwnProperty(i)?l!=null&&i==="onScroll"&&ze("scroll",e):l!=null&&kh(e,i,l,o))}switch(n){case"input":Ga(e),Hm(e,r,!1);break;case"textarea":Ga(e),Km(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ns(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Si(e,!!r.multiple,i,!1):r.defaultValue!=null&&Si(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Zl)}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 kt(t),null;case 6:if(e&&t.stateNode!=null)j_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(V(166));if(n=Es(la.current),Es(ir.current),rl(t)){if(r=t.stateNode,n=t.memoizedProps,r[er]=t,(i=r.nodeValue!==n)&&(e=an,e!==null))switch(e.tag){case 3:nl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&nl(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[er]=t,t.stateNode=r}return kt(t),null;case 13:if(Fe(He),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Be&&rn!==null&&t.mode&1&&!(t.flags&128))Yw(),Oi(),t.flags|=98560,i=!1;else if(i=rl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(V(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(V(317));i[er]=t}else Oi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kt(t),i=!1}else Fn!==null&&(Sf(Fn),Fn=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||He.current&1?lt===0&&(lt=3):ip())),t.updateQueue!==null&&(t.flags|=4),kt(t),null);case 4:return Fi(),gf(e,t),e===null&&sa(t.stateNode.containerInfo),kt(t),null;case 10:return Uh(t.type._context),kt(t),null;case 17:return Ht(t.type)&&eu(),kt(t),null;case 19:if(Fe(He),i=t.memoizedState,i===null)return kt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)yo(i,!1);else{if(lt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=au(e),o!==null){for(t.flags|=128,yo(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 Ne(He,He.current&1|2),t.child}e=e.sibling}i.tail!==null&&et()>$i&&(t.flags|=128,r=!0,yo(i,!1),t.lanes=4194304)}else{if(!r)if(e=au(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),yo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Be)return kt(t),null}else 2*et()-i.renderingStartTime>$i&&n!==1073741824&&(t.flags|=128,r=!0,yo(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=et(),t.sibling=null,n=He.current,Ne(He,r?n&1|2:n&1),t):(kt(t),null);case 22:case 23:return sp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?en&1073741824&&(kt(t),t.subtreeFlags&6&&(t.flags|=8192)):kt(t),null;case 24:return null;case 25:return null}throw Error(V(156,t.tag))}function IT(e,t){switch(zh(t),t.tag){case 1:return Ht(t.type)&&eu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Fi(),Fe(Vt),Fe(Rt),qh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Kh(t),null;case 13:if(Fe(He),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(V(340));Oi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fe(He),null;case 4:return Fi(),null;case 10:return Uh(t.type._context),null;case 22:case 23:return sp(),null;case 24:return null;default:return null}}var ol=!1,St=!1,RT=typeof WeakSet=="function"?WeakSet:Set,J=null;function wi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(e,t,r)}else n.current=null}function yf(e,t,n){try{n()}catch(r){Qe(e,t,r)}}var Dg=!1;function PT(e,t){if(Zd=Ql,e=Lw(),Lh(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(ef={focusedElem:e,selectionRange:n},Ql=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;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,_=g.memoizedState,v=t.stateNode,x=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:On(t.type,y),_);v.__reactInternalSnapshotBeforeUpdate=x}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(V(163))}}catch(C){Qe(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return g=Dg,Dg=!1,g}function Do(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&&yf(t,n,i)}s=s.next}while(s!==r)}}function Ju(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 vf(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 A_(e){var t=e.alternate;t!==null&&(e.alternate=null,A_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[er],delete t[oa],delete t[rf],delete t[fT],delete t[hT])),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 N_(e){return e.tag===5||e.tag===3||e.tag===4}function Lg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||N_(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 xf(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=Zl));else if(r!==4&&(e=e.child,e!==null))for(xf(e,t,n),e=e.sibling;e!==null;)xf(e,t,n),e=e.sibling}function wf(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(wf(e,t,n),e=e.sibling;e!==null;)wf(e,t,n),e=e.sibling}var gt=null,zn=!1;function Ar(e,t,n){for(n=n.child;n!==null;)M_(e,t,n),n=n.sibling}function M_(e,t,n){if(sr&&typeof sr.onCommitFiberUnmount=="function")try{sr.onCommitFiberUnmount(Hu,n)}catch{}switch(n.tag){case 5:St||wi(n,t);case 6:var r=gt,s=zn;gt=null,Ar(e,t,n),gt=r,zn=s,gt!==null&&(zn?(e=gt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):gt.removeChild(n.stateNode));break;case 18:gt!==null&&(zn?(e=gt,n=n.stateNode,e.nodeType===8?Uc(e.parentNode,n):e.nodeType===1&&Uc(e,n),ta(e)):Uc(gt,n.stateNode));break;case 4:r=gt,s=zn,gt=n.stateNode.containerInfo,zn=!0,Ar(e,t,n),gt=r,zn=s;break;case 0:case 11:case 14:case 15:if(!St&&(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)&&yf(n,t,o),s=s.next}while(s!==r)}Ar(e,t,n);break;case 1:if(!St&&(wi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Qe(n,t,a)}Ar(e,t,n);break;case 21:Ar(e,t,n);break;case 22:n.mode&1?(St=(r=St)||n.memoizedState!==null,Ar(e,t,n),St=r):Ar(e,t,n);break;default:Ar(e,t,n)}}function Og(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new RT),t.forEach(function(r){var s=FT.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ln(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:gt=a.stateNode,zn=!1;break e;case 3:gt=a.stateNode.containerInfo,zn=!0;break e;case 4:gt=a.stateNode.containerInfo,zn=!0;break e}a=a.return}if(gt===null)throw Error(V(160));M_(i,o,s),gt=null,zn=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(u){Qe(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)D_(t,e),t=t.sibling}function D_(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ln(t,e),Yn(e),r&4){try{Do(3,e,e.return),Ju(3,e)}catch(y){Qe(e,e.return,y)}try{Do(5,e,e.return)}catch(y){Qe(e,e.return,y)}}break;case 1:Ln(t,e),Yn(e),r&512&&n!==null&&wi(n,n.return);break;case 5:if(Ln(t,e),Yn(e),r&512&&n!==null&&wi(n,n.return),e.flags&32){var s=e.stateNode;try{Xo(s,"")}catch(y){Qe(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&&rw(s,i),Vd(a,o);var u=Vd(a,i);for(o=0;o<l.length;o+=2){var c=l[o],f=l[o+1];c==="style"?lw(s,f):c==="dangerouslySetInnerHTML"?ow(s,f):c==="children"?Xo(s,f):kh(s,c,f,u)}switch(a){case"input":zd(s,i);break;case"textarea":sw(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Si(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Si(s,!!i.multiple,i.defaultValue,!0):Si(s,!!i.multiple,i.multiple?[]:"",!1))}s[oa]=i}catch(y){Qe(e,e.return,y)}}break;case 6:if(Ln(t,e),Yn(e),r&4){if(e.stateNode===null)throw Error(V(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(y){Qe(e,e.return,y)}}break;case 3:if(Ln(t,e),Yn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ta(t.containerInfo)}catch(y){Qe(e,e.return,y)}break;case 4:Ln(t,e),Yn(e);break;case 13:Ln(t,e),Yn(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(np=et())),r&4&&Og(e);break;case 22:if(c=n!==null&&n.memoizedState!==null,e.mode&1?(St=(u=St)||c,Ln(t,e),St=u):Ln(t,e),Yn(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!c&&e.mode&1)for(J=e,c=e.child;c!==null;){for(f=J=c;J!==null;){switch(h=J,p=h.child,h.tag){case 0:case 11:case 14:case 15:Do(4,h,h.return);break;case 1:wi(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){Qe(r,n,y)}}break;case 5:wi(h,h.return);break;case 22:if(h.memoizedState!==null){Fg(f);continue}}p!==null?(p.return=h,J=p):Fg(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=aw("display",o))}catch(y){Qe(e,e.return,y)}}}else if(f.tag===6){if(c===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){Qe(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:Ln(t,e),Yn(e),r&4&&Og(e);break;case 21:break;default:Ln(t,e),Yn(e)}}function Yn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(N_(n)){var r=n;break e}n=n.return}throw Error(V(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Xo(s,""),r.flags&=-33);var i=Lg(e);wf(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Lg(e);xf(e,a,o);break;default:throw Error(V(161))}}catch(l){Qe(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function jT(e,t,n){J=e,L_(e)}function L_(e,t,n){for(var r=(e.mode&1)!==0;J!==null;){var s=J,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||ol;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||St;a=ol;var u=St;if(ol=o,(St=l)&&!u)for(J=s;J!==null;)o=J,l=o.child,o.tag===22&&o.memoizedState!==null?Bg(s):l!==null?(l.return=o,J=l):Bg(s);for(;i!==null;)J=i,L_(i),i=i.sibling;J=s,ol=a,St=u}zg(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,J=i):zg(e)}}function zg(e){for(;J!==null;){var t=J;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:St||Ju(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!St)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:On(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&bg(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}bg(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&&ta(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(V(163))}St||t.flags&512&&vf(t)}catch(h){Qe(t,t.return,h)}}if(t===e){J=null;break}if(n=t.sibling,n!==null){n.return=t.return,J=n;break}J=t.return}}function Fg(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var n=t.sibling;if(n!==null){n.return=t.return,J=n;break}J=t.return}}function Bg(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ju(4,t)}catch(l){Qe(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(l){Qe(t,s,l)}}var i=t.return;try{vf(t)}catch(l){Qe(t,i,l)}break;case 5:var o=t.return;try{vf(t)}catch(l){Qe(t,o,l)}}}catch(l){Qe(t,t.return,l)}if(t===e){J=null;break}var a=t.sibling;if(a!==null){a.return=t.return,J=a;break}J=t.return}}var AT=Math.ceil,cu=Ir.ReactCurrentDispatcher,ep=Ir.ReactCurrentOwner,Cn=Ir.ReactCurrentBatchConfig,be=0,ht=null,ot=null,xt=0,en=0,_i=cs(0),lt=0,fa=null,Fs=0,Zu=0,tp=0,Lo=null,Ft=null,np=0,$i=1/0,pr=null,du=!1,_f=null,Qr=null,al=!1,$r=null,fu=0,Oo=0,bf=null,Nl=-1,Ml=0;function Dt(){return be&6?et():Nl!==-1?Nl:Nl=et()}function Xr(e){return e.mode&1?be&2&&xt!==0?xt&-xt:mT.transition!==null?(Ml===0&&(Ml=ww()),Ml):(e=Se,e!==0||(e=window.event,e=e===void 0?16:Tw(e.type)),e):1}function Un(e,t,n,r){if(50<Oo)throw Oo=0,bf=null,Error(V(185));Pa(e,n,r),(!(be&2)||e!==ht)&&(e===ht&&(!(be&2)&&(Zu|=n),lt===4&&zr(e,xt)),Wt(e,r),n===1&&be===0&&!(t.mode&1)&&($i=et()+500,Yu&&ds()))}function Wt(e,t){var n=e.callbackNode;mE(e,t);var r=Yl(e,e===ht?xt:0);if(r===0)n!==null&&Ym(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ym(n),t===1)e.tag===0?pT($g.bind(null,e)):Kw($g.bind(null,e)),cT(function(){!(be&6)&&ds()}),n=null;else{switch(_w(r)){case 1:n=Ih;break;case 4:n=vw;break;case 16:n=Gl;break;case 536870912:n=xw;break;default:n=Gl}n=H_(n,O_.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function O_(e,t){if(Nl=-1,Ml=0,be&6)throw Error(V(327));var n=e.callbackNode;if(Ri()&&e.callbackNode!==n)return null;var r=Yl(e,e===ht?xt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=hu(e,r);else{t=r;var s=be;be|=2;var i=F_();(ht!==e||xt!==t)&&(pr=null,$i=et()+500,Is(e,t));do try{DT();break}catch(a){z_(e,a)}while(!0);$h(),cu.current=i,be=s,ot!==null?t=0:(ht=null,xt=0,t=lt)}if(t!==0){if(t===2&&(s=Gd(e),s!==0&&(r=s,t=kf(e,s))),t===1)throw n=fa,Is(e,0),zr(e,r),Wt(e,et()),n;if(t===6)zr(e,r);else{if(s=e.current.alternate,!(r&30)&&!NT(s)&&(t=hu(e,r),t===2&&(i=Gd(e),i!==0&&(r=i,t=kf(e,i))),t===1))throw n=fa,Is(e,0),zr(e,r),Wt(e,et()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(V(345));case 2:_s(e,Ft,pr);break;case 3:if(zr(e,r),(r&130023424)===r&&(t=np+500-et(),10<t)){if(Yl(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Dt(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=nf(_s.bind(null,e,Ft,pr),t);break}_s(e,Ft,pr);break;case 4:if(zr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-$n(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=et()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*AT(r/1960))-r,10<r){e.timeoutHandle=nf(_s.bind(null,e,Ft,pr),r);break}_s(e,Ft,pr);break;case 5:_s(e,Ft,pr);break;default:throw Error(V(329))}}}return Wt(e,et()),e.callbackNode===n?O_.bind(null,e):null}function kf(e,t){var n=Lo;return e.current.memoizedState.isDehydrated&&(Is(e,t).flags|=256),e=hu(e,t),e!==2&&(t=Ft,Ft=n,t!==null&&Sf(t)),e}function Sf(e){Ft===null?Ft=e:Ft.push.apply(Ft,e)}function NT(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(!Hn(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 zr(e,t){for(t&=~tp,t&=~Zu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-$n(t),r=1<<n;e[n]=-1,t&=~r}}function $g(e){if(be&6)throw Error(V(327));Ri();var t=Yl(e,0);if(!(t&1))return Wt(e,et()),null;var n=hu(e,t);if(e.tag!==0&&n===2){var r=Gd(e);r!==0&&(t=r,n=kf(e,r))}if(n===1)throw n=fa,Is(e,0),zr(e,t),Wt(e,et()),n;if(n===6)throw Error(V(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,_s(e,Ft,pr),Wt(e,et()),null}function rp(e,t){var n=be;be|=1;try{return e(t)}finally{be=n,be===0&&($i=et()+500,Yu&&ds())}}function Bs(e){$r!==null&&$r.tag===0&&!(be&6)&&Ri();var t=be;be|=1;var n=Cn.transition,r=Se;try{if(Cn.transition=null,Se=1,e)return e()}finally{Se=r,Cn.transition=n,be=t,!(be&6)&&ds()}}function sp(){en=_i.current,Fe(_i)}function Is(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,uT(n)),ot!==null)for(n=ot.return;n!==null;){var r=n;switch(zh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&eu();break;case 3:Fi(),Fe(Vt),Fe(Rt),qh();break;case 5:Kh(r);break;case 4:Fi();break;case 13:Fe(He);break;case 19:Fe(He);break;case 10:Uh(r.type._context);break;case 22:case 23:sp()}n=n.return}if(ht=e,ot=e=Jr(e.current,null),xt=en=t,lt=0,fa=null,tp=Zu=Fs=0,Ft=Lo=null,Cs!==null){for(t=0;t<Cs.length;t++)if(n=Cs[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}Cs=null}return e}function z_(e,t){do{var n=ot;try{if($h(),Pl.current=uu,lu){for(var r=Ge.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}lu=!1}if(zs=0,dt=at=Ge=null,Mo=!1,ua=0,ep.current=null,n===null||n.return===null){lt=1,fa=t,ot=null;break}e:{var i=e,o=n.return,a=n,l=t;if(t=xt,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=Ig(o);if(p!==null){p.flags&=-257,Rg(p,o,a,i,t),p.mode&1&&Tg(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)){Tg(i,u,t),ip();break e}l=Error(V(426))}}else if(Be&&a.mode&1){var _=Ig(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Rg(_,o,a,i,t),Fh(Bi(l,a));break e}}i=l=Bi(l,a),lt!==4&&(lt=2),Lo===null?Lo=[i]:Lo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=__(i,l,t);_g(i,v);break e;case 1:a=l;var x=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Qr===null||!Qr.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=b_(i,a,t);_g(i,C);break e}}i=i.return}while(i!==null)}$_(n)}catch(k){t=k,ot===n&&n!==null&&(ot=n=n.return);continue}break}while(!0)}function F_(){var e=cu.current;return cu.current=uu,e===null?uu:e}function ip(){(lt===0||lt===3||lt===2)&&(lt=4),ht===null||!(Fs&268435455)&&!(Zu&268435455)||zr(ht,xt)}function hu(e,t){var n=be;be|=2;var r=F_();(ht!==e||xt!==t)&&(pr=null,Is(e,t));do try{MT();break}catch(s){z_(e,s)}while(!0);if($h(),be=n,cu.current=r,ot!==null)throw Error(V(261));return ht=null,xt=0,lt}function MT(){for(;ot!==null;)B_(ot)}function DT(){for(;ot!==null&&!oE();)B_(ot)}function B_(e){var t=V_(e.alternate,e,en);e.memoizedProps=e.pendingProps,t===null?$_(e):ot=t,ep.current=null}function $_(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=IT(n,t),n!==null){n.flags&=32767,ot=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{lt=6,ot=null;return}}else if(n=TT(n,t,en),n!==null){ot=n;return}if(t=t.sibling,t!==null){ot=t;return}ot=t=e}while(t!==null);lt===0&&(lt=5)}function _s(e,t,n){var r=Se,s=Cn.transition;try{Cn.transition=null,Se=1,LT(e,t,n,r)}finally{Cn.transition=s,Se=r}return null}function LT(e,t,n,r){do Ri();while($r!==null);if(be&6)throw Error(V(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(V(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(gE(e,i),e===ht&&(ot=ht=null,xt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||al||(al=!0,H_(Gl,function(){return Ri(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Cn.transition,Cn.transition=null;var o=Se;Se=1;var a=be;be|=4,ep.current=null,PT(e,n),D_(n,e),nT(ef),Ql=!!Zd,ef=Zd=null,e.current=n,jT(n),aE(),be=a,Se=o,Cn.transition=i}else e.current=n;if(al&&(al=!1,$r=e,fu=s),i=e.pendingLanes,i===0&&(Qr=null),cE(n.stateNode),Wt(e,et()),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(du)throw du=!1,e=_f,_f=null,e;return fu&1&&e.tag!==0&&Ri(),i=e.pendingLanes,i&1?e===bf?Oo++:(Oo=0,bf=e):Oo=0,ds(),null}function Ri(){if($r!==null){var e=_w(fu),t=Cn.transition,n=Se;try{if(Cn.transition=null,Se=16>e?16:e,$r===null)var r=!1;else{if(e=$r,$r=null,fu=0,be&6)throw Error(V(331));var s=be;for(be|=4,J=e.current;J!==null;){var i=J,o=i.child;if(J.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(J=u;J!==null;){var c=J;switch(c.tag){case 0:case 11:case 15:Do(8,c,i)}var f=c.child;if(f!==null)f.return=c,J=f;else for(;J!==null;){c=J;var h=c.sibling,p=c.return;if(A_(c),c===u){J=null;break}if(h!==null){h.return=p,J=h;break}J=p}}}var g=i.alternate;if(g!==null){var y=g.child;if(y!==null){g.child=null;do{var _=y.sibling;y.sibling=null,y=_}while(y!==null)}}J=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,J=o;else e:for(;J!==null;){if(i=J,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Do(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,J=v;break e}J=i.return}}var x=e.current;for(J=x;J!==null;){o=J;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,J=w;else e:for(o=x;J!==null;){if(a=J,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ju(9,a)}}catch(k){Qe(a,a.return,k)}if(a===o){J=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,J=C;break e}J=a.return}}if(be=s,ds(),sr&&typeof sr.onPostCommitFiberRoot=="function")try{sr.onPostCommitFiberRoot(Hu,e)}catch{}r=!0}return r}finally{Se=n,Cn.transition=t}}return!1}function Ug(e,t,n){t=Bi(n,t),t=__(e,t,1),e=Yr(e,t,1),t=Dt(),e!==null&&(Pa(e,1,t),Wt(e,t))}function Qe(e,t,n){if(e.tag===3)Ug(e,e,n);else for(;t!==null;){if(t.tag===3){Ug(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qr===null||!Qr.has(r))){e=Bi(n,e),e=b_(t,e,1),t=Yr(t,e,1),e=Dt(),t!==null&&(Pa(t,1,e),Wt(t,e));break}}t=t.return}}function OT(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Dt(),e.pingedLanes|=e.suspendedLanes&n,ht===e&&(xt&n)===n&&(lt===4||lt===3&&(xt&130023424)===xt&&500>et()-np?Is(e,0):tp|=n),Wt(e,t)}function U_(e,t){t===0&&(e.mode&1?(t=Xa,Xa<<=1,!(Xa&130023424)&&(Xa=4194304)):t=1);var n=Dt();e=Sr(e,t),e!==null&&(Pa(e,t,n),Wt(e,n))}function zT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),U_(e,n)}function FT(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(V(314))}r!==null&&r.delete(t),U_(e,n)}var V_;V_=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Vt.current)Ut=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ut=!1,ET(e,t,n);Ut=!!(e.flags&131072)}else Ut=!1,Be&&t.flags&1048576&&qw(t,ru,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Al(e,t),e=t.pendingProps;var s=Li(t,Rt.current);Ii(t,n),s=Yh(null,t,r,e,s,n);var i=Qh();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,Ht(r)?(i=!0,tu(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Hh(t),s.updater=Xu,t.stateNode=s,s._reactInternals=t,cf(t,r,e,n),t=hf(null,t,r,!0,i,n)):(t.tag=0,Be&&i&&Oh(t),Nt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Al(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=$T(r),e=On(r,e),s){case 0:t=ff(null,t,r,e,n);break e;case 1:t=Ag(null,t,r,e,n);break e;case 11:t=Pg(null,t,r,e,n);break e;case 14:t=jg(null,t,r,On(r.type,e),n);break e}throw Error(V(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:On(r,s),ff(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:On(r,s),Ag(e,t,r,s,n);case 3:e:{if(E_(t),e===null)throw Error(V(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Zw(e,t),ou(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=Bi(Error(V(423)),t),t=Ng(e,t,r,n,s);break e}else if(r!==s){s=Bi(Error(V(424)),t),t=Ng(e,t,r,n,s);break e}else for(rn=Gr(t.stateNode.containerInfo.firstChild),an=t,Be=!0,Fn=null,n=Xw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Oi(),r===s){t=Cr(e,t,n);break e}Nt(e,t,r,n)}t=t.child}return t;case 5:return e_(t),e===null&&af(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,tf(r,s)?o=null:i!==null&&tf(r,i)&&(t.flags|=32),C_(e,t),Nt(e,t,o,n),t.child;case 6:return e===null&&af(t),null;case 13:return T_(e,t,n);case 4:return Wh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=zi(t,null,r,n):Nt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:On(r,s),Pg(e,t,r,s,n);case 7:return Nt(e,t,t.pendingProps,n),t.child;case 8:return Nt(e,t,t.pendingProps.children,n),t.child;case 12:return Nt(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,Ne(su,r._currentValue),r._currentValue=o,i!==null)if(Hn(i.value,o)){if(i.children===s.children&&!Vt.current){t=Cr(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=_r(-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),lf(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(V(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),lf(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}Nt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ii(t,n),s=Tn(s),r=r(s),t.flags|=1,Nt(e,t,r,n),t.child;case 14:return r=t.type,s=On(r,t.pendingProps),s=On(r.type,s),jg(e,t,r,s,n);case 15:return k_(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:On(r,s),Al(e,t),t.tag=1,Ht(r)?(e=!0,tu(t)):e=!1,Ii(t,n),w_(t,r,s),cf(t,r,s,n),hf(null,t,r,!0,e,n);case 19:return I_(e,t,n);case 22:return S_(e,t,n)}throw Error(V(156,t.tag))};function H_(e,t){return yw(e,t)}function BT(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 bn(e,t,n,r){return new BT(e,t,n,r)}function op(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $T(e){if(typeof e=="function")return op(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ch)return 11;if(e===Eh)return 14}return 2}function Jr(e,t){var n=e.alternate;return n===null?(n=bn(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 Dl(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")op(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case di:return Rs(n.children,s,i,t);case Sh:o=8,s|=8;break;case Nd:return e=bn(12,n,t,s|2),e.elementType=Nd,e.lanes=i,e;case Md:return e=bn(13,n,t,s),e.elementType=Md,e.lanes=i,e;case Dd:return e=bn(19,n,t,s),e.elementType=Dd,e.lanes=i,e;case ew:return ec(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Jx:o=10;break e;case Zx:o=9;break e;case Ch:o=11;break e;case Eh:o=14;break e;case Mr:o=16,r=null;break e}throw Error(V(130,e==null?e:typeof e,""))}return t=bn(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Rs(e,t,n,r){return e=bn(7,e,r,t),e.lanes=n,e}function ec(e,t,n,r){return e=bn(22,e,r,t),e.elementType=ew,e.lanes=n,e.stateNode={isHidden:!1},e}function Qc(e,t,n){return e=bn(6,e,null,t),e.lanes=n,e}function Xc(e,t,n){return t=bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function UT(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=jc(0),this.expirationTimes=jc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jc(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function ap(e,t,n,r,s,i,o,a,l){return e=new UT(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=bn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hh(i),e}function VT(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ci,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function W_(e){if(!e)return rs;e=e._reactInternals;e:{if(Ws(e)!==e||e.tag!==1)throw Error(V(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ht(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(V(171))}if(e.tag===1){var n=e.type;if(Ht(n))return Ww(e,n,t)}return t}function K_(e,t,n,r,s,i,o,a,l){return e=ap(n,r,!0,e,s,i,o,a,l),e.context=W_(null),n=e.current,r=Dt(),s=Xr(n),i=_r(r,s),i.callback=t??null,Yr(n,i,s),e.current.lanes=s,Pa(e,s,r),Wt(e,r),e}function tc(e,t,n,r){var s=t.current,i=Dt(),o=Xr(s);return n=W_(n),t.context===null?t.context=n:t.pendingContext=n,t=_r(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Yr(s,t,o),e!==null&&(Un(e,s,o,i),Rl(e,s,o)),o}function pu(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 Vg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lp(e,t){Vg(e,t),(e=e.alternate)&&Vg(e,t)}function HT(){return null}var q_=typeof reportError=="function"?reportError:function(e){console.error(e)};function up(e){this._internalRoot=e}nc.prototype.render=up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(V(409));tc(e,t,null,null)};nc.prototype.unmount=up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Bs(function(){tc(null,e,null,null)}),t[kr]=null}};function nc(e){this._internalRoot=e}nc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Sw();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Or.length&&t!==0&&t<Or[n].priority;n++);Or.splice(n,0,e),n===0&&Ew(e)}};function cp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function rc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Hg(){}function WT(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=pu(o);i.call(u)}}var o=K_(t,r,e,0,null,!1,!1,"",Hg);return e._reactRootContainer=o,e[kr]=o.current,sa(e.nodeType===8?e.parentNode:e),Bs(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var u=pu(l);a.call(u)}}var l=ap(e,0,!1,null,null,!1,!1,"",Hg);return e._reactRootContainer=l,e[kr]=l.current,sa(e.nodeType===8?e.parentNode:e),Bs(function(){tc(t,l,n,r)}),l}function sc(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=pu(o);a.call(l)}}tc(t,o,e,s)}else o=WT(n,t,e,s,r);return pu(o)}bw=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Co(t.pendingLanes);n!==0&&(Rh(t,n|1),Wt(t,et()),!(be&6)&&($i=et()+500,ds()))}break;case 13:Bs(function(){var r=Sr(e,1);if(r!==null){var s=Dt();Un(r,e,1,s)}}),lp(e,1)}};Ph=function(e){if(e.tag===13){var t=Sr(e,134217728);if(t!==null){var n=Dt();Un(t,e,134217728,n)}lp(e,134217728)}};kw=function(e){if(e.tag===13){var t=Xr(e),n=Sr(e,t);if(n!==null){var r=Dt();Un(n,e,t,r)}lp(e,t)}};Sw=function(){return Se};Cw=function(e,t){var n=Se;try{return Se=e,t()}finally{Se=n}};Wd=function(e,t,n){switch(t){case"input":if(zd(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=Gu(r);if(!s)throw Error(V(90));nw(r),zd(r,s)}}}break;case"textarea":sw(e,n);break;case"select":t=n.value,t!=null&&Si(e,!!n.multiple,t,!1)}};dw=rp;fw=Bs;var KT={usingClientEntryPoint:!1,Events:[Aa,mi,Gu,uw,cw,rp]},vo={findFiberByHostInstance:Ss,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},qT={bundleType:vo.bundleType,version:vo.version,rendererPackageName:vo.rendererPackageName,rendererConfig:vo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ir.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=mw(e),e===null?null:e.stateNode},findFiberByHostInstance:vo.findFiberByHostInstance||HT,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 ll=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ll.isDisabled&&ll.supportsFiber)try{Hu=ll.inject(qT),sr=ll}catch{}}pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KT;pn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cp(t))throw Error(V(200));return VT(e,t,null,n)};pn.createRoot=function(e,t){if(!cp(e))throw Error(V(299));var n=!1,r="",s=q_;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=ap(e,1,!1,null,null,n,!1,r,s),e[kr]=t.current,sa(e.nodeType===8?e.parentNode:e),new up(t)};pn.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(V(188)):(e=Object.keys(e).join(","),Error(V(268,e)));return e=mw(t),e=e===null?null:e.stateNode,e};pn.flushSync=function(e){return Bs(e)};pn.hydrate=function(e,t,n){if(!rc(t))throw Error(V(200));return sc(null,e,t,!0,n)};pn.hydrateRoot=function(e,t,n){if(!cp(e))throw Error(V(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=q_;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=K_(t,null,e,1,n??null,s,!1,i,o),e[kr]=t.current,sa(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 nc(t)};pn.render=function(e,t,n){if(!rc(t))throw Error(V(200));return sc(null,e,t,!1,n)};pn.unmountComponentAtNode=function(e){if(!rc(e))throw Error(V(40));return e._reactRootContainer?(Bs(function(){sc(null,null,e,!1,function(){e._reactRootContainer=null,e[kr]=null})}),!0):!1};pn.unstable_batchedUpdates=rp;pn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!rc(n))throw Error(V(200));if(e==null||e._reactInternals===void 0)throw Error(V(38));return sc(e,t,n,!1,r)};pn.version="18.3.1-next-f1338f8080-20240426";function G_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(G_)}catch(e){console.error(e)}}G_(),Gx.exports=pn;var Y_=Gx.exports,Q_,Wg=Y_;Q_=Wg.createRoot,Wg.hydrateRoot;function GT(e,t){const n=e[X_];if(!n)throw new Error("ResourceElement.type is not a valid Resource");return n(t)}const X_=Symbol("fnSymbol");function ve(e){const t=n=>({type:t,props:n});return t[X_]=e,t}function ur(e,t){return{...t,key:e}}let zo=null;function YT(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 ss(){if(!zo)throw new Error("No resource fiber available");return zo}function QT(e){return null}const J_=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),mu=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},Fo=(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()),mu(e)}}},Kg=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))},Z_=(e,t)=>{const n=ss(),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},XT=e=>{ss().renderContext.effectTasks.push(e)},JT=(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 eb(e,t,n,r){const s=Z_("reducer",()=>{const a=ss(),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};JT(a,()=>a.root.dirtyCells.length===0&&!c.hasEagerState&&(c.eagerState=e(s.workInProgress,u),c.hasEagerState=!0,Object.is(s.current,c.eagerState))?null:()=>{Kg(a,s),s.queue.add(c)})}}}),i=ss(),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)||(Kg(i,s),s.workInProgress=a)}return[s.workInProgress,s.dispatch]}function ZT(e,t,n){return eb(e,void 0,t,n)}function eI(e,t,n,r){return eb(e,t,n,r)}const tI=(e,t)=>typeof t=="function"?t(e):t,nI=e=>typeof e=="function"?e():e;function dn(e){return ZT(tI,e,nI)}const tb=(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},rI=()=>({type:"effect",cleanup:void 0,deps:null});function tt(e,t){const n=Z_("effect",rI);if(!(t&&n.deps&&tb(n.deps,t))){if(n.deps!==null&&!!t!=!!n.deps)throw new Error("tapEffect called with and without dependencies across re-renders");XT(()=>{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 or(e){const[t]=dn(()=>({current:e}));return t}function Ps(e,t){const[n]=dn(e);return n}const sI=()=>{throw new Error("Memo reducer should not be called")},ce=(e,t)=>{ss();const[n]=eI(sI,r=>r&&tb(r.deps,t)?r:{value:e(),deps:t},null);return n.value},ha=(e,t)=>ce(()=>e,t);function ar(e){const t=or(e);tt(()=>{t.current=e});const n=ss();return ha((...r)=>t.current(...r),[n])}function iI(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 oI(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 pa(e,t,n=void 0,r=QT()){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function Pi(e){if(!e.isMounted)throw new Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,oI(e)}function Zr(e,t){const n={effectTasks:[],props:t,output:void 0};return YT(e,()=>{e.renderContext=n;try{n.output=GT(e.type,t)}finally{e.renderContext=void 0}}),n}function Ui(e,t){e.isMounted=!0,e.isNeverMounted=!1,iI(t)}function yt(e,t){const n=ss(),r=or(0),s=ce(()=>(e.key,pa(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),i=t?ce(()=>Zr(s,e.props),[s,...t,r.current]):Zr(s,e.props);return tt(()=>()=>Pi(s),[s]),tt(()=>{Ui(s,i)},[s,i]),i.output}function ic(e,t){const n=or(0),r=n.current,s=Ps(ss),i=Ps(()=>()=>{n.current++,s.markDirty?.()}),o=Ps(()=>new Map),a=t?ha(e,t):e,l=ce(()=>{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 _=o.get(y);if(_)if(_.fiber.type!==g.type){const v=pa(g.type,s.root,i),x=Zr(v,g.props);_.next=[v,x],f.push(x.output)}else _.next=Zr(_.fiber,g.props),f.push(_.next.output);else{const v=pa(g.type,s.root,i),x=Zr(v,g.props);_={fiber:v,next:x},h++,o.set(y,_),f.push(x.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 tt(()=>()=>{for(const u of o.keys()){const c=o.get(u).fiber;Pi(c)}},[]),tt(()=>{for(const[u,c]of o.entries())c.next==="delete"?(c.fiber.isMounted&&Pi(c.fiber),o.delete(u)):Array.isArray(c.next)?(Pi(c.fiber),c.fiber=c.next[0],Ui(c.fiber,c.next[1])):Ui(c.fiber,c.next)},[l]),l}const aI=50;let nr={schedulers:new Set([]),isScheduled:!1};var lI=class{constructor(e){A(this,"_task");A(this,"_isDirty",!1);this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,nr.schedulers.add(this),uI()}runTask(){this._isDirty=!1,this._task()}};const uI=()=>{nr.isScheduled||(nr.isScheduled=!0,cI())},Cf=()=>{try{const e=[];let t=0;for(const n of nr.schedulers)if(nr.schedulers.delete(n),!!n.isDirty){if(t++,t>aI)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{nr.schedulers.clear(),nr.isScheduled=!1}},cI=(()=>{if(typeof MessageChannel<"u"){const e=new MessageChannel;return e.port1.onmessage=Cf,()=>e.port2.postMessage(null)}return()=>setTimeout(Cf,0)})(),qg=e=>{const t=nr;nr={schedulers:new Set([]),isScheduled:!0};try{const n=e();return Cf(),n}finally{nr=t}},dI=e=>{const t=Ps(()=>new lI(()=>u(null))),n=Ps(()=>[]),r=ce(()=>(e.key,pa(e.type,J_(c=>{!t.isDirty&&!c()||(n.push(c),t.markDirty())}))),[e.type,e.key]);Fo(r.root,r.root.committedVersion);const s=Zr(r,e.props),i=or(!1),o=or(e.props),a=or(s.output),l=Ps(()=>new Set),u=ar(c=>{if(c===null&&(Fo(r.root,2),Fo(r.root,1),n.forEach(f=>{f()}),c=Zr(r,o.current)),t.isDirty)throw new Error("Scheduler is dirty, this should never happen");mu(r.root),n.length=0,i.current&&Ui(r,c),!(t.isDirty||a.current===c.output)&&(a.current=c.output,l.forEach(f=>f()))});return tt(()=>(i.current=!0,()=>{i.current=!1,Pi(r)}),[r]),tt(()=>{o.current=s.props,mu(r.root),Ui(r,s),!(t.isDirty||a.current===s.output)&&(a.current=s.output,l.forEach(c=>c()))}),ce(()=>({getValue:()=>a.current,subscribe:c=>(l.add(c),()=>l.delete(c))}),[])},Bo=Symbol("tap.Context"),nb=e=>({[Bo]:e}),rb=(e,t,n)=>{const r=e[Bo];e[Bo]=t;try{return n()}finally{e[Bo]=r}},sb=e=>e[Bo],fI=ve(()=>{const[e,t]=dn(()=>({renderers:{},fallbacks:[]}));return{getState:()=>e,setDataUI:ha((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:ha(n=>(t(r=>({...r,fallbacks:[...r.fallbacks,n]})),()=>{t(r=>({...r,fallbacks:r.fallbacks.filter(s=>s!==n)}))}),[])}}),hI=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 dp=class{constructor(){A(this,"_providers",new Set);A(this,"_subscribers",new Set)}getModelContext(){return hI(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 Ef=[],pI={modelName:void 0,toolNames:Ef},mI=(e,t)=>e===t||e.length===t.length&&e.every((n,r)=>n===t[r]),ul=(e,t)=>{const n=e.getModelContext(),r=n.config?.modelName,s=n.tools?Object.keys(n.tools).sort():Ef,i=s.length?s:Ef;return r===t.modelName&&mI(i,t.toolNames)?t:{modelName:r,toolNames:i}},ib=ve(()=>{const e=ce(()=>new dp,[]),[t,n]=dn(()=>ul(e,pI));return tt(()=>(n(r=>ul(e,r)),e.subscribe(()=>{n(r=>ul(e,r))})),[e]),{getState:()=>ul(e,t),getModelContext:()=>e.getModelContext(),subscribe:r=>e.subscribe(r),register:r=>e.registerModelContextProvider(r)}}),gI=e=>e.display!==void 0?e.display==="standalone":e.type==="human",yI=(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})},vI=e=>function(n){return yI(e,n)},Tf=Symbol("assistant-ui.store.clientIndex"),xI=e=>e[Tf],ob=nb([]),fp=()=>sb(ob),wI=(e,t)=>{const n=fp();return rb(ob,ce(()=>[...n,e],[n,e]),t)},_I=new Set(["$$typeof","nodeType","then"]),oc=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!="symbol"){if(e==="toJSON")return()=>t;if(!_I.has(e))return!1}};var hp=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 ab=e=>{const t=ve(e);return n=>{const r=t(n);return n.key===void 0?r:ur(n.key,r)}},gu=Symbol("assistant-ui.store.getValue"),bI=e=>{const t=e[gu];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?.()},Gg=new Map;function kI(e){let t=Gg.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[gu];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)},Gg.set(e,t)),t}var SI=class extends hp{constructor(t,n){super();A(this,"outputRef");A(this,"index");A(this,"boundFns");A(this,"cachedReceiver");this.outputRef=t,this.index=n}get(t,n,r){if(n===gu)return this.outputRef.current;if(n===Tf)return this.index;const s=oc(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=kI(n).bind(r),this.boundFns.set(n,o)),o}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(t,n){return n===gu||n===Tf?!0:n in this.outputRef.current}};const lb=ab(e=>{const t=or(null),n=fp().length,r=ce(()=>new Proxy({},new SI(t,n)),[n]),s=wI(r,()=>yt(e));return t.current||(t.current=s),tt(()=>{t.current=s}),{methods:r,state:s.getState?.(),key:e.key}}),ac=e=>yt(lb(e)),$o=Symbol("assistant-ui.store.proxiedAssistantState"),Jc=e=>e==="on"||e==="subscribe"||typeof e=="symbol",ub=e=>{class t extends hp{get(r,s){const i=oc(s,"AssistantState");if(i!==!1)return i;const o=s;if(!Jc(o))return bI(e[o]())}ownKeys(){return Object.keys(e).filter(r=>!Jc(r))}has(r,s){return!Jc(s)&&s in e}}return new Proxy({},new t)},CI=e=>e[$o],Yg=()=>()=>{},cb=e=>{const t=()=>{throw new Error(e)};return t.source=null,t.query=null,t};var EI=class extends hp{get(e,t){if(t==="subscribe"||t==="on")return Yg;if(t===$o)return TI;const n=oc(t,"DefaultAssistantClient");return n!==!1?n:cb("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",$o]}has(e,t){return t==="subscribe"||t==="on"||t===$o}};const lc=new Proxy({},new EI),TI=ub(lc),II=()=>new Proxy({},{get(e,t){const n=oc(t,"AssistantClient");return n!==!1?n:cb(`The current scope does not have a "${String(t)}" property.`)}}),db=m.createContext(lc),RI=()=>m.useContext(db),Rr=({value:e,children:t})=>d.jsx(db.Provider,{value:e,children:t}),En=ve(e=>null),If=Symbol("assistant-ui.transform-scopes");function fb(e,t){const n=e;if(n[If])throw new Error("transformScopes is already attached to this resource");n[If]=t}function PI(e){return e[If]}const hb=e=>typeof e=="string"?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},pb=nb(null),jI=(e,t)=>rb(pb,e,t),mb=()=>{const e=sb(pb);if(!e)throw new Error("AssistantTapContext is not available");return e},gb=()=>mb().clientRef,pp=()=>{const{emit:e}=mb(),t=fp();return ar((n,r)=>{e(n,r,t)})};function AI(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===En||r.has(a.type))continue;r.add(a.type);const l=PI(a.type);if(l){l(n,t),s=!0;break}}}const i={},o={};for(const[a,l]of Object.entries(n))l.type===En?o[a]=l:i[a]=l;return{rootClients:i,derivedClients:o}}const Qg=e=>ce(()=>e,[...Object.entries(e).flat()]),NI=(e,t)=>{const{rootClients:n,derivedClients:r}=AI(e,t);return{rootClients:Qg(n),derivedClients:Qg(r)}},MI=ve(()=>Ps(()=>{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)}}}})),DI=()=>null;function yb(e){const t=m.useMemo(()=>J_(a=>r(a)),[]),[n,r]=m.useReducer((a,l)=>(Fo(t,a),a+(l()?1:0)),0);Fo(t,n);const s=DI(),i=m.useMemo(()=>(e.key,pa(e.type,t,void 0,s)),[e.type,e.key,t,s]),o=Zr(i,e.props);return m.useLayoutEffect(()=>()=>Pi(i),[i]),m.useLayoutEffect(()=>{mu(t),Ui(i,o)}),o.output}const vb=e=>ce(()=>e,e),LI=ve(({element:e,emit:t,clientRef:n})=>{const{methods:r,state:s}=jI({clientRef:n,emit:t},()=>ac(e));return ce(()=>({state:s,methods:r}),[r,s])}),OI=ve(({element:e,notifications:t,clientRef:n,name:r})=>{const s=dI(LI({element:e,emit:t.emit,clientRef:n}));return tt(()=>s.subscribe(t.notifySubscribers),[s,t]),ce(()=>{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])}),zI=ve(()=>ce(()=>({clients:[],subscribe:void 0,on:void 0}),[])),FI=ve(({clients:e,clientRef:t})=>{const n=yt(MI());tt(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);const r=vb(ic(()=>Object.keys(e).map(s=>ur(s,OI({element:e[s],notifications:n,clientRef:t,name:s}))),[e,n,t]));return ce(()=>({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}=hb(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[xI(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])}),BI=ve(({element:e,clientRef:t,name:n})=>{const r=or(e.props);return r.current=e.props,ce(()=>{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])}),$I=(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}`},UI=ve(({clients:e,clientRef:t})=>vb(ic(()=>Object.keys(e).map(n=>{const r=n,s=e[r];return ur($I(r,s.props),BI({element:s,clientRef:t,name:r}))}),[e,t]))),VI=ve(({parent:e,clients:t})=>{const{rootClients:n,derivedClients:r}=NI(t,e),s=or({parent:e,current:null}).current;tt(()=>{s.current=a});const i=yt(Object.keys(n).length>0?FI({clients:n,clientRef:s}):zI()),o=yt(UI({clients:r,clientRef:s})),a=ce(()=>{const l=e===lc?II():e,u=Object.create(l);Object.assign(u,{subscribe:i.subscribe??e.subscribe,on:i.on??e.on,[$o]:ub(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 ue(e,{parent:t}={parent:RI()}){if(e)return yb(VI({parent:t??lc,clients:e}));if(t===null)throw new Error("received null parent, this usage is not allowed");return t}const G=e=>{const t=ue(),n=CI(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},HI=e=>{const t=ue(),n=m.useRef(!1),r=n.current?null:e(t);return G(()=>n.current?e(t):r),()=>(n.current=!0,e(t))},WI=Object.freeze({});function to({getItemState:e,children:t}){return KI(t(HI(e)))}const KI=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?WI:t?.props])??e},qI=$t.createContext(!0);function Xg(){throw new Error("A function wrapped in useEffectEvent can't be called during rendering.")}const GI="use"in $t?()=>{try{return $t.use(qI)}catch{return!1}}:()=>!1;function YI(e){const t=$t.useRef(Xg);return $t.useInsertionEffect(()=>{t.current=e},[e]),(...n)=>{GI()&&Xg();const r=t.current;return r(...n)}}const yu=(e,t)=>{const n=ue(),r=YI(t),{scope:s,event:i}=hb(e);m.useEffect(()=>n.on({scope:s,event:i},r),[n,s,i])},QI=ab(e=>{if(e.key===void 0)throw new Error("tapClientResource: Element has no key");return yt(lb(e))});function Vi(e,t){const n=ic(()=>e().map(i=>QI(i)),t),r=ce(()=>Object.keys(n),[n]),s=ce(()=>n.reduce((i,o,a)=>(i[o.key]=a,i),{}),[n]);return{state:ce(()=>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 xb=ve(({toolkit:e,mcpApp:t})=>{const n=ic(()=>t?[ur("mcpApp",t)]:[],[t])[0],[r,s]=dn(()=>({})),i=ce(()=>({toolUIs:r,mcpApp:n,tools:Object.fromEntries(Object.entries(r).map(([l,u])=>[l,u.map(c=>c.render)]))}),[r,n]),o=gb(),a=ha((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(_=>_!==f)??[];if(p.length>0)return{...h,[l]:p};const{[l]:g,...y}=h;return y})}},[]);return tt(()=>{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?vI(p):void 0);g&&l.push(a(c,g,{standalone:gI(f)}))}const u=Object.entries(e).reduce((c,[f,h])=>{if(h.type==="mcp")return c;const{display:p,render:g,renderText:y,..._}=h;return c[f]=_,c},{});return l.push(o.current.modelContext().register({getModelContext:()=>({tools:u})})),()=>{l.forEach(c=>c())}},[e,a,o]),{getState:()=>i,setToolUI:a}});fb(xb,(e,t)=>{!e.modelContext&&t.modelContext.source===null&&(e.modelContext=ib())});const Ks=e=>{const[,t]=dn(e.getState);return tt(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},wb=ve(({runtime:e})=>{const t=Ks(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),XI=ve(({runtime:e,index:t})=>yt(wb({runtime:ce(()=>e.getAttachmentByIndex(t),[e,t])}))),_b=ve(({threadIdRef:e,messageIdRef:t,runtime:n})=>{const r=Ks(n),s=pp();tt(()=>{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=Vi(()=>r.attachments.map((a,l)=>ur(a.id,XI({runtime:n,index:l}))),[r.attachments,n]),o=ce(()=>({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}}),JI=ve(({runtime:e})=>{const t=Ks(e);return{getState:()=>t,addToolResult:n=>e.addToolResult(n),resumeToolCall:n=>e.resumeToolCall(n),respondToToolApproval:n=>e.respondToToolApproval(n),__internal_getRuntime:()=>e}}),ZI=ve(({runtime:e,index:t})=>yt(wb({runtime:ce(()=>e.getAttachmentByIndex(t),[e,t])}))),eR=ve(({runtime:e,index:t})=>yt(JI({runtime:ce(()=>e.getMessagePartByIndex(t),[e,t])}))),tR=ve(({runtime:e,threadIdRef:t})=>{const n=Ks(e),[r,s]=dn(!1),[i,o]=dn(!1),a=ce(()=>({get current(){return e.getState().id}}),[e]),l=ac(_b({runtime:e.composer,threadIdRef:t,messageIdRef:a})),u=Vi(()=>n.content.map((h,p)=>ur("toolCallId"in h&&h.toolCallId!=null?`toolCallId-${h.toolCallId}`:`index-${p}`,eR({runtime:e,index:p}))),[n.content,e]),c=Vi(()=>(n.attachments??[]).map((h,p)=>ur(h.id,ZI({runtime:e,index:p}))),[n.attachments,e]),f=ce(()=>({...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}}),nR=ve(({runtime:e,id:t,threadIdRef:n})=>yt(tR({runtime:ce(()=>e.getMessageById(t),[e,t]),threadIdRef:n}))),rR=ve(({runtime:e})=>{const t=Ks(e),n=pp();tt(()=>{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=ce(()=>({get current(){return e.getState().threadId}}),[e]),s=ac(_b({runtime:e.composer,threadIdRef:r})),i=Vi(()=>t.messages.map(a=>ur(a.id,nR({runtime:e,id:a.id,threadIdRef:r}))),[t.messages,e,r]),o=ce(()=>({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}}),sR=ve(({runtime:e})=>{const t=Ks(e),n=pp();return tt(()=>{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}}),iR=ve(({runtime:e,id:t})=>yt(sR({runtime:ce(()=>e.getItemById(t),[e,t])}))),oR=ve(({runtime:e,__internal_assistantRuntime:t})=>{const n=Ks(e),r=ac(rR({runtime:e.main})),s=Vi(()=>Object.keys(n.threadItems).map(o=>ur(o,iR({runtime:e,id:o}))),[n.threadItems,e]),i=ce(()=>({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}}),aR=ve(e=>({getState:()=>e})),lR=ve(e=>{const[t]=dn(()=>({suggestions:(e??[]).map(r=>typeof r=="string"?{title:r,label:"",prompt:r}:{title:r.title,label:r.label,prompt:r.prompt})})),n=Vi(()=>t.suggestions.map((r,s)=>ur(s,aR(r))),[t.suggestions]);return{getState:()=>t,suggestion:({index:r})=>n.get({index:r})}}),uR=ve(e=>{const t=gb();return tt(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),yt(oR({runtime:e.threads,__internal_assistantRuntime:e}))}),cR=(e,t)=>{e.thread??(e.thread=En({source:"threads",query:{type:"main"},get:n=>n.threads().thread("main")})),e.threadListItem??(e.threadListItem=En({source:"threads",query:{type:"main"},get:n=>n.threads().item("main")})),e.composer??(e.composer=En({source:"thread",query:{},get:n=>n.threads().thread("main").composer()})),!e.modelContext&&t.modelContext.source===null&&(e.modelContext=ib()),!e.suggestions&&t.suggestions.source===null&&(e.suggestions=lR())},bb=ve(e=>yt(uR(e)));fb(bb,(e,t)=>{cR(e,t),!e.tools&&t.tools.source===null&&(e.tools=xb({})),!e.dataRenderers&&t.dataRenderers.source===null&&(e.dataRenderers=fI())});const dR=e=>e._core?.RenderComponent,fR=m.memo(({runtime:e,aui:t=null,children:n})=>{const r=ue({threads:bb(e)},{parent:t}),s=dR(e);return d.jsxs(Rr,{value:r,children:[s&&d.jsx(s,{}),n]})}),Jg=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},hR=e=>e?Jg(e):Jg,pR=e=>e;function mR(e,t=pR){const n=$t.useSyncExternalStore(e.subscribe,$t.useCallback(()=>t(e.getState()),[e,t]),$t.useCallback(()=>t(e.getInitialState()),[e,t]));return $t.useDebugValue(n),n}const Zg=e=>{const t=hR(e),n=r=>mR(t,r);return Object.assign(n,t),n},kb=e=>e?Zg(e):Zg,mp=()=>{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}},gR=()=>{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=mp(),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 ey=class{constructor(e){A(this,"_controller");A(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 Sb=e=>new ReadableStream({start(t){return e.start?.(new ey(t))},pull(t){return e.pull?.(new ey(t))},cancel(t){return e.cancel?.(t)}}),ty=()=>{let e;return[Sb({start(t){e=t}}),e]};var ny=class{constructor(e){A(this,"_controller");A(this,"_isClosed",!1);A(this,"_mergeTask");A(this,"_argsTextController");this._controller=e;const t=Sb({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 yR=e=>new ReadableStream({start(t){return e.start?.(new ny(t))},pull(t){return e.pull?.(new ny(t))},cancel(t){return e.cancel?.(t)}}),vR=()=>{let e;return[yR({start(t){e=t}}),e]};var Cb=class{constructor(){A(this,"value",-1)}up(){return++this.value}},xR=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 wR=class extends TransformStream{constructor(e){const t=new Cb,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]})}})}},_R=class extends TransformStream{constructor(e){super();const t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},Eb=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 Tb=(e,t=21)=>(n=t)=>{let r="",s=n|0;for(;s--;)r+=e[Math.random()*e.length|0];return r};const bR=Tb("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var kR=class Ib{constructor(t){A(this,"_state");A(this,"_parentId");this._state=t||{merger:gR(),contentCounter:new Cb}}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 xR(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new wR(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]=ty();return this._addPart(this._withParentIdOption({type:"text"}),t),n}addReasoningPart(){const[t,n]=ty();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??bR(),[i,o]=vR();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 Ib(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function SR(e){const t=new kR;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 CR(){const{resolve:e,promise:t}=mp();let n;return[SR(r=>(n=r,n.__internal_subscribeToClose(e),t)),n]}function ER(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 no={exports:{}};const TR=typeof Buffer<"u",ry=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,sy=/"(?: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 Rb(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),TR&&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(ry.test(e)===!1&&sy.test(e)===!1)return r}else if(s!=="ignore"&&i==="ignore"){if(ry.test(e)===!1)return r}else if(sy.test(e)===!1)return r;return Pb(r,{protoAction:s,constructorAction:i,safe:n&&n.safe})}function Pb(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 gp(e,t,n){const{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return Rb(e,t,n)}finally{Error.stackTraceLimit=r}}function IR(e,t){const{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return Rb(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}no.exports=gp;no.exports.default=gp;no.exports.parse=gp;no.exports.safeParse=IR;no.exports.scan=Pb;var RR=no.exports;const Rf=Ia(RR),Ll=Symbol("aui.parse-partial-json-object.meta"),PR=e=>e?.[Ll],Pf=e=>{if(e.length===0)return{[Ll]:{state:"partial",partialPath:[]}};try{const t=Rf.parse(e);if(typeof t!="object"||t===null)throw new Error("argsText is expected to be an object");return t[Ll]={state:"complete",partialPath:[]},t}catch{try{const[t,n]=ER(e),r=Rf.parse(t);if(typeof r!="object"||r===null)throw new Error("argsText is expected to be an object");return r[Ll]={state:"partial",partialPath:n},r}catch{return}}},jb=(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 jb(a,{state:"partial",partialPath:o},s)},Hi=(e,t)=>{const n=PR(e);if(!n)throw new Error("unable to determine object state");return jb(e,n,t.map(String))};async function*jR(){const e=this.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{e.releaseLock()}}function Zc(e){var t;return e[t=Symbol.asyncIterator]??(e[t]=jR),e}const iy=Symbol.for("aui.tool-response");var wr=class jf{constructor(t){A(this,"artifact");A(this,"result");A(this,"isError");A(this,"modelContent");A(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[iy](){return!0}static[Symbol.hasInstance](t){return typeof t=="object"&&t!==null&&iy in t}static toResponse(t){return t instanceof jf?t:new jf({result:t===void 0?"<no result>":t})}};function AR(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 Wi(e,t){let n=e;for(const r of t){if(n==null)return;n=n[r]}return n}var NR=class{constructor(e,t,n){A(this,"resolve");A(this,"reject");A(this,"disposed",!1);A(this,"fieldPath");this.resolve=e,this.reject=t,this.fieldPath=n}update(e){if(!this.disposed)try{if(Hi(e,this.fieldPath)==="complete"){const t=Wi(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=Wi(e,this.fieldPath);this.resolve(t)}catch(t){this.reject(t)}finally{this.dispose()}}dispose(){this.disposed=!0}},MR=class{constructor(e,t){A(this,"controller");A(this,"disposed",!1);A(this,"fieldPath");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=Wi(e,this.fieldPath);t!==void 0&&this.controller.enqueue(t),Hi(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}},DR=class{constructor(e,t){A(this,"controller");A(this,"disposed",!1);A(this,"fieldPath");A(this,"lastValue");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=Wi(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)}Hi(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}},LR=class{constructor(e,t){A(this,"controller");A(this,"disposed",!1);A(this,"fieldPath");A(this,"processedIndexes",new Set);this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=Wi(e,this.fieldPath);if(!Array.isArray(t))return;for(let n=0;n<t.length;n++)this.processedIndexes.has(n)||Hi(e,[...this.fieldPath,n])==="complete"&&(this.controller.enqueue(t[n]),this.processedIndexes.add(n));Hi(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){A(this,"argTextDeltas");A(this,"handles",new Set);A(this,"args",Pf(""));A(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=Pf(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 NR(t,n,e);if(this.args&&Hi(this.args,e)==="complete"){const s=Wi(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 Zc(new ReadableStream({start:r=>{n=new MR(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 Zc(new ReadableStream({start:r=>{n=new DR(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 Zc(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))}}))}},zR=class{constructor(e){A(this,"promise");this.promise=e}get(){return this.promise}},FR=class{constructor(){A(this,"args");A(this,"response");A(this,"writable");A(this,"resolve");A(this,"argsText","");A(this,"result",{get:async()=>(await this.response.get()).result});const e=new TransformStream;this.writable=e.writable,this.args=new OR(e.readable);const{promise:t,resolve:n}=mp();this.resolve=n,this.response=new zR(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)}},BR=class extends _R{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 FR;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 wr({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=AR(()=>{let h;try{h=Rf.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 wr({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 wr({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 Eb).pipeThrough(s)})}};const $R=e=>typeof e=="object"&&e!==null&&"~standard"in e&&e["~standard"].version===1;function UR(e,t,n,r){const s=e?.[n.toolName];return s?.execute?(async o=>{if(t.aborted)return new wr({result:"Tool execution was cancelled.",isError:!0});let a=o;if($R(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 wr({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=wr.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 wr({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 VR(e,t,n,r,s){e?.[r.toolName]?.streamCall?.(n,{toolCallId:r.toolCallId,abortSignal:t,human:i=>s(r.toolCallId,i)})}function HR(e,t,n,r){const s=typeof e=="function"?e:()=>e,i=typeof t=="function"?t:()=>t;return new BR({execute:o=>UR(s(),i(),o,n),streamCall:({reader:o,...a})=>VR(s(),i(),o,a,n),onExecutionStart:r?.onExecutionStart,onExecutionEnd:r?.onExecutionEnd})}const Ab=({index:e,children:t})=>d.jsx(Rr,{value:ue({attachment:En({source:"message",query:{type:"index",index:e},get:n=>n.message().attachment({index:e})})}),children:t}),Nb=({index:e,children:t})=>d.jsx(Rr,{value:ue({attachment:En({source:"composer",query:{type:"index",index:e},get:n=>n.composer().attachment({index:e})})}),children:t}),Mb=({index:e,children:t})=>d.jsx(Rr,{value:ue({message:En({source:"thread",query:{type:"index",index:e},get:n=>n.thread().message({index:e})}),composer:En({source:"message",query:{},get:n=>n.thread().message({index:e}).composer()})}),children:t}),yp=({index:e,children:t})=>d.jsx(Rr,{value:ue({part:En({source:"message",query:{type:"index",index:e},get:n=>n.message().part({index:e})})}),children:t}),WR=ve(({text:e,isRunning:t})=>{const n=ce(()=>({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")}}}),vp=({text:e,isRunning:t=!1,children:n})=>d.jsx(Rr,{value:ue({part:WR({text:e,isRunning:t})}),children:n}),KR=Object.freeze({type:"complete"}),qR=ve(({parts:e,getMessagePart:t})=>{const[n,r]=dn(!0),s=ce(()=>e[e.length-1]?.status??KR,[e]),i=ce(()=>({parts:e,collapsed:n,status:s}),[e,n,s]);return{getState:()=>i,setCollapsed:r,part:t}}),GR=({startIndex:e,endIndex:t,children:n})=>{const r=G(i=>i.message.parts).slice(e,t+1),s=ue();return d.jsx(Rr,{value:ue({chainOfThought:qR({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})},Db=({index:e,children:t})=>d.jsx(Rr,{value:ue({suggestion:En({source:"suggestions",query:{index:e},get:n=>n.suggestions().suggestion({index:e})})}),children:t}),YR=({index:e,children:t})=>d.jsx(Rr,{value:ue({queueItem:En({source:"composer",query:{index:e},get:n=>n.composer().queueItem({index:e})})}),children:t}),$s=Symbol("innerMessage"),ed=Symbol("innerMessages"),QR=[],XR=(e,t)=>{$s in e||(e[$s]=t)},JR=e=>{const t="messages"in e?e.messages:e,n=t[ed]||t[$s];return n?Array.isArray(n)?n:(t[ed]=[n],t[ed]):QR},Wn=Symbol("skip-update");function ZR(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 eP=class{constructor(){A(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)}}},uc=class{constructor(){A(this,"_subscriptions",new Set);A(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()}}},Bn=class extends uc{constructor(t){super();A(this,"binding");A(this,"_previousState");A(this,"getState",()=>(this.isConnected||this._syncState(),this._previousState));this.binding=t;const n=t.getState();if(n===Wn)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===Wn||ZR(t,this._previousState)?!1:(this._previousState=t,!0)}_connect(){const t=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(t)}},xp=class extends uc{constructor(t){super();A(this,"binding");A(this,"_previousStateDirty",!0);A(this,"_previousState");A(this,"getState",()=>{if(!this.isConnected||this._previousStateDirty){const t=this.binding.getState();t!==Wn&&(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)}},vu=class extends uc{constructor(t){super();A(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?.()}}},Lb=class extends uc{constructor(t){super();A(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?.()}}},Ob=class{constructor(e){A(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)}},zb=class extends Ob{constructor(t,n){super(t);A(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)}},tP=class extends zb{get source(){return"thread-composer"}},nP=class extends zb{get source(){return"edit-composer"}},rP=class extends Ob{get source(){return"message"}remove(){throw new Error("Message attachments cannot be removed")}};const Fb=Object.freeze([]),Bb=Object.freeze({}),sP=e=>Object.freeze({type:"thread",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??Fb,text:e?.text??"",role:e?.role??"user",runConfig:e?.runConfig??Bb,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,value:e?.text??""}),iP=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??Fb,runConfig:e?.runConfig??Bb,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,parentId:e?.parentId??null,sourceId:e?.sourceId??null,value:e?.text??""});var $b=class{constructor(e){A(this,"_core");A(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 Lb({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},oP=class extends $b{constructor(t){const n=new xp({path:t.path,getState:()=>sP(t.getState()),subscribe:r=>t.subscribe(r)});super({path:t.path,getState:()=>t.getState(),subscribe:r=>n.subscribe(r)});A(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 tP(new Bn({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"}:Wn},subscribe:n=>this._core.subscribe(n)}),this._core)}},aP=class extends $b{constructor(t,n){const r=new xp({path:t.path,getState:()=>iP(t.getState()),subscribe:s=>t.subscribe(s)});super({path:t.path,getState:()=>t.getState(),subscribe:s=>r.subscribe(s)});A(this,"_beginEdit");A(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 nP(new Bn({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"}:Wn},subscribe:n=>this._core.subscribe(n)}),this._core)}};const ma=e=>e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
43
+
44
+ `);var oy=class{constructor(e,t,n){A(this,"contentBinding");A(this,"messageApi");A(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=wr.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 cl=Object.freeze({type:"complete"}),lP=(e,t,n)=>{if(e.role!=="assistant")return cl;if(n.type==="tool-call")return n.result?cl:e.status;const r=t===Math.max(0,e.content.length-1);return e.status.type==="requires-action"?cl:r?e.status:cl},ay=(e,t)=>{const n=e.content[t];if(!n)return Wn;const r=lP(e,t,n);return Object.freeze({...n,[$s]:n[$s],status:r})};var uP=class{constructor(e,t){A(this,"_core");A(this,"_threadBinding");A(this,"composer");A(this,"_getEditComposerRuntimeCore",()=>this._threadBinding.getState().getEditComposer(this._core.getState().id));this._core=e,this._threadBinding=t,this.composer=new aP(new vu({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 ma(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 oy(new Bn({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>ay(this.getState(),e),subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new oy(new Bn({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?Wn:ay(t,n)},subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new rP(new Bn({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"}:Wn},subscribe:t=>this._core.subscribe(t)}))}};const cP=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),dP=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),fP=(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},hP=(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 Ub=class{constructor(e,t){A(this,"_threadBinding");A(this,"composer");A(this,"_eventSubscriptionSubjects",new Map);const n=new Bn({path:e.path,getState:()=>hP(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 oP(new vu({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(fP(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(dP(e))}resumeRun(e){return this._threadBinding.getState().resumeRun(cP(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 uP(new Bn({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 Wn;const a=this._threadBinding.getState().getBranches(n.id);return{...n,[$s]:n[$s],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 Lb({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}};const pP=m.createContext(null),mP=()=>m.useContext(pP);var dl=class{constructor(e,t){A(this,"_core");A(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 ly=Promise.resolve(),gP=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}),fl=(e,t)=>{if(t===void 0)return Wn;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}:Wn};var yP=class{constructor(e,t=Ub){A(this,"_core");A(this,"_runtimeFactory");A(this,"_getState");A(this,"_mainThreadListItemRuntime");A(this,"main");this._core=e,this._runtimeFactory=t;const n=new xp({path:{},getState:()=>gP(e),subscribe:r=>e.subscribe(r)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new dl(new Bn({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>fl(this._core,this._core.mainThreadId),subscribe:r=>this._core.subscribe(r)}),this._core),this.main=new t(new vu({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?.()??ly}loadMore(){return this._core.loadMore?.()??ly}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new vu({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 dl(new Bn({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>fl(this._core,this._core.threadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getArchivedItemByIndex(e){return new dl(new Bn({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>fl(this._core,this._core.archivedThreadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getItemById(e){return new dl(new Bn({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>fl(this._core,e),subscribe:t=>this._core.subscribe(t)}),this._core)}},Vb=class{constructor(e){A(this,"_core");A(this,"threads");A(this,"_thread");this._core=e,this.threads=new yP(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)}},Hb=class{constructor(){A(this,"_contextProvider",new dp)}registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}};const gs=Object.freeze([]),ji="DEFAULT_THREAD_ID",vP=Object.freeze([ji]),xP=Object.freeze({id:ji,remoteId:void 0,externalId:void 0,status:"regular"}),wP=Promise.resolve(),uy=Object.freeze({[ji]:xP});var _P=class{constructor(e={},t){A(this,"threadFactory");A(this,"_mainThreadId",ji);A(this,"_threads",vP);A(this,"_archivedThreads",gs);A(this,"_threadData",uy);A(this,"adapter",{});A(this,"_mainThread");A(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 wP}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??ji,s=e.threads??gs,i=e.archivedThreads??gs,o=n.threadId??ji,a=n.threads??gs,l=n.archivedThreads??gs;!t&&o===r&&a===s&&l===i||((a!==s||l!==i||o!==r)&&(this._threadData={...uy,...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)??gs),l!==i&&(this._archivedThreads=this.adapter.archivedThreads?.map(u=>u.id)??gs),(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 is=Tb("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),ro=Symbol("autoStatus"),bP=Object.freeze(Object.assign({type:"running"},{[ro]:!0})),kP=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[ro]:!0})),SP=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[ro]:!0})),CP=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[ro]:!0})),EP=e=>e[ro]===!0,xu=(e,t,n,r,s)=>e&&s?Object.assign({type:"incomplete",reason:"error",error:s},{[ro]:!0}):e&&t?bP:n?CP:r?SP:kP,td=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},ga=(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,..._}=h,v={..._,toolCallId:h.toolCallId??`tool-${is()}`,...g!==void 0&&{parentId:g},...y!==void 0&&{messages:y}};return h.args?{...v,args:h.args,argsText:h.argsText??JSON.stringify(h.args)}:{...v,args:Pf(h.argsText??"")??{},argsText:h.argsText??""}}default:{const g=td(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=td(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=>td(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}`)}},Wb={fromArray:e=>{const t=e.map(n=>ga(n,is(),xu(!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=xu(!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:ga(r,r.id,n)}})}}},Ol=e=>e.next?Ol(e.next):"current"in e?e:null;var TP=class{constructor(e){A(this,"func");A(this,"_value",null);this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},wp=class{constructor(){A(this,"messages",new Map);A(this,"head",null);A(this,"root",{children:[],next:null});A(this,"_messages",new TP(()=>{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],(Ol(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=Ol(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=Ol(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 cy(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 IP(e,t){return e.length!==t.length?!1:e.every((n,r)=>n.id===t[r].id)}function RP(e){const t=is();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 PP(e){const t=[];for(const n of e)n.type!=="text"&&t.push(RP(n));return t}const nd=e=>e.status.type==="complete";var Kb=class extends eP{constructor(){super(...arguments);A(this,"isEditing",!0);A(this,"_attachments",[]);A(this,"_text","");A(this,"_role","user");A(this,"_runConfig",{});A(this,"_quote");A(this,"_dictation");A(this,"_dictationSession");A(this,"_dictationUnsubscribes",[]);A(this,"_dictationBaseText","");A(this,"_currentInterimText","");A(this,"_dictationSessionIdCounter",0);A(this,"_activeDictationSessionId");A(this,"_isCleaningDictation",!1);A(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=>!nd(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(nd(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&&!cy({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??is(),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(!cy({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(!nd(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)}}},qb=class extends Kb{constructor(t){super();A(this,"runtime");A(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()}},jP=class extends Kb{constructor(t,n,{parentId:r,message:s}){super();A(this,"runtime");A(this,"endEditCallback");A(this,"_previousText");A(this,"_previousAttachments");A(this,"_nonTextPassthrough");A(this,"_parentId");A(this,"_sourceId");this.runtime=t,this.endEditCallback=n,this._parentId=r,this._sourceId=s.id,this._previousText=ma(s),this.setText(this._previousText),this.setRole(s.role),s.role==="user"?(this._previousAttachments=[...s.attachments??[],...PP(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=ma(t),s=!IP(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()}},AP=class{constructor(e){A(this,"_contextProvider");A(this,"_subscriptions",new Set);A(this,"_isInitialized",!1);A(this,"repository",new wp);A(this,"_voiceMessages",[]);A(this,"_voiceGeneration",0);A(this,"_cachedMergedMessages",null);A(this,"_cachedVoiceGeneration",-1);A(this,"_cachedMergedBase",null);A(this,"composer",new qb(this));A(this,"_editComposers",new Map);A(this,"_stopSpeaking");A(this,"speech");A(this,"_voiceSession");A(this,"_voiceUnsubs",[]);A(this,"voice");A(this,"_voiceVolume",0);A(this,"_voiceVolumeSubscribers",new Set);A(this,"getVoiceVolume",()=>this._voiceVolume);A(this,"subscribeVoiceVolume",e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e)));A(this,"_currentAssistantMsg",null);A(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 jP(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(ma(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:is(),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:is(),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(Wb.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)}}},dy=class{constructor(){A(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 Af(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function wu(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=>wu(n,t+1)):Af(e)?Object.entries(e).every(([n,r])=>typeof n=="string"&&wu(r,t+1)):!1}const NP=100,Nf=(e,t,n)=>{if(e===t)return!0;if(n>NP||e==null||t==null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>Nf(i,t[o],n+1));if(Array.isArray(t)||!Af(e)||!Af(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)&&Nf(e[i],t[i],n+1))},MP=(e,t)=>!wu(e)||!wu(t)?!1:Nf(e,t,0),hl=e=>{try{return JSON.parse(e),!0}catch{return!1}},fy=e=>{try{return JSON.parse(e)}catch{return}},hy=(e,t)=>{const n=fy(e),r=fy(t);return n===void 0||r===void 0?!1:MP(n,r)};var DP=class{constructor(e,t){A(this,"_getTools");A(this,"_callbacks");A(this,"_entries",new Map);A(this,"_skipExecuteStreamIds",new Set);A(this,"_humanInput",new Map);A(this,"_executing",new Set);A(this,"_settledResolvers",[]);A(this,"_statuses",new Map);A(this,"_ac",new AbortController);A(this,"_pendingRestore",!0);A(this,"_lastSnapshot",null);A(this,"_isRunning",!1);A(this,"_controller");A(this,"_pipelineDead",!1);A(this,"_pipelineRestartUsed",!1);this._getTools=e,this._callbacks=t,this._initPipeline()}_initPipeline(){const[e,t]=CR();this._controller=t;const n=HR(()=>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 Eb).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)&&hl(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)hy(e.argsText,t.argsText)&&(e.argsText=t.argsText),r=!1;else if(!t.argsText.startsWith(e.argsText))if(hl(e.argsText)&&hl(t.argsText)&&hy(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 wr({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 LP=Object.freeze([]),py=(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},OP=(e,t)=>e&&t[t.length-1]?.role!=="assistant";var zP=class extends AP{constructor(t,n){super(t);A(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});A(this,"_messages");A(this,"isDisabled");A(this,"isSendDisabled");A(this,"suggestions",[]);A(this,"extras");A(this,"_converter",new dy);A(this,"_store");A(this,"_toolInvocations",null);A(this,"_toolCallToMessageId",new Map);A(this,"_messagesForToolCallIndex",null);A(this,"updateMessages",t=>{this._store.convertMessage!==void 0?this._store.setMessages?.(t.flatMap(JR)):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??LP;py(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};py(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 dy;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=xu(c===(t.messages?.length??0)-1,n,!1,!1,void 0);if(l&&(l.role!=="assistant"||!EP(l.status)||l.status===f))return l;const h=ga(t.convertMessage(u,c),c.toString(),f);return XR(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;OP(n,o)&&(a=is(),this.repository.addOrUpdateMessage(o.at(-1)?.id??null,ga({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 DP(()=>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(ma(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 wp;n.import(Wb.fromArray(t??[])),this.updateMessages(n.getMessages())}import(t){super.import(t),this._store.onImport&&this._store.onImport(this.repository.getMessages())}};const my=e=>e.adapters?.threadList??{};var FP=class extends Hb{constructor(t){super();A(this,"threads");this.threads=new _P(my(t),()=>new zP(this._contextProvider,t))}setAdapter(t){this.threads.__internal_setAdapter(my(t)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(t)}};const Ma=e=>{const[t]=m.useState(()=>new FP(e));m.useEffect(()=>{t.setAdapter(e)});const{modelContext:n}=mP()??{};return m.useEffect(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),m.useMemo(()=>new Vb(t),[t])},Gb=(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,BP=()=>null,$P=(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??BP;default:throw new Error(`Unknown message role: ${t}`)}},Yb=({components:e})=>d.jsx($P(e,G(t=>t.message.role),G(t=>t.message.composer.isEditing)),{}),Qb=m.memo(({index:e,components:t})=>d.jsx(Mb,{index:e,children:d.jsx(Yb,{components:t})}),(e,t)=>e.index===t.index&&Gb(e.components,t.components));Qb.displayName="ThreadPrimitive.MessageByIndex";const gy=({children:e})=>{const t=G(n=>n.thread.messages.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>d.jsx(Mb,{index:r,children:d.jsx(to,{getItemState:s=>s.thread().message({index:r}).getState(),children:s=>e({get message(){return s()}})})},r)),[t,e])},Xb=({components:e,children:t})=>e?d.jsx(gy,{children:()=>d.jsx(Yb,{components:e})}):d.jsx(gy,{children:t});Xb.displayName="ThreadPrimitive.Messages";const UP=m.memo(Xb,(e,t)=>e.children||t.children?e.children===t.children:Gb(e.components,t.components)),Jb=e=>{const t=e.message.metadata;if(!(!t||typeof t!="object"))return t.custom?.quote};var VP=class extends Error{constructor(t,n=`Component "${t}" is not in the generative-ui allowlist.`){super(n);A(this,"componentName");this.name="GenerativeUIRenderError",this.componentName=t}};const HP=e=>typeof e=="object"&&e!==null,Zb=(e,t,n,r)=>{if(e==null)return null;if(typeof e=="string")return e;if(!HP(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 VP(s)}const u=o?.length?o.map((c,f)=>Zb(c,t,n,`${r}/${f}`)):void 0;return m.createElement(l,{...i??{},key:a??r},...u??[])},WP=e=>{if(!e||e.root===void 0||e.root===null)return[];const t=e.root;return Array.isArray(t)?t:[t]},_p=({spec:e,components:t,Fallback:n})=>d.jsx(d.Fragment,{children:m.useMemo(()=>WP(e),[e]).map((r,s)=>Zb(r,t,n,`${s}`))});_p.displayName="GenerativeUIRender";const e0=({components:e,spec:t,Fallback:n})=>{const r=G(i=>{const o=i.part;return o?.type==="generative-ui"?o.spec:void 0}),s=t??r;return s?d.jsx(_p,{spec:s,components:e,Fallback:n}):null};e0.displayName="MessagePrimitive.GenerativeUI";const KP="ui://",qP=e=>!!e?.startsWith(KP),yy=e=>Symbol.iterator in e,vy=e=>"entries"in e,xy=(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},GP=(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 YP(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:yy(e)&&yy(t)?vy(e)&&vy(t)?xy(e,t):GP(e,t):xy({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function t0(e){const t=$t.useRef(void 0);return n=>{const r=e(n);return YP(t.current,r)?t.current:t.current=r}}const rd=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})}}},QP=(e,t)=>{const n=[];if(t){const r=rd("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=rd("toolGroup"),s=rd("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},XP=e=>{const t=G(t0(n=>n.message.parts.map(r=>r.type)));return m.useMemo(()=>t.length===0?[]:QP(t,e),[t,e])},JP=({Fallback:e,...t})=>{const n=G(r=>r.tools.toolUIs[t.toolName]?.[0]?.render??e);return n?d.jsx(n,{...t}):null},bp=(e,t,n)=>{const r=e.renderers[t]?.[0];return r||(e.fallbacks[0]??n)},ZP=({Fallback:e,...t})=>{const n=G(r=>bp(r.dataRenderers,t.name,e));return n?d.jsx(n,{...t}):null},Ct={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},ej=({components:{Text:e=Ct.Text,Reasoning:t=Ct.Reasoning,Image:n=Ct.Image,Source:r=Ct.Source,File:s=Ct.File,Unstable_Audio:i=Ct.Unstable_Audio,tools:o={},data:a,generativeUI:l}={}})=>{const u=ue(),c=G(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(JP,{...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(ZP,{...c,Fallback:h})}case"generative-ui":return l?.components?d.jsx(_p,{spec:c.spec,components:l.components,Fallback:l.Fallback}):null;default:return console.warn(`Unknown message part type: ${f}`),null}},Uo=m.memo(({index:e,components:t})=>d.jsx(yp,{index:e,children:d.jsx(ej,{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);Uo.displayName="MessagePrimitive.PartByIndex";const tj=({status:e,component:t})=>d.jsx(vp,{text:"",isRunning:e.type==="running",children:d.jsx(t,{type:"text",text:"",status:e})}),nj=Object.freeze({type:"complete"}),rj=Object.freeze({type:"running"}),sj=({components:e})=>{const t=G(n=>n.message.status??nj);return e?.Empty?d.jsx(e.Empty,{status:t}):t.type!=="running"?null:d.jsx(tj,{status:t,component:e?.Text??Ct.Text})},n0=m.memo(sj,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),ij=({components:e,enabled:t})=>G(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(n0,{components:e}):null,oj=m.memo(ij,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),aj=({Quote:e})=>{const t=G(Jb);return t?d.jsx(e,{text:t.text,messageId:t.messageId}):null},lj=m.memo(aj);function r0(e,t){const n=e.toolUIs[t.toolName]?.[0]?.render??null;return n||(qP(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}const s0=()=>{const e=ue(),t=G(r=>r.part),n=G(r=>r.part.type==="tool-call"?r0(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})},i0=()=>{const e=G(n=>n.part),t=G(n=>n.part.type==="data"?bp(n.dataRenderers,n.part.name,void 0)??null:null);return!t||e.type!=="data"?null:d.jsx(t,{...e})},uj=()=>{const e=G(t=>t.part.type);return e==="tool-call"?d.jsx(s0,{}):e==="data"?d.jsx(i0,{}):null},cj=Object.freeze({type:"text",text:"",status:rj}),o0=({index:e,children:t})=>{const n=ue(),r=G(s=>s.dataRenderers);return d.jsx(yp,{index:e,children:d.jsx(to,{getItemState:s=>s.message().part({index:e}).getState(),children:s=>t({get part(){const i=s();if(i.type==="tool-call"){const o=r0(n.tools().getState(),i)!==null,a=n.message().part({index:e});return{...i,toolUI:o?d.jsx(s0,{}):null,addResult:a.addToolResult,resume:a.resumeToolCall,respondToApproval:a.respondToToolApproval}}if(i.type==="data"){const o=bp(r,i.name,void 0)!==void 0;return{...i,dataRendererUI:o?d.jsx(i0,{}):null}}return i}})})})},dj=({children:e})=>{const t=G(s=>s.message.parts.length),n=G(s=>(s.message.status?.type??"complete")==="running"),r=t===0&&n;return t===0?r?d.jsx(vp,{text:"",isRunning:!0,children:e({part:cj})}):null:d.jsx(d.Fragment,{children:Array.from({length:t},(s,i)=>d.jsx(o0,{index:i,children:o=>e(o)??d.jsx(uj,{})},i))})},Mf=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?d.jsx(dj,{children:n}):d.jsx(fj,{components:e,unstable_showEmptyOnNonTextEnd:t});Mf.displayName="MessagePrimitive.Parts";const fj=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{const n=G(i=>i.message.parts.length),r=XP(!!e?.ChainOfThought),s=m.useMemo(()=>n===0?d.jsx(n0,{components:e}):r.map(i=>{if(i.type==="single")return d.jsx(Uo,{index:i.index,components:e},i.index);if(i.type==="chainOfThoughtGroup"){const o=e?.ChainOfThought;return o?d.jsx(GR,{startIndex:i.startIndex,endIndex:i.endIndex,children:d.jsx(o,{})},`chainOfThought-${i.startIndex}`):null}else return i.type==="toolGroup"?d.jsx(e?.ToolGroup??Ct.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(Uo,{index:l,components:e},`part-${l}`)})},`tool-${i.startIndex}`):d.jsx(e?.ReasoningGroup??Ct.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(Uo,{index:l,components:e},`part-${l}`)})},`reasoning-${i.startIndex}`)}),[r,e,n]);return d.jsxs(d.Fragment,{children:[e?.Quote&&d.jsx(lj,{Quote:e.Quote}),s,d.jsx(oj,{components:e,enabled:t})]})},hj=Symbol.for("@assistant-ui/groupBy.memoKey"),wy=e=>{const t=e.nextChildIdx++;return e.nodeKey===""?String(t):`${e.nodeKey}.${t}`},pj=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:wy(l),indices:[],children:[],nextChildIdx:0})}const a=n[n.length-1];a.children.push({type:"part",index:s,nodeKey:wy(a)});for(let l=1;l<n.length;l++)n[l].indices.push(s)}for(;n.length>1;)r();return t.children},mj=Object.freeze({type:"complete"}),gj=(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"}}},a0=()=>{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.")},l0=(e,t,n)=>{if(e.type==="part")return d.jsx(o0,{index:e.index,children:({part:s})=>n({part:s,children:d.jsx(a0,{})})},`part-${e.index}`);const r=t[e.indices.at(-1)]?.status??mj;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=>l0(s,t,n))})})},e.nodeKey)},u0=({groupBy:e,indicator:t="no-text",children:n})=>{const r=G(t0(o=>o.message.parts)),s=G(o=>o.tools.toolUIs),i=G(o=>t==="never"?!1:o.message.status?.type==="running");return d.jsxs(d.Fragment,{children:[m.useMemo(()=>{const o={toolUIs:s};return pj(r.map(a=>e(a,o)??[]))},[r,e[hj]??e,s]).map(o=>l0(o,r,n)),gj(t,r,i)&&n({part:{type:"indicator"},children:d.jsx(a0,{})})]})};u0.displayName="MessagePrimitive.GroupedParts";const yj=({children:e})=>{const t=G(Jb);return t?d.jsx(d.Fragment,{children:e(t)}):null},c0=m.memo(yj);c0.displayName="MessagePrimitive.Quote";const d0=(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}},vj=({components:e})=>{const t=G(r=>r.attachment);if(!t)return null;const n=d0(e,t);return n?d.jsx(n,{}):null},f0=m.memo(({index:e,components:t})=>d.jsx(Ab,{index:e,children:d.jsx(vj,{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);f0.displayName="MessagePrimitive.AttachmentByIndex";const _y=({children:e})=>{const t=G(n=>n.message.role!=="user"?0:(n.message.attachments??[]).length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(Ab,{index:r,children:d.jsx(to,{getItemState:s=>s.message().attachment({index:r}).getState(),children:s=>e({get attachment(){return s()}})})},r)),[t,e])},h0=({components:e,children:t})=>e?d.jsx(_y,{children:({attachment:n})=>{const r=d0(e,n);return r?d.jsx(r,{}):null}}):d.jsx(_y,{children:t});h0.displayName="MessagePrimitive.Attachments";const p0=(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}},xj=({components:e})=>{const t=G(r=>r.attachment);if(!t)return null;const n=p0(e,t);return n?d.jsx(n,{}):null},m0=m.memo(({index:e,components:t})=>d.jsx(Nb,{index:e,children:d.jsx(xj,{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);m0.displayName="ComposerPrimitive.AttachmentByIndex";const by=({children:e})=>{const t=G(n=>n.composer.attachments.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(Nb,{index:r,children:d.jsx(to,{getItemState:s=>s.composer().attachment({index:r}).getState(),children:s=>e({get attachment(){return s()}})})},r)),[t,e])},g0=({components:e,children:t})=>e?d.jsx(by,{children:({attachment:n})=>{const r=p0(e,n);return r?d.jsx(r,{}):null}}):d.jsx(by,{children:t});g0.displayName="ComposerPrimitive.Attachments";const wj=({children:e})=>{const t=G(n=>n.composer.queue.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(YR,{index:r,children:d.jsx(to,{getItemState:s=>s.composer().queueItem({index:r}).getState(),children:s=>e({get queueItem(){return s()}})})},r)),[t,e])},y0=m.memo(wj);y0.displayName="ComposerPrimitive.Queue";const kp=({children:e})=>G(t=>t.part.status.type==="running")?e:null;kp.displayName="MessagePartPrimitive.InProgress";const v0=({components:e})=>{const t=e.Suggestion;return d.jsx(t,{})},x0=m.memo(({index:e,components:t})=>d.jsx(Db,{index:e,children:d.jsx(v0,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);x0.displayName="ThreadPrimitive.SuggestionByIndex";const ky=({children:e})=>{const t=G(n=>n.suggestions.suggestions.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>d.jsx(Db,{index:r,children:d.jsx(to,{getItemState:s=>s.suggestions().suggestion({index:r}).getState(),children:s=>e({get suggestion(){return s()}})})},r)),[t,e])},w0=({components:e,children:t})=>e?d.jsx(ky,{children:()=>d.jsx(v0,{components:e})}):d.jsx(ky,{children:t});w0.displayName="ThreadPrimitive.Suggestions";const _j=m.memo(w0,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion),bj=e=>G(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)}),_0=({children:e,...t})=>bj(t)?e:null;_0.displayName="ComposerPrimitive.If";const kj=()=>{const e=ue(),t=G(n=>!n.composer.canSend||n.thread.isRunning&&!n.thread.capabilities.queue);return{send:m.useCallback(n=>{e.composer().send(n)},[e]),disabled:t}},Sj=()=>{const e=ue(),t=G(n=>!n.composer.canCancel);return{cancel:m.useCallback(()=>{e.composer().cancel()},[e]),disabled:t}},Cj=()=>{const e=ue(),t=G(n=>n.composer.dictation!=null||!n.thread.capabilities.dictation||!n.composer.isEditing);return{startDictation:m.useCallback(()=>{e.composer().startDictation()},[e]),disabled:t}},Ej=()=>{const e=ue(),t=G(n=>!n.composer.isEditing);return{addAttachment:m.useCallback(n=>e.composer().addAttachment(n),[e]),disabled:t}},Tj=({copiedDuration:e=3e3,copyToClipboard:t}={})=>{const n=ue(),r=G(a=>!((a.message.role!=="assistant"||a.message.status?.type!=="running")&&a.message.parts.some(l=>l.type==="text"&&l.text.length>0))),s=G(a=>a.message.isCopied),i=G(a=>a.composer.isEditing),o=G(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}},Ij=()=>{const e=ue(),t=G(n=>n.composer.isEditing);return{edit:m.useCallback(()=>{e.composer().beginEdit()},[e]),disabled:t}},Rj=()=>{const e=ue(),t=G(n=>n.thread.isRunning||n.thread.isDisabled||n.message.role!=="assistant");return{reload:m.useCallback(()=>{e.message().reload()},[e]),disabled:t}},Pj=()=>{const e=ue(),t=G(n=>n.message.metadata.submittedFeedback?.type==="positive");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t}},jj=()=>{const e=ue(),t=G(n=>n.message.metadata.submittedFeedback?.type==="negative");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t}},Aj=()=>{const e=ue(),t=G(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}},Nj=()=>{const e=ue(),t=G(n=>n.message.speech==null);return{stopSpeaking:m.useCallback(()=>{e.message().stopSpeaking()},[e]),disabled:t}},Mj=({prompt:e,send:t,clearComposer:n=!0})=>{const r=ue(),s=G(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}},Dj=()=>G(e=>e.message.status?.type==="incomplete"&&e.message.status.reason==="error"?e.message.status.error??"An error occurred":void 0),Lj=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}},Oj=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,b0={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(Oj)){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 zj(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 k0(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 S0=m.createContext(null),{useThreadViewport:qs,useThreadViewportStore:Gs}=k0(zj(S0,"ThreadPrimitive.Viewport"),"useThreadViewport"),Sy=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()}}}}},Fj=(e={})=>{const t=new Set,n=Sy(o=>{i.setState({height:{...i.getState().height,viewport:o}})}),r=Sy(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=kb(()=>({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},_u=e=>e,Bj=e=>{const t=Gs({optional:!0}),[n]=m.useState(()=>Fj(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&&_u(t).setState({isAtBottom:r.isAtBottom})})},[n,t]),n},Sp=({children:e,options:t={}})=>{const n=Bj(t),[r]=m.useState(()=>({useThreadViewport:n}));return d.jsx(S0.Provider,{value:r,children:e})},$j=()=>{const e=ue();return m.useEffect(()=>{},[e]),null},Uj=({children:e,aui:t,runtime:n})=>d.jsxs(fR,{runtime:n,aui:t??null,children:[d.jsx($j,{}),d.jsx(Sp,{children:e})]}),Da=m.memo(Uj),Vj=e=>{const t=e;t.__isBound||(t.__internal_bindMethods?.(),t.__isBound=!0)};function Hj(e,t=Wj){Vj(e);const n=m.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return m.useDebugValue(n),n}const Wj=e=>e;function Kj(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?Hj(i,s):null}return t}function C0(e){const t=ue(),n=G(()=>t.composer.source?t.composer().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("ComposerRuntime is not available");return n}function qj(e){const t=ue(),n=G(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("MessageRuntime is not available");return n}const bu=Kj(qj);function Cy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Gj(...e){return t=>{let n=!1;const r=e.map(s=>{const i=Cy(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():Cy(e[s],null)}}}}function Ys(...e){return m.useCallback(Gj(...e),e)}var Ey=Object.defineProperty,so=(e,t)=>{let n={};for(var r in e)Ey(n,r,{get:e[r],enumerable:!0});return Ey(n,Symbol.toStringTag,{value:"Module"}),n};function E0(e){const t=m.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Ty(s)&&typeof pl=="function"&&(s=pl(s._payload)),m.Children.forEach(s,h=>{if(Zj(h)){a=!0;const p=h;let g="child"in p.props?p.props.child:p.props.children;Ty(g)&&typeof pl=="function"&&(g=pl(g._payload)),o=Qj(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?Jj(o):void 0,c=Ys(r,u);if(!o){if(s||s===0)throw new Error(a?rA(e):nA(e));return s}const f=Xj(i,o.props??{});return o.type!==m.Fragment&&(f.ref=r?c:u),m.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var ku=E0("Slot"),Yj=Symbol.for("radix.slottable"),Qj=(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 Xj(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 Jj(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 Zj(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yj}var eA=Symbol.for("react.lazy");function Ty(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===eA&&"_payload"in e&&tA(e._payload)}function tA(e){return typeof e=="object"&&e!==null&&"then"in e}var nA=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,rA=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,pl=OC[" use ".trim().toString()],sA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],iA=sA.reduce((e,t)=>{const n=E0(`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 oA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"];function aA(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 lA(e){const t=iA[e],n=aA(t);return n.displayName=`Primitive.${e}`,n}const Me=oA.reduce((e,t)=>(e[t]=lA(t),e),{}),uA=({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:r})=>G(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"}),cA=m.createContext(null),T0=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=uA({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:i>0});return u==="hidden"?null:d.jsx(cA.Provider,{value:l,children:d.jsx(Me.div,{...u==="floating"?{"data-floating":"true"}:null,...r,ref:s})})});T0.displayName="ActionBarPrimitive.Root";function Ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}const dA=({copiedDuration:e=3e3}={})=>{const{copy:t,disabled:n}=Tj({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},I0=m.forwardRef(({copiedDuration:e,onClick:t,disabled:n,...r},s)=>{const i=G(a=>a.message.isCopied),o=dA({copiedDuration:e});return d.jsx(Me.button,{type:"button",...i?{"data-copied":"true"}:{},...r,ref:s,disabled:n||!o,onClick:Ke(t,()=>{o?.()})})});I0.displayName="ActionBarPrimitive.Copy";const Kn=(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(Me.button,{...a,type:"button",ref:i,disabled:a.disabled||!l,onClick:Ke(a.onClick,l)})});return r.displayName=e,r},fA=()=>{const{disabled:e,reload:t}=Rj();return e?null:t},hA=Kn("ActionBarPrimitive.Reload",fA),pA=()=>{const{disabled:e,edit:t}=Ij();return e?null:t},mA=Kn("ActionBarPrimitive.Edit",pA),gA=()=>{const{disabled:e,speak:t}=Aj();return e?null:t},yA=Kn("ActionBarPrimitive.Speak",gA);function Us(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function R0(e,t=globalThis?.document){const n=Us(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 vA=()=>{const{disabled:e,stopSpeaking:t}=Nj();return e?null:t},P0=m.forwardRef((e,t)=>{const n=vA();return R0(r=>{n&&(r.preventDefault(),n())}),d.jsx(Me.button,{type:"button",disabled:!n,...e,ref:t,onClick:Ke(e.onClick,()=>{n?.()})})});P0.displayName="ActionBarPrimitive.StopSpeaking";const xA=()=>{const{submit:e}=Pj();return e},j0=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const s=G(o=>o.message.metadata.submittedFeedback?.type==="positive"),i=xA();return d.jsx(Me.button,{type:"button",...s?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!i,onClick:Ke(e,()=>{i?.()})})});j0.displayName="ActionBarPrimitive.FeedbackPositive";const wA=()=>{const{submit:e}=jj();return e},A0=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const s=G(o=>o.message.metadata.submittedFeedback?.type==="negative"),i=wA();return d.jsx(Me.button,{type:"button",...s?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!i,onClick:Ke(e,()=>{i?.()})})});A0.displayName="ActionBarPrimitive.FeedbackNegative";const _A=({filename:e,onExport:t}={})=>{const n=ue(),r=G(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},N0=m.forwardRef(({filename:e,onExport:t,onClick:n,disabled:r,...s},i)=>{const o=_A({filename:e,onExport:t});return d.jsx(Me.button,{type:"button",...s,ref:i,disabled:r||!o,onClick:Ke(n,()=>{o?.()})})});N0.displayName="ActionBarPrimitive.ExportMarkdown";var Iy=so({Copy:()=>I0,Edit:()=>mA,ExportMarkdown:()=>N0,FeedbackNegative:()=>A0,FeedbackPositive:()=>j0,Reload:()=>hA,Root:()=>T0,Speak:()=>yA,StopSpeaking:()=>P0});const M0=m.forwardRef((e,t)=>d.jsx(Me.div,{...e,ref:t}));M0.displayName="AttachmentPrimitive.Root";const D0=m.forwardRef((e,t)=>{const n=G(r=>{const s=r.attachment.name.split(".");return s.length>1?s.pop():""});return d.jsxs(Me.div,{...e,ref:t,children:[".",n]})});D0.displayName="AttachmentPrimitive.unstable_Thumb";const L0=()=>d.jsx(d.Fragment,{children:G(e=>e.attachment.name)});L0.displayName="AttachmentPrimitive.Name";const bA=()=>{const e=ue();return m.useCallback(()=>{e.attachment().remove()},[e])},kA=Kn("AttachmentPrimitive.Remove",bA);var Ry=so({Name:()=>L0,Remove:()=>kA,Root:()=>M0,unstable_Thumb:()=>D0});const SA=e=>G(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)}),O0=({children:e,...t})=>SA(t)?e:null;O0.displayName="MessagePrimitive.If";const z0=m.createContext(null),cc=()=>m.useContext(z0),CA=({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(z0.Provider,{value:o,children:e})},Cp=m.createContext(null),F0=m.createContext(null),Ep=()=>{const e=m.useContext(Cp);if(!e)throw new Error("useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot");return e},Tp=()=>m.useContext(Cp),EA=()=>{const e=m.useContext(F0);if(!e)throw new Error("useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot");return e},TA=()=>{const e=Ep();return m.useSyncExternalStore(e.subscribe,e.getTriggers,e.getTriggers)},IA=new Map,B0=()=>()=>{},Py=()=>IA,RA=()=>{const e=Tp();return m.useSyncExternalStore(e?e.subscribe:B0,e?e.getTriggers:Py,e?e.getTriggers:Py)},jy=()=>null,PA=()=>{const e=Tp();return m.useSyncExternalStore(e?e.subscribeAria:B0,e?e.getActiveAria:jy,e?e.getActiveAria:jy)};function Ay(){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 Ny=({children:e})=>{const t=m.useRef(new Map),n=m.useRef(new Set),{notify:r,subscribe:s}=Ay(),i=m.useCallback(_=>{const{char:v}=_;if(t.current.has(v))return()=>{};const x=new Map(t.current);x.set(v,_),t.current=x,r();for(const w of n.current)w.added(_);return()=>{const w=new Map(t.current);w.delete(v),t.current=w,r();for(const C of n.current)C.removed(v)}},[r]),o=m.useCallback(()=>t.current,[]),a=m.useCallback(_=>(n.current.add(_),()=>{n.current.delete(_)}),[]),l=m.useRef(null),u=m.useRef(null),{notify:c,subscribe:f}=Ay(),h=m.useCallback((_,v)=>{if(v===null){if(u.current!==_)return;l.current=null,u.current=null,c();return}const x=l.current;u.current===_&&x!==null&&x.popoverId===v.popoverId&&x.highlightedItemId===v.highlightedItemId||(l.current=v,u.current=_,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(Cp.Provider,{value:g,children:d.jsx(F0.Provider,{value:y,children:e})})},$0=({children:e})=>cc()?d.jsx(Ny,{children:e}):d.jsx(CA,{children:d.jsx(Ny,{children:e})});$0.displayName="ComposerPrimitive.TriggerPopoverRoot";const My=/\s/u;function jA(e,t,n){const r=e.slice(0,n);for(let s=r.length-1;s>=0;s--){const i=r[s];if(My.test(i))return null;if(r.startsWith(t,s)){if(s>0&&!My.test(r[s-1]))continue;return{query:r.slice(s+t.length),offset:s}}}return null}const AA=ve(({text:e,triggerChar:t})=>{const[n,r]=dn(e.length),s=ce(()=>jA(e,t,Math.min(n,e.length)),[n,e,t]);return{trigger:s,query:s?.query??"",setCursorPosition:r}});function NA(e){return"type"in e}const MA=ve(({navigableList:e,isSearchMode:t,activeCategoryId:n,query:r,popoverId:s,open:i,selectItem:o,selectCategory:a,goBack:l,close:u})=>{const[c,f]=dn(0);tt(()=>{f(0)},[e]),tt(()=>{f(0)},[t,n]);const h=ar(y=>{y<0||y>=e.length||y!==c&&f(y)}),p=ar(y=>{if(!i)return!1;switch(y.key){case"ArrowDown":return y.preventDefault(),f(_=>{const v=e.length;return v===0?0:_<v-1?_+1:0}),!0;case"ArrowUp":return y.preventDefault(),f(_=>{const v=e.length;return v===0?0:_>0?_-1:v-1}),!0;case"Enter":case"Tab":{if(y.shiftKey)return!1;y.preventDefault();const _=e[c];return _&&(NA(_)?o(_):a(_.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 Dy(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}const DA=ve(({adapter:e,query:t,open:n})=>{const[r,s]=dn(null);tt(()=>{n||s(null)},[n]);const i=ce(()=>!n||!e?[]:e.categories(),[n,e]),o=n?r:null,a=ce(()=>!o||!e?[]:e.categoryItems(o),[o,e]),l=ce(()=>{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))Dy(y,p)&&h.push(y);return h},[n,e,t,o,i]),u=l!==null,c=ce(()=>{if(u)return[];if(!t)return i;const h=t.toLowerCase();return i.filter(p=>p.label.toLowerCase().includes(h))},[i,t,u]),f=ce(()=>{if(u)return l??[];if(!t)return a;const h=t.toLowerCase();return a.filter(p=>Dy(p,h))},[a,t,u,l]);return{categories:c,items:f,isSearchMode:u,activeCategoryId:o,navigableList:ce(()=>u?l??[]:o?f:c,[u,l,o,f,c]),selectCategory:ar(h=>{s(h)}),goBack:ar(()=>{s(null)})}}),LA=ve(({behavior:e,trigger:t,aui:n,triggerChar:r,setCursorPosition:s,onSelected:i})=>{const o=or(null),a=ar(l=>(o.current=l,()=>{o.current===l&&(o.current=null)}));return{selectItem:ar(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:ar(()=>{i(),t&&s(t.offset)}),registerSelectItemOverride:a}}),OA=ve(({adapter:e,text:t,triggerChar:n,behavior:r,aui:s,popoverId:i})=>{const o=yt(AA({text:t,triggerChar:n})),a=o.trigger!==null&&e!==void 0&&r!==void 0,l=yt(DA({adapter:e,query:o.query,open:a})),u=ar(()=>{l.goBack()}),c=yt(LA({behavior:r,trigger:o.trigger,aui:s,triggerChar:n,setCursorPosition:o.setCursorPosition,onSelected:u})),f=yt(MA({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}}),Ip=m.createContext(null),io=()=>{const e=m.useContext(Ip);if(!e)throw new Error("useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover");return e},zA=()=>m.useContext(Ip),U0=m.createContext(null),V0=()=>{const e=m.useContext(U0);if(!e)throw new Error("TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover");return e},H0=m.forwardRef(({char:e,adapter:t,"aria-label":n,children:r,...s},i)=>{const o=ue(),a=G(k=>k.composer.text),l=m.useId(),u=m.useRef(null),[c,f]=m.useState(null),h=m.useRef(0),p=m.useCallback(k=>(h.current+=1,u.current=k,f(k),()=>{h.current=Math.max(0,h.current-1),u.current===k&&(u.current=null,f(null))}),[e]),g=m.useMemo(()=>({register:p}),[p]),y=yb(OA({adapter:t,text:a,triggerChar:e,behavior:c??void 0,aui:o,popoverId:l})),_=m.useRef(y);_.current=y;const v=Ep();m.useEffect(()=>v.register({char:e,...c?{behavior:c}:{},resource:_.current}),[v,e,c]);const x=cc();m.useEffect(()=>{if(x)return x.register(_.current)},[x]);const w=c!==null&&y.open,C=EA();return m.useEffect(()=>{if(w)return()=>{C.setActiveAria(e,null)}},[C,e,w]),m.useEffect(()=>{w&&C.setActiveAria(e,{popoverId:l,highlightedItemId:y.highlightedItemId})},[C,e,l,w,y.highlightedItemId]),d.jsx(U0.Provider,{value:g,children:d.jsx(Ip.Provider,{value:y,children:w?d.jsx(Me.div,{role:"listbox",id:l,"aria-label":n??"Suggestions","aria-activedescendant":y.highlightedItemId,"data-state":"open",...s,ref:i,children:r}):r})})});H0.displayName="ComposerPrimitive.TriggerPopover";const W0=()=>{const{disabled:e,send:t}=kj(),n=m.useCallback(()=>t(),[t]);return e?null:n},FA=Kn("ComposerPrimitive.Send",W0),K0=m.forwardRef(({onSubmit:e,...t},n)=>{const r=W0(),s=i=>{i.preventDefault(),r&&r()};return d.jsx(Me.form,{...t,ref:n,onSubmit:Ke(e,s)})});K0.displayName="ComposerPrimitive.Root";const q0=e=>{const t=Us(e),n=qs(r=>r.onScrollToBottom);m.useEffect(()=>n(t),[n,t])},BA=()=>!1,$A=()=>{},UA=e=>m.useSyncExternalStore(m.useCallback(t=>{if(typeof window>"u"||e===null)return $A;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]),BA);function Df(){return Df=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},Df.apply(null,arguments)}function VA(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 HA=m.useLayoutEffect,WA=function(t){var n=$t.useRef(t);return HA(function(){n.current=t}),n},Ly=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},KA=function(t,n){var r=$t.useRef();return $t.useCallback(function(s){t.current=s,r.current&&Ly(r.current,null),r.current=n,n&&Ly(n,s)},[n])},Oy={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},qA=function(t){Object.keys(Oy).forEach(function(n){t.style.setProperty(n,Oy[n],"important")})},zy=qA,At=null,Fy=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function GA(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),At||(At=document.createElement("textarea"),At.setAttribute("tabindex","-1"),At.setAttribute("aria-hidden","true"),zy(At)),At.parentNode===null&&document.body.appendChild(At);var s=e.paddingSize,i=e.borderSize,o=e.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(h){var p=h;At.style[p]=o[p]}),zy(At),At.value=t;var l=Fy(At,e);At.value=t,l=Fy(At,e),At.value="x";var u=At.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 By=function(){},YA=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},QA=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],XA=!!document.documentElement.currentStyle,JA=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=YA(QA,n),s=r.boxSizing;if(s==="")return null;XA&&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}},ZA=JA;function Rp(e,t,n){var r=WA(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 eN=function(t,n){Rp(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},tN=function(t){Rp(window,"resize",t)},nN=function(t){Rp(document.fonts,"loadingdone",t)},rN=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],sN=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,i=t.minRows,o=t.onChange,a=o===void 0?By:o,l=t.onHeightChange,u=l===void 0?By:l,c=VA(t,rN),f=c.value!==void 0,h=m.useRef(null),p=KA(h,n),g=m.useRef(0),y=m.useRef(),_=function(){var w=h.current,C=r&&y.current?y.current:ZA(w);if(C){y.current=C;var k=GA(C,w.value||w.placeholder||"x",i,s),S=k[0],T=k[1];g.current!==S&&(g.current=S,w.style.setProperty("height",S+"px","important"),u(S,{rowHeight:T}))}},v=function(w){f||_(),a(w)};return m.useLayoutEffect(_),eN(h,function(){if(!f){var x=h.current.value;requestAnimationFrame(function(){var w=h.current;w&&x!==w.value&&_()})}}),tN(_),nN(_),m.createElement("textarea",Df({},c,{onChange:v,ref:p}))},iN=m.forwardRef(sN);const oN="(pointer: coarse) and (not (any-pointer: fine))",G0=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,..._},v)=>{const x=ue(),w=cc(),C=PA(),k=u??(l===!1?"none":"enter"),S=UA(g?oN:null),T=g&&S&&k==="enter"?"none":k,I=G(z=>z.composer.isEditing?z.composer.text:""),P=G(z=>z.thread.isDisabled||z.composer.dictation?.inputDisabled)||r,E=m.useRef(null),D=Ys(v,E),M=m.useRef(!1);R0(z=>{if(!E.current?.contains(z.target))return;if(w){for(const W of w.getPlugins())if(W.handleKeyDown(z))return}if(!c)return;const b=x.composer();b.getState().canCancel&&(b.cancel(),z.preventDefault())});const B=z=>{if(!P&&!z.nativeEvent.isComposing){if(w){for(const b of w.getPlugins())if(b.handleKeyDown(z))return}if(z.key==="Enter"){const b=x.thread().getState(),W=b.capabilities.queue;if(z.shiftKey&&(z.ctrlKey||z.metaKey)&&W&&k!=="none"&&x.composer().getState().canSend){z.preventDefault(),x.composer().send({steer:!0});return}if(z.shiftKey||b.isRunning&&!W)return;let X=!1;T==="ctrlEnter"?X=z.ctrlKey||z.metaKey:T==="enter"&&(X=!0),X&&(z.preventDefault(),E.current?.closest("form")?.requestSubmit())}}},Q=async z=>{if(!y)return;const b=x.thread().getState().capabilities,W=Array.from(z.clipboardData?.files||[]);if(b.attachments&&W.length>0)try{z.preventDefault(),await Promise.all(W.map(X=>x.composer().addAttachment(X)))}catch(X){console.error("Error adding attachment:",X)}},U=e&&!P,te=m.useCallback(()=>{const z=E.current;!z||!U||(z.focus({preventScroll:!0}),z.setSelectionRange(z.value.length,z.value.length))},[U]);m.useEffect(()=>te(),[te]),q0(()=>{x.composer().getState().type==="thread"&&h&&te()}),m.useEffect(()=>{if(!(x.composer().getState().type!=="thread"||!f))return x.on("thread.runStart",te)},[f,te,x]),m.useEffect(()=>{if(!(x.composer().getState().type!=="thread"||!p))return x.on("threadListItem.switchedTo",te)},[p,te,x]);const Z=C?{"aria-controls":C.popoverId,"aria-expanded":!0,"aria-haspopup":"listbox","aria-activedescendant":C.highlightedItemId}:{},F={name:"input",value:I,..._,...Z,ref:D,disabled:P,onChange:Ke(s,z=>{if(!x.composer().getState().isEditing)return;const b=z.nativeEvent.isComposing===!0;M.current&&!b&&(M.current=!1);const W=b||M.current;if(qg(()=>{x.composer().setText(z.target.value)}),W)return;const X=z.target.selectionStart??z.target.value.length;if(w)for(const R of w.getPlugins())R.setCursorPosition(X)}),onKeyDown:Ke(i,B),onCompositionStart:Ke(_.onCompositionStart,()=>{M.current=!0}),onCompositionEnd:Ke(_.onCompositionEnd,z=>{if(M.current=!1,!x.composer().getState().isEditing)return;const b=z.target;qg(()=>{x.composer().setText(b.value)});const W=b.selectionStart??b.value.length;if(w)for(const X of w.getPlugins())X.setCursorPosition(W)}),onSelect:Ke(a,z=>{if(M.current)return;const b=z.target,W=b.selectionStart??b.value.length;if(w)for(const X of w.getPlugins())X.setCursorPosition(W)}),onPaste:Ke(o,Q)};if(n&&m.isValidElement(n)){const z=_.children!==void 0?_.children:n.props.children;return d.jsx(ku,{...F,children:m.cloneElement(n,void 0,z)})}return d.jsx(t?ku:iN,{...F})});G0.displayName="ComposerPrimitive.Input";const aN=()=>{const{disabled:e,cancel:t}=Sj();return e?null:t},lN=Kn("ComposerPrimitive.Cancel",aN),uN=({multiple:e=!0}={})=>{const{disabled:t,addAttachment:n}=Ej(),r=ue(),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},cN=Kn("ComposerPrimitive.AddAttachment",uN,["multiple"]),Y0=m.forwardRef(({disabled:e,asChild:t=!1,render:n,children:r,...s},i)=>{const[o,a]=m.useState(!1),l=ue(),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 _=>{try{await l.composer().addAttachment(_)}catch(v){console.error("Failed to add attachment:",v)}}))},[e,l]),p={...o?{"data-dragging":"true"}:null,...s,onDragEnterCapture:Ke(s.onDragEnterCapture,u),onDragOverCapture:Ke(s.onDragOverCapture,c),onDragLeaveCapture:Ke(s.onDragLeaveCapture,f),onDropCapture:Ke(s.onDropCapture,h),ref:i};if(n&&m.isValidElement(n)){const g=r!==void 0?r:n.props.children;return d.jsx(ku,{...p,children:m.cloneElement(n,void 0,g)})}return d.jsx(t?ku:"div",{...p,children:r})});Y0.displayName="ComposerPrimitive.AttachmentDropzone";const dN=()=>{const{disabled:e,startDictation:t}=Cj();return e?null:t},fN=Kn("ComposerPrimitive.Dictate",dN),hN=()=>{const e=ue(),t=G(r=>r.composer.dictation!=null),n=m.useCallback(()=>{e.composer().stopDictation()},[e]);return t?n:null},pN=Kn("ComposerPrimitive.StopDictation",hN),Q0=m.forwardRef(({children:e,...t},n)=>{const r=G(s=>s.composer.dictation?.transcript);return r?d.jsx(Me.span,{...t,ref:n,children:e??r}):null});Q0.displayName="ComposerPrimitive.DictationTranscript";const X0=m.forwardRef((e,t)=>G(n=>n.composer.quote)?d.jsx(Me.div,{...e,ref:t}):null);X0.displayName="ComposerPrimitive.Quote";const J0=m.forwardRef(({children:e,...t},n)=>{const r=G(s=>s.composer.quote?.text);return r?d.jsx(Me.span,{...t,ref:n,children:e??r}):null});J0.displayName="ComposerPrimitive.QuoteText";const Z0=m.forwardRef(({onClick:e,...t},n)=>{const r=ue(),s=m.useCallback(()=>{r.composer().setQuote(void 0)},[r]);return d.jsx(Me.button,{type:"button",...t,ref:n,onClick:Ke(e,s)})});Z0.displayName="ComposerPrimitive.QuoteDismiss";const ek=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{categories:s,activeCategoryId:i,isSearchMode:o,open:a}=io();return!a||i||o?null:d.jsx(Me.div,{role:"group","aria-label":t??"Categories",...n,ref:r,children:e(s)})});ek.displayName="ComposerPrimitive.TriggerPopoverCategories";const tk=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}=io(),h=m.useCallback(()=>{i(e)},[i,e]),p=a.findIndex(_=>_.id===e),g=!u&&!c&&p===l,y=m.useCallback(()=>{o(p)},[o,p]);return d.jsx(Me.button,{type:"button",role:"option",id:`${f}-option-${e}`,"aria-selected":g,"data-highlighted":g?"":void 0,...r,ref:s,onClick:Ke(t,h),onMouseMove:Ke(n,y)})});tk.displayName="ComposerPrimitive.TriggerPopoverCategoryItem";const nk=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{items:s,activeCategoryId:i,isSearchMode:o,open:a}=io();return!a||!i&&!o?null:d.jsx(Me.div,{role:"group","aria-label":t??"Items",...n,ref:r,children:e(s)})});nk.displayName="ComposerPrimitive.TriggerPopoverItems";const rk=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}=io(),p=m.useCallback(()=>{o(e)},[o,e]),g=t??l.findIndex(v=>v.id===e.id),y=(f||c!==null)&&g===u,_=m.useCallback(()=>{a(g)},[a,g]);return d.jsx(Me.button,{type:"button",role:"option",id:`${h}-option-${e.id}`,"aria-selected":y,"data-highlighted":y?"":void 0,...s,ref:i,onClick:Ke(n,p),onMouseMove:Ke(r,_)})});rk.displayName="ComposerPrimitive.TriggerPopoverItem";const sk=m.forwardRef(({onClick:e,...t},n)=>{const{activeCategoryId:r,isSearchMode:s,goBack:i,open:o}=io();return!o||!r||s?null:d.jsx(Me.button,{type:"button",...t,ref:n,onClick:Ke(e,i)})});sk.displayName="ComposerPrimitive.TriggerPopoverBack";const ik=({formatter:e,onExecute:t,removeOnExecute:n})=>{const{register:r}=V0(),s=m.useRef(t);return s.current=t,m.useEffect(()=>r({kind:"action",formatter:e??b0,onExecute:i=>s.current(i),...n!==void 0?{removeOnExecute:n}:{}}),[r,e,n]),null};ik.displayName="ComposerPrimitive.TriggerPopoverAction";const ok=({formatter:e,onInserted:t})=>{const{register:n}=V0(),r=m.useRef(t);return r.current=t,m.useEffect(()=>n({kind:"directive",formatter:e??b0,onInserted:s=>r.current?.(s)}),[n,e]),null};ok.displayName="ComposerPrimitive.TriggerPopoverDirective";const mN=Object.assign(H0,{Directive:ok,Action:ik});var ml=so({AddAttachment:()=>cN,AttachmentByIndex:()=>m0,AttachmentDropzone:()=>Y0,Attachments:()=>g0,Cancel:()=>lN,Dictate:()=>fN,DictationTranscript:()=>Q0,If:()=>_0,Input:()=>G0,Queue:()=>y0,Quote:()=>X0,QuoteDismiss:()=>Z0,QuoteText:()=>J0,Root:()=>K0,Send:()=>FA,StopDictation:()=>pN,Unstable_TriggerPopover:()=>mN,Unstable_TriggerPopoverBack:()=>sk,Unstable_TriggerPopoverCategories:()=>ek,Unstable_TriggerPopoverCategoryItem:()=>tk,Unstable_TriggerPopoverItem:()=>rk,Unstable_TriggerPopoverItems:()=>nk,Unstable_TriggerPopoverRoot:()=>$0,unstable_useTriggerPopoverRootContext:()=>Ep,unstable_useTriggerPopoverRootContextOptional:()=>Tp,unstable_useTriggerPopoverScopeContext:()=>io,unstable_useTriggerPopoverScopeContextOptional:()=>zA,unstable_useTriggerPopoverTriggers:()=>TA,unstable_useTriggerPopoverTriggersOptional:()=>RA});const ak=()=>G(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}),gN=()=>G(e=>{if(e.part.type!=="image")throw new Error("MessagePartImage can only be used inside image message parts.");return e.part}),lk=m.createContext(null),yN=e=>({useSmoothStatus:kb(()=>e)}),vN=({children:e})=>{const t=uk({optional:!0}),n=ue(),[r]=m.useState(()=>yN(n.part().getState().status));return t?e:d.jsx(lk.Provider,{value:r,children:e})},xN=e=>{const t=m.forwardRef((n,r)=>d.jsx(vN,{children:d.jsx(e,{...n,ref:r})}));return t.displayName=e.displayName,t};function uk(e){const t=m.useContext(lk);if(!e?.optional&&!t)throw new Error("This component must be used within a SmoothContextProvider.");return t}const{useSmoothStatus:wN,useSmoothStatusStore:_N}=k0(uk,"useSmoothStatus");var bN=class{constructor(e,t){A(this,"currentText");A(this,"setText");A(this,"animationFrameId",null);A(this,"lastUpdateTime",Date.now());A(this,"targetText","");A(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 sd=Object.freeze({type:"running"}),ck=(e,t=!1)=>{const{text:n}=e,[r,s]=m.useState(e.status.type==="running"?"":n),i=ue(),o=G(()=>i.part()),[a,l]=m.useState(o);(o!==a||!n.startsWith(r))&&(l(o),s(e.status.type==="running"?"":n));const u=_N({optional:!0}),c=Us(p=>{if(s(p),u){const g=r!==p||e.status.type==="running"?sd:e.status;_u(u).setState(g,!0)}});m.useEffect(()=>{if(u){const p=t&&(r!==n||e.status.type==="running")?sd:e.status;_u(u).setState(p,!0)}},[u,t,n,r,e.status]);const[f]=m.useState(new bN(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:sd}:e,[t,r,e,n])},Pp=m.forwardRef(({smooth:e=!0,component:t="span",...n},r)=>{const{text:s,status:i}=ck(ak(),e);return d.jsx(t,{"data-status":i.type,...n,ref:r,children:s})});Pp.displayName="MessagePartPrimitive.Text";const jp=m.forwardRef((e,t)=>{const{image:n}=gN();return d.jsx(Me.img,{src:n,...e,ref:t})});jp.displayName="MessagePartPrimitive.Image";const Qs=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])},$y=(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},kN=e=>e.dataset.messageId,SN=()=>{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},Uy=(e,t)=>{const n=`${t}px`;return e.style.height!==n?(e.style.height=n,!0):!1},CN=e=>{const t=window.devicePixelRatio||1;return Math.round(e*t)/t},dk=()=>{const e=ue(),t=G(()=>e.message());return Qs(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]))},EN=()=>{const e=qs(t=>t.topAnchorTurn?.anchorId);return G(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))},TN=()=>{const e=qs(t=>t.topAnchorTurn?.targetId);return G(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))},IN=(e,t)=>Qs(m.useCallback(n=>{if(e)return t.getState().registerAnchorElement(n)},[e,t])),RN=({active:e,threadViewportStore:t})=>Qs(m.useCallback(n=>{if(!e)return;const r=t.getState(),s=r.topAnchorMessageClamp;return r.registerAnchorTargetElement(n,{tallerThan:$y(s.tallerThan,n),visibleHeight:$y(s.visibleHeight,n)})},[e,t])),PN=({forwardedRef:e,...t})=>{const n=Ys(e,dk()),r=G(s=>s.message.id);return d.jsx(Me.div,{...t,ref:n,"data-message-id":r})},jN=({forwardedRef:e,threadViewportStore:t,...n})=>{const r=dk(),s=EN(),i=TN(),o=Ys(e,r,IN(s,t),RN({active:i,threadViewportStore:t})),a=G(l=>l.message.id);return d.jsx(Me.div,{...n,ref:o,"data-message-id":a,"data-aui-top-anchor-user":s?"":void 0,"data-aui-top-anchor-target":i?"":void 0})},fk=m.forwardRef((e,t)=>{const n=Gs();return n.getState().turnAnchor==="top"?d.jsx(jN,{...e,forwardedRef:t,threadViewportStore:n}):d.jsx(PN,{...e,forwardedRef:t})});fk.displayName="MessagePrimitive.Root";const id={...Ct,Text:()=>d.jsxs("p",{style:{whiteSpace:"pre-line"},children:[d.jsx(Pp,{}),d.jsx(kp,{children:d.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>d.jsx(jp,{})},Lf=e=>{if("children"in e)return d.jsx(Mf,{children:e.children});const{components:t,...n}=e;return d.jsx(Mf,{components:t?{Text:t.Text??id.Text,Image:t.Image??id.Image,Reasoning:t.Reasoning??Ct.Reasoning,Source:t.Source??Ct.Source,File:t.File??Ct.File,Unstable_Audio:t.Unstable_Audio??Ct.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??Ct.ToolGroup,ReasoningGroup:t.ReasoningGroup??Ct.ReasoningGroup},Empty:t.Empty,Quote:t.Quote,generativeUI:t.generativeUI}:id,...n})};Lf.displayName="MessagePrimitive.Parts";const hk=({children:e})=>Dj()!==void 0?e:null;hk.displayName="MessagePrimitive.Error";const AN=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},NN=e=>{const t=G(n=>n.message.parts);return m.useMemo(()=>t.length===0?[]:e(t),[t,e])},MN=({Fallback:e,...t})=>{const n=G(r=>{const s=r.tools.tools[t.toolName]??e;return Array.isArray(s)?s[0]??e:s});return n?d.jsx(n,{...t}):null},DN=({Fallback:e,...t})=>{const n=G(r=>{const s=r.dataRenderers.renderers[t.name]??e;return Array.isArray(s)?s[0]??e:s});return n?d.jsx(n,{...t}):null},Lr={Text:()=>d.jsxs("p",{style:{whiteSpace:"pre-line"},children:[d.jsx(Pp,{}),d.jsx(kp,{children:d.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>d.jsx(jp,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},LN=({components:{Text:e=Lr.Text,Reasoning:t=Lr.Reasoning,Image:n=Lr.Image,Source:r=Lr.Source,File:s=Lr.File,Unstable_Audio:i=Lr.Unstable_Audio,tools:o={},data:a}={}})=>{const l=ue(),u=G(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(MN,{...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(DN,{...u,Fallback:f})}default:return console.warn(`Unknown message part type: ${c}`),null}},ON=({partIndex:e,components:t})=>d.jsx(yp,{index:e,children:d.jsx(LN,{components:t})}),zN=m.memo(ON,(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),FN=({status:e,component:t})=>d.jsx(vp,{text:"",isRunning:e.type==="running",children:d.jsx(t,{type:"text",text:"",status:e})}),BN=Object.freeze({type:"complete"}),$N=({components:e})=>{const t=G(n=>n.message.status??BN);return e?.Empty?d.jsx(e.Empty,{status:t}):d.jsx(FN,{status:t,component:e?.Text??Lr.Text})},UN=m.memo($N,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),Ap=({groupingFunction:e,components:t})=>{const n=G(s=>s.message.parts.length),r=NN(e);return d.jsx(d.Fragment,{children:m.useMemo(()=>n===0?d.jsx(UN,{components:t}):r.map((s,i)=>d.jsx(t?.Group??Lr.Group,{groupKey:s.groupKey,indices:s.indices,children:s.indices.map(o=>d.jsx(zN,{partIndex:o,components:t},o))},`group-${i}-${s.groupKey??"ungrouped"}`)),[r,t,n])})};Ap.displayName="MessagePrimitive.Unstable_PartsGrouped";const pk=({components:e,...t})=>d.jsx(Ap,{...t,components:e,groupingFunction:AN});pk.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId";var Su=so({AttachmentByIndex:()=>f0,Attachments:()=>h0,Content:()=>Lf,Error:()=>hk,GenerativeUI:()=>e0,GroupedParts:()=>u0,If:()=>O0,PartByIndex:()=>Uo,Parts:()=>Lf,Quote:()=>c0,Root:()=>fk,Unstable_PartsGrouped:()=>Ap,Unstable_PartsGroupedByParentId:()=>pk});const VN=e=>{const t=Us(e);return Qs(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]))},HN=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{const s=m.useRef(null),i=G(C=>C.thread.messages.length>0),o=m.useRef(!1),a=m.useRef(null),l=Gs();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(C=>{const k=s.current;k&&(p.current=C,k.scrollTo({top:k.scrollHeight,behavior:C}))},[]),y=m.useCallback(C=>{p.current=C,a.current!==null&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{a.current=null,g(C)})},[g]);m.useLayoutEffect(()=>()=>{a.current!==null&&cancelAnimationFrame(a.current)},[]);const _=m.useCallback(()=>{const C=l.getState();return C.turnAnchor==="top"&&C.element.viewport===s.current&&C.element.anchor!==null},[l]),v=()=>{const C=s.current;if(!C)return;const k=l.getState().isAtBottom,S=Math.abs(C.scrollHeight-C.scrollTop-C.clientHeight)<=1||C.scrollHeight<=C.clientHeight;!S&&u.current<C.scrollTop||(S?C.scrollHeight>C.clientHeight+1&&(p.current=null):u.current>C.scrollTop&&c.current===C.scrollHeight&&(p.current=null),(S||p.current===null)&&S!==k&&_u(l).setState({isAtBottom:S})),u.current=C.scrollTop,c.current=C.scrollHeight},x=VN(()=>{const C=s.current;if(!C)return;const{scrollHeight:k,clientHeight:S}=C;if(k===f.current&&S===h.current)return;f.current=k,h.current=S;const T=p.current;T&&_()?p.current=null:T?g(T):e&&l.getState().isAtBottom&&g("instant"),v()}),w=Qs(C=>(C.addEventListener("scroll",v),()=>{C.removeEventListener("scroll",v)}));return m.useLayoutEffect(()=>{if(n){if(!i){o.current=!1;return}o.current||(o.current=!0,p.current===null&&y("instant"))}},[i,y,n]),q0(({behavior:C})=>{g(C)}),yu("thread.runStart",()=>{t&&l.getState().turnAnchor!=="top"&&y("auto")}),yu("threadListItem.switchedTo",()=>{r&&y("instant")}),Ys(x,w,s)},mk=m.forwardRef((e,t)=>d.jsx(Me.div,{...e,ref:t}));mk.displayName="ThreadPrimitive.Root";const gk=({children:e})=>G(t=>t.thread.isEmpty)?e:null;gk.displayName="ThreadPrimitive.Empty";const WN=e=>G(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)),yk=({children:e,...t})=>WN(t)?e:null;yk.displayName="ThreadPrimitive.If";const vk=(e,t)=>Qs(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])),Vy=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},KN=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:Vy(e)-Vy(t)},xk=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{const s=KN(t,e),i=t.offsetHeight;return s+Math.max(0,i-(i<=n?i:r))},qN=({scrollHeight:e,...t})=>{const{viewport:n}=t,r=xk(t)+n.clientHeight;return Math.max(0,r-e)},GN=({viewport:e,reserve:t,...n})=>qN({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),YN=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}},QN=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},XN=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&&(Uy(t,0),t.remove());return}if(t??(t=SN()),(t.parentElement!==c.parentElement||t.previousElementSibling!==c)&&c.after(t),i.target(l,u,c),Uy(t,GN({viewport:l,anchor:u,reserve:t,...f}))){s.schedule();return}const h=kN(u);if(h!==void 0&&n===h)return;const p=CN(xk({viewport:l,anchor:u,...f}));Math.abs(l.scrollTop-p)>1&&l.scrollTo({top:p,behavior:"smooth"}),h!==void 0&&(n=h)}const s=QN(r),i=YN(s.schedule);s.schedule();const o=e.subscribe(s.schedule);return()=>{s.cancel(),o(),i.disconnect(),t?.remove()}},JN=e=>{const t=Gs();m.useLayoutEffect(()=>{if(e)return XN(t)},[e,t])},wk=({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}},ZN=e=>wk(e)?.anchorId,eM=e=>wk(e)?.targetId,tM=()=>vk(qs(e=>e.registerViewport),m.useCallback(e=>e.clientHeight,[])),nM=()=>Qs(qs(e=>e.registerViewportElement)),rM=e=>{const t=Gs(),n=G(o=>{if(e)return ZN(o.thread)}),r=G(o=>{if(e)return eM(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]);yu("thread.initialize",i),yu("threadListItem.switchedTo",i)},_k=m.forwardRef(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r,children:s,...i},o)=>{const a=HN({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r}),l=tM(),u=nM(),c=Gs().getState().turnAnchor==="top";rM(c),JN(c);const f=Ys(o,a,l,u);return d.jsx(Me.div,{...i,ref:f,children:s})});_k.displayName="ThreadPrimitive.ViewportScrollable";const bk=m.forwardRef(({turnAnchor:e,topAnchorMessageClamp:t,...n},r)=>d.jsx(Sp,{options:{turnAnchor:e,topAnchorMessageClamp:t},children:d.jsx(_k,{...n,ref:r})}));bk.displayName="ThreadPrimitive.Viewport";const kk=m.forwardRef((e,t)=>{const n=Ys(t,vk(qs(r=>r.registerContentInset),m.useCallback(r=>{const s=parseFloat(getComputedStyle(r).marginTop)||0;return r.offsetHeight+s},[])));return d.jsx(Me.div,{...e,ref:n})});kk.displayName="ThreadPrimitive.ViewportFooter";const sM=({behavior:e}={})=>{const t=qs(s=>s.isAtBottom),n=Gs(),r=m.useCallback(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},iM=Kn("ThreadPrimitive.ScrollToBottom",sM,["behavior"]),oM=({prompt:e,send:t,clearComposer:n,autoSend:r,method:s})=>{const{disabled:i,trigger:o}=Mj({prompt:e,send:t??r??!1,clearComposer:n});return i?null:o},aM=Kn("ThreadPrimitive.Suggestion",oM,["prompt","send","clearComposer","autoSend","method"]);var vt=so({Empty:()=>gk,If:()=>yk,MessageByIndex:()=>Qb,Messages:()=>UP,Root:()=>mk,ScrollToBottom:()=>iM,Suggestion:()=>aM,SuggestionByIndex:()=>x0,Suggestions:()=>_j,Viewport:()=>bk,ViewportFooter:()=>kk,ViewportProvider:()=>Sp}),lM=so({AssistantRuntimeImpl:()=>Vb,BaseAssistantRuntimeCore:()=>Hb,CompositeContextProvider:()=>dp,DefaultThreadComposerRuntimeCore:()=>qb,MessageRepository:()=>wp,ThreadRuntimeImpl:()=>Ub,fromThreadMessageLike:()=>ga,generateId:()=>is,getAutoStatus:()=>xu,splitLocalRuntimeOptions:()=>Lj,useComposerInputPluginRegistryOptional:()=>cc,useSmooth:()=>ck,useSmoothStatus:()=>wN,withSmoothContextProvider:()=>xN});const Np="claude-control.token";let Cu=null,Eu=!1;function uM(){try{return window.localStorage.getItem(Np)}catch{return null}}const cM="claude-control";function dc(){return Eu||(Cu=uM(),Eu=!0),Cu}function Sk(e){Cu=e,Eu=!0;try{window.localStorage.setItem(Np,e)}catch{}}function Ck(){Cu=null,Eu=!0;try{window.localStorage.removeItem(Np)}catch{}}function dM(){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;Sk(t),e.delete("token");const n=e.toString(),r=window.location.pathname+(n?`?${n}`:"")+window.location.hash;try{window.history.replaceState(null,"",r)}catch{}}dM();const Of=new Set;function fM(e){return Of.add(e),()=>Of.delete(e)}function Ek(){Ck();for(const e of Of)e()}function hM(e){const t=dc(),n={...e??{}};return t&&(n.Authorization=`Bearer ${t}`),n}async function nt(e,t){const n=await fetch(e,{...t,headers:hM(t?.headers)});return n.status===401&&Ek(),n}function pM(e){const t=`/term/${encodeURIComponent(e)}/`,n=dc();return n?`${t}?token=${encodeURIComponent(n)}`:t}function mM(){const e=window.location;return`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}/`}async function Tk(){try{const e=await nt("/api/version");return e.ok?await e.json():null}catch{return null}}async function gM(){try{const e=await nt("/api/update",{method:"POST"}),t=await e.json().catch(()=>({}));return e.ok&&!!t.ok}catch{return!0}}async function yM(){try{const e=await nt("/api/push/vapid");return e.ok?(await e.json()).publicKey??null:null}catch{return null}}async function vM(e){try{return(await nt("/api/push/subscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).ok}catch{return!1}}async function xM(e){try{return(await nt("/api/push/unsubscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:e})})).ok}catch{return!1}}async function wM(e){const t=await nt("/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 _M(){const e=await nt("/api/icon",{method:"DELETE"}),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw new Error(t.error||`HTTP ${e.status}`)}async function bM(){const e=await nt("/api/models");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function kM(e,t){const n=await nt("/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 SM(e,t="webm",n){const r=await nt(`/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 Ik(){const e=await nt("/api/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function CM(e){const t=await nt("/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 Rk(e){const t=await nt("/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 EM(e,t){const n=await nt("/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 TM(e){return`/api/uploads/${encodeURIComponent(e)}`}async function IM(){const e=await nt("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).processes??[]}async function RM(e,t){const n=await nt("/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 Pk(e){const t=e?`/api/skills?id=${encodeURIComponent(e)}`:"/api/skills",n=await nt(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).skills??[]}async function PM(e){const t=e?`/api/agents?id=${encodeURIComponent(e)}`:"/api/agents",n=await nt(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).agents??[]}async function jM(e){const t=`/api/upload?name=${encodeURIComponent(e.name)}`,n=await nt(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 AM=1008,Hy=1e3,NM=3e4;class MM{constructor(){A(this,"ws",null);A(this,"reconnectTimer",null);A(this,"reconnectDelay",Hy);A(this,"selectedId",null);A(this,"closed",!1);A(this,"msgHandlers",new Set);A(this,"stateHandlers",new Set)}connect(){if(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.emitState("connecting");const t=dc(),n=t?[cM,t]:void 0,r=new WebSocket(mM(),n);this.ws=r,r.addEventListener("open",()=>{this.reconnectDelay=Hy,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===AM){Ek();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,NM)}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 Wy=2e3;function DM(e,t){if(!e||e.length===0)return Ky(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:Ky([...e,...r])}function Ky(e){return e.length>Wy?e.slice(e.length-Wy):e}const LM=10*6e4;function OM(){const e=m.useRef(null);e.current||(e.current=new MM);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),[_,v]=m.useState({}),[x,w]=m.useState({}),[C,k]=m.useState({}),[S,T]=m.useState({}),I=m.useRef(null);I.current=s;const P=m.useRef([]);P.current=n,m.useEffect(()=>{const ee=t.onState(a),ne=t.onMessage(se=>{switch(se.type){case"sessions":r(he=>{const mt=new Map(he.map(ut=>[ut.id,ut]));return(se.sessions??[]).map(ut=>{const rt=mt.get(ut.id);return rt?{...ut,model:ut.model??rt.model,ctxPct:ut.ctxPct??rt.ctxPct}:ut})});break;case"messages":v(he=>({...he,[se.id]:DM(he[se.id],se.messages??[])})),w(he=>({...he,[se.id]:se.pending??null}));break;case"append":v(he=>({...he,[se.id]:[...he[se.id]??[],...se.messages??[]]}));break;case"pending":w(he=>({...he,[se.id]:se.pending})),r(he=>he.map(mt=>mt.id===se.id?{...mt,pending:!!se.pending}:mt));break;case"resources":{const he=se.snapshot??null;if(u({snapshot:he,warning:se.warning??null}),he){const mt=Date.now(),ut={t:mt,cpu:he.self?.cpuPct??0,mem:he.system?.memUsedPct??0};f(rt=>[...rt,ut].filter(Pn=>mt-Pn.t<=LM))}break}case"capture":se.id===I.current&&p(se.text??"");break;case"shell-output":(!se.id||se.id===I.current)&&y(se.text??"");break;case"prompt":T(he=>({...he,[se.id]:se.prompt}));break;case"subagents":k(he=>({...he,[se.id]:Object.fromEntries((se.subagents??[]).map(mt=>[mt.agentId,mt]))}));break;case"subagent":k(he=>({...he,[se.id]:{...he[se.id]??{},[se.subagent.agentId]:se.subagent}}));break;case"ack":window.dispatchEvent(new CustomEvent("cockpit:ack",{detail:se}));break}});return t.connect(),()=>{ee(),ne()}},[t]),m.useEffect(()=>()=>t.close(),[t]);const E=m.useCallback(ee=>{ee!==I.current&&(i(ee),p(null),t.select(ee))},[t]),D=m.useCallback(ee=>{const ne=I.current;return!ne||!ee.trim()?!1:t.send({type:"reply",id:ne,text:ee})},[t]),M=m.useCallback((ee,ne)=>{const se=I.current;return se?t.send({type:"answer",id:se,toolUseId:ee,selections:ne}):!1},[t]),B=m.useCallback((ee,ne)=>{const se=I.current;return se?t.send({type:"capture",id:se,lines:ee,escapes:ne}):!1},[t]),Q=m.useCallback(()=>p(null),[]),U=m.useCallback(ee=>{const ne=I.current;return ne?t.send({type:"pane-text",id:ne,text:ee}):!1},[t]),te=m.useCallback(ee=>{const ne=I.current;return ne?t.send({type:"pane-key",id:ne,key:ee}):!1},[t]),Z=m.useCallback(ee=>{const ne=I.current;return ne?t.send({type:"shell-input",id:ne,line:ee}):!1},[t]),F=m.useCallback(ee=>{const ne=I.current;return ne?t.send({type:"shell-text",id:ne,text:ee}):!1},[t]),z=m.useCallback(ee=>{const ne=I.current;return ne?t.send({type:"shell-key",id:ne,key:ee}):!1},[t]),b=m.useCallback(ee=>{const ne=I.current;return ne?t.send({type:"shell-capture",id:ne,lines:ee}):!1},[t]),W=m.useCallback(()=>y(null),[]),X=m.useCallback(()=>t.resubscribe(),[t]),R=m.useCallback(ee=>{const ne=I.current;return ne?t.send({type:"promptkey",id:ne,key:ee}):!1},[t]),le=m.useCallback((ee,ne)=>t.send({type:"promptselect",id:ee,labels:ne}),[t]),we=m.useMemo(()=>s!=null&&s in _,[s,_]),de=m.useMemo(()=>s?_[s]??[]:[],[s,_]),Je=m.useMemo(()=>s?x[s]??null:null,[s,x]),Ue=m.useMemo(()=>s?S[s]??null:null,[s,S]),Ce=m.useMemo(()=>{const ee=s?C[s]:null;return ee?Object.values(ee).sort((ne,se)=>(se.createdAt??-1/0)-(ne.createdAt??-1/0)):[]},[s,C]);return{sessions:n,selectedId:s,messages:de,messagesLoaded:we,pending:Je,prompt:Ue,subagents:Ce,conn:o,resources:l,resourceHistory:c,capture:h,shellOutput:g,select:E,resubscribe:X,sendReply:D,sendPromptKey:R,sendPromptSelect:le,sendAnswer:M,requestCapture:B,clearCapture:Q,sendPaneText:U,sendPaneKey:te,sendShellInput:Z,sendShellText:F,sendShellKey:z,requestShellCapture:b,clearShellOutput:W}}const od="cc:push:intent";function zM(){return typeof window>"u"||!("serviceWorker"in navigator)||!("PushManager"in window)||!("Notification"in window)?!1:window.isSecureContext===!0}function FM(){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 qy(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 BM(){const e=zM(),t=FM(),[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 yM();if(!u)return r("off"),!1;let c=await a.pushManager.getSubscription();if(c)try{const h=qy(u),p=c.options?.applicationServerKey;let g=!1;if(p instanceof ArrayBuffer){const y=new Uint8Array(p),_=new Uint8Array(h);if(y.length!==_.length)g=!0;else for(let v=0;v<y.length;v++)if(y[v]!==_[v]){g=!0;break}}g&&(await c.unsubscribe(),c=null)}catch{}return c||(c=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:qy(u)})),await vM(c.toJSON())},[]),i=m.useCallback(async()=>{if(e){r("working");try{await s()?(localStorage.setItem(od,"1"),r("on")):r(l=>l==="denied"?"denied":"off")}catch{r("off")}}},[e,s]),o=m.useCallback(async()=>{r("working"),localStorage.removeItem(od);try{const l=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();l&&(await xM(l.endpoint),await l.unsubscribe())}catch{}r("off")},[]);return m.useEffect(()=>{if(!e||localStorage.getItem(od)!=="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 zf=70,$M=110,UM=.5,VM=".thread-viewport, .rail-scroll, .live-pane-body";function HM(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 v=y.target?.closest(VM)??null;v&&v.scrollTop<=0?(u.current=v,l.current=y.touches[0].clientY,a.current=!0):a.current=!1},p=y=>{if(!a.current)return;const _=y.touches[0].clientY-l.current,v=u.current;if(_<=0||v&&v.scrollTop>0){o.current!==0&&c(0),v&&v.scrollTop>0&&(a.current=!1);return}const x=Math.min($M,_*UM);c(x),y.cancelable&&y.preventDefault()},g=()=>{a.current&&(a.current=!1,o.current>=zf?(c(zf),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 WM=zf,Tu="__cockpitSummary";function KM(e){if(e&&typeof e=="object"&&Tu in e){const t=e[Tu];return typeof t=="string"?t:""}return""}function jk(e){if(!e||typeof e!="object")return e;const t={};for(const[n,r]of Object.entries(e))n!==Tu&&(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 Ak(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=QM(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}}})}),GM(n)}function GM(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 YM(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 QM(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?YM(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,[Tu]:s.inputSummary??""},argsText:s.inputSummary??"",result:i??void 0,isError:i?.isError});break}}return r}const XM="image/*,application/pdf,text/*,.md,.json,.csv,.log",Ff=" cockpit-path:";function JM(e){return Ff+e}const zl=new Map;function ZM(e){return zl.get(e)??null}function e2(e){for(const t of e.content??[])if(t.type==="text"&&t.text.startsWith(Ff))return t.text.slice(Ff.length);return ZM(e.id)}function t2(e){return`${e.name}-${e.size}-${e.lastModified}`}function n2(e){return{accept:XM,async add({file:t}){const n=t2(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 jM(t);return zl.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=zl.get(t.id);if(!n)throw new Error(`attachment ${t.name} was not uploaded`);return{...t,status:{type:"complete"},content:[{type:"text",text:JM(n)}]}},async remove(t){zl.delete(t.id)}}}function mr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nk(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 ln={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},ya={duration:.5,overwrite:!1,delay:0},Mp,wt,$e,kn=1e8,Re=1/kn,Bf=Math.PI*2,r2=Bf/4,s2=0,Mk=Math.sqrt,i2=Math.cos,o2=Math.sin,pt=function(t){return typeof t=="string"},Xe=function(t){return typeof t=="function"},Er=function(t){return typeof t=="number"},Dp=function(t){return typeof t>"u"},cr=function(t){return typeof t=="object"},Kt=function(t){return t!==!1},Lp=function(){return typeof window<"u"},gl=function(t){return Xe(t)||pt(t)},Dk=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},It=Array.isArray,a2=/random\([^)]+\)/g,l2=/,\s*/g,Gy=/(?:-?\.?\d|\.)+/gi,Lk=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,bi=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,ad=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Ok=/[+-]=-?[.\d]+/,u2=/[^,'"\[\]\s]+/gi,c2=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,We,Zn,$f,Op,fn={},Iu={},zk,Fk=function(t){return(Iu=Ki(t,fn))&&Qt},zp=function(t,n){return console.warn("Invalid property",t,"set to",n,"Missing plugin? gsap.registerPlugin()")},va=function(t,n){return!n&&console.warn(t)},Bk=function(t,n){return t&&(fn[t]=n)&&Iu&&(Iu[t]=n)||fn},xa=function(){return 0},d2={suppressEvents:!0,isStart:!0,kill:!1},Fl={suppressEvents:!0,kill:!1},f2={suppressEvents:!0},Fp={},es=[],Uf={},$k,tn={},ld={},Yy=30,Bl=[],Bp="",$p=function(t){var n=t[0],r,s;if(cr(n)||Xe(n)||(t=[t]),!(r=(n._gsap||{}).harness)){for(s=Bl.length;s--&&!Bl[s].targetTest(n););r=Bl[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new uS(t[s],r)))||t.splice(s,1);return t},js=function(t){return t._gsap||$p(Sn(t))[0]._gsap},Uk=function(t,n,r){return(r=t[n])&&Xe(r)?t[n]():Dp(r)&&t.getAttribute&&t.getAttribute(n)||r},qt=function(t,n){return(t=t.split(",")).forEach(n)||t},Ze=function(t){return Math.round(t*1e5)/1e5||0},Ve=function(t){return Math.round(t*1e7)/1e7||0},Ai=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},h2=function(t,n){for(var r=n.length,s=0;t.indexOf(n[s])<0&&++s<r;);return s<r},Ru=function(){var t=es.length,n=es.slice(0),r,s;for(Uf={},es.length=0,r=0;r<t;r++)s=n[r],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Up=function(t){return!!(t._initted||t._startAt||t.add)},Vk=function(t,n,r,s){es.length&&!wt&&Ru(),t.render(n,r,!!(wt&&n<0&&Up(t))),es.length&&!wt&&Ru()},Hk=function(t){var n=parseFloat(t);return(n||n===0)&&(t+"").match(u2).length<2?n:pt(t)?t.trim():t},Wk=function(t){return t},hn=function(t,n){for(var r in n)r in t||(t[r]=n[r]);return t},p2=function(t){return function(n,r){for(var s in r)s in n||s==="duration"&&t||s==="ease"||(n[s]=r[s])}},Ki=function(t,n){for(var r in n)t[r]=n[r];return t},Qy=function e(t,n){for(var r in n)r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&(t[r]=cr(n[r])?e(t[r]||(t[r]={}),n[r]):n[r]);return t},Pu=function(t,n){var r={},s;for(s in t)s in n||(r[s]=t[s]);return r},Vo=function(t){var n=t.parent||We,r=t.keyframes?p2(It(t.keyframes)):hn;if(Kt(t.inherit))for(;n;)r(t,n.vars.defaults),n=n.parent||n._dp;return t},m2=function(t,n){for(var r=t.length,s=r===n.length;s&&r--&&t[r]===n[r];);return r<0},Kk=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},fc=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},os=function(t,n){t.parent&&(!n||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},As=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},g2=function(t){for(var n=t.parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return t},Vf=function(t,n,r,s){return t._startAt&&(wt?t._startAt.revert(Fl):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(n,!0,s))},y2=function e(t){return!t||t._ts&&e(t.parent)},Xy=function(t){return t._repeat?qi(t._tTime,t=t.duration()+t._rDelay)*t:0},qi=function(t,n){var r=Math.floor(t=Ve(t/n));return t&&r===t?r-1:r},ju=function(t,n){return(t-n._start)*n._ts+(n._ts>=0?0:n._dirty?n.totalDuration():n._tDur)},hc=function(t){return t._end=Ve(t._start+(t._tDur/Math.abs(t._ts||t._rts||Re)||0))},pc=function(t,n){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=Ve(r._time-(t._ts>0?n/t._ts:((t._dirty?t.totalDuration():t._tDur)-n)/-t._ts)),hc(t),r._dirty||As(r,t)),t},qk=function(t,n){var r;if((n._time||!n._dur&&n._initted||n._start<t._time&&(n._dur||!n.add))&&(r=ju(t.rawTime(),n),(!n._dur||La(0,n.totalDuration(),r)-n._tTime>Re)&&n.render(r,!0)),As(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=-Re}},tr=function(t,n,r,s){return n.parent&&os(n),n._start=Ve((Er(r)?r:r||t!==We?vn(t,r,n):t._time)+n._delay),n._end=Ve(n._start+(n.totalDuration()/Math.abs(n.timeScale())||0)),Kk(t,n,"_first","_last",t._sort?"_start":0),Hf(n)||(t._recent=n),s||qk(t,n),t._ts<0&&pc(t,t._tTime),t},Gk=function(t,n){return(fn.ScrollTrigger||zp("scrollTrigger",n))&&fn.ScrollTrigger.create(n,t)},Yk=function(t,n,r,s,i){if(Hp(t,n,i),!t._initted)return 1;if(!r&&t._pt&&!wt&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&$k!==nn.frame)return es.push(t),t._lazy=[i,s],1},v2=function e(t){var n=t.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||e(n))},Hf=function(t){var n=t.data;return n==="isFromStart"||n==="isStart"},x2=function(t,n,r,s){var i=t.ratio,o=n<0||!n&&(!t._start&&v2(t)&&!(!t._initted&&Hf(t))||(t._ts<0||t._dp._ts<0)&&!Hf(t))?0:1,a=t._rDelay,l=0,u,c,f;if(a&&t._repeat&&(l=La(0,t._tDur,n),c=qi(l,a),t._yoyo&&c&1&&(o=1-o),c!==qi(t._tTime,a)&&(i=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==i||wt||s||t._zTime===Re||!n&&t._zTime){if(!t._initted&&Yk(t,n,s,r,l))return;for(f=t._zTime,t._zTime=n||(r?Re: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&&Vf(t,n,r,!0),t._onUpdate&&!r&&sn(t,"onUpdate"),l&&t._repeat&&!r&&t.parent&&sn(t,"onRepeat"),(n>=t._tDur||n<0)&&t.ratio===o&&(o&&os(t,1),!r&&!wt&&(sn(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=n)},w2=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}},Gi=function(t,n,r,s){var i=t._repeat,o=Ve(n)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=i?i<0?1e10:Ve(o*(i+1)+t._rDelay*i):o,a>0&&!s&&pc(t,t._tTime=t._tDur*a),t.parent&&hc(t),r||As(t.parent,t),t},Jy=function(t){return t instanceof Bt?As(t):Gi(t,t._dur)},_2={_start:0,endTime:xa,totalDuration:xa},vn=function e(t,n,r){var s=t.labels,i=t._recent||_2,o=t.duration()>=kn?i.endTime(!1):t._dur,a,l,u;return pt(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*(It(r)?r[0]:r).totalDuration()),a>1?e(t,n.substr(0,a-1),r)+l:o+l)):n==null?o:+n},Ho=function(t,n,r){var s=Er(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=Kt(l.vars.inherit)&&l.parent;o.immediateRender=Kt(a.immediateRender),t<2?o.runBackwards=1:o.startAt=n[i-1]}return new it(n[0],o,n[i+1])},fs=function(t,n){return t||t===0?n(t):n},La=function(t,n,r){return r<t?t:r>n?n:r},Et=function(t,n){return!pt(t)||!(n=c2.exec(t))?"":n[1]},b2=function(t,n,r){return fs(r,function(s){return La(t,n,s)})},Wf=[].slice,Qk=function(t,n){return t&&cr(t)&&"length"in t&&(!n&&!t.length||t.length-1 in t&&cr(t[0]))&&!t.nodeType&&t!==Zn},k2=function(t,n,r){return r===void 0&&(r=[]),t.forEach(function(s){var i;return pt(s)&&!n||Qk(s,1)?(i=r).push.apply(i,Sn(s)):r.push(s)})||r},Sn=function(t,n,r){return $e&&!n&&$e.selector?$e.selector(t):pt(t)&&!r&&($f||!Yi())?Wf.call((n||Op).querySelectorAll(t),0):It(t)?k2(t,r):Qk(t)?Wf.call(t,0):t?[t]:[]},Kf=function(t){return t=Sn(t)[0]||va("Invalid scope")||{},function(n){var r=t.current||t.nativeElement||t;return Sn(n,r.querySelectorAll?r:r===t?va("Invalid scope")||Op.createElement("div"):t)}},Xk=function(t){return t.sort(function(){return .5-Math.random()})},Jk=function(t){if(Xe(t))return t;var n=cr(t)?t:{each:t},r=Ns(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 pt(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,_=o[y],v,x,w,C,k,S,T,I,P;if(!_){if(P=n.grid==="auto"?0:(n.grid||[1,kn])[1],!P){for(T=-kn;T<(T=g[P++].getBoundingClientRect().left)&&P<y;);P<y&&P--}for(_=o[y]=[],v=l?Math.min(P,y)*c-.5:s%P,x=P===kn?0:l?y*f/P-.5:s/P|0,T=0,I=kn,S=0;S<y;S++)w=S%P-v,C=x-(S/P|0),_[S]=k=u?Math.abs(u==="y"?C:w):Mk(w*w+C*C),k>T&&(T=k),k<I&&(I=k);s==="random"&&Xk(_),_.max=T-I,_.min=I,_.v=y=(parseFloat(n.amount)||parseFloat(n.each)*(P>y?y-1:u?u==="y"?y/P:P:Math.max(P,y/P))||0)*(s==="edges"?-1:1),_.b=y<0?i-y:i,_.u=Et(n.amount||n.each)||0,r=r&&y<0?L2(r):r}return y=(_[h]-_.min)/_.max||0,Ve(_.b+(r?r(y):y)*_.v)+_.u}},qf=function(t){var n=Math.pow(10,((t+"").split(".")[1]||"").length);return function(r){var s=Ve(Math.round(parseFloat(r)/t)*t*n);return(s-s%1)/n+(Er(r)?0:Et(r))}},Zk=function(t,n){var r=It(t),s,i;return!r&&cr(t)&&(s=r=t.radius||kn,t.values?(t=Sn(t.values),(i=!Er(t[0]))&&(s*=s)):t=qf(t.increment)),fs(n,r?Xe(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=kn,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||Er(o)?c:c+Et(o)}:qf(t))},eS=function(t,n,r,s){return fs(It(t)?!n:r===!0?!!(r=0):!s,function(){return It(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})},S2=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)}},C2=function(t,n){return function(r){return t(parseFloat(r))+(n||Et(r))}},E2=function(t,n,r){return nS(t,n,0,1,r)},tS=function(t,n,r){return fs(r,function(s){return t[~~n(s)]})},T2=function e(t,n,r){var s=n-t;return It(t)?tS(t,e(0,t.length),n):fs(r,function(i){return(s+(i-t)%s)%s+t})},I2=function e(t,n,r){var s=n-t,i=s*2;return It(t)?tS(t,e(0,t.length-1),n):fs(r,function(o){return o=(i+(o-t)%i)%i||0,t+(o>s?i-o:o)})},wa=function(t){return t.replace(a2,function(n){var r=n.indexOf("[")+1,s=n.substring(r||7,r?n.indexOf("]"):n.length-1).split(l2);return eS(r?s:+s[0],r?0:+s[1],+s[2]||1e-5)})},nS=function(t,n,r,s,i){var o=n-t,a=s-r;return fs(i,function(l){return r+((l-t)/o*a||0)})},R2=function e(t,n,r,s){var i=isNaN(t+n)?0:function(p){return(1-p)*t+p*n};if(!i){var o=pt(t),a={},l,u,c,f,h;if(r===!0&&(s=1)&&(r=null),o)t={p:t},n={p:n};else if(It(t)&&!It(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=Ki(It(t)?[]:{},t));if(!c){for(l in n)Vp.call(a,t,l,"get",n[l]);i=function(g){return qp(g,a)||(o?t.p:t)}}}return fs(r,i)},Zy=function(t,n,r){var s=t.labels,i=kn,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},sn=function(t,n,r){var s=t.vars,i=s[n],o=$e,a=t._ctx,l,u,c;if(i)return l=s[n+"Params"],u=s.callbackScope||t,r&&es.length&&Ru(),a&&($e=a),c=l?i.apply(u,l):i.call(u),$e=o,c},To=function(t){return os(t),t.scrollTrigger&&t.scrollTrigger.kill(!!wt),t.progress()<1&&sn(t,"onInterrupt"),t},ki,rS=[],sS=function(t){if(t)if(t=!t.name&&t.default||t,Lp()||t.headless){var n=t.name,r=Xe(t),s=n&&!r&&t.init?function(){this._props=[]}:t,i={init:xa,render:qp,add:Vp,kill:K2,modifier:W2,rawVars:0},o={targetTest:0,get:0,getSetter:Kp,aliases:{},register:0};if(Yi(),t!==s){if(tn[n])return;hn(s,hn(Pu(t,i),o)),Ki(s.prototype,Ki(i,Pu(t,o))),tn[s.prop=n]=s,t.targetTest&&(Bl.push(s),Fp[n]=1),n=(n==="css"?"CSS":n.charAt(0).toUpperCase()+n.substr(1))+"Plugin"}Bk(n,s),t.register&&t.register(Qt,s,Gt)}else rS.push(t)},Te=255,Io={aqua:[0,Te,Te],lime:[0,Te,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Te],navy:[0,0,128],white:[Te,Te,Te],olive:[128,128,0],yellow:[Te,Te,0],orange:[Te,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Te,0,0],pink:[Te,192,203],cyan:[0,Te,Te],transparent:[Te,Te,Te,0]},ud=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)*Te+.5|0},iS=function(t,n,r){var s=t?Er(t)?[t>>16,t>>8&Te,t&Te]:0:Io.black,i,o,a,l,u,c,f,h,p,g;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),Io[t])s=Io[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&Te,s&Te,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Te,t&Te]}else if(t.substr(0,3)==="hsl"){if(s=g=t.match(Gy),!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]=ud(l+1/3,i,o),s[1]=ud(l,i,o),s[2]=ud(l-1/3,i,o);else if(~t.indexOf("="))return s=t.match(Lk),r&&s.length<4&&(s[3]=1),s}else s=t.match(Gy)||Io.transparent;s=s.map(Number)}return n&&!g&&(i=s[0]/Te,o=s[1]/Te,a=s[2]/Te,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},oS=function(t){var n=[],r=[],s=-1;return t.split(ts).forEach(function(i){var o=i.match(bi)||[];n.push.apply(n,o),r.push(s+=o.length+1)}),n.c=r,n},ev=function(t,n,r){var s="",i=(t+s).match(ts),o=n?"hsla(":"rgba(",a=0,l,u,c,f;if(!i)return t;if(i=i.map(function(h){return(h=iS(h,n,1))&&o+(n?h[0]+","+h[1]+"%,"+h[2]+"%,"+h[3]:h.join(","))+")"}),r&&(c=oS(t),l=r.c,l.join(s)!==c.c.join(s)))for(u=t.replace(ts,"1").split(bi),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(ts),f=u.length-1;a<f;a++)s+=u[a]+i[a];return s+u[f]},ts=function(){var e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in Io)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),P2=/hsl[a]?\(/,aS=function(t){var n=t.join(" "),r;if(ts.lastIndex=0,ts.test(n))return r=P2.test(n),t[1]=ev(t[1],r),t[0]=ev(t[0],r,oS(t[1])),!0},_a,nn=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(_){var v=e()-s,x=_===!0,w,C,k,S;if((v>t||v<0)&&(r+=v-n),s+=v,k=s-r,w=k-o,(w>0||x)&&(S=++f.frame,h=k-f.time*1e3,f.time=k=k/1e3,o+=w+(w>=i?4:i-w),C=1),x||(l=u(y)),C)for(p=0;p<a.length;p++)a[p](k,h,S,_)};return f={time:0,frame:0,tick:function(){g(!0)},deltaRatio:function(_){return h/(1e3/(_||60))},wake:function(){zk&&(!$f&&Lp()&&(Zn=$f=window,Op=Zn.document||{},fn.gsap=Qt,(Zn.gsapVersions||(Zn.gsapVersions=[])).push(Qt.version),Fk(Iu||Zn.GreenSockGlobals||!Zn.gsap&&Zn||{}),rS.forEach(sS)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,l&&f.sleep(),u=c||function(_){return setTimeout(_,o-f.time*1e3+1|0)},_a=1,g(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(l),_a=0,u=xa},lagSmoothing:function(_,v){t=_||1/0,n=Math.min(v||33,t)},fps:function(_){i=1e3/(_||240),o=f.time*1e3+i},add:function(_,v,x){var w=v?function(C,k,S,T){_(C,k,S,T),f.remove(w)}:_;return f.remove(_),a[x?"unshift":"push"](w),Yi(),w},remove:function(_,v){~(v=a.indexOf(_))&&a.splice(v,1)&&p>=v&&p--},_listeners:a},f}(),Yi=function(){return!_a&&nn.wake()},xe={},j2=/^[\d.\-M][\d.\-,\s]/,A2=/["']/g,N2=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(A2,"").trim():+u,s=l.substr(a+1).trim();return n},M2=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)},D2=function(t){var n=(t+"").split("("),r=xe[n[0]];return r&&n.length>1&&r.config?r.config.apply(null,~t.indexOf("{")?[N2(n[1])]:M2(t).split(",").map(Hk)):xe._CE&&j2.test(t)?xe._CE("",t):r},L2=function(t){return function(n){return 1-t(1-n)}},Ns=function(t,n){return t&&(Xe(t)?t:xe[t]||D2(t))||n},Xs=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 qt(t,function(a){xe[a]=fn[a]=i,xe[o=a.toLowerCase()]=r;for(var l in i)xe[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=xe[a+"."+l]=i[l]}),i},lS=function(t){return function(n){return n<.5?(1-t(1-n*2))/2:.5+t((n-.5)*2)/2}},cd=function e(t,n,r){var s=n>=1?n:1,i=(r||(t?.3:.45))/(n<1?n:1),o=i/Bf*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*o2((c-o)*i)+1},l=t==="out"?a:t==="in"?function(u){return 1-a(1-u)}:lS(a);return i=Bf/i,l.config=function(u,c){return e(t,u,c)},l},dd=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)}:lS(r);return s.config=function(i){return e(t,i)},s};qt("Linear,Quad,Cubic,Quart,Quint,Strong",function(e,t){var n=t<5?t+1:t;Xs(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})});xe.Linear.easeNone=xe.none=xe.Linear.easeIn;Xs("Elastic",cd("in"),cd("out"),cd());(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};Xs("Bounce",function(o){return 1-i(1-o)},i)})(7.5625,2.75);Xs("Expo",function(e){return Math.pow(2,10*(e-1))*e+e*e*e*e*e*e*(1-e)});Xs("Circ",function(e){return-(Mk(1-e*e)-1)});Xs("Sine",function(e){return e===1?1:-i2(e*r2)+1});Xs("Back",dd("in"),dd("out"),dd());xe.SteppedEase=xe.steps=fn.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-Re;return function(a){return((s*La(0,o,a)|0)+i)*r}}};ya.ease=xe["quad.out"];qt("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(e){return Bp+=e+","+e+"Params,"});var uS=function(t,n){this.id=s2++,t._gsap=this,this.target=t,this.harness=n,this.get=n?n.get:Uk,this.set=n?n.getSetter:Kp},ba=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,Gi(this,+n.duration,1,1),this.data=n.data,$e&&(this._ctx=$e,$e.data.push(this)),_a||nn.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,Gi(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(r,s){if(Yi(),!arguments.length)return this._tTime;var i=this._dp;if(i&&i.smoothChildTiming&&this._ts){for(pc(this,r),!i._dp||i.parent||qk(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)&&tr(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Re||!this._initted&&this._dur&&r||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),Vk(this,r,s)),this},t.time=function(r,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+Xy(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)+Xy(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?qi(this._tTime,i)+1:1},t.timeScale=function(r,s){if(!arguments.length)return this._rts===-Re?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?ju(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-Re?0:this._rts,this.totalTime(La(-Math.abs(this._delay),this.totalDuration(),i),s!==!1),hc(this),g2(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):(Yi(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Re&&(this._tTime-=Re)))),this):this._ps},t.startTime=function(r){if(arguments.length){this._start=Ve(r);var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&tr(s,this,this._start-this._delay),this}return this._start},t.endTime=function(r){return this._start+(Kt(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?ju(s.rawTime(r),this):this._tTime:this._tTime},t.revert=function(r){r===void 0&&(r=f2);var s=wt;return wt=r,Up(this)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),wt=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,Jy(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(r){if(arguments.length){var s=this._time;return this._rDelay=r,Jy(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(vn(this,r),Kt(s))},t.restart=function(r,s){return this.play().totalTime(r?-this._delay:0,Kt(s)),this._dur||(this._zTime=-Re),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?-Re:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Re,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)-Re)},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=Xe(r)?r:Wk,l=function(){var c=s.then;s.then=null,i&&i(),Xe(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(){To(this)},e}();hn(ba.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:-Re,_prom:0,_ps:!1,_rts:1});var Bt=function(e){Nk(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=Kt(r.sortChildren),We&&tr(r.parent||We,mr(i),s),r.reversed&&i.reverse(),r.paused&&i.paused(!0),r.scrollTrigger&&Gk(mr(i),r.scrollTrigger),i}var n=t.prototype;return n.to=function(s,i,o){return Ho(0,arguments,this),this},n.from=function(s,i,o){return Ho(1,arguments,this),this},n.fromTo=function(s,i,o,a){return Ho(2,arguments,this),this},n.set=function(s,i,o){return i.duration=0,i.parent=this,Vo(i).repeatDelay||(i.repeat=0),i.immediateRender=!!i.immediateRender,new it(s,i,vn(this,o),1),this},n.call=function(s,i,o){return tr(this,it.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 it(s,o,vn(this,l)),this},n.staggerFrom=function(s,i,o,a,l,u,c){return o.runBackwards=1,Vo(o).immediateRender=Kt(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,Vo(a).immediateRender=Kt(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:Ve(s),f=this._zTime<0!=s<0&&(this._initted||!u),h,p,g,y,_,v,x,w,C,k,S,T;if(this!==We&&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,C=this._start,w=this._ts,v=!w,f&&(u||(a=this._zTime),(s||!i)&&(this._zTime=s)),this._repeat){if(S=this._yoyo,_=u+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(_*100+s,i,o);if(h=Ve(c%_),c===l?(y=this._repeat,h=u):(k=Ve(c/_),y=~~k,y&&y===k&&(h=u,y--),h>u&&(h=u)),k=qi(this._tTime,_),!a&&this._tTime&&k!==y&&this._tTime-k*_-this._dur<=0&&(k=y),S&&y&1&&(h=u-h,T=1),y!==k&&!this._lock){var I=S&&k&1,P=I===(S&&y&1);if(y<k&&(I=!I),a=I?0:c%u?u:c,this._lock=1,this.render(a||(T?0:Ve(y*_)),i,!u)._lock=0,this._tTime=c,!i&&this.parent&&sn(this,"onRepeat"),this.vars.repeatRefresh&&!T&&(this.invalidate()._lock=1,k=y),a&&a!==this._time||v!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(u=this._dur,l=this._tDur,P&&(this._lock=2,a=I?u:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!T&&this.invalidate()),this._lock=0,!this._ts&&!v)return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=w2(this,Ve(a),Ve(h)),x&&(c-=h-(h=x._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&&!k&&(sn(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&&x!==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&&!v){x=0,g&&(c+=this._zTime=-Re);break}}p=g}else{p=this._last;for(var E=s<0?s:h;p;){if(g=p._prev,(p._act||E<=p._end)&&p._ts&&x!==p){if(p.parent!==this)return this.render(s,i,o);if(p.render(p._ts>0?(E-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(E-p._start)*p._ts,i,o||wt&&Up(p)),h!==this._time||!this._ts&&!v){x=0,g&&(c+=this._zTime=E?-Re:Re);break}}p=g}}if(x&&!i&&(this.pause(),x.render(h>=a?0:-Re)._zTime=h>=a?1:-1,this._ts))return this._start=C,hc(this),this.render(s,i,o);this._onUpdate&&!i&&sn(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(C===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((s||!u)&&(c===l&&this._ts>0||!c&&this._ts<0)&&os(this,1),!i&&!(s<0&&!a)&&(c||a||!l)&&(sn(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(Er(i)||(i=vn(this,i,s)),!(s instanceof ba)){if(It(s))return s.forEach(function(a){return o.add(a,i)}),this;if(pt(s))return this.addLabel(s,i);if(Xe(s))s=it.delayedCall(0,s);else return this}return this!==s?tr(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=-kn);for(var l=[],u=this._first;u;)u._start>=a&&(u instanceof it?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 pt(s)?this.removeLabel(s):Xe(s)?this.killTweensOf(s):(s.parent===this&&fc(this,s),s===this._recent&&(this._recent=this._last),As(this))},n.totalTime=function(s,i){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Ve(nn.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]=vn(this,i),this},n.removeLabel=function(s){return delete this.labels[s],this},n.addPause=function(s,i,o){var a=it.delayedCall(0,i||xa,o);return a.data="isPause",this._hasPause=1,tr(this,a,vn(this,s))},n.removePause=function(s){var i=this._first;for(s=vn(this,s);i;)i._start===s&&i.data==="isPause"&&os(i),i=i._next},n.killTweensOf=function(s,i,o){for(var a=this.getTweensOf(s,o),l=a.length;l--;)Ur!==a[l]&&a[l].kill(s,i);return this},n.getTweensOf=function(s,i){for(var o=[],a=Sn(s),l=this._first,u=Er(i),c;l;)l instanceof it?h2(l._targets,a)&&(u?(!Ur||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=vn(o,s),l=i,u=l.startAt,c=l.onStart,f=l.onStartParams,h=l.immediateRender,p,g=it.to(o,hn({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())||Re,onStart:function(){if(o.pause(),!p){var _=i.duration||Math.abs((a-(u&&"time"in u?u.time:o._time))/o.timeScale());g._dur!==_&&Gi(g,_,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,hn({startAt:{time:vn(this,s)}},o))},n.recent=function(){return this._recent},n.nextLabel=function(s){return s===void 0&&(s=this._time),Zy(this,vn(this,s))},n.previousLabel=function(s){return s===void 0&&(s=this._time),Zy(this,vn(this,s),1)},n.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Re)},n.shiftChildren=function(s,i,o){o===void 0&&(o=0);var a=this._first,l=this.labels,u;for(s=Ve(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 As(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={}),As(this)},n.totalDuration=function(s){var i=0,o=this,a=o._last,l=kn,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,tr(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(i-=c,(!f&&!o._dp||f&&f.smoothChildTiming)&&(o._start+=Ve(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;Gi(o,o===We&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(We._ts&&(Vk(We,ju(s,We)),$k=nn.frame),nn.frame>=Yy){Yy+=ln.autoSleep||120;var i=We._first;if((!i||!i._ts)&&ln.autoSleep&&nn._listeners.length<2){for(;i&&!i._ts;)i=i._next;i||nn.sleep()}}},t}(ba);hn(Bt.prototype,{_lock:0,_hasPause:0,_forcing:0});var O2=function(t,n,r,s,i,o,a){var l=new Gt(this._pt,t,n,0,1,mS,null,i),u=0,c=0,f,h,p,g,y,_,v,x;for(l.b=r,l.e=s,r+="",s+="",(v=~s.indexOf("random("))&&(s=wa(s)),o&&(x=[r,s],o(x,t,n),r=x[0],s=x[1]),h=r.match(ad)||[];f=ad.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++]&&(_=parseFloat(h[c-1])||0,l._pt={_next:l._pt,p:y||c===1?y:",",s:_,c:g.charAt(1)==="="?Ai(_,g)-_:parseFloat(g)-_,m:p&&p<4?Math.round:0},u=ad.lastIndex);return l.c=u<s.length?s.substring(u,s.length):"",l.fp=a,(Ok.test(s)||v)&&(l.e=0),this._pt=l,l},Vp=function(t,n,r,s,i,o,a,l,u,c){Xe(s)&&(s=s(i||0,t,o));var f=t[n],h=r!=="get"?r:Xe(f)?u?t[n.indexOf("set")||!Xe(t["get"+n.substr(3)])?n:"get"+n.substr(3)](u):t[n]():f,p=Xe(f)?u?U2:hS:Wp,g;if(pt(s)&&(~s.indexOf("random(")&&(s=wa(s)),s.charAt(1)==="="&&(g=Ai(h,s)+(Et(h)||0),(g||g===0)&&(s=g))),!c||h!==s||Gf)return!isNaN(h*s)&&s!==""?(g=new Gt(this._pt,t,n,+h||0,s-(h||0),typeof f=="boolean"?H2:pS,0,p),u&&(g.fp=u),a&&g.modifier(a,this,t),this._pt=g):(!f&&!(n in t)&&zp(n,s),O2.call(this,t,n,h,s,p,l||ln.stringFilter,u))},z2=function(t,n,r,s,i){if(Xe(t)&&(t=Wo(t,i,n,r,s)),!cr(t)||t.style&&t.nodeType||It(t)||Dk(t))return pt(t)?Wo(t,i,n,r,s):t;var o={},a;for(a in t)o[a]=Wo(t[a],i,n,r,s);return o},cS=function(t,n,r,s,i,o){var a,l,u,c;if(tn[t]&&(a=new tn[t]).init(i,a.rawVars?n[t]:z2(n[t],s,i,o,r),r,s,o)!==!1&&(r._pt=l=new Gt(r._pt,i,t,0,1,a.render,a,0,a.priority),r!==ki))for(u=r._ptLookup[r._targets.indexOf(i)],c=a._props.length;c--;)u[a._props[c]]=l;return a},Ur,Gf,Hp=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,_=t._targets,v=t.parent,x=v&&v.data==="nested"?v.vars.targets:_,w=t._overwrite==="auto"&&!Mp,C=t.timeline,k=s.easeReverse||f,S,T,I,P,E,D,M,B,Q,U,te,Z,F;if(C&&(!h||!i)&&(i="none"),t._ease=Ns(i,ya.ease),t._rEase=k&&(Ns(k)||t._ease),t._from=!C&&!!s.runBackwards,t._from&&(t.ratio=1),!C||h&&!s.stagger){if(B=_[0]?js(_[0]).harness:0,Z=B&&s[B.prop],S=Pu(s,Fp),y&&(y._zTime<0&&y.progress(1),n<0&&c&&a&&!p?y.render(-1,!0):y.revert(c&&g?Fl:d2),y._lazy=0),o){if(os(t._startAt=it.set(_,hn({data:"isStart",overwrite:!1,parent:v,immediateRender:!0,lazy:!y&&Kt(l),startAt:null,delay:0,onUpdate:u&&function(){return sn(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,n<0&&(wt||!a&&!p)&&t._startAt.revert(Fl),a&&g&&n<=0&&r<=0){n&&(t._zTime=n);return}}else if(c&&g&&!y){if(n&&(a=!1),I=hn({overwrite:!1,data:"isFromStart",lazy:a&&!y&&Kt(l),immediateRender:a,stagger:0,parent:v},S),Z&&(I[B.prop]=Z),os(t._startAt=it.set(_,I)),t._startAt._dp=0,t._startAt._sat=t,n<0&&(wt?t._startAt.revert(Fl):t._startAt.render(-1,!0)),t._zTime=n,!a)e(t._startAt,Re,Re);else if(!n)return}for(t._pt=t._ptCache=0,l=g&&Kt(l)||l&&!g,T=0;T<_.length;T++){if(E=_[T],M=E._gsap||$p(_)[T]._gsap,t._ptLookup[T]=U={},Uf[M.id]&&es.length&&Ru(),te=x===_?T:x.indexOf(E),B&&(Q=new B).init(E,Z||S,t,te,x)!==!1&&(t._pt=P=new Gt(t._pt,E,Q.name,0,1,Q.render,Q,0,Q.priority),Q._props.forEach(function(z){U[z]=P}),Q.priority&&(D=1)),!B||Z)for(I in S)tn[I]&&(Q=cS(I,S,t,te,E,x))?Q.priority&&(D=1):U[I]=P=Vp.call(t,E,I,"get",S[I],te,x,0,s.stringFilter);t._op&&t._op[T]&&t.kill(E,t._op[T]),w&&t._pt&&(Ur=t,We.killTweensOf(E,U,t.globalTime(n)),F=!t.parent,Ur=0),t._pt&&l&&(Uf[M.id]=1)}D&&gS(t),t._onInit&&t._onInit(t)}t._onUpdate=u,t._initted=(!t._op||t._pt)&&!F,h&&n<=0&&C.render(kn,!0,!0)},F2=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 Gf=1,t.vars[n]="+=0",Hp(t,a),Gf=0,l?va(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=Ze(r)+Et(f.e)),f.b&&(f.b=c.s+Et(f.b))},B2=function(t,n){var r=t[0]?js(t[0]).harness:0,s=r&&r.aliases,i,o,a,l;if(!s)return n;i=Ki({},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},$2=function(t,n,r,s){var i=n.ease||s||"power1.inOut",o,a;if(It(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})},Wo=function(t,n,r,s,i){return Xe(t)?t.call(n,r,s,i):pt(t)&&~t.indexOf("random(")?wa(t):t},dS=Bp+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",fS={};qt(dS+",id,stagger,delay,duration,paused,scrollTrigger",function(e){return fS[e]=1});var it=function(e){Nk(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:Vo(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,_=l.scrollTrigger,v=s.parent||We,x=(It(r)||Dk(r)?Er(r[0]):"length"in s)?[r]:Sn(r),w,C,k,S,T,I,P,E;if(a._targets=x.length?$p(x):va("GSAP target "+r+" not found. https://gsap.com",!ln.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=p,g||h||gl(u)||gl(c)){s=a.vars;var D=s.easeReverse||s.yoyoEase;if(w=a.timeline=new Bt({data:"nested",defaults:y||{},targets:v&&v.data==="nested"?v.vars.targets:x}),w.kill(),w.parent=w._dp=mr(a),w._start=0,h||gl(u)||gl(c)){if(S=x.length,P=h&&Jk(h),cr(h))for(T in h)~dS.indexOf(T)&&(E||(E={}),E[T]=h[T]);for(C=0;C<S;C++)k=Pu(s,fS),k.stagger=0,D&&(k.easeReverse=D),E&&Ki(k,E),I=x[C],k.duration=+Wo(u,mr(a),C,I,x),k.delay=(+Wo(c,mr(a),C,I,x)||0)-a._delay,!h&&S===1&&k.delay&&(a._delay=c=k.delay,a._start+=c,k.delay=0),w.to(I,k,P?P(C,I,x):0),w._ease=xe.none;w.duration()?u=c=0:a.timeline=0}else if(g){Vo(hn(w.vars.defaults,{ease:"none"})),w._ease=Ns(g.ease||s.ease||"none");var M=0,B,Q,U;if(It(g))g.forEach(function(te){return w.to(x,te,">")}),w.duration();else{k={};for(T in g)T==="ease"||T==="easeEach"||$2(T,g[T],k,g.easeEach);for(T in k)for(B=k[T].sort(function(te,Z){return te.t-Z.t}),M=0,C=0;C<B.length;C++)Q=B[C],U={ease:Q.e,duration:(Q.t-(C?B[C-1].t:0))/100*u},U[T]=Q.v,w.to(x,U,M),M+=U.duration;w.duration()<u&&w.to({},{duration:u-w.duration()})}}u||a.duration(u=w.duration())}else a.timeline=0;return p===!0&&!Mp&&(Ur=mr(a),We.killTweensOf(x),Ur=0),tr(v,mr(a),i),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(f||!u&&!g&&a._start===Ve(v._time)&&Kt(f)&&y2(mr(a))&&v.data!=="nested")&&(a._tTime=-Re,a.render(Math.max(0,-c)||0)),_&&Gk(mr(a),_),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-Re&&!c?l:s<Re?0:s,h,p,g,y,_,v,x,w;if(!u)x2(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=Ve(f%y),f===l?(g=this._repeat,h=u):(_=Ve(f/y),g=~~_,g&&g===_?(h=u,g--):h>u&&(h=u)),v=this._yoyo&&g&1,v&&(h=u-h),_=qi(this._tTime,y),h===a&&!o&&this._initted&&g===_)return this._tTime=f,this;g!==_&&this.vars.repeatRefresh&&!v&&!this._lock&&h!==y&&this._initted&&(this._lock=o=1,this.render(Ve(y*g),!0).invalidate()._lock=0)}if(!this._initted){if(Yk(this,c?s:h,o,i,f))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&g!==_))return this;if(u!==this._dur)return this.render(s,i,o)}if(this._rEase){var C=h<a;if(C!==this._inv){var k=C?a:u-a;this._inv=C,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=a,this._invRecip=k?(C?-1:1)/k:0,this._invScale=C?-this.ratio:1-this.ratio,this._invEase=C?this._rEase:this._ease}this.ratio=x=this._invRatio+this._invScale*this._invEase((h-this._invTime)*this._invRecip)}else this.ratio=x=this._ease(h/u);if(this._from&&(this.ratio=x=1-x),this._tTime=f,this._time=h,!this._act&&this._ts&&(this._act=1,this._lazy=0),!a&&f&&!i&&!_&&(sn(this,"onStart"),this._tTime!==f))return this;for(p=this._pt;p;)p.r(x,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&&Vf(this,s,i,o),sn(this,"onUpdate")),this._repeat&&g!==_&&this.vars.onRepeat&&!i&&this.parent&&sn(this,"onRepeat"),(f===this._tDur||!f)&&this._tTime===f&&(c&&!this._onUpdate&&Vf(this,s,!0,!0),(s||!u)&&(f===this._tDur&&this._ts>0||!f&&this._ts<0)&&os(this,1),!i&&!(c&&!a)&&(f||a||v)&&(sn(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){_a||nn.wake(),this._ts||this.play();var u=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Hp(this,u),c=this._ease(u/this._dur),F2(this,s,i,o,a,c,u,l)?this.resetTo(s,i,o,a,1):(pc(this,0),this.parent||Kk(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?To(this):this.scrollTrigger&&this.scrollTrigger.kill(!!wt),this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,i,Ur&&Ur.vars.overwrite!==!0)._first||To(this),this.parent&&o!==this.timeline.totalDuration()&&Gi(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=s?Sn(s):a,u=this._ptLookup,c=this._pt,f,h,p,g,y,_,v;if((!i||i==="all")&&m2(a,l))return i==="all"&&(this._pt=0),To(this);for(f=this._op=this._op||[],i!=="all"&&(pt(i)&&(y={},qt(i,function(x){return y[x]=1}),i=y),i=B2(a,i)),v=a.length;v--;)if(~l.indexOf(a[v])){h=u[v],i==="all"?(f[v]=i,g=h,p={}):(p=f[v]=f[v]||{},g=i);for(y in g)_=h&&h[y],_&&((!("kill"in _.d)||_.d.kill(y)===!0)&&fc(this,_,"_pt"),delete h[y]),p!=="all"&&(p[y]=1)}return this._initted&&!this._pt&&c&&To(this),this},t.to=function(s,i){return new t(s,i,arguments[2])},t.from=function(s,i){return Ho(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 Ho(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 We.killTweensOf(s,i,o)},t}(ba);hn(it.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});qt("staggerTo,staggerFrom,staggerFromTo",function(e){it[e]=function(){var t=new Bt,n=Wf.call(arguments,0);return n.splice(e==="staggerFromTo"?5:4,0,0),t[e].apply(t,n)}});var Wp=function(t,n,r){return t[n]=r},hS=function(t,n,r){return t[n](r)},U2=function(t,n,r,s){return t[n](s.fp,r)},V2=function(t,n,r){return t.setAttribute(n,r)},Kp=function(t,n){return Xe(t[n])?hS:Dp(t[n])&&t.setAttribute?V2:Wp},pS=function(t,n){return n.set(n.t,n.p,Math.round((n.s+n.c*t)*1e6)/1e6,n)},H2=function(t,n){return n.set(n.t,n.p,!!(n.s+n.c*t),n)},mS=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)},qp=function(t,n){for(var r=n._pt;r;)r.r(t,r.d),r=r._next},W2=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},K2=function(t){for(var n=this._pt,r,s;n;)s=n._next,n.p===t&&!n.op||n.op===t?fc(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)},gS=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},Gt=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||pS,this.d=l||this,this.set=u||Wp,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}();qt(Bp+"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 Fp[e]=1});fn.TweenMax=fn.TweenLite=it;fn.TimelineLite=fn.TimelineMax=Bt;We=new Bt({sortChildren:!1,defaults:ya,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});ln.stringFilter=aS;var Ms=[],$l={},G2=[],tv=0,Y2=0,fd=function(t){return($l[t]||G2).map(function(n){return n()})},Yf=function(){var t=Date.now(),n=[];t-tv>2&&(fd("matchMediaInit"),Ms.forEach(function(r){var s=r.queries,i=r.conditions,o,a,l,u;for(a in s)o=Zn.matchMedia(s[a]).matches,o&&(l=1),o!==i[a]&&(i[a]=o,u=1);u&&(r.revert(),l&&n.push(r))}),fd("matchMediaRevert"),n.forEach(function(r){return r.onMatch(r,function(s){return r.add(null,s)})}),tv=t,fd("matchMedia"))},yS=function(){function e(n,r){this.selector=r&&Kf(r),this.data=[],this._r=[],this.isReverted=!1,this.id=Y2++,n&&this.add(n)}var t=e.prototype;return t.add=function(r,s,i){Xe(r)&&(i=s,s=r,r=Xe);var o=this,a=function(){var u=$e,c=o.selector,f;return u&&u!==o&&u.data.push(o),i&&(o.selector=Kf(i)),$e=o,f=s.apply(o,arguments),Xe(f)&&o._r.push(f),$e=u,o.selector=c,o.isReverted=!1,f};return o.last=a,r===Xe?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},t.ignore=function(r){var s=$e;$e=null,r(this),$e=s},t.getTweens=function(){var r=[];return this.data.forEach(function(s){return s instanceof e?r.push.apply(r,s.getTweens()):s instanceof it&&!(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 Bt?u.data!=="nested"&&(u.scrollTrigger&&u.scrollTrigger.revert(),u.kill()):!(u instanceof it)&&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=Ms.length;o--;)Ms[o].id===this.id&&Ms.splice(o,1)},t.revert=function(r){this.kill(r||{})},e}(),Q2=function(){function e(n){this.contexts=[],this.scope=n,$e&&$e.data.push(this)}var t=e.prototype;return t.add=function(r,s,i){cr(r)||(r={matches:r});var o=new yS(0,i||this.scope),a=o.conditions={},l,u,c;$e&&!o.selector&&(o.selector=$e.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=r;for(u in r)u==="all"?c=1:(l=Zn.matchMedia(r[u]),l&&(Ms.indexOf(o)<0&&Ms.push(o),(a[u]=l.matches)&&(c=1),l.addListener?l.addListener(Yf):l.addEventListener("change",Yf)));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}(),Au={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 sS(s)})},timeline:function(t){return new Bt(t)},getTweensOf:function(t,n){return We.getTweensOf(t,n)},getProperty:function(t,n,r,s){pt(t)&&(t=Sn(t)[0]);var i=js(t||{}).get,o=r?Wk:Hk;return r==="native"&&(r=""),t&&(n?o((tn[n]&&tn[n].get||i)(t,n,r,s)):function(a,l,u){return o((tn[a]&&tn[a].get||i)(t,a,l,u))})},quickSetter:function(t,n,r){if(t=Sn(t),t.length>1){var s=t.map(function(c){return Qt.quickSetter(c,n,r)}),i=s.length;return function(c){for(var f=i;f--;)s[f](c)}}t=t[0]||{};var o=tn[n],a=js(t),l=a.harness&&(a.harness.aliases||{})[n]||n,u=o?function(c){var f=new o;ki._pt=0,f.init(t,r?c+r:c,ki,0,[t]),f.render(1,f),ki._pt&&qp(1,ki)}: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=Qt.to(t,hn((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 We.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Ns(t.ease,ya.ease)),Qy(ya,t||{})},config:function(t){return Qy(ln,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&&!tn[a]&&!fn[a]&&va(n+" effect requires "+a+" plugin.")}),ld[n]=function(a,l,u){return r(Sn(a),hn(l||{},i),u)},o&&(Bt.prototype[n]=function(a,l,u){return this.add(ld[n](a,cr(l)?l:(u=l)&&{},this),u)})},registerEase:function(t,n){xe[t]=Ns(n)},parseEase:function(t,n){return arguments.length?Ns(t,n):xe},getById:function(t){return We.getById(t)},exportRoot:function(t,n){t===void 0&&(t={});var r=new Bt(t),s,i;for(r.smoothChildTiming=Kt(t.smoothChildTiming),We.remove(r),r._dp=0,r._time=r._tTime=We._time,s=We._first;s;)i=s._next,(n||!(!s._dur&&s instanceof it&&s.vars.onComplete===s._targets[0]))&&tr(r,s,s._start-s._delay),s=i;return tr(We,r,0),r},context:function(t,n){return t?new yS(t,n):$e},matchMedia:function(t){return new Q2(t)},matchMediaRefresh:function(){return Ms.forEach(function(t){var n=t.conditions,r,s;for(s in n)n[s]&&(n[s]=!1,r=1);r&&t.revert()})||Yf()},addEventListener:function(t,n){var r=$l[t]||($l[t]=[]);~r.indexOf(n)||r.push(n)},removeEventListener:function(t,n){var r=$l[t],s=r&&r.indexOf(n);s>=0&&r.splice(s,1)},utils:{wrap:T2,wrapYoyo:I2,distribute:Jk,random:eS,snap:Zk,normalize:E2,getUnit:Et,clamp:b2,splitColor:iS,toArray:Sn,selector:Kf,mapRange:nS,pipe:S2,unitize:C2,interpolate:R2,shuffle:Xk},install:Fk,effects:ld,ticker:nn,updateRoot:Bt.updateRoot,plugins:tn,globalTimeline:We,core:{PropTween:Gt,globals:Bk,Tween:it,Timeline:Bt,Animation:ba,getCache:js,_removeLinkedListItem:fc,reverting:function(){return wt},context:function(t){return t&&$e&&($e.data.push(t),t._ctx=$e),$e},suppressOverwrites:function(t){return Mp=t}}};qt("to,from,fromTo,delayedCall,set,killTweensOf",function(e){return Au[e]=it[e]});nn.add(Bt.updateRoot);ki=Au.to({},{duration:0});var X2=function(t,n){for(var r=t._pt;r&&r.p!==n&&r.op!==n&&r.fp!==n;)r=r._next;return r},J2=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=X2(o,s)),o&&o.modifier&&o.modifier(n[s],t,r[i],s))},hd=function(t,n){return{name:t,headless:1,rawVars:1,init:function(s,i,o){o._onInit=function(a){var l,u;if(pt(i)&&(l={},qt(i,function(c){return l[c]=1}),i=l),n){l={};for(u in i)l[u]=n(i[u]);i=l}J2(a,i)}}}},Qt=Au.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;)wt?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)}},hd("roundProps",qf),hd("modifiers"),hd("snap",Zk))||Au;it.version=Bt.version=Qt.version="3.15.0";zk=1;Lp()&&Yi();xe.Power0;xe.Power1;xe.Power2;xe.Power3;xe.Power4;xe.Linear;xe.Quad;xe.Cubic;xe.Quart;xe.Quint;xe.Strong;xe.Elastic;xe.Back;xe.SteppedEase;xe.Bounce;xe.Sine;xe.Expo;xe.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 nv,Vr,Ni,Gp,Ts,rv,Yp,Z2=function(){return typeof window<"u"},Tr={},bs=180/Math.PI,Mi=Math.PI/180,oi=Math.atan2,sv=1e8,Qp=/([A-Z])/g,eD=/(left|right|width|margin|padding|x)/i,tD=/[\s,\(]\S/,rr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Qf=function(t,n){return n.set(n.t,n.p,Math.round((n.s+n.c*t)*1e4)/1e4+n.u,n)},nD=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)},rD=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)},sD=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)},iD=function(t,n){var r=n.s+n.c*t;n.set(n.t,n.p,~~(r+(r<0?-.5:.5))+n.u,n)},vS=function(t,n){return n.set(n.t,n.p,t?n.e:n.b,n)},xS=function(t,n){return n.set(n.t,n.p,t!==1?n.b:n.e,n)},oD=function(t,n,r){return t.style[n]=r},aD=function(t,n,r){return t.style.setProperty(n,r)},lD=function(t,n,r){return t._gsap[n]=r},uD=function(t,n,r){return t._gsap.scaleX=t._gsap.scaleY=r},cD=function(t,n,r,s,i){var o=t._gsap;o.scaleX=o.scaleY=r,o.renderTransform(i,o)},dD=function(t,n,r,s,i){var o=t._gsap;o[n]=r,o.renderTransform(i,o)},qe="transform",Yt=qe+"Origin",fD=function e(t,n){var r=this,s=this.target,i=s.style,o=s._gsap;if(t in Tr&&i){if(this.tfm=this.tfm||{},t!=="transform")t=rr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return r.tfm[a]=yr(s,a)}):this.tfm[t]=o.x?o[t]:yr(s,t),t===Yt&&(this.tfm.zOrigin=o.zOrigin);else return rr.transform.split(",").forEach(function(a){return e.call(r,a,n)});if(this.props.indexOf(qe)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Yt,n,"")),t=qe}(i||n)&&this.props.push(t,n,i[t])},wS=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},hD=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(Qp,"-$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=Yp(),(!i||!i.isStart)&&!r[qe]&&(wS(r),s.zOrigin&&r[Yt]&&(r[Yt]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},_S=function(t,n){var r={target:t,props:[],revert:hD,save:fD};return t._gsap||Qt.core.getCache(t),n&&t.style&&t.nodeType&&n.split(",").forEach(function(s){return r.save(s)}),r},bS,Xf=function(t,n){var r=Vr.createElementNS?Vr.createElementNS((n||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Vr.createElement(t);return r&&r.style?r:Vr.createElement(t)},on=function e(t,n,r){var s=getComputedStyle(t);return s[n]||s.getPropertyValue(n.replace(Qp,"-$1").toLowerCase())||s.getPropertyValue(n)||!r&&e(t,Qi(n)||n,1)||""},iv="O,Moz,ms,Ms,Webkit".split(","),Qi=function(t,n,r){var s=n||Ts,i=s.style,o=5;if(t in i&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(iv[o]+t in i););return o<0?null:(o===3?"ms":o>=0?iv[o]:"")+t},Jf=function(){Z2()&&window.document&&(nv=window,Vr=nv.document,Ni=Vr.documentElement,Ts=Xf("div")||{style:{}},Xf("div"),qe=Qi(qe),Yt=qe+"Origin",Ts.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",bS=!!Qi("perspective"),Yp=Qt.core.reverting,Gp=1)},ov=function(t){var n=t.ownerSVGElement,r=Xf("svg",n&&n.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=t.cloneNode(!0),i;s.style.display="block",r.appendChild(s),Ni.appendChild(r);try{i=s.getBBox()}catch{}return r.removeChild(s),Ni.removeChild(r),i},av=function(t,n){for(var r=n.length;r--;)if(t.hasAttribute(n[r]))return t.getAttribute(n[r])},kS=function(t){var n,r;try{n=t.getBBox()}catch{n=ov(t),r=1}return n&&(n.width||n.height)||r||(n=ov(t)),n&&!n.width&&!n.x&&!n.y?{x:+av(t,["x","cx","x1"])||0,y:+av(t,["y","cy","y1"])||0,width:0,height:0}:n},SS=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&kS(t))},as=function(t,n){if(n){var r=t.style,s;n in Tr&&n!==Yt&&(n=qe),r.removeProperty?(s=n.substr(0,2),(s==="ms"||n.substr(0,6)==="webkit")&&(n="-"+n),r.removeProperty(s==="--"?n:n.replace(Qp,"-$1").toLowerCase())):r.removeAttribute(n)}},Hr=function(t,n,r,s,i,o){var a=new Gt(t._pt,n,r,0,1,o?xS:vS);return t._pt=a,a.b=s,a.e=i,t._props.push(r),a},lv={deg:1,rad:1,turn:1},pD={grid:1,flex:1},ls=function e(t,n,r,s){var i=parseFloat(r)||0,o=(r+"").trim().substr((i+"").length)||"px",a=Ts.style,l=eD.test(n),u=t.tagName.toLowerCase()==="svg",c=(u?"client":"offset")+(l?"Width":"Height"),f=100,h=s==="px",p=s==="%",g,y,_,v;if(s===o||!i||lv[s]||lv[o])return i;if(o!=="px"&&!h&&(i=e(t,n,r,"px")),v=t.getCTM&&SS(t),(p||o==="%")&&(Tr[n]||~n.indexOf("adius")))return g=v?t.getBBox()[l?"width":"height"]:t[c],Ze(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,v&&(y=(t.ownerSVGElement||{}).parentNode),(!y||y===Vr||!y.appendChild)&&(y=Vr.body),_=y._gsap,_&&p&&_.width&&l&&_.time===nn.time&&!_.uncache)return Ze(i/_.width*f);if(p&&(n==="height"||n==="width")){var x=t.style[n];t.style[n]=f+s,g=t[c],x?t.style[n]=x:as(t,n)}else(p||o==="%")&&!pD[on(y,"display")]&&(a.position=on(t,"position")),y===t&&(a.position="static"),y.appendChild(Ts),g=Ts[c],y.removeChild(Ts),a.position="absolute";return l&&p&&(_=js(y),_.time=nn.time,_.width=y[c]),Ze(h?g*i/f:g&&i?f/g*i:0)},yr=function(t,n,r,s){var i;return Gp||Jf(),n in rr&&n!=="transform"&&(n=rr[n],~n.indexOf(",")&&(n=n.split(",")[0])),Tr[n]&&n!=="transform"?(i=Sa(t,s),i=n!=="transformOrigin"?i[n]:i.svg?i.origin:Mu(on(t,Yt))+" "+i.zOrigin+"px"):(i=t.style[n],(!i||i==="auto"||s||~(i+"").indexOf("calc("))&&(i=Nu[n]&&Nu[n](t,n,r)||on(t,n)||Uk(t,n)||(n==="opacity"?1:0))),r&&!~(i+"").trim().indexOf(" ")?ls(t,n,i,r)+r:i},mD=function(t,n,r,s){if(!r||r==="none"){var i=Qi(n,t,1),o=i&&on(t,i,1);o&&o!==r?(n=i,r=o):n==="borderColor"&&(r=on(t,"borderTopColor"))}var a=new Gt(this._pt,t.style,n,0,1,mS),l=0,u=0,c,f,h,p,g,y,_,v,x,w,C,k;if(a.b=r,a.e=s,r+="",s+="",s.substring(0,6)==="var(--"&&(s=on(t,s.substring(4,s.indexOf(")")))),s==="auto"&&(y=t.style[n],t.style[n]=s,s=on(t,n)||s,y?t.style[n]=y:as(t,n)),c=[r,s],aS(c),r=c[0],s=c[1],h=r.match(bi)||[],k=s.match(bi)||[],k.length){for(;f=bi.exec(s);)_=f[0],x=s.substring(l,f.index),g?g=(g+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(g=1),_!==(y=h[u++]||"")&&(p=parseFloat(y)||0,C=y.substr((p+"").length),_.charAt(1)==="="&&(_=Ai(p,_)+C),v=parseFloat(_),w=_.substr((v+"").length),l=bi.lastIndex-w.length,w||(w=w||ln.units[n]||C,l===s.length&&(s+=w,a.e+=w)),C!==w&&(p=ls(t,n,y,w)||0),a._pt={_next:a._pt,p:x||u===1?x:",",s:p,c:v-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"?xS:vS;return Ok.test(s)&&(a.e=0),this._pt=a,a},uv={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},gD=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]=uv[r]||r,n[1]=uv[s]||s,n.join(" ")},yD=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],Tr[a]&&(l=1,a=a==="transformOrigin"?Yt:qe),as(r,a);l&&(as(r,qe),o&&(o.svg&&r.removeAttribute("transform"),s.scale=s.rotate=s.translate="none",Sa(r,1),o.uncache=1,wS(s)))}},Nu={clearProps:function(t,n,r,s,i){if(i.data!=="isFromStart"){var o=t._pt=new Gt(t._pt,n,r,0,0,yD);return o.u=s,o.pr=-10,o.tween=i,t._props.push(r),1}}},ka=[1,0,0,1,0,0],CS={},ES=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},cv=function(t){var n=on(t,qe);return ES(n)?ka:n.substr(7).match(Lk).map(Ze)},Xp=function(t,n){var r=t._gsap||js(t),s=t.style,i=cv(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"?ka:i):(i===ka&&!t.offsetParent&&t!==Ni&&!r.svg&&(l=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent&&!t.getBoundingClientRect().width)&&(u=1,a=t.nextElementSibling,Ni.appendChild(t)),i=cv(t),l?s.display=l:as(t,"display"),u&&(a?o.insertBefore(t,a):o?o.appendChild(t):Ni.removeChild(t))),n&&i.length>6?[i[0],i[1],i[4],i[5],i[12],i[13]]:i)},Zf=function(t,n,r,s,i,o){var a=t._gsap,l=i||Xp(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],_=l[3],v=l[4],x=l[5],w=n.split(" "),C=parseFloat(w[0])||0,k=parseFloat(w[1])||0,S,T,I,P;r?l!==ka&&(T=p*_-g*y)&&(I=C*(_/T)+k*(-y/T)+(y*x-_*v)/T,P=C*(-g/T)+k*(p/T)-(p*x-g*v)/T,C=I,k=P):(S=kS(t),C=S.x+(~w[0].indexOf("%")?C/100*S.width:C),k=S.y+(~(w[1]||w[0]).indexOf("%")?k/100*S.height:k)),s||s!==!1&&a.smooth?(v=C-u,x=k-c,a.xOffset=f+(v*p+x*y)-v,a.yOffset=h+(v*g+x*_)-x):a.xOffset=a.yOffset=0,a.xOrigin=C,a.yOrigin=k,a.smooth=!!s,a.origin=n,a.originIsAbsolute=!!r,t.style[Yt]="0px 0px",o&&(Hr(o,a,"xOrigin",u,C),Hr(o,a,"yOrigin",c,k),Hr(o,a,"xOffset",f,a.xOffset),Hr(o,a,"yOffset",h,a.yOffset)),t.setAttribute("data-svg-origin",C+" "+k)},Sa=function(t,n){var r=t._gsap||new uS(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=on(t,Yt)||"0",c,f,h,p,g,y,_,v,x,w,C,k,S,T,I,P,E,D,M,B,Q,U,te,Z,F,z,b,W,X,R,le,we;return c=f=h=y=_=v=x=w=C=0,p=g=1,r.svg=!!(t.getCTM&&SS(t)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(s[qe]=(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[qe]!=="none"?l[qe]:"")),s.scale=s.rotate=s.translate="none"),T=Xp(t,r.svg),r.svg&&(r.uncache?(F=t.getBBox(),u=r.xOrigin-F.x+"px "+(r.yOrigin-F.y)+"px",Z=""):Z=!n&&t.getAttribute("data-svg-origin"),Zf(t,Z||u,!!Z||r.originIsAbsolute,r.smooth!==!1,T)),k=r.xOrigin||0,S=r.yOrigin||0,T!==ka&&(D=T[0],M=T[1],B=T[2],Q=T[3],c=U=T[4],f=te=T[5],T.length===6?(p=Math.sqrt(D*D+M*M),g=Math.sqrt(Q*Q+B*B),y=D||M?oi(M,D)*bs:0,x=B||Q?oi(B,Q)*bs+y:0,x&&(g*=Math.abs(Math.cos(x*Mi))),r.svg&&(c-=k-(k*D+S*B),f-=S-(k*M+S*Q))):(we=T[6],R=T[7],b=T[8],W=T[9],X=T[10],le=T[11],c=T[12],f=T[13],h=T[14],I=oi(we,X),_=I*bs,I&&(P=Math.cos(-I),E=Math.sin(-I),Z=U*P+b*E,F=te*P+W*E,z=we*P+X*E,b=U*-E+b*P,W=te*-E+W*P,X=we*-E+X*P,le=R*-E+le*P,U=Z,te=F,we=z),I=oi(-B,X),v=I*bs,I&&(P=Math.cos(-I),E=Math.sin(-I),Z=D*P-b*E,F=M*P-W*E,z=B*P-X*E,le=Q*E+le*P,D=Z,M=F,B=z),I=oi(M,D),y=I*bs,I&&(P=Math.cos(I),E=Math.sin(I),Z=D*P+M*E,F=U*P+te*E,M=M*P-D*E,te=te*P-U*E,D=Z,U=F),_&&Math.abs(_)+Math.abs(y)>359.9&&(_=y=0,v=180-v),p=Ze(Math.sqrt(D*D+M*M+B*B)),g=Ze(Math.sqrt(te*te+we*we)),I=oi(U,te),x=Math.abs(I)>2e-4?I*bs:0,C=le?1/(le<0?-le:le):0),r.svg&&(Z=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!ES(on(t,qe)),Z&&t.setAttribute("transform",Z))),Math.abs(x)>90&&Math.abs(x)<270&&(i?(p*=-1,x+=y<=0?180:-180,y+=y<=0?180:-180):(g*=-1,x+=x<=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=Ze(p),r.scaleY=Ze(g),r.rotation=Ze(y)+a,r.rotationX=Ze(_)+a,r.rotationY=Ze(v)+a,r.skewX=x+a,r.skewY=w+a,r.transformPerspective=C+o,(r.zOrigin=parseFloat(u.split(" ")[2])||!n&&r.zOrigin||0)&&(s[Yt]=Mu(u)),r.xOffset=r.yOffset=0,r.force3D=ln.force3D,r.renderTransform=r.svg?xD:bS?TS:vD,r.uncache=0,r},Mu=function(t){return(t=t.split(" "))[0]+" "+t[1]},pd=function(t,n,r){var s=Et(n);return Ze(parseFloat(n)+parseFloat(ls(t,"x",r+"px",s)))+s},vD=function(t,n){n.z="0px",n.rotationY=n.rotationX="0deg",n.force3D=0,TS(t,n)},ys="0deg",xo="0px",vs=") ",TS=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,_=r.transformPerspective,v=r.force3D,x=r.target,w=r.zOrigin,C="",k=v==="auto"&&t&&t!==1||v===!0;if(w&&(f!==ys||c!==ys)){var S=parseFloat(c)*Mi,T=Math.sin(S),I=Math.cos(S),P;S=parseFloat(f)*Mi,P=Math.cos(S),o=pd(x,o,T*P*-w),a=pd(x,a,-Math.sin(S)*-w),l=pd(x,l,I*P*-w+w)}_!==xo&&(C+="perspective("+_+vs),(s||i)&&(C+="translate("+s+"%, "+i+"%) "),(k||o!==xo||a!==xo||l!==xo)&&(C+=l!==xo||k?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+vs),u!==ys&&(C+="rotate("+u+vs),c!==ys&&(C+="rotateY("+c+vs),f!==ys&&(C+="rotateX("+f+vs),(h!==ys||p!==ys)&&(C+="skew("+h+", "+p+vs),(g!==1||y!==1)&&(C+="scale("+g+", "+y+vs),x.style[qe]=C||"translate(0, 0)"},xD=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,_=r.xOffset,v=r.yOffset,x=r.forceCSS,w=parseFloat(o),C=parseFloat(a),k,S,T,I,P;l=parseFloat(l),u=parseFloat(u),c=parseFloat(c),c&&(c=parseFloat(c),u+=c,l+=c),l||u?(l*=Mi,u*=Mi,k=Math.cos(l)*f,S=Math.sin(l)*f,T=Math.sin(l-u)*-h,I=Math.cos(l-u)*h,u&&(c*=Mi,P=Math.tan(u-c),P=Math.sqrt(1+P*P),T*=P,I*=P,c&&(P=Math.tan(c),P=Math.sqrt(1+P*P),k*=P,S*=P)),k=Ze(k),S=Ze(S),T=Ze(T),I=Ze(I)):(k=f,I=h,S=T=0),(w&&!~(o+"").indexOf("px")||C&&!~(a+"").indexOf("px"))&&(w=ls(p,"x",o,"px"),C=ls(p,"y",a,"px")),(g||y||_||v)&&(w=Ze(w+g-(g*k+y*T)+_),C=Ze(C+y-(g*S+y*I)+v)),(s||i)&&(P=p.getBBox(),w=Ze(w+s/100*P.width),C=Ze(C+i/100*P.height)),P="matrix("+k+","+S+","+T+","+I+","+w+","+C+")",p.setAttribute("transform",P),x&&(p.style[qe]=P)},wD=function(t,n,r,s,i){var o=360,a=pt(i),l=parseFloat(i)*(a&&~i.indexOf("rad")?bs: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*sv)%o-~~(u/o)*o:f==="ccw"&&u>0&&(u=(u-o*sv)%o-~~(u/o)*o)),t._pt=h=new Gt(t._pt,n,r,s,u,nD),h.e=c,h.u="deg",t._props.push(r),h},dv=function(t,n){for(var r in n)t[r]=n[r];return t},_D=function(t,n,r){var s=dv({},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[qe]=n,a=Sa(r,1),as(r,qe),r.setAttribute("transform",u)):(u=getComputedStyle(r)[qe],o[qe]=n,a=Sa(r,1),o[qe]=u);for(l in Tr)u=s[l],c=a[l],u!==c&&i.indexOf(l)<0&&(p=Et(u),g=Et(c),f=p!==g?ls(r,l,u,g):parseFloat(u),h=parseFloat(c),t._pt=new Gt(t._pt,a,l,f,h-f,Qf),t._pt.u=g||0,t._props.push(l));dv(a,s)};qt("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});Nu[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 yr(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 IS={name:"css",register:Jf,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,_,v,x,w,C,k,S,T,I,P;Gp||Jf(),this.styles=this.styles||_S(t),I=this.styles.props,this.tween=r;for(y in n)if(y!=="autoRound"&&(c=n[y],!(tn[y]&&cS(y,n,r,s,t,i)))){if(p=typeof c,g=Nu[y],p==="function"&&(c=c.call(r,s,t,i),p=typeof c),p==="string"&&~c.indexOf("random(")&&(c=wa(c)),g)g(this,t,y,c,r)&&(T=1);else if(y.substr(0,2)==="--")u=(getComputedStyle(t).getPropertyValue(y)+"").trim(),c+="",ts.lastIndex=0,ts.test(u)||(_=Et(u),v=Et(c),v?_!==v&&(u=ls(t,y,u,v)+v):_&&(c+=_)),this.add(a,"setProperty",u,c,s,i,0,0,y),o.push(y),I.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],pt(u)&&~u.indexOf("random(")&&(u=wa(u)),Et(u+"")||u==="auto"||(u+=ln.units[y]||Et(yr(t,y))||""),(u+"").charAt(1)==="="&&(u=yr(t,y))):u=yr(t,y),h=parseFloat(u),x=p==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),f=parseFloat(c),y in rr&&(y==="autoAlpha"&&(h===1&&yr(t,"visibility")==="hidden"&&f&&(h=0),I.push("visibility",0,a.visibility),Hr(this,a,"visibility",h?"inherit":"hidden",f?"inherit":"hidden",!f)),y!=="scale"&&y!=="transform"&&(y=rr[y],~y.indexOf(",")&&(y=y.split(",")[0]))),w=y in Tr,w){if(this.styles.save(y),P=c,p==="string"&&c.substring(0,6)==="var(--"){if(c=on(t,c.substring(4,c.indexOf(")"))),c.substring(0,5)==="calc("){var E=t.style.perspective;t.style.perspective=c,c=on(t,"perspective"),E?t.style.perspective=E:as(t,"perspective")}f=parseFloat(c)}if(C||(k=t._gsap,k.renderTransform&&!n.parseTransform||Sa(t,n.parseTransform),S=n.smoothOrigin!==!1&&k.smooth,C=this._pt=new Gt(this._pt,a,qe,0,1,k.renderTransform,k,0,-1),C.dep=1),y==="scale")this._pt=new Gt(this._pt,k,"scaleY",k.scaleY,(x?Ai(k.scaleY,x+f):f)-k.scaleY||0,Qf),this._pt.u=0,o.push("scaleY",y),y+="X";else if(y==="transformOrigin"){I.push(Yt,0,a[Yt]),c=gD(c),k.svg?Zf(t,c,0,S,0,this):(v=parseFloat(c.split(" ")[2])||0,v!==k.zOrigin&&Hr(this,k,"zOrigin",k.zOrigin,v),Hr(this,a,y,Mu(u),Mu(c)));continue}else if(y==="svgOrigin"){Zf(t,c,1,S,0,this);continue}else if(y in CS){wD(this,k,y,h,x?Ai(h,x+c):c);continue}else if(y==="smoothOrigin"){Hr(this,k,"smooth",k.smooth,c);continue}else if(y==="force3D"){k[y]=c;continue}else if(y==="transform"){_D(this,c,t);continue}}else y in a||(y=Qi(y)||y);if(w||(f||f===0)&&(h||h===0)&&!tD.test(c)&&y in a)_=(u+"").substr((h+"").length),f||(f=0),v=Et(c)||(y in ln.units?ln.units[y]:_),_!==v&&(h=ls(t,y,u,v)),this._pt=new Gt(this._pt,w?k:a,y,h,(x?Ai(h,x+f):f)-h,!w&&(v==="px"||y==="zIndex")&&n.autoRound!==!1?iD:Qf),this._pt.u=v||0,w&&P!==c?(this._pt.b=u,this._pt.e=P,this._pt.r=sD):_!==v&&v!=="%"&&(this._pt.b=u,this._pt.r=rD);else if(y in a)mD.call(this,t,y,u,x?x+c:c);else if(y in t)this.add(t,y,u||t[y],x?x+c:c,s,i);else if(y!=="parseTransform"){zp(y,c);continue}w||(y in a?I.push(y,0,a[y]):typeof t[y]=="function"?I.push(y,2,t[y]()):I.push(y,1,u||t[y])),o.push(y)}}T&&gS(this)},render:function(t,n){if(n.tween._time||!Yp())for(var r=n._pt;r;)r.r(t,r.d),r=r._next;else n.styles.revert()},get:yr,aliases:rr,getSetter:function(t,n,r){var s=rr[n];return s&&s.indexOf(",")<0&&(n=s),n in Tr&&n!==Yt&&(t._gsap.x||yr(t,"x"))?r&&rv===r?n==="scale"?uD:lD:(rv=r||{})&&(n==="scale"?cD:dD):t.style&&!Dp(t.style[n])?oD:~n.indexOf("-")?aD:Kp(t,n)},core:{_removeProperty:as,_getMatrix:Xp}};Qt.utils.checkPrefix=Qi;Qt.core.getStyleSaver=_S;(function(e,t,n,r){var s=qt(e+","+t+","+n,function(i){Tr[i]=1});qt(t,function(i){ln.units[i]="deg",CS[i]=1}),rr[s[13]]=e+","+t,qt(r,function(i){var o=i.split(":");rr[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");qt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(e){ln.units[e]="px"});Qt.registerPlugin(IS);var ft=Qt.registerPlugin(IS)||Qt;ft.core.Tween;const ai={fast:.18,base:.28,enterEase:"power3.out",exitEase:"power2.in"};function lr(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const RS='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function fv(e){return Array.from(e.querySelectorAll(RS)).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 Js(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(RS))&&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=fv(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=fv(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),lr())return ft.set(a,{opacity:1}),l&&ft.set(l,{clearProps:"transform,opacity"}),()=>{document.removeEventListener("keydown",u)};const c=ft.timeline();return c.fromTo(a,{opacity:0},{opacity:1,duration:ai.fast,ease:"none"}),l&&c.fromTo(l,{y:14,scale:.97,opacity:0},{y:0,scale:1,opacity:1,duration:ai.base,ease:ai.enterEase},"<"),()=>{c.kill(),document.removeEventListener("keydown",u)}},[]);const o=m.useCallback(()=>{if(n.current)return;n.current=!0;const a=t.current;if(!a||lr()){i(),r.current();return}const l=a.querySelector(":scope > *"),u=ft.timeline({onComplete:()=>{i(),r.current()}});l&&u.to(l,{y:10,scale:.97,opacity:0,duration:ai.fast,ease:ai.exitEase}),u.to(a,{opacity:0,duration:ai.fast,ease:"none"},"<")},[i]);return{rootRef:t,requestClose:o}}function Jp({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 Rn({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 bD(e){return d.jsxs(Rn,{...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 PS(e){return d.jsxs(Rn,{...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 kD(e){return d.jsxs(Rn,{...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 SD(e){return d.jsxs(Rn,{...e,children:[d.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),d.jsx("path",{d:"M9 3v18"})]})}function CD(e){return d.jsxs(Rn,{...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 ED(e){return d.jsx(Rn,{...e,children:d.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})}function eh(e){return d.jsxs(Rn,{...e,children:[d.jsx("path",{d:"M18 6 6 18"}),d.jsx("path",{d:"m6 6 12 12"})]})}function TD(e){return d.jsx(Rn,{...e,children:d.jsx("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54L22 3z"})})}function ID(e){return d.jsxs(Rn,{...e,children:[d.jsx("path",{d:"M12 5v14"}),d.jsx("path",{d:"m19 12-7 7-7-7"})]})}function RD(e){return d.jsxs(Rn,{...e,children:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("path",{d:"m21 21-4.35-4.35"})]})}function PD(e){return d.jsx(Rn,{...e,children:d.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2",ry:"2",fill:"currentColor",stroke:"none"})})}function jS({level:e=1,charging:t=!1,...n}){const r=Math.max(0,Math.min(1,e))*12;return d.jsxs(Rn,{...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 th(e){if(e.thinking)return!0;const t=e.lastActivityMs;return typeof t=="number"&&Number.isFinite(t)&&Date.now()-t<15e3}function jD(e){if(!e)return"";const t=e.replace(/\/$/,"").split("/");return t[t.length-1]||e}function AD(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 ND({s:e,selected:t,onSelect:n,hotkey:r}){const s=e.kind==="terminal",i=s?e.ccShell?`shell · ${e.cmd||"sh"}`:e.cmd||e.tmuxName||"shell":e.title||e.name||e.id,o=s?null:e.pending?"ask":th(e)?"working":"sleeping",a=m.useRef(null),l=m.useRef(e.pending);return m.useEffect(()=>{e.pending&&!l.current&&a.current&&!lr()&&ft.fromTo(a.current,{boxShadow:"0 0 0 2px var(--accent)"},{boxShadow:"0 0 0 0 rgba(0,0,0,0)",duration:1.1,ease:"power2.out"}),l.current=e.pending},[e.pending]),d.jsxs("li",{ref:a,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:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n(e.id))},children:[d.jsxs("div",{className:"session-top",children:[d.jsxs("span",{className:"pane-icon","data-kind":s?"terminal":"claude","data-active":e.active?"true":"false","data-state":o??void 0,"aria-label":s?"terminal pane":"Claude pane",title:s?e.active?"active pane":"inactive pane":o==="ask"?"waiting on a question":o==="working"?"working…":"idle",children:[s?d.jsx(PS,{size:15}):d.jsx(Jp,{size:14}),o==="ask"?d.jsx("span",{className:"pane-icon-badge pane-icon-ask","aria-hidden":"true",children:"?"}):o==="sleeping"?d.jsx("span",{className:"pane-icon-badge pane-icon-zzz","aria-hidden":"true",children:"z"}):null]}),d.jsx("span",{className:"session-name",children:i}),!s&&o==="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,s&&e.cwd?d.jsx("span",{className:"meta-cwd meta-cwd-inline",children:jD(e.cwd)}):null]}),!s&&(e.model||e.ctxPct!=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]}):null]})}function MD({sessions:e,selectedId:t,onSelect:n,filter:r,collapsed:s,onToggleCollapse:i,hotkeyById:o}){const a=m.useMemo(()=>{const l=e.filter(u=>r==="all"?!0:r==="terminal"?u.kind==="terminal":u.kind!=="terminal");return AD(l)},[e,r]);return a.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:a.map(l=>{const u=s.has(l.sessionName),c=l.windows.reduce((f,h)=>f+h.panes.length,0);return d.jsxs("section",{className:"session-group","data-collapsed":u?"true":void 0,children:[d.jsxs("button",{type:"button",className:"session-group-head","aria-expanded":!u,onClick:()=>i(l.sessionName),children:[d.jsx("span",{className:"session-group-chevron","aria-hidden":"true",children:u?"▸":"▾"}),d.jsx("span",{className:"session-group-name",children:l.sessionName}),u?d.jsx("span",{className:"session-group-count",children:c}):null]}),u?null:l.windows.map(f=>d.jsxs("div",{className:"session-window",children:[d.jsxs("div",{className:"session-window-head",children:[d.jsx("span",{className:"window-idx",children:f.windowIndex}),d.jsx("span",{className:"window-name",children:f.windowName})]}),d.jsx("ul",{className:"session-pane-list",children:f.panes.map(h=>d.jsx(ND,{s:h,selected:h.id===t,onSelect:n,hotkey:o.get(h.id)},h.id))})]},f.windowIndex))]},l.sessionName)})})}const DD={on:"Notifications on",off:"Enable notifications",denied:"Notifications blocked",unsupported:"Notifications unsupported",working:"Working…"};function LD({push:e}){const{status:t,supported:n,enable:r,disable:s}=e,i=t==="on",o=!n||t==="unsupported"||t==="working"||t==="denied",a=DD[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 hv(e,t=""){return e!=null?`${Math.round(e)}${t}`:"—"}function OD({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(Jp,{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:hv(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:hv(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(jS,{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(LD,{push:n})]})}const zD={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},FD=" ",Zp=e=>e===" "?FD:e,Ko=new WeakMap;function AS(e){const t=Ko.get(e);t&&(t.timers.forEach(n=>window.clearTimeout(n)),Ko.delete(e),Du(e,t.target))}function NS(e){const t=document.createElement("span");return t.className="char-face",t.textContent=Zp(e),t}function MS(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=Zp(e),t.append(n,NS(e)),t}function Du(e,t){e.classList.add("slot-text"),e.replaceChildren(...Array.from(t,MS))}function DS(e,t,n={}){const{direction:r,stagger:s,duration:i,exitOffset:o,easing:a,bounce:l,color:u,colorFade:c,skipUnchanged:f,interrupt:h}={...zD,...n},p=Ko.get(e);if(p&&!h){t!==p.target&&(p.pending={text:t,options:n});return}if(AS(e),!e.querySelector(".char-slot")){Du(e,t);return}const g=Array.from(e.querySelectorAll(".char-slot")),y=g.map(M=>M.dataset.char??"").join("");if(!h&&y===t)return;const _=Math.max(y.length,t.length),v=g.find(M=>(M.dataset.char??"")!=="")??g[0],x=getComputedStyle(e),w=Math.ceil(v?.getBoundingClientRect().height||v?.offsetHeight||e.getBoundingClientRect().height||parseFloat(x.lineHeight)||0)||Math.ceil(parseFloat(x.fontSize)*1.3)||18,C=u?x.color:"";for(let M=g.length;M<_;M++){const B=MS("");e.appendChild(B),g.push(B)}const k=[],S={timers:k,target:t};Ko.set(e,S);const T=r==="down"?w:-w,I=r==="down"?-w:w,P=(M,B)=>{const Q=Math.sin((M+1)*12.9898+B*78.233)*43758.5453;return(Q-Math.floor(Q))*2-1};let E=0;for(let M=0;M<_;M++){const B=y[M]||"",Q=t[M]||"";if(B===Q&&(f||B===""))continue;const U=g[M],te=U.querySelector(".char-sizer"),Z=U.querySelector(".char-face"),F=U.getBoundingClientRect().width;te.textContent=Zp(Q);const z=te.getBoundingClientRect().width,b=Math.abs(z-F)>.5;b&&(U.style.width=`${F}px`),(B===""||Q==="")&&U.classList.add("is-resizing");const W=typeof u=="function"?u(M,_):u,X=Q==="",R=Math.round(i*(X?.75:1)*(1+l*.45*P(M,1))),le=X?t.length*.5+(M-t.length)*.25:M,we=Math.round(le*s*(1+l*.25*P(M,2))),de=(l*5*P(M,3)).toFixed(2),Je=`transform ${R}ms ${a}`,Ue=u?`${Je}, color ${c}ms linear ${R}ms`:Je,Ce=NS(Q);if(Ce.style.transformOrigin="50% 50%",Ce.style.transform=`translateY(${I}px) rotate(${de}deg)`,W&&(Ce.style.color=W),U.appendChild(Ce),U.offsetWidth,b){let ee=we,ne=R;X?(ee=we+Math.round(R*.55),ne=Math.max(140,Math.round(R*.6))):B===""&&(ne=Math.max(140,Math.round(R*.45))),k.push(window.setTimeout(()=>{U.style.transition=`width ${ne}ms cubic-bezier(0.2, 0, 0, 1)`,U.style.width=`${z}px`},ee)),E=Math.max(E,ee+ne)}E=Math.max(E,we+o+R+(u?c:0)),Z&&k.push(window.setTimeout(()=>{Z.style.transition=Je,Z.style.transform=`translateY(${T}px) rotate(${-Number(de)}deg)`},we)),k.push(window.setTimeout(()=>{Ce.style.transition=Ue,Ce.style.transform="translateY(0) rotate(0deg)",u&&(Ce.style.color=C);const ee=ne=>{ne.propertyName==="transform"&&(Ce.removeEventListener("transitionend",ee),U.dataset.char=Q,U.style.removeProperty("transition"),U.style.removeProperty("width"),U.classList.remove("is-resizing"),U.querySelectorAll(".char-face").forEach(se=>{se!==Ce&&se.remove()}))};Ce.addEventListener("transitionend",ee)},we+o))}const D=E+80;k.push(window.setTimeout(()=>{const M=S.pending;Ko.delete(e),Du(e,t),M&&DS(e,M.text,M.options)},D))}function BD(e,t=""){AS(e),e.classList.remove("slot-text"),e.textContent=t}const LS=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 Du(u,e),o.current=!0,()=>{BD(u),o.current=!1,a.current=!0}},[]),m.useEffect(()=>{const u=i.current;if(!(!u||!o.current)){if(a.current){a.current=!1;return}DS(u,e,l.current)}},[e]),m.createElement("span",{...r,"aria-label":n??e,ref:i})});LS.displayName="SlotText";const $D=(e,t)=>typeof e=="string"?e===t:JSON.stringify(e)===JSON.stringify(t),UD=(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))&&$D(e.children,t.children)},OS=(e,t)=>UD(e.node,t.node),em=m.createContext(null),VD=()=>m.useContext(em)!==null,HD=({children:e,...t})=>d.jsx(em.Provider,{value:t,children:e}),WD=m.memo(HD,OS),KD=({node:e,...t})=>d.jsx("pre",{...t}),qD=({node:e,...t})=>d.jsx("code",{...t}),tm=({node:e,components:{Pre:t,Code:n},code:r})=>d.jsx(t,{children:d.jsx(n,{node:e,children:r})}),GD=()=>null,YD=({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:tm,{node:e,components:a,language:i??"unknown",code:o})]})};var zS={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})()})(zS);var QD=zS.exports;const FS=Ia(QD),pv=({className:e,...t})=>({className:n,...r})=>({className:FS(e,n),...t,...r}),XD=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:s},componentsByLanguage:i={},children:o,...a})=>{const l=pv(m.useContext(em)),u=Us(p=>d.jsx(t,{...l(p)})),c=pv(a),f=Us(p=>d.jsx(n,{...c(p)})),h=/language-(\w+)/.exec(a.className||"")?.[1]??"";return typeof o!="string"?d.jsx(tm,{node:e,components:{Pre:u,Code:f},code:o}):d.jsx(YD,{node:e,components:{Pre:u,Code:f,SyntaxHighlighter:i[h]?.SyntaxHighlighter??r,CodeHeader:i[h]?.CodeHeader??s},language:h||"unknown",code:o})},JD=({node:e,components:t,componentsByLanguage:n,...r})=>VD()?d.jsx(XD,{node:e,components:t,componentsByLanguage:n,...r}):d.jsx(t.Code,{...r}),ZD=m.memo(JD,(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&OS(e,t));function eL(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const tL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rL={};function mv(e,t){return(rL.jsx?nL:tL).test(e)}const sL=/[ \t\n\f\r]/g;function iL(e){return typeof e=="object"?e.type==="text"?gv(e.value):!1:gv(e)}function gv(e){return e.replace(sL,"")===""}class Oa{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Oa.prototype.normal={};Oa.prototype.property={};Oa.prototype.space=void 0;function BS(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Oa(n,r,t)}function nh(e){return e.toLowerCase()}class Xt{constructor(t,n){this.attribute=n,this.property=t}}Xt.prototype.attribute="";Xt.prototype.booleanish=!1;Xt.prototype.boolean=!1;Xt.prototype.commaOrSpaceSeparated=!1;Xt.prototype.commaSeparated=!1;Xt.prototype.defined=!1;Xt.prototype.mustUseProperty=!1;Xt.prototype.number=!1;Xt.prototype.overloadedBoolean=!1;Xt.prototype.property="";Xt.prototype.spaceSeparated=!1;Xt.prototype.space=void 0;let oL=0;const ae=Zs(),st=Zs(),rh=Zs(),H=Zs(),Ie=Zs(),Ds=Zs(),Zt=Zs();function Zs(){return 2**++oL}const sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:ae,booleanish:st,commaOrSpaceSeparated:Zt,commaSeparated:Ds,number:H,overloadedBoolean:rh,spaceSeparated:Ie},Symbol.toStringTag,{value:"Module"})),md=Object.keys(sh);class nm extends Xt{constructor(t,n,r,s){let i=-1;if(super(t,n),yv(this,"space",s),typeof r=="number")for(;++i<md.length;){const o=md[i];yv(this,md[i],(r&sh[o])===sh[o])}}}nm.prototype.defined=!0;function yv(e,t,n){n&&(e[t]=n)}function oo(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new nm(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[nh(r)]=r,n[nh(i.attribute)]=r}return new Oa(t,n,e.space)}const $S=oo({properties:{ariaActiveDescendant:null,ariaAtomic:st,ariaAutoComplete:null,ariaBusy:st,ariaChecked:st,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:Ie,ariaCurrent:null,ariaDescribedBy:Ie,ariaDetails:null,ariaDisabled:st,ariaDropEffect:Ie,ariaErrorMessage:null,ariaExpanded:st,ariaFlowTo:Ie,ariaGrabbed:st,ariaHasPopup:null,ariaHidden:st,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ie,ariaLevel:H,ariaLive:null,ariaModal:st,ariaMultiLine:st,ariaMultiSelectable:st,ariaOrientation:null,ariaOwns:Ie,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:st,ariaReadOnly:st,ariaRelevant:null,ariaRequired:st,ariaRoleDescription:Ie,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:st,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function US(e,t){return t in e?e[t]:t}function VS(e,t){return US(e,t.toLowerCase())}const aL=oo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ds,acceptCharset:Ie,accessKey:Ie,action:null,allow:null,allowFullScreen:ae,allowPaymentRequest:ae,allowUserMedia:ae,alpha:ae,alt:null,as:null,async:ae,autoCapitalize:null,autoComplete:Ie,autoFocus:ae,autoPlay:ae,blocking:Ie,capture:null,charSet:null,checked:ae,cite:null,className:Ie,closedBy:null,colorSpace:null,cols:H,colSpan:H,command:null,commandFor:null,content:null,contentEditable:st,controls:ae,controlsList:Ie,coords:H|Ds,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ae,defer:ae,dir:null,dirName:null,disabled:ae,download:rh,draggable:st,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ae,formTarget:null,headers:Ie,height:H,hidden:rh,high:H,href:null,hrefLang:null,htmlFor:Ie,httpEquiv:Ie,id:null,imageSizes:null,imageSrcSet:null,inert:ae,inputMode:null,integrity:null,is:null,isMap:ae,itemId:null,itemProp:Ie,itemRef:Ie,itemScope:ae,itemType:Ie,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ae,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:ae,muted:ae,name:null,nonce:null,noModule:ae,noValidate:ae,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:ae,optimum:H,pattern:null,ping:Ie,placeholder:null,playsInline:ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ae,referrerPolicy:null,rel:Ie,required:ae,reversed:ae,rows:H,rowSpan:H,sandbox:Ie,scope:null,scoped:ae,seamless:ae,selected:ae,shadowRootClonable:ae,shadowRootCustomElementRegistry:ae,shadowRootDelegatesFocus:ae,shadowRootMode:null,shadowRootSerializable:ae,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:st,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:ae,useMap:null,value:st,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ie,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ae,declare:ae,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:ae,noHref:ae,noShade:ae,noWrap:ae,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:st,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ae,disablePictureInPicture:ae,disableRemotePlayback:ae,exportParts:Ds,part:Ie,prefix:null,property:null,results:H,security:null,unselectable:null},space:"html",transform:VS}),lL=oo({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:Zt,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:Ie,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:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,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:Ds,g2:Ds,glyphName:Ds,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Zt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,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:H,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:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ie,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zt,rev:Zt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zt,requiredFeatures:Zt,requiredFonts:Zt,requiredFormats:Zt,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:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Zt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zt,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:US}),HS=oo({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()}}),WS=oo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:VS}),KS=oo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),uL={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"},cL=/[A-Z]/g,vv=/-[a-z]/g,dL=/^data[-\w.:]+$/i;function fL(e,t){const n=nh(t);let r=t,s=Xt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&dL.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(vv,pL);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!vv.test(i)){let o=i.replace(cL,hL);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=nm}return new s(r,t)}function hL(e){return"-"+e.toLowerCase()}function pL(e){return e.charAt(1).toUpperCase()}const mL=BS([$S,aL,HS,WS,KS],"html"),rm=BS([$S,lL,HS,WS,KS],"svg");function gL(e){return e.join(" ").trim()}var sm={},xv=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,yL=/\n/g,vL=/^\s*/,xL=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,wL=/^:\s*/,_L=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,bL=/^[;\s]*/,kL=/^\s+|\s+$/g,SL=`
63
+ `,wv="/",_v="*",ks="",CL="comment",EL="declaration";function TL(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(yL);y&&(n+=y.length);var _=g.lastIndexOf(SL);r=~_?g.length-_: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 _=y[0];return s(_),e=e.slice(_.length),y}}function u(){l(vL)}function c(g){var y;for(g=g||[];y=f();)y!==!1&&g.push(y);return g}function f(){var g=i();if(!(wv!=e.charAt(0)||_v!=e.charAt(1))){for(var y=2;ks!=e.charAt(y)&&(_v!=e.charAt(y)||wv!=e.charAt(y+1));)++y;if(y+=2,ks===e.charAt(y-1))return a("End of comment missing");var _=e.slice(2,y-2);return r+=2,s(_),e=e.slice(y),r+=2,g({type:CL,comment:_})}}function h(){var g=i(),y=l(xL);if(y){if(f(),!l(wL))return a("property missing ':'");var _=l(_L),v=g({type:EL,property:bv(y[0].replace(xv,ks)),value:_?bv(_[0].replace(xv,ks)):ks});return l(bL),v}}function p(){var g=[];c(g);for(var y;y=h();)y!==!1&&(g.push(y),c(g));return g}return u(),p()}function bv(e){return e?e.replace(kL,ks):ks}var IL=TL,RL=Hl&&Hl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sm,"__esModule",{value:!0});sm.default=jL;const PL=RL(IL);function jL(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,PL.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 mc={};Object.defineProperty(mc,"__esModule",{value:!0});mc.camelCase=void 0;var AL=/^--[a-zA-Z0-9_-]+$/,NL=/-([a-z])/g,ML=/^[^-]+$/,DL=/^-(webkit|moz|ms|o|khtml)-/,LL=/^-(ms)-/,OL=function(e){return!e||ML.test(e)||AL.test(e)},zL=function(e,t){return t.toUpperCase()},kv=function(e,t){return"".concat(t,"-")},FL=function(e,t){return t===void 0&&(t={}),OL(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(LL,kv):e=e.replace(DL,kv),e.replace(NL,zL))};mc.camelCase=FL;var BL=Hl&&Hl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},$L=BL(sm),UL=mc;function ih(e,t){var n={};return!e||typeof e!="string"||(0,$L.default)(e,function(r,s){r&&s&&(n[(0,UL.camelCase)(r,t)]=s)}),n}ih.default=ih;var VL=ih;const HL=Ia(VL),qS=GS("end"),im=GS("start");function GS(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 WL(e){const t=im(e),n=qS(e);if(t&&n)return{start:t,end:n}}function qo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Sv(e.position):"start"in e||"end"in e?Sv(e):"line"in e||"column"in e?oh(e):""}function oh(e){return Cv(e&&e.line)+":"+Cv(e&&e.column)}function Sv(e){return oh(e&&e.start)+"-"+oh(e&&e.end)}function Cv(e){return e&&typeof e=="number"?e:1}class Pt 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=qo(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}}Pt.prototype.file="";Pt.prototype.name="";Pt.prototype.reason="";Pt.prototype.message="";Pt.prototype.stack="";Pt.prototype.column=void 0;Pt.prototype.line=void 0;Pt.prototype.ancestors=void 0;Pt.prototype.cause=void 0;Pt.prototype.fatal=void 0;Pt.prototype.place=void 0;Pt.prototype.ruleId=void 0;Pt.prototype.source=void 0;const om={}.hasOwnProperty,KL=new Map,qL=/[A-Z]/g,GL=new Set(["table","tbody","thead","tfoot","tr"]),YL=new Set(["td","th"]),YS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function QL(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=sO(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=rO(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"?rm:mL,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=QS(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function QS(e,t,n){if(t.type==="element")return XL(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return JL(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return eO(e,t,n);if(t.type==="mdxjsEsm")return ZL(e,t);if(t.type==="root")return tO(e,t,n);if(t.type==="text")return nO(e,t)}function XL(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=rm,e.schema=s),e.ancestors.push(t);const i=JS(e,t.tagName,!1),o=iO(e,t);let a=lm(e,t);return GL.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!iL(l):!0})),XS(e,o,i,t),am(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function JL(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)}Ca(e,t.position)}function ZL(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ca(e,t.position)}function eO(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=rm,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:JS(e,t.name,!0),o=oO(e,t),a=lm(e,t);return XS(e,o,i,t),am(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function tO(e,t,n){const r={};return am(r,lm(e,t)),e.create(t,e.Fragment,r,n)}function nO(e,t){return t.value}function XS(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function am(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function rO(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 sO(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=im(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 iO(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&om.call(t.properties,s)){const i=aO(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&YL.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 oO(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 Ca(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 Ca(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function lm(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:KL;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=QS(e,i,o);a!==void 0&&n.push(a)}return n}function aO(e,t,n){const r=fL(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?eL(n):gL(n)),r.property==="style"){let s=typeof n=="object"?n:lO(e,String(n));return e.stylePropertyNameCase==="css"&&(s=uO(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?uL[r.property]||r.property:r.attribute,n]}}function lO(e,t){try{return HL(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Pt("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=YS+"#cannot-parse-style-attribute",s}}function JS(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=mv(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=mv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return om.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ca(e)}function Ca(e,t){const n=new Pt("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=YS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function uO(e){const t={};let n;for(n in e)om.call(e,n)&&(t[cO(n)]=e[n]);return t}function cO(e){let t=e.replace(qL,dO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function dO(e){return"-"+e.toLowerCase()}const gd={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"]},fO={};function um(e,t){const n=fO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ZS(e,r,s)}function ZS(e,t,n){if(hO(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 Ev(e.children,t,n)}return Array.isArray(e)?Ev(e,t,n):""}function Ev(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=ZS(e[s],t,n);return r.join("")}function hO(e){return!!(e&&typeof e=="object")}const Tv=document.createElement("i");function cm(e){const t="&"+e+";";Tv.innerHTML=t;const n=Tv.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function un(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 _n(e,t){return e.length>0?(un(e,e.length,0,t),e):t}const Iv={}.hasOwnProperty;function e1(e){const t={};let n=-1;for(;++n<e.length;)pO(t,e[n]);return t}function pO(e,t){let n;for(n in t){const s=(Iv.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Iv.call(s,o)||(s[o]=[]);const a=i[o];mO(s[o],Array.isArray(a)?a:a?[a]:[])}}}function mO(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);un(e,0,0,r)}function t1(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 Vn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mt=hs(/[A-Za-z]/),Tt=hs(/[\dA-Za-z]/),gO=hs(/[#-'*+\--9=?A-Z^-~]/);function Lu(e){return e!==null&&(e<32||e===127)}const ah=hs(/\d/),yO=hs(/[\dA-Fa-f]/),vO=hs(/[!-/:-@[-`{-~]/);function re(e){return e!==null&&e<-2}function Pe(e){return e!==null&&(e<0||e===32)}function me(e){return e===-2||e===-1||e===32}const gc=hs(/\p{P}|\p{S}/u),Vs=hs(/\s/);function hs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ao(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Tt(e.charCodeAt(n+1))&&Tt(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 _e(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return me(l)?(e.enter(n),a(l)):t(l)}function a(l){return me(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const xO={tokenize:wO};function wO(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"),_e(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 re(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const _O={tokenize:bO},Rv={tokenize:kO};function bO(e){const t=this,n=[];let r=0,s,i,o;return a;function a(w){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&x();const C=t.events.length;let k=C,S;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){S=t.events[k][1].end;break}v(r);let T=C;for(;T<t.events.length;)t.events[T][1].end={...S},T++;return un(t.events,k+1,0,t.events.slice(C)),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(Rv,c,f)(w)}function c(w){return s&&x(),v(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(Rv,p,g)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),h(w)}function g(w){if(w===null){s&&x(),v(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){_(e.exit("chunkFlow"),!0),v(0),e.consume(w);return}return re(w)?(e.consume(w),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),y)}function _(w,C){const k=t.sliceStream(w);if(C&&k.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(k),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 I=T,P,E;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(P){E=t.events[I][1].end;break}P=!0}for(v(r),S=T;S<t.events.length;)t.events[S][1].end={...E},S++;un(t.events,I+1,0,t.events.slice(T)),t.events.length=S}}function v(w){let C=n.length;for(;C-- >w;){const k=n[C];t.containerState=k[1],k[0].exit.call(t,e)}n.length=w}function x(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function kO(e,t,n){return _e(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xi(e){if(e===null||Pe(e)||Vs(e))return 1;if(gc(e))return 2}function yc(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 lh={name:"attention",resolveAll:SO,tokenize:CO};function SO(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};Pv(f,-l),Pv(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=_n(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=_n(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=_n(u,yc(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=_n(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=_n(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,un(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 CO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Xi(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=Xi(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 Pv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const EO={name:"autolink",tokenize:TO};function TO(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 Mt(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||Tt(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||Tt(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||Lu(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):gO(p)?(e.consume(p),u):n(p)}function c(p){return Tt(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||Tt(p))&&r++<63){const g=p===45?h:f;return e.consume(p),g}return n(p)}}const za={partial:!0,tokenize:IO};function IO(e,t,n){return r;function r(i){return me(i)?_e(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||re(i)?t(i):n(i)}}const n1={continuation:{tokenize:PO},exit:jO,name:"blockQuote",tokenize:RO};function RO(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 me(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function PO(e,t,n){const r=this;return s;function s(o){return me(o)?_e(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(n1,t,n)(o)}}function jO(e){e.exit("blockQuote")}const r1={name:"characterEscape",tokenize:AO};function AO(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 vO(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const s1={name:"characterReference",tokenize:NO};function NO(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=Tt,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=yO,c):(e.enter("characterReferenceValue"),i=7,o=ah,c(f))}function c(f){if(f===59&&s){const h=e.exit("characterReferenceValue");return o===Tt&&!cm(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 jv={partial:!0,tokenize:DO},Av={concrete:!0,name:"codeFenced",tokenize:MO};function MO(e,t,n){const r=this,s={partial:!0,tokenize:k};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"),me(S)?_e(e,f,"whitespace")(S):f(S))}function f(S){return S===null||re(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(jv,y,C)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||re(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(S)):me(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_e(e,p,"whitespace")(S)):S===96&&S===a?n(S):(e.consume(S),h)}function p(S){return S===null||re(S)?f(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||re(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,C,_)(S)}function _(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),v}function v(S){return i>0&&me(S)?_e(e,x,"linePrefix",i+1)(S):x(S)}function x(S){return S===null||re(S)?e.check(jv,y,C)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||re(S)?(e.exit("codeFlowValue"),x(S)):(e.consume(S),w)}function C(S){return e.exit("codeFenced"),t(S)}function k(S,T,I){let P=0;return E;function E(U){return S.enter("lineEnding"),S.consume(U),S.exit("lineEnding"),D}function D(U){return S.enter("codeFencedFence"),me(U)?_e(S,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):M(U)}function M(U){return U===a?(S.enter("codeFencedFenceSequence"),B(U)):I(U)}function B(U){return U===a?(P++,S.consume(U),B):P>=o?(S.exit("codeFencedFenceSequence"),me(U)?_e(S,Q,"whitespace")(U):Q(U)):I(U)}function Q(U){return U===null||re(U)?(S.exit("codeFencedFence"),T(U)):I(U)}}}function DO(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 yd={name:"codeIndented",tokenize:OO},LO={partial:!0,tokenize:zO};function OO(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),_e(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):re(u)?e.attempt(LO,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||re(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function zO(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):re(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):_e(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):re(o)?s(o):n(o)}}const FO={name:"codeText",previous:$O,resolve:BO,tokenize:UO};function BO(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 $O(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function UO(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)):re(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||re(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 VO{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&&wo(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),wo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),wo(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);wo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);wo(this.left,n.reverse())}}}function wo(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 i1(e){const t={};let n=-1,r,s,i,o,a,l,u;const c=new VO(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,HO(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 un(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function HO(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 _=[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,_.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):_.pop(),h=_.length;h--;){const v=a.slice(_[h],_[h+1]),x=i.pop();l.push([x,x+v.length-1]),e.splice(x,2,v)}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 WO={resolve:qO,tokenize:GO},KO={partial:!0,tokenize:YO};function qO(e){return i1(e),e}function GO(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):re(a)?e.check(KO,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 YO(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),_e(e,i,"linePrefix")}function i(o){if(o===null||re(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 o1(e,t,n,r,s,i,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(v){return v===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(v),e.exit(i),h):v===null||v===32||v===41||Lu(v)?n(v):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(v))}function h(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(a),h(v)):v===null||v===60||re(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function y(v){return!c&&(v===null||v===41||Pe(v))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,y):v===41?(e.consume(v),c--,y):v===null||v===32||v===40||Lu(v)?n(v):(e.consume(v),v===92?_:y)}function _(v){return v===40||v===41||v===92?(e.consume(v),y):y(v)}}function a1(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):re(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||re(p)||a++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!me(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function l1(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):re(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),_e(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===o||h===null||re(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 Go(e,t){let n;return r;function r(s){return re(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):me(s)?_e(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const QO={name:"definition",tokenize:JO},XO={partial:!0,tokenize:ZO};function JO(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return a1.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=Vn(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 Pe(p)?Go(e,u)(p):u(p)}function u(p){return o1(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(XO,f,f)(p)}function f(p){return me(p)?_e(e,h,"whitespace")(p):h(p)}function h(p){return p===null||re(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function ZO(e,t,n){return r;function r(a){return Pe(a)?Go(e,s)(a):n(a)}function s(a){return l1(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return me(a)?_e(e,o,"whitespace")(a):o(a)}function o(a){return a===null||re(a)?t(a):n(a)}}const ez={name:"hardBreakEscape",tokenize:tz};function tz(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return re(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const nz={name:"headingAtx",resolve:rz,tokenize:sz};function rz(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"},un(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function sz(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||Pe(c)?(e.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||re(c)?(e.exit("atxHeading"),t(c)):me(c)?_e(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||Pe(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),u)}}const iz=["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"],Nv=["pre","script","style","textarea"],oz={concrete:!0,name:"htmlFlow",resolveTo:uz,tokenize:cz},az={partial:!0,tokenize:fz},lz={partial:!0,tokenize:dz};function uz(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 cz(e,t,n){const r=this;let s,i,o,a,l;return u;function u(R){return c(R)}function c(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),f}function f(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),i=!0,y):R===63?(e.consume(R),s=3,r.interrupt?t:b):Mt(R)?(e.consume(R),o=String.fromCharCode(R),_):n(R)}function h(R){return R===45?(e.consume(R),s=2,p):R===91?(e.consume(R),s=5,a=0,g):Mt(R)?(e.consume(R),s=4,r.interrupt?t:b):n(R)}function p(R){return R===45?(e.consume(R),r.interrupt?t:b):n(R)}function g(R){const le="CDATA[";return R===le.charCodeAt(a++)?(e.consume(R),a===le.length?r.interrupt?t:M:g):n(R)}function y(R){return Mt(R)?(e.consume(R),o=String.fromCharCode(R),_):n(R)}function _(R){if(R===null||R===47||R===62||Pe(R)){const le=R===47,we=o.toLowerCase();return!le&&!i&&Nv.includes(we)?(s=1,r.interrupt?t(R):M(R)):iz.includes(o.toLowerCase())?(s=6,le?(e.consume(R),v):r.interrupt?t(R):M(R)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):i?x(R):w(R))}return R===45||Tt(R)?(e.consume(R),o+=String.fromCharCode(R),_):n(R)}function v(R){return R===62?(e.consume(R),r.interrupt?t:M):n(R)}function x(R){return me(R)?(e.consume(R),x):E(R)}function w(R){return R===47?(e.consume(R),E):R===58||R===95||Mt(R)?(e.consume(R),C):me(R)?(e.consume(R),w):E(R)}function C(R){return R===45||R===46||R===58||R===95||Tt(R)?(e.consume(R),C):k(R)}function k(R){return R===61?(e.consume(R),S):me(R)?(e.consume(R),k):w(R)}function S(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),l=R,T):me(R)?(e.consume(R),S):I(R)}function T(R){return R===l?(e.consume(R),l=null,P):R===null||re(R)?n(R):(e.consume(R),T)}function I(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Pe(R)?k(R):(e.consume(R),I)}function P(R){return R===47||R===62||me(R)?w(R):n(R)}function E(R){return R===62?(e.consume(R),D):n(R)}function D(R){return R===null||re(R)?M(R):me(R)?(e.consume(R),D):n(R)}function M(R){return R===45&&s===2?(e.consume(R),te):R===60&&s===1?(e.consume(R),Z):R===62&&s===4?(e.consume(R),W):R===63&&s===3?(e.consume(R),b):R===93&&s===5?(e.consume(R),z):re(R)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(az,X,B)(R)):R===null||re(R)?(e.exit("htmlFlowData"),B(R)):(e.consume(R),M)}function B(R){return e.check(lz,Q,X)(R)}function Q(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),U}function U(R){return R===null||re(R)?B(R):(e.enter("htmlFlowData"),M(R))}function te(R){return R===45?(e.consume(R),b):M(R)}function Z(R){return R===47?(e.consume(R),o="",F):M(R)}function F(R){if(R===62){const le=o.toLowerCase();return Nv.includes(le)?(e.consume(R),W):M(R)}return Mt(R)&&o.length<8?(e.consume(R),o+=String.fromCharCode(R),F):M(R)}function z(R){return R===93?(e.consume(R),b):M(R)}function b(R){return R===62?(e.consume(R),W):R===45&&s===2?(e.consume(R),b):M(R)}function W(R){return R===null||re(R)?(e.exit("htmlFlowData"),X(R)):(e.consume(R),W)}function X(R){return e.exit("htmlFlow"),t(R)}}function dz(e,t,n){const r=this;return s;function s(o){return re(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 fz(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(za,t,n)}}const hz={name:"htmlText",tokenize:pz};function pz(e,t,n){const r=this;let s,i,o;return a;function a(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),l}function l(b){return b===33?(e.consume(b),u):b===47?(e.consume(b),k):b===63?(e.consume(b),w):Mt(b)?(e.consume(b),I):n(b)}function u(b){return b===45?(e.consume(b),c):b===91?(e.consume(b),i=0,g):Mt(b)?(e.consume(b),x):n(b)}function c(b){return b===45?(e.consume(b),p):n(b)}function f(b){return b===null?n(b):b===45?(e.consume(b),h):re(b)?(o=f,Z(b)):(e.consume(b),f)}function h(b){return b===45?(e.consume(b),p):f(b)}function p(b){return b===62?te(b):b===45?h(b):f(b)}function g(b){const W="CDATA[";return b===W.charCodeAt(i++)?(e.consume(b),i===W.length?y:g):n(b)}function y(b){return b===null?n(b):b===93?(e.consume(b),_):re(b)?(o=y,Z(b)):(e.consume(b),y)}function _(b){return b===93?(e.consume(b),v):y(b)}function v(b){return b===62?te(b):b===93?(e.consume(b),v):y(b)}function x(b){return b===null||b===62?te(b):re(b)?(o=x,Z(b)):(e.consume(b),x)}function w(b){return b===null?n(b):b===63?(e.consume(b),C):re(b)?(o=w,Z(b)):(e.consume(b),w)}function C(b){return b===62?te(b):w(b)}function k(b){return Mt(b)?(e.consume(b),S):n(b)}function S(b){return b===45||Tt(b)?(e.consume(b),S):T(b)}function T(b){return re(b)?(o=T,Z(b)):me(b)?(e.consume(b),T):te(b)}function I(b){return b===45||Tt(b)?(e.consume(b),I):b===47||b===62||Pe(b)?P(b):n(b)}function P(b){return b===47?(e.consume(b),te):b===58||b===95||Mt(b)?(e.consume(b),E):re(b)?(o=P,Z(b)):me(b)?(e.consume(b),P):te(b)}function E(b){return b===45||b===46||b===58||b===95||Tt(b)?(e.consume(b),E):D(b)}function D(b){return b===61?(e.consume(b),M):re(b)?(o=D,Z(b)):me(b)?(e.consume(b),D):P(b)}function M(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),s=b,B):re(b)?(o=M,Z(b)):me(b)?(e.consume(b),M):(e.consume(b),Q)}function B(b){return b===s?(e.consume(b),s=void 0,U):b===null?n(b):re(b)?(o=B,Z(b)):(e.consume(b),B)}function Q(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||Pe(b)?P(b):(e.consume(b),Q)}function U(b){return b===47||b===62||Pe(b)?P(b):n(b)}function te(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function Z(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),F}function F(b){return me(b)?_e(e,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):z(b)}function z(b){return e.enter("htmlTextData"),o(b)}}const dm={name:"labelEnd",resolveAll:vz,resolveTo:xz,tokenize:wz},mz={tokenize:_z},gz={tokenize:bz},yz={tokenize:kz};function vz(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&&un(e,0,e.length,n),e}function xz(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=_n(a,e.slice(i+1,i+r+3)),a=_n(a,[["enter",c,t]]),a=_n(a,yc(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=_n(a,[["exit",c,t],e[o-2],e[o-1],["exit",u,t]]),a=_n(a,e.slice(o+1)),a=_n(a,[["exit",l,t]]),un(e,i,e.length,a),e}function wz(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(Vn(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(mz,c,o?c:f)(h):h===91?e.attempt(gz,c,o?u:f)(h):o?c(h):f(h)}function u(h){return e.attempt(yz,c,f)(h)}function c(h){return t(h)}function f(h){return i._balanced=!0,n(h)}}function _z(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 Pe(f)?Go(e,i)(f):i(f)}function i(f){return f===41?c(f):o1(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return Pe(f)?Go(e,l)(f):c(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?l1(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return Pe(f)?Go(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 bz(e,t,n){const r=this;return s;function s(a){return a1.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function kz(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 Sz={name:"labelStartImage",resolveAll:dm.resolveAll,tokenize:Cz};function Cz(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 Ez={name:"labelStartLink",resolveAll:dm.resolveAll,tokenize:Tz};function Tz(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 vd={name:"lineEnding",tokenize:Iz};function Iz(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),_e(e,t,"linePrefix")}}const Ul={name:"thematicBreak",tokenize:Rz};function Rz(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||re(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),me(u)?_e(e,a,"whitespace")(u):a(u))}}const zt={continuation:{tokenize:Nz},exit:Dz,name:"list",tokenize:Az},Pz={partial:!0,tokenize:Lz},jz={partial:!0,tokenize:Mz};function Az(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:ah(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(Ul,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 ah(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(Pz,h,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return me(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 Nz(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,_e(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!me(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(jz,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,_e(e,e.attempt(zt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Mz(e,t,n){const r=this;return _e(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 Dz(e){e.exit(this.containerState.type)}function Lz(e,t,n){const r=this;return _e(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!me(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Mv={name:"setextUnderline",resolveTo:Oz,tokenize:zz};function Oz(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 zz(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"),me(u)?_e(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||re(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Fz={tokenize:Bz};function Bz(e){const t=this,n=e.attempt(za,r,e.attempt(this.parser.constructs.flowInitial,s,_e(e,e.attempt(this.parser.constructs.flow,s,e.attempt(WO,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 $z={resolveAll:c1()},Uz=u1("string"),Vz=u1("text");function u1(e){return{resolveAll:c1(e==="text"?Hz: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 c1(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 Hz(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 Wz={42:zt,43:zt,45:zt,48:zt,49:zt,50:zt,51:zt,52:zt,53:zt,54:zt,55:zt,56:zt,57:zt,62:n1},Kz={91:QO},qz={[-2]:yd,[-1]:yd,32:yd},Gz={35:nz,42:Ul,45:[Mv,Ul],60:oz,61:Mv,95:Ul,96:Av,126:Av},Yz={38:s1,92:r1},Qz={[-5]:vd,[-4]:vd,[-3]:vd,33:Sz,38:s1,42:lh,60:[EO,hz],91:Ez,92:[ez,r1],93:dm,95:lh,96:FO},Xz={null:[lh,$z]},Jz={null:[42,95]},Zz={null:[]},eF=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Jz,contentInitial:Kz,disable:Zz,document:Wz,flow:Gz,flowInitial:qz,insideSpan:Xz,string:Yz,text:Qz},Symbol.toStringTag,{value:"Module"}));function tF(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(k),check:T(S),consume:x,enter:w,exit:C,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(D){return o=_n(o,D),_(),o[o.length-1]!==null?[]:(I(t,0),u.events=yc(i,u.events,u),u.events)}function h(D,M){return rF(p(D),M)}function p(D){return nF(o,D)}function g(){const{_bufferIndex:D,_index:M,line:B,column:Q,offset:U}=r;return{_bufferIndex:D,_index:M,line:B,column:Q,offset:U}}function y(D){s[D.line]=D.column,E()}function _(){let D;for(;r._index<o.length;){const M=o[r._index];if(typeof M=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<M.length;)v(M.charCodeAt(r._bufferIndex));else v(M)}}function v(D){c=c(D)}function x(D){re(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,E()):D!==-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=D}function w(D,M){const B=M||{};return B.type=D,B.start=g(),u.events.push(["enter",B,u]),a.push(B),B}function C(D){const M=a.pop();return M.end=g(),u.events.push(["exit",M,u]),M}function k(D,M){I(D,M.from)}function S(D,M){M.restore()}function T(D,M){return B;function B(Q,U,te){let Z,F,z,b;return Array.isArray(Q)?X(Q):"tokenize"in Q?X([Q]):W(Q);function W(de){return Je;function Je(Ue){const Ce=Ue!==null&&de[Ue],ee=Ue!==null&&de.null,ne=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return X(ne)(Ue)}}function X(de){return Z=de,F=0,de.length===0?te:R(de[F])}function R(de){return Je;function Je(Ue){return b=P(),z=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?we():de.tokenize.call(M?Object.assign(Object.create(u),M):u,l,le,we)(Ue)}}function le(de){return D(z,b),U}function we(de){return b.restore(),++F<Z.length?R(Z[F]):te}}}function I(D,M){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&un(u.events,M,u.events.length-M,D.resolve(u.events.slice(M),u)),D.resolveTo&&(u.events=D.resolveTo(u.events,u))}function P(){const D=g(),M=u.previous,B=u.currentConstruct,Q=u.events.length,U=Array.from(a);return{from:Q,restore:te};function te(){r=D,u.previous=M,u.currentConstruct=B,u.events.length=Q,a=U,E()}}function E(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function nF(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 rF(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 sF(e){const r={constructs:e1([eF,...(e||{}).extensions||[]]),content:s(xO),defined:[],document:s(_O),flow:s(Fz),lazy:{},string:s(Uz),text:s(Vz)};return r;function s(i){return o;function o(a){return tF(r,i,a)}}}function iF(e){for(;!i1(e););return e}const Dv=/[\0\t\n\r]/g;function oF(){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(Dv.lastIndex=f,u=Dv.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 aF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function lF(e){return e.replace(aF,uF)}function uF(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return t1(n.slice(i?2:1),i?16:10)}return cm(n)||e}const d1={}.hasOwnProperty;function cF(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),dF(n)(iF(sF(n).document().write(oF()(e,t,!0))))}function dF(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(jn),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(ut),blockQuote:i(ee),characterEscape:P,characterReference:P,codeFenced:i(ne),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ne,o),codeText:i(se,o),codeTextData:P,data:P,codeFlowValue:P,definition:i(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(mt),hardBreakEscape:i(rt),hardBreakTrailing:i(rt),htmlFlow:i(Pn,o),htmlFlowData:P,htmlText:i(Pn,o),htmlTextData:P,image:i(jr),label:o,link:i(jn),listItem:i(An),listItemValue:h,listOrdered:i(ps,f),listUnordered:i(ps),paragraph:i(gn),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ut),strong:i(ei),thematicBreak:i(qn)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:Ce,autolinkProtocol:Ue,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:we,characterReferenceMarkerNumeric:we,characterReferenceValue:de,characterReference:Je,codeFenced:l(_),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:E,codeIndented:l(v),codeText:l(U),codeTextData:E,data:E,definition:l(),definitionDestinationString:C,definitionLabelString:x,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(B),htmlFlowData:E,htmlText:l(Q),htmlTextData:E,image:l(Z),label:z,labelText:F,lineEnding:D,link:l(te),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:le,resourceDestinationString:b,resourceTitleString:W,resource:X,setextHeading:l(I),setextHeadingLineSequence:T,setextHeadingText:S,strong:l(),thematicBreak:l()}};f1(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(O){let Y={type:"root",children:[]};const ie={stack:[Y],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:c,data:n},fe=[];let N=-1;for(;++N<O.length;)if(O[N][1].type==="listOrdered"||O[N][1].type==="listUnordered")if(O[N][0]==="enter")fe.push(N);else{const $=fe.pop();N=s(O,$,N)}for(N=-1;++N<O.length;){const $=t[O[N][0]];d1.call($,O[N][1].type)&&$[O[N][1].type].call(Object.assign({sliceSerialize:O[N][2].sliceSerialize},ie),O[N][1])}if(ie.tokenStack.length>0){const $=ie.tokenStack[ie.tokenStack.length-1];($[1]||Lv).call(ie,void 0,$[0])}for(Y.position={start:Nr(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Nr(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},N=-1;++N<t.transforms.length;)Y=t.transforms[N](Y)||Y;return Y}function s(O,Y,ie){let fe=Y-1,N=-1,$=!1,oe,ke,pe,Ee;for(;++fe<=ie;){const ye=O[fe];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?N++:N--,Ee=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(oe&&!Ee&&!N&&!pe&&(pe=fe),Ee=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ee=void 0}if(!N&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||N===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(oe){let De=fe;for(ke=void 0;De--;){const ct=O[De];if(ct[1].type==="lineEnding"||ct[1].type==="lineEndingBlank"){if(ct[0]==="exit")continue;ke&&(O[ke][1].type="lineEndingBlank",$=!0),ct[1].type="lineEnding",ke=De}else if(!(ct[1].type==="linePrefix"||ct[1].type==="blockQuotePrefix"||ct[1].type==="blockQuotePrefixWhitespace"||ct[1].type==="blockQuoteMarker"||ct[1].type==="listItemIndent"))break}pe&&(!ke||pe<ke)&&(oe._spread=!0),oe.end=Object.assign({},ke?O[ke][1].start:ye[1].end),O.splice(ke||fe,0,["exit",oe,ye[2]]),fe++,ie++}if(ye[1].type==="listItemPrefix"){const De={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};oe=De,O.splice(fe,0,["enter",De,ye[2]]),fe++,ie++,pe=void 0,Ee=!0}}}return O[Y][1]._spread=$,ie}function i(O,Y){return ie;function ie(fe){a.call(this,O(fe),fe),Y&&Y.call(this,fe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(O,Y,ie){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([Y,ie||void 0]),O.position={start:Nr(Y.start),end:void 0}}function l(O){return Y;function Y(ie){O&&O.call(this,ie),u.call(this,ie)}}function u(O,Y){const ie=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==O.type&&(Y?Y.call(this,O,fe[0]):(fe[1]||Lv).call(this,O,fe[0]));else throw new Error("Cannot close `"+O.type+"` ("+qo({start:O.start,end:O.end})+"): it’s not open");ie.position.end=Nr(O.end)}function c(){return um(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(O){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=O}function g(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=O}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.value=O.replace(/(\r?\n|\r)$/g,"")}function x(O){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.label=Y,ie.identifier=Vn(this.sliceSerialize(O)).toLowerCase()}function w(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.title=O}function C(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.url=O}function k(O){const Y=this.stack[this.stack.length-1];if(!Y.depth){const ie=this.sliceSerialize(O).length;Y.depth=ie}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function T(O){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function P(O){const ie=this.stack[this.stack.length-1].children;let fe=ie[ie.length-1];(!fe||fe.type!=="text")&&(fe=yn(),fe.position={start:Nr(O.start),end:void 0},ie.push(fe)),this.stack.push(fe)}function E(O){const Y=this.stack.pop();Y.value+=this.sliceSerialize(O),Y.position.end=Nr(O.end)}function D(O){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ie=Y.children[Y.children.length-1];ie.position.end=Nr(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(P.call(this,O),E.call(this,O))}function M(){this.data.atHardBreak=!0}function B(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.value=O}function Q(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.value=O}function U(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.value=O}function te(){const O=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=Y,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function Z(){const O=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=Y,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function F(O){const Y=this.sliceSerialize(O),ie=this.stack[this.stack.length-2];ie.label=lF(Y),ie.identifier=Vn(Y).toLowerCase()}function z(){const O=this.stack[this.stack.length-1],Y=this.resume(),ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,ie.type==="link"){const fe=O.children;ie.children=fe}else ie.alt=Y}function b(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.url=O}function W(){const O=this.resume(),Y=this.stack[this.stack.length-1];Y.title=O}function X(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function le(O){const Y=this.resume(),ie=this.stack[this.stack.length-1];ie.label=Y,ie.identifier=Vn(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function we(O){this.data.characterReferenceType=O.type}function de(O){const Y=this.sliceSerialize(O),ie=this.data.characterReferenceType;let fe;ie?(fe=t1(Y,ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=cm(Y);const N=this.stack[this.stack.length-1];N.value+=fe}function Je(O){const Y=this.stack.pop();Y.position.end=Nr(O.end)}function Ue(O){E.call(this,O);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(O)}function Ce(O){E.call(this,O);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(O)}function ee(){return{type:"blockquote",children:[]}}function ne(){return{type:"code",lang:null,meta:null,value:""}}function se(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function mt(){return{type:"emphasis",children:[]}}function ut(){return{type:"heading",depth:0,children:[]}}function rt(){return{type:"break"}}function Pn(){return{type:"html",value:""}}function jr(){return{type:"image",title:null,url:"",alt:null}}function jn(){return{type:"link",title:null,url:"",children:[]}}function ps(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function An(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function gn(){return{type:"paragraph",children:[]}}function ei(){return{type:"strong",children:[]}}function yn(){return{type:"text",value:""}}function qn(){return{type:"thematicBreak"}}}function Nr(e){return{line:e.line,column:e.column,offset:e.offset}}function f1(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?f1(e,r):fF(e,r)}}function fF(e,t){let n;for(n in t)if(d1.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 Lv(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+qo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+qo({start:t.start,end:t.end})+") is still open")}function hF(e){const t=this;t.parser=n;function n(r){return cF(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function pF(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 mF(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
66
+ `}]}function gF(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 yF(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vF(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xF(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=ao(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 wF(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 _F(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function h1(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 bF(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return h1(e,t);const s={src:ao(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 kF(e,t){const n={src:ao(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 SF(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 CF(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return h1(e,t);const s={href:ao(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 EF(e,t){const n={href:ao(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 TF(e,t,n){const r=e.all(t),s=n?IF(n):p1(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 IF(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=p1(n[r])}return t}function p1(e){const t=e.spread;return t??e.children.length>1}function RF(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 PF(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jF(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function AF(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function NF(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=im(t.children[1]),l=qS(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 MF(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 DF(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ov=9,zv=32;function LF(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(Fv(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(Fv(t.slice(s),s>0,!1)),i.join("")}function Fv(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===Ov||i===zv;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===Ov||i===zv;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function OF(e,t){const n={type:"text",value:LF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function zF(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const FF={blockquote:pF,break:mF,code:gF,delete:yF,emphasis:vF,footnoteReference:xF,heading:wF,html:_F,imageReference:bF,image:kF,inlineCode:SF,linkReference:CF,link:EF,listItem:TF,list:RF,paragraph:PF,root:jF,strong:AF,table:NF,tableCell:DF,tableRow:MF,text:OF,thematicBreak:zF,toml:yl,yaml:yl,definition:yl,footnoteDefinition:yl};function yl(){}const m1=-1,vc=0,Yo=1,Ou=2,fm=3,hm=4,pm=5,mm=6,g1=7,y1=8,BF=typeof self=="object"?self:globalThis,Bv=(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 BF[e](t)},$F=(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 vc:case m1:return n(o,s);case Yo:{const a=n([],s);for(const l of o)a.push(r(l));return a}case Ou:{const a=n({},s);for(const[l,u]of o)a[r(l)]=r(u);return a}case fm:return n(new Date(o),s);case hm:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case pm:{const a=n(new Map,s);for(const[l,u]of o)a.set(r(l),r(u));return a}case mm:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case g1:{const{name:a,message:l}=o;return n(Bv(a,l),s)}case y1: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(Bv(i,o),s)};return r},$v=e=>$F(new Map,e)(0),li="",{toString:UF}={},{keys:VF}=Object,_o=e=>{const t=typeof e;if(t!=="object"||!e)return[vc,t];const n=UF.call(e).slice(8,-1);switch(n){case"Array":return[Yo,li];case"Object":return[Ou,li];case"Date":return[fm,li];case"RegExp":return[hm,li];case"Map":return[pm,li];case"Set":return[mm,li];case"DataView":return[Yo,n]}return n.includes("Array")?[Yo,n]:n.includes("Error")?[g1,n]:[Ou,n]},vl=([e,t])=>e===vc&&(t==="function"||t==="symbol"),HF=(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]=_o(o);switch(a){case vc:{let c=o;switch(l){case"bigint":a=y1,c=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return s([m1],o)}return s([a,c],o)}case Yo:{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 Ou:{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 VF(o))(e||!vl(_o(o[h])))&&c.push([i(h),i(o[h])]);return f}case fm:return s([a,o.toISOString()],o);case hm:{const{source:c,flags:f}=o;return s([a,{source:c,flags:f}],o)}case pm:{const c=[],f=s([a,c],o);for(const[h,p]of o)(e||!(vl(_o(h))||vl(_o(p))))&&c.push([i(h),i(p)]);return f}case mm:{const c=[],f=s([a,c],o);for(const h of o)(e||!vl(_o(h)))&&c.push(i(h));return f}}const{message:u}=o;return s([a,{name:l,message:u}],o)};return i},Uv=(e,{json:t,lossy:n}={})=>{const r=[];return HF(!(t||n),!!t,new Map,r)(e),r},zu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?$v(Uv(e,t)):structuredClone(e):(e,t)=>$v(Uv(e,t));function WF(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 KF(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function qF(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||WF,r=e.options.footnoteBackLabel||KF,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=ao(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 x=typeof n=="string"?n:n(l,p);typeof x=="string"&&(x={type:"text",value:x}),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(x)?x:[x]})}const _=c[c.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const x=_.children[_.children.length-1];x&&x.type==="text"?x.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...g)}else c.push(...g);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(c,!0)};e.patch(u,v),a.push(v)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...zu(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 xc=function(e){if(e==null)return XF;if(typeof e=="function")return wc(e);if(typeof e=="object")return Array.isArray(e)?GF(e):YF(e);if(typeof e=="string")return QF(e);throw new Error("Expected function, string, or object as test")};function GF(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=xc(e[n]);return wc(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function YF(e){const t=e;return wc(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function QF(e){return wc(t);function t(n){return n&&n.type===e}}function wc(e){return t;function t(n,r,s){return!!(JF(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function XF(){return!0}function JF(e){return e!==null&&typeof e=="object"&&"type"in e}const v1=[],ZF=!0,uh=!1,eB="skip";function x1(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=xc(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=v1,g,y,_;if((!t||i(l,u,c[c.length-1]||void 0))&&(p=tB(n(l,c)),p[0]===uh))return p;if("children"in l&&l.children){const v=l;if(v.children&&p[0]!==eB)for(y=(r?v.children.length:-1)+o,_=c.concat(v);y>-1&&y<v.children.length;){const x=v.children[y];if(g=a(x,y,_)(),g[0]===uh)return g;y=typeof g[1]=="number"?g[1]:y+o}}return p}}}function tB(e){return Array.isArray(e)?e:typeof e=="number"?[ZF,e]:e==null?v1:[e]}function gm(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),x1(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 ch={}.hasOwnProperty,nB={};function rB(e,t){const n=t||nB,r=new Map,s=new Map,i=new Map,o={...FF,...n.handlers},a={all:u,applyData:iB,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:sB,wrap:aB};return gm(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(ch.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,..._}=c,v=zu(_);return v.children=a.all(c),v}return zu(c)}return(a.options.unknownHandler||oB)(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=Vv(g.value)),!Array.isArray(g)&&g.type==="element")){const y=g.children[0];y&&y.type==="text"&&(y.value=Vv(y.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function sB(e,t){e.position&&(t.position=WL(e))}function iB(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,zu(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function oB(e,t){const n=t.data||{},r="value"in t&&!(ch.call(n,"hProperties")||ch.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 aB(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 Vv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Hv(e,t){const n=rB(e,t),r=n.one(e,void 0),s=qF(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 lB(e,t){return e&&"run"in e?async function(n,r){const s=Hv(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Hv(n,{file:r,...e||t})}}function Wv(e){if(e)throw e}var Vl=Object.prototype.hasOwnProperty,w1=Object.prototype.toString,Kv=Object.defineProperty,qv=Object.getOwnPropertyDescriptor,Gv=function(t){return typeof Array.isArray=="function"?Array.isArray(t):w1.call(t)==="[object Array]"},Yv=function(t){if(!t||w1.call(t)!=="[object Object]")return!1;var n=Vl.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Vl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Vl.call(t,s)},Qv=function(t,n){Kv&&n.name==="__proto__"?Kv(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Xv=function(t,n){if(n==="__proto__")if(Vl.call(t,n)){if(qv)return qv(t,n).value}else return;return t[n]},uB=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=Xv(a,n),s=Xv(t,n),a!==s&&(c&&s&&(Yv(s)||(i=Gv(s)))?(i?(i=!1,o=r&&Gv(r)?r:[]):o=r&&Yv(r)?r:{},Qv(a,{name:n,newValue:e(c,o,s)})):typeof s<"u"&&Qv(a,{name:n,newValue:s}));return a};const xd=Ia(uB);function dh(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 cB(){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?dB(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 dB(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 Jn={basename:fB,dirname:hB,extname:pB,join:mB,sep:"/"};function fB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fa(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 hB(e){if(Fa(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 pB(e){Fa(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 mB(...e){let t=-1,n;for(;++t<e.length;)Fa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":gB(n)}function gB(e){Fa(e);const t=e.codePointAt(0)===47;let n=yB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function yB(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 Fa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const vB={cwd:xB};function xB(){return"/"}function fh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wB(e){if(typeof e=="string")e=new URL(e);else if(!fh(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 _B(e)}function _B(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 wd=["history","path","basename","stem","extname","dirname"];class _1{constructor(t){let n;t?fh(t)?n={path:t}:typeof t=="string"||bB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":vB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wd.length;){const i=wd[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)wd.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Jn.basename(this.path):void 0}set basename(t){bd(t,"basename"),_d(t,"basename"),this.path=Jn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Jn.dirname(this.path):void 0}set dirname(t){Jv(this.basename,"dirname"),this.path=Jn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Jn.extname(this.path):void 0}set extname(t){if(_d(t,"extname"),Jv(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=Jn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){fh(t)&&(t=wB(t)),bd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Jn.basename(this.path,this.extname):void 0}set stem(t){bd(t,"stem"),_d(t,"stem"),this.path=Jn.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 Pt(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 _d(e,t){if(e&&e.includes(Jn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Jn.sep+"`")}function bd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Jv(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function bB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kB=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},SB={}.hasOwnProperty;class ym extends kB{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=cB()}copy(){const t=new ym;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(xd(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Cd("data",this.frozen),this.namespace[t]=n,this):SB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Cd("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=xl(t),r=this.parser||this.Parser;return kd("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),kd("process",this.parser||this.Parser),Sd("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=xl(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);TB(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(),kd("processSync",this.parser||this.Parser),Sd("processSync",this.compiler||this.Compiler),this.process(t,s),ex("processSync","process",n),r;function s(i,o){n=!0,Wv(i),r=o}}run(t,n,r){Zv(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=xl(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),ex("runSync","run",r),s;function i(o,a){Wv(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=xl(n),s=this.compiler||this.Compiler;return Sd("stringify",s),Zv(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Cd("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=xd(!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];dh(y)&&dh(p)&&(p=xd(!0,y,p)),r[h]=[u,p,...g]}}}}const CB=new ym().freeze();function kd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Sd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Cd(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 Zv(e){if(!dh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ex(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xl(e){return EB(e)?e:new _1(e)}function EB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function TB(e){return typeof e=="string"||IB(e)}function IB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const RB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",tx=[],nx={allowDangerousHtml:!0},PB=/^(https?|ircs?|mailto|xmpp)$/i,jB=[{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 AB(e){const t=NB(e),n=MB(e);return DB(t.runSync(t.parse(n),n),e)}function NB(e){const t=e.rehypePlugins||tx,n=e.remarkPlugins||tx,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nx}:nx;return CB().use(hF).use(n).use(lB,r).use(t)}function MB(e){const t=e.children||"",n=new _1;return typeof t=="string"&&(n.value=t),n}function DB(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||LB;for(const c of jB)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+RB+c.id,void 0);return gm(e,u),QL(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 gd)if(Object.hasOwn(gd,p)&&Object.hasOwn(c.properties,p)){const g=c.properties[p],y=gd[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 LB(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||PB.test(e.slice(0,t))?e:""}const{useSmooth:OB,useSmoothStatus:zB,withSmoothContextProvider:FB}=lM,BB=({components:e,componentsByLanguage:t,smooth:n=!0,preprocess:r,...s})=>{const i=ak(),{text:o}=OB(m.useMemo(()=>r?{...i,text:r(i.text)}:i,[i,r]),n),{pre:a=KD,code:l=qD,SyntaxHighlighter:u=tm,CodeHeader:c=GD}=e??{},f=m.useMemo(()=>({Pre:a,Code:l,SyntaxHighlighter:u,CodeHeader:c}),[a,l,u,c]),h=Us(p=>d.jsx(ZD,{components:f,componentsByLanguage:t,...p}));return d.jsx(AB,{components:m.useMemo(()=>{const{pre:p,code:g,SyntaxHighlighter:y,CodeHeader:_,...v}=e??{};return{...v,pre:WD,code:h}},[h,e]),...s,children:o})},b1=m.forwardRef(({className:e,containerProps:t,containerComponent:n="div",...r},s)=>d.jsx(n,{"data-status":zB().type,...t,className:FS(e,t?.className),ref:s,children:d.jsx(BB,{...r})}));b1.displayName="MarkdownTextPrimitive";const $B=FB(b1);function rx(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 UB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function VB(e,t,n){const s=xc((n||{}).ignore||[]),i=HB(t);let o=-1;for(;++o<i.length;)x1(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 _=f.children.indexOf(u);let v=!1,x=[];h.lastIndex=0;let w=h.exec(u.value);for(;w;){const C=w.index,k={index:w.index,input:w.input,stack:[...c,u]};let S=p(...w,k);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=C+1:(g!==C&&x.push({type:"text",value:u.value.slice(g,C)}),Array.isArray(S)?x.push(...S):S&&x.push(S),g=C+w[0].length,v=!0),!h.global)break;w=h.exec(u.value)}return v?(g<u.value.length&&x.push({type:"text",value:u.value.slice(g)}),f.children.splice(_,1,...x)):x=[u],_+x.length}}function HB(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([WB(s[0]),KB(s[1])])}return t}function WB(e){return typeof e=="string"?new RegExp(UB(e),"g"):e}function KB(e){return typeof e=="function"?e:function(){return e}}const Ed="phrasing",Td=["autolink","link","image","label"];function qB(){return{transforms:[e4],enter:{literalAutolink:YB,literalAutolinkEmail:Id,literalAutolinkHttp:Id,literalAutolinkWww:Id},exit:{literalAutolink:ZB,literalAutolinkEmail:JB,literalAutolinkHttp:QB,literalAutolinkWww:XB}}}function GB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ed,notInConstruct:Td},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ed,notInConstruct:Td},{character:":",before:"[ps]",after:"\\/",inConstruct:Ed,notInConstruct:Td}]}}function YB(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Id(e){this.config.enter.autolinkProtocol.call(this,e)}function QB(e){this.config.exit.autolinkProtocol.call(this,e)}function XB(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 JB(e){this.config.exit.autolinkEmail.call(this,e)}function ZB(e){this.exit(e)}function e4(e){VB(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,t4],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,n4]],{ignore:["link","linkReference"]})}function t4(e,t,n,r,s){let i="";if(!k1(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!r4(n)))return!1;const o=s4(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 n4(e,t,n,r){return!k1(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function r4(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 s4(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=rx(e,"(");let i=rx(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 k1(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Vs(n)||gc(n))&&(!t||n!==47)}S1.peek=h4;function i4(){this.buffer()}function o4(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function a4(){this.buffer()}function l4(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function u4(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function c4(e){this.exit(e)}function d4(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function f4(e){this.exit(e)}function h4(){return"["}function S1(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 p4(){return{enter:{gfmFootnoteCallString:i4,gfmFootnoteCall:o4,gfmFootnoteDefinitionLabelString:a4,gfmFootnoteDefinition:l4},exit:{gfmFootnoteCallString:u4,gfmFootnoteCall:c4,gfmFootnoteDefinitionLabelString:d4,gfmFootnoteDefinition:f4}}}function m4(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:S1},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?C1:g4))),u(),l}}function g4(e,t,n){return t===0?e:C1(e,t,n)}function C1(e,t,n){return(n?"":" ")+e}const y4=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];E1.peek=b4;function v4(){return{canContainEols:["delete"],enter:{strikethrough:w4},exit:{strikethrough:_4}}}function x4(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:y4}],handlers:{delete:E1}}}function w4(e){this.enter({type:"delete",children:[]},e)}function _4(e){this.exit(e)}function E1(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 b4(){return"~"}function k4(e){return e.length}function S4(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||k4,i=[],o=[],a=[],l=[];let u=0,c=-1;for(;++c<e.length;){const y=[],_=[];let v=-1;for(e[c].length>u&&(u=e[c].length);++v<e[c].length;){const x=C4(e[c][v]);if(n.alignDelimiters!==!1){const w=s(x);_[v]=w,(l[v]===void 0||w>l[v])&&(l[v]=w)}y.push(x)}o[c]=y,a[c]=_}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)i[f]=sx(r[f]);else{const y=sx(r);for(;++f<u;)i[f]=y}f=-1;const h=[],p=[];for(;++f<u;){const y=i[f];let _="",v="";y===99?(_=":",v=":"):y===108?_=":":y===114&&(v=":");let x=n.alignDelimiters===!1?1:Math.max(1,l[f]-_.length-v.length);const w=_+"-".repeat(x)+v;n.alignDelimiters!==!1&&(x=_.length+x+v.length,x>l[f]&&(l[f]=x),p[f]=x),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],_=a[c];f=-1;const v=[];for(;++f<u;){const x=y[f]||"";let w="",C="";if(n.alignDelimiters!==!1){const k=l[f]-(_[f]||0),S=i[f];S===114?w=" ".repeat(k):S===99?k%2?(w=" ".repeat(k/2+.5),C=" ".repeat(k/2-.5)):(w=" ".repeat(k/2),C=w):C=" ".repeat(k)}n.delimiterStart!==!1&&!f&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&x==="")&&(n.delimiterStart!==!1||f)&&v.push(" "),n.alignDelimiters!==!1&&v.push(w),v.push(x),n.alignDelimiters!==!1&&v.push(C),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&v.push("|")}g.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return g.join(`
77
+ `)}function C4(e){return e==null?"":String(e)}function sx(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 E4(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()),T4);return s(),o}function T4(e,t,n){return">"+(n?"":" ")+e}function I4(e,t){return ix(e,t.inConstruct,!0)&&!ix(e,t.notInConstruct,!1)}function ix(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 ox(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
78
+ `&&I4(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
79
+ `}function R4(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 P4(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 j4(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 A4(e,t,n,r){const s=j4(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(P4(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,N4);return f(),h}const a=n.createTracker(r),l=s.repeat(Math.max(R4(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 N4(e,t,n){return(n?"":" ")+e}function vm(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 M4(e,t,n,r){const s=vm(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 D4(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 Ea(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Fu(e,t,n){const r=Xi(e),s=Xi(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}}T1.peek=L4;function T1(e,t,n,r){const s=D4(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=Fu(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=Ea(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=Fu(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+Ea(f));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function L4(e,t,n){return n.options.emphasis||"*"}function O4(e,t){let n=!1;return gm(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,uh}),!!((!e.depth||e.depth<3)&&um(e)&&(t.options.setext||n))}function z4(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(O4(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=Ea(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}I1.peek=F4;function I1(e){return e.value||""}function F4(){return"<"}R1.peek=B4;function R1(e,t,n,r){const s=vm(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 B4(){return"!"}P1.peek=$4;function P1(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 $4(){return"!"}j1.peek=U4;function j1(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 U4(){return"`"}function A1(e,t){const n=um(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))}N1.peek=V4;function N1(e,t,n,r){const s=vm(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(A1(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 V4(e,t,n){return A1(e,n)?"<":"["}M1.peek=H4;function M1(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 H4(){return"["}function xm(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 W4(e){const t=xm(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 K4(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 D1(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 q4(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?K4(n):xm(n);const a=e.ordered?o==="."?")":".":W4(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),D1(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 G4(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 Y4(e,t,n,r){const s=G4(n);let i=n.bulletCurrent||xm(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 Q4(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const X4=xc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function J4(e,t,n,r){return(e.children.some(function(o){return X4(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Z4(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}L1.peek=e3;function L1(e,t,n,r){const s=Z4(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=Fu(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=Ea(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=Fu(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+Ea(f));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function e3(e,t,n){return n.options.strong||"*"}function t3(e,t,n,r){return n.safe(e.value,r)}function n3(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 r3(e,t,n){const r=(D1(n)+(n.options.ruleSpaces?" ":"")).repeat(n3(n));return n.options.ruleSpaces?r.slice(0,-1):r}const O1={blockquote:E4,break:ox,code:A4,definition:M4,emphasis:T1,hardBreak:ox,heading:z4,html:I1,image:R1,imageReference:P1,inlineCode:j1,link:N1,linkReference:M1,list:q4,listItem:Y4,paragraph:Q4,root:J4,strong:L1,text:t3,thematicBreak:r3};function s3(){return{enter:{table:i3,tableData:ax,tableHeader:ax,tableRow:a3},exit:{codeText:l3,table:o3,tableData:Rd,tableHeader:Rd,tableRow:Rd}}}function i3(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 o3(e){this.exit(e),this.data.inTable=void 0}function a3(e){this.enter({type:"tableRow",children:[]},e)}function Rd(e){this.exit(e)}function ax(e){this.enter({type:"tableCell",children:[]},e)}function l3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,u3));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function u3(e,t){return t==="|"?t:e}function c3(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,_){return u(c(p,y,_),p.align)}function a(p,g,y,_){const v=f(p,y,_),x=u([v]);return x.slice(0,x.indexOf(`
90
+ `))}function l(p,g,y,_){const v=y.enter("tableCell"),x=y.enter("phrasing"),w=y.containerPhrasing(p,{..._,before:i,after:i});return x(),v(),w}function u(p,g){return S4(p,{align:g,alignDelimiters:r,padding:n,stringLength:s})}function c(p,g,y){const _=p.children;let v=-1;const x=[],w=g.enter("table");for(;++v<_.length;)x[v]=f(_[v],g,y);return w(),x}function f(p,g,y){const _=p.children;let v=-1;const x=[],w=g.enter("tableRow");for(;++v<_.length;)x[v]=l(_[v],p,g,y);return w(),x}function h(p,g,y){let _=O1.inlineCode(p,g,y);return y.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function d3(){return{exit:{taskListCheckValueChecked:lx,taskListCheckValueUnchecked:lx,paragraph:h3}}}function f3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:p3}}}function lx(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function h3(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 p3(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=O1.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 m3(){return[qB(),p4(),v4(),s3(),d3()]}function g3(e){return{extensions:[GB(),m4(e),x4(),c3(e),f3()]}}const y3={tokenize:k3,partial:!0},z1={tokenize:S3,partial:!0},F1={tokenize:C3,partial:!0},B1={tokenize:E3,partial:!0},v3={tokenize:T3,partial:!0},$1={name:"wwwAutolink",tokenize:_3,previous:V1},U1={name:"protocolAutolink",tokenize:b3,previous:H1},Pr={name:"emailAutolink",tokenize:w3,previous:W1},fr={};function x3(){return{text:fr}}let xs=48;for(;xs<123;)fr[xs]=Pr,xs++,xs===58?xs=65:xs===91&&(xs=97);fr[43]=Pr;fr[45]=Pr;fr[46]=Pr;fr[95]=Pr;fr[72]=[Pr,U1];fr[104]=[Pr,U1];fr[87]=[Pr,$1];fr[119]=[Pr,$1];function w3(e,t,n){const r=this;let s,i;return o;function o(f){return!hh(f)||!W1.call(r,r.previous)||wm(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(f))}function a(f){return hh(f)?(e.consume(f),a):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(v3,c,u)(f):f===45||f===95||Tt(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&&Mt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function _3(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!V1.call(r,r.previous)||wm(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(y3,e.attempt(z1,e.attempt(F1,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function b3(e,t,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&H1.call(r,r.previous)&&!wm(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),a):n(f)}function a(f){if(Mt(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||Lu(f)||Pe(f)||Vs(f)||gc(f)?n(f):e.attempt(z1,e.attempt(F1,c),n)(f)}function c(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function k3(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 S3(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(B1,l,a)(u):u===null||Pe(u)||Vs(u)||u!==45&&gc(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 C3(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(B1,t,i)(o):o===null||Pe(o)||Vs(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function E3(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||Pe(a)||Vs(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||Pe(a)||Vs(a)?t(a):r(a)}function i(a){return Mt(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Mt(a)?(e.consume(a),o):n(a)}}function T3(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return Tt(i)?n(i):t(i)}}function V1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pe(e)}function H1(e){return!Mt(e)}function W1(e){return!(e===47||hh(e))}function hh(e){return e===43||e===45||e===46||e===95||Tt(e)}function wm(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 I3={tokenize:L3,partial:!0};function R3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:N3,continuation:{tokenize:M3},exit:D3}},text:{91:{name:"gfmFootnoteCall",tokenize:A3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:P3,resolveTo:j3}}}}function P3(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=Vn(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 j3(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 A3(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||Pe(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(Vn(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Pe(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 N3(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||Pe(g))return n(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Vn(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Pe(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),_e(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function M3(e,t,n){return e.check(za,t,e.attempt(I3,t,n))}function D3(e){e.exit("gfmFootnoteDefinition")}function L3(e,t,n){const r=this;return _e(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 O3(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&&un(h,h.length,0,yc(p,o.slice(u+1,l),a)),un(h,h.length,0,[["exit",f,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",c,a]]),un(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=Xi(u);if(g===126)return f>1?l(g):(o.consume(g),f++,p);if(f<2&&!n)return l(g);const _=o.exit("strikethroughSequenceTemporary"),v=Xi(g);return _._open=!v||v===2&&!!y,_._close=!y||y===2&&!!v,a(g)}}}class z3{constructor(){this.map=[]}add(t,n,r){F3(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 F3(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 B3(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 $3(){return{flow:{null:{name:"table",tokenize:U3,resolveAll:V3}}}}function U3(e,t,n){const r=this;let s=0,i=0,o;return a;function a(E){let D=r.events.length-1;for(;D>-1;){const Q=r.events[D][1].type;if(Q==="lineEnding"||Q==="linePrefix")D--;else break}const M=D>-1?r.events[D][1].type:null,B=M==="tableHead"||M==="tableRow"?S:l;return B===S&&r.parser.lazy[r.now().line]?n(E):B(E)}function l(E){return e.enter("tableHead"),e.enter("tableRow"),u(E)}function u(E){return E===124||(o=!0,i+=1),c(E)}function c(E){return E===null?n(E):re(E)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):n(E):me(E)?_e(e,c,"whitespace")(E):(i+=1,o&&(o=!1,s+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,c):(e.enter("data"),f(E)))}function f(E){return E===null||E===124||Pe(E)?(e.exit("data"),c(E)):(e.consume(E),E===92?h:f)}function h(E){return E===92||E===124?(e.consume(E),f):f(E)}function p(E){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(E):(e.enter("tableDelimiterRow"),o=!1,me(E)?_e(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):g(E))}function g(E){return E===45||E===58?_(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),y):k(E)}function y(E){return me(E)?_e(e,_,"whitespace")(E):_(E)}function _(E){return E===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),v):E===45?(i+=1,v(E)):E===null||re(E)?C(E):k(E)}function v(E){return E===45?(e.enter("tableDelimiterFiller"),x(E)):k(E)}function x(E){return E===45?(e.consume(E),x):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(E))}function w(E){return me(E)?_e(e,C,"whitespace")(E):C(E)}function C(E){return E===124?g(E):E===null||re(E)?!o||s!==i?k(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):k(E)}function k(E){return n(E)}function S(E){return e.enter("tableRow"),T(E)}function T(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),T):E===null||re(E)?(e.exit("tableRow"),t(E)):me(E)?_e(e,T,"whitespace")(E):(e.enter("data"),I(E))}function I(E){return E===null||E===124||Pe(E)?(e.exit("data"),T(E)):(e.consume(E),E===92?P:I)}function P(E){return E===92||E===124?(e.consume(E),I):I(E)}}function V3(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 z3;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(ux(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=wl(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=wl(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=wl(h,t,i,s,n,f)):o[1]!==0&&(f=wl(h,t,o,s,n,f)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&ux(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=B3(t.events,n))}return e}function wl(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},ui(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=ui(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=ui(t.events,n[2]),c=ui(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({},ui(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function ux(e,t,n,r,s){const i=[],o=ui(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 ui(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const H3={name:"tasklistCheck",tokenize:K3};function W3(){return{text:{91:H3}}}function K3(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 Pe(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 re(l)?t(l):me(l)?e.check({tokenize:q3},t,n)(l):n(l)}}function q3(e,t,n){return _e(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function G3(e){return e1([x3(),R3(),O3(e),$3(),W3()])}const Y3={};function Q3(e){const t=this,n=e||Y3,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(G3(n)),i.push(m3()),o.push(g3(n))}const X3="modulepreload",J3=function(e,t){return new URL(e,t).href},cx={},Qn=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=J3(u,r),u in cx)return;cx[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":X3,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)})},Z3={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 _m(e){return e?Z3[e.trim().toLowerCase()]??null:null}let Pd=null;async function e$(){return Pd||(Pd=(async()=>{const{default:e}=await Qn(async()=>{const{default:c}=await import("./core-CEtbx-dx.js");return{default:c}},[],import.meta.url),[t,n,r,s,i,o,a,l,u]=await Promise.all([Qn(()=>import("./typescript-C2FFdlUC.js"),[],import.meta.url),Qn(()=>import("./javascript-BKRaQes9.js"),[],import.meta.url),Qn(()=>import("./json-DIYVocXf.js"),[],import.meta.url),Qn(()=>import("./bash-I8pq0VWm.js"),[],import.meta.url),Qn(()=>import("./python-sE43i1Pi.js"),[],import.meta.url),Qn(()=>import("./diff-DiTmLxSS.js"),[],import.meta.url),Qn(()=>import("./markdown-BrP960CR.js"),[],import.meta.url),Qn(()=>import("./xml-BXBhIUeX.js"),[],import.meta.url),Qn(()=>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})()),Pd}async function K1(e,t){const n=_m(e);if(!n)return null;try{const r=await e$(),{value:s}=r.highlight(t,{language:n,ignoreIllegals:!0});return s}catch{return null}}function t$(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 n$(e,t){return"code-"+t$((e??"")+`
91
+ `+t)}const dx=8,q1=m.createContext(null);function bm(){const e=m.useContext(q1);if(!e)throw new Error("useArtifactPanel must be used inside <ArtifactPanelProvider>");return e}function r$(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>dx?r.slice(0,dx):r,activeId:t.id}}function s$(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 i$({children:e}){const[t,n]=m.useState({artifacts:[],activeId:null}),r=m.useCallback(a=>{n(l=>r$(l,a))},[]),s=m.useCallback(a=>{n(l=>({...l,activeId:a}))},[]),i=m.useCallback(a=>{n(l=>s$(l,a))},[]),o=m.useMemo(()=>({artifacts:t.artifacts,activeId:t.activeId,open:r,setActive:s,close:i}),[t,r,s,i]);return d.jsx(q1.Provider,{value:o,children:e})}const o$=({language:e,code:t})=>{const{open:n}=bm();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:n$(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]})},a$=({components:e,language:t,code:n})=>{const{Pre:r,Code:s}=e,i=_m(t)!==null,[o,a]=m.useState(null);return m.useEffect(()=>{if(!i){a(null);return}let l=!0;return a(null),K1(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})})},l$=({node:e,...t})=>d.jsx("div",{className:"md-table-wrap",children:d.jsx("table",{...t})}),u$=()=>d.jsx($B,{className:"aui-md",remarkPlugins:[Q3],components:{CodeHeader:o$,SyntaxHighlighter:a$,table:l$}}),c$=m.memo(u$);function d$(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=!1,s=null;return nt(TM(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 f$=new Set([".jpg",".jpeg",".png",".gif",".webp",".avif",".heic",".heif",".svg"]),fx=/(?:^|\s)(\/[^\s]*\/\.claude-control\/uploads\/([^\s]+))/g;function h$(e){const t=[],n=new Set;let r;for(fx.lastIndex=0;(r=fx.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:f$.has(o)})}return t}function G1({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 p$({ref_:e}){const[t,n]=m.useState(!1),r=d$(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(G1,{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 m$({text:e}){const t=h$(e);return t.length===0?null:d.jsx("div",{className:"transcript-attachments","aria-label":"Attachments",children:t.map(n=>d.jsx(p$,{ref_:n},n.fullPath))})}function g$(e){return e.trimStart().startsWith("Base directory for this skill:")}function y$(e){const n=e.trim().replace(/\/SKILL\.md$/i,"").split("/").filter(Boolean);return n[n.length-1]??"skill"}function v$(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 x$(e){const t=e.trimStart().split(`
94
+ `),s=(t[0]??"").match(/Base directory for this skill:\s*(.+)/)?.[1]??"",i=y$(s),o=t.slice(1).join(`
95
+ `).trimStart(),{entries:a,rest:l}=v$(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 w$={UserMessage:Ba,AssistantMessage:dr,SystemMessage:dr};function _$({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"skill-body",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ma({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Da,{runtime:n,children:d.jsx(vt.Root,{className:"skill-body-thread",children:d.jsx(vt.Viewport,{className:"skill-body-viewport",children:d.jsx(vt.Messages,{components:w$})})})})}function b$({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(_$,{markdown:e.body})})]})]})})}function k$({text:e}){const[t,n]=m.useState(!1),r=m.useMemo(()=>x$(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(b$,{parsed:r,onClose:()=>n(!1)})]})}const S$=/^\s*working…?\s*$/i,C$=e=>typeof e.text=="string"&&S$.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:d.jsx(Jp,{size:14})}),d.jsx("span",{className:"shimmer-text",children:"Working…"})]}):typeof e.text=="string"&&g$(e.text)?d.jsx(k$,{text:e.text}):d.jsxs(d.Fragment,{children:[d.jsx(c$,{...e}),typeof e.text=="string"?d.jsx(m$,{text:e.text}):null]}),hx=90;function E$(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>hx?r.slice(0,hx-1)+"…":r}return""}function T$(e){const t=jk(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 I$=({toolCallId:e,toolName:t,args:n,result:r})=>{const{open:s}=bm(),[i,o]=m.useState(!1),a=KM(n),l=T$(n),u=qM(r),c=l.length>0||u!=null,f=jk(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,_=()=>{y&&s({id:e,kind:"tool",title:t+(a?` — ${a}`:""),language:p,content:g,filePath:h})},v=y?d.jsx("button",{type:"button",className:"tool-name tool-name-btn",onClick:_,title:"Open in side panel",children:t}):d.jsx("span",{className:"tool-name",children:t}),x=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:"▸"}),v,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:x}),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]})},Y1=m.createContext(null);function R$(){return m.useContext(Y1)}function P$(){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 j$(){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 Q1(){return d.jsx(Iy.Root,{className:"msg-actions",children:d.jsxs(Iy.Copy,{className:"act-btn","aria-label":"Copy message",children:[d.jsxs("span",{className:"act-copy-idle",children:[d.jsx(P$,{})," copy"]}),d.jsxs("span",{className:"act-copy-done",children:[d.jsx(j$,{})," copied"]})]})})}const A$=new Set(["AskUserQuestion","ExitPlanMode"]);function N$(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&&A$.has(i.toolName)?(r(),t.push({groupKey:void 0,indices:[s]})):n.push(s)}return r(),t}function M$({text:e}){return!e||!e.trim()?null:d.jsx("div",{className:"cot-reasoning thinking-text",children:e})}const X1={Text:C$,Reasoning:M$,tools:{Fallback:I$}};function D$({indices:e,children:t}){const n=bu(y=>y.id),r=R$(),s=!!r&&n===r,[i,o]=m.useState(!1),a=s||i,l=bu(y=>y.content);let u=0,c=0,f="";for(const y of e){const _=l[y];_&&(_.type==="reasoning"?(u+=1,_.text?.trim()&&(f=_.text)):_.type==="tool-call"&&(c+=1))}const h=u+c,p=u>0?"chain of thought":`${c} tool call${c===1?"":"s"}`,g=E$(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(LS,{text:g}):g}):null]}),a?d.jsx("div",{className:"cot-body",children:t}):null]})}function L$(){return d.jsx(Su.Unstable_PartsGrouped,{groupingFunction:N$,components:{...X1,Group:({groupKey:e,indices:t,children:n})=>e?d.jsx(D$,{indices:t,children:n}):d.jsx(d.Fragment,{children:n})}})}function Ba(){return d.jsxs(Su.Root,{className:"msg-row","data-role":"user",children:[d.jsx("div",{className:"msg-body",children:d.jsx(Su.Parts,{components:X1})}),d.jsx(Q1,{})]})}function dr(){const e=bu(n=>n.metadata?.custom?.cockpitRole)??"assistant",t=bu(n=>n.metadata?.custom?.working);return d.jsxs(Su.Root,{className:"msg-row","data-role":e,children:[d.jsx("div",{className:"msg-body",children:d.jsx(L$,{})}),!t&&d.jsx(Q1,{})]})}function Fr({children:e}){return d.jsx("kbd",{className:"kbd",children:e})}const px=1.8;function O$(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 z$(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 F$({original:e,result:t,onSend:n,onAccept:r,onClose:s}){const{rootRef:i,requestClose:o}=Js(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 v=setTimeout(()=>p.current(h.current),px*1e3);return()=>clearTimeout(v)},[c]),m.useEffect(()=>{const v=x=>{x.key==="Escape"?(x.preventDefault(),o()):x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),p.current(h.current))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[o]);const y=z$(e,t.optimized),_=y.some(v=>v.kind!=="same");return d.jsx("div",{className:"modal-backdrop",ref:i,onClick:v=>{v.target===v.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:O$(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:v=>{l(v.target.value),g()},rows:6,spellCheck:!1,autoComplete:"off"})]}),_?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((v,x)=>d.jsxs("div",{className:v.kind==="add"?"diff-add":v.kind==="del"?"diff-del":"diff-same",children:[v.kind==="add"?"+ ":v.kind==="del"?"- ":" ",v.text||" "]},x))})]}):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((v,x)=>d.jsx("li",{children:v},x))})]}):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((v,x)=>d.jsx("li",{children:v},x))})]}):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":`${px}s`}:void 0,onClick:()=>n(a),children:d.jsxs("span",{className:"btn-send-label",children:["Send ",d.jsx(Fr,{children:"⌘/Ctrl+↵"})]})})]})]})})}const mx="(max-width:760px)";function km(){const[e,t]=m.useState(()=>typeof window>"u"?!1:window.matchMedia(mx).matches);return m.useEffect(()=>{if(typeof window>"u")return;const n=window.matchMedia(mx),r=s=>t(s.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}function B$({onPick:e,onClose:t,sessionId:n}){const{rootRef:r,requestClose:s}=Js(t),i=km(),[o,a]=m.useState([]),[l,u]=m.useState(!0),[c,f]=m.useState(""),h=m.useRef(null);m.useEffect(()=>{let _=!0;return u(!0),Pk(n).then(v=>{_&&(a(v),u(!1))}).catch(()=>{_&&u(!1)}),()=>{_=!1}},[]),m.useEffect(()=>{requestAnimationFrame(()=>h.current?.focus())},[]),m.useEffect(()=>{const _=v=>{v.key==="Escape"&&(v.preventDefault(),s())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[s]);const p=c.trim().toLowerCase(),g=p?o.filter(_=>_.name.toLowerCase().includes(p)||_.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:_=>f(_.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(_=>d.jsxs("button",{type:"button",className:"skill-card",role:"listitem",onClick:()=>e(_.name),title:`Prefill /${_.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:_.name}),_.description?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input skill-card-desc",children:_.description})]}):null]}),_.source!=="user"?d.jsx("span",{className:"skill-source-tag",children:_.source}):null]},_.name))})]});return i?d.jsx("div",{className:"skill-browser-sheet-wrap",children:y}):d.jsx("div",{className:"modal-backdrop",ref:r,onClick:_=>{_.target===_.currentTarget&&s()},children:y})}function $$(){if(typeof window>"u")return null;const e=window;return e.AudioContext??e.webkitAudioContext??null}function U$(){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 V$({onCommit:e,onClose:t}){const[n,r]=m.useState("starting"),[s,i]=m.useState(null),o=m.useRef(null),a=m.useRef(null),l=m.useRef(null),u=m.useRef(null),c=m.useRef([]),f=m.useRef({mime:"",ext:"webm"}),h=m.useRef(null),p=m.useRef(null),g=m.useRef(!1),y=m.useRef(!1),_=m.useRef(!0),v=m.useRef(null),x=m.useCallback(()=>{g.current=!1,p.current!=null&&cancelAnimationFrame(p.current),p.current=null},[]),w=m.useCallback(()=>{const I=h.current,P=l.current;if(!I||!P)return;const E=I.getContext("2d");if(!E)return;const D=new Uint8Array(P.fftSize),M=getComputedStyle(I).getPropertyValue("--accent").trim()||"#7aa2f7";g.current=!0;const B=()=>{if(!g.current)return;I.width!==I.clientWidth&&(I.width=I.clientWidth),P.getByteTimeDomainData(D);const Q=I.width,U=I.height;E.clearRect(0,0,Q,U),E.lineWidth=2,E.strokeStyle=M,E.beginPath();const te=Q/D.length;for(let Z=0;Z<D.length;Z+=1){const z=D[Z]/128*U/2,b=Z*te;Z===0?E.moveTo(b,z):E.lineTo(b,z)}E.stroke(),p.current=requestAnimationFrame(B)};p.current=requestAnimationFrame(B)},[]),C=m.useCallback(()=>{x(),o.current?.getTracks().forEach(I=>I.stop()),o.current=null,a.current?.close().catch(()=>{}),a.current=null,l.current=null},[x]);m.useEffect(()=>(_.current=!0,()=>{_.current=!1,v.current?.abort(),v.current=null}),[]),m.useEffect(()=>{let I=!1;return(async()=>{try{if(!navigator.mediaDevices?.getUserMedia)throw new Error("no-getusermedia");const P=await navigator.mediaDevices.getUserMedia({audio:!0});if(I){P.getTracks().forEach(B=>B.stop());return}o.current=P;const E=$$();if(E){const B=new E;a.current=B,B.state==="suspended"&&await B.resume();const Q=B.createMediaStreamSource(P),U=B.createAnalyser();U.fftSize=512,Q.connect(U),l.current=U}if(!("MediaRecorder"in window))throw new Error("no-mediarecorder");const D=U$();f.current=D;const M=D.mime?new MediaRecorder(P,{mimeType:D.mime}):new MediaRecorder(P);M.ondataavailable=B=>{B.data&&B.data.size>0&&c.current.push(B.data)},u.current=M,M.start(),r("recording"),w()}catch(P){const E=P instanceof Error?P.message:"",D=P instanceof Error?P.name:"";let M;E==="no-mediarecorder"?M="Audio recording isn't supported in this browser.":!window.isSecureContext||!navigator.mediaDevices?.getUserMedia?M="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"?M='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"?M="No microphone available (or it’s in use by another app).":M="Microphone permission denied or unavailable.",i(M),r("error")}})(),()=>{I=!0,x();try{u.current?.stop()}catch{}u.current=null,o.current?.getTracks().forEach(P=>P.stop()),o.current=null,a.current?.close().catch(()=>{}),a.current=null,l.current=null}},[]);const k=m.useCallback(()=>{if(n==="recording"){try{u.current?.pause()}catch{}x(),r("paused")}else if(n==="paused"){try{u.current?.resume()}catch{}r("recording"),w()}},[n,x,w]),S=m.useCallback(()=>{if(y.current)return;y.current=!0;const I=u.current;if(!I){C(),e("");return}r("transcribing"),I.onstop=async()=>{const{mime:P,ext:E}=f.current,D=new Blob(c.current,{type:P||"audio/webm"});if(C(),D.size===0){e("");return}const M=new AbortController;v.current=M;try{const B=await SM(D,E,M.signal);_.current&&!M.signal.aborted&&e(B)}catch(B){if(B?.name==="AbortError")return;_.current&&!M.signal.aborted&&(i(B instanceof Error?B.message:"Transcription failed."),r("error"))}};try{I.stop()}catch{C(),e("")}},[C,e]),T=m.useCallback(()=>{y.current=!0,v.current?.abort(),v.current=null;const I=u.current;I&&(I.onstop=null);try{I?.stop()}catch{}u.current=null,C(),t()},[C,t]);return{status:n,errorMsg:s,canvasRef:h,pauseResume:k,stop:S,cancel:T}}const ph=["#414868","#f7768e","#9ece6a","#e0af68","#7aa2f7","#bb9af7","#7dcfff","#a9b1d6"],mh=["#565f89","#ff7a93","#b9f27c","#ff9e64","#9bb5ff","#c7a9ff","#a4daff","#c0caf5"];function H$(e){if(e<8)return ph[e];if(e<16)return mh[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 W$(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=ph[r-30];else if(r===39)e.fg=void 0;else if(r>=90&&r<=97)e.fg=mh[r-90];else if(r>=40&&r<=47)e.bg=ph[r-40];else if(r===49)e.bg=void 0;else if(r>=100&&r<=107)e.bg=mh[r-100];else if(r===38||r===48){const s=r===38?"fg":"bg";t[n+1]===5?(e[s]=H$(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 jd=/\x1b\[([0-9;]*)m/g,K$=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,q$=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b[@-Z\\-_]/g,G$=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function Y$(e){const t=String(e).split(`
99
+ `);for(;t.length&&t[t.length-1].replace(G$,"").trim()==="";)t.pop();return t.join(`
100
+ `)}function Q$(e){return e.replace(q$,"")}function X$(e){const t=String(e).replace(K$,""),n=[],r={};let s=0,i;jd.lastIndex=0;const o=a=>{const l=Q$(a);l&&n.push({text:l,...r})};for(;(i=jd.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);W$(r,a),s=jd.lastIndex}return s<t.length&&o(t.slice(s)),n}const gx=/(https?:\/\/[^\s'"`<>()\][]+)/g;function J$(e){const t=[];let n=0,r;for(gx.lastIndex=0;(r=gx.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 yx=400,Z$=800,e5=[{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 J1({output:e,requestCapture:t,clearOutput:n,sendKey:r,mods:s,onToggleMod:i}){const o=m.useRef(null),a=m.useRef(!0);m.useEffect(()=>{t(yx);const c=setInterval(()=>t(yx),Z$);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:X$(Y$(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:J$(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"}),e5.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 t5={output:null,run:()=>!1,text:()=>!1,key:()=>!1,poll:()=>!1,clear:()=>{}},Z1=m.createContext(t5),n5=()=>m.useContext(Z1);function eC(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 Ta=e=>/^[a-z]$/i.test(e);function Bu(e,t){return Ta(t)?e.ctrl?`C-${t.toLowerCase()}`:e.alt?`M-${t.toLowerCase()}`:null:null}const r5={Enter:"Enter",Escape:"Escape"};function tC(e,t=!1){return e==="Tab"?t?"BTab":"Tab":r5[e]??null}const s5={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Home:"Home",End:"End",PageUp:"PPage",PageDown:"NPage"};function nC(e,t){const n=s5[e];return n?`${t.ctrl?"C-":""}${t.alt?"M-":""}${t.shift?"S-":""}`+n:null}function i5(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 $u=new Map,_l=new Map;function o5(e){const t=e??"",n=$u.get(t);if(n)return Promise.resolve(n);const r=_l.get(t);if(r)return r;const s=Pk(e).then(i=>($u.set(t,i),_l.delete(t),i)).catch(()=>(_l.delete(t),[]));return _l.set(t,s),s}const Uu=new Map,bl=new Map;function a5(e){const t=e??"",n=Uu.get(t);if(n)return Promise.resolve(n);const r=bl.get(t);if(r)return r;const s=PM(e).then(i=>(Uu.set(t,i),bl.delete(t),i)).catch(()=>(bl.delete(t),[]));return bl.set(t,s),s}const l5=/^\/([A-Za-z0-9:_-]+)\s/,u5=4;function c5({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(G1,{src:t,alt:e.name,onClose:()=>s(!1)}):null]}):d.jsx("div",{className:"chip-thumb chip-thumb-empty"})}function d5({attachment:e}){const t=e.type==="image",n=e.status.type==="running";return d.jsxs(Ry.Root,{className:"attach-chip","data-pending":n,children:[t&&e.file?d.jsx(c5,{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(Ry.Remove,{className:"chip-remove","aria-label":`Remove ${e.name}`,children:"×"})]})}const vx={optimizing:!1,review:null};function rC({disabled:e,sessionId:t,subAgentMode:n=!0,onSubAgentModeChange:r,onTerminalModeChange:s,working:i=!1,onStop:o}){const a=C0(),l=n5(),[u,c]=m.useState(!0),[f,h]=m.useState(!1),[p,g]=m.useState(!1),[y,_]=m.useState(!1),v=m.useRef(null),x=m.useCallback(()=>{_(!0),g(!0),s?.(!0)},[s]);m.useEffect(()=>{g(!1),_(!1),s?.(!1)},[t]),m.useEffect(()=>{const N=v.current;if(N)if(p){if(N.style.display="",lr()){ft.set(N,{opacity:1,scale:1,y:0});return}ft.fromTo(N,{opacity:0,scale:.95,y:8},{opacity:1,scale:1,y:0,duration:.26,ease:"power3.out",transformOrigin:"bottom center"})}else lr()?N.style.display="none":ft.to(N,{opacity:0,scale:.95,y:8,duration:.18,ease:"power2.in",transformOrigin:"bottom center",onComplete:()=>{N.style.display="none"}})},[p,y]);const[w,C]=m.useState({}),k=t??"",{optimizing:S,review:T}=w[k]??vx,I=m.useCallback((N,$)=>{C(oe=>({...oe,[N]:{...oe[N]??vx,...$}}))},[]),P=m.useCallback(()=>{requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()})},[]),E=m.useRef(null);m.useEffect(()=>{const N=E.current;if(N){if(S&&!lr()){const $=ft.to(N,{scale:1.08,duration:.5,ease:"sine.inOut",repeat:-1,yoyo:!0});return()=>{$.kill(),ft.set(N,{scale:1})}}ft.set(N,{scale:1})}},[S]);const[D,M]=m.useState(()=>$u.get(t??"")??[]),[B,Q]=m.useState(()=>Uu.get(t??"")??[]),[U,te]=m.useState(""),[Z,F]=m.useState(0),[z,b]=m.useState(0),[W,X]=m.useState(!1);m.useEffect(()=>{let N=!0;const $=$u.get(t??"");return $?M($):o5(t).then(oe=>{N&&M(oe)}).catch(()=>{N&&M([])}),()=>{N=!1}},[t]),m.useEffect(()=>{let N=!0;const $=Uu.get(t??"");return $?Q($):a5(t).then(oe=>{N&&Q(oe)}).catch(()=>{N&&Q([])}),()=>{N=!1}},[t]),m.useEffect(()=>{const N=()=>{const $=a.getState().text??"";te($),c(!$.trim());const oe=document.querySelector(".composer-input");oe&&F(oe.selectionStart??$.length)};return N(),a.subscribe(N)},[a]);const R=m.useCallback(N=>{N&&F(N.selectionStart??0)},[]),le=m.useMemo(()=>i5(U,Z),[U,Z]),we=le?le.query:null;m.useEffect(()=>{b(0),X(!1)},[we]);const de=m.useMemo(()=>{if(we==null||W)return[];const N=we.toLowerCase();return(le?.trigger==="@"?B:D).filter(oe=>oe.name.toLowerCase().includes(N)).sort((oe,ke)=>{const pe=oe.name.toLowerCase().startsWith(N)?0:1,Ee=ke.name.toLowerCase().startsWith(N)?0:1;return pe!==Ee?pe-Ee:oe.name.localeCompare(ke.name)}).slice(0,u5)},[we,W,le?.trigger,D,B]),Je=!p&&de.length>0,Ue=m.useMemo(()=>{const N=l5.exec(U);return N&&D.some($=>$.name===N[1])?N[1]:null},[U,D]),Ce=m.useCallback(N=>{const $=le,oe=($?.trigger==="@"?"@":"/")+N+" ";if($){const ke=a.getState().text??"",pe=ke.slice(0,$.start)+oe+ke.slice($.end);a.setText(pe);const Ee=$.start+oe.length;requestAnimationFrame(()=>{const ye=document.querySelector(".composer-input");ye&&(ye.focus(),ye.setSelectionRange(Ee,Ee),F(Ee))})}else a.setText(oe),requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()});X(!0)},[a,le]),[ee,ne]=m.useState(!1),se=m.useCallback(()=>{e||ne(!0)},[e]),he=m.useCallback(()=>{ne(!1)},[]);m.useEffect(()=>{const N=$=>{$.key.toLowerCase()!=="s"||!($.metaKey||$.ctrlKey)||$.shiftKey||$.altKey||e||document.querySelector('[aria-modal="true"]')||($.preventDefault(),ee?he():se())};return window.addEventListener("keydown",N,!0),()=>window.removeEventListener("keydown",N,!0)},[e,ee,se,he]),m.useEffect(()=>{const N=$=>{$.key.toLowerCase()!=="d"||!($.metaKey||$.ctrlKey)||$.shiftKey||$.altKey||e||document.querySelector('[aria-modal="true"]')||p||($.preventDefault(),r?.(!n))};return window.addEventListener("keydown",N,!0),()=>window.removeEventListener("keydown",N,!0)},[e,p,n,r]);const mt=m.useCallback(N=>{he();const $=N.trim();if(!$)return;const oe=a.getState().text??"",ke=oe&&!/\s$/.test(oe)?" ":"";a.setText(oe+ke+$+" ")},[a,he]);m.useEffect(()=>{h(!1),ne(!1)},[t]);const ut=m.useCallback(N=>{a.setText(`/${N} `),h(!1),requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()})},[a]),rt=m.useCallback(async()=>{if(e||S)return;const N=a.getState().text??"";if(!N.trim())return;const $=k;I($,{optimizing:!0});try{const oe=await kM(N);I($,{optimizing:!1,review:{...oe,original:N}})}catch{I($,{optimizing:!1})}},[a,e,S,k,I]),Pn=m.useRef(null);m.useEffect(()=>{const N=$=>{if(!($.key!=="Enter"||!($.metaKey||$.ctrlKey)||$.altKey)&&!(e||p)&&!document.querySelector('[aria-modal="true"]')){if(ee){$.preventDefault(),Pn.current?.();return}$.preventDefault(),$.shiftKey?(a.send(),P()):rt()}};return window.addEventListener("keydown",N,!0),()=>window.removeEventListener("keydown",N,!0)},[e,p,ee,a,rt,P]);const[jr,jn]=m.useState({ctrl:!1,alt:!1}),ps=m.useRef(jr);ps.current=jr;const An=m.useRef(l);An.current=l;const gn=m.useRef(""),ei=m.useCallback(N=>{jn($=>({...$,[N]:!$[N]}))},[]);m.useEffect(()=>{if(!p){gn.current="";return}a.setText(""),gn.current="",jn({ctrl:!1,alt:!1});const N=()=>{const $=a.getState().text??"",oe=gn.current;if($===oe)return;const{removed:ke,added:pe}=eC(oe,$),Ee=ps.current;if((Ee.ctrl||Ee.alt)&&ke===0&&pe.length===1&&Ta(pe)){const De=Bu(Ee,pe);De&&An.current.key(De),jn({ctrl:!1,alt:!1}),a.setText(oe);return}const ye=pe.indexOf(`
101
+ `);if(ye!==-1){for(let De=0;De<ke;De+=1)An.current.key("BSpace");pe.slice(0,ye)&&An.current.text(pe.slice(0,ye)),An.current.key("Enter"),gn.current="",a.setText("");return}for(let De=0;De<ke;De+=1)An.current.key("BSpace");pe&&An.current.text(pe),gn.current=$};return a.subscribe(N)},[p,a]);const yn=m.useRef(null),qn=m.useMemo(()=>new Set(D.map(N=>N.name)),[D]),O=m.useMemo(()=>new Set(B.map(N=>N.name)),[B]);function Y(N,$,oe){const ke=/(^|\s)([/@])([A-Za-z0-9:_-]+)(\s)/g,pe=[];let Ee=0,ye=!1,De=0,ct;for(;(ct=ke.exec(N))!==null;){const $a=ct[2],ms=ct[3];if(!($a==="/"&&$.has(ms)||$a==="@"&&oe.has(ms)))continue;ye=!0;const lo=ct.index,ti=ct[1],Gn=ct[4],Ua=lo+ti.length,ni=Ua+1+ms.length;lo>Ee&&pe.push(N.slice(Ee,lo)),ti&&pe.push(ti),pe.push(d.jsx("span",{className:"composer-pill","aria-hidden":"true",children:N.slice(Ua,ni)},De++)),pe.push(N.slice(ni,ni+Gn.length)),Ee=ni+Gn.length}return Ee<N.length&&pe.push(N.slice(Ee)),{nodes:pe,hasPills:ye}}const{nodes:ie,hasPills:fe}=m.useMemo(()=>Y(U,qn,O),[U,qn,O]);return m.useLayoutEffect(()=>{const N=document.querySelector(".composer-input"),$=yn.current;!N||!$||($.scrollTop=N.scrollTop,$.scrollLeft=N.scrollLeft)},[U]),d.jsxs(ml.Root,{className:"composer",children:[Je?d.jsx("div",{className:"skill-ac",role:"listbox","aria-label":"Skill suggestions",children:de.map((N,$)=>d.jsx("button",{type:"button",role:"option","aria-selected":$===z,"data-on":$===z?"true":void 0,className:"skill-ac-item",onMouseDown:oe=>{oe.preventDefault(),Ce(N.name)},onMouseEnter:()=>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:N.name}),N.description?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input skill-card-desc",children:N.description})]}):null]})},N.name))}):null,y?d.jsx("div",{ref:v,className:"term-warm",children:d.jsx(J1,{output:l.output,requestCapture:l.poll,clearOutput:l.clear,sendKey:l.key,mods:jr,onToggleMod:ei})}):null,d.jsxs("div",{className:"composer-card","data-terminal":p?"true":void 0,"data-voice":ee?"true":void 0,children:[Ue?d.jsx("div",{className:"composer-skill-chip-row",children:d.jsxs("span",{className:"skill-chip composer-skill-chip",title:`Invoking /${Ue}`,children:[d.jsx("span",{className:"skill-chip-icon","aria-hidden":"true",children:"⌁"}),d.jsxs("span",{className:"skill-chip-name",children:["/",Ue]})]})}):null,ee?d.jsx(f5,{onCommit:mt,onClose:he,stopRef:Pn}):null,d.jsxs("div",{className:"composer-input-wrap","data-has-pills":fe?"true":void 0,style:ee?{display:"none"}:void 0,children:[d.jsx(ml.Input,{className:"composer-input",placeholder:e&&!p?"Select a session…":" ",submitOnEnter:!1,onKeyUp:N=>R(N.currentTarget),onClick:N=>R(N.currentTarget),onSelect:N=>R(N.currentTarget),onScroll:N=>{const $=yn.current;$&&($.scrollTop=N.currentTarget.scrollTop,$.scrollLeft=N.currentTarget.scrollLeft)},onKeyDown:N=>{if(p){if(N.metaKey)return;if(N.key==="Escape"){N.preventDefault(),g(!1),s?.(!1),P();return}const $=jr,oe=N.ctrlKey||$.ctrl,ke=N.altKey||$.alt;if((oe||ke)&&N.key.length===1&&Ta(N.key)){N.preventDefault();const ye=Bu({ctrl:oe,alt:ke},N.key);ye&&l.key(ye),($.ctrl||$.alt)&&jn({ctrl:!1,alt:!1});return}const pe=nC(N.key,{ctrl:N.ctrlKey,alt:N.altKey,shift:N.shiftKey});if(pe){N.preventDefault(),l.key(pe);return}if(N.key==="Backspace"){N.preventDefault(),l.key("BSpace");const ye=a.getState().text??"";if(ye){const De=ye.slice(0,-1);a.setText(De),gn.current=De}return}if(N.key==="Delete"){N.preventDefault(),l.key("DC");return}const Ee=tC(N.key,N.shiftKey);Ee&&(N.preventDefault(),l.key(Ee),Ee==="Enter"&&(gn.current="",a.setText("")));return}if(u&&N.key==="!"){N.preventDefault(),x();return}if(Je){if(N.key==="ArrowDown"){N.preventDefault(),b($=>($+1)%de.length);return}if(N.key==="ArrowUp"){N.preventDefault(),b($=>($-1+de.length)%de.length);return}if(N.key==="Enter"&&!N.metaKey&&!N.ctrlKey){N.preventDefault(),Ce(de[z].name);return}if(N.key==="Tab"){N.preventDefault(),Ce(de[z].name);return}if(N.key==="Escape"){N.preventDefault(),X(!0);return}}if(N.key==="Enter"&&(N.metaKey||N.ctrlKey)){if(N.preventDefault(),e||S)return;N.shiftKey?(a.send(),P()):rt()}N.key.toLowerCase()==="o"&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),rt())},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:yn,children:ie}),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(Fr,{children:"Tab"})," completes",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(Fr,{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(Fr,{children:"⌘/Ctrl+↵"})," optimise",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(Fr,{children:"⌘/Ctrl+⇧+↵"})," send raw",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(Fr,{children:"↵"})," newline"]})]})]}),ee?null:d.jsx("div",{className:"composer-attachments",children:d.jsx(ml.Attachments,{children:({attachment:N})=>d.jsx(d5,{attachment:N})})}),d.jsxs("div",{className:"composer-toolbar",children:[!p&&!ee?d.jsxs(d.Fragment,{children:[d.jsx(ml.AddAttachment,{className:"composer-attach","aria-label":"Attach a file",title:"Attach a file",multiple:!0,disabled:e,children:d.jsx(h5,{})}),d.jsx("button",{type:"button",className:"composer-mic","aria-label":"Voice input",title:"Voice input",disabled:e,"data-hotkey":"⌘S",onClick:se,children:d.jsx(sC,{})})]}):null,ee?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)):x()},children:d.jsx(p5,{})}),d.jsx("span",{className:"composer-toolbar-spacer"}),!p&&!ee?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:N=>r?.(N.target.checked),"aria-label":"Dispatch task in sub-agent"}),d.jsx("span",{className:"composer-subagent-label",children:"Dispatch task in sub-agent"})]}):null,!p&&!ee?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(),P()},children:d.jsx(xx,{})}):null,p&&!ee?d.jsx("button",{type:"button",className:"composer-send","data-terminal":"true","aria-label":"Send Enter",title:"Enter",onMouseDown:N=>N.preventDefault(),onClick:()=>l.key("Enter"),children:d.jsx(xx,{})}):ee?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(PD,{size:14})}):null,!i||!u?d.jsx("button",{type:"button",ref:E,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 rt(),children:S?d.jsx("span",{className:"composer-enhance-spinner","aria-hidden":"true"}):d.jsx(m5,{})}):null]})]})]}),T?d.jsx(F$,{original:T.original,result:T,onSend:N=>{I(k,{review:null}),a.setText(N),requestAnimationFrame(()=>{e||a.send(),P()})},onAccept:N=>{a.setText(N),I(k,{review:null}),P()},onClose:()=>{I(k,{review:null}),P()}}):null,f?d.jsx(B$,{onPick:ut,onClose:()=>h(!1),sessionId:t}):null]})}function f5({onCommit:e,onClose:t,stopRef:n}){const{status:r,errorMsg:s,canvasRef:i,pauseResume:o,stop:a,cancel:l}=V$({onCommit:e,onClose:t});m.useEffect(()=>(n.current=a,()=>{n.current=null}),[a,n]);const u=r==="error"?"Microphone unavailable":r==="transcribing"?"Transcribing…":r==="paused"?"Paused":r==="starting"?"Starting…":"Listening…";return d.jsxs("div",{className:"voice-inline-body","aria-live":"polite",children:[d.jsxs("div",{className:"voice-status",children:[d.jsx("span",{className:"voice-dot","data-on":r==="recording"?"true":void 0}),u]}),d.jsx("canvas",{ref:i,className:"voice-wave voice-wave-inline",height:64,"data-paused":r!=="recording"?"true":void 0}),r==="error"?d.jsx("div",{className:"voice-error",children:s||"Could not start recording."}):r!=="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:l,disabled:r==="transcribing","aria-label":"Cancel voice recording",children:"Cancel"}),d.jsx("span",{className:"composer-toolbar-spacer"}),r==="recording"||r==="paused"?d.jsx("button",{type:"button",className:"btn-secondary voice-btn-pause",onClick:o,"aria-label":r==="recording"?"Pause recording":"Resume recording",children:r==="recording"?"Pause":"Resume"}):null,d.jsx("button",{type:"button",className:"composer-send voice-btn-stop",onClick:a,disabled:r==="error"||r==="transcribing"||r==="starting","aria-label":"Stop recording and transcribe",title:"Stop & Transcribe (⌘/Ctrl+↵)",children:r==="transcribing"?d.jsx("span",{className:"composer-enhance-spinner","aria-hidden":"true"}):d.jsx(sC,{})})]})]})}function h5(){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 xx(){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 p5(){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 sC(){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 m5(){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 wx=120;function g5(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 _x(s)}const n=(e?.description??"").replace(/\s+/g," ").trim();return n?_x(n):""}function _x(e){return e.length>wx?e.slice(0,wx-1)+"…":e}function iC({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=g5(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 y5={UserMessage:Ba,AssistantMessage:dr,SystemMessage:dr};function Sm({messages:e}){const t=m.useMemo(()=>Ak(e),[e]),n=Ma({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Da,{runtime:n,children:d.jsx(vt.Root,{className:"sa-thread-root",children:d.jsxs(vt.Viewport,{className:"sa-thread-viewport",autoScroll:!0,children:[d.jsx(vt.Empty,{children:d.jsx("div",{className:"thread-empty",children:"no output yet…"})}),d.jsx(vt.Messages,{components:y5})]})})})}const v5={UserMessage:Ba,AssistantMessage:dr,SystemMessage:dr},x5=[{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 (>_)"}],w5=8e3;function _5({loading:e}){const[t,n]=m.useState(!0);return m.useEffect(()=>{if(!e){n(!0);return}const r=setTimeout(()=>n(!1),w5);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 b5(){const e=C0(),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:x5.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 k5({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(vt.Root,{className:"thread-root",children:[d.jsx("div",{className:"thread-fade","aria-hidden":"true"}),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(Sm,{messages:c.messages})]}):d.jsxs(d.Fragment,{children:[d.jsxs(vt.Viewport,{className:"thread-viewport",children:[e?d.jsx(vt.Empty,{children:t?d.jsx(_5,{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(b5,{})]})}):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(vt.Messages,{components:v5})]}),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(ID,{size:18})})]}),d.jsx(iC,{subagents:l,onOpenAgent:u,viewingAgentId:c?.agentId??null}),d.jsx(rC,{disabled:!e,sessionId:n,subAgentMode:i,onSubAgentModeChange:o,onTerminalModeChange:a,working:h,onStop:p})]})}const S5=256*1024,bo=40,bx=90,C5=25,E5=15,T5=95;function I5(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const R5={UserMessage:Ba,AssistantMessage:dr,SystemMessage:dr};function P5({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"skill-legend-body",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ma({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Da,{runtime:n,children:d.jsx(vt.Root,{className:"skill-body-thread",children:d.jsx(vt.Viewport,{className:"skill-body-viewport",children:d.jsx(vt.Messages,{components:R5})})})})}function j5({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 A5({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(j5,{val:s})]},r))}),e.content.length>0?d.jsx("div",{className:"skill-body-wrap",children:d.jsx(P5,{markdown:e.content})}):null]})}function kx({language:e,content:t,artifactId:n}){const[r,s]=m.useState(null),i=t.length>S5,o=_m(e),a=!i&&o!==null;return m.useEffect(()=>{if(!a){s(null);return}let l=!0;return s(null),K1(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:I5(t)}})})})}function N5(){const{artifacts:e,activeId:t,setActive:n,close:r}=bm(),s=km(),i=m.useRef(null),o=m.useRef(null),a=m.useId(),[l,u]=m.useState(bo),c=m.useRef(null),[f,h]=m.useState(!1),p=e.find(k=>k.id===t)??null,g=p!==null;m.useEffect(()=>{g&&u(bo)},[g]);const y=m.useRef(!1);m.useEffect(()=>{const k=y.current;if(y.current=g,!k&&g&&requestAnimationFrame(()=>{const S=o.current?.querySelector('[role="tab"][aria-selected="true"]');S?S.focus():i.current?.focus()}),k&&!g){const S=document.querySelector(".thread-root");S&&(S.hasAttribute("tabindex")||S.setAttribute("tabindex","-1"),S.focus())}},[g]);const _=m.useCallback(k=>{k.key==="Escape"&&t&&(k.preventDefault(),r(t))},[t,r]),v=m.useCallback(k=>{if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;const S=Array.from(o.current?.querySelectorAll('[role="tab"]')??[]),T=document.activeElement,I=S.indexOf(T);if(I<0)return;const P=k.key==="ArrowRight"?S[(I+1)%S.length]:S[(I-1+S.length)%S.length];P?.focus();const E=P?.dataset.artifactId;E&&n(E)},[n]),x=m.useCallback(k=>{c.current={startY:k.clientY,startH:l},k.currentTarget.setPointerCapture(k.pointerId),h(!0)},[l]),w=m.useCallback(k=>{if(!c.current)return;const{startY:S,startH:T}=c.current,I=(S-k.clientY)/window.innerHeight*100,P=Math.min(T5,Math.max(E5,T+I));u(P)},[]),C=m.useCallback(k=>{c.current&&(k.currentTarget.releasePointerCapture(k.pointerId),c.current=null,h(!1),u(S=>{if(S<C5)return t&&r(t),bo;const T=Math.abs(S-bo),I=Math.abs(S-bx);return T<=I?bo:bx}))},[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:_,children:[d.jsx("div",{className:"artifact-drag-handle",role:"separator","aria-label":"Resize panel",onPointerDown:x,onPointerMove:w,onPointerUp:C,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:v,children:e.map(k=>{const S=k.id===t,T=`artifact-tab-${k.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":k.id,onClick:()=>n(k.id),children:k.title}),d.jsx("button",{className:"artifact-tab-close","aria-label":`Close ${k.title}`,tabIndex:-1,onClick:I=>{I.stopPropagation(),r(k.id)},children:"✕"})]},k.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(kx,{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:_,children:[d.jsxs("div",{className:"artifact-panel-head",children:[d.jsx("div",{role:"tablist","aria-label":"Open artifacts",ref:o,className:"artifact-tablist",onKeyDown:v,children:e.map(k=>{const S=k.id===t,T=`artifact-tab-${k.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":k.id,onClick:()=>n(k.id),children:k.title}),d.jsx("button",{className:"artifact-tab-close","aria-label":`Close ${k.title}`,tabIndex:-1,onClick:I=>{I.stopPropagation(),r(k.id)},children:"✕"})]},k.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(A5,{artifact:p}):d.jsx(kx,{language:p.language,content:p.content,artifactId:p.id})})]}):null}const Sx=200,M5=2e3;function D5({sessionId:e,capture:t,requestCapture:n,clearCapture:r}){const s=m.useRef(null),i=m.useRef(!0);m.useEffect(()=>{n(Sx);const a=setInterval(()=>n(Sx),M5);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 L5(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}=eC(p,h),_=o.current,v=a.current;if((_.ctrl||_.alt)&&g===0&&y.length===1&&Ta(y)){const w=Bu(_,y);w&&v.sendKey(w),s({ctrl:!1,alt:!1}),n(p);return}const x=y.indexOf(`
102
+ `);if(x!==-1){for(let w=0;w<g;w+=1)v.sendKey("BSpace");y.slice(0,x)&&v.sendText(y.slice(0,x)),v.sendKey("Enter"),i.current="",n("");return}for(let w=0;w<g;w+=1)v.sendKey("BSpace");y&&v.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,_=h.altKey||p.alt;if((y||_)&&h.key.length===1&&Ta(h.key)){h.preventDefault();const w=Bu({ctrl:y,alt:_},h.key);w&&g.sendKey(w),(p.ctrl||p.alt)&&s({ctrl:!1,alt:!1});return}const v=nC(h.key,{ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey});if(v){h.preventDefault(),g.sendKey(v);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 x=tC(h.key,h.shiftKey);x&&(h.preventDefault(),g.sendKey(x),x==="Enter"&&(i.current="",n("")))},[]);return m.useMemo(()=>({value:t,onChange:c,onKeyDown:f,sticky:r,toggleMod:l}),[t,c,f,r,l])}function O5({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=L5(a),u=m.useRef(null);return m.useEffect(()=>{const c=u.current;!c||lr()||ft.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("div",{className:"thread-fade","aria-hidden":"true"}),d.jsx(J1,{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 Cx(e){return e.questions.map(()=>new Set)}function z5(e){return e.options.some(t=>typeof t.preview=="string"&&t.preview.length>0)}function F5({pending:e,capture:t,onAnswer:n,onCapture:r,onClose:s}){const{rootRef:i,requestClose:o}=Js(s),[a,l]=m.useState(()=>Cx(e)),[u,c]=m.useState(()=>e.questions.map(()=>0)),f=m.useRef(null),h=m.useRef(null);m.useEffect(()=>{l(Cx(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(x=>x.size>0),[a]),g=(x,w,C)=>{l(k=>{const S=k.map(I=>new Set(I)),T=S[x];return C?T.has(w)?T.delete(w):T.add(w):S[x]=new Set([w]),S})},y=(x,w,C)=>{c(k=>{const S=[...k];return S[x]=Math.max(0,Math.min(C-1,(k[x]??0)+w)),S})},_=x=>{if(x.key==="Escape"){x.preventDefault(),o();return}if(x.key!=="Tab")return;const w=f.current?.querySelectorAll('button:not([disabled]), [tabindex="0"]');if(!w||w.length===0)return;const C=w[0],k=w[w.length-1];x.shiftKey&&document.activeElement===C?(x.preventDefault(),k.focus()):!x.shiftKey&&document.activeElement===k&&(x.preventDefault(),C.focus())},v=()=>{p&&n(e.toolUseId,a.map(x=>[...x]))};return d.jsx("div",{className:"modal-backdrop",ref:i,onClick:x=>{x.target===x.currentTarget&&o()},children:d.jsxs("div",{ref:f,className:"modal",role:"dialog","aria-modal":"true","aria-label":"Question from Claude",tabIndex:-1,onKeyDown:_,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((x,w)=>{const C=z5(x),k=u[w]??0,S=x.options[k];return d.jsxs("div",{className:"question",children:[x.header?d.jsx("div",{className:"q-header",children:x.header}):null,d.jsx("div",{className:"q-text",children:x.question}),x.multiSelect?d.jsx("div",{className:"q-hint",children:"select one or more"}):null,C?d.jsxs("div",{className:"ask-split",children:[d.jsx("div",{className:"ask-split-list",role:"listbox","aria-multiselectable":!!x.multiSelect,"aria-label":x.question,children:x.options.map((T,I)=>{const P=a[w]?.has(T.label),E=I===k;return d.jsxs("div",{className:"ask-split-row","data-focused":E?"true":"false","data-selected":P?"true":"false",role:"option","aria-selected":P,tabIndex:E?0:-1,onMouseEnter:()=>c(D=>{const M=[...D];return M[w]=I,M}),onClick:()=>{c(D=>{const M=[...D];return M[w]=I,M}),g(w,T.label,!!x.multiSelect)},onKeyDown:D=>{D.key==="ArrowDown"?(D.preventDefault(),y(w,1,x.options.length)):D.key==="ArrowUp"?(D.preventDefault(),y(w,-1,x.options.length)):(D.key===" "||D.key==="Enter")&&(D.preventDefault(),g(w,T.label,!!x.multiSelect))},children:[d.jsx("span",{className:"ask-split-indicator",children:x.multiSelect?d.jsx("span",{className:"ask-check","aria-hidden":"true",children:P?"▣":"▢"}):d.jsx("span",{className:"ask-radio","aria-hidden":"true",children:P?"◉":"○"})}),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:x.options.map(T=>{const I=a[w]?.has(T.label);return d.jsxs("button",{type:"button",className:"option-btn","data-on":I?"true":"false","aria-pressed":I,onClick:()=>g(w,T.label,!!x.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:v,children:"Send Answer"})]})]})})}function B5({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 Ex="claude-control-update-dismissed";function $5(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 U5(){const[e,t]=m.useState(null),[n,r]=m.useState(!1);return m.useEffect(()=>{let s=!0;return Tk().then(i=>{if(!s||!i?.updateAvailable)return;const o=i.latest??`behind-${i.behind??0}`;localStorage.getItem(Ex)!==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:$5(e)}),d.jsxs("span",{className:"update-actions",children:[d.jsx("button",{type:"button",className:"update-now",onClick:()=>{r(!0),gM()},children:"Update now"}),d.jsx("button",{type:"button",className:"update-dismiss","aria-label":"Dismiss update notice",onClick:()=>{localStorage.setItem(Ex,e.latest??`behind-${e.behind}`),t(null)},children:"×"})]})]}):null}function V5({onClose:e,onToast:t}){const{rootRef:n,requestClose:r}=Js(e),[s,i]=m.useState(""),[o,a]=m.useState(""),[l,u]=m.useState(""),[c,f]=m.useState(""),[h,p]=m.useState("mlx"),[g,y]=m.useState(""),[_,v]=m.useState(0),[x,w]=m.useState(0),[C,k]=m.useState(null),[S,T]=m.useState(!0),[I,P]=m.useState(!1),[E,D]=m.useState(null),[M,B]=m.useState(()=>Date.now()),[Q,U]=m.useState(!1),te=m.useRef(null);m.useEffect(()=>{let b=!0;return Tk().then(W=>b&&W&&D(W)).catch(()=>{}),bM().then(W=>b&&k(W)).catch(()=>{}),()=>{b=!1}},[]),m.useEffect(()=>{let b=!0;return Ik().then(W=>{b&&(i(W.launchCommand),a(W.defaultCwd),u(W.optimizeModel??""),f(W.claudeBin??""),p(W.optimizeBackend??"mlx"),y(W.mlxModel??""),v(W.transcriptFontSize??0),w(W.externalFontSize??0))}).catch(W=>t(`Load config failed: ${W.message}`,"error")).finally(()=>{b&&T(!1)}),()=>{b=!1}},[t]),m.useEffect(()=>{const b=W=>{W.key==="Escape"&&r()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[r]);const Z=async b=>{const W=b.target.files?.[0];if(b.target.value="",!!W){if(W.type!=="image/png"){t("Icon must be a PNG image","error");return}U(!0);try{await wM(W),B(Date.now()),t("App icon updated — re-add to Home Screen to see it","ok")}catch(X){t(`Icon upload failed: ${X.message}`,"error")}finally{U(!1)}}},F=async()=>{U(!0);try{await _M(),B(Date.now()),t("App icon reset to default","ok")}catch(b){t(`Icon reset failed: ${b.message}`,"error")}finally{U(!1)}},z=async()=>{P(!0);try{const b=await CM({launchCommand:s,defaultCwd:o,optimizeModel:l,claudeBin:c,optimizeBackend:h,mlxModel:g,transcriptFontSize:_,externalFontSize:x});i(b.launchCommand),a(b.defaultCwd),u(b.optimizeModel??""),f(b.claudeBin??""),p(b.optimizeBackend??"mlx"),y(b.mlxModel??""),v(b.transcriptFontSize??0),w(b.externalFontSize??0);const W=C?.mlxModels.find(X=>X.id===b.mlxModel);b.optimizeBackend==="mlx"&&W&&W.installed===!1?t(`Downloading ${W.label} (${W.sizeGB} GB)… enhancer uses claude until ready`,"ok"):t("Config saved","ok"),r()}catch(b){t(`Save failed: ${b.message}`,"error")}finally{P(!1)}};return d.jsx("div",{className:"config-overlay",ref:n,role:"presentation",onClick:b=>{b.target===b.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.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Launch command"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"claude",value:s,disabled:S,onChange:b=>i(b.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsx("span",{className:"config-hint",children:"Run in each new session's pane."})]}),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:o,disabled:S,onChange:b=>a(b.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:h,disabled:S,onChange:b=>p(b.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:l,disabled:S,onChange:b=>u(b.target.value),children:[l&&!C?.claudeModels.some(b=>b.id===l)?d.jsxs("option",{value:l,children:[l,C?" (custom)":""]}):null,(C?.claudeModels??[]).map(b=>d.jsxs("option",{value:b.id,children:[b.label,b.id===C?.recommendedClaudeModel?" · recommended":""]},b.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:g,disabled:S||h!=="mlx",onChange:b=>y(b.target.value),children:[g&&!C?.mlxModels.some(b=>b.id===g)?d.jsxs("option",{value:g,children:[g,C?" (custom)":""]}):null,(C?.mlxModels??[]).map(b=>d.jsxs("option",{value:b.id,children:[b.label," · ",b.sizeGB," GB",b.installed?" · downloaded":" · ⬇ download",b.id===C?.recommendedMlxModel?" · recommended":"",C&&b.minRamGB>C.machine.ramGB?` (needs ≥${b.minRamGB} GB)`:""]},b.id))]}),d.jsx("span",{className:"config-hint",children:C?`Your ${C.machine.appleSilicon?"Apple Silicon ":""}Mac has ${C.machine.ramGB} GB — recommended: ${C.mlxModels.find(b=>b.id===C.recommendedMlxModel)?.label??C.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:_,disabled:S,onChange:b=>v(Number(b.target.value)),children:[d.jsx("option",{value:0,children:"Default (auto)"}),[12,13,14,15,16,17,18].map(b=>d.jsxs("option",{value:b,children:[b,"px"]},b))]}),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:x,disabled:S,onChange:b=>w(Number(b.target.value)),children:[d.jsx("option",{value:0,children:"Default (auto)"}),[12,13,14,15,16,17,18,19,20,21,22].map(b=>d.jsxs("option",{value:b,children:[b,"px"]},b))]}),d.jsx("span",{className:"config-hint",children:"Applies only when iPad drives an external monitor. Overrides base size on that display."})]}),d.jsxs("label",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"Claude CLI path (optional)"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"auto-detected",value:c,disabled:S,onChange:b=>f(b.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsxs("span",{className:"config-hint",children:["Path to the ",d.jsx("code",{children:"claude"})," binary. Blank = auto-detect."]})]}),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=${M}`,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:Q,onClick:()=>te.current?.click(),children:Q?"Working…":"Upload PNG"}),d.jsx("button",{type:"button",className:"config-cancel",disabled:Q,onClick:F,children:"Reset"})]}),d.jsx("input",{ref:te,type:"file",accept:"image/png",hidden:!0,onChange:Z})]}),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:E?d.jsxs(d.Fragment,{children:[d.jsxs("span",{children:["claude-control v",E.current]}),E.updateAvailable&&E.latest?d.jsxs("span",{className:"config-version-update",children:["· update available: v",E.latest]}):null]}):null}),d.jsxs("div",{className:"config-actions",children:[d.jsx("button",{type:"button",className:"config-cancel",onClick:r,disabled:I,children:"Cancel"}),d.jsx("button",{type:"button",className:"config-save",onClick:z,disabled:S||I,children:I?"Saving…":"Save"})]})]})]})})}const Tx={all:"Showing all panes — tap to show only Claude",claude:"Showing Claude sessions — tap to show only terminals",terminal:"Showing terminals — tap to show all"};function Ix(e=Date.now()){return`session-${e.toString(36).slice(-6)}`}function H5({onToast:e,filter:t,onCycleFilter:n}){const[r,s]=m.useState(!1),[i,o]=m.useState(""),[a,l]=m.useState(!1),[u,c]=m.useState(Ix),f=m.useRef(null);m.useEffect(()=>{r&&(c(Ix()),f.current?.focus())},[r]);const h=m.useCallback(()=>{s(!1),o("")},[]),p=m.useCallback(async()=>{if(a)return;l(!0);const g=i.trim()||u;e("Creating session…");try{const y=await Rk({name:g});e(`Session created → ${y.name}`,"ok"),h()}catch(y){e(`New session failed: ${y.message}`,"error")}finally{l(!1)}},[a,i,u,e,h]);return r?d.jsxs("form",{className:"rail-new-form","aria-label":"Create session",onSubmit:g=>{g.preventDefault(),p()},children:[d.jsx("input",{ref:f,className:"rail-new-name",type:"text",value:i,placeholder:u,disabled:a,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Escape"&&(g.preventDefault(),h())},"aria-label":"Session name",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsxs("div",{className:"rail-new-actions",children:[d.jsx("button",{type:"button",className:"rail-new-cancel",onClick:h,disabled:a,children:"Cancel"}),d.jsx("button",{type:"submit",className:"rail-new-create",disabled:a,children:a?"Creating…":"Create"})]})]}):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":Tx[t],title:Tx[t],onClick:n,children:[d.jsx(TD,{size:15}),t!=="all"?d.jsx("span",{className:"rail-filter-tag",children:t==="claude"?"CC":">_"}):null]})]})}const W5="frame";function K5(e){return e==="Escape"}function q5({sessionId:e,label:t,visible:n,onClose:r}){const s=pM(e),i=m.useRef(null);m.useEffect(()=>{if(!n)return;const h=p=>{K5(p.key)&&r()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[r,n]);const o=()=>{n&&W5==="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 G5({children:e}){const[t,n]=m.useState("probing"),[r,s]=m.useState(null),[i,o]=m.useState(""),a=m.useCallback(async()=>{try{return(await nt("/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(()=>fM(()=>{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),Sk(c),await a()||(Ck(),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…"})]})}):(dc(),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 Y5={UserMessage:Ba,AssistantMessage:dr,SystemMessage:dr};function Q5({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"plan",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ma({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Da,{runtime:n,children:d.jsx(vt.Root,{className:"plan-review",children:d.jsx(vt.Viewport,{className:"plan-review-viewport",children:d.jsx(vt.Messages,{components:Y5})})})})}function X5({prompt:e,onKey:t,onSelect:n,onClose:r,planMarkdown:s}){const{rootRef:i,requestClose:o}=Js(r),a=!!e.multiSelect,l=m.useMemo(()=>a?null:e.options.find(E=>E.selected)?.key??e.options[0]?.key??null,[e,a]),[u,c]=m.useState(l),[f,h]=m.useState(null),p=m.useMemo(()=>new Set(e.options.filter(P=>P.checked).map(P=>P.label)),[JSON.stringify(e)]),[g,y]=m.useState(p),[_,v]=m.useState(!1),x=JSON.stringify(e);m.useEffect(()=>{a?(y(p),v(!1)):(c(l),h(null))},[x,l,a]);const w=P=>{f||(h(P),t(P))},C=()=>{u&&w(u)},k=P=>{y(E=>{const D=new Set(E);return D.has(P)?D.delete(P):D.add(P),D})},S=()=>{_||g.size===0||(v(!0),n?.([...g]))};m.useEffect(()=>{const P=E=>{if(a){if(_)return;if(E.key==="Escape"){E.preventDefault(),o();return}if(E.key==="Enter"){E.preventDefault(),S();return}const D=e.options.find(M=>M.key===E.key);D&&(E.preventDefault(),k(D.label))}else{if(f)return;if(E.key==="Escape"){E.preventDefault(),o();return}if(E.key==="Enter"){E.preventDefault(),u&&w(u);return}e.options.some(D=>D.key===E.key)&&(E.preventDefault(),c(E.key))}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[o,f,u,x,a,_,g]);const T=a?_:f!==null,I=!!s;return d.jsx("div",{className:"modal-backdrop",ref:i,onClick:P=>{P.target===P.currentTarget&&!T&&o()},children:d.jsxs("div",{className:I?"modal modal-plan":"modal",role:"dialog","aria-modal":"true","aria-label":I?"Review plan":"Terminal prompt",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",children:I?"Review plan":"Claude needs a choice"}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Hide",onClick:o,children:"✕"})]}),d.jsxs("div",{className:"modal-body",children:[I?d.jsx(Q5,{markdown:s}):null,d.jsxs("div",{className:"question",children:[I?null:d.jsx("div",{className:"q-text",children:e.question}),a?d.jsx("div",{className:"q-hint",children:"select one or more"}):null,a?d.jsx("div",{className:"q-options","aria-label":"Options",children:e.options.map(P=>{const E=g.has(P.label);return d.jsx("button",{type:"button",className:"option-btn","aria-pressed":E,"data-on":E?"true":"false",disabled:T,onClick:()=>k(P.label),children:d.jsxs("span",{className:"option-label",children:[P.key,". ",P.label]})},P.key)})}):d.jsx("div",{className:"q-options",role:"radiogroup","aria-label":"Options",children:e.options.map(P=>d.jsxs("button",{type:"button",className:"option-btn",role:"radio","aria-checked":u===P.key,"data-on":u===P.key?"true":"false","data-sending":f===P.key?"true":void 0,disabled:T,onClick:()=>c(P.key),children:[d.jsxs("span",{className:"option-label",children:[P.key,". ",P.label]}),f===P.key?d.jsxs("span",{className:"option-sending","aria-live":"polite",children:[d.jsx("span",{className:"working-spinner","aria-hidden":"true"})," sending…"]}):null]},P.key))})]})]}),d.jsxs("div",{className:"modal-foot",children:[d.jsxs("button",{type:"button",className:"btn-secondary",disabled:T,onClick:()=>a?o():w("Escape"),children:["Cancel ",d.jsx(Fr,{children:"Esc"})]}),d.jsx("span",{className:"modal-foot-spacer"}),T?d.jsx("span",{className:"prompt-status",children:"submitting your answer…"}):null,d.jsxs("button",{type:"button",className:"btn-primary",disabled:T||(a?g.size===0:!u),onClick:a?S:C,children:["Confirm ",d.jsx(Fr,{children:"↵"})]})]})]})})}const J5={active:"Active",completed:"Completed",all:"All"};function oC(e){return e.model?e.model:e.def?.model?e.def.model:null}function Cm({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 Z5({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 eU({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(Cm,{agentType:t.agentType,model:t.model},t.agentId))})]})}function tU({agent:e}){const t=oC(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"sa-dot","data-status":e.status,"aria-hidden":"true"}),d.jsx(Cm,{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 nU({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||lr()||ft.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=oC(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(Cm,{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(Z5,{def:c.def,agentType:c.agentType}),d.jsx(eU,{nested:c.nested}),d.jsx(Sm,{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:[J5[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(tU,{agent:p}),d.jsx("span",{className:"sa-chevron","aria-hidden":"true",children:"›"})]},p.agentId))})]})]})}const rU=3e3,Rx=10*6e4;function Px({points:e,field:t,now:n,floor:r,color:s}){const a=n-Rx,l=e.filter(g=>g.t>=a),u=g=>(g-a)/Rx*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 sU({power:e,history:t,onClose:n,onToast:r}){const{rootRef:s,requestClose:i}=Js(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,_=m.useCallback(()=>{IM().then(a).catch(x=>r(`ps failed: ${x.message}`,"error"))},[r]);m.useEffect(()=>{_();const x=setInterval(_,rU);return()=>clearInterval(x)},[_]),m.useEffect(()=>{const x=w=>{w.key==="Escape"&&i()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[i]);const v=m.useCallback(async(x,w)=>{f(x);try{await RM(x,w?"SIGKILL":"SIGTERM"),r(`Sent ${w?"SIGKILL":"SIGTERM"} → ${x}`,"ok"),u(null),_()}catch(C){r(`kill ${x} failed: ${C.message}`,"error")}finally{f(null)}},[r,_]);return d.jsx("div",{className:"modal-backdrop",ref:s,onClick:x=>{x.target===x.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(jS,{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(eh,{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(Px,{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(Px,{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(x=>d.jsxs("div",{className:"proc-row",children:[d.jsx("span",{className:"proc-pid",children:x.pid}),d.jsx("span",{className:"proc-cpu","data-hot":x.cpu>=50?"true":void 0,children:x.cpu.toFixed(0)}),d.jsxs("span",{className:"proc-mem",children:[x.rssMB,"m"]}),d.jsx("span",{className:"proc-cmd",title:x.command,children:x.command}),d.jsx("span",{className:"proc-act",children:l===x.pid?d.jsxs("span",{className:"proc-confirm",children:[d.jsx("button",{type:"button",className:"proc-kill-yes",disabled:c===x.pid,title:"SIGTERM (shift-click for SIGKILL)",onClick:w=>v(x.pid,w.shiftKey),children:c===x.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 ${x.pid}`,title:"Kill process",onClick:()=>u(x.pid),children:d.jsx(eh,{size:14})})})]},x.pid))]})]})})}function jx(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 iU(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:jx(r,n)?120:jx(s,n)?60:0}function oU(e,t){const n=[],r=new Map;e.forEach((o,a)=>{const l=iU(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 aU({commands:e,onClose:t}){const{rootRef:n,requestClose:r}=Js(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(()=>oU(e,s),[e,s]),h=m.useMemo(()=>{const y=new Map;return f.forEach((_,v)=>y.set(_.id,v)),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=_=>{const v=f.length;if(_.key==="Escape"){_.preventDefault(),r();return}if((_.metaKey||_.ctrlKey)&&/^[1-9]$/.test(_.key)){_.preventDefault(),g(f[Number(_.key)-1]);return}v!==0&&(_.key==="ArrowDown"||_.key==="Tab"&&!_.shiftKey?(_.preventDefault(),a(x=>(x+1)%v)):_.key==="ArrowUp"||_.key==="Tab"&&_.shiftKey?(_.preventDefault(),a(x=>(x-1+v)%v)):_.key==="Enter"&&(_.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(_=>{const v=h.get(_.id)??0,x=v===o,w=_.hotkey??(v<9?`⌘${v+1}`:null);return d.jsxs("li",{className:`cmdk-row${x?" cmdk-row--active":""}`,role:"option","aria-selected":x,"data-index":v,onClick:()=>g(_),onMouseMove:()=>a(v),children:[d.jsx("span",{className:"cmdk-row-label",children:_.label}),_.hint&&d.jsx("span",{className:"cmdk-row-hint",children:_.hint}),w&&d.jsx("span",{className:"cmdk-row-key",children:w})]},_.id)})})]},y.group??"__ungrouped__"))})]})})}function aC(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 lU(e){return e.length*8.5+18}function Ax(){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=lU(l);if(u==="right"){const _=a.top+a.height/2-c/2,v=a.right-8-h/2;t.push({key:`hint-${o}`,label:l,top:_,left:v,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 uU(){const e=aC(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(Ax());function s(){n(Ax())}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:Y_.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 lC=typeof CSS<"u"&&"highlights"in CSS,uC="transcript-search",gh="transcript-search-active";function kl(){lC&&(CSS.highlights.delete(uC),CSS.highlights.delete(gh))}function cU(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 dU(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 Nx(e,t){if(!lC)return;const n=e.map(r=>r.range);CSS.highlights.set(uC,new Highlight(...n)),e.length>0&&t>=0&&t<e.length?CSS.highlights.set(gh,new Highlight(e[t].range)):CSS.highlights.delete(gh)}function Mx(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 fU({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(k=>{const S=document.querySelector(".thread-viewport");if(!S){kl(),i([]),a(0);return}const T=k.trim();if(!T){kl(),i([]),a(0);return}const I=cU(S,u.current),P=dU(I,T);i(P),a(E=>{const D=P.length>0?Math.min(E,P.length-1):0;return Nx(P,D),P.length>0&&Mx(P[D]),D})},[]),g=m.useCallback(k=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>p(k),120)},[p]);m.useEffect(()=>{if(!e)return;const k=document.querySelector(".thread-viewport");if(k)return f.current=new MutationObserver(()=>{h.current||(h.current=setTimeout(()=>{h.current=null;const S=l.current?.value??"";p(S)},200))}),f.current.observe(k,{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)):(kl(),i([]),a(0),c.current&&clearTimeout(c.current))},[e]),m.useEffect(()=>()=>{kl(),c.current&&clearTimeout(c.current)},[]);const y=m.useCallback(k=>{if(!s.length)return;const S=(k%s.length+s.length)%s.length;a(S),Nx(s,S),Mx(s[S])},[s]),_=m.useCallback(()=>y(o+1),[y,o]),v=m.useCallback(()=>y(o-1),[y,o]),x=m.useCallback(k=>{k.key==="Escape"?(k.preventDefault(),t()):k.key==="Enter"&&(k.preventDefault(),k.shiftKey?v():_())},[t,_,v]);if(!e)return null;const w=s.length,C=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:k=>{r(k.target.value),g(k.target.value)},onKeyDown:x,autoComplete:"off",spellCheck:!1}),d.jsx("span",{className:"transcript-search-count","aria-live":"polite","aria-atomic":"true",children:w===0?n.trim()?"0":"":`${C}/${w}`}),d.jsx("button",{type:"button",className:"transcript-search-nav",title:"Previous match (Shift+Enter)","aria-label":"Previous match",onClick:v,disabled:w===0,children:"↑"}),d.jsx("button",{type:"button",className:"transcript-search-nav",title:"Next match (Enter)","aria-label":"Next match",onClick:_,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(eh,{size:14})})]})}function hU(e){return e?e===!0?"Using a sub-agent":`Using the ${e} sub-agent`:""}function pU(e,t){const n=hU(t);return!n||!e?e:`${n}. ${e}`}function mU(e){return(e.blocks??[]).filter(t=>t.kind==="text").map(t=>t.text).join(" ")}const gU=18e5,cC="cc_drafts";function yU(){try{return JSON.parse(localStorage.getItem(cC)||"{}")||{}}catch{return{}}}function vU(e){try{localStorage.setItem(cC,JSON.stringify(e))}catch{}}const dC="cc_subagent";function Dx(){try{return JSON.parse(localStorage.getItem(dC)||"{}")||{}}catch{return{}}}function xU(e){try{localStorage.setItem(dC,JSON.stringify(e))}catch{}}const Lx=150,wU=150;function _U(e){return typeof e.content=="string"?e.content:e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
103
+ `)}function bU(){const e=OM(),t=BM(),[n,r]=m.useState(null),s=m.useRef(0),i=m.useCallback((j,L="")=>{r({id:++s.current,text:j,kind:L})},[]);m.useEffect(()=>{const j=()=>{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 j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]),m.useEffect(()=>{let j=0,L=0,K=!0;const q=()=>{if(!K)return;const Le=document.body.classList.contains("is-external-display")&&L>0?L:j>0?j:0;Le>0?document.documentElement.style.setProperty("--txt-transcript",`${Le}px`):document.documentElement.style.removeProperty("--txt-transcript")};return Ik().then(Ae=>{K&&(j=Ae.transcriptFontSize??0,L=Ae.externalFontSize??0,q())}).catch(()=>{}),window.addEventListener("resize",q),()=>{K=!1,window.removeEventListener("resize",q)}},[]),m.useEffect(()=>{const j=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",j),()=>window.removeEventListener("cockpit:ack",j)},[i]);const o=m.useMemo(()=>n2(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(j=>{f.current=j},[]),[p,g]=m.useState(null),y=m.useCallback(async j=>{const L=_U(j).trim(),K=(j.attachments??[]).map(jt=>e2(jt)).filter(jt=>!!jt),q=e.selectedId,Ae=q!=null?E.current[q]??!0:!1,Oe=!f.current&&L?pU(L,Ae):L,Jt=[Oe,...K].filter(Boolean).join(" ");if(!Jt)return;const Nn=e.sendReply(Jt);if(i(Nn?"Sent →":"Not connected — reconnecting…",Nn?"ok":"error"),Nn&&q){const jt=Oe||(K.length?`📎 ${K.length} attachment(s)`:Jt);u(Mn=>[...Mn,{key:++c.current,sessionId:q,text:Jt,label:jt,at:Date.now()}])}},[e,i]),_=m.useRef({});m.useEffect(()=>{const j=e.selectedId;if(!j)return;const L=e.messages,K=_.current[j],q=K==null?L.length:Math.min(K,L.length);if(L.length>q){const Ae=[];for(let Le=q;Le<L.length;Le++){if(L[Le].role!=="user")continue;const Oe=mU(L[Le]).trim();Oe&&Ae.push(Oe)}if(Ae.length){const Le=Oe=>Oe.replace(/\s+/g," ").trim();u(Oe=>{const Jt=[...Oe];for(const Nn of Ae){const jt=Le(Nn),Mn=Jt.map((Dn,hr)=>({e:Dn,i:hr})).filter(({e:Dn})=>Dn.sessionId===j);if(Mn.length===0)continue;const si=Mn.find(({e:Dn})=>{const hr=Le(Dn.text),Wa=Le(Dn.label);return hr===jt||Wa===jt||jt.startsWith(Wa)||hr.startsWith(jt)})??Mn[0];Jt.splice(si.i,1)}return Jt})}}_.current[j]=L.length},[e.selectedId,e.messages]),m.useEffect(()=>{if(l.length===0)return;const j=setInterval(()=>{const L=Date.now()-gU;u(K=>K.some(q=>q.at<L)?K.filter(q=>q.at>=L):K)},5e3);return()=>clearInterval(j)},[l.length]),m.useEffect(()=>{if(!p)return;if(e.selectedId!==p.sessionId||e.messages.length>p.baseCount){g(null);return}const j=setTimeout(()=>g(null),9e4);return()=>clearTimeout(j)},[p,e.selectedId,e.messages.length]);const[v,x]=m.useState(Lx);m.useEffect(()=>{x(Lx)},[e.selectedId]);const w=m.useMemo(()=>Ak(e.messages),[e.messages]),C=Math.max(0,w.length-v),k=m.useMemo(()=>l.filter(j=>j.sessionId===e.selectedId),[l,e.selectedId]),S=m.useMemo(()=>{if(!e.prompt)return null;const j=e.messages;for(let L=j.length-1;L>=0;L--)for(const K of j[L].blocks??[])if(K.kind==="tool_use"&&K.name==="ExitPlanMode"){const q=K.input?.plan;if(typeof q=="string"&&q.trim())return q}return null},[e.prompt,e.messages]),T=m.useMemo(()=>{const j=C>0?w.slice(C):w.slice();for(const q of k){const Ae={role:"user",id:`queued-${q.key}`,createdAt:new Date(q.at),content:[{type:"text",text:q.label}],metadata:{custom:{cockpitRole:"user",optimistic:!0}}};let Le=j.length;for(let Oe=0;Oe<j.length;Oe++){const Jt=j[Oe].createdAt;if(Jt instanceof Date&&Jt.getTime()>q.at){Le=Oe;break}}j.splice(Le,0,Ae)}const L=e.sessions.find(q=>q.id===e.selectedId);return(!!L&&th(L)||p!==null&&p.sessionId===e.selectedId)&&j.push({role:"assistant",id:"optimistic-working",content:[{type:"text",text:"Working…"}],metadata:{custom:{cockpitRole:"assistant",working:!0}}}),j},[w,C,e.selectedId,e.sessions,k,p]),I=m.useCallback(()=>{x(j=>j+wU)},[]),P=Ma({messages:T,isDisabled:!e.selectedId,convertMessage:j=>j,onNew:y,adapters:{attachments:o}}),E=m.useRef(Dx()),[D,M]=m.useState(()=>Dx()),B=m.useCallback((j,L)=>{M(K=>{const q={...K,[j]:L};return E.current=q,xU(q),q})},[]),Q=m.useRef(yU()),U=m.useRef(e.selectedId);m.useEffect(()=>{const j=P.thread.composer,L=()=>{const K=U.current;if(!K)return;const q=j.getState().text??"";q?Q.current[K]=q:delete Q.current[K],vU(Q.current)};return j.subscribe(L)},[P]),m.useEffect(()=>{const j=P.thread.composer,L=e.selectedId,K=L?Q.current[L]??"":"";U.current=L;try{j.reset(),K&&j.setText(K)}catch{}},[e.selectedId,P]);const[te,Z]=m.useState(null),[F,z]=m.useState(!1),[b,W]=m.useState(!1),[X,R]=m.useState(!1),le=4,[we,de]=m.useState([]),[Je,Ue]=m.useState(!1),Ce=m.useCallback(j=>{de(L=>{const K=[...L.filter(q=>q!==j),j];return K.length>le?K.slice(K.length-le):K})},[]);m.useEffect(()=>{Ue(!1);const j=e.selectedId;if(!j)return;const L=setTimeout(()=>{de(K=>K.includes(j)?[...K.filter(q=>q!==j),j]:K.length<le?[...K,j]:K)},500);return()=>clearTimeout(L)},[e.selectedId]);const ee=m.useCallback(()=>{const j=e.selectedId;j&&(Ce(j),Ue(!0))},[e.selectedId,Ce]),ne=m.useCallback(()=>{const j=e.selectedId;j&&Ue(L=>(L||Ce(j),!L))},[e.selectedId,Ce]),[se,he]=m.useState(!1),[mt,ut]=m.useState(null),[rt,Pn]=m.useState(null),[jr,jn]=m.useState(!1),[ps,An]=m.useState(null);m.useEffect(()=>{he(!1),Pn(null)},[e.selectedId]);const gn=m.useCallback(j=>{Pn(L=>L===j?null:j)},[]),ei=m.useCallback(()=>Pn(null),[]),[yn,qn]=m.useState(null),O=m.useRef(null),Y=yn!==null;m.useEffect(()=>{Y&&O.current?.select()},[Y]);const ie=m.useCallback(async()=>{const j=e.selectedId,L=(yn??"").trim();if(qn(null),!j||!L)return;const K=e.sessions.find(q=>q.id===j)?.name;if(L!==K)try{await EM(j,L),i("Renamed →","ok")}catch(q){i(`rename failed: ${q instanceof Error?q.message:"error"}`,"error")}},[e.selectedId,e.sessions,yn,i]),[fe,N]=m.useState(!0),$=km(),oe=m.useRef(null),ke=m.useRef(null),[pe,Ee]=m.useState(()=>{try{return localStorage.getItem("cc:railCollapsed")==="1"}catch{return!1}}),ye=m.useCallback(()=>{Ee(j=>{const L=!j;try{localStorage.setItem("cc:railCollapsed",L?"1":"0")}catch{}return L})},[]),[De,ct]=m.useState(()=>{try{const j=localStorage.getItem("cc:sessionFilter");return j==="claude"||j==="terminal"?j:"all"}catch{return"all"}}),$a=m.useCallback(()=>{ct(j=>{const L=j==="all"?"claude":j==="claude"?"terminal":"all";try{localStorage.setItem("cc:sessionFilter",L)}catch{}return L})},[]),[ms,Em]=m.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem("cc:collapsedSessions")||"[]"))}catch{return new Set}}),lo=m.useCallback(j=>{Em(L=>{const K=new Set(L);K.has(j)?K.delete(j):K.add(j);try{localStorage.setItem("cc:collapsedSessions",JSON.stringify([...K]))}catch{}return K})},[]),ti=m.useRef(!1);m.useEffect(()=>{const j=oe.current;if(!j)return;if($){ft.set(j,{clearProps:"width,flexBasis,opacity"});return}const L=pe?{width:0,flexBasis:0,opacity:0}:{width:300,flexBasis:300,opacity:1};if(lr()||!ti.current){ft.set(j,L),ti.current=!0;return}ft.to(j,{...L,duration:.3,ease:"power3.out"})},[pe,$]),m.useEffect(()=>{const j=ke.current;!j||!e.selectedId||lr()||ft.fromTo(j,{opacity:.35,y:6},{opacity:1,y:0,duration:.22,ease:"power3.out"})},[e.selectedId]),m.useEffect(()=>{if(!e.selectedId)return;let j=null,L=null,K=null,q=null,Ae=0,Le=0,Oe=0,Jt=0,Nn=!0,jt=!1,Mn=!0,si=0;const Dn=()=>!!j&&j.scrollHeight-j.scrollTop-j.clientHeight<80,hr=()=>{L&&(L.dataset.show=j&&!Dn()?"true":"")},Wa=()=>{Le||(Le=requestAnimationFrame(()=>{Le=0,j&&(Nn||Mn)&&!jt&&(j.scrollTop=j.scrollHeight)}))},Am=()=>{Mn&&(Mn=!1,clearTimeout(si),Nn=Dn(),hr())},Nm=()=>{!jt&&!Mn&&(Nn=Dn()),hr()},kc=()=>{jt=!0,Am(),clearTimeout(Oe)},uo=()=>{clearTimeout(Oe),Oe=window.setTimeout(()=>{jt=!1,Nn=Dn(),hr()},160)},Mm=()=>{kc(),uo()},Dm=()=>{if(j=document.querySelector(".thread-viewport"),L=document.querySelector(".scroll-to-bottom"),!j){Jt++<40&&(Ae=requestAnimationFrame(Dm));return}Nn=!0,Mn=!0,j.scrollTop=j.scrollHeight,hr(),clearTimeout(si),si=window.setTimeout(Am,600),j.addEventListener("scroll",Nm,{passive:!0}),j.addEventListener("touchstart",kc,{passive:!0}),j.addEventListener("touchend",uo,{passive:!0}),j.addEventListener("touchcancel",uo,{passive:!0}),j.addEventListener("wheel",Mm,{passive:!0}),K=new MutationObserver(Wa),K.observe(j,{childList:!0,subtree:!0,characterData:!0});const Sc=j.closest(".thread-root"),Cc=Sc?.querySelector(".composer")??null;if(Sc&&Cc&&"ResizeObserver"in window){const Lm=()=>Sc.style.setProperty("--composer-h",`${Cc.offsetHeight}px`);Lm(),q=new ResizeObserver(Lm),q.observe(Cc)}};return Ae=requestAnimationFrame(Dm),()=>{cancelAnimationFrame(Ae),cancelAnimationFrame(Le),clearTimeout(Oe),clearTimeout(si),j&&(j.removeEventListener("scroll",Nm),j.removeEventListener("touchstart",kc),j.removeEventListener("touchend",uo),j.removeEventListener("touchcancel",uo),j.removeEventListener("wheel",Mm)),K&&K.disconnect(),q&&q.disconnect()}},[e.selectedId]);const Gn=m.useCallback(j=>{e.select(j),N(!1),window.location.hash=encodeURIComponent(j)},[e]);m.useEffect(()=>{if(!("serviceWorker"in navigator))return;const j=L=>{const K=L.data;K?.type==="open-session"&&K.id&&Gn(K.id)};return navigator.serviceWorker.addEventListener("message",j),()=>navigator.serviceWorker.removeEventListener("message",j)},[Gn]);const Ua=typeof window<"u"&&(window.matchMedia?.("(display-mode: standalone)").matches||navigator.standalone===!0),ni=t.iosHint&&!Ua&&t.status!=="on",Tm=m.useRef(!1);m.useEffect(()=>{const j=()=>{const L=decodeURIComponent(window.location.hash.replace(/^#/,""));L&&L!==e.selectedId&&e.sessions.some(K=>K.id===L)&&(e.select(L),N(!1))};return!Tm.current&&e.sessions.length>0&&(Tm.current=!0,j()),window.addEventListener("hashchange",j),()=>window.removeEventListener("hashchange",j)},[e,e.sessions,e.selectedId]);const je=e.sessions.find(j=>j.id===e.selectedId),hC=2e4,pC=k.length>0&&k.some(j=>Date.now()-j.at<hC),Va=!!je&&th(je)||pC,Im=m.useCallback(()=>{e.sendPromptKey("Escape"),i("Canceled →")},[e,i]),Rm=e.selectedId!=null?D[e.selectedId]??!0:!0,Pm=m.useCallback(j=>{e.selectedId&&B(e.selectedId,j)},[e.selectedId,B]);m.useEffect(()=>{const j=L=>{(L.metaKey||L.ctrlKey)&&(L.key==="k"||L.key==="K")&&(L.preventDefault(),W(K=>!K))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[]),m.useEffect(()=>{const j=L=>{if(!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey)return;const K=L.key.toLowerCase();K==="b"?(L.preventDefault(),ye()):K==="e"&&je?(L.preventDefault(),qn(je.name??je.id)):K==="j"&&je?(L.preventDefault(),ne()):K==="u"&&e.subagents.length>0&&(L.preventDefault(),ut(null),he(q=>!q))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[je,e.subagents.length,ye,ne]);const Ha=m.useMemo(()=>De==="terminal"?[]:e.sessions.filter(j=>j.kind!=="terminal"&&!ms.has(j.sessionName??"?")).sort((j,L)=>(j.sessionName??"").localeCompare(L.sessionName??"",void 0,{numeric:!0})||(j.windowIndex??0)-(L.windowIndex??0)||(j.paneIndex??0)-(L.paneIndex??0)),[e.sessions,De,ms]),mC=m.useMemo(()=>{const j=new Map;return Ha.slice(0,9).forEach((L,K)=>j.set(L.id,`⌘${K+1}`)),j},[Ha]);m.useEffect(()=>{const j=L=>{if(b||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||!/^[1-9]$/.test(L.key))return;const K=Ha[Number(L.key)-1];if(K){L.preventDefault(),L.stopPropagation();const q=document.activeElement;q&&q.tagName==="IFRAME"&&q.blur();const Ae=document.querySelector(".detail-body")??document.body;Ae.setAttribute("tabindex","-1"),Ae.focus({preventScroll:!0}),Ue(!1),Gn(K.id);const Le=requestAnimationFrame(()=>{const Oe=document.querySelector(".detail-body")??document.body;Oe.setAttribute("tabindex","-1"),Oe.focus({preventScroll:!0})});return()=>cancelAnimationFrame(Le)}};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[Ha,b,Gn,Ue]),m.useEffect(()=>{const j=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 q=document.querySelector(".composer .composer-input");q&&(L.preventDefault(),q.focus())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[]),m.useEffect(()=>{const j=L=>{L.key==="Escape"&&(document.querySelector('[aria-modal="true"]')||document.querySelector(".skill-ac")||f.current||Va&&(L.preventDefault(),e.sendPromptKey("Escape"),i("Canceled →")))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[Va,e,i]),m.useEffect(()=>{const j=L=>{if(!(L.key==="."||L.code==="Period")||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||document.querySelector('[aria-modal="true"]'))return;const q=document.querySelector(".thread-viewport");q&&(L.preventDefault(),q.scrollTo({top:q.scrollHeight,behavior:"smooth"}))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[]);const ri=e.subagents.filter(j=>j.status==="running").length;m.useEffect(()=>{const j=L=>{L.key!=="/"||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||(L.preventDefault(),L.stopPropagation(),R(K=>!K))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[]);const gC=m.useMemo(()=>{const j=q=>q?q.replace(/\/$/,"").split("/").pop()||q:"",L=[],K=[...e.sessions].sort((q,Ae)=>{const Le=q.kind==="terminal"?1:0,Oe=Ae.kind==="terminal"?1:0;return Le!==Oe?Le-Oe:(q.sessionName??"").localeCompare(Ae.sessionName??"",void 0,{numeric:!0})||(q.windowIndex??0)-(Ae.windowIndex??0)||(q.paneIndex??0)-(Ae.paneIndex??0)});for(const q of K){const Ae=q.kind==="terminal";L.push({id:`switch:${q.id}`,label:q.name||q.title||q.tmuxName||q.id,hint:[Ae?"terminal":j(q.cwd),q.pending?"ASK":""].filter(Boolean).join(" · "),keywords:`${q.sessionName??""} ${q.cwd??""} ${q.id}`,group:Ae?"Terminals":"Sessions",run:()=>Gn(q.id)})}return L.push({id:"act:tmux-window",label:"View raw tmux window",hint:je?je.name||je.id:"select a session first",group:"Actions",keywords:"terminal ttyd pane window",run:()=>ee()},{id:"act:new-session",label:"New session",group:"Actions",keywords:"create start claude",run:()=>{i("Creating session…"),Rk({}).then(q=>i(`Session created → ${q.name}`,"ok")).catch(q=>i(`New session failed: ${q.message}`,"error"))}},{id:"act:processes",label:"Processes & system",group:"Actions",keywords:"ps aux kill cpu memory battery power",run:()=>jn(!0)},{id:"act:settings",label:"Settings",group:"Actions",keywords:"config preferences model mlx",run:()=>z(!0)},{id:"act:toggle-sidebar",label:pe?"Show sidebar":"Hide sidebar (focus mode)",group:"Actions",keywords:"rail collapse focus",run:()=>ye()},{id:"act:reload",label:"Reload app",group:"Actions",keywords:"refresh",run:()=>window.location.reload()}),L},[e.sessions,e.selectedId,je,pe,Gn,ye,i,ee]),yC=je?.thinking&&w.length>0?w[w.length-1].id??null:null,jm=m.useRef(null),{pull:_c,refreshing:bc}=HM(jm),vC=aC(500);return d.jsx(Da,{runtime:P,children:d.jsx(i$,{children:d.jsxs("div",{ref:jm,className:"app","data-detail":e.selectedId&&!fe?"open":"closed","data-rail-collapsed":!$&&pe?"true":void 0,"data-cmd-held":vC?"true":void 0,children:[_c>0||bc?d.jsx("div",{className:"ptr-indicator",style:{transform:`translate(-50%, ${Math.round(_c)}px)`},"data-ready":!bc&&_c>=WM?"true":void 0,"data-refreshing":bc?"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(OD,{resources:e.resources,conn:e.conn,push:t}),d.jsx(U5,{}),ni?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:oe,children:[d.jsx(H5,{onToast:i,filter:De,onCycleFilter:$a}),d.jsx("div",{className:"rail-scroll",children:d.jsx(MD,{sessions:e.sessions,selectedId:e.selectedId,onSelect:Gn,filter:De,collapsed:ms,onToggleCollapse:lo,hotkeyById:mC})}),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:()=>z(!0),children:[d.jsx(CD,{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:()=>jn(!0),children:d.jsx(ED,{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:()=>N(!0),children:"‹"}),d.jsx("div",{className:"detail-title",children:yn!==null?d.jsx("input",{ref:O,className:"detail-rename-input",type:"text",value:yn,"aria-label":"Session name",onChange:j=>qn(j.target.value),onKeyDown:j=>{j.key==="Enter"?(j.preventDefault(),ie()):j.key==="Escape"&&(j.preventDefault(),qn(null))},onBlur:()=>void ie()}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"detail-name",children:je?.name||e.selectedId||"claude control"}),je?.cwd?d.jsx("span",{className:"detail-cwd",title:je.cwd,children:je.cwd.replace(/\/$/,"").split("/").pop()||je.cwd}):null]})}),d.jsxs("div",{className:"detail-actions",children:[je&&yn===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:()=>qn(je.name??je.id),children:d.jsx(bD,{})}),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:ee,children:d.jsx(PS,{})}),d.jsx("button",{type:"button",className:"detail-action","aria-pressed":X,"data-on":X?"true":void 0,"aria-label":"Search transcript",title:"Search transcript (⌘/)","data-hotkey":"⌘/","data-hotkey-dir":"down",onClick:()=>R(j=>!j),children:d.jsx(RD,{})}),e.subagents.length>0?d.jsxs("button",{type:"button",className:"detail-action detail-action--count","aria-pressed":se,"data-on":se?"true":void 0,"data-running":ri>0?"true":void 0,"aria-label":ri>0?`${ri} sub-agent${ri===1?"":"s"} running`:"Sub-agents",title:"Sub-agents (⌘U)","data-hotkey":"⌘U","data-hotkey-dir":"down",onClick:()=>{ut(null),he(j=>!j)},children:[d.jsx(kD,{}),ri>0?d.jsx("span",{className:"detail-action-count",children:ri}):null]}):null]}):null,d.jsx("button",{type:"button",className:"detail-action focus-toggle","aria-pressed":pe,"aria-label":pe?"Show sidebar":"Focus mode (hide sidebar)",title:pe?"Show sidebar (⌘B)":"Focus mode (hide sidebar) (⌘B)","data-hotkey":"⌘B","data-hotkey-dir":"down",onClick:ye,children:d.jsx(SD,{})})]})]}),d.jsx("div",{className:"detail-body",ref:ke,children:d.jsx(Z1.Provider,{value:a,children:je&&je.kind==="terminal"?d.jsx(O5,{sessionId:je.id,capture:e.capture,requestCapture:e.requestCapture,clearCapture:e.clearCapture,sendText:e.sendPaneText,sendKey:e.sendPaneKey}):je&&!je.transcriptPath?d.jsxs("div",{className:"thread-root",children:[d.jsx("div",{className:"thread-fade","aria-hidden":"true"}),(()=>{const j=rt?e.subagents.find(L=>L.agentId===rt)??null:null;return j?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:ei,children:"‹ back"}),d.jsxs("span",{className:"agent-inline-title",children:[d.jsx("span",{className:"sa-dot","data-status":j.status,"aria-hidden":"true"}),d.jsx("span",{className:"agent-inline-name",children:j.agentType||"sub-agent"}),d.jsx("span",{className:"agent-inline-status",children:j.status==="running"?"· running":"· done"})]})]}),d.jsx(Sm,{messages:j.messages})]}):d.jsxs(d.Fragment,{children:[d.jsx(D5,{sessionId:je.id,capture:e.capture,requestCapture:e.requestCapture,clearCapture:e.clearCapture}),k.length>0?d.jsx("div",{className:"live-pending","aria-label":"Queued sends",children:k.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(iC,{subagents:e.subagents,onOpenAgent:gn,viewingAgentId:rt}),d.jsx(rC,{disabled:!1,sessionId:e.selectedId,subAgentMode:Rm,onSubAgentModeChange:Pm,onTerminalModeChange:h,working:Va,onStop:Im})]}):d.jsxs("div",{className:"detail-split",children:[d.jsx(Y1.Provider,{value:yC,children:d.jsx(k5,{hasSelection:!!e.selectedId,loading:!e.messagesLoaded,sessionId:e.selectedId,hiddenCount:C,onLoadEarlier:I,subAgentMode:Rm,onSubAgentModeChange:Pm,onTerminalModeChange:h,subagents:e.subagents,onOpenAgent:gn,viewingAgent:rt?e.subagents.find(j=>j.agentId===rt)??null:null,onCloseAgent:ei,working:Va,onStop:Im})}),d.jsx(N5,{}),d.jsx(fU,{open:X,onClose:()=>R(!1)})]})})})]})]}),e.pending&&e.pending.toolUseId!==te?d.jsx(F5,{pending:e.pending,capture:e.capture,onAnswer:(j,L)=>{e.sendAnswer(j,L),Z(j),e.clearCapture(),e.selectedId&&g({sessionId:e.selectedId,baseCount:e.messages.length})},onCapture:e.requestCapture,onClose:()=>{Z(e.pending?.toolUseId??null),e.clearCapture()}},e.pending.toolUseId):null,F?d.jsx(V5,{onClose:()=>z(!1),onToast:i}):null,we.map(j=>d.jsx(q5,{sessionId:j,visible:j===e.selectedId&&Je,label:e.sessions.find(L=>L.id===j)?.name??j,onClose:()=>Ue(!1)},j)),d.jsx(nU,{subagents:e.subagents,open:se&&e.subagents.length>0,onClose:()=>he(!1),focusAgentId:mt}),jr?d.jsx(sU,{power:e.resources.snapshot?.power??null,history:e.resourceHistory,onClose:()=>jn(!1),onToast:i}):null,b?d.jsx(aU,{commands:gC,onClose:()=>W(!1)}):null,e.prompt&&!e.pending&&JSON.stringify(e.prompt)!==ps?d.jsx(X5,{prompt:e.prompt,planMarkdown:S,onKey:j=>e.sendPromptKey(j),onSelect:j=>e.selectedId?e.sendPromptSelect(e.selectedId,j):!1,onClose:()=>An(JSON.stringify(e.prompt))}):null,d.jsx(uU,{}),d.jsx(B5,{toast:n})]})})})}function kU(){return d.jsx(G5,{children:d.jsx(bU,{})})}const fC=document.getElementById("root");if(!fC)throw new Error("#root not found");Q_(fC).render(d.jsx(m.StrictMode,{children:d.jsx(kU,{})}));export{Ia as g};